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 <nw4r/g3d.h>
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 = sRangeDataF(256.0f, 256.0f, 80.0f, 80.0f);
61
62 dCdFile_c *file = dCd_c::m_instance->getFileP(dScStage_c::m_instance->mCurrFile);
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.IsValid()) {
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 sRangeDataF &bound, u8 areaID) const {
380 dCdFile_c *course = dCd_c::m_instance->getFileP(dScStage_c::m_instance->mCurrFile);
381 sAreaData *area = course->getAreaDataP(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;
389 bt.x = pos.x + bound.mOffset.x - bound.mSize.x;
390 bt.y = pos.y + bound.mOffset.y + bound.mSize.y;
391 b.set(bt.x, bt.y);
392
393 b.x -= area->mRangeData.mX;
394 b.y += area->mRangeData.mY;
395
396 mVec2_c doubleBoundSize = bound.getSize();
397 doubleBoundSize.x = 2.0f * doubleBoundSize.x;
398 doubleBoundSize.y = 2.0f * doubleBoundSize.y;
399
400 mVec2_c maxBoundSize = mMaxBound.getSize();
401
402 if (!(course->mpOptions->mFlags & sOptionData::WRAP_AROUND_EDGES)) {
403 if (b.x + doubleBoundSize.x < -maxBoundSize.x || b.x > area->mRangeData.mWidth + maxBoundSize.x) {
404 return true;
405 }
406 }
407 if (b.y - doubleBoundSize.y > maxBoundSize.y || b.y < -(area->mRangeData.mHeight + maxBoundSize.y)) {
408 return true;
409 }
410
411 return false;
412}
413
415 if (mEatState == EAT_STATE_EATEN) {
416 return false;
417 }
418
419 if (!(flags & SKIP_RIDE_CHECK) && mBc.checkRide()) {
420 return false;
421 }
422
423 sRangeDataF visibleBound;
424 visibleBound.mOffset.x = mVisibleAreaOffset.x;
425 visibleBound.mOffset.y = mVisibleAreaOffset.y;
426 visibleBound.mSize.x = mVisibleAreaSize.x * 0.5f;
427 visibleBound.mSize.y = mVisibleAreaSize.y * 0.5f;
428
429 bool outOfScreen = false;
430 if (areaCullCheck(mPos, visibleBound, mAreaNo)) {
431 outOfScreen = true;
432 } else if (!(flags & SKIP_SCREEN_CHECK)) {
433 if (screenCullCheck(mPos, visibleBound, getDestroyBound(), mAreaNo)) {
434 outOfScreen = true;
435 }
436 }
437
438 if (outOfScreen && !(flags & SKIP_ACTOR_DELETE)) {
440 }
441
442 return outOfScreen;
443}
444
446 sRangeDataF bound;
447 bound.mOffset.x = mVisibleAreaOffset.x;
448 bound.mOffset.y = mVisibleAreaOffset.y;
449 bound.mSize.x = mVisibleAreaSize.x * 0.5f;
450 bound.mSize.y = mVisibleAreaSize.y * 0.5f + 16.0f;
451
452 mVec3_c pos = mPos;
453 changePosAngle(&pos, nullptr, 1);
454
455 return dGameCom::someCheck(&pos, &bound);
456}
457
459 if (mBgCollFlags != 0) {
460 if ((mBgCollFlags & COLL_HEAD) && mBc.isHead()) {
461 return true;
462 }
463 if ((mBgCollFlags & COLL_WALL_L) && mBc.isWallL()) {
464 return true;
465 }
466 if ((mBgCollFlags & COLL_FOOT) && mBc.isFoot()) {
467 return true;
468 }
469 if ((mBgCollFlags & COLL_WALL_R) && mBc.isWallR()) {
470 return true;
471 }
472 }
473 return false;
474}
475
476bool dActor_c::carryFukidashiCheck(int fukidashiAction, mVec2_c fukidashiTriggerSize) {
477 mVec3_c centerPos = getCenterPos();
478
479 mVec3_c minTriggerPos(centerPos.x - fukidashiTriggerSize.x, centerPos.y - fukidashiTriggerSize.y, mPos.z);
480 mVec3_c maxTriggerPos(centerPos.x + fukidashiTriggerSize.x, centerPos.y + fukidashiTriggerSize.y, mPos.z);
481
482 if (mCarryFukidashiPlayerNo <= 3 && dInfo_c::m_instance->mFukidashiActionPerformed[mCarryFukidashiPlayerNo][fukidashiAction]) {
484 }
485
486 if (mCarryFukidashiPlayerNo <= 3) {
487 // Already displaying a fukidashi
488 dAcPy_c *player = daPyMng_c::getPlayer(mCarryFukidashiPlayerNo);
489 if (player != nullptr) {
490 bool canDrawFukidashi = player->isDrawingCarryFukidashi();
491
492 sRangeDataF playerBoundBox;
493 player->getCcBounds(playerBoundBox);
494 mVec3_c playerPos(
495 dScStage_c::getLoopPosX(playerBoundBox.mOffset.x + player->mPos.x),
496 playerBoundBox.mOffset.y + player->mPos.y,
497 player->mPos.z
498 );
499
500 mVec3_c minPlayerPos(playerPos.x - playerBoundBox.mSize.x - 2.0f, playerPos.y - playerBoundBox.mSize.y, playerPos.z);
501 mVec3_c maxPlayerPos(playerPos.x + playerBoundBox.mSize.x + 2.0f, playerPos.y + playerBoundBox.mSize.y, playerPos.z);
502
503 if (!dfukidashiManager_c::m_instance->mInfos[mCarryFukidashiPlayerNo].mVisible) {
505 }
506
507 bool overlap = dGameCom::checkRectangleOverlap(&minTriggerPos, &maxTriggerPos, &minPlayerPos, &maxPlayerPos, 0.0f);
508 if ((!canDrawFukidashi) || (!overlap)) {
511 }
512 }
513 } else {
514 // Not displaying a fukidashi yet, search for a player to show it
515 dAcPy_c *player = searchCarryFukidashiPlayer(fukidashiAction);
516 if (player != nullptr) {
517 bool canDrawFukidashi = player->isDrawingCarryFukidashi();
518
519 sRangeDataF playerBoundBox;
520 player->getCcBounds(playerBoundBox);
521 mVec3_c playerPos(
522 dScStage_c::getLoopPosX(playerBoundBox.mOffset.x + player->mPos.x),
523 playerBoundBox.mOffset.y + player->mPos.y,
524 player->mPos.z
525 );
526
527 mVec3_c minPlayerPos(playerPos.x - playerBoundBox.mSize.x, playerPos.y - playerBoundBox.mSize.y, playerPos.z);
528 mVec3_c maxPlayerPos(playerPos.x + playerBoundBox.mSize.x, playerPos.y + playerBoundBox.mSize.y, playerPos.z);
529
530 bool overlap = dGameCom::checkRectangleOverlap(&minTriggerPos, &maxTriggerPos, &minPlayerPos, &maxPlayerPos, 0.0f);
531 if (canDrawFukidashi && overlap) {
533 }
534 }
535 }
536
537 return false;
538}
539
540void dActor_c::carryFukidashiCancel(int fukidashiAction, int playerId) {
541 for (int i = 0; i < 4; i++) {
542 if (i == playerId) {
543 dGameCom::hideFukidashiForLevel(i, fukidashiAction, 0);
544 dGameCom::hideFukidashiForSession(i, fukidashiAction);
545 } else {
546 dGameCom::hideFukidashiTemporarily(i, fukidashiAction, 0);
547 }
548 }
550}
551
553 mVec3_c center = getCenterPos();
554
555 dAcPy_c *closestPlayer = nullptr;
556 float closestDist = 1e9;
557 for (int i = 0; i < 4; i++) {
558 if (daPyMng_c::checkPlayer(i) && !dInfo_c::m_instance->mFukidashiActionPerformed[i][fukidashiAction]) {
559 dAcPy_c *player = daPyMng_c::getPlayer(i);
560 if (player == nullptr) {
561 continue;
562 }
563
564 float diffX = player->mPos.x + player->mCenterOffs.x - center.x;
565 float diffY = player->mPos.y + player->mCenterOffs.y - center.y;
566 float dist = diffX * diffX + diffY * diffY;
567 if (closestDist > dist) {
568 closestPlayer = player;
569 closestDist = dist;
570 }
571 }
572 }
573 return closestPlayer;
574}
575
577 return mVec2_c(mPos.x + mCenterOffs.x, mPos.y + mCenterOffs.y);
578}
579
581
583 mVec3_c effPos = getCenterPos();
584 effPos.y += 4.0f;
585 mEf::createEffect("Wm_en_burst_s", 0, &effPos, nullptr, nullptr);
586}
587
588void dActor_c::killActor(s8 playerId, int noScore) {
589 mVec3_c effPos = mPos;
590 mVec3_c centerOffs = mCenterOffs;
591
592 mNoRespawn = true;
593 for (int i = 0; i < daPyMng_c::mNum; i++) {
594 dAcPy_c *player = daPyMng_c::getPlayer(i);
595 if (player != nullptr && fManager_c::searchBaseByID(player->mCarryActorID) == this) {
596 player->cancelCarry(this);
597 }
598 }
599
600 effPos += centerOffs;
601 mEf::createEffect("Wm_en_burst_s", 0, &effPos, nullptr, nullptr);
602 deleteActor(1);
603
604 if (!noScore) {
605 if (playerId < 0) {
606 dScoreMng_c::m_instance->UnKnownScoreSet(this, 1, dScoreMng_c::smc_SCORE_X, dScoreMng_c::smc_SCORE_Y);
607 } else {
608 dScoreMng_c::m_instance->ScoreSet(this, 1, playerId, dScoreMng_c::smc_SCORE_X, dScoreMng_c::smc_SCORE_Y);
609 }
610 }
611}
612
614
617}
618
620
621void dActor_c::setEatMouth(dActor_c *eatingActor) {}
622
624 return true;
625}
626
628 static const int yoshiEatPopupTypes[] = { dSmallScore_c::POPUP_TYPE_200, dSmallScore_c::POPUP_TYPE_1000 };
629 static const int yoshiEatPoints[] = { 200, 1000 };
630
632 mVec3_c smallScorePos = eatingActor->mPos;
633 smallScorePos.y += 40.0f;
634
635 s8 plrNo = *eatingActor->getPlrNo();
636 dGameCom::CreateSmallScore(smallScorePos, yoshiEatPopupTypes[mEatPoints], plrNo, false);
637
638 if (plrNo != -1) {
639 daPyMng_c::addScore(yoshiEatPoints[mEatPoints], plrNo);
640 dMultiMng_c::mspInstance->incEnemyDown(plrNo);
641 }
642 }
643
645 return true;
646}
647
651
653 mMtx_c mouthMtx;
654 daYoshi_c *yoshi = (daYoshi_c *) eatingActor;
655
656 yoshi->getMouthMtx(&mouthMtx);
657 mMtx_c transposeMtx;
658 PSMTXTrans(transposeMtx, 10.0f, -7.0f, 0.0f);
659 mMtx_c resMtx;
660 PSMTXConcat(mouthMtx, transposeMtx, mouthMtx);
661 mPos.x = mouthMtx.transX();
662 mPos.y = mouthMtx.transY();
663}
664
666 float res = 1.0f;
667 daYoshi_c *yoshi = (daYoshi_c *) eatingActor;
668
669 if (yoshi->m_a0 <= 1) {
670 res = yoshi->m_a0 / 1.25f;
671 }
672 return res;
673}
674
677
678 float scaleRate = calcEatScaleRate(eatingActor);
679 if (scaleRate < 1.0f) {
680 mScale *= scaleRate;
681 }
682}
683
684void dActor_c::eatMove(dActor_c *eatingActor) {
685 mMtx_c tongueTipMtx;
686 daYoshi_c *yoshi = (daYoshi_c *) eatingActor;
687
688 yoshi->getTongueTipMtx(&tongueTipMtx);
689 mPos.x = tongueTipMtx.transX();
690 mPos.y = tongueTipMtx.transY() - mCenterOffs.y;
691}
692
694
696
698
700
701void dActor_c::slideComboSE(int multiplier, bool shortCombo) {
702 static const dAudio::SoundEffectID_t cs_combo_se[] = {
703 SE_EMY_KAME_HIT_1,
704 SE_EMY_KAME_HIT_2,
705 SE_EMY_KAME_HIT_3,
706 SE_EMY_KAME_HIT_4,
707 SE_EMY_KAME_HIT_5,
708 SE_EMY_KAME_HIT_6,
709 SE_EMY_KAME_HIT_7,
710 SE_EMY_KAME_HIT_7,
711 SE_EMY_KAME_HIT_7
712 };
713
714 if ((u8) mPlayerNo <= 3) {
715 int combo = multiplier;
716 if (combo >= ARRAY_SIZE(cs_combo_se)) {
717 combo = ARRAY_SIZE(cs_combo_se) - 1;
718 }
719 int comboNeededForClaps = shortCombo ? 4 : 7;
720 if (combo >= comboNeededForClaps) {
721 dMultiMng_c::mspInstance->setClapSE();
722 }
723
724 cs_combo_se[combo].playEmySound(getCenterPos(), dAudio::getRemotePlayer(mPlayerNo));
725 }
726}
727
731
732void dActor_c::waterSplashEffect(const mVec3_c &pos, float size) {
733 mVec3_c shiftedPos(pos, 6500.0f);
734
735 int waterDepth = dBc_c::checkWaterDepth(shiftedPos.x, shiftedPos.y, mLayer, mBc.mLineKind, nullptr);
736
737 u32 splashInfo = 0;
738 if (waterDepth < 3) {
739 splashInfo = 1;
740 }
741 splashInfo |= (mLayer << 16);
742
743 mVec3_c splashSize(size, size, size);
744 dEffActorMng_c::m_instance->createWaterSplashEff(shiftedPos, splashInfo, -1, splashSize);
745
746 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH, shiftedPos, 0);
747
748 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 6);
749}
750
751void dActor_c::yoganSplashEffect(const mVec3_c &pos, float size) {
752 mVec3_c shiftedPos(pos, 6500.0f);
753
754 u32 splashInfo = 4 | (mLayer << 16);
755
756 mVec3_c splashSize(size, size, size);
757 dEffActorMng_c::m_instance->createWaterSplashEff(shiftedPos, splashInfo, -1, splashSize);
758
759 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH_LAVA, shiftedPos, 0);
760
761 if (size < 1.0f) {
762 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 16);
763 } else {
764 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 14);
765 }
766}
767
768void dActor_c::poisonSplashEffect(const mVec3_c &pos, float size) {
769 mVec3_c shiftedPos(pos, 6500.0f);
770
771 u32 splashInfo = 6 | (mLayer << 16);
772
773 mVec3_c splashSize(size, size, size);
774 dEffActorMng_c::m_instance->createWaterSplashEff(shiftedPos, splashInfo, -1, splashSize);
775
776 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH_POISON, pos, 0);
777
778 if (size < 1.0f) {
779 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 23);
780 } else {
781 dBg_c::m_bg_p->setWaterInWave(pos.x, pos.y, 21);
782 }
783}
784
785bool dActor_c::checkCarried(int *playerNum) {
786 for (int i = 0; i < 4; i++) {
787 dAcPy_c *player = daPyMng_c::getPlayer(i);
788 if (player != nullptr && fManager_c::searchBaseByID(player->mCarryActorID) == this) {
789 if (playerNum != nullptr) {
790 *playerNum = *player->getPlrNo();
791 }
792 return true;
793 }
794 }
795 if (playerNum != nullptr) {
796 *playerNum = -1;
797 }
798 return false;
799}
800
802 mCc.release();
803}
804
806 mCc.entry();
807}
void getCcBounds(sRangeDataF &bounds)
float m_1b
Definition d_actor.hpp:341
static u8 mExecStopReq
The actors for which the execute operation is requested to be disabled.
Definition d_actor.hpp:401
static u8 mExecStop
The actors for which the execute operation is currently disabled.
Definition d_actor.hpp:403
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:397
u8 mExecStopMask
The mask required to disable the execute operation for the actor.
Definition d_actor.hpp:379
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:701
static bool screenCullCheck(const mVec3_c &pos, const sRangeDataF &visibleBound, sRangeDataF destroyBound, u8 areaID)
Checks if the actor should be culled due to being outside the screen.
virtual bool setEatGlupDown(dActor_c *eatingActor)
Callback for when the actor is about to be fully swallowed.
Definition d_actor.cpp:627
bool mBlockHit
Whether a block below the actor was hit.
Definition d_actor.hpp:365
dAcPy_c * searchNearPlayer(mVec2_c &delta)
Gets the closest player to the actor and its distance.
Definition d_actor.cpp:191
sRangeDataF mDestroyBound
Definition d_actor.hpp:353
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:540
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:370
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:695
u8 m_00
Seems to be a player bit flag.
Definition d_actor.hpp:334
static u8 * m_tmpCtSpawnFlags
Temporary storage for the next created sprite actor's spawn flags. See mpSpawnFlags.
Definition d_actor.hpp:410
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:381
virtual void setSpinLiftUpActor(dActor_c *carryingActor)
Callback for when the actor is picked up by another actor.
Definition d_actor.cpp:613
virtual void reviveCc()
Enables the actor's collision.
Definition d_actor.cpp:805
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:416
static u8 m_tmpCtLayerNo
Temporary storage for the next constructed actor's layer. See mLayer.
Definition d_actor.hpp:407
u8 * mpSpawnFlags
The spawn flags for the actor. See ACTOR_SPAWN_FLAG_e.
Definition d_actor.hpp:358
bool areaCullCheck(const mVec3_c &pos, const sRangeDataF &bound, u8 areaID) const
Checks if the actor should be culled due to zone limits.
Definition d_actor.cpp:379
dBc_c mBc
The actor-to-tile collision sensor.
Definition d_actor.hpp:345
static getTrgToSrcDirFunc mGetTrgToSrcDirFunc
The direction detection function.
Definition d_actor.hpp:406
static u8 m_tmpCtSpriteLayerNo
Temporary storage for the next created sprite actor's layer. See mLayer.
Definition d_actor.hpp:419
virtual void poisonSplashEffect(const mVec3_c &pos, float size)
Generates a poison water splash effect.
Definition d_actor.cpp:768
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:728
virtual void setEatTongue(dActor_c *eatingActor)
Callback for when the actor is targeted by Yoshi's tongue.
Definition d_actor.cpp:615
@ EAT_POINTS_200
Awards 200 points (default).
Definition d_actor.hpp:22
@ EAT_POINTS_NONE
No points are awarded.
Definition d_actor.hpp:24
virtual mVec2_c getLookatPos() const
Gets the position players look to when focused on the actor.
Definition d_actor.cpp:576
@ SKIP_SCREEN_CHECK
The actor position is not checked against the screen boundaries.
Definition d_actor.hpp:79
@ SKIP_RIDE_CHECK
The actor's ride status is not checked.
Definition d_actor.hpp:80
@ SKIP_ACTOR_DELETE
The actor is not deleted if out of screen.
Definition d_actor.hpp:78
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:396
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:665
mVec2_c m_1eb
Definition d_actor.hpp:348
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:413
u8 mKind
The actor's kind. Value is a STAGE_ACTOR_KIND_e.
Definition d_actor.hpp:377
u8 mEatState
The actor's eat state. Value is a EAT_STATE_e.
Definition d_actor.hpp:368
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
dCc_c mCc
The actor-to-actor collision sensor.
Definition d_actor.hpp:344
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:40
virtual bool ActorDrawCullCheck()
Checks if the actor is out of view.
Definition d_actor.cpp:445
dAcPy_c * searchCarryFukidashiPlayer(int fukidashiAction)
Searches the closest player who has not yet performed the given action.
Definition d_actor.cpp:552
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:350
virtual void removeCc()
Disables the actor's collision.
Definition d_actor.cpp:801
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:693
static u8 mDrawStopReq
The actor kinds for which the draw operation is requested to be disabled.
Definition d_actor.hpp:402
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:265
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:684
int mAttentionMode
Definition d_actor.hpp:373
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:369
u8 mAreaNo
The actor's zone ID.
Definition d_actor.hpp:355
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:582
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:378
bool ActorScrOutCheck(u16 flags)
Checks if the actor is out of gameplay and optionally deletes it.
Definition d_actor.cpp:414
u32 mComboMultiplier
The current combo multiplier obtained by the actor by colliding with other actors.
Definition d_actor.hpp:338
virtual void cancelFunsuiActSide(int)
Definition d_actor.cpp:697
virtual void cancelFunsuiActVanish()
Definition d_actor.cpp:699
virtual void setEatMouth(dActor_c *eatingActor)
Callback for when the actor is being eaten.
Definition d_actor.cpp:621
u32 mEatenByID
The unique identifier of the eating actor.
Definition d_actor.hpp:367
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:476
virtual void waterSplashEffect(const mVec3_c &pos, float size)
Generates a water splash effect.
Definition d_actor.cpp:732
void killActor(s8 playerId, int noScore)
Kills the actor and optionally awards points to one or all players.
Definition d_actor.cpp:588
virtual void setEatTongueOff(dActor_c *eatingActor)
Callback for when the eating action is canceled.
Definition d_actor.cpp:619
virtual void block_hit_init()
Callback for when a block directly beneath the actor is hit.
Definition d_actor.cpp:580
@ EAT_STATE_EATEN
The actor has been successfully eaten.
Definition d_actor.hpp:31
bool checkCarried(int *playerNum)
Returns whether the actor is being carried by a player.
Definition d_actor.cpp:785
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:458
virtual void yoganSplashEffect(const mVec3_c &pos, float size)
Generates a lava splash effect.
Definition d_actor.cpp:751
@ COLL_FOOT
The actor can collide with the ground.
Definition d_actor.hpp:66
@ COLL_HEAD
The actor can collide with ceilings.
Definition d_actor.hpp:63
@ COLL_WALL_L
The actor can collide with walls on its left.
Definition d_actor.hpp:64
@ COLL_WALL_R
The actor can collide with walls on its right.
Definition d_actor.hpp:65
@ COLL_NONE
The actor does not collide with any surface.
Definition d_actor.hpp:62
static const float smc_CULL_AREA_YLIMIT
The default max bound Y size.
Definition d_actor.hpp:398
dRc_c mRc
The actor's ride surface manager.
Definition d_actor.hpp:346
@ ACTOR_SPAWNED
The actor is spawned.
Definition d_actor.hpp:71
@ ACTOR_NO_RESPAWN
The actor must not respawn after deletion.
Definition d_actor.hpp:72
virtual void calcEatInScale(dActor_c *eatingActor)
Adjusts the actor's scale while being eaten.
Definition d_actor.cpp:675
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:335
virtual int preDraw()
pre method for the draw operation.
Definition d_actor.cpp:141
sRangeDataF mMaxBound
Definition d_actor.hpp:352
virtual s8 * getPlrNo()
Gets the player number associated with the actor. See mPlayerNo.
Definition d_actor.hpp:107
virtual void setAfterEatScale()
Restores the actor's scale once spat out.
Definition d_actor.cpp:648
static const mVec2_c smc_FUKIDASHI_RANGE
The default trigger area size for displaying action prompts.
Definition d_actor.hpp:399
virtual bool setEatSpitOut(dActor_c *eatingActor)
Callback for when the actor is about to be spat out.
Definition d_actor.cpp:623
@ STAGE_ACTOR_GENERIC
A generic stage actor (default).
Definition d_actor.hpp:48
virtual void calcSpitOutPos(dActor_c *eatingActor)
Calculates the position where the actor will be spat out.
Definition d_actor.cpp:652
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:395
u16 * mpDeleteVal
Definition d_actor.hpp:359
static searchNearPlayerFunc mSearchNearPlayerFunc
The player search function.
Definition d_actor.hpp:405
u8 mLayer
The actor's layer.
Definition d_actor.hpp:380
mVec2_c mVisibleAreaOffset
The offset applied to the area size.
Definition d_actor.hpp:351
bool(* getTrgToSrcDirFunc)(float trgX, float srcX)
Gets the direction the target position is in, from the source position's viewpoint.
Definition d_actor.hpp:274
~dActor_c()
Destroys the actor.
Definition d_actor.cpp:81
u8 mBgCollFlags
The collision directions that the actor can respond to.
Definition d_actor.hpp:356
static u8 mDrawStop
The actor kinds for which the draw operation is currently disabled.
Definition d_actor.hpp:404
EAT_POINTS_e mEatPoints
The score awarded when the actor is eaten by Yoshi.
Definition d_actor.hpp:372
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
Course data file holder. A course data file contains the actual course elements - areas,...
Definition d_cd.hpp:11
static dMultiMng_c * mspInstance
The instance of this class.
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.
@ POPUP_TYPE_1000
The number 1000.
@ POPUP_TYPE_200
The number 200.
MAIN_STATE_e
The possible operation results.
Definition f_base.hpp:33
@ SUCCESS
The operation was completed successfully.
Definition f_base.hpp:36
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:67
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:42
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:43
fBaseID_e mUniqueID
The base's unique identifier.
Definition f_base.hpp:58
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:59
A 3x4 matrix.
Definition m_mtx.hpp:9
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
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.
bool someCheck(mVec3_c *a, sRangeDataF *b)
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 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.