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(getplayerkey(i, "viewentity") == "")
64 //registercmd("hud_configure");
65 //registercmd("hud_save");
66 //registercmd("menu_action");
68 ConsoleCommand_macro_init();
70 registercvar("hud_usecsqc", "1");
71 registercvar("scoreboard_columns", "default", CVAR_SAVE);
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_sound("misc/hit.wav");
94 precache_sound("misc/typehit.wav");
95 Projectile_Precache();
99 DamageInfo_Precache();
102 Announcer_Precache();
105 if(autocvar_cl_reticle)
107 if(autocvar_cl_reticle_item_normal) { precache_pic("gfx/reticle_normal"); }
108 if(autocvar_cl_reticle_item_nex) { precache_pic("gfx/reticle_nex"); }
111 get_mi_min_max_texcoords(1); // try the CLEVER way first
112 minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
113 shortmapname = mi_shortname;
115 if(precache_pic(minimapname) == "")
117 // but maybe we have a non-clever minimap
118 minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
119 if(precache_pic(minimapname) == "")
120 minimapname = ""; // FAIL
122 get_mi_min_max_texcoords(0); // load new texcoords
125 mi_center = (mi_min + mi_max) * 0.5;
126 mi_scale = mi_max - mi_min;
127 minimapname = strzone(minimapname);
131 hud_configure_prev = -1;
135 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
136 float cvar_clientsettemp_restore();
137 void CSQC_Shutdown(void)
152 if(autocvar_cl_db_saveasdump)
153 db_dump(ClientProgsDB, "client.db");
155 db_save(ClientProgsDB, "client.db");
156 db_close(ClientProgsDB);
158 cvar_clientsettemp_restore();
161 cvar_set("chase_active",ftos(chase_active_backup));
163 // unset the event chasecam's chase_active
164 if(autocvar_chase_active < 0)
165 cvar_set("chase_active", "0");
169 if not(calledhooks & HOOK_START)
170 localcmd("\n_cl_hook_gamestart nop\n");
171 if not(calledhooks & HOOK_END)
172 localcmd("\ncl_hook_gameend\n");
177 float SetTeam(entity o, float Team)
191 if(GetTeam(Team, false) == NULL)
193 print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
194 Team = COLOR_SPECTATOR;
207 if(GetTeam(Team, false) == NULL)
209 print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
210 Team = COLOR_SPECTATOR;
215 if(Team == -1) // leave
219 tm = GetTeam(o.team, false);
230 tm = GetTeam(Team, true);
235 else if(Team != o.team)
237 tm = GetTeam(o.team, false);
240 tm = GetTeam(Team, true);
248 void Playerchecker_Think()
252 for(i = 0; i < maxclients; ++i)
255 if(GetPlayerName(i) == "")
259 // player disconnected
272 playerslots[i] = e = spawn();
275 e.ping_packetloss = 0;
276 e.ping_movementloss = 0;
277 //e.gotscores = 0; // we might already have the scores...
278 SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
280 HUD_UpdatePlayerPos(e);
284 self.nextthink = time + 0.2;
291 localcmd(strcat("\nscoreboard_columns_set ", autocvar_scoreboard_columns, ";\n"));
293 entity playerchecker;
294 playerchecker = spawn();
295 playerchecker.think = Playerchecker_Think;
296 playerchecker.nextthink = time + 0.2;
306 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
307 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
308 // All keys are in ascii.
309 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
310 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
311 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
312 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
317 if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
320 if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
324 if(menu_action(bInputType, nPrimary, nSecondary))
330 // END REQUIRED CSQC FUNCTIONS
331 // --------------------------------------------------------------------------
333 // --------------------------------------------------------------------------
334 // BEGIN OPTIONAL CSQC FUNCTIONS
335 void Ent_RemoveEntCS()
337 entcs_receiver[self.sv_entnum] = world;
342 InterpolateOrigin_Undo();
344 self.classname = "entcs_receiver";
348 self.sv_entnum = ReadByte();
351 self.origin_x = ReadShort();
352 self.origin_y = ReadShort();
353 self.origin_z = ReadShort();
357 self.angles_y = ReadByte() * 360.0 / 256;
358 self.angles_x = self.angles_z = 0;
361 self.healthvalue = ReadByte() * 10;
363 self.armorvalue = ReadByte() * 10;
365 entcs_receiver[self.sv_entnum] = self;
366 self.entremove = Ent_RemoveEntCS;
368 InterpolateOrigin_Note();
373 void Ent_RemovePlayerScore()
379 SetTeam(self.owner, -1);
380 self.owner.gotscores = 0;
381 for(i = 0; i < MAX_SCORE; ++i)
382 self.owner.(scores[i]) = 0; // clear all scores
386 void Ent_ReadPlayerScore()
392 // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN
393 // (no I've never heard of M-x replace-string, sed, or anything like that)
394 isNew = !self.owner; // workaround for DP bug
397 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
398 if(!isNew && n != self.sv_entnum)
400 //print(_("A CSQC entity changed its owner!\n"));
401 print(sprintf(_("A CSQC entity changed its owner! (edict: %d, classname: %s)\n"), num_for_edict(self), self.classname));
404 self.enttype = ENT_CLIENT_SCORES;
410 if not(playerslots[self.sv_entnum])
411 playerslots[self.sv_entnum] = spawn();
412 o = self.owner = playerslots[self.sv_entnum];
413 o.sv_entnum = self.sv_entnum;
416 //if not(o.sort_prev)
417 // RegisterPlayer(o);
418 //playerchecker will do this for us later, if it has not already done so
429 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
433 o.(scores[i]) = ReadInt24_t();
435 o.(scores[i]) = ReadChar();
439 HUD_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
441 self.entremove = Ent_RemovePlayerScore;
444 void Ent_ReadTeamScore()
449 self.team = ReadByte();
450 o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
453 #if MAX_TEAMSCORE <= 8
461 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
465 o.(teamscores[i]) = ReadInt24_t();
467 o.(teamscores[i]) = ReadChar();
470 HUD_UpdateTeamPos(o);
473 void Ent_ClientData()
476 float newspectatee_status;
480 scoreboard_showscores_force = (f & 1);
484 newspectatee_status = ReadByte();
485 if(newspectatee_status == player_localentnum)
486 newspectatee_status = -1; // observing
489 newspectatee_status = 0;
491 spectatorbutton_zoom = (f & 4);
495 angles_held_status = 1;
496 angles_held_x = ReadAngle();
497 angles_held_y = ReadAngle();
501 angles_held_status = 0;
503 if(newspectatee_status != spectatee_status)
507 race_checkpointtime = 0;
509 if (autocvar_hud_panel_healtharmor_progressbar_gfx)
511 if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
512 || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
515 else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
518 spectatee_status = newspectatee_status;
523 float nags, i, j, b, f;
525 nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
530 strunzone(vote_called_vote);
531 vote_called_vote = string_null;
541 vote_yescount = ReadByte();
542 vote_nocount = ReadByte();
543 vote_needed = ReadByte();
544 vote_highlighted = ReadChar();
550 strunzone(vote_called_vote);
551 vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
556 for(j = 0; j < maxclients; ++j)
558 playerslots[j].ready = 1;
559 for(i = 1; i <= maxclients; i += 8)
562 for(j = i-1, b = 1; b < 256; b *= 2, ++j)
565 playerslots[j].ready = 0;
569 ready_waiting = (nags & 1);
570 ready_waiting_for_me = (nags & 2);
571 vote_waiting = (nags & 4);
572 vote_waiting_for_me = (nags & 8);
573 warmup_stage = (nags & 16);
576 void Ent_RandomSeed()
584 void Ent_ReadAccuracy(void)
590 for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w)
591 weapon_accuracy[w] = -1;
595 for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2)
601 weapon_accuracy[w] = -1;
603 weapon_accuracy[w] = 1.0; // no better error handling yet, sorry
605 weapon_accuracy[w] = (b - 1.0) / 100.0;
610 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
611 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
612 void Ent_RadarLink();
614 void Ent_ScoresInfo();
615 void CSQC_Ent_Update(float bIsNewEntity)
621 // set up the "time" global for received entities to be correct for interpolation purposes
629 serverprevtime = time;
630 serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
631 time = serverprevtime + serverdeltatime;
634 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
637 if(t != self.enttype || bIsNewEntity)
639 //print(_("A CSQC entity changed its type!\n"));
640 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));
649 print(sprintf(_("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n"), num_for_edict(self), self.entnum, t));
657 case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
658 case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
659 case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
660 case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
661 case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
662 case ENT_CLIENT_LASER: Ent_Laser(); break;
663 case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
664 case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
665 case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
666 case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
667 case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
668 case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
669 case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
670 case ENT_CLIENT_INIT: Ent_Init(); break;
671 case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
672 case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
673 case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
674 case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
675 case ENT_CLIENT_WALL: Ent_Wall(); break;
676 case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
677 case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
678 case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
679 case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
680 case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
681 case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
682 case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
683 case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
684 case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
685 case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
686 case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
687 case ENT_CLIENT_TURRET: ent_turret(); break;
689 //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
690 error(sprintf(_("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n"), self.enttype, num_for_edict(self), self.classname));
696 // Destructor, but does NOT deallocate the entity by calling remove(). Also
697 // used when an entity changes its type. For an entity that someone interacts
698 // with others, make sure it can no longer do so.
706 self.draw = menu_sub_null;
707 self.entremove = menu_sub_null;
708 // TODO possibly set more stuff to defaults
710 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
711 void CSQC_Ent_Remove()
722 localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
723 calledhooks |= HOOK_START;
726 // 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.
727 void CSQC_Parse_StuffCmd(string strMessage)
729 localcmd(strMessage);
731 // 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.
732 void CSQC_Parse_Print(string strMessage)
734 print(ColorTranslateRGB(strMessage));
737 // CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
738 void CSQC_Parse_CenterPrint(string strMessage)
740 centerprint(strMessage);
743 string notranslate_fogcmd1 = "\nfog ";
744 string notranslate_fogcmd2 = "\nr_fog_exp2 0\nr_drawfog 1\n";
747 // TODO somehow thwart prvm_globalset client ...
750 localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2));
753 void Gamemode_Init();
754 void Ent_ScoresInfo()
757 self.classname = "ent_client_scores_info";
758 gametype = ReadByte();
759 for(i = 0; i < MAX_SCORE; ++i)
761 scores_label[i] = strzone(ReadString());
762 scores_flags[i] = ReadByte();
764 for(i = 0; i < MAX_TEAMSCORE; ++i)
766 teamscores_label[i] = strzone(ReadString());
767 teamscores_flags[i] = ReadByte();
775 self.classname = "ent_client_init";
777 nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
779 hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
780 hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
781 hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
782 hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
783 electro_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
784 electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
785 electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
786 electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
787 gauntlet_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
788 gauntlet_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
789 gauntlet_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
790 gauntlet_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
794 forcefog = strzone(ReadString());
796 armorblockpercent = ReadByte() / 255.0;
798 g_weaponswitchdelay = ReadByte() / 255.0;
800 g_balance_grenadelauncher_bouncefactor = ReadCoord();
801 g_balance_grenadelauncher_bouncestop = ReadCoord();
802 g_balance_electro_secondary_bouncefactor = ReadCoord();
803 g_balance_electro_secondary_bouncestop = ReadCoord();
805 nex_scope = !ReadByte();
806 rifle_scope = !ReadByte();
808 serverflags = ReadByte();
810 minelayer_maxmines = ReadByte();
812 hagar_maxrockets = ReadByte();
814 g_trueaim_minrange = ReadCoord();
828 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
829 race_checkpoint = ReadByte();
830 race_time = ReadInt24_t();
831 race_previousbesttime = ReadInt24_t();
832 if(race_previousbestname)
833 strunzone(race_previousbestname);
834 race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
836 race_checkpointtime = time;
838 if(race_checkpoint == 0 || race_checkpoint == 254)
840 race_penaltyaccumulator = 0;
841 race_laptime = time; // valid
846 case RACE_NET_CHECKPOINT_CLEAR:
848 race_checkpointtime = 0;
851 case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
852 race_laptime = ReadCoord();
853 race_checkpointtime = -99999;
855 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
856 race_nextcheckpoint = ReadByte();
858 race_nextbesttime = ReadInt24_t();
859 if(race_nextbestname)
860 strunzone(race_nextbestname);
861 race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
864 case RACE_NET_CHECKPOINT_HIT_RACE:
865 race_mycheckpoint = ReadByte();
866 race_mycheckpointtime = time;
867 race_mycheckpointdelta = ReadInt24_t();
868 race_mycheckpointlapsdelta = ReadByte();
869 if(race_mycheckpointlapsdelta >= 128)
870 race_mycheckpointlapsdelta -= 256;
871 if(race_mycheckpointenemy)
872 strunzone(race_mycheckpointenemy);
873 race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
876 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
877 race_othercheckpoint = ReadByte();
878 race_othercheckpointtime = time;
879 race_othercheckpointdelta = ReadInt24_t();
880 race_othercheckpointlapsdelta = ReadByte();
881 if(race_othercheckpointlapsdelta >= 128)
882 race_othercheckpointlapsdelta -= 256;
883 if(race_othercheckpointenemy)
884 strunzone(race_othercheckpointenemy);
885 race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
888 case RACE_NET_PENALTY_RACE:
889 race_penaltyeventtime = time;
890 race_penaltytime = ReadShort();
891 //race_penaltyaccumulator += race_penaltytime;
892 if(race_penaltyreason)
893 strunzone(race_penaltyreason);
894 race_penaltyreason = strzone(ReadString());
897 case RACE_NET_PENALTY_QUALIFYING:
898 race_penaltyeventtime = time;
899 race_penaltytime = ReadShort();
900 race_penaltyaccumulator += race_penaltytime;
901 if(race_penaltyreason)
902 strunzone(race_penaltyreason);
903 race_penaltyreason = strzone(ReadString());
906 case RACE_NET_SERVER_RECORD:
907 race_server_record = ReadInt24_t();
909 case RACE_NET_SPEED_AWARD:
910 race_speedaward = ReadInt24_t();
911 if(race_speedaward_holder)
912 strunzone(race_speedaward_holder);
913 race_speedaward_holder = strzone(ReadString());
915 case RACE_NET_SPEED_AWARD_BEST:
916 race_speedaward_alltimebest = ReadInt24_t();
917 if(race_speedaward_alltimebest_holder)
918 strunzone(race_speedaward_alltimebest_holder);
919 race_speedaward_alltimebest_holder = strzone(ReadString());
921 case RACE_NET_SERVER_RANKINGS:
922 float pos, prevpos, del;
924 prevpos = ReadShort();
927 // move other rankings out of the way
930 for (i=prevpos-1;i>pos-1;--i) {
931 grecordtime[i] = grecordtime[i-1];
933 strunzone(grecordholder[i]);
934 grecordholder[i] = strzone(grecordholder[i-1]);
936 } else if (del) { // a record has been deleted by the admin
937 for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
938 if (i == RANKINGS_CNT-1) { // clear out last record
940 if (grecordholder[i])
941 strunzone(grecordholder[i]);
942 grecordholder[i] = string_null;
945 grecordtime[i] = grecordtime[i+1];
946 if (grecordholder[i])
947 strunzone(grecordholder[i]);
948 grecordholder[i] = strzone(grecordholder[i+1]);
951 } else { // player has no ranked record yet
952 for (i=RANKINGS_CNT-1;i>pos-1;--i) {
953 grecordtime[i] = grecordtime[i-1];
955 strunzone(grecordholder[i]);
956 grecordholder[i] = strzone(grecordholder[i-1]);
961 if(grecordholder[pos-1] != "")
962 strunzone(grecordholder[pos-1]);
963 grecordholder[pos-1] = strzone(ReadString());
964 grecordtime[pos-1] = ReadInt24_t();
965 if(grecordholder[pos-1] == GetPlayerName(player_localentnum -1))
968 case RACE_NET_SERVER_STATUS:
969 race_status = ReadShort();
971 strunzone(race_status_name);
972 race_status_name = strzone(ReadString());
979 current_viewzoom = 0.6;
982 void Net_TeamNagger()
987 void Net_ReadPingPLReport()
994 if not(playerslots[e])
996 playerslots[e].ping = pi;
997 playerslots[e].ping_packetloss = pl / 255.0;
998 playerslots[e].ping_movementloss = ml / 255.0;
1001 void Net_WeaponComplain() {
1002 complain_weapon = ReadByte();
1004 if(complain_weapon_name)
1005 strunzone(complain_weapon_name);
1006 complain_weapon_name = strzone(ReadString());
1008 complain_weapon_type = ReadByte();
1010 complain_weapon_time = time;
1011 weapontime = time; // ping the weapon panel
1014 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
1015 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
1016 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
1017 float CSQC_Parse_TempEntity()
1025 // NOTE: Could just do return instead of break...
1028 case TE_CSQC_TARGET_MUSIC:
1032 case TE_CSQC_PICTURE:
1033 Net_MapVote_Picture();
1044 case TE_CSQC_ZCURVEPARTICLES:
1045 Net_ReadZCurveParticles();
1048 case TE_CSQC_NEXGUNBEAMPARTICLE:
1049 Net_ReadNexgunBeamParticle();
1052 case TE_CSQC_TEAMNAGGER:
1056 case TE_CSQC_LIGHTNINGARC:
1057 Net_ReadLightningarc();
1060 case TE_CSQC_PINGPLREPORT:
1061 Net_ReadPingPLReport();
1064 case TE_CSQC_ANNOUNCE:
1065 Announcer_Play(ReadString());
1068 case TE_CSQC_KILLNOTIFY:
1069 HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadShort(), ReadByte());
1072 case TE_CSQC_KILLCENTERPRINT:
1073 HUD_KillCenterprint(ReadString(), ReadString(), ReadShort(), ReadByte());
1076 case TE_CSQC_CENTERPRINT_GENERIC:
1081 if (id != 0 && s != "")
1082 centerprint_generic(id, s, ReadByte(), ReadByte());
1084 centerprint_generic(id, s, 0, 0);
1087 case TE_CSQC_WEAPONCOMPLAIN:
1088 Net_WeaponComplain();
1091 case TE_CSQC_VEHICLESETUP:
1096 // No special logic for this temporary entity; return 0 so the engine can handle it
1104 string getcommandkey(string text, string command)
1109 if (!autocvar_hud_showbinds)
1112 keys = db_get(binddb, command);
1115 n = tokenize(findkeysforcommand(command)); // uses '...' strings
1116 for(j = 0; j < n; ++j)
1122 keys = keynumtostring(k);
1124 keys = strcat(keys, ", ", keynumtostring(k));
1127 if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break;
1131 db_put(binddb, command, keys);
1135 if (autocvar_hud_showbinds > 1)
1136 return sprintf(_("%s (not bound)"), text);
1140 else if (autocvar_hud_showbinds > 1)
1141 return sprintf(_("%s (%s)"), text, keys);