Applying sind/cosd/atan2d macros across the board (#518)

This commit is contained in:
mrshigure 2025-01-10 16:20:22 -08:00 committed by GitHub
parent 40da624fe7
commit 2455408432
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 3431 additions and 3414 deletions

View file

@ -302,7 +302,7 @@ static void CoinChgAppear(omObjData *object, coinChg *coin_chg) {
f32 angle;
OSu16tof32(&coin_chg->angle, &angle);
angle = sin(M_PI * angle / 180.0);
angle = sind(angle);
scale = angle;
object->rot.x = 405.0f * angle;
BoardModelScaleSet(coin_chg->coin_model, scale, scale, scale);
@ -342,8 +342,8 @@ static void CoinChgSeparate(omObjData *object, coinChg *coin_chg) {
} else {
spacing = 105.0f;
}
y_offset = (200.0 * sin((M_PI * (2.0f * x_scale)) / 180.0));
x_scale = sin((M_PI * x_scale) / 180.0);
y_offset = 200.0 * sind(2.0f * x_scale);
x_scale = sind(x_scale);
object->rot.x = 45.0f + (315.0f * x_scale);
if (coin_chg->tens != 0) {
coin_x = object->trans.x + (x_scale * -spacing);
@ -379,7 +379,7 @@ static void CoinChgShow(omObjData* object, coinChg* coin_chg) {
f32 y_pos;
OSu16tof32(&coin_chg->angle, &angle);
angle = (f32) sin((M_PI * angle) / 180.0);
angle = sind(angle);
if (coin_chg->minus != 0) {
y_pos = (-50.0f * angle) + object->trans.y;
} else {

View file

@ -6,7 +6,7 @@
#include "game/flag.h"
#include "game/objsub.h"
#include "game/process.h"
#include "math.h"
#include "ext_math.h"
#define BLOCK_SPAWN 0
#define BLOCK_HIT 2
@ -312,7 +312,7 @@ static void SpawnBlock(BlockWork *arg0, omObjData *arg1)
}
arg1->rot.y = rotY;
arg1->scale.x = arg1->scale.y = arg1->scale.z = sin(M_PI * scaleAngle / 180.0);
arg1->scale.x = arg1->scale.y = arg1->scale.z = sind(scaleAngle);
}
static void HitBlock(BlockWork *arg0, omObjData *arg1)
@ -325,7 +325,7 @@ static void HitBlock(BlockWork *arg0, omObjData *arg1)
}
OSs16tof32(&arg0->hit_y_velocity, &var_f30);
arg1->trans.y += 0.2f * sin((M_PI * var_f30) / 180.0);
arg1->trans.y += 0.2f * sind(var_f30);
}
static void OpenBlock(BlockWork *arg0, omObjData *arg1)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -12,6 +12,8 @@
#include "game/board/tutorial.h"
#include "game/board/window.h"
#include "ext_math.h"
// structs
typedef struct structActiveMG {
s16 unk_00;
@ -767,7 +769,7 @@ static void SeparateStatus(bitcopy* arg0, omObjData* arg1) {
return;
}
OSu8tof32((u8*)&arg0->unk_03, &temp_f29);
temp_f30 = sin((temp_f29 * M_PI) / 180.0) * 4.0 + 1.0;
temp_f30 = sind(temp_f29) * 4.0 + 1.0;
arg0->unk_03 += 6;
if (arg0->unk_03 > 0x5A) {
arg0->unk_03 = 0x5A;
@ -797,9 +799,9 @@ static void PopupVS(bitcopy* arg0, omObjData* arg1) {
}
OSs16tof32(&arg0->unk_04, &temp_f31);
if (arg0->unk_04 < 0x5A) {
var_f30 = 2.0 * sin((M_PI * temp_f31) / 180.0);
var_f30 = 2.0 * sind(temp_f31);
} else {
var_f30 = 1.0 + sin((M_PI * temp_f31) / 180.0);
var_f30 = 1.0 + sind(temp_f31);
if (arg0->unk_04 >= 0xB4) {
var_f30 = 1.0f;
temp_r28 = (bitcopy*) mgSetupObj->work;
@ -958,7 +960,7 @@ static void UpdateLuckyValue(bitcopy* arg0, omObjData* arg1) {
case 1:
if (arg0->unk_03 < 0x5A) {
OSu8tof32((u8*) &arg0->unk_03, &temp_f28);
temp_f29 = sin((M_PI * temp_f28) / 180.0);
temp_f29 = sind(temp_f28);
HuSprScaleSet(temp_r27->unk_00[0], 8, temp_f29, temp_f29);
HuSprScaleSet(temp_r27->unk_00[0], 9, temp_f29, temp_f29);
arg0->unk_03 += 2;
@ -1006,7 +1008,7 @@ static void UpdateLuckyValue(bitcopy* arg0, omObjData* arg1) {
return;
}
temp_f28 = (arg0->unk_04 % 360);
temp_f29 = (1.0 + (0.5 * sin((M_PI * temp_f28) / 180.0)));
temp_f29 = (1.0 + (0.5 * sind(temp_f28)));
HuSprScaleSet(temp_r27->unk_00[0], 8, temp_f29, temp_f29);
HuSprScaleSet(temp_r27->unk_00[0], 9, temp_f29, temp_f29);
break;
@ -1075,7 +1077,7 @@ static void UpdateMGList(bitcopy* arg0, omObjData* arg1) {
case 1:
if (arg0->unk_03 < 0x5A) {
OSu8tof32((u8*) &arg0->unk_03, &var_f26);
temp_f27 = sin((M_PI * var_f26) / 180.0);
temp_f27 = sind(var_f26);
arg0->unk_03 += 3;
HuSprScaleSet(temp_r24->unk_00[0], temp_r22, temp_f27, temp_f27);
return;
@ -1166,7 +1168,7 @@ static void UpdateMGList(bitcopy* arg0, omObjData* arg1) {
case 5:
if (arg0->unk_03 < 0x5A) {
OSu8tof32((u8*) &arg0->unk_03, &var_f26);
temp_f27 = (1.0 + (2.0 * sin((M_PI * var_f26) / 180.0)));
temp_f27 = (1.0 + (2.0 * sind(var_f26)));
arg0->unk_03 += 4;
if (arg0->unk_03 > 0x5A) {
arg0->unk_03 = 0x5A;

View file

@ -300,7 +300,7 @@ static void ExitBox(ItemGiveWork2* arg0, omObjData* arg1) {
}
arg1->trans.y = spC.y + (700.0f * cosd(arg0->unk_08));
arg1->rot.y = sin((M_PI * temp) / 180.0);
arg1->rot.y = sind(temp);
arg0->unk_08 -= 1.5f;
arg0->unk_06 -= 30;
}

View file

@ -20,6 +20,7 @@
#include "game/board/window.h"
#include "dolphin.h"
#include "ext_math.h"
#include "string.h"
typedef struct {
@ -238,7 +239,7 @@ static void ShowLogo(void) {
HuSprGrpPosSet(logoSprGrp, 288.0f, 240.0f);
for (spA = 0; spA < 90; spA += 4) {
OSs16tof32(&spA, &var_f27);
temp_f28 = sin(var_f27 * M_PI / 180.0);
temp_f28 = sind(var_f27);
HuSprScaleSet(logoSprGrp, 0, temp_f28, temp_f28);
HuPrcVSleep();
}
@ -246,7 +247,7 @@ static void ShowLogo(void) {
for (spA = 0; spA < 540; spA += 4) {
sp8 = spA % 180;
OSs16tof32(&sp8, &var_f27);
temp_f28 = 1.0 + 0.699999988079071 * sin(var_f27 * M_PI / 180.0);
temp_f28 = 1.0 + 0.7f * sind(var_f27);
HuSprScaleSet(logoSprGrp, 0, temp_f28, temp_f28);
HuPrcVSleep();
}
@ -254,7 +255,7 @@ static void ShowLogo(void) {
HuPrcSleep(0x78);
for (spA = 0; spA < 90; spA += 4) {
OSs16tof32(&spA, &var_f27);
temp_f28 = cos(var_f27 * M_PI / 180.0);
temp_f28 = cosd(var_f27);
HuSprScaleSet(logoSprGrp, 0, temp_f28, temp_f28);
HuPrcVSleep();
}
@ -586,7 +587,7 @@ static void PlayerDiceNumHide(omObjData *arg0, PlayerStartWork *arg1) {
arg1->unk02 = 2;
}
OSs16tof32(&arg1->unk06, &var_f28);
arg0->rot.x = 1.0 + 1.2999999523162842 * sin(var_f28 * M_PI / 180.0);
arg0->rot.x = 1.0 + 1.3f * sind(var_f28);
break;
case 2:
arg1->unk06 += 9;
@ -595,8 +596,8 @@ static void PlayerDiceNumHide(omObjData *arg0, PlayerStartWork *arg1) {
arg1->unk02 = 3;
}
OSs16tof32(&arg1->unk06, &var_f28);
arg0->rot.x = cos(0.5f * var_f28 * M_PI / 180.0);
arg0->rot.y = 1.0 + 1.2999999523162842 * sin(var_f28 * M_PI / 180.0);
arg0->rot.x = cosd(0.5f * var_f28);
arg0->rot.y = 1.0 + 1.3f * sind(var_f28);
break;
case 3:
BoardModelVisibilitySet(arg1->unk0A, 0);

View file

@ -12,7 +12,7 @@
#include "game/objsub.h"
#include "game/disp.h"
#include "math.h"
#include "ext_math.h"
static void WarpInit(s32);
static void WarpLaunch(s32);
@ -234,7 +234,7 @@ static void WarpImpact(s32 player) {
speed = 4.0f;
for (angle = 0.0f, temp = angle; angle < 180.0f; angle += speed) {
temp_f30 = sin((M_PI * angle) / 180.0);
temp_f30 = sind(angle);
BoardModelScaleSet(warpImpactMdl, 0.5f + temp_f30, 0.5f + temp_f30, 0.5f + temp_f30);
HuPrcVSleep();
}
@ -245,4 +245,4 @@ static void WarpImpact(s32 player) {
BoardPlayerIdleSet(warpImpactPlayer[i]);
}
warpState = 6;
}
}