summaryrefslogtreecommitdiff
path: root/include/game.h
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-01-08 05:26:39 +0100
committerTreeki <treeki@gmail.com>2012-01-08 05:26:39 +0100
commit14fc0d0f71e1cb682473b7f7bbc959cfa70d163d (patch)
tree5e227316b6cc4a18e76b7cc51e397d0109ff523a /include/game.h
parent0ba16c2ac037346cea4566dadcb23d7c179e9588 (diff)
downloadkamek-14fc0d0f71e1cb682473b7f7bbc959cfa70d163d.tar.gz
kamek-14fc0d0f71e1cb682473b7f7bbc959cfa70d163d.zip
finally, a proper state API! hopefully this didn't break anything
Diffstat (limited to 'include/game.h')
-rwxr-xr-xinclude/game.h63
1 files changed, 32 insertions, 31 deletions
diff --git a/include/game.h b/include/game.h
index 465bbd4..3b2876d 100755
--- a/include/game.h
+++ b/include/game.h
@@ -1092,53 +1092,54 @@ class dActorState_c;
class dActorMultiState_c;
-class AcStateMgrBase {
+template <class TOwner>
+class dStateWrapperBase_c {
public:
- virtual ~AcStateMgrBase();
-
- u32 cls1, cls2, cls3;
- dActorMultiState_c *owner;
- u32 unkZero;
-
- dStateMgr_c<dActorMultiState_c> manager;
-
- // All these are passed straight through to the manager
- virtual void _vfC();
- virtual void _vf10();
- virtual void _vf14();
- virtual void _vf18();
- virtual void _vf1C();
- virtual void _vf20();
- virtual void _vf24();
- virtual void _vf28();
- virtual void _vf2C();
+ virtual ~dStateWrapperBase_c() { }
+
+ dStatePointless_c pointless;
+ dStateExecutor_c<TOwner> executor;
+
+ dStateMgr_c manager;
+
+ // All these are passed straight through to the manager, todo: name them and arguments
+ virtual void ensureStateHasBegun();
+ virtual void execute();
+ virtual void endCurrentState();
+ virtual void setState(dStateBase_c *pNewState);
+ virtual void executeNextStateThisTick();
+ virtual dStateMethodExecutorBase_c *getCurrentStateMethodExecutor();
+ virtual dStateBase_c *getNextState();
+ virtual dStateBase_c *getCurrentState();
+ virtual dStateBase_c *getPreviousState();
};
-class AcStateMgr : public AcStateMgrBase {
+template <class TOwner>
+class dStateWrapper_c : public dStateWrapperBase_c<TOwner> {
public:
- ~AcStateMgr();
+ ~dStateWrapper_c() { }
};
class MultiStateMgrBase {
public:
virtual ~MultiStateMgrBase();
- AcStateMgr s1, s2;
- AcStateMgr *ptrToStateMgr;
+ dStateWrapper_c<dActorMultiState_c> s1, s2;
+ dStateWrapper_c<dActorMultiState_c> *ptrToStateMgr;
- virtual void _vfC(); // calls vfC on ptrToStateMgr
+ virtual void ensureStateHasBegun(); // calls vfC on ptrToStateMgr
virtual void execute(); // calls vf10 on ptrToStateMgr
- virtual void _vf14(); // if (isSecondStateMgr()) { disableSecond(); } else { ptrToStateMgr->_vf14(); }
+ virtual void endCurrentState(); // if (isSecondStateMgr()) { disableSecond(); } else { ptrToStateMgr->_vf14(); }
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 void executeNextStateThisTick(); // calls vf1C on ptrToStateMgr
+ virtual dStateMethodExecutorBase_c *getCurrentStateMethodExecutor(); // calls vf20 on ptrToStateMgr
+ virtual dStateBase_c *getNextState(); // calls vf24 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 dStateBase_c *getPreviousState(); // calls vf2C on ptrToStateMgr
+ virtual void enableSecondWithState(dStateBase_c *state); // sets ptrToStateMgr to s2, calls vf18 on it
virtual void disableSecond(); // if (isSecondStateMgr()) { ptrToStateMgr->vf14(); ptrToStateMgr = &s1; }
virtual bool isSecondStateMgr();
- virtual void _vf3C(); // calls vf28 on s1
+ virtual dStateBase_c *getCurrentStateFromFirst(); // calls vf28 on s1
};
class MultiStateMgr : public MultiStateMgrBase {