Matched m463Dll (US); applying some ext_math macros (#506)

This commit is contained in:
mrshigure 2025-01-04 18:52:39 -08:00 committed by GitHub
parent 391f320aec
commit d95b1af697
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 1637 additions and 207 deletions

View file

@ -13,6 +13,8 @@
#include "game/data.h"
#include "game/wipe.h"
#include "ext_math.h"
static s16 stopWin = -1;
static s16 wheelMdl = -1;
s16 lbl_801D3854 = -1;
@ -1330,7 +1332,7 @@ static void UpdateLotteryTicket(omObjData *object)
switch(work->state) {
case 2:
if(work->angle < 540) {
float scale = 0.4f+(0.1f*sin(M_PI*(float)(work->angle%180)/180.0));
float scale = 0.4f+(0.1f*sind((float)(work->angle%180)));
HuSprGrpScaleSet(work->group, scale, scale);
work->angle += 9;
} else {
@ -1511,7 +1513,7 @@ static void StartHostMove(Vec *from, Vec *to, s16 time)
omSetTra(object, from->x, from->y, from->z);
omSetRot(object, (to->x-from->x)/duration, 0.0f, (to->z-from->z)/duration);
omSetSca(object, to->x, to->y, to->z);
angle = 180.0*(atan2(object->rot.x, object->rot.z)/M_PI);
angle = atan2d(object->rot.x, object->rot.z);
work->angle = 0;
OSf32tos16(&angle, &work->angle_end);
BoardModelMotionShiftSet(hostMdl, hostMot[0], 0, 8, HU3D_MOTATTR_LOOP);

View file

@ -18,7 +18,7 @@
#include "game/objsub.h"
#include "game/pad.h"
#include "math.h"
#include "ext_math.h"
#include "stdlib.h"
static void InitJunction(s32, s32, f32);
@ -1152,7 +1152,7 @@ static void InitJunction(s32 arg0, s32 arg1, f32 arg8)
VECSubtract(&sp50, &sp68, &sp44);
VECNormalize(&sp44, &sp44);
angle = (180.0 * (atan2(sp44.x, sp44.z) / M_PI));
angle = atan2d(sp44.x, sp44.z);
if (angle < 0.0f) {
angle += 360.0f;
}
@ -1174,7 +1174,7 @@ static void InitJunction(s32 arg0, s32 arg1, f32 arg8)
temp_r29->unk_06[var_r27] = BoardModelCreate(DATA_MAKE_NUM(DATADIR_BOARD, 0), NULL, 1);
BoardModelRotSet(temp_r29->unk_06[var_r27], 0.0f, angle, 0.0f);
BoardModelLayerSet(temp_r29->unk_06[var_r27], 6);
sp5C.x = sp68.x + (100.0 * sin((M_PI * angle) / 180.0));
sp5C.x = sp68.x + 100.0 * sind(angle);
sp5C.y = 300.0f + sp68.y;
sp5C.z = (var_f29 + (sp68.z + (100.0 * cosd(angle))));
BoardModelPosSetV(temp_r29->unk_06[var_r27], &sp5C);
@ -1219,7 +1219,7 @@ static void UpdateJunctionGfx(omObjData *arg0)
temp_r30->unk_02 -= 0xB4;
}
OSs16tof32(&temp_r30->unk_02, &arg0->scale.x);
arg0->scale.x = 3.0 + sin((M_PI * arg0->scale.x) / 180.0);
arg0->scale.x = 3.0 + sind(arg0->scale.x);
arg0->scale.y = arg0->scale.x;
arg0->scale.z = arg0->scale.x;
BoardModelScaleSet(temp_r30->unk_06[temp_r30->field00_bit5], arg0->scale.x, arg0->scale.y, arg0->scale.z);
@ -1355,7 +1355,7 @@ static s32 DoDebugMove(s32 arg0, s16 *arg1)
}
else {
VECSubtract(&sp5C->pos, &sp88, &sp94);
var_f30 = 90.0 - (180.0 * (atan2(sp94.z, sp94.x) / M_PI));
var_f30 = 90.0 - atan2d(sp94.z, sp94.x);
OSf32tos16(&var_f30, &var_r26);
if (var_r26 < 0) {
var_r26 += 0x168;
@ -1394,7 +1394,7 @@ static s32 DoDebugMove(s32 arg0, s16 *arg1)
goto loop_21;
}
if ((0.0f != spA0.x) || (0.0f != spA0.z)) {
var_f30 = (90.0 + (180.0 * (atan2(spA0.z, spA0.x) / M_PI)));
var_f30 = 90.0 + atan2d(spA0.z, spA0.x);
if (var_f30 < 0.0f) {
var_f30 += 360.0f;
}
@ -1404,7 +1404,7 @@ static s32 DoDebugMove(s32 arg0, s16 *arg1)
RestoreJunction(var_f30, 1);
sp50 = &boardCamera;
VECSubtract(&sp50->target, &sp50->pos, &sp7C);
var_f30 = (var_f30 + (90.0 - (180.0 * (atan2(-sp7C.z, -sp7C.x) / M_PI))));
var_f30 += 90.0 - atan2d(-sp7C.z, -sp7C.x);
if (var_f30 < 0.0f) {
var_f30 += 360.0f;
}
@ -1535,7 +1535,7 @@ static s32 ExecJunction(s32 arg0, s16 *arg1)
}
else {
VECSubtract(&sp88->pos, &spAC, &spB8);
var_f29 = (90.0 - (180.0 * (atan2(spB8.z, spB8.x) / M_PI)));
var_f29 = 90.0 - atan2d(spB8.z, spB8.x);
if (var_f29 < 0.0f) {
var_f29 += 360.0f;
}
@ -1611,7 +1611,7 @@ static s32 ExecJunction(s32 arg0, s16 *arg1)
}
else {
if ((0.0f != spC4.x) || (0.0f != spC4.z)) {
var_f29 = (90.0 + (180.0 * (atan2(spC4.z, spC4.x) / M_PI)));
var_f29 = 90.0 + atan2d(spC4.z, spC4.x);
if (var_f29 < 0.0f) {
var_f29 += 360.0f;
}
@ -1729,7 +1729,7 @@ void BoardPlayerPosLerpStart(s32 arg0, Vec *arg1, Vec *arg2, s16 arg3)
}
VECSubtract(arg2, arg1, &sp18);
VECNormalize(&sp18, &sp18);
var_f26 = 90.0 - (180.0 * (atan2(sp18.z, sp18.x) / M_PI));
var_f26 = 90.0 - atan2d(sp18.z, sp18.x);
var_f30 = var_f26;
if (var_f30 < 0.0f) {
var_f30 += 360.0f;
@ -2896,7 +2896,7 @@ static s32 MegaPlayerPassFunc(s32 player, s32 space)
VECSubtract(&spC4, &spB8, &spAC);
spAC.x /= 60.0f;
spAC.z /= 60.0f;
BoardPlayerRotYSet(player, 90.0 - (180.0 * (atan2(spAC.z, spAC.x) / M_PI)));
BoardPlayerRotYSet(player, 90.0 - atan2d(spAC.z, spAC.x));
sp98[1] = BoardVecDistXZCalc(&spC4, &spB8);
BoardPlayerMotionShiftSet(player, 4, 0, 8, HU3D_MOTATTR_NONE);
HuPrcSleep(8);
@ -2998,7 +2998,7 @@ static s32 MegaExecJump(s32 player, s32 space)
VECSubtract(&spC4, &spB8, &spAC);
spAC.x /= 60.0f;
spAC.z /= 60.0f;
BoardPlayerRotYSet(player, 90.0 - (180.0 * (atan2(spAC.z, spAC.x) / M_PI)));
BoardPlayerRotYSet(player, 90.0 - atan2d(spAC.z, spAC.x));
BoardPlayerIdleSet(player);
HuPrcSleep(10);
sp90[1] = BoardVecDistXZCalc(&spC4, &spB8);

View file

@ -14,7 +14,7 @@
#include "game/objsub.h"
#include "game/sprite.h"
#include "math.h"
#include "ext_math.h"
#include "string.h"
static BoardSpace spaceData[2][256];
@ -156,10 +156,10 @@ void BoardSpaceCornerPosGet(s32 index, s32 corner, Vec *pos)
corner_ofs.x = corner_pos[corner][0] * 80.0f;
corner_ofs.y = 0;
corner_ofs.z = corner_pos[corner][1] * 80.0f;
corner_ofs.x = (cos((M_PI * rot.z) / 180) * corner_ofs.x) + (sin((M_PI * rot.z) / 180) * corner_ofs.y);
corner_ofs.y = (cos((M_PI * rot.x) / 180) * cos((M_PI * rot.z) / 180) * corner_ofs.y) + (sin((M_PI * rot.z) / 180) * corner_ofs.x)
+ (sin((M_PI * -rot.x) / 180) * corner_ofs.z);
corner_ofs.z = (sin((M_PI * rot.x) / 180) * corner_ofs.y) + (cos((M_PI * rot.x) / 180) * corner_ofs.z);
corner_ofs.x = (cosd(rot.z) * corner_ofs.x) + (sind(rot.z) * corner_ofs.y);
corner_ofs.y = (cosd(rot.x) * cosd(rot.z) * corner_ofs.y) + (sind(rot.z) * corner_ofs.x)
+ (sind(-rot.x) * corner_ofs.z);
corner_ofs.z = (sind(rot.x) * corner_ofs.y) + (cosd(rot.x) * corner_ofs.z);
pos->x += corner_ofs.x;
pos->y += corner_ofs.y;
pos->z += corner_ofs.z;
@ -724,7 +724,7 @@ static s32 ExecPipeSpace(s32 player, s32 space)
BoardSpacePosGet(0, space_ptr->link[0], &pos_link);
VECSubtract(&pos_link, &pos, &dir);
VECNormalize(&dir, &dir);
BoardPlayerRotYSet(player, 90 - ((atan2(dir.z, dir.x) / M_PI) * 180));
BoardPlayerRotYSet(player, 90 - atan2d(dir.z, dir.x));
radius = 0.75f * BoardVecDistXZCalc(&pos_link, &pos);
BoardPlayerMotionStart(player, 4, 0);
y_vel = 0;

View file

@ -15,6 +15,8 @@
#include "game/board/space.h"
#include "game/board/ui.h"
#include "ext_math.h"
typedef struct {
struct {
u8 unk00_field0 : 1;
@ -247,9 +249,9 @@ static void ExecMapView(void) {
if (sp9 != 0 || sp8 != 0) {
OSs8tof32(&sp9, &spC.x);
OSs8tof32(&sp8, &spC.z);
temp_f28 = 180.0 * (atan2(spC.x, -spC.z) / M_PI);
spC.x = var_f29 * sin(temp_f28 * M_PI / 180.0);
spC.z = var_f29 * cos(temp_f28 * M_PI / 180.0);
temp_f28 = atan2d(spC.x, -spC.z);
spC.x = var_f29 * sind(temp_f28);
spC.z = var_f29 * cosd(temp_f28);
}
VECAdd(&spC, &focusPos, &focusPos);
if (focusPos.x < temp_f26) {
@ -563,7 +565,7 @@ static void UpdateOverheadView(omObjData *arg0) {
sp14.y -= 240.0f;
VECSubtract(&sp20, &sp14, &sp8);
sp8.z = 0.0f;
temp_f30 = BoardDAngleCalc(180.0 * (atan2(sp8.y, sp8.x) / M_PI) - 90.0);
temp_f30 = BoardDAngleCalc(atan2d(sp8.y, sp8.x) - 90.0);
temp_f31 = VECMag(&sp8) / 32;
if (i != 4) {
var_r28 = i + 4;