From 489743da419b0da842e82dc6d430f6f3d8752055 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 14 Aug 2020 17:34:04 +0300 Subject: Darkel fixes --- src/control/Darkel.cpp | 16 +++++++++++----- src/control/Darkel.h | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index cfd58340..02627f33 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -30,9 +30,9 @@ int8 CDarkel::InterruptedWeapon; * makes game handle sounds & messages instead of SCM (just like in GTA2) * but it's never been used in the game. Has unused sliding text when frenzy completed etc. */ -int8 CDarkel::bStandardSoundAndMessages; -int8 CDarkel::bNeedHeadShot; -int8 CDarkel::bProperKillFrenzy; +bool CDarkel::bStandardSoundAndMessages; +bool CDarkel::bNeedHeadShot; +bool CDarkel::bProperKillFrenzy; uint16 CDarkel::Status; uint16 CDarkel::RegisteredKills[NUM_DEFAULT_MODELS]; int32 CDarkel::ModelToKill; @@ -108,9 +108,15 @@ CDarkel::DrawMessages() sprintf(gString, "%d", (CDarkel::KillsNeeded >= 0 ? CDarkel::KillsNeeded : 0)); AsciiToUnicode(gString, gUString); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString); +#ifdef FIX_BUGS +#define DARKEL_COUNTER_HEIGHT 143.0f +#else +#define DARKEL_COUNTER_HEIGHT 128.0f +#endif + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT + 1.0f), gUString); CFont::SetColor(CRGBA(255, 128, 128, 255)); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(143.0f), gUString); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(DARKEL_COUNTER_HEIGHT), gUString); +#undef DARKEL_COUNTER_HEIGHT break; } case KILLFRENZY_PASSED: diff --git a/src/control/Darkel.h b/src/control/Darkel.h index 14529c63..0f5c2329 100644 --- a/src/control/Darkel.h +++ b/src/control/Darkel.h @@ -24,9 +24,9 @@ private: static int32 AmmoInterruptedWeapon; static int32 KillsNeeded; static int8 InterruptedWeapon; - static int8 bStandardSoundAndMessages; - static int8 bNeedHeadShot; - static int8 bProperKillFrenzy; + static bool bStandardSoundAndMessages; + static bool bNeedHeadShot; + static bool bProperKillFrenzy; static uint16 Status; static uint16 RegisteredKills[NUM_DEFAULT_MODELS]; static int32 ModelToKill; -- cgit v1.2.3 From e7945625b59750459ff4876f7e076b4b8d5c3aee Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 14 Aug 2020 18:57:23 +0300 Subject: Original screen grabber --- src/core/FileMgr.h | 1 + src/core/main.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/skel/glfw/glfw.cpp | 16 ++++++++++++++++ src/skel/platform.h | 1 + src/skel/skeleton.cpp | 9 +++++++++ src/skel/skeleton.h | 3 +++ src/skel/win/win.cpp | 17 +++++++++++++++++ 7 files changed, 85 insertions(+) (limited to 'src') diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h index 0ad9daa7..4734720e 100644 --- a/src/core/FileMgr.h +++ b/src/core/FileMgr.h @@ -19,4 +19,5 @@ public: static bool ReadLine(int fd, char *buf, int len); static int CloseFile(int fd); static int GetErrorReadWrite(int fd); + static char *GetRootDirName() { return ms_rootDirName; } }; diff --git a/src/core/main.cpp b/src/core/main.cpp index b63688ec..8458a248 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -2,6 +2,7 @@ #include "rpmatfx.h" #include "rphanim.h" #include "rpskin.h" +#include "rtbmp.h" #include "main.h" #include "CdStream.h" @@ -61,6 +62,7 @@ #include "MemoryCard.h" #include "SceneEdit.h" #include "debugmenu.h" +#include "Clock.h" GlobalScene Scene; @@ -288,6 +290,28 @@ DoFade(void) } } +bool +RwGrabScreen(RwCamera *camera, RwChar *filename) +{ + char temp[255]; + RwImage *pImage = RsGrabScreen(camera); + bool result = true; + + if (pImage == nil) + return false; + + strcpy(temp, CFileMgr::GetRootDirName()); + strcat(temp, filename); + + if (RtBMPImageWrite(pImage, &temp[0]) == nil) + result = false; + RwImageDestroy(pImage); + return result; +} + +#define TILE_WIDTH 576 +#define TILE_HEIGHT 432 + void DoRWStuffEndOfFrame(void) { @@ -296,6 +320,20 @@ DoRWStuffEndOfFrame(void) FlushObrsPrintfs(); RwCameraEndUpdate(Scene.camera); RsCameraShowRaster(Scene.camera); +#ifndef MASTER + char s[48]; + if (CPad::GetPad(1)->GetLeftShockJustDown()) { + // try using both controllers for this thing... crazy bastards + if (CPad::GetPad(0)->GetRightStickY() > 0) { + sprintf(s, "screen%d%d.ras", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes); + // TODO + //RtTileRender(Scene.camera, TILE_WIDTH * 2, TILE_HEIGHT * 2, TILE_WIDTH, TILE_HEIGHT, &NewTileRendererCB, nil, s); + } else { + sprintf(s, "screen%d%d.bmp", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes); + RwGrabScreen(Scene.camera, s); + } + } +#endif // !MASTER } static RwBool diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index ed442348..920bb8a9 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -181,6 +181,22 @@ psCameraShowRaster(RwCamera *camera) return; } +/* + ***************************************************************************** + */ +RwImage * +psGrabScreen(RwCamera *pCamera) +{ +#ifndef LIBRW + RwRaster *pRaster = RwCameraGetRaster(pCamera); + if (RwImage *pImage = RwImageCreate(pRaster->width, pRaster->height, 32)) { + RwImageAllocatePixels(pImage); + RwImageSetFromRaster(pImage, pRaster); + return pImage; + } +#endif + return nil; +} /* ***************************************************************************** diff --git a/src/skel/platform.h b/src/skel/platform.h index 0f314b9d..c9a8a11f 100644 --- a/src/skel/platform.h +++ b/src/skel/platform.h @@ -22,6 +22,7 @@ extern void psTerminate(void); extern void psCameraShowRaster(RwCamera *camera); extern RwBool psCameraBeginUpdate(RwCamera *camera); +extern RwImage *psGrabScreen(RwCamera *camera); extern void psMouseSetPos(RwV2d *pos); diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp index 8191107e..4780316a 100644 --- a/src/skel/skeleton.cpp +++ b/src/skel/skeleton.cpp @@ -50,6 +50,15 @@ RsCameraBeginUpdate(RwCamera * camera) return psCameraBeginUpdate(camera); } +/* + ***************************************************************************** + */ +RwImage* +RsGrabScreen(RwCamera *camera) +{ + return psGrabScreen(camera); +} + /* ***************************************************************************** */ diff --git a/src/skel/skeleton.h b/src/skel/skeleton.h index b5ea5abf..1c468179 100644 --- a/src/skel/skeleton.h +++ b/src/skel/skeleton.h @@ -274,6 +274,9 @@ RsCameraBeginUpdate(RwCamera *camera); //extern void //RsMouseSetVisibility(RwBool visible); +extern RwImage* +RsGrabScreen(RwCamera *camera); + extern void RsMouseSetPos(RwV2d *pos); diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index cf4749b1..a064788c 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -238,6 +238,23 @@ psCameraShowRaster(RwCamera *camera) } +/* + ***************************************************************************** + */ +RwImage * +psGrabScreen(RwCamera *pCamera) +{ +#ifndef LIBRW + RwRaster *pRaster = RwCameraGetRaster(pCamera); + if (RwImage *pImage = RwImageCreate(pRaster->width, pRaster->height, 32)) { + RwImageAllocatePixels(pImage); + RwImageSetFromRaster(pImage, pRaster); + return pImage; + } +#endif + return nil; +} + /* ***************************************************************************** */ -- cgit v1.2.3 From 72088a000b6fc0d641f5b94f6aa6586e9e2d9e8b Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 14 Aug 2020 19:42:15 +0300 Subject: Don't react if player's targeting with melee --- src/peds/Ped.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index f52b373e..a15927ff 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -10232,7 +10232,11 @@ CPed::ProcessControl(void) CPed::Chat(); break; case PED_AIM_GUN: - if (m_pPointGunAt && m_pPointGunAt->IsPed() && ((CPed*)m_pPointGunAt)->CanSeeEntity(this, CAN_SEE_ENTITY_ANGLE_THRESHOLD * 2)) { + if (m_pPointGunAt && m_pPointGunAt->IsPed() +#ifdef FIX_BUGS + && !GetWeapon()->IsTypeMelee() +#endif + && ((CPed*)m_pPointGunAt)->CanSeeEntity(this, CAN_SEE_ENTITY_ANGLE_THRESHOLD * 2)) { ((CPed*)m_pPointGunAt)->ReactToPointGun(this); } PointGunAt(); -- cgit v1.2.3 From a728a542be7b3cf5dde16184dea071c50fdd38c0 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 16 Aug 2020 01:37:09 +0300 Subject: Graphics menu + MSAA --- src/core/Frontend.cpp | 215 +++++++++++++++++++++++++++++++++++++++++++++-- src/core/Frontend.h | 22 ++++- src/core/MenuScreens.cpp | 85 ++++++++++++++++--- src/core/config.h | 9 +- src/core/re3.cpp | 28 +++--- src/skel/win/win.cpp | 4 +- 6 files changed, 326 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 95d5f6e6..df65f94f 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -116,6 +116,12 @@ int32 CMenuManager::m_PrefsSfxVolume = 102; bool CMenuManager::m_PrefsCutsceneBorders = true; #endif + +#ifdef MULTISAMPLING +int8 CMenuManager::m_nPrefsMSAALevel = 0; +int8 CMenuManager::m_nDisplayMSAALevel = 0; +#endif + char CMenuManager::m_PrefsSkinFile[256] = DEFAULT_SKIN_NAME; int32 CMenuManager::m_KeyPressedCode = -1; @@ -399,8 +405,15 @@ CMenuManager::ThingsToDoBeforeGoingBack() DMAudio.StopFrontEndTrack(); OutputDebugString("FRONTEND AUDIO TRACK STOPPED"); #endif +#ifdef GRAPHICS_MENU_OPTIONS } else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { +#else + } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { +#endif m_nDisplayVideoMode = m_nPrefsVideoMode; +#ifdef MULTISAMPLING + m_nDisplayMSAALevel = m_nPrefsMSAALevel; +#endif } if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) { @@ -848,7 +861,7 @@ CMenuManager::Draw() CFont::SetCentreOn(); break; case MENUPAGE_SOUND_SETTINGS: - case MENUPAGE_GRAPHICS_SETTINGS: + case MENUPAGE_DISPLAY_SETTINGS: case MENUPAGE_MULTIPLAYER_CREATE: case MENUPAGE_SKIN_SELECT_OLD: case MENUPAGE_CONTROLLER_PC_OLD1: @@ -856,7 +869,10 @@ CMenuManager::Draw() case MENUPAGE_CONTROLLER_PC_OLD3: case MENUPAGE_CONTROLLER_PC_OLD4: case MENUPAGE_CONTROLLER_DEBUG: - case MENUPAGE_MOUSE_CONTROLS: + case MENUPAGE_MOUSE_CONTROLS: +#ifdef GRAPHICS_MENU_OPTIONS + case MENUPAGE_GRAPHICS_SETTINGS: +#endif columnWidth = 50; headerHeight = 0; lineHeight = 20; @@ -1155,6 +1171,25 @@ CMenuManager::Draw() AsciiToUnicode(_psGetVideoModeList()[m_nDisplayVideoMode], unicodeTemp); rightText = unicodeTemp; break; +#ifdef IMPROVED_VIDEOMODE + case MENUACTION_SCREENFORMAT: + rightText = TheText.Get(FrontEndMenuManager.m_nSelectedScreenMode ? "FED_WND" : "FED_FLS"); + break; +#endif +#ifdef MULTISAMPLING + case MENUACTION_MULTISAMPLING: + switch (m_nDisplayMSAALevel) { + case 0: + rightText = TheText.Get("FEM_OFF"); + break; + default: + sprintf(gString, "%iX", 1 << (m_nDisplayMSAALevel)); + AsciiToUnicode(gString, unicodeTemp); + rightText = unicodeTemp; + break; + } + break; +#endif case MENUACTION_AUDIOHW: if (m_nPrefsAudio3DProviderIndex == -1) rightText = TheText.Get("FEA_NAH"); @@ -1205,6 +1240,11 @@ CMenuManager::Draw() case MENUACTION_MOUSESTEER: rightText = TheText.Get(CVehicle::m_bDisableMouseSteering ? "FEM_OFF" : "FEM_ON"); break; +#ifdef CUTSCENE_BORDERS_SWITCH + case MENUACTION_CUTSCENEBORDERS: + rightText = TheText.Get(m_PrefsCutsceneBorders ? "FEM_ON" : "FEM_OFF"); + break; +#endif #ifdef CUSTOM_FRONTEND_OPTIONS case MENUACTION_TRIGGERFUNC: FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; @@ -1306,7 +1346,14 @@ CMenuManager::Draw() CFont::SetRightJustifyOn(); if(textLayer == 1) - if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES") + if((!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES") +#ifdef IMPROVED_VIDEOMODE + || !strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEM_SCF") +#endif +#ifdef MULTISAMPLING + || !strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_AAS") +#endif + ) && !m_bGameNotLoaded #ifdef CUSTOM_FRONTEND_OPTIONS || isOptionDisabled @@ -1331,6 +1378,18 @@ CMenuManager::Draw() if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES") && m_nHelperTextMsgId == 1) ResetHelperText(); } +#ifdef IMPROVED_VIDEOMODE + if (m_nSelectedScreenMode == m_nPrefsWindowed) { + if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEM_SCF") && m_nHelperTextMsgId == 1) + ResetHelperText(); + } +#endif +#ifdef MULTISAMPLING + if (m_nDisplayMSAALevel == m_nPrefsMSAALevel) { + if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_AAS") && m_nHelperTextMsgId == 1) + ResetHelperText(); + } +#endif if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) { if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH")) SetHelperText(1); @@ -1339,6 +1398,18 @@ CMenuManager::Draw() if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES")) SetHelperText(1); } +#ifdef IMPROVED_VIDEOMODE + if (m_nSelectedScreenMode != m_nPrefsWindowed) { + if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEM_SCF")) + SetHelperText(1); + } +#endif +#ifdef MULTISAMPLING + if (m_nDisplayMSAALevel != m_nPrefsMSAALevel) { + if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_AAS")) + SetHelperText(1); + } +#endif if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) { if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH") != 0 && m_nCurrScreen == MENUPAGE_SOUND_SETTINGS && m_nPrefsAudio3DProviderIndex != -1) { @@ -1349,11 +1420,41 @@ CMenuManager::Draw() } if (m_nDisplayVideoMode != m_nPrefsVideoMode) { if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES") != 0 - && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { +#ifdef GRAPHICS_MENU_OPTIONS + && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { +#else + && m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { +#endif m_nDisplayVideoMode = m_nPrefsVideoMode; SetHelperText(3); } } +#ifdef IMPROVED_VIDEOMODE + if (m_nSelectedScreenMode != m_nPrefsWindowed) { + if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEM_SCF") != 0 +#ifdef GRAPHICS_MENU_OPTIONS + && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { +#else + && m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { +#endif + m_nSelectedScreenMode = m_nPrefsWindowed; + SetHelperText(3); + } + } +#endif +#ifdef MULTISAMPLING + if (m_nSelectedScreenMode != m_nPrefsWindowed) { + if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_AAS") != 0 +#ifdef GRAPHICS_MENU_OPTIONS + && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { +#else + && m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { +#endif + m_nDisplayMSAALevel = m_nPrefsMSAALevel; + SetHelperText(3); + } + } +#endif #ifdef CUSTOM_FRONTEND_OPTIONS if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) { @@ -1419,10 +1520,13 @@ CMenuManager::Draw() switch (m_nCurrScreen) { case MENUPAGE_CONTROLLER_SETTINGS: case MENUPAGE_SOUND_SETTINGS: - case MENUPAGE_GRAPHICS_SETTINGS: + case MENUPAGE_DISPLAY_SETTINGS: case MENUPAGE_SKIN_SELECT: case MENUPAGE_CONTROLLER_PC: case MENUPAGE_MOUSE_CONTROLS: +#ifdef GRAPHICS_MENU_OPTIONS + case MENUPAGE_GRAPHICS_SETTINGS: +#endif DisplayHelperText(); break; } @@ -2079,7 +2183,7 @@ CMenuManager::DrawFrontEnd() bbNames[0] = { "FEB_SAV",MENUPAGE_NEW_GAME }; bbNames[1] = { "FEB_CON",MENUPAGE_CONTROLLER_PC }; bbNames[2] = { "FEB_AUD",MENUPAGE_SOUND_SETTINGS }; - bbNames[3] = { "FEB_DIS",MENUPAGE_GRAPHICS_SETTINGS }; + bbNames[3] = { "FEB_DIS",MENUPAGE_DISPLAY_SETTINGS }; bbNames[4] = { "FEB_LAN",MENUPAGE_LANGUAGE_SETTINGS }; bbNames[5] = { "FESZ_QU",MENUPAGE_EXIT }; bbTabCount = 6; @@ -2091,7 +2195,7 @@ CMenuManager::DrawFrontEnd() bbNames[2] = { "FEB_BRI",MENUPAGE_BRIEFS }; bbNames[3] = { "FEB_CON",MENUPAGE_CONTROLLER_PC }; bbNames[4] = { "FEB_AUD",MENUPAGE_SOUND_SETTINGS }; - bbNames[5] = { "FEB_DIS",MENUPAGE_GRAPHICS_SETTINGS }; + bbNames[5] = { "FEB_DIS",MENUPAGE_DISPLAY_SETTINGS }; bbNames[6] = { "FEB_LAN",MENUPAGE_LANGUAGE_SETTINGS }; bbNames[7] = { "FESZ_QU",MENUPAGE_EXIT }; bbTabCount = 8; @@ -2212,7 +2316,7 @@ CMenuManager::DrawFrontEndNormal() case MENUPAGE_DELETE_SLOT_CONFIRM: currentSprite = FE_ICONSAVE; break; - case MENUPAGE_GRAPHICS_SETTINGS: + case MENUPAGE_DISPLAY_SETTINGS: currentSprite = FE_ICONDISPLAY; break; case MENUPAGE_SOUND_SETTINGS: @@ -3224,6 +3328,10 @@ CMenuManager::LoadSettings() #endif #ifdef CUTSCENE_BORDERS_SWITCH CFileMgr::Read(fileHandle, (char *)&CMenuManager::m_PrefsCutsceneBorders, 1); +#endif +#ifdef MULTISAMPLING + CFileMgr::Read(fileHandle, (char *)&m_nPrefsMSAALevel, 1); + m_nDisplayMSAALevel = m_nPrefsMSAALevel; #endif } } @@ -3320,6 +3428,9 @@ CMenuManager::SaveSettings() #endif #ifdef CUTSCENE_BORDERS_SWITCH CFileMgr::Write(fileHandle, (char *)&CMenuManager::m_PrefsCutsceneBorders, 1); +#endif +#ifdef MULTISAMPLING + CFileMgr::Write(fileHandle, (char *)&CMenuManager::m_nPrefsMSAALevel, 1); #endif } @@ -4638,7 +4749,27 @@ CMenuManager::ProcessButtonPresses(void) SetHelperText(0); SaveSettings(); } + break; +#ifdef IMPROVED_VIDEOMODE + case MENUACTION_SCREENFORMAT: + if (m_nSelectedScreenMode != m_nPrefsWindowed) { + m_nPrefsWindowed = m_nSelectedScreenMode; + _psSelectScreenVM(m_nPrefsVideoMode); + SetHelperText(0); + SaveSettings(); + } break; +#endif +#ifdef MULTISAMPLING + case MENUACTION_MULTISAMPLING: + if (m_nDisplayMSAALevel != m_nPrefsMSAALevel) { + m_nPrefsMSAALevel = m_nDisplayMSAALevel; + _psSelectScreenVM(m_nPrefsVideoMode); + SetHelperText(0); + SaveSettings(); + } + break; +#endif case MENUACTION_AUDIOHW: { int selectedProvider = m_nPrefsAudio3DProviderIndex; @@ -4685,7 +4816,8 @@ CMenuManager::ProcessButtonPresses(void) DMAudio.SetRadioInCar(m_PrefsRadioStation); DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); SaveSettings(); - } else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { +#ifndef GRAPHICS_MENU_OPTIONS + } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { m_PrefsFrameLimiter = true; m_PrefsBrightness = 256; m_PrefsVsyncDisp = true; @@ -4706,8 +4838,40 @@ CMenuManager::ProcessButtonPresses(void) } #else CMBlur::BlurOn = true; +#endif +#ifdef CUTSCENE_BORDERS_SWITCH + m_PrefsCutsceneBorders = true; #endif SaveSettings(); +#else + } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { + m_PrefsBrightness = 256; + m_PrefsShowSubtitles = true; +#ifdef CUTSCENE_BORDERS_SWITCH + m_PrefsCutsceneBorders = true; +#endif + SaveSettings(); + } else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { + m_PrefsFrameLimiter = true; + m_PrefsUseWideScreen = false; + m_PrefsVsyncDisp = true; + m_PrefsLOD = 1.2f; + m_PrefsVsync = true; + CRenderer::ms_lodDistScale = 1.2f; + m_nDisplayVideoMode = m_nPrefsVideoMode; +#ifdef GTA3_1_1_PATCH + if (_dwOperatingSystemVersion == OS_WIN98) { + CMBlur::BlurOn = false; + CMBlur::MotionBlurClose(); + } else { + CMBlur::BlurOn = true; + CMBlur::MotionBlurOpen(Scene.camera); + } +#else + CMBlur::BlurOn = true; +#endif // GTA3_1_1_PATCH + SaveSettings(); +#endif // GRAPHICS_MENU_OPTIONS } else if ((m_nCurrScreen != MENUPAGE_SKIN_SELECT_OLD) && (m_nCurrScreen == MENUPAGE_CONTROLLER_PC)) { ControlsManager.MakeControllerActionsBlank(); ControlsManager.InitDefaultControlConfiguration(); @@ -4966,6 +5130,32 @@ CMenuManager::ProcessButtonPresses(void) } } break; +#ifdef IMPROVED_VIDEOMODE + case MENUACTION_SCREENFORMAT: + if (m_bGameNotLoaded) { + FrontEndMenuManager.m_nSelectedScreenMode = !FrontEndMenuManager.m_nSelectedScreenMode; + } + break; +#endif +#ifdef MULTISAMPLING + case MENUACTION_MULTISAMPLING: + if (m_bGameNotLoaded) { + m_nDisplayMSAALevel += changeValueBy; + + int i = 0; + int maxAA = RwD3D8EngineGetMaxMultiSamplingLevels(); + while (maxAA != 1) { + i++; + maxAA >>= 1; + } + + if (m_nDisplayMSAALevel < 0) + m_nDisplayMSAALevel = i; + else if (m_nDisplayMSAALevel > i) + m_nDisplayMSAALevel = 0; + } + break; +#endif case MENUACTION_AUDIOHW: if (m_nPrefsAudio3DProviderIndex != -1) { m_nPrefsAudio3DProviderIndex += changeValueBy; @@ -5131,6 +5321,13 @@ CMenuManager::ProcessOnOffMenuOptions() DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; +#ifdef CUTSCENE_BORDERS_SWITCH + case MENUACTION_CUTSCENEBORDERS: + m_PrefsCutsceneBorders = !m_PrefsCutsceneBorders; + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); + SaveSettings(); + break; +#endif } } diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 7b0e2f4b..c9af7c10 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -183,7 +183,7 @@ enum eMenuScreen MENUPAGE_BRIEFS = 3, MENUPAGE_CONTROLLER_SETTINGS = 4, MENUPAGE_SOUND_SETTINGS = 5, - MENUPAGE_GRAPHICS_SETTINGS = 6, + MENUPAGE_DISPLAY_SETTINGS = 6, MENUPAGE_LANGUAGE_SETTINGS = 7, MENUPAGE_CHOOSE_LOAD_SLOT = 8, MENUPAGE_CHOOSE_DELETE_SLOT = 9, @@ -238,6 +238,9 @@ enum eMenuScreen MENUPAGE_58 = 58, #ifdef MENU_MAP MENUPAGE_MAP = 59, +#endif +#ifdef GRAPHICS_MENU_OPTIONS + MENUPAGE_GRAPHICS_SETTINGS, #endif MENUPAGES }; @@ -359,6 +362,19 @@ enum eMenuAction MENUACTION_UNK112, MENUACTION_REJECT_RETRY, MENUACTION_UNK114, +#ifdef IMPROVED_VIDEOMODE + MENUACTION_SCREENFORMAT, +#endif +#ifdef ANISOTROPIC_FILTERING + MENUACTION_MIPMAPS, + MENUACTION_TEXTURE_FILTERING, +#endif +#ifdef MULTISAMPLING + MENUACTION_MULTISAMPLING, +#endif +#ifdef CUTSCENE_BORDERS_SWITCH + MENUACTION_CUTSCENEBORDERS, +#endif #ifdef CUSTOM_FRONTEND_OPTIONS MENUACTION_TRIGGERFUNC #endif @@ -532,6 +548,10 @@ public: int32 m_nPrefsSubsystem; int32 m_nSelectedScreenMode; #endif +#ifdef MULTISAMPLING + static int8 m_nPrefsMSAALevel; + static int8 m_nDisplayMSAALevel; +#endif enum LANGUAGE { diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp index 4685918e..c313944c 100644 --- a/src/core/MenuScreens.cpp +++ b/src/core/MenuScreens.cpp @@ -4,6 +4,32 @@ // If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp. +#ifdef CUTSCENE_BORDERS_SWITCH +#define MENU_CUTSCENE_BORDERS_SWITCH(screen) MENUACTION_CUTSCENEBORDERS, "FEM_CSB", SAVESLOT_NONE, screen, +#else +#define MENU_CUTSCENE_BORDERS_SWITCH(screen) +#endif + +#ifdef IMPROVED_VIDEOMODE +#define MENU_IMPROVED_VIDEOMODE(screen) MENUACTION_SCREENFORMAT, "FEM_SCF", SAVESLOT_NONE, screen, +#else +#define MENU_IMPROVED_VIDEOMODE(screen) +#endif + +#ifdef ANISOTROPIC_FILTERING +#define MENU_MIPMAPS(screen) MENUACTION_MIPMAPS, "FED_MIP", SAVESLOT_NONE, screen, +#define MENU_TEXTURE_FILTERING(screen) MENUACTION_TEXTURE_FILTERING, "FED_FIL", SAVESLOT_NONE, screen, +#else +#define MENU_MIPMAPS(screen) +#define MENU_TEXTURE_FILTERING(screen) +#endif + +#ifdef MULTISAMPLING +#define MENU_MULTISAMPLING(screen) MENUACTION_MULTISAMPLING, "FED_AAS", SAVESLOT_NONE, screen, +#else +#define MENU_MULTISAMPLING(screen) +#endif + CMenuScreen aScreens[] = { // MENUPAGE_NONE = 0 { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, @@ -46,19 +72,35 @@ CMenuScreen aScreens[] = { MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, - // MENUPAGE_GRAPHICS_SETTINGS = 6 + // MENUPAGE_DISPLAY_SETTINGS = 6 +#ifndef GRAPHICS_MENU_OPTIONS { "FET_DIS", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2, - MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, - MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, - MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, - MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, - MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, - MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, - MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, - MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, - MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENU_CUTSCENE_BORDERS_SWITCH(MENUPAGE_DISPLAY_SETTINGS) + MENU_MIPMAPS(MENUPAGE_DISPLAY_SETTINGS) + MENU_TEXTURE_FILTERING(MENUPAGE_DISPLAY_SETTINGS) + MENU_MULTISAMPLING(MENUPAGE_DISPLAY_SETTINGS) + MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENU_IMPROVED_VIDEOMODE(MENUPAGE_DISPLAY_SETTINGS) + MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, + }, +#else + { "FET_DIS", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2, + MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, + MENU_CUTSCENE_BORDERS_SWITCH(MENUPAGE_DISPLAY_SETTINGS) + MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, +#endif // GRAPHICS_MENU_OPTIONS + // MENUPAGE_LANGUAGE_SETTINGS = 7 { "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3, @@ -322,7 +364,10 @@ CMenuScreen aScreens[] = { { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4, MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, - MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, +#ifdef GRAPHICS_MENU_OPTIONS + MENUACTION_CHANGEMENU, "FET_GRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, +#endif MENUACTION_CHANGEMENU, "FET_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, MENUACTION_PLAYERSETUP, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, @@ -446,6 +491,24 @@ CMenuScreen aScreens[] = { MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, #endif + +#ifdef GRAPHICS_MENU_OPTIONS + // MENUPAGE_GRAPHICS_SETTINGS = 60 + { "FET_GRA", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2, + MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENU_MIPMAPS(MENUPAGE_GRAPHICS_SETTINGS) + MENU_TEXTURE_FILTERING(MENUPAGE_GRAPHICS_SETTINGS) + MENU_MULTISAMPLING(MENUPAGE_GRAPHICS_SETTINGS) + MENU_IMPROVED_VIDEOMODE(MENUPAGE_GRAPHICS_SETTINGS) + MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, + }, +#endif }; #endif \ No newline at end of file diff --git a/src/core/config.h b/src/core/config.h index bb6adce6..081d9b39 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -209,6 +209,12 @@ enum Config { //#define USE_TEXTURE_POOL #define CUTSCENE_BORDERS_SWITCH //#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur) +#define MULTISAMPLING // adds MSAA option + +#ifdef LIBRW +// these are not supported with librw yet +# undef MULTISAMPLING +#endif // Particle //#define PC_PARTICLE @@ -233,14 +239,15 @@ enum Config { #ifndef PC_MENU # define PS2_MENU //# define PS2_MENU_USEALLPAGEICONS -#else # 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. +#else # 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 # define CUSTOM_FRONTEND_OPTIONS +# define GRAPHICS_MENU_OPTIONS #endif // Script diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 9edd9497..dbc526dd 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -111,7 +111,7 @@ void LangJapSelect(int8 action) } #endif -#ifdef IMPROVED_VIDEOMODE +/*#ifdef IMPROVED_VIDEOMODE void ScreenModeChange(int8 displayedValue) { if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) { @@ -121,7 +121,7 @@ void ScreenModeChange(int8 displayedValue) FrontEndMenuManager.SaveSettings(); } } -#endif +#endif*/ #ifdef FREE_CAM void ToggleFreeCam(int8 action) @@ -133,13 +133,13 @@ void ToggleFreeCam(int8 action) } #endif -#ifdef CUTSCENE_BORDERS_SWITCH -void BorderModeChange(int8 displayedValue) -{ - CMenuManager::m_PrefsCutsceneBorders = !!displayedValue; - FrontEndMenuManager.SaveSettings(); -} -#endif +//#ifdef CUTSCENE_BORDERS_SWITCH +//void BorderModeChange(int8 displayedValue) +//{ +// CMenuManager::m_PrefsCutsceneBorders = !!displayedValue; +// FrontEndMenuManager.SaveSettings(); +//} +//#endif // Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind void @@ -154,11 +154,11 @@ CustomFrontendOptionsPopulate(void) FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, LangJapSelect, nil); #endif -#ifdef IMPROVED_VIDEOMODE +/*#ifdef IMPROVED_VIDEOMODE static const wchar *screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" }; FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 8); FrontendOptionAddSelect(TheText.Get("SCRFOR"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil); -#endif +#endif*/ #ifdef MENU_MAP FrontendOptionSetPosition(MENUPAGE_PAUSE_MENU, 2); @@ -171,11 +171,11 @@ CustomFrontendOptionsPopulate(void) FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil); #endif -#ifdef CUTSCENE_BORDERS_SWITCH +/*#ifdef CUTSCENE_BORDERS_SWITCH static const wchar *off_on[] = { TheText.Get("FEM_OFF"), TheText.Get("FEM_ON") }; - FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 9); + FrontendOptionSetPosition(MENUPAGE_DISPLAY_SETTINGS, 3); FrontendOptionAddSelect((const wchar *)L"CUTSCENE BORDERS", off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil); -#endif +#endif*/ } #endif diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index a064788c..e79a8150 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1597,7 +1597,9 @@ psSelectDevice() PSGLOBAL(fullScreen) = FALSE; #endif } - +#ifdef MULTISAMPLING + RwD3D8EngineSetMultiSamplingLevels(1 << FrontEndMenuManager.m_nPrefsMSAALevel); +#endif return TRUE; } -- cgit v1.2.3 From 732681db08438f0d61ad7fe4d670f79feaac7b9e Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 16 Aug 2020 17:26:44 +0300 Subject: Island loading and PS2 alpha test added to options --- src/control/Record.cpp | 8 +- src/control/Script.cpp | 60 ++++++++----- src/core/Collision.cpp | 112 +++++++++++++++--------- src/core/Collision.h | 3 + src/core/Frontend.cpp | 183 ++++++++++++++++++++++++++++++++++++++++ src/core/Frontend.h | 18 ++++ src/core/MenuScreens.cpp | 16 ++++ src/core/Streaming.cpp | 40 ++++++--- src/core/config.h | 2 +- src/modelinfo/ModelInfo.cpp | 28 +++--- src/render/Renderer.cpp | 16 ++-- src/save/GenericGameStorage.cpp | 22 +++-- 12 files changed, 403 insertions(+), 105 deletions(-) (limited to 'src') diff --git a/src/control/Record.cpp b/src/control/Record.cpp index 8dc0028a..8a23ffde 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -9,6 +9,7 @@ #include "Timer.h" #include "VehicleModelInfo.h" #include "World.h" +#include "Frontend.h" uint16 CRecordDataForGame::RecordingState; uint8* CRecordDataForGame::pDataBuffer; @@ -439,10 +440,11 @@ void CRecordDataForChase::StartChaseScene(float startTime) Status = STATE_PLAYBACK; AnimTime = startTime; AnimStartTime = CTimer::GetTimeInMilliseconds(); -#ifndef NO_ISLAND_LOADING - RemoveUnusedCollision(); - CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + RemoveUnusedCollision(); + CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); CGame::TidyUpMemory(true, true); CStreaming::ImGonnaUseStreamingMemory(); CFileMgr::SetDir("data\\paths"); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 6eb802b4..fa0fb463 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -10017,15 +10017,21 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; -#ifndef NO_ISLAND_LOADING - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + } CCollision::SortOutCollisionAfterLoad(); -#ifndef NO_ISLAND_LOADING - CStreaming::RequestIslands(CGame::currLevel); - CStreaming::LoadAllRequestedModels(true); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) #endif + { + CStreaming::RequestIslands(CGame::currLevel); + CStreaming::LoadAllRequestedModels(true); + } CTimer::Update(); return 0; } @@ -10641,24 +10647,40 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; if (CGame::currLevel != CCollision::ms_collisionInMemory) { -#ifndef NO_ISLAND_LOADING - DMAudio.SetEffectsFadeVol(0); - CPad::StopPadsShaking(); - CCollision::LoadCollisionScreen(CGame::currLevel); - DMAudio.Service(); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + DMAudio.SetEffectsFadeVol(0); + CPad::StopPadsShaking(); + CCollision::LoadCollisionScreen(CGame::currLevel); + DMAudio.Service(); + } CPopulation::DealWithZoneChange(CCollision::ms_collisionInMemory, CGame::currLevel, false); -#ifndef NO_ISLAND_LOADING - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + } CCollision::SortOutCollisionAfterLoad(); -#ifndef NO_ISLAND_LOADING - CStreaming::RequestIslands(CGame::currLevel); - CStreaming::RequestBigBuildings(CGame::currLevel); - CStreaming::LoadAllRequestedModels(true); - DMAudio.SetEffectsFadeVol(127); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) +#endif + CStreaming::RequestIslands(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) +#endif + CStreaming::RequestBigBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) +#endif + CStreaming::LoadAllRequestedModels(true); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + DMAudio.SetEffectsFadeVol(127); } CTimer::Update(); return 0; diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index 6522ff1c..bd0dfb92 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -21,6 +21,7 @@ #include "SurfaceTable.h" #include "Lines.h" #include "Collision.h" +#include "Frontend.h" // TODO: where do these go? @@ -519,74 +520,101 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange) } } - if(level == CGame::currLevel || forceChange){ + if (level == CGame::currLevel || forceChange) { CTimer::Stop(); -#ifndef NO_ISLAND_LOADING - DMAudio.SetEffectsFadeVol(0); - CPad::StopPadsShaking(); - LoadCollisionScreen(CGame::currLevel); - DMAudio.Service(); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + DMAudio.SetEffectsFadeVol(0); + CPad::StopPadsShaking(); + LoadCollisionScreen(CGame::currLevel); + DMAudio.Service(); + } CPopulation::DealWithZoneChange(ms_collisionInMemory, CGame::currLevel, false); -#ifndef NO_ISLAND_LOADING - CStreaming::RemoveIslandsNotUsed(LEVEL_INDUSTRIAL); - CStreaming::RemoveIslandsNotUsed(LEVEL_COMMERCIAL); - CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); - CStreaming::RemoveBigBuildings(LEVEL_INDUSTRIAL); - CStreaming::RemoveBigBuildings(LEVEL_COMMERCIAL); - CStreaming::RemoveBigBuildings(LEVEL_SUBURBAN); - CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); - CStreaming::RemoveUnusedModelsInLoadedList(); - CGame::TidyUpMemory(true, true); - CFileLoader::LoadCollisionFromDatFile(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) +#endif + { + CStreaming::RemoveIslandsNotUsed(LEVEL_INDUSTRIAL); + CStreaming::RemoveIslandsNotUsed(LEVEL_COMMERCIAL); + CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); + } +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RemoveBigBuildings(LEVEL_INDUSTRIAL); + CStreaming::RemoveBigBuildings(LEVEL_COMMERCIAL); + CStreaming::RemoveBigBuildings(LEVEL_SUBURBAN); + CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); + CStreaming::RemoveUnusedModelsInLoadedList(); + CGame::TidyUpMemory(true, true); + CFileLoader::LoadCollisionFromDatFile(CGame::currLevel); + } ms_collisionInMemory = CGame::currLevel; CReplay::EmptyReplayBuffer(); -#ifndef NO_ISLAND_LOADING - if(CGame::currLevel != LEVEL_GENERIC) - LoadSplash(GetLevelSplashScreen(CGame::currLevel)); - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); - CStreaming::RequestBigBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) +#endif + { + if (CGame::currLevel != LEVEL_GENERIC) + LoadSplash(GetLevelSplashScreen(CGame::currLevel)); + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + CStreaming::RequestBigBuildings(CGame::currLevel); + } +#ifdef NO_ISLAND_LOADING + else if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_MEDIUM) + CStreaming::RequestIslands(CGame::currLevel); #endif CStreaming::LoadAllRequestedModels(true); -#ifndef NO_ISLAND_LOADING - CStreaming::HaveAllBigBuildingsLoaded(CGame::currLevel); - - CGame::TidyUpMemory(true, true); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::HaveAllBigBuildingsLoaded(CGame::currLevel); + + CGame::TidyUpMemory(true, true); + } CTimer::Update(); -#ifndef NO_ISLAND_LOADING - DMAudio.SetEffectsFadeVol(127); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + DMAudio.SetEffectsFadeVol(127); } } +#ifdef NO_ISLAND_LOADING +bool CCollision::bAlreadyLoaded = false; +#endif void CCollision::SortOutCollisionAfterLoad(void) { if(ms_collisionInMemory == CGame::currLevel) return; -#ifndef NO_ISLAND_LOADING - CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); + if (CGame::currLevel != LEVEL_GENERIC) { #ifdef NO_ISLAND_LOADING - static bool bAlreadyLoaded = false; - if (bAlreadyLoaded) { - ms_collisionInMemory = CGame::currLevel; - return; - } - bAlreadyLoaded = true; - CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL); - CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL); - CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN); -#else - CFileLoader::LoadCollisionFromDatFile(CGame::currLevel); + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_LOW) { + if (bAlreadyLoaded) { + ms_collisionInMemory = CGame::currLevel; + return; + } + bAlreadyLoaded = true; + CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL); + CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL); + CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN); + } else #endif + CFileLoader::LoadCollisionFromDatFile(CGame::currLevel); if(!CGame::playingIntro) LoadSplash(GetLevelSplashScreen(CGame::currLevel)); } diff --git a/src/core/Collision.h b/src/core/Collision.h index d7498ac0..da94dd34 100644 --- a/src/core/Collision.h +++ b/src/core/Collision.h @@ -212,6 +212,9 @@ class CCollision public: static eLevelName ms_collisionInMemory; static CLinkList ms_colModelCache; +#ifdef NO_ISLAND_LOADING + static bool bAlreadyLoaded; +#endif static void Init(void); static void Shutdown(void); diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index df65f94f..0c813cbb 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -122,6 +122,11 @@ int8 CMenuManager::m_nPrefsMSAALevel = 0; int8 CMenuManager::m_nDisplayMSAALevel = 0; #endif +#ifdef NO_ISLAND_LOADING +int8 CMenuManager::m_DisplayIslandLoading = ISLAND_LOADING_LOW; +int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW; +#endif + char CMenuManager::m_PrefsSkinFile[256] = DEFAULT_SKIN_NAME; int32 CMenuManager::m_KeyPressedCode = -1; @@ -155,6 +160,10 @@ int32 MouseButtonJustClicked; int32 JoyButtonJustClicked; //int32 *pControlTemp = 0; +#ifdef PS2_ALPHA_TEST +extern bool gPS2alphaTest; +#endif + #ifndef MASTER bool CMenuManager::m_PrefsMarketing = false; bool CMenuManager::m_PrefsDisableTutorials = false; @@ -1189,6 +1198,21 @@ CMenuManager::Draw() break; } break; +#endif +#ifdef NO_ISLAND_LOADING + case MENUACTION_ISLANDLOADING: + switch (m_DisplayIslandLoading) { + case ISLAND_LOADING_LOW: + rightText = TheText.Get("FEM_LOW"); + break; + case ISLAND_LOADING_MEDIUM: + rightText = TheText.Get("FEM_MED"); + break; + case ISLAND_LOADING_HIGH: + rightText = TheText.Get("FEM_HIG"); + break; + } + break; #endif case MENUACTION_AUDIOHW: if (m_nPrefsAudio3DProviderIndex == -1) @@ -1245,6 +1269,11 @@ CMenuManager::Draw() rightText = TheText.Get(m_PrefsCutsceneBorders ? "FEM_ON" : "FEM_OFF"); break; #endif +#ifdef PS2_ALPHA_TEST + case MENUACTION_PS2_ALPHA_TEST: + rightText = TheText.Get(gPS2alphaTest ? "FEM_ON" : "FEM_OFF"); + break; +#endif #ifdef CUSTOM_FRONTEND_OPTIONS case MENUACTION_TRIGGERFUNC: FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; @@ -1389,6 +1418,12 @@ CMenuManager::Draw() if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_AAS") && m_nHelperTextMsgId == 1) ResetHelperText(); } +#endif +#ifdef NO_ISLAND_LOADING + if (m_DisplayIslandLoading == m_PrefsIslandLoading) { + if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEM_ISL") && m_nHelperTextMsgId == 1) + ResetHelperText(); + } #endif if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) { if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH")) @@ -1409,6 +1444,12 @@ CMenuManager::Draw() if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_AAS")) SetHelperText(1); } +#endif +#ifdef NO_ISLAND_LOADING + if (m_DisplayIslandLoading != m_PrefsIslandLoading) { + if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEM_ISL")) + SetHelperText(1); + } #endif if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) { if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH") != 0 @@ -3333,6 +3374,13 @@ CMenuManager::LoadSettings() CFileMgr::Read(fileHandle, (char *)&m_nPrefsMSAALevel, 1); m_nDisplayMSAALevel = m_nPrefsMSAALevel; #endif +#ifdef NO_ISLAND_LOADING + CFileMgr::Read(fileHandle, (char *)&CMenuManager::m_PrefsIslandLoading, 1); + CMenuManager::m_DisplayIslandLoading = CMenuManager::m_PrefsIslandLoading; +#endif +#ifdef PS2_ALPHA_TEST + CFileMgr::Read(fileHandle, (char *)&gPS2alphaTest, 1); +#endif // PS2_ALPHA_TEST } } @@ -3432,6 +3480,12 @@ CMenuManager::SaveSettings() #ifdef MULTISAMPLING CFileMgr::Write(fileHandle, (char *)&CMenuManager::m_nPrefsMSAALevel, 1); #endif +#ifdef NO_ISLAND_LOADING + CFileMgr::Write(fileHandle, (char *)&CMenuManager::m_PrefsIslandLoading, 1); +#endif +#ifdef PS2_ALPHA_TEST + CFileMgr::Write(fileHandle, (char *)&gPS2alphaTest, 1); +#endif // PS2_ALPHA_TEST } CFileMgr::CloseFile(fileHandle); @@ -4769,6 +4823,45 @@ CMenuManager::ProcessButtonPresses(void) SaveSettings(); } break; +#endif +#ifdef NO_ISLAND_LOADING + case MENUACTION_ISLANDLOADING: + if (m_DisplayIslandLoading != m_PrefsIslandLoading) { + if (!m_bGameNotLoaded) { + if (m_DisplayIslandLoading > ISLAND_LOADING_LOW) { + if (m_DisplayIslandLoading == ISLAND_LOADING_HIGH) + CStreaming::RemoveIslandsNotUsed(LEVEL_GENERIC); + if (m_PrefsIslandLoading == ISLAND_LOADING_LOW) { + if (CGame::currLevel != LEVEL_INDUSTRIAL) + CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL); + if (CGame::currLevel != LEVEL_COMMERCIAL) + CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL); + if (CGame::currLevel != LEVEL_SUBURBAN) + CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN); + CCollision::bAlreadyLoaded = true; + m_PrefsIslandLoading = m_DisplayIslandLoading; + CStreaming::RequestBigBuildings(CGame::currLevel); + } else if (m_PrefsIslandLoading == ISLAND_LOADING_HIGH) { + m_PrefsIslandLoading = m_DisplayIslandLoading; + CStreaming::RequestIslands(CGame::currLevel); + } else + m_PrefsIslandLoading = m_DisplayIslandLoading; + } else { // low + m_PrefsIslandLoading = m_DisplayIslandLoading; + CCollision::bAlreadyLoaded = false; + CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + CStreaming::RequestIslands(CGame::currLevel); + } + + CStreaming::LoadAllRequestedModels(true); + } else + m_PrefsIslandLoading = m_DisplayIslandLoading; + SetHelperText(0); + SaveSettings(); + } + break; #endif case MENUACTION_AUDIOHW: { @@ -4842,6 +4935,43 @@ CMenuManager::ProcessButtonPresses(void) #ifdef CUTSCENE_BORDERS_SWITCH m_PrefsCutsceneBorders = true; #endif +#ifdef NO_ISLAND_LOADING + m_DisplayIslandLoading = ISLAND_LOADING_LOW; + if (!m_bGameNotLoaded) { + if (m_DisplayIslandLoading > ISLAND_LOADING_LOW) { + if (m_DisplayIslandLoading == ISLAND_LOADING_HIGH) + CStreaming::RemoveIslandsNotUsed(LEVEL_GENERIC); + if (m_PrefsIslandLoading == ISLAND_LOADING_LOW) { + if (CGame::currLevel != LEVEL_INDUSTRIAL) + CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL); + if (CGame::currLevel != LEVEL_COMMERCIAL) + CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL); + if (CGame::currLevel != LEVEL_SUBURBAN) + CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN); + CCollision::bAlreadyLoaded = true; + m_PrefsIslandLoading = m_DisplayIslandLoading; + CStreaming::RequestBigBuildings(CGame::currLevel); + } else if (m_PrefsIslandLoading == ISLAND_LOADING_HIGH) { + m_PrefsIslandLoading = m_DisplayIslandLoading; + CStreaming::RequestIslands(CGame::currLevel); + } else + m_PrefsIslandLoading = m_DisplayIslandLoading; + } else { // low + m_PrefsIslandLoading = m_DisplayIslandLoading; + CCollision::bAlreadyLoaded = false; + CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + CStreaming::RequestIslands(CGame::currLevel); + } + + CStreaming::LoadAllRequestedModels(true); + } else + m_PrefsIslandLoading = m_DisplayIslandLoading; +#endif // NO_ISLAND_LOADING +#ifdef PS2_ALPHA_TEST + gPS2alphaTest = false; +#endif // PS2_ALPHA_TEST SaveSettings(); #else } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { @@ -4870,6 +5000,43 @@ CMenuManager::ProcessButtonPresses(void) #else CMBlur::BlurOn = true; #endif // GTA3_1_1_PATCH +#ifdef NO_ISLAND_LOADING + m_DisplayIslandLoading = ISLAND_LOADING_LOW; + if (!m_bGameNotLoaded) { + if (m_DisplayIslandLoading > ISLAND_LOADING_LOW) { + if (m_DisplayIslandLoading == ISLAND_LOADING_HIGH) + CStreaming::RemoveIslandsNotUsed(LEVEL_GENERIC); + if (m_PrefsIslandLoading == ISLAND_LOADING_LOW) { + if (CGame::currLevel != LEVEL_INDUSTRIAL) + CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL); + if (CGame::currLevel != LEVEL_COMMERCIAL) + CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL); + if (CGame::currLevel != LEVEL_SUBURBAN) + CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN); + CCollision::bAlreadyLoaded = true; + m_PrefsIslandLoading = m_DisplayIslandLoading; + CStreaming::RequestBigBuildings(CGame::currLevel); + } else if (m_PrefsIslandLoading == ISLAND_LOADING_HIGH) { + m_PrefsIslandLoading = m_DisplayIslandLoading; + CStreaming::RequestIslands(CGame::currLevel); + } else + m_PrefsIslandLoading = m_DisplayIslandLoading; + } else { // low + m_PrefsIslandLoading = m_DisplayIslandLoading; + CCollision::bAlreadyLoaded = false; + CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + CStreaming::RequestIslands(CGame::currLevel); + } + + CStreaming::LoadAllRequestedModels(true); + } else + m_PrefsIslandLoading = m_DisplayIslandLoading; +#endif // NO_ISLAND_LOADING +#ifdef PS2_ALPHA_TEST + gPS2alphaTest = false; +#endif // PS2_ALPHA_TEST SaveSettings(); #endif // GRAPHICS_MENU_OPTIONS } else if ((m_nCurrScreen != MENUPAGE_SKIN_SELECT_OLD) && (m_nCurrScreen == MENUPAGE_CONTROLLER_PC)) { @@ -5155,6 +5322,15 @@ CMenuManager::ProcessButtonPresses(void) m_nDisplayMSAALevel = 0; } break; +#endif +#ifdef NO_ISLAND_LOADING + case MENUACTION_ISLANDLOADING: + m_DisplayIslandLoading += changeValueBy; + if (m_DisplayIslandLoading > ISLAND_LOADING_HIGH) + m_DisplayIslandLoading = ISLAND_LOADING_LOW; + else if (m_DisplayIslandLoading < ISLAND_LOADING_LOW) + m_DisplayIslandLoading = ISLAND_LOADING_HIGH; + break; #endif case MENUACTION_AUDIOHW: if (m_nPrefsAudio3DProviderIndex != -1) { @@ -5327,6 +5503,13 @@ CMenuManager::ProcessOnOffMenuOptions() DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; +#endif +#ifdef PS2_ALPHA_TEST + case MENUACTION_PS2_ALPHA_TEST: + gPS2alphaTest = !gPS2alphaTest; + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); + SaveSettings(); + break; #endif } } diff --git a/src/core/Frontend.h b/src/core/Frontend.h index c9af7c10..dd82507e 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -372,6 +372,12 @@ enum eMenuAction #ifdef MULTISAMPLING MENUACTION_MULTISAMPLING, #endif +#ifdef NO_ISLAND_LOADING + MENUACTION_ISLANDLOADING, +#endif +#ifdef PS2_ALPHA_TEST + MENUACTION_PS2_ALPHA_TEST, +#endif #ifdef CUTSCENE_BORDERS_SWITCH MENUACTION_CUTSCENEBORDERS, #endif @@ -622,6 +628,18 @@ public: void PrintMap(); #endif +#ifdef NO_ISLAND_LOADING + enum + { + ISLAND_LOADING_LOW = 0, + ISLAND_LOADING_MEDIUM, + ISLAND_LOADING_HIGH + }; + + static int8 m_DisplayIslandLoading; + static int8 m_PrefsIslandLoading; +#endif + public: static void BuildStatLine(Const char *text, void *stat, bool itsFloat, void *stat2); static void CentreMousePointer(); diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp index c313944c..02c004b3 100644 --- a/src/core/MenuScreens.cpp +++ b/src/core/MenuScreens.cpp @@ -30,6 +30,18 @@ #define MENU_MULTISAMPLING(screen) #endif +#ifdef NO_ISLAND_LOADING +#define MENU_ISLAND_LOADING(screen) MENUACTION_ISLANDLOADING, "FEM_ISL", SAVESLOT_NONE, screen, +#else +#define MENU_ISLAND_LOADING(screen) +#endif + +#ifdef PS2_ALPHA_TEST +#define MENU_PS2_ALPHA_TEST(screen) MENUACTION_PS2_ALPHA_TEST, "FEM_2PR", SAVESLOT_NONE, screen, +#else +#define MENU_PS2_ALPHA_TEST(screen) +#endif + CMenuScreen aScreens[] = { // MENUPAGE_NONE = 0 { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, @@ -84,6 +96,8 @@ CMenuScreen aScreens[] = { MENU_CUTSCENE_BORDERS_SWITCH(MENUPAGE_DISPLAY_SETTINGS) MENU_MIPMAPS(MENUPAGE_DISPLAY_SETTINGS) MENU_TEXTURE_FILTERING(MENUPAGE_DISPLAY_SETTINGS) + MENU_ISLAND_LOADING(MENUPAGE_DISPLAY_SETTINGS) + MENU_PS2_ALPHA_TEST(MENUPAGE_DISPLAY_SETTINGS) MENU_MULTISAMPLING(MENUPAGE_DISPLAY_SETTINGS) MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, MENU_IMPROVED_VIDEOMODE(MENUPAGE_DISPLAY_SETTINGS) @@ -502,6 +516,8 @@ CMenuScreen aScreens[] = { MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENU_MIPMAPS(MENUPAGE_GRAPHICS_SETTINGS) MENU_TEXTURE_FILTERING(MENUPAGE_GRAPHICS_SETTINGS) + MENU_ISLAND_LOADING(MENUPAGE_GRAPHICS_SETTINGS) + MENU_PS2_ALPHA_TEST(MENUPAGE_GRAPHICS_SETTINGS) MENU_MULTISAMPLING(MENUPAGE_GRAPHICS_SETTINGS) MENU_IMPROVED_VIDEOMODE(MENUPAGE_GRAPHICS_SETTINGS) MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 40189844..089e8b23 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -32,6 +32,7 @@ #include "Replay.h" #endif #include "main.h" +#include "Frontend.h" bool CStreaming::ms_disableStreaming; bool CStreaming::ms_bLoadingBigModel; @@ -727,7 +728,9 @@ CStreaming::RequestBigBuildings(eLevelName level) for(i = n; i >= 0; i--){ b = CPools::GetBuildingPool()->GetSlot(i); if(b && b->bIsBIGBuilding -#ifndef NO_ISLAND_LOADING +#ifdef NO_ISLAND_LOADING + && ((CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_LOW) || (b->m_level == level)) +#else && b->m_level == level #endif ) @@ -740,7 +743,9 @@ CStreaming::RequestBigBuildings(eLevelName level) void CStreaming::RequestIslands(eLevelName level) { -#ifndef NO_ISLAND_LOADING +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) +#endif switch(level){ case LEVEL_INDUSTRIAL: RequestModel(islandLODcomInd, BIGBUILDINGFLAGS); @@ -756,7 +761,6 @@ CStreaming::RequestIslands(eLevelName level) break; default: break; } -#endif } void @@ -942,14 +946,17 @@ CStreaming::RemoveBuildings(eLevelName level) void CStreaming::RemoveUnusedBigBuildings(eLevelName level) { -#ifndef NO_ISLAND_LOADING - if(level != LEVEL_INDUSTRIAL) - RemoveBigBuildings(LEVEL_INDUSTRIAL); - if(level != LEVEL_COMMERCIAL) - RemoveBigBuildings(LEVEL_COMMERCIAL); - if(level != LEVEL_SUBURBAN) - RemoveBigBuildings(LEVEL_SUBURBAN); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + if (level != LEVEL_INDUSTRIAL) + RemoveBigBuildings(LEVEL_INDUSTRIAL); + if (level != LEVEL_COMMERCIAL) + RemoveBigBuildings(LEVEL_COMMERCIAL); + if (level != LEVEL_SUBURBAN) + RemoveBigBuildings(LEVEL_SUBURBAN); + } RemoveIslandsNotUsed(level); } @@ -969,7 +976,15 @@ DeleteIsland(CEntity *island) void CStreaming::RemoveIslandsNotUsed(eLevelName level) { -#ifndef NO_ISLAND_LOADING +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) { + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); + } else +#endif switch(level){ case LEVEL_INDUSTRIAL: DeleteIsland(pIslandLODindustEntity); @@ -987,16 +1002,13 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level) DeleteIsland(pIslandLODcomIndEntity); break; default: -#endif // !NO_ISLAND_LOADING DeleteIsland(pIslandLODindustEntity); DeleteIsland(pIslandLODcomIndEntity); DeleteIsland(pIslandLODcomSubEntity); DeleteIsland(pIslandLODsubIndEntity); DeleteIsland(pIslandLODsubComEntity); -#ifndef NO_ISLAND_LOADING break; } -#endif // !NO_ISLAND_LOADING } void diff --git a/src/core/config.h b/src/core/config.h index 081d9b39..6aa41e6b 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -205,7 +205,7 @@ enum Config { #define PS2_ALPHA_TEST // emulate ps2 alpha test #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number #define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time -//#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU +#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU //#define USE_TEXTURE_POOL #define CUTSCENE_BORDERS_SWITCH //#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur) diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index d6fb0102..5d9c7700 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -4,6 +4,7 @@ #include "TempColModels.h" #include "ModelIndices.h" #include "ModelInfo.h" +#include "Frontend.h" CBaseModelInfo *CModelInfo::ms_modelInfoPtrs[MODELINFOSIZE]; @@ -217,20 +218,23 @@ CModelInfo::IsBikeModel(int32 id) void CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level) { -#ifndef NO_ISLAND_LOADING - int i; - CBaseModelInfo *mi; - CColModel *colmodel; - - for(i = 0; i < MODELINFOSIZE; i++){ - mi = GetModelInfo(i); - if(mi){ - colmodel = mi->GetColModel(); - if(colmodel && colmodel->level != LEVEL_GENERIC && colmodel->level != level) - colmodel->RemoveCollisionVolumes(); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) +#endif + { + int i; + CBaseModelInfo *mi; + CColModel *colmodel; + + for (i = 0; i < MODELINFOSIZE; i++) { + mi = GetModelInfo(i); + if (mi) { + colmodel = mi->GetColModel(); + if (colmodel && colmodel->level != LEVEL_GENERIC && colmodel->level != level) + colmodel->RemoveCollisionVolumes(); + } } } -#endif } void diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 7ae29a2f..568f0afa 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -19,6 +19,7 @@ #include "Shadows.h" #include "PointLights.h" #include "Renderer.h" +#include "Frontend.h" bool gbShowPedRoadGroups; bool gbShowCarRoadGroups; @@ -710,15 +711,18 @@ CRenderer::ScanWorld(void) ScanSectorPoly(poly, 3, ScanSectorList); } #ifdef NO_ISLAND_LOADING - ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_INDUSTRIAL)); - ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_COMMERCIAL)); - ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_SUBURBAN)); -#else + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) { + ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_INDUSTRIAL)); + ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_COMMERCIAL)); + ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_SUBURBAN)); + } else +#endif + { #ifdef FIX_BUGS if (CCollision::ms_collisionInMemory != LEVEL_GENERIC) #endif - ScanBigBuildingList(CWorld::GetBigBuildingList(CCollision::ms_collisionInMemory)); -#endif + ScanBigBuildingList(CWorld::GetBigBuildingList(CCollision::ms_collisionInMemory)); + } ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_GENERIC)); } } diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 1e2d5da7..516c8d46 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -562,17 +562,23 @@ RestoreForStartLoad() ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().x); ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().y); ReadDataFromBufferPointer(_buf, TheCamera.GetMatrix().GetPosition().z); -#ifndef NO_ISLAND_LOADING - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + } CCollision::SortOutCollisionAfterLoad(); -#ifndef NO_ISLAND_LOADING - CStreaming::RequestBigBuildings(CGame::currLevel); - CStreaming::LoadAllRequestedModels(false); - CStreaming::HaveAllBigBuildingsLoaded(CGame::currLevel); - CGame::TidyUpMemory(true, false); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RequestBigBuildings(CGame::currLevel); + CStreaming::LoadAllRequestedModels(false); + CStreaming::HaveAllBigBuildingsLoaded(CGame::currLevel); + CGame::TidyUpMemory(true, false); + } if (CloseFile(file)) { return true; } else { -- cgit v1.2.3 From 0418ba597bc53d08d0244188f4623ebadfdd2876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 16 Aug 2020 17:58:40 +0300 Subject: remove CFO --- src/core/Frontend.cpp | 150 +----------------------------------- src/core/Frontend.h | 5 +- src/core/Game.cpp | 5 -- src/core/MenuScreens.cpp | 21 ++++- src/core/config.h | 1 - src/core/re3.cpp | 112 --------------------------- src/extras/frontendoption.cpp | 173 ------------------------------------------ src/extras/frontendoption.h | 87 --------------------- 8 files changed, 21 insertions(+), 533 deletions(-) delete mode 100644 src/extras/frontendoption.cpp delete mode 100644 src/extras/frontendoption.h (limited to 'src') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 0c813cbb..d82c5df4 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -36,7 +36,6 @@ #include "Stats.h" #include "Messages.h" #include "FileLoader.h" -#include "frontendoption.h" #define TIDY_UP_PBP // ProcessButtonPresses #define MAX_VISIBLE_LIST_ROW 30 @@ -432,46 +431,12 @@ CMenuManager::ThingsToDoBeforeGoingBack() if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) { m_nTotalListRow = 0; } - -#ifdef CUSTOM_FRONTEND_OPTIONS - for (int i = 0; i < numCustomFrontendOptions; i++) { - FrontendOption &option = customFrontendOptions[i]; - if (option.type != FEOPTION_REDIRECT && option.type != FEOPTION_GOBACK && m_nCurrScreen == option.screen) { - if (option.returnPrevPageFunc) - option.returnPrevPageFunc(); - - if (m_nCurrOption == option.screenOptionOrder && option.type == FEOPTION_DYNAMIC) - option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); - - if (option.onlyApplyOnEnter) - option.displayedValue = *option.value; - } - } -#endif } int8 CMenuManager::GetPreviousPageOption() { -#ifndef CUSTOM_FRONTEND_OPTIONS - return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0]; -#else - int8 prevPage = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0]; - - if (prevPage == -1) // Game also does same - return 0; - - prevPage = prevPage == MENUPAGE_NONE ? (!m_bGameNotLoaded ? MENUPAGE_PAUSE_MENU : MENUPAGE_START_MENU) : prevPage; - - for (int i = 0; i < NUM_MENUROWS; i++) { - if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) { - return i; - } - } - - // Couldn't find current screen option on previous page, use default behaviour (maybe save-related screen?) return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0]; -#endif } // ------ Functions not in the game/inlined ends @@ -990,14 +955,7 @@ CMenuManager::Draw() } #endif -#ifdef CUSTOM_FRONTEND_OPTIONS - static int lastOption = m_nCurrOption; -#endif - for (int i = 0; i < NUM_MENUROWS; ++i) { -#ifdef CUSTOM_FRONTEND_OPTIONS - bool isOptionDisabled = false; -#endif if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') { wchar *rightText = nil; wchar *leftText; @@ -1274,29 +1232,6 @@ CMenuManager::Draw() rightText = TheText.Get(gPS2alphaTest ? "FEM_ON" : "FEM_OFF"); break; #endif -#ifdef CUSTOM_FRONTEND_OPTIONS - case MENUACTION_TRIGGERFUNC: - FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; - if (m_nCurrScreen == option.screen && i == option.screenOptionOrder) { - leftText = (wchar*)option.leftText; - if (option.type == FEOPTION_SELECT) { - if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0) - option.displayedValue = 0; - - rightText = (wchar*)option.rightTexts[option.displayedValue]; - - } else if (option.type == FEOPTION_DYNAMIC) { - if (option.drawFunc) { - rightText = option.drawFunc(&isOptionDisabled); - } - } - } else { - debug("A- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, i, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu, option.screen, option.screenOptionOrder); - assert(0 && "Custom frontend options is borked"); - } - - break; -#endif } float nextItemY = headerHeight + nextYToUse; @@ -1383,11 +1318,7 @@ CMenuManager::Draw() || !strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_AAS") #endif ) - && !m_bGameNotLoaded -#ifdef CUSTOM_FRONTEND_OPTIONS - || isOptionDisabled -#endif - ) + && !m_bGameNotLoaded) CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255))); CFont::PrintString(MENU_X_RIGHT_ALIGNED(columnWidth - textLayer), itemY, rightText); @@ -1497,20 +1428,6 @@ CMenuManager::Draw() } #endif -#ifdef CUSTOM_FRONTEND_OPTIONS - if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) { - FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; - if (option.onlyApplyOnEnter && m_nCurrOption != i) - option.displayedValue = *option.value; - - if (m_nCurrOption != lastOption && lastOption == i) { - FrontendOption &oldOption = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[lastOption].m_TargetMenu]; - if (oldOption.type == FEOPTION_DYNAMIC) - oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); - } - } -#endif - // Sliders int lastActiveBarX; switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { @@ -1554,10 +1471,6 @@ CMenuManager::Draw() } } -#ifdef CUSTOM_FRONTEND_OPTIONS - lastOption = m_nCurrOption; -#endif - switch (m_nCurrScreen) { case MENUPAGE_CONTROLLER_SETTINGS: case MENUPAGE_SOUND_SETTINGS: @@ -3215,10 +3128,6 @@ CMenuManager::InitialiseChangedLanguageSettings() default: break; } - -#ifdef CUSTOM_FRONTEND_OPTIONS - CustomFrontendOptionsPopulate(); -#endif } } @@ -5096,33 +5005,6 @@ CMenuManager::ProcessButtonPresses(void) RequestFrontEndShutDown(); RetryMission(2, 0); return; -#endif -#ifdef CUSTOM_FRONTEND_OPTIONS - case MENUACTION_TRIGGERFUNC: - FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu]; - if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) { - if (option.type == FEOPTION_SELECT) { - if (!option.onlyApplyOnEnter) { - option.displayedValue++; - if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0) - option.displayedValue = 0; - } - option.changeFunc(option.displayedValue); - *option.value = option.displayedValue; - - } else if (option.type == FEOPTION_DYNAMIC) { - option.buttonPressFunc(FEOPTION_ACTION_SELECT); - } else if (option.type == FEOPTION_REDIRECT) { - ChangeScreen(option.to, option.option, true, option.fadeIn); - } else if (option.type == FEOPTION_GOBACK) { - goBack = true; - } - } else { - debug("B- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder); - assert(0 && "Custom frontend options are borked"); - } - - break; #endif } } @@ -5354,36 +5236,6 @@ CMenuManager::ProcessButtonPresses(void) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; -#ifdef CUSTOM_FRONTEND_OPTIONS - case MENUACTION_TRIGGERFUNC: - FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu]; - if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) { - if (option.type == FEOPTION_SELECT) { - if (changeValueBy > 0) { - option.displayedValue++; - if (option.displayedValue >= option.numRightTexts) - option.displayedValue = 0; - } else { - option.displayedValue--; - if (option.displayedValue < 0) - option.displayedValue = option.numRightTexts - 1; - } - if (!option.onlyApplyOnEnter) { - option.changeFunc(option.displayedValue); - *option.value = option.displayedValue; - } - } else if (option.type == FEOPTION_DYNAMIC) { - option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT); - } - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - } - else { - debug("C- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder); - assert(0 && "Custom frontend options are borked"); - } - - break; -#endif } ProcessOnOffMenuOptions(); if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { diff --git a/src/core/Frontend.h b/src/core/Frontend.h index dd82507e..d631a7d1 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -381,9 +381,6 @@ enum eMenuAction #ifdef CUTSCENE_BORDERS_SWITCH MENUACTION_CUTSCENEBORDERS, #endif -#ifdef CUSTOM_FRONTEND_OPTIONS - MENUACTION_TRIGGERFUNC -#endif }; enum eCheckHover @@ -478,7 +475,7 @@ struct CMenuScreen int32 m_Action; // eMenuAction char m_EntryName[8]; int32 m_SaveSlot; // eSaveSlot - int32 m_TargetMenu; // eMenuScreen // FrontendOption ID if it's a custom option + int32 m_TargetMenu; // eMenuScreen } m_aEntries[NUM_MENUROWS]; }; diff --git a/src/core/Game.cpp b/src/core/Game.cpp index d5b376f6..06f2c1bd 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -86,7 +86,6 @@ #include "ZoneCull.h" #include "Zones.h" #include "debugmenu.h" -#include "frontendoption.h" #include "postfx.h" eLevelName CGame::currLevel; @@ -292,10 +291,6 @@ bool CGame::InitialiseOnceAfterRW(void) DMAudio.SetEffectsFadeVol(127); DMAudio.SetMusicFadeVol(127); CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile); - -#ifdef CUSTOM_FRONTEND_OPTIONS - CustomFrontendOptionsPopulate(); -#endif return true; } diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp index 02c004b3..5dfcc8fe 100644 --- a/src/core/MenuScreens.cpp +++ b/src/core/MenuScreens.cpp @@ -2,8 +2,6 @@ #include "Frontend.h" #ifdef PC_MENU -// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp. - #ifdef CUTSCENE_BORDERS_SWITCH #define MENU_CUTSCENE_BORDERS_SWITCH(screen) MENUACTION_CUTSCENEBORDERS, "FEM_CSB", SAVESLOT_NONE, screen, #else @@ -47,7 +45,11 @@ CMenuScreen aScreens[] = { { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_STATS = 1 +#ifdef MENU_MAP + { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3, +#else { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, +#endif MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, @@ -60,7 +62,11 @@ CMenuScreen aScreens[] = { }, // MENUPAGE_BRIEFS = 3 +#ifdef MENU_MAP + { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4, +#else { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3, +#endif MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, @@ -375,7 +381,11 @@ CMenuScreen aScreens[] = { }, // MENUPAGE_OPTIONS = 41 +#ifdef MENU_MAP + { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5, +#else { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4, +#endif MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, @@ -388,7 +398,11 @@ CMenuScreen aScreens[] = { }, // MENUPAGE_EXIT = 42 +#ifdef MENU_MAP + { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6, +#else { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5, +#endif MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_DONTCANCEL, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE, @@ -449,6 +463,9 @@ CMenuScreen aScreens[] = { { "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, +#ifdef MENU_MAP + MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP, +#endif MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS, MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS, MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS, diff --git a/src/core/config.h b/src/core/config.h index 6aa41e6b..00a8076f 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -246,7 +246,6 @@ enum Config { # define SCROLLABLE_STATS_PAGE // only draggable by mouse atm # define TRIANGLE_BACK_BUTTON //# define CIRCLE_BACK_BUTTON -# define CUSTOM_FRONTEND_OPTIONS # define GRAPHICS_MENU_OPTIONS #endif diff --git a/src/core/re3.cpp b/src/core/re3.cpp index dbc526dd..eef30706 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -70,115 +70,6 @@ mysrand(unsigned int seed) myrand_seed = seed; } -#ifdef CUSTOM_FRONTEND_OPTIONS -#include "frontendoption.h" -#include "platform.h" - -void ReloadFrontendOptions(void) -{ - CustomFrontendOptionsPopulate(); -} - -#ifdef MORE_LANGUAGES -void LangPolSelect(int8 action) -{ - if (action == FEOPTION_ACTION_SELECT) { - FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH; - FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; - FrontEndMenuManager.InitialiseChangedLanguageSettings(); - FrontEndMenuManager.SaveSettings(); - } -} - -void LangRusSelect(int8 action) -{ - if (action == FEOPTION_ACTION_SELECT) { - FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN; - FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; - FrontEndMenuManager.InitialiseChangedLanguageSettings(); - FrontEndMenuManager.SaveSettings(); - } -} - -void LangJapSelect(int8 action) -{ - if (action == FEOPTION_ACTION_SELECT) { - FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE; - FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; - FrontEndMenuManager.InitialiseChangedLanguageSettings(); - FrontEndMenuManager.SaveSettings(); - } -} -#endif - -/*#ifdef IMPROVED_VIDEOMODE -void ScreenModeChange(int8 displayedValue) -{ - if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) { - FrontEndMenuManager.m_nPrefsWindowed = displayedValue; - _psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution - FrontEndMenuManager.SetHelperText(0); - FrontEndMenuManager.SaveSettings(); - } -} -#endif*/ - -#ifdef FREE_CAM -void ToggleFreeCam(int8 action) -{ - if (action == FEOPTION_ACTION_SELECT) { - TheCamera.bFreeCam = !TheCamera.bFreeCam; - FrontEndMenuManager.SaveSettings(); - } -} -#endif - -//#ifdef CUTSCENE_BORDERS_SWITCH -//void BorderModeChange(int8 displayedValue) -//{ -// CMenuManager::m_PrefsCutsceneBorders = !!displayedValue; -// FrontEndMenuManager.SaveSettings(); -//} -//#endif - -// Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind -void -CustomFrontendOptionsPopulate(void) -{ - RemoveCustomFrontendOptions(); // if exist - -#ifdef MORE_LANGUAGES - FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS); - FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil); - FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, LangRusSelect, nil); - FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, LangJapSelect, nil); -#endif - -/*#ifdef IMPROVED_VIDEOMODE - static const wchar *screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" }; - FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 8); - FrontendOptionAddSelect(TheText.Get("SCRFOR"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil); -#endif*/ - -#ifdef MENU_MAP - FrontendOptionSetPosition(MENUPAGE_PAUSE_MENU, 2); - FrontendOptionAddRedirect(TheText.Get("FEG_MAP"), MENUPAGE_MAP); -#endif - -#ifdef FREE_CAM - static const wchar *text = (wchar*)L"TOGGLE FREE CAM"; - FrontendOptionSetPosition(MENUPAGE_CONTROLLER_PC, 1); - FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil); -#endif - -/*#ifdef CUTSCENE_BORDERS_SWITCH - static const wchar *off_on[] = { TheText.Get("FEM_OFF"), TheText.Get("FEM_ON") }; - FrontendOptionSetPosition(MENUPAGE_DISPLAY_SETTINGS, 3); - FrontendOptionAddSelect((const wchar *)L"CUTSCENE BORDERS", off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil); -#endif*/ -} -#endif - #ifdef DEBUGMENU void WeaponCheat(); void HealthCheat(); @@ -502,9 +393,6 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway); DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil); -#ifdef CUSTOM_FRONTEND_OPTIONS - DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions); -#endif DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil); DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); diff --git a/src/extras/frontendoption.cpp b/src/extras/frontendoption.cpp deleted file mode 100644 index 51814f35..00000000 --- a/src/extras/frontendoption.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include "common.h" - -#ifdef CUSTOM_FRONTEND_OPTIONS -#include "frontendoption.h" - -int numCustomFrontendOptions = 0; -FrontendOption *customFrontendOptions; - -int optionCursor = -1; -eMenuScreen currentMenu; - -void ChangeScreen(eMenuScreen screen, int option, bool fadeIn) -{ - FrontEndMenuManager.m_nPrevScreen = FrontEndMenuManager.m_nCurrScreen; - FrontEndMenuManager.m_nCurrScreen = screen; - FrontEndMenuManager.m_nCurrOption = option; - if (fadeIn) - FrontEndMenuManager.m_nMenuFadeAlpha = 0; -} - -void GoBack(bool fadeIn) -{ - int screen = !FrontEndMenuManager.m_bGameNotLoaded ? - aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[0]; - int option = !FrontEndMenuManager.m_bGameNotLoaded ? - aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[0]; - - FrontEndMenuManager.ThingsToDoBeforeGoingBack(); - - ChangeScreen((eMenuScreen)screen, option, fadeIn); -} - -uint8 -GetNumberOfMenuOptions(int screen) -{ - uint8 Rows = 0; - for (int i = 0; i < NUM_MENUROWS; i++) { - if (aScreens[screen].m_aEntries[i].m_Action == MENUACTION_NOTHING) - break; - - ++Rows; - } - return Rows; -} - -// Used before populating options, but effective in InitialiseChangedLanguageSettings and debugmenu -void -RemoveCustomFrontendOptions() -{ - if (numCustomFrontendOptions == 0) - return; - - for (int i = 0; i < MENUPAGES; i++) { - for (int j = 0; j < NUM_MENUROWS; j++) { - if (aScreens[i].m_aEntries[j].m_Action == MENUACTION_TRIGGERFUNC) { - int k; - for (k = j; k < NUM_MENUROWS-1; k++) { - memcpy(&aScreens[i].m_aEntries[k], &aScreens[i].m_aEntries[k+1], sizeof(CMenuScreen::CMenuEntry)); - } - aScreens[i].m_aEntries[k].m_Action = MENUACTION_NOTHING; - aScreens[i].m_aEntries[k].m_EntryName[0] = '\0'; - j--; - } - } - } - free(customFrontendOptions); - numCustomFrontendOptions = 0; -} - -int8 RegisterNewOption(int screen) -{ - numCustomFrontendOptions++; - if (numCustomFrontendOptions == 1) - customFrontendOptions = (FrontendOption*)malloc(5 * sizeof(FrontendOption)); - else if (numCustomFrontendOptions % 5 == 1) - customFrontendOptions = (FrontendOption*)realloc(customFrontendOptions, (numCustomFrontendOptions + 4) * sizeof(FrontendOption)); - - assert(customFrontendOptions != nil && "Custom frontend options can't be allocated"); - - uint8 nth = GetNumberOfMenuOptions(screen); - if (optionCursor < 0) { - if (optionCursor == -1) { - if (!strcmp(aScreens[screen].m_aEntries[nth - 1].m_EntryName, "FEDS_TB") || !strcmp(aScreens[screen].m_aEntries[nth - 1].m_EntryName, "FESZ_CA")) { - // Move back button one below - memcpy(&aScreens[screen].m_aEntries[nth], &aScreens[screen].m_aEntries[nth - 1], sizeof(CMenuScreen::CMenuEntry)); - nth--; - } - } - } else { - if (aScreens[screen].m_aEntries[optionCursor].m_Action != MENUACTION_NOTHING) { - for (int i = nth - 1; i >= optionCursor; i--) { - memcpy(&aScreens[screen].m_aEntries[i + 1], &aScreens[screen].m_aEntries[i], sizeof(CMenuScreen::CMenuEntry)); - } - } - nth = optionCursor; - optionCursor++; - } - - aScreens[screen].m_aEntries[nth].m_Action = MENUACTION_TRIGGERFUNC; - aScreens[screen].m_aEntries[nth].m_TargetMenu = numCustomFrontendOptions - 1; - aScreens[screen].m_aEntries[nth].m_EntryName[0] = 1; // just something to fool it - return nth; -} - -void FrontendOptionSetPosition(eMenuScreen screen, int8 option) -{ - currentMenu = screen; - optionCursor = option; -} - -void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc) -{ - int8 screenOptionOrder = RegisterNewOption(currentMenu); - - FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1]; - option.screen = currentMenu; - option.type = FEOPTION_SELECT; - option.leftText = leftText; - option.rightTexts = rightTexts; - option.numRightTexts = numRightTexts; - option.value = var; - option.displayedValue = *var; - option.onlyApplyOnEnter = onlyApplyOnEnter; - option.changeFunc = changeFunc; - option.screenOptionOrder = screenOptionOrder; - option.returnPrevPageFunc = returnPrevPageFunc; -} - -void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc) -{ - int8 screenOptionOrder = RegisterNewOption(currentMenu); - - FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1]; - option.screen = currentMenu; - option.type = FEOPTION_DYNAMIC; - option.drawFunc = drawFunc; - option.buttonPressFunc = buttonPressFunc; - option.leftText = leftText; - option.onlyApplyOnEnter = false; - option.screenOptionOrder = screenOptionOrder; - option.returnPrevPageFunc = returnPrevPageFunc; -} - -void FrontendOptionAddRedirect(const wchar* text, eMenuScreen to, int8 selectedOption, bool fadeIn) -{ - int8 screenOptionOrder = RegisterNewOption(currentMenu); - - FrontendOption &option = customFrontendOptions[numCustomFrontendOptions - 1]; - option.screen = currentMenu; - option.type = FEOPTION_REDIRECT; - option.to = to; - option.option = selectedOption; - option.fadeIn = fadeIn; - option.leftText = text; - option.onlyApplyOnEnter = false; - option.screenOptionOrder = screenOptionOrder; - option.returnPrevPageFunc = nil; -} - -void FrontendOptionAddBackButton(const wchar* text, bool fadeIn) -{ - int8 screenOptionOrder = RegisterNewOption(currentMenu); - - FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1]; - option.screen = currentMenu; - option.type = FEOPTION_GOBACK; - option.fadeIn = fadeIn; - option.leftText = text; - option.onlyApplyOnEnter = false; - option.screenOptionOrder = screenOptionOrder; - option.returnPrevPageFunc = nil; -} -#endif \ No newline at end of file diff --git a/src/extras/frontendoption.h b/src/extras/frontendoption.h deleted file mode 100644 index 7cfc09a7..00000000 --- a/src/extras/frontendoption.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once -#include "common.h" - -#ifdef CUSTOM_FRONTEND_OPTIONS -#include "Frontend.h" - -// Warning: All of the code relies on that you won't use more then NUM_MENUROWS(18) options on one page. Also congrats if you can make 18 options visible at once. - - -// Static/select: User allocates variable, passes it to function and it's set automatically from input among the strings given to function, -// then you can handle ChangeFunc and ReturnPrevPageFunc if needed. -// -// Dynamic: Function doesn't accept value pointer, user should do operations with handling ButtonPressFunc. -// Right-side text can be set via DrawFunc, which is called on every draw. ReturnPrevPageFunc is also here if needed. - -#define FEOPTION_SELECT 0 -#define FEOPTION_DYNAMIC 1 -#define FEOPTION_REDIRECT 2 -#define FEOPTION_GOBACK 3 - -#define FEOPTION_ACTION_LEFT 0 -#define FEOPTION_ACTION_RIGHT 1 -#define FEOPTION_ACTION_SELECT 2 -#define FEOPTION_ACTION_FOCUSLOSS 3 - -void RemoveCustomFrontendOptions(); -void CustomFrontendOptionsPopulate(); - -// for static and dynamic options -typedef void (*ReturnPrevPageFunc)(); - -// for static options -typedef void (*ChangeFunc)(int8 displayedValue); // called before updating the value - -// for dynamic options -typedef wchar* (*DrawFunc)(bool* disabled); // should return pointer to right text. *disabled = true will make it dark yellow -typedef void (*ButtonPressFunc)(int8 action); // see FEOPTION_ACTIONs above - -struct FrontendOption -{ - int8 type; - int8 screenOptionOrder; - eMenuScreen screen; - const wchar* leftText; - ReturnPrevPageFunc returnPrevPageFunc; - - union { - // Only for dynamic - struct { - DrawFunc drawFunc; - ButtonPressFunc buttonPressFunc; - }; - - // Only for static/select - struct { - const wchar** rightTexts; - int8 numRightTexts; - int8 *value; - int8 displayedValue; // if onlyApplyOnEnter enabled - bool onlyApplyOnEnter; - ChangeFunc changeFunc; - }; - - // Only for redirect - struct { - eMenuScreen to; - int8 option; - bool fadeIn; - }; - }; -}; - -extern int numCustomFrontendOptions; -extern FrontendOption* customFrontendOptions; - -// To be used in ButtonPressFunc / ChangeFunc(but that would be weird): -void ChangeScreen(eMenuScreen screen, int option = 0, bool fadeIn = true); -void GoBack(bool fadeIn = true); - -// If option is positive number, all calls will increase it before using it (you can think it as cursor). -1 means before the back button, -2 is end of page -void FrontendOptionSetPosition(eMenuScreen screen, int8 option = -1); - -void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc); -void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc rightTextDrawFunc, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc); -void FrontendOptionAddRedirect(const wchar* text, eMenuScreen to, int8 selectedOption = 0, bool fadeIn = true); -void FrontendOptionAddBackButton(const wchar* text, bool fadeIn = true); -#endif \ No newline at end of file -- cgit v1.2.3