SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
Nerve.hpp
1#pragma once
2
3#include "Game/LiveActor/Spine.hpp"
4
6class Nerve {
7public:
10 virtual void execute(Spine *pSpine) const = 0;
13 virtual void executeOnEnd(Spine *pSpine) const;
14};
15
16/* Defines a basic nerve class */
17#define NERVE(name)\
18class name : public Nerve\
19{\
20public:\
21 name() NO_INLINE {\
22 };\
23 virtual void execute(Spine *) const;\
24 static name sInstance;\
25};\
26
27/* Defines a basic nerve that overrides the executeOnEnd function */
28#define NERVE_EXECEND(name)\
29class name : public Nerve\
30{\
31public:\
32 name() NO_INLINE {\
33 };\
34 virtual void execute(Spine *) const;\
35 virtual void executeOnEnd(Spine *) const;\
36 static name sInstance;\
37};\
38
39/* Initializes the static instance of a nerve */
40#define INIT_NERVE(name)\
41 name name::sInstance;\
42
43/* Initalizes the static instance of a nerve and also defines the body of said nerve's execute function */
44#define INIT_NERVE_NEW(name, parent_class, func)\
45 name name::sInstance;\
46 void name::execute(Spine *pSpine) const { \
47 parent_class* actor = reinterpret_cast<parent_class*>(pSpine->mExecutor);\
48 actor->func();\
49 }\
50
51/* Declares a nerve and also defines the body of the nerve's execution function, which calls a specified member function */
52#define NERVE_DECL(name, parent_class, func)\
53class name : public Nerve\
54{\
55public:\
56 name() NO_INLINE {\
57 };\
58 virtual void execute(Spine *pSpine) const {\
59 parent_class* actor = reinterpret_cast<parent_class*>(pSpine->mExecutor);\
60 actor->func();\
61 };\
62 static name sInstance;\
63};\
64
65/* Declares a nerve and also defines the body of the nerve's execution and executeOnEndfunctions, which calls a specified member function */
66#define NERVE_DECL_ONEND(name, parent_class, func, onEndFunc)\
67class name : public Nerve\
68{\
69public:\
70 name() NO_INLINE {\
71 };\
72 virtual void execute(Spine *pSpine) const {\
73 parent_class* actor = reinterpret_cast<parent_class*>(pSpine->mExecutor);\
74 actor->func();\
75 };\
76 virtual void executeOnEnd(Spine *pSpine) const {\
77 parent_class* actor = reinterpret_cast<parent_class*>(pSpine->mExecutor);\
78 actor->onEndFunc();\
79 };\
80 static name sInstance;\
81};\
82
83/* Declares a nerve and also defines the nerve's execute function with an empty body */
84#define NERVE_DECL_NULL(name)\
85class name : public Nerve\
86{\
87public:\
88 name() NO_INLINE {\
89 };\
90 virtual void execute(Spine *pSpine) const {\
91 };\
92 static name sInstance;\
93};\
Used for executing states of a LiveActor.
Definition Nerve.hpp:6
virtual void execute(Spine *pSpine) const =0
Executes a state based on the host actor.
virtual void executeOnEnd(Spine *pSpine) const
Executes after the last iteration of a state before it executes another state.
Definition Nerve.cpp:3
Definition Spine.hpp:9