diff --git a/src/game/game_176d70.c b/src/game/game_176d70.c index afd8c3024..51957d9bb 100644 --- a/src/game/game_176d70.c +++ b/src/game/game_176d70.c @@ -7099,7 +7099,7 @@ s32 menuhandlerMpSimulantSlot(u32 operation, struct menu_item *item, s32 *value) case MENUOP_SET: g_MenuStack[g_MpPlayerNum].slotindex = item->param; - if ((g_MpSetup.simslots & (1 << (item->param + 4))) == 0) { + if ((g_MpSetup.chrslots & (1 << (item->param + 4))) == 0) { menuPushDialog(&g_MpAddSimulantMenuDialog); } else if (var80090af0 == 1) { menuPushDialog(&menudialog_1b414); diff --git a/src/game/game_1999b0.c b/src/game/game_1999b0.c index b1845f2d8..a5b3ed9fe 100644 --- a/src/game/game_1999b0.c +++ b/src/game/game_1999b0.c @@ -2155,6 +2155,46 @@ glabel func0f19b540 /* f19b660: 00000000 */ sll $zero,$zero,0x0 ); +// Mismatch because it's doing something weird with the chrslots, and also +// writing to negative mpsim offsets. This code below might not be functionally +// identical. +//void func0f19b540(void) +//{ +// if (var800acc10 == 5) { +// s32 slot = 0; +// s32 i; +// u32 *ptr; +// +// for (i = 0; i < 4; i++) { +// if (g_MpSetup.chrslots & (1 << i)) { +// g_MpChrs[i].unk9d = 0x80; +// slot++; +// } +// } +// +// g_MpSetup.chrslots &= 0x000f; +// ptr = &var800ac798[slot]; +// +// for (i = 0; i != 8; i++) { +// g_MpSimulants[i].unk48 = *(ptr - 1); +// +// if (*(ptr - 1) != 6) { +// g_MpSetup.chrslots |= 1 << (i + 4); +// } +// +// ptr++; +// } +// +// if (g_MpSetup.scenario == MPSCENARIO_KINGOFTHEHILL) { +// g_Vars.mphilltime = 10; +// } +// } else { +// if (!mpIsChallengeComplete(CHALLENGE_UNK64)) { +// g_MpSetup.chrslots &= 0x00ff; +// } +// } +//} + s32 mpGetNumAvailableChallenges(void) { s32 challengeindex; diff --git a/src/gvars/gvars.c b/src/gvars/gvars.c index 68a1e1a32..ca1655f96 100644 --- a/src/gvars/gvars.c +++ b/src/gvars/gvars.c @@ -30637,14 +30637,7 @@ u32 var800ac52c = 0; u32 var800ac530 = 0; u32 var800ac534 = 0; struct mpsim g_MpSimulants[8] = {0}; -u32 var800ac798 = 0; -u32 var800ac79c = 0; -u32 var800ac7a0 = 0; -u32 var800ac7a4 = 0; -u32 var800ac7a8 = 0; -u32 var800ac7ac = 0; -u32 var800ac7b0 = 0; -u32 var800ac7b4 = 0; +u32 var800ac798[8] = {0}; struct mpchr g_MpChrs[4] = {0}; u32 var800aca38 = 0; u32 var800aca3c = 0; diff --git a/src/include/game/game_1999b0.h b/src/include/game/game_1999b0.h index aa52142b6..cdfb49948 100644 --- a/src/include/game/game_1999b0.h +++ b/src/include/game/game_1999b0.h @@ -27,7 +27,7 @@ u32 func0f19ab70(void); u32 func0f19af3c(void); bool mpIsChallengeAvailable(s32 challengeindex); void func0f19afdc(void); -u32 func0f19b540(void); +void func0f19b540(void); s32 mpGetNumAvailableChallenges(void); char *mpChallengeGetName(s32 challengeindex); u32 func0f19b6f8(void); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 0aa3520e1..cc9a6c419 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -844,7 +844,7 @@ extern u32 var800ac4d0; extern u32 var800ac500; extern u32 var800ac530; extern struct mpsim g_MpSimulants[8]; -extern u32 var800ac798; +extern u32 var800ac798[8]; extern struct mpchr g_MpChrs[]; extern u32 var800aca38; extern u32 var800acad8; diff --git a/src/include/types.h b/src/include/types.h index 2f4c91e7f..136f7cf53 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3998,7 +3998,7 @@ struct mpchr { /*0x94*/ u8 unk94; /*0x95*/ u8 title; /*0x98*/ u32 unk98; - /*0x9c*/ u32 unk9c; + /*0x9c*/ u8 unk9c; }; struct missionconfig { @@ -4029,7 +4029,16 @@ struct mpsetup { /*0x8009cb9a*/ u8 timelimit; /*0x8009cb9b*/ u8 scorelimit; /*0x8009cb9c*/ u16 teamscorelimit; - /*0x8009cb9e*/ u16 simslots; + + /** + * Each bit signifies that a player or sim is participating. + * + * Bits 0x000f are for players + * Bits 0x0ff0 are for sims + * Bits 0xf000 are probably not used + */ + /*0x8009cb9e*/ u16 chrslots; + /*0x8009cba0*/ u32 unk18; /*0x8009cba4*/ u32 unk1c; /*0x8009cba8*/ bool saved; @@ -4085,7 +4094,7 @@ struct mpsim { /*0x3c*/ u32 unk3c; /*0x40*/ u32 unk40; /*0x44*/ u32 unk44; - /*0x48*/ u32 unk48; + /*0x48*/ u8 unk48; }; struct savelocation {