From 1ad1d524faa426edeee2b017602f6eda7e1c37db Mon Sep 17 00:00:00 2001 From: captnblood Date: Sat, 21 Dec 2019 15:38:55 +0100 Subject: [PATCH 01/25] refresh look_around appearance --- src/game.cpp | 27 ++++++++++---------- src/monster.cpp | 67 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 63 insertions(+), 31 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 475dab42018f6..bfe46caf6494a 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5780,8 +5780,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; } @@ -5792,24 +5791,24 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l const int max_width = getmaxx( w_look ) - column - 1; int lines; std::string tile = m.tername( lp ); - tile = "(" + area_name + ") " + tile; + tile = "Place : " + area_name + "\nTile : " + tile; if( m.has_furn( lp ) ) { - tile += "; " + m.furnname( lp ); + tile += "\nDecor : " + m.furnname( lp ); } if( m.impassable( lp ) ) { lines = fold_and_print( w_look, point( column, line ), max_width, c_light_gray, - _( "%s; Impassable" ), + _( "%s, Impassable" ), tile ); } else { lines = fold_and_print( w_look, point( column, line ), max_width, c_light_gray, - _( "%s; Movement cost %d" ), + _( "%s\nMove : %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, ++lines ),c_light_gray, _( "Light : " ) ); + mvwprintz( w_look, point( column+9, lines ), ll.second, ll.first ); } std::string signage = m.get_signage( lp ); @@ -5824,7 +5823,7 @@ 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 += "Property5: " + m.furnname( below ); } if( !m.has_floor_or_support( lp ) ) { @@ -5837,13 +5836,12 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l 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, ++lines ), max_width, c_light_gray, + "Type : " + m.features( lp ) ); + fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, _( "Surface: %d%% \n" ), m.coverage( lp ) ); if( line < lines ) { - line = lines + map_features - 1; + line = lines + 1; } } @@ -5863,6 +5861,7 @@ void game::print_fields_info( const tripoint &lp, const catacurses::window &w_lo mvwprintz( w_look, point( column, ++line ), cur.color(), cur.name() ); } } + 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, diff --git a/src/monster.cpp b/src/monster.cpp index 0c3e76417bc7f..cdcfb65ddaf09 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -597,17 +597,58 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in { const int vEnd = vStart + vLines; - mvwprintz( w, point( column, vStart ), c_white, "%s ", name() ); - + // mvwprintz( w, point( column, vStart ), c_white, "%s ", name() ); + // display name + mvwprintz( w, point( column, vStart ), c_light_gray, "Entity : " ); + mvwprintz( w, point( column+9, vStart ), c_white, name() ); + + // 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+9, vStart ), color, sText ); + + // display sense + std::string senses_str = "--"; + if (sees(g->u)) + senses_str="He is aware of your presence"; + else + senses_str="He hasn't noticed you"; + + mvwprintz( w, point( column, ++vStart ), c_light_gray, "Senses : "); + mvwprintz( w, point( column+9, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); + + // display stance const auto att = get_attitude(); - wprintz( w, att.second, att.first ); - - if( debug_mode ) { - wprintz( w, c_light_gray, _( " Difficulty " ) + to_string( type->difficulty ) ); - } + mvwprintz( w, point( column, ++vStart ), c_light_gray, "Stance : " ); + mvwprintz( w, point( column+9, vStart ), att.second, att.first ); + + // display threat + int threatlvl = type->difficulty; + nc_color threatlvl_color = c_white; + if (threatlvl >= 8) + threatlvl_color = c_red; + else if (threatlvl >=4) + threatlvl_color= c_yellow; + else if (threatlvl >=0) + threatlvl_color = c_blue; + + mvwprintz( w, point( column, ++vStart ), c_light_gray, "Threat : "); + mvwprintz( w, point( column+9, 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 ) - 11 - column ); + std::vector lines = foldstring( type->get_description(), getmaxx( w ) - 1 - column ); + int numlines = lines.size(); + for( int i = 0; i < numlines && vStart <= vEnd; i++ ) { + if (i==0) + mvwprintz( w, point( column+9, vStart ), c_white, line1[i] ); + else + mvwprintz( w, point( column, ++vStart ), c_white, lines[i] ); - if( sees( g->u ) ) { - mvwprintz( w, point( column, ++vStart ), c_yellow, _( "Aware of your presence!" ) ); } std::string effects = get_effect_status(); @@ -615,8 +656,6 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in trim_and_print( w, point( used_space, vStart++ ), getmaxx( w ) - used_space - 2, h_white, effects ); - 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() ); } @@ -625,12 +664,6 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in wprintz( w, c_light_gray, _( " It is %s." ), size_names.at( get_size() ) ); } - std::vector lines = foldstring( type->get_description(), getmaxx( w ) - 1 - column ); - int numlines = lines.size(); - for( int i = 0; i < numlines && vStart <= vEnd; i++ ) { - mvwprintz( w, point( column, vStart++ ), c_white, lines[i] ); - } - return vStart; } From dfa1412c7845b5e12877a9989183588a512c841c Mon Sep 17 00:00:00 2001 From: captnblood Date: Sat, 21 Dec 2019 17:20:22 +0100 Subject: [PATCH 02/25] fix astyle regressions --- src/game.cpp | 4 ++-- src/monster.cpp | 42 ++++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index bfe46caf6494a..69708e0ee2f82 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5807,8 +5807,8 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l 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, ++lines ),c_light_gray, _( "Light : " ) ); - mvwprintz( w_look, point( column+9, lines ), ll.second, ll.first ); + mvwprintz( w_look, point( column, ++lines ), c_light_gray, _( "Light : " ) ); + mvwprintz( w_look, point( column + 9, lines ), ll.second, ll.first ); } std::string signage = m.get_signage( lp ); diff --git a/src/monster.cpp b/src/monster.cpp index cdcfb65ddaf09..3218363b2934f 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -597,57 +597,59 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in { const int vEnd = vStart + vLines; - // mvwprintz( w, point( column, vStart ), c_white, "%s ", name() ); // display name mvwprintz( w, point( column, vStart ), c_light_gray, "Entity : " ); - mvwprintz( w, point( column+9, vStart ), c_white, name() ); + mvwprintz( w, point( column + 9, vStart ), c_white, name() ); // 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+9, vStart ), color, sText ); + mvwprintz( w, point( column + 9, vStart ), color, sText ); // display sense std::string senses_str = "--"; - if (sees(g->u)) - senses_str="He is aware of your presence"; - else - senses_str="He hasn't noticed you"; + if( sees( g->u ) ) { + senses_str = "He is aware of your presence"; + } else { + senses_str = "He hasn't noticed you"; + } - mvwprintz( w, point( column, ++vStart ), c_light_gray, "Senses : "); - mvwprintz( w, point( column+9, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, "Senses : " ); + mvwprintz( w, point( column + 9, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); // display stance const auto att = get_attitude(); mvwprintz( w, point( column, ++vStart ), c_light_gray, "Stance : " ); - mvwprintz( w, point( column+9, vStart ), att.second, att.first ); + mvwprintz( w, point( column + 9, vStart ), att.second, att.first ); // display threat int threatlvl = type->difficulty; nc_color threatlvl_color = c_white; - if (threatlvl >= 8) + if( threatlvl >= 8 ) { threatlvl_color = c_red; - else if (threatlvl >=4) - threatlvl_color= c_yellow; - else if (threatlvl >=0) + } else if( threatlvl >= 4 ) { + threatlvl_color = c_yellow; + } else if( threatlvl >= 0 ) { threatlvl_color = c_blue; + } - mvwprintz( w, point( column, ++vStart ), c_light_gray, "Threat : "); - mvwprintz( w, point( column+9, vStart ), threatlvl_color, to_string(threatlvl)); + mvwprintz( w, point( column, ++vStart ), c_light_gray, "Threat : " ); + mvwprintz( w, point( column + 9, vStart ), threatlvl_color, to_string( threatlvl ) ); // dipslay aspect - mvwprintz(w, point(column, ++vStart ), c_light_gray, "Aspect :" ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, "Aspect :" ); std::vector line1 = foldstring( type->get_description(), getmaxx( w ) - 11 - column ); std::vector lines = foldstring( type->get_description(), getmaxx( w ) - 1 - column ); int numlines = lines.size(); for( int i = 0; i < numlines && vStart <= vEnd; i++ ) { - if (i==0) - mvwprintz( w, point( column+9, vStart ), c_white, line1[i] ); - else + if( i == 0 ) { + mvwprintz( w, point( column + 9, vStart ), c_white, line1[i] ); + } else { mvwprintz( w, point( column, ++vStart ), c_white, lines[i] ); + } } From 4212753991749f6590da988884312ee9435130d6 Mon Sep 17 00:00:00 2001 From: captnblood Date: Sat, 21 Dec 2019 17:23:32 +0100 Subject: [PATCH 03/25] fix astyle regressions --- src/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index 69708e0ee2f82..06526d796539b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5823,7 +5823,7 @@ 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 += "Property5: " + m.furnname( below ); + tile_below += ", " + m.furnname( below ); } if( !m.has_floor_or_support( lp ) ) { From 4b184b49b3087af51ef1f8117ffbb70214ccca93 Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 18:57:57 +0100 Subject: [PATCH 04/25] Update src/monster.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 3218363b2934f..7aa402220ee0a 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -598,7 +598,7 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in const int vEnd = vStart + vLines; // display name - mvwprintz( w, point( column, vStart ), c_light_gray, "Entity : " ); + mvwprintz( w, point( column, vStart ), c_light_gray, _( "Entity : " ) ); mvwprintz( w, point( column + 9, vStart ), c_white, name() ); // display health From c2bcda6f9def058332585c64b268bfd574fd4148 Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 18:58:38 +0100 Subject: [PATCH 05/25] Update src/monster.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 7aa402220ee0a..895ef44a28858 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -611,7 +611,7 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in // display sense std::string senses_str = "--"; if( sees( g->u ) ) { - senses_str = "He is aware of your presence"; + senses_str = _( "It is aware of your presence" ); } else { senses_str = "He hasn't noticed you"; } From f2550568c83f617bb6caaf6409f9ae517c3aa9cc Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 18:59:30 +0100 Subject: [PATCH 06/25] Update src/monster.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 895ef44a28858..af58844ab7475 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -605,7 +605,7 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in 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, ++vStart ), c_light_gray, _( "Health : " ) ); mvwprintz( w, point( column + 9, vStart ), color, sText ); // display sense From 223ceeb6143407e44aa205ebfe26aa46a84517e2 Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 18:59:50 +0100 Subject: [PATCH 07/25] Update src/monster.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index af58844ab7475..7379821762aab 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -613,7 +613,7 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in if( sees( g->u ) ) { senses_str = _( "It is aware of your presence" ); } else { - senses_str = "He hasn't noticed you"; + senses_str = _( "It hasn't noticed you" ); } mvwprintz( w, point( column, ++vStart ), c_light_gray, "Senses : " ); From e8197de9566e04f501687c9a398207fa465ddda9 Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 19:00:05 +0100 Subject: [PATCH 08/25] Update src/monster.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 7379821762aab..ccdb3d7ca3929 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -616,7 +616,7 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in senses_str = _( "It hasn't noticed you" ); } - mvwprintz( w, point( column, ++vStart ), c_light_gray, "Senses : " ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Senses : " ) ); mvwprintz( w, point( column + 9, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); // display stance From de27a2e263259671bdf7ec42197310fdffe4c7fd Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 19:00:20 +0100 Subject: [PATCH 09/25] Update src/monster.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index ccdb3d7ca3929..c17a83061c016 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -621,7 +621,7 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in // display stance const auto att = get_attitude(); - mvwprintz( w, point( column, ++vStart ), c_light_gray, "Stance : " ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Stance : " ) ); mvwprintz( w, point( column + 9, vStart ), att.second, att.first ); // display threat From b8ad97fe383d074a375835b07de5cf61dba57df2 Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 19:00:34 +0100 Subject: [PATCH 10/25] Update src/monster.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index c17a83061c016..a3fd496d70f99 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -635,7 +635,7 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in threatlvl_color = c_blue; } - mvwprintz( w, point( column, ++vStart ), c_light_gray, "Threat : " ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Threat : " ) ); mvwprintz( w, point( column + 9, vStart ), threatlvl_color, to_string( threatlvl ) ); // dipslay aspect From 63b375d39122ddfba372438ec393a9268b086981 Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 19:00:49 +0100 Subject: [PATCH 11/25] Update src/monster.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index a3fd496d70f99..98bdc6a0ab0ad 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -639,7 +639,7 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in mvwprintz( w, point( column + 9, vStart ), threatlvl_color, to_string( threatlvl ) ); // dipslay aspect - mvwprintz( w, point( column, ++vStart ), c_light_gray, "Aspect :" ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Aspect :" ) ); std::vector line1 = foldstring( type->get_description(), getmaxx( w ) - 11 - column ); std::vector lines = foldstring( type->get_description(), getmaxx( w ) - 1 - column ); From 52fe0c243ad2c98318f4c215872717d77c0088e1 Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sat, 21 Dec 2019 19:09:47 +0100 Subject: [PATCH 12/25] Update game.cpp --- src/game.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 06526d796539b..679160652f038 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5791,9 +5791,9 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l const int max_width = getmaxx( w_look ) - column - 1; int lines; std::string tile = m.tername( lp ); - tile = "Place : " + area_name + "\nTile : " + tile; + tile = _( "Place : " ) + area_name + "\nTile : " + tile; if( m.has_furn( lp ) ) { - tile += "\nDecor : " + m.furnname( lp ); + tile += "\n" + _( "Decor : " ) + m.furnname( lp ); } if( m.impassable( lp ) ) { @@ -5837,7 +5837,7 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l } } fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, - "Type : " + m.features( lp ) ); + _( "Type : " ) + m.features( lp ) ); fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, _( "Surface: %d%% \n" ), m.coverage( lp ) ); if( line < lines ) { From 1f388fe8867413ae9ee4148ef2a4cc06ac217ea0 Mon Sep 17 00:00:00 2001 From: captnblood Date: Sat, 21 Dec 2019 21:07:58 +0100 Subject: [PATCH 13/25] fix translation symbols --- src/game.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index 679160652f038..bbc672338fb67 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5793,7 +5793,8 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l std::string tile = m.tername( lp ); tile = _( "Place : " ) + area_name + "\nTile : " + tile; if( m.has_furn( lp ) ) { - tile += "\n" + _( "Decor : " ) + m.furnname( lp ); + tile += "\n"; + tile += _( "Decor : " ) + m.furnname( lp ); } if( m.impassable( lp ) ) { From 80bd778979fe2abee22700ac1f8091a77a96981a Mon Sep 17 00:00:00 2001 From: captnblood <59030614+captnblood@users.noreply.github.com> Date: Sun, 22 Dec 2019 13:55:16 +0100 Subject: [PATCH 14/25] Update src/game.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jianxiang Wang (王健翔) --- src/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index bbc672338fb67..7c0c392c34ea5 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5791,7 +5791,7 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l const int max_width = getmaxx( w_look ) - column - 1; int lines; std::string tile = m.tername( lp ); - tile = _( "Place : " ) + area_name + "\nTile : " + tile; + tile = _( "Place : " ) + area_name + _( "\nTile : " ) + tile; if( m.has_furn( lp ) ) { tile += "\n"; tile += _( "Decor : " ) + m.furnname( lp ); From fac609d91b8bd9b996946d2bff2fb747d4aa1d56 Mon Sep 17 00:00:00 2001 From: captnblood Date: Sun, 22 Dec 2019 16:36:18 +0100 Subject: [PATCH 15/25] item labels in colors --- src/game.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index 7c0c392c34ea5..d56035c8a2c60 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5946,9 +5946,13 @@ 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::vector obj_color; std::map item_names; + int counter = 0; for( auto &item : m.i_at( lp ) ) { ++item_names[item.tname()]; + obj_color.push_back(item.color_in_inventory()); } const int max_width = getmaxx( w_look ) - column - 1; @@ -5963,8 +5967,9 @@ void game::print_items_info( const tripoint &lp, const catacurses::window &w_loo pgettext( "%s is the name of the item. %d is the quantity of that item.", "%s [%d]" ), it.first.c_str(), it.second ); } else { - trim_and_print( w_look, point( column, ++line ), max_width, c_white, it.first ); + trim_and_print( w_look, point( column, ++line ), max_width, obj_color[counter], it.first ); } + counter++; } } } From fa620f4a22429b314db3b2539f908548fb6ba8f6 Mon Sep 17 00:00:00 2001 From: captnblood Date: Mon, 23 Dec 2019 12:01:28 +0100 Subject: [PATCH 16/25] correct item colors --- src/game.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index d56035c8a2c60..a15890dfe28c0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5946,13 +5946,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::vector obj_color; - std::map item_names; - int counter = 0; + //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()]; - obj_color.push_back(item.color_in_inventory()); + ++item_names[item.tname()].first; + item_names[item.tname()].second = item.color_in_inventory(); } const int max_width = getmaxx( w_look ) - column - 1; @@ -5962,14 +5960,14 @@ void game::print_items_info( const tripoint &lp, const catacurses::window &w_loo break; } - if( it.second > 1 ) { + if( it.second.first > 1 ) { trim_and_print( w_look, point( column, ++line ), max_width, c_white, 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, obj_color[counter], 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 ); } - counter++; } } } From 3b3e1eb2ea2c85f4aad00557e3783d5ca11f0e02 Mon Sep 17 00:00:00 2001 From: captnblood Date: Mon, 23 Dec 2019 13:28:24 +0100 Subject: [PATCH 17/25] some cleanup and astyle --- src/game.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index a15890dfe28c0..5b536c1b1888d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5859,10 +5859,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() ); } } - mvwprintz( w_look, point( column, ++line ), c_white, "\n" ); + // 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, @@ -5961,7 +5966,7 @@ void game::print_items_info( const tripoint &lp, const catacurses::window &w_loo } if( it.second.first > 1 ) { - trim_and_print( w_look, point( column, ++line ), max_width, c_white, + 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.first ); } else { From bd814f6014566fcdb300191691d6f38f296af6bc Mon Sep 17 00:00:00 2001 From: captnblood Date: Mon, 23 Dec 2019 17:19:19 +0100 Subject: [PATCH 18/25] fix monster description --- src/monster.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index 98bdc6a0ab0ad..f92a46e121814 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -640,17 +640,12 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in // dipslay aspect mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Aspect :" ) ); - - std::vector line1 = foldstring( type->get_description(), getmaxx( w ) - 11 - column ); std::vector lines = foldstring( type->get_description(), getmaxx( w ) - 1 - column ); int numlines = lines.size(); for( int i = 0; i < numlines && vStart <= vEnd; i++ ) { - if( i == 0 ) { - mvwprintz( w, point( column + 9, vStart ), c_white, line1[i] ); - } else { - mvwprintz( w, point( column, ++vStart ), c_white, lines[i] ); - } - + if ( i == 0 ) + ++vStart; + mvwprintz( w, point( column, ++vStart ), c_white, lines[i] ); } std::string effects = get_effect_status(); From 66e6ae15f996eec8ff743d32cb81712163ffa458 Mon Sep 17 00:00:00 2001 From: captnblood Date: Tue, 24 Dec 2019 00:55:52 +0100 Subject: [PATCH 19/25] monster desc --- src/monster.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index f92a46e121814..d61efacbcc356 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -639,12 +639,11 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in mvwprintz( w, point( column + 9, vStart ), threatlvl_color, to_string( threatlvl ) ); // dipslay aspect - mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Aspect :" ) ); + //mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Aspect :" ) ); + vStart++; std::vector lines = foldstring( type->get_description(), getmaxx( w ) - 1 - column ); int numlines = lines.size(); for( int i = 0; i < numlines && vStart <= vEnd; i++ ) { - if ( i == 0 ) - ++vStart; mvwprintz( w, point( column, ++vStart ), c_white, lines[i] ); } From 831028918bd49b14d2a1f4eb979253b4113381b7 Mon Sep 17 00:00:00 2001 From: captnblood Date: Tue, 24 Dec 2019 01:21:20 +0100 Subject: [PATCH 20/25] monster effect --- src/monster.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index d61efacbcc356..31de1a2e050e3 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -601,6 +601,13 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in mvwprintz( w, point( column, vStart ), c_light_gray, _( "Entity : " ) ); mvwprintz( w, point( column + 9, vStart ), c_white, name() ); + const auto att = get_attitude(); + std::string effects = get_effect_status(); + //size_t used_space = utf8_width( att.first ) + utf8_width( name() ) + 3; + 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; @@ -620,7 +627,6 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in mvwprintz( w, point( column + 9, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); // display stance - const auto att = get_attitude(); mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Stance : " ) ); mvwprintz( w, point( column + 9, vStart ), att.second, att.first ); @@ -647,11 +653,6 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in mvwprintz( w, point( column, ++vStart ), c_white, lines[i] ); } - std::string effects = get_effect_status(); - size_t used_space = utf8_width( att.first ) + utf8_width( name() ) + 3; - trim_and_print( w, point( used_space, vStart++ ), getmaxx( w ) - used_space - 2, - h_white, effects ); - if( has_effect( effect_ridden ) && mounted_player ) { mvwprintz( w, point( column, vStart++ ), c_white, _( "Rider: %s" ), mounted_player->disp_name() ); } From 52ed7be10ca3150c77440bf8cda32db3be176144 Mon Sep 17 00:00:00 2001 From: captnblood Date: Fri, 27 Dec 2019 12:20:58 +0100 Subject: [PATCH 21/25] fixing some offsets --- src/game.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 76a03d074ef09..e53ae82c83070 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5828,9 +5828,10 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l 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, ++lines ), c_light_gray, _( "Sign : " ) ); + trim_and_print( w_look, point( column + 9, lines ), max_width, 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 ) ) { @@ -5843,18 +5844,18 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l if( !m.has_floor_or_support( lp ) ) { fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray, - _( "Below: %s; No support" ), + _( "Below : %s; No support" ), tile_below ); } else { fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray, - _( "Below: %s; Walkable" ), + _( "Below : %s; Walkable" ), tile_below ); } } + fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, _( "Cover : %d%% \n" ), + m.coverage( lp ) ); fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, _( "Type : " ) + m.features( lp ) ); - fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, _( "Surface: %d%% \n" ), - m.coverage( lp ) ); if( line < lines ) { line = lines + 1; } From e40928a7e781697a75d78d8683306981119fcd15 Mon Sep 17 00:00:00 2001 From: captnblood Date: Fri, 27 Dec 2019 12:24:20 +0100 Subject: [PATCH 22/25] astyle.. --- src/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index e53ae82c83070..8acc1ee23f464 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5828,7 +5828,7 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l std::string signage = m.get_signage( lp ); if( !signage.empty() ) { - mvwprintz(w_look, point( column, ++lines ), c_light_gray, _( "Sign : " ) ); + mvwprintz( w_look, point( column, ++lines ), c_light_gray, _( "Sign : " ) ); trim_and_print( w_look, point( column + 9, lines ), max_width, c_cyan, // NOLINTNEXTLINE(cata-text-style): the question mark does not end a sentence u.has_trait( trait_ILLITERATE ) ? _( "???" ) : "%s", signage ); From da843712d1344cc55f3ea68327f30eed2be6adaf Mon Sep 17 00:00:00 2001 From: captnblood Date: Tue, 31 Dec 2019 05:10:01 +0100 Subject: [PATCH 23/25] various cleanups, added npc --- src/game.cpp | 55 ++++++++++++++++++++++++++----------------------- src/monster.cpp | 27 ++++++++++++++---------- src/npc.cpp | 53 ++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 90 insertions(+), 45 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 8acc1ee23f464..dde87eb5618de 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5803,33 +5803,35 @@ 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 = _( "Place : " ) + area_name + _( "\nTile : " ) + tile; + mvwprintz( w_look, point( column, line ), c_light_gray, _( "Place : " ) ); + trim_and_print( w_look, point( column + 9, line ), max_width - 9, c_white, area_name ); + + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Tile : " ) ); + trim_and_print( w_look, point( column + 9, line ), max_width - 9, c_light_gray, tile ); + if( m.has_furn( lp ) ) { - tile += "\n"; - tile += _( "Decor : " ) + m.furnname( lp ); + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Decor : " ) ); + mvwprintz( w_look, point( column + 9, 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 + 9, 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 + 9, line ), c_light_red, "Impassable" ); } else { - lines = fold_and_print( w_look, point( column, line ), max_width, c_light_gray, - _( "%s\nMove : %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 ) ); - mvwprintz( w_look, point( column, ++lines ), c_light_gray, _( "Light : " ) ); - mvwprintz( w_look, point( column + 9, lines ), ll.second, ll.first ); + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Move : " ) ); + mvwprintz( w_look, point( column + 9, line ), c_light_gray, "%d", m.move_cost( lp ) * 50 ); } std::string signage = m.get_signage( lp ); if( !signage.empty() ) { - mvwprintz( w_look, point( column, ++lines ), c_light_gray, _( "Sign : " ) ); - trim_and_print( w_look, point( column + 9, lines ), max_width, c_cyan, + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Sign : " ) ); + trim_and_print( w_look, point( column + 9, line ), max_width, c_cyan, // NOLINTNEXTLINE(cata-text-style): the question mark does not end a sentence u.has_trait( trait_ILLITERATE ) ? _( "???" ) : "%s", signage ); } @@ -5843,22 +5845,21 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l } if( !m.has_floor_or_support( lp ) ) { - fold_and_print( w_look, point( column, ++lines ), max_width, c_dark_gray, + 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, + fold_and_print( w_look, point( column, ++line ), max_width, c_dark_gray, _( "Below : %s; Walkable" ), tile_below ); } } - fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, _( "Cover : %d%% \n" ), + fold_and_print( w_look, point( column, ++line ), max_width, c_light_gray, _( "Cover : %d%% \n" ), m.coverage( lp ) ); - fold_and_print( w_look, point( column, ++lines ), max_width, c_light_gray, - _( "Type : " ) + m.features( lp ) ); - if( line < lines ) { - line = lines + 1; - } + + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Type : " ) ); + trim_and_print( w_look, point( column + 9, line ), max_width - 9, c_light_gray, m.features( lp ) ); + ++line; } void game::print_fields_info( const tripoint &lp, const catacurses::window &w_look, int column, @@ -5918,7 +5919,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, _( "Vehicle: " ) ); + mvwprintz( w_look, point( column + 9, line ), c_white, "%s", veh->name ); line = veh->print_part_list( w_look, ++line, last_line, getmaxx( w_look ), veh_part ); } } diff --git a/src/monster.cpp b/src/monster.cpp index 31de1a2e050e3..fc995c88af19a 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -601,7 +601,6 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in mvwprintz( w, point( column, vStart ), c_light_gray, _( "Entity : " ) ); mvwprintz( w, point( column + 9, vStart ), c_white, name() ); - const auto att = get_attitude(); std::string effects = get_effect_status(); //size_t used_space = utf8_width( att.first ) + utf8_width( name() ) + 3; size_t used_space = utf8_width( "Entity : " ) + utf8_width( name() ) + 3; @@ -618,24 +617,25 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in // display sense std::string senses_str = "--"; if( sees( g->u ) ) { - senses_str = _( "It is aware of your presence" ); + senses_str = _( "Aware of your presence" ); } else { - senses_str = _( "It hasn't noticed you" ); + senses_str = _( "Unaware of your presence" ); } mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Senses : " ) ); mvwprintz( w, point( column + 9, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); // display stance + const auto att = get_attitude(); mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Stance : " ) ); mvwprintz( w, point( column + 9, vStart ), att.second, att.first ); // display threat int threatlvl = type->difficulty; nc_color threatlvl_color = c_white; - if( threatlvl >= 8 ) { + if( threatlvl >= 20 ) { threatlvl_color = c_red; - } else if( threatlvl >= 4 ) { + } else if( threatlvl >= 10 ) { threatlvl_color = c_yellow; } else if( threatlvl >= 0 ) { threatlvl_color = c_blue; @@ -645,16 +645,21 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in mvwprintz( w, point( column + 9, vStart ), threatlvl_color, to_string( threatlvl ) ); // dipslay aspect - //mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Aspect :" ) ); - vStart++; - std::vector lines = foldstring( type->get_description(), getmaxx( w ) - 1 - column ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Aspect :" ) ); + std::vector line1 = foldstring( type->get_description(), getmaxx( w ) - 10 - 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 + 9, 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() ); + mvwprintz( w, point( column, vStart++ ), c_white, _( "Rider : %s" ), mounted_player->disp_name() ); } if( size_bonus > 0 ) { diff --git a/src/npc.cpp b/src/npc.cpp index 7e0ec9b6710d8..ab018d74a9215 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -2196,20 +2196,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: %s" ), name ); + // display name + mvwprintz( w, point( column, line ), c_light_gray, _( "Entity : " ) ); + mvwprintz( w, point( column + 9, line ), c_white, name ); + + // display health bars + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Health : " ) ); + mvwprintz( w, point( column + 9, 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 + 9, line ), c_yellow, _( "Aware of your presence!" ) ); + } else { + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Senses : " ) ); + mvwprintz( w, point( column + 9, line ), c_green, _( "Ignoring your presence" ) ); } + // 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 + 9, 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 + 9, 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 - 9 ); + // 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 + 9, 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 ); } }; @@ -2218,8 +2253,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, _( "Apparel: " ) ); + enumerate_print( wearing, c_dark_gray ); } // as of now, visibility of mutations is between 0 and 10 @@ -2239,7 +2276,7 @@ int npc::print_info( const catacurses::window &w, int line, int vLines, int colu const auto trait_str = visible_mutations( visibility_cap ); if( !trait_str.empty() ) { - const std::string mutations = _( "Traits: " ) + trait_str; + const std::string mutations = _( "Traits : " ) + trait_str; enumerate_print( mutations, c_green ); } From d5e7ca42b6f68aa368ddc8936a3289bb57582fdd Mon Sep 17 00:00:00 2001 From: captnblood Date: Tue, 31 Dec 2019 18:45:03 +0100 Subject: [PATCH 24/25] better display on narrow panel themes --- src/game.cpp | 44 ++++++++++++++++++++++---------------------- src/monster.cpp | 34 +++++++++++++++++----------------- src/npc.cpp | 32 ++++++++++++++++---------------- 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index dde87eb5618de..d806d87ec9630 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5805,33 +5805,33 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l const int max_width = getmaxx( w_look ) - column - 1; std::string tile = m.tername( lp ); - mvwprintz( w_look, point( column, line ), c_light_gray, _( "Place : " ) ); - trim_and_print( w_look, point( column + 9, line ), max_width - 9, c_white, area_name ); + 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 + 9, line ), max_width - 9, c_light_gray, tile ); + 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 ) ) { - mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Decor : " ) ); - mvwprintz( w_look, point( column + 9, line ), c_light_blue, 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 + 9, line ), ll.second, ll.first ); + 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 ) ) { - mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Move : " ) ); - mvwprintz( w_look, point( column + 9, line ), c_light_red, "Impassable" ); + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Move : " ) ); + mvwprintz( w_look, point( column + 8, line ), c_light_red, "Impassable" ); } else { - mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Move : " ) ); - mvwprintz( w_look, point( column + 9, line ), c_light_gray, "%d", m.move_cost( lp ) * 50 ); + 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() ) { - mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Sign : " ) ); - trim_and_print( w_look, point( column + 9, line ), max_width, c_cyan, + mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Sign : " ) ); + trim_and_print( w_look, point( column + 8, line ), max_width, c_cyan, // NOLINTNEXTLINE(cata-text-style): the question mark does not end a sentence u.has_trait( trait_ILLITERATE ) ? _( "???" ) : "%s", signage ); } @@ -5846,19 +5846,19 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l if( !m.has_floor_or_support( lp ) ) { fold_and_print( w_look, point( column, ++line ), max_width, c_dark_gray, - _( "Below : %s; No support" ), + _( "Below : %s; No support" ), tile_below ); } else { fold_and_print( w_look, point( column, ++line ), max_width, c_dark_gray, - _( "Below : %s; Walkable" ), + _( "Below : %s; Walkable" ), tile_below ); } } - fold_and_print( w_look, point( column, ++line ), max_width, c_light_gray, _( "Cover : %d%% \n" ), + fold_and_print( w_look, point( column, ++line ), max_width, c_light_gray, _( "Cover : %d%% \n" ), m.coverage( lp ) ); - mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Type : " ) ); - trim_and_print( w_look, point( column + 9, line ), max_width - 9, c_light_gray, m.features( lp ) ); + 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; } @@ -5920,8 +5920,8 @@ void game::print_vehicle_info( const vehicle *veh, int veh_part, const catacurse { if( veh ) { // display vehicle - mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Vehicle: " ) ); - mvwprintz( w_look, point( column + 9, line ), c_white, "%s", veh->name ); + 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 ); } } @@ -6006,7 +6006,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 fc995c88af19a..d589893c27f03 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -598,12 +598,12 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in const int vEnd = vStart + vLines; // display name - mvwprintz( w, point( column, vStart ), c_light_gray, _( "Entity : " ) ); - mvwprintz( w, point( column + 9, vStart ), c_white, 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( att.first ) + utf8_width( name() ) + 3; - size_t used_space = utf8_width( "Entity : " ) + utf8_width( name() ) + 3; + 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 ); @@ -611,24 +611,24 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in 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 + 9, vStart ), 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 ) ) { - senses_str = _( "Aware of your presence" ); + senses_str = _( "It knows you're there" ); } else { - senses_str = _( "Unaware of your presence" ); + senses_str = _( "It hasn't detected you" ); } - mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Senses : " ) ); - mvwprintz( w, point( column + 9, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Senses: " ) ); + mvwprintz( w, point( column + 8, vStart ), sees( g->u ) ? c_red : c_green, senses_str ); // display stance const auto att = get_attitude(); - mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Stance : " ) ); - mvwprintz( w, point( column + 9, vStart ), att.second, att.first ); + mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Stance: " ) ); + mvwprintz( w, point( column + 8, vStart ), att.second, att.first ); // display threat int threatlvl = type->difficulty; @@ -641,25 +641,25 @@ int monster::print_info( const catacurses::window &w, int vStart, int vLines, in threatlvl_color = c_blue; } - mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Threat : " ) ); - mvwprintz( w, point( column + 9, vStart ), threatlvl_color, to_string( threatlvl ) ); + 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 ) - 10 - column ); + 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 + 9, vStart ), c_dark_gray, line1[0] ); + 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_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() ); + mvwprintz( w, point( column, vStart++ ), c_white, _( "Rider : %s" ), mounted_player->disp_name() ); } if( size_bonus > 0 ) { diff --git a/src/npc.cpp b/src/npc.cpp index ab018d74a9215..7fcd2a6a70c13 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -2198,41 +2198,41 @@ int npc::print_info( const catacurses::window &w, int line, int vLines, int colu // w is also 48 characters wide - 2 characters for border = 46 characters for us // display name - mvwprintz( w, point( column, line ), c_light_gray, _( "Entity : " ) ); - mvwprintz( w, point( column + 9, line ), c_white, 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 + 9, line ), + 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_light_gray, _( "Senses : " ) ); - mvwprintz( w, point( column + 9, 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 + 9, line ), c_green, _( "Ignoring your presence" ) ); + 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 + 9, line ), res.second, res.first.translated() ); + 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() ) { - mvwprintz( w, point( column, ++line ), c_light_gray, _( "Wield : " ) ); - trim_and_print( w, point( column + 9, line ), iWidth, c_red, 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 ) { // 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 - 9 ); + 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 @@ -2241,7 +2241,7 @@ int npc::print_info( const catacurses::window &w, int line, int vLines, int colu const std::vector longlist = foldstring( test, iWidth ); // print 1st line, from shortlist with label offset - mvwprintz( w, point( column + 9, line++ ), color, shortlist[0] ); + 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 ) { @@ -2255,7 +2255,7 @@ int npc::print_info( const catacurses::window &w, int line, int vLines, int colu if( !worn_str.empty() ) { // display worn apparel const std::string wearing = worn_str; - mvwprintz( w, point( column, ++line ), c_light_gray, _( "Apparel: " ) ); + mvwprintz( w, point( column, ++line ), c_light_gray, _( "Outfit: " ) ); enumerate_print( wearing, c_dark_gray ); } @@ -2276,7 +2276,7 @@ int npc::print_info( const catacurses::window &w, int line, int vLines, int colu const auto trait_str = visible_mutations( visibility_cap ); if( !trait_str.empty() ) { - const std::string mutations = _( "Traits : " ) + trait_str; + const std::string mutations = _( "Traits: " ) + trait_str; enumerate_print( mutations, c_green ); } From 5621cc186902cc5a4fcb0c8b7ab78b896db71c91 Mon Sep 17 00:00:00 2001 From: captnblood Date: Tue, 31 Dec 2019 19:38:03 +0100 Subject: [PATCH 25/25] prevent line overflow --- src/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index d806d87ec9630..bb79ebb67e5f6 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -5831,7 +5831,7 @@ void game::print_terrain_info( const tripoint &lp, const catacurses::window &w_l std::string signage = m.get_signage( lp ); if( !signage.empty() ) { mvwprintz( w_look, point( column, ++line ), c_light_gray, _( "Sign : " ) ); - trim_and_print( w_look, point( column + 8, line ), max_width, c_cyan, + 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 ) ? _( "???" ) : "%s", signage ); }