]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Move hud_panel_engineinfo_framecounter_decimals and hud_panel_engineinfo_framecounter...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 96b3caa75e3b8efbe5585da89e65ff85de0b4399..e4661468d8a8c050f44d19aea9973131b0023f6b 100644 (file)
@@ -11,6 +11,7 @@
 #include "commands/cl_cmd.qh"
 #include "mapvoting.qh"
 #include <client/mutators/_mod.qh>
+#include "hud/panel/centerprint.qh"
 #include "hud/panel/scoreboard.qh"
 #include "hud/panel/quickmenu.qh"
 #include "shownames.qh"
@@ -136,13 +137,17 @@ void CSQC_Init()
 
        registercvar("cl_shootfromfixedorigin", "");
 
-       registercvar("cl_multijump", "1");
+       registercvar("cl_multijump", "-1");
+
+       registercvar("cl_dodging", "0");
 
        registercvar("cl_spawn_near_teammate", "1");
 
        registercvar("cl_weapon_switch_reload", "1");
        registercvar("cl_weapon_switch_fallback_to_impulse", "1");
 
+       registercvar("cl_allow_uidranking", "1");
+
        if(autocvar_cl_lockview)
                cvar_set("cl_lockview", "0");
 
@@ -226,17 +231,19 @@ void Shutdown()
 
        localcmd("\ncl_hook_shutdown\n");
 
-       localcmd("\n-button14\n");
+       localcmd("\n-button12\n");
 
        deactivate_minigame();
        HUD_MinigameMenu_Close(NULL, NULL, NULL);
+
+       ReplicateVars(true); // destroy
 }
 
 .float has_team;
 bool SetTeam(entity o, int Team)
 {
        TC(int, Team);
-       devassert_once(Team);
+       //devassert_once(Team);
        entity tm;
        if(teamplay)
        {
@@ -308,7 +315,7 @@ bool SetTeam(entity o, int Team)
 
 void Playerchecker_Think(entity this)
 {
-    int i;
+       int i;
        entity e;
        for(i = 0; i < maxclients; ++i)
        {
@@ -667,33 +674,15 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew)
 
 void Spawn_Draw(entity this)
 {
-       if(this.alpha <= 0)
-               return;
-
-       __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
-}
-
-void Spawn_PreDraw(entity this)
-{
-       float alph;
-       vector org = getpropertyvec(VF_ORIGIN);
-       if(this.fade_start)
+       bool dodraw = autocvar_cl_spawn_point_particles;
+       if(dodraw && autocvar_cl_spawn_point_dist_max)
        {
-               if(vdist(org - this.origin, >, this.fade_end))
-                       alph = 0; // save on some processing
-               else if(vdist(org - this.origin, <, this.fade_start))
-                       alph = 1; // more processing saved
-               else
-                       alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+               vector org = getpropertyvec(VF_ORIGIN);
+               dodraw = vdist(org - this.origin, <, autocvar_cl_spawn_point_dist_max);
        }
-       else
-               alph = 1;
-       //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
-       this.alpha = alph;
-       if(alph <= 0)
-               this.drawmask = 0;
-       else
-               this.drawmask = MASK_NORMAL;
+
+       if(dodraw)
+               pointparticles(((!teamplay) ? EFFECT_SPAWNPOINT_NEUTRAL : EFFECT_SPAWNPOINT(this.team - 1)), this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
 }
 
 NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new)
@@ -720,27 +709,8 @@ NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new)
                        //this.draw = Spawn_Draw;
                        IL_PUSH(g_drawables, this);
                }*/
-               if(autocvar_cl_spawn_point_particles)
-               {
-                       if(teamplay)
-                       {
-                               switch(teamnum)
-                               {
-                                       case NUM_TEAM_1: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_RED); break;
-                                       case NUM_TEAM_2: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_BLUE); break;
-                                       case NUM_TEAM_3: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_YELLOW); break;
-                                       case NUM_TEAM_4: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_PINK); break;
-                                       default: this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_NEUTRAL); break;
-                               }
-                       }
-                       else { this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_NEUTRAL); }
-
-                       this.draw = Spawn_Draw;
-                       if (is_new) IL_PUSH(g_drawables, this);
-                       setpredraw(this, Spawn_PreDraw);
-                       this.fade_start = autocvar_cl_spawn_point_dist_min;
-                       this.fade_end = autocvar_cl_spawn_point_dist_max;
-               }
+               this.draw = Spawn_Draw;
+               if (is_new) IL_PUSH(g_drawables, this);
        //}
 
        //printf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d, effect = %d\n", is_new, vtos(this.origin), teamnum, this.cnt);
@@ -914,11 +884,11 @@ void CSQC_Parse_Print(string strMessage)
        print(ColorTranslateRGB(strMessage));
 }
 
-// CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
+// CSQC_Parse_CenterPrint : Provides the centerprint_AddStandard string in the first parameter that the server provided.
 void CSQC_Parse_CenterPrint(string strMessage)
 {
        if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_CenterPrint(\"%s\")", strMessage);
-       centerprint_hud(strMessage);
+       centerprint_AddStandard(strMessage);
 }
 
 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
@@ -1121,17 +1091,15 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        break;
 
                case RACE_NET_PENALTY_RACE:
-                       race_penaltyeventtime = time;
-                       race_penaltytime = ReadShort();
-                       //race_penaltyaccumulator += race_penaltytime;
-                       strcpy(race_penaltyreason, ReadString());
-                       break;
-
                case RACE_NET_PENALTY_QUALIFYING:
                        race_penaltyeventtime = time;
                        race_penaltytime = ReadShort();
-                       race_penaltyaccumulator += race_penaltytime;
-                       strcpy(race_penaltyreason, ReadString());
+                       string reason = ReadString();
+                       if (reason == "missing a checkpoint")
+                               reason = _("missing a checkpoint");
+                       strcpy(race_penaltyreason, reason);
+                       if (b == RACE_NET_PENALTY_QUALIFYING)
+                               race_penaltyaccumulator += race_penaltytime;
                        break;
 
                case RACE_NET_SERVER_RECORD:
@@ -1152,12 +1120,12 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        break;
                case RACE_NET_SERVER_RANKINGS:
                        float prevpos, del;
-            int pos = ReadShort();
+                       int pos = ReadShort();
                        prevpos = ReadShort();
                        del = ReadShort();
 
                        // move other rankings out of the way
-            int i;
+                       int i;
                        if (prevpos) {
                                int m = min(prevpos, RANKINGS_DISPLAY_CNT);
                                for (i=m-1; i>pos-1; --i) {
@@ -1224,7 +1192,7 @@ NET_HANDLE(TE_CSQC_PINGPLREPORT, bool isNew)
 NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew)
 {
        int weapon_id = ReadByte();
-       complain_weapon = Weapons_from(weapon_id);
+       complain_weapon = REGISTRY_GET(Weapons, weapon_id);
        complain_weapon_type = ReadByte();
        return = true;
 
@@ -1261,6 +1229,8 @@ string _getcommandkey(string cmd_name, string command, bool forcename)
                                if(!joy_active && substring(key, 0, 3) == "JOY")
                                        continue;
 
+                               key = translate_key(key);
+
                                if (keys == "")
                                        keys = key;
                                else