feat(Core/Time): Implement saparated manager for game time (#8630)

This commit is contained in:
Kargatum
2022-01-24 17:55:00 +07:00
committed by GitHub
parent 12da792a90
commit 8b7df23f06
129 changed files with 1147 additions and 817 deletions

View File

@@ -21,6 +21,7 @@
#include "CreatureAISelector.h"
#include "EscortMovementGenerator.h"
#include "FleeingMovementGenerator.h"
#include "GameTime.h"
#include "HomeMovementGenerator.h"
#include "IdleMovementGenerator.h"
#include "Log.h"
@@ -568,7 +569,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
{
_owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
_owner->m_movementInfo.SetFallTime(0);
_owner->ToPlayer()->SetFallInformation(time(nullptr), _owner->GetPositionZ());
_owner->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), _owner->GetPositionZ());
}
else if (_owner->GetTypeId() == TYPEID_UNIT && addFlagForNPC) // pussywizard
{

View File

@@ -19,6 +19,7 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "CreatureGroups.h"
#include "GameTime.h"
#include "MapMgr.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
@@ -316,7 +317,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
// this prevent cheating with landing point at lags
// when client side flight end early in comparison server side
player->StopMoving();
player->SetFallInformation(time(nullptr), player->GetPositionZ());
player->SetFallInformation(GameTime::GetGameTime().count(), player->GetPositionZ());
}
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);
@@ -409,7 +410,7 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
if (i_currentNode >= i_path.size() - 1)
{
player->CleanupAfterTaxiFlight();
player->SetFallInformation(time(nullptr), player->GetPositionZ());
player->SetFallInformation(GameTime::GetGameTime().count(), player->GetPositionZ());
if (player->pvpInfo.IsHostile)
player->CastSpell(player, 2479, true);

View File

@@ -107,14 +107,16 @@ namespace Movement
struct CommonInitializer
{
CommonInitializer(float _velocity) : velocityInv(1000.f / _velocity), time(minimal_duration) {}
float velocityInv;
int32 time;
CommonInitializer(float _velocity) : velocityInv(1000.f / _velocity), _time(minimal_duration) {}
inline int32 operator()(Spline<int32>& s, int32 i)
{
time += (s.SegLength(i) * velocityInv);
return time;
_time += (s.SegLength(i) * velocityInv);
return _time;
}
float velocityInv;
int32 _time;
};
void MoveSpline::init_spline(const MoveSplineInitArgs& args)