mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 02:12:43 +01:00
- misc code changes
This commit is contained in:
parent
fdc9782530
commit
fd5ed926ab
@ -264,7 +264,7 @@ int CheckUnpackNewRegions(void)
|
||||
}
|
||||
else if (32 - force_load_boundary < current_barrel_region_xcell)
|
||||
{
|
||||
if (region_x < cells_across >> 5)
|
||||
if (region_x < regions_across)
|
||||
{
|
||||
leftright_unpack = 2;
|
||||
num_regions_to_unpack = 1;
|
||||
@ -295,8 +295,6 @@ int CheckUnpackNewRegions(void)
|
||||
{
|
||||
if (topbottom_unpack == 1)
|
||||
{
|
||||
num_regions_to_unpack = 3;
|
||||
|
||||
if (leftright_unpack == 1)
|
||||
{
|
||||
regions_to_unpack[2].xoffset = -1;
|
||||
@ -447,7 +445,16 @@ void InitMap(void)
|
||||
}
|
||||
|
||||
// load regions synchronously
|
||||
if (doSpooling == 0)
|
||||
if (doSpooling)
|
||||
{
|
||||
regions_unpacked[0] = -1;
|
||||
regions_unpacked[1] = -1;
|
||||
regions_unpacked[2] = -1;
|
||||
regions_unpacked[3] = -1;
|
||||
|
||||
ControlMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
old_region = -1;
|
||||
|
||||
@ -458,8 +465,8 @@ void InitMap(void)
|
||||
multiplayerregions[3] = multiplayerregions[2] + 1;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
region_to_unpack = multiplayerregions[i];
|
||||
|
||||
if (spoolinfo_offsets[region_to_unpack] != 0xffff)
|
||||
@ -469,13 +476,12 @@ void InitMap(void)
|
||||
if (spoolptr->super_region != 0xff)
|
||||
initarea = spoolptr->super_region;
|
||||
|
||||
barrel_region = (region_to_unpack % (cells_across >> 5) & 1U) + (region_to_unpack / (cells_across >> 5) & 1U) * 2;
|
||||
barrel_region = (region_to_unpack % regions_across & 1U) +
|
||||
(region_to_unpack / regions_across & 1U) * 2;
|
||||
|
||||
UnpackRegion(region_to_unpack, barrel_region);
|
||||
}
|
||||
|
||||
i++;
|
||||
} while (i < 4);
|
||||
}
|
||||
|
||||
LoadInAreaTSets(initarea);
|
||||
LoadInAreaModels(initarea);
|
||||
@ -485,25 +491,13 @@ void InitMap(void)
|
||||
|
||||
StartSpooling();
|
||||
}
|
||||
else
|
||||
{
|
||||
regions_unpacked[0] = -1;
|
||||
regions_unpacked[1] = -1;
|
||||
regions_unpacked[2] = -1;
|
||||
regions_unpacked[3] = -1;
|
||||
|
||||
ControlMap();
|
||||
}
|
||||
}
|
||||
|
||||
// [D] [T] [A]
|
||||
void GetVisSetAtPosition(VECTOR *pos, char *tgt, int *ccx, int *ccz)
|
||||
{
|
||||
int cz;
|
||||
int cx;
|
||||
|
||||
int rz;
|
||||
int rx;
|
||||
int cx, cz;
|
||||
int rx, rz;
|
||||
|
||||
cx = (pos->vx + units_across_halved) / MAP_CELL_SIZE;
|
||||
cz = (pos->vz + units_down_halved) / MAP_CELL_SIZE;
|
||||
@ -524,8 +518,6 @@ void GetVisSetAtPosition(VECTOR *pos, char *tgt, int *ccx, int *ccz)
|
||||
tgt);
|
||||
}
|
||||
|
||||
unsigned char nybblearray[512] = { 0 };
|
||||
|
||||
char* PVS_Buffers[4] = { 0 };
|
||||
int pvsSize[4] = { 0, 0, 0, 0 };
|
||||
unsigned char *PVSEncodeTable = NULL;
|
||||
@ -533,6 +525,7 @@ unsigned char *PVSEncodeTable = NULL;
|
||||
// [D] [T]
|
||||
void PVSDecode(char *output, char *celldata, ushort sz, int havanaCorruptCellBodge)
|
||||
{
|
||||
u_char nybblearray[256];
|
||||
int pixelIndex;
|
||||
u_char* decodebuf;
|
||||
u_char* op;
|
||||
@ -620,8 +613,8 @@ void PVSDecode(char *output, char *celldata, ushort sz, int havanaCorruptCellBod
|
||||
|
||||
size = pvs_square - 1;
|
||||
op = (decodebuf - 2) + (size * pvs_square + pvs_square);
|
||||
i = size;
|
||||
|
||||
i = size;
|
||||
while (i >= 0)
|
||||
{
|
||||
j = pvs_square-2;
|
||||
@ -683,20 +676,18 @@ void GetPVSRegionCell2(int source_region, int region, int cell, char *output)
|
||||
PVSEncodeTable = (unsigned char *)(bp + 0x802);
|
||||
tbp = bp + cell * 2;
|
||||
|
||||
length = M_SHRT_2((unsigned char)tbp[2], (unsigned char)tbp[3]) - M_SHRT_2((unsigned char)tbp[0], (unsigned char)tbp[1]) & 0xffff;
|
||||
length = M_SHRT_2((u_char)tbp[2], (u_char)tbp[3]) - M_SHRT_2((u_char)tbp[0], (u_char)tbp[1]) & 0xffff;
|
||||
|
||||
if (length == 0)
|
||||
if (length != 0)
|
||||
{
|
||||
for (k = 0; k < pvs_square_sq; k++)
|
||||
output[k] = 1;
|
||||
havanaCorruptCellBodge = (regions_unpacked[source_region] == 158 && cell == 168);
|
||||
|
||||
PVSDecode(output, bp + M_SHRT_2((u_char)tbp[0], (u_char)tbp[1]), length, havanaCorruptCellBodge);
|
||||
}
|
||||
else
|
||||
{
|
||||
havanaCorruptCellBodge = 0;
|
||||
if (regions_unpacked[source_region] == 158 && cell == 168)
|
||||
havanaCorruptCellBodge = (GameLevel == 1);
|
||||
|
||||
PVSDecode(output, bp + M_SHRT_2((unsigned char)tbp[0], (unsigned char)tbp[1]), length, havanaCorruptCellBodge);
|
||||
for (k = 0; k < pvs_square_sq; k++)
|
||||
output[k] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -163,7 +163,7 @@ int check_regions_present(void)
|
||||
{
|
||||
regions_to_unpack[0].xoffset = 1;
|
||||
|
||||
if (region_x < (cells_across >> 5))
|
||||
if (region_x < regions_across)
|
||||
{
|
||||
leftright_unpack = 2;
|
||||
num_regions_to_unpack = 1;
|
||||
@ -222,7 +222,7 @@ int check_regions_present(void)
|
||||
x = regions_to_unpack[retval].xoffset;
|
||||
z = regions_to_unpack[retval].zoffset;
|
||||
|
||||
region_to_unpack = current_region + x + z * (cells_across >> 5);
|
||||
region_to_unpack = current_region + x + z * regions_across;
|
||||
|
||||
if (loading_region[(region_x + x & 1U) + (region_z + z & 1U) * 2] != -1 &&
|
||||
spoolinfo_offsets[region_to_unpack] != 0xffff &&
|
||||
|
Loading…
Reference in New Issue
Block a user