NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_actor.cpp
Go to the documentation of this file.
1#include <game/bases/d_actor.hpp>
2#include <game/bases/d_a_player_manager.hpp>
3#include <game/bases/d_a_yoshi.hpp>
4#include <game/bases/d_attention.hpp>
6#include <game/bases/d_bg.hpp>
7#include <game/bases/d_cd.hpp>
8#include <game/bases/d_eff_actor_manager.hpp>
9#include <game/bases/d_fukidashi_manager.hpp>
10#include <game/bases/d_game_com.hpp>
11#include <game/bases/d_info.hpp>
12#include <game/bases/d_multi_manager.hpp>
13#include <game/bases/d_s_stage.hpp>
14#include <game/bases/d_score_manager.hpp>
15#include <game/bases/d_SmallScore.hpp>
16#include <game/mLib/m_effect.hpp>
17#include <lib/nw4r/g3d/scn_mdl.hpp>
18#include <constants/sjis_constants.h>
20/// @file
21
28
29const float dActor_c::smc_CULL_XLIMIT = 80.0f;
30const float dActor_c::smc_CULL_YLIMIT = 256.0f;
31const float dActor_c::smc_CULL_AREA_XLIMIT = 128.0f;
32const float dActor_c::smc_CULL_AREA_YLIMIT = 128.0f;
33
35
37
38const u8 l_Ami_Line[] = { 1, 2 };
39const float l_Ami_Zpos[] = { 1500.0f, -2500.0f };
40
45
47 m_00(0), mCarryFukidashiPlayerNo(-1), m_17(0), m_1b(1.0f),
48 mVisibleAreaSize(0.0f, 0.0f), mVisibleAreaOffset(0.0f, 0.0f),
49 mMaxBound(0.0f, 0.0f, 0.0f, 0.0f),
50 mpSpawnFlags(nullptr), mpDeleteVal(nullptr),
53 mNoRespawn(false) {
54
56
57 mExecStopMask = 1;
58
59 setDefaultMaxBound();
60 mDestroyBound = mBoundBox(256.0f, 256.0f, 80.0f, 80.0f);
61
62 dCdFile_c *file = dCd_c::m_instance->getFileP(dScStage_c::m_instance->mCurrCourse);
63 mAreaNo = file->getAreaNo(&mPos);
64
65 mBc.mpRc = &mRc;
66 mRc.set(this, 1);
67 mRc.mpBc = &mBc;
68
71
73 mCc.mLayer = mLayer;
74 mBc.mLayer = mLayer;
75 mRc.mLayer = mLayer;
76
78 mBlockHit = false;
79}
80
82 mCc.release();
83}
84
88
92
95 return NOT_READY;
96 }
98 return SUCCEEDED;
99}
100
104
107 return NOT_READY;
108 }
110 return NOT_READY;
111 }
112 if (mExecStop & mExecStopMask) {
113 return NOT_READY;
114 }
115 mRc.clrLink();
116 if (mBlockHit == true) {
117 mBlockHit = false;
119 }
120 return SUCCEEDED;
121}
122
124 if (status == SUCCESS) {
125 if (!(mActorProperties & 0x400)) {
126 mPos.x = dScStage_c::getLoopPosX(mPos.x);
127 }
128 mCc.clear();
129 if (!mDeleteRequested) {
130 mBc.checkLink();
131 mRc.chkLink();
132 }
133 if (mActorProperties & 0x8) {
134 dAttention_c::mspInstance->entry(mUniqueID);
135 }
136 m_1eb.set(0.0f, 0.0f);
137 }
139}
140
142 if (dBaseActor_c::preDraw() == NOT_READY || (mDrawStop & getKindMask()) != 0) {
143 return NOT_READY;
144 }
145 if (mEatState == EAT_STATE_EATEN) {
146 return NOT_READY;
147 }
148 if ((mActorProperties & 2) && ActorDrawCullCheck()) {
149 return NOT_READY;
150 }
151 return SUCCEEDED;
152}
153
157
158const char *dActor_c::getKindString() const {
159 return D_ACTOR_KIND_STRING;
160}
161
163 m_tmpCtLayerNo = layer;
164 return;
165}
166
167dActor_c *dActor_c::construct(ProfileName profName, unsigned long param, const mVec3_c *position, const mAng3_c *rotation, u8 layer) {
168 setTmpCtData(layer);
169 return (dActor_c *) dBaseActor_c::construct(profName, param, position, rotation);
170}
171
172dActor_c *dActor_c::construct(ProfileName profName, dBase_c *parent, unsigned long param, const mVec3_c *position, const mAng3_c *rotation, u8 layer) {
173 setTmpCtData(layer);
174 return (dActor_c *) dBaseActor_c::construct(profName, parent, param, position, rotation);
175}
176
177void dActor_c::setKind(u8 kind) {
178 mKind = kind;
180}
181
183 static const searchNearPlayerFunc searchFunc[dScStage_c::LOOP_COUNT] = {
187 };
188 mSearchNearPlayerFunc = searchFunc[loopType];
189}
190
192 mVec3_c centerPos = getCenterPos();
193 return searchNearPlayer_Main(delta, mVec2_c(centerPos.x, centerPos.y));
194}
195
197 return mSearchNearPlayerFunc(delta, pos);
198}
199
201 dAcPy_c *closestPlayer = nullptr;
202 float closestDist = 1e9;
203 for (int i = 0; i < 4; i++) {
204 dAcPy_c *player = daPyMng_c::getPlayer(i);
205 if (player == nullptr || !daPyMng_c::checkPlayer(i)) {
206 continue;
207 }
208
209 float xDiff = player->mPos.x + player->mCenterOffs.x - pos.x;
210 float yDiff = player->mPos.y + player->mCenterOffs.y - pos.y;
211 float dist = xDiff * xDiff + yDiff * yDiff;
212
213 if (closestDist > dist) {
214 delta.set(xDiff, yDiff);
215 closestPlayer = player;
216 closestDist = dist;
217 }
218 }
219 return closestPlayer;
220}
221
223 dAcPy_c *closestPlayer = nullptr;
224
225 float loopOffset = dBg_c::m_bg_p->mLoopOffset;
226
227 mVec2_c loopPos;
228 loopPos.x = dScStage_c::getLoopPosX(pos.x);
229 loopPos.y = pos.y;
230 float closestDist = 1e9;
231
232 dAcPy_c *player;
233 for (int i = 0; i < 4; i++) {
234 if ((player = daPyMng_c::getPlayer(i)) == nullptr || !daPyMng_c::checkPlayer(i)) {
235 continue;
236 }
237
238 mVec2_c loopPlayerPos;
239 loopPlayerPos.x = dScStage_c::getLoopPosX(player->getCenterX());
240 loopPlayerPos.y = player->getCenterY();
241
242 mVec2_c adjDelta;
243 adjDelta.x = loopPlayerPos.x - loopPos.x;
244
245 // Handle loop-over
246 if (adjDelta.x < 0.0f) {
247 if (adjDelta.x < -loopOffset / 2) {
248 adjDelta.x += loopOffset;
249 }
250 } else {
251 if (adjDelta.x > loopOffset / 2) {
252 adjDelta.x -= loopOffset;
253 }
254 }
255
256 adjDelta.y = loopPlayerPos.y - loopPos.y;
257
258 float dist = adjDelta.x * adjDelta.x + adjDelta.y * adjDelta.y;
259 if (closestDist > dist) {
260 delta.set(adjDelta.x, adjDelta.y);
261 closestPlayer = player;
262 closestDist = dist;
263 }
264 }
265 return closestPlayer;
266}
267
269 static const getTrgToSrcDirFunc getdirFunc[dScStage_c::LOOP_COUNT] = {
273 };
274 mGetTrgToSrcDirFunc = getdirFunc[loopType];
275}
276
277bool dActor_c::getTrgToSrcDir_Main(float trgX, float srcX) {
278 return mGetTrgToSrcDirFunc(trgX, srcX);
279}
280
281bool dActor_c::getTrgToSrcDirNormal(float trgX, float srcX) {
282 return trgX < srcX;
283}
284
285bool dActor_c::getTrgToSrcDirLoop(float trgX, float srcX) {
286 float loopTrgX = dScStage_c::getLoopPosX(trgX);
287 float loopSrcX = dScStage_c::getLoopPosX(srcX);
288 float diffX = loopTrgX - loopSrcX;
289
290 float loopOffset = dBg_c::m_bg_p->mLoopOffset / 2;
291 if (diffX < 0.0f) {
292 return !(diffX < -loopOffset);
293 } else {
294 return diffX > loopOffset;
295 }
296}
297
298void dActor_c::changePosAngle(mVec3_c *pos, mAng3_c *ang, int param3) {
299 dScStage_c::changePos(pos);
300}
301
303 dScStage_c::setChangePosFunc(loopType);
304}
305
306void dActor_c::setLoopFunc(int loopType) {
307 setChangePosAngleFunc(loopType);
308 setSearchNearPlayerFunc(loopType);
309 setGetTrgToSrcDirFunc(loopType);
310}
311
313 for (int i = 0; i < 4; i++) {
314 dActor_c *player = daPyMng_c::getPlayer(i);
315 if (player != nullptr && player->mAreaNo == mAreaNo) {
316 return true;
317 }
318 }
319 return false;
320}
321
325
329
333
337
341
343 nw4r::g3d::ResMdl resMdl = mdl.getResMdl();
344 m3d::replaceLightMapTexture("lm_01i", mdl, 0);
345 m3d::replaceLightMapTexture("lm_02i", mdl, 0);
346
347 for (size_t i = 0; i < resMdl.GetResMatNumEntries(); i++) {
348 nw4r::g3d::ScnMdl::CopiedMatAccess cma(nw4r::g3d::G3dObj::DynamicCast<nw4r::g3d::ScnMdl>(mdl.getScn()), i);
349 nw4r::g3d::ResMatMisc mat = cma.GetResMatMisc(false);
350 if (mat.mZCompLoc != 0) {
351 mat.SetLightSetIdx(6);
352 }
353 }
354}
355
356void dActor_c::deleteActor(u8 deleteForever) {
358
359 u8 *spawnFlags = mpSpawnFlags;
360 u16 *deleteVal = mpDeleteVal;
361 if (spawnFlags == nullptr || deleteVal == nullptr) {
362 return;
363 }
364
365 if (!deleteForever) {
366 if (spawnFlags != nullptr) {
367 *spawnFlags = *spawnFlags & ~ACTOR_SPAWNED;
368 }
369 } else {
370 if (spawnFlags != nullptr) {
371 *spawnFlags = *spawnFlags | ACTOR_NO_RESPAWN;
372 }
373 if (deleteVal != nullptr) {
374 *deleteVal = 300;
375 }
376 }
377}
378
379bool dActor_c::areaCullCheck(const mVec3_c &pos, const mBoundBox &bound, u8 areaID) const {
380 dCdFile_c *course = dCd_c::m_instance->getFileP(dScStage_c::m_instance->mCurrCourse);
381 AreaBoundU16 *area = course->getAreaP(areaID, nullptr);
382 if (area == nullptr) {
383 return true;
384 }
385
386 // [Probably some more inlining going on here]
387 mVec2_c b;
388 mVec2_c bt = bound.withPos(pos);
389 b.set(bt.x, bt.y);
390
391 b.x -= area->x;
392 b.y += area->y;
393
394 mVec2_c doubleBoundSize = bound.getSize();
395 doubleBoundSize.x = 2.0f * doubleBoundSize.x;
396 doubleBoundSize.y = 2.0f * doubleBoundSize.y;
397
398 mVec2_c maxBoundSize = mMaxBound.getSize();
399
400 if (!(course->mpCourseSettings->mFlags & dCdCourseSettings_c::WRAP_AROUND_EDGES)) {
401 if (b.x + doubleBoundSize.x < -maxBoundSize.x || b.x > area->width + maxBoundSize.x) {
402 return true;
403 }
404 }
405 if (b.y - doubleBoundSize.y > maxBoundSize.y || b.y < -(area->height + maxBoundSize.y)) {
406 return true;
407 }
408
409 return false;
410}
411
413 if (mEatState == EAT_STATE_EATEN) {
414 return false;
415 }
416
417 if (!(flags & SKIP_RIDE_CHECK) && mBc.checkRide()) {
418 return false;
419 }
420
421 mBoundBox visibleBound;
422 visibleBound.mOffset.x = mVisibleAreaOffset.x;
423 visibleBound.mOffset.y = mVisibleAreaOffset.y;
424 visibleBound.mSize.x = mVisibleAreaSize.x * 0.5f;
425 visibleBound.mSize.y = mVisibleAreaSize.y * 0.5f;
426
427 bool outOfScreen = false;
428 if (areaCullCheck(mPos, visibleBound, mAreaNo)) {
429 outOfScreen = true;
430 } else if (!(flags & SKIP_SCREEN_CHECK)) {
431 if (screenCullCheck(mPos, visibleBound, getDestroyBound(), mAreaNo)) {
432 outOfScreen = true;
433 }
434 }
435
436 if (outOfScreen && !(flags & SKIP_ACTOR_DELETE)) {
438 }
439
440 return outOfScreen;
441}
442
444 mBoundBox bound;
445 bound.mOffset.x = mVisibleAreaOffset.x;
446 bound.mOffset.y = mVisibleAreaOffset.y;
447 bound.mSize.x = mVisibleAreaSize.x * 0.5f;
448 bound.mSize.y = mVisibleAreaSize.y * 0.5f + 16.0f;
449
450 mVec3_c pos = mPos;
451 changePosAngle(&pos, nullptr, 1);
452
453 return dGameCom::someCheck(&pos, &bound);
454}
455
457 if (mBgCollFlags != 0) {
458 if ((mBgCollFlags & COLL_HEAD) && mBc.isHead()) {
459 return true;
460 }
461 if ((mBgCollFlags & COLL_WALL_L) && mBc.isWallL()) {
462 return true;
463 }
464 if ((mBgCollFlags & COLL_FOOT) && mBc.isFoot()) {
465 return true;
466 }
467 if ((mBgCollFlags & COLL_WALL_R) && mBc.isWallR()) {
468 return true;
469 }
470 }
471 return false;
472}
473
474bool dActor_c::carryFukidashiCheck(int fukidashiAction, mVec2_c fukidashiTriggerSize) {
475 mVec3_c centerPos = getCenterPos();
476
477 mVec3_c minTriggerPos(centerPos.x - fukidashiTriggerSize.x, centerPos.y - fukidashiTriggerSize.y, mPos.z);
478 mVec3_c maxTriggerPos(centerPos.x + fukidashiTriggerSize.x, centerPos.y + fukidashiTriggerSize.y, mPos.z);
479
480 if (mCarryFukidashiPlayerNo <= 3 && dInfo_c::m_instance->mFukidashiActionPerformed[mCarryFukidashiPlayerNo][fukidashiAction]) {
482 }
483
484 if (mCarryFukidashiPlayerNo <= 3) {
485 // Already displaying a fukidashi
486 dAcPy_c *player = daPyMng_c::getPlayer(mCarryFukidashiPlayerNo);
487 if (player != nullptr) {
488 bool canDrawFukidashi = player->isDrawingCarryFukidashi();
489
490 mBoundBox playerBoundBox;
491 player->getCcBounds(playerBoundBox);
492 mVec3_c playerPos(
493 dScStage_c::getLoopPosX(playerBoundBox.mOffset.x + player->mPos.x),
494 playerBoundBox.mOffset.y + player->mPos.y,
495 player->mPos.z
496 );
497
498 mVec3_c minPlayerPos(playerPos.x - playerBoundBox.mSize.x - 2.0f, playerPos.y - playerBoundBox.mSize.y, playerPos.z);
499 mVec3_c maxPlayerPos(playerPos.x + playerBoundBox.mSize.x + 2.0f, playerPos.y + playerBoundBox.mSize.y, playerPos.z);
500
501 if (!dfukidashiManager_c::m_instance->mInfos[mCarryFukidashiPlayerNo].mVisible) {
503 }
504
505 bool overlap = dGameCom::checkRectangleOverlap(&minTriggerPos, &maxTriggerPos, &minPlayerPos, &maxPlayerPos, 0.0f);
506 if ((!canDrawFukidashi) || (!overlap)) {
509 }
510 }
511 } else {
512 // Not displaying a fukidashi yet, search for a player to show it
513 dAcPy_c *player = searchCarryFukidashiPlayer(fukidashiAction);
514 if (player != nullptr) {
515 bool canDrawFukidashi = player->isDrawingCarryFukidashi();
516
517 mBoundBox playerBoundBox;
518 player->getCcBounds(playerBoundBox);
519 mVec3_c playerPos(
520 dScStage_c::getLoopPosX(playerBoundBox.mOffset.x + player->mPos.x),
521 playerBoundBox.mOffset.y + player->mPos.y,
522 player->mPos.z
523 );
524
525 mVec3_c minPlayerPos(playerPos.x - playerBoundBox.mSize.x, playerPos.y - playerBoundBox.mSize.y, playerPos.z);
526 mVec3_c maxPlayerPos(playerPos.x + playerBoundBox.mSize.x, playerPos.y + playerBoundBox.mSize.y, playerPos.z);
527
528 bool overlap = dGameCom::checkRectangleOverlap(&minTriggerPos, &maxTriggerPos, &minPlayerPos, &maxPlayerPos, 0.0f);
529 if (canDrawFukidashi && overlap) {
531 }
532 }
533 }
534
535 return false;
536}
537
538void dActor_c::carryFukidashiCancel(int fukidashiAction, int playerId) {
539 for (int i = 0; i < 4; i++) {
540 if (i == playerId) {
541 dGameCom::hideFukidashiForLevel(i, fukidashiAction, 0);
542 dGameCom::hideFukidashiForSession(i, fukidashiAction);
543 } else {
544 dGameCom::hideFukidashiTemporarily(i, fukidashiAction, 0);
545 }
546 }
548}
549
551 mVec3_c center = getCenterPos();
552
553 dAcPy_c *closestPlayer = nullptr;
554 float closestDist = 1e9;
555 for (int i = 0; i < 4; i++) {
556 if (daPyMng_c::checkPlayer(i) && !dInfo_c::m_instance->mFukidashiActionPerformed[i][fukidashiAction]) {
557 dAcPy_c *player = daPyMng_c::getPlayer(i);
558 if (player == nullptr) {
559 continue;
560 }
561
562 float diffX = player->mPos.x + player->mCenterOffs.x - center.x;
563 float diffY = player->mPos.y + player->mCenterOffs.y - center.y;
564 float dist = diffX * diffX + diffY * diffY;
565 if (closestDist > dist) {
566 closestPlayer = player;
567 closestDist = dist;
568 }
569 }
570 }
571 return closestPlayer;
572}
573
575 return mVec2_c(mPos.x + mCenterOffs.x, mPos.y + mCenterOffs.y);
576}
577
579
581 mVec3_c effPos = getCenterPos();
582 effPos.y += 4.0f;
583 mEf::createEffect("Wm_en_burst_s", 0, &effPos, nullptr, nullptr);
584}
585
586void dActor_c::killActor(s8 playerId, int noScore) {
587 mVec3_c effPos = mPos;
588 mVec3_c centerOffs = mCenterOffs;
589
590 mNoRespawn = true;
591 for (int i = 0; i < daPyMng_c::mNum; i++) {
592 dAcPy_c *player = daPyMng_c::getPlayer(i);
593 if (player != nullptr && fManager_c::searchBaseByID(player->mCarryActorID) == this) {
594 player->cancelCarry(this);
595 }
596 }
597
598 effPos += centerOffs;
599 mEf::createEffect("Wm_en_burst_s", 0, &effPos, nullptr, nullptr);
600 deleteActor(1);
601
602 if (!noScore) {
603 if (playerId < 0) {
604 dScoreMng_c::m_instance->UnKnownScoreSet(this, 1, dScoreMng_c::smc_SCORE_X, dScoreMng_c::smc_SCORE_Y);
605 } else {
606 dScoreMng_c::m_instance->ScoreSet(this, 1, playerId, dScoreMng_c::smc_SCORE_X, dScoreMng_c::smc_SCORE_Y);
607 }
608 }
609}
610
612
615}
616
618
619void dActor_c::setEatMouth(dActor_c *eatingActor) {}
620
622 return true;
623}
624
626 static const int yoshiEatPopupTypes[] = { dSmallScore_c::POPUP_TYPE_200, dSmallScore_c::POPUP_TYPE_1000 };
627 static const int yoshiEatPoints[] = { 200, 1000 };
628
630 mVec3_c smallScorePos = eatingActor->mPos;
631 smallScorePos.y += 40.0f;
632
633 s8 plrNo = *eatingActor->getPlrNo();
634 dGameCom::CreateSmallScore(smallScorePos, yoshiEatPopupTypes[mEatPoints], plrNo, false);
635
636 if (plrNo != -1) {
637 daPyMng_c::addScore(yoshiEatPoints[mEatPoints], plrNo);
638 dMultiMng_c::mspInstance->incEnemyDown(plrNo);
639 }
640 }
641
643 return true;
644}
645
649
651 mMtx_c mouthMtx;
652 daYoshi_c *yoshi = (daYoshi_c *) eatingActor;
653
654 yoshi->getMouthMtx(&mouthMtx);
655 mMtx_c transposeMtx;
656 PSMTXTrans(transposeMtx, 10.0f, -7.0f, 0.0f);
657 mMtx_c resMtx;
658 PSMTXConcat(mouthMtx, transposeMtx, mouthMtx);
659 mPos.x = mouthMtx.transX();
660 mPos.y = mouthMtx.transY();
661}
662
664 float res = 1.0f;
665 daYoshi_c *yoshi = (daYoshi_c *) eatingActor;
666
667 if (yoshi->m_a0 <= 1) {
668 res = yoshi->m_a0 / 1.25f;
669 }
670 return res;
671}
672
675
676 float scaleRate = calcEatScaleRate(eatingActor);
677 if (scaleRate < 1.0f) {
678 mScale *= scaleRate;
679 }
680}
681
682void dActor_c::eatMove(dActor_c *eatingActor) {
683 mMtx_c tongueTipMtx;
684 daYoshi_c *yoshi = (daYoshi_c *) eatingActor;
685
686 yoshi->getTongueTipMtx(&tongueTipMtx);
687 mPos.x = tongueTipMtx.transX();
688 mPos.y = tongueTipMtx.transY() - mCenterOffs.y;
689}
690
692
694
696
698
699void dActor_c::slideComboSE(int multiplier, bool shortCombo) {
700 static const dAudio::SoundEffectID_t cs_combo_se[] = {
701 SE_EMY_KAME_HIT_1,
702 SE_EMY_KAME_HIT_2,
703 SE_EMY_KAME_HIT_3,
704 SE_EMY_KAME_HIT_4,
705 SE_EMY_KAME_HIT_5,
706 SE_EMY_KAME_HIT_6,
707 SE_EMY_KAME_HIT_7,
708 SE_EMY_KAME_HIT_7,
709 SE_EMY_KAME_HIT_7
710 };
711
712 if ((u8) mPlayerNo <= 3) {
713 int combo = multiplier;
714 if (combo >= ARRAY_SIZE(cs_combo_se)) {
715 combo = ARRAY_SIZE(cs_combo_se) - 1;
716 }
717 int comboNeededForClaps = shortCombo ? 4 : 7;
718 if (combo >= comboNeededForClaps) {
719 dMultiMng_c::mspInstance->setClapSE();
720 }
721
722 cs_combo_se[combo].playEmySound(getCenterPos(), dAudio::getRemotePlayer(mPlayerNo));
723 }
724}
725
729
730void dActor_c::waterSplashEffect(const mVec3_c &pos, float size) {
731 mVec3_c shiftedPos(pos, 6500.0f);
732
733 int waterDepth = dBc_c::checkWaterDepth(shiftedPos.x, shiftedPos.y, mLayer, mBc.mLineKind, nullptr);
734
735 u32 splashInfo = 0;
736 if (waterDepth < 3) {
737 splashInfo = 1;
738 }
739 splashInfo |= (mLayer << 16);
740
741 mVec3_c splashSize(size, size, size);
742 dEffActorMng_c::m_instance->createWaterSplashEff(shiftedPos, splashInfo, -1, splashSize);
743
744 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH, shiftedPos, 0);
745
746 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 6);
747}
748
749void dActor_c::yoganSplashEffect(const mVec3_c &pos, float size) {
750 mVec3_c shiftedPos(pos, 6500.0f);
751
752 u32 splashInfo = 4 | (mLayer << 16);
753
754 mVec3_c splashSize(size, size, size);
755 dEffActorMng_c::m_instance->createWaterSplashEff(shiftedPos, splashInfo, -1, splashSize);
756
757 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH_LAVA, shiftedPos, 0);
758
759 if (size < 1.0f) {
760 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 16);
761 } else {
762 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 14);
763 }
764}
765
766void dActor_c::poisonSplashEffect(const mVec3_c &pos, float size) {
767 mVec3_c shiftedPos(pos, 6500.0f);
768
769 u32 splashInfo = 6 | (mLayer << 16);
770
771 mVec3_c splashSize(size, size, size);
772 dEffActorMng_c::m_instance->createWaterSplashEff(shiftedPos, splashInfo, -1, splashSize);
773
774 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH_POISON, pos, 0);
775
776 if (size < 1.0f) {
777 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 23);
778 } else {
779 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 21);
780 }
781}
782
783bool dActor_c::checkCarried(int *playerNum) {
784 for (int i = 0; i < 4; i++) {
785 dAcPy_c *player = daPyMng_c::getPlayer(i);
786 if (player != nullptr && fManager_c::searchBaseByID(player->mCarryActorID) == this) {
787 if (playerNum != nullptr) {
788 *playerNum = *player->getPlrNo();
789 }
790 return true;
791 }
792 }
793 if (playerNum != nullptr) {
794 *playerNum = -1;
795 }
796 return false;
797}
798
800 mCc.release();
801}
802
804 mCc.entry();
805}
void getCcBounds(mBoundBox &bounds)
float m_1b
Definition d_actor.hpp:338
static u8 mExecStopReq
The actors for which the execute operation is requested to be disabled.
Definition d_actor.hpp:398
static u8 mExecStop
The actors for which the execute operation is currently disabled.
Definition d_actor.hpp:400
static bool getTrgToSrcDirLoop(float trgX, float srcX)
See getTrgToSrcDirFunc.
Definition d_actor.cpp:285
void deleteActor(u8 deleteForever)
Deletes the actor and optionally disables respawn.
Definition d_actor.cpp:356
static const float smc_CULL_AREA_XLIMIT
The default max bound X size.
Definition d_actor.hpp:394
u8 mExecStopMask
The mask required to disable the execute operation for the actor.
Definition d_actor.hpp:376
static dActor_c * construct(ProfileName profName, unsigned long param, const mVec3_c *position, const mAng3_c *rotation, u8 layer)
Creates a stage actor without a parent.
Definition d_actor.cpp:167
void slideComboSE(int multiplier, bool shortCombo)
Plays the combo kill sound effect.
Definition d_actor.cpp:699
virtual bool setEatGlupDown(dActor_c *eatingActor)
Callback for when the actor is about to be fully swallowed.
Definition d_actor.cpp:625
bool mBlockHit
Whether a block below the actor was hit.
Definition d_actor.hpp:362
dAcPy_c * searchNearPlayer(mVec2_c &delta)
Gets the closest player to the actor and its distance.
Definition d_actor.cpp:191
static void setLoopFunc(int loopType)
Sets the position-related functions for the level.
Definition d_actor.cpp:306
bool checkAreaNo()
Checks if at least one player is in the same zone as the actor.
Definition d_actor.cpp:312
void carryFukidashiCancel(int fukidashiAction, int playerId)
Hides the given action prompt for all players.
Definition d_actor.cpp:538
virtual void postCreate(fBase_c::MAIN_STATE_e status)
post method for the create operation.
Definition d_actor.cpp:89
virtual void postDelete(fBase_c::MAIN_STATE_e status)
post method for the delete operation.
Definition d_actor.cpp:101
mVec3_c mPreEatScale
The actor's scale before being eaten.
Definition d_actor.hpp:367
static void setSoftLight_MapObj(m3d::bmdl_c &mdl)
Sets the soft light effect for map objects.
Definition d_actor.cpp:334
virtual void cancelFunsuiActUpper()
Definition d_actor.cpp:693
u8 m_00
Seems to be a player bit flag.
Definition d_actor.hpp:331
static u8 * m_tmpCtSpawnFlags
Temporary storage for the next created sprite actor's spawn flags. See mpSpawnFlags.
Definition d_actor.hpp:407
static void setSoftLight_Map(m3d::bmdl_c &mdl)
Sets the soft light effect for map actors.
Definition d_actor.cpp:330
bool mNoRespawn
Whether the actor should not respawn after being deleted.
Definition d_actor.hpp:378
virtual void setSpinLiftUpActor(dActor_c *carryingActor)
Callback for when the actor is picked up by another actor.
Definition d_actor.cpp:611
virtual void reviveCc()
Enables the actor's collision.
Definition d_actor.cpp:803
static void setTmpCtData(u8 layer)
Sets temporary data to be used for the next actor's construction.
Definition d_actor.cpp:162
static u64 m_tmpCtEventMask
Temporary storage for the next created sprite actor's event mask. See mEventMask.
Definition d_actor.hpp:413
static u8 m_tmpCtLayerNo
Temporary storage for the next constructed actor's layer. See mLayer.
Definition d_actor.hpp:404
u8 * mpSpawnFlags
The spawn flags for the actor. See ACTOR_SPAWN_FLAG_e.
Definition d_actor.hpp:355
dBc_c mBc
The actor-to-tile collision sensor.
Definition d_actor.hpp:342
static getTrgToSrcDirFunc mGetTrgToSrcDirFunc
The direction detection function.
Definition d_actor.hpp:403
static u8 m_tmpCtSpriteLayerNo
Temporary storage for the next created sprite actor's layer. See mLayer.
Definition d_actor.hpp:416
virtual void poisonSplashEffect(const mVec3_c &pos, float size)
Generates a poison water splash effect.
Definition d_actor.cpp:766
static bool getTrgToSrcDir_Main(float trgX, float srcX)
See getTrgToSrcDirFunc.
Definition d_actor.cpp:277
static void setSoftLight_Enemy(m3d::bmdl_c &mdl)
Sets the soft light effect for enemies.
Definition d_actor.cpp:326
void clrComboCnt()
Clears the actor's combo counter.
Definition d_actor.cpp:726
virtual void setEatTongue(dActor_c *eatingActor)
Callback for when the actor is targeted by Yoshi's tongue.
Definition d_actor.cpp:613
@ EAT_POINTS_200
Awards 200 points (default).
Definition d_actor.hpp:20
@ EAT_POINTS_NONE
No points are awarded.
Definition d_actor.hpp:22
virtual mVec2_c getLookatPos() const
Gets the position players look to when focused on the actor.
Definition d_actor.cpp:574
@ SKIP_SCREEN_CHECK
The actor position is not checked against the screen boundaries.
Definition d_actor.hpp:76
@ SKIP_RIDE_CHECK
The actor's ride status is not checked.
Definition d_actor.hpp:77
@ SKIP_ACTOR_DELETE
The actor is not deleted if out of screen.
Definition d_actor.hpp:75
static bool getTrgToSrcDirNormal(float trgX, float srcX)
See getTrgToSrcDirFunc.
Definition d_actor.cpp:281
static void setSoftLight_Boss(m3d::bmdl_c &mdl)
Sets the soft light effect for bosses.
Definition d_actor.cpp:338
static const float smc_CULL_YLIMIT
The default max bound Y offset.
Definition d_actor.hpp:393
static void setSoftLight_Player(m3d::bmdl_c &mdl)
Sets the soft light effect for players.
Definition d_actor.cpp:322
virtual float calcEatScaleRate(dActor_c *eatingActor)
Computes the scaling rate during eating.
Definition d_actor.cpp:663
mVec2_c m_1eb
Definition d_actor.hpp:345
static dAcPy_c * searchNearPlayerLoop(mVec2_c &delta, const mVec2_c &pos)
See searchNearPlayerFunc.
Definition d_actor.cpp:222
static u16 m_tmpCtEventNums
Temporary storage for the next created sprite actor's tracked event IDs. See mEventNums.
Definition d_actor.hpp:410
u8 mKind
The actor's kind. Value is a STAGE_ACTOR_KIND_e.
Definition d_actor.hpp:374
u8 mEatState
The actor's eat state. Value is a EAT_STATE_e.
Definition d_actor.hpp:365
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:298
bool areaCullCheck(const mVec3_c &pos, const mBoundBox &bound, u8 areaID) const
Checks if the actor should be culled due to zone limits.
Definition d_actor.cpp:379
dCc_c mCc
The actor-to-actor collision sensor.
Definition d_actor.hpp:341
static dAcPy_c * searchNearPlayerNormal(mVec2_c &delta, const mVec2_c &pos)
See searchNearPlayerFunc.
Definition d_actor.cpp:200
@ EAT_TYPE_EAT_PERMANENT
The actor is consumed permanently after being eaten (default).
Definition d_actor.hpp:38
virtual bool ActorDrawCullCheck()
Checks if the actor is out of view.
Definition d_actor.cpp:443
dAcPy_c * searchCarryFukidashiPlayer(int fukidashiAction)
Searches the closest player who has not yet performed the given action.
Definition d_actor.cpp:550
static void setSearchNearPlayerFunc(int loopType)
Sets the player search function to be used for the level.
Definition d_actor.cpp:182
mVec2_c mVisibleAreaSize
The size of the area inside which the actor is visible.
Definition d_actor.hpp:347
virtual void removeCc()
Disables the actor's collision.
Definition d_actor.cpp:799
virtual int preCreate()
pre method for the create operation.
Definition d_actor.cpp:85
static dAcPy_c * searchNearPlayer_Main(mVec2_c &delta, const mVec2_c &pos)
See searchNearPlayerFunc.
Definition d_actor.cpp:196
virtual void vfb4()
Definition d_actor.cpp:691
static u8 mDrawStopReq
The actor kinds for which the draw operation is requested to be disabled.
Definition d_actor.hpp:399
dAcPy_c *(* searchNearPlayerFunc)(mVec2_c &delta, const mVec2_c &pos)
Gets the closest player to the given position and its distance.
Definition d_actor.hpp:262
virtual void postExecute(fBase_c::MAIN_STATE_e status)
post method for the execute operation.
Definition d_actor.cpp:123
virtual void eatMove(dActor_c *eatingActor)
Updates the actor's position during eating actions.
Definition d_actor.cpp:682
int mAttentionMode
Definition d_actor.hpp:370
static void setGetTrgToSrcDirFunc(int loopType)
Sets the direction detection function to be used for the level.
Definition d_actor.cpp:268
u8 mEatBehaviour
The actor's eat behaviour. Value is a EAT_BEHAVIOR_e.
Definition d_actor.hpp:366
u8 mAreaNo
The actor's zone ID.
Definition d_actor.hpp:352
void setKind(u8 kind)
Sets the actor's kind. See STAGE_ACTOR_KIND_e.
Definition d_actor.cpp:177
virtual int preExecute()
pre method for the execute operation.
Definition d_actor.cpp:105
virtual void allEnemyDeathEffSet()
Spawns the visual effects for when all players reach the flagpole and all enemies are cleared.
Definition d_actor.cpp:580
static void setSoftLight_Item(m3d::bmdl_c &mdl)
Sets the soft light effect for items.
Definition d_actor.cpp:342
virtual const char * getKindString() const
Gets the base's kind string.
Definition d_actor.cpp:158
s8 mPlayerNo
The player associated with the actor, -1 if not associated to any player.
Definition d_actor.hpp:375
bool ActorScrOutCheck(u16 flags)
Checks if the actor is out of gameplay and optionally deletes it.
Definition d_actor.cpp:412
u32 mComboMultiplier
The current combo multiplier obtained by the actor by colliding with other actors.
Definition d_actor.hpp:335
virtual void cancelFunsuiActSide(int)
Definition d_actor.cpp:695
virtual void cancelFunsuiActVanish()
Definition d_actor.cpp:697
virtual void setEatMouth(dActor_c *eatingActor)
Callback for when the actor is being eaten.
Definition d_actor.cpp:619
u32 mEatenByID
The unique identifier of the eating actor.
Definition d_actor.hpp:364
bool carryFukidashiCheck(int fukidashiAction, mVec2_c fukidashiTriggerSize)
Checks if the prompt for the given action should be displayed for each player.
Definition d_actor.cpp:474
virtual void waterSplashEffect(const mVec3_c &pos, float size)
Generates a water splash effect.
Definition d_actor.cpp:730
void killActor(s8 playerId, int noScore)
Kills the actor and optionally awards points to one or all players.
Definition d_actor.cpp:586
virtual void setEatTongueOff(dActor_c *eatingActor)
Callback for when the eating action is canceled.
Definition d_actor.cpp:617
virtual void block_hit_init()
Callback for when a block directly beneath the actor is hit.
Definition d_actor.cpp:578
@ EAT_STATE_EATEN
The actor has been successfully eaten.
Definition d_actor.hpp:29
bool checkCarried(int *playerNum)
Returns whether the actor is being carried by a player.
Definition d_actor.cpp:783
dActor_c()
Constructs a new actor.
Definition d_actor.cpp:46
bool checkBgColl()
Returns whether the actor is colliding with any enabled collision sides.
Definition d_actor.cpp:456
virtual void yoganSplashEffect(const mVec3_c &pos, float size)
Generates a lava splash effect.
Definition d_actor.cpp:749
@ COLL_FOOT
The actor can collide with the ground.
Definition d_actor.hpp:64
@ COLL_HEAD
The actor can collide with ceilings.
Definition d_actor.hpp:61
@ COLL_WALL_L
The actor can collide with walls on its left.
Definition d_actor.hpp:62
@ COLL_WALL_R
The actor can collide with walls on its right.
Definition d_actor.hpp:63
@ COLL_NONE
The actor does not collide with any surface.
Definition d_actor.hpp:60
static const float smc_CULL_AREA_YLIMIT
The default max bound Y size.
Definition d_actor.hpp:395
dRc_c mRc
The actor's ride surface manager.
Definition d_actor.hpp:343
@ ACTOR_SPAWNED
The actor is spawned.
Definition d_actor.hpp:69
@ ACTOR_NO_RESPAWN
The actor must not respawn after deletion.
Definition d_actor.hpp:70
virtual void calcEatInScale(dActor_c *eatingActor)
Adjusts the actor's scale while being eaten.
Definition d_actor.cpp:673
u32 mCarryFukidashiPlayerNo
The player for whom an action prompt related to the actor is being displayed. -1 if no players meet t...
Definition d_actor.hpp:332
virtual int preDraw()
pre method for the draw operation.
Definition d_actor.cpp:141
virtual s8 * getPlrNo()
Gets the player number associated with the actor. See mPlayerNo.
Definition d_actor.hpp:104
virtual void setAfterEatScale()
Restores the actor's scale once spat out.
Definition d_actor.cpp:646
static bool screenCullCheck(const mVec3_c &pos, const mBoundBox &visibleBound, mBoundBox destroyBound, u8 areaID)
Checks if the actor should be culled due to being outside the screen.
static const mVec2_c smc_FUKIDASHI_RANGE
The default trigger area size for displaying action prompts.
Definition d_actor.hpp:396
virtual bool setEatSpitOut(dActor_c *eatingActor)
Callback for when the actor is about to be spat out.
Definition d_actor.cpp:621
@ STAGE_ACTOR_GENERIC
A generic stage actor (default).
Definition d_actor.hpp:46
virtual void calcSpitOutPos(dActor_c *eatingActor)
Calculates the position where the actor will be spat out.
Definition d_actor.cpp:650
static void setChangePosAngleFunc(int loopType)
Sets the position update function to be used for the level.
Definition d_actor.cpp:302
virtual void postDraw(fBase_c::MAIN_STATE_e status)
post method for the draw operation.
Definition d_actor.cpp:154
virtual int preDelete()
pre method for the delete operation.
Definition d_actor.cpp:93
static const float smc_CULL_XLIMIT
The default max bound X offset.
Definition d_actor.hpp:392
u16 * mpDeleteVal
Definition d_actor.hpp:356
static searchNearPlayerFunc mSearchNearPlayerFunc
The player search function.
Definition d_actor.hpp:402
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
bool(* getTrgToSrcDirFunc)(float trgX, float srcX)
Gets the direction the target position is in, from the source position's viewpoint.
Definition d_actor.hpp:271
~dActor_c()
Destroys the actor.
Definition d_actor.cpp:81
mBoundBox mMaxBound
Definition d_actor.hpp:349
u8 mBgCollFlags
The collision directions that the actor can respond to.
Definition d_actor.hpp:353
static u8 mDrawStop
The actor kinds for which the draw operation is currently disabled.
Definition d_actor.hpp:401
EAT_POINTS_e mEatPoints
The score awarded when the actor is eaten by Yoshi.
Definition d_actor.hpp:369
mBoundBox mDestroyBound
Definition d_actor.hpp:350
bool mVisible
Whether the actor should be visible or not. Defaults to true .
virtual int preDraw()
pre method for the draw operation.
mVec3_c mScale
The actor's scale (defaults to 1).
mVec3_c mPos
The actor's position.
virtual void postExecute(fBase_c::MAIN_STATE_e status)
post method for the execute operation.
virtual void postDraw(fBase_c::MAIN_STATE_e status)
post method for the draw operation.
mVec3_c mCenterOffs
The offset from the position to the center of the actor (defaults to 0).
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()
pre method for the delete operation.
virtual void postDelete(fBase_c::MAIN_STATE_e status)
post method for the delete operation.
mVec3_c getCenterPos() const
Gets the actor's centered position.
virtual void postCreate(fBase_c::MAIN_STATE_e status)
post method for the create operation.
u32 mActorProperties
The actor's properties. See fProfile::fActorProfile_c::mActorProperties.
virtual int preExecute()
pre method for the execute operation.
virtual int preCreate()
pre method for the create operation.
dBase_c()
Constructs a new base.
Definition d_base.cpp:13
const char * mpKindString
The base's kind string.
Definition d_base.hpp:44
AreaBoundU16 * getAreaP(u8 zoneID, mBoundBox *bound)
static float smc_SCORE_X
The score's horizontal offset from the actor position.
static float smc_SCORE_Y
The score's vertical offset from the actor position.
static bool checkPlayer(u8 plrNo)
MAIN_STATE_e
The possible operation results.
Definition f_base.hpp:30
@ SUCCESS
The operation was completed successfully.
Definition f_base.hpp:33
void deleteRequest()
Requests deletion of the base.
Definition f_base.cpp:289
bool mDeleteRequested
If deletion of the base was requested, but the delete operation has not been scheduled yet.
Definition f_base.hpp:64
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:39
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:40
fBaseID_e mUniqueID
The base's unique identifier.
Definition f_base.hpp:55
static fBase_c * searchBaseByID(fBaseID_e id)
Searches for a base with the given ID.
Definition f_manager.cpp:18
A three-dimensional short angle vector.
Definition m_angle.hpp:60
A 3x4 matrix.
Definition m_mtx.hpp:11
A two-dimensional floating point vector.
Definition m_vec.hpp:9
A three-dimensional floating point vector.
Definition m_vec.hpp:100
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
void PSMTXTrans(Mtx *mtx, float x, float y, float z)
Sets a translation matrix with the given components.
void PSMTXConcat(const Mtx *a, const Mtx *b, Mtx *out)
Concatenates two matrices.
u16 ProfileName
The name of a profile. Value is a fProfile::PROFILE_NAME_e.
Definition f_profile.hpp:32
void SetSoftLight_Player(m3d::bmdl_c &, int)
Sets the soft light effect for players.
void SetSoftLight_Enemy(m3d::bmdl_c &, int)
Sets the soft light effect for enemies.
void SetSoftLight_MapObj(m3d::bmdl_c &, int)
Sets the soft light effect for map objects.
void SetSoftLight_Map(m3d::bmdl_c &, int)
Sets the soft light effect for map actors.
void hideFukidashiForLevel(int playerId, int fukidashiAction, int param3)
Hides the given action prompt for the given player for the rest of the current level.
void showFukidashi(int playerId, int fukidashiAction)
Displays the given action prompt to the given player.
bool isGameStop(ulong flag)
Determines if gameplay is currently stopped for the specified reason(s).
bool someCheck(mVec3_c *a, mBoundBox *b)
bool checkRectangleOverlap(mVec3_c *, mVec3_c *, mVec3_c *, mVec3_c *, float)
void SetSoftLight_Boss(m3d::bmdl_c &, int)
Sets the soft light effect for bosses.
void hideFukidashiTemporarily(int playerId, int fukidashiAction, int param3)
Temporarily hides the given action prompt for the given player.
void hideFukidashiForSession(int playerId, int fukidashiAction)
Hides the given action prompt for the given player for the rest of the current session.
@ GAME_STOP_ANY
The game is stopped for any unspecified reason.