]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Abuse a button slot to tell the server when a player is playing a minigame
authorMario <mario@smbclan.net>
Sat, 22 Sep 2018 05:17:01 +0000 (15:17 +1000)
committerMario <mario@smbclan.net>
Sat, 22 Sep 2018 05:17:01 +0000 (15:17 +1000)
qcsrc/client/hud/hud.qc
qcsrc/client/view.qc
qcsrc/common/physics/player.qh
qcsrc/server/client.qc

index a00accb0e8e917698b19ac36e488995412f9c0dc..bee8d0568ec2ac1afe7b7ba2704cb3dc77b08f9f 100644 (file)
@@ -574,7 +574,7 @@ bool HUD_WouldShowCursor()
                //return true;
        if(HUD_Radar_Clickable())
                return true;
-       if(HUD_MinigameMenu_IsOpened() || active_minigame)
+       if(HUD_MinigameMenu_IsOpened())
                return true;
        if(QuickMenu_IsOpened())
                return true;
index 2341cec7797120e9b69617d607767fb3c3f86106..00c3001c16a523abb107f795fea3612eb059e167 100644 (file)
@@ -633,6 +633,8 @@ vector GetOrthoviewFOV(vector ov_worldmin, vector ov_worldmax, vector ov_mid, ve
 // this function must match W_SetupShot!
 float zoomscript_caught;
 
+bool minigame_wasactive;
+
 vector wcross_origin;
 float wcross_scale_prev, wcross_alpha_prev;
 vector wcross_color_prev;
@@ -1592,7 +1594,7 @@ void HUD_Mouse(entity player)
                HUD_Panel_Mouse();
        else
        {
-               if (HUD_MinigameMenu_IsOpened() || active_minigame)
+               if (HUD_MinigameMenu_IsOpened())
                        HUD_Minigame_Mouse();
                if (QuickMenu_IsOpened())
                        QuickMenu_Mouse();
@@ -2010,6 +2012,20 @@ void CSQC_UpdateView(entity this, float w, float h)
                }
        }
 
+       if(active_minigame && HUD_MinigameMenu_IsOpened())
+       {
+               if(!minigame_wasactive)
+               {
+                       localcmd("+button14\n");
+                       minigame_wasactive = true;
+               }
+       }
+       else if(minigame_wasactive)
+       {
+               localcmd("-button14\n");
+               minigame_wasactive = false;
+       }
+
        ColorTranslateMode = autocvar_cl_stripcolorcodes;
 
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
index 478789dc2e784d51d708382273ac1a106f84a5da..29c028f03267500aed3f84994ff0b524e14c6c7c 100644 (file)
@@ -109,6 +109,7 @@ bool IsFlying(entity a);
 #define PHYS_INPUT_BUTTON_ZOOMSCRIPT(s)     PHYS_INPUT_BUTTON_BUTTON9(s)
 #define PHYS_INPUT_BUTTON_JETPACK(s)        PHYS_INPUT_BUTTON_BUTTON10(s)
 #define PHYS_INPUT_BUTTON_DODGE(s)                     PHYS_INPUT_BUTTON_BUTTON11(s)
+#define PHYS_INPUT_BUTTON_MINIGAME(s)          PHYS_INPUT_BUTTON_BUTTON14(s)
 
 #ifdef CSQC
 STATIC_INIT(PHYS_INPUT_BUTTON)
index da0d84979f5e139531a89f86f410184b51ea7759..9171444d8762ae3833a7fda6efc4e2dec07dcbe5 100644 (file)
@@ -1236,7 +1236,7 @@ void ChatBubbleThink(entity this)
 
        if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) )
        {
-               if ( CS(this.owner).active_minigame )
+               if ( CS(this.owner).active_minigame && PHYS_INPUT_BUTTON_MINIGAME(this.owner) )
                        this.mdl = "models/sprites/minigame_busy.iqm";
                else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
                        this.mdl = "models/misc/chatbubble.spr";
@@ -2674,7 +2674,7 @@ void PM_UpdateButtons(entity this, entity store)
                store.impulse = this.impulse;
        this.impulse = 0;
 
-       bool typing = this.buttonchat;
+       bool typing = this.buttonchat || this.button14;
 
        store.button0 = (typing) ? 0 : this.button0;
        //button1?!