NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
s_StateMethod.hpp
1#pragma once
2#include <dol/sLib/s_StateInterfaces.hpp>
3
8public:
16 sStateMethod_c(sStateIDChkIf_c &checker, sStateFctIf_c &factory, const sStateIDIf_c &initialState);
17 virtual ~sStateMethod_c();
18
19 virtual void initializeStateMethod();
20 virtual void executeStateMethod();
21 virtual void finalizeStateMethod();
22 virtual void changeStateMethod(const sStateIDIf_c &newStateID);
23 virtual void refreshStateMethod() { mRefreshStateMethod = true; }
24 virtual sStateIf_c *getState() const { return mpState; }
25 virtual const sStateIDIf_c *getNewStateID() const { return mpNewStateID; }
26 virtual const sStateIDIf_c *getStateID() const { return mpStateID; }
27 virtual const sStateIDIf_c *getOldStateID() const { return mpOldStateID; }
28
29 virtual int initializeStateLocalMethod() = 0;
30 virtual void executeStateLocalMethod() = 0;
31 virtual void finalizeStateLocalMethod() = 0;
32 virtual void changeStateLocalMethod(const sStateIDIf_c &newStateID) = 0;
33
34protected:
37
40 bool mIsValid;
43
47
49};
The interface for state factories.
The interface for state ID checkers.
The interface for state IDs.
The interface for a state holder.
A class that handles state execution and transition.
virtual void executeStateLocalMethod()=0
Performs the actual state execution.
virtual const sStateIDIf_c * getOldStateID() const
Gets the previous state ID.
virtual int initializeStateLocalMethod()=0
Performs the actual state initialization.
virtual void finalizeStateLocalMethod()=0
Performs the actual state termination.
virtual void initializeStateMethod()
Initializes the current state.
const sStateIDIf_c * mpStateID
The current state ID.
const sStateIDIf_c * mpOldStateID
The previous state ID.
bool mExecutionLock
A lock to ensure executeStateMethod is not called recursively.
sStateIDChkIf_c & mpStateChk
[Unused]. The state checker to use.
virtual const sStateIDIf_c * getNewStateID() const
Gets the next state ID.
virtual sStateIf_c * getState() const
Gets the state holder.
virtual void finalizeStateMethod()
Prepares the current state for termination.
virtual void refreshStateMethod()
Marks the current state to be executed again.
virtual ~sStateMethod_c()
Destroys the sStateMethod_c instance.
sStateFctIf_c & mpStateFct
The state factory which produces the state holder.
bool mInitFinalizeLock
A lock to ensure initializeStateMethod and finalizeStateMethod are not called recursively.
bool mStateChanged
If the current state has changed during execution.
virtual void changeStateLocalMethod(const sStateIDIf_c &newStateID)=0
Performs the actual state transition.
sStateIf_c * mpState
The current state holder.
const sStateIDIf_c * mpNewStateID
The next state ID.
bool mIsValid
If the state holder contains a valid state ID.
virtual void executeStateMethod()
Executes the current state.
virtual void changeStateMethod(const sStateIDIf_c &newStateID)
Transitions to a new state ID.
bool mRefreshStateMethod
True, if after a state transition, the state should be executed again.
virtual const sStateIDIf_c * getStateID() const
Gets the current state ID.