@@ -33,6 +33,10 @@ namespace Movement
33
33
extern float computeFallElevation (float time_passed, bool isSafeFall, float start_velocy);
34
34
extern float computeFallElevation (float time_passed);
35
35
36
+ /* *
37
+ * @brief Computes the current position on the spline.
38
+ * @return The computed location.
39
+ */
36
40
Location MoveSpline::ComputePosition () const
37
41
{
38
42
MANGOS_ASSERT (Initialized ());
@@ -72,6 +76,10 @@ namespace Movement
72
76
return c;
73
77
}
74
78
79
+ /* *
80
+ * @brief Computes the elevation during a fall.
81
+ * @param el The elevation to be computed.
82
+ */
75
83
void MoveSpline::computeFallElevation (float & el) const
76
84
{
77
85
float z_now = spline.getPoint (spline.first ()).z - Movement::computeFallElevation (MSToSec (time_passed));
@@ -86,11 +94,20 @@ namespace Movement
86
94
}
87
95
}
88
96
97
+ /* *
98
+ * @brief Computes the duration of the movement.
99
+ * @param length The length of the path.
100
+ * @param velocity The velocity of the movement.
101
+ * @return The computed duration in milliseconds.
102
+ */
89
103
inline uint32 computeDuration (float length, float velocity)
90
104
{
91
105
return SecToMS (length / velocity);
92
106
}
93
107
108
+ /* *
109
+ * @brief Struct for initializing fall parameters.
110
+ */
94
111
struct FallInitializer
95
112
{
96
113
FallInitializer (float _start_elevation) : start_elevation(_start_elevation) {}
@@ -106,6 +123,9 @@ namespace Movement
106
123
minimal_duration = 1 ,
107
124
};
108
125
126
+ /* *
127
+ * @brief Struct for initializing common parameters.
128
+ */
109
129
struct CommonInitializer
110
130
{
111
131
CommonInitializer (float _velocity) : velocityInv(1000 .f / _velocity), time(minimal_duration) {}
@@ -118,6 +138,10 @@ namespace Movement
118
138
}
119
139
};
120
140
141
+ /* *
142
+ * @brief Initializes the spline with the given arguments.
143
+ * @param args The initialization arguments.
144
+ */
121
145
void MoveSpline::init_spline (const MoveSplineInitArgs& args)
122
146
{
123
147
const SplineBase::EvaluationMode modes[2 ] = {SplineBase::ModeLinear, SplineBase::ModeCatmullrom};
@@ -155,6 +179,10 @@ namespace Movement
155
179
point_Idx = spline.first ();
156
180
}
157
181
182
+ /* *
183
+ * @brief Initializes the MoveSpline with the given arguments.
184
+ * @param args The initialization arguments.
185
+ */
158
186
void MoveSpline::Initialize (const MoveSplineInitArgs& args)
159
187
{
160
188
splineflags = args.flags ;
@@ -173,13 +201,21 @@ namespace Movement
173
201
init_spline (args);
174
202
}
175
203
204
+ /* *
205
+ * @brief Default constructor for MoveSpline.
206
+ */
176
207
MoveSpline::MoveSpline () : m_Id(0 ), time_passed(0 ), point_Idx(0 ), point_Idx_offset(0 )
177
208
{
178
209
splineflags.done = true ;
179
210
}
180
211
181
212
// / ============================================================================================
182
213
214
+ /* *
215
+ * @brief Validates the MoveSpline initialization arguments.
216
+ * @param unit The unit to validate against.
217
+ * @return True if the arguments are valid, false otherwise.
218
+ */
183
219
bool MoveSplineInitArgs::Validate (Unit* unit) const
184
220
{
185
221
#define CHECK (exp ) \
@@ -197,6 +233,10 @@ namespace Movement
197
233
198
234
// MONSTER_MOVE packet format limitation for not CatmullRom movement:
199
235
// each vertex offset packed into 11 bytes
236
+ /* *
237
+ * @brief Checks the bounds of the path for non-CatmullRom movement.
238
+ * @return True if the path bounds are valid, false otherwise.
239
+ */
200
240
bool MoveSplineInitArgs::_checkPathBounds () const
201
241
{
202
242
if (!(flags & MoveSplineFlag::Mask_CatmullRom) && path.size () > 2 )
@@ -222,6 +262,11 @@ namespace Movement
222
262
223
263
// / ============================================================================================
224
264
265
+ /* *
266
+ * @brief Updates the state of the MoveSpline.
267
+ * @param ms_time_diff The time difference in milliseconds.
268
+ * @return The result of the update.
269
+ */
225
270
MoveSpline::UpdateResult MoveSpline::_updateState (int32& ms_time_diff)
226
271
{
227
272
if (Finalized ())
@@ -264,6 +309,10 @@ namespace Movement
264
309
return result;
265
310
}
266
311
312
+ /* *
313
+ * @brief Converts the MoveSpline to a string representation.
314
+ * @return The string representation of the MoveSpline.
315
+ */
267
316
std::string MoveSpline::ToString () const
268
317
{
269
318
std::stringstream str;
@@ -291,13 +340,20 @@ namespace Movement
291
340
return str.str ();
292
341
}
293
342
343
+ /* *
344
+ * @brief Finalizes the MoveSpline.
345
+ */
294
346
void MoveSpline::_Finalize ()
295
347
{
296
348
splineflags.done = true ;
297
349
point_Idx = spline.last () - 1 ;
298
350
time_passed = Duration ();
299
351
}
300
352
353
+ /* *
354
+ * @brief Gets the current path index.
355
+ * @return The current path index.
356
+ */
301
357
int32 MoveSpline::currentPathIdx () const
302
358
{
303
359
int32 point = point_Idx_offset + point_Idx - spline.first () + (int )Finalized ();
0 commit comments