1#include "Game/MapObj/BlackHole.hpp"
2#include "Game/LiveActor/ModelObj.hpp"
3#include "Game/Util.hpp"
8 initMapToolInfo(rIter);
10 MR::connectToSceneMapObj(
this);
12 MR::addHitSensorEye(
this,
"body", 0x10, _A0, TVec3f(0.0f, 0.0f, 0.0f));
13 initEffectKeeper(0, 0,
false);
14 MR::setEffectHostMtx(
this,
"BlackHoleSuction", (MtxPtr)&_D8);
16 f32 val = 500.0f * _9C;
24 f32 clippingRadius = 500.0f * radius;
25 MR::setClippingTypeSphere(
this, clippingRadius);
26 MR::setClippingTypeSphere(mBlackHoleModel, clippingRadius);
27 MR::setClippingFarMax(
this);
28 MR::setClippingFarMax(mBlackHoleModel);
31 if (MR::tryRegisterDemoCast(
this, rIter)) {
32 MR::registerDemoActionNerve(
this, &NrvBlackHole::BlackHoleNrvDisappear::sInstance, 0);
35 bool isCreated = MR::createActorCameraInfoIfExist(rIter, &mCameraInfo);
37 MR::initActorCamera(
this, rIter, &mCameraInfo);
40 initNerve(&NrvBlackHole::BlackHoleNrvWait::sInstance);
41 bool uses = MR::useStageSwitchReadAppear(
this, rIter);
43 MR::syncStageSwitchAppear(
this);
51void BlackHole::makeActorAppeared() {
52 bool isOnSwitch =
false;
53 if (MR::isValidSwitchA(
this) && MR::isOnSwitchA(
this)) {
58 LiveActor::makeActorAppeared();
59 mBlackHoleModel->makeActorAppeared();
63void BlackHole::kill() {
65 mBlackHoleModel->kill();
68bool BlackHole::tryStartDemoCamera() {
70 MR::startActorCameraTargetSelf(
this, mCameraInfo, -1);
78 if (isNerve(&NrvBlackHole::BlackHoleNrvWait::sInstance)) {
79 if (!_A4 || isInCubeBox(a2->mPosition)) {
80 if (MR::sendArbitraryMsg(0x73, a2, a1)) {
81 if (MR::isSensorPlayer(a2)) {
82 setNerve(&NrvBlackHole::BlackHoleNrvDemo::sInstance);
91void BlackHole::initMapToolInfo(
const JMapInfoIter &rIter) {
92 MR::initDefaultPos(
this, rIter);
93 MR::useStageSwitchReadA(
this, rIter);
94 MR::useStageSwitchReadAppear(
this, rIter);
96 if (MR::isEqualObjectName(rIter,
"BlackHoleCube")) {
106 stack_C.setInlineXYPS(
mScale);
107 _A0 = PSVECMag(stack_C.toCVec());
111 bool ret = MR::getJMapInfoArg0NoInit(rIter, &arg0);
114 _9C = arg0 / 1000.0f;
125void BlackHole::initModel() {
126 initModelManagerWithAnm(
"BlackHoleRange", 0,
false);
127 mBlackHoleModel = MR::createModelObjMapObj(
"コアモデル",
"BlackHole",
getBaseMtx());
128 mBlackHoleModel->makeActorDead();
129 updateModelScale(_9C, _9C);
133void BlackHole::initCubeBox() {
139 TVec3f stack_8(0.5f * (1000.0f * -
mScale.x), 0.5f * (1000.0f * -
mScale.y), 0.5f * (1000.0f * -
mScale.z));
140 TVec3f stack_14(0.5f * (1000.0f *
mScale.x), 0.5f * (1000.0f,
mScale.z), 0.5f * (1000.0f *
mScale.y));
141 _A4->mMin.set(stack_8);
142 _A4->mMax.set(stack_14);
146bool BlackHole::isInCubeBox(
const TVec3f &rVec)
const {
148 _A8.multTranspose(rVec, stack_8);
151 if (stack_8.x >= box->mMin.x && stack_8.y >= box->mMin.y && stack_8.z >= box->mMin.z && stack_8.x < box->mMax.x && stack_8.y < box->mMax.y && stack_8.z < box->mMax.z) {
158void BlackHole::updateModelScale(f32 a1, f32 a2) {
160 mBlackHoleModel->
mScale.setAll<f32>(0.5f * a2);
163void BlackHole::exeWait() {
164 if (MR::isFirstStep(
this)) {
165 MR::startBck(
this,
"BlackHoleRange", 0);
166 MR::startBtk(
this,
"BlackHoleRange");
167 MR::startBtk(mBlackHoleModel,
"BlackHole");
170 MR::startLevelSound(
this,
"SE_OJ_LV_BLACK_HOLE", -1, -1, -1);
171 bool isOnSwitch =
false;
172 if (MR::isValidSwitchA(
this) && MR::isOnSwitchA(
this)) {
181void BlackHole::exeDisappear() {
182 if (MR::isFirstStep(
this)) {
183 MR::startSound(
this,
"SE_OJ_BLACK_HOLE_DISAPPEAR", -1, -1);
186 f32 nerveEaseIn = MR::calcNerveEaseInValue(
this, 0x5A, _9C, 0.0f);
187 f32 blackHoleEase = MR::calcNerveEaseInValue(
this, 0x1E, 0x5A, _9C, 0.0f);
188 mScale.setAll<f32>(nerveEaseIn);
189 mBlackHoleModel->
mScale.setAll<f32>(0.5f * blackHoleEase);
191 if (MR::isStep(
this, 0x5A)) {
196BlackHole::~BlackHole() {
200namespace NrvBlackHole {
201 BlackHoleNrvWait BlackHoleNrvWait::sInstance;
202 BlackHoleNrvDemo BlackHoleNrvDemo::sInstance;
203 BlackHoleNrvDisappear BlackHoleNrvDisappear::sInstance;
205 void BlackHoleNrvDisappear::execute(
Spine *pSpine)
const {
207 blackHole->exeDisappear();
210 void BlackHoleNrvDemo::execute(
Spine *pSpine)
const {
212 MR::startLevelSound(blackHole,
"SE_OJ_LV_BLACK_HOLE", -1, -1, -1);
215 void BlackHoleNrvWait::execute(
Spine *pSpine)
const {
217 blackHole->exeWait();
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
TVec3f mRotation
3D vector of the actor's rotation.
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.
void setName(const char *pName)
Sets the NameObj's mName.