1#include "Game/MapObj/CrystalSwitch.hpp"
5CrystalSwitch::CrystalSwitch(
const char *pName) :
LiveActor(pName) {
13 MR::initDefaultPos(
this, rIter);
14 initModelManagerWithAnm(
"CrystalSwitch",
nullptr,
false);
15 MR::connectToSceneMapObj(
this);
19 sensor_offs.y = 100.0f;
21 MR::addHitSensorMapObj(
this,
"body", 16, 100.0f, sensor_offs);
23 MR::needStageSwitchWriteA(
this, rIter);
24 MR::getJMapInfoArg0NoInit(rIter, &_90);
25 initNerve(&NrvCrystalSwitch::CrystalSwitchNrvOff::sInstance);
26 initEffectKeeper(0,
nullptr,
false);
27 MR::startBck(
this,
"Wait",
nullptr);
28 MR::startBpk(
this,
"Off");
32void CrystalSwitch::control() {
38 if (MR::isSensorPlayer(a2)) {
39 a2->receiveMessage(41, a1);
48bool CrystalSwitch::trySwitchDown() {
50 setNerve(&NrvCrystalSwitch::CrystalSwitchNrvSwitchDown::sInstance);
57bool CrystalSwitch::tryOn() {
58 if (getNerveStep() > 10) {
59 setNerve(&NrvCrystalSwitch::CrystalSwitchNrvOn::sInstance);
66bool CrystalSwitch::tryOff() {
67 if (mRotateSpeed < 8.0f) {
68 setNerve(&NrvCrystalSwitch::CrystalSwitchNrvOff::sInstance);
75void CrystalSwitch::exeOff() {
76 if (MR::isFirstStep(
this)) {
77 MR::validateClipping(
this);
84void CrystalSwitch::exeSwitchDown() {
85 if (MR::isFirstStep(
this)) {
86 MR::startBpk(
this,
"On");
87 MR::invalidateClipping(
this);
93void CrystalSwitch::exeOn() {
94 if (MR::isFirstStep(
this)) {
96 MR::shakeCameraNormal();
97 MR::startSound(
this,
"SE_OJ_CRYSTAL_SWITCH_ON", -1, -1);
99 MR::setBckRate(
this, 10.0f);
103void CrystalSwitch::calcRotSpeed() {
104 if (isNerve(&NrvCrystalSwitch::CrystalSwitchNrvOn::sInstance)) {
105 if (mRotateSpeed < 10.0f) {
106 mRotateSpeed += 1.5f;
109 if (mRotateSpeed > 10.0f) {
110 mRotateSpeed = 10.0f;
114 if (mRotateSpeed > 10.0f) {
115 mRotateSpeed = 10.0f;
118 MR::setBckRate(
this, mRotateSpeed);
119 mRotateSpeed *= 0.99000001f;
121 if (mRotateSpeed < 0.0f) {
127CrystalSwitch::~CrystalSwitch() {
131namespace NrvCrystalSwitch {
132 INIT_NERVE(CrystalSwitchNrvOff);
133 INIT_NERVE(CrystalSwitchNrvSwitchDown);
134 INIT_NERVE(CrystalSwitchNrvOn);
135 INIT_NERVE(CrystalSwitchNrvSwitchUp);
137 void CrystalSwitchNrvSwitchUp::execute(
Spine *pSpine)
const {
140 if (MR::isFirstStep(crystal)) {
141 MR::startBpk(crystal,
"Off");
147 void CrystalSwitchNrvOn::execute(
Spine *pSpine)
const {
152 void CrystalSwitchNrvSwitchDown::execute(
Spine *pSpine)
const {
154 crystal->exeSwitchDown();
157 void CrystalSwitchNrvOff::execute(
Spine *pSpine)
const {
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)