diff --git a/configure.py b/configure.py index 87a87cc5b..968532f02 100755 --- a/configure.py +++ b/configure.py @@ -614,7 +614,7 @@ config.libs = [ Object(NonMatching, "d/actor/d_a_himo2.cpp"), Object(Matching, "d/actor/d_a_hookshot.cpp"), Object(Matching, "d/actor/d_a_ib.cpp"), - Object(NonMatching, "d/actor/d_a_item.cpp"), + Object(Matching, "d/actor/d_a_item.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_itembase.cpp"), Object(Matching, "d/actor/d_a_nh.cpp"), Object(Matching, "d/actor/d_a_npc_fa1.cpp"), diff --git a/include/d/actor/d_a_item.h b/include/d/actor/d_a_item.h index 25bbb8043..a3e491412 100644 --- a/include/d/actor/d_a_item.h +++ b/include/d/actor/d_a_item.h @@ -39,7 +39,7 @@ public: MODE_WATER = 0x2, }; - float getYOffset(); + f32 getYOffset(); void set_mtx(); void set_mtx_base(J3DModel*, cXyz, csXyz); void CreateInit(); @@ -140,8 +140,8 @@ namespace daItem_prm { inline u32 getAction(daItem_c* i_this) { return (fopAcM_GetParam(i_this) & 0xFC000000) >> 0x1A; } inline u32 getItemNo(daItem_c* i_this) { return (fopAcM_GetParam(i_this) & 0x000000FF) >> 0x00; } inline u32 getItemBitNo(daItem_c* i_this) { return (fopAcM_GetParam(i_this) & 0x0000FF00) >> 0x08; } - inline u32 getSwitchNo(daItem_c* i_this) { return (i_this->home.angle.z & 0x00FF) >> 0; } - inline u32 getSwitchNo2(daItem_c* i_this) { return (fopAcM_GetParam(i_this) & 0x00FF0000) >> 0x10; } + inline u32 getSwitchNo(daItem_c* i_this) { return (fopAcM_GetParam(i_this) & 0x00FF0000) >> 0x10; } + inline u32 getSwitchNo2(daItem_c* i_this) { return (i_this->home.angle.z & 0x00FF) >> 0; } }; #endif /* D_A_ITEM_H */ diff --git a/include/d/actor/d_a_itembase.h b/include/d/actor/d_a_itembase.h index 7295763cd..9f6704bd1 100644 --- a/include/d/actor/d_a_itembase.h +++ b/include/d/actor/d_a_itembase.h @@ -6,6 +6,7 @@ #include "d/d_bg_s.h" #include "d/d_bg_s_acch.h" #include "d/d_cc_d.h" +#include "f_op/f_op_actor_mng.h" class mDoExt_btkAnm; class mDoExt_brkAnm; @@ -41,8 +42,13 @@ STATIC_ASSERT(sizeof(daItemBase_c_m_data) == 0x4C); class daItemBase_c : public fopAc_ac_c { public: + void RotateBase() { + s16 rotationSpeed = 0xFFFF / m_data.mRotateYSpeed; + fopAcM_addAngleY(this, current.angle.y + rotationSpeed, rotationSpeed); + } + BOOL DeleteBase(const char*); - BOOL CreateItemHeap(const char*, short, short, short, short, short, short, short); + BOOL CreateItemHeap(const char*, s16, s16, s16, s16, s16, s16, s16); virtual BOOL DrawBase(); virtual void setListStart(); void setListEnd(); @@ -50,7 +56,7 @@ public: virtual void setTevStr(); virtual void setShadow(); virtual void animEntry(); - void animPlay(float, float, float, float, float); + void animPlay(f32, f32, f32, f32, f32); virtual BOOL clothCreate(); u8 getItemNo(); diff --git a/include/d/d_item_data.h b/include/d/d_item_data.h index 989ce9503..acd095c63 100644 --- a/include/d/d_item_data.h +++ b/include/d/d_item_data.h @@ -298,7 +298,7 @@ struct dItem_data_field_item_res { STATIC_ASSERT(sizeof(dItem_data_field_item_res) == 0x1C); struct dItem_data_item_info { - /* 0x00 */ u8 mShadowSize; + /* 0x00 */ s8 mShadowSize; /* 0x01 */ u8 mCollisionH; // Cylinder Height /* 0x02 */ u8 mCollisionR; // Cylinder Radius /* 0x03 */ u8 mFlag; // TODO enum @@ -348,7 +348,7 @@ public: static u8 getShadowSize(u8 no) { return item_info[no].mShadowSize; } static const u8 getH(u8 no) { return item_info[no].mCollisionH; } static const u8 getR(u8 no) { return item_info[no].mCollisionR; } - static bool chkFlag(u8 no, u32 mask) { return item_info[no].mFlag & mask; } + static BOOL chkFlag(u8 no, int mask) { return item_info[no].mFlag & mask; } static bool checkAppearEffect(u8 no); static u16 getAppearEffect(u8 no); diff --git a/src/d/actor/d_a_bomb2.cpp b/src/d/actor/d_a_bomb2.cpp index c225cb817..ad47a206e 100644 --- a/src/d/actor/d_a_bomb2.cpp +++ b/src/d/actor/d_a_bomb2.cpp @@ -10,6 +10,7 @@ #include "d/d_a_obj.h" #include "d/d_kankyo_wether.h" #include "d/d_com_inf_game.h" +#include "f_op/f_op_camera_mng.h" #include "res/Object/VbakH.h" #include "f_op/f_op_camera.h" #include "f_op/f_op_kankyo_mng.h" @@ -712,8 +713,8 @@ void Act_c::eff_explode() { camera_process_class* cam = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); csXyz rot; - rot.x = -cam->mAngle.x; - rot.y = cam->mAngle.y + 0x8000; + rot.x = -fopCamM_GetAngleX(cam); + rot.y = fopCamM_GetAngleY(cam) + 0x8000; rot.z = 0; eff_explode_normal(&rot); diff --git a/src/d/actor/d_a_bomb3.inc b/src/d/actor/d_a_bomb3.inc index ec8987f79..a9af0b773 100644 --- a/src/d/actor/d_a_bomb3.inc +++ b/src/d/actor/d_a_bomb3.inc @@ -11,6 +11,7 @@ #include "d/actor/d_a_sea.h" #include "d/d_kankyo_wether.h" #include "f_op/f_op_camera.h" +#include "f_op/f_op_camera_mng.h" #include "f_op/f_op_kankyo_mng.h" #include "m_Do/m_Do_mtx.h" #include "m_Do/m_Do_lib.h" @@ -682,8 +683,8 @@ void daBomb_c::makeFireEffect(cXyz& pos, csXyz& rotation) { cXyz scale; scale.setall(0.3f); csXyz rot; - rot.x = -cam->mAngle.x; - rot.y = cam->mAngle.y + 0x8000; + rot.x = -fopCamM_GetAngleX(cam); + rot.y = fopCamM_GetAngleY(cam) + 0x8000; rot.z = 0; rotation.x = rotation.x + 0x4000; @@ -767,8 +768,8 @@ void daBomb_c::eff_explode_cheap(const csXyz* rotation) { void daBomb_c::eff_explode() { camera_process_class* cam = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); csXyz rot; - rot.x = -cam->mAngle.x; - rot.y = cam->mAngle.y + 0x8000; + rot.x = -fopCamM_GetAngleX(cam); + rot.y = fopCamM_GetAngleY(cam) + 0x8000; rot.z = 0; if(prm_get_cheapEff()) { diff --git a/src/d/actor/d_a_item.cpp b/src/d/actor/d_a_item.cpp index f778a5578..39849230e 100644 --- a/src/d/actor/d_a_item.cpp +++ b/src/d/actor/d_a_item.cpp @@ -11,6 +11,7 @@ #include "d/actor/d_a_sea.h" #include "d/d_com_inf_game.h" #include "f_op/f_op_camera.h" +#include "f_op/f_op_camera_mng.h" #include "m_Do/m_Do_mtx.h" #include "m_Do/m_Do_controller_pad.h" @@ -30,7 +31,7 @@ cXyz setArrowTrans(s16 yRot, cXyz offset) { } /* 800F4C4C-800F4CD8 .text getYOffset__8daItem_cFv */ -float daItem_c::getYOffset() { +f32 daItem_c::getYOffset() { switch (m_itemNo) { case dItemNo_KNIGHTS_CREST_e: return 0.0f; @@ -183,12 +184,12 @@ void daItem_c::CreateInit() { break; } - mSpawnSwitchNo = daItem_prm::getSwitchNo2(this); + mSpawnSwitchNo = daItem_prm::getSwitchNo(this); if (mSpawnSwitchNo != 0xFF && !fopAcM_isSwitch(this, mSpawnSwitchNo)) { hide(); setFlag(0x02); } - mCollideSwitchNo = daItem_prm::getSwitchNo(this); + mCollideSwitchNo = daItem_prm::getSwitchNo2(this); current.angle.z = 0; home.angle.z = 0; @@ -387,7 +388,10 @@ void daItem_c::execMainNormalDirection() { current.pos.y = headPos.y; } - current.angle = dComIfGp_getCamera(0)->mAngle; + camera_process_class* camera = dComIfGp_getCamera(0); + current.angle.x = fopCamM_GetAngleX(camera); + current.angle.y = fopCamM_GetAngleY(camera); + current.angle.z = fopCamM_GetAngleZ(camera); mSimpleExistTimer--; if (mSimpleExistTimer < 0) { @@ -976,7 +980,6 @@ BOOL daItem_c::itemActionForEmono() { /* 800F73A4-800F7898 .text itemActionForSword__8daItem_cFv */ BOOL daItem_c::itemActionForSword() { - /* Nonmatching - retail-only regalloc */ mAcch.CrrPos(*dComIfG_Bgsp()); bool isQuake = dComIfGp_getDetect().chk_quake(¤t.pos); @@ -1003,8 +1006,8 @@ BOOL daItem_c::itemActionForSword() { dBgS_ObjGndChk gndChk; cXyz bottomPos(0.0f, 0.0f, 0.0f); cXyz topPos(0.0f, 50.0f, 0.0f); - mDoMtx_stack_c::transS(current.pos); - mDoMtx_stack_c::ZXYrotM(current.angle); + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, current.angle.z); mDoMtx_stack_c::multVec(&bottomPos, &bottomPos); mDoMtx_stack_c::multVec(&topPos, &topPos); gndChk.SetPos(&bottomPos); @@ -1335,8 +1338,7 @@ void daItem_c::mode_water() { current.pos.y = mAcch.m_wtr.GetHeight(); } - s16 rotationSpeed = 0xFFFF / daItemBase_c::m_data.mRotateYSpeed; - fopAcM_addAngleY(this, current.angle.y + rotationSpeed, rotationSpeed); + RotateBase(); } /* 800F8528-800F8950 .text initAction__8daItem_cFv */ diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 039b554ea..90ef1d386 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -2712,9 +2712,9 @@ BOOL daPy_lk_c::setBodyAngleToCamera() { #endif } else { camera_process_class* cam = dComIfGp_getCamera(mCameraInfoIdx); - shape_angle.y = cam->mAngle.y; + shape_angle.y = fopCamM_GetAngleY(cam); current.angle.y = shape_angle.y; - mBodyAngle.x = cam->mAngle.x; + mBodyAngle.x = fopCamM_GetAngleX(cam); } return bVar1; } diff --git a/src/d/actor/d_a_race_item.cpp b/src/d/actor/d_a_race_item.cpp index a80d5cca0..f6002f248 100644 --- a/src/d/actor/d_a_race_item.cpp +++ b/src/d/actor/d_a_race_item.cpp @@ -140,8 +140,7 @@ BOOL daRaceItem_c::execute() { case 0: { checkGet(); - s16 spin = 0xFFFF / daItemBase_c::m_data.mRotateYSpeed; - fopAcM_addAngleY(this, current.angle.y + spin, spin); + RotateBase(); mCyl.SetC(current.pos); dComIfG_Ccsp()->Set(&mCyl);