- fix matrix in DrawSmashable_sprites

This commit is contained in:
Ilya Shurumov 2020-05-06 10:20:21 +06:00
parent 607da2dd0c
commit a75e53d385
2 changed files with 16 additions and 20 deletions

View File

@ -1516,32 +1516,30 @@ extern _pct plotContext;
void DrawSmashable_sprites(void) void DrawSmashable_sprites(void)
{ {
//undefined4 uVar1; //undefined4 uVar1;
int iVar2;
char *pcVar3;
DAMAGED_OBJECT *dam; DAMAGED_OBJECT *dam;
MODEL *model; MODEL *model;
int iVar4; int count;
VECTOR pos; VECTOR pos;
MATRIX object_matrix; MATRIX object_matrix;
MATRIX spritematrix; MATRIX spritematrix;
dam = damaged_object; dam = damaged_object;
iVar4 = 7; count = 7;
do { do {
if (dam->active != 0) if (dam->active != 0)
{ {
model = modelpointers[dam->cop.type]; model = modelpointers[dam->cop.type];
object_matrix.m[0][0] = 0x1000; object_matrix.m[0][0] = 0x1000;
object_matrix.m[1][0] = 0;
object_matrix.m[2][0] = 0;
object_matrix.m[0][1] = 0; object_matrix.m[0][1] = 0;
object_matrix.m[1][1] = 0x1000;
object_matrix.m[2][1] = 0;
object_matrix.m[0][2] = 0; object_matrix.m[0][2] = 0;
object_matrix.m[1][0] = 0;
object_matrix.m[1][1] = 0x1000;
object_matrix.m[1][2] = 0; object_matrix.m[1][2] = 0;
object_matrix.m[2][0] = 0;
object_matrix.m[2][1] = 0;
object_matrix.m[2][2] = 0x1000; object_matrix.m[2][2] = 0x1000;
if ((model->shape_flags & 0x4000) == 0) if ((model->shape_flags & 0x4000) == 0)
@ -1550,8 +1548,8 @@ void DrawSmashable_sprites(void)
RotMatrixZ(dam->rot_speed * dam->damage & 0xfff, &object_matrix); RotMatrixZ(dam->rot_speed * dam->damage & 0xfff, &object_matrix);
pos.vx = dam->vx - camera_position.vx; pos.vx = dam->vx - camera_position.vx;
pos.vy = (dam->cop).pos.vy - camera_position.vy; pos.vy = dam->cop.pos.vy - camera_position.vy;
pos.vz = (dam->cop).pos.vz - camera_position.vz; pos.vz = dam->cop.pos.vz - camera_position.vz;
Apply_Inv_CameraMatrix(&pos); Apply_Inv_CameraMatrix(&pos);
@ -1559,14 +1557,12 @@ void DrawSmashable_sprites(void)
gte_SetTransVector(&pos); gte_SetTransVector(&pos);
pos.vx = dam->vx; pos.vx = dam->vx;
pos.vy = (dam->cop).pos.vy; pos.vy = dam->cop.pos.vy;
pos.vz = (dam->cop).pos.vz; pos.vz = dam->cop.pos.vz;
SetFrustrumMatrix(); SetFrustrumMatrix();
iVar2 = FrustrumCheck(&pos, model->bounding_sphere); if (FrustrumCheck(&pos, model->bounding_sphere) != -1)
if (iVar2 != -1)
{ {
if ((model->shape_flags & 0x4000) == 0) if ((model->shape_flags & 0x4000) == 0)
{ {
@ -1591,9 +1587,9 @@ void DrawSmashable_sprites(void)
} }
} }
} }
iVar4--; count--;
dam++; dam++;
} while (-1 < iVar4); } while (-1 < count);
} }

View File

@ -2619,7 +2619,7 @@ int DrawAllBuildings(CELL_OBJECT **objects, int num_buildings, DB *disp)
void RenderModel(MODEL *model, MATRIX *matrix, VECTOR *pos, int zBias, int flags) void RenderModel(MODEL *model, MATRIX *matrix, VECTOR *pos, int zBias, int flags)
{ {
OTTYPE *savedOT = current->ot; OTTYPE *savedOT = current->ot;
if (matrix != NULL) if (matrix != NULL)
{ {
MATRIX comb; MATRIX comb;