]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/minigames/minigame/ttt.qc
Merge branch 'terencehill/csqc_input_stuff' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / minigames / minigame / ttt.qc
index bb642a282aa6c9acb9634d96b7f8d17422c3c74f..530243dc3a870f1bc58e6255320813ca71b85a9e 100644 (file)
@@ -565,13 +565,18 @@ int ttt_client_event(entity minigame, string event, ...)
                        return false;
                }
                case "key_pressed":
+               case "key_released":
                {
-                       if((minigame.minigame_flags & TTT_TURN_TEAM) == minigame_self.team)
+                       bool event_blocked = ((event == "key_released")
+                               || ((minigame.minigame_flags & TTT_TURN_TEAM) != minigame_self.team));
+                       if (!(minigame.minigame_flags & TTT_TURN_WIN) && !(minigame.minigame_flags & TTT_TURN_DRAW))
                        {
                                switch ( ...(0,int) )
                                {
                                        case K_RIGHTARROW:
                                        case K_KP_RIGHTARROW:
+                                               if (event_blocked)
+                                                       return true;
                                                if ( ! ttt_curr_pos )
                                                        ttt_set_curr_pos("a3");
                                                else
@@ -579,6 +584,8 @@ int ttt_client_event(entity minigame, string event, ...)
                                                return true;
                                        case K_LEFTARROW:
                                        case K_KP_LEFTARROW:
+                                               if (event_blocked)
+                                                       return true;
                                                if ( ! ttt_curr_pos )
                                                        ttt_set_curr_pos("c3");
                                                else
@@ -586,6 +593,8 @@ int ttt_client_event(entity minigame, string event, ...)
                                                return true;
                                        case K_UPARROW:
                                        case K_KP_UPARROW:
+                                               if (event_blocked)
+                                                       return true;
                                                if ( ! ttt_curr_pos )
                                                        ttt_set_curr_pos("a1");
                                                else
@@ -593,6 +602,8 @@ int ttt_client_event(entity minigame, string event, ...)
                                                return true;
                                        case K_DOWNARROW:
                                        case K_KP_DOWNARROW:
+                                               if (event_blocked)
+                                                       return true;
                                                if ( ! ttt_curr_pos )
                                                        ttt_set_curr_pos("a3");
                                                else
@@ -601,6 +612,8 @@ int ttt_client_event(entity minigame, string event, ...)
                                        case K_ENTER:
                                        case K_KP_ENTER:
                                        case K_SPACE:
+                                               if (event_blocked)
+                                                       return true;
                                                ttt_make_move(minigame);
                                                return true;
                                }
@@ -612,6 +625,7 @@ int ttt_client_event(entity minigame, string event, ...)
                {
                        if(...(0,int) == K_MOUSE1)
                        {
+                               ttt_client_event(minigame, "mouse_moved");
                                ttt_make_move(minigame);
                                return true;
                        }