In linger mode a new overlay is used to see the difference between

playing and lingering.

Did some minor cleanups.
This commit is contained in:
Mark de Wever 2007-11-24 09:34:50 +00:00
parent cae767b276
commit b7c86f8088
8 changed files with 53 additions and 11 deletions

View file

@ -16,6 +16,8 @@ Version 1.3.11+svn:
* removed the turn_cmd preference option
* Savegames now have a prefix indicating the campaign they are from if
the campaign WML declared an abbrev= tag.
* in linger mode a new overlay is used to see the difference between
playing and lingering
* WML engine:
* New standard unit filter keys:
- defense: chance to be hit on current terrain by normal weapons

View file

@ -45,6 +45,7 @@ Version 1.3.11:
* Tips of the day have attributions, a "Previous" button and a fixed size.
* Savegames now have a prefix indicating the campaign they are from if
the campaign WML declared an abbrev= tag.
* When the game enters linger mode the map shows a visual hint.
Version 1.3.10:
* Campaigns

View file

@ -52,7 +52,8 @@ namespace game_config
std::string terrain_mask_image = "terrain/alphamask.png";
std::string grid_image = "terrain/grid.png";
std::string unreachable_image = "terrain/darken.png";
std::string unreachable_image = "terrain/darken.png"; //!< overlay image for unreachable tiles
std::string linger_image = "terrain/darken-linger.png"; //!< overlay image for tiles in linger mode
std::string energy_image = "misc/bar-energy.png";
std::string moved_ball_image = "misc/ball-moved.png";

View file

@ -59,7 +59,7 @@ namespace game_config
moved_ball_image, unmoved_ball_image, partmoved_ball_image,
enemy_ball_image, ally_ball_image, energy_image,
flag_image, flag_icon_image, cross_image,
terrain_mask_image, grid_image, unreachable_image,
terrain_mask_image, grid_image, unreachable_image, linger_image,
observer_image, tod_bright_image,
checked_menu_image, unchecked_menu_image, wml_menu_image, level_image, ellipsis_image, tome_title;

View file

