Use two-color orbs for allies' units (configurable by preferences)
These orbs no longer look the same as the player's own orbs, so they won't cause confusion in multiplayer. The relevant part of the advanced preference now shows: ``` [ ] - Show ally orb [ ] - During ally’s turn, use a two-color orb to show movement Radio buttons for colors: ( ) ( ) ( ) ( ) ( ) ( ) ( ) ``` That offers these choices: * Don't show ally orbs at all * Always use the one-color (with ally color, not status) * Use the two-color when that ally is playing, single color at other times * Use the two-color when that ally is playing, no orb at other times Rename some `allied_orb` functions to be `ally_orb`. This makes them consistent with both the names of the corresponding `enemy_orb` functions and the WML attribute that's used in the preferences file. This probably doesn't need a change to the in-game help, at least for the en_US version of the documentation. The current text in data/core/help.cfg is: * Blue for allied units, except during that ally's own turn. * During the ally's own turn, their units will be shown with the colors showing whether the units can still move and attack; however their moves, and the corresponding orb changes, are delayed as explained in "Shroud and Fog of War'.
This commit is contained in:
parent
be432e441b
commit
686e35e0e3
10 changed files with 63 additions and 12 deletions
4
changelog_entries/ally_orbs.md
Normal file
4
changelog_entries/ally_orbs.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
### Multiplayer
|
||||
* Allied units’ orbs no longer look like the player’s own units’ orbs (issue #7108).
|
||||
* By default, they are now two-color during the ally’s turn.
|
||||
* Added an advanced setting to always show them as single-color (the ally color).
|
|
@ -149,7 +149,9 @@
|
|||
{_GUI_ORB_SPACER_ROW}
|
||||
{_GUI_ORB_GROUP moved (_"Show moved orb")}
|
||||
{_GUI_ORB_SPACER_ROW}
|
||||
{_GUI_ORB_GROUP ally (_"Show ally orb")}
|
||||
{_GUI_ORB_TWO_COLOR ally
|
||||
(_"Show ally orb")
|
||||
(_"During ally’s turn, use a two-color orb to show movement") (_"During your allies’ turns, their units have a two-color orb. One half is the ally orb color, and the other half shows whether the unit is unmoved, partially moved or fully moved.")}
|
||||
{_GUI_ORB_SPACER_ROW}
|
||||
{_GUI_ORB_GROUP enemy (_"Show enemy orb")}
|
||||
[row]
|
||||
|
|
|
@ -137,6 +137,7 @@ bool show_disengaged_orb;
|
|||
bool show_enemy_orb;
|
||||
bool show_moved_orb;
|
||||
bool show_partial_orb;
|
||||
bool show_status_on_ally_orb;
|
||||
bool show_unmoved_orb;
|
||||
|
||||
//
|
||||
|
@ -321,6 +322,7 @@ void load_config(const config &v)
|
|||
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_status_on_ally_orb = v["show_status_on_ally_orb"].to_bool(true);
|
||||
show_unmoved_orb = v["show_unmoved_orb"].to_bool(true);
|
||||
show_disengaged_orb = v["show_disengaged_orb"].to_bool(true);
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ namespace game_config
|
|||
extern bool show_enemy_orb;
|
||||
extern bool show_moved_orb;
|
||||
extern bool show_partial_orb;
|
||||
extern bool show_status_on_ally_orb;
|
||||
extern bool show_unmoved_orb;
|
||||
|
||||
namespace images {
|
||||
|
|
|
@ -48,7 +48,8 @@ select_orb_colors::select_orb_colors()
|
|||
, show_partial_(preferences::show_partial_orb())
|
||||
, show_disengaged_(preferences::show_disengaged_orb())
|
||||
, show_moved_(preferences::show_moved_orb())
|
||||
, show_ally_(preferences::show_allied_orb())
|
||||
, show_ally_(preferences::show_ally_orb())
|
||||
, two_color_ally_(preferences::show_status_on_ally_orb())
|
||||
, show_enemy_(preferences::show_enemy_orb())
|
||||
{
|
||||
}
|
||||
|
@ -58,7 +59,7 @@ void select_orb_colors::pre_show(window& window)
|
|||
setup_orb_group("unmoved", show_unmoved_, preferences::unmoved_color());
|
||||
setup_orb_group_two_color("partial", show_partial_, show_disengaged_, preferences::partial_color());
|
||||
setup_orb_group("moved", show_moved_, preferences::moved_color());
|
||||
setup_orb_group("ally", show_ally_, preferences::allied_color());
|
||||
setup_orb_group_two_color("ally", show_ally_, two_color_ally_, preferences::allied_color());
|
||||
setup_orb_group("enemy", show_enemy_, preferences::enemy_color());
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
|
@ -75,7 +76,8 @@ void select_orb_colors::post_show(window&)
|
|||
preferences::set_show_partial_orb(show_partial_);
|
||||
preferences::set_show_disengaged_orb(show_disengaged_);
|
||||
preferences::set_show_moved_orb(show_moved_);
|
||||
preferences::set_show_allied_orb(show_ally_);
|
||||
preferences::set_show_ally_orb(show_ally_);
|
||||
preferences::set_show_status_on_ally_orb(two_color_ally_);
|
||||
preferences::set_show_enemy_orb(show_enemy_);
|
||||
|
||||
preferences::set_unmoved_color(groups_["unmoved"].get_active_member_value());
|
||||
|
@ -168,12 +170,13 @@ void select_orb_colors::reset_orb_callback()
|
|||
show_disengaged_ = game_config::show_disengaged_orb;
|
||||
show_moved_ = game_config::show_moved_orb;
|
||||
show_ally_ = game_config::show_ally_orb;
|
||||
two_color_ally_ = game_config::show_status_on_ally_orb;
|
||||
show_enemy_ = game_config::show_enemy_orb;
|
||||
|
||||
reset_orb_group("unmoved", show_unmoved_, game_config::colors::unmoved_orb_color);
|
||||
reset_orb_group_two_color("partial", show_partial_, show_disengaged_, game_config::colors::partial_orb_color);
|
||||
reset_orb_group("moved", show_moved_, game_config::colors::moved_orb_color);
|
||||
reset_orb_group("ally", show_ally_, game_config::colors::ally_orb_color);
|
||||
reset_orb_group_two_color("ally", show_ally_, two_color_ally_, game_config::colors::ally_orb_color);
|
||||
reset_orb_group("enemy", show_enemy_, game_config::colors::enemy_orb_color);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ private:
|
|||
bool show_disengaged_;
|
||||
bool show_moved_;
|
||||
bool show_ally_;
|
||||
bool two_color_ally_;
|
||||
bool show_enemy_;
|
||||
|
||||
std::map<std::string, group<std::string>> groups_;
|
||||
|
|
|
@ -259,13 +259,20 @@ void load_base_prefs() {
|
|||
}
|
||||
|
||||
|
||||
bool show_allied_orb() {
|
||||
bool show_ally_orb() {
|
||||
return get("show_ally_orb", game_config::show_ally_orb);
|
||||
}
|
||||
void set_show_allied_orb(bool show_orb) {
|
||||
void set_show_ally_orb(bool show_orb) {
|
||||
prefs["show_ally_orb"] = show_orb;
|
||||
}
|
||||
|
||||
bool show_status_on_ally_orb() {
|
||||
return get("show_status_on_ally_orb", game_config::show_status_on_ally_orb);
|
||||
}
|
||||
void set_show_status_on_ally_orb(bool show_orb) {
|
||||
prefs["show_status_on_ally_orb"] = show_orb;
|
||||
}
|
||||
|
||||
bool show_enemy_orb() {
|
||||
return get("show_enemy_orb", game_config::show_enemy_orb);
|
||||
}
|
||||
|
|
|
@ -188,8 +188,11 @@ namespace preferences {
|
|||
std::string disengaged_color();
|
||||
void set_disengaged_color(const std::string& color_id);
|
||||
|
||||
bool show_allied_orb();
|
||||
void set_show_allied_orb(bool show_orb);
|
||||
bool show_ally_orb();
|
||||
void set_show_ally_orb(bool show_orb);
|
||||
|
||||
bool show_status_on_ally_orb();
|
||||
void set_show_status_on_ally_orb(bool show_orb);
|
||||
|
||||
bool show_enemy_orb();
|
||||
void set_show_enemy_orb(bool show_orb);
|
||||
|
|
|
@ -62,6 +62,31 @@ std::unique_ptr<image::locator> get_orb_image(orb_status os)
|
|||
return std::make_unique<image::locator>(game_config::images::orb + "~RC(magenta>" + color + ")");
|
||||
}
|
||||
|
||||
/**
|
||||
* Assemble a two-color orb for an ally's unit, during that ally's turn.
|
||||
* Returns nullptr if the preferences both of these orbs and ally orbs in general are off.
|
||||
* Returns a one-color orb (using the ally color) in several circumstances.
|
||||
*/
|
||||
std::unique_ptr<image::locator> get_playing_ally_orb_image(orb_status os)
|
||||
{
|
||||
if(!preferences::show_status_on_ally_orb())
|
||||
return get_orb_image(orb_status::allied);
|
||||
|
||||
// This is conditional on prefs_show_orb, because a user might want to disable the standard
|
||||
// partial orb, but keep it enabled as a reminder for units in the disengaged state.
|
||||
if(os == orb_status::disengaged && !orb_status_helper::prefs_show_orb(orb_status::disengaged)) {
|
||||
os = orb_status::partial;
|
||||
}
|
||||
|
||||
if(!orb_status_helper::prefs_show_orb(os))
|
||||
return get_orb_image(orb_status::allied);
|
||||
|
||||
auto allied_color = orb_status_helper::get_orb_color(orb_status::allied);
|
||||
auto status_color = orb_status_helper::get_orb_color(os);
|
||||
return std::make_unique<image::locator>(game_config::images::orb_two_color + "~RC(ellipse_red>"
|
||||
+ allied_color + ")~RC(magenta>" + status_color + ")");
|
||||
}
|
||||
|
||||
void draw_bar(int xpos, int ypos, int bar_height, double filled, const color_t& col)
|
||||
{
|
||||
// Magic width number
|
||||
|
@ -329,9 +354,12 @@ void unit_drawer::redraw_unit(const unit& u) const
|
|||
if(static_cast<std::size_t>(side) != viewing_team + 1)
|
||||
os = orb_status::allied;
|
||||
orb_img = get_orb_image(os);
|
||||
} else if(static_cast<std::size_t>(side) != viewing_team + 1) {
|
||||
// We're looking at an ally's unit, during that ally's turn.
|
||||
auto os = dc.unit_orb_status(u);
|
||||
orb_img = get_playing_ally_orb_image(os);
|
||||
} else {
|
||||
// We're looking at either the player's own unit, or an ally's unit, during the unit's
|
||||
// owner's turn.
|
||||
// We're looking at the player's own unit, during the player's turn.
|
||||
auto os = dc.unit_orb_status(u);
|
||||
orb_img = get_orb_image(os);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ bool orb_status_helper::prefs_show_orb(orb_status os)
|
|||
case orb_status::partial:
|
||||
return preferences::show_partial_orb();
|
||||
case orb_status::allied:
|
||||
return preferences::show_allied_orb();
|
||||
return preferences::show_ally_orb();
|
||||
case orb_status::enemy:
|
||||
return preferences::show_enemy_orb();
|
||||
default:
|
||||
|
|
Loading…
Add table
Reference in a new issue