mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-23 02:42:38 +01:00
- optimize memory usage on cell object pointers
This commit is contained in:
parent
f5ca7b325a
commit
5985ee7f95
@ -21,6 +21,8 @@ extern int pvs_square;
|
||||
extern int pvs_square_sq;
|
||||
extern int PolySizes[56];
|
||||
|
||||
extern void* model_object_ptrs[192];
|
||||
|
||||
extern int combointensity;
|
||||
|
||||
extern int gForceLowDetailCars;
|
||||
|
@ -912,13 +912,10 @@ void GameInit(void)
|
||||
|
||||
if (NewLevel != 0)
|
||||
{
|
||||
MALLOC_BEGIN();
|
||||
char* mem = D_MALLOC(1024);
|
||||
coplist = (CELL_OBJECT**)mem;
|
||||
|
||||
pcoplist = (PACKED_CELL_OBJECT**)D_MALLOC(1024 + 256);
|
||||
//transparent_buffer = D_MALLOC(256); // [A] unused
|
||||
MALLOC_END();
|
||||
// alloc pointer list
|
||||
// [A] use model_object_ptrs for this since it is only used for drawing purposes
|
||||
coplist = (CELL_OBJECT**)(model_object_ptrs);
|
||||
pcoplist = (PACKED_CELL_OBJECT**)(model_object_ptrs + 96);
|
||||
}
|
||||
|
||||
if (NoPlayerControl == 0)
|
||||
|
@ -920,12 +920,9 @@ void CollisionCopList(XZPAIR *pos, int *count)
|
||||
do {
|
||||
j = 0;
|
||||
|
||||
i++;
|
||||
cell.z = initial.z;
|
||||
|
||||
do {
|
||||
j++;
|
||||
|
||||
// [A] FIXME: replace with 'cell_header.region_size'
|
||||
if ((cell.x / 32) + (cell.z / 32) * (cells_across / 32) == RoadMapRegions[((cell.x / 32) & 1) + ((cell.z / 32) & 1) * 2])
|
||||
{
|
||||
@ -934,21 +931,24 @@ void CollisionCopList(XZPAIR *pos, int *count)
|
||||
|
||||
while (cop != NULL)
|
||||
{
|
||||
cop->pad = *count;
|
||||
|
||||
coplist[*count] = cop;
|
||||
cop->pad = *(unsigned char *)count;
|
||||
pcoplist[*count] = ci.ppco;
|
||||
|
||||
ppco = GetNextPackedCop(&ci);
|
||||
cop = UnpackCellObject(ppco, &ci.nearCell);
|
||||
|
||||
*count = *count + 1;
|
||||
(*count)++;
|
||||
}
|
||||
}
|
||||
|
||||
cell.z++;
|
||||
j++;
|
||||
} while (j < 2);
|
||||
|
||||
cell.x++;
|
||||
i++;
|
||||
} while (i < 2);
|
||||
}
|
||||
else
|
||||
@ -1090,8 +1090,10 @@ void CheckScenaryCollisions(_CAR_DATA *cp)
|
||||
mdcount = 0;
|
||||
Havana3DOcclusion(BuildCollisionCopList, &mdcount);
|
||||
|
||||
printInfo("Coll: %d\n", mdcount);
|
||||
|
||||
x1 = 0;
|
||||
if (0 < mdcount + event_models_active)
|
||||
if (mdcount + event_models_active > 0)
|
||||
{
|
||||
do {
|
||||
if (x1 < mdcount)
|
||||
@ -1297,6 +1299,8 @@ int QuickBuildingCollisionCheck(VECTOR *pPos, int dir, int l, int w, int extra)
|
||||
Havana3DOcclusion(BuildCollisionCopList, &mdcount);
|
||||
iVar4 = 0;
|
||||
|
||||
printInfo("Coll: %d\n", mdcount);
|
||||
|
||||
if (0 < mdcount + event_models_active)
|
||||
{
|
||||
bVar1 = 0 < mdcount;
|
||||
|
Loading…
Reference in New Issue
Block a user