From 3e0fa39c6c0f82a6e0262d721f7e7f991b558609 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 16 Feb 2021 21:38:58 +1000 Subject: [PATCH] Decompile mpCreateScenarioHudmsg --- src/game/mplayer/options.c | 69 +++++--------------------------- src/game/mplayer/scenarios.c | 16 ++++---- src/include/constants.h | 1 + src/include/game/mplayer/setup.h | 2 +- 4 files changed, 20 insertions(+), 68 deletions(-) diff --git a/src/game/mplayer/options.c b/src/game/mplayer/options.c index 453fa8fb4..61253c47c 100644 --- a/src/game/mplayer/options.c +++ b/src/game/mplayer/options.c @@ -1138,65 +1138,16 @@ glabel func0f186508 /* f1866b4: 27bd0078 */ addiu $sp,$sp,0x78 ); -GLOBAL_ASM( -glabel func0f1866b8 -/* f1866b8: 27bdffe0 */ addiu $sp,$sp,-32 -/* f1866bc: afbf0014 */ sw $ra,0x14($sp) -/* f1866c0: afa50024 */ sw $a1,0x24($sp) -/* f1866c4: 0480002a */ bltz $a0,.L0f186770 -/* f1866c8: 00803825 */ or $a3,$a0,$zero -/* f1866cc: 3c05800a */ lui $a1,%hi(g_Vars) -/* f1866d0: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars) -/* f1866d4: 8cae006c */ lw $t6,0x6c($a1) -/* f1866d8: 00003025 */ or $a2,$zero,$zero -/* f1866dc: 00001825 */ or $v1,$zero,$zero -/* f1866e0: 11c00003 */ beqz $t6,.L0f1866f0 -/* f1866e4: 00002025 */ or $a0,$zero,$zero -/* f1866e8: 10000001 */ b .L0f1866f0 -/* f1866ec: 24060001 */ addiu $a2,$zero,0x1 -.L0f1866f0: -/* f1866f0: 8caf0068 */ lw $t7,0x68($a1) -/* f1866f4: 00001025 */ or $v0,$zero,$zero -/* f1866f8: 11e00003 */ beqz $t7,.L0f186708 -/* f1866fc: 00000000 */ nop -/* f186700: 10000001 */ b .L0f186708 -/* f186704: 24030001 */ addiu $v1,$zero,0x1 -.L0f186708: -/* f186708: 8cb80064 */ lw $t8,0x64($a1) -/* f18670c: 13000003 */ beqz $t8,.L0f18671c -/* f186710: 00000000 */ nop -/* f186714: 10000001 */ b .L0f18671c -/* f186718: 24040001 */ addiu $a0,$zero,0x1 -.L0f18671c: -/* f18671c: 8cb90070 */ lw $t9,0x70($a1) -/* f186720: 13200003 */ beqz $t9,.L0f186730 -/* f186724: 00000000 */ nop -/* f186728: 10000001 */ b .L0f186730 -/* f18672c: 24020001 */ addiu $v0,$zero,0x1 -.L0f186730: -/* f186730: 00444021 */ addu $t0,$v0,$a0 -/* f186734: 01034821 */ addu $t1,$t0,$v1 -/* f186738: 01265021 */ addu $t2,$t1,$a2 -/* f18673c: 00ea082a */ slt $at,$a3,$t2 -/* f186740: 5020000c */ beqzl $at,.L0f186774 -/* f186744: 8fbf0014 */ lw $ra,0x14($sp) -/* f186748: 8cab028c */ lw $t3,0x28c($a1) -/* f18674c: 00e02025 */ or $a0,$a3,$zero -/* f186750: 0fc4a24b */ jal setCurrentPlayerNum -/* f186754: afab001c */ sw $t3,0x1c($sp) -/* f186758: 8fa40024 */ lw $a0,0x24($sp) -/* f18675c: 24050009 */ addiu $a1,$zero,0x9 -/* f186760: 0fc377e9 */ jal func0f0ddfa4 -/* f186764: 24060001 */ addiu $a2,$zero,0x1 -/* f186768: 0fc4a24b */ jal setCurrentPlayerNum -/* f18676c: 8fa4001c */ lw $a0,0x1c($sp) -.L0f186770: -/* f186770: 8fbf0014 */ lw $ra,0x14($sp) -.L0f186774: -/* f186774: 27bd0020 */ addiu $sp,$sp,0x20 -/* f186778: 03e00008 */ jr $ra -/* f18677c: 00000000 */ nop -); +void mpCreateScenarioHudmsg(s32 playernum, char *message) +{ + if (playernum >= 0 && playernum < PLAYERCOUNT()) { + s32 prevplayernum = g_Vars.currentplayernum; + + setCurrentPlayerNum(playernum); + func0f0ddfa4(message, HUDMSGTYPE_MPSCENARIO, 1); + setCurrentPlayerNum(prevplayernum); + } +} GLOBAL_ASM( glabel func0f186780 diff --git a/src/game/mplayer/scenarios.c b/src/game/mplayer/scenarios.c index 606f04483..ca5c5e21d 100644 --- a/src/game/mplayer/scenarios.c +++ b/src/game/mplayer/scenarios.c @@ -4287,7 +4287,7 @@ glabel func0f1845bc /* f184710: 8e060000 */ lw $a2,0x0($s0) /* f184714: 02202025 */ or $a0,$s1,$zero .L0f184718: -/* f184718: 0fc619ae */ jal func0f1866b8 +/* f184718: 0fc619ae */ jal mpCreateScenarioHudmsg /* f18471c: 02402825 */ or $a1,$s2,$zero /* f184720: 8e6a006c */ lw $t2,0x6c($s3) /* f184724: 26310001 */ addiu $s1,$s1,0x1 @@ -4363,12 +4363,12 @@ glabel func0f1847b8 /* f184818: 0fc5b9f1 */ jal langGet /* f18481c: 24045408 */ addiu $a0,$zero,0x5408 /* f184820: 02002025 */ or $a0,$s0,$zero -/* f184824: 0fc619ae */ jal func0f1866b8 +/* f184824: 0fc619ae */ jal mpCreateScenarioHudmsg /* f184828: 00402825 */ or $a1,$v0,$zero /* f18482c: 0fc5b9f1 */ jal langGet /* f184830: 24045409 */ addiu $a0,$zero,0x5409 /* f184834: 02002025 */ or $a0,$s0,$zero -/* f184838: 0fc619ae */ jal func0f1866b8 +/* f184838: 0fc619ae */ jal mpCreateScenarioHudmsg /* f18483c: 00402825 */ or $a1,$v0,$zero /* f184840: 10000015 */ b .L0f184898 /* f184844: 00000000 */ nop @@ -4381,17 +4381,17 @@ glabel func0f1847b8 /* f18485c: 0fc5b9f1 */ jal langGet /* f184860: a44b0020 */ sh $t3,0x20($v0) /* f184864: 02002025 */ or $a0,$s0,$zero -/* f184868: 0fc619ae */ jal func0f1866b8 +/* f184868: 0fc619ae */ jal mpCreateScenarioHudmsg /* f18486c: 00402825 */ or $a1,$v0,$zero /* f184870: 0fc5b9f1 */ jal langGet /* f184874: 2404540b */ addiu $a0,$zero,0x540b /* f184878: 02002025 */ or $a0,$s0,$zero -/* f18487c: 0fc619ae */ jal func0f1866b8 +/* f18487c: 0fc619ae */ jal mpCreateScenarioHudmsg /* f184880: 00402825 */ or $a1,$v0,$zero /* f184884: 0fc5b9f1 */ jal langGet /* f184888: 2404540c */ addiu $a0,$zero,0x540c /* f18488c: 02002025 */ or $a0,$s0,$zero -/* f184890: 0fc619ae */ jal func0f1866b8 +/* f184890: 0fc619ae */ jal mpCreateScenarioHudmsg /* f184894: 00402825 */ or $a1,$v0,$zero .L0f184898: /* f184898: 0fc6116f */ jal func0f1845bc @@ -4497,7 +4497,7 @@ glabel scenarioPacTick /* f1849f4: 00402825 */ or $a1,$v0,$zero /* f1849f8: 000b6040 */ sll $t4,$t3,0x1 /* f1849fc: 008c2021 */ addu $a0,$a0,$t4 -/* f184a00: 0fc619ae */ jal func0f1866b8 +/* f184a00: 0fc619ae */ jal mpCreateScenarioHudmsg /* f184a04: 8484c118 */ lh $a0,%lo(g_ScenarioData+0x8)($a0) .L0f184a08: /* f184a08: 8fbf0014 */ lw $ra,0x14($sp) @@ -4521,7 +4521,7 @@ glabel scenarioPacTick // if (g_ScenarioData.pac.age240 > SECSTOTIME240(60)) { // g_ScenarioData.pac.age240 = 0; // g_ScenarioData.pac.wincounts[g_ScenarioData.pac.victims[g_ScenarioData.pac.victimindex]]++; -// func0f1866b8(g_ScenarioData.pac.victims[g_ScenarioData.pac.victimindex], langGet(L_MPWEAPONS(7))); // "Have a point for living!" +// mpCreateScenarioHudmsg(g_ScenarioData.pac.victims[g_ScenarioData.pac.victimindex], langGet(L_MPWEAPONS(7))); // "Have a point for living!" // } // } // } diff --git a/src/include/constants.h b/src/include/constants.h index 1a2a98190..e792dedb0 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -930,6 +930,7 @@ #define HUDMSGTYPE_3 3 #define HUDMSGTYPE_4 4 #define HUDMSGTYPE_SUBTITLE 6 +#define HUDMSGTYPE_MPSCENARIO 9 #define HUDMSGTYPE_TRAINING 10 #define HUDMSGTYPE_11 11 diff --git a/src/include/game/mplayer/setup.h b/src/include/game/mplayer/setup.h index ae67b2855..7121f574f 100644 --- a/src/include/game/mplayer/setup.h +++ b/src/include/game/mplayer/setup.h @@ -109,7 +109,7 @@ u32 func0f185c14(void); bool func0f185e20(struct prop *prop, s32 *arg1); void mpPrepareScenario(void); u32 func0f186508(void); -void func0f1866b8(s32 playernum, char *message); +void mpCreateScenarioHudmsg(s32 playernum, char *message); u32 func0f186780(void); u32 chrGiveBriefcase(struct chrdata *chr, struct prop *prop); void func0f187288(struct chrdata *chr, struct prop *prop);