From 70080f1fdbafe5ecd11c573d4d9fba522a5d8235 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 1 Aug 2021 12:54:05 +0300 Subject: mission replay --- src/core/Frontend.cpp | 29 +++++++++++++++++++++++++++++ src/core/Frontend.h | 9 ++++++++- src/core/MenuScreens.cpp | 10 ++++++++++ src/core/MenuScreensCustom.cpp | 11 +++++++++++ src/core/Pools.cpp | 4 ++-- src/core/config.h | 14 +++++++++++--- 6 files changed, 71 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 632a69ab..03d9a719 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -571,7 +571,11 @@ CMenuManager::Initialise(void) m_fMapCenterX = MENU_X_LEFT_ALIGNED(320.0f); m_fMapCenterY = MENU_Y(225.0f); CPad::StopPadsShaking(); +#ifdef MISSION_REPLAY + if (!m_OnlySaveMenu && m_nCurrScreen != MENUPAGE_MISSION_RETRY) +#else if (!m_OnlySaveMenu) +#endif m_nCurrScreen = MENUPAGE_NONE; DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0); @@ -4711,6 +4715,18 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK"); } break; +#ifdef MISSION_REPLAY + case MENUACTION_REJECT_RETRY: + doingMissionRetry = false; + AllowMissionReplay = 0; + RequestFrontEndShutDown(); + break; + case MENUACTION_UNK114: + doingMissionRetry = false; + RequestFrontEndShutDown(); + RetryMission(2, 0); + return; +#endif case MENUACTION_SAVEGAME: { int saveSlot = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot; @@ -5355,6 +5371,19 @@ CMenuManager::ProcessFileActions() { switch (m_nCurrScreen) { case MENUPAGE_LOADING_IN_PROGRESS: +#ifdef MISSION_REPLAY + if (MissionSkipLevel) { + if (gGameState != GS_PLAYING_GAME) + DoSettingsBeforeStartingAGame(); + RequestFrontEndShutDown(); + break; + } + if (doingMissionRetry) { + RetryMission(2, 0); + m_nCurrSaveSlot = SLOT_COUNT; + doingMissionRetry = false; + } +#endif if (CheckSlotDataValid(m_nCurrSaveSlot)) { #ifdef USE_DEBUG_SCRIPT_LOADER scriptToLoad = 0; diff --git a/src/core/Frontend.h b/src/core/Frontend.h index b4e70613..1a1dd799 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -218,8 +218,11 @@ enum eMenuScreen #ifdef DETECT_JOYSTICK_MENU MENUPAGE_DETECT_JOYSTICK, #endif - #endif +#ifdef MISSION_REPLAY + MENUPAGE_MISSION_RETRY, +#endif + MENUPAGE_OUTRO, // Originally 34, but CFO needs last screen to be empty to count number of menu pages MENUPAGES }; @@ -288,6 +291,10 @@ enum eMenuAction MENUACTION_CTRLVIBRATION, MENUACTION_CTRLCONFIG, #endif +#ifdef MISSION_REPLAY + MENUACTION_REJECT_RETRY, + MENUACTION_UNK114 +#endif }; enum eCheckHover diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp index 20484389..3ffc4e83 100644 --- a/src/core/MenuScreens.cpp +++ b/src/core/MenuScreens.cpp @@ -329,6 +329,16 @@ CMenuScreen aScreens[] = { }, #endif +#ifdef MISSION_REPLAY + // MENUPAGE_MISSION_RETRY = 57 on mobile + + { "M_FAIL", MENUPAGE_DISABLED, 0, + MENUACTION_LABEL, "FESZ_RM", SAVESLOT_NONE, MENUPAGE_NONE, 0, 0, 0, + MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS, 320, 200, MENUALIGN_CENTER, + MENUACTION_REJECT_RETRY, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, 320, 225, MENUALIGN_CENTER, + }, +#endif + // MENUPAGE_OUTRO - Originally 34 { "", 0, 0, }, }; diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp index 49bb33f8..62b1ebdb 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -756,6 +756,17 @@ CMenuScreenCustom aScreens[] = { }, #endif + +#ifdef MISSION_REPLAY + // MENUPAGE_MISSION_RETRY = 57 on mobile + + { "M_FAIL", MENUPAGE_DISABLED, nil, nil, + MENUACTION_LABEL, "FESZ_RM", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, 0, 0, 0, + MENUACTION_CHANGEMENU, "FEM_YES", { nil, SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS }, 320, 200, MENUALIGN_CENTER, + MENUACTION_REJECT_RETRY, "FEM_NO", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, 320, 225, MENUALIGN_CENTER, + }, +#endif + // MENUPAGE_OUTRO = 34 { "", 0, nil, nil, }, }; diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index a85d6846..c4b4d3b0 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -269,7 +269,7 @@ INITSAVEBUF if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) ++nNumBoats; if (pVehicle->IsBike() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) - ++nNumBoats; + ++nNumBikes; #else if (!pVehicle->pDriver && !bHasPassenger) { if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) @@ -277,7 +277,7 @@ INITSAVEBUF if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) ++nNumBoats; if (pVehicle->IsBike() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) - ++nNumBoats; + ++nNumBikes; #endif } } diff --git a/src/core/config.h b/src/core/config.h index 307f55d3..7ed983fd 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -182,6 +182,9 @@ enum Config { # define PC_MENU # define PC_WATER #elif defined GTA_XBOX +#elif defined GTA_MOBILE +# define MISSION_REPLAY +# define SIMPLER_MISSIONS #endif // This is enabled for all released games. @@ -372,14 +375,15 @@ enum Config { #define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely #define SUPPORT_JAPANESE_SCRIPT //#define SUPPORT_XBOX_SCRIPT -//#define SUPPORT_MOBILE_SCRIPT +#define SUPPORT_MOBILE_SCRIPT #if (defined SUPPORT_XBOX_SCRIPT && defined SUPPORT_MOBILE_SCRIPT) static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually exclusive"); #endif #ifdef PC_MENU -//#define MISSION_REPLAY // mobile feature +#define MISSION_REPLAY // mobile feature +//#define SIMPLER_MISSIONS // apply simplifications from mobile +#define USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT #endif -//#define SIMPLIER_MISSIONS // apply simplifications from mobile #define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #define SCRIPT_LOG_FILE_LEVEL 0 // 0 == no log, 1 == overwrite every frame, 2 == full log @@ -396,6 +400,10 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #undef USE_BASIC_SCRIPT_DEBUG_OUTPUT #endif +#ifndef MISSION_REPLAY +#undef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT +#endif + // Replay //#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool! //#define USE_BETA_REPLAY_MODE // adds another replay mode, a few seconds slomo (caution: buggy!) -- cgit v1.2.3