NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_base_actor.hpp
1#pragma once
2#include <types.h>
4#include <dol/cLib/c_list.hpp>
5#include <dol/framework/f_list_mg.hpp>
6#include <dol/mLib/m_angle.hpp>
7#include <dol/mLib/m_mtx.hpp>
8#include <dol/mLib/m_vec.hpp>
9
14class dBaseActor_c : public dBase_c {
15public:
16
29 };
30
32
33protected:
34 virtual int preCreate();
35 virtual void postCreate(fBase_c::MAIN_STATE_e status);
36
37 virtual int preDelete();
38 virtual void postDelete(fBase_c::MAIN_STATE_e status);
39
42 virtual int preExecute();
43
46 virtual void postExecute(fBase_c::MAIN_STATE_e status);
47
50 virtual int preDraw();
51 virtual void postDraw(fBase_c::MAIN_STATE_e status);
52
53 virtual ~dBaseActor_c();
54
57 virtual void draw2D();
58
61 virtual void draw2D_lyt2();
62
63 virtual int GetActorType();
64
65 virtual void finalUpdate();
66
67public:
71 void calcSpeed();
72
75 void calcSpeedXY();
76
77 void calcSpeedX();
78 void calcFallSpeed();
79 void calcSpeedY();
80 void calcSpeedF();
81
82 void makeMtx();
83
84 mVec3_c getCenterPos() const;
85 void posMove(mVec3_c &delta);
86 void posMove();
87
88 int GetProfNameActorNum(ProfileName profile);
89
90 static void draw2DActorOnLyt1();
91 static void draw2DActorOnLyt2();
92
104 static dBaseActor_c *construct(ProfileName profName, unsigned long param, const mVec3_c *position, const mAng3_c *rotation);
105
116 static dBaseActor_c *construct(ProfileName profName, dBase_c *parent, unsigned long param, const mVec3_c *position, const mAng3_c *rotation);
117
118private:
125 static void setTmpCtData(const mVec3_c *position, const mAng3_c *rotation);
126
128
129public:
131
135
140
143
144 float mSpeedF;
146 float mAccelY;
148 float mAccelF;
149
151 bool mVisible;
152
153private:
154 static const mVec3_c *m_tmpCtPosP;
155 static const mAng3_c *m_tmpCtAngleP;
157};
Basic actor class, supporting positioning, rotation and movement/acceleration.
mAng3_c mLastAngle
The actor's rotation in the previous frame.
bool mVisible
Whether the actor should be visible or not. Defaults to true .
void calcSpeedXY()
Updates the actor's speed (2D actors).
int GetProfNameActorNum(ProfileName profile)
Counts the instances of the given actor profile.
mMtx_c mMatrix
The actor's world matrix.
virtual int preDraw()
Code to be executed before draw.
mVec3_c mScale
The actor's scale (defaults to 1).
float mAccelF
The actor's horizontal acceleration.
mVec3_c mSpeed
The actor's speed.
mVec3_c mLastPos
The actor's position in the previous frame.
mVec3_c mPos
The actor's position (top-left corner).
virtual void draw2D_lyt2()
Alternate drawing function for drawing in front of 2D layouts (second draw pass).
mVec3_c mSpeedMax
The actor's maximum speed.
void makeMtx()
Updates the actor's world matrix.
virtual void postExecute(fBase_c::MAIN_STATE_e status)
Code to be executed after execute.
virtual void postDraw(fBase_c::MAIN_STATE_e status)
See dBase_c::postDraw.
static const mVec3_c * m_tmpCtPosP
Temporary storage for the next constructed actor's position. See mPos.
virtual void finalUpdate()
Code to be executed after all the actors' execute method has run.
void calcSpeedX()
Applies mAccelF to the actor's X speed, using mSpeedMax as the speed limit.
mVec3_c mPosDelta
The actor's position delta since the previous frame.
mVec3_c mCenterOffs
The offset from the position to the center of the actor (defaults to 0).
void calcFallSpeed()
Applies mAccelY to the actor's Y speed, using mMaxFallSpeed as the speed limit.
fLiNdBa_c mLinkActor
The node in m_actorManage.
static void setTmpCtData(const mVec3_c *position, const mAng3_c *rotation)
Sets temporary data to be used for the next actor's construction.
static dBaseActor_c * construct(ProfileName profName, unsigned long param, const mVec3_c *position, const mAng3_c *rotation)
Creates an actor without a parent.
virtual int preDelete()
See dBase_c::preDelete.
float mSpeedF
The actor's horizontal speed.
virtual void postDelete(fBase_c::MAIN_STATE_e status)
See dBase_c::postDelete.
void posMove()
Moves the actor by its speed.
virtual void draw2D()
Alternate drawing function for drawing in front of 2D layouts (first draw pass).
virtual int GetActorType()
Gets the actor kind. See ACTOR_KIND_e.
float mMaxFallSpeed
The actor's maximum fall speed.
void calcSpeed()
Updates the actor's speed (3D actors).
mVec3_c getCenterPos() const
Gets the actor's center position.
static const mAng3_c * m_tmpCtAngleP
Temporary storage for the next constructed actor's rotation. See mAngle.
void calcSpeedF()
Applies mAccelF to mSpeedF, using mMaxSpeedF as the speed limit.
static fLiMgBa_c m_actorManage
A list of all the constructed actors.
mAng3_c mAngle
The actor's rotation.
static void draw2DActorOnLyt2()
Calls draw2D_lyt2 on every actor.
virtual void postCreate(fBase_c::MAIN_STATE_e status)
See dBase_c::postCreate.
u32 mActorProperties
The actor's properties. See fProfile::fActorProfile_c::mActorProperties.
float mAccelY
The actor's vertical acceleration.
float mMaxSpeedF
The actor's maximum horizontal speed.
void calcSpeedY()
Applies mAccelY to the actor's Y speed, using mSpeedMax as the speed limit.
virtual int preExecute()
Code to be executed before execute.
virtual int preCreate()
See dBase_c::preCreate.
static void draw2DActorOnLyt1()
Calls draw2D on every actor.
ACTOR_KIND_e
An identifier that represents the actor's kind.
@ ACTOR_MAP_STOP
[Unused]. Identifies the daWmStop_c actor.
@ ACTOR_MAP_ENEMY
Used for map enemies.
@ ACTOR_MAP_DEMO
Used for map actors that are affected by cutscenes.
@ ACTOR_UNK_6
[Unused].
@ ACTOR_MAP_PLAYER
The worldmap player actor [dWmPlayer_c].
@ ACTOR_GENERIC
The default value.
@ ACTOR_MAP
Used for most map actors.
@ ACTOR_SYSTEM
Used for behind-the-scenes actors [such as dCsSeqMng_c].
@ ACTOR_MENU_PLAYER
The menu player actor [da2DPlayer_c].
An extension of fBase_c with base kind and name strings.
Definition d_base.hpp:9
MAIN_STATE_e
The possible operation results.
Definition f_base.hpp:135
A base list, made of fLiNdBa_c nodes.
Definition f_list_mg.hpp:13
A base list node.
Definition f_list_nd.hpp:11
A three-dimensional short angle vector.
Definition m_angle.hpp:61
A 3x4 matrix.
Definition m_mtx.hpp:9
A three-dimensional floating point vector.
Definition m_vec.hpp:88
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
Definition f_profile.hpp:32