From a0343951e97b6fb562bdb9a8aede19cc5d658d29 Mon Sep 17 00:00:00 2001 From: Mark Schreiber Date: Mon, 16 Dec 2019 21:17:34 -0800 Subject: [PATCH] Standardize player info window colors/format Previously, the colors and format used on the player info window had varied from tab to tab. Make all tabs conform to the color convention used in the STATS tab: Magenta is reserved for text that must be set off from the rest, white for numeric stats to make them stand out, light gray for everything else. Convert "sentence"-based structure of ENCUMBRANCE AND WARMTH tab to one-line-per-stat format. --- src/effect.cpp | 20 +++++++------- src/player_display.cpp | 61 ++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 45 deletions(-) diff --git a/src/effect.cpp b/src/effect.cpp index f07f10c47b290..de0ab1df9e2b9 100644 --- a/src/effect.cpp +++ b/src/effect.cpp @@ -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 +%d; " ), tmp ); } else if( tmp < 0 ) { - ret << string_format( _( "Strength %d; " ), tmp ); + ret << string_format( _( "Strength %d; " ), tmp ); } tmp = get_avg_mod( "DEX", reduced ); if( tmp > 0 ) { - ret << string_format( _( "Dexterity +%d; " ), tmp ); + ret << string_format( _( "Dexterity +%d; " ), tmp ); } else if( tmp < 0 ) { - ret << string_format( _( "Dexterity %d; " ), tmp ); + ret << string_format( _( "Dexterity %d; " ), tmp ); } tmp = get_avg_mod( "PER", reduced ); if( tmp > 0 ) { - ret << string_format( _( "Perception +%d; " ), tmp ); + ret << string_format( _( "Perception +%d; " ), tmp ); } else if( tmp < 0 ) { - ret << string_format( _( "Perception %d; " ), tmp ); + ret << string_format( _( "Perception %d; " ), tmp ); } tmp = get_avg_mod( "INT", reduced ); if( tmp > 0 ) { - ret << string_format( _( "Intelligence +%d; " ), tmp ); + ret << string_format( _( "Intelligence +%d; " ), tmp ); } else if( tmp < 0 ) { - ret << string_format( _( "Intelligence %d; " ), tmp ); + ret << string_format( _( "Intelligence %d; " ), tmp ); } tmp = get_avg_mod( "SPEED", reduced ); if( tmp > 0 ) { - ret << string_format( _( "Speed +%d; " ), tmp ); + ret << string_format( _( "Speed +%d; " ), tmp ); } else if( tmp < 0 ) { - ret << string_format( _( "Speed %d; " ), tmp ); + ret << string_format( _( "Speed %d; " ), tmp ); } // Newline if necessary if( !ret.str().empty() && ret.str().back() != '\n' ) { diff --git a/src/player_display.cpp b/src/player_display.cpp index 4ff479fe9602a..c912205e4566b 100644 --- a/src/player_display.cpp +++ b/src/player_display.cpp @@ -151,39 +151,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: %+d\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: %+d\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: %+d\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: %+d\n" ), moves ); } static std::string dodge_skill_text( double mod ) { - return string_format( _( "Dodge skill %+.1f. " ), mod ); + return string_format( _( "Dodge skill: %+.1f\n" ), mod ); } static int get_encumbrance( const player &p, body_part bp, bool combine ) @@ -203,7 +192,7 @@ 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: %+d%%\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 ) ); @@ -211,29 +200,31 @@ static std::string get_encumbrance_description( const player &p, body_part bp, b break; } case bp_head: - s += _( "Head encumbrance has no effect; it simply limits how much you can put on." ); + s += _( "Head encumbrance has no effect; it simply limits how much you can put on." ); 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: %+d\n" + "Dispersion when throwing items: %+d" ), + -( 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 += _( "Covering your mouth will make it more difficult to breathe and catch your breath." ); break; case bp_arm_l: case bp_arm_r: - s += _( "Arm encumbrance affects stamina cost of melee attacks and accuracy with ranged weapons." ); + s += _( "Arm encumbrance affects stamina cost of melee attacks and accuracy with ranged weapons." ); break; case bp_hand_l: case bp_hand_r: - s += _( "Reduces the speed at which you can handle or manipulate items\n" ); + s += _( "Reduces the speed at which you can handle or manipulate items.\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: %+.1f\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: %.1f" ), + p.aim_speed_encumbrance_modifier() ); break; case bp_leg_l: case bp_leg_r: @@ -346,7 +337,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 ); @@ -406,7 +397,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(); @@ -467,7 +458,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 ); @@ -537,7 +528,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 ); @@ -611,7 +602,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 ); @@ -764,7 +755,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 );