NO_ISLAND_LOADING ported from re3

This commit is contained in:
Sergeanur 2020-12-27 18:26:30 +02:00
parent 76e744bb7b
commit 7959b7fd1f
7 changed files with 77 additions and 45 deletions

View File

@ -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++) {

View File

@ -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

View File

@ -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)

View File

@ -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);

View File

@ -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);
}

View File

@ -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

View File

@ -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));
}
}