-
Notifications
You must be signed in to change notification settings - Fork 10
/
Game.ixx
245 lines (159 loc) · 8.55 KB
/
Game.ixx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
/*
* SDK module for Trilogy Online modification.
* The author of this file is the lead developer of Trilogy Online.
* Detailed information can be found on the website.
* https://trilogy-online.com/
*/
module;
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <chrono>
export module TrilogyOnline.SDK.Game;
import TrilogyOnline.SDK.Fundamental;
import TrilogyOnline.SDK.Vector;
import TrilogyOnline.SDK.Entities;
import TrilogyOnline.SDK.Browser;
import TrilogyOnline.SDK.ScreenBrowser;
import TrilogyOnline.SDK.GameObjectBrowser;
export namespace TrilogyOnline
{
namespace API
{
class CGame
{
public:
class CState
{
public:
virtual ~CState() noexcept = default;
#ifdef TRILOGY_ONLINE_CLIENT
virtual void OnMessageReceived(CGame& game, const Byte* const data, const NativeUInt size) { }
virtual void OnGameThreadTick(CGame& game) { }
virtual void OnRendererThreadTick(CGame& game) { }
virtual void OnConnected(CGame& game) { }
virtual void OnDisconnected(CGame& game) { }
virtual void OnRemoteBlipCreated(CGame& game, CBlip& blip) { }
virtual void OnRemoteBlipDestroyed(CGame& game, CBlip& blip) { }
virtual void OnRemoteCheckpointCreated(CGame& game, CCheckpoint& checkpoint) { }
virtual void OnRemoteCheckpointDestroyed(CGame& game, CCheckpoint& checkpoint) { }
virtual void OnRemoteObjectCreated(CGame& game, CObject& object) { }
virtual void OnRemoteObjectDestroyed(CGame& game, CObject& object) { }
virtual void OnRemotePickupCreated(CGame& game, CPickup& pickup) { }
virtual void OnRemotePickupDestroyed(CGame& game, CPickup& pickup) { }
virtual void OnRemotePlayerCreated(CGame& game, CPlayer& player) { }
virtual void OnRemotePlayerDestroyed(CGame& game, CPlayer& player) { }
virtual void OnRemoteVehicleCreated(CGame& game, CVehicle& vehicle) { }
virtual void OnRemoteVehicleDestroyed(CGame& game, CVehicle& vehicle) { }
virtual void OnKeyDown(CGame& game, const UInt8 key) { }
virtual void OnKeyUp(CGame& game, const UInt8 key) { }
#endif
#ifdef TRILOGY_ONLINE_SERVER
virtual void OnTick(CGame& game) { }
virtual void OnPlayerConnected(CGame& game, CPlayer& player) { }
virtual void OnPlayerDisconnected(CGame& game, CPlayer& player) { }
#endif
};
virtual void SetState(CState* const value) noexcept = 0;
[[nodiscard]]
virtual CState* GetState() const noexcept = 0;
[[nodiscard]]
virtual CBlip* CreateBlip(const CVector3DFloat& position, const CBlip::ESprite sprite, const CBlip::EColor color, const UInt16 scale, const bool shortRange) = 0;
[[nodiscard]]
virtual CCheckpoint* CreateCheckpoint(const CCheckpoint::EType type, const CVector3DFloat& position, const CVector3DFloat& nextPosition, const float radius, const UInt32 color, const UInt16 pulsePeriod = 1024, const float pulseFraction = 0.075f, const UInt16 rotateRate = 0) = 0;
[[nodiscard]]
virtual CObject* CreateObject(const UInt32 modelId, const CVector3DFloat& position, const CVector3DFloat& rotation) = 0;
[[nodiscard]]
virtual CPickup* CreatePickup(const UInt32 modelId, const CPickup::EType type, const CVector3DFloat& position) = 0;
[[nodiscard]]
virtual CVehicle* CreateVehicle(const UInt32 modelId, const CVector3DFloat& position, const CVector3DFloat& rotation, const CVehicle::CPainting& painting, const float health) = 0;
#ifdef TRILOGY_ONLINE_CLIENT
virtual void SendUnreliableMessage(const Byte* const data, const NativeUInt size) = 0;
virtual void SendReliableMessage(const Byte* const data, const NativeUInt size) = 0;
[[nodiscard]]
virtual CScreenBrowser* CreateScreenBrowser(const std::u16string_view url) = 0;
[[nodiscard]]
virtual CScreenBrowser* CreateScreenBrowser(const CVector2DInt32& position, const CVector2DUInt32& size, const std::u16string_view url) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserBoolMultiArgument(const bool value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserInt8MultiArgument(const Int8 value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserUInt8MultiArgument(const UInt8 value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserInt16MultiArgument(const Int16 value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserUInt16MultiArgument(const UInt16 value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserInt32MultiArgument(const Int32 value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserUInt32MultiArgument(const UInt32 value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserInt64MultiArgument(const Int64 value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserUInt64MultiArgument(const UInt64 value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserFloatMultiArgument(const float value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserDoubleMultiArgument(const double value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserLongDoubleMultiArgument(const long double value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserStringMultiArgument(const std::u16string& value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserStringMultiArgument(std::u16string&& value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserArrayViewMultiArgument(const std::vector<CBrowser::CMultiArgument*>& value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserArrayViewMultiArgument(std::vector<CBrowser::CMultiArgument*>&& value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserObjectViewMultiArgument(const std::map<std::u16string, CBrowser::CMultiArgument*>& value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserObjectViewMultiArgument(std::map<std::u16string, CBrowser::CMultiArgument*>&& value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserArrayMultiArgument(std::vector<std::unique_ptr<CBrowser::CMultiArgument>>&& value) = 0;
[[nodiscard]]
virtual CBrowser::CMultiArgument* CreateBrowserObjectMultiArgument(std::map<std::u16string, std::unique_ptr<CBrowser::CMultiArgument>>&& value) = 0;
virtual void ToggleArea69SAMSite(const bool value) = 0;
[[nodiscard]]
virtual bool IsArea69SAMSiteEnabled() const = 0;
virtual void ToggleAircraftCarrierSAMSite(const bool value) = 0;
[[nodiscard]]
virtual bool IsAircraftCarrierSAMSiteEnabled() const = 0;
virtual void SetControllablePlayerMoney(const Int32 value) = 0;
[[nodiscard]]
virtual Int32 GetControllablePlayerMoney() const = 0;
virtual void ToggleCursor(const bool value) = 0;
virtual void SetCamera(const CVector3DFloat& position, const CVector3DFloat& lookAtPosition) = 0;
virtual void SetMovingCamera(const CVector3DFloat& positionStart, const CVector3DFloat& positionEnd, const CVector3DFloat& lookAtPositionStart, const CVector3DFloat& lookAtPositionEnd, const float positionDuration, const float lookAtPositionDuration, const bool isPositionEase, const bool isLookAtPositionEase) = 0;
virtual void SetCameraBehindControllablePlayer() = 0;
virtual void SetWeather(const UInt16 weather) = 0;
virtual void SetClock(const UInt8 hours, const UInt8 minutes) = 0;
virtual void ToggleHUDDisplay(const bool value) = 0;
virtual void ToggleAreaNameDisplay(const bool value) = 0;
virtual void ToggleVehicleNameDisplay(const bool value) = 0;
virtual void ToggleRadarDisplay(const bool value) = 0;
[[nodiscard]]
virtual CPlayer* GetControllablePlayer() const = 0;
virtual void Quit() = 0;
[[nodiscard]]
virtual CVector2DFloat GetMousePositionDelta() const = 0;
[[nodiscard]]
virtual CVector2DUInt32 GetWindowSize() const = 0;
[[nodiscard]]
virtual bool CalcScreenCoords(const CVector3DFloat& position, CVector3DFloat& screenCoords, float* const width, float* const height, const bool checkMaximumVisible, const bool checkMinimumVisible) const = 0;
virtual void RequestModel(const UInt32 modelId) = 0;
virtual void LoadAllRequestedModels() = 0;
virtual void ToggleEntryExitManager(const bool value) = 0;
[[nodiscard]]
virtual bool IsConnected() const = 0;
virtual void Disconnect() = 0;
#endif
#ifdef TRILOGY_ONLINE_SERVER
virtual void ServerStartup(const std::u16string_view productKey, const UInt16 port = 7777, const std::chrono::milliseconds& sleepTime = std::chrono::milliseconds{ 1 }) = 0;
virtual void ServerShutdown() = 0;
#endif
};
}
}