Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refresh look_around appearance #36324

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1ad1d52
refresh look_around appearance
captnblood Dec 21, 2019
dfa1412
fix astyle regressions
captnblood Dec 21, 2019
4212753
fix astyle regressions
captnblood Dec 21, 2019
4b184b4
Update src/monster.cpp
Dec 21, 2019
c2bcda6
Update src/monster.cpp
Dec 21, 2019
f255056
Update src/monster.cpp
Dec 21, 2019
223ceeb
Update src/monster.cpp
Dec 21, 2019
e8197de
Update src/monster.cpp
Dec 21, 2019
de27a2e
Update src/monster.cpp
Dec 21, 2019
b8ad97f
Update src/monster.cpp
Dec 21, 2019
63b375d
Update src/monster.cpp
Dec 21, 2019
52fe0c2
Update game.cpp
Dec 21, 2019
1f388fe
fix translation symbols
captnblood Dec 21, 2019
80bd778
Update src/game.cpp
Dec 22, 2019
fac609d
item labels in colors
captnblood Dec 22, 2019
fa620f4
correct item colors
captnblood Dec 23, 2019
3b3e1eb
some cleanup and astyle
captnblood Dec 23, 2019
bd814f6
fix monster description
captnblood Dec 23, 2019
66e6ae1
monster desc
captnblood Dec 23, 2019
8310289
monster effect
captnblood Dec 24, 2019
cc30675
Merge remote-tracking branch 'upstream/master' into look_around_refresh
captnblood Dec 24, 2019
01a5458
Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA…
captnblood Dec 25, 2019
52ed7be
fixing some offsets
captnblood Dec 27, 2019
e40928a
astyle..
captnblood Dec 27, 2019
da84371
various cleanups, added npc
captnblood Dec 31, 2019
d5e7ca4
better display on narrow panel themes
captnblood Dec 31, 2019
5621cc1
prevent line overflow
captnblood Dec 31, 2019
5245f2b
Merge branch 'master' into look_around_refresh
Apr 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -5792,24 +5791,25 @@ 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 += "\n";
tile += _( "Decor : " ) + 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 );
Expand All @@ -5824,7 +5824,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 += ", " + m.furnname( below );
}

if( !m.has_floor_or_support( lp ) ) {
Expand All @@ -5837,13 +5837,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;
}
}

Expand All @@ -5863,6 +5862,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" );
This conversation was marked as resolved.
Show resolved Hide resolved
}

void game::print_trap_info( const tripoint &lp, const catacurses::window &w_look, const int column,
Expand Down Expand Up @@ -5946,9 +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::map<std::string, int> item_names;
//loop through list of items, get their names and colored string
std::map<std::string, std::pair<int, nc_color>> 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;
Expand All @@ -5958,12 +5960,13 @@ 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,
This conversation was marked as resolved.
Show resolved Hide resolved
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 );
}
}
}
Expand Down
63 changes: 49 additions & 14 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,26 +597,67 @@ 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() );

// 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 = _( "It is aware of your presence" );
} else {
senses_str = _( "It 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 );
mvwprintz( w, point( column, ++vStart ), c_light_gray, _( "Stance : " ) );
mvwprintz( w, point( column + 9, vStart ), att.second, att.first );

if( debug_mode ) {
wprintz( w, c_light_gray, _( " Difficulty " ) + to_string( type->difficulty ) );
// 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;
}

if( sees( g->u ) ) {
mvwprintz( w, point( column, ++vStart ), c_yellow, _( "Aware of your presence!" ) );
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<std::string> line1 = foldstring( type->get_description(), getmaxx( w ) - 11 - column );
std::vector<std::string> 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] );
}

This conversation was marked as resolved.
Show resolved Hide resolved
}

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 );

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() );
}
Expand All @@ -625,12 +666,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<std::string> 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;
}

Expand Down