blob: ce6f8aef7601542d88838338763f323eabcc0ae8 (
plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
static bool modeLoaded[MODE_COUNT];
static int modeVersion[MODE_COUNT];
static bool GOKZHitPerf[MAXPLAYERS + 1];
static float GOKZTakeoffSpeed[MAXPLAYERS + 1];
// =====[ PUBLIC ]=====
bool GetModeLoaded(int mode)
{
return modeLoaded[mode];
}
int GetModeVersion(int mode)
{
return modeLoaded[mode] ? modeVersion[mode] : -1;
}
void SetModeLoaded(int mode, bool loaded, int version = -1)
{
if (!modeLoaded[mode] && loaded)
{
modeLoaded[mode] = true;
modeVersion[mode] = version;
Call_GOKZ_OnModeLoaded(mode);
}
else if (modeLoaded[mode] && !loaded)
{
modeLoaded[mode] = false;
Call_GOKZ_OnModeUnloaded(mode);
}
}
int GetLoadedModeCount()
{
int count = 0;
for (int mode = 0; mode < MODE_COUNT; mode++)
{
if (modeLoaded[mode])
{
count++;
}
}
return count;
}
int GetALoadedMode()
{
for (int mode = 0; mode < MODE_COUNT; mode++)
{
if (GOKZ_GetModeLoaded(mode))
{
return mode;
}
}
return -1; // Uh-oh
}
bool GetGOKZHitPerf(int client)
{
return GOKZHitPerf[client];
}
void SetGOKZHitPerf(int client, bool hitPerf)
{
GOKZHitPerf[client] = hitPerf;
}
float GetGOKZTakeoffSpeed(int client)
{
return GOKZTakeoffSpeed[client];
}
void SetGOKZTakeoffSpeed(int client, float takeoffSpeed)
{
GOKZTakeoffSpeed[client] = takeoffSpeed;
}
// =====[ EVENTS ]=====
void OnAllPluginsLoaded_Modes()
{
if (GetLoadedModeCount() <= 0)
{
SetFailState("At least one GOKZ mode plugin is required.");
}
}
void OnPlayerSpawn_Modes(int client)
{
GOKZHitPerf[client] = false;
GOKZTakeoffSpeed[client] = 0.0;
}
void OnOptionChanged_Mode(int client, Option option)
{
if (option == Option_Mode)
{
// Remove speed when switching modes
Movement_SetVelocityModifier(client, 1.0);
Movement_SetVelocity(client, view_as<float>( { 0.0, 0.0, 0.0 } ));
}
}
|