- complete TileNxN, Tile1x1

This commit is contained in:
Ilya Shurumov 2020-10-19 13:22:41 +06:00
parent 65d5972c03
commit 91c9f40be3

View File

@ -85,6 +85,7 @@ void Tile1x1(MODEL *model)
{ {
int opz; int opz;
int Z; int Z;
int ofse;
PL_POLYFT4* polys; PL_POLYFT4* polys;
int i; int i;
u_char ptype; u_char ptype;
@ -94,6 +95,12 @@ void Tile1x1(MODEL *model)
srcVerts = (SVECTOR*)model->vertices; srcVerts = (SVECTOR*)model->vertices;
polys = (PL_POLYFT4*)model->poly_block; polys = (PL_POLYFT4*)model->poly_block;
// grass should be under pavements and other things
if ((model->shape_flags & 0x80) || (model->flags2 & 0x4000))
ofse = 229;
else
ofse = 133;
i = model->num_polys; i = model->num_polys;
while (i > 0) while (i > 0)
{ {
@ -136,7 +143,7 @@ void Tile1x1(MODEL *model)
*(ushort*)&prims->u2 = *(ushort*)&polys->uv3; *(ushort*)&prims->u2 = *(ushort*)&polys->uv3;
*(ushort*)&prims->u3 = *(ushort*)&polys->uv2; *(ushort*)&prims->u3 = *(ushort*)&polys->uv2;
addPrim(plotContext.ot + (Z >> 1) + 133, prims); addPrim(plotContext.ot + (Z >> 1) + ofse, prims);
plotContext.primptr += sizeof(POLY_FT4); plotContext.primptr += sizeof(POLY_FT4);
} }
@ -223,7 +230,7 @@ void Tile1x1(MODEL *model)
/* end block 4 */ /* end block 4 */
// End Line: 464 // End Line: 464
// [D] // [D] [T]
void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
{ {
PACKED_CELL_OBJECT *ppco; PACKED_CELL_OBJECT *ppco;
@ -241,9 +248,7 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
} }
else if (gTimeOfDay == 3) else if (gTimeOfDay == 3)
{ {
plotContext.colour = ((int)((uint)combointensity >> 0x10 & 0xff) / 3) * 0x10000 | plotContext.colour = ((combointensity >> 16 & 0xFF) / 3) << 16 | ((combointensity >> 8 & 0xFF) / 3) << 8 | (combointensity & 0xFF) / 3 | 0x2c000000U;
((int)((uint)combointensity >> 8 & 0xff) / 3) * 0x100 |
(int)(combointensity & 0xffU) / 3 | 0x2c000000U;
} }
} }
@ -290,12 +295,12 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount)
previous_matrix = yang; previous_matrix = yang;
} }
if (Z < 7001) if (Z <= 7000)
{ {
if (Low2HighDetailTable[model_number] != 0xffff) if (Low2HighDetailTable[model_number] != 0xffff)
model_number = Low2HighDetailTable[model_number]; model_number = Low2HighDetailTable[model_number];
if (Z < 2000) if (Z < 2000)
TileNxN(modelpointers[model_number], 4, 75); TileNxN(modelpointers[model_number], 4, 75);
else else
TileNxN(modelpointers[model_number], 2, 35); TileNxN(modelpointers[model_number], 2, 35);
@ -898,7 +903,7 @@ void SubdivNxM(char *polys, ulong n, ulong m, int ofse)
/* end block 3 */ /* end block 3 */
// End Line: 1571 // End Line: 1571
// [D] // [D] [T]
void TileNxN(MODEL *model, int levels, int Dofse) void TileNxN(MODEL *model, int levels, int Dofse)
{ {
uint ttype; uint ttype;
@ -908,23 +913,19 @@ void TileNxN(MODEL *model, int levels, int Dofse)
int ofse; int ofse;
ttype = 0; ttype = 0;
ofse = 133;
polys = (unsigned char *)model->poly_block; polys = (unsigned char *)model->poly_block;
plotContext.verts = (SVECTOR *)model->vertices; plotContext.verts = (SVECTOR *)model->vertices;
plotContext.polySizes = PolySizes; plotContext.polySizes = PolySizes;
// tile types comes right after model header it seems
tileTypes = *(uint *)(model + 1) >> 2; tileTypes = *(uint *)(model + 1) >> 2;
// [A] // grass should be under pavements and other things
if ((*(uint *)model & 0x40000080) != 0) if((model->shape_flags & 0x80) || (model->flags2 & 0x4000))
{
// probably these are checked
//(model->shape_flags & 0x80);
//(model->flags2 & 0x4000);
ofse = 229; ofse = 229;
} else
ofse = 133;
i = 0; i = 0;