Removal and Replacement of the CryTimer (gEnv->pTimer) (#5409)

Replaced and removed the CryTimer (gEnv->pTimer). The new TimeSystem is a merger of the current time functionality found in the engine.

* Rename TimeSystemComponent.h/.cpp to TimeSystem.h/.cpp
* Adding New TimeSystem
* remove old timer cvars
* small improvements to the time system.
 - updated parts to use the time conversion functions.
 - in AdvanceTickDeltaTimes applying t_simulationTickScale is now uses doubles instead of floats.
* Replace gEnv->pTimer / ITimer usages with TimeSystem
* Updating usages of AZ::TimeMs{ 0 } and AZ::TimeUs{ 0 } to AZ::Time::ZeroTimeMs and AZ::Time::ZeroTimeUs
* red code the CryTimer
* using TimeUs instead of TimeMs is some cases + updating usages of old cvars to new

Signed-off-by: amzn-sean <75276488+amzn-sean@users.noreply.github.com>
This commit is contained in:
amzn-sean
2021-11-15 12:11:58 +00:00
committed by GitHub
parent 0ada8b335b
commit 38a03817bb
142 changed files with 1215 additions and 2090 deletions
@@ -11,6 +11,7 @@
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/std/sort.h>
#include <AzCore/Time/ITime.h>
#include <LyShine/Bus/UiTransform2dBus.h>
#include <LyShine/Bus/UiElementBus.h>
@@ -19,8 +20,6 @@
#include <LyShine/Bus/UiTooltipDataPopulatorBus.h>
#include <LyShine/UiSerializeHelpers.h>
#include <ITimer.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC MEMBER FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -173,8 +172,8 @@ void UiTooltipDisplayComponent::Hide()
{
// Since sequences can't have keys that represent current values,
// only play the hide animation if the show animation has completed.
m_timeSinceLastShown = gEnv->pTimer->GetCurrTime(ITimer::ETIMER_UI);
const AZ::TimeMs realTimeMs = AZ::GetRealElapsedTimeMs();
m_timeSinceLastShown = AZ::TimeMsToSeconds(realTimeMs);
EndTransitionState();
@@ -184,7 +183,8 @@ void UiTooltipDisplayComponent::Hide()
case State::Shown:
{
m_timeSinceLastShown = gEnv->pTimer->GetCurrTime(ITimer::ETIMER_UI);
const AZ::TimeMs realTimeMs = AZ::GetRealElapsedTimeMs();
m_timeSinceLastShown = AZ::TimeMsToSeconds(realTimeMs);
// Check if there is a hide animation to play
IUiAnimationSystem* animSystem = nullptr;
@@ -220,7 +220,9 @@ void UiTooltipDisplayComponent::Update()
if (m_state == State::DelayBeforeShow)
{
// Check if it's time to show the tooltip
if ((gEnv->pTimer->GetCurrTime(ITimer::ETIMER_UI) - m_stateStartTime) >= m_curDelayTime)
const AZ::TimeMs realTimeMs = AZ::GetRealElapsedTimeMs();
const float currentTime = AZ::TimeMsToSeconds(realTimeMs);
if ((currentTime - m_stateStartTime) >= m_curDelayTime)
{
// Make sure nothing has changed with the hover interactable
if (m_tooltipElement.IsValid() && UiTooltipDataPopulatorBus::FindFirstHandler(m_tooltipElement))
@@ -238,7 +240,9 @@ void UiTooltipDisplayComponent::Update()
// Check if it's time to hide the tooltip
if (m_displayTime >= 0.0f)
{
if ((gEnv->pTimer->GetCurrTime(ITimer::ETIMER_UI) - m_stateStartTime) >= m_displayTime)
const AZ::TimeMs realTimeMs = AZ::GetRealElapsedTimeMs();
const float currentTime = AZ::TimeMsToSeconds(realTimeMs);
if ((currentTime - m_stateStartTime) >= m_displayTime)
{
// Hide tooltip
Hide();
@@ -425,7 +429,8 @@ void UiTooltipDisplayComponent::Deactivate()
void UiTooltipDisplayComponent::SetState(State state)
{
m_state = state;
m_stateStartTime = gEnv->pTimer->GetCurrTime(ITimer::ETIMER_UI);
const AZ::TimeMs realTimeMs = AZ::GetRealElapsedTimeMs();
m_stateStartTime = AZ::TimeMsToSeconds(realTimeMs);
switch (m_state)
{