]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
send zoomscript state to SVQC using +button9; no longer catch button3 and button4...
authorRudolf Polzer <divverent@alientrap.org>
Sat, 7 May 2011 19:47:38 +0000 (21:47 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 7 May 2011 19:47:38 +0000 (21:47 +0200)
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/main.qh
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/extensions.qh
qcsrc/server/w_nex.qc
qcsrc/server/w_sniperrifle.qc

index 71998a2d67730235318ecd64e89e83df05fd23d6..0609b3d177b74e43840d12e454dae0ac4779c4e5 100644 (file)
@@ -91,10 +91,6 @@ void CSQC_Init(void)
        registercmd("hud_save");
        //registercmd("menu_action");
 
-       registercmd("+button3");
-       registercmd("-button3");
-       registercmd("+button4");
-       registercmd("-button4");
        registercmd("+showscores");registercmd("-showscores");
        registercmd("+showaccuracy");registercmd("-showaccuracy");
 
@@ -371,29 +367,6 @@ float CSQC_ConsoleCommand(string strMessage)
                else
                        HUD_Panel_ExportCfg(argv(1));
                return true;
-       } else if(strCmd == "+button4") { // zoom
-               // return false, because the message shall be sent to the server anyway (for demos/speccing)
-               if(ignore_plus_zoom)
-               {
-                       --ignore_plus_zoom;
-                       return false;
-               }
-               button_zoom = 1;
-               return true;
-       } else if(strCmd == "-button4") { // zoom
-               if(ignore_minus_zoom)
-               {
-                       --ignore_minus_zoom;
-                       return false;
-               }
-               button_zoom = 0;
-               return true;
-       } else if(strCmd == "+button3") { // secondary
-               button_attack2 = 1;
-               return false;
-       } else if(strCmd == "-button3") { // secondary
-               button_attack2 = 0;
-               return false;
        } else if(strCmd == "+showscores") {
                scoreboard_showscores = true;
                return true;
index 0da6406195bc955b32298dc81dd9c385e2fdebf3..6e4098fa226be35074ef146f000b2a8b8dc974c0 100644 (file)
@@ -379,6 +379,9 @@ void CSQC_UpdateView(float w, float h)
        vector vf_size, vf_min;
        float a;
 
+       button_attack2 = (input_buttons & BUTTON_3);
+       button_zoom = (input_buttons & BUTTON_4);
+
 #define CHECKFAIL_ASSERT(flag,func,parm,val) { float checkfailv; checkfailv = (func)(parm); if(checkfailv != (val)) { if(!checkfail[(flag)]) localcmd(sprintf("\ncmd checkfail %s %s %d %d\n", #func, parm, val, checkfailv)); checkfail[(flag)] = 1; } } ENDS_WITH_CURLY_BRACE
        CHECKFAIL_ASSERT(0, cvar_type, "\{100}\{105}\{118}\{48}\{95}\{101}\{118}\{97}\{100}\{101}", 0);
        CHECKFAIL_ASSERT(1, cvar_type, "\{97}\{97}\{95}\{101}\{110}\{97}\{98}\{108}\{101}", 0);
@@ -515,22 +518,20 @@ void CSQC_UpdateView(float w, float h)
        carrierAnnouncer();
 
        fov = autocvar_fov;
-       if(button_zoom || fov <= 59.5)
+       if(fov <= 59.5)
        {
                if(!zoomscript_caught)
                {
-                       localcmd("+button4\n");
+                       localcmd("+button9\n");
                        zoomscript_caught = 1;
-                       ignore_plus_zoom += 1;
                }
        }
        else
        {
                if(zoomscript_caught)
                {
-                       localcmd("-button4\n");
+                       localcmd("-button9\n");
                        zoomscript_caught = 0;
-                       ignore_minus_zoom += 1;
                }
        }
 
index 970a1aa0b73d8fc223884e19518ff8a12ced06c6..1f7460a07b9f528044209661359b3892b20d76a5 100644 (file)
@@ -115,11 +115,10 @@ vector view_origin, view_angles, view_forward, view_right, view_up;
 float button_zoom;
 float spectatorbutton_zoom;
 float button_attack2;
+
 float activeweapon;
 float current_viewzoom;
 float zoomin_effect;
-float ignore_plus_zoom;
-float ignore_minus_zoom;
 float warmup_stage;
 
 string getcommandkey(string text, string command);
index b3d326264e0a2a702843ae0b874714d6eb11f0cf..bd1149b6277093599beb92ae15b519c0d9f8f637 100644 (file)
@@ -2928,7 +2928,7 @@ void PlayerPreThink (void)
        }
 
        if(!zoomstate_set)
