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