Merge branch 'master' into miami

# Conflicts:
#	src/control/CarAI.cpp
#	src/control/Phones.cpp
#	src/control/Phones.h
#	src/control/Record.cpp
#	src/control/Restart.cpp
#	src/control/Script.cpp
#	src/core/Collision.cpp
#	src/core/Frontend.cpp
#	src/core/Frontend.h
#	src/core/Game.h
#	src/core/Streaming.cpp
#	src/core/TempColModels.cpp
#	src/core/Wanted.cpp
#	src/core/Zones.cpp
#	src/core/config.h
#	src/core/main.cpp
#	src/core/re3.cpp
#	src/entities/Entity.cpp
#	src/entities/Physical.cpp
#	src/extras/frontendoption.cpp
#	src/modelinfo/ModelInfo.cpp
#	src/modelinfo/PedModelInfo.cpp
#	src/peds/CivilianPed.cpp
#	src/peds/CopPed.cpp
#	src/peds/EmergencyPed.cpp
#	src/peds/Ped.cpp
#	src/peds/Ped.h
#	src/peds/Population.cpp
#	src/render/Renderer.cpp
#	src/save/GenericGameStorage.cpp
#	src/skel/win/win.cpp
#	src/vehicles/Automobile.cpp
#	src/vehicles/Boat.cpp
#	src/vehicles/Boat.h
#	src/vehicles/Vehicle.cpp
This commit is contained in:
Sergeanur
2020-07-13 18:10:17 +03:00
30 changed files with 140 additions and 60 deletions

View File

@ -41,7 +41,7 @@ void
CCollision::Init(void)
{
ms_colModelCache.Init(NUMCOLCACHELINKS);
ms_collisionInMemory = LEVEL_NONE;
ms_collisionInMemory = LEVEL_GENERIC;
CColStore::Initialise();
}
@ -70,10 +70,10 @@ GetCollisionInSectorList(CPtrList &list)
for(node = list.first; node; node = node->next){
e = (CEntity*)node->item;
level = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel()->level;
if(level != LEVEL_NONE)
if(level != LEVEL_GENERIC)
return (eLevelName)level;
}
return LEVEL_NONE;
return LEVEL_GENERIC;
}
//--MIAMI: unused
@ -84,15 +84,15 @@ GetCollisionInSector(CSector &sect)
int level;
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_BUILDINGS]);
if(level == LEVEL_NONE)
if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_BUILDINGS_OVERLAP]);
if(level == LEVEL_NONE)
if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_OBJECTS]);
if(level == LEVEL_NONE)
if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_OBJECTS_OVERLAP]);
if(level == LEVEL_NONE)
if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_DUMMIES]);
if(level == LEVEL_NONE)
if(level == LEVEL_GENERIC)
level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_DUMMIES_OVERLAP]);
return (eLevelName)level;
}

View File

@ -91,6 +91,10 @@ int curBottomBarOption = -1;
int hoveredBottomBarOption = -1;
#endif
#ifdef CUTSCENE_BORDERS_SWITCH
bool CMenuManager::m_PrefsCutsceneBorders = true;
#endif
// Originally that was PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway)
#ifdef PS2_LIKE_MENU
const CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255);
@ -3166,6 +3170,9 @@ CMenuManager::LoadSettings()
CFileMgr::Read(fileHandle, (char*)&m_PrefsShowHud, 1);
CFileMgr::Read(fileHandle, (char*)&m_PrefsRadarMode, 1);
CFileMgr::Read(fileHandle, (char*)&m_PrefsShowLegends, 1);
#ifdef CUTSCENE_BORDERS_SWITCH
CFileMgr::Read(fileHandle, (char *)&CMenuManager::m_PrefsCutsceneBorders, 1);
#endif
}
}
@ -3275,6 +3282,9 @@ CMenuManager::SaveSettings()
CFileMgr::Write(fileHandle, (char*)&m_PrefsShowHud, 1);
CFileMgr::Write(fileHandle, (char*)&m_PrefsRadarMode, 1);
CFileMgr::Write(fileHandle, (char*)&m_PrefsShowLegends, 1);
#ifdef CUTSCENE_BORDERS_SWITCH
CFileMgr::Write(fileHandle, (char *)&CMenuManager::m_PrefsCutsceneBorders, 1);
#endif
}
m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex;

