diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/control/Record.cpp | 8 | ||||
-rw-r--r-- | src/control/Script.cpp | 60 | ||||
-rw-r--r-- | src/core/Collision.cpp | 112 | ||||
-rw-r--r-- | src/core/Collision.h | 3 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 183 | ||||
-rw-r--r-- | src/core/Frontend.h | 18 | ||||
-rw-r--r-- | src/core/MenuScreens.cpp | 16 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 40 | ||||
-rw-r--r-- | src/core/config.h | 2 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.cpp | 28 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 16 | ||||
-rw-r--r-- | src/save/GenericGameStorage.cpp | 22 |
12 files changed, 403 insertions, 105 deletions
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<CColModel*> 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; @@ -1190,6 +1199,21 @@ CMenuManager::Draw() } 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) rightText = TheText.Get("FEA_NAH"); @@ -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]; @@ -1390,6 +1419,12 @@ CMenuManager::Draw() 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")) SetHelperText(1); @@ -1410,6 +1445,12 @@ CMenuManager::Draw() 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 && m_nCurrScreen == MENUPAGE_SOUND_SETTINGS && m_nPrefsAudio3DProviderIndex != -1) { @@ -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); @@ -4770,6 +4824,45 @@ CMenuManager::ProcessButtonPresses(void) } 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: { int selectedProvider = m_nPrefsAudio3DProviderIndex; @@ -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)) { @@ -5156,6 +5323,15 @@ CMenuManager::ProcessButtonPresses(void) } 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) { m_nPrefsAudio3DProviderIndex += changeValueBy; @@ -5328,6 +5504,13 @@ CMenuManager::ProcessOnOffMenuOptions() 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 { |