Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev
2020-05-06 01:11:18 +03:00
27 changed files with 327 additions and 792 deletions

View File

@ -3182,12 +3182,14 @@ CCamera::GetScreenFadeStatus(void)
void
CCamera::RenderMotionBlur(void)
{
#ifndef MIAMI // temporary
if(m_BlurType == 0)
return;
CMBlur::MotionBlurRender(m_pRwCamera,
m_BlurRed, m_BlurGreen, m_BlurBlue,
m_motionBlur, m_BlurType, m_imotionBlurAddAlpha);
#endif
}
void

View File

@ -99,9 +99,6 @@ CFileLoader::LoadLevel(const char *filename)
}
LoadingScreenLoadingFile(line + 4);
LoadScene(line + 4);
}else if(strncmp(line, "MAPZONE", 7) == 0){
LoadingScreenLoadingFile(line + 8);
LoadMapZones(line + 8);
}else if(strncmp(line, "SPLASH", 6) == 0){
LoadSplash(GetRandomSplashScreen());
}else if(strncmp(line, "CDIMAGE", 7) == 0){
@ -171,6 +168,7 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
debug("Loading collision file %s\n", filename);
fd = CFileMgr::OpenFile(filename, "rb");
assert(fd > 0);
while(CFileMgr::Read(fd, (char*)&header, sizeof(header))){
assert(strncmp(header.ident, "COLL", 4) == 0);
@ -554,7 +552,9 @@ CFileLoader::LoadObjectTypes(const char *filename)
enum {
NONE,
OBJS,
MLO, // unused but enum still has it
TOBJ,
WEAP,
HIER,
CARS,
PEDS,
@ -565,16 +565,17 @@ CFileLoader::LoadObjectTypes(const char *filename)
int fd;
int section;
int pathIndex;
char pathTypeStr[20];
int id, pathType;
int mlo;
int minID, maxID;
section = NONE;
minID = INT32_MAX;
maxID = -1;
pathIndex = -1;
mlo = 0;
debug("Loading object types from %s...\n", filename);
fd = CFileMgr::OpenFile(filename, "rb");
assert(fd > 0);
for(line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)){
if(*line == '\0' || *line == '#')
continue;
@ -582,6 +583,7 @@ CFileLoader::LoadObjectTypes(const char *filename)
if(section == NONE){
if(strncmp(line, "objs", 4) == 0) section = OBJS;
else if(strncmp(line, "tobj", 4) == 0) section = TOBJ;
else if(strncmp(line, "weap", 4) == 0) section = WEAP;
else if(strncmp(line, "hier", 4) == 0) section = HIER;
else if(strncmp(line, "cars", 4) == 0) section = CARS;
else if(strncmp(line, "peds", 4) == 0) section = PEDS;
@ -591,10 +593,17 @@ CFileLoader::LoadObjectTypes(const char *filename)
section = NONE;
}else switch(section){
case OBJS:
LoadObject(line);
id = LoadObject(line);
if(id > maxID) maxID = id;
if(id < minID) minID = id;
break;
case TOBJ:
LoadTimeObject(line);
id = LoadTimeObject(line);
if(id > maxID) maxID = id;
if(id < minID) minID = id;
break;
case WEAP:
assert(0 && "can't do this yet");
break;
case HIER:
LoadClumpObject(line);
@ -607,17 +616,15 @@ CFileLoader::LoadObjectTypes(const char *filename)
break;
case PATH:
if(pathIndex == -1){
id = LoadPathHeader(line, pathTypeStr);
if(strncmp(pathTypeStr, "ped", 4) == 0)
pathType = 1;
else if(strncmp(pathTypeStr, "car", 4) == 0)
pathType = 0;
id = LoadPathHeader(line, pathType);
pathIndex = 0;
}else{
if(pathType == 1)
if(pathType == 0)
LoadPedPathNode(line, id, pathIndex);
else if(pathType == 0)
LoadCarPathNode(line, id, pathIndex);
else if (pathType == 1)
LoadCarPathNode(line, id, pathIndex, false);
else if (pathType == 2)
LoadCarPathNode(line, id, pathIndex, true);
pathIndex++;
if(pathIndex == 12)
pathIndex = -1;
@ -630,7 +637,7 @@ CFileLoader::LoadObjectTypes(const char *filename)
}
CFileMgr::CloseFile(fd);
for(id = 0; id < MODELINFOSIZE; id++){
for(id = minID; id <= maxID; id++){
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id);
if(mi && mi->IsSimple())
mi->SetupBigBuilding();
@ -640,16 +647,20 @@ CFileLoader::LoadObjectTypes(const char *filename)
void
SetModelInfoFlags(CSimpleModelInfo *mi, uint32 flags)
{
mi->m_normalCull = !!(flags & 1);
mi->m_wetRoadReflection = !!(flags & 1);
mi->m_noFade = !!(flags & 2);
mi->m_drawLast = !!(flags & (4|8));
mi->m_additive = !!(flags & 8);
mi->m_isSubway = !!(flags & 0x10);
mi->m_ignoreLight = !!(flags & 0x20);
mi->m_noZwrite = !!(flags & 0x40);
mi->m_noShadows = !!(flags & 0x80);
mi->m_ignoreDrawDist = !!(flags & 0x100);
mi->m_isCodeGlass = !!(flags & 0x200);
mi->m_isArtistGlass = !!(flags & 0x400);
}
void
int
CFileLoader::LoadObject(const char *line)
{
int id, numObjs;
@ -660,7 +671,7 @@ CFileLoader::LoadObject(const char *line)
CSimpleModelInfo *mi;
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
return;
return 0; // game returns return value
switch(numObjs){
case 1:
@ -692,9 +703,11 @@ CFileLoader::LoadObject(const char *line)
mi->m_firstDamaged = damaged;
mi->SetTexDictionary(txd);
MatchModelString(model, id);
return id;
}
void
int
CFileLoader::LoadTimeObject(const char *line)
{
int id, numObjs;
@ -706,7 +719,7 @@ CFileLoader::LoadTimeObject(const char *line)
CTimeModelInfo *mi, *other;
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
return;
return 0; // game returns return value
switch(numObjs){
case 1:
@ -742,6 +755,8 @@ CFileLoader::LoadTimeObject(const char *line)
if(other)
other->SetOtherTimeModel(id);
MatchModelString(model, id);
return id;
}
void
@ -872,33 +887,51 @@ CFileLoader::LoadPedObject(const char *line)
}
int
CFileLoader::LoadPathHeader(const char *line, char *type)
CFileLoader::LoadPathHeader(const char *line, int &type)
{
int id;
char modelname[32];
sscanf(line, "%s %d %s", type, &id, modelname);
sscanf(line, "%d %d %s", &type, &id, modelname);
return id;
}
void
CFileLoader::LoadPedPathNode(const char *line, int id, int node)
{
int type, next, cross;
float x, y, z, width;
int type, next, cross, numLeft, numRight, speed, flags;
float x, y, z, width, spawnRate;
sscanf(line, "%d %d %d %f %f %f %f", &type, &next, &cross, &x, &y, &z, &width);
ThePaths.StoreNodeInfoPed(id, node, type, next, x, y, z, 0, !!cross);
if(sscanf(line, "%d %d %d %f %f %f %f %d %d %d %d %f",
&type, &next, &cross, &x, &y, &z, &width, &numLeft, &numRight,
&speed, &flags, &spawnRate) != 12)
spawnRate = 1.0f;
if(id == -1)
ThePaths.StoreDetachedNodeInfoPed(node, type, next, x, y, z,
width, !!cross, !!(flags&1), !!(flags&4), spawnRate*15.0f);
else
ThePaths.StoreNodeInfoPed(id, node, type, next, x, y, z,
width, !!cross, spawnRate*15.0f);
}
void
CFileLoader::LoadCarPathNode(const char *line, int id, int node)
CFileLoader::LoadCarPathNode(const char *line, int id, int node, bool waterPath)
{
int type, next, cross, numLeft, numRight;
float x, y, z, width;
int type, next, cross, numLeft, numRight, speed, flags;
float x, y, z, width, spawnRate;
sscanf(line, "%d %d %d %f %f %f %f %d %d", &type, &next, &cross, &x, &y, &z, &width, &numLeft, &numRight);
ThePaths.StoreNodeInfoCar(id, node, type, next, x, y, z, 0, numLeft, numRight);
if(sscanf(line, "%d %d %d %f %f %f %f %d %d %d %d %f",
&type, &next, &cross, &x, &y, &z, &width, &numLeft, &numRight,
&speed, &flags, &spawnRate) != 12)
spawnRate = 1.0f;
if(id == -1)
ThePaths.StoreDetachedNodeInfoCar(node, type, next, x, y, z, width, numLeft, numRight,
!!(flags&1), !!(flags&4), speed, !!(flags&2), waterPath, spawnRate, false);
else
ThePaths.StoreNodeInfoCar(id, node, type, next, x, y, z, 0, numLeft, numRight,
!!(flags&1), !!(flags&4), speed, !!(flags&2), waterPath, spawnRate);
}
@ -991,20 +1024,21 @@ CFileLoader::LoadScene(const char *filename)
INST,
ZONE,
CULL,
OCCL,
PICK,
PATH,
};
char *line;
int fd;
int section;
int pathIndex;
char pathTypeStr[20];
int pathType, pathIndex;
section = NONE;
pathIndex = -1;
debug("Creating objects from %s...\n", filename);
fd = CFileMgr::OpenFile(filename, "rb");
assert(fd > 0);
for(line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)){
if(*line == '\0' || *line == '#')
continue;
@ -1015,6 +1049,7 @@ CFileLoader::LoadScene(const char *filename)
else if(strncmp(line, "cull", 4) == 0) section = CULL;
else if(strncmp(line, "pick", 4) == 0) section = PICK;
else if(strncmp(line, "path", 4) == 0) section = PATH;
else if(strncmp(line, "occl", 4) == 0) section = OCCL;
}else if(strncmp(line, "end", 3) == 0){
section = NONE;
}else switch(section){
@ -1027,18 +1062,24 @@ CFileLoader::LoadScene(const char *filename)
case CULL:
LoadCullZone(line);
break;
case OCCL:
// TODO(MIAMI): occlusion
break;
case PICK:
// unused
LoadPickup(line);
break;
case PATH:
// unfinished in the game
if(pathIndex == -1){
LoadPathHeader(line, pathTypeStr);
// type not set
LoadPathHeader(line, pathType);
pathIndex = 0;
}else{
// nodes not loaded
if(pathType == 0)
LoadPedPathNode(line, -1, pathIndex);
else if (pathType == 1)
LoadCarPathNode(line, -1, pathIndex, false);
else if (pathType == 2)
LoadCarPathNode(line, -1, pathIndex, true);
pathIndex++;
if(pathIndex == 12)
pathIndex = -1;
@ -1122,9 +1163,7 @@ CFileLoader::LoadObjectInstance(const char *line)
entity->SetModelIndexNoCreate(id);
entity->GetMatrix() = CMatrix(xform);
CWorld::Add(entity);
// TODO(MIAMI)
//--MIAMI: TODO
if(IsGlass(entity->GetModelIndex()))
if(IsGlass(entity->GetModelIndex()) && !mi->m_isArtistGlass)
entity->bIsVisible = false;
entity->m_level = CTheZones::GetLevelFromPosition(entity->GetPosition());
entity->m_area = area;
@ -1172,54 +1211,7 @@ CFileLoader::LoadPickup(const char *line)
sscanf(line, "%d %f %f %f", &id, &x, &y, &z);
}
void
CFileLoader::LoadMapZones(const char *filename)
{
enum {
NONE,
INST,
ZONE,
CULL,
PICK,
PATH,
};
char *line;
int fd;
int section;
section = NONE;
debug("Creating zones from %s...\n", filename);
fd = CFileMgr::OpenFile(filename, "rb");
for(line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)){
if(*line == '\0' || *line == '#')
continue;
if(section == NONE){
if(strncmp(line, "zone", 4) == 0) section = ZONE;
}else if(strncmp(line, "end", 3) == 0){
section = NONE;
}else switch(section){
case ZONE: {
char name[24];
int type, level;
float minx, miny, minz;
float maxx, maxy, maxz;
if(sscanf(line, "%s %d %f %f %f %f %f %f %d",
&name, &type,
&minx, &miny, &minz,
&maxx, &maxy, &maxz,
&level) == 9)
CTheZones::CreateMapZone(name, (eZoneType)type, minx, miny, minz, maxx, maxy, maxz, (eLevelName)level);
}
break;
}
}
CFileMgr::CloseFile(fd);
debug("Finished loading IPL\n");
}
//--MIAMI: unused
void
CFileLoader::ReloadPaths(const char *filename)
{
@ -1230,10 +1222,10 @@ CFileLoader::ReloadPaths(const char *filename)
char *line;
int section = NONE;
int id, pathType, pathIndex = -1;
char pathTypeStr[20];
debug("Reloading paths from %s...\n", filename);
int fd = CFileMgr::OpenFile(filename, "r");
assert(fd > 0);
for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
if (*line == '\0' || *line == '#')
continue;
@ -1249,17 +1241,15 @@ CFileLoader::ReloadPaths(const char *filename)
switch (section) {
case PATH:
if (pathIndex == -1) {
id = LoadPathHeader(line, pathTypeStr);
if (strncmp(pathTypeStr, "ped", 4) == 0)
pathType = 1;
else if (strncmp(pathTypeStr, "car", 4) == 0)
pathType = 0;
id = LoadPathHeader(line, pathType);
pathIndex = 0;
} else {
if (pathType == 1)
if(pathType == 0)
LoadPedPathNode(line, id, pathIndex);
else if (pathType == 0)
LoadCarPathNode(line, id, pathIndex);
else if (pathType == 1)
LoadCarPathNode(line, id, pathIndex, false);
else if (pathType == 2)
LoadCarPathNode(line, id, pathIndex, true);
pathIndex++;
if (pathIndex == 12)
pathIndex = -1;
@ -1289,6 +1279,7 @@ CFileLoader::ReloadObjectTypes(const char *filename)
CFileMgr::ChangeDir("\\DATA\\MAPS\\");
int fd = CFileMgr::OpenFile(filename, "r");
assert(fd > 0);
CFileMgr::ChangeDir("\\");
for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
if (*line == '\0' || *line == '#')
@ -1364,6 +1355,7 @@ CFileLoader::ReLoadScene(const char *filename)
char *line;
CFileMgr::ChangeDir("\\DATA\\");
int fd = CFileMgr::OpenFile(filename, "r");
assert(fd > 0);
CFileMgr::ChangeDir("\\");
for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {

View File

@ -23,14 +23,14 @@ public:
static void AddTexDictionaries(RwTexDictionary *dst, RwTexDictionary *src);
static void LoadObjectTypes(const char *filename);
static void LoadObject(const char *line);
static void LoadTimeObject(const char *line);
static int LoadObject(const char *line);
static int LoadTimeObject(const char *line);
static void LoadClumpObject(const char *line);
static void LoadVehicleObject(const char *line);
static void LoadPedObject(const char *line);
static int LoadPathHeader(const char *line, char *type);
static int LoadPathHeader(const char *line, int &type);
static void LoadPedPathNode(const char *line, int id, int node);
static void LoadCarPathNode(const char *line, int id, int node);
static void LoadCarPathNode(const char *line, int id, int node, bool waterPath);
static void Load2dEffect(const char *line);
static void LoadScene(const char *filename);
@ -39,8 +39,6 @@ public:
static void LoadCullZone(const char *line);
static void LoadPickup(const char *line);
static void LoadMapZones(const char *filename);
static void ReloadPaths(const char *filename);
static void ReloadObjectTypes(const char *filename);
static void ReloadObject(const char *line);

View File

@ -265,7 +265,7 @@ bool CGame::Initialise(const char* datFile)
strcpy(aDatFile, datFile);
CPools::Initialise();
CIniFile::LoadIniFile();
currLevel = LEVEL_INDUSTRIAL;
currLevel = LEVEL_BEACH;
LoadingScreen("Loading the Game", "Loading generic textures", GetRandomSplashScreen());
gameTxdSlot = CTxdStore::AddTxdSlot("generic");
CTxdStore::Create(gameTxdSlot);
@ -588,7 +588,7 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Initialise();
FrontEndMenuManager.m_bWantToLoad = false;
ReInitGameObjectVariables();
currLevel = LEVEL_INDUSTRIAL;
currLevel = LEVEL_NONE;
CCollision::SortOutCollisionAfterLoad();
}
}

View File

@ -3,9 +3,30 @@
enum eLevelName {
LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel
LEVEL_NONE = 0,
LEVEL_INDUSTRIAL,
LEVEL_COMMERCIAL,
LEVEL_SUBURBAN
LEVEL_BEACH,
LEVEL_MAINLAND
};
enum eAreaName {
AREA_MAIN_MAP,
AREA_HOTEL,
AREA_MANSION,
AREA_BANK,
AREA_MALL,
AREA_STRIP_CLUB,
AREA_LAWYERS,
AREA_COFFEE_SHOP,
AREA_CONCERT_HALL,
AREA_STUDIO,
AREA_RIFLE_RANGE,
AREA_BIKER_BAR,
AREA_POLICE_STATION,
AREA_EVERYWHERE,
AREA_DIRT,
AREA_BLOOD,
AREA_OVALRING,
AREA_MALIBU_CLUB,
AREA_PRINT_WORKS
};
enum eVisibilityArea
@ -66,3 +87,5 @@ public:
static void DrasticTidyUpMemory(bool);
static void ProcessTidyUpMemory(void);
};
inline bool IsAreaVisible(int area) { return area == CGame::currArea || area == AREA_EVERYWHERE; }

View File

@ -64,16 +64,10 @@ uint32 CStreaming::ms_memoryAvailable;
int32 desiredNumVehiclesLoaded = 12;
CEntity *pIslandLODindustEntity;
CEntity *pIslandLODcomIndEntity;
CEntity *pIslandLODcomSubEntity;
CEntity *pIslandLODsubIndEntity;
CEntity *pIslandLODsubComEntity;
int32 islandLODindust;
int32 islandLODcomInd;
int32 islandLODcomSub;
int32 islandLODsubInd;
int32 islandLODsubCom;
CEntity *pIslandLODmainlandEntity;
CEntity *pIslandLODbeachEntity;
int32 islandLODmainland;
int32 islandLODbeach;
bool
CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size)
@ -212,21 +206,12 @@ CStreaming::Init2(void)
// find island LODs
pIslandLODindustEntity = nil;
pIslandLODcomIndEntity = nil;
pIslandLODcomSubEntity = nil;
pIslandLODsubIndEntity = nil;
pIslandLODsubComEntity = nil;
islandLODindust = -1;
islandLODcomInd = -1;
islandLODcomSub = -1;
islandLODsubInd = -1;
islandLODsubCom = -1;
CModelInfo::GetModelInfo("IslandLODInd", &islandLODindust);
CModelInfo::GetModelInfo("IslandLODcomIND", &islandLODcomInd);
CModelInfo::GetModelInfo("IslandLODcomSUB", &islandLODcomSub);
CModelInfo::GetModelInfo("IslandLODsubIND", &islandLODsubInd);
CModelInfo::GetModelInfo("IslandLODsubCOM", &islandLODsubCom);
pIslandLODmainlandEntity = nil;
pIslandLODbeachEntity = nil;
islandLODmainland = -1;
islandLODbeach = -1;
CModelInfo::GetModelInfo("IslandLODmainland", &islandLODmainland);
CModelInfo::GetModelInfo("IslandLODbeach", &islandLODbeach);
}
void
@ -678,47 +663,6 @@ CStreaming::RequestModel(int32 id, int32 flags)
}
}
void
CStreaming::RequestSubway(void)
{
RequestModel(MI_SUBWAY1, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY2, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY3, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY4, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY5, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY6, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY7, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY8, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY9, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY10, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY11, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY12, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY13, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY14, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY15, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY16, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY17, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBWAY18, STREAMFLAGS_NOFADE);
switch(CGame::currLevel){
case LEVEL_INDUSTRIAL:
RequestModel(MI_SUBPLATFORM_IND, STREAMFLAGS_NOFADE);
break;
case LEVEL_COMMERCIAL:
if(FindPlayerTrain()->GetPosition().y < -700.0f){
RequestModel(MI_SUBPLATFORM_COMS, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBPLATFORM_COMS2, STREAMFLAGS_NOFADE);
}else{
RequestModel(MI_SUBPLATFORM_COMN, STREAMFLAGS_NOFADE);
}
break;
case LEVEL_SUBURBAN:
RequestModel(MI_SUBPLATFORM_SUB, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBPLATFORM_SUB2, STREAMFLAGS_NOFADE);
break;
}
}
#define BIGBUILDINGFLAGS STREAMFLAGS_DONT_REMOVE
void
@ -772,21 +716,18 @@ CStreaming::InstanceBigBuildings(eLevelName level, const CVector &pos)
}
}
//--MIAMI: done
void
CStreaming::RequestIslands(eLevelName level)
{
switch(level){
case LEVEL_INDUSTRIAL:
RequestModel(islandLODcomInd, BIGBUILDINGFLAGS);
RequestModel(islandLODsubInd, BIGBUILDINGFLAGS);
case LEVEL_MAINLAND:
if(islandLODbeach != -1)
RequestModel(islandLODbeach, BIGBUILDINGFLAGS);
break;
case LEVEL_COMMERCIAL:
RequestModel(islandLODindust, BIGBUILDINGFLAGS);
RequestModel(islandLODsubCom, BIGBUILDINGFLAGS);
break;
case LEVEL_SUBURBAN:
RequestModel(islandLODindust, BIGBUILDINGFLAGS);
RequestModel(islandLODcomSub, BIGBUILDINGFLAGS);
case LEVEL_BEACH:
if(islandLODmainland != -1)
RequestModel(islandLODmainland, BIGBUILDINGFLAGS);
break;
}
}
@ -906,16 +847,14 @@ CStreaming::RemoveModel(int32 id)
ms_aInfoForModel[id].m_loadState = STREAMSTATE_NOTLOADED;
}
//--MIAMI: change islands
//--MIAMI: done
void
CStreaming::RemoveUnusedBuildings(eLevelName level)
{
if(level != LEVEL_INDUSTRIAL)
RemoveBuildings(LEVEL_INDUSTRIAL);
if(level != LEVEL_COMMERCIAL)
RemoveBuildings(LEVEL_COMMERCIAL);
if(level != LEVEL_SUBURBAN)
RemoveBuildings(LEVEL_SUBURBAN);
if(level != LEVEL_BEACH)
RemoveBuildings(LEVEL_BEACH);
if(level != LEVEL_MAINLAND)
RemoveBuildings(LEVEL_MAINLAND);
}
//--MIAMI: done
@ -979,16 +918,14 @@ CStreaming::RemoveBuildings(eLevelName level)
}
}
//--MIAMI: change islands
//--MIAMI: done
void
CStreaming::RemoveUnusedBigBuildings(eLevelName level)
{
if(level != LEVEL_INDUSTRIAL)
RemoveBigBuildings(LEVEL_INDUSTRIAL);
if(level != LEVEL_COMMERCIAL)
RemoveBigBuildings(LEVEL_COMMERCIAL);
if(level != LEVEL_SUBURBAN)
RemoveBigBuildings(LEVEL_SUBURBAN);
if(level != LEVEL_BEACH)
RemoveBigBuildings(LEVEL_BEACH);
if(level != LEVEL_MAINLAND)
RemoveBigBuildings(LEVEL_MAINLAND);
RemoveIslandsNotUsed(level);
}
@ -1009,40 +946,23 @@ void
CStreaming::RemoveIslandsNotUsed(eLevelName level)
{
int i;
if(pIslandLODindustEntity == nil)
if(pIslandLODmainlandEntity == nil)
for(i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--){
CBuilding *building = CPools::GetBuildingPool()->GetSlot(i);
if(building == nil)
continue;
if(building->GetModelIndex() == islandLODindust) pIslandLODindustEntity = building;
if(building->GetModelIndex() == islandLODcomInd) pIslandLODcomIndEntity = building;
if(building->GetModelIndex() == islandLODcomSub) pIslandLODcomSubEntity = building;
if(building->GetModelIndex() == islandLODsubInd) pIslandLODsubIndEntity = building;
if(building->GetModelIndex() == islandLODsubCom) pIslandLODsubComEntity = building;
if(building->GetModelIndex() == islandLODmainland)
pIslandLODmainlandEntity = building;
if(building->GetModelIndex() == islandLODbeach)
pIslandLODbeachEntity = building;
}
switch(level){
case LEVEL_INDUSTRIAL:
DeleteIsland(pIslandLODindustEntity);
DeleteIsland(pIslandLODcomSubEntity);
DeleteIsland(pIslandLODsubComEntity);
case LEVEL_MAINLAND:
DeleteIsland(pIslandLODmainlandEntity);
break;
case LEVEL_COMMERCIAL:
DeleteIsland(pIslandLODcomIndEntity);
DeleteIsland(pIslandLODcomSubEntity);
DeleteIsland(pIslandLODsubIndEntity);
break;
case LEVEL_SUBURBAN:
DeleteIsland(pIslandLODsubIndEntity);
DeleteIsland(pIslandLODsubComEntity);
DeleteIsland(pIslandLODcomIndEntity);
break;
default:
DeleteIsland(pIslandLODindustEntity);
DeleteIsland(pIslandLODcomIndEntity);
DeleteIsland(pIslandLODcomSubEntity);
DeleteIsland(pIslandLODsubIndEntity);
DeleteIsland(pIslandLODsubComEntity);
case LEVEL_BEACH:
DeleteIsland(pIslandLODbeachEntity);
break;
}
}

