mirror of
https://github.com/zeldaret/oot
synced 2026-07-08 14:26:45 -04:00
Consistent naming for Math_ functions (#542)
* Darkmeiro decompilation Bg_Gnd_Darkmeiro decompiled, matched, and documented. * give this a shot * fix conflict * one more try * could be useful * whoops * ZAP2 stuff * ZAP why * ZAP again * maths * Factoriali -> Factorial * soon, soon * renames * rand * docs * merged * formatting * little more cleanup * asm crept back in * changes to MathF * smooth criminal * functions.h
This commit is contained in:
+50
-50
@@ -1,38 +1,38 @@
|
||||
#include "global.h"
|
||||
#include "fp.h"
|
||||
|
||||
s32 use_cfrac;
|
||||
s32 gUseAtanContFrac;
|
||||
|
||||
f32 Math_tanf(f32 x) {
|
||||
f32 Math_FTanF(f32 x) {
|
||||
f32 sin = sinf(x);
|
||||
f32 cos = cosf(x);
|
||||
return sin / cos;
|
||||
}
|
||||
|
||||
f32 Math_floorf(f32 x) {
|
||||
f32 Math_FFloorF(f32 x) {
|
||||
return floorf(x);
|
||||
}
|
||||
|
||||
f32 Math_ceilf(f32 x) {
|
||||
f32 Math_FCeilF(f32 x) {
|
||||
return ceilf(x);
|
||||
}
|
||||
|
||||
f32 Math_roundf(f32 x) {
|
||||
f32 Math_FRoundF(f32 x) {
|
||||
return roundf(x);
|
||||
}
|
||||
|
||||
f32 Math_truncf(f32 x) {
|
||||
f32 Math_FTruncF(f32 x) {
|
||||
return truncf(x);
|
||||
}
|
||||
|
||||
f32 Math_nearbyintf(f32 x) {
|
||||
f32 Math_FNearbyIntF(f32 x) {
|
||||
return nearbyintf(x);
|
||||
}
|
||||
|
||||
/* Arctangent approximation using a Taylor series (one quadrant) */
|
||||
f32 Math_atanf_taylor_q(f32 x) {
|
||||
f32 Math_FAtanTaylorQF(f32 x) {
|
||||
static const f32 coeffs[] = {
|
||||
-1.f / 3, +1.f / 5, -1.f / 7, +1.f / 9, -1.f / 11, +1.f / 13, -1.f / 15, +1.f / 17, 0.f,
|
||||
-1.0f / 3, +1.0f / 5, -1.0f / 7, +1.0f / 9, -1.0f / 11, +1.0f / 13, -1.0f / 15, +1.0f / 17, 0.0f,
|
||||
};
|
||||
|
||||
f32 poly = x;
|
||||
@@ -54,31 +54,31 @@ f32 Math_atanf_taylor_q(f32 x) {
|
||||
}
|
||||
|
||||
/* Ditto for two quadrants */
|
||||
f32 Math_atanf_taylor(f32 x) {
|
||||
f32 Math_FAtanTaylorF(f32 x) {
|
||||
f32 t;
|
||||
f32 q;
|
||||
|
||||
if (x > 0.f) {
|
||||
if (x > 0.0f) {
|
||||
t = x;
|
||||
} else if (x < 0.f) {
|
||||
} else if (x < 0.0f) {
|
||||
t = -x;
|
||||
} else if (x == 0.f) {
|
||||
return 0.f;
|
||||
} else if (x == 0.0f) {
|
||||
return 0.0f;
|
||||
} else {
|
||||
return qNaN0x10000;
|
||||
}
|
||||
|
||||
if (t <= M_SQRT2 - 1.f) {
|
||||
return Math_atanf_taylor_q(x);
|
||||
if (t <= M_SQRT2 - 1.0f) {
|
||||
return Math_FAtanTaylorQF(x);
|
||||
}
|
||||
|
||||
if (t >= M_SQRT2 + 1.f) {
|
||||
q = M_PI / 2 - Math_atanf_taylor_q(1.f / t);
|
||||
if (t >= M_SQRT2 + 1.0f) {
|
||||
q = M_PI / 2 - Math_FAtanTaylorQF(1.0f / t);
|
||||
} else {
|
||||
q = M_PI / 4 - Math_atanf_taylor_q((1.f - t) / (1.f + t));
|
||||
q = M_PI / 4 - Math_FAtanTaylorQF((1.0f - t) / (1.0f + t));
|
||||
}
|
||||
|
||||
if (x > 0.f) {
|
||||
if (x > 0.0f) {
|
||||
return q;
|
||||
} else {
|
||||
return -q;
|
||||
@@ -86,33 +86,33 @@ f32 Math_atanf_taylor(f32 x) {
|
||||
}
|
||||
|
||||
/* Arctangent approximation using a continued fraction */
|
||||
f32 Math_atanf_cfrac(f32 x) {
|
||||
f32 Math_FAtanContFracF(f32 x) {
|
||||
s32 sector;
|
||||
f32 z;
|
||||
f32 conv;
|
||||
f32 sq;
|
||||
s32 i;
|
||||
|
||||
if (x >= -1.f && x <= 1.f) {
|
||||
if (x >= -1.0f && x <= 1.0f) {
|
||||
sector = 0;
|
||||
} else if (x > 1.f) {
|
||||
} else if (x > 1.0f) {
|
||||
sector = 1;
|
||||
x = 1.f / x;
|
||||
} else if (x < -1.f) {
|
||||
x = 1.0f / x;
|
||||
} else if (x < -1.0f) {
|
||||
sector = -1;
|
||||
x = 1.f / x;
|
||||
x = 1.0f / x;
|
||||
} else {
|
||||
return qNaN0x10000;
|
||||
}
|
||||
|
||||
sq = SQ(x);
|
||||
conv = 0.f;
|
||||
z = 8.f;
|
||||
conv = 0.0f;
|
||||
z = 8.0f;
|
||||
for (i = 8; i != 0; i--) {
|
||||
conv = SQ(z) * sq / (2.f * z + 1.f + conv);
|
||||
z -= 1.f;
|
||||
conv = SQ(z) * sq / (2.0f * z + 1.0f + conv);
|
||||
z -= 1.0f;
|
||||
}
|
||||
conv = x / (1.f + conv);
|
||||
conv = x / (1.0f + conv);
|
||||
|
||||
if (sector == 0) {
|
||||
return conv;
|
||||
@@ -123,38 +123,38 @@ f32 Math_atanf_cfrac(f32 x) {
|
||||
}
|
||||
}
|
||||
|
||||
f32 Math_atanf(f32 x) {
|
||||
if (use_cfrac == 0) {
|
||||
return Math_atanf_taylor(x);
|
||||
f32 Math_FAtanF(f32 x) {
|
||||
if (!gUseAtanContFrac) {
|
||||
return Math_FAtanTaylorF(x);
|
||||
} else {
|
||||
return Math_atanf_cfrac(x);
|
||||
return Math_FAtanContFracF(x);
|
||||
}
|
||||
}
|
||||
|
||||
f32 Math_atan2f(f32 y, f32 x) {
|
||||
if (x == 0.f) {
|
||||
if (y == 0.f) {
|
||||
return 0.f;
|
||||
} else if (y > 0.f) {
|
||||
f32 Math_FAtan2F(f32 y, f32 x) {
|
||||
if (x == 0.0f) {
|
||||
if (y == 0.0f) {
|
||||
return 0.0f;
|
||||
} else if (y > 0.0f) {
|
||||
return M_PI / 2;
|
||||
} else if (y < 0.f) {
|
||||
} else if (y < 0.0f) {
|
||||
return -M_PI / 2;
|
||||
} else {
|
||||
return qNaN0x10000;
|
||||
}
|
||||
} else if (x >= 0.f) {
|
||||
return Math_atanf(y / x);
|
||||
} else if (y < 0.f) {
|
||||
return Math_atanf(y / x) - M_PI;
|
||||
} else if (x >= 0.0f) {
|
||||
return Math_FAtanF(y / x);
|
||||
} else if (y < 0.0f) {
|
||||
return Math_FAtanF(y / x) - M_PI;
|
||||
} else {
|
||||
return M_PI - Math_atanf(-(y / x));
|
||||
return M_PI - Math_FAtanF(-(y / x));
|
||||
}
|
||||
}
|
||||
|
||||
f32 Math_asinf(f32 x) {
|
||||
return Math_atan2f(x, sqrtf(1.f - SQ(x)));
|
||||
f32 Math_FAsinF(f32 x) {
|
||||
return Math_FAtan2F(x, sqrtf(1.0f - SQ(x)));
|
||||
}
|
||||
|
||||
f32 Math_acosf(f32 x) {
|
||||
return M_PI / 2 - Math_asinf(x);
|
||||
f32 Math_FAcosF(f32 x) {
|
||||
return M_PI / 2 - Math_FAsinF(x);
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ static u32 sRandFloat;
|
||||
/**
|
||||
* Gets the next integer in the sequence of pseudo-random numbers.
|
||||
*/
|
||||
u32 Math_Rand_Next(void) {
|
||||
u32 Rand_Next(void) {
|
||||
return sRandInt = (sRandInt * 1664525) + 1013904223;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeds the pseudo-random number generator by providing a starting value.
|
||||
*/
|
||||
void Math_Rand_Seed(u32 seed) {
|
||||
void Rand_Seed(u32 seed) {
|
||||
sRandInt = seed;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ void Math_Rand_Seed(u32 seed) {
|
||||
* the next integer and masking it to an IEEE-754 compliant floating-point number
|
||||
* between 1.0f and 2.0f, returning the result subtract 1.0f.
|
||||
*/
|
||||
f32 Math_Rand_ZeroOne(void) {
|
||||
f32 Rand_ZeroOne(void) {
|
||||
sRandInt = (sRandInt * 1664525) + 1013904223;
|
||||
sRandFloat = ((sRandInt >> 9) | 0x3F800000);
|
||||
return *((f32*)&sRandFloat) - 1.0f;
|
||||
@@ -33,9 +33,9 @@ f32 Math_Rand_ZeroOne(void) {
|
||||
|
||||
/**
|
||||
* Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same
|
||||
* manner in which Math_Rand_ZeroOne generates its result.
|
||||
* manner in which Rand_ZeroOne generates its result.
|
||||
*/
|
||||
f32 Math_Rand_Centered(void) {
|
||||
f32 Rand_Centered(void) {
|
||||
sRandInt = (sRandInt * 1664525) + 1013904223;
|
||||
sRandFloat = ((sRandInt >> 9) | 0x3F800000);
|
||||
return *((f32*)&sRandFloat) - 1.5f;
|
||||
@@ -44,14 +44,14 @@ f32 Math_Rand_Centered(void) {
|
||||
/**
|
||||
* Seeds a pseudo-random number at rndNum with a provided seed.
|
||||
*/
|
||||
void Math_Rand_Seed_Variable(u32* rndNum, u32 seed) {
|
||||
void Rand_Seed_Variable(u32* rndNum, u32 seed) {
|
||||
*rndNum = seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random integer from the provided rndNum.
|
||||
*/
|
||||
u32 Math_Rand_Next_Variable(u32* rndNum) {
|
||||
u32 Rand_Next_Variable(u32* rndNum) {
|
||||
return *rndNum = (*rndNum * 1664525) + 1013904223;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ u32 Math_Rand_Next_Variable(u32* rndNum) {
|
||||
* Generates the next pseudo-random floating-point number between 0.0f and
|
||||
* 1.0f from the provided rndNum.
|
||||
*/
|
||||
f32 Math_Rand_ZeroOne_Variable(u32* rndNum) {
|
||||
f32 Rand_ZeroOne_Variable(u32* rndNum) {
|
||||
u32 next;
|
||||
|
||||
next = (*rndNum * 1664525) + 1013904223;
|
||||
@@ -73,7 +73,7 @@ f32 Math_Rand_ZeroOne_Variable(u32* rndNum) {
|
||||
* Generates the next pseudo-random floating-point number between -0.5f and
|
||||
* 0.5f from the provided rndNum.
|
||||
*/
|
||||
f32 Math_Rand_Centered_Variable(u32* rndNum) {
|
||||
f32 Rand_Centered_Variable(u32* rndNum) {
|
||||
u32 next;
|
||||
|
||||
next = (*rndNum * 1664525) + 1013904223;
|
||||
|
||||
+17
-14
@@ -3,42 +3,45 @@
|
||||
f32 sFactorialTbl[] = { 1.0f, 1.0f, 2.0f, 6.0f, 24.0f, 120.0f, 720.0f,
|
||||
5040.0f, 40320.0f, 362880.0f, 3628800.0f, 39916800.0f, 479001600.0f };
|
||||
|
||||
f32 func_800CA540(f32 arg0) {
|
||||
f32 Math_FactorialF(f32 n) {
|
||||
f32 ret = 1.0f;
|
||||
s32 i;
|
||||
for (i = arg0; i > 1; i--) {
|
||||
|
||||
for (i = n; i > 1; i--) {
|
||||
ret *= i;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
f32 func_800CA63C(u32 arg0) {
|
||||
f32 Math_Factorial(s32 n) {
|
||||
f32 ret;
|
||||
s32 i;
|
||||
if (arg0 > 12) {
|
||||
|
||||
if (n > 12U) {
|
||||
ret = sFactorialTbl[12];
|
||||
for (i = 13; i <= (s32)arg0; i++) {
|
||||
for (i = 13; i <= n; i++) {
|
||||
ret *= i;
|
||||
}
|
||||
} else {
|
||||
ret = sFactorialTbl[arg0];
|
||||
ret = sFactorialTbl[n];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
f32 func_800CA6FC(f32 arg0, s32 arg1) {
|
||||
f32 Math_PowF(f32 base, s32 exp) {
|
||||
f32 ret = 1.0f;
|
||||
while (arg1 > 0) {
|
||||
arg1--;
|
||||
ret *= arg0;
|
||||
|
||||
while (exp > 0) {
|
||||
exp--;
|
||||
ret *= base;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
f32 func_800CA720(f32 arg0) {
|
||||
return sins((s16)(arg0 * (32767.0f / M_PI))) * SHT_MINV;
|
||||
f32 Math_SinF(f32 angle) {
|
||||
return sins((s16)(angle * (32767.0f / M_PI))) * SHT_MINV;
|
||||
}
|
||||
|
||||
f32 func_800CA774(f32 arg0) {
|
||||
return coss((s16)(arg0 * (32767.0f / M_PI))) * SHT_MINV;
|
||||
f32 Math_CosF(f32 angle) {
|
||||
return coss((s16)(angle * (32767.0f / M_PI))) * SHT_MINV;
|
||||
}
|
||||
|
||||
@@ -870,8 +870,8 @@ s32 Math3D_LineVsCubeShort(Vec3s* min, Vec3s* max, Vec3s* a, Vec3s* b) {
|
||||
* outputs the plane equation `a``pointOnPlane->x` + 0y + `c``pointOnPlane->z`+`d` = 0
|
||||
*/
|
||||
void Math3D_RotateXZPlane(Vec3f* pointOnPlane, s16 angle, f32* a, f32* c, f32* d) {
|
||||
*a = Math_Sins(angle) * 32767.0f;
|
||||
*c = Math_Coss(angle) * 32767.0f;
|
||||
*a = Math_SinS(angle) * 32767.0f;
|
||||
*c = Math_CosS(angle) * 32767.0f;
|
||||
*d = -((*a * pointOnPlane->x) + (*c * pointOnPlane->z));
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
|
||||
u16 sATan2Tbl[] = {
|
||||
static u16 sATan2Tbl[] = {
|
||||
0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070, 0x007A, 0x0084,
|
||||
0x008F, 0x0099, 0x00A3, 0x00AD, 0x00B7, 0x00C2, 0x00CC, 0x00D6, 0x00E0, 0x00EA, 0x00F4, 0x00FF, 0x0109, 0x0113,
|
||||
0x011D, 0x0127, 0x0131, 0x013C, 0x0146, 0x0150, 0x015A, 0x0164, 0x016F, 0x0179, 0x0183, 0x018D, 0x0197, 0x01A1,
|
||||
@@ -77,7 +77,7 @@ u16 sATan2Tbl[] = {
|
||||
0x1FF6, 0x1FFB, 0x2000,
|
||||
};
|
||||
|
||||
u16 GetAtan2Tbl(f32 x, f32 y) {
|
||||
u16 Math_GetAtan2Tbl(f32 x, f32 y) {
|
||||
s32 tblIdx;
|
||||
u16 ret;
|
||||
|
||||
@@ -93,41 +93,41 @@ u16 GetAtan2Tbl(f32 x, f32 y) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s16 atan2s(f32 x, f32 y) {
|
||||
s16 Math_Atan2S(f32 x, f32 y) {
|
||||
s32 ret;
|
||||
|
||||
if (y >= 0.0f) {
|
||||
if (x >= 0.0f) {
|
||||
if (y <= x) {
|
||||
ret = GetAtan2Tbl(y, x);
|
||||
ret = Math_GetAtan2Tbl(y, x);
|
||||
} else {
|
||||
ret = 0x4000 - GetAtan2Tbl(x, y);
|
||||
ret = 0x4000 - Math_GetAtan2Tbl(x, y);
|
||||
}
|
||||
} else {
|
||||
if (-x < y) {
|
||||
ret = GetAtan2Tbl(-x, y) + 0x4000;
|
||||
ret = Math_GetAtan2Tbl(-x, y) + 0x4000;
|
||||
} else {
|
||||
ret = 0x8000 - GetAtan2Tbl(y, -x);
|
||||
ret = 0x8000 - Math_GetAtan2Tbl(y, -x);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (x < 0.0f) {
|
||||
if (-y <= -x) {
|
||||
ret = GetAtan2Tbl(-y, -x) + 0x8000;
|
||||
ret = Math_GetAtan2Tbl(-y, -x) + 0x8000;
|
||||
} else {
|
||||
ret = 0xC000 - GetAtan2Tbl(-x, -y);
|
||||
ret = 0xC000 - Math_GetAtan2Tbl(-x, -y);
|
||||
}
|
||||
} else {
|
||||
if (x < -y) {
|
||||
ret = GetAtan2Tbl(x, -y) + 0xC000;
|
||||
ret = Math_GetAtan2Tbl(x, -y) + 0xC000;
|
||||
} else {
|
||||
ret = -GetAtan2Tbl(-y, x);
|
||||
ret = -Math_GetAtan2Tbl(-y, x);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
f32 atan2f(f32 x, f32 y) {
|
||||
return atan2s(x, y) * (M_PI / 32768.0f);
|
||||
f32 Math_Atan2F(f32 x, f32 y) {
|
||||
return Math_Atan2S(x, y) * (M_PI / 32768.0f);
|
||||
}
|
||||
|
||||
+28
-28
@@ -308,8 +308,8 @@ void Matrix_RotateRPY(s16 x, s16 y, s16 z, u8 mode) {
|
||||
f32 cos;
|
||||
|
||||
if (mode == MTXMODE_APPLY) {
|
||||
sin = Math_Sins(z);
|
||||
cos = Math_Coss(z);
|
||||
sin = Math_SinS(z);
|
||||
cos = Math_CosS(z);
|
||||
|
||||
temp1 = cmf->xx;
|
||||
temp2 = cmf->yx;
|
||||
@@ -332,8 +332,8 @@ void Matrix_RotateRPY(s16 x, s16 y, s16 z, u8 mode) {
|
||||
cmf->yw = temp2 * cos - temp1 * sin;
|
||||
|
||||
if (y != 0) {
|
||||
sin = Math_Sins(y);
|
||||
cos = Math_Coss(y);
|
||||
sin = Math_SinS(y);
|
||||
cos = Math_CosS(y);
|
||||
|
||||
temp1 = cmf->xx;
|
||||
temp2 = cmf->zx;
|
||||
@@ -357,8 +357,8 @@ void Matrix_RotateRPY(s16 x, s16 y, s16 z, u8 mode) {
|
||||
}
|
||||
|
||||
if (x != 0) {
|
||||
sin = Math_Sins(x);
|
||||
cos = Math_Coss(x);
|
||||
sin = Math_SinS(x);
|
||||
cos = Math_CosS(x);
|
||||
|
||||
temp1 = cmf->yx;
|
||||
temp2 = cmf->zx;
|
||||
@@ -395,8 +395,8 @@ void Matrix_JointPosition(Vec3f* position, Vec3s* rotation) {
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
|
||||
sin = Math_Sins(rotation->z);
|
||||
cos = Math_Coss(rotation->z);
|
||||
sin = Math_SinS(rotation->z);
|
||||
cos = Math_CosS(rotation->z);
|
||||
|
||||
temp1 = cmf->xx;
|
||||
temp2 = cmf->yx;
|
||||
@@ -423,8 +423,8 @@ void Matrix_JointPosition(Vec3f* position, Vec3s* rotation) {
|
||||
cmf->yw = temp2 * cos - temp1 * sin;
|
||||
|
||||
if (rotation->y != 0) {
|
||||
sin = Math_Sins(rotation->y);
|
||||
cos = Math_Coss(rotation->y);
|
||||
sin = Math_SinS(rotation->y);
|
||||
cos = Math_CosS(rotation->y);
|
||||
|
||||
temp1 = cmf->xx;
|
||||
temp2 = cmf->zx;
|
||||
@@ -448,8 +448,8 @@ void Matrix_JointPosition(Vec3f* position, Vec3s* rotation) {
|
||||
}
|
||||
|
||||
if (rotation->x != 0) {
|
||||
sin = Math_Sins(rotation->x);
|
||||
cos = Math_Coss(rotation->x);
|
||||
sin = Math_SinS(rotation->x);
|
||||
cos = Math_CosS(rotation->x);
|
||||
|
||||
temp1 = cmf->yx;
|
||||
temp2 = cmf->zx;
|
||||
@@ -480,8 +480,8 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) {
|
||||
f32 sp28;
|
||||
f32 sp24;
|
||||
|
||||
sp30 = Math_Sins(vec->y);
|
||||
sp2C = Math_Coss(vec->y);
|
||||
sp30 = Math_SinS(vec->y);
|
||||
sp2C = Math_CosS(vec->y);
|
||||
|
||||
cmf->xx = sp2C;
|
||||
cmf->xz = -sp30;
|
||||
@@ -494,8 +494,8 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) {
|
||||
cmf->ww = 1.0f;
|
||||
|
||||
if (vec->x != 0) {
|
||||
sp24 = Math_Sins(vec->x);
|
||||
sp28 = Math_Coss(vec->x);
|
||||
sp24 = Math_SinS(vec->x);
|
||||
sp28 = Math_CosS(vec->x);
|
||||
|
||||
cmf->zz = sp2C * sp28;
|
||||
cmf->yz = sp2C * sp24;
|
||||
@@ -513,8 +513,8 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) {
|
||||
}
|
||||
|
||||
if (vec->z != 0) {
|
||||
sp24 = Math_Sins(vec->z);
|
||||
sp28 = Math_Coss(vec->z);
|
||||
sp24 = Math_SinS(vec->z);
|
||||
sp28 = Math_CosS(vec->z);
|
||||
|
||||
sp30 = cmf->xx;
|
||||
sp2C = cmf->yx;
|
||||
@@ -752,17 +752,17 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) {
|
||||
temp = mf->zx;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->zz);
|
||||
vec->x = Math_atan2f(-mf->zy, sqrtf(temp)) * (32768 / M_PI);
|
||||
vec->x = Math_FAtan2F(-mf->zy, sqrtf(temp)) * (32768 / M_PI);
|
||||
|
||||
if ((vec->x == 0x4000) || (vec->x == -0x4000)) {
|
||||
vec->z = 0;
|
||||
|
||||
vec->y = Math_atan2f(-mf->xz, mf->xx) * (32768 / M_PI);
|
||||
vec->y = Math_FAtan2F(-mf->xz, mf->xx) * (32768 / M_PI);
|
||||
} else {
|
||||
vec->y = Math_atan2f(mf->zx, mf->zz) * (32768 / M_PI);
|
||||
vec->y = Math_FAtan2F(mf->zx, mf->zz) * (32768 / M_PI);
|
||||
|
||||
if (!flag) {
|
||||
vec->z = Math_atan2f(mf->xy, mf->yy) * (32768 / M_PI);
|
||||
vec->z = Math_FAtan2F(mf->xy, mf->yy) * (32768 / M_PI);
|
||||
} else {
|
||||
temp = mf->xx;
|
||||
temp4 = mf->xz;
|
||||
@@ -783,7 +783,7 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) {
|
||||
temp2 = sqrtf(temp2);
|
||||
temp2 = temp3 / temp2;
|
||||
|
||||
vec->z = Math_atan2f(temp, temp2) * (32768 / M_PI);
|
||||
vec->z = Math_FAtan2F(temp, temp2) * (32768 / M_PI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -800,18 +800,18 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) {
|
||||
temp = mf->xx;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->xy);
|
||||
vec->y = Math_atan2f(-mf->xz, sqrtf(temp)) * (32768 / M_PI);
|
||||
vec->y = Math_FAtan2F(-mf->xz, sqrtf(temp)) * (32768 / M_PI);
|
||||
|
||||
if ((vec->y == 0x4000) || (vec->y == -0x4000)) {
|
||||
vec->x = 0;
|
||||
vec->z = Math_atan2f(-mf->yx, mf->yy) * (32768 / M_PI);
|
||||
vec->z = Math_FAtan2F(-mf->yx, mf->yy) * (32768 / M_PI);
|
||||
return;
|
||||
}
|
||||
|
||||
vec->z = Math_atan2f(mf->xy, mf->xx) * (32768 / M_PI);
|
||||
vec->z = Math_FAtan2F(mf->xy, mf->xx) * (32768 / M_PI);
|
||||
|
||||
if (!flag) {
|
||||
vec->x = Math_atan2f(mf->yz, mf->zz) * (32768 / M_PI);
|
||||
vec->x = Math_FAtan2F(mf->yz, mf->zz) * (32768 / M_PI);
|
||||
} else {
|
||||
temp = mf->yx;
|
||||
temp *= temp;
|
||||
@@ -827,7 +827,7 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) {
|
||||
temp2 = sqrtf(temp2);
|
||||
temp2 = mf->zz / temp2;
|
||||
|
||||
vec->x = Math_atan2f(temp, temp2) * (32768 / M_PI);
|
||||
vec->x = Math_FAtan2F(temp, temp2) * (32768 / M_PI);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
+77
-77
@@ -28,7 +28,7 @@ void func_8002B200(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx*
|
||||
COMBINED);
|
||||
|
||||
temp1 = (temp1 < 0.0f) ? 0.0f : ((temp1 > 150.0f) ? 150.0f : temp1);
|
||||
temp2 = 1.0f - (temp1 * (1.f / 350));
|
||||
temp2 = 1.0f - (temp1 * (1.0f / 350));
|
||||
|
||||
if (color != NULL) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color->r, color->g, color->b,
|
||||
@@ -44,7 +44,7 @@ void func_8002B200(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx*
|
||||
Matrix_RotateY(actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
temp2 = (1.0f - (temp1 * (1.f / 350))) * actor->shape.unk_10;
|
||||
temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.unk_10;
|
||||
Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1588),
|
||||
@@ -80,7 +80,7 @@ void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3,
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0,
|
||||
(u32)(((arg3 * 0.00005f) > 1.0f ? 1.0f : (arg3 * 0.00005f)) * arg4) & 0xFF);
|
||||
|
||||
sp58 = Math_atan2f(light->l.dir[0], light->l.dir[2]);
|
||||
sp58 = Math_FAtan2F(light->l.dir[0], light->l.dir[2]);
|
||||
arg6 *= (4.5f - (light->l.dir[1] * 0.035f));
|
||||
arg6 = (arg6 < 1.0f) ? 1.0f : arg6;
|
||||
Matrix_Put(arg2);
|
||||
@@ -463,7 +463,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl
|
||||
unkActor = &player->actor;
|
||||
}
|
||||
|
||||
if (Math_ApproxF(&targetCtx->unk_40, 0.0f, 0.25f) == 0) {
|
||||
if (Math_StepToF(&targetCtx->unk_40, 0.0f, 0.25f) == 0) {
|
||||
temp1 = 0.25f / targetCtx->unk_40;
|
||||
temp2 = unkActor->posRot.pos.x - targetCtx->naviRefPos.x;
|
||||
temp3 = (unkActor->posRot.pos.y + (unkActor->unk_4C * unkActor->scale.y)) - targetCtx->naviRefPos.y;
|
||||
@@ -502,7 +502,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl
|
||||
if (targetCtx->unk_4B == 0) {
|
||||
temp5 = (500.0f - targetCtx->unk_44) * 3.0f;
|
||||
temp6 = (temp5 < 30.0f) ? 30.0f : ((100.0f < temp5) ? 100.0f : temp5);
|
||||
if (Math_ApproxF(&targetCtx->unk_44, 80.0f, temp6) != 0) {
|
||||
if (Math_StepToF(&targetCtx->unk_44, 80.0f, temp6) != 0) {
|
||||
targetCtx->unk_4B++;
|
||||
}
|
||||
} else {
|
||||
@@ -511,7 +511,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl
|
||||
}
|
||||
} else {
|
||||
targetCtx->targetedActor = NULL;
|
||||
Math_ApproxF(&targetCtx->unk_44, 500.0f, 80.0f);
|
||||
Math_StepToF(&targetCtx->unk_44, 500.0f, 80.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,11 +697,11 @@ void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCt
|
||||
void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
|
||||
if (DECR(titleCtx->delayB) == 0) {
|
||||
if (DECR(titleCtx->delayA) == 0) {
|
||||
Math_ApproxS(&titleCtx->unk_C, 0, 30);
|
||||
Math_ApproxS(&titleCtx->unk_E, 0, 70);
|
||||
Math_StepToS(&titleCtx->unk_C, 0, 30);
|
||||
Math_StepToS(&titleCtx->unk_E, 0, 70);
|
||||
} else {
|
||||
Math_ApproxS(&titleCtx->unk_C, 255, 10);
|
||||
Math_ApproxS(&titleCtx->unk_E, 255, 20);
|
||||
Math_StepToS(&titleCtx->unk_C, 255, 10);
|
||||
Math_StepToS(&titleCtx->unk_E, 255, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -853,8 +853,8 @@ void func_8002D7EC(Actor* actor) {
|
||||
}
|
||||
|
||||
void func_8002D868(Actor* actor) {
|
||||
actor->velocity.x = Math_Sins(actor->posRot.rot.y) * actor->speedXZ;
|
||||
actor->velocity.z = Math_Coss(actor->posRot.rot.y) * actor->speedXZ;
|
||||
actor->velocity.x = Math_SinS(actor->posRot.rot.y) * actor->speedXZ;
|
||||
actor->velocity.z = Math_CosS(actor->posRot.rot.y) * actor->speedXZ;
|
||||
|
||||
actor->velocity.y += actor->gravity;
|
||||
if (actor->velocity.y < actor->minVelocityY) {
|
||||
@@ -868,10 +868,10 @@ void Actor_MoveForward(Actor* actor) {
|
||||
}
|
||||
|
||||
void func_8002D908(Actor* actor) {
|
||||
f32 sp24 = Math_Coss(actor->posRot.rot.x) * actor->speedXZ;
|
||||
actor->velocity.x = Math_Sins(actor->posRot.rot.y) * sp24;
|
||||
actor->velocity.y = Math_Sins(actor->posRot.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_Coss(actor->posRot.rot.y) * sp24;
|
||||
f32 sp24 = Math_CosS(actor->posRot.rot.x) * actor->speedXZ;
|
||||
actor->velocity.x = Math_SinS(actor->posRot.rot.y) * sp24;
|
||||
actor->velocity.y = Math_SinS(actor->posRot.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_CosS(actor->posRot.rot.y) * sp24;
|
||||
}
|
||||
|
||||
void func_8002D97C(Actor* actor) {
|
||||
@@ -880,8 +880,8 @@ void func_8002D97C(Actor* actor) {
|
||||
}
|
||||
|
||||
void func_8002D9A4(Actor* actor, f32 arg1) {
|
||||
actor->speedXZ = Math_Coss(actor->posRot.rot.x) * arg1;
|
||||
actor->velocity.y = -Math_Sins(actor->posRot.rot.x) * arg1;
|
||||
actor->speedXZ = Math_CosS(actor->posRot.rot.x) * arg1;
|
||||
actor->velocity.y = -Math_SinS(actor->posRot.rot.x) * arg1;
|
||||
}
|
||||
|
||||
void func_8002D9F8(Actor* actor, SkelAnime* skelAnime) {
|
||||
@@ -938,8 +938,8 @@ void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2) {
|
||||
f32 deltaX;
|
||||
f32 deltaZ;
|
||||
|
||||
cosRot2Y = Math_Coss(actor->shape.rot.y);
|
||||
sinRot2Y = Math_Sins(actor->shape.rot.y);
|
||||
cosRot2Y = Math_CosS(actor->shape.rot.y);
|
||||
sinRot2Y = Math_SinS(actor->shape.rot.y);
|
||||
deltaX = arg2->x - actor->posRot.pos.x;
|
||||
deltaZ = arg2->z - actor->posRot.pos.z;
|
||||
|
||||
@@ -1223,7 +1223,7 @@ void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f
|
||||
&actor->wallPoly, &sp60, actor, arg2))) {
|
||||
sp5C = actor->wallPoly;
|
||||
Math_Vec3f_Copy(&actor->posRot.pos, &sp64);
|
||||
actor->wallPolyRot = atan2s(sp5C->norm.z, sp5C->norm.x);
|
||||
actor->wallPolyRot = Math_Atan2S(sp5C->norm.z, sp5C->norm.x);
|
||||
actor->bgCheckFlags |= 8;
|
||||
actor->wallPolySource = sp60;
|
||||
} else {
|
||||
@@ -1829,7 +1829,7 @@ void func_8002FBAC(GlobalContext* globalCtx) {
|
||||
sp9C = (1.0f / D_8015BC18) * temp_ret;
|
||||
phi_f14 = 20.0f / sp9C;
|
||||
phi_f14 = (phi_f14 < 0.05f) ? 0.05f : phi_f14;
|
||||
Math_ApproxF(&D_8015BC18, 0.0f, phi_f14);
|
||||
Math_StepToF(&D_8015BC18, 0.0f, phi_f14);
|
||||
temp_f2 = ((D_8015BC18 / spC0) * temp_ret) / temp_ret;
|
||||
gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x =
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.x + (spB4.x * temp_f2);
|
||||
@@ -1843,9 +1843,9 @@ void func_8002FBAC(GlobalContext* globalCtx) {
|
||||
osSyncPrintf("-------- DISPLAY Y=%f\n", spD8);
|
||||
}
|
||||
|
||||
spA4.x = Math_Rand_CenteredFloat(6.0f) + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x;
|
||||
spA4.y = Math_Rand_ZeroOne() * 6.0f + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + 80.0f;
|
||||
spA4.z = Math_Rand_CenteredFloat(6.0f) + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z;
|
||||
spA4.x = Rand_CenteredFloat(6.0f) + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x;
|
||||
spA4.y = Rand_ZeroOne() * 6.0f + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + 80.0f;
|
||||
spA4.z = Rand_CenteredFloat(6.0f) + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z;
|
||||
|
||||
EffectSsKiraKira_SpawnDispersed(globalCtx, &spA4, &D_80116048, &D_80116054, &D_80116060, &D_80116064, 1000,
|
||||
16);
|
||||
@@ -3011,7 +3011,7 @@ void func_80032C7C(GlobalContext* globalCtx, Actor* actor) {
|
||||
|
||||
s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) {
|
||||
if (DECR(arg0[1]) == 0) {
|
||||
arg0[1] = Math_Rand_S16Offset(arg1, arg2);
|
||||
arg0[1] = Rand_S16Offset(arg1, arg2);
|
||||
}
|
||||
|
||||
if ((arg0[1] - arg3) > 0) {
|
||||
@@ -3027,11 +3027,11 @@ s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) {
|
||||
|
||||
s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) {
|
||||
if (DECR(arg0[1]) == 0) {
|
||||
arg0[1] = Math_Rand_S16Offset(arg1, arg2);
|
||||
arg0[1] = Rand_S16Offset(arg1, arg2);
|
||||
arg0[0]++;
|
||||
|
||||
if ((arg0[0] % 3) == 0) {
|
||||
arg0[0] = (s32)(Math_Rand_ZeroOne() * arg3) * 3;
|
||||
arg0[0] = (s32)(Rand_ZeroOne() * arg3) * 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3148,15 +3148,15 @@ void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3
|
||||
f32 var;
|
||||
s32 i;
|
||||
|
||||
var = (Math_Rand_ZeroOne() - 0.5f) * 6.28f;
|
||||
var = (Rand_ZeroOne() - 0.5f) * 6.28f;
|
||||
pos.y = actor->groundY;
|
||||
accel.y += (Math_Rand_ZeroOne() - 0.5f) * 0.2f;
|
||||
accel.y += (Rand_ZeroOne() - 0.5f) * 0.2f;
|
||||
|
||||
for (i = arg4; i >= 0; i--) {
|
||||
pos.x = (func_800CA720(var) * arg3) + arg2->x;
|
||||
pos.z = (func_800CA774(var) * arg3) + arg2->z;
|
||||
accel.x = (Math_Rand_ZeroOne() - 0.5f) * arg5;
|
||||
accel.z = (Math_Rand_ZeroOne() - 0.5f) * arg5;
|
||||
pos.x = (Math_SinF(var) * arg3) + arg2->x;
|
||||
pos.z = (Math_CosF(var) * arg3) + arg2->z;
|
||||
accel.x = (Rand_ZeroOne() - 0.5f) * arg5;
|
||||
accel.z = (Rand_ZeroOne() - 0.5f) * arg5;
|
||||
|
||||
if (scale == 0) {
|
||||
func_8002857C(globalCtx, &pos, &velocity, &accel);
|
||||
@@ -3179,11 +3179,11 @@ void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s1
|
||||
s32 i;
|
||||
|
||||
for (i = arg3; i >= 0; i--) {
|
||||
pos.x = arg1->x + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
|
||||
pos.y = arg1->y + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
|
||||
pos.z = arg1->z + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
|
||||
pos.x = arg1->x + ((Rand_ZeroOne() - 0.5f) * arg2);
|
||||
pos.y = arg1->y + ((Rand_ZeroOne() - 0.5f) * arg2);
|
||||
pos.z = arg1->z + ((Rand_ZeroOne() - 0.5f) * arg2);
|
||||
|
||||
scale = (s16)((Math_Rand_ZeroOne() * arg4) * 0.2f) + arg4;
|
||||
scale = (s16)((Rand_ZeroOne() * arg4) * 0.2f) + arg4;
|
||||
var2 = arg6;
|
||||
|
||||
if (var2 != 0) {
|
||||
@@ -3256,9 +3256,9 @@ Actor* func_80033780(GlobalContext* globalCtx, Actor* refActor, f32 arg2) {
|
||||
(itemActor->unk_210 == 0)) {
|
||||
actor = actor->next;
|
||||
} else {
|
||||
deltaX = Math_Sins(itemActor->actor.posRot.rot.y) * (itemActor->actor.speedXZ * 10.0f);
|
||||
deltaX = Math_SinS(itemActor->actor.posRot.rot.y) * (itemActor->actor.speedXZ * 10.0f);
|
||||
deltaY = itemActor->actor.velocity.y + (itemActor->actor.gravity * 10.0f);
|
||||
deltaZ = Math_Coss(itemActor->actor.posRot.rot.y) * (itemActor->actor.speedXZ * 10.0f);
|
||||
deltaZ = Math_CosS(itemActor->actor.posRot.rot.y) * (itemActor->actor.speedXZ * 10.0f);
|
||||
|
||||
spA8.x = itemActor->actor.posRot.pos.x + deltaX;
|
||||
spA8.y = itemActor->actor.posRot.pos.y + deltaY;
|
||||
@@ -3366,8 +3366,8 @@ s16 func_800339B8(Actor* actor, GlobalContext* globalCtx, f32 arg2, s16 arg3) {
|
||||
|
||||
Math_Vec3f_Copy(&sp30, &actor->posRot.pos);
|
||||
sp44 = actor->bgCheckFlags;
|
||||
sp40 = Math_Sins(arg3) * arg2;
|
||||
sp3C = Math_Coss(arg3) * arg2;
|
||||
sp40 = Math_SinS(arg3) * arg2;
|
||||
sp3C = Math_CosS(arg3) * arg2;
|
||||
actor->posRot.pos.x += sp40;
|
||||
actor->posRot.pos.z += sp3C;
|
||||
func_8002E4B4(globalCtx, actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
@@ -3403,13 +3403,13 @@ f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 ar
|
||||
f32 ret = 0.0f;
|
||||
|
||||
if (arg4 <= Math_Vec3f_DistXYZ(arg0, arg1)) {
|
||||
ret = Math_SmoothScaleMaxMinF(&arg1->x, arg0->x, arg2, arg3, 0.0f);
|
||||
ret += Math_SmoothScaleMaxMinF(&arg1->y, arg0->y, arg2, arg3, 0.0f);
|
||||
ret += Math_SmoothScaleMaxMinF(&arg1->z, arg0->z, arg2, arg3, 0.0f);
|
||||
ret = Math_SmoothStepToF(&arg1->x, arg0->x, arg2, arg3, 0.0f);
|
||||
ret += Math_SmoothStepToF(&arg1->y, arg0->y, arg2, arg3, 0.0f);
|
||||
ret += Math_SmoothStepToF(&arg1->z, arg0->z, arg2, arg3, 0.0f);
|
||||
} else if (arg5 < Math_Vec3f_DistXYZ(arg0, arg1)) {
|
||||
ret = Math_SmoothScaleMaxMinF(&arg1->x, arg0->x, arg2, arg3, 0.0f);
|
||||
ret += Math_SmoothScaleMaxMinF(&arg1->y, arg0->y, arg2, arg3, 0.0f);
|
||||
ret += Math_SmoothScaleMaxMinF(&arg1->z, arg0->z, arg2, arg3, 0.0f);
|
||||
ret = Math_SmoothStepToF(&arg1->x, arg0->x, arg2, arg3, 0.0f);
|
||||
ret += Math_SmoothStepToF(&arg1->y, arg0->y, arg2, arg3, 0.0f);
|
||||
ret += Math_SmoothStepToF(&arg1->z, arg0->z, arg2, arg3, 0.0f);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -3475,12 +3475,12 @@ void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
|
||||
func_80033DB8(globalCtx, arg2, arg3);
|
||||
}
|
||||
|
||||
f32 Math_Rand_ZeroFloat(f32 f) {
|
||||
return Math_Rand_ZeroOne() * f;
|
||||
f32 Rand_ZeroFloat(f32 f) {
|
||||
return Rand_ZeroOne() * f;
|
||||
}
|
||||
|
||||
f32 Math_Rand_CenteredFloat(f32 f) {
|
||||
return (Math_Rand_ZeroOne() - 0.5f) * f;
|
||||
f32 Rand_CenteredFloat(f32 f) {
|
||||
return (Rand_ZeroOne() - 0.5f) * f;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -3666,7 +3666,7 @@ void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3,
|
||||
sp40 = Math_Vec3f_Yaw(&actor->posRot.pos, &arg1->unk_18) - actor->shape.rot.y;
|
||||
|
||||
temp1 = CLAMP(sp40, -arg2, arg2);
|
||||
Math_SmoothScaleMaxMinS(&arg1->unk_08.y, temp1, 6, 2000, 1);
|
||||
Math_SmoothStepToS(&arg1->unk_08.y, temp1, 6, 2000, 1);
|
||||
|
||||
sp40 = (ABS(sp40) >= 0x8000) ? 0 : ABS(sp40);
|
||||
arg1->unk_08.y = CLAMP(arg1->unk_08.y, -sp40, sp40);
|
||||
@@ -3674,23 +3674,23 @@ void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3,
|
||||
sp40 = sp40 - arg1->unk_08.y;
|
||||
|
||||
temp1 = CLAMP(sp40, -arg5, arg5);
|
||||
Math_SmoothScaleMaxMinS(&arg1->unk_0E.y, temp1, 6, 2000, 1);
|
||||
Math_SmoothStepToS(&arg1->unk_0E.y, temp1, 6, 2000, 1);
|
||||
|
||||
sp40 = (ABS(sp40) >= 0x8000) ? 0 : ABS(sp40);
|
||||
arg1->unk_0E.y = CLAMP(arg1->unk_0E.y, -sp40, sp40);
|
||||
|
||||
if (arg8 != 0) {
|
||||
if (arg3) {} // Seems necessary to match
|
||||
Math_SmoothScaleMaxMinS(&actor->shape.rot.y, sp44, 6, 2000, 1);
|
||||
Math_SmoothStepToS(&actor->shape.rot.y, sp44, 6, 2000, 1);
|
||||
}
|
||||
|
||||
temp1 = CLAMP(sp46, arg4, arg3);
|
||||
Math_SmoothScaleMaxMinS(&arg1->unk_08.x, temp1, 6, 2000, 1);
|
||||
Math_SmoothStepToS(&arg1->unk_08.x, temp1, 6, 2000, 1);
|
||||
|
||||
temp2 = sp46 - arg1->unk_08.x;
|
||||
|
||||
temp1 = CLAMP(temp2, arg7, arg6);
|
||||
Math_SmoothScaleMaxMinS(&arg1->unk_0E.x, temp1, 6, 2000, 1);
|
||||
Math_SmoothStepToS(&arg1->unk_0E.x, temp1, 6, 2000, 1);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800344BC.s")
|
||||
@@ -3734,11 +3734,11 @@ s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3,
|
||||
switch (arg1->unk_06) {
|
||||
case 0:
|
||||
case 2:
|
||||
arg1->unk_04 = Math_Rand_S16Offset(30, 30);
|
||||
arg1->unk_04 = Rand_S16Offset(30, 30);
|
||||
arg1->unk_06++;
|
||||
return 1;
|
||||
case 1:
|
||||
arg1->unk_04 = Math_Rand_S16Offset(10, 10);
|
||||
arg1->unk_04 = Rand_S16Offset(10, 10);
|
||||
arg1->unk_06++;
|
||||
return 3;
|
||||
}
|
||||
@@ -3839,10 +3839,10 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) {
|
||||
|
||||
if (arg3 < var) {
|
||||
actor->flags &= ~1;
|
||||
Math_SmoothScaleMaxMinS(&arg2, 0, 6, 0x14, 1);
|
||||
Math_SmoothStepToS(&arg2, 0, 6, 0x14, 1);
|
||||
} else {
|
||||
actor->flags |= 1;
|
||||
Math_SmoothScaleMaxMinS(&arg2, 0xFF, 6, 0x14, 1);
|
||||
Math_SmoothStepToS(&arg2, 0xFF, 6, 0x14, 1);
|
||||
}
|
||||
|
||||
return arg2;
|
||||
@@ -3885,7 +3885,7 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) {
|
||||
actor->params = 1;
|
||||
} else if (!(actor->bgCheckFlags & 1)) {
|
||||
Actor_MoveForward(actor);
|
||||
Math_SmoothScaleMaxMinF(&actor->speedXZ, 0.0f, 1.0f, 0.1f, 0.0f);
|
||||
Math_SmoothStepToF(&actor->speedXZ, 0.0f, 1.0f, 0.1f, 0.0f);
|
||||
} else if ((actor->bgCheckFlags & 2) && (actor->velocity.y < -4.0f)) {
|
||||
ret = 1;
|
||||
} else {
|
||||
@@ -4070,8 +4070,8 @@ void func_80035844(Vec3f* arg0, Vec3f* arg1, s16* arg2, s32 arg3) {
|
||||
f32 dz = arg1->z - arg0->z;
|
||||
f32 dy = arg3 ? (arg1->y - arg0->y) : (arg0->y - arg1->y);
|
||||
|
||||
arg2[1] = atan2s(dz, dx);
|
||||
arg2[0] = atan2s(sqrtf(SQ(dx) + SQ(dz)), dy);
|
||||
arg2[1] = Math_Atan2S(dz, dx);
|
||||
arg2[0] = Math_Atan2S(sqrtf(SQ(dx) + SQ(dz)), dy);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4117,15 +4117,15 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) {
|
||||
sp40 = floorPoly->norm.y * (1.0f / 32767);
|
||||
sp3C = floorPoly->norm.z * (1.0f / 32767);
|
||||
|
||||
sp38 = Math_Sins(arg1);
|
||||
sp34 = Math_Coss(arg1);
|
||||
sp38 = Math_SinS(arg1);
|
||||
sp34 = Math_CosS(arg1);
|
||||
sp28 = (-(sp44 * sp38) - (sp3C * sp34));
|
||||
arg2->x = -(s16)(Math_atan2f(sp28 * sp40, 1.0f) * (32768 / M_PI));
|
||||
arg2->x = -(s16)(Math_FAtan2F(sp28 * sp40, 1.0f) * (32768 / M_PI));
|
||||
|
||||
sp2C = Math_Sins(arg1 - 16375);
|
||||
sp30 = Math_Coss(arg1 - 16375);
|
||||
sp2C = Math_SinS(arg1 - 16375);
|
||||
sp30 = Math_CosS(arg1 - 16375);
|
||||
sp24 = (-(sp44 * sp2C) - (sp3C * sp30));
|
||||
arg2->z = -(s16)(Math_atan2f(sp24 * sp40, 1.0f) * (32768 / M_PI));
|
||||
arg2->z = -(s16)(Math_FAtan2F(sp24 * sp40, 1.0f) * (32768 / M_PI));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5433,10 +5433,10 @@ s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) {
|
||||
}
|
||||
|
||||
s32 func_80037F30(Vec3s* arg0, Vec3s* arg1) {
|
||||
Math_SmoothScaleMaxMinS(&arg0->y, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(&arg0->x, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(&arg1->y, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(&arg1->x, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(&arg0->y, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(&arg0->x, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(&arg1->y, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(&arg1->x, 0, 6, 6200, 100);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -5448,17 +5448,17 @@ s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) {
|
||||
sp36 = Math_Vec3f_Pitch(&actor->posRot2.pos, arg1);
|
||||
sp34 = Math_Vec3f_Yaw(&actor->posRot2.pos, arg1) - actor->posRot.rot.y;
|
||||
|
||||
Math_SmoothScaleMaxMinS(&arg2->x, sp36, 6, 2000, 1);
|
||||
Math_SmoothStepToS(&arg2->x, sp36, 6, 2000, 1);
|
||||
arg2->x = (arg2->x < -6000) ? -6000 : ((arg2->x > 6000) ? 6000 : arg2->x);
|
||||
|
||||
var = Math_SmoothScaleMaxMinS(&arg2->y, sp34, 6, 2000, 1);
|
||||
var = Math_SmoothStepToS(&arg2->y, sp34, 6, 2000, 1);
|
||||
arg2->y = (arg2->y < -8000) ? -8000 : ((arg2->y > 8000) ? 8000 : arg2->y);
|
||||
|
||||
if (var && (ABS(arg2->y) < 8000)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Math_SmoothScaleMaxMinS(&arg3->y, sp34 - arg2->y, 4, 2000, 1);
|
||||
Math_SmoothStepToS(&arg3->y, sp34 - arg2->y, 4, 2000, 1);
|
||||
arg3->y = (arg3->y < -12000) ? -12000 : ((arg3->y > 12000) ? 12000 : arg3->y);
|
||||
|
||||
return 1;
|
||||
|
||||
+59
-59
@@ -558,7 +558,7 @@ f32 Camera_GetWaterSurface(Camera* camera, Vec3f* chkPos, s32* envProp) {
|
||||
* Calculates the angle between points `from` and `to`
|
||||
*/
|
||||
s16 Camera_XZAngle(Vec3f* to, Vec3f* from) {
|
||||
return DEGF_TO_BINANG(RADF_TO_DEGF(Math_atan2f(from->x - to->x, from->z - to->z)));
|
||||
return DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(from->x - to->x, from->z - to->z)));
|
||||
}
|
||||
|
||||
s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
|
||||
@@ -580,8 +580,8 @@ s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
|
||||
f32 phi_f16;
|
||||
f32 playerHeight;
|
||||
|
||||
sinYaw = Math_Sins(yaw);
|
||||
cosYaw = Math_Coss(yaw);
|
||||
sinYaw = Math_SinS(yaw);
|
||||
cosYaw = Math_CosS(yaw);
|
||||
playerHeight = Player_GetHeight(camera->player);
|
||||
temp_f2 = PCT(OREG(19)) * playerHeight;
|
||||
sp30 = PCT(OREG(17)) * playerHeight;
|
||||
@@ -623,8 +623,8 @@ s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
|
||||
}
|
||||
phi_f16 = PCT(OREG(20)) * (D_8015CE50 - camera->playerGroundY);
|
||||
phi_f18 = (1.0f - PCT(OREG(20))) * (D_8015CE54 - camera->playerGroundY);
|
||||
temp_s0 = DEGF_TO_BINANG(RADF_TO_DEGF(Math_atan2f(phi_f16, sp30)));
|
||||
temp_s1 = DEGF_TO_BINANG(RADF_TO_DEGF(Math_atan2f(phi_f18, sp2C)));
|
||||
temp_s0 = DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(phi_f16, sp30)));
|
||||
temp_s1 = DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(phi_f18, sp2C)));
|
||||
return temp_s0 + temp_s1;
|
||||
}
|
||||
|
||||
@@ -653,13 +653,13 @@ Vec3f* Camera_CalcUpFromPitchYawRoll(Vec3f* dest, s16 pitch, s16 yaw, s16 roll)
|
||||
f32 temp_f8_2;
|
||||
f32 temp_f8_3;
|
||||
|
||||
sinPitch = Math_Sins(pitch);
|
||||
cosPitch = Math_Coss(pitch);
|
||||
sinYaw = Math_Sins(yaw);
|
||||
cosYaw = Math_Coss(yaw);
|
||||
sinPitch = Math_SinS(pitch);
|
||||
cosPitch = Math_CosS(pitch);
|
||||
sinYaw = Math_SinS(yaw);
|
||||
cosYaw = Math_CosS(yaw);
|
||||
negSinPitch = -sinPitch;
|
||||
sinNegRoll = Math_Sins(-roll);
|
||||
cosNegRoll = Math_Coss(-roll);
|
||||
sinNegRoll = Math_SinS(-roll);
|
||||
cosNegRoll = Math_CosS(-roll);
|
||||
negSinPitchSinYaw = negSinPitch * sinYaw;
|
||||
temp_f14 = 1.0f - cosNegRoll;
|
||||
cosPitchSinYaw = cosPitch * sinYaw;
|
||||
@@ -884,8 +884,8 @@ f32 Camera_CalcSlopeYAdj(Vec3f* floorNorm, s16 playerYRot, s16 eyeAtYaw, f32 adj
|
||||
|
||||
OLib_Vec3fToVecSphGeo(&floorNormSph, floorNorm);
|
||||
|
||||
tmp = Math_Coss(floorNormSph.pitch) * Math_Coss(playerYRot - floorNormSph.yaw);
|
||||
return (fabsf(tmp) * adjAmt) * Math_Coss(playerYRot - eyeAtYaw);
|
||||
tmp = Math_CosS(floorNormSph.pitch) * Math_CosS(playerYRot - floorNormSph.yaw);
|
||||
return (fabsf(tmp) * adjAmt) * Math_CosS(playerYRot - eyeAtYaw);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -940,7 +940,7 @@ s32 func_800458D4(Camera* camera, VecSph* eyeAtDir, f32 arg2, f32* arg3, s16 arg
|
||||
}
|
||||
|
||||
deltaY = playerPosRot->pos.y - *arg3;
|
||||
eyeAtAngle = Math_atan2f(deltaY, OLib_Vec3fDistXZ(&camera->at, &camera->eye));
|
||||
eyeAtAngle = Math_FAtan2F(deltaY, OLib_Vec3fDistXZ(&camera->at, &camera->eye));
|
||||
|
||||
if (eyeAtAngle > DEGF_TO_RADF(OREG(32))) {
|
||||
if (1) {}
|
||||
@@ -975,12 +975,12 @@ s32 func_80045B08(Camera* camera, VecSph* eyeAtDir, f32 yExtra, s16 arg3) {
|
||||
posOffsetTarget.x = 0.0f;
|
||||
posOffsetTarget.z = 0.0f;
|
||||
|
||||
temp_ret = Math_Sins(arg3);
|
||||
temp_ret = Math_SinS(arg3);
|
||||
|
||||
if (temp_ret < 0.0f) {
|
||||
phi_f2 = Math_Coss(playerPosRot->rot.y - eyeAtDir->yaw);
|
||||
phi_f2 = Math_CosS(playerPosRot->rot.y - eyeAtDir->yaw);
|
||||
} else {
|
||||
phi_f2 = -Math_Coss(playerPosRot->rot.y - eyeAtDir->yaw);
|
||||
phi_f2 = -Math_CosS(playerPosRot->rot.y - eyeAtDir->yaw);
|
||||
}
|
||||
|
||||
posOffsetTarget.y -= temp_ret * phi_f2 * OREG(9);
|
||||
@@ -1031,8 +1031,8 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 arg2, f32* arg3,
|
||||
phi_f20 = playerPosRot->pos.y - *arg3;
|
||||
sp54 = OLib_Vec3fDistXZ(at, &camera->eye);
|
||||
phi_f16 = sp54;
|
||||
Math_atan2f(phi_f20, sp54);
|
||||
temp_f2 = Math_tanf(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16;
|
||||
Math_FAtan2F(phi_f20, sp54);
|
||||
temp_f2 = Math_FTanF(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16;
|
||||
if (temp_f2 < phi_f20) {
|
||||
*arg3 += phi_f20 - temp_f2;
|
||||
phi_f20 = temp_f2;
|
||||
@@ -1043,7 +1043,7 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 arg2, f32* arg3,
|
||||
posOffsetTarget.y -= phi_f20;
|
||||
} else {
|
||||
phi_f20 = playerPosRot->pos.y - *arg3;
|
||||
temp_f2 = Math_atan2f(phi_f20, OLib_Vec3fDistXZ(at, eye));
|
||||
temp_f2 = Math_FAtan2F(phi_f20, OLib_Vec3fDistXZ(at, eye));
|
||||
if (DEG_TO_RAD(OREG(32)) < temp_f2) {
|
||||
phi_f16 = 1 - sinf(temp_f2 - DEG_TO_RAD(OREG(32)));
|
||||
} else if (temp_f2 < DEG_TO_RAD(OREG(33))) {
|
||||
@@ -1133,8 +1133,8 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f
|
||||
yPosDelta = playerPosRot->pos.y - *yPosOffset;
|
||||
eyeAtDist = OLib_Vec3fDistXZ(at, &camera->eye);
|
||||
phi_f16 = eyeAtDist;
|
||||
Math_atan2f(yPosDelta, eyeAtDist);
|
||||
temp_f0_2 = Math_tanf(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16;
|
||||
Math_FAtan2F(yPosDelta, eyeAtDist);
|
||||
temp_f0_2 = Math_FTanF(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16;
|
||||
if (temp_f0_2 < yPosDelta) {
|
||||
*yPosOffset = *yPosOffset + (yPosDelta - temp_f0_2);
|
||||
yPosDelta = temp_f0_2;
|
||||
@@ -1145,7 +1145,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f
|
||||
tmpPos0.y = tmpPos0.y - yPosDelta;
|
||||
} else {
|
||||
yPosDelta = playerPosRot->pos.y - *yPosOffset;
|
||||
temp_f0_2 = Math_atan2f(yPosDelta, OLib_Vec3fDistXZ(at, &camera->eye));
|
||||
temp_f0_2 = Math_FAtan2F(yPosDelta, OLib_Vec3fDistXZ(at, &camera->eye));
|
||||
|
||||
if (temp_f0_2 > DEG_TO_RAD(OREG(32))) {
|
||||
phi_f16 = 1.0f - sinf(temp_f0_2 - DEG_TO_RAD(OREG(32)));
|
||||
@@ -1227,7 +1227,7 @@ f32 Camera_LERPClampDist(Camera* camera, f32 dist, f32 min, f32 max) {
|
||||
}
|
||||
|
||||
camera->rUpdateRateInv = Camera_LERPCeilF(rUpdateRateInvTarget, camera->rUpdateRateInv, PCT(OREG(25)), 0.1f);
|
||||
return Camera_LERPCeilF(distTarget, camera->dist, 1.f / camera->rUpdateRateInv, 0.2f);
|
||||
return Camera_LERPCeilF(distTarget, camera->dist, 1.0f / camera->rUpdateRateInv, 0.2f);
|
||||
}
|
||||
|
||||
f32 Camera_ClampDist(Camera* camera, f32 dist, f32 minDist, f32 maxDist, s16 timer) {
|
||||
@@ -1261,7 +1261,7 @@ s16 Camera_CalcDefaultPitch(Camera* camera, s16 arg1, s16 arg2, s16 arg3) {
|
||||
s16 sp1C;
|
||||
|
||||
phi_v1 = ABS(arg1);
|
||||
phi_v0 = arg3 > 0 ? (s16)(Math_Coss(arg3) * arg3) : arg3;
|
||||
phi_v0 = arg3 > 0 ? (s16)(Math_CosS(arg3) * arg3) : arg3;
|
||||
sp1C = arg2 - phi_v0;
|
||||
|
||||
if (ABS(sp1C) < phi_v1) {
|
||||
@@ -1380,7 +1380,7 @@ void func_80046E20(Camera* camera, VecSph* eyeAdjustment, f32 minDist, f32 arg3,
|
||||
anim->atEyePoly = NULL;
|
||||
if (temp_f0 < OREG(21)) {
|
||||
sp40.yaw = eyeAdjustment->yaw;
|
||||
sp40.pitch = Math_Sins(atEyeColChk.sphNorm.pitch + 0x3FFF) * 16380.0f;
|
||||
sp40.pitch = Math_SinS(atEyeColChk.sphNorm.pitch + 0x3FFF) * 16380.0f;
|
||||
sp40.r = (OREG(21) - temp_f0) * PCT(OREG(22));
|
||||
Camera_Vec3fVecSphGeoAdd(eye, eye, &sp40);
|
||||
}
|
||||
@@ -1537,7 +1537,7 @@ s32 Camera_Normal1(Camera* camera) {
|
||||
}
|
||||
|
||||
spA0 = ((anim->swing.unk_18 != 0) && (norm1->yOffset > -40.0f))
|
||||
? (sp9C = Math_Sins(anim->swing.unk_14), ((-40.0f * sp9C) + (norm1->yOffset * (1.0f - sp9C))))
|
||||
? (sp9C = Math_SinS(anim->swing.unk_14), ((-40.0f * sp9C) + (norm1->yOffset * (1.0f - sp9C))))
|
||||
: norm1->yOffset;
|
||||
|
||||
if (norm1->interfaceFlags & 0x80) {
|
||||
@@ -1614,7 +1614,7 @@ s32 Camera_Normal1(Camera* camera) {
|
||||
|
||||
// crit wiggle
|
||||
if (gSaveContext.health <= 16 && ((camera->globalCtx->state.frames % 256) == 0)) {
|
||||
wiggleAdj = Math_Rand_ZeroOne() * 10000.0f;
|
||||
wiggleAdj = Rand_ZeroOne() * 10000.0f;
|
||||
camera->inputDir.y = wiggleAdj + camera->inputDir.y;
|
||||
}
|
||||
} else {
|
||||
@@ -2420,9 +2420,9 @@ s32 Camera_Jump2(Camera* camera) {
|
||||
}
|
||||
|
||||
// Check the floor at the top of the climb
|
||||
bgChkPos.x = playerPosRot->pos.x + (Math_Sins(playerPosRot->rot.y) * 25.0f);
|
||||
bgChkPos.x = playerPosRot->pos.x + (Math_SinS(playerPosRot->rot.y) * 25.0f);
|
||||
bgChkPos.y = playerPosRot->pos.y + (playerHeight * 2.2f);
|
||||
bgChkPos.z = playerPosRot->pos.z + (Math_Coss(playerPosRot->rot.y) * 25.0f);
|
||||
bgChkPos.z = playerPosRot->pos.z + (Math_CosS(playerPosRot->rot.y) * 25.0f);
|
||||
|
||||
sp90 = Camera_GetFloorYNorm(camera, &floorNorm, &bgChkPos, &bgId);
|
||||
if ((sp90 != BGCHECK_Y_MIN) && (playerPosRot->pos.y < sp90)) {
|
||||
@@ -4211,13 +4211,13 @@ s32 Camera_Subj3(Camera* camera) {
|
||||
func_80044340(camera, at, eye);
|
||||
}
|
||||
} else {
|
||||
sp58 = Math_Sins(-sp60.rot.x);
|
||||
temp_f0_3 = Math_Coss(-sp60.rot.x);
|
||||
sp58 = Math_SinS(-sp60.rot.x);
|
||||
temp_f0_3 = Math_CosS(-sp60.rot.x);
|
||||
sp98.x = subj3->atOffset.x;
|
||||
sp98.y = (subj3->atOffset.y * temp_f0_3) - (subj3->atOffset.z * sp58);
|
||||
sp98.z = (subj3->atOffset.y * sp58) + (subj3->atOffset.z * temp_f0_3);
|
||||
sp58 = Math_Sins(BINANG_ROT180(sp60.rot.y));
|
||||
temp_f0_3 = Math_Coss(BINANG_ROT180(sp60.rot.y));
|
||||
sp58 = Math_SinS(BINANG_ROT180(sp60.rot.y));
|
||||
temp_f0_3 = Math_CosS(BINANG_ROT180(sp60.rot.y));
|
||||
subj3->atOffset.x = (sp98.z * sp58) + (sp98.x * temp_f0_3);
|
||||
subj3->atOffset.y = sp98.y;
|
||||
subj3->atOffset.z = (sp98.z * temp_f0_3) - (sp98.x * sp58);
|
||||
@@ -4341,7 +4341,7 @@ s32 Camera_Subj4(Camera* camera) {
|
||||
sp64.pitch = 0x238C;
|
||||
Camera_Vec3fVecSphGeoAdd(&sp98, eyeNext, &sp64);
|
||||
anim->unk_2C += 0xBB8;
|
||||
temp_f16 = Math_Coss(anim->unk_2C);
|
||||
temp_f16 = Math_CosS(anim->unk_2C);
|
||||
eye->x += (sp98.x - eye->x) * fabsf(temp_f16);
|
||||
eye->y += (sp98.y - eye->y) * fabsf(temp_f16);
|
||||
eye->z += (sp98.z - eye->z) * fabsf(temp_f16);
|
||||
@@ -4360,9 +4360,9 @@ s32 Camera_Subj4(Camera* camera) {
|
||||
camera->player->actor.shape.rot.y = sp64.yaw;
|
||||
temp_f16 = ((240.0f * temp_f16) * (anim->unk_24 * 0.416667f));
|
||||
temp_a0 = temp_f16 + anim->unk_30;
|
||||
at->x = eye->x + (Math_Sins(temp_a0) * 10.0f);
|
||||
at->x = eye->x + (Math_SinS(temp_a0) * 10.0f);
|
||||
at->y = eye->y;
|
||||
at->z = eye->z + (Math_Coss(temp_a0) * 10.0f);
|
||||
at->z = eye->z + (Math_CosS(temp_a0) * 10.0f);
|
||||
camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5f, 0xA);
|
||||
return 1;
|
||||
}
|
||||
@@ -4975,7 +4975,7 @@ s32 Camera_Unique7(Camera* camera) {
|
||||
// 0x7D0 ~ 10.98 degres.
|
||||
unk08->unk_00.x = Camera_LERPFloorS(playerPosEyeOffset.yaw, unk08->unk_00.x, 0.4f, 0x7D0);
|
||||
playerPosEyeOffset.pitch =
|
||||
-BGCAM_ROT(sceneCamData).x * Math_Coss(playerPosEyeOffset.yaw - BGCAM_ROT(sceneCamData).y);
|
||||
-BGCAM_ROT(sceneCamData).x * Math_CosS(playerPosEyeOffset.yaw - BGCAM_ROT(sceneCamData).y);
|
||||
Camera_Vec3fVecSphGeoAdd(at, eye, &playerPosEyeOffset);
|
||||
camera->unk_14C |= 0x400;
|
||||
return true;
|
||||
@@ -5630,9 +5630,9 @@ s32 Camera_Demo3(Camera* camera) {
|
||||
anim->initialAt.y = camera->playerGroundY;
|
||||
}
|
||||
angle = camPlayerPosRot->rot.y;
|
||||
sp68.x = anim->initialAt.x + (Math_Sins(angle) * 40.0f);
|
||||
sp68.x = anim->initialAt.x + (Math_SinS(angle) * 40.0f);
|
||||
sp68.y = anim->initialAt.y + 40.0f;
|
||||
sp68.z = anim->initialAt.z + (Math_Coss(angle) * 40.0f);
|
||||
sp68.z = anim->initialAt.z + (Math_CosS(angle) * 40.0f);
|
||||
if (camera->globalCtx->state.frames & 1) {
|
||||
angle -= 0x3FFF;
|
||||
anim->yawDir = 1;
|
||||
@@ -5640,9 +5640,9 @@ s32 Camera_Demo3(Camera* camera) {
|
||||
angle += 0x3FFF;
|
||||
anim->yawDir = -1;
|
||||
}
|
||||
sp74.x = sp68.x + (D_8011D658[1].r * Math_Sins(angle));
|
||||
sp74.x = sp68.x + (D_8011D658[1].r * Math_SinS(angle));
|
||||
sp74.y = anim->initialAt.y + 5.0f;
|
||||
sp74.z = sp68.z + (D_8011D658[1].r * Math_Coss(angle));
|
||||
sp74.z = sp68.z + (D_8011D658[1].r * Math_CosS(angle));
|
||||
if (Camera_BGCheck(camera, &sp68, &sp74)) {
|
||||
anim->yawDir = -anim->yawDir;
|
||||
}
|
||||
@@ -5838,8 +5838,8 @@ s32 Camera_Demo5(Camera* camera) {
|
||||
// camera is targeting a(the) player actor
|
||||
if (eyePlayerGeo.r > 30.0f) {
|
||||
D_8011D6AC[1].timerInit = camera->timer - 1;
|
||||
D_8011D6AC[1].atTargetInit.z = Math_Rand_ZeroOne() * 10.0f;
|
||||
D_8011D6AC[1].eyeTargetInit.x = Math_Rand_ZeroOne() * 10.0f;
|
||||
D_8011D6AC[1].atTargetInit.z = Rand_ZeroOne() * 10.0f;
|
||||
D_8011D6AC[1].eyeTargetInit.x = Rand_ZeroOne() * 10.0f;
|
||||
ONEPOINTDEMO->keyFrames = D_8011D6AC;
|
||||
ONEPOINTDEMO->keyFrameCnt = ARRAY_COUNT(D_8011D6AC);
|
||||
if (camera->parentCamIdx != 0) {
|
||||
@@ -5848,7 +5848,7 @@ s32 Camera_Demo5(Camera* camera) {
|
||||
camera->timer += D_8011D6AC[2].timerInit;
|
||||
}
|
||||
} else {
|
||||
D_8011D724[1].eyeTargetInit.x = Math_Rand_ZeroOne() * 10.0f;
|
||||
D_8011D724[1].eyeTargetInit.x = Rand_ZeroOne() * 10.0f;
|
||||
D_8011D724[1].timerInit = camera->timer - 1;
|
||||
ONEPOINTDEMO->keyFrames = D_8011D724;
|
||||
ONEPOINTDEMO->keyFrameCnt = ARRAY_COUNT(D_8011D724);
|
||||
@@ -5906,7 +5906,7 @@ s32 Camera_Demo5(Camera* camera) {
|
||||
} else {
|
||||
D_8011D8DC[0].atTargetInit.z = eyeTargetDist * 0.6f;
|
||||
D_8011D8DC[0].eyeTargetInit.z = eyeTargetDist + 50.0f;
|
||||
D_8011D8DC[0].eyeTargetInit.x = Math_Rand_ZeroOne() * 10.0f;
|
||||
D_8011D8DC[0].eyeTargetInit.x = Rand_ZeroOne() * 10.0f;
|
||||
if (BINANG_SUB(eyePlayerGeo.yaw, playerTargetGeo.yaw) > 0) {
|
||||
D_8011D8DC[0].atTargetInit.x = -D_8011D8DC[0].atTargetInit.x;
|
||||
D_8011D8DC[0].eyeTargetInit.x = -D_8011D8DC[0].eyeTargetInit.x;
|
||||
@@ -5937,14 +5937,14 @@ s32 Camera_Demo5(Camera* camera) {
|
||||
|
||||
D_8011D954[0].atTargetInit.y = D_8011D954[0].eyeTargetInit.y = D_8011D954[1].atTargetInit.y =
|
||||
camera->target->shape.rot.y == sp4A ? 180.0f : 0.0f;
|
||||
sp90 = (BINANG_SUB(playerTargetGeo.yaw, sp4A) < 0 ? 20.0f : -20.0f) * Math_Rand_ZeroOne();
|
||||
sp90 = (BINANG_SUB(playerTargetGeo.yaw, sp4A) < 0 ? 20.0f : -20.0f) * Rand_ZeroOne();
|
||||
D_8011D954[0].eyeTargetInit.y = D_8011D954->eyeTargetInit.y + sp90;
|
||||
temp_v0 = Math_Rand_ZeroOne() * (sp90 * -0.2f);
|
||||
temp_v0 = Rand_ZeroOne() * (sp90 * -0.2f);
|
||||
D_8011D954[1].rollTargetInit = temp_v0;
|
||||
D_8011D954[0].rollTargetInit = temp_v0;
|
||||
func_8002EEE4(&targetPosRot2, camera->target);
|
||||
targetPosRot2.pos.x += 50.0f * Math_Sins(BINANG_ROT180(sp4A));
|
||||
targetPosRot2.pos.z += 50.0f * Math_Coss(BINANG_ROT180(sp4A));
|
||||
targetPosRot2.pos.x += 50.0f * Math_SinS(BINANG_ROT180(sp4A));
|
||||
targetPosRot2.pos.z += 50.0f * Math_CosS(BINANG_ROT180(sp4A));
|
||||
if (Camera_BGCheck(camera, &playerPosRot2.pos, &targetPosRot2.pos)) {
|
||||
D_8011D954[1].actionFlags = 0xC1;
|
||||
D_8011D954[2].actionFlags = 0x8F;
|
||||
@@ -5964,7 +5964,7 @@ s32 Camera_Demo5(Camera* camera) {
|
||||
D_8011D9F4[0].atTargetInit.z = playerTargetGeo.r * 0.25f;
|
||||
}
|
||||
if (playerTargetGeo.r < 400.0f) {
|
||||
D_8011D9F4[0].eyeTargetInit.x = Math_Rand_ZeroOne() * 25.0f;
|
||||
D_8011D9F4[0].eyeTargetInit.x = Rand_ZeroOne() * 25.0f;
|
||||
}
|
||||
Player_GetHeight(camera->player);
|
||||
D_8011D9F4[0].timerInit = camera->timer;
|
||||
@@ -6347,9 +6347,9 @@ s32 Camera_Special4(Camera* camera) {
|
||||
|
||||
// 0x3E8 ~ 5.49 degrees
|
||||
sp3A = BINANG_ROT180(curTargetPosRot.rot.y) + 0x3E8;
|
||||
camera->eye.x = camera->eyeNext.x = (Math_Sins(sp3A) * 780.0f) + camera->at.x;
|
||||
camera->eye.x = camera->eyeNext.x = (Math_SinS(sp3A) * 780.0f) + camera->at.x;
|
||||
camera->eyeNext.y = camera->at.y;
|
||||
camera->eye.z = camera->eyeNext.z = (Math_Coss(sp3A) * 780.0f) + camera->at.z;
|
||||
camera->eye.z = camera->eyeNext.z = (Math_CosS(sp3A) * 780.0f) + camera->at.z;
|
||||
camera->eye.y = curTargetPosRot.pos.y;
|
||||
camera->eye.y = Camera_GetFloorY(camera, &camera->eye) + 20.0f;
|
||||
(*timer)--;
|
||||
@@ -6425,7 +6425,7 @@ s32 Camera_Special5(Camera* camera) {
|
||||
OLib_Vec3fToVecSphGeo(&sp6C, &sp7C.norm);
|
||||
spA4 = BINANG_SUB(playerPosRot->rot.y, sp6C.yaw);
|
||||
sp74.r = spec5->eyeDist;
|
||||
temp_f0_2 = Math_Rand_ZeroOne();
|
||||
temp_f0_2 = Rand_ZeroOne();
|
||||
sp74.yaw =
|
||||
BINANG_ROT180(playerPosRot->rot.y) + (s16)(spA4 < 0 ? -(s16)(0x1553 + (s16)(temp_f0_2 * 2730.0f))
|
||||
: (s16)(0x1553 + (s16)(temp_f0_2 * 2730.0f)));
|
||||
@@ -7285,12 +7285,12 @@ void func_80058E8C(Camera* camera) {
|
||||
}
|
||||
D_8011DB08 += DEGF_TO_BINANG(phi_f0);
|
||||
D_8011DB0C += DEGF_TO_BINANG(phi_f2);
|
||||
Math_Coss(D_8011DB08);
|
||||
Math_Sins(D_8011DB08);
|
||||
Math_Sins(D_8011DB0C);
|
||||
Math_CosS(D_8011DB08);
|
||||
Math_SinS(D_8011DB08);
|
||||
Math_SinS(D_8011DB0C);
|
||||
func_800AA76C(&camera->globalCtx->view, 0.0f, 0.0f, 0.0f);
|
||||
func_800AA78C(&camera->globalCtx->view, Math_Sins(D_8011DB0C) * (sp40 * phi_f20) + 1.0f,
|
||||
Math_Coss(D_8011DB0C) * (sp3C * phi_f20) + 1.0f, Math_Coss(D_8011DB08) * (sp38 * phi_f20) + 1.0f);
|
||||
func_800AA78C(&camera->globalCtx->view, Math_SinS(D_8011DB0C) * (sp40 * phi_f20) + 1.0f,
|
||||
Math_CosS(D_8011DB0C) * (sp3C * phi_f20) + 1.0f, Math_CosS(D_8011DB08) * (sp38 * phi_f20) + 1.0f);
|
||||
func_800AA7AC(&camera->globalCtx->view, sp34 * sp60);
|
||||
camera->unk_14C |= 0x40;
|
||||
} else if (camera->unk_14C & 0x40) {
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ void func_80064720(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
||||
}
|
||||
|
||||
u32 func_8006472C(GlobalContext* globalCtx, CutsceneContext* csCtx, f32 target) {
|
||||
return Math_ApproxF(&csCtx->unk_0C, target, 0.1f);
|
||||
return Math_StepToF(&csCtx->unk_0C, target, 0.1f);
|
||||
}
|
||||
|
||||
void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx) {
|
||||
|
||||
+12
-12
@@ -602,16 +602,16 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
|
||||
vtx[0].v = baseVtx;
|
||||
vtx[1].v = baseVtx;
|
||||
|
||||
vtx[0].v.ob[0] = Math_nearbyintf(sp158.x);
|
||||
vtx[0].v.ob[1] = Math_nearbyintf(sp158.y);
|
||||
vtx[0].v.ob[2] = Math_nearbyintf(sp158.z);
|
||||
vtx[0].v.ob[0] = Math_FNearbyIntF(sp158.x);
|
||||
vtx[0].v.ob[1] = Math_FNearbyIntF(sp158.y);
|
||||
vtx[0].v.ob[2] = Math_FNearbyIntF(sp158.z);
|
||||
vtx[0].v.cn[0] = sp148.r;
|
||||
vtx[0].v.cn[1] = sp148.g;
|
||||
vtx[0].v.cn[2] = sp148.b;
|
||||
vtx[0].v.cn[3] = sp148.a;
|
||||
vtx[1].v.ob[0] = Math_nearbyintf(sp14C.x);
|
||||
vtx[1].v.ob[1] = Math_nearbyintf(sp14C.y);
|
||||
vtx[1].v.ob[2] = Math_nearbyintf(sp14C.z);
|
||||
vtx[1].v.ob[0] = Math_FNearbyIntF(sp14C.x);
|
||||
vtx[1].v.ob[1] = Math_FNearbyIntF(sp14C.y);
|
||||
vtx[1].v.ob[2] = Math_FNearbyIntF(sp14C.z);
|
||||
vtx[1].v.cn[0] = sp144.r;
|
||||
vtx[1].v.cn[1] = sp144.g;
|
||||
vtx[1].v.cn[2] = sp144.b;
|
||||
@@ -644,17 +644,17 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
|
||||
vtx[j1].v = baseVtx;
|
||||
vtx[j2].v = baseVtx;
|
||||
|
||||
vtx[j1].v.ob[0] = Math_nearbyintf(sp158.x);
|
||||
vtx[j1].v.ob[1] = Math_nearbyintf(sp158.y);
|
||||
vtx[j1].v.ob[2] = Math_nearbyintf(sp158.z);
|
||||
vtx[j1].v.ob[0] = Math_FNearbyIntF(sp158.x);
|
||||
vtx[j1].v.ob[1] = Math_FNearbyIntF(sp158.y);
|
||||
vtx[j1].v.ob[2] = Math_FNearbyIntF(sp158.z);
|
||||
vtx[j1].v.cn[0] = func_80027E84(sp1A4.r, sp19C.r, temp_f28);
|
||||
vtx[j1].v.cn[1] = func_80027E84(sp1A4.g, sp19C.g, temp_f28);
|
||||
vtx[j1].v.cn[2] = func_80027E84(sp1A4.b, sp19C.b, temp_f28);
|
||||
vtx[j1].v.cn[3] = func_80027E84(sp1A4.a, sp19C.a, temp_f28);
|
||||
|
||||
vtx[j2].v.ob[0] = Math_nearbyintf(sp14C.x);
|
||||
vtx[j2].v.ob[1] = Math_nearbyintf(sp14C.y);
|
||||
vtx[j2].v.ob[2] = Math_nearbyintf(sp14C.z);
|
||||
vtx[j2].v.ob[0] = Math_FNearbyIntF(sp14C.x);
|
||||
vtx[j2].v.ob[1] = Math_FNearbyIntF(sp14C.y);
|
||||
vtx[j2].v.ob[2] = Math_FNearbyIntF(sp14C.z);
|
||||
vtx[j2].v.cn[0] = func_80027E84(sp1A0.r, sp198.r, temp_f28);
|
||||
vtx[j2].v.cn[1] = func_80027E84(sp1A0.g, sp198.g, temp_f28);
|
||||
vtx[j2].v.cn[2] = func_80027E84(sp1A0.b, sp198.b, temp_f28);
|
||||
|
||||
@@ -37,14 +37,13 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) {
|
||||
this->timer = 0;
|
||||
|
||||
for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) {
|
||||
elem->initialSpeed =
|
||||
(Math_Rand_ZeroOne() * (this->maxInitialSpeed * 0.5f)) + (this->maxInitialSpeed * 0.5f);
|
||||
elem->initialSpeed = (Rand_ZeroOne() * (this->maxInitialSpeed * 0.5f)) + (this->maxInitialSpeed * 0.5f);
|
||||
elem->endX = 0.0f;
|
||||
elem->startXChange = 0.0f;
|
||||
elem->startX = 0.0f;
|
||||
elem->endXChange = elem->initialSpeed;
|
||||
elem->yaw = Math_Rand_ZeroOne() * 65534.0f;
|
||||
elem->pitch = Math_Rand_ZeroOne() * 65534.0f;
|
||||
elem->yaw = Rand_ZeroOne() * 65534.0f;
|
||||
elem->pitch = Rand_ZeroOne() * 65534.0f;
|
||||
}
|
||||
|
||||
this->lightDecay = initParams->lightDecay;
|
||||
|
||||
+10
-10
@@ -66,9 +66,9 @@ void EffectSpark_Init(void* thisx, void* initParamsx) {
|
||||
elem->position.x = this->position.x;
|
||||
elem->position.y = this->position.y;
|
||||
elem->position.z = this->position.z;
|
||||
elem->velocity.x = Math_Rand_ZeroOne() - 0.5f;
|
||||
elem->velocity.y = Math_Rand_ZeroOne() - 0.5f;
|
||||
elem->velocity.z = Math_Rand_ZeroOne() - 0.5f;
|
||||
elem->velocity.x = Rand_ZeroOne() - 0.5f;
|
||||
elem->velocity.y = Rand_ZeroOne() - 0.5f;
|
||||
elem->velocity.z = Rand_ZeroOne() - 0.5f;
|
||||
|
||||
velocityNorm = sqrtf(SQ(elem->velocity.x) + SQ(elem->velocity.y) + SQ(elem->velocity.z));
|
||||
|
||||
@@ -81,12 +81,12 @@ void EffectSpark_Init(void* thisx, void* initParamsx) {
|
||||
elem->velocity.y = this->speed;
|
||||
}
|
||||
|
||||
elem->unkVelocity.x = 30000.0f - Math_Rand_ZeroOne() * 15000.0f;
|
||||
elem->unkVelocity.y = 30000.0f - Math_Rand_ZeroOne() * 15000.0f;
|
||||
elem->unkVelocity.z = 30000.0f - Math_Rand_ZeroOne() * 15000.0f;
|
||||
elem->unkPosition.x = Math_Rand_ZeroOne() * 65534.0f;
|
||||
elem->unkPosition.y = Math_Rand_ZeroOne() * 65534.0f;
|
||||
elem->unkPosition.z = Math_Rand_ZeroOne() * 65534.0f;
|
||||
elem->unkVelocity.x = 30000.0f - Rand_ZeroOne() * 15000.0f;
|
||||
elem->unkVelocity.y = 30000.0f - Rand_ZeroOne() * 15000.0f;
|
||||
elem->unkVelocity.z = 30000.0f - Rand_ZeroOne() * 15000.0f;
|
||||
elem->unkPosition.x = Rand_ZeroOne() * 65534.0f;
|
||||
elem->unkPosition.y = Rand_ZeroOne() * 65534.0f;
|
||||
elem->unkPosition.z = Rand_ZeroOne() * 65534.0f;
|
||||
}
|
||||
|
||||
this->timer = 0;
|
||||
@@ -214,7 +214,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
||||
elem = &this->elements[i];
|
||||
|
||||
SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z);
|
||||
temp = ((Math_Rand_ZeroOne() * 2.5f) + 1.5f) * 0.015625f;
|
||||
temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) * 0.015625f;
|
||||
SkinMatrix_SetScale(&spAC, temp, temp, 1.0f);
|
||||
SkinMatrix_MtxFMtxFMult(&spEC, &globalCtx->mf_11DA0, &sp6C);
|
||||
SkinMatrix_MtxFMtxFMult(&sp6C, &spAC, &sp12C);
|
||||
|
||||
@@ -8,7 +8,7 @@ void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 113);
|
||||
|
||||
displayListHead = POLY_OPA_DISP;
|
||||
cos = Math_Coss((0x8000 / arg3) * arg2);
|
||||
cos = Math_CosS((0x8000 / arg3) * arg2);
|
||||
absCos = ABS(cos);
|
||||
|
||||
gDPPipeSync(displayListHead++);
|
||||
@@ -35,7 +35,7 @@ void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
|
||||
if (arg3 != 0) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 141);
|
||||
|
||||
cos = Math_Coss((0x4000 / arg3) * arg2);
|
||||
cos = Math_CosS((0x4000 / arg3) * arg2);
|
||||
displayListHead = POLY_OPA_DISP;
|
||||
|
||||
gDPPipeSync(displayListHead++);
|
||||
@@ -69,7 +69,7 @@ void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 178);
|
||||
|
||||
displayListHead = POLY_XLU_DISP;
|
||||
cos = Math_Coss((0x8000 / arg3) * arg2);
|
||||
cos = Math_CosS((0x8000 / arg3) * arg2);
|
||||
absCos = ABS(cos);
|
||||
|
||||
gDPPipeSync(displayListHead++);
|
||||
@@ -96,7 +96,7 @@ void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 201);
|
||||
|
||||
displayListHead = POLY_XLU_DISP;
|
||||
cos = Math_Coss((0x4000 / arg3) * arg2);
|
||||
cos = Math_CosS((0x4000 / arg3) * arg2);
|
||||
|
||||
gDPPipeSync(displayListHead++);
|
||||
gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a);
|
||||
|
||||
@@ -182,17 +182,17 @@ void func_80028894(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity,
|
||||
s16 randAngle;
|
||||
f32 rand;
|
||||
|
||||
rand = Math_Rand_ZeroOne() * randScale;
|
||||
randAngle = (Math_Rand_ZeroOne() * 65536.0f);
|
||||
rand = Rand_ZeroOne() * randScale;
|
||||
randAngle = (Rand_ZeroOne() * 65536.0f);
|
||||
|
||||
*newPos = *srcPos;
|
||||
|
||||
newPos->x += Math_Sins(randAngle) * rand;
|
||||
newPos->z += Math_Coss(randAngle) * rand;
|
||||
newPos->x += Math_SinS(randAngle) * rand;
|
||||
newPos->z += Math_CosS(randAngle) * rand;
|
||||
|
||||
velocity->y = 1.0f;
|
||||
velocity->x = Math_Sins(randAngle);
|
||||
velocity->z = Math_Coss(randAngle);
|
||||
velocity->x = Math_SinS(randAngle);
|
||||
velocity->z = Math_CosS(randAngle);
|
||||
|
||||
accel->x = 0.0f;
|
||||
accel->y = 0.0f;
|
||||
@@ -243,13 +243,13 @@ void EffectSsKiraKira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f
|
||||
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
Math_Vec3f_Copy(&initParams.velocity, velocity);
|
||||
initParams.velocity.y = ((Math_Rand_ZeroOne() * initParams.velocity.y) + initParams.velocity.y) * 0.5f;
|
||||
initParams.velocity.y = ((Rand_ZeroOne() * initParams.velocity.y) + initParams.velocity.y) * 0.5f;
|
||||
Math_Vec3f_Copy(&initParams.accel, accel);
|
||||
initParams.accel.y = ((Math_Rand_ZeroOne() * initParams.accel.y) + initParams.accel.y) * 0.5f;
|
||||
initParams.accel.y = ((Rand_ZeroOne() * initParams.accel.y) + initParams.accel.y) * 0.5f;
|
||||
initParams.life = life;
|
||||
initParams.updateMode = 0;
|
||||
initParams.rotSpeed = 0x1518;
|
||||
initParams.yaw = Math_Rand_ZeroOne() * 16384.0f;
|
||||
initParams.yaw = Rand_ZeroOne() * 16384.0f;
|
||||
initParams.scale = scale;
|
||||
initParams.primColor = *primColor;
|
||||
initParams.envColor = *envColor;
|
||||
@@ -268,7 +268,7 @@ void EffectSsKiraKira_SpawnFocused(GlobalContext* globalCtx, Vec3f* pos, Vec3f*
|
||||
initParams.life = life;
|
||||
initParams.updateMode = 1;
|
||||
initParams.rotSpeed = 0x1518;
|
||||
initParams.yaw = Math_Rand_ZeroOne() * 16384.0f;
|
||||
initParams.yaw = Rand_ZeroOne() * 16384.0f;
|
||||
initParams.scale = scale;
|
||||
Color_RGBA8_Copy(&initParams.primColor, primColor);
|
||||
Color_RGBA8_Copy(&initParams.envColor, envColor);
|
||||
@@ -410,7 +410,7 @@ void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f*
|
||||
Color_RGBA8 envColor = { 255, 0, 0, 0 };
|
||||
s32 randOffset;
|
||||
|
||||
randOffset = (Math_Rand_ZeroOne() * 20.0f) - 10.0f;
|
||||
randOffset = (Rand_ZeroOne() * 20.0f) - 10.0f;
|
||||
|
||||
primColor.r += randOffset;
|
||||
primColor.g += randOffset;
|
||||
@@ -619,12 +619,12 @@ void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstSca
|
||||
accel.x = accel.z = 0.0f;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
velocity.x = (Math_Rand_ZeroOne() - 0.5f) * burstScale;
|
||||
velocity.z = (Math_Rand_ZeroOne() - 0.5f) * burstScale;
|
||||
velocity.y = ((Math_Rand_ZeroOne() * 0.5f) + 0.5f) * burstScale;
|
||||
velocity.x = (Rand_ZeroOne() - 0.5f) * burstScale;
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * burstScale;
|
||||
velocity.y = ((Rand_ZeroOne() * 0.5f) + 0.5f) * burstScale;
|
||||
|
||||
EffectSsHahen_Spawn(globalCtx, pos, &velocity, &accel, unused, Math_Rand_S16Offset(scale, randScaleRange),
|
||||
objId, life, dList);
|
||||
EffectSsHahen_Spawn(globalCtx, pos, &velocity, &accel, unused, Rand_S16Offset(scale, randScaleRange), objId,
|
||||
life, dList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) {
|
||||
Vec3f unusedZeroVec1 = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f unusedZeroVec2 = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
s16 randDirection = Math_Rand_ZeroOne() * 1.99f;
|
||||
s16 randDirection = Rand_ZeroOne() * 1.99f;
|
||||
|
||||
for (i = 0; i < KREG(19) + 30; i++) {
|
||||
EffectSsSibuki_Spawn(globalCtx, pos, &zeroVec, &zeroVec, i / (KREG(27) + 6), randDirection, KREG(18) + 40);
|
||||
@@ -864,7 +864,7 @@ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 sc
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(vecScales); i++) {
|
||||
pos = *refPos;
|
||||
velocityScale = Math_Rand_ZeroFloat(1.0f) + 0.5f;
|
||||
velocityScale = Rand_ZeroFloat(1.0f) + 0.5f;
|
||||
velocity.x = (vecScales[i].x * 0.18f) * velocityScale;
|
||||
velocity.y = (vecScales[i].y * 0.18f) * velocityScale;
|
||||
velocity.z = (vecScales[i].z * 0.18f) * velocityScale;
|
||||
@@ -872,8 +872,8 @@ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 sc
|
||||
pos.y += vecScales[i].y;
|
||||
pos.z += vecScales[i].z;
|
||||
|
||||
EffectSsIcePiece_Spawn(globalCtx, &pos, (Math_Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f),
|
||||
&velocity, &accel, 25);
|
||||
EffectSsIcePiece_Spawn(globalCtx, &pos, (Rand_ZeroFloat(1.0f) + 0.5f) * ((scale * 1.3f) * 100.0f), &velocity,
|
||||
&accel, 25);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ u32 func_8006BF1C(ElfMessage** msgp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
temp3 = Math_Rand_ZeroFloat(temp1);
|
||||
temp3 = Rand_ZeroFloat(temp1);
|
||||
for (temp1 = 0; temp1 < temp2; temp1++) {
|
||||
if (sp44[temp1]) {
|
||||
if (temp3 > 0) {
|
||||
|
||||
@@ -244,7 +244,7 @@ void func_8001D480(EnAObj* this, s16 params) {
|
||||
}
|
||||
|
||||
void func_8001D4A8(EnAObj* this, GlobalContext* globalCtx) {
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f);
|
||||
this->dyna.actor.shape.rot.x = this->dyna.actor.shape.rot.x + (this->dyna.actor.posRot.rot.x >> 1);
|
||||
this->dyna.actor.shape.rot.z = this->dyna.actor.shape.rot.z + (this->dyna.actor.posRot.rot.z >> 1);
|
||||
|
||||
@@ -282,7 +282,7 @@ void func_8001D608(EnAObj* this, GlobalContext* globalCtx) {
|
||||
? -2.5f
|
||||
: ((this->dyna.actor.speedXZ > 2.5f) ? 2.5f : this->dyna.actor.speedXZ);
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f);
|
||||
|
||||
if (this->dyna.actor.speedXZ != 0.0f) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG);
|
||||
|
||||
+21
-21
@@ -96,7 +96,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->unk_15C = 0.02f;
|
||||
break;
|
||||
case ITEM00_HEART:
|
||||
this->actor.initPosRot.rot.z = Math_Rand_CenteredFloat(65535.0f);
|
||||
this->actor.initPosRot.rot.z = Rand_CenteredFloat(65535.0f);
|
||||
sp34 = 430.0f;
|
||||
Actor_SetScale(&this->actor, 0.02f);
|
||||
this->unk_15C = 0.02f;
|
||||
@@ -286,25 +286,25 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) {
|
||||
if (this->unk_15A == -1) {
|
||||
if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, this->actor.posRot.rot.x - 0x4000, 2, 3000,
|
||||
if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.posRot.rot.x - 0x4000, 2, 3000,
|
||||
1500)) {
|
||||
this->unk_15A = -2;
|
||||
}
|
||||
} else {
|
||||
if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, -this->actor.posRot.rot.x - 0x4000, 2, 3000,
|
||||
if (!Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.posRot.rot.x - 0x4000, 2, 3000,
|
||||
1500)) {
|
||||
this->unk_15A = -1;
|
||||
}
|
||||
}
|
||||
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.x, 0, 2, 2500, 500);
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.x, 0, 2, 2500, 500);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->actor.params == ITEM00_HEART_PIECE) {
|
||||
this->actor.shape.unk_08 = Math_Sins(this->actor.shape.rot.y) * 150.0f + 850.0f;
|
||||
this->actor.shape.unk_08 = Math_SinS(this->actor.shape.rot.y) * 150.0f + 850.0f;
|
||||
}
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f);
|
||||
Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f);
|
||||
|
||||
if (this->unk_154 == 0) {
|
||||
if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) &&
|
||||
@@ -334,9 +334,9 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (globalCtx->gameplayFrames & 1) {
|
||||
pos.x = this->actor.posRot.pos.x + Math_Rand_CenteredFloat(10.0f);
|
||||
pos.y = this->actor.posRot.pos.y + Math_Rand_CenteredFloat(10.0f);
|
||||
pos.z = this->actor.posRot.pos.z + Math_Rand_CenteredFloat(10.0f);
|
||||
pos.x = this->actor.posRot.pos.x + Rand_CenteredFloat(10.0f);
|
||||
pos.y = this->actor.posRot.pos.y + Rand_CenteredFloat(10.0f);
|
||||
pos.z = this->actor.posRot.pos.z + Rand_CenteredFloat(10.0f);
|
||||
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &D_80115518, &D_80115524, &D_80115510, &D_80115514);
|
||||
}
|
||||
|
||||
@@ -368,9 +368,9 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
this->actor.initPosRot.rot.z += (s16)((this->actor.velocity.y + 3.0f) * 1000.0f);
|
||||
this->actor.posRot.pos.x +=
|
||||
Math_Coss(this->actor.yawTowardsLink) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z));
|
||||
Math_CosS(this->actor.yawTowardsLink) * (-3.0f * Math_CosS(this->actor.initPosRot.rot.z));
|
||||
this->actor.posRot.pos.z +=
|
||||
Math_Sins(this->actor.yawTowardsLink) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z));
|
||||
Math_SinS(this->actor.yawTowardsLink) * (-3.0f * Math_CosS(this->actor.initPosRot.rot.z));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,9 +392,9 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (!(globalCtx->gameplayFrames & 1)) {
|
||||
pos.x = this->actor.posRot.pos.x + (Math_Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
pos.y = this->actor.posRot.pos.y + (Math_Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
pos.z = this->actor.posRot.pos.z + (Math_Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
pos.x = this->actor.posRot.pos.x + (Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
pos.y = this->actor.posRot.pos.y + (Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
pos.z = this->actor.posRot.pos.z + (Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &D_80115518, &D_80115524, &D_80115510, &D_80115514);
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) {
|
||||
this->actor.shape.rot.y = 0;
|
||||
}
|
||||
|
||||
this->actor.posRot.pos.y += 40.0f + Math_Sins(this->unk_15A * 15000) * (this->unk_15A * 0.3f);
|
||||
this->actor.posRot.pos.y += 40.0f + Math_SinS(this->unk_15A * 15000) * (this->unk_15A * 0.3f);
|
||||
|
||||
if (LINK_IS_ADULT) {
|
||||
this->actor.posRot.pos.y += 20.0f;
|
||||
@@ -463,7 +463,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->actor.scale.x, this->unk_15C, 0.1f, this->unk_15C * 0.1f, 0.0f);
|
||||
Math_SmoothStepToF(&this->actor.scale.x, this->unk_15C, 0.1f, this->unk_15C * 0.1f, 0.0f);
|
||||
this->actor.scale.z = this->actor.scale.x;
|
||||
this->actor.scale.y = this->actor.scale.x;
|
||||
|
||||
@@ -506,7 +506,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
if ((this->actor.params == ITEM00_SHIELD_DEKU) || (this->actor.params == ITEM00_SHIELD_HYLIAN) ||
|
||||
(this->actor.params == ITEM00_TUNIC_ZORA) || (this->actor.params == ITEM00_TUNIC_GORON)) {
|
||||
f32 newUnkBC = Math_Coss(this->actor.shape.rot.x) * 37.0f;
|
||||
f32 newUnkBC = Math_CosS(this->actor.shape.rot.x) * 37.0f;
|
||||
this->actor.shape.unk_08 = newUnkBC;
|
||||
if (newUnkBC >= 0.0f) {
|
||||
this->actor.shape.unk_08 = this->actor.shape.unk_08;
|
||||
@@ -892,7 +892,7 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa
|
||||
spawnedActor->actor.velocity.y = !param4000 ? 8.0f : -2.0f;
|
||||
spawnedActor->actor.speedXZ = 2.0f;
|
||||
spawnedActor->actor.gravity = -0.9f;
|
||||
spawnedActor->actor.posRot.rot.y = Math_Rand_CenteredFloat(65536.0f);
|
||||
spawnedActor->actor.posRot.rot.y = Rand_CenteredFloat(65536.0f);
|
||||
Actor_SetScale(&spawnedActor->actor, 0.0f);
|
||||
EnItem00_SetupAction(spawnedActor, func_8001E304);
|
||||
spawnedActor->unk_15A = 220;
|
||||
@@ -933,7 +933,7 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p
|
||||
spawnedActor->actor.velocity.y = 0.0f;
|
||||
spawnedActor->actor.speedXZ = 0.0f;
|
||||
spawnedActor->actor.gravity = param4000 ? 0.0f : -0.9f;
|
||||
spawnedActor->actor.posRot.rot.y = Math_Rand_CenteredFloat(65536.0f);
|
||||
spawnedActor->actor.posRot.rot.y = Rand_CenteredFloat(65536.0f);
|
||||
spawnedActor->actor.flags |= 0x0010;
|
||||
}
|
||||
}
|
||||
@@ -950,7 +950,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
|
||||
s16 dropTableIndex;
|
||||
u8 dropId;
|
||||
|
||||
dropTableIndex = Math_Rand_ZeroOne() * 16.0f;
|
||||
dropTableIndex = Rand_ZeroOne() * 16.0f;
|
||||
param8000 = params & 0x8000;
|
||||
params = params & 0x7FFF;
|
||||
|
||||
@@ -1045,7 +1045,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
|
||||
spawnedActor->actor.velocity.y = 8.0f;
|
||||
spawnedActor->actor.speedXZ = 2.0f;
|
||||
spawnedActor->actor.gravity = -0.9f;
|
||||
spawnedActor->actor.posRot.rot.y = Math_Rand_ZeroOne() * 40000.0f;
|
||||
spawnedActor->actor.posRot.rot.y = Rand_ZeroOne() * 40000.0f;
|
||||
Actor_SetScale(&spawnedActor->actor, 0.0f);
|
||||
EnItem00_SetupAction(spawnedActor, func_8001E304);
|
||||
spawnedActor->actor.flags |= 0x0010;
|
||||
|
||||
@@ -60,12 +60,12 @@ void TransitionFade_Update(TransitionFade* this, s32 updateRate) {
|
||||
newAlpha = this->fadeColor.a;
|
||||
if (iREG(50) != 0) {
|
||||
if (iREG(50) < 0) {
|
||||
if (Math_ApproxS(&newAlpha, 255, 255)) {
|
||||
if (Math_StepToS(&newAlpha, 255, 255)) {
|
||||
iREG(50) = 150;
|
||||
}
|
||||
} else {
|
||||
Math_ApproxS(&iREG(50), 20, 60);
|
||||
if (Math_ApproxS(&newAlpha, 0, iREG(50))) {
|
||||
Math_StepToS(&iREG(50), 20, 60);
|
||||
if (Math_StepToS(&newAlpha, 0, iREG(50))) {
|
||||
iREG(50) = 0;
|
||||
this->isDone = 1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80073A5C.s")
|
||||
|
||||
f32 func_800746DC() {
|
||||
return Math_Rand_ZeroOne() - 0.5f;
|
||||
return Rand_ZeroOne() - 0.5f;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80074704.s")
|
||||
|
||||
+166
-126
@@ -8,19 +8,21 @@ void Lib_MemSet(u8* dest, size_t size, u8 val) {
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
f32 Math_Coss(s16 angle) {
|
||||
return coss(angle) * (1.0f / 32767);
|
||||
f32 Math_CosS(s16 angle) {
|
||||
return coss(angle) * SHT_MINV;
|
||||
}
|
||||
|
||||
f32 Math_Sins(s16 angle) {
|
||||
return sins(angle) * (1.0f / 32767);
|
||||
f32 Math_SinS(s16 angle) {
|
||||
return sins(angle) * SHT_MINV;
|
||||
}
|
||||
|
||||
s32 Math_ApproxUpdateScaledS(s16* pValue, s16 target, s16 step) {
|
||||
f32 updateScale;
|
||||
|
||||
/**
|
||||
* Changes pValue by step (scaled by the update rate) towards target, setting it equal when the target is reached.
|
||||
* Returns true when target is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step) {
|
||||
if (step != 0) {
|
||||
updateScale = R_UPDATE_RATE * 0.5f;
|
||||
f32 updateScale = R_UPDATE_RATE * 0.5f;
|
||||
|
||||
if ((s16)(*pValue - target) > 0) {
|
||||
step = -step;
|
||||
@@ -30,16 +32,20 @@ s32 Math_ApproxUpdateScaledS(s16* pValue, s16 target, s16 step) {
|
||||
|
||||
if (((s16)(*pValue - target) * step) >= 0) {
|
||||
*pValue = target;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
} else if (target == *pValue) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Math_ApproxS(s16* pValue, s16 target, s16 step) {
|
||||
/**
|
||||
* Changes pValue by step towards target, setting it equal when the target is reached.
|
||||
* Returns true when target is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_StepToS(s16* pValue, s16 target, s16 step) {
|
||||
if (step != 0) {
|
||||
if (target < *pValue) {
|
||||
step = -step;
|
||||
@@ -49,16 +55,20 @@ s32 Math_ApproxS(s16* pValue, s16 target, s16 step) {
|
||||
|
||||
if (((*pValue - target) * step) >= 0) {
|
||||
*pValue = target;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
} else if (target == *pValue) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Math_ApproxF(f32* pValue, f32 target, f32 step) {
|
||||
/**
|
||||
* Changes pValue by step towards target, setting it equal when the target is reached.
|
||||
* Returns true when target is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_StepToF(f32* pValue, f32 target, f32 step) {
|
||||
if (step != 0.0f) {
|
||||
if (target < *pValue) {
|
||||
step = -step;
|
||||
@@ -68,84 +78,104 @@ s32 Math_ApproxF(f32* pValue, f32 target, f32 step) {
|
||||
|
||||
if (((*pValue - target) * step) >= 0) {
|
||||
*pValue = target;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
} else if (target == *pValue) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_80077A90(s16* pValue, s16 target, s16 step) {
|
||||
/**
|
||||
* Changes pValue by step. If pvalue reaches limit angle or its opposite, sets it equal to limit angle.
|
||||
* Returns true when limit angle or its opposite is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_StepUntilAngleS(s16* pValue, s16 limit, s16 step) {
|
||||
s16 orig = *pValue;
|
||||
|
||||
*pValue += step;
|
||||
|
||||
if (((s16)(*pValue - target) * (s16)(orig - target)) <= 0) {
|
||||
*pValue = target;
|
||||
return 1;
|
||||
if (((s16)(*pValue - limit) * (s16)(orig - limit)) <= 0) {
|
||||
*pValue = limit;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_80077AF8(s16* pValue, s16 target, s16 step) {
|
||||
/**
|
||||
* Changes pValue by step. If pvalue reaches limit, sets it equal to limit.
|
||||
* Returns true when limit is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_StepUntilS(s16* pValue, s16 limit, s16 step) {
|
||||
s16 orig = *pValue;
|
||||
|
||||
*pValue += step;
|
||||
|
||||
if (((*pValue - target) * ((s16)orig - target)) <= 0) {
|
||||
*pValue = target;
|
||||
return 1;
|
||||
if (((*pValue - limit) * (orig - limit)) <= 0) {
|
||||
*pValue = limit;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_80077B58(s16* pValue, s16 target, s16 step) {
|
||||
s32 phi_v0 = target - *pValue;
|
||||
/**
|
||||
* Changes pValue by step towards target angle, setting it equal when the target is reached.
|
||||
* Returns true when target is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step) {
|
||||
s32 diff = target - *pValue;
|
||||
|
||||
if (phi_v0 < 0) {
|
||||
if (diff < 0) {
|
||||
step = -step;
|
||||
}
|
||||
|
||||
if (phi_v0 >= 0x8000) {
|
||||
if (diff >= 0x8000) {
|
||||
step = -step;
|
||||
phi_v0 = 0xFFFF0001 - -phi_v0;
|
||||
} else if (phi_v0 <= -0x8000) {
|
||||
phi_v0 += 0xFFFF;
|
||||
diff = -0xFFFF - -diff;
|
||||
} else if (diff <= -0x8000) {
|
||||
diff += 0xFFFF;
|
||||
step = -step;
|
||||
}
|
||||
|
||||
if (step != 0) {
|
||||
*pValue += step;
|
||||
|
||||
if ((phi_v0 * step) <= 0) {
|
||||
if ((diff * step) <= 0) {
|
||||
*pValue = target;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
} else if (target == *pValue) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_80077C1C(f32* pValue, f32 target, f32 step) {
|
||||
/**
|
||||
* Changes pValue by step. If pvalue reaches limit, sets it equal to limit.
|
||||
* Returns true when limit is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step) {
|
||||
f32 orig = *pValue;
|
||||
|
||||
*pValue += step;
|
||||
|
||||
if (((*pValue - target) * (orig - target)) <= 0) {
|
||||
*pValue = target;
|
||||
return 1;
|
||||
if (((*pValue - limit) * (orig - limit)) <= 0) {
|
||||
*pValue = limit;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_80077C6C(f32* pValue, f32 target, f32 incrStep, f32 decrStep) {
|
||||
/**
|
||||
* Changes pValue toward target by incrStep if pValue is smaller and by decrStep if it is greater, setting it equal when
|
||||
* target is reached. Returns true when target is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_AymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep) {
|
||||
f32 step = (target >= *pValue) ? incrStep : decrStep;
|
||||
|
||||
if (step != 0.0f) {
|
||||
@@ -173,15 +203,15 @@ void func_80077D10(f32* arg0, s16* arg1, Input* input) {
|
||||
*arg0 = sqrtf(SQ(relX) + SQ(relY));
|
||||
*arg0 = (60.0f < *arg0) ? 60.0f : *arg0;
|
||||
|
||||
*arg1 = atan2s(relY, -relX);
|
||||
*arg1 = Math_Atan2S(relY, -relX);
|
||||
}
|
||||
|
||||
s16 Math_Rand_S16Offset(s16 base, s16 range) {
|
||||
return (s16)(Math_Rand_ZeroOne() * range) + base;
|
||||
s16 Rand_S16Offset(s16 base, s16 range) {
|
||||
return (s16)(Rand_ZeroOne() * range) + base;
|
||||
}
|
||||
|
||||
s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range) {
|
||||
return (s16)(Math_Rand_ZeroOne() * range) * stride + base;
|
||||
s16 Rand_S16OffsetStride(s16 base, s16 stride, s16 range) {
|
||||
return (s16)(Rand_ZeroOne() * range) * stride + base;
|
||||
}
|
||||
|
||||
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src) {
|
||||
@@ -251,11 +281,11 @@ s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b) {
|
||||
f32 dx = b->x - a->x;
|
||||
f32 dz = b->z - a->z;
|
||||
|
||||
return atan2s(dz, dx);
|
||||
return Math_Atan2S(dz, dx);
|
||||
}
|
||||
|
||||
s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b) {
|
||||
return atan2s(Math_Vec3f_DistXZ(a, b), a->y - b->y);
|
||||
return Math_Atan2S(Math_Vec3f_DistXZ(a, b), a->y - b->y);
|
||||
}
|
||||
|
||||
void IChain_Apply_u8(u8* ptr, InitChainEntry* ichain);
|
||||
@@ -351,32 +381,34 @@ void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain) {
|
||||
vec->x = val;
|
||||
}
|
||||
|
||||
f32 Math_SmoothScaleMaxMinF(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) {
|
||||
f32 var;
|
||||
|
||||
/**
|
||||
* Changes pValue by step towards target. If this step is more than fraction of the remaining distance, step by that
|
||||
* instead, with a minimum step of minStep. Returns remaining distance to target.
|
||||
*/
|
||||
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep) {
|
||||
if (*pValue != target) {
|
||||
var = (target - *pValue) * scale;
|
||||
f32 stepSize = (target - *pValue) * fraction;
|
||||
|
||||
if ((var >= minStep) || (var <= -minStep)) {
|
||||
if (var > maxStep) {
|
||||
var = maxStep;
|
||||
if ((stepSize >= minStep) || (stepSize <= -minStep)) {
|
||||
if (stepSize > step) {
|
||||
stepSize = step;
|
||||
}
|
||||
|
||||
if (var < -maxStep) {
|
||||
var = -maxStep;
|
||||
if (stepSize < -step) {
|
||||
stepSize = -step;
|
||||
}
|
||||
|
||||
*pValue += var;
|
||||
*pValue += stepSize;
|
||||
} else {
|
||||
if (var < minStep) {
|
||||
if (stepSize < minStep) {
|
||||
*pValue += minStep;
|
||||
var = minStep;
|
||||
stepSize = minStep;
|
||||
|
||||
if (target < *pValue) {
|
||||
*pValue = target;
|
||||
}
|
||||
}
|
||||
if (var > -minStep) {
|
||||
if (stepSize > -minStep) {
|
||||
*pValue += -minStep;
|
||||
|
||||
if (*pValue < target) {
|
||||
@@ -389,73 +421,76 @@ f32 Math_SmoothScaleMaxMinF(f32* pValue, f32 target, f32 scale, f32 maxStep, f32
|
||||
return fabsf(target - *pValue);
|
||||
}
|
||||
|
||||
void Math_SmoothScaleMaxF(f32* pValue, f32 target, f32 scale, f32 maxStep) {
|
||||
f32 step;
|
||||
|
||||
/**
|
||||
* Changes pValue by step towards target. If step is more than fraction of the remaining distance, step by that instead.
|
||||
*/
|
||||
void Math_ApproachF(f32* pValue, f32 target, f32 fraction, f32 step) {
|
||||
if (*pValue != target) {
|
||||
step = (target - *pValue) * scale;
|
||||
f32 stepSize = (target - *pValue) * fraction;
|
||||
|
||||
if (step > maxStep) {
|
||||
step = maxStep;
|
||||
} else if (step < -maxStep) {
|
||||
step = -maxStep;
|
||||
if (stepSize > step) {
|
||||
stepSize = step;
|
||||
} else if (stepSize < -step) {
|
||||
stepSize = -step;
|
||||
}
|
||||
|
||||
*pValue += step;
|
||||
*pValue += stepSize;
|
||||
}
|
||||
}
|
||||
|
||||
void Math_SmoothDownscaleMaxF(f32* pValue, f32 scale, f32 maxStep) {
|
||||
f32 step;
|
||||
/**
|
||||
* Changes pValue by step towards zero. If step is more than fraction of the remaining distance, step by that instead.
|
||||
*/
|
||||
void Math_ApproachZeroF(f32* pValue, f32 fraction, f32 step) {
|
||||
f32 stepSize = *pValue * fraction;
|
||||
|
||||
step = *pValue * scale;
|
||||
|
||||
if (step > maxStep) {
|
||||
step = maxStep;
|
||||
} else if (step < -maxStep) {
|
||||
step = -maxStep;
|
||||
if (stepSize > step) {
|
||||
stepSize = step;
|
||||
} else if (stepSize < -step) {
|
||||
stepSize = -step;
|
||||
}
|
||||
|
||||
*pValue -= step;
|
||||
*pValue -= stepSize;
|
||||
}
|
||||
|
||||
f32 func_800784D8(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) {
|
||||
f32 step;
|
||||
f32 baseStep;
|
||||
|
||||
step = 0.0f;
|
||||
baseStep = target - *pValue;
|
||||
/**
|
||||
* Changes pValue by step towards target angle in degrees. If this step is more than fraction of the remaining distance,
|
||||
* step by that instead, with a minimum step of minStep. Returns the value of the step taken.
|
||||
*/
|
||||
f32 Math_SmoothStepToDegF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep) {
|
||||
f32 stepSize = 0.0f;
|
||||
f32 diff = target - *pValue;
|
||||
|
||||
if (*pValue != target) {
|
||||
if (baseStep > 180.0f) {
|
||||
baseStep = -(360.0f - baseStep);
|
||||
} else if (baseStep < -180.0f) {
|
||||
baseStep = 360.0f + baseStep;
|
||||
if (diff > 180.0f) {
|
||||
diff = -(360.0f - diff);
|
||||
} else if (diff < -180.0f) {
|
||||
diff = 360.0f + diff;
|
||||
}
|
||||
|
||||
step = baseStep * scale;
|
||||
stepSize = diff * fraction;
|
||||
|
||||
if ((step >= minStep) || (step <= -minStep)) {
|
||||
if (step > maxStep) {
|
||||
step = maxStep;
|
||||
if ((stepSize >= minStep) || (stepSize <= -minStep)) {
|
||||
if (stepSize > step) {
|
||||
stepSize = step;
|
||||
}
|
||||
|
||||
if (step < -maxStep) {
|
||||
step = -maxStep;
|
||||
if (stepSize < -step) {
|
||||
stepSize = -step;
|
||||
}
|
||||
|
||||
*pValue += step;
|
||||
*pValue += stepSize;
|
||||
} else {
|
||||
if (step < minStep) {
|
||||
step = minStep;
|
||||
*pValue += step;
|
||||
if (stepSize < minStep) {
|
||||
stepSize = minStep;
|
||||
*pValue += stepSize;
|
||||
if (*pValue > target) {
|
||||
*pValue = target;
|
||||
}
|
||||
}
|
||||
if (step > -minStep) {
|
||||
step = -minStep;
|
||||
*pValue += step;
|
||||
if (stepSize > -minStep) {
|
||||
stepSize = -minStep;
|
||||
*pValue += stepSize;
|
||||
if (*pValue < target) {
|
||||
*pValue = target;
|
||||
}
|
||||
@@ -471,28 +506,30 @@ f32 func_800784D8(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep)
|
||||
*pValue += 360.0f;
|
||||
}
|
||||
|
||||
return step;
|
||||
return stepSize;
|
||||
}
|
||||
|
||||
s16 Math_SmoothScaleMaxMinS(s16* pValue, s16 target, s16 invScale, s16 maxStep, s16 minStep) {
|
||||
s16 step = 0;
|
||||
s16 diff = (target - *pValue);
|
||||
|
||||
s32 baseStep = diff / invScale;
|
||||
/**
|
||||
* Changes pValue by step towards target. If this step is more than 1/scale of the remaining distance, step by that
|
||||
* instead, with a minimum step of minStep. Returns remaining distance to target.
|
||||
*/
|
||||
s16 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep) {
|
||||
s16 stepSize = 0;
|
||||
s16 diff = target - *pValue;
|
||||
|
||||
if (*pValue != target) {
|
||||
step = baseStep;
|
||||
stepSize = diff / scale;
|
||||
|
||||
if ((step > minStep) || (step < -minStep)) {
|
||||
if (step > maxStep) {
|
||||
step = maxStep;
|
||||
if ((stepSize > minStep) || (stepSize < -minStep)) {
|
||||
if (stepSize > step) {
|
||||
stepSize = step;
|
||||
}
|
||||
|
||||
if (step < -maxStep) {
|
||||
step = -maxStep;
|
||||
if (stepSize < -step) {
|
||||
stepSize = -step;
|
||||
}
|
||||
|
||||
*pValue += step;
|
||||
*pValue += stepSize;
|
||||
} else {
|
||||
if (diff >= 0) {
|
||||
*pValue += minStep;
|
||||
@@ -513,17 +550,20 @@ s16 Math_SmoothScaleMaxMinS(s16* pValue, s16 target, s16 invScale, s16 maxStep,
|
||||
return diff;
|
||||
}
|
||||
|
||||
void Math_SmoothScaleMaxS(s16* pValue, s16 target, s16 invScale, s16 maxStep) {
|
||||
s16 step = target - *pValue;
|
||||
/**
|
||||
* Changes pValue by step towards target. If step is more than 1/scale of the remaining distance, step by that instead.
|
||||
*/
|
||||
void Math_ApproachS(s16* pValue, s16 target, s16 scale, s16 maxStep) {
|
||||
s16 diff = target - *pValue;
|
||||
|
||||
step /= invScale;
|
||||
diff /= scale;
|
||||
|
||||
if (step > maxStep) {
|
||||
if (diff > maxStep) {
|
||||
*pValue += maxStep;
|
||||
} else if (step < -maxStep) {
|
||||
} else if (diff < -maxStep) {
|
||||
*pValue -= maxStep;
|
||||
} else {
|
||||
*pValue += step;
|
||||
*pValue += diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -80,10 +80,10 @@ Vec3f* OLib_VecSphToVec3f(Vec3f* dest, VecSph* sph) {
|
||||
f32 sinYaw;
|
||||
f32 cosYaw;
|
||||
|
||||
cosPitch = Math_Coss(sph->pitch);
|
||||
cosYaw = Math_Coss(sph->yaw);
|
||||
sinPitch = Math_Sins(sph->pitch);
|
||||
sinYaw = Math_Sins(sph->yaw);
|
||||
cosPitch = Math_CosS(sph->pitch);
|
||||
cosYaw = Math_CosS(sph->yaw);
|
||||
sinPitch = Math_SinS(sph->pitch);
|
||||
sinYaw = Math_SinS(sph->yaw);
|
||||
|
||||
v.x = sph->r * sinPitch * sinYaw;
|
||||
v.y = sph->r * cosPitch;
|
||||
@@ -122,14 +122,14 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) {
|
||||
if ((dist == 0.0f) && (vec->y == 0.0f)) {
|
||||
sph.pitch = 0;
|
||||
} else {
|
||||
sph.pitch = DEGF_TO_BINANG(RADF_TO_DEGF(Math_atan2f(dist, vec->y)));
|
||||
sph.pitch = DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(dist, vec->y)));
|
||||
}
|
||||
|
||||
sph.r = sqrtf(SQ(vec->y) + distSquared);
|
||||
if ((vec->x == 0.0f) && (vec->z == 0.0f)) {
|
||||
sph.yaw = 0;
|
||||
} else {
|
||||
sph.yaw = DEGF_TO_BINANG(RADF_TO_DEGF(Math_atan2f(vec->x, vec->z)));
|
||||
sph.yaw = DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(vec->x, vec->z)));
|
||||
}
|
||||
|
||||
*dest = sph;
|
||||
@@ -183,8 +183,8 @@ VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* dest, Vec3f* a, Vec3f* b) {
|
||||
Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b) {
|
||||
Vec3f anglesRad;
|
||||
|
||||
anglesRad.x = Math_atan2f(b->z - a->z, b->y - a->y);
|
||||
anglesRad.y = Math_atan2f(b->x - a->x, b->z - a->z);
|
||||
anglesRad.x = Math_FAtan2F(b->z - a->z, b->y - a->y);
|
||||
anglesRad.y = Math_FAtan2F(b->x - a->x, b->z - a->z);
|
||||
anglesRad.z = 0;
|
||||
|
||||
*dest = anglesRad;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw) {
|
||||
dx = pointPos->x - actor->posRot.pos.x;
|
||||
dz = pointPos->z - actor->posRot.pos.z;
|
||||
|
||||
*yaw = Math_atan2f(dx, dz) * (32768 / M_PI);
|
||||
*yaw = Math_FAtan2F(dx, dz) * (32768 / M_PI);
|
||||
|
||||
return SQ(dx) + SQ(dz);
|
||||
}
|
||||
|
||||
+1
-1
@@ -339,7 +339,7 @@ void Gameplay_Init(GameState* thisx) {
|
||||
gTrnsnUnkState = 0;
|
||||
globalCtx->transitionMode = 0;
|
||||
func_8008E6A0(&globalCtx->sub_7B8);
|
||||
Math_Rand_Seed((u32)osGetTime());
|
||||
Rand_Seed((u32)osGetTime());
|
||||
Matrix_Init(&globalCtx->state);
|
||||
globalCtx->state.main = Gameplay_Main;
|
||||
globalCtx->state.destroy = Gameplay_Destroy;
|
||||
|
||||
@@ -754,7 +754,7 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
|
||||
sp58 = sp7C - SQ(sp60);
|
||||
sp58 = (sp7C < SQ(sp60)) ? 0.0f : sqrtf(sp58);
|
||||
|
||||
sp54 = Math_atan2f(sp58, sp60);
|
||||
sp54 = Math_FAtan2F(sp58, sp60);
|
||||
|
||||
sp6C = sp80 - spA4.y;
|
||||
|
||||
@@ -765,9 +765,9 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime,
|
||||
sp58 = sp7C - SQ(sp60);
|
||||
sp58 = (sp7C < SQ(sp60)) ? 0.0f : sqrtf(sp58);
|
||||
|
||||
sp50 = Math_atan2f(sp58, sp60);
|
||||
sp50 = Math_FAtan2F(sp58, sp60);
|
||||
|
||||
temp1 = (M_PI - (Math_atan2f(sp5C, sp58) + ((M_PI / 2) - sp50))) * 10430.378f;
|
||||
temp1 = (M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50))) * 10430.378f;
|
||||
temp1 = temp1 - skelAnime->limbDrawTbl[shinLimbIndex].z;
|
||||
|
||||
if ((s16)(ABS(skelAnime->limbDrawTbl[shinLimbIndex].x) + ABS(skelAnime->limbDrawTbl[shinLimbIndex].y)) <
|
||||
@@ -814,7 +814,7 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
||||
pos->y -= this->unk_6C4;
|
||||
|
||||
if (this->unk_6C2 != 0) {
|
||||
Matrix_Translate(pos->x, ((Math_Coss(this->unk_6C2) - 1.0f) * 200.0f) + pos->y, pos->z, MTXMODE_APPLY);
|
||||
Matrix_Translate(pos->x, ((Math_CosS(this->unk_6C2) - 1.0f) * 200.0f) + pos->y, pos->z, MTXMODE_APPLY);
|
||||
Matrix_RotateX(this->unk_6C2 * (M_PI / 32768), MTXMODE_APPLY);
|
||||
Matrix_RotateRPY(rot->x, rot->y, rot->z, MTXMODE_APPLY);
|
||||
pos->x = pos->y = pos->z = 0.0f;
|
||||
@@ -1034,8 +1034,8 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, this->giObjectSegment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, this->giObjectSegment);
|
||||
|
||||
Matrix_Translate(refPos->x + (3.3f * Math_Sins(this->actor.shape.rot.y)), refPos->y + height,
|
||||
refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_Coss(this->actor.shape.rot.y)), MTXMODE_NEW);
|
||||
Matrix_Translate(refPos->x + (3.3f * Math_SinS(this->actor.shape.rot.y)), refPos->y + height,
|
||||
refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_CosS(this->actor.shape.rot.y)), MTXMODE_NEW);
|
||||
Matrix_RotateRPY(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY);
|
||||
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
|
||||
|
||||
|
||||
+11
-11
@@ -64,8 +64,8 @@ void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x) {
|
||||
s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
|
||||
s32 pad;
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Math_Sins(req->speed * req->countdown);
|
||||
Quake_UpdateShakeInfo(req, shake, a, Math_Rand_ZeroOne() * a);
|
||||
f32 a = Math_SinS(req->speed * req->countdown);
|
||||
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
||||
req->countdown--;
|
||||
}
|
||||
return req->countdown;
|
||||
@@ -73,7 +73,7 @@ s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
|
||||
|
||||
s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Math_Sins(req->speed * req->countdown);
|
||||
f32 a = Math_SinS(req->speed * req->countdown);
|
||||
Quake_UpdateShakeInfo(req, shake, a, a);
|
||||
req->countdown--;
|
||||
}
|
||||
@@ -85,14 +85,14 @@ s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
|
||||
f32 a;
|
||||
|
||||
req->countdown--;
|
||||
a = Math_Sins(req->speed * ((req->countdown & 0xF) + 500));
|
||||
Quake_UpdateShakeInfo(req, shake, a, Math_Rand_ZeroOne() * a);
|
||||
a = Math_SinS(req->speed * ((req->countdown & 0xF) + 500));
|
||||
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
||||
return 1;
|
||||
}
|
||||
|
||||
s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Math_Sins(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax);
|
||||
f32 a = Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax);
|
||||
Quake_UpdateShakeInfo(req, shake, a, a);
|
||||
req->countdown--;
|
||||
}
|
||||
@@ -101,8 +101,8 @@ s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
|
||||
|
||||
s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Math_Rand_ZeroOne();
|
||||
Quake_UpdateShakeInfo(req, shake, a, Math_Rand_ZeroOne() * a);
|
||||
f32 a = Rand_ZeroOne();
|
||||
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
||||
req->countdown--;
|
||||
}
|
||||
return req->countdown;
|
||||
@@ -110,8 +110,8 @@ s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
|
||||
|
||||
s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Math_Rand_ZeroOne() * ((f32)req->countdown / (f32)req->countdownMax);
|
||||
Quake_UpdateShakeInfo(req, shake, a, Math_Rand_ZeroOne() * a);
|
||||
f32 a = Rand_ZeroOne() * ((f32)req->countdown / (f32)req->countdownMax);
|
||||
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
||||
req->countdown--;
|
||||
}
|
||||
return req->countdown;
|
||||
@@ -151,7 +151,7 @@ QuakeRequest* Quake_AddImpl(Camera* cam, u32 callbackIdx) {
|
||||
req->camPtrIdx = cam->thisIdx;
|
||||
req->callbackIdx = callbackIdx;
|
||||
req->unk_1C = 1;
|
||||
req->randIdx = ((s16)(Math_Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
|
||||
req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
|
||||
sQuakeRequestCount++;
|
||||
|
||||
return req;
|
||||
|
||||
+3
-3
@@ -384,11 +384,11 @@ void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
}
|
||||
|
||||
dayTime = gSaveContext.dayTime;
|
||||
globalCtx->envCtx.unk_04.x = -(Math_Sins(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
globalCtx->envCtx.unk_04.x = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
dayTime = gSaveContext.dayTime;
|
||||
globalCtx->envCtx.unk_04.y = (Math_Coss(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
globalCtx->envCtx.unk_04.y = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
dayTime = gSaveContext.dayTime;
|
||||
globalCtx->envCtx.unk_04.z = (Math_Coss(dayTime - 0x8000) * 20.0f) * 25.0f;
|
||||
globalCtx->envCtx.unk_04.z = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f;
|
||||
|
||||
if (((globalCtx->envCtx.unk_02 == 0) && (gSaveContext.cutsceneIndex < 0xFFF0)) ||
|
||||
(gSaveContext.entranceIndex == 0x0604)) {
|
||||
|
||||
+12
-12
@@ -1449,11 +1449,11 @@ void func_8009BEEC(GlobalContext* globalCtx) {
|
||||
Quake_SetCountdown(var, 127);
|
||||
}
|
||||
|
||||
if ((globalCtx->gameplayFrames % 64 == 0) && (Math_Rand_ZeroOne() > 0.6f)) {
|
||||
if ((globalCtx->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) {
|
||||
var = Quake_Add(ACTIVE_CAM, 3);
|
||||
Quake_SetSpeed(var, 32000.0f + (Math_Rand_ZeroOne() * 3000.0f));
|
||||
Quake_SetQuakeValues(var, 10.0f - (Math_Rand_ZeroOne() * 9.0f), 0, 0, 0);
|
||||
Quake_SetCountdown(var, 48.0f - (Math_Rand_ZeroOne() * 15.0f));
|
||||
Quake_SetSpeed(var, 32000.0f + (Rand_ZeroOne() * 3000.0f));
|
||||
Quake_SetQuakeValues(var, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0);
|
||||
Quake_SetCountdown(var, 48.0f - (Rand_ZeroOne() * 15.0f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1836,11 +1836,11 @@ void func_8009DA30(GlobalContext* globalCtx) {
|
||||
} else {
|
||||
if (gSaveContext.dayTime > 0xC555) {
|
||||
if (globalCtx->unk_11D30[0] != 255) {
|
||||
Math_ApproxS(&globalCtx->unk_11D30[0], 255, 5);
|
||||
Math_StepToS(&globalCtx->unk_11D30[0], 255, 5);
|
||||
}
|
||||
} else if (gSaveContext.dayTime >= 0x4000) {
|
||||
if (globalCtx->unk_11D30[0] != 0) {
|
||||
Math_ApproxS(&globalCtx->unk_11D30[0], 0, 10);
|
||||
Math_StepToS(&globalCtx->unk_11D30[0], 0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2189,11 +2189,11 @@ void func_8009F5D4(GlobalContext* globalCtx) {
|
||||
} else {
|
||||
if (gSaveContext.dayTime > 0xC000) {
|
||||
if (globalCtx->unk_11D30[0] != 255) {
|
||||
Math_ApproxS(&globalCtx->unk_11D30[0], 255, 5);
|
||||
Math_StepToS(&globalCtx->unk_11D30[0], 255, 5);
|
||||
}
|
||||
} else if (gSaveContext.dayTime >= 0x4000) {
|
||||
if (globalCtx->unk_11D30[0] != 0) {
|
||||
Math_ApproxS(&globalCtx->unk_11D30[0], 0, 10);
|
||||
Math_StepToS(&globalCtx->unk_11D30[0], 0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2343,10 +2343,10 @@ void func_8009FE58(GlobalContext* globalCtx) {
|
||||
D_8012A3A0 += 1820;
|
||||
|
||||
temp = 0.020000001f;
|
||||
func_800AA76C(&globalCtx->view, 0.00009587531f * temp * Math_Coss(D_8012A39C),
|
||||
0.00009587531f * temp * Math_Sins(D_8012A39C), 0.00009587531f * temp * Math_Sins(D_8012A3A0));
|
||||
func_800AA78C(&globalCtx->view, 1.f + (0.79999995f * temp * Math_Sins(D_8012A3A0)),
|
||||
1.f + (0.39999998f * temp * Math_Coss(D_8012A3A0)), 1.f + (1 * temp * Math_Coss(D_8012A39C)));
|
||||
func_800AA76C(&globalCtx->view, 0.00009587531f * temp * Math_CosS(D_8012A39C),
|
||||
0.00009587531f * temp * Math_SinS(D_8012A39C), 0.00009587531f * temp * Math_SinS(D_8012A3A0));
|
||||
func_800AA78C(&globalCtx->view, 1.f + (0.79999995f * temp * Math_SinS(D_8012A3A0)),
|
||||
1.f + (0.39999998f * temp * Math_CosS(D_8012A3A0)), 1.f + (1 * temp * Math_CosS(D_8012A39C)));
|
||||
func_800AA7AC(&globalCtx->view, 0.95f);
|
||||
|
||||
switch (globalCtx->unk_11D30[0]) {
|
||||
|
||||
@@ -1397,11 +1397,11 @@ s32 func_800A4AD8(SkelAnime* skelAnime) {
|
||||
}
|
||||
temp_a1 = skelAnime->transCurrentFrame * 0x4000;
|
||||
if (skelAnime->unk_03 < 0) {
|
||||
sp28 = 1.0f - Math_Coss(temp_a2);
|
||||
phi_f2 = 1.0f - Math_Coss(temp_a1);
|
||||
sp28 = 1.0f - Math_CosS(temp_a2);
|
||||
phi_f2 = 1.0f - Math_CosS(temp_a1);
|
||||
} else {
|
||||
sp28 = Math_Sins(temp_a2);
|
||||
phi_f2 = Math_Sins(temp_a1);
|
||||
sp28 = Math_SinS(temp_a2);
|
||||
phi_f2 = Math_SinS(temp_a1);
|
||||
}
|
||||
if (phi_f2 != 0.0f) {
|
||||
phi_f2 /= sp28;
|
||||
@@ -1614,15 +1614,15 @@ void func_800A54FC(SkelAnime* skelAnime, Vec3f* pos, s16 angle) {
|
||||
// `angle` rotation around y axis.
|
||||
x = skelAnime->limbDrawTbl[0].x;
|
||||
z = skelAnime->limbDrawTbl[0].z;
|
||||
sin = Math_Sins(angle);
|
||||
cos = Math_Coss(angle);
|
||||
sin = Math_SinS(angle);
|
||||
cos = Math_CosS(angle);
|
||||
pos->x = x * cos + z * sin;
|
||||
pos->z = z * cos - x * sin;
|
||||
x = skelAnime->prevFramePos.x;
|
||||
z = skelAnime->prevFramePos.z;
|
||||
// `prevFrameRot` rotation around y axis.
|
||||
sin = Math_Sins(skelAnime->prevFrameRot);
|
||||
cos = Math_Coss(skelAnime->prevFrameRot);
|
||||
sin = Math_SinS(skelAnime->prevFrameRot);
|
||||
cos = Math_CosS(skelAnime->prevFrameRot);
|
||||
pos->x -= x * cos + z * sin;
|
||||
pos->z -= z * cos - x * sin;
|
||||
}
|
||||
|
||||
+14
-14
@@ -330,8 +330,8 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) {
|
||||
f32 yy;
|
||||
f32 zy;
|
||||
|
||||
sin = Math_Sins(yaw);
|
||||
cos = Math_Coss(yaw);
|
||||
sin = Math_SinS(yaw);
|
||||
cos = Math_CosS(yaw);
|
||||
mf->yy = cos;
|
||||
mf->yx = -sin;
|
||||
mf->xw = mf->yw = mf->zw = 0;
|
||||
@@ -339,8 +339,8 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) {
|
||||
mf->ww = 1;
|
||||
|
||||
if (pitch != 0) {
|
||||
sin2 = Math_Sins(pitch);
|
||||
cos2 = Math_Coss(pitch);
|
||||
sin2 = Math_SinS(pitch);
|
||||
cos2 = Math_CosS(pitch);
|
||||
|
||||
mf->xx = cos * cos2;
|
||||
mf->zx = cos * sin2;
|
||||
@@ -361,8 +361,8 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) {
|
||||
}
|
||||
|
||||
if (roll != 0) {
|
||||
sin2 = Math_Sins(roll);
|
||||
cos2 = Math_Coss(roll);
|
||||
sin2 = Math_SinS(roll);
|
||||
cos2 = Math_CosS(roll);
|
||||
|
||||
yx = mf->yx;
|
||||
zx = mf->zx;
|
||||
@@ -395,8 +395,8 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) {
|
||||
f32 yz;
|
||||
f32 xx;
|
||||
f32 yx;
|
||||
sin = Math_Sins(roll);
|
||||
cos = Math_Coss(roll);
|
||||
sin = Math_SinS(roll);
|
||||
cos = Math_CosS(roll);
|
||||
mf->xx = cos;
|
||||
mf->xz = -sin;
|
||||
mf->zw = 0;
|
||||
@@ -408,8 +408,8 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) {
|
||||
mf->ww = 1;
|
||||
|
||||
if (yaw != 0) {
|
||||
sin2 = Math_Sins(yaw);
|
||||
cos2 = Math_Coss(yaw);
|
||||
sin2 = Math_SinS(yaw);
|
||||
cos2 = Math_CosS(yaw);
|
||||
|
||||
mf->zz = cos * cos2;
|
||||
mf->yz = cos * sin2;
|
||||
@@ -430,8 +430,8 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) {
|
||||
}
|
||||
|
||||
if (pitch != 0) {
|
||||
sin2 = Math_Sins(pitch);
|
||||
cos2 = Math_Coss(pitch);
|
||||
sin2 = Math_SinS(pitch);
|
||||
cos2 = Math_CosS(pitch);
|
||||
xx = mf->xx;
|
||||
yx = mf->yx;
|
||||
mf->xx = (xx * cos2) + (yx * sin2);
|
||||
@@ -620,8 +620,8 @@ void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z) {
|
||||
f32 xz;
|
||||
f32 pad;
|
||||
|
||||
sinA = Math_Sins(a);
|
||||
cosA = Math_Coss(a);
|
||||
sinA = Math_SinS(a);
|
||||
cosA = Math_CosS(a);
|
||||
|
||||
xx = x * x;
|
||||
yy = y * y;
|
||||
|
||||
@@ -236,7 +236,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->actor.velocity);
|
||||
player->actor.posRot.rot.x =
|
||||
atan2s(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y);
|
||||
Math_Atan2S(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y);
|
||||
}
|
||||
|
||||
if (phi_f16 < 50.0f) {
|
||||
@@ -254,7 +254,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
|
||||
Actor_MoveForward(&this->actor);
|
||||
Math_Vec3f_Diff(&this->actor.posRot.pos, &this->actor.pos4, &prevFrameDiff);
|
||||
Math_Vec3f_Sum(&this->unk_1E8, &prevFrameDiff, &this->unk_1E8);
|
||||
this->actor.shape.rot.x = atan2s(this->actor.speedXZ, -this->actor.velocity.y);
|
||||
this->actor.shape.rot.x = Math_Atan2S(this->actor.speedXZ, -this->actor.velocity.y);
|
||||
sp60.x = this->unk_1F4.x - (this->unk_1E8.x - this->unk_1F4.x);
|
||||
sp60.y = this->unk_1F4.y - (this->unk_1E8.y - this->unk_1F4.y);
|
||||
sp60.z = this->unk_1F4.z - (this->unk_1E8.z - this->unk_1F4.z);
|
||||
@@ -332,8 +332,8 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Math_Vec3f_Diff(&player->unk_3C8, &this->actor.posRot.pos, &sp78);
|
||||
sp58 = SQ(sp78.x) + SQ(sp78.z);
|
||||
sp5C = sqrtf(sp58);
|
||||
Matrix_RotateY(Math_atan2f(sp78.x, sp78.z), MTXMODE_APPLY);
|
||||
Matrix_RotateX(Math_atan2f(-sp78.y, sp5C), MTXMODE_APPLY);
|
||||
Matrix_RotateY(Math_FAtan2F(sp78.x, sp78.z), MTXMODE_APPLY);
|
||||
Matrix_RotateX(Math_FAtan2F(-sp78.y, sp5C), MTXMODE_APPLY);
|
||||
Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 910),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
@@ -195,7 +195,7 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
if (Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 500.0f, 0.5f, 7.5f,
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 500.0f, 0.5f, 7.5f,
|
||||
1.0f) < 0.1f) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
|
||||
this->actionFunc = func_8086C29C;
|
||||
@@ -242,7 +242,7 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
|
||||
this->dyna.actor.velocity.y += 0.5f;
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + -70.0f,
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + -70.0f,
|
||||
this->dyna.actor.velocity.y)) {
|
||||
this->dyna.actor.posRot.rot.y = 0;
|
||||
this->unk_16A = 0x3C;
|
||||
@@ -311,9 +311,9 @@ void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_8086C6EC(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
s32 cond = Math_ApproxUpdateScaledS(&this->dyna.actor.shape.rot.y, this->dyna.actor.initPosRot.rot.y, 0x200);
|
||||
s32 cond = Math_ScaledStepToS(&this->dyna.actor.shape.rot.y, this->dyna.actor.initPosRot.rot.y, 0x200);
|
||||
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + -125.0f, 3.0f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + -125.0f, 3.0f)) {
|
||||
if (cond) {
|
||||
this->actionFunc = func_8086C76C;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
if (Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 965.0f, 0.5f, 15.0f,
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 965.0f, 0.5f, 15.0f,
|
||||
0.2f) < 0.01f) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
|
||||
this->actionFunc = BgBdanObjects_DoNothing;
|
||||
@@ -383,13 +383,13 @@ void func_8086C9A8(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
|
||||
void func_8086C9F0(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
if (this->unk_16A == 0) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 0.5f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 0.5f)) {
|
||||
Flags_UnsetSwitch(globalCtx, this->unk_168);
|
||||
this->actionFunc = func_8086C9A8;
|
||||
}
|
||||
func_8002F948(this, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
|
||||
} else {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 75.0f, 0.5f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 75.0f, 0.5f)) {
|
||||
this->actionFunc = func_8086CABC;
|
||||
}
|
||||
func_8002F948(this, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
|
||||
|
||||
@@ -112,14 +112,14 @@ void func_8086D0EC(BgBdanSwitch* this) {
|
||||
case BLUE:
|
||||
case YELLOW_HEAVY:
|
||||
case YELLOW:
|
||||
this->unk_1D4 = ((Math_Coss(this->unk_1CC) * 0.5f) + 8.833334f) * 0.012f;
|
||||
this->unk_1D0 = ((Math_Coss(this->unk_1CC) * 0.5f) + 20.5f) * (this->unk_1C8 * 0.0050000004f);
|
||||
this->unk_1D4 = ((Math_CosS(this->unk_1CC) * 0.5f) + 8.833334f) * 0.012f;
|
||||
this->unk_1D0 = ((Math_CosS(this->unk_1CC) * 0.5f) + 20.5f) * (this->unk_1C8 * 0.0050000004f);
|
||||
this->dyna.actor.scale.y = this->unk_1C8 * 0.1f;
|
||||
break;
|
||||
case YELLOW_TALL_1:
|
||||
case YELLOW_TALL_2:
|
||||
this->unk_1D4 = ((Math_Coss(this->unk_1CC) * 0.5f) + (43.0f / 6.0f)) * 0.0075000003f;
|
||||
this->unk_1D0 = ((Math_Coss(this->unk_1CC) * 0.5f) + 20.5f) * (this->unk_1C8 * 0.0050000004f);
|
||||
this->unk_1D4 = ((Math_CosS(this->unk_1CC) * 0.5f) + (43.0f / 6.0f)) * 0.0075000003f;
|
||||
this->unk_1D0 = ((Math_CosS(this->unk_1CC) * 0.5f) + 20.5f) * (this->unk_1C8 * 0.0050000004f);
|
||||
this->dyna.actor.scale.y = this->unk_1C8 * 0.1f;
|
||||
}
|
||||
this->dyna.actor.shape.unk_08 = 1.2f / this->unk_1D0;
|
||||
|
||||
@@ -87,7 +87,7 @@ void BgBowlWall_SpawnBullseyes(BgBowlWall* this, GlobalContext* globalCtx) {
|
||||
|
||||
type = this->dyna.actor.params;
|
||||
if (type != 0) {
|
||||
type += (s16)Math_Rand_ZeroFloat(2.99f);
|
||||
type += (s16)Rand_ZeroFloat(2.99f);
|
||||
this->dyna.actor.shape.rot.z = this->dyna.actor.posRot.rot.z = sTargetRot[type];
|
||||
osSyncPrintf("\n\n");
|
||||
}
|
||||
@@ -136,13 +136,13 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) {
|
||||
wallFallen = false;
|
||||
|
||||
if (this->dyna.actor.params == 0) { // wall collapses backwards
|
||||
Math_SmoothScaleMaxMinS(&this->dyna.actor.shape.rot.x, -0x3E80, 3, 500, 0);
|
||||
Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 3, 500, 0);
|
||||
this->dyna.actor.posRot.rot.x = this->dyna.actor.shape.rot.x;
|
||||
if (this->dyna.actor.shape.rot.x < -0x3C1E) {
|
||||
wallFallen = true;
|
||||
}
|
||||
} else { // wall slides downwards
|
||||
Math_SmoothScaleMaxF(&this->dyna.actor.posRot.pos.y, this->initPos.y - 450.0f, 0.3f, 10.0f);
|
||||
Math_ApproachF(&this->dyna.actor.posRot.pos.y, this->initPos.y - 450.0f, 0.3f, 10.0f);
|
||||
if (this->dyna.actor.posRot.pos.y < (this->initPos.y - 400.0f)) {
|
||||
wallFallen = true;
|
||||
}
|
||||
@@ -150,9 +150,9 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (wallFallen) {
|
||||
for (i = 0; i < 15; i++) {
|
||||
effectPos.x = Math_Rand_CenteredFloat(300.0f) + this->bullseyeCenter.x;
|
||||
effectPos.x = Rand_CenteredFloat(300.0f) + this->bullseyeCenter.x;
|
||||
effectPos.y = -100.0f;
|
||||
effectPos.z = Math_Rand_CenteredFloat(400.0f) + this->bullseyeCenter.z;
|
||||
effectPos.z = Rand_CenteredFloat(400.0f) + this->bullseyeCenter.z;
|
||||
EffectSsBomb2_SpawnLayered(globalCtx, &effectPos, &effectVelocity, &effectAccel, 100, 30);
|
||||
effectPos.y = -50.0f;
|
||||
EffectSsHahen_SpawnBurst(globalCtx, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL);
|
||||
@@ -170,9 +170,9 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) {
|
||||
void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx) {
|
||||
if (this->timer >= 2) {
|
||||
if (this->dyna.actor.params == 0) {
|
||||
Math_SmoothScaleMaxMinS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 200, 0);
|
||||
Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 200, 0);
|
||||
} else {
|
||||
Math_SmoothScaleMaxF(&this->dyna.actor.posRot.pos.y, this->initPos.y - 450.0f, 0.3f, 10.0f);
|
||||
Math_ApproachF(&this->dyna.actor.posRot.pos.y, this->initPos.y - 450.0f, 0.3f, 10.0f);
|
||||
}
|
||||
} else if (this->timer == 1) {
|
||||
this->dyna.actor.posRot.rot.x = this->dyna.actor.shape.rot.x = 0;
|
||||
@@ -184,7 +184,7 @@ void BgBowlWall_FinishFall(BgBowlWall* this, GlobalContext* globalCtx) {
|
||||
|
||||
void BgBowlWall_Reset(BgBowlWall* this, GlobalContext* globalCtx) {
|
||||
if (this->chuGirl->wallStatus[this->dyna.actor.params] != 2) {
|
||||
Math_SmoothScaleMaxF(&this->dyna.actor.posRot.pos.y, this->initPos.y, 0.3f, 50.0f);
|
||||
Math_ApproachF(&this->dyna.actor.posRot.pos.y, this->initPos.y, 0.3f, 50.0f);
|
||||
if (fabsf(this->dyna.actor.posRot.pos.y - this->initPos.y) <= 10.0f) {
|
||||
this->dyna.actor.posRot.pos.y = this->initPos.y;
|
||||
this->isHit = false;
|
||||
|
||||
@@ -136,16 +136,16 @@ void BgDdanJd_MoveEffects(BgDdanJd* this, GlobalContext* globalCtx) {
|
||||
dustPos.y = this->dyna.actor.initPosRot.pos.y;
|
||||
if (globalCtx->gameplayFrames & 1) {
|
||||
dustPos.x = this->dyna.actor.posRot.pos.x + 65.0f;
|
||||
dustPos.z = Math_Rand_CenteredFloat(110.0f) + this->dyna.actor.posRot.pos.z;
|
||||
dustPos.z = Rand_CenteredFloat(110.0f) + this->dyna.actor.posRot.pos.z;
|
||||
func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1);
|
||||
dustPos.x = this->dyna.actor.posRot.pos.x - 65.0f;
|
||||
dustPos.z = Math_Rand_CenteredFloat(110.0f) + this->dyna.actor.posRot.pos.z;
|
||||
dustPos.z = Rand_CenteredFloat(110.0f) + this->dyna.actor.posRot.pos.z;
|
||||
func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1);
|
||||
} else {
|
||||
dustPos.x = Math_Rand_CenteredFloat(110.0f) + this->dyna.actor.posRot.pos.x;
|
||||
dustPos.x = Rand_CenteredFloat(110.0f) + this->dyna.actor.posRot.pos.x;
|
||||
dustPos.z = this->dyna.actor.posRot.pos.z + 65.0f;
|
||||
func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1);
|
||||
dustPos.x = Math_Rand_CenteredFloat(110.0f) + this->dyna.actor.posRot.pos.x;
|
||||
dustPos.x = Rand_CenteredFloat(110.0f) + this->dyna.actor.posRot.pos.x;
|
||||
dustPos.z = this->dyna.actor.posRot.pos.z - 65.0f;
|
||||
func_80033480(globalCtx, &dustPos, 5.0f, 1, 20, 60, 1);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx) {
|
||||
this->idleTimer = 0;
|
||||
this->actionFunc = BgDdanJd_Idle;
|
||||
func_800800F8(globalCtx, 0xBF4, -0x63, &this->dyna.actor, 0);
|
||||
} else if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->targetY, this->ySpeed)) {
|
||||
} else if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->targetY, this->ySpeed)) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_PILLAR_MOVE_STOP);
|
||||
this->actionFunc = BgDdanJd_Idle;
|
||||
}
|
||||
|
||||
@@ -117,10 +117,10 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
|
||||
Vec3f sp50;
|
||||
f32 sp4C;
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.speedXZ, 4.0f, 0.5f, 0.025f, 0.0f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 4.0f, 0.5f, 0.025f, 0.0f);
|
||||
func_800AA000(500.0f, 0x78, 0x14, 0xA);
|
||||
|
||||
if (Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.y, (this->dyna.actor.initPosRot.pos.y - 200.0f) - 20.0f,
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, (this->dyna.actor.initPosRot.pos.y - 200.0f) - 20.0f,
|
||||
0.075f, this->dyna.actor.speedXZ, 0.0075f) == 0.0f) {
|
||||
Flags_SetSwitch(globalCtx, this->dyna.actor.params);
|
||||
BgDdanKd_SetupAction(this, func_80871838);
|
||||
@@ -131,30 +131,30 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
|
||||
sp5C = sp50 = this->dyna.actor.posRot.pos;
|
||||
|
||||
if (globalCtx->state.frames & 2) {
|
||||
sp5C.z += 210.0f + Math_Rand_ZeroOne() * 230.0f;
|
||||
sp50.z += 210.0f + Math_Rand_ZeroOne() * 230.0f;
|
||||
sp5C.z += 210.0f + Rand_ZeroOne() * 230.0f;
|
||||
sp50.z += 210.0f + Rand_ZeroOne() * 230.0f;
|
||||
} else {
|
||||
sp5C.z += 330.0f + Math_Rand_ZeroOne() * 240.0f;
|
||||
sp50.z += 330.0f + Math_Rand_ZeroOne() * 240.0f;
|
||||
sp5C.z += 330.0f + Rand_ZeroOne() * 240.0f;
|
||||
sp50.z += 330.0f + Rand_ZeroOne() * 240.0f;
|
||||
}
|
||||
sp5C.x += 80.0f + Math_Rand_ZeroOne() * 10.0f;
|
||||
sp50.x -= 80.0f + Math_Rand_ZeroOne() * 10.0f;
|
||||
sp5C.y = this->dyna.actor.groundY + 20.0f + Math_Rand_ZeroOne();
|
||||
sp50.y = this->dyna.actor.groundY + 20.0f + Math_Rand_ZeroOne();
|
||||
sp5C.x += 80.0f + Rand_ZeroOne() * 10.0f;
|
||||
sp50.x -= 80.0f + Rand_ZeroOne() * 10.0f;
|
||||
sp5C.y = this->dyna.actor.groundY + 20.0f + Rand_ZeroOne();
|
||||
sp50.y = this->dyna.actor.groundY + 20.0f + Rand_ZeroOne();
|
||||
|
||||
func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1);
|
||||
func_80033480(globalCtx, &sp50, 20.0f, 1, sp4C * 135.0f, 60, 1);
|
||||
|
||||
D_808718FC[0] = Math_Rand_CenteredFloat(3.0f);
|
||||
D_80871904[0] = Math_Rand_CenteredFloat(3.0f);
|
||||
D_808718FC[0] = Rand_CenteredFloat(3.0f);
|
||||
D_80871904[0] = Rand_CenteredFloat(3.0f);
|
||||
|
||||
func_8003555C(globalCtx, &sp5C, &D_808718FC, &D_80871908);
|
||||
func_8003555C(globalCtx, &sp50, &D_808718FC, &D_80871908);
|
||||
|
||||
sp5C = this->dyna.actor.posRot.pos;
|
||||
sp5C.z += 560.0f + Math_Rand_ZeroOne() * 5.0f;
|
||||
sp5C.x += (Math_Rand_ZeroOne() - 0.5f) * 160.0f;
|
||||
sp5C.y = Math_Rand_ZeroOne() * 3.0f + (this->dyna.actor.groundY + 20.0f);
|
||||
sp5C.z += 560.0f + Rand_ZeroOne() * 5.0f;
|
||||
sp5C.x += (Rand_ZeroOne() - 0.5f) * 160.0f;
|
||||
sp5C.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.groundY + 20.0f);
|
||||
|
||||
func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1);
|
||||
func_8003555C(globalCtx, &sp5C, &D_808718FC, &D_80871908);
|
||||
|
||||
@@ -63,9 +63,9 @@ void BgDodoago_SpawnSparkles(Vec3f* vec, GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
|
||||
for (i = 4; i > 0; i--) {
|
||||
pos.x = Math_Rand_CenteredFloat(20.0f) + vec->x;
|
||||
pos.y = Math_Rand_CenteredFloat(10.0f) + vec->y;
|
||||
pos.z = Math_Rand_CenteredFloat(20.0f) + vec->z;
|
||||
pos.x = Rand_CenteredFloat(20.0f) + vec->x;
|
||||
pos.y = Rand_CenteredFloat(10.0f) + vec->y;
|
||||
pos.z = Rand_CenteredFloat(20.0f) + vec->z;
|
||||
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &velocity, &acceleration, &primColor, &envColor);
|
||||
}
|
||||
}
|
||||
@@ -210,10 +210,10 @@ void func_80871FB8(BgDodoago* this, GlobalContext* globalCtx) {
|
||||
currentPos.z = this->dyna.actor.posRot.pos.z + 100.0f;
|
||||
|
||||
BgDodoago_SpawnSparkles(¤tPos, globalCtx);
|
||||
Math_ApproxS(&this->unk_164, 0x64, 3);
|
||||
Math_StepToS(&this->unk_164, 0x64, 3);
|
||||
func_800AA000(500.0f, 0x78, 0x14, 0xA);
|
||||
|
||||
if (Math_SmoothScaleMaxMinS(&this->dyna.actor.shape.rot.x, 0x1333, 0x6E - this->unk_164, 0x3E8, 0x32) == 0) {
|
||||
if (Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, 0x1333, 0x6E - this->unk_164, 0x3E8, 0x32) == 0) {
|
||||
BgDodoago_SetupAction(this, func_8087227C);
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_STONE_BOUND, &this->dyna.actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
|
||||
@@ -199,25 +199,25 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) {
|
||||
|
||||
osSyncPrintf("MODE DOWN\n");
|
||||
if (this->flashState == FLASH_GROW) {
|
||||
Math_SmoothScaleMaxF(&this->flashPrimColorB, 170.0f, 1.0f, 8.5f);
|
||||
Math_SmoothScaleMaxF(&this->flashEnvColorR, 120.0f, 1.0f, 13.5f);
|
||||
Math_SmoothScaleMaxF(&this->flashYScale, 2.5f, 1.0f, 0.25f);
|
||||
Math_ApproachF(&this->flashPrimColorB, 170.0f, 1.0f, 8.5f);
|
||||
Math_ApproachF(&this->flashEnvColorR, 120.0f, 1.0f, 13.5f);
|
||||
Math_ApproachF(&this->flashYScale, 2.5f, 1.0f, 0.25f);
|
||||
if (this->flashYScale == 2.5f) {
|
||||
this->flashState = FLASH_SHRINK;
|
||||
}
|
||||
} else if (this->flashState == FLASH_SHRINK) {
|
||||
Math_SmoothScaleMaxF(&this->flashPrimColorG, 0.0f, 1.0f, 25.5f);
|
||||
Math_SmoothScaleMaxF(&this->flashEnvColorR, 0.0f, 1.0f, 12.0f);
|
||||
Math_SmoothScaleMaxF(&this->flashEnvColorG, 0.0f, 1.0f, 25.5f);
|
||||
Math_SmoothDownscaleMaxF(&this->flashYScale, 1.0f, 0.25f);
|
||||
Math_ApproachF(&this->flashPrimColorG, 0.0f, 1.0f, 25.5f);
|
||||
Math_ApproachF(&this->flashEnvColorR, 0.0f, 1.0f, 12.0f);
|
||||
Math_ApproachF(&this->flashEnvColorG, 0.0f, 1.0f, 25.5f);
|
||||
Math_ApproachZeroF(&this->flashYScale, 1.0f, 0.25f);
|
||||
if (this->flashYScale == 0.0f) {
|
||||
this->flashState = FLASH_NONE;
|
||||
}
|
||||
}
|
||||
if (this->dropTimer == 0) {
|
||||
this->flashYScale = 0.0f;
|
||||
Math_SmoothScaleMaxF(&this->dyna.actor.posRot.pos.y, -1000.0f, 1.0f, this->dyna.actor.speedXZ);
|
||||
Math_SmoothScaleMaxF(&this->dyna.actor.speedXZ, 100.0f, 1.0f, 2.0f);
|
||||
Math_ApproachF(&this->dyna.actor.posRot.pos.y, -1000.0f, 1.0f, this->dyna.actor.speedXZ);
|
||||
Math_ApproachF(&this->dyna.actor.speedXZ, 100.0f, 1.0f, 2.0f);
|
||||
if (!(this->unwalledSides & OTYUKA_SIDE_EAST)) {
|
||||
this->dyna.actor.shape.rot.z -= (s16)(this->dyna.actor.speedXZ * 30.0f);
|
||||
}
|
||||
@@ -237,11 +237,11 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) {
|
||||
velocity.x = velocity.y = velocity.z = 0.0f;
|
||||
|
||||
for (i = 0; i < 30; i++) {
|
||||
pos.x = Math_Rand_CenteredFloat(150.0f) + this->dyna.actor.posRot.pos.x;
|
||||
pos.y = Math_Rand_ZeroFloat(60.0f) + -750.0f;
|
||||
pos.z = Math_Rand_CenteredFloat(150.0f) + this->dyna.actor.posRot.pos.z;
|
||||
pos.x = Rand_CenteredFloat(150.0f) + this->dyna.actor.posRot.pos.x;
|
||||
pos.y = Rand_ZeroFloat(60.0f) + -750.0f;
|
||||
pos.z = Rand_CenteredFloat(150.0f) + this->dyna.actor.posRot.pos.z;
|
||||
func_8002836C(globalCtx, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor,
|
||||
(s16)Math_Rand_ZeroFloat(100.0f) + 250, 5, (s16)Math_Rand_ZeroFloat(5.0f) + 15);
|
||||
(s16)Rand_ZeroFloat(100.0f) + 250, 5, (s16)Rand_ZeroFloat(5.0f) + 15);
|
||||
}
|
||||
|
||||
func_80033DB8(globalCtx, 10, 15);
|
||||
@@ -257,8 +257,8 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_BLOCKSINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4, &D_801333E0,
|
||||
&D_801333E0, &D_801333E8);
|
||||
}
|
||||
Math_SmoothScaleMaxF(&this->dyna.actor.posRot.pos.y, -1000.0f, 1.0f, this->dyna.actor.speedXZ);
|
||||
Math_SmoothScaleMaxF(&this->dyna.actor.speedXZ, 100.0f, 1.0f, 0.1f);
|
||||
Math_ApproachF(&this->dyna.actor.posRot.pos.y, -1000.0f, 1.0f, this->dyna.actor.speedXZ);
|
||||
Math_ApproachF(&this->dyna.actor.speedXZ, 100.0f, 1.0f, 0.1f);
|
||||
}
|
||||
osSyncPrintf("MODE DOWN END\n");
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void func_80878300(BgGateShutter* this, GlobalContext* globalCtx) {
|
||||
if (this->unk_178 == 0) {
|
||||
Audio_PlayActorSound2(thisx, NA_SE_EV_METALGATE_OPEN - SFX_FLAG);
|
||||
thisx->posRot.pos.x -= 2.0f;
|
||||
Math_SmoothScaleMaxF(&thisx->posRot.pos.z, -1375.0f, 0.8f, 0.3f);
|
||||
Math_ApproachF(&thisx->posRot.pos.z, -1375.0f, 0.8f, 0.3f);
|
||||
if (thisx->posRot.pos.x < -89.0f) {
|
||||
Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP);
|
||||
this->unk_178 = 0x1E;
|
||||
@@ -107,7 +107,7 @@ void func_808783D4(BgGateShutter* this, GlobalContext* globalCtx) {
|
||||
if (this->unk_178 == 0) {
|
||||
Audio_PlayActorSound2(thisx, NA_SE_EV_METALGATE_OPEN - SFX_FLAG);
|
||||
thisx->posRot.pos.x += 2.0f;
|
||||
Math_SmoothScaleMaxF(&thisx->posRot.pos.z, -1350.0f, 0.8f, 0.3f);
|
||||
Math_ApproachF(&thisx->posRot.pos.z, -1350.0f, 0.8f, 0.3f);
|
||||
if (thisx->posRot.pos.x > 90.0f) {
|
||||
thisx->posRot.pos.x = 91.0f;
|
||||
Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP);
|
||||
|
||||
@@ -194,7 +194,7 @@ void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx) {
|
||||
if (vanishTimer > 64) {
|
||||
this->timer2 = (this->timer2 < 120) ? this->timer2 + 8 : 127;
|
||||
} else if (vanishTimer > 16) {
|
||||
this->timer2 = (Math_Coss((u16)this->timer1 * 0x1000) * 64.0f) + 127.0f;
|
||||
this->timer2 = (Math_CosS((u16)this->timer1 * 0x1000) * 64.0f) + 127.0f;
|
||||
if (this->timer2 > 127) {
|
||||
this->timer2 = 127;
|
||||
}
|
||||
|
||||
@@ -124,24 +124,24 @@ void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
|
||||
if (1) {}
|
||||
|
||||
if ((this->unk_198 % 6) == 0) {
|
||||
temp_2 = Math_Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f
|
||||
temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f
|
||||
vecA.y = 0.0f;
|
||||
vecB.y = this->actor.posRot.pos.y;
|
||||
|
||||
this2 = this;
|
||||
for (i = 0; i < 6; i++) {
|
||||
temp_1 = Math_Rand_CenteredFloat(0x2800) + temp_2;
|
||||
temp_3 = Math_Sins(temp_1);
|
||||
temp_4 = Math_Coss(temp_1);
|
||||
temp_1 = Rand_CenteredFloat(0x2800) + temp_2;
|
||||
temp_3 = Math_SinS(temp_1);
|
||||
temp_4 = Math_CosS(temp_1);
|
||||
vecB.x = this2->actor.posRot.pos.x + (120.0f * temp_3);
|
||||
vecB.z = this2->actor.posRot.pos.z + (120.0f * temp_4);
|
||||
distXZ = Math_Vec3f_DistXZ(&this2->actor.initPosRot.pos, &vecB) * (1.0f / 120.f);
|
||||
distXZ = Math_Vec3f_DistXZ(&this2->actor.initPosRot.pos, &vecB) * (1.0f / 120.0f);
|
||||
if (distXZ < 0.7f) {
|
||||
temp_3 = Math_Sins(temp_1 + 0x8000);
|
||||
temp_4 = Math_Coss(temp_1 + 0x8000);
|
||||
temp_3 = Math_SinS(temp_1 + 0x8000);
|
||||
temp_4 = Math_CosS(temp_1 + 0x8000);
|
||||
vecB.x = this->actor.posRot.pos.x + (120.0f * temp_3);
|
||||
vecB.z = this->actor.posRot.pos.z + (120.0f * temp_4);
|
||||
distXZ = Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &vecB) * (1.0f / 120.f);
|
||||
distXZ = Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &vecB) * (1.0f / 120.0f);
|
||||
}
|
||||
|
||||
vecA.x = 4.0f * temp_3 * distXZ;
|
||||
|
||||
@@ -99,11 +99,11 @@ void func_8087B938(BgHaka* this, GlobalContext* globalCtx) {
|
||||
|
||||
this->dyna.actor.speedXZ += 0.05f;
|
||||
this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 1.5f);
|
||||
sp38 = Math_ApproxF(&this->dyna.actor.minVelocityY, 60.0f, this->dyna.actor.speedXZ);
|
||||
sp38 = Math_StepToF(&this->dyna.actor.minVelocityY, 60.0f, this->dyna.actor.speedXZ);
|
||||
this->dyna.actor.posRot.pos.x =
|
||||
Math_Sins(this->dyna.actor.posRot.rot.y) * this->dyna.actor.minVelocityY + this->dyna.actor.initPosRot.pos.x;
|
||||
Math_SinS(this->dyna.actor.posRot.rot.y) * this->dyna.actor.minVelocityY + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z =
|
||||
Math_Coss(this->dyna.actor.posRot.rot.y) * this->dyna.actor.minVelocityY + this->dyna.actor.initPosRot.pos.z;
|
||||
Math_CosS(this->dyna.actor.posRot.rot.y) * this->dyna.actor.minVelocityY + this->dyna.actor.initPosRot.pos.z;
|
||||
if (sp38 != 0) {
|
||||
this->dyna.unk_150 = 0.0f;
|
||||
player->stateFlags2 &= ~0x10;
|
||||
|
||||
@@ -157,7 +157,7 @@ void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
this->unk_16A--;
|
||||
}
|
||||
|
||||
if (!Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 640.0f,
|
||||
if (!Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 640.0f,
|
||||
this->dyna.actor.velocity.y)) {
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_CHINETRAP_DOWN - SFX_FLAG);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ void func_8087E10C(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_8087E1E0(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 16.0f / 3.0f);
|
||||
Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 16.0f / 3.0f);
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG);
|
||||
|
||||
if (this->unk_16A != 0) {
|
||||
@@ -196,9 +196,9 @@ void func_8087E288(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_8087E2D8(BgHakaMeganeBG* this, GlobalContext* globalCtx) {
|
||||
Math_ApproxF(&this->dyna.actor.speedXZ, 30.0f, 2.0f);
|
||||
Math_StepToF(&this->dyna.actor.speedXZ, 30.0f, 2.0f);
|
||||
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.speedXZ)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.speedXZ)) {
|
||||
Actor_SetHeight(&this->dyna.actor, 50.0f);
|
||||
this->actionFunc = func_8087E34C;
|
||||
} else {
|
||||
|
||||
@@ -186,8 +186,8 @@ void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) {
|
||||
this->timer = SCYTHE_SPIN_TIME;
|
||||
}
|
||||
|
||||
actorRotYSin = Math_Sins(this->actor.shape.rot.y);
|
||||
actorRotYCos = Math_Coss(this->actor.shape.rot.y);
|
||||
actorRotYSin = Math_SinS(this->actor.shape.rot.y);
|
||||
actorRotYCos = Math_CosS(this->actor.shape.rot.y);
|
||||
|
||||
iterateCount = (this->actor.params != 0) ? 4 : 2;
|
||||
|
||||
|
||||
@@ -180,8 +180,8 @@ void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
|
||||
func_8002DBD0(&this->dyna.actor, &sp28, &player->actor.posRot.pos);
|
||||
|
||||
sine = Math_Sins(this->dyna.actor.shape.rot.y);
|
||||
cosine = Math_Coss(this->dyna.actor.shape.rot.y);
|
||||
sine = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cosine = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
if (this->dyna.actor.params == HAKA_TRAP_GUILLOTINE_SLOW) {
|
||||
sp28.x = CLAMP(sp28.x, -50.0f, 50.0f);
|
||||
zNonNegative = (sp28.z >= 0.0f) ? 1.0f : -1.0f;
|
||||
@@ -201,7 +201,7 @@ void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
|
||||
if ((D_80880F30 == 0) && (!Player_InCsMode(globalCtx))) {
|
||||
if (!Math_ApproxF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x, 0.5f)) {
|
||||
if (!Math_StepToF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x, 0.5f)) {
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG);
|
||||
} else if (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) {
|
||||
D_80881018 |= 1;
|
||||
@@ -235,13 +235,13 @@ void func_808802D8(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_BURN_OUT - SFX_FLAG);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
f32 rand = Math_Rand_ZeroOne();
|
||||
f32 rand = Rand_ZeroOne();
|
||||
|
||||
xScale = (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) ? -30.0f : 30.0f;
|
||||
|
||||
vector.x = xScale * rand + this->dyna.actor.posRot.pos.x;
|
||||
vector.y = Math_Rand_ZeroOne() * 10.0f + this->dyna.actor.posRot.pos.y + 30.0f;
|
||||
vector.z = Math_Rand_CenteredFloat(320.0f) + this->dyna.actor.posRot.pos.z;
|
||||
vector.y = Rand_ZeroOne() * 10.0f + this->dyna.actor.posRot.pos.y + 30.0f;
|
||||
vector.z = Rand_CenteredFloat(320.0f) + this->dyna.actor.posRot.pos.z;
|
||||
|
||||
EffectSsDeadDb_Spawn(globalCtx, &vector, &zeroVec, &zeroVec, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9,
|
||||
false);
|
||||
@@ -267,7 +267,7 @@ void func_80880484(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
this->timer -= 1;
|
||||
}
|
||||
|
||||
sp24 = Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 185.0f,
|
||||
sp24 = Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 185.0f,
|
||||
this->dyna.actor.velocity.y);
|
||||
timer = this->timer;
|
||||
|
||||
@@ -295,12 +295,12 @@ void func_808805C0(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (this->unk_16A) {
|
||||
Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 27.0f);
|
||||
Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 27.0f);
|
||||
} else {
|
||||
if (this->timer > 20) {
|
||||
Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 90.0f, 9.0f);
|
||||
Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 90.0f, 9.0f);
|
||||
} else {
|
||||
Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 4.5f);
|
||||
Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 4.5f);
|
||||
}
|
||||
|
||||
if (this->timer == 20) {
|
||||
@@ -347,7 +347,7 @@ void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
vector.x -= 90.0f;
|
||||
}
|
||||
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, tempf20, this->dyna.actor.velocity.y)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, tempf20, this->dyna.actor.velocity.y)) {
|
||||
if (this->dyna.actor.velocity.y > 0.01f) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_TRAP_BOUND);
|
||||
}
|
||||
@@ -374,9 +374,9 @@ void func_808808F4(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (this->timer > 20) {
|
||||
this->unk_169 = Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->unk_16A, 15.0f);
|
||||
this->unk_169 = Math_StepToF(&this->dyna.actor.posRot.pos.y, this->unk_16A, 15.0f);
|
||||
} else {
|
||||
this->unk_169 = Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 20.0f);
|
||||
this->unk_169 = Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 20.0f);
|
||||
}
|
||||
|
||||
if (this->timer == 0) {
|
||||
@@ -412,12 +412,12 @@ void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2) {
|
||||
|
||||
void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
if (this->timer != 0) {
|
||||
if (Math_ApproxUpdateScaledS(&this->dyna.actor.posRot.rot.z, 0, this->dyna.actor.posRot.rot.z * 0.03f + 5.0f)) {
|
||||
if (Math_ScaledStepToS(&this->dyna.actor.posRot.rot.z, 0, this->dyna.actor.posRot.rot.z * 0.03f + 5.0f)) {
|
||||
this->timer = 40;
|
||||
this->actionFunc = func_808809B0;
|
||||
}
|
||||
} else {
|
||||
if (Math_ApproxUpdateScaledS(&this->dyna.actor.posRot.rot.z, 0x3A00,
|
||||
if (Math_ScaledStepToS(&this->dyna.actor.posRot.rot.z, 0x3A00,
|
||||
this->dyna.actor.posRot.rot.z * 0.03f + 5.0f)) {
|
||||
this->timer = 100;
|
||||
this->actionFunc = func_80880C0C;
|
||||
|
||||
@@ -66,7 +66,7 @@ void BgHakaTubo_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Collider_SetCylinder(globalCtx, &this->potCollider, &this->dyna.actor, &sPotColliderInit);
|
||||
Collider_InitCylinder(globalCtx, &this->flamesCollider);
|
||||
Collider_SetCylinder(globalCtx, &this->flamesCollider, &this->dyna.actor, &sFlamesColliderInit);
|
||||
this->fireScroll = Math_Rand_ZeroOne() * 15.0f;
|
||||
this->fireScroll = Rand_ZeroOne() * 15.0f;
|
||||
sPotsDestroyed = 0;
|
||||
this->actionFunc = BgHakaTubo_Idle;
|
||||
}
|
||||
@@ -85,8 +85,8 @@ void BgHakaTubo_Idle(BgHakaTubo* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (this->dyna.actor.room == 12) { // 3 spinning pots room in Shadow Temple
|
||||
this->dyna.actor.shape.rot.y += 0x180;
|
||||
this->dyna.actor.posRot.pos.x = Math_Sins(this->dyna.actor.shape.rot.y - 0x4000) * 145.0f + -5559.0f;
|
||||
this->dyna.actor.posRot.pos.z = Math_Coss(this->dyna.actor.shape.rot.y - 0x4000) * 145.0f + -1587.0f;
|
||||
this->dyna.actor.posRot.pos.x = Math_SinS(this->dyna.actor.shape.rot.y - 0x4000) * 145.0f + -5559.0f;
|
||||
this->dyna.actor.posRot.pos.z = Math_CosS(this->dyna.actor.shape.rot.y - 0x4000) * 145.0f + -1587.0f;
|
||||
}
|
||||
// Colliding with flame circle
|
||||
if (this->flamesCollider.base.atFlags & 2) {
|
||||
@@ -133,7 +133,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) {
|
||||
spawnPos.y = this->dyna.actor.posRot.pos.y + 200.0f;
|
||||
spawnPos.z = this->dyna.actor.posRot.pos.z;
|
||||
if (this->dyna.actor.room == 12) { // 3 spinning pots room in Shadow Temple
|
||||
rnd = Math_Rand_ZeroOne();
|
||||
rnd = Rand_ZeroOne();
|
||||
sPotsDestroyed++;
|
||||
if (sPotsDestroyed == 3) {
|
||||
// All 3 pots destroyed
|
||||
|
||||
@@ -94,7 +94,7 @@ void BgHakaWater_ChangeWaterLevel(BgHakaWater* this, GlobalContext* globalCtx) {
|
||||
func_8002F948(&this->actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
|
||||
}
|
||||
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.5f) != 0) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.5f) != 0) {
|
||||
this->actionFunc = BgHakaWater_Wait;
|
||||
if (this->isLowered) {
|
||||
this->actor.draw = NULL;
|
||||
|
||||
@@ -52,9 +52,9 @@ extern Gfx D_06001A30[];
|
||||
extern Gfx D_060018A0[];
|
||||
|
||||
void BgHeavyBlock_SetPieceRandRot(BgHeavyBlock* this, f32 scale) {
|
||||
this->dyna.actor.posRot.rot.x = Math_Rand_CenteredFloat(1024.0f) * scale;
|
||||
this->dyna.actor.posRot.rot.y = Math_Rand_CenteredFloat(1024.0f) * scale;
|
||||
this->dyna.actor.posRot.rot.z = Math_Rand_CenteredFloat(1024.0f) * scale;
|
||||
this->dyna.actor.posRot.rot.x = Rand_CenteredFloat(1024.0f) * scale;
|
||||
this->dyna.actor.posRot.rot.y = Rand_CenteredFloat(1024.0f) * scale;
|
||||
this->dyna.actor.posRot.rot.z = Rand_CenteredFloat(1024.0f) * scale;
|
||||
}
|
||||
|
||||
void BgHeavyBlock_InitPiece(BgHeavyBlock* this, f32 scale) {
|
||||
@@ -64,18 +64,18 @@ void BgHeavyBlock_InitPiece(BgHeavyBlock* this, f32 scale) {
|
||||
|
||||
this->dyna.actor.gravity = -0.6f;
|
||||
this->dyna.actor.minVelocityY = -12.0f;
|
||||
randChoice = Math_Rand_CenteredFloat(12.0f * scale);
|
||||
randChoice = Rand_CenteredFloat(12.0f * scale);
|
||||
rand = (randChoice < 0.0f) ? randChoice - 2.0f : randChoice + 2.0f;
|
||||
this->dyna.actor.velocity.y = (Math_Rand_ZeroFloat(8.0f) + 4.0f) * scale;
|
||||
this->dyna.actor.velocity.z = Math_Rand_ZeroFloat(-8.0f * scale);
|
||||
yawSinCos = Math_Coss(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.velocity.y = (Rand_ZeroFloat(8.0f) + 4.0f) * scale;
|
||||
this->dyna.actor.velocity.z = Rand_ZeroFloat(-8.0f * scale);
|
||||
yawSinCos = Math_CosS(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.velocity.x =
|
||||
(Math_Sins(this->dyna.actor.posRot.rot.y) * this->dyna.actor.velocity.z + (yawSinCos * rand));
|
||||
yawSinCos = Math_Sins(this->dyna.actor.posRot.rot.y);
|
||||
(Math_SinS(this->dyna.actor.posRot.rot.y) * this->dyna.actor.velocity.z + (yawSinCos * rand));
|
||||
yawSinCos = Math_SinS(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.velocity.z =
|
||||
(Math_Coss(this->dyna.actor.posRot.rot.y) * this->dyna.actor.velocity.z) + (-yawSinCos * rand);
|
||||
(Math_CosS(this->dyna.actor.posRot.rot.y) * this->dyna.actor.velocity.z) + (-yawSinCos * rand);
|
||||
BgHeavyBlock_SetPieceRandRot(this, scale);
|
||||
Actor_SetScale(&this->dyna.actor, Math_Rand_CenteredFloat(0.2f) + 1.0f);
|
||||
Actor_SetScale(&this->dyna.actor, Rand_CenteredFloat(0.2f) + 1.0f);
|
||||
}
|
||||
|
||||
void BgHeavyBlock_SetupDynapoly(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
@@ -192,9 +192,9 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
thisx->pos4.y -= this->unk_164.y;
|
||||
if (thisx->bgCheckFlags & 1) {
|
||||
this->pieceFlags |= PIECE_FLAG_HIT_FLOOR;
|
||||
thisx->velocity.y = Math_Rand_ZeroFloat(4.0f) + 2.0f;
|
||||
thisx->velocity.x = Math_Rand_CenteredFloat(8.0f);
|
||||
thisx->velocity.z = Math_Rand_CenteredFloat(8.0f);
|
||||
thisx->velocity.y = Rand_ZeroFloat(4.0f) + 2.0f;
|
||||
thisx->velocity.x = Rand_CenteredFloat(8.0f);
|
||||
thisx->velocity.z = Rand_CenteredFloat(8.0f);
|
||||
BgHeavyBlock_SetPieceRandRot(this, 1.0f);
|
||||
Audio_PlayActorSound2(thisx, NA_SE_EV_ROCK_BROKEN);
|
||||
func_800AA000(thisx->xzDistFromLink, 0x96, 0xA, 8);
|
||||
@@ -261,20 +261,20 @@ void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 po
|
||||
scaleStep = 50;
|
||||
break;
|
||||
case 2:
|
||||
sp44 = Math_Rand_ZeroFloat(5.0f) + 5.0f;
|
||||
sp6E = Math_Rand_CenteredFloat(65280.0f);
|
||||
sp44 = Rand_ZeroFloat(5.0f) + 5.0f;
|
||||
sp6E = Rand_CenteredFloat(65280.0f);
|
||||
|
||||
velocity.x = (Math_Sins(sp6E) * sp44) + velX;
|
||||
velocity.x = (Math_SinS(sp6E) * sp44) + velX;
|
||||
velocity.y = velY;
|
||||
velocity.z = (Math_Coss(sp6E) * sp44) + velZ;
|
||||
velocity.z = (Math_CosS(sp6E) * sp44) + velZ;
|
||||
break;
|
||||
case 0:
|
||||
sp6E = Math_Vec3f_Yaw(&eye, &at);
|
||||
sp6C = -Math_Vec3f_Pitch(&eye, &at);
|
||||
|
||||
velocity.x = ((5.0f * Math_Sins(sp6E)) * Math_Coss(sp6C)) + velX;
|
||||
velocity.y = (Math_Sins(sp6C) * 5.0f) + velY;
|
||||
velocity.z = ((5.0f * Math_Coss(sp6E)) * Math_Coss(sp6C)) + velZ;
|
||||
velocity.x = ((5.0f * Math_SinS(sp6E)) * Math_CosS(sp6C)) + velX;
|
||||
velocity.y = (Math_SinS(sp6C) * 5.0f) + velY;
|
||||
velocity.z = ((5.0f * Math_CosS(sp6E)) * Math_CosS(sp6C)) + velZ;
|
||||
|
||||
pos.x -= (velocity.x * 20.0f);
|
||||
pos.y -= (velocity.y * 20.0f);
|
||||
@@ -283,7 +283,7 @@ void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 po
|
||||
}
|
||||
|
||||
func_8002843C(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, scaleStep,
|
||||
(s32)Math_Rand_ZeroFloat(10.0f) + 20);
|
||||
(s32)Rand_ZeroFloat(10.0f) + 20);
|
||||
}
|
||||
|
||||
void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
@@ -299,10 +299,10 @@ void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
f32 sinYaw;
|
||||
f32 cosYaw;
|
||||
|
||||
sinPitch = Math_Sins(this->dyna.actor.posRot.rot.x);
|
||||
cosPitch = Math_Coss(this->dyna.actor.posRot.rot.x);
|
||||
sinYaw = Math_Sins(this->dyna.actor.posRot.rot.y);
|
||||
cosYaw = Math_Coss(this->dyna.actor.posRot.rot.y);
|
||||
sinPitch = Math_SinS(this->dyna.actor.posRot.rot.x);
|
||||
cosPitch = Math_CosS(this->dyna.actor.posRot.rot.x);
|
||||
sinYaw = Math_SinS(this->dyna.actor.posRot.rot.y);
|
||||
cosYaw = Math_CosS(this->dyna.actor.posRot.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(spA4); i++) {
|
||||
pos.z = (spA4[i].y * sinPitch) + (spA4[i].z * cosPitch);
|
||||
@@ -362,10 +362,10 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (this->timer < 40) {
|
||||
xOffset = Math_Rand_CenteredFloat(110.0f);
|
||||
sinYaw = Math_Sins(this->dyna.actor.shape.rot.y);
|
||||
zOffset = Math_Rand_CenteredFloat(110.0f);
|
||||
cosYaw = Math_Coss(this->dyna.actor.shape.rot.y);
|
||||
xOffset = Rand_CenteredFloat(110.0f);
|
||||
sinYaw = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
zOffset = Rand_CenteredFloat(110.0f);
|
||||
cosYaw = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
BgHeavyBlock_SpawnDust(globalCtx, (sinYaw * -70.0f) + (this->dyna.actor.posRot.pos.x + xOffset),
|
||||
this->dyna.actor.posRot.pos.y + 10.0f,
|
||||
@@ -447,7 +447,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
this->actionFunc = BgHeavyBlock_Land;
|
||||
}
|
||||
}
|
||||
this->dyna.actor.shape.rot.x = atan2s(this->dyna.actor.velocity.y, this->dyna.actor.speedXZ);
|
||||
this->dyna.actor.shape.rot.x = Math_Atan2S(this->dyna.actor.velocity.y, this->dyna.actor.speedXZ);
|
||||
}
|
||||
|
||||
void BgHeavyBlock_DoNothing(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
@@ -456,25 +456,23 @@ void BgHeavyBlock_DoNothing(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
|
||||
if (Math_SmoothScaleMaxMinS(&this->dyna.actor.shape.rot.x, 0x8AD0, 6, 2000, 100) != 0) {
|
||||
Math_ApproxF(&this->dyna.actor.speedXZ, 0.0f, 20.0f);
|
||||
Math_ApproxF(&this->dyna.actor.velocity.y, 0.0f, 3.0f);
|
||||
if (Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, 0x8AD0, 6, 2000, 100) != 0) {
|
||||
Math_StepToF(&this->dyna.actor.speedXZ, 0.0f, 20.0f);
|
||||
Math_StepToF(&this->dyna.actor.velocity.y, 0.0f, 3.0f);
|
||||
this->dyna.actor.gravity = 0.0f;
|
||||
this->dyna.actor.posRot.pos = this->dyna.actor.initPosRot.pos;
|
||||
Actor_MoveForward(&this->dyna.actor);
|
||||
this->dyna.actor.initPosRot.pos = this->dyna.actor.posRot.pos;
|
||||
switch (this->dyna.actor.params & 0xFF) {
|
||||
case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
|
||||
BgHeavyBlock_SpawnDust(globalCtx, Math_Rand_CenteredFloat(30.0f) + 1678.0f,
|
||||
Math_Rand_ZeroFloat(100.0f) + 1286.0f, Math_Rand_CenteredFloat(30.0f) + 552.0f,
|
||||
0.0f, 0.0f, 0.0f, 0);
|
||||
BgHeavyBlock_SpawnDust(globalCtx, Math_Rand_CenteredFloat(30.0f) + 1729.0f,
|
||||
Math_Rand_ZeroFloat(80.0f) + 1269.0f, Math_Rand_CenteredFloat(30.0f) + 600.0f,
|
||||
0.0f, 0.0f, 0.0f, 0);
|
||||
BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(30.0f) + 1678.0f, Rand_ZeroFloat(100.0f) + 1286.0f,
|
||||
Rand_CenteredFloat(30.0f) + 552.0f, 0.0f, 0.0f, 0.0f, 0);
|
||||
BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(30.0f) + 1729.0f, Rand_ZeroFloat(80.0f) + 1269.0f,
|
||||
Rand_CenteredFloat(30.0f) + 600.0f, 0.0f, 0.0f, 0.0f, 0);
|
||||
break;
|
||||
case HEAVYBLOCK_UNBREAKABLE:
|
||||
BgHeavyBlock_SpawnDust(globalCtx, Math_Rand_CenteredFloat(100.0f) + -735.0f, 29.0f,
|
||||
Math_Rand_CenteredFloat(100.0f) + -3418.0f, 0.0f, 0.0f, 0.0f, 3);
|
||||
BgHeavyBlock_SpawnDust(globalCtx, Rand_CenteredFloat(100.0f) + -735.0f, 29.0f,
|
||||
Rand_CenteredFloat(100.0f) + -3418.0f, 0.0f, 0.0f, 0.0f, 3);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -102,7 +102,7 @@ void BgHidanCurtain_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
(((this->type == 0) || (this->type == 6)) && Flags_GetClear(globalCtx, this->actor.room))) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
this->texScroll = Math_Rand_ZeroOne() * 15.0f;
|
||||
this->texScroll = Rand_ZeroOne() * 15.0f;
|
||||
}
|
||||
|
||||
void BgHidanCurtain_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
@@ -149,7 +149,7 @@ void BgHidanCurtain_WaitForSwitchOff(BgHidanCurtain* this, GlobalContext* global
|
||||
void BgHidanCurtain_TurnOn(BgHidanCurtain* this, GlobalContext* globalCtx) {
|
||||
f32 riseSpeed = sHCParams[this->size].riseSpeed;
|
||||
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, riseSpeed)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, riseSpeed)) {
|
||||
Flags_UnsetSwitch(globalCtx, this->actor.params);
|
||||
this->actionFunc = BgHidanCurtain_WaitForSwitchOn;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ void BgHidanCurtain_TurnOn(BgHidanCurtain* this, GlobalContext* globalCtx) {
|
||||
void BgHidanCurtain_TurnOff(BgHidanCurtain* this, GlobalContext* globalCtx) {
|
||||
BgHidanCurtainParams* hcParams = &sHCParams[this->size];
|
||||
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y - hcParams->riseDist,
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y - hcParams->riseDist,
|
||||
hcParams->riseSpeed)) {
|
||||
if ((this->type == 0) || (this->type == 6)) {
|
||||
Actor_Kill(&this->actor);
|
||||
|
||||
@@ -104,8 +104,8 @@ void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
this->dyna.actor.posRot.rot.y += 0x4000;
|
||||
}
|
||||
this->dyna.actor.posRot.pos.x += 32.5f * Math_Sins(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.posRot.pos.z += 32.5f * Math_Coss(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.posRot.pos.x += 32.5f * Math_SinS(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.posRot.pos.z += 32.5f * Math_CosS(this->dyna.actor.posRot.rot.y);
|
||||
|
||||
func_8002DF54(globalCtx, &this->dyna.actor, 8);
|
||||
this->dyna.actor.flags |= 0x10;
|
||||
@@ -127,7 +127,7 @@ void BgHidanDalm_Shrink(BgHidanDalm* this, GlobalContext* globalCtx) {
|
||||
Vec3f velocity;
|
||||
Vec3f pos;
|
||||
|
||||
if (Math_ApproxF(&this->dyna.actor.scale.x, 0.0f, 0.004f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.scale.x, 0.0f, 0.004f)) {
|
||||
func_8002DF54(globalCtx, &this->dyna.actor, 7);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
}
|
||||
@@ -139,9 +139,9 @@ void BgHidanDalm_Shrink(BgHidanDalm* this, GlobalContext* globalCtx) {
|
||||
pos.z = this->dyna.actor.posRot.pos.z;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
velocity.x = 5.0f * Math_Sins(this->dyna.actor.posRot.rot.y + 0x8000) + (Math_Rand_ZeroOne() - 0.5f) * 5.0f;
|
||||
velocity.z = 5.0f * Math_Coss(this->dyna.actor.posRot.rot.y + 0x8000) + (Math_Rand_ZeroOne() - 0.5f) * 5.0f;
|
||||
velocity.y = (Math_Rand_ZeroOne() - 0.5f) * 1.5f;
|
||||
velocity.x = 5.0f * Math_SinS(this->dyna.actor.posRot.rot.y + 0x8000) + (Rand_ZeroOne() - 0.5f) * 5.0f;
|
||||
velocity.z = 5.0f * Math_CosS(this->dyna.actor.posRot.rot.y + 0x8000) + (Rand_ZeroOne() - 0.5f) * 5.0f;
|
||||
velocity.y = (Rand_ZeroOne() - 0.5f) * 1.5f;
|
||||
EffectSsKiraKira_SpawnSmallYellow(globalCtx, &pos, &velocity, &accel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,9 +111,9 @@ void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx)
|
||||
|
||||
void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||
if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) {
|
||||
Math_ApproxF(&this->actor.scale.y, 0.1f, 0.01f / 0.4f);
|
||||
Math_StepToF(&this->actor.scale.y, 0.1f, 0.01f / 0.4f);
|
||||
} else {
|
||||
if (Math_ApproxF(&this->actor.scale.y, 0.01f, 0.01f) != 0) {
|
||||
if (Math_StepToF(&this->actor.scale.y, 0.01f, 0.01f) != 0) {
|
||||
this->actor.draw = NULL;
|
||||
this->actionFunc = BgHidanFirewall_Wait;
|
||||
} else {
|
||||
@@ -164,8 +164,8 @@ void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext*
|
||||
} else {
|
||||
sp30.z = this->actor.params * 25.0f;
|
||||
}
|
||||
sp28 = Math_Sins(this->actor.shape.rot.y);
|
||||
temp_ret = Math_Coss(this->actor.shape.rot.y);
|
||||
sp28 = Math_SinS(this->actor.shape.rot.y);
|
||||
temp_ret = Math_CosS(this->actor.shape.rot.y);
|
||||
this->collider.dim.pos.x = this->actor.posRot.pos.x + sp30.x * temp_ret + sp30.z * sp28;
|
||||
this->collider.dim.pos.z = this->actor.posRot.pos.z - sp30.x * sp28 + sp30.z * temp_ret;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) {
|
||||
void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
|
||||
if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y, 4.0f)) {
|
||||
if (Math_StepToF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y, 4.0f)) {
|
||||
Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND);
|
||||
func_80886FB4(this);
|
||||
} else {
|
||||
@@ -121,7 +121,7 @@ void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
|
||||
if (func_80043590(thisx)) {
|
||||
if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 790.0f, 4.0f)) {
|
||||
if (Math_StepToF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 790.0f, 4.0f)) {
|
||||
Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND);
|
||||
func_80886FB4(this);
|
||||
} else {
|
||||
|
||||
@@ -97,8 +97,8 @@ void BgHidanFwbig_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void BgHidanFwbig_UpdatePosition(BgHidanFwbig* this) {
|
||||
s16 startAngle = this->actor.shape.rot.y + this->direction * -0x4000;
|
||||
|
||||
this->actor.posRot.pos.x = (Math_Sins(startAngle) * 885.4f) + this->actor.initPosRot.pos.x;
|
||||
this->actor.posRot.pos.z = (Math_Coss(startAngle) * 885.4f) + this->actor.initPosRot.pos.z;
|
||||
this->actor.posRot.pos.x = (Math_SinS(startAngle) * 885.4f) + this->actor.initPosRot.pos.x;
|
||||
this->actor.posRot.pos.z = (Math_CosS(startAngle) * 885.4f) + this->actor.initPosRot.pos.z;
|
||||
}
|
||||
|
||||
void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
@@ -116,7 +116,7 @@ void BgHidanFwbig_WaitForCs(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgHidanFwbig_Rise(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 10.0f)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 10.0f)) {
|
||||
if (this->direction == 0) {
|
||||
Flags_UnsetSwitch(globalCtx, this->actor.params);
|
||||
this->actionFunc = BgHidanFwbig_WaitForSwitch;
|
||||
@@ -127,7 +127,7 @@ void BgHidanFwbig_Rise(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgHidanFwbig_Lower(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y - (2400.0f * this->actor.scale.y),
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y - (2400.0f * this->actor.scale.y),
|
||||
10.0f)) {
|
||||
if (this->direction == 0) {
|
||||
this->actionFunc = BgHidanFwbig_WaitForTimer;
|
||||
@@ -168,7 +168,7 @@ void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
|
||||
void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
if (!Player_InCsMode(globalCtx)) {
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.shape.rot.y,
|
||||
if (Math_ScaledStepToS(&this->actor.shape.rot.y,
|
||||
this->actor.initPosRot.rot.y + (this->direction * 0x6390), 0x20)) {
|
||||
this->moveState = FWBIG_RESET;
|
||||
this->actionFunc = BgHidanFwbig_Lower;
|
||||
@@ -192,8 +192,8 @@ void BgHidanFwbig_MoveCollider(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
projPos.x = CLAMP(projPos.x, -500.0f, 500.0f);
|
||||
}
|
||||
|
||||
sn = Math_Sins(this->actor.shape.rot.y);
|
||||
cs = Math_Coss(this->actor.shape.rot.y);
|
||||
sn = Math_SinS(this->actor.shape.rot.y);
|
||||
cs = Math_CosS(this->actor.shape.rot.y);
|
||||
this->collider.dim.pos.x = this->actor.posRot.pos.x + (projPos.x * cs) + (projPos.z * sn);
|
||||
this->collider.dim.pos.z = this->actor.posRot.pos.z - (projPos.x * sn) + (projPos.z * cs);
|
||||
this->collider.dim.pos.y = this->actor.posRot.pos.y;
|
||||
|
||||
@@ -97,8 +97,8 @@ void BgHidanKousi_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void func_80889ACC(BgHidanKousi* this) {
|
||||
s32 pad[2];
|
||||
Vec3s* rot = &this->dyna.actor.posRot.rot;
|
||||
f32 temp1 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_Sins(rot->y);
|
||||
f32 temp2 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_Coss(rot->y);
|
||||
f32 temp1 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_SinS(rot->y);
|
||||
f32 temp2 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_CosS(rot->y);
|
||||
Vec3f* initPos = &this->dyna.actor.initPosRot.pos;
|
||||
|
||||
this->dyna.actor.posRot.pos.x = initPos->x + temp1;
|
||||
|
||||
@@ -113,8 +113,8 @@ void BgHidanRsekizou_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
this->dyna.actor.shape.rot.y += 0x180; // Approximately 2 Degrees per Frame
|
||||
yawSine = Math_Sins(this->dyna.actor.shape.rot.y);
|
||||
yawCosine = Math_Coss(this->dyna.actor.shape.rot.y);
|
||||
yawSine = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
yawCosine = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->colliderItems); i++) {
|
||||
sphere = &this->collider.list[i];
|
||||
@@ -149,11 +149,11 @@ Gfx* BgHidanRsekizou_DrawFireball(GlobalContext* globalCtx, BgHidanRsekizou* thi
|
||||
gDPSetEnvColor(displayList++, 255, 0, 0, 255);
|
||||
|
||||
if (a == 0) {
|
||||
sins = -Math_Sins(this->dyna.actor.shape.rot.y - (frame * 1500));
|
||||
coss = -Math_Coss(this->dyna.actor.shape.rot.y - (frame * 1500));
|
||||
sins = -Math_SinS(this->dyna.actor.shape.rot.y - (frame * 1500));
|
||||
coss = -Math_CosS(this->dyna.actor.shape.rot.y - (frame * 1500));
|
||||
} else {
|
||||
sins = Math_Sins(this->dyna.actor.shape.rot.y - (frame * 1500));
|
||||
coss = Math_Coss(this->dyna.actor.shape.rot.y - (frame * 1500));
|
||||
sins = Math_SinS(this->dyna.actor.shape.rot.y - (frame * 1500));
|
||||
coss = Math_CosS(this->dyna.actor.shape.rot.y - (frame * 1500));
|
||||
}
|
||||
|
||||
mf->xx = mf->yy = mf->zz = (0.7f * fVar6) + 0.5f;
|
||||
|
||||
@@ -41,13 +41,13 @@ static InitChainEntry sInitChain[] = {
|
||||
void func_80891AC0(BgIceShutter* this) {
|
||||
f32 sp24;
|
||||
|
||||
sp24 = Math_Sins(this->dyna.actor.shape.rot.x) * this->dyna.actor.velocity.y;
|
||||
sp24 = Math_SinS(this->dyna.actor.shape.rot.x) * this->dyna.actor.velocity.y;
|
||||
this->dyna.actor.posRot.pos.y =
|
||||
(Math_Coss(this->dyna.actor.shape.rot.x) * this->dyna.actor.velocity.y) + this->dyna.actor.initPosRot.pos.y;
|
||||
(Math_CosS(this->dyna.actor.shape.rot.x) * this->dyna.actor.velocity.y) + this->dyna.actor.initPosRot.pos.y;
|
||||
this->dyna.actor.posRot.pos.x =
|
||||
(Math_Sins(this->dyna.actor.shape.rot.y) * sp24) + this->dyna.actor.initPosRot.pos.x;
|
||||
(Math_SinS(this->dyna.actor.shape.rot.y) * sp24) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z =
|
||||
(Math_Coss(this->dyna.actor.shape.rot.y) * sp24) + this->dyna.actor.initPosRot.pos.z;
|
||||
(Math_CosS(this->dyna.actor.shape.rot.y) * sp24) + this->dyna.actor.initPosRot.pos.z;
|
||||
}
|
||||
|
||||
void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
@@ -84,12 +84,12 @@ void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (sp28 == 2) {
|
||||
temp_f6 = Math_Sins(this->dyna.actor.shape.rot.x) * 50.0f;
|
||||
temp_f6 = Math_SinS(this->dyna.actor.shape.rot.x) * 50.0f;
|
||||
this->dyna.actor.posRot2.pos.x =
|
||||
(Math_Sins(this->dyna.actor.shape.rot.y) * temp_f6) + this->dyna.actor.initPosRot.pos.x;
|
||||
(Math_SinS(this->dyna.actor.shape.rot.y) * temp_f6) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot2.pos.y = this->dyna.actor.initPosRot.pos.y;
|
||||
this->dyna.actor.posRot2.pos.z =
|
||||
this->dyna.actor.initPosRot.pos.z + (Math_Coss(this->dyna.actor.shape.rot.y) * temp_f6);
|
||||
this->dyna.actor.initPosRot.pos.z + (Math_CosS(this->dyna.actor.shape.rot.y) * temp_f6);
|
||||
} else {
|
||||
Actor_SetHeight(&this->dyna.actor, 50.0f);
|
||||
}
|
||||
@@ -120,8 +120,8 @@ void func_80891D6C(BgIceShutter* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_80891DD4(BgIceShutter* this, GlobalContext* globalCtx) {
|
||||
Math_ApproxF(&this->dyna.actor.speedXZ, 30.0f, 2.0f);
|
||||
if (Math_ApproxF(&this->dyna.actor.velocity.y, 210.0f, this->dyna.actor.speedXZ)) {
|
||||
Math_StepToF(&this->dyna.actor.speedXZ, 30.0f, 2.0f);
|
||||
if (Math_StepToF(&this->dyna.actor.velocity.y, 210.0f, this->dyna.actor.speedXZ)) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -90,16 +90,16 @@ void BgIceTurara_Break(BgIceTurara* this, GlobalContext* globalCtx, f32 arg2) {
|
||||
Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.posRot.pos, 30, NA_SE_EV_ICE_BROKEN);
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 10; j++) {
|
||||
pos.x = this->dyna.actor.posRot.pos.x + Math_Rand_CenteredFloat(8.0f);
|
||||
pos.y = this->dyna.actor.posRot.pos.y + (Math_Rand_ZeroOne() * arg2) + (i * arg2);
|
||||
pos.z = this->dyna.actor.posRot.pos.z + Math_Rand_CenteredFloat(8.0f);
|
||||
pos.x = this->dyna.actor.posRot.pos.x + Rand_CenteredFloat(8.0f);
|
||||
pos.y = this->dyna.actor.posRot.pos.y + (Rand_ZeroOne() * arg2) + (i * arg2);
|
||||
pos.z = this->dyna.actor.posRot.pos.z + Rand_CenteredFloat(8.0f);
|
||||
|
||||
vel.x = Math_Rand_CenteredFloat(7.0f);
|
||||
vel.z = Math_Rand_CenteredFloat(7.0f);
|
||||
vel.y = (Math_Rand_ZeroOne() * 4.0f) + 8.0f;
|
||||
vel.x = Rand_CenteredFloat(7.0f);
|
||||
vel.z = Rand_CenteredFloat(7.0f);
|
||||
vel.y = (Rand_ZeroOne() * 4.0f) + 8.0f;
|
||||
|
||||
EffectSsEnIce_Spawn(globalCtx, &pos, (Math_Rand_ZeroOne() * 0.2f) + 0.1f, &vel, &accel, &primColor,
|
||||
&envColor, 30);
|
||||
EffectSsEnIce_Spawn(globalCtx, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &vel, &accel, &primColor, &envColor,
|
||||
30);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,11 +139,11 @@ void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) {
|
||||
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
this->actionFunc = BgIceTurara_Fall;
|
||||
} else {
|
||||
sp28 = Math_Rand_ZeroOne();
|
||||
phi_v0_2 = (Math_Rand_ZeroOne() < 0.5f ? -1 : 1);
|
||||
sp28 = Rand_ZeroOne();
|
||||
phi_v0_2 = (Rand_ZeroOne() < 0.5f ? -1 : 1);
|
||||
this->dyna.actor.posRot.pos.x = (phi_v0_2 * ((0.5f * sp28) + 0.5f)) + this->dyna.actor.initPosRot.pos.x;
|
||||
sp28 = Math_Rand_ZeroOne();
|
||||
phi_v0_3 = (Math_Rand_ZeroOne() < 0.5f ? -1 : 1);
|
||||
sp28 = Rand_ZeroOne();
|
||||
phi_v0_3 = (Rand_ZeroOne() < 0.5f ? -1 : 1);
|
||||
this->dyna.actor.posRot.pos.z = (phi_v0_3 * ((0.5f * sp28) + 0.5f)) + this->dyna.actor.initPosRot.pos.z;
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgIceTurara_Regrow(BgIceTurara* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 1.0f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 1.0f)) {
|
||||
this->actionFunc = BgIceTurara_Wait;
|
||||
this->dyna.actor.velocity.y = 0.0f;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ void func_80892890(BgIngate* this, GlobalContext* globalCtx) {
|
||||
if (csFrames > 0x4000) {
|
||||
csFrames = 0x4000;
|
||||
}
|
||||
csFrames = (Math_Sins(csFrames) * 16384.0f);
|
||||
csFrames = (Math_SinS(csFrames) * 16384.0f);
|
||||
phi1 = csFrames;
|
||||
if ((this->dyna.actor.params & 2) == 0) {
|
||||
phi1 = -phi1;
|
||||
|
||||
@@ -142,13 +142,13 @@ void BgJya1flift_ChangeDirection(BgJya1flift* this) {
|
||||
void BgJya1flift_Move(BgJya1flift* this, GlobalContext* globalCtx) {
|
||||
f32 tempVelocity;
|
||||
|
||||
Math_ApproxF(&this->dyna.actor.velocity.y, 6.0f, 0.4f);
|
||||
Math_StepToF(&this->dyna.actor.velocity.y, 6.0f, 0.4f);
|
||||
if (this->dyna.actor.velocity.y < 1.0f) {
|
||||
tempVelocity = 1.0f;
|
||||
} else {
|
||||
tempVelocity = this->dyna.actor.velocity.y;
|
||||
}
|
||||
if (fabsf(Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.y, (sFinalPositions[this->isMovingDown]), 0.5f,
|
||||
if (fabsf(Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, (sFinalPositions[this->isMovingDown]), 0.5f,
|
||||
tempVelocity, 1.0f)) < 0.001f) {
|
||||
this->dyna.actor.posRot.pos.y = sFinalPositions[this->isMovingDown];
|
||||
BgJya1flift_ResetMoveDelay(this);
|
||||
|
||||
@@ -91,7 +91,7 @@ void func_80893428(BgJyaAmishutter* this) {
|
||||
}
|
||||
|
||||
void func_80893438(BgJyaAmishutter* this) {
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 100.0f, 3.0f)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 100.0f, 3.0f)) {
|
||||
func_808934B0(this);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_METALDOOR_STOP);
|
||||
} else {
|
||||
@@ -114,7 +114,7 @@ void func_808934FC(BgJyaAmishutter* this) {
|
||||
}
|
||||
|
||||
void func_8089350C(BgJyaAmishutter* this) {
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 3.0f)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 3.0f)) {
|
||||
func_808933BC(this);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_METALDOOR_STOP);
|
||||
} else {
|
||||
|
||||
@@ -97,19 +97,19 @@ void BgJyaBombchuiwa_Break(BgJyaBombchuiwa* this, GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
pos.x = Math_Rand_ZeroOne() * 10.0f + this->actor.posRot.pos.x - 10.0f;
|
||||
pos.y = Math_Rand_ZeroOne() * 40.0f + this->actor.posRot.pos.y - 20.0f;
|
||||
pos.z = Math_Rand_ZeroOne() * 50.0f + this->actor.posRot.pos.z - 25.0f;
|
||||
velocity.x = Math_Rand_ZeroOne() * 3.0f - 0.3f;
|
||||
velocity.y = Math_Rand_ZeroOne() * 18.0f;
|
||||
velocity.z = (Math_Rand_ZeroOne() - 0.5f) * 15.0f;
|
||||
scale = (s32)(Math_Rand_ZeroOne() * 20.0f) + 1;
|
||||
pos.x = Rand_ZeroOne() * 10.0f + this->actor.posRot.pos.x - 10.0f;
|
||||
pos.y = Rand_ZeroOne() * 40.0f + this->actor.posRot.pos.y - 20.0f;
|
||||
pos.z = Rand_ZeroOne() * 50.0f + this->actor.posRot.pos.z - 25.0f;
|
||||
velocity.x = Rand_ZeroOne() * 3.0f - 0.3f;
|
||||
velocity.y = Rand_ZeroOne() * 18.0f;
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * 15.0f;
|
||||
scale = (s32)(Rand_ZeroOne() * 20.0f) + 1;
|
||||
if (scale > 10) {
|
||||
arg5 = 5;
|
||||
} else {
|
||||
arg5 = 1;
|
||||
}
|
||||
if (Math_Rand_ZeroOne() < 0.4f) {
|
||||
if (Rand_ZeroOne() < 0.4f) {
|
||||
arg5 |= 0x40;
|
||||
arg6 = 0xC;
|
||||
arg7 = 8;
|
||||
@@ -164,7 +164,7 @@ void func_808949B8(BgJyaBombchuiwa* this, GlobalContext* globalCtx) {
|
||||
if (this->timer & 4) {
|
||||
func_80033480(globalCtx, &this->actor.posRot.pos, 60.0f, 3, 100, 100, 0);
|
||||
}
|
||||
if (Math_ApproxF(&this->lightRayIntensity, 1.0f, 0.028)) {
|
||||
if (Math_StepToF(&this->lightRayIntensity, 1.0f, 0.028)) {
|
||||
BgJyaBombchuiwa_SpawnLightRay(this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,19 +107,19 @@ void BgJyaBombiwa_Break(BgJyaBombiwa* this, GlobalContext* globalCtx) {
|
||||
s16 scale;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
pos.x = ((Math_Rand_ZeroOne() * 80.0f) + this->dyna.actor.posRot.pos.x) - 40.0f;
|
||||
pos.y = (Math_Rand_ZeroOne() * 140.0f) + this->dyna.actor.posRot.pos.y;
|
||||
pos.z = ((Math_Rand_ZeroOne() * 80.0f) + this->dyna.actor.posRot.pos.z) - 40.0f;
|
||||
velocity.x = (Math_Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
velocity.y = Math_Rand_ZeroOne() * 12.0f;
|
||||
velocity.z = (Math_Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
pos.x = ((Rand_ZeroOne() * 80.0f) + this->dyna.actor.posRot.pos.x) - 40.0f;
|
||||
pos.y = (Rand_ZeroOne() * 140.0f) + this->dyna.actor.posRot.pos.y;
|
||||
pos.z = ((Rand_ZeroOne() * 80.0f) + this->dyna.actor.posRot.pos.z) - 40.0f;
|
||||
velocity.x = (Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
velocity.y = Rand_ZeroOne() * 12.0f;
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * 10.0f;
|
||||
scale = (s32)(i * 1.8f) + 3;
|
||||
if (scale > 15) {
|
||||
arg5 = 5;
|
||||
} else {
|
||||
arg5 = 1;
|
||||
}
|
||||
if (Math_Rand_ZeroOne() < 0.4f) {
|
||||
if (Rand_ZeroOne() < 0.4f) {
|
||||
arg5 |= 0x40;
|
||||
arg6 = 0xC;
|
||||
arg7 = 8;
|
||||
|
||||
@@ -122,9 +122,9 @@ void func_80897B48(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
thisx->speedXZ = (sqrtf(tmpf1) * this->unk_1B0);
|
||||
thisx->velocity.x = (Math_Sins(thisx->posRot.rot.y) * thisx->speedXZ);
|
||||
thisx->velocity.x = (Math_SinS(thisx->posRot.rot.y) * thisx->speedXZ);
|
||||
|
||||
tmpf2 = Math_Coss(thisx->posRot.rot.y) * thisx->speedXZ;
|
||||
tmpf2 = Math_CosS(thisx->posRot.rot.y) * thisx->speedXZ;
|
||||
thisx->velocity.z = tmpf2;
|
||||
thisx->posRot.pos.x = thisx->posRot.pos.x + thisx->velocity.x;
|
||||
thisx->posRot.pos.z = thisx->posRot.pos.z + tmpf2;
|
||||
@@ -161,7 +161,7 @@ void func_80897B48(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
||||
func_80897DDC(this);
|
||||
}
|
||||
} else {
|
||||
Math_ApproxF(&this->unk_1B0, 1.0f, 0.04f);
|
||||
Math_StepToF(&this->unk_1B0, 1.0f, 0.04f);
|
||||
}
|
||||
|
||||
if (thisx->posRot.pos.x > 1745.0f) {
|
||||
|
||||
@@ -79,12 +79,12 @@ void BgJyaHaheniron_SpawnFragments(GlobalContext* globalCtx, Vec3f* vec1, Vec3f*
|
||||
f32 rand1;
|
||||
|
||||
for (angle = 0, i = 0; i < ARRAY_COUNT(sKakeraScales); i++) {
|
||||
rand1 = Math_Rand_ZeroOne() * 10.0f;
|
||||
vel.x = (Math_Sins(angle) * rand1) + vec2->x;
|
||||
vel.y = (Math_Rand_ZeroOne() * 10.0f) + vec2->y;
|
||||
vel.z = (Math_Coss(angle) * rand1) + vec2->z;
|
||||
rand1 = Rand_ZeroOne() * 10.0f;
|
||||
vel.x = (Math_SinS(angle) * rand1) + vec2->x;
|
||||
vel.y = (Rand_ZeroOne() * 10.0f) + vec2->y;
|
||||
vel.z = (Math_CosS(angle) * rand1) + vec2->z;
|
||||
|
||||
rand1 = Math_Rand_ZeroOne();
|
||||
rand1 = Rand_ZeroOne();
|
||||
if (rand1 < 0.2f) {
|
||||
arg5 = 96;
|
||||
} else if (rand1 < 0.8f) {
|
||||
@@ -109,7 +109,7 @@ void BgJyaHaheniron_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Actor_SetScale(&this->actor, D_80898794[this->actor.params]);
|
||||
if (thisx->params == 0) {
|
||||
BgJyaHaheniron_ColliderInit(this, globalCtx);
|
||||
thisx->shape.rot.z = (Math_Rand_ZeroOne() * 65535.0f);
|
||||
thisx->shape.rot.z = (Rand_ZeroOne() * 65535.0f);
|
||||
BgJyaHaheniron_SetupChairCrumble(this);
|
||||
} else if (thisx->params == 1) {
|
||||
BgJyaHaheniron_SetupPillarCrumble(this);
|
||||
@@ -135,9 +135,9 @@ void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx)
|
||||
func_8002E4B4(globalCtx, &this->actor, 5.0f, 8.0f, 0.0f, 0x85);
|
||||
if ((this->actor.bgCheckFlags & 9) ||
|
||||
((this->collider.base.atFlags & 2) && (this->collider.base.at) && (this->collider.base.at->type == 2))) {
|
||||
vec.x = -Math_Rand_ZeroOne() * this->actor.velocity.x;
|
||||
vec.y = -Math_Rand_ZeroOne() * this->actor.velocity.y;
|
||||
vec.z = -Math_Rand_ZeroOne() * this->actor.velocity.z;
|
||||
vec.x = -Rand_ZeroOne() * this->actor.velocity.x;
|
||||
vec.y = -Rand_ZeroOne() * this->actor.velocity.y;
|
||||
vec.z = -Rand_ZeroOne() * this->actor.velocity.z;
|
||||
BgJyaHaheniron_SpawnFragments(globalCtx, &this->actor.posRot, &vec);
|
||||
Actor_Kill(&this->actor);
|
||||
} else if (this->timer >= 61) {
|
||||
|
||||
@@ -102,7 +102,7 @@ void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) {
|
||||
s32 pad[2];
|
||||
s32 var;
|
||||
this->unk_168 += 0x20;
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.x, 0x4000, this->unk_168)) {
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.x, 0x4000, this->unk_168)) {
|
||||
func_80899A08(this);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_TRAP_BOUND);
|
||||
var = Quake_Add(ACTIVE_CAM, 3);
|
||||
|
||||
@@ -114,9 +114,9 @@ void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx) {
|
||||
f32 distFromBottom;
|
||||
f32 tempVelocity;
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.velocity.y, 4.0f, 0.1f, 1.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.velocity.y, 4.0f, 0.1f, 1.0f, 0.0f);
|
||||
tempVelocity = (this->dyna.actor.velocity.y < 0.2f) ? 0.2f : this->dyna.actor.velocity.y;
|
||||
distFromBottom = Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.y, 973.0f, 0.1f, tempVelocity, 0.2f);
|
||||
distFromBottom = Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, 973.0f, 0.1f, tempVelocity, 0.2f);
|
||||
if ((this->dyna.actor.posRot.pos.y < 1440.0f) && (1440.0f <= this->dyna.actor.pos4.y)) {
|
||||
func_8005B1A4(ACTIVE_CAM);
|
||||
}
|
||||
|
||||
@@ -132,11 +132,11 @@ void func_8089A1DC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, s32 nu
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
s32 idx = ((s16)(Math_Rand_ZeroOne() * 8.0f)) & D_8089B17C[arg4];
|
||||
s16 arg5 = ((idx < 5) && (Math_Rand_ZeroOne() < 0.7f)) ? 0x40 : 0x20;
|
||||
s32 idx = ((s16)(Rand_ZeroOne() * 8.0f)) & D_8089B17C[arg4];
|
||||
s16 arg5 = ((idx < 5) && (Rand_ZeroOne() < 0.7f)) ? 0x40 : 0x20;
|
||||
EffectSsKakera_Spawn(globalCtx, pos, velocity, pos, -90, arg5, D_8089B16C[idx], 4, 0, D_8089B14C[idx], 0, 5,
|
||||
D_8089B15C[idx], KAKERA_COLOR_NONE, OBJECT_JYA_OBJ, D_0600B9F8);
|
||||
if (Math_Rand_ZeroOne() < 0.45f) {
|
||||
if (Rand_ZeroOne() < 0.45f) {
|
||||
Math_Vec3f_Copy(&spB4, pos);
|
||||
spB4.z += 25.0f;
|
||||
func_80033480(globalCtx, &spB4, 60.0f, 0, D_8089B14C[idx] * 4 + 50, D_8089B14C[idx] * 4 + 70, 1);
|
||||
@@ -149,7 +149,7 @@ void func_8089A41C(BgJyaMegami* this, GlobalContext* globalCtx, f32 arg2) {
|
||||
Vec3f sp50;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->pieces); i++) {
|
||||
if (Math_Rand_ZeroOne() < arg2) {
|
||||
if (Rand_ZeroOne() < arg2) {
|
||||
Math_Vec3f_Sum(&this->dyna.actor.posRot.pos, &sPiecesInit[i].unk_00, &sp50);
|
||||
sp50.z += 15.0f;
|
||||
func_8089A1DC(globalCtx, &sp50, &D_8089B184, 1, 0);
|
||||
@@ -252,7 +252,7 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) {
|
||||
temp->pos.y += temp->vel.y;
|
||||
temp->rotVelX += temp2->rotVelX;
|
||||
temp->rotVelY += temp2->rotVelY;
|
||||
if (Math_Rand_ZeroOne() < 0.067f) {
|
||||
if (Rand_ZeroOne() < 0.067f) {
|
||||
Math_Vec3f_Sum(&temp->pos, &temp2->unk_00, &sp8C);
|
||||
sp8C.z += 10.0f;
|
||||
func_8089A1DC(globalCtx, &sp8C, &temp->vel, 3, 2);
|
||||
@@ -266,9 +266,9 @@ void BgJyaMegami_Explode(BgJyaMegami* this, GlobalContext* globalCtx) {
|
||||
|
||||
if ((this->explosionTimer % 4 == 0) && (this->explosionTimer > 30) && (this->explosionTimer < 80) &&
|
||||
(this->explosionTimer > 40)) {
|
||||
sp8C.x = ((Math_Rand_ZeroOne() - 0.5f) * 90.0f) + this->dyna.actor.posRot.pos.x;
|
||||
sp8C.y = (this->dyna.actor.posRot.pos.y - (Math_Rand_ZeroOne() * 80.0f)) - 20.0f;
|
||||
sp8C.z = this->dyna.actor.posRot.pos.z - ((Math_Rand_ZeroOne() - 0.5f) * 50.0f);
|
||||
sp8C.x = ((Rand_ZeroOne() - 0.5f) * 90.0f) + this->dyna.actor.posRot.pos.x;
|
||||
sp8C.y = (this->dyna.actor.posRot.pos.y - (Rand_ZeroOne() * 80.0f)) - 20.0f;
|
||||
sp8C.z = this->dyna.actor.posRot.pos.z - ((Rand_ZeroOne() - 0.5f) * 50.0f);
|
||||
func_8089A1DC(globalCtx, &sp8C, &sVec, 1, 0);
|
||||
}
|
||||
if (this->explosionTimer < ARRAY_COUNT(this->pieces)) {
|
||||
|
||||
@@ -166,7 +166,7 @@ void func_8089B80C(BgJyaZurerukabe* this) {
|
||||
}
|
||||
|
||||
void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x + (this->unk_16C * 75),
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x + (this->unk_16C * 75),
|
||||
D_8089BA08[this->unk_168])) {
|
||||
func_8089B7B4(this);
|
||||
}
|
||||
|
||||
@@ -106,19 +106,19 @@ void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, GlobalContext* globalCtx
|
||||
|
||||
void BgMizuShutter_Move(BgMizuShutter* this, GlobalContext* globalCtx) {
|
||||
if (Flags_GetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F)) {
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.x, this->openPos.x, 1.0f, 4.0f, 0.1f);
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.y, this->openPos.y, 1.0f, 4.0f, 0.1f);
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.z, this->openPos.z, 1.0f, 4.0f, 0.1f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.posRot.pos.x, this->openPos.x, 1.0f, 4.0f, 0.1f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->openPos.y, 1.0f, 4.0f, 0.1f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.posRot.pos.z, this->openPos.z, 1.0f, 4.0f, 0.1f);
|
||||
if ((this->dyna.actor.posRot.pos.x == this->openPos.x) && (this->dyna.actor.posRot.pos.y == this->openPos.y) &&
|
||||
(this->dyna.actor.posRot.pos.z == this->openPos.z)) {
|
||||
this->timer = this->timerMax;
|
||||
this->actionFunc = BgMizuShutter_WaitForTimer;
|
||||
}
|
||||
} else {
|
||||
Math_SmoothScaleMaxMinF(&this->maxSpeed, 20.0f, 1.0f, 3.0f, 0.1f);
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.x, this->closedPos.x, 1.0f, this->maxSpeed, 0.1f);
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.y, this->closedPos.y, 1.0f, this->maxSpeed, 0.1f);
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.z, this->closedPos.z, 1.0f, this->maxSpeed, 0.1f);
|
||||
Math_SmoothStepToF(&this->maxSpeed, 20.0f, 1.0f, 3.0f, 0.1f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.posRot.pos.x, this->closedPos.x, 1.0f, this->maxSpeed, 0.1f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->closedPos.y, 1.0f, this->maxSpeed, 0.1f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.posRot.pos.z, this->closedPos.z, 1.0f, this->maxSpeed, 0.1f);
|
||||
if ((this->dyna.actor.posRot.pos.x == this->closedPos.x) &&
|
||||
(this->dyna.actor.posRot.pos.y == this->closedPos.y) &&
|
||||
(this->dyna.actor.posRot.pos.z == this->closedPos.z)) {
|
||||
|
||||
@@ -236,7 +236,7 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) {
|
||||
Flags_UnsetSwitch(globalCtx, prevSwitchFlag);
|
||||
}
|
||||
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->targetY, 5.0f)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->targetY, 5.0f)) {
|
||||
globalCtx->unk_11D30[0] = 0;
|
||||
this->actionFunc = BgMizuWater_WaitForAction;
|
||||
func_80106CCC(globalCtx);
|
||||
@@ -251,7 +251,7 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
this->targetY = this->baseY;
|
||||
}
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->targetY, 1.0f)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->targetY, 1.0f)) {
|
||||
globalCtx->unk_11D30[0] = 0;
|
||||
this->actionFunc = BgMizuWater_WaitForAction;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
this->targetY = this->baseY;
|
||||
}
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->targetY, 1.0f)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->targetY, 1.0f)) {
|
||||
globalCtx->unk_11D30[0] = 0;
|
||||
this->actionFunc = BgMizuWater_WaitForAction;
|
||||
}
|
||||
@@ -275,7 +275,7 @@ void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
this->targetY = this->baseY;
|
||||
}
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, this->targetY, 1.0f)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, this->targetY, 1.0f)) {
|
||||
globalCtx->unk_11D30[0] = 0;
|
||||
this->actionFunc = BgMizuWater_WaitForAction;
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@ s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, GlobalContext* globalCtx) {
|
||||
Vec3f pos;
|
||||
Actor* ladder;
|
||||
|
||||
cs = Math_Coss(this->dyna.actor.shape.rot.y);
|
||||
sn = Math_Sins(this->dyna.actor.shape.rot.y);
|
||||
cs = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
sn = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
pos.x = 6.0f * sn + this->dyna.actor.posRot.pos.x;
|
||||
pos.y = -210.0f + this->dyna.actor.posRot.pos.y;
|
||||
|
||||
@@ -147,7 +147,7 @@ void BgMoriHashira4_GateWait(BgMoriHashira4* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgMoriHashira4_GateOpen(BgMoriHashira4* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 120.0f, 10.0f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 120.0f, 10.0f)) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx) {
|
||||
this->drainTimer--;
|
||||
if ((roomNum == 7) || (roomNum == 8) || (roomNum == 9)) {
|
||||
if (this->drainTimer < 70) {
|
||||
Math_ApproxF(&thisx->posRot.pos.y, this->targetWaterLevel, 3.5f);
|
||||
Math_StepToF(&thisx->posRot.pos.y, this->targetWaterLevel, 3.5f);
|
||||
BgMoriIdomizu_SetWaterLevel(globalCtx, thisx->posRot.pos.y);
|
||||
if (this->drainTimer > 0) {
|
||||
if (switchFlagSet) {
|
||||
|
||||
@@ -102,9 +102,9 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx) {
|
||||
BgMoriKaitenkabe_SetupRotate(this);
|
||||
func_8002DF54(globalCtx, &this->dyna.actor, 8);
|
||||
Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.posRot.pos);
|
||||
push.x = Math_Sins(this->dyna.unk_158);
|
||||
push.x = Math_SinS(this->dyna.unk_158);
|
||||
push.y = 0.0f;
|
||||
push.z = Math_Coss(this->dyna.unk_158);
|
||||
push.z = Math_CosS(this->dyna.unk_158);
|
||||
leverArm.x = this->dyna.actor.posRot.pos.x - player->actor.posRot.pos.x;
|
||||
leverArm.y = 0.0f;
|
||||
leverArm.z = this->dyna.actor.posRot.pos.z - player->actor.posRot.pos.z;
|
||||
@@ -131,8 +131,8 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, GlobalContext* globalCtx) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
s16 rotY;
|
||||
|
||||
Math_ApproxF(&this->rotSpeed, 0.6f, 0.02f);
|
||||
if (Math_ApproxF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) {
|
||||
Math_StepToF(&this->rotSpeed, 0.6f, 0.02f);
|
||||
if (Math_StepToF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) {
|
||||
BgMoriKaitenkabe_SetupWait(this);
|
||||
func_8002DF54(globalCtx, thisx, 7);
|
||||
if (this->rotDirection > 0.0f) {
|
||||
|
||||
@@ -193,7 +193,7 @@ void BgMoriRakkatenjo_SetupRise(BgMoriRakkatenjo* this) {
|
||||
}
|
||||
|
||||
void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, GlobalContext* globalCtx) {
|
||||
Math_SmoothScaleMaxMinF(&this->dyna.actor.velocity.y, 5.0f, 0.06f, 0.1f, 0.0f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.velocity.y, 5.0f, 0.06f, 0.1f, 0.0f);
|
||||
this->dyna.actor.posRot.pos.y += this->dyna.actor.velocity.y;
|
||||
if (this->dyna.actor.posRot.pos.y >= 683.0f) {
|
||||
BgMoriRakkatenjo_SetupWait(this);
|
||||
|
||||
@@ -86,8 +86,8 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
s32 phi_t2;
|
||||
Actor* newPainting;
|
||||
|
||||
sins = Math_Sins(this->dyna.actor.shape.rot.y);
|
||||
coss = Math_Coss(this->dyna.actor.shape.rot.y);
|
||||
sins = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
coss = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
if (this->type == 4) {
|
||||
sins *= 2.4f;
|
||||
scaleY = 1.818f;
|
||||
@@ -130,7 +130,7 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
sPuzzleState = 0;
|
||||
this->actionFunc = BgPoEvent_AmyWait;
|
||||
} else {
|
||||
sPuzzleState = (s32)(Math_Rand_ZeroOne() * 3.0f) % 3;
|
||||
sPuzzleState = (s32)(Rand_ZeroOne() * 3.0f) % 3;
|
||||
this->actionFunc = BgPoEvent_PaintingEmpty;
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
static s32 firstFall = 0;
|
||||
|
||||
this->dyna.actor.velocity.y++;
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, 433.0f, this->dyna.actor.velocity.y)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, 433.0f, this->dyna.actor.velocity.y)) {
|
||||
this->dyna.actor.flags &= ~0x20;
|
||||
this->dyna.actor.velocity.y = 0.0f;
|
||||
sBlocksAtRest++;
|
||||
@@ -376,10 +376,10 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
|
||||
this->dyna.actor.speedXZ += 0.1f;
|
||||
this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f);
|
||||
blockStop = Math_ApproxF(&blockPushDist, 20.0f, this->dyna.actor.speedXZ);
|
||||
blockStop = Math_StepToF(&blockPushDist, 20.0f, this->dyna.actor.speedXZ);
|
||||
displacement = this->direction * blockPushDist;
|
||||
this->dyna.actor.posRot.pos.x = (Math_Sins(this->dyna.unk_158) * displacement) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z = (Math_Coss(this->dyna.unk_158) * displacement) + this->dyna.actor.initPosRot.pos.z;
|
||||
this->dyna.actor.posRot.pos.x = (Math_SinS(this->dyna.unk_158) * displacement) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z = (Math_CosS(this->dyna.unk_158) * displacement) + this->dyna.actor.initPosRot.pos.z;
|
||||
if (blockStop) {
|
||||
player->stateFlags2 &= ~0x10;
|
||||
if ((this->dyna.unk_150 > 0.0f) && (func_800435D8(globalCtx, &this->dyna, 0x1E, 0x32, -0x14) == 0)) {
|
||||
@@ -409,8 +409,8 @@ void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
player->stateFlags2 &= ~0x10;
|
||||
this->dyna.unk_150 = 0.0f;
|
||||
}
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, 493.0f, 1.0f) &&
|
||||
Math_ApproxUpdateScaledS(&this->dyna.actor.shape.rot.z, this->dyna.actor.posRot.rot.z - 0x4000, 0x400)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, 493.0f, 1.0f) &&
|
||||
Math_ScaledStepToS(&this->dyna.actor.shape.rot.z, this->dyna.actor.posRot.rot.z - 0x4000, 0x400)) {
|
||||
|
||||
this->index = (this->index + 1) % 4;
|
||||
this->actionFunc = BgPoEvent_BlockFall;
|
||||
@@ -428,7 +428,7 @@ void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
if (this->dyna.unk_150 != 0.0f) {
|
||||
player->stateFlags2 &= ~0x10;
|
||||
}
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, 369.0f, 2.0f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, 369.0f, 2.0f)) {
|
||||
sPuzzleState = 0x20;
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
}
|
||||
@@ -449,8 +449,8 @@ void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (sPuzzleState == 0xF) {
|
||||
pos.x = this->dyna.actor.posRot.pos.x - 5.0f;
|
||||
pos.y = Math_Rand_CenteredFloat(120.0f) + this->dyna.actor.posRot.pos.y;
|
||||
pos.z = Math_Rand_CenteredFloat(120.0f) + this->dyna.actor.posRot.pos.z;
|
||||
pos.y = Rand_CenteredFloat(120.0f) + this->dyna.actor.posRot.pos.y;
|
||||
pos.z = Rand_CenteredFloat(120.0f) + this->dyna.actor.posRot.pos.z;
|
||||
EffectSsDeadDb_Spawn(globalCtx, &pos, &sZeroVec, &sZeroVec, 170, 0, 200, 255, 100, 170, 0, 255, 0, 1, 9, true);
|
||||
} else if (sPuzzleState == 0x20) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
@@ -461,7 +461,7 @@ void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
|
||||
s32 BgPoEvent_NextPainting(BgPoEvent* this) {
|
||||
if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.child != NULL)) {
|
||||
if (Math_Rand_ZeroOne() < 0.5f) {
|
||||
if (Rand_ZeroOne() < 0.5f) {
|
||||
sPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index;
|
||||
} else {
|
||||
sPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index;
|
||||
@@ -548,9 +548,9 @@ void BgPoEvent_PaintingBurn(BgPoEvent* this, GlobalContext* globalCtx) {
|
||||
Vec3f sp54;
|
||||
|
||||
this->timer--;
|
||||
sp54.x = (Math_Sins(this->dyna.actor.shape.rot.y) * 5.0f) + this->dyna.actor.posRot.pos.x;
|
||||
sp54.y = Math_Rand_CenteredFloat(66.0f) + this->dyna.actor.posRot.pos.y;
|
||||
sp54.z = Math_Rand_CenteredFloat(50.0f) + this->dyna.actor.posRot.pos.z;
|
||||
sp54.x = (Math_SinS(this->dyna.actor.shape.rot.y) * 5.0f) + this->dyna.actor.posRot.pos.x;
|
||||
sp54.y = Rand_CenteredFloat(66.0f) + this->dyna.actor.posRot.pos.y;
|
||||
sp54.z = Rand_CenteredFloat(50.0f) + this->dyna.actor.posRot.pos.z;
|
||||
if (this->timer >= 0) {
|
||||
if (this->type == 2) {
|
||||
EffectSsDeadDb_Spawn(globalCtx, &sp54, &sZeroVec, &sZeroVec, 100, 0, 255, 255, 150, 170, 255, 0, 0, 1, 9,
|
||||
|
||||
@@ -105,7 +105,7 @@ void BgPoSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
this->flameTextureScroll = (s16)(Math_Rand_ZeroOne() * 20.0f);
|
||||
this->flameTextureScroll = (s16)(Rand_ZeroOne() * 20.0f);
|
||||
}
|
||||
|
||||
void BgPoSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
@@ -149,7 +149,7 @@ void BgPoSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Color_RGBA8* primColor = &sPrimColors[this->flameColor];
|
||||
Color_RGBA8* envColor = &sEnvColors[this->flameColor];
|
||||
|
||||
lightBrightness = (0.3f * Math_Rand_ZeroOne()) + 0.7f;
|
||||
lightBrightness = (0.3f * Rand_ZeroOne()) + 0.7f;
|
||||
|
||||
red = (u8)(primColor->r * lightBrightness);
|
||||
green = (u8)(primColor->g * lightBrightness);
|
||||
|
||||
@@ -65,7 +65,7 @@ void func_808A8BAC(BgPushbox* this, GlobalContext* globalCtx) {
|
||||
|
||||
thisx->speedXZ += this->dyna.unk_150 * 0.2f;
|
||||
thisx->speedXZ = (thisx->speedXZ < -1.0f) ? -1.0f : ((thisx->speedXZ > 1.0f) ? 1.0f : thisx->speedXZ);
|
||||
Math_ApproxF(&thisx->speedXZ, 0.0f, 0.2f);
|
||||
Math_StepToF(&thisx->speedXZ, 0.0f, 0.2f);
|
||||
thisx->posRot.rot.y = this->dyna.unk_158;
|
||||
Actor_MoveForward(thisx);
|
||||
func_8002E4B4(globalCtx, thisx, 20.0f, 40.0f, 40.0f, 0x1D);
|
||||
|
||||
@@ -129,7 +129,7 @@ void func_808A90F4(BgRelayObjects* this, GlobalContext* globalCtx) {
|
||||
this->timer = 160;
|
||||
}
|
||||
}
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 120.0f, 12.0f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 120.0f, 12.0f)) {
|
||||
this->actionFunc = func_808A91AC;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ void func_808A91AC(BgRelayObjects* this, GlobalContext* globalCtx) {
|
||||
|
||||
void func_808A9234(BgRelayObjects* this, GlobalContext* globalCtx) {
|
||||
this->dyna.actor.velocity.y += this->dyna.actor.gravity;
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.velocity.y)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.velocity.y)) {
|
||||
func_800AA000(this->dyna.actor.xyzDistFromLinkSq, 180, 20, 100);
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
|
||||
if (this->unk_169 != globalCtx->roomCtx.curRoom.num) {
|
||||
@@ -189,9 +189,9 @@ void func_808A939C(BgRelayObjects* this, GlobalContext* globalCtx) {
|
||||
gSaveContext.eventChkInf[6] |= 0x20;
|
||||
}
|
||||
if (gSaveContext.eventChkInf[6] & 0x20) {
|
||||
Math_ApproxUpdateScaledS(&this->dyna.actor.posRot.rot.y, 0x400, 8);
|
||||
Math_ScaledStepToS(&this->dyna.actor.posRot.rot.y, 0x400, 8);
|
||||
} else {
|
||||
Math_ApproxUpdateScaledS(&this->dyna.actor.posRot.rot.y, 0x80, 8);
|
||||
Math_ScaledStepToS(&this->dyna.actor.posRot.rot.y, 0x80, 8);
|
||||
}
|
||||
this->dyna.actor.shape.rot.y += this->dyna.actor.posRot.rot.y;
|
||||
func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WOOD_GEAR - SFX_FLAG,
|
||||
|
||||
@@ -68,7 +68,7 @@ void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) {
|
||||
thisx->shape.rot.z += this->unk_154;
|
||||
temp = ((this->unk_154 - 100.0f) / 1700.0f) + 1.0f;
|
||||
func_800F436C(&thisx->projectedPos, 0x2085, temp);
|
||||
Math_SmoothScaleMaxF(&this->unk_154, this->unk_158, this->unk_15C, 100.0f);
|
||||
Math_ApproachF(&this->unk_154, this->unk_158, this->unk_15C, 100.0f);
|
||||
}
|
||||
|
||||
void BgSpot01Fusya_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
@@ -60,7 +60,7 @@ void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx) {
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
}
|
||||
Math_SmoothScaleMaxF(&this->actor.posRot.pos.y, this->waterHeight, 1.0f, 2.0f);
|
||||
Math_ApproachF(&this->actor.posRot.pos.y, this->waterHeight, 1.0f, 2.0f);
|
||||
}
|
||||
|
||||
void BgSpot01Idomizu_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
@@ -97,7 +97,7 @@ void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
|
||||
thisx->speedXZ *= 1.5f;
|
||||
if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y - 120.0f, thisx->speedXZ) != 0) {
|
||||
if (Math_StepToF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y - 120.0f, thisx->speedXZ) != 0) {
|
||||
Actor_Kill(thisx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
f32 sinY;
|
||||
f32 cosY;
|
||||
|
||||
sinY = Math_Sins(this->dyna.actor.shape.rot.y);
|
||||
cosY = Math_Coss(this->dyna.actor.shape.rot.y);
|
||||
sinY = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cosY = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
burstDepthX.z = 0.0f;
|
||||
burstDepthX.x = 0.0f;
|
||||
@@ -97,14 +97,14 @@ void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
f32 temp2;
|
||||
s32 rotationSpeed;
|
||||
|
||||
temp1 = (Math_Rand_ZeroOne() - 0.5f) * 440.0f;
|
||||
temp2 = (Math_Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
temp1 = (Rand_ZeroOne() - 0.5f) * 440.0f;
|
||||
temp2 = (Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
burstDepthY.x = this->dyna.actor.posRot.pos.x + temp2 * sinY + (temp1 * cosY);
|
||||
burstDepthY.y = (this->dyna.actor.posRot.pos.y + 20.0f) + (i * 5.4166665f);
|
||||
burstDepthY.z = this->dyna.actor.posRot.pos.z + temp2 * cosY - (temp1 * sinY);
|
||||
|
||||
burstDepthX.y = (Math_Rand_ZeroOne() - 0.2f) * 12.0f;
|
||||
scale = Math_Rand_ZeroOne() * 75.0f + 10.0f;
|
||||
burstDepthX.y = (Rand_ZeroOne() - 0.2f) * 12.0f;
|
||||
scale = Rand_ZeroOne() * 75.0f + 10.0f;
|
||||
|
||||
if (scale < 25) {
|
||||
gravityInfluence = -300;
|
||||
@@ -114,7 +114,7 @@ void func_808B0324(BgSpot08Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
gravityInfluence = -420;
|
||||
}
|
||||
|
||||
if (Math_Rand_ZeroOne() < 0.4f) {
|
||||
if (Rand_ZeroOne() < 0.4f) {
|
||||
rotationSpeed = 65;
|
||||
} else {
|
||||
rotationSpeed = 33;
|
||||
|
||||
@@ -67,12 +67,12 @@ void func_808B2218(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
|
||||
Math_Vec3f_Sum(&thisx->posRot.pos, &D_808B272C, &burstDepthY);
|
||||
|
||||
burstDepthY.x += (Math_Rand_ZeroOne() - 0.5f) * 120.0f;
|
||||
burstDepthY.x += (Rand_ZeroOne() - 0.5f) * 120.0f;
|
||||
burstDepthY.y += (30.0f + (i * 6.5f));
|
||||
burstDepthY.z += (Math_Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
burstDepthY.z += (Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
|
||||
burstDepthX.y = (Math_Rand_ZeroOne() - 0.2f) * 12.0f;
|
||||
scale = (Math_Rand_ZeroOne() * 55.0f) + 8.0f;
|
||||
burstDepthX.y = (Rand_ZeroOne() - 0.2f) * 12.0f;
|
||||
scale = (Rand_ZeroOne() * 55.0f) + 8.0f;
|
||||
|
||||
if (scale < 20) {
|
||||
gravityInfluence = -300;
|
||||
@@ -81,7 +81,7 @@ void func_808B2218(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
gravityInfluence = -420;
|
||||
}
|
||||
if (Math_Rand_ZeroOne() < 0.4f) {
|
||||
if (Rand_ZeroOne() < 0.4f) {
|
||||
rotationSpeed = 65;
|
||||
} else {
|
||||
rotationSpeed = 33;
|
||||
|
||||
@@ -103,7 +103,7 @@ void func_808B29E0(BgSpot11Oasis* this) {
|
||||
}
|
||||
|
||||
void func_808B29F0(BgSpot11Oasis* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->actor.posRot.pos.y, 0.0f, 0.7f)) {
|
||||
if (Math_StepToF(&this->actor.posRot.pos.y, 0.0f, 0.7f)) {
|
||||
func_808B2AA8(this);
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.posRot.pos.x,
|
||||
this->actor.posRot.pos.y + 40.0f, this->actor.posRot.pos.z, 0, 0, 0, FAIRY_SPAWNER);
|
||||
@@ -135,9 +135,9 @@ void BgSpot11Oasis_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
gameplayFrames = globalCtx->gameplayFrames;
|
||||
if (gameplayFrames & 4) {
|
||||
Math_Vec3f_Sum(&this->actor.posRot.pos, &D_808B2E34[this->unk_151], &sp30);
|
||||
EffectSsBubble_Spawn(globalCtx, &sp30, 0.0f, 15.0f, 50.0f, (Math_Rand_ZeroOne() * 0.12f) + 0.02f);
|
||||
if (Math_Rand_ZeroOne() < 0.3f) {
|
||||
this->unk_151 = Math_Rand_ZeroOne() * 4.9f;
|
||||
EffectSsBubble_Spawn(globalCtx, &sp30, 0.0f, 15.0f, 50.0f, (Rand_ZeroOne() * 0.12f) + 0.02f);
|
||||
if (Rand_ZeroOne() < 0.3f) {
|
||||
this->unk_151 = Rand_ZeroOne() * 4.9f;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -114,8 +114,8 @@ void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
s32 var;
|
||||
|
||||
Math_ApproxF(&thisx->velocity.y, 1.6f, 0.03f);
|
||||
if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 200.0f, thisx->velocity.y)) {
|
||||
Math_StepToF(&thisx->velocity.y, 1.6f, 0.03f);
|
||||
if (Math_StepToF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 200.0f, thisx->velocity.y)) {
|
||||
func_808B3274(this);
|
||||
var = Quake_Add(ACTIVE_CAM, 3);
|
||||
Quake_SetSpeed(var, -0x3CB0);
|
||||
|
||||
@@ -102,13 +102,13 @@ void func_808B35E4(BgSpot12Saku* this) {
|
||||
}
|
||||
|
||||
void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx) {
|
||||
f32 temp_ret = Math_SmoothScaleMaxMinF(&this->dyna.actor.scale.x, 0.001f / 0.14f, 0.16f, 0.0022f, 0.001f);
|
||||
f32 temp_ret = Math_SmoothStepToF(&this->dyna.actor.scale.x, 0.001f / 0.14f, 0.16f, 0.0022f, 0.001f);
|
||||
f32 temp_f18 = ((0.1f - this->dyna.actor.scale.x) * 840.0f);
|
||||
|
||||
this->dyna.actor.posRot.pos.x =
|
||||
this->dyna.actor.initPosRot.pos.x - (Math_Sins(this->dyna.actor.shape.rot.y + 0x4000) * temp_f18);
|
||||
this->dyna.actor.initPosRot.pos.x - (Math_SinS(this->dyna.actor.shape.rot.y + 0x4000) * temp_f18);
|
||||
this->dyna.actor.posRot.pos.z =
|
||||
this->dyna.actor.initPosRot.pos.z - (Math_Coss(this->dyna.actor.shape.rot.y + 0x4000) * temp_f18);
|
||||
this->dyna.actor.initPosRot.pos.z - (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * temp_f18);
|
||||
if (fabsf(temp_ret) < 0.0001f) {
|
||||
func_808B3714(this);
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP);
|
||||
@@ -122,8 +122,8 @@ void func_808B3714(BgSpot12Saku* this) {
|
||||
|
||||
this->actionFunc = func_808B37AC;
|
||||
thisx->scale.x = 0.001f / 0.14f;
|
||||
thisx->posRot.pos.x = thisx->initPosRot.pos.x - (Math_Sins(thisx->shape.rot.y + 0x4000) * 78.0f);
|
||||
thisx->posRot.pos.z = thisx->initPosRot.pos.z - (Math_Coss(thisx->shape.rot.y + 0x4000) * 78.0f);
|
||||
thisx->posRot.pos.x = thisx->initPosRot.pos.x - (Math_SinS(thisx->shape.rot.y + 0x4000) * 78.0f);
|
||||
thisx->posRot.pos.z = thisx->initPosRot.pos.z - (Math_CosS(thisx->shape.rot.y + 0x4000) * 78.0f);
|
||||
}
|
||||
|
||||
void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx) {
|
||||
|
||||
@@ -261,7 +261,7 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) {
|
||||
|
||||
this->unk_174 = CLAMP_MAX(this->unk_174, 2.0f);
|
||||
|
||||
approxFResult = Math_ApproxF(&this->unk_178, 20.0f, this->unk_174);
|
||||
approxFResult = Math_StepToF(&this->unk_178, 20.0f, this->unk_174);
|
||||
|
||||
sign = this->unk_17C >= 0.0f ? 1.0f : -1.0f;
|
||||
|
||||
@@ -354,8 +354,8 @@ void BgSpot15Rrbox_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->unk_168--;
|
||||
}
|
||||
this->dyna.actor.posRot.rot.y = this->dyna.unk_158;
|
||||
this->unk_16C = Math_Sins(this->dyna.actor.posRot.rot.y);
|
||||
this->unk_170 = Math_Coss(this->dyna.actor.posRot.rot.y);
|
||||
this->unk_16C = Math_SinS(this->dyna.actor.posRot.rot.y);
|
||||
this->unk_170 = Math_CosS(this->dyna.actor.posRot.rot.y);
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,8 +154,8 @@ s32 func_808B4D9C(BgSpot16Bombstone* this, GlobalContext* globalCtx) {
|
||||
this->actor.colChkInfo.mass = 0xFF;
|
||||
func_808B4C4C(this, globalCtx);
|
||||
func_808B4D04(this, globalCtx);
|
||||
this->sinRotation = Math_Sins(this->actor.shape.rot.y);
|
||||
this->cosRotation = Math_Coss(this->actor.shape.rot.y);
|
||||
this->sinRotation = Math_SinS(this->actor.shape.rot.y);
|
||||
this->cosRotation = Math_CosS(this->actor.shape.rot.y);
|
||||
this->unk_150 = D_06000C20;
|
||||
|
||||
func_808B5934(this);
|
||||
@@ -181,8 +181,8 @@ s32 func_808B4E58(BgSpot16Bombstone* this, GlobalContext* globalctx) {
|
||||
|
||||
actor->posRot.rot.y = D_808B5DD8[actor->params][5];
|
||||
|
||||
sinValue = Math_Sins(this->actor.posRot.rot.y);
|
||||
cosValue = Math_Coss(this->actor.posRot.rot.y);
|
||||
sinValue = Math_SinS(this->actor.posRot.rot.y);
|
||||
cosValue = Math_CosS(this->actor.posRot.rot.y);
|
||||
|
||||
actor->posRot.pos.x = (sinValue * sinCosPosFactor) + actor->initPosRot.pos.x;
|
||||
actor->posRot.pos.y = D_808B5DD8[actor->params][6] + actor->initPosRot.pos.y;
|
||||
@@ -308,13 +308,13 @@ void BgSpot16Bombstone_SpawnFragments(BgSpot16Bombstone* this, GlobalContext* gl
|
||||
|
||||
if (index < ARRAY_COUNT(D_808B6074)) {
|
||||
do {
|
||||
pos.x = ((Math_Rand_ZeroOne() - 0.5f) * 8.0f) + this->actor.posRot.pos.x;
|
||||
pos.y = ((Math_Rand_ZeroOne() * 5.0f) + this->actor.posRot.pos.y) + 8.0f;
|
||||
pos.z = ((Math_Rand_ZeroOne() - 0.5f) * 8.0f) + this->actor.posRot.pos.z;
|
||||
pos.x = ((Rand_ZeroOne() - 0.5f) * 8.0f) + this->actor.posRot.pos.x;
|
||||
pos.y = ((Rand_ZeroOne() * 5.0f) + this->actor.posRot.pos.y) + 8.0f;
|
||||
pos.z = ((Rand_ZeroOne() - 0.5f) * 8.0f) + this->actor.posRot.pos.z;
|
||||
|
||||
velocity.x = (Math_Rand_ZeroOne() - 0.5f) * 16.0f;
|
||||
velocity.y = (Math_Rand_ZeroOne() * 14.0) + (fabsf(this->actor.velocity.y) * velocityYMultiplier);
|
||||
velocity.z = (Math_Rand_ZeroOne() - 0.5f) * 16.0f;
|
||||
velocity.x = (Rand_ZeroOne() - 0.5f) * 16.0f;
|
||||
velocity.y = (Rand_ZeroOne() * 14.0) + (fabsf(this->actor.velocity.y) * velocityYMultiplier);
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * 16.0f;
|
||||
|
||||
scale = D_808B6074[index] * this->actor.scale.x * 3;
|
||||
|
||||
@@ -353,7 +353,7 @@ void func_808B56BC(BgSpot16Bombstone* this, GlobalContext* globalCtx) {
|
||||
adjustedYawDiff = absYawDiff - 0x3FFF;
|
||||
|
||||
if (adjustedYawDiff > 0) {
|
||||
sinValue = Math_Sins(adjustedYawDiff) * this->actor.xzDistFromLink;
|
||||
sinValue = Math_SinS(adjustedYawDiff) * this->actor.xzDistFromLink;
|
||||
|
||||
if (sinValue >= 0.0f) {
|
||||
player->actor.posRot.pos.x += sinValue * this->sinRotation;
|
||||
|
||||
@@ -48,8 +48,8 @@ void func_808B6BC0(BgSpot17Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
f32 sinY;
|
||||
f32 cosY;
|
||||
|
||||
sinY = Math_Sins(this->dyna.actor.shape.rot.y);
|
||||
cosY = Math_Coss(this->dyna.actor.shape.rot.y);
|
||||
sinY = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cosY = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
burstDepthX.z = 0.0f;
|
||||
burstDepthX.x = 0.0f;
|
||||
@@ -61,15 +61,15 @@ void func_808B6BC0(BgSpot17Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
f32 temp2;
|
||||
s32 rotationSpeed;
|
||||
|
||||
temp1 = (Math_Rand_ZeroOne() - 0.5f) * 140.0f;
|
||||
temp2 = (Math_Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
temp1 = (Rand_ZeroOne() - 0.5f) * 140.0f;
|
||||
temp2 = (Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
|
||||
burstDepthY.x = this->dyna.actor.posRot.pos.x + temp2 * sinY + (temp1 * cosY);
|
||||
burstDepthY.y = this->dyna.actor.posRot.pos.y + 30.0f + (i * 6.5f);
|
||||
burstDepthY.z = this->dyna.actor.posRot.pos.z + temp2 * cosY - (temp1 * sinY);
|
||||
|
||||
burstDepthX.y = (Math_Rand_ZeroOne() - 0.2f) * 12.0f;
|
||||
scale = Math_Rand_ZeroOne() * 55.0f + 8.0f;
|
||||
burstDepthX.y = (Rand_ZeroOne() - 0.2f) * 12.0f;
|
||||
scale = Rand_ZeroOne() * 55.0f + 8.0f;
|
||||
|
||||
if (scale < 20) {
|
||||
gravityInfluence = -300;
|
||||
@@ -79,7 +79,7 @@ void func_808B6BC0(BgSpot17Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
gravityInfluence = -420;
|
||||
}
|
||||
|
||||
if (Math_Rand_ZeroOne() < 0.4f) {
|
||||
if (Rand_ZeroOne() < 0.4f) {
|
||||
rotationSpeed = 65;
|
||||
} else {
|
||||
rotationSpeed = 33;
|
||||
|
||||
@@ -78,13 +78,13 @@ void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) {
|
||||
|
||||
for (i = 0, count = 2; i != count; i++) {
|
||||
if (globalCtx) {}
|
||||
if (!(arg2 < Math_Rand_ZeroOne())) {
|
||||
if (!(arg2 < Rand_ZeroOne())) {
|
||||
D_808B85D0 += 0x7530;
|
||||
|
||||
sinValue = Math_Sins(D_808B85D0);
|
||||
cosValue = Math_Coss(D_808B85D0);
|
||||
sinValue = Math_SinS(D_808B85D0);
|
||||
cosValue = Math_CosS(D_808B85D0);
|
||||
|
||||
randomValue = (Math_Rand_ZeroOne() * 35.0f) + 35.0f;
|
||||
randomValue = (Rand_ZeroOne() * 35.0f) + 35.0f;
|
||||
|
||||
position.x = (randomValue * sinValue) + this->dyna.actor.posRot.pos.x;
|
||||
position.y = this->dyna.actor.posRot.pos.y + 10.0f;
|
||||
@@ -98,8 +98,8 @@ void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) {
|
||||
acceleration.y = 0.5f;
|
||||
acceleration.z = 0.0f;
|
||||
|
||||
func_800286CC(globalCtx, &position, &velocity, &acceleration, ((Math_Rand_ZeroOne() * 16) + 80),
|
||||
((Math_Rand_ZeroOne() * 30) + 80));
|
||||
func_800286CC(globalCtx, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80),
|
||||
((Rand_ZeroOne() * 30) + 80));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,17 +185,17 @@ void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx) {
|
||||
f32 positionDiff;
|
||||
Actor* colliderBaseAc;
|
||||
|
||||
Math_ApproxS(&this->unk_210, 0x1F4, 0x1E);
|
||||
Math_StepToS(&this->unk_210, 0x1F4, 0x1E);
|
||||
|
||||
this->dyna.actor.shape.rot.y += this->unk_210;
|
||||
|
||||
Math_ApproxF(&this->unk_208, 50.0f, 1.5f);
|
||||
Math_ApproxS(&this->unk_20C, 400, 15);
|
||||
Math_StepToF(&this->unk_208, 50.0f, 1.5f);
|
||||
Math_StepToS(&this->unk_20C, 400, 15);
|
||||
|
||||
this->unk_20E += this->unk_20C;
|
||||
|
||||
this->dyna.actor.posRot.pos.x = (Math_Sins(this->unk_20E) * this->unk_208) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z = (Math_Coss(this->unk_20E) * this->unk_208) + this->dyna.actor.initPosRot.pos.z;
|
||||
this->dyna.actor.posRot.pos.x = (Math_SinS(this->unk_20E) * this->unk_208) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z = (Math_CosS(this->unk_20E) * this->unk_208) + this->dyna.actor.initPosRot.pos.z;
|
||||
|
||||
if (this->colliderJntSph.base.acFlags & 2) {
|
||||
colliderBaseAc = this->colliderJntSph.base.ac;
|
||||
@@ -227,32 +227,32 @@ void func_808B7D50(BgSpot18Basket* this, GlobalContext* globalCtx) {
|
||||
f32 tempValue;
|
||||
|
||||
if (this->unk_216 > 120) {
|
||||
Math_ApproxS(&this->unk_210, 0x3E8, 0x32);
|
||||
Math_StepToS(&this->unk_210, 0x3E8, 0x32);
|
||||
} else {
|
||||
Math_ApproxS(&this->unk_210, 0xBB8, 0x64);
|
||||
Math_StepToS(&this->unk_210, 0xBB8, 0x64);
|
||||
}
|
||||
|
||||
this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y + this->unk_210;
|
||||
|
||||
if (this->unk_216 < 70) {
|
||||
Math_ApproxF(&this->unk_208, 100.0f, 2.0f);
|
||||
Math_StepToF(&this->unk_208, 100.0f, 2.0f);
|
||||
} else {
|
||||
Math_ApproxF(&this->unk_208, 0.0f, 2.0f);
|
||||
Math_StepToF(&this->unk_208, 0.0f, 2.0f);
|
||||
}
|
||||
|
||||
Math_ApproxS(&this->unk_20C, 1000, 20);
|
||||
Math_StepToS(&this->unk_20C, 1000, 20);
|
||||
|
||||
this->unk_20E += this->unk_20C;
|
||||
|
||||
this->dyna.actor.posRot.pos.x = (Math_Sins(this->unk_20E) * this->unk_208) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z = (Math_Coss(this->unk_20E) * this->unk_208) + this->dyna.actor.initPosRot.pos.z;
|
||||
this->dyna.actor.posRot.pos.x = (Math_SinS(this->unk_20E) * this->unk_208) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z = (Math_CosS(this->unk_20E) * this->unk_208) + this->dyna.actor.initPosRot.pos.z;
|
||||
|
||||
this->unk_212 += 0xBB8;
|
||||
|
||||
Math_ApproxS(&this->unk_214, 0x5DC, 0x1E);
|
||||
Math_StepToS(&this->unk_214, 0x5DC, 0x1E);
|
||||
|
||||
this->dyna.actor.shape.rot.x = Math_Coss(this->unk_212) * this->unk_214;
|
||||
this->dyna.actor.shape.rot.z = -Math_Sins(this->unk_212) * this->unk_214;
|
||||
this->dyna.actor.shape.rot.x = Math_CosS(this->unk_212) * this->unk_214;
|
||||
this->dyna.actor.shape.rot.z = -Math_SinS(this->unk_212) * this->unk_214;
|
||||
|
||||
if (this->unk_216 > 140) {
|
||||
func_808B7F74(this);
|
||||
@@ -298,15 +298,15 @@ void func_808B7FC0(BgSpot18Basket* this, GlobalContext* globalCtx) {
|
||||
this->unk_212 += 0xBB8;
|
||||
|
||||
if (this->unk_216 >= 13) {
|
||||
tempUnk214 = Math_ApproxS(&this->unk_214, 0, 55);
|
||||
tempUnk214 = Math_StepToS(&this->unk_214, 0, 55);
|
||||
} else {
|
||||
tempUnk214 = 0;
|
||||
}
|
||||
|
||||
this->dyna.actor.shape.rot.x = Math_Coss(this->unk_212) * this->unk_214;
|
||||
this->dyna.actor.shape.rot.z = -Math_Sins(this->unk_212) * this->unk_214;
|
||||
this->dyna.actor.shape.rot.x = Math_CosS(this->unk_212) * this->unk_214;
|
||||
this->dyna.actor.shape.rot.z = -Math_SinS(this->unk_212) * this->unk_214;
|
||||
|
||||
Math_ApproxS(&this->unk_210, 0x1F4, 0xA);
|
||||
Math_StepToS(&this->unk_210, 0x1F4, 0xA);
|
||||
this->dyna.actor.shape.rot.y += this->unk_210;
|
||||
|
||||
if (tempUnk214 != 0) {
|
||||
|
||||
@@ -59,7 +59,7 @@ void BgSpot18Futa_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 iVar1;
|
||||
|
||||
if (this->actor.parent == NULL) {
|
||||
iVar1 = Math_ApproxF(&this->actor.scale.x, 0, 0.005);
|
||||
iVar1 = Math_StepToF(&this->actor.scale.x, 0, 0.005);
|
||||
|
||||
if (iVar1 != 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
|
||||
@@ -158,9 +158,9 @@ s32 func_808B8BB4(BgSpot18Obj* this, GlobalContext* globalCtx) {
|
||||
} else if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) {
|
||||
func_808B9030(this);
|
||||
this->dyna.actor.posRot.pos.x =
|
||||
(Math_Sins(this->dyna.actor.posRot.rot.y) * 80.0f) + this->dyna.actor.initPosRot.pos.x;
|
||||
(Math_SinS(this->dyna.actor.posRot.rot.y) * 80.0f) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z =
|
||||
(Math_Coss(this->dyna.actor.posRot.rot.y) * 80.0f) + this->dyna.actor.initPosRot.pos.z;
|
||||
(Math_CosS(this->dyna.actor.posRot.rot.y) * 80.0f) + this->dyna.actor.initPosRot.pos.z;
|
||||
} else {
|
||||
func_808B8E64(this);
|
||||
}
|
||||
@@ -247,7 +247,7 @@ void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
Player* player = PLAYER;
|
||||
|
||||
Math_ApproxF(&this->dyna.actor.speedXZ, 1.2f, 0.1f);
|
||||
Math_StepToF(&this->dyna.actor.speedXZ, 1.2f, 0.1f);
|
||||
Actor_MoveForward(&this->dyna.actor);
|
||||
func_808B8DDC(this, globalCtx);
|
||||
|
||||
@@ -255,9 +255,9 @@ void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx) {
|
||||
this->dyna.actor.initPosRot.pos.z) >= 6400.0f) {
|
||||
func_808B9030(this);
|
||||
this->dyna.actor.posRot.pos.x =
|
||||
(Math_Sins(this->dyna.actor.posRot.rot.y) * 80.0f) + this->dyna.actor.initPosRot.pos.x;
|
||||
(Math_SinS(this->dyna.actor.posRot.rot.y) * 80.0f) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z =
|
||||
(Math_Coss(this->dyna.actor.posRot.rot.y) * 80.0f) + this->dyna.actor.initPosRot.pos.z;
|
||||
(Math_CosS(this->dyna.actor.posRot.rot.y) * 80.0f) + this->dyna.actor.initPosRot.pos.z;
|
||||
this->dyna.unk_150 = 0.0f;
|
||||
player->stateFlags2 &= ~0x10;
|
||||
Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F);
|
||||
|
||||
@@ -67,8 +67,8 @@ void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
} else {
|
||||
if (gSaveContext.infTable[16] & 0x200) {
|
||||
this->dyna.actor.posRot.pos.x += 125.0f * Math_Coss(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.posRot.pos.z -= 125.0f * Math_Sins(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.posRot.pos.x += 125.0f * Math_CosS(this->dyna.actor.posRot.rot.y);
|
||||
this->dyna.actor.posRot.pos.z -= 125.0f * Math_SinS(this->dyna.actor.posRot.rot.y);
|
||||
this->actionFunc = func_808B95AC;
|
||||
} else {
|
||||
this->actionFunc = func_808B9618;
|
||||
@@ -109,7 +109,7 @@ void func_808B9618(BgSpot18Shutter* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 180.0f, 1.44f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 180.0f, 1.44f)) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP);
|
||||
this->actionFunc = func_808B95AC;
|
||||
} else {
|
||||
@@ -118,13 +118,13 @@ void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx) {
|
||||
f32 sin = Math_Sins(this->dyna.actor.posRot.rot.y);
|
||||
f32 cos = Math_Coss(this->dyna.actor.posRot.rot.y);
|
||||
f32 sin = Math_SinS(this->dyna.actor.posRot.rot.y);
|
||||
f32 cos = Math_CosS(this->dyna.actor.posRot.rot.y);
|
||||
s32 flag =
|
||||
Math_ApproxF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x + (125.0f * cos), fabsf(cos)) &
|
||||
Math_StepToF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x + (125.0f * cos), fabsf(cos)) &
|
||||
1;
|
||||
flag &=
|
||||
Math_ApproxF(&this->dyna.actor.posRot.pos.z, this->dyna.actor.initPosRot.pos.z - (125.0f * sin), fabsf(sin));
|
||||
Math_StepToF(&this->dyna.actor.posRot.pos.z, this->dyna.actor.initPosRot.pos.z - (125.0f * sin), fabsf(sin));
|
||||
|
||||
if (flag) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP);
|
||||
|
||||
@@ -117,9 +117,9 @@ void func_808BC6F8(BgTreemouth* this, GlobalContext* globalCtx) {
|
||||
|
||||
if ((gSaveContext.sceneSetupIndex == 6) && (globalCtx->csCtx.frames >= 0x2BD) &&
|
||||
(globalCtx->state.frames % 8 == 0)) {
|
||||
sp34.x = (Math_Rand_ZeroOne() * 1158.0f) + 3407.0f;
|
||||
sp34.x = (Rand_ZeroOne() * 1158.0f) + 3407.0f;
|
||||
sp34.y = 970.0f;
|
||||
sp34.z = (Math_Rand_ZeroOne() * 2026.0f) + -2163.0f;
|
||||
sp34.z = (Rand_ZeroOne() * 2026.0f) + -2163.0f;
|
||||
EffectSsHahen_SpawnBurst(globalCtx, &sp34, 0.8f, 0, 50, 30, 1, HAHEN_OBJECT_DEFAULT, 10, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ void BgYdanHasi_UpdateFloatingBlock(BgYdanHasi* this, GlobalContext* globalCtx)
|
||||
|
||||
framesAfterMath = sinf((globalCtx->gameplayFrames & 0xFF) * 0.024543693f) * 165.0f;
|
||||
this->dyna.actor.posRot.pos.x =
|
||||
((Math_Sins(this->dyna.actor.posRot.rot.y) * framesAfterMath) + this->dyna.actor.initPosRot.pos.x);
|
||||
((Math_SinS(this->dyna.actor.posRot.rot.y) * framesAfterMath) + this->dyna.actor.initPosRot.pos.x);
|
||||
this->dyna.actor.posRot.pos.z =
|
||||
((Math_Coss(this->dyna.actor.posRot.rot.y) * framesAfterMath) + this->dyna.actor.initPosRot.pos.z);
|
||||
((Math_CosS(this->dyna.actor.posRot.rot.y) * framesAfterMath) + this->dyna.actor.initPosRot.pos.z);
|
||||
waterBox = &globalCtx->colCtx.stat.colHeader->waterBoxes[1];
|
||||
this->dyna.actor.posRot.pos.y = waterBox->unk_02 + 20.0f;
|
||||
if (this->timer != 0) {
|
||||
@@ -122,13 +122,13 @@ WaterBox* BgYdanHasi_MoveWater(BgYdanHasi* this, GlobalContext* globalCtx) {
|
||||
WaterBox* waterBox;
|
||||
|
||||
if (this->timer == 0) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 1.0f) != 0) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 1.0f) != 0) {
|
||||
Flags_UnsetSwitch(globalCtx, this->unk_168);
|
||||
this->actionFunc = BgYdanHasi_InitWater;
|
||||
}
|
||||
func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
|
||||
} else {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 47.0f, 0.5f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y - 47.0f, 0.5f)) {
|
||||
this->actionFunc = BgYdanHasi_DecWaterTimer;
|
||||
}
|
||||
func_8002F948(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG);
|
||||
@@ -165,7 +165,7 @@ void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) {
|
||||
this->timer--;
|
||||
}
|
||||
if (this->timer == 0) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 3.0f) != 0) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 3.0f) != 0) {
|
||||
Flags_UnsetSwitch(globalCtx, this->unk_168);
|
||||
this->dyna.actor.draw = NULL;
|
||||
this->actionFunc = BgYdanHasi_SetupThreeBlocks;
|
||||
@@ -174,7 +174,7 @@ void BgYdanHasi_UpdateThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) {
|
||||
func_8002F948(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
|
||||
return;
|
||||
}
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 120.0f, 3.0f) == 0) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 120.0f, 3.0f) == 0) {
|
||||
func_8002F948(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
sinRotY = Math_Sins(thisx->shape.rot.y);
|
||||
cosRotY = Math_Coss(thisx->shape.rot.y);
|
||||
sinRotY = Math_SinS(thisx->shape.rot.y);
|
||||
cosRotY = Math_CosS(thisx->shape.rot.y);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
sp4C[i].x = (items->dim.vtx[i].x * cosRotY) + thisx->posRot.pos.x;
|
||||
@@ -160,16 +160,16 @@ void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
this->dyna.actor.posRot.pos.x =
|
||||
(Math_Coss(this->dyna.actor.shape.rot.y) * temp) + this->dyna.actor.initPosRot.pos.x;
|
||||
(Math_CosS(this->dyna.actor.shape.rot.y) * temp) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z =
|
||||
(Math_Sins(this->dyna.actor.shape.rot.y) * temp) + this->dyna.actor.initPosRot.pos.z;
|
||||
(Math_SinS(this->dyna.actor.shape.rot.y) * temp) + this->dyna.actor.initPosRot.pos.z;
|
||||
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG);
|
||||
}
|
||||
|
||||
void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx) {
|
||||
this->dyna.actor.velocity.y += 1.0f;
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.velocity.y)) {
|
||||
if (Math_StepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.velocity.y)) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_LADDER_DOUND);
|
||||
this->actionFunc = BgYdanMaruta_DoNothing;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ void DemoEc_UpdateEyes(DemoEc* this) {
|
||||
s16* eyeTexIndex = &this->eyeTexIndex;
|
||||
|
||||
if (DECR(*blinkTimer) == 0) {
|
||||
*blinkTimer = Math_Rand_S16Offset(60, 60);
|
||||
*blinkTimer = Rand_S16Offset(60, 60);
|
||||
}
|
||||
|
||||
*eyeTexIndex = *blinkTimer;
|
||||
|
||||
@@ -605,16 +605,16 @@ void DemoEffect_MedalSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 isS
|
||||
accel.z = 0.0f;
|
||||
|
||||
if (isSmallSpawner) {
|
||||
velocity.x = Math_Rand_ZeroOne() - 0.5f;
|
||||
velocity.z = Math_Rand_ZeroOne() - 0.5f;
|
||||
velocity.x = Rand_ZeroOne() - 0.5f;
|
||||
velocity.z = Rand_ZeroOne() - 0.5f;
|
||||
} else {
|
||||
velocity.x = (Math_Rand_ZeroOne() - 0.5f) * 2.0f;
|
||||
velocity.z = (Math_Rand_ZeroOne() - 0.5f) * 2.0f;
|
||||
velocity.x = (Rand_ZeroOne() - 0.5f) * 2.0f;
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * 2.0f;
|
||||
}
|
||||
|
||||
pos.x = Math_Rand_CenteredFloat(10.0f) + this->actor.posRot.pos.x;
|
||||
pos.y = Math_Rand_CenteredFloat(10.0f) + this->actor.posRot.pos.y;
|
||||
pos.z = Math_Rand_CenteredFloat(10.0f) + this->actor.posRot.pos.z;
|
||||
pos.x = Rand_CenteredFloat(10.0f) + this->actor.posRot.pos.x;
|
||||
pos.y = Rand_CenteredFloat(10.0f) + this->actor.posRot.pos.y;
|
||||
pos.z = Rand_CenteredFloat(10.0f) + this->actor.posRot.pos.z;
|
||||
|
||||
EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 1000, 16);
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, GlobalContext* globalCtx) {
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Math_SmoothScaleMaxMinF(&this->actor.scale.x, 0.0f, 0.1f, 0.1f, 0.005f);
|
||||
Math_SmoothStepToF(&this->actor.scale.x, 0.0f, 0.1f, 0.1f, 0.005f);
|
||||
Actor_SetScale(&this->actor, this->actor.scale.x);
|
||||
break;
|
||||
|
||||
@@ -1487,7 +1487,7 @@ void DemoEffect_MoveJewelActivateDoorOfTime(DemoEffect* this, GlobalContext* glo
|
||||
}
|
||||
|
||||
if (startPos.x != endPos.x || startPos.y != endPos.y || startPos.z != endPos.z) {
|
||||
this->jewelCsRotation.x = atan2f(endPos.z - startPos.z, -(endPos.x - startPos.x)) * (0x8000 / M_PI);
|
||||
this->jewelCsRotation.x = Math_Atan2F(endPos.z - startPos.z, -(endPos.x - startPos.x)) * (0x8000 / M_PI);
|
||||
this->jewelCsRotation.y = Math_Vec3f_Yaw(&startPos, &endPos);
|
||||
}
|
||||
|
||||
@@ -1525,8 +1525,8 @@ void DemoEffect_JewelSparkle(DemoEffect* this, GlobalContext* globalCtx, s32 spa
|
||||
primColor.a = 0;
|
||||
|
||||
for (i = 0; i < spawnerCount; i++) {
|
||||
velocity.x = (Math_Rand_ZeroOne() - 0.5f) * 1.5f;
|
||||
velocity.z = (Math_Rand_ZeroOne() - 0.5f) * 1.5f;
|
||||
velocity.x = (Rand_ZeroOne() - 0.5f) * 1.5f;
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * 1.5f;
|
||||
|
||||
EffectSsKiraKira_SpawnDispersed(globalCtx, &this->actor.posRot.pos, &velocity, &accel, &primColor, &envColor,
|
||||
3000, 16);
|
||||
@@ -1639,8 +1639,8 @@ void DemoEffect_UpdateDust(DemoEffect* this, GlobalContext* globalCtx) {
|
||||
pos = this->actor.posRot.pos;
|
||||
|
||||
pos.y += 600.0f;
|
||||
pos.x += Math_Rand_CenteredFloat(300.0f);
|
||||
pos.z += 200.0f + Math_Rand_CenteredFloat(300.0f);
|
||||
pos.x += Rand_CenteredFloat(300.0f);
|
||||
pos.z += 200.0f + Rand_CenteredFloat(300.0f);
|
||||
|
||||
velocity.z = 0.0f;
|
||||
velocity.x = 0.0f;
|
||||
@@ -2109,8 +2109,8 @@ void DemoEffect_FaceToCsEndpoint(DemoEffect* this, Vec3f startPos, Vec3f endPos)
|
||||
f32 z = endPos.z - startPos.z;
|
||||
f32 xzDistance = sqrtf(SQ(x) + SQ(z));
|
||||
|
||||
this->actor.shape.rot.y = Math_atan2f(x, z) * (32768.0f / M_PI);
|
||||
this->actor.shape.rot.x = Math_atan2f(-(endPos.y - startPos.y), xzDistance) * (32768.0f / M_PI);
|
||||
this->actor.shape.rot.y = Math_FAtan2F(x, z) * (32768.0f / M_PI);
|
||||
this->actor.shape.rot.x = Math_FAtan2F(-(endPos.y - startPos.y), xzDistance) * (32768.0f / M_PI);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -98,7 +98,7 @@ void func_8097C930(DemoGo* this) {
|
||||
s32 pad[3];
|
||||
|
||||
if (DECR(*something) == 0) {
|
||||
*something = Math_Rand_S16Offset(0x3C, 0x3C);
|
||||
*something = Rand_S16Offset(0x3C, 0x3C);
|
||||
}
|
||||
*other = *something;
|
||||
if (*other >= 3) {
|
||||
|
||||
@@ -52,8 +52,8 @@ void DemoGt_SpawnDust(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec
|
||||
static Color_RGBA8 brownPrim = { 100, 80, 100, 0 };
|
||||
static Color_RGBA8 redEnv = { 255, 110, 96, 0 };
|
||||
|
||||
func_8002843C(globalCtx, pos, velocity, accel, &brownPrim, &redEnv,
|
||||
((Math_Rand_ZeroOne() * (scale * 0.2f)) + scale), scaleStep, life);
|
||||
func_8002843C(globalCtx, pos, velocity, accel, &brownPrim, &redEnv, ((Rand_ZeroOne() * (scale * 0.2f)) + scale),
|
||||
scaleStep, life);
|
||||
}
|
||||
|
||||
void func_8097D7D8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velOffset, f32 scale, s32 arg4, s32 arg5, s16 life) {
|
||||
@@ -116,19 +116,19 @@ void func_8097DAC8(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) {
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
|
||||
pos.x = Math_Sins(angle) * 46.0f;
|
||||
pos.y = (Math_Rand_ZeroOne() * 75.0f) + 2.0f;
|
||||
pos.z = Math_Coss(angle) * 46.0f;
|
||||
pos.x = Math_SinS(angle) * 46.0f;
|
||||
pos.y = (Rand_ZeroOne() * 75.0f) + 2.0f;
|
||||
pos.z = Math_CosS(angle) * 46.0f;
|
||||
|
||||
velocity.x = (pos.x * 0.1f) + 20.0f;
|
||||
velocity.y = Math_Rand_ZeroOne() * 16.0f;
|
||||
velocity.y = Rand_ZeroOne() * 16.0f;
|
||||
velocity.z = pos.z * 0.1f;
|
||||
|
||||
pos.x += spawnerPos->x;
|
||||
pos.y += spawnerPos->y;
|
||||
pos.z += spawnerPos->z;
|
||||
|
||||
temp_f0 = Math_Rand_ZeroOne();
|
||||
temp_f0 = Rand_ZeroOne();
|
||||
|
||||
if (temp_f0 < 0.1f) {
|
||||
phi_s0 = 96;
|
||||
@@ -139,7 +139,7 @@ void func_8097DAC8(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) {
|
||||
}
|
||||
|
||||
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0,
|
||||
(s32)(Math_Rand_ZeroOne() * 10.0f + 30.0f), 2, 300, (s32)(Math_Rand_ZeroOne() * 0.0f) + 30,
|
||||
(s32)(Rand_ZeroOne() * 10.0f + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 30,
|
||||
KAKERA_COLOR_NONE, OBJECT_GEFF, D_06000EA0);
|
||||
angle += 0x1555;
|
||||
}
|
||||
@@ -157,19 +157,19 @@ void func_8097DD28(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) {
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
|
||||
pos.x = Math_Sins(angle) * 30.0f;
|
||||
pos.y = (Math_Rand_ZeroOne() * 75.0f) + 2.0f;
|
||||
pos.z = Math_Coss(angle) * 30.0f;
|
||||
pos.x = Math_SinS(angle) * 30.0f;
|
||||
pos.y = (Rand_ZeroOne() * 75.0f) + 2.0f;
|
||||
pos.z = Math_CosS(angle) * 30.0f;
|
||||
|
||||
velocity.x = 0.0f;
|
||||
velocity.y = Math_Rand_ZeroOne() * -4.0f;
|
||||
velocity.y = Rand_ZeroOne() * -4.0f;
|
||||
velocity.z = pos.z * 0.1f;
|
||||
|
||||
pos.x += spawnerPos->x;
|
||||
pos.y += spawnerPos->y;
|
||||
pos.z += spawnerPos->z;
|
||||
|
||||
temp_f0 = Math_Rand_ZeroOne();
|
||||
temp_f0 = Rand_ZeroOne();
|
||||
|
||||
if (temp_f0 < 0.1f) {
|
||||
phi_s0 = 96;
|
||||
@@ -180,8 +180,8 @@ void func_8097DD28(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) {
|
||||
}
|
||||
|
||||
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -247, phi_s0, 3, 0, 0,
|
||||
(s32)((Math_Rand_ZeroOne() * 10.0f) + 30.0f), 2, 300,
|
||||
(s32)(Math_Rand_ZeroOne() * 0.0f) + 0x1E, KAKERA_COLOR_NONE, OBJECT_GEFF, D_06000EA0);
|
||||
(s32)((Rand_ZeroOne() * 10.0f) + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 0x1E,
|
||||
KAKERA_COLOR_NONE, OBJECT_GEFF, D_06000EA0);
|
||||
|
||||
angle += 0x2000;
|
||||
}
|
||||
@@ -199,19 +199,19 @@ void func_8097DF70(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) {
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
|
||||
pos.x = Math_Sins(angle) * 16.0f;
|
||||
pos.y = (Math_Rand_ZeroOne() * 5.0f) + 2.0f;
|
||||
pos.z = Math_Coss(angle) * 16.0f;
|
||||
pos.x = Math_SinS(angle) * 16.0f;
|
||||
pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f;
|
||||
pos.z = Math_CosS(angle) * 16.0f;
|
||||
|
||||
velocity.x = pos.x * 0.6f;
|
||||
velocity.y = (Math_Rand_ZeroOne() * 36.0f) + 6.0f;
|
||||
velocity.y = (Rand_ZeroOne() * 36.0f) + 6.0f;
|
||||
velocity.z = pos.z * 0.6f;
|
||||
|
||||
pos.x += spawnerPos->x;
|
||||
pos.y += spawnerPos->y;
|
||||
pos.z += spawnerPos->z;
|
||||
|
||||
temp_f0 = Math_Rand_ZeroOne();
|
||||
temp_f0 = Rand_ZeroOne();
|
||||
|
||||
if (temp_f0 < 0.1f) {
|
||||
phi_s0 = 97;
|
||||
@@ -222,7 +222,7 @@ void func_8097DF70(DemoGt* this, GlobalContext* globalCtx, Vec3f* spawnerPos) {
|
||||
}
|
||||
|
||||
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, spawnerPos, -200, phi_s0, 10, 10, 0,
|
||||
Math_Rand_ZeroOne() * 30.0f + 30.0f, 2, 300, (s32)(Math_Rand_ZeroOne() * 30.0f) + 30,
|
||||
Rand_ZeroOne() * 30.0f + 30.0f, 2, 300, (s32)(Rand_ZeroOne() * 30.0f) + 30,
|
||||
KAKERA_COLOR_NONE, OBJECT_GEFF, D_06000EA0);
|
||||
angle += 0x1555;
|
||||
}
|
||||
@@ -240,19 +240,19 @@ void func_8097E1D4(GlobalContext* globalCtx, Vec3f* arg1, s16 arg2) {
|
||||
|
||||
for (i = 0; i < 1; i++) {
|
||||
|
||||
pos.x = Math_Sins(angle) * 46.0f;
|
||||
pos.y = (Math_Rand_ZeroOne() * 75.0f) - 28.0f;
|
||||
pos.z = Math_Coss(angle) * 46.0f;
|
||||
pos.x = Math_SinS(angle) * 46.0f;
|
||||
pos.y = (Rand_ZeroOne() * 75.0f) - 28.0f;
|
||||
pos.z = Math_CosS(angle) * 46.0f;
|
||||
|
||||
velocity.x = Math_Sins(arg2) * 3.0f;
|
||||
velocity.y = (Math_Rand_ZeroOne() * -4.0f) + 10.0f;
|
||||
velocity.z = Math_Coss(arg2) * 3.0f;
|
||||
velocity.x = Math_SinS(arg2) * 3.0f;
|
||||
velocity.y = (Rand_ZeroOne() * -4.0f) + 10.0f;
|
||||
velocity.z = Math_CosS(arg2) * 3.0f;
|
||||
|
||||
pos.x += arg1->x;
|
||||
pos.y += arg1->y;
|
||||
pos.z += arg1->z;
|
||||
|
||||
temp_f0 = Math_Rand_ZeroOne();
|
||||
temp_f0 = Rand_ZeroOne();
|
||||
|
||||
if (temp_f0 < 0.1f) {
|
||||
phi_s0 = 97;
|
||||
@@ -263,8 +263,8 @@ void func_8097E1D4(GlobalContext* globalCtx, Vec3f* arg1, s16 arg2) {
|
||||
}
|
||||
|
||||
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, arg1, -247, phi_s0, 3, 0, 0,
|
||||
(s32)((Math_Rand_ZeroOne() * 10.0f) + 30.0f), 2, 300,
|
||||
(s32)(Math_Rand_ZeroOne() * 0.0f) + 30, KAKERA_COLOR_NONE, OBJECT_GEFF, D_06000EA0);
|
||||
(s32)((Rand_ZeroOne() * 10.0f) + 30.0f), 2, 300, (s32)(Rand_ZeroOne() * 0.0f) + 30,
|
||||
KAKERA_COLOR_NONE, OBJECT_GEFF, D_06000EA0);
|
||||
|
||||
angle += 0x10000;
|
||||
}
|
||||
@@ -288,13 +288,13 @@ void func_8097E454(GlobalContext* globalCtx, Vec3f* spawnerPos, Vec3f* velocity,
|
||||
|
||||
for (i = frames; i < arg6; i += arg7) {
|
||||
|
||||
pos.x = (Math_Sins(phi_s0) * arg4) + spawnerPos->x;
|
||||
pos.x = (Math_SinS(phi_s0) * arg4) + spawnerPos->x;
|
||||
pos.y = spawnerPos->y;
|
||||
pos.z = (Math_Coss(phi_s0) * arg4) + spawnerPos->z;
|
||||
pos.z = (Math_CosS(phi_s0) * arg4) + spawnerPos->z;
|
||||
|
||||
DemoGt_SpawnDust(globalCtx, &pos, velocity, accel, dustScale, dustScaleStep, life);
|
||||
|
||||
if (Math_Rand_ZeroOne() <= 0.05f) {
|
||||
if (Rand_ZeroOne() <= 0.05f) {
|
||||
func_8097E1D4(globalCtx, &pos, phi_s0);
|
||||
}
|
||||
|
||||
@@ -434,9 +434,9 @@ void func_8097E824(DemoGt* this, s32 arg1) {
|
||||
unk16C->y += phi_a2;
|
||||
unk16C->z += phi_a3;
|
||||
|
||||
tempf1 = Math_Coss(unk16C->x) * phi_f14;
|
||||
tempf2 = Math_Coss(unk16C->y) * phi_f12;
|
||||
tempf3 = Math_Coss(unk16C->z) * phi_f2;
|
||||
tempf1 = Math_CosS(unk16C->x) * phi_f14;
|
||||
tempf2 = Math_CosS(unk16C->y) * phi_f12;
|
||||
tempf3 = Math_CosS(unk16C->z) * phi_f2;
|
||||
|
||||
pos->x += tempf1;
|
||||
pos->y += tempf2;
|
||||
@@ -660,16 +660,16 @@ void DemoGt_Draw1(DemoGt* this, GlobalContext* globalCtx) {
|
||||
spB8 = (s16)((s32)kREG(70)) + 0x4000;
|
||||
spBA = kREG(70);
|
||||
spB4 = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
sp98 = 1.0f - Math_Coss(spC6);
|
||||
sp98 = 1.0f - Math_CosS(spC6);
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_gt_part1.c", 458);
|
||||
|
||||
spA8.x = Math_Coss(spB8);
|
||||
spA8.x = Math_CosS(spB8);
|
||||
spA8.y = 0.0f;
|
||||
spA8.z = Math_Sins(spB8);
|
||||
sp9C.x = Math_Coss(spBA) * spBC * sp98;
|
||||
sp9C.y = Math_Sins(spC6) * spBC;
|
||||
sp9C.z = Math_Sins(spBA) * spBC * sp98;
|
||||
spA8.z = Math_SinS(spB8);
|
||||
sp9C.x = Math_CosS(spBA) * spBC * sp98;
|
||||
sp9C.y = Math_SinS(spC6) * spBC;
|
||||
sp9C.z = Math_SinS(spBA) * spBC * sp98;
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
@@ -1281,17 +1281,17 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx) {
|
||||
sp6A = kREG(58);
|
||||
gfxCtx = globalCtx2->state.gfxCtx;
|
||||
sp60 = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
sp44 = 1.0f - Math_Coss(sp76);
|
||||
sp44 = 1.0f - Math_CosS(sp76);
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_gt_part4_1.c", 217);
|
||||
|
||||
sp54.x = Math_Coss(sp68);
|
||||
sp54.x = Math_CosS(sp68);
|
||||
sp54.y = 0.0f;
|
||||
sp54.z = Math_Sins(sp68);
|
||||
sp54.z = Math_SinS(sp68);
|
||||
|
||||
sp48.x = (Math_Coss(sp6A) * sp6C) * sp44;
|
||||
sp48.y = Math_Sins(sp76) * sp6C;
|
||||
sp48.z = (Math_Sins(sp6A) * sp6C) * sp44;
|
||||
sp48.x = (Math_CosS(sp6A) * sp6C) * sp44;
|
||||
sp48.y = Math_SinS(sp76) * sp6C;
|
||||
sp48.z = (Math_SinS(sp6A) * sp6C) * sp44;
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
@@ -1400,17 +1400,17 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) {
|
||||
sp68 = (s16)(kREG(59) - 0x4000) + 0x4000;
|
||||
gfxCtx = globalCtx->state.gfxCtx;
|
||||
sp60 = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
sp44 = 1 - Math_Coss(sp76);
|
||||
sp44 = 1 - Math_CosS(sp76);
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_gt_part4_2.c", 212);
|
||||
|
||||
sp54.x = Math_Coss(sp68);
|
||||
sp54.x = Math_CosS(sp68);
|
||||
sp54.y = 0.0f;
|
||||
sp54.z = Math_Sins(sp68);
|
||||
sp54.z = Math_SinS(sp68);
|
||||
|
||||
sp48.x = Math_Coss(sp6A) * sp6C * sp44;
|
||||
sp48.y = Math_Sins(sp76) * sp6C;
|
||||
sp48.z = Math_Sins(sp6A) * sp6C * sp44;
|
||||
sp48.x = Math_CosS(sp6A) * sp6C * sp44;
|
||||
sp48.y = Math_SinS(sp76) * sp6C;
|
||||
sp48.z = Math_SinS(sp6A) * sp6C * sp44;
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
@@ -1496,17 +1496,17 @@ void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) {
|
||||
sp6C += 0x4000;
|
||||
gfxCtx = globalCtx->state.gfxCtx;
|
||||
sp64 = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
sp48 = 1.0f - Math_Coss(sp78);
|
||||
sp48 = 1.0f - Math_CosS(sp78);
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_gt_part4_3.c", 276);
|
||||
|
||||
sp58.x = Math_Coss(sp6C);
|
||||
sp58.x = Math_CosS(sp6C);
|
||||
sp58.y = 0.0f;
|
||||
sp58.z = Math_Sins(sp6C);
|
||||
sp58.z = Math_SinS(sp6C);
|
||||
|
||||
sp4C.x = Math_Coss(sp6E) * sp70 * sp48;
|
||||
sp4C.y = Math_Sins(sp78) * sp70;
|
||||
sp4C.z = Math_Sins(sp6E) * sp70 * sp48;
|
||||
sp4C.x = Math_CosS(sp6E) * sp70 * sp48;
|
||||
sp4C.y = Math_SinS(sp78) * sp70;
|
||||
sp4C.z = Math_SinS(sp6E) * sp70 * sp48;
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
@@ -1588,17 +1588,17 @@ void DemoGt_Draw7(DemoGt* this, GlobalContext* globalCtx) {
|
||||
sp60 = kREG(74) + 0x7FEC;
|
||||
sp60 = sp60 + 0x4000;
|
||||
sp5C = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
sp40 = 1.0f - Math_Coss(sp6E);
|
||||
sp40 = 1.0f - Math_CosS(sp6E);
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_gt_part5.c", 136);
|
||||
|
||||
sp50.x = Math_Coss(sp60);
|
||||
sp50.x = Math_CosS(sp60);
|
||||
sp50.y = 0.0f;
|
||||
sp50.z = Math_Sins(sp60);
|
||||
sp50.z = Math_SinS(sp60);
|
||||
|
||||
sp44.x = (Math_Coss(sp62) * sp64) * sp40;
|
||||
sp44.y = Math_Sins(sp6E) * sp64;
|
||||
sp44.z = (Math_Sins(sp62) * sp64) * sp40;
|
||||
sp44.x = (Math_CosS(sp62) * sp64) * sp40;
|
||||
sp44.y = Math_SinS(sp6E) * sp64;
|
||||
sp44.z = (Math_SinS(sp62) * sp64) * sp40;
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
@@ -1679,17 +1679,17 @@ void DemoGt_Draw8(DemoGt* this, GlobalContext* globalCtx) {
|
||||
sp60 = kREG(77) + 0xBE80;
|
||||
sp60 += 0x4000;
|
||||
sp5C = Graph_Alloc(gfxCtx, sizeof(Mtx));
|
||||
sp40 = 1.0f - Math_Coss(sp6E);
|
||||
sp40 = 1.0f - Math_CosS(sp6E);
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_gt_part6.c", 137);
|
||||
|
||||
sp50.x = Math_Coss(sp60);
|
||||
sp50.x = Math_CosS(sp60);
|
||||
sp50.y = 0.0f;
|
||||
sp50.z = Math_Sins(sp60);
|
||||
sp50.z = Math_SinS(sp60);
|
||||
|
||||
sp44.x = Math_Coss(sp62) * sp64 * sp40;
|
||||
sp44.y = Math_Sins(sp6E) * sp64;
|
||||
sp44.z = Math_Sins(sp62) * sp64 * sp40;
|
||||
sp44.x = Math_CosS(sp62) * sp64 * sp40;
|
||||
sp44.y = Math_SinS(sp6E) * sp64;
|
||||
sp44.z = Math_SinS(sp62) * sp64 * sp40;
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user