-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathPools.hpp
176 lines (151 loc) · 6.78 KB
/
Pools.hpp
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
#pragma once
#include "Entities.hpp"
namespace rage
{
class IPlayerPool
: public IPool<IPlayer>
{
public:
virtual void Broadcast(const std::string& message) const = 0;
virtual void BroadcastInRange(const std::string& message, const vector3& position, float range, dimensionId_t dimension = 0xFFFFFFFF) const = 0;
virtual void BroadcastInDimension(const std::string& message, dimensionId_t dimension) const = 0;
public:
virtual void _Call(const std::string& eventName, const arg_t *arguments = nullptr, size_t count = 0) const = 0;
virtual void _CallInRange(const vector3& position, float range, dimensionId_t dimension, const std::string& eventName, const arg_t *arguments = nullptr, size_t count = 0) const = 0;
virtual void _CallInDimension(dimensionId_t dimension, const std::string& eventName, const arg_t *arguments = nullptr, size_t count = 0) const = 0;
virtual void _CallFor(const std::vector<rage::IPlayer*>& players, const std::string& eventName, const arg_t *arguments = nullptr, size_t count = 0) const = 0;
virtual void _Call(uint64_t eventName, const rage::arg_t *arguments = nullptr, size_t count = 0) = 0;
virtual void _CallInRange(const vector3& position, float range, dimensionId_t dimension, uint64_t eventName, const rage::arg_t *arguments = nullptr, size_t count = 0) = 0;
virtual void _CallInDimension(dimensionId_t dimension, uint64_t eventName, const rage::arg_t *arguments = nullptr, size_t count = 0) = 0;
virtual void _CallFor(const std::vector<rage::IPlayer*>& players, uint64_t eventName, const arg_t *arguments = nullptr, size_t count = 0) = 0;
virtual void _Invoke(uint64_t nativeHash, const arg_t *arguments = nullptr, size_t count = 0) const = 0;
virtual void _InvokeInRange(const vector3& position, float range, dimensionId_t dimension, uint64_t nativeHash, const arg_t *arguments = nullptr, size_t count = 0) const = 0;
virtual void _InvokeInDimension(dimensionId_t dimension, uint64_t nativeHash, const arg_t *arguments = nullptr, size_t count = 0) const = 0;
virtual void _InvokeFor(const std::vector<rage::IPlayer*>& players, uint64_t nativeHash, const arg_t *arguments = nullptr, size_t count = 0) const = 0;
public:
template<typename ...Args>
void Call(const std::string& eventName, Args&&... args)
{
const int count = sizeof...(Args);
if (count == 0)
this->_Call(eventName);
else
{
arg_t arguments[count] = { arg_t(std::forward<Args>(args))... };
this->_Call(eventName, arguments, count);
}
}
template<typename ...Args>
void CallInRange(const vector3& position, float range, dimensionId_t dimension, const std::string& eventName, Args&&... args)
{
const int count = sizeof...(Args);
if (count == 0)
this->_CallInRange(position, range, dimension, eventName);
else
{
arg_t arguments[count] = { arg_t(std::forward<Args>(args))... };
this->_CallInRange(position, range, dimension, eventName, arguments, count);
}
}
template<typename ...Args>
void CallInDimension(dimensionId_t dimension, const std::string& eventName, Args&&... args)
{
const int count = sizeof...(Args);
if (count == 0)
this->_CallInDimension(dimension, eventName);
else
{
arg_t arguments[count] = { arg_t(std::forward<Args>(args))... };
this->_CallInDimension(dimension, eventName, arguments, count);
}
}
template<typename ...Args>
void Invoke(uint64_t hash, Args&&... args)
{
const int count = sizeof...(Args);
if (count == 0)
this->_Invoke(hash);
else
{
arg_t arguments[count] = { arg_t(std::forward<Args>(args))... };
this->_Invoke(hash, arguments, count);
}
}
template<typename ...Args>
void InvokeInRange(const vector3& position, float range, dimensionId_t dimension, uint64_t hash, Args&&... args)
{
const int count = sizeof...(Args);
if (count == 0)
this->_InvokeInRange(position, range, dimension, hash);
else
{
arg_t arguments[count] = { arg_t(std::forward<Args>(args))... };
this->_InvokeInRange(position, range, dimension, hash, arguments, count);
}
}
template<typename ...Args>
void InvokeInDimension(dimensionId_t dimension, uint64_t hash, Args&&... args)
{
const int count = sizeof...(Args);
if (count == 0)
this->_InvokeInDimension(dimension, hash);
else
{
arg_t arguments[count] = { arg_t(std::forward<Args>(args))... };
this->_InvokeInDimension(dimension, hash, arguments, count);
}
}
};
class IVehiclePool
: public IPool<IVehicle>
{
public:
virtual IVehicle *New(uint32_t model, const vector3& position, float heading = 0.f, const std::string& numberPlate = "", uint8_t alpha = 255, bool locked = false, bool engine = false, dimensionId_t dimension = 0) const = 0;
};
class IColshapePool
: public IPool<IColshape>
{
public:
virtual IColshape *NewCircle(const vector2& position, float radius, dimensionId_t dimension = 0) const = 0;
virtual IColshape *NewSphere(const vector3& position, float radius, dimensionId_t dimension = 0) const = 0;
virtual IColshape *NewTube(const vector3& position, float radius, float height, dimensionId_t dimension = 0) const = 0;
virtual IColshape *NewRectangle(const vector2& position, const vector2& size, dimensionId_t dimension = 0) const = 0;
virtual IColshape *NewCube(const vector3& position, const vector3& size, dimensionId_t dimension = 0) const = 0;
};
class ICheckpointPool
: public IPool<ICheckpoint>
{
public:
virtual ICheckpoint *New(uint8_t type, const vector3& position, const vector3& nextPos, float radius, const rgba_t color, bool visible = true, dimensionId_t dimension = 0) const = 0;
};
class IMarkerPool
: public IPool<IMarker>
{
public:
virtual IMarker *New(uint32_t model, const vector3& position, const vector3& rotation, const vector3& direction, float scale, rage::rgba_t color, bool visible = true, dimensionId_t dimension = 0) const = 0;
};
class IBlipPool
: public IPool<IBlip>
{
public:
virtual IBlip *New(uint32_t sprite, const vector3& position, float scale, uint8_t color, const std::string& name = "", uint8_t alpha = 255, float drawDistance = 0.f, bool shortRange = false, short rotation = 0, dimensionId_t dimension = 0) const = 0;
};
class IPickupPool
: public IPool<IPickup>
{
public:
// todo
};
class IObjectPool
: public IPool<IObject>
{
public:
virtual IObject *New(uint32_t model, const vector3& position, const vector3& rotation, dimensionId_t dimension = 0) const = 0;
};
class ITextLabelPool
: public IPool<ITextLabel>
{
public:
virtual ITextLabel *New(const vector3& pos, const std::string& text, uint8_t fontId, rage::rgba_t color, float drawDistance = 150.f, bool los = false, dimensionId_t dimension = 0) const = 0;
};
}