NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_actor_state.hpp
1#pragma once
2
3#include <game/bases/d_actor.hpp>
5
6/// @brief An implementation of dActor_c with state support.
7/// @ingroup bases
8class dActorState_c : public dActor_c {
9public:
10 dActorState_c(); ///< @copydoc dActor_c::dActor_c
11 ~dActorState_c(); ///< @copydoc dActor_c::~dActor_c
12
13 STATE_VIRTUAL_FUNC_DECLARE(dActorState_c, Gegneric); ///< An example state that does nothing.
14
16
17 void changeState(const sStateIDIf_c &newState) {
18 mStateMgr.changeState(newState);
19 }
20
21 /// @cond
22 void dummy() {
25 }
26 /// @endcond
27
28 bool isState(const sStateIDIf_c &state) const {
29 return *mStateMgr.getStateID() == state;
30 }
31
32 const sStateIDIf_c &getOldStateID() const {
33 return *mStateMgr.getOldStateID();
34 }
35};
36
37/// @brief An implementation of dActor_c with multi state support.
38/// @ingroup bases
40public:
41 dActorMultiState_c() : mStateMgr(*this, sStateID::null) {} ///< @copydoc dActor_c::dActor_c
42 ~dActorMultiState_c(); ///< @copydoc dActor_c::~dActor_c
43
44 /// @brief Changes the actor's state to the given state.
45 /// @param newState The state ID of the new state.
46 virtual void changeState(const sStateIDIf_c &newState) { mStateMgr.changeState(newState); }
47
48 /// @brief Checks if the actor is currently in the given state.
49 /// @param other The state ID to check.
50 /// @return Whether the actor is in the given state.
51 bool isState(const sStateIDIf_c &other) const { return *mStateMgr.getStateID() == other; }
52
53 STATE_VIRTUAL_FUNC_DECLARE(dActorMultiState_c, GegnericMulti); ///< An example state that does nothing.
54
56
57 /// @cond
58 void dummy() {
59 mStateMgr.initializeState();
60 mStateMgr.finalizeState();
61 mStateMgr.changeToSubState(*mStateMgr.getOldStateID());
62 }
63 /// @endcond
64};
bool isState(const sStateIDIf_c &other) const
Checks if the actor is currently in the given state.
dActorMultiState_c()
Constructs a new actor.
virtual void changeState(const sStateIDIf_c &newState)
Changes the actor's state to the given state.
sFStateStateMgr_c< dActorMultiState_c, sStateMethodUsr_FI_c, sStateMethodUsr_FI_c > mStateMgr
The state manager.
~dActorMultiState_c()
Destroys the actor.
dActorState_c()
Constructs a new actor.
~dActorState_c()
Destroys the actor.
sFStateMgr_c< dActorState_c, sStateMethodUsr_FI_c > mStateMgr
The state manager.
dActor_c()
Constructs a new actor.
Definition d_actor.cpp:46
A wrapper for sStateMgr_c that uses sFStateFct_c and sStateIDChk_c.
The interface for state IDs.
virtual void finalizeState()
Prepares the current state for termination.
virtual void initializeState()
Initializes the current state.
#define STATE_VIRTUAL_FUNC_DECLARE(class, name)
Declares a virtual state.
Definition s_State.hpp:22