From 96347ab5028b6ef8ed8f5901f7d16ad51ab99cd4 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Wed, 22 Jul 2026 20:13:31 -0400 Subject: [PATCH] Clean up angle constants and conversions (#1135) * Add angle conversion constants and macros * Replace angle literals with hex instead of decimal --- include/SSystem/SComponent/c_angle.h | 48 ++++++++----------- include/SSystem/SComponent/c_math.h | 7 +-- src/JSystem/J3DU/J3DUClipper.cpp | 2 +- src/JSystem/JAudio/JASOscillator.cpp | 4 +- src/JSystem/JAudio/JASSeqParser.cpp | 6 +-- src/JSystem/JAudio/JASTrack.cpp | 18 +++---- src/JSystem/JParticle/JPADraw.cpp | 8 ++-- src/JSystem/JParticle/JPADrawVisitor.cpp | 6 +-- src/JSystem/JParticle/JPAEmitter.cpp | 2 +- .../JStudio_JParticle/object-particle.cpp | 6 +-- src/SSystem/SComponent/c_math.cpp | 2 +- src/c/c_damagereaction.cpp | 20 ++++---- src/d/actor/d_a_arrow.cpp | 2 +- src/d/actor/d_a_arrow_iceeff.cpp | 10 ++-- src/d/actor/d_a_bdk.cpp | 4 +- src/d/actor/d_a_bdkobj.cpp | 6 +-- src/d/actor/d_a_bgn.cpp | 4 +- src/d/actor/d_a_bgn3.cpp | 6 +-- src/d/actor/d_a_bmd.cpp | 2 +- src/d/actor/d_a_bmdfoot.cpp | 4 +- src/d/actor/d_a_boko.cpp | 4 +- src/d/actor/d_a_boomerang.cpp | 4 +- src/d/actor/d_a_bpw.cpp | 18 +++---- src/d/actor/d_a_bst.cpp | 2 +- src/d/actor/d_a_btd.cpp | 8 ++-- src/d/actor/d_a_bwd.cpp | 4 +- src/d/actor/d_a_bwds.cpp | 8 ++-- src/d/actor/d_a_canon.cpp | 8 ++-- src/d/actor/d_a_cc.cpp | 4 +- src/d/actor/d_a_daiocta.cpp | 2 +- src/d/actor/d_a_ep.cpp | 4 +- src/d/actor/d_a_esa.cpp | 6 +-- src/d/actor/d_a_ff.cpp | 2 +- src/d/actor/d_a_fgmahou.cpp | 2 +- src/d/actor/d_a_fm.cpp | 8 ++-- src/d/actor/d_a_himo2.cpp | 8 ++-- src/d/actor/d_a_ikari.cpp | 2 +- src/d/actor/d_a_kb.cpp | 8 ++-- src/d/actor/d_a_ki.cpp | 2 +- src/d/actor/d_a_ks.cpp | 8 ++-- src/d/actor/d_a_lamp.cpp | 2 +- src/d/actor/d_a_lwood.cpp | 2 +- src/d/actor/d_a_mo2.cpp | 4 +- src/d/actor/d_a_movie_player.cpp | 16 +++---- src/d/actor/d_a_npc_photo.cpp | 2 +- src/d/actor/d_a_nzg.cpp | 2 +- src/d/actor/d_a_obj_Yboil.cpp | 2 +- src/d/actor/d_a_obj_barrel2.cpp | 2 +- src/d/actor/d_a_obj_coming.cpp | 2 +- src/d/actor/d_a_obj_hlift.cpp | 6 +-- src/d/actor/d_a_obj_homen.cpp | 2 +- src/d/actor/d_a_obj_ice.cpp | 4 +- src/d/actor/d_a_obj_ikada.cpp | 8 ++-- src/d/actor/d_a_obj_lpalm.cpp | 2 +- src/d/actor/d_a_obj_mshokki.cpp | 2 +- src/d/actor/d_a_obj_ohatch.cpp | 28 +++++------ src/d/actor/d_a_obj_stair.cpp | 4 +- src/d/actor/d_a_oship.cpp | 4 +- src/d/actor/d_a_player_fan.inc | 6 +-- src/d/actor/d_a_player_main.cpp | 6 +-- src/d/actor/d_a_player_particle.inc | 2 +- src/d/actor/d_a_player_rope.inc | 4 +- src/d/actor/d_a_pw.cpp | 2 +- src/d/actor/d_a_sea.cpp | 2 +- src/d/actor/d_a_ship.cpp | 29 ++++++----- src/d/actor/d_a_st.cpp | 12 ++--- src/d/actor/d_a_stone.cpp | 4 +- src/d/actor/d_a_title.cpp | 2 +- src/d/actor/d_a_tn.cpp | 2 +- src/d/actor/d_a_tsubo.cpp | 6 +-- src/d/d_attention.cpp | 2 +- src/d/d_boss_magma.cpp | 2 +- src/d/d_cam_param.cpp | 2 +- src/d/d_camera.cpp | 4 +- src/d/d_drawlist.cpp | 10 ++-- src/d/d_kankyo.cpp | 6 +-- src/d/d_kankyo_rain.cpp | 20 ++++---- src/d/d_magma.cpp | 2 +- src/d/d_map.cpp | 2 +- src/d/d_meter.cpp | 4 +- src/d/d_particle.cpp | 10 ++-- src/d/d_picture_box.cpp | 2 +- src/f_op/f_op_msg_mng.cpp | 4 +- src/m_Do/m_Do_gba_com.cpp | 6 +-- src/m_Do/m_Do_lib.cpp | 2 +- 85 files changed, 261 insertions(+), 267 deletions(-) diff --git a/include/SSystem/SComponent/c_angle.h b/include/SSystem/SComponent/c_angle.h index 0ca77ec45..3ccebf5df 100644 --- a/include/SSystem/SComponent/c_angle.h +++ b/include/SSystem/SComponent/c_angle.h @@ -3,6 +3,20 @@ #include "SSystem/SComponent/c_xyz.h" +#define RAD2DEG_CONSTANT (180.0f / M_PI) // 57.29577951f +#define DEG2RAD_CONSTANT (M_PI / 180.0f) // 0.017453292f +#define DEG2S_CONSTANT (0x8000 / 180.0f) // 182.04445f +#define S2DEG_CONSTANT (180.0f / 0x8000) // 0.005493164f +#define S2RAD_CONSTANT (M_PI / 0x8000) // 9.58738e-5f / 9.58738e-05f / 0.0000958738f +#define RAD2S_CONSTANT (0x8000 / M_PI) // 10430.378f + +#define RAD2DEG(x) ((x) * RAD2DEG_CONSTANT) +#define DEG2RAD(x) ((x) * DEG2RAD_CONSTANT) +#define DEG2S(x) ((s16)((x) * DEG2S_CONSTANT)) +#define S2DEG(x) ((x) * S2DEG_CONSTANT) +#define S2RAD(x) ((x) * S2RAD_CONSTANT) +#define RAD2S(x) ((x) * RAD2S_CONSTANT) + class cSAngle { private: s16 mAngle; @@ -59,33 +73,13 @@ cSAngle operator+(short, const cSAngle&); cSAngle operator-(short, const cSAngle&); struct cAngle { - static f32 Radian_to_Degree(f32 rad) { - return rad * (180.0f / M_PI); - } - - static f32 Degree_to_Radian(f32 deg) { - return deg * (M_PI / 180.0f); - } - - static s16 Degree_to_SAngle(f32 deg) { - return deg * (65536.0f / 360.0f); - } - - static f32 SAngle_to_Degree(s16 angle) { - return angle * (360.0f / 65536.0f); - } - - static f32 SAngle_to_Radian(s16 angle) { - return angle * ((2.0f * M_PI) / 65536.0f); - } - - static f32 SAngle_to_Normal(s16 angle) { - return angle * (2.0f / 65536.0f); - } - - static s16 Radian_to_SAngle(f32 rad) { - return rad * (65536.0f / (2.0f * M_PI)); - } + static f32 Radian_to_Degree(f32 rad) { return RAD2DEG(rad); } + static f32 Degree_to_Radian(f32 deg) { return DEG2RAD(deg); } + static s16 Degree_to_SAngle(f32 deg) { return DEG2S(deg); } + static f32 SAngle_to_Degree(s16 angle) { return S2DEG(angle); } + static f32 SAngle_to_Radian(s16 angle) { return S2RAD(angle); } + static s16 Radian_to_SAngle(f32 rad) { return RAD2S(rad); } + static f32 SAngle_to_Normal(s16 angle) { return angle * (1.0f / 0x8000); } /* Converts Radian value into Degree value */ static f32 r2d(f32 r) { return Radian_to_Degree(r); } diff --git a/include/SSystem/SComponent/c_math.h b/include/SSystem/SComponent/c_math.h index d6be45a79..400840c04 100644 --- a/include/SSystem/SComponent/c_math.h +++ b/include/SSystem/SComponent/c_math.h @@ -2,6 +2,7 @@ #define C_MATH_H #include "JSystem/JMath/JMATrigonometric.h" +#include "SSystem/SComponent/c_angle.h" s16 cM_rad2s(float rad); u16 U_GetAtanTable(float, float); @@ -40,7 +41,7 @@ inline f32 cM_ssin(s16 x) { } inline s16 cM_deg2s(f32 deg) { - return deg * 182.04445f; + return DEG2S(deg); } inline f32 cM_fcos(f32 x) { @@ -52,11 +53,11 @@ inline f32 cM_fsin(f32 x) { } inline f32 cM_sht2d(f32 v) { - return v * 0.005493164f; + return S2DEG(v); } inline f32 cM_s2rad(s16 x) { - return x * 9.58738e-05f; + return S2RAD(x); } #endif /* C_MATH_H */ diff --git a/src/JSystem/J3DU/J3DUClipper.cpp b/src/JSystem/J3DU/J3DUClipper.cpp index 605093e8d..b6e6caf2b 100644 --- a/src/JSystem/J3DU/J3DUClipper.cpp +++ b/src/JSystem/J3DU/J3DUClipper.cpp @@ -12,7 +12,7 @@ #include "weak_bss_3569.h" // IWYU pragma: keep -static const f32 Deg2Rad = 0.017453292f; +static const f32 Deg2Rad = (M_PI / 180.0f); // 0.017453292f /* 802566B8-802566CC .text init__11J3DUClipperFv */ void J3DUClipper::init() { diff --git a/src/JSystem/JAudio/JASOscillator.cpp b/src/JSystem/JAudio/JASOscillator.cpp index 1deb94370..13d592883 100644 --- a/src/JSystem/JAudio/JASOscillator.cpp +++ b/src/JSystem/JAudio/JASOscillator.cpp @@ -199,14 +199,14 @@ f32 JASystem::TOscillator::calc(s16* i_table) { field_0x5 = envMode; if (envTime == 0) { - mTargetPhase = envValue / 32768.0f; + mTargetPhase = (f32)envValue / 0x8000; field_0x6 += 1; continue; } mReleaseRate = envTime * ((Kernel::getDacRate() / 80.0f) / 600.0f) / Driver::getUpdateInterval(); mInitialReleaseRate = mReleaseRate; - mTargetPhase = envValue / 32768.0f; + mTargetPhase = (f32)envValue / 0x8000; if (field_0x5 == 0) { mPhaseChangeRate = (mTargetPhase - mPhase) / mReleaseRate; diff --git a/src/JSystem/JAudio/JASSeqParser.cpp b/src/JSystem/JAudio/JASSeqParser.cpp index 5c5a85496..fc621fbd2 100644 --- a/src/JSystem/JAudio/JASSeqParser.cpp +++ b/src/JSystem/JAudio/JASSeqParser.cpp @@ -581,7 +581,7 @@ int JASystem::TSeqParser::cmdIIRSet(TTrack* track, u32* args) { for (u8 i = 0; i < 4; i++) { u8 iirIndex = TTrack::TIMED_IIR_Unk0 + i; TTrack::MoveParam_* iir = &track->mTimedParam.mMoveParams[iirIndex]; - iir->mTargetValue = (s16)args[i] / 32768.0f; + iir->mTargetValue = (f32)(s16)args[i] / 0x8000; iir->mCurrentValue = iir->mTargetValue; iir->mMoveAmount = 0.0f; iir->mMoveTime = 1.0f; @@ -596,7 +596,7 @@ int JASystem::TSeqParser::cmdIIRCutOff(TTrack* track, u32* args) { s16* table = &JASystem::Player::CUTOFF_TO_IIR_TABLE[iirTableIdx * 4]; u8 iirIndex = TTrack::TIMED_IIR_Unk0 + i; TTrack::MoveParam_* iir = &track->mTimedParam.mMoveParams[iirIndex]; - iir->mTargetValue = table[i] / (32768.0f - 1.0f); + iir->mTargetValue = table[i] / (0x8000 - 1.0f); iir->mCurrentValue = iir->mTargetValue; iir->mMoveAmount = 0.0f; iir->mMoveTime = 1.0f; @@ -789,7 +789,7 @@ int JASystem::TSeqParser::cmdSetParam(TTrack* track, u8 param_2) { break; } - track->setParam(flag, (int)data / 32767.0f, val); + track->setParam(flag, data / (f32)0x7FFF, val); return 0; } diff --git a/src/JSystem/JAudio/JASTrack.cpp b/src/JSystem/JAudio/JASTrack.cpp index a8d93d915..0a7f20644 100644 --- a/src/JSystem/JAudio/JASTrack.cpp +++ b/src/JSystem/JAudio/JASTrack.cpp @@ -510,7 +510,7 @@ void JASystem::TTrack::updateTrackAll() { f32 fx_vol; f32 dolby; - f32 pan_weight = mRegisterParam.getPanPowerParent() / 32767.0f; + f32 pan_weight = (f32)mRegisterParam.getPanPowerParent() / 0x7FFF; mChannelUpdater.field_0x68 = mRegisterParam.field_0x1a | 0x10000; mChannelUpdater.field_0x6c = 0; @@ -568,7 +568,7 @@ void JASystem::TTrack::updateTrackAll() { mChannelUpdater.field_0x24 = fx_vol; mChannelUpdater.field_0x28 = dolby; } else { - pan_weight = mRegisterParam.getPanPowerTrack() / 32767.0f; + pan_weight = (f32)mRegisterParam.getPanPowerTrack() / 0x7FFF; mChannelUpdater.field_0x18 = mParent->mChannelUpdater.field_0x18 * vol; mChannelUpdater.field_0x1c = mParent->mChannelUpdater.field_0x1c * pitch; @@ -590,11 +590,11 @@ void JASystem::TTrack::updateTrackAll() { } for (u8 i = 0; i < 4; i++) { - mChannelUpdater.field_0x3c[i] = mTimedParam.mMoveParams[TIMED_IIR_Unk0 + i].mCurrentValue * 32767.0f; + mChannelUpdater.field_0x3c[i] = mTimedParam.mMoveParams[TIMED_IIR_Unk0 + i].mCurrentValue * 0x7FFF; } mChannelUpdater.field_0x61 |= 0x20; - mChannelUpdater.field_0x4c = mTimedParam.mMoveParams[TIMED_Unk5].mCurrentValue * 32767.0f; + mChannelUpdater.field_0x4c = mTimedParam.mMoveParams[TIMED_Unk5].mCurrentValue * 0x7FFF; } } @@ -610,7 +610,7 @@ void JASystem::TTrack::updateTrack(u32 flags) { f32 fx_vol; f32 dolby; - f32 pan_weight = mRegisterParam.getPanPowerParent() / 32767.0f; + f32 pan_weight = (f32)mRegisterParam.getPanPowerParent() / 0x7FFF; if (flags & OUTERPARAM_Unk18) { f32 unkF = mTimedParam.mMoveParams[TIMED_Unk17].mCurrentValue * 128.0f; s8 unk = 0; @@ -686,7 +686,7 @@ void JASystem::TTrack::updateTrack(u32 flags) { if (flags & OUTERPARAM_IIRFilter) { for (u8 i = 0; i < 4; i++) { - mChannelUpdater.field_0x3c[i] = mTimedParam.mMoveParams[TIMED_IIR_Unk0 + i].mCurrentValue * 32767.0f; + mChannelUpdater.field_0x3c[i] = mTimedParam.mMoveParams[TIMED_IIR_Unk0 + i].mCurrentValue * 0x7FFF; } mChannelUpdater.field_0x61 |= 0x20; } @@ -699,7 +699,7 @@ void JASystem::TTrack::updateTrack(u32 flags) { } if (flags & OUTERPARAM_Unk6) { - mChannelUpdater.field_0x4c = mTimedParam.mMoveParams[TIMED_Unk5].mCurrentValue * 32767.0f; + mChannelUpdater.field_0x4c = mTimedParam.mMoveParams[TIMED_Unk5].mCurrentValue * 0x7FFF; } if (mParent == NULL || (field_0x37b & 1)) { @@ -719,7 +719,7 @@ void JASystem::TTrack::updateTrack(u32 flags) { mChannelUpdater.field_0x28 = dolby; } } else { - pan_weight = mRegisterParam.getPanPowerTrack() / 32767.0f; + pan_weight = (f32)mRegisterParam.getPanPowerTrack() / 0x7FFF; if (set_volume) { mChannelUpdater.field_0x18 = mParent->mChannelUpdater.field_0x18 * vol; } @@ -750,7 +750,7 @@ void JASystem::TTrack::updateTempo() { field_0x368 = (f32) field_0x378; field_0x368 *= field_0x376; field_0x368 /= Kernel::getDacRate(); - field_0x368 *= 1.33333333f; + field_0x368 *= (4.0f / 3.0f); if (mOuterParam != NULL && mOuterParam->checkOuterSwitch(OUTERPARAM_Tempo)) { field_0x368 *= mOuterParam->getTempo(); } diff --git a/src/JSystem/JParticle/JPADraw.cpp b/src/JSystem/JParticle/JPADraw.cpp index c7f1e45fc..e614439d1 100644 --- a/src/JSystem/JParticle/JPADraw.cpp +++ b/src/JSystem/JParticle/JPADraw.cpp @@ -172,12 +172,12 @@ void JPADraw::initParticle(JPABaseParticle* ptcl) { params->mLoopOffset = dc.pbe->getRandomF() * dc.pbsp->getLoopOffset(); if (dc.pesp != NULL) { if (dc.pesp->isEnableRotate()) { - params->mRotateAngle = (dc.pesp->getRotateAngle() * 32768.0f) + (dc.pbe->getRandomSF() * dc.pesp->getRotateRandomAngle() * 65536.0f); + params->mRotateAngle = (dc.pesp->getRotateAngle() * 0x8000) + (dc.pbe->getRandomSF() * dc.pesp->getRotateRandomAngle() * 0x10000); s16 rotateSpeed; if (dc.pbe->getRandomRF() < dc.pesp->getRotateDirection()) { - rotateSpeed = dc.pesp->getRotateSpeed() * (dc.pesp->getRotateRandomSpeed() * dc.pbe->getRandomRF() + 1.0f) * 32768.0f; + rotateSpeed = dc.pesp->getRotateSpeed() * (dc.pesp->getRotateRandomSpeed() * dc.pbe->getRandomRF() + 1.0f) * 0x8000; } else { - rotateSpeed = -dc.pesp->getRotateSpeed() * (dc.pesp->getRotateRandomSpeed() * dc.pbe->getRandomRF() + 1.0f) * 32768.0f; + rotateSpeed = -dc.pesp->getRotateSpeed() * (dc.pesp->getRotateRandomSpeed() * dc.pbe->getRandomRF() + 1.0f) * 0x8000; } params->mRotateSpeed = rotateSpeed; } else { @@ -245,7 +245,7 @@ void JPADraw::initChild(JPABaseParticle* ptcl, JPABaseParticle* chld) { chld_params->mRotateAngle = params->mRotateAngle; if (dc.pssp->isEnableRotate()) { - chld_params->mRotateSpeed = dc.pssp->getRotateSpeed() * 32768.0f; + chld_params->mRotateSpeed = dc.pssp->getRotateSpeed() * 0x8000; } else { chld_params->mRotateSpeed = 0; } diff --git a/src/JSystem/JParticle/JPADrawVisitor.cpp b/src/JSystem/JParticle/JPADrawVisitor.cpp index bd6ce0743..43f85bb00 100644 --- a/src/JSystem/JParticle/JPADrawVisitor.cpp +++ b/src/JSystem/JParticle/JPADrawVisitor.cpp @@ -990,7 +990,7 @@ void JPADrawCalcAlpha::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) { /* 80265C40-80265D54 .text calc__27JPADrawCalcAlphaFlickNrmSinFPC14JPADrawContextP15JPABaseParticle */ void JPADrawCalcAlphaFlickNrmSin::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) { JPADrawParams* params = ptcl->getDrawParamPPtr(); - f32 sin = JMASSin((ptcl->getAge() * 16384) * params->mAlphaWaveRandom * (1.0f - pDC->pesp->getAlphaWaveParam1())); + f32 sin = JMASSin((ptcl->getAge() * 0x4000) * params->mAlphaWaveRandom * (1.0f - pDC->pesp->getAlphaWaveParam1())); params->mAlphaOut *= params->mAlphaWaveRandom * (((sin - 1.0f) * 0.5f) * pDC->pesp->getAlphaWaveParam3()) + 1.0f; if (params->mAlphaOut < 0.0f) params->mAlphaOut = 0.0f; @@ -1000,7 +1000,7 @@ void JPADrawCalcAlphaFlickNrmSin::calc(const JPADrawContext* pDC, JPABaseParticl void JPADrawCalcAlphaFlickAddSin::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) { /* Nonmatching - operand swap */ JPADrawParams* params = ptcl->getDrawParamPPtr(); - f32 theta = (ptcl->getAge() * 16384) * params->mAlphaWaveRandom; + f32 theta = (ptcl->getAge() * 0x4000) * params->mAlphaWaveRandom; f32 sin2 = JMASSin(theta * (1.0f - pDC->pesp->getAlphaWaveParam2())); f32 sin1 = JMASSin(theta * (1.0f - pDC->pesp->getAlphaWaveParam1())); params->mAlphaOut *= (params->mAlphaWaveRandom * ((((sin1 + sin2) - 2.0f) * 0.5f) * pDC->pesp->getAlphaWaveParam3()) + 2.0f) * 0.5f; @@ -1011,7 +1011,7 @@ void JPADrawCalcAlphaFlickAddSin::calc(const JPADrawContext* pDC, JPABaseParticl /* 80265EC4-80266048 .text calc__28JPADrawCalcAlphaFlickMultSinFPC14JPADrawContextP15JPABaseParticle */ void JPADrawCalcAlphaFlickMultSin::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) { JPADrawParams* params = ptcl->getDrawParamPPtr(); - f32 theta = (ptcl->getAge() * 16384) * params->mAlphaWaveRandom; + f32 theta = (ptcl->getAge() * 0x4000) * params->mAlphaWaveRandom; f32 mul3 = (pDC->pesp->getAlphaWaveParam3() * 0.5f) * params->mAlphaWaveRandom; f32 sin2 = JMASSin(theta * (1.0f - pDC->pesp->getAlphaWaveParam2())); f32 sin1 = JMASSin(theta * (1.0f - pDC->pesp->getAlphaWaveParam1())); diff --git a/src/JSystem/JParticle/JPAEmitter.cpp b/src/JSystem/JParticle/JPAEmitter.cpp index 6109e21d0..73add1229 100644 --- a/src/JSystem/JParticle/JPAEmitter.cpp +++ b/src/JSystem/JParticle/JPAEmitter.cpp @@ -71,7 +71,7 @@ void JPABaseEmitter::calcVolumeSphere() { if (checkEmDataFlag(JPADynFlag_FixedInterval)) { u16 angleNo = (emtrInfo.mVolumeEmitAngleCount * 0x10000) / emtrInfo.mVolumeEmitAngleMax; x = (u16)((emtrInfo.mVolumeEmitXCount * 0x8000) / (emtrInfo.mDivNumber - 1) + 0x4000); - angle = (f32)angleNo * mVolumeSweep + 32768.0f; + angle = (f32)angleNo * mVolumeSweep + 0x8000; emtrInfo.mVolumeEmitAngleCount++; if (emtrInfo.mVolumeEmitAngleCount == emtrInfo.mVolumeEmitAngleMax) { emtrInfo.mVolumeEmitAngleCount = 0; diff --git a/src/JSystem/JStudio/JStudio_JParticle/object-particle.cpp b/src/JSystem/JStudio/JStudio_JParticle/object-particle.cpp index 1c3ade513..40dd86829 100644 --- a/src/JSystem/JStudio/JStudio_JParticle/object-particle.cpp +++ b/src/JSystem/JStudio/JStudio_JParticle/object-particle.cpp @@ -240,9 +240,9 @@ void TAdaptor_particle::TJPACallback_::execute(JPABaseEmitter* emitter) { } emitter->setGlobalTranslation(pos[0]); - int angleX = 65536.0 * (pos[1].x / 360.0); - int angleY = 65536.0 * (pos[1].y / 360.0); - int angleZ = 65536.0 * (pos[1].z / 360.0); + int angleX = 0x10000 * (pos[1].x / 360.0); + int angleY = 0x10000 * (pos[1].y / 360.0); + int angleZ = 0x10000 * (pos[1].z / 360.0); emitter->setGlobalRotation(JGeometry::TVec3(angleX, angleY, angleZ)); emitter->setGlobalScale(sp0C); } else { diff --git a/src/SSystem/SComponent/c_math.cpp b/src/SSystem/SComponent/c_math.cpp index 363b8647b..03e39fc98 100644 --- a/src/SSystem/SComponent/c_math.cpp +++ b/src/SSystem/SComponent/c_math.cpp @@ -161,7 +161,7 @@ s16 cM_atan2s(float f0, float f1) { /* 80246270-802462B8 .text cM_atan2f__Fff */ float cM_atan2f(float f1, float f2) { - return 9.58738E-5f * cM_atan2s(f1, f2); + return S2RAD(cM_atan2s(f1, f2)); } static s32 r0, r1, r2; diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index f6763035a..3de074267 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -1470,10 +1470,10 @@ void dr_damage_anime(damagereaction* dr) { if(temp2 < -22000.0f) { temp2 = -22000.0f; } - dr->m010[8].y = 0.4f * temp2 + 8192.0f; - dr->m010[4].z = 0.4f * -temp2 - 8192.0f; - dr->m010[8].z = 0.4f * zero + 8192.0f; - dr->m010[4].y = 0.4f * zero + 8192.0f; + dr->m010[8].y = 0.4f * temp2 + 0x2000; + dr->m010[4].z = 0.4f * -temp2 - 0x2000; + dr->m010[8].z = 0.4f * zero + 0x2000; + dr->m010[4].y = 0.4f * zero + 0x2000; f32 temp3 = temp; if(temp3 > 22000.0f) { @@ -1482,10 +1482,10 @@ void dr_damage_anime(damagereaction* dr) { if(temp3 < -5000.0f) { temp3 = -5000.0f; } - dr->m010[9].y = 0.4f * temp3 - 8192.0f; - dr->m010[5].z = 0.4f * temp3 - 8192.0f; - dr->m010[9].z = 0.4f * zero + 8192.0f; - dr->m010[5].y = 0.4f * -zero - 8192.0f; + dr->m010[9].y = 0.4f * temp3 - 0x2000; + dr->m010[5].z = 0.4f * temp3 - 0x2000; + dr->m010[9].z = 0.4f * zero + 0x2000; + dr->m010[5].y = 0.4f * -zero - 0x2000; f32 temp4 = temp; if(temp4 > 20000.0f) { @@ -1507,7 +1507,7 @@ void dr_damage_anime(damagereaction* dr) { temp5 = -10000.0f; } dr->m010[6].x = (3000.0f - temp5) + REG0_S(0); - dr->m010[6].z = (-zero - 16384.0f) + REG0_S(1); + dr->m010[6].z = (-zero - 0x4000) + REG0_S(1); f32 temp6 = temp; if(temp6 > 10000.0f) { @@ -1517,7 +1517,7 @@ void dr_damage_anime(damagereaction* dr) { temp6 = -7000.0f; } dr->m010[7].x = (-temp6 - 3000.0f); - dr->m010[7].z = (-zero - 16384.0f); + dr->m010[7].z = (-zero - 0x4000); } else { dr->m010[6].y += dr->m4B8; diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index d72d37263..1ed076b13 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -559,7 +559,7 @@ void daArrow_c::setStopActorMatrix() { s16 xRot = 0; if (cLib_calcTimer(&field_0x604) != 0) { f32 temp = (field_0x604 / 40.0f); - xRot = 1024.0f * temp*temp * cM_ssin(field_0x604 * 0x52FB); + xRot = 0x400 * temp*temp * cM_ssin(field_0x604 * 0x52FB); } fopAc_ac_c* hitActor = fopAcM_SearchByID(mHitActorProcID); if (!hitActor) { diff --git a/src/d/actor/d_a_arrow_iceeff.cpp b/src/d/actor/d_a_arrow_iceeff.cpp index 391468a27..34c01d4a0 100644 --- a/src/d/actor/d_a_arrow_iceeff.cpp +++ b/src/d/actor/d_a_arrow_iceeff.cpp @@ -56,10 +56,10 @@ void daArrow_Iceeff_c::CreateInit() { field_0x8B4[i].setall(cM_rndF(4.5f) + 6.2999997f); f32 temp = 180.0f * i / 30.0f; - s16 angle = cM_rndF(65536.0f); - mDoMtx_stack_c::ZrotS(cM_rndF(65536.0f)); - mDoMtx_stack_c::XrotM(cM_rndF(65536.0f)); - mDoMtx_stack_c::YrotM(cM_rndF(65536.0f)); + s16 angle = cM_rndF(0x10000); + mDoMtx_stack_c::ZrotS(cM_rndF(0x10000)); + mDoMtx_stack_c::XrotM(cM_rndF(0x10000)); + mDoMtx_stack_c::YrotM(cM_rndF(0x10000)); mDoMtx_stack_c::transM(temp * cM_ssin(angle), temp * cM_scos(angle), 0.0f); mDoMtx_stack_c::ZrotM(current.angle.z); mDoMtx_stack_c::XrotM(current.angle.x); @@ -68,7 +68,7 @@ void daArrow_Iceeff_c::CreateInit() { } } else { - current.angle.y = cM_rndF(65536.0f); + current.angle.y = cM_rndF(0x10000); } fopAcM_setCullSizeBox(this, -100.0f, -100.0f, -100.0f, 100.0f, 100.0f, 100.0f); diff --git a/src/d/actor/d_a_bdk.cpp b/src/d/actor/d_a_bdk.cpp index 16da13a6d..1d7501873 100644 --- a/src/d/actor/d_a_bdk.cpp +++ b/src/d/actor/d_a_bdk.cpp @@ -174,7 +174,7 @@ static void eff_hane_set(bdk_class* i_this, cXyz* offset, int param_3, signed ch eff->m004.z = offset->z; eff->m024 = 0.0f; - eff->m03C = cM_rndF(65536.0f); + eff->m03C = cM_rndF(0x10000); eff->m036.z = cM_rndFX(1200.0f + REG8_F(10)); eff->m036.x = cM_rndFX(800.0f + REG8_F(16)); iVar4++; @@ -191,7 +191,7 @@ static void eff_hane_set(bdk_class* i_this, cXyz* offset, int param_3, signed ch eff->m020 = REG8_F(8) + (cM_rndF(5.0f) + 5.0f); } eff->m01C = REG8_F(9) + (cM_rndF(5.0f) + 5.0f); - eff->m030.y = cM_rndF(65536.0f); + eff->m030.y = cM_rndF(0x10000); } } } diff --git a/src/d/actor/d_a_bdkobj.cpp b/src/d/actor/d_a_bdkobj.cpp index 3092dccaa..3b431535a 100644 --- a/src/d/actor/d_a_bdkobj.cpp +++ b/src/d/actor/d_a_bdkobj.cpp @@ -284,13 +284,13 @@ static void tower_kaidan_move(bdkobj_class* i_this) { fopAcM_seStartCurrent(i_this, JA_SE_OBJ_MJ_WBOARD_BRK, 0); for (s32 i = 0; i < 2; i++) { i_this->mEffs[i].m000 = 2; - i_this->mEffs[i].m1AC = cM_rndF(65536.0f); + i_this->mEffs[i].m1AC = cM_rndF(0x10000); i_this->mEffs[i].m028 = (0.7f + cM_rndFX(0.25f)); i_this->mEffs[i].m008.x = i_this->current.pos.x + cM_rndFX(500.0f); i_this->mEffs[i].m008.y = i_this->current.pos.y; i_this->mEffs[i].m008.z = i_this->current.pos.z + cM_rndFX(500.0f); - i_this->mEffs[i].m030.y = cM_rndF(65536.0f); - i_this->mEffs[i].m030.z = cM_rndF(65536.0f); + i_this->mEffs[i].m030.y = cM_rndF(0x10000); + i_this->mEffs[i].m030.z = cM_rndF(0x10000); i_this->mEffs[i].m036.y = cM_rndFX(800.0f); i_this->mEffs[i].m030.x = cM_rndFX(10000.0f); i_this->mEffs[i].m036.z = cM_rndFX(800.0f); diff --git a/src/d/actor/d_a_bgn.cpp b/src/d/actor/d_a_bgn.cpp index 3c076729a..3e03b4e62 100644 --- a/src/d/actor/d_a_bgn.cpp +++ b/src/d/actor/d_a_bgn.cpp @@ -3686,8 +3686,8 @@ static cPhs_State daBgn_Create(fopAc_ac_c* a_this) { #endif } for (s32 i = 0; i < 8; i++) { - i_this->mAAA8[i].m2FA = cM_rndF(32768.0f); - i_this->mAAA8[i].m2FC = cM_rndF(32768.0f); + i_this->mAAA8[i].m2FA = cM_rndF(0x8000); + i_this->mAAA8[i].m2FC = cM_rndF(0x8000); } if (dComIfGs_isEventBit(dSv_event_flag_c::UNK_3F10)) { i_this->m02B4 = 0xFF; diff --git a/src/d/actor/d_a_bgn3.cpp b/src/d/actor/d_a_bgn3.cpp index bce657a89..bf2aaaf38 100644 --- a/src/d/actor/d_a_bgn3.cpp +++ b/src/d/actor/d_a_bgn3.cpp @@ -472,7 +472,7 @@ static void damage(bgn3_class* i_this) { if (checkGround(i_this)) { actor->speed.y = 50.0f; i_this->m0FD8C = 2; - actor->current.angle.y = cM_rndF(65536.0f); + actor->current.angle.y = cM_rndF(0x10000); i_this->m0FDB8 = 1.0f; dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); drop_eff_set(i_this); @@ -527,13 +527,13 @@ static void end(bgn3_class* i_this) { } if (checkGround(i_this)) { i_this->m0FD8C++; - actor->current.angle.y = cM_rndF(65536.0f); + actor->current.angle.y = cM_rndF(0x10000); i_this->m0FDB8 = 1.0f; dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); drop_eff_set(i_this); actor->speed.y = REG0_F(11) + 130.0f; actor->speedF = 0.0f; - actor->current.angle.y = cM_rndF(65536.0f); + actor->current.angle.y = cM_rndF(0x10000); fopAcM_monsSeStart(actor, JA_SE_CV_BGN_HIT_1, 0); } if ((i_this->m0FD8C == 4) && (actor->speed.y <= -30.0f)) { diff --git a/src/d/actor/d_a_bmd.cpp b/src/d/actor/d_a_bmd.cpp index ba8fb2b67..7c46ce4ad 100644 --- a/src/d/actor/d_a_bmd.cpp +++ b/src/d/actor/d_a_bmd.cpp @@ -987,7 +987,7 @@ void wait(bmd_class* i_this) { move1(i_this); if (i_this->m308[1] == 0) { i_this->m308[1] = (s16)(int)(cM_rndF(200.0f) + 100.0f); - i_this->m336 = (s16)(int)cM_rndFX(32768.0f); + i_this->m336 = (s16)(int)cM_rndFX(0x8000); i_this->m338 = 0.0f; } cLib_addCalcAngleS2(&actor->shape_angle.y, i_this->m336, 0x20, i_this->m338); diff --git a/src/d/actor/d_a_bmdfoot.cpp b/src/d/actor/d_a_bmdfoot.cpp index 704764dc1..e57fb4e87 100644 --- a/src/d/actor/d_a_bmdfoot.cpp +++ b/src/d/actor/d_a_bmdfoot.cpp @@ -139,7 +139,7 @@ void wait(bmdfoot_class* i_this) { i_this->m2BC++; anm_init(i_this, dRes_INDEX_BMDFOOT_BCK_ASI_WAIT_e, 50.0f, J3DFrameCtrl::EMode_LOOP, cM_rndF(0.2f) + 0.9f, -1); i_this->m2C0[0] = cM_rndF(150.0f) + 100.0f; - i_this->m3EC = cM_rndFX(32768.0f); + i_this->m3EC = cM_rndFX(0x8000); for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m3A4[i] = REG14_F(13) + (0.2f + cM_rndFX(0.1f)); } @@ -460,7 +460,7 @@ void damage(bmdfoot_class* i_this) { anm_init(i_this, dRes_INDEX_BMDFOOT_BCK_ASI_NOBIKIRU_e, 40.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->m2BC++; i_this->m2C0[0] = 0x1e; - i_this->m3EC = cM_rndFX(32768.0f); + i_this->m3EC = cM_rndFX(0x8000); for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m3A4[i] = (0.3f + cM_rndFX(0.2f)); } diff --git a/src/d/actor/d_a_boko.cpp b/src/d/actor/d_a_boko.cpp index 92259a2f8..a6b36e448 100644 --- a/src/d/actor/d_a_boko.cpp +++ b/src/d/actor/d_a_boko.cpp @@ -358,7 +358,7 @@ void daBoko_c::setThrowReverse(s16 arg1) { fopAcM_SetGravity(this, -3.0f); fopAcM_GetSpeed(this).y = 15.0f; speedF *= 0.25f; - current.angle.y = arg1 + cM_rndFX(12288.0f); + current.angle.y = arg1 + cM_rndFX(0x3000); int sVar1 = cLib_distanceAngleS(current.angle.y, shape_angle.y); if (sVar1 >= 0x4000) { @@ -603,7 +603,7 @@ BOOL daBoko_c::procThrow() { } if (mCps.ChkAtHit()) { - unaff_r28 = current.angle.y + cM_rndF(16384.0f); + unaff_r28 = current.angle.y + cM_rndF(0x4000); } else if (mAcch.ChkWallHit()) { unaff_r28 = mAcchCir.GetWallAngleY(); } else { diff --git a/src/d/actor/d_a_boomerang.cpp b/src/d/actor/d_a_boomerang.cpp index 1392fcfcc..468b9b957 100644 --- a/src/d/actor/d_a_boomerang.cpp +++ b/src/d/actor/d_a_boomerang.cpp @@ -248,7 +248,7 @@ void daBoomerang_sightPacket_c::setSight(cXyz* pPos, int n) { mDoMtx_stack_c::transS(proj); mDoMtx_stack_c::scaleM(scaleX, scaleY, scale); - mDoMtx_stack_c::ZrotM(cM_ssin(imageRot * 16384.0f) * 32768.0f); + mDoMtx_stack_c::ZrotM(cM_ssin(imageRot * 0x4000) * 0x8000); MTXCopy(mDoMtx_stack_c::get(), mMtxArr[n]); mSightOnFlg |= 1 << n; @@ -646,7 +646,7 @@ BOOL daBoomerang_c::procMove() { } else if (a > 18.0f) { a = 20.0f + 40.0f * (a - 18.0f); } - newAngle = a * 256.0f + 1024.0f; + newAngle = a * 0x100 + 0x400; } else { newAngle = 0x4000; } diff --git a/src/d/actor/d_a_bpw.cpp b/src/d/actor/d_a_bpw.cpp index 368e4150e..fbb244a71 100644 --- a/src/d/actor/d_a_bpw.cpp +++ b/src/d/actor/d_a_bpw.cpp @@ -953,7 +953,7 @@ void search_get_skull(bpw_class* i_this, u8 param_2) { actor2->speed.y = 20.0f; } actor2->current.angle.y = fopAcM_searchActorAngleY(actor, actor2); - actor2->current.angle.y += (int)cM_rndFX(4096.0f); + actor2->current.angle.y += (int)cM_rndFX(0x1000); actor2->shape_angle.x += -0x2000; } break; @@ -2025,13 +2025,13 @@ void action_damage(bpw_class* i_this) { csXyz pwAngle = actor->shape_angle; local_58 = actor->current.pos; int currRandomAngle; - int pwSpreadAmount = (int)(65536.0f / actor->health); + int pwSpreadAmount = (int)(0x10000 / (f32)actor->health); local_58.y = i_this->mAcch.GetGroundH() + 20.0f; i_this->m3E9 = 0; for (i = 0; i < 15; i++) { i_this->mChildPoeIds[i] = fpcM_ERROR_PROCESS_ID_e; } - currRandomAngle = (int)cM_rndFX(32768.0f); + currRandomAngle = (int)cM_rndFX(0x8000); uVar14 = (s16)cM_rndF(4.99f); u32 uVar2 = uVar14 << 9 | 0xFF000003; for (i = 0; i < actor->health; i++) { @@ -2089,13 +2089,13 @@ void action_bunri_dousa(bpw_class* i_this) { csXyz pwAngle = actor->shape_angle; local_58 = actor->current.pos; int currRandomAngle; - int pwSpreadAmount = (int)(65536.0f / actor->health); + int pwSpreadAmount = (int)(0x10000 / (f32)actor->health); local_58.y = i_this->mAcch.GetGroundH() + 20.0f; i_this->m3E9 = 0; for (i = 0; i < 15; i++) { i_this->mChildPoeIds[i] = fpcM_ERROR_PROCESS_ID_e; } - currRandomAngle = (int)cM_rndFX(32768.0f); + currRandomAngle = (int)cM_rndFX(0x8000); uVar14 = (s16)cM_rndF(4.99f); u32 uVar2 = uVar14 << 9 | 0xFF000003; for (i = 0; i < actor->health; i++) { @@ -2739,7 +2739,7 @@ void action_bunri_dousa(bpw_class* i_this) { i_this->mActionState++; // fallthrough case 0x83: - cLib_addCalcAngleS2(&actor->shape_angle.x, REG18_F(19) + 49152.0f, 1, 0x300); + cLib_addCalcAngleS2(&actor->shape_angle.x, REG18_F(19) + 0xC000, 1, 0x300); if (i_this->mSomeCountdownTimers[0] != 0) { break; } @@ -2768,7 +2768,7 @@ void action_bunri_dousa(bpw_class* i_this) { #endif // fallthrough case 0x85: - cLib_addCalcAngleS2(&actor->shape_angle.x, REG18_F(19) + 49152.0f, 1, 0x300); + cLib_addCalcAngleS2(&actor->shape_angle.x, REG18_F(19) + 0xC000, 1, 0x300); cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 1, 0x300); cLib_addCalc2(&i_this->m440, REG6_F(7) + 50.0f, 1.0f, 0.5f); fVar2 = std::fabsf(i_this->m40C.x - (REG6_F(8) + -1352.0f)); @@ -4616,9 +4616,9 @@ static cPhs_State daBPW_Create(fopAc_ac_c* a_this) { csXyz pwAngle = a_this->shape_angle; local_58 = a_this->current.pos; int currRandomAngle; - int pwSpreadAmount = (int)(65536.0f / a_this->health); + int pwSpreadAmount = (int)(0x10000 / (f32)a_this->health); local_58.y = i_this->mAcch.GetGroundH() + 20.0f; - currRandomAngle = (int)cM_rndFX(32768.0f); + currRandomAngle = (int)cM_rndFX(0x8000); uVar14 = (s16)cM_rndF(4.99f); u32 uVar2 = uVar14 << 9 | 0xFF000004; for (s32 i = 0; i < 15; i++) { diff --git a/src/d/actor/d_a_bst.cpp b/src/d/actor/d_a_bst.cpp index 6a8b9698c..c9f2e0319 100644 --- a/src/d/actor/d_a_bst.cpp +++ b/src/d/actor/d_a_bst.cpp @@ -3179,7 +3179,7 @@ static cPhs_State daBst_Create(fopAc_ac_c* a_this) { actor->max_health = 4; } } - i_this->mUpdateLastFacingDirIfMultipleOf32 = cM_rndFX(32768.0f); + i_this->mUpdateLastFacingDirIfMultipleOf32 = cM_rndFX(0x8000); #if VERSION > VERSION_DEMO i_this->mEnvLight = actor->tevStr; i_this->m2F20 = actor->tevStr; diff --git a/src/d/actor/d_a_btd.cpp b/src/d/actor/d_a_btd.cpp index bed6a57a6..73bcae8e9 100644 --- a/src/d/actor/d_a_btd.cpp +++ b/src/d/actor/d_a_btd.cpp @@ -540,14 +540,14 @@ static void sibuki_set(btd_class* i_this) { for (s32 i = 0; i < ARRAY_SSIZE(i_this->mBtdSibukiS); i++, sibuki++) { if (sibuki->m00 == 0) { sibuki->m00 = 1; - cMtx_YrotS(*calc_mtx, cM_rndFX(32768.0f)); + cMtx_YrotS(*calc_mtx, cM_rndFX(0x8000)); local_38.z = REG0_F(13) + (cM_rndFX(200.0f) + 300.0f); local_38.y = cM_rndF(50.0f); MtxPosition(&local_38, &sibuki->m04); local_38.z = l_HIO.m48 + cM_rndF(l_HIO.m48 * 0.5f); local_38.y = l_HIO.m4C + cM_rndF(l_HIO.m4C * 0.5f); MtxPosition(&local_38, &sibuki->m10); - cMtx_YrotS(*calc_mtx, cM_rndFX(32768.0f)); + cMtx_YrotS(*calc_mtx, cM_rndFX(0x8000)); } } } @@ -811,8 +811,8 @@ static s32 damage(btd_class* i_this) local_58.y = REG0_F(1) + (cM_rndF(5.0f) + 20.0f); local_58.z = REG0_F(0) + (cM_rndF(5.0f) + 20.0f); MtxPosition(&local_58, &hahen->m14); - hahen->m22 = cM_rndF(65536.0f); - hahen->m20 = cM_rndF(65536.0f); + hahen->m22 = cM_rndF(0x10000); + hahen->m20 = cM_rndF(0x10000); } } for (s32 i = 0, j = 0, k = 0; i < ARRAY_SSIZE(hahen_eff_name); i++, j++, k++) { diff --git a/src/d/actor/d_a_bwd.cpp b/src/d/actor/d_a_bwd.cpp index d9dcad783..e9cb7df2e 100644 --- a/src/d/actor/d_a_bwd.cpp +++ b/src/d/actor/d_a_bwd.cpp @@ -1147,8 +1147,8 @@ static void end(bwd_class* i_this) { local_c0.y = 2.0f; local_c0.z = 2.0f; csXyz local_d4(0, 0, 0); - local_d4.x = (s16)(int)cM_rndF(65536.0f); - local_d4.y = (s16)(int)cM_rndF(65536.0f); + local_d4.x = (s16)(int)cM_rndF(0x10000); + local_d4.y = (s16)(int)cM_rndF(0x10000); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_SIBOUBAKUEN00, i_this->m0418 + i_this->m3C24, &local_d4, &local_c0); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWO_SIBOUSUNA00, i_this->m0418 + i_this->m3C24, &local_d4, &local_c0); mDoAud_seStart(JA_SE_CM_MONS_EXPLODE, &i_this->m0418[i_this->m3C24], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); diff --git a/src/d/actor/d_a_bwds.cpp b/src/d/actor/d_a_bwds.cpp index e8e6a83cd..5b90a589c 100644 --- a/src/d/actor/d_a_bwds.cpp +++ b/src/d/actor/d_a_bwds.cpp @@ -230,7 +230,7 @@ static void ug_move(bwds_class* i_this) { i_this->m030C = REG0_F(3) + 3000.0f; actor->speedF = l_HIO.m010; actor->speed.y = REG0_F(13) + 60.0f + cM_rndF(20.0f); - actor->current.angle.y = cM_rndFX(32768.0f); + actor->current.angle.y = cM_rndFX(0x8000); local_34.x = 0.0f; local_34.y = 0.0f; local_34.z = 2000.0f; @@ -409,7 +409,7 @@ static void hook_chance(bwds_class* i_this) { i_this->m04FC = REG0_S(5) + 0x7f00; } - i_this->m0500 = cM_rndFX(32768.0f); + i_this->m0500 = cM_rndFX(0x8000); i_this->m0502 = cM_rndFX(REG0_F(5) + 2500.0f); if (cM_rndF(1.0f) < 0.5f) { if (cM_rndF(1.0f) < 0.5f) { @@ -465,8 +465,8 @@ static void fail(bwds_class* i_this) { local_34.z = 0.5f; csXyz local_54(0, 0, 0); - local_54.x = cM_rndF(65536.0f); - local_54.y = cM_rndF(65536.0f); + local_54.x = cM_rndF(0x10000); + local_54.y = cM_rndF(0x10000); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWK_SIBOUBAKUEN00, &local_40, &local_54, &local_34); dComIfGp_particle_set(dPa_name::ID_IT_SN_BWK_SIBOUFLASH00, &local_40, &local_54, &local_34); i_this->m04F0++; diff --git a/src/d/actor/d_a_canon.cpp b/src/d/actor/d_a_canon.cpp index 7c4bd8578..c5ecee11e 100644 --- a/src/d/actor/d_a_canon.cpp +++ b/src/d/actor/d_a_canon.cpp @@ -127,7 +127,7 @@ cXyz daCanon_c::getGridPos(int arg1, int arg2) { /* 00000448-00000554 .text getBulEndPos__9daCanon_cFss */ cXyz daCanon_c::getBulEndPos(short arg1, short arg2) { cXyz sp08 = current.pos; - f32 fVar2 = (((home.angle.x + 0x1000) - arg2) / 4096.0f); + f32 fVar2 = (f32)((home.angle.x + 0x1000) - arg2) / 0x1000; f32 fVar3 = fVar2 * 1500.0f * 7.0f + 10500.0f + REG10_F(10); sp08.x += fVar3 * cM_ssin(arg1); sp08.z += fVar3 * cM_scos(arg1); @@ -327,7 +327,7 @@ void daCanon_c::game_proc() { /* 00000FA0-00001074 .text fire_proc_init__9daCanon_cFv */ void daCanon_c::fire_proc_init() { - f32 tmp = (((home.angle.x + 0x1000) - shape_angle.x) / 4096.0f); + f32 tmp = (f32)((home.angle.x + 0x1000) - shape_angle.x) / 0x1000; m652 = tmp * 8.0f * 7.0f + 64.0f; m654 = m652; m65E = 0; @@ -454,13 +454,13 @@ void daCanon_c::PadMove() { s16 target2 = shape_angle.x; if (stickX > 0.5f) { - target1 += (s16)((0.5f - stickX) * 1024.0f); + target1 += (s16)((0.5f - stickX) * 0x400); s16 sVar1 = home.angle.y + -0x1200; if (shape_angle.y >= sVar1 && target1 < sVar1) { target1 = sVar1; } } else if (stickX < -0.5f) { - target1 += (s16)((-0.5f - stickX) * 1024.0f); + target1 += (s16)((-0.5f - stickX) * 0x400); s16 sVar1 = home.angle.y + 0x1200; if (shape_angle.y <= sVar1 && target1 > sVar1) { target1 = sVar1; diff --git a/src/d/actor/d_a_cc.cpp b/src/d/actor/d_a_cc.cpp index 9ddc62221..6de742da3 100644 --- a/src/d/actor/d_a_cc.cpp +++ b/src/d/actor/d_a_cc.cpp @@ -750,7 +750,7 @@ BOOL search_angle_set(cc_class* i_this) { } else if (std::sqrtf(SQUARE(fVar7) + SQUARE(fVar1)) < 100.0f && cM_rnd() < 0.1f && (s16)cLib_distanceAngleS(i_this->actor.shape_angle.y, i_this->actor.current.angle.y) < 0x100) { - i_this->actor.current.angle.y += cM_rndFX(16384.0f); + i_this->actor.current.angle.y += cM_rndFX(0x4000); } } return FALSE; @@ -1632,7 +1632,7 @@ void action_noboru(cc_class* i_this) { a_this->current.angle.x = 0; a_this->current.angle.y = 0; a_this->current.angle.z = 0; - a_this->current.angle.y = cM_rndFX(4096.0f) + 12288.0f; + a_this->current.angle.y = cM_rndFX(0x1000) + 0x3000; a_this->shape_angle.x = a_this->current.angle.x; a_this->shape_angle.y = a_this->current.angle.y; a_this->shape_angle.z = a_this->current.angle.z; diff --git a/src/d/actor/d_a_daiocta.cpp b/src/d/actor/d_a_daiocta.cpp index 38ca17b7b..528443df0 100644 --- a/src/d/actor/d_a_daiocta.cpp +++ b/src/d/actor/d_a_daiocta.cpp @@ -637,7 +637,7 @@ void daDaiocta_c::setAwaRandom(int i_awaIndex) { f29_2 = f30 + cM_rndF(f29); #endif - s16 random_theta = cM_rndF(65536.0f); + s16 random_theta = cM_rndF(0x10000); mAwaTranslation[i_awaIndex].x = current.pos.x + f29_2 * cM_ssin(random_theta); mAwaTranslation[i_awaIndex].y = mWaterY; diff --git a/src/d/actor/d_a_ep.cpp b/src/d/actor/d_a_ep.cpp index 7abc4fe40..0e7167a96 100644 --- a/src/d/actor/d_a_ep.cpp +++ b/src/d/actor/d_a_ep.cpp @@ -559,8 +559,8 @@ void daEp_CreateInit(fopAc_ac_c* a_this) { fopAcM_SetMtx(a_this, i_this->mAlphaModelMtx); fopAcM_SetMin(a_this, -160.0f, -160.0f, -160.0f); fopAcM_SetMax(a_this, 160.0f, 160.0f, 160.0f); - i_this->mAlphaModelRotX = cM_rndF(32768.0f); - i_this->mAlphaModelRotY = cM_rndF(32768.0f); + i_this->mAlphaModelRotX = cM_rndF(0x8000); + i_this->mAlphaModelRotY = cM_rndF(0x8000); a_this->attention_info.position.x = a_this->current.pos.x; a_this->attention_info.position.y = a_this->current.pos.y + 100.0f; a_this->attention_info.position.z = a_this->current.pos.z; diff --git a/src/d/actor/d_a_esa.cpp b/src/d/actor/d_a_esa.cpp index 0002b65ce..62fbbc976 100644 --- a/src/d/actor/d_a_esa.cpp +++ b/src/d/actor/d_a_esa.cpp @@ -93,7 +93,7 @@ void esa_1_move(esa_class* i_this) { switch(i_this->mActionState) { case 0: i_this->current.angle.y += (s16)cM_rndFX(4000.0f); - i_this->current.angle.z = cM_rndFX(32768.0f); + i_this->current.angle.z = cM_rndFX(0x8000); sp24.x = 0.0f; sp24.y = cM_rndF(8.0f) + 15.0f; sp24.z = cM_rndF(5.0f) + 10.0f; @@ -118,7 +118,7 @@ void esa_1_move(esa_class* i_this) { else { if(i_this->speed.y < 5.0f) { i_this->speed.y *= -(cM_rndF(0.05f) + 0.15f); - i_this->current.angle.z = cM_rndFX(32768.0f); + i_this->current.angle.z = cM_rndFX(0x8000); } i_this->current.angle.y += (s16)cM_rndFX(8000.0f); @@ -264,7 +264,7 @@ static cPhs_State daEsa_Create(fopAc_ac_c* i_actor) { params->base.position = pos; params->base.angle.x = 0; params->base.angle.y = i_this->current.angle.y; - params->base.angle.z = cM_rndF(65536.0f); + params->base.angle.z = cM_rndF(0x10000); params->base.parameters = 0x000000FF; fpcM_Create(fpcNm_ESA_e, 0, params); } diff --git a/src/d/actor/d_a_ff.cpp b/src/d/actor/d_a_ff.cpp index 206a1f51c..c640c5d72 100644 --- a/src/d/actor/d_a_ff.cpp +++ b/src/d/actor/d_a_ff.cpp @@ -312,7 +312,7 @@ static cPhs_State daFf_Create(fopAc_ac_c* i_this) { a_this->cullMtx = a_this->mpModel[0]->getBaseTRMtx(); a_this->mHomePos = a_this->current.pos; a_this->m2EC = a_this->mHomePos; - a_this->mLiveTimer = cM_rndF(32768.0f); + a_this->mLiveTimer = cM_rndF(0x8000); a_this->mTimers[2] = cM_rndF(100.0f); static dCcD_SrcSph cc_sph_src = { // dCcD_SrcGObjInf diff --git a/src/d/actor/d_a_fgmahou.cpp b/src/d/actor/d_a_fgmahou.cpp index 8953fdb76..2dcac9d69 100644 --- a/src/d/actor/d_a_fgmahou.cpp +++ b/src/d/actor/d_a_fgmahou.cpp @@ -67,7 +67,7 @@ static void move(fgmahou_class* i_this) { case 0: i_this->mState = 1; i_this->field_0x2D4 = i_this->mOrbNumber * REG6_S(2) - REG6_S(3); - i_this->field_0x2D6 = cM_rndF(65536.0f); + i_this->field_0x2D6 = cM_rndF(0x10000); i_this->speedF = REG0_F(0xD) + 50.0f; i_this->speedF *= (0.2f + REG0_F(4)) * spdd[i_this->mOrbNumber] + 1.0f; diff --git a/src/d/actor/d_a_fm.cpp b/src/d/actor/d_a_fm.cpp index 34312574c..3dfecb9d2 100644 --- a/src/d/actor/d_a_fm.cpp +++ b/src/d/actor/d_a_fm.cpp @@ -636,9 +636,9 @@ void daFm_c::moveRndBack() { if(!isGrabFoot()) { if(cLib_calcTimer(&field_0x648) == 0 || field_0xAE4 == 0 || mObjAcch.ChkWallHit()) { if(field_0xAE4 == 0 || mObjAcch.ChkWallHit()) { - field_0x680 += (s16)(0x5000 + field_0x680 + cM_rndF(3.0f) * 4096.0f); + field_0x680 += (s16)(0x5000 + field_0x680 + cM_rndF(3.0f) * 0x1000); } else { - field_0x680 = shape_angle.y + 0x3000 + cM_rndF(5.0f) * 4096.0f; + field_0x680 = shape_angle.y + 0x3000 + cM_rndF(5.0f) * 0x1000; } field_0x394 = cM_rndF(9.0f) + 1.0f; field_0x660.z += l_HIO.field_0x0AC * cM_scos(field_0x680); @@ -661,9 +661,9 @@ void daFm_c::moveRndEscape() { if(cLib_calcTimer(&field_0x648) == 0 || field_0xAE4 == 0 || mObjAcch.ChkWallHit()) { if(dist < l_HIO.field_0x0B4) { if(field_0xAE4 == 0 || mObjAcch.ChkWallHit()) { - field_0x680 += (s16)(0x5000 + field_0x680 + cM_rndF(3.0f) * 4096.0f); + field_0x680 += (s16)(0x5000 + field_0x680 + cM_rndF(3.0f) * 0x1000); } else { - field_0x680 = shape_angle.y + 0x3000 + cM_rndF(5.0f) * 4096.0f; + field_0x680 = shape_angle.y + 0x3000 + cM_rndF(5.0f) * 0x1000; } field_0x660.set(field_0x690); field_0x660.z += l_HIO.field_0x0B8 * cM_scos(field_0x680); diff --git a/src/d/actor/d_a_himo2.cpp b/src/d/actor/d_a_himo2.cpp index ca0ce4965..51083f73f 100644 --- a/src/d/actor/d_a_himo2.cpp +++ b/src/d/actor/d_a_himo2.cpp @@ -416,11 +416,11 @@ static BOOL daHimo2_Draw(himo2_class* i_this) { sp44 = i_this->m02EC[1] - i_this->m1F84; MtxPosition(&sp44, &sp38); sp38.z = sp38.z * (REG0_F(5) + 500.0f); - if (sp38.z > 16384.0f) { - sp38.z = 16384.0f; + if (sp38.z > 0x4000) { + sp38.z = 0x4000; } - if (sp38.z < -16384.0f) { - sp38.z = -16384.0f; + if (sp38.z < -0x4000) { + sp38.z = -0x4000; } cLib_addCalcAngleS2(&i_this->m1F90, sp38.z, 2, REG0_S(2) + 0x800); sp38.x *= REG0_F(6) + -200.0f; diff --git a/src/d/actor/d_a_ikari.cpp b/src/d/actor/d_a_ikari.cpp index c6375cdfc..c9be07390 100644 --- a/src/d/actor/d_a_ikari.cpp +++ b/src/d/actor/d_a_ikari.cpp @@ -144,7 +144,7 @@ cPhs_State daIkari_c::_create() { 160.0f * scaleX, 100.0f * scaleX, 600.0f * scaleX); fopAcM_setCullSizeFar(this, 10.0f); - mTimer = (s16)(int)cM_rndF(32768.0f); + mTimer = (s16)(int)cM_rndF(0x8000); } } diff --git a/src/d/actor/d_a_kb.cpp b/src/d/actor/d_a_kb.cpp index 873973bd3..ec5297ab1 100644 --- a/src/d/actor/d_a_kb.cpp +++ b/src/d/actor/d_a_kb.cpp @@ -637,7 +637,7 @@ void target_set(kb_class* i_this, u8 param_1) { case 0: temp = actor->shape_angle.y; if(i_this->m426[3] == 0) { - temp = way_check(i_this, cM_rndFX(32768.0f), 0); + temp = way_check(i_this, cM_rndFX(0x8000), 0); } break; @@ -1664,7 +1664,7 @@ void attack_move(kb_class* i_this) { } else { if((s16)cLib_distanceAngleS(actor->current.angle.y, i_this->m442) < 0x100) { - i_this->m442 = fopAcM_searchPlayerAngleY(actor) + cM_rndFX(4096.0f); + i_this->m442 = fopAcM_searchPlayerAngleY(actor) + cM_rndFX(0x1000); } i_this->m5D4[0] = actor->current.pos; @@ -1761,7 +1761,7 @@ void money_drop(kb_class* i_this) { rnd *= 10.0f; u32 temp2 = gold_rate_dt[(int)(0.3f * rnd)]; i_this->m407 = 1; - cMtx_YrotS(*calc_mtx, cM_rndFX(32768.0f)); + cMtx_YrotS(*calc_mtx, cM_rndFX(0x8000)); temp3.set(0.0f, 0.0f, 20.0f); MtxPosition(&temp3, &temp4); temp4 += actor->current.pos; @@ -1782,7 +1782,7 @@ void money_drop(kb_class* i_this) { rnd *= 10.0f; u32 temp2 = item_rate_dt[(int)(0.3f * rnd)]; i_this->m407 = 1; - cMtx_YrotS(*calc_mtx, cM_rndFX(32768.0f)); + cMtx_YrotS(*calc_mtx, cM_rndFX(0x8000)); temp3.set(0.0f, 0.0f, 20.0f); MtxPosition(&temp3, &temp4); temp4 += actor->current.pos; diff --git a/src/d/actor/d_a_ki.cpp b/src/d/actor/d_a_ki.cpp index 434761b88..271966ac8 100644 --- a/src/d/actor/d_a_ki.cpp +++ b/src/d/actor/d_a_ki.cpp @@ -629,7 +629,7 @@ void ki_atack_move(ki_class* i_this) { cLib_addCalcAngleS2(&a_this->shape_angle.y, fopAcM_searchPlayerAngleY(a_this), 2, 0x1000); if (i_this->mTimers[1] == 0) { i_this->mTimers[1] = cM_rndF(50.0f) + 50.0f; - s32 rndFX = cM_rndFX(32768.0f); + s32 rndFX = cM_rndFX(0x8000); cMtx_YrotS(*calc_mtx, player->current.angle.y + rndFX); sp24.x = 0.0f; sp24.y = (cM_rndFX(50.0f) + 200.0f) + REG0_F(12); diff --git a/src/d/actor/d_a_ks.cpp b/src/d/actor/d_a_ks.cpp index 0e952df9f..6222eba68 100644 --- a/src/d/actor/d_a_ks.cpp +++ b/src/d/actor/d_a_ks.cpp @@ -723,7 +723,7 @@ void action_dead_move(ks_class* i_this) { i_this->mMode++; - i_this->m2F0[1] = (s16)cM_rndFX(4096.0f); + i_this->m2F0[1] = (s16)cM_rndFX(0x1000); i_this->mSph.OffAtSPrmBit(cCcD_AtSPrm_Set_e); i_this->mSph.OffAtSPrmBit(cCcD_AtSPrm_Set_e); @@ -1151,7 +1151,7 @@ void action_omoi(ks_class* i_this) { } actor->current.angle.y = fopAcM_searchPlayerAngleY(actor) + 0x8000; - actor->current.angle.y += (s16)cM_rndFX(16384.0f); + actor->current.angle.y += (s16)cM_rndFX(0x4000); actor->speedF = 15.0f; actor->gravity = -3.0f; @@ -1290,7 +1290,7 @@ void action_kb_birth_check(ks_class* i_this) { switch (i_this->mMode) { case 60: { actor->current.pos.y += REG8_F(13) + 30.0f; - actor->current.angle.y = cM_rndFX(32767.0f); + actor->current.angle.y = cM_rndFX(0x7FFF); actor->speedF = REG8_F(8) + 4.0f + cM_rndF(REG8_F(9) + 4.0f); actor->speed.y = REG8_F(10) + 20.0f + cM_rndF(REG8_F(11) + 5.0f); @@ -1717,7 +1717,7 @@ static cPhs_State daKS_Create(fopAc_ac_c* i_this) { fopAc_ac_c* gm_actor = fopAcM_SearchByID(a_this->mGmID); if (gm_actor && fopAc_IsActor(gm_actor) && fopAcM_GetName(gm_actor) == fpcNm_GM_e && a_this->m2C8 == 5) { - i_this->current.angle.y += cM_rndFX(8192.0f); + i_this->current.angle.y += cM_rndFX(0x2000); i_this->speedF = cM_rndF(6.0f) + 34.0f; i_this->speed.y = cM_rndF(8.0f) + 22.0f; } diff --git a/src/d/actor/d_a_lamp.cpp b/src/d/actor/d_a_lamp.cpp index 45a8b0b96..9c19c819c 100644 --- a/src/d/actor/d_a_lamp.cpp +++ b/src/d/actor/d_a_lamp.cpp @@ -185,7 +185,7 @@ static cPhs_State daLamp_Create(fopAc_ac_c* i_ac) { i_this->mSph.Set(sph_src); i_this->mSph.SetStts(&i_this->mStts); - i_this->mCycleCtr = cM_rndFX(32768.0f); + i_this->mCycleCtr = cM_rndFX(0x8000); for (int i = 0; i < 2; i++) { daLamp_Execute(i_this); diff --git a/src/d/actor/d_a_lwood.cpp b/src/d/actor/d_a_lwood.cpp index 53a19f7d2..3c7015e44 100644 --- a/src/d/actor/d_a_lwood.cpp +++ b/src/d/actor/d_a_lwood.cpp @@ -43,7 +43,7 @@ void daLwood_c::CreateInit() { fopAcM_SetMtx(this, mModel->getBaseTRMtx()); fopAcM_setCullSizeBox(this, -600.0f, -0.0f, -600.0f, 600.0f, 900.0f, 600.0f); fopAcM_setCullSizeFar(this, 2.37f); - mTimer = cM_rndF(32768.0f); + mTimer = cM_rndF(0x8000); mScale = cM_rndF(0.4f) + 0.8f; JUTNameTab* jointName = mModel->getModelData()->getJointName(); for (u16 i = 0; i < mModel->getModelData()->getJointNum(); i++) { diff --git a/src/d/actor/d_a_mo2.cpp b/src/d/actor/d_a_mo2.cpp index 238f65c80..aa8be9096 100644 --- a/src/d/actor/d_a_mo2.cpp +++ b/src/d/actor/d_a_mo2.cpp @@ -2446,7 +2446,7 @@ static void yogan_fail(mo2_class* i_this) { dComIfGp_particle_setSimple(dPa_name::ID_IT_SN_O_FIREK_KASU, &actor->current.pos); dComIfGp_particle_setSimple(dPa_name::ID_IT_SN_O_MAGT_FCHIP, &actor->current.pos); if ((i_this->m059C & 3U) == 0) { - i_this->m05E8.y = cM_rndF(65536.0f); + i_this->m05E8.y = cM_rndF(0x10000); i_this->m05E8.x = -0x2000; dComIfGp_particle_set(dPa_name::ID_AK_JN_TUBA00, &i_this->m28C8, &i_this->m05E8); } @@ -2624,7 +2624,7 @@ static void hip_damage(mo2_class* i_this) { break; case 2: if ((i_this->m059C & 7) == 0) { - i_this->m05E8.y = cM_rndF(65536.0f); + i_this->m05E8.y = cM_rndF(0x10000); i_this->m05E8.x = -0x2000; dComIfGp_particle_set(dPa_name::ID_AK_JN_TUBA00, &i_this->m28C8, &i_this->m05E8); } diff --git a/src/d/actor/d_a_movie_player.cpp b/src/d/actor/d_a_movie_player.cpp index 91b5be4de..393f556d7 100644 --- a/src/d/actor/d_a_movie_player.cpp +++ b/src/d/actor/d_a_movie_player.cpp @@ -3279,18 +3279,18 @@ static void daMP_MixAudio(s16* destination, s16*, u32 sample) { l_mix = 0.7f * (attenuation * curPtr[0] >> 15); // clamp volume - if (l_mix < -32768) - l_mix = -32768; - if (l_mix > 32767) - l_mix = 32767; + if (l_mix < -0x8000) + l_mix = -0x8000; + if (l_mix > 0x7FFF) + l_mix = 0x7FFF; dst[0] = l_mix; r_mix = 0.7f * (attenuation * curPtr[1] >> 15); - if (r_mix < -32768) - r_mix = -32768; - if (r_mix > 32767) - r_mix = 32767; + if (r_mix < -0x8000) + r_mix = -0x8000; + if (r_mix > 0x7FFF) + r_mix = 0x7FFF; dst[1] = r_mix; diff --git a/src/d/actor/d_a_npc_photo.cpp b/src/d/actor/d_a_npc_photo.cpp index 6e4eaa2c0..a8ed1630d 100644 --- a/src/d/actor/d_a_npc_photo.cpp +++ b/src/d/actor/d_a_npc_photo.cpp @@ -1468,7 +1468,7 @@ void daNpcPhoto_c::eventSetEyeInit() { /* 000030F0-000031F0 .text eventSetEye__12daNpcPhoto_cFv */ bool daNpcPhoto_c::eventSetEye() { daPy_lk_c* link = daPy_getPlayerLinkActorClass(); - s16 temp = link->shape_angle.y + cM_ssin(field_0x9B0) * 12288.0f; + s16 temp = link->shape_angle.y + cM_ssin(field_0x9B0) * 0x3000; field_0x9B0 += 0x400; mEyePos.x = 0.0f; mEyePos.y = 0.0f; diff --git a/src/d/actor/d_a_nzg.cpp b/src/d/actor/d_a_nzg.cpp index 5dc81515f..bed1a4031 100644 --- a/src/d/actor/d_a_nzg.cpp +++ b/src/d/actor/d_a_nzg.cpp @@ -73,7 +73,7 @@ void nzg_00_move(nzg_class* i_this) { parameters |= 1; csXyz child_angle = actor->current.angle; - child_angle.y += cM_rndFX(8192.0f); + child_angle.y += cM_rndFX(0x2000); fpc_ProcID childProcID = fopAcM_createChild(fpcNm_NZ_e, fopAcM_GetID(actor), parameters, &actor->current.pos, fopAcM_GetRoomNo(actor), &child_angle, &actor->scale, NULL); if (childProcID != fpcM_ERROR_PROCESS_ID_e) { diff --git a/src/d/actor/d_a_obj_Yboil.cpp b/src/d/actor/d_a_obj_Yboil.cpp index 993f24d4f..16d836f03 100644 --- a/src/d/actor/d_a_obj_Yboil.cpp +++ b/src/d/actor/d_a_obj_Yboil.cpp @@ -48,7 +48,7 @@ BOOL daObjYboil_c::CreateHeap() { void daObjYboil_c::pos_reset(int i) { mMdlScale[i].setall(mScaleMin + cM_rndF(mScaleMax - mScaleMin)); f32 dist = 1300.0f + cM_rndF(1400.0f); - s16 angle = cM_rndF(65536.0f); + s16 angle = cM_rndF(0x10000); mMdlPos[i].x = current.pos.x + dist * cM_ssin(angle); mMdlPos[i].y = current.pos.y; mMdlPos[i].z = current.pos.z + dist * cM_scos(angle); diff --git a/src/d/actor/d_a_obj_barrel2.cpp b/src/d/actor/d_a_obj_barrel2.cpp index 8cac21edc..f40968ae8 100644 --- a/src/d/actor/d_a_obj_barrel2.cpp +++ b/src/d/actor/d_a_obj_barrel2.cpp @@ -832,7 +832,7 @@ void daObjBarrel2::Act_c::buoy_jump(float speed) { if (m460 != fpcM_ERROR_PROCESS_ID_e) { daObjBuoyflag::Act_c* buoy = (daObjBuoyflag::Act_c*)fopAcM_SearchByID(m460); if (buoy != NULL) { - s16 rnd = cM_rndFX(32768.0f); + s16 rnd = cM_rndFX(0x8000); buoy->speed.y = speed; buoy->speedF = 50.0f; buoy->current.angle.y = rnd; diff --git a/src/d/actor/d_a_obj_coming.cpp b/src/d/actor/d_a_obj_coming.cpp index 5da8c48f9..45744a88d 100644 --- a/src/d/actor/d_a_obj_coming.cpp +++ b/src/d/actor/d_a_obj_coming.cpp @@ -417,7 +417,7 @@ bool daObjComing::Act_c::barrel2_get_param(daObjComing::PrmBarrel2_c* barrel2) { barrel2->m14 = barrel2_get_buoy(uVar5); s16 angle = cLib_targetAngleY(fopAcM_GetPosition_p(ship), (cXyz*)&sp08.m0C); - s16 rnd = cM_rndFX(8192.0f); + s16 rnd = cM_rndFX(0x2000); barrel2->mAngleY = angle + rnd; return true; } diff --git a/src/d/actor/d_a_obj_hlift.cpp b/src/d/actor/d_a_obj_hlift.cpp index d7e7a488d..f53913de3 100644 --- a/src/d/actor/d_a_obj_hlift.cpp +++ b/src/d/actor/d_a_obj_hlift.cpp @@ -11,7 +11,7 @@ namespace daObjHlift { namespace { int L_time_lag_num; - static const Attr_c L_attr = { 30.0f, 50.0f, 10.0f, 2.0f, 0.3f, 1.2f, 250.0f, 10, 16384, 2.5f, 0x00, 0x02, 0x0a, 0x08, 0x07, 0x00, 0x00, 0x00 }; + static const Attr_c L_attr = { 30.0f, 50.0f, 10.0f, 2.0f, 0.3f, 1.2f, 250.0f, 10, 0x4000, 2.5f, 0x00, 0x02, 0x0a, 0x08, 0x07, 0x00, 0x00, 0x00 }; } // namespace Mtx Act_c::M_tmp_mtx; @@ -243,14 +243,14 @@ void daObjHlift::Act_c::init_mtx() { /* 00000C40-00000C8C .text rot_set__Q210daObjHlift5Act_cFv */ void daObjHlift::Act_c::rot_set() { f32 fVar1 = current.pos.y - home.pos.y; - f32 fVar2 = (65536.0f/L_attr.field_0x18); + f32 fVar2 = (0x10000 / L_attr.field_0x18); shape_angle.y = -(s16)(int)(fVar1 * fVar2); } /* 00000C8C-00000CA8 .text vib_set__Q210daObjHlift5Act_cFv */ void daObjHlift::Act_c::vib_set() { field_0x2E8 = L_attr.field_0x1C; - field_0x2EA = 16384; + field_0x2EA = 0x4000; } /* 00000CA8-00000D70 .text vib_proc__Q210daObjHlift5Act_cFv */ diff --git a/src/d/actor/d_a_obj_homen.cpp b/src/d/actor/d_a_obj_homen.cpp index 82021c04b..2a222ca32 100644 --- a/src/d/actor/d_a_obj_homen.cpp +++ b/src/d/actor/d_a_obj_homen.cpp @@ -596,7 +596,7 @@ BOOL Act_c::process_falldown_init() { } else { field_0x7D6 = 120; } - field_0x7DC = cM_rndFX(3072.0f); + field_0x7DC = cM_rndFX(0xC00); return TRUE; } diff --git a/src/d/actor/d_a_obj_ice.cpp b/src/d/actor/d_a_obj_ice.cpp index 835cda425..2df048227 100644 --- a/src/d/actor/d_a_obj_ice.cpp +++ b/src/d/actor/d_a_obj_ice.cpp @@ -200,7 +200,7 @@ void daObjIce_c::tg_hitCallback(fopAc_ac_c* a_this, dCcD_GObjInf* arg1, fopAc_ac if (i_this->m44C < 0.0f) { i_this->m44C = 0.0f; } - i_this->m450 = 1.0f - cM_scos(i_this->m44C * 16384.0f); + i_this->m450 = 1.0f - cM_scos(i_this->m44C * 0x4000); if (i_this->m44C < 0.1f) { i_this->m45C = 1; } @@ -377,7 +377,7 @@ void daObjIce_c::fade_out_retire_act_proc() { m454 = 0.0f; } - f32 tmp3 = 1.0f - cM_scos(tmp2 * 16384.0f); + f32 tmp3 = 1.0f - cM_scos(tmp2 * 0x4000); m44C = tmp2; m450 = tmp3; diff --git a/src/d/actor/d_a_obj_ikada.cpp b/src/d/actor/d_a_obj_ikada.cpp index 32ebc6df6..37332c36f 100644 --- a/src/d/actor/d_a_obj_ikada.cpp +++ b/src/d/actor/d_a_obj_ikada.cpp @@ -1317,8 +1317,8 @@ void daObj_Ikada_c::createInit() { mSvId[3] = fopAcM_createChild("Sv3", fopAcM_GetID(this), 0xffffffff, ¤t.pos, tevStr.mRoomNo, 0, 0, 0); } - mLightRotY = cM_rndF(32768.0f); - mLightRotX = cM_rndF(32768.0f); + mLightRotY = cM_rndF(0x8000); + mLightRotX = cM_rndF(0x8000); current.pos.y = dLib_getWaterY(current.pos, mObjAcch); mpBgW->SetGrpRoomInf(fopAcM_GetRoomNo(this)); @@ -1374,8 +1374,8 @@ void daObj_Ikada_c::createInit() { mFlagScale = flag_scale[mType]; } - mWave.mAnimX = cM_rndF(32768.0f); - mWave.mAnimZ = cM_rndF(32768.0f); + mWave.mAnimX = cM_rndF(0x8000); + mWave.mAnimZ = cM_rndF(0x8000); if (mType == 4) { mpModel->calc(); diff --git a/src/d/actor/d_a_obj_lpalm.cpp b/src/d/actor/d_a_obj_lpalm.cpp index 4e692794f..4c852ebf2 100644 --- a/src/d/actor/d_a_obj_lpalm.cpp +++ b/src/d/actor/d_a_obj_lpalm.cpp @@ -67,7 +67,7 @@ void daObjLpalm_c::CreateInit() { mAnimDir[0] = 0; mAnimDir[1] = 0; mAnimWave[0] = 0; - mAnimWave[1] = cM_rndFX(32768.0f); + mAnimWave[1] = cM_rndFX(0x8000); fopAcM_SetMtx(this, mModel->getBaseTRMtx()); fopAcM_setCullSizeBox(this, -350.0f, -50.0f, -350.0f, 350.0f, 1300.0f, 350.0f); fopAcM_setCullSizeFar(this, 2.37f); diff --git a/src/d/actor/d_a_obj_mshokki.cpp b/src/d/actor/d_a_obj_mshokki.cpp index 73980d1e2..5fc544ac0 100644 --- a/src/d/actor/d_a_obj_mshokki.cpp +++ b/src/d/actor/d_a_obj_mshokki.cpp @@ -238,7 +238,7 @@ void daObjMshokki_c::set_se() { #else if (abs(tmp) < (s32)HIO(m18)) { #endif - s16 uVar4 = (shape_angle.x / l_data[m60C].m0C) * 16384.0f; + s16 uVar4 = (shape_angle.x / l_data[m60C].m0C) * 0x4000; if (uVar4 > 0x4000) { uVar4 = 0x4000; } diff --git a/src/d/actor/d_a_obj_ohatch.cpp b/src/d/actor/d_a_obj_ohatch.cpp index 986e46da1..67a377947 100644 --- a/src/d/actor/d_a_obj_ohatch.cpp +++ b/src/d/actor/d_a_obj_ohatch.cpp @@ -44,34 +44,34 @@ static daObjOhatch_HIO_c l_HIO; daObjOhatch_HIO_c::daObjOhatch_HIO_c() { mNo = -1; - m08 = -4096.0f; - m0C = -16384.0f; + m08 = -0x1000; + m0C = -0x4000; m10 = 0.0f; m14 = -25.0f; m18 = 190.0f; m1C = 1.0f; - m20 = 8192.0f; - m24 = 131072.0f; + m20 = 0x2000; + m24 = 0x20000; m28 = 6.0f; m2C = -64.0f; - m30 = 1024.0f; - m34 = 8192.0f; + m30 = 0x400; + m34 = 0x2000; m38 = 0; } #else namespace L_HIO { -static const f32 m08 = -4096.0f; -static const f32 m0C = -16384.0f; +static const f32 m08 = -0x1000; +static const f32 m0C = -0x4000; static const f32 m10 = 0.0f; static const f32 m14 = -25.0f; static const f32 m18 = 190.0f; static const f32 m1C = 1.0f; -static const f32 m20 = 8192.0f; -static const f32 m24 = 131072.0f; +static const f32 m20 = 0x2000; +static const f32 m24 = 0x20000; static const f32 m28 = 6.0f; static const f32 m2C = -64.0f; -static const f32 m30 = 1024.0f; -static const f32 m34 = 8192.0f; +static const f32 m30 = 0x400; +static const f32 m34 = 0x2000; static const u8 m38 = 0; } // namespace L_HIO #endif @@ -246,10 +246,10 @@ void daObjOhatch_c::tremor_act_proc() { /* 000008A4-00000A00 .text open_act_proc__13daObjOhatch_cFv */ void daObjOhatch_c::open_act_proc() { #if VERSION == VERSION_DEMO - f32 uVar3 = (cM_ssin(m2D8 / HIO(m0C) * 32768.0f) + HIO(m1C)) / (HIO(m1C) + 1.0f); + f32 uVar3 = (cM_ssin(m2D8 / HIO(m0C) * 0x8000) + HIO(m1C)) / (HIO(m1C) + 1.0f); s32 uVar2 = HIO(m08) * uVar3; #else - f32 sin = m2D8 / HIO(m0C) * 32768.0f; + f32 sin = m2D8 / HIO(m0C) * 0x8000; s32 uVar2 = (cM_ssin(sin) + HIO(m1C)) / (HIO(m1C) + 1.0f) * HIO(m08); #endif m2D8 += uVar2; diff --git a/src/d/actor/d_a_obj_stair.cpp b/src/d/actor/d_a_obj_stair.cpp index ae0c3e9b0..d8ec620d7 100644 --- a/src/d/actor/d_a_obj_stair.cpp +++ b/src/d/actor/d_a_obj_stair.cpp @@ -227,8 +227,8 @@ bool daObj_Stair_c::_execute() { if(temp2.abs() > 8e-11f){ cXyz temp3 = temp2.normZP(); f32 temp4 = l_HIO.m10 * 0.5f * field_0x2C8.abs() * 0.01f * field_0x2EC; - sin = cM_ssin(temp4 * 182.04445f); - cos = cM_scos(temp4 * 182.04445f); + sin = cM_ssin(DEG2S(temp4)); + cos = cM_scos(DEG2S(temp4)); // misses inline cM_deg2s? field_0x4B0.x = sin * temp3.x; diff --git a/src/d/actor/d_a_oship.cpp b/src/d/actor/d_a_oship.cpp index 7b9a1306f..6b241c17d 100644 --- a/src/d/actor/d_a_oship.cpp +++ b/src/d/actor/d_a_oship.cpp @@ -913,8 +913,8 @@ void daOship_c::createInit() { mCyl[i].SetStts(&mStts); } - mWave.mAnimX = cM_rndF(32768.0f); - mWave.mAnimZ = cM_rndF(32768.0f); + mWave.mAnimX = cM_rndF(0x8000); + mWave.mAnimZ = cM_rndF(0x8000); setMtx(); mpModel->calc(); diff --git a/src/d/actor/d_a_player_fan.inc b/src/d/actor/d_a_player_fan.inc index 1e6c8864a..fa682a244 100644 --- a/src/d/actor/d_a_player_fan.inc +++ b/src/d/actor/d_a_player_fan.inc @@ -85,9 +85,9 @@ int daPy_lk_c::setShapeFanLeaf() { if (mpEquipItemModel != NULL) { mtl = mpEquipItemModel->getModelData()->getJointNodePointer(FAN_JNT_CL_FAN_e)->getMesh()->getNext(); } - m355C = m355C + 0x82f; - m3558 = 1536.0f * cM_ssin(m355C); - m355A = 2048.0f * cM_ssin(m355C - 0xe00U); + m355C = m355C + 0x82F; + m3558 = 0x600 * cM_ssin(m355C); + m355A = 0x800 * cM_ssin(m355C - 0xE00); if (dComIfGs_getMagic() >= 1) { // Show material: // * "leafAMat" diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index b470fea7c..83193b72a 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -7583,7 +7583,7 @@ BOOL daPy_lk_c::procDamage() { dVar6 = (mFrameCtrlUnder[UNDER_MOVE0_e].getFrame() - m_HIO->mDam.mDamage.m.field_0x28); cLib_addCalcAngleS(&m3564.y, 0, 4, 0x800, 0x100); if (dVar6 < 0.0f) { - uVar4 = ((16384.0f * mFrameCtrlUnder[UNDER_MOVE0_e].getFrame()) / + uVar4 = ((0x4000 * mFrameCtrlUnder[UNDER_MOVE0_e].getFrame()) / m_HIO->mDam.mDamage.m.field_0x28); fVar1 = cM_ssin(uVar4); if (uVar4 < 0x2000) { @@ -7593,7 +7593,7 @@ BOOL daPy_lk_c::procDamage() { } fVar2 = cM_ssin(uVar4); } else { - uVar4 = (16384.0f * (1.0f - (dVar6 / (mFrameCtrlUnder[UNDER_MOVE0_e].getEnd() - + uVar4 = (0x4000 * (1.0f - (dVar6 / (mFrameCtrlUnder[UNDER_MOVE0_e].getEnd() - m_HIO->mDam.mDamage.m.field_0x28)))); fVar1 = 1.0f - cM_scos(uVar4); fVar2 = 1.0f - cM_scos(uVar4 < 0x2000 ? 0 : (s16)((uVar4 - 0x2000) * 2)); @@ -7689,7 +7689,7 @@ BOOL daPy_lk_c::procLargeDamage_init(int param_1, int param_2, s16 param_3, s16 current.angle.y = cM_atan2s(damage_vec->x, damage_vec->z); } sVar3 = current.angle.y - shape_angle.y; - if (std::abs(sVar3) < 8192.0f) { + if (std::abs(sVar3) < 0x2000) { if (sVar3 >= 0) { sVar3 = 0x2000; } else { diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index fd09a0a8d..346734291 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -181,7 +181,7 @@ void daPy_sightPacket_c::setSight() { f32 temp_f3 = 0.65f + (0.35f * var_f2); mDoMtx_stack_c::scaleM(temp_f3 * mpImg->width, temp_f3 * mpImg->height, temp_f3); - mDoMtx_stack_c::ZrotM(32768.0f * cM_ssin(16384.0f * var_f31)); + mDoMtx_stack_c::ZrotM(0x8000 * cM_ssin(0x4000 * var_f31)); } else { mDoMtx_stack_c::scaleM(10.0f, 10.0f, 10.0f); } diff --git a/src/d/actor/d_a_player_rope.inc b/src/d/actor/d_a_player_rope.inc index ac7acfae9..bd2e6b72c 100644 --- a/src/d/actor/d_a_player_rope.inc +++ b/src/d/actor/d_a_player_rope.inc @@ -1133,10 +1133,10 @@ BOOL daPy_lk_c::procRopeSwingStart() { if (!cLib_addCalcAngleS(&shape_angle.x, mProcVar2.m34D4, 5, 0xa0, 0x40)) { if (mProcVar2.m34D4 > 0) { setSingleMoveAnime(ANM_ROPESWINGF, 1.0f, 0.0f, -1, 10.0f); - mProcVar2.m34D4 = -4096.0f * m35A4; + mProcVar2.m34D4 = -0x1000 * m35A4; } else { setSingleMoveAnime(ANM_ROPESWINGB, 1.0f, 0.0f, -1, 10.0f); - mProcVar2.m34D4 = 4096.0f * m35A4; + mProcVar2.m34D4 = 0x1000 * m35A4; } mProcVar0.m34D0 = 1; if (DEMO_SELECT(!strcmp(dComIfGp_getStartStageName(), "GanonK"), checkSpecialRope())) { diff --git a/src/d/actor/d_a_pw.cpp b/src/d/actor/d_a_pw.cpp index e9ecddf5f..db9671049 100644 --- a/src/d/actor/d_a_pw.cpp +++ b/src/d/actor/d_a_pw.cpp @@ -322,7 +322,7 @@ void action_dousa(pw_class* i_this) { anm_init(i_this, dRes_INDEX_PW_BCK_IDOU2_e, 7.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); } } - i_this->m38C += (s16)cM_rndFX(16384.0f); + i_this->m38C += (s16)cM_rndFX(0x4000); if (i_this->mPathIndex != 0xFF && i_this->mpPath != NULL) { i_this->mMode = 0x14; } else { diff --git a/src/d/actor/d_a_sea.cpp b/src/d/actor/d_a_sea.cpp index 787b0ea76..6b219b38a 100644 --- a/src/d/actor/d_a_sea.cpp +++ b/src/d/actor/d_a_sea.cpp @@ -542,7 +542,7 @@ void daSea_packet_c::execute(cXyz& pos) { aThetaXTable[i] = mWaveInfo.GetKm(i) * mWaveInfo.GetVx(i); aThetaZTable[i] = mWaveInfo.GetKm(i) * mWaveInfo.GetVz(i); - aOffsAnimTable[i] = 65536.0f * (mWaveInfo.GetRatio(i) - 0.5f); + aOffsAnimTable[i] = 0x10000 * (mWaveInfo.GetRatio(i) - 0.5f); aHeightTable[i] = mWaveInfo.GetBaseHeight(i) * scale; } diff --git a/src/d/actor/d_a_ship.cpp b/src/d/actor/d_a_ship.cpp index 1600f6309..1bcc605d2 100644 --- a/src/d/actor/d_a_ship.cpp +++ b/src/d/actor/d_a_ship.cpp @@ -1219,9 +1219,9 @@ void daShip_c::setCrashData(short param1) { iVar5 = param1 - shape_angle.y; fVar1 = cM_ssin(iVar5); fVar2 = cM_scos(iVar5); - m0370 += fVar2 * 3072.0f; + m0370 += fVar2 * 0xC00; m0374 += fVar2 * 500.0f; - m0372 -= fVar1 * 3072.0f; + m0372 -= fVar1 * 0xC00; m0376 -= fVar1 * 500.0f; m03B6 = 30; } @@ -1393,7 +1393,7 @@ void daShip_c::setSelfMove(int param_1) { float fVar6; if (param_1) { - sVar2 = mStickMVal * 8192.0f * -cM_ssin(mStickMAng); + sVar2 = mStickMVal * 0x2000 * -cM_ssin(mStickMAng); } else { sVar2 = 0; @@ -1624,7 +1624,7 @@ BOOL daShip_c::procSteerMove() { if (checkNextMode(MODE_STEER_MOVE_e)) { return TRUE; } - cLib_addCalcAngleS(&m0366, mStickMVal * 8192.0f * -cM_ssin(mStickMAng), 4, l_HIO.tiller_speed, 0x100); + cLib_addCalcAngleS(&m0366, mStickMVal * 0x2000 * -cM_ssin(mStickMAng), 4, l_HIO.tiller_speed, 0x100); if (!checkStateFlg(daSFLG_FLY_e)) { setMoveAngle(m0366); } @@ -2030,19 +2030,19 @@ BOOL daShip_c::procCraneUp() { if (cLib_distanceAngleS(m036C, m03A6) < 0x400) { if (mCraneBaseAngle > 0) { if (m03A6 > 0x400) { - m03A6 = cM_rnd() * 256.0f; + m03A6 = cM_rnd() * 0x100; } else { - m03A6 = cM_rnd() * 1024.0f + 2048.0f; + m03A6 = cM_rnd() * 0x400 + 0x800; seStart(JA_SE_LK_SHIP_CRANE_SALVAGE, ¤t.pos); } } else { if (m03A6 < -0x400) { - m03A6 = cM_rnd() * -256.0f; + m03A6 = cM_rnd() * -0x100; } else { - m03A6 = -2048.0f - cM_rnd() * 1024.0f; + m03A6 = -0x800 - cM_rnd() * 0x400; seStart(JA_SE_LK_SHIP_CRANE_SALVAGE, ¤t.pos); } } @@ -2876,7 +2876,7 @@ BOOL daShip_c::procWhirlDown_init() { /* 00007A90-00007BEC .text procWhirlDown__8daShip_cFv */ BOOL daShip_c::procWhirlDown() { - shape_angle.y += (m0408 / (2*M_PI)) * 65536.0f; + shape_angle.y += (m0408 / (2*M_PI)) * 0x10000; if (mWhirlActor) { #if VERSION == VERSION_DEMO if (cLib_addCalcPosXZ(¤t.pos, mWhirlActor->current.pos, 1.0f, speedF, 10.0f) < 10.0f) @@ -3706,20 +3706,19 @@ BOOL daShip_c::execute() { if (mTornadoActor) { s16 sVar16; sVar16 = shape_angle.y; - cLib_addCalcAngleS(&shape_angle.y, m040C * 10430.378f + 20480.0f, 5, 0x2000, 0x200); + cLib_addCalcAngleS(&shape_angle.y, RAD2S(m040C) + 0x5000, 5, 0x2000, 0x200); setControllAngle(getAimControllAngle(sVar16)); current.angle.y = shape_angle.y; } else { if (mWhirlActor) { - s16 sVar16; - sVar16 = shape_angle.y; + s16 sVar16 = shape_angle.y; s16 sVar5; if (m0352) { - sVar5 = m040C * 10430.378f + 20480.0f; + sVar5 = RAD2S(m040C) + 0x5000; } else { - sVar5 = m040C * 10430.378f + 32768.0f; + sVar5 = RAD2S(m040C) + 0x8000; } cLib_addCalcAngleS(&shape_angle.y, sVar5, 5, 0x2000, 0x200); setControllAngle(getAimControllAngle(sVar16)); @@ -4013,7 +4012,7 @@ BOOL daShip_c::execute() { mDoMtx_multVecZero(mpCannonModel->getAnmMtx(VFNCN_JNT_CANON2_e), &m1038); if (mProc != &daShip_c::procCannon) { - m0396 = getAnglePartRate() * 16384.0f; + m0396 = getAnglePartRate() * 0x4000; m0394 *= getAnglePartRate(); } diff --git a/src/d/actor/d_a_st.cpp b/src/d/actor/d_a_st.cpp index 8ff595db4..a33602eba 100644 --- a/src/d/actor/d_a_st.cpp +++ b/src/d/actor/d_a_st.cpp @@ -2049,7 +2049,7 @@ static void part_move(st_class* i_this, int jointIndex) { } } if ((i_this->m0ED3 == 2) || (i_this->m0ED3 == 0xb)) { - this_part->m3E = cM_rndF(65536.0f); + this_part->m3E = cM_rndF(0x10000); this_part->m44 = 0.0f; if (jointIndex == ST_JNT_BUKI_e) { if ((heldWeapon != NULL) && (!fopAcM_checkCarryNow(heldWeapon))) { @@ -2083,7 +2083,7 @@ static void part_move(st_class* i_this, int jointIndex) { case 6: #if VERSION > VERSION_DEMO if ((i_this->m1DDC == 0) && (this_part->mPartVelocity.y <= 0.0f)) { - this_part->m3E = cM_rndF(65536.0f); + this_part->m3E = cM_rndF(0x10000); this_part->m44 = 0.0f; this_part->mPartState = 1; this_part->mWaitTimer = 0; @@ -2123,7 +2123,7 @@ static void part_move(st_class* i_this, int jointIndex) { cLib_addCalcAngleS2(&this_part->mPartRot.y, i_this->m1DDA, 2, 0xc00); #if VERSION == VERSION_DEMO if (i_this->m1DDC == 0) { - this_part->m3E = cM_rndF(65536.0f); + this_part->m3E = cM_rndF(0x10000); this_part->m44 = 0.0f; this_part->mPartState = 1; this_part->mWaitTimer = 0; @@ -2151,7 +2151,7 @@ static void part_move(st_class* i_this, int jointIndex) { } this_part->mPartVelocity.setall(0.0f); if (i_this->m1DDC == 0) { - this_part->m3E = cM_rndF(65536.0f); + this_part->m3E = cM_rndF(0x10000); this_part->m44 = 0.0f; this_part->mPartState = 1; this_part->mWaitTimer = 0; @@ -2162,7 +2162,7 @@ static void part_move(st_class* i_this, int jointIndex) { } #else if ((i_this->m1DDC == 0) && (this_part->mPartVelocity.y <= 0.0f)) { - this_part->m3E = cM_rndF(65536.0f); + this_part->m3E = cM_rndF(0x10000); this_part->m44 = 0.0f; this_part->mPartState = 1; this_part->mWaitTimer = 0; @@ -2246,7 +2246,7 @@ static void part_move(st_class* i_this, int jointIndex) { this_part->mPartRotAdd = local_88; this_part->mPartRot = this_part->mPartRotAdd; } - this_part->m3E = cM_rndF(65536.0f); + this_part->m3E = cM_rndF(0x10000); this_part->mWaitTimer = 0; this_part->m44 = 0.5f; this_part->m05 = 1; diff --git a/src/d/actor/d_a_stone.cpp b/src/d/actor/d_a_stone.cpp index 5125d9bba..e97b0322b 100644 --- a/src/d/actor/d_a_stone.cpp +++ b/src/d/actor/d_a_stone.cpp @@ -203,7 +203,7 @@ cPhs_State Act_c::_create() { if (fopAcM_entrySolidHeap(this, CreateHeapCB, data().m78)) { #endif if (home.angle.y == 0 && !(data().m70 & 0x10)) { - home.angle.y = cM_rndFX(32768.0f); + home.angle.y = cM_rndFX(0x8000); current.angle.y = home.angle.y; shape_angle.y = home.angle.y; } @@ -667,7 +667,7 @@ void Act_c::init_mtx() { void Act_c::init_rot_throw() { m67C.Val(data().m28); m67C *= cM_rnd(); - m67E.Val((s16)cM_rndFX(32768.0f)); + m67E.Val((s16)cM_rndFX(0x8000)); m680.Val(data().m2A); m682.Val(cSAngle::_0); m684.Val(data().m2C); diff --git a/src/d/actor/d_a_title.cpp b/src/d/actor/d_a_title.cpp index 1a938e4c3..33e4c5434 100644 --- a/src/d/actor/d_a_title.cpp +++ b/src/d/actor/d_a_title.cpp @@ -357,7 +357,7 @@ void daTitle_proc_c::calc_2d_alpha() { pos.set(pane[4].mPosTopLeftOrig.x - 320.0f, pane[4].mPosTopLeftOrig.y - 240.0f, 0.0f); csXyz angle; - angle.x = (s16)cM_rndFX(32768.0f); + angle.x = (s16)cM_rndFX(0x8000); angle.y = 0; angle.z = (s16)cM_rndFX(4000.0f); diff --git a/src/d/actor/d_a_tn.cpp b/src/d/actor/d_a_tn.cpp index 3c97b2d70..f7907dbe9 100644 --- a/src/d/actor/d_a_tn.cpp +++ b/src/d/actor/d_a_tn.cpp @@ -2101,7 +2101,7 @@ static void yogan_fail(tn_class* i_this) { dComIfGp_particle_setSimple(dPa_name::ID_IT_SN_O_FIREK_KASU, &actor->current.pos); dComIfGp_particle_setSimple(dPa_name::ID_IT_SN_O_MAGT_FCHIP, &actor->current.pos); if (!(i_this->m03D8 & 3)) { - i_this->m0428.y = cM_rndF(65536.0f); + i_this->m0428.y = cM_rndF(0x10000); i_this->m0428.x = -0x2000; dComIfGp_particle_set(dPa_name::ID_AK_JN_TUBA00, &i_this->m1384, &i_this->m0428); } diff --git a/src/d/actor/d_a_tsubo.cpp b/src/d/actor/d_a_tsubo.cpp index fa3f94fa1..35a862b67 100644 --- a/src/d/actor/d_a_tsubo.cpp +++ b/src/d/actor/d_a_tsubo.cpp @@ -2069,8 +2069,8 @@ void Act_c::mode_afl_init() { cLib_offBit(attention_info.flags, fopAc_Attn_ACTION_CARRY_e); - m804 = cM_rndFX(32768.0f); - m806 = cM_rndFX(32768.0f); + m804 = cM_rndFX(0x8000); + m806 = cM_rndFX(0x8000); m678 = 7; } @@ -2930,7 +2930,7 @@ void Act_c::set_tensor(const cXyz* pos) { void Act_c::init_rot_throw() { m688.Val(data().m28); m688 *= cM_rnd(); - m68A.Val((s16)cM_rndFX(32768.0f)); + m68A.Val((s16)cM_rndFX(0x8000)); m68C.Val(data().m2A); m68E.Val(cSAngle::_0); m690.Val(data().m2C); diff --git a/src/d/d_attention.cpp b/src/d/d_attention.cpp index 23f47ba2a..e6441a101 100644 --- a/src/d/d_attention.cpp +++ b/src/d/d_attention.cpp @@ -292,7 +292,7 @@ s32 check_flontofplayer(u32 checkMask, s16 angle1, s16 angle2) { /* 8009DC28-8009DC74 .text distace_weight__Ffsf */ f32 distace_weight(f32 distance, s16 angle, f32 ratio) { - f32 turns = (f32)angle / 32768.0F; + f32 turns = (f32)angle / 0x8000; return distance * (f32)((1.0F - ratio) + (f32)(ratio * (turns * turns))); } diff --git a/src/d/d_boss_magma.cpp b/src/d/d_boss_magma.cpp index af236afbf..c0cede5fa 100644 --- a/src/d/d_boss_magma.cpp +++ b/src/d/d_boss_magma.cpp @@ -84,5 +84,5 @@ void dMagma_ballBoss_c::setup(f32 param_1, u8 param_2, int param_3) { } field_0x7C = (cM_rndF(100.0f) + 400.0f); - mWave = (cM_rndF(8.0f) * 4096.0f); + mWave = (cM_rndF(8.0f) * 0x1000); } diff --git a/src/d/d_cam_param.cpp b/src/d/d_cam_param.cpp index 8c3e66155..c61a60f34 100644 --- a/src/d/d_cam_param.cpp +++ b/src/d/d_cam_param.cpp @@ -147,7 +147,7 @@ dCamBGChk_c::dCamBGChk_c() { } static f32 dummy() { - return 182.04445f; + return DEG2S_CONSTANT; } /* 800AF8F4-800AF930 .text __ct__11dCamParam_cFl */ diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index 5f3cf9de0..ded5f1ac5 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -239,7 +239,7 @@ void dCamera_c::initialize(camera_class* camera, fopAc_ac_c* playerActor, u32 ca mEventFlags = 0; m148 = cSAngle::_0; m07C = 0; - m080 = cM_rndFX(32767.0f); + m080 = cM_rndFX(0x7FFF); m064 = 1.0f; m5F4 = 0.0f; mTrimHeight = 0.0f; @@ -4461,7 +4461,7 @@ bool dCamera_c::nonOwnerCamera(s32 param_1) { if (m11C == 0) { mViewCache.mCenter = relationalPos(mpLockonTarget, &local_90); - mViewCache.mDirection.Val(f27, f26 * 182.04445f, directionOf(mpLockonTarget).Inv()); + mViewCache.mDirection.Val(f27, DEG2S(f26), directionOf(mpLockonTarget).Inv()); mViewCache.mEye = mViewCache.mCenter + mViewCache.mDirection.Xyz(); mViewCache.mFovy = f31; m100 = 1; diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 05528a2a1..63b476b7f 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -96,10 +96,10 @@ void dDlst_2DT_c::draw() { f32 texH = mTexH; f32 xo = ((mX1 - mX0) * 0.5f) / mScaleX; f32 yo = ((mY1 - mY0) * 0.5f) / mScaleY; - u16 s0 = ((mCenterX - xo) / texW) * 32768.0f; - u16 t0 = ((mCenterY - yo) / texH) * 32768.0f; - u16 s1 = ((mCenterX + xo) / texW) * 32768.0f; - u16 t1 = ((mCenterY + yo) / texH) * 32768.0f; + u16 s0 = ((mCenterX - xo) / texW) * 0x8000; + u16 t0 = ((mCenterY - yo) / texH) * 0x8000; + u16 s1 = ((mCenterX + xo) / texW) * 0x8000; + u16 t1 = ((mCenterY + yo) / texH) * 0x8000; GXTexObj texObj; GXInitTexObj(&texObj, mpTexData, mTexW, mTexH, (GXTexFmt)mTexFmt, GX_CLAMP, GX_CLAMP, GX_FALSE); @@ -723,7 +723,7 @@ void dDlst_effectLine_c::draw() { for (s32 i = 0; i < numSegments; i++) { cXyz pt0, pt1; - s16 angle = mRnd.getFX(32767.0f); + s16 angle = mRnd.getFX(0x7FFF); f32 rad0 = mRnd.getValue(field_0x28, field_0x2C); pt0.x = mPos.x + rad0 * cM_ssin(angle); diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index 7ddf6629a..f3337c004 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -590,9 +590,9 @@ void dScnKy_env_light_c::setSunpos() { var_f1 = g_env_light.mCurTime + 345.0f; } - sp8.x = std::sinf(DEG_TO_RAD(var_f1)) * 80000.0f; - sp8.y = std::cosf(DEG_TO_RAD(var_f1)) * 80000.0f; - sp8.z = std::cosf(DEG_TO_RAD(var_f1)) * -48000.0f; + sp8.x = std::sinf(DEG2RAD(var_f1)) * 80000.0f; + sp8.y = std::cosf(DEG2RAD(var_f1)) * 80000.0f; + sp8.z = std::cosf(DEG2RAD(var_f1)) * -48000.0f; if (dComIfGp_event_runCheck() == FALSE || g_env_light.mInitAnimTimer != 0) { mSunPos.x = camera_p->mLookat.mEye.x + sp8.x; diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index d185baed1..96d3dea0a 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -133,8 +133,8 @@ void dKyr_kamome_move() { case 0: if (spawnBirds) { if (pWind->mKamomeEff[i].mTimer == 0) { - pWind->mKamomeEff[i].mAngleY = cM_rndFX(65535.0f); - pWind->mKamomeEff[i].mAngleX = cM_rndFX(65535.0f); + pWind->mKamomeEff[i].mAngleY = cM_rndFX(0xFFFF); + pWind->mKamomeEff[i].mAngleX = cM_rndFX(0xFFFF); newPos.x = pCamera->mLookat.mEye.x + cM_ssin(pWind->mKamomeEff[i].mAngleY) * 7000.0f; newPos.y = 4500.0f; newPos.z = pCamera->mLookat.mEye.z + cM_scos(pWind->mKamomeEff[i].mAngleY) * 7000.0f; @@ -343,7 +343,7 @@ void dKyr_wind_move() { windEff.mPos.y -= windVec.y * windScale; windEff.mPos.z -= windVec.z * windScale; - windEff.field_0x2c = cM_rndF(65535.0f); + windEff.field_0x2c = cM_rndF(0xFFFF); cXyz pos; pos.x = windEff.mBasePos.x + windEff.mPos.x; @@ -498,7 +498,7 @@ void dKyr_lenzflare_move() { s16 angle = cM_atan2s(vectle.x, vectle.y); pLenzPkt->mAngleDeg = angle; - pLenzPkt->mAngleDeg *= 0.005493164f; + pLenzPkt->mAngleDeg *= S2DEG_CONSTANT; pLenzPkt->mAngleDeg += 180.0f; dKyr_get_vectle_calc(&pCamera->mLookat.mEye, &pCamera->mLookat.mCenter, &camFwd); @@ -1106,7 +1106,7 @@ void dKyr_housi_move() { case 0: effect->field_0x34 = cM_rndF(1.5f) + 0.2f; effect->field_0x3c = 0; - effect->field_0x4c = cM_rndFX(65536.0f); + effect->field_0x4c = cM_rndFX(0x10000); effect->mBasePos.x = sp84.x; effect->mBasePos.y = sp84.y; effect->mBasePos.z = sp84.z; @@ -1399,9 +1399,9 @@ void wave_move() { pPkt->mEff[i].mPos.x = cM_rndFX(g_env_light.mWaveChan.mWaveSpawnRadius); pPkt->mEff[i].mPos.y = 0.0f; pPkt->mEff[i].mPos.z = cM_rndFX(g_env_light.mWaveChan.mWaveSpawnRadius); - pPkt->mEff[i].mCounter = cM_rndF(65536.0f); + pPkt->mEff[i].mCounter = cM_rndF(0x10000); pPkt->mEff[i].mAlpha = 0.0f; - pPkt->mEff[i].field_0x32 = cM_rndF(65536.0f); + pPkt->mEff[i].field_0x32 = cM_rndF(0x10000); pPkt->mEff[i].mStrengthEnv = 1.0f; pPkt->mEff[i].mScale = g_env_light.mWaveChan.mWaveScaleRand + cM_rndF(1.0f - g_env_light.mWaveChan.mWaveScaleRand); pPkt->mEff[i].mSpeed = pPkt->mEff[i].mScale; @@ -1562,7 +1562,7 @@ void cloud_shadow_move() { pPkt->mEff[i].mPos.z = cM_rndFX(2000.0f); pPkt->mEff[i].mWindSpeed = 0.7f + cM_rndF(0.3f); pPkt->mEff[i].mAlpha = 0.0; - pPkt->mEff[i].mAnimCounter = cM_rndF(65535.0f); + pPkt->mEff[i].mAnimCounter = cM_rndF(0xFFFF); pPkt->mEff[i].mVelRndm.x = cM_rndFX(360.0f); pPkt->mEff[i].mVelRndm.y = cM_rndFX(360.0f); pPkt->mEff[i].mVelRndm.z = cM_rndFX(360.0f); @@ -2949,7 +2949,7 @@ void dKyr_drawHousi(Mtx drawMtx, u8** pImg) { GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); - MTXRotRad(rotMtx, 'Z', DEG_TO_RAD(rot)); + MTXRotRad(rotMtx, 'Z', DEG2RAD(rot)); MTXConcat(camMtx, rotMtx, camMtx); GXLoadPosMtxImm(drawMtx, GX_PNMTX0); @@ -3136,7 +3136,7 @@ void dKyr_drawStar(Mtx drawMtx, u8** pImg) { GXSetVtxDesc(GX_VA_POS, GX_DIRECT); Mtx rotMtx; - MTXRotRad(rotMtx, 'Z', DEG_TO_RAD(rot)); + MTXRotRad(rotMtx, 'Z', DEG2RAD(rot)); MTXConcat(camMtx, rotMtx, camMtx); GXLoadPosMtxImm(drawMtx, GX_PNMTX0); diff --git a/src/d/d_magma.cpp b/src/d/d_magma.cpp index a834ea0c3..043cdc542 100644 --- a/src/d/d_magma.cpp +++ b/src/d/d_magma.cpp @@ -90,7 +90,7 @@ void dMagma_ballPath_c::setup(f32 offsY, u8 pathNo, int roomNo) { mPos.z = pt->m_position.z + cM_rndFX(pt->mArg3 * 100.0f); mScale = cM_rndF(1.0f) + 1.0f; mBaseY = offsY - cM_rndF(20.0f); - mWave = cM_rndF(8.0f) * 4096.0f; + mWave = cM_rndF(8.0f) * 0x1000; mPos.y = mBaseY + (cM_ssin(mWave) - 1.0f) * 100.0f; mWaveTimer = 0; mDoMtx_stack_c::transS(mPos); diff --git a/src/d/d_map.cpp b/src/d/d_map.cpp index 31ebe7e00..53b045788 100644 --- a/src/d/d_map.cpp +++ b/src/d/d_map.cpp @@ -1830,7 +1830,7 @@ void dMap_c::drawPointAgbCursor(f32 param_1, f32 param_2) { if (agbFlashCheck()) { mMapAGBCursorFlashFrmCnt++; mMapAGBCursorFlashFrmCnt = mMapAGBCursorFlashFrmCnt % 45; - f32 tmp = JMASSin(mMapAGBCursorFlashFrmCnt / 45.0f * 32768.0f) * JMASSin(mMapAGBCursorFlashFrmCnt / 45.0f * 32768.0f); + f32 tmp = JMASSin(mMapAGBCursorFlashFrmCnt / 45.0f * 0x8000) * JMASSin(mMapAGBCursorFlashFrmCnt / 45.0f * 0x8000); color.r = 0; color.g = tmp * 175.0f + 80.0f; color.b = 0; diff --git a/src/d/d_meter.cpp b/src/d/d_meter.cpp index 299157a82..0b10dd029 100644 --- a/src/d/d_meter.cpp +++ b/src/d/d_meter.cpp @@ -4718,7 +4718,7 @@ void dMeter_menuPlusMove(sub_meter_class* i_Meter) { cXyz* pcVar4 = dKyw_get_wind_vec(); iVar3 = cM_atan2s(pcVar4->x, pcVar4->z); i_Meter->field_0x02f8.pane->rotate( - i_Meter->field_0x02f8.mSizeOrig.x, i_Meter->field_0x02f8.mSizeOrig.y / 2.0f, ROTATE_Z, (iVar3 * 180.0f) / 32768.0f - 180.0f + i_Meter->field_0x02f8.mSizeOrig.x, i_Meter->field_0x02f8.mSizeOrig.y / 2.0f, ROTATE_Z, (iVar3 * 180.0f) / 0x8000 - 180.0f ); fopMsgM_paneTrans(&i_Meter->field_0x02c0, x, y); fopMsgM_paneTrans(&i_Meter->field_0x02f8, (dVar13 - 7.0f) + g_meterHIO.field_0x64, (dVar12 + 9.0f) + g_meterHIO.field_0x66); @@ -5223,7 +5223,7 @@ void dMeter_compassGetOnProc(sub_meter_class* i_Meter) { dMeter_compassAnimeMove(i_Meter); break; } - f32 dVar3 = (-(s16)(fopAcM_SearchByName(fpcNm_SHIP_e)->shape_angle.y + 0x8000) * 180.0f) / 32768.0f; + f32 dVar3 = (-(s16)(fopAcM_SearchByName(fpcNm_SHIP_e)->shape_angle.y + 0x8000) * 180.0f) / 0x8000; dMeter_compassRotate(&i_Meter->field_0x1670, &i_Meter->field_0x16a8, (-dComIfGs_getTime() - 90.0f)); dMeter_compassRotate(&i_Meter->field_0x1248, &i_Meter->field_0x12f0, dVar3); dMeter_compassRotate(&i_Meter->field_0x1280, &i_Meter->field_0x12f0, dVar3); diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index 92d9af8ed..d240c68b4 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -110,21 +110,21 @@ void dPa_J3DmodelEmitter_c::draw() { sp44[2][1] = vel.z; sp44[2][2] = tmp.z; - f32 f1 = params->mRotateAngle * 0.005493164f; // SAngle -> Degree conversion + f32 f1 = S2DEG(params->mRotateAngle); if (f1) { switch (field_0x26) { case 0: - MTXRotRad(sp14, 'y', f1 * 0.017453292f); // Degree -> Radian conversion + MTXRotRad(sp14, 'y', DEG2RAD(f1)); break; case 1: - MTXRotRad(sp14, 'x', f1 * 0.017453292f); // Degree -> Radian conversion + MTXRotRad(sp14, 'x', DEG2RAD(f1)); break; case 2: - MTXRotRad(sp14, 'z', f1 * 0.017453292f); // Degree -> Radian conversion + MTXRotRad(sp14, 'z', DEG2RAD(f1)); break; case 3: Vec sp08 = {1.0f, 1.0f, 1.0f}; - MTXRotAxisRad(sp14, &sp08, f1 * 0.017453292f); // Degree -> Radian conversion + MTXRotAxisRad(sp14, &sp08, DEG2RAD(f1)); break; } MTXConcat(sp44, sp14, sp44); diff --git a/src/d/d_picture_box.cpp b/src/d/d_picture_box.cpp index 6b56870c1..6a10e51c6 100644 --- a/src/d/d_picture_box.cpp +++ b/src/d/d_picture_box.cpp @@ -401,7 +401,7 @@ void dJle_Pb_c::zoomScale() { } else { f32 cameraZoomForcus = dComIfGp_getCameraZoomForcus(0); - mDoAud_seStart(JA_SE_TELESCOPE_ZOOM, NULL, cameraZoomForcus * 32768.0f + 0.5f); + mDoAud_seStart(JA_SE_TELESCOPE_ZOOM, NULL, cameraZoomForcus * 0x8000 + 0.5f); } } } diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp index d20dbab1e..4d107dee0 100644 --- a/src/f_op/f_op_msg_mng.cpp +++ b/src/f_op/f_op_msg_mng.cpp @@ -6367,10 +6367,10 @@ f32 fopMsgM_valueIncrease(int i_max, int i_value, u8 i_mode) { ret = (v * 2.0f - 1.0f) * 2.0f - 1.0f; break; case 4: - ret = JMASSin(v * 32768.0f * 0.5f) * JMASSin(v * 32768.0f * 0.5f); + ret = JMASSin(v * 0x8000 * 0.5f) * JMASSin(v * 0x8000 * 0.5f); break; case 5: - ret = JMASSin(v * 65535.0f * 0.5f) * JMASSin(v * 65535.0f * 0.5f); + ret = JMASSin(v * 0xFFFF * 0.5f) * JMASSin(v * 0xFFFF * 0.5f); break; } return ret; diff --git a/src/m_Do/m_Do_gba_com.cpp b/src/m_Do/m_Do_gba_com.cpp index de4b7c73a..0cf3c82aa 100644 --- a/src/m_Do/m_Do_gba_com.cpp +++ b/src/m_Do/m_Do_gba_com.cpp @@ -113,8 +113,8 @@ void mDoGaC_agbCom_c::mDoGaC_Initial(mDoGaC_DataManag_c* param_0, u8 param_1) { field_0x114 = 0xFFFFFFFF; field_0x118 = 0; - field_0x12c.U16._12e_1 = (u32)cM_rndF(32767.0f); - field_0x12c.U32bits._12c_2 = cM_rndF(32767.0f); + field_0x12c.U16._12e_1 = (u32)cM_rndF(0x7FFF); + field_0x12c.U32bits._12c_2 = cM_rndF(0x7FFF); field_0x12c.U8._12c_0 = 1; field_0x128 = 0; } @@ -153,7 +153,7 @@ void mDoGaC_agbCom_c::mDoGaC_GbaReboot() { mDoGaC_ComStop(); u8 temp = field_0x0 = 0; // fakematch? field_0x3 = 0; - field_0x12c.U32bits._12c_2 = cM_rndF(32767.0f); + field_0x12c.U32bits._12c_2 = cM_rndF(0x7FFF); field_0x128 = temp; } diff --git a/src/m_Do/m_Do_lib.cpp b/src/m_Do/m_Do_lib.cpp index d1cb15e53..5fa191b39 100644 --- a/src/m_Do/m_Do_lib.cpp +++ b/src/m_Do/m_Do_lib.cpp @@ -43,7 +43,7 @@ void mDoLib_clipper::setup(f32 fovY, f32 aspect, f32 n, f32 f) { mSystemFar = f; mClipper.calcViewFrustum(); - s16 ang = (s16)(fovY * 182.04445f); + s16 ang = DEG2S(fovY); mFovyRate = JMASCos(ang) / JMASSin(ang); }