]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/minigames/minigame/c4.qc
Merge branch 'master' into terencehill/bot_waypoints
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / minigames / minigame / c4.qc
index 3c2beacb6fc20c3f1e0c87ecfbb93cab7ff41e39..be65e6ac13528bc4446b8b0e1ee8768636387fff 100644 (file)
@@ -1,4 +1,5 @@
-REGISTER_MINIGAME(c4, "Connect Four");
+#include "c4.qh"
+REGISTER_MINIGAME(c4, _("Connect Four"));
 
 const float C4_TURN_PLACE = 0x0100; // player has to place a piece on the board
 const float C4_TURN_WIN   = 0x0200; // player has won
@@ -200,8 +201,8 @@ int c4_server_event(entity minigame, string event, ...)
                        while( (e = findentity(e, owner, minigame)) )
                        if(e.classname == "minigame_board_piece")
                        {
-                               if(e.netname) { strunzone(e.netname); }
-                               remove(e);
+                               strfree(e.netname);
+                               delete(e);
                        }
                        return false;
                }
@@ -298,22 +299,22 @@ void c4_hud_board(vector pos, vector mySize)
        if ( active_minigame.minigame_flags & C4_TURN_WIN )
        {
                vector winfs = hud_fontsize*2;
-               string playername = "";
+               string pname = "";
                FOREACH_MINIGAME_ENTITY(e)
                        if ( e.classname == "minigame_player" &&
                                        e.team == (active_minigame.minigame_flags & C4_TURN_TEAM) )
-                               playername = entcs_GetName(e.minigame_playerslot-1);
+                               pname = entcs_GetName(e.minigame_playerslot-1);
 
                vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
                vector win_sz;
                win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
-                       sprintf("%s^7 won the game!",playername),
+                       sprintf(_("%s^7 won the game!"), pname),
                        winfs, 0, DRAWFLAG_NORMAL, 0.5);
 
                drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE);
 
                minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
-                       sprintf("%s^7 won the game!",playername),
+                       sprintf(_("%s^7 won the game!"), pname),
                        winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5);
        }
 }
@@ -322,7 +323,7 @@ void c4_hud_board(vector pos, vector mySize)
 // Required function, draw the game status panel
 void c4_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);
@@ -398,8 +399,7 @@ void c4_make_move(entity minigame)
 
 void c4_set_curr_pos(string s)
 {
-       if ( c4_curr_pos )
-               strunzone(c4_curr_pos);
+       strfree(c4_curr_pos);
        if ( s )
                s = strzone(s);
        c4_curr_pos = s;
@@ -413,7 +413,12 @@ int c4_client_event(entity minigame, string event, ...)
                case "activate":
                {
                        c4_set_curr_pos("");
-                       minigame.message = c4_turn_to_string(minigame.minigame_flags);
+                       strcpy(minigame.message, c4_turn_to_string(minigame.minigame_flags));
+                       return false;
+               }
+               case "deactivate":
+               {
+                       strfree(minigame.message);
                        return false;
                }
                case "key_pressed":
@@ -490,7 +495,7 @@ int c4_client_event(entity minigame, string event, ...)
                        {
                                if ( sf & MINIG_SF_UPDATE )
                                {
-                                       sent.message = c4_turn_to_string(sent.minigame_flags);
+                                       strcpy(sent.message, c4_turn_to_string(sent.minigame_flags));
                                        if ( sent.minigame_flags & minigame_self.team )
                                                minigame_prompt();
                                }