sys_math.c Rename (#1258)

* rename via comments

* missed a comment

* math header

* name boot_80086760.c functions

* PR Review

* rm cam comment

* Elliptic review

* alphabetical
This commit is contained in:
engineer124
2023-06-05 22:16:34 -04:00
committed by GitHub
parent f92a61db27
commit 7f5087d0b2
140 changed files with 916 additions and 955 deletions
+2 -99
View File
@@ -129,39 +129,6 @@ void MtxConv_L2F(MtxF* mtx, Mtx* mf);
void __assert(const char* file, u32 lineNum);
// void func_800862B4(void);
s32 func_80086620(OSMesgQueue* param_1, PadMgr* param_2, OSContStatus* param_3);
f32 func_80086760(f32 x);
// void func_80086794(void);
// void func_800867B4(void);
// void func_800867D4(void);
// void func_800867F4(void);
f32 func_80086814(f32 x);
// void func_80086834(void);
// void func_80086880(void);
// void func_800869A4(void);
// void func_80086AF0(void);
f32 func_80086B30(f32 y, f32 x);
// void func_80086C18(void);
f32 func_80086C48(f32 x);
// void func_80086C70(void);
f64 func_80086C7C(f64 param_1);
s32 func_80086C88(f32 param_1);
s32 func_80086C98(f64 param_1);
// void func_80086CA8(void);
f64 func_80086CB4(f64 param_1);
s32 func_80086CC0(f32 param_1);
s32 func_80086CD0(f64 param_1);
// void func_80086CE0(void);
f64 func_80086CEC(f64 param_1);
s32 func_80086CF8(f32 param_1);
s32 func_80086D08(f64 param_1);
// void func_80086D18(void);
f64 func_80086D24(f64);
s32 func_80086D30(f32 param_1);
s32 func_80086D40(f64 param_1);
// void func_80086D50(void);
f64 func_80086D6C(f64 param_1);
s32 func_80086D8C(f32 param_1);
s32 func_80086DAC(f64 param_1);
u32 Rand_Next(void);
void Rand_Seed(u32 seed);
@@ -1161,70 +1128,17 @@ void func_800FEA50(PlayState* play);
void func_800FEAB0(void);
// void func_800FEAC0(void);
void func_800FEAF4(EnvironmentContext* envCtx);
void* Lib_MemCpy(void* dest, void* src, size_t size);
void* Lib_MemSet(void* buffer, s32 value, size_t size);
f32 Math_CosS(s16 angle);
f32 Math_SinS(s16 angle);
s32 Math_StepToIImpl(s32 start, s32 target, s32 step);
void Math_StepToIGet(s32* pValue, s32 target, s32 step);
s32 Math_StepToI(s32* pValue, s32 target, s32 step);
s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step);
s32 Math_StepToS(s16* pValue, s16 target, s16 step);
s32 Math_StepToC(s8* pValue, s8 target, s8 step);
s32 Math_StepToF(f32* pValue, f32 target, f32 step);
s32 Math_StepUntilAngleS(s16* pValue, s16 target, s16 step);
s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step);
s32 Math_AsymStepToS(s16* pValue, s16 target, s16 incrStep, s16 decrStep);
s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step);
s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep);
void func_800FF3A0(f32* distOut, s16* angleOut, Input* input);
s16 Rand_S16Offset(s16 base, s16 range);
s16 Rand_S16OffsetStride(s16 base, s16 stride, s16 range);
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src);
void Math_Vec3s_Copy(Vec3s* dest, Vec3s* src);
void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src);
void Math_Vec3f_ToVec3s(Vec3s* dest, Vec3f* src);
void Math_Vec3f_Sum(Vec3f* l, Vec3f* r, Vec3f* dest);
void Math_Vec3f_Diff(Vec3f* l, Vec3f* r, Vec3f* dest);
void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* l, Vec3s* r);
void Math_Vec3f_Scale(Vec3f* vec, f32 scale);
void Math_Vec3f_ScaleAndStore(Vec3f* vec, f32 scale, Vec3f* dest);
void Math_Vec3f_Lerp(Vec3f* a, Vec3f* b, f32 t, Vec3f* dest);
void Math_Vec3f_SumScaled(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest);
void Math_Vec3f_AddRand(Vec3f* orig, f32 scale, Vec3f* dest);
void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest);
f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b);
f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest);
f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b);
f32 Math_Vec3f_DistXZAndStore(Vec3f* a, Vec3f* b, f32* dx, f32* dz);
f32 Math_Vec3f_StepToXZ(Vec3f* start, Vec3f* target, f32 speed);
f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b);
s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b);
s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b);
void Actor_ProcessInitChain(Actor* actor, InitChainEntry* ichain);
// void IChain_Apply_u8(u8* actor, InitChainEntry* init);
// void IChain_Apply_s8(u8* actor, InitChainEntry* init);
// void IChain_Apply_u16(u8* actor, InitChainEntry* init);
// void IChain_Apply_s16(u8* actor, InitChainEntry* init);
// void IChain_Apply_u32(u8* actor, InitChainEntry* init);
// void IChain_Apply_s32(u8* actor, InitChainEntry* init);
// void IChain_Apply_f32(u8* actor, InitChainEntry* init);
// void IChain_Apply_f32div1000(u8* actor, InitChainEntry* init);
// void IChain_Apply_Vec3f(u8* actor, InitChainEntry* init);
// void IChain_Apply_Vec3fdiv1000(u8* actor, InitChainEntry* init);
// void IChain_Apply_Vec3s(u8* actor, InitChainEntry* init);
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep);
void Math_ApproachF(f32* pValue, f32 target, f32 scale, f32 maxStep);
void Math_ApproachZeroF(f32* pValue, f32 scale, f32 maxStep);
s16 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep);
void Math_ApproachS(s16* pValue, s16 target, s16 scale, s16 maxStep);
void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src);
void func_801000A4(u16 sfxId);
void func_801000CC(u16 sfxId);
void Lib_PlaySfxAtPos(Vec3f* pos, u16 sfxId);
void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 rotAngle, Vec3f* src, Vec3f* dst);
void Lib_LerpRGB(Color_RGB8* a, Color_RGB8* b, f32 t, Color_RGB8* dst);
f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed);
void Lib_Nop801004FC(void);
void* Lib_SegmentedToVirtual(void* ptr);
void* Lib_SegmentedToVirtualNull(void* ptr);
@@ -2056,13 +1970,7 @@ void CmpDma_LoadAllFiles(uintptr_t segmentVrom, void* dst, size_t size);
// void Check_DrawRegionLockErrorMessage(void);
void Check_ExpansionPak(void);
void Check_RegionIsSupported(void);
f32 func_80179300(f32 n);
f32 func_80179400(s32 n);
f32 pow_int(f32 base, s32 exp);
f32 sin_rad(f32 rad);
f32 cos_rad(f32 rad);
f32 Rand_ZeroFloat(f32 scale);
f32 randPlusMinusPoint5Scaled(f32 scale);
f32 Math3D_Normalize(Vec3f* vec);
s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* closestPoint);
s32 func_80179798(Vec3f* param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, Vec3f* param_5, Vec3f* param_6);
@@ -2158,11 +2066,6 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z);
// void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11);
// void func_8017FD44(void);
s16 Math_Atan2S(f32 y, f32 x);
f32 Math_Atan2F(f32 y, f32 x);
s16 Math_Atan2S_XY(f32 x, f32 y);
f32 Math_Atan2F_XY(f32 x, f32 y);
u64* SysUcode_GetUCodeBoot(void);
size_t SysUcode_GetUCodeBootSize(void);
u64* SysUcode_GetUCode(void);
-1
View File
@@ -755,7 +755,6 @@ extern s32 gScreenWidth;
extern s32 gScreenHeight;
extern u32 startHeapSize;
extern UNK_PTR D_801D1540;
// extern f32 sFactorialTbl[13];
extern Vec3f gZeroVec3f;
extern Vec3s gZeroVec3s;
+71
View File
@@ -168,4 +168,75 @@ typedef enum {
#define SQXYZ(vec) ((vec.x) * (vec.x) + (vec.y) * (vec.y) + (vec.z) * (vec.z))
#define DOTXYZ(vec1, vec2) ((vec1.x) * (vec2.x) + (vec1.y) * (vec2.y) + (vec1.z) * (vec2.z))
f32 Math_CosS(s16 angle);
f32 Math_SinS(s16 angle);
s32 Math_StepToIImpl(s32 start, s32 target, s32 step);
void Math_StepToIGet(s32* pValue, s32 target, s32 step);
s32 Math_StepToI(s32* pValue, s32 target, s32 step);
s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step);
s32 Math_StepToS(s16* pValue, s16 target, s16 step);
s32 Math_StepToC(s8* pValue, s8 target, s8 step);
s32 Math_StepToF(f32* pValue, f32 target, f32 step);
s32 Math_StepUntilAngleS(s16* pValue, s16 target, s16 step);
s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step);
s32 Math_AsymStepToS(s16* pValue, s16 target, s16 incrStep, s16 decrStep);
s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step);
s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep);
s16 Rand_S16Offset(s16 base, s16 range);
s16 Rand_S16OffsetStride(s16 base, s16 stride, s16 range);
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src);
void Math_Vec3s_Copy(Vec3s* dest, Vec3s* src);
void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src);
void Math_Vec3f_ToVec3s(Vec3s* dest, Vec3f* src);
void Math_Vec3f_Sum(Vec3f* l, Vec3f* r, Vec3f* dest);
void Math_Vec3f_Diff(Vec3f* l, Vec3f* r, Vec3f* dest);
void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* l, Vec3s* r);
void Math_Vec3f_Scale(Vec3f* vec, f32 scale);
void Math_Vec3f_ScaleAndStore(Vec3f* vec, f32 scale, Vec3f* dest);
void Math_Vec3f_Lerp(Vec3f* a, Vec3f* b, f32 t, Vec3f* dest);
void Math_Vec3f_SumScaled(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest);
void Math_Vec3f_AddRand(Vec3f* orig, f32 scale, Vec3f* dest);
void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest);
f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b);
f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest);
f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b);
f32 Math_Vec3f_DistXZAndStore(Vec3f* a, Vec3f* b, f32* dx, f32* dz);
f32 Math_Vec3f_StepToXZ(Vec3f* start, Vec3f* target, f32 speed);
f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b);
s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b);
s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b);
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep);
void Math_ApproachF(f32* pValue, f32 target, f32 scale, f32 maxStep);
void Math_ApproachZeroF(f32* pValue, f32 scale, f32 maxStep);
s16 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep);
void Math_ApproachS(s16* pValue, s16 target, s16 scale, s16 maxStep);
f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed);
f32 Math_FactorialF(f32 n);
f32 Math_Factorial(s32 n);
f32 Math_PowF(f32 base, s32 exp);
f32 Math_SinF(f32 rad);
f32 Math_CosF(f32 rad);
f32 Rand_ZeroFloat(f32 scale);
f32 Rand_CenteredFloat(f32 scale);
f32 Math_FTanF(f32 x);
f32 Math_FFloorF(f32 x);
f32 Math_FCeilF(f32 x);
f32 Math_FRoundF(f32 x);
f32 Math_FTruncF(f32 x);
f32 Math_FNearbyIntF(f32 x);
f32 Math_FAtanTaylorQF(f32 x);
f32 Math_FAtanTaylorF(f32 x);
f32 Math_FAtanContFracF(f32 x);
f32 Math_FAtanF(f32 x);
f32 Math_FAtan2F(f32 y, f32 x);
f32 Math_FAsinF(f32 x);
f32 Math_FAcosF(f32 x);
s16 Math_Atan2S(f32 y, f32 x);
f32 Math_Atan2F(f32 y, f32 x);
s16 Math_Atan2S_XY(f32 x, f32 y);
f32 Math_Atan2F_XY(f32 x, f32 y);
#endif
+29 -48
View File
@@ -5,57 +5,44 @@
#include "global.h"
#include "fixed_point.h"
extern f32 func_80086C70(f32 x);
extern f32 func_80086CA8(f32 x);
extern f32 func_80086D50(f32 x);
extern f32 func_80086CE0(f32 x);
extern f32 func_80086D18(f32 x);
s32 gUseAtanContFrac;
/**
* Tangent function computed using libultra sinf and cosf
*/
// Math_FTanF
f32 func_80086760(f32 x) {
f32 Math_FTanF(f32 x) {
return sinf(x) / cosf(x);
}
// Unused
// Math_FFloorF
f32 func_80086794(f32 x) {
return func_80086C70(x);
f32 Math_FFloorF(f32 x) {
return floorf(x);
}
// Unused
// Math_FCeilF
f32 func_800867B4(f32 x) {
return func_80086CA8(x);
f32 Math_FCeilF(f32 x) {
return ceilf(x);
}
// Unused
// Math_FRoundF
f32 func_800867D4(f32 x) {
return func_80086D50(x);
f32 Math_FRoundF(f32 x) {
return roundf(x);
}
// Unused
// Math_FTruncF
f32 func_800867F4(f32 x) {
return func_80086CE0(x);
f32 Math_FTruncF(f32 x) {
return truncf(x);
}
// Math_FNearbyIntF
f32 func_80086814(f32 x) {
return func_80086D18(x);
f32 Math_FNearbyIntF(f32 x) {
return nearbyintf(x);
}
/**
* Arctangent approximation using a Maclaurin series [https://mathworld.wolfram.com/MaclaurinSeries.html]
* (one quadrant, i.e. |x| < 1)
*/
// Math_FAtanTaylorQF
f32 func_80086834(f32 x) {
f32 Math_FAtanTaylorQF(f32 x) {
// Coefficients of Maclaurin series of arctangent
static const f32 coeffs[] = {
-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,
@@ -84,10 +71,9 @@ f32 func_80086834(f32 x) {
* Extends previous arctangent function to the rest of the real numbers.
* Uses the formulae arctan(x) = pi/2 - arctan(1/x)
* and arctan(x) = pi/4 - arctan( (1-x)/(1+x) )
* to extend the range in which the series computed by func_80086834 is a good approximation
* to extend the range in which the series computed by Math_FAtanTaylorQF is a good approximation
*/
// Math_FAtanTaylorF
f32 func_80086880(f32 x) {
f32 Math_FAtanTaylorF(f32 x) {
f32 t;
f32 q;
@@ -102,13 +88,13 @@ f32 func_80086880(f32 x) {
}
if (t <= M_SQRT2 - 1.0f) {
return func_80086834(x);
return Math_FAtanTaylorQF(x);
}
if (t >= M_SQRT2 + 1.0f) {
q = M_PI / 2 - func_80086834(1.0f / t);
q = M_PI / 2 - Math_FAtanTaylorQF(1.0f / t);
} else { // in the interval (\sqrt{2} - 1, \sqrt{2} + 1)
q = M_PI / 4 - func_80086834((1.0f - t) / (1.0f + t));
q = M_PI / 4 - Math_FAtanTaylorQF((1.0f - t) / (1.0f + t));
}
if (x > 0.0f) {
@@ -123,8 +109,7 @@ f32 func_80086880(f32 x) {
* Cf. https://en.wikipedia.org/wiki/Gauss%27s_continued_fraction#The_series_2F1_2 ,
* https://dlmf.nist.gov/4.25#E4
*/
// Math_FAtanContFracF
f32 func_800869A4(f32 x) {
f32 Math_FAtanContFracF(f32 x) {
s32 sector;
f32 z;
f32 conv;
@@ -162,24 +147,22 @@ f32 func_800869A4(f32 x) {
}
}
// Math_FAtanF
/**
* Single-argument arctangent, only used by the two-argument function.
* Nothing else sets the bss variable gUseAtanContFrac, so the Maclaurin series is always used
*/
f32 func_80086AF0(f32 x) {
f32 Math_FAtanF(f32 x) {
if (!gUseAtanContFrac) {
return func_80086880(x);
return Math_FAtanTaylorF(x);
} else {
return func_800869A4(x);
return Math_FAtanContFracF(x);
}
}
// Math_FAtan2F
/**
* Main two-argument arctangent function
*/
f32 func_80086B30(f32 y, f32 x) {
f32 Math_FAtan2F(f32 y, f32 x) {
if (x == 0.0f) {
if (y == 0.0f) {
return 0.0f;
@@ -191,20 +174,18 @@ f32 func_80086B30(f32 y, f32 x) {
return qNaN0x10000;
}
} else if (x >= 0.0f) {
return func_80086AF0(y / x);
return Math_FAtanF(y / x);
} else if (y < 0.0f) {
return func_80086AF0(y / x) - M_PI;
return Math_FAtanF(y / x) - M_PI;
} else {
return M_PI - func_80086AF0(-(y / x));
return M_PI - Math_FAtanF(-(y / x));
}
}
// Math_FAsinF
f32 func_80086C18(f32 x) {
return func_80086B30(x, sqrtf(1.0f - SQ(x)));
f32 Math_FAsinF(f32 x) {
return Math_FAtan2F(x, sqrtf(1.0f - SQ(x)));
}
// Math_FAcosF
f32 func_80086C48(f32 x) {
return M_PI / 2 - func_80086C18(x);
f32 Math_FAcosF(f32 x) {
return M_PI / 2 - Math_FAsinF(x);
}
+19 -14
View File
@@ -4,15 +4,17 @@
*/
#include "global.h"
static 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 };
static 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,
};
// Rename to Math_FactorialF
/**
* Takes a float, returns the factorial of it(s trunctation), iteratively
* Unused
*
* @remark original name: "ffact"
*/
f32 func_80179300(f32 n) {
f32 Math_FactorialF(f32 n) {
f32 ret = 1.0f;
s32 i;
@@ -23,12 +25,13 @@ f32 func_80179300(f32 n) {
return ret;
}
// Rename to Math_Factorial
/**
* Takes an int and returns its factorial as a float. Uses the lookup table for n <= 12.
* Unused
*
* @remark original name: "ifact"
*/
f32 func_80179400(s32 n) {
f32 Math_Factorial(s32 n) {
f32 ret;
s32 i;
@@ -45,12 +48,13 @@ f32 func_80179400(s32 n) {
return ret;
}
// Rename to Math_PowF
/**
* Returns base^{exp} if exp is nonnegative and 1.0f otherwise.
* Unused
*
* @remark original name: "powi"
*/
f32 pow_int(f32 base, s32 exp) {
f32 Math_PowF(f32 base, s32 exp) {
f32 ret = 1.0f;
while (exp > 0) {
@@ -61,19 +65,21 @@ f32 pow_int(f32 base, s32 exp) {
return ret;
}
// Rename to Math_SinF
/**
* Takes an angle in radians and returns the sine.
*
* @remark original name: "sinf_table"
*/
f32 sin_rad(f32 rad) {
f32 Math_SinF(f32 rad) {
return sins(RAD_TO_BINANG(rad)) * SHT_MINV;
}
// Rename to Math_CosF
/**
* Takes an angle in radians and returns the cosine.
*
* @remark original name: "cosf_table"
*/
f32 cos_rad(f32 rad) {
f32 Math_CosF(f32 rad) {
return coss(RAD_TO_BINANG(rad)) * SHT_MINV;
}
@@ -84,10 +90,9 @@ f32 Rand_ZeroFloat(f32 scale) {
return Rand_ZeroOne() * scale;
}
// Rename to Rand_CenteredFloat
/**
* Returns a pseudo-random floating-point number between (- scale / 2) and (scale / 2). Originally in z_actor in OoT.
*/
f32 randPlusMinusPoint5Scaled(f32 scale) {
f32 Rand_CenteredFloat(f32 scale) {
return Rand_Centered() * scale;
}
+9 -9
View File
@@ -3567,8 +3567,8 @@ void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 r
accel.y += (Rand_ZeroOne() - 0.5f) * 0.2f;
for (i = countMinusOne; i >= 0; i--) {
pos.x = (sin_rad(angle) * radius) + posXZ->x;
pos.z = (cos_rad(angle) * radius) + posXZ->z;
pos.x = (Math_SinF(angle) * radius) + posXZ->x;
pos.z = (Math_CosF(angle) * radius) + posXZ->z;
accel.x = (Rand_ZeroOne() - 0.5f) * randAccelWeight;
accel.z = (Rand_ZeroOne() - 0.5f) * randAccelWeight;
@@ -4816,7 +4816,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16
// Apply and draw a light orb over each limb of frozen actor
for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) {
Matrix_RotateZF(randPlusMinusPoint5Scaled(2 * M_PI), MTXMODE_APPLY);
Matrix_RotateZF(Rand_CenteredFloat(2 * M_PI), MTXMODE_APPLY);
currentMatrix->mf[3][0] = limbPos->x;
currentMatrix->mf[3][1] = limbPos->y;
currentMatrix->mf[3][2] = limbPos->z;
@@ -4857,9 +4857,9 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16
// first electric spark
Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI));
Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
currentMatrix->mf[3][0] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->x;
currentMatrix->mf[3][1] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->y;
currentMatrix->mf[3][2] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->z;
currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->x;
currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->y;
currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->z;
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -4869,9 +4869,9 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16
// second electric spark
Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI));
Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY);
currentMatrix->mf[3][0] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->x;
currentMatrix->mf[3][1] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->y;
currentMatrix->mf[3][2] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->z;
currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->x;
currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->y;
currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + limbPos->z;
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+2 -1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "fixed_point.h"
#include "vt.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
@@ -3047,7 +3048,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
newPoly->normal.z = COLPOLY_SNORMAL(newNormal.z);
}
newPoly->dist = func_80086D24(-DOTXYZ(newNormal, vtxA));
newPoly->dist = nearbyint(-DOTXYZ(newNormal, vtxA));
if (newNormal.y > 0.5f) {
s16 polyId = *polyStartIndex + i;
+16 -17
View File
@@ -875,7 +875,7 @@ void func_800CC938(Camera* camera) {
* Calculates the angle between points `from` and `to`
*/
s16 Camera_CalcXZAngle(Vec3f* to, Vec3f* from) {
return CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(from->x - to->x, from->z - to->z)));
return CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(from->x - to->x, from->z - to->z)));
}
// BSS
@@ -964,8 +964,8 @@ s16 Camera_GetPitchAdjFromFloorHeightDiffs(Camera* camera, s16 viewYaw, s16 shou
floorYDiffNear = (sFloorYNear - camera->focalActorFloorHeight) * 0.8f;
floorYDiffFar = (sFloorYFar - camera->focalActorFloorHeight) * (20.0f * 0.01f);
pitchNear = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(floorYDiffNear, nearDist)));
pitchFar = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(floorYDiffFar, farDist)));
pitchNear = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(floorYDiffNear, nearDist)));
pitchFar = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(floorYDiffFar, farDist)));
return pitchNear + pitchFar;
}
@@ -1457,9 +1457,8 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecGeo* arg1, f32 yOffset, f32 xzOf
deltaY = focalActorPosRot->pos.y - *focalActorPosY;
eyeAtDistXZ = OLib_Vec3fDistXZ(at, &camera->eye);
// Math_FTanF
// Get the height based on 80% of the fov
fovHeight = func_80086760(DEG_TO_RAD(camera->fov * (0.8f * 0.5f))) * eyeAtDistXZ;
fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * (0.8f * 0.5f))) * eyeAtDistXZ;
if (deltaY > fovHeight) {
//! FAKE
@@ -1539,8 +1538,8 @@ s32 Camera_CalcAtForFriendlyLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targ
deltaY = focalActorPosRot->pos.y - *yPosOffset;
sp50 = OLib_Vec3fDistXZ(at, &camera->eye);
phi_f16 = sp50;
func_80086B30(deltaY, sp50);
fovHeight = func_80086760(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16;
Math_FAtan2F(deltaY, sp50);
fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * 0.4f)) * phi_f16;
if (fovHeight < deltaY) {
*yPosOffset += deltaY - fovHeight;
@@ -1552,12 +1551,12 @@ s32 Camera_CalcAtForFriendlyLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targ
focalActorAtOffsetTarget.y -= deltaY;
} else {
deltaY = focalActorPosRot->pos.y - *yPosOffset;
temp_f0_6 = func_80086B30(deltaY, OLib_Vec3fDistXZ(at, &camera->eye));
temp_f0_6 = Math_FAtan2F(deltaY, OLib_Vec3fDistXZ(at, &camera->eye));
if (temp_f0_6 > 0.34906584f) { // (M_PI / 9)
phi_f16 = 1.0f - sin_rad(temp_f0_6 - 0.34906584f);
phi_f16 = 1.0f - Math_SinF(temp_f0_6 - 0.34906584f);
} else if (temp_f0_6 < -0.17453292f) { // (M_PI / 18)
phi_f16 = 1.0f - sin_rad(-0.17453292f - temp_f0_6);
phi_f16 = 1.0f - Math_SinF(-0.17453292f - temp_f0_6);
} else {
phi_f16 = 1.0f;
}
@@ -1625,10 +1624,10 @@ s32 Camera_CalcAtForEnemyLockOn(Camera* camera, f32* arg1, s32 arg2, f32 yOffset
new_var2 = *arg1;
sp4C = new_var2;
deltaY = focalActorPosRot->pos.y - *arg6;
temp_f0_3 = func_80086B30(deltaY, sp4C);
temp_f0_3 = Math_FAtan2F(deltaY, sp4C);
if (!(flags & 0x80)) {
fovHeight = func_80086760(DEG_TO_RAD(camera->fov * 0.4f)) * sp4C;
fovHeight = Math_FTanF(DEG_TO_RAD(camera->fov * 0.4f)) * sp4C;
if (fovHeight < deltaY) {
*arg6 += deltaY - fovHeight;
@@ -1641,9 +1640,9 @@ s32 Camera_CalcAtForEnemyLockOn(Camera* camera, f32* arg1, s32 arg2, f32 yOffset
focalActorAtOffsetTarget.y -= deltaY;
} else {
if (temp_f0_3 > 0.34906584f) { // (M_PI / 9)
phi_f14 = 1.0f - sin_rad(temp_f0_3 - 0.34906584f);
phi_f14 = 1.0f - Math_SinF(temp_f0_3 - 0.34906584f);
} else if (temp_f0_3 < -0.17453292f) { // (M_PI / 18)
phi_f14 = 1.0f - sin_rad(-0.17453292f - temp_f0_3);
phi_f14 = 1.0f - Math_SinF(-0.17453292f - temp_f0_3);
} else {
phi_f14 = 1.0f;
}
@@ -6343,8 +6342,8 @@ s32 Camera_Demo4(Camera* camera) {
// Camera fixed on human player as the mask moves from the pocket to the face
// Camera rolls left and right
if (rwData->timer >= 12) {
rwData->unk_0C = (rwData->timer - 12) * 10.384615f;
sin = sin_rad(DEG_TO_RAD(rwData->unk_0C));
rwData->unk_0C = (rwData->timer - 12) * (135.0f / 13.0f);
sin = Math_SinF(DEG_TO_RAD(rwData->unk_0C));
rwData->unk_0C = ((rwData->unk_10 < 0.0f) ? -1.0f : 1.0f) * sin;
if (rwData->timer == 12) {
Distortion_Request(DISTORTION_TYPE_MASK_TRANSFORM_1);
@@ -6516,7 +6515,7 @@ s32 Camera_Demo5(Camera* camera) {
// Camera zooms out while rolling back and forth
rwData->unk_0C = rwData->timer * (180.0f / 23.0f);
sp58 = DEG_TO_RAD(rwData->unk_0C);
sin = sin_rad(sp58);
sin = Math_SinF(sp58);
rwData->unk_0C = ((rwData->unk_10 < 0.0f) ? -1.0f : 1.0f) * sin;
new_var = (46 - rwData->timer) * (5.0f / 46.0f);
focalActorFocus.pos.x = (Math_SinS(rwData->unk_24) * new_var * rwData->unk_0C) + focalActorPosRot->pos.x;
+12 -12
View File
@@ -561,16 +561,16 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
vtx[0].v = baseVtx;
vtx[1].v = baseVtx;
vtx[0].v.ob[0] = func_80086814(sp158.x);
vtx[0].v.ob[1] = func_80086814(sp158.y);
vtx[0].v.ob[2] = func_80086814(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] = func_80086814(sp14C.x);
vtx[1].v.ob[1] = func_80086814(sp14C.y);
vtx[1].v.ob[2] = func_80086814(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;
@@ -606,17 +606,17 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
vtx[j1].v = baseVtx;
vtx[j2].v = baseVtx;
vtx[j1].v.ob[0] = func_80086814(sp158.x);
vtx[j1].v.ob[1] = func_80086814(sp158.y);
vtx[j1].v.ob[2] = func_80086814(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_800B0A24(sp1A4.r, sp19C.r, temp_f28);
vtx[j1].v.cn[1] = func_800B0A24(sp1A4.g, sp19C.g, temp_f28);
vtx[j1].v.cn[2] = func_800B0A24(sp1A4.b, sp19C.b, temp_f28);
vtx[j1].v.cn[3] = func_800B0A24(sp1A4.a, sp19C.a, temp_f28);
vtx[j2].v.ob[0] = func_80086814(sp14C.x);
vtx[j2].v.ob[1] = func_80086814(sp14C.y);
vtx[j2].v.ob[2] = func_80086814(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_800B0A24(sp1A0.r, sp198.r, temp_f28);
vtx[j2].v.cn[1] = func_800B0A24(sp1A0.g, sp198.g, temp_f28);
vtx[j2].v.cn[2] = func_800B0A24(sp1A0.b, sp198.b, temp_f28);
+6 -6
View File
@@ -127,7 +127,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
break;
case ITEM00_RECOVERY_HEART:
this->actor.home.rot.z = randPlusMinusPoint5Scaled(0xFFFF);
this->actor.home.rot.z = Rand_CenteredFloat(0xFFFF);
shadowOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->unk154 = 0.02f;
@@ -381,9 +381,9 @@ void func_800A6650(EnItem00* this, PlayState* play) {
}
if ((play->gameplayFrames & 1) != 0) {
pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(10.0f);
pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(10.0f);
pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(10.0f);
pos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f);
pos.y = this->actor.world.pos.y + Rand_CenteredFloat(10.0f);
pos.z = this->actor.world.pos.z + Rand_CenteredFloat(10.0f);
EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor);
}
@@ -956,7 +956,7 @@ Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) {
}
spawnedActor->speed = 2.0f;
spawnedActor->gravity = -0.9f;
spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000);
spawnedActor->world.rot.y = Rand_CenteredFloat(0x10000);
Actor_SetScale(spawnedActor, 0.0f);
((EnItem00*)spawnedActor)->actionFunc = func_800A6780;
((EnItem00*)spawnedActor)->unk152 = 0xDC;
@@ -1011,7 +1011,7 @@ Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) {
} else {
spawnedActor->gravity = -0.9f;
}
spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000);
spawnedActor->world.rot.y = Rand_CenteredFloat(0x10000);
spawnedActor->flags |= 0x10;
}
}
+3 -3
View File
@@ -348,9 +348,9 @@ void Math_Vec3f_SumScaled(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest) {
}
void Math_Vec3f_AddRand(Vec3f* orig, f32 scale, Vec3f* dest) {
dest->x = randPlusMinusPoint5Scaled(scale) + orig->x;
dest->y = randPlusMinusPoint5Scaled(scale) + orig->y;
dest->z = randPlusMinusPoint5Scaled(scale) + orig->z;
dest->x = Rand_CenteredFloat(scale) + orig->x;
dest->y = Rand_CenteredFloat(scale) + orig->y;
dest->z = Rand_CenteredFloat(scale) + orig->z;
}
void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* dest) {
+4 -4
View File
@@ -123,14 +123,14 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) {
if ((distXZ == 0.0f) && (vec->y == 0.0f)) {
sph.pitch = 0;
} else {
sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(distXZ, vec->y)));
sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(distXZ, vec->y)));
}
sph.r = sqrtf(SQ(vec->y) + distXZSq);
if ((vec->x == 0.0f) && (vec->z == 0.0f)) {
sph.yaw = 0;
} else {
sph.yaw = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(vec->x, vec->z)));
sph.yaw = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(vec->x, vec->z)));
}
*dest = sph;
@@ -202,8 +202,8 @@ Vec3f* OLib_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) {
Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b) {
Vec3f anglesRad;
anglesRad.x = func_80086B30(b->z - a->z, b->y - a->y);
anglesRad.y = func_80086B30(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;
+5 -7
View File
@@ -1540,10 +1540,8 @@ void Player_UpdateBunnyEars(Player* player) {
sBunnyEarKinematics.angVel.y += -sBunnyEarKinematics.rot.y >> 2;
angle = player->actor.world.rot.y - player->actor.shape.rot.y;
force.x =
(s32)(player->actor.speed * -200.0f * Math_CosS(angle) * (randPlusMinusPoint5Scaled(2.0f) + 10.0f)) & 0xFFFF;
force.y =
(s32)(player->actor.speed * 100.0f * Math_SinS(angle) * (randPlusMinusPoint5Scaled(2.0f) + 10.0f)) & 0xFFFF;
force.x = (s32)(player->actor.speed * -200.0f * Math_CosS(angle) * (Rand_CenteredFloat(2.0f) + 10.0f)) & 0xFFFF;
force.y = (s32)(player->actor.speed * 100.0f * Math_SinS(angle) * (Rand_CenteredFloat(2.0f) + 10.0f)) & 0xFFFF;
sBunnyEarKinematics.angVel.x += force.x >> 2;
sBunnyEarKinematics.angVel.y += force.y >> 2;
@@ -1801,7 +1799,7 @@ void Player_AdjustSingleLeg(PlayState* play, Player* player, SkelAnime* skelAnim
temp_f20 = sp74 - SQ(sp58);
temp_f20 = (temp_f20 < 0.0f) ? 0.0f : sqrtf(temp_f20);
sp4C = func_80086B30(temp_f20, sp58);
sp4C = Math_FAtan2F(temp_f20, sp58);
distance = sqrtf(SQ(diffX) + SQ(yIntersect - sp90.y) + SQ(diffZ));
sp58 = (SQ(distance) + sp70) / (2.0f * distance);
sp54 = distance - sp58;
@@ -1809,8 +1807,8 @@ void Player_AdjustSingleLeg(PlayState* play, Player* player, SkelAnime* skelAnim
temp_f20 = sp74 - SQ(sp58);
temp_f20 = (temp_f20 < 0.0f) ? 0.0f : sqrtf(temp_f20);
sp48 = func_80086B30(temp_f20, sp58);
phi_t1 = (M_PI - (func_80086B30(sp54, temp_f20) + ((M_PI / 2.0f) - sp48))) * (0x8000 / M_PI);
sp48 = Math_FAtan2F(temp_f20, sp58);
phi_t1 = (M_PI - (Math_FAtan2F(sp54, temp_f20) + ((M_PI / 2.0f) - sp48))) * (0x8000 / M_PI);
phi_t1 = -skelAnime->jointTable[shinLimbIndex].z + phi_t1;
temp_f8 = (sp48 - sp4C) * (0x8000 / M_PI);
+1 -1
View File
@@ -577,7 +577,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) {
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d);
if (((px * actor->world.pos.x) + (pz * actor->world.pos.z) + d) > 0.0f) {
reached = true;
}
@@ -64,10 +64,11 @@ void func_808D75F0(BgF40Flift* this, PlayState* play) {
}
this->timer--;
if (this->dyna.actor.params == 1) {
this->dyna.actor.world.pos.y = (sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f) + this->dyna.actor.home.pos.y;
this->dyna.actor.world.pos.y =
(Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f) + this->dyna.actor.home.pos.y;
} else {
this->dyna.actor.world.pos.y =
(sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y);
(Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y);
}
}
}
@@ -76,7 +77,7 @@ void func_808D7714(BgF40Flift* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
this->dyna.actor.world.pos.y =
(((cos_rad(this->timer * (M_PI / 96.0f)) * this->dyna.actor.params) + 1.0f) * 463.4f) +
(((Math_CosF(this->timer * (M_PI / 96.0f)) * this->dyna.actor.params) + 1.0f) * 463.4f) +
this->dyna.actor.home.pos.y;
} else {
this->dyna.actor.params = -this->dyna.actor.params;
@@ -105,7 +105,7 @@ void BgF40Swlift_Update(Actor* thisx, PlayState* play2) {
}
this->timer--;
this->dyna.actor.world.pos.y =
sHeights[this->dyna.actor.params] + (sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f);
sHeights[this->dyna.actor.params] + (Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f);
}
}
@@ -96,8 +96,8 @@ void BgIcefloe_Grow(BgIcefloe* this, PlayState* play) {
Vec3f velocity;
Vec3f position;
velocity.x = randPlusMinusPoint5Scaled(6.0f);
velocity.z = randPlusMinusPoint5Scaled(6.0f);
velocity.x = Rand_CenteredFloat(6.0f);
velocity.z = Rand_CenteredFloat(6.0f);
velocity.y = Rand_ZeroFloat(4.0f) + 4.0f;
this->dyna.actor.scale.x += (0.65f * 0.01f);
this->dyna.actor.scale.z += (0.65f * 0.01f);
@@ -127,7 +127,7 @@ void func_80AC4C34(BgIcefloe* this, PlayState* play) {
func_80AC4CF0(this);
} else {
this->dyna.actor.world.pos.y =
(sin_rad(this->timer * (M_PI / 30.0f)) * 3.0f) + (this->dyna.actor.home.pos.y + 10.0f);
(Math_SinF(this->timer * (M_PI / 30.0f)) * 3.0f) + (this->dyna.actor.home.pos.y + 10.0f);
}
}
@@ -144,8 +144,8 @@ void func_80AC4D2C(BgIcefloe* this, PlayState* play) {
Vec3f position;
velocity.y = (this->timer - 38) * (1 / 12.0f);
velocity.x = randPlusMinusPoint5Scaled(1.5f) * velocity.y;
velocity.z = randPlusMinusPoint5Scaled(1.5f) * velocity.y;
velocity.x = Rand_CenteredFloat(1.5f) * velocity.y;
velocity.z = Rand_CenteredFloat(1.5f) * velocity.y;
velocity.y += 0.8f;
position.x = this->dyna.actor.world.pos.x + (2.0f * velocity.x);
position.z = this->dyna.actor.world.pos.z + (2.0f * velocity.z);
@@ -109,12 +109,12 @@ void BgIcicle_Break(BgIcicle* this, PlayState* play, f32 arg2) {
for (i = 0; i < 2; i++) {
for (j = 0; j < 10; j++) {
pos.x = this->dyna.actor.world.pos.x + randPlusMinusPoint5Scaled(8.0f);
pos.x = this->dyna.actor.world.pos.x + Rand_CenteredFloat(8.0f);
pos.y = this->dyna.actor.world.pos.y + (Rand_ZeroOne() * arg2) + (i * arg2);
pos.z = this->dyna.actor.world.pos.z + randPlusMinusPoint5Scaled(8.0f);
pos.z = this->dyna.actor.world.pos.z + Rand_CenteredFloat(8.0f);
velocity.x = randPlusMinusPoint5Scaled(7.0f);
velocity.z = randPlusMinusPoint5Scaled(7.0f);
velocity.x = Rand_CenteredFloat(7.0f);
velocity.z = Rand_CenteredFloat(7.0f);
velocity.y = (Rand_ZeroOne() * 4.0f) + 8.0f;
EffectSsEnIce_Spawn(play, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &velocity, &accel, &primColor, &envColor,
@@ -240,7 +240,7 @@ void func_809CE234(BgSpdweb* this, PlayState* play) {
spA8.y = this->dyna.actor.world.pos.y;
for (i = 0; i < 6; i++) {
temp_s0 = (s32)randPlusMinusPoint5Scaled(10240.0f) + phi_s2;
temp_s0 = (s32)Rand_CenteredFloat(0x2800) + phi_s2;
temp_f24 = Math_SinS(temp_s0);
temp_f22 = Math_CosS(temp_s0);
@@ -323,7 +323,8 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) {
this->unk_162--;
}
this->dyna.actor.world.pos.y = (sin_rad(this->unk_162 * (M_PI / 6)) * this->unk_164) + this->dyna.actor.home.pos.y;
this->dyna.actor.world.pos.y =
(Math_SinF(this->unk_162 * (M_PI / 6)) * this->unk_164) + this->dyna.actor.home.pos.y;
Math_ApproachZeroF(&this->unk_164, 1.0f, 0.8f);
if (this->unk_162 == 4) {
@@ -388,7 +389,7 @@ void func_809CE830(BgSpdweb* this, PlayState* play) {
spC4.z = this->dyna.actor.world.pos.z + 90.0f * sinQ * cosF1;
for (i = 0; i < 6; i++) {
temp_s0 = (s32)randPlusMinusPoint5Scaled(0x2800) + temp_s3;
temp_s0 = (s32)Rand_CenteredFloat(0x2800) + temp_s3;
sinF2 = Math_SinS(temp_s0);
cosF2 = Math_CosS(temp_s0);
+19 -19
View File
@@ -485,9 +485,9 @@ void Boss02_SpawnEffectSand(TwinmoldEffect* effects, Vec3f* pos, f32 scale) {
if (effects->type == TWINMOLD_EFFECT_NONE) {
effects->type = TWINMOLD_EFFECT_SAND;
effects->pos = *pos;
effects->velocity.x = randPlusMinusPoint5Scaled(30.0f);
effects->velocity.x = Rand_CenteredFloat(30.0f);
effects->velocity.y = Rand_ZeroFloat(7.0f) + 7.0f;
effects->velocity.z = randPlusMinusPoint5Scaled(30.0f);
effects->velocity.z = Rand_CenteredFloat(30.0f);
effects->accel.y = -0.3f;
effects->scale = scale;
effects->alpha = 255;
@@ -507,9 +507,9 @@ void Boss02_SpawnEffectFragment(TwinmoldEffect* effects, Vec3f* pos) {
effects->type = TWINMOLD_EFFECT_FRAGMENT;
effects->pos = *pos;
effects->timer = Rand_ZeroFloat(20.0f);
effects->velocity.x = randPlusMinusPoint5Scaled(50.0f);
effects->velocity.y = randPlusMinusPoint5Scaled(50.0f);
effects->velocity.z = randPlusMinusPoint5Scaled(50.0f);
effects->velocity.x = Rand_CenteredFloat(50.0f);
effects->velocity.y = Rand_CenteredFloat(50.0f);
effects->velocity.z = Rand_CenteredFloat(50.0f);
effects->accel.z = 0.0f;
effects->accel.x = 0.0f;
effects->accel.y = -1.5f;
@@ -774,8 +774,8 @@ void func_809DAB78(Boss02* this, PlayState* play) {
this->actor.world.pos.z = player->actor.world.pos.z;
this->actor.world.pos.y = player->actor.world.pos.y - (600.0f * D_809DF5B0);
} else {
this->actor.world.pos.x = randPlusMinusPoint5Scaled(5000.0f * D_809DF5B0);
this->actor.world.pos.z = randPlusMinusPoint5Scaled(5000.0f * D_809DF5B0);
this->actor.world.pos.x = Rand_CenteredFloat(5000.0f * D_809DF5B0);
this->actor.world.pos.z = Rand_CenteredFloat(5000.0f * D_809DF5B0);
this->actor.world.pos.y = -500.0f * D_809DF5B0;
if (sIsInGiantMode) {
this->actor.world.pos.y += 3150.0f;
@@ -802,8 +802,8 @@ void func_809DAB78(Boss02* this, PlayState* play) {
this->unk_0146[0] = 150;
} else {
this->unk_0144 = 2;
this->unk_01B0.x = randPlusMinusPoint5Scaled(3000.0f * D_809DF5B0);
this->unk_01B0.z = randPlusMinusPoint5Scaled(3000.0f * D_809DF5B0);
this->unk_01B0.x = Rand_CenteredFloat(3000.0f * D_809DF5B0);
this->unk_01B0.z = Rand_CenteredFloat(3000.0f * D_809DF5B0);
if ((fabsf(this->unk_01B0.x) < (500.0f * D_809DF5B0)) &&
(fabsf(this->unk_01B0.z) < (500.0f * D_809DF5B0))) {
this->unk_01B0.x = 500.0f;
@@ -847,12 +847,12 @@ void func_809DAB78(Boss02* this, PlayState* play) {
this->unk_01B0.z = player->actor.world.pos.z;
if (this->unk_0146[0] == 0) {
this->unk_0144 = 3;
this->unk_01B0.x = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + this->actor.world.pos.x;
this->unk_01B0.x = Rand_CenteredFloat(500.0f * D_809DF5B0) + this->actor.world.pos.x;
this->unk_01B0.y = -3000.0f * D_809DF5B0;
if (sIsInGiantMode) {
this->unk_01B0.y += 3150.0f;
}
this->unk_01B0.z = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + this->actor.world.pos.z;
this->unk_01B0.z = Rand_CenteredFloat(500.0f * D_809DF5B0) + this->actor.world.pos.z;
this->unk_0146[0] = 150;
this->unk_0164 = 0.0f;
}
@@ -917,7 +917,7 @@ void func_809DAB78(Boss02* this, PlayState* play) {
Matrix_MultVecZ(1500.0f * D_809DF5B0, &spA4);
this->unk_0146[0] = 50;
this->unk_01B0.x = player->actor.world.pos.x + spA4.x;
this->unk_01B0.y = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + (600.0f * D_809DF5B0);
this->unk_01B0.y = Rand_CenteredFloat(500.0f * D_809DF5B0) + (600.0f * D_809DF5B0);
if (sIsInGiantMode) {
this->unk_01B0.y += 3150.0f;
}
@@ -963,7 +963,7 @@ void func_809DAB78(Boss02* this, PlayState* play) {
this->actor.gravity = -1.0f * D_809DF5B0;
this->actor.velocity.y = 0.0f;
this->actor.terminalVelocity = -1000.0f * D_809DF5B0;
this->unk_0164 = randPlusMinusPoint5Scaled(0.05f);
this->unk_0164 = Rand_CenteredFloat(0.05f);
spCC = player->actor.world.pos.x - this->actor.world.pos.x;
spC4 = player->actor.world.pos.z - this->actor.world.pos.z;
@@ -1205,16 +1205,16 @@ void Boss02_Twinmold_Update(Actor* thisx, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_SAND_OLD - SFX_FLAG);
if (this->unk_0144 > 20) {
sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x;
sp3C.y = randPlusMinusPoint5Scaled(50.0f * D_809DF5B0) + this->unk_0170.y;
sp3C.z = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.z;
sp3C.x = Rand_CenteredFloat(100.0f * D_809DF5B0) + this->unk_0170.x;
sp3C.y = Rand_CenteredFloat(50.0f * D_809DF5B0) + this->unk_0170.y;
sp3C.z = Rand_CenteredFloat(100.0f * D_809DF5B0) + this->unk_0170.z;
Boss02_SpawnEffectSand(play->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f);
}
if ((this->unk_014C % 2) == 0) {
sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x;
sp3C.y = randPlusMinusPoint5Scaled(50.0f * D_809DF5B0) + this->unk_0170.y;
sp3C.z = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.z;
sp3C.x = Rand_CenteredFloat(100.0f * D_809DF5B0) + this->unk_0170.x;
sp3C.y = Rand_CenteredFloat(50.0f * D_809DF5B0) + this->unk_0170.y;
sp3C.z = Rand_CenteredFloat(100.0f * D_809DF5B0) + this->unk_0170.z;
Boss02_SpawnEffectSand(play->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f);
}
}

Some files were not shown because too many files have changed in this diff Show More