X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fminigames%2Fminigame%2Fpp.qc;h=0811ba28e04bcf97bbb946d10db135dff15e9131;hb=HEAD;hp=4a445fa45c3a356f93d54e1367f84f1facd279cd;hpb=4e21f418ad9e6287efb942c1fa2861a51981110a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/minigames/minigame/pp.qc b/qcsrc/common/minigames/minigame/pp.qc index 4a445fa45..0811ba28e 100644 --- a/qcsrc/common/minigames/minigame/pp.qc +++ b/qcsrc/common/minigames/minigame/pp.qc @@ -11,7 +11,7 @@ const int PP_TURN_TEAM1 = 0x0001; const int PP_TURN_TEAM2 = 0x0002; const int PP_TURN_TEAM = 0x000f; // turn team mask -const int PP_BLOCKED_TEAM = 5; // there won't ever be a 5th team, so we can abuse this +const int PP_SPECTATOR_TEAM = 255; // must be above max teams and equal to or below 255 const int PP_LET_CNT = 7; const int PP_NUM_CNT = 7; @@ -225,7 +225,7 @@ int pp_server_event(entity minigame, string event, ...) int pl_num = minigame_count_players(minigame); // Don't allow more than 2 players - if(pl_num >= 2) { return false; } + if(pl_num >= 2) { return PP_SPECTATOR_TEAM; } // Get the right team if(minigame.minigame_players) @@ -236,12 +236,18 @@ int pp_server_event(entity minigame, string event, ...) } case "cmd": { + entity player = ...(0,entity); + bool event_blocked = (player.team == PP_SPECTATOR_TEAM); switch(argv(0)) { case "move": + if(event_blocked) + return true; pp_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); return true; case "next": + if(event_blocked) + return true; pp_next_match(minigame,...(0,entity)); return true; } @@ -362,12 +368,14 @@ void pp_hud_board(vector pos, vector mySize) 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); + drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5*panel_fg_alpha,DRAWFLAG_ADDITIVE); minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, sprintf(_("%s^7 won the game!"), pname), winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5); } + + minigame_show_allspecs(pp_boardpos, pp_boardsize); } @@ -388,17 +396,20 @@ void pp_hud_status(vector pos, vector mySize) vector mypos; vector tile_size = '48 48 0'; - mypos = pos; - if ( (active_minigame.minigame_flags&PP_TURN_TEAM) == 2 ) - mypos_y += player_fontsize_y + ts_y; - drawfill(mypos,eX*mySize_x+eY*player_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE); - mypos_y += player_fontsize_y; - drawfill(mypos,eX*mySize_x+eY*tile_size_y,'1 1 1',0.25,DRAWFLAG_ADDITIVE); + if(minigame_self.team != PP_SPECTATOR_TEAM) + { + mypos = pos; + if ( (active_minigame.minigame_flags&PP_TURN_TEAM) == 2 ) + mypos_y += player_fontsize_y + ts_y; + drawfill(mypos,eX*mySize_x+eY*player_fontsize_y,'1 1 1',0.5*panel_fg_alpha,DRAWFLAG_ADDITIVE); + mypos_y += player_fontsize_y; + drawfill(mypos,eX*mySize_x+eY*tile_size_y,'1 1 1',0.25*panel_fg_alpha,DRAWFLAG_ADDITIVE); + } entity e; FOREACH_MINIGAME_ENTITY(e) { - if ( e.classname == "minigame_player" ) + if ( e.classname == "minigame_player" && e.team != PP_SPECTATOR_TEAM ) { vector tile_color = '1 1 1'; switch(e.team) @@ -434,13 +445,16 @@ void pp_hud_status(vector pos, vector mySize) // Turn a set of flags into a help message string pp_turn_to_string(int turnflags) { + if(minigame_self.team == PP_SPECTATOR_TEAM) + return _("You are spectating"); + if ( turnflags & PP_TURN_DRAW ) return _("Draw"); if ( turnflags & PP_TURN_WIN ) { // translator-friendly messages composed of 2 existing messages - if ( (turnflags&PP_TURN_TEAM) != minigame_self.team ) + if ( (turnflags & PP_TURN_TEAM) != minigame_self.team ) 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!")); }