SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
KillerGunnerSingle.cpp
1#include "Game/MapObj/KillerGunnerSingle.hpp"
2
3KillerGunnerSingle::KillerGunnerSingle(const char *pName) : LiveActor(pName) {
4
5}
6
8 MR::initDefaultPos(this, rIter);
9 initModelManagerWithAnm("KillerGunnerSingle", nullptr, false);
10 MR::connectToSceneEnvironment(this);
11 initHitSensor(2);
12 TVec3f sensor_offs;
13 sensor_offs.x = 0.0f;
14 sensor_offs.y = 0.0f;
15 sensor_offs.z = 0.0f;
16 MR::addHitSensorMapObj(this, "body", 0x10, 0.0f, sensor_offs);
17
18 TVec3f shell_sensor_offs(sShellPos);
19 MR::addHitSensorEnemy(this, "shell", 0x10, 250.0f, shell_sensor_offs);
20 MR::initCollisionParts(this, "KillerGunnerSingle", getSensor("body"), nullptr);
21 initEffectKeeper(0, nullptr, false);
22 initSound(4, false);
23 MR::setClippingTypeSphereContainsModelBoundingBox(this, 100.0f);
24 initNerve(&NrvKillerGunnerSingle::HostTypeWait::sInstance);
25 makeActorAppeared();
26}
27
28void KillerGunnerSingle::attackSensor(HitSensor *a1, HitSensor *a2) {
29 if (isNerve(&NrvKillerGunnerSingle::HostTypeShoot::sInstance)) {
30 if (MR::isSensorPlayer(a2)) {
31 if (MR::isNear(a1, a2, a1->mRadius)) {
32 if (MR::sendMsgEnemyAttackMaximum(a2, a1)) {
33 setNerve(&NrvKillerGunnerSingle::HostTypeAttack::sInstance);
34 }
35 }
36 }
37 }
38}
39
40void KillerGunnerSingle::exeWait() {
41 if (MR::isFirstStep(this)) {
42 getSensor("shell")->invalidate();
43 }
44
45 if (MR::isStep(this, 120)) {
46 setNerve(&NrvKillerGunnerSingle::HostTypeCharge::sInstance);
47 }
48}
49
50void KillerGunnerSingle::exeCharge() {
51 if (MR::isFirstStep(this)) {
52 MR::startBtk(this, "KillerGunnerSingleCharge");
53 }
54
55 MR::startLevelSound(this, "SE_OJ_LV_K_GUNNER_CHARGE", -1, -1, -1);
56
57 if (MR::isBtkStopped(this)) {
58 MR::startBck(this, "KillerGunnerSingleShoot", nullptr);
59 MR::emitEffect(this, "KillerGunnerSingleSmoke");
60 MR::startSound(this, "SE_OJ_K_GUNNER_FIRE", -1, -1);
61 setNerve(&NrvKillerGunnerSingle::HostTypeShoot::sInstance);
62 }
63}
64
65void KillerGunnerSingle::exeShoot() {
66 if (MR::isFirstStep(this)) {
67 MR::startRumbleWithShakeCameraWeak(this, "中", "弱", 500.0f, 1000.0f);
68 }
69
70 if (MR::isStep(this, 0)) {
71 getSensor("shell")->validate();
72 }
73
74 if (MR::isStep(this, 40)) {
75 getSensor("shell")->invalidate();
76 }
77
78 if (MR::isBckStopped(this)) {
79 setNerve(&NrvKillerGunnerSingle::HostTypeWait::sInstance);
80 }
81}
82
83inline void KillerGunnerSingle::exeAttack() {
84 if (MR::isBckStopped(this)) {
85 setNerve(&NrvKillerGunnerSingle::HostTypeWait::sInstance);
86 }
87}
88
89KillerGunnerSingle::~KillerGunnerSingle() {
90
91}
92
93namespace NrvKillerGunnerSingle {
94 INIT_NERVE(HostTypeAttack);
95 INIT_NERVE(HostTypeShoot);
96 INIT_NERVE(HostTypeCharge);
97 INIT_NERVE(HostTypeWait);
98};
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)
Definition LiveActor.hpp:24
HitSensor * getSensor(const char *pSensorName) const
Gets a sensor.