View File

@ -598,6 +598,10 @@ public:
};
bool GetIsMenuActive() {return !!m_bMenuActive;}
#ifdef CUTSCENE_BORDERS_SWITCH
static bool m_PrefsCutsceneBorders;
#endif
#ifndef MASTER
static bool m_PrefsMarketing;
static bool m_PrefsDisableTutorials;

View File

@ -354,7 +354,7 @@ bool CGame::Initialise(const char* datFile)
LoadingScreen("Loading the Game", "Setup streaming", nil);
CStreaming::LoadInitialVehicles();
CStreaming::LoadInitialPeds();
CStreaming::RequestBigBuildings(LEVEL_NONE);
CStreaming::RequestBigBuildings(LEVEL_GENERIC);
CStreaming::LoadAllRequestedModels(false);
printf("Streaming uses %dK of its memory", CStreaming::ms_memoryUsed / 1024);
LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen());
@ -505,7 +505,7 @@ void CGame::ReInitGameObjectVariables(void)
CTimeCycle::Initialise();
CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f;
CStreaming::RequestBigBuildings(LEVEL_NONE);
CStreaming::RequestBigBuildings(LEVEL_GENERIC);
CStreaming::LoadAllRequestedModels(false);
CPed::Initialise();
CEventList::Initialise();
@ -643,7 +643,7 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Initialise();
FrontEndMenuManager.m_bWantToLoad = false;
ReInitGameObjectVariables();
currLevel = LEVEL_NONE;
currLevel = LEVEL_GENERIC;
CCollision::SortOutCollisionAfterLoad();
}
}

View File

@ -2,7 +2,7 @@
enum eLevelName {
LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel
LEVEL_NONE = 0,
LEVEL_GENERIC = 0,
LEVEL_BEACH,
LEVEL_MAINLAND
};

View File