View File

@ -4,19 +4,19 @@
#include "Lists.h"
#include "PlayerInfo.h"
/* Sectors span from -2000 to 2000 in x and y.
* With 100x100 sectors, each is 40x40 units. */
/* Sectors span from -2400 to 1600 in x and -2000 to 2000 y.
* With 80x80 sectors, each is 50x50 units. */
#define SECTOR_SIZE_X (40.0f)
#define SECTOR_SIZE_Y (40.0f)
#define SECTOR_SIZE_X (50.0f)
#define SECTOR_SIZE_Y (50.0f)
#define NUMSECTORS_X (100)
#define NUMSECTORS_Y (100)
#define NUMSECTORS_X (80)
#define NUMSECTORS_Y (80)
#define WORLD_SIZE_X (NUMSECTORS_X * SECTOR_SIZE_X)
#define WORLD_SIZE_Y (NUMSECTORS_Y * SECTOR_SIZE_Y)
#define WORLD_MIN_X (-2000.0f)
#define WORLD_MIN_X (-2400.0f)
#define WORLD_MIN_Y (-2000.0f)
#define WORLD_MAX_X (WORLD_MIN_X + WORLD_SIZE_X)

View File

@ -139,7 +139,11 @@ CTheZones::CreateZone(char *name, eZoneType type,
for(p = name; *p; p++) if(islower(*p)) *p = toupper(*p);
// add zone
zone = &ZoneArray[TotalNumberOfZones++];
// TODO(MIAMI): do this properly, also navig zones
if(type == ZONE_MAPZONE)
zone = &MapZoneArray[TotalNumberOfMapZones++];
else
zone = &ZoneArray[TotalNumberOfZones++];
strncpy(zone->name, name, 7);
zone->name[7] = '\0';
zone->type = type;
@ -156,36 +160,6 @@ CTheZones::CreateZone(char *name, eZoneType type,
}
}
void
CTheZones::CreateMapZone(char *name, eZoneType type,
float minx, float miny, float minz,
float maxx, float maxy, float maxz,
eLevelName level)
{
CZone *zone;
char *p;
if(minx > maxx) SWAPF(minx, maxx);
if(miny > maxy) SWAPF(miny, maxy);
if(minz > maxz) SWAPF(minz, maxz);
// make upper case
for(p = name; *p; p++) if(islower(*p)) *p = toupper(*p);
// add zone
zone = &MapZoneArray[TotalNumberOfMapZones++];
strncpy(zone->name, name, 7);
zone->name[7] = '\0';
zone->type = type;
zone->minx = minx;
zone->miny = miny;
zone->minz = minz;
zone->maxx = maxx;
zone->maxy = maxy;
zone->maxz = maxz;
zone->level = level;
}
void
CTheZones::PostZoneCreation(void)
{
@ -565,18 +539,6 @@ CTheZones::FindAudioZone(CVector *pos)
return -1;
}
eLevelName
CTheZones::FindZoneForPoint(const CVector &pos)
{
if(PointLiesWithinZone(pos, GetZone(FindZoneByLabelAndReturnIndex("IND_ZON"))))
return LEVEL_INDUSTRIAL;
if(PointLiesWithinZone(pos, GetZone(FindZoneByLabelAndReturnIndex("COM_ZON"))))
return LEVEL_COMMERCIAL;
if(PointLiesWithinZone(pos, GetZone(FindZoneByLabelAndReturnIndex("SUB_ZON"))))
return LEVEL_SUBURBAN;
return LEVEL_NONE;
}
void
CTheZones::AddZoneToAudioZoneArray(CZone *zone)
{

View File

@ -71,10 +71,6 @@ public:
float minx, float miny, float minz,
float maxx, float maxy, float maxz,
eLevelName level);
static void CreateMapZone(char *name, eZoneType type,
float minx, float miny, float minz,
float maxx, float maxy, float maxz,
eLevelName level);
static CZone *GetZone(uint16 i) { return &ZoneArray[i]; }
static void PostZoneCreation(void);
static void InsertZoneIntoZoneHierarchy(CZone *zone);
@ -103,7 +99,6 @@ public:
static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity);
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
static int16 FindAudioZone(CVector *pos);
static eLevelName FindZoneForPoint(const CVector &pos);
static CZone *GetPointerForZoneIndex(int32 i) { return i == -1 ? nil : &ZoneArray[i]; }
static int32 GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - ZoneArray; }
static void AddZoneToAudioZoneArray(CZone *zone);

View File

@ -23,7 +23,7 @@ enum Config {
MAXVEHICLESLOADED = 50, // 70 on mobile
NUMOBJECTINFO = 168, // object.dat
NUMOBJECTINFO = 400, // TODO(MIAMI): fantasy // object.dat
// Pool sizes
NUMPTRNODES = 50000,

View File

@ -1134,7 +1134,7 @@ void
InitialiseGame(void)
{
LoadingScreen(nil, nil, "loadsc0");
CGame::Initialise("DATA\\GTA3.DAT");
CGame::Initialise("DATA\\GTA_VC.DAT");
}
RsEventStatus