Made the orb and minimap colors configurable by the preferences.

This commit is contained in:
fendrin 2014-03-15 14:36:48 +01:00
parent dc9a2c89e4
commit 1e5d58af6a
14 changed files with 513 additions and 60 deletions

View file

@ -16,6 +16,8 @@ Version 1.13.0-dev:
* Units:
* Increased the experience requirement for the Rami from 32 to 39
* Increased the experience requirement for the Saree from 56 to 64
* User interface:
* Made orb and minmap colors configurable by the game preferences.
* Miscellaneous and bug fixes:
* Fix Fisher-Yates implemenation of Lua helper.shuffle (bug #21706)
* Fixed issues with the ~BG() image path function not always working with

View file

@ -13,16 +13,21 @@
rgb=FF0000,FFFFFF,000000,FF0000
name= _ "Red"
[/color_range]
[color_range]
id=orb_3red
rgb=FF0000,FFFFFF,000000,FF0000
name= _ "Red"
[/color_range]
[color_range]
id=lightred
rgb=D1620D,FFFFFF,000000,D1620D
id=orb_lightred
rgb=D1620D,FFFFFF,000000,FF0000
name= _ "Light Red"
[/color_range]
[color_range]
id=darkred
rgb=8A0808,FFFFFF,000000,8A0808
id=orb_darkred
rgb=8A0808,FFFFFF,000000,FF0000
name= _ "Dark Red"
[/color_range]
@ -31,7 +36,17 @@
rgb=2E419B,FFFFFF,0F0F0F,0000FF
name= _ "Blue"
[/color_range]
[color_range]
id=orb_6blue
rgb=2E419B,FFFFFF,0F0F0F,0000FF
name= _ "Blue"
[/color_range]
[color_range]
id=orb_5lightblue
rgb=00A4FF,FFFFFF,000A21,00A4FF
name= _ "Light blue"
[/color_range]
[color_range]
id=lightblue
rgb=00A4FF,FFFFFF,000A21,00A4FF
@ -44,6 +59,11 @@
name= _ "Green"
[/color_range]
[color_range]
id=orb_1brightgreen
rgb=8CFF00,EBFFBF,2D4001,8CFF00
name= _ "Bright green"
[/color_range]
[color_range]
id=brightgreen
rgb=8CFF00,EBFFBF,2D4001,8CFF00
@ -62,6 +82,12 @@
name= _ "Black"
[/color_range]
[color_range]
id=orb_6black
rgb=5A5A5A,FFFFFF,000000,000000
name= _ "Black"
[/color_range]
[color_range]
id=brown
rgb=945027,FFFFFF,000000,AA4600
@ -75,7 +101,7 @@
[/color_range]
[color_range]
id=brightorange
id=orb_2brightorange
rgb=FFC600,FFF7E6,792A00,FFC600
name= _ "Bright orange"
[/color_range]
@ -85,6 +111,11 @@
rgb=E1E1E1,FFFFFF,1E1E1E,FFFFFF
name= _ "White"
[/color_range]
[color_range]
id=orb_7white
rgb=E1E1E1,FFFFFF,1E1E1E,FFFFFF
name= _ "White"
[/color_range]
[color_range]
id=teal
@ -97,6 +128,12 @@
rgb=FFF35A,FFF8D2,994F13,FFF35A
name= _ "Gold"
[/color_range]
[color_range]
id=orb_8gold
rgb=FFF35A,FFF8D2,994F13,FFF35A
name= _ "Gold"
[/color_range]
# The following team colors are an extended palette meant specifically to recolor the background of terrain type icons
# Each color range is named after the terrain type it corresponds to.

View file

@ -46,16 +46,19 @@
footprint_teleport_enter="footsteps/teleport-in.png"
footprint_teleport_exit="footsteps/teleport-out.png"
[colors]
enemy_orb_color="orb_6black"
unmoved_orb_color="orb_1brightgreen"
ally_orb_color="orb_5lightblue"
partial_orb_color="orb_2brightorange"
moved_orb_color="orb_3red"
[/colors]
[images]
game_title="maps/titlescreen.png"
game_title_background="maps/background.jpg"
orb="misc/orb.png"
enemy_orb_color="red"
unmoved_orb_color="brightgreen"
ally_orb_color="lightblue"
partmoved_orb_color="brightorange"
moved_orb_color="black"
energy="misc/bar-energy.png"
flag="flags/flag-[1~4].png:150"

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
images/buttons/misc/orb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -10,6 +10,9 @@ Version 1.13.0-dev:
* Increased the experience requirement for the Rami from 32 to 39.
* Increased the experience requirement for the Saree from 56 to 64.
* User interface:
* Made orb and minmap colors configurable by the game preferences.
Version 1.11.11:
* Campaigns:

View file

@ -1924,20 +1924,20 @@ void display::draw_minimap_units()
if (preferences::minimap_movement_coding()) {
if ((*teams_)[currentTeam_].is_enemy(side)) {
col = int_to_color(game_config::color_info(game_config::images::enemy_orb_color).rep());
col = int_to_color(game_config::color_info(preferences::enemy_color()).rep());
} else {
if (currentTeam_ +1 == static_cast<unsigned>(side)) {
if (u->movement_left() == u->total_movement())
col = int_to_color(game_config::color_info(game_config::images::unmoved_orb_color).rep());
col = int_to_color(game_config::color_info(preferences::unmoved_color()).rep());
else if (u->movement_left() == 0)
col = int_to_color(game_config::color_info(game_config::images::moved_orb_color).rep());
col = int_to_color(game_config::color_info(preferences::moved_color()).rep());
else
col = int_to_color(game_config::color_info(game_config::images::partmoved_orb_color).rep());
col = int_to_color(game_config::color_info(preferences::partial_color()).rep());
} else
col = int_to_color(game_config::color_info(game_config::images::ally_orb_color).rep());
col = int_to_color(game_config::color_info(preferences::allied_color()).rep());
}
}

View file

@ -72,16 +72,21 @@ namespace game_config
default_victory_music,
default_defeat_music;
namespace colors {
std::string moved_orb_color,
unmoved_orb_color,
partial_orb_color,
enemy_orb_color,
ally_orb_color;
}
bool show_ally_orb, show_enemy_orb, show_moved_orb, show_partial_orb, show_unmoved_orb;
namespace images {
std::string game_title,
game_title_background,
// orbs and hp/xp bar
orb,
moved_orb_color,
unmoved_orb_color,
partmoved_orb_color,
enemy_orb_color,
ally_orb_color,
energy,
// flags
flag,
@ -195,17 +200,27 @@ namespace game_config
default_victory_music = v["default_victory_music"].str();
default_defeat_music = v["default_defeat_music"].str();
if(const config &i = v.child("colors")){
using namespace game_config::colors;
moved_orb_color = i["moved_orb_color"].str();
unmoved_orb_color = i["unmoved_orb_color"].str();
partial_orb_color = i["partial_orb_color"].str();
enemy_orb_color = i["enemy_orb_color"].str();
ally_orb_color = i["ally_orb_color"].str();
} // colors
show_ally_orb = v["show_ally_orb"].to_bool(true);
show_enemy_orb = v["show_enemy_orb"].to_bool(false);
show_moved_orb = v["show_moved_orb"].to_bool(true);
show_partial_orb = v["show_partly_orb"].to_bool(true);
show_unmoved_orb = v["show_unmoved_orb"].to_bool(true);
if(const config &i = v.child("images")){
using namespace game_config::images;
game_title = i["game_title"].str();
game_title_background = i["game_title_background"].str();
orb = i["orb"].str();
moved_orb_color = i["moved_orb_color"].str();
unmoved_orb_color = i["unmoved_orb_color"].str();
partmoved_orb_color = i["partmoved_orb_color"].str();
enemy_orb_color = i["enemy_orb_color"].str();
ally_orb_color = i["ally_orb_color"].str();
energy = i["energy"].str();
flag = i["flag"].str();

View file

@ -72,16 +72,21 @@ namespace game_config
default_victory_music,
default_defeat_music;
namespace colors {
extern std::string unmoved_orb_color,
partial_orb_color,
enemy_orb_color,
ally_orb_color,
moved_orb_color;
} // colors
extern bool show_ally_orb, show_enemy_orb, show_moved_orb, show_partial_orb, show_unmoved_orb;
namespace images {
extern std::string game_title,
game_title_background,
// orbs and hp/xp bar
orb,
unmoved_orb_color,
partmoved_orb_color,
enemy_orb_color,
ally_orb_color,
moved_orb_color,
energy,
// flags
flag,

View file

@ -106,12 +106,12 @@ private:
void sort_advanced_preferences();
void set_friends_menu();
std::vector<std::string> friends_names_;
std::vector<std::string> color_ids_;
//
// change
gui::slider music_slider_, sound_slider_, UI_sound_slider_, bell_slider_,
scroll_slider_, chat_lines_slider_,
buffer_size_slider_, idle_anim_slider_, autosavemax_slider_, advanced_slider_;
scroll_slider_, chat_lines_slider_, buffer_size_slider_,
idle_anim_slider_, autosavemax_slider_, advanced_slider_;
gui::list_slider<double> turbo_slider_;
gui::button fullscreen_button_, turbo_button_, show_ai_moves_button_,
interrupt_when_ally_sighted_button_,
@ -127,16 +127,32 @@ private:
turn_dialog_button_, whiteboard_on_start_button_,
hide_whiteboard_button_, turn_bell_button_, show_team_colors_button_,
show_haloing_button_, video_mode_button_,
theme_button_, hotkeys_button_,
paths_button_,
theme_button_,
hotkeys_button_, paths_button_, colors_button_,
advanced_button_, sound_button_,
music_button_, chat_timestamp_button_,
advanced_sound_button_, normal_sound_button_,
display_button_,
UI_sound_button_, sample_rate_button1_,
sample_rate_button2_, sample_rate_button3_,
confirm_sound_button_, idle_anim_button_,
standing_anim_button_,
animate_map_button_;
animate_map_button_,
// color tab
orb_colors_defaults_,
orb_colors_enemy_toggle_,
orb_colors_ally_toggle_,
orb_colors_unmoved_toggle_,
orb_colors_partial_toggle_,
orb_colors_moved_toggle_;
std::vector<gui::button> orb_colors_ally_buttons_;
std::vector<gui::button> orb_colors_enemy_buttons_;
std::vector<gui::button> orb_colors_moved_buttons_;
std::vector<gui::button> orb_colors_partial_buttons_;
std::vector<gui::button> orb_colors_unmoved_buttons_;
gui::label music_label_, sound_label_, UI_sound_label_, bell_label_,
scroll_label_, chat_lines_label_,
turbo_slider_label_, sample_rate_label_, buffer_size_label_,
@ -152,7 +168,7 @@ private:
enum TAB { GENERAL_TAB, DISPLAY_TAB, SOUND_TAB, MULTIPLAYER_TAB, ADVANCED_TAB,
/*extra tab*/
ADVANCED_SOUND_TAB, FRIENDS_TAB};
COLOR_TAB, ADVANCED_SOUND_TAB, FRIENDS_TAB};
TAB tab_;
display &disp_;
const config& game_cfg_;
@ -165,6 +181,7 @@ public:
preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
: gui::preview_pane(disp.video()),
friends_names_(),
color_ids_(),
music_slider_(disp.video()), sound_slider_(disp.video()),
UI_sound_slider_(disp.video()), bell_slider_(disp.video()),
scroll_slider_(disp.video()),
@ -204,12 +221,14 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
theme_button_(disp.video(), _("Theme")),
hotkeys_button_(disp.video(), _("Hotkeys")),
paths_button_(disp.video(), _("Paths")),
colors_button_(disp.video(), _("Colors")),
advanced_button_(disp.video(), "", gui::button::TYPE_CHECK),
sound_button_(disp.video(), _("Sound effects"), gui::button::TYPE_CHECK),
music_button_(disp.video(), _("Music"), gui::button::TYPE_CHECK),
chat_timestamp_button_(disp.video(), _("Chat timestamping"), gui::button::TYPE_CHECK),
advanced_sound_button_(disp.video(), _("sound^Advanced Options")),
normal_sound_button_(disp.video(), _("sound^Standard Options")),
display_button_(disp.video(), _("colors^Display")),
UI_sound_button_(disp.video(), _("User interface sounds"), gui::button::TYPE_CHECK),
sample_rate_button1_(disp.video(), "22050", gui::button::TYPE_RADIO),
sample_rate_button2_(disp.video(), "44100", gui::button::TYPE_RADIO),
@ -219,6 +238,22 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
standing_anim_button_(disp.video(), _("Show unit standing animations"), gui::button::TYPE_CHECK),
animate_map_button_(disp.video(), _("Animate map"), gui::button::TYPE_CHECK),
// Colors tab buttons
orb_colors_defaults_(disp.video(), _("Defaults")),
orb_colors_enemy_toggle_(disp.video(), _("Show enemy orb"), gui::button::TYPE_CHECK),
orb_colors_ally_toggle_(disp.video(), _("Show ally orb"), gui::button::TYPE_CHECK),
orb_colors_unmoved_toggle_(disp.video(), _("Show unmoved orb"), gui::button::TYPE_CHECK),
orb_colors_partial_toggle_(disp.video(), _("Show partial moved orb"), gui::button::TYPE_CHECK),
orb_colors_moved_toggle_(disp.video(), _("Show moved orb"), gui::button::TYPE_CHECK),
//colors tab buttons
orb_colors_ally_buttons_(),
orb_colors_enemy_buttons_(),
orb_colors_moved_buttons_(),
orb_colors_partial_buttons_(),
orb_colors_unmoved_buttons_(),
// Sound tab labels
music_label_(disp.video(), _("Volume:"), font::SIZE_SMALL),
sound_label_(disp.video(), _("Volume:"), font::SIZE_SMALL),
UI_sound_label_(disp.video(), _("Volume:"), font::SIZE_SMALL),
@ -265,6 +300,48 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
music_slider_.set_value(music_volume());
music_slider_.set_help_string(_("Change the music volume"));
orb_colors_ally_toggle_.set_check(preferences::show_allied_orb());
orb_colors_enemy_toggle_.set_check(preferences::show_enemy_orb());
orb_colors_moved_toggle_.set_check(preferences::show_moved_orb());
orb_colors_partial_toggle_.set_check(preferences::show_partial_orb());
orb_colors_unmoved_toggle_.set_check(preferences::show_unmoved_orb());
const std::map<std::string, t_string>& colors = game_config::team_rgb_name;
std::map<std::string, t_string>::const_iterator colors_it;
for (colors_it = colors.begin(); colors_it != colors.end(); colors_it++) {
const std::string& color_id = colors_it->first;
const t_string& color_name = colors_it->second;
if (color_id.substr(0,4) != "orb_")
continue;
color_ids_.push_back(color_id);
std::string image_path = "misc/orb"; //game_config::images::orb;
std::string image_path_suffix = "~RC(magenta>" + color_id + ")~CROP(14,0,14,14)~SCALE(28,28)";
gui::button color_radio_button(disp.video(), "", gui::button::TYPE_IMAGE, image_path, gui::button::MINIMUM_SPACE);
color_radio_button.set_tooltip_string(color_name);
color_radio_button.set_help_string(color_name);
color_radio_button.set_image_path_suffix(image_path_suffix);
color_radio_button.set_check(color_id == preferences::allied_color());
orb_colors_ally_buttons_.push_back(color_radio_button);
color_radio_button.set_check(color_id == preferences::enemy_color());
orb_colors_enemy_buttons_.push_back(color_radio_button);
color_radio_button.set_check(color_id == preferences::moved_color());
orb_colors_moved_buttons_.push_back(color_radio_button);
color_radio_button.set_check(color_id == preferences::partial_color());
orb_colors_partial_buttons_.push_back(color_radio_button);
color_radio_button.set_check(color_id == preferences::unmoved_color());
orb_colors_unmoved_buttons_.push_back(color_radio_button);
}
// bell volume slider
bell_slider_.set_min(0);
bell_slider_.set_max(128);
@ -430,8 +507,8 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
show_haloing_button_.set_help_string(_("Use graphical special effects (may be slower)"));
hotkeys_button_.set_help_string(_("View and configure keyboard shortcuts"));
paths_button_.set_help_string(_("View game file paths"));
colors_button_.set_help_string(_("Adjust orb colors"));
set_advanced_menu();
set_friends_menu();
@ -487,6 +564,7 @@ handler_vector preferences_dialog::handler_members()
h.push_back(&theme_button_);
h.push_back(&hotkeys_button_);
h.push_back(&paths_button_);
h.push_back(&colors_button_);
h.push_back(&advanced_button_);
h.push_back(&sound_button_);
h.push_back(&music_button_);
@ -512,6 +590,24 @@ handler_vector preferences_dialog::handler_members()
h.push_back(&sample_rate_input_);
h.push_back(&advanced_);
h.push_back(&friends_);
// Colors tab
for (u_int i = 0; i < color_ids_.size(); i++) {
h.push_back(&orb_colors_ally_buttons_[i]);
h.push_back(&orb_colors_enemy_buttons_[i]);
h.push_back(&orb_colors_moved_buttons_[i]);
h.push_back(&orb_colors_partial_buttons_[i]);
h.push_back(&orb_colors_unmoved_buttons_[i]);
}
h.push_back(&orb_colors_ally_toggle_);
h.push_back(&orb_colors_enemy_toggle_);
h.push_back(&orb_colors_moved_toggle_);
h.push_back(&orb_colors_partial_toggle_);
h.push_back(&orb_colors_unmoved_toggle_);
h.push_back(&orb_colors_defaults_);
h.push_back(&display_button_);
return h;
}
@ -587,6 +683,73 @@ void preferences_dialog::update_location(SDL_Rect const &rect)
video_mode_button_.set_location(rect.x, bottom_row_y - video_mode_button_.height());
theme_button_.set_location(rect.x + video_mode_button_.width() + 10,
bottom_row_y - theme_button_.height());
colors_button_.set_location(rect.x + video_mode_button_.width() + theme_button_.width() + 20, bottom_row_y - colors_button_.height());
// Color tab
const int width = 28; // orb_colors_ally_buttons_[0].width();
const u_int color_number = color_ids_.size();
const u_int number = std::max(color_number, (u_int)2);
const int orb_x_offset = ( (rect.w - width*number) / number ) * 2;
int xpos = rect.x;
ypos = rect.y + top_border;
orb_colors_unmoved_toggle_.set_location(xpos, ypos);
ypos += item_interline - 10;
xpos -= orb_x_offset;
xpos += horizontal_padding;
BOOST_FOREACH(gui::button& button, orb_colors_unmoved_buttons_) {
xpos += orb_x_offset;
button.set_location(xpos, ypos);
}
xpos = rect.x;
ypos += item_interline;
orb_colors_partial_toggle_.set_location(xpos, ypos);
ypos += item_interline - 10;
xpos -= orb_x_offset;
xpos += horizontal_padding;
BOOST_FOREACH(gui::button& button, orb_colors_partial_buttons_) {
xpos += orb_x_offset;
button.set_location(xpos, ypos);
}
xpos = rect.x;
ypos += item_interline;
orb_colors_moved_toggle_.set_location(xpos, ypos);
ypos += item_interline - 10;
xpos -= orb_x_offset;
xpos += horizontal_padding;
BOOST_FOREACH(gui::button& button, orb_colors_moved_buttons_) {
xpos += orb_x_offset;
button.set_location(xpos, ypos);
}
xpos = rect.x;
ypos += item_interline;
orb_colors_ally_toggle_.set_location(xpos, ypos);
ypos += item_interline - 10;
xpos -= orb_x_offset;
xpos += horizontal_padding;
BOOST_FOREACH(gui::button& button, orb_colors_ally_buttons_) {
xpos += orb_x_offset;
button.set_location(xpos, ypos);
}
xpos = rect.x;
ypos += item_interline;
orb_colors_enemy_toggle_.set_location(xpos, ypos);
ypos += item_interline - 10;
xpos -= orb_x_offset;
xpos += horizontal_padding;
BOOST_FOREACH(gui::button& button, orb_colors_enemy_buttons_) {
xpos += orb_x_offset;
button.set_location(xpos, ypos);
}
display_button_.set_location(rect.x, bottom_row_y - display_button_.height());
orb_colors_defaults_.set_location(rect.x + display_button_.width() + 10, bottom_row_y - orb_colors_defaults_.height());
// Sound tab
slider_label_width_ = std::max<unsigned>(music_label_.width(), sound_label_.width());
@ -808,9 +971,84 @@ void preferences_dialog::process_event()
set_idle_anim_rate(idle_anim_slider_.value());
if (colors_button_.pressed())
set_selection(COLOR_TAB);
return;
}
if (tab_ == COLOR_TAB) {
if (display_button_.pressed()) {
set_selection(DISPLAY_TAB);
return;
}
if (orb_colors_defaults_.pressed()) {
preferences::set_show_allied_orb(game_config::show_ally_orb);
preferences::set_show_enemy_orb(game_config::show_enemy_orb);
preferences::set_show_moved_orb(game_config::show_moved_orb);
preferences::set_show_partial_orb(game_config::show_partial_orb);
preferences::set_show_unmoved_orb(game_config::show_unmoved_orb);
orb_colors_ally_toggle_.set_check(preferences::show_allied_orb());
orb_colors_enemy_toggle_.set_check(preferences::show_enemy_orb());
orb_colors_moved_toggle_.set_check(preferences::show_moved_orb());
orb_colors_partial_toggle_.set_check(preferences::show_partial_orb());
orb_colors_unmoved_toggle_.set_check(preferences::show_unmoved_orb());
preferences::set_allied_color(game_config::colors::ally_orb_color);
preferences::set_enemy_color(game_config::colors::enemy_orb_color);
preferences::set_moved_color(game_config::colors::moved_orb_color);
preferences::set_unmoved_color(game_config::colors::unmoved_orb_color);
preferences::set_partial_color(game_config::colors::partial_orb_color);
}
if (orb_colors_ally_toggle_.pressed()) {
preferences::set_show_allied_orb(orb_colors_ally_toggle_.checked());
return;
}
if (orb_colors_enemy_toggle_.pressed()) {
preferences::set_show_enemy_orb(orb_colors_enemy_toggle_.checked());
return;
}
if (orb_colors_moved_toggle_.pressed()) {
preferences::set_show_moved_orb(orb_colors_moved_toggle_.checked());
return;
}
if (orb_colors_partial_toggle_.pressed()) {
preferences::set_show_partial_orb(orb_colors_partial_toggle_.checked());
return;
}
if (orb_colors_unmoved_toggle_.pressed()) {
preferences::set_show_unmoved_orb(orb_colors_unmoved_toggle_.checked());
return;
}
for (u_int i = 0; i < color_ids_.size(); i++) {
if (orb_colors_ally_buttons_[i].pressed())
preferences::set_allied_color(color_ids_[i]);
if (orb_colors_enemy_buttons_[i].pressed())
preferences::set_enemy_color(color_ids_[i]);
if (orb_colors_moved_buttons_[i].pressed())
preferences::set_moved_color(color_ids_[i]);
if (orb_colors_unmoved_buttons_[i].pressed())
preferences::set_unmoved_color(color_ids_[i]);
if (orb_colors_partial_buttons_[i].pressed())
preferences::set_partial_color(color_ids_[i]);
orb_colors_ally_buttons_[i].set_check(
preferences::allied_color() == color_ids_[i]);
orb_colors_enemy_buttons_[i].set_check(
preferences::enemy_color() == color_ids_[i]);
orb_colors_moved_buttons_[i].set_check(
preferences::moved_color() == color_ids_[i]);
orb_colors_partial_buttons_[i].set_check(
preferences::partial_color() == color_ids_[i]);
orb_colors_unmoved_buttons_[i].set_check(
preferences::unmoved_color() == color_ids_[i]);
}
return;
}
if (tab_ == SOUND_TAB) {
if (turn_bell_button_.pressed()) {
@ -1327,6 +1565,25 @@ void preferences_dialog::set_selection(int index)
theme_button_.hide(hide_display);
show_team_colors_button_.hide(hide_display);
show_grid_button_.hide(hide_display);
colors_button_.hide(hide_display);
const bool hide_colors = tab_ != COLOR_TAB;
orb_colors_ally_toggle_.hide(hide_colors);
orb_colors_enemy_toggle_.hide(hide_colors);
orb_colors_moved_toggle_.hide(hide_colors);
orb_colors_partial_toggle_.hide(hide_colors);
orb_colors_unmoved_toggle_.hide(hide_colors);
for (u_int i = 0; i < color_ids_.size(); i++) {
orb_colors_ally_buttons_[i].hide(hide_colors);
orb_colors_enemy_buttons_[i].hide(hide_colors);
orb_colors_moved_buttons_[i].hide(hide_colors);
orb_colors_partial_buttons_[i].hide(hide_colors);
orb_colors_unmoved_buttons_[i].hide(hide_colors);
}
display_button_.hide(hide_colors);
display_button_.enable(!hide_colors);
orb_colors_defaults_.hide(hide_colors);
orb_colors_defaults_.enable(!hide_colors);
const bool hide_sound = tab_ != SOUND_TAB;
music_button_.hide(hide_sound);

View file

@ -232,11 +232,11 @@ surface getMinimap(int w, int h, const gamemap &map, const team *vw, const std::
} else {
if (vw->owns_village(loc))
col = int_to_color(game_config::color_info(game_config::images::unmoved_orb_color).rep());
col = int_to_color(game_config::color_info(preferences::unmoved_color()).rep());
else if (vw->is_enemy(side + 1))
col = int_to_color(game_config::color_info(game_config::images::enemy_orb_color).rep());
col = int_to_color(game_config::color_info(preferences::enemy_color()).rep());
else
col = int_to_color(game_config::color_info(game_config::images::ally_orb_color).rep());
col = int_to_color(game_config::color_info(preferences::allied_color()).rep());
}
}
}

View file

@ -185,6 +185,93 @@ bool fullscreen()
return get("fullscreen", false);
}
bool show_allied_orb() {
return get("show_ally_orb", game_config::show_ally_orb);
}
void set_show_allied_orb(bool show_orb) {
prefs["show_ally_orb"] = show_orb;
}
bool show_enemy_orb() {
return get("show_enemy_orb", game_config::show_enemy_orb);
}
void set_show_enemy_orb(bool show_orb) {
prefs["show_enemy_orb"] = show_orb;
}
bool show_moved_orb() {
return get("show_moved_orb", game_config::show_moved_orb);
}
void set_show_moved_orb(bool show_orb) {
prefs["show_moved_orb"] = show_orb;
}
bool show_unmoved_orb() {
return get("show_unmoved_orb", game_config::show_unmoved_orb);
}
void set_show_unmoved_orb(bool show_orb) {
prefs["show_unmoved_orb"] = show_orb;
}
bool show_partial_orb() {
return get("show_partial_orb", game_config::show_partial_orb);
}
void set_show_partial_orb(bool show_orb) {
prefs["show_partial_orb"] = show_orb;
}
std::string allied_color() {
std::string ally_color = get("ally_orb_color");
if (ally_color.empty())
return game_config::colors::ally_orb_color;
return ally_color;
}
void set_allied_color(const std::string& color_id) {
prefs["ally_orb_color"] = color_id;
}
std::string enemy_color() {
std::string enemy_color = get("enemy_orb_color");
if (enemy_color.empty())
return game_config::colors::enemy_orb_color;
return enemy_color;
}
void set_enemy_color(const std::string& color_id) {
prefs["enemy_orb_color"] = color_id;
}
std::string moved_color() {
std::string moved_color = get("moved_orb_color");
if (moved_color.empty())
return game_config::colors::moved_orb_color;
return moved_color;
}
void set_moved_color(const std::string& color_id) {
prefs["moved_orb_color"] = color_id;
}
std::string unmoved_color() {
std::string unmoved_color = get("unmoved_orb_color");
if (unmoved_color.empty())
return game_config::colors::unmoved_orb_color;
return unmoved_color;
}
void set_unmoved_color(const std::string& color_id) {
prefs["unmoved_orb_color"] = color_id;
}
std::string partial_color() {
std::string partmoved_color = get("partial_orb_color");
if (partmoved_color.empty())
return game_config::colors::partial_orb_color;
return partmoved_color;
}
void set_partial_color(const std::string& color_id) {
prefs["partial_orb_color"] = color_id;
}
void _set_fullscreen(bool ison)
{
prefs["fullscreen"] = ison;

View file

@ -125,6 +125,39 @@ namespace preferences {
void add_alias(const std::string& alias, const std::string& command);
const config &get_alias();
std::string allied_color();
void set_allied_color(const std::string& color_id);
std::string enemy_color();
void set_enemy_color(const std::string& color_id);
std::string unmoved_color();
void set_unmoved_color(const std::string& color_id);
std::string partial_color();
void set_partial_color(const std::string& color_id);
std::string moved_color();
void set_moved_color(const std::string& color_id);
bool show_allied_orb();
void set_show_allied_orb(bool show_orb);
bool show_enemy_orb();
void set_show_enemy_orb(bool show_orb);
bool show_moved_orb();
void set_show_moved_orb(bool show_orb);
bool show_unmoved_orb();
void set_show_unmoved_orb(bool show_orb);
bool show_partial_orb();
void set_show_partial_orb(bool show_orb);
bool use_color_cursors();
void _set_color_cursors(bool value);

View file

@ -2049,40 +2049,51 @@ void unit::redraw_unit()
}
if(draw_bars) {
const image::locator* orb_img = NULL;
static const image::locator partmoved_orb(game_config::images::orb + "~RC(magenta>" +
game_config::images::partmoved_orb_color + ")" );
static const image::locator moved_orb(game_config::images::orb + "~RC(magenta>" +
game_config::images::moved_orb_color + ")" );
static const image::locator ally_orb(game_config::images::orb + "~RC(magenta>" +
game_config::images::ally_orb_color + ")" );
static const image::locator enemy_orb(game_config::images::orb + "~RC(magenta>" +
game_config::images::enemy_orb_color + ")" );
static const image::locator unmoved_orb(game_config::images::orb + "~RC(magenta>" +
game_config::images::unmoved_orb_color + ")" );
/*static*/ const image::locator partmoved_orb(game_config::images::orb + "~RC(magenta>" +
preferences::partial_color() + ")" );
/*static*/ const image::locator moved_orb(game_config::images::orb + "~RC(magenta>" +
preferences::moved_color() + ")" );
/*static*/ const image::locator ally_orb(game_config::images::orb + "~RC(magenta>" +
preferences::allied_color() + ")" );
/*static*/ const image::locator enemy_orb(game_config::images::orb + "~RC(magenta>" +
preferences::enemy_color() + ")" );
/*static*/ const image::locator unmoved_orb(game_config::images::orb + "~RC(magenta>" +
preferences::unmoved_color() + ")" );
const std::string* energy_file = &game_config::images::energy;
if(size_t(side()) != disp.viewing_team()+1) {
if(disp.team_valid() &&
disp.get_teams()[disp.viewing_team()].is_enemy(side())) {
orb_img = &enemy_orb;
if (preferences::show_enemy_orb())
orb_img = &enemy_orb;
else
orb_img = NULL;
} else {
orb_img = &ally_orb;
if (preferences::show_allied_orb())
orb_img = &ally_orb;
else orb_img = NULL;
}
} else {
orb_img = &moved_orb;
if (preferences::show_moved_orb())
orb_img = &moved_orb;
else orb_img = NULL;
if(disp.playing_team() == disp.viewing_team() && !user_end_turn()) {
if (movement_left() == total_movement()) {
orb_img = &unmoved_orb;
if (preferences::show_unmoved_orb())
orb_img = &unmoved_orb;
else orb_img = NULL;
} else if ( actions::unit_can_move(*this) ) {
orb_img = &partmoved_orb;
if (preferences::show_partial_orb())
orb_img = &partmoved_orb;
else orb_img = NULL;
}
}
}
assert(orb_img != NULL);
surface orb(image::get_image(*orb_img,image::SCALED_TO_ZOOM));
if (orb != NULL) {
if (orb_img != NULL) {
surface orb(image::get_image(*orb_img,image::SCALED_TO_ZOOM));
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
loc_, xsrc, ysrc +adjusted_params.y, orb);
}