Debian Codegraph @

Sources/Jazz2/Actors/Enemies/Bosses/Bolly.h

raw
1 #pragma once
2
3 #include "BossBase.h"
4
5 namespace Jazz2::Actors::Bosses
6 {
7 /** @brief Bolly (boss) */
8 class Bolly : public BossBase
9 {
10 DEATH_RUNTIME_OBJECT(BossBase);
11
12 public:
13 Bolly();
14 ~Bolly();
15
16 static void Preload(const ActorActivationDetails& details);
17
18 protected:
19 Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override;
20 bool OnActivatedBoss() override;
21 void OnUpdate(float timeMult) override;
22 bool OnPerish(ActorBase* collider) override;
23
24 private:
25 static constexpr std::int32_t StateTransition = -1;
26 static constexpr std::int32_t StateWaiting = 0;
27 static constexpr std::int32_t StateFlying = 1;
28 static constexpr std::int32_t StateNewDirection = 2;
29 static constexpr std::int32_t StatePrepairingToAttack = 3;
30 static constexpr std::int32_t StateAttacking = 4;
31
32 static constexpr std::int32_t NormalChainLength = 5 * 3;
33 static constexpr std::int32_t HardChainLength = 6 * 3;
34 static constexpr std::int32_t MaxChainLength = HardChainLength;
35
36 #ifndef DOXYGEN_GENERATING_OUTPUT
37 // Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
38 class BollyPart : public EnemyBase
39 {
40 friend class Bolly;
41
42 public:
43 float Size;
44
45 protected:
46 Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override;
47 void OnUpdate(float timeMult) override;
48 };
49
50 class Rocket : public EnemyBase
51 {
52 friend class Bolly;
53
54 public:
55 bool OnHandleCollision(std::shared_ptr<ActorBase> other) override;
56
57 protected:
58 Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override;
59 void OnUpdate(float timeMult) override;
60 void OnUpdateHitbox() override;
61 void OnEmitLights(SmallVectorImpl<LightEmitter>& lights) override;
62 bool OnPerish(ActorBase* collider) override;
63 void OnHitFloor(float timeMult) override;
64 void OnHitWall(float timeMult) override;
65 void OnHitCeiling(float timeMult) override;
66
67 private:
68 float _timeLeft;
69 };
70 #endif
71
72 std::int32_t _state;
73 float _stateTime;
74 uint8_t _endText;
75 std::shared_ptr<BollyPart> _bottom;
76 //std::shared_ptr<BollyPart> _turret;
77 std::shared_ptr<BollyPart> _chain[MaxChainLength];
78 Vector2f _originPos;
79 float _noiseCooldown;
80 std::int32_t _rocketsLeft;
81 float _chainPhase;
82
83 //void UpdateTurret(float timeMult);
84 void FollowNearestPlayer(std::int32_t newState, float time);
85 void FireRocket();
86 };
87 }