1#pragma once
2
3#include <math/seadVector.h>
4
5#include "Library/Nerve/NerveExecutor.h"
6
7namespace al {
8
9class CameraShaker : public NerveExecutor {
10public:
11 enum class ShakeDirection : s32 { Both, Vertical };
12
13 struct ShakeInfo {
14 const char* name = nullptr;
15 s32 steps = 0;
16 f32 speed = 0.0f;
17 f32 strength = 0.0f;
18 ShakeDirection direction = ShakeDirection::Both;
19
20 bool operator>(const ShakeInfo& other) const {
21 if (strength < other.strength)
22 return false;
23 if (other.strength < strength)
24 return true;
25
26 if (other.steps > 0 && steps < 0)
27 return false;
28 if (other.steps < 0 && steps > 0)
29 return true;
30
31 if (steps < other.steps)
32 return false;
33 if (other.steps < steps)
34 return true;
35
36 s32 otherDirection = (s32)other.direction;
37 s32 directionCopy = (s32)direction;
38 if (otherDirection < directionCopy)
39 return false;
40 if (directionCopy < otherDirection)
41 return true;
42
43 if (speed < other.speed)
44 return true;
45 return false;
46 }
47 };
48
49 CameraShaker();
50
51 void update(const char* shakeLoop);
52 void startShakeByAction(const char* name, const char* unused1, const char* unused2, s32 steps);
53 void startShakeByName(const char* name, s32 steps);
54 void startShakeByHitReaction(const char* name, const char* unused1, const char* unused2,
55 s32 steps);
56
57 void exeWait();
58 void exeShake();
59 void exeShakeLoop();
60
61 void startShakeByIndex(s32 index, s32 steps);
62
63private:
64 sead::Vector2f mOffset = {0.0f, 0.0f};
65 const ShakeInfo* mActiveShake = nullptr;
66 const ShakeInfo* mShakeLoop = nullptr;
67 ShakeInfo mEditedShake = {};
68};
69
70static_assert(sizeof(CameraShaker) == 0x40);
71
72} // namespace al
73