1#include "Game/MapObj/BeeFlowerHover.hpp"
2#include "Game/LiveActor/LodCtrl.hpp"
4BeeFlowerHover::BeeFlowerHover(
const char *pName) :
LiveActor(pName) {
16 MR::initDefaultPos(
this, rIter);
17 initModelManagerWithAnm(
"BeeFlowerHover", 0,
false);
18 MR::connectToSceneMapObj(
this);
20 MR::addBodyMessageSensorMapObj(
this);
21 MR::initCollisionPartsAutoEqualScale(
this,
"BeeFlowerHover",
getSensor(0), 0);
22 initEffectKeeper(0, 0,
false);
25 if (MR::isConnectedWithRail(rIter)) {
28 mRailMover->
init(rIter);
32 mRailPosture->_48 = 2;
37 MR::initShadowVolumeCylinder(
this, 450.0f);
38 MR::onShadowFollowHostScale(
this, 0);
41 MR::onCalcShadowOneTime(
this, 0);
45 MR::getJMapInfoArg7NoInit(rIter, &drop_length);
46 if (drop_length != -1) {
47 MR::setShadowDropLength(
this, 0, drop_length);
51 MR::initAndSetRailClipping(&_CC,
this, 100.0f, 500.0f);
54 MR::setClippingTypeSphereContainsModelBoundingBox(
this, 100.0f);
58 MR::onCalcGravity(
this);
61 MR::calcGravity(
this);
64 MR::getJMapInfoArg0NoInit(rIter, &_BC);
66 mLodCtrlPlanet = MR::createLodCtrlPlanet(
this, rIter, 100.0f, -1);
67 mLodCtrlPlanet->validate();
68 initNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvWait::sInstance);
72void BeeFlowerHover::exeSoftTouch() {
73 if (MR::isFirstStep(
this)) {
74 MR::startBck(
this,
"OnBee", 0);
75 MR::startSound(
this,
"SE_OJ_BEE_FLOWER_BEE_ON", -1, -1);
78 if (MR::isBckStopped(
this)) {
79 setNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvSoftTouchWait::sInstance);
83void BeeFlowerHover::exeSoftTouchWait() {
84 if (MR::isFirstStep(
this)) {
85 MR::startBck(
this,
"Wait", 0);
88 if (!MR::isPlayerElementModeBee()) {
89 setNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvHardTouch::sInstance);
94 setNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvWait::sInstance);
99void BeeFlowerHover::exeHardTouch() {
100 if (MR::isFirstStep(
this)) {
101 MR::startBck(
this,
"ThroughMario", 0);
102 MR::startSound(
this,
"SE_OJ_BEE_FLOWER_DISAPPEAR", -1, -1);
103 MR::invalidateCollisionParts(
this);
104 MR::invalidateShadow(
this, 0);
105 MR::onCalcShadowOneTime(
this, 0);
106 MR::tryRumblePadMiddle(
this, 0);
107 MR::shakeCameraNormal();
110 if (MR::isBckStopped(
this)) {
112 setNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvRecover::sInstance);
116void BeeFlowerHover::exeRecover() {
117 if (MR::isStep(
this, 0x3C)) {
118 MR::validateShadow(
this, 0);
119 MR::onCalcShadowOneTime(
this, 0);
121 MR::startBck(
this,
"Appear", 0);
122 MR::startSound(
this,
"SE_OJ_BEE_FLOWER_RECOVER", -1, -1);
125 if (MR::isGreaterEqualStep(
this, 0x3C) && MR::isBckStopped(
this) && !MR::isHiddenModel(
this)) {
126 MR::validateCollisionParts(
this);
127 setNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvWait::sInstance);
132void BeeFlowerHover::control() {
133 if (!isNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvRecover::sInstance)) {
134 mLodCtrlPlanet->update();
136 if (mLodCtrlPlanet->isShowLowModel()) {
143 v5 = v5 * 0.017453292f;
149 v12.mMtx[0][3] = 0.0f;
150 v12.mMtx[1][3] = 0.0f;
151 v12.mMtx[2][3] = 0.0f;
155 f32 mag = PSVECMag(v10.toCVec());
156 PSVECNormalize(v10.toCVec(), v10.toVec());
159 v12.mMtx[0][0] = v7 + ((1.0f - v7) * (v10.x * v10.x));
160 v12.mMtx[1][1] = v7 + ((1.0f - v7) * (v10.y * v10.y));
162 v12.mMtx[2][2] = v7 + ((1.0f - v7) * (v10.z * v10.z));
166 v12.mMtx[0][1] = (v10.y * ((1.0f - v7) * v10.x)) - (v6 * v10.z);
167 v12.mMtx[1][0] = (v10.y * ((1.0f - v7) * v10.x)) + (v6 * v10.z);
168 v12.mMtx[0][2] = (v10.z * ((1.0f - v7) * v10.x)) + (v6 * v10.y);
169 v12.mMtx[2][0] = (v10.z * ((1.0f - v7) * v10.x)) - (v6 * v10.y);
170 v12.mMtx[1][2] = (v10.z * ((1.0f - v7) * v10.y)) - (v6 * v10.x);
171 v12.mMtx[2][1] = (v10.z * ((1.0f - v7) * v10.y)) + (v6 * v10.x);
175 mRailMover->movement();
176 mRailPosture->movement();
187 stack_8.concat(mRailPosture->_18);
190 MR::makeMtxRotate(stack_8.toMtxPtr(),
mRotation);
197 MR::setBaseTRMtx(
this, stack_8);
201 if (!isNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvWait::sInstance)) {
205 if (MR::isMsgFloorTouch(msg)) {
206 if (MR::isPlayerElementModeBee()) {
207 setNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvSoftTouch::sInstance);
210 setNerve(&NrvBeeFlowerHover::BeeFlowerHoverNrvHardTouch::sInstance);
219BeeFlowerHover::~BeeFlowerHover() {
223namespace NrvBeeFlowerHover {
224 INIT_NERVE(BeeFlowerHoverNrvWait);
225 INIT_NERVE(BeeFlowerHoverNrvSoftTouch);
226 INIT_NERVE(BeeFlowerHoverNrvSoftTouchWait);
227 INIT_NERVE(BeeFlowerHoverNrvHardTouch);
228 INIT_NERVE(BeeFlowerHoverNrvRecover);
230 void BeeFlowerHoverNrvRecover::execute(
Spine *pSpine)
const {
232 flower->exeRecover();
235 void BeeFlowerHoverNrvHardTouch::execute(
Spine *pSpine)
const {
237 flower->exeHardTouch();
240 void BeeFlowerHoverNrvSoftTouchWait::execute(
Spine *pSpine)
const {
242 flower->exeSoftTouchWait();
245 void BeeFlowerHoverNrvSoftTouch::execute(
Spine *pSpine)
const {
247 flower->exeSoftTouch();
250 void BeeFlowerHoverNrvWait::execute(
Spine *pSpine)
const {
253 if (MR::isFirstStep(flower)) {
254 MR::startBck(flower,
"Wait", 0);
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
virtual void calcAndSetBaseMtx()
Calculates and sets the base matrix of the actor.
The basis of a drawable actor that can contain states (see: Nerve)
TVec3f mRotation
3D vector of the actor's rotation.
TVec3f mPosition
3D vector of the actor's position.
HitSensor * getSensor(const char *pSensorName) const
Gets a sensor.
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
void initWithoutIter()
Initializes a NameObj without a JMapInfoIter instance.