From 9e415edfc0b28f59ae8d3576813e2c92fe8570a0 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 9 Jan 2020 08:12:40 +1000 Subject: [PATCH] Attempt to decompile scenarioPacChooseVictims --- src/game/game_176d70.c | 43 +++++++++++++++++++++++++++++++--- src/include/game/game_176d70.h | 2 +- src/include/types.h | 7 +++++- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/game/game_176d70.c b/src/game/game_176d70.c index fcb839a52..5cfbd742a 100644 --- a/src/game/game_176d70.c +++ b/src/game/game_176d70.c @@ -14886,7 +14886,7 @@ glabel scenarioHtmCallback28 ); GLOBAL_ASM( -glabel func0f1843d4 +glabel scenarioPacChooseVictims /* f1843d4: 27bdffd0 */ addiu $sp,$sp,-48 /* f1843d8: afb40028 */ sw $s4,0x28($sp) /* f1843dc: 3c14800b */ lui $s4,%hi(g_ScenarioData) @@ -14969,14 +14969,51 @@ glabel func0f1843d4 /* f1844e8: 27bd0030 */ addiu $sp,$sp,0x30 ); +//void scenarioPacChooseVictims(void) +//{ +// s32 i; +// s32 j; +// +// g_ScenarioData.pac.unk04 = -1; +// g_ScenarioData.pac.unk02 = 0; +// +// for (i = 0; i != 12; i++) { +// g_ScenarioData.pac.unk20[i] = 0; +// g_ScenarioData.pac.unk34[i] = 0; +// } +// +// i = 0; +// +// while (i < g_MpNumPlayers) { +// bool isnew = true; +// s32 victimplayernum = random() % g_MpNumPlayers; +// +// for (j = 0; j < i; j++) { +// if (g_ScenarioData.pac.victims[j] == victimplayernum) { +// isnew = false; +// break; +// } +// } +// +// if (isnew) { +// g_ScenarioData.pac.victims[i] = victimplayernum; +// i++; +// } +// } +// +// for (i = 0; i < g_MpNumPlayers; i++) { +// // This loop probably printed debug messages +// } +//} + void scenarioPacInit(void) { - func0f1843d4(); + scenarioPacChooseVictims(); } void scenarioPacReset(void) { - func0f1843d4(); + scenarioPacChooseVictims(); } GLOBAL_ASM( diff --git a/src/include/game/game_176d70.h b/src/include/game/game_176d70.h index 193984f3d..95f8aa49a 100644 --- a/src/include/game/game_176d70.h +++ b/src/include/game/game_176d70.h @@ -131,7 +131,7 @@ u32 scenarioHtmCallback1c(void); s32 scenarioHtmCallback20(s32 value); bool scenarioHtmCallback24(void *arg0, struct prop *prop); u32 scenarioHtmCallback28(void); -void func0f1843d4(void); +void scenarioPacChooseVictims(void); void scenarioPacInit(void); void scenarioPacReset(void); u32 scenarioPacCallback28(void); diff --git a/src/include/types.h b/src/include/types.h index 258be4cd5..a76e62fb7 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -4381,7 +4381,12 @@ struct scenariodata_htm { }; struct scenariodata_pac { - u32 unk00; + s16 unk00; + s16 unk02; + s32 unk04; + s16 victims[12]; // shuffled list of player numbers + s16 unk20[12]; + s16 unk34[12]; }; struct scenariodata_koh {