From 70c2c679a40186461dba45d137598a25875e7575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Fa=C3=9Fbender?= <31699028+Brotenko@users.noreply.github.com> Date: Tue, 28 Dec 2021 13:52:32 +0100 Subject: [PATCH] Introduce SPRITE_PIXEL_SCALE (#580) --- include/macros.h | 2 ++ src/182B30.c | 14 +++++++------- src/77480.c | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/macros.h b/include/macros.h index 92bb3f9191..d233b7ed21 100644 --- a/include/macros.h +++ b/include/macros.h @@ -81,6 +81,8 @@ #define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0))) +#define SPRITE_PIXEL_SCALE (5.0 / 7.0) + #ifdef PERMUTER #define SCRIPT(...) {} #endif diff --git a/src/182B30.c b/src/182B30.c index 4fe627709d..e3891b1cbd 100644 --- a/src/182B30.c +++ b/src/182B30.c @@ -305,9 +305,9 @@ void func_80254C50(Actor* actor) { guRotateF(sp98, rotZ, 0.0f, 0.0f, 1.0f); guMtxCatF(sp18, sp58, sp218); guMtxCatF(sp218, sp98, spD8); - guScaleF(sp118, actor->scale.x * (5.0 / 7.0) * actor->scalingFactor, - actor->scale.y * (5.0 / 7.0) * actor->scalingFactor * partTable->verticalStretch, - actor->scale.z * (5.0 / 7.0)); + guScaleF(sp118, actor->scale.x * SPRITE_PIXEL_SCALE * actor->scalingFactor, + actor->scale.y * SPRITE_PIXEL_SCALE * actor->scalingFactor * partTable->verticalStretch, + actor->scale.z * SPRITE_PIXEL_SCALE); guMtxCatF(sp118, sp158, sp258); guMtxCatF(sp258, spD8, sp218); guMtxCatF(sp218, sp198, sp258); @@ -388,9 +388,9 @@ void func_802552EC(s32 arg0, Actor* actor) { guRotateF(sp98, actor->rotation.z, 0.0f, 0.0f, 1.0f); guMtxCatF(sp18, sp58, sp198); guMtxCatF(sp198, sp98, spD8); - guScaleF(sp118, actor->scale.x * (5.0 / 7.0) * actor->scalingFactor, - actor->scale.y * (5.0 / 7.0) * actor->scalingFactor, - actor->scale.z * (5.0 / 7.0)); + guScaleF(sp118, actor->scale.x * SPRITE_PIXEL_SCALE * actor->scalingFactor, + actor->scale.y * SPRITE_PIXEL_SCALE * actor->scalingFactor, + actor->scale.z * SPRITE_PIXEL_SCALE); guMtxCatF(sp118, spD8, sp298); numParts = actor->numParts; @@ -417,7 +417,7 @@ void func_802552EC(s32 arg0, Actor* actor) { } if (partTable->flags & ACTOR_PART_FLAG_100000) { - guScaleF(sp2D8, actor->scale.x * (5.0 / 7.0), actor->scale.y * (5.0 / 7.0), actor->scale.z * (5.0 / 7.0)); + guScaleF(sp2D8, actor->scale.x * SPRITE_PIXEL_SCALE, actor->scale.y * SPRITE_PIXEL_SCALE, actor->scale.z * SPRITE_PIXEL_SCALE); } j = decorationTable->unk_7D9; diff --git a/src/77480.c b/src/77480.c index 41f9ae4fea..d797e78af3 100644 --- a/src/77480.c +++ b/src/77480.c @@ -792,7 +792,7 @@ void appendGfx_player(void) { s32 phi_a0; if (playerStatus->actionState == ACTION_STATE_SLIDING) { - guScaleF(spE0, (5.0f / 7.0f), (5.0f / 7.0f), (5.0f / 7.0f)); + guScaleF(spE0, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE); guRotateF(sp20, temp_f0, 0.0f, 1.0f, 0.0f); guMtxCatF(spE0, sp20, sp20); guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); @@ -812,7 +812,7 @@ void appendGfx_player(void) { guMtxCatF(sp20, spA0, sp20); guTranslateF(sp60, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f); guMtxCatF(sp20, sp60, sp20); - guScaleF(spE0, (5.0f / 7.0f), (5.0f / 7.0f), (5.0f / 7.0f)); + guScaleF(spE0, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE); guMtxCatF(sp20, spE0, sp20); guTranslateF(sp60, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); guMtxCatF(sp20, sp60, sp20);