Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
small streaming fixes
  • Loading branch information
aap committed Aug 20, 2020
1 parent 73dd29e commit dace79c7c351d77e83afa3f77a9c34763f9292f1
Showing with 17 additions and 16 deletions.
  1. +17 −16 src/core/Streaming.cpp
@@ -273,8 +273,12 @@ CStreaming::Shutdown(void)
{ {
RwFreeAlign(ms_pStreamingBuffer[0]); RwFreeAlign(ms_pStreamingBuffer[0]);
ms_streamingBufferSize = 0; ms_streamingBufferSize = 0;
if(ms_pExtraObjectsDir) if(ms_pExtraObjectsDir){
delete ms_pExtraObjectsDir; delete ms_pExtraObjectsDir;
#ifdef FIX_BUGS
ms_pExtraObjectsDir = nil;
#endif
}
} }


void void
@@ -1191,7 +1195,7 @@ CStreaming::AddToLoadedVehiclesList(int32 modelId)
if(id == -1) if(id == -1)
return false; // still no luck return false; // still no luck
ms_lastVehicleDeleted = id; ms_lastVehicleDeleted = id;
// this is more that we wanted actually // this is more than we wanted actually
ms_numVehiclesLoaded++; ms_numVehiclesLoaded++;
}else }else
RemoveModel(id); RemoveModel(id);
@@ -1384,18 +1388,17 @@ CStreaming::StreamZoneModels(const CVector &pos)
// unload pevious group // unload pevious group
if(ms_currentPedGrp != -1) if(ms_currentPedGrp != -1)
for(i = 0; i < NUMMODELSPERPEDGROUP; i++){ for(i = 0; i < NUMMODELSPERPEDGROUP; i++){
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1) if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1){
break; SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]); SetModelTxdIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
SetModelTxdIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]); }
} }


ms_currentPedGrp = info.pedGroup; ms_currentPedGrp = info.pedGroup;


for(i = 0; i < NUMMODELSPERPEDGROUP; i++){ for(i = 0; i < NUMMODELSPERPEDGROUP; i++){
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1) if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1)
break; RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE);
RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE);
} }
} }
RequestModel(MI_MALE01, STREAMFLAGS_DONT_REMOVE); RequestModel(MI_MALE01, STREAMFLAGS_DONT_REMOVE);
@@ -1593,8 +1596,6 @@ CStreaming::GetNextFileOnCd(int32 lastPosn, bool priority)
* Files larger than the buffer size can only be loaded by channel 0, * Files larger than the buffer size can only be loaded by channel 0,
* which then uses both buffers, while channel 1 is idle. * which then uses both buffers, while channel 1 is idle.
* ms_bLoadingBigModel is set to true to indicate this state. * ms_bLoadingBigModel is set to true to indicate this state.
*
* TODO: two-part files
*/ */


// Make channel read from disc // Make channel read from disc
@@ -1935,7 +1936,7 @@ CStreaming::UpdateMemoryUsed(void)
// empty // empty
} }


#define STREAM_DIST (2*SECTOR_SIZE_X) #define STREAM_DIST 80.0f


void void
CStreaming::AddModelsToRequestList(const CVector &pos) CStreaming::AddModelsToRequestList(const CVector &pos)
@@ -2232,7 +2233,7 @@ CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
assert(ymin <= ymax); assert(ymin <= ymax);


// Delete a block of sectors that we know is behind the camera // Delete a block of sectors that we know is behind the camera
if(TheCamera.GetForward().x > 0){ if(TheCamera.GetForward().x > 0.0f){
// looking east // looking east
xmax = Max(ix - 2, 0); xmax = Max(ix - 2, 0);
xmin = Max(ix - 10, 0); xmin = Max(ix - 10, 0);
@@ -2254,7 +2255,7 @@ CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
} }


// Now a block that intersects with the camera's frustum // Now a block that intersects with the camera's frustum
if(TheCamera.GetForward().x > 0){ if(TheCamera.GetForward().x > 0.0f){
// looking east // looking east
xmax = Max(ix + 10, 0); xmax = Max(ix + 10, 0);
xmin = Max(ix - 2, 0); xmin = Max(ix - 2, 0);
@@ -2296,7 +2297,7 @@ CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
assert(xmin <= xmax); assert(xmin <= xmax);


// Delete a block of sectors that we know is behind the camera // Delete a block of sectors that we know is behind the camera
if(TheCamera.GetForward().y > 0){ if(TheCamera.GetForward().y > 0.0f){
// looking north // looking north
ymax = Max(iy - 2, 0); ymax = Max(iy - 2, 0);
ymin = Max(iy - 10, 0); ymin = Max(iy - 10, 0);
@@ -2318,7 +2319,7 @@ CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
} }


// Now a block that intersects with the camera's frustum // Now a block that intersects with the camera's frustum
if(TheCamera.GetForward().y > 0){ if(TheCamera.GetForward().y > 0.0f){
// looking north // looking north
ymax = Max(iy + 10, 0); ymax = Max(iy + 10, 0);
ymin = Max(iy - 2, 0); ymin = Max(iy - 2, 0);

0 comments on commit dace79c

Please sign in to comment.