diff --git a/include/SSystem/SComponent/c_angle.h b/include/SSystem/SComponent/c_angle.h index 8f78fb88d37..d3a81eefd1e 100644 --- a/include/SSystem/SComponent/c_angle.h +++ b/include/SSystem/SComponent/c_angle.h @@ -2,33 +2,8 @@ #define C_ANGLE_H #include "SSystem/SComponent/c_xyz.h" +#include "angle_utils.h" -#define ADD_VAR(x, y) ((x) += (y)) -#define SUB_VAR(x, y) ((x) -= (y)) -#define MULT_VAR(x, y) ((x) *= (y)) - -#define ADD_VAR_CAST(x, y, t) ((x) += (t)(y)) -#define SUB_VAR_CAST(x, y, t) ((x) -= (t)(y)) -#define MULT_VAR_CAST(x, y, t) ((x) *= (t)(y)) - -#define ADD_ANGLE(x, y) ADD_VAR_CAST(x, y, s16) -#define SUB_ANGLE(x, y) SUB_VAR_CAST(x, y, s16) -#define MULT_ANGLE(x, y) MULT_VAR_CAST(x, y, s16) - -// There are some angles that weren't sign-extended until the shield version -#if !PLATFORM_SHIELD - #define ADD_ANGLE_2 ADD_VAR - #define SUB_ANGLE_2 SUB_VAR - #define MULT_ANGLE_2 MULT_VAR - - #define ADD_S8_2 ADD_VAR -#else - #define ADD_ANGLE_2 ADD_ANGLE - #define SUB_ANGLE_2 SUB_ANGLE - #define MULT_ANGLE_2 MULT_ANGLE - - #define ADD_S8_2(x, y) ADD_VAR_CAST(x, y, s8) -#endif #define DEG2S_CONSTANT (0x8000 / 180.0f) #define S2DEG_CONSTANT (180.0f / 0x8000) diff --git a/include/angle_utils.h b/include/angle_utils.h new file mode 100644 index 00000000000..22c08956a48 --- /dev/null +++ b/include/angle_utils.h @@ -0,0 +1,89 @@ +#ifndef _ANGLE_UTILS_H_ +#define _ANGLE_UTILS_H_ + +#include "global.h" +#include "types.h" + +#define VAR_ADD(x, y) ((x) += (y)) +#define VAR_SUB(x, y) ((x) -= (y)) +#define VAR_MULT(x, y) ((x) *= (y)) + +#define VAR_ADD_CAST(x, y, t) ((x) += (t)(y)) +#define VAR_SUB_CAST(x, y, t) ((x) -= (t)(y)) +#define VAR_MULT_CAST(x, y, t) ((x) *= (t)(y)) + +#define S8_ADD(x, y) VAR_ADD_CAST(x, y, s8) +#define U8_ADD(x, y) VAR_ADD_CAST(x, y, u8) +#define S16_ADD(x, y) VAR_ADD_CAST(x, y, s16) +#define U16_ADD(x, y) VAR_ADD_CAST(x, y, u16) +#define S32_ADD(x, y) VAR_ADD_CAST(x, y, s32) +#define U32_ADD(x, y) VAR_ADD_CAST(x, y, u32) + +#define S8_SUB(x, y) VAR_SUB_CAST(x, y, s8) +#define U8_SUB(x, y) VAR_SUB_CAST(x, y, u8) +#define S16_SUB(x, y) VAR_SUB_CAST(x, y, s16) +#define U16_SUB(x, y) VAR_SUB_CAST(x, y, u16) +#define S32_SUB(x, y) VAR_SUB_CAST(x, y, s32) +#define U32_SUB(x, y) VAR_SUB_CAST(x, y, u32) + +#define S8_MULT(x, y) VAR_MULT_CAST(x, y, s8) +#define U8_MULT(x, y) VAR_MULT_CAST(x, y, u8) +#define S16_MULT(x, y) VAR_MULT_CAST(x, y, s16) +#define U16_MULT(x, y) VAR_MULT_CAST(x, y, u16) +#define S32_MULT(x, y) VAR_MULT_CAST(x, y, s32) +#define U32_MULT(x, y) VAR_MULT_CAST(x, y, u32) + +#define ANGLE_ADD S16_ADD +#define ANGLE_SUB S16_SUB +#define ANGLE_MULT S16_MULT + +// There are some angles that weren't sign-extended until the shield version +#if !PLATFORM_SHIELD + #define S8_ADD_2 VAR_ADD + #define U8_ADD_2 VAR_ADD + #define S16_ADD_2 VAR_ADD + #define U16_ADD_2 VAR_ADD + #define S32_ADD_2 VAR_ADD + #define U32_ADD_2 VAR_ADD + + #define S8_SUB_2 VAR_SUB + #define U8_SUB_2 VAR_SUB + #define S16_SUB_2 VAR_SUB + #define U16_SUB_2 VAR_SUB + #define S32_SUB_2 VAR_SUB + #define U32_SUB_2 VAR_SUB + + #define S8_MULT_2 VAR_MULT + #define U8_MULT_2 VAR_MULT + #define S16_MULT_2 VAR_MULT + #define U16_MULT_2 VAR_MULT + #define S32_MULT_2 VAR_MULT + #define U32_MULT_2 VAR_MULT +#else + #define S8_ADD_2 S8_ADD + #define U8_ADD_2 U8_ADD + #define S16_ADD_2 S16_ADD + #define U16_ADD_2 U16_ADD + #define S32_ADD_2 S32_ADD + #define U32_ADD_2 U32_ADD + + #define S8_SUB_2 S8_SUB + #define U8_SUB_2 U8_SUB + #define S16_SUB_2 S16_SUB + #define U16_SUB_2 U16_SUB + #define S32_SUB_2 S32_SUB + #define U32_SUB_2 U32_SUB + + #define S8_MULT_2 S8_MULT + #define U8_MULT_2 U8_MULT + #define S16_MULT_2 S16_MULT + #define U16_MULT_2 U16_MULT + #define S32_MULT_2 S32_MULT + #define U32_MULT_2 U32_MULT +#endif + +#define ANGLE_ADD_2 S16_ADD_2 +#define ANGLE_SUB_2 S16_SUB_2 +#define ANGLE_MULT_2 S16_MULT_2 + +#endif // !_ANGLE_UTILS_H_ diff --git a/include/d/actor/d_a_npc.h b/include/d/actor/d_a_npc.h index 9dbc9f8d5fa..205a2420501 100644 --- a/include/d/actor/d_a_npc.h +++ b/include/d/actor/d_a_npc.h @@ -276,7 +276,7 @@ class daNpcT_JntAnm_c { cXyz cStack_50 = *mAttnPosP - param_1; sVar3 += cM_atan2s(cStack_50.x, cStack_50.z); sVar3 -= param_2; - sVar3 -= (s16)(field_0x150.y - param_2); + ANGLE_SUB(sVar3, field_0x150.y - param_2); sVar3 += param_5; } if (param_3) { diff --git a/src/JSystem/JUtility/JUTCacheFont.cpp b/src/JSystem/JUtility/JUTCacheFont.cpp index 7ddd4112c79..3dac794756a 100644 --- a/src/JSystem/JUtility/JUTCacheFont.cpp +++ b/src/JSystem/JUtility/JUTCacheFont.cpp @@ -7,6 +7,7 @@ #include "JSystem/JKernel/JKRAram.h" #include #include +#include "angle_utils.h" JUTCacheFont::JUTCacheFont(ResFONT const* p_fontRes, u32 cacheSize, JKRHeap* p_heap) { initialize_state(); @@ -343,11 +344,7 @@ void JUTCacheFont::getGlyphFromAram(JUTCacheFont::TGlyphCacheInfo* param_0, prepend(pGylphCacheInfo); int iVar3 = pGylphCacheInfo->field_0x16 * pGylphCacheInfo->field_0x18; int iVar2 = *r30 / iVar3; -#if PLATFORM_SHIELD - pGylphCacheInfo->field_0x8 += (u16)(iVar2 * iVar3); -#else - pGylphCacheInfo->field_0x8 += iVar2 * iVar3; -#endif + U16_ADD_2(pGylphCacheInfo->field_0x8, iVar2 * iVar3); u16 local_30 = pGylphCacheInfo->field_0x8 + iVar3 - 1; pGylphCacheInfo->field_0xa = pGylphCacheInfo->field_0xa < local_30 ? pGylphCacheInfo->field_0xa : local_30; *param_3 = iVar2; diff --git a/src/JSystem/JUtility/JUTDirectPrint.cpp b/src/JSystem/JUtility/JUTDirectPrint.cpp index b8726c06f44..ccb1f5c2e01 100644 --- a/src/JSystem/JUtility/JUTDirectPrint.cpp +++ b/src/JSystem/JUtility/JUTDirectPrint.cpp @@ -4,6 +4,7 @@ #include #include #include "global.h" +#include "angle_utils.h" JUTDirectPrint* JUTDirectPrint::sDirectPrint; @@ -160,11 +161,7 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format for (; 0 < buffer_length; buffer_length--, ptr++) { int codepoint = sAsciiTable[*ptr & 0x7f]; if (codepoint == 0xfe) { -#if PLATFORM_SHIELD - position_y += (u16)7; -#else - position_y += 7; -#endif + U16_ADD_2(position_y, 7); position_x = x; } else if (codepoint == 0xfd) { position_x = position_x + 0x30 - ((position_x - x + 0x2f) % 0x30); @@ -172,11 +169,7 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format if (codepoint != 0xff) { drawChar(position_x, position_y, codepoint); } -#if PLATFORM_SHIELD - position_x += (u16)6; -#else - position_x += 6; -#endif + U16_ADD_2(position_x, 6); } } } diff --git a/src/d/actor/d_a_alink.cpp b/src/d/actor/d_a_alink.cpp index 6ae53c79837..f0041d01d65 100644 --- a/src/d/actor/d_a_alink.cpp +++ b/src/d/actor/d_a_alink.cpp @@ -2812,10 +2812,10 @@ void daAlink_c::setHairAngle(cXyz* param_0, f32 param_1, f32 param_2) { var_f31 = 0.15f + (0.85f * var_f31); - field_0x3070 += (s16)(1000.0f + cM_rndF(500.0f) + (var_f31 * (3000.0f + cM_rndF(1000.0f)))); - field_0x3072 += (s16)(1000.0f + cM_rndF(500.0f) + (var_f31 * (3000.0f + cM_rndF(1000.0f)))); - field_0x3074 += (s16)(1000.0f + cM_rndF(500.0f) + (var_f31 * (5000.0f + cM_rndF(1500.0f)))); - field_0x3076 += (s16)(1000.0f + cM_rndF(500.0f) + (var_f31 * (5000.0f + cM_rndF(1500.0f)))); + ANGLE_ADD(field_0x3070, 1000.0f + cM_rndF(500.0f) + (var_f31 * (3000.0f + cM_rndF(1000.0f)))); + ANGLE_ADD(field_0x3072, 1000.0f + cM_rndF(500.0f) + (var_f31 * (3000.0f + cM_rndF(1000.0f)))); + ANGLE_ADD(field_0x3074, 1000.0f + cM_rndF(500.0f) + (var_f31 * (5000.0f + cM_rndF(1500.0f)))); + ANGLE_ADD(field_0x3076, 1000.0f + cM_rndF(500.0f) + (var_f31 * (5000.0f + cM_rndF(1500.0f)))); temp_f27 = 1.0f / temp_f27; param_0->x *= temp_f27; @@ -3148,7 +3148,7 @@ s16 daAlink_c::getNeckAimAngle(cXyz* param_0, s16* param_1, s16* param_2, s16* p s16 sp18; s16 sp16 = mPrevAngleY + mBodyAngle.y; if ((mProcID == PROC_GOAT_CATCH && mProcVar1.field_0x300a == 0) || (mProcID == PROC_HAND_PAT && mProcVar2.field_0x300c == 0)) { - ADD_ANGLE_2(sp16, 0x8000); + ANGLE_ADD_2(sp16, 0x8000); } cXyz sp28 = eyePos - field_0x34e0; @@ -3233,8 +3233,8 @@ s16 daAlink_c::getNeckAimAngle(cXyz* param_0, s16* param_1, s16* param_2, s16* p *param_4 = sp8; } - *param_3 += (s16)(sp10 - temp_r24); - *param_4 += (s16)(spE - var_r28); + ANGLE_ADD(*param_3, sp10 - temp_r24); + ANGLE_ADD(*param_4, spE - var_r28); if (checkEndResetFlg0(ERFLG0_UNK_4000)) { *param_3 = (sp10 + 0x8000) - sp14; @@ -3302,7 +3302,7 @@ void daAlink_c::setEyeMove(cXyz* param_0, s16 param_1, s16 param_2) { field_0x341c = 0.0f; } else { s16 temp_r29_2 = cM_atan2s(field_0x3418, field_0x341c); - temp_r29_2 += (s16)(((int)cM_rndF(3.0f) << 13) + 0x6000); + ANGLE_ADD(temp_r29_2, ((int)cM_rndF(3.0f) << 13) + 0x6000); field_0x3418 = cM_ssin(temp_r29_2); field_0x341c = cM_scos(temp_r29_2); @@ -3929,9 +3929,9 @@ void daAlink_c::footBgCheck() { if ((sp10 * var_r29->field_0x6) < 0 && abs(sp10 - var_r29->field_0x6) >= 0x8000) { if (sp10 >= 0) { - sp10 -= (s16)0x4000; + ANGLE_SUB(sp10, 0x4000); } else { - sp10 += (s16)0x4000; + ANGLE_ADD(sp10, 0x4000); } } diff --git a/src/d/actor/d_a_alink_canoe.inc b/src/d/actor/d_a_alink_canoe.inc index 6b92edf0bc0..92802f8075f 100644 --- a/src/d/actor/d_a_alink_canoe.inc +++ b/src/d/actor/d_a_alink_canoe.inc @@ -383,7 +383,7 @@ int daAlink_c::procCanoeRide() { if (checkAnmEnd(frameCtrl)) { procCanoeWaitInit(1); } else if (frameCtrl->getFrame() < 9.0f) { - mProcVar3.field_0x300e += (s16)0x180; + ANGLE_ADD(mProcVar3.field_0x300e, 0x180); if (mProcVar0.field_0x3008 == 0) { canoe->incShapeAngleZ(-mProcVar3.field_0x300e); @@ -483,11 +483,11 @@ int daAlink_c::procCanoeGetOffInit() { } if (var_r27) { - shape_angle.y -= (s16)0x4000; + ANGLE_SUB(shape_angle.y, 0x4000); setOldRootQuaternion(0, 0x4000, 0); var_r28->mTranslate.x -= 100.0f; } else { - shape_angle.y += (s16)0x4000; + ANGLE_ADD(shape_angle.y, 0x4000); setOldRootQuaternion(0, -0x4000, 0); var_r28->mTranslate.x += 100.0f; } diff --git a/src/d/actor/d_a_alink_damage.inc b/src/d/actor/d_a_alink_damage.inc index bf21bf7f092..38cf05d3e6d 100644 --- a/src/d/actor/d_a_alink_damage.inc +++ b/src/d/actor/d_a_alink_damage.inc @@ -45,11 +45,11 @@ void daAlink_c::freezeTimerDamage() { } if (escapeTrigger()) { - mProcVar0.field_0x3008 -= (s16)2; + S16_SUB(mProcVar0.field_0x3008, 2); } if (checkInputOnR() && abs((s16)(mStickAngle - mPrevStickAngle)) > 0x1000) { - mProcVar0.field_0x3008 -= (s16)2; + S16_SUB(mProcVar0.field_0x3008, 2); } if (mProcVar0.field_0x3008 < 0) { @@ -504,7 +504,7 @@ BOOL daAlink_c::checkDamageAction() { poly_dmg_flags = 0; } } else if (mIceDamageWaitTimer > 3) { - mIceDamageWaitTimer -= (s16)3; + S16_SUB(mIceDamageWaitTimer, 3); } else { mIceDamageWaitTimer = 0; } @@ -1656,7 +1656,7 @@ int daAlink_c::procCoElecDamageInit(fopAc_ac_c* i_tgHitActor, dCcD_GObjInf* i_tg if (getZoraSwim()) { current.pos.y += 50.0f; - field_0x3080 += (s16)0x4000; + ANGLE_ADD(field_0x3080, 0x4000); } } } diff --git a/src/d/actor/d_a_alink_demo.inc b/src/d/actor/d_a_alink_demo.inc index ed927c8de24..98dcb83804d 100644 --- a/src/d/actor/d_a_alink_demo.inc +++ b/src/d/actor/d_a_alink_demo.inc @@ -4148,7 +4148,7 @@ int daAlink_c::procDungeonWarpInit() { } int daAlink_c::procDungeonWarp() { - mProcVar2.field_0x300c += (s16)0x200; + ANGLE_ADD(mProcVar2.field_0x300c, 0x200); if (mProcVar2.field_0x300c > 0x4000) { mProcVar2.field_0x300c = 0x4000; @@ -4157,7 +4157,7 @@ int daAlink_c::procDungeonWarp() { } f32 sin = cM_ssin(mProcVar2.field_0x300c); - shape_angle.y += (s16)(14336.0f * sin); + ANGLE_ADD(shape_angle.y, 0x3800 * sin); mProcVar3.field_0x300e = 8.0f * sin + 24.0f * (1.0f - scale.x); if (mProcVar5.field_0x3012 != 0) { @@ -4256,7 +4256,7 @@ int daAlink_c::procDungeonWarpSceneStart() { } f32 sin = cM_ssin(mProcVar2.field_0x300c); - shape_angle.y += (s16)(sin * 14336.0f); + ANGLE_ADD(shape_angle.y, sin * (f32)0x3800); mProcVar3.field_0x300e = (sin * 8.0f) + ((1.0f - scale.x) * 24.0f); return 1; } diff --git a/src/d/actor/d_a_alink_grab.inc b/src/d/actor/d_a_alink_grab.inc index 6c316a09337..6175baea5dc 100644 --- a/src/d/actor/d_a_alink_grab.inc +++ b/src/d/actor/d_a_alink_grab.inc @@ -492,10 +492,10 @@ void daAlink_c::setCarryArmAngle(f32 param_0, f32 param_1) { field_0x3136[1].set(0, 0, temp_r29 - (3500.0f * param_1)); if (param_1 < 0.0f) { - field_0x312a[0].z += (s16)(2500.0f * param_1); - field_0x3136[0].y += (s16)(2000.0f * param_1); + ANGLE_ADD(field_0x312a[0].z, 2500.0f * param_1); + ANGLE_ADD(field_0x3136[0].y, 2000.0f * param_1); } else { - field_0x3136[0].y += (s16)(4000.0f * param_1); + ANGLE_ADD(field_0x3136[0].y, 4000.0f * param_1); } } else if (checkGrabRooster()) { field_0x3136[0].y = -5000.0f * param_1; diff --git a/src/d/actor/d_a_alink_guard.inc b/src/d/actor/d_a_alink_guard.inc index f2832f23e08..a238b98735f 100644 --- a/src/d/actor/d_a_alink_guard.inc +++ b/src/d/actor/d_a_alink_guard.inc @@ -330,7 +330,7 @@ int daAlink_c::procGuardSlip() { setShapeAngleToAtnActor(0); if (mProcVar1.field_0x300a != 0) { - mProcVar1.field_0x300a -= (s16)1; + S16_SUB(mProcVar1.field_0x300a, 1); mBodyAngle.y += mProcVar2.field_0x300c; mBodyAngle.x += mProcVar3.field_0x300e; } diff --git a/src/d/actor/d_a_alink_hang.inc b/src/d/actor/d_a_alink_hang.inc index 25d48a2d6df..2b6847a56a4 100644 --- a/src/d/actor/d_a_alink_hang.inc +++ b/src/d/actor/d_a_alink_hang.inc @@ -1835,8 +1835,8 @@ int daAlink_c::setMoveBGClimbCorrect() { current.pos.x = mLinkLinChk.GetCross().x; current.pos.z = mLinkLinChk.GetCross().z; - current.angle.y += (s16)(shape_angle.y - temp_r28); - field_0x308c += (s16)(temp_r28 - shape_angle.y); + ANGLE_ADD(current.angle.y, shape_angle.y - temp_r28); + ANGLE_ADD(field_0x308c, temp_r28 - shape_angle.y); mPolyInfo1.SetPolyInfo(mLinkLinChk); } diff --git a/src/d/actor/d_a_alink_hook.inc b/src/d/actor/d_a_alink_hook.inc index d4961480502..efcb3b8bc07 100644 --- a/src/d/actor/d_a_alink_hook.inc +++ b/src/d/actor/d_a_alink_hook.inc @@ -732,7 +732,7 @@ int daAlink_c::setHookshotHangMoveBGCollect() { mDoMtx_stack_c::multVec(&field_0x37c8, &mIronBallBgChkPos); current.pos += mIronBallBgChkPos - sp28; - shape_angle.y += (s16)(mProcVar0.field_0x3008 - carry_actor->shape_angle.y); + ANGLE_ADD(shape_angle.y, mProcVar0.field_0x3008 - carry_actor->shape_angle.y); current.angle.y = shape_angle.y; mProcVar0.field_0x3008 = carry_actor->shape_angle.y; } else if (dComIfG_Bgsp().ChkPolySafe(*polyinfo)) { diff --git a/src/d/actor/d_a_alink_horse.inc b/src/d/actor/d_a_alink_horse.inc index 2e40fd21c40..69cf4cfe577 100644 --- a/src/d/actor/d_a_alink_horse.inc +++ b/src/d/actor/d_a_alink_horse.inc @@ -1135,11 +1135,11 @@ void daAlink_c::boarForceGetOff() { void daAlink_c::horseGetOffEnd() { if (field_0x2fc0 == 0) { - shape_angle.y -= (s16)0x4000; + ANGLE_SUB(shape_angle.y, 0x4000); setOldRootQuaternion(0, 0x4000, 0); mDoMtx_stack_c::YrotS(-0x4000); } else { - shape_angle.y += (s16)0x4000; + ANGLE_ADD(shape_angle.y, 0x4000); setOldRootQuaternion(0, -0x4000, 0); mDoMtx_stack_c::YrotS(0x4000); } @@ -1587,7 +1587,7 @@ int daAlink_c::procHorseGetOff() { if (rideActor != NULL) { current.pos += rideActor->current.pos - field_0x37d4; field_0x37d4 = rideActor->current.pos; - shape_angle.y += (s16)(mProcVar3.field_0x300e - rideActor->shape_angle.y); + ANGLE_ADD(shape_angle.y, mProcVar3.field_0x300e - rideActor->shape_angle.y); mProcVar3.field_0x300e = rideActor->shape_angle.y; } @@ -2706,9 +2706,9 @@ int daAlink_c::procHorseRun() { if (horse->checkRodeoLeft()) { if (mProcVar3.field_0x300e != 0) { - mProcVar5.field_0x3012 -= (s16)150; + S16_SUB(mProcVar5.field_0x3012, 150); } else { - mProcVar5.field_0x3012 -= (s16)600; + S16_SUB(mProcVar5.field_0x3012, 600); } if (mProcVar2.field_0x300c == 0) { @@ -2716,9 +2716,9 @@ int daAlink_c::procHorseRun() { } } else { if (mProcVar3.field_0x300e != 0) { - mProcVar5.field_0x3012 += (s16)150; + S16_ADD(mProcVar5.field_0x3012, 150); } else { - mProcVar5.field_0x3012 += (s16)600; + S16_ADD(mProcVar5.field_0x3012, 600); } if (mProcVar2.field_0x300c == 0) { @@ -2744,7 +2744,7 @@ int daAlink_c::procHorseRun() { daPy_frameCtrl_c* framectrl = &mUnderFrameCtrl[0]; f32 temp_f31 = framectrl->getFrame() / framectrl->getEnd(); - mProcVar4.field_0x3010 = (field_0x3478 * (1.0f + cM_fsin((M_PI*2) * (temp_f31 - 0.69999999f)))) + (4000.0f * (1.0f - fabsf(0.000099999997f * mProcVar5.field_0x3012))); + mProcVar4.field_0x3010 = (field_0x3478 * (1.0f + cM_fsin((M_PI*2) * (temp_f31 - 0.7f)))) + (4000.0f * (1.0f - fabsf(0.0001f * mProcVar5.field_0x3012))); field_0x3088 = field_0x3478 * (1.0f + cM_fsin((M_PI*2) * (temp_f31 - 1.0f))); if (framectrl->checkPass(0.0f)) { diff --git a/src/d/actor/d_a_alink_hvyboots.inc b/src/d/actor/d_a_alink_hvyboots.inc index ccea1765f23..cd069c69f31 100644 --- a/src/d/actor/d_a_alink_hvyboots.inc +++ b/src/d/actor/d_a_alink_hvyboots.inc @@ -378,7 +378,7 @@ int daAlink_c::procMagneBootsFly() { cLib_addCalcAngleS(&shape_angle.x, sp24.atan2sY_XZ() + -0x4000, 5, 0x1000, 0x100); cLib_addCalcAngleS(&shape_angle.y, sp24.atan2sX_Z(), 5, 0x1000, 0x100); - mProcVar2.field_0x300c += (s16)0x1C00; + ANGLE_ADD(mProcVar2.field_0x300c, 0x1C00); } return 1; diff --git a/src/d/actor/d_a_alink_swim.inc b/src/d/actor/d_a_alink_swim.inc index 52773e9914e..986f3336a31 100644 --- a/src/d/actor/d_a_alink_swim.inc +++ b/src/d/actor/d_a_alink_swim.inc @@ -875,7 +875,7 @@ BOOL daAlink_c::checkSwimNeckUpDown() const { } void daAlink_c::setSwimUpDownOffset() { - mProcVar2.field_0x300c += (s16)((cM_rndF(0.3f) + 0.85f) * 2330.0f); + ANGLE_ADD(mProcVar2.field_0x300c, (cM_rndF(0.3f) + 0.85f) * 2330.0f); f32 var_f1; if (checkWolf()) { diff --git a/src/d/actor/d_a_alink_wolf.inc b/src/d/actor/d_a_alink_wolf.inc index f9e3fc4136b..6805311b9ea 100644 --- a/src/d/actor/d_a_alink_wolf.inc +++ b/src/d/actor/d_a_alink_wolf.inc @@ -1774,9 +1774,9 @@ void daAlink_c::wolfBgCheck() { if (field_0x2fa6 == 0 && !checkEndResetFlg1(ERFLG1_UNK_200000)) { s16 var_r27 = field_0x3092 - shape_angle.y; if (var_r27 <= 0) { - var_r27 += (s16)0x4000; + ANGLE_ADD(var_r27, 0x4000); } else { - var_r27 -= (s16)0x4000; + ANGLE_SUB(var_r27, 0x4000); } mPrevAngleY += var_r27; diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 920448ce24d..809dadb9944 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -357,7 +357,7 @@ void daArrow_c::clearNearActorData() { s16 daArrow_c::getVibAngle() { s16 angle; if (cLib_calcTimer(&field_0x952)) { - field_0x954 += (s16)(21243.0f - cM_rndF(4096.0f)); + ANGLE_ADD(field_0x954, 21243.0f - cM_rndF(4096.0f)); f32 f = field_0x952 * 0.02f; angle = f * 1024.0f * f * cM_ssin(field_0x954); diff --git a/src/d/actor/d_a_b_dr.cpp b/src/d/actor/d_a_b_dr.cpp index b9c5fc548ee..609ba1e94dc 100644 --- a/src/d/actor/d_a_b_dr.cpp +++ b/src/d/actor/d_a_b_dr.cpp @@ -2091,9 +2091,9 @@ bool daB_DR_c::mFeintBreath() { field_0x718++; } else { if (field_0x756 > 0) { - temp_r30 += (s16)(l_HIO.feint_angle * 0xB6); + ANGLE_ADD(temp_r30, l_HIO.feint_angle * 0xB6); } else { - temp_r30 -= (s16)(l_HIO.feint_angle * 0xB6); + ANGLE_SUB(temp_r30, l_HIO.feint_angle * 0xB6); } if (abs((s16)(current.angle.y - temp_r30)) > 0x100) { @@ -3327,7 +3327,8 @@ void daB_DR_c::executeBullet() { if (parentActorID != 0) { daB_DR_c* dr_p = (daB_DR_c*)fopAcM_SearchByID(fopAcM_GetLinkId(this)); if (dr_p != NULL) { - current.angle.y -= (s16)((s16)(dr_p->mHeadAngle.y - home.angle.y) * (0.002f + JREG_F(13))); + ANGLE_SUB(current.angle.y, + (s16)(dr_p->mHeadAngle.y - home.angle.y) * (0.002f + JREG_F(13))); } } @@ -3357,7 +3358,7 @@ void daB_DR_c::executeParts() { switch (mMoveMode) { case 0: speedF = 20.0f + ZREG_F(13) + cM_rndF(10.0f + ZREG_F(14)); - current.angle.y += (s16)cM_rndFX(65536.0f); + ANGLE_ADD(current.angle.y, cM_rndFX(65536.0f)); speed.y = 30.0f + ZREG_F(10); speed.y += cM_rndFX(10.0f + ZREG_F(11)); @@ -3396,11 +3397,11 @@ void daB_DR_c::executeParts() { case 10: speedF = 40.0f + ZREG_F(13) + cM_rndF(10.0f + ZREG_F(14)); mTimer[0] = 50; - current.angle.x += (s16)cM_rndFX(16384.0f); + ANGLE_ADD(current.angle.x, cM_rndFX(16384.0f)); mae = camera->lookat.center - current.pos; current.angle.y = mae.atan2sX_Z(); - current.angle.y += (s16)cM_rndFX(16384.0f); + ANGLE_ADD(current.angle.y, cM_rndFX(16384.0f)); cMtx_YrotS(*calc_mtx, current.angle.y); cMtx_XrotM(*calc_mtx, current.angle.x); diff --git a/src/d/actor/d_a_b_ds.cpp b/src/d/actor/d_a_b_ds.cpp index 88b5c8042a1..d817769dedb 100644 --- a/src/d/actor/d_a_b_ds.cpp +++ b/src/d/actor/d_a_b_ds.cpp @@ -590,7 +590,7 @@ void daB_DS_c::mZsMoveChk() { } angle_y = fopAcM_searchPlayerAngleY(this); - angle_y += (s16)cM_rndFX(0x2000); + ANGLE_ADD(angle_y, cM_rndFX(0x2000)); } if (!daPy_getPlayerActorClass()->checkSpinnerRide() || mAction == ACT_DAMAGE || @@ -1044,7 +1044,7 @@ void daB_DS_c::neck_set() { angl.x = -mae.atan2sY_XZ() * 2.0f; if (mAction == ACT_BREATH_ATTACK) { angl.x = mBh2AttackAngleF; - angl.x += (s16)(mBackboneLevel * 200); + ANGLE_ADD(angl.x, mBackboneLevel * 200); } if (angl.x > 0x2000) { @@ -5156,7 +5156,7 @@ int daB_DS_c::execute() { if (!mIsOpeningDemo) { s16 hand_x_ang_target = -6000; - hand_x_ang_target += (s16)(mBackboneLevel * 1000); + ANGLE_ADD(hand_x_ang_target, mBackboneLevel * 1000); if (handX_ang > -4000) { handX_ang = -4000; } @@ -5178,7 +5178,7 @@ int daB_DS_c::execute() { } if (jnt_pos.y < chk_pos.y) { - handL_ang += (s16)(fabsf(jnt_pos.y - chk_pos.y) * 10.0f); + ANGLE_ADD(handL_ang, fabsf(jnt_pos.y - chk_pos.y) * 10.0f); var_r25 = true; if (field_0x84d & 1) { @@ -5201,7 +5201,7 @@ int daB_DS_c::execute() { } if (jnt_pos.y < chk_pos.y) { - handR_ang += (s16)(fabsf(jnt_pos.y - chk_pos.y) * 10.0f); + ANGLE_ADD(handR_ang, fabsf(jnt_pos.y - chk_pos.y) * 10.0f); var_r25 = true; if (field_0x84d & 2) { if ((int)mpMorf->getFrame() >= 34 && (int)mpMorf->getFrame() < 41) { diff --git a/src/d/actor/d_a_b_gg.cpp b/src/d/actor/d_a_b_gg.cpp index 8623cdb422a..90a24c0150f 100644 --- a/src/d/actor/d_a_b_gg.cpp +++ b/src/d/actor/d_a_b_gg.cpp @@ -2905,7 +2905,7 @@ void daB_GG_c::G_DamageAction() { speedF = 0.0f; } - s_TargetAngle += (s16) 0x4000; + ANGLE_ADD(s_TargetAngle, 0x4000); break; case 2: cXyz* tg_hit_pos; @@ -3789,7 +3789,7 @@ void daB_GG_c::At_Check() { mAtInfo.mAttackPower = 80; } - health -= (s16)mAtInfo.mAttackPower; + S16_SUB(health, mAtInfo.mAttackPower); } int pause_time; diff --git a/src/d/actor/d_a_b_gnd.cpp b/src/d/actor/d_a_b_gnd.cpp index 6349ee995ab..ee80e287f2d 100644 --- a/src/d/actor/d_a_b_gnd.cpp +++ b/src/d/actor/d_a_b_gnd.cpp @@ -865,7 +865,7 @@ static void b_gnd_h_run_a(b_gnd_class* i_this) { i_this->field_0xc92 = cM_rndF(600.0f) + 300.0f; } - i_this->field_0x5cc += (s16)(var_f30 * cM_ssin(i_this->field_0xc90)); + ANGLE_ADD(i_this->field_0x5cc, var_f30 * cM_ssin(i_this->field_0xc90)); } if (i_this->field_0xc72 != 0) { diff --git a/src/d/actor/d_a_b_mgn.cpp b/src/d/actor/d_a_b_mgn.cpp index 8cb9ca1ae99..077ac211aa6 100644 --- a/src/d/actor/d_a_b_mgn.cpp +++ b/src/d/actor/d_a_b_mgn.cpp @@ -840,9 +840,9 @@ void daB_MGN_c::checkDownBeforeBG() { s16 var_r28 = (s16)cM_atan2s(var_r29->x, var_r29->z); if (abs((s16)(var_r28 - shape_angle.y)) > 0x5000) { if ((s16)(var_r28 - shape_angle.y) != 0) { - field_0xa92 -= (s16)0x300; + ANGLE_SUB(field_0xa92, 0x300); } else { - field_0xa92 += (s16)0x300; + ANGLE_ADD(field_0xa92, 0x300); } } } @@ -1546,9 +1546,9 @@ void daB_MGN_c::executeDash() { } if ((s16)(mAcchCir.GetWallAngleY() - shape_angle.y) < 0) { - shape_angle.y += (s16) 0x100; + ANGLE_ADD(shape_angle.y, 0x100); } else { - shape_angle.y += (s16) -0x100; + ANGLE_ADD(shape_angle.y, -0x100); } current.angle.y = shape_angle.y; diff --git a/src/d/actor/d_a_b_oh.cpp b/src/d/actor/d_a_b_oh.cpp index aded45eee35..69d2be6184c 100644 --- a/src/d/actor/d_a_b_oh.cpp +++ b/src/d/actor/d_a_b_oh.cpp @@ -256,7 +256,7 @@ static void attack(b_oh_class* i_this) { cLib_addCalcAngleS2(&i_this->field_0xca4, var3, 1, 500); if (i_this->mTimers[1] == 0 || i_this->mTimers[1] > 10) { - i_this->current.angle.y += (s16)(i_this->field_0xc88 * 300); + ANGLE_ADD(i_this->current.angle.y, i_this->field_0xc88 * 300); } if (i_this->mActionPhase == 2) { @@ -511,10 +511,10 @@ static void action(b_oh_class* i_this) { (-a_this->field_0x614 - a_this->field_0x60c) + cM_ssin(a_this->field_0x5cc * 200) * 100.0f; a_this->field_0x604 = ((100.0f - a_this->field_0x614) - a_this->field_0x60c) + cM_ssin(a_this->field_0x5cc * 200) * 100.0f; - a_this->field_0x5f8 += (s16)a_this->field_0x600; - a_this->field_0x5fa += (s16)a_this->field_0x604; + ANGLE_ADD(a_this->field_0x5f8, a_this->field_0x600); + ANGLE_ADD(a_this->field_0x5fa, a_this->field_0x604); a_this->field_0x5fc = a_this->field_0x60c + 2000.0f; - a_this->field_0x5f6 += (s16)a_this->field_0x5fc; + ANGLE_ADD(a_this->field_0x5f6, a_this->field_0x5fc); cLib_addCalc0(&a_this->field_0x60c, 0.1f, 50.0f); cLib_addCalc2(&a_this->field_0x610, 0.2f, 0.1f, 0.01f); diff --git a/src/d/actor/d_a_b_yo.cpp b/src/d/actor/d_a_b_yo.cpp index 70a7d423912..61f7610b591 100644 --- a/src/d/actor/d_a_b_yo.cpp +++ b/src/d/actor/d_a_b_yo.cpp @@ -1334,7 +1334,7 @@ void daB_YO_c::calcFreeMove(f32 param_0) { } void daB_YO_c::setReflectAngle() { - current.angle.y += (s16)cM_rndFX(4000.0f); + ANGLE_ADD(current.angle.y, cM_rndFX(4000.0f)); s16 angle_diff = current.angle.y - mWallAngle; if (abs(angle_diff) > 0x4800) { current.angle.y = mWallAngle * 2 - (current.angle.y + 0x8000); diff --git a/src/d/actor/d_a_boomerang.cpp b/src/d/actor/d_a_boomerang.cpp index 6a37355dba8..c51a648a59e 100644 --- a/src/d/actor/d_a_boomerang.cpp +++ b/src/d/actor/d_a_boomerang.cpp @@ -918,8 +918,8 @@ int daBoomerang_c::procWait() { } else { offStateFlg0(FLG0_10); } - - current.angle.y += (s16)0x1830; + + ANGLE_ADD(current.angle.y, 0x1830); shape_angle.x = current.angle.x; shape_angle.y = current.angle.y; shape_angle.z = 0x1000; diff --git a/src/d/actor/d_a_cow.cpp b/src/d/actor/d_a_cow.cpp index 2b12092989d..d4d7bff17bb 100644 --- a/src/d/actor/d_a_cow.cpp +++ b/src/d/actor/d_a_cow.cpp @@ -1237,16 +1237,16 @@ void daCow_c::action_run() { switch (mAction) { case daCow_c::Action_NadeNade: - SUB_ANGLE_2(targetAngle, 0x1000); + ANGLE_SUB_2(targetAngle, 0x1000); break; case daCow_c::Action_Cry: - ADD_ANGLE_2(targetAngle, 0x1000); + ANGLE_ADD_2(targetAngle, 0x1000); break; case daCow_c::Action_3: - SUB_ANGLE_2(targetAngle, 0x4000); + ANGLE_SUB_2(targetAngle, 0x4000); break; case daCow_c::Action_4: - ADD_ANGLE_2(targetAngle, 0x4000); + ANGLE_ADD_2(targetAngle, 0x4000); break; case daCow_c::Action_Wait: s16 cowshedAngle = getCowshedAngle(); @@ -2174,11 +2174,11 @@ void daCow_c::executeCrazyThrow() { if (mAction != daCow_c::Action_Wait) { setBck(daCow_c::Animation_DownR, J3DFrameCtrl::EMode_LOOP, 0.0f, 1.0f); - mSavedAngle.y -= (s16)0x7000; + ANGLE_SUB(mSavedAngle.y, 0x7000); mThrowIntensity = -1000; } else { setBck(daCow_c::Animation_DownL, J3DFrameCtrl::EMode_LOOP, 0.0f, 1.0f); - mSavedAngle.y += (s16)0x7000; + ANGLE_ADD(mSavedAngle.y, 0x7000); mThrowIntensity = 1000; } } diff --git a/src/d/actor/d_a_cstatue.cpp b/src/d/actor/d_a_cstatue.cpp index 57536d8c55d..6a1f0a126b7 100644 --- a/src/d/actor/d_a_cstatue.cpp +++ b/src/d/actor/d_a_cstatue.cpp @@ -1043,7 +1043,7 @@ void daCstatue_c::initStartBrkBtk() { for (int iParticle = 0; iParticle < 2; iParticle++) { dComIfGp_particle_set(0x88bb, &mBallPos, &angle, NULL); dComIfGp_particle_set(0x88bc, &mBallPos, &angle, NULL); - ADD_ANGLE_2(angle.y, 0x8000); + ANGLE_ADD_2(angle.y, 0x8000); } } diff --git a/src/d/actor/d_a_door_spiral.cpp b/src/d/actor/d_a_door_spiral.cpp index 133194549ad..b8830575ce0 100644 --- a/src/d/actor/d_a_door_spiral.cpp +++ b/src/d/actor/d_a_door_spiral.cpp @@ -418,7 +418,7 @@ void daSpiral_c::initProc(int param_0) { void daSpiral_c::initOpenDemo(int param_0) { shape_angle.y = current.angle.y; if (field_0x62c == 1) { - shape_angle.y += (s16)0x7FFF; + ANGLE_ADD(shape_angle.y, 0x7FFF); } mStaffId = dComIfGp_evmng_getMyStaffId("SHUTTER_DOOR", NULL, 0); @@ -559,7 +559,7 @@ int daSpiral_c::actionWait() { fopAc_ac_c* door = dComIfGp_event_getDoorPartner(); if (door == this) { shape_angle.y = current.angle.y; - shape_angle.y += (s16)0x7FFF; + ANGLE_ADD(shape_angle.y, 0x7FFF); mStaffId = dComIfGp_evmng_getMyStaffId("PARTNER_DOOR", NULL, 0); setAction(daSpiral_ACT_DEMO_e); eventInfo.setEventId(mEventIds[mDemoMode]); @@ -573,7 +573,7 @@ int daSpiral_c::actionWait() { mStaffId = dComIfGp_evmng_getMyStaffId("SHUTTER_DOOR", NULL, 0); shape_angle.y = current.angle.y; if (field_0x62c == 1) { - shape_angle.y += (s16)0x7FFF; + ANGLE_ADD(shape_angle.y, 0x7FFF); } setAction(daSpiral_ACT_DEMO_e); demoProc(); @@ -667,10 +667,10 @@ void daSpiral_c::setNextSpiral() { s16 pl_angle = (s16)door->current.angle.y; if (mType == daSpiral_TYPE_DOWN_e) { pl_pos = l_spiral_path_point_u[0]; - pl_angle += (s16)0x4000; + ANGLE_ADD(pl_angle, 0x4000); } else { pl_pos = l_spiral_path_point_d[0]; - pl_angle -= (s16)0x4000; + ANGLE_SUB(pl_angle, 0x4000); } mDoMtx_stack_c::transS(door->current.pos.x, door->current.pos.y, door->current.pos.z); @@ -829,7 +829,7 @@ void daSpiral_c::debugDraw() { s16 var_r25 = current.angle.y; if (field_0x62c == 1) { - var_r25 += (s16)0x7FFF; + ANGLE_ADD(var_r25, 0x7FFF); } mDoMtx_stack_c::YrotS(var_r25); @@ -1083,7 +1083,7 @@ void dSpiral_stop_c::calcMtx(daSpiral_c* i_spiral) { s16 angle = i_spiral->current.angle.y; if (field_0x72 == 1) { - angle += (s16)0x7FFF; + ANGLE_ADD(angle, 0x7FFF); } mDoMtx_stack_c::transS(pos.x, pos.y, pos.z); diff --git a/src/d/actor/d_a_e_arrow.cpp b/src/d/actor/d_a_e_arrow.cpp index 9827237349a..dc5a0c4d314 100644 --- a/src/d/actor/d_a_e_arrow.cpp +++ b/src/d/actor/d_a_e_arrow.cpp @@ -200,10 +200,10 @@ static void hit_check(e_arrow_class* i_this) { i_this->speedF *= 0.3f; if (i_this->mCcTgSph.ChkTgHit()) { - i_this->current.angle.y += (s16)(cM_rndFX(8000.0f) + 32768.0f); + ANGLE_ADD(i_this->current.angle.y, cM_rndFX(8000.0f) + 32768.0f); i_this->mSound.startSound(Z2SE_COL_FLIP_ARROW, 0, -1); } else { - i_this->current.angle.y += (s16)(cM_rndFX(4000.0f) + 32768.0f); + ANGLE_ADD(i_this->current.angle.y, cM_rndFX(4000.0f) + 32768.0f); } dKy_Sound_set(i_this->current.pos, 3, fopAcM_GetID(i_this), 10); @@ -470,7 +470,7 @@ static void e_arrow_demo_bound(e_arrow_class* i_this) { } if (i_this->field_0xa0c > 0) { - a_this->shape_angle.x += (s16)i_this->field_0xa10; + ANGLE_ADD(a_this->shape_angle.x, i_this->field_0xa10); if (a_this->shape_angle.x > i_this->field_0xa0c || a_this->shape_angle.x < (s16)-i_this->field_0xa0c) diff --git a/src/d/actor/d_a_e_bee.cpp b/src/d/actor/d_a_e_bee.cpp index d0f182031da..f668842d7f9 100644 --- a/src/d/actor/d_a_e_bee.cpp +++ b/src/d/actor/d_a_e_bee.cpp @@ -497,7 +497,7 @@ static void bee_control(e_bee_class* i_this) { } else { daPy_py_c* player = daPy_getPlayerActorClass(); if (cc_pl_cut_bit_get() == 0x80) { - i_this->mBoomerangAngle += (s16)0x1400; + ANGLE_ADD(i_this->mBoomerangAngle, 0x1400); vec1.z = 150.0f + TREG_F(15); } else { vec1.z = 100.0f + TREG_F(12); diff --git a/src/d/actor/d_a_e_bg.cpp b/src/d/actor/d_a_e_bg.cpp index c0363529c6e..1f1514bed6d 100644 --- a/src/d/actor/d_a_e_bg.cpp +++ b/src/d/actor/d_a_e_bg.cpp @@ -1227,11 +1227,11 @@ int daE_BG_c::execute() { mIsBomb = true; if (field_0x694 < 30) { - field_0x698 += (s16)0x1000; + ANGLE_ADD(field_0x698, 0x1000); } else if (field_0x694 < 45) { - field_0x698 += (s16)0x800; + ANGLE_ADD(field_0x698, 0x800); } else { - field_0x698 += (s16)0x300; + ANGLE_ADD(field_0x698, 0x300); } if (field_0x694 == 0) { diff --git a/src/d/actor/d_a_e_bi.cpp b/src/d/actor/d_a_e_bi.cpp index e6eb59aeb38..c93217979a8 100644 --- a/src/d/actor/d_a_e_bi.cpp +++ b/src/d/actor/d_a_e_bi.cpp @@ -373,13 +373,13 @@ static void e_bi_ex(e_bi_class* i_this) { if (i_this->ignition_time != 0) { i_this->ignition_time--; i_this->sound.startCreatureSoundLevel(Z2SE_OBJ_BOMB_IGNITION, 0, -1); - i_this->field_0x696 += (s16) 0x1100; + ANGLE_ADD(i_this->field_0x696, 0x1100); if (i_this->ignition_time < 45) { - i_this->field_0x696 += (s16) 0x1100; + ANGLE_ADD(i_this->field_0x696, 0x1100); if (i_this->ignition_time < 30) { - i_this->field_0x696 += (s16) 0x1100; + ANGLE_ADD(i_this->field_0x696, 0x1100); } } diff --git a/src/d/actor/d_a_e_bu.cpp b/src/d/actor/d_a_e_bu.cpp index d636a9be5d3..4809b36b200 100644 --- a/src/d/actor/d_a_e_bu.cpp +++ b/src/d/actor/d_a_e_bu.cpp @@ -628,7 +628,7 @@ static s8 e_bu_head(e_bu_class* i_this) { actor->speedF *= 0.5f; actor->speed.y = 30.0f; i_this->mode = 2; - i_this->head_rot_y += (s16)cM_rndFX(10000.0f); + ANGLE_ADD(i_this->head_rot_y, cM_rndFX(10000.0f)); if (cM_rndF(1.0f) < 0.5f) { i_this->field_0x6bc = 0x4000; @@ -641,7 +641,7 @@ static s8 e_bu_head(e_bu_class* i_this) { } break; case 2: - i_this->head_rot_x += (s16)(actor->speedF * (400.0f + AREG_F(1))); + ANGLE_ADD(i_this->head_rot_x, actor->speedF * (400.0f + AREG_F(1))); if (!i_this->acch.ChkGroundHit()) { break; @@ -650,7 +650,7 @@ static s8 e_bu_head(e_bu_class* i_this) { i_this->mode = 3; actor->speed.y = 20.0f; case 3: - i_this->head_rot_x += (s16)(actor->speedF * (400.0f + AREG_F(1))); + ANGLE_ADD(i_this->head_rot_x, actor->speedF * (400.0f + AREG_F(1))); i_this->head_rot_y += i_this->field_0x6b8; cLib_addCalc2(&actor->speedF, 10.0f, 1.0f, 2.0f + TREG_F(16)); @@ -705,7 +705,7 @@ static s8 e_bu_head(e_bu_class* i_this) { i_this->mode = 0; anm_init(i_this, 7, 10.0f, 2, 1.0f + cM_rndF(0.1f)); } else { - actor->current.angle.y += (s16)cM_rndFX(8000.0f); + ANGLE_ADD(actor->current.angle.y, cM_rndFX(8000.0f)); i_this->mode = 11; actor->speed.y = JREG_F(7) + (20.0f + cM_rndF(10.0f)); actor->speedF = 10.0f + cM_rndF(10.0f); diff --git a/src/d/actor/d_a_e_bug.cpp b/src/d/actor/d_a_e_bug.cpp index d31174a14e7..c58787169d8 100644 --- a/src/d/actor/d_a_e_bug.cpp +++ b/src/d/actor/d_a_e_bug.cpp @@ -517,7 +517,7 @@ static void normal_move(e_bug_class* a_this, bug_s* i_this) { cLib_addCalcAngleS2(&i_this->field_0x3c.y, i_this->field_0x42 + (sVar1 + cM_atan2s(sp74.x, sp74.z)), 2, 0x800); i_this->field_0x3c.x = 0; } else { - i_this->field_0x3c.x += (s16)((i_this->field_0x8 << 1) + 0xE00); + ANGLE_ADD(i_this->field_0x3c.x, (i_this->field_0x8 << 1) + 0xE00); } i_this->field_0x30.x = i_this->field_0x24 * cM_ssin(i_this->field_0x3c.y); diff --git a/src/d/actor/d_a_e_dn.cpp b/src/d/actor/d_a_e_dn.cpp index 794458bbe61..a4c76df7cc2 100644 --- a/src/d/actor/d_a_e_dn.cpp +++ b/src/d/actor/d_a_e_dn.cpp @@ -874,7 +874,7 @@ static void e_dn_normal(e_dn_class* i_this) { /* Calculate how much the actor turned */ angle -= actor->current.angle.y; /* Scale turn strength */ - angle *= (s16)(YREG_S(5) + 2); + ANGLE_MULT(angle, YREG_S(5) + 2); /* Ensure the targeted angle is no more than ±22.5° */ s16 max_turn = YREG_S(6) + 0x1000; @@ -957,7 +957,7 @@ static void e_dn_wolfbite(e_dn_class* i_this) { anm_init(i_this, ANM_HANGED, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f); i_this->mode = 1; i_this->sound.startCreatureVoice(Z2SE_EN_DN_V_DRAWBACK, -1); - actor->health -= (s16)10; + S16_SUB(actor->health, 10); break; case 1: @@ -977,7 +977,7 @@ static void e_dn_wolfbite(e_dn_class* i_this) { if (actor->health <= 0 || actor->checkWolfBiteDamage()) { actor->offWolfBiteDamage(); anm_init(i_this, ANM_HANGED_DAMAGE, 2.0f, J3DFrameCtrl::EMode_NONE, 1.0f); - actor->health -= (s16)10; + S16_SUB(actor->health, 10); if (actor->health <= 0) { player->offWolfEnemyHangBite(); i_this->field_0x750 = (actor->shape_angle.y - 0x8000) - player->shape_angle.y; @@ -1167,7 +1167,7 @@ static void e_dn_fight_run(e_dn_class* i_this) { sVar1 -= actor->shape_angle.y; } - sVar1 *= (s16)(YREG_S(5) + 2); + ANGLE_MULT(sVar1, YREG_S(5) + 2); s16 sVar4 = YREG_S(6) + 0x1000; if (sVar1 > sVar4) { sVar1 = sVar4; @@ -1505,7 +1505,7 @@ static void e_dn_attack(e_dn_class* i_this) { sVar1 = actor->current.angle.y; cLib_addCalcAngleS2(&actor->current.angle.y, i_this->search_angle_y, 2, 0x800); sVar1 -= actor->current.angle.y; - sVar1 *= (s16)(YREG_S(5) + 2); + ANGLE_MULT(sVar1, YREG_S(5) + 2); s16 sVar3 = YREG_S(6) + 0x1000; if (sVar1 > sVar3) { sVar1 = sVar3; @@ -1950,7 +1950,7 @@ static void e_dn_damage(e_dn_class* i_this) { case 3: if (body_gake(i_this)) { i_this->field_0x704 = VREG_F(8) + -20.0f; - i_this->field_0x724.x -= (s16)(VREG_S(7) + 0x300); + ANGLE_SUB(i_this->field_0x724.x, VREG_S(7) + 0x300); } if (actor->health <= 0 && i_this->timer[1] == 0) { diff --git a/src/d/actor/d_a_e_fk.cpp b/src/d/actor/d_a_e_fk.cpp index 8a3c406c3dd..9c28c359c6a 100644 --- a/src/d/actor/d_a_e_fk.cpp +++ b/src/d/actor/d_a_e_fk.cpp @@ -613,7 +613,7 @@ void daE_FK_c::At_Check(int i_sphIdx) { } if ((s16)mAtInfo.mAttackPower > 0) { - health -= (s16)mAtInfo.mAttackPower; + S16_SUB(health, mAtInfo.mAttackPower); } int unk_r29 = 0; diff --git a/src/d/actor/d_a_e_fm.cpp b/src/d/actor/d_a_e_fm.cpp index 3dae088fbdf..959d733b953 100644 --- a/src/d/actor/d_a_e_fm.cpp +++ b/src/d/actor/d_a_e_fm.cpp @@ -2756,7 +2756,7 @@ static void action(e_fm_class* i_this) { for (int i = 0; i < create_num; i++) { fopAcM_createChild(PROC_E_BA, fopAcM_GetID(actor), 0xFFFF1F02, &actor->eyePos, fopAcM_GetRoomNo(actor), &rot, NULL, -1, NULL); - rot.y += (s16)(0x10000 / create_num); + ANGLE_ADD(rot.y, 0x10000 / create_num); } } diff --git a/src/d/actor/d_a_e_gb.cpp b/src/d/actor/d_a_e_gb.cpp index e3aff4c735b..747ac44ec9b 100644 --- a/src/d/actor/d_a_e_gb.cpp +++ b/src/d/actor/d_a_e_gb.cpp @@ -396,9 +396,9 @@ static void e_gb_damage(e_gb_class* i_this) { case 0: i_this->mode = 1; if ((s16)(i_this->angleYTarget - actor->current.angle.y) < 0) { - actor->current.angle.y += (s16)(KREG_S(6) + 0x2000); + ANGLE_ADD(actor->current.angle.y, KREG_S(6) + 0x2000); } else { - actor->current.angle.y -= (s16)(KREG_S(6) + 0x2000); + ANGLE_SUB(actor->current.angle.y, KREG_S(6) + 0x2000); } cMtx_YrotS(*calc_mtx, actor->current.angle.y); @@ -871,7 +871,7 @@ static void action(e_gb_class* i_this) { i_this->xRot = i_this->field_0x94c * cM_scos((s16)i_this->field_0x94a); } - i_this->field_0x94a += (s16)(10000 + VREG_S(2)); + ANGLE_ADD(i_this->field_0x94a, 10000 + VREG_S(2)); cLib_addCalc0(&i_this->field_0x94c, 1.0f, VREG_F(2) + 150.0f); } else { i_this->xRot = 0; @@ -1449,7 +1449,7 @@ static int daE_GB_Execute(e_gb_class* i_this) { if (i_this->field_0x670 == 1) { i_this->keyPos.y += i_this->field_0x680; i_this->field_0x680 -= 3.0f; - i_this->keyXRot += (s16)-0xC00; + ANGLE_ADD(i_this->keyXRot, -0xC00); if (i_this->keyPos.y < actor->home.pos.y) { i_this->keyXRot = 0; diff --git a/src/d/actor/d_a_e_ge.cpp b/src/d/actor/d_a_e_ge.cpp index f0784578d85..ba9816f8c53 100644 --- a/src/d/actor/d_a_e_ge.cpp +++ b/src/d/actor/d_a_e_ge.cpp @@ -1013,7 +1013,7 @@ void daE_GE_c::executeWind() { } cXyz boomerangPos2(daPy_py_c::getThrowBoomerangActor()->current.pos); - field_0xb8c += (s16)0x800; + ANGLE_ADD(field_0xb8c, 0x800); current.pos.x = boomerangPos2.x + field_0xb58 * cM_ssin(field_0xb8c); current.pos.z = boomerangPos2.z + field_0xb58 * cM_scos(field_0xb8c); cLib_chaseF(&field_0xb58, field_0xb60, 2.0f); diff --git a/src/d/actor/d_a_e_hm.cpp b/src/d/actor/d_a_e_hm.cpp index f6a473fe11e..7dcd7c5317a 100644 --- a/src/d/actor/d_a_e_hm.cpp +++ b/src/d/actor/d_a_e_hm.cpp @@ -395,7 +395,7 @@ int daE_HM_c::W_MoveCheckWall() { dComIfG_Bgsp().GetTriPla(linChk, &plane1); if (!dComIfG_Bgsp().GetMagnetCode(linChk)) { - field_0x5b4 += (s16)0x200; + ANGLE_ADD(field_0x5b4, 0x200); return 1; } @@ -438,7 +438,7 @@ int daE_HM_c::W_WallCheck() { cM3dGPla plane; dComIfG_Bgsp().GetTriPla(linChk, &plane); if (!dComIfG_Bgsp().GetMagnetCode(linChk)) { - field_0x5b4 += (s16)0x200; + ANGLE_ADD(field_0x5b4, 0x200); return 1; } } @@ -841,7 +841,7 @@ void daE_HM_c::DeathMotion() { f32 frame = mAnm_p->getFrame(); if (mAcch.ChkGroundHit() && (field_0x5da++, field_0x5da) == 1) { speed.y = yREG_F(11) + 35.0f; - current.angle.y -= (s16)0x1000; + ANGLE_SUB(current.angle.y, 0x1000); SetAnm(8, 0, nREG_F(9) + 1.0f, nREG_F(12) + 1.0f); mAnm_p->setPlaySpeed(yREG_F(12) + 2.0f); } @@ -1075,7 +1075,7 @@ void daE_HM_c::At_Check() { } if ((s16)mAtInfo.mAttackPower > 0) { - health -= (s16)mAtInfo.mAttackPower; + S16_SUB(health, mAtInfo.mAttackPower); } s8 unkByte1 = 0; diff --git a/src/d/actor/d_a_e_hz.cpp b/src/d/actor/d_a_e_hz.cpp index ca896091f43..258b7fb7cf6 100644 --- a/src/d/actor/d_a_e_hz.cpp +++ b/src/d/actor/d_a_e_hz.cpp @@ -463,7 +463,7 @@ void daE_HZ_c::executeWait() { case 4: target = home.pos.y + 30.0f; if (cLib_chaseF(¤t.pos.y, target, 5.0f)) { - field_0x6b4 += (s16)0x800; + ANGLE_ADD(field_0x6b4, 0x800); current.pos.y += cM_ssin(field_0x6b4) * 1.5f; cLib_chaseAngleS(&shape_angle.y, mPlayerAngleY, 0x400); } @@ -896,7 +896,7 @@ void daE_HZ_c::executeWind() { } current.pos.y += frame; - shape_angle.y -= (s16)0x7D0; + ANGLE_SUB(shape_angle.y, 0x7D0); if (mpMorfSO->checkFrame(field_0x6cc) || mpBoomerangActor == NULL || mpBoomerangActor->getReturnFlg()) @@ -962,7 +962,7 @@ void daE_HZ_c::executeWind() { return; } - field_0x6b2 += (s16)0x800; + ANGLE_ADD(field_0x6b2, 0x800); linChk.Set(¤t.pos, &position, NULL); if (!dComIfG_Bgsp().LineCross(&linChk)) { cLib_chaseF(¤t.pos.x, position.x + field_0x678.x * cM_ssin(field_0x6b2), 50.0f); @@ -991,7 +991,7 @@ void daE_HZ_c::executeWind() { cLib_chaseAngleS(&shape_angle.x, -0x8000, 0x400); } - shape_angle.y -= (s16)l_HIO.reeling_rotation_speed; + ANGLE_SUB(shape_angle.y, l_HIO.reeling_rotation_speed); break; case 4: @@ -1277,7 +1277,7 @@ void daE_HZ_c::executeWindChance() { } end = mpBoomerangActor->current.pos; - field_0x6b6 += (s16)0x800; + ANGLE_ADD(field_0x6b6, 0x800); start = current.pos; start.y += 50.0f; linChk.Set(&start, &end, NULL); @@ -1296,7 +1296,7 @@ void daE_HZ_c::executeWindChance() { } shape_angle.y -= field_0x6b2; - field_0x6b4 += (s16)0x1000; + ANGLE_ADD(field_0x6b4, 0x1000); shape_angle.x = (s16)(cM_scos(field_0x6b4) * 6144.0f); break; @@ -1307,12 +1307,12 @@ void daE_HZ_c::executeWindChance() { cLib_chaseAngleS(&field_0x6b2, 0, 0x100); cLib_chaseAngleS(&field_0x6b6, 0, 0x200); shape_angle.y -= field_0x6b2; - field_0x6b4 += (s16)0x1000; + ANGLE_ADD(field_0x6b4, 0x1000); shape_angle.x = (s16)(field_0x6b6 * cM_scos(field_0x6b4)); - + if (mWaitTimer == 0) { if (mPiyoriTimer != 0) { - mPiyoriTimer += (s16)20; + S16_ADD(mPiyoriTimer, 20); } setActionMode(ACTION_CHANCE); diff --git a/src/d/actor/d_a_e_mk_bo.cpp b/src/d/actor/d_a_e_mk_bo.cpp index 8d4c430fa76..8cd027d63b3 100644 --- a/src/d/actor/d_a_e_mk_bo.cpp +++ b/src/d/actor/d_a_e_mk_bo.cpp @@ -516,7 +516,7 @@ static void action(e_mk_bo_class* i_this) { sound = Z2SE_EN_MK_BOOM_FLY; } - actor->shape_angle.y += (s16) 0x2000; + ANGLE_ADD(actor->shape_angle.y, 0x2000); if ((i_this->counter & 7) == 0) { i_this->sound.startSound(sound, 0, -1); diff --git a/src/d/actor/d_a_e_mm_mt.cpp b/src/d/actor/d_a_e_mm_mt.cpp index 92d02f20fcc..cec4a232a30 100644 --- a/src/d/actor/d_a_e_mm_mt.cpp +++ b/src/d/actor/d_a_e_mm_mt.cpp @@ -313,7 +313,7 @@ static void e_mm_mt_drop(e_mm_mt_class* i_this) { if (wall_angle != 0x23) { wall_angle = i_this->enemy.current.angle.y - wall_angle; i_this->m_spin = wall_angle * (TREG_F(6) + -0.3f); - i_this->enemy.current.angle.y += (s16)(0x8000 - (wall_angle << 1)); + ANGLE_ADD(i_this->enemy.current.angle.y, 0x8000 - (wall_angle << 1)); if (i_this->m_acch.ChkWaterHit()) { mDoAud_seStart(Z2SE_EN_MM_MET_BOUND_WTR, &i_this->enemy.current.pos, (u32)(i_this->enemy.speed.y), 0); } else { @@ -489,7 +489,7 @@ static void action(e_mm_mt_class* i_this) { s16 playerAngleY = fopAcM_searchPlayerAngleY(actor); s16 playerAngleDelta = i_this->m_rotation.y - playerAngleY; if (playerAngleDelta > 0x4000 || playerAngleDelta < -0x4000) { - playerAngleY += (s16)0x8000; + ANGLE_ADD(playerAngleY, 0x8000); } cLib_addCalcAngleS2(&i_this->m_rotation.y, playerAngleY, 4, 0x100); } diff --git a/src/d/actor/d_a_e_nest.cpp b/src/d/actor/d_a_e_nest.cpp index 9da31111fd8..2b5a540bbef 100644 --- a/src/d/actor/d_a_e_nest.cpp +++ b/src/d/actor/d_a_e_nest.cpp @@ -416,7 +416,7 @@ static void e_nest_drop(e_nest_class* i_this) { if (wall_angle != 0x23) { s16 angle_delta = i_this->current.angle.y - wall_angle; i_this->mSpin = angle_delta * -0.3f; - i_this->current.angle.y += (s16)(0x8000 - (angle_delta << 1)); + ANGLE_ADD(i_this->current.angle.y, 0x8000 - (angle_delta << 1)); i_this->speedF *= 0.5f; i_this->mTimers[1] = 10; i_this->mSound.startSound(Z2SE_OBJ_HACHINOSU_BOUND, 0, -1); diff --git a/src/d/actor/d_a_e_oc.cpp b/src/d/actor/d_a_e_oc.cpp index 1c1f4c483c5..248d48c1972 100644 --- a/src/d/actor/d_a_e_oc.cpp +++ b/src/d/actor/d_a_e_oc.cpp @@ -714,17 +714,17 @@ void daE_OC_c::damage_check() { } else if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_IRON_BALL)) { my_val = 5; if (dComIfGp_checkPlayerStatus0(0,0x400)) { - health += (s16) 140; + S16_ADD(health, 140); } else { - health += (s16) 80; + S16_ADD(health, 80); } } else if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_BOOMERANG)) { my_val = 4; } else if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_40)) { - health += (s16) 10; + S16_ADD(health, 10); } else if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_SLINGSHOT)) { if (mName == "E_OC") { - health -= (s16) 5; + S16_SUB(health, 5); if (health < 0) { health = 0; mSound.startCollisionSE(0x40007,0x20); diff --git a/src/d/actor/d_a_e_ot.cpp b/src/d/actor/d_a_e_ot.cpp index e4849ccad63..0da17665533 100644 --- a/src/d/actor/d_a_e_ot.cpp +++ b/src/d/actor/d_a_e_ot.cpp @@ -280,9 +280,9 @@ void daE_OT_c::executeEgg() { speed.y = 50.0f + cM_rndFX(10.0f); current.angle.y = mpToadActor->shape_angle.y; if (mChildNo < 5 || (mChildNo >= 10 && mChildNo < 15)) { - current.angle.y += (s16)(0x4000 + cM_rndFX(0x1000)); + ANGLE_ADD(current.angle.y, 0x4000 + cM_rndFX(0x1000)); } else { - current.angle.y += (s16)(-0x4000 + cM_rndFX(0x1000)); + ANGLE_ADD(current.angle.y, -0x4000 + cM_rndFX(0x1000)); } } diff --git a/src/d/actor/d_a_e_ph.cpp b/src/d/actor/d_a_e_ph.cpp index 63365ee1ce9..e2d853a1a80 100644 --- a/src/d/actor/d_a_e_ph.cpp +++ b/src/d/actor/d_a_e_ph.cpp @@ -617,9 +617,9 @@ void daE_PH_c::StopAction() { switch (mCAction) { case 0: if (mAnmID == ANM_HANG_WAIT || mAnmID == ANM_HANG_START) { - mHeadRotX += (s16)(field_0x612 + 0x1000); + ANGLE_ADD(mHeadRotX, field_0x612 + 0x1000); } else { - mHeadRotX += (s16)(field_0x612 + 0x500); + ANGLE_ADD(mHeadRotX, field_0x612 + 0x500); } mSound.startCreatureSoundLevel(Z2SE_EN_PH_PROPELLER, field_0x612 + 0x500, -1); diff --git a/src/d/actor/d_a_e_pm.cpp b/src/d/actor/d_a_e_pm.cpp index 56041078cee..39c86f914ad 100644 --- a/src/d/actor/d_a_e_pm.cpp +++ b/src/d/actor/d_a_e_pm.cpp @@ -2452,7 +2452,7 @@ void daE_PM_c::At_Check() { } if ((s16)mAtInfo.mAttackPower > 0) { - health -= (s16)mAtInfo.mAttackPower; + S16_SUB(health, mAtInfo.mAttackPower); } u32 pause_timer = 0; diff --git a/src/d/actor/d_a_e_po.cpp b/src/d/actor/d_a_e_po.cpp index 04e8bf0ff8b..8b500de1b89 100644 --- a/src/d/actor/d_a_e_po.cpp +++ b/src/d/actor/d_a_e_po.cpp @@ -1864,21 +1864,21 @@ static void e_po_holl_demo(e_po_class* i_this) { i_this->field_0x7DE += 1; i_this->field_0x7E2 += 1; if (mArg0Check(i_this, 7) != 0) { - a_this->current.angle.x += (s16)(400.0f * cM_ssin(1000.0f * i_this->field_0x7DE)); - a_this->current.angle.y += (s16)(500.0f * cM_scos(1000.0f * i_this->field_0x7E2)); - a_this->current.angle.z += (s16)(500.0f * -cM_scos(1000.0f * i_this->field_0x7E2)); + ANGLE_ADD(a_this->current.angle.x, 400.0f * cM_ssin(1000.0f * i_this->field_0x7DE)); + ANGLE_ADD(a_this->current.angle.y, 500.0f * cM_scos(1000.0f * i_this->field_0x7E2)); + ANGLE_ADD(a_this->current.angle.z, 500.0f * -cM_scos(1000.0f * i_this->field_0x7E2)); } else if (mArg0Check(i_this, 8) != 0) { - a_this->current.angle.x += (s16)(-400.0f * cM_ssin(1000.0f * i_this->field_0x7DE)); - a_this->current.angle.y += (s16)(500.0f * cM_scos(1000.0f * i_this->field_0x7E2)); - a_this->current.angle.z += (s16)(500.0f * -cM_scos(1000.0f * i_this->field_0x7E2)); + ANGLE_ADD(a_this->current.angle.x, -400.0f * cM_ssin(1000.0f * i_this->field_0x7DE)); + ANGLE_ADD(a_this->current.angle.y, 500.0f * cM_scos(1000.0f * i_this->field_0x7E2)); + ANGLE_ADD(a_this->current.angle.z, 500.0f * -cM_scos(1000.0f * i_this->field_0x7E2)); } else if (mArg0Check(i_this, 9) != 0) { - a_this->current.angle.x -= (s16)(200.0f * cM_ssin(1000.0f * i_this->field_0x7DE)); - a_this->current.angle.y -= (s16)(1000.0f * cM_scos(1000.0f * i_this->field_0x7E2)); - a_this->current.angle.z -= (s16)(500.0f * -cM_scos(1000.0f * i_this->field_0x7E2)); + ANGLE_SUB(a_this->current.angle.x, 200.0f * cM_ssin(1000.0f * i_this->field_0x7DE)); + ANGLE_SUB(a_this->current.angle.y, 1000.0f * cM_scos(1000.0f * i_this->field_0x7E2)); + ANGLE_SUB(a_this->current.angle.z, 500.0f * -cM_scos(1000.0f * i_this->field_0x7E2)); } else { - a_this->current.angle.x -= (s16)(100.0f * cM_ssin(1000.0f * i_this->field_0x7DE)); - a_this->current.angle.y -= (s16)(100.0f * cM_scos(1000.0f * i_this->field_0x7E2)); - a_this->current.angle.z -= (s16)(500.0f * -cM_scos(1000.0f * i_this->field_0x7E2)); + ANGLE_SUB(a_this->current.angle.x, 100.0f * cM_ssin(1000.0f * i_this->field_0x7DE)); + ANGLE_SUB(a_this->current.angle.y, 100.0f * cM_scos(1000.0f * i_this->field_0x7E2)); + ANGLE_SUB(a_this->current.angle.z, 500.0f * -cM_scos(1000.0f * i_this->field_0x7E2)); } if (i_this->field_0x74A[2] != 0) { break; diff --git a/src/d/actor/d_a_e_rb.cpp b/src/d/actor/d_a_e_rb.cpp index bf8e917245c..c34dddbd434 100644 --- a/src/d/actor/d_a_e_rb.cpp +++ b/src/d/actor/d_a_e_rb.cpp @@ -626,7 +626,7 @@ static void e_rb_base_1(e_rb_class* i_this) { } if (i_this->field_0xa64 != 0) { - i_this->field_0xa4e += (s16)(AREG_S(6) + 300); + ANGLE_ADD(i_this->field_0xa4e, AREG_S(6) + 300); } return; } diff --git a/src/d/actor/d_a_e_rd.cpp b/src/d/actor/d_a_e_rd.cpp index 98e8ce700af..92a2d12f15e 100644 --- a/src/d/actor/d_a_e_rd.cpp +++ b/src/d/actor/d_a_e_rd.cpp @@ -1038,7 +1038,7 @@ static BOOL way_check(e_rd_class* i_this) { dBgS_LinChk lin_chk; lin_chk.Set(&start, &end, a_this); if (dComIfG_Bgsp().LineCross(&lin_chk)) { - sVar1 += (s16) 0x1000; + ANGLE_ADD(sVar1, 0x1000); } else { i_this->field_0x5cc = sVar1; return TRUE; @@ -1581,7 +1581,7 @@ static void e_rd_bow_run(e_rd_class* i_this) { case 1: fVar1 = fVar2; - ADD_ANGLE_2(playerAngleY, 0x8000); + ANGLE_ADD_2(playerAngleY, 0x8000); if (i_this->mPlayerDistance > l_HIO.attack_range || i_this->field_0x990[0] == 0 || i_this->mObjAcch.ChkWallHit() || move_gake_check(i_this, 100.0f)) { bVar1 = 1; } @@ -2608,7 +2608,7 @@ static void e_rd_bomb_action(e_rd_class* i_this) { } } - ADD_ANGLE_2(sVar1, 0x8000); + ANGLE_ADD_2(sVar1, 0x8000); fVar1 = l_HIO.dash_speed; if (JMAFastSqrt(sp48.x * sp48.x + sp48.z * sp48.z) > 600.0f) { i_this->mMode = 3; @@ -2879,10 +2879,10 @@ static void e_rd_damage(e_rd_class* i_this) { OS_REPORT(" ..KADO KABE ..%x\n", kado_kabe); if (kado_kabe == 2) { i_this->field_0x9f6 = 0x1000; - i_this->field_0xa0c.y += (s16) (TREG_S(8) - 7000); + ANGLE_ADD(i_this->field_0xa0c.y, TREG_S(8) - 7000); } else { i_this->field_0x9f6 = -0x1000; - i_this->field_0xa0c.y += (s16) -(TREG_S(8) - 7000); + ANGLE_ADD(i_this->field_0xa0c.y, -(TREG_S(8) - 7000)); } i_this->field_0xab8 = 8000.0f + BREG_F(10); @@ -2895,7 +2895,7 @@ static void e_rd_damage(e_rd_class* i_this) { i_this->mMode = 10; a_this->speed.y = 0.0f; i_this->field_0x9ec *= 0.2f; - ADD_ANGLE_2(i_this->field_0xa0c.y, 0x8000); + ANGLE_ADD_2(i_this->field_0xa0c.y, 0x8000); i_this->field_0xaf0 = 5 + BREG_S(7); i_this->field_0xa24 = 100.0f + BREG_F(4); i_this->field_0xa2c = 100.0f + BREG_F(5); @@ -3163,7 +3163,7 @@ static s16 gake_check(e_rd_class* i_this, f32 param_2) { } } - sVar1 += (s16) 0x1000; + ANGLE_ADD(sVar1, 0x1000); } return a_this->shape_angle.y; @@ -5322,7 +5322,8 @@ static void action(e_rd_class* i_this) { sp25c.x = 10.0f; MtxPosition(&sp25c, &sp268); sp25c = sp268 - i_this->field_0x9b0; - a_this->current.angle.x += (s16)-cM_atan2s(sp25c.y, JMAFastSqrt(sp25c.x * sp25c.x + sp25c.z * sp25c.z)); + ANGLE_ADD(a_this->current.angle.x, + -cM_atan2s(sp25c.y, JMAFastSqrt(sp25c.x * sp25c.x + sp25c.z * sp25c.z))); a_this->shape_angle.x = a_this->current.angle.x; if (i_this->field_0x9be == 1) { @@ -6857,8 +6858,8 @@ static int daE_RD_Execute(e_rd_class* i_this) { // NOT Hyrule Field if (strcmp(dComIfGp_getStartStageName(), "F_SP121") != 0 && i_this->field_0x1296 == 0) { - local_148.x += (s16)(cM_rndFX(200.0f) + -500.0f); - local_148.y += (s16)cM_rndFX(100.0f); + ANGLE_ADD(local_148.x, cM_rndFX(200.0f) + -500.0f); + ANGLE_ADD(local_148.y, cM_rndFX(100.0f)); } } @@ -6912,8 +6913,8 @@ static int daE_RD_Execute(e_rd_class* i_this) { } else { i_this->field_0x71c[i] += i_this->field_0x7c4[i]; i_this->field_0x7c4[i].y -= 3.0f; - i_this->field_0x86c[i].y += (s16) 0x900; - i_this->field_0x86c[i].x += (s16) 0xB00; + ANGLE_ADD(i_this->field_0x86c[i].y, 0x900); + ANGLE_ADD(i_this->field_0x86c[i].x, 0xB00); mDoMtx_stack_c::transS(i_this->field_0x71c[i].x, i_this->field_0x71c[i].y, i_this->field_0x71c[i].z); mDoMtx_stack_c::YrotM(i_this->field_0x86c[i].y); @@ -6951,8 +6952,8 @@ static int daE_RD_Execute(e_rd_class* i_this) { cMtx_XrotM(*calc_mtx, 0x7FFF); cMtx_ZrotM(*calc_mtx, i_this->field_0x6bc.z); MtxTrans(-(BREG_F(5) + 80.0f), -(BREG_F(6) + 50.0f), -(BREG_F(7) + 0.0f), 1); - i_this->field_0x6bc.y += (s16) 0x200; - i_this->field_0x6bc.z += (s16) 0xF00; + ANGLE_ADD(i_this->field_0x6bc.y, 0x200); + ANGLE_ADD(i_this->field_0x6bc.z, 0xF00); } i_this->mpMorfHornAnm->getModel()->setBaseTRMtx(*calc_mtx); @@ -7073,7 +7074,7 @@ static void ride_game_actor_set(e_rd_class* i_this) { gnd_chk.SetPos(&i_pos); i_pos.y = dComIfG_Bgsp().GroundCross(&gnd_chk); i_angle = player->shape_angle; - i_angle.y += (s16) 0x4000; + ANGLE_ADD(i_angle.y, 0x4000); i_parameters = 0x80000005; } else if (i_this->mBossMode == 2) { i_pos.set(34789.0f, -290.0f, -36177.0f); diff --git a/src/d/actor/d_a_e_rdy.cpp b/src/d/actor/d_a_e_rdy.cpp index c12cfef2d95..5ed41b451bc 100644 --- a/src/d/actor/d_a_e_rdy.cpp +++ b/src/d/actor/d_a_e_rdy.cpp @@ -683,7 +683,7 @@ static BOOL way_check(e_rdy_class* i_this) { dBgS_LinChk lin_chk; lin_chk.Set(&start, &end, _this); if (dComIfG_Bgsp().LineCross(&lin_chk)) { - ADD_ANGLE_2(angle, 0x1000); + ANGLE_ADD_2(angle, 0x1000); } else { i_this->mTargetAngleY = angle; return TRUE; @@ -1165,7 +1165,7 @@ static void e_rdy_bow_run(e_rdy_class* i_this) { case 1: target_speed = run_speed; - ADD_ANGLE_2(target_angle, 0x8000); + ANGLE_ADD_2(target_angle, 0x8000); if (i_this->mPlayerDist > l_HIO.field_0x28 || i_this->mTimer[0] == 0 || i_this->mAcch.ChkWallHit()) { @@ -1933,7 +1933,7 @@ static void e_rdy_bomb_action(e_rdy_class* i_this) { break; } } - ADD_ANGLE_2(target_angle, 0x8000); + ANGLE_ADD_2(target_angle, 0x8000); target_speed = l_HIO.mRunSpeed; if (JMAFastSqrt(vec1.x * vec1.x + vec1.z * vec1.z) > 600.0f) { i_this->mMode = 3; @@ -2158,10 +2158,10 @@ static void e_rdy_damage(e_rdy_class* i_this) { OS_REPORT(" ..KADO KABE ..%x\n", check); if (check == 2) { i_this->field_0xac6 = 0x1000; - i_this->field_0xadc.y += (s16)(TREG_S(8) - 7000); + ANGLE_ADD(i_this->field_0xadc.y, TREG_S(8) - 7000); } else { i_this->field_0xac6 = -0x1000; - i_this->field_0xadc.y += (s16)-(TREG_S(8) - 7000); + ANGLE_ADD(i_this->field_0xadc.y, -(TREG_S(8) - 7000)); } i_this->field_0xb88 = 8000.0f + BREG_F(10); i_this->field_0xaf4 = 100.0f + BREG_F(4); @@ -2171,7 +2171,7 @@ static void e_rdy_damage(e_rdy_class* i_this) { i_this->mMode = 10; a_this->speed.y = 0.0f; i_this->field_0xabc *= 0.2f; - ADD_ANGLE_2(i_this->field_0xadc.y, 0x8000); + ANGLE_ADD_2(i_this->field_0xadc.y, 0x8000); i_this->field_0xbc0 = 5 + BREG_S(7); i_this->field_0xaf4 = 100.0f + BREG_F(4); i_this->field_0xafc = 100.0f + BREG_F(5); @@ -2261,7 +2261,7 @@ static void e_rdy_damage(e_rdy_class* i_this) { case 3: if (body_gake(i_this)) { i_this->field_0xabc = -20.0f + VREG_F(8); - i_this->field_0xadc.x -= (s16)(VREG_S(7) + 0x300); + ANGLE_SUB(i_this->field_0xadc.x, VREG_S(7) + 0x300); } if (a_this->health <= 0 && i_this->mTimer[1] == 0) { rd_disappear(i_this); @@ -2416,7 +2416,7 @@ static s16 gake_check(e_rdy_class* i_this, f32 i_dist) { return angle_y; } } - angle_y += (s16)0x1000; + ANGLE_ADD(angle_y, 0x1000); } return _this->shape_angle.y; } @@ -3526,13 +3526,13 @@ static void action(e_rdy_class* i_this) { i_this->field_0xb44[1].x = i_this->field_0xafc * cM_scos(i_this->field_0xb00) * (70.0f + BREG_F(0)); i_this->field_0xb44[2].x += i_this->field_0xb44[1].x; cLib_addCalc0(&i_this->field_0xafc, 1.0f, 3.0f + BREG_F(1)); - i_this->field_0xb00 += (s16)(4000 + BREG_S(0)); + ANGLE_ADD(i_this->field_0xb00, 4000 + BREG_S(0)); } if (fabsf(i_this->field_0xaf4) > 1.0f) { i_this->field_0xb44[0].x = i_this->field_0xaf4 * cM_scos(i_this->field_0xaf8) * (70.0f + BREG_F(2)); cLib_addCalc0(&i_this->field_0xaf4, 1.0f, 3.0f + BREG_F(3)); - i_this->field_0xaf8 += (s16)(4000 + BREG_S(1)); + ANGLE_ADD(i_this->field_0xaf8, 4000 + BREG_S(1)); } if (a_this->speed.y < 0.0f && i_this->mAcch.ChkGroundHit()) { @@ -4218,7 +4218,7 @@ static void demo_camera(e_rdy_class* i_this) { i_this->mCamEye += player->current.pos; i_this->mCamCenter = player->current.pos; i_this->mCamCenter.y += 100.0f + NREG_F(10); - i_this->field_0x13d4 += (s16)(230 + NREG_S(2)); + ANGLE_ADD(i_this->field_0x13d4, 230 + NREG_S(2)); if (i_this->mDemoTimer >= 30) { if (i_this->mDemoTimer == 30) { i_this->mMsgFlow.init(a_this, 0x7d1, 0, NULL); @@ -4687,8 +4687,8 @@ static int daE_RDY_Execute(e_rdy_class* i_this) { arrow_angle.x = -cM_atan2s(vec1.y, JMAFastSqrt(vec1.x * vec1.x + vec1.z * vec1.z)); if (strcmp(dComIfGp_getStartStageName(), "F_SP121") && !i_this->field_0x1366) { // Not Hyrule Field - arrow_angle.x += (s16)(cM_rndFX(200.0f) + -500.0f); - arrow_angle.y += (s16)cM_rndFX(100.0f); + ANGLE_ADD(arrow_angle.x, cM_rndFX(200.0f) + -500.0f); + ANGLE_ADD(arrow_angle.y, cM_rndFX(100.0f)); } } arrow_angle.z = 0; diff --git a/src/d/actor/d_a_e_sg.cpp b/src/d/actor/d_a_e_sg.cpp index 36abce70fd8..36f1953709a 100644 --- a/src/d/actor/d_a_e_sg.cpp +++ b/src/d/actor/d_a_e_sg.cpp @@ -700,7 +700,7 @@ static void e_sg_drop(e_sg_class* i_this) { i_this->mRotationTarget = -0x8000; } - i_this->current.angle.y += (s16)cM_rndFX(15000.0f); + ANGLE_ADD(i_this->current.angle.y, cM_rndFX(15000.0f)); i_this->mSound.startCreatureSound(Z2SE_EN_SG_BOUND, 0, -1); } diff --git a/src/d/actor/d_a_e_sm.cpp b/src/d/actor/d_a_e_sm.cpp index 9814a6021ad..b04d99b964b 100644 --- a/src/d/actor/d_a_e_sm.cpp +++ b/src/d/actor/d_a_e_sm.cpp @@ -242,7 +242,7 @@ void daE_SM_c::ArrowCheck() { } void daE_SM_c::E_SM_Damage() { - field_0x6bc += (s16)((field_0x980 + 1000.0f) / field_0x6f0); + ANGLE_ADD(field_0x6bc, (field_0x980 + 1000.0f) / field_0x6f0); mCoSm.OffAtSetBit(); if (field_0x6c0[0] != 0) { @@ -254,7 +254,7 @@ void daE_SM_c::E_SM_Damage() { fVar1 = field_0x978; } - field_0x6be += (s16)(3000.0f / field_0x6f0); + ANGLE_ADD(field_0x6be, 3000.0f / field_0x6f0); cLib_addCalc2(&field_0x6e4, field_0x974, 0.3f, 1.0f); cLib_addCalc2(&field_0x6e0, fVar1 + 1.0f, 0.3f, 1.0f); cLib_addCalc2(&field_0x6dc, field_0x97c + 0.005f, 0.05f, 0.5f); diff --git a/src/d/actor/d_a_e_sm2.cpp b/src/d/actor/d_a_e_sm2.cpp index 47b5b5872e4..066a8243e24 100644 --- a/src/d/actor/d_a_e_sm2.cpp +++ b/src/d/actor/d_a_e_sm2.cpp @@ -1276,7 +1276,8 @@ static void action(e_sm2_class* i_this) { static f32 asp[] = {500.0f, 400.0f, 300.0f, 200.0f, 100.0f}; static f32 asp2[] = {3500.0f, 3000.0f, 2500.0f, 2000.0f, 1500.0f}; - i_this->field_0x828 += (s16)(asp2[i_this->sizetype] + (i_this->field_0x82c * asp[i_this->sizetype])); + ANGLE_ADD(i_this->field_0x828, + asp2[i_this->sizetype] + (i_this->field_0x82c * asp[i_this->sizetype])); for (int i = 0; i < 8; i++) { if (i_this->action != ACTION_FAIL) { diff --git a/src/d/actor/d_a_e_th_ball.cpp b/src/d/actor/d_a_e_th_ball.cpp index a6fad3bbaa8..c2995c2030c 100644 --- a/src/d/actor/d_a_e_th_ball.cpp +++ b/src/d/actor/d_a_e_th_ball.cpp @@ -35,7 +35,7 @@ static void chain_draw(e_th_ball_class* i_this) { rot_z = var_r28 * 3000; if (var_r28 & 1) { - rot_z += (s16)0x4000; + ANGLE_ADD(rot_z, 0x4000); } cMtx_ZrotM(*calc_mtx, rot_z); MtxScale(size, size, size, 1); @@ -57,7 +57,7 @@ static void chain_draw(e_th_ball_class* i_this) { rot_z = var_r28 * 3000; if (var_r28 & 1) { - rot_z += (s16)0x4000; + ANGLE_ADD(rot_z, 0x4000); } cMtx_ZrotM(*calc_mtx, rot_z); MtxScale(size, size, size, 1); @@ -78,7 +78,7 @@ static void chain_draw(e_th_ball_class* i_this) { rot_z = var_r28 * 3000; if (var_r28 & 1) { - rot_z += (s16)0x4000; + ANGLE_ADD(rot_z, 0x4000); } cMtx_ZrotM(*calc_mtx, rot_z); MtxScale(size, size, size, 1); @@ -462,7 +462,7 @@ static void normal_move(e_th_ball_class* i_this, s8 param_1) { a_this->speed.y -= 5.0f; if (param_1 != 0) { - a_this->current.angle.x += (s16)(200.0f * a_this->speedF); + ANGLE_ADD(a_this->current.angle.x, 200.0f * a_this->speedF); } f32 y_speed = a_this->speed.y; @@ -655,7 +655,7 @@ static void e_th_ball_shot(e_th_ball_class* i_this) { cLib_addCalcAngleS2(&i_this->shape_angle.y, spE, 1, 0x4000); cLib_addCalcAngleS2(&i_this->shape_angle.x, 0, 1, 0x4000); } else if (temp_f31 > 0.0f) { - i_this->current.angle.y += (s16)cM_rndFX(4000.0f); + ANGLE_ADD(i_this->current.angle.y, cM_rndFX(4000.0f)); i_this->speed.y = 20.0f + AREG_F(5); } @@ -674,7 +674,7 @@ static void e_th_ball_shot(e_th_ball_class* i_this) { if (wall_angle != 35) { s16 spA = i_this->current.angle.y - wall_angle; - i_this->current.angle.y += (s16)(0x8000 - (spA * 2)); + ANGLE_ADD(i_this->current.angle.y, 0x8000 - (spA * 2)); i_this->speedF *= 0.3f + AREG_F(14); } else { i_this->current.angle.y -= 0x8000; @@ -738,7 +738,7 @@ static void e_th_ball_return(e_th_ball_class* i_this) { i_this->speed.y = 0.0f; i_this->speedF = 10.0f; i_this->mMode = 3; - i_this->current.angle.y += (s16)cM_rndFX(6000.0f); + ANGLE_ADD(i_this->current.angle.y, cM_rndFX(6000.0f)); } else if (fabsf(i_this->speedF) < 0.1f) { i_this->mMode = 3; } diff --git a/src/d/actor/d_a_e_tk.cpp b/src/d/actor/d_a_e_tk.cpp index dbe22e40f4d..ca9a5445e41 100644 --- a/src/d/actor/d_a_e_tk.cpp +++ b/src/d/actor/d_a_e_tk.cpp @@ -317,7 +317,7 @@ static void e_tk_find(e_tk_class* i_this) { break; case MODE_TK_SWIM: - ADD_ANGLE(i_this->mPlayerAngleY, 0x8000); + ANGLE_ADD(i_this->mPlayerAngleY, 0x8000); i_this->mAttentionOFF = true; if (i_this->mpMorf->isStop()) { i_this->mAnimSpeed = 4.0f; @@ -343,7 +343,7 @@ static void e_tk_find(e_tk_class* i_this) { } } if (i_this->mActionTimer[1] == 0) { - ADD_ANGLE(i_this->mPlayerAngleY, 0x8000); + ANGLE_ADD(i_this->mPlayerAngleY, 0x8000); } else { i_this->mPlayerAngleY = i_this->mSomeAngle; } diff --git a/src/d/actor/d_a_e_tk2.cpp b/src/d/actor/d_a_e_tk2.cpp index 4d2b62d295f..b28faa1b9b3 100644 --- a/src/d/actor/d_a_e_tk2.cpp +++ b/src/d/actor/d_a_e_tk2.cpp @@ -242,7 +242,7 @@ static void e_tk2_find(e_tk2_class* i_this) { break; case MODE_TK2_SWIM: - ADD_ANGLE(i_this->mPlayerAngleY, 0x8000); + ANGLE_ADD(i_this->mPlayerAngleY, 0x8000); i_this->mAttentionOFF = true; if (i_this->mpMorf->isStop()) { i_this->mAnimSpeed = 4.0f; @@ -268,7 +268,7 @@ static void e_tk2_find(e_tk2_class* i_this) { } } if (i_this->mActionTimer[1] == 0) { - ADD_ANGLE(i_this->mPlayerAngleY, 0x8000); + ANGLE_ADD(i_this->mPlayerAngleY, 0x8000); } else { i_this->mPlayerAngleY = i_this->mSomeAngle; } diff --git a/src/d/actor/d_a_e_tk_ball.cpp b/src/d/actor/d_a_e_tk_ball.cpp index 529eec4a893..fb719a4240b 100644 --- a/src/d/actor/d_a_e_tk_ball.cpp +++ b/src/d/actor/d_a_e_tk_ball.cpp @@ -81,7 +81,7 @@ static void impact_eff_set(e_tk_ball_class* i_this) { cXyz scale(2.0f + TREG_F(8), 2.0f + TREG_F(8), 2.0f + TREG_F(8)); csXyz rotation = actor->current.angle; - ADD_ANGLE(rotation.y, 0x8000); + ANGLE_ADD(rotation.y, 0x8000); if (i_this->mType == TYPE_TK_BALL_WATER) { dComIfGp_particle_set(0x819B, &pos, &rotation, &scale); @@ -157,7 +157,7 @@ static void e_tk_ball_move(e_tk_ball_class* i_this) { if (actor_lockon && daPy_getPlayerActorClass()->getCutType() != daPy_py_c::CUT_TYPE_NONE) { i_this->mAction = ACT_TK_BALL_RETURN; i_this->mMode = MODE_TK_BALL_INIT; - ADD_ANGLE(actor->current.angle.y, 0x8000); + ANGLE_ADD(actor->current.angle.y, 0x8000); } else { i_this->mAction = ACT_TK_BALL_DROP; i_this->mMode = MODE_TK_BALL_INIT; @@ -335,8 +335,8 @@ static int daE_TK_BALL_Execute(e_tk_ball_class* i_this) { action(i_this); - ADD_ANGLE(actor->shape_angle.y, 0x1000); - ADD_ANGLE(actor->shape_angle.x, 0xE00); + ANGLE_ADD(actor->shape_angle.y, 0x1000); + ANGLE_ADD(actor->shape_angle.x, 0xE00); mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y + i_this->mArcHeight, actor->current.pos.z); diff --git a/src/d/actor/d_a_e_vt.cpp b/src/d/actor/d_a_e_vt.cpp index a9d716acd0a..64029be198b 100644 --- a/src/d/actor/d_a_e_vt.cpp +++ b/src/d/actor/d_a_e_vt.cpp @@ -1271,9 +1271,9 @@ void daE_VA_c::onRopeCutStatus(int param_0, int param_1, int param_2) { } void daE_VA_c::setVibRope(f32 param_0, f32 param_1) { - field_0x1336 += (s16)(param_1 * 7168.0f); - field_0x122c.y += (s16)(param_0 * cM_ssin(field_0x1336)); - field_0x123e += (s16)(param_0 * 50.0f * cM_ssin(field_0x1336)); + ANGLE_ADD(field_0x1336, param_1 * 7168.0f); + ANGLE_ADD(field_0x122c.y, param_0 * cM_ssin(field_0x1336)); + ANGLE_ADD(field_0x123e, param_0 * 50.0f * cM_ssin(field_0x1336)); } static s16 TAG_VIB_ANGLE[] = { diff --git a/src/d/actor/d_a_e_wb.cpp b/src/d/actor/d_a_e_wb.cpp index 165b9360642..905bd9df396 100644 --- a/src/d/actor/d_a_e_wb.cpp +++ b/src/d/actor/d_a_e_wb.cpp @@ -1939,7 +1939,7 @@ static void e_wb_b_ikki(e_wb_class* i_this) { } else if (a_this->speedF < 1.0f) { anm_init(i_this, 0x2a, 10.0f, 2, 1.0f); i_this->mActionMode = 6; - i_this->mTargetFacingAngle += (s16)0x8000; + ANGLE_ADD(i_this->mTargetFacingAngle, 0x8000); } break; case 6: @@ -2201,7 +2201,7 @@ static void e_wb_b_ikki2(e_wb_class* i_this) { } else if (a_this->speedF < 1.0f) { anm_init(i_this, 0x2a, 10.0f, 2, 1.0f); i_this->mActionMode = 6; - i_this->mTargetFacingAngle += (s16)0x8000; + ANGLE_ADD(i_this->mTargetFacingAngle, 0x8000); } } break; @@ -2374,7 +2374,7 @@ static void e_wb_a_run(e_wb_class* i_this) { if (i_this->field_0x698[0] == 0) { i_this->field_0x698[0] = cM_rndF(30.0f) + 10.0f; - i_this->mTargetFacingAngle += (s16)cM_rndFX(10000.0f); + ANGLE_ADD(i_this->mTargetFacingAngle, cM_rndFX(10000.0f)); } if (i_this->field_0x698[1] == 1 || i_this->mSpeedCapTimer == 2) { @@ -2457,7 +2457,7 @@ static int e_wb_damage(e_wb_class* i_this) { i_this->mActionMode = 1; a_this->speedF = -15.0f + YREG_F(0); a_this->speed.y = 50.0f + YREG_F(1) + cM_rndF(20.0f); - a_this->current.angle.y += (s16)cM_rndFX(3000.0f); + ANGLE_ADD(a_this->current.angle.y, cM_rndFX(3000.0f)); i_this->mStatusFlags |= (u16)0x40; break; @@ -2778,7 +2778,7 @@ static void damage_check(e_wb_class* i_this) { if (!daAlink_getAlinkActorClass()->checkBoarRideOwn(a_this) && i_this->field_0x6a0 == 0 && a_this->speedF < 1.0f && fopAcM_GetName(hit_actor) == PROC_ALINK) { - i_this->field_0x6ba += (s16)2; + ANGLE_ADD(i_this->field_0x6ba, 2); if (i_this->field_0x6ba >= 150) { i_this->field_0x692 = i_this->mActionID; i_this->mActionID = ACT_S_DAMAGE; @@ -2823,10 +2823,10 @@ static void damage_check(e_wb_class* i_this) { if (angle < 0) { i_this->field_0x5de = 0x1000; - a_this->current.angle.y += (s16)0x800; + ANGLE_ADD(a_this->current.angle.y, 0x800); } else { i_this->field_0x5de = -0x1000; - a_this->current.angle.y -= (s16)0x800; + ANGLE_SUB(a_this->current.angle.y, 0x800); } } } @@ -3341,11 +3341,11 @@ static s8 e_wb_c_run(e_wb_class* i_this) { i_this->mTargetFacingAngle = cM_atan2s(sp94.x, sp94.z); if (rider && rider->mAnmID == 0x27) { - i_this->mTargetFacingAngle += static_cast( - (BREG_F(16) + 5000.0f) * cM_ssin(i_this->field_0x68e * (BREG_S(7) + 1000))); + ANGLE_ADD(i_this->mTargetFacingAngle, + (BREG_F(16) + 5000.0f) * cM_ssin(i_this->field_0x68e * (BREG_S(7) + 1000))); turn_speed = 0x400; } else if (wall_check != 0) { - i_this->mTargetFacingAngle += (s16)((BREG_S(8) + -8000) * wall_check); + ANGLE_ADD(i_this->mTargetFacingAngle, (BREG_S(8) + -8000) * wall_check); } cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->mTargetFacingAngle, 8, turn_speed); diff --git a/src/d/actor/d_a_e_ww.cpp b/src/d/actor/d_a_e_ww.cpp index 91558261621..3e6730e94f9 100644 --- a/src/d/actor/d_a_e_ww.cpp +++ b/src/d/actor/d_a_e_ww.cpp @@ -320,9 +320,9 @@ void daE_WW_c::damage_check() { mAtInfo.mpCollider = var_r29; if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_IRON_BALL) != 0) { if (fopAcM_GetName(dCc_GetAc(mAtInfo.mpCollider->GetAc())) == PROC_Obj_Carry) { - health += (s16) 150; + S16_ADD(health, 150); } else if (dComIfGp_checkPlayerStatus0(0, 0x400) != 0) { - health += (s16) 180; + S16_ADD(health, 180); } else { health = 0; } diff --git a/src/d/actor/d_a_e_yg.cpp b/src/d/actor/d_a_e_yg.cpp index f0a3059f620..d5d0e538684 100644 --- a/src/d/actor/d_a_e_yg.cpp +++ b/src/d/actor/d_a_e_yg.cpp @@ -314,7 +314,7 @@ static BOOL way_set(e_yg_class* i_this) { dBgS_LinChk lin_chk; lin_chk.Set(&start, &end, actor); if (dComIfG_Bgsp().LineCross(&lin_chk)) { - y_rot += (s16)0x1000; + ANGLE_ADD(y_rot, 0x1000); } else { i_this->mCurrentAngleYTarget = y_rot; return TRUE; @@ -346,7 +346,7 @@ static s8 e_yg_normal(e_yg_class* i_this) { target = l_HIO.movement_spd; if (i_this->mpMorf->checkFrame(1.0f)) { - i_this->mCurrentAngleYTarget += (s16)cM_rndFX(2000.0f); + ANGLE_ADD(i_this->mCurrentAngleYTarget, cM_rndFX(2000.0f)); } if (i_this->mTimers[0] == 0 || (i_this->mTimers[2] == 0 && fopAcM_wayBgCheck(actor, 200.0f, 50.0f))) { @@ -382,7 +382,7 @@ static s8 e_yg_normal(e_yg_class* i_this) { target = l_HIO.movement_spd * 1.5f; if (i_this->mpMorf->checkFrame(1.0f)) { - i_this->mCurrentAngleYTarget += (s16)cM_rndFX(4000.0f); + ANGLE_ADD(i_this->mCurrentAngleYTarget, cM_rndFX(4000.0f)); } if (i_this->mTimers[2] == 0 && fopAcM_wayBgCheck(actor, 200.0f, 50.0f)) { @@ -560,7 +560,7 @@ static void search_ground_1(e_yg_class* i_this) { } } - y_rot += (s16)0x1000; + ANGLE_ADD(y_rot, 0x1000); } if (line_cross_flag) { diff --git a/src/d/actor/d_a_e_ym.cpp b/src/d/actor/d_a_e_ym.cpp index 91809720829..15c0179abf0 100644 --- a/src/d/actor/d_a_e_ym.cpp +++ b/src/d/actor/d_a_e_ym.cpp @@ -964,13 +964,13 @@ void daE_YM_c::executeEscape() { cLib_chaseF(&speedF, 20.0f, 1.0f); setMoveSound(0); if (mAcch.ChkWallHit()) { - field_0x6e4 += (s16) 0x800; + ANGLE_ADD(field_0x6e4, 0x800); } if (field_0x6e8 >= 0) { - field_0x6e6 -= (s16) 200; + ANGLE_SUB(field_0x6e6, 200); } else { - field_0x6e6 += (s16) 200; + ANGLE_ADD(field_0x6e6, 200); } field_0x6e8 += field_0x6e6; @@ -1971,9 +1971,9 @@ void daE_YM_c::executeFly() { current.angle.y = cLib_targetAngleY(¤t.pos, &mPrevPos); current.angle.x = cLib_targetAngleX(¤t.pos, &mPrevPos); if ((s16)(cLib_targetAngleY(¤t.pos, &player_pos) - current.angle.y) < 0) { - current.angle.y += (s16) 0x3000; + ANGLE_ADD(current.angle.y, 0x3000); } else { - current.angle.y -= (s16) 0x3000; + ANGLE_SUB(current.angle.y, 0x3000); } } } @@ -2080,9 +2080,9 @@ void daE_YM_c::executeFly() { } else { tgt_ang_y = cLib_targetAngleY(¤t.pos, &mPrevPos); if (s16(cLib_targetAngleY(¤t.pos, &player_pos) - tgt_ang_y) < 0) { - tgt_ang_y += (s16) 0x3000; + ANGLE_ADD(tgt_ang_y, 0x3000); } else { - tgt_ang_y -= (s16) 0x3000; + ANGLE_SUB(tgt_ang_y, 0x3000); } cLib_chaseAngleS(¤t.angle.y, tgt_ang_y, 0x400); @@ -2100,7 +2100,7 @@ void daE_YM_c::executeFly() { } } - field_0x6e4 += (s16) 0x800; + ANGLE_ADD(field_0x6e4, 0x800); current.pos.y += cM_ssin(field_0x6e4) * 3.0f; } @@ -2176,7 +2176,7 @@ void daE_YM_c::executeFlyAttack() { case 4: case 5: { - field_0x6e4 += (s16) 0x800; + ANGLE_ADD(field_0x6e4, 0x800); current.pos.y += cM_ssin(field_0x6e4) * 3.0f; cLib_chaseF(&speed.y, 0.0f, 3.0f); cLib_chaseF(&speedF, 0.0f, 3.0f); @@ -2537,12 +2537,12 @@ void daE_YM_c::executeSwitch() { cLib_chaseF(&field_0x6dc, 0.0f, 15.0f); setMoveSound(0); if (mAcch.ChkWallHit()) { - field_0x6e4 += (s16) 0x800; + ANGLE_ADD(field_0x6e4, 0x800); } if (field_0x6e8 >= 0) { - field_0x6e6 -= (s16) 200; + ANGLE_SUB(field_0x6e6, 200); } else { - field_0x6e6 += (s16) 200; + ANGLE_ADD(field_0x6e6, 200); } field_0x6e8 += field_0x6e6; cLib_addCalcAngleS(&shape_angle.y, field_0x6e4 + field_0x6e8, 4, 0x1000, 0x100); @@ -2742,7 +2742,7 @@ void daE_YM_c::executeFire() { default: break; } - field_0x6e4 += (s16) 0x2000; + ANGLE_ADD(field_0x6e4, 0x2000); current.pos.y += cM_ssin(field_0x6e4) * 3.0f; if (mMode) { mSound.startCreatureSoundLevel(Z2SE_EN_YM_FLY, 0, -1); @@ -2851,7 +2851,7 @@ void daE_YM_c::executeRiver() { case 2: { setRiverAttention(); - field_0x6e8 += (s16) 0x200; + ANGLE_ADD(field_0x6e8, 0x200); current.pos.y += cM_ssin(field_0x6e8 << 1) * 15.0f; f32 my_float_val = cM_scos(field_0x6e8) * 15.0f; current.pos.x += my_float_val * cM_ssin(shape_angle.y); diff --git a/src/d/actor/d_a_e_ymb.cpp b/src/d/actor/d_a_e_ymb.cpp index c1d39eccecc..70142c85976 100644 --- a/src/d/actor/d_a_e_ymb.cpp +++ b/src/d/actor/d_a_e_ymb.cpp @@ -902,16 +902,16 @@ void daE_YMB_c::executeFly() { if (fVar1 > 1800.0f) { adj_angle = playerAngleY + 0x8000 + cM_rndFX(2048.0f); if ((s16)(cLib_targetAngleY(¤t.pos, &field_0x69c) - playerAngleY) > 0) { - adj_angle -= (s16) 0x1800; + ANGLE_SUB(adj_angle, 0x1800); } else { - adj_angle += (s16) 0x1800; + ANGLE_ADD(adj_angle, 0x1800); } } else { adj_angle = playerAngleY + 0x8000 + cM_rndFX(2048.0f); if (cM_rnd() < 0.5f) { - adj_angle += (s16) 0x1800; + ANGLE_ADD(adj_angle, 0x1800); } else { - adj_angle -= (s16) 0x1800; + ANGLE_SUB(adj_angle, 0x1800); } } } diff --git a/src/d/actor/d_a_e_zm.cpp b/src/d/actor/d_a_e_zm.cpp index e8cc184b1ac..25a3dceaca6 100644 --- a/src/d/actor/d_a_e_zm.cpp +++ b/src/d/actor/d_a_e_zm.cpp @@ -578,7 +578,7 @@ void daE_ZM_c::executeDead() { break; case MODE_1: { - shape_angle.y += (s16)(field_0x722 * (JREG_S(1) + 100)); + ANGLE_ADD(shape_angle.y, field_0x722 * (JREG_S(1) + 100)); cLib_addCalc0(&speedF, 0.8f, 2.0f); field_0x72b += 10; field_0x700.x = field_0x714 * cM_ssin(field_0x72b * field_0x718); diff --git a/src/d/actor/d_a_fr.cpp b/src/d/actor/d_a_fr.cpp index 7eb4b89c9df..47c90ee0a7f 100644 --- a/src/d/actor/d_a_fr.cpp +++ b/src/d/actor/d_a_fr.cpp @@ -148,7 +148,7 @@ static void fr_normal(fr_class* i_this) { cXyz sp0c; switch (i_this->field_0x5d4) { case 0: - i_this->field_0x5d4 += (s16)1; + S16_ADD(i_this->field_0x5d4, 1); anm_init(i_this, 11, 5.0f, 2, cM_rndF(0.3f) + 0.8f); i_this->field_0x5dc[0] = cM_rndF(50.0f) + 20.0f; i_this->speedF = 0.0f; @@ -200,7 +200,7 @@ static void fr_away(fr_class* i_this) { cXyz sp08; switch (i_this->field_0x5d4) { case 0: - i_this->field_0x5d4 += (s16)1; + S16_ADD(i_this->field_0x5d4, 1); i_this->speedF = 0.0f; anm_init(i_this, 7, 3.0f, 0, 4.0f); break; diff --git a/src/d/actor/d_a_horse.cpp b/src/d/actor/d_a_horse.cpp index e6303ca10e4..84e51945e62 100644 --- a/src/d/actor/d_a_horse.cpp +++ b/src/d/actor/d_a_horse.cpp @@ -2668,9 +2668,9 @@ int daHorse_c::setLegAngle(f32 param_0, int param_1, int param_2, s16* param_3) sp8C = *sp18 - *sp1C; sp80 = *sp14 - *sp18; - param_3[i] += (s16)(cM_atan2s(spA4.y, spA4.z) - cM_atan2s(sp8C.y, sp8C.z)); + ANGLE_ADD(param_3[i], cM_atan2s(spA4.y, spA4.z) - cM_atan2s(sp8C.y, sp8C.z)); // i don't like this, but it matches debug and release, param_3[i+1] does not match debug - (param_3 + 1)[i] += (s16)(cM_atan2s(sp98.y, sp98.z) - cM_atan2s(sp80.y, sp80.z)); + ANGLE_ADD((param_3 + 1)[i], cM_atan2s(sp98.y, sp98.z) - cM_atan2s(sp80.y, sp80.z)); if (i == 0) { spC0[3].y += param_0 * var_f27; @@ -3813,7 +3813,7 @@ int daHorse_c::procTurnInit(int param_0) { field_0x171e = shape_angle.y + 0x8000; if (!dComIfGp_event_runCheck() && !checkStateFlg0(FLG0_UNK_4000000)) { - field_0x170a += (s16)(f32)0x8000; + ANGLE_ADD(field_0x170a, (f32)0x8000); } else if (checkStateFlg0(FLG0_UNK_4000000)) { field_0x171e = shape_angle.y; } @@ -3949,7 +3949,7 @@ int daHorse_c::procTurn() { break; } - shape_angle.y += (s16)0x2000; + ANGLE_ADD(shape_angle.y, 0x2000); current.angle.y = shape_angle.y; } @@ -4344,8 +4344,7 @@ int daHorse_c::execute() { current.pos -= *m_cc_stts.GetCCMoveP(); break; } - - shape_angle.y += (s16)0x2000; + ANGLE_ADD(shape_angle.y, 0x2000); current.angle.y = shape_angle.y; } diff --git a/src/d/actor/d_a_hozelda.cpp b/src/d/actor/d_a_hozelda.cpp index 4d64d0e6edf..fea51232d9b 100644 --- a/src/d/actor/d_a_hozelda.cpp +++ b/src/d/actor/d_a_hozelda.cpp @@ -825,8 +825,8 @@ void daHoZelda_c::setNeckAngle() { angle_x_target = var_r27; angle_y_target = var_r26; - var_r27 += (s16)(spA - spE); - var_r26 += (s16)(sp8 - spC); + ANGLE_ADD(var_r27, spA - spE); + ANGLE_ADD(var_r26, sp8 - spC); } daPy_addCalcShort(&mNeckAngle.x, angle_x_target, 3, 0x1000, 0x100); diff --git a/src/d/actor/d_a_itembase.cpp b/src/d/actor/d_a_itembase.cpp index 680f5bb6c7a..7c5f2b32787 100644 --- a/src/d/actor/d_a_itembase.cpp +++ b/src/d/actor/d_a_itembase.cpp @@ -135,7 +135,7 @@ int daItemBase_c::DrawBase() { } void daItemBase_c::RotateYBase() { - shape_angle.y += (s16)(0xFFFF / getData().mRotateYSpeed); + ANGLE_ADD(shape_angle.y, 0xFFFF / getData().mRotateYSpeed); } void daItemBase_c::setListStart() { diff --git a/src/d/actor/d_a_kago.cpp b/src/d/actor/d_a_kago.cpp index 4e2b90659df..654c2d8a222 100644 --- a/src/d/actor/d_a_kago.cpp +++ b/src/d/actor/d_a_kago.cpp @@ -1290,13 +1290,13 @@ void daKago_c::executeStagger() { if (field_0x744 == 1) { shape_angle.z = 0x3000; - current.angle.y += (s16)-0x2000; + ANGLE_ADD(current.angle.y, -0x2000); if (abs((s16)(current.angle.y - field_0x714)) > 0x2000) { current.angle.y = field_0x714 + -0x2000; } } else { shape_angle.z = -0x3000; - current.angle.y += (s16)0x2000; + ANGLE_ADD(current.angle.y, 0x2000); if (abs((s16)(current.angle.y - field_0x714)) > 0x2000) { current.angle.y = field_0x714 + 0x2000; } diff --git a/src/d/actor/d_a_mant.cpp b/src/d/actor/d_a_mant.cpp index a65520e4dab..12d4db275f1 100644 --- a/src/d/actor/d_a_mant.cpp +++ b/src/d/actor/d_a_mant.cpp @@ -425,7 +425,7 @@ static void joint_control(mant_class* i_this, mant_j_s* param_2, int param_3, f3 sp08 *= -1; } - sp08 *= (s16)(-4000 + VREG_S(5)); + ANGLE_MULT(sp08, -4000 + VREG_S(5)); spFC.x = 0.0f; spFC.y = 0.0f; spFC.z = i_this->field_0x394c; @@ -438,7 +438,7 @@ static void joint_control(mant_class* i_this, mant_j_s* param_2, int param_3, f3 spB4 = spC0 * (d_p[sp34 - 1] + NREG_F(sp34)); sp18 = i_this->field_0x3958; - sp18 *= 1.0f + VREG_F(0) - sp34 * (0.07f + VREG_F(1)); + sp18 *= 1.0f + VREG_F(0) - sp34 * (0.07f + VREG_F(1)); sp84.zero(); diff --git a/src/d/actor/d_a_mg_fish.cpp b/src/d/actor/d_a_mg_fish.cpp index 16ed251d303..7a351d1b502 100644 --- a/src/d/actor/d_a_mg_fish.cpp +++ b/src/d/actor/d_a_mg_fish.cpp @@ -2308,7 +2308,7 @@ static void mf_esa_search(mg_fish_class* i_this) { i_this->field_0x5ec > 10000.0f) { i_this->mActionPhase = 3; i_this->mMovementPitch = i_this->mMovementPitch + 0x2000; - i_this->mMovementYaw += (s16)cM_rndFX(32768.0f); + ANGLE_ADD(i_this->mMovementYaw, cM_rndFX(32768.0f)); rod->field_0x10a5 = fVar10 * (cM_rndF(20.0f) + 15.0f); i_this->field_0x659 = rod->field_0x10a5; } else { @@ -3007,7 +3007,7 @@ static void action(mg_fish_class* i_this) { } } else { f32 unkFloat0 = -1000.0f * i_this->field_0x5d4 * i_this->field_0x660; - i_this->jointYaws2[1] += (s16)(i_this->field_0x5d4 * 2500.0f / i_this->mJointScale); + ANGLE_ADD(i_this->jointYaws2[1], i_this->field_0x5d4 * 2500.0f / i_this->mJointScale); if (i_this->mGedouKind >= GEDOU_KIND_BG) { i_this->jointYaws2[1] += 2000; } diff --git a/src/d/actor/d_a_mg_fshop.cpp b/src/d/actor/d_a_mg_fshop.cpp index 990da93a06f..f24db03e89c 100644 --- a/src/d/actor/d_a_mg_fshop.cpp +++ b/src/d/actor/d_a_mg_fshop.cpp @@ -409,8 +409,8 @@ static void lure_set(fshop_class* i_this) { pLure->field_0x3c = cM_rndF(1000.0f) + 500.0f; } - pLure->field_0x34 += (s16) 4000; - pLure->field_0x36 += (s16) 4000; + ANGLE_ADD(pLure->field_0x34, 4000); + ANGLE_ADD(pLure->field_0x36, 4000); pLure->field_0x32 = pLure->field_0x3c * cM_ssin(pLure->field_0x36); pLure->field_0x30 = pLure->field_0x38 * cM_ssin(pLure->field_0x34); @@ -559,7 +559,7 @@ static void tsubo_set(fshop_class* i_this) { xrot = cM_ssin(pTsubo->field_0x20) * pTsubo->field_0x1c; zrot = cM_ssin(pTsubo->field_0x22) * pTsubo->field_0x1c; pTsubo->field_0x20 += pTsubo->field_0x24; - ADD_ANGLE_2(pTsubo->field_0x22, pTsubo->field_0x24 + 700); + ANGLE_ADD_2(pTsubo->field_0x22, pTsubo->field_0x24 + 700); cLib_addCalcAngleS2(&pTsubo->field_0x24, 9000 + TREG_S(8), 1, 200); mDoMtx_stack_c::transS(pTsubo->field_0x00.x, pTsubo->field_0x00.y, pTsubo->field_0x00.z); @@ -589,7 +589,7 @@ static void weed_control(fshop_class* i_this, fs_weed_s* i_weed) { f32 reg_f26; f32 reg_f31; f32 reg_f30; - i_weed->field_0xbc += (s16)(i_weed->field_0xb8 * 600.0f + 200.0f); + ANGLE_ADD(i_weed->field_0xbc, i_weed->field_0xb8 * 600.0f + 200.0f); cLib_addCalc0(&i_weed->field_0xb8, 0.05f, 0.02f); for (i = 1; i < 15; i++, pfVar7++) { @@ -731,9 +731,9 @@ static void koro2_game(fshop_class* i_this) { (mDoCPd_c::getSubStickX(PAD_1) <= -0.8f && old_stick_x > -0.8f)) { if (mDoCPd_c::getSubStickX(PAD_1) > 0.0f) { - i_this->field_0x4062 += (s16) 0x4000; + ANGLE_ADD(i_this->field_0x4062, 0x4000); } else { - i_this->field_0x4062 += (s16) -0x4000; + ANGLE_ADD(i_this->field_0x4062, -0x4000); } } @@ -1099,8 +1099,8 @@ static int daFshop_Execute(fshop_class* i_this) { i_this->field_0x4000 = cM_rndF(600.0f) + 1300.0f; } - i_this->field_0x3ff8 += (s16) 4000; - i_this->field_0x3ffa += (s16) 4000; + ANGLE_ADD(i_this->field_0x3ff8, 4000); + ANGLE_ADD(i_this->field_0x3ffa, 4000); s16 iVar10 = i_this->field_0x4000 * cM_ssin(i_this->field_0x3ffa); s16 iVar11 = i_this->field_0x3ffc * cM_ssin(i_this->field_0x3ff8); cLib_addCalc0(&i_this->field_0x3ffc, 1.0f, 40.0f); diff --git a/src/d/actor/d_a_mg_rod.cpp b/src/d/actor/d_a_mg_rod.cpp index 9acbaea735d..92cca278227 100644 --- a/src/d/actor/d_a_mg_rod.cpp +++ b/src/d/actor/d_a_mg_rod.cpp @@ -1318,13 +1318,13 @@ static void lure_cast(dmg_rod_class* i_this) { actor->speedF *= 0.95f + VREG_F(11); sp40.x = 50.0f + VREG_F(12); sp40.y = (0.0105f + TREG_F(10)) * sp4C.abs(); - i_this->field_0x75c += (s16)0x1100; - i_this->field_0x75e += (s16)0x880; + ANGLE_ADD(i_this->field_0x75c, 0x1100); + ANGLE_ADD(i_this->field_0x75e, 0x880); } else { sp40.x = 0.0f; sp40.y = (0.011f + TREG_F(11)) * sp4C.abs(); - i_this->field_0x75c += (s16)0x2200; - i_this->field_0x75e += (s16)0x1100; + ANGLE_ADD(i_this->field_0x75c, 0x2200); + ANGLE_ADD(i_this->field_0x75e, 0x1100); } cLib_addCalc2(&i_this->field_0x6f8, sp40.x, 0.1f, 5.0f); @@ -1677,7 +1677,7 @@ static void po_action(dmg_rod_class* i_this, f32 param_1) { } if (i_this->timers[0] == 1) { - i_this->lure_yaw_target += (s16)cM_rndFX(5000.0f); + ANGLE_ADD(i_this->lure_yaw_target, cM_rndFX(5000.0f)); } cLib_addCalcAngleS2(&i_this->lure_yaw_offset, i_this->lure_yaw_target, 4, var_r26); @@ -1891,8 +1891,8 @@ static void ground_action(dmg_rod_class* i_this) { } } } else if (i_this->field_0x10a8 == 1) { - i_this->lure_yaw_offset += (s16)3200; - i_this->lure_pitch_offset += (s16)4000; + ANGLE_ADD(i_this->lure_yaw_offset, 3200); + ANGLE_ADD(i_this->lure_pitch_offset, 4000); } cLib_addCalc2(&actor->speedF, reelSpeed, 1.0f, 5.0f + BREG_F(12)); @@ -1972,9 +1972,9 @@ static void wd_action(dmg_rod_class* i_this, f32 param_1, wd_ss* i_wd_s) { sp8 -= actor->shape_angle.y; if (sp8 < 0) { - i_wd_s->field_0x38 += (s16)200; + ANGLE_ADD(i_wd_s->field_0x38, 200); } else { - i_wd_s->field_0x38 -= (s16)200; + ANGLE_SUB(i_wd_s->field_0x38, 200); } } } @@ -2525,7 +2525,7 @@ static void lure_catch(dmg_rod_class* i_this) { if (mgfish->mActionPhase < 2 && i_this->play_cam_timer > 25) { s16 target = DREG_S(6) + 2000; if (mgfish->mJointScale > 0.5f) { - target += (s16)((mgfish->mJointScale - 0.5f) * (20000.0f + DREG_F(19))); + ANGLE_ADD(target, (mgfish->mJointScale - 0.5f) * (20000.0f + DREG_F(19))); } if (target > 6000) { @@ -3634,15 +3634,15 @@ static void uki_pl_arm_calc(dmg_rod_class* i_this) { sp10.y = WREG_S(4) - 5000; sp10.z = WREG_S(5) + 2000; - sp8.y += (s16)(-15000.0f * i_this->field_0x1508); - sp8.z += (s16)(3500.0f * i_this->field_0x1508); + ANGLE_ADD(sp8.y, -15000.0f * i_this->field_0x1508); + ANGLE_ADD(sp8.z, 3500.0f * i_this->field_0x1508); - sp10.y += (s16)(-4000.0f * i_this->field_0x1508); - sp10.z += (s16)((3500.0f * i_this->field_0x1508) + ((-11000.0f + WREG_F(8)) * (i_this->field_0x150c * i_this->field_0x1508))); + ANGLE_ADD(sp10.y, -4000.0f * i_this->field_0x1508); + ANGLE_ADD(sp10.z, (3500.0f * i_this->field_0x1508) + ((-11000.0f + WREG_F(8)) * (i_this->field_0x150c * i_this->field_0x1508))); if (i_this->action == ACTION_UKI_HIT && i_this->field_0xf60 > 140.0f + JREG_F(14)) { - sp8.y += (s16)((50.0f + nREG_F(0)) * cM_ssin(i_this->counter * 0x6200)); - sp8.z += (s16)((50.0f + nREG_F(0)) * cM_ssin(i_this->counter * 0x6500)); + ANGLE_ADD(sp8.y, (50.0f + nREG_F(0)) * cM_ssin(i_this->counter * 0x6200)); + ANGLE_ADD(sp8.z, (50.0f + nREG_F(0)) * cM_ssin(i_this->counter * 0x6500)); daAlink_getAlinkActorClass()->seStartOnlyReverbLevel(Z2SE_AL_ROD_BEND); } @@ -3668,7 +3668,7 @@ static void uki_standby(dmg_rod_class* i_this) { cLib_addCalc2(&i_this->field_0x150c, substickX, 0.5f, 0.2f); if (i_this->field_0x1508 > 0.3f && i_this->play_cam_mode < 5) { - i_this->field_0x1418 += (s16)((-500.0f + VREG_F(3)) * mDoCPd_c::getStickX3D(PAD_1)); + ANGLE_ADD(i_this->field_0x1418, (-500.0f + VREG_F(3)) * mDoCPd_c::getStickX3D(PAD_1)); } cMtx_YrotS(*calc_mtx, i_this->field_0x1418); @@ -4638,7 +4638,7 @@ static void play_camera(dmg_rod_class* i_this) { f32 sp40 = i_this->field_0x13ac; sp40 *= 1000.0f + BREG_F(3); - i_this->field_0x141a += (s16)sp40; + ANGLE_ADD(i_this->field_0x141a, sp40); if (i_this->field_0x141a > 0x1000) { i_this->field_0x141a = 0x1000; } else if (i_this->field_0x141a < -0x1000) { @@ -6012,7 +6012,7 @@ static int dmg_rod_Execute(dmg_rod_class* i_this) { s16 sp8 = 500.0f * cM_ssin(i_this->counter * 1100); if (i_this->reel_btn_flags != 0) { - sp8 += (s16)0x2000; + ANGLE_ADD(sp8, 0x2000); } cLib_addCalcAngleS2(&obj_life->shape_angle.x, sp8, 15, 0x200); diff --git a/src/d/actor/d_a_midna.cpp b/src/d/actor/d_a_midna.cpp index afaccaf13be..5f199789291 100644 --- a/src/d/actor/d_a_midna.cpp +++ b/src/d/actor/d_a_midna.cpp @@ -2420,8 +2420,8 @@ s16 daMidna_c::getNeckAimAngle(cXyz const* i_atnPos, s16* o_neckX, s16* o_neckY, *o_eyeY = (s16)(sVar8 - sVar2) >> 1; *o_neckX = *o_eyeX; *o_neckY = *o_eyeY; - *o_eyeX += (s16)(atn_angle_x - sVar7); - *o_eyeY += (s16)(atn_angle_y - sVar8); + ANGLE_ADD(*o_eyeX, atn_angle_x - sVar7); + ANGLE_ADD(*o_eyeY, atn_angle_y - sVar8); } else { *o_neckX = daAlink_getAlinkActorClass()->getProcNeckX(); *o_neckY = daAlink_getAlinkActorClass()->getMidnaProcNeckY(); diff --git a/src/d/actor/d_a_movie_player.cpp b/src/d/actor/d_a_movie_player.cpp index fbee0d4fa5f..f6b727f0cd0 100644 --- a/src/d/actor/d_a_movie_player.cpp +++ b/src/d/actor/d_a_movie_player.cpp @@ -689,17 +689,17 @@ static void __THPDecompressYUV(void* tileY, void* tileU, void* tileV) { if (__THPInfo->xPixelSize == 512 && targetY == 448) { while (currentY < targetY) { __THPDecompressiMCURow512x448(); - currentY += (u16)16; + U16_ADD(currentY, 16); } } else if (__THPInfo->xPixelSize == 640 && targetY == 480) { while (currentY < targetY) { __THPDecompressiMCURow640x480(); - currentY += (u16)16; + U16_ADD(currentY, 16); } } else { while (currentY < targetY) { __THPDecompressiMCURowNxN(); - currentY += (u16)16; + U16_ADD(currentY, 16); } } diff --git a/src/d/actor/d_a_ni.cpp b/src/d/actor/d_a_ni.cpp index 982276ff8bb..5ded6087c41 100644 --- a/src/d/actor/d_a_ni.cpp +++ b/src/d/actor/d_a_ni.cpp @@ -1243,7 +1243,7 @@ static void play_camera(ni_class* i_this) { temp = i_this->mPadSubStickX; temp *= TREG_F(3) + 5000.0f; - i_this->field_0xaf4 += (s16)temp; + S16_ADD(i_this->field_0xaf4, temp); i_this->field_0xafc += i_this->mPadSubStickY * (TREG_F(7) + -25.0f); if (i_this->field_0xafc > (TREG_F(8) + 800.0f)) { diff --git a/src/d/actor/d_a_npc.cpp b/src/d/actor/d_a_npc.cpp index d407d42e7c3..c625bf0cb54 100644 --- a/src/d/actor/d_a_npc.cpp +++ b/src/d/actor/d_a_npc.cpp @@ -2435,7 +2435,7 @@ BOOL daNpcT_c::turn(s16 i_angle, int i_count, int i_direction) { } s16 turn = angle_diff * cM_ssin((s16)mTurnAmount); - mTurnAmount += (s16)(0x4000 / mTurnCount); + ANGLE_ADD(mTurnAmount, 0x4000 / mTurnCount); if ((u16)mTurnAmount < 0x4000) { mCurAngle.y = mStartAngle + turn; @@ -2645,7 +2645,7 @@ void daNpcT_c::setHitodamaPrtcl() { field_0xe00.y = cM_ssin(field_0xe18) * 4.0f; field_0xe00.z = field_0xe00.x * -cM_ssin(shape_angle.y); field_0xe00.x = field_0xe00.x * cM_scos(shape_angle.y); - field_0xe1a += (s16)0x400; + ANGLE_ADD(field_0xe1a, 0x400); pos.x = eyePos.x + field_0xe00.x + field_0xe0c.x; pos.y = eyePos.y + field_0xe00.y + field_0xe0c.y; diff --git a/src/d/actor/d_a_npc4.cpp b/src/d/actor/d_a_npc4.cpp index cf2f71f7039..535355d091c 100644 --- a/src/d/actor/d_a_npc4.cpp +++ b/src/d/actor/d_a_npc4.cpp @@ -1710,7 +1710,7 @@ void daNpcF_c::setHitodamaPrtcl() { field_0x9b8.z = field_0x9b8.x * -cM_ssin(shape_angle.y); field_0x9b8.x *= cM_scos(shape_angle.y); - field_0x9d2 += (s16)0x400; + ANGLE_ADD(field_0x9d2, 0x400); pos.x = eyePos.x + field_0x9b8.x + field_0x9c4.x; pos.y = eyePos.y + field_0x9b8.y + field_0x9c4.y; diff --git a/src/d/actor/d_a_npc_aru.cpp b/src/d/actor/d_a_npc_aru.cpp index 9ad1f1029ac..ef1bb9d3ff7 100644 --- a/src/d/actor/d_a_npc_aru.cpp +++ b/src/d/actor/d_a_npc_aru.cpp @@ -1402,19 +1402,19 @@ int daNpc_Aru_c::duck(int param_1) { switch (field_0xfca) { case 1: - sVar1 -= (s16) 0x1000; + ANGLE_SUB(sVar1, 0x1000); break; case 7: - sVar1 += (s16) 0x1000; + ANGLE_ADD(sVar1, 0x1000); break; case 2: - sVar1 -= (s16) 0x4000; + ANGLE_SUB(sVar1, 0x4000); break; case 6: - sVar1 += (s16) 0x4000; + ANGLE_ADD(sVar1, 0x4000); break; } diff --git a/src/d/actor/d_a_npc_henna.cpp b/src/d/actor/d_a_npc_henna.cpp index 7cb4c9e2ee3..b6936f96f51 100644 --- a/src/d/actor/d_a_npc_henna.cpp +++ b/src/d/actor/d_a_npc_henna.cpp @@ -826,7 +826,7 @@ static void action(npc_henna_class* i_this) { i_this->field_0x6b6 = i_this->field_0x6b0 * (TREG_F(3) + -0.65f); } - i_this->field_0x6b6 += (s16)((0.15f + TREG_F(13)) * fabsf(i_this->field_0x6ac)); + ANGLE_ADD(i_this->field_0x6b6, (0.15f + TREG_F(13)) * fabsf(i_this->field_0x6ac)); s16 sp_0x8 = 0; // unused } diff --git a/src/d/actor/d_a_npc_kn.cpp b/src/d/actor/d_a_npc_kn.cpp index 9378de990db..3419650c5e6 100644 --- a/src/d/actor/d_a_npc_kn.cpp +++ b/src/d/actor/d_a_npc_kn.cpp @@ -4994,22 +4994,14 @@ int daNpc_Kn_c::setSlipPrtcl() { mDoMtx_stack_c::multVecZero(&mParticleMngr[0].mPos); mParticleMngr[0].mPos.y -= 20.0f; mParticleMngr[0].mAngle = current.angle; - #if DEBUG - mParticleMngr[0].mAngle.y -= (s16) 0x8000; - #else - mParticleMngr[0].mAngle.y -= 0x8000; - #endif + ANGLE_SUB_2(mParticleMngr[0].mAngle.y, 0x8000); mParticleMngr[0].mpModel = true; mDoMtx_stack_c::copy(mpModelMorf[0]->getModel()->getAnmMtx(0x1b)); mDoMtx_stack_c::multVecZero(&mParticleMngr[1].mPos); mParticleMngr[1].mPos.y -= 20.0f; mParticleMngr[1].mAngle = current.angle; - #if DEBUG - mParticleMngr[1].mAngle.y -= (s16) 0x8000; - #else - mParticleMngr[1].mAngle.y -= 0x8000; - #endif + ANGLE_SUB_2(mParticleMngr[1].mAngle.y, 0x8000); mParticleMngr[1].mpModel = true; return 1; } diff --git a/src/d/actor/d_a_npc_kn_base.inc b/src/d/actor/d_a_npc_kn_base.inc index 0ee3bb6e337..aa331fb4d52 100644 --- a/src/d/actor/d_a_npc_kn_base.inc +++ b/src/d/actor/d_a_npc_kn_base.inc @@ -1033,7 +1033,7 @@ BOOL daNpc_Kn_c::turn(s16 i_angle, int i_count, int i_direction) { } int offset = angle_diff * cM_ssin((s16)mTurnAmount); - mTurnAmount += (s16)(16384.0f / mTurnCount); + ANGLE_ADD(mTurnAmount, 16384.0f / mTurnCount); if ((u16)mTurnAmount < 0x4000) { mCurAngle.y = mStartAngle + offset; diff --git a/src/d/actor/d_a_npc_ks.cpp b/src/d/actor/d_a_npc_ks.cpp index 6c5d3832f41..fc55d7a6d44 100644 --- a/src/d/actor/d_a_npc_ks.cpp +++ b/src/d/actor/d_a_npc_ks.cpp @@ -681,7 +681,7 @@ static int npc_ks_ori(npc_ks_class* i_this) { if (i_this->timer[0] == 1) { anm_init(i_this, 32, 2.0f, 0, 1.0f); if (fopAcM_GetRoomNo(actor) == 11) { - ADD_ANGLE_2(actor->current.angle.y, 0x1600); + ANGLE_ADD_2(actor->current.angle.y, 0x1600); } } @@ -829,7 +829,7 @@ static int npc_ks_ori2(npc_ks_class* i_this) { break; case 2: - ADD_ANGLE_2(sVar1, -0x8000); + ANGLE_ADD_2(sVar1, -0x8000); if (i_this->timer[0] == 0) { if (cage_p->partBreak()) { anm_init(i_this, 22, 5.0f, 2, 1.0f); @@ -901,7 +901,7 @@ static int npc_ks_ori2(npc_ks_class* i_this) { case 6: i_this->field_0x5fc = 0; fVar1 = -20.0f; - ADD_ANGLE_2(sVar1, 0x2000); + ANGLE_ADD_2(sVar1, 0x2000); if (i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); actor->speedF = 40.0f; @@ -916,7 +916,7 @@ static int npc_ks_ori2(npc_ks_class* i_this) { case 7: i_this->field_0x5fc = 0; - ADD_ANGLE_2(sVar1, 0x4000); + ANGLE_ADD_2(sVar1, 0x4000); actor->gravity = -5.0f; break; @@ -2018,7 +2018,7 @@ static void npc_ks_hang(npc_ks_class* i_this) { s16 sVar2 = i_this->field_0x602; cLib_addCalcAngleS2(&i_this->field_0x602, i_this->field_0x60c * cM_ssin(i_this->field_0x5fa), 4, 0x1000); i_this->field_0x604 = i_this->field_0x602 - sVar2; - i_this->field_0x5fa += (s16) 0x800; + ANGLE_ADD(i_this->field_0x5fa, 0x800); actor->current.angle.z = -(i_this->field_0x602 / 4); if (i_this->mode != 4) { @@ -2162,7 +2162,7 @@ static void npc_ks_hang_s(npc_ks_class* i_this) { s16 sVar2 = i_this->field_0x602; cLib_addCalcAngleS2(&i_this->field_0x602, i_this->field_0x60c * cM_ssin(i_this->field_0x5fa), 4, 0x1000); i_this->field_0x604 = i_this->field_0x602 - sVar2; - ADD_ANGLE_2(i_this->field_0x5fa, 0x800); + ANGLE_ADD_2(i_this->field_0x5fa, 0x800); actor->current.angle.z = -(i_this->field_0x602 / 4); if (i_this->field_0x620 != 2) { @@ -2242,7 +2242,7 @@ static void npc_ks_e_hang(npc_ks_class* i_this) { actor->current.pos = sw_p->field_0x920[i_this->field_0x630]; cLib_addCalcAngleS2(&i_this->field_0x602, i_this->field_0x60c * cM_ssin(i_this->field_0x5fa), 4, 0x1000); - ADD_ANGLE_2(i_this->field_0x5fa, 0x800); + ANGLE_ADD_2(i_this->field_0x5fa, 0x800); actor->current.angle.z = -(i_this->field_0x602 / 4); cLib_addCalc0(&i_this->field_0x60c, 0.5f, 100.0f + TREG_F(3)); } @@ -3877,7 +3877,7 @@ static int npc_ks_option(npc_ks_class* i_this) { case 30: target_speed = l_HIO.holding_speed_h; - ADD_ANGLE_2(i_this->current_angle.y, 0x8000); + ANGLE_ADD_2(i_this->current_angle.y, 0x8000); if (fVar2 > 400.0f) { i_this->mode = 31; anm_init(i_this, 51, 5.0f, 2, 1.0f); @@ -3898,7 +3898,7 @@ static int npc_ks_option(npc_ks_class* i_this) { anm_init(i_this, 39, 5.0f, 2, 1.0f); i_this->mode = 41; i_this->timer[0] = cM_rndF(80.0f) + 100.0f; - ADD_ANGLE_2(i_this->current_angle.y, 0x8000); + ANGLE_ADD_2(i_this->current_angle.y, 0x8000); break; case 41: @@ -5865,7 +5865,7 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) { if (i_this->path_no == 0) { anm_init(i_this, 45, 3.0f, 0, 1.0f); i_this->mode = 3; - ADD_ANGLE_2(i_this->current_angle.y, 0x8000); + ANGLE_ADD_2(i_this->current_angle.y, 0x8000); actor->speedF = 0.0f; } else { i_this->mode = 1; @@ -5878,7 +5878,7 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) { case 3: if (i_this->model->isStop()) { - ADD_ANGLE_2(i_this->current_angle.y, 0x8000); + ANGLE_ADD_2(i_this->current_angle.y, 0x8000); i_this->mode = 1; } break; @@ -5916,7 +5916,7 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) { if (i_this->timer[2] != 0) { i_this->search_time = 10; i_this->find_pos.set(-37799.0f, 815.0f, -22323.0f); - i_this->current_angle.y -= (s16) 0x3000; + ANGLE_SUB(i_this->current_angle.y, 0x3000); sVar1 = 0x800; } diff --git a/src/d/actor/d_a_npc_ne.cpp b/src/d/actor/d_a_npc_ne.cpp index 414022d3777..a02e60a4e38 100644 --- a/src/d/actor/d_a_npc_ne.cpp +++ b/src/d/actor/d_a_npc_ne.cpp @@ -615,7 +615,7 @@ static void npc_ne_away(npc_ne_class* i_this) { way_check(i_this, i_this->mTargetAngleY); } if (i_this->mTimers[0] == 0) { - i_this->mTargetAngleY += (s16)cM_rndFX(4000.0f); + ANGLE_ADD(i_this->mTargetAngleY, cM_rndFX(4000.0f)); i_this->mTimers[0] = cM_rndF(25.0f) + 20.0f; } if (i_this->mDistToTarget > 400.0f && i_this->mTimers[2] == 0) { diff --git a/src/d/actor/d_a_npc_tk.cpp b/src/d/actor/d_a_npc_tk.cpp index e9980c953e0..0bfefbe1d5a 100644 --- a/src/d/actor/d_a_npc_tk.cpp +++ b/src/d/actor/d_a_npc_tk.cpp @@ -456,7 +456,7 @@ void daNPC_TK_c::initPerchDemo(int param_0) { mPathStep2 = cM_rndFX(5.0f); if (mPathStep2 < 0) { - ADD_S8_2(mPathStep2, mpPath1->m_num); + S8_ADD_2(mPathStep2, mpPath1->m_num); } if (mPathStep2 >= mpPath1->m_num || mPathStep2 < 0) { @@ -1128,8 +1128,8 @@ void daNPC_TK_c::executeAway() { } void daNPC_TK_c::setCarryActorMtx() { - field_0x6a8 += (s16)0x6bc; - field_0x6a6 = cM_ssin(field_0x6a8) * 2048.0f + 4096.0f; + ANGLE_ADD(field_0x6a8, 0x6bc); + field_0x6a6 = cM_ssin(field_0x6a8) * (f32)0x800 + (f32)0x1000; if (field_0x634 == NULL) { return; } @@ -1310,8 +1310,7 @@ void daNPC_TK_c::executeBack() { shape_angle.y += field_0x69e; current.angle.y = shape_angle.y; - - shape_angle.x -= (s16)(0x300 + nREG_S(0)); + ANGLE_SUB(shape_angle.x, 0x300 + nREG_S(0)); if (shape_angle.x < -0x3000) { shape_angle.x = -0x3000; diff --git a/src/d/actor/d_a_npc_ykm.cpp b/src/d/actor/d_a_npc_ykm.cpp index 706634a16ef..08b90870929 100644 --- a/src/d/actor/d_a_npc_ykm.cpp +++ b/src/d/actor/d_a_npc_ykm.cpp @@ -2675,7 +2675,7 @@ int daNpc_ykM_c::cutLv5DungeonClear(int i_cutIndex) { if (rv != 0) { angleY = fopAcM_searchActorAngleY(this, player); - angleY += (s16)0x4000; + ANGLE_ADD(angleY, 0x4000); daPy_getPlayerActorClass()->setPlayerPosAndAngle(&player->current.pos, angleY, 0); field_0x1580 = 1; } diff --git a/src/d/actor/d_a_npc_zra.inc b/src/d/actor/d_a_npc_zra.inc index e377682c711..8bca2ba0be9 100644 --- a/src/d/actor/d_a_npc_zra.inc +++ b/src/d/actor/d_a_npc_zra.inc @@ -1936,7 +1936,7 @@ BOOL daNpc_zrA_c::swimRiverDescend(void* param_0) { } if ((player_r26->current.pos - current.pos).absXZ() < 500.0f) { - angle_sp44.x += (s16)0x1000; + ANGLE_ADD(angle_sp44.x, 0x1000); } if (field_0x153c) { diff --git a/src/d/actor/d_a_obj_Y_taihou.cpp b/src/d/actor/d_a_obj_Y_taihou.cpp index 970a5662b3b..b2dd4bfd059 100644 --- a/src/d/actor/d_a_obj_Y_taihou.cpp +++ b/src/d/actor/d_a_obj_Y_taihou.cpp @@ -156,7 +156,7 @@ void daObjYtaihou_c::setMtx() { static f32 l_wheelMinR; static u8 lbl_396_bss_4C; - home.angle.z += (s16) ((s16)(shape_angle.y - old.angle.y) * 0.8f); + ANGLE_ADD(home.angle.z, (s16)(shape_angle.y - old.angle.y) * 0.8f); if ((s8)lbl_396_bss_4C == 0) { l_wheelMinR = cM_scos(0xccc) * 60.0f; lbl_396_bss_4C = 1; diff --git a/src/d/actor/d_a_obj_bhashi.cpp b/src/d/actor/d_a_obj_bhashi.cpp index a09728a02cc..42b29b43ae6 100644 --- a/src/d/actor/d_a_obj_bhashi.cpp +++ b/src/d/actor/d_a_obj_bhashi.cpp @@ -316,8 +316,8 @@ void Hahen_c::Roll_Set(cXyz* i_pos, f32 param_1, s16 i_no) { rot_speed.x = cM_rndFX(5000.0f + nREG_F(6)); rot_speed.y = cM_rndFX(5000.0f + nREG_F(6)); - rotation.x += (s16)0x1000; - rotation.y += (s16)0x1000; + ANGLE_ADD(rotation.x, 0x1000); + ANGLE_ADD(rotation.y, 0x1000); } void daObjBHASHI_c::setBaseMtx() { diff --git a/src/d/actor/d_a_obj_brg.cpp b/src/d/actor/d_a_obj_brg.cpp index dbe848e6d3a..243f10f978c 100644 --- a/src/d/actor/d_a_obj_brg.cpp +++ b/src/d/actor/d_a_obj_brg.cpp @@ -674,7 +674,7 @@ static void obj_brg_move(obj_brg_class* i_this) { i_this->field_0xaf1c = 3; /* fallthrough */ case 3: { - i_this->field_0xaf1e += (s16) 3000; + ANGLE_ADD(i_this->field_0xaf1e, 3000); part->field_0x0b0 = a_this->home.pos; if ((i_this->mType & 1) == 1) { @@ -871,7 +871,7 @@ static void obj_brg_move(obj_brg_class* i_this) { } cLib_addCalc0(&i_this->field_0xaef4, 0.05f, 80.0f); - i_this->field_0xaf2e += (s16) 4500; + ANGLE_ADD(i_this->field_0xaf2e, 4500); if (i_this->field_0xb1ec) { spDC = i_this->mEndPos; diff --git a/src/d/actor/d_a_obj_carry.cpp b/src/d/actor/d_a_obj_carry.cpp index c41fdc88e70..a666ca8d439 100644 --- a/src/d/actor/d_a_obj_carry.cpp +++ b/src/d/actor/d_a_obj_carry.cpp @@ -3917,8 +3917,8 @@ void daObjCarry_c::calc_rot_axis_tsubo() { mDoMtx_stack_c::YrotS(current.angle.y); mDoMtx_stack_c::multVec(&mRotAxis, &mRotAxis); } - - mRotation += (s16)(((0.5f * field_0xd70) + data().m_urnRotateFactor) * (std::fabs(speedF) + std::fabs(speed.y))); + ANGLE_ADD(mRotation, ((0.5f * field_0xd70) + data().m_urnRotateFactor) * + (std::fabs(speedF) + std::fabs(speed.y))); break; case 3: sp20 = current.pos - old.pos; @@ -3930,8 +3930,8 @@ void daObjCarry_c::calc_rot_axis_tsubo() { mDoMtx_stack_c::multVec(&mRotAxis, &mRotAxis); } } - - mRotation += (s16)(((0.5f * field_0xd70) + data().m_urnRotateFactor) * (std::fabs(speedF) + std::fabs(speed.y))); + ANGLE_ADD(mRotation, ((0.5f * field_0xd70) + data().m_urnRotateFactor) * + (std::fabs(speedF) + std::fabs(speed.y))); break; } } @@ -3951,7 +3951,7 @@ void daObjCarry_c::calc_rot_axis_kibako() { cXyz sp8 = current.pos - old.pos; if (mMode == MODE_DROP) { - mRotation += (s16)(speedF * ((field_0xd70 * 0.5f) + data().m_urnRotateFactor)); + ANGLE_ADD(mRotation, speedF * ((field_0xd70 * 0.5f) + data().m_urnRotateFactor)); } else { mRotation = 0; } @@ -3984,7 +3984,8 @@ void daObjCarry_c::calc_rot_axis_bokkuri() { mDoMtx_stack_c::multVec(&mRotAxis, &mRotAxis); } - mRotation += (s16)(((0.5f * field_0xd70) + data().m_urnRotateFactor) * (std::fabs(speedF) + std::fabs(speed.y))); + ANGLE_ADD(mRotation, ((0.5f * field_0xd70) + data().m_urnRotateFactor) * + (std::fabs(speedF) + std::fabs(speed.y))); } } else if (mMode == MODE_WALK || mMode == MODE_WAIT) { mRotAxis = cXyz::Zero; diff --git a/src/d/actor/d_a_obj_chandelier.cpp b/src/d/actor/d_a_obj_chandelier.cpp index bdcf4b19830..ff512a87eb5 100644 --- a/src/d/actor/d_a_obj_chandelier.cpp +++ b/src/d/actor/d_a_obj_chandelier.cpp @@ -182,8 +182,8 @@ void daObjChandelier_c::setModelMtx() { void daObjChandelier_c::moveSwing(f32 param_0, f32 param_1, f32 param_2, f32 param_3) { f32 f1 = -param_1 + param_0 * field_0x5fc; - shape_angle.z += (s16)(field_0x608 * (f1 * field_0x5ec)); - shape_angle.y += (s16)(field_0x608 * field_0x604 * field_0x5ec); + ANGLE_ADD(shape_angle.z, field_0x608 * (f1 * field_0x5ec)); + ANGLE_ADD(shape_angle.y, field_0x608 * field_0x604 * field_0x5ec); if (f1 > param_1) { field_0x5fc = 0; field_0x608 *= -1; @@ -209,7 +209,7 @@ void daObjChandelier_c::moveSwingFall() { cLib_chaseF(&field_0x5ec, 0.0f, 0.04f); field_0x608 *= -1; shape_angle.z = field_0x608 * 50.0f * field_0x5ec; - shape_angle.y += (s16)cM_rndFX(50.0f); + ANGLE_ADD(shape_angle.y, cM_rndFX(50.0f)); cXyz vec1 = field_0x5a8; mDoMtx_stack_c::transS(vec1); mDoMtx_stack_c::ZXYrotM(shape_angle); diff --git a/src/d/actor/d_a_obj_crvgate.cpp b/src/d/actor/d_a_obj_crvgate.cpp index d781f0bc180..58be175cafe 100644 --- a/src/d/actor/d_a_obj_crvgate.cpp +++ b/src/d/actor/d_a_obj_crvgate.cpp @@ -170,8 +170,7 @@ void daObjCRVGATE_c::actionDemoEvent() { } } else { cLib_chaseAngleS(&mDoorOpenAngle.x, 0x4000, mMoveAngle.z); - - mMoveAngle.z += (s16)0x300; + ANGLE_ADD(mMoveAngle.z, 0x300); if (mDoorOpenAngle.x == 0x4000) { mEventID = 3; camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); @@ -224,7 +223,7 @@ int daObjCRVGATE_c::CheckVec() { } void daObjCRVGATE_c::KeyVib() { - mMoveAngle.x -= (s16)0x21; + ANGLE_SUB(mMoveAngle.x, 0x21); mMoveAngle.z += mMoveAngle.x; cLib_chaseAngleS(&mMoveAngle.y, 0, 0x150); @@ -249,7 +248,7 @@ void daObjCRVGATE_c::KeyVib() { } void daObjCRVGATE_c::DoorVib() { - mDoorVib.y -= (s16)(KREG_S(1) + 0x100); + ANGLE_SUB(mDoorVib.y, KREG_S(1) + 0x100); mDoorVib.z += mDoorVib.y; cLib_chaseAngleS(&mDoorVib.x, 0, 0x40); diff --git a/src/d/actor/d_a_obj_flag.cpp b/src/d/actor/d_a_obj_flag.cpp index 1a4f266c2d8..7443e8fa3f0 100644 --- a/src/d/actor/d_a_obj_flag.cpp +++ b/src/d/actor/d_a_obj_flag.cpp @@ -106,8 +106,7 @@ void daObjFlag_c::calcJointAngle() { } else { param_0->mJoint1.z = (attr().field_0x0e * cM_ssin(param_0->mRv)); } - - param_0->mRv += (s16)(param_1 * attr().field_0x30); + ANGLE_ADD(param_0->mRv, param_1 * attr().field_0x30); } void daObjFlag_c::calcAngleSwingX(FlagJoint_c* param_0, f32 param_1) { diff --git a/src/d/actor/d_a_obj_food.cpp b/src/d/actor/d_a_obj_food.cpp index e416af3bf07..54e30faf14a 100644 --- a/src/d/actor/d_a_obj_food.cpp +++ b/src/d/actor/d_a_obj_food.cpp @@ -170,8 +170,7 @@ static void food_normal(obj_food_class* i_this) { Z2GetAudioMgr()->seStart(Z2SE_OBJ_TOY_BONE_BOUND, &i_this->current.pos, fabsf(i_this->mOldSpeedY), 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); - - i_this->current.angle.y += (s16)cM_rndFX(8000.0f); + ANGLE_ADD(i_this->current.angle.y, cM_rndFX(8000.0f)); if (i_this->mBounces == 3) { i_this->mRotSpeed.z = 0; @@ -271,7 +270,7 @@ static void action(obj_food_class* i_this) { } if (i_this->mType == obj_food_class::TYPE_BALL) { - i_this->current.angle.x += (s16)(i_this->speedF * 700.0f); + ANGLE_ADD(i_this->current.angle.x, i_this->speedF * 700.0f); cMtx_YrotS(*calc_mtx, i_this->current.angle.y); vec1.x = 0.0f; vec1.y = 0.0f; diff --git a/src/d/actor/d_a_obj_gadget.cpp b/src/d/actor/d_a_obj_gadget.cpp index 43291977249..43b33177702 100644 --- a/src/d/actor/d_a_obj_gadget.cpp +++ b/src/d/actor/d_a_obj_gadget.cpp @@ -305,7 +305,8 @@ int daObj_Gadget_c::Execute() { if (getWallAngle(current.angle.y, &wallAngle)) { field_0x9f4 = 10; s16 angleDiff = current.angle.y - wallAngle; - current.angle.y += (s16)((0x8000 - (angleDiff * 2)) + (s16)cM_rndFX(2000.0f)); + ANGLE_ADD(current.angle.y, + (0x8000 - (angleDiff * 2)) + (s16)cM_rndFX(2000.0f)); field_0x9ec.y = -field_0x9ec.y / 2; speedF *= 0.3f; } @@ -318,7 +319,8 @@ int daObj_Gadget_c::Execute() { if (mAcch.ChkWallHit()) { if (getWallAngle(current.angle.y, &wallAngle)) { s16 angleDiff = current.angle.y - wallAngle; - current.angle.y += (s16)((0x8000 - (angleDiff << 1)) + (s16)cM_rndFX(1000.0f)); + ANGLE_ADD(current.angle.y, + (0x8000 - (angleDiff << 1)) + (s16)cM_rndFX(1000.0f)); speedF *= 0.5f; } } diff --git a/src/d/actor/d_a_obj_gm.cpp b/src/d/actor/d_a_obj_gm.cpp index 714b2ba2fc2..1b334ac4b34 100644 --- a/src/d/actor/d_a_obj_gm.cpp +++ b/src/d/actor/d_a_obj_gm.cpp @@ -437,7 +437,8 @@ static void drop(obj_gm_class* i_this) { i_this->mTimers[0] = 10; s16 wallAngle = wall_angle_get(i_this); if (a_this->speedF > 5.0f && wallAngle != 35) { - i_this->field_0x720 += (s16)(0x8000 - ((s16)(i_this->field_0x720 - wallAngle) << 1)); + ANGLE_ADD(i_this->field_0x720, 0x8000 - ((s16)(i_this->field_0x720 - wallAngle) << 1)); + i_this->field_0x722 *= -1; i_this->mTimers[0] = 10; a_this->speedF *= AREG_F(4) + 0.35f; diff --git a/src/d/actor/d_a_obj_gra2_base.inc b/src/d/actor/d_a_obj_gra2_base.inc index 9af48bb8961..a7b10b987a7 100644 --- a/src/d/actor/d_a_obj_gra2_base.inc +++ b/src/d/actor/d_a_obj_gra2_base.inc @@ -237,7 +237,7 @@ int daObj_GrA_c::startDemo(void* param_1) { gra_p->setFaceMotion(12, -1.0f); gra_p->setLookMode(0); - current.angle.y += (s16) 0x4000; + ANGLE_ADD(current.angle.y, 0x4000); field_0x91a.y = shape_angle.y = current.angle.y; } diff --git a/src/d/actor/d_a_obj_h_saku.cpp b/src/d/actor/d_a_obj_h_saku.cpp index 7461add608e..dc814a0fa57 100644 --- a/src/d/actor/d_a_obj_h_saku.cpp +++ b/src/d/actor/d_a_obj_h_saku.cpp @@ -120,10 +120,10 @@ void daObjH_Saku_c::Action() { shape_angle.y += field_0x5d6.y; shape_angle.x += field_0x5d6.x; - shape_angle.z -= (s16)0x100; + ANGLE_SUB(shape_angle.z, 0x100); field_0x5bc.y += field_0x5d0.y * 1.5f; field_0x5bc.x += field_0x5d0.x; - field_0x5bc.z -= (s16)0x100; + ANGLE_SUB(field_0x5bc.z, 0x100); break; case 2: @@ -143,9 +143,9 @@ void daObjH_Saku_c::Action() { if (field_0x5dd != 0) { if (speed.y > 0.0f) { - shape_angle.z += (s16)0x400; + ANGLE_ADD(shape_angle.z, 0x400); } else { - shape_angle.z -= (s16)0x400; + ANGLE_SUB(shape_angle.z, 0x400); } cLib_chaseAngleS(&shape_angle.x, 0x4000, field_0x5d6.x); @@ -181,9 +181,9 @@ void daObjH_Saku_c::Action() { if (field_0x5dc != 0) { if (field_0x5b0.y > 0.0f) { - field_0x5bc.z += (s16)0x400; + ANGLE_ADD(field_0x5bc.z, 0x400); } else { - field_0x5bc.z -= (s16)0x400; + ANGLE_SUB(field_0x5bc.z, 0x400); } cLib_chaseAngleS(&field_0x5bc.x, -0x4000, field_0x5d6.x); diff --git a/src/d/actor/d_a_obj_hb.cpp b/src/d/actor/d_a_obj_hb.cpp index 9f3d9040668..de047bb066a 100644 --- a/src/d/actor/d_a_obj_hb.cpp +++ b/src/d/actor/d_a_obj_hb.cpp @@ -236,7 +236,7 @@ static void obj_hb_drop(obj_hb_class* i_this) { if (wall_angle != 35) { s16 angle_delta = a_this->current.angle.y - wall_angle; i_this->field_0x690 = angle_delta * (WREG_F(6) + -0.3f); - a_this->current.angle.y += (s16)(0x8000 - (angle_delta << 1)); + ANGLE_ADD(a_this->current.angle.y, 0x8000 - (angle_delta << 1)); a_this->speedF *= AREG_F(4) + 0.5f; i_this->mTimers[0] = 10; i_this->mSound.startCollisionSE(Z2SE_HIT_SWORD, 41); @@ -369,8 +369,8 @@ static void obj_hb_float(obj_hb_class* i_this) { i_this->field_0x676.x = i_this->field_0x694 * cM_ssin(i_this->field_0x650 * (WREG_S(3) + 1000)); i_this->field_0x676.z = i_this->field_0x694 * cM_ssin(i_this->field_0x650 * (WREG_S(4) + 1100)); cLib_addCalc2(&i_this->field_0x694, 500.0f, 0.1f, 30.0f); - i_this->field_0x676.x += (s16)(i_this->field_0x698 * cM_ssin(i_this->field_0x650 * (WREG_S(7) + 4000))); - a_this->shape_angle.z += (s16)(i_this->field_0x698 * cM_ssin(i_this->field_0x650 * (WREG_S(8) + 4200))); + ANGLE_ADD(i_this->field_0x676.x, i_this->field_0x698 * cM_ssin(i_this->field_0x650 * (WREG_S(7) + 4000))); + ANGLE_ADD(a_this->shape_angle.z, i_this->field_0x698 * cM_ssin(i_this->field_0x650 * (WREG_S(8) + 4200))); cLib_addCalc2(&i_this->field_0x698, 0.0f, 0.1f, 30.0f); i_this->field_0x676.y += i_this->field_0x690; @@ -416,7 +416,7 @@ static void action(obj_hb_class* i_this) { s16 target = fopAcM_searchPlayerAngleY(a_this); s16 angle_delta = i_this->field_0x676.y - target; if (angle_delta > 0x4000 || angle_delta < -0x4000) { - ADD_ANGLE(target, 0x8000); + ANGLE_ADD(target, 0x8000); } cLib_addCalcAngleS2(&i_this->field_0x676.y, target, 4, 0x100); } diff --git a/src/d/actor/d_a_obj_ihasi.cpp b/src/d/actor/d_a_obj_ihasi.cpp index fe3219ee6cb..f0feb4a3b94 100644 --- a/src/d/actor/d_a_obj_ihasi.cpp +++ b/src/d/actor/d_a_obj_ihasi.cpp @@ -170,11 +170,11 @@ static int daObj_Ihasi_Create(fopAc_ac_c* i_actor) { fopAcM_create(PROC_E_S1, param1, &pos, fopAcM_GetRoomNo(i_actor), &angle, NULL, -1); pos.set(35250.0f, -300.0f, -43500.0f); - angle.y += (s16)0x5555; + ANGLE_ADD(angle.y, 0x5555); fopAcM_create(PROC_E_S1, param1, &pos, fopAcM_GetRoomNo(i_actor), &angle, NULL, -1); pos.set(34250.0f, -300.0f, -43500.0f); - angle.y += (s16)0x5555; + ANGLE_ADD(angle.y, 0x5555); fopAcM_create(PROC_E_S1, param1, &pos, fopAcM_GetRoomNo(i_actor), &angle, NULL, -1); return cPhs_ERROR_e; diff --git a/src/d/actor/d_a_obj_itamato.cpp b/src/d/actor/d_a_obj_itamato.cpp index 92d15e694f3..c4c4775bf2c 100644 --- a/src/d/actor/d_a_obj_itamato.cpp +++ b/src/d/actor/d_a_obj_itamato.cpp @@ -411,11 +411,11 @@ void daObj_ItaMato_c::setSwayParam(fopAc_ac_c* i_actor) { case 6: case 7: if (mCutType == 3) { - field_0xa02 -= (s16)0x4000; + ANGLE_SUB(field_0xa02, 0x4000); } - + if (mCutType == 4) { - field_0xa02 += (s16)0x4000; + ANGLE_ADD(field_0xa02, 0x4000); } fVar1 = 0.6f; diff --git a/src/d/actor/d_a_obj_ito.cpp b/src/d/actor/d_a_obj_ito.cpp index 87de60ae465..967b00815a0 100644 --- a/src/d/actor/d_a_obj_ito.cpp +++ b/src/d/actor/d_a_obj_ito.cpp @@ -483,8 +483,7 @@ static void action(obj_ito_class* i_this) { MtxPull(); *pcVar1 = (*pcVar2 + (sp10c * j)) + spf4; - sVar5 += (s16)((TREG_F(13) + 2200.0f) + (TREG_F(12) + 1500.0f) * cM_ssin(j * (BREG_S(0) + 5000) + i * (BREG_S(1) + 3000))); - + ANGLE_ADD(sVar5, (TREG_F(13) + 2200.0f) + (TREG_F(12) + 1500.0f) * cM_ssin(j * (BREG_S(0) + 5000) + i * (BREG_S(1) + 3000))); if (j >= 10) { fVar1 -= fVar2; sVar3 -= sVar4; diff --git a/src/d/actor/d_a_obj_kago.cpp b/src/d/actor/d_a_obj_kago.cpp index 311f092bfe2..9b0361f48ad 100644 --- a/src/d/actor/d_a_obj_kago.cpp +++ b/src/d/actor/d_a_obj_kago.cpp @@ -298,9 +298,9 @@ int daObj_Kago_c::Execute() { if (field_0xb48 == 0 && mObjAcch.ChkWallHit() != 0) { if (getWallAngle(current.angle.y, &sVar2)) { current.angle.y = sVar2; - current.angle.y += (s16)cM_rndFX(2000.0f); + ANGLE_ADD(current.angle.y, cM_rndFX(2000.0f)); } else { - current.angle.y += (s16)cM_rndFX(2000.0f); + ANGLE_ADD(current.angle.y, cM_rndFX(2000.0f)); current.angle.y += -0x8000; } diff --git a/src/d/actor/d_a_obj_kamakiri.cpp b/src/d/actor/d_a_obj_kamakiri.cpp index 91139f6587f..b8cc58c5fa4 100644 --- a/src/d/actor/d_a_obj_kamakiri.cpp +++ b/src/d/actor/d_a_obj_kamakiri.cpp @@ -273,10 +273,10 @@ void daObjKAM_c::WallWalk() { field_0x99a.z = -cM_atan2s(normal->x, normYzMag); field_0x99a.x = cM_atan2s(normal->z, normal->y); } else { - field_0x990 += (s16)0x100; + ANGLE_ADD(field_0x990, 0x100); } } else { - field_0x990 += (s16)0x100; + ANGLE_ADD(field_0x990, 0x100); } cLib_addCalcAngleS2(¤t.angle.y, field_0x990, 0x10, 0x50); @@ -773,7 +773,7 @@ int daObjKAM_c::create() { field_0x9c0 = fopAcM_GetParam(this) & 0xf; if (field_0x9c0 == 2) { field_0x56c = 0; - shape_angle.x -= (s16)0x2000; + ANGLE_SUB(shape_angle.x, 0x2000); fopAcM_OnStatus(this, fopAcM_STATUS_UNK_0x4000); } else { mDraw = true; diff --git a/src/d/actor/d_a_obj_kanban2.cpp b/src/d/actor/d_a_obj_kanban2.cpp index 46fbae0f182..867152267b4 100644 --- a/src/d/actor/d_a_obj_kanban2.cpp +++ b/src/d/actor/d_a_obj_kanban2.cpp @@ -1377,7 +1377,7 @@ void daObj_Kanban2_c::executeFloat() { if (!float_damage_check()) { field_0x5e8.x += 0x400; - field_0x5ee.x += (s16)(70.0f * cM_ssin(field_0x5e8.x)); + ANGLE_ADD(field_0x5ee.x, 70.0f * cM_ssin(field_0x5e8.x)); if (current.pos.y >= field_0x604) { current.pos.y = field_0x604; diff --git a/src/d/actor/d_a_obj_katatsumuri.cpp b/src/d/actor/d_a_obj_katatsumuri.cpp index 115d0dfaddf..d3fd476cd50 100644 --- a/src/d/actor/d_a_obj_katatsumuri.cpp +++ b/src/d/actor/d_a_obj_katatsumuri.cpp @@ -233,7 +233,7 @@ void daObjKAT_c::WallWalk() { field_0x7c2.x = cM_atan2s(unkXyzP2->z, unkXyzP2->y); field_0x7f6 = cM_atan2s(unkXyzP2->x, unkXyzP2->z); } else { - field_0x7e0 += (s16)0x100; + ANGLE_ADD(field_0x7e0, 0x100); } } @@ -702,7 +702,7 @@ int daObjKAT_c::create() { field_0x808 = fopAcM_GetParam(this) & 0xf; if (field_0x808 == 2) { field_0x56c = 0; - shape_angle.x += (s16)-0x2000; + ANGLE_ADD(shape_angle.x, -0x2000); fopAcM_OnStatus(this, 0x4000); } else { mDraw = true; diff --git a/src/d/actor/d_a_obj_kbacket.cpp b/src/d/actor/d_a_obj_kbacket.cpp index 601aa2c73e6..24ef2eae4d0 100644 --- a/src/d/actor/d_a_obj_kbacket.cpp +++ b/src/d/actor/d_a_obj_kbacket.cpp @@ -284,9 +284,9 @@ int daObj_KBacket_c::Execute() { if (field_0x9f4 == 0 && mObjAcch.ChkWallHit() != 0) { if (getWallAngle(current.angle.y, &wallAngle) != 0) { current.angle.y = wallAngle; - current.angle.y += (s16)cM_rndFX(2000.0f); + ANGLE_ADD(current.angle.y, cM_rndFX(2000.0f)); } else { - current.angle.y += (s16)cM_rndFX(2000.0f); + ANGLE_ADD(current.angle.y, cM_rndFX(2000.0f)); current.angle.y += -0x8000; } @@ -340,8 +340,7 @@ int daObj_KBacket_c::Execute() { wallAngleDiff = current.angle.y; } - current.angle.y += (s16)((s16)cM_rndFX(1000.0f) + (0x8000 - wallAngleDiff * 2)); - + ANGLE_ADD(current.angle.y, (s16)cM_rndFX(1000.0f) + (0x8000 - wallAngleDiff * 2)); speedF *= 0.5f; field_0xa47 = 0; @@ -417,7 +416,7 @@ int daObj_KBacket_c::Execute() { } shape_angle.x = field_0xa10 * cM_ssin(field_0xa14 * 1000); - shape_angle.z += (s16)(field_0xa10 * cM_scos(field_0xa14 * 1000)); + ANGLE_ADD(shape_angle.z, field_0xa10 * cM_scos(field_0xa14 * 1000)); cLib_chaseAngleS(&field_0x9ec.y, 0, 10); shape_angle.y += field_0x9ec.y; diff --git a/src/d/actor/d_a_obj_kbox.cpp b/src/d/actor/d_a_obj_kbox.cpp index 968d2a073e4..655f6257202 100644 --- a/src/d/actor/d_a_obj_kbox.cpp +++ b/src/d/actor/d_a_obj_kbox.cpp @@ -232,8 +232,8 @@ static void kbox_float(obj_kbox_class* i_this) { a_this->shape_angle.x = i_this->field_0x594 * cM_ssin((i_this->field_0x578 * 1000)); a_this->shape_angle.z = i_this->field_0x594 * cM_ssin((i_this->field_0x578 * 1100)); cLib_addCalc2(&i_this->field_0x594, 500.0f, 0.1f, 30.0f); - a_this->shape_angle.x += (s16)(i_this->field_0x598 * cM_ssin((i_this->field_0x578 * 4000))); - a_this->shape_angle.z += (s16)(i_this->field_0x598 * cM_ssin((i_this->field_0x578 * 4200))); + ANGLE_ADD(a_this->shape_angle.x, i_this->field_0x598 * cM_ssin(i_this->field_0x578 * 4000)); + ANGLE_ADD(a_this->shape_angle.z, i_this->field_0x598 * cM_ssin(i_this->field_0x578 * 4200)); cLib_addCalc2(&i_this->field_0x598, 0, 0.1f, 30.0f); i_this->field_0x58c = 30.0f; cLib_addCalc2(&i_this->field_0x5a4, i_this->field_0x5a8, 0.2f, 20.0f); diff --git a/src/d/actor/d_a_obj_key.cpp b/src/d/actor/d_a_obj_key.cpp index 873b1f71e97..3ba6a097c85 100644 --- a/src/d/actor/d_a_obj_key.cpp +++ b/src/d/actor/d_a_obj_key.cpp @@ -366,7 +366,7 @@ static void chain_control_01(obj_key_class* i_this) { } cXyz sp88; - i_this->field_0x612 += (s16)3000; + ANGLE_ADD(i_this->field_0x612, 3000); i_this->field_0x614 += i_this->field_0x616; cMtx_YrotS(*calc_mtx, i_this->field_0x614); @@ -454,7 +454,7 @@ static void chain_control_01(obj_key_class* i_this) { MtxTrans(i_this->key_s.pos[i].x, i_this->key_s.pos[i].y, i_this->key_s.pos[i].z, 0); cMtx_XrotM(*calc_mtx, i_this->key_s.angle[i].x); cMtx_YrotM(*calc_mtx, i_this->key_s.angle[i].y); - spA += (s16)(TREG_S(8) + 0x4000); + ANGLE_ADD(spA, TREG_S(8) + 0x4000); if (i == 1) { var_f28 = actor->scale.x; diff --git a/src/d/actor/d_a_obj_keyhole.cpp b/src/d/actor/d_a_obj_keyhole.cpp index 73733ebfed9..e3562dd4d11 100644 --- a/src/d/actor/d_a_obj_keyhole.cpp +++ b/src/d/actor/d_a_obj_keyhole.cpp @@ -367,7 +367,7 @@ static void chain_move(obj_keyhole_class* i_this) { cMtx_YrotM(*calc_mtx, 0x4000); chain->model[j]->setBaseTRMtx(*calc_mtx); - sp8 += (s16)(TREG_S(0) + 0x3D00); + ANGLE_ADD(sp8, TREG_S(0) + 0x3D00); } } } diff --git a/src/d/actor/d_a_obj_lv6elevta.cpp b/src/d/actor/d_a_obj_lv6elevta.cpp index b084decccfd..97495730e09 100644 --- a/src/d/actor/d_a_obj_lv6elevta.cpp +++ b/src/d/actor/d_a_obj_lv6elevta.cpp @@ -172,9 +172,9 @@ int daObjLv6ElevtA_c::Execute(Mtx** i_pMtx) { if (mMode == 2) { #if DEBUG - mAngle += (s16)((f32)0x3fff / l_HIO.mRightAngleTurnFrameCount); + ANGLE_ADD(mAngle, (f32)0x3fff / l_HIO.mRightAngleTurnFrameCount); #else - mAngle += (s16)((f32)0x3fff / 150); + ANGLE_ADD(mAngle, (f32)0x3fff / 150); #endif if (mAngle > 0x3fff) { mAngle = 0x3fff; @@ -183,9 +183,9 @@ int daObjLv6ElevtA_c::Execute(Mtx** i_pMtx) { moveAngle(found); } else if (mMode == 3) { #if DEBUG - mAngle -= (s16)((f32)0x3fff / l_HIO.mRightAngleTurnFrameCount); + ANGLE_SUB(mAngle, (f32)0x3fff / l_HIO.mRightAngleTurnFrameCount); #else - mAngle -= (s16)((f32)0x3fff / 150); + ANGLE_SUB(mAngle, (f32)0x3fff / 150); #endif if (mAngle < -0x3fff) { mAngle = -0x3fff; @@ -195,9 +195,9 @@ int daObjLv6ElevtA_c::Execute(Mtx** i_pMtx) { } else if (mMode == 1) { if (mAngle > 0) { #if DEBUG - mAngle -= (s16)((f32)0x3fff / l_HIO.mRightAngleTurnFrameCount); + ANGLE_SUB(mAngle, (f32)0x3fff / l_HIO.mRightAngleTurnFrameCount); #else - mAngle -= (s16)((f32)0x3fff / 150); + ANGLE_SUB(mAngle, (f32)0x3fff / 150); #endif if (mAngle < 0) { mAngle = 0; @@ -207,9 +207,9 @@ int daObjLv6ElevtA_c::Execute(Mtx** i_pMtx) { } else if (mAngle < 0) { #if DEBUG - mAngle += (s16)((f32)0x3fff / l_HIO.mRightAngleTurnFrameCount); + ANGLE_ADD(mAngle, (f32)0x3fff / l_HIO.mRightAngleTurnFrameCount); #else - mAngle += (s16)((f32)0x3fff / 150); + ANGLE_ADD(mAngle, (f32)0x3fff / 150); #endif if (mAngle > 0) { mAngle = 0; diff --git a/src/d/actor/d_a_obj_mie.cpp b/src/d/actor/d_a_obj_mie.cpp index 9a42ab6d07e..fb41e1edb8b 100644 --- a/src/d/actor/d_a_obj_mie.cpp +++ b/src/d/actor/d_a_obj_mie.cpp @@ -218,7 +218,7 @@ int daObj_Mie_c::Execute() { { field_0x9f4 = 10; s16 local_b4 = current.angle.y - local_b6; - current.angle.y += (s16)(0x8000 - (local_b4 << 1) + (s16)cM_rndFX(2000.0f)); + ANGLE_ADD(current.angle.y, 0x8000 - (local_b4 << 1) + (s16)cM_rndFX(2000.0f)); field_0x9ec.y = -field_0x9ec.y / 2; speedF *= 0.3f; } @@ -233,7 +233,7 @@ int daObj_Mie_c::Execute() { getWallAngle(current.angle.y, &local_b6) != 0) { s16 local_b4 = current.angle.y - local_b6; - current.angle.y += (s16)(0x8000 - (local_b4 << 1) + (s16)cM_rndFX(1000.0f)); + ANGLE_ADD(current.angle.y, 0x8000 - (local_b4 << 1) + (s16)cM_rndFX(1000.0f)); speedF *= 0.5f; } if (mAcch.ChkGroundLanding()) { diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index 319bb9746e7..2c19743070d 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -1083,7 +1083,7 @@ void daObjMovebox::Act_c::mode_afl() { var_f31 = -var_f30 * attr().field_0x6c; } - field_0x8b8 += (s16)(attr().mWaterOscillationAngleSpeed * (cM_rnd() + 1.0f)); + S16_ADD(field_0x8b8, attr().mWaterOscillationAngleSpeed * (cM_rnd() + 1.0f)); newGravity = var_f31 * attr().mBuoyancy + attr().mGravity + attr().mWaterOscillationAccel * cM_ssin(field_0x8b8) + field_0x8bc; fopAcM_SetGravity(this, newGravity); diff --git a/src/d/actor/d_a_obj_msima.cpp b/src/d/actor/d_a_obj_msima.cpp index db66eeb6084..d6ffe7692a3 100644 --- a/src/d/actor/d_a_obj_msima.cpp +++ b/src/d/actor/d_a_obj_msima.cpp @@ -265,7 +265,7 @@ static void chain_move(obj_msima_class* i_this, ms_chain_s* param_2, int param_3 mDoMtx_stack_c::YrotM(a_this->shape_angle.y + (param_3 << 14)); s16 zRot = 0; for (int i = 0; i < 35; i++) { - zRot += (s16)((s16)cM_rndFX2(3000.0f) + 0x4000); + ANGLE_ADD(zRot, (s16)cM_rndFX2(3000.0f) + 0x4000); mDoMtx_stack_c::push(); mDoMtx_stack_c::scaleM(scale, scale, scale); mDoMtx_stack_c::XrotM(0x4000); @@ -298,7 +298,7 @@ static void chain_move2(obj_msima_class* i_this, ms_chain_s* param_2, int param_ mDoMtx_stack_c::transS(local_5c.x, local_5c.y, local_5c.z); f32 dVar10 = 1.0f; for (int i = 0; i < 35; i++) { - zRot += (s16)((s16)cM_rndFX2(3000.0f) + 0x4000); + ANGLE_ADD(zRot, (s16)cM_rndFX2(3000.0f) + 0x4000); if (i > 5) { dVar10 = 0.8f * (i - 5) + 1.0f; } diff --git a/src/d/actor/d_a_obj_pillar.cpp b/src/d/actor/d_a_obj_pillar.cpp index 80f0eb6dee4..24064df7526 100644 --- a/src/d/actor/d_a_obj_pillar.cpp +++ b/src/d/actor/d_a_obj_pillar.cpp @@ -428,7 +428,7 @@ int daPillar_c::Execute(Mtx** param_0) { } if (shape_angle.x != 0) { - mRotY += (s16)(mShakeData.mSpeedY + (0x300 / shape_angle.x)); + ANGLE_ADD(mRotY, mShakeData.mSpeedY + (0x300 / shape_angle.x)); } *param_0 = &mBgMtx; diff --git a/src/d/actor/d_a_obj_pumpkin.cpp b/src/d/actor/d_a_obj_pumpkin.cpp index c2e8e6e8aba..57e374dc9f1 100644 --- a/src/d/actor/d_a_obj_pumpkin.cpp +++ b/src/d/actor/d_a_obj_pumpkin.cpp @@ -450,7 +450,7 @@ int daObj_Pumpkin_c::Execute() { current.angle.y = cM_atan2s(sp_0x4C.x, sp_0x4C.z); } - MULT_ANGLE_2(sp_0x10, streamPower); + ANGLE_MULT_2(sp_0x10, streamPower); cLib_chaseAngleS(&field_0xB38.y, (field_0xB38.y < 0) ? sp_0x10*-1 : sp_0x10, 0x10); if (field_0xBAB) { cLib_addCalc2(&speedF, streamPower * 1.55f, 0.15f, 1.0f); diff --git a/src/d/actor/d_a_obj_so.cpp b/src/d/actor/d_a_obj_so.cpp index 02671f7c3ac..3dce537dab6 100644 --- a/src/d/actor/d_a_obj_so.cpp +++ b/src/d/actor/d_a_obj_so.cpp @@ -502,8 +502,8 @@ static void part_move(obj_so_class* i_this) { i_this->field_0x8f0[i].z *= 0.5f; if (i >= 2) { - i_this->field_0xa28[i].x += (s16)cM_rndFX(i_this->field_0x8f0[i].y * 400.0f); - i_this->field_0xbc8[i] += (s16)cM_rndFX(i_this->field_0x8f0[i].y * 200.0f); + ANGLE_ADD(i_this->field_0xa28[i].x, cM_rndFX(i_this->field_0x8f0[i].y * 400.0f)); + ANGLE_ADD(i_this->field_0xbc8[i], cM_rndFX(i_this->field_0x8f0[i].y * 200.0f)); } } else { i_this->field_0x8f0[i].y = -10.0f; diff --git a/src/d/actor/d_a_obj_web0.cpp b/src/d/actor/d_a_obj_web0.cpp index 58a002058cf..b848781a4ca 100644 --- a/src/d/actor/d_a_obj_web0.cpp +++ b/src/d/actor/d_a_obj_web0.cpp @@ -138,7 +138,7 @@ static int daObj_Web0_Execute(obj_web0_class* i_this) { var_r28 = base_p->shape_angle.y; if (sp08 < 0) { - var_r28 += (s16) -0x8000; + ANGLE_ADD(var_r28, -0x8000); } var_r28 -= player->shape_angle.y; diff --git a/src/d/actor/d_a_ppolamp.cpp b/src/d/actor/d_a_ppolamp.cpp index e760171d4e3..dd22f0ebaf3 100644 --- a/src/d/actor/d_a_ppolamp.cpp +++ b/src/d/actor/d_a_ppolamp.cpp @@ -127,8 +127,8 @@ int daPPolamp_c::createHeap() { void daPPolamp_c::moveSwing() { s16 sVar1 = field_0x598 * 65 - 500; - shape_angle.z += (s16)(field_0x5a4 * (field_0x59c * sVar1)); - shape_angle.y += (s16)(field_0x59e * field_0x5a4); + ANGLE_ADD(shape_angle.z, field_0x5a4 * (field_0x59c * sVar1)); + ANGLE_ADD(shape_angle.y, field_0x59e * field_0x5a4); if (sVar1 > 500) { field_0x598 = 0; field_0x59c *= -1; diff --git a/src/d/actor/d_a_tag_Lv7Gate.cpp b/src/d/actor/d_a_tag_Lv7Gate.cpp index cf402f48485..7571fd2caed 100644 --- a/src/d/actor/d_a_tag_Lv7Gate.cpp +++ b/src/d/actor/d_a_tag_Lv7Gate.cpp @@ -184,7 +184,7 @@ void daTagLv7Gate_c::flyAnime() { if (bck_anm == bck_anm_3) { if (field_0x5ac < 150) { - field_0x5ac += (u16)1; + U16_ADD(field_0x5ac, 1); if (field_0x5ac >= 150) { bck = bck_anm_4; attribute = J3DFrameCtrl::EMode_NONE; diff --git a/src/d/actor/d_a_tag_attack_item.cpp b/src/d/actor/d_a_tag_attack_item.cpp index 6e2ce1c8e44..b0efb7fa6ff 100644 --- a/src/d/actor/d_a_tag_attack_item.cpp +++ b/src/d/actor/d_a_tag_attack_item.cpp @@ -147,7 +147,7 @@ void daTagAtkItem_c::createItem() { int item_bit = getItemBit(); for (int i = 0; i < create_num; i++) { - angle.y += (s16)cM_rndFX(0x7FFF); + ANGLE_ADD(angle.y, cM_rndFX(0x7FFF)); fopAcM_createItemFromTable(&home.pos, getItemNo(), item_bit, fopAcM_GetHomeRoomNo(this), &angle, 0, NULL, NULL, NULL, false); diff --git a/src/d/actor/d_a_tag_csw.cpp b/src/d/actor/d_a_tag_csw.cpp index 24be671d06e..f8638cde951 100644 --- a/src/d/actor/d_a_tag_csw.cpp +++ b/src/d/actor/d_a_tag_csw.cpp @@ -376,9 +376,9 @@ int daTagCsw_c::execute() { s16 sp0A = current.angle.y - statue->current.angle.y; sp0A /= field_0x8e2; if (sp0A > 0x800) { - statue->current.angle.y += (s16)0x800; + ANGLE_ADD(statue->current.angle.y, 0x800); } else if (sp0A < -0x800) { - statue->current.angle.y -= (s16)0x800; + ANGLE_SUB(statue->current.angle.y, 0x800); } else { statue->current.angle.y += sp0A; } diff --git a/src/d/actor/d_a_tag_river_back.cpp b/src/d/actor/d_a_tag_river_back.cpp index e361cccbd9c..d8c15ae5275 100644 --- a/src/d/actor/d_a_tag_river_back.cpp +++ b/src/d/actor/d_a_tag_river_back.cpp @@ -82,7 +82,7 @@ void daTagRiverBack_c::actionOrderEvent() { void daTagRiverBack_c::actionEvent() { daPy_py_c* player = daPy_getPlayerActorClass(); - mCount += (s16)1; + S16_ADD(mCount, 1); if (dComIfGp_evmng_endCheck(mEventID)) { setAction(ACTION_DEAD_e); dComIfGp_event_reset(); diff --git a/src/d/actor/d_a_tag_waterfall.cpp b/src/d/actor/d_a_tag_waterfall.cpp index eae7b283f6d..f9016da7729 100644 --- a/src/d/actor/d_a_tag_waterfall.cpp +++ b/src/d/actor/d_a_tag_waterfall.cpp @@ -95,7 +95,7 @@ int daTagWaterFall_c::draw() { cXyz endPos; for (int i = 0; i < 0x10; i++) { - angle += (s16)0x1000; + ANGLE_ADD(angle, 0x1000); endPos = current.pos; if (l_HIO.draw_ellipse == 0) { paramX = l_HIO.ellipse_radius_a * cM_ssin(angle); diff --git a/src/d/actor/d_a_vrbox2.cpp b/src/d/actor/d_a_vrbox2.cpp index 5fb12400e4e..deb1905c741 100644 --- a/src/d/actor/d_a_vrbox2.cpp +++ b/src/d/actor/d_a_vrbox2.cpp @@ -195,7 +195,7 @@ static int daVrbox2_Draw(vrbox2_class* i_this) { mDoMtx_stack_c::ZrotM(-mangZ); sun2_model_p->setBaseTRMtx(mDoMtx_stack_c::get()); mDoExt_modelUpdateDL(sun2_model_p); - mangZ += (s16)(483.0f + cM_rndF(100.0f)); + ANGLE_ADD(mangZ, 483.0f + cM_rndF(100.0f)); } } diff --git a/src/d/d_event_data.cpp b/src/d/d_event_data.cpp index c0e34a0c50b..55ba5f71b9c 100644 --- a/src/d/d_event_data.cpp +++ b/src/d/d_event_data.cpp @@ -1077,7 +1077,7 @@ void dEvDtStaff_c::specialProcDirector() { } #if DEBUG - data->unk2 += (s16)event_debug_evdt_sound_adjust(); + S16_ADD(data->unk2, event_debug_evdt_sound_adjust()); #endif } else { data->unk2 = 0; diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index f4b2a0aea3b..1a8596eb742 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -540,7 +540,7 @@ void dKy_twi_wolflight_set(int light_id) { } #endif - angle_x += (s16)6000; + ANGLE_ADD(angle_x, 6000); kankyo->field_0x0c18[light_id].mAngleX = cM_sht2d(-angle_x); kankyo->field_0x0c18[light_id].mAngleY = cM_sht2d(-angle_y) + 90.0f; } @@ -9820,9 +9820,9 @@ void dKy_ParticleColor_get_base(cXyz* param_0, dKy_tevstr_c* param_1, GXColor* p for (i = 1; i < 3; i++) { if (sp58[i] < 100000000.0f) { temp_f28 = parcent_tabel[spD][i]; - sp48.r += (s16)(sp70[i].r * temp_f28); - sp48.g += (s16)(sp70[i].g * temp_f28); - sp48.b += (s16)(sp70[i].b * temp_f28); + S16_ADD(sp48.r, sp70[i].r * temp_f28); + S16_ADD(sp48.g, sp70[i].g * temp_f28); + S16_ADD(sp48.b, sp70[i].b * temp_f28); } } diff --git a/src/d/d_kankyo_debug.cpp b/src/d/d_kankyo_debug.cpp index 756276f438f..973f2811193 100644 --- a/src/d/d_kankyo_debug.cpp +++ b/src/d/d_kankyo_debug.cpp @@ -55,9 +55,9 @@ static void add_update_proc(u8* mode, s16* param_1, s16* param_2, s16* param_3) } } - *param_1 += (s16)value; - *param_2 += (s16)value; - *param_3 += (s16)value; + S16_ADD(*param_1, value); + S16_ADD(*param_2, value); + S16_ADD(*param_3, value); *mode = 0; g_kankyoHIO.light.dKankyo_lightHIOInfoUpDateF(); diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 6ff1a50c7f0..0351608c18d 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -2266,7 +2266,7 @@ void dMenu_Collect3D_c::_move(u8 param_0, u8 param_1) { toItem3Dpos(linkPos.x, posY, posZ, &itemPos); if (param_0 == 0 && param_1 == 0) { f32 temp = 450.0f; - mLinkAngle += (s16)temp; + ANGLE_ADD(mLinkAngle, temp); } else { s16 target = mIsWolf != 0 ? (s16)-0x510C : (s16)-0x5B1C; cLib_addCalcAngleS(&mLinkAngle, target, 4, 0x800, 0x80); diff --git a/src/d/d_menu_fmap2D.cpp b/src/d/d_menu_fmap2D.cpp index a8776ee94ba..3815e83bad6 100644 --- a/src/d/d_menu_fmap2D.cpp +++ b/src/d/d_menu_fmap2D.cpp @@ -938,9 +938,9 @@ void dMenu_Fmap2DBack_c::scrollCalc(f32 param_0) { } void dMenu_Fmap2DBack_c::mapBlink(s16* param_0) { - *param_0 += (s16)1; + S16_ADD(*param_0, 1); if (*param_0 >= 30) { - *param_0 -= (s16)30; + S16_SUB(*param_0, 30); } } diff --git a/src/d/d_menu_map_common.cpp b/src/d/d_menu_map_common.cpp index c0db6ddcd2c..4d5ed2699b4 100644 --- a/src/d/d_menu_map_common.cpp +++ b/src/d/d_menu_map_common.cpp @@ -564,7 +564,7 @@ void dMenuMapCommon_c::setBlendRatio(u8 i_iconNo, f32 param_2, f32 param_3) { void dMenuMapCommon_c::blinkMove(s16 param_1) { mBlinkTimer++; if (mBlinkTimer >= param_1) { - mBlinkTimer -= (s16)(param_1 + 15); + S16_SUB(mBlinkTimer, param_1 + 15); } if (mBlinkTimer < 0) { diff --git a/src/d/d_npc_lib.cpp b/src/d/d_npc_lib.cpp index f29d8720adb..1b735bf253a 100644 --- a/src/d/d_npc_lib.cpp +++ b/src/d/d_npc_lib.cpp @@ -82,8 +82,8 @@ void dNpcLib_lookat_c::action(cXyz param_0, cXyz param_1, fopAc_ac_c* param_2, M sp16 = -cM_atan2s(sp78.y, sp78.absXZ()); sp14 = cM_atan2s(sp78.x, sp78.z); - field_0x4c[i].x += (s16)(var_f31 * (f32)(sp1A - sp16)); - field_0x4c[i].y += (s16)(var_f31 * (f32)(sp18 - sp14)); + ANGLE_ADD(field_0x4c[i].x, var_f31 * (f32)(sp1A - sp16)); + ANGLE_ADD(field_0x4c[i].y, var_f31 * (f32)(sp18 - sp14)); limitter(&field_0x4c[i].x, field_0x34[i].x, field_0x94[i].x, field_0x7c[i].x); limitter(&field_0x4c[i].y, field_0x34[i].y, field_0x94[i].y, field_0x7c[i].y); @@ -157,7 +157,7 @@ int dNpcLib_lookat_c::limitter(s16* o_value, s16 param_1, s16 param_2, s16 param if (param_2 <= param_1) { *o_value = 0; } else { - *o_value -= (s16)(limit - param_2); + S16_SUB(*o_value, limit - param_2); rt = TRUE; } } @@ -166,7 +166,7 @@ int dNpcLib_lookat_c::limitter(s16* o_value, s16 param_1, s16 param_2, s16 param if (param_1 <= param_3) { *o_value = 0; } else { - *o_value -= (s16)(limit - param_3); + S16_SUB(*o_value, limit - param_3); rt = TRUE; } } diff --git a/src/d/d_ovlp_fade2.cpp b/src/d/d_ovlp_fade2.cpp index 21abd58cddb..6a9dbd87401 100644 --- a/src/d/d_ovlp_fade2.cpp +++ b/src/d/d_ovlp_fade2.cpp @@ -150,7 +150,7 @@ void dOvlpFd2_c::execFadeOut() { cLib_calcTimer(&mTimer); } - field_0x114 += (s16)(TREG_S(0) + 0x800); + ANGLE_ADD(field_0x114, TREG_S(0) + 0x800); cLib_addCalc2(&field_0x118, TREG_F(1) + 1.0f, 1.0f, TREG_F(2) + 0.05f); } diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index 8e4c1cd38af..28b5b6abfa5 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -1783,7 +1783,7 @@ fopAc_ac_c* fopAcM_fastCreateItem(const cXyz* i_pos, int i_itemNo, int i_roomNo, angle = csXyz::Zero; } angle.z = 0xFF; - angle.y += (s16)cM_rndFX(0x2000); + ANGLE_ADD(angle.y, cM_rndFX(0x2000)); ret = (fopAc_ac_c*)fopAcM_fastCreate( PROC_ITEM, params, i_pos, i_roomNo, &angle, i_scale, -1, i_createFunc, NULL); @@ -1833,7 +1833,7 @@ fpc_ProcID fopAcM_createBokkuri(u16 i_setId, const cXyz* i_pos, int i_itemNo, in csXyz params_ex(0, 0, 0); if (param_6 != NULL) { params_ex.y = param_6->atan2sX_Z(); - params_ex.y += (s16)(2048.0f * cM_rndFX(1.0f)); + ANGLE_ADD(params_ex.y, (f32)0x800 * cM_rndFX(1.0f)); param_8 = 1; }