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 /// @cond
18 void dummy() {
19 mStateMgr.initializeState();
20 mStateMgr.finalizeState();
21 mStateMgr.getOldStateID();
22 }
23 /// @endcond
24
25 bool isState(const sStateIDIf_c &state) const {
26 return *mStateMgr.getStateID() == state;
27 }
28};
29
30/// @brief An implementation of dActor_c with multi state support.
31/// @ingroup bases
33public:
34 dActorMultiState_c() : mStateMgr(*this, sStateID::null) {} ///< @copydoc dActor_c::dActor_c
35 ~dActorMultiState_c(); ///< @copydoc dActor_c::~dActor_c
36
37 /// @brief Changes the actor's state to the given state.
38 /// @param newState The state ID of the new state.
39 virtual void changeState(const sStateIDIf_c &newState) { mStateMgr.changeState(newState); }
40
41 /// @brief Checks if the actor is currently in the given state.
42 /// @param other The state ID to check.
43 /// @return Whether the actor is in the given state.
44 bool isState(const sStateIDIf_c &other) const { return *mStateMgr.getStateID() == other; }
45
46 STATE_VIRTUAL_FUNC_DECLARE(dActorMultiState_c, GegnericMulti); ///< An example state that does nothing.
47
49
50 /// @cond
51 void dummy() {
52 mStateMgr.initializeState();
53 mStateMgr.finalizeState();
54 mStateMgr.changeToSubState(*mStateMgr.getOldStateID());
55 }
56 /// @endcond
57};
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 const sStateIDIf_c * getStateID() const
Gets the current state ID.
#define STATE_VIRTUAL_FUNC_DECLARE(class, name)
Declares a virtual state.
Definition s_State.hpp:22