- replace VECTOR by SVECTOR in rndrasm

This commit is contained in:
InspirationByte 2022-02-03 20:55:13 +03:00
parent 1f59ac4d0f
commit f025b9003e
2 changed files with 17 additions and 29 deletions

View File

@ -34,15 +34,13 @@ int Apply_InvCameraMatrixSetTrans(VECTOR_NOPAD* pos)
{
VECTOR vfc;
VECTOR vec;
VECTOR local;
SVECTOR local;
gte_stfc(&vfc);
local.vx = (pos->vx - vfc.vx) << 0x10 >> 0x10;
local.vy = (pos->vy - vfc.vy) << 0x10 >> 0x10;
local.vz = (pos->vz - vfc.vz) << 0x10 >> 0x10;
VecSubtract(&local, pos, &vfc);
#ifdef PSX
gte_ldlvl(&local);
gte_ldsv(&local);
gte_lcir();
gte_stlvl(&vec);
#else
@ -67,15 +65,13 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
{
VECTOR vfc;
VECTOR vec;
VECTOR local;
SVECTOR local;
gte_stfc(&vfc);
local.vx = (pos->vx - vfc.vx) << 0x10 >> 0x10;
local.vy = (pos->vy - vfc.vy) << 0x10 >> 0x10;
local.vz = (pos->vz - vfc.vz) << 0x10 >> 0x10;
VecSubtract(&local, pos, &vfc);
#ifdef PSX
gte_ldlvl(&local);
gte_ldsv(&local);
gte_lcir();
gte_stlvl(&vec);
#else
@ -92,8 +88,6 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
gte_SetRotMatrix(mtx);
gte_SetTransVector(&vec);
if (vec.vx >> 1 < 0)
return vec.vz - vec.vx;
@ -103,19 +97,16 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
// [D] [T]
int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere)
{
VECTOR local;
local.vx = (pcop->pos.vx - camera_position.vx) << 0x10 >> 0x11;
local.vy = (pcop->pos.vy - camera_position.vy) << 0x10 >> 0x11;
local.vz = (pcop->pos.vz - camera_position.vz) << 0x10 >> 0x11;
gte_ldlvl(&local);
VECTOR result;
SVECTOR local;
VecSubtract(&local, &pcop->pos, &camera_position);
gte_ldsv(&local);
gte_llir();
VECTOR result;
gte_stlvnl(&result);
int ang = frustrum_matrix.t[0] - (bounding_sphere >> 1);
int ang = frustrum_matrix.t[0] - bounding_sphere;
if (ang <= result.vx && ang <= result.vy && ang <= result.vz)
return 0;
@ -126,19 +117,16 @@ int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere)
// [D] [T]
int FrustrumCheck(VECTOR* pos, int bounding_sphere)
{
VECTOR local;
local.vx = (pos->vx - camera_position.vx) << 0x10 >> 0x11;
local.vy = (pos->vy - camera_position.vy) << 0x10 >> 0x11;
local.vz = (pos->vz - camera_position.vz) << 0x10 >> 0x11;
gte_ldlvl(&local);
VECTOR result;
SVECTOR local;
VecSubtract(&local, pos, &camera_position);
gte_ldsv(&local);
gte_llir();
VECTOR result;
gte_stlvnl(&result);
int ang = frustrum_matrix.t[0] - (bounding_sphere >> 1);
int ang = frustrum_matrix.t[0] - bounding_sphere;
if (ang <= result.vx && ang <= result.vy && ang <= result.vz)
return 0;

@ -1 +1 @@
Subproject commit fab132785aa0202123c0654d1217ef966d6b07aa
Subproject commit 0b460ed59990bac5ec5dff726b6e86dacd684254