Document math.c

This commit is contained in:
Rachel 2024-11-16 15:53:50 -08:00
parent 0c0edafa26
commit 5cb7907656
60 changed files with 374 additions and 366 deletions

View File

@ -3,27 +3,39 @@
#include <nitro/fx/fx.h>
fx32 sub_0201D15C(u16 param0);
fx32 sub_0201D1D4(u16 param0);
fx32 sub_0201D250(u16 param0);
fx32 sub_0201D264(u16 param0);
u16 sub_0201D278(u16 param0);
u16 sub_0201D2A4(u16 param0);
fx32 sub_0201D2B8(fx32 param0);
fx32 sub_0201D2C4(fx32 param0);
#include "constants/heap.h"
enum AffineTransformationMatrixMode {
AFFINE_MODE_NORMAL = 0,
AFFINE_MODE_MAX_256,
AFFINE_MODE_MAX_360,
};
fx32 CalcSineDegrees(u16 degrees);
fx32 CalcCosineDegrees(u16 degrees);
fx32 CalcSineDegrees_Wraparound(u16 degrees);
fx32 CalcCosineDegrees_Wraparound(u16 degrees);
u16 CalcAngleRotationIdx(u16 degrees);
u16 CalcAngleRotationIdx_Wraparound(u16 degrees);
fx32 CalcSineDegrees_FX32(fx32 degrees);
fx32 CalcCosineDegrees_FX32(fx32 degrees);
u32 LCRNG_GetSeed(void);
void LCRNG_SetSeed(u32 seed);
u16 LCRNG_Next(void);
u32 ARNG_Next(u32 seed);
void MTRNG_SetSeed(u32 seed);
u32 MTRNG_Next(void);
void sub_0201D470(MtxFx22 *param0, u16 param1, fx32 param2, fx32 param3, u8 param4);
s32 sub_0201D4CC(s32 param0, s32 param1, s32 param2, s32 param3, u32 param4);
s32 sub_0201D580(u16 param0, s32 param1);
void CreateAffineTransformationMatrix(MtxFx22 *matrix, u16 degrees, fx32 xScale, fx32 yScale, u8 mode);
s32 CalcDotProduct2D(s32 x0, s32 y0, s32 x1, s32 y1, u32 unused);
s32 CalcRadialAngle(u16 radius, s32 distance);
u32 SumBytes(const void *data, u32 size);
void EncodeData(void *data, u32 size, u32 seed);
void DecodeData(void *data, u32 size, u32 seed);
u16 sub_0201D628(const void *param0, u32 param1);
void sub_0201D640(int param0);
u16 CalcCRC16Checksum(const void *data, u32 dataLen);
void InitCRC16Table(enum HeapId heapID);
#endif // POKEPLATINUM_MATH_H

View File

@ -1855,6 +1855,6 @@ static void ov16_022684BC(SysTask *param0, void *param1)
v0->unk_54 -= 360;
}
v1 = FX_Mul(sub_0201D15C(v0->unk_54), 0x1800) / FX32_ONE;
v1 = FX_Mul(CalcSineDegrees(v0->unk_54), 0x1800) / FX32_ONE;
Healthbar_OffsetPositionXY(v0, 0, v1);
}

View File

@ -55,6 +55,6 @@ static void ov16_02264800(SysTask *param0, void *param1)
v0->unk_198 -= 360;
}
v1 = FX_Mul(sub_0201D15C(v0->unk_198), 0x1800) / FX32_ONE;
v1 = FX_Mul(CalcSineDegrees(v0->unk_198), 0x1800) / FX32_ONE;
sub_02007DEC(v0->unk_20, 4, v1);
}

View File

@ -173,7 +173,7 @@ static void ov16_0226DFD8(SysTask *param0, void *param1)
}
if (v0->unk_1C == 0) {
v1 = FX_Mul(sub_0201D15C(v0->unk_10 / 100), 14 << FX32_SHIFT) / FX32_ONE;
v1 = FX_Mul(CalcSineDegrees(v0->unk_10 / 100), 14 << FX32_SHIFT) / FX32_ONE;
sub_0200D500(v0->unk_00, v0->unk_08, v0->unk_0C - v1, v0->unk_14);
}
}

View File

@ -747,7 +747,7 @@ void Bg_SetAffineParams(BgConfig *bgConfig, u8 bgLayer, const MtxFx22 *mtx, int
static void ResetBgAffineTransforms(BgConfig *bgConfig, u8 bgLayer)
{
MtxFx22 mtx;
sub_0201D470(&mtx, 0, FX32_ONE, FX32_ONE, 0);
CreateAffineTransformationMatrix(&mtx, 0, FX32_ONE, FX32_ONE, AFFINE_MODE_NORMAL);
Bg_SetAffineParams(bgConfig, bgLayer, &mtx, 0, 0);
}
@ -2460,7 +2460,7 @@ static void RunScheduledScrolls(BgConfig *bgConfig)
G2_SetBG2Offset(bgConfig->bgs[BG_LAYER_MAIN_2].xOffset, bgConfig->bgs[BG_LAYER_MAIN_2].yOffset);
} else {
MtxFx22 mtx;
sub_0201D470(&mtx, bgConfig->bgs[BG_LAYER_MAIN_2].rotation, bgConfig->bgs[BG_LAYER_MAIN_2].xScale, bgConfig->bgs[BG_LAYER_MAIN_2].yScale, 2);
CreateAffineTransformationMatrix(&mtx, bgConfig->bgs[BG_LAYER_MAIN_2].rotation, bgConfig->bgs[BG_LAYER_MAIN_2].xScale, bgConfig->bgs[BG_LAYER_MAIN_2].yScale, AFFINE_MODE_MAX_360);
G2_SetBG2Affine(&mtx, bgConfig->bgs[BG_LAYER_MAIN_2].xCenter, bgConfig->bgs[BG_LAYER_MAIN_2].yCenter, bgConfig->bgs[BG_LAYER_MAIN_2].xOffset, bgConfig->bgs[BG_LAYER_MAIN_2].yOffset);
}
}
@ -2470,7 +2470,7 @@ static void RunScheduledScrolls(BgConfig *bgConfig)
G2_SetBG3Offset(bgConfig->bgs[BG_LAYER_MAIN_3].xOffset, bgConfig->bgs[BG_LAYER_MAIN_3].yOffset);
} else {
MtxFx22 mtx;
sub_0201D470(&mtx, bgConfig->bgs[BG_LAYER_MAIN_3].rotation, bgConfig->bgs[BG_LAYER_MAIN_3].xScale, bgConfig->bgs[BG_LAYER_MAIN_3].yScale, 2);
CreateAffineTransformationMatrix(&mtx, bgConfig->bgs[BG_LAYER_MAIN_3].rotation, bgConfig->bgs[BG_LAYER_MAIN_3].xScale, bgConfig->bgs[BG_LAYER_MAIN_3].yScale, AFFINE_MODE_MAX_360);
G2_SetBG3Affine(&mtx, bgConfig->bgs[BG_LAYER_MAIN_3].xCenter, bgConfig->bgs[BG_LAYER_MAIN_3].yCenter, bgConfig->bgs[BG_LAYER_MAIN_3].xOffset, bgConfig->bgs[BG_LAYER_MAIN_3].yOffset);
}
}
@ -2488,7 +2488,7 @@ static void RunScheduledScrolls(BgConfig *bgConfig)
G2S_SetBG2Offset(bgConfig->bgs[BG_LAYER_SUB_2].xOffset, bgConfig->bgs[BG_LAYER_SUB_2].yOffset);
} else {
MtxFx22 mtx;
sub_0201D470(&mtx, bgConfig->bgs[BG_LAYER_SUB_2].rotation, bgConfig->bgs[BG_LAYER_SUB_2].xScale, bgConfig->bgs[BG_LAYER_SUB_2].yScale, 2);
CreateAffineTransformationMatrix(&mtx, bgConfig->bgs[BG_LAYER_SUB_2].rotation, bgConfig->bgs[BG_LAYER_SUB_2].xScale, bgConfig->bgs[BG_LAYER_SUB_2].yScale, AFFINE_MODE_MAX_360);
G2S_SetBG2Affine(&mtx, bgConfig->bgs[BG_LAYER_SUB_2].xCenter, bgConfig->bgs[BG_LAYER_SUB_2].yCenter, bgConfig->bgs[BG_LAYER_SUB_2].xOffset, bgConfig->bgs[BG_LAYER_SUB_2].yOffset);
}
}
@ -2498,7 +2498,7 @@ static void RunScheduledScrolls(BgConfig *bgConfig)
G2S_SetBG3Offset(bgConfig->bgs[BG_LAYER_SUB_3].xOffset, bgConfig->bgs[BG_LAYER_SUB_3].yOffset);
} else {
MtxFx22 mtx;
sub_0201D470(&mtx, bgConfig->bgs[BG_LAYER_SUB_3].rotation, bgConfig->bgs[BG_LAYER_SUB_3].xScale, bgConfig->bgs[BG_LAYER_SUB_3].yScale, 2);
CreateAffineTransformationMatrix(&mtx, bgConfig->bgs[BG_LAYER_SUB_3].rotation, bgConfig->bgs[BG_LAYER_SUB_3].xScale, bgConfig->bgs[BG_LAYER_SUB_3].yScale, AFFINE_MODE_MAX_360);
G2S_SetBG3Affine(&mtx, bgConfig->bgs[BG_LAYER_SUB_3].xCenter, bgConfig->bgs[BG_LAYER_SUB_3].yCenter, bgConfig->bgs[BG_LAYER_SUB_3].xOffset, bgConfig->bgs[BG_LAYER_SUB_3].yOffset);
}
}

View File

