NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_en_door.cpp
1#include <game/bases/d_en_door.hpp>
5
6ACTOR_PROFILE(EN_DOOR, dEnDoor_c, 2);
7
8const sCcDatNewF l_door_cc_data = {
9 0.0f, 20.0f,
10 12.0f, 20.0f,
11 CC_KIND_ENEMY,
12 CC_ATTACK_NONE,
13 BIT_FLAG(CC_KIND_PLAYER),
14 0,
15 CC_STATUS_NONE,
17};
18
20 mResFile = dResMng_c::m_instance->getRes("obj_door", "g3d/obj_door.brres");
21
22 nw4r::g3d::ResMdl resMdl = mResFile.GetResMdl("obj_doorA");
23 mModel.create(resMdl, &mAllocator, nw4r::g3d::ScnMdl::BUFFER_RESMATMISC, 1, nullptr);
24
26
27 nw4r::g3d::ResAnmChr resAnmChr = mResFile.GetResAnmChr("obj_doorA");
28 mAnim.create(resMdl, resAnmChr, &mAllocator, nullptr);
29}
30
32 nw4r::g3d::ResAnmChr resAnmChr = mResFile.GetResAnmChr("obj_doorA");
33 mAnim.setAnm(mModel, resAnmChr, m3d::FORWARD_ONCE);
34 mModel.setAnm(mAnim, 0.0f);
35 mAnim.setRate(0.0f);
36}
37
39 mCc.set(this, (sCcDatNewF *) &l_door_cc_data);
40}
41
43 mAnim.setRate(1.0f);
44 mAnim.mPlayMode = m3d::FORWARD_ONCE;
45}
46
48 mAnim.setRate(1.0f);
49 mAnim.mPlayMode = m3d::REVERSE_ONCE;
50}
51
53 mAnim.setRate(0.0f);
54 mAnim.setFrame(0.0f);
55}
56
57// To get automatically copied virtual functions in the right order. @unused
58void UNUSED_dEnDoor_c() {
59 dEnDoor_c *door = nullptr;
60 door->setCloseMoveSE();
61 door->initialize();
62}
63
65 dAudio::g_pSndObjMap->startSound(SE_OBJ_DOOR_CLOSE, mPos, 0);
66}
67
69 dAudio::g_pSndObjMap->startSound(SE_OBJ_DOOR_OPEN, mPos, 0);
70}
71
73 return isState(StateID_Wait);
74}
bool isState(const sStateIDIf_c &other) const
Checks if the actor is currently in the given state.
static void setSoftLight_MapObj(m3d::bmdl_c &mdl)
Sets the soft light effect for map objects.
Definition d_actor.cpp:333
dCc_c mCc
The actor-to-actor collision sensor.
Definition d_actor.hpp:344
mVec3_c mPos
The actor's position.
A regular d-pad door actor.
Definition d_en_door.hpp:8
virtual void setCloseAnm() override
Sets up the door close animation.
Definition d_en_door.cpp:47
virtual void setOpenSE() override
Plays the door opening SFX.
Definition d_en_door.cpp:68
virtual void initAnm() override
Initializes the animation for the door.
Definition d_en_door.cpp:31
virtual bool isClosed() override
Checks whether the door is closed.
Definition d_en_door.cpp:72
virtual void createMdl() override
Creates the model and animation for the door.
Definition d_en_door.cpp:19
virtual void setCloseSE() override
Plays the door closed SFX.
Definition d_en_door.cpp:64
virtual void setWaitAnm() override
Stops all animations for the door.
Definition d_en_door.cpp:52
virtual void initCcData() override
Initializes collision data for the door.
Definition d_en_door.cpp:38
virtual void setOpenAnm() override
Sets up the door open animation.
Definition d_en_door.cpp:42
static dResMng_c * m_instance
The instance of this class.
Definition d_res_mng.hpp:71
virtual void setCloseMoveSE()
Plays the door closing SFX.
m3d::mdl_c mModel
The door model.
static sFStateID_c< daEnDoor_c > StateID_Wait
Waiting for players to interact with the door.
nw4r::g3d::ResFile mResFile
The resource file.
virtual void initialize()
Initializes other elements, called by create().
dHeapAllocator_c mAllocator
The allocator.
m3d::anmChr_c mAnim
The door model animation.
static void ccCallback(dCc_c *self, dCc_c *other)
Collision callback for the door.
#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
@ FORWARD_ONCE
Play the animation forward once.
Definition banm.hpp:9
@ REVERSE_ONCE
Play the animation in reverse once.
Definition banm.hpp:11
A structure that contains information about a collider.
Definition d_cc.hpp:99