1#include <game/bases/d_a_en_door.hpp>
3#include <game/bases/d_actor_manager.hpp>
4#include <game/bases/d_a_player.hpp>
5#include <game/framework/f_profile_name.hpp>
6#include <game/mLib/m_effect.hpp>
7#include <game/mLib/m_allocator_dummy_heap.hpp>
42 if (result !=
nullptr) {
57 s16 parentAngle = parent->
mAngle.
z;
58 parentAngle += 0x4000;
62 float parentAngleCos = nw4r::math::CosIdx(parentAngle);
63 float parentAngleSin = nw4r::math::SinIdx(parentAngle);
68 mPos.x = parentPos.x + ((distWithParentX * parentAngleCos) - (distWithParentY * parentAngleSin));
69 mPos.y = parentPos.y + ((distWithParentX * parentAngleSin) + (distWithParentY * parentAngleCos));
74 if (result !=
nullptr) {
83 if (parent !=
nullptr) {
96 mScale.set(1.0f, 1.0f, 1.0f);
109 u32 isRotationControlled = ACTOR_PARAM(HasParent);
115 if (isRotationControlled) {
156 if (
mAllocator.mpHeap != mAllocatorDummyHeap_c::getInstance()) {
185 daEnDoor_c *door = (daEnDoor_c *) self->
mpOwner;
187 if (otherActor->isDoorDemoEnable()) {
192 self->
mInfo |= CC_NO_HIT;
194 }
else if (door->
checkOpenOk() && otherActor->setDoorDemo(door)) {
196 self->
mInfo |= CC_NO_HIT;
212void daEnDoor_c::initializeState_Search() {}
214void daEnDoor_c::finalizeState_Search() {}
216void daEnDoor_c::executeState_Search() {
220void daEnDoor_c::initializeState_Open() {
225void daEnDoor_c::finalizeState_Open() {
229void daEnDoor_c::executeState_Open() {
232 if (!
mAnim.isStop()) {
244void daEnDoor_c::initializeState_Dummy() {
245 dAudio::g_pSndObjMap->startSound(SE_OBJ_DDOOR_OPEN,
mPos, 0);
250 mEf::createEffect(
"Wm_en_obakedoor", 0, &effPos,
nullptr,
nullptr);
251 dActorMng_c::m_instance->createUpCoin(
getCenterPos(), 0, 1, 0);
254void daEnDoor_c::finalizeState_Dummy() {}
256void daEnDoor_c::executeState_Dummy() {
260void daEnDoor_c::initializeState_Close() {
264void daEnDoor_c::finalizeState_Close() {}
266void daEnDoor_c::executeState_Close() {
270 if (!
mAnim.isStop()) {
278void daEnDoor_c::initializeState_Wait() {
284void daEnDoor_c::finalizeState_Wait() {}
286void daEnDoor_c::executeState_Wait() {
The player class for Mario, Luigi and the Toads.
bool isState(const sStateIDIf_c &other) const
Checks if the actor is currently in the given state.
sFStateStateMgr_c< dActorMultiState_c, sStateMethodUsr_FI_c, sStateMethodUsr_FI_c > mStateMgr
The state manager.
void deleteActor(u8 deleteForever)
Deletes the actor and optionally disables respawn.
u8 mExecStopMask
The mask required to disable the execute operation for the actor.
@ SKIP_NONE
No checks are skipped.
static const float smc_CULL_YLIMIT
The default max bound Y offset.
u8 mKind
The actor's kind. Value is a STAGE_ACTOR_KIND_e.
static void changePosAngle(mVec3_c *pos, mAng3_c *ang, int param3)
Adjusts the actor's position to account for looping stages.
mVec2_c mVisibleAreaSize
The size of the area inside which the actor is visible.
bool ActorScrOutCheck(u16 flags)
Checks if the actor is out of gameplay and optionally deletes it.
dActor_c()
Constructs a new actor.
@ STAGE_ACTOR_ENEMY
An enemy actor.
@ STAGE_ACTOR_PLAYER
The player actor.
static const float smc_CULL_XLIMIT
The default max bound X offset.
mVec2_c mVisibleAreaOffset
The offset applied to the area size.
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.
mVec3_c mCenterOffs
The offset from the position to the center of the actor (defaults to 0).
mVec3_c getCenterPos() const
Gets the actor's centered position.
mAng3_c mAngle
The actor's rotation (for 2D actors).
Collider ("Collision Check") class - handles collisions between actors.
dActor_c * mpOwner
The actor this collider belongs to.
u8 mInfo
Info flags for this collider. See CC_INFO_e.
virtual void changeState(const sStateIDIf_c &newState)
Changes the actor's state to the given state.
The base class for door actors.
virtual int execute() override
do method for the execute operation.
virtual void setWaitAnm()
Stops all animations for the door.
void calcMdl()
Updates mMatrix and mModel.
void allocate()
Wraps createMdl to allocate memory for the door's assets.
dActor_c * setParentInfo(u32 rotationID)
Links the door to its parent.
fBaseID_e mParentUniqueID
The unique ID of the parent actor if linked (daObjCenter_c or daObjCenter2_c).
DoorStatus_e mDoorStatus
The current status of the door.
static sFStateID_c< daEnDoor_c > StateID_Dummy
Acting as a fake Ghost House door.
virtual void setCloseMoveSE()
Plays the door closing SFX.
dActor_c * rotation_move()
Moves the door along its parent's Z angle.
virtual void setOpenAnm()
Sets up the door open animation.
m3d::mdl_c mModel
The door model.
virtual void initAnm()
Initializes the animation for the door.
virtual int doDelete() override
do method for the delete operation.
mAng mOrientation
The orientation of the door.
@ DOOR_STATUS_WAIT
The door is ready to be opened.
@ DOOR_STATUS_OPEN_IN
The door must open for players to exit it.
@ DOOR_STATUS_CLOSED
The door must close.
@ DOOR_STATUS_OPEN_OUT
The door must open for players to enter it.
virtual bool isClosed()
Checks whether the door is closed.
virtual int draw() override
do method for the draw operation.
static sFStateID_c< daEnDoor_c > StateID_Wait
Waiting for players to interact with the door.
virtual void setOpenSE()
Plays the door opening SFX.
virtual bool isDummyOpen()
Returns whether the door must act like fake Ghost House Doors.
BOOL mMayOpen
Whether the door may open.
virtual void initialize()
Initializes other elements, called by create().
u8 mRotationID
The rotation ID that links the door to the corresponding controller.
BOOL mIsOpen
Whether the door finished opening or not.
virtual void setCloseAnm()
Sets up the door close animation.
dHeapAllocator_c mAllocator
The allocator.
virtual void createMdl()
Creates the model and animation for the door.
static sFStateID_c< daEnDoor_c > StateID_Search
Searching for the parent controller actor.
virtual int create() override
do method for the create operation.
static daObjCenter2_c * searchParent_centerB(u32 rotationID)
Searches for a daObjCenter2_c with the given Rotation ID.
static sFStateID_c< daEnDoor_c > StateID_Open
Playing the open animation.
mVec3_c mDistanceToParent
The distance between the parent controller's position and the door when it spawned.
m3d::anmChr_c mAnim
The door model animation.
virtual void initCcData()
Initializes collision data for the door.
static sFStateID_c< daEnDoor_c > StateID_Close
Playing the close animation.
static daObjCenter_c * searchParent_centerA(u32 rotationID)
Searches for a daObjCenter_c with the given Rotation ID.
virtual void waitProc()
Executed every frame during the Wait state.
u8 mHasParent
Whether the door is controlled by a parent actor.
static dActor_c * searchParent(u32 rotationID)
Searches for a daObjCenter_c or daObjCenter2_c with the given Rotation ID.
bool checkOpenOk()
Checks if the door is opening for players to enter it.
virtual void setCloseSE()
Plays the door closed SFX.
static void ccCallback(dCc_c *self, dCc_c *other)
Collision callback for the door.
A controller for rotating objects around a center point.
u8 mRotationID
The rotation ID to be set on the affected objects.
A controller for swaying objects around a center point.
u8 mRotationID
The rotation ID to be set on the affected objects.
@ SUCCEEDED
The step was completed successfully.
fBaseID_e mUniqueID
The base's unique identifier.
static fBase_c * searchBaseByID(fBaseID_e id)
Searches for a base with the given ID.
static fBase_c * searchBaseByProfName(ProfileName profID, const fBase_c *parent)
Searches for a base with a given profile name, optionally under a given parent.
A three-dimensional short angle vector.
mAng y
The rotation on the Y axis.
mAng z
The rotation on the Z axis.
mAng x
The rotation on the X axis.
A three-dimensional floating point vector.
@ BASE_ID_NULL
Represents the null base.
@ GAME_HEAP_DEFAULT
The default game heap (alias of MEM1 or MEM2).
EGG::ExpHeap * g_gameHeaps[GAME_HEAP_COUNT]
The game heaps.
#define STATE_DEFINE(class, name)
Defines a state.