mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(util): add CGameTime::GameTimeSetMinutesPerSecond
This commit is contained in:
parent
6e7c267d3e
commit
53b26169f3
@ -1,6 +1,20 @@
|
||||
#include "util/time/CGameTime.hpp"
|
||||
#include "common/Time.hpp"
|
||||
|
||||
float CGameTime::GameTimeSetMinutesPerSecond(float minutesPerSec) {
|
||||
float oldMinutesPerSec = this->m_gameMinutesPerRealSecond;
|
||||
|
||||
if (minutesPerSec > CGameTime::MAX_SPEED) {
|
||||
minutesPerSec = CGameTime::MAX_SPEED;
|
||||
} else if (minutesPerSec < CGameTime::MIN_SPEED) {
|
||||
minutesPerSec = CGameTime::MIN_SPEED;
|
||||
}
|
||||
|
||||
this->m_gameMinutesPerRealSecond = minutesPerSec;
|
||||
|
||||
return oldMinutesPerSec;
|
||||
}
|
||||
|
||||
void CGameTime::GameTimeSetTime(const WowTime& time, bool shouldTick) {
|
||||
WowTime biasTime = time;
|
||||
|
||||
|
||||
@ -5,7 +5,12 @@
|
||||
|
||||
class CGameTime : public WowTime {
|
||||
public:
|
||||
// Public static variables
|
||||
static constexpr float MIN_SPEED = 1.0f / 60.0f;
|
||||
static constexpr float MAX_SPEED = 60.0f;
|
||||
|
||||
// Public member functions
|
||||
float GameTimeSetMinutesPerSecond(float minutesPerSec);
|
||||
void GameTimeSetTime(const WowTime& time, bool shouldTick);
|
||||
void GameTimeUpdate(float elapsedSec);
|
||||
|
||||
@ -15,7 +20,7 @@ class CGameTime : public WowTime {
|
||||
int32_t m_timeBias = 0;
|
||||
int32_t m_dateBias = 0;
|
||||
uint32_t m_gameMinutesElapsed = 0;
|
||||
float m_gameMinutesPerRealSecond = 1.0f / 60.0f;
|
||||
float m_gameMinutesPerRealSecond = MIN_SPEED;
|
||||
float m_gameMinutesThisTick = 0.0f;
|
||||
uint32_t m_timeDifferential = 0;
|
||||
uint32_t m_lastTickMinute = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user