X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fminigames%2Fminigame%2Fpp.qc;h=5a46aa91452f1ef37882514be28d20b52f48ae8e;hb=0514f7948727cfa572b33bd29d1bdf2c13cd866d;hp=0b1d74344e93f09fbe00877ecc2c8e6818c328ed;hpb=bc3f297ed082b23fb33dd0d8f5dcd33bb0198507;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/minigames/minigame/pp.qc b/qcsrc/common/minigames/minigame/pp.qc index 0b1d74344..5a46aa914 100644 --- a/qcsrc/common/minigames/minigame/pp.qc +++ b/qcsrc/common/minigames/minigame/pp.qc @@ -1,5 +1,5 @@ #include "pp.qh" -REGISTER_MINIGAME(pp, "Push-Pull"); +REGISTER_MINIGAME(pp, _("Push-Pull")); const int PP_TURN_PLACE = 0x0100; // player has to place a piece on the board const int PP_TURN_WIN = 0x0200; // player has won @@ -125,7 +125,7 @@ void pp_move(entity minigame, entity player, string pos ) delete(existing); } - entity piece = msle_spawn(minigame,"minigame_board_piece"); + entity piece = msle_spawn(minigame,new(minigame_board_piece)); piece.cnt = 1; piece.team = player.team; // temporary piece.netname = strzone(pos); @@ -157,7 +157,7 @@ void pp_setup_pieces(entity minigame) if(t1_true || t2_true) { - entity piece = msle_spawn(minigame,"minigame_board_piece"); + entity piece = msle_spawn(minigame,new(minigame_board_piece)); piece.team = ((t1_true) ? 1 : 2); piece.netname = strzone(minigame_tile_buildname(i,t)); minigame_server_sendflags(piece,MINIG_SF_ALL); @@ -359,13 +359,13 @@ void pp_hud_board(vector pos, vector mySize) 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!",pname), + 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!",pname), + sprintf(_("%s^7 won the game!"), pname), winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5); } } @@ -439,9 +439,10 @@ string pp_turn_to_string(int turnflags) if ( turnflags & PP_TURN_WIN ) { + // translator-friendly messages composed of 2 existing messages if ( (turnflags&PP_TURN_TEAM) != minigame_self.team ) - return _("You lost the game!\nSelect \"^1Next Match^7\" on the menu for a rematch!"); - return _("You win!\nSelect \"^1Next Match^7\" on the menu to start a new match!"); + return strcat(_("You lost the game!"), "\n", _("Select \"^1Next Match^7\" on the menu for a rematch!")); + return strcat(_("You win!"), "\n", _("Select \"^1Next Match^7\" on the menu to start a new match!")); } if ( turnflags & PP_TURN_NEXT ) @@ -485,7 +486,12 @@ int pp_client_event(entity minigame, string event, ...) case "activate": { pp_set_curr_pos(""); - minigame.message = pp_turn_to_string(minigame.minigame_flags); + strcpy(minigame.message, pp_turn_to_string(minigame.minigame_flags)); + return false; + } + case "deactivate": + { + strfree(minigame.message); return false; } case "key_pressed": @@ -560,7 +566,7 @@ int pp_client_event(entity minigame, string event, ...) { if ( sf & MINIG_SF_UPDATE ) { - sent.message = pp_turn_to_string(sent.minigame_flags); + strcpy(sent.message, pp_turn_to_string(sent.minigame_flags)); if ( sent.minigame_flags & minigame_self.team ) minigame_prompt(); sent.pp_team1_score = ReadByte();