summaryrefslogtreecommitdiff
path: root/src/KingSystem
diff options
context:
space:
mode:
Diffstat (limited to 'src/KingSystem')
-rw-r--r--src/KingSystem/Map/mapPlacementMgr.cpp2
-rw-r--r--src/KingSystem/System/SystemTimers.cpp2
-rw-r--r--src/KingSystem/System/Timer.cpp2
-rw-r--r--src/KingSystem/System/VFR.cpp2
-rw-r--r--src/KingSystem/System/VFR.h19
-rw-r--r--src/KingSystem/System/VFRValue.cpp4
-rw-r--r--src/KingSystem/World/worldEnvMgr.cpp10
-rw-r--r--src/KingSystem/World/worldTimeMgr.cpp4
-rw-r--r--src/KingSystem/ksysDebugInput.cpp2
9 files changed, 25 insertions, 22 deletions
diff --git a/src/KingSystem/Map/mapPlacementMgr.cpp b/src/KingSystem/Map/mapPlacementMgr.cpp
index 4898c6fb..08776dc0 100644
--- a/src/KingSystem/Map/mapPlacementMgr.cpp
+++ b/src/KingSystem/Map/mapPlacementMgr.cpp
@@ -111,7 +111,7 @@ void PlacementMgr::x() {
f32 last_time = mTime;
auto* vfr = VFR::instance();
- mTime += vfr->getDeltaTime();
+ mTime += vfr->getDeltaFrame();
mTimeUpdated = s32(last_time) != s32(mTime);
}
diff --git a/src/KingSystem/System/SystemTimers.cpp b/src/KingSystem/System/SystemTimers.cpp
index 4142cfd9..31c87562 100644
--- a/src/KingSystem/System/SystemTimers.cpp
+++ b/src/KingSystem/System/SystemTimers.cpp
@@ -26,7 +26,7 @@ void SystemTimers::prepareStageUnload() {}
void SystemTimers::incrementCountersAndUpdate() {
mFrameCounter++;
mFrameCounter2++;
- f32 deltaTime = VFR::instance()->getDeltaTime();
+ f32 deltaTime = VFR::instance()->getDeltaFrame();
mVfrTimer += deltaTime;
while (mVfrTimer >= 1) {
diff --git a/src/KingSystem/System/Timer.cpp b/src/KingSystem/System/Timer.cpp
index 00749b9f..64aef391 100644
--- a/src/KingSystem/System/Timer.cpp
+++ b/src/KingSystem/System/Timer.cpp
@@ -4,7 +4,7 @@
namespace ksys {
void Timer::update(f32* t, f32 rate) {
- *t += VFR::instance()->getDeltaTime() * rate;
+ *t += VFR::instance()->getDeltaFrame() * rate;
}
void Timer::update() {
diff --git a/src/KingSystem/System/VFR.cpp b/src/KingSystem/System/VFR.cpp
index e0f6d8b2..f2ae8d1f 100644
--- a/src/KingSystem/System/VFR.cpp
+++ b/src/KingSystem/System/VFR.cpp
@@ -189,7 +189,7 @@ void VFR::ScopedDeltaSetter::set(u32 include_mask, u32 exclude_mask) {
f32 raw_delta;
const auto delta = vfr->getDeltaAndSetMin(&raw_delta, include_mask, exclude_mask);
- const auto time = vfr->getDeltaTime();
+ const auto time = vfr->getDeltaFrame();
if (delta != time) {
mPreviousDelta = raw_delta;
if (delta > 0.0)
diff --git a/src/KingSystem/System/VFR.h b/src/KingSystem/System/VFR.h
index a664c2c1..1f69fbdc 100644
--- a/src/KingSystem/System/VFR.h
+++ b/src/KingSystem/System/VFR.h
@@ -69,7 +69,10 @@ public:
// TODO: requires ksys::Sound
void resetTimeMultiplier(u32 idx);
- f32 getDeltaTime(u32 core) const { return *mDeltaFrames[core]; }
+ f32 getDeltaFrame(u32 core) const { return *mDeltaFrames[core]; }
+ f32 getDeltaFrame() const { return getDeltaFrame(sead::CoreInfo::getCurrentCoreId()); }
+
+ f32 getDeltaTime(u32 core) const { return *mDeltaTimes[core]; }
f32 getDeltaTime() const { return getDeltaTime(sead::CoreInfo::getCurrentCoreId()); }
f32 getIntervalRatio(u32 core) const { return *mIntervalRatios[core]; }
@@ -77,16 +80,16 @@ public:
template <typename T>
static inline void add(T* value, const T& v) {
- *value += v * instance()->getDeltaTime();
+ *value += v * instance()->getDeltaFrame();
}
template <typename T>
static inline void multiply(T* value, f32 scalar) {
- *value *= std::pow(scalar, instance()->getDeltaTime());
+ *value *= std::pow(scalar, instance()->getDeltaFrame());
}
static inline f32 getLerpFactor(f32 t) {
- return 1.0f - std::pow(1.0f - t, instance()->getDeltaTime());
+ return 1.0f - std::pow(1.0f - t, instance()->getDeltaFrame());
}
template <typename T>
@@ -97,7 +100,7 @@ public:
template <typename T>
static inline void lerp(T* value, const T& b, f32 t, f32 max_delta) {
const auto f = getLerpFactor(t);
- const auto max_d = instance()->getDeltaTime() * max_delta;
+ const auto max_d = instance()->getDeltaFrame() * max_delta;
const auto diff = b - *value;
const auto d = f * sead::Mathf::abs(diff);
if (d > max_d)
@@ -109,8 +112,8 @@ public:
template <typename T>
static inline bool lerp(T* value, const T& b, f32 t, f32 max_delta, f32 min_delta) {
const auto f = getLerpFactor(t);
- const auto max_d = instance()->getDeltaTime() * max_delta;
- const auto min_d = instance()->getDeltaTime() * min_delta;
+ const auto max_d = instance()->getDeltaFrame() * max_delta;
+ const auto min_d = instance()->getDeltaFrame() * min_delta;
const auto diff = b - *value;
const auto d = f * sead::Mathf::abs(diff);
@@ -132,7 +135,7 @@ public:
template <typename VectorT>
static inline bool chaseVec(VectorT* value, const VectorT& target, f32 t) {
- const auto delta = instance()->getDeltaTime() * t;
+ const auto delta = instance()->getDeltaFrame() * t;
const auto diff = target - *value;
const auto norm = diff.length();
diff --git a/src/KingSystem/System/VFRValue.cpp b/src/KingSystem/System/VFRValue.cpp
index aa9328b2..de18914e 100644
--- a/src/KingSystem/System/VFRValue.cpp
+++ b/src/KingSystem/System/VFRValue.cpp
@@ -13,7 +13,7 @@ util::InitTimeInfoEx sInitInfo;
template <typename T>
void updateStatsImpl(const T& value, T* prev_value, T* mean) {
- const T new_mean = ((*prev_value + value) / 2) * VFR::instance()->getDeltaTime();
+ const T new_mean = ((*prev_value + value) / 2) * VFR::instance()->getDeltaFrame();
*prev_value = value;
*mean = new_mean;
}
@@ -49,7 +49,7 @@ bool VFRValue::lerp(const f32& b, f32 t, f32 max_delta, f32 min_delta) {
}
bool VFRValue::chase(const f32& target, f32 step) {
- const auto delta = step * VFR::instance()->getDeltaTime();
+ const auto delta = step * VFR::instance()->getDeltaFrame();
return sead::Mathf::chase(&value, target, delta);
}
diff --git a/src/KingSystem/World/worldEnvMgr.cpp b/src/KingSystem/World/worldEnvMgr.cpp
index 9341b8f1..f2a473a0 100644
--- a/src/KingSystem/World/worldEnvMgr.cpp
+++ b/src/KingSystem/World/worldEnvMgr.cpp
@@ -345,14 +345,14 @@ void EnvMgr::updateForcedBloodMoon() {
case 1:
// Update the forced blood moon timer
if (evt::Manager::instance()->hasActiveEvent() || mBloodMoonProhibited) {
- mForcedBloodMoonTimer -= VFR::instance()->getDeltaTime();
+ mForcedBloodMoonTimer -= VFR::instance()->getDeltaFrame();
if (mForcedBloodMoonTimer <= 0.0f) {
mForcedBloodMoonTimer = 0.0f;
mForcedBloodMoonStatus = 0;
mForcedBloodMoonReady = false;
}
} else {
- mForcedBloodMoonTimer += VFR::instance()->getDeltaTime();
+ mForcedBloodMoonTimer += VFR::instance()->getDeltaFrame();
if (mForcedBloodMoonTimer >= BloodMoonTimerDuration) {
mForcedBloodMoonTimer = BloodMoonTimerDuration;
mForcedBloodMoonReady = true;
@@ -376,7 +376,7 @@ void EnvMgr::updateForcedBloodMoon() {
case 3:
// Slowly fade out the blood moon state
- mForcedBloodMoonTimer -= VFR::instance()->getDeltaTime();
+ mForcedBloodMoonTimer -= VFR::instance()->getDeltaFrame();
if (mForcedBloodMoonTimer <= 0.0f) {
mForcedBloodMoonTimer = 0.0f;
mForcedBloodMoonStatus = 0;
@@ -389,14 +389,14 @@ void EnvMgr::updateForcedBloodMoon() {
case 4:
// [Alternative state 2] Wait for blood moons to be allowed again
if (mBloodMoonProhibited && !mDeactivateForcedBloodMoon) {
- mForcedBloodMoonTimer -= VFR::instance()->getDeltaTime();
+ mForcedBloodMoonTimer -= VFR::instance()->getDeltaFrame();
if (mForcedBloodMoonTimer <= 0.0f) {
mForcedBloodMoonTimer = 0.0f;
mForcedBloodMoonStatus = 0;
return;
}
} else {
- mForcedBloodMoonTimer += VFR::instance()->getDeltaTime();
+ mForcedBloodMoonTimer += VFR::instance()->getDeltaFrame();
if (mForcedBloodMoonTimer >= BloodMoonTimerDuration) {
mForcedBloodMoonTimer = BloodMoonTimerDuration;
mForcedBloodMoonReady = true;
diff --git a/src/KingSystem/World/worldTimeMgr.cpp b/src/KingSystem/World/worldTimeMgr.cpp
index 1c2b5a40..39e213bc 100644
--- a/src/KingSystem/World/worldTimeMgr.cpp
+++ b/src/KingSystem/World/worldTimeMgr.cpp
@@ -317,7 +317,7 @@ void TimeMgr::calc_() {
if (!mPlayedDemo103Or997 || evt::Manager::instance()->hasActiveEvent())
break;
- const auto delta = mTimeStep * VFR::instance()->getDeltaTime();
+ const auto delta = mTimeStep * VFR::instance()->getDeltaFrame();
mIsTimeFlowingNormally = true;
mTime += delta;
if (mTime >= 24_h) {
@@ -431,7 +431,7 @@ void TimeMgr::calc_() {
break;
case TimeUpdateMode::OnlyUpdateTimeOfDay:
- mTime += mTimeStep * VFR::instance()->getDeltaTime();
+ mTime += mTimeStep * VFR::instance()->getDeltaFrame();
if (mTime >= 24_h)
mTime -= 24_h;
break;
diff --git a/src/KingSystem/ksysDebugInput.cpp b/src/KingSystem/ksysDebugInput.cpp
index b1af1435..2ff54035 100644
--- a/src/KingSystem/ksysDebugInput.cpp
+++ b/src/KingSystem/ksysDebugInput.cpp
@@ -7,7 +7,7 @@ SEAD_SINGLETON_DISPOSER_IMPL(DebugInput)
void DebugInput::update() {
if (mFlags.isOnBit(0)) {
- mLastDelta += VFR::instance()->getDeltaTime();
+ mLastDelta += VFR::instance()->getDeltaFrame();
while (mLastDelta > 30.0) {
mLastDelta -= 30.0;
}