From f46d2fbc6351292c9eb336d813b22c2eb01dcdb8 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 22 Sep 2018 15:17:01 +1000 Subject: [PATCH] Abuse a button slot to tell the server when a player is playing a minigame --- qcsrc/client/hud/hud.qc | 2 +- qcsrc/client/view.qc | 18 +++++++++++++++++- qcsrc/common/physics/player.qh | 1 + qcsrc/server/client.qc | 4 ++-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/qcsrc/client/hud/hud.qc b/qcsrc/client/hud/hud.qc index a00accb0e..bee8d0568 100644 --- a/qcsrc/client/hud/hud.qc +++ b/qcsrc/client/hud/hud.qc @@ -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; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 2341cec77..00c3001c1 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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) diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 478789dc2..29c028f03 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -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) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index da0d84979..9171444d8 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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?! -- 2.39.2