From 932dfee969411c76286201eb7e1142ae5072ee37 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 23 Jun 2020 17:27:57 +1000 Subject: [PATCH] Decompile propPrintDangerous --- src/game/chr/chraction.c | 81 +++++++++++++++----------------- src/game/explosion.c | 4 +- src/game/game_097ba0.c | 2 +- src/game/propobj.c | 8 ++-- src/include/game/chr/chraction.h | 6 +-- 5 files changed, 49 insertions(+), 52 deletions(-) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 05c5b782e..92d657771 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -67,23 +67,6 @@ const char var7f1a8b1c[] = "on"; const char var7f1a8b20[] = "off"; const char var7f1a8b24[] = "firecount(%d) = %d"; const char var7f1a8b38[] = "numshots(%d) = %d"; -const char var7f1a8b4c[] = "Current dangerous items:"; -const char var7f1a8b68[] = " Grenade %x"; -const char var7f1a8b78[] = " Explosion %x"; -const char var7f1a8b8c[] = "misc dangerous prop"; -const char var7f1a8ba0[] = "chraction.c"; -const char var7f1a8bac[] = "chraction.c"; -const char var7f1a8bb8[] = "chraction.c"; -const char var7f1a8bc4[] = "chraction.c"; -const char var7f1a8bd0[] = "chraction.c"; -const char var7f1a8bdc[] = "chraction.c"; -const char var7f1a8be8[] = "CHARS -> FRAMETIMESCALEI(240) = %d"; -const char var7f1a8c0c[] = "CHARS -> numseenbond1 \t= %d/%d"; -const char var7f1a8c30[] = "CHARS -> numseenbond2 \t= %d/%d"; -const char var7f1a8c54[] = "CHARS -> numseenbond3 \t= %d/%d"; -const char var7f1a8c78[] = "CHARS -> numseenbond \t= %d/%d"; -const char var7f1a8c9c[] = "CHARS -> DEAD = %d/%d"; -const char var7f1a8cb4[] = "chrdisttopad : %x -> %d : Dist=%f"; u32 var80068260 = 0x00000000; u32 var80068264 = 0x00000000; @@ -20037,30 +20020,30 @@ glabel chrTickAttackRoll /* f043940: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f043944 -/* f043944: 3c05800a */ lui $a1,%hi(g_DangerousProps) -/* f043948: 24a5cc00 */ addiu $a1,$a1,%lo(g_DangerousProps) -/* f04394c: 00001025 */ or $v0,$zero,$zero -.L0f043950: -/* f043950: 00027080 */ sll $t6,$v0,0x2 -/* f043954: 00ae7821 */ addu $t7,$a1,$t6 -/* f043958: 8de30000 */ lw $v1,0x0($t7) -/* f04395c: 24420001 */ addiu $v0,$v0,0x1 -/* f043960: 305900ff */ andi $t9,$v0,0xff -/* f043964: 10600004 */ beqz $v1,.L0f043978 -/* f043968: 2b21000c */ slti $at,$t9,0xc -/* f04396c: 8c640004 */ lw $a0,0x4($v1) -/* f043970: 10800001 */ beqz $a0,.L0f043978 -/* f043974: 00000000 */ sll $zero,$zero,0x0 -.L0f043978: -/* f043978: 1420fff5 */ bnez $at,.L0f043950 -/* f04397c: 03201025 */ or $v0,$t9,$zero -/* f043980: 03e00008 */ jr $ra -/* f043984: 00000000 */ sll $zero,$zero,0x0 -); +void propPrintDangerous(void) +{ + u8 i; -void unregisterDangerousProp(struct prop *prop) + osSyncPrintf("Current dangerous items:"); + + for (i = 0; i < MAX_DANGEROUSPROPS; i++) { + struct prop *prop = g_DangerousProps[i]; + + if (prop) { + if (prop->weapon + && prop->weapon->weaponnum == WEAPON_GRENADE + && prop->type == PROPTYPE_WEAPON) { + osSyncPrintf(" Grenade %x", prop); + } else if (prop->type == PROPTYPE_EXPLOSION) { + osSyncPrintf(" Explosion %x", prop); + } else { + osSyncPrintf("misc dangerous prop"); + } + } + } +} + +void propUnsetDangerous(struct prop *prop) { s32 i; @@ -20072,7 +20055,7 @@ void unregisterDangerousProp(struct prop *prop) } } -void registerDangerousProp(struct prop *prop) +void propSetDangerous(struct prop *prop) { s32 i; @@ -20185,6 +20168,20 @@ void chrTickBondDie(struct chrdata *chr) // empty } +const char var7f1a8ba0[] = "chraction.c"; +const char var7f1a8bac[] = "chraction.c"; +const char var7f1a8bb8[] = "chraction.c"; +const char var7f1a8bc4[] = "chraction.c"; +const char var7f1a8bd0[] = "chraction.c"; +const char var7f1a8bdc[] = "chraction.c"; +const char var7f1a8be8[] = "CHARS -> FRAMETIMESCALEI(240) = %d"; +const char var7f1a8c0c[] = "CHARS -> numseenbond1 \t= %d/%d"; +const char var7f1a8c30[] = "CHARS -> numseenbond2 \t= %d/%d"; +const char var7f1a8c54[] = "CHARS -> numseenbond3 \t= %d/%d"; +const char var7f1a8c78[] = "CHARS -> numseenbond \t= %d/%d"; +const char var7f1a8c9c[] = "CHARS -> DEAD = %d/%d"; +const char var7f1a8cb4[] = "chrdisttopad : %x -> %d : Dist=%f"; + GLOBAL_ASM( glabel func0f043f2c .late_rodata @@ -24096,7 +24093,7 @@ glabel func0f048398 /* f048598: 00000000 */ sll $zero,$zero,0x0 /* f04859c: 10400003 */ beqz $v0,.L0f0485ac /* f0485a0: 00000000 */ sll $zero,$zero,0x0 -/* f0485a4: 0fc10e51 */ jal func0f043944 +/* f0485a4: 0fc10e51 */ jal propPrintDangerous /* f0485a8: 00000000 */ sll $zero,$zero,0x0 .L0f0485ac: /* f0485ac: 3c02800a */ lui $v0,%hi(g_Vars+0x4d2) diff --git a/src/game/explosion.c b/src/game/explosion.c index 536186673..ba57779d6 100644 --- a/src/game/explosion.c +++ b/src/game/explosion.c @@ -475,7 +475,7 @@ glabel var7f1b5584 /* f12a318: 86ac0028 */ lh $t4,0x28($s5) /* f12a31c: 11f90004 */ beq $t7,$t9,.L0f12a330 /* f12a320: 02a02025 */ or $a0,$s5,$zero -/* f12a324: 0fc10e70 */ jal registerDangerousProp +/* f12a324: 0fc10e70 */ jal propSetDangerous /* f12a328: afaa0158 */ sw $t2,0x158($sp) /* f12a32c: 8faa0158 */ lw $t2,0x158($sp) .L0f12a330: @@ -2790,7 +2790,7 @@ glabel var7f1b55a8 /* f12c554: 24010001 */ addiu $at,$zero,0x1 /* f12c558: 51a10004 */ beql $t5,$at,.L0f12c56c /* f12c55c: ae200000 */ sw $zero,0x0($s1) -/* f12c560: 0fc10e62 */ jal unregisterDangerousProp +/* f12c560: 0fc10e62 */ jal propUnsetDangerous /* f12c564: 8e240000 */ lw $a0,0x0($s1) /* f12c568: ae200000 */ sw $zero,0x0($s1) .L0f12c56c: diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 523f6863d..51aaa1dab 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -9306,7 +9306,7 @@ glabel var7f1ac704 .L0f09ef90: /* f09ef90: 8ca40014 */ lw $a0,0x14($a1) /* f09ef94: afa800b0 */ sw $t0,0xb0($sp) -/* f09ef98: 0fc10e70 */ jal registerDangerousProp +/* f09ef98: 0fc10e70 */ jal propSetDangerous /* f09ef9c: afa500a4 */ sw $a1,0xa4($sp) /* f09efa0: 8fa500a4 */ lw $a1,0xa4($sp) /* f09efa4: 8fa800b0 */ lw $t0,0xb0($sp) diff --git a/src/game/propobj.c b/src/game/propobj.c index 41b6659db..ec68e089c 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -11100,7 +11100,7 @@ glabel var7f1aa2c4 /* f06f73c: 00797023 */ subu $t6,$v1,$t9 /* f06f740: 05c10393 */ bgez $t6,.L0f070590 /* f06f744: a5ee0062 */ sh $t6,0x62($t7) -/* f06f748: 0fc10e62 */ jal unregisterDangerousProp +/* f06f748: 0fc10e62 */ jal propUnsetDangerous /* f06f74c: 8fa401b0 */ lw $a0,0x1b0($sp) /* f06f750: 8fb801a8 */ lw $t8,0x1a8($sp) /* f06f754: 24010002 */ addiu $at,$zero,0x2 @@ -11243,7 +11243,7 @@ glabel var7f1aa2c4 /* f06f93c: 8fa601b0 */ lw $a2,0x1b0($sp) /* f06f940: 0fc0287e */ jal func0f00a1f8 /* f06f944: 24c40008 */ addiu $a0,$a2,0x8 -/* f06f948: 0fc10e62 */ jal unregisterDangerousProp +/* f06f948: 0fc10e62 */ jal propUnsetDangerous /* f06f94c: 8fa401b0 */ lw $a0,0x1b0($sp) /* f06f950: 8e180040 */ lw $t8,0x40($s0) /* f06f954: 3c0d800a */ lui $t5,%hi(g_Vars) @@ -11716,7 +11716,7 @@ glabel var7f1aa2c4 /* f06ffdc: 8fa601b0 */ lw $a2,0x1b0($sp) /* f06ffe0: 0fc0287e */ jal func0f00a1f8 /* f06ffe4: 24c40008 */ addiu $a0,$a2,0x8 -/* f06ffe8: 0fc10e62 */ jal unregisterDangerousProp +/* f06ffe8: 0fc10e62 */ jal propUnsetDangerous /* f06ffec: 8fa401b0 */ lw $a0,0x1b0($sp) /* f06fff0: 8e0e0040 */ lw $t6,0x40($s0) /* f06fff4: 3c0d800a */ lui $t5,%hi(g_Vars) @@ -33694,7 +33694,7 @@ glabel var7f1aa978 /* f083d7c: 84580062 */ lh $t8,0x62($v0) /* f083d80: 07000003 */ bltz $t8,.L0f083d90 /* f083d84: 00000000 */ sll $zero,$zero,0x0 -/* f083d88: 0fc10e70 */ jal registerDangerousProp +/* f083d88: 0fc10e70 */ jal propSetDangerous /* f083d8c: 8fa40140 */ lw $a0,0x140($sp) .L0f083d90: /* f083d90: 10000002 */ beqz $zero,.L0f083d9c diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index f70d95149..bcee0fe16 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -146,7 +146,7 @@ void robotAttack(struct chrdata *chr); void chrTickRobotAttack(struct chrdata *chr); void chrTickAttack(struct chrdata *chr); void chrTickAttackRoll(struct chrdata *chr); -u32 func0f043944(void); +void propPrintDangerous(void); void chrTickThrowGrenade(struct chrdata *chr); s32 func0f043f2c(struct chrdata *chr, struct coord *runpos, s32 arg2, f32 *arg3); void chrTickAttackWalk(struct chrdata *chr); @@ -262,8 +262,8 @@ void chrSetFiring(struct chrdata *chr, s32 hand, bool firing); void chrStopFiring(struct chrdata *chr); void func0f03f988(struct chrdata *chr, s32 hand, s32 arg2); void func0f0429d8(struct chrdata *chr, f32 arg1, f32 arg2); -void unregisterDangerousProp(struct prop *prop); -void registerDangerousProp(struct prop *prop); +void propUnsetDangerous(struct prop *prop); +void propSetDangerous(struct prop *prop); bool chrDetectDangerousObject(struct chrdata *chr, u8 flags); void chrTickBondDie(struct chrdata *chr); s32 chrIsUsingLift(struct chrdata *chr);