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();
294 e.ping_packetloss = 0;
295 e.ping_movementloss = 0;
296 //e.gotscores = 0; // we might already have the scores...
297 SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with Sbar_UpdatePlayerTeams
299 Sbar_UpdatePlayerPos(e);
303 self.nextthink = time + 0.2;
310 print(strcat("PostInit\n maxclients = ", ftos(maxclients), "\n"));
311 localcmd(strcat("\nsbar_columns_set ", cvar_string("sbar_columns"), ";\n"));
313 entity playerchecker;
314 playerchecker = spawn();
315 playerchecker.think = Playerchecker_Think;
316 playerchecker.nextthink = time + 0.2;
324 // CSQC_ConsoleCommand : Used to parse commands in the console that have been registered with the "registercmd" function
325 // Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
327 void Cmd_Sbar_SetFields(float);
328 void Cmd_Sbar_Help(float);
329 float CSQC_ConsoleCommand(string strMessage)
333 //argc = tokenize(strMessage);
334 argc = tokenize_console(strMessage);
340 if(strCmd == "+button4") { // zoom
341 // return false, because the message shall be sent to the server anyway (for demos/speccing)
349 } else if(strCmd == "-button4") { // zoom
350 if(ignore_minus_zoom)
357 } else if(strCmd == "+button3") { // secondary
360 } else if(strCmd == "-button3") { // secondary
363 } else if(strCmd == "+showscores") {
364 sb_showscores = true;
366 } else if(strCmd == "-showscores") {
367 sb_showscores = false;
369 } else if(strCmd == "+showaccuracy") {
370 sb_showaccuracy = true;
372 } else if(strCmd == "-showaccuracy") {
373 sb_showaccuracy = false;
378 if(strCmd == "+forward" || strCmd == "-back") {
379 ++camera_direction_x;
381 } else if(strCmd == "-forward" || strCmd == "+back") {
382 --camera_direction_x;
384 } else if(strCmd == "+moveright" || strCmd == "-moveleft") {
385 --camera_direction_y;
387 } else if(strCmd == "-moveright" || strCmd == "+moveleft") {
388 ++camera_direction_y;
390 } else if(strCmd == "+moveup" || strCmd == "-movedown") {
391 ++camera_direction_z;
393 } else if(strCmd == "-moveup" || strCmd == "+movedown") {
394 --camera_direction_z;
396 } else if(strCmd == "+roll_right" || strCmd == "-roll_left") {
399 } else if(strCmd == "+roll_left" || strCmd == "-roll_right") {
408 entity debug_shotorg;
411 self.origin = view_origin + view_forward * self.view_ofs_x + view_right * self.view_ofs_y + view_up * self.view_ofs_z;
412 self.angles = view_angles;
413 self.angles_x = -self.angles_x;
417 void ShotOrg_Draw2D()
419 vector coord2d_topleft, coord2d_topright, coord2d;
423 s = vtos(self.view_ofs);
424 s = substring(s, 1, strlen(s) - 2);
425 if(tokenize_console(s) == 3)
426 s = strcat(argv(0), " ", argv(1), " ", argv(2));
428 coord2d_topleft = project_3d_to_2d(self.origin + view_up * 4 - view_right * 4);
429 coord2d_topright = project_3d_to_2d(self.origin + view_up * 4 + view_right * 4);
431 fs = '1 1 0' * ((coord2d_topright_x - coord2d_topleft_x) / stringwidth(s, FALSE));
433 coord2d = coord2d_topleft;
436 coord2d_x += (coord2d_topright_x - coord2d_topleft_x) * (1 - 8 / fs_x) * 0.5;
441 drawstring(coord2d, s, fs, '1 1 1', 1, 0);
446 debug_shotorg = spawn();
447 debug_shotorg.draw = ShotOrg_Draw;
448 debug_shotorg.draw2d = ShotOrg_Draw2D;
449 debug_shotorg.renderflags = RF_VIEWMODEL;
450 debug_shotorg.effects = EF_FULLBRIGHT;
451 precache_model("models/shotorg_adjuster.md3");
452 setmodel(debug_shotorg, "models/shotorg_adjuster.md3");
453 debug_shotorg.scale = 2;
454 debug_shotorg.view_ofs = '25 8 -8';
457 void GameCommand(string msg)
460 argc = tokenize_console(msg);
462 if(argv(0) == "help" || argc == 0)
464 print("Usage: cl_cmd COMMAND..., where possible commands are:\n");
465 print(" settemp cvar value\n");
467 print(" sbar_columns_set ...\n");
468 print(" sbar_columns_help\n");
469 GameCommand_Generic("help");
473 if(GameCommand_Generic(msg))
478 if(cmd == "mv_download") {
479 Cmd_MapVote_MapDownload(argc);
481 else if(cmd == "settemp") {
482 cvar_clientsettemp(argv(1), argv(2));
484 else if(cmd == "radar") {
485 ons_showmap = !ons_showmap;
487 else if(cmd == "sbar_columns_set") {
488 Cmd_Sbar_SetFields(argc);
490 else if(cmd == "sbar_columns_help") {
494 else if(cmd == "blurtest") {
495 blurtest_time0 = time;
496 blurtest_time1 = time + stof(argv(1));
497 blurtest_radius = stof(argv(2));
498 blurtest_power = stof(argv(3));
501 else if(cmd == "shotorg_move") {
505 debug_shotorg.view_ofs = debug_shotorg.view_ofs + stov(argv(1));
506 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
508 else if(cmd == "shotorg_movez") {
512 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
513 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
515 else if(cmd == "shotorg_set") {
519 debug_shotorg.view_ofs = stov(argv(1));
520 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
522 else if(cmd == "shotorg_setz") {
526 debug_shotorg.view_ofs = debug_shotorg.view_ofs * (stof(argv(1)) / debug_shotorg.view_ofs_x); // closer/farther, same xy pos
527 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
529 else if(cmd == "shotorg_toggle_hide") {
532 debug_shotorg.cnt = !debug_shotorg.cnt;
535 else if(cmd == "shotorg_end") {
538 print(vtos(debug_shotorg.view_ofs), "\n");
539 remove(debug_shotorg);
540 debug_shotorg = world;
542 localcmd("sv_cmd debug_shotorg\n");
546 print("Invalid command. For a list of supported commands, try cl_cmd help.\n");
552 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
553 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
554 // All keys are in ascii.
555 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
556 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
557 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
558 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
560 local float bSkipKey;
564 if(menu_action(bInputType, nPrimary, nSecondary))
569 // END REQUIRED CSQC FUNCTIONS
570 // --------------------------------------------------------------------------
572 // --------------------------------------------------------------------------
573 // BEGIN OPTIONAL CSQC FUNCTIONS
576 InterpolateOrigin_Undo();
578 self.classname = "entcs_receiver";
579 self.sv_entnum = ReadByte() - 1;
580 self.origin_x = ReadShort();
581 self.origin_y = ReadShort();
582 self.origin_z = ReadShort();
583 self.angles_y = ReadByte() * 360.0 / 256;
584 self.origin_z = self.angles_x = self.angles_z = 0;
586 InterpolateOrigin_Note();
591 void Ent_RemovePlayerScore()
597 SetTeam(self.owner, -1);
598 self.owner.gotscores = 0;
599 for(i = 0; i < MAX_SCORE; ++i)
600 self.owner.(scores[i]) = 0; // clear all scores
604 void Ent_ReadPlayerScore()
610 // damnit -.- don't want to go change every single .sv_entnum in sbar.qc AGAIN
611 // (no I've never heard of M-x replace-string, sed, or anything like that)
612 isNew = !self.owner; // workaround for DP bug
615 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
616 if(!isNew && n != self.sv_entnum)
618 print("A CSQC entity changed its owner!\n");
621 self.enttype = ENT_CLIENT_SCORES;
627 if not(playerslots[self.sv_entnum])
628 playerslots[self.sv_entnum] = spawn();
629 o = self.owner = playerslots[self.sv_entnum];
630 o.sv_entnum = self.sv_entnum;
633 //if not(o.sort_prev)
634 // RegisterPlayer(o);
635 //playerchecker will do this for us later, if it has not already done so
646 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
650 o.(scores[i]) = ReadInt24_t();
652 o.(scores[i]) = ReadChar();
656 Sbar_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
658 self.entremove = Ent_RemovePlayerScore;
661 void Ent_ReadTeamScore()
666 self.team = ReadByte();
667 o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
670 #if MAX_TEAMSCORE <= 8
678 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
682 o.(teamscores[i]) = ReadInt24_t();
684 o.(teamscores[i]) = ReadChar();
687 Sbar_UpdateTeamPos(o);
694 void Ent_ClientData()
697 float newspectatee_status;
701 sb_showscores_force = (f & 1);
705 newspectatee_status = ReadByte();
706 if(newspectatee_status == player_localentnum)
707 newspectatee_status = -1; // observing
710 newspectatee_status = 0;
712 spectatorbutton_zoom = (f & 4);
716 angles_held_status = 1;
717 angles_held_x = ReadAngle();
718 angles_held_y = ReadAngle();
722 angles_held_status = 0;
724 if(newspectatee_status != spectatee_status)
727 // clear the weapon accuracy stats
728 for(i = WEP_FIRST; i <= WEP_LAST; ++i) {
735 race_checkpointtime = 0;
737 spectatee_status = newspectatee_status;
742 float nags, i, j, b, f;
749 strunzone(vote_called_vote);
750 vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
755 for(j = 0; j < maxclients; ++j)
757 playerslots[j].ready = 1;
758 for(i = 1; i <= maxclients; i += 8)
761 for(j = i-1, b = 1; b < 256; b *= 2, ++j)
764 playerslots[j].ready = 0;
768 ready_waiting = (nags & 1);
769 ready_waiting_for_me = (nags & 2);
770 vote_waiting = (nags & 4);
771 vote_waiting_for_me = (nags & 8);
772 warmup_stage = (nags & 16);
775 void Ent_RandomSeed()
783 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
784 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
785 void Ent_RadarLink();
787 void Ent_ScoresInfo();
788 void(float bIsNewEntity) CSQC_Ent_Update =
794 // set up the "time" global for received entities to be correct for interpolation purposes
802 serverprevtime = time;
803 serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
804 time = serverprevtime + serverdeltatime;
807 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
809 if(t != self.enttype)
811 print("A CSQC entity changed its type!\n");
819 case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
820 case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
821 case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
822 case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
823 case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
824 case ENT_CLIENT_LASER: Ent_Laser(); break;
825 case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
826 case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
827 case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
828 case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
829 case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
830 case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
831 case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
832 case ENT_CLIENT_INIT: Ent_Init(); break;
833 case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
834 case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
835 case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
836 case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
837 case ENT_CLIENT_WALL: Ent_Wall(); break;
838 case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
839 case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
841 error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
847 // Destructor, but does NOT deallocate the entity by calling remove(). Also
848 // used when an entity changes its type. For an entity that someone interacts
849 // with others, make sure it can no longer do so.
857 self.draw = menu_sub_null;
858 self.entremove = menu_sub_null;
859 // TODO possibly set more stuff to defaults
861 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
862 void CSQC_Ent_Remove()
871 if(gametype == GAME_ONSLAUGHT) {
872 print(strcat("Using ", minimapname, " as minimap.\n"));
873 precache_pic("gfx/ons-cp-neutral.tga");
874 precache_pic("gfx/ons-cp-red.tga");
875 precache_pic("gfx/ons-cp-blue.tga");
876 precache_pic("gfx/ons-frame.tga");
877 precache_pic("gfx/ons-frame-team.tga");
878 } else if(gametype == GAME_KEYHUNT) {
879 precache_pic("gfx/sb_key_carrying");
880 precache_pic("gfx/sb_key_carrying_outline");
885 localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";");
886 calledhooks |= HOOK_START;
889 // 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.
890 void CSQC_Parse_StuffCmd(string strMessage)
892 localcmd(strMessage);
894 // 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.
895 void CSQC_Parse_Print(string strMessage)
897 print(ColorTranslateRGB(strMessage));
900 // CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
901 void CSQC_Parse_CenterPrint(string strMessage)
903 centerprint(strMessage);
906 string notranslate_fogcmd1 = "\nfog ";
907 string notranslate_fogcmd2 = "\nr_fog_exp2 0\nr_drawfog 1\n";
910 // TODO somehow thwart prvm_globalset client ...
913 localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2));
916 void Gamemode_Init();
917 void Ent_ScoresInfo()
920 self.classname = "ent_client_scores_info";
921 gametype = ReadByte();
922 for(i = 0; i < MAX_SCORE; ++i)
924 scores_label[i] = strzone(ReadString());
925 scores_flags[i] = ReadByte();
927 for(i = 0; i < MAX_TEAMSCORE; ++i)
929 teamscores_label[i] = strzone(ReadString());
930 teamscores_flags[i] = ReadByte();
939 self.classname = "ent_client_init";
941 nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
943 for(i = 0; i < 24; ++i)
944 weaponimpulse[i] = ReadByte() - 1;
945 hook_shotorigin_x = ReadCoord();
946 hook_shotorigin_y = ReadCoord();
947 hook_shotorigin_z = ReadCoord();
951 forcefog = strzone(ReadString());
953 armorblockpercent = ReadByte() / 255.0;
955 g_weaponswitchdelay = ReadByte() / 255.0;
969 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
970 race_checkpoint = ReadByte();
971 race_time = ReadInt24_t();
972 race_previousbesttime = ReadInt24_t();
973 if(race_previousbestname)
974 strunzone(race_previousbestname);
975 race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
977 race_checkpointtime = time;
979 if(race_checkpoint == 0 || race_checkpoint == 254)
981 race_penaltyaccumulator = 0;
982 race_laptime = time; // valid
987 case RACE_NET_CHECKPOINT_CLEAR:
989 race_checkpointtime = 0;
992 case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
993 race_laptime = ReadCoord();
994 race_checkpointtime = -99999;
996 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
997 race_nextcheckpoint = ReadByte();
999 race_nextbesttime = ReadInt24_t();
1000 if(race_nextbestname)
1001 strunzone(race_nextbestname);
1002 race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
1005 case RACE_NET_CHECKPOINT_HIT_RACE:
1006 race_mycheckpoint = ReadByte();
1007 race_mycheckpointtime = time;
1008 race_mycheckpointdelta = ReadInt24_t();
1009 race_mycheckpointlapsdelta = ReadByte();
1010 if(race_mycheckpointlapsdelta >= 128)
1011 race_mycheckpointlapsdelta -= 256;
1012 if(race_mycheckpointenemy)
1013 strunzone(race_mycheckpointenemy);
1014 race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
1017 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
1018 race_othercheckpoint = ReadByte();
1019 race_othercheckpointtime = time;
1020 race_othercheckpointdelta = ReadInt24_t();
1021 race_othercheckpointlapsdelta = ReadByte();
1022 if(race_othercheckpointlapsdelta >= 128)
1023 race_othercheckpointlapsdelta -= 256;
1024 if(race_othercheckpointenemy)
1025 strunzone(race_othercheckpointenemy);
1026 race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
1029 case RACE_NET_PENALTY_RACE:
1030 race_penaltyeventtime = time;
1031 race_penaltytime = ReadShort();
1032 //race_penaltyaccumulator += race_penaltytime;
1033 if(race_penaltyreason)
1034 strunzone(race_penaltyreason);
1035 race_penaltyreason = strzone(ReadString());
1038 case RACE_NET_PENALTY_QUALIFYING:
1039 race_penaltyeventtime = time;
1040 race_penaltytime = ReadShort();
1041 race_penaltyaccumulator += race_penaltytime;
1042 if(race_penaltyreason)
1043 strunzone(race_penaltyreason);
1044 race_penaltyreason = strzone(ReadString());
1047 case RACE_NET_SERVER_RECORD:
1048 race_server_record = ReadInt24_t();
1050 case RACE_NET_SPEED_AWARD:
1051 race_speedaward = ReadShort();
1052 race_speedaward_holder = strzone(ReadString());
1054 case RACE_NET_SPEED_AWARD_BEST:
1055 race_speedaward_alltimebest = ReadShort();
1056 race_speedaward_alltimebest_holder = strzone(ReadString());
1061 void Net_ReadSpawn()
1064 current_viewzoom = 0.6;
1067 void Net_TeamNagger()
1072 void Net_ReadPingPLReport()
1074 float e, pi, pl, ml;
1079 if not(playerslots[e])
1081 playerslots[e].ping = pi;
1082 playerslots[e].ping_packetloss = pl / 255.0;
1083 playerslots[e].ping_movementloss = ml / 255.0;
1086 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
1087 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
1088 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
1089 float CSQC_Parse_TempEntity()
1091 local float bHandled;
1097 // NOTE: Could just do return instead of break...
1100 case TE_CSQC_PICTURE:
1101 Net_MapVote_Picture();
1109 Net_GrapplingHook();
1116 case TE_CSQC_ZCURVEPARTICLES:
1117 Net_ReadZCurveParticles();
1120 case TE_CSQC_NEXGUNBEAMPARTICLE:
1121 Net_ReadNexgunBeamParticle();
1124 case TE_CSQC_TEAMNAGGER:
1128 case TE_CSQC_LIGHTNINGARC:
1129 Net_ReadLightningarc();
1132 case TE_CSQC_PINGPLREPORT:
1133 Net_ReadPingPLReport();
1137 // No special logic for this temporary entity; return 0 so the engine can handle it
1145 string getcommandkey(string text, string command)
1150 if (!sbar_showbinds)
1153 keys = db_get(binddb, command);
1156 n = tokenize(findkeysforcommand(command)); // uses '...' strings
1157 for(j = 0; j < n; ++j)
1163 keys = keynumtostring(k);
1165 keys = strcat(keys, ", ", keynumtostring(k));
1168 if (sbar_showbinds_limit > 0 && sbar_showbinds_limit >= l) break;
1172 db_put(binddb, command, keys);
1176 if (sbar_showbinds > 1)
1177 return strcat(text, " (not bound)");
1181 else if (sbar_showbinds > 1)
1182 return strcat(text, " (", keys, ")");