summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-09-21 17:17:10 +0200
committerTreeki <treeki@gmail.com>2011-09-21 17:17:10 +0200
commite6a84f7143968ac4a8ffa5fa8405d8d986a63951 (patch)
tree428caba44d7cd4cb37c36cebbd7bb92ba8b2a931 /include
parentdd75729e326b0f7114353649baa275cd06afae2f (diff)
downloadkamek-e6a84f7143968ac4a8ffa5fa8405d8d986a63951.tar.gz
kamek-e6a84f7143968ac4a8ffa5fa8405d8d986a63951.zip
renamed state classes, added dEn_c state references
Diffstat (limited to 'include')
-rwxr-xr-xinclude/game.h38
-rw-r--r--include/statelib.h68
2 files changed, 60 insertions, 46 deletions
diff --git a/include/game.h b/include/game.h
index d16a09f..f7728db 100755
--- a/include/game.h
+++ b/include/game.h
@@ -1099,7 +1099,7 @@ public:
dActorMultiState_c *owner;
u32 unkZero;
- StateMgr<dActorMultiState_c> manager;
+ dStateMgr_c<dActorMultiState_c> manager;
// All these are passed straight through to the manager
virtual void _vfC();
@@ -1128,11 +1128,11 @@ public:
virtual void _vfC(); // calls vfC on ptrToStateMgr
virtual void execute(); // calls vf10 on ptrToStateMgr
virtual void _vf14(); // if (isSecondStateMgr()) { disableSecond(); } else { ptrToStateMgr->_vf14(); }
- virtual void setState(StateBase *state); // calls vf18 on ptrToStateMgr
+ virtual void setState(dStateBase_c *state); // calls vf18 on ptrToStateMgr
virtual void _vf1C(); // calls vf1C on ptrToStateMgr
virtual void _vf20(); // calls vf20 on ptrToStateMgr
virtual void _vf24(); // calls vf24 on ptrToStateMgr
- virtual StateBase *getCurrentState(); // calls vf28 on ptrToStateMgr
+ virtual dStateBase_c *getCurrentState(); // calls vf28 on ptrToStateMgr
virtual void _vf2C(); // calls vf2C on ptrToStateMgr
virtual void enableSecond(); // sets ptrToStateMgr to s2, calls vf18 on it
virtual void disableSecond(); // if (isSecondStateMgr()) { ptrToStateMgr->vf14(); ptrToStateMgr = &s1; }
@@ -1146,6 +1146,8 @@ public:
~MultiStateMgr();
};
+#define REF_NINTENDO_STATE(NAME) \
+ static State StateID_##NAME;
#define DECLARE_STATE(NAME) \
static State StateID_##NAME; \
@@ -1161,7 +1163,7 @@ public:
&CLASS::endState_##NAME);
#define USING_STATES(CLASS) \
- typedef State<CLASS> State;
+ typedef dState_c<CLASS> State;
struct LinkListEntry {
@@ -1467,7 +1469,7 @@ public:
MultiStateMgr acState;
- virtual void doStateChange(StateBase *state); // might return bool? overridden by dEn_c
+ virtual void doStateChange(dStateBase_c *state); // might return bool? overridden by dEn_c
virtual void _vfD8(); // nullsub ??
virtual void _vfDC(); // nullsub ??
virtual void _vfE0(); // nullsub ??
@@ -1519,7 +1521,7 @@ public:
void _vfCC(Vec2 *p);
void _vfD0(Vec2 *p);
- void doStateChange(StateBase *state); // might return bool, dunno
+ void doStateChange(dStateBase_c *state); // might return bool, dunno
// Now here's where the fun starts.
@@ -1639,6 +1641,17 @@ public:
static void collisionCallback(ActivePhysics::Info *one, ActivePhysics::Info *two);
+
+ // States
+ USING_STATES(dEn_c);
+ REF_NINTENDO_STATE(DieFumi);
+ REF_NINTENDO_STATE(DieFall);
+ REF_NINTENDO_STATE(DieBigFall);
+ REF_NINTENDO_STATE(DieSmoke);
+ REF_NINTENDO_STATE(DieIceVanish);
+ REF_NINTENDO_STATE(DieYoshiFumi);
+ REF_NINTENDO_STATE(DieGoal);
+ REF_NINTENDO_STATE(DieOther);
};
@@ -1708,12 +1721,13 @@ public:
static void *OPhysicsCallback2;
static void *OPhysicsCallback3;
- static State<daEnBlockMain_c> StateID_UpMove;
- static State<daEnBlockMain_c> StateID_DownMove;
- static State<daEnBlockMain_c> StateID_DownMoveEnd;
- static State<daEnBlockMain_c> StateID_UpMove_Diff;
- static State<daEnBlockMain_c> StateID_DownMove_Diff;
- static State<daEnBlockMain_c> StateID_DownMove_DiffEnd;
+ USING_STATES(daEnBlockMain_c);
+ REF_NINTENDO_STATE(UpMove);
+ REF_NINTENDO_STATE(DownMove);
+ REF_NINTENDO_STATE(DownMoveEnd);
+ REF_NINTENDO_STATE(UpMove_Diff);
+ REF_NINTENDO_STATE(DownMove_Diff);
+ REF_NINTENDO_STATE(DownMove_DiffEnd);
~daEnBlockMain_c();
};
diff --git a/include/statelib.h b/include/statelib.h
index 34ab282..c039934 100644
--- a/include/statelib.h
+++ b/include/statelib.h
@@ -1,21 +1,21 @@
/******************************************************************************/
-// StateBase class
+// dStateBase_c class
/******************************************************************************/
-class StateBase {
+class dStateBase_c {
public:
- StateBase(const char *name);
+ dStateBase_c(const char *name);
- virtual ~StateBase();
+ virtual ~dStateBase_c();
virtual bool isInvalid();
- virtual bool isEqualNotUsedForSomeReason(StateBase *another);
- virtual bool isEqual(StateBase *another);
- virtual bool isNotEqual(StateBase *another);
+ virtual bool isEqualNotUsedForSomeReason(dStateBase_c *another);
+ virtual bool isEqual(dStateBase_c *another);
+ virtual bool isNotEqual(dStateBase_c *another);
virtual bool isSameStateName(const char *name);
virtual const char *getName();
virtual int getID();
- static StateBase mNoState;
+ static dStateBase_c mNoState;
private:
const char *mName;
@@ -25,21 +25,21 @@ private:
};
/******************************************************************************/
-// State<TOwner> : StateBase class
+// dState_c<TOwner> : dStateBase_c class
/******************************************************************************/
template <class TOwner>
-class State : public StateBase {
+class dState_c : public dStateBase_c {
public:
typedef void (TOwner::*funcPtr)();
- State(const char *name, funcPtr begin, funcPtr execute, funcPtr end) : StateBase(name) {
+ dState_c(const char *name, funcPtr begin, funcPtr execute, funcPtr end) : dStateBase_c(name) {
mBegin = begin;
mExecute = execute;
mEnd = end;
}
- ~State();
+ ~dState_c();
bool isSameStateName(const char *name);
virtual void doBegin(TOwner *owner);
@@ -52,10 +52,10 @@ public:
};
template <class TOwner>
-State<TOwner>::~State() { }
+dState_c<TOwner>::~dState_c() { }
template <class TOwner>
-bool State<TOwner>::isSameStateName(const char *name) {
+bool dState_c<TOwner>::isSameStateName(const char *name) {
const char *p = strrchr(name, ':');
if (p)
name = p + 1;
@@ -68,64 +68,64 @@ bool State<TOwner>::isSameStateName(const char *name) {
}
template <class TOwner>
-void State<TOwner>::doBegin(TOwner *owner) {
+void dState_c<TOwner>::doBegin(TOwner *owner) {
(owner->*mBegin)();
}
template <class TOwner>
-void State<TOwner>::doExecute(TOwner *owner) {
+void dState_c<TOwner>::doExecute(TOwner *owner) {
(owner->*mExecute)();
}
template <class TOwner>
-void State<TOwner>::doEnd(TOwner *owner) {
+void dState_c<TOwner>::doEnd(TOwner *owner) {
(owner->*mEnd)();
}
/******************************************************************************/
-// StateMgrBase class
+// dStateMgrBase_c class
/******************************************************************************/
-class StateMgrBase {
+class dStateMgrBase_c {
public:
- StateMgrBase(void *one, void *two, StateBase *pInitState);
+ dStateMgrBase_c(void *one, void *two, dStateBase_c *pInitState);
- virtual ~StateMgrBase();
+ virtual ~dStateMgrBase_c();
virtual void _vf0C();
virtual void execute();
virtual void _vf14();
- virtual void setState(StateBase *pNewState);
+ virtual void setState(dStateBase_c *pNewState);
virtual void setField10ToOne();
- virtual StateBase *getField20();
- virtual StateBase *getField14();
- virtual StateBase *getCurrentState_maybe();
- virtual StateBase *getField18();
+ virtual dStateBase_c *getField20();
+ virtual dStateBase_c *getField14();
+ virtual dStateBase_c *getCurrentState_maybe();
+ virtual dStateBase_c *getField18();
virtual bool _vf30() = 0;
virtual void _vf34() = 0;
virtual void _vf38() = 0;
- virtual void _vf3C(StateBase *pState) = 0;
+ virtual void _vf3C(dStateBase_c *pState) = 0;
private:
void *m04, *m08;
bool m0C, m0D, m0E, m0F, m10;
- StateBase *m14, *m18, *m1C;
- StateBase *m20; // maybe not a StateBase?
+ dStateBase_c *m14, *m18, *m1C;
+ dStateBase_c *m20; // maybe not a dStateBase_c?
};
/******************************************************************************/
-// StateMgr<TOwner> : StateMgrBase class
+// dStateMgr_c<TOwner> : dStateMgrBase_c class
/******************************************************************************/
template <class TOwner>
-class StateMgr : public StateMgrBase {
+class dStateMgr_c : public dStateMgrBase_c {
public:
- StateMgr(void *one, void *two, StateBase *pInitState);
- ~StateMgr();
+ dStateMgr_c(void *one, void *two, dStateBase_c *pInitState);
+ ~dStateMgr_c();
bool _vf30();
void _vf34();
void _vf38();
- void _vf3C(StateBase *pState);
+ void _vf3C(dStateBase_c *pState);
};
// TODO: add template methods