NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_a_ice.cpp
1#include <game/bases/d_a_ice.hpp>
2#include <game/bases/d_a_player_manager.hpp>
3#include <game/bases/d_actor_manager.hpp>
4#include <game/bases/d_bg_parameter.hpp>
5#include <game/bases/d_enemy.hpp>
6#include <game/bases/d_enemy_manager.hpp>
7#include <game/bases/d_game_com.hpp>
8#include <game/bases/d_multi_manager.hpp>
9#include <game/bases/d_quake.hpp>
10#include <game/bases/d_s_stage.hpp>
11#include <game/bases/d_score_manager.hpp>
14
15ACTOR_PROFILE(ICE_ACTOR, daIce_c, BIT_FLAG(11));
16
17mVec3_c l_mdl_defsize[daIce_c::ICE_TYPE_COUNT] = {
18 dIceParam_c::smc_ICE_DEFSIZE_SQUARE,
19 dIceParam_c::smc_ICE_DEFSIZE_TATE,
20 dIceParam_c::smc_ICE_DEFSIZE_YOKO,
21 dIceParam_c::smc_ICE_DEFSIZE_BIG_SQUARE,
22 dIceParam_c::smc_ICE_DEFSIZE_BIG_TATE,
23 dIceParam_c::smc_ICE_DEFSIZE_BIG_YOKO
24};
25
26const float l_float_speed[daIce_c::ICE_WEIGHT_COUNT] = { 0.8f, 0.8f, 0.8f, 0.8f };
27const float l_toge_float_speed[daIce_c::ICE_WEIGHT_COUNT] = { 0.5f, 0.5f, 0.5f, 0.5f };
28const float l_attach_float_speed[daIce_c::ICE_WEIGHT_COUNT] = { 0.3f, 0.35f, 0.425f, 0.8f };
29
30const sCcDatNewF l_ice_cc = {
31 {
32 { 0.0f, 0.0f },
33 { 4.0f, 4.0f }
34 },
35 CC_KIND_ENEMY,
36 CC_ATTACK_NONE,
37 BIT_FLAG(CC_KIND_PLAYER) | BIT_FLAG(CC_KIND_PLAYER_ATTACK) | BIT_FLAG(CC_KIND_YOSHI) |
38 BIT_FLAG(CC_KIND_ENEMY) | BIT_FLAG(CC_KIND_ITEM) | BIT_FLAG(CC_KIND_TAMA) | BIT_FLAG(CC_KIND_KILLER),
39 BIT_FLAG(CC_ATTACK_ICE_BREAK) | BIT_FLAG(CC_ATTACK_YOSHI_FIRE) | BIT_FLAG(CC_ATTACK_YOSHI_BULLET),
40 CC_STATUS_NONE,
42};
43
44STATE_DEFINE(daIce_c, Freeze);
45STATE_DEFINE(daIce_c, Cover);
48STATE_DEFINE(daIce_c, PushSink);
49STATE_DEFINE(daIce_c, Float);
50STATE_DEFINE(daIce_c, SmallFloat);
51STATE_DEFINE(daIce_c, FloatWait);
52STATE_DEFINE(daIce_c, TogeFloat);
53STATE_DEFINE(daIce_c, ShakeFloat);
58STATE_DEFINE(daIce_c, YoganDive);
59STATE_DEFINE(daIce_c, Carry);
60STATE_DEFINE(daIce_c, Throw);
62STATE_DEFINE(daIce_c, Melt_Normal);
63
65 createMdl();
66
67 mScale.set(1.0f, 1.0f, 1.0f);
69 mInitType = (InitType_e) ACTOR_PARAM(InitType);
70 if (!ACTOR_PARAM(Unbreakable)) {
72 }
73 if (!ACTOR_PARAM(NoCarry)) {
75 }
76
77 mSpeedMax.y = -6.0f;
78 mAnm.setPlayMode(m3d::FORWARD_LOOP, 0);
79 mMdl.setAnm(mAnm, 1.0f);
80
81 dEn_c *parent = (dEn_c *) getConnectParent();
82 mPosDiff = parent->mPos - mPos;
83 mpIceMng = &parent->mIceMng;
84
85 calcMdl();
87 mIsWater = FALSE;
88 mPrevPosX = mPos.x;
89
90 switch (mInitType) {
91 case INIT_FREEZE:
93 changeState(StateID_Freeze);
94 break;
95 case INIT_COVER:
96 changeState(StateID_Cover);
97 break;
98 case INIT_AIR:
99 changeState(StateID_Air);
100 break;
101 case INIT_FALL:
102 changeState(StateID_Fall);
103 break;
104 case INIT_WATER:
105 case INIT_WATER_TOGE:
106 mIsWater = TRUE;
107 switch (dBc_c::checkWater(mPos.x, mPos.y, mLayer, nullptr)) {
108 case dBc_c::WATER_CHECK_YOGAN:
109 case dBc_c::WATER_CHECK_POISON:
110 yoganEffect();
111 mSpeed.y = -12.0f;
112 changeState(StateID_YoganDive);
113 break;
114 default:
115 changeState(StateID_Sink);
116 break;
117 }
118 break;
119 case INIT_HOP:
120 changeState(StateID_Hop);
121 break;
122 default:
123 changeState(StateID_Land);
124 break;
125 }
126 mPrevPos = mPos;
127 return SUCCEEDED;
128}
129
131 int iceType = ACTOR_PARAM(IceType);
132 mAllocator.createFrmHeap(-1, mHeap::g_gameHeaps[mHeap::GAME_HEAP_DEFAULT], nullptr, 0x20);
133
134 mResFileMdl = dResMng_c::m_instance->getRes("ice", "g3d/ice.brres");
135 const static char *cs_ice_mdl_name[daIce_c::ICE_TYPE_COUNT] = {
136 "ice_A1", "ice_B1", "ice_C1",
137 "ice_A2", "ice_B2", "ice_C2"
138 };
139 const char *iceMdlName = cs_ice_mdl_name[iceType];
140 nw4r::g3d::ResMdl mdl = mResFileMdl.GetResMdl(iceMdlName);
141 mMdl.create(mdl, &mAllocator, 0x24);
143 mMdl.setPriorityDraw(127, 128);
144
145 const static char *cs_ice_anm_name[daIce_c::ICE_TYPE_COUNT] = {
146 "ice_A1", "ice_B1", "ice_C1",
147 "ice_A2", "ice_B2", "ice_C2"
148 };
149 const char *iceAnmName = cs_ice_anm_name[iceType];
150 mResFileAnm = mResFileMdl.GetResAnmTexSrt(iceAnmName);
151 mAnm.create(mdl, mResFileAnm, &mAllocator);
153
154 mAllocator.adjustFrmHeap();
155}
156
159 return NOT_READY;
160 }
161
162 dEn_c *parent = (dEn_c *) getConnectParent();
163 if (parent == nullptr) {
165 return NOT_READY;
166 }
167
168 if (mCollEntryTimer > 0) {
169 if (--mCollEntryTimer == 0) {
170 mCc.mCcData.mBase.mSize.set(mSize.x * 0.5f, mSize.y * 0.5f);
171 mCc.mCcData.mVsDamage |= BIT_FLAG(CC_ATTACK_SPIN_LIFT_UP);
172 mCc.mCcData.mAttack = CC_ATTACK_NONE;
173 mBgCtr.entry();
174 }
175 }
176 if (!mBreakRequested && isQuakeDamage() && dQuake_c::m_instance->mFlags & 6) {
177 quakeDamage();
178 return NOT_READY;
179 }
180
181 mPrevPosX = mPos.x;
182 return SUCCEEDED;
183}
184
186 mStateMgr.executeState();
187 mAnm.play();
188 mIceEfMaker.execute();
189 if (!isState(StateID_Melt_Normal)) {
190 enlargeBgc();
191 mBgCtr.calc();
192 if (canCarry()) {
193 mVec2_c triggerSize(mSize.x * 0.5f + 2.0f, mSize.y * 0.5f + 2.0f);
194 carryFukidashiCheck(17, triggerSize);
195 } else if (mCarryFukidashiPlayerNo >= 0) {
196 carryFukidashiCancel(17, -1);
197 }
198 }
199 mPrevPos = mPos;
201 return SUCCEEDED;
202}
203
205 mMdl.entry();
206 return SUCCEEDED;
207}
208
210 for (int i = 0; i < PLAYER_COUNT; i++) {
211 dAcPy_c *player = daPyMng_c::getPlayer(i);
212 if (player != nullptr && fManager_c::searchBaseByID(player->mCarryActorID) == this) {
213 player->cancelCarry(this);
214 }
215 }
216 if (mCarryFukidashiPlayerNo >= 0) {
217 carryFukidashiCancel(17, -1);
218 }
219}
220
222 mIceEfMaker.fin();
223 return SUCCEEDED;
224}
225
227 mVec3_c pos = mModelPos;
228 mAng3_c ang = mAngle;
229 changePosAngle(&pos, &ang, 1);
230 mMatrix.trans(pos.x, pos.y, pos.z);
231 mMatrix.YrotM(ang.y);
232 mMatrix.XrotM(ang.x);
233 mMatrix.concat(mMtx_c::createTrans(0.0f, mSize.y * 0.5f, 0.0f));
234 mMatrix.ZrotM(ang.z);
235 mMatrix.concat(mMtx_c::createTrans(0.0f, mSize.y * -0.5f, 0.0f));
236 mMdl.setLocalMtx(&mMatrix);
237 mMdl.setScale(mScale);
238 mMdl.calc(false);
239}
240
241bool daIce_c::vf68(dBg_ctr_c *collider) {
242 if (collider != nullptr && collider->mFlags & 0x800 && collider->mpActor->checkCarried(nullptr)) {
244 return false;
245 }
246
247 return true;
248}
249
251 if (mBc.mpCtrFoot != nullptr) {
252 return daIce_c::vf68(mBc.mpCtrFoot);
253 }
254 return true;
255}
256
258 initSize(size);
259 initPos();
260 initWeight();
262 initEffect(scale);
263 mIceEfMaker.createEffect(dIceEfMaker_c::ICE_EF_FREEZE);
264 mIceEfMaker.createEffect(dIceEfMaker_c::ICE_EF_SMOKE);
265}
266
267void daIce_c::initSize(const mVec3_c &scale) {
268 mScale = scale;
269
270 mVec3_c blockSize;
271 blockSize.x = l_mdl_defsize[ACTOR_PARAM(IceType)].x * scale.x;
272 blockSize.y = l_mdl_defsize[ACTOR_PARAM(IceType)].y * scale.y;
273 blockSize.z = l_mdl_defsize[ACTOR_PARAM(IceType)].z * scale.z;
274
275 mSize = blockSize;
276 mCenterOffs.set(0.0f, mSize.y * 0.5f, 0.0f);
277}
278
280 if (isState(StateID_Land)) {
281 float height = 0.0f;
282 if (calcLandLine(height)) {
283 mPos.y = height + 1.0f;
284 }
285 mLastPos.y = mPos.y + 8.0f;
286 } else if (isState(StateID_Fall)) {
287 float height = 0.0f;
288 if (calcLandLine(height)) {
289 mPos.y = height + 1.0f;
290 }
291 mLastPos.y = mPos.y + 8.0f;
292 }
293}
294
296 float area = mSize.x * mSize.y;
297 if (area < 600.0f) {
298 mWeightType = ICE_WEIGHT_LIGHTEST;
299 } else if (area < 1536.0f) {
300 mWeightType = ICE_WEIGHT_LIGHT;
301 } else if (area < 3072.0f) {
302 mWeightType = ICE_WEIGHT_HEAVY;
303 } else {
304 mWeightType = ICE_WEIGHT_HEAVIEST;
305 }
306}
307
309 dEn_c *parent = (dEn_c *) getConnectParent();
310 mLayer = parent->mLayer;
311 setBc();
312 if (isState(StateID_Land)) {
313 mBcPointWall.mFlags |= BIT_FLAG(30);
314 }
315
316 float sides[] = { 1.0f, -1.0f };
317 if (isState(StateID_Land) || isState(StateID_Air) || isState(StateID_Fall)) {
318 mBc.checkWall(&sides[0]);
319 mBc.checkWall(&sides[1]);
320 }
321
322 mCc.set(this, (sCcDatNewF *) &l_ice_cc);
323 mCc.mCcData.mBase.mOffset.set(0.0f, mSize.y * 0.5f);
324 mCc.mCcData.mBase.mSize.set(mSize.x * 0.5f, mSize.y * 0.5f - 1.0f);
325 mCc.mpFriendActor = parent;
326 if (mCollEntryTimer > 0) {
327 mCc.mCcData.mAttack = CC_ATTACK_SHELL;
328 }
329
330 float w = mSize.x * 0.5f;
331 float h = mSize.y * 0.5f;
332 mBgCtr.set(this, 0.0f, 0.0f, 0.0f, 0.0f, callBackFoot, callBackHead, callBackWall, 1, 0, nullptr);
333 mBgCtr.mpCheckRevFoot = checkRevFoot;
334 mBgCtr.mpCheckRevHead = checkRevHead;
335 mBgCtr.mpCheckRevWall = checkRevWall;
336 mCurrBgcSize.x = 0.0f;
337 mCurrBgcSize.y = 0.0f;
338 mBgcSizeIncrease.x = w / 8.0f;
339 if (mIsWater == FALSE) {
340 mBgcSizeIncrease.y = mSize.y / 8.0f;
341 } else {
342 mBgcSizeIncrease.y = h / 8.0f;
343 }
344 mBgCtr.mLayer = mLayer;
345 mBgCtr.mFlags = 0;
346 mBgCtr.mFlags2 = 1;
347 mBgCtr.setAngleY3((s16 *) &smc_OBJBG_DUMMY_ANGLE);
348 if (mFlags & FLAG_BREAKABLE) {
349 mBgCtr.mFlags |= 0xd68;
350 } else {
351 mBgCtr.mFlags |= 0xc08;
352 }
353 u8 amiLine = 3;
354 if (parent->mFlags & dEn_c::EN_FLAG_2) {
355 amiLine = l_Ami_Line[parent->mAmiLayer];
356 }
357 mCc.mAmiLine = amiLine;
358 mBc.mAmiLine = amiLine;
359 mBgCtr.mAmiLine = amiLine;
360}
361
363 dIceEfScale_c *pScale = nullptr;
364 if (scale != dIceEfScale_c::Zero) {
365 pScale = &scale;
366 }
367 mIceEfMaker.init(ACTOR_PARAM(IceType), pScale);
368}
369
370bool daIce_c::checkInstantBreak(BOOL checkBg) {
371 if (checkPlayerIn()) {
372 return true;
373 }
374
375 if (checkBg && checkBgIn()) {
376 return true;
377 }
378
379 return false;
380}
381
383 float boundLeft = mPos.x - mSize.x * 0.5f;
384 float boundRight = mPos.x + mSize.x * 0.5f;
385 float boundTop = mPos.y + mSize.y;
386 float boundBottom = mPos.y;
387
388 dCc_c *playerColl;
389 dAcPy_c *player;
390 for (int i = 0; i < PLAYER_COUNT; i++) {
391 player = daPyMng_c::getCtrlPlayer(i);
392 if (player != nullptr && daPyMng_c::checkPlayer(i)) {
393 playerColl = &player->mCc;
394 float plLeft = playerColl->getLeftPos();
395 float plRight = playerColl->getRightPos();
396 float plTop = playerColl->getLeftPos(); // [???]
397 float plBottom = playerColl->getRightPos(); // [???]
398 if (plLeft > boundRight || plRight < boundLeft || plBottom > boundTop || plTop < boundBottom) {
399 continue;
400 }
401 return true;
402 }
403 }
404 return false;
405}
406
408 u8 layer = getLayer();
409 u8 amiLine = getAmiLine();
410 float yTop = mPos.y + mSize.y - 4.0f;
411 float yBottom = mPos.y + 4.0f;
412 for (; yTop > yBottom; yTop -= 16.0f) {
413 float xLeft = mPos.x - (mSize.x * 0.5f - 4.0f);
414 float xRight = mPos.x + (mSize.x * 0.5f - 4.0f);
415 while (xLeft < xRight) {
416 if (dBc_c::checkBg(xLeft, yTop, layer, amiLine, 0x819)) {
417 return true;
418 }
419 xLeft += 16.0f;
420 }
421 if (dBc_c::checkBg(xRight, yTop, layer, amiLine, 0x819)) {
422 return true;
423 }
424 }
425 float xLeft = mPos.x - (mSize.x * 0.5f - 4.0f);
426 float xRight = mPos.x + (mSize.x * 0.5f - 4.0f);
427 for (; xLeft < xRight; xLeft += 16.0f) {
428 if (dBc_c::checkBg(xLeft, yBottom, layer, amiLine, 0x819)) {
429 return true;
430 }
431 }
432 return dBc_c::checkBg(xRight, yBottom, layer, amiLine, 0x819);
433}
434
435bool daIce_c::calcLandLine(float &height) {
436 float landLine[40];
437 int linePointCount = 0;
438
439 float xRight;
440 float yBottom;
441 float xLeft;
442
443 xLeft = mPos.x - (mSize.x * 0.5f - 4.0f);
444 xRight = mPos.x + (mSize.x * 0.5f - 4.0f);
445 yBottom = mPos.y + 10.0f;
446
447 for (; xLeft < xRight; xLeft += 8.0f) {
448 mVec3_c pos(xLeft, yBottom, mPos.z);
449 float groundHeight = 0.0f;
450 bool checkRes = dBc_c::checkGround(&pos, &groundHeight, mLayer, 1, -1);
451 landLine[linePointCount] = -3e7f;
452 if (checkRes) {
453 landLine[linePointCount] = groundHeight;
454 }
455 linePointCount++;
456 }
457
458 // Check the rightmost point
459 mVec3_c pos(xRight, yBottom, mPos.z);
460 float groundHeight = 0.0f;
461 bool checkRes = dBc_c::checkGround(&pos, &groundHeight, mLayer, 1, -1);
462 landLine[linePointCount] = -3e7f;
463 if (checkRes) {
464 landLine[linePointCount] = groundHeight;
465 }
466 linePointCount++;
467
468 float maxHeight = -3e7;
469 for (int i = 0; i < linePointCount; i++) {
470 if (landLine[i] > maxHeight && landLine[i] <= yBottom) {
471 maxHeight = landLine[i];
472 }
473 }
474
475 bool result = false;
476 if (maxHeight > mPos.y - 1.0f) {
477 height = maxHeight;
478 result = true;
479 }
480 return result;
481}
482
484 if (mBreakRequested) {
485 return;
486 }
487
488 mVec3_c pos = mPos;
489 if (isState(StateID_Carry)) {
490 pos = calcCarryPos();
491 mPos = pos;
492 } else if (isState(StateID_Land) && mPos.x != mPrevPos.x) {
493 u8 dir = mPos.x - mPrevPos.x < 0.0f ? 1 : 0;
494 float side[] = { 1.0f, -1.0f };
495 if (mBc.checkWallEnm(&side[dir])) {
496 pos = mPos;
497 mPos.x = mPrevPos.x;
498 mLastPos = mPos;
499 }
500 }
501 mModelPos = pos;
502 u8 mask =
507 if (!(mExecStop & mask) && mShake) {
508 shake();
509 }
510 if (!isState(StateID_Cover) && !isState(StateID_Melt_Normal)) {
511 enemyAttach();
512 }
513 calcMdl();
514}
515
517 if (getManager()->mThawTimer < 3) {
518 return false;
519 }
520 if (isState(StateID_Freeze)) {
521 if (getConnectParent()->mProfName == fProf::EN_IBARAMUSHI) {
522 return true;
523 }
524 mVec3_c pos(mPos.x, mPos.y - 1.0f, mPos.z);
525 float groundHeight = 0.0f;
526 if (dBc_c::checkGround(&pos, &groundHeight, mLayer, 1, -1)) {
527 if (groundHeight > pos.y - 2.0f) {
528 return true;
529 }
530 }
531 }
532 if (isState(StateID_Land) || isState(StateID_Hop)) {
533 if (mBc.isFoot()) {
534 return true;
535 }
536 }
537
538 return false;
539}
540
542 dActor_c *parent = (dActor_c *) getConnectParent(); // [Unused]
543 if (!ACTOR_PARAM(NoQuakeScore)) {
544 dEnemyMng_c::m_instance->breakdownSE(dEnemyMng_c::m_instance->m_154, mPos);
545 dEnemyMng_c::m_instance->incQuakeComboCount(0);
546 int comboCount = dEnemyMng_c::m_instance->m_154;
547 if (comboCount >= 0) {
548 if (comboCount >= 8) {
549 dMultiMng_c::mspInstance->setClapSE();
550 }
551 dScoreMng_c::getInstance()->UnKnownScoreSet(this, comboCount, 0.0f, 24.0f);
552 }
553 }
554 breakReq(dGameCom::rndInt(2), -1);
555}
556
557void daIce_c::combobreakReq(int dir, dActor_c *initiator) {
558 dEn_c *parent = (dEn_c *) getConnectParent();
559 int comboCount = -1;
560 int plrNo = initiator->getPlrNo();
561 if (plrNo >= 0 && plrNo < PLAYER_COUNT) {
562 initiator->mComboMultiplier++;
563 if (initiator->mComboMultiplier >= 8) {
564 initiator->mComboMultiplier = 8;
565 }
566 comboCount = initiator->mComboMultiplier;
567 }
568 if (comboCount >= 0) {
569 int comboScore = parent->mCombo.getComboScore(comboCount);
570 if (comboScore >= 8) {
571 dMultiMng_c::mspInstance->setClapSE();
572 }
573 dScoreMng_c::getInstance()->ScoreSet(this, comboScore, plrNo);
574 }
575 breakReq(dir, -1);
576 parent->mPlayerNo = plrNo;
577}
578
579void daIce_c::plcombobreakReq(int dir, dActor_c *initiator) {
580 dEn_c *parent = (dEn_c *) getConnectParent();
581 int comboCount = -1;
582 int plrNo = initiator->getPlrNo();
583 if (plrNo >= 0 && plrNo < PLAYER_COUNT) {
584 comboCount = dEnCombo_c::calcPlComboCnt(initiator);
585 }
586 if (comboCount >= 0) {
587 int comboScore = parent->mCombo.getComboScore(comboCount);
588 if (comboScore >= 8) {
589 dMultiMng_c::mspInstance->setClapSE();
590 }
591 dScoreMng_c::getInstance()->ScoreSet(this, comboScore, plrNo);
592 }
593 breakReq(dir, -1);
594 parent->mPlayerNo = plrNo;
595}
596
597void daIce_c::treadcombobreakReq(int dir, dActor_c *initiator) {
598 dEn_c *parent = (dEn_c *) getConnectParent();
599
600 int comboScore = parent->mCombo.getFumiScore(initiator);
601 if (comboScore >= 8) {
602 dMultiMng_c::mspInstance->setClapSE();
603 }
604
605 dScoreMng_c::getInstance()->ScoreSet(this, comboScore, initiator->getPlrNo());
606 breakReq(dir, -1);
607 parent->mPlayerNo = initiator->getPlrNo();
608}
609
610void daIce_c::starbreakReq(int dir, dActor_c *initiator) {
611 dEn_c *parent = (dEn_c *) getConnectParent();
612
613 int comboScore = parent->mCombo.getStarScore(initiator);
614 if (comboScore >= 8) {
615 dMultiMng_c::mspInstance->setClapSE();
616 }
617
618 dScoreMng_c::getInstance()->ScoreSet(this, comboScore, initiator->getPlrNo());
619 breakReq(dir, -1);
620 parent->mPlayerNo = initiator->getPlrNo();
621}
622
624 if (ACTOR_PARAM(CollisionMode) == COLLISION_NONE) {
625 mBc.set(this, nullptr, nullptr, nullptr);
626 mBc.mpRc = nullptr;
627 return;
628 }
629
630 mBcPointFoot.mFlags = SENSOR_IS_MANY;
631 mBcPointFoot.mInfMargin = -(int) ((mSize.x * 0.5f - 3.0f) * 0x1000);
632 mBcPointFoot.mSupMargin = ((mSize.x * 0.5f - 3.0f) * 0x1000);
633 mBcPointFoot.mOffset = 0;
634
635 mBcPointHead.mFlags = SENSOR_IS_MANY;
636 mBcPointHead.mInfMargin = -(int) ((mSize.x * 0.5f - 3.0f) * 0x1000);
637 mBcPointHead.mSupMargin = ((mSize.x * 0.5f - 3.0f) * 0x1000);
638 mBcPointHead.mOffset = mSize.y * 0x1000;
639
640 mBcPointWall.mFlags = SENSOR_IS_MANY;
641 mBcPointWall.mInfMargin = 0x4000;
642 mBcPointWall.mSupMargin = (mSize.y - 4.0f) * 0x1000;
643 mBcPointWall.mOffset = (mSize.x * 0.5f - 0.5f) * 0x1000;
644
646}
647
649 if (ACTOR_PARAM(CollisionMode) == COLLISION_NONE) {
650 mBc.set(this, nullptr, nullptr, nullptr);
651 mBc.mpRc = nullptr;
652 return;
653 }
654
655 daPyMng_c::getPlayer(mPlayerNo); // [Unused return value]
656
657 mBcPointFoot.mFlags = SENSOR_IS_MANY;
658 mBcPointFoot.mInfMargin = -(int) ((mSize.x * 0.5f - 8.0f) * 0x1000);
659 mBcPointFoot.mSupMargin = ((mSize.x * 0.5f - 8.0f) * 0x1000);
660 mBcPointFoot.mOffset = 0;
661
662 mBcPointHead.mFlags = SENSOR_IS_MANY;
663 mBcPointHead.mInfMargin = -0x2000;
664 mBcPointHead.mSupMargin = 0x2000;
665 mBcPointHead.mOffset = (mSize.y + 1.0f) * 0x1000;
666
667 mBcPointWall.mFlags = SENSOR_IS_MANY;
668 mBcPointWall.mInfMargin = 0x6000;
669 mBcPointWall.mSupMargin = (mSize.y - 6.0f) * 0x1000;
670 if (mSize.x < 26.0f) {
671 mBcPointWall.mOffset = 0x2000;
672 } else {
673 mBcPointWall.mOffset = mSize.x * 0.5f * 0x1000;
674 }
675
677}
678
680 const static EnlargeFunc cs_enlarge_f[] = {
682 };
683
684 (this->*cs_enlarge_f[mIsWater])();
685}
686
688 float width = mSize.x * 0.5f;
690 if (mCurrBgcSize.x >= width - 1.0f) {
691 mCurrBgcSize.x = width - 1.0f;
692 }
693
695 if (mCurrBgcSize.y >= mSize.y - 1.0f) {
696 mCurrBgcSize.y = mSize.y - 1.0f;
697 }
698
699 mBgCtr.setOfsX1(-mCurrBgcSize.x);
700 mBgCtr.setOfsY1(mCurrBgcSize.y);
701 mBgCtr.setOfsX2(mCurrBgcSize.x);
702 mBgCtr.setOfsY2(0.0f);
703}
704
706 float width = mSize.x * 0.5f;
708 if (mCurrBgcSize.x >= width - 1.0f) {
709 mCurrBgcSize.x = width - 1.0f;
710 }
711
712 float height = mSize.y * 0.5f;
714 if (mCurrBgcSize.y >= height - 1.0f) {
715 mCurrBgcSize.y = height - 1.0f;
716 }
717
718 mBgCtr.setOfsX1(-mCurrBgcSize.x);
719 mBgCtr.setOfsY1(height + mCurrBgcSize.y);
720 mBgCtr.setOfsX2(mCurrBgcSize.x);
721 mBgCtr.setOfsY2(height - mCurrBgcSize.y);
722}
723
725 dActor_c *parent = (dActor_c *) getConnectParent();
726 parent->mPos = mModelPos + mPosDiff;
727}
728
730 if (mInitType == INIT_WATER_TOGE) {
732 } else {
733 normalShake();
734 }
735}
736
738 // 2 frames left, 2 frames right
739 float shakeDir = (dScStage_c::m_exeFrame & 2) ? 1.0f : -1.0f;
740 mModelPos.x += shakeDir;
741}
742
744 mShakeRotSpeed += 0x180;
745 if (mShakeRotSpeed > 0x5000) {
746 mShakeRotSpeed = 0x5000;
747 }
749 float sin = mAng(mShakeRotAngle).sin();
750 mModelPos.x += sin;
751 mAngle.z = mShakeRotAmplitude * sin;
752}
753
755 const static short cs_angle_dir[] = { -0x200, 0x200 };
756
757 dEn_c *parent = (dEn_c *) getConnectParent();
758 mFloatAngle += cs_angle_dir[parent->mBoyoMng.mDirection & 1];
759 mAngle.z = mAng(mFloatAngle).sin() * 0x300;
760}
761
765 if (mSpeedF <= mFloatTargetSpeed) {
767 }
768 } else if (mSpeedF < mFloatTargetSpeed) {
770 if (mSpeedF >= mFloatTargetSpeed) {
772 }
773 }
774 mSpeed.x = -(mSpeedF * 4.0f) * mAngle.z.sin();
775 mSpeed.y = mSpeedF * mAngle.z.cos();
776 mSpeed.z = 0.0f;
777 sLib::chase(&mExtraFloatSpeedX, 0.0f, 0.05f);
779}
780
782 bool result = false;
783
784 if (actor->mKind == STAGE_ACTOR_PLAYER) {
785 dAcPy_c *player = (dAcPy_c *) actor;
786 if (player->isMameAction()) {
789 result = true;
790 }
791 } else {
794 result = true;
795 } else if (player->mSpeed.y < -3.0f) {
797 result = true;
798 }
799 }
800 } else if (actor->mKind == STAGE_ACTOR_YOSHI) {
801 daYoshi_c *yoshi = (daYoshi_c *) actor;
804 result = true;
805 } else if (yoshi->mSpeed.y < -3.0f) {
807 result = true;
808 }
809 }
810
811 return result;
812}
813
817
819 if (isState(StateID_Fall) || isState(StateID_Air)) {
820 if (!(actor->mKind != STAGE_ACTOR_PLAYER && actor->mKind != STAGE_ACTOR_YOSHI)) {
821 daPlBase_c *pl = (daPlBase_c *) actor;
822
823 int plrNo = actor->getPlrNo();
824 if (plrNo >= 0 && plrNo < PLAYER_COUNT) {
825 dQuake_c::getInstance()->startShock(actor->getPlrNo(), dQuake_c::TYPE_6, 2, 0, false);
826 }
827
828 pl->setDamage(this, daPlBase_c::DAMAGE_HEAD_BONK);
829 return true;
830 }
831 }
832 return false;
833}
834
836 return false;
837}
838
839bool daIce_c::checkSideBreak(dActor_c *actor, int direction) {
840 if (isState(StateID_Throw)) {
841 if (!(actor->mKind != STAGE_ACTOR_PLAYER && actor->mKind != STAGE_ACTOR_YOSHI)) {
842 daPlBase_c *pl = (daPlBase_c *) actor;
843 pl->setDamage(this, daPlBase_c::DAMAGE_HIP_ATTACK);
844 return true;
845 }
846 }
847
848 return false;
849}
850
852 if (dBc_c::checkWater(mPos.x, mPos.y + mSize.y * 0.7f, mLayer, nullptr) == dBc_c::WATER_CHECK_WATER) {
853 mIceEfMaker.m_00 &= ~BIT_FLAG(1);
854 mIceEfMaker.createEffect(dIceEfMaker_c::ICE_EF_WATER_BREAK);
855 } else {
856 mIceEfMaker.m_00 &= ~BIT_FLAG(1);
857 mIceEfMaker.createEffect(dIceEfMaker_c::ICE_EF_BREAK);
858 mIceEfMaker.hahenEffect();
859 }
860}
861
863 if (dBc_c::checkWater(mPos.x, mPos.y + mSize.y * 0.7f, mLayer, nullptr) == dBc_c::WATER_CHECK_WATER) {
864 mIceEfMaker.m_00 &= ~BIT_FLAG(1);
865 mIceEfMaker.createEffect(dIceEfMaker_c::ICE_EF_WATER_BREAK);
866 } else {
867 mIceEfMaker.m_00 &= ~BIT_FLAG(1);
868 mIceEfMaker.createEffect(dIceEfMaker_c::ICE_EF_RELEASE);
869 mIceEfMaker.hahenEffect();
870 }
871}
872
874 daIce_c *ice = (daIce_c *) self;
875 if (ice->isDestroy()) {
876 return;
877 }
878
879 if (ice->mBgCtr.m_d8 & 0xe || ice->checkUnderBreak(other)) {
880 daPlBase_c *pl = (daPlBase_c *) other;
881 int dir = !(ice->mPos.x >= other->mPos.x);
882 if (!(other->mKind != STAGE_ACTOR_PLAYER && other->mKind != STAGE_ACTOR_YOSHI) && pl->isStar()) {
883 ice->starbreakReq(dir, other);
884 } else {
885 if (other->getPlrNo() == -1) {
886 ice->breakReq(dir, ice->getPlrNo());
887 } else {
888 ice->breakReq(dir, other->getPlrNo());
889 }
890 }
891 }
892}
893
895 daIce_c *ice = (daIce_c *) self;
896 if (ice->isDestroy()) {
897 return;
898 }
899
900 if (!(ice->mFlags & FLAG_BREAKABLE)) {
901 if (
902 ice->isState(StateID_Float) ||
903 ice->isState(StateID_FloatWait) ||
904 ice->isState(StateID_SmallFloat) ||
905 ice->isState(StateID_PushSink)
906 ) {
907 if (ice->checkPushSink(other)) {
908 ice->changeState(StateID_PushSink);
909 }
910 }
911 } else if (ice->mBgCtr.m_d8 & 0xe || ice->checkUpperBreak(other)) {
912 daPlBase_c *pl = (daPlBase_c *) other;
913 int dir = !(ice->mPos.x >= other->mPos.x);
914 if (!(other->mKind != STAGE_ACTOR_PLAYER && other->mKind != STAGE_ACTOR_YOSHI)) {
915 ice->treadcombobreakReq(dir, other);
916 } else {
917 if (other->getPlrNo() == -1) {
918 ice->breakReq(dir, ice->getPlrNo());
919 } else {
920 ice->breakReq(dir, other->getPlrNo());
921 }
922 }
923 }
924}
925
926void daIce_c::callBackWall(dActor_c *self, dActor_c *other, u8 dir) {
927 daPlBase_c *pl = (daPlBase_c *) other;
928 daIce_c *ice = (daIce_c *) self;
929 if (ice->isDestroy()) {
930 return;
931 }
932
933 int breakDir = !(ice->mPos.x >= other->mPos.x);
934 switch (other->mKind) {
936 if (ice->mBgCtr.m_d8 & 0xe || ice->checkSideBreak(pl, dir)) {
937 if (pl->isStar()) {
938 ice->starbreakReq(breakDir, pl);
940 ice->plcombobreakReq(breakDir, pl);
941 } else {
942 ice->breakReq(breakDir, ice->getPlrNo());
943 }
944 }
945 break;
947 if (ice->mBgCtr.m_d8 & 0xe || ice->checkSideBreak(pl, dir)) {
948 if (pl->isStar()) {
949 ice->starbreakReq(breakDir, pl);
950 } else {
951 ice->breakReq(breakDir, ice->getPlrNo());
952 }
953 }
954 break;
955 default:
956 if (ice->mBgCtr.m_d8 & 0xe || ice->checkSideBreak(pl, dir)) {
957 if (pl->getPlrNo() == -1) {
958 ice->breakReq(breakDir, ice->getPlrNo());
959 } else {
960 ice->combobreakReq(breakDir, pl);
961 }
962 }
963 break;
964 }
965}
966
968 return self->mPosDelta.y < 0.0f;
969}
970
972 return self->mPosDelta.y > 0.0f;
973}
974
975bool daIce_c::checkRevWall(dActor_c *self, dActor_c *other, u8 dir) {
976 if (dir == DIR_LR_L) {
977 if (self->mPosDelta.x > 0.0f || self->m_1eb.x > 0.0f) {
978 return true;
979 }
980 } else {
981 if (self->mPosDelta.x < 0.0f || self->m_1eb.x < 0.0f) {
982 return true;
983 }
984 }
985 return false;
986}
987
988void daIce_c::ccCallBack(dCc_c *self, dCc_c *other) {
989 daIce_c *ice = (daIce_c *) self->getOwner();
990 dActor_c *actor = other->getOwner();
991
992 int dir = !(ice->mPos.x <= actor->mPos.x);
993
994 ProfileName otherProf = actor->mProfName;
995 if (otherProf == fProf::ICE_ACTOR) {
996 daIce_c *otherIce = (daIce_c *) actor;
997 if (ice->getManager() == otherIce->getManager()) {
998 return;
999 }
1000 }
1001
1002 if (otherProf == fProf::EN_TOGETEKKYU || otherProf == fProf::EN_BIG_TOGETEKKYU) {
1003 return;
1004 }
1005
1006 if (ice->isDestroy()) {
1007 return;
1008 }
1009
1010 if (other->mCcData.mAttack == CC_ATTACK_ICE_BREAK || other->mCcData.mStatus & CC_STATUS_9) {
1011 ice->breakReq(dir ^ 1, -1);
1012 self->mInfo |= CC_NO_HIT;
1013 return;
1014 }
1015
1016 if (
1017 self->mCcData.mAttack == CC_ATTACK_SHELL &&
1018 (
1019 other->mCcData.mStatus & CC_STATUS_8 ||
1020 other->mCcData.mKind == CC_KIND_BALLOON
1021 )
1022 ) {
1023 ice->breakReq(dir ^ 1, ice->getPlrNo());
1024 self->mInfo |= CC_NO_HIT;
1025 return;
1026 }
1027
1028 if (!(ice->mFlags & FLAG_BREAKABLE)) {
1029 return;
1030 }
1031
1032 if (other->mCcData.mAttack == CC_ATTACK_YOSHI_BULLET || other->mCcData.mAttack == CC_ATTACK_YOSHI_FIRE) {
1033 ice->combobreakReq(dir ^ 1, actor);
1034 self->mInfo |= CC_NO_HIT;
1035 return;
1036 }
1037
1038 if (other->mCcData.mAttack == CC_ATTACK_SHELL) {
1039 if (actor->checkCarried(nullptr)) {
1040 return;
1041 }
1042
1043 bool isShell = actor->mKind == STAGE_ACTOR_ENEMY && ((dEn_c *) actor)->mFlags & dEn_c::EN_IS_SHELL;
1044 if (isShell) {
1045 return;
1046 }
1047
1048 ice->combobreakReq(dir ^ 1, actor);
1049 self->mInfo |= CC_NO_HIT;
1050 return;
1051 }
1052
1053 if (actor->mKind != STAGE_ACTOR_ENEMY && actor->mKind != STAGE_ACTOR_GENERIC) {
1054 return;
1055 }
1056
1057 if (other->mCcData.mKind == CC_KIND_KILLER) {
1058 ice->breakReq(dir ^ 1, -1);
1059 self->mInfo |= CC_NO_HIT;
1060 return;
1061 }
1062
1063 if (
1064 ice->isState(StateID_Carry) &&
1065 other->mCcData.mVsDamage & BIT_FLAG(CC_ATTACK_SHELL) &&
1066 actor->mProfName != fProf::EN_KANITAMA
1067 ) {
1068 ice->breakReq(dir ^ 1, ice->getPlrNo());
1069 self->mInfo |= CC_NO_HIT;
1070 }
1071}
1072
1074 daIce_c *ice = (daIce_c *) self->getOwner();
1075 dActor_c *actor = (dActor_c *) other->getOwner();
1076
1077 int dir = !(ice->mPos.x <= actor->mPos.x);
1078
1079 if (actor->mProfName == fProf::ICE_ACTOR) {
1080 daIce_c *otherIce = (daIce_c *) actor;
1081 if (ice->getManager() == otherIce->getManager()) {
1082 return;
1083 }
1084 }
1085 if (other->mCcData.mAttack == CC_ATTACK_ICE_BREAK) {
1086 ice->breakReq(dir ^ 1, -1);
1087 self->mInfo |= CC_NO_HIT;
1088 }
1089}
1090
1092 breakReq(dGameCom::rndInt(2) & 1, mPlayerNo);
1093}
1094
1095void daIce_c::breakReq(int dir, int playerNo) {
1096 dEn_c *parent = (dEn_c *) getConnectParent();
1097
1098 parent->mIceDeathDirection = dir;
1099 parent->mPlayerNo = playerNo;
1100
1101 getManager()->setDestroyMode(dIceMng_c::DESTROY_BREAK);
1102
1103 if (playerNo >= 0 && playerNo < PLAYER_COUNT) {
1104 int damageScore = parent->mCombo.getDamageScore();
1105 dScoreMng_c::getInstance()->ScoreSet(this, damageScore, playerNo);
1106 }
1107
1108 carryFukidashiCancel(17, -1);
1109 mBgCtr.release();
1110 parent->mPlayerNo = playerNo;
1111 mBreakRequested = TRUE;
1112}
1113
1115 dEn_c *parent = (dEn_c *) getConnectParent();
1116
1117 parent->mPlayerNo = getManager()->mPlrNo;
1118 getManager()->setDestroyMode(dIceMng_c::DESTROY_VANISH);
1119 mBreakRequested = TRUE;
1120}
1121
1123 float width = mSize.x * 0.5f - 6.0f;
1124 if (dBc_c::checkWireNet(mPos.x - width, mPos.y + mSize.y - 6.0f, mLayer)) {
1125 return true;
1126 }
1127 if (dBc_c::checkWireNet(mPos.x + width, mPos.y + mSize.y - 6.0f, mLayer)) {
1128 return true;
1129 }
1130 if (dBc_c::checkWireNet(mPos.x - width, mPos.y + 6.0f, mLayer)) {
1131 return true;
1132 }
1133 if (dBc_c::checkWireNet(mPos.x + width, mPos.y + 6.0f, mLayer)) {
1134 return true;
1135 }
1136 return false;
1137}
1138
1140 mPlayerNo = actor->getPlrNo();
1142 mBgCtr.mpCarryActor = actor;
1145 changeState(StateID_Carry);
1146}
1147
1148bool daIce_c::checkPlHasami(int *plrNo) {
1149 int res = 0;
1150
1151 if (checkPlAttach_Foot(&res, plrNo) && res != 0) {
1152 return true;
1153 } else if (checkPlAttach_Head(&res) && res != 0) {
1154 return true;
1155 } else if (checkPlAttach_Wall(DIR_LR_R, &res) && res == WALL_ATTACH_STUCK) {
1156 return true;
1157 } else if (checkPlAttach_Wall(DIR_LR_L, &res) && res == WALL_ATTACH_STUCK) {
1158 return true;
1159 }
1160
1161 return false;
1162}
1163
1164bool daIce_c::checkPlAttach_Head(BOOL *playerTouchingCeiling) {
1165 if (playerTouchingCeiling != nullptr) {
1166 *playerTouchingCeiling = FALSE;
1167 }
1168
1169 bool result = false;
1170 for (dBc_c *curr = mBgCtr.mpTriggeredHead; curr != nullptr; curr = curr->mTriggeredHeadSensor) {
1171 if (curr->mpOwner != nullptr && !(curr->mpOwner->mKind != STAGE_ACTOR_PLAYER && curr->mpOwner->mKind != STAGE_ACTOR_YOSHI)) {
1172 daPlBase_c *pl = (daPlBase_c *) curr->mpOwner;
1173 if (playerTouchingCeiling != nullptr && pl->isNowBgCross(daPlBase_c::BGC_HEAD)) {
1174 *playerTouchingCeiling = TRUE;
1175 }
1176 result = true;
1177 }
1178 }
1179 return result;
1180}
1181
1182bool daIce_c::checkPlAttach_Foot(BOOL *playerTouchingFloor, int *plrNo) {
1183 if (playerTouchingFloor != nullptr) {
1184 *playerTouchingFloor = FALSE;
1185 }
1186 if (plrNo != nullptr) {
1187 *plrNo = -1;
1188 }
1189
1190 bool result = false;
1191 for (dBc_c *curr = mBgCtr.mpTriggeredFoot; curr != nullptr; curr = curr->mTriggeredFootSensor) {
1192 if (curr->mpOwner != nullptr && !(curr->mpOwner->mKind != STAGE_ACTOR_PLAYER && curr->mpOwner->mKind != STAGE_ACTOR_YOSHI)) {
1193 daPlBase_c *pl = (daPlBase_c *) curr->mpOwner;
1194 if (playerTouchingFloor != nullptr && pl->isNowBgCross(daPlBase_c::BGC_FOOT)) {
1195 *playerTouchingFloor = TRUE;
1196 }
1197 if (plrNo != nullptr) {
1198 *plrNo = pl->getPlrNo();
1199 }
1200 result = true;
1201 }
1202 }
1203 return result;
1204}
1205
1206bool daIce_c::checkPlAttach_Wall(int dir, int *checkResult) {
1207 if (checkResult != nullptr) {
1208 *checkResult = WALL_ATTACH_NONE;
1209 }
1210
1211 bool result = false;
1212 for (dBc_c *curr = mBgCtr.mpTriggeredWall; curr != nullptr; curr = curr->getLinkW(&mBgCtr)) {
1213 if (curr->mpOwner != nullptr && !(curr->mpOwner->mKind != STAGE_ACTOR_PLAYER && curr->mpOwner->mKind != STAGE_ACTOR_YOSHI)) {
1214 daPlBase_c *pl = (daPlBase_c *) curr->mpOwner;
1215 if (dir == DIR_LR_R) {
1216 if (pl->mPos.x >= mPos.x) {
1217 if (checkResult != nullptr && (pl->isNowBgCross(daPlBase_c::BGC_WALL_TOUCH_R_2) || pl->isNowBgCross(daPlBase_c::BGC_SIDE_LIMIT_R))) {
1218 *checkResult = WALL_ATTACH_TOUCH;
1219 if (checkPlHasami_Wall(pl, dir)) {
1220 *checkResult = WALL_ATTACH_STUCK;
1221 }
1222 }
1223 result = true;
1224 }
1225 } else {
1226 if (pl->mPos.x <= mPos.x) {
1227 if (checkResult != nullptr && (pl->isNowBgCross(daPlBase_c::BGC_WALL_TOUCH_L_2) || pl->isNowBgCross(daPlBase_c::BGC_SIDE_LIMIT_L))) {
1228 *checkResult = WALL_ATTACH_TOUCH;
1229 if (checkPlHasami_Wall(pl, dir)) {
1230 *checkResult = WALL_ATTACH_STUCK;
1231 }
1232 }
1233 result = true;
1234 }
1235 }
1236 }
1237 }
1238 return result;
1239}
1240
1242 const static float sc_dir[] = { 1.0f, -1.0f };
1243
1244 daPlBase_c *pl = (daPlBase_c *) actor;
1245
1246 bool result = false;
1247 float margin = -2.0f;
1248 if (mPosDelta.x * sc_dir[dir] > 0.0f) {
1249 margin = 0.0f;
1250 result = true;
1251 } else if (pl->m_d80[(u8) dir] * sc_dir[dir] < 0.0f) {
1252 margin = -1.0f;
1253 result = true;
1254 }
1255
1256 if (result && pl->checkInsideCrossBg(margin)) {
1257 return true;
1258 } else {
1259 return false;
1260 }
1261}
1262
1264 float zero = 0.0f;
1265 dAcPy_c *player = daPyMng_c::getPlayer(mCarriedByPlrNo);
1266
1268 return mPos;
1269 }
1270
1271 mMtx_c carryMtx = mMtx_c::createTrans(player->getCarryPos());
1272 carryMtx.concat(player->getModel()->getMtx());
1273 carryMtx.concat(mMtx_c::createTrans(zero, zero, zero));
1274 mVec3_c carryPos;
1275 carryMtx.multVecZero(carryPos);
1276 return carryPos;
1277}
1278
1279BOOL daIce_c::canCarry() const {
1280 if (!(mFlags & FLAG_CARRYABLE)) {
1281 return false;
1282 }
1283
1284 if (mWeightType >= ICE_WEIGHT_HEAVY) {
1285 return false;
1286 }
1287
1288 if (
1289 isState(StateID_Land) ||
1290 isState(StateID_Hop) ||
1291 isState(StateID_Freeze)
1292 ) {
1293 return true;
1294 }
1295
1296 return false;
1297}
1298
1300 fBase_c *parent = getConnectParent();
1301 if (parent == nullptr) {
1302 return BASE_ID_NULL;
1303 }
1304 return parent->mUniqueID;
1305}
1306
1308 mVec3_c efPos(mPos.x, mPos.y, 6500.0f);
1309
1310 bool cmn = false;
1311 if (dScStage_c::m_instance != nullptr && dScStage_c::m_instance->mCurrWorld == WORLD_8 && dScStage_c::m_instance->mCurrCourse == STAGE_3) {
1312 cmn = true;
1313 }
1314 if (cmn) {
1315 mEf::createEffect("Wm_en_cmnmagmawave", 0, &efPos, nullptr, nullptr);
1316 } else {
1317 mEf::createEffect("Wm_en_magmawave", 0, &efPos, nullptr, nullptr);
1318 }
1319
1320 mIceEfMaker.m_00 &= ~BIT_FLAG(1);
1321 mIceEfMaker.createEffect(dIceEfMaker_c::ICE_EF_YOGAN);
1322 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH_LAVA, efPos, 0);
1323}
1324
1326 mVec3_c efPos(mPos.x, mPos.y, 6500.0f);
1327
1328 mIceEfMaker.m_00 &= ~BIT_FLAG(1);
1329 mIceEfMaker.createEffect(dIceEfMaker_c::ICE_EF_POISON);
1330 dAudio::g_pSndObjMap->startSound(SE_OBJ_CMN_SPLASH_POISON, efPos, 0);
1331}
1332
1333void daIce_c::initializeState_Freeze() {
1334 mCc.entry();
1335}
1336
1337void daIce_c::finalizeState_Freeze() {
1339 enemyAttach();
1340}
1341
1342void daIce_c::executeState_Freeze() {
1343 int plr = -1;
1344 if (checkPlHasami(&plr)) {
1345 breakReq(dGameCom::rndInt(2), plr);
1346 }
1347}
1348
1349void daIce_c::initializeState_Hop() {
1350 dActor_c *parent = (dActor_c *) getConnectParent();
1351
1352 mSpeed.x = parent->mSpeed.x;
1353 mSpeed.y = parent->mSpeed.y;
1354 mSpeed.z = 0.0f;
1355 mAccelY = -0.1875f;
1356
1357 mTimer = 3;
1359
1360 mBcPointFoot.mFlags |= 0x44;
1361 mBcPointHead.mFlags |= 0x44;
1362 mBcPointWall.mFlags |= 0x44;
1363
1364 mPos.z = 1000.0f;
1365 m_23b = 1;
1366}
1367
1368void daIce_c::finalizeState_Hop() {
1369 mBcPointFoot.mFlags &= ~0x44;
1370 mBcPointHead.mFlags &= ~0x44;
1371 mBcPointWall.mFlags &= ~0x44;
1372}
1373
1374void daIce_c::executeState_Hop() {
1375 calcSpeedY();
1376 posMove();
1377 int dir = !(mSpeed.x >= 0.0f);
1378 if (mSpeed.y <= 0.0f) {
1379 bool isFoot = mBc.isFoot();
1380 if (mBc.checkWall(nullptr)) {
1381 mSpeed.x = mSpeed.x * -0.5f;
1382 }
1383 if (mBc.checkFootEnm()) {
1384 if (!isFoot) {
1385 getManager()->set_2c(0);
1386 mSpeed.x = 0.0f;
1387 mCc.entry();
1389 dAudio::g_pSndObjMap->startSound(SE_OBJ_PNGN_ICE_LAND, mPos, 0);
1390 }
1391 mSpeed.y = 0.0f;
1392 } else {
1393 if (checkPlAttach_Wall(dir, nullptr) || checkPlAttach_Foot(nullptr, nullptr)) {
1394 breakReq(dir ^ 1, getManager()->mPlrNo);
1395 }
1396 }
1397 }
1398}
1399
1400void daIce_c::initializeState_Land() {
1401 mSpeed.set(0.0f, 0.0f, 0.0f);
1402 mBcPointWall.mFlags |= BIT_FLAG(30);
1403 mBcPointHead.mFlags |= BIT_FLAG(31);
1404 mBgCtr.mFlags |= BIT_FLAG(11);
1405}
1406
1407void daIce_c::finalizeState_Land() {
1408 mBcPointWall.mFlags &= ~BIT_FLAG(30);
1409 mBcPointHead.mFlags &= ~BIT_FLAG(31);
1410}
1411
1412void daIce_c::executeState_Land() {
1413 float height = 0.0f;
1414 dBc_c::WATER_TYPE_e waterRes = dBc_c::checkWater(mPos.x, mPos.y, mLayer, &height);
1415 if (waterRes == dBc_c::WATER_CHECK_WATER) {
1416 if (height >= mPos.y + mSize.y + 8.0f) {
1417 getManager()->set_2c(1);
1418 getManager()->setNonMeltTime();
1419 changeState(StateID_Float);
1420 return;
1421 }
1422 } else if (waterRes == dBc_c::WATER_CHECK_YOGAN) {
1423 if (height >= mPos.y + 4.0f) {
1424 getManager()->set_2c(1);
1425 getManager()->setNonMeltTime();
1426 mCc.release();
1427 yoganEffect();
1428 getManager()->set_14(1);
1429 mSpeed.y = -12.0f;
1430 changeState(StateID_YoganDive);
1431 return;
1432 }
1433 }
1434
1435 if (!mCc.isLinked()) {
1436 mCc.entry();
1437 }
1438
1439 calcSpeedY();
1440 posMove();
1441 dBc_c::Flag_e isFootEnm = mBc.checkFootEnm();
1442 if (isFootEnm) {
1443 mPos += mBc.mPushForce;
1444 mSpeed.y = 0.0f;
1445 }
1446 if (!(mBc.mFlags & dBc_c::FLAG_15)) {
1447 mBcPointHead.mFlags |= BIT_FLAG(31);
1448 }
1449
1450 mBc.checkHead(isFootEnm);
1451
1452 u8 dir = mPos.x - mBc.get_4c() < 0.0f;
1453 float dirs[] = { 1.0f, -1.0f };
1454 mBc.checkWallEnm(&dirs[dir]);
1455 mBc.checkWallEnm(&dirs[dir ^ 1]);
1456
1457 if (mBc.mFlags & dBc_c::FLAG_15 && mBgCollFlags & COLL_FOOT) {
1458 if (!checkFootBgcIsGround()) {
1460 }
1461 }
1462 if (HasamareBgCheck()) {
1463 breakReq(dGameCom::rndInt(2), -1);
1464 } else {
1465 int plr = -1;
1466 if (checkPlHasami(&plr)) {
1467 breakReq(dGameCom::rndInt(2), plr);
1468 } else if (!isFootEnm) {
1469 mSpeed.y = 0.0f;
1470 changeState(StateID_Fall);
1471 }
1472 }
1473}
1474
1475void daIce_c::initializeState_Cover() {}
1476
1477void daIce_c::finalizeState_Cover() {}
1478
1479void daIce_c::executeState_Cover() {
1480 dActor_c *parent = (dActor_c *) getConnectParent();
1481 mPos = parent->mPos - mPosDiff;
1482
1483 int plr = -1;
1484 if (checkPlHasami(&plr)) {
1485 breakReq(dGameCom::rndInt(2), plr);
1486 }
1487}
1488
1489void daIce_c::initializeState_Sink() {
1490 mSpeedF = -0.5f;
1491 mAccelF = 0.06f;
1492 mAngle.z = 0;
1493 mFloatTargetSpeed = 0.0f;
1494 mFloatAccel = std::fabs(mSpeedF) / 30.0f;
1495}
1496
1497void daIce_c::finalizeState_Sink() {}
1498
1499void daIce_c::executeState_Sink() {
1500 float prevWaterHeight = mWaterHeight;
1501 dBc_c::checkWater(mPos.x, mPos.y, mLayer, &mWaterHeight);
1502
1503 if (mWaterHeight - prevWaterHeight < 0.0f) {
1504 if (mPos.y >= getFloatPosY()) {
1505 mPos.y = getFloatPosY();
1506 changeState(StateID_FloatWait);
1507 return;
1508 }
1509 }
1510
1512 posMove();
1513
1514 getConnectParent(); // [Unused return value]
1515 getManager(); // [Unused return value]
1516
1517 if (std::fabs(mSpeed.y) < mFloatAccel) {
1518 if (mInitType == INIT_WATER_TOGE) {
1519 changeState(StateID_TogeFloat);
1520 } else {
1521 changeState(StateID_Float);
1522 }
1523 } else if (ACTOR_PARAM(CollisionMode) != COLLISION_NO_SINK_COLLISION) {
1524 float yPos = mPos.y;
1525 if (mBc.checkFoot()) {
1526 if (mBc.mFlags & dBc_c::FLAG_21) {
1527 mPos.y = yPos;
1528 } else {
1529 BOOL playerTouchingCeiling = FALSE;
1530 if (checkPlAttach_Head(&playerTouchingCeiling) && playerTouchingCeiling) {
1531 floatbreakReq();
1532 }
1533 }
1534 }
1535 }
1536}
1537
1538void daIce_c::initializeState_Float() {
1539 mFloatTargetSpeed = 0.7f;
1540 mFloatAccel = 0.0f;
1541 mSpeedF = 0.0f;
1542 mFloatAngle = 0;
1543 m_23b = 1;
1544}
1545
1546void daIce_c::finalizeState_Float() {}
1547
1548void daIce_c::executeState_Float() {
1551 posMove();
1552 switch (m_23b) {
1553 default:
1554 break;
1555 case 1:
1556 mFloatAccel += 0.003f;
1557 if (mFloatAccel >= 0.025f) {
1558 mFloatAccel = 0.025f;
1559 }
1560 if (checkPlAttach_Head(nullptr)) {
1561 mFloatAccel = 0.05f;
1562 mFloatTargetSpeed = l_attach_float_speed[mWeightType];
1563 m_23b = 2;
1564 }
1565 break;
1566 case 2:
1567 BOOL playerTouchingCeiling = FALSE;
1568 if (!checkPlAttach_Head(&playerTouchingCeiling)) {
1569 mFloatAccel = 0.0f;
1570 mFloatTargetSpeed = l_float_speed[mWeightType];
1571 m_23b = 1;
1572 } else if (playerTouchingCeiling != FALSE) {
1574 changeState(StateID_PushSink);
1575 return;
1576 }
1577 break;
1578 }
1579
1580 dBc_c::checkWater(mPos.x, mPos.y, mLayer, &mWaterHeight);
1581
1582 if (mPos.y >= getFloatPosY()) {
1583 changeState(StateID_FloatWait);
1584 } else {
1585 if (mBc.checkHead(0)) {
1586 floatbreakReq();
1587 }
1588 }
1589}
1590
1591void daIce_c::initializeState_SmallFloat() {
1592 mFloatTargetSpeed = 0.5f;
1593 mFloatAccel = 0.0f;
1594 mSpeedF = 0.0f;
1595 mFloatAngle = 0;
1596 m_23b = 1;
1597}
1598
1599void daIce_c::finalizeState_SmallFloat() {}
1600
1601void daIce_c::executeState_SmallFloat() {
1603 posMove();
1604 switch (m_23b) {
1605 default:
1606 break;
1607 case 1:
1608 mFloatAccel += 0.002f;
1609 if (mFloatAccel >= 0.02f) {
1610 mFloatAccel = 0.02f;
1611 }
1612 if (checkPlAttach_Head(nullptr)) {
1613 mFloatAccel = 0.01f;
1614 mFloatTargetSpeed = l_attach_float_speed[mWeightType] * 0.75f;
1615 m_23b = 2;
1616 }
1617 break;
1618 case 2:
1619 BOOL playerTouchingCeiling = FALSE;
1620 if (!checkPlAttach_Head(&playerTouchingCeiling)) {
1621 mFloatAccel = 0.0f;
1622 mFloatTargetSpeed = 0.5f;
1623 m_23b = 1;
1624 } else if (playerTouchingCeiling != FALSE) {
1626 changeState(StateID_PushSink);
1627 return;
1628 }
1629 break;
1630 }
1631
1632 float prevWaterHeight = mWaterHeight;
1633 dBc_c::checkWater(mPos.x, mPos.y, mLayer, &mWaterHeight);
1634
1635 if (mPos.y >= getFloatPosY()) {
1636 changeState(StateID_FloatWait);
1637 } else {
1638 if (mWaterHeight > prevWaterHeight) {
1639 changeState(StateID_Float);
1640 } else if (mBc.checkHead(0)) {
1641 floatbreakReq();
1642 }
1643 }
1644}
1645
1646void daIce_c::initializeState_FloatWait() {
1647 dBc_c::checkWater(mPos.x, mPos.y, mLayer, &mWaterHeight);
1648 mSpeed.x = 0.0f;
1649 mCurrFloatUpDown = 0;
1651 mBcPointHead.mFlags |= BIT_FLAG(7);
1652}
1653
1654void daIce_c::finalizeState_FloatWait() {
1655 mBcPointHead.mFlags &= ~BIT_FLAG(7);
1656}
1657
1658void daIce_c::executeState_FloatWait() {
1659 mAngle.z.chaseAngle(0, 0x10);
1660
1661 float prevWaterHeight = mWaterHeight;
1662 dBc_c::checkWater(mPos.x, mPos.y, mLayer, &mWaterHeight);
1663
1664 float waterHeightDiff = mWaterHeight - prevWaterHeight;
1665 if (waterHeightDiff > 0.0f) {
1667 } else if (waterHeightDiff < 0.0f) {
1669 } else {
1671 }
1672
1673 float floatTarget = mWaterHeight - mSize.y * 0.5f;
1674 switch (mFloatState) {
1675 case FLOAT_STATE_RISING:
1677 sLib::addCalc(&mPos.y, floatTarget, 0.1f, 1.0f, 0.05f);
1678 if (waterHeightDiff < 0.0f) {
1679 float maxPosY = mWaterHeight - mSize.y * 0.3f;
1680 if (mPos.y > maxPosY) {
1681 mPos.y = maxPosY;
1682 }
1683 }
1684 break;
1685 case FLOAT_STATE_STILL:
1686 mCurrFloatUpDown += 0x280;
1687 mPos.y = floatTarget + nw4r::math::SinIdx(mCurrFloatUpDown) * 5.0f;
1688 break;
1689 default:
1690 break;
1691 }
1692 if (mBc.checkHead(0)) {
1693 floatbreakReq();
1694 } else {
1695 BOOL playerTouchingCeiling = FALSE;
1696 if (checkPlAttach_Head(&playerTouchingCeiling) && playerTouchingCeiling != FALSE) {
1698 changeState(StateID_PushSink);
1699 }
1700 }
1701}
1702
1703void daIce_c::initializeState_PushSink() {
1704 const static float cs_float_speed[PUSH_SINK_COUNT] = {
1705 -0.85f, // PUSH_SINK_LAND
1706 -4.5f, // PUSH_SINK_HIP_ATTACK
1707 -1.0f // PUSH_SINK_PRESS
1708 };
1709
1710 mSpeed.set(0.0f, cs_float_speed[mPushSinkType], 0.0f);
1711 mAngle.z = 0;
1712}
1713
1714void daIce_c::finalizeState_PushSink() {}
1715
1716void daIce_c::executeState_PushSink() {
1717 float prevWaterHeight = mWaterHeight;
1718 dBc_c::checkWater(mPos.x, mPos.y, mLayer, &mWaterHeight);
1719 if (mWaterHeight - prevWaterHeight < 0.0f && mPos.y >= getFloatPosY()) {
1720 mPos.y = getFloatPosY();
1721 changeState(StateID_FloatWait);
1722 mStateMgr.refreshState();
1723 } else {
1724 if (mSpeed.y < 0.0f) {
1725 float newVal;
1727 newVal = sLib::addCalc(&mSpeed.y, 0.0f, 0.04f, 0.3f, 0.0f);
1728 } else {
1729 newVal = sLib::addCalc(&mSpeed.y, 0.0f, 0.07f, 0.5f, 0.0f);
1730 }
1731 if (newVal < 0.125f) {
1732 mSpeed.y = 0.0f;
1733 }
1734 }
1735 posMove();
1736 if (mSpeed.y >= 0.0f) {
1738 changeState(StateID_SmallFloat);
1739 } else {
1740 changeState(StateID_Float);
1741 }
1742 } else if (ACTOR_PARAM(CollisionMode) != COLLISION_NO_SINK_COLLISION) {
1743 float prevY = mPos.y;
1744 if (mBc.checkFoot()) {
1745 if (mBc.mFlags & dBc_c::FLAG_21) {
1746 mPos.y = prevY;
1747 } else {
1748 BOOL playerTouchingCeiling = FALSE;
1749 if (checkPlAttach_Head(&playerTouchingCeiling) && playerTouchingCeiling != FALSE) {
1750 floatbreakReq();
1751 }
1752 }
1753 }
1754 }
1755 }
1756}
1757
1758void daIce_c::initializeState_TogeFloat() {
1759 getManager()->set_2c(0);
1760 mFloatTargetSpeed = 0.4f;
1761 mFloatAccel = 0.0f;
1762 mFloatAngle = 0;
1763 m_23b = 1;
1764}
1765
1766void daIce_c::finalizeState_TogeFloat() {}
1767
1768void daIce_c::executeState_TogeFloat() {
1769 getManager(); // [Unused return value]
1770
1772 posMove();
1773 switch (m_23b) {
1774 default:
1775 break;
1776 case 1:
1777 mFloatAccel += 0.003f;
1778 if (mFloatAccel >= 0.03f) {
1779 mFloatAccel = 0.03f;
1780 }
1781 if (checkPlAttach_Head(nullptr)) {
1782 mFloatAccel = 0.03f;
1783 mFloatTargetSpeed = 0.3f;
1784 m_23b = 2;
1785 }
1786 break;
1787 case 2: {
1788 BOOL playerTouchingCeiling = FALSE;
1789 if (!checkPlAttach_Head(&playerTouchingCeiling)) {
1790 mFloatAccel = 0.0f;
1791 mFloatTargetSpeed = l_toge_float_speed[mWeightType];
1792 m_23b = 1;
1793 } else if (playerTouchingCeiling != FALSE) {
1794 mSpeedF = -0.1f;
1795 mFloatAccel = 0.0f;
1796 }
1797 break;
1798 }
1799 }
1800 dBc_c::checkWater(mPos.x, mPos.y, mLayer, &mWaterHeight);
1801 if (mPos.y >= getFloatPosY()) {
1802 mPos.y = getFloatPosY();
1803 }
1804 if (mBc.checkHead(0)) {
1805 floatbreakReq();
1806 } else if (mShake) {
1807 changeState(StateID_ShakeFloat);
1808 }
1809}
1810
1811void daIce_c::initializeState_ShakeFloat() {
1812 mShakeRotAmplitude = 0x300;
1813 mShakeRotSpeed = 0x600;
1814 mShakeRotAngle = 0;
1815 m_23b = 1;
1816}
1817
1818void daIce_c::finalizeState_ShakeFloat() {}
1819
1820void daIce_c::executeState_ShakeFloat() {
1822 posMove();
1823 switch (m_23b) {
1824 default:
1825 break;
1826 case 1:
1827 mFloatAccel += 0.005f;
1828 if (mFloatAccel >= 0.05f) {
1829 mFloatAccel = 0.05f;
1830 }
1831 if (checkPlAttach_Head(nullptr)) {
1832 mFloatAccel = 0.05f;
1833 mFloatTargetSpeed = l_attach_float_speed[mWeightType];
1834 m_23b = 2;
1835 }
1836 break;
1837 case 2:
1838 BOOL playerTouchingCeiling = FALSE;
1839 if (!checkPlAttach_Head(&playerTouchingCeiling)) {
1840 mFloatAccel = 0.0f;
1841 mFloatTargetSpeed = l_float_speed[mWeightType];
1842 m_23b = 1;
1843 } else if (playerTouchingCeiling != FALSE) {
1844 mSpeedF = -0.1f;
1845 mFloatAccel = 0.0f;
1846 }
1847 break;
1848 }
1849 dBc_c::checkWater(mPos.x, mPos.y, mLayer, &mWaterHeight);
1850 if (mPos.y >= getFloatPosY()) {
1851 mPos.y = getFloatPosY();
1852 }
1853 if (mBc.checkHead(0)) {
1854 floatbreakReq();
1855 }
1856}
1857
1858void daIce_c::initializeState_Air() {
1859 mTimer = 120;
1860 mSpeed.set(0.0f, 0.0f, 0.0f);
1861 mCc.entry();
1862 mBcPointFoot.mFlags |= BIT_FLAG(31);
1863}
1864
1865void daIce_c::finalizeState_Air() {
1866 mBcPointFoot.mFlags &= ~BIT_FLAG(31);
1867 mShake = false;
1868}
1869
1870void daIce_c::executeState_Air() {
1871 mTimer--;
1872 if (mTimer == 0) {
1873 mSpeed.set(0.0f, 0.0f, 0.0f);
1874 changeState(StateID_Fall);
1875 } else if (mTimer == 40) {
1876 mShake = true;
1877 }
1878 int plr = -1;
1879 if (checkPlHasami(&plr)) {
1880 breakReq(dGameCom::rndInt(2), plr);
1881 } else {
1882 u8 dir = mPos.x - mBc.get_4c() < 0.0f;
1883 float dirs[] = { 1.0f, -1.0f };
1884 mBc.checkWallEnm(&dirs[dir]);
1885 mBc.checkWallEnm(&dirs[dir ^ 1]);
1886 float prevY = mPos.y;
1887 mBc.checkFoot();
1888 mPos.y = prevY;
1889 }
1890}
1891
1892void daIce_c::initializeState_Fall() {
1893 getManager(); // [Unused return value]
1894
1895 mStartFallY = mPos.y;
1896 if (getOldStateID() == StateID_Air) {
1897 mAccelY = -1.0f;
1898 } else {
1899 mAccelY = -0.1875f;
1900 }
1901}
1902
1903void daIce_c::finalizeState_Fall() {
1904 mBcPointWall.mFlags &= ~BIT_FLAG(30);
1905 getManager()->set_2c(0);
1906}
1907
1908void daIce_c::executeState_Fall() {
1909 mCc.entry();
1910 calcSpeedY();
1911 posMove();
1912 getManager(); // [Unused return value]
1913
1914 u8 dir = mPos.x - mBc.get_4c() < 0.0f;
1915 float dirs[] = { 1.0f, -1.0f };
1916 mBc.checkWallEnm(&dirs[dir]);
1917 mBc.checkWallEnm(&dirs[dir ^ 1]);
1918 if (mBc.checkFootEnm()) {
1919 float fallHeight = std::fabs(mPos.y - mStartFallY);
1920 dEn_c *parent = (dEn_c *) getConnectParent();
1921 if (parent->mFlags & BIT_FLAG(17) || fallHeight >= 24.0f) {
1922 int dir = dGameCom::rndInt(2);
1923 dActorMng_c::m_instance->createUpCoin(getCenterPos(), dir, 1, 0);
1924 breakReq(dir ^ 1, -1);
1925 } else {
1926 if (fallHeight >= 12.0f) {
1927 dAudio::g_pSndObjMap->startSound(SE_OBJ_PNGN_ICE_LAND, mPos, 0);
1928 }
1929 mSpeed.y = 0.0f;
1930 changeState(StateID_Land);
1931 }
1932 } else {
1933 float height = 0;
1934 dBc_c::WATER_TYPE_e waterRes = dBc_c::checkWater(mPos.x, mPos.y + mSize.y * 0.2f, mLayer, &height);
1935 if (waterRes == dBc_c::WATER_CHECK_WATER) {
1936 mSpeed.x = 0.0f;
1937 mVec3_c efPos(mPos.x, height, 6500.0f);
1938 waterSplashEffect(efPos, 1.0f);
1939 changeState(StateID_Dive);
1940 } else if (waterRes == dBc_c::WATER_CHECK_YOGAN) {
1941 mSpeed.x = 0.0f;
1942 yoganEffect();
1943 changeState(StateID_YoganDive);
1944 } else if (waterRes == dBc_c::WATER_CHECK_POISON) {
1945 mSpeed.x = 0.0f;
1946 poisonEffect();
1947 changeState(StateID_YoganDive);
1948 }
1949 }
1950}
1951
1952void daIce_c::initializeState_Dive() {
1953 dIceMng_c *iceMng = getManager();
1954 iceMng->set_2c(1);
1955 iceMng->mThawTimer = iceMng->mThawDuration;
1956 iceMng->stopMeltShake();
1957
1958 mShake = false;
1960 mBgCtr.mFlags = 0x408;
1961 mAccelF = 0.06f;
1962 mSpeedMax.x = 0.0f;
1963 mSpeed.y *= 0.8f;
1964 mAngle.z = 0;
1965 mTimer = 30;
1966}
1967
1968void daIce_c::finalizeState_Dive() {
1969 mCc.mCcData.mAttack = CC_ATTACK_NONE;
1970 mCc.mCcData.mVsKind &= ~(BIT_FLAG(CC_KIND_BALLOON) | BIT_FLAG(CC_KIND_ITEM) | BIT_FLAG(CC_KIND_KILLER));
1971 mPlayerNo = -1;
1972}
1973
1974void daIce_c::executeState_Dive() {
1975 float prevY = mPos.y;
1976 if (mSpeed.y < 0.0f && sLib::addCalc(&mSpeed.y, 0.0f, 0.085f, 0.5f, 0.0f) < 0.25f) {
1977 mSpeed.y = 0.0f;
1978 }
1979 calcSpeedX();
1980 posMove();
1981 mTimer--;
1982 if (mSpeed.y >= 0.0f && std::fabs(mSpeed.x) < mAccelF) {
1983 mCc.mCcData.mAttack = CC_ATTACK_NONE;
1984 mCc.mCcData.mCallback = ccCallBack_Water;
1985 mSpeed.x = 0.0f;
1986 changeState(StateID_Float);
1987 mStateMgr.refreshState();
1988 } else {
1989 if (mBc.checkFoot()) {
1990 mPos.y = prevY;
1991 }
1992 if (mBc.checkWall(nullptr)) {
1994 }
1995 }
1996}
1997
1998void daIce_c::initializeState_YoganDive() {
1999 dIceMng_c *iceMng = getManager();
2000 iceMng->set_2c(1);
2001 iceMng->mThawTimer = iceMng->mThawDuration;
2002 iceMng->stopMeltShake();
2003 mShake = false;
2004 mBgCtr.mFlags = 8;
2006 mAccelF = 0.35f;
2007 mSpeedMax.x = 0.0f;
2008 mSpeed.y *= 0.25f;
2009 mPos.z = -2500.0f;
2010 mAngle.z = 0;
2011 mTimer = 30;
2012}
2013
2014void daIce_c::finalizeState_YoganDive() {}
2015
2016void daIce_c::executeState_YoganDive() {
2017 if (mSpeed.y < 0.0f && sLib::addCalc(&mSpeed.y, -0.33f, 0.3f, 0.75f, 0.0f) < 0.25f) {
2018 mSpeed.y = -0.33f;
2019 }
2020 calcSpeedX();
2021 posMove();
2022 float height = 0.0f;
2023 dBc_c::WATER_TYPE_e waterRes = dBc_c::checkWater(mPos.x, mPos.y, mLayer, &height);
2024 if (waterRes == dBc_c::WATER_CHECK_NONE && mPos.y + mSize.y < height) {
2025 dActor_c *parent = (dActor_c *) getConnectParent();
2026 if (parent != nullptr) {
2027 parent->deleteRequest();
2028 }
2029 } else {
2030 if (std::fabs(mSpeed.x) > 0.25f && mBc.checkWall(nullptr)) {
2032 }
2033 }
2034}
2035
2036void daIce_c::initializeState_Carry() {
2037 dIceMng_c *iceMng = getManager();
2038 iceMng->set_2c(1);
2039 iceMng->mThawTimer = iceMng->mThawDuration;
2040 iceMng->stopMeltShake();
2041 mShake = false;
2042 setCarryBc();
2043 mCc.mCcData.mAttack = CC_ATTACK_SHELL;
2044 mCc.mCcData.mVsKind &= ~BIT_FLAG(CC_KIND_ITEM);
2045 mCc.mCcData.mBase.mSize.set(mSize.x * 0.5f + 1.0f, mSize.y * 0.5f + 1.0f);
2046 mBgCtr.mFlags2 = 2;
2047 mBcPointHead.mFlags |= BIT_FLAG(20) | BIT_FLAG(23);
2048 mBc.mOwningPlrNo = mCarriedByPlrNo;
2049}
2050
2051void daIce_c::finalizeState_Carry() {
2052 daPyMng_c::getPlayer(mCarriedByPlrNo)->cancelCarry(this);
2054 mCc.mCcData.mVsKind |= BIT_FLAG(CC_KIND_ITEM);
2055 setBc();
2056}
2057
2058void daIce_c::executeState_Carry() {
2059 dAcPy_c *player = daPyMng_c::getPlayer(mCarriedByPlrNo);
2060 u8 amiLine = 3;
2061 if (checkNetIn()) {
2062 if (mPos.z >= 0.0f) {
2063 amiLine = 1;
2064 } else {
2065 amiLine = 2;
2066 }
2067 }
2068 mCc.mAmiLine = amiLine;
2069 mBc.mAmiLine = amiLine;
2070 mBgCtr.mAmiLine = amiLine;
2073 mAccelY = -0.1875f;
2075 changeState(StateID_Throw);
2076 return;
2077 }
2078
2079 mVec3_c delta = player->mPosDelta;
2080 u8 dir = !(delta.x >= 0.0f);
2081 getConnectParent(); // [Unused return value]
2082 getManager(); // [Unused return value]
2083 if (player->isStatus(daPlBase_c::STATUS_46) || delta.y > 0.0f) {
2084 mSpeed.y = 3.0f;
2085 bool headRes = mBc.checkHead(0);
2086 mSpeed.y = 0.0f;
2087 if (headRes) {
2088 mDirection = dir ^ 1;
2090 return;
2091 }
2092 BOOL playerTouchingCeiling = FALSE;
2093 if (checkPlAttach_Head(&playerTouchingCeiling) && playerTouchingCeiling != FALSE) {
2095 return;
2096 }
2097 }
2098 if (!player->isStatus(daPlBase_c::STATUS_46)) {
2099 if (mBc.checkWall(&delta.x)) {
2100 mDirection = dir ^ 1;
2102 changeState(StateID_Drop);
2103 } else {
2104 int res = 0;
2105 if (checkPlAttach_Wall(dir, &res) && res != 0) {
2106 mDirection = dir ^ 1;
2108 changeState(StateID_Drop);
2109 }
2110 }
2111 }
2112}
2113
2114void daIce_c::initializeState_Drop() {
2115 const static float cs_drop_speed_x[] = { 1.25f, -1.25f };
2116
2117 mBgCtr.mpCarryActor = nullptr;
2118 mBgCtr.mFlags |= BIT_FLAG(12);
2119 mSpeed.set(cs_drop_speed_x[mDirection], 0.0f, 0.0f);
2120 if (mPos.z > 2000.0f) {
2121 mPos.z = 2000.0f;
2122 }
2123 mAccelY = -0.1875f;
2124}
2125
2126void daIce_c::finalizeState_Drop() {
2127 dIceMng_c *iceMng = getManager();
2128 iceMng->set_2c(0);
2129 iceMng->mThawTimer = iceMng->mThawDuration;
2130 iceMng->stopMeltShake();
2131 mCc.mCcData.mAttack = CC_ATTACK_NONE;
2132 mPlayerNo = -1;
2133}
2134
2135void daIce_c::executeState_Drop() {
2136 calcSpeedY();
2137 posMove();
2138 getConnectParent(); // [Unused return value]
2139 dIceMng_c *iceMng = getManager();
2140 float height = 0.0f;
2141 dBc_c::WATER_TYPE_e waterRes = dBc_c::checkWater(mPos.x, mPos.y + mSize.y * 0.2f, mLayer, &height);
2142 if (waterRes == dBc_c::WATER_CHECK_WATER) {
2143 mCc.mCcData.mAttack = CC_ATTACK_NONE;
2144 mCc.mCcData.mCallback = ccCallBack_Water;
2145 iceMng->m_14 = 1;
2146 mVec3_c efPos(mPos.x, height, 6500.0f);
2147 waterSplashEffect(efPos, 1.0f);
2148 changeState(StateID_Dive);
2149 } else if (waterRes == dBc_c::WATER_CHECK_YOGAN) {
2150 mCc.release();
2151 yoganEffect();
2152 iceMng->m_14 = 1;
2153 changeState(StateID_YoganDive);
2154 } else if (waterRes == dBc_c::WATER_CHECK_POISON) {
2155 mCc.release();
2156 poisonEffect();
2157 iceMng->m_14 = 1;
2158 changeState(StateID_YoganDive);
2159 } else {
2160 if (mBc.checkFootEnm()) {
2161 breakReq(mDirection ^ 1, -1);
2162 } else if (mBc.checkWall(nullptr)) {
2163 mDirection ^= 1;
2164 mSpeed.x = -mSpeed.x;
2165 }
2166 }
2167}
2168
2169void daIce_c::initializeState_Throw() {
2170 const static float cs_throw_speed[] = { 3.0f, -3.0f };
2171 const static float cs_throw_max_speed[] = { 4.0f, -4.0f };
2172
2173 dAcPy_c *pl = daPyMng_c::getPlayer(mPlayerNo);
2174
2175 float throwSpeed = pl->threeQuarterSpeedX() + cs_throw_speed[mDirection];
2176 float throwMaxSpeed = cs_throw_max_speed[mDirection];
2177 mAccelF = 0.0625f;
2178 mSpeedMax.x = throwMaxSpeed;
2179
2180 // [Same deal as in dEnemyCarry_c::setThrowSpeed]
2181 if (throwSpeed < mSpeedMax.x) {
2182 throwSpeed = (throwSpeed > mSpeedMax.x) ? mSpeedMax.x : throwSpeed;
2183 } else if (throwSpeed > mSpeedMax.x) {
2184 throwSpeed = (throwSpeed < mSpeedMax.x) ? mSpeedMax.x : throwSpeed;
2185 }
2186 mSpeed.set(throwSpeed, -1.0f, 0.0f);
2187
2188 clrComboCnt();
2189 mBgCtr.mFlags |= BIT_FLAG(12);
2190 mCc.mCcData.mAttack = CC_ATTACK_SHELL;
2191 mCc.mCcData.mVsKind |= BIT_FLAG(CC_KIND_BALLOON) | BIT_FLAG(CC_KIND_ITEM) | BIT_FLAG(CC_KIND_KILLER);
2192 mCc.mCcData.mVsDamage |= BIT_FLAG(CC_ATTACK_SHELL);
2193 mCc.mCcData.mVsDamage &= ~BIT_FLAG(CC_ATTACK_SPIN_LIFT_UP);
2194 mBcPointHead.mFlags |= BIT_FLAG(18) | BIT_FLAG(19) | BIT_FLAG(20) | BIT_FLAG(23);
2195 mBcPointFoot.mFlags |= BIT_FLAG(18) | BIT_FLAG(19);
2196 mBcPointWall.mFlags |= BIT_FLAG(18) | BIT_FLAG(19) | BIT_FLAG(20) | BIT_FLAG(23);
2197 if (mPos.z > 2000.0f) {
2198 mPos.z = 2000.0f;
2199 }
2200 mBc.mOwningPlrNo = mPlayerNo;
2201}
2202
2203void daIce_c::finalizeState_Throw() {
2204 mBcPointHead.mFlags &= ~(BIT_FLAG(18) | BIT_FLAG(19) | BIT_FLAG(20) | BIT_FLAG(23));
2205 mBcPointFoot.mFlags &= ~(BIT_FLAG(18) | BIT_FLAG(19));
2206 mBcPointWall.mFlags &= ~(BIT_FLAG(18) | BIT_FLAG(19) | BIT_FLAG(20) | BIT_FLAG(23));
2207 mBc.mOwningPlrNo = -1;
2208 mBgCtr.mpCarryActor = nullptr;
2209}
2210
2211void daIce_c::executeState_Throw() {
2212 calcSpeedX();
2213 calcSpeedY();
2214 posMove();
2215 dActor_c *parent = (dActor_c *) getConnectParent();
2216 getManager(); // [Unused return value]
2217
2218 float height = 0.0f;
2219 dBc_c::WATER_TYPE_e waterRes = dBc_c::checkWater(mPos.x, mPos.y + mSize.y * 0.2f, mLayer, &height);
2220 if (waterRes == dBc_c::WATER_CHECK_WATER) {
2221 mVec3_c efPos(mPos.x, height, 6500.0f);
2222 waterSplashEffect(efPos, 1.0f);
2223 changeState(StateID_Dive);
2224 } else if (waterRes == dBc_c::WATER_CHECK_YOGAN) {
2225 mCc.release();
2226 yoganEffect();
2227 changeState(StateID_YoganDive);
2228 } else if (waterRes == dBc_c::WATER_CHECK_POISON) {
2229 mCc.release();
2230 poisonEffect();
2231 changeState(StateID_YoganDive);
2232 } else {
2233 bool isFoot = mBc.isFoot();
2234 if (mBc.checkFootEnm()) {
2235 if (!isFoot) {
2236 dAudio::SoundEffectID_t(SE_OBJ_PNGN_ICE_LAND).playMapSound(mPos, 0);
2237 }
2238 mSpeed.y = 0.0f;
2239 dAudio::SoundEffectID_t(SE_OBJ_PNGN_ICE_SLIDE).holdMapSound(mUniqueID, mPos, 0);
2240 }
2241 if (mBc.checkWall(nullptr)) {
2243 }
2244
2245 float loopX = dBgParameter_c::ms_Instance_p->getLoopScrollDispPosX(mPos.x);
2246 float endX = loopX + dBgParameter_c::ms_Instance_p->xSize();
2247 if (
2248 mPos.x < loopX - 64.0f ||
2249 mPos.x > endX + 64.0f
2250 ) {
2251 parent->deleteRequest();
2252 }
2253 }
2254}
2255
2256void daIce_c::initializeState_Melt_Normal() {
2257 meltEffect();
2258 mBgCtr.release();
2259}
2260
2261void daIce_c::finalizeState_Melt_Normal() {}
2262
2263void daIce_c::executeState_Melt_Normal() {
2264 deleteRequest();
2265}
2266
The player class for Mario, Luigi and the Toads.
sFStateMgr_c< dActorState_c, sStateMethodUsr_FI_c > mStateMgr
The state manager.
static u8 mExecStop
The actors for which the execute operation is currently disabled.
Definition d_actor.hpp:415
@ CARRY_RELEASE
The actor is being released from carry.
Definition d_actor.hpp:57
@ CARRY_THROW
The actor is being actively thrown by the player.
Definition d_actor.hpp:58
void carryFukidashiCancel(int fukidashiAction, int playerId)
Hides the given action prompt for all players.
Definition d_actor.cpp:539
static void setSoftLight_MapObj(m3d::bmdl_c &mdl)
Sets the soft light effect for map objects.
Definition d_actor.cpp:333
virtual s8 & getPlrNo()
Gets the player number associated with the actor. See mPlayerNo.
Definition d_actor.hpp:108
bool HasamareBgCheck()
Returns whether the actor is colliding with any enabled collision sides.
Definition d_actor.cpp:457
dBc_c mBc
The actor-to-tile collision sensor.
Definition d_actor.hpp:345
void clrComboCnt()
Clears the actor's combo counter.
Definition d_actor.cpp:727
u32 mCarryingFlags
The actor's carry actions. See CARRY_ACTION_e.
Definition d_actor.hpp:336
int 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
mVec2_c m_1eb
Definition d_actor.hpp:348
u8 mKind
The actor's kind. Value is a STAGE_ACTOR_KIND_e.
Definition d_actor.hpp:377
static void changePosAngle(mVec3_c *pos, mAng3_c *ang, int param3)
Adjusts the actor's position to account for looping stages.
Definition d_actor.cpp:297
u8 mAmiLayer
The actor's layer for chainlink fences.
Definition d_actor.hpp:382
u8 mDirection
The actor's facing direction.
Definition d_actor.hpp:354
dCc_c mCc
The actor-to-actor collision sensor.
Definition d_actor.hpp:344
u8 mThrowDirection
The actor's direction when thrown or dropped after carrying.
Definition d_actor.hpp:337
virtual int preExecute()
pre method for the execute operation.
Definition d_actor.cpp:104
int mComboMultiplier
The current combo multiplier obtained by the actor by colliding with other actors.
Definition d_actor.hpp:338
s8 mPlayerNo
The player associated with the actor, -1 if not associated to any player.
Definition d_actor.hpp:378
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
int m_23b
Definition d_actor.hpp:363
virtual void waterSplashEffect(const mVec3_c &pos, float size)
Generates a water splash effect.
Definition d_actor.cpp:731
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
@ COLL_FOOT
The actor collided with the ground.
Definition d_actor.hpp:66
@ COLL_NONE
The actor did not collide with any surface.
Definition d_actor.hpp:63
@ STAGE_ACTOR_GENERIC
A generic stage actor (default).
Definition d_actor.hpp:49
@ STAGE_ACTOR_ENEMY
An enemy actor.
Definition d_actor.hpp:52
@ STAGE_ACTOR_YOSHI
The Yoshi actor.
Definition d_actor.hpp:51
@ STAGE_ACTOR_PLAYER
The player actor.
Definition d_actor.hpp:50
u8 mLayer
The actor's layer.
Definition d_actor.hpp:380
u8 mBgCollFlags
The collision directions that the actor collided with in the previous frame. Value is a BG_COLL_FLAG_...
Definition d_actor.hpp:356
mMtx_c mMatrix
The actor's partial transformation matrix. See makeMtx() for details.
mVec3_c mScale
The actor's scale (defaults to 1).
float mAccelF
The actor's horizontal acceleration.
mVec3_c mSpeed
The actor's speed.
mVec3_c mLastPos
The actor's position in the previous frame.
mVec3_c mPos
The actor's position.
mVec3_c mSpeedMax
The actor's maximum speed.
void calcSpeedX()
Updates the actor's X speed. See here for details.
mVec3_c mPosDelta
The actor's position delta since the previous frame.
mVec3_c mCenterOffs
The offset from the position to the center of the actor (defaults to 0).
float mSpeedF
The actor's horizontal speed.
void posMove()
Moves the actor by its speed.
mVec3_c getCenterPos() const
Gets the actor's centered position.
mAng3_c mAngle
The actor's rotation (for 2D actors).
float mAccelY
The actor's vertical acceleration.
void calcSpeedY()
Updates the actor's Y speed. See here for details.
Definition d_bc.hpp:41
Collider ("Collision Check") class - handles collisions between actors.
Definition d_cc.hpp:134
u8 mInfo
Info flags for this collider. See CC_INFO_e.
Definition d_cc.hpp:339
void entry()
Places this collider in the collider list.
Definition d_cc.cpp:52
float getLeftPos()
Gets the X position of the left side of the collider.
Definition d_cc.cpp:140
float getRightPos()
Gets the X position of the right side of the collider.
Definition d_cc.cpp:136
dActor_c * getOwner() const
Gets the owner actor of this collider.
Definition d_cc.hpp:179
sCcDatNewF mCcData
The collision data of this collider.
Definition d_cc.hpp:290
An enemy actor. Note that the definition of "enemy" in this context is actually any interactible stag...
Definition d_enemy.hpp:88
u8 mIceDeathDirection
The X direction to move towards on ice death.
Definition d_enemy.hpp:279
dIceMng_c mIceMng
The ice manager for this enemy.
Definition d_enemy.hpp:287
dEnCombo_c mCombo
The enemy combo manager.
Definition d_enemy.hpp:301
u32 mFlags
Flags for this actor. See FLAGS_e.
Definition d_enemy.hpp:291
static dMultiMng_c * mspInstance
The instance of this class.
static dResMng_c * m_instance
The instance of this class.
Definition d_res_mng.hpp:71
Ice blocks for enemies.
Definition d_a_ice.hpp:12
InitType_e
How the ice block behaves when it's created.
Definition d_a_ice.hpp:28
@ INIT_COVER
The block follows the parent enemy.
Definition d_a_ice.hpp:36
@ INIT_WATER_STUCK
The block was created underwater, but doesn't float up.
Definition d_a_ice.hpp:35
@ INIT_AIR
The block hangs in the air for a while, then falls down.
Definition d_a_ice.hpp:31
@ INIT_WATER_TOGE
Same as INIT_WATER, but for spiky enemies that break the ice block after a while.
Definition d_a_ice.hpp:34
@ INIT_FREEZE
The block is frozen in place indefinitely.
Definition d_a_ice.hpp:30
@ INIT_WATER
The block was created underwater and floats up.
Definition d_a_ice.hpp:33
@ INIT_HOP
The block is launched with the parent enemy's speed.
Definition d_a_ice.hpp:37
@ INIT_FALL
The block falls down immediately.
Definition d_a_ice.hpp:32
void setCarryBc()
Sets up the tile collision sensors while the block is being carried.
Definition d_a_ice.cpp:648
bool checkUnderBreak(dActor_c *actor)
Checks whether a falling block hits a player / Yoshi from above and causes daPlBase_c::DAMAGE_HEAD_BO...
Definition d_a_ice.cpp:818
void setCarry(dActor_c *actor)
Starts being carried by the given actor.
Definition d_a_ice.cpp:1139
static sFStateID_c< daIce_c > StateID_Carry
Being carried by a player.
Definition d_a_ice.hpp:228
BOOL canCarry() const
Checks whether the ice block can currently be picked up.
Definition d_a_ice.cpp:1279
bool checkInstantBreak(BOOL checkBg)
Checks whether the ice block should be broken immediately after creation.
Definition d_a_ice.cpp:370
int doDelete() override
do method for the delete operation.
Definition d_a_ice.cpp:221
mVec3_c calcCarryPos()
Calculates the position of the block in the carrying player's hands.
Definition d_a_ice.cpp:1263
short mShakeRotAmplitude
The maximum rotation of the swinging motion.
Definition d_a_ice.hpp:278
bool checkPushSink(dActor_c *actor)
Checks whether the given actor should push the ice block down and sets mPushSinkType accordingly.
Definition d_a_ice.cpp:781
IceWeight_e mWeightType
The weight class.
Definition d_a_ice.hpp:295
@ PUSH_SINK_HIP_ATTACK
A player ground-pounded the block.
Definition d_a_ice.hpp:69
@ PUSH_SINK_LAND
A player landed on the block.
Definition d_a_ice.hpp:68
@ PUSH_SINK_PRESS
A player standing on the block is pressed against a ceiling.
Definition d_a_ice.hpp:70
void watertogeShake()
Swings the model left and right with increasing frequency. Used for INIT_WATER_TOGE.
Definition d_a_ice.cpp:743
static sFStateID_c< daIce_c > StateID_Drop
Falling down after being dropped. Breaks on landing.
Definition d_a_ice.hpp:230
static sFStateID_c< daIce_c > StateID_ShakeFloat
Floating up slowly while shaking before melting.
Definition d_a_ice.hpp:222
static void ccCallBack_Water(dCc_c *self, dCc_c *other)
The actor collision callback in water.
Definition d_a_ice.cpp:1073
void meltEffect()
Plays the melt effect.
Definition d_a_ice.cpp:862
nw4r::g3d::ResFile mResFileMdl
The resource file.
Definition d_a_ice.hpp:249
static sFStateID_c< daIce_c > StateID_SmallFloat
Floating back up to the water surface after a small push downwards.
Definition d_a_ice.hpp:219
bool calcLandLine(float &height)
Calculates the highest ground position below the ice block.
Definition d_a_ice.cpp:435
void finalUpdate() override
Code to be executed after all actors' execute operation has run.
Definition d_a_ice.cpp:483
float mFloatTargetSpeed
The target speed when floating.
Definition d_a_ice.hpp:269
void initPos()
Places the block on the ground if it's landing or falling.
Definition d_a_ice.cpp:279
PushSinkType_e mPushSinkType
How the block got pushed under the water surface.
Definition d_a_ice.hpp:265
sBcMany mBcPointFoot
The foot sensor for tile collision.
Definition d_a_ice.hpp:256
fBaseID_e getParentID()
Gets the ID of the parent enemy.
Definition d_a_ice.cpp:1299
static sFStateID_c< daIce_c > StateID_Dive
Slowing down after falling into water.
Definition d_a_ice.hpp:226
short mFloatAngle
The current angle while floating up.
Definition d_a_ice.hpp:271
static sFStateID_c< daIce_c > StateID_Freeze
Frozen in place.
Definition d_a_ice.hpp:213
dHeapAllocator_c mAllocator
The allocator.
Definition d_a_ice.hpp:248
void plcombobreakReq(int dir, dActor_c *initiator)
Like combobreakReq(), but uses the player's combo counter.
Definition d_a_ice.cpp:579
void breakEffect()
Plays the break effect.
Definition d_a_ice.cpp:851
void shake()
Shakes the model of the ice block.
Definition d_a_ice.cpp:729
static sFStateID_c< daIce_c > StateID_Melt_Normal
Breaking apart after the ice block has has melted.
Definition d_a_ice.hpp:231
int draw() override
do method for the draw operation.
Definition d_a_ice.cpp:204
static sFStateID_c< daIce_c > StateID_YoganDive
Sinking into lava or poison.
Definition d_a_ice.hpp:227
static void ccCallBack(dCc_c *self, dCc_c *other)
The actor collision callback.
Definition d_a_ice.cpp:988
void enemyAttach()
Moves the parent enemy along with the ice block.
Definition d_a_ice.cpp:724
void yoganEffect()
Plays the lava splash effect.
Definition d_a_ice.cpp:1307
void floatbreakReq()
Requests the ice block to break on water. No score is awarded.
Definition d_a_ice.cpp:1114
bool checkUpperBreak(dActor_c *actor)
Checks whether an actor landing on the block breaks it. [Always false].
Definition d_a_ice.cpp:835
void setBc()
Sets up the tile collision sensors.
Definition d_a_ice.cpp:623
void enlargeBgcWater()
Enlarges the dynamic collider when in water.
Definition d_a_ice.cpp:705
static sFStateID_c< daIce_c > StateID_Float
Floating up to the water surface while tilting back and forth.
Definition d_a_ice.hpp:218
u32 mFlags
Value is a FLAG_e.
Definition d_a_ice.hpp:290
void initSize(const mVec3_c &scale)
Calculates the block's size from the ice type and the given scale.
Definition d_a_ice.cpp:267
void breakReq(int dir, int playerNo)
Requests the ice block to be broken.
Definition d_a_ice.cpp:1095
bool checkPlHasami_Wall(dActor_c *actor, int dir)
Checks whether the given player is stuck between the ice block and a wall.
Definition d_a_ice.cpp:1241
static void callBackFoot(dActor_c *self, dActor_c *other)
Called when another actor's foot sensor touches the ice block.
Definition d_a_ice.cpp:894
float mWaterHeight
The height of the water surface.
Definition d_a_ice.hpp:284
dIceMng_c * mpIceMng
The ice manager.
Definition d_a_ice.hpp:297
@ COLLISION_NO_SINK_COLLISION
The block does not check for ground collision while sinking in water.
Definition d_a_ice.hpp:55
@ COLLISION_NONE
The block does not collide with tiles.
Definition d_a_ice.hpp:54
bool checkNetIn()
Checks whether the ice block overlaps a climbable fence.
Definition d_a_ice.cpp:1122
short mShakeRotSpeed
The angular speed of mShakeRotAngle.
Definition d_a_ice.hpp:276
int create() override
do method for the create operation.
Definition d_a_ice.cpp:64
float mFloatAccel
The acceleration towards mFloatTargetSpeed.
Definition d_a_ice.hpp:270
@ FLAG_CARRYABLE
The block can be picked up by players.
Definition d_a_ice.hpp:62
@ FLAG_BREAKABLE
The block can be broken by ground pounding or attacking it from below.
Definition d_a_ice.hpp:61
int preExecute() override
pre method for the execute operation.
Definition d_a_ice.cpp:157
void createMdl()
Creates the model and texture animation according to the ice type.
Definition d_a_ice.cpp:130
static void callBackWall(dActor_c *self, dActor_c *other, u8 dir)
Called when another actor's wall sensor touches the ice block.
Definition d_a_ice.cpp:926
mVec3_c mPosDiff
The offset to the parent actor.
Definition d_a_ice.hpp:259
static void callBackHead(dActor_c *self, dActor_c *other)
Called when another actor's head sensor touches the ice block.
Definition d_a_ice.cpp:873
void quakeDamage()
Awards the earthquake combo score and breaks the ice block.
Definition d_a_ice.cpp:541
nw4r::g3d::ResAnmTexSrt mResFileAnm
The texture animation resource file.
Definition d_a_ice.hpp:251
float mStartFallY
The Y position where the block started falling, used to check whether the block falls far enough to b...
Definition d_a_ice.hpp:287
InitType_e mInitType
The initial behavior.
Definition d_a_ice.hpp:294
sBcMany mBcPointWall
The wall sensor for tile collision.
Definition d_a_ice.hpp:258
static bool checkRevFoot(dActor_c *self, dActor_c *other)
Returns whether the ice block should push up the actor standing on it.
Definition d_a_ice.cpp:971
bool vf68(dBg_ctr_c *collider) override
Unknown, related to collision.
Definition d_a_ice.cpp:241
int execute() override
do method for the execute operation.
Definition d_a_ice.cpp:185
static sFStateID_c< daIce_c > StateID_Throw
Sliding across the ground after being thrown.
Definition d_a_ice.hpp:229
virtual bool checkFootBgcIsGround()
Returns whether touching the collider beneath the ice block counts as touching the ground.
Definition d_a_ice.cpp:250
@ WALL_ATTACH_NONE
The player is not touching a wall.
Definition d_a_ice.hpp:86
@ WALL_ATTACH_STUCK
The player is stuck between the ice block and a wall.
Definition d_a_ice.hpp:88
@ WALL_ATTACH_TOUCH
The player is also touching a wall on the other side of the ice block.
Definition d_a_ice.hpp:87
static sFStateID_c< daIce_c > StateID_TogeFloat
Floating up to the water surface, variant for spiky enemies.
Definition d_a_ice.hpp:221
void combobreakReq(int dir, dActor_c *initiator)
Requests the ice block to be broken by a combo attack (e.g. a shell being thrown).
Definition d_a_ice.cpp:557
static bool checkRevWall(dActor_c *self, dActor_c *other, u8 dir)
Returns whether the ice block should push the actor at its side.
Definition d_a_ice.cpp:975
void calcFloatSpeed()
Accelerates the ice block towards mFloatTargetSpeed in the direction it is tilted to.
Definition d_a_ice.cpp:762
bool checkPlAttach_Head(BOOL *playerTouchingCeiling)
Returns whether a player is standing on the ice block.
Definition d_a_ice.cpp:1164
void initWeight()
Calculates the weight class of the block.
Definition d_a_ice.cpp:295
BOOL mShake
Whether the ice block should shake.
Definition d_a_ice.hpp:275
bool checkPlHasami(int *plrNo)
Returns whether a player is stuck between the ice block and the background collision.
Definition d_a_ice.cpp:1148
int mTimer
A general purpose timer.
Definition d_a_ice.hpp:289
void poisonEffect()
Plays the poison splash effect.
Definition d_a_ice.cpp:1325
void deleteReady() override
Informs the base that it's about to be deleted.
Definition d_a_ice.cpp:209
daIce_c()
Constructs a new actor.
Definition d_a_ice.hpp:93
static sFStateID_c< daIce_c > StateID_Land
Resting on the ground.
Definition d_a_ice.hpp:225
static sFStateID_c< daIce_c > StateID_Sink
Slowing down after being created underwater.
Definition d_a_ice.hpp:216
int mCarriedByPlrNo
The player number of the player carrying the ice block.
Definition d_a_ice.hpp:267
static sFStateID_c< daIce_c > StateID_Fall
Falling down.
Definition d_a_ice.hpp:224
float mExtraFloatSpeedX
Added to the X speed while floating.
Definition d_a_ice.hpp:273
mVec2_c mBgcSizeIncrease
The amount to increase mCurrBgcSize per frame until the full size is reached.
Definition d_a_ice.hpp:255
void calcFloatAngle()
Tilts the ice block back and forth while floating up.
Definition d_a_ice.cpp:754
static sFStateID_c< daIce_c > StateID_Cover
Following the parent enemy. [Used for Fuzzies].
Definition d_a_ice.hpp:214
dBg_ctr_c mBgCtr
The dynamic collider.
Definition d_a_ice.hpp:253
static bool checkRevHead(dActor_c *self, dActor_c *other)
Returns whether the ice block should push down the actor below it.
Definition d_a_ice.cpp:967
mVec3_c mSize
The size of the ice block.
Definition d_a_ice.hpp:263
BOOL mBreakRequested
Whether the ice block should break.
Definition d_a_ice.hpp:291
m3d::anmTexSrt_c mAnm
The texture animation.
Definition d_a_ice.hpp:252
bool checkPlayerIn()
Checks whether a player overlaps the ice block.
Definition d_a_ice.cpp:382
mVec3_c mInitialPos
The position at creation.
Definition d_a_ice.hpp:260
bool checkSideBreak(dActor_c *actor, int direction)
Checks whether a thrown block hits a player / Yoshi from the side and causes daPlBase_c::DAMAGE_HIP_A...
Definition d_a_ice.cpp:839
mVec2_c mCurrBgcSize
The current dynamic collider size, grows over time.
Definition d_a_ice.hpp:254
void block_hit_init() override
Callback for when a block directly beneath the actor is hit.
Definition d_a_ice.cpp:1091
mVec3_c mModelPos
The position of the model, including the shake offset.
Definition d_a_ice.hpp:261
void treadcombobreakReq(int dir, dActor_c *initiator)
Like combobreakReq(), but uses the stomp combo score.
Definition d_a_ice.cpp:597
void enlargeBgc()
Enlarges the dynamic collider until it reaches the full size.
Definition d_a_ice.cpp:679
void initEffect(dIceEfScale_c scale)
Initializes the effect maker.
Definition d_a_ice.cpp:362
static sFStateID_c< daIce_c > StateID_Hop
Being launched with the parent enemy's speed. [Used for the Pokey segments].
Definition d_a_ice.hpp:215
short mShakeRotAngle
The current angle of the swinging motion.
Definition d_a_ice.hpp:277
BOOL mIsWater
Whether the block was created in water.
Definition d_a_ice.hpp:282
@ FLOAT_STATE_LOWERING
The water level is lowering.
Definition d_a_ice.hpp:80
@ FLOAT_STATE_RISING
The water level is rising.
Definition d_a_ice.hpp:79
@ FLOAT_STATE_STILL
The water level is constant, the block bobs up and down.
Definition d_a_ice.hpp:78
@ FLOAT_STATE_INIT
The water level has not been checked yet.
Definition d_a_ice.hpp:77
bool checkPlAttach_Foot(BOOL *playerTouchingFloor, int *plrNo)
Returns whether a player's head is touching the ice block.
Definition d_a_ice.cpp:1182
void normalShake()
Shakes the model left and right.
Definition d_a_ice.cpp:737
sBcMany mBcPointHead
The head sensor for tile collision.
Definition d_a_ice.hpp:257
FloatState_e mFloatState
The state of the water surface, used in StateID_FloatWait.
Definition d_a_ice.hpp:285
void starbreakReq(int dir, dActor_c *initiator)
Like combobreakReq(), but uses the star combo score.
Definition d_a_ice.cpp:610
static sFStateID_c< daIce_c > StateID_Air
Hanging in the air before falling down.
Definition d_a_ice.hpp:223
void setInfo(mVec3_c size, dIceEfScale_c scale)
Sets up the ice block. Called by the ice manager after creation.
Definition d_a_ice.cpp:257
float mPrevPosX
The X position before running execute().
Definition d_a_ice.hpp:292
m3d::mdl_c mMdl
The model.
Definition d_a_ice.hpp:250
void calcMdl()
Updates the model matrix.
Definition d_a_ice.cpp:226
mVec3_c mPrevPos
The position on the previous frame.
Definition d_a_ice.hpp:262
static sFStateID_c< daIce_c > StateID_PushSink
Being pushed under the water surface.
Definition d_a_ice.hpp:217
int mCollEntryTimer
Countdown until the collision is fully activated.
Definition d_a_ice.hpp:288
bool isQuakeDamage()
Checks whether the ice block should be broken by an earthquake.
Definition d_a_ice.cpp:516
dIceMng_c * getManager()
Gets the ice manager of the parent enemy.
Definition d_a_ice.cpp:814
bool checkBgIn()
Checks whether a solid tile overlaps the ice block.
Definition d_a_ice.cpp:407
void initCollision()
Sets up the tile collision, the actor collision and the dynamic collider.
Definition d_a_ice.cpp:308
dIceEfMaker_c mIceEfMaker
The ice effect maker.
Definition d_a_ice.hpp:298
void enlargeBgcLand()
Enlarges the dynamic collider when not in water.
Definition d_a_ice.cpp:687
bool checkPlAttach_Wall(int dir, int *checkResult)
Returns whether a player is touching the given side of the ice block.
Definition d_a_ice.cpp:1206
short mCurrFloatUpDown
Counter for bobbing up and down on the water surface.
Definition d_a_ice.hpp:283
static sFStateID_c< daIce_c > StateID_FloatWait
Floating on the water surface.
Definition d_a_ice.hpp:220
The base class for the player and Yoshi.
@ BGC_HEAD
Colliding with the head sensor.
@ BGC_FOOT
Colliding with the foot sensor.
@ STATUS_PENGUIN_SLIDE
The player is sliding with the penguin suit.
@ STATUS_SPIN_HIP_ATTACK_FALL
The player is falling while doing a down spin.
@ STATUS_OUT_OF_PLAY
The player is in a bubble or has died.
@ STATUS_HIP_ATTACK_FALL
The player is falling while ground pounding.
bool isStatus(int id)
The base class for all scenes, actors and various other processes.
Definition f_base.hpp:18
void deleteRequest()
Requests deletion of the base.
Definition f_base.cpp:289
ProfileName mProfName
The base's profile name.
Definition f_base.hpp:64
fBase_c * getConnectParent() const
Gets the base's parent.
Definition f_base.cpp:303
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:46
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:47
fBaseID_e mUniqueID
The base's unique identifier.
Definition f_base.hpp:62
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:72
mAng y
The rotation on the Y axis.
Definition m_angle.hpp:130
mAng z
The rotation on the Z axis.
Definition m_angle.hpp:131
mAng x
The rotation on the X axis.
Definition m_angle.hpp:129
A 3x4 matrix.
Definition m_mtx.hpp:9
void multVecZero(nw4r::math::VEC3 &out) const
Extracts the translation vector from the matrix.
Definition m_mtx.cpp:135
A two-dimensional floating point vector.
Definition m_vec.hpp:26
A three-dimensional floating point vector.
Definition m_vec.hpp:122
const u8 l_Ami_Line[]
The sub-layer for each side of chainlink fences.
Definition d_actor.cpp:38
fBaseID_e
A unique identifier for each base.
Definition f_base_id.hpp:6
@ BASE_ID_NULL
Represents the null base.
Definition f_base_id.hpp:7
#define ACTOR_PROFILE(profName, className, properties)
Creates an actor profile, using the profile number as the execute and draw order value.
Definition f_profile.hpp:29
u16 ProfileName
The name of a profile. Value is a fProf::PROFILE_NAME_e.
Definition f_profile.hpp:32
void hideFukidashiForSession(int playerId, int fukidashiAction)
Hides the given action prompt for the given player for the rest of the current session.
@ FORWARD_LOOP
Play the animation forward in a loop.
Definition banm.hpp:8
@ GAME_HEAP_DEFAULT
The default game heap (alias of MEM1 or MEM2).
Definition m_heap.hpp:38
EGG::ExpHeap * g_gameHeaps[GAME_HEAP_COUNT]
The game heaps.
Definition m_heap.cpp:13
float addCalc(float *value, float target, float smoothing, float maxStep, float minStep)
Smoothly moves value towards target using proportional scaling.
Definition s_lib.cpp:6
BOOL chase(s16 *value, s16 target, s16 step)
Moves value towards target by a fixed step amount.
Definition s_lib.cpp:122
#define STATE_DEFINE(class, name)
Defines a state.
Definition s_State.hpp:36
A one-dimensional short angle vector.
Definition m_angle.hpp:12
float sin() const
Computes the sine of the angle.
Definition m_angle.hpp:59
A structure that contains information about a collider.
Definition d_cc.hpp:99
u8 mKind
The type of this collider. See CC_KIND_e.
Definition d_cc.hpp:102
u8 mAttack
The attack type of this collider. See CC_ATTACK_e.
Definition d_cc.hpp:103
u16 mStatus
Status flags for this collider. See CC_STATUS_FLAG_e.
Definition d_cc.hpp:113