From 34afbd84db8d66dd634fa19e94a737d40dfe7995 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Thu, 17 Oct 2024 21:35:18 -0400 Subject: [PATCH] clangd: Started fixing warnings and errors, code cleanup --- .clangd | 5 + include/DynamicLink.h | 6 +- include/JSystem/J3DGraphBase/J3DTransform.h | 16 ++- include/JSystem/JGadget/binary.h | 2 +- include/JSystem/JGeometry.h | 2 +- include/JSystem/JMath/JMath.h | 12 ++ include/JSystem/JMessage/resource.h | 6 +- .../JSystem/JStudio/JStudio/functionvalue.h | 2 +- include/JSystem/JStudio/JStudio/stb.h | 12 +- include/JSystem/JUtility/JUTConsole.h | 5 + include/d/actor/d_a_player.h | 3 +- include/d/actor/d_a_player_main_data.h | 9 +- include/d/d_com_inf_game.h | 3 +- include/d/d_particle_name.h | 4 +- include/dolphin/os/OS.h | 6 + include/dolphin/os/OSLink.h | 6 +- include/f_op/f_op_actor.h | 28 ++-- include/f_op/f_op_actor_mng.h | 14 +- src/JSystem/J2DGraph/J2DPicture.cpp | 2 +- src/JSystem/J2DGraph/J2DPrint.cpp | 20 +-- src/JSystem/J2DGraph/J2DScreen.cpp | 3 +- src/JSystem/J3DGraphAnimator/J3DAnimation.cpp | 2 + src/JSystem/J3DGraphAnimator/J3DModel.cpp | 3 +- src/JSystem/J3DGraphLoader/J3DModelLoader.cpp | 3 +- src/JSystem/JAudio/dspproc.c | 1 - src/JSystem/JStudio/JStudio/functionvalue.cpp | 13 +- src/JSystem/JStudio/JStudio/object-id.cpp | 2 +- src/JSystem/JStudio/JStudio/stb.cpp | 15 ++- .../MSL/MSL_C/MSL_Common/Include/math.h | 8 +- .../MSL/MSL_C/MSL_Common/Include/stddef.h | 2 +- .../MSL/MSL_C/MSL_Common/Src/printf.c | 4 +- src/d/actor/d_a_agbsw0.cpp | 3 +- src/d/actor/d_a_am.cpp | 24 ++-- src/d/actor/d_a_am2.cpp | 12 +- src/d/actor/d_a_auction.cpp | 14 +- src/d/actor/d_a_bk.cpp | 9 +- src/d/actor/d_a_item.cpp | 11 +- src/d/actor/d_a_mozo.cpp | 3 +- src/d/actor/d_a_npc_bs1.cpp | 19 +-- src/d/actor/d_a_npc_ji1.cpp | 124 +++++++++--------- src/d/actor/d_a_npc_kamome.cpp | 8 +- src/d/actor/d_a_npc_md.cpp | 2 +- src/d/actor/d_a_npc_nz.cpp | 3 +- src/d/actor/d_a_npc_os.cpp | 56 ++++---- src/d/actor/d_a_npc_people.cpp | 20 +-- src/d/actor/d_a_obj_figure.cpp | 3 +- src/d/actor/d_a_obj_mknjd.cpp | 8 +- src/d/actor/d_a_pedestal.cpp | 2 +- src/d/actor/d_a_player_fan.inc | 2 +- src/d/actor/d_a_player_main.cpp | 14 +- src/d/actor/d_a_rd.cpp | 48 +++---- src/d/d_kankyo.cpp | 5 +- src/d/d_kankyo_rain.cpp | 6 +- src/f_op/f_op_actor_mng.cpp | 54 ++++---- src/f_op/f_op_msg_mng.cpp | 48 +++---- src/m_Do/m_Do_ext.cpp | 10 +- src/m_Do/m_Do_graphic.cpp | 4 +- src/m_Do/m_Do_main.cpp | 2 +- 58 files changed, 417 insertions(+), 316 deletions(-) create mode 100644 .clangd diff --git a/.clangd b/.clangd new file mode 100644 index 000000000..2eee1f5fb --- /dev/null +++ b/.clangd @@ -0,0 +1,5 @@ +# https://clangd.llvm.org/config +CompileFlags: + Add: + - -Wno-c++11-compat-deprecated-writable-strings + - -Wno-undefined-inline diff --git a/include/DynamicLink.h b/include/DynamicLink.h index c90ea8091..dd5318263 100644 --- a/include/DynamicLink.h +++ b/include/DynamicLink.h @@ -18,10 +18,13 @@ struct DynamicModuleControlBase { virtual const char* getModuleName() const { return NULL; } virtual int getModuleSize() const { return 0; } virtual const char* getModuleTypeString() const { return "Base"; } +#ifdef __MWERKS__ virtual void dump(); +#endif + static void dump(); virtual void dump2() {} virtual bool do_load() { return true; } - virtual BOOL do_load_async() { return true; } + virtual BOOL do_load_async() { return TRUE; } virtual bool do_unload() { return true; } virtual BOOL do_link() { return TRUE; } virtual bool do_unlink() { return true; } @@ -31,7 +34,6 @@ struct DynamicModuleControlBase { BOOL load_async(); bool force_unlink(); - static void dump(); static inline DynamicModuleControlBase* getFirstClass() { return mFirst; } inline DynamicModuleControlBase* getNextClass() { return mNext; } bool isLinked() const { return mLinkCount != 0; } diff --git a/include/JSystem/J3DGraphBase/J3DTransform.h b/include/JSystem/J3DGraphBase/J3DTransform.h index 24103714a..51871ad77 100644 --- a/include/JSystem/J3DGraphBase/J3DTransform.h +++ b/include/JSystem/J3DGraphBase/J3DTransform.h @@ -6,17 +6,11 @@ struct J3DTextureSRTInfo; -// struct J3DTransformInfo { -// /* 0x00 */ JGeometry::TVec3 mScale; -// /* 0x0C */ JGeometry::TVec3 mRotation; -// /* 0x14 */ JGeometry::TVec3 mTranslate; -// }; // Size: 0x20 - -// I doubt this is right but it seems like the only way to prevent an empty ctor being added on array construction struct J3DTransformInfo { /* 0x00 */ Vec mScale; /* 0x0C */ SVec mRotation; /* 0x14 */ Vec mTranslate; + inline J3DTransformInfo& operator=(const J3DTransformInfo& b) { mScale = b.mScale; mRotation = b.mRotation; @@ -65,6 +59,7 @@ inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* d register f32 fra2; register f32 fr01; register f32 fr00; +#ifdef __MWERKS__ asm { psq_l fr00, 0(vec), 0, 0 psq_l fr2, 0(mtx), 0, 0 @@ -87,6 +82,7 @@ inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* d ps_sum0 fra6, fra5, fra6, fra5 psq_st fra6, 8(dst), 1, 0 } +#endif } // regalloc issues @@ -107,6 +103,7 @@ inline void J3DPSMulMtxVec(register MtxP mtx, register SVec* vec, register SVec* register f32 fra2; register f32 fr01; register f32 fr00; +#ifdef __MWERKS__ asm { psq_l fr00, 0(vec), 0, 7 psq_l fr2, 0(mtx), 0, 0 @@ -129,6 +126,7 @@ inline void J3DPSMulMtxVec(register MtxP mtx, register SVec* vec, register SVec* ps_sum0 fra6, fra5, fra6, fra5 psq_st fra6, 4(dst), 1, 7 } +#endif } // regalloc issues @@ -147,6 +145,7 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register Vec* vec, register Vec* register f32 fr2; register f32 fr01; register f32 fr00; +#ifdef __MWERKS__ asm { lis punit, PSMulUnit01@ha psq_l fr00, 0(vec), 0, 0 @@ -173,6 +172,7 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register Vec* vec, register Vec* ps_sum0 fr6, fr5, fr6, fr5 psq_st fr6, 8(dst), 1, 0 } +#endif } // regalloc issues @@ -186,6 +186,7 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec register f32 fr2; register f32 fr01; register f32 fr00; +#ifdef __MWERKS__ asm { lis punit, PSMulUnit01@ha psq_l fr00, 0(vec), 0, 7 @@ -212,6 +213,7 @@ inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec ps_sum0 fr6, fr5, fr6, fr5 psq_st fr6, 4(dst), 1, 7 } +#endif } #endif /* J3DTRANSFORM_H */ diff --git a/include/JSystem/JGadget/binary.h b/include/JSystem/JGadget/binary.h index 88fbed304..02933fd99 100644 --- a/include/JSystem/JGadget/binary.h +++ b/include/JSystem/JGadget/binary.h @@ -63,7 +63,7 @@ struct TParseValue_raw_ { template struct TParseValue_endian_big_ : public TParseValue_raw_ { - static T parse(const void* data) { return TParseValue_raw_::parse(data); } + static T parse(const void* data) { return TParseValue_raw_::parse(data); } }; template class Parser> diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index dfba4f38a..9a14863cd 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -374,7 +374,7 @@ struct TBox2 : TBox > { void set(const TBox2& other) { set(other.i, other.f); } void set(const TVec2& i, const TVec2& f) { this->i.set(i), this->f.set(f); } - void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); } + void set(f32 x0, f32 y0, f32 x1, f32 y1) { this->i.set(x0, y0); this->f.set(x1, y1); } }; // clang-format on diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h index 5be195717..759d94612 100644 --- a/include/JSystem/JMath/JMath.h +++ b/include/JSystem/JMath/JMath.h @@ -15,9 +15,11 @@ inline f32 JMAFastReciprocal(f32 value) { inline float __frsqrtes(register double f) { register float out; // clang-format off +#ifdef __MWERKS__ asm { frsqrte out, f } +#endif // clang-format on return out; } @@ -25,9 +27,11 @@ inline float __frsqrtes(register double f) { inline f32 JMAFastSqrt(register f32 input) { if (input > 0.0f) { register f32 out; +#ifdef __MWERKS__ asm { frsqrte out, input } +#endif return out * input; } else { return input; @@ -43,18 +47,21 @@ inline f32 fastReciprocal(f32 value) { inline void gekko_ps_copy3(register void* dst, register const void* src) { register f32 src0; register f32 src1; +#ifdef __MWERKS__ asm { psq_l src0, 0(src), 0, 0 lfs src1, 8(src) psq_st src0, 0(dst), 0, 0 stfs src1, 8(dst) }; +#endif } inline void gekko_ps_copy6(register void* dst, register const void* src) { register f32 src0; register f32 src1; register f32 src2; +#ifdef __MWERKS__ asm { psq_l src0, 0(src), 0, 0 psq_l src1, 8(src), 0, 0 @@ -63,6 +70,7 @@ inline void gekko_ps_copy6(register void* dst, register const void* src) { psq_st src1, 8(dst), 0, 0 psq_st src2, 16(dst), 0, 0 }; +#endif } inline void gekko_ps_copy12(register void* dst, register const void* src) { @@ -72,6 +80,7 @@ inline void gekko_ps_copy12(register void* dst, register const void* src) { register f32 src3; register f32 src4; register f32 src5; +#ifdef __MWERKS__ asm { psq_l src0, 0(src), 0, 0 psq_l src1, 8(src), 0, 0 @@ -86,6 +95,7 @@ inline void gekko_ps_copy12(register void* dst, register const void* src) { psq_st src4, 32(dst), 0, 0 psq_st src5, 40(dst), 0, 0 }; +#endif } inline void gekko_ps_copy16(register void* dst, register const void* src) { @@ -97,6 +107,7 @@ inline void gekko_ps_copy16(register void* dst, register const void* src) { register f32 src5; register f32 src6; register f32 src7; +#ifdef __MWERKS__ asm { psq_l src0, 0(src), 0, 0 psq_l src1, 8(src), 0, 0 @@ -115,6 +126,7 @@ inline void gekko_ps_copy16(register void* dst, register const void* src) { psq_st src6, 48(dst), 0, 0 psq_st src7, 56(dst), 0, 0 }; +#endif } }; // namespace JMath diff --git a/include/JSystem/JMessage/resource.h b/include/JSystem/JMessage/resource.h index 283a22b24..5acedbe71 100644 --- a/include/JSystem/JMessage/resource.h +++ b/include/JSystem/JMessage/resource.h @@ -4,7 +4,6 @@ #include "JSystem/JGadget/binary.h" #include "JSystem/JGadget/linklist.h" #include "JSystem/JMessage/data.h" -#include "JSystem/JUtility/JUTDataHeader.h" namespace JMessage { namespace data { @@ -47,7 +46,12 @@ namespace JMessage { /* 0x18 */ data::JUTMesgIDData* mMessageID; }; +#ifdef __MWERKS__ class TResourceContainer : public JGadget::TLinkList_factory { +#else + // clangd does not support offsetof in template arguments. + class TResourceContainer : public JGadget::TLinkList_factory { +#endif public: TResourceContainer(); virtual TResource* Do_create(); diff --git a/include/JSystem/JStudio/JStudio/functionvalue.h b/include/JSystem/JStudio/JStudio/functionvalue.h index eed1437e2..2c1ab7e91 100644 --- a/include/JSystem/JStudio/JStudio/functionvalue.h +++ b/include/JSystem/JStudio/JStudio/functionvalue.h @@ -18,7 +18,7 @@ class TFunctionValueAttribute_interpolate; class TFunctionValue { public: - enum TEProgress { PROG_INIT }; + enum TEProgress { PROG_INIT, PROG_UNK1, PROG_UNK2, PROG_UNK3, PROG_UNK4 }; enum TEAdjust { ADJ_INIT, ADJ_UNK1, ADJ_UNK2, ADJ_UNK3, ADJ_UNK4 }; enum TEOutside { OUT_INIT }; enum TEInterpolate {}; diff --git a/include/JSystem/JStudio/JStudio/stb.h b/include/JSystem/JStudio/JStudio/stb.h index 708c34e07..5735c9282 100644 --- a/include/JSystem/JStudio/JStudio/stb.h +++ b/include/JSystem/JStudio/JStudio/stb.h @@ -166,15 +166,15 @@ struct TParseData { } bool isEnd() const { - return m_data->_0 == 0; + return m_data->status == 0; } bool empty() const { - return m_data->_c == NULL; + return m_data->fileCount == NULL; } bool isValid() const { - return !empty() && m_data->_0 == 50; + return !empty() && m_data->status == 50; } data::TParse_TParagraph_data::TData* m_data; @@ -182,14 +182,14 @@ struct TParseData { template struct TParseData_fixed : public TParseData { - TParseData_fixed(const void* pContent) : TParseData(pContent) {} + TParseData_fixed(const void* pContent) : TParseData(pContent) {} const void* getNext() const { - return m_data->_c; + return this->m_data->fileCount; } bool isValid() const { - return TParseData::isValid() && getNext() != NULL; + return TParseData::isValid() && getNext() != NULL; } }; diff --git a/include/JSystem/JUtility/JUTConsole.h b/include/JSystem/JUtility/JUTConsole.h index 0883e9197..ded3914af 100644 --- a/include/JSystem/JUtility/JUTConsole.h +++ b/include/JSystem/JUtility/JUTConsole.h @@ -131,7 +131,12 @@ class JUTConsoleManager { static JUTConsoleManager* sManager; +#ifdef __MWERKS__ typedef JGadget::TLinkList ConsoleList; +#else + // clangd does not support offsetof in template arguments. + typedef JGadget::TLinkList ConsoleList; +#endif private: /* 0x00 */ ConsoleList soLink_; diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index bcb752b40..1a0b3f0eb 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -1,9 +1,10 @@ #ifndef D_A_PLAYER #define D_A_PLAYER -#include "f_op/f_op_actor_mng.h" +#include "f_op/f_op_actor.h" #include "d/d_particle.h" #include "d/d_cc_d.h" +#include "d/d_item_data.h" inline u8 dComIfGs_getSelectEquip(int i_no); inline u8 dComIfGp_getMiniGameType(); diff --git a/include/d/actor/d_a_player_main_data.h b/include/d/actor/d_a_player_main_data.h index 59d4482cb..6d0d0a8c3 100644 --- a/include/d/actor/d_a_player_main_data.h +++ b/include/d/actor/d_a_player_main_data.h @@ -1,5 +1,5 @@ -#include "d/d_cc_d.h" +#include "dolphin/mtx/vec.h" extern char l_arcName[]; @@ -37,10 +37,3 @@ extern const Vec l_crawl_rside_offset; extern const Vec l_crawl_lside_front_offset; extern const Vec l_crawl_rside_front_offset; extern const Vec l_crawl_min_side_offset; - -extern dCcD_SrcCyl l_cyl_src; -extern dCcD_SrcCyl l_wind_cyl_src; -extern dCcD_SrcCyl l_at_cyl_src; -extern dCcD_SrcCps l_at_cps_src; -extern dCcD_SrcCps l_fan_wind_cps_src; -extern dCcD_SrcSph l_fan_wind_sph_src; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index effc690e0..6e354917a 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -3464,11 +3464,12 @@ inline void dComIfG_TimerDeleteRequest() { dComIfG_getTimerPtr()->deleteRequest(); } inline void dComIfG_TimerStart(int timer, s16 mode) { - if (dComIfG_getTimerMode() == mode && dComIfG_getTimerPtr() != NULL) + if (dComIfG_getTimerMode() == mode && dComIfG_getTimerPtr() != NULL) { if (timer != 0) dComIfG_getTimerPtr()->start(timer); else dComIfG_getTimerPtr()->start(); + } } inline void dComIfG_TimerReStart(int timer) { if (dComIfG_getTimerPtr() != NULL) diff --git a/include/d/d_particle_name.h b/include/d/d_particle_name.h index 6fc713fa8..0091f7c7b 100644 --- a/include/d/d_particle_name.h +++ b/include/d/d_particle_name.h @@ -24,8 +24,8 @@ namespace dPa_name { ID_SCENE_END = 0x8466, }; - u16 j_o_id[]; - u16 s_o_id[]; + extern u16 j_o_id[]; + extern u16 s_o_id[]; } #endif /* D_PARTICLE_NAME */ diff --git a/include/dolphin/os/OS.h b/include/dolphin/os/OS.h index d37a4f3f3..88a393fd9 100644 --- a/include/dolphin/os/OS.h +++ b/include/dolphin/os/OS.h @@ -121,10 +121,12 @@ inline s16 __OSf32tos16(register f32 inF) { u32 tmp; register u32* tmpPtr = &tmp; // clang-format off +#ifdef __MWERKS__ asm { psq_st inF, 0(tmpPtr), 0x1, 5 lha out, 0(tmpPtr) } +#endif // clang-format on return out; @@ -139,10 +141,12 @@ inline u8 __OSf32tou8(register f32 inF) { u32 tmp; register u32* tmpPtr = &tmp; // clang-format off +#ifdef __MWERKS__ asm { psq_st inF, 0(tmpPtr), 0x1, 2 lbz out, 0(tmpPtr) } +#endif // clang-format on return out; @@ -154,6 +158,7 @@ inline void OSf32tou8(f32* f, u8* out) { static inline void OSInitFastCast(void) { // clang-format off +#ifdef __MWERKS__ asm { li r3, 4 oris r3, r3, 4 @@ -168,6 +173,7 @@ static inline void OSInitFastCast(void) { oris r3, r3, 7 mtspr GQR5, r3 } +#endif // clang-format on } diff --git a/include/dolphin/os/OSLink.h b/include/dolphin/os/OSLink.h index f344c9bc1..c2af63ff4 100644 --- a/include/dolphin/os/OSLink.h +++ b/include/dolphin/os/OSLink.h @@ -19,14 +19,14 @@ typedef struct OSSectionInfo OSSectionInfo; typedef struct OSImportInfo OSImportInfo; typedef struct OSRel OSRel; -OSModuleQueue __OSModuleList AT_ADDRESS(0x800030C8); -void* __OSStringTable AT_ADDRESS(0x800030D0); - struct OSModuleQueue { OSModuleInfo* head; OSModuleInfo* tail; }; +OSModuleQueue __OSModuleList AT_ADDRESS(0x800030C8); +void* __OSStringTable AT_ADDRESS(0x800030D0); + struct OSModuleLink { OSModuleInfo* next; OSModuleInfo* prev; diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index de611923b..7d21c7380 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -225,10 +225,7 @@ class JntHit_c; struct fopAc_cullSizeSphere { public: -#ifdef __INTELLISENSE__ - /* 0x0 */ Vec center; - /* 0xC */ f32 radius; -#else +#ifdef __MWERKS__ /* 0x0 */ cXyz center; /* 0xC */ f32 radius; @@ -238,15 +235,21 @@ struct fopAc_cullSizeSphere { radius = r; } ~fopAc_cullSizeSphere() {} +#else + /* 0x0 */ Vec center; + /* 0xC */ f32 radius; #endif }; +#ifdef __MWERKS__ +#define fopAc_MakeCullSizeSphere(center, radius) fopAc_cullSizeSphere(center, radius) +#else +#define fopAc_MakeCullSizeSphere(center, radius) {(Vec)center, radius} +#endif + struct fopAc_cullSizeBox { public: -#ifdef __INTELLISENSE__ - /* 0x0 */ Vec min; - /* 0xC */ Vec max; -#else +#ifdef __MWERKS__ fopAc_cullSizeBox() {} fopAc_cullSizeBox(const fopAc_cullSizeBox& box) { min = box.min; @@ -260,9 +263,18 @@ struct fopAc_cullSizeBox { /* 0x0 */ cXyz min; /* 0xC */ cXyz max; +#else + /* 0x0 */ Vec min; + /* 0xC */ Vec max; #endif }; +#ifdef __MWERKS__ +#define fopAc_MakeCullSizeBox(min, max) fopAc_cullSizeBox(min, max) +#else +#define fopAc_MakeCullSizeBox(min, max) {(Vec)min, (Vec)max} +#endif + class fopAc_ac_c : public leafdraw_class { public: /* 0x0C0 */ int actor_type; diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 4e266820d..2be8a4364 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -1,7 +1,7 @@ #ifndef F_OP_ACTOR_MNG_H_ #define F_OP_ACTOR_MNG_H_ -#include "new.h" +#include "new.h" // IWYU pragma: keep // Used by the fopAcM_SetupActor macro. #include "f_op/f_op_actor.h" #include "f_op/f_op_actor_iter.h" #include "f_pc/f_pc_manager.h" @@ -461,14 +461,22 @@ void fopAcM_DeleteHeap(fopAc_ac_c* p_actor); bool fopAcM_entrySolidHeap(fopAc_ac_c* p_actor, heapCallbackFunc p_heapCallback, u32 size); inline void fopAcM_SetMin(fopAc_ac_c* p_actor, f32 minX, f32 minY, f32 minZ) { -#ifndef __INTELLISENSE__ +#ifdef __MWERKS__ p_actor->cull.box.min.set(minX, minY, minZ); +#else + p_actor->cull.box.min.x = minX; + p_actor->cull.box.min.y = minY; + p_actor->cull.box.min.z = minZ; #endif } inline void fopAcM_SetMax(fopAc_ac_c* p_actor, f32 maxX, f32 maxY, f32 maxZ) { -#ifndef __INTELLISENSE__ +#ifdef __MWERKS__ p_actor->cull.box.max.set(maxX, maxY, maxZ); +#else + p_actor->cull.box.max.x = maxX; + p_actor->cull.box.max.y = maxY; + p_actor->cull.box.max.z = maxZ; #endif } diff --git a/src/JSystem/J2DGraph/J2DPicture.cpp b/src/JSystem/J2DGraph/J2DPicture.cpp index d9c860168..66a55c4d7 100644 --- a/src/JSystem/J2DGraph/J2DPicture.cpp +++ b/src/JSystem/J2DGraph/J2DPicture.cpp @@ -197,7 +197,7 @@ bool J2DPicture::remove(u8 idx) { mBlendKonstColorF[i] = mBlendKonstColorF[i + 1]; mBlendKonstAlphaF[i] = mBlendKonstAlphaF[i + 1]; } - mValidTexture = mValidTexture & (1 << idx) - 1 | ((mValidTexture & ~((1 << idx + 1) - 1)) >> 1); + mValidTexture = mValidTexture & (1 << idx) - 1 | ((mValidTexture & ~((1 << (idx + 1)) - 1)) >> 1); mNumTexture--; setBlendKonstColor(); setBlendKonstAlpha(); diff --git a/src/JSystem/J2DGraph/J2DPrint.cpp b/src/JSystem/J2DGraph/J2DPrint.cpp index 40ecea86e..c8fc3dd43 100644 --- a/src/JSystem/J2DGraph/J2DPrint.cpp +++ b/src/JSystem/J2DGraph/J2DPrint.cpp @@ -124,13 +124,13 @@ void J2DPrint::printReturn(const char* param_1, f32 param_2, f32 param_3, J2DTex for (int iVar8 = 0; local_2b0[iVar8] != 0xffff; iVar8++) { switch (param_4) { - case VBIND_TOP: + case HBIND_LEFT: local_2b0[iVar8] = 0; break; - case VBIND_BOTTOM: + case HBIND_RIGHT: local_2b0[iVar8] = param_2 - local_2b0[iVar8]; break; - case VBIND_CENTER: + case HBIND_CENTER: f32 fVar1 = (local_2b0[iVar8]); fVar1 = param_2 - fVar1; f32 ratio = 0.5f; @@ -329,7 +329,7 @@ void J2DPrint::doCtrlCode(int param_1) { case 9: if (field_0x20 > 0) { f32 fVar1 = field_0x2c; - field_0x2c = field_0x20 + field_0x20 * ((int)field_0x2c / field_0x20); + field_0x2c = field_0x20 + field_0x20 * (int)((int)field_0x2c / field_0x20); field_0x34 = field_0x2c - fVar1; } break; @@ -397,12 +397,13 @@ u16 J2DPrint::doEscapeCode(const u8** param_1, u8 param_2) { case 'LD': mCursorV += field_0x14; break; - case 'ST': + case 'ST': { s32 val = getNumberS32(param_1, field_0x20, field_0x20, 10); if (val > 0) { field_0x20 = val; } break; + } case 'CC': field_0x8 = getNumberS32(param_1, *(u32*)&mCharColor, *(u32*)&field_0x8, 16); local_40 = field_0x8; @@ -431,25 +432,27 @@ u16 J2DPrint::doEscapeCode(const u8** param_1, u8 param_2) { } mFont->setGradColor(local_40, *local_74); break; - case 'FX': + case 'FX': { f32 dVar13 = getNumberF32(param_1, mFontSizeX, field_0x18, 10); if (dVar13 >= 0) { field_0x18 = dVar13; } break; - case 'FY': + } + case 'FY': { f32 dVar14 = getNumberF32(param_1, mFontSizeY, field_0x1c, 10); if (dVar14 >= 0) { field_0x1c = dVar14; } break; + } case 'SH': field_0x10 = getNumberF32(param_1, field_0x48, field_0x10, 10); break; case 'SV': field_0x14 = getNumberF32(param_1, field_0x4c, field_0x14, 10); break; - case 'GM': + case 'GM': { s32 isZero = getNumberS32(param_1, field_0x22 == 0, field_0x22, 10) == 0; field_0x22 = isZero == 0; local_40.a = local_40.a * param_2 / 0xff; @@ -463,6 +466,7 @@ u16 J2DPrint::doEscapeCode(const u8** param_1, u8 param_2) { } mFont->setGradColor(local_40, *local_80); break; + } case 'HM': break; default: diff --git a/src/JSystem/J2DGraph/J2DScreen.cpp b/src/JSystem/J2DGraph/J2DScreen.cpp index c86b62f6d..292897074 100644 --- a/src/JSystem/J2DGraph/J2DScreen.cpp +++ b/src/JSystem/J2DGraph/J2DScreen.cpp @@ -41,12 +41,13 @@ s32 J2DScreen::makeHierarchyPanes(J2DPane* pParent, JSURandomInputStream* pStrea case 'EXT1': pStream->seek(header.mSize, JSUStreamSeekFrom_CUR); return 1; - case 'BGN1': + case 'BGN1': { pStream->seek(header.mSize, JSUStreamSeekFrom_CUR); s32 ret = makeHierarchyPanes(pPane, pStream); if (ret != 0) return ret; break; + } case 'END1': pStream->seek(header.mSize, JSUStreamSeekFrom_CUR); return 0; diff --git a/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp b/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp index 863841095..0fa5ac9e6 100644 --- a/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp @@ -336,6 +336,7 @@ f32 J3DHermiteInterpolationS(f32 t, s16* time0, s16* value0, s16* tangent0, s16* register s16* p6 = value1; register s16* p7 = tangent1; register f32 fout; +#ifdef __MWERKS__ asm { psq_l f0, 0(p2), 0x1, 5 psq_l f3, 0(p5), 0x1, 5 @@ -358,6 +359,7 @@ f32 J3DHermiteInterpolationS(f32 t, s16* time0, s16* value0, s16* tangent0, s16* fmadds fout, f5, f7, fout fsubs fout, fout, f3 } +#endif return fout; } diff --git a/src/JSystem/J3DGraphAnimator/J3DModel.cpp b/src/JSystem/J3DGraphAnimator/J3DModel.cpp index c70890515..0252093f3 100644 --- a/src/JSystem/J3DGraphAnimator/J3DModel.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DModel.cpp @@ -598,7 +598,7 @@ extern void J3DPSMtxArrayConcat(f32(*)[4], f32(*)[4], f32(*)[4], u32); void J3DModel::calcDrawMtx() { u16 i; switch (getMtxCalcMode()) { - case 0: + case 0: { MtxP viewMtx = j3dSys.getViewMtx(); for (i = 0; i < mModelData->getDrawFullWgtMtxNum(); i++) { u16 drawMtxIdx = mModelData->getDrawMtxIndex(i); @@ -608,6 +608,7 @@ void J3DModel::calcDrawMtx() { J3DPSMtxArrayConcat(viewMtx, getWeightAnmMtx(0), getDrawMtx(mModelData->getDrawFullWgtMtxNum()), mModelData->getWEvlpMtxNum()); } break; + } case 1: for (i = 0; i < mModelData->getDrawFullWgtMtxNum(); i++) { MTXCopy(getAnmMtx(mModelData->getDrawMtxIndex(i)), getDrawMtx(i)); diff --git a/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp b/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp index 23c7108a0..d18839bfb 100644 --- a/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp +++ b/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp @@ -181,7 +181,7 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(const void* i_data, u32 i_fl readMaterialDL((J3DMaterialDLBlock*)block, i_flags); modifyMaterial(i_flags); break; - case 'MAT3': + case 'MAT3': { u32 matFlags = 0x50100000; matFlags |= i_flags & 0x03000000; mpMaterialBlock = (J3DMaterialBlock*)block; @@ -192,6 +192,7 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(const void* i_data, u32 i_fl readPatchedMaterial((J3DMaterialBlock*)block, matFlags); } break; + } default: OSReport("Unknown data block\n"); break; diff --git a/src/JSystem/JAudio/dspproc.c b/src/JSystem/JAudio/dspproc.c index f24ed73ea..ddddb8fdc 100644 --- a/src/JSystem/JAudio/dspproc.c +++ b/src/JSystem/JAudio/dspproc.c @@ -6,7 +6,6 @@ #include "JSystem/JAudio/dspproc.h" #include "JSystem/JAudio/JASDSPInterface.h" #include "JSystem/JAudio/dsptask.h" -#include "dolphin/dsp.h" /* 8028E600-8028E648 .text DSPReleaseHalt2__FUl */ void DSPReleaseHalt2(u32 msg) { diff --git a/src/JSystem/JStudio/JStudio/functionvalue.cpp b/src/JSystem/JStudio/JStudio/functionvalue.cpp index 00ad17a34..b49539405 100644 --- a/src/JSystem/JStudio/JStudio/functionvalue.cpp +++ b/src/JSystem/JStudio/JStudio/functionvalue.cpp @@ -168,23 +168,23 @@ void TFunctionValueAttribute_range::range_prepare() { default: JUTWarn w; w << "unknown progress : " << progress; - case 0: + case TFunctionValue::PROG_INIT: _20 = 0.0; _28 = 1.0; break; - case 1: + case TFunctionValue::PROG_UNK1: _20 = 0.0; _28 = -1.0; break; - case 2: + case TFunctionValue::PROG_UNK2: _20 = fBegin_; _28 = -1.0; break; - case 3: + case TFunctionValue::PROG_UNK3: _20 = fEnd_; _28 = -1.0; break; - case 4: + case TFunctionValue::PROG_UNK4: _20 = 0.5 * (fBegin_ + fEnd_); _28 = -1.0; break; @@ -307,7 +307,7 @@ f64 TFunctionValue_composite::composite_index(const JGadget::TVector_pointer= 4; bytesRemaining -= 4, aStr32++, bStr32++) { + for (; bytesRemaining >= 4; bytesRemaining -= 4, aStr32++, bStr32++) { if (*aStr32 != *bStr32) { return false; } diff --git a/src/JSystem/JStudio/JStudio/stb.cpp b/src/JSystem/JStudio/JStudio/stb.cpp index 6927490cd..7ba5137b8 100644 --- a/src/JSystem/JStudio/JStudio/stb.cpp +++ b/src/JSystem/JStudio/JStudio/stb.cpp @@ -174,18 +174,20 @@ void TObject::process_sequence_() { JUT_EXPECT(pContent == 0); setWait(u32Value); break; - case 3: + case 3: { JUT_EXPECT(pContent == 0); s32 off = toInt32FromUInt24_(u32Value); void* nextseq = (void*)getSequence_offset(off); setSequence_next(nextseq); break; - case 4: + } + case 4: { JUT_EXPECT(pContent == 0); u32 val = toInt32FromUInt24_(u32Value); suspend(val); break; - case 0x80: + } + case 0x80: { ASSERT(pContent != 0); void* p = (void*)pContent; data::TParse_TParagraph para(NULL); @@ -204,6 +206,7 @@ void TObject::process_sequence_() { } JUT_EXPECT(p == pNext); break; + } default: break; } @@ -218,19 +221,21 @@ void TObject::process_paragraph_reserved_(u32 arg1, const void* pContent, u32 uS case 0x2: setWait(*(u32*)pContent); break; - case 0x3: + case 0x3: { const void* seq = getSequence_offset(*(s32*)pContent); setSequence_next(seq); break; + } case 0x80: on_data(NULL, 0, pContent, uSize); break; - case 0x81: + case 0x81: { data::TParse_TParagraph_dataID dataID(pContent); const void* temp = dataID.getContent(); on_data(dataID.get_ID(), dataID.get_IDSize(), temp, uSize - ((u32)temp - (u32)dataID.getRaw())); break; + } case 0x82: break; } diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h index a5cb01cbd..e0277701f 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h @@ -28,11 +28,15 @@ double cos(double); float cosf(float); double exp(double); +extern double __fabs(double); extern float __fabsf(float); inline double fabs(double f) { return __fabs(f); } +double __frsqrte(double); +float __fres(float); + double floor(double); double fmod(double, double); @@ -45,10 +49,6 @@ float sinf(float); double tan(double); float tanf(float); -inline double sqrt_step(double tmpd, float mag) { - return tmpd * 0.5 * (3.0 - mag * (tmpd * tmpd)); -} - extern inline double sqrt(double x) { if(x > 0.0) { diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stddef.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stddef.h index 2bdec36a5..f5aba5015 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stddef.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stddef.h @@ -5,7 +5,7 @@ extern "C" { #endif -#if defined __INTELLISENSE__ +#ifdef __INTELLISENSE__ typedef unsigned int size_t; typedef int ptrdiff_t; #else diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c index 128eaed85..4319f8e13 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c @@ -947,7 +947,7 @@ static int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* Wr long_num = (signed char)long_num; } - if ((format.argument_options == long_long_argument)) { + if (format.argument_options == long_long_argument) { if (!(buff_ptr = longlong2str(long_long_num, buff + 512, format))) { goto conversion_error; } @@ -980,7 +980,7 @@ static int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* Wr long_num = (unsigned char)long_num; } - if ((format.argument_options == long_long_argument)) { + if (format.argument_options == long_long_argument) { if (!(buff_ptr = longlong2str(long_long_num, buff + 512, format))) { goto conversion_error; } diff --git a/src/d/actor/d_a_agbsw0.cpp b/src/d/actor/d_a_agbsw0.cpp index 5e0110164..176b3786e 100644 --- a/src/d/actor/d_a_agbsw0.cpp +++ b/src/d/actor/d_a_agbsw0.cpp @@ -1738,13 +1738,14 @@ BOOL daAgbsw0_c::MoveCheck(s16 conditionNo) { } break; - case 5: + case 5: { daGhostship_c* gship = (daGhostship_c*)fopAcM_searchFromName("Ayush", 0, 0); if(gship && gship->checkInShip()) { return 0; } break; + } case 6: if(dComIfGs_isEventBit(0x1A10)) { return 0; diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 8ddbdde30..10e3b3ef9 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -521,7 +521,7 @@ static void action_dousa(am_class* i_this) { i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this); i_this->mState += 1; // Fall-through - case 4: + case 4: { if (i_this->mCountDownTimers[2] == 1) { i_this->mNeedleCyl.OnAtSPrmBit(AT_SPRM_SET); i_this->mNeedleCyl.OnAtHitBit(); @@ -555,6 +555,7 @@ static void action_dousa(am_class* i_this) { i_this->mState += 1; } break; + } case 5: i_this->speedF = 30.0f; i_this->gravity = -11.0f; @@ -655,7 +656,7 @@ static void action_dousa(am_class* i_this) { /* 00002564-000028C4 .text action_modoru_move__FP8am_class */ static void action_modoru_move(am_class* i_this) { switch (i_this->mState) { - case 0x14: + case 0x14: { anm_init(i_this, AM_BCK_CLOSE_LOOP, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); i_this->mNeedleCyl.OnAtSetBit(); i_this->mNeedleCyl.OnAtHitBit(); @@ -669,9 +670,10 @@ static void action_modoru_move(am_class* i_this) { i_this->mTargetAngleY = cM_atan2s(xDistToSpawn, zDistToSpawn); i_this->mState += 1; break; - case 0x15: - xDistToSpawn = i_this->mSpawnPos.x - i_this->current.pos.x; - zDistToSpawn = i_this->mSpawnPos.z - i_this->current.pos.z; + } + case 0x15: { + f32 xDistToSpawn = i_this->mSpawnPos.x - i_this->current.pos.x; + f32 zDistToSpawn = i_this->mSpawnPos.z - i_this->current.pos.z; if (i_this->mAcch.ChkGroundHit()) { i_this->mSmokeCbs[0].end(); dComIfGp_particle_setToon( @@ -697,7 +699,8 @@ static void action_modoru_move(am_class* i_this) { i_this->mState += 1; } break; - case 0x16: + } + case 0x16: { s16 angleDiff = cLib_distanceAngleS(i_this->shape_angle.y, i_this->mTargetAngleY); if (angleDiff < 0x100) { i_this->mNeedleCyl.OffAtSetBit(); @@ -708,13 +711,14 @@ static void action_modoru_move(am_class* i_this) { } break; } + } } /* 000028C4-00002A6C .text action_handou_move__FP8am_class */ static void action_handou_move(am_class* i_this) { daPy_py_c* player = daPy_getPlayerActorClass(); switch (i_this->mState) { - case 0x1E: + case 0x1E: { i_this->speedF = 20.0f; s16 angleToPlayer = fopAcM_searchPlayerAngleY(i_this); i_this->current.angle.y = angleToPlayer + 0x8000; @@ -731,7 +735,9 @@ static void action_handou_move(am_class* i_this) { anm_init(i_this, AM_BCK_CLOSE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); } i_this->mState += 1; - case 0x1F: + // Fall-through + } + case 0x1F: { cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f); if (i_this->speedF < 0.1f) { i_this->speedF = 0.0f; @@ -740,6 +746,8 @@ static void action_handou_move(am_class* i_this) { i_this->mAction = ACTION_DOUSA; i_this->mState = 3; } + break; + } } } diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index d6e82ee37..6b5d494f1 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -471,7 +471,7 @@ static void action_dousa(am2_class* i_this) { } i_this->mState++; // Fall-through - case 1: + case 1: { f32 playerDist = fopAcM_searchPlayerDistance(i_this); if (playerDist < i_this->mAreaRadius) { cXyz centerPos = player->current.pos; @@ -487,6 +487,7 @@ static void action_dousa(am2_class* i_this) { } } break; + } case 2: if (i_this->mpMorf->checkFrame(24.0f)) { fopAcM_seStart(i_this, JA_SE_CM_AM2_SPIKE_OUT, 0); @@ -496,12 +497,12 @@ static void action_dousa(am2_class* i_this) { } i_this->mState++; // Fall-through - case 3: + case 3: { for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { i_this->mCountUpTimers[i] = 0; } i_this->speedF = 0.0f; - playerDist = fopAcM_searchPlayerDistance(i_this); + f32 playerDist = fopAcM_searchPlayerDistance(i_this); f32 radiusAdjust = 200.0f; if (playerDist > i_this->mAreaRadius + radiusAdjust) { i_this->mState = 6; @@ -518,6 +519,7 @@ static void action_dousa(am2_class* i_this) { i_this->mState++; } break; + } case 4: if (i_this->mAcch.ChkGroundHit()) { i_this->gravity = -3.0f; @@ -961,7 +963,7 @@ static void action_itai(am2_class* i_this) { static void action_handou_move(am2_class* i_this) { daPy_py_c* player = daPy_getPlayerActorClass(); switch (i_this->mState) { - case 0x1E: + case 0x1E: { i_this->speedF = 40.0f; s16 angleToPlayer = fopAcM_searchPlayerAngleY(i_this); i_this->current.angle.y = angleToPlayer + 0x8000; @@ -975,6 +977,8 @@ static void action_handou_move(am2_class* i_this) { i_this->mNeedleCyl.ClrTgHit(); i_this->mTargetAngleY = i_this->current.angle.y; i_this->mState++; + // Fall-through + } case 0x1F: fopAcM_seStart(i_this, JA_SE_CM_AM2_SLIP, 0); cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index c6c7a4bf2..d8725a270 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -567,7 +567,7 @@ void daAuction_c::privateCut() { evtRes = eventGetItem(); break; case 7: - evtRes = &eventMesSet != NULL; + evtRes = &daAuction_c::eventMesSet != NULL; break; case 8: evtRes = eventCameraOffNpc(); @@ -720,7 +720,7 @@ void daAuction_c::eventMainInit() { restMsgTime = l_rest_msg_time1[i]; } - if (60000 > restMsgTime) break; + if (60000 > restMsgTime) break; // Bug: restMsgTime is an s16, so this condition is always true. m82A += 1; } @@ -1307,7 +1307,7 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { dAuction_screen_slotShow(); *pMsgNo = 0x1CF8; break; - case 0x1CF9: + case 0x1CF9: { dComIfGp_setMiniGameRupee(mCurrBid); dComIfGp_setAuctionRupee(mCurrBid); if (m82C < 4) { @@ -1330,7 +1330,8 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { setLinkAnm(1); } break; - case 0x1CFA: + } + case 0x1CFA: { s16 msgSetNo = dComIfGp_getMessageSetNumber(); if (dComIfGs_getRupee() < msgSetNo) { @@ -1371,6 +1372,7 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { dComIfGp_setMessageCountNumber(mCurrBid); } break; + } case 0x1CFC: if (mpCurrMsg->mSelectNum == 0) { *pMsgNo = 0x1D1F; @@ -1396,13 +1398,13 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { case 0x1D20: case 0x1D21: case 0x1D22: - case 0x1D23: + case 0x1D23: { setLinkAnm(0x14); int rnd = getRand(6) + 1; *pMsgNo = l_npc_msg_dat[getAucMdlNo(rnd)].field_0x06; m825 = rnd; break; - + } case 0x1D48: case 0x33A2: case 0x33A8: diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index bcfe54eee..982903cf7 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -166,7 +166,7 @@ static void smoke_set_s(bk_class* i_this, f32 rate) { case dBgS_Attr_DIRT_e: case dBgS_Attr_WOOD_e: case dBgS_Attr_STONE_e: - case dBgS_Attr_SAND_e: + case dBgS_Attr_SAND_e: { i_this->m0350.end(); JPABaseEmitter* emitter1 = dComIfGp_particle_setToon( 0x2022, &i_this->m0338, &i_this->m0344, NULL, 0xB9, @@ -182,6 +182,7 @@ static void smoke_set_s(bk_class* i_this, f32 rate) { emitter1->setGlobalParticleScale(scale); } break; + } case dBgS_Attr_GRASS_e: JPABaseEmitter* emitter2 = dComIfGp_particle_set(0x24, &i_this->m0338, &i_this->m0344); if (emitter2) { @@ -1457,7 +1458,7 @@ static void stand2(bk_class* i_this) { case 0x00: i_this->dr.m004 = 1; // Fall-through - case 0x01: + case 0x01: { if (i_this->mpSearchLight != NULL) { i_this->mpSearchLight->setBkControl(true); } @@ -1490,6 +1491,7 @@ static void stand2(bk_class* i_this) { cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->home.angle.y, 2, 0x800); i_this->speedF = 0.0f; break; + } case 0x0A: i_this->m0B7B = 1; if (i_this->m0300[1] == 30) { @@ -1537,11 +1539,12 @@ static void stand2(bk_class* i_this) { i_this->m0300[2] = 60; } break; - case 0x34: + case 0x34: { dPath__Point* pnt = &i_this->ppd->mpPnt[i_this->m1216]; i_this->m0320 = pnt->mPos; sp24 = i_this->m0320 - i_this->current.pos; goto temp_568; + } case 0x3C: sp24 = i_this->home.pos - i_this->current.pos; temp_568: diff --git a/src/d/actor/d_a_item.cpp b/src/d/actor/d_a_item.cpp index 76e6b60dc..11b4b78b0 100644 --- a/src/d/actor/d_a_item.cpp +++ b/src/d/actor/d_a_item.cpp @@ -657,20 +657,22 @@ void daItem_c::itemGetExecute() { case dItem_DEKU_LEAF_e: mItemStatus = STATUS_INIT_GET_DEMO; break; - case SWORD: + case SWORD: { daItem_c* item = (daItem_c*)fopAcM_SearchByName(PROC_ITEM); if (item && item->m_itemNo == SHIELD) { item->itemGetExecute(); } mItemStatus = STATUS_INIT_GET_DEMO; break; - case SHIELD: - item = (daItem_c*)fopAcM_SearchByName(PROC_ITEM); + } + case SHIELD: { + daItem_c* item = (daItem_c*)fopAcM_SearchByName(PROC_ITEM); if (item && item->m_itemNo == SWORD) { item->itemGetExecute(); } mItemStatus = STATUS_INIT_GET_DEMO; break; + } case DROPPED_SWORD: mItemStatus = STATUS_INIT_GET_DEMO; break; @@ -1333,12 +1335,13 @@ BOOL daItem_c::initAction() { scale.set(mScaleTarget.x, mScaleTarget.y, mScaleTarget.z); switch (mAction) { - case 4: + case 4: { current.angle.y = cM_rndF((f32)0xFFFF); f32 temp = getData()->field_0x2C + cM_rndF(5.0f); speedF = cM_rndF(getData()->field_0x30); speed.set(0.0f, temp, 0.0f); break; + } case 5: speed.setall(0.0f); speedF = 0.0f; diff --git a/src/d/actor/d_a_mozo.cpp b/src/d/actor/d_a_mozo.cpp index 02695e6aa..5c7ec69c8 100644 --- a/src/d/actor/d_a_mozo.cpp +++ b/src/d/actor/d_a_mozo.cpp @@ -10,9 +10,8 @@ #include "d/d_com_inf_game.h" #include "d/d_kankyo.h" #include "d/d_procname.h" -#include "d/d_cc_d.h" #include "d/d_lib.h" -#include "m_do/m_Do_mtx.h" +#include "m_Do/m_Do_mtx.h" #include "m_Do/m_Do_ext.h" #include "m_Do/m_Do_hostIO.h" diff --git a/src/d/actor/d_a_npc_bs1.cpp b/src/d/actor/d_a_npc_bs1.cpp index 7f83e054f..3ca8750a6 100644 --- a/src/d/actor/d_a_npc_bs1.cpp +++ b/src/d/actor/d_a_npc_bs1.cpp @@ -338,11 +338,11 @@ void daNpc_Bs1_c::checkOrder() { if(eventInfo.checkCommandDemoAccrpt()) { if(m82A == 3) { m82A = 0; - setAction(&getdemo_action, 0); + setAction(&daNpc_Bs1_c::getdemo_action, 0); } else if(m82A == 4) { m82A = 0; - setAction(&event_action, 0); + setAction(&daNpc_Bs1_c::event_action, 0); } } else if (eventInfo.checkCommandTalk()) { @@ -480,7 +480,7 @@ u16 daNpc_Bs1_c::next_msgStatus(u32* pMsgNo) { case 0xF8F: case 0xF94: case 0xF99: - case 0xF9E: + case 0xF9E: { m83C = dComIfGp_getMessageRupee(); int buyMax = daNpc_Bs1_getBuyItemMax(m83C, m840); setBuyItemMax(buyMax); @@ -492,9 +492,10 @@ u16 daNpc_Bs1_c::next_msgStatus(u32* pMsgNo) { *pMsgNo = 0xF7E; break; - case 0xFD4: + } + case 0xFD4: { m83C = dComIfGp_getMessageRupee(); - buyMax = daNpc_Bs1_getBuyItemMax(m83C, m840); + int buyMax = daNpc_Bs1_getBuyItemMax(m83C, m840); setBuyItemMax(buyMax); setBuyItem(buyMax); if(buyMax != 0) { @@ -504,6 +505,7 @@ u16 daNpc_Bs1_c::next_msgStatus(u32* pMsgNo) { *pMsgNo = 0xF7E; break; + } case 0xF7A: case 0xF82: case 0xF87: @@ -936,7 +938,7 @@ u16 daNpc_Bs1_c::next_msgStatus(u32* pMsgNo) { *pMsgNo = 0xF3E; break; case 0xF4C: - case 0xF4E: + case 0xF4E: { int points = dComIfGs_getEventReg(0x86FF); points += 1; points = cLib_maxLimit(points, 0xFF); @@ -966,6 +968,7 @@ u16 daNpc_Bs1_c::next_msgStatus(u32* pMsgNo) { *pMsgNo = 0xF4F; break; + } default: msgStatus = fopMsgStts_MSG_ENDS_e; break; @@ -1564,13 +1567,13 @@ BOOL daNpc_Bs1_c::CreateInit() { switch(mType) { case 0: - setAction(&wait_action, 0); + setAction(&daNpc_Bs1_c::wait_action, 0); m83A = dComIfGp_evmng_getEventIdx("BS1_GETDEMO"); mEventCut.setActorInfo("Bs1", this); mEventCut.setJntCtrlPtr(&mJntCtrl); break; case 1: - setAction(&wait_action, 0); + setAction(&daNpc_Bs1_c::wait_action, 0); m83A = dComIfGp_evmng_getEventIdx("BS2_GETDEMO"); mEventCut.setActorInfo("Bs2", this); mEventCut.setJntCtrlPtr(&mJntCtrl); diff --git a/src/d/actor/d_a_npc_ji1.cpp b/src/d/actor/d_a_npc_ji1.cpp index bf77bef21..51a7b01af 100644 --- a/src/d/actor/d_a_npc_ji1.cpp +++ b/src/d/actor/d_a_npc_ji1.cpp @@ -418,21 +418,21 @@ BOOL daNpc_Ji1_c::normalSubActionHarpoonGuard(s16 param_1) { field_0xC84 = 0xC; field_0x2C8 = field_0x2B0; - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); } else if(field_0xD74 == 5) { setAnm(5, 4.0f, 0); field_0xC84 = 0xD; field_0x2C8 = field_0x2B0; - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); } else if(field_0xD74 > 5) { setAnm(5, 4.0f, 0); field_0xC84 = 0xE; field_0x2C8 = field_0x2B0; - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); field_0xD74 = 0; } @@ -466,21 +466,21 @@ BOOL daNpc_Ji1_c::normalSubActionGuard(s16 param_1) { field_0xC84 = 0xC; field_0x2C8 = field_0x2B0; - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); } else if(field_0xD74 == 5) { setAnm(5, 4.0f, 0); field_0xC84 = 0xD; field_0x2C8 = field_0x2B0; - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); } else if(field_0xD74 > 5) { setAnm(5, 4.0f, 0); field_0xC84 = 0xE; field_0x2C8 = field_0x2B0; - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); } else { setAnm(0x1, 8.0f, 0); @@ -520,7 +520,7 @@ BOOL daNpc_Ji1_c::normalAction(void*) { temp3 -= m_jnt.getBackbone_y(); cLib_addCalcAngleS2(¤t.angle.y, temp3, 8, 0x800); if(cLib_distanceAngleS(current.angle.y, temp3) < 0x100) { - setAction(&talkAction, 0); + setAction(&daNpc_Ji1_c::talkAction, 0); } } @@ -583,7 +583,7 @@ BOOL daNpc_Ji1_c::kaitenExpAction(void*) { else if(field_0xC78 != -1) { int staffIdx = dComIfGp_evmng_getMyStaffId("Ji1"); if(getEventActionNo(staffIdx) == 2) { - setAction(&kaitenspeakAction, 0); + setAction(&daNpc_Ji1_c::kaitenspeakAction, 0); } else { dComIfGp_evmng_cutEnd(staffIdx); @@ -612,7 +612,7 @@ BOOL daNpc_Ji1_c::kaitenspeakAction(void*) { if(temp2 == 0) { m_jnt.clrTrn(); - setAction(&talkAction, 0); + setAction(&daNpc_Ji1_c::talkAction, 0); } } else { @@ -642,8 +642,8 @@ BOOL daNpc_Ji1_c::kaitenwaitAction(void*) { else if(field_0xC78 != -1) { if(!dComIfGs_isEventBit(0x501) && daNpc_Ji1_plRoomOutCheck()) { field_0xC84 = 9; - setAction(&eventAction, 0); - field_0x2C8 = &kaitenwaitAction; + setAction(&daNpc_Ji1_c::eventAction, 0); + field_0x2C8 = &daNpc_Ji1_c::kaitenwaitAction; return true; } @@ -670,7 +670,7 @@ BOOL daNpc_Ji1_c::kaitenwaitAction(void*) { temp3 -= m_jnt.getBackbone_y(); cLib_addCalcAngleS2(¤t.angle.y, temp3, 8, 0x800); if(cLib_distanceAngleS(current.angle.y, temp3) < 0x100) { - setAction(&talkAction, 0); + setAction(&daNpc_Ji1_c::talkAction, 0); } } @@ -682,7 +682,7 @@ BOOL daNpc_Ji1_c::kaitenwaitAction(void*) { field_0xD79 = 1; dComIfGp_getDetect().set_quake(0); - setAction(&kaitenAction, 0); + setAction(&daNpc_Ji1_c::kaitenAction, 0); } if(field_0xD84 == 1) { @@ -776,11 +776,11 @@ BOOL daNpc_Ji1_c::kaitenAction(void*) { fopAcM_seStart(this, JA_SE_VS_JI_OPENING, 0); mDoAud_bgmStop(0x0000002D); - setAction(&plmoveAction, 0); + setAction(&daNpc_Ji1_c::plmoveAction, 0); } else { setAnm(1, 8.0f, 0); - setAction(&normalAction, 0); + setAction(&daNpc_Ji1_c::normalAction, 0); } dComIfGp_event_reset(); @@ -1079,10 +1079,10 @@ BOOL daNpc_Ji1_c::talkAction(void*) { fopAcM_seStart(this, JA_SE_VS_JI_OPENING, 0); mDoAud_bgmStop(0x0000002D); - setAction(&plmoveAction, 0); + setAction(&daNpc_Ji1_c::plmoveAction, 0); } else { - setAction(&kaitenwaitAction, 0); + setAction(&daNpc_Ji1_c::kaitenwaitAction, 0); } } } @@ -1095,10 +1095,10 @@ BOOL daNpc_Ji1_c::talkAction(void*) { fopAcM_seStart(this, JA_SE_VS_JI_OPENING, 0); mDoAud_bgmStop(0x0000002D); - setAction(&plmoveAction, 0); + setAction(&daNpc_Ji1_c::plmoveAction, 0); } else if(field_0x2AC == 0x995) { - setAction(&plmoveAction, 0); + setAction(&daNpc_Ji1_c::plmoveAction, 0); } else { setAction(field_0x2BC, 0); @@ -1205,7 +1205,7 @@ BOOL daNpc_Ji1_c::speakBadAction(void*) { l_msg->mStatus = fopMsgStts_MSG_DESTROYED_e; if(field_0x2AC == 0x969) { field_0xD70 = 0; - setAction(&teachAction, 0); + setAction(&daNpc_Ji1_c::teachAction, 0); } else { setAction(field_0x2BC, 0); @@ -1981,7 +1981,7 @@ BOOL daNpc_Ji1_c::endspeakAction(void*) { else if(l_msg->mStatus == fopMsgStts_BOX_CLOSED_e) { l_msg->mStatus = fopMsgStts_MSG_DESTROYED_e; mDoAud_bgmStop(0x2D); - setAction(&reiAction, 0); + setAction(&daNpc_Ji1_c::reiAction, 0); } } } @@ -2077,8 +2077,8 @@ BOOL daNpc_Ji1_c::teachSPRollCutAction(void*) { dComIfGp_setItemMagicCount(dComIfGs_getMaxMagic()); if(daNpc_Ji1_plRoomOutCheck()) { field_0xC84 = 9; - setAction(&eventAction, 0); - field_0x2C8 = &teachSPRollCutAction; + setAction(&daNpc_Ji1_c::eventAction, 0); + field_0x2C8 = &daNpc_Ji1_c::teachSPRollCutAction; return true; } @@ -2096,8 +2096,8 @@ BOOL daNpc_Ji1_c::teachSPRollCutAction(void*) { field_0x7E0.OffTgShield(); field_0xC84 = 10; - setAction(&eventAction, 0); - field_0x2C8 = &teachSPRollCutAction; + setAction(&daNpc_Ji1_c::eventAction, 0); + field_0x2C8 = &daNpc_Ji1_c::teachSPRollCutAction; return 1; } @@ -2105,8 +2105,8 @@ BOOL daNpc_Ji1_c::teachSPRollCutAction(void*) { if(cutType == 8) { field_0xC84 = 0xB; - setAction(&eventAction, 0); - field_0x2C8 = &teachSPRollCutAction; + setAction(&daNpc_Ji1_c::eventAction, 0); + field_0x2C8 = &daNpc_Ji1_c::teachSPRollCutAction; return 1; } @@ -2150,9 +2150,9 @@ BOOL daNpc_Ji1_c::teachSPRollCutAction(void*) { if(field_0xC8C == 9) { field_0xC84 = 0xA; - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); - field_0x2C8 = &normalAction; + field_0x2C8 = &daNpc_Ji1_c::normalAction; return true; } @@ -2190,7 +2190,7 @@ BOOL daNpc_Ji1_c::teachSPRollCutAction(void*) { field_0xC50 = 0.0f; field_0xC2C = 0.0f; - setAction(&speakBadAction, 0); + setAction(&daNpc_Ji1_c::speakBadAction, 0); } else { field_0xC90 = 0; @@ -2198,7 +2198,7 @@ BOOL daNpc_Ji1_c::teachSPRollCutAction(void*) { field_0xC9C = 0.0f; field_0xD38 = current.pos; - setAction(&speakAction, 0); + setAction(&daNpc_Ji1_c::speakAction, 0); } } } @@ -2246,7 +2246,7 @@ void daNpc_Ji1_c::battleSubActionWaitInit() { /* Nonmatching */ field_0xC9C = 0; - setSubAction(&battleSubActionWait); + setSubAction(&daNpc_Ji1_c::battleSubActionWait); } /* 0000A430-0000A564 .text battleSubActionWait__11daNpc_Ji1_cFv */ @@ -2263,7 +2263,7 @@ void daNpc_Ji1_c::battleSubActionNockBackInit(int param_1) { field_0xC9C = 0; field_0xD38 = current.pos; field_0x330->setPlaySpeed(-1.0f); - setSubAction(&battleSubActionNockBack); + setSubAction(&daNpc_Ji1_c::battleSubActionNockBack); field_0x2A4 = 30.0f; } @@ -2280,7 +2280,7 @@ void daNpc_Ji1_c::battleSubActionAttackInit() { field_0x330->setPlaySpeed(l_HIO.field_0x6C); fopAcM_seStart(this, JA_SE_CV_JI_ATTACK, 0); field_0xC34 = 0; - setSubAction(&battleSubActionYokoAttack); + setSubAction(&daNpc_Ji1_c::battleSubActionYokoAttack); } /* 0000A808-0000AAA4 .text battleSubActionAttack__11daNpc_Ji1_cFv */ @@ -2296,7 +2296,7 @@ void daNpc_Ji1_c::battleSubActionTateAttackInit() { field_0x330->setPlaySpeed(l_HIO.field_0x78); fopAcM_seStart(this, JA_SE_CV_JI_ATTACK, 0); field_0xC34 = 0; - setSubAction(&battleSubActionYokoAttack); + setSubAction(&daNpc_Ji1_c::battleSubActionYokoAttack); } /* 0000AB68-0000AE2C .text battleSubActionTateAttack__11daNpc_Ji1_cFv */ @@ -2312,7 +2312,7 @@ void daNpc_Ji1_c::battleSubActionYokoAttackInit() { field_0x330->setPlaySpeed(l_HIO.field_0x80); fopAcM_seStart(this, JA_SE_CV_JI_ATTACK, 0); field_0xC34 = 0; - setSubAction(&battleSubActionYokoAttack); + setSubAction(&daNpc_Ji1_c::battleSubActionYokoAttack); } /* 0000AEF0-0000B254 .text battleSubActionYokoAttack__11daNpc_Ji1_cFv */ @@ -2327,7 +2327,7 @@ void daNpc_Ji1_c::battleSubActionJumpInit() { setAnm(0xB, 0.0f, 1); field_0xC9C = 0; field_0xD38 = current.pos; - setSubAction(&battleSubActionJump); + setSubAction(&daNpc_Ji1_c::battleSubActionJump); } /* 0000B2D4-0000B5EC .text battleSubActionJump__11daNpc_Ji1_cFv */ @@ -2343,7 +2343,7 @@ void daNpc_Ji1_c::battleSubActionDamageInit() { field_0x330->setPlaySpeed(1.5f); field_0xC9C = 0; field_0xD38 = current.pos; - setSubAction(&battleSubActionDamage); + setSubAction(&daNpc_Ji1_c::battleSubActionDamage); } /* 0000B67C-0000B8AC .text battleSubActionDamage__11daNpc_Ji1_cFv */ @@ -2358,7 +2358,7 @@ void daNpc_Ji1_c::battleSubActionJpGuardInit() { setAnm(0xA, 0.0f, 1); field_0xC9C = 0; field_0xD38 = current.pos; - setSubAction(&battleSubActionJpGuard); + setSubAction(&daNpc_Ji1_c::battleSubActionJpGuard); } /* 0000B92C-0000BAEC .text battleSubActionJpGuard__11daNpc_Ji1_cFv */ @@ -2373,7 +2373,7 @@ void daNpc_Ji1_c::battleSubActionGuardInit() { field_0xC9C = 0; field_0xD38 = current.pos; setParticle(0x10, 1.0f, 0.1f); - setSubAction(&battleSubActionGuard); + setSubAction(&daNpc_Ji1_c::battleSubActionGuard); } /* 0000BB6C-0000BD8C .text battleSubActionGuard__11daNpc_Ji1_cFv */ @@ -2404,9 +2404,9 @@ BOOL daNpc_Ji1_c::battleGuardCheck() { case 0x6: case 0x8: case 0x9: - case 0x1A: + case 0x1A: { if(!isAttackAnim()) { - if(!checkSubAction(&battleSubActionNockBack)) { + if(!checkSubAction(&daNpc_Ji1_c::battleSubActionNockBack)) { setAnm(8, 0.0f, 1); battleSubActionGuardInit(); break; @@ -2414,7 +2414,7 @@ BOOL daNpc_Ji1_c::battleGuardCheck() { } int attackFrame = isAttackFrame(); - if(checkSubAction(&battleSubActionNockBack)) { + if(checkSubAction(&daNpc_Ji1_c::battleSubActionNockBack)) { setAnm(8, 0.0f, 1); battleSubActionGuardInit(); } @@ -2435,6 +2435,7 @@ BOOL daNpc_Ji1_c::battleGuardCheck() { } break; + } case 0xA: battleSubActionJpGuardInit(); break; @@ -2461,17 +2462,17 @@ BOOL daNpc_Ji1_c::battleGuardCheck() { case 0x1D: case 0x1E: case 0x1F: - default: + default: { if(!isAttackAnim()) { - if(!checkSubAction(&battleSubActionNockBack)) { + if(!checkSubAction(&daNpc_Ji1_c::battleSubActionNockBack)) { setAnm(9, 0.0f, 1); battleSubActionGuardInit(); break; } } - attackFrame = isAttackFrame(); - if(checkSubAction(&battleSubActionNockBack)) { + int attackFrame = isAttackFrame(); + if(checkSubAction(&daNpc_Ji1_c::battleSubActionNockBack)) { setAnm(9, 0.0f, 1); battleSubActionGuardInit(); } @@ -2492,6 +2493,7 @@ BOOL daNpc_Ji1_c::battleGuardCheck() { } break; + } } if(field_0xC24 == 0) { @@ -2539,10 +2541,10 @@ BOOL daNpc_Ji1_c::battleGuardCheck() { field_0xC38 = 1; } - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); dComIfGp_setMessageCountNumber(field_0xD70); - field_0x2C8 = &normalAction; + field_0x2C8 = &daNpc_Ji1_c::normalAction; if (dComIfG_getTimerPtr()) { dComIfG_TimerDeleteRequest(); setClearRecord(field_0xD70); @@ -2561,20 +2563,20 @@ BOOL daNpc_Ji1_c::battleGuardCheck() { } if(field_0xC3C > 2) { - if(checkAction(&battleAction)) { + if(checkAction(&daNpc_Ji1_c::battleAction)) { dComIfG_TimerDeleteRequest(); if(isClearRecord(field_0xD70)) { setClearRecord(field_0xD70); field_0xC84 = 7; - setAction(&eventAction, 0); + setAction(&daNpc_Ji1_c::eventAction, 0); dComIfGp_setMessageCountNumber(field_0xD70); - field_0x2C8 = &normalAction; + field_0x2C8 = &daNpc_Ji1_c::normalAction; } else { - setAction(&endspeakAction, 0); + setAction(&daNpc_Ji1_c::endspeakAction, 0); } } } @@ -3346,7 +3348,7 @@ BOOL daNpc_Ji1_c::CreateInit() { current.pos.z = -850.0f; current.angle.y = -0x8000; - setAction(&kaitenExpAction, 0); + setAction(&daNpc_Ji1_c::kaitenExpAction, 0); } else { field_0xD84 = 1; @@ -3357,7 +3359,7 @@ BOOL daNpc_Ji1_c::CreateInit() { field_0xD5C.y = 0; field_0xD5C.z = 0x7FFF; - setAction(&normalAction, 0); + setAction(&daNpc_Ji1_c::normalAction, 0); } field_0xD28 = home.pos; @@ -3373,17 +3375,17 @@ BOOL daNpc_Ji1_c::CreateInit() { field_0xD5C.z = 0x7FFF; field_0xD28 = home.pos; - setAction(&normalAction, 0); + setAction(&daNpc_Ji1_c::normalAction, 0); } else { field_0xD84 = 0; if(!dComIfGs_isEventBit(0x640) || l_HIO.field_0x30) { field_0xD68 = 0; - setAction(&kaitenExpAction, 0); + setAction(&daNpc_Ji1_c::kaitenExpAction, 0); } else { - setAction(&kaitenwaitAction, 0); + setAction(&daNpc_Ji1_c::kaitenwaitAction, 0); } current.pos.x = 0.0f; @@ -3641,7 +3643,11 @@ BOOL daNpc_Ji1_c::lookBack() { dstPos = &attnPos; } else { - if((field_0xD7A != 0 || isGuardAnim()) || (checkAction(&kaitenwaitAction) && !dComIfGs_isEventBit(0x501)) || (!checkAction(&normalAction) && dist < 600.0f)) { + if( + (field_0xD7A != 0 || isGuardAnim()) || + (checkAction(&daNpc_Ji1_c::kaitenwaitAction) && !dComIfGs_isEventBit(0x501)) || + (!checkAction(&daNpc_Ji1_c::normalAction) && dist < 600.0f) + ) { if(field_0xD64 == 0xD) { dstPos = 0; } diff --git a/src/d/actor/d_a_npc_kamome.cpp b/src/d/actor/d_a_npc_kamome.cpp index ec456eb9c..3e5a479f9 100644 --- a/src/d/actor/d_a_npc_kamome.cpp +++ b/src/d/actor/d_a_npc_kamome.cpp @@ -394,7 +394,7 @@ BOOL daNpc_kam_c::init() { mTargetAngVelY = l_HIO.mHio1.mGlidingAngVelY; mTargetAngVelX = l_HIO.mHio1.mGlidingAngVelX; - setNpcAction(&waitNpcAction, NULL); + setNpcAction(&daNpc_kam_c::waitNpcAction, NULL); mAcchCirs[0].SetWall(20.0f, 50.0f); mAcchCirs[1].SetWall(-20.0f, 50.0f); @@ -452,7 +452,7 @@ void daNpc_kam_c::npcAction(void* arg) { if (!mCurrNpcActionFunc) { speedF = 0.0f; offHyoiKamome(); - setNpcAction(&waitNpcAction, NULL); + setNpcAction(&daNpc_kam_c::waitNpcAction, NULL); #if VERSION != VERSION_JPN mDoAud_zelAudio_c::getInterface()->field_0x0062 = 0; #endif @@ -471,7 +471,7 @@ void daNpc_kam_c::setNpcAction(ActionFunc actionFunc, void* arg) { void daNpc_kam_c::playerAction(void* arg) { if (!mCurrPlayerActionFunc) { speedF = 0.0f; - setPlayerAction(&waitPlayerAction, NULL); + setPlayerAction(&daNpc_kam_c::waitPlayerAction, NULL); } dComIfGp_setRStatusForce(0x07); // Show "Return" on the R button @@ -805,7 +805,7 @@ int daNpc_kam_c::waitPlayerAction(void*) { } if (mTgSph.ChkTgHit()) { - setPlayerAction(&damagePlayerAction, NULL); + setPlayerAction(&daNpc_kam_c::damagePlayerAction, NULL); } } return TRUE; diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index b10454c47..6d2ec1a59 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -381,7 +381,7 @@ s32 daNpc_Md_c::create() { fopAcM_SetupActor(this, daNpc_Md_c); mType = fopAcM_GetParam(this) >> 0x08; - if (mType == -2) { + if (mType == -2) { // Bug: Comparing unsigned value with -2 is always false. dComIfGs_onEventBit(0x1620); } else { if (dComIfGs_isCollect(0, 2)) { diff --git a/src/d/actor/d_a_npc_nz.cpp b/src/d/actor/d_a_npc_nz.cpp index 93292003d..7125d967e 100644 --- a/src/d/actor/d_a_npc_nz.cpp +++ b/src/d/actor/d_a_npc_nz.cpp @@ -663,7 +663,7 @@ u16 daNpc_Nz_c::next_msgStatus(u32* pMsgNo) { case 0x3401: case 0x3402: switch(mpCurrMsg->mSelectNum) { - case 0: + case 0: { u32 msgNo = daNpcNz_getShopBoughtMsg(field_0x908); if(msgNo != 0) { *pMsgNo = msgNo; @@ -682,6 +682,7 @@ u16 daNpc_Nz_c::next_msgStatus(u32* pMsgNo) { dComIfGp_event_setGtItm(field_0x908); msgStatus = fopMsgStts_MSG_ENDS_e; break; + } case 1: *pMsgNo = field_0x900; break; diff --git a/src/d/actor/d_a_npc_os.cpp b/src/d/actor/d_a_npc_os.cpp index afaf118c3..650ad943f 100644 --- a/src/d/actor/d_a_npc_os.cpp +++ b/src/d/actor/d_a_npc_os.cpp @@ -578,7 +578,7 @@ void daNpc_Os_c::npcAction(void* param_1) { initBrkAnm(6, true); } - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); } (this->*mNpcAction)(param_1); @@ -594,7 +594,7 @@ void daNpc_Os_c::setNpcAction(ActionFunc_t action, void* param_2) { void daNpc_Os_c::playerAction(void* param_1) { if(!mPlayerAction) { speedF = 0.0f; - setPlayerAction(&waitPlayerAction, 0); + setPlayerAction(&daNpc_Os_c::waitPlayerAction, 0); } dComIfGp_setRStatusForce(7); @@ -710,7 +710,7 @@ BOOL daNpc_Os_c::waitNpcAction(void*) { current.angle.y = shape_angle.y; if(finishCheck()) { - setNpcAction(&finish01NpcAction, 0); + setNpcAction(&daNpc_Os_c::finish01NpcAction, 0); } } @@ -725,7 +725,7 @@ BOOL daNpc_Os_c::waitNpcAction(void*) { else { if(wakeupCheck()) { if(dist >= l_HIO.field_0x60 * l_HIO.field_0x60) { - setNpcAction(&searchNpcAction, 0); + setNpcAction(&daNpc_Os_c::searchNpcAction, 0); } } else { @@ -761,7 +761,7 @@ BOOL daNpc_Os_c::finish01NpcAction(void* param_1) { mJntCtrl.lookAtTarget(&shape_angle.y, 0, cXyz::Zero, shape_angle.y, field_0x798, true); if(field_0x7A1) { - setNpcAction(&finish02NpcAction, 0); + setNpcAction(&daNpc_Os_c::finish02NpcAction, 0); } setAttention(true); @@ -820,12 +820,12 @@ BOOL daNpc_Os_c::talkNpcAction(void*) { } else if(field_0x7A9 == 2) { if(talk()) { - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); dComIfGp_event_reset(); } } else if(field_0x7A9 == 3) { - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); } mJntCtrl.setTrn(); @@ -864,21 +864,21 @@ BOOL daNpc_Os_c::carryNpcAction(void* param_1) { fopAcM_cancelCarryNow(this); s16 temp = mAcchCir[wallHit].GetWallAngleY(); - setNpcAction(&throwNpcAction, &temp); + setNpcAction(&daNpc_Os_c::throwNpcAction, &temp); return true; } if(!fopAcM_checkCarryNow(this)) { if(speedF > 0.0f) { - setNpcAction(&throwNpcAction, 0); + setNpcAction(&daNpc_Os_c::throwNpcAction, 0); return true; } else { fopAcM_seStartCurrent(this, JA_SE_OBJ_OSTATUE_PUT, 0); smokeSet(0xA328); - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); return true; } @@ -913,7 +913,7 @@ BOOL daNpc_Os_c::throwNpcAction(void* param_1) { if(mAcch.ChkGroundHit()) { fopAcM_seStartCurrent(this, JA_SE_OBJ_OSTATUE_PUT, 0); smokeSet(0xA33B); - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); } setAttention(true); @@ -939,7 +939,7 @@ BOOL daNpc_Os_c::jumpNpcAction(void* param_1) { else if(field_0x7A9 != -1) { if(mAcch.ChkGroundHit()) { smokeSet(0xA33B); - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); } setAttention(true); @@ -1019,7 +1019,7 @@ BOOL daNpc_Os_c::routeCheck(f32 param_1, s16* param_2) { if(dComIfG_Bgsp()->GroundCross(&gndChk) - current.pos.y > -100.0f) { if(cLib_distanceAngleS(current.angle.y, *param_2) < 0x800) { - setNpcAction(&jumpNpcAction, 0); + setNpcAction(&daNpc_Os_c::jumpNpcAction, 0); } return true; @@ -1036,7 +1036,7 @@ BOOL daNpc_Os_c::routeCheck(f32 param_1, s16* param_2) { if(mAcch.ChkWallHit()) { f32 temp4 = checkWallJump(*param_2); if(temp4 >= 0.0f) { - setNpcAction(&jumpNpcAction, &temp4); + setNpcAction(&daNpc_Os_c::jumpNpcAction, &temp4); return true; } @@ -1101,7 +1101,7 @@ BOOL daNpc_Os_c::searchNpcAction(void*) { s16 temp4 = shape_angle.y; lookBack(1, 0, 0); if(temp < 0.001f) { - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); } else { shape_angle.y = temp4; @@ -1146,7 +1146,7 @@ BOOL daNpc_Os_c::waitPlayerAction(void*) { current.angle.y = shape_angle.y; if(g_mDoCPd_cpadInfo[0].mMainStickValue >= l_HIO.field_0xA0 && stickPos == 0) { current.angle.y = target; - setPlayerAction(&walkPlayerAction, 0); + setPlayerAction(&daNpc_Os_c::walkPlayerAction, 0); } } else { @@ -1195,11 +1195,11 @@ BOOL daNpc_Os_c::walkPlayerAction(void*) { } if(stickPos != 0) { - setPlayerAction(&waitPlayerAction, 0); + setPlayerAction(&daNpc_Os_c::waitPlayerAction, 0); } } else { - setPlayerAction(&waitPlayerAction, 0); + setPlayerAction(&daNpc_Os_c::waitPlayerAction, 0); } setAttention(true); @@ -1270,7 +1270,7 @@ BOOL daNpc_Os_c::eventProc() { } else if(field_0x7A5 != 2 && field_0x7A5 != 4 && field_0x7A5 != 6) { if(field_0x7A5 == 0xA || field_0x7A5 == 0xB || field_0x7A5 == 0xC || field_0x7A5 == 0xD || field_0x7A5 == 0xE || field_0x7A5 == 0xF) { - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); offNpcCallCommand(); onNpcNotChange(); dComIfGp_setCb1Player(NULL); @@ -1460,7 +1460,7 @@ void daNpc_Os_c::initialEndEvent(int) { setFinish(); u32 temp = 0; - setNpcAction(&finish02NpcAction, &temp); + setNpcAction(&daNpc_Os_c::finish02NpcAction, &temp); } /* 00004748-0000474C .text initialTurnEvent__10daNpc_Os_cFi */ @@ -1807,7 +1807,7 @@ bool daNpc_Os_c::chkArea(cXyz* param_1) { /* 000052D4-00005328 .text carryCheck__10daNpc_Os_cFv */ void daNpc_Os_c::carryCheck() { if(fopAcM_checkCarryNow(this)) { - setNpcAction(&carryNpcAction, 0); + setNpcAction(&daNpc_Os_c::carryNpcAction, 0); } } @@ -1832,7 +1832,7 @@ void daNpc_Os_c::eventOrder() { void daNpc_Os_c::checkOrder() { if(eventInfo.checkCommandTalk() && (field_0x7A5 == 0x12 || field_0x7A5 == 0x11)) { field_0x7A5 = 0xFF; - setNpcAction(&talkNpcAction, 0); + setNpcAction(&daNpc_Os_c::talkNpcAction, 0); fopAcM_cancelCarryNow(this); } } @@ -1980,11 +1980,11 @@ BOOL daNpc_Os_c::init() { } if(finishCheck()) { - setNpcAction(&finish02NpcAction, 0); + setNpcAction(&daNpc_Os_c::finish02NpcAction, 0); } else { setAnm(0); - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); } field_0x754 = current.pos; @@ -2100,7 +2100,7 @@ BOOL daNpc_Os_c::execute() { fopAcM_setStageLayer(this); - if(chkNpcAction(&carryNpcAction)) { + if(chkNpcAction(&daNpc_Os_c::carryNpcAction)) { mAcchCir[0].SetWallR(15.0f); mAcchCir[1].SetWallR(15.0f); } @@ -2158,7 +2158,7 @@ BOOL daNpc_Os_c::execute() { } else { if(check_moveStop()) { - setNpcAction(&waitNpcAction, 0); + setNpcAction(&daNpc_Os_c::waitNpcAction, 0); field_0x7A3 = 0; endBeam(); @@ -2199,7 +2199,7 @@ BOOL daNpc_Os_c::execute() { mAcch.CrrPos(*dComIfG_Bgsp()); field_0x784 |= 0x10; - if(chkPlayerAction(&walkPlayerAction) || chkNpcAction(&searchNpcAction)) { + if(chkPlayerAction(&daNpc_Os_c::walkPlayerAction) || chkNpcAction(&daNpc_Os_c::searchNpcAction)) { if(!mAcch.ChkGroundHit()) { f32 gndY = mAcch.GetGroundH(); f32 delta = gndY - current.pos.y; @@ -2311,7 +2311,7 @@ BOOL daNpc_Os_c::execute() { checkOrder(); npcAction(0); - if(!chkNpcAction(&throwNpcAction)) { + if(!chkNpcAction(&daNpc_Os_c::throwNpcAction)) { current.angle.y = shape_angle.y; } } diff --git a/src/d/actor/d_a_npc_people.cpp b/src/d/actor/d_a_npc_people.cpp index 2cdb3b23d..ad270ba70 100644 --- a/src/d/actor/d_a_npc_people.cpp +++ b/src/d/actor/d_a_npc_people.cpp @@ -4137,7 +4137,7 @@ static s32 phase_1(daNpcPeople_c* i_this) { break; case 0x11: - case 0x12: + case 0x12: { int day = dKy_get_dayofweek(); switch(arg0) { @@ -4153,9 +4153,9 @@ static s32 phase_1(daNpcPeople_c* i_this) { } break; - - break; } + break; + } case 0x7: case 0x9: case 0xB: @@ -4357,7 +4357,7 @@ s32 daNpcPeople_c::createInit() { m766[0] = dComIfGp_evmng_getEventIdx("SA3_GET_ITEM"); break; - case 0xF: + case 0xF: { m766[0] = dComIfGp_evmng_getEventIdx("SA5_TALK_XY"); m766[1] = dComIfGp_evmng_getEventIdx("SA5_GET_ITEM"); @@ -4371,7 +4371,8 @@ s32 daNpcPeople_c::createInit() { } } } - + // Fall-through + } case 0x10: if(mbIsNight) { m758 |= 0x40000000; @@ -6264,7 +6265,7 @@ u16 daNpcPeople_c::next_msgStatus(u32* pMsgNo) { u16 status = fopMsgStts_MSG_CONTINUES_e; switch(*pMsgNo) { - case 0x358B: + case 0x358B: { daNpcPeople_c* pActor = (daNpcPeople_c*)fopAcM_searchFromName(l_npc_staff_id[17], 0, 0); if(mpCurrMsg->mSelectNum == 0) { pActor->mCurrMsgNo = 0x358C; @@ -6280,6 +6281,7 @@ u16 daNpcPeople_c::next_msgStatus(u32* pMsgNo) { status = fopMsgStts_MSG_ENDS_e; break; + } case 0x3024: dComIfGs_onEventBit(0x2220); status = fopMsgStts_MSG_ENDS_e; @@ -6347,7 +6349,7 @@ u16 daNpcPeople_c::next_msgStatus(u32* pMsgNo) { status = fopMsgStts_MSG_ENDS_e; break; - case 8: + case 8: { m734++; u8 item = (*m734 == 0) ? (u8)0x29 : (u8)0x28; m734++; @@ -6359,6 +6361,7 @@ u16 daNpcPeople_c::next_msgStatus(u32* pMsgNo) { *pMsgNo = *m734; break; + } case 9: m77E |= 0x40; m75C = 4; @@ -8022,7 +8025,8 @@ BOOL daNpcPeople_c::is1DayGetMap20() { int daNpcPeople_c::getWindDir() { cXyz* wind = dKyw_get_wind_vec(); u16 angle = cM_atan2s(wind->x, wind->z); - return angle + 0x1000 >> 0xD & 7; // what is this dark magic + // Round to nearest multiple of 0x2000 then convert to a value from 0-7 on a compass. + return ((u32)(angle + 0x1000) / 0x2000) & 7; } /* 0000917C-000091B8 .text isUo1FdaiAll__13daNpcPeople_cFv */ diff --git a/src/d/actor/d_a_obj_figure.cpp b/src/d/actor/d_a_obj_figure.cpp index 6979cf2fb..3c745c4aa 100644 --- a/src/d/actor/d_a_obj_figure.cpp +++ b/src/d/actor/d_a_obj_figure.cpp @@ -1237,7 +1237,7 @@ void daObjFigure_c::eventMesSetInit(int staffIdx) { /* 00001294-00001600 .text eventMesSet__13daObjFigure_cFv */ bool daObjFigure_c::eventMesSet() { switch(m73F) { - case 0: + case 0: { if(m73A != 0) { m73A--; } @@ -1301,6 +1301,7 @@ bool daObjFigure_c::eventMesSet() { dCam_getBody()->Set(m70C, m718, m724, 0); break; + } case 1: talk(0); if(m694 != fpcM_ERROR_PROCESS_ID_e) { diff --git a/src/d/actor/d_a_obj_mknjd.cpp b/src/d/actor/d_a_obj_mknjd.cpp index f8fad2157..96bf6ac8a 100644 --- a/src/d/actor/d_a_obj_mknjd.cpp +++ b/src/d/actor/d_a_obj_mknjd.cpp @@ -501,7 +501,7 @@ void daObjMknjD::Act_c::privateCut() { case ACT_WAIT: doCutEnd = true; break; - case ACT_BREAK: + case ACT_BREAK: { if (daObjMknjD_break() == true) { if (strcmp(dComIfGp_getStartStageName(), "Ekaze") == 0 || strcmp(dComIfGp_getStartStageName(), "Edaichi") == 0) { mDoAud_bgmStart(JA_BGM_JABOO_CAVE); @@ -523,13 +523,15 @@ void daObjMknjD::Act_c::privateCut() { doCutEnd = true; } break; - case ACT_LESSON: + } + case ACT_LESSON: { u16 msgStatus = talk(1); if (msgStatus == fopMsgStts_BOX_CLOSED_e || msgStatus == fopMsgStts_UNK15_e) { doCutEnd = true; } break; + } case ACT_TACT: if (m0504 == false) { doCutEnd = true; @@ -687,7 +689,7 @@ bool daObjMknjD::Act_c::daObjMknjD_break() { fallingShardNum = 0; } - for (fallingShardNum; fallingShardNum < 20; fallingShardNum++) { + for (; fallingShardNum < 20; fallingShardNum++) { mShardHeights[fallingShardNum] -= 2.0f; mShardPositions[fallingShardNum].y += mShardHeights[fallingShardNum]; } diff --git a/src/d/actor/d_a_pedestal.cpp b/src/d/actor/d_a_pedestal.cpp index 737cb2691..1c8ab1458 100644 --- a/src/d/actor/d_a_pedestal.cpp +++ b/src/d/actor/d_a_pedestal.cpp @@ -184,7 +184,7 @@ BOOL daPds_c::setAction(ActionFunc_t action, void* param_1) { /* 0000073C-000007C4 .text action__Q210daPedestal7daPds_cFPv */ void daPds_c::action(void* param_1) { if (!mAction) { - setAction(&waitAction, NULL); + setAction(&daPds_c::waitAction, NULL); } (this->*mAction)(param_1); diff --git a/src/d/actor/d_a_player_fan.inc b/src/d/actor/d_a_player_fan.inc index 42d8b730e..7ef49e835 100644 --- a/src/d/actor/d_a_player_fan.inc +++ b/src/d/actor/d_a_player_fan.inc @@ -13,7 +13,7 @@ #include "d/actor/d_a_player_main.h" #include "d/actor/d_a_player_HIO.h" -char l_arcName[]; +extern char l_arcName[]; /* 8014BAA0-8014BAEC .text fanWindEffectDraw__9daPy_lk_cFv */ BOOL daPy_lk_c::fanWindEffectDraw() { diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index a5567df86..02689d3b8 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -674,20 +674,20 @@ void daPy_lk_c::setBootsModel(J3DModel** pBootModels) { u16 bootsJointIdx; if (checkEquipHeavyBoots()) { // TODO: add enum for link's joint numbers - pBootModels[0]->setAnmMtx(0x01, mpCLModel->getAnmMtx(0x26)); - pBootModels[1]->setAnmMtx(0x01, mpCLModel->getAnmMtx(0x21)); + pBootModels[0]->setAnmMtx(0x01, mpCLModel->getAnmMtx(0x26)); // RlegB_jnt joint + pBootModels[1]->setAnmMtx(0x01, mpCLModel->getAnmMtx(0x21)); // LlegB_jnt joint bootsJointIdx = 2; } else { bootsJointIdx = 1; } J3DModel* bootModel = pBootModels[0]; - bootModel->setAnmMtx(bootsJointIdx, mpCLModel->getAnmMtx(0x28)); - bootModel->setAnmMtx(bootsJointIdx+1, mpCLModel->getAnmMtx(0x27)); + bootModel->setAnmMtx(bootsJointIdx, mpCLModel->getAnmMtx(0x28)); // Rtoe_jnt joint + bootModel->setAnmMtx(bootsJointIdx+1, mpCLModel->getAnmMtx(0x27)); // Rfoot_jnt joint bootModel = pBootModels[1]; - bootModel->setAnmMtx(bootsJointIdx, mpCLModel->getAnmMtx(0x23)); - bootModel->setAnmMtx(bootsJointIdx+1, mpCLModel->getAnmMtx(0x22)); + bootModel->setAnmMtx(bootsJointIdx, mpCLModel->getAnmMtx(0x23)); // Ltoe_jnt joint + bootModel->setAnmMtx(bootsJointIdx+1, mpCLModel->getAnmMtx(0x22)); // Lfoot_jnt joint } /* 80105910-80106660 .text setItemModel__9daPy_lk_cFv */ @@ -4753,7 +4753,7 @@ static actor_method_class2 l_daPy_Method = { actor_process_profile_definition2 g_profile_PLAYER = { /* LayerID */ fpcLy_CURRENT_e, /* ListID */ 5, - /* ListPrio */ fpcLy_CURRENT_e, + /* ListPrio */ fpcPi_CURRENT_e, /* ProcName */ PROC_PLAYER, /* Proc SubMtd */ &g_fpcLf_Method.base, /* Size */ sizeof(daPy_lk_c), diff --git a/src/d/actor/d_a_rd.cpp b/src/d/actor/d_a_rd.cpp index 8ca028cc9..8d42833f0 100644 --- a/src/d/actor/d_a_rd.cpp +++ b/src/d/actor/d_a_rd.cpp @@ -1239,63 +1239,63 @@ void daRd_c::modeProc(daRd_c::Proc_e proc, int newMode) { static ModeEntry mode_tbl[] = { { - &modeWaitInit, - &modeWait, + &daRd_c::modeWaitInit, + &daRd_c::modeWait, "WAIT", }, { - &modeDamageInit, - &modeDamage, + &daRd_c::modeDamageInit, + &daRd_c::modeDamage, "DAMAGE", }, { - &modeParalysisInit, - &modeParalysis, + &daRd_c::modeParalysisInit, + &daRd_c::modeParalysis, "PARALYSIS", }, { - &modeDeathInit, - &modeDeath, + &daRd_c::modeDeathInit, + &daRd_c::modeDeath, "DEATH", }, { - &modeMoveInit, - &modeMove, + &daRd_c::modeMoveInit, + &daRd_c::modeMove, "MOVE", }, { - &modeCryInit, - &modeCry, + &daRd_c::modeCryInit, + &daRd_c::modeCry, "CRY", }, { - &modeCryWaitInit, - &modeCryWait, + &daRd_c::modeCryWaitInit, + &daRd_c::modeCryWait, "CRY_WAIT", }, { - &modeAttackInit, - &modeAttack, + &daRd_c::modeAttackInit, + &daRd_c::modeAttack, "ATTACK", }, { - &modeReturnInit, - &modeReturn, + &daRd_c::modeReturnInit, + &daRd_c::modeReturn, "RETURN", }, { - &modeSilentPrayInit, - &modeSilentPray, + &daRd_c::modeSilentPrayInit, + &daRd_c::modeSilentPray, "SILENT_PRAY", }, { - &modeSwWaitInit, - &modeSwWait, + &daRd_c::modeSwWaitInit, + &daRd_c::modeSwWait, "SW_WAIT", }, { - &modeKanokeInit, - &modeKanoke, + &daRd_c::modeKanokeInit, + &daRd_c::modeKanoke, "KANOKE", }, }; diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index fdc12a760..63aab0a01 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -1597,7 +1597,7 @@ void dScnKy_env_light_c::settingTevStruct(int i_lightType, cXyz* i_pos, dKy_tevs } else { i_tevstr->mLightMode = 0; - if (i_tevstr->mRoomNo >= 128) { + if (i_tevstr->mRoomNo >= 128) { // Bug: mRoomNo is an s8, so this condition never evaluates to true. i_tevstr->mEnvrIdxCurr = 0; } else { i_tevstr->mEnvrIdxCurr = i_tevstr->mRoomNo; @@ -2134,7 +2134,7 @@ void dKy_event_proc() { switch (env_light.mDiceWeatherState) { case DICE_STATE_RESET_e: break; - case DICE_STATE_INIT_e: + case DICE_STATE_INIT_e: { u8 table_no = cM_rndF(7.99f); env_light.mDiceWeatherCurrPattern = S_wether_table[table_no]; env_light.mDiceWeatherCounter = 0; @@ -2165,6 +2165,7 @@ void dKy_event_proc() { env_light.mDiceWeatherCounter++; env_light.mDiceWeatherState++; break; + } case DICE_STATE_EXEC_e: if (current_time > env_light.mDiceWeatherTime && current_time - env_light.mDiceWeatherTime < 180.0f) diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index 0155a576e..e93f2c244 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -870,7 +870,6 @@ void wave_move() { if (roomNo >= 0) fili_p = dComIfGp_roomControl_getStatusRoomDt(roomNo)->getFileListInfo(); - seaLevel; if (fili_p != NULL) seaLevel = dStage_FileList_dt_SeaLevel(fili_p); @@ -927,7 +926,6 @@ void wave_move() { d0.zero(); - deltaXZ; deltaXZ.x = pCamera->mLookat.mCenter.x - pCamera->mLookat.mEye.x; deltaXZ.y = 0.0f; deltaXZ.z = pCamera->mLookat.mCenter.z - pCamera->mLookat.mEye.z; @@ -1167,7 +1165,9 @@ void cloud_shadow_move() { pPkt->mEff[i].mPos.z += pPkt->mEff[i].mPntWindVel.z; // botched comparison? - strcmp(dComIfGp_getStartStageName(), "kaze"); + if (strcmp(dComIfGp_getStartStageName(), "kaze") == 0) { + + } if (strcmp(dComIfGp_getStartStageName(), "Adanmae") == 0) { speed = 20.0f; diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index 570e8a76f..6e82af2c3 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -13,8 +13,8 @@ #include "d/d_procname.h" #include "d/d_item.h" #include "d/d_item_data.h" +#include "d/d_bg_s_lin_chk.h" #include "d/actor/d_a_player.h" -#include "d/actor/d_a_player_main.h" #include "d/actor/d_a_item.h" #include "d/actor/d_a_sea.h" #include "d/actor/d_a_ib.h" @@ -535,34 +535,31 @@ s32 fopAcM_checkCullingBox(Mtx pMtx, f32 x0, f32 y0, f32 z0, f32 x1, f32 y1, f32 static l_HIO l_hio; static fopAc_cullSizeBox l_cullSizeBox[14] = { -#ifndef __INTELLISENSE__ - /* fopAc_CULLBOX_0_e */ fopAc_cullSizeBox(cXyz(-40.0f, 0.0f, -40.0f), cXyz(40.0f, 125.0f, 40.0f)), - /* fopAc_CULLBOX_1_e */ fopAc_cullSizeBox(cXyz(-25.0f, 0.0f, -25.0f), cXyz(25.0f, 50.0f, 25.0f)), - /* fopAc_CULLBOX_2_e */ fopAc_cullSizeBox(cXyz(-50.0f, 0.0f, -50.0f), cXyz(50.0f, 100.0f, 50.0f)), - /* fopAc_CULLBOX_3_e */ fopAc_cullSizeBox(cXyz(-75.0f, 0.0f, -75.0f), cXyz(75.0f, 150.0f, 75.0f)), - /* fopAc_CULLBOX_4_e */ fopAc_cullSizeBox(cXyz(-100.0f, 0.0f, -100.0f), cXyz(100.0f, 800.0f, 100.0f)), - /* fopAc_CULLBOX_5_e */ fopAc_cullSizeBox(cXyz(-125.0f, 0.0f, -125.0f), cXyz(125.0f, 250.0f, 125.0f)), - /* fopAc_CULLBOX_6_e */ fopAc_cullSizeBox(cXyz(-150.0f, 0.0f, -150.0f), cXyz(150.0f, 300.0f, 150.0f)), - /* fopAc_CULLBOX_7_e */ fopAc_cullSizeBox(cXyz(-200.0f, 0.0f, -200.0f), cXyz(200.0f, 400.0f, 200.0f)), - /* fopAc_CULLBOX_8_e */ fopAc_cullSizeBox(cXyz(-600.0f, 0.0f, -600.0f), cXyz(600.0f, 900.0f, 600.0f)), - /* fopAc_CULLBOX_9_e */ fopAc_cullSizeBox(cXyz(-250.0f, 0.0f, -50.0f), cXyz(250.0f, 450.0f, 50.0f)), - /* fopAc_CULLBOX_10_e */ fopAc_cullSizeBox(cXyz(-60.0f, 0.0f, -20.0f), cXyz(40.0f, 130.0f, 150.0f)), - /* fopAc_CULLBOX_11_e */ fopAc_cullSizeBox(cXyz(-75.0f, 0.0f, -75.0f), cXyz(75.0f, 210.0f, 75.0f)), - /* fopAc_CULLBOX_12_e */ fopAc_cullSizeBox(cXyz(-70.0f, -100.0f, -80.0f), cXyz(70.0f, 240.0f, 100.0f)), - /* fopAc_CULLBOX_13_e */ fopAc_cullSizeBox(cXyz(-60.0f, -20.0f, -60.0f), cXyz(60.0f, 160.0f, 60.0f)), -#endif + /* fopAc_CULLBOX_0_e */ fopAc_MakeCullSizeBox(cXyz(-40.0f, 0.0f, -40.0f), cXyz(40.0f, 125.0f, 40.0f)), + /* fopAc_CULLBOX_1_e */ fopAc_MakeCullSizeBox(cXyz(-25.0f, 0.0f, -25.0f), cXyz(25.0f, 50.0f, 25.0f)), + /* fopAc_CULLBOX_2_e */ fopAc_MakeCullSizeBox(cXyz(-50.0f, 0.0f, -50.0f), cXyz(50.0f, 100.0f, 50.0f)), + /* fopAc_CULLBOX_3_e */ fopAc_MakeCullSizeBox(cXyz(-75.0f, 0.0f, -75.0f), cXyz(75.0f, 150.0f, 75.0f)), + /* fopAc_CULLBOX_4_e */ fopAc_MakeCullSizeBox(cXyz(-100.0f, 0.0f, -100.0f), cXyz(100.0f, 800.0f, 100.0f)), + /* fopAc_CULLBOX_5_e */ fopAc_MakeCullSizeBox(cXyz(-125.0f, 0.0f, -125.0f), cXyz(125.0f, 250.0f, 125.0f)), + /* fopAc_CULLBOX_6_e */ fopAc_MakeCullSizeBox(cXyz(-150.0f, 0.0f, -150.0f), cXyz(150.0f, 300.0f, 150.0f)), + /* fopAc_CULLBOX_7_e */ fopAc_MakeCullSizeBox(cXyz(-200.0f, 0.0f, -200.0f), cXyz(200.0f, 400.0f, 200.0f)), + /* fopAc_CULLBOX_8_e */ fopAc_MakeCullSizeBox(cXyz(-600.0f, 0.0f, -600.0f), cXyz(600.0f, 900.0f, 600.0f)), + /* fopAc_CULLBOX_9_e */ fopAc_MakeCullSizeBox(cXyz(-250.0f, 0.0f, -50.0f), cXyz(250.0f, 450.0f, 50.0f)), + /* fopAc_CULLBOX_10_e */ fopAc_MakeCullSizeBox(cXyz(-60.0f, 0.0f, -20.0f), cXyz(40.0f, 130.0f, 150.0f)), + /* fopAc_CULLBOX_11_e */ fopAc_MakeCullSizeBox(cXyz(-75.0f, 0.0f, -75.0f), cXyz(75.0f, 210.0f, 75.0f)), + /* fopAc_CULLBOX_12_e */ fopAc_MakeCullSizeBox(cXyz(-70.0f, -100.0f, -80.0f), cXyz(70.0f, 240.0f, 100.0f)), + /* fopAc_CULLBOX_13_e */ fopAc_MakeCullSizeBox(cXyz(-60.0f, -20.0f, -60.0f), cXyz(60.0f, 160.0f, 60.0f)), + }; static fopAc_cullSizeSphere l_cullSizeSphere[8] = { -#ifndef __INTELLISENSE__ - /* fopAc_CULLSPHERE_0_e */ fopAc_cullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 80.0f), - /* fopAc_CULLSPHERE_1_e */ fopAc_cullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 50.0f), - /* fopAc_CULLSPHERE_2_e */ fopAc_cullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 100.0f), - /* fopAc_CULLSPHERE_3_e */ fopAc_cullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 150.0f), - /* fopAc_CULLSPHERE_4_e */ fopAc_cullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 200.0f), - /* fopAc_CULLSPHERE_5_e */ fopAc_cullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 250.0f), - /* fopAc_CULLSPHERE_6_e */ fopAc_cullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 300.0f), - /* fopAc_CULLSPHERE_7_e */ fopAc_cullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 400.0f), -#endif + /* fopAc_CULLSPHERE_0_e */ fopAc_MakeCullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 80.0f), + /* fopAc_CULLSPHERE_1_e */ fopAc_MakeCullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 50.0f), + /* fopAc_CULLSPHERE_2_e */ fopAc_MakeCullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 100.0f), + /* fopAc_CULLSPHERE_3_e */ fopAc_MakeCullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 150.0f), + /* fopAc_CULLSPHERE_4_e */ fopAc_MakeCullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 200.0f), + /* fopAc_CULLSPHERE_5_e */ fopAc_MakeCullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 250.0f), + /* fopAc_CULLSPHERE_6_e */ fopAc_MakeCullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 300.0f), + /* fopAc_CULLSPHERE_7_e */ fopAc_MakeCullSizeSphere(cXyz(0.0f, 0.0f, 0.0f), 400.0f), }; static void dummy() { @@ -812,7 +809,7 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo case 0x01: case 0x02: case 0x03: - case 0x04: + case 0x04: { int life = dComIfGs_getLife() * 100; int max = dComIfGs_getMaxLife() & 0xFC; u8 lifePercent = life / max; @@ -826,6 +823,7 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo tableIdx = 1; } break; + } case 0x0B: case 0x0C: case 0x0D: diff --git a/src/f_op/f_op_msg_mng.cpp b/src/f_op/f_op_msg_mng.cpp index 285f64a24..f9e2b5eee 100644 --- a/src/f_op/f_op_msg_mng.cpp +++ b/src/f_op/f_op_msg_mng.cpp @@ -356,30 +356,30 @@ bool fopMsgM_releaseScopeMode() { } static const char* fopMsgM_buttonTex[] = { - /* 0x00 */ {"font_00.bti"}, - /* 0x01 */ {"font_01.bti"}, - /* 0x02 */ {"font_09.bti"}, - /* 0x03 */ {"font_04.bti"}, - /* 0x04 */ {"font_05.bti"}, - /* 0x05 */ {"font_02.bti"}, - /* 0x06 */ {"font_03.bti"}, - /* 0x07 */ {"font_06.bti"}, - /* 0x08 */ {"font_08.bti"}, - /* 0x09 */ {"font_07_01.bti"}, - /* 0x0A */ {"font_10.bti"}, - /* 0x0B */ {"font_10.bti"}, - /* 0x0C */ {"font_10.bti"}, - /* 0x0D */ {"font_10.bti"}, - /* 0x0E */ {"font_07_01.bti"}, - /* 0x0F */ {"font_07_01.bti"}, - /* 0x10 */ {"font_07_01.bti"}, - /* 0x11 */ {"font_07_01.bti"}, - /* 0x12 */ {"font_07_01.bti"}, - /* 0x13 */ {"font_07_01.bti"}, - /* 0x14 */ {"font_12.bti"}, - /* 0x15 */ {"font_13.bti"}, - /* 0x16 */ {"font_14.bti"}, - /* 0x17 */ {"font_15.bti"}, + /* 0x00 */ "font_00.bti", + /* 0x01 */ "font_01.bti", + /* 0x02 */ "font_09.bti", + /* 0x03 */ "font_04.bti", + /* 0x04 */ "font_05.bti", + /* 0x05 */ "font_02.bti", + /* 0x06 */ "font_03.bti", + /* 0x07 */ "font_06.bti", + /* 0x08 */ "font_08.bti", + /* 0x09 */ "font_07_01.bti", + /* 0x0A */ "font_10.bti", + /* 0x0B */ "font_10.bti", + /* 0x0C */ "font_10.bti", + /* 0x0D */ "font_10.bti", + /* 0x0E */ "font_07_01.bti", + /* 0x0F */ "font_07_01.bti", + /* 0x10 */ "font_07_01.bti", + /* 0x11 */ "font_07_01.bti", + /* 0x12 */ "font_07_01.bti", + /* 0x13 */ "font_07_01.bti", + /* 0x14 */ "font_12.bti", + /* 0x15 */ "font_13.bti", + /* 0x16 */ "font_14.bti", + /* 0x17 */ "font_15.bti", }; static GXColor fopMsgM_buttonW[] = { diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index d9e1fd77b..b819da020 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -903,8 +903,8 @@ JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_alignmen } JKRSolidHeap* createdHeap; - if (i_size == 0 || i_size == 0xFFFFFFFF) { - createdHeap = JKRSolidHeap::create(0xFFFFFFFFFF, i_heap, false); + if (i_size == 0 || i_size == -1) { + createdHeap = JKRSolidHeap::create(-1, i_heap, false); } else { i_size = ALIGN_NEXT(i_size, 0x10); i_size += 0x80; @@ -1164,7 +1164,7 @@ mDoExt_McaMorf::mDoExt_McaMorf(J3DModelData* modelData, mDoExt_McaMorfCallBack1_ return; } if (modelData->getModelDataType() == 1 && modelFlag == 0) { - if (modelFlag = modelData->isLocked()) { + if (modelData->isLocked()) { modelFlag = 0x20000; } else { modelFlag = 0x80000; @@ -1451,7 +1451,7 @@ mDoExt_McaMorf2::mDoExt_McaMorf2(J3DModelData* modelData, mDoExt_McaMorfCallBack return; } if (modelData->getModelDataType() == 1 && modelFlag == 0) { - if (modelFlag = modelData->isLocked()) { + if (modelData->isLocked()) { modelFlag = 0x20000; } else { modelFlag = 0x80000; @@ -2587,7 +2587,7 @@ J3DModel* mDoExt_J3DModel__create(J3DModelData* i_modelData, u32 i_modelFlag, u3 J3DModel* model = new J3DModel(); if (model) { if (i_modelData->getModelDataType() == 1 && i_modelFlag == 0) { - if (i_modelFlag = i_modelData->isLocked()) { + if (i_modelData->isLocked()) { i_modelFlag = 0x20000; } else { i_modelFlag = 0x80000; diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index a077ebd66..400c9a6f7 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -1110,7 +1110,7 @@ void mCaptureGXDrawSyncCallback(u16) { OSCancelAlarm(&mCaptureTimeOutAlarm); BOOL interrupt = OSDisableInterrupts(); if (mCaptureStep == 2) { - void * oldcb = GXSetDrawSyncCallback(mCaptureOldCB); + void* oldcb = (void*)GXSetDrawSyncCallback(mCaptureOldCB); JUT_ASSERT(0xa5f, oldcb == mCaptureGXDrawSyncCallback); mCaptureOldCB = NULL; mCaptureStep++; @@ -1393,7 +1393,7 @@ bool mDoGph_Painter() { } mCaptureStep = 5; } else { - OSCreateThread(&mCaptureThread, mCaptureProc, NULL, mCaptureThreadStackHead + mCaptureThreadStackSize, mCaptureThreadStackSize, mCaptureThreadPriority, 0); + OSCreateThread(&mCaptureThread, (void*)mCaptureProc, NULL, mCaptureThreadStackHead + mCaptureThreadStackSize, mCaptureThreadStackSize, mCaptureThreadPriority, 0); OSResumeThread(&mCaptureThread); mCaptureStep++; } diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index 9fa0cf9f2..75c2fd576 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -482,7 +482,7 @@ void main() { } s32 priority = OSGetThreadPriority(current_thread); - OSCreateThread(&mainThread, main01, 0, stack + sizeof(stack), sizeof(stack), priority, 0); + OSCreateThread(&mainThread, (void*)main01, 0, stack + sizeof(stack), sizeof(stack), priority, 0); OSResumeThread(&mainThread); OSSetThreadPriority(current_thread, 0x1F); OSSuspendThread(current_thread);