SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
AnimationRandomPlayer.cpp
1#include "Game/LiveActor/AnimationRandomPlayer.hpp"
2#include "Game/Util.hpp"
3
4NrvAnimationRandomPlayer::HostTypeWait NrvAnimationRandomPlayer::HostTypeWait::sInstance;
5NrvAnimationRandomPlayer::HostTypePlay NrvAnimationRandomPlayer::HostTypePlay::sInstance;
6
7AnimationRandomPlayer::AnimationRandomPlayer(const LiveActor *pActor, const char *a2, const char *a3, s32 a4, f32 a5) : NerveExecutor(a2) {
8 mActor = pActor;
9 _C = a2;
10 _10 = a3;
11 _18 = a4;
12 _1C = a5;
13 initNerve(&NrvAnimationRandomPlayer::HostTypeWait::sInstance);
14 updateStartStep();
15}
16
17void AnimationRandomPlayer::updateStartStep() {
18 s32 v5 = _18 * _1C;
19 s32 min = _18 - v5;
20 s32 max = _18 + v5;
21 _14 = MR::getRandom(min, max);
22}
23
24void AnimationRandomPlayer::exeWait() {
25 if (MR::isFirstStep(this)) {
26 if (_10) {
27 MR::startAllAnim(mActor, _10);
28 }
29 }
30
31 if (MR::isStep(this, _14)) {
32 setNerve(&NrvAnimationRandomPlayer::HostTypePlay::sInstance);
33 }
34}
35
36void AnimationRandomPlayer::exePlay() {
37 if (MR::isFirstStep(this)) {
38 MR::startAllAnim(mActor, _C);
39 }
40
41 if (MR::isAnyAnimOneTimeAndStopped(mActor, _C)) {
42 updateStartStep();
43 MR::setAllAnimFrame(mActor, _C, 0.0f);
44 setNerve(&NrvAnimationRandomPlayer::HostTypeWait::sInstance);
45 }
46}
47
48AnimationRandomPlayer::~AnimationRandomPlayer() {
49
50}
The basis of a drawable actor that can contain states (see: Nerve)
Definition LiveActor.hpp:24