]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix some bugs in minigames
authorMattia Basaglia <mattia.basaglia@gmail.com>
Fri, 6 Feb 2015 16:30:52 +0000 (17:30 +0100)
committerMattia Basaglia <mattia.basaglia@gmail.com>
Fri, 6 Feb 2015 16:30:52 +0000 (17:30 +0100)
qcsrc/common/minigames/cl_minigames.qc
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/minigame/ttt.qc

index 8a715555c0b305f4829a28ce2683eec8e045e712..e9a8a4b414a2ce93778765da2601870846bfc884 100644 (file)
@@ -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();
index fd6e9bc67eb16598e427fe7467bd448a8d0db632..c578fb3c1397fe74962c8c099e2d48e03d8a618b 100644 (file)
@@ -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() )
index e8313d4f5b94c1d12fc26ba7203f91214e713cfa..2823d68301bf31695058f212746086c2b0ecaf77 100644 (file)
@@ -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",