From 70dbbb1cb11cb9018b2823d7083c9db942ee7725 Mon Sep 17 00:00:00 2001 From: elijah-thomas774 Date: Sun, 9 Jun 2024 22:47:44 -0400 Subject: [PATCH] added macro for declaring state manager (used for annoying dummy funcs) --- include/d/tg/d_t_rock_boat.h | 7 +------ include/d/tg/d_t_tumble_weed.h | 5 +---- include/s/s_State.hpp | 16 ++++++++++------ 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/include/d/tg/d_t_rock_boat.h b/include/d/tg/d_t_rock_boat.h index 378593b4..28d0d669 100644 --- a/include/d/tg/d_t_rock_boat.h +++ b/include/d/tg/d_t_rock_boat.h @@ -23,14 +23,9 @@ public: STATE_FUNC_DECLARE(dTgRockBoat_c, Wait); private: - - sFStateMgr_c mStateMgr; + STATE_MGR_DECLARE(dTgRockBoat_c); int cooldown; int boatNum; - - void dummy() { - mStateMgr.getStateID(); - } }; #endif diff --git a/include/d/tg/d_t_tumble_weed.h b/include/d/tg/d_t_tumble_weed.h index e3a80dd4..5f8f9ecd 100644 --- a/include/d/tg/d_t_tumble_weed.h +++ b/include/d/tg/d_t_tumble_weed.h @@ -30,11 +30,8 @@ private: bool shouldDoWind(); void doSpawnTumbleweed(); void getWind(mVec3_c *); - void unused() { - mStateMgr.getStateID(); - } - sFStateMgr_c mStateMgr; + STATE_MGR_DECLARE(dTgTumbleWeed_c); u16 tumbleweedTimer; u16 padding; u16 windTimer; diff --git a/include/s/s_State.hpp b/include/s/s_State.hpp index 97a5847e..9ec6614a 100644 --- a/include/s/s_State.hpp +++ b/include/s/s_State.hpp @@ -7,15 +7,19 @@ // Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib // See include/s/README.txt for changes made -#define STATE_FUNC_DECLARE(class, name) void initializeState_##name(); \ +#define STATE_FUNC_DECLARE(class, name) \ + void initializeState_##name(); \ void executeState_##name(); \ void finalizeState_##name(); \ static sFStateID_c StateID_##name -#define STATE_DEFINE(class, name) sFStateID_c class::StateID_##name( \ - #class "::StateID_" #name, \ - &class::initializeState_##name, \ - &class::executeState_##name, \ - &class::finalizeState_##name) +#define STATE_DEFINE(class, name) \ + sFStateID_c class ::StateID_##name(#class "::StateID_" #name, &class ::initializeState_##name, \ + &class ::executeState_##name, &class ::finalizeState_##name) +#define STATE_MGR_DECLARE(class_name) \ + sFStateMgr_c mStateMgr; \ + void dummy_GetStateID() { \ + mStateMgr.getStateID(); \ + } #endif