-
-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathHooks.Timers.cpp
More file actions
70 lines (58 loc) · 1.4 KB
/
Hooks.Timers.cpp
File metadata and controls
70 lines (58 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <GameOptionsClass.h>
#include <FPSCounter.h>
#include <Ext/Rules/Body.h>
namespace TimerValueTemp
{
static int oldValue;
};
DEFINE_HOOK(0x6D4B50, PrintTimerOnTactical_Start, 0x6)
{
if (!Phobos::Config::RealTimeTimers)
return 0;
REF_STACK(int, value, STACK_OFFSET(0, 0x4));
TimerValueTemp::oldValue = value;
if (Phobos::Config::RealTimeTimers_Adaptive
|| GameOptionsClass::Instance.GameSpeed == 0
|| (Phobos::Misc::EnableCustomFPS && Phobos::Misc::CustomGameSpeedFPS[GameOptionsClass::Instance.GameSpeed] > 0))
{
value = (int)((double)value / (std::max((double)FPSCounter::CurrentFrameRate, 1.0) / 15.0));
return 0;
}
switch (GameOptionsClass::Instance.GameSpeed)
{
case 1: // 60 FPS
value = value / 4;
break;
case 2: // 30 FPS
value = value / 2;
break;
case 3: // 20 FPS
value = (value * 3) / 4;
break;
case 4: // 15 FPS
break;
case 5: // 12 FPS
value = (value * 5) / 4;
break;
case 6: // 10 FPS
value = (value * 3) / 2;
break;
default:
break;
}
return 0;
}
DEFINE_HOOK(0x6D4C68, PrintTimerOnTactical_End, 0x8)
{
if (!Phobos::Config::RealTimeTimers)
return 0;
REF_STACK(int, value, STACK_OFFSET(0x654, 0x4));
value = TimerValueTemp::oldValue;
return 0;
}
DEFINE_HOOK(0x6D4CD9, PrintTimerOnTactical_BlinkColor, 0x6)
{
enum { SkipGameCode = 0x6D4CE2 };
R->EDI(ColorScheme::Array.GetItem(RulesExt::Global()->TimerBlinkColorScheme));
return SkipGameCode;
}