1 // --------------------------------------------------------------------------
2 // BEGIN REQUIRED CSQC FUNCTIONS
5 #define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
7 void cvar_clientsettemp(string cv, string val)
10 for(e = world; (e = find(e, classname, "saved_cvar_value")); )
14 e.classname = "saved_cvar_value";
15 e.netname = strzone(cv);
16 e.message = strzone(cvar_string(cv));
21 void cvar_clientsettemp_restore()
24 for(e = world; (e = find(e, classname, "saved_cvar_value")); )
25 cvar_set(e.netname, e.message);
28 void() menu_show_error =
30 drawstring('0 200 0', "ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!", '8 8 0', '1 0 0', 1, 0);
33 // CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)
34 // Useful for precaching things
36 void() menu_sub_null =
45 void WaypointSprite_Load();
50 __engine_check = checkextension("DP_SV_WRITEPICTURE");
53 print("^3Your engine build is outdated\n^3This Server uses a newer QC VM. Please update!\n");
54 localcmd("\ndisconnect\n");
60 check_unacceptable_compiler_bugs();
68 ClientProgsDB = db_load("client.db");
69 compressShortVector_init();
73 menu_show = menu_show_error;
74 menu_action = menu_sub_null;
76 for(i = 0; i < 255; ++i)
77 if(getplayerkey(i, "viewentity") == "")
82 // localcmd("alias order \"cmd order $*\""); enable if ctf-command thingy is used
83 //registercmd("ctf_menu");
84 registercmd("ons_map");
85 //registercmd("menu_action");
87 registercmd("+button3");
88 registercmd("-button3");
89 registercmd("+button4");
90 registercmd("-button4");
91 registercmd("+showaccuracy");registercmd("-showaccuracy");
97 registercmd("+forward");registercmd("-forward");
98 registercmd("+back");registercmd("-back");
99 registercmd("+moveup");registercmd("-moveup");
100 registercmd("+movedown");registercmd("-movedown");
101 registercmd("+moveright");registercmd("-moveright");
102 registercmd("+moveleft");registercmd("-moveleft");
103 registercmd("+roll_right");registercmd("-roll_right");
104 registercmd("+roll_left");registercmd("-roll_left");
108 registercvar("sbar_usecsqc", "1");
109 registercvar("sbar_columns", "default", CVAR_SAVE);
113 // sbar_fields uses strunzone on the titles!
114 for(i = 0; i < MAX_SBAR_FIELDS; ++i)
115 sbar_title[i] = strzone("(null)");
121 teams = Sort_Spawn();
122 players = Sort_Spawn();
124 GetTeam(COLOR_SPECTATOR, true); // add specs first
126 cvar_clientsettemp("_supports_weaponpriority", "1");
130 WaypointSprite_Load();
132 Projectile_Precache();
133 GibSplash_Precache();
135 DamageInfo_Precache();
136 Announcer_Precache();
139 get_mi_min_max_texcoords(1); // try the CLEVER way first
140 minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
141 shortmapname = mi_shortname;
143 if(precache_pic(minimapname) == "")
145 // but maybe we have a non-clever minimap
146 minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
147 if(precache_pic(minimapname) == "")
148 minimapname = ""; // FAIL
150 get_mi_min_max_texcoords(0); // load new texcoords
153 mi_center = (mi_min + mi_max) * 0.5;
154 mi_scale = mi_max - mi_min;
155 minimapname = strzone(minimapname);
158 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
159 void CSQC_Shutdown(void)
172 db_save(ClientProgsDB, "client.db");
173 db_close(ClientProgsDB);
175 cvar_clientsettemp_restore();
178 cvar_set("chase_active",ftos(chase_active_backup));
182 if not(calledhooks & HOOK_START)
183 localcmd("\n_cl_hook_gamestart nop;");
184 if not(calledhooks & HOOK_END)
185 localcmd("\ncl_hook_gameend;");
190 float SetTeam(entity o, float Team)
204 if(GetTeam(Team, false) == NULL)
206 print("trying to switch to unsupported team ", ftos(Team), "\n");
207 Team = COLOR_SPECTATOR;
220 if(GetTeam(Team, false) == NULL)
222 print("trying to switch to unsupported team ", ftos(Team), "\n");
223 Team = COLOR_SPECTATOR;
228 if(Team == -1) // leave
232 //print("(DISCONNECT) leave team ", ftos(o.team), "\n");
233 tm = GetTeam(o.team, false);
243 //print("(CONNECT) enter team ", ftos(o.team), "\n");
245 tm = GetTeam(Team, true);
250 else if(Team != o.team)
252 //print("(CHANGE) leave team ", ftos(o.team), "\n");
253 tm = GetTeam(o.team, false);
256 //print("(CHANGE) enter team ", ftos(o.team), "\n");
257 tm = GetTeam(Team, true);
265 void Playerchecker_Think()
269 for(i = 0; i < maxclients; ++i)
272 if(GetPlayerName(i) == "")
276 //print("playerchecker: KILL KILL KILL\n");
277 // player disconnected
288 //print("playerchecker: SPAWN SPAWN SPAWN\n");
291 playerslots[i] = e = spawn();
293 //e.gotscores = 0; // we might already have the scores...
294 SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with Sbar_UpdatePlayerTeams
296 Sbar_UpdatePlayerPos(e);
300 self.nextthink = time + 0.2;
307 print(strcat("PostInit\n maxclients = ", ftos(maxclients), "\n"));
308 localcmd(strcat("\nsbar_columns_set ", cvar_string("sbar_columns"), ";\n"));
310 entity playerchecker;
311 playerchecker = spawn();
312 playerchecker.think = Playerchecker_Think;
313 playerchecker.nextthink = time + 0.2;
321 // CSQC_ConsoleCommand : Used to parse commands in the console that have been registered with the "registercmd" function
322 // Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
324 void Cmd_Sbar_SetFields(float);
325 void Cmd_Sbar_Help(float);
326 float CSQC_ConsoleCommand(string strMessage)
330 //argc = tokenize(strMessage);
331 argc = tokenize_console(strMessage);
337 if(strCmd == "+button4") { // zoom
338 // return false, because the message shall be sent to the server anyway (for demos/speccing)
346 } else if(strCmd == "-button4") { // zoom
347 if(ignore_minus_zoom)
354 } else if(strCmd == "+button3") { // secondary
357 } else if(strCmd == "-button3") { // secondary
360 } else if(strCmd == "+showscores") {
361 sb_showscores = true;
363 } else if(strCmd == "-showscores") {
364 sb_showscores = false;
366 } else if(strCmd == "+showaccuracy") {
367 sb_showaccuracy = true;
369 } else if(strCmd == "-showaccuracy") {
370 sb_showaccuracy = false;
375 if(strCmd == "+forward" || strCmd == "-back") {
376 ++camera_direction_x;
378 } else if(strCmd == "-forward" || strCmd == "+back") {
379 --camera_direction_x;
381 } else if(strCmd == "+moveright" || strCmd == "-moveleft") {
382 --camera_direction_y;
384 } else if(strCmd == "-moveright" || strCmd == "+moveleft") {
385 ++camera_direction_y;
387 } else if(strCmd == "+moveup" || strCmd == "-movedown") {
388 ++camera_direction_z;
390 } else if(strCmd == "-moveup" || strCmd == "+movedown") {
391 --camera_direction_z;
393 } else if(strCmd == "+roll_right" || strCmd == "-roll_left") {
396 } else if(strCmd == "+roll_left" || strCmd == "-roll_right") {
405 entity debug_shotorg;
408 self.origin = view_origin + view_forward * self.view_ofs_x + view_right * self.view_ofs_y + view_up * self.view_ofs_z;
409 self.angles = view_angles;
410 self.angles_x = -self.angles_x;
414 void ShotOrg_Draw2D()
416 vector coord2d_topleft, coord2d_topright, coord2d;
420 s = vtos(self.view_ofs);
421 s = substring(s, 1, strlen(s) - 2);
422 if(tokenize_console(s) == 3)
423 s = strcat(argv(0), " ", argv(1), " ", argv(2));
425 coord2d_topleft = project_3d_to_2d(self.origin + view_up * 4 - view_right * 4);
426 coord2d_topright = project_3d_to_2d(self.origin + view_up * 4 + view_right * 4);
428 fs = '1 1 0' * ((coord2d_topright_x - coord2d_topleft_x) / stringwidth(s, FALSE));
430 coord2d = coord2d_topleft;
433 coord2d_x += (coord2d_topright_x - coord2d_topleft_x) * (1 - 8 / fs_x) * 0.5;
438 drawstring(coord2d, s, fs, '1 1 1', 1, 0);
443 debug_shotorg = spawn();
444 debug_shotorg.draw = ShotOrg_Draw;
445 debug_shotorg.draw2d = ShotOrg_Draw2D;
446 debug_shotorg.renderflags = RF_VIEWMODEL;
447 debug_shotorg.effects = EF_FULLBRIGHT;
448 precache_model("models/shotorg_adjuster.md3");
449 setmodel(debug_shotorg, "models/shotorg_adjuster.md3");
450 debug_shotorg.scale = 2;
451 debug_shotorg.view_ofs = '25 8 -8';
454 void GameCommand(string msg)
457 argc = tokenize_console(msg);
459 if(argv(0) == "help" || argc == 0)
461 print("Usage: cl_cmd COMMAND..., where possible commands are:\n");
462 print(" settemp cvar value\n");
464 print(" sbar_columns_set ...\n");
465 print(" sbar_columns_help\n");
466 GameCommand_Generic("help");
470 if(GameCommand_Generic(msg))
475 if(cmd == "mv_download") {
476 Cmd_MapVote_MapDownload(argc);
478 else if(cmd == "settemp") {
479 cvar_clientsettemp(argv(1), argv(2));
481 else if(cmd == "radar") {
482 ons_showmap = !ons_showmap;
484 else if(cmd == "sbar_columns_set") {
485 Cmd_Sbar_SetFields(argc);
487 else if(cmd == "sbar_columns_help") {
491 else if(cmd == "blurtest") {
492 blurtest_time0 = time;
493 blurtest_time1 = time + stof(argv(1));
494 blurtest_radius = stof(argv(2));
495 blurtest_power = stof(argv(3));
498 else if(cmd == "shotorg_move") {
502 debug_shotorg.view_ofs = debug_shotorg.view_ofs + stov(argv(1));
503 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
505 else if(cmd == "shotorg_movez") {
509 debug_shotorg.view_ofs = debug_shotorg.view_ofs + stof(argv(1)) * (debug_shotorg.view_ofs * (1 / debug_shotorg.view_ofs_x)); // closer/farther, same xy pos
510 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
512 else if(cmd == "shotorg_set") {
516 debug_shotorg.view_ofs = stov(argv(1));
517 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
519 else if(cmd == "shotorg_setz") {
523 debug_shotorg.view_ofs = debug_shotorg.view_ofs * (stof(argv(1)) / debug_shotorg.view_ofs_x); // closer/farther, same xy pos
524 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
526 else if(cmd == "shotorg_toggle_hide") {
529 debug_shotorg.cnt = !debug_shotorg.cnt;
532 else if(cmd == "shotorg_end") {
535 print(vtos(debug_shotorg.view_ofs), "\n");
536 remove(debug_shotorg);
537 debug_shotorg = world;
539 localcmd("sv_cmd debug_shotorg\n");
543 print("Invalid command. For a list of supported commands, try cl_cmd help.\n");
549 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
550 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
551 // All keys are in ascii.
552 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
553 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
554 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
555 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
557 local float bSkipKey;
561 if(menu_action(bInputType, nPrimary, nSecondary))
566 // END REQUIRED CSQC FUNCTIONS
567 // --------------------------------------------------------------------------
569 // --------------------------------------------------------------------------
570 // BEGIN OPTIONAL CSQC FUNCTIONS
573 InterpolateOrigin_Undo();
575 self.classname = "entcs_receiver";
576 self.sv_entnum = ReadByte() - 1;
577 self.origin_x = ReadShort();
578 self.origin_y = ReadShort();
579 self.origin_z = ReadShort();
580 self.angles_y = ReadByte() * 360.0 / 256;
581 self.origin_z = self.angles_x = self.angles_z = 0;
583 InterpolateOrigin_Note();
588 void Ent_RemovePlayerScore()
594 SetTeam(self.owner, -1);
595 self.owner.gotscores = 0;
596 for(i = 0; i < MAX_SCORE; ++i)
597 self.owner.(scores[i]) = 0; // clear all scores
601 void Ent_ReadPlayerScore()
607 // damnit -.- don't want to go change every single .sv_entnum in sbar.qc AGAIN
608 // (no I've never heard of M-x replace-string, sed, or anything like that)
609 isNew = !self.owner; // workaround for DP bug
612 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
613 if(!isNew && n != self.sv_entnum)
615 print("A CSQC entity changed its owner!\n");
618 self.enttype = ENT_CLIENT_SCORES;
624 if not(playerslots[self.sv_entnum])
625 playerslots[self.sv_entnum] = spawn();
626 o = self.owner = playerslots[self.sv_entnum];
627 o.sv_entnum = self.sv_entnum;
630 //if not(o.sort_prev)
631 // RegisterPlayer(o);
632 //playerchecker will do this for us later, if it has not already done so
643 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
647 o.(scores[i]) = ReadInt24_t();
649 o.(scores[i]) = ReadChar();
653 Sbar_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
655 self.entremove = Ent_RemovePlayerScore;
658 void Ent_ReadTeamScore()
663 self.team = ReadByte();
664 o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
667 #if MAX_TEAMSCORE <= 8
675 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
679 o.(teamscores[i]) = ReadInt24_t();
681 o.(teamscores[i]) = ReadChar();
684 Sbar_UpdateTeamPos(o);
691 void Ent_ClientData()
694 float newspectatee_status;
698 sb_showscores_force = (f & 1);
702 newspectatee_status = ReadByte();
703 if(newspectatee_status == player_localentnum)
704 newspectatee_status = -1; // observing
707 newspectatee_status = 0;
709 spectatorbutton_zoom = (f & 4);
713 angles_held_status = 1;
714 angles_held_x = ReadAngle();
715 angles_held_y = ReadAngle();
719 angles_held_status = 0;
721 if(newspectatee_status != spectatee_status)
724 // clear the weapon accuracy stats
725 for(i = WEP_FIRST; i <= WEP_LAST; ++i) {
732 race_checkpointtime = 0;
734 spectatee_status = newspectatee_status;
739 float nags, i, j, b, f;
746 strunzone(vote_called_vote);
747 vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
752 for(j = 0; j < maxclients; ++j)
754 playerslots[j].ready = 1;
755 for(i = 1; i <= maxclients; i += 8)
758 for(j = i-1, b = 1; b < 256; b *= 2, ++j)
761 playerslots[j].ready = 0;
765 ready_waiting = (nags & 1);
766 ready_waiting_for_me = (nags & 2);
767 vote_waiting = (nags & 4);
768 vote_waiting_for_me = (nags & 8);
769 warmup_stage = (nags & 16);
772 void Ent_RandomSeed()
780 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
781 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
782 void Ent_RadarLink();
784 void Ent_ScoresInfo();
785 void(float bIsNewEntity) CSQC_Ent_Update =
791 // set up the "time" global for received entities to be correct for interpolation purposes
799 serverprevtime = time;
800 serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
801 time = serverprevtime + serverdeltatime;
804 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
806 if(t != self.enttype)
808 print("A CSQC entity changed its type!\n");
816 case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
817 case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
818 case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
819 case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
820 case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
821 case ENT_CLIENT_LASER: Ent_Laser(); break;
822 case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
823 case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
824 case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
825 case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
826 case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
827 case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
828 case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
829 case ENT_CLIENT_INIT: Ent_Init(); break;
830 case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
831 case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
832 case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
833 case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
834 case ENT_CLIENT_WALL: Ent_Wall(); break;
835 case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
836 case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
838 error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
844 // Destructor, but does NOT deallocate the entity by calling remove(). Also
845 // used when an entity changes its type. For an entity that someone interacts
846 // with others, make sure it can no longer do so.
854 self.draw = menu_sub_null;
855 self.entremove = menu_sub_null;
856 // TODO possibly set more stuff to defaults
858 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
859 void CSQC_Ent_Remove()
868 if(gametype == GAME_ONSLAUGHT) {
869 print(strcat("Using ", minimapname, " as minimap.\n"));
870 precache_pic("gfx/ons-cp-neutral.tga");
871 precache_pic("gfx/ons-cp-red.tga");
872 precache_pic("gfx/ons-cp-blue.tga");
873 precache_pic("gfx/ons-frame.tga");
874 precache_pic("gfx/ons-frame-team.tga");
875 } else if(gametype == GAME_KEYHUNT) {
876 precache_pic("gfx/sb_key_carrying");
877 precache_pic("gfx/sb_key_carrying_outline");
882 localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";");
883 calledhooks |= HOOK_START;
886 // 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.
887 void CSQC_Parse_StuffCmd(string strMessage)
889 localcmd(strMessage);
891 // 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.
892 void CSQC_Parse_Print(string strMessage)
894 print(ColorTranslateRGB(strMessage));
897 // CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
898 void CSQC_Parse_CenterPrint(string strMessage)
900 centerprint(strMessage);
905 // TODO somehow thwart prvm_globalset client ...
908 localcmd(strcat("\nfog ", forcefog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
911 void Gamemode_Init();
912 void Ent_ScoresInfo()
915 self.classname = "ent_client_scores_info";
916 gametype = ReadByte();
917 for(i = 0; i < MAX_SCORE; ++i)
919 scores_label[i] = strzone(ReadString());
920 scores_flags[i] = ReadByte();
922 for(i = 0; i < MAX_TEAMSCORE; ++i)
924 teamscores_label[i] = strzone(ReadString());
925 teamscores_flags[i] = ReadByte();
934 self.classname = "ent_client_init";
936 nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
938 for(i = 0; i < 24; ++i)
939 weaponimpulse[i] = ReadByte() - 1;
940 hook_shotorigin_x = ReadCoord();
941 hook_shotorigin_y = ReadCoord();
942 hook_shotorigin_z = ReadCoord();
946 forcefog = strzone(ReadString());
948 armorblockpercent = ReadByte() / 255.0;
950 g_weaponswitchdelay = ReadByte() / 255.0;
964 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
965 race_checkpoint = ReadByte();
966 race_time = ReadInt24_t();
967 race_previousbesttime = ReadInt24_t();
968 if(race_previousbestname)
969 strunzone(race_previousbestname);
970 race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
972 race_checkpointtime = time;
974 if(race_checkpoint == 0 || race_checkpoint == 254)
976 race_penaltyaccumulator = 0;
977 race_laptime = time; // valid
982 case RACE_NET_CHECKPOINT_CLEAR:
984 race_checkpointtime = 0;
987 case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
988 race_laptime = ReadCoord();
989 race_checkpointtime = -99999;
991 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
992 race_nextcheckpoint = ReadByte();
994 race_nextbesttime = ReadInt24_t();
995 if(race_nextbestname)
996 strunzone(race_nextbestname);
997 race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
1000 case RACE_NET_CHECKPOINT_HIT_RACE:
1001 race_mycheckpoint = ReadByte();
1002 race_mycheckpointtime = time;
1003 race_mycheckpointdelta = ReadInt24_t();
1004 race_mycheckpointlapsdelta = ReadByte();
1005 if(race_mycheckpointlapsdelta >= 128)
1006 race_mycheckpointlapsdelta -= 256;
1007 if(race_mycheckpointenemy)
1008 strunzone(race_mycheckpointenemy);
1009 race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
1012 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
1013 race_othercheckpoint = ReadByte();
1014 race_othercheckpointtime = time;
1015 race_othercheckpointdelta = ReadInt24_t();
1016 race_othercheckpointlapsdelta = ReadByte();
1017 if(race_othercheckpointlapsdelta >= 128)
1018 race_othercheckpointlapsdelta -= 256;
1019 if(race_othercheckpointenemy)
1020 strunzone(race_othercheckpointenemy);
1021 race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
1024 case RACE_NET_PENALTY_RACE:
1025 race_penaltyeventtime = time;
1026 race_penaltytime = ReadShort();
1027 //race_penaltyaccumulator += race_penaltytime;
1028 if(race_penaltyreason)
1029 strunzone(race_penaltyreason);
1030 race_penaltyreason = strzone(ReadString());
1033 case RACE_NET_PENALTY_QUALIFYING:
1034 race_penaltyeventtime = time;
1035 race_penaltytime = ReadShort();
1036 race_penaltyaccumulator += race_penaltytime;
1037 if(race_penaltyreason)
1038 strunzone(race_penaltyreason);
1039 race_penaltyreason = strzone(ReadString());
1042 case RACE_NET_SERVER_RECORD:
1043 race_server_record = ReadInt24_t();
1045 case RACE_NET_SPEED_AWARD:
1046 race_speedaward = ReadShort();
1047 race_speedaward_holder = strzone(ReadString());
1049 case RACE_NET_SPEED_AWARD_BEST:
1050 race_speedaward_alltimebest = ReadShort();
1051 race_speedaward_alltimebest_holder = strzone(ReadString());
1056 void Net_ReadSpawn()
1059 current_viewzoom = 0.6;
1062 void Net_TeamNagger()
1067 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
1068 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
1069 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
1070 float CSQC_Parse_TempEntity()
1072 local float bHandled;
1078 // NOTE: Could just do return instead of break...
1081 case TE_CSQC_PICTURE:
1082 Net_MapVote_Picture();
1090 Net_GrapplingHook();
1097 case TE_CSQC_ZCURVEPARTICLES:
1098 Net_ReadZCurveParticles();
1101 case TE_CSQC_NEXGUNBEAMPARTICLE:
1102 Net_ReadNexgunBeamParticle();
1105 case TE_CSQC_TEAMNAGGER:
1109 case TE_CSQC_LIGHTNINGARC:
1110 Net_ReadLightningarc();
1114 // No special logic for this temporary entity; return 0 so the engine can handle it
1122 string getcommandkey(string text, string command)
1127 if (!sbar_showbinds)
1130 keys = db_get(binddb, command);
1133 n = tokenize(findkeysforcommand(command)); // uses '...' strings
1134 for(j = 0; j < n; ++j)
1140 keys = keynumtostring(k);
1142 keys = strcat(keys, ", ", keynumtostring(k));
1145 if (sbar_showbinds_limit > 0 && sbar_showbinds_limit >= l) break;
1149 db_put(binddb, command, keys);
1153 if (sbar_showbinds > 1)
1154 return strcat(text, " (not bound)");
1158 else if (sbar_showbinds > 1)
1159 return strcat(text, " (", keys, ")");