diff --git a/ld/gamefiles.ntsc-final.inc b/ld/gamefiles.ntsc-final.inc index 41222e133..a678e9a6b 100644 --- a/ld/gamefiles.ntsc-final.inc +++ b/ld/gamefiles.ntsc-final.inc @@ -134,7 +134,6 @@ build/ROMID/game/cheats.o (section); \ build/ROMID/game/filemgr.o (section); \ build/ROMID/game/fmb.o (section); \ - build/ROMID/game/endscreen.o (section); \ build/ROMID/game/gamefile.o (section); \ build/ROMID/game/bossfile.o (section); \ build/ROMID/game/filelist.o (section); \ @@ -218,7 +217,5 @@ build/ROMID/game/vmstats.o (section); \ build/ROMID/game/botroom.o (section); \ build/ROMID/game/challenge.o (section); \ - build/ROMID/game/training.o (section); \ - build/ROMID/game/trainingmenus.o (section); \ build/ROMID/game/modeldef.o (section); \ build/ROMID/game/game_1a78b0.o (section); diff --git a/src/game/activemenu.c b/src/game/activemenu.c index 35a418402..4380bdb1e 100644 --- a/src/game/activemenu.c +++ b/src/game/activemenu.c @@ -13,7 +13,6 @@ #include "game/bot.h" #include "game/botcmd.h" #include "game/gfxmemory.h" -#include "game/training.h" #include "game/lang.h" #include "game/mplayer/mplayer.h" #include "game/options.h" @@ -315,14 +314,6 @@ void amApply(s32 slot) if (pass) { pass = true; - if (g_FrIsValidWeapon) { - s32 weaponnum = frGetWeaponBySlot(frGetSlot()); - - if (g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponnum == weaponnum) { - pass = false; - } - } - if (pass) { invSetCurrentIndex(invindex); diff --git a/src/game/bondgun.c b/src/game/bondgun.c index ddfa473fb..9a34d768f 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -32,7 +32,6 @@ #include "game/lv.h" #include "game/texdecompress.h" #include "game/game_176080.h" -#include "game/training.h" #include "game/lang.h" #include "game/mplayer/mplayer.h" #include "game/pak.h" @@ -1027,10 +1026,6 @@ void bgun0f098df8(s32 weaponfunc, struct handweaponinfo *info, struct hand *hand s32 reloadindex = bgunGetUnequippedReloadIndex(info->weaponnum); - if (g_FrIsValidWeapon) { - reloadindex = -1; - } - if (checkunequipped && reloadindex >= 0) { #if VERSION >= VERSION_PAL_BETA amount -= hand->gunroundsspent[reloadindex] / TICKS(256); @@ -2679,13 +2674,6 @@ bool bgunIsReadyToSwitch(s32 handnum) { struct player *player = g_Vars.currentplayer; - // Dont switch if... something firing range related - if (g_FrIsValidWeapon - && frGetWeaponBySlot(frGetSlot()) == player->hands[HAND_RIGHT].gset.weaponnum - && g_Vars.currentplayer->gunctrl.unk1583_04 == false) { - return false; - } - // Don't switch right hand if left hand is about to auto switch if (handnum == HAND_RIGHT && player->hands[HAND_LEFT].inuse @@ -4539,12 +4527,6 @@ void bgunCreateThrownProjectile(s32 handnum, struct gset *gset) } weapon->gunfunc = gset->weaponfunc; - } else if (gset->weaponnum == WEAPON_ECMMINE && g_Vars.stagenum == STAGE_CITRAINING) { - data = dtGetData(); - - if (data->intraining) { - data->obj = obj; - } } } diff --git a/src/game/bossfile.c b/src/game/bossfile.c index 3838a5f4b..a95d0ded9 100644 --- a/src/game/bossfile.c +++ b/src/game/bossfile.c @@ -8,7 +8,6 @@ #include "game/bossfile.h" #include "game/bg.h" #include "game/challenge.h" -#include "game/training.h" #include "game/gamefile.h" #include "game/mplayer/mplayer.h" #include "game/pak.h" diff --git a/src/game/botroom.c b/src/game/botroom.c index b0e727ef1..941f67349 100644 --- a/src/game/botroom.c +++ b/src/game/botroom.c @@ -6,7 +6,6 @@ #include "game/mplayer/setup.h" #include "game/bot.h" #include "game/challenge.h" -#include "game/training.h" #include "game/lang.h" #include "game/mplayer/mplayer.h" #include "game/mplayer/scenarios.h" diff --git a/src/game/challenge.c b/src/game/challenge.c index 573589252..9f7223cc9 100644 --- a/src/game/challenge.c +++ b/src/game/challenge.c @@ -6,7 +6,6 @@ #include "game/mplayer/setup.h" #include "game/bot.h" #include "game/challenge.h" -#include "game/training.h" #include "game/lang.h" #include "game/mplayer/mplayer.h" #include "game/mplayer/scenarios.h" @@ -211,9 +210,7 @@ void challengeDetermineUnlockedFeatures(void) for (j = 0; j < func0f188bcc(); j++) { struct mpweapon *weapon = &g_MpWeapons[j]; - if (weapon->unlockfeature > 0 && func0f19cbcc(weapon->weaponnum)) { - g_MpFeaturesUnlocked[weapon->unlockfeature] |= 1; - } + g_MpFeaturesUnlocked[weapon->unlockfeature] |= 1; } func0f1895e8(); diff --git a/src/game/cheats.c b/src/game/cheats.c index 613173646..f49478124 100644 --- a/src/game/cheats.c +++ b/src/game/cheats.c @@ -6,7 +6,6 @@ #include "game/cheats.h" #include "game/inv.h" #include "game/playermgr.h" -#include "game/training.h" #include "game/gamefile.h" #include "game/lang.h" #include "game/pak.h" @@ -107,9 +106,6 @@ u32 cheatIsUnlocked(s32 cheat_id) u32 unlocked = 0; if (cheat->flags & CHEATFLAG_FIRINGRANGE) { - if (frIsClassicWeaponUnlocked(cheat->time)) { - unlocked++; - } } else if (cheat->flags & CHEATFLAG_COMPLETION) { if (g_GameFile.besttimes[cheat->stage_index][0]) { unlocked++; diff --git a/src/game/endscreen.c b/src/game/endscreen.c deleted file mode 100644 index b6e27672f..000000000 --- a/src/game/endscreen.c +++ /dev/null @@ -1,1834 +0,0 @@ -#include -#include "constants.h" -#include "game/bossfile.h" -#include "game/cheats.h" -#include "game/game_006900.h" -#include "game/title.h" -#include "game/pdmode.h" -#include "game/objectives.h" -#include "game/bondgun.h" -#include "game/game_0b0fd0.h" -#include "game/player.h" -#include "game/savebuffer.h" -#include "game/menugfx.h" -#include "game/menu.h" -#include "game/mainmenu.h" -#include "game/filemgr.h" -#include "game/endscreen.h" -#include "game/stagetable.h" -#include "game/lv.h" -#include "game/mplayer/ingame.h" -#include "game/challenge.h" -#include "game/gamefile.h" -#include "game/lang.h" -#include "game/options.h" -#include "game/mpstats.h" -#include "bss.h" -#include "lib/vi.h" -#include "lib/main.h" -#include "lib/str.h" -#include "data.h" -#include "types.h" - -s32 endscreenHandleDeclineMission(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - menuPopDialog(); - menuPopDialog(); - } - - return 0; -} - -s32 endscreenHandleRetryMission(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - switch (operation) { - case MENUOP_TICK: - { - /** - * NTSC Final adds this check to make sure the given dialog is - * either the one being displayed or its sibling. This most likely - * fixes a bug - perhaps there is some way that this handler is run - * when the dialog is not on screen? - */ -#if VERSION >= VERSION_NTSC_FINAL - if (g_Menus[g_MpPlayerNum].curdialog) { - if (dialogdef == g_Menus[g_MpPlayerNum].curdialog->definition - || (dialogdef->nextsibling && dialogdef->nextsibling == g_Menus[g_MpPlayerNum].curdialog->definition)) { -#endif - struct menuinputs *inputs = data->dialog2.inputs; - bool accept = false; - - if (inputs->back) { - menuPopDialog(); - menuPopDialog(); - } - - inputs->back = false; - - if (inputs->start) { - accept = true; - } - - inputs->start = false; - - if (inputs->select - && g_Menus[g_MpPlayerNum].curdialog - && dialogdef->nextsibling - && dialogdef->nextsibling == g_Menus[g_MpPlayerNum].curdialog->definition) { - accept = true; - inputs->select = false; - } - - if (accept) { - union handlerdata data2; - menuhandlerAcceptMission(MENUOP_SET, &dialogdef->items[1], &data2); - } -#if VERSION >= VERSION_NTSC_FINAL - } - } -#endif - } - } - - return menudialog00103608(operation, dialogdef, data); -} - -char *endscreenMenuTitleRetryMission(struct menudialogdef *dialogdef) -{ - char *name; - char *prefix; - - if (g_Menus[g_MpPlayerNum].curdialog->definition != dialogdef) { - return langGet(L_OPTIONS_300); // "Objectives" - } - - prefix = langGet(L_OPTIONS_296); // "Retry" - name = langGet(g_StageNames[g_MissionConfig.stageindex].name3); - - sprintf(g_StringPointer, "%s: %s\n", prefix, name); - - return g_StringPointer; -} - -char *endscreenMenuTitleNextMission(struct menudialogdef *dialogdef) -{ - char *name; - char *prefix; - - if (g_Menus[g_MpPlayerNum].curdialog->definition != dialogdef) { - return langGet(L_OPTIONS_300); // "Objectives" - } - - prefix = langGet(L_OPTIONS_297); // "Next Mission" - name = langGet(g_StageNames[g_MissionConfig.stageindex].name3); - - sprintf(g_StringPointer, "%s: %s\n", prefix, name); - - return g_StringPointer; -} - -s32 endscreenHandleReplayPreviousMission(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - g_MissionConfig.stageindex--; - g_MissionConfig.stagenum = g_StageNames[g_MissionConfig.stageindex].stagenum; - } - - return menuhandlerAcceptMission(operation, NULL, data); -} - -struct menuitem g_RetryMissionMenuItems[] = { - { - MENUITEMTYPE_OBJECTIVES, - 1, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_298, // "Accept" - 0, - menuhandlerAcceptMission, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_299, // "Decline" - 0, - endscreenHandleDeclineMission, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_RetryMissionMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&endscreenMenuTitleRetryMission, - g_RetryMissionMenuItems, - endscreenHandleRetryMission, - MENUDIALOGFLAG_STARTSELECTS | MENUDIALOGFLAG_DISABLEITEMSCROLL, - &g_PreAndPostMissionBriefingMenuDialog, -}; - -struct menuitem g_NextMissionMenuItems[] = { - { - MENUITEMTYPE_OBJECTIVES, - 1, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_298, // "Accept" - 0, - menuhandlerAcceptMission, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_299, // "Decline" - 0, - endscreenHandleDeclineMission, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_MISC_470, // "Replay Previous Mission" - 0, - endscreenHandleReplayPreviousMission, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_NextMissionMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&endscreenMenuTitleNextMission, - g_NextMissionMenuItems, - endscreenHandleRetryMission, - MENUDIALOGFLAG_STARTSELECTS | MENUDIALOGFLAG_DISABLEITEMSCROLL, - &g_PreAndPostMissionBriefingMenuDialog, -}; - -char *endscreenMenuTextNumKills(struct menuitem *item) -{ - sprintf(g_StringPointer, "%d", mpstatsGetPlayerKillCount()); - return g_StringPointer; -} - -char *endscreenMenuTextNumShots(struct menuitem *item) -{ - sprintf(g_StringPointer, "%d", mpstatsGetPlayerShotCountByRegion(SHOTREGION_TOTAL)); - return g_StringPointer; -} - -char *endscreenMenuTextNumHeadShots(struct menuitem *item) -{ - sprintf(g_StringPointer, "%d", mpstatsGetPlayerShotCountByRegion(SHOTREGION_HEAD)); - return g_StringPointer; -} - -char *endscreenMenuTextNumBodyShots(struct menuitem *item) -{ - sprintf(g_StringPointer, "%d", mpstatsGetPlayerShotCountByRegion(SHOTREGION_BODY)); - return g_StringPointer; -} - -char *endscreenMenuTextNumLimbShots(struct menuitem *item) -{ - sprintf(g_StringPointer, "%d", mpstatsGetPlayerShotCountByRegion(SHOTREGION_LIMB)); - return g_StringPointer; -} - -char *endscreenMenuTextNumOtherShots(struct menuitem *item) -{ - u32 total = mpstatsGetPlayerShotCountByRegion(SHOTREGION_GUN) + mpstatsGetPlayerShotCountByRegion(SHOTREGION_HAT); - sprintf(g_StringPointer, "%d", total); - return g_StringPointer; -} - -char *endscreenMenuTextAccuracy(struct menuitem *item) -{ - s32 total = mpstatsGetPlayerShotCountByRegion(SHOTREGION_TOTAL); - s32 numhead = mpstatsGetPlayerShotCountByRegion(SHOTREGION_HEAD); - s32 numbody = mpstatsGetPlayerShotCountByRegion(SHOTREGION_BODY); - s32 numlimb = mpstatsGetPlayerShotCountByRegion(SHOTREGION_LIMB); - s32 numgun = mpstatsGetPlayerShotCountByRegion(SHOTREGION_GUN); - s32 numhat = mpstatsGetPlayerShotCountByRegion(SHOTREGION_HAT); - s32 numobject = mpstatsGetPlayerShotCountByRegion(SHOTREGION_OBJECT); - f32 accuracy; - - if (total > 0) { - s32 hits = numhead + numbody + numlimb + numgun + numhat + numobject; - accuracy = hits * 100.0f / total; - } else { - accuracy = 0; - } - - if (accuracy > 100.0f) { - accuracy = 100.0f; - } - - sprintf(g_StringPointer, "%s%s%.1f%%", "", "", accuracy); - return g_StringPointer; -} - -char *endscreenMenuTextMissionStatus(struct menuitem *item) -{ - if (g_CheatsActiveBank0 || g_CheatsActiveBank1) { - return langGet(L_MPWEAPONS_135); // "Cheated" - } - - if (g_Vars.coopplayernum >= 0) { - if (g_Vars.bond->aborted || g_Vars.coop->aborted) { - return langGet(L_OPTIONS_295); // "Aborted" - } - - if (g_Vars.bond->isdead && g_Vars.coop->isdead) { - return langGet(L_OPTIONS_293); // "Failed" - } - } else if (g_Vars.antiplayernum >= 0) { - if (g_Vars.currentplayer == g_Vars.bond) { - if (g_Vars.bond->aborted) { - return langGet(L_OPTIONS_295); // "Aborted" - } - - if (g_Vars.anti->aborted) { - return langGet(L_OPTIONS_295); // "Aborted" - } - - if (g_Vars.bond->isdead) { - return langGet(L_OPTIONS_293); // "Failed" - } - } else { - if (g_Vars.anti->aborted) { - return langGet(L_OPTIONS_295); // "Aborted" - } - - if (!g_Vars.bond->aborted && !g_Vars.bond->isdead) { - return langGet(L_OPTIONS_293); // "Failed" - } - } - } else { - if (g_Vars.bond->aborted) { - return langGet(L_OPTIONS_295); // "Aborted" - } - - if (g_Vars.bond->isdead) { - return langGet(L_OPTIONS_293); // "Failed" - } - } - - if (objectiveIsAllComplete() == false) { - return langGet(L_OPTIONS_293); // "Failed" - } - - if (g_StageIndex == STAGEINDEX_DEFENSE) { - return langGet(L_MPWEAPONS_062); // "Unknown" - } - - return langGet(L_OPTIONS_294); // "Completed" -} - -char *endscreenMenuTextAgentStatus(struct menuitem *item) -{ - if (g_CheatsActiveBank0 || g_CheatsActiveBank1) { - return langGet(L_MPWEAPONS_134); // "Dishonored" - } - - if (g_Vars.currentplayer->aborted) { - return langGet(L_OPTIONS_292); // "Disavowed" - } - - if (g_Vars.currentplayer->isdead) { - return langGet(L_OPTIONS_290); // "Deceased" - } - - if (g_StageIndex == STAGEINDEX_DEFENSE) { - return langGet(L_MPWEAPONS_063); // "Missing" - } - - return langGet(L_OPTIONS_291); // "Active" -} - -char *endscreenMenuTitleStageCompleted(struct menuitem *item) -{ -#if VERSION >= VERSION_NTSC_1_0 - sprintf(g_StringPointer, "%s: %s\n", - langGet(g_StageNames[g_Menus[g_MpPlayerNum].endscreen.stageindex].name3), - langGet(L_OPTIONS_276)); // "Completed" -#else - sprintf(g_StringPointer, "%s: %s\n", - langGet(g_StageNames[g_MissionConfig.stageindex].name3), - langGet(L_OPTIONS_276)); // "Completed" -#endif - - return g_StringPointer; -} - -#if VERSION >= VERSION_NTSC_1_0 -char *endscreenMenuTextCurrentStageName3(struct menuitem *item) -{ - char *name = langGet(g_StageNames[g_MissionConfig.stageindex].name3); - sprintf(g_StringPointer, "%s\n", name); - - return g_StringPointer; -} -#endif - -char *endscreenMenuTitleStageFailed(struct menuitem *item) -{ - sprintf(g_StringPointer, "%s: %s\n", - langGet(g_StageNames[g_MissionConfig.stageindex].name3), - langGet(L_OPTIONS_277)); // "Failed" - - return g_StringPointer; -} - -char *endscreenMenuTextMissionTime(struct menuitem *item) -{ - formatTime(g_StringPointer, playerGetMissionTime(), TIMEPRECISION_SECONDS); - strcat(g_StringPointer, "\n"); - - return g_StringPointer; -} - -struct menudialogdef *endscreenAdvance(void) -{ -#if VERSION < VERSION_NTSC_1_0 - if (g_MissionConfig.stagenum == STAGE_SKEDARRUINS) { - g_MissionConfig.stagenum = STAGE_CREDITS; - titleSetNextStage(g_MissionConfig.stagenum); - lvSetDifficulty(g_MissionConfig.difficulty); - titleSetNextMode(TITLEMODE_SKIP); - mainChangeToStage(g_MissionConfig.stagenum); - - return NULL; - } -#endif - - g_MissionConfig.stageindex++; - g_MissionConfig.stagenum = g_StageNames[g_MissionConfig.stageindex].stagenum; - - return &g_NextMissionMenuDialog; -} - -void endscreen0f10d770(void) -{ - func0f0f8bb4(&g_Menus[0].unk840, bgunCalculateGunMemCapacity() - menugfxGetParticleArraySize(), 0); - g_Menus[0].unk840.unk004 = bgunGetGunMem() + menugfxGetParticleArraySize(); - - func0f0f8bb4(&g_Menus[1].unk840, bgunCalculateGunMemCapacity() - menugfxGetParticleArraySize(), 0); - g_Menus[1].unk840.unk004 = bgunGetGunMem() + menugfxGetParticleArraySize(); - - func0f0f8bb4(&g_Menus[2].unk840, bgunCalculateGunMemCapacity() - menugfxGetParticleArraySize(), 0); - g_Menus[2].unk840.unk004 = bgunGetGunMem() + menugfxGetParticleArraySize(); - - func0f0f8bb4(&g_Menus[3].unk840, bgunCalculateGunMemCapacity() - menugfxGetParticleArraySize(), 0); - g_Menus[3].unk840.unk004 = bgunGetGunMem() + menugfxGetParticleArraySize(); -} - -#if VERSION >= VERSION_NTSC_1_0 -s32 endscreenHandleReplayLastLevel(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - g_MissionConfig.stagenum = g_StageNames[g_MissionConfig.stageindex].stagenum; - return menuhandlerAcceptMission(operation, NULL, data); - } - - return 0; -} -#endif - -struct menuitem g_2PMissionEndscreenObjectivesVMenuItems[] = { - { - MENUITEMTYPE_OBJECTIVES, - 2, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_OPTIONS_301, // "Press START" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menuitem g_SoloEndscreenObjectivesMenuItems[] = { - { - MENUITEMTYPE_OBJECTIVES, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_OPTIONS_301, // "Press START" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_SoloEndscreenObjectivesFailedMenuDialog = { - MENUDIALOGTYPE_DANGER, - L_OPTIONS_300, // "Objectives" - g_SoloEndscreenObjectivesMenuItems, - soloMenuDialogPauseStatus, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - NULL, -}; - -struct menudialogdef g_SoloEndscreenObjectivesCompletedMenuDialog = { - MENUDIALOGTYPE_SUCCESS, - L_OPTIONS_300, // "Objectives" - g_SoloEndscreenObjectivesMenuItems, - soloMenuDialogPauseStatus, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - NULL, -}; - -struct menudialogdef g_2PMissionEndscreenObjectivesFailedVMenuDialog = { - MENUDIALOGTYPE_DANGER, - L_OPTIONS_300, // "Objectives" - g_2PMissionEndscreenObjectivesVMenuItems, - soloMenuDialogPauseStatus, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - NULL, -}; - -struct menudialogdef g_2PMissionEndscreenObjectivesCompletedVMenuDialog = { - MENUDIALOGTYPE_SUCCESS, - L_OPTIONS_300, // "Objectives" - g_2PMissionEndscreenObjectivesVMenuItems, - soloMenuDialogPauseStatus, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - NULL, -}; - -#if VERSION >= VERSION_NTSC_1_0 -/** - * Displayed after Defense and Skedar Ruins completion screens. - */ -s32 endscreenHandleContinueMission(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - endscreenContinue(2); - } - - return 0; -} -#endif - -#if VERSION >= VERSION_NTSC_1_0 -struct menuitem g_MissionContinueOrReplyMenuItems[] = { - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPWEAPONS_244, // "Continue" - 0, - endscreenHandleContinueMission, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPWEAPONS_245, // "Replay Last Level" - 0, - endscreenHandleReplayLastLevel, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_MissionContinueOrReplyMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&endscreenMenuTextCurrentStageName3, - g_MissionContinueOrReplyMenuItems, - NULL, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; -#endif - -#if VERSION >= VERSION_NTSC_1_0 -/** - * Context is: - * - * 0 when closing a completed endscreen - * 1 unsure - is invoked directly by menuTick - * 2 when pressing continue - */ -void endscreenContinue(s32 context) -{ - if (g_Vars.antiplayernum >= 0) { - menuPopDialog(); - } else if (g_Vars.coopplayernum >= 0 && PLAYERCOUNT() >= 2 && context == 0) { - menuPopDialog(); - } else { - if (g_Vars.stagenum == STAGE_DEEPSEA || g_Vars.stagenum == STAGE_SKEDARRUINS) { - if (context == 2 || g_Menus[g_MpPlayerNum].endscreen.isfirstcompletion) { - // Pressed continue - if (g_Vars.stagenum == STAGE_DEEPSEA) { - if (!isStageDifficultyUnlocked(g_MissionConfig.stageindex + 1, g_MissionConfig.difficulty)) { - menuPopDialog(); - menuPopDialog(); - } else { - // Commit to starting next stage - g_MissionConfig.stageindex++; - g_MissionConfig.stagenum = g_StageNames[g_MissionConfig.stageindex].stagenum; - - titleSetNextStage(g_MissionConfig.stagenum); - - if (g_MissionConfig.iscoop) { - if (g_Vars.numaibuddies == 0) { - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = 1; - g_Vars.antiplayernum = -1; - setNumPlayers(2); - } else { - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = -1; - g_Vars.antiplayernum = -1; - setNumPlayers(1); - } - } else { - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = -1; - g_Vars.antiplayernum = -1; - setNumPlayers(1); - } - - lvSetDifficulty(g_MissionConfig.difficulty); - titleSetNextMode(TITLEMODE_SKIP); - mainChangeToStage(g_MissionConfig.stagenum); - viBlack(true); - } - } else if (g_Vars.stagenum == STAGE_SKEDARRUINS) { - // Commit to starting credits - g_MissionConfig.stagenum = STAGE_CREDITS; - titleSetNextStage(g_MissionConfig.stagenum); - lvSetDifficulty(g_MissionConfig.difficulty); - titleSetNextMode(TITLEMODE_SKIP); - mainChangeToStage(g_MissionConfig.stagenum); - viBlack(true); - } - } else { - if (context == 1) { - menuPushRootDialog(&g_MissionContinueOrReplyMenuDialog, MENUROOT_COOPCONTINUE); - } else { - menuPushDialog(&g_MissionContinueOrReplyMenuDialog); - } - } - } else { - if (context == 2) { - menuPopDialog(); - } - - if (isStageDifficultyUnlocked(g_MissionConfig.stageindex + 1, g_MissionConfig.difficulty) == 0) { - if (context == 2) { - menuPopDialog(); - menuPopDialog(); - } else { - menuPushDialog(&g_MissionContinueOrReplyMenuDialog); - } - } else if (stageGetIndex(g_MissionConfig.stagenum) < 0 - || g_Vars.stagenum == STAGE_CITRAINING - || g_MissionConfig.stageindex >= SOLOSTAGEINDEX_MBR) { - if (context == 2) { - menuPopDialog(); - menuPopDialog(); - } else { - menuPushDialog(&g_MissionContinueOrReplyMenuDialog); - } - } else { - endscreen0f10d770(); - - if (context == 1) { - menuPushRootDialog(endscreenAdvance(), MENUROOT_COOPCONTINUE); - } else { - menuPushDialog(endscreenAdvance()); - } - } - } - } -} -#endif - -s32 endscreenHandle2PCompleted(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - if (operation == MENUOP_OPEN) { - g_Menus[g_MpPlayerNum].endscreen.unke1c = 0; - } - - if (operation == MENUOP_TICK) { - if (g_Menus[g_MpPlayerNum].curdialog) { - if (g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef - || (dialogdef->nextsibling && dialogdef->nextsibling == g_Menus[g_MpPlayerNum].curdialog->definition)) { - struct menuinputs *inputs = data->dialog2.inputs; - - if (inputs->select || inputs->back || inputs->start) { - g_Menus[g_MpPlayerNum].endscreen.unke1c = VERSION >= VERSION_NTSC_1_0 ? 6 : 3; - } - - if (g_Menus[g_MpPlayerNum].endscreen.unke1c) { - if (var8009dfc0) { - g_Menus[g_MpPlayerNum].endscreen.unke1c--; - } - - if (g_Menus[g_MpPlayerNum].endscreen.unke1c == 0) { -#if VERSION >= VERSION_NTSC_1_0 - endscreenContinue(0); -#else - if (g_Vars.stagenum == STAGE_DEEPSEA) { - if (g_Vars.antiplayernum >= 0 || (g_Vars.coopplayernum >= 0 && PLAYERCOUNT() >= 2)) { - menuPopDialog(); - } else { - g_MissionConfig.stageindex++; - g_MissionConfig.stagenum = g_StageNames[g_MissionConfig.stageindex].stagenum; - - titleSetNextStage(g_MissionConfig.stagenum); - lvSetDifficulty(g_MissionConfig.difficulty); - titleSetNextMode(TITLEMODE_SKIP); - mainChangeToStage(g_MissionConfig.stagenum); - } - } else if (g_Vars.antiplayernum >= 0 - || (g_Vars.coopplayernum >= 0 && PLAYERCOUNT() >= 2) - || (stageGetIndex(g_MissionConfig.stagenum) < 0 - || g_Vars.stagenum == STAGE_CITRAINING - || g_MissionConfig.stageindex > SOLOSTAGEINDEX_SKEDARRUINS - || ((g_CheatsActiveBank0 || g_CheatsActiveBank1) - && !isStageDifficultyUnlocked(g_MissionConfig.stageindex + 1, g_MissionConfig.difficulty)))) { - menuPopDialog(); - } else { - endscreen0f10d770(); - menuPushDialog(endscreenAdvance()); - } -#endif - } - } - - inputs->select = inputs->back = inputs->start = false; - } - } - } - - return 0; -} - -s32 endscreenHandle2PFailed(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - if (operation == MENUOP_OPEN) { - g_Menus[g_MpPlayerNum].endscreen.unke1c = 0; - } - - if (operation == MENUOP_TICK) { - if (g_Menus[g_MpPlayerNum].curdialog) { - if (g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef - || (dialogdef->nextsibling && dialogdef->nextsibling == g_Menus[g_MpPlayerNum].curdialog->definition)) { - struct menuinputs *inputs = data->dialog2.inputs; - - if (inputs->select || inputs->back || inputs->start) { - g_Menus[g_MpPlayerNum].endscreen.unke1c = VERSION >= VERSION_NTSC_1_0 ? 6 : 3; - } - - if (g_Menus[g_MpPlayerNum].endscreen.unke1c) { - if (var8009dfc0) { - g_Menus[g_MpPlayerNum].endscreen.unke1c--; - } - - if (g_Menus[g_MpPlayerNum].endscreen.unke1c == 0) { - if (g_Vars.antiplayernum >= 0 - || (g_Vars.coopplayernum >= 0 && PLAYERCOUNT() >= 2) - || stageGetIndex(g_MissionConfig.stagenum) < 0 - || g_Vars.stagenum == STAGE_CITRAINING) { - menuPopDialog(); - } else { - endscreen0f10d770(); - menuPushDialog(&g_RetryMissionMenuDialog); - } - } - } - - inputs->select = inputs->back = inputs->start = false; - } - } - } - - return 0; -} - -struct menuitem g_2PMissionEndscreenVMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SMALLFONT, - L_OPTIONS_278, // "Mission Status:" - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - (u32)&endscreenMenuTextMissionStatus, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SMALLFONT, - L_OPTIONS_279, // "Agent Status:" - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - (u32)&endscreenMenuTextAgentStatus, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SMALLFONT, - L_OPTIONS_280, // "Mission Time:" - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - (u32)&endscreenMenuTextMissionTime, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SMALLFONT, - L_MPWEAPONS_129, // "Difficulty:" - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - (u32)soloMenuTextDifficulty, - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SMALLFONT, - L_OPTIONS_281, // "Weapon of Choice:" - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - (u32)&mpMenuTextWeaponOfChoiceName, - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_282, // "Kills:" - (u32)&endscreenMenuTextNumKills, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_283, // "Accuracy:" - (u32)&endscreenMenuTextAccuracy, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_284, // "Shot Total:" - (u32)&endscreenMenuTextNumShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SMALLFONT, - L_OPTIONS_285, // "Head Shots:" - (u32)&endscreenMenuTextNumHeadShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SMALLFONT, - L_OPTIONS_286, // "Body Shots:" - (u32)&endscreenMenuTextNumBodyShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SMALLFONT, - L_OPTIONS_287, // "Limb Shots:" - (u32)&endscreenMenuTextNumLimbShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SMALLFONT, - L_OPTIONS_288, // "Others:" - (u32)&endscreenMenuTextNumOtherShots, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_OPTIONS_289, // "Press START" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -#if VERSION >= VERSION_NTSC_1_0 -/** - * This function is re-used for several values on the endscreen. - * item->param is used to determine which value it is. Values are: - * - * 0 = mission time - * 1 = target time - * 2 = separator and new cheat available - * 3 = completion cheat name - * 4 = others (shots) - * 5 = timed cheat name - * 6 = limb shots - */ -s32 endscreenHandleCheatInfo(s32 operation, struct menuitem *item, union handlerdata *data) -{ - static u32 cheatcolour = 0xff7f7fff; - - if (operation == MENUOP_GETCOLOUR - && ((g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x200) || item->param == 5)) { - // Timed cheat just got unlocked, and this item is the timed cheat name - u32 weight = menuGetSinOscFrac(40) * 255; - - mainOverrideVariable("ctcol", &cheatcolour); - - if (item->param == 0 - && cheatGetTime(g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0xff) == 0) { - return 0; - } - - data->label.colour2 = colourBlend(data->label.colour2, cheatcolour, weight); - - if (item->param == 3) { // completion cheat name - data->label.colour1 = colourBlend(data->label.colour1, cheatcolour, weight); - } - - if (item->param == 5) { // timed cheat name - data->label.colour1 = colourBlend(data->label.colour1, cheatcolour, weight); - } - } - - if (operation == MENUOP_CHECKHIDDEN) { - if (item->param == 1) { // target time - u32 info = g_Menus[g_MpPlayerNum].endscreen.cheatinfo; - - if (info & 0x800) { // completion cheat just got unlocked - return true; - } - - // (has timed cheat) - // and (timed cheat just got unlocked or timed cheat already unlocked) == 0 - // and cheat has a target time configured - if ((info & 0x100) && (info & 0x600) == 0 && cheatGetTime(info & 0xff) > 0) { - return false; - } - - return true; - } else if (item->param == 2 && (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0xa00) == 0) { - // new cheat available - return true; - } else if (item->param == 3 && (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x200) == 0) { - // completion cheat name - return true; - } else if (item->param == 4 && (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0xa00)) { - // others (shots) - return true; - } else if (item->param == 6 && (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0xa00) == 0xa00) { - // limb shots - return true; - } else if (item->param == 5 && (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x800) == 0) { - // timed cheat name - return true; - } - } - - return false; -} -#endif - -struct menuitem g_MissionEndscreenMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_278, // "Mission Status:" - (u32)&endscreenMenuTextMissionStatus, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_279, // "Agent Status:" - (u32)&endscreenMenuTextAgentStatus, - NULL, - }, -#if VERSION >= VERSION_NTSC_1_0 - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_LABEL_CUSTOMCOLOUR, - L_OPTIONS_280, // "Mission Time:" - (u32)&endscreenMenuTextMissionTime, - endscreenHandleCheatInfo, - }, - { - MENUITEMTYPE_LABEL, - 1, - MENUITEMFLAG_LABEL_CUSTOMCOLOUR, - L_MPWEAPONS_242, // "Target Time:" - (u32)&endscreenMenuTextTargetTime, - endscreenHandleCheatInfo, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_MPWEAPONS_129, // "Difficulty:" - (u32)&soloMenuTextDifficulty, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 2, - 0, - 0, - 0, - endscreenHandleCheatInfo, - }, - { - MENUITEMTYPE_LABEL, - 2, - 0, - L_MPWEAPONS_243, // "New Cheat Available!:" - 0, - endscreenHandleCheatInfo, - }, - { - MENUITEMTYPE_LABEL, - 3, - MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_LABEL_CUSTOMCOLOUR, - (u32)&endscreenMenuTextTimedCheatName, - 0, - endscreenHandleCheatInfo, - }, - { - MENUITEMTYPE_LABEL, - 5, - MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_LABEL_CUSTOMCOLOUR, - (u32)&endscreenMenuTextCompletionCheatName, - 0, - endscreenHandleCheatInfo, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_281, // "Weapon of Choice:" - (u32)&mpMenuTextWeaponOfChoiceName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_282, // "Kills:" - (u32)&endscreenMenuTextNumKills, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_283, // "Accuracy:" - (u32)&endscreenMenuTextAccuracy, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_284, // "Shot Total:" - (u32)&endscreenMenuTextNumShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_285, // "Head Shots:" - (u32)&endscreenMenuTextNumHeadShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_286, // "Body Shots:" - (u32)&endscreenMenuTextNumBodyShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 6, - 0, - L_OPTIONS_287, // "Limb Shots:" - (u32)&endscreenMenuTextNumLimbShots, - endscreenHandleCheatInfo, - }, - { - MENUITEMTYPE_LABEL, - 4, - 0, - L_OPTIONS_288, // "Others:" - (u32)&endscreenMenuTextNumOtherShots, - endscreenHandleCheatInfo, - }, -#else - // NTSC beta's endscreen dialog lacks cheat information - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_280, // "Mission Time:" - (u32)&endscreenMenuTextMissionTime, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_MPWEAPONS_129, // "Difficulty:" - (u32)&soloMenuTextDifficulty, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_281, // "Weapon of Choice:" - (u32)&mpMenuTextWeaponOfChoiceName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_282, // "Kills:" - (u32)&endscreenMenuTextNumKills, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_283, // "Accuracy:" - (u32)&endscreenMenuTextAccuracy, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_284, // "Shot Total:" - (u32)&endscreenMenuTextNumShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_285, // "Head Shots:" - (u32)&endscreenMenuTextNumHeadShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_286, // "Body Shots:" - (u32)&endscreenMenuTextNumBodyShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_287, // "Limb Shots:" - (u32)&endscreenMenuTextNumLimbShots, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - 0, - L_OPTIONS_288, // "Others:" - (u32)&endscreenMenuTextNumOtherShots, - NULL, - }, -#endif - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_OPTIONS_289, // "Press START" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -#if VERSION >= VERSION_NTSC_1_0 -char *endscreenMenuTextTimedCheatName(struct menuitem *item) -{ - if (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x00000300) { - return cheatGetName(g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0xff); - } - - return NULL; -} -#endif - -#if VERSION >= VERSION_NTSC_1_0 -char *endscreenMenuTextCompletionCheatName(struct menuitem *item) -{ - if (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x00000800) { - return cheatGetName((g_Menus[g_MpPlayerNum].endscreen.cheatinfo >> 16) & 0xff); - } - - return NULL; -} -#endif - -#if VERSION >= VERSION_NTSC_1_0 -char *endscreenMenuTextTargetTime(struct menuitem *item) -{ - s32 time; - s32 time2; - - if ((g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x00000100) == 0) { - return NULL; - } - - time = g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0xff; - time = cheatGetTime(time); - - if (!time) { - return NULL; - } - - formatTime(g_StringPointer, time * 60, TIMEPRECISION_SECONDS); - strcat(g_StringPointer, "\n"); - return g_StringPointer; -} -#endif - -void endscreenSetCoopCompleted(void) -{ - if (g_CheatsActiveBank0 == 0 && g_CheatsActiveBank1 == 0) { -#if VERSION >= VERSION_NTSC_1_0 - if (g_GameFile.coopcompletions[g_MissionConfig.difficulty] & (1 << g_MissionConfig.stageindex)) { - g_Menus[g_MpPlayerNum].endscreen.isfirstcompletion = true; - } -#endif - - g_GameFile.coopcompletions[g_MissionConfig.difficulty] |= (1 << g_MissionConfig.stageindex); - } -} - -struct menudialogdef g_SoloMissionEndscreenCompletedMenuDialog = { - MENUDIALOGTYPE_SUCCESS, - (u32)&endscreenMenuTitleStageCompleted, - g_MissionEndscreenMenuItems, - endscreenHandle2PCompleted, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_SoloEndscreenObjectivesCompletedMenuDialog, -}; - -struct menudialogdef g_SoloMissionEndscreenFailedMenuDialog = { - MENUDIALOGTYPE_DANGER, - (u32)&endscreenMenuTitleStageFailed, - g_MissionEndscreenMenuItems, - endscreenHandle2PFailed, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_SoloEndscreenObjectivesFailedMenuDialog, -}; - -/** - * Prepare the endscreen by calculating unlocked cheats, setting the new best - * time, choosing the default stage and difficulty and saving the game file. - * - * NTSC beta doesn't have cheats implemented, and has a different autostageindex - * and thumbnail calculation. - */ -void endscreenPrepare(void) -{ - s32 timedcheatid; - s32 complcheatid; - s32 d; - s32 s; - u32 secs; - s32 timedalreadyunlocked; - s32 complalreadyunlocked; - u16 prevbest; - bool nowunlocked; - -#if VERSION >= VERSION_NTSC_1_0 - g_Menus[g_MpPlayerNum].endscreen.stageindex = g_MissionConfig.stageindex; -#endif - - if (g_MenuData.root != MENUROOT_ENDSCREEN && g_Vars.mplayerisrunning == false) { -#if VERSION >= VERSION_NTSC_1_0 - g_Menus[g_MpPlayerNum].endscreen.cheatinfo = 0; - g_Menus[g_MpPlayerNum].endscreen.isfirstcompletion = false; - g_Menus[g_MpPlayerNum].playernum = 0; - - // Set cheat info - if (g_MissionConfig.iscoop == false - && g_MissionConfig.isanti == false - && g_MissionConfig.pdmode == false) { - timedcheatid = cheatGetByTimedStageIndex(g_MissionConfig.stageindex, g_MissionConfig.difficulty); - complcheatid = cheatGetByCompletedStageIndex(g_MissionConfig.stageindex); - - if (timedcheatid >= 0) { - g_Menus[g_MpPlayerNum].endscreen.cheatinfo = 0x0100 | timedcheatid; - } - - if (complcheatid >= 0) { - g_Menus[g_MpPlayerNum].endscreen.cheatinfo |= 0x1000 | (complcheatid << 16); - } - } -#else - g_Menus[g_MpPlayerNum].playernum = 0; -#endif - - // Push the endscreen -#if VERSION == VERSION_PAL_BETA - if ((g_Vars.currentplayer->isdead || g_Vars.currentplayer->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled()) -#else - if (g_Vars.currentplayer->isdead || g_Vars.currentplayer->aborted || !objectiveIsAllComplete()) -#endif - { - menuPushRootDialog(&g_SoloMissionEndscreenFailedMenuDialog, MENUROOT_ENDSCREEN); - } else { - menuPushRootDialog(&g_SoloMissionEndscreenCompletedMenuDialog, MENUROOT_ENDSCREEN); - - if (g_MissionConfig.iscoop) { - endscreenSetCoopCompleted(); - } - } - - if (g_MissionConfig.iscoop == false && g_MissionConfig.isanti == false) { -#if VERSION >= VERSION_NTSC_1_0 - timedalreadyunlocked = false; - complalreadyunlocked = false; - - // If there's a timed cheat for this stage + difficulty - if (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x100) { - timedalreadyunlocked = cheatIsUnlocked(g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0xff); - - if (timedalreadyunlocked) { - g_Menus[g_MpPlayerNum].endscreen.cheatinfo |= 0x400; - } - } - - // If there's a completion cheat for this stage (ie. not a special stage) - if (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x1000) { - complalreadyunlocked = cheatIsUnlocked((g_Menus[g_MpPlayerNum].endscreen.cheatinfo >> 16) & 0xff); - } -#else - playerGetMissionTime(); -#endif - - // Update total mission time - secs = playerGetMissionTime() / 60; - - if (secs != 0) { - if (secs >= S32_MAX || S32_MAX - secs <= g_GameFile.totaltime) { - g_GameFile.totaltime = S32_MAX; - } else { - g_GameFile.totaltime += secs; - } - } - - g_GameFile.autostageindex = g_MissionConfig.stageindex; - g_GameFile.autodifficulty = g_MissionConfig.difficulty; - -#if VERSION == VERSION_PAL_BETA - if (g_CheatsActiveBank0 == 0 - && g_CheatsActiveBank1 == 0 - && g_MissionConfig.pdmode == false - && ((g_Vars.currentplayer->isdead == false - && g_Vars.currentplayer->aborted == false - && objectiveIsAllComplete()) - || debugIsSetCompleteEnabled())) -#elif VERSION >= VERSION_NTSC_1_0 - if (g_CheatsActiveBank0 == 0 - && g_CheatsActiveBank1 == 0 - && g_MissionConfig.pdmode == false - && g_Vars.currentplayer->isdead == false - && g_Vars.currentplayer->aborted == false - && objectiveIsAllComplete()) -#else - if (g_Vars.currentplayer->isdead == false - && g_Vars.currentplayer->aborted == false - && objectiveIsAllComplete() - && g_CheatsActiveBank0 == 0 - && g_CheatsActiveBank1 == 0) -#endif - { - secs = playerGetMissionTime() / 60; - - // The save file allows 12 bits per time, which is up to - // 1h 8m 16s. If the timer is higher than this, reduce it. - if (secs > 0xfff) { - secs = 0xfff; - } - -#if VERSION >= VERSION_NTSC_1_0 - // Zero is used as an indicator that the stage is not completed, - // so if the player managed to legitly complete a stage in 0:00 - // adjust it to 0:01. - if (secs == 0) { - secs = 1; - } - - // Set best time - prevbest = g_GameFile.besttimes[g_MissionConfig.stageindex][g_MissionConfig.difficulty]; - - if (prevbest == 0) { - g_Menus[g_MpPlayerNum].endscreen.isfirstcompletion = true; - } - - if (secs < prevbest || prevbest == 0) { - g_GameFile.besttimes[g_MissionConfig.stageindex][g_MissionConfig.difficulty] = secs; - } -#else - prevbest = g_GameFile.besttimes[g_MissionConfig.stageindex][g_MissionConfig.difficulty]; - - if (secs < prevbest || prevbest == 0) { - g_GameFile.besttimes[g_MissionConfig.stageindex][g_MissionConfig.difficulty] = secs; - } -#endif - -#if VERSION >= VERSION_NTSC_1_0 - // Recalculate thumbnail for file select screen - if (g_MissionConfig.stageindex <= SOLOSTAGEINDEX_SKEDARRUINS) { - g_GameFile.autostageindex = g_MissionConfig.stageindex + 1; - - if (g_GameFile.autostageindex > SOLOSTAGEINDEX_SKEDARRUINS) { - g_GameFile.autostageindex = SOLOSTAGEINDEX_SKEDARRUINS; - } - - for (d = 0; d != 3; d++) { - for (s = 0; s <= SOLOSTAGEINDEX_SKEDARRUINS; s++) { - if (g_GameFile.besttimes[s][d]) { - g_GameFile.thumbnail = s + 1; - } - } - } - } - - if (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x100) { - nowunlocked = cheatIsUnlocked(g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0xff); - - if (!timedalreadyunlocked && nowunlocked) { - g_Menus[g_MpPlayerNum].endscreen.cheatinfo |= 0x0200; - } - } - - if (g_Menus[g_MpPlayerNum].endscreen.cheatinfo & 0x1000) { - nowunlocked = cheatIsUnlocked((g_Menus[g_MpPlayerNum].endscreen.cheatinfo >> 16) & 0xff); - - if (!complalreadyunlocked && nowunlocked) { - g_Menus[g_MpPlayerNum].endscreen.cheatinfo |= 0x0800; - } - } -#else - // 154 - if (g_MissionConfig.stageindex <= SOLOSTAGEINDEX_SKEDARRUINS) { - g_GameFile.autostageindex = g_MissionConfig.stageindex + 1; - - if (g_GameFile.autostageindex > SOLOSTAGEINDEX_SKEDARRUINS) { - g_GameFile.autostageindex = SOLOSTAGEINDEX_SKEDARRUINS; - } - - g_GameFile.thumbnail = g_MissionConfig.stageindex + 1; - } -#endif - - challengeDetermineUnlockedFeatures(); - - if (g_MissionConfig.stagenum == STAGE_SKEDARRUINS && g_AltTitleUnlocked == false) { - g_AltTitleUnlocked = true; -#if VERSION >= VERSION_NTSC_1_0 - *(s8 *)&g_AltTitleEnabled = true; -#else - g_AltTitleEnabled = true; -#endif - bossfileSave(); - } - } - } - - filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0); - } - - if (g_MenuData.root == MENUROOT_ENDSCREEN) { - lvSetPaused(true); - g_Vars.currentplayer->pausemode = PAUSEMODE_PAUSED; - } -} - -struct menudialogdef g_2PMissionEndscreenCompletedHMenuDialog = { - MENUDIALOGTYPE_SUCCESS, - (u32)&endscreenMenuTitleStageCompleted, - g_MissionEndscreenMenuItems, - endscreenHandle2PCompleted, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_SoloEndscreenObjectivesCompletedMenuDialog, -}; - -struct menudialogdef g_2PMissionEndscreenFailedHMenuDialog = { - MENUDIALOGTYPE_DANGER, - (u32)&endscreenMenuTitleStageFailed, - g_MissionEndscreenMenuItems, - endscreenHandle2PFailed, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_SoloEndscreenObjectivesFailedMenuDialog, -}; - -struct menudialogdef g_2PMissionEndscreenCompletedVMenuDialog = { - MENUDIALOGTYPE_SUCCESS, - L_OPTIONS_276, // "Completed" - g_2PMissionEndscreenVMenuItems, - endscreenHandle2PCompleted, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_2PMissionEndscreenObjectivesCompletedVMenuDialog, -}; - -struct menudialogdef g_2PMissionEndscreenFailedVMenuDialog = { - MENUDIALOGTYPE_DANGER, - L_OPTIONS_277, // "Failed" - g_2PMissionEndscreenVMenuItems, - endscreenHandle2PFailed, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_2PMissionEndscreenObjectivesFailedVMenuDialog, -}; - -void endscreenPushCoop(void) -{ - u32 prevplayernum = g_MpPlayerNum; - - lvSetPaused(true); - - g_MpPlayerNum = g_Vars.currentplayerstats->mpindex; - -#if VERSION >= VERSION_NTSC_1_0 - g_Menus[g_MpPlayerNum].endscreen.cheatinfo = 0; - g_Menus[g_MpPlayerNum].endscreen.isfirstcompletion = false; - g_Menus[g_MpPlayerNum].endscreen.stageindex = g_MissionConfig.stageindex; -#endif - - g_Menus[g_MpPlayerNum].playernum = g_Vars.currentplayernum; - -#if VERSION == VERSION_PAL_BETA - if (((g_Vars.bond->isdead && g_Vars.coop->isdead) - || g_Vars.bond->aborted - || g_Vars.coop->aborted - || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled()) -#else - if ((g_Vars.bond->isdead && g_Vars.coop->isdead) - || g_Vars.bond->aborted - || g_Vars.coop->aborted - || !objectiveIsAllComplete()) -#endif - { - // Failed or aborted - if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) { - menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN); - } else { - menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN); - } - } else { - // Completed - if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) { - menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN); - } else { - menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN); - } - - endscreenSetCoopCompleted(); - } - - if (g_Vars.currentplayer == g_Vars.bond) { - filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0); - } - - g_MpPlayerNum = prevplayernum; -} - -/** - * This function is misnamed. It pushes the menu after the endscreen - * (ie. retry, next mission or continue), and it looks like it might be for coop - * only but I'm not 100% sure. - * - * This function is only called from menuTick, which is a bit weird... - */ -void endscreenPushSolo(void) -{ - u32 prevplayernum = g_MpPlayerNum; - - g_MpPlayerNum = 0; - g_Menus[g_MpPlayerNum].playernum = 0; - -#if VERSION == VERSION_PAL_BETA - if (((g_Vars.bond->isdead && g_Vars.coop->isdead) - || g_Vars.bond->aborted - || g_Vars.coop->aborted - || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled()) -#else - if ((g_Vars.bond->isdead && g_Vars.coop->isdead) - || g_Vars.bond->aborted - || g_Vars.coop->aborted - || !objectiveIsAllComplete()) -#endif - { - // Failed or aborted - endscreen0f10d770(); - menuPushRootDialog(&g_RetryMissionMenuDialog, MENUROOT_COOPCONTINUE); - } else { - // Completed -#if VERSION >= VERSION_NTSC_1_0 - endscreenContinue(1); -#else - struct menudialogdef *definition = endscreenAdvance(); - - if (definition) { - endscreen0f10d770(); - menuPushRootDialog(definition, MENUROOT_COOPCONTINUE); - } -#endif - } - - g_MpPlayerNum = prevplayernum; -} - -void endscreenPushAnti(void) -{ - u32 prevplayernum = g_MpPlayerNum; - - lvSetPaused(true); - - g_MpPlayerNum = g_Vars.currentplayerstats->mpindex; - -#if VERSION >= VERSION_NTSC_1_0 - g_Menus[g_MpPlayerNum].endscreen.cheatinfo = 0; - g_Menus[g_MpPlayerNum].endscreen.isfirstcompletion = false; - g_Menus[g_MpPlayerNum].endscreen.stageindex = g_MissionConfig.stageindex; -#endif - - g_Menus[g_MpPlayerNum].playernum = g_Vars.currentplayernum; - - if (g_Vars.currentplayer == g_Vars.bond) { -#if VERSION == VERSION_PAL_BETA - if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled()) -#else - if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete())) -#endif - { - // Bond - failed or aborted - if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) { - menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN); - } else { - menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN); - } - } else { - // Bond - completed - if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) { - menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN); - } else { - menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN); - } - } - - filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0); - } else { -#if VERSION == VERSION_PAL_BETA - if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete()) && !debugIsSetCompleteEnabled()) -#else - if (!g_Vars.anti->aborted && (g_Vars.bond->isdead || g_Vars.bond->aborted || !objectiveIsAllComplete())) -#endif - { - // Anti - completed - if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) { - menuPushRootDialog(&g_2PMissionEndscreenCompletedVMenuDialog, MENUROOT_MPENDSCREEN); - } else { - menuPushRootDialog(&g_2PMissionEndscreenCompletedHMenuDialog, MENUROOT_MPENDSCREEN); - } - } else { - // Anti - failed or aborted - if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) { - menuPushRootDialog(&g_2PMissionEndscreenFailedVMenuDialog, MENUROOT_MPENDSCREEN); - } else { - menuPushRootDialog(&g_2PMissionEndscreenFailedHMenuDialog, MENUROOT_MPENDSCREEN); - } - } - } - - g_MpPlayerNum = prevplayernum; -} diff --git a/src/game/filelist.c b/src/game/filelist.c index fef5f2a4d..37f65a257 100644 --- a/src/game/filelist.c +++ b/src/game/filelist.c @@ -8,7 +8,6 @@ #include "game/filelist.h" #include "game/bg.h" #include "game/challenge.h" -#include "game/training.h" #include "game/gamefile.h" #include "game/mplayer/mplayer.h" #include "game/pak.h" diff --git a/src/game/fmb.c b/src/game/fmb.c index 7e911586c..4ab94d446 100644 --- a/src/game/fmb.c +++ b/src/game/fmb.c @@ -29,11 +29,7 @@ s32 fmbHandleDropOut(s32 operation, struct menuitem *item, union handlerdata *da s32 fmdHandleAbortGame(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_SET) { - if (g_Vars.stagenum == STAGE_4MBMENU) { - func0f0f820c(&g_MainMenu4MbMenuDialog, MENUROOT_4MBMAINMENU); - } else { - func0f0f820c(&g_SoloMissionPauseMenuDialog, MENUROOT_MAINMENU); - } + func0f0f820c(&g_MainMenu4MbMenuDialog, MENUROOT_4MBMAINMENU); } return 0; diff --git a/src/game/game_096360.c b/src/game/game_096360.c index 0832ff89a..1c3e4e5a8 100644 --- a/src/game/game_096360.c +++ b/src/game/game_096360.c @@ -3,7 +3,6 @@ #include "game/objectives.h" #include "game/game_096360.h" #include "game/tex.h" -#include "game/training.h" #include "game/propobj.h" #include "bss.h" #include "lib/rng.h" diff --git a/src/game/gamefile.c b/src/game/gamefile.c index 3dd2182cc..12a5e93c6 100644 --- a/src/game/gamefile.c +++ b/src/game/gamefile.c @@ -7,7 +7,6 @@ #include "game/savebuffer.h" #include "game/bg.h" #include "game/challenge.h" -#include "game/training.h" #include "game/gamefile.h" #include "game/mplayer/mplayer.h" #include "game/pak.h" @@ -345,20 +344,6 @@ s32 gamefileLoad(s32 device) g_GameFile.weaponsfound[i] = savebufferReadBits(&buffer, 8); } -#if VERSION >= VERSION_NTSC_1_0 - if (pakHasBitflag(GAMEFILEFLAG_FOUNDTIMEDMINE, g_GameFile.flags)) { - frSetWeaponFound(WEAPON_TIMEDMINE); - } - - if (pakHasBitflag(GAMEFILEFLAG_FOUNDPROXYMINE, g_GameFile.flags)) { - frSetWeaponFound(WEAPON_PROXIMITYMINE); - } - - if (pakHasBitflag(GAMEFILEFLAG_FOUNDREMOTEMINE, g_GameFile.flags)) { - frSetWeaponFound(WEAPON_REMOTEMINE); - } -#endif - func0f0d54c4(&buffer); gamefileApplyOptions(&g_GameFile); @@ -429,12 +414,6 @@ s32 gamefileSave(s32 device, s32 fileid, u16 deviceserial) pakSetBitflag(GAMEFILEFLAG_CUTSCENESUBTITLES, g_GameFile.flags, optionsGetCutsceneSubtitles()); pakSetBitflag(GAMEFILEFLAG_LANGFILTERON, g_GameFile.flags, g_Vars.langfilteron); -#if VERSION >= VERSION_NTSC_1_0 - pakSetBitflag(GAMEFILEFLAG_FOUNDTIMEDMINE, g_GameFile.flags, frIsWeaponFound(WEAPON_TIMEDMINE)); - pakSetBitflag(GAMEFILEFLAG_FOUNDPROXYMINE, g_GameFile.flags, frIsWeaponFound(WEAPON_PROXIMITYMINE)); - pakSetBitflag(GAMEFILEFLAG_FOUNDREMOTEMINE, g_GameFile.flags, frIsWeaponFound(WEAPON_REMOTEMINE)); -#endif - #if VERSION >= VERSION_NTSC_1_0 switch (optionsGetScreenSize()) #else diff --git a/src/game/inv.c b/src/game/inv.c index bc7aeac6b..d46b4ae29 100644 --- a/src/game/inv.c +++ b/src/game/inv.c @@ -4,7 +4,6 @@ #include "game/bondgun.h" #include "game/game_0b0fd0.h" #include "game/inv.h" -#include "game/training.h" #include "game/lang.h" #include "bss.h" #include "lib/main.h" @@ -359,8 +358,6 @@ bool invHasDoubleWeaponIncAllGuns(s32 weapon1, s32 weapon2) bool invGiveSingleWeapon(s32 weaponnum) { - frSetWeaponFound(weaponnum); - if (invHasSingleWeaponExcAllGuns(weaponnum) == 0) { struct invitem *item; diff --git a/src/game/lv.c b/src/game/lv.c index a75aa0532..bde87c49e 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -75,7 +75,6 @@ #include "game/texdecompress.h" #include "game/tiles.h" #include "game/title.h" -#include "game/training.h" #include "game/utils.h" #include "game/vtxstore.h" #include "game/wallhit.h" @@ -399,7 +398,6 @@ void lvReset(s32 stagenum) lasersightsReset(); stub0f013540(); shardsReset(); - frReset(); if (g_Vars.stagenum == STAGE_TITLE) { // empty @@ -775,10 +773,6 @@ void lvFindThreatsForProp(struct prop *prop, bool inchild, struct coord *playerp } } - if (obj->modelnum == MODEL_TARGET && frIsTargetOneHitExplodable(prop)) { - pass = true; - } - if (pass) { for (i = 0; i != 4; i++) { if (g_Vars.currentplayer->trackedprops[i].prop == prop) { @@ -1379,11 +1373,7 @@ Gfx *lvRender(Gfx *gdl) } else if (weaponHasFlag(bgunGetWeaponNum(HAND_RIGHT), WEAPONFLAG_AIMTRACK)) { s32 j; - if (frIsInTraining() - && g_Vars.currentplayer->lookingatprop.prop - && bmoveIsInSightAimMode()) { - func0f1a0924(g_Vars.currentplayer->lookingatprop.prop); - } else if (lvUpdateTrackedProp(&g_Vars.currentplayer->lookingatprop, -1) == 0) { + if (lvUpdateTrackedProp(&g_Vars.currentplayer->lookingatprop, -1) == 0) { g_Vars.currentplayer->lookingatprop.prop = NULL; } @@ -1701,10 +1691,6 @@ Gfx *lvRender(Gfx *gdl) gdl = scenarioRenderHud(gdl); #endif - if (g_FrIsValidWeapon) { - gdl = frRenderHud(gdl); - } - if (debugGetTilesDebugMode() != 0 || debugGetPadsDebugMode() != 0 || debug0f11eea8() @@ -1784,42 +1770,6 @@ Gfx *lvRender(Gfx *gdl) } } - // Advance the cutscenes when autoplaying - if (!g_Vars.autocutplaying && g_Vars.autocutgroupcur >= 0 && g_Vars.autocutgroupleft > 0) { - hudmsgRemoveAll(); - - g_Vars.autocutnum = g_Cutscenes[g_Vars.autocutgroupcur].scene; - -#if VERSION < VERSION_NTSC_1_0 - if (mainGetStageNum() != g_Cutscenes[g_Vars.autocutgroupcur].stage) -#endif - { - g_MissionConfig.iscoop = false; - g_Vars.mplayerisrunning = false; - g_Vars.normmplayerisrunning = false; - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = -1; - g_Vars.antiplayernum = -1; - g_MissionConfig.isanti = false; - setNumPlayers(1); - titleSetNextMode(TITLEMODE_SKIP); - g_MissionConfig.difficulty = DIFF_A; - lvSetDifficulty(DIFF_A); - g_MissionConfig.stageindex = g_Cutscenes[g_Vars.autocutgroupcur].mission; - g_MissionConfig.stagenum = g_Cutscenes[g_Vars.autocutgroupcur].stage; - titleSetNextStage(g_Cutscenes[g_Vars.autocutgroupcur].stage); - mainChangeToStage(g_Cutscenes[g_Vars.autocutgroupcur].stage); - } - - g_Vars.autocutgroupleft--; - - if (g_Vars.autocutgroupleft > 0) { - g_Vars.autocutgroupcur++; - } else { - g_Vars.autocutgroupcur = -1; - } - } - gDPSetScissor(gdl++, G_SC_NON_INTERLACE, 0, 0, viGetWidth(), viGetHeight()); #if VERSION < VERSION_NTSC_1_0 @@ -2405,23 +2355,6 @@ void lvTick(void) musicTick(); langTick(); propsTickPadEffects(); - - if (mainGetStageNum() == STAGE_CITRAINING) { - struct trainingdata *trainingdata = dtGetData(); - - if ((g_Vars.currentplayer->prop->rooms[0] < ROOM_DISH_HOLO1 || g_Vars.currentplayer->prop->rooms[0] > ROOM_DISH_HOLO4) - && g_Vars.currentplayer->prop->rooms[0] != ROOM_DISH_FIRINGRANGE - && (trainingdata == NULL || trainingdata->intraining == false)) { - chrUnsetStageFlag(NULL, STAGEFLAG_CI_IN_TRAINING); - } - - frTick(); - - if (g_Vars.lvupdate240 != 0) { - dtTick(); - htTick(); - } - } } } diff --git a/src/game/mainmenu.c b/src/game/mainmenu.c index 5a3cfad6a..b1a597695 100644 --- a/src/game/mainmenu.c +++ b/src/game/mainmenu.c @@ -18,7 +18,6 @@ #include "game/lv.h" #include "game/mplayer/ingame.h" #include "game/challenge.h" -#include "game/training.h" #include "game/gamefile.h" #include "game/lang.h" #include "game/mplayer/mplayer.h" @@ -38,31 +37,6 @@ struct menudialogdef g_2PMissionControlStyleMenuDialog; struct menudialogdef g_CiControlPlayer2MenuDialog; struct menudialogdef g_CinemaMenuDialog; -char *menuTextCurrentStageName(struct menuitem *item) -{ - sprintf(g_StringPointer, "%s\n", langGet(g_StageNames[g_MissionConfig.stageindex].name3)); - return g_StringPointer; -} - -char *soloMenuTextDifficulty(struct menuitem *item) -{ -#if VERSION >= VERSION_NTSC_1_0 - if (g_MissionConfig.pdmode) { - return langGet(L_MPWEAPONS_221); - } -#endif - - switch (g_MissionConfig.difficulty) { - case DIFF_SA: - return langGet(L_OPTIONS_252); - case DIFF_PA: - return langGet(L_OPTIONS_253); - case DIFF_A: - default: - return langGet(L_OPTIONS_251); - } -} - u16 g_ControlStyleOptions[] = { L_OPTIONS_239, // "1.1" L_OPTIONS_240, // "1.2" @@ -659,1078 +633,6 @@ s32 menuhandlerSfxVolume(s32 operation, struct menuitem *item, union handlerdata return 0; } -s32 menudialogBriefing(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - if (operation == MENUOP_TICK) { - if (g_Menus[g_MpPlayerNum].curdialog - && g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) { - struct menuinputs *inputs = data->dialog2.inputs; - - if (inputs->start) { - menuhandlerAcceptMission(MENUOP_SET, NULL, data); - } - - inputs->start = false; - } - } - - return 0; -} - -struct menuitem g_PreAndPostMissionBriefingMenuItems[] = { - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_BRIEFING, - 0, - 0, - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_PreAndPostMissionBriefingMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_247, // "Briefing" - g_PreAndPostMissionBriefingMenuItems, - menudialogBriefing, - MENUDIALOGFLAG_DISABLEITEMSCROLL, - NULL, -}; - -s32 menuhandlerAcceptMission(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - menuStop(); - - if (g_Vars.stagenum == g_MissionConfig.stagenum) { - g_Vars.restartlevel = true; - } - - titleSetNextStage(g_MissionConfig.stagenum); - - if (g_MissionConfig.iscoop) { - if (g_Vars.numaibuddies == 0) { - // Coop with human buddy - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = 1; - g_Vars.antiplayernum = -1; - setNumPlayers(2); - } else { - // Coop with AI buddies - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = -1; - g_Vars.antiplayernum = -1; - setNumPlayers(1); - } - } else if (g_MissionConfig.isanti) { - if (g_Vars.pendingantiplayernum == 1) { - g_Vars.bondplayernum = 0; - g_Vars.antiplayernum = 1; - } else { - g_Vars.bondplayernum = 1; - g_Vars.antiplayernum = 0; - } - - g_Vars.coopplayernum = -1; - setNumPlayers(2); - } else { - // Solo - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = -1; - g_Vars.antiplayernum = -1; - setNumPlayers(1); - } - - lvSetDifficulty(g_MissionConfig.difficulty); - titleSetNextMode(TITLEMODE_SKIP); - mainChangeToStage(g_MissionConfig.stagenum); - -#if VERSION >= VERSION_NTSC_1_0 - viBlack(true); -#endif - } - - return 0; -} - -char *soloMenuTitleStageOverview(struct menudialogdef *dialogdef) -{ - if (dialogdef != g_Menus[g_MpPlayerNum].curdialog->definition) { - return langGet(L_OPTIONS_273); // "Overview" - } - - sprintf(g_StringPointer, "%s: %s\n", - langGet(g_StageNames[g_MissionConfig.stageindex].name3), - langGet(L_OPTIONS_273)); - - return g_StringPointer; -} - -s32 menudialog00103608(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - switch (operation) { - case MENUOP_OPEN: - g_Menus[g_MpPlayerNum].unk840.unk010 = 0; - - setupLoadBriefing(g_MissionConfig.stagenum, - g_Menus[g_MpPlayerNum].unk840.unk004, - g_Menus[g_MpPlayerNum].unk840.unk008, &g_Briefing); - break; - case MENUOP_CLOSE: - langClearBank(g_Briefing.langbank); - break; - } - - return 0; -} - -struct menuitem g_AcceptMissionMenuItems[] = { - { - MENUITEMTYPE_OBJECTIVES, - 1, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_274, // "Accept" - 0, - menuhandlerAcceptMission, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - L_OPTIONS_275, // "Decline" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_AcceptMissionMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&soloMenuTitleStageOverview, - g_AcceptMissionMenuItems, - menudialog00103608, - MENUDIALOGFLAG_STARTSELECTS | MENUDIALOGFLAG_DISABLEITEMSCROLL, - &g_PreAndPostMissionBriefingMenuDialog, -}; - -f32 func0f1036ac(u8 value, s32 prop) -{ - if (prop == PDMODEPROP_REACTION) { - return value / 255.0f; - } - - return mpHandicapToDamageScale(value); -} - -s32 menuhandlerPdModeSetting(s32 operation, struct menuitem *item, union handlerdata *data) -{ - u8 *property; - f32 fvalue; - - switch (item->param) { - case PDMODEPROP_REACTION: property = &g_MissionConfig.pdmodereaction; break; - case PDMODEPROP_HEALTH: property = &g_MissionConfig.pdmodehealth; break; - case PDMODEPROP_DAMAGE: property = &g_MissionConfig.pdmodedamage; break; - case PDMODEPROP_ACCURACY: property = &g_MissionConfig.pdmodeaccuracy; break; - default: return 0; - } - - switch (operation) { - case MENUOP_GETSLIDER: - data->slider.value = *property; - break; - case MENUOP_SET: - *property = (u16)data->slider.value; - break; - case MENUOP_GETSLIDERLABEL: - fvalue = func0f1036ac(*property, item->param); - if (item->param == 0) { - fvalue = fvalue * 4 + 1.0f; - } - sprintf(data->slider.label, "%s%s%.00f%%\n", "", "", fvalue * 100.0f); - break; - } - - return 0; -} - -s32 menuhandlerAcceptPdModeSettings(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - g_MissionConfig.pdmode = true; - g_MissionConfig.pdmodehealthf = func0f1036ac(g_MissionConfig.pdmodehealth, PDMODEPROP_HEALTH); - g_MissionConfig.pdmodedamagef = func0f1036ac(g_MissionConfig.pdmodedamage, PDMODEPROP_DAMAGE); - g_MissionConfig.pdmodeaccuracyf = func0f1036ac(g_MissionConfig.pdmodeaccuracy, PDMODEPROP_ACCURACY); - g_MissionConfig.difficulty = DIFF_PA; - lvSetDifficulty(g_MissionConfig.difficulty); - menuPopDialog(); - menuPopDialog(); - menuPushDialog(&g_AcceptMissionMenuDialog); - } - - return 0; -} - -struct menuitem g_PdModeSettingsMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING, - L_MPWEAPONS_222, // "Choose Settings:" - 0, - NULL, - }, - { - MENUITEMTYPE_SLIDER, - 1, - MENUITEMFLAG_SLIDER_ALTSIZE, - L_MPWEAPONS_224, // "Enemy Health:" - 0x000000ff, - menuhandlerPdModeSetting, - }, - { - MENUITEMTYPE_SLIDER, - 2, - MENUITEMFLAG_SLIDER_ALTSIZE, - L_MPWEAPONS_225, // "Enemy Damage:" - 0x000000ff, - menuhandlerPdModeSetting, - }, - { - MENUITEMTYPE_SLIDER, - 3, - MENUITEMFLAG_SLIDER_ALTSIZE, - L_MPWEAPONS_226, // "Enemy Accuracy:" - 0x000000ff, - menuhandlerPdModeSetting, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0x000000b4, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_MPWEAPONS_227, // "OK" - 0, - menuhandlerAcceptPdModeSettings, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - L_MPWEAPONS_228, // "Cancel" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_PdModeSettingsMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPWEAPONS_221, // "Perfect Dark" - g_PdModeSettingsMenuItems, - NULL, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; - -/** - * This function assumes that the stage that's given to it is already unlocked. - * It is checking the difficulty for that stage only. - * - * This function does not test for PD mode being unlocked. - */ -bool isStageDifficultyUnlocked(s32 stageindex, s32 difficulty) -{ - s32 s; - s32 d; - - // Handle special missions - if (stageindex > SOLOSTAGEINDEX_SKEDARRUINS) { -#if VERSION >= VERSION_NTSC_1_0 - // If the player has completed Skedar Ruins on the same difficulty as - // the one that's being queried, then they have access to this - // difficulty for all special missions. Agent is gifted here, so if the - // bonus mission is available at all then Agent is also available. - s32 maxcompleteddiff = DIFF_A; - - for (d = DIFF_A; d <= DIFF_PA; d++) { - if (g_GameFile.besttimes[SOLOSTAGEINDEX_SKEDARRUINS][d] != 0) { - maxcompleteddiff = d; - } - } - - if (difficulty <= maxcompleteddiff) { - return true; - } -#endif - - // Otherwise, grant them the difficulty if they've completed all prior - // difficulties on this stage. - for (d = DIFF_A; d < difficulty; d++) { - if (g_GameFile.besttimes[stageindex][d] == 0) { - return false; - } - } - - return true; - } - - // Handle normal missions - if (stageindex <= SOLOSTAGEINDEX_SKEDARRUINS && difficulty <= DIFF_PA) { - // Defection is always unlocked on all difficulties - if (g_StageNames[stageindex].stagenum == STAGE_DEFECTION) { - return true; - } - - // If the stage has already been completed on the queried difficulty - // or higher then the queried difficulty is made available. - // For coop and anti, coop completions are also checked. - for (d = difficulty; d <= DIFF_PA; d++) { - if (g_GameFile.besttimes[stageindex][d] != 0) { - return true; - } - - if ((g_MissionConfig.iscoop || g_MissionConfig.isanti) - && (g_GameFile.coopcompletions[d] & (1 << stageindex))) { - return true; - } - } - - if (stageindex > 0) { - if (g_StageNames[stageindex].stagenum != STAGE_SKEDARRUINS) { - // For normal stages prior to Skedar Ruins, test if the - // prior stage is complete on the same difficulty or higher. - for (d = difficulty; d <= DIFF_PA; d++) { - if (g_GameFile.besttimes[stageindex - 1][d] != 0) { - return true; - } - - if ((g_MissionConfig.iscoop || g_MissionConfig.isanti) - && (g_GameFile.coopcompletions[d] & (1 << (stageindex - 1)))) { - return true; - } - } - } else { - // For Skedar Ruins, check that all prior stages are complete - // on the queried difficulty or higher. - for (s = 0; s < stageindex; s++) { - for (d = difficulty; d <= DIFF_PA; d++) { - if (g_GameFile.besttimes[s][d] != 0) { - break; - } - - if ((g_MissionConfig.iscoop || g_MissionConfig.isanti) - && (g_GameFile.coopcompletions[d] & (1 << s)) != 0) { - break; - } - } - - if (d > DIFF_PA) { - // A stage was not complete - break; - } - } - - if (s >= stageindex) { - return true; - } - } - } - - // If all normal stages are complete on any difficulty, and we're - // querying SA or higher, grant the difficulty if the stage is complete - // on the prior difficulty or higher. - if (difficulty >= DIFF_SA) { - if (g_StageNames[stageindex].stagenum != STAGE_SKEDARRUINS) { - // Check if all normal stages are complete on any difficulty - for (s = 0; s <= SOLOSTAGEINDEX_SKEDARRUINS; s++) { - for (d = DIFF_A; d <= DIFF_PA; d++) { - if (g_GameFile.besttimes[s][d] != 0) { - break; - } - - if ((g_MissionConfig.iscoop || g_MissionConfig.isanti) - && (g_GameFile.coopcompletions[d] & (1 << s)) != 0) { - break; - } - } - - if (d > DIFF_PA) { - // A stage was not complete - break; - } - } - - if (s >= SOLOSTAGEINDEX_MBR) { - for (d = difficulty - 1; d <= DIFF_PA; d++) { - if (g_GameFile.besttimes[stageindex][d] != 0) { - return true; - } - - if ((g_MissionConfig.iscoop || g_MissionConfig.isanti) - && (g_GameFile.coopcompletions[d] & (1 << stageindex)) != 0) { - return true; - } - } - } - } - } - } - - return false; -} - -s32 menuhandlerSoloDifficulty(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_CHECKPREFOCUSED: -#if VERSION >= VERSION_NTSC_1_0 - if (isStageDifficultyUnlocked(g_MissionConfig.stageindex, item->param)) { - if (item->param3 == 0) { - return true; - } - if (item->param <= (u32)g_GameFile.autodifficulty) { - return true; - } - } -#else - if (item->param3 == 0) { - return true; - } - if (item->param <= (u32)g_GameFile.autodifficulty) { - return true; - } -#endif - break; - case MENUOP_SET: - g_MissionConfig.pdmode = false; - g_MissionConfig.difficulty = item->param; - lvSetDifficulty(g_MissionConfig.difficulty); - menuPopDialog(); - menuPushDialog(&g_AcceptMissionMenuDialog); - break; - case MENUOP_CHECKDISABLED: - if (!isStageDifficultyUnlocked(g_MissionConfig.stageindex, item->param)) { - return true; - } - } - - return 0; -} - -s32 menuhandlerPdMode(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_SET: - menuPushDialog(&g_PdModeSettingsMenuDialog); - break; - case MENUOP_CHECKHIDDEN: - if (g_GameFile.besttimes[SOLOSTAGEINDEX_SKEDARRUINS][DIFF_PA] == 0) { - return true; - } - } - - return 0; -} - -char *soloMenuTextBestTime(struct menuitem *item) -{ - u16 time = g_GameFile.besttimes[g_MissionConfig.stageindex][item->param]; - s32 hours = time / 3600; - - if (time == 0) { - return "--:--\n"; - } - - if (time >= 0xfff) { // 1 hour, 8 minutes, 15 seconds - return "==:==\n"; - } - - if (hours == 0) { - s32 mins = time / 60; - sprintf(g_StringPointer, "%dm:%02ds", mins % 60, time % 60); - } else { - s32 mins = time / 60; - sprintf(g_StringPointer, "%dh:%02dm:%02ds", hours, mins % 60, time % 60); - } - - return g_StringPointer; -} - -struct menuitem g_SoloMissionDifficultyMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING, - L_OPTIONS_249, // "Difficulty" - L_OPTIONS_250, // "Best Time" - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_251, // "Agent" - (u32)&soloMenuTextBestTime, - menuhandlerSoloDifficulty, - }, - { - MENUITEMTYPE_SELECTABLE, - 1, - 0, - L_OPTIONS_252, // "Special Agent" - (u32)&soloMenuTextBestTime, - menuhandlerSoloDifficulty, - }, - { - MENUITEMTYPE_SELECTABLE, - 2, - 0, - L_OPTIONS_253, // "Perfect Agent" - (u32)&soloMenuTextBestTime, - menuhandlerSoloDifficulty, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_MPWEAPONS_221, // "Perfect Dark" - 0, - menuhandlerPdMode, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - L_OPTIONS_254, // "Cancel" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_SoloMissionDifficultyMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_248, // "Select Difficulty" - g_SoloMissionDifficultyMenuItems, - NULL, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; - -s32 menuhandlerBuddyOptionsContinue(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - menuPopDialog(); - menuPushDialog(&g_AcceptMissionMenuDialog); - } - - if (operation == MENUOP_CHECKPREFOCUSED) { - return true; - } - - return 0; -} - -#if VERSION >= VERSION_NTSC_1_0 -s32 getMaxAiBuddies(void) -{ - u32 stack; - s32 extra = 0; - s32 max = 1 - g_MissionConfig.difficulty; - s32 d; - - for (d = 0; d != 3; d++) { - if ((g_GameFile.coopcompletions[d] | 0xfffe0000) == 0xffffffff) { - extra = d + 1; - } - } - - max += extra; - - if (max > 4) { - max = 4; - } - - if (max < 1) { - max = 1; - } - -#if VERSION == VERSION_PAL_BETA - if (debugIsAllBuddiesEnabled()) { - max = 4; - } -#endif - - return max; -} -#endif - -s32 menudialogCoopAntiOptions(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ -#if VERSION >= VERSION_NTSC_1_0 - if (operation == MENUOP_OPEN) { - s32 max = getMaxAiBuddies(); - - if (g_Vars.numaibuddies > max) { - g_Vars.numaibuddies = max; - } - } -#endif - - if (operation == MENUOP_TICK) { - if (g_Menus[g_MpPlayerNum].curdialog && g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) { - struct menuinputs *inputs = data->dialog2.inputs; - - if (inputs->start) { - menuhandlerBuddyOptionsContinue(MENUOP_SET, NULL, NULL); - } - - inputs->start = false; - } - } - - return 0; -} - -s32 menuhandlerCoopRadar(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_GET: - return g_Vars.coopradaron; - case MENUOP_SET: - g_Vars.coopradaron = data->checkbox.value ? 1 : 0; - g_Vars.modifiedfiles |= MODFILE_GAME; - } - - return 0; -} - -s32 menuhandlerCoopFriendlyFire(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_GET: - return g_Vars.coopfriendlyfire; - case MENUOP_SET: - g_Vars.coopfriendlyfire = data->checkbox.value ? 1 : 0; - g_Vars.modifiedfiles |= MODFILE_GAME; - } - - return 0; -} - -s32 menuhandlerCoopBuddy(s32 operation, struct menuitem *item, union handlerdata *data) -{ - const u16 labels[] = { - L_OPTIONS_261, // "Human" - L_OPTIONS_262, // "1 Simulant" - L_OPTIONS_263, // "2 Simulants" - L_OPTIONS_264, // "3 Simulants" - L_OPTIONS_265, // "4 Simulants" - }; - - switch (operation) { - case MENUOP_GETOPTIONCOUNT: -#if VERSION >= VERSION_NTSC_1_0 - { - s32 maxaibuddies = getMaxAiBuddies(); - s32 human = 0; - - if (joyGetConnectedControllers() & 2) { - human = 1; - } - - data->dropdown.value = human + maxaibuddies; - } -#else - { - s32 extrabuddies = 0; - s32 i; - s32 maxbuddies = 1 - g_MissionConfig.difficulty; - s32 human = 0; - - if (joyGetConnectedControllers() & 2) { - human = 1; - } - - for (i = 0; i < 3; i++) { - if ((g_GameFile.coopcompletions[i] | 0xfffe0000) == 0xffffffff) { - extrabuddies = i + 1; - } - } - - maxbuddies += extrabuddies; - - if (maxbuddies > 4) { - maxbuddies = 4; - } - - if (maxbuddies < 1) { - maxbuddies = 1; - } - - if (debugIsAllBuddiesEnabled()) { - maxbuddies = 4; - } - - data->dropdown.value = human + maxbuddies; - } -#endif - break; - case MENUOP_GETOPTIONTEXT: - { - s32 extra = 1; - - if (joyGetConnectedControllers() & 2) { - extra = 0; - } - - return (s32)langGet(labels[data->dropdown.value + extra]); - } - case MENUOP_SET: - { - s32 extra = 1; - - if (joyGetConnectedControllers() & 2) { - extra = 0; - } - - g_Vars.numaibuddies = data->dropdown.value + extra; - g_Vars.modifiedfiles |= MODFILE_GAME; - } - break; - case MENUOP_GETSELECTEDINDEX: - { - s32 extra = 1; - - if (joyGetConnectedControllers() & 2) { - extra = 0; - } - - if (extra == 1 && g_Vars.numaibuddies == 0) { - g_Vars.numaibuddies = 1; - } - - data->dropdown.value = g_Vars.numaibuddies - extra; - } - break; - } - - return 0; -} - -struct menuitem g_CoopOptionsMenuItems[] = { - { - MENUITEMTYPE_CHECKBOX, - 0, - 0, - L_OPTIONS_256, // "Radar On" - 0, - menuhandlerCoopRadar, - }, - { - MENUITEMTYPE_CHECKBOX, - 0, - 0, - L_OPTIONS_257, // "Friendly Fire" - 0, - menuhandlerCoopFriendlyFire, - }, - { - MENUITEMTYPE_DROPDOWN, - 0, - 0, - L_OPTIONS_258, // "Perfect Buddy" - 0, - menuhandlerCoopBuddy, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, // "" - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_259, // "Continue" - 0, - menuhandlerBuddyOptionsContinue, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - L_OPTIONS_260, // "Cancel" - 0, - NULL, - }, - { MENUITEMTYPE_END }, // "" -}; - -struct menudialogdef g_CoopOptionsMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_255, // "Co-Operative Options" - g_CoopOptionsMenuItems, - menudialogCoopAntiOptions, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; - -s32 menuhandlerAntiRadar(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_GET: - return g_Vars.antiradaron; - case MENUOP_SET: - g_Vars.antiradaron = data->checkbox.value ? 1 : 0; - g_Vars.modifiedfiles |= MODFILE_GAME; - } - - return 0; -} - -s32 menuhandlerAntiPlayer(s32 operation, struct menuitem *item, union handlerdata *data) -{ - const u16 labels[] = {L_OPTIONS_271, L_OPTIONS_272}; - - switch (operation) { - case MENUOP_GETOPTIONCOUNT: - data->dropdown.value = 2; - break; - case MENUOP_GETOPTIONTEXT: - return (s32) langGet(labels[data->dropdown.value]); - case MENUOP_SET: - g_Vars.pendingantiplayernum = data->dropdown.value; - g_Vars.modifiedfiles |= MODFILE_GAME; - break; - case MENUOP_GETSELECTEDINDEX: - data->dropdown.value = g_Vars.pendingantiplayernum; - break; - } - - return 0; -} - -struct menuitem g_AntiOptionsMenuItems[] = { - { - MENUITEMTYPE_CHECKBOX, - 0, - 0, - L_OPTIONS_267, // "Radar On" - 0, - menuhandlerAntiRadar, - }, - { - MENUITEMTYPE_DROPDOWN, - 0, - 0, - L_OPTIONS_268, // "Counter-Operative" - 0, - menuhandlerAntiPlayer, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_269, // "Continue" - 0, - menuhandlerBuddyOptionsContinue, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - L_OPTIONS_270, // "Cancel" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_AntiOptionsMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_266, // "Counter-Operative Options" - g_AntiOptionsMenuItems, - menudialogCoopAntiOptions, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; - -s32 menuhandlerCoopDifficulty(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_SET: - g_MissionConfig.pdmode = false; - g_MissionConfig.difficulty = item->param; - lvSetDifficulty(g_MissionConfig.difficulty); - menuPopDialog(); - menuPushDialog(&g_CoopOptionsMenuDialog); - break; - case MENUOP_CHECKDISABLED: - if (!isStageDifficultyUnlocked(g_MissionConfig.stageindex, item->param)) { - return true; - } - } - - return 0; -} - -struct menuitem g_CoopMissionDifficultyMenuItems[] = { - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_251, // "Agent" - 0, - menuhandlerCoopDifficulty, - }, - { - MENUITEMTYPE_SELECTABLE, - 1, - 0, - L_OPTIONS_252, // "Special Agent" - 0, - menuhandlerCoopDifficulty, - }, - { - MENUITEMTYPE_SELECTABLE, - 2, - 0, - L_OPTIONS_253, // "Perfect Agent" - 0, - menuhandlerCoopDifficulty, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - L_OPTIONS_254, // "Cancel" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_CoopMissionDifficultyMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_248, // "Select Difficulty" - g_CoopMissionDifficultyMenuItems, - NULL, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; - -s32 menuhandlerAntiDifficulty(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_SET: - g_MissionConfig.pdmode = false; - g_MissionConfig.difficulty = item->param; - lvSetDifficulty(g_MissionConfig.difficulty); - menuPopDialog(); - menuPushDialog(&g_AntiOptionsMenuDialog); - } - - return 0; -} - -struct menuitem g_AntiMissionDifficultyMenuItems[] = { - { - MENUITEMTYPE_SELECTABLE, - 0, - 0, - L_OPTIONS_251, // "Agent" - 0, - menuhandlerAntiDifficulty, - }, - { - MENUITEMTYPE_SELECTABLE, - 1, - 0, - L_OPTIONS_252, // "Special Agent" - 0, - menuhandlerAntiDifficulty, - }, - { - MENUITEMTYPE_SELECTABLE, - 2, - 0, - L_OPTIONS_253, // "Perfect Agent" - 0, - menuhandlerAntiDifficulty, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - L_OPTIONS_254, // "Cancel" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_AntiMissionDifficultyMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_248, // "Select Difficulty" - g_AntiMissionDifficultyMenuItems, - NULL, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; - struct stageoverviewentry g_StageNames[NUM_SOLOSTAGES] = { // stage, unk04, { STAGE_DEFECTION, 0x0c, L_OPTIONS_133, L_OPTIONS_134, L_MPWEAPONS_124 }, @@ -1756,344 +658,6 @@ struct stageoverviewentry g_StageNames[NUM_SOLOSTAGES] = { { STAGE_DUEL, 0x1c, L_OPTIONS_171, L_OPTIONS_003, L_OPTIONS_171 }, }; -s32 getNumUnlockedSpecialStages(void) -{ - s32 next = 0; - s32 offsetforduel = 1; - s32 i; - - for (i = 0; i < 3; i++) { - if (g_GameFile.besttimes[SOLOSTAGEINDEX_SKEDARRUINS][i]) { - next = i + 1; - } - } - - if (g_MissionConfig.iscoop || g_MissionConfig.isanti) { - offsetforduel = 0; - } else { - for (i = 0; i < (VERSION >= VERSION_NTSC_1_0 ? 32 : 33); i++) { - if (ciGetFiringRangeScore(i) <= 0) { - offsetforduel = 0; - } - } - } - - return next + offsetforduel; -} - -s32 func0f104720(s32 value) -{ - s32 next = 0; - s32 d; - - for (d = 0; d != 3; d++) { - if (g_GameFile.besttimes[SOLOSTAGEINDEX_SKEDARRUINS][d]) { - next = d + 1; - } - } - - if (next > value) { - return 17 + value; - } - - return 20; -} - -s32 menuhandlerMissionList(s32 operation, struct menuitem *item, union handlerdata *data) -{ - struct optiongroup groups[] = { - { 0, L_OPTIONS_123 }, // "Mission 1" - { 3, L_OPTIONS_124 }, // "Mission 2" - { 4, L_OPTIONS_125 }, // "Mission 3" - { 6, L_OPTIONS_126 }, // "Mission 4" - { 9, L_OPTIONS_127 }, // "Mission 5" - { 12, L_OPTIONS_128 }, // "Mission 6" - { 14, L_OPTIONS_129 }, // "Mission 7" - { 15, L_OPTIONS_130 }, // "Mission 8" - { 16, L_OPTIONS_131 }, // "Mission 9" - { 99, L_OPTIONS_132 }, // "Special Assignments" - }; - - s32 i; - s32 j; - bool stageiscomplete; - union handlerdata sp18c; - u32 sp188; - union handlerdata sp178; - union handlerdata sp168; - s32 sp164; - s32 sp160; - union handlerdata sp150; - s32 k; - union handlerdata sp13c; - Gfx *gdl; - struct menuitemrenderdata *renderdata; - s32 x; - s32 y; - s32 stack; - s32 incompleteindex; - char text[50]; - s32 stageindex; - union handlerdata spdc; - - switch (operation) { - case MENUOP_GETOPTIONCOUNT: - data->list.value = 0; - - for (i = 0; i < 17; i++) { - stageiscomplete = false; - - for (j = 0; j < 3; j++) { - if (g_GameFile.besttimes[i][j] != 0) { - stageiscomplete = true; - } - - if ((g_MissionConfig.iscoop || g_MissionConfig.isanti) - && (g_GameFile.coopcompletions[j] & (1 << i))) { - stageiscomplete = true; - } - } - - data->list.value++; - - if (!stageiscomplete) { - break; - } - } - - data->list.value += getNumUnlockedSpecialStages(); - break; - case MENUOP_GETOPTIONTEXT: - if (data->list.unk04u32 == 0) { - menuhandlerMissionList(MENUOP_GETOPTIONCOUNT, item, &sp18c); - data->list.unk04u32 = sp18c.list.value - getNumUnlockedSpecialStages(); - } - - if (data->list.value < data->list.unk04u32) { - // Regular stage such as "dataDyne Central - Defection" - // Return the name before the dash, such as "dataDyne Central" - return (s32) langGet(g_StageNames[data->list.value].name1); - } - - // Special stages have no dash and suffix, so just return the name - return (s32) langGet(g_StageNames[func0f104720(data->list.value - data->list.unk04u32)].name1); - case MENUOP_SET: - sp188 = data->list.value; - menuhandlerMissionList(MENUOP_GETOPTIONCOUNT, item, &sp178); - sp178.list.value -= getNumUnlockedSpecialStages(); - - if (data->list.value >= sp178.list.value) { - sp188 = func0f104720(data->list.value - sp178.list.value); - } - - g_Vars.mplayerisrunning = false; - g_Vars.normmplayerisrunning = false; - g_MissionConfig.stagenum = g_StageNames[sp188].stagenum; - g_MissionConfig.stageindex = sp188; - - if (g_MissionConfig.iscoop) { - menuPushDialog(&g_CoopMissionDifficultyMenuDialog); - } else if (g_MissionConfig.isanti) { - menuPushDialog(&g_AntiMissionDifficultyMenuDialog); - } else { - menuPushDialog(&g_SoloMissionDifficultyMenuDialog); - } - - break; - case MENUOP_GETSELECTEDINDEX: - data->list.value = 0xfffff; - break; - case MENUOP_25: - if (data->list.unk04 == 0 && !g_MissionConfig.iscoop && !g_MissionConfig.isanti) { - data->list.value = g_GameFile.autostageindex; - - menuhandlerMissionList(MENUOP_GETOPTIONCOUNT, item, &sp168); - sp168.list.value -= getNumUnlockedSpecialStages(); - - if (data->list.value >= sp168.list.value) { - sp164 = getNumUnlockedSpecialStages(); - - data->list.value = sp168.list.value - 1; - - for (sp160 = 0; sp160 < sp164; sp160++) { - if (func0f104720(sp160) == g_GameFile.autostageindex) { - data->list.value = sp168.list.values32 + sp160; - } - } - } - } - break; - case MENUOP_GETOPTGROUPCOUNT: - menuhandlerMissionList(MENUOP_GETOPTIONCOUNT, item, &sp150); - sp150.list.value -= getNumUnlockedSpecialStages(); - - data->list.unk0c = 0; - - for (i = 0; i < ARRAYCOUNT(groups); i++) { - if (groups[i].offset < sp150.list.value) { - data->list.unk0c++; - } - } - - data->list.value = data->list.unk0c + 1; - break; - case MENUOP_GETOPTGROUPTEXT: - if (data->list.unk0c == data->list.value) { - return (s32) langGet(groups[9].name); // "Special Assignments" - } - return (s32) langGet(groups[data->list.value].name); - case MENUOP_GETGROUPSTARTINDEX: - if (data->list.unk0c == data->list.value) { - menuhandlerMissionList(MENUOP_GETOPTIONCOUNT, item, &sp13c); - data->list.groupstartindex = sp13c.list.value - getNumUnlockedSpecialStages(); - } else { - data->list.groupstartindex = groups[data->list.value].offset; - } - break; - case MENUOP_RENDER: - gdl = data->type19.gdl; - renderdata = data->type19.renderdata2; - incompleteindex = 0; - stageindex = data->type19.unk04u32; - - if (data->type19.unk0c == 0) { - menuhandlerMissionList(MENUOP_GETOPTIONCOUNT, item, &spdc); - data->type19.unk0c = spdc.list.value - getNumUnlockedSpecialStages(); - } - - if (data->type19.unk04u32 >= data->type19.unk0c) { - stageindex = func0f104720(data->type19.unk04u32 - data->type19.unk0c); - } - - // Draw the thumbnail - gDPPipeSync(gdl++); - gDPSetTexturePersp(gdl++, G_TP_NONE); - gDPSetAlphaCompare(gdl++, G_AC_NONE); - gDPSetTextureLOD(gdl++, G_TL_TILE); - gDPSetTextureConvert(gdl++, G_TC_FILT); - -#if VERSION >= VERSION_NTSC_1_0 - texSelect(&gdl, g_TexGeneralConfigs + 13 + stageindex, 2, 0, 2, true, NULL); - gDPSetCycleType(gdl++, G_CYC_1CYCLE); - gDPSetCombineLERP(gdl++, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0); - gDPSetTextureFilter(gdl++, G_TF_POINT); - gDPSetEnvColorViaWord(gdl++, 0xffffff00 | ((renderdata->colour & 0xff) * 255 / 256)); -#else - texSelect(&gdl, g_TexGeneralConfigs + 13 + stageindex, 1, 0, 2, true, NULL); - gDPSetCycleType(gdl++, G_CYC_1CYCLE); - gDPSetCombineMode(gdl++, G_CC_DECALRGBA, G_CC_DECALRGBA); - gDPSetTextureFilter(gdl++, G_TF_POINT); -#endif - - gSPTextureRectangle(gdl++, - ((renderdata->x + 4) << 2) * g_ScaleX, (renderdata->y + 3) << 2, - ((renderdata->x + 60) << 2) * g_ScaleX, (renderdata->y + 39) << 2, - G_TX_RENDERTILE, 0, 0x0480, 1024 / g_ScaleX, -1024); - - if (g_MissionConfig.isanti) { - // No stars - } else if (g_MissionConfig.iscoop) { - texSelect(&gdl, &g_TexGeneralConfigs[36], 2, 0, 2, true, NULL); - - gDPSetCycleType(gdl++, G_CYC_1CYCLE); - gDPSetTextureFilter(gdl++, G_TF_POINT); - - for (k = 0; k < 3; k++) { - s32 relx = 63 + k * 17; - - if ((g_GameFile.coopcompletions[k] & (1 << stageindex)) == 0) { -#if VERSION >= VERSION_NTSC_1_0 - gDPSetEnvColorViaWord(gdl++, 0xffffff00 | ((renderdata->colour & 0xff) * 63 / 256)); -#else - gDPSetEnvColorViaWord(gdl++, 0xffffff3f); -#endif - gDPSetCombineLERP(gdl++, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0); - } else { -#if VERSION >= VERSION_NTSC_1_0 - gDPSetEnvColorViaWord(gdl++, 0xffffff00 | ((renderdata->colour & 0xff) * 207 / 256)); -#else - gDPSetEnvColorViaWord(gdl++, 0xffffffcf); -#endif - gDPSetCombineMode(gdl++, G_CC_DECALRGBA, G_CC_DECALRGBA); - } - - gSPTextureRectangle(gdl++, - ((renderdata->x + relx) << 2) * g_ScaleX, (renderdata->y + 25) << 2, - ((renderdata->x + relx + 14) << 2) * g_ScaleX, (renderdata->y + 39) << 2, - G_TX_RENDERTILE, 0x0010, 0x01c0, 1024 / g_ScaleX, -1024); - } - } else { - texSelect(&gdl, &g_TexGeneralConfigs[34], 2, 0, 2, true, NULL); - - gDPSetCycleType(gdl++, G_CYC_1CYCLE); - gDPSetTextureFilter(gdl++, G_TF_POINT); - gDPSetCombineMode(gdl++, G_CC_DECALRGBA, G_CC_DECALRGBA); - -#if VERSION >= VERSION_NTSC_1_0 - gDPSetEnvColorViaWord(gdl++, 0xffffff00 | ((renderdata->colour & 0xff) * 175 / 256)); -#else - gDPSetEnvColorViaWord(gdl++, 0xffffffaf); -#endif - - for (k = 0; k < 3; k++) { - if (g_GameFile.besttimes[stageindex][k] != 0) { - incompleteindex = k + 1; - } - } - - for (k = 0; k < 3; k++) { - s32 relx = 63 + k * 17; - - if (k == incompleteindex) { - // Set transparency -#if VERSION >= VERSION_NTSC_1_0 - gDPSetEnvColorViaWord(gdl++, 0xffffff00 | ((renderdata->colour & 0xff) * 63 / 256)); -#else - gDPSetEnvColorViaWord(gdl++, 0xffffff3f); -#endif - gDPSetCombineLERP(gdl++, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0); - } - - gSPTextureRectangle(gdl++, - ((renderdata->x + relx) << 2) * g_ScaleX, (renderdata->y + 25) << 2, - ((renderdata->x + relx + 14) << 2) * g_ScaleX, (renderdata->y + 39) << 2, - G_TX_RENDERTILE, 0x0010, 0x01c0, 1024 / g_ScaleX, -1024); - } - } - - x = renderdata->x + 62; - y = renderdata->y + 3; - - gdl = text0f153628(gdl); - - // Draw first part of name - strcpy(text, langGet(g_StageNames[stageindex].name1)); - strcat(text, "\n"); - - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, - renderdata->colour, viGetWidth(), viGetHeight(), 0, 0); - - // Draw last part of name - strcpy(text, langGet(g_StageNames[stageindex].name2)); - - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, - renderdata->colour, viGetWidth(), viGetHeight(), 0, 0); - - gdl = text0f153780(gdl); - - return (s32) gdl; - case MENUOP_GETOPTIONHEIGHT: - data->list.value = 42; - break; - } - - return 0; -} - s32 menudialog0010559c(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) { switch (operation) { @@ -3869,9 +2433,6 @@ char *invMenuTextWeaponName(struct menuitem *item) return langGet(L_OPTIONS_003); // "\n" } -/** - * Return manufacturer, with fallback to weapon name if manufacturer is blank. - */ char *invMenuTextWeaponManufacturer(struct menuitem *item) { struct weapon *weapon = weaponFindById(g_InventoryWeapon); @@ -4022,129 +2583,6 @@ struct menuitem g_SoloMissionInventoryMenuItems[] = { { MENUITEMTYPE_END }, }; -struct menuitem g_FrWeaponsAvailableMenuItems[] = { - { - MENUITEMTYPE_LIST, - 0, - 0, - 0x0000006e, - 0x00000063, - menuhandlerFrInventoryList, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_NEWCOLUMN | MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SMALLFONT, - L_OPTIONS_003, // "" - (u32)&invMenuTextWeaponManufacturer, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_LABEL_ALTCOLOUR | MENUITEMFLAG_SMALLFONT, - L_OPTIONS_003, // "" - (u32)&invMenuTextWeaponName, - NULL, - }, - { - MENUITEMTYPE_MODEL, - 0, - 0, - 0x0000008c, - 0x00000037, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SMALLFONT, - L_OPTIONS_003, // "" - (u32)&invMenuTextPrimaryFunction, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SMALLFONT, - L_OPTIONS_003, // "" - (u32)&invMenuTextSecondaryFunction, - NULL, - }, - { - MENUITEMTYPE_MARQUEE, - 0, - MENUITEMFLAG_SMALLFONT | MENUITEMFLAG_MARQUEE_FADEBOTHSIDES, - (u32)&invMenuTextWeaponDescription, - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_SoloMissionInventoryMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_178, // "Inventory" - g_SoloMissionInventoryMenuItems, - inventoryMenuDialog, -#if VERSION >= VERSION_JPN_FINAL - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_DISABLERESIZE | MENUDIALOGFLAG_0400 | MENUDIALOGFLAG_1000, -#else - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_DISABLERESIZE | MENUDIALOGFLAG_0400, -#endif - &g_SoloMissionOptionsMenuDialog, -}; - -struct menudialogdef g_FrWeaponsAvailableMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_179, // "Weapons Available" - g_FrWeaponsAvailableMenuItems, - inventoryMenuDialog, - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_DISABLERESIZE | MENUDIALOGFLAG_0400, - NULL, -}; - -s32 menuhandlerFrInventoryList(s32 operation, struct menuitem *item, union handlerdata *data) -{ - static u8 g_FrFocusedSlotIndex = 0; - - switch (operation) { - case MENUOP_GETOPTGROUPCOUNT: - data->list.value = 0; - break; - case MENUOP_GETOPTGROUPTEXT: - return 0; - case MENUOP_GETGROUPSTARTINDEX: - data->list.groupstartindex = 0; - break; - case MENUOP_GETOPTIONCOUNT: - data->list.value = frGetNumWeaponsAvailable(); - break; - case MENUOP_GETOPTIONTEXT: - g_FrFocusedSlotIndex = data->list.value; - return (s32)bgunGetName(frGetWeaponBySlot(data->list.value)); - case MENUOP_SET: - g_FrFocusedSlotIndex = data->list.value; - return 0; - case MENUOP_GETSELECTEDINDEX: - data->list.value = g_FrFocusedSlotIndex; - break; - case MENUOP_LISTITEMFOCUS: - g_InventoryWeapon = frGetWeaponBySlot(data->list.value); - g_Menus[g_MpPlayerNum].training.weaponnum = g_InventoryWeapon; - g_FrFocusedSlotIndex = data->list.value; - - // These items are labels - func0f0f139c(&g_SoloMissionInventoryMenuItems[1], -1.0f); // manufacturer - func0f0f139c(&g_SoloMissionInventoryMenuItems[2], -1.0f); // weapon name - func0f0f139c(&g_SoloMissionInventoryMenuItems[4], -1.0f); // primary function - func0f0f139c(&g_SoloMissionInventoryMenuItems[5], -1.0f); // secondary function - break; - } - - return 0; -} - s32 menuhandlerInventoryList(s32 operation, struct menuitem *item, union handlerdata *data) { switch (operation) { @@ -4354,19 +2792,6 @@ s32 soloMenuDialogPauseStatus(s32 operation, struct menudialogdef *dialogdef, un return 0; } -char *soloMenuTitlePauseStatus(struct menudialogdef *dialogdef) -{ - if (dialogdef != g_Menus[g_MpPlayerNum].curdialog->definition) { - return langGet(L_OPTIONS_172); // "Status" - } - - sprintf(g_StringPointer, "%s: %s\n", - langGet(g_StageNames[g_MissionConfig.stageindex].name3), - langGet(L_OPTIONS_172)); - - return g_StringPointer; -} - struct menuitem g_2PMissionPauseVMenuItems[] = { { MENUITEMTYPE_OBJECTIVES, @@ -4406,493 +2831,3 @@ struct menuitem g_MissionPauseMenuItems[] = { }, { MENUITEMTYPE_END }, }; - -struct menudialogdef g_SoloMissionPauseMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&soloMenuTitlePauseStatus, - g_MissionPauseMenuItems, - soloMenuDialogPauseStatus, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_SoloMissionInventoryMenuDialog, -}; - -struct menudialogdef g_2PMissionPauseHMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&soloMenuTitlePauseStatus, - g_MissionPauseMenuItems, - soloMenuDialogPauseStatus, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_2PMissionInventoryHMenuDialog, -}; - -struct menudialogdef g_2PMissionPauseVMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_172, // "Status" - g_2PMissionPauseVMenuItems, - soloMenuDialogPauseStatus, - MENUDIALOGFLAG_DISABLEITEMSCROLL | MENUDIALOGFLAG_SMOOTHSCROLLABLE, - &g_2PMissionInventoryVMenuDialog, -}; - -struct cutscene g_Cutscenes[] = { - // stage ID, mission, scene, name - { /* 0*/ STAGE_DEFECTION, 0, 0, L_OPTIONS_450 }, - { /* 1*/ STAGE_DEFECTION, 0, 1, L_OPTIONS_451 }, - { /* 2*/ STAGE_INVESTIGATION, 1, 0, L_OPTIONS_452 }, - { /* 3*/ STAGE_INVESTIGATION, 1, 1, L_OPTIONS_453 }, - { /* 4*/ STAGE_EXTRACTION, 2, 0, L_OPTIONS_454 }, - { /* 5*/ STAGE_EXTRACTION, 2, 1, L_OPTIONS_455 }, - { /* 6*/ STAGE_VILLA, 3, 0, L_OPTIONS_456 }, -#if VERSION < VERSION_NTSC_1_0 - { /* 7*/ STAGE_VILLA, 3, 1, L_OPTIONS_457 }, -#endif - { /* 7*/ STAGE_VILLA, 3, 2, L_OPTIONS_458 }, - { /* 8*/ STAGE_CHICAGO, 4, 0, L_OPTIONS_459 }, - { /* 9*/ STAGE_CHICAGO, 4, 1, L_OPTIONS_460 }, - { /*10*/ STAGE_G5BUILDING, 5, 0, L_OPTIONS_461 }, - { /*11*/ STAGE_G5BUILDING, 5, 1, L_OPTIONS_462 }, - { /*12*/ STAGE_G5BUILDING, 5, 2, L_OPTIONS_463 }, - { /*13*/ STAGE_INFILTRATION, 6, 0, L_OPTIONS_464 }, - { /*14*/ STAGE_INFILTRATION, 6, 1, L_OPTIONS_465 }, - { /*15*/ STAGE_RESCUE, 7, 0, L_OPTIONS_466 }, - { /*16*/ STAGE_RESCUE, 7, 1, L_OPTIONS_467 }, - { /*17*/ STAGE_ESCAPE, 8, 0, L_OPTIONS_468 }, - { /*18*/ STAGE_ESCAPE, 8, 1, L_OPTIONS_469 }, - { /*19*/ STAGE_ESCAPE, 8, 2, L_OPTIONS_470 }, - { /*20*/ STAGE_AIRBASE, 9, 0, L_OPTIONS_471 }, - { /*21*/ STAGE_AIRBASE, 9, 1, L_OPTIONS_472 }, - { /*22*/ STAGE_AIRFORCEONE, 10, 0, L_OPTIONS_473 }, - { /*23*/ STAGE_AIRFORCEONE, 10, 1, L_OPTIONS_474 }, - { /*24*/ STAGE_AIRFORCEONE, 10, 2, L_OPTIONS_475 }, - { /*25*/ STAGE_CRASHSITE, 11, 0, L_OPTIONS_476 }, - { /*26*/ STAGE_CRASHSITE, 11, 1, L_OPTIONS_477 }, - { /*27*/ STAGE_PELAGIC, 12, 0, L_OPTIONS_478 }, - { /*28*/ STAGE_PELAGIC, 12, 1, L_OPTIONS_479 }, - { /*29*/ STAGE_DEEPSEA, 13, 0, L_OPTIONS_480 }, - { /*30*/ STAGE_DEEPSEA, 13, 1, L_OPTIONS_481 }, - { /*31*/ STAGE_DEEPSEA, 13, 2, L_OPTIONS_482 }, - { /*32*/ STAGE_DEFENSE, 14, 0, L_OPTIONS_483 }, - { /*33*/ STAGE_DEFENSE, 14, 1, L_OPTIONS_484 }, - { /*34*/ STAGE_ATTACKSHIP, 15, 0, L_OPTIONS_485 }, - { /*35*/ STAGE_ATTACKSHIP, 15, 1, L_OPTIONS_486 }, - { /*36*/ STAGE_SKEDARRUINS, 16, 0, L_OPTIONS_487 }, - { /*37*/ STAGE_SKEDARRUINS, 16, 1, L_OPTIONS_488 }, -}; - -u32 g_CutsceneCountsByMission[] = { - /* 0*/ 1, // 0 missions completed => 1 cutscene available (Def intro) - /* 1*/ 3, // 1 mission completed => 3 cutscenes available (Def intro, outro, Invest intro) - /* 2*/ 5, - /* 3*/ 7, -#if VERSION >= VERSION_NTSC_1_0 - // NTSC beta has an extra Villa cutscene - // so the numbers are bumped forward in that version - /* 4*/ 9, - /* 5*/ 11, - /* 6*/ 14, - /* 7*/ 16, - /* 8*/ 18, - /* 9*/ 21, - /*10*/ 23, - /*11*/ 26, - /*12*/ 28, - /*13*/ 30, - /*14*/ 33, - /*15*/ 35, - /*16*/ 37, - /*17*/ 38, -#else - /* 4*/ 10, - /* 5*/ 12, - /* 6*/ 15, - /* 7*/ 17, - /* 8*/ 19, - /* 9*/ 22, - /*10*/ 24, - /*11*/ 27, - /*12*/ 29, - /*13*/ 31, - /*14*/ 34, - /*15*/ 36, - /*16*/ 38, - /*17*/ 39, -#endif -}; - -s32 getNumCompletedMissions(void) -{ - s32 s; - s32 d; - s32 count = 0; - - for (s = 0; s != 17; s++) { - bool done = false; - - for (d = 0; d != 3; d++) { - if (g_GameFile.besttimes[s][d] || (g_GameFile.coopcompletions[d] & (1 << s))) { - count++; - done = true; - break; - } - } - - if (!done) { - break; - } - } - - return count; -} - -struct cutscenegroup { - u32 first_cutscene_index; - u16 name; -}; - -s32 menuhandlerCinema(s32 operation, struct menuitem *item, union handlerdata *data) -{ - struct cutscenegroup groups[] = { - { /* 0*/ 0, L_OPTIONS_436 }, // "Special" - { /* 1*/ 1, L_OPTIONS_438 }, // "Mission 1 - dataDyne Central" - { /* 2*/ 7, L_OPTIONS_439 }, -#if VERSION >= VERSION_NTSC_1_0 - { /* 3*/ 9, L_OPTIONS_440 }, - { /* 4*/ 14, L_OPTIONS_441 }, - { /* 5*/ 21, L_OPTIONS_442 }, - { /* 6*/ 28, L_OPTIONS_443 }, - { /* 7*/ 33, L_OPTIONS_444 }, - { /* 8*/ 35, L_OPTIONS_445 }, - { /* 9*/ 37, L_OPTIONS_446 }, // "Mission 9 - Skedar Ruins" - { /*10*/ 39, L_OPTIONS_447 }, // "Finale" -#else - { /* 3*/ 10, L_OPTIONS_440 }, - { /* 4*/ 15, L_OPTIONS_441 }, - { /* 5*/ 22, L_OPTIONS_442 }, - { /* 6*/ 29, L_OPTIONS_443 }, - { /* 7*/ 34, L_OPTIONS_444 }, - { /* 8*/ 36, L_OPTIONS_445 }, - { /* 9*/ 38, L_OPTIONS_446 }, // "Mission 9 - Skedar Ruins" - { /*10*/ 40, L_OPTIONS_447 }, // "Finale" -#endif - }; - - switch (operation) { - case MENUOP_GETOPTIONCOUNT: - // Add one for Play All option - data->list.value = g_CutsceneCountsByMission[getNumCompletedMissions()] + 1; - break; - case MENUOP_GETOPTIONTEXT: - if (data->list.value == 0) { - sprintf(g_StringPointer, langGet(L_OPTIONS_448)); // "Play All" - return (s32) g_StringPointer; - } - return (s32) langGet(g_Cutscenes[data->list.value - 1].name); - case MENUOP_SET: - if (data->list.value == 0) { - // Play all - s32 index = getNumCompletedMissions(); - g_Vars.autocutgroupcur = 0; - g_Vars.autocutgroupleft = g_CutsceneCountsByMission[index]; - menuPopDialog(); - menuStop(); - } else { - // Play specific cutscene - g_Vars.autocutgroupcur = data->list.value - 1; - g_Vars.autocutgroupleft = 1; - menuPopDialog(); - menuStop(); - } - break; - case MENUOP_GETSELECTEDINDEX: - data->list.value = 0xfffff; - break; - case MENUOP_GETOPTGROUPCOUNT: - data->list.value = ARRAYCOUNT(groups); - break; - case MENUOP_GETOPTGROUPTEXT: - return (s32) langGet(groups[data->list.value].name); - case MENUOP_GETGROUPSTARTINDEX: - data->list.groupstartindex = groups[data->list.value].first_cutscene_index; - break; - } - - return 0; -} - -struct menuitem g_CinemaMenuItems[] = { - { - MENUITEMTYPE_LIST, - 0, - 0, - 0x000000eb, - 0, - menuhandlerCinema, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_CinemaMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_490, // "Cinema" - g_CinemaMenuItems, - NULL, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; - -struct menuitem g_SelectMissionMenuItems[] = { - { - MENUITEMTYPE_LIST, - 0, - MENUITEMFLAG_LIST_CUSTOMRENDER, - 0x000000eb, - 0, - menuhandlerMissionList, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_SelectMissionMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_122, // "Mission Select" - g_SelectMissionMenuItems, - NULL, - MENUDIALOGFLAG_STARTSELECTS, - NULL, -}; - -s32 menuhandlerMainMenuSoloMissions(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - g_MissionConfig.iscoop = false; - g_MissionConfig.isanti = false; - menuPushDialog(&g_SelectMissionMenuDialog); - } - - if (operation == MENUOP_CHECKPREFOCUSED) { - if (isStageDifficultyUnlocked(SOLOSTAGEINDEX_INVESTIGATION, DIFF_A)) { - return true; - } - } - - return 0; -} - -s32 menuhandlerMainMenuCombatSimulator(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - g_Vars.bondplayernum = 0; - g_Vars.coopplayernum = -1; - g_Vars.antiplayernum = -1; - challengeDetermineUnlockedFeatures(); - g_Vars.mpsetupmenu = MPSETUPMENU_GENERAL; - func0f0f820c(&g_CombatSimulatorMenuDialog, MENUROOT_MPSETUP); - func0f0f8300(); - } - - return 0; -} - -s32 menuhandlerMainMenuCooperative(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - g_MissionConfig.iscoop = true; - g_MissionConfig.isanti = false; - menuPushDialog(&g_SelectMissionMenuDialog); - } - - return 0; -} - -s32 menuhandlerMainMenuCounterOperative(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_CHECKDISABLED) { - if ((joyGetConnectedControllers() & 2) == 0) { - return true; - } - } - - if (operation == MENUOP_SET) { - g_MissionConfig.iscoop = false; - g_MissionConfig.isanti = true; - menuPushDialog(&g_SelectMissionMenuDialog); - } - - return 0; -} - -s32 menudialogMainMenu(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - switch (operation) { - case MENUOP_OPEN: - g_Menus[g_MpPlayerNum].main.unke2c = 0; - break; - case MENUOP_TICK: - if (g_Menus[g_MpPlayerNum].curdialog && - g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) { - g_MissionConfig.iscoop = false; - g_MissionConfig.isanti = false; - } - break; - } - - return false; -} - -char *mainMenuTextLabel(struct menuitem *item) -{ - u16 nocheats[] = { - L_OPTIONS_117, // "Solo Missions" - L_OPTIONS_118, // "Combat Simulator" - L_OPTIONS_119, // "Co-Operative" - L_OPTIONS_120, // "Counter-Operative" - }; - - u16 withcheats[] = { - L_MPWEAPONS_130, // "Cheat Solo Missions" - L_MPWEAPONS_131, // "Cheat Combat Simulator" - L_MPWEAPONS_132, // "Cheat Co-Operative" - L_MPWEAPONS_133, // "Cheat Counter-Operative" - }; - - if (g_CheatsEnabledBank0 || g_CheatsEnabledBank1) { - return langGet(withcheats[item->param]); - } - - return langGet(nocheats[item->param]); -} - -struct menuitem g_MainMenuMenuItems[] = { - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_BIGFONT, - L_MISC_446, // "Carrington Institute" - 0x00000001, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_BIGFONT, - (u32)&mainMenuTextLabel, - 0x00000002, - menuhandlerMainMenuSoloMissions, - }, - { - MENUITEMTYPE_SELECTABLE, - 1, - MENUITEMFLAG_BIGFONT, - (u32)&mainMenuTextLabel, - 0x00000003, - menuhandlerMainMenuCombatSimulator, - }, - { - MENUITEMTYPE_SELECTABLE, - 2, - MENUITEMFLAG_BIGFONT, - (u32)&mainMenuTextLabel, - 0x00000004, - menuhandlerMainMenuCooperative, - }, - { - MENUITEMTYPE_SELECTABLE, - 3, - MENUITEMFLAG_BIGFONT, - (u32)&mainMenuTextLabel, - 0x00000005, - menuhandlerMainMenuCounterOperative, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_OPENSDIALOG | MENUITEMFLAG_BIGFONT, - L_OPTIONS_187, // "Change Agent..." - 0x00000006, - (void *)&g_ChangeAgentMenuDialog, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_CiMenuViaPcMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_116, // "Perfect Menu" - g_MainMenuMenuItems, - menudialogMainMenu, - MENUDIALOGFLAG_STARTSELECTS, - &g_CiOptionsViaPcMenuDialog, -}; - -struct menudialogdef g_CiMenuViaPauseMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_OPTIONS_116, // "Perfect Menu" - g_MainMenuMenuItems, - menudialogMainMenu, - MENUDIALOGFLAG_STARTSELECTS, - &g_CiOptionsViaPauseMenuDialog, -}; - -bool soloChoosePauseDialog(void) -{ - if (g_Menus[g_MpPlayerNum].openinhibit == 0) { - g_Menus[g_MpPlayerNum].playernum = 0; - - if (g_Vars.stagenum == STAGE_CITRAINING) { - bool handled = false; - - if (ciIsTourDone()) { - struct trainingdata *dtdata = dtGetData(); - s32 room = g_Vars.currentplayer->prop->rooms[0]; - - if (room >= ROOM_DISH_HOLO1 && room <= ROOM_DISH_HOLO4) { - struct trainingdata *htdata = getHoloTrainingData(); - - if (htdata->intraining) { - menuPushRootDialog(&g_HtDetailsMenuDialog, MENUROOT_TRAINING); - } else if (htdata->finished) { - htPushEndscreen(); - } else { - menuPushRootDialog(&g_HtListMenuDialog, MENUROOT_TRAINING); - } - - handled = true; - } else if (room == ROOM_DISH_DEVICELAB) { - if (dtdata->intraining) { - menuPushRootDialog(&g_DtDetailsMenuDialog, MENUROOT_TRAINING); - } else if (dtdata->finished) { - dtPushEndscreen(); - } else { - menuPushRootDialog(&g_DtListMenuDialog, MENUROOT_TRAINING); - } - - handled = true; - } else if (dtdata->intraining) { - menuPushRootDialog(&g_DtDetailsMenuDialog, MENUROOT_TRAINING); - handled = true; - } else if (dtdata->finished) { - dtPushEndscreen(); - handled = true; - } else if (room == ROOM_DISH_FIRINGRANGE) { - if (frIsInTraining()) { - menuPushRootDialog(&g_FrTrainingInfoInGameMenuDialog, MENUROOT_TRAINING); - } else { - menuPushRootDialog(&g_FrWeaponListMenuDialog, MENUROOT_TRAINING); - } - - handled = true; - } - } - - if (!handled) { - menuPushRootDialog(&g_CiMenuViaPauseMenuDialog, MENUROOT_MAINMENU); - return true; - } - } else { - menuPushRootDialog(&g_SoloMissionPauseMenuDialog, MENUROOT_MAINMENU); - } - - return true; - } - - return false; -} diff --git a/src/game/menu.c b/src/game/menu.c index 7aa7a5dfc..c359effcb 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -25,7 +25,6 @@ #include "game/texdecompress.h" #include "game/mplayer/setup.h" #include "game/challenge.h" -#include "game/training.h" #include "game/game_1a78b0.h" #include "game/gamefile.h" #include "game/gfxmemory.h" @@ -5750,10 +5749,6 @@ void menuPushRootDialog(struct menudialogdef *dialogdef, s32 root) void func0f0f85e0(struct menudialogdef *dialogdef, s32 root) { - if (dialogdef == &g_CiMenuViaPcMenuDialog) { - musicStartMenu(); - } - menuPushRootDialog(dialogdef, root); lvSetPaused(true); g_Vars.currentplayer->pausemode = PAUSEMODE_PAUSED; diff --git a/src/game/menuitem.c b/src/game/menuitem.c index a9a173269..3cbd827e4 100644 --- a/src/game/menuitem.c +++ b/src/game/menuitem.c @@ -12,7 +12,6 @@ #include "game/game_1531a0.h" #include "game/lv.h" #include "game/challenge.h" -#include "game/training.h" #include "game/lang.h" #include "game/mplayer/mplayer.h" #include "game/options.h" @@ -3369,16 +3368,6 @@ char *menuitemScrollableGetText(u32 type) challengeLoadAndStoreCurrent(g_Menus[g_MpPlayerNum].unk840.unk004, g_Menus[g_MpPlayerNum].unk840.unk008); } return challengeGetCurrentDescription(); - case DESCRIPTION_CHRBIO: return ciGetChrBioDescription(); - case DESCRIPTION_MISCBIO: return ciGetMiscBioDescription(); - case DESCRIPTION_DEVICETRAINING: return dtGetDescription(); - case DESCRIPTION_FRWEAPON: return frGetWeaponDescription(); - case DESCRIPTION_HANGARBIO: return ciGetHangarBioDescription(); - case DESCRIPTION_HOLOTRAINING: return htGetDescription(); - case DESCRIPTION_HOLOTIP1: return htGetTip1(); - case DESCRIPTION_HOLOTIP2: return htGetTip2(); - case DESCRIPTION_DEVICETIP1: return dtGetTip1(); - case DESCRIPTION_DEVICETIP2: return dtGetTip2(); } return langGet(g_Briefing.briefingtextnum); diff --git a/src/game/menustop.c b/src/game/menustop.c index d0100308b..a9bb0cc33 100644 --- a/src/game/menustop.c +++ b/src/game/menustop.c @@ -9,14 +9,12 @@ #include "game/menu.h" #include "game/filelist.h" #include "game/mainmenu.h" -#include "game/endscreen.h" #include "game/playermgr.h" #include "game/lv.h" #include "game/music.h" #include "game/mplayer/ingame.h" #include "game/mplayer/setup.h" #include "game/challenge.h" -#include "game/training.h" #include "game/gamefile.h" #include "game/mplayer/mplayer.h" #include "bss.h" diff --git a/src/game/menutick.c b/src/game/menutick.c index 09233cebc..e3ef5580e 100644 --- a/src/game/menutick.c +++ b/src/game/menutick.c @@ -10,14 +10,12 @@ #include "game/menu.h" #include "game/filelist.h" #include "game/mainmenu.h" -#include "game/endscreen.h" #include "game/playermgr.h" #include "game/lv.h" #include "game/music.h" #include "game/mplayer/ingame.h" #include "game/mplayer/setup.h" #include "game/challenge.h" -#include "game/training.h" #include "game/gamefile.h" #include "game/mplayer/mplayer.h" #include "bss.h" @@ -429,19 +427,7 @@ void menuTick(void) } if (playernum >= 0) { - if (g_Vars.coopplayernum >= 0) { - s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(playernum); - endscreenPushCoop(); - setCurrentPlayerNum(prevplayernum); - } else if (g_Vars.antiplayernum >= 0) { - s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(playernum); - endscreenPushAnti(); - setCurrentPlayerNum(prevplayernum); - } else { - mpPushEndscreenDialog(playernum, i); - } + mpPushEndscreenDialog(playernum, i); } } } @@ -485,13 +471,8 @@ void menuTick(void) if ((g_MenuData.unk5d5_06 || g_MenuData.unk008 != -1) && sp344 == false) { if ((g_MenuData.root == MENUROOT_MPSETUP || g_MenuData.root == MENUROOT_4MBMAINMENU) && g_MenuData.unk008 == -1) { - if (g_Vars.mpsetupmenu == MPSETUPMENU_GENERAL) { - g_MenuData.unk008 = MENUROOT_MAINMENU; - g_MenuData.unk00c = &g_CiMenuViaPauseMenuDialog; - } else { - g_MenuData.unk008 = MENUROOT_4MBMAINMENU; - g_MenuData.unk00c = &g_MainMenu4MbMenuDialog; - } + g_MenuData.unk008 = MENUROOT_4MBMAINMENU; + g_MenuData.unk00c = &g_MainMenu4MbMenuDialog; } if (g_MenuData.unk008 != -1) { @@ -514,34 +495,11 @@ void menuTick(void) for (i = 0; i < 4; i++) { if (g_MpSetup.chrslots & (1 << i)) { - if (g_Vars.coopplayernum >= 0) { - if (g_Vars.stagenum == STAGE_DEEPSEA) { - g_MissionConfig.stageindex++; - g_MissionConfig.stagenum = g_StageNames[g_MissionConfig.stageindex].stagenum; - titleSetNextStage(g_MissionConfig.stagenum); - lvSetDifficulty(g_MissionConfig.difficulty); - titleSetNextMode(TITLEMODE_SKIP); - mainChangeToStage(g_MissionConfig.stagenum); - } else { - s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(playernum); - endscreenPushCoop(); - setCurrentPlayerNum(prevplayernum); - sp344 = true; - } - } else if (g_Vars.antiplayernum >= 0) { - s32 prevplayernum = g_Vars.currentplayernum; - setCurrentPlayerNum(playernum); - endscreenPushAnti(); - setCurrentPlayerNum(prevplayernum); - sp344 = true; - } else { - mpPushEndscreenDialog(playernum, i); - sp344 = true; + mpPushEndscreenDialog(playernum, i); + sp344 = true; - if (g_PlayerConfigsArray[i].fileguid.fileid && g_PlayerConfigsArray[i].fileguid.deviceserial) { - func0f0fd548(i); - } + if (g_PlayerConfigsArray[i].fileguid.fileid && g_PlayerConfigsArray[i].fileguid.deviceserial) { + func0f0fd548(i); } playernum++; @@ -564,20 +522,6 @@ void menuTick(void) sndStart(var80095200, SFX_EXPLOSION_8098, 0, -1, -1, -1, -1, -1); } - if (g_MenuData.root == MENUROOT_MAINMENU || g_MenuData.root == MENUROOT_TRAINING) { - struct trainingdata *dtdata = dtGetData(); - - if ((g_Vars.stagenum == STAGE_CITRAINING || g_Vars.stagenum == STAGE_4MBMENU) - && ((g_Vars.currentplayer->prop->rooms[0] >= 0x16 && g_Vars.currentplayer->prop->rooms[0] <= 0x19) - || g_Vars.currentplayer->prop->rooms[0] == 0x0a - || g_Vars.currentplayer->prop->rooms[0] == 0x1e - || (dtdata && dtdata->intraining))) { - startmusic = false; - } else { - startmusic = true; - } - } - if (startmusic) { musicStartMenu(); } @@ -611,11 +555,7 @@ void menuTick(void) g_PlayerConfigsArray[1] = tmp; } - if (g_Vars.coopplayernum >= 0 - && g_MissionConfig.stageindex <= SOLOSTAGEINDEX_SKEDARRUINS - && ((!g_CheatsActiveBank0 && !g_CheatsActiveBank1) || isStageDifficultyUnlocked(g_MissionConfig.stageindex + 1, g_MissionConfig.difficulty))) { - endscreenPushSolo(); - } else if (g_Vars.restartlevel) { + if (g_Vars.restartlevel) { mainChangeToStage(mainGetStageNum()); } else { mpSetPaused(MPPAUSEMODE_UNPAUSED); diff --git a/src/game/mplayer/ingame.c b/src/game/mplayer/ingame.c index 22e57dd1f..0d65d2ac4 100644 --- a/src/game/mplayer/ingame.c +++ b/src/game/mplayer/ingame.c @@ -483,24 +483,6 @@ struct menudialogdef g_MpPauseInventoryMenuDialog = { &g_MpPauseControlMenuDialog, }; -struct menudialogdef g_2PMissionInventoryHMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_284, // "Inventory" - g_Mp2PMissionInventoryMenuItems, - NULL, - 0, - &g_2PMissionOptionsHMenuDialog, -}; - -struct menudialogdef g_2PMissionInventoryVMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_284, // "Inventory" - g_Mp2PMissionInventoryMenuItems, - NULL, - 0, - &g_2PMissionOptionsVMenuDialog, -}; - struct menuitem g_MpInGamePlayerStatsMenuItems[] = { { MENUITEMTYPE_PLAYERSTATS, @@ -768,18 +750,10 @@ void mpPushPauseDialog(void) if (g_Menus[g_MpPlayerNum].openinhibit == 0) { g_Menus[g_MpPlayerNum].playernum = g_Vars.currentplayernum; - if (g_Vars.normmplayerisrunning) { - if (g_MpSetup.options & MPOPTION_TEAMSENABLED) { - menuPushRootDialog(&g_MpPauseTeamRankingsMenuDialog, MENUROOT_MPPAUSE); - } else { - menuPushRootDialog(&g_MpPausePlayerRankingMenuDialog, MENUROOT_MPPAUSE); - } + if (g_MpSetup.options & MPOPTION_TEAMSENABLED) { + menuPushRootDialog(&g_MpPauseTeamRankingsMenuDialog, MENUROOT_MPPAUSE); } else { - if (optionsGetScreenSplit() == SCREENSPLIT_VERTICAL) { - menuPushRootDialog(&g_2PMissionPauseVMenuDialog, MENUROOT_MPPAUSE); - } else { - menuPushRootDialog(&g_2PMissionPauseHMenuDialog, MENUROOT_MPPAUSE); - } + menuPushRootDialog(&g_MpPausePlayerRankingMenuDialog, MENUROOT_MPPAUSE); } } diff --git a/src/game/mplayer/setup.c b/src/game/mplayer/setup.c index f4cc3299a..01bf1d85d 100644 --- a/src/game/mplayer/setup.c +++ b/src/game/mplayer/setup.c @@ -4739,15 +4739,7 @@ char *mpMenuTextSavePlayerOrCopy(struct menuitem *item) s32 menuhandler0017ef30(s32 operation, struct menuitem *item, union handlerdata *data) { if (operation == MENUOP_SET) { - if (g_Vars.stagenum == STAGE_CITRAINING) { - if (IS4MB()) { - func0f0f820c(&g_CiMenuViaPauseMenuDialog, 2); - } else { - func0f0f820c(&g_CiMenuViaPcMenuDialog, 2); - } - } else { - func0f0f820c(&g_SoloMissionPauseMenuDialog, 2); - } + func0f0f820c(&g_MainMenu4MbMenuDialog, MENUROOT_4MBMAINMENU); } return 0; diff --git a/src/game/objectives.c b/src/game/objectives.c index 9c3695d78..a36587fd3 100644 --- a/src/game/objectives.c +++ b/src/game/objectives.c @@ -11,7 +11,6 @@ #include "game/inv.h" #include "game/playermgr.h" #include "game/lv.h" -#include "game/training.h" #include "game/lang.h" #include "game/propobj.h" #include "bss.h" @@ -518,11 +517,6 @@ void objectiveCheckHolograph(f32 maxdist) && sp70[1] > camGetScreenTop() && sp70[1] < camGetScreenTop() + camGetScreenHeight()) { criteria->status = OBJECTIVE_COMPLETE; - - if (g_Vars.stagenum == STAGE_CITRAINING) { - struct trainingdata *data = dtGetData(); - data->holographedpc = true; - } } } } diff --git a/src/game/player.c b/src/game/player.c index 6b3425c66..f4575fcf3 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -45,7 +45,6 @@ #include "game/mplayer/ingame.h" #include "game/mplayer/scenarios.h" #include "game/radar.h" -#include "game/training.h" #include "game/mplayer/mplayer.h" #include "game/pad.h" #include "game/pak.h" @@ -2159,10 +2158,6 @@ void playerTickPauseMenu(void) case PAUSEMODE_PAUSING: // Pause menu is opening switch (g_GlobalMenuRoot) { - case MENUROOT_TRAINING: - case MENUROOT_MAINMENU: - opened = soloChoosePauseDialog(); - break; case MENUROOT_FILEMGR: opened = filemgrConsiderPushingFileSelectDialog(); break; @@ -2173,22 +2168,9 @@ void playerTickPauseMenu(void) } if (opened) { - struct trainingdata *data = dtGetData(); lvSetPaused(true); g_Vars.currentplayer->pausemode = PAUSEMODE_PAUSED; - if ((g_GlobalMenuRoot == MENUROOT_MAINMENU || g_GlobalMenuRoot == MENUROOT_TRAINING) - && g_Vars.stagenum == STAGE_CITRAINING) { - s32 room = g_Vars.currentplayer->prop->rooms[0]; - - if ((room >= ROOM_DISH_HOLO1 && room <= ROOM_DISH_HOLO4) - || room == ROOM_DISH_FIRINGRANGE - || room == ROOM_DISH_DEVICELAB - || (data && data->intraining)) { - return; - } - } - musicStartMenu(); } break; diff --git a/src/game/portal.c b/src/game/portal.c index d9bbae897..cc68060e2 100644 --- a/src/game/portal.c +++ b/src/game/portal.c @@ -40,7 +40,6 @@ #include "game/mplayer/ingame.h" #include "game/mplayer/scenarios.h" #include "game/radar.h" -#include "game/training.h" #include "game/mplayer/mplayer.h" #include "game/pad.h" #include "game/pak.h" diff --git a/src/game/prop.c b/src/game/prop.c index 189978817..06064a2d5 100644 --- a/src/game/prop.c +++ b/src/game/prop.c @@ -21,7 +21,6 @@ #include "game/sparks.h" #include "game/bg.h" #include "game/bot.h" -#include "game/training.h" #include "game/pad.h" #include "game/propobj.h" #include "game/splat.h" @@ -1284,7 +1283,6 @@ void handTickAttack(s32 handnum) g_Vars.currentplayer->hands[handnum].activatesecondary = false; gsetPopulateFromCurrentPlayer(handnum, &gset); - frIncrementNumShots(); switch (type) { case HANDATTACKTYPE_SHOOT: @@ -2556,13 +2554,7 @@ void autoaimTick(void) isclose = true; } - if (frIsInTraining()) { - if (!frChooseFarsightTarget()) { - farsightChooseTarget(); - } - } else { - farsightChooseTarget(); - } + farsightChooseTarget(); if (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_CMP150 && g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponfunc == FUNC_SECONDARY) { diff --git a/src/game/propobj.c b/src/game/propobj.c index 4a7be4a55..3858f79c0 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -48,7 +48,6 @@ #include "game/mpstats.h" #include "game/bot.h" #include "game/botact.h" -#include "game/training.h" #include "game/lang.h" #include "game/mplayer/mplayer.h" #include "game/pad.h" @@ -7839,10 +7838,6 @@ s32 projectileTick(struct defaultobj *obj, bool *embedded) shieldhitCreate(hitprop, shield, g_EmbedProp, g_EmbedNode, g_EmbedModel, g_EmbedSide, var8006993c); } - - if (hitobj->modelnum == MODEL_TARGET && var80069944 == TEXTURE_0B9E) { - frCalculateHit(hitobj, &sp5e8, 0.0f); - } } } else if (weapon->weaponnum == WEAPON_ROCKET || weapon->weaponnum == WEAPON_HOMINGROCKET) { s32 ownerplayernum = (obj->hidden & 0xf0000000) >> 28; @@ -9396,11 +9391,7 @@ void autogunTick(struct prop *prop) target = autogun->target; } else { // Find new target - if (frIsInTraining()) { - // Laptop gun in firing range - target = frChooseAutogunTarget(&prop->pos); - if (1); - } else if (autogun->targetteam != 0) { + if (autogun->targetteam != 0) { // Autogun (solo or MP) configured to attack specific teams if (g_Vars.normmplayerisrunning) { numchrs = g_MpNumChrs; @@ -9478,7 +9469,7 @@ void autogunTick(struct prop *prop) if (target) { if (target->chr == NULL) { target = NULL; - } else if (target->type != PROPTYPE_CHR && target->type != PROPTYPE_PLAYER && !frIsInTraining()) { + } else if (target->type != PROPTYPE_CHR && target->type != PROPTYPE_PLAYER) { target = NULL; } } @@ -9575,15 +9566,7 @@ void autogunTick(struct prop *prop) track = false; } } else if (target->type == PROPTYPE_OBJ) { - struct defaultobj *obj = target->obj; - - if (obj && obj->modelnum == MODEL_TARGET) { - if (!frIsTargetFacingPos(target, &prop->pos)) { - track = false; - } - } else { - track = false; - } + track = false; } propSetPerimEnabled(prop, false); @@ -9999,8 +9982,6 @@ void autogunTickShoot(struct prop *autogunprop) missed = false; - frCalculateHit(hitobj, &hitpos, 0); - if (chrIsUsingPaintball(ownerchr)) { sparksCreate(hitprop->rooms[0], hitprop, &hitpos, 0, 0, SPARKTYPE_PAINT); } else { @@ -16516,9 +16497,7 @@ void objHit(struct shotdata *shotdata, struct hit *hit) } if (obj->modelnum == MODEL_TARGET) { - if (hit->hitthing.texturenum == TEXTURE_0B9E) { - frCalculateHit(obj, &sp110, shotdata->gset.unk063a); - } else if ((shotdata->gset.weaponnum != WEAPON_CALLISTO || shotdata->gset.weaponfunc != FUNC_SECONDARY) + if ((shotdata->gset.weaponnum != WEAPON_CALLISTO || shotdata->gset.weaponfunc != FUNC_SECONDARY) #if VERSION >= VERSION_NTSC_1_0 && shotdata->gset.weaponnum != WEAPON_FARSIGHT #endif @@ -16874,68 +16853,8 @@ bool propobjInteract(struct prop *prop) { struct defaultobj *obj = prop->obj; bool result = false; - u32 tag_id = propobjGetCiTagId(prop); - if (tag_id) { - // CI object - terminals etc - u8 handled = false; - - if (ciIsTourDone()) { - if (tag_id == 0x10) { - struct trainingdata *data = dtGetData(); - handled = true; - - if (data->intraining) { - func0f0f85e0(&g_DtDetailsMenuDialog, MENUROOT_TRAINING); - } else { - func0f0f85e0(&g_DtListMenuDialog, MENUROOT_TRAINING); - } - } else if (tag_id == 0x45) { - struct trainingdata *data = getHoloTrainingData(); - handled = true; - - if (data->intraining) { - func0f0f85e0(&g_HtDetailsMenuDialog, MENUROOT_TRAINING); - } else { - func0f0f85e0(&g_HtListMenuDialog, MENUROOT_TRAINING); - } - } else if (tag_id == 0x7f) { - handled = true; - - if (frIsInTraining()) { - func0f0f85e0(&g_FrTrainingInfoInGameMenuDialog, MENUROOT_TRAINING); - } else { - func0f0f85e0(&g_FrWeaponListMenuDialog, MENUROOT_TRAINING); - } - } - } - - if (!handled) { - if (tag_id == 0x0e) { - handled = true; - func0f0f85e0(&g_BioListMenuDialog, MENUROOT_TRAINING); - } else if (tag_id == 0x0f) { - handled = true; - func0f0f85e0(&g_CheatsMenuDialog, MENUROOT_TRAINING); - } else if (tag_id == 0x1b) { - handled = true; - func0f0f85e0(&g_FrWeaponsAvailableMenuDialog, MENUROOT_TRAINING); - } else if (tag_id == 0x47) { - handled = true; - func0f0f85e0(&g_CiMenuViaPcMenuDialog, MENUROOT_MAINMENU); - } else if (tag_id == 0x46) { - handled = true; - func0f0f85e0(&g_HangarListMenuDialog, MENUROOT_TRAINING); - } - } - - if (handled) { - // Typing sound - sndStart(var80095200, SFX_TYPING_8118, NULL, -1, -1, -1, -1, -1); - } - - func0f0fd494(&prop->pos); - } else if (obj->type == OBJTYPE_ALARM) { + if (obj->type == OBJTYPE_ALARM) { // Button press sound sndStart(var80095200, SFX_PRESS_SWITCH, NULL, -1, -1, -1, -1, -1); @@ -21425,21 +21344,9 @@ bool propdoorInteract(struct prop *doorprop) } else if (door->mode == DOORMODE_IDLE && door->frac < 0.5f * door->maxfrac) { if ((door->base.flags2 & OBJFLAG2_SKIPDOORLOCKEDMSG) == 0) { struct textoverride *override = invGetTextOverrideForObj(&door->base); - u8 intraining = false; - - if (g_Vars.stagenum == STAGE_CITRAINING) { - struct trainingdata *devdata = dtGetData(); - struct trainingdata *holodata = getHoloTrainingData(); - - intraining = (devdata && devdata->intraining) - || (holodata && holodata->intraining) - || g_Vars.currentplayer->prop->rooms[0] == 0x0a; - } if (override && override->pickuptext) { hudmsgCreateWithFlags(langGet(override->pickuptext), HUDMSGTYPE_DEFAULT, HUDMSGFLAG_ONLYIFALIVE); - } else if (intraining) { - hudmsgCreateWithFlags(langGet(L_DISH_080), HUDMSGTYPE_DEFAULT, HUDMSGFLAG_ONLYIFALIVE); // "Cannot exit while training is in progress." } else { hudmsgCreateWithFlags(langGet(L_PROPOBJ_044), HUDMSGTYPE_DEFAULT, HUDMSGFLAG_ONLYIFALIVE); // "This door is locked." } diff --git a/src/game/title.c b/src/game/title.c index a0d6ce2be..0856985e9 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -13,7 +13,6 @@ #include "game/file.h" #include "game/lv.h" #include "game/music.h" -#include "game/training.h" #include "game/modeldef.h" #include "game/lang.h" #include "game/propobj.h" diff --git a/src/game/training.c b/src/game/training.c deleted file mode 100644 index acbdce651..000000000 --- a/src/game/training.c +++ /dev/null @@ -1,4029 +0,0 @@ -#include -#include "constants.h" -#include "game/chraction.h" -#include "game/dlights.h" -#include "game/prop.h" -#include "game/propsnd.h" -#include "game/objectives.h" -#include "game/atan2f.h" -#include "game/bondgun.h" -#include "game/game_0b0fd0.h" -#include "game/player.h" -#include "game/hudmsg.h" -#include "game/menu.h" -#include "game/filemgr.h" -#include "game/inv.h" -#include "game/explosions.h" -#include "game/game_1531a0.h" -#include "game/bg.h" -#include "game/trainingmenus.h" -#include "game/training.h" -#include "game/gamefile.h" -#include "game/lang.h" -#include "game/pad.h" -#include "game/padhalllv.h" -#include "game/propobj.h" -#include "game/shards.h" -#include "game/wallhit.h" -#include "bss.h" -#include "lib/vi.h" -#include "lib/dma.h" -#include "lib/main.h" -#include "lib/snd.h" -#include "lib/memp.h" -#include "lib/rng.h" -#include "lib/mtx.h" -#include "data.h" -#include "types.h" - -#define FRSCRIPTINDEX_WEAPONS 0x00 -#define FRSCRIPTINDEX_TARGETS 0x22 -#define FRSCRIPTINDEX_HELP 0x71 - -extern u8 *_firingrangeSegmentRomStart; -extern u8 *_firingrangeSegmentRomEnd; - -struct frdata g_FrData; -struct trainingdata g_DtData; -struct trainingdata g_HtData; - -u16 *g_FrScriptOffsets = NULL; -u8 g_FrIsValidWeapon = false; -u8 g_FrDataLoaded = false; -u8 g_FrNumSounds = 0; -u8 *g_FrRomData = NULL; - -u16 g_FrPads[] = { - 0x00d6, 0x00d7, 0x00d9, 0x00d8, 0x00da, 0x00db, 0x00dc, 0x00dd, - 0x00de, 0x00df, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, - 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00f4, 0x00f3, - 0x00f2, 0x00f1, 0x00f0, 0x00ef, 0x00ee, 0x00ed, 0x00ec, -}; - -bool ciIsTourDone(void) -{ - return gamefileHasFlag(GAMEFILEFLAG_CI_TOUR_DONE); -} - -u8 ciGetFiringRangeScore(s32 weaponindex) -{ - // Data at firingrangescores is a u8 array where each score uses 2 bits - -#if VERSION == VERSION_JPN_FINAL - if (weaponindex == frGetWeaponIndexByWeapon(WEAPON_COMBATKNIFE)) { - // The knife doesn't exist in the JPN version. - // Treat it as completed so unlockables still work. - return 3; - } -#endif - - return (g_GameFile.firingrangescores[weaponindex >> 2] >> (weaponindex % 4) * 2) & 3; -} - -void frSaveScoreIfBest(s32 weaponindex, s32 difficulty) -{ - if (ciGetFiringRangeScore(weaponindex) < difficulty) { - u32 byteindex = weaponindex >> 2; - u32 shiftamount = (weaponindex % 4) * 2; - u32 value = g_GameFile.firingrangescores[byteindex]; - u32 mask = (1 << shiftamount) + (1 << (shiftamount + 1)); - - value &= 255 - mask; - value += (difficulty << shiftamount) & mask; - - g_GameFile.firingrangescores[byteindex] = value; - } -} - -s32 func0f19ca78(u32 weaponnum) -{ - s32 slot = -1; - s32 i; - - for (i = 0; i <= WEAPON_HORIZONSCANNER; i++) { - switch (i) { - case WEAPON_FALCON2: - case WEAPON_FALCON2_SCOPE: - case WEAPON_FALCON2_SILENCER: - case WEAPON_MAGSEC4: - case WEAPON_MAULER: - case WEAPON_PHOENIX: - case WEAPON_DY357MAGNUM: - case WEAPON_DY357LX: - case WEAPON_CMP150: - case WEAPON_CYCLONE: - case WEAPON_CALLISTO: - case WEAPON_RCP120: - case WEAPON_LAPTOPGUN: - case WEAPON_DRAGON: - case WEAPON_K7AVENGER: - case WEAPON_AR34: - case WEAPON_SUPERDRAGON: - case WEAPON_SHOTGUN: - case WEAPON_SNIPERRIFLE: - case WEAPON_FARSIGHT: - case WEAPON_CROSSBOW: - case WEAPON_TRANQUILIZER: - case WEAPON_REAPER: - case WEAPON_DEVASTATOR: - case WEAPON_ROCKETLAUNCHER: - case WEAPON_SLAYER: - case WEAPON_COMBATKNIFE: - case WEAPON_LASER: - case WEAPON_GRENADE: - case WEAPON_TIMEDMINE: - case WEAPON_PROXIMITYMINE: - case WEAPON_REMOTEMINE: - slot++; - } - - if (i == weaponnum) { - return slot; - } - } - - return -1; -} - -u8 frIsWeaponFound(s32 weaponnum) -{ - u32 byteindex; - - if (weaponnum <= WEAPON_UNARMED) { - return true; - } - -#if VERSION >= VERSION_NTSC_1_0 - if (weaponnum < (s32)sizeof(g_GameFile.weaponsfound) * 8) { - byteindex = weaponnum >> 3; - return g_GameFile.weaponsfound[byteindex] & (1 << (weaponnum % 8)); - } - - return false; -#else - byteindex = weaponnum >> 3; - return g_GameFile.weaponsfound[byteindex] & (1 << (weaponnum % 8)); -#endif -} - -void frSetWeaponFound(s32 weaponnum) -{ - if (weaponnum < (s32)sizeof(g_GameFile.weaponsfound) * 8) { - u32 byteindex = weaponnum >> 3; - u32 value = g_GameFile.weaponsfound[byteindex]; - - value |= (1 << (weaponnum % 8)); - - g_GameFile.weaponsfound[byteindex] = value; - } -} - -s32 ciIsStageComplete(s32 stageindex) -{ - return g_GameFile.besttimes[stageindex][0] - || g_GameFile.besttimes[stageindex][1] - || g_GameFile.besttimes[stageindex][2]; -} - -bool func0f19cbcc(s32 weapon) -{ - if (weapon <= 0 || weapon == WEAPON_PSYCHOSISGUN) { - return false; - } - - if (weapon == WEAPON_XRAYSCANNER && ciIsStageComplete(SOLOSTAGEINDEX_INFILTRATION)) { - return true; - } - - if (weapon == WEAPON_CLOAKINGDEVICE && ciIsStageComplete(SOLOSTAGEINDEX_CHICAGO)) { - return true; - } - - return frIsWeaponFound(weapon); -} - -bool frIsWeaponAvailable(s32 weapon) -{ -#if VERSION == VERSION_JPN_FINAL - if (weapon == WEAPON_COMBATKNIFE) { - return false; - } -#endif - - if (weapon < WEAPON_FALCON2 || weapon > WEAPON_REMOTEMINE - || weapon == WEAPON_PSYCHOSISGUN - || weapon == WEAPON_COMBATBOOST - || weapon == WEAPON_NBOMB) { - return false; - } - - if (weapon == WEAPON_FALCON2 || weapon == WEAPON_CMP150) { - return true; - } - -#if VERSION < VERSION_NTSC_1_0 - if (debugIsAllTrainingEnabled() && weapon <= WEAPON_XRAYSCANNER) { - return true; - } -#endif - - return frIsWeaponFound(weapon); -} - -u32 frGetWeaponIndexByWeapon(u32 weaponnum) -{ - switch (weaponnum) { - case WEAPON_FALCON2: return 0; - case WEAPON_FALCON2_SCOPE: return 1; - case WEAPON_FALCON2_SILENCER: return 2; - case WEAPON_MAGSEC4: return 3; - case WEAPON_MAULER: return 4; - case WEAPON_PHOENIX: return 5; - case WEAPON_DY357MAGNUM: return 6; - case WEAPON_DY357LX: return 7; - case WEAPON_CMP150: return 8; - case WEAPON_CYCLONE: return 9; - case WEAPON_CALLISTO: return 10; - case WEAPON_RCP120: return 11; - case WEAPON_LAPTOPGUN: return 12; - case WEAPON_DRAGON: return 13; - case WEAPON_K7AVENGER: return 14; - case WEAPON_AR34: return 15; - case WEAPON_SUPERDRAGON: return 16; - case WEAPON_SHOTGUN: return 17; - case WEAPON_SNIPERRIFLE: return 18; - case WEAPON_FARSIGHT: return 19; - case WEAPON_CROSSBOW: return 20; - case WEAPON_TRANQUILIZER: return 21; - case WEAPON_REAPER: return 22; - case WEAPON_DEVASTATOR: return 23; - case WEAPON_ROCKETLAUNCHER: return 24; - case WEAPON_SLAYER: return 25; - case WEAPON_COMBATKNIFE: return 26; - case WEAPON_LASER: return 27; - case WEAPON_GRENADE: return 28; - case WEAPON_TIMEDMINE: return 29; - case WEAPON_PROXIMITYMINE: return 30; - case WEAPON_REMOTEMINE: return 31; - } - - return 0; -} - -u32 frGetWeaponScriptIndex(u32 weaponnum) -{ - switch (weaponnum) { - case WEAPON_FALCON2: return 1; - case WEAPON_FALCON2_SCOPE: return 2; - case WEAPON_FALCON2_SILENCER: return 3; - case WEAPON_MAGSEC4: return 4; - case WEAPON_MAULER: return 5; - case WEAPON_PHOENIX: return 6; - case WEAPON_DY357MAGNUM: return 7; - case WEAPON_DY357LX: return 8; - case WEAPON_CMP150: return 9; - case WEAPON_CYCLONE: return 10; - case WEAPON_CALLISTO: return 11; - case WEAPON_RCP120: return 12; - case WEAPON_LAPTOPGUN: return 13; - case WEAPON_DRAGON: return 14; - case WEAPON_K7AVENGER: return 15; - case WEAPON_AR34: return 16; - case WEAPON_SUPERDRAGON: return 17; - case WEAPON_SHOTGUN: return 18; - case WEAPON_SNIPERRIFLE: return 19; - case WEAPON_FARSIGHT: return 20; - case WEAPON_CROSSBOW: return 21; - case WEAPON_TRANQUILIZER: return 22; - case WEAPON_REAPER: return 23; - case WEAPON_DEVASTATOR: return 24; - case WEAPON_ROCKETLAUNCHER: return 25; - case WEAPON_SLAYER: return 26; - case WEAPON_COMBATKNIFE: return 27; - case WEAPON_LASER: return 28; - case WEAPON_GRENADE: return 29; - case WEAPON_TIMEDMINE: return 31; - case WEAPON_PROXIMITYMINE: return 32; - case WEAPON_REMOTEMINE: return 33; - } - - return 0; -} - -s32 frIsClassicWeaponUnlocked(u32 weapon) -{ - switch (weapon) { - case WEAPON_PP9I: - return ciGetFiringRangeScore(0) == 3 - && ciGetFiringRangeScore(1) == 3 - && ciGetFiringRangeScore(2) == 3; - case WEAPON_CC13: - return ciGetFiringRangeScore(3) == 3 - && ciGetFiringRangeScore(4) == 3 - && ciGetFiringRangeScore(5) == 3 - && ciGetFiringRangeScore(6) == 3 - && ciGetFiringRangeScore(7) == 3; - case WEAPON_KL01313: - return ciGetFiringRangeScore(8) == 3 - && ciGetFiringRangeScore(9) == 3 - && ciGetFiringRangeScore(10) == 3 - && ciGetFiringRangeScore(11) == 3; - case WEAPON_KF7SPECIAL: - return ciGetFiringRangeScore(12) == 3 - && ciGetFiringRangeScore(13) == 3 - && ciGetFiringRangeScore(14) == 3 - && ciGetFiringRangeScore(15) == 3 - && ciGetFiringRangeScore(16) == 3; - case WEAPON_ZZT: - return ciGetFiringRangeScore(17) == 3 - && ciGetFiringRangeScore(18) == 3 - && ciGetFiringRangeScore(24) == 3 - && ciGetFiringRangeScore(25) == 3; - case WEAPON_DMC: -#if VERSION >= VERSION_NTSC_1_0 - return ciGetFiringRangeScore(29) == 3 - && ciGetFiringRangeScore(30) == 3 - && ciGetFiringRangeScore(31) == 3; -#else - return ciGetFiringRangeScore(29) == 3 - && ciGetFiringRangeScore(30) == 3 - && ciGetFiringRangeScore(32) == 3 - && ciGetFiringRangeScore(33) == 3 - && ciGetFiringRangeScore(34) == 3; -#endif - case WEAPON_AR53: - return ciGetFiringRangeScore(19) == 3 - && ciGetFiringRangeScore(20) == 3 - && ciGetFiringRangeScore(26) == 3 - && ciGetFiringRangeScore(28) == 3; - case WEAPON_RCP45: - return ciGetFiringRangeScore(21) == 3 - && ciGetFiringRangeScore(22) == 3 - && ciGetFiringRangeScore(23) == 3; - } - - return false; -} - -s32 frGetSlot(void) -{ - return g_FrData.slot; -} - -void frSetSlot(s32 slot) -{ - g_FrData.slot = slot; -} - -u32 frGetWeaponBySlot(s32 slot) -{ - s32 index = -1; - s32 weapon; - - for (weapon = WEAPON_NONE; weapon <= WEAPON_HORIZONSCANNER; weapon++) { - if (frIsWeaponAvailable(weapon)) { - index++; - } - - if (slot == index) { - return weapon; - } - } - - return WEAPON_UNARMED; -} - -s32 frGetNumWeaponsAvailable(void) -{ - s32 count = 0; - s32 i; - - for (i = WEAPON_UNARMED; i <= WEAPON_HORIZONSCANNER; i++) { - if (frIsWeaponAvailable(i)) { - count++; - } - } - - return count; -} - -void frInitLighting(void) -{ - if (g_FrData.donelighting == false) { - s32 roomnum; - - for (roomnum = 7; roomnum < 10; roomnum++) { - roomSetLighting(roomnum, LIGHTOP_3, 50, 100, TICKS(32)); - } - - roomSetLighting(ROOM_DISH_FIRINGRANGE, LIGHTOP_3, 25, 100, TICKS(32)); - - g_FrData.donelighting = true; - - sndStart(var80095200, SFX_FR_LIGHTSON, NULL, -1, -1, -1, -1, -1); - } - - chrSetStageFlag(NULL, STAGEFLAG_CI_IN_TRAINING); -} - -void frRestoreLighting(void) -{ - if (g_FrData.donelighting == true) { - s32 roomnum; - - for (roomnum = 7; roomnum < 10; roomnum++) { - roomSetLighting(roomnum, LIGHTOP_3, 100, 50, TICKS(8)); - } - - roomSetLighting(ROOM_DISH_FIRINGRANGE, LIGHTOP_3, 100, 25, TICKS(8)); - - g_FrData.donelighting = false; - - sndStart(var80095200, SFX_FR_LIGHTSOFF, NULL, -1, -1, -1, -1, -1); - } -} - -void frReset(void) -{ - s32 i; - -#if VERSION >= VERSION_NTSC_1_0 - g_FrScriptOffsets = NULL; -#endif - - g_FrDataLoaded = false; - g_FrIsValidWeapon = false; - g_FrRomData = NULL; - - g_FrData.helpscriptindex = 0; - g_FrData.helpscriptoffset = 0; - g_FrData.helpscriptenabled = false; - g_FrData.helpscriptsleep = 0; - -#if VERSION >= VERSION_NTSC_1_0 - g_FrData.menucountdown = 0; - g_FrData.maxactivetargets = 0; - - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - g_FrData.targets[i].prop = NULL; - g_FrData.targets[i].inuse = false; - } - - g_FrNumSounds = 0; -#endif -} - -void *frLoadRomData(u32 len) -{ - g_FrRomData = mempAlloc(ALIGN16(len), MEMPOOL_STAGE); - - if (g_FrRomData) { - return dmaExecWithAutoAlign(g_FrRomData, (u32)&_firingrangeSegmentRomStart, len); - } - - return NULL; -} - -void frSetDifficulty(s32 difficulty) -{ - if (difficulty < FRDIFFICULTY_BRONZE) { - difficulty = FRDIFFICULTY_BRONZE; - } - - if (difficulty > FRDIFFICULTY_GOLD) { - difficulty = FRDIFFICULTY_GOLD; - } - - g_FrData.difficulty = difficulty; -} - -u32 frGetDifficulty(void) -{ - return g_FrData.difficulty; -} - -void frInitDefaults(void) -{ - s32 i; - struct pad pad; - - g_FrNumSounds = 0; - - padUnpack(g_FrPads[0], PADFIELD_POS, &pad); - - g_FrData.maxactivetargets = 0; - g_FrData.goalscore = 0; - g_FrData.timelimit = 200; - g_FrData.ammolimit = 255; - g_FrData.sdgrenadelimit = 255; - g_FrData.goalaccuracy = 0; - g_FrData.goaltargets = 255; - g_FrData.speed = 1; - - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - g_FrData.targets[i].dstpos.x = pad.pos.x; - g_FrData.targets[i].dstpos.y = pad.pos.y; - g_FrData.targets[i].dstpos.z = pad.pos.z; - -#if VERSION >= VERSION_NTSC_1_0 - g_FrData.targets[i].dstpos.z += 6.0f * i; -#endif - - g_FrData.targets[i].inuse = false; - g_FrData.targets[i].rotateoncloak = false; - g_FrData.targets[i].destroyed = false; - g_FrData.targets[i].damage = 0; - g_FrData.targets[i].scriptoffset = 0; - - g_FrData.targets[i].travelspeed = 0; - g_FrData.targets[i].scriptsleep = SECSTOTIME60(255); - g_FrData.targets[i].timeuntilrotate = 0; - - g_FrData.targets[i].rotating = false; - g_FrData.targets[i].rotatespeed = 0; - g_FrData.targets[i].angle = 0; - g_FrData.targets[i].rotatetoangle = 0; - g_FrData.targets[i].silent = 0; - g_FrData.targets[i].donestopsound = false; - g_FrData.targets[i].travelling = false; - g_FrData.targets[i].invincibletimer = 0; - g_FrData.targets[i].frpadnum = -1; - - wallhitsFreeByProp(g_FrData.targets[i].prop, 0); - wallhitsFreeByProp(g_FrData.targets[i].prop, 1); - } - - g_FrData.timetaken = TICKS(-240); - g_FrData.score = 0; - g_FrData.numtargets = 0; - g_FrData.targetsdestroyed = 0; - g_FrData.menucountdown = 0; - g_FrData.padindexoffset = 0; - g_FrData.feedbackzone = 0; - g_FrData.feedbackttl = 0; - g_FrData.failreason = 0; - g_FrData.numshots = 0; - g_FrData.numhitsring3 = 0; - g_FrData.numhitsring2 = 0; - g_FrData.numhitsring1 = 0; - g_FrData.numhitsbullseye = 0; - g_FrData.helpscriptindex = 0; - g_FrData.helpscriptoffset = 0; - g_FrData.helpscriptenabled = false; - g_FrData.helpscriptsleep = 0; - g_FrData.proxyendtimer = 0; - g_FrData.donealarm = false; - g_FrData.ammohasgrace = true; - g_FrData.ammoextra = -1; -} - -struct frdata *frGetData(void) -{ - return &g_FrData; -} - -u32 frResolveFrPad(u32 arg0) -{ - switch (arg0) { - case 31: return random() % 9 + 4; // 4 - 12 - case 32: return random() % 9 + 13; // 13 - 21 - case 33: return random() % 9 + 22; // 22 - 30 - case 34: return random() % 27 + 4; // 4 - 30 - } - - return g_FrData.padindexoffset + arg0; -} - -bool frIsDifficulty(u32 flags) -{ - if (g_FrData.difficulty == FRDIFFICULTY_BRONZE) { - if ((flags & FRTARGETFLAG_BRONZE) == 0) { - return false; - } - } else if (g_FrData.difficulty == FRDIFFICULTY_SILVER) { - if ((flags & FRTARGETFLAG_SILVER) == 0) { - return false; - } - } else if (g_FrData.difficulty == FRDIFFICULTY_GOLD) { - if ((flags & FRTARGETFLAG_GOLD) == 0) { - return false; - } - } - - return true; -} - -void frExecuteWeaponScript(s32 scriptindex) -{ - s32 offset = 0; - - if (scriptindex >= FRSCRIPTINDEX_WEAPONS && scriptindex < FRSCRIPTINDEX_TARGETS) { - u8 *script = &g_FrRomData[g_FrScriptOffsets[scriptindex]]; - u8 mult = 1; - u32 stack[5]; - s32 start; - s32 capacity; - s32 index; - u8 *subscript; - s32 i; - s32 val; - - while (script[offset] != FRCMD_END) { - switch (script[offset]) { - case FRCMD_SETPADINDEXOFFSET: - g_FrData.padindexoffset = script[offset + 1]; - offset += 2; - break; - case FRCMD_ADDTARGET: - if (!frIsDifficulty(script[offset + 4])) { - offset += 5; - break; - } - if (g_FrData.numtargets < ARRAYCOUNT(g_FrData.targets)) { - g_FrData.targets[g_FrData.numtargets].frpadindex = frResolveFrPad(script[offset + 1]); - g_FrData.targets[g_FrData.numtargets].scriptindex = script[offset + 2]; - g_FrData.targets[g_FrData.numtargets].maxdamage = script[offset + 3]; - g_FrData.targets[g_FrData.numtargets].inuse = true; - g_FrData.targets[g_FrData.numtargets].flags = script[offset + 4]; - - if (g_FrData.targets[g_FrData.numtargets].flags & FRTARGETFLAG_ROTATEONCLOAK) { - g_FrData.targets[g_FrData.numtargets].rotateoncloak = true; - } - - if (g_FrData.targets[g_FrData.numtargets].flags & FRTARGETFLAG_ONEHITEXPLODE) { - g_FrData.targets[g_FrData.numtargets].maxdamage = 1; - } - - g_FrData.numtargets++; - } - offset += 5; - break; - case FRCMD_SETMAXACTIVETARGETS: - g_FrData.maxactivetargets = script[g_FrData.difficulty + offset + 1]; - offset += 4; - break; - case FRCMD_SETSCOREMULTIPLIER: - if (script[g_FrData.difficulty + offset + 1] > 0) { - mult = script[g_FrData.difficulty + offset + 1]; - } else { - mult = 1; - } - offset += 4; - break; - case FRCMD_SETGOALSCORE: - g_FrData.goalscore = script[g_FrData.difficulty + offset + 1] * mult; - offset += 4; - break; - case FRCMD_SETTIMELIMIT: - g_FrData.timelimit = script[g_FrData.difficulty + offset + 1]; - if (g_FrData.timelimit == 255) { - g_FrData.timelimit = 120; - } - offset += 4; - break; - case FRCMD_SETAMMOLIMIT: - capacity = bgunGetCapacityByAmmotype(bgunGetAmmoTypeForWeapon(frGetWeaponBySlot(g_FrData.slot), 0)); - g_FrData.ammolimit = script[g_FrData.difficulty + offset + 1]; - - if (g_FrData.ammolimit != 255) { - if (g_FrData.ammolimit > capacity) { - g_FrData.ammoextra = g_FrData.ammolimit - capacity; - } else { - g_FrData.ammoextra = 0; - } - } - - offset += 4; - break; - case FRCMD_SETGRENADELIMIT: - capacity = bgunGetCapacityByAmmotype(AMMOTYPE_DEVASTATOR); - g_FrData.sdgrenadelimit = script[g_FrData.difficulty + offset + 1]; - - if (g_FrData.sdgrenadelimit != 255) { - if (g_FrData.sdgrenadelimit > capacity) { - g_FrData.sdgrenadeextra = g_FrData.sdgrenadelimit - capacity; - } else { - g_FrData.sdgrenadeextra = 0; - } - } - - offset += 4; - break; - case FRCMD_SETEXTRASPEED: - g_FrData.speed = script[g_FrData.difficulty + offset + 1] * 0.1f + 1.0f; - offset += 4; - break; - case FRCMD_SETGOALACCURACY: - g_FrData.goalaccuracy = script[g_FrData.difficulty + offset + 1]; - offset += 4; - break; - case FRCMD_SETGOALTARGETS: - g_FrData.goaltargets = script[g_FrData.difficulty + offset + 1]; - offset += 4; - break; - case FRCMD_SETHELPSCRIPT: - g_FrData.helpscriptindex = script[offset + 1]; - g_FrData.helpscriptenabled = true; - index = FRSCRIPTINDEX_HELP + g_FrData.helpscriptindex; - if (&g_FrRomData[g_FrScriptOffsets[index]]); - subscript = &g_FrRomData[g_FrScriptOffsets[index]]; - offset += 2; - - if (g_FrData.difficulty == FRDIFFICULTY_BRONZE) { - start = FRCMD_IFBRONZE; - } else if (g_FrData.difficulty == FRDIFFICULTY_SILVER) { - start = FRCMD_IFSILVER; - } else if (g_FrData.difficulty == FRDIFFICULTY_GOLD) { - start = FRCMD_IFGOLD; - } - - g_FrData.helpscriptoffset = 0; - i = 0; - - while (1) { - g_FrData.helpscriptoffset++; - - if (subscript[i] == start) { - i++; - - val = subscript[i]; - - if (val >= FRCMD_IFBRONZE) { - g_FrData.helpscriptoffset++; - val = subscript[i + 1]; - } - - if (val >= FRCMD_IFBRONZE) { - g_FrData.helpscriptoffset++; - } - break; - } - - i++; - } - break; - } - } - } -} - -void frSetTargetProps(void) -{ - s32 i; - u32 targets[] = { - 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x11, - 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, - }; - - for (i = 0; i < ARRAYCOUNT(targets); i++) { - struct defaultobj *obj = objFindByTagId(targets[i]); - - if (obj) { - g_FrData.targets[i].prop = obj->prop; - obj->flags2 |= OBJFLAG2_INVISIBLE; - } - } -} - -s32 g_FrWeaponNum = WEAPON_UNARMED; - -bool frTargetIsAtScriptStart(s32 targetnum) -{ - return g_FrData.targets[targetnum].scriptoffset == 0; -} - -/** - * 0 => "FIRING\n Press Z Button to fire gun.\n" - * 1 => "AUTO RELOAD\n Release Z Button when out of ammo.\n" - * 2 => "MANUAL RELOAD\n Press B Button to reload early if magazine not full.\n" - * 3 => "Aiming: Hold down R Button to enter Aim mode.\n" - * 4 => "Use Control Stick to move aiming sight.\n" - * 5 => "AUTO FIRE\n Hold Z Button to repeatedly fire automatically.\n" - * 6 => "ALTER AIM\n Press Up C Button or Down C Button to move sight up/down.\n" - * 7 => "ZOOM\n Hold R Button to enter Zoom mode.\n" - * 8 => "FAST FIRE\n Press Z Button quickly to fire faster.\n" - */ -char *frGetInstructionalText(u32 index) -{ - u16 textid = (u16)(g_FrRomData[index * 2] << 8) | g_FrRomData[index * 2 + 1]; - - return langGet(textid); -} - -void frExecuteHelpScript(void) -{ - if (!g_FrData.helpscriptenabled || g_Vars.lvupdate240 == 0) { - return; - } - - if (g_FrData.helpscriptsleep == 0) { - s32 index = FRSCRIPTINDEX_HELP + g_FrData.helpscriptindex; - u8 *script = &g_FrRomData[g_FrScriptOffsets[index]]; - u32 offset = g_FrData.helpscriptoffset; - - switch (script[offset]) { - case FRCMD_END: - case FRCMD_IFBRONZE: - case FRCMD_IFSILVER: - case FRCMD_IFGOLD: - g_FrData.helpscriptenabled = false; - break; - case FRCMD_HUDMSG: - hudmsgCreate(frGetInstructionalText(script[offset + 1]), HUDMSGTYPE_TRAINING); - g_FrData.helpscriptoffset += 2; - break; - case FRCMD_HELPWAITSECONDS: -#if PAL - g_FrData.helpscriptsleep = script[offset + 1] * 50; -#else - g_FrData.helpscriptsleep = SECSTOTIME60(script[offset + 1]); -#endif - g_FrData.helpscriptoffset += 2; - break; - case FRCMD_WAITUNTILSHOOT: - if (g_FrData.numshots) { - g_FrData.helpscriptoffset++; - } - break; - } - } else { - g_FrData.helpscriptsleep -= g_Vars.lvupdate60; - - if (g_FrData.helpscriptsleep <= 0) { - g_FrData.helpscriptsleep = 0; - } - } -} - -bool frExecuteTargetScript(s32 targetnum) -{ - if (g_FrData.targets[targetnum].inuse) { - s32 index = FRSCRIPTINDEX_TARGETS + g_FrData.targets[targetnum].scriptindex; - u8 *script = &g_FrRomData[g_FrScriptOffsets[index]]; - s32 offset = g_FrData.targets[targetnum].scriptoffset; - struct pad pad; - s32 frpadnum; - - switch (script[offset]) { - case FRCMD_END: - g_FrData.targets[targetnum].scriptenabled = true; - g_FrData.targets[targetnum].scriptsleep = 255 * 60; - return true; - case FRCMD_GOTOPAD: - frpadnum = frResolveFrPad(script[offset + 1]); - - if (frpadnum == g_FrData.targets[targetnum].frpadnum) { - g_FrData.targets[targetnum].scriptoffset += 4; - return false; - } - - g_FrData.targets[targetnum].frpadnum = frpadnum; - - padUnpack(g_FrPads[frpadnum], PADFIELD_POS, &pad); - - g_FrData.targets[targetnum].dstpos.x = pad.pos.x; - g_FrData.targets[targetnum].dstpos.y = pad.pos.y; - g_FrData.targets[targetnum].dstpos.z = pad.pos.z; - -#if VERSION >= VERSION_NTSC_1_0 - g_FrData.targets[targetnum].dstpos.z += 6.0f * targetnum; -#endif - - if (script[offset + 2] == 0xff) { - g_FrData.targets[targetnum].travelspeed = -1; - g_FrData.targets[targetnum].travelling = true; - } else { - if (g_FrNumSounds < 3) { - g_FrNumSounds++; - propsnd0f0939f8(NULL, g_FrData.targets[targetnum].prop, SFX_FR_CONVEYER, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); - } - - g_FrData.targets[targetnum].travelspeed = script[offset + 2] / 60.0f * g_FrData.speed; - g_FrData.targets[targetnum].travelling = true; - } - - g_FrData.targets[targetnum].scriptsleep = script[offset + 3] * TICKS(60); - g_FrData.targets[targetnum].donestopsound = false; - g_FrData.targets[targetnum].scriptoffset += 4; - return true; - case FRCMD_RESTART: - g_FrData.targets[targetnum].scriptoffset = 0; - return true; - case FRCMD_WAITSECONDS: - g_FrData.targets[targetnum].scriptenabled = true; - g_FrData.targets[targetnum].scriptsleep = script[offset + 1] * TICKS(60); - g_FrData.targets[targetnum].scriptoffset += 2; - return true; - case FRCMD_ROTATE: - if (g_FrData.targets[targetnum].rotateoncloak == false) { - f32 angles[4]; - angles[0] = DEG2RAD(-90); - angles[1] = DEG2RAD(-180); - angles[2] = DEG2RAD(90); - angles[3] = DEG2RAD(180); - - g_FrData.targets[targetnum].rotatetoangle = g_FrData.targets[targetnum].angle + angles[script[offset + 1]]; - g_FrData.targets[targetnum].rotatespeed = angles[script[offset + 1]] / (script[offset + 2] * 15); - g_FrData.targets[targetnum].rotating = true; - g_FrData.targets[targetnum].scriptenabled = false; - } - - if (1); - g_FrData.targets[targetnum].scriptoffset += 3; - return true; - } - } - - return true; -} - -void frHideAllTargets(void) -{ - s32 i; - - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - struct prop *prop = g_FrData.targets[i].prop; - struct defaultobj *target = prop->obj; - - target->flags2 |= OBJFLAG2_INVISIBLE; - - func0f0926bc(prop, 1, 0xffff); - } -} - -void frInitTargets(void) -{ - s32 count = 0; - s32 i; - struct prop *prop; - struct defaultobj *obj; - struct pad pad; - struct coord pos; - Mtxf sp144; - f32 sp108[3][3]; - - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - prop = g_FrData.targets[i].prop; - -#if VERSION >= VERSION_NTSC_1_0 - if (prop) -#endif - { - obj = prop->obj; - - objFree(obj, false, true); - - obj->damage = 0; - prop->timetoregen = 0; - - if (g_FrData.targets[i].inuse) { - g_FrData.targets[i].scriptenabled = false; - g_FrData.targets[i].destroyed = false; - - if (count < g_FrData.maxactivetargets) { - obj->flags2 &= ~OBJFLAG2_INVISIBLE; - g_FrData.targets[i].active = true; - } else { - obj->flags2 |= OBJFLAG2_INVISIBLE; - g_FrData.targets[i].active = false; - } - - padUnpack(g_FrPads[g_FrData.targets[i].frpadindex], PADFIELD_POS, &pad); - - pos.f[0] = pad.pos.f[0]; - pos.f[1] = pad.pos.f[1]; -#if VERSION >= VERSION_NTSC_1_0 - pos.f[2] = pad.pos.f[2] + 6.0f * i; -#else - pos.f[2] = pad.pos.f[2]; -#endif - - frExecuteTargetScript(i); - - if (g_FrData.targets[i].travelspeed == -1) { - pos.x = g_FrData.targets[i].dstpos.x; - pos.y = g_FrData.targets[i].dstpos.y; - pos.z = g_FrData.targets[i].dstpos.z; - } - - count++; - } else { - obj->flags2 |= OBJFLAG2_INVISIBLE; - } - - if (obj->flags2 & OBJFLAG2_INVISIBLE) { -#if VERSION < VERSION_NTSC_1_0 - padUnpack(g_FrPads[g_FrData.targets[i].frpadindex], PADFIELD_POS, &pad); - - pos.x = 0.0f; - pos.y = 5000.0f; - pos.z = 0.0f; -#else - pos.x = 0.0f; - pos.y = 5000.0f; - pos.z = 6.0f * i; -#endif - } - - if (g_FrData.targets[i].flags & FRTARGETFLAG_SPAWNFACINGAWAY) { - mtx4LoadYRotation(0.0f, &sp144); - g_FrData.targets[i].angle = M_PI; - } else { - mtx4LoadYRotation(M_PI, &sp144); - } - - mtx00015f04(obj->model->scale, &sp144); - mtx4ToMtx3(&sp144, sp108); - mtx3Copy(sp108, obj->realrot); - - prop->pos.x = pos.x; - prop->pos.y = pos.y; - prop->pos.z = pos.z; - - func0f069c70(obj, true, false); - } - } -} - -void frCloseAndLockDoor(void) -{ - struct defaultobj *obj = objFindByTagId(0x91); - - if (obj && obj->prop && obj->prop->type == PROPTYPE_DOOR) { - struct doorobj *door = (struct doorobj *)obj; - door->keyflags |= 0x40; - doorsRequestMode(door, DOORMODE_CLOSING); - } -} - -void frUnlockDoor(void) -{ - struct defaultobj *obj = objFindByTagId(0x91); - - if (obj && obj->prop && obj->prop->type == PROPTYPE_DOOR) { - struct doorobj *door = (struct doorobj *)obj; - door->keyflags &= ~0x40; - } -} - -void frLoadData(void) -{ - if (!g_FrDataLoaded) { - s32 len = (s32)&_firingrangeSegmentRomEnd - (s32)&_firingrangeSegmentRomStart; - s32 index = 0; - u32 i; - u32 numscripts = 1; - s32 size; - - if (index); - - g_FrDataLoaded = true; - - frLoadRomData(len); - - for (i = 0x12; i < len; i++) { - if (g_FrRomData[i] == FRCMD_START) { - numscripts++; - } - } - - size = numscripts * sizeof(*g_FrScriptOffsets); - g_FrScriptOffsets = mempAlloc(ALIGN16(size), MEMPOOL_STAGE); - - if (numscripts < 0); - - if (g_FrScriptOffsets) { - for (i = 0x12; i < len; i++) { - if (g_FrRomData[i] == FRCMD_START) { - g_FrScriptOffsets[index] = i + 1; - index++; - } - } - } - - frSetTargetProps(); - - g_FrData.slot = 0; - g_FrData.difficulty = FRDIFFICULTY_BRONZE; - g_FrData.donelighting = false; - } -} - -u32 frInitAmmo(s32 weaponnum) -{ - u32 scriptindex; - u32 ammotype = bgunGetAmmoTypeForWeapon(weaponnum, 0); - u32 capacity = bgunGetCapacityByAmmotype(ammotype); - - frInitDefaults(); - scriptindex = frGetWeaponScriptIndex(weaponnum); - frExecuteWeaponScript(scriptindex); - - if (g_FrData.ammolimit == 255) { - bgunSetAmmoQuantity(ammotype, capacity); - } else { - bgunSetAmmoQuantity(ammotype, g_FrData.ammolimit); - } - - if (weaponnum == WEAPON_SUPERDRAGON) { - if (g_FrData.sdgrenadelimit == 255) { - bgunSetAmmoQuantity(AMMOTYPE_DEVASTATOR, capacity); - } else { - bgunSetAmmoQuantity(AMMOTYPE_DEVASTATOR, g_FrData.sdgrenadelimit); - } - } - - return scriptindex; -} - -void frBeginSession(s32 weapon) -{ - s32 i; - struct defaultobj *obj = objFindByTagId(0x7f); // computer - - if (obj) { - obj->flags |= OBJFLAG_CANNOT_ACTIVATE; - } - - frCloseAndLockDoor(); - - for (i = 0; i < 2; i++) { - if (g_Vars.currentplayer->gunctrl.ammotypes[i] >= 0) { - g_Vars.currentplayer->hands[0].loadedammo[i] = 0; - g_Vars.currentplayer->hands[1].loadedammo[i] = 0; - } - } - - g_FrIsValidWeapon = frInitAmmo(weapon) == 0 ? false : true; - frInitTargets(); - bgunSetPassiveMode(false); -} - -char *frGetWeaponDescription(void) -{ - u32 weapon = frGetWeaponBySlot(g_FrData.slot); - - switch (weapon) { -#if VERSION >= VERSION_PAL_BETA - case WEAPON_FALCON2: return langGet(L_DISH_283); - case WEAPON_FALCON2_SCOPE: return langGet(L_DISH_284); - case WEAPON_FALCON2_SILENCER: return langGet(L_DISH_285); - case WEAPON_MAGSEC4: return langGet(L_DISH_286); - case WEAPON_MAULER: return langGet(L_DISH_287); - case WEAPON_PHOENIX: return langGet(L_DISH_288); - case WEAPON_DY357MAGNUM: return langGet(L_DISH_289); - case WEAPON_DY357LX: return langGet(L_DISH_290); - case WEAPON_CMP150: return langGet(L_DISH_291); - case WEAPON_CYCLONE: return langGet(L_DISH_292); - case WEAPON_CALLISTO: return langGet(L_DISH_293); - case WEAPON_RCP120: return langGet(L_DISH_294); - case WEAPON_LAPTOPGUN: return langGet(L_DISH_295); - case WEAPON_DRAGON: return langGet(L_DISH_296); - case WEAPON_K7AVENGER: return langGet(L_DISH_297); - case WEAPON_AR34: return langGet(L_DISH_298); - case WEAPON_SUPERDRAGON: return langGet(L_DISH_299); - case WEAPON_SHOTGUN: return langGet(L_DISH_300); - case WEAPON_SNIPERRIFLE: return langGet(L_DISH_301); - case WEAPON_FARSIGHT: return langGet(L_DISH_302); - case WEAPON_CROSSBOW: return langGet(L_DISH_303); - case WEAPON_TRANQUILIZER: return langGet(L_DISH_304); - case WEAPON_REAPER: return langGet(L_DISH_305); - case WEAPON_DEVASTATOR: return langGet(L_DISH_306); - case WEAPON_ROCKETLAUNCHER: return langGet(L_DISH_307); - case WEAPON_SLAYER: return langGet(L_DISH_308); - case WEAPON_COMBATKNIFE: return langGet(L_DISH_309); - case WEAPON_LASER: return langGet(L_DISH_310); - case WEAPON_GRENADE: return langGet(L_DISH_311); - case WEAPON_NBOMB: return langGet(L_DISH_312); - case WEAPON_TIMEDMINE: return langGet(L_DISH_313); - case WEAPON_PROXIMITYMINE: return langGet(L_DISH_314); - case WEAPON_REMOTEMINE: return langGet(L_DISH_315); -#else - case WEAPON_FALCON2: return langGet(L_MISC_377); - case WEAPON_FALCON2_SCOPE: return langGet(L_MISC_378); - case WEAPON_FALCON2_SILENCER: return langGet(L_MISC_379); - case WEAPON_MAGSEC4: return langGet(L_MISC_380); - case WEAPON_MAULER: return langGet(L_MISC_381); - case WEAPON_PHOENIX: return langGet(L_MISC_382); - case WEAPON_DY357MAGNUM: return langGet(L_MISC_383); - case WEAPON_DY357LX: return langGet(L_MISC_384); - case WEAPON_CMP150: return langGet(L_MISC_385); - case WEAPON_CYCLONE: return langGet(L_MISC_386); - case WEAPON_CALLISTO: return langGet(L_MISC_387); - case WEAPON_RCP120: return langGet(L_MISC_388); - case WEAPON_LAPTOPGUN: return langGet(L_MISC_389); - case WEAPON_DRAGON: return langGet(L_MISC_390); - case WEAPON_K7AVENGER: return langGet(L_MISC_391); - case WEAPON_AR34: return langGet(L_MISC_392); - case WEAPON_SUPERDRAGON: return langGet(L_MISC_393); - case WEAPON_SHOTGUN: return langGet(L_MISC_394); - case WEAPON_SNIPERRIFLE: return langGet(L_MISC_395); - case WEAPON_FARSIGHT: return langGet(L_MISC_396); - case WEAPON_CROSSBOW: return langGet(L_MISC_397); - case WEAPON_TRANQUILIZER: return langGet(L_MISC_398); - case WEAPON_REAPER: return langGet(L_MISC_399); - case WEAPON_DEVASTATOR: return langGet(L_MISC_400); - case WEAPON_ROCKETLAUNCHER: return langGet(L_MISC_401); - case WEAPON_SLAYER: return langGet(L_MISC_402); - case WEAPON_COMBATKNIFE: return langGet(L_MISC_403); - case WEAPON_LASER: return langGet(L_MISC_404); - case WEAPON_GRENADE: return langGet(L_MISC_405); - case WEAPON_NBOMB: return langGet(L_MISC_406); - case WEAPON_TIMEDMINE: return langGet(L_MISC_407); - case WEAPON_PROXIMITYMINE: return langGet(L_MISC_408); - case WEAPON_REMOTEMINE: return langGet(L_MISC_409); -#endif - } - - return NULL; -} - -void frEndSession(bool hidetargets) -{ - s32 i; - s32 j; - s16 propnums[256]; - s16 *propnumptr; - s16 rooms[20]; - u32 stack1; - s16 rooms2[10]; - u32 stack2; - - if (g_FrDataLoaded) { - struct defaultobj *terminal = objFindByTagId(0x7f); - - if (terminal) { - terminal->flags &= ~OBJFLAG_CANNOT_ACTIVATE; - } - - frUnlockDoor(); - - if (g_Vars.currentplayer->visionmode == VISIONMODE_SLAYERROCKET) { - g_Vars.currentplayer->visionmode = VISIONMODE_NORMAL; - } - - bgunSetPassiveMode(true); - - g_FrIsValidWeapon = 0; - - frRestoreLighting(); - - if (hidetargets) { - frHideAllTargets(); - } - - if (g_ThrownLaptops[0].base.prop) { - objFreePermanently(&g_ThrownLaptops[0].base, true); - } - - roomsCopy(g_Vars.currentplayer->prop->rooms, rooms); - - for (i = 0; g_Vars.currentplayer->prop->rooms[i] != -1; i++) { - roomGetNeighbours(g_Vars.currentplayer->prop->rooms[i], rooms2, 10); - roomsAppend(rooms2, rooms, 20); - } - - // Remove projectiles and throwables - roomGetProps(rooms, propnums, 256); - - propnumptr = propnums; - - while (*propnumptr >= 0) { - struct prop *prop = &g_Vars.props[*propnumptr]; - - if (prop) { - struct defaultobj *obj = prop->obj; - - if (prop->type == PROPTYPE_WEAPON) { - if (obj->type == OBJTYPE_AUTOGUN) { - objFreePermanently(obj, true); - } - - if (obj->type == OBJTYPE_WEAPON) { - struct weaponobj *weapon = (struct weaponobj *)obj; - - if (weapon->weaponnum == WEAPON_NBOMB - || weapon->weaponnum == WEAPON_BOLT - || weapon->weaponnum == WEAPON_COMBATKNIFE - || weapon->weaponnum == WEAPON_HOMINGROCKET - || weapon->weaponnum == WEAPON_GRENADE - || weapon->weaponnum == WEAPON_GRENADEROUND - || weapon->weaponnum == WEAPON_PROXIMITYMINE - || weapon->weaponnum == WEAPON_REMOTEMINE - || weapon->weaponnum == WEAPON_ROCKET - || weapon->weaponnum == WEAPON_TIMEDMINE - || weapon->weaponnum == WEAPON_SKROCKET - || (weapon->weaponnum == WEAPON_DRAGON && weapon->gunfunc == FUNC_SECONDARY) - || (weapon->weaponnum == WEAPON_LAPTOPGUN && weapon->gunfunc == FUNC_SECONDARY)) { - objFreePermanently(obj, true); - } - } - } - } - - propnumptr++; - } - - // Remove explosions - for (i = 0; i < g_MaxExplosions; i++) { - g_Explosions[i].age = 256; - - for (j = 0; j < 40; j++) { - g_Explosions[i].parts[j].frame = 0; - } - } - - // Remove smoke - for (i = 0; i < g_MaxSmokes; i++) { - g_Smokes[i].age = 256; - - for (j = 0; j < 10; j++) { - g_Smokes[i].parts[j].size = 0; - } - } - } - - playerDisplayHealth(); - - g_Vars.currentplayer->bondhealth = 1; -} - -bool frWasTooInaccurate(void) -{ - f32 sum = (g_FrData.numhitsring3 + - + g_FrData.numhitsbullseye - + g_FrData.numhitsring1 - + g_FrData.numhitsring2) * 100.0f; - - if (g_FrData.numshots) { - f32 accuracy = sum / g_FrData.numshots; - - if (accuracy < g_FrData.goalaccuracy) { - return true; - } - } - - return false; -} - -void frSetFailReason(s32 failreason) -{ - frEndSession(false); - - g_FrData.failreason = frWasTooInaccurate() ? FRFAILREASON_INACCURATE : failreason; - g_FrData.menutype = FRMENUTYPE_FAILED; - g_FrData.menucountdown = TICKS(60); -} - -void frSetCompleted(void) -{ - frEndSession(false); - - if (frWasTooInaccurate()) { - g_FrData.failreason = FRFAILREASON_INACCURATE; - g_FrData.menutype = FRMENUTYPE_FAILED; - } else { - u32 frweaponindex = frGetWeaponIndexByWeapon(frGetWeaponBySlot(g_FrData.slot)); - frSaveScoreIfBest(frweaponindex, g_FrData.difficulty + 1); - g_FrData.menutype = FRMENUTYPE_COMPLETED; - } - - g_FrData.menucountdown = TICKS(60); -} - -bool frIsTargetOneHitExplodable(struct prop *prop) -{ - s32 i; - - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].inuse - && g_FrData.targets[i].destroyed == false - && g_FrData.targets[i].active - && prop == g_FrData.targets[i].prop) { - if (g_FrData.targets[i].flags & FRTARGETFLAG_ONEHITEXPLODE) { - return true; - } - - return false; - } - } - - return false; -} - -f32 frGetTargetAngleToPos(struct coord *targetpos, f32 targetangle, struct coord *pos) -{ - f32 xdiff = targetpos->x - pos->x; - f32 zdiff = targetpos->z - pos->z; - f32 directangle = atan2f(xdiff, zdiff); - f32 relativeangle = directangle - targetangle; - - if (directangle < targetangle) { - relativeangle += M_BADTAU; - } - - return relativeangle; -} - -bool frIsTargetFacingPos(struct prop *prop, struct coord *pos) -{ - s32 i; - - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (prop == g_FrData.targets[i].prop) { - f32 angle; - - if (g_FrData.targets[i].destroyed) { - return false; - } - - angle = frGetTargetAngleToPos(&prop->pos, g_FrData.targets[i].angle, pos); - - //if (angle > DEG2RAD(90) && angle < DEG2RAD(270)) { - if (angle > 1.5707963705063f && angle < 4.7116389274597f) { - return false; - } - - return true; - } - } - - return true; -} - -struct prop *frChooseAutogunTarget(struct coord *autogunpos) -{ - f32 closestdist = 0x20000000; - s32 facingtargets[ARRAYCOUNT(g_FrData.targets)]; - s32 len = 0; - struct prop *closesttarget = NULL; - s32 i; - - // Make list of targets which are facing the laptop gun - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].inuse - && g_FrData.targets[i].destroyed == false - && g_FrData.targets[i].active) { - f32 angle = frGetTargetAngleToPos(&g_FrData.targets[i].prop->pos, g_FrData.targets[i].angle, autogunpos); - - if (!(angle > 1.5707963705063f && angle < 4.7116389274597f)) { - facingtargets[len++] = i; - } - } - } - - // Determine which of the facing targets is closest - for (i = 0; i < len; i++) { - struct prop *prop = g_FrData.targets[facingtargets[i]].prop; - f32 xdiff = prop->pos.f[0] - autogunpos->f[0]; - f32 ydiff = prop->pos.f[1] - autogunpos->f[1]; - f32 zdiff = prop->pos.f[2] - autogunpos->f[2]; - f32 dist = xdiff * xdiff + ydiff * ydiff + zdiff * zdiff; - - if (dist < closestdist) { - closestdist = dist; - closesttarget = prop; - } - } - - if (facingtargets); - - return closesttarget; -} - -bool frIsAmmoWasted(void) -{ - s32 weaponnum = frGetWeaponBySlot(g_FrData.slot); - s32 i; - s32 priammotype = bgunGetAmmoTypeForWeapon(weaponnum, 0); - s32 secammotype = bgunGetAmmoTypeForWeapon(weaponnum, 1); - struct hand *hand0 = &g_Vars.currentplayer->hands[0]; - struct hand *hand1 = &g_Vars.currentplayer->hands[1]; - s32 ammoloaded[2]; - s32 ammototal[2]; - s16 *propnumptr; - s16 propnums[258]; - s16 rooms20[22]; - s16 rooms10[12]; - u32 stack[4]; - s32 ammotype; - struct hand *hand; - struct prop *prop; - struct prop *child; - - // Laser has unlimited ammo - if (weaponnum == WEAPON_LASER) { - return false; - } - - // Check if player has ammo - ammoloaded[0] = hand0->loadedammo[0] + hand1->loadedammo[0]; - ammoloaded[1] = hand0->loadedammo[1] + hand1->loadedammo[1]; - ammototal[0] = bgunGetReservedAmmoCount(priammotype) + ammoloaded[0]; - ammototal[1] = bgunGetReservedAmmoCount(secammotype) + ammoloaded[1]; - - if (ammototal[0] <= 0 && ammototal[1] <= 0) { - // Don't do any further checks if this is the first frame where we've - // gotten this far. I'm guessing this fixes a frame perfect bug, however - // testing with this check removed doesn't cause any unusual behaviour. - if (g_FrData.ammohasgrace) { - g_FrData.ammohasgrace = false; - return false; - } - - // Check if there are any explosions - for (i = 0; i != 6; i++) { - if (g_Explosions[i].prop) { - return false; - } - } - - // Check projectiles - if (weaponnum == WEAPON_ROCKETLAUNCHER - || weaponnum == WEAPON_SLAYER - || weaponnum == WEAPON_DEVASTATOR - || weaponnum == WEAPON_SUPERDRAGON - || weaponnum == WEAPON_COMBATKNIFE - || weaponnum == WEAPON_CROSSBOW - || weaponnum == WEAPON_GRENADE - || weaponnum == WEAPON_NBOMB - || weaponnum == WEAPON_TIMEDMINE - || weaponnum == WEAPON_PROXIMITYMINE - || weaponnum == WEAPON_REMOTEMINE) { - roomsCopy(g_Vars.currentplayer->prop->rooms, rooms20); - - for (i = 0; g_Vars.currentplayer->prop->rooms[i] != -1; i++) { - roomGetNeighbours(g_Vars.currentplayer->prop->rooms[i], rooms10, 10); - roomsAppend(rooms10, rooms20, 20); - } - - roomGetProps(rooms20, propnums, 256); - propnumptr = propnums; - - while (*propnumptr >= 0) { - prop = &g_Vars.props[*propnumptr]; - child = prop->child; - - if ((child && child->type == PROPTYPE_WEAPON && child->weapon->weaponnum == WEAPON_TIMEDMINE) - || (child && child->type == PROPTYPE_WEAPON && child->weapon->weaponnum == WEAPON_REMOTEMINE) - || (child && child->type == PROPTYPE_WEAPON && child->weapon->weaponnum == WEAPON_PROXIMITYMINE) - || (child && child->type == PROPTYPE_WEAPON && child->weapon->weaponnum == WEAPON_GRENADEROUND)) { - return false; - } - - if (prop->type == PROPTYPE_WEAPON) { - if (prop->weapon->weaponnum == WEAPON_ROCKET - || prop->weapon->weaponnum == WEAPON_HOMINGROCKET - || prop->weapon->weaponnum == WEAPON_GRENADE - || prop->weapon->weaponnum == WEAPON_GRENADEROUND) { - return false; - } - - if (prop->weapon->weaponnum == WEAPON_BOLT - || prop->weapon->weaponnum == WEAPON_COMBATKNIFE) { - if (prop->obj->hidden & OBJHFLAG_PROJECTILE) { - return false; - } - } else if (prop->weapon->weaponnum == WEAPON_TIMEDMINE - || prop->weapon->weaponnum == WEAPON_REMOTEMINE) { - return false; - } else if (prop->weapon->weaponnum == WEAPON_PROXIMITYMINE) { - if (g_FrData.proxyendtimer == -255) { - return false; - } - - if (g_FrData.proxyendtimer == 0) { - // Initial state - set the timer to 5 seconds if player is now out of mines - ammotype = bgunGetAmmoTypeForWeapon(weaponnum, 0); - hand = &g_Vars.currentplayer->hands[HAND_RIGHT]; - - if (bgunGetReservedAmmoCount(ammotype) + hand->loadedammo[0] == 0) { - g_FrData.proxyendtimer = TICKS(300); - } - - return false; - } - - g_FrData.proxyendtimer -= g_Vars.lvupdate60; - - if (g_FrData.proxyendtimer <= 0) { - // Timer has just hit zero - remove all proxy items - for (i = 0; i < ARRAYCOUNT(g_Proxies); i++) { - if (g_Proxies[i]) { - g_Proxies[i]->timer240 = 0; - } - } - - g_FrData.proxyendtimer = -255; - return true; - } - - return false; - } - } - - propnumptr++; - } - } - - return true; - } - - return false; -} - -void frTick(void) -{ - s32 ammotype; - s32 capacity; - s32 weaponnum; - struct coord diff; - struct coord newpos; - u8 weaponnum2; - struct prop *prop; - struct defaultobj *obj; - struct defaultobj *obj2; - s32 invincible; - s32 i; - s32 j; - f32 dist; - u32 stack; - struct inventory_ammo *ammo; - u8 exploding; - bool oldside; - struct modelrodata_bbox *bbox; - s32 tmp; -#if VERSION >= VERSION_NTSC_1_0 - f32 mult; -#endif - bool newside; - struct chrdata *chr; - bool cloaked; - f32 toangle; - f32 speed; - Mtxf spbc; - f32 sp98[3][3]; - - if (g_FrIsValidWeapon - && g_Vars.currentplayer->gunctrl.unk1583_04 == 0 - && invHasSingleWeaponIncAllGuns(frGetWeaponBySlot(g_FrData.slot))) { - bgunEquipWeapon(frGetWeaponBySlot(g_FrData.slot)); - } - - // NTSC beta does the room code then menu code, - // while everything else does the menu code then room code -#if VERSION < VERSION_NTSC_1_0 - // End the session if the player slipped through the door before it closed - if (g_Vars.currentplayer->prop->rooms[0] != ROOM_DISH_FIRINGRANGE) { - if (g_FrIsValidWeapon) { - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].inuse - && g_FrData.targets[i].destroyed == false - && g_FrData.targets[i].silent == false - && g_FrData.targets[i].travelling) { - g_FrData.targets[i].silent = true; - func0f0926bc(g_FrData.targets[i].prop, 1, 0xffff); - } - } - - g_Vars.currentplayer->training = false; - frEndSession(true); - g_FrData.menucountdown = 0; // This assignment is in NTSC beta only - chrUnsetStageFlag(NULL, STAGEFLAG_CI_IN_TRAINING); - } - return; - } -#endif - - // Handle the menu countdown - if (g_FrData.menucountdown != 0) { - g_FrData.menucountdown -= g_Vars.lvupdate60; - - // Prevent showing the menu until gun is put away - if (g_FrData.menucountdown <= 0) { - if ((g_FrData.menutype == FRMENUTYPE_FAILED || g_FrData.menutype == FRMENUTYPE_COMPLETED) - && g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponnum != WEAPON_UNARMED) { - g_FrData.menucountdown = 1; - } - } - - if (g_FrData.menucountdown <= 0) { - g_FrData.menucountdown = 0; - - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].prop) { - func0f0926bc(g_FrData.targets[i].prop, 1, 0xffff); - } - } - - switch (g_FrData.menutype) { - case FRMENUTYPE_WEAPONLIST: - func0f0f85e0(ciGetFrWeaponListMenuDialog(), MENUROOT_TRAINING); - break; - case FRMENUTYPE_DETAILS: - func0f0f85e0(&g_FrTrainingInfoPreGameMenuDialog, MENUROOT_TRAINING); - break; - case FRMENUTYPE_FAILED: - sndStart(var80095200, SFX_TRAINING_FAIL, NULL, -1, -1, -1, -1, -1); - func0f0f85e0(&g_FrFailedMenuDialog, MENUROOT_TRAINING); - break; - case FRMENUTYPE_COMPLETED: - sndStart(var80095200, SFX_TRAINING_COMPLETE, NULL, -1, -1, -1, -1, -1); - func0f0f85e0(&g_FrCompletedMenuDialog, MENUROOT_TRAINING); - filemgrSaveOrLoad(&g_GameFileGuid, FILEOP_SAVE_GAME_000, 0); - break; - } - } - return; - } - -#if VERSION >= VERSION_NTSC_1_0 - // End the session if the player slipped through the door before it closed - if (g_Vars.currentplayer->prop->rooms[0] != ROOM_DISH_FIRINGRANGE) { - if (g_FrIsValidWeapon) { - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].inuse - && g_FrData.targets[i].destroyed == false - && g_FrData.targets[i].silent == false - && g_FrData.targets[i].travelling) { - g_FrData.targets[i].silent = true; - func0f0926bc(g_FrData.targets[i].prop, 1, 0xffff); - } - } - - g_Vars.currentplayer->training = false; - frEndSession(true); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_IN_TRAINING); - } - return; - } -#endif - - if (!g_FrIsValidWeapon) { - return; - } - - if (g_Vars.currentplayer->isdead) { - frEndSession(false); - } - - // If paused, stop any target sounds - if (g_Vars.lvupdate240 == 0) { - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].inuse - && g_FrData.targets[i].destroyed == false - && g_FrData.targets[i].silent == false - && g_FrData.targets[i].travelling) { - g_FrData.targets[i].silent = true; - func0f0926bc(g_FrData.targets[i].prop, 1, 0xffff); - } - } - return; - } - - g_Vars.currentplayer->training = true; - frExecuteHelpScript(); - - // Top up the player's ammo if the config defined more ammo than the - // weapon allows, or if it defined unlimited ammo - if (g_FrData.numshotssincetopup != 0) { - weaponnum = frGetWeaponBySlot(g_FrData.slot); - ammotype = bgunGetAmmoTypeForWeapon(weaponnum, 0); - capacity = bgunGetCapacityByAmmotype(ammotype); - ammo = weaponGetAmmoByFunction(weaponnum, 0); - capacity -= (ammo ? ammo->clipsize : 0); - - if (g_FrData.ammoextra > 0) { - tmp = bgunGetReservedAmmoCount(ammotype); - g_FrData.ammoextra -= g_FrData.numshotssincetopup; - - if (g_FrData.ammoextra < 0) { - g_FrData.ammoextra = 0; - } - - capacity = tmp + g_FrData.numshotssincetopup; - bgunSetAmmoQuantity(ammotype, capacity); - } else if (g_FrData.ammoextra == -1) { - bgunSetAmmoQuantity(ammotype, capacity); - } - - if (weaponnum == WEAPON_SUPERDRAGON) { - capacity = bgunGetCapacityByAmmotype(AMMOTYPE_DEVASTATOR); - - if (g_FrData.sdgrenadeextra > 0) { - tmp = bgunGetReservedAmmoCount(AMMOTYPE_DEVASTATOR); - g_FrData.sdgrenadeextra -= g_FrData.numshotssincetopup; - - if (g_FrData.sdgrenadeextra < 0) { - g_FrData.sdgrenadeextra = 0; - } - - capacity = tmp + g_FrData.numshotssincetopup; - bgunSetAmmoQuantity(AMMOTYPE_DEVASTATOR, capacity); - } else if (g_FrData.sdgrenadeextra == -1) { - bgunSetAmmoQuantity(AMMOTYPE_DEVASTATOR, capacity); - } - } - - g_FrData.numshotssincetopup = 0; - } - - g_FrData.timetaken += g_Vars.lvupdate60; - - // Handle prestart - if (g_FrData.timetaken < 0) { - if (g_FrData.numshots == 0) { - if (g_FrData.donealarm == false && g_FrData.timetaken > TICKS(-180)) { - g_FrData.donealarm = true; - sndStart(var80095200, SFX_FR_ALARM, NULL, -1, -1, -1, -1, -1); - } - - if (!g_FrData.donelighting && g_FrData.timetaken > TICKS(-225)) { - frInitLighting(); - } - - return; - } - - // Fired a shot during prestart - if (!g_FrData.donelighting) { - frInitLighting(); - } - - g_FrData.timetaken = 0; - g_FrData.donealarm = true; - } - - // Iterate each target and handle their health active/inactive state - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].inuse && g_FrData.targets[i].destroyed == false && g_FrData.targets[i].active) { - invincible = false; - exploding = false; - weaponnum2 = frGetWeaponBySlot(g_FrData.slot); - prop = g_FrData.targets[i].prop; - obj = prop->obj; - - switch (weaponnum2) { - case WEAPON_GRENADE: - case WEAPON_PROXIMITYMINE: - coordTriggerProxies(&prop->pos, true); - break; - } - - if (g_FrData.targets[i].travelling && g_FrData.targets[i].silent && g_FrData.targets[i].travelspeed != -1) { - g_FrData.targets[i].silent = false; - propsnd0f0939f8(NULL, g_FrData.targets[i].prop, SFX_FR_CONVEYER, -1, - -1, 0, 0, 0, 0, -1, 0, -1, -1, -1, -1); - } - - if (g_FrData.targets[i].angle > 2.2915925979614f && g_FrData.targets[i].angle < 3.9915928840637f) { - obj->damage = 0; - } - - if ((g_FrData.targets[i].flags & FRTARGETFLAG_TMPINVINCIBLE) - && g_FrData.targets[i].invincibletimer < TICKS(300)) { - invincible = true; - g_FrData.targets[i].invincibletimer += g_Vars.lvupdate60; - } - - if (obj->damage > 0) { - if (invincible || g_FrData.targets[i].angle == M_PI) { - obj->damage = 0; - } else if (g_FrData.targets[i].flags & FRTARGETFLAG_ONEHITEXPLODE - || obj->damage >= obj->maxdamage - || frGetWeaponBySlot(g_FrData.slot) == WEAPON_PHOENIX) { - g_FrData.numhitsbullseye++; - g_FrData.score += 10; - exploding = true; - g_FrData.feedbackttl = TICKS(60); - g_FrData.feedbackzone = FRZONE_EXPLODE; - } - } - - // Handle target being destroyed - if (exploding || (g_FrData.targets[i].maxdamage != 255 - && g_FrData.targets[i].damage >= g_FrData.targets[i].maxdamage)) { - bbox = objFindBboxRodata(obj); - - if (g_FrNumSounds && g_FrData.targets[i].travelling) { - g_FrNumSounds--; - func0f0926bc(prop, 1, 0xffff); - } - - if (g_FrNumSounds); - - shardsCreate(&prop->pos, &obj->realrot[0][0], &obj->realrot[1][0], &obj->realrot[2][0], - bbox->xmin, bbox->xmax, bbox->ymin, bbox->ymax, 2, prop); - - g_FrData.targetsdestroyed++; - - if (g_FrData.targets[i].flags & FRTARGETFLAG_ONEHITEXPLODE) { - explosionCreateSimple(g_FrData.targets[i].prop, &g_FrData.targets[i].prop->pos, - g_FrData.targets[i].prop->rooms, EXPLOSIONTYPE_FRTARGET, 1); - } - - g_FrData.targets[i].travelling = false; - g_FrData.targets[i].active = false; - g_FrData.targets[i].destroyed = true; - - obj->flags2 |= OBJFLAG2_INVISIBLE; - - prop->pos.x = 0; - prop->pos.y = -5000; - prop->pos.z = 0; - - func0f069c70(obj, true, false); - - // Activate another target - for (j = 0; j < ARRAYCOUNT(g_FrData.targets); j++) { - if (g_FrData.targets[j].destroyed == false - && g_FrData.targets[j].inuse - && g_FrData.targets[j].active == false) { - obj2 = g_FrData.targets[j].prop->obj; - g_FrData.targets[j].active = true; - obj2->flags2 &= ~OBJFLAG2_INVISIBLE; - break; - } - } - } - } - } - - // Check if the session should end - if (g_FrData.goaltargets == 255) { - if (g_FrData.goalscore && g_FrData.score >= g_FrData.goalscore) { - frSetCompleted(); - return; - } - } else { - if (g_FrData.targetsdestroyed >= g_FrData.goaltargets - && (g_FrData.goalscore == 0 || g_FrData.score >= g_FrData.goalscore)) { - frSetCompleted(); - return; - } - } - - if (g_FrData.targetsdestroyed >= g_FrData.numtargets) { - frSetFailReason(FRFAILREASON_SCOREUNATTAINABLE); - return; - } - - if (frIsAmmoWasted()) { - frSetFailReason(FRFAILREASON_OUTOFAMMO); - return; - } - - if (g_FrData.timelimit != 255 && g_FrData.timetaken >= g_FrData.timelimit * TICKS(60)) { - frSetFailReason(FRFAILREASON_TIMEOVER); - return; - } - - // Tick each target - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].inuse - && g_FrData.targets[i].destroyed == false - && g_FrData.targets[i].active) { - prop = g_FrData.targets[i].prop; - obj = prop->obj; - - if (g_FrData.targets[i].travelling) { - if (g_FrData.targets[i].travelspeed == -1) { - g_FrData.targets[i].donestopsound = true; - g_FrData.targets[i].travelling = false; -#if VERSION >= VERSION_NTSC_1_0 - mult = 1; -#endif - dist = -2; - } else { - diff.x = g_FrData.targets[i].dstpos.x - prop->pos.x; - diff.y = g_FrData.targets[i].dstpos.y - prop->pos.y; - diff.z = g_FrData.targets[i].dstpos.z - prop->pos.z; - - dist = sqrtf(diff.f[0] * diff.f[0] + diff.f[1] * diff.f[1] + diff.f[2] * diff.f[2]); -#if VERSION >= VERSION_NTSC_1_0 - mult = 1; -#endif - - if (dist != 0) { -#if VERSION >= VERSION_NTSC_1_0 - -#if VERSION >= VERSION_PAL_BETA - mult = g_FrData.targets[i].travelspeed * g_Vars.lvupdate60freal; -#else - mult = (g_FrData.targets[i].travelspeed * g_Vars.lvupdate240) * 0.25f; -#endif - diff.x *= 1.0f / dist; - diff.y *= 1.0f / dist; - diff.z *= 1.0f / dist; - newpos.x = diff.x * mult + prop->pos.x; - newpos.y = diff.y * mult + prop->pos.y; - newpos.z = diff.z * mult + prop->pos.z; -#else - diff.x *= 1.0f / dist; - diff.y *= 1.0f / dist; - diff.z *= 1.0f / dist; - newpos.x = diff.x * g_FrData.targets[i].travelspeed * g_Vars.lvupdate240 * 0.25f + prop->pos.x; - newpos.y = diff.y * g_FrData.targets[i].travelspeed * g_Vars.lvupdate240 * 0.25f + prop->pos.y; - newpos.z = diff.z * g_FrData.targets[i].travelspeed * g_Vars.lvupdate240 * 0.25f + prop->pos.z; -#endif - } else { - dist = -2; - } - } - -#if VERSION >= VERSION_NTSC_1_0 - if (mult >= dist) -#else - if (dist < g_FrData.targets[i].travelspeed) -#endif - { - // Target is stopping - newpos.x = g_FrData.targets[i].dstpos.x; - newpos.y = g_FrData.targets[i].dstpos.y; - newpos.z = g_FrData.targets[i].dstpos.z; - - g_FrData.targets[i].scriptenabled = true; - g_FrData.targets[i].travelling = false; - - if (g_FrData.targets[i].donestopsound == false) { - g_FrData.targets[i].donestopsound = true; - - if (g_FrNumSounds) { - g_FrNumSounds--; - } - - func0f0926bc(prop, 1, 0xffff); - propsnd0f0939f8(NULL, prop, SFX_FR_CONVEYER_STOP, -1, - -1, 1024, 0, 0, 0, -1, 0, -1, -1, -1, -1); - - if (g_FrNumSounds); - } - } - - prop->pos.x = newpos.x; - prop->pos.y = newpos.y; - prop->pos.z = newpos.z; - - func0f069c70(obj, true, false); - } - - if (g_FrData.targets[i].rotateoncloak && g_FrData.targets[i].rotating == false) { - if (g_FrData.targets[i].timeuntilrotate == 0) { - chr = g_Vars.currentplayer->prop->chr; - cloaked = chr->hidden & CHRHFLAG_CLOAKED; - - if (cloaked) { - if (g_FrData.targets[i].angle == M_PI) { - g_FrData.targets[i].timeuntilrotate = TICKS(60); - g_FrData.targets[i].rotatetoangle = 0; - g_FrData.targets[i].rotatespeed = -M_PI / 90; - } - } else { - if (g_FrData.targets[i].angle == 0) { - g_FrData.targets[i].timeuntilrotate = TICKS(60); - g_FrData.targets[i].rotatetoangle = M_PI; - g_FrData.targets[i].rotatespeed = M_PI / 90; - } - } - } else { - g_FrData.targets[i].timeuntilrotate -= g_Vars.lvupdate60; - - if (g_FrData.targets[i].timeuntilrotate <= 0) { - g_FrData.targets[i].timeuntilrotate = 0; - g_FrData.targets[i].rotating = true; - } - } - } else if (g_FrData.targets[i].rotating) { - toangle = g_FrData.targets[i].rotatetoangle; - speed = g_FrData.targets[i].rotatespeed; - - if (toangle); - - oldside = 0; - - if (g_FrData.targets[i].angle < toangle) { - oldside = 1; - } - - oldside = (u8)oldside; - -#if VERSION >= VERSION_PAL_BETA - g_FrData.targets[i].angle += speed * g_Vars.lvupdate60freal; -#else - g_FrData.targets[i].angle += speed * g_Vars.lvupdate240 * 0.25f; -#endif - - newside = 0; - - toangle = g_FrData.targets[i].rotatetoangle; - - if (g_FrData.targets[i].angle < toangle) { - newside = 1; - } - - newside = (u8)newside; - - if (newside != oldside || g_FrData.targets[i].angle == toangle) { - // Reached desired angle - g_FrData.targets[i].angle = g_FrData.targets[i].rotatetoangle; - g_FrData.targets[i].rotating = false; - g_FrData.targets[i].scriptenabled = true; - g_FrData.targets[i].scriptsleep = 0; - - while (g_FrData.targets[i].angle > M_BADTAU) { - g_FrData.targets[i].angle -= M_BADTAU; - } - - while (g_FrData.targets[i].angle < 0) { - g_FrData.targets[i].angle += M_BADTAU; - } - } - - mtx4LoadYRotation(g_FrData.targets[i].angle + M_PI, &spbc); - mtx00015f04(obj->model->scale, &spbc); - mtx4ToMtx3(&spbc, sp98); - mtx3Copy(sp98, obj->realrot); - } - - if (g_FrData.targets[i].scriptenabled && g_FrData.targets[i].scriptsleep != SECSTOTIME60(255)) { - g_FrData.targets[i].scriptsleep -= g_Vars.lvupdate60; - - if (g_FrData.targets[i].scriptsleep <= 0) { - g_FrData.targets[i].scriptenabled = false; - - while (!frExecuteTargetScript(i)); - - if (frTargetIsAtScriptStart(i)) { - while (!frExecuteTargetScript(i)); - } - } - } - } - } -} - -void func0f1a0924(struct prop *prop) -{ - struct defaultobj *obj = prop->obj; - s32 i; - - if (obj->modelnum == MODEL_TARGET) { - f32 sp68; - f32 sp64; - f32 sp60; - f32 sp56; - - sp64 = -1; - sp68 = -1; - sp56 = -2; - sp60 = -2; - - modelGetScreenCoords(obj->model, &sp56, &sp64, &sp60, &sp68); - - for (i = 0; i < 4; i++) { - if (g_Vars.currentplayer->trackedprops[i].prop == prop) { - return; - } - - if (g_Vars.currentplayer->trackedprops[i].prop == NULL) { - g_Vars.currentplayer->trackedprops[i].prop = prop; - - g_Vars.currentplayer->trackedprops[i].x1 = sp64 - 2; - g_Vars.currentplayer->trackedprops[i].x2 = sp56 + 2; - g_Vars.currentplayer->trackedprops[i].y1 = sp68 - 2; - g_Vars.currentplayer->trackedprops[i].y2 = sp60 + 2; - g_Vars.currentplayer->targetset[i] = 0; - return; - } - } - } -} - -bool frChooseFarsightTarget(void) -{ - struct prop *bestprop = NULL; - f32 bestvalue = 1; - f32 bestdist = -1; - bool found = false; - s32 i; - - if (bgunGetWeaponNum(HAND_RIGHT) == WEAPON_FARSIGHT) { - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - if (g_FrData.targets[i].inuse - && g_FrData.targets[i].destroyed == false - && g_FrData.targets[i].active - && g_FrData.targets[i].flags & FRTARGETFLAG_FARSIGHTAUTOTARGETABLE) { - struct prop *prop = g_FrData.targets[i].prop; - f32 xdiff = g_Vars.currentplayer->bond2.unk10.x - prop->pos.x; - f32 ydiff = g_Vars.currentplayer->bond2.unk10.y - prop->pos.y; - f32 zdiff = g_Vars.currentplayer->bond2.unk10.z - prop->pos.z; - f32 dist = sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff); - - if (dist > 0) { - f32 value = (xdiff * g_Vars.currentplayer->bond2.unk1c.f[0] - + ydiff * g_Vars.currentplayer->bond2.unk1c.f[1] - + zdiff * g_Vars.currentplayer->bond2.unk1c.f[2]) / dist; - - if (value); - - if (value < 0 && value < bestvalue) { - bestvalue = value; - bestprop = prop; - bestdist = dist; - found = true; - } - } - } - } - } - - g_Vars.currentplayer->autoeraserdist = bestdist; - g_Vars.currentplayer->autoerasertarget = bestprop; - - return found; -} - -s32 frIsInTraining(void) -{ - if (g_FrData.menucountdown > 0 && - (g_FrData.menutype == FRMENUTYPE_FAILED || g_FrData.menutype == FRMENUTYPE_COMPLETED)) { - return true; - } - - return g_Vars.currentplayer->prop->rooms[0] == ROOM_DISH_FIRINGRANGE - && g_FrIsValidWeapon - && mainGetStageNum() == STAGE_CITRAINING; -} - -void frCalculateHit(struct defaultobj *obj, struct coord *hitpos, f32 maulercharge) -{ - s32 i; - - if (g_FrIsValidWeapon == false) { - return; - } - - for (i = 0; i < ARRAYCOUNT(g_FrData.targets); i++) { - struct prop *prop = g_FrData.targets[i].prop; - - if (obj == prop->obj) { - f32 xdiff = hitpos->x - prop->pos.x; - f32 ydiff = hitpos->y - prop->pos.y; - f32 zdiff = hitpos->z - prop->pos.z; - - f32 dist = sqrtf(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff); - - if (g_FrData.targets[i].flags & FRTARGETFLAG_ONEHITEXPLODE) { - g_FrData.targets[i].damage = g_FrData.targets[i].maxdamage; - } else if (frGetWeaponBySlot(g_FrData.slot) == WEAPON_MAULER) { - g_FrData.targets[i].damage += (f32)((s32)(maulercharge * 0.1f) + 1); - } else if ((g_FrData.targets[i].flags & FRTARGETFLAG_TMPINVINCIBLE) == 0 - || g_FrData.targets[i].invincibletimer >= TICKS(300)) { - g_FrData.targets[i].damage++; - } - - if (dist < 18) { - g_FrData.feedbackzone = FRZONE_BULLSEYE; - g_FrData.numhitsbullseye++; - } else if (dist < 37) { - g_FrData.feedbackzone = FRZONE_RING1; - g_FrData.numhitsring1++; - } else if (dist < 56) { - g_FrData.feedbackzone = FRZONE_RING2; - g_FrData.numhitsring2++; - } else { - g_FrData.feedbackzone = FRZONE_RING3; - g_FrData.numhitsring3++; - } - - g_FrData.feedbackttl = TICKS(60); - g_FrData.score += g_FrData.feedbackzone; - } - } -} - -void frIncrementNumShots(void) -{ - g_FrData.numshots++; - g_FrData.numshotssincetopup++; -} - -bool ciIsChrBioUnlocked(u32 bodynum) -{ - switch (bodynum) { - case BODY_DARK_COMBAT: - case BODY_CARRINGTON: - return true; - case BODY_CASSANDRA: - return ciIsStageComplete(SOLOSTAGEINDEX_DEFECTION); - case BODY_DRCAROLL: - return ciIsStageComplete(SOLOSTAGEINDEX_INVESTIGATION); - case BODY_MRBLONDE: - return ciIsStageComplete(SOLOSTAGEINDEX_EXTRACTION); - case BODY_TRENT: - return ciIsStageComplete(SOLOSTAGEINDEX_G5BUILDING); - case BODY_JONATHAN: - return ciIsStageComplete(SOLOSTAGEINDEX_INFILTRATION); - case BODY_THEKING: - return ciIsStageComplete(SOLOSTAGEINDEX_RESCUE); - case BODY_PRESIDENT: - return ciIsStageComplete(SOLOSTAGEINDEX_AIRFORCEONE); - } - - return false; -} - -u8 g_ChrBioSlot = 0; - -struct chrbio *ciGetChrBioByBodynum(u32 bodynum) -{ -#ifdef AVOID_UB - static -#endif - struct chrbio bios[] = { - // name, race, age, profile -#if VERSION >= VERSION_PAL_BETA - /*0*/ { L_DISH_125, L_DISH_126, L_DISH_127, L_DISH_128 }, // Joanna Dark - /*1*/ { L_DISH_129, L_DISH_130, L_DISH_131, L_DISH_132 }, // Jonathan - /*2*/ { L_DISH_133, L_DISH_134, L_DISH_135, L_DISH_136 }, // Daniel Carrington - /*3*/ { L_DISH_137, L_DISH_138, L_DISH_139, L_DISH_140 }, // Cassandra De Vries - /*4*/ { L_DISH_141, L_DISH_142, L_DISH_143, L_DISH_144 }, // Trent Easton - /*5*/ { L_DISH_145, L_DISH_146, L_DISH_147, L_DISH_148 }, // Dr. Caroll - /*6*/ { L_DISH_149, L_DISH_150, L_DISH_151, L_DISH_152 }, // Elvis - /*7*/ { L_DISH_153, L_DISH_154, L_DISH_155, L_DISH_156 }, // Mr. Blonde - /*8*/ { L_DISH_157, L_DISH_158, L_DISH_159, L_DISH_160 }, // Mr. Blonde (repeat) - /*9*/ { L_DISH_161, L_DISH_162, L_DISH_163, L_DISH_164 }, // The U.S. President -#else - /*0*/ { L_MISC_219, L_MISC_220, L_MISC_221, L_MISC_222 }, // Joanna Dark - /*1*/ { L_MISC_223, L_MISC_224, L_MISC_225, L_MISC_226 }, // Jonathan - /*2*/ { L_MISC_227, L_MISC_228, L_MISC_229, L_MISC_230 }, // Daniel Carrington - /*3*/ { L_MISC_231, L_MISC_232, L_MISC_233, L_MISC_234 }, // Cassandra De Vries - /*4*/ { L_MISC_235, L_MISC_236, L_MISC_237, L_MISC_238 }, // Trent Easton - /*5*/ { L_MISC_239, L_MISC_240, L_MISC_241, L_MISC_242 }, // Dr. Caroll - /*6*/ { L_MISC_243, L_MISC_244, L_MISC_245, L_MISC_246 }, // Elvis - /*7*/ { L_MISC_247, L_MISC_248, L_MISC_249, L_MISC_250 }, // Mr. Blonde - /*8*/ { L_MISC_251, L_MISC_252, L_MISC_253, L_MISC_254 }, // Mr. Blonde (repeat) - /*9*/ { L_MISC_255, L_MISC_256, L_MISC_257, L_MISC_258 }, // The U.S. President -#endif - }; - - switch (bodynum) { - case BODY_DARK_COMBAT: - return &bios[0]; - case BODY_JONATHAN: - return &bios[1]; - case BODY_CARRINGTON: - return &bios[2]; - case BODY_CASSANDRA: - return &bios[3]; - case BODY_TRENT: - return &bios[4]; - case BODY_DRCAROLL: - return &bios[5]; - case BODY_THEKING: - return &bios[6]; - case BODY_MRBLONDE: - if (ciIsStageComplete(SOLOSTAGEINDEX_CRASHSITE)) { - return &bios[8]; - } - return &bios[7]; - case BODY_PRESIDENT: - return &bios[9]; - } - - return NULL; -} - -char *ciGetChrBioDescription(void) -{ - struct chrbio *bio = ciGetChrBioByBodynum(ciGetChrBioBodynumBySlot(g_ChrBioSlot)); - return langGet(bio->description); -} - -s32 ciGetNumUnlockedChrBios(void) -{ - s32 count = 0; - s32 bodynum; - - for (bodynum = 0; bodynum < NUM_BODIES; bodynum++) { - if (ciIsChrBioUnlocked(bodynum)) { - count++; - } - } - - return count; -} - -s32 ciGetChrBioBodynumBySlot(s32 slot) -{ - s32 index = -1; - s32 bodynum; - - for (bodynum = 0; bodynum < NUM_BODIES; bodynum++) { - if (ciIsChrBioUnlocked(bodynum)) { - index++; - } - - if (index == slot) { - return bodynum; - } - } - - return 0; -} - -struct miscbio *ciGetMiscBio(s32 index) -{ -#ifdef AVOID_UB - static -#endif - struct miscbio bios[] = { - // name, description -#if VERSION >= VERSION_PAL_BETA - { L_DISH_165, L_DISH_166 }, - { L_DISH_167, L_DISH_168 }, - { L_DISH_169, L_DISH_170 }, - { L_DISH_171, L_DISH_172 }, -#else - { L_MISC_259, L_MISC_260 }, - { L_MISC_261, L_MISC_262 }, - { L_MISC_263, L_MISC_264 }, - { L_MISC_265, L_MISC_266 }, -#endif - }; - - switch (index) { - case MISCBIO_MAIANS: return &bios[0]; - case MISCBIO_SKEDAR: return &bios[1]; - case MISCBIO_BACKGROUND: return &bios[2]; - case MISCBIO_STORY: return &bios[3]; - } - - return NULL; -} - -bool ciIsMiscBioUnlocked(s32 index) -{ - switch (index) { - case MISCBIO_MAIANS: - return ciIsStageComplete(SOLOSTAGEINDEX_RESCUE); - case MISCBIO_SKEDAR: - return ciIsStageComplete(SOLOSTAGEINDEX_ATTACKSHIP); - case MISCBIO_BACKGROUND: - case MISCBIO_STORY: - return ciIsStageComplete(SOLOSTAGEINDEX_MBR); - } - - return false; -} - -s32 ciGetNumUnlockedMiscBios(void) -{ - s32 count = 0; - s32 i; - - for (i = 0; i < 4; i++) { - if (ciIsMiscBioUnlocked(i)) { - count++; - } - } - - return count; -} - -s32 ciGetMiscBioIndexBySlot(s32 slot) -{ - s32 index = -1; - s32 i; - - for (i = 0; i < 4; i++) { - if (ciIsMiscBioUnlocked(i)) { - index++; - } - - if (index == slot) { - return i; - } - } - - return 0; -} - -char *ciGetMiscBioDescription(void) -{ - s32 index = ciGetMiscBioIndexBySlot(g_ChrBioSlot - ciGetNumUnlockedChrBios()); - struct miscbio *bio = ciGetMiscBio(index); - - return langGet(bio->description); -} - -bool ciIsHangarBioAVehicle(s32 index) -{ - return index >= HANGARBIO_JUMPSHIP; -} - -u8 g_HangarBioSlot = 0; - -struct hangarbio *ciGetHangarBio(s32 index) -{ -#ifdef AVOID_UB - static -#endif - struct hangarbio bios[] = { - // name, description -#if VERSION >= VERSION_PAL_BETA - { L_DISH_196, L_DISH_219 }, // Carrington Institute - { L_DISH_197, L_DISH_220 }, // Lucerne Tower - { L_DISH_198, L_DISH_221 }, // Laboratory Basement - { L_DISH_199, L_DISH_222 }, // Carrington Villa - { L_DISH_200, L_DISH_223 }, // Chicago - { L_DISH_201, L_DISH_224 }, // G5 Building - { L_DISH_202, L_DISH_225 }, // Area 51 - { L_DISH_203, L_DISH_226 }, // Alaskan Air Base - { L_DISH_204, L_DISH_227 }, // Air Force One - { L_DISH_205, L_DISH_228 }, // Crash Site - { L_DISH_206, L_DISH_229 }, // Pelagic II - { L_DISH_207, L_DISH_230 }, // Cetan Ship - { L_DISH_208, L_DISH_231 }, // Skedar Assault Ship - { L_DISH_209, L_DISH_232 }, // Skedar Homeworld - { L_DISH_210, L_DISH_233 }, // Jumpship - { L_DISH_211, L_DISH_234 }, // HoverCrate - { L_DISH_212, L_DISH_235 }, // HoverBike - { L_DISH_213, L_DISH_236 }, // Cleaning Hovbot - { L_DISH_214, L_DISH_237 }, // Hovercopter - { L_DISH_215, L_DISH_238 }, // G5 Robot - { L_DISH_216, L_DISH_239 }, // A51 Interceptor - { L_DISH_217, L_DISH_240 }, // Maian Vessel - { L_DISH_218, L_DISH_241 }, // Skedar Shuttle -#else - { L_MISC_290, L_MISC_313 }, // Carrington Institute - { L_MISC_291, L_MISC_314 }, // Lucerne Tower - { L_MISC_292, L_MISC_315 }, // Laboratory Basement - { L_MISC_293, L_MISC_316 }, // Carrington Villa - { L_MISC_294, L_MISC_317 }, // Chicago - { L_MISC_295, L_MISC_318 }, // G5 Building - { L_MISC_296, L_MISC_319 }, // Area 51 - { L_MISC_297, L_MISC_320 }, // Alaskan Air Base - { L_MISC_298, L_MISC_321 }, // Air Force One - { L_MISC_299, L_MISC_322 }, // Crash Site - { L_MISC_300, L_MISC_323 }, // Pelagic II - { L_MISC_301, L_MISC_324 }, // Cetan Ship - { L_MISC_302, L_MISC_325 }, // Skedar Assault Ship - { L_MISC_303, L_MISC_326 }, // Skedar Homeworld - { L_MISC_304, L_MISC_327 }, // Jumpship - { L_MISC_305, L_MISC_328 }, // HoverCrate - { L_MISC_306, L_MISC_329 }, // HoverBike - { L_MISC_307, L_MISC_330 }, // Cleaning Hovbot - { L_MISC_308, L_MISC_331 }, // Hovercopter - { L_MISC_309, L_MISC_332 }, // G5 Robot - { L_MISC_310, L_MISC_333 }, // A51 Interceptor - { L_MISC_311, L_MISC_334 }, // Maian Vessel - { L_MISC_312, L_MISC_335 }, // Skedar Shuttle -#endif - }; - - switch (index) { - case HANGARBIO_INSTITUTE: return &bios[0]; - case HANGARBIO_DDTOWER: return &bios[1]; - case HANGARBIO_LABBASEMENT: return &bios[2]; - case HANGARBIO_VILLA: return &bios[3]; - case HANGARBIO_CHICAGO: return &bios[4]; - case HANGARBIO_G5: return &bios[5]; - case HANGARBIO_AREA51: return &bios[6]; - case HANGARBIO_AIRBASE: return &bios[7]; - case HANGARBIO_AIRFORCEONE: return &bios[8]; - case HANGARBIO_CRASHSITE: return &bios[9]; - case HANGARBIO_PELAGIC: return &bios[10]; - case HANGARBIO_DEEPSEA: return &bios[11]; - case HANGARBIO_ATTACKSHIP: return &bios[12]; - case HANGARBIO_SKEDARRUINS: return &bios[13]; - case HANGARBIO_JUMPSHIP: return &bios[14]; - case HANGARBIO_HOVERCRATE: return &bios[15]; - case HANGARBIO_HOVERBIKE: return &bios[16]; - case HANGARBIO_HOVERBOT: return &bios[17]; - case HANGARBIO_HOVERCOPTER: return &bios[18]; - case HANGARBIO_G5ROBOT: return &bios[19]; - case HANGARBIO_A51INTERCEPTOR: return &bios[20]; - case HANGARBIO_MAIANVESSEL: return &bios[21]; - case HANGARBIO_SKEDARSHUTTLE: return &bios[22]; - } - - return NULL; -} - -u8 g_DtSlot = 0; -u8 var80088adc = 0; - -bool ciIsHangarBioUnlocked(u32 bioindex) -{ - u32 stage; - - switch (bioindex) { - case HANGARBIO_INSTITUTE: - case HANGARBIO_HOVERCRATE: - return true; - case HANGARBIO_DDTOWER: - stage = SOLOSTAGEINDEX_DEFECTION; - break; - case HANGARBIO_LABBASEMENT: - case HANGARBIO_HOVERBOT: - stage = SOLOSTAGEINDEX_INVESTIGATION; - break; - case HANGARBIO_HOVERCOPTER: - stage = SOLOSTAGEINDEX_EXTRACTION; - break; - case HANGARBIO_VILLA: - case HANGARBIO_JUMPSHIP: - stage = SOLOSTAGEINDEX_VILLA; - break; - case HANGARBIO_CHICAGO: - stage = SOLOSTAGEINDEX_CHICAGO; - break; - case HANGARBIO_G5: - case HANGARBIO_G5ROBOT: - stage = SOLOSTAGEINDEX_G5BUILDING; - break; - case HANGARBIO_AREA51: - case HANGARBIO_HOVERBIKE: - case HANGARBIO_A51INTERCEPTOR: - stage = SOLOSTAGEINDEX_INFILTRATION; - break; - case HANGARBIO_AIRBASE: - stage = SOLOSTAGEINDEX_AIRBASE; - break; - case HANGARBIO_AIRFORCEONE: - stage = SOLOSTAGEINDEX_AIRFORCEONE; - break; - case HANGARBIO_CRASHSITE: - case HANGARBIO_MAIANVESSEL: - stage = SOLOSTAGEINDEX_CRASHSITE; - break; - case HANGARBIO_PELAGIC: - stage = SOLOSTAGEINDEX_PELAGIC; - break; - case HANGARBIO_DEEPSEA: - stage = SOLOSTAGEINDEX_DEEPSEA; - break; - case HANGARBIO_ATTACKSHIP: - case HANGARBIO_SKEDARSHUTTLE: - stage = SOLOSTAGEINDEX_DEFENSE; - break; - case HANGARBIO_SKEDARRUINS: - stage = SOLOSTAGEINDEX_ATTACKSHIP; - break; - default: - return false; - } - - return ciIsStageComplete(stage); -} - -s32 ciGetNumUnlockedLocationBios(void) -{ - s32 count = 0; - s32 i; - - for (i = 0; i < 23; i++) { - if (ciIsHangarBioAVehicle(i)) { - return count; - } - - if (ciIsHangarBioUnlocked(i)) { - count++; - } - } - - return count; -} - -s32 ciGetNumUnlockedHangarBios(void) -{ - s32 count = 0; - s32 i; - - for (i = 0; i < 23; i++) { - if (ciIsHangarBioUnlocked(i)) { - count++; - } - } - - return count; -} - -s32 ciGetHangarBioIndexBySlot(s32 slot) -{ - s32 index = -1; - s32 i; - - for (i = 0; i < 23; i++) { - if (ciIsHangarBioUnlocked(i)) { - index++; - } - - if (index == slot) { - return i; - } - } - - return 0; -} - -char *ciGetHangarBioDescription(void) -{ - struct hangarbio *bio = ciGetHangarBio(ciGetHangarBioIndexBySlot(g_HangarBioSlot)); - return langGet(bio->description); -} - -struct trainingdata *dtGetData(void) -{ - return &g_DtData; -} - -void dtRestorePlayer(void) -{ - bgunSetPassiveMode(true); - - if (g_DtData.obj) { - objFreePermanently(g_DtData.obj, true); - } - - g_DtData.obj = NULL; - - if (dtGetWeaponByDeviceIndex(dtGetIndexBySlot(g_DtSlot)) == WEAPON_ECMMINE) { - bgunSetAmmoQuantity(AMMOTYPE_ECM_MINE, 0); - } -} - -void dtPushEndscreen(void) -{ - if (g_DtData.completed) { - func0f0f85e0(&g_DtCompletedMenuDialog, MENUROOT_TRAINING); - } else if (g_DtData.failed) { - func0f0f85e0(&g_DtFailedMenuDialog, MENUROOT_TRAINING); - } - - g_DtData.timeleft = 0; - g_DtData.completed = false; - g_DtData.failed = false; - g_DtData.finished = false; - g_DtData.holographedpc = false; -} - -void dtTick(void) -{ - if (var80088adc) { - if (g_DtData.intraining) { - g_DtData.timetaken += g_Vars.lvupdate60; - - if (g_Vars.currentplayer->isdead) { - dtEnd(); - } - - if (chrHasStageFlag(NULL, STAGEFLAG_CI_TRIGGER_DEVICE_FAILURE)) { - dtEnd(); - g_DtData.failed = true; - g_DtData.timeleft = 1; - g_DtData.finished = true; - } else if (chrHasStageFlag(NULL, STAGEFLAG_CI_TRIGGER_DEVICE_SUCCESS)) { - dtEnd(); - g_DtData.completed = true; - g_DtData.timeleft = 1; - g_DtData.finished = true; - } - } else if (g_DtData.finished) { - if (g_DtData.timeleft <= 0) { - dtPushEndscreen(); - } else { - g_DtData.timeleft -= g_Vars.lvupdate60; - } - } - } -} - -void func0f1a1ac0(void) -{ - if (var80088adc == false) { - var80088adc = true; - g_DtData.intraining = false; - g_DtData.failed = false; - g_DtData.completed = false; - g_DtData.finished = false; - g_DtData.timeleft = 0; - g_DtData.holographedpc = false; - g_DtData.timetaken = 0; - g_DtData.obj = NULL; - chrUnsetStageFlag(NULL, STAGEFLAG_CI_DEVICE_ABORTING); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_DEVICE_SUCCESS); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_DEVICE_FAILURE); - } -} - -void dtBegin(void) -{ - g_DtData.intraining = true; - g_DtData.timetaken = 0; - chrUnsetStageFlag(NULL, STAGEFLAG_CI_DEVICE_ABORTING); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_DEVICE_SUCCESS); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_DEVICE_FAILURE); - chrSetStageFlag(NULL, ciGetStageFlagByDeviceIndex(dtGetIndexBySlot(g_DtSlot))); - g_Vars.currentplayer->training = true; - bgunSetPassiveMode(false); - chrSetStageFlag(NULL, STAGEFLAG_CI_IN_TRAINING); -} - -void dtEnd(void) -{ - g_DtData.intraining = false; - dtRestorePlayer(); - bgunSetAmmoQuantity(AMMOTYPE_CLOAK, 0); - chrSetStageFlag(NULL, STAGEFLAG_CI_DEVICE_ABORTING); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_DEVICE_FAILURE); - chrUnsetStageFlag(NULL, ciGetStageFlagByDeviceIndex(dtGetIndexBySlot(g_DtSlot))); - g_Vars.currentplayer->training = false; - chrUnsetStageFlag(NULL, STAGEFLAG_CI_IN_TRAINING); - playerDisplayHealth(); - g_Vars.currentplayer->bondhealth = 1; -} - -bool dtIsAvailable(s32 deviceindex) -{ - u8 flags[] = { - GAMEFILEFLAG_CI_UPLINK_DONE, - GAMEFILEFLAG_CI_ECMMINE_DONE, - GAMEFILEFLAG_CI_CAMSPY_DONE, - GAMEFILEFLAG_CI_NIGHTVISION_DONE, - GAMEFILEFLAG_CI_DOORDECODER_DONE, - GAMEFILEFLAG_CI_RTRACKER_DONE, - GAMEFILEFLAG_CI_IR_DONE, - GAMEFILEFLAG_CI_XRAY_DONE, - GAMEFILEFLAG_CI_DISGUISE_DONE, - GAMEFILEFLAG_CI_CLOAK_DONE, - }; - - deviceindex--; - - if (deviceindex >= 10) { - return true; - } - - if (deviceindex < 0 || gamefileHasFlag(flags[deviceindex])) { - return true; - } - - return false; -} - -s32 dtGetNumAvailable(void) -{ - s32 count = 0; - s32 i; - - for (i = 0; i < 10; i++) { - if (dtIsAvailable(i)) { - count++; - } - } - - return count; -} - -s32 dtGetIndexBySlot(s32 wantindex) -{ - s32 index = -1; - s32 i; - - for (i = 0; i < 10; i++) { - if (dtIsAvailable(i)) { - index++; - } - - if (index == wantindex) { - return i; - } - } - - return 0; -} - -u32 dtGetWeaponByDeviceIndex(s32 deviceindex) -{ - u32 weapons[] = { - WEAPON_DATAUPLINK, - WEAPON_ECMMINE, - WEAPON_EYESPY, - WEAPON_NIGHTVISION, - WEAPON_DOORDECODER, - WEAPON_RTRACKER, - WEAPON_IRSCANNER, - WEAPON_XRAYSCANNER, - WEAPON_DISGUISE41, - WEAPON_CLOAKINGDEVICE, - }; - - return weapons[deviceindex]; -} - -u32 ciGetStageFlagByDeviceIndex(u32 deviceindex) -{ - u32 flags[] = { - STAGEFLAG_CI_TRIGGER_UPLINK, - STAGEFLAG_CI_TRIGGER_ECMMINE, - STAGEFLAG_CI_TRIGGER_CAMSPY, - STAGEFLAG_CI_TRIGGER_NIGHTVISION, - STAGEFLAG_CI_TRIGGER_DOORDECODER, - STAGEFLAG_CI_TRIGGER_RTRACKER, - STAGEFLAG_CI_TRIGGER_IR, - STAGEFLAG_CI_TRIGGER_XRAY, - STAGEFLAG_CI_TRIGGER_DISGUISE, - STAGEFLAG_CI_TRIGGER_CLOAK, - }; - - return flags[deviceindex]; -} - -char *dtGetDescription(void) -{ - u32 texts[] = { -#if VERSION >= VERSION_PAL_BETA - /*0*/ L_DISH_186, // Data uplink - /*1*/ L_DISH_185, // ECM mine - /*2*/ L_DISH_177, // CamSpy - /*3*/ L_DISH_178, // Night vision - /*4*/ L_DISH_179, // Door decoder - /*5*/ L_DISH_183, // R-tracker - /*6*/ L_DISH_182, // IR scanner - /*7*/ L_DISH_180, // X-ray scanner - /*8*/ L_DISH_181, // Disguise - /*9*/ L_DISH_184, // Cloak -#else - /*0*/ L_MISC_280, // Data uplink - /*1*/ L_MISC_279, // ECM mine - /*2*/ L_MISC_271, // CamSpy - /*3*/ L_MISC_272, // Night vision - /*4*/ L_MISC_273, // Door decoder - /*5*/ L_MISC_277, // R-tracker - /*6*/ L_MISC_276, // IR scanner - /*7*/ L_MISC_274, // X-ray scanner - /*8*/ L_MISC_275, // Disguise - /*9*/ L_MISC_278, // Cloak -#endif - }; - - return langGet(texts[dtGetIndexBySlot(g_DtSlot)]); -} - -char *dtGetTip1(void) -{ - u32 texts[] = { -#if VERSION >= VERSION_PAL_BETA - /*0*/ L_DISH_263, - /*1*/ L_DISH_264, - /*2*/ L_DISH_265, - /*3*/ L_DISH_266, - /*4*/ L_DISH_267, - /*5*/ L_DISH_268, - /*6*/ L_DISH_269, - /*7*/ L_DISH_270, - /*8*/ L_DISH_271, - /*9*/ L_DISH_272, -#else - /*0*/ L_MISC_357, - /*1*/ L_MISC_358, - /*2*/ L_MISC_359, - /*3*/ L_MISC_360, - /*4*/ L_MISC_361, - /*5*/ L_MISC_362, - /*6*/ L_MISC_363, - /*7*/ L_MISC_364, - /*8*/ L_MISC_365, - /*9*/ L_MISC_366, -#endif - }; - - return langGet(texts[dtGetIndexBySlot(g_DtSlot)]); -} - -char *dtGetTip2(void) -{ - u32 texts[] = { -#if VERSION >= VERSION_PAL_BETA - /*0*/ L_DISH_273, - /*1*/ L_DISH_274, - /*2*/ L_DISH_275, - /*3*/ L_DISH_276, - /*4*/ L_DISH_277, - /*5*/ L_DISH_278, - /*6*/ L_DISH_279, - /*7*/ L_DISH_280, - /*8*/ L_DISH_281, - /*9*/ L_DISH_282, -#else - /*0*/ L_MISC_367, - /*1*/ L_MISC_368, - /*2*/ L_MISC_369, - /*3*/ L_MISC_370, - /*4*/ L_MISC_371, - /*5*/ L_MISC_372, - /*6*/ L_MISC_373, - /*7*/ L_MISC_374, - /*8*/ L_MISC_375, - /*9*/ L_MISC_376, -#endif - }; - - return langGet(texts[dtGetIndexBySlot(g_DtSlot)]); -} - -struct trainingdata *getHoloTrainingData(void) -{ - return &g_HtData; -} - -void htPushEndscreen(void) -{ - if (g_HtData.completed) { - func0f0f85e0(&g_HtCompletedMenuDialog, MENUROOT_TRAINING); - } else if (g_HtData.failed) { - func0f0f85e0(&g_HtFailedMenuDialog, MENUROOT_TRAINING); - } - - g_HtData.timeleft = 0; - g_HtData.completed = false; - g_HtData.failed = false; - g_HtData.finished = false; -} - -u8 var80088bb4 = 0; -u8 var80088bb8 = 0; - -void htTick(void) -{ - if (var80088bb8) { - if (g_HtData.intraining) { - g_HtData.timetaken += g_Vars.lvupdate60; - - if (g_Vars.currentplayer->isdead) { - htEnd(); - } - - if (chrHasStageFlag(NULL, STAGEFLAG_CI_TRIGGER_HOLO_FAILURE)) { - htEnd(); - g_HtData.failed = true; - g_HtData.timeleft = 1; - g_HtData.finished = true; - } else if (chrHasStageFlag(NULL, STAGEFLAG_CI_TRIGGER_HOLO_SUCCESS)) { - htEnd(); - g_HtData.completed = true; - g_HtData.timeleft = 1; - g_HtData.finished = true; - } - } else if (g_HtData.finished) { - if (g_HtData.timeleft <= 0) { - htPushEndscreen(); - } else { - g_HtData.timeleft -= g_Vars.lvupdate60; - } - } - } -} - -void func0f1a2198(void) -{ - if (var80088bb8 == false) { - var80088bb8 = true; - g_HtData.intraining = false; - g_HtData.failed = false; - g_HtData.completed = false; - g_HtData.finished = false; - g_HtData.timeleft = 0; - g_HtData.timetaken = 0; - chrUnsetStageFlag(NULL, STAGEFLAG_CI_HOLO_ABORTING); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_HOLO_SUCCESS); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_HOLO_FAILURE); - } -} - -void htBegin(void) -{ - struct waypoint *waypoints = g_StageSetup.waypoints; - - g_HtData.intraining = true; - g_HtData.timetaken = 0; - chrUnsetStageFlag(NULL, STAGEFLAG_CI_HOLO_ABORTING); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_HOLO_SUCCESS); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_HOLO_FAILURE); - chrSetStageFlag(NULL, func0f1a25c0(htGetIndexBySlot(var80088bb4))); - - // Disable segment leading out of the door - waypointDisableSegment(&waypoints[0x20], &waypoints[0x31]); - - g_Vars.currentplayer->training = true; - bgunSetPassiveMode(false); - chrSetStageFlag(NULL, STAGEFLAG_CI_IN_TRAINING); -} - -void htEnd(void) -{ - struct prop *prop; - s16 *propnum; - s16 propnums[256]; - s16 rooms[5] = { 0x0016, 0x0017, 0x0018, 0x0019, -1 }; - struct waypoint *waypoints = g_StageSetup.waypoints; - - g_HtData.intraining = false; - chrSetStageFlag(NULL, STAGEFLAG_CI_HOLO_ABORTING); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_TRIGGER_HOLO_FAILURE); - chrUnsetStageFlag(NULL, func0f1a25c0(htGetIndexBySlot(var80088bb4))); - - // Enable segment leading out of the door - waypointEnableSegment(&waypoints[0x20], &waypoints[0x31]); - - g_Vars.currentplayer->training = false; - roomGetProps(rooms, propnums, 256); - propnum = &propnums[0]; - - // Remove dropped weapons - while (*propnum >= 0) { - prop = &g_Vars.props[*propnum]; - - if (prop && prop->type == PROPTYPE_WEAPON) { - struct defaultobj *obj = prop->obj; - - if (obj->type == OBJTYPE_WEAPON) { - objFreePermanently(obj, true); - } - } - - propnum++; - } - - bgunSetPassiveMode(true); - chrUnsetStageFlag(NULL, STAGEFLAG_CI_IN_TRAINING); - playerDisplayHealth(); - g_Vars.currentplayer->bondhealth = 1; -} - -bool htIsUnlocked(u32 value) -{ - switch (value) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - return true; - } - - return false; -} - -s32 htGetNumUnlocked(void) -{ - s32 count = 0; - s32 i; - - for (i = 0; i < 7; i++) { - if (htIsUnlocked(i)) { - count++; - } - } - - return count; -} - -s32 htGetIndexBySlot(s32 slot) -{ - s32 index = -1; - s32 i; - - for (i = 0; i < 7; i++) { - if (htIsUnlocked(i)) { - index++; - } - - if (index == slot) { - return i; - } - } - - return 0; -} - -char *htGetName(s32 index) -{ - u32 texts[] = { -#if VERSION >= VERSION_PAL_BETA - L_DISH_316, // "Holo 1 - Looking Around" - L_DISH_317, // "Holo 2 - Movement 1" - L_DISH_318, // "Holo 3 - Movement 2" - L_DISH_319, // "Holo 4 - Unarmed Combat 1" - L_DISH_320, // "Holo 5 - Unarmed Combat 2" - L_DISH_321, // "Holo 6 - Live Combat 1" - L_DISH_322, // "Holo 7 - Live Combat 2" -#else - L_MISC_410, // "Holo 1 - Looking Around" - L_MISC_411, // "Holo 2 - Movement 1" - L_MISC_412, // "Holo 3 - Movement 2" - L_MISC_413, // "Holo 4 - Unarmed Combat 1" - L_MISC_414, // "Holo 5 - Unarmed Combat 2" - L_MISC_415, // "Holo 6 - Live Combat 1" - L_MISC_416, // "Holo 7 - Live Combat 2" -#endif - }; - - return langGet(texts[index]); -} - -u32 func0f1a25c0(s32 index) -{ - u32 flags[] = { - STAGEFLAG_CI_IN_HOLO1, - STAGEFLAG_CI_IN_HOLO2, - STAGEFLAG_CI_IN_HOLO3, - STAGEFLAG_CI_IN_HOLO4, - STAGEFLAG_CI_IN_HOLO5, - STAGEFLAG_CI_IN_HOLO6, - STAGEFLAG_CI_IN_HOLO7, - STAGEFLAG_CI_GENERAL_PURPOSE, - }; - - return flags[index]; -} - -char *htGetDescription(void) -{ - u32 texts[] = { -#if VERSION >= VERSION_PAL_BETA - L_DISH_242, - L_DISH_243, - L_DISH_244, - L_DISH_245, - L_DISH_246, - L_DISH_247, - L_DISH_248, -#else - L_MISC_336, - L_MISC_337, - L_MISC_338, - L_MISC_339, - L_MISC_340, - L_MISC_341, - L_MISC_342, -#endif - }; - - return langGet(texts[htGetIndexBySlot(var80088bb4)]); -} - -char *htGetTip1(void) -{ - u32 texts[] = { -#if VERSION >= VERSION_PAL_BETA - L_DISH_249, // "For greater precision..." - L_DISH_250, // "Think about where you want to go..." - L_DISH_251, // "Ducking enables you to..." - L_DISH_252, // "Attacking opponents from behind..." - L_DISH_253, // "Only stay close long enough..." - L_DISH_254, // "Don't hang around and wait..." - L_DISH_255, // "Go for the armed opponents..." -#else - L_MISC_343, // "For greater precision..." - L_MISC_344, // "Think about where you want to go..." - L_MISC_345, // "Ducking enables you to..." - L_MISC_346, // "Attacking opponents from behind..." - L_MISC_347, // "Only stay close long enough..." - L_MISC_348, // "Don't hang around and wait..." - L_MISC_349, // "Go for the armed opponents..." -#endif - }; - - return langGet(texts[htGetIndexBySlot(var80088bb4)]); -} - -char *htGetTip2(void) -{ - u32 texts[] = { -#if VERSION >= VERSION_PAL_BETA - L_DISH_256, // "For greater precision..." - L_DISH_257, // "Sidestepping and strafing..." - L_DISH_258, // "Ducking enables you to..." - L_DISH_259, // "Attacking opponents from behind..." - L_DISH_260, // "Only stay close long enough..." - L_DISH_261, // "Don't hang around and wait..." - L_DISH_262, // "Go for the armed opponents..." -#else - L_MISC_350, // "For greater precision..." - L_MISC_351, // "Sidestepping and strafing..." - L_MISC_352, // "Ducking enables you to..." - L_MISC_353, // "Attacking opponents from behind..." - L_MISC_354, // "Only stay close long enough..." - L_MISC_355, // "Don't hang around and wait..." - L_MISC_356, // "Go for the armed opponents..." -#endif - }; - - return langGet(texts[htGetIndexBySlot(var80088bb4)]); -} - -#if VERSION >= VERSION_JPN_FINAL -void frGetGoalTargetsText(char *buffer, char *buffer2) -{ - sprintf(buffer, "%s", langGet(L_MISC_417)); - sprintf(buffer2, "%d\n", g_FrData.goaltargets); -} -#else -void frGetGoalTargetsText(char *buffer) -{ - // "GOAL TARGETS:" - sprintf(buffer, "%s %d\n", langGet(L_MISC_417), g_FrData.goaltargets); -} -#endif - -void frGetTargetsDestroyedValue(char *buffer) -{ - sprintf(buffer, "%02d\n", g_FrData.targetsdestroyed); -} - -void frGetScoreValue(char *buffer) -{ - sprintf(buffer, "%03d\n", g_FrData.score); -} - -#if VERSION >= VERSION_JPN_FINAL -void frGetGoalScoreText(char *buffer1, char *buffer2) -{ - if (g_FrData.goalscore) { - sprintf(buffer1, "%s", langGet(L_MISC_418)); - sprintf(buffer2, "%d\n", g_FrData.goalscore); - } else { - sprintf(buffer1, ""); - sprintf(buffer2, ""); - } -} -#else -void frGetGoalScoreText(char *buffer) -{ - if (g_FrData.goalscore) { - // "GOAL SCORE:" - sprintf(buffer, "%s %d\n", langGet(L_MISC_418), g_FrData.goalscore); - } else { - sprintf(buffer, ""); - } -} -#endif - -f32 frGetAccuracy(char *buffer) -{ - f32 sum = (g_FrData.numhitsring3 - + g_FrData.numhitsbullseye - + g_FrData.numhitsring1 - + g_FrData.numhitsring2) * 100.0f; - f32 accuracy = 100.0f; - - if (g_FrData.numshots) { - accuracy = sum / (f32)g_FrData.numshots; - } - - if (accuracy > 100.0f) { - accuracy = 100.0f; - } - - sprintf(buffer, "%s%s%.2f%%\n", "", "", accuracy); - - return accuracy; -} - -#if VERSION >= VERSION_JPN_FINAL -bool frGetMinAccuracy(char *buffer1, f32 accuracy, char *buffer2) -{ - sprintf(buffer1, "%s", langGet(L_MISC_419)); - sprintf(buffer2, "%d%%\n", g_FrData.goalaccuracy); - - return accuracy < g_FrData.goalaccuracy; -} -#else -bool frGetMinAccuracy(char *buffer, f32 accuracy) -{ - // "MIN ACCURACY:" - sprintf(buffer, "%s %d%%\n", langGet(L_MISC_419), g_FrData.goalaccuracy); - - return accuracy < g_FrData.goalaccuracy; -} -#endif - -/** - * Formats either the time taken or time limit into buffer, and returns true if - * the time should induce a failure. - * - * The time limit will be used if it exists and the time take exceeds it, - * otherwise time taken will be used. - * - * Negative time taken (such as when the player aborts before the challenge - * starts) is wrapped to positive and will induce a failure. - */ -bool frFormatTime(char *buffer) -{ - s32 mins = 0; - s32 mult = 1; - f32 secs = g_FrData.timetaken / TICKS(60.0f); - u8 failed = false; - - if (g_FrData.timelimit != 255 && secs >= g_FrData.timelimit) { - failed = true; - secs = g_FrData.timelimit; - } else if (g_FrData.timetaken < 0) { - failed = true; - } - - if (secs < 0) { - mult = -1; - secs = -secs; - } - - if (secs >= 60) { - while (secs >= 60) { - secs -= 60; - mins++; - } - } - - sprintf(buffer, "%02d:%02d\n", mult * mins, (s32)secs); - - return failed; -} - -#if VERSION >= VERSION_JPN_FINAL -bool frGetHudMiddleSubtext(char *buffer1, char *buffer2) -{ - s32 secs; - s32 mins; - - sprintf(buffer2, ""); - - if (g_FrData.timetaken < TICKS(-180)) { - sprintf(buffer1, "%s", langGet(L_MISC_420)); // "FIRE TO START" - return false; - } - - if (g_FrData.timetaken < 0) { - sprintf(buffer1, "%s", langGet(L_MISC_421)); // "GET READY!" - return true; - } - - if (g_FrData.timelimit == 255) { - return false; - } - - secs = g_FrData.timelimit; - mins = 0; - - if (secs >= 60) { - while (secs >= 60) { - secs -= 60; - mins++; - } - } - - sprintf(buffer1, "%s", langGet(L_MISC_422)); // "LIMIT:" - sprintf(buffer2, "%02d:%02d\n", mins, secs); - return true; -} -#else -bool frGetHudMiddleSubtext(char *buffer) -{ - s32 secs; - s32 mins; - - if (g_FrData.timetaken < TICKS(-180)) { - sprintf(buffer, "%s", langGet(L_MISC_420)); // "FIRE TO START" - return false; - } - - if (g_FrData.timetaken < 0) { - sprintf(buffer, "%s", langGet(L_MISC_421)); // "GET READY!" - return true; - } - - if (g_FrData.timelimit == 255) { - return false; - } - - secs = g_FrData.timelimit; - mins = 0; - - if (secs >= 60) { - while (secs >= 60) { - secs -= 60; - mins++; - } - } - - sprintf(buffer, "%s %02d:%02d\n", langGet(L_MISC_422), mins, secs); // "LIMIT:" - return true; -} -#endif - -#if VERSION >= VERSION_JPN_FINAL -bool frGetFeedback(char *scorebuffer, char *zonebuffer, char *extrabuffer) -{ - u32 texts[] = { - L_MISC_423, // "ZONE 3" - L_MISC_424, // "ZONE 2" - L_MISC_425, // "ZONE 1" - L_MISC_426, // "BULL'S-EYE" - L_MISC_427, // "EXPLODED" - }; - - sprintf(extrabuffer, ""); - - if (g_FrData.feedbackzone) { - g_FrData.feedbackttl -= g_Vars.lvupdate60; - - if (g_FrData.feedbackttl <= 0) { - g_FrData.feedbackzone = 0; - g_FrData.feedbackttl = 0; - return false; - } - - if (g_FrData.feedbackzone == FRZONE_EXPLODE) { - sprintf(scorebuffer, "010\n"); - } else { - sprintf(scorebuffer, "%03d\n", g_FrData.feedbackzone); - } - - switch (g_FrData.feedbackzone) { - case FRZONE_RING3: - sprintf(zonebuffer, "%s", langGet(texts[0])); - return true; - case FRZONE_RING2: - sprintf(zonebuffer, "%s", langGet(texts[1])); - return true; - case FRZONE_RING1: - sprintf(zonebuffer, "%s", langGet(texts[2])); - return true; - case FRZONE_BULLSEYE: - sprintf(zonebuffer, "%s", langGet(texts[3])); - return true; - case FRZONE_EXPLODE: - sprintf(zonebuffer, "%s", langGet(texts[4])); - return true; - } - - sprintf(zonebuffer, "\n"); - return true; - } - - return false; -} -#else -bool frGetFeedback(char *scorebuffer, char *zonebuffer) -{ - u32 texts[] = { - L_MISC_423, // "ZONE 3" - L_MISC_424, // "ZONE 2" - L_MISC_425, // "ZONE 1" - L_MISC_426, // "BULL'S-EYE" - L_MISC_427, // "EXPLODED" - }; - - if (g_FrData.feedbackzone) { - g_FrData.feedbackttl -= g_Vars.lvupdate60; - - if (g_FrData.feedbackttl <= 0) { - g_FrData.feedbackzone = 0; - g_FrData.feedbackttl = 0; - return false; - } - - if (g_FrData.feedbackzone == FRZONE_EXPLODE) { - sprintf(scorebuffer, "010\n"); - } else { - sprintf(scorebuffer, "%03d\n", g_FrData.feedbackzone); - } - - switch (g_FrData.feedbackzone) { - case FRZONE_RING3: - sprintf(zonebuffer, "%s", langGet(texts[0])); - return true; - case FRZONE_RING2: - sprintf(zonebuffer, "%s", langGet(texts[1])); - return true; - case FRZONE_RING1: - sprintf(zonebuffer, "%s", langGet(texts[2])); - return true; - case FRZONE_BULLSEYE: - sprintf(zonebuffer, "%s", langGet(texts[3])); - return true; - case FRZONE_EXPLODE: - sprintf(zonebuffer, "%s", langGet(texts[4])); - return true; - } - - sprintf(zonebuffer, "\n"); - return true; - } - - return false; -} -#endif - -#if VERSION >= VERSION_JPN_FINAL -GLOBAL_ASM( -glabel frRenderHudElement -/* f1a3788: 27bdff88 */ addiu $sp,$sp,-120 -/* f1a378c: afa60080 */ sw $a2,0x80($sp) -/* f1a3790: 3c0e8008 */ lui $t6,0x8008 -/* f1a3794: 8dce0150 */ lw $t6,0x150($t6) -/* f1a3798: afb00034 */ sw $s0,0x34($sp) -/* f1a379c: afa70084 */ sw $a3,0x84($sp) -/* f1a37a0: 00e03025 */ move $a2,$a3 -/* f1a37a4: 00808025 */ move $s0,$a0 -/* f1a37a8: afbf003c */ sw $ra,0x3c($sp) -/* f1a37ac: afa5007c */ sw $a1,0x7c($sp) -/* f1a37b0: 3c078008 */ lui $a3,0x8008 -/* f1a37b4: afb10038 */ sw $s1,0x38($sp) -/* f1a37b8: 8ce70154 */ lw $a3,0x154($a3) -/* f1a37bc: 27a50070 */ addiu $a1,$sp,0x70 -/* f1a37c0: 27a40074 */ addiu $a0,$sp,0x74 -/* f1a37c4: afa00014 */ sw $zero,0x14($sp) -/* f1a37c8: 0fc55d49 */ jal textMeasure -/* f1a37cc: afae0010 */ sw $t6,0x10($sp) -/* f1a37d0: 8fa80070 */ lw $t0,0x70($sp) -/* f1a37d4: 8faf007c */ lw $t7,0x7c($sp) -/* f1a37d8: 8fa30080 */ lw $v1,0x80($sp) -/* f1a37dc: 0008c043 */ sra $t8,$t0,0x1 -/* f1a37e0: 27aa0074 */ addiu $t2,$sp,0x74 -/* f1a37e4: 01f8c823 */ subu $t9,$t7,$t8 -/* f1a37e8: afb9006c */ sw $t9,0x6c($sp) -/* f1a37ec: afaa0010 */ sw $t2,0x10($sp) -/* f1a37f0: 02002025 */ move $a0,$s0 -/* f1a37f4: 27a5006c */ addiu $a1,$sp,0x6c -/* f1a37f8: 27a60068 */ addiu $a2,$sp,0x68 -/* f1a37fc: 27a70070 */ addiu $a3,$sp,0x70 -/* f1a3800: 0fc54bed */ jal text0f153858 -/* f1a3804: afa30068 */ sw $v1,0x68($sp) -/* f1a3808: 0c002eeb */ jal viGetWidth -/* f1a380c: 00408025 */ move $s0,$v0 -/* f1a3810: 00028c00 */ sll $s1,$v0,0x10 -/* f1a3814: 00115c03 */ sra $t3,$s1,0x10 -/* f1a3818: 0c002eef */ jal viGetHeight -/* f1a381c: 01608825 */ move $s1,$t3 -/* f1a3820: 93a30097 */ lbu $v1,0x97($sp) -/* f1a3824: 8fae0090 */ lw $t6,0x90($sp) -/* f1a3828: 3c0c8008 */ lui $t4,0x8008 -/* f1a382c: 3c0d8008 */ lui $t5,0x8008 -/* f1a3830: 2401ff00 */ li $at,-256 -/* f1a3834: 8dad0150 */ lw $t5,0x150($t5) -/* f1a3838: 8d8c0154 */ lw $t4,0x154($t4) -/* f1a383c: 01c17824 */ and $t7,$t6,$at -/* f1a3840: 01e34825 */ or $t1,$t7,$v1 -/* f1a3844: 00034043 */ sra $t0,$v1,0x1 -/* f1a3848: afa8001c */ sw $t0,0x1c($sp) -/* f1a384c: afa80048 */ sw $t0,0x48($sp) -/* f1a3850: afa90018 */ sw $t1,0x18($sp) -/* f1a3854: afa90044 */ sw $t1,0x44($sp) -/* f1a3858: 02002025 */ move $a0,$s0 -/* f1a385c: 27a5006c */ addiu $a1,$sp,0x6c -/* f1a3860: 27a60068 */ addiu $a2,$sp,0x68 -/* f1a3864: 8fa70084 */ lw $a3,0x84($sp) -/* f1a3868: afb10020 */ sw $s1,0x20($sp) -/* f1a386c: afa20024 */ sw $v0,0x24($sp) -/* f1a3870: afa00028 */ sw $zero,0x28($sp) -/* f1a3874: afa0002c */ sw $zero,0x2c($sp) -/* f1a3878: afad0014 */ sw $t5,0x14($sp) -/* f1a387c: 0fc55d34 */ jal func0f1574d0jf -/* f1a3880: afac0010 */ sw $t4,0x10($sp) -/* f1a3884: 8fa60088 */ lw $a2,0x88($sp) -/* f1a3888: 00408025 */ move $s0,$v0 -/* f1a388c: 27a4005c */ addiu $a0,$sp,0x5c -/* f1a3890: 10c00060 */ beqz $a2,.JF0f1a3a14 -/* f1a3894: 27a50058 */ addiu $a1,$sp,0x58 -/* f1a3898: 3c188008 */ lui $t8,0x8008 -/* f1a389c: 8f180148 */ lw $t8,0x148($t8) -/* f1a38a0: 3c078008 */ lui $a3,0x8008 -/* f1a38a4: 8ce7014c */ lw $a3,0x14c($a3) -/* f1a38a8: afa00014 */ sw $zero,0x14($sp) -/* f1a38ac: 0fc55d49 */ jal textMeasure -/* f1a38b0: afb80010 */ sw $t8,0x10($sp) -/* f1a38b4: 3c198008 */ lui $t9,0x8008 -/* f1a38b8: 8f390148 */ lw $t9,0x148($t9) -/* f1a38bc: 3c078008 */ lui $a3,0x8008 -/* f1a38c0: 8ce7014c */ lw $a3,0x14c($a3) -/* f1a38c4: 27a40054 */ addiu $a0,$sp,0x54 -/* f1a38c8: 27a50050 */ addiu $a1,$sp,0x50 -/* f1a38cc: 8fa6008c */ lw $a2,0x8c($sp) -/* f1a38d0: afa00014 */ sw $zero,0x14($sp) -/* f1a38d4: 0fc55d49 */ jal textMeasure -/* f1a38d8: afb90010 */ sw $t9,0x10($sp) -/* f1a38dc: 8fab0058 */ lw $t3,0x58($sp) -/* f1a38e0: 8fac0050 */ lw $t4,0x50($sp) -/* f1a38e4: 8fad007c */ lw $t5,0x7c($sp) -/* f1a38e8: 8fa20080 */ lw $v0,0x80($sp) -/* f1a38ec: 016c4021 */ addu $t0,$t3,$t4 -/* f1a38f0: 8faa005c */ lw $t2,0x5c($sp) -/* f1a38f4: 00087043 */ sra $t6,$t0,0x1 -/* f1a38f8: 27b80074 */ addiu $t8,$sp,0x74 -/* f1a38fc: 01ae7823 */ subu $t7,$t5,$t6 -/* f1a3900: 24420011 */ addiu $v0,$v0,0x11 -/* f1a3904: afaf006c */ sw $t7,0x6c($sp) -/* f1a3908: afa20040 */ sw $v0,0x40($sp) -/* f1a390c: afa20068 */ sw $v0,0x68($sp) -/* f1a3910: afb80010 */ sw $t8,0x10($sp) -/* f1a3914: afa80070 */ sw $t0,0x70($sp) -/* f1a3918: 02002025 */ move $a0,$s0 -/* f1a391c: 27a5006c */ addiu $a1,$sp,0x6c -/* f1a3920: 27a60068 */ addiu $a2,$sp,0x68 -/* f1a3924: 27a70070 */ addiu $a3,$sp,0x70 -/* f1a3928: 0fc54bed */ jal text0f153858 -/* f1a392c: afaa0074 */ sw $t2,0x74($sp) -/* f1a3930: 0c002eeb */ jal viGetWidth -/* f1a3934: 00408025 */ move $s0,$v0 -/* f1a3938: 00028c00 */ sll $s1,$v0,0x10 -/* f1a393c: 0011cc03 */ sra $t9,$s1,0x10 -/* f1a3940: 0c002eef */ jal viGetHeight -/* f1a3944: 03208825 */ move $s1,$t9 -/* f1a3948: 3c0a8008 */ lui $t2,0x8008 -/* f1a394c: 3c0b8008 */ lui $t3,0x8008 -/* f1a3950: 8d6b0148 */ lw $t3,0x148($t3) -/* f1a3954: 8d4a014c */ lw $t2,0x14c($t2) -/* f1a3958: 8fac0044 */ lw $t4,0x44($sp) -/* f1a395c: 8fad0048 */ lw $t5,0x48($sp) -/* f1a3960: 02002025 */ move $a0,$s0 -/* f1a3964: 27a5006c */ addiu $a1,$sp,0x6c -/* f1a3968: 27a60068 */ addiu $a2,$sp,0x68 -/* f1a396c: 8fa70088 */ lw $a3,0x88($sp) -/* f1a3970: afb10020 */ sw $s1,0x20($sp) -/* f1a3974: afa20024 */ sw $v0,0x24($sp) -/* f1a3978: afa00028 */ sw $zero,0x28($sp) -/* f1a397c: afa0002c */ sw $zero,0x2c($sp) -/* f1a3980: afab0014 */ sw $t3,0x14($sp) -/* f1a3984: afaa0010 */ sw $t2,0x10($sp) -/* f1a3988: afac0018 */ sw $t4,0x18($sp) -/* f1a398c: 0fc55d34 */ jal func0f1574d0jf -/* f1a3990: afad001c */ sw $t5,0x1c($sp) -/* f1a3994: 8fa30040 */ lw $v1,0x40($sp) -/* f1a3998: 8fae006c */ lw $t6,0x6c($sp) -/* f1a399c: 00408025 */ move $s0,$v0 -/* f1a39a0: 24630001 */ addiu $v1,$v1,0x1 -/* f1a39a4: 25cffffc */ addiu $t7,$t6,-4 -/* f1a39a8: afaf006c */ sw $t7,0x6c($sp) -/* f1a39ac: 0c002eeb */ jal viGetWidth -/* f1a39b0: afa30068 */ sw $v1,0x68($sp) -/* f1a39b4: 00028c00 */ sll $s1,$v0,0x10 -/* f1a39b8: 0011c403 */ sra $t8,$s1,0x10 -/* f1a39bc: 0c002eef */ jal viGetHeight -/* f1a39c0: 03008825 */ move $s1,$t8 -/* f1a39c4: 3c198008 */ lui $t9,0x8008 -/* f1a39c8: 3c0a8008 */ lui $t2,0x8008 -/* f1a39cc: 8d4a0148 */ lw $t2,0x148($t2) -/* f1a39d0: 8f39014c */ lw $t9,0x14c($t9) -/* f1a39d4: 8fab0044 */ lw $t3,0x44($sp) -/* f1a39d8: 8fac0048 */ lw $t4,0x48($sp) -/* f1a39dc: 02002025 */ move $a0,$s0 -/* f1a39e0: 27a5006c */ addiu $a1,$sp,0x6c -/* f1a39e4: 27a60068 */ addiu $a2,$sp,0x68 -/* f1a39e8: 8fa7008c */ lw $a3,0x8c($sp) -/* f1a39ec: afb10020 */ sw $s1,0x20($sp) -/* f1a39f0: afa20024 */ sw $v0,0x24($sp) -/* f1a39f4: afa00028 */ sw $zero,0x28($sp) -/* f1a39f8: afa0002c */ sw $zero,0x2c($sp) -/* f1a39fc: afaa0014 */ sw $t2,0x14($sp) -/* f1a3a00: afb90010 */ sw $t9,0x10($sp) -/* f1a3a04: afab0018 */ sw $t3,0x18($sp) -/* f1a3a08: 0fc55d34 */ jal func0f1574d0jf -/* f1a3a0c: afac001c */ sw $t4,0x1c($sp) -/* f1a3a10: 00408025 */ move $s0,$v0 -.JF0f1a3a14: -/* f1a3a14: 8fbf003c */ lw $ra,0x3c($sp) -/* f1a3a18: 02001025 */ move $v0,$s0 -/* f1a3a1c: 8fb00034 */ lw $s0,0x34($sp) -/* f1a3a20: 8fb10038 */ lw $s1,0x38($sp) -/* f1a3a24: 03e00008 */ jr $ra -/* f1a3a28: 27bd0078 */ addiu $sp,$sp,0x78 -); - -//Gfx *frRenderHudElement(Gfx *gdl, s32 x, s32 y, char *string1, char *string2, char *string3, u32 colour, u8 alpha) -//{ -// s32 textheight; // 74 -// s32 textwidth; // 70 -// s32 x2; // 6c -// s32 y2; // 68 -// -// u32 halfalpha = alpha >> 1; -// u32 fullcolour = (colour & 0xffffff00) | alpha; -// -// textMeasure(&textheight, &textwidth, string1, g_CharsHandelGothicMd, g_FontHandelGothicMd, 0); -// -// x2 = x - (textwidth >> 1); -// y2 = y; -// gdl = text0f153858(gdl, &x2, &y2, &textwidth, &textheight); -// -// gdl = textRender(gdl, &x2, &y2, string1, -// g_CharsHandelGothicMd, g_FontHandelGothicMd, fullcolour, halfalpha, viGetWidth(), viGetHeight(), 0, 0); -// -// if (string2) { -// s32 textheight2; // 5c -// s32 textwidth2; // 58 -// s32 textheight3; // 54 -// s32 textwidth3; // 50 -// -// textMeasure(&textheight2, &textwidth2, string2, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); -// textMeasure(&textheight3, &textwidth3, string3, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); -// -// textwidth = textwidth2 + textwidth3; -// textheight = textheight3; -// x2 = x - (textwidth >> 1); -// y2 = y + 17; -// -// gdl = text0f153858(gdl, &x2, &y2, &textwidth, &textheight); -// -// gdl = func0f1574d0jf(gdl, &x2, &y2, string2, -// g_CharsHandelGothicXs, g_FontHandelGothicXs, fullcolour, halfalpha, viGetWidth(), viGetHeight(), 0, 0); -// -// x2 -= 4; -// y2 = y + 18; -// -// gdl = func0f1574d0jf(gdl, &x2, &y2, string3, -// g_CharsHandelGothicXs, g_FontHandelGothicXs, fullcolour, halfalpha, viGetWidth(), viGetHeight(), 0, 0); -// } -// -// return gdl; -//} -#else -Gfx *frRenderHudElement(Gfx *gdl, s32 x, s32 y, char *string1, char *string2, u32 colour, u8 alpha) -{ - s32 textheight; - s32 textwidth; - s32 x2; - s32 y2; - - u32 halfalpha = alpha >> 1; - u32 fullcolour = (colour & 0xffffff00) | alpha; - - textMeasure(&textheight, &textwidth, string1, g_CharsHandelGothicMd, g_FontHandelGothicMd, 0); - - x2 = x - (textwidth >> 1); - y2 = y; - gdl = text0f153858(gdl, &x2, &y2, &textwidth, &textheight); - - gdl = textRender(gdl, &x2, &y2, string1, - g_CharsHandelGothicMd, g_FontHandelGothicMd, fullcolour, halfalpha, viGetWidth(), viGetHeight(), 0, 0); - - if (string2) { - textMeasure(&textheight, &textwidth, string2, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); - - x2 = x - (textwidth >> 1); - y2 = y + 17; - gdl = text0f153858(gdl, &x2, &y2, &textwidth, &textheight); - - gdl = textRender(gdl, &x2, &y2, string2, - g_CharsHandelGothicXs, g_FontHandelGothicXs, fullcolour, halfalpha, viGetWidth(), viGetHeight(), 0, 0); - } - - return gdl; -} -#endif - -#if VERSION >= VERSION_JPN_FINAL -Gfx *frRenderHud(Gfx *gdl) -{ - char string1[128]; - char string2[128]; - char string3[128]; - bool red; - bool exists; - s32 alpha = 0xa0; - f32 mult; - - if (viGetViewWidth() > 400) { - mult = 1.7f; - } else { - mult = 1; - } - - if (!g_FrIsValidWeapon && g_FrData.menucountdown <= 0) { - return gdl; - } - - if (g_FrData.menucountdown != 0) { - alpha = (f32)(g_FrData.menucountdown * 160) / TICKS(60.0f); - } - - gdl = text0f153628(gdl); - - // Time - red = frFormatTime(string1); - exists = frGetHudMiddleSubtext(string2, string3); - - gdl = frRenderHudElement(gdl, viGetViewWidth() >> 1, viGetViewTop() + 12, - string1, - exists ? string2 : NULL, - exists ? string3 : NULL, - red ? 0xff4444ff : 0x00ff00a0, - alpha); - - // Score - frGetScoreValue(string1); - frGetGoalScoreText(string2, string3); - gdl = frRenderHudElement(gdl, viGetViewLeft() + 65.0f * mult, viGetViewTop() + 12, - string1, string2, string3, 0x00ff00a0, alpha); - - // Feedback - if (frGetFeedback(string1, string2, string3)) { - gdl = frRenderHudElement(gdl,viGetViewLeft() + 65.0f * mult, viGetViewTop() + 48, - string1, string2, string3, 0x00ff00a0, alpha); - } - - if (g_FrData.goalaccuracy > 0) { - red = frGetMinAccuracy(string2, frGetAccuracy(string1), string3); - - gdl = frRenderHudElement(gdl, viGetViewLeft() + viGetViewWidth() - 70.0f * mult, viGetViewTop() + 12, - string1, string2, string3, - red ? 0xff4444ff : 0x00ff00a0, - alpha); - } else if (g_FrData.goaltargets != 255) { - frGetTargetsDestroyedValue(string1); - frGetGoalTargetsText(string2, string3); - - if (mult == 2) { - mult = 2.4; - } - - gdl = frRenderHudElement(gdl, viGetViewLeft() + viGetViewWidth() - 70.0f * mult, viGetViewTop() + 12, - string1, string2, string3, 0x00ff00a0, alpha); - } - - return text0f153780(gdl); -} -#else -Gfx *frRenderHud(Gfx *gdl) -{ - char string1[128]; - char string2[128]; - bool red; - bool exists; - s32 alpha = 0xa0; - f32 mult; - - if (viGetViewWidth() > (VERSION >= VERSION_PAL_FINAL ? 330 : 400)) { - mult = VERSION >= VERSION_PAL_FINAL ? 1.5f : 2; - } else { - mult = 1; - } - - if (!g_FrIsValidWeapon && g_FrData.menucountdown <= 0) { - return gdl; - } - - if (g_FrData.menucountdown != 0) { - alpha = (f32)(g_FrData.menucountdown * 160) / TICKS(60.0f); - } - - gdl = text0f153628(gdl); - - // Time - red = frFormatTime(string1); - exists = frGetHudMiddleSubtext(string2); - - gdl = frRenderHudElement(gdl, viGetViewWidth() >> 1, viGetViewTop() + 12, - string1, exists ? string2 : NULL, - red ? 0xff0000a0 : 0x00ff00a0, - alpha); - - // Score - frGetScoreValue(string1); - frGetGoalScoreText(string2); - gdl = frRenderHudElement(gdl, viGetViewLeft() + 65.0f * mult, viGetViewTop() + 12, - string1, string2, 0x00ff00a0, alpha); - - // Feedback - if (frGetFeedback(string1, string2)) { - gdl = frRenderHudElement(gdl,viGetViewLeft() + 65.0f * mult, viGetViewTop() + 40, - string1, string2, 0x00ff00a0, alpha); - } - - if (g_FrData.goalaccuracy > 0) { - red = frGetMinAccuracy(string2, frGetAccuracy(string1)); - - gdl = frRenderHudElement(gdl, viGetViewLeft() + viGetViewWidth() - 70.0f * mult, viGetViewTop() + 12, - string1, string2, - red ? 0xff0000a0 : 0x00ff00a0, - alpha); - } else if (g_FrData.goaltargets != 255) { - frGetTargetsDestroyedValue(string1); - frGetGoalTargetsText(string2); - - if (mult == 2) { - mult = 2.4; - } - - gdl = frRenderHudElement(gdl, viGetViewLeft() + viGetViewWidth() - 70.0f * mult, viGetViewTop() + 12, - string1, string2, 0x00ff00a0, alpha); - } - - return text0f153780(gdl); -} -#endif diff --git a/src/game/trainingmenus.c b/src/game/trainingmenus.c deleted file mode 100644 index 004546567..000000000 --- a/src/game/trainingmenus.c +++ /dev/null @@ -1,2857 +0,0 @@ -#include -#include "constants.h" -#include "game/chraction.h" -#include "game/ceil.h" -#include "game/bondgun.h" -#include "game/game_0b0fd0.h" -#include "game/tex.h" -#include "game/menugfx.h" -#include "game/menu.h" -#include "game/mainmenu.h" -#include "game/inv.h" -#include "game/game_1531a0.h" -#include "game/file.h" -#include "game/texdecompress.h" -#include "game/trainingmenus.h" -#include "game/training.h" -#include "game/lang.h" -#include "game/mplayer/mplayer.h" -#include "game/options.h" -#include "bss.h" -#include "lib/vi.h" -#include "lib/main.h" -#include "data.h" -#include "types.h" - -#define NUM_BIO_LOCATIONS 14 - -struct menudialogdef g_BioProfileMenuDialog; -struct menudialogdef g_BioTextMenuDialog; -struct menudialogdef g_HangarLocationDetailsMenuDialog; -struct menudialogdef g_HangarVehicleDetailsMenuDialog; - -s32 frDetailsOkMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - s32 i; - - switch (operation) { - case MENUOP_CHECKPREFOCUSED: - return true; - case MENUOP_SET: - if (frIsInTraining() == false) { - s32 weapon = frGetWeaponBySlot(frGetSlot()); - - if (g_FrWeaponNum != WEAPON_UNARMED) { - invRemoveItemByNum(g_FrWeaponNum); - } - - if (weapon != WEAPON_UNARMED) { - invGiveSingleWeapon(weapon); - } - - invSetCurrentIndex(1); - - if (bgunGetWeaponNum(HAND_RIGHT) != weapon) { - bgunEquipWeapon2(HAND_RIGHT, weapon); - } - - g_FrWeaponNum = weapon; - - for (i = 0; i < 4; i++) { - g_Vars.currentplayer->hands[0].gunroundsspent[i] = 0; - g_Vars.currentplayer->hands[1].gunroundsspent[i] = 0; - } - - frBeginSession(weapon); - } - - func0f0f8120(); - break; - } - - return 0; -} - -s32 frAbortMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - if (frIsInTraining()) { - frEndSession(true); - } - } - - return 0; -} - -struct menudialogdef g_FrDifficultyMenuDialog; - -s32 frWeaponListMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - s32 weaponnum; - s32 score; - Gfx *gdl; - struct menuitemrenderdata *renderdata; - u32 colour; - s32 weaponnum2; - s32 score2; - s32 i; - s32 x; - s32 y; - - switch (operation) { - case MENUOP_GETOPTIONHEIGHT: - data->list.value = LINEHEIGHT; - break; - case MENUOP_GETOPTGROUPCOUNT: - data->list.value = 0; - break; - case MENUOP_GETOPTGROUPTEXT: - return 0; - case MENUOP_GETGROUPSTARTINDEX: - data->list.groupstartindex = 0; - break; - case MENUOP_GETOPTIONCOUNT: - data->list.value = frGetNumWeaponsAvailable(); - break; - case MENUOP_GETOPTIONTEXT: - return 0; - case MENUOP_SET: - weaponnum = frGetWeaponBySlot(data->list.value); - score = ciGetFiringRangeScore(frGetWeaponIndexByWeapon(weaponnum)); - -#if VERSION < VERSION_NTSC_1_0 - if (g_Menus[g_MpPlayerNum].layers[g_Menus[g_MpPlayerNum].depth - 1].numsiblings > 1) { - menuCloseDialog(); - menuPushDialog(&g_FrWeaponListMenuDialog); - } -#endif - - frLoadData(); - frSetSlot(data->list.value); - - if (score) { - frSetDifficulty(ciGetFiringRangeScore(frGetWeaponIndexByWeapon(weaponnum))); - menuPushDialog(&g_FrDifficultyMenuDialog); - } else { - frSetDifficulty(FRDIFFICULTY_BRONZE); - menuPushDialog(&g_FrTrainingInfoPreGameMenuDialog); - } - break; - case MENUOP_GETSELECTEDINDEX: - data->list.value = frGetSlot(); - break; - case MENUOP_RENDER: - gdl = data->type19.gdl; - renderdata = data->type19.renderdata2; - weaponnum2 = frGetWeaponBySlot(data->type19.unk04); - score2 = ciGetFiringRangeScore(frGetWeaponIndexByWeapon(weaponnum2)); - - // Render weapon name - x = renderdata->x + 10; - y = renderdata->y; - -#if VERSION == VERSION_JPN_FINAL - y++; -#endif - - gdl = text0f153628(gdl); - gdl = textRenderProjected(gdl, &x, &y, bgunGetName(weaponnum2), g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, viGetWidth(), viGetHeight(), 0, 0); - gdl = text0f153780(gdl); - - // Prepare the star texture for the difficulties - gDPPipeSync(gdl++); - gDPSetTexturePersp(gdl++, G_TP_NONE); - gDPSetAlphaCompare(gdl++, G_AC_NONE); - gDPSetTextureLOD(gdl++, G_TL_TILE); - gDPSetTextureConvert(gdl++, G_TC_FILT); - gDPSetTextureFilter(gdl++, G_TF_POINT); - - texSelect(&gdl, &g_TexGeneralConfigs[35], 2, 0, 2, 1, NULL); - - gDPSetCycleType(gdl++, G_CYC_1CYCLE); - gDPSetCombineMode(gdl++, G_CC_DECALRGBA, G_CC_DECALRGBA); - gDPSetTextureFilter(gdl++, G_TF_POINT); - - // Iterate and render the 3 difficulty stars - for (i = 0; i < 3; i++) { - if (score2 > i) { - switch (i) { - case FRDIFFICULTY_BRONZE: - colour = 0x884400ff; - break; - case FRDIFFICULTY_SILVER: - colour = 0x99999fff; - break; - case FRDIFFICULTY_GOLD: - colour = 0xbb9922ff; - break; - } - } else { - colour = 0x99999944; - } - -#if VERSION >= VERSION_NTSC_1_0 - colour = (colour & 0xffffff00) | (((colour & 0xff) * (renderdata->colour & 0xff)) >> 8); -#endif - - gDPSetEnvColorViaWord(gdl++, colour); - - gDPSetCombineLERP(gdl++, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0); - - gSPTextureRectangle(gdl++, - (((renderdata->x + i * 13) + 125) << 2) * g_ScaleX, (renderdata->y) << 2, - (((renderdata->x + i * 13) + 136) << 2) * g_ScaleX, (renderdata->y + 11) << 2, - G_TX_RENDERTILE, 0, 0x0160, 1024 / g_ScaleX, -1024); - } - - return (s32)gdl; - } - - return 0; -} - -s32 frTrainingInfoMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - u32 stack; - s32 weaponnum; - - switch (operation) { - case MENUOP_OPEN: - weaponnum = frGetWeaponBySlot(frGetSlot()); - g_Menus[g_MpPlayerNum].training.weaponnum = weaponnum; - func0f105948(weaponnum); - - if (!frIsInTraining()) { - frInitAmmo(weaponnum); - } - break; - case MENUOP_TICK: - if (g_Menus[g_MpPlayerNum].curdialog && g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) { - g_Menus[g_MpPlayerNum].unk840.unk574 -= g_Vars.diffframe60; - g_Menus[g_MpPlayerNum].unk840.unk54c = 18.849555969238f * g_20SecIntervalFrac; - g_Menus[g_MpPlayerNum].unk840.unk524 = 18.849555969238f * g_20SecIntervalFrac; - g_Menus[g_MpPlayerNum].unk840.unk528 = 0; - g_Menus[g_MpPlayerNum].unk840.unk550 = 0; - } - break; - case MENUOP_CLOSE: - if (!frIsInTraining()) { - frEndSession(true); - } - break; - } - - return 0; -} - -s32 frTrainingStatsMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - if (operation == MENUOP_CLOSE) { - if (frIsInTraining() == false) { - frEndSession(true); - } - } - - return 0; -} - -/** - * This is an unused menu handler which implements the difficulty selection - * using a dropdown. - */ -s32 frDifficultyDropdownMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - u16 names[] = { - L_MPMENU_439, // "Bronze" - L_MPMENU_440, // "Silver" - L_MPMENU_441, // "Gold" - }; - - switch (operation) { - case MENUOP_GETOPTIONCOUNT: - data->dropdown.value = ciGetFiringRangeScore(frGetSlot()) + 1; - - if (data->dropdown.value > 3) { - data->dropdown.value = 3; - } - break; - case MENUOP_GETOPTIONTEXT: - return (s32) langGet(names[data->dropdown.value]); - case MENUOP_SET: - frSetDifficulty(data->dropdown.value); - menuPushDialog(&g_FrTrainingInfoPreGameMenuDialog); - break; - case MENUOP_GETSELECTEDINDEX: - data->dropdown.value = frGetDifficulty(); - break; - } - - return 0; -} - -s32 frDifficultyMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_CHECKHIDDEN: - if (ciGetFiringRangeScore(frGetWeaponIndexByWeapon(frGetWeaponBySlot(frGetSlot()))) < item->param) { - return true; - } - break; - case MENUOP_SET: - frSetDifficulty(item->param); - menuPushDialog(&g_FrTrainingInfoPreGameMenuDialog); - break; - case MENUOP_CHECKPREFOCUSED: - if (ciGetFiringRangeScore(frGetWeaponIndexByWeapon(frGetWeaponBySlot(frGetSlot()))) >= item->param) { - return true; - } - break; - } - - return 0; -} - -char *frPrimaryFunctionMenuText(struct menuitem *item) -{ - struct weaponfunc *func = weaponGetFunctionById(frGetWeaponBySlot(frGetSlot()), FUNC_PRIMARY); - - if (func) { - return langGet(func->name); - } - - return "\n"; -} - -char *frSecondaryFunctionMenuText(struct menuitem *item) -{ - struct weaponfunc *func = weaponGetFunctionById(frGetWeaponBySlot(frGetSlot()), FUNC_SECONDARY); - - if (func) { - return langGet(func->name); - } - - return "\n"; -} - -char *frMenuTextFailReason(struct menuitem *item) -{ - u16 reasons[] = { - L_MPMENU_456, // "Not Failed" - L_MPMENU_457, // "Out of Ammo" - L_MPMENU_458, // "Time Over" - L_MPMENU_459, // "Score Unattainable" - L_MPMENU_460, // "Too Inaccurate" - }; - - struct frdata *frdata = frGetData(); - - return langGet(reasons[frdata->failreason]); -} - -char *frMenuTextDifficultyName(struct menuitem *item) -{ - u16 names[] = { - L_MPMENU_439, // "Bronze" - L_MPMENU_440, // "Silver" - L_MPMENU_441, // "Gold" - }; - - struct frdata *frdata = frGetData(); - - return langGet(names[frdata->difficulty]); -} - -char *frMenuTextTimeTakenValue(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - f32 secs = frdata->timetaken / (PAL ? 50.0f : 60.0f); - - if (secs > frdata->timelimit) { - secs = frdata->timelimit; - } - - if (secs >= 60.0f) { - s32 mins = 0; - - while (secs >= 60.0f) { - secs -= 60.0f; - mins++; - } - - sprintf(g_StringPointer, "%dm %2ds\n", mins, (s32)ceilf(secs)); - return g_StringPointer; - } else { - sprintf(g_StringPointer, "%s%s%2.2fs\n", "", "", secs); - } - - return g_StringPointer; -} - -char *frMenuTextScoreValue(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - sprintf(g_StringPointer, "%d\n", frdata->score); - return g_StringPointer; -} - -char *frMenuTextGoalScoreValueUnconditional(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - sprintf(g_StringPointer, "%d\n", frdata->goalscore); - return g_StringPointer; -} - -char *frMenuTextWeaponName(struct menuitem *item) -{ - return bgunGetName(frGetWeaponBySlot(frGetSlot())); -} - -char *frMenuTextTargetsDestroyedValue(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - sprintf(g_StringPointer, "%d\n", frdata->targetsdestroyed); - return g_StringPointer; -} - -char *frMenuTextAccuracyValue(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - f32 totalhits = (frdata->numhitsring3 + frdata->numhitsbullseye + frdata->numhitsring1 + frdata->numhitsring2) * 100.0f; - f32 accuracy = 0; - - if (frdata->numshots) { - accuracy = totalhits / frdata->numshots; - } - - if (accuracy > 100.0f) { - accuracy = 100.0f; - } - - sprintf(g_StringPointer, "%s%s%.1f%%\n", "", "", accuracy); - return g_StringPointer; -} - -char *frMenuTextGoalScoreLabel(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - if (frdata->goalscore > 0) { - sprintf(g_StringPointer, "%s", langGet(L_MPMENU_475)); // "Goal Score:" - return g_StringPointer; - } - - return NULL; -} - -char *frMenuTextGoalScoreValue(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - if (frdata->goalscore > 0) { - sprintf(g_StringPointer2, "%d\n", frdata->goalscore); - return g_StringPointer2; - } - - return NULL; -} - -char *frMenuTextMinAccuracyOrTargetsLabel(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - if (frdata->goalaccuracy > 0) { - sprintf(g_StringPointer, "%s", langGet(L_MPMENU_473)); // "Min Accuracy:" - } else if (frdata->goaltargets != 255) { - sprintf(g_StringPointer, "%s", langGet(L_MPMENU_474)); // "Goal Targets:" - } else { - return NULL; - } - - return g_StringPointer; -} - -char *frMenuTextMinAccuracyOrTargetsValue(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - if (frdata->goalaccuracy > 0) { - sprintf(g_StringPointer2, "%d%%\n", frdata->goalaccuracy); - } else if (frdata->goaltargets != 255) { - sprintf(g_StringPointer2, "%d\n", frdata->goaltargets); - } else { - return NULL; - } - - return g_StringPointer2; -} - -char *frMenuTextTimeLimitLabel(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - if (frdata->timelimit != 255) { - sprintf(g_StringPointer, "%s", langGet(L_MPMENU_472)); // "Time Limit:" - } else { - return NULL; - } - - return g_StringPointer; -} - -char *frMenuTextTimeLimitValue(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - if (frdata->timelimit != 255) { - s32 secs = frdata->timelimit; - s32 mins = 0; - - while (secs >= 60) { - secs -= 60; - mins++; - } - - if (mins > 0) { - sprintf(g_StringPointer2, "%dm %ds\n", mins, secs); - } else { - sprintf(g_StringPointer2, "%ds\n", secs); - } - } else { - return NULL; - } - - return g_StringPointer2; -} - -char *frMenuTextAmmoLimitLabel(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - - if (frdata->ammolimit != 255) { - sprintf(g_StringPointer, "%s", langGet(L_MPMENU_471)); // "Ammo Limit:" - } else { - return NULL; - } - - return g_StringPointer; -} - -char *frMenuTextAmmoLimitValue(struct menuitem *item) -{ - struct frdata *frdata = frGetData(); - char suffix[16]; - s32 weaponnum; - - if (frdata->ammolimit != 255) { - weaponnum = frGetWeaponBySlot(frdata->slot); - - if (weaponnum == WEAPON_SUPERDRAGON && frdata->sdgrenadelimit != 255) { - sprintf(suffix, "/%d", frdata->sdgrenadelimit); - } else { - suffix[0] = '\0'; - } - - sprintf(g_StringPointer2, "%d%s\n", frdata->ammolimit, suffix); - } else { - return NULL; - } - - return g_StringPointer2; -} - -/** - * Render the "Scoring" section of the firing range results screen. - * - * The screen contains a diagram of a target with the zones marked, - * as well as the player's score chart. There are lines leading from - * the score chart to the diagram. - */ -s32 frScoringMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_RENDER) { - Gfx *gdl = data->type19.gdl; - struct menuitemrenderdata *renderdata = data->type19.renderdata2; - s32 x; - s32 y; - s32 textheight; - s32 textwidth; - struct textureconfig *tconfig = &g_TexGeneralConfigs[50]; - struct frdata *frdata = frGetData(); - char text[128]; - bool failed = frdata->menutype == FRMENUTYPE_FAILED; -#if VERSION >= VERSION_JPN_FINAL - u32 linecolourmid = failed ? 0xff644477 : 0x00ff0077; // line gradient colour in middle - u32 linecolourfig = failed ? 0xff664400 : 0x00ff0000; // line gradient colour at figures - u32 linecolourtex = failed ? 0xff664433 : 0x00ff0033; // line gradient colour at target texture -#else - u32 linecolourmid = failed ? 0xff000077 : 0x00ff0077; // line gradient colour in middle - u32 linecolourfig = failed ? 0xff000000 : 0x00ff0000; // line gradient colour at figures - u32 linecolourtex = failed ? 0xff000033 : 0x00ff0033; // line gradient colour at target texture -#endif - -#if VERSION >= VERSION_NTSC_1_0 - u32 colour; -#endif - - static u32 x1 = 0; - static u32 x2 = 0; - static u32 y1 = 0; - static u32 y2 = 0; - static u32 x3 = 0; - static u32 x4 = 0; - static u32 y3 = 0; - static u32 y4 = 0; - -#if VERSION >= VERSION_NTSC_1_0 - linecolourmid = (linecolourmid & 0xffffff00) | ((linecolourmid & 0xff) * (renderdata->colour & 0xff) >> 8); - linecolourfig = (linecolourfig & 0xffffff00) | ((linecolourfig & 0xff) * (renderdata->colour & 0xff) >> 8); - linecolourtex = (linecolourtex & 0xffffff00) | ((linecolourtex & 0xff) * (renderdata->colour & 0xff) >> 8); -#endif - - mainOverrideVariable("x1", &x1); - mainOverrideVariable("x2", &x2); - mainOverrideVariable("y1", &y1); - mainOverrideVariable("y2", &y2); - mainOverrideVariable("x3", &x3); - mainOverrideVariable("x4", &x4); - mainOverrideVariable("y3", &y3); - mainOverrideVariable("y4", &y4); - - gDPPipeSync(gdl++); - gDPSetTexturePersp(gdl++, G_TP_NONE); - gDPSetAlphaCompare(gdl++, G_AC_NONE); - gDPSetTextureLOD(gdl++, G_TL_TILE); - gDPSetTextureConvert(gdl++, G_TC_FILT); - gDPSetTextureFilter(gdl++, G_TF_POINT); - - texSelect(&gdl, tconfig, 2, 0, 2, 1, NULL); - - gDPSetCycleType(gdl++, G_CYC_1CYCLE); - gDPSetCombineMode(gdl++, G_CC_DECALRGBA, G_CC_DECALRGBA); - gDPSetTextureFilter(gdl++, G_TF_POINT); - -#if VERSION >= VERSION_NTSC_1_0 - colour = ((failed ? 0xff777799 : 0x55ff5588) & 0xffffff00) | (((failed ? 0xff777799 : 0x55ff5588) & 0xff) * (renderdata->colour & 0xff) >> 8); - gDPSetEnvColorViaWord(gdl++, colour); -#else - gDPSetEnvColorViaWord(gdl++, failed ? 0xff777799 : 0x55ff5588); -#endif - - gDPSetCombineLERP(gdl++, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0); - - // Top left quarter of target - gSPTextureRectangle(gdl++, - ((renderdata->x + 10) << 2) * g_ScaleX, (renderdata->y + 5) << 2, - ((renderdata->x + 42) << 2) * g_ScaleX, (renderdata->y + 37) << 2, - G_TX_RENDERTILE, 16, 1024, 1024 / g_ScaleX, -1024); - - // Top right quarter of target - gSPTextureRectangle(gdl++, - ((renderdata->x + 41) << 2) * g_ScaleX, (renderdata->y + 5) << 2, - ((renderdata->x + 73) << 2) * g_ScaleX, (renderdata->y + 37) << 2, - G_TX_RENDERTILE, 16, 1024, -1024 / g_ScaleX, -1024); - - // Bottom left quarter of target - gSPTextureRectangle(gdl++, - ((renderdata->x + 10) << 2) * g_ScaleX, (renderdata->y + 36) << 2, - ((renderdata->x + 42) << 2) * g_ScaleX, (renderdata->y + 68) << 2, - G_TX_RENDERTILE, 16, 1024, 1024 / g_ScaleX, 1024); - - // Bottom right quarter of target - gSPTextureRectangle(gdl++, - ((renderdata->x + 41) << 2) * g_ScaleX, (renderdata->y + 36) << 2, - ((renderdata->x + 73) << 2) * g_ScaleX, (renderdata->y + 68) << 2, - G_TX_RENDERTILE, 16, 1024, -1024 / g_ScaleX, 1024); - -#if VERSION >= VERSION_NTSC_1_0 - gdl = textSetPrimColour(gdl, ((failed ? 0xff000055 : 0x00ff0055) & 0xffffff00) | (((failed ? 0xff000055 : 0x00ff0055) & 0xff) * (renderdata->colour & 0xff) >> 8)); - colour = ((failed ? 0xff6969aa : renderdata->colour) & 0xffffff00) | ((((failed ? 0xff6969aa : renderdata->colour) & 0xff) * (renderdata->colour & 0xff)) >> 8); -#else - gdl = textSetPrimColour(gdl, failed ? 0xff000055 : 0x00ff0055); -#endif - - // NTSC beta uses a static alpha channel, while newer versions take the - // alpha from the menu item's renderdata. Additionally, NTSC beta - // repeats its colour calculation throughout this function while newer - // versions store it in a variable. To prevent having version checks - // everywhere, this has been implemented here using macros. -#if VERSION >= VERSION_NTSC_1_0 -#define COLOUR() (colour) -#define COLOURWHITE() (0xffffff00 | (((renderdata->colour & 0xff) * 0xff) >> 8)) -#else -#define COLOUR() (failed ? 0xff6969aa : renderdata->colour) -#define COLOURWHITE() 0xffffffff -#endif - - // Bull's-eye count - sprintf(text, "%d\n", frdata->numhitsbullseye); - x = renderdata->x + 93; - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 15 : 14); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // "Bull's-eye" - sprintf(text, langGet(L_MPMENU_461)); - x = renderdata->x + 122; - y = renderdata->y + 14; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // Bull's-eye score - sprintf(text, "%d\n", frdata->numhitsbullseye * 10); - textMeasure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); - x = renderdata->x - textheight + (VERSION == VERSION_JPN_FINAL ? 192 : 182); - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 15 : 14); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // Zone 1 count - sprintf(text, "%d\n", frdata->numhitsring1); - x = renderdata->x + 93; - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 27 : 25); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // "Zone 1" - sprintf(text, langGet(L_MPMENU_462)); - x = renderdata->x + 122; - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 26 : 25); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // Zone 1 score - sprintf(text, "%d\n", frdata->numhitsring1 * 5); - textMeasure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); - x = renderdata->x - textheight + (VERSION == VERSION_JPN_FINAL ? 192 : 182); - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 27 : 25); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // Zone 2 count - sprintf(text, "%d\n", frdata->numhitsring2); - x = renderdata->x + 93; - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 39 : 36); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // "Zone 2" - sprintf(text, langGet(L_MPMENU_463)); - x = renderdata->x + 122; - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 38 : 36); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // Zone 2 score - sprintf(text, "%d\n", frdata->numhitsring2 * 2); - textMeasure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); - x = renderdata->x - textheight + (VERSION == VERSION_JPN_FINAL ? 192 : 182); - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 39 : 36); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // Zone 3 count - sprintf(text, "%d\n", frdata->numhitsring3); - x = renderdata->x + 93; - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 51 : 47); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // "Zone 3" - // Note: developers forgot to remove last argument when copy/pasting - sprintf(text, langGet(L_MPMENU_464), frdata->numhitsring3); - x = renderdata->x + 122; - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 50 : 47); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // Zone 3 score - sprintf(text, "%d\n", frdata->numhitsring3); - textMeasure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); - x = renderdata->x - textheight + (VERSION == VERSION_JPN_FINAL ? 192 : 182); - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 51 : 47); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // "Hit total" - sprintf(text, langGet(L_MPMENU_465)); - x = renderdata->x + 133; - y = renderdata->y + 63; - -#if VERSION >= VERSION_JPN_FINAL - x -= 44; - y += 3; -#endif - - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // Hit total count - sprintf(text, "%d\n", frdata->numhitsring3 + frdata->numhitsbullseye + frdata->numhitsring1 + frdata->numhitsring2); - textMeasure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); - x = renderdata->x - textheight + 188; - y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 64 : 63); - -#if VERSION >= VERSION_JPN_FINAL - x -= 27; - y += 3; -#endif - - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // "Scoring" - sprintf(text, langGet(L_MPMENU_466)); - x = renderdata->x + 83; - y = renderdata->y + 1; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), viGetWidth(), viGetHeight(), 0, 0); - - // "10" - sprintf(text, langGet(L_MPMENU_467)); - x = renderdata->x + 38; - y = renderdata->y + 35; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), viGetWidth(), viGetHeight(), 0, 0); - - // "5" - sprintf(text, langGet(L_MPMENU_468)); - x = renderdata->x + 32; - y = renderdata->y + 26; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), viGetWidth(), viGetHeight(), 0, 0); - - // "2" - sprintf(text, langGet(L_MPMENU_469)); - x = renderdata->x + 24; - y = renderdata->y + 16; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), viGetWidth(), viGetHeight(), 0, 0); - - // "1" - sprintf(text, langGet(L_MPMENU_470)); - x = renderdata->x + 14; - y = renderdata->y + 4; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), viGetWidth(), viGetHeight(), 0, 0); - - gdl = text0f153838(gdl); - - // Render lines between the score table and the target texture - - // Horizontal lines - bottom left - gdl = menugfxDrawFilledRect(gdl, renderdata->x + 45, renderdata->y + 36, renderdata->x + 81, renderdata->y + 37, linecolourtex, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 52, renderdata->y + 44, renderdata->x + 84, renderdata->y + 45, linecolourtex, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 62, renderdata->y + 50, renderdata->x + 87, renderdata->y + 51, linecolourtex, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 70, renderdata->y + 60, renderdata->x + 90, renderdata->y + 61, linecolourtex, linecolourmid); - -#if VERSION >= VERSION_JPN_FINAL - // Vertical lines - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 81, renderdata->y + 17, renderdata->x + 82, renderdata->y + 37, linecolourmid, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 84, renderdata->y + 29, renderdata->x + 85, renderdata->y + 45, linecolourmid, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 87, renderdata->y + 41, renderdata->x + 88, renderdata->y + 51, linecolourmid, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 90, renderdata->y + 53, renderdata->x + 91, renderdata->y + 61, linecolourmid, linecolourmid); - - // Horizontal lines - top right - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 81, renderdata->y + 17, renderdata->x + 96, renderdata->y + 18, linecolourmid, linecolourfig); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 84, renderdata->y + 29, renderdata->x + 96, renderdata->y + 30, linecolourmid, linecolourfig); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 87, renderdata->y + 41, renderdata->x + 96, renderdata->y + 42, linecolourmid, linecolourfig); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 90, renderdata->y + 53, renderdata->x + 96, renderdata->y + 54, linecolourmid, linecolourfig); -#else - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 81, renderdata->y + 17, renderdata->x + 82, renderdata->y + 37, linecolourmid, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 84, renderdata->y + 28, renderdata->x + 85, renderdata->y + 45, linecolourmid, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 87, renderdata->y + 39, renderdata->x + 88, renderdata->y + 51, linecolourmid, linecolourmid); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 90, renderdata->y + 50, renderdata->x + 91, renderdata->y + 61, linecolourmid, linecolourmid); - - // Horizontal lines - top right - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 81, renderdata->y + 17, renderdata->x + 96, renderdata->y + 18, linecolourmid, linecolourfig); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 84, renderdata->y + 28, renderdata->x + 96, renderdata->y + 29, linecolourmid, linecolourfig); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 87, renderdata->y + 39, renderdata->x + 96, renderdata->y + 40, linecolourmid, linecolourfig); - gdl = menugfxDrawDialogBorderLine(gdl, renderdata->x + 90, renderdata->y + 50, renderdata->x + 96, renderdata->y + 51, linecolourmid, linecolourfig); -#endif - - return (s32)gdl; - } - - return 0; -} - -#if VERSION >= VERSION_NTSC_1_0 -s32 menuhandlerFrFailedContinue(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - if (g_Vars.currentplayer->prop->rooms[0] == 0xa) { - func0f0f3704(&g_FrWeaponListMenuDialog); - } else { - menuPopDialog(); - } - } - - return 0; -} -#endif - -struct menuitem g_FrDifficultyMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING, - L_MPMENU_444, // "Select Difficulty:" - L_MPMENU_445, // "" - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_439, // "Bronze" - L_OPTIONS_003, // "" - frDifficultyMenuHandler, - }, - { - MENUITEMTYPE_SELECTABLE, - 1, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_440, // "Silver" - L_OPTIONS_003, // "" - frDifficultyMenuHandler, - }, - { - MENUITEMTYPE_SELECTABLE, - 2, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_441, // "Gold" - L_OPTIONS_003, // "" - frDifficultyMenuHandler, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_429, // "Cancel" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_FrDifficultyMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_442, // "Difficulty" - g_FrDifficultyMenuItems, - NULL, - MENUDIALOGFLAG_DISABLERESIZE, - NULL, -}; - -struct menuitem g_FrWeaponListMenuItems[] = { - { - MENUITEMTYPE_LIST, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_LIST_CUSTOMRENDER, - 0x000000aa, - 0, - frWeaponListMenuHandler, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_FrWeaponListMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_446, // "Weapon" - g_FrWeaponListMenuItems, - NULL, - MENUDIALOGFLAG_DISABLERESIZE, - NULL, -}; - -struct menuitem g_FrTrainingInfoInGameMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_443, // "Difficulty:" - (u32)&frMenuTextDifficultyName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - (u32)&frMenuTextGoalScoreLabel, - (u32)&frMenuTextGoalScoreValue, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - (u32)&frMenuTextMinAccuracyOrTargetsLabel, - (u32)&frMenuTextMinAccuracyOrTargetsValue, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - (u32)&frMenuTextTimeLimitLabel, - (u32)&frMenuTextTimeLimitValue, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - (u32)&frMenuTextAmmoLimitLabel, - (u32)&frMenuTextAmmoLimitValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_FRWEAPON, - MENUITEMFLAG_DARKERBG, - 0x0000010e, - PAL ? 0x69 : 0x5f, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_SELECTABLE_CENTRE, - L_OPTIONS_003, // "" - L_MPMENU_428, // "Resume" - frDetailsOkMenuHandler, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_SELECTABLE_CENTRE, - L_OPTIONS_003, // "" - L_MPMENU_430, // "Abort" - frAbortMenuHandler, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_FrTrainingInfoInGameMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_447, // "Training Info" - g_FrTrainingInfoInGameMenuItems, - frTrainingInfoMenuDialog, - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_DISABLERESIZE | MENUDIALOGFLAG_0400, - NULL, -}; - -struct menuitem g_FrTrainingInfoPreGameMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_443, // "Difficulty:" - (u32)&frMenuTextDifficultyName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - (u32)&frMenuTextGoalScoreLabel, - (u32)&frMenuTextGoalScoreValue, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - (u32)&frMenuTextMinAccuracyOrTargetsLabel, - (u32)&frMenuTextMinAccuracyOrTargetsValue, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - (u32)&frMenuTextTimeLimitLabel, - (u32)&frMenuTextTimeLimitValue, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - (u32)&frMenuTextAmmoLimitLabel, - (u32)&frMenuTextAmmoLimitValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_FRWEAPON, - MENUITEMFLAG_DARKERBG, - 0x0000010e, - PAL ? 0x69 : 0x5f, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_SELECTABLE_CENTRE, - L_OPTIONS_003, // "" - L_MPMENU_427, // "Ok" - frDetailsOkMenuHandler, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG | MENUITEMFLAG_SELECTABLE_CENTRE, - L_OPTIONS_003, // "" - L_MPMENU_429, // "Cancel" - frAbortMenuHandler, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_FrTrainingInfoPreGameMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_447, // "Training Info" - g_FrTrainingInfoPreGameMenuItems, - frTrainingInfoMenuDialog, - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_DISABLERESIZE | MENUDIALOGFLAG_0400, - NULL, -}; - -struct menuitem g_FrCompletedMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_449, // "Completed!" - 0, - NULL, - }, -#if VERSION < VERSION_NTSC_1_0 - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, -#endif - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_450, // "Score:" - (u32)&frMenuTextScoreValue, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_451, // "Targets Destroyed:" - (u32)&frMenuTextTargetsDestroyedValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_452, // "Difficulty:" - (u32)&frMenuTextDifficultyName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_453, // "Time Taken:" - (u32)&frMenuTextTimeTakenValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_454, // "Weapon:" - (u32)&frMenuTextWeaponName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_455, // "Accuracy:" - (u32)&frMenuTextAccuracyValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_MODEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LIST_CUSTOMRENDER, - 0x000000d2, - 0x00000050, - frScoringMenuHandler, - }, -#if VERSION >= VERSION_NTSC_1_0 - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPWEAPONS_252, // "Continue" - 0, - menuhandlerFrFailedContinue, - }, -#endif - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_FrCompletedMenuDialog = { - MENUDIALOGTYPE_SUCCESS, - L_MPMENU_448, // "Training Stats" - g_FrCompletedMenuItems, - frTrainingStatsMenuDialog, -#if VERSION >= VERSION_NTSC_1_0 - MENUDIALOGFLAG_STARTSELECTS, - NULL, -#else - 0, - &g_FrWeaponListMenuDialog, -#endif -}; - -struct menuitem g_FrFailedMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - (u32)&frMenuTextFailReason, - 0, - NULL, - }, -#if VERSION < VERSION_NTSC_1_0 - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, -#endif - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_450, // "Score:" - (u32)&frMenuTextScoreValue, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_451, // "Targets Destroyed:" - (u32)&frMenuTextTargetsDestroyedValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_452, // "Difficulty:" - (u32)&frMenuTextDifficultyName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_453, // "Time Taken:" - (u32)&frMenuTextTimeTakenValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_454, // "Weapon:" - (u32)&frMenuTextWeaponName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_455, // "Accuracy:" - (u32)&frMenuTextAccuracyValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_MODEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LIST_CUSTOMRENDER, - 0x000000d2, - 0x00000050, - frScoringMenuHandler, - }, -#if VERSION >= VERSION_NTSC_1_0 - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPWEAPONS_252, // "Continue" - 0, - menuhandlerFrFailedContinue, - }, -#endif - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_FrFailedMenuDialog = { - MENUDIALOGTYPE_DANGER, - L_MPMENU_448, // "Training Stats" - g_FrFailedMenuItems, - frTrainingStatsMenuDialog, -#if VERSION >= VERSION_NTSC_1_0 - MENUDIALOGFLAG_STARTSELECTS, - NULL, -#else - 0, - &g_FrWeaponListMenuDialog, -#endif -}; - -s32 ciOfficeInformationMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - struct optiongroup groups[2] = { - { 0, L_MPMENU_421 }, // "Character Profiles" - { 0, L_MPMENU_422 }, // "Other Information" - }; - - s32 numunlockedchrbios = ciGetNumUnlockedChrBios(); - s32 numunlockedmiscbios = ciGetNumUnlockedMiscBios(); - struct chrbio *chrbio; - struct miscbio *miscbio; - - groups[1].offset = numunlockedchrbios; - - switch (operation) { - case MENUOP_GETOPTIONCOUNT: - data->list.value = numunlockedchrbios + numunlockedmiscbios; - break; - case MENUOP_GETOPTIONTEXT: - if (data->list.value < numunlockedchrbios) { - chrbio = ciGetChrBioByBodynum(ciGetChrBioBodynumBySlot(data->list.value)); - return (s32) langGet(chrbio->name); - } else { - miscbio = ciGetMiscBio(ciGetMiscBioIndexBySlot(data->list.value - numunlockedchrbios)); - return (s32) langGet(miscbio->name); - } - break; - case MENUOP_SET: - g_ChrBioSlot = data->list.value; - if (g_ChrBioSlot < numunlockedchrbios) { - menuPushDialog(&g_BioProfileMenuDialog); - } else { - menuPushDialog(&g_BioTextMenuDialog); - } - break; - case MENUOP_GETSELECTEDINDEX: - data->list.value = g_ChrBioSlot; - break; - case MENUOP_GETOPTGROUPCOUNT: - data->list.value = 2; - break; - case MENUOP_GETOPTGROUPTEXT: - return (s32) langGet(groups[data->list.value].name); - case MENUOP_GETGROUPSTARTINDEX: - data->list.groupstartindex = data->list.value == 0 ? 0 : numunlockedchrbios; - break; - } - - return 0; -} - -struct menuitem g_BioListMenuItems[] = { - { - MENUITEMTYPE_LIST, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - 0x000000c8, - 0, - ciOfficeInformationMenuHandler, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_BioListMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_418, // "Information" - g_BioListMenuItems, - NULL, - 0, - NULL, -}; - -struct menuitem g_NowSafeMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_437, // "It is now safe to turn off your computer." - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - 0, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - L_MPMENU_438, // "Cancel" - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_NowSafeMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_436, // "Cheats" - g_NowSafeMenuItems, - NULL, - MENUDIALOGFLAG_DISABLERESIZE, - NULL, -}; - -s32 ciCharacterProfileMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - u32 bodynum = ciGetChrBioBodynumBySlot(g_ChrBioSlot); - u32 mpbodynum = mpGetMpbodynumByBodynum(bodynum); - u32 mpheadnum = mpGetMpheadnumByMpbodynum(mpbodynum); - f32 x; - f32 y; - f32 scale; - - switch (operation) { - case MENUOP_OPEN: - if (bodynum == BODY_DRCAROLL) { - scale = 0.7f; - g_Menus[g_MpPlayerNum].unk840.unk554 = -1; - } else { - g_Menus[g_MpPlayerNum].unk840.unk554 = 30; - scale = 1.0f; - } - - g_Menus[g_MpPlayerNum].unk840.unk574 = TICKS(120); - g_Menus[g_MpPlayerNum].unk840.unk580 = 0; - -#if VERSION == VERSION_PAL_FINAL - if (g_ViRes != VIRES_HI) { - x = -117; - - if (optionsGetScreenRatio() == SCREENRATIO_16_9) { - x = -87; - } - } else { - x = -177; - - if (optionsGetScreenRatio() == SCREENRATIO_16_9) { - x = -127; - } - } -#elif VERSION == VERSION_PAL_BETA - x = -117; - - if (optionsGetScreenRatio() == SCREENRATIO_16_9) { - x = -87; - } -#else - x = -130; - - if (optionsGetScreenRatio() == SCREENRATIO_16_9) { - x = -100; - } -#endif - - y = -15; - - if (bodynum == BODY_MRBLONDE) { - y -= 12; - } - - if (bodynum == BODY_THEKING) { - scale = 0.8f; - } - - func0f0f372c(&g_Menus[g_MpPlayerNum].unk840, x, y, 0, 0, 0, 0, scale, 7); - - g_Menus[g_MpPlayerNum].unk840.unk510 = 8.2f; - g_Menus[g_MpPlayerNum].unk840.unk514 = -4.1f; - g_Menus[g_MpPlayerNum].unk840.unk51c = 0.00393f; - g_Menus[g_MpPlayerNum].unk840.unk524 = 0; - g_Menus[g_MpPlayerNum].unk840.unk54c = 0; - g_Menus[g_MpPlayerNum].unk840.unk578 = TICKS(60); - break; - case MENUOP_CLOSE: - break; - case MENUOP_TICK: - if (bodynum == BODY_DRCAROLL) { - static struct modelpartvisibility vis[] = { - { MODELPART_DRCAROLL_0001, false }, - { MODELPART_DRCAROLL_0002, false }, - { MODELPART_DRCAROLL_0003, false }, - { MODELPART_DRCAROLL_0004, false }, - { MODELPART_DRCAROLL_0005, false }, - { MODELPART_DRCAROLL_0007, false }, - { MODELPART_DRCAROLL_0008, false }, - { MODELPART_DRCAROLL_0009, false }, - { MODELPART_DRCAROLL_000A, false }, - { MODELPART_DRCAROLL_000B, false }, - { 255 }, - }; - - g_Menus[g_MpPlayerNum].unk840.partvisibility = vis; - g_Menus[g_MpPlayerNum].unk840.unk05c = 318; - } else { - g_Menus[g_MpPlayerNum].unk840.unk05c = 106; - } - - if (bodynum == BODY_THEKING) { - static struct modelpartvisibility vis[] = { - { MODELPART_CHR_RIGHTHAND, false }, - { 255 }, - }; - - g_Menus[g_MpPlayerNum].unk840.partvisibility = vis; - } - - g_Menus[g_MpPlayerNum].unk840.unk00c = 0xffff; - g_Menus[g_MpPlayerNum].unk840.unk00c |= (mpheadnum << 16); - g_Menus[g_MpPlayerNum].unk840.unk00c |= (mpbodynum << 24); - - if (g_Menus[g_MpPlayerNum].unk840.unk578 > 0) { - g_Menus[g_MpPlayerNum].unk840.unk578 -= g_Vars.diffframe60; - } else { -#if VERSION >= VERSION_PAL_BETA - f32 tmp = g_Menus[g_MpPlayerNum].unk840.unk524 + 0.01f * g_Vars.diffframe60freal; -#else - f32 tmp = g_Menus[g_MpPlayerNum].unk840.unk524 + 0.01f * g_Vars.diffframe60f; -#endif - g_Menus[g_MpPlayerNum].unk840.unk54c = tmp; - g_Menus[g_MpPlayerNum].unk840.unk524 = tmp; - } - - break; - } - - return 0; -} - -char *ciMenuTextChrBioName(struct menuitem *item) -{ - struct chrbio *bio = ciGetChrBioByBodynum(ciGetChrBioBodynumBySlot(g_ChrBioSlot)); - sprintf(g_StringPointer, "%s\n", langGet(bio->name)); - - return g_StringPointer; -} - -char *ciMenuTextChrBioAge(struct menuitem *item) -{ - struct chrbio *bio = ciGetChrBioByBodynum(ciGetChrBioBodynumBySlot(g_ChrBioSlot)); - sprintf(g_StringPointer, "%s\n", langGet(bio->age)); - - return g_StringPointer; -} - -char *ciMenuTextChrBioRace(struct menuitem *item) -{ - struct chrbio *bio = ciGetChrBioByBodynum(ciGetChrBioBodynumBySlot(g_ChrBioSlot)); - sprintf(g_StringPointer, "%s\n", langGet(bio->race)); - - return g_StringPointer; -} - -char *ciMenuTextMiscBioName(struct menuitem *item) -{ - struct miscbio *bio = ciGetMiscBio(ciGetMiscBioIndexBySlot(g_ChrBioSlot - ciGetNumUnlockedChrBios())); - - sprintf(g_StringPointer, "%s\n", langGet(bio->name)); - - return g_StringPointer; -} - -s32 dtDeviceListMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_GETOPTIONCOUNT: - data->list.value = dtGetNumAvailable(); - break; - case MENUOP_GETOPTIONTEXT: - return (s32) bgunGetName(dtGetWeaponByDeviceIndex(dtGetIndexBySlot(data->list.value))); - case MENUOP_SET: - g_DtSlot = data->list.value; - menuPushDialog(&g_DtDetailsMenuDialog); - break; - case MENUOP_GETSELECTEDINDEX: - data->list.value = g_DtSlot; - break; - case MENUOP_GETOPTGROUPCOUNT: - data->list.value = 0; - break; - case MENUOP_GETOPTGROUPTEXT: - return 0; - case MENUOP_GETGROUPSTARTINDEX: - data->list.groupstartindex = 0; - break; - } - - return 0; -} - -char *dtMenuTextName(struct menuitem *item) -{ - u32 weaponnum = dtGetWeaponByDeviceIndex(dtGetIndexBySlot(g_DtSlot)); - - return bgunGetName(weaponnum); -} - -s32 menuhandlerDtOkOrResume(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - // @bug: dtBegin() should not be called if training is already in - // progress. Doing this resets the training timer. - dtBegin(); - func0f0f8120(); - } - - return 0; -} - -s32 menuhandler001a6514(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - dtEnd(); - } - - return 0; -} - -struct menuitem g_BioProfileMenuItems[] = { - { - MENUITEMTYPE_MODEL, - 0, - MENUITEMFLAG_00000002, - 0x00000046, - 0x00000096, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_NEWCOLUMN | MENUITEMFLAG_00000002, - L_MPMENU_432, // "Name:" - (u32)&ciMenuTextChrBioName, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_433, // "Age:" - (u32)&ciMenuTextChrBioAge, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_434, // "Race:" - (u32)&ciMenuTextChrBioRace, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_CHRBIO, - 0, - 0x000000b4, - 0x00000064, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_435, // "Press the B Button to go back." - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_BioProfileMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_431, // "Character Profile" - g_BioProfileMenuItems, - ciCharacterProfileMenuDialog, - MENUDIALOGFLAG_0002, - NULL, -}; - -struct menuitem g_BioTextMenuItems[] = { - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_MISCBIO, - 0, - 0x000000c8, - 0x00000096, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_414, // "Press the B Button to go back." - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_BioTextMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&ciMenuTextMiscBioName, - g_BioTextMenuItems, - NULL, - MENUDIALOGFLAG_DISABLERESIZE, - NULL, -}; - -struct menuitem g_DtListMenuItems[] = { - { - MENUITEMTYPE_LIST, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - 0x000000a0, - 0, - dtDeviceListMenuHandler, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_DtListMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_417, // "Device List" - g_DtListMenuItems, - NULL, - 0, - NULL, -}; - -s32 dtTrainingDetailsMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - switch (operation) { - case MENUOP_OPEN: - { - s32 weaponnum = dtGetWeaponByDeviceIndex(dtGetIndexBySlot(g_DtSlot)); - u16 unused[] = {64250, 38500, 25650, 25700, 12950}; - func0f1a1ac0(); - g_Menus[g_MpPlayerNum].training.weaponnum = weaponnum; - func0f105948(weaponnum); - -#if VERSION == VERSION_PAL_FINAL - if (g_ViRes == VIRES_HI) { - if (optionsGetScreenRatio() == SCREENRATIO_16_9) { - g_Menus[g_MpPlayerNum].unk840.unk538 = 84; - g_Menus[g_MpPlayerNum].unk840.unk510 = 84; - } else { - g_Menus[g_MpPlayerNum].unk840.unk538 = 104; - g_Menus[g_MpPlayerNum].unk840.unk510 = 104; - } - } else { - if (optionsGetScreenRatio() == SCREENRATIO_16_9) { - g_Menus[g_MpPlayerNum].unk840.unk538 = 64; - g_Menus[g_MpPlayerNum].unk840.unk510 = 64; - } else { - g_Menus[g_MpPlayerNum].unk840.unk538 = 84; - g_Menus[g_MpPlayerNum].unk840.unk510 = 84; - } - } -#elif VERSION == VERSION_PAL_BETA - if (optionsGetScreenRatio() == SCREENRATIO_16_9) { - g_Menus[g_MpPlayerNum].unk840.unk538 = 64; - g_Menus[g_MpPlayerNum].unk840.unk510 = 64; - } else { - g_Menus[g_MpPlayerNum].unk840.unk538 = 84; - g_Menus[g_MpPlayerNum].unk840.unk510 = 84; - } -#else - if (optionsGetScreenRatio() == SCREENRATIO_16_9) { - g_Menus[g_MpPlayerNum].unk840.unk538 = 70; - g_Menus[g_MpPlayerNum].unk840.unk510 = 70; - } else { - g_Menus[g_MpPlayerNum].unk840.unk538 = 90; - g_Menus[g_MpPlayerNum].unk840.unk510 = 90; - } -#endif - - g_Menus[g_MpPlayerNum].unk840.unk544 /= 2.5f; - } - break; - case MENUOP_CLOSE: - break; - case MENUOP_TICK: - if (g_Menus[g_MpPlayerNum].curdialog && g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) { - s32 weaponnum = dtGetWeaponByDeviceIndex(dtGetIndexBySlot(g_DtSlot)); - - if (weaponnum == WEAPON_DISGUISE41) { - g_Menus[g_MpPlayerNum].unk840.unk05c = ANIM_006A; - g_Menus[g_MpPlayerNum].unk840.unk578 = TICKS(60); - g_Menus[g_MpPlayerNum].unk840.unk574 = TICKS(120); - } - - g_Menus[g_MpPlayerNum].unk840.unk54c = 18.849555969238f * g_20SecIntervalFrac; - g_Menus[g_MpPlayerNum].unk840.unk524 = 18.849555969238f * g_20SecIntervalFrac; - g_Menus[g_MpPlayerNum].unk840.unk550 = 0; - g_Menus[g_MpPlayerNum].unk840.unk528 = 0; - } - break; - } - - return 0; -} - -char *dtMenuTextOkOrResume(struct menuitem *item) -{ - struct trainingdata *data = dtGetData(); - - if (data->intraining) { - return langGet(L_MPMENU_428); // "Resume" - } - - return langGet(L_MPMENU_427); // "Ok" -} - -char *dtMenuTextCancelOrAbort(struct menuitem *item) -{ - struct trainingdata *data = dtGetData(); - - if (data->intraining) { - return langGet(L_MPMENU_430); // "Abort" - } - - return langGet(L_MPMENU_429); // "Cancel" -} - -char *dtMenuTextTimeTakenValue(struct menuitem *item) -{ - struct trainingdata *data = dtGetData(); - f32 secs = data->timetaken / (PAL ? 50.0f : 60.0f); - - if (secs >= 60.0f) { - s32 mins = 0; - - while (secs >= 60.0f) { - secs -= 60.0f; - mins++; - } - - sprintf(g_StringPointer, "%dm %2ds\n", mins, (s32)ceilf(secs)); - return g_StringPointer; - } else { - sprintf(g_StringPointer, "%s%s%2.2fs\n", "", "", secs); - } - - return g_StringPointer; -} - -s32 menudialogDeviceTrainingResults(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - if (operation == MENUOP_CLOSE) { - chrSetStageFlag(NULL, 0x08000000); - } - - return false; -} - -s32 htHoloListMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - switch (operation) { - case MENUOP_GETOPTIONCOUNT: - data->list.value = htGetNumUnlocked(); - break; - case MENUOP_GETOPTIONTEXT: - return (s32) htGetName(htGetIndexBySlot(data->list.value)); - case MENUOP_SET: - var80088bb4 = data->list.value; - menuPushDialog(&g_HtDetailsMenuDialog); - break; - case MENUOP_GETSELECTEDINDEX: - data->list.value = var80088bb4; - break; - case MENUOP_GETOPTGROUPCOUNT: - data->list.value = 0; - break; - case MENUOP_GETOPTGROUPTEXT: - return 0; - case MENUOP_GETGROUPSTARTINDEX: - data->list.groupstartindex = 0; - break; - } - - return 0; -} - -char *htMenuTextName(struct menuitem *item) -{ - return htGetName(htGetIndexBySlot(var80088bb4)); -} - -s32 menuhandler001a6a34(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - htBegin(); - func0f0f8120(); - } - - return 0; -} - -s32 menuhandler001a6a70(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_SET) { - htEnd(); - } - - return 0; -} - -s32 menudialog001a6aa4(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - switch (operation) { - case MENUOP_OPEN: - func0f1a2198(); - break; - case MENUOP_CLOSE: - break; - } - - return false; -} - -char *htMenuTextOkOrResume(struct menuitem *item) -{ - struct trainingdata *data = getHoloTrainingData(); - - if (data->intraining) { - return langGet(L_MPMENU_428); // "Resume" - } - - return langGet(L_MPMENU_427); // "Ok" -} - -char *htMenuTextCancelOrAbort(struct menuitem *item) -{ - struct trainingdata *data = getHoloTrainingData(); - - if (data->intraining) { - return langGet(L_MPMENU_430); // "Abort" - } - - return langGet(L_MPMENU_429); // "Cancel" -} - -char *htMenuTextTimeTakenValue(struct menuitem *item) -{ - struct trainingdata *data = getHoloTrainingData(); - f32 secs = data->timetaken / (PAL ? 50.0f : 60.0f); - - if (secs >= 60.0f) { - s32 mins = 0; - - while (secs >= 60.0f) { - secs -= 60.0f; - mins++; - } - - sprintf(g_StringPointer, "%dm %2ds\n", mins, (s32)ceilf(secs)); - return g_StringPointer; - } else { - sprintf(g_StringPointer, "%s%s%2.2fs\n", "", "", secs); - } - - return g_StringPointer; -} - -s32 menudialogFiringRangeResults(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - if (operation == MENUOP_CLOSE) { - chrSetStageFlag(NULL, 0x08000000); - } - - return false; -} - -char *bioMenuTextName(struct menuitem *item) -{ - struct hangarbio *bio = ciGetHangarBio(ciGetHangarBioIndexBySlot(g_HangarBioSlot)); - - return langGet(bio->name); -} - -/** - * The subheading is stored in the same string as the name, separated by a pipe. - * eg. "Lucerne Tower\0|Global headquarters\n" - */ -char *ciMenuTextHangarBioSubheading(struct menuitem *item) -{ - s32 index = 0; - struct hangarbio *bio = ciGetHangarBio(ciGetHangarBioIndexBySlot(g_HangarBioSlot)); - char *name = langGet(bio->name); - - while (name[index] != '|') { - index++; - } - - sprintf(g_StringPointer, "%s\n", &name[index + 1]); - - return g_StringPointer; -} - -struct menuitem g_DtDetailsMenuItems[] = { - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_DEVICETRAINING, - 0, - 0x000000aa, - PAL ? 0xd6 : 0xbe, - NULL, - }, - { - MENUITEMTYPE_MODEL, - 0, - MENUITEMFLAG_NEWCOLUMN | MENUITEMFLAG_00000002, - 0x0000008c, - PAL ? 0xb4 : 0x9c, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - (u32)&dtMenuTextOkOrResume, - 0, - menuhandlerDtOkOrResume, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - (u32)&dtMenuTextCancelOrAbort, - 0, - menuhandler001a6514, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_DtDetailsMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&dtMenuTextName, - g_DtDetailsMenuItems, - dtTrainingDetailsMenuDialog, - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_STARTSELECTS | MENUDIALOGFLAG_DISABLERESIZE, - NULL, -}; - -struct menuitem g_DtFailedMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_426, // "Failed!" - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_424, // "Time Taken:" - (u32)&dtMenuTextTimeTakenValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_DEVICETIP1, - 0, - 0x00000082, - PAL ? 110 : 100, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_DtFailedMenuDialog = { - MENUDIALOGTYPE_DANGER, - L_MPMENU_423, // "Training Stats" - g_DtFailedMenuItems, - menudialogDeviceTrainingResults, - MENUDIALOGFLAG_DISABLERESIZE, - &g_DtListMenuDialog, -}; - -struct menuitem g_DtCompletedMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_425, // "Completed!" - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_424, // "Time Taken:" - (u32)&dtMenuTextTimeTakenValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_DEVICETIP2, - 0, - 0x00000082, - PAL ? 110 : 100, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_DtCompletedMenuDialog = { - MENUDIALOGTYPE_SUCCESS, - L_MPMENU_423, // "Training Stats" - g_DtCompletedMenuItems, - menudialogDeviceTrainingResults, - MENUDIALOGFLAG_DISABLERESIZE, - &g_DtListMenuDialog, -}; - -struct menuitem g_HtListMenuItems[] = { - { - MENUITEMTYPE_LIST, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - 0x000000a0, - 0, - htHoloListMenuHandler, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_HtListMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_416, // "Holotraining" - g_HtListMenuItems, - NULL, - 0, - NULL, -}; - -struct menuitem g_HtDetailsMenuItems[] = { - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_HOLOTRAINING, - 0, - 0x000000aa, - 0x000000be, - NULL, - }, - { - MENUITEMTYPE_MODEL, - 0, - MENUITEMFLAG_NEWCOLUMN | MENUITEMFLAG_00000002, - 0x0000008c, - 0x0000009c, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - (u32)&htMenuTextOkOrResume, - 0, - menuhandler001a6a34, - }, - { - MENUITEMTYPE_SELECTABLE, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - (u32)&htMenuTextCancelOrAbort, - 0, - menuhandler001a6a70, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_HtDetailsMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&htMenuTextName, - g_HtDetailsMenuItems, - menudialog001a6aa4, - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_STARTSELECTS | MENUDIALOGFLAG_DISABLERESIZE, - NULL, -}; - -struct menuitem g_HtFailedMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_426, // "Failed!" - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_424, // "Time Taken:" - (u32)&htMenuTextTimeTakenValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_HOLOTIP1, - 0, - 0x00000082, -#if VERSION >= VERSION_JPN_FINAL - 120, -#elif PAL - 110, -#else - 100, -#endif - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_HtFailedMenuDialog = { - MENUDIALOGTYPE_DANGER, - L_MPMENU_423, // "Training Stats" - g_HtFailedMenuItems, - menudialogFiringRangeResults, - MENUDIALOGFLAG_DISABLERESIZE, - &g_HtListMenuDialog, -}; - -struct menuitem g_HtCompletedMenuItems[] = { - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LESSLEFTPADDING | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_425, // "Completed!" - 0, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002, - L_MPMENU_424, // "Time Taken:" - (u32)&htMenuTextTimeTakenValue, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_HOLOTIP2, - 0, - 0x00000082, -#if VERSION >= VERSION_JPN_FINAL - 120, -#elif PAL - 110, -#else - 100, -#endif - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_HtCompletedMenuDialog = { - MENUDIALOGTYPE_SUCCESS, - L_MPMENU_423, // "Training Stats" - g_HtCompletedMenuItems, - menudialogFiringRangeResults, - MENUDIALOGFLAG_DISABLERESIZE, - &g_HtListMenuDialog, -}; - -s32 ciHangarInformationMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - struct optiongroup groups[2] = { - { 0, L_MPMENU_419 }, // "Locations" - { 0, L_MPMENU_420 }, // "Vehicles" - }; - - s32 bioindex; - struct hangarbio *bio; - - groups[1].offset = ciGetNumUnlockedLocationBios(); - - switch (operation) { - case MENUOP_GETOPTIONCOUNT: - data->list.value = ciGetNumUnlockedHangarBios(); - break; - case MENUOP_GETOPTIONTEXT: - bio = ciGetHangarBio(ciGetHangarBioIndexBySlot(data->list.value)); - return (s32) langGet(bio->name); - case MENUOP_SET: - g_HangarBioSlot = data->list.value; - bioindex = ciGetHangarBioIndexBySlot(g_HangarBioSlot); - - if (bioindex <= HANGARBIO_SKEDARRUINS) { - menuPushDialog(&g_HangarLocationDetailsMenuDialog); - } else { - menuPushDialog(&g_HangarVehicleDetailsMenuDialog); - } - break; - case MENUOP_GETSELECTEDINDEX: - data->list.value = g_HangarBioSlot; - break; - case MENUOP_GETOPTGROUPCOUNT: - data->list.value = 2; - break; - case MENUOP_GETOPTGROUPTEXT: - return (s32) langGet(groups[data->list.value].name); - case MENUOP_GETGROUPSTARTINDEX: - data->list.groupstartindex = data->list.value == 0 ? 0 : groups[1].offset; - break; - } - - return 0; -} - -s32 ciHangarTitleMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data) -{ - if (operation == MENUOP_RENDER) { - Gfx *gdl = data->type19.gdl; - struct menuitemrenderdata *renderdata = data->type19.renderdata2; - s32 textwidth; - s32 textheight; - s32 leftmargin; - char *text; - s32 index = ciGetHangarBioIndexBySlot(g_HangarBioSlot); - - if (index < NUM_BIO_LOCATIONS) { - // Location bio - render texture - u8 texturenums[] = { 0x1b, 0x0d, 0x0e, 0x10, 0x11, 0x12, 0x13, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1c, 0x1d }; - s32 texturenum = texturenums[index]; - - gDPPipeSync(gdl++); - gDPSetTexturePersp(gdl++, G_TP_NONE); - gDPSetAlphaCompare(gdl++, G_AC_NONE); - gDPSetTextureLOD(gdl++, G_TL_TILE); - gDPSetTextureConvert(gdl++, G_TC_FILT); - - texSelect(&gdl, &g_TexGeneralConfigs[texturenum], 1, 0, 2, 1, NULL); - - gDPSetCycleType(gdl++, G_CYC_1CYCLE); - gDPSetCombineMode(gdl++, G_CC_DECALRGBA, G_CC_DECALRGBA); - gDPSetTextureFilter(gdl++, G_TF_POINT); - -#if VERSION >= VERSION_NTSC_1_0 - gDPSetEnvColorViaWord(gdl++, 0xffffff00 | ((renderdata->colour & 0xff) * 255) >> 8); -#endif - - gSPTextureRectangle(gdl++, - ((renderdata->x + 6) << 2) * g_ScaleX, (renderdata->y + 3) << 2, - ((renderdata->x + 60) << 2) * g_ScaleX, (renderdata->y + 39) << 2, - G_TX_RENDERTILE, 0, 0x0480, 1024 / g_ScaleX, -1024); - - leftmargin = -1; - } else { - // Vehicle bio - leftmargin = item->param2 / 2; - } - - gdl = text0f153628(gdl); - - // Render title - text = bioMenuTextName(NULL); - textMeasure(&textheight, &textwidth, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, 0); - - if (leftmargin == -1) { - textwidth = renderdata->x + 64; - } else { - textwidth = (renderdata->x + leftmargin) - (textwidth >> 1); - } - - textheight = renderdata->y + 8; - gdl = textRenderProjected(gdl, &textwidth, &textheight, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, renderdata->colour, viGetWidth(), viGetHeight(), 0, 0); - - // Render subheading - text = ciMenuTextHangarBioSubheading(NULL); - textMeasure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); - - if (leftmargin == -1) { - textwidth = renderdata->x + 64; - } else { - textwidth = (renderdata->x + leftmargin) - (textwidth >> 1); - } - - textheight = renderdata->y + 25; - gdl = textRenderProjected(gdl, &textwidth, &textheight, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, viGetWidth(), viGetHeight(), 0, 0); - - gdl = text0f153780(gdl); - - return (s32)gdl; - } - - return 0; -} - -struct biovehicleitem { - u32 fileid; - s32 y_offset; - u16 size; -}; - -struct modelpartvisibility g_BioPartVisibility[] = { - { MODELPART_SKSHUTTLE_GANGWAY, false }, - { MODELPART_CHOPPER_0005, false }, - { MODELPART_ROBOT_0004, false }, - { 255 }, -}; - -s32 ciHangarHolographMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data) -{ - s32 index = ciGetHangarBioIndexBySlot(g_HangarBioSlot); - - if (index >= NUM_BIO_LOCATIONS) { - struct biovehicleitem items[] = { - // File ID, Y offset, size - { FILE_PDROPSHIP, 7, 8 }, - { FILE_PHOVERCRATE1, -5, 600 }, - { FILE_PHOVBIKE, -10, 50 }, - { FILE_PHOOVERBOT, -20, 1000 }, - { FILE_PDD_HOVERCOPTER, 35, 30 }, - { FILE_CCHICROB, 0, 70 }, - { FILE_PA51INTERCEPTOR, -30, 500 }, - { FILE_PELVIS_SAUCER, 0, 15 }, - { FILE_PSK_SHUTTLE, 0, 10 }, - }; - - switch (operation) { - case MENUOP_OPEN: - g_Menus[g_MpPlayerNum].unk840.unk548 = 0; - g_Menus[g_MpPlayerNum].unk840.unk520 = 0; - g_Menus[g_MpPlayerNum].unk840.unk54c = 0; - g_Menus[g_MpPlayerNum].unk840.unk524 = 0; - g_Menus[g_MpPlayerNum].unk840.unk538 = 0; - g_Menus[g_MpPlayerNum].unk840.unk510 = 0; - g_Menus[g_MpPlayerNum].unk840.unk53c = 0; - g_Menus[g_MpPlayerNum].unk840.unk514 = 0; - g_Menus[g_MpPlayerNum].unk840.unk51c = 0; - break; - case MENUOP_CLOSE: - break; - case MENUOP_TICK: - if (g_Menus[g_MpPlayerNum].curdialog) { -#if VERSION >= VERSION_JPN_FINAL - if (g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) { - f32 offset; - f32 size; - - index -= NUM_BIO_LOCATIONS; - - offset = items[index].y_offset; - size = items[index].size * 0.001f; - - g_Menus[g_MpPlayerNum].unk840.unk544 = size; - g_Menus[g_MpPlayerNum].unk840.unk514 = offset; - g_Menus[g_MpPlayerNum].unk840.unk53c = offset; - - if (g_Menus[g_MpPlayerNum].unk840.unk00c != items[index].fileid) { - g_Menus[g_MpPlayerNum].unk840.unk000 = 8; - } - - g_Menus[g_MpPlayerNum].unk840.unk00c = items[index].fileid; - g_Menus[g_MpPlayerNum].unk840.unk54c = g_Menus[g_MpPlayerNum].unk840.unk524 + 0.01f * g_Vars.diffframe60freal; - g_Menus[g_MpPlayerNum].unk840.unk524 += 0.01f * g_Vars.diffframe60freal; - g_Menus[g_MpPlayerNum].unk840.partvisibility = g_BioPartVisibility; - } else { - g_Menus[g_MpPlayerNum].unk840.unk548 = 0; - g_Menus[g_MpPlayerNum].unk840.unk520 = 0; - g_Menus[g_MpPlayerNum].unk840.unk54c = 0; - g_Menus[g_MpPlayerNum].unk840.unk524 = 0; - g_Menus[g_MpPlayerNum].unk840.unk538 = 0; - g_Menus[g_MpPlayerNum].unk840.unk510 = 0; - g_Menus[g_MpPlayerNum].unk840.unk53c = 0; - g_Menus[g_MpPlayerNum].unk840.unk514 = 0; - g_Menus[g_MpPlayerNum].unk840.unk544 = 0; - g_Menus[g_MpPlayerNum].unk840.unk51c = 0; - } -#else - if (g_Menus[g_MpPlayerNum].curdialog->definition == dialogdef) { - f32 offset; - f32 size; - - index -= NUM_BIO_LOCATIONS; - - offset = items[index].y_offset; - size = items[index].size * 0.001f; - - g_Menus[g_MpPlayerNum].unk840.unk544 = size; - g_Menus[g_MpPlayerNum].unk840.unk514 = offset; - g_Menus[g_MpPlayerNum].unk840.unk53c = offset; - g_Menus[g_MpPlayerNum].unk840.unk00c = items[index].fileid; -#if VERSION >= VERSION_PAL_BETA - g_Menus[g_MpPlayerNum].unk840.unk54c = g_Menus[g_MpPlayerNum].unk840.unk524 + 0.01f * g_Vars.diffframe60freal; - g_Menus[g_MpPlayerNum].unk840.unk524 += 0.01f * g_Vars.diffframe60freal; -#else - g_Menus[g_MpPlayerNum].unk840.unk54c = g_Menus[g_MpPlayerNum].unk840.unk524 + 0.01f * g_Vars.diffframe60f; - g_Menus[g_MpPlayerNum].unk840.unk524 += 0.01f * g_Vars.diffframe60f; -#endif - g_Menus[g_MpPlayerNum].unk840.partvisibility = g_BioPartVisibility; - } -#endif - } - break; - } - } - - return 0; -} - -struct menudialogdef *ciGetFrWeaponListMenuDialog(void) -{ - return &g_FrWeaponListMenuDialog; -} - -struct menuitem g_HangarDetailsMenuItems[] = { - { - MENUITEMTYPE_MODEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_LIST_CUSTOMRENDER, - 0x00000104, - 0x0000002c, - ciHangarTitleMenuHandler, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_SCROLLABLE, - DESCRIPTION_HANGARBIO, - 0, - 0x00000104, - 0x0000005a, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_414, // "Press the B Button to go back." - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menuitem g_HangarVehicleHolographMenuItems[] = { - { - MENUITEMTYPE_MODEL, - 0, - MENUITEMFLAG_00000002, - 0x00000104, - 0x0000006e, - NULL, - }, - { - MENUITEMTYPE_SEPARATOR, - 0, - MENUITEMFLAG_00000002, - 0, - 0, - NULL, - }, - { - MENUITEMTYPE_LABEL, - 0, - MENUITEMFLAG_00000002 | MENUITEMFLAG_SELECTABLE_CENTRE, - L_MPMENU_414, // "Press the B Button to go back." - 0, - NULL, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_HangarVehicleHolographMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MISC_471, // "Holograph" - g_HangarVehicleHolographMenuItems, - ciHangarHolographMenuDialog, - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_DISABLERESIZE, - NULL, -}; - -struct menudialogdef g_HangarVehicleDetailsMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&bioMenuTextName, - g_HangarDetailsMenuItems, - NULL, - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_DISABLERESIZE, - &g_HangarVehicleHolographMenuDialog, -}; - -struct menudialogdef g_HangarLocationDetailsMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - (u32)&bioMenuTextName, - g_HangarDetailsMenuItems, - NULL, - MENUDIALOGFLAG_0002 | MENUDIALOGFLAG_DISABLERESIZE, - NULL, -}; - -struct menuitem g_HangarListMenuItems[] = { - { - MENUITEMTYPE_LIST, - 0, - MENUITEMFLAG_SELECTABLE_CLOSESDIALOG, - 0x000000a0, - 0, - ciHangarInformationMenuHandler, - }, - { MENUITEMTYPE_END }, -}; - -struct menudialogdef g_HangarListMenuDialog = { - MENUDIALOGTYPE_DEFAULT, - L_MPMENU_415, // "Hangar Information" - g_HangarListMenuItems, - NULL, - 0, - NULL, -}; diff --git a/src/include/data.h b/src/include/data.h index 451f67416..85c1bd0ff 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -504,26 +504,6 @@ extern u8 g_BotCount; extern struct aibotweaponpreference g_AibotWeaponPreferences[]; extern u32 var80087eb4; extern struct challenge g_MpChallenges[NUM_CHALLENGES]; -extern u8 g_FrIsValidWeapon; -extern s32 g_FrWeaponNum; -extern u8 g_ChrBioSlot; -extern u8 g_HangarBioSlot; -extern u8 g_DtSlot; extern u8 var80088bb4; -extern struct menudialogdef g_FrWeaponListMenuDialog; -extern struct menudialogdef g_FrTrainingInfoInGameMenuDialog; -extern struct menudialogdef g_FrTrainingInfoPreGameMenuDialog; -extern struct menudialogdef g_FrCompletedMenuDialog; -extern struct menudialogdef g_FrFailedMenuDialog; -extern struct menudialogdef g_BioListMenuDialog; -extern struct menudialogdef g_DtListMenuDialog; -extern struct menudialogdef g_DtDetailsMenuDialog; -extern struct menudialogdef g_DtFailedMenuDialog; -extern struct menudialogdef g_DtCompletedMenuDialog; -extern struct menudialogdef g_HtListMenuDialog; -extern struct menudialogdef g_HtDetailsMenuDialog; -extern struct menudialogdef g_HtFailedMenuDialog; -extern struct menudialogdef g_HtCompletedMenuDialog; -extern struct menudialogdef g_HangarListMenuDialog; #endif diff --git a/src/include/game/endscreen.h b/src/include/game/endscreen.h deleted file mode 100644 index 44755878b..000000000 --- a/src/include/game/endscreen.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef IN_GAME_ENDSCREEN_H -#define IN_GAME_ENDSCREEN_H -#include -#include "data.h" -#include "types.h" - -s32 endscreenHandleRetryMission(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 endscreenHandle2PCompleted(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 endscreenHandle2PFailed(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 endscreenHandleDeclineMission(s32 operation, struct menuitem *item, union handlerdata *data); -s32 endscreenHandleCheatInfo(s32 operation, struct menuitem *item, union handlerdata *data); -s32 endscreenHandleContinueMission(s32 operation, struct menuitem *item, union handlerdata *data); -s32 endscreenHandleReplayLastLevel(s32 operation, struct menuitem *item, union handlerdata *data); -s32 endscreenHandleReplayPreviousMission(s32 operation, struct menuitem *item, union handlerdata *data); -char *endscreenMenuTitleRetryMission(struct menudialogdef *dialogdef); -char *endscreenMenuTitleNextMission(struct menudialogdef *dialogdef); -char *endscreenMenuTextNumKills(struct menuitem *item); -char *endscreenMenuTextNumShots(struct menuitem *item); -char *endscreenMenuTextNumHeadShots(struct menuitem *item); -char *endscreenMenuTextNumBodyShots(struct menuitem *item); -char *endscreenMenuTextNumLimbShots(struct menuitem *item); -char *endscreenMenuTextNumOtherShots(struct menuitem *item); -char *endscreenMenuTextAccuracy(struct menuitem *item); -char *endscreenMenuTextMissionStatus(struct menuitem *item); -char *endscreenMenuTextAgentStatus(struct menuitem *item); -char *endscreenMenuTitleStageCompleted(struct menuitem *item); -char *endscreenMenuTextCurrentStageName3(struct menuitem *item); -char *endscreenMenuTitleStageFailed(struct menuitem *item); -char *endscreenMenuTextMissionTime(struct menuitem *item); -struct menudialogdef *endscreenAdvance(void); -void endscreen0f10d770(void); -void endscreenContinue(s32 context); -char *endscreenMenuTextTimedCheatName(struct menuitem *item); -char *endscreenMenuTextCompletionCheatName(struct menuitem *item); -char *endscreenMenuTextTargetTime(struct menuitem *item); -void endscreenSetCoopCompleted(void); -void endscreenPrepare(void); -void endscreenPushCoop(void); -void endscreenPushSolo(void); -void endscreenPushAnti(void); - -#endif diff --git a/src/include/game/mainmenu.h b/src/include/game/mainmenu.h index 9a3275ca5..5505c4880 100644 --- a/src/include/game/mainmenu.h +++ b/src/include/game/mainmenu.h @@ -11,15 +11,7 @@ extern struct menudialogdef g_PreAndPostMissionBriefingMenuDialog; extern struct menudialogdef g_RetryMissionMenuDialog; extern struct menudialogdef g_NextMissionMenuDialog; -char *menuTextCurrentStageName(struct menuitem *item); -char *soloMenuTextDifficulty(struct menuitem *item); s32 menuhandlerControlStyleImpl(s32 operation, struct menuitem *item, union handlerdata *data, s32 mpindex); -char *soloMenuTitleStageOverview(struct menudialogdef *dialogdef); -f32 func0f1036ac(u8 value, s32 prop); -bool isStageDifficultyUnlocked(s32 stageindex, s32 difficulty); -char *soloMenuTextBestTime(struct menuitem *item); -s32 getMaxAiBuddies(void); -s32 getNumUnlockedSpecialStages(void); s32 func0f104720(s32 value); char *func0f105664(struct menuitem *item); char *func0f1056a0(struct menuitem *item); diff --git a/src/include/game/training.h b/src/include/game/training.h deleted file mode 100644 index d23654652..000000000 --- a/src/include/game/training.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef IN_GAME_TRAINING_TRAINING_H -#define IN_GAME_TRAINING_TRAINING_H -#include -#include "data.h" -#include "types.h" - -extern u8 g_FrIsValidWeapon; -extern s32 g_FrWeaponNum; -extern u8 g_ChrBioSlot; -extern u8 var80088bb4; -extern u8 g_HangarBioSlot; -extern u8 g_DtSlot; - -bool ciIsTourDone(void); -u8 ciGetFiringRangeScore(s32 weaponindex); -void frSaveScoreIfBest(s32 weaponindex, s32 difficulty); -u8 frIsWeaponFound(s32 weapon); -void frSetWeaponFound(s32 weaponnum); -s32 ciIsStageComplete(s32 stageindex); -bool func0f19cbcc(s32 weapon); -bool frIsWeaponAvailable(s32 weapon); -u32 frGetWeaponIndexByWeapon(u32 weaponnum); -u32 frGetWeaponScriptIndex(u32 weaponnum); -s32 frIsClassicWeaponUnlocked(u32 weapon); -s32 frGetSlot(void); -void frSetSlot(s32 slot); -u32 frGetWeaponBySlot(s32 slot); -s32 frGetNumWeaponsAvailable(void); -void frInitLighting(void); -void frRestoreLighting(void); -void frReset(void); -void *frLoadRomData(u32 len); -void frSetDifficulty(s32 difficulty); -u32 frGetDifficulty(void); -void frInitDefaults(void); -struct frdata *frGetData(void); -u32 frResolveFrPad(u32 arg0); -bool frIsDifficulty(u32 difficulties); -void frExecuteWeaponScript(s32 scriptindex); -void frSetTargetProps(void); -bool frTargetIsAtScriptStart(s32 targetnum); -char *frGetInstructionalText(u32 index); -void frExecuteHelpScript(void); -bool frExecuteTargetScript(s32 targetnum); -void frHideAllTargets(void); -void frInitTargets(void); -void frCloseAndLockDoor(void); -void frUnlockDoor(void); -void frLoadData(void); -u32 frInitAmmo(s32 weapon); -void frBeginSession(s32 weapon); -char *frGetWeaponDescription(void); -void frEndSession(bool hidetargets); -bool frWasTooInaccurate(void); -void frSetFailReason(s32 failreason); -void frSetCompleted(void); -bool frIsTargetOneHitExplodable(struct prop *prop); -f32 frGetTargetAngleToPos(struct coord *a, f32 angle, struct coord *b); -bool frIsTargetFacingPos(struct prop *prop, struct coord *pos); -struct prop *frChooseAutogunTarget(struct coord *autogunpos); -bool frIsAmmoWasted(void); -void frTick(void); -void func0f1a0924(struct prop *prop); -bool frChooseFarsightTarget(void); -s32 frIsInTraining(void); -void frCalculateHit(struct defaultobj *obj, struct coord *hitpos, f32 maulercharge); -void frIncrementNumShots(void); -bool ciIsChrBioUnlocked(u32 bodynum); -struct chrbio *ciGetChrBioByBodynum(u32 bodynum); -char *ciGetChrBioDescription(void); -s32 ciGetNumUnlockedChrBios(void); -s32 ciGetChrBioBodynumBySlot(s32 slot); -struct miscbio *ciGetMiscBio(s32 index); -bool ciIsMiscBioUnlocked(s32 index); -s32 ciGetNumUnlockedMiscBios(void); -s32 ciGetMiscBioIndexBySlot(s32 slot); -char *ciGetMiscBioDescription(void); -bool ciIsHangarBioAVehicle(s32 index); -struct hangarbio *ciGetHangarBio(s32 index); -bool ciIsHangarBioUnlocked(u32 bioindex); -s32 ciGetNumUnlockedLocationBios(void); -s32 ciGetNumUnlockedHangarBios(void); -s32 ciGetHangarBioIndexBySlot(s32 slot); -char *ciGetHangarBioDescription(void); -struct trainingdata *dtGetData(void); -void dtRestorePlayer(void); -void dtPushEndscreen(void); -void dtTick(void); -void func0f1a1ac0(void); -void dtBegin(void); -void dtEnd(void); -bool dtIsAvailable(s32 deviceindex); -s32 dtGetNumAvailable(void); -s32 dtGetIndexBySlot(s32 wantindex); -u32 dtGetWeaponByDeviceIndex(s32 deviceindex); -u32 ciGetStageFlagByDeviceIndex(u32 deviceindex); -char *dtGetDescription(void); -char *dtGetTip1(void); -char *dtGetTip2(void); -struct trainingdata *getHoloTrainingData(void); -void htPushEndscreen(void); -void htTick(void); -void func0f1a2198(void); -void htBegin(void); -void htEnd(void); -bool htIsUnlocked(u32 value); -s32 htGetNumUnlocked(void); -s32 htGetIndexBySlot(s32 slot); -char *htGetName(s32 index); -u32 func0f1a25c0(s32 index); -char *htGetDescription(void); -char *htGetTip1(void); -char *htGetTip2(void); - -#if VERSION >= VERSION_JPN_FINAL -void frGetGoalTargetsText(char *buffer1, char *buffer2); -void frGetGoalScoreText(char *buffer1, char *buffer2); -bool frGetMinAccuracy(char *buffer1, f32 accuracy, char *buffer2); -bool frGetHudMiddleSubtext(char *buffer1, char *buffer2); -bool frGetFeedback(char *score, char *zone, char *extrabuffer); -Gfx *frRenderHudElement(Gfx *gdl, s32 x, s32 y, char *string1, char *string2, char *string3, u32 colour, u8 alpha); -#else -void frGetGoalTargetsText(char *buffer); -void frGetGoalScoreText(char *buffer); -bool frGetMinAccuracy(char *buffer, f32 accuracy); -bool frGetHudMiddleSubtext(char *buffer); -bool frGetFeedback(char *score, char *zone); -Gfx *frRenderHudElement(Gfx *gdl, s32 x, s32 y, char *string1, char *string2, u32 colour, u8 alpha); -#endif - -void frGetTargetsDestroyedValue(char *buffer); -void frGetScoreValue(char *buffer); -f32 frGetAccuracy(char *buffer); -bool frFormatTime(char *buffer); -Gfx *frRenderHud(Gfx *gdl); - -#endif diff --git a/src/include/game/trainingmenus.h b/src/include/game/trainingmenus.h deleted file mode 100644 index 8bdfbdec9..000000000 --- a/src/include/game/trainingmenus.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef IN_GAME_TRAINING_MENUS_H -#define IN_GAME_TRAINING_MENUS_H -#include -#include "data.h" -#include "types.h" - -char *frMenuTextFailReason(struct menuitem *item); -char *frMenuTextDifficultyName(struct menuitem *item); -char *frMenuTextTimeTakenValue(struct menuitem *item); -char *frMenuTextScoreValue(struct menuitem *item); -char *frMenuTextWeaponName(struct menuitem *item); -char *frMenuTextTargetsDestroyedValue(struct menuitem *item); -char *frMenuTextAccuracyValue(struct menuitem *item); -char *frMenuTextGoalScoreLabel(struct menuitem *item); -char *frMenuTextGoalScoreValue(struct menuitem *item); -char *frMenuTextMinAccuracyOrTargetsLabel(struct menuitem *item); -char *frMenuTextMinAccuracyOrTargetsValue(struct menuitem *item); -char *frMenuTextTimeLimitLabel(struct menuitem *item); -char *frMenuTextTimeLimitValue(struct menuitem *item); -char *frMenuTextAmmoLimitLabel(struct menuitem *item); -char *frMenuTextAmmoLimitValue(struct menuitem *item); -char *ciMenuTextChrBioName(struct menuitem *item); -char *ciMenuTextChrBioAge(struct menuitem *item); -char *ciMenuTextChrBioRace(struct menuitem *item); -char *ciMenuTextMiscBioName(struct menuitem *item); -char *dtMenuTextName(struct menuitem *item); -char *dtMenuTextOkOrResume(struct menuitem *item); -char *dtMenuTextCancelOrAbort(struct menuitem *item); -char *dtMenuTextTimeTakenValue(struct menuitem *item); -char *htMenuTextName(struct menuitem *item); -char *htMenuTextOkOrResume(struct menuitem *item); -char *htMenuTextCancelOrAbort(struct menuitem *item); -char *htMenuTextTimeTakenValue(struct menuitem *item); -char *bioMenuTextName(struct menuitem *item); -char *ciMenuTextHangarBioSubheading(struct menuitem *item); -struct menudialogdef *ciGetFrWeaponListMenuDialog(void); -s32 frTrainingInfoMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 frTrainingStatsMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 ciCharacterProfileMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 dtTrainingDetailsMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 menudialogDeviceTrainingResults(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 menudialog001a6aa4(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 menudialogFiringRangeResults(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 ciHangarHolographMenuDialog(s32 operation, struct menudialogdef *dialogdef, union handlerdata *data); -s32 frDetailsOkMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 frAbortMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 frWeaponListMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 frScoringMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 menuhandlerFrFailedContinue(s32 operation, struct menuitem *item, union handlerdata *data); -s32 ciOfficeInformationMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 dtDeviceListMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 menuhandlerDtOkOrResume(s32 operation, struct menuitem *item, union handlerdata *data); -s32 menuhandler001a6514(s32 operation, struct menuitem *item, union handlerdata *data); -s32 htHoloListMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 menuhandler001a6a34(s32 operation, struct menuitem *item, union handlerdata *data); -s32 menuhandler001a6a70(s32 operation, struct menuitem *item, union handlerdata *data); -s32 ciHangarInformationMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 ciHangarTitleMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); -s32 frDifficultyMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data); - -#endif diff --git a/src/lib/main.c b/src/lib/main.c index c8abd4289..499770e9e 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -26,7 +26,6 @@ #include "game/title.h" #include "game/pdmode.h" #include "game/objectives.h" -#include "game/endscreen.h" #include "game/playermgr.h" #include "game/game_1531a0.h" #include "game/gfxmemory.h" @@ -1979,34 +1978,7 @@ void mainEndStage(void) #endif joyDisableTemporarily(); - if (g_Vars.coopplayernum >= 0) { - s32 prevplayernum = g_Vars.currentplayernum; - s32 i; - - for (i = 0; i < PLAYERCOUNT(); i++) { - setCurrentPlayerNum(i); - endscreenPushCoop(); - } - - setCurrentPlayerNum(prevplayernum); - musicStartMenu(); - } else if (g_Vars.antiplayernum >= 0) { - s32 prevplayernum = g_Vars.currentplayernum; - s32 i; - - for (i = 0; i < PLAYERCOUNT(); i++) { - setCurrentPlayerNum(i); - endscreenPushAnti(); - } - - setCurrentPlayerNum(prevplayernum); - musicStartMenu(); - } else if (g_Vars.normmplayerisrunning) { - mpEndMatch(); - } else { - endscreenPrepare(); - musicStartMenu(); - } + mpEndMatch(); } g_MainIsEndscreen = true;