From: Mattia Basaglia Date: Fri, 6 Feb 2015 16:30:52 +0000 (+0100) Subject: Fix some bugs in minigames X-Git-Tag: xonotic-v0.8.2~2038^2~31 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c3fcc8bea8d62c9f319ddc2ae44f7c3344c282ff;p=xonotic%2Fxonotic-data.pk3dir.git Fix some bugs in minigames --- diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index 8a715555c..e9a8a4b41 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -102,9 +102,8 @@ void HUD_MinigameMenu_CurrentButton(); bool auto_close_minigamemenu; void deactivate_minigame() { - if ( !active_minigame ) + if ( !active_minigame || active_minigame != self ) return; - active_minigame.minigame_event(active_minigame,"deactivate"); entity e = world; while( (e = findentity(e, owner, self)) ) @@ -115,7 +114,7 @@ void deactivate_minigame() minigame_self = world; active_minigame = world; - + if ( auto_close_minigamemenu ) { HUD_MinigameMenu_Close(); diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index fd6e9bc67..c578fb3c1 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -1,7 +1,8 @@ #include "minigames.qh" #include "../../client/mapvoting.qh" -float HUD_mouse_over(entity somepanel) +// whether the mouse is over the given panel +bool HUD_mouse_over(entity somepanel) { vector pos = stov(cvar_string(strcat("hud_panel_", somepanel.panel_name, "_pos"))); vector sz = stov(cvar_string(strcat("hud_panel_", somepanel.panel_name, "_size"))); @@ -13,6 +14,7 @@ float HUD_mouse_over(entity somepanel) // Minigame Board // ==================================================================== +// Draws the minigame game board void HUD_MinigameBoard () { entity hud_minigame = world; @@ -38,6 +40,7 @@ void HUD_MinigameBoard () // ==================================================================== // Minigame Status // ==================================================================== +// Draws the minigame status panel void HUD_MinigameStatus () { entity hud_minigame = world; @@ -188,6 +191,8 @@ bool HUD_MinigameMenu_Click_ExpandCollapse() } if ( self.list_next ) self.list_next.list_prev = self; + else + HUD_MinigameMenu_last_entry = self; } else { @@ -310,7 +315,7 @@ void HUD_MinigameMenu_CustomEntry(entity parent, string menumessage, string even menumessage, HUD_MinigameMenu_ClickCustomEntry, parent ); e.netname = event_arg; HUD_MinigameMenu_InsertEntry(e, parent); - dprint("CustomEntry ",ftos(num_for_edict(parent))," ",menumessage," ",event_arg,"\n"); + //dprint("CustomEntry ",ftos(num_for_edict(parent))," ",menumessage," ",event_arg,"\n"); } // Click action for the Current Game menu @@ -460,7 +465,7 @@ void HUD_MinigameMenu_DrawColoredEntry(vector pos, string s, vector fontsize) fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); } -// minigame menu panel UI +// Minigame menu panel UI void HUD_MinigameMenu () { if ( !HUD_MinigameMenu_IsOpened() ) diff --git a/qcsrc/common/minigames/minigame/ttt.qc b/qcsrc/common/minigames/minigame/ttt.qc index e8313d4f5..2823d6830 100644 --- a/qcsrc/common/minigames/minigame/ttt.qc +++ b/qcsrc/common/minigames/minigame/ttt.qc @@ -484,8 +484,8 @@ void ttt_aimove(entity minigame) int piecemask_free = 0; int pieceflag = 1; string pos; - for ( int i = 0; i < 3; i++ ) + { for ( int j = 0; j < 3; j++ ) { pos = minigame_tile_buildname(i,j); @@ -501,6 +501,7 @@ void ttt_aimove(entity minigame) piecemask_free |= pieceflag; pieceflag <<= 1; } + } // TODO multiple AI difficulties dprint(sprintf("TTT AI: self: %x opponent: %x free: %x\n",