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-06 12:16:34 +10:00 committed by GitHub
parent f92a61db27
commit 7f5087d0b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
140 changed files with 916 additions and 955 deletions

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);

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;

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

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);
}

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;
}

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);

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;

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;

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);

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;
}
}

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) {

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;

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);

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;
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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,

View File

@ -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);

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);
}
}

View File

@ -162,8 +162,8 @@ void Boss03_SpawnEffectDroplet(PlayState* play, Vec3f* pos) {
eff->unk_34.y = 0.0f;
eff->unk_34.z = Rand_ZeroFloat(2 * M_PI);
eff->unk_02 = Rand_ZeroFloat(100.0f);
eff->velocity.x = randPlusMinusPoint5Scaled(25.0f);
eff->velocity.z = randPlusMinusPoint5Scaled(25.0f);
eff->velocity.x = Rand_CenteredFloat(25.0f);
eff->velocity.z = Rand_CenteredFloat(25.0f);
return;
}
@ -425,17 +425,17 @@ void Boss03_SpawnDust(Boss03* this, PlayState* play) {
Vec3f accel;
for (i = 0; i < 5; i++) {
velocity.x = randPlusMinusPoint5Scaled(10.0f);
velocity.x = Rand_CenteredFloat(10.0f);
velocity.y = Rand_ZeroFloat(2.0f) + 2.0f;
velocity.z = randPlusMinusPoint5Scaled(10.0f);
velocity.z = Rand_CenteredFloat(10.0f);
accel.y = -0.075f;
accel.z = 0.0f;
accel.x = 0.0f;
pos.y = Rand_ZeroFloat(20.0f) + 5.0f;
pos.z = randPlusMinusPoint5Scaled(150.0f) + this->insideJawPos.z;
pos.x = randPlusMinusPoint5Scaled(150.0f) + this->insideJawPos.x;
pos.z = Rand_CenteredFloat(150.0f) + this->insideJawPos.z;
pos.x = Rand_CenteredFloat(150.0f) + this->insideJawPos.x;
func_800B0EB0(play, &pos, &velocity, &accel, &sGyorgDustPrimColor, &sGyorgDustEnvColor,
Rand_ZeroFloat(200.0f) + 400.0f, 10, Rand_ZeroFloat(10.0f) + 25.0f);
@ -597,9 +597,9 @@ void func_809E34B8(Boss03* this, PlayState* play) {
if (this->workTimer[WORK_TIMER_UNK2_A] == 0) {
if ((sqrtf(SQ(xDiff) + SQ(zDiff)) < 100.0f) || (this->workTimer[WORK_TIMER_UNK0_A] == 0)) {
for (i = 0; i < 200; i++) {
this->unk_268.x = randPlusMinusPoint5Scaled(2500.0f);
this->unk_268.x = Rand_CenteredFloat(2500.0f);
this->unk_268.y = Rand_ZeroFloat(100.0f) + 150.0f;
this->unk_268.z = randPlusMinusPoint5Scaled(2500.0f);
this->unk_268.z = Rand_CenteredFloat(2500.0f);
xDiff = this->unk_268.x - this->actor.world.pos.x;
zDiff = this->unk_268.z - this->actor.world.pos.z;
@ -1100,9 +1100,9 @@ void Boss03_JumpOverPlatform(Boss03* this, PlayState* play) {
Vec3f sp30;
for (i = 0; i < 3; i++) {
sp30.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(150.0f);
sp30.x = this->actor.world.pos.x + Rand_CenteredFloat(150.0f);
sp30.y = this->actor.world.pos.y;
sp30.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(150.0f);
sp30.z = this->actor.world.pos.z + Rand_CenteredFloat(150.0f);
Boss03_SpawnEffectDroplet(play, &sp30);
}
}
@ -1337,9 +1337,9 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) {
if (1) {}
for (i = 0; i < 3; i++) {
effectPos.x = randPlusMinusPoint5Scaled(150.0f) + this->actor.world.pos.x;
effectPos.x = Rand_CenteredFloat(150.0f) + this->actor.world.pos.x;
effectPos.y = this->actor.world.pos.y;
effectPos.z = randPlusMinusPoint5Scaled(150.0f) + this->actor.world.pos.z;
effectPos.z = Rand_CenteredFloat(150.0f) + this->actor.world.pos.z;
Boss03_SpawnEffectDroplet(play, &effectPos);
}
@ -1399,9 +1399,9 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) {
this->subCamEye = this->actor.world.pos;
for (i = 0; i < bubblesToSpawnNum; i++) {
effectPos.x = randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.x;
effectPos.y = (randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.y) - 150.0f;
effectPos.z = randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.z;
effectPos.x = Rand_CenteredFloat(100.0f) + this->subCamAt.x;
effectPos.y = (Rand_CenteredFloat(100.0f) + this->subCamAt.y) - 150.0f;
effectPos.z = Rand_CenteredFloat(100.0f) + this->subCamAt.z;
Boss03_SpawnEffectBubble(play, &effectPos);
}
@ -1573,17 +1573,15 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
this->actor.speed = ((Rand_ZeroFloat(5.0f) + 2.5f) * sp64) + 2.5f;
if (Rand_ZeroOne() < 0.5f) {
this->shapeRotTargetX =
((s16)randPlusMinusPoint5Scaled(500.0f) + this->shapeRotTargetX) + 0x8000;
this->shapeRotTargetX = ((s16)(s32)Rand_CenteredFloat(0x1F4) + this->shapeRotTargetX) + 0x8000;
}
if (Rand_ZeroOne() < 0.5f) {
this->shapeRotTargetZ =
((s16)randPlusMinusPoint5Scaled(500.0f) + this->shapeRotTargetZ) + 0x8000;
this->shapeRotTargetZ = ((s16)(s32)Rand_CenteredFloat(0x1F4) + this->shapeRotTargetZ) + 0x8000;
}
if (Rand_ZeroOne() < 0.5f) {
this->shapeRotTargetY = Rand_ZeroFloat(65536.0f);
this->shapeRotTargetY = Rand_ZeroFloat(0x10000);
}
this->actor.world.rot.y = Math_Atan2S_XY(-this->actor.world.pos.z, -this->actor.world.pos.x);
@ -1600,9 +1598,9 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
sp4C = 150.0f * sp64;
for (i = 0; i < 1; i++) {
sp78.x = randPlusMinusPoint5Scaled(sp4C) + this->actor.world.pos.x;
sp78.x = Rand_CenteredFloat(sp4C) + this->actor.world.pos.x;
sp78.y = this->actor.world.pos.y;
sp78.z = randPlusMinusPoint5Scaled(sp4C) + this->actor.world.pos.z;
sp78.z = Rand_CenteredFloat(sp4C) + this->actor.world.pos.z;
Boss03_SpawnEffectDroplet(play, &sp78);
}
@ -2073,9 +2071,9 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
if ((this->unk_240 % 2) == 0) {
for (i = 0; i < this->bubbleEffectSpawnCount; i++) {
bubblePos.x = randPlusMinusPoint5Scaled(100.0f) + this->actor.world.pos.x;
bubblePos.y = randPlusMinusPoint5Scaled(100.0f) + this->actor.world.pos.y;
bubblePos.z = randPlusMinusPoint5Scaled(100.0f) + this->actor.world.pos.z;
bubblePos.x = Rand_CenteredFloat(100.0f) + this->actor.world.pos.x;
bubblePos.y = Rand_CenteredFloat(100.0f) + this->actor.world.pos.y;
bubblePos.z = Rand_CenteredFloat(100.0f) + this->actor.world.pos.z;
Boss03_SpawnEffectBubble(play, &bubblePos);
}
@ -2106,9 +2104,9 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
if (this->wetSpotEffectSpawnCount != 0) {
this->wetSpotEffectSpawnCount--;
wetSpotPos.x = randPlusMinusPoint5Scaled(50.0f) + player->actor.world.pos.x;
wetSpotPos.x = Rand_CenteredFloat(50.0f) + player->actor.world.pos.x;
wetSpotPos.y = PLATFORM_HEIGHT;
wetSpotPos.z = randPlusMinusPoint5Scaled(50.0f) + player->actor.world.pos.z;
wetSpotPos.z = Rand_CenteredFloat(50.0f) + player->actor.world.pos.z;
Boss03_SpawnEffectWetSpot(play, &wetSpotPos);
}
}
@ -2131,9 +2129,9 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
for (j = 0, i = 0; i < 20; j++) {
Matrix_RotateYF(yRot, MTXMODE_NEW);
Matrix_MultVecZ(Rand_ZeroFloat(60.000004f) + 312.0f, &dropletPos);
dropletPos.x += this->unk_284 + randPlusMinusPoint5Scaled(40.0f);
dropletPos.x += this->unk_284 + Rand_CenteredFloat(40.0f);
dropletPos.y = PLATFORM_HEIGHT;
dropletPos.z += this->unk_28C + randPlusMinusPoint5Scaled(40.0f);
dropletPos.z += this->unk_28C + Rand_CenteredFloat(40.0f);
if (sqrtf(SQ(dropletPos.x) + SQ(dropletPos.z)) < 355.0f) {
Boss03_SpawnEffectDroplet(play, &dropletPos);

View File

@ -439,8 +439,8 @@ void func_809ECD18(Boss04* this, PlayState* play) {
if (Rand_ZeroOne() < 0.1f) {
Math_Vec3f_Copy(&this->unk_6C8, &player->actor.world.pos);
} else {
this->unk_6C8.x = randPlusMinusPoint5Scaled(600.0f) + this->unk_6E8;
this->unk_6C8.z = randPlusMinusPoint5Scaled(600.0f) + this->unk_6F0;
this->unk_6C8.x = Rand_CenteredFloat(600.0f) + this->unk_6E8;
this->unk_6C8.z = Rand_CenteredFloat(600.0f) + this->unk_6F0;
}
}

View File

@ -110,7 +110,7 @@ void EffDust_Destroy(Actor* thisx, PlayState* play) {
void func_80918D64(EffDust* this, PlayState* play) {
s16 theta;
s16 fi;
s16 phi;
s32 i;
s32 j;
f32* distanceTraveled = this->distanceTraveled;
@ -127,10 +127,10 @@ void func_80918D64(EffDust* this, PlayState* play) {
i = this->index & 0x3F;
if (this->distanceTraveled[i] >= 1.0f) {
// Spherical coordinate system.
fi = randPlusMinusPoint5Scaled(0x10000);
phi = Rand_CenteredFloat(0x10000);
theta = Rand_ZeroFloat(0x1000);
this->initialPositions[i].x = -(f32)this->actor.home.rot.z * Math_CosS(fi) * Math_CosS(theta);
this->initialPositions[i].y = -(f32)this->actor.home.rot.z * Math_SinS(fi) * Math_CosS(theta);
this->initialPositions[i].x = -(f32)this->actor.home.rot.z * Math_CosS(phi) * Math_CosS(theta);
this->initialPositions[i].y = -(f32)this->actor.home.rot.z * Math_SinS(phi) * Math_CosS(theta);
this->initialPositions[i].z = -(f32)this->actor.home.rot.z * Math_SinS(theta);
this->distanceTraveled[i] = 0.0f;
this->index++;
@ -141,7 +141,7 @@ void func_80918D64(EffDust* this, PlayState* play) {
void func_80918FE4(EffDust* this, PlayState* play) {
s16 theta;
s16 fi;
s16 phi;
f32* distanceTraveled = this->distanceTraveled;
s32 i;
s32 j;
@ -157,11 +157,11 @@ void func_80918FE4(EffDust* this, PlayState* play) {
i = this->index & 0x3F;
if (this->distanceTraveled[i] >= 1.0f) {
// Spherical coordinate system.
fi = randPlusMinusPoint5Scaled(0x10000);
phi = Rand_CenteredFloat(0x10000);
theta = Rand_ZeroFloat(0x2000);
this->initialPositions[i].x = 400.0f * Math_CosS(fi) * Math_CosS(theta);
this->initialPositions[i].x = 400.0f * Math_CosS(phi) * Math_CosS(theta);
this->initialPositions[i].y = 400.0f * Math_SinS(theta);
this->initialPositions[i].z = 400.0f * Math_SinS(fi) * Math_CosS(theta);
this->initialPositions[i].z = 400.0f * Math_SinS(phi) * Math_CosS(theta);
this->distanceTraveled[i] = 0.0f;
this->index++;
}
@ -206,7 +206,7 @@ void func_80919230(EffDust* this, PlayState* play) {
i = this->index & 0x3F;
if (this->distanceTraveled[i] >= 1.0f) {
theta = randPlusMinusPoint5Scaled(0x10000);
theta = Rand_CenteredFloat(0x10000);
switch (this->actor.params) {
case EFF_DUST_TYPE_SPIN_ATTACK_CHARGE:
this->initialPositions[i].x = (Rand_ZeroOne() * 4500.0f) + 700.0f;

View File

@ -179,7 +179,7 @@ s32 func_80BECD10(EnAkindonuts* this, Path* path, s32 arg2) {
phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
sp50 = true;
}

View File

@ -193,9 +193,9 @@ void EnAm_SpawnEffects(EnAm* this, PlayState* play) {
// Dust Clouds that spawn from the hop
for (i = 4; i > 0; i--) {
effectPos.x = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.x;
effectPos.y = randPlusMinusPoint5Scaled(10.0f) + (this->actor.world.pos.y + 40.0f);
effectPos.z = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.z;
effectPos.x = Rand_CenteredFloat(65.0f) + this->actor.world.pos.x;
effectPos.y = Rand_CenteredFloat(10.0f) + (this->actor.world.pos.y + 40.0f);
effectPos.z = Rand_CenteredFloat(65.0f) + this->actor.world.pos.z;
EffectSsKirakira_SpawnSmall(play, &effectPos, &sVelocity, &sAccel, &D_808B1118, &D_808B111C);
}
Actor_PlaySfx(&this->actor, NA_SE_EN_AMOS_WALK);
@ -254,7 +254,7 @@ void EnAm_ApplyEnemyTexture(EnAm* this, PlayState* play) {
func_808B0358(this);
} else {
tempTextureBlend = this->textureBlend + 20;
rand = randPlusMinusPoint5Scaled(10.0f);
rand = Rand_CenteredFloat(10.0f);
cos = Math_CosS(this->actor.shape.rot.y) * rand;
sin = Math_SinS(this->actor.shape.rot.y) * rand;
this->actor.world.pos.x = this->actor.home.pos.x + cos;
@ -433,7 +433,7 @@ void func_808B0894(EnAm* this, PlayState* play) {
for (i = 0; i < 8; i++) {
dustPos.x = (Math_SinS(0) * 7.0f) + this->actor.world.pos.x;
dustPos.y = (randPlusMinusPoint5Scaled(10.0f) * 6.0f) + (this->actor.world.pos.y + 40.0f);
dustPos.y = (Rand_CenteredFloat(10.0f) * 6.0f) + (this->actor.world.pos.y + 40.0f);
dustPos.z = (Math_CosS(0) * 7.0f) + this->actor.world.pos.z;
func_800B0EB0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_808B1120, &D_808B1124, 200, 45, 12);

View File

@ -336,7 +336,7 @@ void func_8088ACE0(EnArrow* this, PlayState* play) {
(this->collider.base.atFlags & AT_BOUNCED)) {
if ((this->collider.base.at != NULL) && (this->collider.base.at->id != ACTOR_OBJ_SYOKUDAI)) {
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos);
this->actor.world.rot.y += BINANG_ROT180((s16)randPlusMinusPoint5Scaled(8000.0f));
this->actor.world.rot.y += BINANG_ROT180((s16)(s32)Rand_CenteredFloat(0x1F40));
this->actor.velocity.y = -this->actor.velocity.y;
this->bubble.unk_149 = -1;
return;

View File

@ -54,9 +54,9 @@ void EnAttackNiw_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
this->actor.gravity = 0.0f;
this->randomTargetCenterOffset.x = randPlusMinusPoint5Scaled(100.0f);
this->randomTargetCenterOffset.y = randPlusMinusPoint5Scaled(10.0f);
this->randomTargetCenterOffset.z = randPlusMinusPoint5Scaled(100.0f);
this->randomTargetCenterOffset.x = Rand_CenteredFloat(100.0f);
this->randomTargetCenterOffset.y = Rand_CenteredFloat(10.0f);
this->randomTargetCenterOffset.z = Rand_CenteredFloat(100.0f);
Actor_SetScale(&this->actor, 0.01f);
this->actor.flags &= ~ACTOR_FLAG_1; // Unnecessary: this actor does not start with this flag
@ -311,7 +311,7 @@ void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play) {
}
if (this->randomAngleChangeTimer == 50) {
this->targetRotY = randPlusMinusPoint5Scaled(200.0f) + this->actor.yawTowardsPlayer;
this->targetRotY = Rand_CenteredFloat(200.0f) + this->actor.yawTowardsPlayer;
}
Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 2, this->rotStep, 0);

View File

@ -449,9 +449,9 @@ void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f*
effect->accel = *accel;
effect->scale = scale;
effect->timer = timer;
effect->rotation.x = (s16)randPlusMinusPoint5Scaled(30000.0f);
effect->rotation.y = (s16)randPlusMinusPoint5Scaled(30000.0f);
effect->rotation.z = (s16)randPlusMinusPoint5Scaled(30000.0f);
effect->rotation.x = (s16)(s32)Rand_CenteredFloat(0x7530);
effect->rotation.y = (s16)(s32)Rand_CenteredFloat(0x7530);
effect->rotation.z = (s16)(s32)Rand_CenteredFloat(0x7530);
return;
}
}

View File

@ -161,11 +161,10 @@ void EnBat_Init(Actor* thisx, PlayState* play) {
EnBat_SetupFlyIdle(this);
while (BAD_BAT_GET_NUMBER_TO_SPAWN(thisx) > 1) {
Actor_SpawnAsChildAndCutscene(
&play->actorCtx, play, ACTOR_EN_BAT, thisx->world.pos.x + randPlusMinusPoint5Scaled(200.0f),
thisx->world.pos.y + randPlusMinusPoint5Scaled(100.0f),
thisx->world.pos.z + randPlusMinusPoint5Scaled(200.0f), randPlusMinusPoint5Scaled(0x2000),
0xFFFF * Rand_ZeroOne(), 0, BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), CS_ID_NONE,
thisx->halfDaysBits, NULL);
&play->actorCtx, play, ACTOR_EN_BAT, thisx->world.pos.x + Rand_CenteredFloat(200.0f),
thisx->world.pos.y + Rand_CenteredFloat(100.0f), thisx->world.pos.z + Rand_CenteredFloat(200.0f),
Rand_CenteredFloat(0x2000), 0xFFFF * Rand_ZeroOne(), 0,
BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), CS_ID_NONE, thisx->halfDaysBits, NULL);
BAD_BAT_GET_NUMBER_TO_SPAWN(thisx)--;
}
}

View File

@ -340,7 +340,7 @@ void EnBbfall_Fly(EnBbfall* this, PlayState* play) {
// Bounce upwards off the ground
this->actor.velocity.y *= -1.2f;
this->actor.velocity.y = CLAMP(this->actor.velocity.y, 8.0f, 12.0f);
this->actor.shape.rot.y += (s16)randPlusMinusPoint5Scaled(73728.0f);
this->actor.shape.rot.y += (s16)(s32)Rand_CenteredFloat(0x12000);
}
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;

View File

@ -158,9 +158,9 @@ void EnBee_FlyIdle(EnBee* this, PlayState* play) {
nextPos.z += Math_CosS(this->targetYaw) * 30.0f;
if ((this->instanceId % 2) == 0) {
this->targetYaw += (s16)((s32)randPlusMinusPoint5Scaled(1000.0f) + 4000);
this->targetYaw += (s16)((s32)Rand_CenteredFloat(1000.0f) + 4000);
} else {
this->targetYaw -= (s16)((s32)randPlusMinusPoint5Scaled(1000.0f) + 4000);
this->targetYaw -= (s16)((s32)Rand_CenteredFloat(1000.0f) + 4000);
}
this->flightHoverOffset += 1000;
@ -197,10 +197,10 @@ void EnBee_Attack(EnBee* this, PlayState* play) {
yawOffset = (this->instanceId * 0x700) + 0x2000;
for (i = 0; i < 2; i++) {
rand = randPlusMinusPoint5Scaled(20.0f);
rand = Rand_CenteredFloat(20.0f);
nextPos.x += Math_SinS((f32)this->actor.yawTowardsPlayer + this->targetYaw + yawOffset) * (rand + 30.0f);
nextPos.y = (Math_SinS(this->flightHoverOffset) * 10.0f) + (player->actor.floorHeight + 40.0f);
rand = randPlusMinusPoint5Scaled(20.0f);
rand = Rand_CenteredFloat(20.0f);
nextPos.z += Math_CosS((f32)this->actor.yawTowardsPlayer + this->targetYaw + yawOffset) * (rand + 30.0f);
Math_Vec3f_Copy(&this->targetPos[i], &nextPos);
@ -210,14 +210,12 @@ void EnBee_Attack(EnBee* this, PlayState* play) {
Math_Vec3f_Copy(&nextPos, &this->targetPos[this->posIndex]);
if ((this->instanceId % 2) == 0) {
this->targetYaw +=
(this->instanceId * 0x700) + (s32)randPlusMinusPoint5Scaled((this->instanceId * 0x700) * 0.5f);
this->targetYaw += (this->instanceId * 0x700) + (s32)Rand_CenteredFloat((this->instanceId * 0x700) * 0.5f);
} else {
this->targetYaw -=
(this->instanceId * 0x700) + (s32)randPlusMinusPoint5Scaled((this->instanceId * 0x700) * 0.5f);
this->targetYaw -= (this->instanceId * 0x700) + (s32)Rand_CenteredFloat((this->instanceId * 0x700) * 0.5f);
}
this->flightHoverOffset += (s32)randPlusMinusPoint5Scaled(500.0f) + 1000;
this->flightHoverOffset += (s32)Rand_CenteredFloat(500.0f) + 1000;
if (this->targetYaw > 0x10000) {
this->targetYaw = 0;

View File

@ -59,9 +59,9 @@ void func_80C22DEC(EnBh* this, PlayState* play) {
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
if ((this->timer2 == 0) || (xzDist < 100.0f)) {
this->pos.x = randPlusMinusPoint5Scaled(300.0f) + this->actor.home.pos.x;
this->pos.y = randPlusMinusPoint5Scaled(100.0f) + this->actor.home.pos.y;
this->pos.z = randPlusMinusPoint5Scaled(300.0f) + this->actor.home.pos.z;
this->pos.x = Rand_CenteredFloat(300.0f) + this->actor.home.pos.x;
this->pos.y = Rand_CenteredFloat(100.0f) + this->actor.home.pos.y;
this->pos.z = Rand_CenteredFloat(300.0f) + this->actor.home.pos.z;
this->timer2 = Rand_ZeroFloat(50.0f) + 30.0f;
this->step = 0;
}
@ -85,7 +85,7 @@ void func_80C22DEC(EnBh* this, PlayState* play) {
this->skelanime.playSpeed = 1.0f;
this->timer = Rand_ZeroFloat(70.0f) + 50.0f;
} else if (((this->timer & 7) == 7) && (Rand_ZeroOne() < 0.5f)) {
this->unk1E4 = randPlusMinusPoint5Scaled(3000.0f);
this->unk1E4 = Rand_CenteredFloat(3000.0f);
}
} else {
SkelAnime_Update(&this->skelanime);

View File

@ -436,9 +436,9 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) {
bubblePos.y = this->picto.actor.world.pos.y;
for (i = 0; i < 20; i++) {
bubbleVel.x = randPlusMinusPoint5Scaled(10.0f);
bubbleVel.x = Rand_CenteredFloat(10.0f);
bubbleVel.y = Rand_ZeroFloat(5.5f) + 5.5f;
bubbleVel.z = randPlusMinusPoint5Scaled(10.0f);
bubbleVel.z = Rand_CenteredFloat(10.0f);
bubblePos.x = this->picto.actor.world.pos.x + (2.0f * bubbleVel.x);
bubblePos.z = this->picto.actor.world.pos.z + (2.0f * bubbleVel.z);
@ -604,7 +604,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec
MTXMODE_APPLY);
}
} else if (this->actionFunc == EnBigokuta_SuckInPlayer) {
f32 sin = sin_rad(this->timer * (M_PI / 3.0f)) * 0.5f;
f32 sin = Math_SinF(this->timer * (M_PI / 3.0f)) * 0.5f;
Matrix_Scale(((this->timer * (2 / 90.0f)) * (0.5f + sin)) + 1.0f,
((this->timer * (2 / 90.0f)) * (0.5f - sin)) + 1.0f, 1.0f - ((this->timer * 0.3f) / 9.0f),
@ -613,7 +613,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec
if (this->timer == 0) {
Matrix_Scale(0.9f, 0.9f, 1.15f, MTXMODE_APPLY);
} else if (this->timer > 0) {
f32 sin = sin_rad(this->timer * (M_PI / 3.0f)) * 0.5f;
f32 sin = Math_SinF(this->timer * (M_PI / 3.0f)) * 0.5f;
Matrix_Scale(((0.5f + sin) * 0.2f) + 1.0f, ((0.5f - sin) * 0.2f) + 1.0f, 0.7f, MTXMODE_APPLY);
} else {

View File

@ -267,7 +267,7 @@ void func_80A27B58(EnBigpamet* this) {
this->unk_2A2 = 40;
for (ptr = &this->unk_2FC[0], i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) {
temp_s1 = (s32)randPlusMinusPoint5Scaled(20480.0f) + this->actor.wallYaw;
temp_s1 = (s32)Rand_CenteredFloat(0x5000) + this->actor.wallYaw;
temp_s2 = Rand_S16Offset(0x1000, 0x3000);
temp_fs2 = Math_SinS(temp_s2);
@ -342,7 +342,7 @@ void func_80A27FE8(EnBigpamet* this, PlayState* play) {
pos.y += 8.0f;
if (this->actionFunc != func_80A28D0C) {
sp32 = (s32)randPlusMinusPoint5Scaled(0x8000) + this->actor.world.rot.y;
sp32 = (s32)Rand_CenteredFloat(0x8000) + this->actor.world.rot.y;
pos.x -= 55.0f * Math_SinS(sp32);
pos.z -= 55.0f * Math_CosS(sp32);
}

View File

@ -554,7 +554,7 @@ void EnBigpo_IdleFlying(EnBigpo* this, PlayState* play) {
// flight position calculations
this->hoverHeightCycleTimer = (this->hoverHeightCycleTimer == 0) ? 40 : (this->hoverHeightCycleTimer - 1);
Math_StepToF(&this->savedHeight, player->actor.world.pos.y + 100.0f, 1.5f);
this->actor.world.pos.y = (sin_rad(this->hoverHeightCycleTimer * (M_PI / 20)) * 10.0f) + this->savedHeight;
this->actor.world.pos.y = (Math_SinF(this->hoverHeightCycleTimer * (M_PI / 20)) * 10.0f) + this->savedHeight;
Math_StepToF(&this->actor.speed, 3.0f, 0.2f);
func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG);
if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) {
@ -827,7 +827,7 @@ void EnBigpo_ScoopSoulIdle(EnBigpo* this, PlayState* play) {
EnBigpo_SetupScoopSoulLeaving(this);
} else {
Actor_OfferGetItem(&this->actor, play, GI_MAX, 35.0f, 60.0f);
this->actor.world.pos.y = (sin_rad(this->idleTimer * (M_PI / 20)) * 5.0f) + this->savedHeight;
this->actor.world.pos.y = (Math_SinF(this->idleTimer * (M_PI / 20)) * 5.0f) + this->savedHeight;
}
}

View File

@ -657,7 +657,7 @@ void EnBigslime_AddWavySurface(EnBigslime* this) {
randFloat = (Rand_ZeroOne() * 40.0f) + 50.0f;
}
this->vtxSurfacePerturbation[i] = sin_rad((randInt + i) * (M_PI / 3)) * randFloat * 0.001f;
this->vtxSurfacePerturbation[i] = Math_SinF((randInt + i) * (M_PI / 3)) * randFloat * 0.001f;
}
}
@ -673,7 +673,7 @@ void EnBigslime_UpdateWavySurface(EnBigslime* this) {
}
this->wavySurfaceTimer--;
vtxSurfaceWave = sin_rad(this->wavySurfaceTimer * (M_PI / 12));
vtxSurfaceWave = Math_SinF(this->wavySurfaceTimer * (M_PI / 12));
for (i = 0; i < BIGSLIME_NUM_VTX; i++) {
staticVtx = &sBigslimeStaticVtx[i];
dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][i];
@ -692,9 +692,9 @@ void EnBigslime_InitFallMinislime(EnBigslime* this) {
for (i = 0; i < MINISLIME_NUM_SPAWN; i++) {
minislime = this->minislime[i];
minislime->actor.params = MINISLIME_INIT_FALL;
minislime->actor.world.pos.x = randPlusMinusPoint5Scaled(80.0f) + (GBT_ROOM_5_MIN_X + ((i % 4) + 1) * 192.0f);
minislime->actor.world.pos.x = Rand_CenteredFloat(80.0f) + (GBT_ROOM_5_MIN_X + ((i % 4) + 1) * 192.0f);
minislime->actor.world.pos.y = Rand_ZeroFloat(250.0f) + (GBT_ROOM_5_CENTER_Y + 50.0f);
minislime->actor.world.pos.z = randPlusMinusPoint5Scaled(80.0f) + (GBT_ROOM_5_MIN_Z + ((i / 4) + 1) * 192.0f);
minislime->actor.world.pos.z = Rand_CenteredFloat(80.0f) + (GBT_ROOM_5_MIN_Z + ((i / 4) + 1) * 192.0f);
}
this->minislimeState = MINISLIME_ACTIVE_INIT_STATE;
@ -1169,7 +1169,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) {
s32 j;
for (i = 0; i < BIGSLIME_NUM_RING_FACES / 2; i++) {
vtxY = (((cos_rad(i * (M_PI / 6)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F;
vtxY = (((Math_CosF(i * (M_PI / 6)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F;
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@ -1188,7 +1188,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) {
}
for (; i < BIGSLIME_NUM_RING_VTX; i++) {
vtxY = ((cos_rad((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 16)) * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F;
vtxY = ((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 16)) * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F;
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@ -1301,7 +1301,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) {
sBigslimeTargetVtx[0].n.ob[2] = 0;
for (i = 1; i < BIGSLIME_NUM_RING_FACES / 2; i++) {
upperSphereCos = (((cos_rad((i - 1) * (M_PI / 5)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F;
upperSphereCos = (((Math_CosF((i - 1) * (M_PI / 5)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F;
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@ -1318,7 +1318,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) {
}
for (; i < BIGSLIME_NUM_RING_FACES; i++) {
lowerSphereCos = cos_rad((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / BIGSLIME_NUM_RING_FACES));
lowerSphereCos = Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / BIGSLIME_NUM_RING_FACES));
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@ -1361,7 +1361,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) {
sBigslimeTargetVtx[0].n.ob[2] = 0;
for (i = 1; i < BIGSLIME_NUM_RING_FACES / 2; i++) {
upperSphereCos = cos_rad((i - 1) * (M_PI / 10));
upperSphereCos = Math_CosF((i - 1) * (M_PI / 10));
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@ -1374,7 +1374,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) {
for (; i < BIGSLIME_NUM_RING_FACES; i++) {
lowerSphereCos =
(((cos_rad((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 5)) + 1) * 0.925f) + -1.0f) * BIGSLIME_RADIUS_F;
(((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 5)) + 1) * 0.925f) + -1.0f) * BIGSLIME_RADIUS_F;
for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) {
staticVtx = &sBigslimeStaticVtx[j];
targetVtx = &sBigslimeTargetVtx[j];
@ -1692,7 +1692,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) {
EnBigslime_UpdateCameraGrabPlayer(this, play);
if (this->windupPunchTimer > 0) {
invWindupPunchTimer = 1.0f / this->windupPunchTimer;
scale = cos_rad(this->windupPunchTimer * (M_PI / 27)) + 1.0f;
scale = Math_CosF(this->windupPunchTimer * (M_PI / 27)) + 1.0f;
player->actor.world.pos.y = this->actor.world.pos.y + (this->actor.scale.y * -500.0f);
// Linearly interpolate gekkoRot.y --> this->actor.world.rot.y
@ -1705,7 +1705,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) {
EnBigslime_GekkoSfxInsideBigslime(this, NA_SE_EN_FROG_PUNCH1);
}
scale = 0.5f - cos_rad(-this->windupPunchTimer * (M_PI / 5)) * 0.5f;
scale = 0.5f - Math_CosF(-this->windupPunchTimer * (M_PI / 5)) * 0.5f;
if (this->windupPunchTimer == -5) {
if (player->stateFlags2 & PLAYER_STATE2_80) {
player->actor.parent = NULL;
@ -1879,7 +1879,7 @@ void EnBigslime_Freeze(EnBigslime* this, PlayState* play) {
if (vtxIceSeed < BIGSLIME_NUM_VTX) {
dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][vtxIceSeed];
targetVtx = &sBigslimeTargetVtx[vtxIceSeed];
randFloat = randPlusMinusPoint5Scaled(40.0f);
randFloat = Rand_CenteredFloat(40.0f);
dynamicVtx->n.ob[0] += (s16)(randFloat / this->actor.scale.x);
dynamicVtx->n.ob[1] += (s16)(randFloat / this->actor.scale.y);
dynamicVtx->n.ob[2] += (s16)(randFloat / this->actor.scale.z);
@ -2444,9 +2444,9 @@ void EnBigslime_SetupFrogSpawn(EnBigslime* this, PlayState* play) {
func_800B0DE0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &dustPrimColor, &dustEnvColor, 500, 50);
for (i = 0; i < 25; i++) {
hahenVel.x = randPlusMinusPoint5Scaled(5.0f);
hahenVel.x = Rand_CenteredFloat(5.0f);
hahenVel.y = Rand_ZeroFloat(3.0f) + 4.0f;
hahenVel.z = randPlusMinusPoint5Scaled(5.0f);
hahenVel.z = Rand_CenteredFloat(5.0f);
EffectSsHahen_Spawn(play, worldPos, &hahenVel, &hahenAccel, 0, Rand_S16Offset(12, 3), HAHEN_OBJECT_DEFAULT, 10,
0);
}
@ -2464,7 +2464,8 @@ void EnBigslime_FrogSpawn(EnBigslime* this, PlayState* play) {
this->spawnFrogTimer--;
// Zoom the camera in and out at the newly spawned red frog
subCamZoom = sin_rad(this->spawnFrogTimer * (M_PI / 5)) * ((0.04f * (this->spawnFrogTimer * 0.1f)) + 0.02f) + 1.0f;
subCamZoom =
Math_SinF(this->spawnFrogTimer * (M_PI / 5)) * ((0.04f * (this->spawnFrogTimer * 0.1f)) + 0.02f) + 1.0f;
subCamEye.x = subCam->at.x + (this->subCamDistToFrog.x * subCamZoom);
subCamEye.z = subCam->at.z + (this->subCamDistToFrog.z * subCamZoom);
subCamEye.y = subCam->at.y + (this->subCamDistToFrog.y * subCamZoom);

View File

@ -87,7 +87,7 @@ typedef struct EnBigslime {
s16 isDespawned;
s16 isInitJump;
};
/* 0x02BC */ s16 wavySurfaceTimer; // decrements from 24, used in sin_rad for currData2
/* 0x02BC */ s16 wavySurfaceTimer; // decrements from 24, used in Math_SinF for currData2
/* 0x02BE */ s16 stunTimer;
/* 0x02C0 */ union {
s16 freezeTimer;

View File

@ -120,7 +120,7 @@ s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, PlayState
return false;
}
angle = func_80086C48(normDotUp);
angle = Math_FAcosF(normDotUp);
if (angle < 0.001f) {
return false;
}

View File

@ -236,8 +236,8 @@ void func_80C03AF4(EnBombers* this, PlayState* play) {
if (this->unk_2A8 == 0) {
Math_Vec3f_Copy(&sp60, &this->actor.home.pos);
sp60.x += randPlusMinusPoint5Scaled(150.0f);
sp60.z += randPlusMinusPoint5Scaled(150.0f);
sp60.x += Rand_CenteredFloat(150.0f);
sp60.z += Rand_CenteredFloat(150.0f);
abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp60)));
if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp60, &sp6C,

View File

@ -266,8 +266,8 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) {
if (this->unk_2C0 == 0) {
Math_Vec3f_Copy(&sp54, &this->actor.home.pos);
sp54.x += randPlusMinusPoint5Scaled(150.0f);
sp54.z += randPlusMinusPoint5Scaled(150.0f);
sp54.x += Rand_CenteredFloat(150.0f);
sp54.z += Rand_CenteredFloat(150.0f);
abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp54)));
if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp54, &sp6C,
@ -422,7 +422,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) {
}
sp40.x = (Math_SinS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.x;
sp40.y = this->bombal->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f);
sp40.y = this->bombal->actor.world.pos.y - Rand_CenteredFloat(40.0f);
sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.z;
SoundSource_PlaySfxAtFixedWorldPos(play, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN);
@ -433,8 +433,8 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) {
func_80BFE494(this, 5, 1.0f);
this->unk_29A = 0;
Math_Vec3f_Copy(&this->unk_2A4, &this->actor.home.pos);
this->unk_2A4.x += randPlusMinusPoint5Scaled(150.0f);
this->unk_2A4.z += randPlusMinusPoint5Scaled(150.0f);
this->unk_2A4.x += Rand_CenteredFloat(150.0f);
this->unk_2A4.z += Rand_CenteredFloat(150.0f);
this->unk_2A2++;
}
}

View File

@ -275,8 +275,8 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) {
case 0:
if (this->unk_2AE == 0) {
Math_Vec3f_Copy(&sp48, &this->actor.home.pos);
sp48.x += randPlusMinusPoint5Scaled(150.0f);
sp48.z += randPlusMinusPoint5Scaled(150.0f);
sp48.x += Rand_CenteredFloat(150.0f);
sp48.z += Rand_CenteredFloat(150.0f);
abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp48)));
if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp48, &sp60,

View File

@ -494,8 +494,8 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) {
vel.z = cosf(i * (33.0f / 40.0f)) * i * .5f;
vel.y = Rand_ZeroFloat(8.0f) + 7.0f;
vel.x += randPlusMinusPoint5Scaled(0.5f);
vel.z += randPlusMinusPoint5Scaled(0.5f);
vel.x += Rand_CenteredFloat(0.5f);
vel.z += Rand_CenteredFloat(0.5f);
accel.x = 0.0f;
accel.y = -1.0f;

View File

@ -163,7 +163,7 @@ void func_80AFDFB4(EnColMan* this, PlayState* play) {
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y < 0.0f)) {
if (!this->hasSetRandomValues) {
this->actor.world.rot.y = randPlusMinusPoint5Scaled(30000.0f);
this->actor.world.rot.y = Rand_CenteredFloat(30000.0f);
this->actor.speed = 2.0f + BREG(56) + Rand_ZeroFloat(2.0f);
this->actor.velocity.y = 12.0f + BREG(57) + Rand_ZeroFloat(5.0f);
this->hasSetRandomValues = true;
@ -172,9 +172,9 @@ void func_80AFDFB4(EnColMan* this, PlayState* play) {
}
for (i = 0; i < 2; i++) {
velocity.x = randPlusMinusPoint5Scaled(2.0f);
velocity.x = Rand_CenteredFloat(2.0f);
velocity.y = Rand_ZeroFloat(2.0f) + 1.0f;
velocity.z = randPlusMinusPoint5Scaled(2.0f);
velocity.z = Rand_CenteredFloat(2.0f);
accel.y = -0.1f;
accel.z = 0.0f;
accel.x = 0.0f;

View File

@ -552,9 +552,9 @@ s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if (this->actor.colChkInfo.health != 0) {
if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) {
rot->y += (s16)(0xC00 * sin_rad(this->skelAnime.curFrame * (M_PI / 4)));
rot->y += (s16)(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4)));
} else if (limbIndex == OBJECT_CROW_LIMB_TAIL) {
rot->y += (s16)(0x1400 * sin_rad((this->skelAnime.curFrame + 2.5f) * (M_PI / 4)));
rot->y += (s16)(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4)));
}
}
return false;

View File

@ -243,9 +243,9 @@ void func_80BE66E4(EnDaiku2* this, PlayState* play) {
sp70.y += 40.0f;
sp70.z += Math_CosS(this->actor.world.rot.y) * 70.0f;
sp70.x += randPlusMinusPoint5Scaled(5.0f);
sp70.y += randPlusMinusPoint5Scaled(5.0f);
sp70.z += randPlusMinusPoint5Scaled(5.0f);
sp70.x += Rand_CenteredFloat(5.0f);
sp70.y += Rand_CenteredFloat(5.0f);
sp70.z += Rand_CenteredFloat(5.0f);
sp88.y = -1.0f;
@ -507,9 +507,9 @@ void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 ar
effect->unk_1C = *arg3;
effect->unk_30 = arg4;
effect->unk_34 = arg5;
effect->unk_28.x = randPlusMinusPoint5Scaled(30000.0f);
effect->unk_28.y = randPlusMinusPoint5Scaled(30000.0f);
effect->unk_28.z = randPlusMinusPoint5Scaled(30000.0f);
effect->unk_28.x = Rand_CenteredFloat(30000.0f);
effect->unk_28.y = Rand_CenteredFloat(30000.0f);
effect->unk_28.z = Rand_CenteredFloat(30000.0f);
break;
}
}

View File

@ -384,7 +384,7 @@ void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) {
this->size * 0.01f * (0.5f + (15 - this->timer) * 0.5f / 15.0f);
Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800);
headDistVertical = sin_rad(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PI) * 32.0f + 14.0f;
headDistVertical = Math_SinF(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PI) * 32.0f + 14.0f;
if (this->actor.shape.rot.x < -0x38E3) {
headDistHorizontal = 0.0f;
@ -468,7 +468,7 @@ void EnDekubaba_Retract(EnDekubaba* this, PlayState* play) {
this->size * 0.01f * (0.5f + this->timer * (1.0f / 30));
Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300);
headDistVertical = (sin_rad(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f;
headDistVertical = (Math_SinF(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f;
if (this->actor.shape.rot.x < -0x38E3) {
headDistHorizontal = 0.0f;

View File

@ -280,7 +280,7 @@ s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) {
diffZ = points[currentPoint + 1].z - points[currentPoint - 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 (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
@ -358,9 +358,9 @@ void EnDg_SpawnFloorDustRing(EnDg* this, PlayState* play) {
Vec3f pos;
if (((this->index + curFrame) % mod) == 0) {
pos.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x;
pos.x = Rand_CenteredFloat(15.0f) + this->actor.world.pos.x;
pos.y = this->actor.world.pos.y;
pos.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z;
pos.z = Rand_CenteredFloat(15.0f) + this->actor.world.pos.z;
Actor_SpawnFloorDustRing(play, &this->actor, &pos, 10.0f, 0, 2.0f, 300, 0, true);
}
}
@ -900,14 +900,14 @@ void EnDg_JumpAttack(EnDg* this, PlayState* play) {
if (curFrame < 9) {
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = randPlusMinusPoint5Scaled(1.0f) + 3.0f;
sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = Rand_CenteredFloat(1.0f) + 3.0f;
}
EnDg_SpawnFloorDustRing(this, play);
} else {
this->dogFlags |= DOG_FLAG_JUMP_ATTACKING;
if (Animation_OnFrame(&this->skelAnime, 9.0f)) {
f32 rand = randPlusMinusPoint5Scaled(1.5f);
f32 rand = Rand_CenteredFloat(1.5f);
sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = 1.2f;
this->actor.velocity.y = 2.0f * rand + 3.0f;

View File

@ -1062,7 +1062,7 @@ void func_8089CB10(EnDinofos* this, PlayState* play) {
}
void func_8089CBEC(EnDinofos* this, PlayState* play) {
s16 temp_s3 = ((s32)randPlusMinusPoint5Scaled(0x1000) + this->actor.shape.rot.y) + this->unk_28E;
s16 temp_s3 = ((s32)Rand_CenteredFloat(0x1000) + this->actor.shape.rot.y) + this->unk_28E;
Vec3f sp88;
Vec3f sp7C;
ColliderJntSphElementDim* dim;
@ -1081,10 +1081,10 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) {
temp_s0 = CLAMP_MIN(temp_s0, 0);
sp88.x = 11.0f * temp_f20;
sp88.y = randPlusMinusPoint5Scaled(2.0f) + -5.4f;
sp88.y = Rand_CenteredFloat(2.0f) + -5.4f;
sp88.z = 11.0f * temp_f22;
sp7C.x = 0.9f * temp_f20;
sp7C.y = randPlusMinusPoint5Scaled(0.6f) + 1.4f;
sp7C.y = Rand_CenteredFloat(0.6f) + 1.4f;
sp7C.z = 0.9f * temp_f22;
func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG);
EffectSsDFire_Spawn(play, &this->limbPos[10], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, 3, 8);
@ -1098,7 +1098,7 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) {
for (i = 6; i < end; i++) {
dim = &this->colliderJntSph.elements[i].dim;
temp_s3 = (s32)(cos_rad((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y;
temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y;
dim->worldSphere.center.x = (s32)this->limbPos[10].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z);
dim->worldSphere.center.y = (s32)this->limbPos[10].y + (s32)dim->modelSphere.center.y;
@ -1232,9 +1232,9 @@ void func_8089D42C(EnDinofos* this, PlayState* play) {
if ((this->actionFunc == func_8089B834) && (this->unk_290 != 0)) {
Math_ScaledStepToS(&this->unk_28E, Math_SinS(this->unk_290 * 1400) * 0x2C00, 0x300);
} else if (this->actionFunc == func_8089CA74) {
Math_ScaledStepToS(&this->unk_28E, cos_rad(M_PI) * 0x2C00, 0x233);
Math_ScaledStepToS(&this->unk_28E, Math_CosF(M_PI) * 0x2C00, 0x2C00 / 20);
} else if (this->actionFunc == func_8089CBEC) {
this->unk_28E = cos_rad(this->unk_290 * (M_PI / 20)) * 0x2C00;
this->unk_28E = Math_CosF(this->unk_290 * (M_PI / 20)) * 0x2C00;
} else if (!Play_InCsMode(play)) {
temp_v0_2 = this->unk_28E + this->actor.shape.rot.y;
temp_v0_2 = BINANG_SUB(this->actor.yawTowardsPlayer, temp_v0_2);

View File

@ -371,11 +371,11 @@ void func_80876930(EnDodongo* this, PlayState* play, Vec3f* arg2) {
temp3 = this->unk_334 * 30.0f;
for (i = 0; i < 3; i++) {
sp88.x = randPlusMinusPoint5Scaled(temp3) + arg2->x;
sp88.x = Rand_CenteredFloat(temp3) + arg2->x;
sp88.y = Rand_ZeroFloat(5.0f) + this->actor.floorHeight;
sp88.z = randPlusMinusPoint5Scaled(temp3) + arg2->z;
D_8087933C.x = randPlusMinusPoint5Scaled(2.0f);
D_8087933C.z = randPlusMinusPoint5Scaled(2.0f);
sp88.z = Rand_CenteredFloat(temp3) + arg2->z;
D_8087933C.x = Rand_CenteredFloat(2.0f);
D_8087933C.z = Rand_CenteredFloat(2.0f);
func_800B0DE0(play, &sp88, &gZeroVec3f, &D_8087933C, sp80, sp7C, temp1, temp2);
}
}
@ -738,9 +738,9 @@ void func_80877E60(EnDodongo* this, PlayState* play) {
this->timer--;
if (this->timer == 10) {
for (i = 10; i >= 0; i--) {
sp84.x = randPlusMinusPoint5Scaled(10.0f);
sp84.y = randPlusMinusPoint5Scaled(10.0f);
sp84.z = randPlusMinusPoint5Scaled(10.0f);
sp84.x = Rand_CenteredFloat(10.0f);
sp84.y = Rand_CenteredFloat(10.0f);
sp84.z = Rand_CenteredFloat(10.0f);
sp78.x = sp84.x * -0.1f;
sp78.y = sp84.y * -0.1f;
sp78.z = sp84.z * -0.1f;

View File

@ -299,11 +299,11 @@ void EnDragon_SpawnBubbles(EnDragon* this, PlayState* play, Vec3f basePos) {
Vec3f bubblePos;
s32 i;
bubbleCount = (s32)randPlusMinusPoint5Scaled(5.0f) + 10;
bubbleCount = (s32)Rand_CenteredFloat(5.0f) + 10;
colorIndex = 0;
if (this->action == DEEP_PYTHON_ACTION_DEAD) {
colorIndex = 1;
bubbleCount = (s32)randPlusMinusPoint5Scaled(5.0f) + 10;
bubbleCount = (s32)Rand_CenteredFloat(5.0f) + 10;
}
for (i = 0; i < bubbleCount; i++) {
@ -311,9 +311,9 @@ void EnDragon_SpawnBubbles(EnDragon* this, PlayState* play, Vec3f basePos) {
sBubbleVelocity.x = Rand_ZeroFloat(1.0f) * 23.0f;
sBubbleVelocity.y = Rand_ZeroFloat(1.0f) * 10.0f;
sBubbleVelocity.z = Rand_ZeroFloat(1.0f) * 23.0f;
bubblePos.x += randPlusMinusPoint5Scaled(i * 30.0f);
bubblePos.y += randPlusMinusPoint5Scaled(5.0f);
bubblePos.z += randPlusMinusPoint5Scaled(i * 30.0f);
bubblePos.x += Rand_CenteredFloat(i * 30.0f);
bubblePos.y += Rand_CenteredFloat(5.0f);
bubblePos.z += Rand_CenteredFloat(i * 30.0f);
sBubbleAccel.y = Rand_ZeroFloat(1.0f) * 20.0f * 3.0f;
scale = Rand_S16Offset(380, 240);
EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &sBubbleVelocity, &sBubbleAccel,

View File

@ -134,8 +134,8 @@ void EnEgblock_SpawnEffect(EnEgblock* this, Vec3f* pos, s16 lifetime, s16 arg3)
if (!effect->isActive) {
effect->isActive = true;
effect->pos = *pos;
effect->pos.x += randPlusMinusPoint5Scaled(50.0f);
effect->pos.z += randPlusMinusPoint5Scaled(50.0f);
effect->pos.x += Rand_CenteredFloat(50.0f);
effect->pos.z += Rand_CenteredFloat(50.0f);
effect->timer = lifetime;
effect->alpha = 255;
effect->type = arg3;
@ -146,9 +146,9 @@ void EnEgblock_SpawnEffect(EnEgblock* this, Vec3f* pos, s16 lifetime, s16 arg3)
effect->velocity.y = 5.0f + (10.0f * Rand_ZeroOne());
effect->velocity.z = 2.0f * (Rand_ZeroOne() - 0.5f);
effect->scale = 0.5f + (0.2f * Rand_ZeroFloat(1.0f));
effect->rot.x = randPlusMinusPoint5Scaled(0x7530);
effect->rot.y = randPlusMinusPoint5Scaled(0x7530);
effect->rot.z = randPlusMinusPoint5Scaled(0x7530);
effect->rot.x = Rand_CenteredFloat(0x7530);
effect->rot.y = Rand_CenteredFloat(0x7530);
effect->rot.z = Rand_CenteredFloat(0x7530);
break;
}
}

View File

@ -610,8 +610,7 @@ void EnEgol_Retreat(EnEgol* this, PlayState* play) {
if ((ABS_ALT(angleToFacing) < 0x3000) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 50.0f) &&
(this->actor.xzDistToPlayer < 100.0f) && (player->invincibilityTimer == 0)) {
func_800B8D50(play, &this->actor, 2.0f, (s32)randPlusMinusPoint5Scaled(0x2000) + this->actor.world.rot.y, 5.0f,
0x10);
func_800B8D50(play, &this->actor, 2.0f, (s32)Rand_CenteredFloat(0x2000) + this->actor.world.rot.y, 5.0f, 0x10);
}
Math_Vec3f_Copy(&spawnPos, &gZeroVec3f);
if ((this->actor.world.pos.y - 50.0f) <= player->actor.world.pos.y) {
@ -764,11 +763,11 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) {
/*! @bug The following is supposed to calculate the rotation from vertical to the collision poly normal.
* However, the calculation is performed incorrectly. The correct calculation is
* rotToNorm.x = func_80086B30(nz, ny) * 0x8000 / M_PI;
* rotToNorm.z = func_80086B30(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / M_PI;
* rotToNorm.x = Math_FAtan2F(nz, ny) * 0x8000 / M_PI;
* rotToNorm.z = Math_FAtan2F(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / M_PI;
*/
rotToNorm.x = RAD_TO_BINANG_ALT2(-func_80086B30(-nz * ny, 1.0f));
rotToNorm.z = RAD_TO_BINANG_ALT2(func_80086B30(-nx * ny, 1.0f));
rotToNorm.x = RAD_TO_BINANG_ALT2(-Math_FAtan2F(-nz * ny, 1.0f));
rotToNorm.z = RAD_TO_BINANG_ALT2(Math_FAtan2F(-nx * ny, 1.0f));
if ((this->actor.world.pos.y - 50.0f) <= player->actor.world.pos.y) {
EnEgol_SpawnEffect(this, &hitPos, &rotToNorm, 100, 0.02f, EYEGORE_EFFECT_IMPACT);
@ -1534,9 +1533,9 @@ void EnEgol_SpawnEffect(EnEgol* this, Vec3f* pos, Vec3s* rot, s16 lifetime, f32
effect->timer = lifetime;
effect->alpha = 255;
effect->type = type;
effect->rot.x = randPlusMinusPoint5Scaled(0x7530);
effect->rot.y = randPlusMinusPoint5Scaled(0x7530);
effect->rot.z = randPlusMinusPoint5Scaled(0x7530);
effect->rot.x = Rand_CenteredFloat(0x7530);
effect->rot.y = Rand_CenteredFloat(0x7530);
effect->rot.z = Rand_CenteredFloat(0x7530);
if ((effect->type == EYEGORE_EFFECT_PIECE_LARGE) || (effect->type == EYEGORE_EFFECT_PIECE_SMALL)) {
effect->accel.y = -1.0f;
effect->velocity.x = 4.0f * (Rand_ZeroOne() - 0.5f);

View File

@ -201,7 +201,7 @@ void func_8088C858(EnElf* this, PlayState* play) {
this->unk_244 = 1;
this->unk_248 = 128;
this->unk_254 = Rand_ZeroFloat(1.0f) + 0.5f;
this->unk_24C = randPlusMinusPoint5Scaled(0x7FFF);
this->unk_24C = Rand_CenteredFloat(0x7FFF);
this->unk_26C = func_8088C9CC;
}
}
@ -216,7 +216,7 @@ void func_8088C920(EnElf* this, PlayState* play) {
this->unk_244 = 1;
this->unk_248 = 128;
this->unk_254 = Rand_ZeroFloat(1.0f) + 0.5f;
this->unk_24C = randPlusMinusPoint5Scaled(0x7FFF);
this->unk_24C = Rand_CenteredFloat(0x7FFF);
this->unk_26C = func_8088C9CC;
}
}
@ -264,7 +264,7 @@ void func_8088C9CC(EnElf* this, PlayState* play) {
this->unk_244 = 1;
this->unk_248 = 128;
this->unk_254 = Rand_ZeroFloat(0.5f) + 0.5f;
this->unk_24C = randPlusMinusPoint5Scaled(0x7FFF);
this->unk_24C = Rand_CenteredFloat(0x7FFF);
}
}
@ -293,7 +293,7 @@ void func_8088CC48(EnElf* this, PlayState* play) {
this->unk_246 = 0;
this->unk_24A = (s32)Rand_ZeroFloat(1048.0f) + 0x200;
this->unk_224 = this->actor.world.pos;
this->unk_258 = randPlusMinusPoint5Scaled(0x7FFF);
this->unk_258 = Rand_CenteredFloat(0x7FFF);
this->unk_26C = func_8088C9CC;
func_8088CBAC(this, play);
this->unk_25C = 0;
@ -1247,9 +1247,9 @@ void func_8088F5F4(EnElf* this, PlayState* play, s32 sparkleLife) {
Color_RGBA8 envColor;
if (!(this->fairyFlags & 8)) {
sparklePos.x = randPlusMinusPoint5Scaled(6.0f) + this->actor.world.pos.x;
sparklePos.x = Rand_CenteredFloat(6.0f) + this->actor.world.pos.x;
sparklePos.y = (Rand_ZeroOne() * 6.0f) + this->actor.world.pos.y;
sparklePos.z = randPlusMinusPoint5Scaled(6.0f) + this->actor.world.pos.z;
sparklePos.z = Rand_CenteredFloat(6.0f) + this->actor.world.pos.z;
primColor.r = this->innerColor.r;
primColor.g = this->innerColor.g;

View File

@ -66,7 +66,7 @@ void EnElfbub_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 1.25f);
this->actionFunc = EnElfbub_Idle;
this->zRot = randPlusMinusPoint5Scaled(0x10000);
this->zRot = Rand_CenteredFloat(0x10000);
this->zRotDelta = 1000;
this->xScale = 0.08f;

View File

@ -262,8 +262,8 @@ void func_80A39DC8(EnElfgrp* this, PlayState* play, s32 arg2, s32 arg3) {
}
for (i = 0; i < arg2; i++) {
elforg = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, randPlusMinusPoint5Scaled(20.0f) + sp6C.x, sp6C.y,
randPlusMinusPoint5Scaled(20.0f) + sp6C.z, 0, 0, 0, params);
elforg = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, Rand_CenteredFloat(20.0f) + sp6C.x, sp6C.y,
Rand_CenteredFloat(20.0f) + sp6C.z, 0, 0, 0, params);
if (elforg == NULL) {
continue;
}

View File

@ -58,7 +58,7 @@ void EnElforg_InitializeParams(EnElforg* this) {
this->actor.speed = 1.0f;
this->targetSpeedXZ = 1.0f;
this->actor.velocity.y = 0.0f;
this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x10000);
this->actor.world.rot.y = Rand_CenteredFloat(0x10000);
this->timer = 0;
this->secondaryTimer = Rand_ZeroFloat(100.0f);
this->actor.shape.yOffset = 0.0f;
@ -176,9 +176,9 @@ void EnElforg_SpawnSparkles(EnElforg* this, PlayState* play, s32 life) {
s32 pad;
s32 index;
pos.x = randPlusMinusPoint5Scaled(6.0f) + this->actor.world.pos.x;
pos.x = Rand_CenteredFloat(6.0f) + this->actor.world.pos.x;
pos.y = (Rand_ZeroOne() * 6.0f) + this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y);
pos.z = randPlusMinusPoint5Scaled(6.0f) + this->actor.world.pos.z;
pos.z = Rand_CenteredFloat(6.0f) + this->actor.world.pos.z;
index = (this->area < STRAY_FAIRY_AREA_CLOCK_TOWN || this->area >= STRAY_FAIRY_AREA_MAX)
? STRAY_FAIRY_AREA_CLOCK_TOWN
: this->area;

View File

@ -102,15 +102,15 @@ void EnEncount1_SpawnActor(EnEncount1* this, PlayState* play) {
this->timer = 0;
switch (this->type) {
case EN_ENCOUNT1_GRASSHOPPER:
scale = randPlusMinusPoint5Scaled(40.0f) + 200.0f;
scale = Rand_CenteredFloat(40.0f) + 200.0f;
rotY = player->actor.shape.rot.y;
if (this->spawnActiveCount & 1) {
rotY = -rotY;
scale = randPlusMinusPoint5Scaled(20.0f) + 100.0f;
scale = Rand_CenteredFloat(20.0f) + 100.0f;
}
spawnPos.x = player->actor.world.pos.x + (Math_SinS(rotY) * scale) + randPlusMinusPoint5Scaled(40.0f);
spawnPos.x = player->actor.world.pos.x + (Math_SinS(rotY) * scale) + Rand_CenteredFloat(40.0f);
spawnPos.y = player->actor.floorHeight + 120.0f;
spawnPos.z = player->actor.world.pos.z + (Math_CosS(rotY) * scale) + randPlusMinusPoint5Scaled(40.0f);
spawnPos.z = player->actor.world.pos.z + (Math_CosS(rotY) * scale) + Rand_CenteredFloat(40.0f);
floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos);
if ((floorHeight <= BGCHECK_Y_MIN) ||
((player->actor.depthInWater != BGCHECK_Y_MIN) &&
@ -125,11 +125,11 @@ void EnEncount1_SpawnActor(EnEncount1* this, PlayState* play) {
break;
case EN_ENCOUNT1_SKULLFISH:
scale = randPlusMinusPoint5Scaled(250.0f) + 500.0f;
scale = Rand_CenteredFloat(250.0f) + 500.0f;
rotY = player->actor.shape.rot.y;
spawnPos.x = player->actor.world.pos.x + (Math_SinS(rotY) * scale) + randPlusMinusPoint5Scaled(40.0f);
spawnPos.x = player->actor.world.pos.x + (Math_SinS(rotY) * scale) + Rand_CenteredFloat(40.0f);
spawnPos.y = player->actor.world.pos.y - Rand_ZeroFloat(20.0f);
spawnPos.z = player->actor.world.pos.z + (Math_CosS(rotY) * scale) + randPlusMinusPoint5Scaled(40.0f);
spawnPos.z = player->actor.world.pos.z + (Math_CosS(rotY) * scale) + Rand_CenteredFloat(40.0f);
floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos);
if (!(player->stateFlags1 & PLAYER_STATE1_8000000) || (floorHeight <= BGCHECK_Y_MIN) ||
(player->actor.depthInWater < floorHeight)) {

View File

@ -171,8 +171,8 @@ void func_809C42A8(EnEncount4* this, PlayState* play) {
if (this->unk_14C != 0) {
yRot += 0x8000;
}
pos.x += Math_SinS(yRot) * (40.0f + randPlusMinusPoint5Scaled(40.0f));
pos.z += Math_CosS(yRot) * (40.0f + randPlusMinusPoint5Scaled(40.0f));
pos.x += Math_SinS(yRot) * (40.0f + Rand_CenteredFloat(40.0f));
pos.z += Math_CosS(yRot) * (40.0f + Rand_CenteredFloat(40.0f));
if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_SKB, pos.x, pos.y, pos.z, 0, 0, 0,
ENSKB_PARAM_0) != NULL) {
this->unk_14C++;

View File

@ -64,10 +64,10 @@ void EnEstone_Init(Actor* thisx, PlayState* play) {
s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f);
this->rotVel.x = this->rotVel.y = this->rotVel.z = randPlusMinusPoint5Scaled(1.0f) * 20.0f;
this->rotVel.x = this->rotVel.y = this->rotVel.z = Rand_CenteredFloat(1.0f) * 20.0f;
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->actor.world.rot.y += (s16)randPlusMinusPoint5Scaled(0x2710);
this->actor.world.rot.y += (s16)(s32)Rand_CenteredFloat(0x2710);
this->actor.shape.rot.y = this->actor.world.rot.y;
if (this->actor.params == ENESTONE_TYPE_LARGE) {
@ -224,9 +224,9 @@ void EnEstone_SpawnEffect(EnEstone* this, Vec3f* pos, Vec3f* velocity, Vec3f* ac
effect->accel = *accel;
effect->scale = scale;
effect->timer = lifetime;
effect->rot.x = randPlusMinusPoint5Scaled(0x7530);
effect->rot.y = randPlusMinusPoint5Scaled(0x7530);
effect->rot.z = randPlusMinusPoint5Scaled(0x7530);
effect->rot.x = Rand_CenteredFloat(0x7530);
effect->rot.y = Rand_CenteredFloat(0x7530);
effect->rot.z = Rand_CenteredFloat(0x7530);
break;
}
}

View File

@ -662,16 +662,16 @@ s32 EnFall_RisingDebris_InitializeEffect(EnFall* this) {
debrisEffects[i].pos.x = this->actor.world.pos.x;
debrisEffects[i].pos.y = this->actor.world.pos.y;
debrisEffects[i].pos.z = this->actor.world.pos.z;
angle = randPlusMinusPoint5Scaled(0x10000);
angle = Rand_CenteredFloat(0x10000);
scale = (1.0f - (Rand_ZeroFloat(1.0f) * Rand_ZeroFloat(1.0f))) * 3000.0f;
debrisEffects[i].pos.x += Math_SinS(angle) * scale;
debrisEffects[i].pos.z += Math_CosS(angle) * scale;
debrisEffects[i].velocity.x = 0.0f;
debrisEffects[i].velocity.z = 0.0f;
debrisEffects[i].velocity.y = 80.0f;
debrisEffects[i].rot.x = randPlusMinusPoint5Scaled(0x10000);
debrisEffects[i].rot.y = randPlusMinusPoint5Scaled(0x10000);
debrisEffects[i].rot.z = randPlusMinusPoint5Scaled(0x10000);
debrisEffects[i].rot.x = Rand_CenteredFloat(0x10000);
debrisEffects[i].rot.y = Rand_CenteredFloat(0x10000);
debrisEffects[i].rot.z = Rand_CenteredFloat(0x10000);
this->activeDebrisEffectCount++;
return true;
}

View File

@ -265,7 +265,7 @@ void EnFamos_SetupDeathDebris(EnFamos* this) {
rock->rotation.y = (s32)Rand_Next() >> 0x10;
rock->rotation.z = (s32)Rand_Next() >> 0x10;
rock->pos.x = Math_SinS(randVelDirection) * 20.0f + this->actor.world.pos.x;
rock->pos.y = randPlusMinusPoint5Scaled(60.0f) + (this->actor.world.pos.y + 40.0f);
rock->pos.y = Rand_CenteredFloat(60.0f) + (this->actor.world.pos.y + 40.0f);
rock->pos.z = Math_CosS(randVelDirection) * 20.0f + this->actor.world.pos.z;
rock->scale = Rand_ZeroFloat(0.002f) + (2.5f * 0.001f);
}
@ -687,8 +687,8 @@ void EnFamos_DeathExplosion(EnFamos* this, PlayState* play) {
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 4);
}
this->actor.world.pos.x = randPlusMinusPoint5Scaled(5.0f) + this->targetDest.x;
this->actor.world.pos.z = randPlusMinusPoint5Scaled(5.0f) + this->targetDest.z;
this->actor.world.pos.x = Rand_CenteredFloat(5.0f) + this->targetDest.x;
this->actor.world.pos.z = Rand_CenteredFloat(5.0f) + this->targetDest.z;
if (this->stateTimer == 1) {
EnBom* explosion = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x,
this->actor.world.pos.y + 40.0f, this->actor.world.pos.z,

View File

@ -301,7 +301,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) {
Math_ScaledStepToS(&this->actor.shape.rot.y,
Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300);
} else if (rand < 0.8f) {
this->actor.shape.rot.y += (s16)randPlusMinusPoint5Scaled(1536.0f);
this->actor.shape.rot.y += (s16)(s32)Rand_CenteredFloat(0x600);
}
// Climb if too close to ground

View File

@ -352,7 +352,7 @@ void func_80B28C14(EnFish2* this, PlayState* play) {
this->unk_2B4 = (s32)Rand_ZeroFloat(20.0f) + 10;
} else if (this->unk_2B4 == 1) {
if ((this->unk_348 == 0) || (Rand_ZeroOne() < 0.6f)) {
this->unk_348 = randPlusMinusPoint5Scaled(0x2000);
this->unk_348 = Rand_CenteredFloat(0x2000);
} else {
this->unk_348 = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_324);
if (this->unk_348 < -0x1000) {
@ -545,8 +545,8 @@ void func_80B295A4(EnFish2* this, PlayState* play) {
Math_ApproachZeroF(&this->actor.speed, 0.3f, 0.3f);
if (this->unk_2B4 != 0) {
Math_Vec3f_Copy(&sp60, &this->unk_318);
sp60.x += randPlusMinusPoint5Scaled(100.0f);
sp60.z += randPlusMinusPoint5Scaled(100.0f);
sp60.x += Rand_CenteredFloat(100.0f);
sp60.z += Rand_CenteredFloat(100.0f);
for (i = 0; i < 2; i++) {
EffectSsBubble_Spawn(play, &sp60, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f);
@ -912,10 +912,10 @@ void func_80B2A498(EnFish2* this, PlayState* play) {
for (i = 0; i < 10; i++) {
Math_Vec3f_Copy(&sp6C, &this->actor.world.pos);
sp6C.x += randPlusMinusPoint5Scaled(70.0f);
sp6C.x += Rand_CenteredFloat(70.0f);
sp6C.y = this->unk_334 + 10.0f;
sp6C.z += randPlusMinusPoint5Scaled(70.0f);
EffectSsGSplash_Spawn(play, &sp6C, NULL, NULL, 0, (s32)randPlusMinusPoint5Scaled(50.0f) + 350);
sp6C.z += Rand_CenteredFloat(70.0f);
EffectSsGSplash_Spawn(play, &sp6C, NULL, NULL, 0, (s32)Rand_CenteredFloat(50.0f) + 350);
}
}
}
@ -970,11 +970,11 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) {
if ((play->gameplayFrames % 8) == 0) {
Math_Vec3f_Copy(&sp5C, &this->unk_324);
sp5C.x += randPlusMinusPoint5Scaled(100.0f);
sp5C.x += Rand_CenteredFloat(100.0f);
sp5C.y = this->actor.floorHeight;
sp5C.z += randPlusMinusPoint5Scaled(100.0f);
sp5C.z += Rand_CenteredFloat(100.0f);
for (i = 0; i < (s32)randPlusMinusPoint5Scaled(5.0f) + 10; i++) {
for (i = 0; i < (s32)Rand_CenteredFloat(5.0f) + 10; i++) {
EffectSsBubble_Spawn(play, &sp5C, 0, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f);
}
}
@ -1102,9 +1102,9 @@ void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) {
ptr->unk_20 = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(phi_v0));
ptr->unk_00 = true;
ptr->unk_04 = *vec;
ptr->unk_04.x += randPlusMinusPoint5Scaled(ptr->unk_00 + (this->unk_330 * 4000.0f));
ptr->unk_04.y += randPlusMinusPoint5Scaled(20.0f);
ptr->unk_04.z += randPlusMinusPoint5Scaled(ptr->unk_00 + (this->unk_330 * 4000.0f));
ptr->unk_04.x += Rand_CenteredFloat(ptr->unk_00 + (this->unk_330 * 4000.0f));
ptr->unk_04.y += Rand_CenteredFloat(20.0f);
ptr->unk_04.z += Rand_CenteredFloat(ptr->unk_00 + (this->unk_330 * 4000.0f));
ptr->unk_18 = (this->unk_330 * 20.0f) - (Rand_ZeroFloat(5.0f) * 0.01f);
ptr->unk_1C = 0x42;
ptr->unk_10 = arg2;

View File

@ -1838,9 +1838,9 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot)
dy = sLurePos.y - sRodTipPos.y;
dz = sLurePos.z - sRodTipPos.z;
ry = func_80086B30(dx, dz);
ry = Math_FAtan2F(dx, dz);
dist = sqrtf(SQ(dx) + SQ(dz));
rx = -func_80086B30(dy, dist);
rx = -Math_FAtan2F(dy, dist);
dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) * 0.001f;
@ -1865,9 +1865,9 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot)
dy = D_80917218.y - (linePos + i)->y;
dz = D_80917218.z - (linePos + i)->z;
ry = func_80086B30(dx, dz);
ry = Math_FAtan2F(dx, dz);
dist = sqrtf(SQ(dx) + SQ(dz));
rx = -func_80086B30(dy, dist);
rx = -Math_FAtan2F(dy, dist);
dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) * 0.001f;
@ -3003,9 +3003,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->actor.shape.rot.y = -0x8000;
if ((this->actor.projectedPos.z < 200.0f) && (this->actor.projectedPos.z > 0.0f)) {
spC4.x = randPlusMinusPoint5Scaled(5.0f) + 130.0f;
spC4.x = Rand_CenteredFloat(5.0f) + 130.0f;
spC4.y = 40.0f;
spC4.z = randPlusMinusPoint5Scaled(5.0f) + 1280.0f;
spC4.z = Rand_CenteredFloat(5.0f) + 1280.0f;
EnFishing_SpawnBubble(NULL, play->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1);
}
@ -3080,9 +3080,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
} else {
this->unk_150 = 1;
this->unk_172[0] = Rand_ZeroFloat(30.0f) + 10.0f;
this->unk_1AC.x = randPlusMinusPoint5Scaled(300.0f);
this->unk_1AC.x = Rand_CenteredFloat(300.0f);
this->unk_1AC.y = (WATER_SURFACE_Y(play) - 50.0f) - Rand_ZeroFloat(50.0f);
this->unk_1AC.z = randPlusMinusPoint5Scaled(300.0f);
this->unk_1AC.z = Rand_CenteredFloat(300.0f);
this->unk_188 = 1.0f;
this->unk_18C = 2000.0f;
}
@ -3144,8 +3144,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
Math_ApproachF(&this->unk_1A8, 4096.0f, 1.0f, 256.0f);
if ((play->gameplayFrames % 32) == 0) {
this->unk_1AC.x = randPlusMinusPoint5Scaled(600.0f);
this->unk_1AC.z = randPlusMinusPoint5Scaled(600.0f);
this->unk_1AC.x = Rand_CenteredFloat(600.0f);
this->unk_1AC.z = Rand_CenteredFloat(600.0f);
this->unk_1AC.y = -120.0f;
}
} else if (sp124 > 50.0f) {
@ -3600,7 +3600,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
for (spA2 = 0; spA2 < 100; spA2++) {
Matrix_RotateYF(randPlusMinusPoint5Scaled(0.75f * M_PI) +
Matrix_RotateYF(Rand_CenteredFloat(0.75f * M_PI) +
BINANG_TO_RAD_ALT(this->actor.yawTowardsPlayer + 0x8000),
MTXMODE_NEW);
Matrix_MultVec3f(&sp10C, &sp100);
@ -4067,7 +4067,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
func_80903C60(this, 1);
this->unk_17C = this->actor.velocity.y;
this->actor.velocity.y = 0.0f;
this->unk_162 = randPlusMinusPoint5Scaled(32768.0f);
this->unk_162 = (s16)(s32)Rand_CenteredFloat(0x8000);
} else if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) &&
(this->actor.prevPos.y >= WATER_SURFACE_Y(play))) {
if (this->unk_17C < -5.0f) {
@ -4128,10 +4128,10 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
if (Rand_ZeroOne() < 0.5f) {
this->unk_15E = 0;
} else {
this->unk_15E = (s16)randPlusMinusPoint5Scaled(32.0f) + 0x8000;
this->unk_15E = (s16)(s32)Rand_CenteredFloat(0x20) + 0x8000;
}
this->unk_160 = (s16)randPlusMinusPoint5Scaled(16384.0f);
this->unk_160 = (s16)(s32)Rand_CenteredFloat(0x4000);
this->unk_188 = 1.0f;
this->unk_18C = 5000.0f;
this->unk_194 = 5000.0f;
@ -4141,8 +4141,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
if ((this->unk_150 == 5) && !(this->unk_154 & 1)) {
Vec3f pos;
pos.x = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.x;
pos.z = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.z;
pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x;
pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z;
pos.y = this->actor.floorHeight + 5.0f;
EnFishing_SpawnWaterDust(&this->actor.projectedPos, play->specialEffects, &pos,
(this->unk_1A4 * 0.005f) + 0.15f);
@ -4160,9 +4160,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->unk_1CA--;
for (i = 0; i < 2; i++) {
pos.x = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.x;
pos.y = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.y;
pos.z = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.z;
pos.x = Rand_CenteredFloat(range) + this->actor.world.pos.x;
pos.y = Rand_CenteredFloat(range) + this->actor.world.pos.y;
pos.z = Rand_CenteredFloat(range) + this->actor.world.pos.z;
EnFishing_SpawnBubble(&this->actor.projectedPos, play->specialEffects, &pos, Rand_ZeroFloat(0.035f) + 0.04f,
0);
}
@ -4568,14 +4568,14 @@ void EnFishing_UpdateGroupFishes(PlayState* play) {
spD6 = Math_Atan2S_XY(dist, dy);
if ((dist < 10.0f) || (((fish->timer % 32) == 0) && (Rand_ZeroOne() > 0.5f))) {
fish->unk_10.y = basePos[groupIndex].y + randPlusMinusPoint5Scaled(10.0f);
fish->unk_10.y = basePos[groupIndex].y + Rand_CenteredFloat(10.0f);
if (D_8090CF18 != 0) {
fish->unk_10.x = basePos[groupIndex].x + randPlusMinusPoint5Scaled(200.0f);
fish->unk_10.z = basePos[groupIndex].z + randPlusMinusPoint5Scaled(200.0f);
fish->unk_10.x = basePos[groupIndex].x + Rand_CenteredFloat(200.0f);
fish->unk_10.z = basePos[groupIndex].z + Rand_CenteredFloat(200.0f);
} else {
fish->unk_10.x = basePos[groupIndex].x + randPlusMinusPoint5Scaled(100.0f);
fish->unk_10.z = basePos[groupIndex].z + randPlusMinusPoint5Scaled(100.0f);
fish->unk_10.x = basePos[groupIndex].x + Rand_CenteredFloat(100.0f);
fish->unk_10.z = basePos[groupIndex].z + Rand_CenteredFloat(100.0f);
}
ripplePos = fish->pos;
@ -5460,8 +5460,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) {
((play->gameplayFrames % 2) == 0)) {
Vec3f pos;
pos.x = randPlusMinusPoint5Scaled(20.0f) + player->actor.world.pos.x;
pos.z = randPlusMinusPoint5Scaled(20.0f) + player->actor.world.pos.z;
pos.x = Rand_CenteredFloat(20.0f) + player->actor.world.pos.x;
pos.z = Rand_CenteredFloat(20.0f) + player->actor.world.pos.z;
pos.y = player->actor.floorHeight + 5.0f;
EnFishing_SpawnWaterDust(NULL, play->specialEffects, &pos, 0.5f);
}
@ -5552,9 +5552,9 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) {
rot.z = (Camera_GetInputDirYaw(mainCam) * -(M_PI / 0x8000)) + rot.y;
for (i = 0; i < (u8)D_8090CCD0; i++) {
pos.x = randPlusMinusPoint5Scaled(700.0f) + play->view.eye.x;
pos.x = Rand_CenteredFloat(700.0f) + play->view.eye.x;
pos.y = (Rand_ZeroFloat(100.0f) + 150.0f) - 170.0f;
pos.z = randPlusMinusPoint5Scaled(700.0f) + play->view.eye.z;
pos.z = Rand_CenteredFloat(700.0f) + play->view.eye.z;
if (pos.z < 1160.0f) {
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &projectedPos, &sProjectedW);

View File

@ -306,14 +306,14 @@ void func_809328F4(EnFz* this, PlayState* play, Vec3f* arg2, s32 arg3, f32 arg4)
sp88.b = 200;
for (i = 0; i < arg3; i++) {
temp_f24 = randPlusMinusPoint5Scaled(0.3f) + 0.6f;
temp_s1 = (s32)randPlusMinusPoint5Scaled(5.0f) + 12;
spA8.x = randPlusMinusPoint5Scaled(arg4) + arg2->x;
temp_f24 = Rand_CenteredFloat(0.3f) + 0.6f;
temp_s1 = (s32)Rand_CenteredFloat(5.0f) + 12;
spA8.x = Rand_CenteredFloat(arg4) + arg2->x;
spA8.y = Rand_ZeroFloat(arg4) + arg2->y;
spA8.z = randPlusMinusPoint5Scaled(arg4) + arg2->z;
sp9C.x = randPlusMinusPoint5Scaled(10.0f);
spA8.z = Rand_CenteredFloat(arg4) + arg2->z;
sp9C.x = Rand_CenteredFloat(10.0f);
sp9C.y = Rand_ZeroFloat(10.0f) + 2.0f;
sp9C.z = randPlusMinusPoint5Scaled(10.0f);
sp9C.z = Rand_CenteredFloat(10.0f);
EffectSsEnIce_Spawn(play, &spA8, temp_f24, &sp9C, &sp90, &sp8C, &sp88, temp_s1);
}
@ -329,9 +329,9 @@ void func_80932AF4(EnFz* this) {
Vec3f sp2C;
if (!(this->unk_BC6 & 0xF)) {
sp44.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x;
sp44.y = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.y + 30.0f;
sp44.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z;
sp44.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x;
sp44.y = Rand_CenteredFloat(40.0f) + this->actor.world.pos.y + 30.0f;
sp44.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z;
sp2C.x = sp2C.z = 0.0f;
sp2C.y = 0.1f;
sp38.x = sp38.y = sp38.z = 0.0f;
@ -345,9 +345,9 @@ void func_80932BD4(EnFz* this) {
Vec3f sp2C;
if (!(this->unk_BC6 & 3)) {
sp44.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x;
sp44.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x;
sp44.y = this->unk_BB4;
sp44.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z;
sp44.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z;
sp2C.x = sp2C.z = 0.0f;
sp2C.y = 0.1f;
sp38.x = sp38.y = sp38.z = 0.0f;

View File

@ -310,7 +310,7 @@ s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_) {
phi_f14 = points[arg2 + 1].z - points[arg2 - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;

View File

@ -374,7 +374,7 @@ s32 func_80B50C78(EnGk* this, Path* path, s32 arg2_) {
phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
ret = true;

View File

@ -246,7 +246,7 @@ void EnGrasshopper_Init(Actor* thisx, PlayState* play) {
this->type;
}
this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y;
this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y;
EnGrasshopper_SetupFly(this);
}
@ -343,7 +343,7 @@ void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) {
void EnGrasshopper_SetupFly(EnGrasshopper* this) {
EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FLY);
this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y;
this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y;
this->action = EN_GRASSHOPPER_ACTION_FLY;
this->actionFunc = EnGrasshopper_Fly;
}
@ -384,7 +384,7 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) {
}
if (this->shouldTurn) {
this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y;
this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y;
this->targetRot.y = Math_Atan2S(diffX, diffZ);
this->timer = Rand_S16Offset(30, 30);
}
@ -412,7 +412,7 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) {
this->targetRot.y = Math_Atan2S(diffX, diffZ);
this->timer = Rand_S16Offset(30, 70);
this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y;
this->baseFlyHeight = Rand_CenteredFloat(50.0f) + this->flyingHomePos.y;
}
}
}
@ -441,7 +441,7 @@ void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) {
this->baseFlyHeight = Math_SinS(this->bobPhase) * 10.0f;
if (this->timer == 0) {
this->baseFlyHeight = randPlusMinusPoint5Scaled(10.0f);
this->baseFlyHeight = Rand_CenteredFloat(10.0f);
this->timer = Rand_S16Offset(30, 30);
}
@ -583,8 +583,8 @@ void EnGrasshopper_ApproachPlayer(EnGrasshopper* this, PlayState* play) {
if ((this->splashCount < 3) || !(play->gameplayFrames % 8)) {
this->splashCount++;
Math_Vec3f_Copy(&splashPos, &this->tailTipPos);
splashPos.x += randPlusMinusPoint5Scaled(20.0f);
splashPos.z += randPlusMinusPoint5Scaled(20.0f);
splashPos.x += Rand_CenteredFloat(20.0f);
splashPos.z += Rand_CenteredFloat(20.0f);
EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (((s32)Rand_ZeroOne() * 100) + 400));
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER);
}
@ -633,8 +633,8 @@ void EnGrasshopper_Attack(EnGrasshopper* this, PlayState* play) {
if ((this->splashCount < 3) || !(play->gameplayFrames % 8)) {
this->splashCount++;
Math_Vec3f_Copy(&splashPos, &this->tailTipPos);
splashPos.x += randPlusMinusPoint5Scaled(20.0f);
splashPos.z += randPlusMinusPoint5Scaled(20.0f);
splashPos.x += Rand_CenteredFloat(20.0f);
splashPos.z += Rand_CenteredFloat(20.0f);
EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, ((s32)Rand_ZeroOne() * 100) + 400);
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER);
}
@ -796,8 +796,8 @@ void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) {
for (i = 0; i < 3; i++) {
Math_Vec3f_Copy(&splashPos, &this->actor.world.pos);
splashPos.x += randPlusMinusPoint5Scaled((i * 5.0f) + 20.0f);
splashPos.z += randPlusMinusPoint5Scaled((i * 5.0f) + 20.0f);
splashPos.x += Rand_CenteredFloat((i * 5.0f) + 20.0f);
splashPos.z += Rand_CenteredFloat((i * 5.0f) + 20.0f);
EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (((s32)Rand_ZeroOne() * 100) + 400));
}
@ -826,7 +826,7 @@ void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) {
for (i = 0; i < ARRAY_COUNT(sFireVelocityAndAccel); i++) {
Math_Vec3f_Copy(&firePos, &this->actor.world.pos);
firePos.x += randPlusMinusPoint5Scaled(30.0f);
firePos.x += Rand_CenteredFloat(30.0f);
if (!isUnderWater) {
firePos.y = this->actor.floorHeight;
} else if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z,
@ -834,7 +834,7 @@ void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) {
firePos.y = waterSurface;
}
firePos.z += randPlusMinusPoint5Scaled(30.0f);
firePos.z += Rand_CenteredFloat(30.0f);
func_800B3030(play, &firePos, &sFireVelocityAndAccel[i], &sFireVelocityAndAccel[i], 100, 0, 2);
}
@ -1062,10 +1062,10 @@ void EnGrasshopper_InitializeEffect(EnGrasshopper* this, Vec3f* pos) {
effect->isEnabled = true;
effect->pos = *pos;
effect->timer = 10;
effect->velocity.x = randPlusMinusPoint5Scaled(20.0f);
effect->velocity.y = randPlusMinusPoint5Scaled(20.0f);
effect->velocity.z = randPlusMinusPoint5Scaled(20.0f);
effect->yaw = randPlusMinusPoint5Scaled(30000.0f);
effect->velocity.x = Rand_CenteredFloat(20.0f);
effect->velocity.y = Rand_CenteredFloat(20.0f);
effect->velocity.z = Rand_CenteredFloat(20.0f);
effect->yaw = Rand_CenteredFloat(30000.0f);
return;
}
}

View File

@ -815,9 +815,9 @@ s32 func_809995A4(EnGs* this, PlayState* play) {
Vec3f sp60;
for (i = 0; i < 3; i++) {
sp60.x = randPlusMinusPoint5Scaled(15.0f);
sp60.x = Rand_CenteredFloat(15.0f);
sp60.y = Rand_ZeroFloat(-1.0f);
sp60.z = randPlusMinusPoint5Scaled(15.0f);
sp60.z = Rand_CenteredFloat(15.0f);
sp6C.x = this->actor.world.pos.x + (2.0f * sp60.x);
sp6C.y = this->actor.world.pos.y + 7.0f;

View File

@ -265,7 +265,7 @@ void func_80B22500(EnHakurock* this, PlayState* play) {
if (this->counter > 0) {
this->counter--;
if ((this->counter & 1) == 0) {
this->actor.world.pos.y = (sin_rad(this->counter * (M_PI / 20)) * 4.0f) + this->actor.floorHeight;
this->actor.world.pos.y = (Math_SinF(this->counter * (M_PI / 20)) * 4.0f) + this->actor.floorHeight;
} else {
this->actor.world.pos.y = this->actor.floorHeight;
}

View File

@ -107,9 +107,9 @@ void func_80B22E0C(EnHanabiStruct* arg0) {
arg0->unk_20.y *= arg0->unk_14.x;
arg0->unk_20.y -= 1.0f;
arg0->unk_20.x += randPlusMinusPoint5Scaled(0.8f);
arg0->unk_20.y += randPlusMinusPoint5Scaled(0.8f);
arg0->unk_20.z += randPlusMinusPoint5Scaled(0.8f);
arg0->unk_20.x += Rand_CenteredFloat(0.8f);
arg0->unk_20.y += Rand_CenteredFloat(0.8f);
arg0->unk_20.z += Rand_CenteredFloat(0.8f);
if (arg0->unk_01 > 0) {
arg0->unk_01--;
@ -286,10 +286,10 @@ void func_80B236C8(EnHanabi* this, PlayState* play) {
}
sp34.x += sp30 * Math_SinS(this->actor.home.rot.y);
sp34.y += randPlusMinusPoint5Scaled(300.0f);
sp34.y += Rand_CenteredFloat(300.0f);
sp34.z += sp30 * Math_CosS(this->actor.home.rot.y);
if (this->actor.home.rot.x >= 0x259) {
if (this->actor.home.rot.x > 0x258) {
sp28 = func_80B22C80(&sp34, this->unk_148, 2.0f);
} else {
sp28 = func_80B22C80(&sp34, this->unk_148, 1.0f);

View File

@ -173,8 +173,8 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) {
Math_Vec3f_Copy(&sp74, &this->actor.world.pos);
sp74.x += randPlusMinusPoint5Scaled(15.0f);
sp74.z += randPlusMinusPoint5Scaled(15.0f);
sp74.x += Rand_CenteredFloat(15.0f);
sp74.z += Rand_CenteredFloat(15.0f);
EffectSsDtBubble_SpawnCustomColor(play, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30,
true);
@ -216,8 +216,8 @@ void func_80BDB59C(EnHiddenNuts* this, PlayState* play) {
Math_Vec3f_Copy(&sp78, &this->actor.world.pos);
sp78.x += randPlusMinusPoint5Scaled(15.0f);
sp78.z += randPlusMinusPoint5Scaled(15.0f);
sp78.x += Rand_CenteredFloat(15.0f);
sp78.z += Rand_CenteredFloat(15.0f);
EffectSsDtBubble_SpawnCustomColor(play, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30,
true);

View File

@ -814,11 +814,11 @@ void func_80C215E4(PlayState* play, EnHintSkb* this, Vec3f* arg2) {
s32 pad;
sp5C.y = this->actor.floorHeight;
sp5C.x = (sin_rad(sp40) * 15.0f) + arg2->x;
sp5C.z = (cos_rad(sp40) * 15.0f) + arg2->z;
sp5C.x = (Math_SinF(sp40) * 15.0f) + arg2->x;
sp5C.z = (Math_CosF(sp40) * 15.0f) + arg2->z;
sp44.x = randPlusMinusPoint5Scaled(1.0f);
sp44.z = randPlusMinusPoint5Scaled(1.0f);
sp44.x = Rand_CenteredFloat(1.0f);
sp44.z = Rand_CenteredFloat(1.0f);
sp50.y += (Rand_ZeroOne() - 0.5f) * 4.0f;

View File

@ -487,7 +487,7 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) {
if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 23.0f)) {
this->colliderQuad.base.atFlags |= AT_ON;
if (this->drawArmorFlags) {
this->actor.speed = sin_rad((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f;
this->actor.speed = Math_SinF((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f;
}
} else {
this->colliderQuad.base.atFlags &= ~AT_ON;
@ -550,7 +550,7 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) {
} else {
phi_f2 = this->skelAnime.curFrame - 1.0f;
}
this->actor.speed = sin_rad((M_PI / 8) * phi_f2) * 4.5f;
this->actor.speed = Math_SinF((M_PI / 8) * phi_f2) * 4.5f;
}
this->colliderQuad.base.atFlags |= AT_ON;
} else {
@ -685,9 +685,9 @@ void EnIk_Die(EnIk* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
for (i = 6 - (this->timer >> 2); i >= 0; i--) {
effectPos.x = randPlusMinusPoint5Scaled(80.0f) + this->actor.world.pos.x;
effectPos.z = randPlusMinusPoint5Scaled(80.0f) + this->actor.world.pos.z;
effectPos.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f);
effectPos.x = Rand_CenteredFloat(80.0f) + this->actor.world.pos.x;
effectPos.z = Rand_CenteredFloat(80.0f) + this->actor.world.pos.z;
effectPos.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + 20.0f);
func_800B3030(play, &effectPos, &sEffectVelAndAccel, &sEffectVelAndAccel, 100, 0, 2);
}
if (this->timer == 0) {
@ -845,9 +845,9 @@ void EnIk_UpdateArmor(EnIk* this, PlayState* play) {
ikEffect->pos.y = this->actor.floorHeight;
for (i = 0; i < 4; i++) {
effectPos.x = randPlusMinusPoint5Scaled(20.0f) + ikEffect->pos.x;
effectPos.x = Rand_CenteredFloat(20.0f) + ikEffect->pos.x;
effectPos.y = Rand_ZeroFloat(20.0f) + ikEffect->pos.y;
effectPos.z = randPlusMinusPoint5Scaled(20.0f) + ikEffect->pos.z;
effectPos.z = Rand_CenteredFloat(20.0f) + ikEffect->pos.z;
func_800B3030(play, &effectPos, &gZeroVec3f, &gZeroVec3f, 40, 7, 2);
}

View File

@ -242,7 +242,7 @@ s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) {
diffZ = points[currentPoint + 1].z - points[currentPoint - 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 (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;

View File

@ -1461,7 +1461,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) {
void func_80B88CD8(EnKaizoku* this) {
EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3);
this->picto.actor.speed = randPlusMinusPoint5Scaled(12.0f);
this->picto.actor.speed = Rand_CenteredFloat(12.0f);
this->skelAnime.playSpeed = 1.0f;
this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y;
this->unk_2B2 = Rand_ZeroOne() * 30.0f + 30.0f;

View File

@ -1006,11 +1006,11 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) {
if ((play->gameplayFrames % 4) == 0) {
Math_Vec3f_Copy(&tempWorldPos, &this->picto.actor.world.pos);
tempWorldPos.y = this->picto.actor.floorHeight;
tempWorldPos.x += randPlusMinusPoint5Scaled(2.0f);
tempWorldPos.z += randPlusMinusPoint5Scaled(2.0f);
tempWorldPos.x += Rand_CenteredFloat(2.0f);
tempWorldPos.z += Rand_CenteredFloat(2.0f);
if (play->sceneId == SCENE_8ITEMSHOP) {
EffectSsGSplash_Spawn(play, &tempWorldPos, 0, 0, 0, randPlusMinusPoint5Scaled(100.0f) + 200.0f);
EffectSsGSplash_Spawn(play, &tempWorldPos, 0, 0, 0, Rand_CenteredFloat(100.0f) + 200.0f);
SoundSource_PlaySfxAtFixedWorldPos(play, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER);
} else {

View File

@ -606,9 +606,9 @@ void func_80AD8388(EnKame* this, PlayState* play) {
this->actor.scale.y = this->actor.scale.x;
this->actor.scale.z = this->actor.scale.x;
}
sp34.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x;
sp34.x = Rand_CenteredFloat(40.0f) + this->actor.world.pos.x;
sp34.y = this->actor.world.pos.y + 15.0f;
sp34.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z;
sp34.z = Rand_CenteredFloat(40.0f) + this->actor.world.pos.z;
func_800B3030(play, &sp34, &gZeroVec3f, &gZeroVec3f, 100, 0, 2);
}
}

View File

@ -135,8 +135,8 @@ void func_80954960(EnKanban* this) {
ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y);
nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z);
this->floorRot.x = -func_80086B30(-nz * ny, 1.0f);
this->floorRot.z = func_80086B30(-nx * ny, 1.0f);
this->floorRot.x = -Math_FAtan2F(-nz * ny, 1.0f);
this->floorRot.z = Math_FAtan2F(-nx * ny, 1.0f);
}
}
@ -350,7 +350,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
piece->actionState = ENKANBAN_AIR;
piece->actor.gravity = -1.0f;
piece->actor.world.rot.y =
BINANG_ROT180((s32)randPlusMinusPoint5Scaled(0x4000) + this->actor.yawTowardsPlayer);
BINANG_ROT180((s32)Rand_CenteredFloat(0x4000) + this->actor.yawTowardsPlayer);
if ((hitItem->toucher.dmgFlags & 0x10) || (hitItem->toucher.dmgFlags & 8) ||
(hitItem->toucher.dmgFlags & 0x80000000)) {
@ -369,7 +369,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
piece->bounceZ = Rand_ZeroFloat(7.0f) + 3.0f;
}
piece->spinVel.y = randPlusMinusPoint5Scaled(0x1800);
piece->spinVel.y = Rand_CenteredFloat(0x1800);
if (Rand_ZeroOne() < 0.5f) {
piece->direction = 1;
@ -526,7 +526,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
this->actor.velocity.y = 0.0f;
} else {
this->actor.velocity.y *= -0.3f;
this->actor.world.rot.y += (s16)randPlusMinusPoint5Scaled(0x4000);
this->actor.world.rot.y += (s16)(s32)Rand_CenteredFloat(0x4000);
}
bounced = true;
} else {
@ -653,8 +653,8 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
dustCount = this->partCount * 0.5f;
for (j = 0; j < dustCount + 3; j++) {
pos.x = randPlusMinusPoint5Scaled((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.x;
pos.z = randPlusMinusPoint5Scaled((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.z;
pos.x = Rand_CenteredFloat((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.x;
pos.z = Rand_CenteredFloat((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.z;
func_800B0F18(play, &pos, &velocity, &accel, &primColor, &envColor, 100, 5,
Rand_ZeroFloat(5.0f) + 14.0f);
}
@ -750,7 +750,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
this->actionState = ENKANBAN_AIR;
this->actor.gravity = -1.0f;
this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x10000);
this->actor.world.rot.y = Rand_CenteredFloat(0x10000);
if (this->partCount >= 4) {
this->bounceX = Rand_ZeroFloat(10.0f) + 6.0f;
this->bounceZ = Rand_ZeroFloat(10.0f) + 6.0f;
@ -763,7 +763,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
this->actor.speed = Rand_ZeroFloat(1.5f);
}
this->spinVel.y = randPlusMinusPoint5Scaled(0x1800);
this->spinVel.y = Rand_CenteredFloat(0x1800);
if (Rand_ZeroOne() < 0.5f) {
this->direction = 1;
@ -808,7 +808,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
this->actor.speed = 4.0f + bombStrength;
}
this->spinVel.y = randPlusMinusPoint5Scaled(0x1800);
this->spinVel.y = Rand_CenteredFloat(0x1800);
if (Rand_ZeroOne() < 0.5f) {
this->direction = 1;

View File

@ -233,9 +233,9 @@ void EnMinifrog_SpawnDust(EnMinifrog* this, PlayState* play) {
vec5.z = this->actor.world.pos.z - (5.0f * Math_CosS(yaw) * Math_CosS(pitch));
for (i = 0; i < 5; i++) {
vel.x = randPlusMinusPoint5Scaled(4.0f);
vel.y = randPlusMinusPoint5Scaled(4.0f);
vel.z = randPlusMinusPoint5Scaled(4.0f);
vel.x = Rand_CenteredFloat(4.0f);
vel.y = Rand_CenteredFloat(4.0f);
vel.z = Rand_CenteredFloat(4.0f);
accel.x = -vel.x * 0.1f;
accel.y = -vel.y * 0.1f;
accel.z = -vel.z * 0.1f;

View File

@ -209,11 +209,11 @@ void EnMinislime_AddIceSmokeEffect(EnMinislime* this, PlayState* play) {
Vec3f pos;
Vec3f vel;
pos.x = (randPlusMinusPoint5Scaled(200.0f) * this->actor.scale.x) + this->actor.world.pos.x;
pos.x = (Rand_CenteredFloat(200.0f) * this->actor.scale.x) + this->actor.world.pos.x;
pos.y = CLAMP_MIN(this->actor.world.pos.y, GBT_ROOM_5_MIN_Y + 30.0f);
pos.z = (randPlusMinusPoint5Scaled(200.0f) * this->actor.scale.z) + this->actor.world.pos.z;
vel.x = randPlusMinusPoint5Scaled(1.5f);
vel.z = randPlusMinusPoint5Scaled(1.5f);
pos.z = (Rand_CenteredFloat(200.0f) * this->actor.scale.z) + this->actor.world.pos.z;
vel.x = Rand_CenteredFloat(1.5f);
vel.z = Rand_CenteredFloat(1.5f);
vel.y = 2.0f;
EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 500);
}
@ -401,8 +401,8 @@ void EnMinislime_GrowAndShrink(EnMinislime* this, PlayState* play) {
this->growShrinkTimer--;
scaleFactor = (this->growShrinkTimer / 6) + 1.0f;
this->actor.scale.z = this->actor.scale.x =
((cos_rad(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * (2.0f / 30.0f))) + 1.5f) * 0.1f;
this->actor.scale.y = ((sin_rad(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * 0.05f)) + 0.75f) * 0.1f;
((Math_CosF(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * (2.0f / 30.0f))) + 1.5f) * 0.1f;
this->actor.scale.y = ((Math_SinF(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * 0.05f)) + 0.75f) * 0.1f;
if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) {
EnMinislime_SetupMoveToGekko(this);
} else if ((this->actor.xzDistToPlayer < 150.0f) && (this->growShrinkTimer < 38)) {
@ -424,11 +424,12 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) {
f32 speedXZ;
this->idleTimer--;
speedXZ = sin_rad(this->idleTimer * (M_PI / 10));
speedXZ = Math_SinF(this->idleTimer * (M_PI / 10));
this->actor.speed = speedXZ * 1.5f;
this->actor.speed = CLAMP_MIN(this->actor.speed, 0.0f);
Math_StepToF(&this->actor.scale.x, ((0.14f * speedXZ) + 1.5f) * 0.1f, 0.010000001f);
Math_StepToF(&this->actor.scale.y, ((cos_rad(this->idleTimer * (M_PI / 10)) * 0.07f) + 0.75f) * 0.1f, 0.010000001f);
Math_StepToF(&this->actor.scale.y, ((Math_CosF(this->idleTimer * (M_PI / 10)) * 0.07f) + 0.75f) * 0.1f,
0.010000001f);
Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f);
if (this->idleTimer == 0) {
if (this->actor.xzDistToPlayer < 300.0f) {
@ -537,13 +538,13 @@ void EnMinislime_Knockback(EnMinislime* this, PlayState* play) {
this->knockbackTimer--;
Math_StepToF(&this->actor.speed, 0.0f, 1.0f);
sqrtFrozenTimer = sqrtf(this->knockbackTimer);
this->actor.scale.x = ((cos_rad(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f;
this->actor.scale.x = ((Math_CosF(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f;
this->actor.scale.z = this->actor.scale.x;
if (this->knockbackTimer == 15) {
this->collider.base.acFlags |= AC_ON;
}
this->actor.scale.y = ((sin_rad(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.075f;
this->actor.scale.y = ((Math_SinF(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.075f;
if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) {
EnMinislime_SetupMoveToGekko(this);
} else if (this->knockbackTimer == 0) {
@ -575,9 +576,10 @@ void EnMinislime_DefeatIdle(EnMinislime* this, PlayState* play) {
f32 xzScale;
this->idleTimer--;
xzScale = sin_rad(this->idleTimer * (M_PI / 10));
xzScale = Math_SinF(this->idleTimer * (M_PI / 10));
Math_StepToF(&this->actor.scale.x, ((0.14f * xzScale) + 1.5f) * 0.1f, 0.010000001f);
Math_StepToF(&this->actor.scale.y, ((0.07f * cos_rad(this->idleTimer * (M_PI / 10))) + 0.75f) * 0.1f, 0.010000001f);
Math_StepToF(&this->actor.scale.y, ((0.07f * Math_CosF(this->idleTimer * (M_PI / 10))) + 0.75f) * 0.1f,
0.010000001f);
Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f);
if (this->idleTimer == 0) {
this->idleTimer = 20;
@ -670,9 +672,9 @@ void EnMinislime_GekkoThrow(EnMinislime* this, PlayState* play) {
f32 xzScale;
this->throwTimer--;
xzScale = sin_rad(this->throwTimer * (M_PI / 5));
xzScale = Math_SinF(this->throwTimer * (M_PI / 5));
this->actor.scale.x = ((0.3f * xzScale) + 1.5f) * 0.1f;
this->actor.scale.y = ((cos_rad(this->throwTimer * (M_PI / 5)) * 0.2f) + 0.75f) * 0.1f;
this->actor.scale.y = ((Math_CosF(this->throwTimer * (M_PI / 5)) * 0.2f) + 0.75f) * 0.1f;
this->actor.scale.z = 0.3f - this->actor.scale.x;
if (this->throwTimer == 0) {
this->throwTimer = 10;

View File

@ -274,7 +274,7 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) {
Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer, 0x400);
}
this->actor.shape.rot.y =
(s32)(sin_rad(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150;
(s32)(Math_SinF(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150;
func_800B9010(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG);
if (sp20) {
this->unk_14B &= ~2;
@ -379,16 +379,16 @@ void func_80A4E84C(EnMkk* this) {
this->unk_154.y = this->actor.world.pos.y;
this->unk_154.x = this->actor.world.pos.x -
10.0f * Math_SinS(this->actor.shape.rot.y +
(s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5))));
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5))));
this->unk_154.z = this->actor.world.pos.z -
10.0f * Math_CosS(this->actor.shape.rot.y +
(s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5))));
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5))));
this->unk_160.x = this->unk_154.x -
12.0f * Math_SinS(this->actor.shape.rot.y -
(s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5))));
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5))));
this->unk_160.z = this->unk_154.z -
12.0f * Math_CosS(this->actor.shape.rot.y -
(s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5))));
(s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5))));
}
}

View File

@ -87,9 +87,9 @@ void EnNimotsu_Update(Actor* thisx, PlayState* play) {
}
if ((play->state.frames % 3) == 0) {
dustPosition.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(15.0f);
dustPosition.x = this->actor.world.pos.x + Rand_CenteredFloat(15.0f);
dustPosition.y = this->actor.world.pos.y;
dustPosition.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(15.0f);
dustPosition.z = this->actor.world.pos.z + Rand_CenteredFloat(15.0f);
Actor_SpawnFloorDustRing(play, &this->actor, &dustPosition, 20.0f, 0, 2.0f, 0, 0, 0);
}
}

View File

@ -280,7 +280,7 @@ void EnNiw_SpawnAttackNiw(EnNiw* this, PlayState* play) {
yView = play->view.at.y - play->view.eye.y;
zView = play->view.at.z - play->view.eye.z;
newNiwPos.x = ((Rand_ZeroOne() - 0.5f) * xView) + play->view.eye.x;
newNiwPos.y = randPlusMinusPoint5Scaled(0.3f) + (play->view.eye.y + 50.0f + (yView * 0.5f));
newNiwPos.y = Rand_CenteredFloat(0.3f) + (play->view.eye.y + 50.0f + (yView * 0.5f));
newNiwPos.z = ((Rand_ZeroOne() - 0.5f) * zView) + play->view.eye.z;
attackNiw = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ATTACK_NIW, newNiwPos.x,
newNiwPos.y, newNiwPos.z, 0, 0, 0, ATTACK_NIW_REGULAR);
@ -340,8 +340,8 @@ void EnNiw_SetupIdle(EnNiw* this) {
void EnNiw_Idle(EnNiw* this, PlayState* play) {
f32 posX2;
f32 posZ2;
f32 posX1 = randPlusMinusPoint5Scaled(100.0f);
f32 posZ1 = randPlusMinusPoint5Scaled(100.0f);
f32 posX1 = Rand_CenteredFloat(100.0f);
f32 posZ1 = Rand_CenteredFloat(100.0f);
s16 nextAnimIndex;
if (this->niwType == NIW_TYPE_REGULAR) {
@ -438,9 +438,9 @@ void EnNiw_Held(EnNiw* this, PlayState* play) {
this->heldTimer = (s32)(Rand_ZeroFloat(1.0f) * 10.0f) + 10;
}
this->actor.shape.rot.x = (s16)randPlusMinusPoint5Scaled(5000.0f) + this->actor.world.rot.x;
this->actor.shape.rot.y = (s16)randPlusMinusPoint5Scaled(5000.0f) + this->actor.world.rot.y;
this->actor.shape.rot.z = (s16)randPlusMinusPoint5Scaled(5000.0f) + this->actor.world.rot.z;
this->actor.shape.rot.x = (s16)(s32)Rand_CenteredFloat(0x1388) + this->actor.world.rot.x;
this->actor.shape.rot.y = (s16)(s32)Rand_CenteredFloat(0x1388) + this->actor.world.rot.y;
this->actor.shape.rot.z = (s16)(s32)Rand_CenteredFloat(0x1388) + this->actor.world.rot.z;
if (this->niwType == NIW_TYPE_REGULAR) {
if (Actor_HasNoParent(&this->actor, play)) {
this->actor.shape.rot.z = 0;
@ -773,9 +773,9 @@ void EnNiw_Update(Actor* thisx, PlayState* play) {
featherCount = 4;
}
for (i = 0; i < featherCount; i++) {
pos.x = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.x;
pos.y = randPlusMinusPoint5Scaled(10.0f) + (this->actor.world.pos.y + this->unk308);
pos.z = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.z;
pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x;
pos.y = Rand_CenteredFloat(10.0f) + (this->actor.world.pos.y + this->unk308);
pos.z = Rand_CenteredFloat(10.0f) + this->actor.world.pos.z;
featherScale = Rand_ZeroFloat(6.0f) + 6.0f;
if ((this->unk29E == 2) && (this->unk308 != 0)) {
@ -785,9 +785,9 @@ void EnNiw_Update(Actor* thisx, PlayState* play) {
if (this->unk308 == 0) {
featherScale = Rand_ZeroFloat(2.0f) + 2.0f;
}
vel.x = randPlusMinusPoint5Scaled(3.0f);
vel.x = Rand_CenteredFloat(3.0f);
vel.y = Rand_ZeroFloat(2.0f) * 0.5f + 2.0f;
vel.z = randPlusMinusPoint5Scaled(3.0f);
vel.z = Rand_CenteredFloat(3.0f);
accel.z = accel.x = 0.0f;
accel.y = -0.15f;

View File

@ -110,9 +110,9 @@ void EnNwc_SpawnDust(EnNwc* this, PlayState* play) {
vec5.z = this->actor.world.pos.z - 5.0f * Math_CosS(yaw) * Math_CosS(pitch);
for (i = 0; i < 5; i++) {
vel.x = randPlusMinusPoint5Scaled(4.0f);
vel.y = randPlusMinusPoint5Scaled(4.0f);
vel.z = randPlusMinusPoint5Scaled(4.0f);
vel.x = Rand_CenteredFloat(4.0f);
vel.y = Rand_CenteredFloat(4.0f);
vel.z = Rand_CenteredFloat(4.0f);
accel.x = -vel.x * 0.1f;
accel.y = -vel.y * 0.1f;
accel.z = -vel.z * 0.1f;
@ -182,7 +182,7 @@ void EnNwc_ChangeState(EnNwc* this, s16 newState) {
case NWC_STATE_TURNING:
this->stateTimer = Rand_ZeroFloat(20.0f) + 15.0f;
this->actionFunc = EnNwc_Turn;
this->fallingRotY = (s16)(s32)randPlusMinusPoint5Scaled(0x10000);
this->fallingRotY = (s16)(s32)Rand_CenteredFloat(0x10000);
break;
case NWC_STATE_HOPPING_FORWARD:
@ -193,7 +193,7 @@ void EnNwc_ChangeState(EnNwc* this, s16 newState) {
case NWC_STATE_FOLLOWING:
this->actionFunc = EnNwc_Follow;
this->transformTimer = 0;
this->randomRot = (s16)(s32)randPlusMinusPoint5Scaled(10000.0f);
this->randomRot = (s16)(s32)Rand_CenteredFloat(0x2710);
break;
case NWC_STATE_RUNNING:
@ -331,7 +331,7 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) {
}
} else { // not too close: keep moving
this->randomRot += (s16)randPlusMinusPoint5Scaled(1500.0f);
this->randomRot += (s16)(s32)Rand_CenteredFloat(0x5DC);
if (this->randomRot > 0x1388) {
this->randomRot = 0x1388;
} else if (this->randomRot < -0x1388) {

View File

@ -118,9 +118,9 @@ void func_80BF5E68(EnOsk* this, AnimationHeader** animations, s16 index, f32 pla
void func_80BF5EBC(EnOsk* this, PlayState* play) {
Vec3f sp2C;
sp2C.x = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.x;
sp2C.z = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.z;
sp2C.y = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.y;
sp2C.x = Rand_CenteredFloat(30.0f) + this->actor.world.pos.x;
sp2C.z = Rand_CenteredFloat(30.0f) + this->actor.world.pos.z;
sp2C.y = Rand_CenteredFloat(30.0f) + this->actor.world.pos.y;
func_800B3030(play, &sp2C, &D_80BF7018, &D_80BF7018, 100, 0, 2);
}

View File

@ -271,7 +271,7 @@ void func_8095AB1C(EnOwl* this, PlayState* play) {
}
void func_8095AB4C(EnOwl* this) {
if (randPlusMinusPoint5Scaled(1.0f) < 0.0f) {
if (Rand_CenteredFloat(1.0f) < 0.0f) {
this->actionFlags |= 0x20;
} else {
this->actionFlags &= ~0x20;

View File

@ -306,7 +306,7 @@ s32 func_8086A2CC(EnPametfrog* this, CollisionPoly* floorPoly) {
return false;
}
rotation = func_80086C48(arg0);
rotation = Math_FAcosF(arg0);
if (rotation < 0.0001f) {
return false;
}
@ -523,7 +523,7 @@ void EnPametfrog_FallOffSnapper(EnPametfrog* this, PlayState* play) {
this->timer--;
}
sin = sin_rad(this->timer * (M_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f;
sin = Math_SinF(this->timer * (M_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f;
EnPametfrog_ShakeCamera(this, play, 300.0f * sin, 100.0f * sin);
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
EnPametfrog_StopCutscene(this, play);
@ -966,9 +966,9 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, PlayState* play) {
Flags_SetClearTemp(play, play->roomCtx.curRoom.num);
for (i = 0; i < 25; i++) {
vel.x = randPlusMinusPoint5Scaled(5.0f);
vel.x = Rand_CenteredFloat(5.0f);
vel.y = Rand_ZeroFloat(3.0f) + 4.0f;
vel.z = randPlusMinusPoint5Scaled(5.0f);
vel.z = Rand_CenteredFloat(5.0f);
EffectSsHahen_Spawn(play, &this->actor.world.pos, &vel, &sAccel, 0, Rand_S16Offset(12, 3), HAHEN_OBJECT_DEFAULT,
10, 0);
}
@ -981,7 +981,7 @@ void EnPametfrog_SpawnFrog(EnPametfrog* this, PlayState* play) {
f32 magShake;
this->timer--;
magShake = (sin_rad(this->timer * (M_PI / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f;
magShake = (Math_SinF(this->timer * (M_PI / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f;
EnPametfrog_ShakeCamera(this, play, 75.0f * magShake, 10.0f * magShake);
if (this->timer == 0) {
EnPametfrog_StopCutscene(this, play);

View File

@ -90,10 +90,10 @@ void func_808654C4(EnPart* this, PlayState* play) {
break;
case ENPART_TYPE_4:
for (i = 7; i >= 0; i--) {
effectPos.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x;
effectPos.y = randPlusMinusPoint5Scaled(50.0f) +
effectPos.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x;
effectPos.y = Rand_CenteredFloat(50.0f) +
(this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y));
effectPos.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z;
effectPos.z = Rand_CenteredFloat(60.0f) + this->actor.world.pos.z;
effectVelocity.y = Rand_ZeroOne() + 1.0f;
effectScale = Rand_S16Offset(80, 100);
EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &gZeroVec3f, effectScale, 25,

View File

@ -257,9 +257,9 @@ void func_80897258(PlayState* play, EnPeehat* this, Vec3f* arg2, f32 arg3, f32 a
sp44.x = (Math_SinS(sp42) * arg3) + arg2->x;
sp44.z = (Math_CosS(sp42) * arg3) + arg2->z;
D_80899564.x = randPlusMinusPoint5Scaled(1.05f);
D_80899564.z = randPlusMinusPoint5Scaled(1.05f);
D_80899558.y = randPlusMinusPoint5Scaled(4.0f) + 8.0f;
D_80899564.x = Rand_CenteredFloat(1.05f);
D_80899564.z = Rand_CenteredFloat(1.05f);
D_80899558.y = Rand_CenteredFloat(4.0f) + 8.0f;
EffectSsHahen_Spawn(play, &sp44, &D_80899558, &D_80899564, 0, (Rand_ZeroFloat(5.0f) + 12.0f) * arg4,
HAHEN_OBJECT_DEFAULT, 10, NULL);
@ -506,7 +506,7 @@ void func_80897F44(EnPeehat* this, PlayState* play) {
this->actor.world.pos.y -= 1.0f;
}
cos = cos_rad(this->unk_2B8);
cos = Math_CosF(this->unk_2B8);
this->actor.world.pos.y += cos * 1.4f;
this->unk_2B8 += fabsf(cos * 0.18f) + 0.07f;
this->unk_2B0--;
@ -514,7 +514,7 @@ void func_80897F44(EnPeehat* this, PlayState* play) {
if (this->unk_2B0 <= 0) {
this->actor.speed = Rand_ZeroFloat(0.5f) + 2.5f;
this->unk_2B0 = Rand_ZeroFloat(10.0f) + 10.0f;
this->unk_2B6 = randPlusMinusPoint5Scaled(1000.0f);
this->unk_2B6 = Rand_CenteredFloat(1000.0f);
}
SkelAnime_Update(&this->skelAnime);
@ -549,10 +549,10 @@ void func_80898144(EnPeehat* this, PlayState* play) {
} else {
this->actor.world.pos.y += 1.0f;
}
cos = cos_rad(this->unk_2B8);
cos = Math_CosF(this->unk_2B8);
this->actor.world.pos.y += cos * 1.4f;
cos = cos_rad(this->unk_2B8);
cos = Math_CosF(this->unk_2B8);
this->unk_2B8 += fabsf(cos * 0.18f) + 0.07f;
step = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos);

View File

@ -397,17 +397,17 @@ void EnPp_SpawnDust(EnPp* this, PlayState* play) {
Vec3f accel;
for (i = 0; i < ARRAY_COUNT(this->backFootPos); i++) {
velocity.x = randPlusMinusPoint5Scaled(2.0f);
velocity.x = Rand_CenteredFloat(2.0f);
velocity.y = Rand_ZeroFloat(2.0f) + 1.0f;
velocity.z = randPlusMinusPoint5Scaled(2.0f);
velocity.z = Rand_CenteredFloat(2.0f);
accel.y = -0.1f;
accel.z = 0.0f;
accel.x = 0.0f;
pos.x = this->backFootPos[i].x + randPlusMinusPoint5Scaled(10.0f);
pos.x = this->backFootPos[i].x + Rand_CenteredFloat(10.0f);
pos.y = Rand_ZeroFloat(3.0f) + this->actor.floorHeight + 1.0f;
pos.z = this->backFootPos[i].z + randPlusMinusPoint5Scaled(10.0f);
pos.z = this->backFootPos[i].z + Rand_CenteredFloat(10.0f);
func_800B0EB0(play, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor, (Rand_ZeroFloat(50.0f) + 60.0f),
30, (Rand_ZeroFloat(5.0f) + 20.0f));
@ -534,8 +534,8 @@ void EnPp_Idle(EnPp* this, PlayState* play) {
if ((this->timer == 0) && (this->secondaryTimer == 0)) {
this->secondaryTimer = Rand_ZeroFloat(20.0f) + 20.0f;
Math_Vec3f_Copy(&posToLookAt, &this->actor.home.pos);
posToLookAt.x += randPlusMinusPoint5Scaled(50.0f);
posToLookAt.z += randPlusMinusPoint5Scaled(50.0f);
posToLookAt.x += Rand_CenteredFloat(50.0f);
posToLookAt.z += Rand_CenteredFloat(50.0f);
this->targetRotY = Math_Vec3f_Yaw(&this->actor.world.pos, &posToLookAt);
this->actor.speed = 0.0f;
if (this->animIndex != EN_PP_ANIM_IDLE) {
@ -1046,8 +1046,8 @@ void EnPp_Dead(EnPp* this, PlayState* play) {
if (this->actor.world.pos.y < waterSurface) {
for (i = 0; i < 5; i++) {
Math_Vec3f_Copy(&splashPos, &this->actor.world.pos);
splashPos.x += randPlusMinusPoint5Scaled(10 + (5 * i));
splashPos.z += randPlusMinusPoint5Scaled(40 + (5 * i));
splashPos.x += Rand_CenteredFloat(10 + (5 * i));
splashPos.z += Rand_CenteredFloat(40 + (5 * i));
EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (Rand_ZeroOne() * 100.0f) + 400.0f);
}
@ -1143,9 +1143,9 @@ void EnPp_Mask_Detach(EnPp* this, PlayState* play) {
for (i = 0; i < ARRAY_COUNT(sMaskFireVelocityAndAccel); i++) {
Math_Vec3f_Copy(&maskFirePos, &this->maskFlamesBasePos);
maskFirePos.x += randPlusMinusPoint5Scaled(20.0f);
maskFirePos.x += Rand_CenteredFloat(20.0f);
maskFirePos.y = this->actor.floorHeight;
maskFirePos.z += randPlusMinusPoint5Scaled(20.0f);
maskFirePos.z += Rand_CenteredFloat(20.0f);
func_800B3030(play, &maskFirePos, &sMaskFireVelocityAndAccel[i],
&sMaskFireVelocityAndAccel[i], 70, 0, 2);
}
@ -1173,7 +1173,7 @@ void EnPp_BodyPart_SetupMove(EnPp* this) {
this->deadBodyPartRotationalVelocity.z = (this->deadBodyPartIndex * 0x2E) + 0xFF00;
if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_BODY_PART_BODY) {
this->actor.speed = Rand_ZeroFloat(4.0f) + 4.0f;
this->actor.world.rot.y = ((s32)randPlusMinusPoint5Scaled(223.0f) + 0x1999) * this->deadBodyPartIndex;
this->actor.world.rot.y = ((s32)Rand_CenteredFloat(223.0f) + 0x1999) * this->deadBodyPartIndex;
}
this->action = EN_PP_ACTION_BODY_PART_MOVE;
@ -1213,8 +1213,8 @@ void EnPp_BodyPart_Move(EnPp* this, PlayState* play) {
if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) {
for (i = 0; i < 6; i++) {
Math_Vec3f_Copy(&splashPos, &this->actor.world.pos);
splashPos.x += randPlusMinusPoint5Scaled(10 + (5 * i));
splashPos.z += randPlusMinusPoint5Scaled(40 + (5 * i));
splashPos.x += Rand_CenteredFloat(10 + (5 * i));
splashPos.z += Rand_CenteredFloat(40 + (5 * i));
EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (Rand_ZeroOne() * 100.0f) + 400.0f);
}
} else {

View File

@ -319,7 +319,7 @@ void func_80A32A40(EnPr* this, PlayState* play) {
WaterBox* sp30;
Math_Vec3f_Copy(&sp34, &this->actor.world.pos);
sp34.y = randPlusMinusPoint5Scaled(50.0f) + this->actor.home.pos.y;
sp34.y = Rand_CenteredFloat(50.0f) + this->actor.home.pos.y;
if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_2B4,
&sp30)) {
@ -551,9 +551,9 @@ void EnPr_Update(Actor* thisx, PlayState* play) {
Math_Vec3f_Copy(&sp40, &this->unk_2D4);
this->unk_204 = 0;
sp40.x += randPlusMinusPoint5Scaled(20.0f);
sp40.y += randPlusMinusPoint5Scaled(5.0f);
sp40.z += randPlusMinusPoint5Scaled(20.0f);
sp40.x += Rand_CenteredFloat(20.0f);
sp40.y += Rand_CenteredFloat(5.0f);
sp40.z += Rand_CenteredFloat(20.0f);
for (i = 0; i < (s32)Rand_ZeroFloat(5.0f) + 5; i++) {
EffectSsBubble_Spawn(play, &sp40, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f);

View File

@ -390,8 +390,8 @@ void func_80A748E8(EnPr2* this, PlayState* play) {
if (this->unk_1DA == 1) {
this->unk_1D8 = Rand_S16Offset(100, 100);
Math_Vec3f_Copy(&sp3C, &this->unk_228);
sp3C.x += randPlusMinusPoint5Scaled(300.0f);
sp3C.z += randPlusMinusPoint5Scaled(300.0f);
sp3C.x += Rand_CenteredFloat(300.0f);
sp3C.z += Rand_CenteredFloat(300.0f);
Math_Vec3f_Copy(&this->unk_21C, &sp3C);
}
} else {
@ -536,7 +536,7 @@ void func_80A751B4(EnPr2* this) {
this->actor.shape.rot.z = this->actor.world.rot.z;
this->unk_1D8 = 30;
this->actor.speed = Rand_ZeroFloat(0.5f);
this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x8000);
this->actor.world.rot.y = Rand_CenteredFloat(0x8000);
}
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 10);
this->unk_1D4 = 3;
@ -596,9 +596,9 @@ void func_80A75310(EnPr2* this, PlayState* play) {
for (i = 0; i < 10; i++) {
Math_Vec3f_Copy(&sp64, &this->actor.world.pos);
sp64.x += randPlusMinusPoint5Scaled(20.0f);
sp64.y += randPlusMinusPoint5Scaled(5.0f);
sp64.z += randPlusMinusPoint5Scaled(20.0f);
sp64.x += Rand_CenteredFloat(20.0f);
sp64.y += Rand_CenteredFloat(5.0f);
sp64.z += Rand_CenteredFloat(20.0f);
frame = Rand_ZeroFloat(0.03f) + 0.07f;
EffectSsBubble_Spawn(play, &sp64, 0.0f, 5.0f, 5.0f, frame);
@ -675,9 +675,9 @@ void EnPr2_Update(Actor* thisx, PlayState* play) {
Math_Vec3f_Copy(&sp58, &this->unk_270);
this->unk_1D6 = false;
sp58.x += randPlusMinusPoint5Scaled(20.0f);
sp58.y += randPlusMinusPoint5Scaled(5.0f);
sp58.z += randPlusMinusPoint5Scaled(20.0f);
sp58.x += Rand_CenteredFloat(20.0f);
sp58.y += Rand_CenteredFloat(5.0f);
sp58.z += Rand_CenteredFloat(20.0f);
for (i = 0; i < 2; i++) {
rand = Rand_ZeroFloat(0.03f) + 0.07f;

View File

@ -127,7 +127,7 @@ void EnPrz_Init(Actor* thisx, PlayState* play) {
this->unk_220 = &this->actor;
this->unk_1EC = 255;
this->unk_202 = randPlusMinusPoint5Scaled((this->unk_1E6 * 100.0f) + 1000.0f);
this->unk_202 = Rand_CenteredFloat((this->unk_1E6 * 100.0f) + 1000.0f);
func_80A76388(this);
}
@ -176,7 +176,7 @@ void func_80A76070(EnPrz* this, s16 arg1, PlayState* play) {
temp_s0 = -100;
}
if (fabsf(this->actor.world.rot.y - (f32)arg1) < (randPlusMinusPoint5Scaled(20.0f) + 100.0f)) {
if (fabsf(this->actor.world.rot.y - (f32)arg1) < (Rand_CenteredFloat(20.0f) + 100.0f)) {
Math_ApproachZeroF(&this->unk_218, 0.5f, 20.0f);
} else {
Math_ApproachF(&this->unk_218, temp_s0, 0.5f, 5.0f);
@ -218,7 +218,7 @@ s32 func_80A762C0(EnPrz* this, PlayState* play) {
}
void func_80A76388(EnPrz* this) {
this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 4.0f;
this->actor.speed = Rand_CenteredFloat(1.0f) + 4.0f;
func_80A75F18(this, 0);
this->unk_1EA = 1;
this->actionFunc = func_80A763E8;
@ -251,11 +251,11 @@ void func_80A763E8(EnPrz* this, PlayState* play) {
if ((this->unk_1EE == 0) && (this->unk_1F2 == 0)) {
s16 rot;
this->unk_214 = randPlusMinusPoint5Scaled(40.0f);
this->unk_214 = Rand_CenteredFloat(40.0f);
rot = BINANG_ROT180(this->unk_220->world.rot.y);
this->unk_1D8.x += Math_SinS(rot) * this->unk_214;
this->unk_1D8.y = randPlusMinusPoint5Scaled(40.0f) + (this->unk_220->world.pos.y + 40.0f);
this->unk_1D8.y = Rand_CenteredFloat(40.0f) + (this->unk_220->world.pos.y + 40.0f);
rot = BINANG_ROT180(this->unk_220->world.rot.y);
this->unk_1D8.z += Math_CosS(rot) * this->unk_214;
@ -302,7 +302,7 @@ void func_80A76634(EnPrz* this, PlayState* play) {
}
void func_80A76748(EnPrz* this) {
this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 3.0f;
this->actor.speed = Rand_CenteredFloat(1.0f) + 3.0f;
this->unk_1EE = 0;
this->unk_1EA = 3;
this->skelAnime.playSpeed = 2.0f;
@ -317,7 +317,7 @@ void func_80A767A8(EnPrz* this, PlayState* play) {
if (func_80A762C0(this, play)) {
func_80A75F18(this, 0);
this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 4.0f;
this->actor.speed = Rand_CenteredFloat(1.0f) + 4.0f;
func_80A76604(this, play);
return;
}
@ -353,8 +353,8 @@ void func_80A767A8(EnPrz* this, PlayState* play) {
this->unk_1C8 = 1;
}
this->unk_1D8.y = (player->actor.world.pos.y + D_80A771E0[GET_PLAYER_FORM]) +
randPlusMinusPoint5Scaled((2.0f * this->unk_1E6) + 1.0f);
this->unk_1D8.y =
(player->actor.world.pos.y + D_80A771E0[GET_PLAYER_FORM]) + Rand_CenteredFloat((2.0f * this->unk_1E6) + 1.0f);
func_80A76070(this, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8), play);
}
@ -374,7 +374,7 @@ void func_80A76A1C(EnPrz* this) {
this->unk_1FE = this->actor.world.rot.y;
this->actor.speed = Rand_ZeroFloat(0.5f);
this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x8000);
this->actor.world.rot.y = Rand_CenteredFloat(0x8000);
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 30);
this->unk_1EE = 50;
@ -409,9 +409,9 @@ void func_80A76B14(EnPrz* this, PlayState* play) {
for (i = 0; i < 10; i++) {
Math_Vec3f_Copy(&sp6C, &this->actor.world.pos);
sp6C.x += randPlusMinusPoint5Scaled(20.0f);
sp6C.y += randPlusMinusPoint5Scaled(5.0f);
sp6C.z += randPlusMinusPoint5Scaled(20.0f);
sp6C.x += Rand_CenteredFloat(20.0f);
sp6C.y += Rand_CenteredFloat(5.0f);
sp6C.z += Rand_CenteredFloat(20.0f);
EffectSsBubble_Spawn(play, &sp6C, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f);
}
@ -473,9 +473,9 @@ void EnPrz_Update(Actor* thisx, PlayState* play) {
Math_Vec3f_Copy(&sp38, &this->unk_1CC);
this->unk_1C8 = 0;
sp38.x += randPlusMinusPoint5Scaled(20.0f);
sp38.y += randPlusMinusPoint5Scaled(5.0f);
sp38.z += randPlusMinusPoint5Scaled(20.0f);
sp38.x += Rand_CenteredFloat(20.0f);
sp38.y += Rand_CenteredFloat(5.0f);
sp38.z += Rand_CenteredFloat(20.0f);
EffectSsBubble_Spawn(play, &sp38, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f);
}

View File

@ -275,8 +275,8 @@ s16 EnRacedog_GetYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ)
if (path != NULL) {
point = Lib_SegmentedToVirtual(path->points);
point = &point[pointIndex];
diffXRand = (randPlusMinusPoint5Scaled(100.0f) + point->x) - pos->x;
diffZRand = (randPlusMinusPoint5Scaled(100.0f) + point->z) - pos->z;
diffXRand = (Rand_CenteredFloat(100.0f) + point->x) - pos->x;
diffZRand = (Rand_CenteredFloat(100.0f) + point->z) - pos->z;
diffX = point->x - pos->x;
diffZ = point->z - pos->z;
} else {
@ -474,9 +474,9 @@ void EnRacedog_UpdateSpeed(EnRacedog* this) {
// The dog is past the very start, but is still less than 1/4th of the way through the race track.
// This code will give the blue dog a higher base speed than any other dog (6.0 instead of 5.0).
if (sDogInfo[this->index].color == DOG_COLOR_BLUE) {
this->targetSpeed = sBaseSpeeds[sDogInfo[this->index].color][0] + randPlusMinusPoint5Scaled(1.0f);
this->targetSpeed = sBaseSpeeds[sDogInfo[this->index].color][0] + Rand_CenteredFloat(1.0f);
} else {
this->targetSpeed = 5.0f + randPlusMinusPoint5Scaled(1.0f);
this->targetSpeed = 5.0f + Rand_CenteredFloat(1.0f);
}
if (DOG_IS_IN_GOOD_CONDITION(this) && (this->index != sFirstPlaceIndex)) {
@ -485,9 +485,9 @@ void EnRacedog_UpdateSpeed(EnRacedog* this) {
} else if (this->currentPoint < (quarterPathCount * 3)) {
// The dog is between 1/4th and 3/4ths of the way through the race track.
if (this->currentPoint < sDogInfo[this->index].pointToUseSecondBaseSpeed) {
this->targetSpeed = 5.0f + randPlusMinusPoint5Scaled(1.0f);
this->targetSpeed = 5.0f + Rand_CenteredFloat(1.0f);
} else {
this->targetSpeed = sBaseSpeeds[sDogInfo[this->index].color][1] + randPlusMinusPoint5Scaled(1.0f);
this->targetSpeed = sBaseSpeeds[sDogInfo[this->index].color][1] + Rand_CenteredFloat(1.0f);
if (DOG_IS_IN_GOOD_CONDITION(this) && (this->index != sFirstPlaceIndex)) {
this->targetSpeed *= sDogInfo[this->index].goodConditionSpeedMultiplier;
@ -497,7 +497,7 @@ void EnRacedog_UpdateSpeed(EnRacedog* this) {
// The dog is more than 3/4ths of the way through the race track.
EnRacedog_CalculateFinalStretchTargetSpeed(this);
} else {
this->targetSpeed = randPlusMinusPoint5Scaled(1.0f) + 5.0f;
this->targetSpeed = Rand_CenteredFloat(1.0f) + 5.0f;
}
}
}
@ -657,9 +657,9 @@ void EnRacedog_SpawnFloorDustRing(EnRacedog* this, PlayState* play) {
Vec3f pos;
if (((this->index + curFrame) % mod) == 0) {
pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(15.0f);
pos.x = this->actor.world.pos.x + Rand_CenteredFloat(15.0f);
pos.y = this->actor.world.pos.y;
pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(15.0f);
pos.z = this->actor.world.pos.z + Rand_CenteredFloat(15.0f);
Actor_SpawnFloorDustRing(play, &this->actor, &pos, 10.0f, 0, 2.0f, 300, 0, true);
}
}

View File

@ -895,9 +895,9 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc
effect->accel = *accel;
effect->scale = scale;
effect->timer = timer;
effect->rotation.x = randPlusMinusPoint5Scaled(30000.0f);
effect->rotation.y = randPlusMinusPoint5Scaled(30000.0f);
effect->rotation.z = randPlusMinusPoint5Scaled(30000.0f);
effect->rotation.x = Rand_CenteredFloat(30000.0f);
effect->rotation.y = Rand_CenteredFloat(30000.0f);
effect->rotation.z = Rand_CenteredFloat(30000.0f);
return;
}
}

View File

@ -230,7 +230,7 @@ s32 EnRat_UpdateFloorPoly(EnRat* this, CollisionPoly* floorPoly, PlayState* play
return false;
}
angle = func_80086C48(normDotUp);
angle = Math_FAcosF(normDotUp);
if (angle < 0.001f) {
return false;
}
@ -324,9 +324,9 @@ void EnRat_ChooseDirection(EnRat* this) {
angle -= 0x8000;
}
angle += (s16)randPlusMinusPoint5Scaled(0x800);
angle += (s16)(s32)Rand_CenteredFloat(0x800);
} else {
angle = (Rand_ZeroOne() < 0.1f) ? (s16)randPlusMinusPoint5Scaled(0x800) : 0;
angle = (Rand_ZeroOne() < 0.1f) ? (s16)(s32)Rand_CenteredFloat(0x800) : 0;
}
}
@ -633,9 +633,9 @@ void EnRat_UpdateSparkOffsets(EnRat* this) {
for (i = 0; i < ARRAY_COUNT(this->sparkOffsets); i++) {
ptr = &this->sparkOffsets[i];
ptr->x = randPlusMinusPoint5Scaled(6.0f);
ptr->y = randPlusMinusPoint5Scaled(6.0f);
ptr->z = randPlusMinusPoint5Scaled(6.0f);
ptr->x = Rand_CenteredFloat(6.0f);
ptr->y = Rand_CenteredFloat(6.0f);
ptr->z = Rand_CenteredFloat(6.0f);
}
}
@ -937,14 +937,14 @@ void EnRat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gBombCapDL);
if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) {
redModifier = fabsf(cos_rad(this->timer * (M_PI / 30.f)));
redModifier = fabsf(Math_CosF(this->timer * (M_PI / 30.f)));
} else {
if (this->timer >= 120) {
redModifier = fabsf(cos_rad((this->timer % 30) * (M_PI / 30.0f)));
redModifier = fabsf(Math_CosF((this->timer % 30) * (M_PI / 30.0f)));
} else if (this->timer >= 30) {
redModifier = fabsf(cos_rad((this->timer % 6) * (M_PI / 6.0f)));
redModifier = fabsf(Math_CosF((this->timer % 6) * (M_PI / 6.0f)));
} else {
redModifier = fabsf(cos_rad((this->timer % 3) * (M_PI / 3.0f)));
redModifier = fabsf(Math_CosF((this->timer % 3) * (M_PI / 3.0f)));
}
}

View File

@ -161,7 +161,7 @@ s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIn
diffZ = points[currentPoint + 1].z - points[currentPoint - 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 (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}
@ -194,7 +194,7 @@ s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32
diffZ = points[currentPoint - 1].z - points[currentPoint + 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 (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) {
reached = true;
}

View File

@ -417,9 +417,9 @@ void EnSb_Draw(Actor* thisx, PlayState* play) {
fireDecr = this->fireCount - 1;
if (!(fireDecr & 1)) {
offset = &sFlamePosOffsets[fireDecr & 3];
flamePos.x = randPlusMinusPoint5Scaled(5.0f) + (this->actor.world.pos.x + offset->x);
flamePos.y = randPlusMinusPoint5Scaled(5.0f) + (this->actor.world.pos.y + offset->y);
flamePos.z = randPlusMinusPoint5Scaled(5.0f) + (this->actor.world.pos.z + offset->z);
flamePos.x = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.x + offset->x);
flamePos.y = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.y + offset->y);
flamePos.z = Rand_CenteredFloat(5.0f) + (this->actor.world.pos.z + offset->z);
EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, 100, 0, 0, -1);
}
}

View File

@ -192,7 +192,7 @@ s32 func_80BCD334(EnScopecrow* this, Path* path, s32 pointIndex) {
phi_fa1 = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x);
func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x);
if (((this->actor.world.pos.x * sp3C.z) + (sp3C.y * this->actor.world.pos.z) + sp3C.x) > 0.0f) {
ret = true;

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