checked some of streaming for VC changes

This commit is contained in:
aap 2020-05-06 21:54:43 +02:00
parent 03cecb6f1c
commit 965ea93a61
8 changed files with 120 additions and 108 deletions

View File

@ -501,13 +501,13 @@ CPathFind::PreparePathData(void)
}
for(i = 0; i < NUMDETACHED_CARS; i++)
for(j = 0; j < 12; j++)
if(DetachedInfoForTilePeds[i*12 + j].type == NodeTypeExtern){
if(DetachedInfoForTileCars[i*12 + j].type == NodeTypeExtern){
// MI:%d here but no argument for it
if(DetachedInfoForTilePeds[i*12 + j].numLeftLanes < 0)
if(DetachedInfoForTileCars[i*12 + j].numLeftLanes < 0)
printf("ILLEGAL BLOCK. NEGATIVE NUMBER OF LANES (Obj:%d)\n", i);
if(DetachedInfoForTilePeds[i*12 + j].numRightLanes < 0)
if(DetachedInfoForTileCars[i*12 + j].numRightLanes < 0)
printf("ILLEGAL BLOCK. NEGATIVE NUMBER OF LANES (Obj:%d)\n", i);
if(DetachedInfoForTilePeds[i*12 + j].numLeftLanes + DetachedInfoForTilePeds[i*12 + j].numRightLanes <= 0)
if(DetachedInfoForTileCars[i*12 + j].numLeftLanes + DetachedInfoForTileCars[i*12 + j].numRightLanes <= 0)
printf("ILLEGAL BLOCK. NO LANES IN NODE (Obj:%d)\n", i);
}

View File

@ -222,6 +222,7 @@ CColStore::EnsureCollisionIsInMemory(const CVector2D &pos)
}
}
//--MIAMI: done
bool
CColStore::HasCollisionLoaded(const CVector2D &pos)
{

View File

@ -641,7 +641,7 @@ CFileLoader::LoadObjectTypes(const char *filename)
for(id = minID; id <= maxID; id++){
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id);
if(mi && mi->IsSimple())
if(mi && mi->IsBuilding())
mi->SetupBigBuilding();
}
}
@ -1143,7 +1143,7 @@ CFileLoader::LoadObjectInstance(const char *line)
entity->GetMatrix() = CMatrix(xform);
entity->m_level = CTheZones::GetLevelFromPosition(&entity->GetPosition());
entity->m_area = area;
if(mi->IsSimple()){
if(mi->IsBuilding()){
if(mi->m_isBigBuilding)
entity->SetupBigBuilding();
if(mi->m_isSubway)

View File

@ -50,6 +50,7 @@ int32 CStreaming::ms_channelError;
int32 CStreaming::ms_numVehiclesLoaded;
int32 CStreaming::ms_vehiclesLoaded[MAXVEHICLESLOADED];
int32 CStreaming::ms_lastVehicleDeleted;
bool CStreaming::ms_bIsPedFromPedGroupLoaded[NUMMODELSPERPEDGROUP];
CDirectory *CStreaming::ms_pExtraObjectsDir;
int32 CStreaming::ms_numPriorityRequests;
int32 CStreaming::ms_currentPedGrp;
@ -69,6 +70,7 @@ CEntity *pIslandLODbeachEntity;
int32 islandLODmainland;
int32 islandLODbeach;
//--MIAMI: done
bool
CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size)
{
@ -79,6 +81,7 @@ CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size)
return true;
}
//--MIAMI: done
void
CStreamingInfo::SetCdPosnAndSize(uint32 posn, uint32 size)
{
@ -86,6 +89,7 @@ CStreamingInfo::SetCdPosnAndSize(uint32 posn, uint32 size)
m_size = size;
}
//--MIAMI: done
void
CStreamingInfo::AddToList(CStreamingInfo *link)
{
@ -96,6 +100,7 @@ CStreamingInfo::AddToList(CStreamingInfo *link)
m_next->m_prev = this;
}
//--MIAMI: done
void
CStreamingInfo::RemoveFromList(void)
{
@ -105,6 +110,7 @@ CStreamingInfo::RemoveFromList(void)
m_prev = nil;
}
//--MIAMI: done
void
CStreaming::Init2(void)
{
@ -174,12 +180,15 @@ CStreaming::Init2(void)
ms_vehiclesLoaded[i] = -1;
ms_numVehiclesLoaded = 0;
for(i = 0; i < ARRAY_SIZE(ms_bIsPedFromPedGroupLoaded); i++)
ms_bIsPedFromPedGroupLoaded[i] = false;
ms_pExtraObjectsDir = new CDirectory(EXTRADIRSIZE);
ms_numPriorityRequests = 0;
ms_currentPedGrp = -1;
ms_lastCullZone = -1; // unused because RemoveModelsNotVisibleFromCullzone is gone
ms_loadedGangs = 0;
ms_currentPedLoading = 8; // unused, whatever it is
ms_currentPedLoading = NUMMODELSPERPEDGROUP; // unused, whatever it is
LoadCdDirectory();
@ -190,19 +199,11 @@ CStreaming::Init2(void)
ms_pStreamingBuffer[1] = ms_pStreamingBuffer[0] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
debug("Streaming buffer size is %d sectors", ms_streamingBufferSize);
// PC only, figure out how much memory we got
#ifdef GTA_PC
#define MB (1024*1024)
extern unsigned long _dwMemAvailPhys;
ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
if(ms_memoryAvailable < 50*MB)
ms_memoryAvailable = 50*MB;
desiredNumVehiclesLoaded = (ms_memoryAvailable/MB - 50)/3 + 12;
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
ms_memoryAvailable = 65*MB;
desiredNumVehiclesLoaded = 25;
debug("Memory allocated to Streaming is %dMB", ms_memoryAvailable/MB);
#undef MB
#endif
// find island LODs
@ -237,6 +238,7 @@ CStreaming::Init(void)
#endif
}
//--MIAMI: done
void
CStreaming::Shutdown(void)
{
@ -246,6 +248,7 @@ CStreaming::Shutdown(void)
delete ms_pExtraObjectsDir;
}
//--MIAMI: done
void
CStreaming::Update(void)
{
@ -272,7 +275,7 @@ CStreaming::Update(void)
!CCutsceneMgr::IsCutsceneProcessing() &&
ms_numModelsRequested < 5 &&
!CRenderer::m_loadingPriority &&
CGame::currArea == 0 &&
CGame::currArea == AREA_MAIN_MAP &&
!CReplay::IsPlayingBack()){
StreamVehiclesAndPeds();
StreamZoneModels(FindPlayerCoors());
@ -296,6 +299,7 @@ CStreaming::Update(void)
}
}
//--MIAMI: done
void
CStreaming::LoadCdDirectory(void)
{
@ -309,12 +313,6 @@ CStreaming::LoadCdDirectory(void)
ms_imageOffsets[3] = -1;
ms_imageOffsets[4] = -1;
ms_imageOffsets[5] = -1;
ms_imageOffsets[6] = -1;
ms_imageOffsets[7] = -1;
ms_imageOffsets[8] = -1;
ms_imageOffsets[9] = -1;
ms_imageOffsets[10] = -1;
ms_imageOffsets[11] = -1;
ms_imageSize = GetGTA3ImgSize();
// PS2 uses CFileMgr::GetCdFile on all IMG files to fill the array
#endif
@ -330,6 +328,7 @@ CStreaming::LoadCdDirectory(void)
ms_imageSize /= CDSTREAM_SECTOR_SIZE;
}
//--MIAMI: needs IFP
void
CStreaming::LoadCdDirectory(const char *dirname, int n)
{
@ -406,6 +405,22 @@ CStreaming::LoadCdDirectory(const char *dirname, int n)
CFileMgr::CloseFile(fd);
}
static char*
GetObjectName(int streamId)
{
static char objname[32];
if(streamId < STREAM_OFFSET_TXD)
sprintf(objname, "%s.dff", CModelInfo::GetModelInfo(streamId)->GetName());
else if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL)
sprintf(objname, "%s.txd", CTxdStore::GetTxdName(streamId-STREAM_OFFSET_TXD));
else if(streamId >= STREAM_OFFSET_COL && streamId < NUMSTREAMINFO)
sprintf(objname, "%s.col", CColStore::GetColName(streamId-STREAM_OFFSET_COL));
// TODO(MIAMI): IFP
return objname;
}
//--MIAMI: needs IFP
bool
CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
{
@ -444,6 +459,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
if(mi->IsSimple()){
success = CFileLoader::LoadAtomicFile(stream, streamId);
// TODO(MIAMI)? complain if file is not pre-instanced. we hardly are interested in that
} else if (mi->GetModelType() == MITYPE_VEHICLE) {
// load vehicles in two parts
CModelInfo::GetModelInfo(streamId)->AddRef();
@ -468,7 +484,6 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
}
}else if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL){
// Txd
assert(streamId < NUMSTREAMINFO);
if((ms_aInfoForModel[streamId].m_flags & STREAMFLAGS_KEEP_IN_MEMORY) == 0 &&
!IsTxdUsedByRequestedModels(streamId - STREAM_OFFSET_TXD)){
RemoveModel(streamId);
@ -518,12 +533,12 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
smi->m_alpha = 0;
}
if((ms_aInfoForModel[streamId].m_flags & STREAMFLAGS_CANT_REMOVE) == 0)
if(CanRemoveModel(streamId))
ms_aInfoForModel[streamId].AddToList(&ms_startLoadedList);
}
}else if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL){
// Txd
if((ms_aInfoForModel[streamId].m_flags & STREAMFLAGS_CANT_REMOVE) == 0)
if(CanRemoveModel(streamId))
ms_aInfoForModel[streamId].AddToList(&ms_startLoadedList);
// TODO(MIAMI): animations
}
@ -536,23 +551,13 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
endTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
timeDiff = endTime - startTime;
if(timeDiff > 5){
// TODO: is this inlined?
static char objname[32];
if(streamId < STREAM_OFFSET_TXD)
sprintf(objname, "%s.dff", CModelInfo::GetModelInfo(streamId)->GetName());
else if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL)
sprintf(objname, "%s.txd", CTxdStore::GetTxdName(streamId-STREAM_OFFSET_TXD));
else if(streamId >= STREAM_OFFSET_COL && streamId < NUMSTREAMINFO)
sprintf(objname, "%s.col", CColStore::GetColName(streamId-STREAM_OFFSET_COL));
// TODO(MIAMI): IFP
debug("%s took %d ms\n", objname, timeDiff);
}
if(timeDiff > 5)
debug("%s took %d ms\n", GetObjectName(streamId), timeDiff);
return true;
}
//--MIAMI: TODO: anim
bool
CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
{
@ -583,7 +588,8 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
success = AddToLoadedVehiclesList(streamId);
mi->RemoveRef();
CTxdStore::RemoveRefWithoutDelete(mi->GetTxdSlot());
}else{
// TODO(MIAMI): animation
}else if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL){
// Txd
CTxdStore::AddRef(streamId - STREAM_OFFSET_TXD);
success = CTxdStore::FinishLoadTxd(streamId - STREAM_OFFSET_TXD, stream);
@ -605,16 +611,13 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
endTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
timeDiff = endTime - startTime;
if(timeDiff > 5){
if(streamId < STREAM_OFFSET_TXD)
debug("finish model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetName(), timeDiff);
else
debug("finish txd %s took %d ms\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD), timeDiff);
}
if(timeDiff > 5)
debug("%s took %d ms\n", GetObjectName(streamId), timeDiff);
return true;
}
//--MIAMI: TODO: anim
void
CStreaming::RequestModel(int32 id, int32 flags)
{
@ -643,7 +646,7 @@ CStreaming::RequestModel(int32 id, int32 flags)
// reinsert into list
if(ms_aInfoForModel[id].m_next){
ms_aInfoForModel[id].RemoveFromList();
if((ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0)
if(CanRemoveModel(id))
ms_aInfoForModel[id].AddToList(&ms_startLoadedList);
}
}else if(ms_aInfoForModel[id].m_loadState == STREAMSTATE_NOTLOADED ||
@ -652,6 +655,7 @@ CStreaming::RequestModel(int32 id, int32 flags)
if(ms_aInfoForModel[id].m_loadState == STREAMSTATE_NOTLOADED){
if(id < STREAM_OFFSET_TXD)
RequestTxd(CModelInfo::GetModelInfo(id)->GetTxdSlot(), flags);
// TODO(MIAMI): animation
ms_aInfoForModel[id].AddToList(&ms_startRequestedList);
ms_numModelsRequested++;
if(flags & STREAMFLAGS_PRIORITY)
@ -665,6 +669,7 @@ CStreaming::RequestModel(int32 id, int32 flags)
#define BIGBUILDINGFLAGS STREAMFLAGS_DONT_REMOVE
//--MIAMI: done
void
CStreaming::RequestBigBuildings(eLevelName level)
{
@ -681,6 +686,7 @@ CStreaming::RequestBigBuildings(eLevelName level)
RequestIslands(level);
}
//--MIAMI: done
void
CStreaming::RequestBigBuildings(eLevelName level, const CVector &pos)
{
@ -700,6 +706,7 @@ CStreaming::RequestBigBuildings(eLevelName level, const CVector &pos)
RequestIslands(level);
}
//--MIAMI: done
void
CStreaming::InstanceBigBuildings(eLevelName level, const CVector &pos)
{
@ -716,6 +723,8 @@ CStreaming::InstanceBigBuildings(eLevelName level, const CVector &pos)
}
}
// TODO(MIAMI): InstanceLoadedModels
//--MIAMI: done
void
CStreaming::RequestIslands(eLevelName level)
@ -732,6 +741,7 @@ CStreaming::RequestIslands(eLevelName level)
}
}
//--MIAMI: TODO
void
CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flags)
{
@ -773,24 +783,28 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
RequestModel(modelId, flags);
}
//--MIAMI: done
void
CStreaming::RequestSpecialChar(int32 charId, const char *modelName, int32 flags)
{
RequestSpecialModel(charId + MI_SPECIAL01, modelName, flags);
}
//--MIAMI: done
bool
CStreaming::HasSpecialCharLoaded(int32 id)
{
return HasModelLoaded(id + MI_SPECIAL01);
}
//--MIAMI: done
void
CStreaming::SetMissionDoesntRequireSpecialChar(int32 id)
{
return SetMissionDoesntRequireModel(id + MI_SPECIAL01);
}
//--MIAMI: done
void
CStreaming::DecrementRef(int32 id)
{
@ -801,6 +815,7 @@ CStreaming::DecrementRef(int32 id)
}
}
//--MIAMI: TODO: animation
void
CStreaming::RemoveModel(int32 id)
{
@ -929,6 +944,7 @@ CStreaming::RemoveUnusedBigBuildings(eLevelName level)
RemoveIslandsNotUsed(level);
}
//--MIAMI: done
void
DeleteIsland(CEntity *island)
{
@ -942,6 +958,7 @@ DeleteIsland(CEntity *island)
}
}
//--MIAMI: done
void
CStreaming::RemoveIslandsNotUsed(eLevelName level)
{
@ -999,8 +1016,7 @@ CStreaming::RemoveLoadedVehicle(void)
if(ms_lastVehicleDeleted == MAXVEHICLESLOADED)
ms_lastVehicleDeleted = 0;
id = ms_vehiclesLoaded[ms_lastVehicleDeleted];
if(id != -1 &&
(ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0 &&
if(id != -1 && CanRemoveModel(id) && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0 &&
ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED)
goto found;
}
@ -1009,33 +1025,39 @@ found:
RemoveModel(ms_vehiclesLoaded[ms_lastVehicleDeleted]);
ms_numVehiclesLoaded--;
ms_vehiclesLoaded[ms_lastVehicleDeleted] = -1;
// TODO(MIAMI): CCarCtrl::RemoveFromLoadedVehicleArray
return true;
}
//--MIAMI: TODO: anim
bool
CStreaming::RemoveLeastUsedModel(void)
CStreaming::RemoveLeastUsedModel(uint32 excludeMask)
{
CStreamingInfo *si;
int streamId;
for(si = ms_endLoadedList.m_prev; si != &ms_startLoadedList; si = si->m_prev){
if(si->m_flags & excludeMask)
continue;
streamId = si - ms_aInfoForModel;
if(streamId < STREAM_OFFSET_TXD){
if (CModelInfo::GetModelInfo(streamId)->GetNumRefs() == 0) {
RemoveModel(streamId);
return true;
}
}else{
}else if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL){
if(CTxdStore::GetNumRefs(streamId - STREAM_OFFSET_TXD) == 0 &&
!IsTxdUsedByRequestedModels(streamId - STREAM_OFFSET_TXD)){
RemoveModel(streamId);
return true;
}
// TODO(MIAMI): IFP
}
}
return ms_numVehiclesLoaded > 7 && RemoveLoadedVehicle();
return (ms_numVehiclesLoaded > 7 || CGame::currArea != AREA_MAIN_MAP && ms_numVehiclesLoaded > 4) && RemoveLoadedVehicle();
}
//--MIAMI: done
void
CStreaming::RemoveAllUnusedModels(void)
{
@ -1046,7 +1068,6 @@ CStreaming::RemoveAllUnusedModels(void)
for(i = NUM_DEFAULT_MODELS; i < MODELINFOSIZE; i++){
if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED &&
ms_aInfoForModel[i].m_flags & STREAMFLAGS_DONT_REMOVE &&
CModelInfo::GetModelInfo(i)->GetNumRefs() == 0) {
RemoveModel(i);
ms_aInfoForModel[i].m_loadState = STREAMSTATE_NOTLOADED;
@ -1054,30 +1075,14 @@ CStreaming::RemoveAllUnusedModels(void)
}
}
bool
CStreaming::RemoveReferencedTxds(int32 mem)
{
CStreamingInfo *si;
int streamId;
for(si = ms_endLoadedList.m_prev; si != &ms_startLoadedList; si = si->m_prev){
streamId = si - ms_aInfoForModel;
if(streamId >= STREAM_OFFSET_TXD &&
CTxdStore::GetNumRefs(streamId-STREAM_OFFSET_TXD) == 0){
RemoveModel(streamId);
if(ms_memoryUsed < mem)
return true;
}
}
return false;
}
//--MIAMI: done
void
CStreaming::RemoveUnusedModelsInLoadedList(void)
{
// empty
}
//--MIAMI: done, but strangely not found in mobile?
bool
CStreaming::IsTxdUsedByRequestedModels(int32 txdId)
{
@ -1137,8 +1142,8 @@ CStreaming::AddToLoadedVehiclesList(int32 modelId)
// find vehicle we can remove
for(i = 0; i < MAXVEHICLESLOADED; i++){
id = ms_vehiclesLoaded[ms_lastVehicleDeleted];
if(id != -1 &&
(ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0)
if(id != -1 && CanRemoveModel(id) &&
CModelInfo::GetModelInfo(id)->GetNumRefs() == 0)
goto found;
ms_lastVehicleDeleted++;
if(ms_lastVehicleDeleted == MAXVEHICLESLOADED)
@ -1190,6 +1195,7 @@ CStreaming::SetModelTxdIsDeletable(int32 id)
SetModelIsDeletable(CModelInfo::GetModelInfo(id)->GetTxdSlot() + STREAM_OFFSET_TXD);
}
//--MIAMI: done
void
CStreaming::SetMissionDoesntRequireModel(int32 id)
{
@ -1566,13 +1572,15 @@ CStreaming::RequestModelStream(int32 ch)
imgOffset = GetCdImageOffset(lastPosn);
streamId = GetNextFileOnCd(lastPosn - imgOffset, true);
if(streamId == -1)
return;
// remove Txds that aren't requested anymore
while(streamId >= STREAM_OFFSET_TXD){
if(ms_aInfoForModel[streamId].m_flags & STREAMFLAGS_KEEP_IN_MEMORY ||
IsTxdUsedByRequestedModels(streamId - STREAM_OFFSET_TXD))
// remove Txds and Anims that aren't requested anymore
while(streamId != -1){
if(ms_aInfoForModel[streamId].m_flags & STREAMFLAGS_KEEP_IN_MEMORY)
break;
if(streamId >= STREAM_OFFSET_TXD && streamId < STREAM_OFFSET_COL){
if(IsTxdUsedByRequestedModels(streamId - STREAM_OFFSET_TXD))
break;
// TODO(MIAMI): anims
}else
break;
RemoveModel(streamId);
// so try next file
@ -1610,6 +1618,7 @@ CStreaming::RequestModelStream(int32 ch)
if (havePed && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_PED ||
haveBigFile && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_VEHICLE ||
!TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot()))
// TODO(MIAMI): anims
break;
}else{
if(haveBigFile && size > 200)
@ -1656,6 +1665,7 @@ CStreaming::RequestModelStream(int32 ch)
ms_channel[ch].numTries = 0;
}
//--MIAMI: done
// Load data previously read from disc
bool
CStreaming::ProcessLoadingChannel(int32 ch)
@ -1690,10 +1700,10 @@ CStreaming::ProcessLoadingChannel(int32 ch)
if(id < STREAM_OFFSET_TXD && CModelInfo::GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
ms_numVehiclesLoaded >= desiredNumVehiclesLoaded &&
!RemoveLoadedVehicle() &&
((ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 || GetAvailableVehicleSlot() == -1)){
(CanRemoveModel(id) || GetAvailableVehicleSlot() == -1)){
// can't load vehicle
RemoveModel(id);
if(ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE)
if(!CanRemoveModel(id))
ReRequestModel(id);
else if(CTxdStore::GetNumRefs(CModelInfo::GetModelInfo(id)->GetTxdSlot()) == 0)
RemoveTxd(CModelInfo::GetModelInfo(id)->GetTxdSlot());
@ -1725,6 +1735,7 @@ CStreaming::ProcessLoadingChannel(int32 ch)
return true;
}
//--MIAMI: done
void
CStreaming::RetryLoadFile(int32 ch)
{
@ -1761,6 +1772,7 @@ CStreaming::RetryLoadFile(int32 ch)
}
}
//--MIAMI: done
void
CStreaming::LoadRequestedModels(void)
{
@ -1785,6 +1797,7 @@ CStreaming::LoadRequestedModels(void)
}
}
//--MIAMI: done
void
CStreaming::LoadAllRequestedModels(bool priority)
{
@ -1838,6 +1851,7 @@ CStreaming::LoadAllRequestedModels(bool priority)
bInsideLoadAll = false;
}
//--MIAMI: done
void
CStreaming::FlushChannels(void)
{
@ -1859,6 +1873,7 @@ CStreaming::FlushChannels(void)
ProcessLoadingChannel(1);
}
//--MIAMI: done
void
CStreaming::FlushRequestList(void)
{
@ -2228,9 +2243,6 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
}
}
if(RemoveReferencedTxds(mem))
return;
// As last resort, delete objects from the last step more aggressively
for(y = ymin; y <= ymax; y++){
for(x = xmax; x != xmin; x -= inc){
@ -2292,9 +2304,6 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
}
}
if(RemoveReferencedTxds(mem))
return;
// As last resort, delete objects from the last step more aggressively
for(x = xmin; x <= xmax; x++){
for(y = ymax; y != ymin; y -= inc){
@ -2393,7 +2402,7 @@ CStreaming::MakeSpaceFor(int32 size)
// but it's not nice....
while((uint32)ms_memoryUsed >= ms_memoryAvailable - size)
if(!RemoveLeastUsedModel()){
if(!RemoveLeastUsedModel(STREAMFLAGS_20)){
DeleteRwObjectsBehindCamera(ms_memoryAvailable - size);
return;
}

View File

@ -94,6 +94,7 @@ public:
static int32 ms_numVehiclesLoaded;
static int32 ms_vehiclesLoaded[MAXVEHICLESLOADED];
static int32 ms_lastVehicleDeleted;
static bool ms_bIsPedFromPedGroupLoaded[NUMMODELSPERPEDGROUP];
static CDirectory *ms_pExtraObjectsDir;
static int32 ms_numPriorityRequests;
static int32 ms_currentPedGrp;
@ -145,7 +146,7 @@ public:
static void RemoveIslandsNotUsed(eLevelName level);
static void RemoveBigBuildings(eLevelName level);
static bool RemoveLoadedVehicle(void);
static bool RemoveLeastUsedModel(void);
static bool RemoveLeastUsedModel(uint32 excludeMask);
static void RemoveAllUnusedModels(void);
static void RemoveUnusedModelsInLoadedList(void);
static bool RemoveReferencedTxds(int32 mem);

View File

@ -3,14 +3,14 @@
enum Config {
NUMPLAYERS = 1,
NUMCDIMAGES = 12, // gta3.img duplicates (not used on PC)
NUMCDIMAGES = 6, // gta3.img duplicates (not used on PC)
MAX_CDIMAGES = 8, // additional cdimages
MAX_CDCHANNELS = 5,
MODELINFOSIZE = 6500,
TXDSTORESIZE = 1385,
COLSTORESIZE = 31,
EXTRADIRSIZE = 128,
EXTRADIRSIZE = 256,
CUTSCENEDIRSIZE = 512,
SIMPLEMODELSIZE = 5000, // only 3885 in VC???
@ -106,7 +106,7 @@ enum Config {
NUMPEDROUTES = 200,
NUMPHONES = 50,
NUMPEDGROUPS = 31,
NUMMODELSPERPEDGROUP = 8,
NUMMODELSPERPEDGROUP = 8, // TODO(MIAMI): 16 once we have peds
NUMSHOTINFOS = 100,
NUMROADBLOCKS = 300,

View File

@ -6,14 +6,16 @@
enum ModelInfoType : uint8
{
MITYPE_NA = 0,
MITYPE_SIMPLE = 1,
MITYPE_MLO = 2,
MITYPE_TIME = 3,
MITYPE_CLUMP = 4,
MITYPE_VEHICLE = 5,
MITYPE_PED = 6,
MITYPE_XTRACOMPS = 7,
MITYPE_NA,
MITYPE_SIMPLE,
MITYPE_MLO, // unused but still in enum
MITYPE_TIME,
MITYPE_WEAPON,
MITYPE_CLUMP,
MITYPE_VEHICLE,
MITYPE_PED,
MITYPE_XTRACOMPS, // unused but still in enum
MITYPE_HAND // xbox and mobile
};
static_assert(sizeof(ModelInfoType) == 1, "ModeInfoType: error");
@ -43,10 +45,9 @@ public:
// one day it becomes virtual
ModelInfoType GetModelType() const { return m_type; }
bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; }
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE ||
m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck
}
bool IsBuilding(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; }
bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME || m_type == MITYPE_WEAPON; }
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE; }
char *GetName(void) { return m_name; }
void SetName(const char *name) { strncpy(m_name, name, 24); }
void SetColModel(CColModel *col, bool owns = false){

View File

@ -357,7 +357,7 @@ enum
MI_AIRTRAIN_VLO = 198,
MI_LOPOLYGUY,
NUM_DEFAULT_MODELS
NUM_DEFAULT_MODELS = 300 // MIAMI
};
enum{
@ -373,7 +373,7 @@ inline bool
IsGlass(int16 id)
{
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id);
return mi->IsSimple() && (mi->m_isCodeGlass || mi->m_isArtistGlass);
return mi->IsBuilding() && (mi->m_isCodeGlass || mi->m_isArtistGlass);
}
inline bool