diff --git a/src/game/bondbike.c b/src/game/bondbike.c index 699854fc2..d45fddb1f 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -1490,7 +1490,7 @@ glabel func0f0d341c /* f0d360c: 31f84000 */ andi $t8,$t7,0x4000 /* f0d3610: 13000003 */ beqz $t8,.L0f0d3620 /* f0d3614: 00000000 */ sll $zero,$zero,0x0 -/* f0d3618: 0fc304ea */ jal func0f0c13a8 +/* f0d3618: 0fc304ea */ jal currentPlayerDie /* f0d361c: 24040001 */ addiu $a0,$zero,0x1 .L0f0d3620: /* f0d3620: 0fc32fd4 */ jal func0f0cbf50 diff --git a/src/game/bondgrab.c b/src/game/bondgrab.c index bbe0d6cf3..138e743a0 100644 --- a/src/game/bondgrab.c +++ b/src/game/bondgrab.c @@ -1690,7 +1690,7 @@ void func0f0ce1ac(void) if ((g_Vars.currentplayer->floorflags & FLOORFLAG_4000) && g_Vars.currentplayer->vv_manground - 20.0f < g_Vars.currentplayer->vv_ground) { - func0f0c13a8(true); + currentPlayerDie(true); } } diff --git a/src/game/bondwalk.c b/src/game/bondwalk.c index aea10f465..42365933d 100644 --- a/src/game/bondwalk.c +++ b/src/game/bondwalk.c @@ -1871,7 +1871,7 @@ glabel var7f1ad7d0 /* f0c5724: 4602003c */ c.lt.s $f0,$f2 /* f0c5728: 57000007 */ bnezl $t8,.L0f0c5748 /* f0c572c: 4602003c */ c.lt.s $f0,$f2 -/* f0c5730: 0fc304ea */ jal func0f0c13a8 +/* f0c5730: 0fc304ea */ jal currentPlayerDie /* f0c5734: 24040001 */ addiu $a0,$zero,0x1 /* f0c5738: 8e020284 */ lw $v0,0x284($s0) /* f0c573c: c4420074 */ lwc1 $f2,0x74($v0) @@ -1984,7 +1984,7 @@ glabel var7f1ad7d0 /* f0c58d4: 2b0100f1 */ slti $at,$t8,0xf1 /* f0c58d8: 54200068 */ bnezl $at,.L0f0c5a7c /* f0c58dc: 44808000 */ mtc1 $zero,$f16 -/* f0c58e0: 0fc304ea */ jal func0f0c13a8 +/* f0c58e0: 0fc304ea */ jal currentPlayerDie /* f0c58e4: afa30104 */ sw $v1,0x104($sp) /* f0c58e8: 8fa30104 */ lw $v1,0x104($sp) /* f0c58ec: 10000062 */ beqz $zero,.L0f0c5a78 @@ -2043,7 +2043,7 @@ glabel var7f1ad7d0 /* f0c59b8: 24050001 */ addiu $a1,$zero,0x1 /* f0c59bc: 51e00005 */ beqzl $t7,.L0f0c59d4 /* f0c59c0: 8fa4007c */ lw $a0,0x7c($sp) -/* f0c59c4: 0fc30501 */ jal currentPlayerDie +/* f0c59c4: 0fc30501 */ jal currentPlayerDieByShooter /* f0c59c8: afa30104 */ sw $v1,0x104($sp) /* f0c59cc: 8fa30104 */ lw $v1,0x104($sp) /* f0c59d0: 8fa4007c */ lw $a0,0x7c($sp) @@ -2071,7 +2071,7 @@ glabel var7f1ad7d0 /* f0c5a18: 00000000 */ sll $zero,$zero,0x0 /* f0c5a1c: 45020017 */ bc1fl .L0f0c5a7c /* f0c5a20: 44808000 */ mtc1 $zero,$f16 -/* f0c5a24: 0fc304ea */ jal func0f0c13a8 +/* f0c5a24: 0fc304ea */ jal currentPlayerDie /* f0c5a28: afa30104 */ sw $v1,0x104($sp) /* f0c5a2c: 8fa30104 */ lw $v1,0x104($sp) /* f0c5a30: 10000011 */ beqz $zero,.L0f0c5a78 @@ -2090,7 +2090,7 @@ glabel var7f1ad7d0 /* f0c5a5c: 00000000 */ sll $zero,$zero,0x0 /* f0c5a60: 45020006 */ bc1fl .L0f0c5a7c /* f0c5a64: 44808000 */ mtc1 $zero,$f16 -/* f0c5a68: 0fc304ea */ jal func0f0c13a8 +/* f0c5a68: 0fc304ea */ jal currentPlayerDie /* f0c5a6c: afa30104 */ sw $v1,0x104($sp) /* f0c5a70: 8fa30104 */ lw $v1,0x104($sp) /* f0c5a74: 8e020284 */ lw $v0,0x284($s0) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 8bcb33a13..6ac3a154d 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -8493,7 +8493,7 @@ glabel func0f034524 /* f0359e4: 00000000 */ sll $zero,$zero,0x0 /* f0359e8: 45000006 */ bc1f .L0f035a04 /* f0359ec: 00000000 */ sll $zero,$zero,0x0 -/* f0359f0: 0fc30501 */ jal currentPlayerDie +/* f0359f0: 0fc30501 */ jal currentPlayerDieByShooter /* f0359f4: 00002825 */ or $a1,$zero,$zero /* f0359f8: 920f02ff */ lbu $t7,0x2ff($s0) /* f0359fc: 25f80001 */ addiu $t8,$t7,0x1 diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 089bbbcf9..ea39dc17e 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -8248,7 +8248,7 @@ glabel func0f0bd904 /* f0bdce8: 11a00004 */ beqz $t5,.L0f0bdcfc /* f0bdcec: 00000000 */ sll $zero,$zero,0x0 /* f0bdcf0: 8e64028c */ lw $a0,0x28c($s3) -/* f0bdcf4: 0fc30501 */ jal currentPlayerDie +/* f0bdcf4: 0fc30501 */ jal currentPlayerDieByShooter /* f0bdcf8: 24050001 */ addiu $a1,$zero,0x1 .L0f0bdcfc: /* f0bdcfc: 0fc2ee05 */ jal func0f0bb814 @@ -11966,35 +11966,21 @@ glabel func0f0c07c8 /* f0c13a4: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f0c13a8 -/* f0c13a8: 3c06800a */ lui $a2,%hi(g_Vars) -/* f0c13ac: 24c69fc0 */ addiu $a2,$a2,%lo(g_Vars) -/* f0c13b0: 8cce0284 */ lw $t6,0x284($a2) -/* f0c13b4: 27bdffe8 */ addiu $sp,$sp,-24 -/* f0c13b8: afbf0014 */ sw $ra,0x14($sp) -/* f0c13bc: 8dcf00bc */ lw $t7,0xbc($t6) -/* f0c13c0: 00802825 */ or $a1,$a0,$zero -/* f0c13c4: 8de20004 */ lw $v0,0x4($t7) -/* f0c13c8: 844300ec */ lh $v1,0xec($v0) -/* f0c13cc: 04620007 */ bltzl $v1,.L0f0c13ec -/* f0c13d0: 8cc4028c */ lw $a0,0x28c($a2) -/* f0c13d4: 845800ee */ lh $t8,0xee($v0) -/* f0c13d8: 5b000004 */ blezl $t8,.L0f0c13ec -/* f0c13dc: 8cc4028c */ lw $a0,0x28c($a2) -/* f0c13e0: 10000002 */ beqz $zero,.L0f0c13ec -/* f0c13e4: 00602025 */ or $a0,$v1,$zero -/* f0c13e8: 8cc4028c */ lw $a0,0x28c($a2) -.L0f0c13ec: -/* f0c13ec: 0fc30501 */ jal currentPlayerDie -/* f0c13f0: 00000000 */ sll $zero,$zero,0x0 -/* f0c13f4: 8fbf0014 */ lw $ra,0x14($sp) -/* f0c13f8: 27bd0018 */ addiu $sp,$sp,0x18 -/* f0c13fc: 03e00008 */ jr $ra -/* f0c1400: 00000000 */ sll $zero,$zero,0x0 -); +void currentPlayerDie(bool force) +{ + struct chrdata *chr = g_Vars.currentplayer->prop->chr; + s32 shooter; -void currentPlayerDie(u32 playernum, bool force) + if (chr->lastshooter >= 0 && chr->timeshooter > 0) { + shooter = chr->lastshooter; + } else { + shooter = g_Vars.currentplayernum; + } + + currentPlayerDieByShooter(shooter, force); +} + +void currentPlayerDieByShooter(u32 shooter, bool force) { if (!g_Vars.currentplayer->isdead && (force || !g_Vars.currentplayer->invincible)) { @@ -12006,7 +11992,7 @@ void currentPlayerDie(u32 playernum, bool force) func0f0dfa50(g_Vars.currentplayernum); if (g_Vars.mplayerisrunning) { - func0f0b09f4(playernum, g_Vars.currentplayernum); + func0f0b09f4(shooter, g_Vars.currentplayernum); } chrUncloak(g_Vars.currentplayer->prop->chr, true); @@ -12014,7 +12000,7 @@ void currentPlayerDie(u32 playernum, bool force) if (g_Vars.mplayerisrunning && (g_Vars.antiplayernum < 0 || g_Vars.currentplayernum != g_Vars.antiplayernum - || playernum != g_Vars.antiplayernum)) { + || shooter != g_Vars.antiplayernum)) { func0f0910ac(); } diff --git a/src/include/game/game_0b63b0.h b/src/include/game/game_0b63b0.h index 4896230d3..3258ff9ab 100644 --- a/src/include/game/game_0b63b0.h +++ b/src/include/game/game_0b63b0.h @@ -65,8 +65,8 @@ u32 func0f0bffcc(void); u32 func0f0c00cc(void); u32 func0f0c0190(void); u32 func0f0c07c8(void); -void func0f0c13a8(s32 arg0); -void currentPlayerDie(u32 playernum, bool force); +void currentPlayerDie(bool force); +void currentPlayerDieByShooter(u32 shooter, bool force); u32 func0f0c160c(void); u32 func0f0c16f4(void); u32 func0f0c1840(void); diff --git a/src/include/types.h b/src/include/types.h index 3a6f53a04..5d0553464 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -577,7 +577,7 @@ struct chrdata { /*0x0e4*/ s32 lastvisibletarget60; /*0x0e8*/ void *unk0e8; /*0x0ec*/ s16 lastshooter; - /*0x0ee*/ u16 timeshooter; + /*0x0ee*/ s16 timeshooter; /*0x0f0*/ f32 hearingscale; /*0x0f4*/ s32 lastheartarget60; /*0x0f8*/ u8 shadecol[4];