提交 17e14970 编写于 作者: E Eric Pierce

Add overmap_loc_text and some better comments

- Adds a new overmap_loc_text widget variable, showing overmap coords
- Add overmap_location_desc to custom sidebar
- Documentation
上级 ab80d6f1
......@@ -8,5 +8,13 @@
"width": 0,
"height": 7,
"flags": [ "W_LABEL_NONE" ]
},
{
"id": "overmap_location_desc",
"type": "widget",
"label": "Location",
"var": "overmap_loc_text",
"style": "text",
"flags": [ "W_LABEL_NONE" ]
}
]
......@@ -18,6 +18,7 @@
"weapon_style_layout",
"place_date_time_layout",
"overmap_full_width",
"overmap_location_desc",
"light_moon_wind_temp_layout",
"vehicle_azimuth_cruise_fuel_layout",
"vital_numbers_layout",
......
......@@ -552,6 +552,7 @@ Some vars refer to text descriptors. These must use style "text". Examples:
| `moon_phase_text` | Phase of the moon - "New moon", "Waxing gibbous", "Full moon" etc.
| `move_mode_letter` | Movement mode - "W": walking, "R": running, "C": crouching, "P": prone
| `move_mode_text` | Movement mode - "walking", "running", "crouching", "prone"
| `overmap_loc_text` | Overmap coordinates, same as shown in the lower corner of overmap screen
| `overmap_text` | Colored text rendering of the local overmap; may define "width" and "height"
| `pain_text` | "Mild pain", "Distracting pain", "Intense pain", etc.
| `place_text` | Location place name
......
......@@ -141,6 +141,8 @@ std::string enum_to_string<widget_var>( widget_var data )
return "move_mode_text";
case widget_var::pain_text:
return "pain_text";
case widget_var::overmap_loc_text:
return "overmap_loc_text";
case widget_var::overmap_text:
return "overmap_text";
case widget_var::place_text:
......@@ -517,6 +519,7 @@ bool widget::uses_text_function()
case widget_var::move_mode_letter:
case widget_var::move_mode_text:
case widget_var::pain_text:
case widget_var::overmap_loc_text:
case widget_var::overmap_text:
case widget_var::place_text:
case widget_var::power_text:
......@@ -544,10 +547,15 @@ bool widget::uses_text_function()
std::string widget::color_text_function_string( const avatar &ava, unsigned int max_width )
{
std::string ret;
bool apply_color = true;
// Most text variables have both a string and a color.
// The string and color in `desc` will be converted to colorized text with markup.
std::pair<std::string, nc_color> desc;
// Give a default color (some widget_vars do not define one)
// Set a default color
desc.second = c_light_gray;
// By default, colorize the string in desc.first with the color in desc.second.
bool apply_color = true;
// Some helper display:: functions do their own internal colorization of the string.
// For those, desc.first is the already-colorized string, and apply_color is set to false.
switch( _var ) {
case widget_var::activity_text:
desc = display::activity_text_color( ava );
......@@ -592,6 +600,9 @@ std::string widget::color_text_function_string( const avatar &ava, unsigned int
case widget_var::pain_text:
desc = display::pain_text_color( ava );
break;
case widget_var::overmap_loc_text:
desc.first = display::overmap_position_text( ava.global_omt_location() );
break;
case widget_var::overmap_text:
desc.first = display::colorized_overmap_text( ava, _width == 0 ? max_width : _width, _height );
apply_color = false;
......
......@@ -59,6 +59,7 @@ enum class widget_var : int {
moon_phase_text,// Current phase of the moon
move_mode_letter, // Movement mode, color letter (W/R/C/P)
move_mode_text, // Movement mode, color text (walking/running/crouching/prone)
overmap_loc_text,// Local overmap position, pseudo latitude/longitude with Z-level
overmap_text, // Local overmap and mission marker, multi-line color string
pain_text, // Pain description text, color string
place_text, // Place name in world where character is
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册