mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-25 03:42:34 +01:00
- added InitMatrix macro
This commit is contained in:
parent
7fcb416a78
commit
685bf1a636
@ -60,17 +60,7 @@ void DrawThrownBombs(void)
|
||||
{
|
||||
if ((bomb->flags & 1) != 0)
|
||||
{
|
||||
object_matrix.m[0][0] = 0x1000;
|
||||
object_matrix.m[0][1] = 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[2][0] = 0;
|
||||
object_matrix.m[2][1] = 0;
|
||||
object_matrix.m[2][2] = 0x1000;
|
||||
InitMatrix(object_matrix);
|
||||
|
||||
RotMatrixY(bomb->rot_speed * bomb->active * 3 & 0xfff, &object_matrix);
|
||||
RotMatrixZ(bomb->rot_speed * bomb->active & 0xfff, &object_matrix);
|
||||
|
@ -6,17 +6,7 @@
|
||||
// [D] [T]
|
||||
void Calc_Object_MatrixYZX(MATRIX *mat, SVECTOR *angles)
|
||||
{
|
||||
mat->m[0][0] = ONE;
|
||||
mat->m[0][1] = 0;
|
||||
mat->m[0][2] = 0;
|
||||
|
||||
mat->m[1][0] = 0;
|
||||
mat->m[1][1] = ONE;
|
||||
mat->m[1][2] = 0;
|
||||
|
||||
mat->m[2][0] = 0;
|
||||
mat->m[2][1] = 0;
|
||||
mat->m[2][2] = ONE;
|
||||
InitMatrix(*mat);
|
||||
|
||||
RotMatrixX(angles->vx, mat);
|
||||
RotMatrixZ(angles->vz, mat);
|
||||
|
@ -1064,17 +1064,7 @@ void DrawSmashable_sprites(void)
|
||||
{
|
||||
model = modelpointers[dam->cop.type];
|
||||
|
||||
object_matrix.m[0][0] = ONE;
|
||||
object_matrix.m[0][1] = 0;
|
||||
object_matrix.m[0][2] = 0;
|
||||
|
||||
object_matrix.m[1][0] = 0;
|
||||
object_matrix.m[1][1] = ONE;
|
||||
object_matrix.m[1][2] = 0;
|
||||
|
||||
object_matrix.m[2][0] = 0;
|
||||
object_matrix.m[2][1] = 0;
|
||||
object_matrix.m[2][2] = ONE;
|
||||
InitMatrix(object_matrix);
|
||||
|
||||
if ((model->shape_flags & SHAPE_FLAG_SPRITE) == 0)
|
||||
RotMatrixY(dam->rot_speed * dam->damage * 3 & 0xfff, &object_matrix);
|
||||
|
@ -342,17 +342,7 @@ void MoveHubcap()
|
||||
MATRIX Orientation;
|
||||
CVECTOR col = {72,72,72};
|
||||
|
||||
Orientation.m[0][0] = ONE;
|
||||
Orientation.m[0][1] = 0;
|
||||
Orientation.m[0][2] = 0;
|
||||
|
||||
Orientation.m[1][0] = 0;
|
||||
Orientation.m[1][1] = ONE;
|
||||
Orientation.m[1][2] = 0;
|
||||
|
||||
Orientation.m[2][0] = 0;
|
||||
Orientation.m[2][1] = 0;
|
||||
Orientation.m[2][2] = ONE;
|
||||
InitMatrix(Orientation);
|
||||
|
||||
if (pauseflag == 0)
|
||||
{
|
||||
|
@ -461,10 +461,7 @@ void CalcObjectRotationMatrices(void)
|
||||
// simpler and faster method
|
||||
m = (MATRIX*)&matrixtable[i];
|
||||
|
||||
m->m[0][0] = ONE; m->m[0][1] = 0; m->m[0][2] = 0;
|
||||
m->m[1][0] = 0; m->m[1][1] = ONE; m->m[1][2] = 0;
|
||||
m->m[2][0] = 0; m->m[2][1] = 0; m->m[2][2] = ONE;
|
||||
|
||||
InitMatrix(*m);
|
||||
RotMatrixY(angle, m);
|
||||
|
||||
angle += 64;
|
||||
|
@ -227,17 +227,8 @@ void DrawCone(VECTOR *position, int cone)
|
||||
|
||||
if (PositionVisible(position) == 0 || FrustrumCheck(position, gTrailblazerConeModel->bounding_sphere) == -1)
|
||||
return;
|
||||
|
||||
matrix.m[0][0] = ONE;
|
||||
matrix.m[1][1] = ONE;
|
||||
matrix.m[2][2] = ONE;
|
||||
matrix.m[1][0] = 0;
|
||||
matrix.m[2][0] = 0;
|
||||
matrix.m[0][1] = 0;
|
||||
matrix.m[2][1] = 0;
|
||||
matrix.m[0][2] = 0;
|
||||
matrix.m[1][2] = 0;
|
||||
|
||||
|
||||
InitMatrix(matrix);
|
||||
_RotMatrixY(&matrix, gTrailblazerData[cone].rot);
|
||||
|
||||
pos.vx = position->vx - camera_position.vx;
|
||||
@ -256,15 +247,7 @@ void DrawSmashedCone(SMASHED_CONE *sc, VECTOR *wpos)
|
||||
MATRIX object_matrix;
|
||||
VECTOR pos;
|
||||
|
||||
object_matrix.m[1][0] = 0;
|
||||
object_matrix.m[2][0] = 0;
|
||||
object_matrix.m[0][1] = 0;
|
||||
object_matrix.m[2][1] = 0;
|
||||
object_matrix.m[0][2] = 0;
|
||||
object_matrix.m[1][2] = 0;
|
||||
object_matrix.m[0][0] = ONE;
|
||||
object_matrix.m[1][1] = ONE;
|
||||
object_matrix.m[2][2] = ONE;
|
||||
InitMatrix(object_matrix);
|
||||
|
||||
RotMatrixY(sc->rot_speed * sc->active * 3 & 0xfff, &object_matrix);
|
||||
RotMatrixZ(sc->rot_speed * sc->active & 0xfff, &object_matrix);
|
||||
|
@ -1488,17 +1488,7 @@ void SetCamera(EVENT* ev)
|
||||
{
|
||||
camera_position = eventCamera.position;
|
||||
|
||||
matrix.m[0][0] = ONE;
|
||||
matrix.m[1][0] = 0;
|
||||
matrix.m[2][0] = 0;
|
||||
|
||||
matrix.m[0][1] = 0;
|
||||
matrix.m[1][1] = ONE;
|
||||
matrix.m[2][1] = 0;
|
||||
|
||||
matrix.m[0][2] = 0;
|
||||
matrix.m[1][2] = 0;
|
||||
matrix.m[2][2] = ONE;
|
||||
InitMatrix(matrix);
|
||||
|
||||
if (axis == 0x10)
|
||||
{
|
||||
@ -2680,15 +2670,7 @@ void DrawRotor(VECTOR pos, MATRIX* matrix)
|
||||
{0,0,0},
|
||||
};
|
||||
|
||||
localMat.m[0][0] = ONE;
|
||||
localMat.m[1][0] = 0;
|
||||
localMat.m[2][0] = 0;
|
||||
localMat.m[0][1] = 0;
|
||||
localMat.m[1][1] = ONE;
|
||||
localMat.m[2][1] = 0;
|
||||
localMat.m[0][2] = 0;
|
||||
localMat.m[1][2] = 0;
|
||||
localMat.m[2][2] = ONE;
|
||||
InitMatrix(localMat);
|
||||
|
||||
pos.vx -= camera_position.vx;
|
||||
pos.vy -= camera_position.vy;
|
||||
|
@ -1084,9 +1084,11 @@ void DrawOverheadMap(void)
|
||||
CAR_DATA *cp;
|
||||
DR_AREA *drarea;
|
||||
int intens;
|
||||
|
||||
SVECTOR MapMesh[5][5];
|
||||
VECTOR MapMeshO[5][5];
|
||||
MAPTEX MapTex[4];
|
||||
|
||||
SVECTOR direction;
|
||||
RECT16 clipped_size;
|
||||
VECTOR vec;
|
||||
@ -1295,7 +1297,6 @@ void DrawOverheadMap(void)
|
||||
// make grid coordinates
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
|
||||
MapMesh[0][i].vx = -44;
|
||||
MapMesh[i][0].vz = -44;
|
||||
|
||||
@ -1331,15 +1332,15 @@ void DrawOverheadMap(void)
|
||||
direction.vz = 0;
|
||||
direction.vy = player[0].dir & 0xfff;
|
||||
|
||||
RotMatrixXYZ(&map_matrix, &direction);
|
||||
MulMatrix0(&identity, &map_matrix, &map_matrix);
|
||||
InitMatrix(map_matrix);
|
||||
_RotMatrixY(&map_matrix, player[0].dir & 0xfff);
|
||||
|
||||
gte_SetRotMatrix(&map_matrix);
|
||||
gte_SetTransVector(&translate);
|
||||
|
||||
MeshWidth = x_mod ? 4 : 3;
|
||||
MeshHeight = y_mod ? 4 : 3;
|
||||
|
||||
|
||||
// transform the map mesh
|
||||
for (i = 0; i <= MeshWidth; i++)
|
||||
{
|
||||
@ -1379,7 +1380,7 @@ void DrawOverheadMap(void)
|
||||
|
||||
spt->clut = MapClut;
|
||||
spt->tpage = MapTPage;
|
||||
|
||||
|
||||
spt->x0 = MapMeshO[j][i].vx;
|
||||
spt->y0 = MapMeshO[j][i].vz;
|
||||
|
||||
@ -1462,19 +1463,15 @@ void DrawOverheadMap(void)
|
||||
void SetFullscreenMapMatrix(void)
|
||||
{
|
||||
VECTOR translate = { 160, 0, 128 };
|
||||
SVECTOR direction;
|
||||
|
||||
direction.vx = 0;
|
||||
int direction;
|
||||
|
||||
if (gUseRotatedMap == 0)
|
||||
direction.vy = 0;
|
||||
direction = 0;
|
||||
else
|
||||
direction.vy = player[0].dir & 0xfff;
|
||||
direction = player[0].dir & 0xfff;
|
||||
|
||||
direction.vz = 0;
|
||||
|
||||
RotMatrixXYZ(&map_matrix, &direction); // Why, Reflections? Why? You could have used RotMatrixY
|
||||
MulMatrix0(&identity, &map_matrix, &map_matrix);
|
||||
InitMatrix(map_matrix);
|
||||
_RotMatrixY(&map_matrix, direction);
|
||||
|
||||
gte_SetRotMatrix(&map_matrix);
|
||||
gte_SetTransVector(&translate);
|
||||
|
@ -86,6 +86,19 @@ extern short rcossin_tbl[8192];
|
||||
(vecLeft)->vz *= (vecRight)->vz; \
|
||||
}
|
||||
|
||||
#define InitMatrix(_m) \
|
||||
{ \
|
||||
(_m).m[0][0] = ONE; \
|
||||
(_m).m[1][0] = 0; \
|
||||
(_m).m[2][0] = 0; \
|
||||
(_m).m[0][1] = 0; \
|
||||
(_m).m[1][1] = ONE; \
|
||||
(_m).m[2][1] = 0; \
|
||||
(_m).m[0][2] = 0; \
|
||||
(_m).m[1][2] = 0; \
|
||||
(_m).m[2][2] = ONE; \
|
||||
}
|
||||
|
||||
#define numberOf(sexToys) (sizeof(sexToys) / sizeof(sexToys[0]))
|
||||
|
||||
#ifndef MIN
|
||||
|
Loading…
Reference in New Issue
Block a user