diff --git a/src/game.cpp b/src/game.cpp index f03c7aad21249..7dc10b081df25 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5765,8 +5765,7 @@ void game::print_visibility_info( const catacurses::window &w_look, int column, visibility_message = _( "Unseen." ); break; } - - mvwprintw( w_look, point( line, column ), visibility_message ); + mvwprintz( w_look, point( line, column ), c_light_gray, visibility_message ); line += 2; } @@ -5775,33 +5774,37 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l int &line ) { const int max_width = getmaxx( w_look ) - column - 1; - int lines; + std::string tile = m.tername( lp ); - tile = "(" + area_name + ") " + tile; + mvwprintz( w_look, point( column, line ), c_light_gray, _( "Place : " ) ); + trim_and_print( w_look, point( column + 8, line ), max_width - 8, c_white, area_name ); + + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Tile : " ) ); + trim_and_print( w_look, point( column + 8, line ), max_width - 8, c_light_gray, tile ); + if( m.has_furn( lp ) ) { - tile += "; " + m.furnname( lp ); + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Decor : " ) ); + mvwprintz( w_look, point( column + 8, line ), c_light_blue, m.furnname( lp ) ); } + const auto ll = get_light_level( std::max( 1.0, + LIGHT_AMBIENT_LIT - m.ambient_light_at( lp ) + 1.0 ) ); + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Light : " ) ); + mvwprintz( w_look, point( column + 8, line ), ll.second, ll.first ); if( m.impassable( lp ) ) { - lines = fold_and_print( w_look, point( column, line ), max_width, c_light_gray, - _( "%s; Impassable" ), - tile ); + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Move : " ) ); + mvwprintz( w_look, point( column + 8, line ), c_light_red, "Impassable" ); } else { - lines = fold_and_print( w_look, point( column, line ), max_width, c_light_gray, - _( "%s; Movement cost %d" ), - tile, m.move_cost( lp ) * 50 ); - - const auto ll = get_light_level( std::max( 1.0, - LIGHT_AMBIENT_LIT - m.ambient_light_at( lp ) + 1.0 ) ); - mvwprintw( w_look, point( column, ++lines ), _( "Lighting: " ) ); - wprintz( w_look, ll.second, ll.first ); + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Move : " ) ); + mvwprintz( w_look, point( column + 8, line ), c_light_gray, "%d", m.move_cost( lp ) * 50 ); } std::string signage = m.get_signage( lp ); if( !signage.empty() ) { - trim_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray, + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Sign : " ) ); + trim_and_print( w_look, point( column + 8, line ), max_width - 8, c_cyan, // NOLINTNEXTLINE(cata-text-style): the question mark does not end a sentence - u.has_trait( trait_ILLITERATE ) ? _( "Sign: ???" ) : _( "Sign: %s" ), signage ); + u.has_trait( trait_ILLITERATE ) ? _( "???" ) : "%s", signage ); } if( m.has_zlevels() && lp.z > -OVERMAP_DEPTH && !m.has_floor( lp ) ) { @@ -5809,27 +5812,25 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l tripoint below( lp.xy(), lp.z - 1 ); std::string tile_below = m.tername( below ); if( m.has_furn( below ) ) { - tile_below += "; " + m.furnname( below ); + tile_below += ", " + m.furnname( below ); } if( !m.has_floor_or_support( lp ) ) { - fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray, - _( "Below: %s; No support" ), + fold_and_print( w_look, point( column, ++line ), max_width, c_dark_gray, + _( "Below : %s; No support" ), tile_below ); } else { - fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray, - _( "Below: %s; Walkable" ), + fold_and_print( w_look, point( column, ++line ), max_width, c_dark_gray, + _( "Below : %s; Walkable" ), tile_below ); } } - - int map_features = fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray, - m.features( lp ) ); - fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, _( "Coverage: %d%%" ), + fold_and_print( w_look, point( column, ++line ), max_width, c_light_gray, _( "Cover : %d%% \n" ), m.coverage( lp ) ); - if( line < lines ) { - line = lines + map_features - 1; - } + + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Type : " ) ); + trim_and_print( w_look, point( column + 8, line ), max_width - 8, c_light_gray, m.features( lp ) ); + ++line; } void game::print_fields_info( const tripoint &lp, const catacurses::window &w_look, int column, @@ -5845,9 +5846,15 @@ void game::print_fields_info( const tripoint &lp, const catacurses::window &w_lo get_fire_fuel_string( lp ) ) - 1; line += lines; } else { + // display tile special detail if it exists (blood stain, puddle of acid ..) mvwprintz( w_look, point( column, ++line ), cur.color(), cur.name() ); } } + // only display new line if there is items to show + int size = std::distance( tmpfield.begin(), tmpfield.end() ); + if( size > 0 ) { + mvwprintz( w_look, point( column, ++line ), c_white, "\n" ); + } } void game::print_trap_info( const tripoint &lp, const catacurses::window &w_look, const int column, @@ -5882,7 +5889,9 @@ void game::print_vehicle_info( const vehicle *veh, int veh_part, const catacurse const int column, int &line, const int last_line ) { if( veh ) { - mvwprintw( w_look, point( column, ++line ), _( "There is a %s there. Parts:" ), veh->name ); + // display vehicle + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Auto : " ) ); + mvwprintz( w_look, point( column + 8, line ), c_white, "%s", veh->name ); line = veh->print_part_list( w_look, ++line, last_line, getmaxx( w_look ), veh_part ); } } @@ -5930,9 +5939,11 @@ void game::print_items_info( const tripoint &lp, const catacurses::window &w_loo _( "There's something there, but you can't see what it is." ) ); return; } else { - std::map item_names; + //loop through list of items, get their names and colored string + std::map> item_names; for( auto &item : m.i_at( lp ) ) { - ++item_names[item.tname()]; + ++item_names[item.tname()].first; + item_names[item.tname()].second = item.color_in_inventory(); } const int max_width = getmaxx( w_look ) - column - 1; @@ -5942,12 +5953,13 @@ void game::print_items_info( const tripoint &lp, const catacurses::window &w_loo break; } - if( it.second > 1 ) { - trim_and_print( w_look, point( column, ++line ), max_width, c_white, + if( it.second.first > 1 ) { + trim_and_print( w_look, point( column, ++line ), max_width, it.second.second, pgettext( "%s is the name of the item. %d is the quantity of that item.", "%s [%d]" ), - it.first.c_str(), it.second ); + it.first.c_str(), it.second.first ); } else { - trim_and_print( w_look, point( column, ++line ), max_width, c_white, it.first ); + // display colored item list in look_around window + trim_and_print( w_look, point( column, ++line ), max_width, it.second.second, it.first ); } } } @@ -5964,7 +5976,7 @@ void game::print_graffiti_info( const tripoint &lp, const catacurses::window &w_ const int max_width = getmaxx( w_look ) - column - 2; if( m.has_graffiti_at( lp ) ) { fold_and_print( w_look, point( column, ++line ), max_width, c_light_gray, - m.ter( lp ) == t_grave_new ? _( "Graffiti: %s" ) : _( "Inscription: %s" ), + m.ter( lp ) == t_grave_new ? _( "Graff : %s" ) : _( "Note : %s" ), m.graffiti_at( lp ) ); } } diff --git a/src/monster.cpp b/src/monster.cpp index 4b4798b0887ca..21fe3fcdd1323 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -640,40 +640,72 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in { const int vEnd = vStart + vLines; - mvwprintz( w, point( column, vStart ), basic_symbol_color(), name() ); - wprintw( w, " " ); - const auto att = get_attitude(); - wprintz( w, att.second, att.first ); - - if( debug_mode ) { - wprintz( w, c_light_gray, _( " Difficulty " ) + to_string( type->difficulty ) ); - } + // display name + mvwprintz( w, point( column, vStart ), c_light_gray, _( "Entity: " ) ); + mvwprintz( w, point( column + 8, vStart ), c_white, name() ); + std::string effects = get_effect_status(); + size_t used_space = utf8_width( "Entity: " ) + utf8_width( name() ) + 3; + trim_and_print( w, point( used_space, vStart ), getmaxx( w ) - used_space - 2, + h_white, effects ); + + // display health + nc_color color = c_white; + std::string sText; + get_HP_Bar( color, sText ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Health: " ) ); + mvwprintz( w, point( column + 8, vStart ), color, sText ); + + // display sense + std::string senses_str = "--"; if( sees( g->u ) ) { - mvwprintz( w, point( column, ++vStart ), c_yellow, _( "Aware of your presence!" ) ); + senses_str = _( "It knows you're there" ); + } else { + senses_str = _( "It hasn't detected you" ); } - std::string effects = get_effect_status(); - if( !effects.empty() ) { - trim_and_print( w, point( column, ++vStart ), getmaxx( w ) - 2, h_white, effects ); - } + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Senses: " ) ); + mvwprintz( w, point( column + 8, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); - const auto hp_desc = hp_description( hp, type->hp ); - mvwprintz( w, point( column, ++vStart ), hp_desc.second, hp_desc.first ); - if( has_effect( effect_ridden ) && mounted_player ) { - mvwprintz( w, point( column, ++vStart ), c_white, _( "Rider: %s" ), mounted_player->disp_name() ); - } + // display stance + const auto att = get_attitude(); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Stance: " ) ); + mvwprintz( w, point( column + 8, vStart ), att.second, att.first ); - if( size_bonus > 0 ) { - wprintz( w, c_light_gray, _( " It is %s." ), size_names.at( get_size() ) ); + // display threat + int threatlvl = type->difficulty; + nc_color threatlvl_color = c_white; + if( threatlvl >= 20 ) { + threatlvl_color = c_red; + } else if( threatlvl >= 10 ) { + threatlvl_color = c_yellow; + } else if( threatlvl >= 0 ) { + threatlvl_color = c_blue; } - std::vector lines = foldstring( type->get_description(), getmaxx( w ) - 1 - column ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Threat: " ) ); + mvwprintz( w, point( column + 8, vStart ), threatlvl_color, to_string( threatlvl ) ); + + // dipslay aspect + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Aspect: " ) ); + std::vector line1 = foldstring( type->get_description(), getmaxx( w ) - 9 - column ); + + int offset = utf8_width( line1[0] ); + std::string test = type->get_description().substr( offset ); + std::vector lines = foldstring( test, getmaxx( w ) - 2 - column ); + + mvwprintz( w, point( column + 8, vStart ), c_dark_gray, line1[0] ); int numlines = lines.size(); for( int i = 0; i < numlines && vStart <= vEnd; i++ ) { - mvwprintz( w, point( column, ++vStart ), c_white, lines[i] ); + mvwprintz( w, point( column, ++vStart ), c_dark_gray, lines[i] ); + } + ++vStart; + if( has_effect( effect_ridden ) && mounted_player ) { + mvwprintz( w, point( column, vStart++ ), c_white, _( "Rider : %s" ), mounted_player->disp_name() ); + } + if( size_bonus > 0 ) { + wprintz( w, c_light_gray, _( " It is %s." ), size_names.at( get_size() ) ); } - return vStart; } diff --git a/src/npc.cpp b/src/npc.cpp index 6246f2cbec736..8bf4b191d9dff 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -2209,21 +2209,55 @@ int npc::print_info( const catacurses::window &w, int line, int vLines, int colu // is a blank line. w is 13 characters tall, and we can't use the last one // because it's a border as well; so we have lines 6 through 11. // w is also 48 characters wide - 2 characters for border = 46 characters for us - mvwprintz( w, point( column, line++ ), c_white, _( "NPC: " ) ); - wprintz( w, basic_symbol_color(), name ); + // display name + mvwprintz( w, point( column, line ), c_light_gray, _( "Entity: " ) ); + trim_and_print( w, point( column + 8, line ), iWidth - 8, c_white, name ); + + // display health bars + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Health: " ) ); + mvwprintz( w, point( column + 8, line ), + get_hp_bar( hp_percentage(), 200 ).second, + get_hp_bar( hp_percentage(), 100 ).first ); + + // display senses if( sees( g->u ) ) { - mvwprintz( w, point( column, line++ ), c_yellow, _( "Aware of your presence!" ) ); + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Senses: " ) ); + mvwprintz( w, point( column + 8, line ), c_yellow, _( "Aware of your presence" ) ); + } else { + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Senses: " ) ); + mvwprintz( w, point( column + 8, line ), c_green, _( "Unaware of you" ) ); } + // display stance + Attitude att = attitude_to( g->u ); + const std::pair res = Creature::get_attitude_ui_data( att ); + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Stance: " ) ); + mvwprintz( w, point( column + 8, line ), res.second, res.first.translated() ); + + // display weapon if( is_armed() ) { - trim_and_print( w, point( column, line++ ), iWidth, c_red, _( "Wielding a %s" ), weapon.tname() ); + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Wield : " ) ); + trim_and_print( w, point( column + 8, line ), iWidth, c_red, weapon.tname() ); } const auto enumerate_print = [ w, last_line, column, iWidth, &line ]( const std::string & str_in, nc_color color ) { - const std::vector folded = foldstring( str_in, iWidth ); - for( auto it = folded.begin(); it < folded.end() && line < last_line; ++it, ++line ) { + // function to build a list of worn apparel, first line is shorter due to label taking space. + // build 1st line + const std::vector shortlist = foldstring( str_in, iWidth - 8 ); + // calc how much we could cram into the first line + int offset = utf8_width( shortlist[0] ); + // substract that from initial string + std::string test = str_in.substr( offset ); + // build new vector of strings without the portion we've already put on 1st line + const std::vector longlist = foldstring( test, iWidth ); + + // print 1st line, from shortlist with label offset + mvwprintz( w, point( column + 8, line++ ), color, shortlist[0] ); + + // print the rest from longlist + for( auto it = longlist.begin(); it < longlist.end() && line < last_line; ++it, ++line ) { trim_and_print( w, point( column, line ), iWidth, color, *it ); } }; @@ -2232,8 +2266,10 @@ int npc::print_info( const catacurses::window &w, int line, int vLines, int colu return it.tname(); } ); if( !worn_str.empty() ) { - const std::string wearing = _( "Wearing: " ) + worn_str; - enumerate_print( wearing, c_light_blue ); + // display worn apparel + const std::string wearing = worn_str; + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Outfit: " ) ); + enumerate_print( wearing, c_dark_gray ); } // as of now, visibility of mutations is between 0 and 10