Skip to content

Commit

Permalink
Merge pull request #36178 from mark7/wb-playerstatus-color
Browse files Browse the repository at this point in the history
Standardize player info window colors
  • Loading branch information
ZhilkinSerg authored Dec 18, 2019
2 parents e81d01a + a034395 commit e8be1ac
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 45 deletions.
20 changes: 10 additions & 10 deletions src/effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,33 +548,33 @@ std::string effect::disp_desc( bool reduced ) const
// First print stat changes, adding + if value is positive
int tmp = get_avg_mod( "STR", reduced );
if( tmp > 0 ) {
ret << string_format( _( "Strength +%d; " ), tmp );
ret << string_format( _( "Strength <color_white>+%d</color>; " ), tmp );
} else if( tmp < 0 ) {
ret << string_format( _( "Strength %d; " ), tmp );
ret << string_format( _( "Strength <color_white>%d</color>; " ), tmp );
}
tmp = get_avg_mod( "DEX", reduced );
if( tmp > 0 ) {
ret << string_format( _( "Dexterity +%d; " ), tmp );
ret << string_format( _( "Dexterity <color_white>+%d</color>; " ), tmp );
} else if( tmp < 0 ) {
ret << string_format( _( "Dexterity %d; " ), tmp );
ret << string_format( _( "Dexterity <color_white>%d</color>; " ), tmp );
}
tmp = get_avg_mod( "PER", reduced );
if( tmp > 0 ) {
ret << string_format( _( "Perception +%d; " ), tmp );
ret << string_format( _( "Perception <color_white>+%d</color>; " ), tmp );
} else if( tmp < 0 ) {
ret << string_format( _( "Perception %d; " ), tmp );
ret << string_format( _( "Perception <color_white>%d</color>; " ), tmp );
}
tmp = get_avg_mod( "INT", reduced );
if( tmp > 0 ) {
ret << string_format( _( "Intelligence +%d; " ), tmp );
ret << string_format( _( "Intelligence <color_white>+%d</color>; " ), tmp );
} else if( tmp < 0 ) {
ret << string_format( _( "Intelligence %d; " ), tmp );
ret << string_format( _( "Intelligence <color_white>%d</color>; " ), tmp );
}
tmp = get_avg_mod( "SPEED", reduced );
if( tmp > 0 ) {
ret << string_format( _( "Speed +%d; " ), tmp );
ret << string_format( _( "Speed <color_white>+%d</color>; " ), tmp );
} else if( tmp < 0 ) {
ret << string_format( _( "Speed %d; " ), tmp );
ret << string_format( _( "Speed <color_white>%d</color>; " ), tmp );
}
// Newline if necessary
if( !ret.str().empty() && ret.str().back() != '\n' ) {
Expand Down
61 changes: 26 additions & 35 deletions src/player_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,39 +152,28 @@ void player::print_encumbrance( const catacurses::window &win, const int line,

static std::string swim_cost_text( int moves )
{
return string_format( ngettext( "Swimming costs %+d movement point. ",
"Swimming costs %+d movement points. ",
moves ),
moves );
return string_format( _( "Swimming movement point cost: <color_white>%+d</color>\n" ), moves );
}

static std::string run_cost_text( int moves )
{
return string_format( ngettext( "Running costs %+d movement point. ",
"Running costs %+d movement points. ",
moves ),
moves );
return string_format( _( "Running movement point cost: <color_white>%+d</color>\n" ), moves );
}

static std::string reload_cost_text( int moves )
{
return string_format( ngettext( "Reloading costs %+d movement point. ",
"Reloading costs %+d movement points. ",
moves ),
moves );
return string_format( _( "Reloading movement point cost: <color_white>%+d</color>\n" ), moves );
}

static std::string melee_cost_text( int moves )
{
return string_format( ngettext( "Melee and thrown attacks cost %+d movement point. ",
"Melee and thrown attacks cost %+d movement points. ",
moves ),
moves );
return string_format(
_( "Melee and thrown attack movement point cost: <color_white>%+d</color>\n" ), moves );
}

static std::string dodge_skill_text( double mod )
{
return string_format( _( "Dodge skill %+.1f. " ), mod );
return string_format( _( "Dodge skill: <color_white>%+.1f</color>\n" ), mod );
}

static int get_encumbrance( const player &p, body_part bp, bool combine )
Expand All @@ -204,37 +193,39 @@ static std::string get_encumbrance_description( const player &p, body_part bp, b
switch( bp ) {
case bp_torso: {
const int melee_roll_pen = std::max( -eff_encumbrance, -80 );
s += string_format( _( "Melee attack rolls %+d%%; " ), melee_roll_pen );
s += string_format( _( "Melee attack rolls: <color_white>%+d%%</color>\n" ), melee_roll_pen );
s += dodge_skill_text( -( eff_encumbrance / 10.0 ) );
s += swim_cost_text( ( eff_encumbrance / 10.0 ) * ( 80 - p.get_skill_level(
skill_swimming ) * 3 ) );
s += melee_cost_text( eff_encumbrance );
break;
}
case bp_head:
s += _( "Head encumbrance has no effect; it simply limits how much you can put on." );
s += _( "<color_magenta>Head encumbrance has no effect; it simply limits how much you can put on.</color>" );
break;
case bp_eyes:
s += string_format( _( "Perception %+d when checking traps or firing ranged weapons;\n"
"Dispersion %+d when throwing items." ),
-( eff_encumbrance / 10 ),
eff_encumbrance * 10 );
s += string_format(
_( "Perception when checking traps or firing ranged weapons: <color_white>%+d</color>\n"
"Dispersion when throwing items: <color_white>%+d</color>" ),
-( eff_encumbrance / 10 ),
eff_encumbrance * 10 );
break;
case bp_mouth:
s += _( "Covering your mouth will make it more difficult to breathe and catch your breath." );
s += _( "<color_magenta>Covering your mouth will make it more difficult to breathe and catch your breath.</color>" );
break;
case bp_arm_l:
case bp_arm_r:
s += _( "Arm encumbrance affects stamina cost of melee attacks and accuracy with ranged weapons." );
s += _( "<color_magenta>Arm encumbrance affects stamina cost of melee attacks and accuracy with ranged weapons.</color>" );
break;
case bp_hand_l:
case bp_hand_r:
s += _( "Reduces the speed at which you can handle or manipulate items\n" );
s += _( "<color_magenta>Reduces the speed at which you can handle or manipulate items.</color>\n\n" );
s += reload_cost_text( ( eff_encumbrance / 10 ) * 15 );
s += string_format( _( "Dexterity %+.1f when throwing items;\n" ), -( eff_encumbrance / 10.0f ) );
s += string_format( _( "Dexterity when throwing items: <color_white>%+.1f</color>\n" ),
-( eff_encumbrance / 10.0f ) );
s += melee_cost_text( eff_encumbrance / 2 );
s += "\n";
s += string_format( _( "Reduces aim speed of guns by %.1f." ), p.aim_speed_encumbrance_modifier() );
s += string_format( _( "Reduced gun aim speed: <color_white>%.1f</color>" ),
p.aim_speed_encumbrance_modifier() );
break;
case bp_leg_l:
case bp_leg_r:
Expand Down Expand Up @@ -347,7 +338,7 @@ static void draw_stats_tab( const catacurses::window &w_stats, const catacurses:
_( "Your weight is a general indicator of how much fat your body has stored up,"
" which in turn shows how prepared you are to survive for a time without food."
" Having too much, or too little, can be unhealthy." ) );
fold_and_print( w_info, point( 1, 1 + lines ), FULL_SCREEN_WIDTH - 2, c_magenta,
fold_and_print( w_info, point( 1, 1 + lines ), FULL_SCREEN_WIDTH - 2, c_light_gray,
you.get_weight_description() );
}
wrefresh( w_stats );
Expand Down Expand Up @@ -407,7 +398,7 @@ static void draw_encumbrance_tab( const catacurses::window &w_encumb,
}
const std::string s = get_encumbrance_description( you, bp, combined_here );
// NOLINTNEXTLINE(cata-use-named-point-constants)
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_magenta, s );
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_light_gray, s );
wrefresh( w_info );

action = ctxt.handle_input();
Expand Down Expand Up @@ -468,7 +459,7 @@ static void draw_traits_tab( const catacurses::window &w_traits, const catacurse
if( line < traitslist.size() ) {
const auto &mdata = traitslist[line].obj();
// NOLINTNEXTLINE(cata-use-named-point-constants)
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_magenta, string_format(
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_light_gray, string_format(
"%s: %s", colorize( mdata.name(), mdata.get_display_color() ), traitslist[line]->desc() ) );
}
wrefresh( w_traits );
Expand Down Expand Up @@ -538,7 +529,7 @@ static void draw_bionics_tab( const catacurses::window &w_bionics, const catacur
}
if( line < bionicslist.size() ) {
// NOLINTNEXTLINE(cata-use-named-point-constants)
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_white, "%s",
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_light_gray, "%s",
bionicslist[line].info().description );
}
wrefresh( w_bionics );
Expand Down Expand Up @@ -612,7 +603,7 @@ static void draw_effects_tab( const catacurses::window &w_effects, const catacur
}
if( line < actual_size ) {
// NOLINTNEXTLINE(cata-use-named-point-constants)
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_magenta,
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_light_gray,
effect_name_and_text[line].second );
}
wrefresh( w_effects );
Expand Down Expand Up @@ -765,7 +756,7 @@ static void draw_skills_tab( const catacurses::window &w_skills, const catacurse

if( selectedSkill ) {
// NOLINTNEXTLINE(cata-use-named-point-constants)
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_magenta,
fold_and_print( w_info, point( 1, 0 ), FULL_SCREEN_WIDTH - 2, c_light_gray,
selectedSkill->description() );
}
wrefresh( w_info );
Expand Down

0 comments on commit e8be1ac

Please sign in to comment.