small streaming fixes

This commit is contained in:
aap 2020-08-20 23:45:05 +02:00
parent 73dd29ea3a
commit dace79c7c3

View File

@ -273,8 +273,12 @@ CStreaming::Shutdown(void)
{
RwFreeAlign(ms_pStreamingBuffer[0]);
ms_streamingBufferSize = 0;
if(ms_pExtraObjectsDir)
if(ms_pExtraObjectsDir){
delete ms_pExtraObjectsDir;
#ifdef FIX_BUGS
ms_pExtraObjectsDir = nil;
#endif
}
}
void
@ -1191,7 +1195,7 @@ found:
if(id == -1)
return false; // still no luck
ms_lastVehicleDeleted = id;
// this is more that we wanted actually
// this is more than we wanted actually
ms_numVehiclesLoaded++;
}else
RemoveModel(id);
@ -1384,18 +1388,17 @@ CStreaming::StreamZoneModels(const CVector &pos)
// unload pevious group
if(ms_currentPedGrp != -1)
for(i = 0; i < NUMMODELSPERPEDGROUP; i++){
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
break;
SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
SetModelTxdIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1){
SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
SetModelTxdIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
}
}
ms_currentPedGrp = info.pedGroup;
for(i = 0; i < NUMMODELSPERPEDGROUP; i++){
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
break;
RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE);
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1)
RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], 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,
* which then uses both buffers, while channel 1 is idle.
* ms_bLoadingBigModel is set to true to indicate this state.
*
* TODO: two-part files
*/
// Make channel read from disc
@ -1935,7 +1936,7 @@ CStreaming::UpdateMemoryUsed(void)
// empty
}
#define STREAM_DIST (2*SECTOR_SIZE_X)
#define STREAM_DIST 80.0f
void
CStreaming::AddModelsToRequestList(const CVector &pos)
@ -2232,7 +2233,7 @@ CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
assert(ymin <= ymax);
// 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
xmax = Max(ix - 2, 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
if(TheCamera.GetForward().x > 0){
if(TheCamera.GetForward().x > 0.0f){
// looking east
xmax = Max(ix + 10, 0);
xmin = Max(ix - 2, 0);
@ -2296,7 +2297,7 @@ CStreaming::DeleteRwObjectsBehindCamera(size_t mem)
assert(xmin <= xmax);
// 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
ymax = Max(iy - 2, 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
if(TheCamera.GetForward().y > 0){
if(TheCamera.GetForward().y > 0.0f){
// looking north
ymax = Max(iy + 10, 0);
ymin = Max(iy - 2, 0);