From 5680c7293e56ac39deddb53fcab09f84544e4d48 Mon Sep 17 00:00:00 2001 From: Prakxo Date: Thu, 15 Jun 2023 16:48:36 +0200 Subject: [PATCH] fix fakematch --- include/m_lib.h | 2 +- include/sys_matrix.h | 2 +- rel/m_lib.c | 10 +++++----- rel/sys_matrix.c | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/m_lib.h b/include/m_lib.h index 39b8171a..64da89c4 100644 --- a/include/m_lib.h +++ b/include/m_lib.h @@ -91,7 +91,7 @@ extern void none_proc2(ACTOR* actor, GAME* game); extern int _Game_play_isPause(GAME_PLAY* play); extern f32 check_percent_abs(f32 x, f32 min, f32 max, f32 scale, int shift_by_min); extern f32 get_percent_forAccelBrake(const f32 now, const f32 start, const f32 end, const f32 accelerateDist, const f32 brakeDist); -extern void Game_play_Projection_Trans(GAME_PLAY* const play, MtxF* matrix, xyz_t* screen_pos); +extern void Game_play_Projection_Trans(GAME_PLAY* const play, xyz_t* world_pos, xyz_t* screen_pos); extern f32 get_percent(const int max, const int min, const int x); diff --git a/include/sys_matrix.h b/include/sys_matrix.h index 29562139..0e68ece9 100644 --- a/include/sys_matrix.h +++ b/include/sys_matrix.h @@ -31,7 +31,7 @@ extern void Matrix_softcv3_load(s_xyz* src, f32 x, f32 y, f32 z); extern Mtx* _MtxF_to_Mtx(MtxF* src, Mtx* dest); extern Mtx* _Matrix_to_Mtx(Mtx* dest); extern Mtx* _Matrix_to_Mtx_new(GRAPH* graph); -extern void Matrix_Position(MtxF* matrix, xyz_t* screen_pos); +extern void Matrix_Position(xyz_t* old_pos, xyz_t* new_pos); extern void Matrix_Position_Zero(xyz_t* screen_pos); extern void Matrix_Position_VecX(xyz_t* screen_pos, f32 x); extern void Matrix_Position_VecZ(xyz_t* screen_pos, f32 x); diff --git a/rel/m_lib.c b/rel/m_lib.c index 4e42eab5..b4ea57ac 100644 --- a/rel/m_lib.c +++ b/rel/m_lib.c @@ -782,16 +782,16 @@ extern f32 get_percent_forAccelBrake(const f32 now, const f32 start, const f32 e * @param wpos Pointer to the 3D world position (xyz_t). * @param screen_pos Pointer to the resulting 2D screen position (xyz_t). */ -extern void Game_play_Projection_Trans(GAME_PLAY* const play, MtxF* matrix, +extern void Game_play_Projection_Trans(GAME_PLAY* const play, xyz_t* world_pos, xyz_t* screen_pos) { f32 w; Matrix_mult(&play->matrix, 0); - Matrix_Position(matrix, screen_pos); + Matrix_Position(world_pos, screen_pos); w = play->matrix.ww + - ((play->matrix.wx * matrix->xx) + - (play->matrix.wy * matrix->yx) + - (play->matrix.wz * matrix->zx)); + ((play->matrix.wx * world_pos->x) + + (play->matrix.wy * world_pos->y) + + (play->matrix.wz * world_pos->z)); screen_pos->x = (SCREEN_WIDTH_F / 2.0f) + ((screen_pos->x / w) * (SCREEN_WIDTH_F / 2.0f)); screen_pos->y = (SCREEN_HEIGHT_F / 2.0f) - ((screen_pos->y / w) * (SCREEN_HEIGHT_F / 2.0f)); } diff --git a/rel/sys_matrix.c b/rel/sys_matrix.c index c4291eac..efb90233 100644 --- a/rel/sys_matrix.c +++ b/rel/sys_matrix.c @@ -617,12 +617,12 @@ Mtx* _Matrix_to_Mtx_new(GRAPH* graph){ } -void Matrix_Position(MtxF* m, xyz_t* v){ +void Matrix_Position(xyz_t* old_pos, xyz_t* new_pos){ MtxF* curm = Matrix_now; - v->x = (curm->xx * m->xx) + (curm->xy * m->yx) + (curm->xz * m->zx) + curm->xw; - v->y = (curm->yx * m->xx) + (curm->yy * m->yx) + (curm->yz * m->zx) + curm->yw; - v->z = (curm->zx * m->xx) + (curm->zy * m->yx) + (curm->zz * m->zx) + curm->zw; + new_pos->x = (curm->xx * old_pos->x) + (curm->xy * old_pos->y) + (curm->xz * old_pos->z) + curm->xw; + new_pos->y = (curm->yx * old_pos->x) + (curm->yy * old_pos->y) + (curm->yz * old_pos->z) + curm->yw; + new_pos->z = (curm->zx * old_pos->x) + (curm->zy * old_pos->y) + (curm->zz * old_pos->z) + curm->zw; } void Matrix_Position_Zero(xyz_t* v){