]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/minigames/minigame/ttt.qc
Merge branch 'master' into terencehill/hud_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / minigames / minigame / ttt.qc
index 630462aa9fda2bc060f0605bb40e6e00e68a8560..e06bb46628c5366db60f07a129feaf0cc18358f7 100644 (file)
@@ -1,3 +1,4 @@
+#include "ttt.qh"
 REGISTER_MINIGAME(ttt, "Tic Tac Toe");
 
 const int TTT_TURN_PLACE = 0x0100; // player has to place a piece on the board
@@ -272,7 +273,7 @@ void ttt_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void ttt_hud_status(vector pos, vector mySize)
 {
-       HUD_Panel_DrawBg(1);
+       HUD_Panel_DrawBg();
        vector ts;
        ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
                hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);
@@ -421,7 +422,7 @@ int ttt_ai_random(int piecemask)
                f <<= 1;
        }
 
-       LOG_TRACE(sprintf("TTT AI: selected %x from %x\n",
+       LOG_TRACE(sprintf("TTT AI: selected %x from %x",
                        RandomSelection_chosen_float, piecemask) );
        return RandomSelection_chosen_float;
 }
@@ -439,7 +440,7 @@ int ttt_ai_block3 ( int piecemask, int piecemask_free )
        r |= ttt_ai_1of3(piecemask,TTT_AI_POSFLAG_A3,TTT_AI_POSFLAG_B3,TTT_AI_POSFLAG_C3);
        r |= ttt_ai_1of3(piecemask,TTT_AI_POSFLAG_A1,TTT_AI_POSFLAG_B2,TTT_AI_POSFLAG_C3);
        r |= ttt_ai_1of3(piecemask,TTT_AI_POSFLAG_A3,TTT_AI_POSFLAG_B2,TTT_AI_POSFLAG_C1);
-       LOG_TRACE(sprintf("TTT AI: possible 3 in a rows in %x: %x (%x)\n",piecemask,r, r&piecemask_free));
+       LOG_TRACE(sprintf("TTT AI: possible 3 in a rows in %x: %x (%x)",piecemask,r, r&piecemask_free));
        r &= piecemask_free;
        return ttt_ai_random(r);
 }
@@ -452,15 +453,15 @@ string ttt_ai_choose_simple(int piecemask_self, int piecemask_opponent, int piec
 {
        int move = 0;
 
-       LOG_TRACE("TTT AI: checking winning move\n");
+       LOG_TRACE("TTT AI: checking winning move");
        if (( move = ttt_ai_block3(piecemask_self,piecemask_free) ))
                return ttt_ai_piece_flag2pos(move); // place winning move
 
-       LOG_TRACE("TTT AI: checking opponent's winning move\n");
+       LOG_TRACE("TTT AI: checking opponent's winning move");
        if (( move = ttt_ai_block3(piecemask_opponent,piecemask_free) ))
                return ttt_ai_piece_flag2pos(move); // block opponent
 
-       LOG_TRACE("TTT AI: random move\n");
+       LOG_TRACE("TTT AI: random move");
        return ttt_ai_piece_flag2pos(ttt_ai_random(piecemask_free));
 }
 
@@ -510,12 +511,12 @@ void ttt_aimove(entity minigame)
                }
 
                // TODO multiple AI difficulties
-               LOG_TRACE(sprintf("TTT AI: self: %x opponent: %x free: %x\n",
+               LOG_TRACE(sprintf("TTT AI: self: %x opponent: %x free: %x",
                                piecemask_self, piecemask_opponent, piecemask_free));
                pos = ttt_ai_choose_simple(piecemask_self, piecemask_opponent, piecemask_free);
-               LOG_TRACE("TTT AI: chosen move: ",pos,"\n\n");
+               LOG_TRACE("TTT AI: chosen move: ", pos);
                if ( !pos )
-                       LOG_TRACE("Tic Tac Toe AI has derped!\n");
+                       LOG_TRACE("Tic Tac Toe AI has derped!");
                else
                        ttt_move(minigame,aiplayer,pos);
        }