NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_wm_peach.cpp
1#include <game/bases/d_a_wm_peach.hpp>
3#include <game/bases/d_cs_seq_manager.hpp>
4#include <game/bases/d_wm_lib.hpp>
5
6const char *daWmPeach_c::smc_resAnmNames[ANIM_COUNT] = {
7 "fly_wmap_B1",
8 "fly_wmap_B2"
9};
10
11ACTOR_PROFILE(WM_PEACH, daWmPeach_c, 0);
12
15
18 mClipSphere.set(mPos, 10000.0f);
19 calcModel();
20
21 initState();
22 mScale.set(1.89f, 1.89f, 1.89f);
23
24 return SUCCEEDED;
25}
26
28 static const ProcFunc Proc_tbl[PROC_COUNT] = {
30 };
31
32 dCsSeqMng_c *csSeqMng = dCsSeqMng_c::ms_instance;
33 if (csSeqMng->FUN_80915600()) {
34 processCutsceneCommand(csSeqMng->GetCutName(), csSeqMng->m_164);
35 } else {
36 (this->*Proc_tbl[mCurrProc])();
37 }
38
39 mModel.play();
40 calcModel();
41 return SUCCEEDED;
42}
43
45 mModel.entry();
46 return SUCCEEDED;
47}
48
50 return SUCCEEDED;
51}
52
54 mAllocator.createFrmHeap(-1, mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT], nullptr, 0x20);
55 mResFile = dResMng_c::m_instance->getRes("peach", "g3d/peach.brres");
56
57 nw4r::g3d::ResMdl resMdl = mResFile.GetResMdl("peach");
58 mModel.create(resMdl, &mAllocator, nw4r::g3d::ScnMdl::BUFFER_RESMATMISC, 1);
59
60 static const m3d::playMode_e playModes[ANIM_COUNT] = {
63 };
64
65 for (int i = 0; i < ANIM_COUNT; i++) {
66 nw4r::g3d::ResAnmChr resAnmChr = mResFile.GetResAnmChr(smc_resAnmNames[i]);
67 mChrAnim[i].create(resMdl, resAnmChr, &mAllocator, nullptr);
68 mChrAnim[i].mPlayMode = playModes[i];
69 mChrAnim[i].setRate(0.0f);
70 mChrAnim[i].setFrame(0.0f);
71 }
72
73 mModel.setAnm(mChrAnim[fly_wmap_B1]);
74 calcModel();
76
77 mAllocator.adjustFrmHeap();
78}
79
81 mVec3_c pos = mPos;
82 mAng3_c angle = mAngle;
83 mMatrix.trans(pos);
84 mMatrix.ZXYrotM(angle);
85 mModel.setLocalMtx(&mMatrix);
86 mModel.setScale(mScale);
87 mModel.calc(false);
88}
89
93
95 mCurrProc = PROC_TYPE_EXEC;
96}
97
99
100void daWmPeach_c::processCutsceneCommand(int cutsceneCommandId, bool isFirstFrame) {
101 if (cutsceneCommandId != dCsSeqMng_c::CUTSCENE_CMD_NONE && !isStaff()) {
102 mIsCutEnd = true;
103 }
104}
105
106void daWmPeach_c::setAnim(int animIdx, float blendFrame, float rate, float frame) {
107 m3d::anmChr_c &anim = mChrAnim[animIdx];
108 anim.setRate(rate);
109 anim.setFrame(frame);
110 mModel.removeAnm(nw4r::g3d::ScnMdlSimple::ANMOBJTYPE_CHR);
111 mModel.setAnm(anim, blendFrame);
112}
mMtx_c mMatrix
The actor's partial transformation matrix. See makeMtx() for details.
mVec3_c mScale
The actor's scale (defaults to 1).
mVec3_c mPos
The actor's position.
mAng3_c mAngle
The actor's rotation (for 2D actors).
bool FUN_80915600()
static dResMng_c * m_instance
The instance of this class.
Definition d_res_mng.hpp:61
static void setSoftLight_Enemy(m3d::bmdl_c &mdl)
Sets the soft light effect for enemies.
mSphere_c mClipSphere
A sphere representing the actor's visible area.
The worldmap Peach actor, used during the World 8-Castle unlock cutscene.
virtual int execute()
do method for the execute operation.
void mode_exec()
Process function for the exec process type.
m3d::mdl_c mModel
The model.
nw4r::g3d::ResFile mResFile
The resource file.
void createModel()
Initializes the resources for the actor.
virtual int doDelete()
do method for the delete operation.
daWmPeach_c()
Constructs a new actor.
~daWmPeach_c()
Destroys the actor.
void calcModel()
Updates the model's transformation matrix.
dHeapAllocator_c mAllocator
The allocator.
static const char * smc_resAnmNames[ANIM_COUNT]
The animation names.
void setAnim(int animIdx, float blendFrame, float rate, float frame)
Sets an animation on the actor.
void init_exec()
Process initialization function for the exec process type.
virtual void processCutsceneCommand(int cutsceneCommandId, bool isFirstFrame)
Contains the actor-specific logic for processing the current world map cutscene.
m3d::anmChr_c mChrAnim[ANIM_COUNT]
The model animations.
PROC_TYPE_e mCurrProc
The current process type. See PROC_TYPE_e.
virtual int create()
do method for the create operation.
void initState()
Sets up the actor's initial state.
virtual int draw()
do method for the draw operation.
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:46
void setFrame(float frame)
Jumps to the specified frame in the animation.
Definition fanm.cpp:71
A three-dimensional short angle vector.
Definition m_angle.hpp:68
A three-dimensional floating point vector.
Definition m_vec.hpp:122
#define ACTOR_PROFILE(profName, className, properties)
Creates an actor profile, using the profile number as the execute and draw order value.
Definition f_profile.hpp:29
playMode_e
Definition banm.hpp:7
@ FORWARD_ONCE
Play the animation forward once.
Definition banm.hpp:9
@ GAME_HEAP_DEFAULT
The default game heap (alias of MEM1 or MEM2).
Definition m_heap.hpp:38
EGG::ExpHeap * g_gameHeaps[GAME_HEAP_COUNT]
The game heaps.
Definition m_heap.cpp:13