@ -24,7 +24,6 @@
#include "filesystem.hpp"
#include "font.hpp"
#include "game_config.hpp"
#include "gamestatus.hpp"
#include "gettext.hpp"
#include "halo.hpp"
#include "hotkeys.hpp"
@ -64,10 +63,15 @@ game_display::game_display(unit_map& units, CVideo& video, const gamemap& map,
teams_(t),
level_(level),
invalidateUnit_(true),
currentTeam_(0), activeTeam_(0),
currentTeam_(0),
activeTeam_(0),
sidebarScaling_(1.0),
first_turn_(true), in_game_(false),
tod_hex_mask1(NULL), tod_hex_mask2(NULL), reach_map_changed_(true)
first_turn_(true),
in_game_(false),
tod_hex_mask1(NULL),
tod_hex_mask2(NULL),
reach_map_changed_(true),
game_mode_(RUNNING)
{
singleton_ = this;
@ -293,7 +297,7 @@ void game_display::draw(bool update,bool force)
// commented out code, but enabling it looks worse).
const bool on_map = map_.on_board(*it);
const bool off_map_tile = (map_.get_terrain(*it) == t_translation::OFF_MAP_USER);
const bool is_shrouded = shrouded(*it);
const bool is_shrouded = shrouded(*it);
image::TYPE image_type = image::SCALED_TO_HEX;
@ -318,7 +322,7 @@ void game_display::draw(bool update,bool force)
tile_stack_clear();
if(!is_shrouded /*|| !on_map*/) {
if(!is_shrouded) {
// unshrouded terrain (the normal case)
tile_stack_append(get_terrain_images(*it,tod.id, image_type, ADJACENT_BACKGROUND));
@ -334,7 +338,7 @@ void game_display::draw(bool update,bool force)
}
}
if(!is_shrouded /*|| !on_map*/) {
if(!is_shrouded) {
tile_stack_append(get_terrain_images(*it,tod.id,image_type,ADJACENT_FOREGROUND));
}
@ -389,13 +393,15 @@ void game_display::draw(bool update,bool force)
tile_stack_append(image::get_image("misc/attack-indicator-dst-" + attack_indicator_direction() + ".png", image::UNMASKED));
}
// Apply shroud and fog
// Apply shroud, fog and linger overlay
if(is_shrouded) {
// We apply void also on off-map tiles
// to shroud the half-hexes too
tile_stack_append(image::get_image(shroud_image, image::SCALED_TO_HEX));
} else if(fogged(*it)) {
tile_stack_append(image::get_image(fog_image, image::SCALED_TO_HEX));
} else if(game_mode_ != RUNNING) {
tile_stack_append(image::get_image(game_config::linger_image, image::SCALED_TO_HEX));
}
if(!is_shrouded) {
@ -624,6 +630,14 @@ void game_display::draw_bar(const std::string& image, int xpos, int ypos, size_t
}
}
void game_display::set_game_mode(const tgame_mode game_mode)
{
if(game_mode != game_mode_) {
game_mode_ = game_mode;
invalidate_all();
}
}
void game_display::draw_movement_info(const gamemap::location& loc)
{
// Search if there is a turn waypoint here

View file

@ -97,7 +97,6 @@ public:
void float_label(const gamemap::location& loc, const std::string& text,
int red, int green, int blue);
public:
//! Function to return 2 half-hex footsteps images for the given location.
//! Only loc is on the current route set by set_route.
std::vector<surface> footsteps_images(const gamemap::location& loc);
@ -185,6 +184,20 @@ public:
virtual bool in_game() const { return in_game_; }
void draw_bar(const std::string& image, int xpos, int ypos, size_t height, double filled, const SDL_Color& col, fixed_t alpha);
//! Sets the linger mode for the display.
//! There have been some discussions on what to do with fog and shroud
//! the extra variables make it easier to modify the behaviour. There
//! might even be a split between victory and defeat.
//
//! @todo if the current implementation is wanted we can change
//! the stuff back to a boolean
enum tgame_mode {
RUNNING, //!< no linger overlay, show fog and shroud
LINGER_SP, //!< linger overlay, show fog and shroud
LINGER_MP }; //!< linger overlay, show fog and shroud
void set_game_mode(const tgame_mode game_mode);
private:
game_display(const game_display&);
void operator=(const game_display&);
@ -269,6 +282,8 @@ private:
bool reach_map_changed_;
void process_reachmap_changes();
tgame_mode game_mode_;
// For debug mode
static std::map<gamemap::location,fixed_t> debugHighlights_;

View file

@ -224,6 +224,10 @@ void playmp_controller::linger(upload_log& log, LEVEL_RESULT result)
LOG_NG << "beginning end-of-scenario linger";
browse_ = true;
linger_ = true;
// If we need to set the status depending on the completion state
// we're needed here.
gui_->set_game_mode(game_display::LINGER_MP);
// this is actually for after linger mode is over -- we don't want to
// stay stuck in linger state when the *next* scenario is over.
gamestate_.completion = "running";
@ -276,6 +280,7 @@ void playmp_controller::linger(upload_log& log, LEVEL_RESULT result)
// revert the end-turn button text to its normal label
gui_->get_theme().refresh_title2(std::string("button-endturn"), std::string("title"));
gui_->invalidate_theme();
gui_->set_game_mode(game_display::RUNNING);
LOG_NG << "ending end-of-scenario linger";
}

View file

@ -601,6 +601,9 @@ void playsingle_controller::linger(upload_log& log)
LOG_NG << "beginning end-of-scenario linger";
browse_ = true;
linger_ = true;
// If we need to set the status depending on the completion state
// we're needed here.
gui_->set_game_mode(game_display::LINGER_SP);
// this is actually for after linger mode is over -- we don't
// want to stay stuck in linger state when the *next* scenario
@ -633,6 +636,7 @@ void playsingle_controller::linger(upload_log& log)
// revert the end-turn button text to its normal label
gui_->get_theme().refresh_title2(std::string("button-endturn"), std::string("title"));
gui_->invalidate_theme();
gui_->set_game_mode(game_display::RUNNING);
LOG_NG << "ending end-of-scenario linger";
}