1#include "Game/Map/SeaGull.hpp"
2#include "Game/Util.hpp"
4NrvSeaGull::SeaGullNrvHoverFront NrvSeaGull::SeaGullNrvHoverFront::sInstance;
5NrvSeaGull::SeaGullNrvHoverLeft NrvSeaGull::SeaGullNrvHoverLeft::sInstance;
6NrvSeaGull::SeaGullNrvHoverRight NrvSeaGull::SeaGullNrvHoverRight::sInstance;
9 mSeaGullGroup = pGroup;
12 _98 = MR::getRandom((s32)0, (s32)0xB4);
35 MR::initDefaultPos(
this, rIter);
36 MR::calcActorAxis(&_C4, &_B8, &_AC,
this);
37 MR::calcActorAxisY(&_A0,
this);
38 initModelManagerWithAnm(
"SeaGull", 0,
false);
39 MR::startBck(
this,
"Fly", 0);
40 MR::setBckFrameAtRandom(
this);
41 MR::connectToSceneEnvironment(
this);
42 f32 railLength = MR::getRailTotalLength(mSeaGullGroup);
43 f32 diff = railLength - 1.0f;
44 f32 rnd = MR::getRandom(1.0f, diff);
45 f64 val = rnd / 500.0f;
47 MR::calcRailPosAtCoord(&
mPosition, mSeaGullGroup, rnd);
48 u8 a = MR::isHalfProbability();
50 _9C = mSeaGullGroup->updatePosInfo(&_90, a);
54 f32 scale = MR::getRandom(-1.0f, 1.0f);
55 stack_14.scale(scale);
56 scale = MR::getRandom(-1.0f, 1.0f);
61 if (MR::isNearZero(_AC, 0.001f)) {
70 initNerve(&NrvSeaGull::SeaGullNrvHoverFront::sInstance);
72 _E0 = MR::getRandom((s32)0x3C, (s32)0x1E0);
73 MR::invalidateClipping(
this);
78void SeaGull::exeHoverFront() {
79 if (MR::isFirstStep(
this)) {
80 _D0 = MR::getRandom((s32)0, (s32)0x3C);
91 f32 dist = PSVECDistance((
const Vec*)&
mPosition, (
const Vec*)_9C);
94 f32 prod = _C4.dot(stack_8);
97 setNerve(&NrvSeaGull::SeaGullNrvHoverLeft::sInstance);
100 setNerve(&NrvSeaGull::SeaGullNrvHoverRight::sInstance);
106void SeaGull::exeHoverLeft() {
107 if (MR::isFirstStep(
this)) {
108 _D0 = MR::getRandom((s32)0x3C, (s32)0x78);
113 if (MR::isStep(
this, _D0)) {
114 setNerve(&NrvSeaGull::SeaGullNrvHoverFront::sInstance);
118void SeaGull::exeHoverRight() {
119 if (MR::isFirstStep(
this)) {
120 _D0 = MR::getRandom((s32)0x3C, (s32)0x78);
125 if (MR::isStep(
this, _D0)) {
126 setNerve(&NrvSeaGull::SeaGullNrvHoverFront::sInstance);
130void SeaGull::control() {
137 f32 mag = PSVECMag((
const Vec*)&
mVelocity);
146 PSVECCrossProduct((
const Vec*)&_B8, (
const Vec*)&_AC, (Vec*)&_C4);
148 PSVECCrossProduct((
const Vec*)&_AC, (
const Vec*)&_C4, (Vec*)&_B8);
153 _9C = mSeaGullGroup->updatePosInfo(&_90, _94);
158 MR::startSound(
this,
"SE_OJ_SEAGULL_CHIRP", -1, -1);
159 _E0 = MR::getRandom((s32)0x3C, (s32)0x1E0);
165 if (MR::isJudgedToClipFrustum300m(
mPosition, 200.0f)) {
166 if (!MR::isHiddenModel(
this)) {
171 if (MR::isHiddenModel(
this)) {
180 mtx.mMtx[0][0] = _C4.x;
181 mtx.mMtx[1][0] = _C4.y;
182 mtx.mMtx[2][0] = _C4.z;
183 mtx.mMtx[0][1] = _B8.x;
184 mtx.mMtx[1][1] = _B8.y;
185 mtx.mMtx[2][1] = _B8.z;
186 mtx.mMtx[0][2] = _AC.x;
187 mtx.mMtx[1][2] = _AC.y;
188 mtx.mMtx[2][2] = _AC.z;
192 MR::setBaseTRMtx(
this, mtx);
195SeaGullGroup::SeaGullGroup(
const char *pName) :
LiveActor(pName) {
200TVec3f* SeaGullGroup::updatePosInfo(s32 *a1,
bool a2)
const {
223SeaGullGroup::~SeaGullGroup() {
227namespace NrvSeaGull {
228 void SeaGullNrvHoverRight::execute(
Spine *pSpine)
const {
230 gull->exeHoverRight();
233 void SeaGullNrvHoverLeft::execute(
Spine *pSpine)
const {
235 gull->exeHoverLeft();
238 void SeaGullNrvHoverFront::execute(
Spine *pSpine)
const {
240 gull->exeHoverFront();
The basis of a drawable actor that can contain states (see: Nerve)
TVec3f mPosition
3D vector of the actor's position.
TVec3f mVelocity
3D vector of the actor's velocity.
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.