2019-12-22 20:04:07 +00:00
|
|
|
#include "Runtime/CTimeProvider.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/Graphics/CGraphics.hpp"
|
2015-10-27 20:04:02 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2020-04-26 07:05:18 +00:00
|
|
|
static CTimeProvider* s_currentTimeProvider = nullptr;
|
|
|
|
|
|
|
|
CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x8_lastProvider(s_currentTimeProvider) {
|
|
|
|
if (x8_lastProvider != nullptr) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x8_lastProvider->x4_first = false;
|
2020-04-26 07:05:18 +00:00
|
|
|
}
|
2015-10-27 20:04:02 +00:00
|
|
|
|
2020-04-26 07:05:18 +00:00
|
|
|
s_currentTimeProvider = this;
|
2016-02-18 16:14:57 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CGraphics::SetExternalTimeProvider(this);
|
2015-10-27 20:04:02 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CTimeProvider::~CTimeProvider() {
|
2020-04-26 07:05:18 +00:00
|
|
|
s_currentTimeProvider = x8_lastProvider;
|
|
|
|
if (s_currentTimeProvider != nullptr) {
|
|
|
|
s_currentTimeProvider->x4_first = true;
|
|
|
|
}
|
|
|
|
CGraphics::SetExternalTimeProvider(s_currentTimeProvider);
|
2015-10-27 20:04:02 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|