From 1ff18808eaec272c540d377377e69d14c36d6656 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Tue, 2 Apr 2024 13:14:50 -0500 Subject: [PATCH 1/2] Use define for showing HuSprGrpDrawNoSet prototype --- include/game/sprite.h | 3 +++ src/REL/instDll/main.c | 2 -- src/REL/modeltestDll/main.c | 1 + src/game/board/lottery.c | 2 -- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/game/sprite.h b/include/game/sprite.h index c08cf105..d944cc74 100644 --- a/include/game/sprite.h +++ b/include/game/sprite.h @@ -113,6 +113,9 @@ void HuSprGrpCenterSet(s16 group, float x, float y); void HuSprGrpZRotSet(s16 group, float z_rot); void HuSprGrpScaleSet(s16 group, float x, float y); void HuSprGrpTPLvlSet(s16 group, float tp_lvl); +#ifndef HUSPR_USE_OLD_DEFS +void HuSprGrpDrawNoSet(s16 group, s32 draw_no); +#endif void HuSprDrawNoSet(s16 group, s16 member, s32 draw_no); void HuSprPriSet(s16 group, s16 member, s16 prio); void HuSprGrpScissorSet(s16 group, s16 x, s16 y, s16 w, s16 h); diff --git a/src/REL/instDll/main.c b/src/REL/instDll/main.c index 4ba2b989..7c9ea6d0 100644 --- a/src/REL/instDll/main.c +++ b/src/REL/instDll/main.c @@ -21,8 +21,6 @@ #include "rel_sqrt_consts.h" -void HuSprGrpDrawNoSet(s16 group, s32 draw_no); - static s16 lbl_1_data_0 = 1; static omObjData *lbl_1_bss_60; diff --git a/src/REL/modeltestDll/main.c b/src/REL/modeltestDll/main.c index 444cea7a..f72c1fc2 100644 --- a/src/REL/modeltestDll/main.c +++ b/src/REL/modeltestDll/main.c @@ -1,3 +1,4 @@ +#define HUSPR_USE_OLD_DEFS #include "math.h" #include "game/chrman.h" #include "game/object.h" diff --git a/src/game/board/lottery.c b/src/game/board/lottery.c index 783e4d63..f5689a87 100755 --- a/src/game/board/lottery.c +++ b/src/game/board/lottery.c @@ -23,8 +23,6 @@ #include "math.h" -void HuSprGrpDrawNoSet(s16 group, s32 draw_no); - #define ABS(x) (((x) < 0) ? -(x) : (x)) typedef struct { From a75efa78828355cb9e038caacfa93b679cb1f83f Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Tue, 2 Apr 2024 13:31:26 -0500 Subject: [PATCH 2/2] Use inlines for coin gain and collect amounts --- include/game/gamework_data.h | 28 ++++++++++++++++++++++++++-- src/game/board/bowser.c | 3 +-- src/game/board/main.c | 4 ++-- src/game/flag.c | 2 +- src/game/objsub.c | 7 ++----- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/include/game/gamework_data.h b/include/game/gamework_data.h index 69542fdf..cf87373b 100644 --- a/include/game/gamework_data.h +++ b/include/game/gamework_data.h @@ -2,6 +2,7 @@ #define _GAMEWORK_DATA_H #include "dolphin.h" +#include "game/flag.h" typedef struct player_config { s16 character; @@ -97,8 +98,8 @@ typedef struct player_state { /* 0x20 */ s16 coins_total; /* 0x22 */ s16 coins_max; /* 0x24 */ s16 coins_battle; -/* 0x26 */ s16 unk_26; -/* 0x28 */ s16 coin_gain; +/* 0x26 */ s16 coin_collect; +/* 0x28 */ s16 coin_win; /* 0x2A */ s16 stars; /* 0x2C */ s16 stars_max; /* 0x2E */ char unk_2E[2]; @@ -233,4 +234,27 @@ static inline void GWLuckyValueSet(s32 value) GWSystem.lucky_value = value; } +static inline s16 GWPlayerCoinCollectGet(s32 player) +{ + return GWPlayer[player].coin_collect; +} + +static inline void GWPlayerCoinCollectSet(s32 player, s16 value) +{ + GWPlayer[player].coin_collect = value; +} + +static inline s16 GWPlayerCoinWinGet(s32 player) +{ + return GWPlayer[player].coin_win; +} + +static inline void GWPlayerCoinWinSet(s32 player, s16 value) +{ + if (_CheckFlag(0x1000C) == 0) { + GWPlayer[player].coin_win = value; + } + +} + #endif diff --git a/src/game/board/bowser.c b/src/game/board/bowser.c index d32ce7d5..b26d3f0f 100644 --- a/src/game/board/bowser.c +++ b/src/game/board/bowser.c @@ -467,8 +467,7 @@ static void DoMGReturnEffect(void) s32 mess; s32 mess_char; for(player=0; player<4; player++) { - s16 gain = GWPlayer[player].coin_gain; - if(gain == 1) { + if(GWPlayerCoinWinGet(player) == 1) { break; } } diff --git a/src/game/board/main.c b/src/game/board/main.c index b7abb20f..2ba9bd1e 100644 --- a/src/game/board/main.c +++ b/src/game/board/main.c @@ -322,8 +322,8 @@ void BoardSaveInit(s32 board) GWPlayer[i].coins_max = 0; GWPlayer[i].stars_max = 0; GWPlayer[i].coins_battle = 0; - GWPlayer[i].unk_26 = 0; - GWPlayer[i].coin_gain = 0; + GWPlayer[i].coin_collect = 0; + GWPlayer[i].coin_win = 0; GWPlayer[i].items[0] = -1; GWPlayer[i].items[1] = -1; GWPlayer[i].items[2] = -1; diff --git a/src/game/flag.c b/src/game/flag.c index f5168ef5..26cdb6c8 100644 --- a/src/game/flag.c +++ b/src/game/flag.c @@ -15,7 +15,7 @@ static u8 *GetFlagPtr(u32 flag) return ret; } -u32 _CheckFlag(u32 flag) +s32 _CheckFlag(u32 flag) { u8 *flag_ptr = GetFlagPtr(flag); u16 index = flag; diff --git a/src/game/objsub.c b/src/game/objsub.c index f80a4928..a3dde048 100644 --- a/src/game/objsub.c +++ b/src/game/objsub.c @@ -1199,11 +1199,8 @@ void omGameSysInit(Process *objman) { omSysPauseEnable(0); for (i = 0; i < 4; i++) { - if (_CheckFlag(0x1000C) == 0) { - GWPlayer[i].coin_gain = 0; - } - - GWPlayer[i].unk_26 = 0; + GWPlayerCoinWinSet(i, 0); + GWPlayerCoinCollectSet(i, 0); } if (mgPracticeEnableF != 0) {