]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/client/Main.qc
remove unuseds (except for the fteqcc bug ones)
[divverent/nexuiz.git] / data / qcsrc / client / Main.qc
1 // --------------------------------------------------------------------------\r
2 // BEGIN REQUIRED CSQC FUNCTIONS\r
3 //include "main.qh"\r
4 \r
5 void() menu_show_error =\r
6 {\r
7         drawstring('0 200 0', "ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!", '8 8 0', '1 0 0', 1, 0);\r
8 };\r
9 \r
10 // CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)\r
11 // Useful for precaching things\r
12 \r
13 void() menu_sub_null =\r
14 {\r
15 };\r
16 \r
17 // let's make this a general data buffer...\r
18 float using_gps;\r
19 \r
20 #ifdef USE_FTE\r
21 float __engine_check;\r
22 #endif\r
23 \r
24 string config_get(string key, string defaultvalue)\r
25 {\r
26         string s;\r
27         s = db_get(configdb, strcat("/s/", key));\r
28         if(s == "")\r
29                 return defaultvalue;\r
30         else\r
31                 return db_get(configdb, strcat("/v/", key));\r
32 }\r
33 \r
34 void CSQC_Init(void)\r
35 {\r
36 #ifdef USE_FTE\r
37 #pragma target ID\r
38         __engine_check = checkextension("DP_SV_WRITEPICTURE");\r
39         if(!__engine_check)\r
40         {\r
41                 print("^3Your engine build is outdated\n^3This Server uses a newer QC VM. Please update!\n");\r
42                 localcmd("\ndisconnect\n");\r
43                 return;\r
44         }\r
45 #pragma target FTE\r
46 #endif\r
47         \r
48         float i;\r
49         CSQC_CheckEngine();\r
50 \r
51         configdb = db_create();\r
52 \r
53         drawfont = 0;\r
54         menu_visible = FALSE;\r
55         menu_show = menu_show_error;\r
56         menu_action = menu_sub_null;\r
57         using_gps = false;\r
58         maxclients = 255; // we later get the real maxclients to speed up stuff\r
59         //ctf_temp_1 = "";\r
60         // localcmd("alias order \"cmd order $*\""); enable if ctf-command thingy is used\r
61         //registercmd("ctf_menu");\r
62         registercmd("ons_map");\r
63         //registercmd("menu_action");\r
64         registercmd("sbar_columns_set");\r
65         registercmd("sbar_columns_help");\r
66 \r
67         registercvar("sbar_usecsqc", "1");\r
68         registercvar("sbar_columns", "default", CVAR_SAVE);\r
69 \r
70         gametype = 0;\r
71 \r
72         gps_start = world;\r
73 \r
74         // sbar_fields uses strunzone on the titles!\r
75         for(i = 0; i < MAX_SBAR_FIELDS; ++i)\r
76                 sbar_title[i] = strzone("(null)");\r
77 \r
78         postinit = false;\r
79 \r
80         teams = Sort_Spawn();\r
81         players = Sort_Spawn();\r
82         \r
83         GetTeam(COLOR_SPECTATOR, true); // add specs first\r
84 }\r
85 \r
86 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)\r
87 void CSQC_Shutdown(void)\r
88 {\r
89 #ifdef USE_FTE\r
90 #pragma TARGET id\r
91         if(!__engine_check)\r
92                 return 0;\r
93 #pragma TARGET fte\r
94 #endif\r
95 \r
96         remove(teams);\r
97         remove(players);\r
98         db_close(configdb);\r
99 }\r
100 \r
101 .float has_team;\r
102 float SetTeam(entity o, float Team)\r
103 {\r
104         entity tm;\r
105         if(Team == -1) // leave\r
106         {\r
107                 if(o.has_team)\r
108                 {\r
109                         //print("(DISCONNECT) leave team ", ftos(o.team), "\n");\r
110                         tm = GetTeam(o.team, false);\r
111                         tm.team_size -= 1;\r
112                         o.has_team = 0;\r
113                         return TRUE;\r
114                 }\r
115         }\r
116         else\r
117         {\r
118                 if not(o.has_team)\r
119                 {\r
120                         //print("(CONNECT) enter team ", ftos(o.team), "\n");\r
121                         o.team = Team;\r
122                         tm = GetTeam(Team, true);\r
123                         tm.team_size += 1;\r
124                         o.has_team = 1;\r
125                         return TRUE;\r
126                 }\r
127                 else if(Team != o.team)\r
128                 {\r
129                         //print("(CHANGE) leave team ", ftos(o.team), "\n");\r
130                         tm = GetTeam(o.team, false);\r
131                         tm.team_size -= 1;\r
132                         o.team = Team;\r
133                         //print("(CHANGE) enter team ", ftos(o.team), "\n");\r
134                         tm = GetTeam(Team, true);\r
135                         tm.team_size += 1;\r
136                         return TRUE;\r
137                 }\r
138         }\r
139         return FALSE;\r
140 }\r
141 \r
142 void Playerchecker_Think()\r
143 {\r
144         float i;\r
145         for(i = 0; i < maxclients; ++i)\r
146         {\r
147                 if(getplayerkey(i, "name") == "")\r
148                 {\r
149                         if(playerslots[i].sort_prev)\r
150                         {\r
151                                 //print("playerchecker: KILL KILL KILL\n");\r
152                                 // player disconnected\r
153                                 SetTeam(playerslots[i], -1);\r
154                                 RemovePlayer(playerslots[i]);\r
155                                 playerslots[i].sort_prev = world;\r
156                                 playerslots[i].gotscores = 0;\r
157                         }\r
158                 }\r
159                 else\r
160                 {\r
161                         if not(playerslots[i].sort_prev)\r
162                         {\r
163                                 //print("playerchecker: SPAWN SPAWN SPAWN\n");\r
164                                 // player connected\r
165                                 if not(playerslots[i])\r
166                                         playerslots[i] = spawn();\r
167                                 playerslots[i].sv_entnum = i;\r
168                                 playerslots[i].gotscores = 0;\r
169                                 SetTeam(playerslots[i], COLOR_SPECTATOR);\r
170                                 RegisterPlayer(playerslots[i]);\r
171                                 Sbar_UpdatePlayerPos(playerslots[i]);\r
172                         }\r
173                 }\r
174         }\r
175         self.nextthink = time + 0.2;\r
176 }\r
177 \r
178 void PostInit(void)\r
179 {\r
180         print(strcat("PostInit\n    maxclients = ", ftos(maxclients), "\n"));\r
181         localcmd(strcat("\nsbar_columns_set ", cvar_string("sbar_columns"), ";\n"));\r
182 \r
183         entity playerchecker;\r
184         playerchecker = spawn();\r
185         playerchecker.think = Playerchecker_Think;\r
186         playerchecker.nextthink = time + 0.2;\r
187 \r
188         postinit = true;\r
189 }\r
190 \r
191 // CSQC_ConsoleCommand : Used to parse commands in the console that have been registered with the "registercmd" function\r
192 // Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.\r
193 void Cmd_Sbar_SetFields(float);\r
194 void Cmd_Sbar_Help(float);\r
195 float CSQC_ConsoleCommand(string strMessage)\r
196 {\r
197         float argc;\r
198         // Tokenize String\r
199         //argc = tokenize(strMessage);\r
200         argc = tokenizebyseparator(strMessage, " ");\r
201         \r
202         // Acquire Command\r
203         local string strCmd;\r
204         strCmd = argv(0);\r
205 \r
206         /*if(strCmd == "ctf_menu") {\r
207                 ctf_menu_show();\r
208                 nReturn = true;\r
209                 } else*/\r
210         if(strCmd == "ons_map") {\r
211                 Cmd_ons_map();\r
212                 return true;\r
213         } else if(strCmd == "sbar_columns_set") {\r
214                 Cmd_Sbar_SetFields(argc);\r
215                 return true;\r
216         } else if(strCmd == "sbar_columns_help") {\r
217                 Cmd_Sbar_Help(argc);\r
218                 return true;\r
219         } else if(strCmd == "+showscores") {\r
220                 sb_showscores = true;\r
221                 return true;\r
222         } else if(strCmd == "-showscores") {\r
223                 sb_showscores = false;\r
224                 return true;\r
225         }\r
226         \r
227         return false;\r
228 }\r
229 \r
230 float GameCommand(string msg)\r
231 {\r
232         float argc;\r
233         argc = tokenize(msg);\r
234         string cmd;\r
235         cmd = argv(0);\r
236         if(cmd == "mv_download") {\r
237                 Cmd_MapVote_MapDownload(argc);\r
238                 return true;\r
239         }\r
240         \r
241         return false;\r
242 }\r
243 \r
244 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.\r
245 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.\r
246 // All keys are in ascii.\r
247 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.\r
248 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.\r
249 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.\r
250 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)\r
251 {\r
252         local float bSkipKey;\r
253         bSkipKey = false;\r
254         \r
255         if(menu_visible)\r
256                 if(menu_action(bInputType, nPrimary, nSecondary))\r
257                         return TRUE;\r
258         return bSkipKey;\r
259 }\r
260 \r
261 // END REQUIRED CSQC FUNCTIONS\r
262 // --------------------------------------------------------------------------\r
263 \r
264 // --------------------------------------------------------------------------\r
265 // BEGIN OPTIONAL CSQC FUNCTIONS\r
266 void Ent_ReadONS()\r
267 {\r
268         entity gps;\r
269         using_gps = true;\r
270 \r
271         self.origin_x = ReadCoord();\r
272         self.origin_y = ReadCoord();\r
273         self.angles_y = ReadCoord();\r
274         self.origin_z = self.angles_x = self.angles_z = 0;\r
275 \r
276         for(gps = gps_start; gps; gps = gps.chain)\r
277         {\r
278                 if(gps == self)\r
279                         break;\r
280         }\r
281         if(!gps)\r
282         {\r
283                 self.chain = gps_start;\r
284                 gps_start = self;\r
285         }\r
286 }\r
287 \r
288 void Ent_RemoveONS()\r
289 {\r
290         if(gps_start == self)\r
291                 gps_start = self.chain;\r
292         else\r
293         {\r
294                 local entity ent;\r
295                 ent = gps_start;\r
296                         \r
297                 while(ent.chain != self && ent.chain != world)\r
298                         ent = ent.chain;\r
299                 if(ent.chain == self)\r
300                         ent.chain = self.chain;\r
301         }\r
302 }\r
303 \r
304 void Ent_ReadPlayerScore()\r
305 {\r
306         float i, Team;\r
307         float isNew;\r
308         entity o;\r
309 \r
310         // damnit -.- don't want to go change every single .sv_entnum in sbar.qc AGAIN\r
311         // (no I've never heard of M-x replace-string, sed, or anything like that)\r
312         isNew = !self.owner; // workaround for DP bug\r
313         self.sv_entnum = ReadByte()-1;\r
314         Team = GetPlayerColor(self.sv_entnum);\r
315 \r
316         if not(playerslots[self.sv_entnum])\r
317                 playerslots[self.sv_entnum] = spawn();\r
318         o = self.owner = playerslots[self.sv_entnum];\r
319         o.sv_entnum = self.sv_entnum;\r
320         o.gotscores = 1;\r
321         if not(o.sort_prev)\r
322                 RegisterPlayer(o);\r
323 \r
324         SetTeam(o, Team);\r
325 \r
326         for(i = 0; i < MAX_SCORE; ++i)\r
327                 o.(scores[i]) = ReadShort();\r
328 \r
329         Sbar_UpdatePlayerPos(o);\r
330 }\r
331 \r
332 void Ent_ReadTeamScore()\r
333 {\r
334         float i;\r
335         entity o;\r
336         \r
337         self.team = ReadByte();\r
338         o = self.owner = GetTeam(self.team, true);\r
339 \r
340         for(i = 0; i < MAX_TEAMSCORE; ++i)\r
341                 o.(teamscores[i]) = ReadShort();\r
342 \r
343         Sbar_UpdateTeamPos(o);\r
344 }\r
345 \r
346 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.\r
347 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.\r
348 void Ent_Remove();\r
349 void(float bIsNewEntity) CSQC_Ent_Update =\r
350 {\r
351         float msg, t;\r
352         t = ReadByte();\r
353         if(self.enttype)\r
354                 if(t != self.enttype)\r
355                         Ent_Remove();\r
356         self.enttype = t;\r
357         if(self.enttype == ENT_CLIENT_ENTCS)\r
358         {\r
359                 self.sv_entnum = ReadByte()-1;\r
360 \r
361                 for(msg = ReadByte(); msg != ENTCS_MSG_END; msg = ReadByte())\r
362                 {\r
363                         switch(msg)\r
364                         {\r
365                         case ENTCS_MSG_ONS_GPS: Ent_ReadONS(); break;\r
366                         case ENTCS_MSG_ONS_REMOVE: Ent_RemoveONS(); break;\r
367                         default:\r
368                                 error("unknown ENTCS_MSG type\n");\r
369                         }\r
370                 }\r
371         }\r
372         else if(self.enttype == ENT_CLIENT_SCORES)\r
373                 Ent_ReadPlayerScore();\r
374         else if(self.enttype == ENT_CLIENT_TEAMSCORES)\r
375                 Ent_ReadTeamScore();\r
376         else\r
377                 error("unknown entity type in CSQC_Ent_Update\n");\r
378         \r
379 };\r
380 // Destructor, but does NOT deallocate the entity by calling remove(). Also\r
381 // used when an entity changes its type. For an entity that someone interacts\r
382 // with others, make sure it can no longer do so.\r
383 void Ent_Remove()\r
384 {\r
385         if(self.enttype == ENT_CLIENT_ENTCS)\r
386         {\r
387                 if(using_gps) //gametype == GAME_ONSLAUGHT)\r
388                 {\r
389                         if(gps_start == self)\r
390                                 gps_start = self.chain;\r
391                         else\r
392                         {\r
393                                 local entity ent;\r
394                                 ent = gps_start;\r
395                         \r
396                                 while(ent.chain != self && ent.chain != world)\r
397                                         ent = ent.chain;\r
398                                 if(ent.chain == self)\r
399                                         ent.chain = self.chain;\r
400                         }\r
401                 }\r
402         } else if(self.enttype == ENT_CLIENT_SCORES)\r
403         {\r
404                 if(self.owner)\r
405                 {\r
406                         SetTeam(self.owner, -1);\r
407                         if(self.owner.sort_prev)\r
408                                 RemovePlayer(self.owner);\r
409                         self.owner.sort_prev = NULL;\r
410                 }\r
411         } else if(self.enttype == ENT_CLIENT_TEAMSCORES)\r
412         {\r
413                 /*\r
414                 if(self.owner)\r
415                         RemoveTeam(self.owner);\r
416                 */\r
417                 // we don't NEED to remove them... they won't display anyway\r
418                 // plus, svqc never does this anyway\r
419         }\r
420 \r
421         self.enttype = 0;\r
422         self.classname = "";\r
423         // TODO possibly set more stuff to defaults\r
424 }\r
425 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed.  Essentially call remove(self) as well.\r
426 void CSQC_Ent_Remove()\r
427 {\r
428         if(self.enttype)\r
429                 Ent_Remove();\r
430         remove(self);\r
431 }\r
432 \r
433 void Gamemode_Init()\r
434 {\r
435         local string mapinfo, infoline;\r
436         local float len;\r
437         local float file;\r
438         local vector mi_min, mi_max;\r
439 \r
440         if(!strcasecmp(substring(mapname, 0, 5), "maps/"))\r
441                 shortmapname = substring(mapname, 5, 999);\r
442         else\r
443                 shortmapname = mapname;\r
444         len = strlen(shortmapname);\r
445         if(!strcasecmp(substring(shortmapname, len-4, 4), ".bsp"))\r
446                 shortmapname = substring(shortmapname, 0, len-4);\r
447         shortmapname = strzone(shortmapname);\r
448 \r
449         if(gametype == GAME_ONSLAUGHT) {\r
450                 mapinfo = strcat("maps/", minimapname, ".info");\r
451                 minimapname = strzone(strcat("gfx/", shortmapname, "_mini.tga"));\r
452 \r
453                 mi_min = world.mins;\r
454                 mi_max = world.maxs;\r
455                 \r
456                 file = fopen(mapinfo, FILE_READ);\r
457                 if(file >= 0) {\r
458                         while((infoline = fgets(file))) {\r
459                                 if(!strncasecmp(infoline, "mins", 4)) {\r
460                                         mi_min = stov(substring(infoline, 5, 999));\r
461                                 } else if(!strncasecmp(infoline, "maxs", 4)) {\r
462                                         mi_max = stov(substring(infoline, 5, 999));\r
463                                 } else if(strncasecmp(infoline, "//", 2)) { // don't print comment-style lines\r
464                                         print(strcat("mapinfo: ", infoline, "\n"));\r
465                                 }\r
466                         }\r
467                 } else {\r
468                         print(strcat("Map has no .info file (", mapinfo, ").\n"));\r
469                 }\r
470                 fclose(file);\r
471 \r
472                 print(strcat("Mins: ", vtos(mi_min), "    Maxs: ", vtos(mi_max), "\n"));\r
473                 \r
474                 mi_center = (mi_min + mi_max) * 0.5;\r
475                 mi_scale = mi_max - mi_min;\r
476                 \r
477                 \r
478                 print(strcat("Using ", minimapname, " as minimap.\n"));\r
479                 precache_pic(minimapname);\r
480                 precache_pic("gfx/ons-cp-neutral.tga");\r
481                 precache_pic("gfx/ons-cp-red.tga");\r
482                 precache_pic("gfx/ons-cp-blue.tga");\r
483                 precache_pic("gfx/ons-frame.tga");\r
484                 precache_pic("gfx/ons-frame-team.tga");\r
485         } else if(gametype == GAME_KEYHUNT) {\r
486                 precache_pic("gfx/sb_key_carrying");\r
487                 precache_pic("gfx/sb_key_carrying_outline");\r
488         }\r
489 }\r
490 // CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided.  To execute standard behavior, simply execute localcmd with the string.\r
491 void CSQC_Parse_StuffCmd(string strMessage)\r
492 {\r
493         localcmd(strMessage);\r
494 }\r
495 // CSQC_Parse_Print : Provides the print string in the first parameter that the server provided.  To execute standard behavior, simply execute print with the string.\r
496 void CSQC_Parse_Print(string strMessage)\r
497 {\r
498         print(strMessage);\r
499 }\r
500 // CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.  To execute standard behavior, simply execute cprint with the string.\r
501 void CSQC_Parse_CenterPrint(string strMessage)\r
502 {\r
503         cprint(strMessage);\r
504 }\r
505 \r
506 void CSQC_CheckRevision();\r
507 \r
508 void Gamemode_Init();\r
509 void Net_ReadScoresInfo()\r
510 {\r
511         float i;\r
512         gametype = ReadByte();\r
513         for(i = 0; i < MAX_SCORE; ++i)\r
514         {\r
515                 scores_label[i] = strzone(ReadString());\r
516                 scores_flags[i] = ReadByte();\r
517         }\r
518         for(i = 0; i < MAX_TEAMSCORE; ++i)\r
519         {\r
520                 teamscores_label[i] = strzone(ReadString());\r
521                 teamscores_flags[i] = ReadByte();\r
522         }\r
523         Sbar_InitScores();\r
524         Gamemode_Init();\r
525 }\r
526 \r
527 void Net_ReadInit()\r
528 {\r
529         csqc_revision = ReadShort();\r
530         maxclients = ReadByte();\r
531 \r
532         CSQC_CheckRevision();\r
533 }\r
534 \r
535 string Net_ReadPicture()\r
536 {\r
537         string img;\r
538         if(csqc_flags & CSQC_FLAG_READPICTURE)\r
539         {\r
540                 img = ReadPicture();\r
541                 print(strcat("Got Picture: ", img, "\n"));\r
542         } else {\r
543                 img = ReadString();\r
544                 print(strcat("^3Warning: ^7Couldn't download ", img, ". This is probably because your engine build is outdated.\n"));\r
545                 float psize, i;\r
546                 psize = ReadShort();\r
547                 // Can I be sure that ReadShort is 2 bytes and ReadLong is 4 bytes?\r
548                 // Because then this could be optimized to first get all 4-byte-groups,\r
549                 // then the remaining 2, then the remaining 1\r
550                 for(i = 0; i < psize; ++i)\r
551                         ReadByte();\r
552         }\r
553         return img;\r
554 }\r
555 \r
556 void Net_Config()\r
557 {\r
558         string key, value;\r
559         key = ReadString();\r
560         value = ReadString();\r
561         db_put(configdb, strcat("/v/", key), value);\r
562         db_put(configdb, strcat("/s/", key), "1");\r
563 }\r
564 \r
565 void Net_ReadRace()\r
566 {\r
567         float b;\r
568 \r
569         b = ReadByte();\r
570 \r
571         switch(b)\r
572         {\r
573                 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:\r
574                         race_checkpoint = ReadByte();\r
575                         race_time = ReadShort();\r
576                         race_previousbesttime = ReadShort();\r
577                         if(race_previousbestname)\r
578                                 strunzone(race_previousbestname);\r
579                         race_previousbestname = strzone(ReadString());\r
580 \r
581                         race_checkpointtime = time;\r
582 \r
583                         if(race_checkpoint == 0)\r
584                                 race_laptime = time; // valid\r
585 \r
586                         break;\r
587 \r
588                 case RACE_NET_CHECKPOINT_CLEAR:\r
589                         race_laptime = 0;\r
590                         race_checkpointtime = 0;\r
591                         break;\r
592 \r
593                 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:\r
594                         race_nextcheckpoint = ReadByte();\r
595 \r
596                         race_nextbesttime = ReadShort();\r
597                         if(race_nextbestname)\r
598                                 strunzone(race_nextbestname);\r
599                         race_nextbestname = strzone(ReadString());\r
600                         break;\r
601 \r
602                 case RACE_NET_CHECKPOINT_HIT_RACE:\r
603                         race_mycheckpoint = ReadByte();\r
604                         race_mycheckpointtime = time;\r
605                         race_mycheckpointdelta = ReadShort();\r
606                         race_mycheckpointlapsdelta = ReadByte();\r
607                         if(race_mycheckpointlapsdelta >= 128)\r
608                                 race_mycheckpointlapsdelta -= 128;\r
609                         if(race_mycheckpointenemy)\r
610                                 strunzone(race_mycheckpointenemy);\r
611                         race_mycheckpointenemy = strzone(ReadString());\r
612                         break;\r
613 \r
614                 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:\r
615                         race_othercheckpoint = ReadByte();\r
616                         race_othercheckpointtime = time;\r
617                         race_othercheckpointdelta = ReadShort();\r
618                         race_othercheckpointlapsdelta = ReadByte();\r
619                         if(race_othercheckpointlapsdelta >= 128)\r
620                                 race_othercheckpointlapsdelta -= 128;\r
621                         if(race_othercheckpointenemy)\r
622                                 strunzone(race_othercheckpointenemy);\r
623                         race_othercheckpointenemy = strzone(ReadString());\r
624                         break;\r
625         }\r
626 }\r
627 \r
628 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.\r
629 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.\r
630 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.\r
631 float CSQC_Parse_TempEntity()\r
632 {\r
633         local float bHandled;\r
634                 bHandled  = true;\r
635         // Acquire TE ID\r
636         local float nTEID;\r
637                 nTEID = ReadByte();\r
638 \r
639                 // NOTE: Could just do return instead of break...\r
640         switch(nTEID)\r
641         {\r
642                 case TE_CSQC_INIT:\r
643                         Net_ReadInit();\r
644                         bHandled = true;\r
645                         break;\r
646                 case TE_CSQC_MAPVOTE:\r
647                         Net_Mapvote();\r
648                         bHandled = true;\r
649                         break;\r
650                 case TE_CSQC_CONFIG:\r
651                         Net_Config();\r
652                         bHandled = true;\r
653                         break;\r
654                 case TE_CSQC_SCORESINFO:\r
655                         Net_ReadScoresInfo();\r
656                         bHandled = true;\r
657                         break;\r
658                 case TE_CSQC_RACE:\r
659                         Net_ReadRace();\r
660                         bHandled = true;\r
661                         break;\r
662                 default:\r
663                         // No special logic for this temporary entity; return 0 so the engine can handle it\r
664                         bHandled = false;\r
665                         break;\r
666         }\r
667         \r
668         if(!postinit)\r
669                 PostInit();\r
670                 \r
671         return bHandled;\r
672 }\r
673 \r
674 // COMMIT-TODO: Update if necessare, before committing\r
675 void CSQC_CheckRevision()\r
676 {\r
677         if(csqc_revision == CSQC_REVISION)\r
678         {\r
679                 print("^2SVQC and CSQC revisions are compatible.\n");\r
680         } else if(csqc_revision < CSQC_REVISION) {\r
681                 print("^1Your csprogs.dat (CSQC) version is newer than the one on the server.\n");\r
682         } else if(csqc_revision > CSQC_REVISION) {\r
683                 print("^1Your csprogs.dat (CSQC) is too old for this server.\n");\r
684                 print("^1Please update to a newer version.\n");\r
685         }\r
686 }\r