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();
26 prvm_language = cvar_string("prvm_language");
30 __engine_check = checkextension("DP_SV_WRITEPICTURE");
33 print(_("^3Your engine build is outdated\n^3This Server uses a newer QC VM. Please update!\n"));
34 localcmd("\ndisconnect\n");
40 check_unacceptable_compiler_bugs();
43 print(sprintf(_("^4CSQC Build information: ^1%s\n"), WATERMARK()));
50 ClientProgsDB = db_load("client.db");
51 compressShortVector_init();
53 drawfont = FONT_USER+1;
55 menu_show = menu_show_error;
56 menu_action = menu_sub_null;
58 for(i = 0; i < 255; ++i)
59 if(getplayerkey(i, "viewentity") == "")
63 //registercmd("hud_configure");
64 //registercmd("hud_save");
65 //registercmd("menu_action");
67 registercvar("hud_usecsqc", "1");
68 registercvar("scoreboard_columns", "default", CVAR_SAVE);
72 // hud_fields uses strunzone on the titles!
73 for(i = 0; i < MAX_HUD_FIELDS; ++i)
74 hud_title[i] = strzone("(null)");
81 players = Sort_Spawn();
83 GetTeam(COLOR_SPECTATOR, true); // add specs first
87 WaypointSprite_Load();
90 precache_sound("misc/hit.wav");
91 precache_sound("misc/typehit.wav");
92 Projectile_Precache();
96 DamageInfo_Precache();
102 if(autocvar_cl_reticle)
104 if(autocvar_cl_reticle_item_normal) { precache_pic("gfx/reticle_normal"); }
105 if(autocvar_cl_reticle_item_nex) { precache_pic("gfx/reticle_nex"); }
108 get_mi_min_max_texcoords(1); // try the CLEVER way first
109 minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
110 shortmapname = mi_shortname;
112 if(precache_pic(minimapname) == "")
114 // but maybe we have a non-clever minimap
115 minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
116 if(precache_pic(minimapname) == "")
117 minimapname = ""; // FAIL
119 get_mi_min_max_texcoords(0); // load new texcoords
122 mi_center = (mi_min + mi_max) * 0.5;
123 mi_scale = mi_max - mi_min;
124 minimapname = strzone(minimapname);
128 hud_configure_prev = -1;
132 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
133 void cvar_clientsettemp_restore();
134 void CSQC_Shutdown(void)
149 if(autocvar_cl_db_saveasdump)
150 db_dump(ClientProgsDB, "client.db");
152 db_save(ClientProgsDB, "client.db");
153 db_close(ClientProgsDB);
155 cvar_clientsettemp_restore();
158 cvar_set("chase_active",ftos(chase_active_backup));
160 // unset the event chasecam's chase_active
161 if(autocvar_chase_active < 0)
162 cvar_set("chase_active", "0");
166 if not(calledhooks & HOOK_START)
167 localcmd("\n_cl_hook_gamestart nop\n");
168 if not(calledhooks & HOOK_END)
169 localcmd("\ncl_hook_gameend\n");
174 float SetTeam(entity o, float Team)
188 if(GetTeam(Team, false) == NULL)
190 print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
191 Team = COLOR_SPECTATOR;
204 if(GetTeam(Team, false) == NULL)
206 print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
207 Team = COLOR_SPECTATOR;
212 if(Team == -1) // leave
216 tm = GetTeam(o.team, false);
227 tm = GetTeam(Team, true);
232 else if(Team != o.team)
234 tm = GetTeam(o.team, false);
237 tm = GetTeam(Team, true);
245 void Playerchecker_Think()
249 for(i = 0; i < maxclients; ++i)
252 if(GetPlayerName(i) == "")
256 // player disconnected
269 playerslots[i] = e = spawn();
272 e.ping_packetloss = 0;
273 e.ping_movementloss = 0;
274 //e.gotscores = 0; // we might already have the scores...
275 SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
277 HUD_UpdatePlayerPos(e);
281 self.nextthink = time + 0.2;
288 localcmd(strcat("\nscoreboard_columns_set ", autocvar_scoreboard_columns, ";\n"));
290 entity playerchecker;
291 playerchecker = spawn();
292 playerchecker.think = Playerchecker_Think;
293 playerchecker.nextthink = time + 0.2;
303 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
304 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
305 // All keys are in ascii.
306 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
307 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
308 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
309 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
314 if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
317 if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
321 if(menu_action(bInputType, nPrimary, nSecondary))
327 // END REQUIRED CSQC FUNCTIONS
328 // --------------------------------------------------------------------------
330 // --------------------------------------------------------------------------
331 // BEGIN OPTIONAL CSQC FUNCTIONS
332 void Ent_RemoveEntCS()
334 entcs_receiver[self.sv_entnum] = world;
339 InterpolateOrigin_Undo();
341 self.classname = "entcs_receiver";
345 self.sv_entnum = ReadByte();
348 self.origin_x = ReadShort();
349 self.origin_y = ReadShort();
350 self.origin_z = ReadShort();
354 self.angles_y = ReadByte() * 360.0 / 256;
355 self.angles_x = self.angles_z = 0;
358 self.healthvalue = ReadByte() * 10;
360 self.armorvalue = ReadByte() * 10;
362 entcs_receiver[self.sv_entnum] = self;
363 self.entremove = Ent_RemoveEntCS;
365 InterpolateOrigin_Note();
370 void Ent_RemovePlayerScore()
376 SetTeam(self.owner, -1);
377 self.owner.gotscores = 0;
378 for(i = 0; i < MAX_SCORE; ++i)
379 self.owner.(scores[i]) = 0; // clear all scores
383 void Ent_ReadPlayerScore()
389 // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN
390 // (no I've never heard of M-x replace-string, sed, or anything like that)
391 isNew = !self.owner; // workaround for DP bug
394 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
395 if(!isNew && n != self.sv_entnum)
397 //print(_("A CSQC entity changed its owner!\n"));
398 print(sprintf(_("A CSQC entity changed its owner! (edict: %d, classname: %s)\n"), num_for_edict(self), self.classname));
401 self.enttype = ENT_CLIENT_SCORES;
407 if not(playerslots[self.sv_entnum])
408 playerslots[self.sv_entnum] = spawn();
409 o = self.owner = playerslots[self.sv_entnum];
410 o.sv_entnum = self.sv_entnum;
413 //if not(o.sort_prev)
414 // RegisterPlayer(o);
415 //playerchecker will do this for us later, if it has not already done so
426 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
430 o.(scores[i]) = ReadInt24_t();
432 o.(scores[i]) = ReadChar();
436 HUD_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
438 self.entremove = Ent_RemovePlayerScore;
441 void Ent_ReadTeamScore()
446 self.team = ReadByte();
447 o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
450 #if MAX_TEAMSCORE <= 8
458 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
462 o.(teamscores[i]) = ReadInt24_t();
464 o.(teamscores[i]) = ReadChar();
467 HUD_UpdateTeamPos(o);
470 void Ent_ClientData()
473 float newspectatee_status;
477 scoreboard_showscores_force = (f & 1);
481 newspectatee_status = ReadByte();
482 if(newspectatee_status == player_localentnum)
483 newspectatee_status = -1; // observing
486 newspectatee_status = 0;
488 spectatorbutton_zoom = (f & 4);
492 angles_held_status = 1;
493 angles_held_x = ReadAngle();
494 angles_held_y = ReadAngle();
498 angles_held_status = 0;
500 if(newspectatee_status != spectatee_status)
504 race_checkpointtime = 0;
506 if (autocvar_hud_panel_healtharmor_progressbar_gfx)
508 if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
509 || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
512 else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
515 spectatee_status = newspectatee_status;
520 float nags, i, j, b, f;
522 nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
527 strunzone(vote_called_vote);
528 vote_called_vote = string_null;
538 vote_yescount = ReadByte();
539 vote_nocount = ReadByte();
540 vote_needed = ReadByte();
541 vote_highlighted = ReadChar();
547 strunzone(vote_called_vote);
548 vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
553 for(j = 0; j < maxclients; ++j)
555 playerslots[j].ready = 1;
556 for(i = 1; i <= maxclients; i += 8)
559 for(j = i-1, b = 1; b < 256; b *= 2, ++j)
562 playerslots[j].ready = 0;
566 ready_waiting = (nags & 1);
567 ready_waiting_for_me = (nags & 2);
568 vote_waiting = (nags & 4);
569 vote_waiting_for_me = (nags & 8);
570 warmup_stage = (nags & 16);
573 void Ent_RandomSeed()
581 void Ent_ReadAccuracy(void)
587 for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w)
588 weapon_accuracy[w] = -1;
592 for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2)
598 weapon_accuracy[w] = -1;
600 weapon_accuracy[w] = 1.0; // no better error handling yet, sorry
602 weapon_accuracy[w] = (b - 1.0) / 100.0;
607 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
608 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
609 void Ent_RadarLink();
611 void Ent_ScoresInfo();
612 void CSQC_Ent_Update(float bIsNewEntity)
618 // set up the "time" global for received entities to be correct for interpolation purposes
626 serverprevtime = time;
627 serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
628 time = serverprevtime + serverdeltatime;
631 #ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
634 if(t != self.enttype || bIsNewEntity)
636 //print(_("A CSQC entity changed its type!\n"));
637 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));
646 print(sprintf(_("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n"), num_for_edict(self), self.entnum, t));
654 case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
655 case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
656 case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
657 case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
658 case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
659 case ENT_CLIENT_LASER: Ent_Laser(); break;
660 case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
661 case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
662 case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
663 case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
664 case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
665 case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
666 case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
667 case ENT_CLIENT_INIT: Ent_Init(); break;
668 case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
669 case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
670 case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
671 case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
672 case ENT_CLIENT_WALL: Ent_Wall(); break;
673 case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
674 case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
675 case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
676 case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
677 case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
678 case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
679 case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
680 case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
681 case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
682 case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
683 case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
684 case ENT_CLIENT_TURRET: ent_turret(); break;
686 //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
687 error(sprintf(_("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n"), self.enttype, num_for_edict(self), self.classname));
693 // Destructor, but does NOT deallocate the entity by calling remove(). Also
694 // used when an entity changes its type. For an entity that someone interacts
695 // with others, make sure it can no longer do so.
703 self.draw = menu_sub_null;
704 self.entremove = menu_sub_null;
705 // TODO possibly set more stuff to defaults
707 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
708 void CSQC_Ent_Remove()
719 localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
720 calledhooks |= HOOK_START;
723 // 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.
724 void CSQC_Parse_StuffCmd(string strMessage)
726 localcmd(strMessage);
728 // 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.
729 void CSQC_Parse_Print(string strMessage)
731 print(ColorTranslateRGB(strMessage));
734 // CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
735 void CSQC_Parse_CenterPrint(string strMessage)
737 centerprint(strMessage);
740 string notranslate_fogcmd1 = "\nfog ";
741 string notranslate_fogcmd2 = "\nr_fog_exp2 0\nr_drawfog 1\n";
744 // TODO somehow thwart prvm_globalset client ...
747 localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2));
750 void Gamemode_Init();
751 void Ent_ScoresInfo()
754 self.classname = "ent_client_scores_info";
755 gametype = ReadByte();
756 for(i = 0; i < MAX_SCORE; ++i)
758 scores_label[i] = strzone(ReadString());
759 scores_flags[i] = ReadByte();
761 for(i = 0; i < MAX_TEAMSCORE; ++i)
763 teamscores_label[i] = strzone(ReadString());
764 teamscores_flags[i] = ReadByte();
772 self.classname = "ent_client_init";
774 nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
776 hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
777 hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
778 hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
779 hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
780 electro_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
781 electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
782 electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
783 electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
784 gauntlet_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
785 gauntlet_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
786 gauntlet_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
787 gauntlet_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
791 forcefog = strzone(ReadString());
793 armorblockpercent = ReadByte() / 255.0;
795 g_weaponswitchdelay = ReadByte() / 255.0;
797 g_balance_grenadelauncher_bouncefactor = ReadCoord();
798 g_balance_grenadelauncher_bouncestop = ReadCoord();
799 g_balance_electro_secondary_bouncefactor = ReadCoord();
800 g_balance_electro_secondary_bouncestop = ReadCoord();
802 nex_scope = !ReadByte();
803 rifle_scope = !ReadByte();
805 serverflags = ReadByte();
807 minelayer_maxmines = ReadByte();
809 hagar_maxrockets = ReadByte();
811 g_trueaim_minrange = ReadCoord();
825 case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
826 race_checkpoint = ReadByte();
827 race_time = ReadInt24_t();
828 race_previousbesttime = ReadInt24_t();
829 if(race_previousbestname)
830 strunzone(race_previousbestname);
831 race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
833 race_checkpointtime = time;
835 if(race_checkpoint == 0 || race_checkpoint == 254)
837 race_penaltyaccumulator = 0;
838 race_laptime = time; // valid
843 case RACE_NET_CHECKPOINT_CLEAR:
845 race_checkpointtime = 0;
848 case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
849 race_laptime = ReadCoord();
850 race_checkpointtime = -99999;
852 case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
853 race_nextcheckpoint = ReadByte();
855 race_nextbesttime = ReadInt24_t();
856 if(race_nextbestname)
857 strunzone(race_nextbestname);
858 race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
861 case RACE_NET_CHECKPOINT_HIT_RACE:
862 race_mycheckpoint = ReadByte();
863 race_mycheckpointtime = time;
864 race_mycheckpointdelta = ReadInt24_t();
865 race_mycheckpointlapsdelta = ReadByte();
866 if(race_mycheckpointlapsdelta >= 128)
867 race_mycheckpointlapsdelta -= 256;
868 if(race_mycheckpointenemy)
869 strunzone(race_mycheckpointenemy);
870 race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
873 case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
874 race_othercheckpoint = ReadByte();
875 race_othercheckpointtime = time;
876 race_othercheckpointdelta = ReadInt24_t();
877 race_othercheckpointlapsdelta = ReadByte();
878 if(race_othercheckpointlapsdelta >= 128)
879 race_othercheckpointlapsdelta -= 256;
880 if(race_othercheckpointenemy)
881 strunzone(race_othercheckpointenemy);
882 race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
885 case RACE_NET_PENALTY_RACE:
886 race_penaltyeventtime = time;
887 race_penaltytime = ReadShort();
888 //race_penaltyaccumulator += race_penaltytime;
889 if(race_penaltyreason)
890 strunzone(race_penaltyreason);
891 race_penaltyreason = strzone(ReadString());
894 case RACE_NET_PENALTY_QUALIFYING:
895 race_penaltyeventtime = time;
896 race_penaltytime = ReadShort();
897 race_penaltyaccumulator += race_penaltytime;
898 if(race_penaltyreason)
899 strunzone(race_penaltyreason);
900 race_penaltyreason = strzone(ReadString());
903 case RACE_NET_SERVER_RECORD:
904 race_server_record = ReadInt24_t();
906 case RACE_NET_SPEED_AWARD:
907 race_speedaward = ReadInt24_t();
908 if(race_speedaward_holder)
909 strunzone(race_speedaward_holder);
910 race_speedaward_holder = strzone(ReadString());
912 case RACE_NET_SPEED_AWARD_BEST:
913 race_speedaward_alltimebest = ReadInt24_t();
914 if(race_speedaward_alltimebest_holder)
915 strunzone(race_speedaward_alltimebest_holder);
916 race_speedaward_alltimebest_holder = strzone(ReadString());
918 case RACE_NET_SERVER_RANKINGS:
919 float pos, prevpos, del;
921 prevpos = ReadShort();
924 // move other rankings out of the way
927 for (i=prevpos-1;i>pos-1;--i) {
928 grecordtime[i] = grecordtime[i-1];
930 strunzone(grecordholder[i]);
931 grecordholder[i] = strzone(grecordholder[i-1]);
933 } else if (del) { // a record has been deleted by the admin
934 for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
935 if (i == RANKINGS_CNT-1) { // clear out last record
937 if (grecordholder[i])
938 strunzone(grecordholder[i]);
939 grecordholder[i] = string_null;
942 grecordtime[i] = grecordtime[i+1];
943 if (grecordholder[i])
944 strunzone(grecordholder[i]);
945 grecordholder[i] = strzone(grecordholder[i+1]);
948 } else { // player has no ranked record yet
949 for (i=RANKINGS_CNT-1;i>pos-1;--i) {
950 grecordtime[i] = grecordtime[i-1];
952 strunzone(grecordholder[i]);
953 grecordholder[i] = strzone(grecordholder[i-1]);
958 if(grecordholder[pos-1] != "")
959 strunzone(grecordholder[pos-1]);
960 grecordholder[pos-1] = strzone(ReadString());
961 grecordtime[pos-1] = ReadInt24_t();
962 if(grecordholder[pos-1] == GetPlayerName(player_localentnum -1))
965 case RACE_NET_SERVER_STATUS:
966 race_status = ReadShort();
968 strunzone(race_status_name);
969 race_status_name = strzone(ReadString());
976 current_viewzoom = 0.6;
979 void Net_TeamNagger()
984 void Net_ReadPingPLReport()
991 if not(playerslots[e])
993 playerslots[e].ping = pi;
994 playerslots[e].ping_packetloss = pl / 255.0;
995 playerslots[e].ping_movementloss = ml / 255.0;
998 void Net_WeaponComplain() {
999 complain_weapon = ReadByte();
1001 if(complain_weapon_name)
1002 strunzone(complain_weapon_name);
1003 complain_weapon_name = strzone(ReadString());
1005 complain_weapon_type = ReadByte();
1007 complain_weapon_time = time;
1008 weapontime = time; // ping the weapon panel
1011 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
1012 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
1013 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
1014 float CSQC_Parse_TempEntity()
1022 // NOTE: Could just do return instead of break...
1025 case TE_CSQC_TARGET_MUSIC:
1029 case TE_CSQC_PICTURE:
1030 Net_MapVote_Picture();
1041 case TE_CSQC_ZCURVEPARTICLES:
1042 Net_ReadZCurveParticles();
1045 case TE_CSQC_NEXGUNBEAMPARTICLE:
1046 Net_ReadNexgunBeamParticle();
1049 case TE_CSQC_TEAMNAGGER:
1053 case TE_CSQC_LIGHTNINGARC:
1054 Net_ReadLightningarc();
1057 case TE_CSQC_PINGPLREPORT:
1058 Net_ReadPingPLReport();
1061 case TE_CSQC_ANNOUNCE:
1062 Announcer_Play(ReadString());
1065 case TE_CSQC_KILLNOTIFY:
1066 HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadShort(), ReadByte());
1069 case TE_CSQC_KILLCENTERPRINT:
1070 HUD_KillCenterprint(ReadString(), ReadString(), ReadShort(), ReadByte());
1073 case TE_CSQC_CENTERPRINT_GENERIC:
1078 if (id != 0 && s != "")
1079 centerprint_generic(id, s, ReadByte(), ReadByte());
1081 centerprint_generic(id, s, 0, 0);
1084 case TE_CSQC_WEAPONCOMPLAIN:
1085 Net_WeaponComplain();
1088 case TE_CSQC_VEHICLESETUP:
1093 // No special logic for this temporary entity; return 0 so the engine can handle it
1101 string getcommandkey(string text, string command)
1106 if (!autocvar_hud_showbinds)
1109 keys = db_get(binddb, command);
1112 n = tokenize(findkeysforcommand(command)); // uses '...' strings
1113 for(j = 0; j < n; ++j)
1119 keys = keynumtostring(k);
1121 keys = strcat(keys, ", ", keynumtostring(k));
1124 if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break;
1128 db_put(binddb, command, keys);
1132 if (autocvar_hud_showbinds > 1)
1133 return sprintf(_("%s (not bound)"), text);
1137 else if (autocvar_hud_showbinds > 1)
1138 return sprintf(_("%s (%s)"), text, keys);