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()));
51 ClientProgsDB = db_load("client.db");
52 compressShortVector_init();
54 drawfont = FONT_USER+1;
56 menu_show = menu_show_error;
57 menu_action = menu_sub_null;
59 for(i = 0; i < 255; ++i)
60 if(getplayerkeyvalue(i, "viewentity") == "")
64 //registercommand("hud_configure");
65 //registercommand("hud_save");
66 //registercommand("menu_action");
68 ConsoleCommand_macro_init();
70 registercvar("hud_usecsqc", "1");
71 registercvar("scoreboard_columns", "default");
75 // hud_fields uses strunzone on the titles!
76 for(i = 0; i < MAX_HUD_FIELDS; ++i)
77 hud_title[i] = strzone("(null)");
84 players = Sort_Spawn();
86 GetTeam(COLOR_SPECTATOR, true); // add specs first
90 WaypointSprite_Load();
93 precache_model("null");
94 precache_sound("misc/hit.wav");
95 precache_sound("misc/typehit.wav");
96 Projectile_Precache();
100 DamageInfo_Precache();
103 Announcer_Precache();
106 if(autocvar_cl_reticle)
108 if(autocvar_cl_reticle_item_normal) { precache_pic("gfx/reticle_normal"); }
109 if(autocvar_cl_reticle_item_nex) { precache_pic("gfx/reticle_nex"); }
112 get_mi_min_max_texcoords(1); // try the CLEVER way first
113 minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
114 shortmapname = mi_shortname;
116 if(precache_pic(minimapname) == "")
118 // but maybe we have a non-clever minimap
119 minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
120 if(precache_pic(minimapname) == "")
121 minimapname = ""; // FAIL
123 get_mi_min_max_texcoords(0); // load new texcoords
126 mi_center = (mi_min + mi_max) * 0.5;
127 mi_scale = mi_max - mi_min;
128 minimapname = strzone(minimapname);
132 hud_configure_prev = -1;
136 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
137 float cvar_clientsettemp_restore();
138 void CSQC_Shutdown(void)
153 if(autocvar_cl_db_saveasdump)
154 db_dump(ClientProgsDB, "client.db");
156 db_save(ClientProgsDB, "client.db");
157 db_close(ClientProgsDB);
159 cvar_clientsettemp_restore();
162 cvar_set("chase_active",ftos(chase_active_backup));
164 // unset the event chasecam's chase_active
165 if(autocvar_chase_active < 0)
166 cvar_set("chase_active", "0");
170 if not(calledhooks & HOOK_START)
171 localcmd("\n_cl_hook_gamestart nop\n");
172 if not(calledhooks & HOOK_END)
173 localcmd("\ncl_hook_gameend\n");
178 float SetTeam(entity o, float Team)
192 if(GetTeam(Team, false) == world)
194 print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
195 Team = COLOR_SPECTATOR;
208 if(GetTeam(Team, false) == world)
210 print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
211 Team = COLOR_SPECTATOR;
216 if(Team == -1) // leave
220 tm = GetTeam(o.team, false);
231 tm = GetTeam(Team, true);
236 else if(Team != o.team)
238 tm = GetTeam(o.team, false);
241 tm = GetTeam(Team, true);
249 void Playerchecker_Think()
253 for(i = 0; i < maxclients; ++i)
256 if(GetPlayerName(i) == "")
260 // player disconnected
273 playerslots[i] = e = spawn();
276 e.ping_packetloss = 0;
277 e.ping_movementloss = 0;
278 //e.gotscores = 0; // we might already have the scores...
279 SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
281 HUD_UpdatePlayerPos(e);
285 self.nextthink = time + 0.2;
292 localcmd(strcat("\nscoreboard_columns_set ", autocvar_scoreboard_columns, ";\n"));
294 entity playerchecker;
295 playerchecker = spawn();
296 playerchecker.think = Playerchecker_Think;
297 playerchecker.nextthink = time + 0.2;
307 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
308 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
309 // All keys are in ascii.
310 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
311 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
312 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
313 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
318 if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
321 if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
325 if(menu_action(bInputType, nPrimary, nSecondary))
331 // END REQUIRED CSQC FUNCTIONS
332 // --------------------------------------------------------------------------
334 // --------------------------------------------------------------------------
335 // BEGIN OPTIONAL CSQC FUNCTIONS
336 void Ent_RemoveEntCS()
338 entcs_receiver[self.sv_entnum] = world;
343 InterpolateOrigin_Undo();
345 self.classname = "entcs_receiver";
349 self.sv_entnum = ReadByte();
352 self.origin_x = ReadShort();
353 self.origin_y = ReadShort();
354 self.origin_z = ReadShort();
358 self.angles_y = ReadByte() * 360.0 / 256;
359 self.angles_x = self.angles_z = 0;
362 self.healthvalue = ReadByte() * 10;
364 self.armorvalue = ReadByte() * 10;
366 entcs_receiver[self.sv_entnum] = self;
367 self.entremove = Ent_RemoveEntCS;
369 InterpolateOrigin_Note();
374 void Ent_RemovePlayerScore()
380 SetTeam(self.owner, -1);
381 self.owner.gotscores = 0;
382 for(i = 0; i < MAX_SCORE; ++i)
383 self.owner.(scores[i]) = 0; // clear all scores
387 void Ent_ReadPlayerScore()
393 // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN
394 // (no I've never heard of M-x replace-string, sed, or anything like that)
395 isNew = !self.owner; // workaround for DP bug
398 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
399 if(!isNew && n != self.sv_entnum)
401 //print(_("A CSQC entity changed its owner!\n"));
402 print(sprintf(_("A CSQC entity changed its owner! (edict: %d, classname: %s)\n"), num_for_edict(self), self.classname));
405 self.enttype = ENT_CLIENT_SCORES;
411 if not(playerslots[self.sv_entnum])
412 playerslots[self.sv_entnum] = spawn();
413 o = self.owner = playerslots[self.sv_entnum];
414 o.sv_entnum = self.sv_entnum;
417 //if not(o.sort_prev)
418 // RegisterPlayer(o);
419 //playerchecker will do this for us later, if it has not already done so
430 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
434 o.(scores[i]) = ReadInt24_t();
436 o.(scores[i]) = ReadChar();
440 HUD_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
442 self.entremove = Ent_RemovePlayerScore;
445 void Ent_ReadTeamScore()
450 self.team = ReadByte();
451 o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
454 #if MAX_TEAMSCORE <= 8
462 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
466 o.(teamscores[i]) = ReadInt24_t();
468 o.(teamscores[i]) = ReadChar();
471 HUD_UpdateTeamPos(o);
474 void Ent_ClientData()
477 float newspectatee_status;
481 scoreboard_showscores_force = (f & 1);
485 newspectatee_status = ReadByte();
486 if(newspectatee_status == player_localentnum)
487 newspectatee_status = -1; // observing
490 newspectatee_status = 0;
492 spectatorbutton_zoom = (f & 4);
496 angles_held_status = 1;
497 angles_held_x = ReadAngle();
498 angles_held_y = ReadAngle();
502 angles_held_status = 0;
504 if(newspectatee_status != spectatee_status)
508 race_checkpointtime = 0;
510 if (autocvar_hud_panel_healtharmor_progressbar_gfx)
512 if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
513 || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
516 else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
519 spectatee_status = newspectatee_status;
524 float nags, i, j, b, f;
526 nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
531 strunzone(vote_called_vote);
532 vote_called_vote = string_null;
542 vote_yescount = ReadByte();
543 vote_nocount = ReadByte();
544 vote_needed = ReadByte();
545 vote_highlighted = ReadChar();
551 strunzone(vote_called_vote);
552 vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
557 for(j = 0; j < maxclients; ++j)
559 playerslots[j].ready = 1;
560 for(i = 1; i <= maxclients; i += 8)
563 for(j = i-1, b = 1; b < 256; b *= 2, ++j)
566 playerslots[j].ready = 0;
570 ready_waiting = (nags & 1);
571 ready_waiting_for_me = (nags & 2);
572 vote_waiting = (nags & 4);
573 vote_waiting_for_me = (nags & 8);
574 warmup_stage = (nags & 16);
577 void Ent_RandomSeed()
585 void Ent_ReadAccuracy(void)
591 for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w)
592 weapon_accuracy[w] = -1;
596 for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2)
602 weapon_accuracy[w] = -1;
604 weapon_accuracy[w] = 1.0; // no better error handling yet, sorry
606 weapon_accuracy[w] = (b - 1.0) / 100.0;
611 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
612 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
613 void Ent_RadarLink();
615 void Ent_ScoresInfo();
616 void CSQC_Ent_Update(float bIsNewEntity)
622 // set up the "time" global for received entities to be correct for interpolation purposes
630 serverprevtime = time;
631 serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
632 time = serverprevtime + serverdeltatime;
635 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
638 if(t != self.enttype || bIsNewEntity)
640 //print(_("A CSQC entity changed its type!\n"));
641 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));
650 print(sprintf(_("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n"), num_for_edict(self), self.entnum, t));
658 case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
659 case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
660 case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
661 case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
662 case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
663 case ENT_CLIENT_LASER: Ent_Laser(); break;
664 case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
665 case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
666 case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
667 case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
668 case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
669 case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
670 case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
671 case ENT_CLIENT_INIT: Ent_Init(); break;
672 case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
673 case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
674 case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
675 case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
676 case ENT_CLIENT_WALL: Ent_Wall(); break;
677 case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
678 case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
679 case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
680 case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
681 case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
682 case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
683 case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
684 case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
685 case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
686 case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
687 case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
688 case ENT_CLIENT_TURRET: ent_turret(); break;
690 //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
691 error(sprintf(_("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n"), self.enttype, num_for_edict(self), self.classname));
697 // Destructor, but does NOT deallocate the entity by calling remove(). Also
698 // used when an entity changes its type. For an entity that someone interacts
699 // with others, make sure it can no longer do so.
707 self.draw = menu_sub_null;
708 self.entremove = menu_sub_null;
709 // TODO possibly set more stuff to defaults
711 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
712 void CSQC_Ent_Remove()
723 localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
724 calledhooks |= HOOK_START;
727 // 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.
728 void CSQC_Parse_StuffCmd(string strMessage)
730 localcmd(strMessage);
732 // 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.
733 void CSQC_Parse_Print(string strMessage)
735 print(ColorTranslateRGB(strMessage));
738 // CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
739 void CSQC_Parse_CenterPrint(string strMessage)
741 centerprint_hud(strMessage);
744 string notranslate_fogcmd1 = "\nfog ";
745 string notranslate_fogcmd2 = "\nr_fog_exp2 0\nr_drawfog 1\n";
748 // TODO somehow thwart prvm_globalset client ...
751 localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2));
754 void Gamemode_Init();
755 void Ent_ScoresInfo()
758 self.classname = "ent_client_scores_info";
759 gametype = ReadByte();
760 for(i = 0; i < MAX_SCORE; ++i)
762 scores_label[i] = strzone(ReadString());
763 scores_flags[i] = ReadByte();
765 for(i = 0; i < MAX_TEAMSCORE; ++i)
767 teamscores_label[i] = strzone(ReadString());
768 teamscores_flags[i] = ReadByte();
776 self.classname = "ent_client_init";
778 nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
780 hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
781 hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
782 hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
783 hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
784 electro_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
785 electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
786 electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
787 electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
788 gauntlet_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
789 gauntlet_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
790 gauntlet_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
791 gauntlet_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
795 forcefog = strzone(ReadString());
797 armorblockpercent = ReadByte() / 255.0;
799 g_weaponswitchdelay = ReadByte() / 255.0;
801 g_balance_grenadelauncher_bouncefactor = ReadCoord();
802 g_balance_grenadelauncher_bouncestop = ReadCoord();
803 g_balance_electro_secondary_bouncefactor = ReadCoord();
804 g_balance_electro_secondary_bouncestop = ReadCoord();
806 nex_scope = !ReadByte();
807 rifle_scope = !ReadByte();
809 serverflags = ReadByte();
811 minelayer_maxmines = ReadByte();
813 hagar_maxrockets = ReadByte();
815 g_trueaim_minrange = ReadCoord();
829 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
830 race_checkpoint = ReadByte();
831 race_time = ReadInt24_t();
832 race_previousbesttime = ReadInt24_t();
833 if(race_previousbestname)
834 strunzone(race_previousbestname);
835 race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
837 race_checkpointtime = time;
839 if(race_checkpoint == 0 || race_checkpoint == 254)
841 race_penaltyaccumulator = 0;
842 race_laptime = time; // valid
847 case RACE_NET_CHECKPOINT_CLEAR:
849 race_checkpointtime = 0;
852 case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
853 race_laptime = ReadCoord();
854 race_checkpointtime = -99999;
856 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
857 race_nextcheckpoint = ReadByte();
859 race_nextbesttime = ReadInt24_t();
860 if(race_nextbestname)
861 strunzone(race_nextbestname);
862 race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
865 case RACE_NET_CHECKPOINT_HIT_RACE:
866 race_mycheckpoint = ReadByte();
867 race_mycheckpointtime = time;
868 race_mycheckpointdelta = ReadInt24_t();
869 race_mycheckpointlapsdelta = ReadByte();
870 if(race_mycheckpointlapsdelta >= 128)
871 race_mycheckpointlapsdelta -= 256;
872 if(race_mycheckpointenemy)
873 strunzone(race_mycheckpointenemy);
874 race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
877 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
878 race_othercheckpoint = ReadByte();
879 race_othercheckpointtime = time;
880 race_othercheckpointdelta = ReadInt24_t();
881 race_othercheckpointlapsdelta = ReadByte();
882 if(race_othercheckpointlapsdelta >= 128)
883 race_othercheckpointlapsdelta -= 256;
884 if(race_othercheckpointenemy)
885 strunzone(race_othercheckpointenemy);
886 race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
889 case RACE_NET_PENALTY_RACE:
890 race_penaltyeventtime = time;
891 race_penaltytime = ReadShort();
892 //race_penaltyaccumulator += race_penaltytime;
893 if(race_penaltyreason)
894 strunzone(race_penaltyreason);
895 race_penaltyreason = strzone(ReadString());
898 case RACE_NET_PENALTY_QUALIFYING:
899 race_penaltyeventtime = time;
900 race_penaltytime = ReadShort();
901 race_penaltyaccumulator += race_penaltytime;
902 if(race_penaltyreason)
903 strunzone(race_penaltyreason);
904 race_penaltyreason = strzone(ReadString());
907 case RACE_NET_SERVER_RECORD:
908 race_server_record = ReadInt24_t();
910 case RACE_NET_SPEED_AWARD:
911 race_speedaward = ReadInt24_t();
912 if(race_speedaward_holder)
913 strunzone(race_speedaward_holder);
914 race_speedaward_holder = strzone(ReadString());
916 case RACE_NET_SPEED_AWARD_BEST:
917 race_speedaward_alltimebest = ReadInt24_t();
918 if(race_speedaward_alltimebest_holder)
919 strunzone(race_speedaward_alltimebest_holder);
920 race_speedaward_alltimebest_holder = strzone(ReadString());
922 case RACE_NET_SERVER_RANKINGS:
923 float pos, prevpos, del;
925 prevpos = ReadShort();
928 // move other rankings out of the way
931 for (i=prevpos-1;i>pos-1;--i) {
932 grecordtime[i] = grecordtime[i-1];
934 strunzone(grecordholder[i]);
935 grecordholder[i] = strzone(grecordholder[i-1]);
937 } else if (del) { // a record has been deleted by the admin
938 for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
939 if (i == RANKINGS_CNT-1) { // clear out last record
941 if (grecordholder[i])
942 strunzone(grecordholder[i]);
943 grecordholder[i] = string_null;
946 grecordtime[i] = grecordtime[i+1];
947 if (grecordholder[i])
948 strunzone(grecordholder[i]);
949 grecordholder[i] = strzone(grecordholder[i+1]);
952 } else { // player has no ranked record yet
953 for (i=RANKINGS_CNT-1;i>pos-1;--i) {
954 grecordtime[i] = grecordtime[i-1];
956 strunzone(grecordholder[i]);
957 grecordholder[i] = strzone(grecordholder[i-1]);
962 if(grecordholder[pos-1] != "")
963 strunzone(grecordholder[pos-1]);
964 grecordholder[pos-1] = strzone(ReadString());
965 grecordtime[pos-1] = ReadInt24_t();
966 if(grecordholder[pos-1] == GetPlayerName(player_localentnum -1))
969 case RACE_NET_SERVER_STATUS:
970 race_status = ReadShort();
972 strunzone(race_status_name);
973 race_status_name = strzone(ReadString());
980 current_viewzoom = 0.6;
983 void Net_TeamNagger()
988 void Net_ReadPingPLReport()
995 if not(playerslots[e])
997 playerslots[e].ping = pi;
998 playerslots[e].ping_packetloss = pl / 255.0;
999 playerslots[e].ping_movementloss = ml / 255.0;
1002 void Net_WeaponComplain() {
1003 complain_weapon = ReadByte();
1005 if(complain_weapon_name)
1006 strunzone(complain_weapon_name);
1007 complain_weapon_name = strzone(ReadString());
1009 complain_weapon_type = ReadByte();
1011 complain_weapon_time = time;
1012 weapontime = time; // ping the weapon panel
1015 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
1016 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
1017 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
1018 float CSQC_Parse_TempEntity()
1026 // NOTE: Could just do return instead of break...
1029 case TE_CSQC_TARGET_MUSIC:
1033 case TE_CSQC_PICTURE:
1034 Net_MapVote_Picture();
1045 case TE_CSQC_ZCURVEPARTICLES:
1046 Net_ReadZCurveParticles();
1049 case TE_CSQC_NEXGUNBEAMPARTICLE:
1050 Net_ReadNexgunBeamParticle();
1053 case TE_CSQC_TEAMNAGGER:
1057 case TE_CSQC_LIGHTNINGARC:
1058 Net_ReadLightningarc();
1061 case TE_CSQC_PINGPLREPORT:
1062 Net_ReadPingPLReport();
1065 case TE_CSQC_ANNOUNCE:
1066 Announcer_Play(ReadString());
1069 case TE_CSQC_KILLNOTIFY:
1070 HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadShort(), ReadByte());
1073 case TE_CSQC_KILLCENTERPRINT:
1074 HUD_KillCenterprint(ReadString(), ReadString(), ReadShort(), ReadByte());
1077 case TE_CSQC_CENTERPRINT_GENERIC:
1082 if (id != 0 && s != "")
1083 centerprint_generic(id, s, ReadByte(), ReadByte());
1085 centerprint_generic(id, s, 0, 0);
1088 case TE_CSQC_WEAPONCOMPLAIN:
1089 Net_WeaponComplain();
1092 case TE_CSQC_VEHICLESETUP:
1097 // No special logic for this temporary entity; return 0 so the engine can handle it
1105 string getcommandkey(string text, string command)
1110 if (!autocvar_hud_showbinds)
1113 keys = db_get(binddb, command);
1116 n = tokenize(findkeysforcommand(command, 0)); // uses '...' strings
1117 for(j = 0; j < n; ++j)
1123 keys = keynumtostring(k);
1125 keys = strcat(keys, ", ", keynumtostring(k));
1128 if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break;
1132 db_put(binddb, command, keys);
1136 if (autocvar_hud_showbinds > 1)
1137 return sprintf(_("%s (not bound)"), text);
1141 else if (autocvar_hud_showbinds > 1)
1142 return sprintf(_("%s (%s)"), text, keys);