diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 0a512f6c9..a8f558495 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -3806,90 +3806,35 @@ void func0f0220ac(struct chrdata *chr) func0f065cb0(chr->prop); } -GLOBAL_ASM( -glabel func0f0220ec -/* f0220ec: 3c03800a */ lui $v1,%hi(g_Vars) -/* f0220f0: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars) -/* f0220f4: 27bdffe0 */ addiu $sp,$sp,-32 -/* f0220f8: 8c6e02ac */ lw $t6,0x2ac($v1) -/* f0220fc: afbf001c */ sw $ra,0x1c($sp) -/* f022100: afb00018 */ sw $s0,0x18($sp) -/* f022104: afa50024 */ sw $a1,0x24($sp) -/* f022108: 24020006 */ addiu $v0,$zero,0x6 -/* f02210c: 00803825 */ or $a3,$a0,$zero -/* f022110: 144e001f */ bne $v0,$t6,.L0f022190 -/* f022114: 8c900020 */ lw $s0,0x20($a0) -/* f022118: 8c8f001c */ lw $t7,0x1c($a0) -/* f02211c: 91f80000 */ lbu $t8,0x0($t7) -/* f022120: 54580006 */ bnel $v0,$t8,.L0f02213c -/* f022124: 8e020020 */ lw $v0,0x20($s0) -/* f022128: 8c990014 */ lw $t9,0x14($a0) -/* f02212c: 2401f7ff */ addiu $at,$zero,-2049 -/* f022130: 03214024 */ and $t0,$t9,$at -/* f022134: ac880014 */ sw $t0,0x14($a0) -/* f022138: 8e020020 */ lw $v0,0x20($s0) -.L0f02213c: -/* f02213c: 50400015 */ beqzl $v0,.L0f022194 -/* f022140: 8ce20018 */ lw $v0,0x18($a3) -/* f022144: 844a0000 */ lh $t2,0x0($v0) -/* f022148: 3c098006 */ lui $t1,%hi(g_Anims) -/* f02214c: 8d29f00c */ lw $t1,%lo(g_Anims)($t1) -/* f022150: 000a5880 */ sll $t3,$t2,0x2 -/* f022154: 016a5823 */ subu $t3,$t3,$t2 -/* f022158: 000b5880 */ sll $t3,$t3,0x2 -/* f02215c: 012b6021 */ addu $t4,$t1,$t3 -/* f022160: 918d000b */ lbu $t5,0xb($t4) -/* f022164: 8faf0024 */ lw $t7,0x24($sp) -/* f022168: 31ae0002 */ andi $t6,$t5,0x2 -/* f02216c: 51c00009 */ beqzl $t6,.L0f022194 -/* f022170: 8ce20018 */ lw $v0,0x18($a3) -/* f022174: 59e00007 */ blezl $t7,.L0f022194 -/* f022178: 8ce20018 */ lw $v0,0x18($a3) -/* f02217c: 906204e2 */ lbu $v0,0x4e2($v1) -/* f022180: 18400003 */ blez $v0,.L0f022190 -/* f022184: 0002c080 */ sll $t8,$v0,0x2 -/* f022188: 01f8c821 */ addu $t9,$t7,$t8 -/* f02218c: afb90024 */ sw $t9,0x24($sp) -.L0f022190: -/* f022190: 8ce20018 */ lw $v0,0x18($a3) -.L0f022194: -/* f022194: 3c01dfff */ lui $at,0xdfff -/* f022198: 3421ffff */ ori $at,$at,0xffff -/* f02219c: 00024080 */ sll $t0,$v0,0x2 -/* f0221a0: 05010003 */ bgez $t0,.L0f0221b0 -/* f0221a4: 00415024 */ and $t2,$v0,$at -/* f0221a8: 10000015 */ b .L0f022200 -/* f0221ac: acea0018 */ sw $t2,0x18($a3) -.L0f0221b0: -/* f0221b0: 10c00010 */ beqz $a2,.L0f0221f4 -/* f0221b4: 02002025 */ or $a0,$s0,$zero -/* f0221b8: 8ce90014 */ lw $t1,0x14($a3) -/* f0221bc: 02002025 */ or $a0,$s0,$zero -/* f0221c0: 312b0800 */ andi $t3,$t1,0x800 -/* f0221c4: 5560000f */ bnezl $t3,.L0f022204 -/* f0221c8: 8fbf001c */ lw $ra,0x1c($sp) -/* f0221cc: 0c006b43 */ jal modelGetRootPosition -/* f0221d0: 24e500c8 */ addiu $a1,$a3,0xc8 -/* f0221d4: 02002025 */ or $a0,$s0,$zero -/* f0221d8: 8fa50024 */ lw $a1,0x24($sp) -/* f0221dc: 0c007b86 */ jal func0001ee18 -/* f0221e0: 24060001 */ addiu $a2,$zero,0x1 -/* f0221e4: 0c006cef */ jal func0001b3bc -/* f0221e8: 02002025 */ or $a0,$s0,$zero -/* f0221ec: 10000005 */ b .L0f022204 -/* f0221f0: 8fbf001c */ lw $ra,0x1c($sp) -.L0f0221f4: -/* f0221f4: 8fa50024 */ lw $a1,0x24($sp) -/* f0221f8: 0c007b86 */ jal func0001ee18 -/* f0221fc: 00003025 */ or $a2,$zero,$zero -.L0f022200: -/* f022200: 8fbf001c */ lw $ra,0x1c($sp) -.L0f022204: -/* f022204: 8fb00018 */ lw $s0,0x18($sp) -/* f022208: 27bd0020 */ addiu $sp,$sp,0x20 -/* f02220c: 03e00008 */ jr $ra -/* f022210: 00000000 */ nop -); +void func0f0220ec(struct chrdata *chr, s32 arg1, s32 arg2) +{ + struct model *model = chr->model; + + if (g_Vars.tickmode == TICKMODE_6) { + if (chr->prop->type == PROPTYPE_PLAYER) { + chr->hidden &= ~CHRHFLAG_KEEP_CORPSE; + } + + if (model->anim + && (g_Anims[model->anim->animnum].flags & ANIMFLAG_02) + && arg1 > 0 + && g_Vars.unk0004e2 > 0) { + arg1 += g_Vars.unk0004e2 * 4; + } + } + + if ((chr->chrflags & CHRCFLAG_20000000)) { + chr->chrflags &= ~CHRCFLAG_20000000; + } else if (arg2) { + if ((chr->hidden & CHRHFLAG_KEEP_CORPSE) == 0) { + modelGetRootPosition(model, &chr->prevpos); + func0001ee18(model, arg1, 1); + func0001b3bc(model); + } + } else { + func0001ee18(model, arg1, 0); + } +} GLOBAL_ASM( glabel func0f022214 diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 180db58fa..f9114860d 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -20955,7 +20955,7 @@ glabel currentPlayerIsUsingSecondaryFunction void currentPlayerTickInventory(bool triggeron) { - bool gunsfiring[2] = {false, false}; + s32 gunsfiring[2] = {false, false}; struct player *player = g_Vars.currentplayer; s32 i; @@ -20970,7 +20970,7 @@ void currentPlayerTickInventory(bool triggeron) } if (g_Vars.currentplayer->weaponnum != WEAPON_UNARMED - && g_Vars.currentplayer->unk1582 != (u32)WEAPON_UNARMED) { + && g_Vars.currentplayer->unk1582 != WEAPON_UNARMED) { currentPlayerEquipWeapon(WEAPON_UNARMED); } diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index 95d43fd24..9ee3d97ca 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -47,7 +47,7 @@ u32 func0f09c01c(void); u32 func0f09cb44(void); u32 func0f09cb5c(void); u32 func0f09cd18(void); -void func0f09cdc4(u32 hand); +void func0f09cdc4(s32 hand); void func0f09ce8c(void); u32 func0f09ceac(void); f32 func0f09cf58(u32 arg0); @@ -139,7 +139,7 @@ u32 func0f0a7d5c(void); void func0f0a7d98(u8 *arg0, struct prop *prop, s32 arg2); u32 func0f0a8404(void); u32 func0f0a84c8(void); -void func0f0a8910(u32 hand, bool firing); +void func0f0a8910(s32 hand, bool firing); u32 currentPlayerConsiderToggleGunFunction(s32 usedowntime, bool firing, s32 arg2); void func0f0a8c50(void); bool currentPlayerIsUsingSecondaryFunction(void); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 82629d0b1..eed98ddea 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -52,7 +52,7 @@ struct g_vars { /*0002a0*/ struct player *bond; // Joanna /*0002a4*/ struct player *coop; // Co-op buddy when controlled by human /*0002a8*/ struct player *anti; // Counter-op - /*0002ac*/ u32 tickmode; + /*0002ac*/ s32 tickmode; /*0002b0*/ s32 killcount; /*0002b4*/ u32 knockoutcount; /*0002b8*/ struct textoverride *textoverrides; diff --git a/src/include/types.h b/src/include/types.h index cc51f37c1..d5118feff 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2350,11 +2350,11 @@ struct player { /*0x15f4*/ u32 unk15f4; /*0x15f8*/ u32 unk15f8; /*0x15fc*/ u32 unk15fc; - /*0x1600*/ u32 doautoselect; + /*0x1600*/ s32 doautoselect; /*0x1604*/ u32 playertriggeron; /*0x1608*/ u32 playertriggerprev; /*0x160c*/ s32 playertrigtime240; - /*0x1610*/ u32 curguntofire; // 0 or 1, for dual wielding + /*0x1610*/ s32 curguntofire; // 0 or 1, for dual wielding /*0x1614*/ u8 gunshadecol[4]; /*0x1618*/ s16 resetshadecol; /*0x161a*/ u16 floorcol;