- correct model/shape flags

This commit is contained in:
Ilya Shurumov 2021-05-10 00:56:18 +06:00 committed by InspirationByte
parent 620e32e391
commit ce8c27f56b
8 changed files with 57 additions and 79 deletions

View File

@ -868,7 +868,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,
damage_object(cop, &velocity);
// smash object
if ((model->shape_flags & SHAPE_FLAG_SMASH_QUIET) == 0)
if ((model->shape_flags & SHAPE_FLAG_TRANS) == 0)
{
sip = smashable;
match = sip;

View File

@ -984,7 +984,7 @@ void DrawSmashable_sprites(void)
object_matrix.m[2][1] = 0;
object_matrix.m[2][2] = ONE;
if ((model->shape_flags & SHAPE_FLAG_SMASH_SPRITE) == 0)
if ((model->shape_flags & SHAPE_FLAG_SPRITE) == 0)
RotMatrixY(dam->rot_speed * dam->damage * 3 & 0xfff, &object_matrix);
RotMatrixZ(dam->rot_speed * dam->damage & 0xfff, &object_matrix);
@ -1006,7 +1006,7 @@ void DrawSmashable_sprites(void)
if (FrustrumCheck(&pos, model->bounding_sphere) != -1)
{
if (model->shape_flags & SHAPE_FLAG_SMASH_SPRITE)
if (model->shape_flags & SHAPE_FLAG_SPRITE)
{
UNIMPLEMENTED();
@ -3633,7 +3633,7 @@ void AddRainDrops(void)
{
ROADS_GetRouteData(rt->position.vx, rt->position.vz, &routeData);
if (modelpointers[routeData.type]->flags2 & MODEL_FLAG_HASROOF)
if (modelpointers[routeData.type]->flags2 & MODEL_FLAG_INDOORS)
break;
}
*/

View File

@ -1156,7 +1156,7 @@ void ControlReplay(void)
/*
ROADS_GetRouteData(player[0].cameraPos.vx, player[0].cameraPos.vz, &routeData1);
if (modelpointers[routeData1.type]->flags2 & MODEL_FLAG_HASROOF)
if (modelpointers[routeData1.type]->flags2 & MODEL_FLAG_INDOORS)
{
int road_height;
road_height = -450 - MapHeight(&player[0].cameraPos);
@ -1291,7 +1291,7 @@ void ControlReplay(void)
/*
ROADS_GetRouteData(player[0].cameraPos.vx, player[0].cameraPos.vz, &routeData);
if ((modelpointers[routeData.type]->flags2 & MODEL_FLAG_HASROOF) && player[0].cameraPos.vy < height - 450)
if ((modelpointers[routeData.type]->flags2 & MODEL_FLAG_INDOORS) && player[0].cameraPos.vy < height - 450)
{
player[0].cameraPos.vy = height - 450;
}*/

View File

@ -1416,7 +1416,7 @@ void DrawMapPSX(int* comp_val)
if (FrustrumCheck16(ppco, model->bounding_sphere) != -1)
{
// sprity type
if (model->shape_flags & SHAPE_FLAG_SMASH_SPRITE)
if (model->shape_flags & SHAPE_FLAG_SPRITE)
{
if (drawData.sprites_found < MAX_DRAWN_SPRITES)
spriteList[drawData.sprites_found++] = ppco;
@ -1468,8 +1468,8 @@ void DrawMapPSX(int* comp_val)
}
}
if ((model->shape_flags & (SHAPE_FLAG_SUBSURFACE | SHAPE_FLAG_ALLEYWAY)) ||
(model->flags2 & (MODEL_FLAG_SIDEWALK | MODEL_FLAG_GRASS)))
if ((model->shape_flags & (SHAPE_FLAG_WATER | SHAPE_FLAG_TILE)) ||
(model->flags2 & (MODEL_FLAG_PATH | MODEL_FLAG_GRASS)))
{
if (model->flags2 & MODEL_FLAG_ALLEY)
{

View File

@ -49,7 +49,7 @@ char CellEmpty(VECTOR *pPosition, int radius)
pModel = modelpointers[type];
if ((uint)pModel->collision_block > 0 &&
(pModel->flags2 & (MODEL_FLAG_NOCOL_200 | MODEL_FLAG_SMASHABLE)) == 0)
(pModel->flags2 & (MODEL_FLAG_CHAIR | MODEL_FLAG_SMASHABLE)) == 0)
{
QuickUnpackCellObject(ppco, &ci.nearCell, &tempCO);
@ -385,7 +385,7 @@ char lineClear(VECTOR *v1, VECTOR *v2)
sphere_sq = pModel->bounding_sphere + 800;
if ((uint)pModel->collision_block > 0 &&
(pModel->flags2 & (MODEL_FLAG_NOCOL_200 | MODEL_FLAG_SMASHABLE)) == 0 &&
(pModel->flags2 & (MODEL_FLAG_CHAIR | MODEL_FLAG_SMASHABLE)) == 0 &&
(xd*xd + zd*zd < sphere_sq*sphere_sq))
{
num_cb = *(int*)pModel->collision_block;
@ -733,7 +733,7 @@ void CheckScenaryCollisions(CAR_DATA *cp)
}
else if (cp->controlType == CONTROL_TYPE_CAMERACOLLIDER)
{
if ((model->flags2 & (MODEL_FLAG_NOCOL_200 | MODEL_FLAG_SMASHABLE)) == 0 &&
if ((model->flags2 & (MODEL_FLAG_CHAIR | MODEL_FLAG_SMASHABLE)) == 0 &&
(bbox.xsize > 100 || (bbox.zsize > 100)))
{
coll_test_count = 5;

View File

@ -24,7 +24,7 @@ void Tile1x1(MODEL *model)
polys = (PL_POLYFT4*)model->poly_block;
// grass should be under pavements and other things
if ((model->shape_flags & SHAPE_FLAG_SUBSURFACE) || (model->flags2 & 0x4000))
if ((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & 0x4000))
ofse = 229;
else
ofse = 133;
@ -416,7 +416,7 @@ void TileNxN(MODEL *model, int levels, int Dofse)
tileTypes = *(u_int *)(model + 1) >> 2;
// grass should be under pavements and other things
if((model->shape_flags & SHAPE_FLAG_SUBSURFACE) || (model->flags2 & 0x4000))
if((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & 0x4000))
ofse = 229;
else
ofse = 133;

View File

@ -22,6 +22,9 @@ extern short rcossin_tbl[8192];
#define RSIN(a) rcossin_tbl[(a & 0xFFFU) * 2]
#define RCOS(a) rcossin_tbl[(a & 0xFFFU) * 2 + 1]
#define DIFF_ANGLES( A, B ) \
(((((B) - (A)) + 2048) & 4095) - 2048)
// Remap a value in the range [A,B] to [C,D].
#define RemapVal( val, A, B, C, D) \
(C + (D - C) * (val - A) / (B - A))

View File

@ -345,44 +345,55 @@ struct OUT_CELL_FILE_HEADER
};
//---------------------------------------------------------------------------------------
// TODO: MODELS.H
// TODO: MDL.H
enum ModelShapeFlags
{
SHAPE_FLAG_SMASH_QUIET = 0x8,
SHAPE_FLAG_LITPOLY = 0x1,
SHAPE_FLAG_BSPDATA = 0x2,
SHAPE_FLAG_TRANS = 0x8,
SHAPE_FLAG_NOCOLLIDE = 0x10,
SHAPE_FLAG_SUBSURFACE = 0x80, // grass, dirt, water
SHAPE_FLAG_ALLEYWAY = 0x400, // alleyway
SHAPE_FLAG_SMASH_SPRITE = 0x4000,
SHAPE_FLAG_WATER = 0x80, // model is water
SHAPE_FLAG_AMBIENT2 = 0x100, // Ambient sound 2 associated - maybe used in D1
SHAPE_FLAG_AMBIENT1 = 0x200, // Ambient sound 1 associated - maybe used in D1
SHAPE_FLAG_TILE = 0x400, // treat as road
SHAPE_FLAG_SHADOW = 0x800, // D1 leftover flag
SHAPE_FLAG_ALPHA = 0x1000, // alpha tested object
SHAPE_FLAG_ROAD = 0x2000, // section of road
SHAPE_FLAG_SPRITE = 0x4000,
};
enum ModelFlags2
{
MODEL_FLAG_ANIMOBJ = 0x1,
MODEL_FLAG_MEDIAN = 0x20,
MODEL_FLAG_ALLEY = 0x80,
MODEL_FLAG_HASROOF = 0x100,
MODEL_FLAG_NOCOL_200 = 0x200,
MODEL_FLAG_ANIMOBJ = 0x1, // CUSTOM FLAG!
MODEL_FLAG_MEDIAN = 0x20, // Hmmmm...
MODEL_FLAG_JUNC = 0x40,
MODEL_FLAG_ALLEY = 0x80, // alley tile
MODEL_FLAG_INDOORS = 0x100,
MODEL_FLAG_CHAIR = 0x200,
MODEL_FLAG_BARRIER = 0x400,
MODEL_FLAG_SMASHABLE = 0x800,
MODEL_FLAG_LAMP = 0x1000,
MODEL_FLAG_TREE = 0x2000,
MODEL_FLAG_GRASS = 0x4000,
MODEL_FLAG_SIDEWALK = 0x8000,
MODEL_FLAG_PATH = 0x8000,
};
#define COLLISION_BOX 0
#define COLLISION_CYLINDER 1
#define COLLISION_CONE 2
#define COLLISION_SPHERE 3
#define COLLISION_INDOORS 4
struct COLLISION_PACKET
{
short type;
short xpos;
short ypos;
short zpos;
short xpos, ypos, zpos;
short flags;
short yang;
short empty;
short xsize;
short ysize;
short zsize;
short xsize, ysize, zsize;
};
struct POLYFT4
@ -391,14 +402,8 @@ struct POLYFT4
u_char texture_set;
u_char texture_id;
u_char spare;
u_char v0;
u_char v1;
u_char v2;
u_char v3;
UV_INFO uv0;
UV_INFO uv1;
UV_INFO uv2;
UV_INFO uv3;
u_char v0, v1, v2, v3;
UV_INFO uv0, uv1, uv2, uv3;
RGB color;
};
@ -408,18 +413,9 @@ struct POLYGT4
u_char texture_set;
u_char texture_id;
u_char spare;
u_char v0;
u_char v1;
u_char v2;
u_char v3;
u_char n0;
u_char n1;
u_char n2;
u_char n3;
UV_INFO uv0;
UV_INFO uv1;
UV_INFO uv2;
UV_INFO uv3;
u_char v0, v1, v2, v3;
u_char n0, n1, n2, n3;
UV_INFO uv0, uv1, uv2, uv3;
RGB color;
};
@ -429,14 +425,8 @@ struct PL_POLYFT4
u_char texture_set;
u_char texture_id;
u_char th;
u_char v0;
u_char v1;
u_char v2;
u_char v3;
UV_INFO uv0;
UV_INFO uv1;
UV_INFO uv2;
UV_INFO uv3;
u_char v0, v1, v2, v3;
UV_INFO uv0, uv1, uv2, uv3;
};
@ -446,14 +436,8 @@ struct POLYFT3
u_char texture_set;
u_char texture_id;
u_char spare;
u_char v0;
u_char v1;
u_char v2;
u_char pad;
UV_INFO uv0;
UV_INFO uv1;
UV_INFO uv2;
UV_INFO pad2;
u_char v0, v1, v2, pad;
UV_INFO uv0, uv1, uv2, pad2;
RGB color;
};
@ -463,18 +447,9 @@ struct POLYGT3
u_char texture_set;
u_char texture_id;
u_char spare;
u_char v0;
u_char v1;
u_char v2;
u_char pad;
u_char n0;
u_char n1;
u_char n2;
u_char pad2;
UV_INFO uv0;
UV_INFO uv1;
UV_INFO uv2;
UV_INFO pad3;
u_char v0, v1, v2, pad;
u_char n0, n1, n2, pad2;
UV_INFO uv0, uv1, uv2, pad3;
RGB color;
};