Skip to content

Instantly share code, notes, and snippets.

@zid
Created November 11, 2018 21:59
Show Gist options
  • Save zid/5b7941891149ca4401b1fd73ff475e63 to your computer and use it in GitHub Desktop.
Save zid/5b7941891149ca4401b1fd73ff475e63 to your computer and use it in GitHub Desktop.
signed int __cdecl sub_41CC00(struct player *a1)
{
__int16 v1; // ax@1
unsigned int v2; // edi@1
int v3; // ebp@1
unsigned int v4; // ebx@4
int v5; // eax@5
unsigned int v6; // ecx@13
__int16 v7; // ax@25
int v8; // edx@25
int v9; // eax@27
int v11; // eax@29
int v12; // eax@31
v1 = a1->logged_in;
v2 = a1->decos;
v3 = a1->info.decos - v2;
if ( v1 & 1 && a1->info.decos != v2 )
{
if ( a1->info.decos <= v2 )
{
if ( !(frame_counter % 7u) )
{
v12 = a1->num;
if ( (!a1->num || !byte_4B1710) && v2 <= 0x186A0 )
{
sfx_play(SFX_NAVI);
v12 = a1->num;
if ( !a1->num )
byte_4B1710 = 1;
}
if ( v12 == 1 )
byte_4B1710 = 0;
}
if ( frame_counter % 5u )
goto LABEL_41;
v11 = a1->decos - 1;
}
else
{
v4 = frame_counter;
if ( !(frame_counter % 7u) )
{
v5 = a1->num;
if ( (!a1->num || !byte_4B1711) && v2 < 100000 )
{
sfx_play(SFX_PREROTATE);
v5 = a1->num;
v4 = frame_counter;
if ( !a1->num )
byte_4B1711 = 1;
}
if ( v5 == 1 )
byte_4B1711 = 0;
}
if ( v4 % 5 || (v6 = a1->field_121C, v6 > 0x32) )
{
if ( v4 & 3 || (v6 = a1->field_121C, v6 <= 0x32) || v6 > 0x1F4 )
{
if ( v4 % 3 || (v6 = a1->field_121C, v6 <= 0x1F4) || v6 > 0x7D0 )
{
if ( v4 & 1 || (v6 = a1->field_121C, v6 <= 0x7D0) || v6 > 0x2710 )
{
v6 = a1->field_121C;
if ( v6 <= 0x2710 )
goto LABEL_41;
}
}
}
}
if ( ++a1->field_1218 > 60 )
{
v7 = a1->field_121A;
v8 = a1->field_121A;
a1->field_1218 = 0;
if ( 11 * v8 > v8 )
a1->field_121A = 11 * v7;
}
v9 = (((0x66666667 * a1->field_121A >> 32) >> 2) + ((0x66666667 * a1->field_121A >> 32) >> 31));
if ( v3 >= v9 )
{
a1->decos += v9;
a1->field_121C = v6 + v9;
split_decos_to_medals(a1);
return 0;
}
v11 = v3 + a1->decos;
a1->field_121C = v3 + v6;
}
a1->decos = v11;
LABEL_41:
split_decos_to_medals(a1);
return 0;
}
a1->logged_in = v1 & 0xFFEF;
byte_4B1711 = 0;
byte_4B1710 = 0;
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment