Debian Codegraph @

Sources/Jazz2/Actors/Multiplayer/RemoteActor.h

raw
1 #pragma once
2
3 #if defined(WITH_MULTIPLAYER) || defined(DOXYGEN_GENERATING_OUTPUT)
4
5 #include "../ActorBase.h"
6
7 namespace Jazz2::Actors::Multiplayer
8 {
9 /** @brief Remote object in online session */
10 class RemoteActor : public ActorBase
11 {
12 DEATH_RUNTIME_OBJECT(ActorBase);
13
14 public:
15 RemoteActor();
16
17 void AssignMetadata(std::uint8_t flags, ActorState state, StringView path, AnimState anim, float rotation, float scaleX, float scaleY, ActorRendererType rendererType);
18 void SyncPositionWithServer(Vector2f pos);
19 void SyncAnimationWithServer(AnimState anim, float rotation, float scaleX, float scaleY, Actors::ActorRendererType rendererType);
20 void SyncMiscWithServer(std::uint8_t flags);
21
22 protected:
23 #ifndef DOXYGEN_GENERATING_OUTPUT
24 struct StateFrame {
25 std::int64_t Time;
26 Vector2f Pos;
27 };
28
29 static constexpr std::int64_t ServerDelay = 64;
30
31 StateFrame _stateBuffer[8];
32 std::int32_t _stateBufferPos;
33 AnimState _lastAnim;
34 bool _isAttachedLocally;
35 #endif
36
37 Task<bool> OnActivatedAsync(const ActorActivationDetails& details) override;
38 void OnUpdate(float timeMult) override;
39 void OnAttach(ActorBase* parent) override;
40 void OnDetach(ActorBase* parent) override;
41 };
42 }
43
44 #endif