@ -560,7 +560,7 @@ CPlayerInfo::Process(void)
veh->m_nZoneLevel = LEVEL_IGNORE;
for (int i = 0; i < ARRAY_SIZE(veh->pPassengers); i++) {
if (veh->pPassengers[i])
veh->pPassengers[i]->m_nZoneLevel = LEVEL_NONE;
veh->pPassengers[i]->m_nZoneLevel = LEVEL_GENERIC;
}
CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled;
} else {

View File

@ -21,8 +21,8 @@ int32 CStats::PedsKilledOfThisType[NUM_PEDTYPES];
int32 CStats::TimesDied;
int32 CStats::TimesArrested;
int32 CStats::KillsSinceLastCheckpoint;
int32 CStats::DistanceTravelledInVehicle;
int32 CStats::DistanceTravelledOnFoot;
float CStats::DistanceTravelledInVehicle;
float CStats::DistanceTravelledOnFoot;
int32 CStats::ProgressMade;
int32 CStats::TotalProgressInGame;
int32 CStats::CarsExploded;

View File

@ -25,8 +25,8 @@ public:
static int32 TimesDied;
static int32 TimesArrested;
static int32 KillsSinceLastCheckpoint;
static int32 DistanceTravelledInVehicle;
static int32 DistanceTravelledOnFoot;
static float DistanceTravelledInVehicle;
static float DistanceTravelledOnFoot;
static int32 CarsExploded;
static int32 PeopleKilledByPlayer;
static int32 ProgressMade;

View File

@ -723,7 +723,11 @@ CStreaming::RequestBigBuildings(eLevelName level, const CVector &pos)
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
#ifndef NO_ISLAND_LOADING
&& b->m_level == level
#endif
)
if(b->bStreamBIGBuilding){
if(CRenderer::ShouldModelBeStreamed(b, pos))
RequestModel(b->GetModelIndex(), 0);
@ -795,6 +799,7 @@ CStreaming::InstanceLoadedModels(const CVector &pos)
void
CStreaming::RequestIslands(eLevelName level)
{
#ifndef NO_ISLAND_LOADING
switch(level){
case LEVEL_MAINLAND:
if(islandLODbeach != -1)
@ -806,6 +811,7 @@ CStreaming::RequestIslands(eLevelName level)
break;
default: break;
}
#endif
}
//--MIAMI: TODO
@ -1010,10 +1016,12 @@ CStreaming::RemoveBuildings(eLevelName level)
void
CStreaming::RemoveUnusedBigBuildings(eLevelName level)
{
#ifndef NO_ISLAND_LOADING
if(level != LEVEL_BEACH)
RemoveBigBuildings(LEVEL_BEACH);
if(level != LEVEL_MAINLAND)
RemoveBigBuildings(LEVEL_MAINLAND);
#endif
RemoveIslandsNotUsed(level);
}
@ -1035,6 +1043,7 @@ 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--){
@ -1053,8 +1062,10 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level)
break;
case LEVEL_BEACH:
DeleteIsland(pIslandLODbeachEntity);
break;
}
#endif // !NO_ISLAND_LOADING
}
//--MIAMI: done
@ -1594,7 +1605,7 @@ CStreaming::LoadBigBuildingsWhenNeeded(void)
if(CCutsceneMgr::IsCutsceneProcessing())
return;
if(CTheZones::m_CurrLevel == LEVEL_NONE ||
if(CTheZones::m_CurrLevel == LEVEL_GENERIC ||
CTheZones::m_CurrLevel == CGame::currLevel)
return;
@ -1612,7 +1623,7 @@ CStreaming::LoadBigBuildingsWhenNeeded(void)
CGame::TidyUpMemory(true, true);
CReplay::EmptyReplayBuffer();
if(CGame::currLevel != LEVEL_NONE)
if(CGame::currLevel != LEVEL_GENERIC)
LoadSplash(GetLevelSplashScreen(CGame::currLevel));
CStreaming::RequestBigBuildings(CGame::currLevel, TheCamera.GetPosition());
@ -2620,16 +2631,16 @@ CStreaming::LoadScene(const CVector &pos)
}
CRenderer::m_loadingPriority = false;
DeleteAllRwObjects();
if(level == LEVEL_NONE)
if(level == LEVEL_GENERIC)
level = CGame::currLevel;
CGame::currLevel = level;
RemoveUnusedBigBuildings(level);
RequestBigBuildings(level, pos);
RequestBigBuildings(LEVEL_NONE, pos);
RequestBigBuildings(LEVEL_GENERIC, pos);
RemoveIslandsNotUsed(level);
LoadAllRequestedModels(false);
InstanceBigBuildings(level, pos);
InstanceBigBuildings(LEVEL_NONE, pos);
InstanceBigBuildings(LEVEL_GENERIC, pos);
AddModelsToRequestList(pos);
CRadar::StreamRadarSections(pos);

View File

@ -37,19 +37,19 @@ CTempColModels::Initialise(void)
#define SET_COLMODEL_SPHERES(colmodel, sphrs)\
colmodel.numSpheres = ARRAY_SIZE(sphrs);\
colmodel.spheres = sphrs;\
colmodel.level = LEVEL_NONE;\
colmodel.level = LEVEL_GENERIC;\
colmodel.ownsCollisionVolumes = false;\
int i;
ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f));
ms_colModelBBox.level = LEVEL_NONE;
ms_colModelBBox.level = LEVEL_GENERIC;
for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) {
ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelCutObj[i].boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f));
ms_colModelCutObj[i].level = LEVEL_NONE;
ms_colModelCutObj[i].level = LEVEL_GENERIC;
}
// Ped Spheres

View File

