@@ -34,15 +34,13 @@ int Apply_InvCameraMatrixSetTrans(VECTOR_NOPAD* pos)
3434{
3535 VECTOR vfc ;
3636 VECTOR vec ;
37- VECTOR local ;
37+ SVECTOR local ;
3838 gte_stfc (& vfc );
3939
40- local .vx = (pos -> vx - vfc .vx ) << 0x10 >> 0x10 ;
41- local .vy = (pos -> vy - vfc .vy ) << 0x10 >> 0x10 ;
42- local .vz = (pos -> vz - vfc .vz ) << 0x10 >> 0x10 ;
40+ VecSubtract (& local , pos , & vfc );
4341
4442#ifdef PSX
45- gte_ldlvl (& local );
43+ gte_ldsv (& local );
4644 gte_lcir ();
4745 gte_stlvl (& vec );
4846#else
@@ -67,15 +65,13 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
6765{
6866 VECTOR vfc ;
6967 VECTOR vec ;
70- VECTOR local ;
68+ SVECTOR local ;
7169 gte_stfc (& vfc );
7270
73- local .vx = (pos -> vx - vfc .vx ) << 0x10 >> 0x10 ;
74- local .vy = (pos -> vy - vfc .vy ) << 0x10 >> 0x10 ;
75- local .vz = (pos -> vz - vfc .vz ) << 0x10 >> 0x10 ;
71+ VecSubtract (& local , pos , & vfc );
7672
7773#ifdef PSX
78- gte_ldlvl (& local );
74+ gte_ldsv (& local );
7975 gte_lcir ();
8076 gte_stlvl (& vec );
8177#else
@@ -92,8 +88,6 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
9288 gte_SetRotMatrix (mtx );
9389 gte_SetTransVector (& vec );
9490
95-
96-
9791 if (vec .vx >> 1 < 0 )
9892 return vec .vz - vec .vx ;
9993
@@ -103,19 +97,16 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx)
10397// [D] [T]
10498int FrustrumCheck16 (PACKED_CELL_OBJECT * pcop , int bounding_sphere )
10599{
106- VECTOR local ;
107- local .vx = (pcop -> pos .vx - camera_position .vx ) << 0x10 >> 0x11 ;
108- local .vy = (pcop -> pos .vy - camera_position .vy ) << 0x10 >> 0x11 ;
109- local .vz = (pcop -> pos .vz - camera_position .vz ) << 0x10 >> 0x11 ;
110-
111- gte_ldlvl (& local );
100+ VECTOR result ;
101+ SVECTOR local ;
102+ VecSubtract (& local , & pcop -> pos , & camera_position );
112103
104+ gte_ldsv (& local );
113105 gte_llir ();
114106
115- VECTOR result ;
116107 gte_stlvnl (& result );
117108
118- int ang = frustrum_matrix .t [0 ] - ( bounding_sphere >> 1 ) ;
109+ int ang = frustrum_matrix .t [0 ] - bounding_sphere ;
119110
120111 if (ang <= result .vx && ang <= result .vy && ang <= result .vz )
121112 return 0 ;
@@ -126,19 +117,16 @@ int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere)
126117// [D] [T]
127118int FrustrumCheck (VECTOR * pos , int bounding_sphere )
128119{
129- VECTOR local ;
130- local .vx = (pos -> vx - camera_position .vx ) << 0x10 >> 0x11 ;
131- local .vy = (pos -> vy - camera_position .vy ) << 0x10 >> 0x11 ;
132- local .vz = (pos -> vz - camera_position .vz ) << 0x10 >> 0x11 ;
133-
134- gte_ldlvl (& local );
120+ VECTOR result ;
121+ SVECTOR local ;
122+ VecSubtract (& local , pos , & camera_position );
135123
124+ gte_ldsv (& local );
136125 gte_llir ();
137126
138- VECTOR result ;
139127 gte_stlvnl (& result );
140128
141- int ang = frustrum_matrix .t [0 ] - ( bounding_sphere >> 1 ) ;
129+ int ang = frustrum_matrix .t [0 ] - bounding_sphere ;
142130
143131 if (ang <= result .vx && ang <= result .vy && ang <= result .vz )
144132 return 0 ;
0 commit comments