From 4f9eecdd1355b493112c24c340aaf31befc69ce9 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 29 Dec 2019 19:14:47 +1000 Subject: [PATCH] Decompile incrementKillCount, incrementKnockoutCount and decrementKnockoutCount --- src/game/chr/chr.c | 8 +++---- src/game/game_0b0420.c | 39 +++++++++++----------------------- src/include/game/game_0b0420.h | 7 +++--- src/include/gvars/gvars.h | 5 +---- 4 files changed, 21 insertions(+), 38 deletions(-) diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 2789e7775..3ed4f5e44 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -22610,7 +22610,7 @@ glabel func0f0319a8 /* f031a18: 24190001 */ addiu $t9,$zero,0x1 /* f031a1c: afb900e8 */ sw $t9,0xe8($sp) .L0f031a20: -/* f031a20: 0fc2c15d */ jal func0f0b0574 +/* f031a20: 0fc2c15d */ jal decrementKnockoutCount /* f031a24: afa700ec */ sw $a3,0xec($sp) /* f031a28: 8fa700ec */ lw $a3,0xec($sp) .L0f031a2c: @@ -23712,7 +23712,7 @@ glabel func0f0319a8 /* f032a0c: 000ecac0 */ sll $t9,$t6,0xb /* f032a10: 07210004 */ bgez $t9,.L0f032a24 /* f032a14: 00000000 */ sll $zero,$zero,0x0 -/* f032a18: 0fc2c151 */ jal func0f0b0544 +/* f032a18: 0fc2c151 */ jal incrementKillCount /* f032a1c: 00000000 */ sll $zero,$zero,0x0 /* f032a20: 8fa20040 */ lw $v0,0x40($sp) .L0f032a24: @@ -24617,7 +24617,7 @@ glabel func0f0336a8 /* f0336f8: 01c17825 */ or $t7,$t6,$at /* f0336fc: ac8f0018 */ sw $t7,0x18($a0) .L0f033700: -/* f033700: 0fc2c157 */ jal func0f0b055c +/* f033700: 0fc2c157 */ jal incrementKnockoutCount /* f033704: afa40018 */ sw $a0,0x18($sp) /* f033708: 8fa40018 */ lw $a0,0x18($sp) /* f03370c: 24180020 */ addiu $t8,$zero,0x20 @@ -27508,7 +27508,7 @@ glabel func0f034524 /* f03602c: 000a5ac0 */ sll $t3,$t2,0xb /* f036030: 05630004 */ bgezl $t3,.L0f036044 /* f036034: 8e0202d4 */ lw $v0,0x2d4($s0) -/* f036038: 0fc2c151 */ jal func0f0b0544 +/* f036038: 0fc2c151 */ jal incrementKillCount /* f03603c: 00000000 */ sll $zero,$zero,0x0 /* f036040: 8e0202d4 */ lw $v0,0x2d4($s0) .L0f036044: diff --git a/src/game/game_0b0420.c b/src/game/game_0b0420.c index a415cb983..2c3df29ae 100644 --- a/src/game/game_0b0420.c +++ b/src/game/game_0b0420.c @@ -188,35 +188,20 @@ glabel func0f0b052c /* f0b0540: 8f020000 */ lw $v0,0x0($t8) ); -GLOBAL_ASM( -glabel func0f0b0544 -/* f0b0544: 3c02800a */ lui $v0,%hi(g_Vars) -/* f0b0548: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f0b054c: 8c4e02b0 */ lw $t6,0x2b0($v0) -/* f0b0550: 25cf0001 */ addiu $t7,$t6,0x1 -/* f0b0554: 03e00008 */ jr $ra -/* f0b0558: ac4f02b0 */ sw $t7,0x2b0($v0) -); +void incrementKillCount(void) +{ + g_Vars.killcount++; +} -GLOBAL_ASM( -glabel func0f0b055c -/* f0b055c: 3c02800a */ lui $v0,%hi(g_Vars) -/* f0b0560: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f0b0564: 8c4e02b4 */ lw $t6,0x2b4($v0) -/* f0b0568: 25cf0001 */ addiu $t7,$t6,0x1 -/* f0b056c: 03e00008 */ jr $ra -/* f0b0570: ac4f02b4 */ sw $t7,0x2b4($v0) -); +void incrementKnockoutCount(void) +{ + g_Vars.knockoutcount++; +} -GLOBAL_ASM( -glabel func0f0b0574 -/* f0b0574: 3c02800a */ lui $v0,%hi(g_Vars) -/* f0b0578: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f0b057c: 8c4e02b4 */ lw $t6,0x2b4($v0) -/* f0b0580: 25cfffff */ addiu $t7,$t6,-1 -/* f0b0584: 03e00008 */ jr $ra -/* f0b0588: ac4f02b4 */ sw $t7,0x2b4($v0) -); +void decrementKnockoutCount(void) +{ + g_Vars.knockoutcount--; +} u8 getKnockoutCount(void) { diff --git a/src/include/game/game_0b0420.h b/src/include/game/game_0b0420.h index 2e2197c6e..ada69693e 100644 --- a/src/include/game/game_0b0420.h +++ b/src/include/game/game_0b0420.h @@ -7,10 +7,11 @@ u32 func0f0b0420(void); u32 func0f0b046c(void); u32 func0f0b0520(void); u32 func0f0b052c(void); -u32 func0f0b0544(void); -u32 func0f0b055c(void); -u32 func0f0b0574(void); +void incrementKillCount(void); +void incrementKnockoutCount(void); +void decrementKnockoutCount(void); u8 getKnockoutCount(void); +u32 getKillCount(void); u32 func0f0b05a4(void); u32 func0f0b073c(void); u32 func0f0b0764(void); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 965133c44..a80980cb8 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -57,10 +57,7 @@ struct g_vars { /*0002a8*/ struct player *anti; // Counter-op /*0002ac*/ u32 unk0002ac; // 7 if currentplayer has finished auto walking /*0002b0*/ s32 killcount; - /*0002b4*/ u8 unk0002b4; - /*0002b5*/ u8 unk0002b5; - /*0002b6*/ u8 unk0002b6; - /*0002b7*/ u8 knockoutcount; + /*0002b4*/ u32 knockoutcount; /*0002b8*/ u32 unk0002b8; /*0002bc*/ s32 roomcount; /*0002c0*/ u32 unk0002c0;