1#include "Game/MapObj/BigFan.hpp"
2#include "Game/MapObj/BigFanHolder.hpp"
3#include "Game/LiveActor/ModelObj.hpp"
4#include "JSystem/JMath/JMath.hpp"
6BigFan::BigFan(
const char *pName) :
LiveActor(pName) {
11 mWindLength = 4000.0f;
13 mIsTeresaGalaxy =
false;
14 BigFanFunction::createBigFanHolder();
15 BigFanFunction::registerBigFan(
this);
19 MR::initDefaultPos(
this, rIter);
20 const char* object_name;
21 MR::getObjectName(&object_name, rIter);
22 initModelManagerWithAnm(object_name, 0,
false);
23 MR::connectToSceneNoSilhouettedMapObj(
this);
25 if (MR::isExistCollisionResource(
this, object_name)) {
27 MR::addBodyMessageSensorReceiver(
this);
28 MR::initCollisionParts(
this, object_name,
getSensor(0), 0);
31 MR::getJMapInfoArg0NoInit(rIter, &mWindLength);
32 MR::getJMapInfoArg1NoInit(rIter, &_A0);
35 MR::calcFrontVec(&front,
this);
36 JMAVECScaleAdd(front.toCVec(),
mPosition.toCVec(), _90.toVec(), 0.5f * mWindLength);
37 MR::setClippingTypeSphere(
this, 400.0f + mWindLength, &_90);
40 if (MR::isEqualStageName(
"TeresaMario2DGalaxy")) {
41 mIsTeresaGalaxy =
true;
44 mIsTeresaGalaxy =
false;
47 initNerve(&NrvBigFan::BigFanNrvWait::sInstance);
48 if (MR::useStageSwitchReadAppear(
this, rIter)) {
49 void (
BigFan::*startFunc)(
void) = &BigFan::start;
50 MR::listenStageSwitchOnAppear(
this, MR::Functor(
this, startFunc));
51 setNerve(&NrvBigFan::BigFanNrvStop::sInstance);
55 MR::registerDemoSimpleCastAll(
this);
59void BigFan::initWindModel() {
60 mWindModel = MR::createModelObjMapObj(
"風モデル",
"BigFanWind",
getBaseMtx());
62 MR::invalidateClipping(mWindModel);
63 MR::startBtk(mWindModel,
"BigFanWind");
64 MR::registerDemoSimpleCastAll(mWindModel);
65 mWindModel->
mScale.z = mWindLength / 2000.0f;
68void BigFan::calcWindInfo(TVec3f *pWindInfo,
const TVec3f &a2) {
69 if (MR::isDead(
this) || isStartOrWait()) {
73 if (mWindLength <= 0.0f) {
79 MR::calcFrontVec(&front_vec,
this);
80 MR::normalize(&front_vec);
82 f32 dot = front_vec.dot(stack_38);
90 stack_2C.setInlinePS(stack_38 - (front_vec * dot));
91 f32 mag = PSVECMag(stack_2C.toCVec());
93 if (mag >= 400.0f *
mScale.x) {
98 f32 scalar = (1.0f - (dot / mWindLength));
104 front_vec.multAndSet(pWindInfo, scalar);
109void BigFan::control() {
113void BigFan::start() {
114 if (isNerve(&NrvBigFan::BigFanNrvStop::sInstance)) {
115 setNerve(&NrvBigFan::BigFanNrvStart::sInstance);
119void BigFan::exeStart() {
120 if (MR::isFirstStep(
this)) {
121 mWindModel->appear();
122 MR::startAction(
this,
"Appear");
123 MR::startAction(mWindModel,
"Appear");
125 if (mIsTeresaGalaxy) {
126 MR::startSound(
this,
"SE_OJ_BIG_FAN_START_FAR", -1, -1);
129 MR::startSound(
this,
"SE_OJ_BIG_FAN_START", -1, -1);
133 if (MR::isActionEnd(
this)) {
134 setNerve(&NrvBigFan::BigFanNrvWait::sInstance);
138void BigFan::exeWait() {
139 if (MR::isFirstStep(
this)) {
140 MR::startAction(
this,
"Wait");
141 MR::startAction(mWindModel,
"Wait");
144 if (mIsTeresaGalaxy) {
145 MR::startLevelSound(
this,
"SE_OJ_LV_BIG_FAN_FAR", -1, -1, -1);
148 MR::startLevelSound(
this,
"SE_OJ_LV_BIG_FAN", -1, -1, -1);
153 INIT_NERVE(BigFanNrvStop);
154 INIT_NERVE(BigFanNrvStart);
155 INIT_NERVE(BigFanNrvWait);
157 void BigFanNrvWait::execute(
Spine *pSpine)
const {
158 BigFan* fan =
reinterpret_cast<BigFan*
>(pSpine->mExecutor);
162 void BigFanNrvStart::execute(
Spine *pSpine)
const {
163 BigFan* fan =
reinterpret_cast<BigFan*
>(pSpine->mExecutor);
167 void BigFanNrvStop::execute(
Spine *pSpine)
const {
168 BigFan* fan =
reinterpret_cast<BigFan*
>(pSpine->mExecutor);
170 if (MR::isFirstStep(fan)) {
171 MR::startAction(fan,
"Appear");
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
The basis of a drawable actor that can contain states (see: Nerve)
TVec3f mPosition
3D vector of the actor's position.
TVec3f mScale
3D vector of the actor's scale.
virtual MtxPtr getBaseMtx() const
Gets the base matrix of the model used for the actor.
HitSensor * getSensor(const char *pSensorName) const
Gets a sensor.
void initWithoutIter()
Initializes a NameObj without a JMapInfoIter instance.