Skip to content

Commit

Permalink
Merge pull request #257 from olanti-p/ui-changes-5
Browse files Browse the repository at this point in the history
Misc UI changes/fixes from DDA 5
  • Loading branch information
Coolthulhu authored Dec 11, 2020
2 parents cb2d3a4 + 4ebc2dc commit d0bfcd1
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 20 deletions.
6 changes: 4 additions & 2 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -807,12 +807,13 @@
"type": "effect_type",
"id": "bandaged",
"name": [ "Bandaged" ],
"desc": [ "Your wounds are bandaged." ],
"desc": [ "The wounds on your %s are bandaged." ],
"main_parts_only": true,
"rating": "good",
"int_dur_factor": "6 h",
"max_intensity": 16,
"max_effective_intensity": 8,
"part_descs": true,
"max_duration": "4 d",
"base_mods": { "healing_rate": [ 2 ], "healing_head": [ 50 ], "healing_torso": [ 150 ] },
"scaling_mods": { "healing_rate": [ 2 ] }
Expand All @@ -821,12 +822,13 @@
"type": "effect_type",
"id": "disinfected",
"name": [ "Disinfected" ],
"desc": [ "Your wounds are disinfected." ],
"desc": [ "The wounds on your %s are disinfected." ],
"main_parts_only": true,
"rating": "good",
"int_dur_factor": "6 h",
"max_intensity": 16,
"max_effective_intensity": 8,
"part_descs": true,
"max_duration": "4 d",
"base_mods": { "healing_rate": [ 2 ], "healing_head": [ 50 ], "healing_torso": [ 150 ] },
"scaling_mods": { "healing_rate": [ 2 ] }
Expand Down
2 changes: 1 addition & 1 deletion data/raw/keybindings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@
},
{
"type": "keybinding",
"name": "Toggle Panel Admin",
"name": "Sidebar Options",
"category": "DEFAULTMODE",
"id": "toggle_panel_adm",
"bindings": [ { "input_method": "keyboard", "key": "}" } ]
Expand Down
11 changes: 6 additions & 5 deletions src/crafting_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ const recipe *select_crafting_recipe( int &batch_size )

if( batch ) {
current.clear();
for( int i = 1; i <= 20; i++ ) {
for( int i = 1; i <= 50; i++ ) {
current.push_back( chosen );
available.push_back( availability( chosen, i ) );
}
Expand Down Expand Up @@ -822,9 +822,9 @@ const recipe *select_crafting_recipe( int &batch_size )

std::string description =
_( "The default is to search result names. Some single-character prefixes "
"can be used with a colon (:) to search in other ways. Additional filters "
"are separated by commas (,).\n"
"\n"
"can be used with a colon <color_red>:</color> to search in other ways. Additional filters "
"are separated by commas <color_red>,</color>.\n"
"\n\n"
"<color_white>Examples:</color>\n" );

{
Expand All @@ -844,7 +844,8 @@ const recipe *select_crafting_recipe( int &batch_size )
}

description +=
_( "\nYou can use <color_white>arrow keys</color> to go through search history\n\n" );
_( "\nUse <color_red>up/down arrow</color> to go through your search history." );
description += "\n\n\n";

string_input_popup()
.title( _( "Search:" ) )
Expand Down
22 changes: 22 additions & 0 deletions src/debug_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ enum debug_menu_index {
DEBUG_CHANGE_WEATHER,
DEBUG_WIND_DIRECTION,
DEBUG_WIND_SPEED,
DEBUG_GEN_SOUND,
DEBUG_KILL_MONS,
DEBUG_DISPLAY_HORDES,
DEBUG_TEST_IT_GROUP,
Expand Down Expand Up @@ -298,6 +299,7 @@ static int map_uilist()
{ uilist_entry( DEBUG_CHANGE_WEATHER, true, 'w', _( "Change weather" ) ) },
{ uilist_entry( DEBUG_WIND_DIRECTION, true, 'd', _( "Change wind direction" ) ) },
{ uilist_entry( DEBUG_WIND_SPEED, true, 's', _( "Change wind speed" ) ) },
{ uilist_entry( DEBUG_GEN_SOUND, true, 'S', _( "Generate sound" ) ) },
{ uilist_entry( DEBUG_KILL_MONS, true, 'K', _( "Kill all monsters" ) ) },
{ uilist_entry( DEBUG_CHANGE_TIME, true, 't', _( "Change time" ) ) },
{ uilist_entry( DEBUG_OM_EDITOR, true, 'O', _( "Overmap editor" ) ) },
Expand Down Expand Up @@ -1487,6 +1489,26 @@ void debug()
}
break;

case DEBUG_GEN_SOUND: {
const cata::optional<tripoint> where = g->look_around();
if( !where ) {
return;
}

int volume;
if( !query_int( volume, _( "Volume of sound: " ) ) ) {
return;
}

if( volume < 0 ) {
return;
}

sounds::sound( *where, volume, sounds::sound_t::order, string_format( _( "DEBUG SOUND ( %d )" ),
volume ) );
}
break;

case DEBUG_KILL_MONS: {
for( monster &critter : g->all_monsters() ) {
// Use the normal death functions, useful for testing death
Expand Down
2 changes: 1 addition & 1 deletion src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ static void wait()
actType = ACT_WAIT;
}

player_activity new_act( actType, 100 * ( to_turns<int>( time_to_wait ) - 1 ), 0 );
player_activity new_act( actType, 100 * ( to_turns<int>( time_to_wait ) ), 0 );

u.assign_activity( new_act, false );
}
Expand Down
10 changes: 5 additions & 5 deletions src/inventory_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,9 @@ void inventory_column::on_input( const inventory_input &input )
move_selection( scroll_direction::FORWARD );
} else if( input.action == "UP" ) {
move_selection( scroll_direction::BACKWARD );
} else if( input.action == "NEXT_TAB" ) {
} else if( input.action == "PAGE_DOWN" ) {
move_selection_page( scroll_direction::FORWARD );
} else if( input.action == "PREV_TAB" ) {
} else if( input.action == "PAGE_UP" ) {
move_selection_page( scroll_direction::BACKWARD );
} else if( input.action == "HOME" ) {
select( 0, scroll_direction::FORWARD );
Expand Down Expand Up @@ -1690,14 +1690,14 @@ inventory_selector::inventory_selector( player &u, const inventory_selector_pres
{
ctxt.register_action( "DOWN", to_translation( "Next item" ) );
ctxt.register_action( "UP", to_translation( "Previous item" ) );
ctxt.register_action( "PAGE_DOWN", to_translation( "Page down" ) );
ctxt.register_action( "PAGE_UP", to_translation( "Page up" ) );
ctxt.register_action( "RIGHT", to_translation( "Next column" ) );
ctxt.register_action( "LEFT", to_translation( "Previous column" ) );
ctxt.register_action( "CONFIRM", to_translation( "Confirm your selection" ) );
ctxt.register_action( "QUIT", to_translation( "Cancel" ) );
ctxt.register_action( "CATEGORY_SELECTION", to_translation( "Switch selection mode" ) );
ctxt.register_action( "CATEGORY_SELECTION", to_translation( "Switch category selection mode" ) );
ctxt.register_action( "TOGGLE_FAVORITE", to_translation( "Toggle favorite" ) );
ctxt.register_action( "NEXT_TAB", to_translation( "Page down" ) );
ctxt.register_action( "PREV_TAB", to_translation( "Page up" ) );
ctxt.register_action( "HOME", to_translation( "Home" ) );
ctxt.register_action( "END", to_translation( "End" ) );
ctxt.register_action( "HELP_KEYBINDINGS" );
Expand Down
10 changes: 6 additions & 4 deletions src/mapbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,18 @@ void mapbuffer::save( bool delete_after_save )
// A set of already-saved submaps, in global overmap coordinates.
std::set<tripoint> saved_submaps;
std::list<tripoint> submaps_to_delete;
int next_report = 0;
static constexpr std::chrono::milliseconds update_interval( 500 );
auto last_update = std::chrono::steady_clock::now();

for( auto &elem : submaps ) {
if( num_total_submaps > 100 && num_saved_submaps >= next_report ) {
auto now = std::chrono::steady_clock::now();
if( last_update + update_interval < now ) {
popup.message( _( "Please wait as the map saves [%d/%d]" ),
num_saved_submaps, num_total_submaps );
ui_manager::redraw();
refresh_display();
next_report += std::max( 100, num_total_submaps / 20 );
last_update = now;
}

// Whatever the coordinates of the current submap are,
// we're saving a 2x2 quad of submaps at a time.
// Submaps are generated in quads, so we know if we have one member of a quad,
Expand Down
4 changes: 2 additions & 2 deletions src/sdl_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ CachedTTFFont::CachedTTFFont(
{
int faceIndex = 0;
std::vector<std::string> typefaces;
std::vector<std::string> known_suffixes = { ".ttf", ".fon" };
std::vector<std::string> known_suffixes = { ".ttf", ".otf", ".ttc", ".fon" };
bool add_suffix = true;
for( const std::string &ks : known_suffixes ) {
if( string_ends_with( typeface, ks ) ) {
Expand Down Expand Up @@ -249,7 +249,7 @@ CachedTTFFont::CachedTTFFont(
typefaces.emplace_back( typeface + ( add_suffix ? ks : "" ) );
}
}
if( typefaces.empty() ) {
if( add_suffix ) {
typefaces.emplace_back( typeface );
}
ensure_unifont_loaded( typefaces );
Expand Down

0 comments on commit d0bfcd1

Please sign in to comment.