1#include "Game/MapObj/ArrowSwitchMulti.hpp"
2#include "Game/MapObj/ArrowSwitchMultiHolder.hpp"
3#include "Game/Map/StageSwitch.hpp"
5ArrowSwitchTarget::ArrowSwitchTarget(
const char *pName) :
NameObj(pName) {
7 mStageSwitchCtrl =
nullptr;
9 MR::createArrowSwitchMultiHolder();
14 MR::getJMapInfoArg0WithInit(rIter, &arg);
16 MR::getJMapInfoArg1WithInit(rIter, &mTargetIdx);
17 mStageSwitchCtrl = MR::createStageSwitchCtrl(
this, rIter);
20void ArrowSwitchTarget::initAfterPlacement() {
21 MR::registerArrowSwitchTarget(
this);
24void ArrowSwitchTarget::onTarget() {
25 if (mStageSwitchCtrl->isValidSwitchA()) {
26 mStageSwitchCtrl->onSwitchA();
29 if (mStageSwitchCtrl->isValidSwitchB()) {
30 mStageSwitchCtrl->offSwitchB();
34void ArrowSwitchTarget::offTarget() {
35 if (mStageSwitchCtrl->isValidSwitchA()) {
36 mStageSwitchCtrl->offSwitchA();
39 if (mStageSwitchCtrl->isValidSwitchB()) {
40 mStageSwitchCtrl->onSwitchB();
45ArrowSwitchMulti::ArrowSwitchMulti(
const char *pName) :
LiveActor(pName) {
52 MR::createArrowSwitchMultiHolder();
54 for (u32 i = 0; i < 4; i++) {
55 mTargetArray[i] =
nullptr;
60 mTargetArray[pTarget->mTargetIdx] = pTarget;
64 MR::initDefaultPos(
this, rIter);
65 initModelManagerWithAnm(
"ArrowSwitch",
nullptr,
false);
66 MR::connectToSceneNoSilhouettedMapObjStrongLight(
this);
68 MR::getJMapInfoArg0WithInit(rIter, &arg);
71 if (MR::isInAreaObj(
"PlaneModeCube",
mPosition)) {
73 MR::addHitSensorMapObj(
this,
"body", 8, 100.0f, TVec3f(0.0f, 50.0f, 250.0f));
77 MR::addHitSensorMapObj(
this,
"body", 8, 100.0f, TVec3f(0.0f, 50.0f, 250.0f));
78 MR::addHitSensorMapObjMoveCollision(
this,
"collision", 8, 0.0f, TVec3f(0.0f, 0.0f, 0.0f));
79 MR::initCollisionParts(
this,
"ArrowSwitch",
getSensor(
"collision"),
nullptr);
83 MR::registerArrowSwitchMulti(
this);
84 initNerve(&NrvArrowSwitchMulti::ArrowSwitchMultiNrvWait::sInstance);
88void ArrowSwitchMulti::control() {
96 pos.setInline(baseMtx);
103 tr_mtx.mMtx[0][2] = v12;
104 tr_mtx.mMtx[1][1] = 1.0f;
105 tr_mtx.mMtx[0][0] = v13;
106 tr_mtx.mMtx[2][0] = -v12;
107 tr_mtx.mMtx[2][2] = v13;
108 tr_mtx.mMtx[2][1] = 0.0f;
109 tr_mtx.mMtx[1][2] = 0.0f;
110 tr_mtx.mMtx[1][0] = 0.0f;
111 tr_mtx.mMtx[0][1] = 0.0f;
112 pos.concat(pos, tr_mtx);
113 MR::setBaseTRMtx(
this, pos);
117 if (MR::isMsgPlayerHitAll(msg)) {
118 return requestPunch(a2, a3);
129 if (!isNerve(&NrvArrowSwitchMulti::ArrowSwitchMultiNrvWait::sInstance)) {
143 MR::invalidateClipping(
this);
144 setNerve(&NrvArrowSwitchMulti::ArrowSwitchMultiNrvRotate::sInstance);
148void ArrowSwitchMulti::exeWait() {
149 if (MR::isFirstStep(
this)) {
151 MR::startBtk(
this,
"On");
154 MR::startBtk(
this,
"Off");
157 MR::validateClipping(
this);
163ArrowSwitchMulti::~ArrowSwitchMulti() {
167ArrowSwitchTarget::~ArrowSwitchTarget() {
171namespace NrvArrowSwitchMulti {
172 INIT_NERVE(ArrowSwitchMultiNrvWait);
173 INIT_NERVE(ArrowSwitchMultiNrvRotate);
175 void ArrowSwitchMultiNrvRotate::execute(
Spine *pSpine)
const {
180 void ArrowSwitchMultiNrvWait::execute(
Spine *pSpine)
const {
virtual void calcAndSetBaseMtx()
Calculates and sets the base matrix of the actor.
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
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.
virtual void calcAndSetBaseMtx()
Calculates and sets the base matrix of the actor.
virtual MtxPtr getBaseMtx() const
Gets the base matrix of the model used for the actor.
HitSensor * getSensor(const char *pSensorName) const
Gets a sensor.
The most basic form of an object.