-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameModeManager.cpp
More file actions
81 lines (66 loc) · 2.18 KB
/
GameModeManager.cpp
File metadata and controls
81 lines (66 loc) · 2.18 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
71
72
73
74
75
76
77
78
79
80
81
#include "GameModeManager.h"
struct SingleModeStatus {
unsigned long startTime = 0;
unsigned long endTime = 0;
};
struct ModeStatuses {
SingleModeStatus superSpinner;
SingleModeStatus superBlastOff;
SingleModeStatus superPops;
};
ModeStatuses modeStates;
void ResetModes(void) {
modeStates.superSpinner.startTime = 0;
modeStates.superSpinner.endTime = 0;
modeStates.superBlastOff.startTime = 0;
modeStates.superBlastOff.endTime = 0;
modeStates.superPops.startTime = 0;
modeStates.superPops.endTime = 0;
}
void StartSuperSpinner(unsigned long curTime) {
modeStates.superSpinner.startTime = curTime;
modeStates.superSpinner.endTime = curTime + SUPER_SPINNER_DURATION;
}
bool IsSuperSpinnerActive(unsigned long curTime) {
return curTime < modeStates.superSpinner.endTime;
}
unsigned long SuperSpinnerRemainingTime(unsigned long curTime) {
if (IsSuperSpinnerActive(curTime)) {
return modeStates.superSpinner.endTime - curTime;
}
return 0; // Mode is not active
}
void StartSuperBlastOff(unsigned long curTime) {
modeStates.superBlastOff.startTime = curTime;
modeStates.superBlastOff.endTime = curTime + SUPER_BLASTOFF_DURATION;
}
void StopSuperBlastOff() {
modeStates.superBlastOff.endTime = 0;
}
bool IsSuperSuperBlastOffActive(unsigned long curTime) {
return curTime < modeStates.superBlastOff.endTime;
}
unsigned long SuperBlastOffRemainingTime(unsigned long curTime) {
if (IsSuperSuperBlastOffActive(curTime)) {
return modeStates.superBlastOff.endTime - curTime;
}
return 0; // Mode is not active
}
void StartSuperPops(unsigned long curTime) {
modeStates.superPops.startTime = curTime;
modeStates.superPops.endTime = curTime + SUPER_POP_DURATION;
}
bool IsSuperPopsActive(unsigned long curTime) {
return curTime < modeStates.superPops.endTime;
}
unsigned long SuperPopsRemainingTime(unsigned long curTime) {
if (IsSuperPopsActive(curTime)) {
return modeStates.superPops.endTime - curTime;
}
return 0; // Mode is not active
}
void StopAllModes() {
modeStates.superSpinner.endTime = 0;
modeStates.superBlastOff.endTime = 0;
modeStates.superPops.endTime = 0;
}