1#include "Game/MapObj/MapPartsRotator.hpp"
2#include "Game/LiveActor/Spine.hpp"
3#include "Game/Util.hpp"
28 MR::getMapPartsArgRotateAngle(&mRotateAngle, rIter);
29 MR::getMapPartsArgRotateAxis(&mRotateAxis, rIter);
30 MR::getMapPartsArgRotateAccelType(&mRotateAccelType, rIter);
31 initRotateSpeed(rIter);
32 MR::getMapPartsArgRotateStopTime(&mRotateStopTime, rIter);
33 MR::getMapPartsArgRotateType(&mRotateType, rIter);
34 MR::getMapPartsArgSignMotionType(&mSignMotionType, rIter);
36 if (MR::isNearZero(_18, 0.001f)) {
37 initNerve(&NrvMapPartsRotator::HostTypeNeverMove::sInstance);
40 initNerve(&NrvMapPartsRotator::HostTypeWait::sInstance);
43 bool cond = 0.0f < _18;
50 angle = -mRotateAngle;
56void MapPartsRotator::start() {
58 updateRotateMtx((AxisType)mRotateAxis, mAngle);
59 setNerve(&NrvMapPartsRotator::HostTypeRotate::sInstance);
62void MapPartsRotator::end() {
63 setNerve(&NrvMapPartsRotator::HostTypeWait::sInstance);
66bool MapPartsRotator::isWorking()
const {
67 if (!isNerve(&NrvMapPartsRotator::HostTypeNeverMove::sInstance)) {
68 return !isNerve(&NrvMapPartsRotator::HostTypeWait::sInstance);
74void MapPartsRotator::startWithSignalMotion() {
77 setNerve(&NrvMapPartsRotator::HostTypeRotateStart::sInstance);
80void MapPartsRotator::cancelSignalMotion() {
82 updateRotateMtx((AxisType)mRotateAxis, _A0);
83 setNerve(&NrvMapPartsRotator::HostTypeWait::sInstance);
86bool MapPartsRotator::isMoving()
const {
87 return isNerve(&NrvMapPartsRotator::HostTypeRotate::sInstance);
90void MapPartsRotator::restartAtEnd() {
91 if (mRotateType != 0) {
92 if (mRotateType == 1) {
98 if (MR::hasMapPartsMoveStartSignMotion(mSignMotionType)) {
99 setNerve(&NrvMapPartsRotator::HostTypeRotateStart::sInstance);
102 setNerve(&NrvMapPartsRotator::HostTypeRotate::sInstance);
107void MapPartsRotator::initRotateSpeed(
const JMapInfoIter &rIter) {
108 if (mRotateAccelType == 2) {
110 MR::getMapPartsArgRotateTime(&rotate_time, rIter);
111 _18 = mRotateAngle / rotate_time;
114 MR::getMapPartsArgRotateSpeed(&mRotateSpeed, rIter);
115 _18 *= 0.0099999998f;
118 if (mRotateAngle < 0.0f) {
123void MapPartsRotator::calcRotateAxisDir(AxisType type, TVec3f *pDir)
const {
147MapPartsRotator::~MapPartsRotator() {
151namespace NrvMapPartsRotator {
152 HostTypeNeverMove HostTypeNeverMove::sInstance;
153 HostTypeWait HostTypeWait::sInstance;
154 HostTypeRotateStart HostTypeRotateStart::sInstance;
155 HostTypeRotate HostTypeRotate::sInstance;
156 HostTypeStopAtEnd HostTypeStopAtEnd::sInstance;
158 void HostTypeStopAtEnd::execute(
Spine *pSpine)
const {
160 if (rotator->isStep(rotator->mRotateStopTime)) {
161 rotator->restartAtEnd();
165 void HostTypeRotate::execute(
Spine *pSpine)
const {
167 rotator->exeRotate();
170 void HostTypeRotateStart::execute(
Spine *pSpine)
const {
172 rotator->exeRotateStart();
175 void HostTypeWait::execute(
Spine *pSpine)
const {
179 void HostTypeNeverMove::execute(
Spine *pSpine)
const {
184bool MapPartsRotator::isOnReverse()
const {
188f32 MapPartsRotator::getRotateSpeed()
const {
The basis of a drawable actor that can contain states (see: Nerve)
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.