From a983a848c10e909f8013d3358a97f1c5be2a9183 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 21 Oct 2023 01:12:59 -0400 Subject: [PATCH] Clean up cXyz inlines copied from TP --- include/SSystem/SComponent/c_xyz.h | 6 +----- src/c/c_damagereaction.cpp | 14 +++++++------- src/d/actor/d_a_am.cpp | 12 ++++++------ src/d/actor/d_a_am2.cpp | 12 ++++++------ src/d/actor/d_a_bomb.cpp | 6 +++--- src/d/actor/d_a_item.cpp | 20 ++++++++++---------- src/d/actor/d_a_nh.cpp | 2 +- src/d/actor/d_a_obj_hole.cpp | 2 +- src/d/actor/d_a_obj_mknjd.cpp | 8 ++++---- src/d/actor/d_a_obj_toripost.cpp | 2 +- src/d/actor/d_a_swtdoor.cpp | 2 -- src/d/d_npc.cpp | 4 ++-- src/f_op/f_op_actor_mng.cpp | 2 +- 13 files changed, 43 insertions(+), 49 deletions(-) diff --git a/include/SSystem/SComponent/c_xyz.h b/include/SSystem/SComponent/c_xyz.h index 4ae7df9ea..3f66bd6aa 100644 --- a/include/SSystem/SComponent/c_xyz.h +++ b/include/SSystem/SComponent/c_xyz.h @@ -86,11 +86,7 @@ struct cXyz : Vec { z = other.z; } - f32 getXDiff(const Vec* other) const { return x - other->x; } - f32 getYDiff(const Vec* other) const { return y - other->y; } - f32 getZDiff(const Vec* other) const { return z - other->z; } - - void setAll(f32 f) { set(f, f, f); } + void setall(f32 f) { set(f, f, f); } void setMin(const cXyz& other) { if (x > other.x) { diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index bed1f696d..9145181a3 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -113,7 +113,7 @@ BOOL enemy_ice(enemyice* ei) { cXyz pos; if (ei->mLightShrinkTimer != 0) { // Dying to light arrows. - particleScale.setAll(ei->mParticleScale); + particleScale.setall(ei->mParticleScale); pos = ac->current.pos; pos.y += ei->mYOffset; @@ -214,7 +214,7 @@ BOOL enemy_ice(enemyice* ei) { } fopAcM_seStart(ac, JA_SE_CM_FREEZE, 0); - particleScale.setAll(ei->mParticleScale); + particleScale.setall(ei->mParticleScale); pos = ac->current.pos; pos.y += ei->mYOffset; dComIfGp_particle_set(0x274, &pos, NULL, &particleScale); @@ -320,7 +320,7 @@ BOOL enemy_ice(enemyice* ei) { if (ei->mFreezeTimer != 0) { if (ei->mFreezeTimer < 0) { // Shattered. - particleScale.setAll(ei->mParticleScale); + particleScale.setall(ei->mParticleScale); pos = ac->current.pos; pos.y += ei->mYOffset; dComIfGp_particle_set(0x273, &pos, NULL, &particleScale); @@ -330,7 +330,7 @@ BOOL enemy_ice(enemyice* ei) { // Shattered by Skull Hammer. dComIfGp_particle_set(0x10, &pos); csXyz angle(0, fopAcM_searchPlayerAngleY(ac), 0); - particleScale.setAll(2.0f); + particleScale.setall(2.0f); dComIfGp_particle_set(0xD, &pos, &angle, &particleScale); dScnPly_ply_c::setPauseTimer(8); } @@ -373,7 +373,7 @@ BOOL enemy_ice(enemyice* ei) { } if (ei->mFreezeTimer == 20) { - particleScale.setAll(ei->mParticleScale); + particleScale.setall(ei->mParticleScale); pos = ac->current.pos; pos.y += ei->mYOffset; dComIfGp_particle_set(0x277, &pos, NULL, &particleScale); @@ -436,7 +436,7 @@ void enemy_fire(enemyfire* ef) { fopAc_ac_c* ac = ef->mpActor; cXyz offset; cXyz pos; - offset.setAll(0.0f); + offset.setall(0.0f); switch (ef->mState) { case 0: // Not on fire. @@ -459,7 +459,7 @@ void enemy_fire(enemyfire* ef) { continue; } cXyz scale; - scale.setAll(ef->mParticleScale[i]); + scale.setall(ef->mParticleScale[i]); ef->mpFlameEmitters[i] = dComIfGp_particle_set(0x3F1, &ac->current.pos, NULL, &scale); ef->mFlameTimers[i] = ef->mFireTimer - (s16)cM_rndF(60.0f); if (ef->mFlameTimers[i] < 10) { diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index b8483da25..94e0362c8 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -400,7 +400,7 @@ static void bomb_move_set(am_class* i_this, u8 alwaysMoveY) { swallowedActor->mGravity = 0.0f; swallowedActor->speedF = 0.0f; - swallowedActor->speed.setAll(0.0f); + swallowedActor->speed.setall(0.0f); swallowedActor->current.angle.setall(0); swallowedActor->shape_angle.setall(0); swallowedActor->current.angle.y = i_this->shape_angle.y; @@ -409,19 +409,19 @@ static void bomb_move_set(am_class* i_this, u8 alwaysMoveY) { if (fpcM_GetName(swallowedActor) == PROC_BOMB) { daBomb_c* bomb = (daBomb_c*)swallowedActor; if (i_this->mCountDownTimers[1] == 1) { - bomb->mScale.setAll(0.0f); + bomb->mScale.setall(0.0f); bomb->setBombNoEff(); } else if (i_this->mCountDownTimers[1] > 1) { - bomb->mScale.setAll(1.0f); + bomb->mScale.setall(1.0f); } bomb->setBombRestTime(100); } else if (fpcM_GetName(swallowedActor) == PROC_Bomb2) { daBomb2::Act_c* bomb2 = (daBomb2::Act_c*)swallowedActor; if (i_this->mCountDownTimers[1] == 1) { - bomb2->mScale.setAll(0.0f); + bomb2->mScale.setall(0.0f); bomb2->remove_fuse_effect(); } else if (i_this->mCountDownTimers[1] > 1) { - bomb2->mScale.setAll(1.0f); + bomb2->mScale.setall(1.0f); } bomb2->set_time(100); } @@ -1006,7 +1006,7 @@ static void action_itai_move(am_class* i_this) { if (i_this->mSwallowedActorProcID != -1) { fopAc_ac_c* swallowedActor = fopAcM_SearchByID(i_this->mSwallowedActorProcID); if (swallowedActor) { - swallowedActor->mScale.setAll(1.0f); + swallowedActor->mScale.setall(1.0f); if (fpcM_GetName(swallowedActor) == PROC_BOMB) { daBomb_c* bomb = (daBomb_c*)swallowedActor; bomb->setBombRestTime(1); diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index 45504bfc4..5f104ce36 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -472,7 +472,7 @@ static BOOL naraku_check(am2_class* i_this) { if (i_this->current.pos.y < -500.0f || i_this->mInAbyssTimer > 50) { i_this->speedF = 0.0f; - i_this->speed.setAll(0.0f); + i_this->speed.setall(0.0f); i_this->mGravity = 0.0f; return TRUE; } @@ -506,7 +506,7 @@ static BOOL naraku_check(am2_class* i_this) { f32 waterSinkDepth = 80.0f + g_regHIO.mChild[12].mFloatRegs[0]; if (i_this->current.pos.y < i_this->mAcch.m_wtr.GetHeight() - waterSinkDepth) { i_this->speedF = 0.0f; - i_this->speed.setAll(0.0f); + i_this->speed.setall(0.0f); i_this->mGravity = 0.0f; return TRUE; } @@ -757,7 +757,7 @@ static void action_mahi(am2_class* i_this) { fopAcM_OffStatus(actor, fopAcStts_SHOWMAP_e); actor->current.angle.y = player->shape_angle.y; actor->mGravity = 0.0f; - actor->speed.setAll(0.0f); + actor->speed.setall(0.0f); actor->speedF = 0.0f; i_this->mbNotInHomeRoom = false; i_this->mBodyCyl.OffCoSetBit(); @@ -1120,14 +1120,14 @@ static void action_modoru_move(am2_class* i_this) { if (i_this->mScale.x < 0.1f) { i_this->speedF = 0.0f; - i_this->speed.setAll(0.0f); + i_this->speed.setall(0.0f); i_this->mGravity = -3.0f; i_this->mbMadeWaterSplash = false; i_this->mRippleCb.end(); i_this->current.angle.y = i_this->shape_angle.y; i_this->current.pos = i_this->mSpawnPos; - i_this->mScale.setAll(0.0f); + i_this->mScale.setall(0.0f); i_this->shape_angle.y = i_this->mSpawnRotY; i_this->current.angle.y = i_this->shape_angle.y; i_this->current.pos = i_this->mSpawnPos; @@ -1147,7 +1147,7 @@ static void action_modoru_move(am2_class* i_this) { if (i_this->mScale.x > 0.9f) { i_this->mCountUpTimers[1] = 0; - i_this->mScale.setAll(1.0f); + i_this->mScale.setall(1.0f); i_this->mWeakSph.OffTgSetBit(); i_this->mNeedleCyl.OffAtSetBit(); i_this->mNeedleCyl.OffCoSetBit(); diff --git a/src/d/actor/d_a_bomb.cpp b/src/d/actor/d_a_bomb.cpp index bb6b803f3..f200239b1 100644 --- a/src/d/actor/d_a_bomb.cpp +++ b/src/d/actor/d_a_bomb.cpp @@ -599,7 +599,7 @@ void daBomb_c::makeFireEffect(cXyz& pos, csXyz& rotation) { camera_class* cam = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); cXyz scale; - scale.setAll(0.3f); + scale.setall(0.3f); csXyz rot; rot.x = -cam->mAngle.x; rot.y = cam->mAngle.y + 0x8000; @@ -1206,7 +1206,7 @@ void daBomb_c::create_init() { mAcch.m_roof_height = 50.0f; mAcch.OnLineCheck(); - field_0x554.setAll(-1.0e9f); + field_0x554.setall(-1.0e9f); field_0x560 = 0; mbWaterIn = 0; field_0x562 = 0; @@ -1241,7 +1241,7 @@ void daBomb_c::create_init() { mMassCounter = g_Counter.mCounter0 - 1; if(chk_attrState(this, ATTR_STATE_2)) { - mScale.setAll(0.0f); + mScale.setall(0.0f); } if(chk_attrState(this, ATTR_STATE_4)) { setFuseEffect(); diff --git a/src/d/actor/d_a_item.cpp b/src/d/actor/d_a_item.cpp index ba33556a6..3d5824c99 100644 --- a/src/d/actor/d_a_item.cpp +++ b/src/d/actor/d_a_item.cpp @@ -181,10 +181,10 @@ void daItem_c::CreateInit() { case BOMB_10: case BOMB_20: case BOMB_30: - mScaleTarget.setAll(0.6f); + mScaleTarget.setall(0.6f); break; default: - mScaleTarget.setAll(1.0f); + mScaleTarget.setall(1.0f); break; } @@ -507,7 +507,7 @@ void daItem_c::scaleAnimFromBossItem() { if (field_0x638 == 30) { fopAcM_seStart(this, JA_SE_CM_BOSS_HEART_APPEAR, 0); } - mScale.setAll(1.0f); + mScale.setall(1.0f); } } @@ -1238,7 +1238,7 @@ void daItem_c::mode_water_init() { current.pos.y = mAcch.m_wtr.GetHeight(); } - speed.setAll(0.0f); + speed.setall(0.0f); speedF = 0.0f; current.angle.z = 0; current.angle.x = 0; @@ -1251,7 +1251,7 @@ void daItem_c::mode_water_init() { f32 temp = dItem_data::getShadowSize(m_itemNo); f32 temp3 = temp / dItem_data::getShadowSize(GREEN_RUPEE); temp3 *= mScale.x; - scale.setAll(temp3); + scale.setall(temp3); dComIfGp_particle_setShipTail(0x33, ¤t.pos, NULL, &scale, 0xFF, &mPtclRippleCb); mPtclRippleCb.mRate = 0.0f; @@ -1359,15 +1359,15 @@ BOOL daItem_c::initAction() { // speedF = cM_rndF(getData()->field_0x30); break; case 5: - speed.setAll(0.0f); + speed.setall(0.0f); speedF = 0.0f; - mScale.setAll(0.0f); + mScale.setall(0.0f); mCurState = STATE_WAIT_BOSS1; fopAcM_OnStatus(this, fopAcStts_UNK4000_e); field_0x654 = 0x4A8; break; case 0xC: - mScale.setAll(1.0f); + mScale.setall(1.0f); mCurState = STATE_WAIT_BOSS2; fopAcM_OnStatus(this, fopAcStts_UNK4000_e); field_0x654 = 0x4A8; @@ -1416,7 +1416,7 @@ BOOL daItem_c::initAction() { break; case 0xA: mGravity = getData()->mFieldItemGravity; - mScale.setAll(0.0f); + mScale.setall(0.0f); mMode = 0; break; case 0xB: @@ -1441,7 +1441,7 @@ BOOL daItem_c::initAction() { mGravity = getData()->mFieldItemGravity; speed.set(0.0f, temp_f31, 0.0f); - mScale.setAll(0.0f); + mScale.setall(0.0f); mMode = 0; diff --git a/src/d/actor/d_a_nh.cpp b/src/d/actor/d_a_nh.cpp index bf6550868..11102db92 100644 --- a/src/d/actor/d_a_nh.cpp +++ b/src/d/actor/d_a_nh.cpp @@ -190,7 +190,7 @@ daNh_c::~daNh_c() { /* 800F9874-800F9980 .text setBaseMtx__6daNh_cFv */ void daNh_c::setBaseMtx() { J3DModel* model = mpModel; - mScale.setAll(l_HIO.prm.mModelScale); + mScale.setall(l_HIO.prm.mModelScale); model->setBaseScale(mScale); mDoMtx_stack_c::transS(getPosition()); mDoMtx_stack_c::YrotM(shape_angle.y); diff --git a/src/d/actor/d_a_obj_hole.cpp b/src/d/actor/d_a_obj_hole.cpp index b56921627..a86991aba 100644 --- a/src/d/actor/d_a_obj_hole.cpp +++ b/src/d/actor/d_a_obj_hole.cpp @@ -122,7 +122,7 @@ void daObj_Hole_c::setMtx() { scale /= l_HIO.m0008; cXyz scaleVec; - scaleVec.setAll(scale); + scaleVec.setall(scale); mpMdl->setBaseScale(scaleVec); mDoMtx_stack_c::transS(adjustPos); diff --git a/src/d/actor/d_a_obj_mknjd.cpp b/src/d/actor/d_a_obj_mknjd.cpp index 48f24decc..132e3db5a 100644 --- a/src/d/actor/d_a_obj_mknjd.cpp +++ b/src/d/actor/d_a_obj_mknjd.cpp @@ -330,11 +330,11 @@ int daObjMknjD::Act_c::Create() { fopAcM_setCullSizeBox(this, -400.0f, -1.0f, -400.0f, 400.0f, 405.0f, 400.0f); - mLeftHalfPos.setAll(0.0f); - mRightHalfPos.setAll(0.0f); + mLeftHalfPos.setall(0.0f); + mRightHalfPos.setall(0.0f); for (int i = 0; i < 20; i++) { - mShardPositions[i].setAll(0.0f); + mShardPositions[i].setall(0.0f); mShardHeights[i] = 0.0f; } @@ -729,7 +729,7 @@ bool daObjMknjD::Act_c::daObjMknjD_break() { m043D = true; for (int i = 0; i < 20; i++) { - mShardPositions[i].setAll(0.0f); + mShardPositions[i].setall(0.0f); if (i == 0x02 || i == 0x03 || i == 0x06 || i == 0x07 || i == 0x0A || i == 0x0D || i == 0x0E || i == 0x12 || i == 0x13) { mShardPositions[i].x += 20.0f; diff --git a/src/d/actor/d_a_obj_toripost.cpp b/src/d/actor/d_a_obj_toripost.cpp index b1558f00f..e2485365f 100644 --- a/src/d/actor/d_a_obj_toripost.cpp +++ b/src/d/actor/d_a_obj_toripost.cpp @@ -726,7 +726,7 @@ void daObjTpost_c::setAnm(s8 param_1, bool param_2) { if(field_0x6C8 == 1) { cXyz scale; - scale.setAll(1.0f); + scale.setall(1.0f); if(mMorf->getFrame() == 1.0f) { dComIfGp_particle_set(0x8190, ¤t.pos, ¤t.angle, &scale); mDoAud_seStart(JA_SE_OBJ_POST_LUGGAGE_OUT, 0, 0, 0); diff --git a/src/d/actor/d_a_swtdoor.cpp b/src/d/actor/d_a_swtdoor.cpp index 0181d4128..1a1cbc68a 100644 --- a/src/d/actor/d_a_swtdoor.cpp +++ b/src/d/actor/d_a_swtdoor.cpp @@ -66,8 +66,6 @@ BOOL useHeapInit(fopAc_ac_c* i_ac) { /* 00000260-00000374 .text daSwtdoor_Create__FP10fopAc_ac_c */ s32 daSwtdoor_Create(fopAc_ac_c* i_ac) { - /* Nonmatching - r30/r31 regswap */ - swtdoor_class * i_this; fopAcM_SetupActor(i_ac, swtdoor_class); diff --git a/src/d/d_npc.cpp b/src/d/d_npc.cpp index 54dc4d51f..28498c5fe 100644 --- a/src/d/d_npc.cpp +++ b/src/d/d_npc.cpp @@ -492,8 +492,8 @@ cXyz dNpc_playerEyePos(f32 param_1) { void dNpc_calc_DisXZ_AngY(cXyz param_1, cXyz param_2, float* param_3, short* param_4) { cXyz diff; - diff.x = param_2.getXDiff(¶m_1); - diff.z = param_2.getZDiff(¶m_1); + diff.x = param_2.x - param_1.x; + diff.z = param_2.z - param_1.z; if(param_3 != 0) { f32 dist = sqrtf(diff.x * diff.x + diff.z * diff.z); diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index e0b7fb9b8..1293c9c59 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -934,7 +934,7 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* rot, cXy BOOL stealItem_CB(void* actor) { if (actor) { daItem_c* item = (daItem_c*)actor; - item->mScale.setAll(1.0f); + item->mScale.setall(1.0f); item->mStatusFlags |= 0x40; } return TRUE;