1 // --------------------------------------------------------------------------
2 // BEGIN REQUIRED CSQC FUNCTIONS
5 #define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
8 drawstring('0 200 0', _("ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!"), '8 8 0', '1 0 0', 1, 0);
11 // CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)
12 // Useful for precaching things
23 void WaypointSprite_Load();
24 void ConsoleCommand_macro_init();
27 prvm_language = cvar_string("prvm_language");
31 __engine_check = checkextension("DP_SV_WRITEPICTURE");
34 print(_("^3Your engine build is outdated\n^3This Server uses a newer QC VM. Please update!\n"));
35 localcmd("\ndisconnect\n");
41 check_unacceptable_compiler_bugs();
44 print(sprintf(_("^4CSQC Build information: ^1%s\n"), WATERMARK()));
49 #ifdef COMPAT_XON050_ENGINE
50 // old engine lacks implementation of player_localnum
51 player_localnum = player_localentnum - 1;
56 ClientProgsDB = db_load("client.db");
57 compressShortVector_init();
59 drawfont = FONT_USER+1;
61 menu_show = menu_show_error;
62 menu_action = menu_sub_null;
64 for(i = 0; i < 255; ++i)
65 if(getplayerkeyvalue(i, "viewentity") == "")
69 //registercommand("hud_configure");
70 //registercommand("hud_save");
71 //registercommand("menu_action");
73 ConsoleCommand_macro_init();
75 registercvar("hud_usecsqc", "1");
76 registercvar("scoreboard_columns", "default");
80 // hud_fields uses strunzone on the titles!
81 for(i = 0; i < MAX_HUD_FIELDS; ++i)
82 hud_title[i] = strzone("(null)");
89 players = Sort_Spawn();
91 GetTeam(COLOR_SPECTATOR, true); // add specs first
95 WaypointSprite_Load();
98 precache_model("null");
99 precache_sound("misc/hit.wav");
100 precache_sound("misc/typehit.wav");
101 Projectile_Precache();
103 GibSplash_Precache();
105 DamageInfo_Precache();
108 Announcer_Precache();
111 if(autocvar_cl_reticle)
113 if(autocvar_cl_reticle_item_normal) { precache_pic("gfx/reticle_normal"); }
114 if(autocvar_cl_reticle_item_nex) { precache_pic("gfx/reticle_nex"); }
117 get_mi_min_max_texcoords(1); // try the CLEVER way first
118 minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
119 shortmapname = mi_shortname;
121 if(precache_pic(minimapname) == "")
123 // but maybe we have a non-clever minimap
124 minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
125 if(precache_pic(minimapname) == "")
126 minimapname = ""; // FAIL
128 get_mi_min_max_texcoords(0); // load new texcoords
131 mi_center = (mi_min + mi_max) * 0.5;
132 mi_scale = mi_max - mi_min;
133 minimapname = strzone(minimapname);
137 hud_configure_prev = -1;
141 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
142 float cvar_clientsettemp_restore();
143 void CSQC_Shutdown(void)
158 if(autocvar_cl_db_saveasdump)
159 db_dump(ClientProgsDB, "client.db");
161 db_save(ClientProgsDB, "client.db");
162 db_close(ClientProgsDB);
164 cvar_clientsettemp_restore();
167 cvar_set("chase_active",ftos(chase_active_backup));
169 // unset the event chasecam's chase_active
170 if(autocvar_chase_active < 0)
171 cvar_set("chase_active", "0");
175 if not(calledhooks & HOOK_START)
176 localcmd("\n_cl_hook_gamestart nop\n");
177 if not(calledhooks & HOOK_END)
178 localcmd("\ncl_hook_gameend\n");
183 float SetTeam(entity o, float Team)
197 if(GetTeam(Team, false) == world)
199 print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
200 Team = COLOR_SPECTATOR;
213 if(GetTeam(Team, false) == world)
215 print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
216 Team = COLOR_SPECTATOR;
221 if(Team == -1) // leave
225 tm = GetTeam(o.team, false);
236 tm = GetTeam(Team, true);
241 else if(Team != o.team)
243 tm = GetTeam(o.team, false);
246 tm = GetTeam(Team, true);
254 void Playerchecker_Think()
258 for(i = 0; i < maxclients; ++i)
261 if(GetPlayerName(i) == "")
265 // player disconnected
278 playerslots[i] = e = spawn();
281 e.ping_packetloss = 0;
282 e.ping_movementloss = 0;
283 //e.gotscores = 0; // we might already have the scores...
284 SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
286 HUD_UpdatePlayerPos(e);
290 self.nextthink = time + 0.2;
297 localcmd(strcat("\nscoreboard_columns_set ", autocvar_scoreboard_columns, ";\n"));
299 entity playerchecker;
300 playerchecker = spawn();
301 playerchecker.think = Playerchecker_Think;
302 playerchecker.nextthink = time + 0.2;
312 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
313 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
314 // All keys are in ascii.
315 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
316 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
317 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
318 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
323 if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
326 if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
330 if(menu_action(bInputType, nPrimary, nSecondary))
336 // END REQUIRED CSQC FUNCTIONS
337 // --------------------------------------------------------------------------
339 // --------------------------------------------------------------------------
340 // BEGIN OPTIONAL CSQC FUNCTIONS
341 void Ent_RemoveEntCS()
343 entcs_receiver[self.sv_entnum] = world;
348 InterpolateOrigin_Undo();
350 self.classname = "entcs_receiver";
354 self.sv_entnum = ReadByte();
357 self.origin_x = ReadShort();
358 self.origin_y = ReadShort();
359 self.origin_z = ReadShort();
363 self.angles_y = ReadByte() * 360.0 / 256;
364 self.angles_x = self.angles_z = 0;
367 self.healthvalue = ReadByte() * 10;
369 self.armorvalue = ReadByte() * 10;
371 entcs_receiver[self.sv_entnum] = self;
372 self.entremove = Ent_RemoveEntCS;
374 InterpolateOrigin_Note();
379 void Ent_RemovePlayerScore()
385 SetTeam(self.owner, -1);
386 self.owner.gotscores = 0;
387 for(i = 0; i < MAX_SCORE; ++i)
388 self.owner.(scores[i]) = 0; // clear all scores
392 void Ent_ReadPlayerScore()
398 // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN
399 // (no I've never heard of M-x replace-string, sed, or anything like that)
400 isNew = !self.owner; // workaround for DP bug
403 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
404 if(!isNew && n != self.sv_entnum)
406 //print(_("A CSQC entity changed its owner!\n"));
407 print(sprintf(_("A CSQC entity changed its owner! (edict: %d, classname: %s)\n"), num_for_edict(self), self.classname));
410 self.enttype = ENT_CLIENT_SCORES;
416 if not(playerslots[self.sv_entnum])
417 playerslots[self.sv_entnum] = spawn();
418 o = self.owner = playerslots[self.sv_entnum];
419 o.sv_entnum = self.sv_entnum;
422 //if not(o.sort_prev)
423 // RegisterPlayer(o);
424 //playerchecker will do this for us later, if it has not already done so
435 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
439 o.(scores[i]) = ReadInt24_t();
441 o.(scores[i]) = ReadChar();
445 HUD_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
447 self.entremove = Ent_RemovePlayerScore;
450 void Ent_ReadTeamScore()
455 self.team = ReadByte();
456 o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
459 #if MAX_TEAMSCORE <= 8
467 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
471 o.(teamscores[i]) = ReadInt24_t();
473 o.(teamscores[i]) = ReadChar();
476 HUD_UpdateTeamPos(o);
479 void Ent_ClientData()
482 float newspectatee_status;
486 scoreboard_showscores_force = (f & 1);
490 newspectatee_status = ReadByte();
491 if(newspectatee_status == player_localnum + 1)
492 newspectatee_status = -1; // observing
495 newspectatee_status = 0;
497 spectatorbutton_zoom = (f & 4);
501 angles_held_status = 1;
502 angles_held_x = ReadAngle();
503 angles_held_y = ReadAngle();
507 angles_held_status = 0;
509 if(newspectatee_status != spectatee_status)
513 race_checkpointtime = 0;
515 if (autocvar_hud_panel_healtharmor_progressbar_gfx)
517 if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
518 || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
521 else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
524 spectatee_status = newspectatee_status;
526 // non-COMPAT_XON050_ENGINE: we could get rid of spectatee_status, and derive it from player_localentnum and player_localnum
531 float nags, i, j, b, f;
533 nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
538 strunzone(vote_called_vote);
539 vote_called_vote = string_null;
549 vote_yescount = ReadByte();
550 vote_nocount = ReadByte();
551 vote_needed = ReadByte();
552 vote_highlighted = ReadChar();
558 strunzone(vote_called_vote);
559 vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
564 for(j = 0; j < maxclients; ++j)
566 playerslots[j].ready = 1;
567 for(i = 1; i <= maxclients; i += 8)
570 for(j = i-1, b = 1; b < 256; b *= 2, ++j)
573 playerslots[j].ready = 0;
577 ready_waiting = (nags & 1);
578 ready_waiting_for_me = (nags & 2);
579 vote_waiting = (nags & 4);
580 vote_waiting_for_me = (nags & 8);
581 warmup_stage = (nags & 16);
584 void Ent_RandomSeed()
592 void Ent_ReadAccuracy(void)
598 for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w)
599 weapon_accuracy[w] = -1;
603 for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2)
609 weapon_accuracy[w] = -1;
611 weapon_accuracy[w] = 1.0; // no better error handling yet, sorry
613 weapon_accuracy[w] = (b - 1.0) / 100.0;
618 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
619 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
620 void Ent_RadarLink();
622 void Ent_ScoresInfo();
623 void CSQC_Ent_Update(float bIsNewEntity)
629 // set up the "time" global for received entities to be correct for interpolation purposes
637 serverprevtime = time;
638 serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
639 time = serverprevtime + serverdeltatime;
642 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
645 if(t != self.enttype || bIsNewEntity)
647 //print(_("A CSQC entity changed its type!\n"));
648 print(sprintf(_("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n"), num_for_edict(self), self.entnum, self.enttype, t));
657 print(sprintf(_("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n"), num_for_edict(self), self.entnum, t));
665 case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
666 case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
667 case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
668 case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
669 case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
670 case ENT_CLIENT_LASER: Ent_Laser(); break;
671 case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
672 case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
673 case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
674 case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
675 case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
676 case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
677 case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
678 case ENT_CLIENT_INIT: Ent_Init(); break;
679 case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
680 case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
681 case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
682 case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
683 case ENT_CLIENT_WALL: Ent_Wall(); break;
684 case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
685 case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
686 case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
687 case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
688 case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
689 case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
690 case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
691 case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
692 case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
693 case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
694 case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
695 case ENT_CLIENT_TURRET: ent_turret(); break;
697 //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
698 error(sprintf(_("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n"), self.enttype, num_for_edict(self), self.classname));
704 // Destructor, but does NOT deallocate the entity by calling remove(). Also
705 // used when an entity changes its type. For an entity that someone interacts
706 // with others, make sure it can no longer do so.
714 self.draw = menu_sub_null;
715 self.entremove = menu_sub_null;
716 // TODO possibly set more stuff to defaults
718 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
719 void CSQC_Ent_Remove()
730 localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
731 calledhooks |= HOOK_START;
734 // 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.
735 void CSQC_Parse_StuffCmd(string strMessage)
737 localcmd(strMessage);
739 // 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.
740 void CSQC_Parse_Print(string strMessage)
742 print(ColorTranslateRGB(strMessage));
745 // CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
746 void CSQC_Parse_CenterPrint(string strMessage)
748 centerprint_hud(strMessage);
751 string notranslate_fogcmd1 = "\nfog ";
752 string notranslate_fogcmd2 = "\nr_fog_exp2 0\nr_drawfog 1\n";
755 // TODO somehow thwart prvm_globalset client ...
758 localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2));
761 void Gamemode_Init();
762 void Ent_ScoresInfo()
765 self.classname = "ent_client_scores_info";
766 gametype = ReadByte();
767 for(i = 0; i < MAX_SCORE; ++i)
769 scores_label[i] = strzone(ReadString());
770 scores_flags[i] = ReadByte();
772 for(i = 0; i < MAX_TEAMSCORE; ++i)
774 teamscores_label[i] = strzone(ReadString());
775 teamscores_flags[i] = ReadByte();
783 self.classname = "ent_client_init";
785 nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
787 hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
788 hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
789 hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
790 hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
791 electro_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
792 electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
793 electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
794 electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
795 gauntlet_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
796 gauntlet_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
797 gauntlet_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
798 gauntlet_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
802 forcefog = strzone(ReadString());
804 armorblockpercent = ReadByte() / 255.0;
806 g_weaponswitchdelay = ReadByte() / 255.0;
808 g_balance_grenadelauncher_bouncefactor = ReadCoord();
809 g_balance_grenadelauncher_bouncestop = ReadCoord();
810 g_balance_electro_secondary_bouncefactor = ReadCoord();
811 g_balance_electro_secondary_bouncestop = ReadCoord();
813 nex_scope = !ReadByte();
814 rifle_scope = !ReadByte();
816 serverflags = ReadByte();
818 minelayer_maxmines = ReadByte();
820 hagar_maxrockets = ReadByte();
822 g_trueaim_minrange = ReadCoord();
836 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
837 race_checkpoint = ReadByte();
838 race_time = ReadInt24_t();
839 race_previousbesttime = ReadInt24_t();
840 if(race_previousbestname)
841 strunzone(race_previousbestname);
842 race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
844 race_checkpointtime = time;
846 if(race_checkpoint == 0 || race_checkpoint == 254)
848 race_penaltyaccumulator = 0;
849 race_laptime = time; // valid
854 case RACE_NET_CHECKPOINT_CLEAR:
856 race_checkpointtime = 0;
859 case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
860 race_laptime = ReadCoord();
861 race_checkpointtime = -99999;
863 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
864 race_nextcheckpoint = ReadByte();
866 race_nextbesttime = ReadInt24_t();
867 if(race_nextbestname)
868 strunzone(race_nextbestname);
869 race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
872 case RACE_NET_CHECKPOINT_HIT_RACE:
873 race_mycheckpoint = ReadByte();
874 race_mycheckpointtime = time;
875 race_mycheckpointdelta = ReadInt24_t();
876 race_mycheckpointlapsdelta = ReadByte();
877 if(race_mycheckpointlapsdelta >= 128)
878 race_mycheckpointlapsdelta -= 256;
879 if(race_mycheckpointenemy)
880 strunzone(race_mycheckpointenemy);
881 race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
884 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
885 race_othercheckpoint = ReadByte();
886 race_othercheckpointtime = time;
887 race_othercheckpointdelta = ReadInt24_t();
888 race_othercheckpointlapsdelta = ReadByte();
889 if(race_othercheckpointlapsdelta >= 128)
890 race_othercheckpointlapsdelta -= 256;
891 if(race_othercheckpointenemy)
892 strunzone(race_othercheckpointenemy);
893 race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
896 case RACE_NET_PENALTY_RACE:
897 race_penaltyeventtime = time;
898 race_penaltytime = ReadShort();
899 //race_penaltyaccumulator += race_penaltytime;
900 if(race_penaltyreason)
901 strunzone(race_penaltyreason);
902 race_penaltyreason = strzone(ReadString());
905 case RACE_NET_PENALTY_QUALIFYING:
906 race_penaltyeventtime = time;
907 race_penaltytime = ReadShort();
908 race_penaltyaccumulator += race_penaltytime;
909 if(race_penaltyreason)
910 strunzone(race_penaltyreason);
911 race_penaltyreason = strzone(ReadString());
914 case RACE_NET_SERVER_RECORD:
915 race_server_record = ReadInt24_t();
917 case RACE_NET_SPEED_AWARD:
918 race_speedaward = ReadInt24_t();
919 if(race_speedaward_holder)
920 strunzone(race_speedaward_holder);
921 race_speedaward_holder = strzone(ReadString());
923 case RACE_NET_SPEED_AWARD_BEST:
924 race_speedaward_alltimebest = ReadInt24_t();
925 if(race_speedaward_alltimebest_holder)
926 strunzone(race_speedaward_alltimebest_holder);
927 race_speedaward_alltimebest_holder = strzone(ReadString());
929 case RACE_NET_SERVER_RANKINGS:
930 float pos, prevpos, del;
932 prevpos = ReadShort();
935 // move other rankings out of the way
938 for (i=prevpos-1;i>pos-1;--i) {
939 grecordtime[i] = grecordtime[i-1];
941 strunzone(grecordholder[i]);
942 grecordholder[i] = strzone(grecordholder[i-1]);
944 } else if (del) { // a record has been deleted by the admin
945 for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
946 if (i == RANKINGS_CNT-1) { // clear out last record
948 if (grecordholder[i])
949 strunzone(grecordholder[i]);
950 grecordholder[i] = string_null;
953 grecordtime[i] = grecordtime[i+1];
954 if (grecordholder[i])
955 strunzone(grecordholder[i]);
956 grecordholder[i] = strzone(grecordholder[i+1]);
959 } else { // player has no ranked record yet
960 for (i=RANKINGS_CNT-1;i>pos-1;--i) {
961 grecordtime[i] = grecordtime[i-1];
963 strunzone(grecordholder[i]);
964 grecordholder[i] = strzone(grecordholder[i-1]);
969 if(grecordholder[pos-1] != "")
970 strunzone(grecordholder[pos-1]);
971 grecordholder[pos-1] = strzone(ReadString());
972 grecordtime[pos-1] = ReadInt24_t();
973 if(grecordholder[pos-1] == GetPlayerName(player_localnum))
976 case RACE_NET_SERVER_STATUS:
977 race_status = ReadShort();
979 strunzone(race_status_name);
980 race_status_name = strzone(ReadString());
987 current_viewzoom = 0.6;
990 void Net_TeamNagger()
995 void Net_ReadPingPLReport()
1002 if not(playerslots[e])
1004 playerslots[e].ping = pi;
1005 playerslots[e].ping_packetloss = pl / 255.0;
1006 playerslots[e].ping_movementloss = ml / 255.0;
1009 void Net_WeaponComplain() {
1010 complain_weapon = ReadByte();
1012 if(complain_weapon_name)
1013 strunzone(complain_weapon_name);
1014 complain_weapon_name = strzone(ReadString());
1016 complain_weapon_type = ReadByte();
1018 complain_weapon_time = time;
1019 weapontime = time; // ping the weapon panel
1022 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
1023 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
1024 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
1025 float CSQC_Parse_TempEntity()
1033 // NOTE: Could just do return instead of break...
1036 case TE_CSQC_TARGET_MUSIC:
1040 case TE_CSQC_PICTURE:
1041 Net_MapVote_Picture();
1052 case TE_CSQC_ZCURVEPARTICLES:
1053 Net_ReadZCurveParticles();
1056 case TE_CSQC_NEXGUNBEAMPARTICLE:
1057 Net_ReadNexgunBeamParticle();
1060 case TE_CSQC_TEAMNAGGER:
1064 case TE_CSQC_LIGHTNINGARC:
1065 Net_ReadLightningarc();
1068 case TE_CSQC_PINGPLREPORT:
1069 Net_ReadPingPLReport();
1072 case TE_CSQC_ANNOUNCE:
1073 Announcer_Play(ReadString());
1076 case TE_CSQC_KILLNOTIFY:
1077 HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadShort(), ReadByte());
1080 case TE_CSQC_KILLCENTERPRINT:
1081 HUD_KillCenterprint(ReadString(), ReadString(), ReadShort(), ReadByte());
1084 case TE_CSQC_CENTERPRINT_GENERIC:
1089 if (id != 0 && s != "")
1090 centerprint_generic(id, s, ReadByte(), ReadByte());
1092 centerprint_generic(id, s, 0, 0);
1095 case TE_CSQC_WEAPONCOMPLAIN:
1096 Net_WeaponComplain();
1099 case TE_CSQC_VEHICLESETUP:
1104 // No special logic for this temporary entity; return 0 so the engine can handle it
1112 string getcommandkey(string text, string command)
1117 if (!autocvar_hud_showbinds)
1120 keys = db_get(binddb, command);
1123 n = tokenize(findkeysforcommand(command, 0)); // uses '...' strings
1124 for(j = 0; j < n; ++j)
1130 keys = keynumtostring(k);
1132 keys = strcat(keys, ", ", keynumtostring(k));
1135 if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break;
1139 db_put(binddb, command, keys);
1143 if (autocvar_hud_showbinds > 1)
1144 return sprintf(_("%s (not bound)"), text);
1148 else if (autocvar_hud_showbinds > 1)
1149 return sprintf(_("%s (%s)"), text, keys);