From aaec9ae2d87e036309ae212ee4807be449431261 Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 11 Jul 2011 00:06:36 +0200 Subject: dFlagMgr_c added to headers and linker scripts --- include/game.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'include/game.h') diff --git a/include/game.h b/include/game.h index ff2e2de..123e4f7 100755 --- a/include/game.h +++ b/include/game.h @@ -284,6 +284,49 @@ void *BgTexMng__LoadAnimTile(void *self, int tileset, short tile, char *name, ch extern void *GameHeaps[]; +class dFlagMgr_c { +public: + dFlagMgr_c(); + + enum ActionFlag { + ACTIVATE = 1, + TICKS = 2 + }; + + u64 flags; + float _8[64], _108[64]; + u8 _208[64]; + u64 _248[64]; + u8 _448[64]; + + u32 ticksRemainingForAction[64]; + u8 actionFlag[64]; + u32 _5C8[64]; // somehow sound related?! assigned by last param to set(); only checked for == 0 + u8 _6C8; // assigned -1 by FlagMgr, and other values by the Switch object, nothing else though + + void setup(bool isNewLevel); + void applyAndClearAllTimedActions(); // only used when setup(true) is called + void execute(); + + void set(u8 number, int delay, bool activate, bool reverseEffect, bool makeNoise, u32 unknown=0); + + u8 findLowestFlagInSet(u32 unk, u64 set); + + void setSpecial(u8 number, float to8, float to108, u8 to208, u32 unk, u64 to248); + float get8(u8 number); + float get108(u8 number); + u8 get208(u8 number); + u64 get248(u8 number); + u8 get448(u8 number); + + // convenience inline functions which may or may not actually exist in Nintendo's original code + u64 mask(u8 number) { return (u64)1 << number; } + bool active(u8 number) { return (flags & mask(number)) != 0; } + bool inactive(u8 number) { return (flags & mask(number)) == 0; } + + static dFlagMgr_c *instance; +}; + namespace nw4r { -- cgit v1.2.3