diff --git a/src/collision/ColStore.cpp b/src/collision/ColStore.cpp index bca1e9b7..192c373d 100644 --- a/src/collision/ColStore.cpp +++ b/src/collision/ColStore.cpp @@ -173,7 +173,7 @@ CColStore::LoadCollision(const CVector2D &pos) if(GetBoundingBox(i).IsPointInside(pos) || bLoadAtSecondPosition && GetBoundingBox(i).IsPointInside(secondPosition, -119.0f) || - CGeneral::faststrcmp(GetColName(i), "yacht") == 0){ + strcmp(GetColName(i), "yacht") == 0){ wantThisOne = true; }else{ for (int j = 0; j < MAX_CLEANUP; j++) { diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index fd7475ef..d9b8f0bd 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -527,6 +527,10 @@ CMenuManager::CMenuManager() m_fMapCenterY = MENU_Y(225.0f); DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume); DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume); + +#ifdef NO_ISLAND_LOADING + m_PrefsIslandLoading = ISLAND_LOADING_LOW; +#endif } void diff --git a/src/core/Frontend.h b/src/core/Frontend.h index a6be06c4..5e18c29a 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -698,10 +698,10 @@ public: ISLAND_LOADING_HIGH }; - static int8 m_PrefsIslandLoading; + int8 m_PrefsIslandLoading; - #define ISLAND_LOADING_IS(p) if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_##p) - #define ISLAND_LOADING_ISNT(p) if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_##p) + #define ISLAND_LOADING_IS(p) if (FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_##p) + #define ISLAND_LOADING_ISNT(p) if (FrontEndMenuManager.m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_##p) #else #define ISLAND_LOADING_IS(p) #define ISLAND_LOADING_ISNT(p) diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp index e35a7751..2001b20b 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -100,12 +100,10 @@ void RestoreDefGraphics(int8 action) { #ifdef NO_ISLAND_LOADING if (!FrontEndMenuManager.m_bGameNotLoaded) { FrontEndMenuManager.m_PrefsIslandLoading = FrontEndMenuManager.ISLAND_LOADING_LOW; - CCollision::bAlreadyLoaded = false; - CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); - CStreaming::RequestIslands(CGame::currLevel); - CStreaming::LoadAllRequestedModels(true); + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + CStreaming::RequestIslands(CGame::currLevel); + CStreaming::LoadAllRequestedModels(true); } else FrontEndMenuManager.m_PrefsIslandLoading = FrontEndMenuManager.ISLAND_LOADING_LOW; #endif @@ -151,16 +149,11 @@ void IslandLoadingAfterChange(int8 before, int8 after) { if (after > FrontEndMenuManager.ISLAND_LOADING_LOW) { FrontEndMenuManager.m_PrefsIslandLoading = before; // calls below needs previous mode :shrug: - if (after == FrontEndMenuManager.ISLAND_LOADING_HIGH) - CStreaming::RemoveIslandsNotUsed(LEVEL_GENERIC); + if (after == FrontEndMenuManager.ISLAND_LOADING_HIGH) { + CStreaming::RemoveIslandsNotUsed(LEVEL_BEACH); + CStreaming::RemoveIslandsNotUsed(LEVEL_MAINLAND); + } if (before == FrontEndMenuManager.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; FrontEndMenuManager.m_PrefsIslandLoading = after; CStreaming::RequestBigBuildings(CGame::currLevel); @@ -171,8 +164,6 @@ void IslandLoadingAfterChange(int8 before, int8 after) { FrontEndMenuManager.m_PrefsIslandLoading = after; } else { // low - CCollision::bAlreadyLoaded = false; - CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); CStreaming::RemoveUnusedBuildings(CGame::currLevel); CStreaming::RequestIslands(CGame::currLevel); diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 8c1b839c..2fd8bf1c 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -35,6 +35,7 @@ #include "MemoryMgr.h" #include "MemoryHeap.h" #include "Font.h" +#include "Frontend.h" //--MIAMI: file done (possibly bugs) @@ -797,7 +798,15 @@ CStreaming::RequestBigBuildings(eLevelName level) n = CPools::GetBuildingPool()->GetSize()-1; for(i = n; i >= 0; i--){ b = CPools::GetBuildingPool()->GetSlot(i); - if(b && b->bIsBIGBuilding && b->m_level == level) + if(b && b->bIsBIGBuilding +#ifdef NO_ISLAND_LOADING + && (((FrontEndMenuManager.m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_LOW) && (b != pIslandLODmainlandEntity) && + (b != pIslandLODbeachEntity)) || + (b->m_level == level)) +#else + && b->m_level == level +#endif + ) if(!b->bStreamBIGBuilding) RequestModel(b->GetModelIndex(), BIGBUILDINGFLAGS); } @@ -814,8 +823,11 @@ CStreaming::RequestBigBuildings(eLevelName level, const CVector &pos) for(i = n; i >= 0; i--){ b = CPools::GetBuildingPool()->GetSlot(i); if(b && b->bIsBIGBuilding -#ifndef NO_ISLAND_LOADING - && b->m_level == level +#ifdef NO_ISLAND_LOADING + && (((FrontEndMenuManager.m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_LOW) && (b != pIslandLODmainlandEntity) && (b != pIslandLODbeachEntity) + ) || (b->m_level == level)) +#else + && b->m_level == level #endif ) if(b->bStreamBIGBuilding){ @@ -885,7 +897,7 @@ CStreaming::InstanceLoadedModels(const CVector &pos) void CStreaming::RequestIslands(eLevelName level) { -#ifndef NO_ISLAND_LOADING + ISLAND_LOADING_ISNT(HIGH) switch(level){ case LEVEL_MAINLAND: if(islandLODbeach != -1) @@ -897,7 +909,6 @@ CStreaming::RequestIslands(eLevelName level) break; default: break; } -#endif } static char *IGnames[] = { @@ -1227,12 +1238,13 @@ CStreaming::RemoveBuildingsNotInArea(int32 area) void CStreaming::RemoveUnusedBigBuildings(eLevelName level) { -#ifndef NO_ISLAND_LOADING + ISLAND_LOADING_IS(LOW) + { if(level != LEVEL_BEACH) RemoveBigBuildings(LEVEL_BEACH); if(level != LEVEL_MAINLAND) RemoveBigBuildings(LEVEL_MAINLAND); -#endif + } RemoveIslandsNotUsed(level); } @@ -1252,7 +1264,6 @@ DeleteIsland(CEntity *island) void CStreaming::RemoveIslandsNotUsed(eLevelName level) { -#ifndef NO_ISLAND_LOADING int i; if(pIslandLODmainlandEntity == nil) for(i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--){ @@ -1264,7 +1275,12 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level) if(building->GetModelIndex() == islandLODbeach) pIslandLODbeachEntity = building; } - +#ifdef NO_ISLAND_LOADING + if(FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) { + DeleteIsland(pIslandLODmainlandEntity); + DeleteIsland(pIslandLODbeachEntity); + } else +#endif switch(level){ case LEVEL_MAINLAND: DeleteIsland(pIslandLODmainlandEntity); @@ -1274,7 +1290,6 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level) break; } -#endif // !NO_ISLAND_LOADING } void @@ -1875,26 +1890,36 @@ CStreaming::LoadBigBuildingsWhenNeeded(void) CTimer::Suspend(); CGame::currLevel = CTheZones::m_CurrLevel; - DMAudio.SetEffectsFadeVol(0); - CPad::StopPadsShaking(); - CCollision::LoadCollisionScreen(CGame::currLevel); - DMAudio.Service(); - - RemoveUnusedBigBuildings(CGame::currLevel); - RemoveUnusedBuildings(CGame::currLevel); - RemoveUnusedModelsInLoadedList(); - CGame::TidyUpMemory(true, true); + ISLAND_LOADING_IS(LOW) + { + DMAudio.SetEffectsFadeVol(0); + CPad::StopPadsShaking(); + CCollision::LoadCollisionScreen(CGame::currLevel); + DMAudio.Service(); + RemoveUnusedBigBuildings(CGame::currLevel); + RemoveUnusedBuildings(CGame::currLevel); + RemoveUnusedModelsInLoadedList(); + CGame::TidyUpMemory(true, true); + } CReplay::EmptyReplayBuffer(); if(CGame::currLevel != LEVEL_GENERIC) LoadSplash(GetLevelSplashScreen(CGame::currLevel)); - CStreaming::RequestBigBuildings(CGame::currLevel, TheCamera.GetPosition()); + ISLAND_LOADING_IS(LOW) + CStreaming::RequestBigBuildings(CGame::currLevel, TheCamera.GetPosition()); + else if(FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_MEDIUM) { + RemoveIslandsNotUsed(CGame::currLevel); + CStreaming::RequestIslands(CGame::currLevel); + } + CStreaming::LoadAllRequestedModels(false); CGame::TidyUpMemory(true, true); CTimer::Resume(); - DMAudio.SetEffectsFadeVol(127); + + ISLAND_LOADING_IS(LOW) + DMAudio.SetEffectsFadeVol(127); } diff --git a/src/core/config.h b/src/core/config.h index f6336be8..8fd3bc1c 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -310,7 +310,7 @@ enum Config { # ifdef CUSTOM_FRONTEND_OPTIONS # define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable -//# 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 CUTSCENE_BORDERS_SWITCH //# define MULTISAMPLING // adds MSAA option # define INVERT_LOOK_FOR_PAD // enable the hidden option diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 7fbc34d0..e5c5a530 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -24,6 +24,7 @@ #include "Occlusion.h" #include "Renderer.h" #include "custompipes.h" +#include "Frontend.h" //--MIAMI: file done @@ -1396,8 +1397,19 @@ CRenderer::ScanWorld(void) poly[2].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPRIGHT].y); ScanSectorPoly(poly, 3, ScanSectorList); } - - ScanBigBuildingList(CWorld::GetBigBuildingList(CGame::currLevel)); + +#ifdef NO_ISLAND_LOADING + if (FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) { + ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_BEACH)); + ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_MAINLAND)); + } else +#endif + { +#ifdef FIX_BUGS + if(CCollision::ms_collisionInMemory != LEVEL_GENERIC) +#endif + ScanBigBuildingList(CWorld::GetBigBuildingList(CGame::currLevel)); + } ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_GENERIC)); } }