@ -1,215 +1,210 @@
#include "math.h"
#include <nitro/math/crc.h>
#include "heap.h"
typedef struct {
MATHCRC16Table unk_00;
} UnkStruct_021BFB10;
static u16 LCRNG_NextFrom(u32 *seed);
fx32 sub_0201D15C(u16 param0)
fx32 CalcSineDegrees(u16 degrees)
{
if (param0 >= 360) {
if (degrees >= 360) {
return 0;
}
{
fx16 v0;
fx32 v1;
v0 = FX_SinIdx(sub_0201D278(param0));
v1 = FX32_CONST(FX_FX16_TO_F32(v0));
return v1;
}
fx16 sin = FX_SinIdx(CalcAngleRotationIdx(degrees));
return FX32_CONST(FX_FX16_TO_F32(sin));
}
fx32 sub_0201D1D4(u16 param0)
fx32 CalcCosineDegrees(u16 degrees)
{
if (param0 >= 360) {
if (degrees >= 360) {
return 0;
}
{
fx16 v0;
fx32 v1;
v0 = FX_CosIdx(sub_0201D278(param0));
v1 = FX32_CONST(FX_FX16_TO_F32(v0));
return v1;
}
fx16 cos = FX_CosIdx(CalcAngleRotationIdx(degrees));
return FX32_CONST(FX_FX16_TO_F32(cos));
}
fx32 sub_0201D250(u16 param0)
fx32 CalcSineDegrees_Wraparound(u16 degrees)
{
param0 %= 360;
return sub_0201D15C(param0);
degrees %= 360;
return CalcSineDegrees(degrees);
}
fx32 sub_0201D264(u16 param0)
fx32 CalcCosineDegrees_Wraparound(u16 degrees)
{
param0 %= 360;
return sub_0201D1D4(param0);
degrees %= 360;
return CalcCosineDegrees(degrees);
}
u16 sub_0201D278(u16 param0)
u16 CalcAngleRotationIdx(u16 degrees)
{
if (param0 >= 360) {
if (degrees >= 360) {
return 0;
}
return FX_DEG_TO_IDX(param0 * FX32_ONE);
return FX_DEG_TO_IDX(degrees * FX32_ONE);
}
u16 sub_0201D2A4(u16 param0)
u16 CalcAngleRotationIdx_Wraparound(u16 degrees)
{
param0 %= 360;
return sub_0201D278(param0);
degrees %= 360;
return CalcAngleRotationIdx(degrees);
}
fx32 sub_0201D2B8(fx32 param0)
fx32 CalcSineDegrees_FX32(fx32 degrees)
{
u16 v0 = param0 >> FX32_SHIFT;
return sub_0201D250(v0);
u16 degreesUnshifted = degrees >> FX32_SHIFT;
return CalcSineDegrees_Wraparound(degreesUnshifted);
}
fx32 sub_0201D2C4(fx32 param0)
fx32 CalcCosineDegrees_FX32(fx32 degrees)
{
u16 v0 = param0 >> FX32_SHIFT;
return sub_0201D264(v0);
u16 degreesUnshifted = degrees >> FX32_SHIFT;
return CalcCosineDegrees_Wraparound(degreesUnshifted);
}
u32 gLCRNG_State;
#define LCRNG_MULTIPLIER 1103515245L
#define LCRNG_INCREMENT 24691
u32 LCRNG_GetSeed(void)
static u32 sLCRNGState;
u32 LCRNG_GetSeed()
{
return gLCRNG_State;
return sLCRNGState;
}
void LCRNG_SetSeed(u32 seed)
{
gLCRNG_State = seed;
sLCRNGState = seed;
}
u16 LCRNG_Next(void)
u16 LCRNG_Next()
{
gLCRNG_State = gLCRNG_State * 1103515245L + 24691;
return (u16)(gLCRNG_State / 65536L);
sLCRNGState = sLCRNGState * LCRNG_MULTIPLIER + LCRNG_INCREMENT;
return sLCRNGState >> 16;
}
// Matsumoto, M. & Nishimura, T. 1998. "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator."
#define MT19937_N 624 // degree of recurrence (number of total words)
#define MT19937_M 397 // middle word offset
#define MT19937_W 32 // word size (number of bits)
#define MT19937_R 31 // separation point of a single word; number of bits of the lower bitmask
#define MT19937_F 1812433253 // additional initialization constant
#define MT19937_A 0x9908B0DF // coefficient of the rational normal form twist matrix
#define MT19937_B 0x9D2C5680 // tempering bitmask
#define MT19937_C 0xEFC60000 // tempering bitmask
#define MT19937_S 7 // tempering bitshift (masked against B)
#define MT19937_T 15 // tempering bitshift (masked against C)
#define MT19937_U 11 // tempering bitshift (not masked)
#define MT19937_L 18 // tempering bitshift (not masked)
#define MT19937_UMASK (0xFFFFFFFF << MT19937_R)
#define MT19937_LMASK (0xFFFFFFFF >> (MT19937_W - MT19937_R))
#define MT19937_DEFAULT_SEED 5489
u32 ARNG_Next(u32 seed)
{
return seed * 1812433253L + 1;
return seed * MT19937_F + 1;
}
static u32 sMTRNG_State[624];
static int sMTRNG_Size = 624 + 1;
static u32 sMTRNG_Xor[2] = { 0x0UL, 0x9908b0dfUL };
static u32 sMTRNGState[MT19937_N];
static int sMTRNGIndex = MT19937_N + 1;
static u32 sMTRNGXor[2] = { 0, MT19937_A };
void MTRNG_SetSeed(u32 seed)
{
sMTRNG_State[0] = seed & 0xffffffff;
for (sMTRNG_Size = 1; sMTRNG_Size < 624; sMTRNG_Size++) {
sMTRNG_State[sMTRNG_Size] = (1812433253UL * (sMTRNG_State[sMTRNG_Size - 1] ^ (sMTRNG_State[sMTRNG_Size - 1] >> 30)) + sMTRNG_Size);
sMTRNG_State[sMTRNG_Size] &= 0xffffffff;
sMTRNGState[0] = seed;
for (sMTRNGIndex = 1; sMTRNGIndex < MT19937_N; sMTRNGIndex++) {
sMTRNGState[sMTRNGIndex] = MT19937_F * (sMTRNGState[sMTRNGIndex - 1] ^ (sMTRNGState[sMTRNGIndex - 1] >> (MT19937_W - 2))) + sMTRNGIndex;
}
}
u32 MTRNG_Next(void)
u32 MTRNG_Next()
{
u32 result;
if (sMTRNGIndex >= MT19937_N) {
if (sMTRNGIndex == MT19937_N + 1) {
MTRNG_SetSeed(MT19937_DEFAULT_SEED);
}
if (sMTRNG_Size >= 624) {
int i;
if (sMTRNG_Size == 624 + 1) {
MTRNG_SetSeed(5489UL);
for (i = 0; i < MT19937_N - MT19937_M; i++) {
result = (sMTRNGState[i] & MT19937_UMASK) | (sMTRNGState[i + 1] & MT19937_LMASK);
sMTRNGState[i] = sMTRNGState[i + MT19937_M] ^ (result >> 1) ^ sMTRNGXor[result & 1];
}
for (; i < MT19937_N - 1; i++) {
result = (sMTRNGState[i] & MT19937_UMASK) | (sMTRNGState[i + 1] & MT19937_LMASK);
sMTRNGState[i] = sMTRNGState[i + (MT19937_M - MT19937_N)] ^ (result >> 1) ^ sMTRNGXor[result & 1];
}
for (i = 0; i < 624 - 397; i++) {
result = (sMTRNG_State[i] & 0x80000000UL) | (sMTRNG_State[i + 1] & 0x7fffffffUL);
sMTRNG_State[i] = sMTRNG_State[i + 397] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL];
}
for (; i < 624 - 1; i++) {
result = (sMTRNG_State[i] & 0x80000000UL) | (sMTRNG_State[i + 1] & 0x7fffffffUL);
sMTRNG_State[i] = sMTRNG_State[i + (397 - 624)] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL];
}
result = (sMTRNG_State[624 - 1] & 0x80000000UL) | (sMTRNG_State[0] & 0x7fffffffUL);
sMTRNG_State[624 - 1] = sMTRNG_State[397 - 1] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL];
sMTRNG_Size = 0;
result = (sMTRNGState[MT19937_N - 1] & MT19937_UMASK) | (sMTRNGState[0] & MT19937_LMASK);
sMTRNGState[MT19937_N - 1] = sMTRNGState[MT19937_M - 1] ^ (result >> 1) ^ sMTRNGXor[result & 1];
sMTRNGIndex = 0;
}
result = sMTRNG_State[sMTRNG_Size++];
result ^= (result >> 11);
result ^= (result << 7) & 0x9d2c5680UL;
result ^= (result << 15) & 0xefc60000UL;
result ^= (result >> 18);
result = sMTRNGState[sMTRNGIndex++];
result ^= (result >> MT19937_U);
result ^= (result << MT19937_S) & MT19937_B;
result ^= (result << MT19937_T) & MT19937_C;
result ^= (result >> MT19937_L);
return result;
}
void sub_0201D470(MtxFx22 *param0, u16 param1, fx32 param2, fx32 param3, u8 param4)
void CreateAffineTransformationMatrix(MtxFx22 *matrix, u16 degrees, fx32 xScale, fx32 yScale, u8 mode)
{
if (param4 == 1) {
param1 = (u16)((u32)(0xffff * param1) >> 8);
} else if (param4 == 2) {
param1 = (u16)((u32)(0xffff * param1) / 360);
if (mode == AFFINE_MODE_MAX_256) {
degrees = (u32)(0xFFFF * degrees) >> 8;
} else if (mode == AFFINE_MODE_MAX_360) {
degrees = (u32)(0xFFFF * degrees) / 360;
}
MTX_Rot22(param0, FX_SinIdx(param1), FX_CosIdx(param1));
MTX_ScaleApply22(param0, param0, param2, param3);
MTX_Rot22(matrix, FX_SinIdx(degrees), FX_CosIdx(degrees));
MTX_ScaleApply22(matrix, matrix, xScale, yScale);
}
static inline void inline_0201D4CC(const VecFx32 *param0, const VecFx32 *param1, VecFx32 *param2)
static inline void CalcCrossProduct(const VecFx32 *a, const VecFx32 *b, VecFx32 *outResult)
{
param2->x = 0;
param2->y = 0;
param2->z = FX_Mul(param0->x, param1->y) - FX_Mul(param1->x, param0->y);
outResult->x = 0;
outResult->y = 0;
outResult->z = FX_Mul(a->x, b->y) - FX_Mul(b->x, a->y);
}
s32 sub_0201D4CC(s32 param0, s32 param1, s32 param2, s32 param3, u32 param4)
s32 CalcDotProduct2D(s32 x0, s32 y0, s32 x1, s32 y1, u32 unused)
{
VecFx32 v0, v1, v2, v3;
fx32 v4;
fx32 v5;
s32 v6;
VecFx32 vec0, vec1, vecResult, cross;
fx32 crossMagnitude;
fx32 dotProduct;
s32 result;
VEC_Set(&v0, param0 << FX32_SHIFT, param1 << FX32_SHIFT, 0);
VEC_Set(&v1, param2 << FX32_SHIFT, param3 << FX32_SHIFT, 0);
inline_0201D4CC(&v0, &v1, &v3);
VEC_Set(&vec0, x0 << FX32_SHIFT, y0 << FX32_SHIFT, 0);
VEC_Set(&vec1, x1 << FX32_SHIFT, y1 << FX32_SHIFT, 0);
CalcCrossProduct(&vec0, &vec1, &cross);
crossMagnitude = cross.x + cross.y + cross.z;
v4 = v3.x + v3.y + v3.z;
VEC_Set(&vec0, y0 << FX32_SHIFT, x0 << FX32_SHIFT, 0);
VEC_Normalize(&vec0, &vecResult);
VEC_Set(&vec0, x0 << FX32_SHIFT, y0 << FX32_SHIFT, 0);
VEC_Set(&vec1, x1 << FX32_SHIFT, y1 << FX32_SHIFT, 0);
VEC_Subtract(&vec1, &vec0, &cross);
VEC_Set(&v0, param1 << FX32_SHIFT, param0 << FX32_SHIFT, 0);
VEC_Normalize(&v0, &v2);
VEC_Set(&v0, param0 << FX32_SHIFT, param1 << FX32_SHIFT, 0);
VEC_Set(&v1, param2 << FX32_SHIFT, param3 << FX32_SHIFT, 0);
VEC_Subtract(&v1, &v0, &v3);
dotProduct = VEC_DotProduct(&vecResult, &cross);
result = dotProduct >> FX32_SHIFT;
result = MATH_IAbs(result);
v5 = VEC_DotProduct(&v2, &v3);
v6 = v5 >> FX32_SHIFT;
v6 = MATH_IAbs(v6);
if (v4 <= 0) {
v6 *= -1;
if (crossMagnitude <= 0) {
result *= -1;
}
return v6;
return result;
}
s32 sub_0201D580(u16 param0, s32 param1)
s32 CalcRadialAngle(u16 radius, s32 distance)
{
s32 v0;
v0 = FX_Mul((2 * param0) << FX32_SHIFT, FX32_CONST(3.140f)) >> FX32_SHIFT;
return (s32)((param1 * 0xffff) / v0);
s32 circumference = FX_Mul((2 * radius) << FX32_SHIFT, FX32_CONST(3.140f)) >> FX32_SHIFT;
return (distance * 0xFFFF) / circumference;
}
u32 SumBytes(const void *data, u32 size)
@ -237,21 +232,20 @@ void DecodeData(void *data, u32 size, u32 seed)
static u16 LCRNG_NextFrom(u32 *seed)
{
seed[0] = seed[0] * 1103515245L + 24691;
return (u16)(seed[0] / 65536L);
*seed = *seed * LCRNG_MULTIPLIER + LCRNG_INCREMENT;
return *seed >> 16;
}
static UnkStruct_021BFB10 *Unk_021BFB10 = NULL;
static MATHCRC16Table *sCRC16Table = NULL;
u16 sub_0201D628(const void *param0, u32 param1)
u16 CalcCRC16Checksum(const void *data, u32 dataLen)
{
return MATH_CalcCRC16CCITT(&Unk_021BFB10->unk_00, param0, param1);
return MATH_CalcCRC16CCITT(sCRC16Table, data, dataLen);
}
void sub_0201D640(int param0)
void InitCRC16Table(enum HeapId heapID)
{
GF_ASSERT(Unk_021BFB10 == NULL);
Unk_021BFB10 = Heap_AllocFromHeap(param0, sizeof(UnkStruct_021BFB10));
MATH_CRC16CCITTInitTable(&Unk_021BFB10->unk_00);
GF_ASSERT(sCRC16Table == NULL);
sCRC16Table = Heap_AllocFromHeap(heapID, sizeof(MATHCRC16Table));
MATH_CRC16CCITTInitTable(sCRC16Table);
}

View File

@ -220,8 +220,8 @@ static void ov5_021F86E4(UnkStruct_ov101_021D5D90 *param0, void *param1)
v4 = &v0->unk_20;
}
v3.x += ((FX32_ONE * 0) + v4->x) + sub_0201D1D4(v0->unk_08) * v0->unk_0A;
v3.y += ((FX32_ONE * (+8)) + v4->y) + sub_0201D15C(v0->unk_08) * v0->unk_0A;
v3.x += ((FX32_ONE * 0) + v4->x) + CalcCosineDegrees(v0->unk_08) * v0->unk_0A;
v3.y += ((FX32_ONE * (+8)) + v4->y) + CalcSineDegrees(v0->unk_08) * v0->unk_0A;
v3.z += ((FX32_ONE * 0) + v4->z);
}

View File

@ -1138,7 +1138,7 @@ static BOOL ov6_0223EBDC(UnkStruct_ov6_0223EA98 *param0)
case 3:
Easy3DObject_GetPosition(&param0->unk_24, &v1, &v2, &v3);
v0[0] = ov6_0223FD18(&param0->unk_E4, param0->unk_D0);
param0->unk_D8 += (sub_0201D264(param0->unk_D0 * (180 / 20)) * 3);
param0->unk_D8 += (CalcCosineDegrees_Wraparound(param0->unk_D0 * (180 / 20)) * 3);
param0->unk_D0++;
Easy3DObject_SetPosition(&param0->unk_24, param0->unk_E4.unk_00, v2, param0->unk_D8);
@ -1157,7 +1157,7 @@ static BOOL ov6_0223EBDC(UnkStruct_ov6_0223EA98 *param0)
case 5:
Easy3DObject_GetPosition(&param0->unk_24, &v1, &v2, &v3);
v0[0] = ov6_0223FD18(&param0->unk_E4, param0->unk_D0);
param0->unk_D8 -= (sub_0201D264(param0->unk_D0 * (90 / 20)) * 3);
param0->unk_D8 -= (CalcCosineDegrees_Wraparound(param0->unk_D0 * (90 / 20)) * 3);
param0->unk_D0++;
Easy3DObject_SetPosition(&param0->unk_24, param0->unk_E4.unk_00, v2, param0->unk_D8);
@ -1214,7 +1214,7 @@ static BOOL ov6_0223EE5C(UnkStruct_ov6_0223EA98 *param0)
case 3:
Easy3DObject_GetPosition(&param0->unk_24, &v1, &v2, &v3);
v0[0] = ov6_0223FD18(&param0->unk_E4, param0->unk_D0);
param0->unk_D8 += (sub_0201D264(param0->unk_D0 * (180 / 32)) * 3);
param0->unk_D8 += (CalcCosineDegrees_Wraparound(param0->unk_D0 * (180 / 32)) * 3);
param0->unk_D0++;
Easy3DObject_SetPosition(&param0->unk_24, param0->unk_E4.unk_00, v2, param0->unk_D8);
@ -1228,7 +1228,7 @@ static BOOL ov6_0223EE5C(UnkStruct_ov6_0223EA98 *param0)
param0->unk_18++;
case 5:
Easy3DObject_GetPosition(&param0->unk_24, &v1, &v2, &v3);
param0->unk_D8 -= (sub_0201D264(param0->unk_D0 * (360 / 32)) * 2);
param0->unk_D8 -= (CalcCosineDegrees_Wraparound(param0->unk_D0 * (360 / 32)) * 2);
param0->unk_D0++;
Easy3DObject_SetPosition(&param0->unk_24, v1, v2, param0->unk_D8);
@ -1252,7 +1252,7 @@ static BOOL ov6_0223EE5C(UnkStruct_ov6_0223EA98 *param0)
v0[0] = ov6_0223FD18(&param0->unk_E4, param0->unk_D0);
v0[1] = ov6_0223FD18(&param0->unk_F4, param0->unk_D0);
param0->unk_D0++;
param0->unk_DC -= (sub_0201D264((param0->unk_D0 + 1) * (180 / 32)) * 4);
param0->unk_DC -= (CalcCosineDegrees_Wraparound((param0->unk_D0 + 1) * (180 / 32)) * 4);
Easy3DObject_SetPosition(&param0->unk_24, param0->unk_E4.unk_00 + param0->unk_DC, v2, param0->unk_F4.unk_00);
if (v0[0] && v0[1]) {
@ -1267,7 +1267,7 @@ static BOOL ov6_0223EE5C(UnkStruct_ov6_0223EA98 *param0)
param0->unk_18++;
case 9:
Easy3DObject_GetPosition(&param0->unk_24, &v1, &v2, &v3);
param0->unk_D8 += (sub_0201D264(param0->unk_D0 * (360 / 32)) * 1);
param0->unk_D8 += (CalcCosineDegrees_Wraparound(param0->unk_D0 * (360 / 32)) * 1);
param0->unk_D0++;
Easy3DObject_SetPosition(&param0->unk_24, v1, v2, param0->unk_D8);
@ -1291,7 +1291,7 @@ static BOOL ov6_0223EE5C(UnkStruct_ov6_0223EA98 *param0)
Easy3DObject_GetPosition(&param0->unk_24, &v1, &v2, &v3);
v0[0] = ov6_0223FD18(&param0->unk_E4, param0->unk_D0);
v0[1] = ov6_0223FD18(&param0->unk_F4, param0->unk_D0);
param0->unk_E0 += (sub_0201D264(param0->unk_D0 * (180 / 32)) * 2);
param0->unk_E0 += (CalcCosineDegrees_Wraparound(param0->unk_D0 * (180 / 32)) * 2);
param0->unk_D0++;
Easy3DObject_SetPosition(&param0->unk_24, param0->unk_E4.unk_00, v2, param0->unk_F4.unk_00 + param0->unk_E0);
@ -1389,7 +1389,7 @@ static BOOL ov6_0223EE5C(UnkStruct_ov6_0223EA98 *param0)
GX_SetMasterBrightness(param0->unk_0C);
}
param0->unk_DC += (sub_0201D264((param0->unk_D0 + 1) * (180 / 32)) * 8);
param0->unk_DC += (CalcCosineDegrees_Wraparound((param0->unk_D0 + 1) * (180 / 32)) * 8);
Easy3DObject_SetPosition(&param0->unk_24, param0->unk_D4 + param0->unk_DC, v2, param0->unk_F4.unk_00);
if (v0[0]) {

View File

@ -573,7 +573,7 @@ static CellActor *ov6_022437DC(UnkStruct_ov6_02243258 *param0)
CellActor_SetAffineOverwriteMode(v0, 2);
CellActor_SetAffineTranslation(v0, &v2);
CellActor_SetAffineScale(v0, &v3);
CellActor_SetAffineZRotation(v0, sub_0201D2A4(0));
CellActor_SetAffineZRotation(v0, CalcAngleRotationIdx_Wraparound(0));
return v0;
}
@ -704,15 +704,15 @@ static void ov6_02243950(UnkStruct_ov101_021D5D90 *param0)
v2->unk_40 = (FX32_ONE * 45);
v2->unk_48 = (FX32_ONE * (128 + 64));
v2->unk_4C = (FX32_ONE * 32);
v2->unk_14.x = sub_0201D264(45) * ((v2->unk_48) / FX32_ONE);
v2->unk_14.y = sub_0201D250((v2->unk_40) / FX32_ONE) * ((v2->unk_48) / FX32_ONE);
v2->unk_14.x = CalcCosineDegrees_Wraparound(45) * ((v2->unk_48) / FX32_ONE);
v2->unk_14.y = CalcSineDegrees_Wraparound((v2->unk_40) / FX32_ONE) * ((v2->unk_48) / FX32_ONE);
v0.x = v2->unk_08.x + v2->unk_14.x;
v0.y = v2->unk_08.y + v2->unk_14.y;
CellActor_SetPosition(v2->unk_68, &v0);
CellActor_SetAffineScale(v2->unk_68, &v1);
CellActor_SetAffineZRotation(v2->unk_68, sub_0201D2A4((v2->unk_38) / FX32_ONE));
CellActor_SetAffineZRotation(v2->unk_68, CalcAngleRotationIdx_Wraparound((v2->unk_38) / FX32_ONE));
CellActor_SetPriority(v2->unk_68, 132);
CellActor_SetDrawFlag(v2->unk_68, 1);
@ -731,7 +731,7 @@ static void ov6_02243950(UnkStruct_ov101_021D5D90 *param0)
CellActor_SetAffineOverwriteMode(v3, 2);
CellActor_SetAffineTranslation(v3, &v4);
CellActor_SetAffineScale(v3, &v5);
CellActor_SetAffineZRotation(v3, sub_0201D2A4(0));
CellActor_SetAffineZRotation(v3, CalcAngleRotationIdx_Wraparound(0));
CellActor_SetAnim(v3, 2);
}
@ -758,8 +758,8 @@ static int ov6_02243AB8(UnkStruct_ov6_02249110 *param0)
param0->unk_4C = 0x1000;
}
param0->unk_14.x = sub_0201D264(45) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = sub_0201D250((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.x = CalcCosineDegrees_Wraparound(45) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = CalcSineDegrees_Wraparound((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
if (((param0->unk_40) / FX32_ONE) < 90) {
param0->unk_40 += 0x4000;
@ -823,15 +823,15 @@ static int ov6_02243BEC(UnkStruct_ov6_02249110 *param0)
param0->unk_4C = (FX32_ONE * 16);
}
param0->unk_14.x = sub_0201D264((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = sub_0201D250(128) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.x = CalcCosineDegrees_Wraparound((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = CalcSineDegrees_Wraparound(128) * ((param0->unk_48) / FX32_ONE);
if (param0->unk_40 < (FX32_ONE * 160)) {
param0->unk_40 += 0x1000;
}
param0->unk_38 += 0x2000;
CellActor_SetAffineZRotation(v1, sub_0201D2A4((param0->unk_38) / FX32_ONE));
CellActor_SetAffineZRotation(v1, CalcAngleRotationIdx_Wraparound((param0->unk_38) / FX32_ONE));
param0->unk_2C.x += param0->unk_50;
if (param0->unk_2C.x > 0x1000) {
@ -895,7 +895,7 @@ static int ov6_02243CFC(UnkStruct_ov6_02249110 *param0)
CellActor_SetPosition(param0->unk_68, &v0);
CellActor_SetAffineScale(param0->unk_68, &v1);
CellActor_SetAffineZRotation(param0->unk_68, sub_0201D2A4((param0->unk_38) / FX32_ONE));
CellActor_SetAffineZRotation(param0->unk_68, CalcAngleRotationIdx_Wraparound((param0->unk_38) / FX32_ONE));
CellActor_SetDrawFlag(param0->unk_68, 1);
CellActor_SetAnim(param0->unk_58.unk_08, 6);
CellActor_SetAnimateFlag(param0->unk_58.unk_08, 1);
@ -920,8 +920,8 @@ static int ov6_02243DC0(UnkStruct_ov6_02249110 *param0)
param0->unk_48 = 0;
}
param0->unk_14.x = sub_0201D264(315) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = sub_0201D250((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.x = CalcCosineDegrees_Wraparound(315) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = CalcSineDegrees_Wraparound((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
if (((param0->unk_40) / FX32_ONE) < 180) {
param0->unk_40 -= 0x4000;
@ -946,7 +946,7 @@ static int ov6_02243DC0(UnkStruct_ov6_02249110 *param0)
param0->unk_38 = (FX32_ONE * 60);
}
CellActor_SetAffineZRotation(v1, sub_0201D2A4((param0->unk_38) / FX32_ONE));
CellActor_SetAffineZRotation(v1, CalcAngleRotationIdx_Wraparound((param0->unk_38) / FX32_ONE));
v0.x = param0->unk_08.x + param0->unk_14.x;
v0.y = param0->unk_08.y + param0->unk_14.y;
@ -1906,7 +1906,7 @@ static CellActor *ov6_02244D4C(UnkStruct_ov6_02243FFC *param0, const VecFx32 *pa
CellActor_SetAffineOverwriteMode(v0, 2);
CellActor_SetAffineTranslation(v0, &v1);
CellActor_SetAffineScale(v0, &v2);
CellActor_SetAffineZRotation(v0, sub_0201D2A4(0));
CellActor_SetAffineZRotation(v0, CalcAngleRotationIdx_Wraparound(0));
return v0;
}
@ -2411,7 +2411,7 @@ static void ov6_0224551C(UnkStruct_ov6_02243FFC *param0)
CellActor_SetPosition(v2->unk_58, &v0);
CellActor_SetAffineScale(v2->unk_58, &v1);
CellActor_SetAffineZRotation(v2->unk_58, sub_0201D2A4((v2->unk_38) / FX32_ONE));
CellActor_SetAffineZRotation(v2->unk_58, CalcAngleRotationIdx_Wraparound((v2->unk_38) / FX32_ONE));
CellActor_SetDrawFlag(v2->unk_58, 1);
}
@ -2426,8 +2426,8 @@ static int ov6_022455C4(UnkStruct_ov6_02249198 *param0)
param0->unk_4C += 0x4000;
}
param0->unk_14.x = sub_0201D264(315) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = sub_0201D250((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.x = CalcCosineDegrees_Wraparound(315) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = CalcSineDegrees_Wraparound((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
if (((param0->unk_40) / FX32_ONE) < 270) {
param0->unk_40 += 0x4000;
@ -2452,7 +2452,7 @@ static int ov6_022455C4(UnkStruct_ov6_02249198 *param0)
param0->unk_38 = 0;
}
CellActor_SetAffineZRotation(v1, sub_0201D2A4((param0->unk_38) / FX32_ONE));
CellActor_SetAffineZRotation(v1, CalcAngleRotationIdx_Wraparound((param0->unk_38) / FX32_ONE));
v0.x = param0->unk_08.x + param0->unk_14.x;
v0.y = param0->unk_08.y + param0->unk_14.y;
@ -2498,15 +2498,15 @@ static void ov6_022456D4(UnkStruct_ov6_02243FFC *param0)
v2->unk_40 = (FX32_ONE * 225);
v2->unk_48 = (FX32_ONE * (128 + 64));
v2->unk_4C = (FX32_ONE * 32);
v2->unk_14.x = sub_0201D264(315) * ((v2->unk_48) / FX32_ONE);
v2->unk_14.y = sub_0201D250((v2->unk_40) / FX32_ONE) * ((v2->unk_48) / FX32_ONE);
v2->unk_14.x = CalcCosineDegrees_Wraparound(315) * ((v2->unk_48) / FX32_ONE);
v2->unk_14.y = CalcSineDegrees_Wraparound((v2->unk_40) / FX32_ONE) * ((v2->unk_48) / FX32_ONE);
v0.x = v2->unk_08.x + v2->unk_14.x;
v0.y = v2->unk_08.y + v2->unk_14.y;
CellActor_SetPosition(v2->unk_58, &v0);
CellActor_SetAffineScale(v2->unk_58, &v1);
CellActor_SetAffineZRotation(v2->unk_58, sub_0201D2A4((v2->unk_38) / FX32_ONE));
CellActor_SetAffineZRotation(v2->unk_58, CalcAngleRotationIdx_Wraparound((v2->unk_38) / FX32_ONE));
CellActor_SetDrawFlag(v2->unk_58, 1);
v2->unk_60 = ov6_02245B4C(param0->unk_244, param0->unk_248);
@ -2525,7 +2525,7 @@ static void ov6_022456D4(UnkStruct_ov6_02243FFC *param0)
CellActor_SetAffineOverwriteMode(v3, 2);
CellActor_SetAffineTranslation(v3, &v4);
CellActor_SetAffineScale(v3, &v5);
CellActor_SetAffineZRotation(v3, sub_0201D2A4(0));
CellActor_SetAffineZRotation(v3, CalcAngleRotationIdx_Wraparound(0));
}
}
@ -2548,8 +2548,8 @@ static int ov6_02245840(UnkStruct_ov6_02249198 *param0)
param0->unk_4C = 0x1000;
}
param0->unk_14.x = sub_0201D264(315) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = sub_0201D250((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.x = CalcCosineDegrees_Wraparound(315) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = CalcSineDegrees_Wraparound((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
if (((param0->unk_40) / FX32_ONE) < 270) {
param0->unk_40 += 0x4000;
@ -2574,7 +2574,7 @@ static int ov6_02245840(UnkStruct_ov6_02249198 *param0)
param0->unk_38 = (FX32_ONE * 360);
}
CellActor_SetAffineZRotation(v1, sub_0201D2A4((param0->unk_38) / FX32_ONE));
CellActor_SetAffineZRotation(v1, CalcAngleRotationIdx_Wraparound((param0->unk_38) / FX32_ONE));
v0.x = param0->unk_08.x + param0->unk_14.x;
v0.y = param0->unk_08.y + param0->unk_14.y;
@ -2657,8 +2657,8 @@ static int ov6_02245A0C(UnkStruct_ov6_02249198 *param0)
param0->unk_4C = (FX32_ONE * 16);
}
param0->unk_14.x = sub_0201D264((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = sub_0201D250(128) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.x = CalcCosineDegrees_Wraparound((param0->unk_40) / FX32_ONE) * ((param0->unk_48) / FX32_ONE);
param0->unk_14.y = CalcSineDegrees_Wraparound(128) * ((param0->unk_48) / FX32_ONE);
if (param0->unk_40 < (FX32_ONE * 135)) {
param0->unk_40 += 0x1000;

View File

@ -2844,12 +2844,12 @@ static void ov9_0224B2CC(UnkStruct_ov101_021D5D90 *param0, void *param1)
v3 = v4->unk_08.unk_04.unk_18;
v3.x += (FX32_ONE * 0) + (sub_0201D1D4((v4->unk_00) / FX32_ONE) * v4->unk_08.unk_04.unk_10);
v3.y += (FX32_ONE * -512) + (sub_0201D15C((v4->unk_00) / FX32_ONE) * v4->unk_08.unk_04.unk_10);
v3.x += (FX32_ONE * 0) + (CalcCosineDegrees((v4->unk_00) / FX32_ONE) * v4->unk_08.unk_04.unk_10);
v3.y += (FX32_ONE * -512) + (CalcSineDegrees((v4->unk_00) / FX32_ONE) * v4->unk_08.unk_04.unk_10);
sub_020715D4(param0, &v3);
CellActor_SetPosition(v4->unk_40, &v3);
CellActor_SetAffineZRotation(v4->unk_40, sub_0201D2A4((v0) / FX32_ONE));
CellActor_SetAffineZRotation(v4->unk_40, CalcAngleRotationIdx_Wraparound((v0) / FX32_ONE));
}
static void ov9_0224B3A4(UnkStruct_ov101_021D5D90 *param0, void *param1)

View File

@ -2912,7 +2912,7 @@ static void ov12_02229A6C(SysTask *param0, void *param1)
if (v0->unk_30) {
v0->unk_2C += (360 / (v0->unk_06));
SPLEmitter_SetPosY(v0->unk_38, (v0->unk_A8[0].unk_02 * 172) + sub_0201D250(v0->unk_2C));
SPLEmitter_SetPosY(v0->unk_38, (v0->unk_A8[0].unk_02 * 172) + CalcSineDegrees_Wraparound(v0->unk_2C));
}
}
}

View File

@ -1913,8 +1913,8 @@ static void ov17_022434E0(SysTask *param0, void *param1)
}
v3 = v0->unk_10 / 0x100;
v1 = FX_Mul(sub_0201D1D4(v0->unk_1E / 100), v3 << FX32_SHIFT) / FX32_ONE;
v2 = FX_Mul(sub_0201D15C(v0->unk_1E / 100), v3 << FX32_SHIFT) / FX32_ONE;
v1 = FX_Mul(CalcCosineDegrees(v0->unk_1E / 100), v3 << FX32_SHIFT) / FX32_ONE;
v2 = FX_Mul(CalcSineDegrees(v0->unk_1E / 100), v3 << FX32_SHIFT) / FX32_ONE;
SpriteActor_SetSpritePositionXY(v0->unk_08, v0->unk_21 + v1, v0->unk_22 + v2);
break;
default:
@ -2023,8 +2023,8 @@ static void ov17_02243750(SysTask *param0, void *param1)
v0->unk_0C -= 360 * 100;
}
v3 = FX_Mul(sub_0201D15C(v0->unk_0C / 100), (12 << FX32_SHIFT)) / FX32_ONE;
v4 = FX_Mul(sub_0201D1D4(v0->unk_0C / 100), (6 << FX32_SHIFT)) / FX32_ONE;
v3 = FX_Mul(CalcSineDegrees(v0->unk_0C / 100), (12 << FX32_SHIFT)) / FX32_ONE;
v4 = FX_Mul(CalcCosineDegrees(v0->unk_0C / 100), (6 << FX32_SHIFT)) / FX32_ONE;
v0->unk_20 += 0x80;
SpriteActor_SetSpritePositionXY(v0->unk_04, (v0->unk_1C >> 8) + v3, (v0->unk_20 >> 8) + v4);

View File

@ -143,7 +143,7 @@ static void ov17_02247840(SysTask *param0, void *param1)
switch (v0->unk_14) {
case 0:
v1 = sub_0201D2B8(v0->unk_10) * 8 / FX32_ONE;
v1 = CalcSineDegrees_FX32(v0->unk_10) * 8 / FX32_ONE;
v0->unk_10 += (6 << FX32_SHIFT);
v0->unk_0C -= 0x100;

View File

@ -1878,7 +1878,7 @@ static void ov17_0224BF58(UnkStruct_ov17_0224BE50 *param0)
}
v2 = (param0->unk_19 == 0) ? 3 : 3;
v1 = sub_0201D1D4(param0->unk_14 >> 8) * v2 / FX32_ONE;
v1 = CalcCosineDegrees(param0->unk_14 >> 8) * v2 / FX32_ONE;
param0->unk_0C->unk_04 = v1 + Unk_ov17_022546F4[param0->unk_19][0] - v2;
ov22_0225B100(param0->unk_0C->unk_00, param0->unk_0C->unk_04, param0->unk_0C->unk_08);
@ -2063,7 +2063,7 @@ void ov17_0224C49C(UnkStruct_ov17_0224C384 *param0, u32 param1, u32 param2, int
v7 = (256 - v6) / 2;
v3 = v0 + v7;
v4 = (0x12 * 8);
v4 -= sub_0201D15C(v5) * 10 / FX32_ONE;
v4 -= CalcSineDegrees(v5) * 10 / FX32_ONE;
sub_0200D500(param0->unk_04, v3, v4, (256 * FX32_ONE));
SpriteActor_EnableObject(param0->unk_04, 1);
@ -2217,7 +2217,7 @@ static void ov17_0224C7B8(SysTask *param0, void *param1)
v0->unk_24 = v0->unk_28;
v0->unk_10++;
case 1:
v1 = sub_0201D2B8(v0->unk_20) * 4 / FX32_ONE;
v1 = CalcSineDegrees_FX32(v0->unk_20) * 4 / FX32_ONE;
v2 = v0->unk_20;
v0->unk_20 += (50 << FX32_SHIFT);

View File

@ -562,7 +562,7 @@ static void ov17_02251140(SysTask *param0, void *param1)
v0->unk_1C -= 360 << 8;
}
v0->unk_10 = FX_Mul(sub_0201D15C(v0->unk_1C / 0x100), v0->unk_12 << FX32_SHIFT) / FX32_ONE;
v0->unk_10 = FX_Mul(CalcSineDegrees(v0->unk_1C / 0x100), v0->unk_12 << FX32_SHIFT) / FX32_ONE;
v0->unk_08 -= v0->unk_14;
v0->unk_0C += 0x280;

View File

@ -592,7 +592,7 @@ static void ov19_021D9600(SysTask *param0, void *param1)
v0->unk_0C += v0->unk_1C;
v1.y = v0->unk_0C;
v0->unk_18 += v0->unk_20;
v2 = v0->unk_24 * sub_0201D15C(v0->unk_18 >> FX32_SHIFT);
v2 = v0->unk_24 * CalcSineDegrees(v0->unk_18 >> FX32_SHIFT);
v1.x = v0->unk_14 + v2;
CellActor_SetPosition(v0->unk_00, &v1);

View File

@ -356,7 +356,7 @@ static void ov19_021DD024(UnkStruct_ov19_021DCF88 *param0)
for (v3 = 1; v3 < (16 - 1); v3++) {
v0 += v2;
param0->unk_D4[v3] = (sub_0201D15C(v0 >> FX32_SHIFT) * 16) >> FX32_SHIFT;
param0->unk_D4[v3] = (CalcSineDegrees(v0 >> FX32_SHIFT) * 16) >> FX32_SHIFT;
param0->unk_E4[v3] = 16 - param0->unk_D4[v3];
}

View File

@ -337,7 +337,7 @@ static int ov21_021D7950(void *param0, UnkStruct_ov21_021E6B20 *param1, const vo
ov21_021D84A8(v3->unk_00[2], v3->unk_0C[2], -14, 2, 5);
if (v0->unk_1C->unk_20 == 0) {
ov21_021D8354(v3, v2, sub_0201D580(524, v1->unk_0C), v1->unk_1C);
ov21_021D8354(v3, v2, CalcRadialAngle(524, v1->unk_0C), v1->unk_1C);
} else if (v0->unk_1C->unk_20 == 1) {
ov21_021D83C0(v3, v2, v0);
} else {
@ -831,7 +831,7 @@ static void ov21_021D8324(UnkStruct_ov21_021D7A64 *param0)
v3 = gCoreSys.touchX - (128 + 120);
v2 = gCoreSys.touchY - (104 + -0);
param0->unk_0C = sub_0201D4CC(v1, v0, v3, v2, 524);
param0->unk_0C = CalcDotProduct2D(v1, v0, v3, v2, 524);
param0->unk_0C *= 10;
}

View File

@ -1017,7 +1017,7 @@ static void ov21_021E5A44(UnkStruct_ov21_021E51DC *param0)
v0 = param0->unk_58 - 157;
v3 = gCoreSys.touchX - 51;
v2 = gCoreSys.touchY - 157;
v4 = sub_0201D4CC(v1, v0, v3, v2, 0);
v4 = CalcDotProduct2D(v1, v0, v3, v2, 0);
if (MATH_IAbs(v4) < 1) {
return;
@ -1101,7 +1101,7 @@ static void ov21_021E5AD8(UnkStruct_ov21_021E51DC *param0)
static void ov21_021E5B50(UnkStruct_ov21_021E5004 *param0, const UnkStruct_ov21_021E51DC *param1)
{
CellActor_SetAffineZRotation(param0->unk_00, sub_0201D580(14, param1->unk_5C));
CellActor_SetAffineZRotation(param0->unk_00, CalcRadialAngle(14, param1->unk_5C));
}
static void ov21_021E5B6C(UnkStruct_ov21_021E5004 *param0, UnkStruct_ov21_021E4DA4 *param1, const UnkStruct_ov21_021E51DC *param2)

View File

@ -789,7 +789,7 @@ static void ov33_0225718C(UnkStruct_ov33_02256474 *param0, const UnkStruct_ov33_
v0->unk_34_val3[2] = 2;
}
VEC_Set(&v0->unk_20, 0, -20 * sub_0201D15C(v0->unk_34_val3[1]), 0);
VEC_Set(&v0->unk_20, 0, -20 * CalcSineDegrees(v0->unk_34_val3[1]), 0);
VEC_Add(&v0->unk_14, &v0->unk_20, &param0->unk_A4);
ov25_02255900(v0->unk_00, param0->unk_A4.x, param0->unk_A4.y);

View File

@ -195,7 +195,7 @@ static void ov53_022565E0(SysTask *param0, void *param1)
fx32 v4;
v3 = ((((180 << FX32_SHIFT) / 16) * v2) + FX32_HALF) >> FX32_SHIFT;
v4 = sub_0201D15C(v3) * 24;
v4 = CalcSineDegrees(v3) * 24;
ov25_02255900(v0->unk_9C, v0->unk_A4, v0->unk_A0 - v4);
}
ov25_0225524C(param1);

View File

@ -1596,7 +1596,7 @@ static void ov58_021D2888(u16 *param0)
*param0 = 0;
}
v0 = sub_0201D250(*param0);
v0 = CalcSineDegrees_Wraparound(*param0);
v3 = 15 + (v0 * 10) / FX32_ONE;
v1 = GX_RGB(29, v3, 0);

View File

@ -1434,7 +1434,7 @@ static void ov59_021D23B0(u16 *param0)
*param0 = 0;
}
v0 = sub_0201D250(*param0);
v0 = CalcSineDegrees_Wraparound(*param0);
v3 = 15 + (v0 * 10) / FX32_ONE;
v1 = GX_RGB(29, v3, 0);

View File

@ -551,7 +551,7 @@ void ov62_02230C28(SysTask *param0, void *param1)
sub_0200D638(v0->unk_00[0], &v1, &v2);
sub_0200D638(v0->unk_00[1], &v3, &v4);
v1 = v1 + ((sub_0201D250((v0->unk_20 * 0xffff) / 360) * 1) * (v0->unk_18 * -1));
v1 = v1 + ((CalcSineDegrees_Wraparound((v0->unk_20 * 0xffff) / 360) * 1) * (v0->unk_18 * -1));
v3 = v1;
v0->unk_20 += 32;
@ -607,7 +607,7 @@ void ov62_02230C28(SysTask *param0, void *param1)
sub_0200D638(v0->unk_00[0], &v9, &v10);
sub_0200D638(v0->unk_00[1], &v11, &v12);
v9 = v0->unk_0C + ((sub_0201D250((v0->unk_20 * 0xffff) / 360) * 3) * (v0->unk_18 * -1));
v9 = v0->unk_0C + ((CalcSineDegrees_Wraparound((v0->unk_20 * 0xffff) / 360) * 3) * (v0->unk_18 * -1));
v11 = v9;
if (v0->unk_19 % 2) {

View File

@ -336,7 +336,7 @@ BOOL ov62_02235008(UnkStruct_0208C06C *param0)
}
v8 = v6 * FX32_ONE;
v7 = v0->unk_00[v3].unk_0C + (sub_0201D250((v0->unk_00[v3].unk_04 * 0xffff) / 360) * 16);
v7 = v0->unk_00[v3].unk_0C + (CalcSineDegrees_Wraparound((v0->unk_00[v3].unk_04 * 0xffff) / 360) * 16);
v0->unk_00[v3].unk_04 += (-4 * 1);
sub_0200D614(param0->unk_534.unk_C8[v3].unk_00, v7, v8);

View File

@ -473,8 +473,8 @@ static BOOL ov62_022375A4(UnkStruct_0208C06C *param0)
v0->unk_04[v1] = 1.0f;
}
v4 = (128 << FX32_SHIFT) + sub_0201D250(v0->unk_2C[v1]) * v0->unk_18[v1];
v5 = (106 << FX32_SHIFT) - sub_0201D264(v0->unk_2C[v1]) * v0->unk_18[v1];
v4 = (128 << FX32_SHIFT) + CalcSineDegrees_Wraparound(v0->unk_2C[v1]) * v0->unk_18[v1];
v5 = (106 << FX32_SHIFT) - CalcCosineDegrees_Wraparound(v0->unk_2C[v1]) * v0->unk_18[v1];
sub_0200D614(v0->unk_68[v1], v4, v5);
SpriteActor_GetSpritePositionXY(v0->unk_68[v1], &v2, &v3);
@ -523,8 +523,8 @@ static BOOL ov62_022376C4(UnkStruct_0208C06C *param0)
SpriteActor_EnableObject(v0->unk_54[v1], 0);
}
v4 = (128 << FX32_SHIFT) - sub_0201D250(v0->unk_2C[v1]) * v0->unk_18[v1];
v5 = (106 << FX32_SHIFT) - sub_0201D264(v0->unk_2C[v1]) * v0->unk_18[v1];
v4 = (128 << FX32_SHIFT) - CalcSineDegrees_Wraparound(v0->unk_2C[v1]) * v0->unk_18[v1];
v5 = (106 << FX32_SHIFT) - CalcCosineDegrees_Wraparound(v0->unk_2C[v1]) * v0->unk_18[v1];
sub_0200D614(v0->unk_68[v1], v4, v5);
SpriteActor_GetSpritePositionXY(v0->unk_68[v1], &v2, &v3);

View File

@ -939,7 +939,7 @@ static void ov65_02235EF8(UnkStruct_ov65_02235130 *param0, UnkStruct_ov65_022354
v0.unk_02 = ov63_0222BF90(param1->unk_00, 1);
v1 = v0;
v0.unk_02 += FX_Mul(sub_0201D15C(param1->unk_08), -192 * FX32_ONE) >> FX32_SHIFT;
v0.unk_02 += FX_Mul(CalcSineDegrees(param1->unk_08), -192 * FX32_ONE) >> FX32_SHIFT;
ov63_0222CFE0(param1->unk_04, v0);
ov63_0222D060(param1->unk_04, v1);
@ -960,7 +960,7 @@ static void ov65_02235F94(UnkStruct_ov65_02235130 *param0, UnkStruct_ov65_022354
if (v3 > 0) {
v3 = v3 % 6;
v0 = (180 * v3) / 6;
v1.unk_02 -= FX_Mul(sub_0201D15C(v0), 4 * FX32_ONE) >> FX32_SHIFT;
v1.unk_02 -= FX_Mul(CalcSineDegrees(v0), 4 * FX32_ONE) >> FX32_SHIFT;
}
ov63_0222CFE0(param1->unk_04, v1);

View File

@ -1283,11 +1283,11 @@ static u32 ov69_0225D194(const VecFx32 *param0, const VecFx32 *param1)
v0 = MATH_ABS(param0->x - param1->x);
v1 = MATH_ABS(param0->y - param1->y);
if (v0 > sub_0201D278(180)) {
if (v0 > CalcAngleRotationIdx(180)) {
v0 = 0xffff - v0;
}
if (v1 > sub_0201D278(180)) {
if (v1 > CalcAngleRotationIdx(180)) {
v1 = 0xffff - v1;
}

View File

@ -1133,8 +1133,8 @@ static void ov70_0225D81C(UnkStruct_ov70_0225CC54 *param0, UnkStruct_ov70_0225CA
v2 = v2 % 6;
v0 = (180 * v2) / 6;
v1.z += FX_Mul(sub_0201D15C(v0), -2 * FX32_ONE);
v1.y += FX_Mul(sub_0201D15C(v0), 10 * FX32_ONE);
v1.z += FX_Mul(CalcSineDegrees(v0), -2 * FX32_ONE);
v1.y += FX_Mul(CalcSineDegrees(v0), 10 * FX32_ONE);
}
ov66_022347F8(param0->unk_04, &v1);

View File

@ -346,7 +346,7 @@ static void ov70_0226D31C(UnkStruct_ov70_0226D2A0 *param0, UnkStruct_ov70_02261E
{
param0->unk_04.val1.unk_00 = 0;
param0->unk_04.val1.unk_02 = 8;
param0->unk_04.val1.unk_04 = (sub_0201D2A4(5));
param0->unk_04.val1.unk_04 = (CalcAngleRotationIdx_Wraparound(5));
param0->unk_04.val1.unk_06 = 2;
param0->unk_04.val1.unk_08 = 4;
}
@ -355,7 +355,7 @@ static void ov70_0226D33C(UnkStruct_ov70_0226D2A0 *param0, UnkStruct_ov70_02261E
{
param0->unk_04.val1.unk_00 = 0;
param0->unk_04.val1.unk_02 = 16;
param0->unk_04.val1.unk_04 = (sub_0201D2A4(10));
param0->unk_04.val1.unk_04 = (CalcAngleRotationIdx_Wraparound(10));
param0->unk_04.val1.unk_06 = 4;
param0->unk_04.val1.unk_08 = 2;
}

View File

@ -1069,7 +1069,7 @@ static void ov72_0223E8D0(u16 *param0)
*param0 = 0;
}
v0 = sub_0201D250(*param0);
v0 = CalcSineDegrees_Wraparound(*param0);
v3 = 15 + (v0 * 10) / FX32_ONE;
v1 = GX_RGB(29, v3, 0);

View File

@ -530,7 +530,7 @@ static void ov77_021D1568(UnkStruct_ov77_021D1568 *param0, UnkStruct_ov77_021D12
param0->unk_2A8 += 2;
param0->unk_2A8 %= 360;
v1 = sub_0201D250((param0->unk_2A8 * 0xffff) / 360);
v1 = CalcSineDegrees_Wraparound((param0->unk_2A8 * 0xffff) / 360);
v1 *= 0.30;
param1->unk_80.y -= v1;

View File

@ -840,7 +840,7 @@ static void ov79_021D2E74(SysTask *param0, void *param1)
v3.y = v2->unk_00.y + FX_Mul(v2->unk_18.y, v0->unk_0C);
v4 = FX_Mul(v2->unk_48, v0->unk_0C);
v4 = FX_Mul(sub_0201D250(v4 >> 12), FX32_CONST(-64));
v4 = FX_Mul(CalcSineDegrees_Wraparound(v4 >> 12), FX32_CONST(-64));
v5 = FX32_ONE;
v3.y += FX_Mul(v4, v5);
@ -1063,7 +1063,7 @@ static void ov79_021D34A8(SysTask *param0, void *param1)
sub_02007DEC(v1->unk_C8, 1, v3.y >> 12);
v4 = FX_Mul(v2->unk_48, v0->unk_0C);
v4 = FX_Mul(sub_0201D250(v4 >> 12), FX32_CONST(-6));
v4 = FX_Mul(CalcSineDegrees_Wraparound(v4 >> 12), FX32_CONST(-6));
sub_02007DEC(v1->unk_C8, 4, v4 >> 12);
@ -1161,7 +1161,7 @@ static void ov79_021D36F0(SysTask *param0, void *param1)
VecFx32 v3;
fx32 v4, v5;
v4 = sub_0201D250(v2->unk_50);
v4 = CalcSineDegrees_Wraparound(v2->unk_50);
v5 = FX_Mul(v4, FX32_CONST(2));
if (v2->unk_50 > 359) {

View File

@ -37,7 +37,7 @@ s32 ov83_0223F7F4(int param0, int param1, int param2, int param3, int param4, in
param2 -= param4;
param3 -= param5;
v3 = sub_0201D4CC(param2, param3, param0, param1, 0);
v3 = CalcDotProduct2D(param2, param3, param0, param1, 0);
v3 = ((v3) * 160);
return v3;
@ -195,7 +195,7 @@ u16 ov83_0223F900(UnkStruct_ov83_0223F8AC *param0, const UnkStruct_ov83_0223FE50
}
v5 = param0->unk_08;
param0->unk_08 += sub_0201D580(68, ((param0->unk_0C) / 160));
param0->unk_08 += CalcRadialAngle(68, ((param0->unk_0C) / 160));
if (((param3 == 0) && (param0->unk_0C >= 0)) || ((param3 == 1) && (param0->unk_0C < 0))) {
if (param3 == 0) {

View File

@ -2968,8 +2968,8 @@ static BOOL ov84_0223EB84(UnkStruct_ov84_0223B5A0 *param0, u16 param1)
if (ov84_0223EB6C() == 1) {
s32 v0, v1;
v0 = sub_0201D4CC(128 - param0->unk_49E, 80 - param0->unk_4A0, 128 - gCoreSys.touchX, 80 - gCoreSys.touchY, 80);
v1 = sub_0201D580(80, v0 * 2);
v0 = CalcDotProduct2D(128 - param0->unk_49E, 80 - param0->unk_4A0, 128 - gCoreSys.touchX, 80 - gCoreSys.touchY, 80);
v1 = CalcRadialAngle(80, v0 * 2);
v1 = ((v1 << 8) / 182) >> 8;
param0->unk_49A += v1;

View File

@ -1607,8 +1607,8 @@ static void inline inline_ov86_0223CB74(UnkStruct_ov86_0223CAE4 *param0)
int v0 = param0->unk_808 >> FX32_SHIFT;
fx32 v1, v2;
v1 = param0->unk_818 + FX_Mul(sub_0201D1D4(v0), 10240);
v2 = FX_Mul(sub_0201D15C(v0), 10240) - FX16_ONE;
v1 = param0->unk_818 + FX_Mul(CalcCosineDegrees(v0), 10240);
v2 = FX_Mul(CalcSineDegrees(v0), 10240) - FX16_ONE;
VEC_Fx16Set(&(param0->unk_826), v1 - 576, v2, 0);
VEC_Fx16Set(&(param0->unk_82C), v1 + 576, v2, 0);

View File

@ -1545,7 +1545,7 @@ static void ov88_0223CEF0(u16 *param0)
*param0 = 0;
}
v0 = sub_0201D250(*param0);
v0 = CalcSineDegrees_Wraparound(*param0);
v3 = 15 + (v0 * 10) / FX32_ONE;
v1 = GX_RGB(29, v3, 0);

View File

@ -1539,11 +1539,11 @@ static u32 ov92_021D28C0(const UnkStruct_ov92_021D28C0 *param0, const UnkStruct_
v0 = MATH_ABS(param0->unk_00 - param1->unk_00);
v1 = MATH_ABS(param0->unk_04 - param1->unk_04);
if (v0 > sub_0201D278(180)) {
if (v0 > CalcAngleRotationIdx(180)) {
v0 = 0xffff - v0;
}
if (v1 > sub_0201D278(180)) {
if (v1 > CalcAngleRotationIdx(180)) {
v1 = 0xffff - v1;
}

View File

@ -923,8 +923,8 @@ static void ov95_022492DC(UnkStruct_ov95_0224922C *param0)
}
}
param0->unk_14.x = param0->unk_08.x + FX_Mul(sub_0201D1D4(v0), param0->unk_38);
param0->unk_14.z = param0->unk_08.z + FX_Mul(sub_0201D15C(v0), param0->unk_3C);
param0->unk_14.x = param0->unk_08.x + FX_Mul(CalcCosineDegrees(v0), param0->unk_38);
param0->unk_14.z = param0->unk_08.z + FX_Mul(CalcSineDegrees(v0), param0->unk_3C);
param0->unk_20.y += param0->unk_56;
for (v1 = 0; v1 < 3; v1++) {

View File

@ -511,8 +511,8 @@ static void ov95_02249D38(UnkStruct_ov95_02249C28 *param0)
param0->unk_5C--;
}
param0->unk_1C.x = FX_Mul(sub_0201D1D4(v0), param0->unk_44);
param0->unk_1C.y = FX_Mul(sub_0201D15C(v0), param0->unk_48);
param0->unk_1C.x = FX_Mul(CalcCosineDegrees(v0), param0->unk_44);
param0->unk_1C.y = FX_Mul(CalcSineDegrees(v0), param0->unk_48);
param0->unk_1C.z = 0;
param0->unk_34.x += 0x300;

View File

@ -507,8 +507,8 @@ static void ov95_0224A978(UnkStruct_ov95_0224A848 *param0)
ov95_022479D4(param0->unk_0C, param0->unk_5C);
}
param0->unk_1C.x = FX_Mul(sub_0201D1D4(v0), param0->unk_44);
param0->unk_1C.y = FX_Mul(sub_0201D15C(v0), param0->unk_48);
param0->unk_1C.x = FX_Mul(CalcCosineDegrees(v0), param0->unk_44);
param0->unk_1C.y = FX_Mul(CalcSineDegrees(v0), param0->unk_48);
param0->unk_1C.z = 0;
param0->unk_34.x -= 0x300;

View File

@ -1447,8 +1447,8 @@ static void ov97_0222EA68(UnkStruct_ov97_0222E398 *param0)
int v2 = LCRNG_Next() % 360;
int v3 = 64 + (LCRNG_Next() % 32);
v1.x = param0->unk_88[v0].unk_10.x + (sub_0201D250(v2) * v3);
v1.y = param0->unk_88[v0].unk_10.y + (sub_0201D264(v2) * v3);
v1.x = param0->unk_88[v0].unk_10.x + (CalcSineDegrees_Wraparound(v2) * v3);
v1.y = param0->unk_88[v0].unk_10.y + (CalcCosineDegrees_Wraparound(v2) * v3);
CellActor_SetPosition(param0->unk_88[v0].unk_0C, &v1);
}
@ -1592,31 +1592,31 @@ static void ov97_0222EEB8(SysTask *param0, void *param1)
if (v0->unk_2C == 0) {
v0->unk_34 += 8;
v0->unk_34 %= 360;
v0->unk_40 = (sub_0201D264(v0->unk_34) * v0->unk_38) >> FX32_SHIFT;
v0->unk_40 = (CalcCosineDegrees_Wraparound(v0->unk_34) * v0->unk_38) >> FX32_SHIFT;
v1.x = v0->unk_10.x + (sub_0201D250(v0->unk_28) * v0->unk_40 * +1);
v1.y = v0->unk_10.y + (sub_0201D264(v0->unk_28) * v0->unk_44 * +1);
v1.x = v0->unk_10.x + (CalcSineDegrees_Wraparound(v0->unk_28) * v0->unk_40 * +1);
v1.y = v0->unk_10.y + (CalcCosineDegrees_Wraparound(v0->unk_28) * v0->unk_44 * +1);
} else if (v0->unk_2C == 1) {
v0->unk_34 += 8;
v0->unk_34 %= 360;
v0->unk_44 = (sub_0201D250(v0->unk_34) * v0->unk_38) >> FX32_SHIFT;
v0->unk_44 = (CalcSineDegrees_Wraparound(v0->unk_34) * v0->unk_38) >> FX32_SHIFT;
v1.x = v0->unk_10.x + (sub_0201D250(v0->unk_28) * v0->unk_40 * +1);
v1.y = v0->unk_10.y + (sub_0201D264(v0->unk_28) * v0->unk_44 * +1);
v1.x = v0->unk_10.x + (CalcSineDegrees_Wraparound(v0->unk_28) * v0->unk_40 * +1);
v1.y = v0->unk_10.y + (CalcCosineDegrees_Wraparound(v0->unk_28) * v0->unk_44 * +1);
} else if (v0->unk_2C == 2) {
v0->unk_34 += 8;
v0->unk_34 %= 360;
v0->unk_44 = (sub_0201D250(v0->unk_34) * v0->unk_38) >> FX32_SHIFT;
v0->unk_44 = (CalcSineDegrees_Wraparound(v0->unk_34) * v0->unk_38) >> FX32_SHIFT;
v1.x = v0->unk_10.x + (sub_0201D250(v0->unk_28) * v0->unk_40 * -1);
v1.y = v0->unk_10.y + (sub_0201D264(v0->unk_28) * v0->unk_44 * -1);
v1.x = v0->unk_10.x + (CalcSineDegrees_Wraparound(v0->unk_28) * v0->unk_40 * -1);
v1.y = v0->unk_10.y + (CalcCosineDegrees_Wraparound(v0->unk_28) * v0->unk_44 * -1);
} else if (v0->unk_2C == 3) {
v0->unk_34 += 8;
v0->unk_34 %= 360;
v0->unk_40 = (sub_0201D264(v0->unk_34) * v0->unk_38) >> FX32_SHIFT;
v0->unk_40 = (CalcCosineDegrees_Wraparound(v0->unk_34) * v0->unk_38) >> FX32_SHIFT;
v1.x = v0->unk_10.x + (sub_0201D250(v0->unk_28) * v0->unk_40 * -1);
v1.y = v0->unk_10.y + (sub_0201D264(v0->unk_28) * v0->unk_44 * -1);
v1.x = v0->unk_10.x + (CalcSineDegrees_Wraparound(v0->unk_28) * v0->unk_40 * -1);
v1.y = v0->unk_10.y + (CalcCosineDegrees_Wraparound(v0->unk_28) * v0->unk_44 * -1);
} else if (v0->unk_2C == 4) {
if (v0->unk_38 < (64 + 32)) {
v0->unk_38 += v0->unk_3C;
@ -1625,8 +1625,8 @@ static void ov97_0222EEB8(SysTask *param0, void *param1)
v0->unk_40 = v0->unk_38;
v0->unk_44 = v0->unk_38;
v1.x = v0->unk_10.x + (sub_0201D250(v0->unk_28) * v0->unk_40 * +1);
v1.y = v0->unk_10.y + (sub_0201D264(v0->unk_28) * v0->unk_44 * +1);
v1.x = v0->unk_10.x + (CalcSineDegrees_Wraparound(v0->unk_28) * v0->unk_40 * +1);
v1.y = v0->unk_10.y + (CalcCosineDegrees_Wraparound(v0->unk_28) * v0->unk_44 * +1);
} else if (v0->unk_2C == 5) {
if (v0->unk_38 < (64 + 32)) {
v0->unk_38 += v0->unk_3C;
@ -1635,8 +1635,8 @@ static void ov97_0222EEB8(SysTask *param0, void *param1)
v0->unk_40 = v0->unk_38;
v0->unk_44 = v0->unk_38;
v1.x = v0->unk_10.x + (sub_0201D250(v0->unk_28) * v0->unk_40 * -1);
v1.y = v0->unk_10.y + (sub_0201D264(v0->unk_28) * v0->unk_44 * -1);
v1.x = v0->unk_10.x + (CalcSineDegrees_Wraparound(v0->unk_28) * v0->unk_40 * -1);
v1.y = v0->unk_10.y + (CalcCosineDegrees_Wraparound(v0->unk_28) * v0->unk_44 * -1);
} else {
v0->unk_04 = 10;
v0->unk_1C += FX32_CONST(0.5);

View File

@ -140,7 +140,7 @@ static void ov99_021D2D18(UnkStruct_ov99_021D2CB0 *param0, UnkStruct_ov99_021D2C
v0->unk_08 -= 360 << FX32_SHIFT;
}
v2 = FX_Mul(sub_0201D2B8(v0->unk_08), v1->unk_18);
v2 = FX_Mul(CalcSineDegrees_FX32(v0->unk_08), v1->unk_18);
v0->unk_00 += v1->unk_0C;
v0->unk_04 += v1->unk_10;

View File

@ -140,8 +140,8 @@ static void ov99_021D2ED8(UnkStruct_ov99_021D2CB0 *param0, UnkStruct_ov99_021D2E
param1->unk_94[v1].unk_04 = Unk_ov99_021D4BDC[v1].unk_44;
param1->unk_94[v1].unk_10 = Unk_ov99_021D4BDC[v1].unk_10;
param1->unk_94[v1].unk_1C = Unk_ov99_021D4BDC[v1].unk_0C;
param1->unk_94[v1].unk_28 = FX_Mul(sub_0201D2B8(Unk_ov99_021D4BDC[v1].unk_10), Unk_ov99_021D4BDC[v1].unk_04);
param1->unk_94[v1].unk_2C = FX_Mul(sub_0201D2C4(Unk_ov99_021D4BDC[v1].unk_10), Unk_ov99_021D4BDC[v1].unk_08);
param1->unk_94[v1].unk_28 = FX_Mul(CalcSineDegrees_FX32(Unk_ov99_021D4BDC[v1].unk_10), Unk_ov99_021D4BDC[v1].unk_04);
param1->unk_94[v1].unk_2C = FX_Mul(CalcCosineDegrees_FX32(Unk_ov99_021D4BDC[v1].unk_10), Unk_ov99_021D4BDC[v1].unk_08);
param1->unk_94[v1].unk_34 = Unk_ov99_021D4BDC[v1].unk_00;
sub_0200D650(param0->unk_10E0[v0], param1->unk_94[v1].unk_00 + param1->unk_94[v1].unk_28, param1->unk_94[v1].unk_04 + param1->unk_94[v1].unk_2C, ((192 + 80) << FX32_SHIFT));
@ -188,8 +188,8 @@ static void ov99_021D2FD4(UnkStruct_ov99_021D2CB0 *param0, UnkStruct_ov99_021D2E
v0->unk_39++;
}
v0->unk_28 = FX_Mul(sub_0201D2B8(v0->unk_10), v1->unk_04);
v0->unk_2C = FX_Mul(sub_0201D2C4(v0->unk_10), v1->unk_08);
v0->unk_28 = FX_Mul(CalcSineDegrees_FX32(v0->unk_10), v1->unk_04);
v0->unk_2C = FX_Mul(CalcCosineDegrees_FX32(v0->unk_10), v1->unk_08);
break;
case 2:
v0->unk_00 += v0->unk_28;
@ -211,8 +211,8 @@ static void ov99_021D2FD4(UnkStruct_ov99_021D2CB0 *param0, UnkStruct_ov99_021D2E
v0->unk_18 -= 360 << FX32_SHIFT;
}
v0->unk_28 = FX_Mul(sub_0201D2B8(v0->unk_14), v1->unk_24);
v0->unk_2C = FX_Mul(sub_0201D2B8(v0->unk_18), v1->unk_28);
v0->unk_28 = FX_Mul(CalcSineDegrees_FX32(v0->unk_14), v1->unk_24);
v0->unk_2C = FX_Mul(CalcSineDegrees_FX32(v0->unk_18), v1->unk_28);
if (param0->unk_10FC >= 5970) {
v0->unk_20 -= v1->unk_2C / 20;
@ -228,13 +228,13 @@ static void ov99_021D2FD4(UnkStruct_ov99_021D2CB0 *param0, UnkStruct_ov99_021D2E
v0->unk_04 = v0->unk_04 + v0->unk_2C;
v0->unk_10 = 0;
v0->unk_1C = v1->unk_3C;
v0->unk_28 = FX_Mul(sub_0201D2B8(0), v1->unk_34);
v0->unk_2C = FX_Mul(sub_0201D2C4(0), v1->unk_38);
v0->unk_28 = FX_Mul(CalcSineDegrees_FX32(0), v1->unk_34);
v0->unk_2C = FX_Mul(CalcCosineDegrees_FX32(0), v1->unk_38);
v0->unk_39++;
case 5:
v0->unk_10 += v0->unk_1C;
v0->unk_28 = FX_Mul(sub_0201D2C4(v0->unk_10), v1->unk_34);
v0->unk_2C = FX_Mul(sub_0201D2B8(v0->unk_10), v1->unk_38);
v0->unk_28 = FX_Mul(CalcCosineDegrees_FX32(v0->unk_10), v1->unk_34);
v0->unk_2C = FX_Mul(CalcSineDegrees_FX32(v0->unk_10), v1->unk_38);
if (v0->unk_10 >= (180 << FX32_SHIFT)) {
v0->unk_39++;

View File

@ -195,7 +195,7 @@ static void ov99_021D35E8(UnkStruct_ov99_021D2CB0 *param0, UnkStruct_ov99_021D34
v0->unk_08 -= 360 << FX32_SHIFT;
}
v2 = FX_Mul(sub_0201D2B8(v0->unk_08), v1->unk_10);
v2 = FX_Mul(CalcSineDegrees_FX32(v0->unk_08), v1->unk_10);
v0->unk_00 += v1->unk_04;
v0->unk_04 += v1->unk_08;

View File

@ -89,8 +89,8 @@ static BOOL ov100_021D4104(UnkStruct_ov100_021D4104 *param0, s16 param1, s16 par
param0->unk_20 += 8;
param0->unk_20 %= 360;
v7 += (sub_0201D250(param0->unk_20) * 1);
v8 += (sub_0201D264(param0->unk_20) * 1);
v7 += (CalcSineDegrees_Wraparound(param0->unk_20) * 1);
v8 += (CalcCosineDegrees_Wraparound(param0->unk_20) * 1);
sub_0200D5E8(param0->unk_00, v7, v8);
}
@ -110,8 +110,8 @@ static void ov100_021D4214(UnkStruct_ov100_021D4104 *param0)
param0->unk_1C += 8;
param0->unk_1C %= 360;
v0 = (128 << FX32_SHIFT) + (sub_0201D250(param0->unk_1C) * 64);
v1 = (48 << FX32_SHIFT) + (sub_0201D264(param0->unk_1C) * 24);
v0 = (128 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(param0->unk_1C) * 64);
v1 = (48 << FX32_SHIFT) + (CalcCosineDegrees_Wraparound(param0->unk_1C) * 24);
sub_0200D650(param0->unk_00, v0, v1, FX32_CONST(192));
@ -125,8 +125,8 @@ static void ov100_021D4264(UnkStruct_ov100_021D4104 *param0, int param1, int par
param0->unk_1C += 8;
param0->unk_1C %= 360;
v0 = (param1 << FX32_SHIFT) + (sub_0201D250(param0->unk_1C) * param3);
v1 = (param2 << FX32_SHIFT) + (sub_0201D264(param0->unk_1C) * param4);
v0 = (param1 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(param0->unk_1C) * param3);
v1 = (param2 << FX32_SHIFT) + (CalcCosineDegrees_Wraparound(param0->unk_1C) * param4);
sub_0200D650(param0->unk_00, v0, v1, FX32_CONST(192));
}
@ -179,8 +179,8 @@ static void ov100_021D4318(UnkStruct_ov100_021D4104 *param0)
sub_0200D67C(param0->unk_00, &v0, &v1, FX32_CONST(192));
v0 += (sub_0201D250(param0->unk_20) * (3 * param0->unk_28[0]));
v1 += (sub_0201D264(param0->unk_20) * (3 * param0->unk_28[1]));
v0 += (CalcSineDegrees_Wraparound(param0->unk_20) * (3 * param0->unk_28[0]));
v1 += (CalcCosineDegrees_Wraparound(param0->unk_20) * (3 * param0->unk_28[1]));
sub_0200D650(param0->unk_00, v0, v1, FX32_CONST(192));

View File

@ -845,7 +845,7 @@ static void ov101_021D6410(UnkStruct_ov101_021D13C8 *param0, UnkStruct_ov101_021
CellActor_SetAffineOverwriteMode(param1->unk_04, 2);
CellActor_SetAffineTranslation(param1->unk_04, &v0);
CellActor_SetAffineScale(param1->unk_04, &v1);
CellActor_SetAffineZRotation(param1->unk_04, sub_0201D2A4(0));
CellActor_SetAffineZRotation(param1->unk_04, CalcAngleRotationIdx_Wraparound(0));
CellActor_SetAnimateFlag(param1->unk_04, 1);
}
@ -1105,7 +1105,7 @@ static int ov101_021D682C(UnkStruct_ov101_021D66D0 *param0)
ov101_021D84A4(param0->unk_20->unk_450, &param0->unk_24, &v0, (NNS_G2D_VRAM_TYPE_2DSUB), 1, 4, 4, 4, 4, 2, 6);
CellActor_SetAffineOverwriteMode(param0->unk_24.unk_04, 2);
CellActor_SetAffineTranslation(param0->unk_24.unk_04, &v1);
CellActor_SetAffineZRotation(param0->unk_24.unk_04, sub_0201D2A4(0));
CellActor_SetAffineZRotation(param0->unk_24.unk_04, CalcAngleRotationIdx_Wraparound(0));
param0->unk_0C = 1;
param0->unk_08++;
@ -1749,7 +1749,7 @@ static int ov101_021D7304(UnkStruct_ov101_021D5D90 *param0, void *param1)
CellActor_SetAffineOverwriteMode(v3->unk_08.unk_04, 2);
CellActor_SetAffineTranslation(v3->unk_08.unk_04, &v1);
CellActor_SetAffineScale(v3->unk_08.unk_04, &v2);
CellActor_SetAffineZRotation(v3->unk_08.unk_04, sub_0201D2A4(0));
CellActor_SetAffineZRotation(v3->unk_08.unk_04, CalcAngleRotationIdx_Wraparound(0));
CellActor_SetAnimateFlag(v3->unk_08.unk_04, 1);
return 1;
@ -1862,7 +1862,7 @@ static int ov101_021D74A0(UnkStruct_ov101_021D5D90 *param0, void *param1)
CellActor_SetAffineOverwriteMode(v3->unk_08.unk_04, 2);
CellActor_SetAffineTranslation(v3->unk_08.unk_04, &v1);
CellActor_SetAffineScale(v3->unk_08.unk_04, &v2);
CellActor_SetAffineZRotation(v3->unk_08.unk_04, sub_0201D2A4(0));
CellActor_SetAffineZRotation(v3->unk_08.unk_04, CalcAngleRotationIdx_Wraparound(0));
CellActor_SetAnimateFlag(v3->unk_08.unk_04, 1);
return 1;
@ -2136,7 +2136,7 @@ static int ov101_021D7810(UnkStruct_ov101_021D5D90 *param0, void *param1)
CellActor_SetAffineOverwriteMode(v6->unk_18[v0].unk_04, 2);
CellActor_SetAffineTranslation(v6->unk_18[v0].unk_04, &v4);
CellActor_SetAffineScale(v6->unk_18[v0].unk_04, &v5);
CellActor_SetAffineZRotation(v6->unk_18[v0].unk_04, sub_0201D2A4(0));
CellActor_SetAffineZRotation(v6->unk_18[v0].unk_04, CalcAngleRotationIdx_Wraparound(0));
v2 = (v6->unk_04 % (v1 * 10)) / v1;

View File

@ -2252,7 +2252,7 @@ static void ov104_022313FC(SysTask *param0, void *param1)
v10 = v4->unk_00[v0].unk_0C & 0xffff;
v11 = v4->unk_00[v0].unk_0C >> 16;
sub_0201D470(&v5, 0, FX32_ONE, FX32_ONE, 0);
CreateAffineTransformationMatrix(&v5, 0, FX32_ONE, FX32_ONE, AFFINE_MODE_NORMAL);
v12 = v6 + v4->unk_00[v0].unk_08;
v13 = v7 + v4->unk_00[v0].unk_0A;
@ -2317,7 +2317,7 @@ static void ov104_022313FC(SysTask *param0, void *param1)
v14 = v4->unk_00[v0].unk_0C & 0xffff;
v15 = v4->unk_00[v0].unk_0C >> 16;
sub_0201D470(&v5, 0, FX32_ONE, FX32_ONE, 0);
CreateAffineTransformationMatrix(&v5, 0, FX32_ONE, FX32_ONE, AFFINE_MODE_NORMAL);
v16 = v6 + v4->unk_00[v0].unk_08;
v17 = v7 + v4->unk_00[v0].unk_0A;

View File

@ -2482,9 +2482,9 @@ static void ov109_021D2D78(UnkStruct_ov109_021D2D78 *param0, const VecFx32 *para
ov109_021D39D4(&v1, param0->unk_20);
v0 = (u16)((v1) / FX32_ONE);
param0->unk_44.x = (FX32_ONE * 0) + param0->unk_50.x + param1->x + (sub_0201D1D4(v0) * 22);
param0->unk_44.x = (FX32_ONE * 0) + param0->unk_50.x + param1->x + (CalcCosineDegrees(v0) * 22);
param0->unk_44.y = (FX32_ONE * -6) + param0->unk_50.y + param1->y;
param0->unk_44.z = (FX32_ONE * 0) + param0->unk_50.z + param1->z + (sub_0201D15C(v0) * 22);
param0->unk_44.z = (FX32_ONE * 0) + param0->unk_50.z + param1->z + (CalcSineDegrees(v0) * 22);
param0->unk_24.unk_00 = ((param0->unk_2C.x) / FX32_ONE);
param0->unk_24.unk_02 = ((param0->unk_2C.y) / FX32_ONE);
@ -2902,7 +2902,7 @@ static void ov109_021D3370(UnkStruct_ov109_021D3370 *param0)
param0->unk_0C = (FX32_ONE * 20);
param0->unk_04++;
case 1:
v0 = sub_0201D15C((param0->unk_10) / FX32_ONE) * ((param0->unk_08) / FX32_ONE);
v0 = CalcSineDegrees((param0->unk_10) / FX32_ONE) * ((param0->unk_08) / FX32_ONE);
v1->unk_2C.z = 0;
ov109_021D39D4(&v1->unk_2C.z, v0);

View File

@ -1427,7 +1427,7 @@ static void ov109_021D5314(u16 *param0)
*param0 = 0;
}
v0 = sub_0201D250(*param0);
v0 = CalcSineDegrees_Wraparound(*param0);
v3 = 15 + (v0 * 10) / FX32_ONE;
v1 = GX_RGB(29, v3, 0);

View File

@ -1324,7 +1324,7 @@ static int ov113_0225F368(UnkStruct_ov113_0225EB20 *param0, UnkStruct_ov113_0225
v0->unk_04 -= 360 << FX32_SHIFT;
}
v5 = FX_Mul(sub_0201D2B8(v0->unk_04), 0x8000);
v5 = FX_Mul(CalcSineDegrees_FX32(v0->unk_04), 0x8000);
Easy3DObject_SetPosition(&param1->unk_1C, v2 - 0x1000, v0->unk_0C + v5, v4);
break;
}
@ -1463,7 +1463,7 @@ static int ov113_0225F728(UnkStruct_ov113_0225EB20 *param0, UnkStruct_ov113_0225
v0->unk_04 -= 360 << FX32_SHIFT;
}
v5 = FX_Mul(sub_0201D2B8(v0->unk_04), 0x8000);
v5 = FX_Mul(CalcSineDegrees_FX32(v0->unk_04), 0x8000);
Easy3DObject_SetPosition(&param1->unk_1C, v0->unk_08 + v5, v3 - 0x1000, v4);
break;
}
@ -1558,7 +1558,7 @@ static int ov113_0225F890(UnkStruct_ov113_0225EB20 *param0, UnkStruct_ov113_0225
v0->unk_F0 -= 360 << FX32_SHIFT;
}
v4 = FX_Mul(sub_0201D2B8(v0->unk_F0), 0x10000);
v4 = FX_Mul(CalcSineDegrees_FX32(v0->unk_F0), 0x10000);
Easy3DObject_GetPosition(&param1->unk_1C, &v1, &v2, &v3);
@ -1656,7 +1656,7 @@ static int ov113_0225FAB0(UnkStruct_ov113_0225EB20 *param0, UnkStruct_ov113_0225
v0->unk_F0 -= 360 << FX32_SHIFT;
}
v4 = FX_Mul(sub_0201D2B8(v0->unk_F0), 0x10000);
v4 = FX_Mul(CalcSineDegrees_FX32(v0->unk_F0), 0x10000);
Easy3DObject_GetPosition(&param1->unk_1C, &v1, &v2, &v3);
@ -2055,7 +2055,7 @@ static BOOL ov113_02260218(UnkStruct_ov113_0225EB20 *param0, UnkStruct_ov113_022
}
}
v1 = FX_Mul(sub_0201D2B8(v0->unk_08), 0x1000);
v1 = FX_Mul(CalcSineDegrees_FX32(v0->unk_08), 0x1000);
v2 = v0->cameraAngle;
v2.y = v1;
Camera_SetAngleAroundSelf(&v2, camera);
@ -2133,7 +2133,7 @@ static BOOL ov113_02260394(UnkStruct_ov113_0225EB20 *param0, UnkStruct_ov113_022
}
}
v2 = FX_Mul(sub_0201D2B8(v0->unk_18), 0x10000);
v2 = FX_Mul(CalcSineDegrees_FX32(v0->unk_18), 0x10000);
v1.x = v2;
Camera_SetTarget(&v0->unk_00, camera);
@ -2172,7 +2172,7 @@ static BOOL ov113_0226046C(UnkStruct_ov113_0225EB20 *param0, UnkStruct_ov113_022
}
}
v2 = FX_Mul(sub_0201D2B8(v0->unk_18), 0x8000);
v2 = FX_Mul(CalcSineDegrees_FX32(v0->unk_18), 0x8000);
v1.y = v2;
Camera_SetTarget(&v0->unk_00, camera);

View File

@ -3482,7 +3482,7 @@ static void ov115_0226414C(UnkStruct_ov115_02263DF8 *param0, u32 param1)
fx32 v0;
param1 -= ((20 * 0xffff) / 360);
v0 = (param1 * 90) / sub_0201D2A4(90 - ((20 * 0xffff) / 360));
v0 = (param1 * 90) / CalcAngleRotationIdx_Wraparound(90 - ((20 * 0xffff) / 360));
v0 = (v0 * (FX32_CONST(180))) / 90;
v0 = (FX32_CONST(180)) - v0;
@ -4102,8 +4102,8 @@ static void ov115_02264DD8(int param0, int param1, int param2, int param3, int p
v1 = param4 - param3;
v0 = param3 + ((param0 * v1) / param1);
*param5 = FX_Mul(sub_0201D1D4(v0), param2 << FX32_SHIFT) >> FX32_SHIFT;
*param6 = FX_Mul(sub_0201D15C(v0), param2 << FX32_SHIFT) >> FX32_SHIFT;
*param5 = FX_Mul(CalcCosineDegrees(v0), param2 << FX32_SHIFT) >> FX32_SHIFT;
*param6 = FX_Mul(CalcSineDegrees(v0), param2 << FX32_SHIFT) >> FX32_SHIFT;
}
static void ov115_02264E48(UnkStruct_ov115_02264FA0 *param0, UnkStruct_ov115_02261ADC *param1, NARC *param2, int param3, u32 param4, u32 param5, NNSFndAllocator *param6)
@ -4148,7 +4148,7 @@ static void ov115_02264E48(UnkStruct_ov115_02264FA0 *param0, UnkStruct_ov115_022
if ((v4 == 0) || (v4 == 1)) {
Easy3DObject_SetRotation(&param0->unk_00[v4], Unk_ov115_02265C5C[param3 - 1][param4], 1);
} else {
Easy3DObject_SetRotation(&param0->unk_00[v4], (sub_0201D278(180)), 1);
Easy3DObject_SetRotation(&param0->unk_00[v4], (CalcAngleRotationIdx(180)), 1);
}
}

View File

@ -407,8 +407,8 @@ void ov116_0226493C(UnkStruct_ov116_02262A8C *param0, s16 param1, s16 param2)
static inline void inline_ov116_022649E4(UnkStruct_ov116_02264FEC_sub1 *param0)
{
param0->unk_1C = FX_Mul(sub_0201D250(param0->unk_28), FX32_CONST(param0->unk_2E));
param0->unk_20 = FX_Mul(sub_0201D264(param0->unk_28), FX32_CONST(param0->unk_30));
param0->unk_1C = FX_Mul(CalcSineDegrees_Wraparound(param0->unk_28), FX32_CONST(param0->unk_2E));
param0->unk_20 = FX_Mul(CalcCosineDegrees_Wraparound(param0->unk_28), FX32_CONST(param0->unk_30));
}
static inline void inline_ov116_022649E4_1(UnkStruct_ov116_02264FEC_sub1 *wk, fx32 x, fx32 y)
@ -1252,16 +1252,16 @@ static void ov116_02265AA4(SysTask *param0, void *param1)
{
sub_0200D67C(v1->unk_00[0].unk_00, &v5, &v6, ((192 + 64) << FX32_SHIFT));
v3 = (v1->unk_00[0].unk_14 << FX32_SHIFT) + (sub_0201D250(v1->unk_00[0].unk_08) * v1->unk_00[0].unk_18);
v4 = (v1->unk_00[0].unk_16 << FX32_SHIFT) + (sub_0201D264(v1->unk_00[0].unk_08) * v1->unk_00[0].unk_1C);
v3 = (v1->unk_00[0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v1->unk_00[0].unk_08) * v1->unk_00[0].unk_18);
v4 = (v1->unk_00[0].unk_16 << FX32_SHIFT) + (CalcCosineDegrees_Wraparound(v1->unk_00[0].unk_08) * v1->unk_00[0].unk_1C);
sub_0200D650(v1->unk_00[0].unk_00, v3, v4, ((192 + 64) << FX32_SHIFT));
ov116_02264764(&v1->unk_00[0].unk_20, v3, v3 + FX32_CONST(180), ov116_022658C8(v1->unk_148));
ov116_02264764(&v1->unk_00[0].unk_38, v4, v4 - FX32_CONST(24), ov116_022658C8(v1->unk_148));
sub_0200D67C(v1->unk_A0[0].unk_00, &v5, &v6, ((192 + 64) << FX32_SHIFT));
v3 = (v1->unk_A0[0].unk_14 << FX32_SHIFT) + (sub_0201D250(v1->unk_A0[0].unk_08) * v1->unk_A0[0].unk_18);
v4 = (v1->unk_A0[0].unk_16 << FX32_SHIFT) - (sub_0201D264(v1->unk_A0[0].unk_08) * v1->unk_A0[0].unk_1C);
v3 = (v1->unk_A0[0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v1->unk_A0[0].unk_08) * v1->unk_A0[0].unk_18);
v4 = (v1->unk_A0[0].unk_16 << FX32_SHIFT) - (CalcCosineDegrees_Wraparound(v1->unk_A0[0].unk_08) * v1->unk_A0[0].unk_1C);
sub_0200D650(v1->unk_A0[0].unk_00, v3, v4, ((192 + 64) << FX32_SHIFT));
ov116_02264764(&v1->unk_A0[0].unk_20, v3, v3 - FX32_CONST(180), ov116_022658C8(v1->unk_144));
@ -1455,11 +1455,11 @@ static BOOL ov116_02265FD4(UnkStruct_ov116_02265D84 *param0, int param1, int par
sub_0200D67C(param0->unk_00, &v3, &v4, ((192 + 64) << FX32_SHIFT));
if (param2 == 0) {
v1 = (param0->unk_14 << FX32_SHIFT) - (sub_0201D250(param0->unk_08) * param0->unk_18);
v2 = (param0->unk_16 << FX32_SHIFT) - (sub_0201D264(param0->unk_08) * param0->unk_1C);
v1 = (param0->unk_14 << FX32_SHIFT) - (CalcSineDegrees_Wraparound(param0->unk_08) * param0->unk_18);
v2 = (param0->unk_16 << FX32_SHIFT) - (CalcCosineDegrees_Wraparound(param0->unk_08) * param0->unk_1C);
} else {
v1 = (param0->unk_14 << FX32_SHIFT) + (sub_0201D250(param0->unk_08) * param0->unk_18);
v2 = (param0->unk_16 << FX32_SHIFT) - (sub_0201D264(param0->unk_08) * param0->unk_1C);
v1 = (param0->unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(param0->unk_08) * param0->unk_18);
v2 = (param0->unk_16 << FX32_SHIFT) - (CalcCosineDegrees_Wraparound(param0->unk_08) * param0->unk_1C);
}
sub_0200D650(param0->unk_00, v1, v2, ((192 + 64) << FX32_SHIFT));
@ -1516,13 +1516,13 @@ static void ov116_022660A8(SysTask *param0, void *param1)
SpriteActor_EnableObject(v2->unk_A0[v0].unk_00, 1);
sub_0200D67C(v2->unk_00[v0].unk_00, &v6, &v7, ((192 + 64) << FX32_SHIFT));
v4 = (v2->unk_00[v0].unk_14 << FX32_SHIFT) + (sub_0201D250(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_18);
v5 = (v2->unk_00[v0].unk_16 << FX32_SHIFT) + (sub_0201D264(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_1C);
v4 = (v2->unk_00[v0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_18);
v5 = (v2->unk_00[v0].unk_16 << FX32_SHIFT) + (CalcCosineDegrees_Wraparound(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_1C);
sub_0200D650(v2->unk_00[v0].unk_00, v4, v5, ((192 + 64) << FX32_SHIFT));
sub_0200D67C(v2->unk_A0[v0].unk_00, &v6, &v7, ((192 + 64) << FX32_SHIFT));
v4 = (v2->unk_A0[v0].unk_14 << FX32_SHIFT) + (sub_0201D250(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_18);
v5 = (v2->unk_A0[v0].unk_16 << FX32_SHIFT) - (sub_0201D264(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_1C);
v4 = (v2->unk_A0[v0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_18);
v5 = (v2->unk_A0[v0].unk_16 << FX32_SHIFT) - (CalcCosineDegrees_Wraparound(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_1C);
sub_0200D650(v2->unk_A0[v0].unk_00, v4, v5, ((192 + 64) << FX32_SHIFT));
}
@ -1643,13 +1643,13 @@ static void ov116_0226644C(SysTask *param0, void *param1)
SpriteActor_EnableObject(v2->unk_A0[v0].unk_00, 1);
sub_0200D67C(v2->unk_00[v0].unk_00, &v6, &v7, ((192 + 64) << FX32_SHIFT));
v4 = (v2->unk_00[v0].unk_14 << FX32_SHIFT) + (sub_0201D250(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_18);
v5 = (v2->unk_00[v0].unk_16 << FX32_SHIFT) + (sub_0201D264(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_1C);
v4 = (v2->unk_00[v0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_18);
v5 = (v2->unk_00[v0].unk_16 << FX32_SHIFT) + (CalcCosineDegrees_Wraparound(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_1C);
sub_0200D650(v2->unk_00[v0].unk_00, v4, v5, ((192 + 64) << FX32_SHIFT));
sub_0200D67C(v2->unk_A0[v0].unk_00, &v6, &v7, ((192 + 64) << FX32_SHIFT));
v4 = (v2->unk_A0[v0].unk_14 << FX32_SHIFT) + (sub_0201D250(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_18);
v5 = (v2->unk_A0[v0].unk_16 << FX32_SHIFT) - (sub_0201D264(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_1C);
v4 = (v2->unk_A0[v0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_18);
v5 = (v2->unk_A0[v0].unk_16 << FX32_SHIFT) - (CalcCosineDegrees_Wraparound(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_1C);
sub_0200D650(v2->unk_A0[v0].unk_00, v4, v5, ((192 + 64) << FX32_SHIFT));
}
@ -1761,13 +1761,13 @@ static void ov116_022667F4(SysTask *param0, void *param1)
SpriteActor_EnableObject(v2->unk_A0[v0].unk_00, 1);
sub_0200D67C(v2->unk_00[v0].unk_00, &v6, &v7, ((192 + 64) << FX32_SHIFT));
v4 = (v2->unk_00[v0].unk_14 << FX32_SHIFT) + (sub_0201D250(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_18);
v5 = (v2->unk_00[v0].unk_16 << FX32_SHIFT) + (sub_0201D264(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_1C);
v4 = (v2->unk_00[v0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_18);
v5 = (v2->unk_00[v0].unk_16 << FX32_SHIFT) + (CalcCosineDegrees_Wraparound(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_1C);
sub_0200D650(v2->unk_00[v0].unk_00, v4, v5, ((192 + 64) << FX32_SHIFT));
sub_0200D67C(v2->unk_A0[v0].unk_00, &v6, &v7, ((192 + 64) << FX32_SHIFT));
v4 = (v2->unk_A0[v0].unk_14 << FX32_SHIFT) + (sub_0201D250(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_18);
v5 = (v2->unk_A0[v0].unk_16 << FX32_SHIFT) - (sub_0201D264(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_1C);
v4 = (v2->unk_A0[v0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_18);
v5 = (v2->unk_A0[v0].unk_16 << FX32_SHIFT) - (CalcCosineDegrees_Wraparound(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_1C);
sub_0200D650(v2->unk_A0[v0].unk_00, v4, v5, ((192 + 64) << FX32_SHIFT));
}
@ -1907,13 +1907,13 @@ static void ov116_02266BF0(SysTask *param0, void *param1)
SpriteActor_EnableObject(v2->unk_A0[v0].unk_00, 1);
sub_0200D67C(v2->unk_00[v0].unk_00, &v6, &v7, ((192 + 64) << FX32_SHIFT));
v4 = (v2->unk_00[v0].unk_14 << FX32_SHIFT) + (sub_0201D250(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_18);
v5 = (v2->unk_00[v0].unk_16 << FX32_SHIFT) + (sub_0201D264(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_1C);
v4 = (v2->unk_00[v0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_18);
v5 = (v2->unk_00[v0].unk_16 << FX32_SHIFT) + (CalcCosineDegrees_Wraparound(v2->unk_00[v0].unk_08) * v2->unk_00[v0].unk_1C);
sub_0200D650(v2->unk_00[v0].unk_00, v4, v5, ((192 + 64) << FX32_SHIFT));
sub_0200D67C(v2->unk_A0[v0].unk_00, &v6, &v7, ((192 + 64) << FX32_SHIFT));
v4 = (v2->unk_A0[v0].unk_14 << FX32_SHIFT) + (sub_0201D250(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_18);
v5 = (v2->unk_A0[v0].unk_16 << FX32_SHIFT) - (sub_0201D264(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_1C);
v4 = (v2->unk_A0[v0].unk_14 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_18);
v5 = (v2->unk_A0[v0].unk_16 << FX32_SHIFT) - (CalcCosineDegrees_Wraparound(v2->unk_A0[v0].unk_08) * v2->unk_A0[v0].unk_1C);
sub_0200D650(v2->unk_A0[v0].unk_00, v4, v5, ((192 + 64) << FX32_SHIFT));
}

View File

@ -960,8 +960,8 @@ BOOL ov117_02264560(UnkStruct_ov117_02261280 *param0)
v1->unk_04 = (128 + 32) << FX32_SHIFT;
}
v4 = 128 + (FX_Mul(sub_0201D2B8(v1->unk_0C), v1->unk_04)) / FX32_ONE;
v5 = 96 + (-FX_Mul(sub_0201D2C4(v1->unk_0C), v1->unk_04)) / FX32_ONE;
v4 = 128 + (FX_Mul(CalcSineDegrees_FX32(v1->unk_0C), v1->unk_04)) / FX32_ONE;
v5 = 96 + (-FX_Mul(CalcCosineDegrees_FX32(v1->unk_0C), v1->unk_04)) / FX32_ONE;
sub_0200D500(v1->unk_00, v4, v5, ((192 + 160) << FX32_SHIFT));
@ -987,8 +987,8 @@ BOOL ov117_02264560(UnkStruct_ov117_02261280 *param0)
v2->unk_04 = (128 + 32) << FX32_SHIFT;
}
v4 = 128 + (FX_Mul(sub_0201D2B8(v2->unk_0C), v2->unk_04)) / FX32_ONE;
v5 = 96 + (-FX_Mul(sub_0201D2C4(v2->unk_0C), v2->unk_04)) / FX32_ONE;
v4 = 128 + (FX_Mul(CalcSineDegrees_FX32(v2->unk_0C), v2->unk_04)) / FX32_ONE;
v5 = 96 + (-FX_Mul(CalcCosineDegrees_FX32(v2->unk_0C), v2->unk_04)) / FX32_ONE;
sub_0200D500(v2->unk_00, v4, v5, ((192 + 160) << FX32_SHIFT));
@ -1014,8 +1014,8 @@ BOOL ov117_02264560(UnkStruct_ov117_02261280 *param0)
v3->unk_04 = (128 + 32) << FX32_SHIFT;
}
v4 = 128 + (FX_Mul(sub_0201D2B8(v3->unk_0C), v3->unk_04)) / FX32_ONE;
v5 = 96 + (-FX_Mul(sub_0201D2C4(v3->unk_0C), v3->unk_04)) / FX32_ONE;
v4 = 128 + (FX_Mul(CalcSineDegrees_FX32(v3->unk_0C), v3->unk_04)) / FX32_ONE;
v5 = 96 + (-FX_Mul(CalcCosineDegrees_FX32(v3->unk_0C), v3->unk_04)) / FX32_ONE;
sub_0200D500(v3->unk_00, v4, v5, ((192 + 160) << FX32_SHIFT));
@ -1490,8 +1490,8 @@ void ov117_02265064(UnkStruct_ov117_02261280 *param0, UnkStruct_ov117_022653F4 *
v0 = Unk_ov117_02266D9C;
for (v1 = 0; v1 < 3; v1++) {
v3 = 256 / 2 + FX_Mul(sub_0201D2B8(param1->unk_E4 + param1->unk_00[v1].unk_0C), 76);
v4 = 196 / 2 + (-FX_Mul(sub_0201D2C4(param1->unk_E4 + param1->unk_00[v1].unk_0C), (64 + 4)));
v3 = 256 / 2 + FX_Mul(CalcSineDegrees_FX32(param1->unk_E4 + param1->unk_00[v1].unk_0C), 76);
v4 = 196 / 2 + (-FX_Mul(CalcCosineDegrees_FX32(param1->unk_E4 + param1->unk_00[v1].unk_0C), (64 + 4)));
param1->unk_00[v1].unk_00 = SpriteActor_LoadResources(param0->unk_24, param0->unk_28, &v0);
sub_0200D500(param1->unk_00[v1].unk_00, v3, v4 + -24, ((192 + 160) << FX32_SHIFT));
@ -1703,7 +1703,7 @@ static int ov117_02265454(UnkStruct_ov117_02261280 *param0, UnkStruct_ov117_0226
}
v6 = ((180 * param2->unk_12) << FX32_SHIFT) / 15;
v7 = -(FX_Mul(sub_0201D2B8(v6), (24 << FX32_SHIFT))) / FX32_ONE;
v7 = -(FX_Mul(CalcSineDegrees_FX32(v6), (24 << FX32_SHIFT))) / FX32_ONE;
sub_0200D500(param2->unk_00, v0, v1 + v7, ((192 + 160) << FX32_SHIFT));
sub_0200D500(param2->unk_08, v0, v1 + 24, ((192 + 160) << FX32_SHIFT));
@ -1734,9 +1734,9 @@ static int ov117_02265644(UnkStruct_ov117_02261280 *param0, UnkStruct_ov117_0226
}
v2 = ((180 * param1->unk_F3) << FX32_SHIFT) / Unk_ov117_02266BC4[param1->unk_F4].unk_00;
v3 = -(FX_Mul(sub_0201D2B8(v2), (12 << FX32_SHIFT))) / FX32_ONE;
v0 = 256 / 2 + FX_Mul(sub_0201D2B8(param1->unk_E4 + param2->unk_0C), 76);
v1 = 196 / 2 + (-FX_Mul(sub_0201D2C4(param1->unk_E4 + param2->unk_0C), (64 + 4)));
v3 = -(FX_Mul(CalcSineDegrees_FX32(v2), (12 << FX32_SHIFT))) / FX32_ONE;
v0 = 256 / 2 + FX_Mul(CalcSineDegrees_FX32(param1->unk_E4 + param2->unk_0C), 76);
v1 = 196 / 2 + (-FX_Mul(CalcCosineDegrees_FX32(param1->unk_E4 + param2->unk_0C), (64 + 4)));
sub_0200D500(param2->unk_00, v0, v1 + -24 + v3, ((192 + 160) << FX32_SHIFT));
sub_0200D500(param2->unk_08, v0, v1 + -24 + 24, ((192 + 160) << FX32_SHIFT));
@ -1821,8 +1821,8 @@ static int ov117_022657C4(UnkStruct_ov117_02261280 *param0, UnkStruct_ov117_0226
v3 += param2->unk_0C / ((360 / 12) << FX32_SHIFT);
v3 %= 12;
v4 = 256 / 2 + FX_Mul(sub_0201D2B8((360 << FX32_SHIFT) / 12 * v3), 76);
v5 = 196 / 2 + (-FX_Mul(sub_0201D2C4((360 << FX32_SHIFT) / 12 * v3), (64 + 4)));
v4 = 256 / 2 + FX_Mul(CalcSineDegrees_FX32((360 << FX32_SHIFT) / 12 * v3), 76);
v5 = 196 / 2 + (-FX_Mul(CalcCosineDegrees_FX32((360 << FX32_SHIFT) / 12 * v3), (64 + 4)));
sub_0200D5A0(param2->unk_00, &v6, &v7, ((192 + 160) << FX32_SHIFT));
@ -1841,7 +1841,7 @@ static int ov117_022657C4(UnkStruct_ov117_02261280 *param0, UnkStruct_ov117_0226
param2->unk_2C += param2->unk_24;
v8 = ((180 * param2->unk_12) << FX32_SHIFT) / param2->unk_18;
v9 = -(FX_Mul(sub_0201D2B8(v8), (12 << FX32_SHIFT))) / FX32_ONE;
v9 = -(FX_Mul(CalcSineDegrees_FX32(v8), (12 << FX32_SHIFT))) / FX32_ONE;
sub_0200D500(param2->unk_00, param2->unk_28 / FX32_ONE, param2->unk_2C / FX32_ONE + -24 + v9, ((192 + 160) << FX32_SHIFT));
sub_0200D34C(param2->unk_00, ((8 + 8 + 12 + 8 + 8) << FX32_SHIFT) / param2->unk_18);

View File

@ -288,12 +288,12 @@ static void SaveData_CheckInfoInit(SaveCheckInfo *checkInfo)
u16 SaveData_CalculateChecksum(const SaveData *saveData, const void *startAddress, u32 size)
{
return sub_0201D628(startAddress, size);
return CalcCRC16Checksum(startAddress, size);
}
static u16 SaveData_CalculateFooterChecksum(const SaveData *saveData, void *startAddress, u32 size)
{
return sub_0201D628(startAddress, size - sizeof(SaveBlockFooter));
return CalcCRC16Checksum(startAddress, size - sizeof(SaveBlockFooter));
}
static u32 SaveData_SaveOffset(int sectorID, const SaveBlockInfo *blockInfo)
@ -593,7 +593,7 @@ static BOOL SaveDataState_Load(SaveData *saveData)
}
for (i = 0; i < SAVE_TABLE_ENTRY_MAX; i++) {
saveData->pageInfo[i].checksum = sub_0201D628(SaveData_SaveTable(saveData, i), saveData->pageInfo[i].size);
saveData->pageInfo[i].checksum = CalcCRC16Checksum(SaveData_SaveTable(saveData, i), saveData->pageInfo[i].size);
}
return TRUE;
@ -931,7 +931,7 @@ static void SaveCheckFooter_Set(const SaveData *saveData, void *saveBody, int ex
footer->saveCounter = saveData->sectorCounter + 1;
footer->size = size;
footer->id = extraSaveID;
footer->checksum = sub_0201D628(saveBody, size + sizeof(SaveCheckFooter) - 2);
footer->checksum = CalcCRC16Checksum(saveBody, size + sizeof(SaveCheckFooter) - 2);
}
static BOOL SaveCheckFooter_Validate(const SaveData *saveData, void *saveBody, int extraSaveID, u32 size)
@ -950,7 +950,7 @@ static BOOL SaveCheckFooter_Validate(const SaveData *saveData, void *saveBody, i
return FALSE;
}
if (footer->checksum != sub_0201D628(saveBody, size + sizeof(SaveCheckFooter) - 2)) {
if (footer->checksum != CalcCRC16Checksum(saveBody, size + sizeof(SaveCheckFooter) - 2)) {
return FALSE;
}
@ -1331,7 +1331,7 @@ BOOL SaveData_Checksum(int saveTableID)
void *table = SaveData_SaveTable(saveData, saveTableID);
int size = SaveTableEntry_BodySize(saveTableID) - 4;
u16 checkResult = sub_0201D628(table, size);
u16 checkResult = CalcCRC16Checksum(table, size);
int halfSize = size / 2;
u16 *halfTable = table;
@ -1355,7 +1355,7 @@ void SaveData_SetChecksum(int saveTableID)
int halfSize = size / 2;
u16 *halfTable = table;
u16 checksum = sub_0201D628(table, size);
u16 checksum = CalcCRC16Checksum(table, size);
halfTable[halfSize] = checksum;

View File

@ -3,6 +3,8 @@
#include <nitro.h>
#include <string.h>
#include "constants/heap.h"
#include "struct_defs/struct_02017E74.h"
#include "core_sys.h"
@ -183,7 +185,7 @@ void sub_0201789C(void)
CARD_SetCacheFlushThreshold(0x500, 0x2400);
sub_0201D640(0);
InitCRC16Table(HEAP_ID_SYSTEM);
}
void InitGraphics(void)

View File

@ -64,10 +64,10 @@ void sub_0201E2E0(MtxFx33 *param0, u16 param1, u16 param2, u16 param3)
{
MtxFx33 v0;
MTX_RotX33(param0, sub_0201D15C(param1), sub_0201D1D4(param1));
MTX_RotY33(&v0, sub_0201D15C(param2), sub_0201D1D4(param2));
MTX_RotX33(param0, CalcSineDegrees(param1), CalcCosineDegrees(param1));
MTX_RotY33(&v0, CalcSineDegrees(param2), CalcCosineDegrees(param2));
MTX_Concat33(param0, &v0, param0);
MTX_RotZ33(&v0, sub_0201D15C(param3), sub_0201D1D4(param3));
MTX_RotZ33(&v0, CalcSineDegrees(param3), CalcCosineDegrees(param3));
MTX_Concat33(param0, &v0, param0);
}

View File

@ -295,8 +295,8 @@ static BOOL sub_0205E268(FieldTask *param0)
v0.x = FX32_CONST(8);
v0.z = FX32_CONST(8);
v0.x = FX_Mul(sub_0201D15C(v2->unk_0E), v2->unk_04);
v0.z = FX_Mul(sub_0201D15C(v2->unk_0E), v2->unk_08);
v0.x = FX_Mul(CalcSineDegrees(v2->unk_0E), v2->unk_04);
v0.z = FX_Mul(CalcSineDegrees(v2->unk_0E), v2->unk_08);
v0.y = 0;
sub_020630AC(v2->unk_00, &v0);

View File

@ -2056,7 +2056,7 @@ static void sub_02088514(u16 *param0)
*param0 = 0;
}
v0 = sub_0201D250(*param0);
v0 = CalcSineDegrees_Wraparound(*param0);
v3 = 15 + (v0 * 10) / FX32_ONE;
v1 = GX_RGB(29, v3, 0);

View File

@ -162,8 +162,8 @@ static void sub_0208B3D4(SysTask *param0, void *param1)
case 1:
v0->unk_24[v1].unk_0C += (8 / 2);
v0->unk_24[v1].unk_0C %= 720;
v14 = (v0->unk_24[0].unk_04 << FX32_SHIFT) + (sub_0201D250(v0->unk_24[v1].unk_0C) * v0->unk_FC);
v15 = (v0->unk_24[0].unk_06 << FX32_SHIFT) + (sub_0201D264(v0->unk_24[v1].unk_0C) * v0->unk_100);
v14 = (v0->unk_24[0].unk_04 << FX32_SHIFT) + (CalcSineDegrees_Wraparound(v0->unk_24[v1].unk_0C) * v0->unk_FC);
v15 = (v0->unk_24[0].unk_06 << FX32_SHIFT) + (CalcCosineDegrees_Wraparound(v0->unk_24[v1].unk_0C) * v0->unk_100);
sub_0200D650(v0->unk_24[v1].unk_00, v14, v15, v0->unk_10.unk_10);
break;
default: