summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMax Roncace <me@caseif.net>2026-03-18 01:38:05 -0400
committerGitHub <noreply@github.com>2026-03-17 22:38:05 -0700
commit6694c1b281a142972fce587bd20cd82ee65ab38f (patch)
tree2537d09d5ab3d270eaca5143a4f2f2f65f4ecb49 /include
parent9f340b604b5ac3d19d330b7bd6a2d7355c58bc27 (diff)
Fix a bunch of compiler warnings and document several more bugs (#3130)
Diffstat (limited to 'include')
-rw-r--r--include/d/actor/d_a_e_hz.h2
-rw-r--r--include/d/actor/d_a_npc2.h2
-rw-r--r--include/d/actor/d_a_npc_bouS.h2
-rw-r--r--include/d/actor/d_a_npc_gra.h2
-rw-r--r--include/d/actor/d_a_npc_grs.h2
-rw-r--r--include/d/actor/d_a_npc_gwolf.h2
-rw-r--r--include/d/actor/d_a_npc_kasi_hana.h3
-rw-r--r--include/d/actor/d_a_npc_kasi_kyu.h3
-rw-r--r--include/d/actor/d_a_npc_kasi_mich.h3
-rw-r--r--include/d/actor/d_a_npc_kn.h2
-rw-r--r--include/d/actor/d_a_npc_ks.h2
-rw-r--r--include/d/actor/d_a_npc_myna2.h2
-rw-r--r--include/d/actor/d_a_npc_ne.h2
-rw-r--r--include/d/actor/d_a_tag_push.h3
-rw-r--r--include/d/actor/d_a_tag_shop_item.h4
-rw-r--r--include/d/d_demo.h23
-rw-r--r--include/d/d_menu_window.h2
-rw-r--r--include/d/d_msg_scrn_howl.h3
-rw-r--r--include/f_op/f_op_actor_mng.h18
-rw-r--r--include/global.h13
20 files changed, 46 insertions, 49 deletions
diff --git a/include/d/actor/d_a_e_hz.h b/include/d/actor/d_a_e_hz.h
index 7e5902e016..539d808cf5 100644
--- a/include/d/actor/d_a_e_hz.h
+++ b/include/d/actor/d_a_e_hz.h
@@ -87,7 +87,7 @@ private:
/* 0x6B4 */ s16 field_0x6b4;
/* 0x6B6 */ s16 field_0x6b6;
/* 0x6B8 */ u8 field_0x6B8[0x6BC - 0x6B8];
- /* 0x6BC */ char* mpName;
+ /* 0x6BC */ const char* mpName;
/* 0x6C0 */ s32 mAction;
/* 0x6C4 */ s32 mPrevAction;
/* 0x6C8 */ s32 mMode; // That's just a guess. Might need a better name for it's usage
diff --git a/include/d/actor/d_a_npc2.h b/include/d/actor/d_a_npc2.h
index ea5548696a..d1d06d7764 100644
--- a/include/d/actor/d_a_npc2.h
+++ b/include/d/actor/d_a_npc2.h
@@ -134,7 +134,7 @@ public:
/* 0x842 */ u16 field_0x842;
/* 0x844 */ u8 field_0x844;
/* 0x845 */ u8 field_0x845[0x848 - 0x845];
- /* 0x848 */ s32 field_0x848;
+ /* 0x848 */ s32 mFlowID;
/* 0x84C */ dMsgFlow_c mMsgFlow;
/* 0x898 */ u8 field_0x898[0x89A - 0x898];
/* 0x89A */ s16 mEvtIdx;
diff --git a/include/d/actor/d_a_npc_bouS.h b/include/d/actor/d_a_npc_bouS.h
index bd3b1ff0b6..27eafb48fd 100644
--- a/include/d/actor/d_a_npc_bouS.h
+++ b/include/d/actor/d_a_npc_bouS.h
@@ -72,7 +72,7 @@ public:
void setExpression(int, f32);
bool talk(void*);
bool demo(void*);
- inline fopAc_ac_c* searchInstructionTag();
+ inline fopAc_ac_c* searchInstructionTag();
bool instruction(void*);
bool checkIntroDemoStart();
int EvCut_BousIntroSumo1(int);
diff --git a/include/d/actor/d_a_npc_gra.h b/include/d/actor/d_a_npc_gra.h
index 3209329a76..236755aba7 100644
--- a/include/d/actor/d_a_npc_gra.h
+++ b/include/d/actor/d_a_npc_gra.h
@@ -160,7 +160,7 @@ private:
/* 0x14B0 */ int field_0x1460;
/* 0x1464 */ int field_0x1464;
/* 0x1468 */ int field_0x1468;
- /* 0x146C */ int field_0x146C;
+ /* 0x146C */ int mFlowID;
/* 0x1470 */ s16 mLookMode;
/* 0x1472 */ u16 field_0x1472;
/* 0x1474 */ u8 mType;
diff --git a/include/d/actor/d_a_npc_grs.h b/include/d/actor/d_a_npc_grs.h
index 202dd25267..d2a0c5359d 100644
--- a/include/d/actor/d_a_npc_grs.h
+++ b/include/d/actor/d_a_npc_grs.h
@@ -103,7 +103,7 @@ private:
/* 0xE00 */ int field_0xe00;
/* 0xE04 */ int field_0xe04;
/* 0xE08 */ int field_0xe08;
- /* 0xE0C */ int field_0xe0c;
+ /* 0xE0C */ int mFlowID;
/* 0xE10 */ s16 mLookMode;
/* 0xE12 */ u16 mActionState;
/* 0xE14 */ u8 mType;
diff --git a/include/d/actor/d_a_npc_gwolf.h b/include/d/actor/d_a_npc_gwolf.h
index adcdb75adb..fcf5d804d0 100644
--- a/include/d/actor/d_a_npc_gwolf.h
+++ b/include/d/actor/d_a_npc_gwolf.h
@@ -121,7 +121,7 @@ private:
/* 0xDFC */ int field_0xdfc;
/* 0xE00 */ int field_0xe00;
/* 0xE04 */ int field_0xe04;
- /* 0xE08 */ int field_0xe08;
+ /* 0xE08 */ int mFlowID;
/* 0xE0C */ s16 mLookMode;
/* 0xE0E */ u16 mMode;
/* 0xE10 */ u8 mType;
diff --git a/include/d/actor/d_a_npc_kasi_hana.h b/include/d/actor/d_a_npc_kasi_hana.h
index 54b0cf914b..e355ed8c55 100644
--- a/include/d/actor/d_a_npc_kasi_hana.h
+++ b/include/d/actor/d_a_npc_kasi_hana.h
@@ -182,7 +182,8 @@ public:
s16 getMessageNo() { return s16(home.angle.x); }
s8 getType() {
s8 rv = fopAcM_GetParam(this) & 0xFF;
-
+
+ // !@bug Comparison of s8 with 0xFF will always evaluate to false
if (rv == 0xFF) {
rv = 0;
}
diff --git a/include/d/actor/d_a_npc_kasi_kyu.h b/include/d/actor/d_a_npc_kasi_kyu.h
index 9ca549e46c..0387c563b7 100644
--- a/include/d/actor/d_a_npc_kasi_kyu.h
+++ b/include/d/actor/d_a_npc_kasi_kyu.h
@@ -98,7 +98,8 @@ public:
s8 getType() {
s8 rv = fopAcM_GetParam(this) & 0xFF;
-
+
+ // !@bug Comparison of s8 with 0xFF will always evaluate to false
if (rv == 0xFF) {
rv = 0;
}
diff --git a/include/d/actor/d_a_npc_kasi_mich.h b/include/d/actor/d_a_npc_kasi_mich.h
index 9f38d3dd1c..e3782f1b27 100644
--- a/include/d/actor/d_a_npc_kasi_mich.h
+++ b/include/d/actor/d_a_npc_kasi_mich.h
@@ -99,7 +99,8 @@ public:
s8 getType() {
s8 rv = fopAcM_GetParam(this) & 0xFF;
-
+
+ // !@bug Comparison of s8 with 0xFF will always evaluate to false
if (rv == 0xFF) {
rv = 0;
}
diff --git a/include/d/actor/d_a_npc_kn.h b/include/d/actor/d_a_npc_kn.h
index a14a89aefe..e97431baef 100644
--- a/include/d/actor/d_a_npc_kn.h
+++ b/include/d/actor/d_a_npc_kn.h
@@ -77,7 +77,7 @@ public:
class daNpc_Kn_prtclMngr_c {
public:
- /* 0x00 */ bool mpModel;
+ /* 0x00 */ bool field_0x00;
/* 0x04 */ cXyz mPos;
/* 0x10 */ csXyz mAngle;
/* 0x18 */ cXyz mScale;
diff --git a/include/d/actor/d_a_npc_ks.h b/include/d/actor/d_a_npc_ks.h
index ba14540735..7ec5fd129d 100644
--- a/include/d/actor/d_a_npc_ks.h
+++ b/include/d/actor/d_a_npc_ks.h
@@ -89,7 +89,7 @@ public:
/* 0x5B7 */ u8 field_0x5b7;
/* 0x5B8 */ int order;
/* 0x5BC */ int bitTRB;
- /* 0x5C0 */ char* res_name;
+ /* 0x5C0 */ const char* res_name;
/* 0x5C4 */ f32 dis;
/* 0x5C8 */ s16 target_angle;
/* 0x5CC */ mDoExt_McaMorfSO* model;
diff --git a/include/d/actor/d_a_npc_myna2.h b/include/d/actor/d_a_npc_myna2.h
index bf97f43124..ac6af4d8f7 100644
--- a/include/d/actor/d_a_npc_myna2.h
+++ b/include/d/actor/d_a_npc_myna2.h
@@ -104,7 +104,7 @@ public:
/* 0xDF8 */ int field_0xdf8;
/* 0xDFC */ int field_0xdfc;
/* 0xE00 */ int field_0xe00;
- /* 0xE04 */ int field_0xe04;
+ /* 0xE04 */ int mFlowID;
/* 0xE08 */ s16 mLookMode;
/* 0xE0A */ u16 mMode;
/* 0xE0C */ u8 mType;
diff --git a/include/d/actor/d_a_npc_ne.h b/include/d/actor/d_a_npc_ne.h
index 10474cc828..51f9f06e81 100644
--- a/include/d/actor/d_a_npc_ne.h
+++ b/include/d/actor/d_a_npc_ne.h
@@ -95,7 +95,7 @@ public:
/* 0x5D8 */ f32 mDistToTarget;
/* 0x5DC */ s16 mAngleToPlayer;
/* 0x5E0 */ f32 mDistScale;
- /* 0x5E4 */ char* mResName;
+ /* 0x5E4 */ const char* mResName;
/* 0x5E8 */ mDoExt_McaMorf* mpMorf;
/* 0x5EC */ mDoExt_btkAnm* mpBtkAnm;
/* 0x5F0 */ mDoExt_btpAnm* mpBtpAnm;
diff --git a/include/d/actor/d_a_tag_push.h b/include/d/actor/d_a_tag_push.h
index 3a20b5ed77..a1f0b75b22 100644
--- a/include/d/actor/d_a_tag_push.h
+++ b/include/d/actor/d_a_tag_push.h
@@ -24,6 +24,9 @@ public:
u8 getBitSW2() { return (fopAcM_GetParam(this) & 0xFF00) >> 8; }
u32 getFlowNodeNo() {
+ // !@bug home.angle.x is promoted to a 32-bit signed integer prior
+ // to being compared, so the compared value can never exceed
+ // SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
return (u16)home.angle.x;
}
diff --git a/include/d/actor/d_a_tag_shop_item.h b/include/d/actor/d_a_tag_shop_item.h
index 826f867ad8..1b04b6ef8e 100644
--- a/include/d/actor/d_a_tag_shop_item.h
+++ b/include/d/actor/d_a_tag_shop_item.h
@@ -19,6 +19,10 @@ public:
u32 getProcessID() { return mProcessID; }
+ int getFlowNodeNum() {
+ return (u16)home.angle.x == 0xFFFF ? -1 : (u16)home.angle.x;
+ }
+
/* 0x56C */ u32 mProcessID;
/* 0x570 */ s16 mCreateTimer;
/* 0x572 */ u8 field_0x572;
diff --git a/include/d/d_demo.h b/include/d/d_demo.h
index 45e99a85d9..ff0a2fe9de 100644
--- a/include/d/d_demo.h
+++ b/include/d/d_demo.h
@@ -336,27 +336,6 @@ public:
virtual JPABaseEmitter* emitter_create(u32);
};
-namespace {
-class jstudio_tAdaptor_message : public JStudio::TAdaptor_message {
-public:
- typedef JStudio::TObject_message ObjectType;
-
- jstudio_tAdaptor_message() {}
-
- virtual ~jstudio_tAdaptor_message();
- virtual void adaptor_do_MESSAGE(JStudio::data::TEOperationData, const void*, u32);
-};
-
-class jstudio_tCreateObject_message : public JStudio::TCreateObject {
-public:
- jstudio_tCreateObject_message() {}
-
- virtual ~jstudio_tCreateObject_message();
- virtual bool create(JStudio::TObject**, const JStudio::stb::data::TParse_TBlock_object&);
-};
-
-}; // namespace
-
int dDemo_setDemoData(fopAc_ac_c*, u8, mDoExt_McaMorf*, char const*, int, u16*, u32, s8);
class dDemo_c {
@@ -405,7 +384,7 @@ public:
static JStudio_JStage::TCreateObject* m_stage;
static JStudio_JAudio2::TCreateObject* m_audio;
static dDemo_particle_c* m_particle;
- static jstudio_tCreateObject_message* m_message;
+ static JStudio::TCreateObject* m_message;
static JStudio::TFactory* m_factory;
static jmessage_tControl* m_mesgControl;
static dDemo_object_c* m_object;
diff --git a/include/d/d_menu_window.h b/include/d/d_menu_window.h
index 35c6789127..65e415077d 100644
--- a/include/d/d_menu_window.h
+++ b/include/d/d_menu_window.h
@@ -190,7 +190,7 @@ public:
bool isPauseWindow() { return mPauseWindow != false; }
void onShowFlag() { mShowFlag |= 1; }
void offShowFlag() { mShowFlag &= ~1; }
- bool isShowFlag() { return mShowFlag & 1 != 0; }
+ bool isShowFlag() { return (mShowFlag & 1) != 0; }
bool isFadeNowCheck() { return mDoGph_gInf_c::getFader()->getStatus() == 1; }
private:
diff --git a/include/d/d_msg_scrn_howl.h b/include/d/d_msg_scrn_howl.h
index aa51249e17..bf28682d42 100644
--- a/include/d/d_msg_scrn_howl.h
+++ b/include/d/d_msg_scrn_howl.h
@@ -112,7 +112,4 @@ struct dMsgScrnHowl_c : public dMsgScrnBase_c {
/* 0x27A8 */ f32 field_0x27a8;
};
-#define LINE_MAX 30
-#define PLOT_BUFFER_MAX_e 0x300
-
#endif /* MSG_SCRN_D_MSG_SCRN_HOWL_H */
diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h
index 8bfa4c068e..d6ef3605a1 100644
--- a/include/f_op/f_op_actor_mng.h
+++ b/include/f_op/f_op_actor_mng.h
@@ -425,11 +425,11 @@ inline void fopAcM_SetAngle(fopAc_ac_c* i_actor, s16 x, s16 y, s16 z) {
i_actor->current.angle.set(x, y, z);
}
-inline void dComIfGs_onSwitch(int i_no, int i_roomNo);
-inline void dComIfGs_offSwitch(int i_no, int i_roomNo);
-inline void dComIfGs_revSwitch(int i_no, int i_roomNo);
-inline BOOL dComIfGs_isSwitch(int i_no, int i_roomNo);
-inline void dComIfGs_offActor(int i_no, int i_roomNo);
+void dComIfGs_onSwitch(int i_no, int i_roomNo);
+void dComIfGs_offSwitch(int i_no, int i_roomNo);
+void dComIfGs_revSwitch(int i_no, int i_roomNo);
+BOOL dComIfGs_isSwitch(int i_no, int i_roomNo);
+void dComIfGs_offActor(int i_no, int i_roomNo);
inline void fopAcM_onSwitch(const fopAc_ac_c* i_actor, int sw) {
return dComIfGs_onSwitch(sw, fopAcM_GetHomeRoomNo(i_actor));
@@ -451,12 +451,12 @@ inline fopAc_ac_c* fopAcM_SearchByName(s16 proc_id) {
return (fopAc_ac_c*)fopAcIt_Judge(fpcSch_JudgeForPName, &proc_id);
}
-inline void dComIfGs_onItem(int bitNo, int roomNo);
+void dComIfGs_onItem(int bitNo, int roomNo);
inline void fopAcM_onItem(const fopAc_ac_c* item, int bitNo) {
dComIfGs_onItem(bitNo, fopAcM_GetHomeRoomNo(item));
}
-inline bool dComIfGs_isItem(int bitNo, int roomNo);
+bool dComIfGs_isItem(int bitNo, int roomNo);
inline bool fopAcM_isItem(const fopAc_ac_c* item, int bitNo) {
return dComIfGs_isItem(bitNo, fopAcM_GetHomeRoomNo(item));
}
@@ -469,7 +469,7 @@ inline int fopAcM_GetSetId(const fopAc_ac_c* i_actor) {
return i_actor->setID;
}
-inline void dComIfGs_onActor(int bitNo, int roomNo);
+void dComIfGs_onActor(int bitNo, int roomNo);
inline void fopAcM_onActor(const fopAc_ac_c* i_actor) {
dComIfGs_onActor(fopAcM_GetSetId(i_actor), fopAcM_GetHomeRoomNo(i_actor));
@@ -704,7 +704,7 @@ inline void make_prm_warp_hole(u32* o_params, u8 prm1, u8 prm2, u8 prm3) {
*o_params = pprm2 | pprm3 | pprm1;
}
-inline fopAc_ac_c* dComIfGp_getPlayer(int);
+fopAc_ac_c* dComIfGp_getPlayer(int);
inline s16 fopAcM_searchPlayerAngleY(const fopAc_ac_c* actor) {
return fopAcM_searchActorAngleY(actor, dComIfGp_getPlayer(0));
diff --git a/include/global.h b/include/global.h
index fc8abb5431..a8c2b0e07e 100644
--- a/include/global.h
+++ b/include/global.h
@@ -106,7 +106,7 @@ static const float INF = 2000000000.0f;
#define NO_INLINE
#endif
#endif
-
+
// Hack to trick the compiler into not inlining functions that use this macro.
#define FORCE_DONT_INLINE \
(void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; \
@@ -176,4 +176,15 @@ static const float INF = 2000000000.0f;
using std::isnan;
#endif
+// Comparing a non-volatile reference type to NULL is tautological
+// and triggers a warning on modern compilers, but in some cases is
+// required to match the original assembly.
+#if defined(__MWERKS__) || defined(DECOMPCTX)
+#define IS_REF_NULL(r) (&(r) == NULL)
+#define IS_REF_NONNULL(r) (&(r) != NULL)
+#else
+#define IS_REF_NULL(r) (0)
+#define IS_REF_NONNULL(r) (1)
+#endif
+
#endif