Debian Codegraph @

Sources/Jazz2/Actors/Solid/Bridge.h

raw
1 #pragma once
2
3 #include "../ActorBase.h"
4
5 namespace Jazz2::Actors::Solid
6 {
7 /** @brief Bridge */
8 class Bridge : public ActorBase
9 {
10 DEATH_RUNTIME_OBJECT(ActorBase);
11
12 public:
13 Bridge();
14 ~Bridge();
15
16 static void Preload(const ActorActivationDetails& details);
17
18 protected:
19 Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override;
20 void OnUpdate(float timeMult) override;
21 void OnUpdateHitbox() override;
22 bool OnDraw(RenderQueue& renderQueue) override;
23
24 private:
25 enum class BridgeType {
26 Rope = 0,
27 Stone = 1,
28 Vine = 2,
29 StoneRed = 3,
30 Log = 4,
31 Gem = 5,
32 Lab = 6,
33
34 Last = Lab
35 };
36
37 #ifndef DOXYGEN_GENERATING_OUTPUT
38 // Doxygen 1.12.0 outputs also private structs/unions even if it shouldn't
39 struct BridgePiece {
40 Vector2f Pos;
41 std::unique_ptr<RenderCommand> Command;
42 };
43 #endif
44
45 static constexpr float BaseY = -6.0f;
46
47 static constexpr std::int32_t PieceWidthsRope[] = { 13, 13, 10, 13, 13, 12, 11 };
48 static constexpr std::int32_t PieceWidthsStone[] = { 15, 9, 10, 9, 15, 9, 15 };
49 static constexpr std::int32_t PieceWidthsVine[] = { 7, 7, 7, 7, 10, 7, 7, 7, 7 };
50 static constexpr std::int32_t PieceWidthsStoneRed[] = { 10, 11, 11, 12 };
51 static constexpr std::int32_t PieceWidthsLog[] = { 13, 13, 13 };
52 static constexpr std::int32_t PieceWidthsGem[] = { 14 };
53 static constexpr std::int32_t PieceWidthsLab[] = { 14 };
54
55 BridgeType _bridgeType;
56 std::int32_t _bridgeWidth;
57 float _heightFactor;
58 const std::int32_t* _widths;
59 std::int32_t _widthsCount;
60 std::int32_t _widthOffset;
61
62 float _leftX, _leftHeight, _rightX, _rightHeight;
63
64 SmallVector<BridgePiece, 0> _pieces;
65
66 float GetSectionHeight(float x) const;
67 };
68 }