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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
{
if file_exists("game_errors.log") file_delete("game_errors.log");
var customMapRotationFile;
//import wav files for music
global.MenuMusic=sound_add(choose("Music/menumusic1.wav","Music/menumusic2.wav"), 1, true);
global.IngameMusic=sound_add("Music/ingamemusic.wav", 1, true);
global.FaucetMusic=sound_add("Music/faucetmusic.wav", 1, true);
global.receiveBuffer = createbuffer();
global.sendBuffer = createbuffer();
global.tempBuffer = createbuffer();
global.HudCheck = false;
global.map_rotation = ds_list_create();
global.CustomMapCollisionSprite = -1;
window_set_region_scale(-1, false);
ini_open("ggc.ini");
global.playerName = ini_read_string("Settings", "PlayerName", "Player");
if string_count("#",global.playerName) > 0 global.playerName = "Player";
global.playerName = string_copy(global.playerName, 0, min(string_length(global.playerName), MAX_PLAYERNAME_LENGTH));
global.fullscreen = ini_read_real("Settings", "Fullscreen", 0);
global.useLobbyServer = ini_read_real("Settings", "UseLobby", 1);
global.hostingPort = ini_read_real("Settings", "HostingPort", 8190);
global.ingameMusic = ini_read_real("Settings", "IngameMusic", 1);
global.playerLimit = ini_read_real("Settings", "PlayerLimit", 10);
global.particles = ini_read_real("Settings", "Particles", PARTICLES_NORMAL);
global.gibLevel = ini_read_real("Settings", "Gib Level", 3);
global.killCam = ini_read_real("Settings", "Kill Cam", 1);
global.monitorSync = ini_read_real("Settings", "Monitor Sync", 0);
if global.monitorSync == 1 set_synchronization(true);
else set_synchronization(false);
global.medicRadar = ini_read_real("Settings", "Healer Radar", 1);
global.showHealer = ini_read_real("Settings", "Show Healer", 1);
global.showHealing = ini_read_real("Settings", "Show Healing",1);
global.showHealthBar = ini_read_real("Settings", "Show Healthbar",0);
customMapRotationFile = ini_read_string("Server", "MapRotation", "");
global.timeLimitMins = ini_read_real("Server", "Time Limit", 15);
if global.timeLimitMins >255 global.timeLimitMins=255;
else if global.timeLimitMins < 1 global.timeLimitMins =1;
global.serverPassword = ini_read_string("Server", "Password", "");
global.clientPassword = "";
// for admin menu
global.mapRotationFile = customMapRotationFile;
global.dedicatedMode = ini_read_real("Server", "Dedicated", 0);
global.defaultServerName = ini_read_string("Server", "ServerName", "My Server");
global.caplimit = ini_read_real("Server", "CapLimit", 5);
if global.caplimit > 255 global.caplimit = 255;
else if global.caplimit < 1 global.caplimit =1;
global.caplimitBkup = global.caplimit;
global.autobalance = ini_read_real("Server", "AutoBalance",1);
global.Server_RespawntimeSec = ini_read_real("Server", "Respawn Time", 5);
global.currentMapArea=1;
global.totalMapAreas=1;
global.setupTimer=1800;
global.joinedServerName="";
ini_write_string("Settings", "PlayerName", global.playerName);
ini_write_real("Settings", "Fullscreen", global.fullscreen);
ini_write_real("Settings", "UseLobby", global.useLobbyServer);
ini_write_real("Settings", "HostingPort", global.hostingPort);
ini_write_real("Settings", "IngameMusic", global.ingameMusic);
ini_write_real("Settings", "PlayerLimit", global.playerLimit);
ini_write_real("Settings", "Particles", global.particles);
ini_write_real("Settings", "Gib Level", global.gibLevel);
ini_write_real("Settings", "Kill Cam", global.killCam);
ini_write_real("Settings", "Monitor Sync", global.monitorSync);
ini_write_real("Settings", "Healer Radar", global.medicRadar);
ini_write_real("Settings", "Show Healer", global.showHealer);
ini_write_real("Settings", "Show Healing", global.showHealing);
ini_write_real("Settings", "Show Healthbar", global.showHealthBar);
ini_write_string("Server", "MapRotation", customMapRotationFile);
ini_write_real("Server", "Dedicated", global.dedicatedMode);
ini_write_string("Server", "ServerName", global.defaultServerName);
ini_write_real("Server", "CapLimit", global.caplimit);
ini_write_real("Server", "AutoBalance", global.autobalance);
ini_write_real("Server", "Respawn Time", global.Server_RespawntimeSec);
ini_write_real("Server", "Time Limit", global.timeLimitMins);
ini_write_string("Server", "Password", global.serverPassword);
//screw the 0 index we will start with 1
//map_2fort
maps[1] = ini_read_real("Maps", "ctf_2fortclassic", 1);
//map_well
maps[2] = ini_read_real("Maps", "ctf_well", 2);
//map_badlands hrhr
maps[3] = ini_read_real("Maps", "ctf_badlands", 3);
//map_warpath instant CP :D
maps[4] = ini_read_real("Maps", "cp_warpath",4);
//map_shortcap instant CP in 2forts backyard
maps[5] = ini_read_real("Maps", "cp_shortcap",5);
//map_frontaldanger with the VIP
maps[6] = ini_read_real("Maps", "hh_frontaldanger", 6);
//map_portalescape for science
maps[7] = ini_read_real("Maps", "hh_portalescape",7);
//Server respawn time calculator. Converts each second to a frame. (read: multiply by 30 :hehe:)
if (global.Server_RespawntimeSec == 0)
{
global.Server_Respawntime = 1;
}
else
{
global.Server_Respawntime = global.Server_RespawntimeSec * 30;
}
// I have to include this, or the client'll complain about an unknown variable.
global.mapchanging = false;
ini_write_real("Maps", "ctf_2fortclassic", maps[1]);
ini_write_real("Maps", "ctf_well", maps[2]);
ini_write_real("Maps", "ctf_badlands", maps[3]);
ini_write_real("Maps", "cp_warpath", maps[4]);
ini_write_real("Maps", "cp_shortcap", maps[5]);
ini_write_real("Maps", "hh_frontaldanger", maps[6]);
ini_write_real("Maps", "hh_portalescape", maps[7]);
ini_close();
var a, IPRaw, portRaw;
doubleCheck=0;
global.launchMap = "";
for(a = 1; a <= parameter_count(); a += 1)
{
if (parameter_string(a) == "-dedicated")
{
global.dedicatedMode = 1;
}
else if (parameter_string(a) == "-server")
{
IPRaw = parameter_string(a+1);
if (doubleCheck == 1)
{
doubleCheck = 2;
}
else
{
doubleCheck = 1;
}
}
else if (parameter_string(a) == "-port")
{
portRaw = parameter_string(a+1);
if (doubleCheck == 1)
{
doubleCheck = 2;
}
else
{
doubleCheck = 1;
}
}
else if (parameter_string(a) == "-map")
{
global.launchMap = parameter_string(a+1);
global.dedicatedMode = 1;
}
}
if (doubleCheck == 2)
{
global.serverPort = real(portRaw);
global.serverIP = IPRaw;
global.isHost = false;
global.client = instance_create(0,0,Client);
}
global.customMapdesginated = 0;
// if the user defined a valid map rotation file, then load from there
if(customMapRotationFile != "" && file_exists(customMapRotationFile) && global.launchMap == "") {
global.customMapdesginated = 1;
var fileHandle, i, mapname;
fileHandle = file_text_open_read(customMapRotationFile);
for(i = 1; !file_text_eof(fileHandle); i += 1) {
mapname = file_text_read_string(fileHandle);
// remove leading whitespace from the string
while(string_char_at(mapname, 0) == " " || string_char_at(mapname, 0) == chr(9)) { // while it starts with a space or tab
mapname = string_delete(mapname, 0, 1); // delete that space or tab
}
if(mapname != "" && string_char_at(mapname, 0) != "#") { // if it's not blank and it's not a comment (starting with #)
ds_list_add(global.map_rotation, mapname);
}
file_text_readln(fileHandle);
}
file_text_close(fileHandle);
}
else if (global.launchMap != "") && (global.dedicatedMode == 1)
{
ds_list_add(global.map_rotation, global.launchMap);
}
else { // else load from the ini file Maps section
//Set up the map rotation stuff
var i, sort_list;
sort_list = ds_list_create();
// that <=[number] should always be the count of the total maps FUCKING NOTHING SELFEXPLAINATORY
for(i=1; i <= 7; i += 1) {
if(maps[i] != 0) ds_list_add(sort_list, ((100*maps[i])+i));
}
ds_list_sort(sort_list, 1);
// translate the numbers back into the names they represent
for(i=0; i < ds_list_size(sort_list); i += 1) {
switch(ds_list_find_value(sort_list, i) mod 100) {
case 1:
ds_list_add(global.map_rotation, "ctf_2fortclassic");
break;
case 2:
ds_list_add(global.map_rotation, "ctf_well");
break;
case 3:
ds_list_add(global.map_rotation, "ctf_badlands");
break;
case 4:
ds_list_add(global.map_rotation, "cp_warpath");
break;
case 5:
ds_list_add(global.map_rotation, "cp_shortcap");
break;
case 6:
ds_list_add(global.map_rotation, "hh_frontaldanger");
break;
case 7:
ds_list_add(global.map_rotation, "hh_portalescape");
break;
}
}
ds_list_destroy(sort_list);
}
window_set_fullscreen(global.fullscreen);
draw_set_font(fnt_gg2);
cursor_sprite = CrosshairS;
if(!directory_exists(working_directory + "\Maps")) directory_create(working_directory + "\Maps");
instance_create(0, 0, AudioControl);
if(global.dedicatedMode == 1) {
AudioControlToggleMute();
room_goto(Menu);
}
// custom dialog box graphics
message_background(popupBackgroundB);
message_button(popupButtonS);
message_text_font("Century",9,c_white,1);
message_button_font("Century",9,c_white,1);
message_input_font("Century",9,c_white,0);
// parse the protocol version UUID for later use
parseProtocolUuid();
//Key Mapping
ini_open("controls.ggc");
global.jump = ini_read_real("Controls", "jump", ord("W"));
global.down = ini_read_real("Controls", "down", ord("S"));
global.left = ini_read_real("Controls", "left", ord("A"));
global.right = ini_read_real("Controls", "right", ord("D"));
global.attack = ini_read_real("Controls", "attack", MOUSE_LEFT);
global.special = ini_read_real("Controls", "special", MOUSE_RIGHT);
global.taunt = ini_read_real("Controls", "taunt", ord("F"));
global.chat1 = ini_read_real("Controls", "chat1", ord("Z"));
global.chat2 = ini_read_real("Controls", "chat2", ord("X"));
global.chat3 = ini_read_real("Controls", "chat3", ord("C"));
global.medic = ini_read_real("Controls", "medic", ord("E"));
global.drop = ini_read_real("Controls", "drop", ord("B"));
global.changeTeam = ini_read_real("Controls", "changeTeam", ord("N"));
global.changeClass = ini_read_real("Controls", "changeClass", ord("M"));
global.showScores = ini_read_real("Controls", "showScores", vk_shift);
ini_close();
calculateMonthAndDay();
}