Skip to content

Commit

Permalink
Keep displaying selected outfit throughout chargen (CleverRaven#70347)
Browse files Browse the repository at this point in the history
* Keep displaying selected outfit throughout chargen

* Update src/newcharacter.cpp

Co-authored-by: mqrause <[email protected]>

* Fix display for small display

* clang fix

---------

Co-authored-by: Fris0uman <[email protected]>
Co-authored-by: mqrause <[email protected]>
  • Loading branch information
3 people authored Dec 22, 2023
1 parent 43a383c commit c6f6397
Showing 1 changed file with 66 additions and 3 deletions.
69 changes: 66 additions & 3 deletions src/newcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2454,6 +2454,7 @@ static std::string assemble_hobby_details( const avatar &u, const input_context

assembled += string_format( g_switch_msg( u ), ctxt.get_desc( "CHANGE_GENDER" ),
sorted_hobbies[cur_id]->gender_appropriate_name( !u.male ) ) + "\n";
assembled += string_format( dress_switch_msg(), ctxt.get_desc( "CHANGE_OUTFIT" ) ) + "\n";

assembled += "\n" + colorize( _( "Background story:" ), COL_HEADER ) + "\n";
assembled += colorize( sorted_hobbies[cur_id]->description( u.male ), c_green ) + "\n";
Expand Down Expand Up @@ -2567,6 +2568,7 @@ void set_hobbies( tab_manager &tabs, avatar &u, pool_type pool )
ctxt.register_navigate_ui_list();
ctxt.register_action( "CONFIRM" );
ctxt.register_action( "CHANGE_GENDER" );
ctxt.register_action( "CHANGE_OUTFIT" );
ctxt.register_action( "SORT" );
ctxt.register_action( "HELP_KEYBINDINGS" );
ctxt.register_action( "FILTER" );
Expand Down Expand Up @@ -2737,6 +2739,9 @@ void set_hobbies( tab_manager &tabs, avatar &u, pool_type pool )
u.toggle_trait_deps( trait );
}

} else if( action == "CHANGE_OUTFIT" ) {
outfit = !outfit;
recalc_hobbies = true;
} else if( action == "CHANGE_GENDER" ) {
u.male = !u.male;
profession_sorter.male = u.male;
Expand Down Expand Up @@ -3111,6 +3116,8 @@ static std::string assemble_scenario_details( const avatar &u, const input_conte

assembled += string_format( g_switch_msg( u ), ctxt.get_desc( "CHANGE_GENDER" ),
current_scenario->gender_appropriate_name( !u.male ) ) + "\n";
assembled += string_format( dress_switch_msg(), ctxt.get_desc( "CHANGE_OUTFIT" ) ) + "\n";

assembled += string_format(
_( "Press <color_light_green>%1$s</color> to change cataclysm start date, <color_light_green>%2$s</color> to change game start date, <color_light_green>%3$s</color> to reset calendar." ),
ctxt.get_desc( "CHANGE_START_OF_CATACLYSM" ), ctxt.get_desc( "CHANGE_START_OF_GAME" ),
Expand Down Expand Up @@ -3237,6 +3244,7 @@ void set_scenario( tab_manager &tabs, avatar &u, pool_type pool )
ctxt.register_action( "SORT" );
ctxt.register_action( "HELP_KEYBINDINGS" );
ctxt.register_action( "CHANGE_GENDER" );
ctxt.register_action( "CHANGE_OUTFIT" );
ctxt.register_action( "FILTER" );
ctxt.register_action( "RESET_FILTER" );
ctxt.register_action( "CHANGE_START_OF_CATACLYSM" );
Expand Down Expand Up @@ -3384,6 +3392,9 @@ void set_scenario( tab_manager &tabs, avatar &u, pool_type pool )
}
reset_scenario( u, sorted_scens[cur_id] );
details_recalc = true;
} else if( action == "CHANGE_OUTFIT" ) {
outfit = !outfit;
recalc_scens = true;
} else if( action == "CHANGE_GENDER" ) {
u.male = !u.male;
recalc_scens = true;
Expand Down Expand Up @@ -3440,6 +3451,7 @@ namespace char_creation
enum description_selector {
NAME,
GENDER,
OUTFIT,
HEIGHT,
AGE,
BLOOD,
Expand Down Expand Up @@ -3489,6 +3501,26 @@ static void draw_gender( ui_adaptor &ui, const catacurses::window &w_gender,
wnoutrefresh( w_gender );
}

static void draw_outfit( ui_adaptor &ui, const catacurses::window &w_outfit, const bool highlight )
{
const point male_pos( 1 + utf8_width( _( "Outfit:" ) ), 0 );
const point female_pos = male_pos + point( 2 + utf8_width( _( "Male" ) ), 0 );

werase( w_outfit );
mvwprintz( w_outfit, point_zero, highlight ? COL_SELECT : c_light_gray, _( "Outfit:" ) );
if( highlight && outfit ) {
ui.set_cursor( w_outfit, male_pos );
}
mvwprintz( w_outfit, male_pos, ( outfit ? c_light_cyan : c_light_gray ),
_( "Male" ) );
if( highlight && !outfit ) {
ui.set_cursor( w_outfit, female_pos );
}
mvwprintz( w_outfit, female_pos, ( outfit ? c_light_gray : c_pink ),
_( "Female" ) );
wnoutrefresh( w_outfit );
}

static void draw_height( ui_adaptor &ui, const catacurses::window &w_height,
const avatar &you, const bool highlight )
{
Expand Down Expand Up @@ -3629,6 +3661,7 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
catacurses::window w;
catacurses::window w_name;
catacurses::window w_gender;
catacurses::window w_outfit;
catacurses::window w_location;
catacurses::window w_vehicle;
catacurses::window w_stats;
Expand Down Expand Up @@ -3659,7 +3692,8 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
if( isWide ) {
w = catacurses::newwin( TERMY, TERMX, point_zero );
w_name = catacurses::newwin( 2, ncol2 + 2, point( 2, 6 ) );
w_gender = catacurses::newwin( 1, ncol2 + 2, point( 2, 8 ) );
w_gender = catacurses::newwin( 1, ncol2 + 2, point( 2, 7 ) );
w_outfit = catacurses::newwin( 1, ncol2 + 1, point( 2, 8 ) );
w_location = catacurses::newwin( 1, ncol3, point( beginx3, 6 ) );
w_vehicle = catacurses::newwin( 1, ncol3, point( beginx3, 7 ) );
w_addictions = catacurses::newwin( 1, ncol3, point( beginx3, 8 ) );
Expand All @@ -3679,8 +3713,9 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
ui.position_from_window( w );
} else {
w = catacurses::newwin( TERMY, TERMX, point_zero );
w_name = catacurses::newwin( 1, ncol_small, point( 2, 6 ) );
w_gender = catacurses::newwin( 1, ncol_small, point( 2, 7 ) );
w_name = catacurses::newwin( 1, ncol_small, point( 2, 5 ) );
w_gender = catacurses::newwin( 1, ncol_small, point( 2, 6 ) );
w_outfit = catacurses::newwin( 1, ncol_small, point( 2, 7 ) );
w_height = catacurses::newwin( 1, ncol_small, point( 2, 8 ) );
w_age = catacurses::newwin( 1, ncol_small, point( begin_sncol, 6 ) );
w_blood = catacurses::newwin( 1, ncol_small, point( begin_sncol, 7 ) );
Expand Down Expand Up @@ -3714,6 +3749,7 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
ctxt.register_action( "REROLL_CHARACTER_WITH_SCENARIO" );
}
ctxt.register_action( "CHANGE_GENDER" );
ctxt.register_action( "CHANGE_OUTFIT" );
ctxt.register_action( "HELP_KEYBINDINGS" );
ctxt.register_action( "CHANGE_START_OF_CATACLYSM" );
ctxt.register_action( "CHANGE_START_OF_GAME" );
Expand Down Expand Up @@ -3956,6 +3992,7 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
char_creation::draw_name( ui, w_name, you, current_selector == char_creation::NAME,
no_name_entered );
char_creation::draw_gender( ui, w_gender, you, current_selector == char_creation::GENDER );
char_creation::draw_outfit( ui, w_outfit, current_selector == char_creation::OUTFIT );
char_creation::draw_age( ui, w_age, you, current_selector == char_creation::AGE );
char_creation::draw_height( ui, w_height, you, current_selector == char_creation::HEIGHT );
char_creation::draw_blood( ui, w_blood, you, current_selector == char_creation::BLOOD );
Expand Down Expand Up @@ -4117,6 +4154,9 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
current_selector = char_creation::GENDER;
break;
case char_creation::GENDER:
current_selector = char_creation::OUTFIT;
break;
case char_creation::OUTFIT:
current_selector = char_creation::HEIGHT;
break;
case char_creation::HEIGHT:
Expand Down Expand Up @@ -4147,6 +4187,9 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
current_selector = char_creation::HEIGHT;
break;
case char_creation::HEIGHT:
current_selector = char_creation::OUTFIT;
break;
case char_creation::OUTFIT:
current_selector = char_creation::GENDER;
break;
case char_creation::GENDER:
Expand Down Expand Up @@ -4182,6 +4225,9 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
case char_creation::GENDER:
you.male = !you.male;
break;
case char_creation::OUTFIT:
outfit = !outfit;
break;
default:
break;
}
Expand Down Expand Up @@ -4214,6 +4260,9 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
case char_creation::GENDER:
you.male = !you.male;
break;
case char_creation::OUTFIT:
outfit = !outfit;
break;
default:
break;
}
Expand Down Expand Up @@ -4244,6 +4293,8 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
you.randomize_height();
you.randomize_blood();
you.randomize_heartrate();
} else if( action == "CHANGE_OUTFIT" ) {
outfit = !outfit;
} else if( action == "CHANGE_GENDER" ) {
you.male = !you.male;
} else if( action == "CHANGE_START_OF_CATACLYSM" ) {
Expand Down Expand Up @@ -4354,6 +4405,18 @@ void set_description( tab_manager &tabs, avatar &you, const bool allow_reroll,
you.male = static_cast<bool>( gselect.ret );
break;
}
case char_creation::OUTFIT: {
uilist gselect;
gselect.text = _( "Select outfit" );
gselect.addentry( 0, true, '1', _( "Female" ) );
gselect.addentry( 1, true, '2', _( "Male" ) );
gselect.query();
if( gselect.ret < 0 ) {
break;
}
outfit = static_cast<bool>( gselect.ret );
break;
}
case char_creation::LOCATION: {
select_location.query();
if( select_location.ret == RANDOM_START_LOC_ENTRY ) {
Expand Down

0 comments on commit c6f6397

Please sign in to comment.