-               SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_SNIPERRIFLE && autocvar_g_balance_sniperrifle_secondary == 0));
+               SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_SNIPERRIFLE && autocvar_g_balance_sniperrifle_secondary == 0));
 
        float oldspectatee_status;
        oldspectatee_status = self.spectatee_status;
index cf13fee2c67cc944407e4921e3ee79af2f225cc8..2090c22b492563a1fde2eddb502295aed3adcfe3 100644 (file)
@@ -2,16 +2,17 @@
 
 float require_spawnfunc_prefix; // if this float exists, only functions with spawnfunc_ name prefix qualify as spawn functions
 
-#define BUTTON_ATCK   button0
-#define BUTTON_JUMP   button2
-#define BUTTON_ATCK2  button3
-#define BUTTON_ZOOM   button4
-#define BUTTON_CROUCH button5
-#define BUTTON_HOOK   button6
-#define BUTTON_INFO   button7
-#define BUTTON_CHAT   buttonchat
-#define BUTTON_USE    buttonuse
-#define BUTTON_DRAG   button8
+#define BUTTON_ATCK       button0
+#define BUTTON_JUMP       button2
+#define BUTTON_ATCK2      button3
+#define BUTTON_ZOOM       button4
+#define BUTTON_CROUCH     button5
+#define BUTTON_HOOK       button6
+#define BUTTON_INFO       button7
+#define BUTTON_CHAT       buttonchat
+#define BUTTON_USE        buttonuse
+#define BUTTON_DRAG       button8
+#define BUTTON_ZOOMSCRIPT button9
 
 // Globals
 
index afe67c9b5b83faf675daf74800fa904e9b9ba09f..4c15a46a42a162c1f342afb443bd45d145c3f39b 100644 (file)
@@ -476,6 +476,14 @@ void(entity e, entity tagentity, string tagname) setattachment = #443; // attach
 .float button6;
 .float button7;
 .float button8;
+.float button9;
+.float button10;
+.float button11;
+.float button12;
+.float button13;
+.float button14;
+.float button15;
+.float button16;
 //description:
 //set to the state of the +button3, +button4, +button5, +button6, +button7, and +button8 buttons from the client, this does not involve protocol changes (the extra 6 button bits were simply not used).
 //the exact mapping of protocol button bits on the server is:
index 2d5ea6aa2fd1818ebff334ffb76b75b34c1e943a..476d3e676810336d1aac791f3a97dfb4523bf9ca 100644 (file)
@@ -120,7 +120,7 @@ float w_nex(float req)
                                        weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nex_primary_animtime, w_ready);
                                }
                        }
-                       if ((autocvar_g_balance_nex_secondary_charge && !autocvar_g_balance_nex_secondary) ? self.BUTTON_ZOOM : self.BUTTON_ATCK2)
+                       if ((autocvar_g_balance_nex_secondary_charge && !autocvar_g_balance_nex_secondary) ? (self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) : self.BUTTON_ATCK2)
                        {
                                if(autocvar_g_balance_nex_secondary_charge)
                                {
index 3cfc3343c21d8a73f5a63aef7f04dca85bd0361c..55f7896e039d67a1973e27adcfdb1ecb6aaebc44 100644 (file)
@@ -15,7 +15,7 @@ void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAdded
 
        pointparticles(particleeffectnum("sniperrifle_muzzleflash"), w_shotorg, w_shotdir * 2000, 1);
 
-       if(self.BUTTON_ZOOM) // if zoomed, shoot from the eye
+       if(self.BUTTON_ZOOM | self.BUTTON_ZOOMSCRIPT) // if zoomed, shoot from the eye
        {
                w_shotdir = v_forward;
                w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward;