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();
138 get_mi_min_max_texcoords(1); // try the CLEVER way first
139 minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
140 shortmapname = mi_shortname;
142 if(precache_pic(minimapname) == "")
144 // but maybe we have a non-clever minimap
145 minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
146 if(precache_pic(minimapname) == "")
147 minimapname = ""; // FAIL
149 get_mi_min_max_texcoords(0); // load new texcoords
152 mi_center = (mi_min + mi_max) * 0.5;
153 mi_scale = mi_max - mi_min;
154 minimapname = strzone(minimapname);
157 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
158 void CSQC_Shutdown(void)
171 db_save(ClientProgsDB, "client.db");
172 db_close(ClientProgsDB);
174 cvar_clientsettemp_restore();
177 cvar_set("chase_active",ftos(chase_active_backup));
181 if not(calledhooks & HOOK_START)
182 localcmd("\n_cl_hook_gamestart nop;");
183 if not(calledhooks & HOOK_END)
184 localcmd("\ncl_hook_gameend;");
189 float SetTeam(entity o, float Team)
203 if(GetTeam(Team, false) == NULL)
205 print("trying to switch to unsupported team ", ftos(Team), "\n");
206 Team = COLOR_SPECTATOR;
219 if(GetTeam(Team, false) == NULL)
221 print("trying to switch to unsupported team ", ftos(Team), "\n");
222 Team = COLOR_SPECTATOR;
227 if(Team == -1) // leave
231 //print("(DISCONNECT) leave team ", ftos(o.team), "\n");
232 tm = GetTeam(o.team, false);
242 //print("(CONNECT) enter team ", ftos(o.team), "\n");
244 tm = GetTeam(Team, true);
249 else if(Team != o.team)
251 //print("(CHANGE) leave team ", ftos(o.team), "\n");
252 tm = GetTeam(o.team, false);
255 //print("(CHANGE) enter team ", ftos(o.team), "\n");
256 tm = GetTeam(Team, true);
264 void Playerchecker_Think()
268 for(i = 0; i < maxclients; ++i)
271 if(GetPlayerName(i) == "")
275 //print("playerchecker: KILL KILL KILL\n");
276 // player disconnected
287 //print("playerchecker: SPAWN SPAWN SPAWN\n");
290 playerslots[i] = e = spawn();
292 //e.gotscores = 0; // we might already have the scores...
293 SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with Sbar_UpdatePlayerTeams
295 Sbar_UpdatePlayerPos(e);
299 self.nextthink = time + 0.2;
306 print(strcat("PostInit\n maxclients = ", ftos(maxclients), "\n"));
307 localcmd(strcat("\nsbar_columns_set ", cvar_string("sbar_columns"), ";\n"));
309 entity playerchecker;
310 playerchecker = spawn();
311 playerchecker.think = Playerchecker_Think;
312 playerchecker.nextthink = time + 0.2;
320 // CSQC_ConsoleCommand : Used to parse commands in the console that have been registered with the "registercmd" function
321 // Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
323 void Cmd_Sbar_SetFields(float);
324 void Cmd_Sbar_Help(float);
325 float CSQC_ConsoleCommand(string strMessage)
329 //argc = tokenize(strMessage);
330 argc = tokenize_console(strMessage);
336 if(strCmd == "+button4") { // zoom
337 // return false, because the message shall be sent to the server anyway (for demos/speccing)
345 } else if(strCmd == "-button4") { // zoom
346 if(ignore_minus_zoom)
353 } else if(strCmd == "+button3") { // secondary
356 } else if(strCmd == "-button3") { // secondary
359 } else if(strCmd == "+showscores") {
360 sb_showscores = true;
362 } else if(strCmd == "-showscores") {
363 sb_showscores = false;
365 } else if(strCmd == "+showaccuracy") {
366 sb_showaccuracy = true;
368 } else if(strCmd == "-showaccuracy") {
369 sb_showaccuracy = false;
374 if(strCmd == "+forward" || strCmd == "-back") {
375 ++camera_direction_x;
377 } else if(strCmd == "-forward" || strCmd == "+back") {
378 --camera_direction_x;
380 } else if(strCmd == "+moveright" || strCmd == "-moveleft") {
381 --camera_direction_y;
383 } else if(strCmd == "-moveright" || strCmd == "+moveleft") {
384 ++camera_direction_y;
386 } else if(strCmd == "+moveup" || strCmd == "-movedown") {
387 ++camera_direction_z;
389 } else if(strCmd == "-moveup" || strCmd == "+movedown") {
390 --camera_direction_z;
392 } else if(strCmd == "+roll_right" || strCmd == "-roll_left") {
395 } else if(strCmd == "+roll_left" || strCmd == "-roll_right") {
404 entity debug_shotorg;
407 self.origin = view_origin + view_forward * self.view_ofs_x + view_right * self.view_ofs_y + view_up * self.view_ofs_z;
408 self.angles = view_angles;
409 self.angles_x = -self.angles_x;
413 void ShotOrg_Draw2D()
415 vector coord2d_topleft, coord2d_topright, coord2d;
419 s = vtos(self.view_ofs);
420 s = substring(s, 1, strlen(s) - 2);
421 if(tokenize_console(s) == 3)
422 s = strcat(argv(0), " ", argv(1), " ", argv(2));
424 coord2d_topleft = project_3d_to_2d(self.origin + view_up * 4 - view_right * 4);
425 coord2d_topright = project_3d_to_2d(self.origin + view_up * 4 + view_right * 4);
427 fs = '1 1 0' * ((coord2d_topright_x - coord2d_topleft_x) / stringwidth(s, FALSE));
429 coord2d = coord2d_topleft;
432 coord2d_x += (coord2d_topright_x - coord2d_topleft_x) * (1 - 8 / fs_x) * 0.5;
437 drawstring(coord2d, s, fs, '1 1 1', 1, 0);
442 debug_shotorg = spawn();
443 debug_shotorg.draw = ShotOrg_Draw;
444 debug_shotorg.draw2d = ShotOrg_Draw2D;
445 debug_shotorg.renderflags = RF_VIEWMODEL;
446 debug_shotorg.effects = EF_FULLBRIGHT;
447 precache_model("models/shotorg_adjuster.md3");
448 setmodel(debug_shotorg, "models/shotorg_adjuster.md3");
449 debug_shotorg.scale = 2;
450 debug_shotorg.view_ofs = '25 8 -8';
453 void GameCommand(string msg)
456 argc = tokenize_console(msg);
458 if(argv(0) == "help" || argc == 0)
460 print("Usage: cl_cmd COMMAND..., where possible commands are:\n");
461 print(" settemp cvar value\n");
463 print(" sbar_columns_set ...\n");
464 print(" sbar_columns_help\n");
465 GameCommand_Generic("help");
469 if(GameCommand_Generic(msg))
474 if(cmd == "mv_download") {
475 Cmd_MapVote_MapDownload(argc);
477 else if(cmd == "settemp") {
478 cvar_clientsettemp(argv(1), argv(2));
480 else if(cmd == "radar") {
481 ons_showmap = !ons_showmap;
483 else if(cmd == "sbar_columns_set") {
484 Cmd_Sbar_SetFields(argc);
486 else if(cmd == "sbar_columns_help") {
490 else if(cmd == "blurtest") {
491 blurtest_time0 = time;
492 blurtest_time1 = time + stof(argv(1));
493 blurtest_radius = stof(argv(2));
494 blurtest_power = stof(argv(3));
497 else if(cmd == "shotorg_move") {
501 debug_shotorg.view_ofs = debug_shotorg.view_ofs + stov(argv(1));
502 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
504 else if(cmd == "shotorg_movez") {
508 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
509 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
511 else if(cmd == "shotorg_set") {
515 debug_shotorg.view_ofs = stov(argv(1));
516 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
518 else if(cmd == "shotorg_setz") {
522 debug_shotorg.view_ofs = debug_shotorg.view_ofs * (stof(argv(1)) / debug_shotorg.view_ofs_x); // closer/farther, same xy pos
523 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
525 else if(cmd == "shotorg_toggle_hide") {
528 debug_shotorg.cnt = !debug_shotorg.cnt;
531 else if(cmd == "shotorg_end") {
534 print(vtos(debug_shotorg.view_ofs), "\n");
535 remove(debug_shotorg);
536 debug_shotorg = world;
538 localcmd("sv_cmd debug_shotorg\n");
542 print("Invalid command. For a list of supported commands, try cl_cmd help.\n");
548 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
549 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
550 // All keys are in ascii.
551 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
552 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
553 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
554 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
556 local float bSkipKey;
560 if(menu_action(bInputType, nPrimary, nSecondary))
565 // END REQUIRED CSQC FUNCTIONS
566 // --------------------------------------------------------------------------
568 // --------------------------------------------------------------------------
569 // BEGIN OPTIONAL CSQC FUNCTIONS
572 InterpolateOrigin_Undo();
574 self.classname = "entcs_receiver";
575 self.sv_entnum = ReadByte() - 1;
576 self.origin_x = ReadShort();
577 self.origin_y = ReadShort();
578 self.origin_z = ReadShort();
579 self.angles_y = ReadByte() * 360.0 / 256;
580 self.origin_z = self.angles_x = self.angles_z = 0;
582 InterpolateOrigin_Note();
587 void Ent_RemovePlayerScore()
593 SetTeam(self.owner, -1);
594 self.owner.gotscores = 0;
595 for(i = 0; i < MAX_SCORE; ++i)
596 self.owner.(scores[i]) = 0; // clear all scores
600 void Ent_ReadPlayerScore()
606 // damnit -.- don't want to go change every single .sv_entnum in sbar.qc AGAIN
607 // (no I've never heard of M-x replace-string, sed, or anything like that)
608 isNew = !self.owner; // workaround for DP bug
611 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
612 if(!isNew && n != self.sv_entnum)
614 print("A CSQC entity changed its owner!\n");
617 self.enttype = ENT_CLIENT_SCORES;
623 if not(playerslots[self.sv_entnum])
624 playerslots[self.sv_entnum] = spawn();
625 o = self.owner = playerslots[self.sv_entnum];
626 o.sv_entnum = self.sv_entnum;
629 //if not(o.sort_prev)
630 // RegisterPlayer(o);
631 //playerchecker will do this for us later, if it has not already done so
642 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
646 o.(scores[i]) = ReadInt24_t();
648 o.(scores[i]) = ReadChar();
652 Sbar_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
654 self.entremove = Ent_RemovePlayerScore;
657 void Ent_ReadTeamScore()
662 self.team = ReadByte();
663 o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
666 #if MAX_TEAMSCORE <= 8
674 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
678 o.(teamscores[i]) = ReadInt24_t();
680 o.(teamscores[i]) = ReadChar();
683 Sbar_UpdateTeamPos(o);
690 void Ent_ClientData()
693 float newspectatee_status;
697 sb_showscores_force = (f & 1);
701 newspectatee_status = ReadByte();
702 if(newspectatee_status == player_localentnum)
703 newspectatee_status = -1; // observing
706 newspectatee_status = 0;
708 spectatorbutton_zoom = (f & 4);
712 angles_held_status = 1;
713 angles_held_x = ReadAngle();
714 angles_held_y = ReadAngle();
718 angles_held_status = 0;
720 if(newspectatee_status != spectatee_status)
724 race_checkpointtime = 0;
726 spectatee_status = newspectatee_status;
731 float nags, i, j, b, f;
738 strunzone(vote_called_vote);
739 vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
744 for(j = 0; j < maxclients; ++j)
746 playerslots[j].ready = 1;
747 for(i = 1; i <= maxclients; i += 8)
750 for(j = i-1, b = 1; b < 256; b *= 2, ++j)
753 playerslots[j].ready = 0;
757 ready_waiting = (nags & 1);
758 ready_waiting_for_me = (nags & 2);
759 vote_waiting = (nags & 4);
760 vote_waiting_for_me = (nags & 8);
761 warmup_stage = (nags & 16);
764 void Ent_RandomSeed()
772 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
773 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
774 void Ent_RadarLink();
776 void Ent_ScoresInfo();
777 void(float bIsNewEntity) CSQC_Ent_Update =
783 // set up the "time" global for received entities to be correct for interpolation purposes
791 serverprevtime = time;
792 serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
793 time = serverprevtime + serverdeltatime;
796 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
798 if(t != self.enttype)
800 print("A CSQC entity changed its type!\n");
808 case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
809 case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
810 case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
811 case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
812 case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
813 case ENT_CLIENT_LASER: Ent_Laser(); break;
814 case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
815 case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
816 case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
817 case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
818 case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
819 case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
820 case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
821 case ENT_CLIENT_INIT: Ent_Init(); break;
822 case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
823 case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
824 case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
825 case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
826 case ENT_CLIENT_WALL: Ent_Wall(); break;
827 case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
829 error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
835 // Destructor, but does NOT deallocate the entity by calling remove(). Also
836 // used when an entity changes its type. For an entity that someone interacts
837 // with others, make sure it can no longer do so.
845 self.draw = menu_sub_null;
846 self.entremove = menu_sub_null;
847 // TODO possibly set more stuff to defaults
849 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
850 void CSQC_Ent_Remove()
859 if(gametype == GAME_ONSLAUGHT) {
860 print(strcat("Using ", minimapname, " as minimap.\n"));
861 precache_pic("gfx/ons-cp-neutral.tga");
862 precache_pic("gfx/ons-cp-red.tga");
863 precache_pic("gfx/ons-cp-blue.tga");
864 precache_pic("gfx/ons-frame.tga");
865 precache_pic("gfx/ons-frame-team.tga");
866 } else if(gametype == GAME_KEYHUNT) {
867 precache_pic("gfx/sb_key_carrying");
868 precache_pic("gfx/sb_key_carrying_outline");
873 localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";");
874 calledhooks |= HOOK_START;
877 // 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.
878 void CSQC_Parse_StuffCmd(string strMessage)
880 localcmd(strMessage);
882 // 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.
883 void CSQC_Parse_Print(string strMessage)
885 print(ColorTranslateRGB(strMessage));
888 // CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
889 void CSQC_Parse_CenterPrint(string strMessage)
891 centerprint(strMessage);
896 // TODO somehow thwart prvm_globalset client ...
899 localcmd(strcat("\nfog ", forcefog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
902 void Gamemode_Init();
903 void Ent_ScoresInfo()
906 self.classname = "ent_client_scores_info";
907 gametype = ReadByte();
908 for(i = 0; i < MAX_SCORE; ++i)
910 scores_label[i] = strzone(ReadString());
911 scores_flags[i] = ReadByte();
913 for(i = 0; i < MAX_TEAMSCORE; ++i)
915 teamscores_label[i] = strzone(ReadString());
916 teamscores_flags[i] = ReadByte();
925 self.classname = "ent_client_init";
927 nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
929 for(i = 0; i < 24; ++i)
930 weaponimpulse[i] = ReadByte() - 1;
931 hook_shotorigin_x = ReadCoord();
932 hook_shotorigin_y = ReadCoord();
933 hook_shotorigin_z = ReadCoord();
937 forcefog = strzone(ReadString());
939 armorblockpercent = ReadByte() / 255.0;
953 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
954 race_checkpoint = ReadByte();
955 race_time = ReadInt24_t();
956 race_previousbesttime = ReadInt24_t();
957 if(race_previousbestname)
958 strunzone(race_previousbestname);
959 race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
961 race_checkpointtime = time;
963 if(race_checkpoint == 0 || race_checkpoint == 254)
965 race_penaltyaccumulator = 0;
966 race_laptime = time; // valid
971 case RACE_NET_CHECKPOINT_CLEAR:
973 race_checkpointtime = 0;
976 case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
977 race_laptime = ReadCoord();
978 race_checkpointtime = -99999;
980 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
981 race_nextcheckpoint = ReadByte();
983 race_nextbesttime = ReadInt24_t();
984 if(race_nextbestname)
985 strunzone(race_nextbestname);
986 race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
989 case RACE_NET_CHECKPOINT_HIT_RACE:
990 race_mycheckpoint = ReadByte();
991 race_mycheckpointtime = time;
992 race_mycheckpointdelta = ReadInt24_t();
993 race_mycheckpointlapsdelta = ReadByte();
994 if(race_mycheckpointlapsdelta >= 128)
995 race_mycheckpointlapsdelta -= 256;
996 if(race_mycheckpointenemy)
997 strunzone(race_mycheckpointenemy);
998 race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
1001 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
1002 race_othercheckpoint = ReadByte();
1003 race_othercheckpointtime = time;
1004 race_othercheckpointdelta = ReadInt24_t();
1005 race_othercheckpointlapsdelta = ReadByte();
1006 if(race_othercheckpointlapsdelta >= 128)
1007 race_othercheckpointlapsdelta -= 256;
1008 if(race_othercheckpointenemy)
1009 strunzone(race_othercheckpointenemy);
1010 race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
1013 case RACE_NET_PENALTY_RACE:
1014 race_penaltyeventtime = time;
1015 race_penaltytime = ReadShort();
1016 //race_penaltyaccumulator += race_penaltytime;
1017 if(race_penaltyreason)
1018 strunzone(race_penaltyreason);
1019 race_penaltyreason = strzone(ReadString());
1022 case RACE_NET_PENALTY_QUALIFYING:
1023 race_penaltyeventtime = time;
1024 race_penaltytime = ReadShort();
1025 race_penaltyaccumulator += race_penaltytime;
1026 if(race_penaltyreason)
1027 strunzone(race_penaltyreason);
1028 race_penaltyreason = strzone(ReadString());
1031 case RACE_NET_SERVER_RECORD:
1032 race_server_record = ReadInt24_t();
1034 case RACE_NET_SPEED_AWARD:
1035 race_speed_award = ReadShort();
1036 race_speed_award_holder = strzone(ReadString());
1041 void Net_ReadSpawn()
1044 current_viewzoom = 0.6;
1047 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
1048 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
1049 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
1050 float CSQC_Parse_TempEntity()
1052 local float bHandled;
1058 // NOTE: Could just do return instead of break...
1061 case TE_CSQC_PICTURE:
1062 Net_MapVote_Picture();
1070 Net_GrapplingHook();
1077 case TE_CSQC_ZCURVEPARTICLES:
1078 Net_ReadZCurveParticles();
1081 case TE_CSQC_NEXGUNBEAMPARTICLE:
1082 Net_ReadNexgunBeamParticle();
1085 case TE_CSQC_LIGHTNINGARC:
1086 Net_ReadLightningarc();
1090 // No special logic for this temporary entity; return 0 so the engine can handle it
1098 string getcommandkey(string text, string command)
1103 if (!sbar_showbinds)
1106 keys = db_get(binddb, command);
1109 n = tokenize(findkeysforcommand(command)); // uses '...' strings
1110 for(j = 0; j < n; ++j)
1116 keys = keynumtostring(k);
1118 keys = strcat(keys, ", ", keynumtostring(k));
1121 if (sbar_showbinds_limit > 0 && sbar_showbinds_limit >= l) break;
1125 db_put(binddb, command, keys);
1129 if (sbar_showbinds > 1)
1130 return strcat(text, " (not bound)");
1134 else if (sbar_showbinds > 1)
1135 return strcat(text, " (", keys, ")");