summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-04-14 00:18:53 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-04-14 00:18:53 +0200
commitf54c83c0b527e3034538e4c8791f10fc4e313576 (patch)
treed10bf31e0badad1e55f035c585c47af557e961e9 /src/core
parentscene edit (diff)
parentupdate readme (diff)
downloadre3-f54c83c0b527e3034538e4c8791f10fc4e313576.tar
re3-f54c83c0b527e3034538e4c8791f10fc4e313576.tar.gz
re3-f54c83c0b527e3034538e4c8791f10fc4e313576.tar.bz2
re3-f54c83c0b527e3034538e4c8791f10fc4e313576.tar.lz
re3-f54c83c0b527e3034538e4c8791f10fc4e313576.tar.xz
re3-f54c83c0b527e3034538e4c8791f10fc4e313576.tar.zst
re3-f54c83c0b527e3034538e4c8791f10fc4e313576.zip
Diffstat (limited to '')
-rw-r--r--src/core/FileLoader.cpp165
-rw-r--r--src/core/FileLoader.h3
-rw-r--r--src/core/Frontend.cpp153
-rw-r--r--src/core/Frontend.h7
-rw-r--r--src/core/MenuScreens.h5
-rw-r--r--src/core/Pad.h1
-rw-r--r--src/core/Pools.cpp4
-rw-r--r--src/core/Timer.h3
-rw-r--r--src/core/config.h6
-rw-r--r--src/core/re3.cpp16
10 files changed, 272 insertions, 91 deletions
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index e0c8b01e..e0a0fafc 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -25,8 +25,6 @@
#include "CdStream.h"
#include "FileLoader.h"
-WRAPPER void CFileLoader::ReloadPaths(const char *filename) { EAXJMP(0x476DB0); }
-
char CFileLoader::ms_line[256];
const char*
@@ -1198,6 +1196,165 @@ CFileLoader::LoadMapZones(const char *filename)
debug("Finished loading IPL\n");
}
+void
+CFileLoader::ReloadPaths(const char *filename)
+{
+ enum {
+ NONE,
+ PATH,
+ };
+ char *line;
+ int section = NONE;
+ int id, pathType, pathIndex = -1;
+ char pathTypeStr[20];
+ debug("Reloading paths from %s...\n", filename);
+
+ int fd = CFileMgr::OpenFile(filename, "r");
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '\0' || *line == '#')
+ continue;
+
+ if (section == NONE) {
+ if (strncmp(line, "path", 4) == 0) {
+ section = PATH;
+ ThePaths.AllocatePathFindInfoMem(4500);
+ }
+ } else if (strncmp(line, "end", 3) == 0) {
+ section = NONE;
+ } else {
+ switch (section) {
+ case PATH:
+ if (pathIndex == -1) {
+ id = LoadPathHeader(line, pathTypeStr);
+ if (strncmp(pathTypeStr, "ped", 4) == 0)
+ pathType = 1;
+ else if (strncmp(pathTypeStr, "car", 4) == 0)
+ pathType = 0;
+ pathIndex = 0;
+ } else {
+ if (pathType == 1)
+ LoadPedPathNode(line, id, pathIndex);
+ else if (pathType == 0)
+ LoadCarPathNode(line, id, pathIndex);
+ pathIndex++;
+ if (pathIndex == 12)
+ pathIndex = -1;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
+
+void
+CFileLoader::ReloadObjectTypes(const char *filename)
+{
+ enum {
+ NONE,
+ OBJS,
+ TOBJ,
+ TWODFX
+ };
+ char *line;
+ int section = NONE;
+ CModelInfo::ReInit2dEffects();
+ debug("Reloading object types from %s...\n", filename);
+
+ CFileMgr::ChangeDir("\\DATA\\MAPS\\");
+ int fd = CFileMgr::OpenFile(filename, "r");
+ CFileMgr::ChangeDir("\\");
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '\0' || *line == '#')
+ continue;
+
+ if (section == NONE) {
+ if (strncmp(line, "objs", 4) == 0) section = OBJS;
+ else if (strncmp(line, "tobj", 4) == 0) section = TOBJ;
+ else if (strncmp(line, "2dfx", 4) == 0) section = TWODFX;
+ } else if (strncmp(line, "end", 3) == 0) {
+ section = NONE;
+ } else {
+ switch (section) {
+ case OBJS:
+ case TOBJ:
+ ReloadObject(line);
+ break;
+ case TWODFX:
+ Load2dEffect(line);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
+
+void
+CFileLoader::ReloadObject(const char *line)
+{
+ int id, numObjs;
+ char model[24], txd[24];
+ float dist[3];
+ uint32 flags;
+ CSimpleModelInfo *mi;
+
+ if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
+ return;
+
+ switch(numObjs){
+ case 1:
+ sscanf(line, "%d %s %s %d %f %d",
+ &id, model, txd, &numObjs, &dist[0], &flags);
+ break;
+ case 2:
+ sscanf(line, "%d %s %s %d %f %f %d",
+ &id, model, txd, &numObjs, &dist[0], &dist[1], &flags);
+ break;
+ case 3:
+ sscanf(line, "%d %s %s %d %f %f %f %d",
+ &id, model, txd, &numObjs, &dist[0], &dist[1], &dist[2], &flags);
+ break;
+ }
+
+ mi = (CSimpleModelInfo*) CModelInfo::GetModelInfo(id);
+ if (
+#ifdef FIX_BUGS
+ mi &&
+#endif
+ mi->m_type == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
+ mi->SetLodDistances(dist);
+ SetModelInfoFlags(mi, flags);
+ } else {
+ printf("Can't reload %s\n", model);
+ }
+}
+
+// unused mobile function - crashes
+void
+CFileLoader::ReLoadScene(const char *filename)
+{
+ char *line;
+ CFileMgr::ChangeDir("\\DATA\\");
+ int fd = CFileMgr::OpenFile(filename, "r");
+ CFileMgr::ChangeDir("\\");
+
+ for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
+ if (*line == '#')
+ continue;
+
+ if (strncmp(line, "EXIT", 9) == 0) // BUG: 9?
+ break;
+
+ if (strncmp(line, "IDE", 3) == 0) {
+ LoadObjectTypes(line + 4);
+ }
+ }
+ CFileMgr::CloseFile(fd);
+}
STARTPATCHES
InjectHook(0x476290, CFileLoader::LoadLevel, PATCH_JUMP);
@@ -1233,4 +1390,8 @@ STARTPATCHES
InjectHook(0x478A90, CFileLoader::LoadCullZone, PATCH_JUMP);
InjectHook(0x478550, CFileLoader::LoadMapZones, PATCH_JUMP);
+
+ InjectHook(0x476DB0, CFileLoader::ReloadPaths, PATCH_JUMP);
+ InjectHook(0x476F30, CFileLoader::ReloadObjectTypes, PATCH_JUMP);
+ InjectHook(0x4772B0, CFileLoader::ReloadObject, PATCH_JUMP);
ENDPATCHES
diff --git a/src/core/FileLoader.h b/src/core/FileLoader.h
index 1b390279..87b8fe61 100644
--- a/src/core/FileLoader.h
+++ b/src/core/FileLoader.h
@@ -43,4 +43,7 @@ public:
static void LoadMapZones(const char *filename);
static void ReloadPaths(const char *filename);
+ static void ReloadObjectTypes(const char *filename);
+ static void ReloadObject(const char *line);
+ static void ReLoadScene(const char *filename); // unused mobile function
};
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index a0b70f27..643c450f 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -31,6 +31,7 @@
#include "Radar.h"
#include "Stats.h"
#include "Messages.h"
+#include "FileLoader.h"
#define TIDY_UP_PBP // ProcessButtonPresses
#define MAX_VISIBLE_LIST_ROW 30
@@ -44,16 +45,27 @@
#define FEET_IN_METER 3.33f
#endif
-#define SCROLLABLE_STATS_PAGE
#ifdef SCROLLABLE_STATS_PAGE
#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS)
#else
#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS)
#endif
+#ifdef TRIANGLE_BACK_BUTTON
+#define GetBackJustUp GetTriangleJustUp
+#define GetBackJustDown GetTriangleJustDown
+#elif defined(CIRCLE_BACK_BUTTON)
+#define GetBackJustUp GetCircleJustUp
+#define GetBackJustDown GetCircleJustDown
+#else
+#define GetBackJustUp GetSquareJustUp
+#define GetBackJustDown GetSquareJustDown
+#endif
+
#ifdef MENU_MAP
bool CMenuManager::bMenuMapActive = false;
bool CMenuManager::bMapMouseShownOnce = false;
+bool CMenuManager::bMapLoaded = false;
float CMenuManager::fMapSize;
float CMenuManager::fMapCenterY;
float CMenuManager::fMapCenterX;
@@ -99,14 +111,14 @@ char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74; //[256] "$$\"\""
int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70; // -1
-// This is PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway)
-#ifdef FIX_BUGS
-CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color
+// Originally that was PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway)
+#ifdef PS2_LIKE_MENU
+const CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255);
#else
-CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255);
+const CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color
#endif
-float menuXYpadding = MENUACTION_POS_Y; // *(float*)0x5F355C; // never changes. not original name
+const float menuXYpadding = MENUACTION_POS_Y; // *(float*)0x5F355C; // not original name
float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE; //*(float*)0x5F2E40;
float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE; //*(float*)0x5F2E44;
@@ -119,17 +131,17 @@ uint8 CMenuManager::m_PrefsPlayerRed = 255;
uint8 CMenuManager::m_PrefsPlayerGreen = 128;
uint8 CMenuManager::m_PrefsPlayerBlue; // why??
-CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
+CMenuManager FrontEndMenuManager; // = *(CMenuManager*)0x8F59D8;
// Move this somewhere else.
-float &CRenderer::ms_lodDistScale = *(float*)0x5F726C; // 1.2
-
-uint32 &TimeToStopPadShaking = *(uint32*)0x628CF8;
-char *&pEditString = *(char**)0x628D00;
-int32 *&pControlEdit = *(int32**)0x628D08;
-bool &DisplayComboButtonErrMsg = *(bool*)0x628D14;
-int32 &MouseButtonJustClicked = *(int32*)0x628D0C;
-int32 &JoyButtonJustClicked = *(int32*)0x628D10;
+float CRenderer::ms_lodDistScale = 1.2f; // *(float*)0x5F726C;
+
+uint32 TimeToStopPadShaking; // = *(uint32*)0x628CF8;
+char *pEditString; // = *(char**)0x628D00;
+int32 *pControlEdit; // = *(int32**)0x628D08;
+bool DisplayComboButtonErrMsg; // = *(bool*)0x628D14;
+int32 MouseButtonJustClicked; // = *(int32*)0x628D0C;
+int32 JoyButtonJustClicked; // = *(int32*)0x628D10;
//int32 *pControlTemp = 0;
#ifndef MASTER
@@ -359,11 +371,6 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
inline void
CMenuManager::ThingsToDoBeforeLeavingPage()
{
-#ifndef MASTER
- if (m_nCurrScreen == MENUPAGE_NO_MEMORY_CARD || m_nCurrScreen == MENUPAGE_MEMORY_CARD_DEBUG) {
- SaveSettings();
- }
-#endif
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
} else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
@@ -719,13 +726,6 @@ CMenuManager::Draw()
else
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break;
-#ifndef MASTER
- case MENUPAGE_NO_MEMORY_CARD:
- case MENUPAGE_MEMORY_CARD_DEBUG:
- CFont::SetColor(CRGBA(235, 170, 50, FadeIn(127))); // white in mobile, because all texts are white there
- str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
- break;
-#endif
case MENUPAGE_SAVE_OVERWRITE_CONFIRM:
if (Slots[m_nCurrSaveSlot + 1] == SLOT_EMPTY)
str = TheText.Get("FESZ_QZ");
@@ -743,20 +743,12 @@ CMenuManager::Draw()
break;
}
-#ifndef MASTER
- if (m_nCurrScreen == MENUPAGE_NO_MEMORY_CARD || m_nCurrScreen == MENUPAGE_MEMORY_CARD_DEBUG) {
- // CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); // it's always like that on PC
- CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(210.0), str);
- } else
-#endif
- {
#ifdef FIX_BUGS
- // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in here.
- CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(menuXYpadding), str);
+ // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in here.
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(menuXYpadding), str);
#else
- CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str);
+ CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str);
#endif
- }
}
CFont::SetCentreSize(SCREEN_WIDTH);
@@ -853,6 +845,10 @@ CMenuManager::Draw()
break;
}
+#ifdef PS2_LIKE_MENU
+ CFont::SetFontStyle(FONT_BANK);
+#endif
+
switch (m_nCurrScreen) {
case MENUPAGE_CONTROLLER_PC_OLD1:
case MENUPAGE_CONTROLLER_PC_OLD2:
@@ -2149,7 +2145,7 @@ CMenuManager::DrawFrontEndNormal()
}
#define optionWidth MENU_X(66.0f)
- #define rawOptionHeight 20.0f
+ #define rawOptionHeight 22.0f
#define optionBottom SCREEN_SCALE_FROM_BOTTOM(20.0f)
#define optionTop SCREEN_SCALE_FROM_BOTTOM(20.0f + rawOptionHeight)
#define leftPadding MENU_X_LEFT_ALIGNED(90.0f)
@@ -3196,31 +3192,33 @@ CMenuManager::PrintBriefs()
newColor = TEXT_COLOR;
FilterOutColorMarkersFromString(gUString, newColor);
- // newColor wasn't used at all! let's fix this
+#ifdef PS2_LIKE_MENU
+ // This PS2 code was always here, but unused
bool rgSame = newColor.r == TEXT_COLOR.r && newColor.g == TEXT_COLOR.g;
bool bSame = rgSame && newColor.b == TEXT_COLOR.b;
- bool colorNotChanged = bSame
-#ifndef FIX_BUGS
- && newColor.a == TEXT_COLOR.a
-#endif
- ;
+ bool colorNotChanged = bSame; /* && newColor.a == TEXT_COLOR.a; */
if (!colorNotChanged) {
newColor.r /= 2;
newColor.g /= 2;
newColor.b /= 2;
}
-#ifdef FIX_BUGS
- newColor.a = FadeIn(255);
- // because some colors aren't visible, due to they were made for PS2
- CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
+ CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); // But this is from PS2
CFont::SetDropShadowPosition(1);
+#endif
+
+#if defined(FIX_BUGS) || defined(PS2_LIKE_MENU)
+ newColor.a = FadeIn(255);
CFont::SetColor(newColor);
#endif
CFont::PrintString(MENU_X_LEFT_ALIGNED(50.0f), nextY, gUString);
nextY += MENU_Y(menuXYpadding);
}
}
+
+#ifdef PS2_LIKE_MENU
+ CFont::SetDropShadowPosition(0);
+#endif
}
// Not sure about name. Not to be confused with CPad::PrintErrorMessage
@@ -3337,6 +3335,7 @@ CMenuManager::Process(void)
m_bWantToRestart = false;
InitialiseChangedLanguageSettings();
+ // Just a hack by R* to not make game continuously resume/pause. But we it seems we can live with it.
if (CPad::GetPad(0)->GetEscapeJustDown())
RequestFrontEndStartUp();
@@ -3662,7 +3661,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#ifndef TIDY_UP_PBP
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustDown()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustDown()) {
m_bShowMouse = false;
goBack = true;
}
@@ -3741,7 +3740,7 @@ CMenuManager::ProcessButtonPresses(void)
if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) {
optionSelected = true;
}
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustUp()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
if (m_nCurrScreen != MENUPAGE_START_MENU) {
goBack = true;
}
@@ -4009,7 +4008,7 @@ CMenuManager::ProcessButtonPresses(void)
}
#ifndef TIDY_UP_PBP
- if (CPad::GetPad(0)->GetSquareJustDown()) {
+ if (CPad::GetPad(0)->GetBackJustDown()) {
if (m_nCurrScreen != MENUPAGE_START_MENU && m_nCurrScreen != MENUPAGE_PAUSE_MENU) {
m_bShowMouse = false;
goBack = true;
@@ -4050,11 +4049,11 @@ CMenuManager::ProcessButtonPresses(void)
if (!goDown && !goUp && !optionSelected) {
if (m_nCurrScreen != MENUPAGE_START_MENU) {
if (isPlainTextScreen(m_nCurrScreen)) {
- if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetSquareJustUp()) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) {
goBack = true;
}
} else {
- if (CPad::GetPad(0)->GetEscapeJustDown() || (m_nCurrScreen != MENUPAGE_PAUSE_MENU && CPad::GetPad(0)->GetSquareJustDown())) {
+ if (CPad::GetPad(0)->GetEscapeJustDown() || (m_nCurrScreen != MENUPAGE_PAUSE_MENU && CPad::GetPad(0)->GetBackJustDown())) {
m_bShowMouse = false;
goBack = true;
}
@@ -4300,12 +4299,7 @@ CMenuManager::ProcessButtonPresses(void)
} else {
#ifdef MENU_MAP
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu == MENUPAGE_MAP) {
- fMapCenterX = SCREEN_WIDTH / 2;
- fMapCenterY = SCREEN_HEIGHT / 3;
- fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio();
- bMapMouseShownOnce = false;
- CPad::GetPad(0)->Clear(false);
- CPad::GetPad(1)->Clear(false);
+ bMapLoaded = false;
}
#endif
@@ -4330,8 +4324,7 @@ CMenuManager::ProcessButtonPresses(void)
DoSettingsBeforeStartingAGame();
break;
case MENUACTION_RELOADIDE:
- // TODO
- // CFileLoader::ReloadObjectTypes("GTA3.IDE");
+ CFileLoader::ReloadObjectTypes("GTA3.IDE");
break;
case MENUACTION_RELOADIPL:
CGame::ReloadIPLs();
@@ -4913,8 +4906,19 @@ CMenuManager::SwitchMenuOnAndOff()
pControlEdit = nil;
m_bShutDownFrontEndRequested = false;
DisplayComboButtonErrMsg = false;
- CPad::GetPad(0)->Clear(0);
- CPad::GetPad(1)->Clear(0);
+
+#ifdef REGISTER_START_BUTTON
+ int16 start1 = CPad::GetPad(0)->PCTempJoyState.Start, start2 = CPad::GetPad(0)->PCTempKeyState.Start,
+ start3 = CPad::GetPad(0)->OldState.Start, start4 = CPad::GetPad(0)->NewState.Start;
+#endif
+ CPad::GetPad(0)->Clear(false);
+ CPad::GetPad(1)->Clear(false);
+#ifdef REGISTER_START_BUTTON
+ CPad::GetPad(0)->PCTempJoyState.Start = start1;
+ CPad::GetPad(0)->PCTempKeyState.Start = start2;
+ CPad::GetPad(0)->OldState.Start = start3;
+ CPad::GetPad(0)->NewState.Start = start4;
+#endif
m_nCurrScreen = MENUPAGE_NONE;
}
}
@@ -5025,7 +5029,7 @@ CMenuManager::PrintController(void)
CFont::SetFontStyle(FONT_BANK); // X
// CFont::SetScale(0.4f, 0.4f);
- CFont::SetScale(MENU_X(SMALLTEXT_X_SCALE), MENU_Y(SMALLTEXT_Y_SCALE)); // X
+ CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); // X
// CFont::SetColor(CRGBA(128, 128, 128, FadeIn(255)));
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); // X
@@ -5219,6 +5223,8 @@ CMenuManager::PrintController(void)
return;
}
}
+
+ CFont::SetDropShadowPosition(0); // X
}
#ifdef MENU_MAP
@@ -5243,6 +5249,20 @@ CMenuManager::PrintMap(void)
bMenuMapActive = true;
CRadar::InitFrontEndMap();
+ if (!bMapLoaded) {
+ fMapCenterX = SCREEN_WIDTH / 2;
+ fMapCenterY = SCREEN_HEIGHT / 3;
+ fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio();
+ bMapMouseShownOnce = false;
+ bMapLoaded = true;
+
+ // Let's wait for a frame to not toggle the waypoint
+ if (CPad::GetPad(0)->NewState.Cross) {
+ bMenuMapActive = false;
+ return;
+ }
+ }
+
// Because fMapSize is half of the map length, and map consists of 3x3 tiles.
float halfTile = fMapSize / 3.0f;
@@ -5601,6 +5621,9 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
}
#endif
+#undef GetBackJustUp
+#undef GetBackJustDown
+
STARTPATCHES
for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index a1ee53f2..81765af9 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -196,7 +196,7 @@ enum eMenuScreen
MENUPAGE_NEW_GAME_RELOAD = 10,
MENUPAGE_LOAD_SLOT_CONFIRM = 11,
MENUPAGE_DELETE_SLOT_CONFIRM = 12,
- MENUPAGE_NO_MEMORY_CARD = 13,
+ MENUPAGE_NO_MEMORY_CARD = 13, // hud adjustment page in mobile
MENUPAGE_LOADING_IN_PROGRESS = 14,
MENUPAGE_DELETING_IN_PROGRESS = 15,
MENUPAGE_PS2_LOAD_FAILED = 16,
@@ -240,7 +240,7 @@ enum eMenuScreen
MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
- MENUPAGE_57 = 57,
+ MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile
MENUPAGE_58 = 58,
#ifdef MENU_MAP
MENUPAGE_MAP = 59,
@@ -570,6 +570,7 @@ public:
#ifdef MENU_MAP
static bool bMenuMapActive;
static bool bMapMouseShownOnce;
+ static bool bMapLoaded;
static float fMapSize;
static float fMapCenterY;
static float fMapCenterX;
@@ -639,4 +640,4 @@ public:
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
-extern CMenuManager &FrontEndMenuManager;
+extern CMenuManager FrontEndMenuManager;
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h
index cece80c7..e1b1bac6 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.h
@@ -128,7 +128,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_NO_MEMORY_CARD = 13
{ "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
- MENUACTION_LABEL, "FEC_OFI", SAVESLOT_NONE, MENUPAGE_NONE, // only in mobile. FEC_OFI is missing
+ // hud adjustment page in mobile
},
// MENUPAGE_LOADING_IN_PROGRESS = 14
@@ -281,7 +281,6 @@ const CMenuScreen aScreens[] = {
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
-
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@@ -444,7 +443,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_57 = 57
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
-
+ // mission failed, wanna restart page in mobile
},
// MENUPAGE_58 = 58
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 78bfac1d..cb705c6b 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -418,6 +418,7 @@ public:
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
+ bool GetTriangleJustUp() { return !!(!NewState.Triangle && OldState.Triangle); }
bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); }
bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); }
bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); }
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 9fd3d60e..6add9e0c 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -183,7 +183,7 @@ INITSAVEBUF
if (!pVehicle)
continue;
bool bHasPassenger = false;
- for (int j = 0; j < 8; j++) {
+ for (int j = 0; j < ARRAY_SIZE(pVehicle->pPassengers); j++) {
if (pVehicle->pPassengers[i])
bHasPassenger = true;
}
@@ -203,7 +203,7 @@ INITSAVEBUF
if (!pVehicle)
continue;
bool bHasPassenger = false;
- for (int j = 0; j < 8; j++) {
+ for (int j = 0; j < ARRAY_SIZE(pVehicle->pPassengers); j++) {
if (pVehicle->pPassengers[j])
bHasPassenger = true;
}
diff --git a/src/core/Timer.h b/src/core/Timer.h
index b119bfb2..a4d674da 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -53,6 +53,9 @@ public:
static void Stop(void);
static void StartUserPause(void);
static void EndUserPause(void);
+
+ friend bool GenericLoad(void);
+ friend bool GenericSave(int file);
};
#ifdef FIX_BUGS
diff --git a/src/core/config.h b/src/core/config.h
index 8dea3216..f7fde579 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -87,6 +87,7 @@ enum Config {
NUMSCRIPTEDPICKUPS = 16,
NUMPICKUPS = NUMGENERALPICKUPS + NUMSCRIPTEDPICKUPS,
NUMCOLLECTEDPICKUPS = 20,
+ NUMPACMANPICKUPS = 256,
NUMEVENTS = 64,
NUM_CARGENS = 160,
@@ -192,7 +193,7 @@ enum Config {
// Pad
#define XINPUT
#define KANGAROO_CHEAT
-#define REGISTER_START_BUTTON // currently only in menu sadly. resumes the game
+#define REGISTER_START_BUTTON
// Hud, frontend and radar
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
@@ -200,6 +201,9 @@ enum Config {
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
#define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
+#define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
+#define TRIANGLE_BACK_BUTTON
+// #define CIRCLE_BACK_BUTTON
// Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 475176b6..096b9d9e 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -152,19 +152,6 @@ SpawnCar(int id)
}
static void
-LetThemFollowYou(void) {
- CPed *player = (CPed*) FindPlayerPed();
- for (int i = 0; i < player->m_numNearPeds; i++) {
- CPed *nearPed = player->m_nearPeds[i];
- if (nearPed && !nearPed->IsPlayer()) {
- nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
- nearPed->m_pedFormation = (eFormation)(1 + (rand() & 7));
- nearPed->bScriptObjectiveCompleted = false;
- }
- }
-}
-
-static void
FixCar(void)
{
CVehicle *veh = FindPlayerVehicle();
@@ -344,6 +331,7 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
+ DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); });
DebugMenuAddVarBool8("Debug", "Draw hud", (int8*)&CHud::m_Wants_To_Draw_Hud, nil);
DebugMenuAddVarBool8("Debug", "Edit on", (int8*)&CSceneEdit::m_bEditOn, nil);
@@ -372,8 +360,6 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
-
- DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou);
#ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);