summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-26 23:25:12 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-26 23:25:12 +0200
commitec1d14971c9bb1d751c0256093483d621dd719b8 (patch)
treeee3196f8abd70e1b01df0cb38b0ebe1888f98cd0 /src/core
parentupdated librw (diff)
downloadre3-ec1d14971c9bb1d751c0256093483d621dd719b8.tar
re3-ec1d14971c9bb1d751c0256093483d621dd719b8.tar.gz
re3-ec1d14971c9bb1d751c0256093483d621dd719b8.tar.bz2
re3-ec1d14971c9bb1d751c0256093483d621dd719b8.tar.lz
re3-ec1d14971c9bb1d751c0256093483d621dd719b8.tar.xz
re3-ec1d14971c9bb1d751c0256093483d621dd719b8.tar.zst
re3-ec1d14971c9bb1d751c0256093483d621dd719b8.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Frontend.cpp19
-rw-r--r--src/core/Frontend.h6
-rw-r--r--src/core/MenuScreens.h10
-rw-r--r--src/core/Pools.cpp43
-rw-r--r--src/core/config.h2
5 files changed, 78 insertions, 2 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index d58d0576..b291886f 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -3497,6 +3497,13 @@ CMenuManager::Process(void)
SaveLoadFileError_SetUpErrorScreen();
}
if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) {
+#ifdef MISSION_REPLAY
+ if (doingMissionRetry) {
+ RetryMission(2, 0);
+ m_nCurrSaveSlot = SLOT_COUNT;
+ doingMissionRetry = false;
+ }
+#endif
if (CheckSlotDataValid(m_nCurrSaveSlot)) {
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
if (m_PrefsVsyncDisp != m_PrefsVsync)
@@ -4661,6 +4668,18 @@ CMenuManager::ProcessButtonPresses(void)
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
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
}
}
ProcessOnOffMenuOptions();
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 89517528..b65a60f1 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -245,7 +245,7 @@ enum eMenuScreen
MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
- MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile
+ MENUPAGE_MISSION_RETRY = 57,
MENUPAGE_58 = 58,
#ifdef MENU_MAP
MENUPAGE_MAP = 59,
@@ -366,6 +366,10 @@ enum eMenuAction
MENUACTION_UNK108,
MENUACTION_UNK109,
MENUACTION_UNK110,
+ MENUACTION_UNK111,
+ MENUACTION_UNK112,
+ MENUACTION_REJECT_RETRY,
+ MENUACTION_UNK114,
#ifdef MORE_LANGUAGES
MENUACTION_LANG_PL,
MENUACTION_LANG_RUS,
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h
index 6c2ebdb8..339ae2ce 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.h
@@ -445,11 +445,19 @@ const CMenuScreen aScreens[] = {
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
+ // MENUPAGE_MISSION_RETRY = 57
+#ifdef MISSION_REPLAY
- // MENUPAGE_57 = 57
+ { "M_FAIL", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
+ MENUACTION_LABEL, "FESZ_RM", SAVESLOT_NONE, MENUPAGE_NONE,
+ MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
+ MENUACTION_REJECT_RETRY, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE
+ },
+#else
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
// mission failed, wanna restart page in mobile
},
+#endif
// MENUPAGE_58 = 58
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 17b9e08d..bd0814d0 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -4,6 +4,9 @@
#include "Boat.h"
#include "CarCtrl.h"
+#ifdef MISSION_REPLAY
+#include "GenericGameStorage.h"
+#endif
#include "Population.h"
#include "ProjectileInfo.h"
#include "Streaming.h"
@@ -206,11 +209,24 @@ INITSAVEBUF
if (pVehicle->pPassengers[j])
bHasPassenger = true;
}
+#ifdef MISSION_REPLAY
+ bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave;
+#ifdef FIX_BUGS
+ if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) {
+#else
+ if (!pVehicle->pDriver && !bHasPassenger) {
+#endif
+ if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
+ ++nNumCars;
+ if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
+ ++nNumBoats;
+#else
if (!pVehicle->pDriver && !bHasPassenger) {
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumCars;
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumBoats;
+#endif
}
}
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
@@ -226,23 +242,42 @@ INITSAVEBUF
if (pVehicle->pPassengers[j])
bHasPassenger = true;
}
+#ifdef MISSION_REPLAY
+ bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave;
+#endif
+#if defined FIX_BUGS && defined MISSION_REPLAY
+ if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) {
+#else
if (!pVehicle->pDriver && !bHasPassenger) {
+#endif
#ifdef COMPATIBLE_SAVES
+#ifdef MISSION_REPLAY
+ if ((pVehicle->IsCar() || pVehicle->IsBoat()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
WriteSaveBuf<int32>(buf, GetVehicleRef(pVehicle));
pVehicle->Save(buf);
}
#else
+#ifdef MISSION_REPLAY
+ if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
memcpy(buf, pVehicle, sizeof(CAutomobile));
SkipSaveBuf(buf, sizeof(CAutomobile));
}
+#ifdef MISSION_REPLAY
+ if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
+#else
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
+#endif
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
@@ -400,7 +435,11 @@ INITSAVEBUF
CPed* pPed = GetPedPool()->GetSlot(i);
if (!pPed)
continue;
+#ifdef MISSION_REPLAY
+ if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1)
+#else
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1)
+#endif
nNumPeds++;
}
*size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + CPlayerPed::nSaveStructSize +
@@ -410,7 +449,11 @@ INITSAVEBUF
CPed* pPed = GetPedPool()->GetSlot(i);
if (!pPed)
continue;
+#ifdef MISSION_REPLAY
+ if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1) {
+#else
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) {
+#endif
CopyToBuf(buf, pPed->m_nPedType);
CopyToBuf(buf, pPed->m_modelIndex);
int32 ref = GetPedRef(pPed);
diff --git a/src/core/config.h b/src/core/config.h
index f43067d7..5ad12fba 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -227,6 +227,8 @@ enum Config {
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
#define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script
#define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
+#define MISSION_REPLAY // mobile feature
+//#define SIMPLIER_MISSIONS // apply simplifications from mobile
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible