NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_en_noko.cpp
1#include <game/bases/d_a_en_noko.hpp>
2#include <game/bases/d_actor_manager.hpp>
3#include <game/bases/d_a_tag_wind.hpp>
5#include <game/mLib/m_allocator_dummy_heap.hpp>
6#include <game/bases/d_a_player_base.hpp>
8
9const sBcSensorPoint l_noko_head = { SENSOR_IS_POINT, 0, 0xc000 };
10const sBcSensorLine l_noko_foot = { SENSOR_IS_LINE, -0x4000, 0x4000, 0x0 };
11const sBcSensorLine l_noko_wall = { SENSOR_IS_LINE, 0x6000, 0x9000, 0x6000 };
12const sCcDatNewF l_noko_cc = {
13 0.0f, 8.0f,
14 9.0f, 8.0f,
15 CC_KIND_ENEMY,
16 CC_ATTACK_NONE,
17 BIT_FLAG(CC_KIND_PLAYER) | BIT_FLAG(CC_KIND_PLAYER_ATTACK) | BIT_FLAG(CC_KIND_YOSHI) |
18 BIT_FLAG(CC_KIND_ENEMY) | BIT_FLAG(CC_KIND_TAMA),
19 (u32) ~BIT_FLAG(CC_ATTACK_NONE) & ~BIT_FLAG(CC_ATTACK_YOSHI_MOUTH) & ~BIT_FLAG(CC_ATTACK_SPIN_LIFT_UP) & ~BIT_FLAG(CC_ATTACK_SAND_PILLAR),
20 CC_STATUS_NONE,
21 dEn_c::normal_collcheck
22};
23
24const float l_walk_speed[2] = { 0.5f, -0.5f };
25const s16 l_turn_speed[2] = { ANGLE_360_DIV(32), -ANGLE_360_DIV(32) };
26const s16 l_turn_target_angle[2] = { DEG_TO_ANGLE(90), -DEG_TO_ANGLE(90) };
27
28STATE_DEFINE(daEnNoko_c, BlockAppear);
31STATE_DEFINE(daEnNoko_c, WindTurn);
32STATE_DEFINE(daEnNoko_c, SpitOut_Ready);
33STATE_DEFINE(daEnNoko_c, BgmDance);
34STATE_DEFINE(daEnNoko_c, BgmDanceEd);
37
38ACTOR_PROFILE(EN_NOKONOKO, daEnNoko_c, 0x12);
39
41 mNokoType = ACTOR_PARAM(NokoType);
42
43 createModel();
44 createShell("nokonokoA", "g3d/nokonokoA.brres", "nokonoko_shell", "Tnokonoko_shell", mNokoType);
45 mScale.set(1.0f, 1.0f, 1.0f);
46 mCenterOffs.set(0.0f, 8.0f, 0.0);
47 mVisibleAreaOffset.set(0.0f, 16.0f);
48 mVisibleAreaSize.set(28.0f, 32.0f);
49 mNokoModel.setCallback(&mMdlCallback);
51
52 u8 dir = getPl_LRflag(mPos);
53 mDirection = dir;
54 mAmiLayer = ACTOR_PARAM(SubLayer);
55 mAngle.y = l_turn_target_angle[dir];
57 mFlags |= dEn_c::EN_FLAG_16;
58 mPos.z = l_Ami_Zpos[ACTOR_PARAM(SubLayer)];
59
60 mNokoAnimTex.setPlayMode(m3d::FORWARD_ONCE, 0);
61 mNokoModel.setAnm(mNokoAnimTex, 0.0f);
62 mNokoAnimTex.setFrame(mNokoType, 0);
63 mNokoAnimTex.setRate(0.0f, 0);
64
65 mSensorHead = l_noko_head;
66 mSensorWall = l_noko_wall;
67 mSensorFootNormal = l_noko_foot;
68
69 mCcData.set(l_noko_cc);
70 mCc.set(this, &mCcData, l_Ami_Line[mAmiLayer]);
71 mCc.entry();
72
73 mBaseZPos = dActorMng_c::m_instance->mGoombaZOrderThing * 16.0f;
74 dActorMng_c::m_instance->mGoombaZOrderThing = (dActorMng_c::m_instance->mGoombaZOrderThing + 1) & 0xF;
75
77
78 mBc.set(this, mSensorFootNormal, mSensorHead, mSensorWall);
79 mBc.m_4c = mPos.x;
80
81 return SUCCEEDED;
82}
83
84void daEnNoko_c::createModel() {
85 mNokoAllocator.createFrmHeap(-1, mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT], nullptr, 0x20);
86
87 mNokoResFile = dResMng_c::m_instance->getRes("nokonokoA", "g3d/nokonokoA.brres");
88
89 nw4r::g3d::ResMdl mdl = mNokoResFile.GetResMdl("nokonokoA");
90 mNokoModel.create(mdl, &mNokoAllocator, nw4r::g3d::ScnMdl::BUFFER_RESMATMISC | nw4r::g3d::ScnMdl::BUFFER_RESTEXOBJ | nw4r::g3d::ScnMdl::BUFFER_RESTLUTOBJ, 1, nullptr);
92
93 nw4r::g3d::ResAnmChr anm = mNokoResFile.GetResAnmChr("walkA");
94 mWalkAnim.create(mdl, anm, &mNokoAllocator, nullptr);
95 mNokoResAnmTex = mNokoResFile.GetResAnmTexPat("nokonokoA");
96 mNokoAnimTex.create(mdl, mNokoResAnmTex, &mNokoAllocator, nullptr, 1);
97
99
100 mNokoAllocator.adjustFrmHeap();
101
103}
104
107 if (ACTOR_PARAM(SpawnMode) == SPAWN_MODE_SLEEP) {
108 mSpeed.y = 0.0f;
110 } else if (ACTOR_PARAM(BlockAppear)) {
112 } else if (ACTOR_PARAM(SpitOut)) {
114 } else {
116 }
117}
118
120 if (dEn_c::preExecute() == NOT_READY) {
121 return NOT_READY;
122 }
123
124 if (canDance()) {
125 if (dAudio::isBgmAccentSign(BIT_FLAG(1))) {
126 danceWithMove(BGM_anim_walkA_1);
127 } else if (dAudio::isBgmAccentSign(BIT_FLAG(2))) {
128 danceWithMove(BGM_anim_walkA_2);
129 } else if (dAudio::isBgmAccentSign(BIT_FLAG(3))) {
130 danceWithMove(BGM_anim_walkA_3);
131 }
132 }
133
134 return SUCCEEDED;
135}
136
138 mStateMgr.executeState();
139
140 if (cullCheck()) {
141 return SUCCEEDED;
142 }
143
145 mHeadAngle = 0;
146 } else {
147 walkTurn();
148 }
149
150 if (!mNoRespawn && !isState(StateID_Ice)) {
151 updateAmiLine();
152 setZPos();
153 if (checkRyusa()) {
154 ryusaEffect();
155 }
156 }
157
158 return SUCCEEDED;
159}
160
162 if (mShellMode == SHELL_MODE_BASE) {
163 return drawShell();
164 }
165
167 drawShell();
168 }
169
170 mNokoModel.entry();
171 return SUCCEEDED;
172}
173
175 if (mNokoAllocator.mpHeap != mAllocatorDummyHeap_c::getInstance()) {
176 mWalkAnim.remove();
177 mNokoModel.remove();
178 mNokoAnimTex.remove();
180 }
181
182 return SUCCEEDED;
183}
184
186 if (mBc.isFoot()) {
187 mVec3_c pos = getCenterPos();
188 u32 type = dBc_c::getUnitType(pos.x, pos.y, mLayer);
189 u8 kind = dBc_c::getUnitKind(pos.x, pos.y, mLayer) >> 16;
190
191 if (type & BIT_FLAG(15) && kind == 3) {
192 return true;
193 }
194 }
195
196 return false;
197}
198
200 mVec3_c center = getCenterPos();
201 mVec3_c efPos(center.x, center.y, 5500.0f);
202 mQuicksandEffect.createEffect("Wm_en_quicksand", 0, &efPos, nullptr, nullptr);
203}
204
205bool daEnNoko_c::canDance() {
206 if (
212 ) {
213 return true;
214 }
215
216 return false;
217}
218
219void daEnNoko_c::danceWithMove(int move) {
220 mDanceMove = move;
222}
223
224void daEnNoko_c::calcMdl() {
225 calcShellMdl();
226 mVec3_c pos = getPos();
227 mAng3_c angle = mAngle;
228 changePosAngle(&pos, &angle, 1);
229
230 mMatrix.trans(pos);
231 mMatrix.ZXYrotM(angle);
232
233 mNokoModel.setLocalMtx(&mMatrix);
234
235 mNokoModel.setScale(mBoyoMng.getScale());
236 mNokoModel.calc(false);
237}
238
239void daEnNoko_c::calcShellEffectPos() {
240 m3d::mdl_c &model = mModel;
241 nw4r::g3d::ResMdl resMdl = model.getResMdl();
242 nw4r::g3d::ResNode resNode = resMdl.GetResNode("nokonoko_shell_model");
243
244 mMtx_c matrix;
245 model.getNodeWorldMtx(resNode.GetID(), &matrix);
246 matrix.multVecZero(mSlideEffectPos);
247 if (mIsFlipped) {
248 mSlideEffectPos.y -= 16.0f;
249 }
250}
251
252bool daEnNoko_c::setPlayerDamage(dActor_c *actor) {
253 daPlBase_c *player = (daPlBase_c *) actor;
254
255 if (player->setDamage(this, daPlBase_c::DAMAGE_DEFAULT) && isWalking()) {
256 playerDamageTurn(actor);
257 return true;
258 }
259
260 return false;
261}
262
264 u8 dir = dActor_c::getTrgToSrcDir_Main(actor->getCenterX(), getCenterX());
265 u8 mode = mShellMode;
266
267 if (mDirection == dir || mode == SHELL_MODE_BASE) {
268 return false;
269 }
270
271 mDirection = dir;
272 mAngle.y = l_turn_target_angle[dir];
273 mHeadAngle *= -1;
274 turnAround();
275
276 return true;
277}
278
280 mSensorHead = l_noko_head;
281 mSensorWall = l_noko_wall;
282 mSensorFootNormal = l_noko_foot;
283 mBc.set(this, mSensorFootNormal, mSensorHead, mSensorWall);
284}
285
286void daEnNoko_c::turnAround() {
287 if (isState(StateID_Turn)) {
289 } else {
290 mSpeed.x = -mSpeed.x;
291 }
292}
293
294bool daEnNoko_c::turnProc() {
295 int turnDir;
296 s16 turnSpeed;
297 doTurn(&turnDir, &turnSpeed);
298 mAngle.y += turnSpeed;
299
300 mAng target = l_turn_target_angle[turnDir];
301 if (mAngle.y.abs() >= target.abs()) {
302 mAngle.y = target;
303 return true;
304 }
305
306 return false;
307}
308
309void daEnNoko_c::doTurn(int *dir, s16 *turnSpeed) {
310 *dir = mDirection;
311 *turnSpeed = l_turn_speed[*dir];
312}
313
314void daEnNoko_c::setZPos() {
315 if (mLayer == LAYER_1) {
316 mPos.z = mBaseZPos + l_Ami_Zpos[mAmiLayer];
317 } else {
318 mPos.z = -2500.0f;
319 }
320}
321
322void daEnNoko_c::updateAmiLine() {
323 float width = mCc.mCcData.mBase.mSize.x;
324 float offX = mCc.mCcData.mBase.mOffset.x;
325 float offY = mCc.mCcData.mBase.mOffset.y;
326
327 float x = mPos.x + offX;
328 float y = mPos.y + offY;
329
330 u32 typeRight = dBc_c::getUnitType(x + width, y, mLayer);
331 u8 kindRight = dBc_c::getUnitKind(x + width, y, mLayer) & 0xFF;
332 u32 typeLeft = dBc_c::getUnitType(x - width, y, mLayer);
333 u8 kindLeft = dBc_c::getUnitKind(x - width, y, mLayer) & 0xFF;
334
335 if (
336 typeRight & BIT_FLAG(10) && kindRight >= 2 ||
337 typeLeft & BIT_FLAG(10) && kindLeft >= 2
338 ) {
339 if (mAmiLayer == 0) {
340 mCc.mAmiLine = 1;
341 } else {
342 mCc.mAmiLine = 2;
343 }
344 } else {
345 mCc.mAmiLine = 3;
346 }
347}
348
349void daEnNoko_c::walkTurn() {
350 static const s16 sc_walkAngle[2] = { -DEG_TO_ANGLE(30), DEG_TO_ANGLE(30) };
351 sLib::chaseAngle(&mHeadAngle, sc_walkAngle[mDirection], ANGLE_360_DIV(64));
352}
353
354bool daEnNoko_c::createIceActor() {
355 static const int sc_iceMode[2] = { 0, 1 };
356 static const float cs_iceOffsetY[2] = { -2.0f, -4.0f };
357
358 int iceMode;
359 mVec3_c icePos;
360 mVec3_c iceSize;
361 if (*mStateMgr.getMainStateID() == StateID_BgmDance) {
362 icePos.set(mPos.x, mPos.y - 4.0f, mPos.z + 2.0f);
363 iceMode = 1;
364 iceSize.set(1.05f, 1.0f, 1.75f);
365 } else {
366 iceMode = sc_iceMode[mShellMode];
367 icePos.set(mPos.x, mPos.y + cs_iceOffsetY[mShellMode], mPos.z);
368 iceSize.set(1.05f, 1.0f, 1.05f);
369 }
370
371 dIceInfo iceInfo[] = {
372 {
373 iceMode,
374 icePos,
375 iceSize
376 }
377 };
378
379 return mIceMng.createIce(iceInfo, ARRAY_SIZE(iceInfo));
380}
381
382bool daEnNoko_c::checkSleep() {
383 if (ACTOR_PARAM(SpawnMode) == SPAWN_MODE_SLEEP) {
384 return false;
385 }
386
387 return daEnShell_c::checkSleep();
388}
389
390void daEnNoko_c::beginFunsui() {
391 if (isState(StateID_Carry) || isState(StateID_Ice)) {
392 return;
393 }
394
395 mIsFunsui = true;
397 mSpeed.set(0.0f, 0.0f, 0.0f);
398
399 if (mShellMode == SHELL_MODE_BASE) {
401 } else {
402 mWalkAnim.setRate(2.0f);
403 }
404}
405
406void daEnNoko_c::endFunsui() {
407 mIsFunsui = false;
408
409 if (mShellMode != SHELL_MODE_BASE) {
410 mWalkAnim.setRate(1.0f);
412 }
413}
414
415float daEnNoko_c::getWindStrength() {
416 daTagWind_c *tagWind = (daTagWind_c *) fManager_c::searchBaseByProfName(fProfile::TAG_WIND, nullptr);
417
418 if (tagWind == nullptr) {
419 return 0.0f;
420 }
421
422 return tagWind->mStrength;
423}
424
425void daEnNoko_c::setMoveAnimation(const char *name, m3d::playMode_e mode, float frame) {
426 mWalkAnim.setAnm(mNokoModel, mNokoResFile.GetResAnmChr(name), mode);
427 mNokoModel.setAnm(mWalkAnim, frame);
428}
429
430void daEnNoko_c::setBaseAnimation(const char *name, m3d::playMode_e mode, float frame) {
431 mAnim.setAnm(mModel, mResFile.GetResAnmChr(name), mode);
432 mModel.setAnm(mAnim, frame);
433}
434
436 static const float sc_offsetX[2] = { 2.5f, -2.5f };
437
438 mVec3_c pos(mPos.x + sc_offsetX[mDirection], mPos.y + 4.0f, mPos.z);
439 u8 kind = dBc_c::getUnitKind(pos.x, mPos.y - 2.0f, mLayer) >> 16;
440
441 if (kind == 8) {
442 return false;
443 }
444
445 float height = 0.0f;
446 if (dBc_c::checkGround(&pos, &height, mLayer, 1, -1) && height < pos.y && height > mPos.y - 5.0f) {
447 return true;
448 }
449
450 return false;
451}
452
453void daEnNoko_c::landEffect() {
454 mVec3_c pos = mVec3_c(mPos.x, mPos.y, 5500.0f);
455
456 if (mBc.getFootAttr() == 12) {
457 mEf::createEffect("Wm_en_sndlandsmk_s", 0, &pos, nullptr, nullptr);
458 } else {
459 mEf::createEffect("Wm_en_landsmoke_s", 0, &pos, nullptr, nullptr);
460 }
461}
462
463void daEnNoko_c::initializeState_Walk() {
464 if (
465 *mStateMgr.getOldStateID() != StateID_Turn &&
466 *mStateMgr.getOldStateID() != StateID_Walk &&
467 *mStateMgr.getOldStateID() != StateID_WindTurn &&
469 ) {
470 setMoveAnimation("walkA", m3d::FORWARD_LOOP, 1.0f);
471 }
472
473 mShellMode = SHELL_MODE_NOKO_WALK;
474 mAccelY = -0.1875f;
475 mAccelF = 0.05f;
476 mSpeedMax.set(l_walk_speed[mDirection], -4.0f, 0.0f);
477 mSensorFootNormal = l_noko_foot;
478 mSpeed.x = l_walk_speed[mDirection];
479 m_8c8 = 0;
480}
481
482void daEnNoko_c::finalizeState_Walk() {}
483
484void daEnNoko_c::executeState_Walk() {
485 mNokoModel.play();
486
487 float wind = getWindStrength();
488 if (std::fabs(wind) > 0.475f) {
489 if (l_EnMuki[mDirection] * wind >= 0.0f) {
491 return;
492 } else {
493 mSpeedMax.x = 0.0f;
494 }
495 } else {
496 mSpeedMax.x = l_walk_speed[mDirection];
497 }
498
499 calcSpeedX();
500 calcSpeedY();
501 posMove();
502
503 u32 prevFoot = mBc.isFoot();
504 EnBgCheck();
505 if (mBc.isFoot()) {
506 mSpeed.y = 0.0f;
507 if (mNokoType == NOKO_RED && !checkLedge()) {
509 return;
510 }
511 } else if (prevFoot && !mInLiquid && (mSpeed.y <= 0.0f)) {
512 mFootPush2.x += m_1eb.x;
513 }
514
515 if (mBc.isWall(mDirection)) {
517 }
518}
519
520void daEnNoko_c::initializeState_Wakeup() {
521 setMoveAnimation("revival", m3d::FORWARD_ONCE, 0.0f);
522 setBaseAnimation("revival_shell", m3d::FORWARD_ONCE, 0.0f);
523 mShellMode = SHELL_MODE_NOKO_WALK;
524
525 daEnShell_c::initializeState_Wakeup();
526}
527
528void daEnNoko_c::finalizeState_Wakeup() {
529 mAnim.setFrame(0.0f);
530 mCc.mCcData.mBase.mOffset.x = 0.0f;
531 mCc.mCcData.mBase.mSize.x = 8.0f;
532}
533
534void daEnNoko_c::executeState_Wakeup() {
535 mNokoModel.play();
536 mModel.play();
537 calcSpeedY();
538 posMove();
539
540 u32 bgCheck = EnBgCheck();
541 if (bgCheck & 1) {
542 mSpeed.y = 0.0f;
543 }
544 if (bgCheck & 4) {
545 mSpeed.x = 0.0f;
546 }
547
548 if (mWalkAnim.isStop()) {
550 }
551}
552
553void daEnNoko_c::initializeState_WakeupTurn() {
554 setMoveAnimation("walkA", m3d::FORWARD_LOOP, 1.0f);
555 daEnShell_c::initializeState_WakeupTurn();
556}
557
558void daEnNoko_c::finalizeState_WakeupTurn() {
559 daEnShell_c::finalizeState_WakeupTurn();
560}
561
562void daEnNoko_c::executeState_WakeupTurn() {
563 mNokoModel.play();
564 daEnShell_c::executeState_WakeupTurn();
565}
566
567void daEnNoko_c::initializeState_Turn() {
568 mDirection ^= 1;
569 mSpeed.x = 0.0f;
570 mSpeedMax.set(0.0f, -4.0f, 0.0f);
571}
572
573void daEnNoko_c::finalizeState_Turn() {}
574
575void daEnNoko_c::executeState_Turn() {
576 mNokoModel.play();
577 calcSpeedY();
578 posMove();
579
580 if (EnBgCheck() & 1) {
581 mSpeed.y = 0.0f;
582 }
583
584 WaterCheck(mPos, 1.0f);
585 if (turnProc()) {
587 }
588}
589
590void daEnNoko_c::initializeState_WindTurn() {
591 mDirection ^= 1;
592 mSpeed.x = 0.0f;
593 mSpeedMax.set(0.0f, -4.0f, 0.0f);
594}
595
596void daEnNoko_c::finalizeState_WindTurn() {}
597
598void daEnNoko_c::executeState_WindTurn() {
599 mNokoModel.play();
600 calcSpeedY();
601 posMove();
602
603 if (EnBgCheck() & 1) {
604 mSpeed.y = 0.0f;
605 }
606
607 turnProc();
608
609 if (std::fabs(getWindStrength()) < 0.25f) {
611 }
612}
613
614void daEnNoko_c::initializeState_BlockAppear() {
615 setMoveAnimation("walkA", m3d::FORWARD_LOOP, 1.0f);
616 mTimer1 = 40;
617 mCc.release();
618}
619
620void daEnNoko_c::finalizeState_BlockAppear() {
621 mCc.entry();
622}
623
624void daEnNoko_c::executeState_BlockAppear() {
625 if (mTimer1 == 0) {
627 }
628}
629
630void daEnNoko_c::initializeState_SpitOut_Ready() {
631 mNoHitPlayer.mTimer[ACTOR_PARAM(BlockHitPlayer)] = 16;
632}
633
634void daEnNoko_c::finalizeState_SpitOut_Ready() { }
635
636void daEnNoko_c::executeState_SpitOut_Ready() {
637 if (mEatenByID == BASE_ID_NULL) {
638 return;
639 }
640
642 if (eatActor == nullptr) {
644 } else {
645 setSlideThrowSpeed(eatActor);
646 mPlayerNo = eatActor->getPlrNo();
648 }
649}
650
651void daEnNoko_c::initializeState_BgmDance() {
652 static const char *sc_bgmDanceAnim[DANCE_MOVE_COUNT] = {
653 "BGM_anim_walkA_1",
654 "BGM_anim_walkA_1",
655 "BGM_anim_walkA_3",
656 };
657
658 setMoveAnimation(sc_bgmDanceAnim[mDanceMove], m3d::FORWARD_ONCE, 3.0f);
659 mSpeed.x = 0.0;
660 mDanceTimer = 3;
662}
663
664void daEnNoko_c::finalizeState_BgmDance() {}
665
666void daEnNoko_c::executeState_BgmDance() {
667 mNokoModel.play();
668 calcSpeedY();
669 posMove();
670
671 if (EnBgCheck() & 1) {
672 mSpeed.y = 0.0f;
673 }
674
675 if (mDanceTimer > 0) {
676 mDanceTimer--;
678 } else {
679 mAngle.y = 0;
680 }
681
682 if (mWalkAnim.isStop()) {
684 }
685}
686
687void daEnNoko_c::initializeState_BgmDanceEd() {
688 setMoveAnimation("walkA", m3d::FORWARD_ONCE, 4.0f);
689 mSpeed.x = 0.0f;
690 mDanceTimer = 4;
691 mBgmDanceRotSpeed = abs(l_turn_target_angle[mDirection]) / mDanceTimer;
692}
693
694void daEnNoko_c::finalizeState_BgmDanceEd() {}
695
696void daEnNoko_c::executeState_BgmDanceEd() {
697 mNokoModel.play();
698 calcSpeedY();
699 posMove();
700
701 if (EnBgCheck() & 1) {
702 mSpeed.y = 0.0;
703 }
704
705 if (mDanceTimer > 0) {
706 mDanceTimer--;
707 sLib::chaseAngle(&mAngle.y.mAngle, l_turn_target_angle[mDirection], mBgmDanceRotSpeed);
708
709 if (mDanceTimer <= 0) {
710 mAngle.y = l_turn_target_angle[mDirection];
712 }
713 }
714}
715
716void daEnNoko_c::nodeCallback_c::timingB(ulong nodeId, nw4r::g3d::WorldMtxManip *manip, nw4r::g3d::ResMdl resMdl) {
717 mMtx_c mtx;
718 if (strcmp(resMdl.GetResNode(nodeId).GetName(), "head") == 0) {
719 manip->GetMatrix(&mtx);
720 mtx.XrotM(mpOwner->mHeadAngle);
721 manip->SetMatrix(mtx);
722 }
723}
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.
The minimum required implementation for a stage actor.
Definition d_actor.hpp:15
fBaseID_e mEatenByID
The unique identifier of the eating actor.
Definition d_actor.hpp:364
virtual s8 & getPlrNo()
Gets the player number associated with the actor. See mPlayerNo.
Definition d_actor.hpp:105
bool mNoRespawn
Whether the actor should not respawn after being deleted.
Definition d_actor.hpp:378
dBc_c mBc
The actor-to-tile collision sensor.
Definition d_actor.hpp:342
static bool getTrgToSrcDir_Main(float trgX, float srcX)
See getTrgToSrcDirFunc.
Definition d_actor.cpp:276
static void setSoftLight_Enemy(m3d::bmdl_c &mdl)
Sets the soft light effect for enemies.
Definition d_actor.cpp:325
void clrComboCnt()
Clears the actor's combo counter.
Definition d_actor.cpp:727
mVec2_c m_1eb
Definition d_actor.hpp:345
static void changePosAngle(mVec3_c *pos, mAng3_c *ang, int param3)
Adjusts the actor's position to account for looping stages.
Definition d_actor.cpp:297
u8 mAmiLayer
The actor's layer for chainlink fences.
Definition d_actor.hpp:379
u8 mDirection
The actor's facing direction.
Definition d_actor.hpp:351
dCc_c mCc
The actor-to-actor collision sensor.
Definition d_actor.hpp:341
mVec2_c mVisibleAreaSize
The size of the area inside which the actor is visible.
Definition d_actor.hpp:347
s8 mPlayerNo
The player associated with the actor, -1 if not associated to any player.
Definition d_actor.hpp:375
dActor_c()
Constructs a new actor.
Definition d_actor.cpp:46
u8 mLayer
The actor's layer.
Definition d_actor.hpp:377
mVec2_c mVisibleAreaOffset
The offset applied to the area size.
Definition d_actor.hpp:348
mMtx_c mMatrix
The actor's partial transformation matrix. See makeMtx() for details.
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 mPos
The actor's position.
mVec3_c mSpeedMax
The actor's maximum speed.
void calcSpeedX()
Updates the actor's X speed. See here for details.
mVec3_c mCenterOffs
The offset from the position to the center of the actor (defaults to 0).
void posMove()
Moves the actor by its speed.
mVec3_c getCenterPos() const
Gets the actor's centered position.
mAng3_c mAngle
The actor's rotation (for 2D actors).
float mAccelY
The actor's vertical acceleration.
void calcSpeedY()
Updates the actor's Y speed. See here for details.
bool getPl_LRflag(const mVec3_c &pos)
Checks whether the nearest player is to the left of pos.
Definition d_enemy.cpp:398
void WaterCheck(mVec3_c &pos, float h)
Definition d_enemy.cpp:729
dIceMng_c mIceMng
The ice manager for this enemy.
Definition d_enemy.hpp:285
u16 mTimer1
[Used in EN_HATENA_BALLON, for example]
Definition d_enemy.hpp:290
virtual void changeState(const sStateIDIf_c &newState)
Changes the actor's state to the given state.
virtual int preExecute()
pre method for the execute operation.
Definition d_enemy.cpp:63
dPlayerDownTimer_c mNoHitPlayer
Hit cooldown timers for each player. This is used to prevent, for example, a thrown shell from hittin...
Definition d_enemy.hpp:296
u32 mFlags
Flags for this actor. See FLAGS_e.
Definition d_enemy.hpp:289
bool mInLiquid
Whether the enemy is in a liquid.
Definition d_enemy.hpp:281
static dResMng_c * m_instance
The instance of this class.
Definition d_res_mng.hpp:61
static sFStateVirtualID_c< daEnCarry_c > StateID_Carry
The enemy is being carried.
Koopa Troopa.
static sFStateID_c< daEnNoko_c > StateID_Walk
Walking on the ground.
int mDanceTimer
Timer for starting and ending the dance.
@ BGM_anim_walkA_2
Actually uses the same animation as BGM_anim_walkA_1.
nw4r::g3d::ResAnmTexPat mNokoResAnmTex
The animated texture resource of the Koopa.
bool checkRyusa()
Checks if the actor is inside quicksand.
static sFStateID_c< daEnNoko_c > StateID_WindTurn
Being turned around by the wind.
mVec3_c mCreatePos
The position where the Koopa was spawned.
float mXSpeedBeforeFunsui
The horizontal speed of the Koopa before being blown by a fountain.
m3d::anmChr_c mWalkAnim
The walk animation of the Koopa.
@ NOKO_RED
Red Koopas turn around on ledges.
static sFStateID_c< daEnNoko_c > StateID_SpitOut_Ready
About to be spit out by Yoshi.
u8 mNokoType
Is a NOKO_TYPE_e.
void ryusaEffect()
Creates the quicksand effect.
static sFStateID_c< daEnNoko_c > StateID_BgmDanceEd
Returning from a dance move to walking.
int execute() override
do method for the execute operation.
m3d::mdl_c mNokoModel
The model of the Koopa.
int preExecute() override
pre method for the execute operation.
static sFStateID_c< daEnNoko_c > StateID_BlockAppear
Spawning from a block.
m3d::anmTexPat_c mNokoAnimTex
The animated texture of the Koopa.
int draw() override
do method for the draw operation.
static sFStateID_c< daEnNoko_c > StateID_BgmDance
Doing a dance move to the background music.
virtual void deleteResExtra()
Subclasses can override this function to delete additional resources.
BOOL mIsFunsui
Whether the Koopa is being blown upwards by a fountain.
u32 mDanceMove
The dance move to perform.
virtual void createModelExtra()
Subclasses can override this function to create additional models.
bool playerDamageTurn(dActor_c *)
Returns whether the Koopa should turn around after damaging the player.
bool checkLedge()
Checks if there is a ledge in front of the Koopa.
dHeapAllocator_c mNokoAllocator
The allocator used for the resources of this actor.
static sFStateID_c< daEnNoko_c > StateID_Turn
Turning around while walking.
void setNokoBc()
Reverts the collision to a regular Koopa.
virtual void setInitialState()
Initializes the state of the Koopa after creation.
int doDelete() override
do method for the delete operation.
nw4r::g3d::ResFile mNokoResFile
The resource file containing the resources of this actor.
int create() override
do method for the create operation.
mAng mBgmDanceRotSpeed
The rotation speed for turning toward the target rotation for a dance.
bool mIsFlipped
Whether the shell is flipped upside down from a block hit.
static sFStateVirtualID_c< daEnShell_c > StateID_Wakeup
Waking up from the sleep state.
static sFStateVirtualID_c< daEnShell_c > StateID_Slide
Sliding across the ground after being kicked.
static sFStateVirtualID_c< daEnShell_c > StateID_Sleep
Remaining stationary after being jumped on.
void createShell(const char *arcName, const char *resPath, const char *modelName, const char *anmTexName, float animFrame)
Loads the resources for the shell model and animation.
static sFStateVirtualID_c< daEnShell_c > StateID_WakeupTurn
Turning around after waking up.
void deleteRequest()
Requests deletion of the base.
Definition f_base.cpp:289
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:45
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:46
static fBase_c * searchBaseByID(fBaseID_e id)
Searches for a base with the given ID.
Definition f_manager.cpp:18
static fBase_c * searchBaseByProfName(ProfileName profID, const fBase_c *parent)
Searches for a base with a given profile name, optionally under a given parent.
Definition f_manager.cpp:26
void multVecZero(nw4r::math::VEC3 &out) const
Extracts the translation vector from the matrix.
Definition m_mtx.cpp:135
void XrotM(mAng angle)
Rotates the matrix on the X axis by the given angle.
Definition m_mtx.cpp:41
A three-dimensional floating point vector.
Definition m_vec.hpp:122
const u8 l_Ami_Line[]
The sub-layer for each side of chainlink fences.
Definition d_actor.cpp:38
const float l_Ami_Zpos[]
The additional Z offset for each side of chainlink fences.
Definition d_actor.cpp:39
@ BASE_ID_NULL
Represents the null base.
Definition f_base_id.hpp:7
#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
@ FORWARD_LOOP
Play the animation forward in a loop.
Definition banm.hpp:8
@ 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
BOOL chaseAngle(s16 *value, s16 target, s16 step)
Moves value towards target by a fixed step amount.
Definition s_lib.cpp:135
#define STATE_DEFINE(class, name)
Defines a state.
Definition s_State.hpp:36
#define STATE_VIRTUAL_DEFINE(class, name)
Defines a virtual state.
Definition s_State.hpp:46
A structure that contains information about a collider.
Definition d_cc.hpp:98