13
13
#include " CObject.h"
14
14
#include " CLogger.h"
15
15
#include " Utils.h"
16
+ #include " CGame.h"
17
+ #include " packets/CElementRPCPacket.h"
18
+ #include < net/rpc_enums.h>
16
19
17
20
extern CGame* g_pGame;
18
21
@@ -271,12 +274,12 @@ void CObject::SetPosition(const CVector& vecPosition)
271
274
272
275
void CObject::GetRotation (CVector& vecRotation)
273
276
{
274
- vecRotation = m_vecRotation;
275
-
276
277
// Are we attached to something?
277
278
if (m_pAttachedTo)
279
+ {
280
+ vecRotation = m_vecRotation;
278
281
GetAttachedRotation (vecRotation);
279
-
282
+ }
280
283
// Are we moving?
281
284
else if (IsMoving ())
282
285
{
@@ -289,6 +292,11 @@ void CObject::GetRotation(CVector& vecRotation)
289
292
}
290
293
vecRotation = m_vecRotation;
291
294
}
295
+ else
296
+ {
297
+ // Not moving and not attached, return stored rotation
298
+ vecRotation = m_vecRotation;
299
+ }
292
300
}
293
301
294
302
void CObject::SetRotation (const CVector& vecRotation)
@@ -352,18 +360,18 @@ void CObject::Move(const CPositionRotationAnimation& a_rMoveAnimation)
352
360
353
361
void CObject::StopMoving ()
354
362
{
355
- // Were we moving in the first place
356
- if (m_pMoveAnimation != NULL )
363
+ if (m_pMoveAnimation != nullptr )
357
364
{
358
365
SPositionRotation positionRotation;
359
366
m_pMoveAnimation->GetValue (positionRotation);
360
367
m_vecPosition = positionRotation.m_vecPosition ;
361
368
m_vecRotation = positionRotation.m_vecRotation ;
362
369
363
370
delete m_pMoveAnimation;
364
- m_pMoveAnimation = NULL ;
371
+ m_pMoveAnimation = nullptr ;
365
372
366
373
UpdateSpatialData ();
374
+ NotifyMovementComplete ();
367
375
}
368
376
}
369
377
@@ -375,7 +383,7 @@ const CPositionRotationAnimation* CObject::GetMoveAnimation()
375
383
}
376
384
else
377
385
{
378
- return NULL ;
386
+ return nullptr ;
379
387
}
380
388
}
381
389
@@ -427,7 +435,7 @@ bool CObject::SetLowLodObject(CObject* pNewLowLodObject)
427
435
428
436
// Clear there and here
429
437
ListRemove (m_pLowLodObject->m_HighLodObjectList , this );
430
- m_pLowLodObject = NULL ;
438
+ m_pLowLodObject = nullptr ;
431
439
return true ;
432
440
}
433
441
else
@@ -437,7 +445,7 @@ bool CObject::SetLowLodObject(CObject* pNewLowLodObject)
437
445
return false ;
438
446
439
447
// Remove any previous link
440
- SetLowLodObject (NULL );
448
+ SetLowLodObject (nullptr );
441
449
442
450
// Make new link
443
451
m_pLowLodObject = pNewLowLodObject;
@@ -449,6 +457,18 @@ bool CObject::SetLowLodObject(CObject* pNewLowLodObject)
449
457
CObject* CObject::GetLowLodObject ()
450
458
{
451
459
if (m_bIsLowLod)
452
- return NULL ;
460
+ return nullptr ;
453
461
return m_pLowLodObject;
454
462
}
463
+
464
+ void CObject::NotifyMovementComplete ()
465
+ {
466
+ CBitStream BitStream;
467
+ BitStream.pBitStream ->Write (m_vecPosition.fX );
468
+ BitStream.pBitStream ->Write (m_vecPosition.fY );
469
+ BitStream.pBitStream ->Write (m_vecPosition.fZ );
470
+ BitStream.pBitStream ->Write (m_vecRotation.fX );
471
+ BitStream.pBitStream ->Write (m_vecRotation.fY );
472
+ BitStream.pBitStream ->Write (m_vecRotation.fZ );
473
+ g_pGame->GetPlayerManager ()->BroadcastOnlyJoined (CElementRPCPacket (this , STOP_OBJECT, *BitStream.pBitStream ));
474
+ }
0 commit comments