From 79c66de4b3e0dd29c92b5e53435b1c61eae96c35 Mon Sep 17 00:00:00 2001 From: "[11EJ11]" Date: Sat, 7 Feb 2026 14:32:09 +1300 Subject: [PATCH] Add MillisecondSystemTimer Add BasicTimerStruct Define NetworkFrameTime reference Define GameFrameTimer reference --- Timer.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Timer.h b/Timer.h index f7cea73e..0db9a514 100644 --- a/Timer.h +++ b/Timer.h @@ -19,13 +19,20 @@ struct SystemTimer operator long() const { return SystemTimer::GetTime(); } }; +struct MillisecondSystemTimer +{ + static DWORD GetTime() JMP_STD(0x5D5890); + long operator()()const { return MillisecondSystemTimer::GetTime(); } + operator long() const { return MillisecondSystemTimer::GetTime(); } +}; + template struct TimerStruct { int StartTime; Clock CurrentTime; int TimeLeft; - + constexpr TimerStruct() :StartTime { -1 }, TimeLeft { 0 } { }; explicit TimerStruct(const noinit_t&){ } explicit TimerStruct(int duration) { this->Start(duration); } @@ -141,3 +148,18 @@ class RateTimer : public CDTimerClass return rate ? static_cast(rate - this->GetTimeLeft()) / static_cast(rate) : 1.0; } }; + +// Used for both tick-based (campaign/skirmish) and millisecond-based (multiplayer) timing +struct BasicTimerStruct +{ + DWORD StartTime; + DWORD CurrentTime; + int TimeLeft; +}; + +// Global game frame timers +namespace Unsorted +{ + DEFINE_REFERENCE(BasicTimerStruct, NetworkFrameTimer, 0x887328); + DEFINE_REFERENCE(BasicTimerStruct, GameFrameTimer, 0x887348); +}