From cdd3cc217536b261f3ecbaf8074db7efaf39fb08 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 7 Feb 2025 15:46:41 +1000 Subject: [PATCH] Set names from remaining mplayer functions --- src/game/bondgun.c | 2 +- src/game/bot.c | 66 ++--- src/game/botinv.c | 8 +- src/game/challenge.c | 4 +- src/game/challengeinit.c | 8 +- src/game/chr.c | 2 +- src/game/chraction.c | 12 +- src/game/chraicommands.c | 2 +- src/game/explosions.c | 4 +- src/game/fmb.c | 6 +- src/game/lv.c | 2 +- src/game/menu.c | 4 +- src/game/menutick.c | 12 +- src/game/mplayer/mplayer.c | 269 +++++++++++------- src/game/mplayer/scenarios.c | 12 +- src/game/mplayer/scenarios/capturethecase.inc | 8 +- src/game/mplayer/scenarios/hackthatmac.inc | 4 +- .../mplayer/scenarios/holdthebriefcase.inc | 2 +- src/game/mplayer/scenarios/popacap.inc | 2 +- src/game/mplayer/setup.c | 106 +++---- src/game/mpstats.c | 4 +- src/game/propobj.c | 22 +- src/include/data.h | 2 +- src/include/game/mplayer/mplayer.h | 28 +- src/include/game/mplayer/setup.h | 8 +- src/include/types.h | 9 +- 26 files changed, 339 insertions(+), 269 deletions(-) diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 37bcd16ea..a9f0049ae 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -4261,7 +4261,7 @@ struct defaultobj *bgun_create_thrown_projectile2(struct chrdata *chr, struct gs obj->hidden &= 0x0fffffff; if (g_Vars.normmplayerisrunning) { - playernum = mp_player_get_index(chr); + playernum = mp_chr_to_chrindex(chr); } else { playernum = playermgr_get_player_num_by_prop(chr->prop); } diff --git a/src/game/bot.c b/src/game/bot.c index 1cf0f0b6d..75055803c 100644 --- a/src/game/bot.c +++ b/src/game/bot.c @@ -829,7 +829,7 @@ bool bot_is_about_to_attack(struct chrdata *chr, bool arg1) if (chr->target != -1) { target = chr_get_target_prop(chr); - mpindex = mp_player_get_index(target->chr); + mpindex = mp_chr_to_chrindex(target->chr); result = false; if (chr->aibot->chrsinsight[mpindex]) { @@ -1334,7 +1334,7 @@ void bot_set_target(struct chrdata *botchr, s32 propnum) if (propnum >= 0) { otherchr = (g_Vars.props + propnum)->chr; - index = mp_player_get_index(otherchr); + index = mp_chr_to_chrindex(otherchr); botchr->aibot->targetinsight = botchr->aibot->chrsinsight[index]; botchr->aibot->targetlastseen60 = botchr->aibot->chrslastseen60[index]; @@ -1585,7 +1585,7 @@ void bot_choose_general_target(struct chrdata *botchr) // and update stats about that chr aibot->queryplayernum = (aibot->queryplayernum + 1) % g_MpNumChrs; - trychr = mp_get_chr_from_player_index(aibot->queryplayernum); + trychr = mp_chrindex_to_chr(aibot->queryplayernum); if (trychr != botchr) { // This condition passes on average once every 4 minutes per player. @@ -1682,7 +1682,7 @@ void bot_choose_general_target(struct chrdata *botchr) for (tmp = 0; tmp < g_MpNumChrs; tmp++) { s32 i = aibot->chrnumsbydistanceasc[tmp]; - trychr = mp_get_chr_from_player_index(i); + trychr = mp_chrindex_to_chr(i); if (trychr != botchr && !chr_is_dead(trychr) @@ -1713,7 +1713,7 @@ void bot_choose_general_target(struct chrdata *botchr) // Use closest out of sight chr if (closestavailablechrnum >= 0) { - trychr = mp_get_chr_from_player_index(closestavailablechrnum); + trychr = mp_chrindex_to_chr(closestavailablechrnum); bot_set_target(botchr, trychr->prop - g_Vars.props); return; } @@ -1725,7 +1725,7 @@ void bot_choose_general_target(struct chrdata *botchr) // Bot has an existing target // If they're still in sight, keep the target - playernum = mp_player_get_index((g_Vars.props + botchr->target)->chr); + playernum = mp_chr_to_chrindex((g_Vars.props + botchr->target)->chr); if (aibot->chrsinsight[playernum]) { bot_set_target(botchr, botchr->target); @@ -1736,7 +1736,7 @@ void bot_choose_general_target(struct chrdata *botchr) // Check for other chrs who are in sight, by distance for (i = 0; i < g_MpNumChrs; i++) { if (aibot->chrsinsight[aibot->chrnumsbydistanceasc[i]]) { - trychr = mp_get_chr_from_player_index(aibot->chrnumsbydistanceasc[i]); + trychr = mp_chrindex_to_chr(aibot->chrnumsbydistanceasc[i]); if (trychr != botchr && !chr_is_dead(trychr) @@ -2334,7 +2334,7 @@ s32 bot_get_count_in_team_doing_command(struct chrdata *self, u32 command, bool s32 bot_is_chrs_ctc_token_held(struct chrdata *chr) { - struct mpchrconfig *mpchr = g_MpAllChrConfigPtrs[mp_player_get_index(chr)]; + struct mpchrconfig *mpchr = g_MpAllChrConfigPtrs[mp_chr_to_chrindex(chr)]; struct prop *prop = g_ScenarioData.ctc.tokens[mpchr->team]; return prop && (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER); @@ -2383,7 +2383,7 @@ s32 bot_get_num_teammates_defending_hill(struct chrdata *bot) */ s32 bot_get_num_opponents_in_hill(struct chrdata *chr) { - struct mpchrconfig *mpchr = g_MpAllChrConfigPtrs[mp_player_get_index(chr)]; + struct mpchrconfig *mpchr = g_MpAllChrConfigPtrs[mp_chr_to_chrindex(chr)]; struct mpchrconfig *loopmpchr; s32 countsperteam[MAX_TEAMS] = {0}; s32 max = 0; @@ -2391,7 +2391,7 @@ s32 bot_get_num_opponents_in_hill(struct chrdata *chr) for (i = 0; i < g_MpNumChrs; i++) { if (g_MpAllChrPtrs[i]->prop->rooms[0] == g_ScenarioData.koh.hillrooms[0]) { - s32 mpindex = func0f18d074(i); + s32 mpindex = mp_chrindex_to_chrslot(i); loopmpchr = MPCHR(mpindex); @@ -2673,7 +2673,7 @@ void bot_tick_unpaused(struct chrdata *chr) // KazeSim will attack people on sight regardless of command if (aibot->config->type == BOTTYPE_KAZE && chr->target != -1 && aibot->targetinsight) { newaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(chr_get_target_prop(chr)->chr); + aibot->attackingplayernum = mp_chr_to_chrindex(chr_get_target_prop(chr)->chr); aibot->abortattacktimer60 = -1; } @@ -2697,7 +2697,7 @@ void bot_tick_unpaused(struct chrdata *chr) && !bot_is_target_invisible(chr, targetchr) && bot_passes_coward_check(chr, targetchr)) { newaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(targetchr); + aibot->attackingplayernum = mp_chr_to_chrindex(targetchr); aibot->abortattacktimer60 = -1; } } else if (aibot->command == AIBOTCMD_FOLLOW) { @@ -2705,13 +2705,13 @@ void bot_tick_unpaused(struct chrdata *chr) // This is a human command only newaction = MA_AIBOTFOLLOW; aibot->canbreakfollow = true; - aibot->followingplayernum = mp_player_get_index((g_Vars.props + aibot->followprotectpropnum)->chr); + aibot->followingplayernum = mp_chr_to_chrindex((g_Vars.props + aibot->followprotectpropnum)->chr); } else if (aibot->command == AIBOTCMD_PROTECT) { // Protect the prop (player) given in followprotectpropnum // This is a human command only newaction = MA_AIBOTFOLLOW; aibot->canbreakfollow = false; - aibot->followingplayernum = mp_player_get_index((g_Vars.props + aibot->followprotectpropnum)->chr); + aibot->followingplayernum = mp_chr_to_chrindex((g_Vars.props + aibot->followprotectpropnum)->chr); } else if (aibot->command == AIBOTCMD_DEFEND) { // Defend the position given in defendholdpos // This is a human command only @@ -2785,7 +2785,7 @@ void bot_tick_unpaused(struct chrdata *chr) } else if (bot_can_follow(chr, tokens[index]->chr)) { newaction = MA_AIBOTFOLLOW; aibot->canbreakfollow = random() % 4 == 0; - aibot->followingplayernum = mp_player_get_index(tokens[index]->chr); + aibot->followingplayernum = mp_chr_to_chrindex(tokens[index]->chr); } } } @@ -2803,7 +2803,7 @@ void bot_tick_unpaused(struct chrdata *chr) if (bot_can_follow(chr, tokenchr)) { newaction = MA_AIBOTFOLLOW; aibot->canbreakfollow = random() % 4 == 0; - aibot->followingplayernum = mp_player_get_index(tokenchr); + aibot->followingplayernum = mp_chr_to_chrindex(tokenchr); } } else { // Held by an opponent - attack them @@ -2811,7 +2811,7 @@ void bot_tick_unpaused(struct chrdata *chr) && !bot_is_target_invisible(chr, tokenchr) && bot_passes_coward_check(chr, tokenchr)) { newaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(tokenchr); + aibot->attackingplayernum = mp_chr_to_chrindex(tokenchr); aibot->abortattacktimer60 = -1; } } @@ -2834,7 +2834,7 @@ void bot_tick_unpaused(struct chrdata *chr) && bot_passes_coward_check(chr, chr_get_target_prop(chr)->chr)) { // Bot is in the hill and sees target - attack them newaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(chr_get_target_prop(chr)->chr); + aibot->attackingplayernum = mp_chr_to_chrindex(chr_get_target_prop(chr)->chr); aibot->abortattacktimer60 = TICKS(300); } else { // Go to the hill if not there already @@ -2893,13 +2893,13 @@ void bot_tick_unpaused(struct chrdata *chr) if (bot_can_follow(chr, uplinkchr)) { newaction = MA_AIBOTFOLLOW; aibot->canbreakfollow = random() % 4 == 0; - aibot->followingplayernum = mp_player_get_index(uplinkchr); + aibot->followingplayernum = mp_chr_to_chrindex(uplinkchr); } } else { // Uplink is held by opponent - attack them if (!bot_is_target_invisible(chr, uplinkchr) && bot_passes_coward_check(chr, uplinkchr)) { newaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(uplinkchr); + aibot->attackingplayernum = mp_chr_to_chrindex(uplinkchr); aibot->abortattacktimer60 = -1; } } @@ -2924,12 +2924,12 @@ void bot_tick_unpaused(struct chrdata *chr) if (bot_can_follow(chr, tokenchr)) { newaction = MA_AIBOTFOLLOW; aibot->canbreakfollow = random() % 4 == 0; - aibot->followingplayernum = mp_player_get_index(tokenchr); + aibot->followingplayernum = mp_chr_to_chrindex(tokenchr); } } else if (!bot_is_target_invisible(chr, tokenchr) && bot_passes_coward_check(chr, tokenchr)) { // Briefcase is held by opponent - attack them newaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(tokenchr); + aibot->attackingplayernum = mp_chr_to_chrindex(tokenchr); aibot->abortattacktimer60 = -1; } } else { @@ -2952,13 +2952,13 @@ void bot_tick_unpaused(struct chrdata *chr) if (bot_can_follow(chr, victimchr)) { newaction = MA_AIBOTFOLLOW; aibot->canbreakfollow = random() % 4 == 0; - aibot->followingplayernum = mp_player_get_index(victimchr); + aibot->followingplayernum = mp_chr_to_chrindex(victimchr); } } else { // Victim is an opponent - attack them if (!bot_is_target_invisible(chr, victimchr) && bot_passes_coward_check(chr, victimchr)) { newaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(victimchr); + aibot->attackingplayernum = mp_chr_to_chrindex(victimchr); aibot->abortattacktimer60 = -1; } } @@ -3022,7 +3022,7 @@ void bot_tick_unpaused(struct chrdata *chr) } else if (g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL) { // If the bot has the uplink, go to the terminal if (g_ScenarioData.htm.uplink == chr->prop) { - if (g_ScenarioData.htm.playernuminrange != mp_player_get_index(chr)) { + if (g_ScenarioData.htm.playernuminrange != mp_chr_to_chrindex(chr)) { newaction = MA_AIBOTGOTOPROP; aibot->gotoprop = g_ScenarioData.htm.terminals[0].prop; } else { @@ -3062,8 +3062,8 @@ void bot_tick_unpaused(struct chrdata *chr) s32 i; for (i = 0; i < count; i++) { - s32 playernum = func0f18d0e8(rankings[i].chrnum); - struct chrdata *otherchr = mp_get_chr_from_player_index(playernum); + s32 playernum = mp_chrslot_to_chrindex(rankings[i].chrnum); + struct chrdata *otherchr = mp_chrindex_to_chr(playernum); if (otherchr != chr && !chr_is_dead(otherchr)) { #if PAL @@ -3085,7 +3085,7 @@ void bot_tick_unpaused(struct chrdata *chr) s32 i; for (i = 0; i < g_MpNumChrs; i++) { - struct chrdata *otherchr = mp_get_chr_from_player_index(i); + struct chrdata *otherchr = mp_chrindex_to_chr(i); if (otherchr != chr && !chr_is_dead(otherchr) @@ -3257,7 +3257,7 @@ void bot_tick_unpaused(struct chrdata *chr) // No y check? if (xdist < 500 && zdist < 500) { chr->myaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(chr_get_target_prop(chr)->chr); + aibot->attackingplayernum = mp_chr_to_chrindex(chr_get_target_prop(chr)->chr); aibot->abortattacktimer60 = TICKS(300); aibot->distmode = -1; } @@ -3298,7 +3298,7 @@ void bot_tick_unpaused(struct chrdata *chr) && aibot->targetinsight && bot_passes_coward_check(chr, chr_get_target_prop(chr)->chr)) { chr->myaction = MA_AIBOTATTACK; - aibot->attackingplayernum = mp_player_get_index(chr_get_target_prop(chr)->chr); + aibot->attackingplayernum = mp_chr_to_chrindex(chr_get_target_prop(chr)->chr); aibot->abortattacktimer60 = TICKS(300); aibot->distmode = -1; } @@ -3339,13 +3339,13 @@ void bot_tick_unpaused(struct chrdata *chr) // empty } else if (g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL && g_ScenarioData.htm.uplink == chr->prop - && g_ScenarioData.htm.playernuminrange == mp_player_get_index(chr)) { + && g_ScenarioData.htm.playernuminrange == mp_chr_to_chrindex(chr)) { chr->myaction = MA_AIBOTMAINLOOP; } } else if (chr->myaction == MA_AIBOTDOWNLOAD) { if (bot_can_do_critical_pickup(chr)) { chr->myaction = MA_AIBOTMAINLOOP; - } else if (g_ScenarioData.htm.playernuminrange != mp_player_get_index(chr)) { + } else if (g_ScenarioData.htm.playernuminrange != mp_chr_to_chrindex(chr)) { chr->myaction = MA_AIBOTMAINLOOP; } } @@ -3354,7 +3354,7 @@ void bot_tick_unpaused(struct chrdata *chr) // route to them, even if it won't be followed bot_choose_general_target(chr); - if (mp_player_get_index(chr) == (g_Vars.lvframenum % g_MpNumChrs) && chr->target != -1) { + if (mp_chr_to_chrindex(chr) == (g_Vars.lvframenum % g_MpNumChrs) && chr->target != -1) { struct prop *targetprop = chr_get_target_prop(chr); struct waypoint *first = waypoint_find_closest_to_pos(&chr->prop->pos, chr->prop->rooms); struct waypoint *last = waypoint_find_closest_to_pos(&targetprop->pos, targetprop->rooms); diff --git a/src/game/botinv.c b/src/game/botinv.c index 7700a194f..087902c0f 100644 --- a/src/game/botinv.c +++ b/src/game/botinv.c @@ -641,7 +641,7 @@ void botinv_score_weapon(struct chrdata *chr, s32 weaponnum, s32 funcnum, s32 if if (chr->aibot->config->difficulty > BOTDIFF_MEAT) { if (comparewithtarget) { if (chr->target != -1 - && chr->aibot->chrsinsight[mp_player_get_index(chr_get_target_prop(chr)->chr)] == 0 + && chr->aibot->chrsinsight[mp_chr_to_chrindex(chr_get_target_prop(chr)->chr)] == 0 && (chr->aibot->random1 % 2) == 0) { score1 += 10; } else { @@ -658,7 +658,7 @@ void botinv_score_weapon(struct chrdata *chr, s32 weaponnum, s32 funcnum, s32 if if (chr->aibot->config->difficulty >= BOTDIFF_NORMAL) { if (comparewithtarget) { if (chr->target != -1 - && chr->aibot->chrsinsight[mp_player_get_index(chr_get_target_prop(chr)->chr)] == 0 + && chr->aibot->chrsinsight[mp_chr_to_chrindex(chr_get_target_prop(chr)->chr)] == 0 && (chr->aibot->random1 % 2) == 0) { score1 = 178; score2 = 188; @@ -992,8 +992,8 @@ void botinv_tick(struct chrdata *chr) if (newweaponnum == WEAPON_COMBATKNIFE && botact_get_ammo_quantity_by_weapon(aibot, WEAPON_COMBATKNIFE, FUNC_SECONDARY, true) >= 2 && chr->target != -1 - && chr->aibot->chrdistances[mp_player_get_index(chr_get_target_prop(chr)->chr)] > 200 - && chr->aibot->chrdistances[mp_player_get_index(chr_get_target_prop(chr)->chr)] < 1500) { + && chr->aibot->chrdistances[mp_chr_to_chrindex(chr_get_target_prop(chr)->chr)] > 200 + && chr->aibot->chrdistances[mp_chr_to_chrindex(chr_get_target_prop(chr)->chr)] < 1500) { newfuncnum = FUNC_SECONDARY; } diff --git a/src/game/challenge.c b/src/game/challenge.c index 89963671e..7c6397b0e 100644 --- a/src/game/challenge.c +++ b/src/game/challenge.c @@ -213,7 +213,7 @@ void challenge_determine_unlocked_features(void) g_MpFeaturesUnlocked[j] = flag; } - for (j = 0; j < func0f188bcc(); j++) { + for (j = 0; j < mp_get_num_mpweapons(); j++) { struct mpweapon *weapon = &g_MpWeapons[j]; if (weapon->unlockfeature > 0 && fr_is_weapon_available_for_mp(weapon->weaponnum)) { @@ -221,7 +221,7 @@ void challenge_determine_unlocked_features(void) } } - func0f1895e8(); + mp_apply_weaponset_if_standard(); // If the ability to have 8 simulants hasn't been unlocked, limit them to 4 if (!challenge_is_feature_unlocked(MPFEATURE_8BOTS)) { diff --git a/src/game/challengeinit.c b/src/game/challengeinit.c index ad6886f08..b85f6da2a 100644 --- a/src/game/challengeinit.c +++ b/src/game/challengeinit.c @@ -19,13 +19,13 @@ void challenges_init(void) g_MpChallenges[i].completions[2] = 0; g_MpChallenges[i].completions[3] = 0; - mpconfig = challenge_load(i, buffer, 0x1ca); - challenge_force_unlock_config_features(&mpconfig->config, g_MpChallenges[i].unlockfeatures, 16, i); + mpconfig = challenge_load(i, buffer, sizeof(buffer)); + challenge_force_unlock_config_features(&mpconfig->config, g_MpChallenges[i].unlockfeatures, sizeof(g_MpChallenges[i].unlockfeatures), i); } for (i = 0; i < mp_get_num_presets(); i++) { - mpconfig = challenge_load_config(g_MpPresets[i].confignum, buffer, 0x1ca); - challenge_force_unlock_config_features(&mpconfig->config, g_MpPresets[i].requirefeatures, 16, -1); + mpconfig = challenge_load_config(g_MpPresets[i].confignum, buffer, sizeof(buffer)); + challenge_force_unlock_config_features(&mpconfig->config, g_MpPresets[i].requirefeatures, sizeof(g_MpChallenges[i].unlockfeatures), -1); } challenge_determine_unlocked_features(); diff --git a/src/game/chr.c b/src/game/chr.c index 61bd9c318..6cf96b8e5 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -925,7 +925,7 @@ bool chr_update_position(struct model *model, struct coord *arg1, struct coord * if (chr->lastshooter >= 0 && chr->timeshooter > 0) { shooter = chr->lastshooter; } else { - shooter = mp_player_get_index(chr); + shooter = mp_chr_to_chrindex(chr); } chr_die(chr, shooter); diff --git a/src/game/chraction.c b/src/game/chraction.c index e2d826c4a..80dca9f1d 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -3368,7 +3368,7 @@ void chr_begin_death(struct chrdata *chr, struct coord *dir, f32 relangle, s32 h // Handle multiplayer stats and kill count if (g_Vars.mplayerisrunning) { - mpstats_record_death(aplayernum, mp_player_get_index(chr)); + mpstats_record_death(aplayernum, mp_chr_to_chrindex(chr)); } else if (aplayernum >= 0) { s32 prevplayernum = g_Vars.currentplayernum; set_current_player_num(aplayernum); @@ -4494,7 +4494,7 @@ void chr_damage(struct chrdata *chr, f32 damage, struct coord *vector, struct gs // (includes MP aibots, not applicable for solo chrs) if (g_Vars.mplayerisrunning) { if (aprop && (aprop->type == PROPTYPE_PLAYER || aprop->type == PROPTYPE_CHR)) { - aplayernum = mp_player_get_index(aprop->chr); + aplayernum = mp_chr_to_chrindex(aprop->chr); } } else { if (aprop && aprop->type == PROPTYPE_PLAYER) { @@ -4991,7 +4991,7 @@ void chr_damage(struct chrdata *chr, f32 damage, struct coord *vector, struct gs } if (g_Vars.mplayerisrunning) { - mpstats_record_death(aplayernum, mp_player_get_index(chr)); + mpstats_record_death(aplayernum, mp_chr_to_chrindex(chr)); } else if (aprop && aprop->type == PROPTYPE_PLAYER) { s32 prevplayernum = g_Vars.currentplayernum; set_current_player_num(playermgr_get_player_num_by_prop(aprop)); @@ -5106,7 +5106,7 @@ void chr_die(struct chrdata *chr, s32 aplayernum) chr->ailist = ailist_find_by_id(GAILIST_AIBOT_DEAD); chr->aioffset = 0; - mpstats_record_death(aplayernum, mp_player_get_index(chr)); + mpstats_record_death(aplayernum, mp_chr_to_chrindex(chr)); botinv_drop_all(chr, chr->aibot->weaponnum); #if VERSION >= VERSION_NTSC_1_0 @@ -10373,7 +10373,7 @@ void chr_tick_shoot(struct chrdata *chr, s32 handnum) s32 playernum = -1; if (g_Vars.mplayerisrunning) { - playernum = mp_player_get_index(chr); + playernum = mp_chr_to_chrindex(chr); } bgun_play_prop_hit_sound(&gset, hitprop, -1); @@ -10408,7 +10408,7 @@ void chr_tick_shoot(struct chrdata *chr, s32 handnum) // Create explosion if using Phoenix if (gset.weaponnum == WEAPON_PHOENIX && gset.weaponfunc == FUNC_SECONDARY) { - s32 playernum = chr->aibot ? mp_player_get_index(chr) : g_Vars.currentplayernum; + s32 playernum = chr->aibot ? mp_chr_to_chrindex(chr) : g_Vars.currentplayernum; if (!queriedhitrooms) { los_find_final_room_exhaustive(&gunpos, gunrooms, &hitpos, hitrooms); diff --git a/src/game/chraicommands.c b/src/game/chraicommands.c index 4a181ab67..5381d9863 100644 --- a/src/game/chraicommands.c +++ b/src/game/chraicommands.c @@ -4904,7 +4904,7 @@ bool ai_if_cutscene_button_pressed(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; if ((g_Vars.in_cutscene && g_CutsceneSkipRequested) || - (g_Vars.stagenum == STAGE_CITRAINING && var80087260 > 0)) { + (g_Vars.stagenum == STAGE_CITRAINING && g_MpReturningFromMatch > 0)) { g_Vars.aioffset = chrai_go_to_label(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { g_Vars.aioffset += 3; diff --git a/src/game/explosions.c b/src/game/explosions.c index 157a83d4d..c00cc1b43 100644 --- a/src/game/explosions.c +++ b/src/game/explosions.c @@ -984,7 +984,7 @@ void explosion_inflict_damage(struct prop *expprop) } if (g_Vars.normmplayerisrunning) { - struct chrdata *ownerchr = mp_get_chr_from_player_index(exp->owner); + struct chrdata *ownerchr = mp_chrindex_to_chr(exp->owner); if (ownerchr) { ownerprop = ownerchr->prop; @@ -1207,7 +1207,7 @@ u32 explosion_tick(struct prop *prop) scorchsize *= 0.8f + 0.2f * RANDOMFRAC(); if (g_Vars.normmplayerisrunning) { - chr = mp_get_chr_from_player_index(exp->owner); + chr = mp_chrindex_to_chr(exp->owner); } else if (g_Vars.antiplayernum >= 0 && exp->owner == g_Vars.antiplayernum) { chr = g_Vars.anti->prop->chr; } else if (g_Vars.coopplayernum >= 0 && exp->owner == g_Vars.coopplayernum) { diff --git a/src/game/fmb.c b/src/game/fmb.c index 563a8d1d4..d26d69314 100644 --- a/src/game/fmb.c +++ b/src/game/fmb.c @@ -65,7 +65,7 @@ void fmb_reset(void) g_MpPlayerNum = 0; if (g_FileState != FILESTATE_UNSELECTED) { - if (var80087260 == 0) { + if (!g_MpReturningFromMatch) { g_Vars.mpsetupmenu = MPSETUPMENU_GENERAL; menu_push_root_dialog(&g_MainMenu4MbMenuDialog, MENUROOT_4MBMAINMENU); } @@ -500,9 +500,9 @@ struct menuitem g_MpConfirmChallenge4MbMenuItems[] = { struct menudialogdef g_MpConfirmChallenge4MbMenuDialog = { MENUDIALOGTYPE_DEFAULT, - (uintptr_t)&func0f17e318, + (uintptr_t)&menutext_mp_challenge_name, g_MpConfirmChallenge4MbMenuItems, - menudialog0017e3fc, + menudialog_mp_confirm_challenge, 0, NULL, }; diff --git a/src/game/lv.c b/src/game/lv.c index 61fb7cfbe..ad4bfc25c 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -1155,7 +1155,7 @@ Gfx *lv_render(Gfx *gdl) gdl = bg_scissor_to_viewport(gdl); artifacts_clear(); - if ((g_Vars.stagenum != STAGE_CITRAINING || (var80087260 <= 0 && g_MenuData.root != MENUROOT_MPSETUP)) + if ((g_Vars.stagenum != STAGE_CITRAINING || (g_MpReturningFromMatch <= 0 && g_MenuData.root != MENUROOT_MPSETUP)) && g_Vars.lvframenum <= 5 && !g_Vars.normmplayerisrunning && g_Vars.tickmode != TICKMODE_CUTSCENE) { diff --git a/src/game/menu.c b/src/game/menu.c index 93be5f0c8..3a7c657d0 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -4302,7 +4302,7 @@ void dialog_tick(struct menudialog *dialog, struct menuinputs *inputs, u32 tickf if (mp_is_player_locked_out(g_MpPlayerNum) && (item->flags & MENUITEMFLAG_LOCKABLEMINOR)) { inputsptr = &spd8; - } else if ((item->flags & MENUITEMFLAG_MPWEAPONSLOT) && mp_get_weapon_set() != func0f189088()) { + } else if ((item->flags & MENUITEMFLAG_MPWEAPONSLOT) && mp_get_weaponset_slotnum() != mp_get_custom_weaponset_slot()) { inputsptr = &spd8; } else if (g_MenuData.root == MENUROOT_12) { inputsptr = &spd8; @@ -5014,7 +5014,7 @@ void menu_process_input(void) && g_Menus[g_MpPlayerNum].curdialog->definition != &g_MpReadyMenuDialog) { menu_push_dialog(&g_MpReadyMenuDialog); } else if (g_Menus[g_MpPlayerNum].curdialog->definition == &g_MpQuickTeamGameSetupMenuDialog) { - func0f17f428(); + mp_apply_quickstart(); } } break; diff --git a/src/game/menutick.c b/src/game/menutick.c index bd296fba2..7a7ff0873 100644 --- a/src/game/menutick.c +++ b/src/game/menutick.c @@ -214,7 +214,7 @@ void menu_tick(void) } // Check if returning from a multiplayer match - if (var80087260 > 0) { + if (g_MpReturningFromMatch > 0) { if (g_Vars.lvframenum >= 4) { if (g_Vars.stagenum == STAGE_CITRAINING || g_Vars.stagenum == STAGE_4MBMENU) { vi_black(false); @@ -234,7 +234,7 @@ void menu_tick(void) if (g_Vars.mpsetupmenu == MPSETUPMENU_ADVSETUP) { g_MpNumJoined++; - func0f17fcb0(true); + mp_open_advanced_setup(true); } else if (g_MpNumJoined == 0) { g_MpNumJoined++; @@ -258,7 +258,7 @@ void menu_tick(void) } } - var80087260 = 0; + g_MpReturningFromMatch = 0; } else { vi_black(true); g_PlayersWithControl[0] = false; @@ -390,7 +390,7 @@ void menu_tick(void) } else { // Joining from advanced setup g_MpNumJoined++; - func0f17fcb0(false); + mp_open_advanced_setup(false); } } @@ -418,7 +418,7 @@ void menu_tick(void) // reached the adv setup layer - open the dialog g_Vars.waitingtojoin[i] = false; g_MpNumJoined++; - func0f17fcb0(false); + mp_open_advanced_setup(false); } } } @@ -614,7 +614,7 @@ void menu_tick(void) break; case MENUROOT_MPENDSCREEN: if (g_Vars.normmplayerisrunning) { - var80087260 = 3; + g_MpReturningFromMatch = 3; } else if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { struct mpplayerconfig tmp; diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index 4c8149ea6..e1dd95aa3 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -33,14 +33,12 @@ struct chrdata *g_MpAllChrPtrs[MAX_MPCHRS]; struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS]; s32 g_MpNumChrs; -u32 var800ac534; struct mpbotconfig g_BotConfigsArray[MAX_BOTS]; u8 g_MpSimulantDifficultiesPerNumPlayers[MAX_BOTS][MAX_PLAYERS]; struct mpplayerconfig g_PlayerConfigsArray[MAX_MPPLAYERCONFIGS]; u8 g_AmBotCommands[9]; struct mpsetup g_MpSetup; struct bossfile g_BossFile; -u32 var800acc1c; struct mplockinfo g_MpLockInfo; struct modeldef *g_PheadModeldefs[18]; @@ -52,7 +50,7 @@ s32 g_MpWeaponSetNum; const char var7f1b8a00[] = "||||||||||||| Starting game... players %d\n"; #endif -s32 var80087260 = 0x00000000; +s32 g_MpReturningFromMatch = 0; bool g_MpEnableMusicSwitching = false; struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = { @@ -127,7 +125,7 @@ f32 mp_handicap_to_value(u8 handicap) return tmp * tmp * 3 - 2; } -void func0f187838(struct mpchrconfig *mpchr) +void mp_reset_mpchrconfig_for_match(struct mpchrconfig *mpchr) { s32 i = 0; @@ -254,7 +252,7 @@ void mp_reset(void) for (i = 0; i < MAX_MPCHRS; i++) { struct mpchrconfig *mpchr = MPCHR(i); - func0f187838(mpchr); + mp_reset_mpchrconfig_for_match(mpchr); #if VERSION >= VERSION_NTSC_1_0 g_MpAllChrPtrs[i] = NULL; @@ -355,14 +353,14 @@ void mp_calculate_team_is_only_ai(void) } } -void func0f187fbc(s32 playernum) +void mp_init_handicaps(s32 playernum) { g_PlayerConfigsArray[playernum].base.unk18 = 80; g_PlayerConfigsArray[playernum].base.unk1a = 80; g_PlayerConfigsArray[playernum].base.unk1c = 75; } -void func0f187fec(void) +void mp_init_limits(void) { g_MpSetup.timelimit = 9; g_MpSetup.scorelimit = 9; @@ -374,7 +372,7 @@ void mp_player_set_defaults(s32 playernum, bool autonames) s32 i; s32 j; - func0f187fbc(playernum); + mp_init_handicaps(playernum); g_PlayerConfigsArray[playernum].controlmode = CONTROLMODE_11; @@ -451,7 +449,7 @@ void mp_player_set_defaults(s32 playernum, bool autonames) } } -void func0f1881d4(s32 index) +void mp_init_botconfig(s32 index) { g_BotConfigsArray[index].base.name[0] = '\0'; g_BotConfigsArray[index].base.mpheadnum = MPHEAD_DARK_COMBAT; @@ -482,7 +480,7 @@ void mp_init(void) g_Vars.mphilltime = 10; - func0f187fec(); + mp_init_limits(); g_MpSetup.fileguid.fileid = 0; g_MpSetup.fileguid.deviceserial = 0; @@ -494,14 +492,14 @@ void mp_init(void) } for (i = 0; i < MAX_BOTS; i++) { - func0f1881d4(i); + mp_init_botconfig(i); } if (arg_find_by_prefix(1, "-mpwpnset")) { char *value = arg_find_by_prefix(1, "-mpwpnset"); - mp_set_weapon_set(*value - '0'); + mp_set_weaponset_slotnum(*value - '0'); } else { - mp_set_weapon_set(0); + mp_set_weaponset_slotnum(0); } g_Vars.mplayerisrunning = false; @@ -858,7 +856,7 @@ s32 mp_get_team_rankings(struct ranking *rankings) return count; } -s32 func0f188bcc(void) +s32 mp_get_num_mpweapons(void) { return NUM_MPWEAPONS; } @@ -974,21 +972,28 @@ struct mpweapon *mp_get_mp_weapon_by_location(s32 locationindex) return &g_MpWeapons[mpweaponnum]; } -s32 mp_count_weapon_set_thing(s32 weaponsetindex) +#define MPWEAPONSET_IS_FULLY_UNLOCKED(mpweaponsetnum) \ + (challenge_is_feature_unlocked(g_MpWeaponSets[mpweaponsetnum].requirefeatures[0]) \ + && challenge_is_feature_unlocked(g_MpWeaponSets[mpweaponsetnum].requirefeatures[1]) \ + && challenge_is_feature_unlocked(g_MpWeaponSets[mpweaponsetnum].requirefeatures[2]) \ + && challenge_is_feature_unlocked(g_MpWeaponSets[mpweaponsetnum].requirefeatures[3])) + +#define MPWEAPONSET_IS_AVAILABLE(mpweaponsetnum) \ + (MPWEAPONSET_IS_FULLY_UNLOCKED(mpweaponsetnum) || g_MpWeaponSets[i].slotsiflocked[0] != WEAPON_DISABLED) + +s32 mp_mpweaponset_to_slotnum(s32 slotnum) { s32 i; s32 count = 0; - if (weaponsetindex >= ARRAYCOUNT(g_MpWeaponSets)) { - count = weaponsetindex - ARRAYCOUNT(g_MpWeaponSets); - weaponsetindex = ARRAYCOUNT(g_MpWeaponSets); + if (slotnum >= ARRAYCOUNT(g_MpWeaponSets)) { + // Custom, Random or Random Five + count = slotnum - ARRAYCOUNT(g_MpWeaponSets); + slotnum = ARRAYCOUNT(g_MpWeaponSets); } - for (i = 0; i < weaponsetindex; i++) { - if ((challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[0]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[1]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[2]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[3])) || g_MpWeaponSets[i].unk0c != WEAPON_DISABLED) { + for (i = 0; i < slotnum; i++) { + if (MPWEAPONSET_IS_AVAILABLE(i)) { count++; } } @@ -996,41 +1001,36 @@ s32 mp_count_weapon_set_thing(s32 weaponsetindex) return count; } -s32 func0f188f9c(s32 arg0) +s32 mp_slotnum_to_mpweaponset(s32 mpweaponset) { s32 i; for (i = 0; i < ARRAYCOUNT(g_MpWeaponSets); i++) { - // @bug? Shouldn't the disabled check be == WEAPON_DISABLED? - if ((challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[0]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[1]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[2]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[3])) - || g_MpWeaponSets[i].unk0c != WEAPON_DISABLED) { - if (arg0 == 0) { + if (MPWEAPONSET_IS_AVAILABLE(i)) { + if (mpweaponset == 0) { break; } - arg0--; + mpweaponset--; } } - return i + arg0; + return i + mpweaponset; } -s32 func0f189058(bool full) +s32 mp_get_num_weaponset_slots(bool full) { - return mp_count_weapon_set_thing(full ? ARRAYCOUNT(g_MpWeaponSets) + 3 : ARRAYCOUNT(g_MpWeaponSets)); + return mp_mpweaponset_to_slotnum(full ? ARRAYCOUNT(g_MpWeaponSets) + 3 : ARRAYCOUNT(g_MpWeaponSets)); } -s32 func0f189088(void) +s32 mp_get_custom_weaponset_slot(void) { - return mp_count_weapon_set_thing(ARRAYCOUNT(g_MpWeaponSets) + 2); + return mp_mpweaponset_to_slotnum(ARRAYCOUNT(g_MpWeaponSets) + 2); } -char *mp_get_weapon_set_name(s32 index) +char *mp_get_weaponset_name_by_slotnum(s32 index) { - index = func0f188f9c(index); + index = mp_slotnum_to_mpweaponset(index); if (index < 0 || index >= ARRAYCOUNT(g_MpWeaponSets) + 2) { return lang_get(L_MPWEAPONS_041); // "Custom" @@ -1047,30 +1047,27 @@ char *mp_get_weapon_set_name(s32 index) return lang_get(g_MpWeaponSets[index].name); } -void func0f18913c(void) +void mp_find_weaponsetnum_by_weapons(void) { s32 i; bool done = false; - u8 *ptr; + u8 *slots; s32 j; for (i = 0; !done && i < ARRAYCOUNT(g_MpWeaponSets); i++) { - if (challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[0]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[1]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[2]) - && challenge_is_feature_unlocked(g_MpWeaponSets[i].requirefeatures[3])) { - ptr = &g_MpWeaponSets[i].slots[0]; - } else if (g_MpWeaponSets[i].unk0c != WEAPON_DISABLED) { - ptr = &g_MpWeaponSets[i].unk0c; + if (MPWEAPONSET_IS_FULLY_UNLOCKED(i)) { + slots = g_MpWeaponSets[i].slots; + } else if (g_MpWeaponSets[i].slotsiflocked[0] != WEAPON_DISABLED) { + slots = g_MpWeaponSets[i].slotsiflocked; } else { - ptr = NULL; + slots = NULL; } - if (ptr != NULL) { + if (slots != NULL) { bool ok = true; for (j = 0; j < ARRAYCOUNT(g_MpWeaponSets[j].slots); j++) { - s32 weaponnum = ptr[j]; + s32 weaponnum = slots[j]; if (weaponnum == WEAPON_MPSHIELD) { if (!challenge_is_feature_unlocked(MPFEATURE_WEAPON_SHIELD)) { @@ -1095,29 +1092,26 @@ void func0f18913c(void) } } -void mp_apply_weapon_set(void) +void mp_apply_weaponset(void) { s32 i; - u8 *ptr; + u8 *slots; if (g_MpWeaponSetNum >= 0 && g_MpWeaponSetNum < ARRAYCOUNT(g_MpWeaponSets)) { - if (challenge_is_feature_unlocked(g_MpWeaponSets[g_MpWeaponSetNum].requirefeatures[0]) - && challenge_is_feature_unlocked(g_MpWeaponSets[g_MpWeaponSetNum].requirefeatures[1]) - && challenge_is_feature_unlocked(g_MpWeaponSets[g_MpWeaponSetNum].requirefeatures[2]) - && challenge_is_feature_unlocked(g_MpWeaponSets[g_MpWeaponSetNum].requirefeatures[3])) { - ptr = &g_MpWeaponSets[g_MpWeaponSetNum].slots[0]; - } else if (g_MpWeaponSets[g_MpWeaponSetNum].unk0c != WEAPON_DISABLED) { - ptr = &g_MpWeaponSets[g_MpWeaponSetNum].unk0c; + if (MPWEAPONSET_IS_FULLY_UNLOCKED(g_MpWeaponSetNum)) { + slots = g_MpWeaponSets[g_MpWeaponSetNum].slots; + } else if (g_MpWeaponSets[g_MpWeaponSetNum].slotsiflocked[0] != WEAPON_DISABLED) { + slots = g_MpWeaponSets[g_MpWeaponSetNum].slotsiflocked; } else { - ptr = NULL; + slots = NULL; } - if (ptr != NULL) { + if (slots != NULL) { for (i = 0; i < ARRAYCOUNT(g_MpSetup.weapons); i++) { u32 j; bool done = false; s32 mpweaponnum = MPWEAPON_NONE; - s32 weaponnum = ptr[i]; + s32 weaponnum = slots[i]; if (weaponnum == WEAPON_MPSHIELD && !challenge_is_feature_unlocked(MPFEATURE_WEAPON_SHIELD)) { weaponnum = 0; @@ -1152,22 +1146,22 @@ void mp_apply_weapon_set(void) } } -void mp_set_weapon_set(s32 weaponsetnum) +void mp_set_weaponset_slotnum(s32 slotnum) { - g_MpWeaponSetNum = func0f188f9c(weaponsetnum); - mp_apply_weapon_set(); + g_MpWeaponSetNum = mp_slotnum_to_mpweaponset(slotnum); + mp_apply_weaponset(); } -void func0f1895e8(void) +void mp_apply_weaponset_if_standard(void) { if (g_MpWeaponSetNum < ARRAYCOUNT(g_MpWeaponSets)) { - mp_apply_weapon_set(); + mp_apply_weaponset(); } } -s32 mp_get_weapon_set(void) +s32 mp_get_weaponset_slotnum(void) { - return mp_count_weapon_set_thing(g_MpWeaponSetNum); + return mp_mpweaponset_to_slotnum(g_MpWeaponSetNum); } bool mp_is_paused(void) @@ -1438,25 +1432,87 @@ s32 mp_find_min_float(s32 numplayers, f32 val0, f32 val1, f32 val2, f32 val3) } struct mpweaponset g_MpWeaponSets[12] = { - { /*0x00*/ L_MPWEAPONS_055, { WEAPON_FALCON2, WEAPON_MAGSEC4, WEAPON_PHOENIX, WEAPON_MAULER, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_PHOENIX, MPFEATURE_WEAPON_MAULER, 0, 0 }, WEAPON_FALCON2, WEAPON_MAGSEC4, WEAPON_FALCON2, WEAPON_DY357MAGNUM, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Pistols - { /*0x01*/ L_MPWEAPONS_054, { WEAPON_FALCON2, WEAPON_CMP150, WEAPON_LAPTOPGUN, WEAPON_AR34, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_LAPTOPGUN, 0, 0, 0 }, WEAPON_FALCON2, WEAPON_CMP150, WEAPON_DRAGON, WEAPON_AR34, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Automatics - { /*0x02*/ L_MPWEAPONS_053, { WEAPON_MAGSEC4, WEAPON_DY357MAGNUM, WEAPON_SHOTGUN, WEAPON_RCP120, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_SHOTGUN, MPFEATURE_WEAPON_RCP120, 0, 0 }, WEAPON_MAGSEC4, WEAPON_DY357MAGNUM, WEAPON_DRAGON, WEAPON_AR34, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Power - { /*0x03*/ L_MPWEAPONS_052, { WEAPON_PHOENIX, WEAPON_CYCLONE, WEAPON_CALLISTO, WEAPON_FARSIGHT, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_FARSIGHT, MPFEATURE_WEAPON_CALLISTO, 0, 0 }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // FarSight - { /*0x04*/ L_MPWEAPONS_051, { WEAPON_FALCON2, WEAPON_CMP150, WEAPON_DRAGON, WEAPON_TRANQUILIZER, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_TRANQUILIZER, 0, 0, 0 }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // Tranquilizer - { /*0x05*/ L_MPWEAPONS_050, { WEAPON_MAULER, WEAPON_K7AVENGER, WEAPON_REAPER, WEAPON_SUPERDRAGON, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_SUPERDRAGON, MPFEATURE_WEAPON_MAULER, MPFEATURE_WEAPON_K7AVENGER, MPFEATURE_WEAPON_REAPER }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // Heavy - { /*0x06*/ L_MPWEAPONS_049, { WEAPON_FALCON2_SILENCER, WEAPON_GRENADE, WEAPON_CMP150, WEAPON_DY357LX, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_FALCON2SILENCED, MPFEATURE_WEAPON_DY357LX, 0, 0 }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // Golden Magnum - { /*0x07*/ L_MPWEAPONS_048, { WEAPON_DEVASTATOR, WEAPON_DEVASTATOR, WEAPON_SUPERDRAGON, WEAPON_SUPERDRAGON, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_SUPERDRAGON, MPFEATURE_WEAPON_DEVASTATOR, 0, 0 }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // Explosive - { /*0x08*/ L_MPWEAPONS_047, { WEAPON_MAGSEC4, WEAPON_CMP150, WEAPON_AR34, WEAPON_DEVASTATOR, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_DEVASTATOR, 0, 0, 0 }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // Grenade Launcher - { /*0x09*/ L_MPWEAPONS_046, { WEAPON_MAULER, WEAPON_CYCLONE, WEAPON_DRAGON, WEAPON_ROCKETLAUNCHER, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_MAULER, 0, 0, 0 }, WEAPON_FALCON2, WEAPON_CYCLONE, WEAPON_DRAGON, WEAPON_ROCKETLAUNCHER, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Rocket Launcher - { /*0x0a*/ L_MPWEAPONS_045, { WEAPON_MAGSEC4, WEAPON_LAPTOPGUN, WEAPON_K7AVENGER, WEAPON_PROXIMITYMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_LAPTOPGUN, MPFEATURE_WEAPON_K7AVENGER, MPFEATURE_WEAPON_PROXIMITYMINE, 0 }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // Proximity Mine + { /*0x00*/ + L_MPWEAPONS_055, // Pistols + { WEAPON_FALCON2, WEAPON_MAGSEC4, WEAPON_PHOENIX, WEAPON_MAULER, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_PHOENIX, MPFEATURE_WEAPON_MAULER, 0, 0 }, + { WEAPON_FALCON2, WEAPON_MAGSEC4, WEAPON_FALCON2, WEAPON_DY357MAGNUM, WEAPON_MPSHIELD, WEAPON_DISABLED }, + }, + { /*0x01*/ + L_MPWEAPONS_054, // Automatics + { WEAPON_FALCON2, WEAPON_CMP150, WEAPON_LAPTOPGUN, WEAPON_AR34, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_LAPTOPGUN, 0, 0, 0 }, + { WEAPON_FALCON2, WEAPON_CMP150, WEAPON_DRAGON, WEAPON_AR34, WEAPON_MPSHIELD, WEAPON_DISABLED }, + }, + { /*0x02*/ + L_MPWEAPONS_053, // Power + { WEAPON_MAGSEC4, WEAPON_DY357MAGNUM, WEAPON_SHOTGUN, WEAPON_RCP120, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_SHOTGUN, MPFEATURE_WEAPON_RCP120, 0, 0 }, + { WEAPON_MAGSEC4, WEAPON_DY357MAGNUM, WEAPON_DRAGON, WEAPON_AR34, WEAPON_MPSHIELD, WEAPON_DISABLED }, + }, + { /*0x03*/ + L_MPWEAPONS_052, // FarSight + { WEAPON_PHOENIX, WEAPON_CYCLONE, WEAPON_CALLISTO, WEAPON_FARSIGHT, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_FARSIGHT, MPFEATURE_WEAPON_CALLISTO, 0, 0 }, + { WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, + }, + { /*0x04*/ + L_MPWEAPONS_051, // Tranquilizer + { WEAPON_FALCON2, WEAPON_CMP150, WEAPON_DRAGON, WEAPON_TRANQUILIZER, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_TRANQUILIZER, 0, 0, 0 }, + { WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, + }, + { /*0x05*/ + L_MPWEAPONS_050, // Heavy + { WEAPON_MAULER, WEAPON_K7AVENGER, WEAPON_REAPER, WEAPON_SUPERDRAGON, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_SUPERDRAGON, MPFEATURE_WEAPON_MAULER, MPFEATURE_WEAPON_K7AVENGER, MPFEATURE_WEAPON_REAPER }, + { WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, + }, + { /*0x06*/ + L_MPWEAPONS_049, // Golden Magnum + { WEAPON_FALCON2_SILENCER, WEAPON_GRENADE, WEAPON_CMP150, WEAPON_DY357LX, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_FALCON2SILENCED, MPFEATURE_WEAPON_DY357LX, 0, 0 }, + { WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, + }, + { /*0x07*/ + L_MPWEAPONS_048, // Explosive + { WEAPON_DEVASTATOR, WEAPON_DEVASTATOR, WEAPON_SUPERDRAGON, WEAPON_SUPERDRAGON, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_SUPERDRAGON, MPFEATURE_WEAPON_DEVASTATOR, 0, 0 }, + { WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, + }, + { /*0x08*/ + L_MPWEAPONS_047, // Grenade Launcher + { WEAPON_MAGSEC4, WEAPON_CMP150, WEAPON_AR34, WEAPON_DEVASTATOR, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_DEVASTATOR, 0, 0, 0 }, + { WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, + }, + { /*0x09*/ + L_MPWEAPONS_046, // Rocket Launcher + { WEAPON_MAULER, WEAPON_CYCLONE, WEAPON_DRAGON, WEAPON_ROCKETLAUNCHER, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_MAULER, 0, 0, 0 }, + { WEAPON_FALCON2, WEAPON_CYCLONE, WEAPON_DRAGON, WEAPON_ROCKETLAUNCHER, WEAPON_MPSHIELD, WEAPON_DISABLED }, + }, + { /*0x0a*/ + L_MPWEAPONS_045, // Proximity Mine + { WEAPON_MAGSEC4, WEAPON_LAPTOPGUN, WEAPON_K7AVENGER, WEAPON_PROXIMITYMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_LAPTOPGUN, MPFEATURE_WEAPON_K7AVENGER, MPFEATURE_WEAPON_PROXIMITYMINE, 0 }, + { WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, + }, + { /*0x0b*/ + L_MPWEAPONS_044, // Close Combat #if VERSION == VERSION_JPN_FINAL - { /*0x0b*/ L_MPWEAPONS_044, { WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_CROSSBOW, 0, 0, 0 }, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Close Combat + { WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_CROSSBOW, 0, 0, 0 }, + { WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, #else - { /*0x0b*/ L_MPWEAPONS_044, { WEAPON_COMBATKNIFE, WEAPON_COMBATKNIFE, WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_CROSSBOW, 0, 0, 0 }, WEAPON_COMBATKNIFE, WEAPON_COMBATKNIFE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Close Combat + { WEAPON_COMBATKNIFE, WEAPON_COMBATKNIFE, WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_MPSHIELD, WEAPON_DISABLED }, + { MPFEATURE_WEAPON_CROSSBOW, 0, 0, 0 }, + { WEAPON_COMBATKNIFE, WEAPON_COMBATKNIFE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, #endif + }, }; -s32 g_MpWeaponSetNum = 0x00000000; +s32 g_MpWeaponSetNum = 0; u16 g_AwardNames[] = { L_MPMENU_000, // "Most Suicidal" @@ -3054,7 +3110,7 @@ void mp_remove_simulant(s32 index) { g_MpSetup.chrslots &= ~(1 << (index + 4)); g_BotConfigsArray[index].base.name[0] = '\0'; - func0f1881d4(index); + mp_init_botconfig(index); mp_generate_bot_names(); } @@ -3193,7 +3249,7 @@ const char var7f1b8c04[] = "PakId for player %d: %d\n"; const char var7f1b8c20[] = "Load Player - Result: %d\n"; #endif -s32 mp_player_get_index(struct chrdata *chr) +s32 mp_chr_to_chrindex(struct chrdata *chr) { s32 i; @@ -3206,7 +3262,7 @@ s32 mp_player_get_index(struct chrdata *chr) return -1; } -struct chrdata *mp_get_chr_from_player_index(s32 index) +struct chrdata *mp_chrindex_to_chr(s32 index) { if (index >= 0 && index < g_MpNumChrs) { return g_MpAllChrPtrs[index]; @@ -3215,38 +3271,49 @@ struct chrdata *mp_get_chr_from_player_index(s32 index) return NULL; } -s32 func0f18d074(s32 index) +/** + * chrslots 0-3 are human players + * chrslots 4-11 are bot players + * + * So for a match with 2 humans and a bot, the chrslots are: + * HH..B....... + * + * player 1 = chrindex 0, chrslot 0 + * player 2 = chrindex 1, chrslot 1 + * bot = chrindex 2, chrslot 4 + */ +s32 mp_chrindex_to_chrslot(s32 chrnum) { s32 i; for (i = 0; i < MAX_PLAYERS; i++) { - if (&g_PlayerConfigsArray[i].base == g_MpAllChrConfigPtrs[index]) { + if (&g_PlayerConfigsArray[i].base == g_MpAllChrConfigPtrs[chrnum]) { return i; } } for (i = 0; i < MAX_BOTS; i++) { - if (&g_BotConfigsArray[i].base == g_MpAllChrConfigPtrs[index]) { - return i + 4; + if (&g_BotConfigsArray[i].base == g_MpAllChrConfigPtrs[chrnum]) { + return MAX_PLAYERS + i; } } return -1; } -s32 func0f18d0e8(s32 arg0) +s32 mp_chrslot_to_chrindex(s32 chrslot) { s32 i; - if (arg0 < 4) { + if (chrslot < MAX_PLAYERS) { for (i = 0; i < g_MpNumChrs; i++) { - if (g_MpAllChrConfigPtrs[i] == &g_PlayerConfigsArray[arg0].base) { + if (g_MpAllChrConfigPtrs[i] == &g_PlayerConfigsArray[chrslot].base) { return i; } } } else { for (i = 0; i < g_MpNumChrs; i++) { - if (g_MpAllChrConfigPtrs[i] == &g_BotConfigsArray[arg0 - 4].base) { + if (g_MpAllChrConfigPtrs[i] == &g_BotConfigsArray[chrslot - MAX_PLAYERS].base) { return i; } } @@ -3293,7 +3360,7 @@ void mpplayerfile_save_gun_funcs(struct savebuffer *buffer, s32 playernum) } } -void mpplayerfile_load_wad(s32 playernum, struct savebuffer *buffer, s32 arg2) +void mpplayerfile_load_wad(s32 playernum, struct savebuffer *buffer, bool arg2) { struct fileguid guid; u32 stack; @@ -3303,7 +3370,7 @@ void mpplayerfile_load_wad(s32 playernum, struct savebuffer *buffer, s32 arg2) savebuffer_read_string(buffer, g_PlayerConfigsArray[playernum].base.name, 1); g_PlayerConfigsArray[playernum].time = savebuffer_read_bits(buffer, 28); - if (arg2 != 0) { + if (arg2) { g_PlayerConfigsArray[playernum].base.mpheadnum = savebuffer_read_bits(buffer, 7); g_PlayerConfigsArray[playernum].base.mpbodynum = savebuffer_read_bits(buffer, 7); @@ -3541,7 +3608,7 @@ s32 mpplayerfile_load(s32 playernum, s32 device, s32 fileid, u16 deviceserial) g_PlayerConfigsArray[playernum].fileguid.fileid = fileid; g_PlayerConfigsArray[playernum].fileguid.deviceserial = deviceserial; - mpplayerfile_load_wad(playernum, &buffer, 1); + mpplayerfile_load_wad(playernum, &buffer, true); savebuffer_print(&buffer); g_PlayerConfigsArray[playernum].handicap = 0x80; @@ -3699,11 +3766,11 @@ void mp_apply_config(struct mpconfigfull *config) } } - func0f18913c(); + mp_find_weaponsetnum_by_weapons(); challenge_remove_force_unlocks(); } -void mp0f18dec4(s32 slot) +void mp_load_preset_by_slotnum(s32 slot) { struct mpconfigfull *config; u8 buffer[0x1ca]; @@ -3777,7 +3844,7 @@ void mpsetupfile_load_wad(struct savebuffer *buffer) g_MpSetup.weapons[i] = savebuffer_read_bits(buffer, 7); } - func0f18913c(); + mp_find_weaponsetnum_by_weapons(); g_MpSetup.timelimit = savebuffer_read_bits(buffer, 6); g_MpSetup.scorelimit = savebuffer_read_bits(buffer, 7); diff --git a/src/game/mplayer/scenarios.c b/src/game/mplayer/scenarios.c index 1d9c9976d..e6f3e6b97 100644 --- a/src/game/mplayer/scenarios.c +++ b/src/game/mplayer/scenarios.c @@ -1061,8 +1061,8 @@ bool scenario_chrs_are_same_team(s32 playernum1, s32 playernum2) struct mpchrconfig *bchr; if ((g_MpSetup.options & MPOPTION_TEAMSENABLED) && playernum1 >= 0 && playernum2 >= 0) { - s32 a = func0f18d074(playernum1); - s32 b = func0f18d074(playernum2); + s32 a = mp_chrindex_to_chrslot(playernum1); + s32 b = mp_chrindex_to_chrslot(playernum2); if (a >= 0 && b >= 0) { achr = MPCHR(a); @@ -1098,7 +1098,7 @@ s32 scenario_pick_up_briefcase(struct chrdata *chr, struct prop *prop) g_ScenarioData.htb.token = chr->prop; if (chr->aibot) { - mpchr = g_MpAllChrConfigPtrs[mp_player_get_index(chr)]; + mpchr = g_MpAllChrConfigPtrs[mp_chr_to_chrindex(chr)]; prop_play_pickup_sound(prop, weapon->weaponnum); chr->aibot->hasbriefcase = true; botinv_give_single_weapon(chr, WEAPON_BRIEFCASE2); @@ -1149,7 +1149,7 @@ s32 scenario_pick_up_briefcase(struct chrdata *chr, struct prop *prop) #endif } else if (g_MpSetup.scenario == MPSCENARIO_CAPTURETHECASE) { if (chr->aibot) { - mpchr = g_MpAllChrConfigPtrs[mp_player_get_index(chr)]; + mpchr = g_MpAllChrConfigPtrs[mp_chr_to_chrindex(chr)]; } else { mpchr = MPCHR(g_Vars.playerstats[g_Vars.currentplayernum].mpindex); } @@ -1400,7 +1400,7 @@ s32 scenario_pick_up_uplink(struct chrdata *chr, struct prop *prop) g_ScenarioData.htm.uplink = chr->prop; if (chr->aibot) { - mpchr = g_MpAllChrConfigPtrs[mp_player_get_index(chr)]; + mpchr = g_MpAllChrConfigPtrs[mp_chr_to_chrindex(chr)]; } else { mpchr = MPCHR(g_Vars.playerstats[g_Vars.currentplayernum].mpindex); } @@ -1472,7 +1472,7 @@ void scenario_handle_activated_prop(struct chrdata *chr, struct prop *prop) struct defaultobj *obj = prop->obj; if (obj->flags3 & OBJFLAG3_HTMTERMINAL) { - u32 mpindex = mp_player_get_index(chr); + u32 mpindex = mp_chr_to_chrindex(chr); if ((obj->hidden & OBJHFLAG_ACTIVATED_BY_BOND) == 0) { obj->hidden &= 0x0fffffff; diff --git a/src/game/mplayer/scenarios/capturethecase.inc b/src/game/mplayer/scenarios/capturethecase.inc index 354dba2ec..3e841f804 100644 --- a/src/game/mplayer/scenarios/capturethecase.inc +++ b/src/game/mplayer/scenarios/capturethecase.inc @@ -235,18 +235,18 @@ void ctc_init_props(void) } #if VERSION >= VERSION_NTSC_1_0 - mpindex = func0f18d0e8(k); + mpindex = mp_chrslot_to_chrindex(k); if (mpindex >= 0) { - struct chrdata *chr = mp_get_chr_from_player_index(mpindex); + struct chrdata *chr = mp_chrindex_to_chr(mpindex); if (chr) { chr->team = 1 << mpchr->team; } } #else - if (func0f18d0e8(k) >= 0) { - struct chrdata *chr = mp_get_chr_from_player_index(func0f18d0e8(k)); + if (mp_chrslot_to_chrindex(k) >= 0) { + struct chrdata *chr = mp_chrindex_to_chr(mp_chrslot_to_chrindex(k)); if (chr) { chr->team = 1 << mpchr->team; diff --git a/src/game/mplayer/scenarios/hackthatmac.inc b/src/game/mplayer/scenarios/hackthatmac.inc index 84aead486..2274904da 100644 --- a/src/game/mplayer/scenarios/hackthatmac.inc +++ b/src/game/mplayer/scenarios/hackthatmac.inc @@ -403,7 +403,7 @@ void htm_tick_chr(struct chrdata *chr) if (chr) { hasuplink = chr->aibot->hasuplink; - playernum = mp_player_get_index(chr); + playernum = mp_chr_to_chrindex(chr); } else { hasuplink = inv_has_data_uplink() && bgun_get_weapon_num(HAND_RIGHT) == WEAPON_DATAUPLINK; playernum = g_Vars.currentplayernum; @@ -623,7 +623,7 @@ void htm_calculate_player_score(struct mpchrconfig *mpchr, s32 mpchrnum, s32 *sc s32 index; *score = 0; - index = func0f18d0e8(mpchrnum); + index = mp_chrslot_to_chrindex(mpchrnum); if (index >= 0) { *score += g_ScenarioData.htm.numpoints[index] * 2; diff --git a/src/game/mplayer/scenarios/holdthebriefcase.inc b/src/game/mplayer/scenarios/holdthebriefcase.inc index 7c82ec89b..48c5b91d6 100644 --- a/src/game/mplayer/scenarios/holdthebriefcase.inc +++ b/src/game/mplayer/scenarios/holdthebriefcase.inc @@ -356,7 +356,7 @@ void htb_tick_chr(struct chrdata *chr) if (chr->aibot->htbheldtimer60 >= TICKS(7200)) { snd_start(var80095200, SFX_MP_SCOREPOINT, NULL, -1, -1, -1, -1, -1); - g_MpAllChrConfigPtrs[mp_player_get_index(chr)]->numpoints++; + g_MpAllChrConfigPtrs[mp_chr_to_chrindex(chr)]->numpoints++; chr->aibot->htbheldtimer60 = 0; } } else { diff --git a/src/game/mplayer/scenarios/popacap.inc b/src/game/mplayer/scenarios/popacap.inc index 859dcee82..21d5ad98c 100644 --- a/src/game/mplayer/scenarios/popacap.inc +++ b/src/game/mplayer/scenarios/popacap.inc @@ -338,7 +338,7 @@ void pac_calculate_player_score(struct mpchrconfig *mpchr, s32 mpchrnum, s32 *sc s32 index; *score = 0; - index = func0f18d0e8(mpchrnum); + index = mp_chrslot_to_chrindex(mpchrnum); if (index >= 0) { *score += g_ScenarioData.pac.killcounts[index] * 2; diff --git a/src/game/mplayer/setup.c b/src/game/mplayer/setup.c index 09ac30276..29aa15255 100644 --- a/src/game/mplayer/setup.c +++ b/src/game/mplayer/setup.c @@ -31,11 +31,11 @@ struct menudialogdef g_MpChangeTeamNameMenuDialog; struct menudialogdef g_MpEditSimulantMenuDialog; struct menudialogdef g_MpSaveSetupNameMenuDialog; -void func0f17b8f0(void); -MenuItemHandlerResult menuhandler0017e9d8(s32 operation, struct menuitem *item, union handlerdata *data); +void mp_restart_character_body_label_timer(void); +MenuItemHandlerResult menuhandler_mp_challenge_description_and_separator(s32 operation, struct menuitem *item, union handlerdata *data); MenuItemHandlerResult menuhandler_mp_start_challenge(s32 operation, struct menuitem *item, union handlerdata *data); MenuItemHandlerResult menuhandler_mp_abort_challenge(s32 operation, struct menuitem *item, union handlerdata *data); -MenuItemHandlerResult menuhandler0017ec64(s32 operation, struct menuitem *item, union handlerdata *data); +MenuItemHandlerResult menuhandler_mp_accept_challenge2(s32 operation, struct menuitem *item, union handlerdata *data); void mp_close_dialogs_for_new_setup(void); MenuItemHandlerResult menuhandler_mp_drop_out(s32 operation, struct menuitem *item, union handlerdata *data) @@ -305,15 +305,15 @@ MenuItemHandlerResult menuhandler_mp_weapon_set_dropdown(s32 operation, struct m { switch (operation) { case MENUOP_GETOPTIONCOUNT: - data->dropdown.value = func0f189058(item->param); + data->dropdown.value = mp_get_num_weaponset_slots(item->param); break; case MENUOP_GETOPTIONTEXT: - return (s32) mp_get_weapon_set_name(data->dropdown.value); + return (s32) mp_get_weaponset_name_by_slotnum(data->dropdown.value); case MENUOP_SET: - mp_set_weapon_set(data->dropdown.value); + mp_set_weaponset_slotnum(data->dropdown.value); break; case MENUOP_GETSELECTEDINDEX: - data->dropdown.value = mp_get_weapon_set(); + data->dropdown.value = mp_get_weaponset_slotnum(); break; } @@ -494,7 +494,15 @@ char *mp_menu_text_setup_name(struct menuitem *item) } #endif -MenuItemHandlerResult func0f179b68(s32 operation, struct menuitem *item, union handlerdata *data) +/** + * These handicap functions are not called. + * + * As for the handicaps themselves: + * handicap1 is never read + * handicap2 is never read + * handicap3 limits the player's walk speed, but cannot be changed off its default. + */ +MenuItemHandlerResult menuhandler_mp_handicap1(s32 operation, struct menuitem *item, union handlerdata *data) { switch (operation) { case MENUOP_GETSLIDER: @@ -511,7 +519,7 @@ MenuItemHandlerResult func0f179b68(s32 operation, struct menuitem *item, union h return 0; } -MenuItemHandlerResult func0f179c14(s32 operation, struct menuitem *item, union handlerdata *data) +MenuItemHandlerResult menuhandler_mp_handicap2(s32 operation, struct menuitem *item, union handlerdata *data) { switch (operation) { case MENUOP_GETSLIDER: @@ -528,7 +536,7 @@ MenuItemHandlerResult func0f179c14(s32 operation, struct menuitem *item, union h return 0; } -MenuItemHandlerResult func0f179cc0(s32 operation, struct menuitem *item, union handlerdata *data) +MenuItemHandlerResult menuhandler_mp_handicap3(s32 operation, struct menuitem *item, union handlerdata *data) { switch (operation) { case MENUOP_GETSLIDER: @@ -545,10 +553,10 @@ MenuItemHandlerResult func0f179cc0(s32 operation, struct menuitem *item, union h return 0; } -MenuItemHandlerResult func0f179d6c(s32 operation, struct menuitem *item, union handlerdata *data) +MenuItemHandlerResult menuhandler_mp_reset_handicaps(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_SET) { - func0f187fbc(g_MpPlayerNum); + mp_init_handicaps(g_MpPlayerNum); } return 0; @@ -646,7 +654,7 @@ MenuItemHandlerResult menuhandler_mp_character_body(s32 operation, struct menuit } } g_PlayerConfigsArray[g_MpPlayerNum].base.mpbodynum = data->carousel.value; - func0f17b8f0(); + mp_restart_character_body_label_timer(); break; case MENUOP_CHECKPREFOCUSED: #if VERSION >= VERSION_NTSC_1_0 @@ -662,7 +670,7 @@ MenuItemHandlerResult menuhandler_mp_character_body(s32 operation, struct menuit g_PlayerConfigsArray[g_MpPlayerNum].base.mpheadnum, true); } -MenuDialogHandlerResult menudialog0017a174(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) +MenuDialogHandlerResult menudialog_mp_human_character(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) { switch (operation) { case MENUOP_OPEN: @@ -1964,9 +1972,9 @@ char *mp_menu_text_body_name(struct menuitem *item) return mp_get_body_name(g_PlayerConfigsArray[g_MpPlayerNum].base.mpbodynum); } -void func0f17b8f0(void) +void mp_restart_character_body_label_timer(void) { - menu_set_item_redraw_timer(g_MpCharacterMenuItems, -0.4f); + menu_set_item_redraw_timer(&g_MpCharacterMenuItems[0], -0.4f); } MenuItemHandlerResult mp_player_name_menu_handler(s32 operation, struct menuitem *item, union handlerdata *data) @@ -2034,7 +2042,7 @@ MenuItemHandlerResult mp_load_settings_menu_handler(s32 operation, struct menuit mp_close_dialogs_for_new_setup(); if (data->list.value < mp_get_num_unlocked_presets()) { - mp0f18dec4(data->list.value); + mp_load_preset_by_slotnum(data->list.value); } else if (g_FileLists[1] != NULL) { struct filelistfile *file = &g_FileLists[1]->files[data->list.value - mp_get_num_unlocked_presets()]; struct fileguid guid; @@ -2267,7 +2275,7 @@ MenuItemHandlerResult menuhandler_mp_team_score_limit_slider(s32 operation, stru MenuItemHandlerResult menuhandler_mp_restore_score_defaults(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_SET) { - func0f187fec(); + mp_init_limits(); } return 0; @@ -2371,7 +2379,7 @@ struct menudialogdef g_MpCharacterMenuDialog = { MENUDIALOGTYPE_DEFAULT, L_MPMENU_143, // "Character" g_MpCharacterMenuItems, - menudialog0017a174, + menudialog_mp_human_character, MENUDIALOGFLAG_0002, NULL, }; @@ -2735,7 +2743,7 @@ MenuItemHandlerResult mp_add_change_simulant_menu_handler(s32 operation, struct } } - g_Menus[g_MpPlayerNum].mpsetup.unke24 = i; + g_Menus[g_MpPlayerNum].mpsetup.botprofileindex = i; // fall-through case MENUOP_GETSELECTEDINDEX: data->list.value = g_Menus[g_MpPlayerNum].mpsetup.slotcount; @@ -2761,7 +2769,7 @@ MenuItemHandlerResult mp_add_change_simulant_menu_handler(s32 operation, struct char *mp_menu_text_simulant_description(struct menuitem *item) { - return lang_get(L_MISC_106 + g_Menus[g_MpPlayerNum].mpsetup.unke24); + return lang_get(L_MISC_106 + g_Menus[g_MpPlayerNum].mpsetup.botprofileindex); } MenuItemHandlerResult menuhandler_mp_simulant_head(s32 operation, struct menuitem *item, union handlerdata *data) @@ -2769,6 +2777,7 @@ MenuItemHandlerResult menuhandler_mp_simulant_head(s32 operation, struct menuite s32 start = 0; if (item->param2 == 1) { + // Selecting a perfect head start = mp_get_num_heads(); } @@ -2804,7 +2813,7 @@ MenuItemHandlerResult menuhandler_mp_simulant_body(s32 operation, struct menuite false); } -MenuDialogHandlerResult menudialog0017ccfc(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) +MenuDialogHandlerResult menudialog_mp_bot_character(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) { switch (operation) { case MENUOP_TICK: @@ -2970,12 +2979,11 @@ char *mp_menu_text_simulant_name(struct menuitem *item) return g_BotConfigsArray[index].base.name; } -char *func0f17d3dc(struct menuitem *item) +char *mp_menu_text_simulant_num(struct menuitem *item) { s32 index = item->param; - if (g_BotConfigsArray[index].base.name[0] == '\0' - || ((g_MpSetup.chrslots & 1 << (index + 4)) == 0)) { + if (g_BotConfigsArray[index].base.name[0] == '\0' || (g_MpSetup.chrslots & 1 << (index + 4)) == 0) { return ""; } @@ -3054,7 +3062,7 @@ struct menudialogdef g_MpSimulantCharacterMenuDialog = { MENUDIALOGTYPE_DEFAULT, L_MPMENU_100, // "Simulant Character" g_MpSimulantCharacterMenuItems, - menudialog0017ccfc, + menudialog_mp_bot_character, MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_MPLOCKABLE, NULL, }; @@ -3414,7 +3422,7 @@ char *mp_menu_text_chr_name_for_team_setup(struct menuitem *item) return ""; } -MenuItemHandlerResult func0f17dac4(s32 operation, struct menuitem *item, union handlerdata *data) +MenuItemHandlerResult menuhandler_mp_team_slot2(s32 operation, struct menuitem *item, union handlerdata *data) { switch (operation) { case MENUOP_GETOPTIONCOUNT: @@ -3460,7 +3468,7 @@ MenuItemHandlerResult menuhandler_mp_team_slot(s32 operation, struct menuitem *i return menuhandler_mp_teams_label(operation, item, data); } - return func0f17dac4(operation, item, data); + return menuhandler_mp_team_slot2(operation, item, data); } char *mp_menu_text_select_tune_or_tunes(struct menuitem *item) @@ -4037,7 +4045,7 @@ MenuItemHandlerResult menuhandler_mp_team_name_slot(s32 operation, struct menuit return 0; } -char *func0f17e318(struct menudialogdef *dialogdef) +char *menutext_mp_challenge_name(struct menudialogdef *dialogdef) { sprintf(g_StringPointer, lang_get(L_MPMENU_056), challenge_get_name_by_slot(g_Menus[g_MpPlayerNum].mpsetup.slotindex)); return g_StringPointer; @@ -4046,7 +4054,7 @@ char *func0f17e318(struct menudialogdef *dialogdef) /** * An "Accept" item somewhere. Probably accepting a challenge. */ -MenuItemHandlerResult menuhandler0017e38c(s32 operation, struct menuitem *item, union handlerdata *data) +MenuItemHandlerResult menuhandler_mp_accept_challenge(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_SET) { #if VERSION >= VERSION_NTSC_1_0 @@ -4060,7 +4068,7 @@ MenuItemHandlerResult menuhandler0017e38c(s32 operation, struct menuitem *item, return 0; } -MenuDialogHandlerResult menudialog0017e3fc(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) +MenuDialogHandlerResult menudialog_mp_confirm_challenge(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) { switch (operation) { case MENUOP_OPEN: @@ -4310,7 +4318,7 @@ struct menuitem g_MpConfirmChallengeViaListOrDetailsMenuItems[] = { MENUITEMFLAG_LOCKABLEMINOR | MENUITEMFLAG_LOCKABLEMAJOR, L_MPMENU_057, // "Accept" 0, - menuhandler0017e38c, + menuhandler_mp_accept_challenge, }, { MENUITEMTYPE_SELECTABLE, @@ -4325,9 +4333,9 @@ struct menuitem g_MpConfirmChallengeViaListOrDetailsMenuItems[] = { struct menudialogdef g_MpConfirmChallengeViaListOrDetailsMenuDialog = { MENUDIALOGTYPE_DEFAULT, - (uintptr_t)&func0f17e318, + (uintptr_t)&menutext_mp_challenge_name, g_MpConfirmChallengeViaListOrDetailsMenuItems, - menudialog0017e3fc, + menudialog_mp_confirm_challenge, MENUDIALOGFLAG_STARTSELECTS | MENUDIALOGFLAG_MPLOCKABLE, NULL, }; @@ -4357,7 +4365,7 @@ struct menuitem g_MpChallengesListOrDetailsMenuItems[] = { 0, 0x0000007c, PAL ? 0x41 : 0x37, - menuhandler0017e9d8, + menuhandler_mp_challenge_description_and_separator, }, { MENUITEMTYPE_SEPARATOR, @@ -4365,7 +4373,7 @@ struct menuitem g_MpChallengesListOrDetailsMenuItems[] = { 0, 0, 0, - menuhandler0017e9d8, + menuhandler_mp_challenge_description_and_separator, }, { MENUITEMTYPE_SELECTABLE, @@ -4446,7 +4454,7 @@ struct menuitem g_MpConfirmChallengeMenuItems[] = { 0, L_MPMENU_057, // "Accept" 0, - menuhandler0017ec64, + menuhandler_mp_accept_challenge2, }, { MENUITEMTYPE_SELECTABLE, @@ -4461,9 +4469,9 @@ struct menuitem g_MpConfirmChallengeMenuItems[] = { struct menudialogdef g_MpConfirmChallengeMenuDialog = { MENUDIALOGTYPE_DEFAULT, - (uintptr_t)&func0f17e318, + (uintptr_t)&menutext_mp_challenge_name, g_MpConfirmChallengeMenuItems, - menudialog0017e3fc, + menudialog_mp_confirm_challenge, MENUDIALOGFLAG_STARTSELECTS, NULL, }; @@ -4582,7 +4590,7 @@ MenuItemHandlerResult mp_challenges_list_menu_handler(s32 operation, struct menu * This is for a separator and fixed height thing in the dialog at: * Combat Simulator > Advanced Setup > Challenges > pick one > Accept */ -MenuItemHandlerResult menuhandler0017e9d8(s32 operation, struct menuitem *item, union handlerdata *data) +MenuItemHandlerResult menuhandler_mp_challenge_description_and_separator(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_CHECKHIDDEN) { if (g_BossFile.locktype != MPLOCKTYPE_CHALLENGE) { @@ -4658,7 +4666,7 @@ MenuDialogHandlerResult mp_combat_challenges_menu_dialog(s32 operation, struct m return 0; } -MenuItemHandlerResult menuhandler0017ec64(s32 operation, struct menuitem *item, union handlerdata *data) +MenuItemHandlerResult menuhandler_mp_accept_challenge2(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_SET) { challenge_set_current_by_slot(g_Menus[g_MpPlayerNum].mpsetup.slotindex); @@ -4749,7 +4757,7 @@ char *mp_menu_text_save_player_or_copy(struct menuitem *item) return lang_get(L_MPMENU_039); // "Save Copy of Player" } -MenuItemHandlerResult menuhandler0017ef30(s32 operation, struct menuitem *item, union handlerdata *data) +MenuItemHandlerResult menuhandler_mp_abort_setup(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_SET) { if (g_Vars.stagenum == STAGE_CITRAINING) { @@ -4798,7 +4806,7 @@ char *mp_menu_text_arena_name(struct menuitem *item) char *mp_menu_text_weapon_set_name(struct menuitem *item) { - return mp_get_weapon_set_name(mp_get_weapon_set()); + return mp_get_weaponset_name_by_slotnum(mp_get_weaponset_slotnum()); } MenuDialogHandlerResult menudialog_mp_game_setup(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) @@ -4924,7 +4932,7 @@ void mp_configure_quick_team_simulants(void) } } -void func0f17f428(void) +void mp_apply_quickstart(void) { mp_configure_quick_team_players(); @@ -4944,7 +4952,7 @@ MenuItemHandlerResult menuhandler_mp_finished_setup(s32 operation, struct menuit #endif if (operation == MENUOP_SET) { - func0f17f428(); + mp_apply_quickstart(); } return 0; @@ -5093,8 +5101,8 @@ MenuItemHandlerResult menuhandler_mp_quick_team_option(s32 operation, struct men if (operation == MENUOP_SET) { g_Vars.mpquickteam = item->param; - if (mp_get_weapon_set() >= func0f189058(0)) { - mp_set_weapon_set(0); + if (mp_get_weaponset_slotnum() >= mp_get_num_weaponset_slots(false)) { + mp_set_weaponset_slotnum(0); } if (g_Vars.mpquickteam == MPQUICKTEAM_PLAYERSONLY || @@ -5413,7 +5421,7 @@ struct menuitem g_MpAbortMenuItems[] = { 0, L_MPMENU_054, // "Abort" 0, - menuhandler0017ef30, + menuhandler_mp_abort_setup, }, { MENUITEMTYPE_SELECTABLE, @@ -5847,7 +5855,7 @@ struct menudialogdef g_CombatSimulatorMenuDialog = { NULL, }; -void func0f17fcb0(s32 silent) +void mp_open_advanced_setup(s32 silent) { g_Menus[g_MpPlayerNum].playernum = g_MpPlayerNum; diff --git a/src/game/mpstats.c b/src/game/mpstats.c index d3ae5a158..c21394d0c 100644 --- a/src/game/mpstats.c +++ b/src/game/mpstats.c @@ -240,7 +240,7 @@ void mpstats_record_death(s32 aplayernum, s32 vplayernum) // Find attacker and victim mpchrs if (aplayernum >= 0) { - ampindex = func0f18d074(aplayernum); + ampindex = mp_chrindex_to_chrslot(aplayernum); if (ampindex >= 0) { ampchr = MPCHR(ampindex); @@ -248,7 +248,7 @@ void mpstats_record_death(s32 aplayernum, s32 vplayernum) } if (vplayernum >= 0) { - vmpindex = func0f18d074(vplayernum); + vmpindex = mp_chrindex_to_chrslot(vplayernum); if (vmpindex >= 0) { vmpchr = MPCHR(vmpindex); diff --git a/src/game/propobj.c b/src/game/propobj.c index e8cac2c97..1b1940f7c 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -4391,7 +4391,7 @@ void weapon_tick(struct prop *prop) s32 ownerplayernum = (obj->hidden & 0xf0000000) >> 28; if (g_Vars.normmplayerisrunning) { - struct chrdata *chr = mp_get_chr_from_player_index(ownerplayernum); + struct chrdata *chr = mp_chrindex_to_chr(ownerplayernum); if (chr) { ownerprop = chr->prop; @@ -4469,7 +4469,7 @@ void weapon_tick(struct prop *prop) // If a player manages to throw a mine on themselves, it will not detonate. // You can't throw a mine on yourself anyway, so this check always passes - if (prop->parent == NULL || parentchr == NULL || mp_player_get_index(parentchr) != ownerplayernum) { + if (prop->parent == NULL || parentchr == NULL || mp_chr_to_chrindex(parentchr) != ownerplayernum) { if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { if (ownerplayernum == 2) { u32 mask = 0; @@ -4549,7 +4549,7 @@ void weapon_tick(struct prop *prop) s32 ownerplayernum = (obj->hidden & 0xf0000000) >> 28; if (g_Vars.normmplayerisrunning) { - struct chrdata *chr = mp_get_chr_from_player_index(ownerplayernum); + struct chrdata *chr = mp_chrindex_to_chr(ownerplayernum); if (chr) { ownerprop = chr->prop; @@ -6151,7 +6151,7 @@ bool rocket_tick_fbw(struct weaponobj *rocket) // Check if close to an enemy if (ownerchr && rocket->timer240) { for (i = 0; i < g_MpNumChrs; i++) { - struct chrdata *chr = mp_get_chr_from_player_index(i); + struct chrdata *chr = mp_chrindex_to_chr(i); if (chr != ownerchr && !chr_is_dead(chr) @@ -6169,7 +6169,7 @@ bool rocket_tick_fbw(struct weaponobj *rocket) // Check if rocket can fly directly to target if (chr_get_target_prop(ownerchr) == chr->prop - && mp_player_get_index(ownerchr) == g_Vars.lvframenum % g_MpNumChrs + && mp_chr_to_chrindex(ownerchr) == g_Vars.lvframenum % g_MpNumChrs && cd_test_los05(&rocketprop->pos, rocketprop->rooms, &chr->prop->pos, chr->prop->rooms, CDTYPE_OBJS | CDTYPE_DOORS | CDTYPE_PATHBLOCKER | CDTYPE_BG | CDTYPE_AIOPAQUE, GEOFLAG_BLOCK_SIGHT)) { @@ -7063,7 +7063,7 @@ s32 projectile_tick(struct defaultobj *obj, bool *embedded) struct prop *ownerprop2 = NULL; if (g_Vars.normmplayerisrunning) { - struct chrdata *ownerchr = mp_get_chr_from_player_index(ownerplayernum); + struct chrdata *ownerchr = mp_chrindex_to_chr(ownerplayernum); if (ownerchr != NULL) { ownerprop2 = ownerchr->prop; @@ -9059,7 +9059,7 @@ void autogun_tick_shoot(struct prop *autogunprop) if (g_Vars.normmplayerisrunning) { // Multiplayer - it must be a laptop gun - ownerchr = mp_get_chr_from_player_index(ownerplayernum); + ownerchr = mp_chrindex_to_chr(ownerplayernum); if (ownerchr) { ownerprop = ownerchr->prop; @@ -15179,7 +15179,7 @@ bool propobj_interact(struct prop *prop) s32 playernum; if (g_Vars.normmplayerisrunning) { - playernum = mp_player_get_index(g_Vars.currentplayer->prop->chr); + playernum = mp_chr_to_chrindex(g_Vars.currentplayer->prop->chr); } else { playernum = g_Vars.currentplayernum; } @@ -17310,7 +17310,7 @@ bool chr_equip_weapon(struct weaponobj *weapon, struct chrdata *chr) if (weapon->base.prop && weapon->base.model) { if (g_Vars.mplayerisrunning) { - s32 playernum = mp_player_get_index(chr); + s32 playernum = mp_chr_to_chrindex(chr); weapon->base.hidden &= 0x0fffffff; weapon->base.hidden |= (playernum << 28) & 0xf0000000; @@ -17425,7 +17425,7 @@ struct autogunobj *laptop_deploy(s32 modelnum, struct gset *gset, struct chrdata s32 index; if (g_Vars.normmplayerisrunning) { - index = mp_player_get_index(chr); + index = mp_chr_to_chrindex(chr); } else { index = playermgr_get_player_num_by_prop(chr->prop); } @@ -17644,7 +17644,7 @@ struct weaponobj *weapon_create_projectile_from_gset(s32 modelnum, struct gset * prop = weapon_init(weapon, modeldef, prop, model); if (g_Vars.mplayerisrunning) { - s32 index = mp_player_get_index(chr); + s32 index = mp_chr_to_chrindex(chr); weapon->base.hidden &= 0x0fffffff; weapon->base.hidden |= ((index << 28) & 0xf0000000); diff --git a/src/include/data.h b/src/include/data.h index 1dcc550d9..f2118472a 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -485,7 +485,7 @@ extern struct menudialogdef g_HtmOptionsMenuDialog; extern struct menudialogdef g_PacOptionsMenuDialog; extern struct menudialogdef g_MpScenarioMenuDialog; extern struct menudialogdef g_MpQuickTeamScenarioMenuDialog; -extern s32 var80087260; +extern s32 g_MpReturningFromMatch; extern bool g_MpEnableMusicSwitching; extern struct mpweapon g_MpWeapons[NUM_MPWEAPONS]; extern struct mphead g_MpHeads[VERSION == VERSION_JPN_FINAL ? 74 : 75]; diff --git a/src/include/game/mplayer/mplayer.h b/src/include/game/mplayer/mplayer.h index c229444df..e6b57401d 100644 --- a/src/include/game/mplayer/mplayer.h +++ b/src/include/game/mplayer/mplayer.h @@ -8,8 +8,8 @@ f32 mp_handicap_to_value(u8 handicap); void mp_start_match(void); void mp_reset(void); void mp_calculate_team_is_only_ai(void); -void func0f187fbc(s32 playernum); -void func0f187fec(void); +void mp_init_handicaps(s32 playernum); +void mp_init_limits(void); void mp_player_set_defaults(s32 playernum, bool autonames); void mp_init(void); void mp_get_teams_with_default_name(u8 *mask); @@ -19,18 +19,18 @@ s32 mp_calculate_team_score_limit(void); void mp_apply_limits(void); s32 mp_get_player_rankings(struct ranking *rankings); s32 mp_get_team_rankings(struct ranking *rankings); -s32 func0f188bcc(void); +s32 mp_get_num_mpweapons(void); s32 mp_get_num_weapon_options(void); char *mp_get_weapon_label(s32 weaponnum); void mp_set_weapon_slot(s32 slot, s32 mpweaponnum); s32 mp_get_weapon_slot(s32 slot); struct mpweapon *mp_get_mp_weapon_by_location(s32 locationindex); -s32 func0f189058(bool full); -s32 func0f189088(void); -char *mp_get_weapon_set_name(s32 arg0); -void mp_set_weapon_set(s32 weaponsetnum); -void func0f1895e8(void); -s32 mp_get_weapon_set(void); +s32 mp_get_num_weaponset_slots(bool full); +s32 mp_get_custom_weaponset_slot(void); +char *mp_get_weaponset_name_by_slotnum(s32 arg0); +void mp_set_weaponset_slotnum(s32 weaponsetnum); +void mp_apply_weaponset_if_standard(void); +s32 mp_get_weaponset_slotnum(void); bool mp_is_paused(void); void mp_set_paused(u8 mode); Gfx *mp_render_modal_text(Gfx *gdl); @@ -75,10 +75,10 @@ bool mp_has_unused_bot_slots(void); bool mp_is_sim_slot_enabled(s32 slot); s32 mp_find_bot_profile(s32 type, s32 difficulty); void mp_generate_bot_names(void); -s32 mp_player_get_index(struct chrdata *chr); -struct chrdata *mp_get_chr_from_player_index(s32 index); -s32 func0f18d074(s32 index); -s32 func0f18d0e8(s32 arg0); +s32 mp_chr_to_chrindex(struct chrdata *chr); +struct chrdata *mp_chrindex_to_chr(s32 index); +s32 mp_chrindex_to_chrslot(s32 index); +s32 mp_chrslot_to_chrindex(s32 arg0); void mpplayerfile_get_overview(char *arg0, char *name, u32 *playtime); s32 mpplayerfile_save(s32 playernum, s32 device, s32 fileid, u16 deviceserial); s32 mpplayerfile_load(s32 playernum, s32 device, s32 arg2, u16 deviceserial); @@ -86,7 +86,7 @@ s32 mp_get_num_presets(void); s32 mp_get_num_unlocked_presets(void); char *mp_get_preset_name_by_slot(s32 slot); void mp_apply_config(struct mpconfigfull *mpconfig); -void mp0f18dec4(s32 arg0); +void mp_load_preset_by_slotnum(s32 arg0); void mpsetupfile_get_overview(char *arg0, char *filename, u16 *numsims, u16 *stagenum, u16 *scenarionum); s32 mpsetupfile_save(s32 device, s32 filenum, u16 deviceserial); s32 mpsetupfile_load(s32 device, s32 filenum, u16 deviceserial); diff --git a/src/include/game/mplayer/setup.h b/src/include/game/mplayer/setup.h index de20b00f0..4a2f4bfb3 100644 --- a/src/include/game/mplayer/setup.h +++ b/src/include/game/mplayer/setup.h @@ -8,16 +8,16 @@ char *mp_get_current_player_name(struct menuitem *item); s16 mp_choose_random_stage(void); MenuItemHandlerResult mp_bot_difficulty_menu_handler(s32 operation, struct menuitem *item, union handlerdata *data); char *mp_menu_title_edit_simulant(struct menudialogdef *dialogdef); -char *func0f17e318(struct menudialogdef *dialogdef); -MenuDialogHandlerResult menudialog0017e3fc(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); +char *menutext_mp_challenge_name(struct menudialogdef *dialogdef); +MenuDialogHandlerResult menudialog_mp_confirm_challenge(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); MenuItemHandlerResult mp_challenges_list_menu_handler(s32 operation, struct menuitem *item, union handlerdata *data); char *mp_menu_text_challenge_name(struct menuitem *item); MenuDialogHandlerResult mp_combat_challenges_menu_dialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); char *mp_menu_text_save_player_or_copy(struct menuitem *item); char *mp_menu_text_arena_name(struct menuitem *item); void mp_configure_quick_team_simulants(void); -void func0f17f428(void); -void func0f17fcb0(s32 silent); +void mp_apply_quickstart(void); +void mp_open_advanced_setup(s32 silent); MenuItemHandlerResult menuhandler_mp_slow_motion(s32 operation, struct menuitem *item, union handlerdata *data); void htb_add_pad(s16 padnum); void htb_remove_ammo_crate_at_pad(s16 padnum); diff --git a/src/include/types.h b/src/include/types.h index a957fb127..e171b434a 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3084,12 +3084,7 @@ struct mpweaponset { /*0x00*/ u16 name; /*0x02*/ u8 slots[NUM_MPWEAPONSLOTS]; /*0x08*/ u8 requirefeatures[4]; - /*0x0c*/ u8 unk0c; - /*0x0d*/ u8 unk0d; - /*0x0e*/ u8 unk0e; - /*0x0f*/ u8 unk0f; - /*0x10*/ u8 unk10; - /*0x11*/ u8 unk11; + /*0x0c*/ u8 slotsiflocked[NUM_MPWEAPONSLOTS]; }; struct mphead { @@ -3722,7 +3717,7 @@ struct menudata_main { struct menudata_mpsetup { u32 slotindex; u32 slotcount; - u32 unke24; + u32 botprofileindex; }; struct menudata_mppause {