Skip to content

Commit

Permalink
Add option to change position of look around windows (#36804)
Browse files Browse the repository at this point in the history
* Add option to change position of look around windows
Adds UI function in options to change look around window between left and right
  • Loading branch information
Kilvoctu authored Apr 11, 2020
1 parent 486efb1 commit e473908
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6639,6 +6639,14 @@ look_around_result game::look_around( catacurses::window w_info, tripoint &cente

int la_y = 0;
int la_x = TERMX - panel_width;
std::string position = get_option<std::string>( "LOOKAROUND_POSITION" );
if( position == "left" ) {
if( get_option<std::string>( "SIDEBAR_POSITION" ) == "right" ) {
la_x = panel_manager::get_manager().get_width_left();
} else {
la_x = panel_manager::get_manager().get_width_left() - panel_width;
}
}
int la_h = height;
int la_w = panel_width;
w_info = catacurses::newwin( la_h, la_w, point( la_x, la_y ) );
Expand Down Expand Up @@ -6774,7 +6782,16 @@ look_around_result game::look_around( catacurses::window w_info, tripoint &cente

int panel_width = panel_manager::get_manager().get_current_layout().begin()->get_width();
int height = pixel_minimap_option ? TERMY - getmaxy( w_pixel_minimap ) : TERMY;
w_info = catacurses::newwin( height, panel_width, point( TERMX - panel_width, 0 ) );
int la_x = TERMX - panel_width;
std::string position = get_option<std::string>( "LOOKAROUND_POSITION" );
if( position == "left" ) {
if( get_option<std::string>( "SIDEBAR_POSITION" ) == "right" ) {
la_x = panel_manager::get_manager().get_width_left();
} else {
la_x = panel_manager::get_manager().get_width_left() - panel_width;
}
}
w_info = catacurses::newwin( height, panel_width, point( la_x, 0 ) );
} else if( action == "LEVEL_UP" || action == "LEVEL_DOWN" ) {
if( !allow_zlev_move ) {
continue;
Expand Down
6 changes: 6 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,12 @@ void options_manager::add_options_interface()
false
);

add( "LOOKAROUND_POSITION", "interface", translate_marker( "Look around position" ),
translate_marker( "Switch between look around panel being left or right." ),
{ { "left", translate_marker( "Left" ) }, { "right", translate_marker( "Right" ) } },
"right"
);

add( "PICKUP_POSITION", "interface", translate_marker( "Pickup position" ),
translate_marker( "Switch between pickup panel being left, right, or overlapping the sidebar." ),
{ { "left", translate_marker( "Left" ) }, { "right", translate_marker( "Right" ) }, { "overlapping", translate_marker( "Overlapping" ) } },
Expand Down

0 comments on commit e473908

Please sign in to comment.