@ -1785,7 +1785,7 @@ CWorld::ClearForRestart(void)
CWorld::Remove(pEntity);
delete pEntity;
}
for(CPtrNode *pNode = GetBigBuildingList(LEVEL_NONE).first; pNode; pNode = pNode->next) {
for(CPtrNode *pNode = GetBigBuildingList(LEVEL_GENERIC).first; pNode; pNode = pNode->next) {
CVehicle *pVehicle = (CVehicle *)pNode->item;
if(pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) {
CWorld::Remove(pVehicle);

View File

@ -93,7 +93,7 @@ CTheZones::Init(void)
InfoZoneArray[0].maxx = 1600.0f;
InfoZoneArray[0].maxy = 2000.0f;
InfoZoneArray[0].maxz = 500.0f;
InfoZoneArray[0].level = LEVEL_NONE;
InfoZoneArray[0].level = LEVEL_GENERIC;
InfoZoneArray[0].type = ZONE_INFO;
strcpy(NavigationZoneArray[0].name, "VICE_C");
@ -103,10 +103,10 @@ CTheZones::Init(void)
NavigationZoneArray[0].maxx = 1600.0f;
NavigationZoneArray[0].maxy = 2000.0f;
NavigationZoneArray[0].maxz = 500.0f;
NavigationZoneArray[0].level = LEVEL_NONE;
NavigationZoneArray[0].level = LEVEL_GENERIC;
NavigationZoneArray[0].type = ZONE_NAVIG;
m_CurrLevel = LEVEL_NONE;
m_CurrLevel = LEVEL_GENERIC;
for(i = 0; i < NUMMAPZONES; i++){
memset(&MapZoneArray[i], 0, sizeof(CZone));
@ -120,7 +120,7 @@ CTheZones::Init(void)
MapZoneArray[0].maxx = 1600.0f;
MapZoneArray[0].maxy = 2000.0f;
MapZoneArray[0].maxz = 500.0f;
MapZoneArray[0].level = LEVEL_NONE;
MapZoneArray[0].level = LEVEL_GENERIC;
}
//--MIAMI: done

View File

@ -213,7 +213,10 @@ enum Config {
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
#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 USE_TEXTURE_POOL
#define CUTSCENE_BORDERS_SWITCH
// Water & Particle
#define PC_PARTICLE
@ -281,6 +284,7 @@ enum Config {
#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
//#define PEDS_REPORT_CRIMES_ON_PHONE
// Camera
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future

View File

@ -249,7 +249,11 @@ DoFade(void)
}
// This is CCamera::GetScreenRect in VC
if(TheCamera.m_WideScreenOn){
if(TheCamera.m_WideScreenOn
#ifdef CUTSCENE_BORDERS_SWITCH
&& CMenuManager::m_PrefsCutsceneBorders
#endif
){
float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
rect.left = 0.0f;
rect.right = SCREEN_WIDTH;
@ -464,6 +468,11 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
{
CSprite2d *splash;
#ifdef DISABLE_LOADING_SCREEN
if (str1 && str2)
return;
#endif
#ifndef RANDOMSPLASH
splashscreen = "LOADSC0";
#endif
@ -885,7 +894,11 @@ Render2dStuff(void)
CReplay::Display();
CPickups::RenderPickUpText();
if(TheCamera.m_WideScreenOn)
if(TheCamera.m_WideScreenOn
#ifdef CUTSCENE_BORDERS_SWITCH
&& CMenuManager::m_PrefsCutsceneBorders
#endif
)
TheCamera.DrawBordersForWideScreen();
CPed *player = FindPlayerPed();

View File

@ -134,6 +134,14 @@ void ToggleFreeCam(int8 action)
}
#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)
@ -158,6 +166,12 @@ CustomFrontendOptionsPopulate(void)
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_GRAPHICS_SETTINGS, 9);
FrontendOptionAddSelect((const wchar *)L"CUTSCENE BORDERS", off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil);
#endif
}
#endif