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 compressShortVector_init();
72 menu_show = menu_show_error;
73 menu_action = menu_sub_null;
75 for(i = 0; i < 255; ++i)
76 if(getplayerkey(i, "viewentity") == "")
81 // localcmd("alias order \"cmd order $*\""); enable if ctf-command thingy is used
82 //registercmd("ctf_menu");
83 registercmd("ons_map");
84 //registercmd("menu_action");
86 registercmd("+button3");
87 registercmd("-button3");
88 registercmd("+button4");
89 registercmd("-button4");
90 registercmd("+showaccuracy");registercmd("-showaccuracy");
96 registercmd("+forward");registercmd("-forward");
97 registercmd("+back");registercmd("-back");
98 registercmd("+moveup");registercmd("-moveup");
99 registercmd("+movedown");registercmd("-movedown");
100 registercmd("+moveright");registercmd("-moveright");
101 registercmd("+moveleft");registercmd("-moveleft");
102 registercmd("+roll_right");registercmd("-roll_right");
103 registercmd("+roll_left");registercmd("-roll_left");
107 registercvar("sbar_usecsqc", "1");
108 registercvar("sbar_columns", "default", CVAR_SAVE);
112 // sbar_fields uses strunzone on the titles!
113 for(i = 0; i < MAX_SBAR_FIELDS; ++i)
114 sbar_title[i] = strzone("(null)");
120 teams = Sort_Spawn();
121 players = Sort_Spawn();
123 GetTeam(COLOR_SPECTATOR, true); // add specs first
125 cvar_clientsettemp("_supports_weaponpriority", "1");
129 WaypointSprite_Load();
131 Projectile_Precache();
132 GibSplash_Precache();
134 DamageInfo_Precache();
135 Announcer_Precache();
137 get_mi_min_max_texcoords(1); // try the CLEVER way first
138 minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
139 shortmapname = mi_shortname;
141 if(precache_pic(minimapname) == "")
143 // but maybe we have a non-clever minimap
144 minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
145 if(precache_pic(minimapname) == "")
146 minimapname = ""; // FAIL
148 get_mi_min_max_texcoords(0); // load new texcoords
151 mi_center = (mi_min + mi_max) * 0.5;
152 mi_scale = mi_max - mi_min;
153 minimapname = strzone(minimapname);
156 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
157 void CSQC_Shutdown(void)
171 cvar_clientsettemp_restore();
174 cvar_set("chase_active",ftos(chase_active_backup));
178 if not(calledhooks & HOOK_START)
179 localcmd("\n_cl_hook_gamestart nop;");
180 if not(calledhooks & HOOK_END)
181 localcmd("\ncl_hook_gameend;");
186 float SetTeam(entity o, float Team)
200 if(GetTeam(Team, false) == NULL)
202 print("trying to switch to unsupported team ", ftos(Team), "\n");
203 Team = COLOR_SPECTATOR;
216 if(GetTeam(Team, false) == NULL)
218 print("trying to switch to unsupported team ", ftos(Team), "\n");
219 Team = COLOR_SPECTATOR;
224 if(Team == -1) // leave
228 //print("(DISCONNECT) leave team ", ftos(o.team), "\n");
229 tm = GetTeam(o.team, false);
239 //print("(CONNECT) enter team ", ftos(o.team), "\n");
241 tm = GetTeam(Team, true);
246 else if(Team != o.team)
248 //print("(CHANGE) leave team ", ftos(o.team), "\n");
249 tm = GetTeam(o.team, false);
252 //print("(CHANGE) enter team ", ftos(o.team), "\n");
253 tm = GetTeam(Team, true);
261 void Playerchecker_Think()
265 for(i = 0; i < maxclients; ++i)
268 if(GetPlayerName(i) == "")
272 //print("playerchecker: KILL KILL KILL\n");
273 // player disconnected
284 //print("playerchecker: SPAWN SPAWN SPAWN\n");
287 playerslots[i] = e = spawn();
289 //e.gotscores = 0; // we might already have the scores...
290 SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with Sbar_UpdatePlayerTeams
292 Sbar_UpdatePlayerPos(e);
296 self.nextthink = time + 0.2;
303 print(strcat("PostInit\n maxclients = ", ftos(maxclients), "\n"));
304 localcmd(strcat("\nsbar_columns_set ", cvar_string("sbar_columns"), ";\n"));
306 entity playerchecker;
307 playerchecker = spawn();
308 playerchecker.think = Playerchecker_Think;
309 playerchecker.nextthink = time + 0.2;
317 // CSQC_ConsoleCommand : Used to parse commands in the console that have been registered with the "registercmd" function
318 // Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
320 void Cmd_Sbar_SetFields(float);
321 void Cmd_Sbar_Help(float);
322 float CSQC_ConsoleCommand(string strMessage)
326 //argc = tokenize(strMessage);
327 argc = tokenize_console(strMessage);
333 if(strCmd == "+button4") { // zoom
334 // return false, because the message shall be sent to the server anyway (for demos/speccing)
342 } else if(strCmd == "-button4") { // zoom
343 if(ignore_minus_zoom)
350 } else if(strCmd == "+button3") { // secondary
353 } else if(strCmd == "-button3") { // secondary
356 } else if(strCmd == "+showscores") {
357 sb_showscores = true;
359 } else if(strCmd == "-showscores") {
360 sb_showscores = false;
362 } else if(strCmd == "+showaccuracy") {
363 sb_showaccuracy = true;
365 } else if(strCmd == "-showaccuracy") {
366 sb_showaccuracy = false;
371 if(strCmd == "+forward" || strCmd == "-back") {
372 ++camera_direction_x;
374 } else if(strCmd == "-forward" || strCmd == "+back") {
375 --camera_direction_x;
377 } else if(strCmd == "+moveright" || strCmd == "-moveleft") {
378 --camera_direction_y;
380 } else if(strCmd == "-moveright" || strCmd == "+moveleft") {
381 ++camera_direction_y;
383 } else if(strCmd == "+moveup" || strCmd == "-movedown") {
384 ++camera_direction_z;
386 } else if(strCmd == "-moveup" || strCmd == "+movedown") {
387 --camera_direction_z;
389 } else if(strCmd == "+roll_right" || strCmd == "-roll_left") {
392 } else if(strCmd == "+roll_left" || strCmd == "-roll_right") {
401 entity debug_shotorg;
404 self.origin = view_origin + view_forward * self.view_ofs_x + view_right * self.view_ofs_y + view_up * self.view_ofs_z;
405 self.angles = view_angles;
406 self.angles_x = -self.angles_x;
410 void ShotOrg_Draw2D()
412 vector coord2d_topleft, coord2d_topright, coord2d;
416 s = vtos(self.view_ofs);
417 s = substring(s, 1, strlen(s) - 2);
418 if(tokenize_console(s) == 3)
419 s = strcat(argv(0), " ", argv(1), " ", argv(2));
421 coord2d_topleft = project_3d_to_2d(self.origin + view_up * 4 - view_right * 4);
422 coord2d_topright = project_3d_to_2d(self.origin + view_up * 4 + view_right * 4);
424 fs = '1 1 0' * ((coord2d_topright_x - coord2d_topleft_x) / stringwidth(s, FALSE));
426 coord2d = coord2d_topleft;
429 coord2d_x += (coord2d_topright_x - coord2d_topleft_x) * (1 - 8 / fs_x) * 0.5;
434 drawstring(coord2d, s, fs, '1 1 1', 1, 0);
439 debug_shotorg = spawn();
440 debug_shotorg.draw = ShotOrg_Draw;
441 debug_shotorg.draw2d = ShotOrg_Draw2D;
442 debug_shotorg.renderflags = RF_VIEWMODEL;
443 debug_shotorg.effects = EF_FULLBRIGHT;
444 precache_model("models/shotorg_adjuster.md3");
445 setmodel(debug_shotorg, "models/shotorg_adjuster.md3");
446 debug_shotorg.scale = 2;
447 debug_shotorg.view_ofs = '25 8 -8';
450 void GameCommand(string msg)
453 argc = tokenize_console(msg);
455 if(argv(0) == "help" || argc == 0)
457 print("Usage: cl_cmd COMMAND..., where possible commands are:\n");
458 print(" settemp cvar value\n");
460 print(" sbar_columns_set ...\n");
461 print(" sbar_columns_help\n");
462 GameCommand_Generic("help");
466 if(GameCommand_Generic(msg))
471 if(cmd == "mv_download") {
472 Cmd_MapVote_MapDownload(argc);
474 else if(cmd == "settemp") {
475 cvar_clientsettemp(argv(1), argv(2));
477 else if(cmd == "radar") {
478 ons_showmap = !ons_showmap;
480 else if(cmd == "sbar_columns_set") {
481 Cmd_Sbar_SetFields(argc);
483 else if(cmd == "sbar_columns_help") {
487 else if(cmd == "blurtest") {
488 blurtest_time0 = time;
489 blurtest_time1 = time + stof(argv(1));
490 blurtest_radius = stof(argv(2));
491 blurtest_power = stof(argv(3));
494 else if(cmd == "shotorg_move") {
498 debug_shotorg.view_ofs = debug_shotorg.view_ofs + stov(argv(1));
499 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
501 else if(cmd == "shotorg_movez") {
505 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
506 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
508 else if(cmd == "shotorg_set") {
512 debug_shotorg.view_ofs = stov(argv(1));
513 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
515 else if(cmd == "shotorg_setz") {
519 debug_shotorg.view_ofs = debug_shotorg.view_ofs * (stof(argv(1)) / debug_shotorg.view_ofs_x); // closer/farther, same xy pos
520 localcmd("sv_cmd debug_shotorg \"", vtos(debug_shotorg.view_ofs), "\"\n");
522 else if(cmd == "shotorg_toggle_hide") {
525 debug_shotorg.cnt = !debug_shotorg.cnt;
528 else if(cmd == "shotorg_end") {
531 print(vtos(debug_shotorg.view_ofs), "\n");
532 remove(debug_shotorg);
533 debug_shotorg = world;
535 localcmd("sv_cmd debug_shotorg\n");
539 print("Invalid command. For a list of supported commands, try cl_cmd help.\n");
545 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
546 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
547 // All keys are in ascii.
548 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
549 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
550 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
551 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
553 local float bSkipKey;
557 if(menu_action(bInputType, nPrimary, nSecondary))
562 // END REQUIRED CSQC FUNCTIONS
563 // --------------------------------------------------------------------------
565 // --------------------------------------------------------------------------
566 // BEGIN OPTIONAL CSQC FUNCTIONS
569 InterpolateOrigin_Undo();
571 self.classname = "entcs_receiver";
572 self.sv_entnum = ReadByte() - 1;
573 self.origin_x = ReadShort();
574 self.origin_y = ReadShort();
575 self.origin_z = ReadShort();
576 self.angles_y = ReadByte() * 360.0 / 256;
577 self.origin_z = self.angles_x = self.angles_z = 0;
579 InterpolateOrigin_Note();
584 void Ent_RemovePlayerScore()
590 SetTeam(self.owner, -1);
591 self.owner.gotscores = 0;
592 for(i = 0; i < MAX_SCORE; ++i)
593 self.owner.(scores[i]) = 0; // clear all scores
597 void Ent_ReadPlayerScore()
603 // damnit -.- don't want to go change every single .sv_entnum in sbar.qc AGAIN
604 // (no I've never heard of M-x replace-string, sed, or anything like that)
605 isNew = !self.owner; // workaround for DP bug
608 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
609 if(!isNew && n != self.sv_entnum)
611 print("A CSQC entity changed its owner!\n");
614 self.enttype = ENT_CLIENT_SCORES;
620 if not(playerslots[self.sv_entnum])
621 playerslots[self.sv_entnum] = spawn();
622 o = self.owner = playerslots[self.sv_entnum];
623 o.sv_entnum = self.sv_entnum;
626 //if not(o.sort_prev)
627 // RegisterPlayer(o);
628 //playerchecker will do this for us later, if it has not already done so
639 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
643 o.(scores[i]) = ReadInt24_t();
645 o.(scores[i]) = ReadChar();
649 Sbar_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
651 self.entremove = Ent_RemovePlayerScore;
654 void Ent_ReadTeamScore()
659 self.team = ReadByte();
660 o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
663 #if MAX_TEAMSCORE <= 8
671 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
675 o.(teamscores[i]) = ReadInt24_t();
677 o.(teamscores[i]) = ReadChar();
680 Sbar_UpdateTeamPos(o);
687 void Ent_ClientData()
690 float newspectatee_status;
694 sb_showscores_force = (f & 1);
698 newspectatee_status = ReadByte();
699 if(newspectatee_status == player_localentnum)
700 newspectatee_status = -1; // observing
703 newspectatee_status = 0;
705 spectatorbutton_zoom = (f & 4);
709 angles_held_status = 1;
710 angles_held_x = ReadAngle();
711 angles_held_y = ReadAngle();
715 angles_held_status = 0;
717 if(newspectatee_status != spectatee_status)
721 race_checkpointtime = 0;
723 spectatee_status = newspectatee_status;
728 float nags, i, j, b, f;
735 strunzone(vote_called_vote);
736 vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
741 for(j = 0; j < maxclients; ++j)
743 playerslots[j].ready = 1;
744 for(i = 1; i <= maxclients; i += 8)
747 for(j = i-1, b = 1; b < 256; b *= 2, ++j)
750 playerslots[j].ready = 0;
754 ready_waiting = (nags & 1);
755 ready_waiting_for_me = (nags & 2);
756 vote_waiting = (nags & 4);
757 vote_waiting_for_me = (nags & 8);
758 warmup_stage = (nags & 16);
761 void Ent_RandomSeed()
769 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
770 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
771 void Ent_RadarLink();
773 void Ent_ScoresInfo();
774 void(float bIsNewEntity) CSQC_Ent_Update =
780 // set up the "time" global for received entities to be correct for interpolation purposes
788 serverprevtime = time;
789 serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
790 time = serverprevtime + serverdeltatime;
793 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
795 if(t != self.enttype)
797 print("A CSQC entity changed its type!\n");
804 case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
805 case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
806 case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
807 case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
808 case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
809 case ENT_CLIENT_LASER: Ent_Laser(); break;
810 case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
811 case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
812 case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
813 case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
814 case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(); break;
815 case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(); break;
816 case ENT_CLIENT_CASING: Ent_Casing(); break;
817 case ENT_CLIENT_INIT: Ent_Init(); break;
818 case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
819 case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
820 case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
821 case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
822 case ENT_CLIENT_WALL: Ent_Wall(); break;
823 case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(); break;
825 error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
831 // Destructor, but does NOT deallocate the entity by calling remove(). Also
832 // used when an entity changes its type. For an entity that someone interacts
833 // with others, make sure it can no longer do so.
841 self.draw = menu_sub_null;
842 self.entremove = menu_sub_null;
843 // TODO possibly set more stuff to defaults
845 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
846 void CSQC_Ent_Remove()
855 if(gametype == GAME_ONSLAUGHT) {
856 print(strcat("Using ", minimapname, " as minimap.\n"));
857 precache_pic("gfx/ons-cp-neutral.tga");
858 precache_pic("gfx/ons-cp-red.tga");
859 precache_pic("gfx/ons-cp-blue.tga");
860 precache_pic("gfx/ons-frame.tga");
861 precache_pic("gfx/ons-frame-team.tga");
862 } else if(gametype == GAME_KEYHUNT) {
863 precache_pic("gfx/sb_key_carrying");
864 precache_pic("gfx/sb_key_carrying_outline");
869 localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";");
870 calledhooks |= HOOK_START;
873 // 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.
874 void CSQC_Parse_StuffCmd(string strMessage)
876 localcmd(strMessage);
878 // 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.
879 void CSQC_Parse_Print(string strMessage)
881 print(ColorTranslateRGB(strMessage));
884 // CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
885 void CSQC_Parse_CenterPrint(string strMessage)
887 centerprint(strMessage);
892 // TODO somehow thwart prvm_globalset client ...
895 localcmd(strcat("\nfog ", forcefog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
898 void Gamemode_Init();
899 void Ent_ScoresInfo()
902 self.classname = "ent_client_scores_info";
903 gametype = ReadByte();
904 for(i = 0; i < MAX_SCORE; ++i)
906 scores_label[i] = strzone(ReadString());
907 scores_flags[i] = ReadByte();
909 for(i = 0; i < MAX_TEAMSCORE; ++i)
911 teamscores_label[i] = strzone(ReadString());
912 teamscores_flags[i] = ReadByte();
921 self.classname = "ent_client_init";
923 nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
925 for(i = 0; i < 24; ++i)
926 weaponimpulse[i] = ReadByte() - 1;
927 hook_shotorigin_x = ReadCoord();
928 hook_shotorigin_y = ReadCoord();
929 hook_shotorigin_z = ReadCoord();
933 forcefog = strzone(ReadString());
935 armorblockpercent = ReadByte() / 255.0;
949 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
950 race_checkpoint = ReadByte();
951 race_time = ReadInt24_t();
952 race_previousbesttime = ReadInt24_t();
953 if(race_previousbestname)
954 strunzone(race_previousbestname);
955 race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
957 race_checkpointtime = time;
959 if(race_checkpoint == 0 || race_checkpoint == 254)
961 race_penaltyaccumulator = 0;
962 race_laptime = time; // valid
967 case RACE_NET_CHECKPOINT_CLEAR:
969 race_checkpointtime = 0;
972 case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
973 race_laptime = ReadCoord();
974 race_checkpointtime = -99999;
976 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
977 race_nextcheckpoint = ReadByte();
979 race_nextbesttime = ReadInt24_t();
980 if(race_nextbestname)
981 strunzone(race_nextbestname);
982 race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
985 case RACE_NET_CHECKPOINT_HIT_RACE:
986 race_mycheckpoint = ReadByte();
987 race_mycheckpointtime = time;
988 race_mycheckpointdelta = ReadInt24_t();
989 race_mycheckpointlapsdelta = ReadByte();
990 if(race_mycheckpointlapsdelta >= 128)
991 race_mycheckpointlapsdelta -= 256;
992 if(race_mycheckpointenemy)
993 strunzone(race_mycheckpointenemy);
994 race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
997 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
998 race_othercheckpoint = ReadByte();
999 race_othercheckpointtime = time;
1000 race_othercheckpointdelta = ReadInt24_t();
1001 race_othercheckpointlapsdelta = ReadByte();
1002 if(race_othercheckpointlapsdelta >= 128)
1003 race_othercheckpointlapsdelta -= 256;
1004 if(race_othercheckpointenemy)
1005 strunzone(race_othercheckpointenemy);
1006 race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
1009 case RACE_NET_PENALTY_RACE:
1010 race_penaltyeventtime = time;
1011 race_penaltytime = ReadShort();
1012 //race_penaltyaccumulator += race_penaltytime;
1013 if(race_penaltyreason)
1014 strunzone(race_penaltyreason);
1015 race_penaltyreason = strzone(ReadString());
1018 case RACE_NET_PENALTY_QUALIFYING:
1019 race_penaltyeventtime = time;
1020 race_penaltytime = ReadShort();
1021 race_penaltyaccumulator += race_penaltytime;
1022 if(race_penaltyreason)
1023 strunzone(race_penaltyreason);
1024 race_penaltyreason = strzone(ReadString());
1029 void Net_ReadSpawn()
1032 current_viewzoom = 0.6;
1035 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
1036 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
1037 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
1038 float CSQC_Parse_TempEntity()
1040 local float bHandled;
1046 // NOTE: Could just do return instead of break...
1049 case TE_CSQC_PICTURE:
1050 Net_MapVote_Picture();
1058 Net_GrapplingHook();
1065 case TE_CSQC_ZCURVEPARTICLES:
1066 Net_ReadZCurveParticles();
1069 case TE_CSQC_NEXGUNBEAMPARTICLE:
1070 Net_ReadNexgunBeamParticle();
1073 case TE_CSQC_LIGHTNINGARC:
1074 Net_ReadLightningarc();
1078 // No special logic for this temporary entity; return 0 so the engine can handle it
1086 string getcommandkey(string text, string command)
1091 if (!sbar_showbinds)
1094 keys = db_get(binddb, command);
1097 n = tokenize(findkeysforcommand(command)); // uses '...' strings
1098 for(j = 0; j < n; ++j)
1104 keys = keynumtostring(k);
1106 keys = strcat(keys, ", ", keynumtostring(k));
1109 if (sbar_showbinds_limit > 0 && sbar_showbinds_limit >= l) break;
1113 db_put(binddb, command, keys);
1117 if (sbar_showbinds > 1)
1118 return strcat(text, " (not bound)");
1122 else if (sbar_showbinds > 1)
1123 return strcat(text, " (", keys, ")");