Skip to content

Commit

Permalink
Remove achievements/scores/killcount top-level keybinding and move it…
Browse files Browse the repository at this point in the history
… into the diary menu (bound by default to ')') (#64470)
  • Loading branch information
strategineer authored Mar 24, 2023
1 parent 28cfded commit 5b8087d
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
17 changes: 9 additions & 8 deletions data/raw/keybindings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2609,13 +2609,6 @@
"id": "factions",
"bindings": [ { "input_method": "keyboard_char", "key": "#" }, { "input_method": "keyboard_code", "key": "3", "mod": [ "shift" ] } ]
},
{
"type": "keybinding",
"name": "View achievements, scores, and kills",
"category": "DEFAULTMODE",
"id": "scores",
"bindings": [ { "input_method": "keyboard_char", "key": ")" }, { "input_method": "keyboard_code", "key": "0", "mod": [ "shift" ] } ]
},
{
"type": "keybinding",
"name": "View morale",
Expand Down Expand Up @@ -2986,7 +2979,8 @@
"type": "keybinding",
"id": "diary",
"name": "Open diary",
"category": "DEFAULTMODE"
"category": "DEFAULTMODE",
"bindings": [ { "input_method": "keyboard_char", "key": ")" }, { "input_method": "keyboard_code", "key": "0", "mod": [ "shift" ] } ]
},
{
"type": "keybinding",
Expand Down Expand Up @@ -4285,6 +4279,13 @@
"category": "DIARY",
"bindings": [ { "input_method": "keyboard_any", "mod": [ ], "key": [ "n" ] } ]
},
{
"type": "keybinding",
"name": "View achievements, scores, and kills",
"category": "DIARY",
"id": "VIEW_SCORES",
"bindings": [ { "input_method": "keyboard_any", "mod": [ ], "key": [ "v" ] } ]
},
{
"type": "keybinding",
"id": "TEXT.QUIT",
Expand Down
4 changes: 0 additions & 4 deletions src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ std::string action_ident( action_id act )
return "missions";
case ACTION_FACTIONS:
return "factions";
case ACTION_SCORES:
return "scores";
case ACTION_MEDICAL:
return "medical";
case ACTION_BODYSTATUS:
Expand Down Expand Up @@ -442,7 +440,6 @@ bool can_action_change_worldstate( const action_id act )
case ACTION_MAP:
case ACTION_SKY:
case ACTION_MISSIONS:
case ACTION_SCORES:
case ACTION_FACTIONS:
case ACTION_MORALE:
case ACTION_MEDICAL:
Expand Down Expand Up @@ -973,7 +970,6 @@ action_id handle_action_menu()
} else if( category == _( "Info" ) ) {
REGISTER_ACTION( ACTION_PL_INFO );
REGISTER_ACTION( ACTION_MISSIONS );
REGISTER_ACTION( ACTION_SCORES );
REGISTER_ACTION( ACTION_FACTIONS );
REGISTER_ACTION( ACTION_MORALE );
REGISTER_ACTION( ACTION_MEDICAL );
Expand Down
2 changes: 0 additions & 2 deletions src/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ enum action_id : int {
ACTION_SKY,
/** Display missions screen */
ACTION_MISSIONS,
/** Display scores screen */
ACTION_SCORES,
/** Display factions screen */
ACTION_FACTIONS,
/** Display morale effects screen */
Expand Down
8 changes: 7 additions & 1 deletion src/diary_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "options.h"
#include "output.h"
#include "popup.h"
#include "scores_ui.h"
#include "string_editor_window.h"
#include "string_formatter.h"
#include "string_input_popup.h"
Expand Down Expand Up @@ -177,6 +178,7 @@ void diary::show_diary_ui( diary *c_diary )
ctxt.register_action( "NEW_PAGE" );
ctxt.register_action( "DELETE PAGE" );
ctxt.register_action( "EXPORT_DIARY" );
ctxt.register_action( "VIEW_SCORES" );
ctxt.register_action( "HELP_KEYBINDINGS" );

ui_adaptor ui_diary;
Expand Down Expand Up @@ -245,7 +247,7 @@ void diary::show_diary_ui( diary *c_diary )
const point &beg = beg_and_max.first;
const point &max = beg_and_max.second;

w_desc = catacurses::newwin( 3, max.x * 3 / 10 + max.x + 10, point( beg.x - 5 - max.x * 3 / 10,
w_desc = catacurses::newwin( 4, max.x * 3 / 10 + max.x + 10, point( beg.x - 5 - max.x * 3 / 10,
beg.y - 6 ) );

ui.position_from_window( w_desc );
Expand All @@ -263,6 +265,8 @@ void diary::show_diary_ui( diary *c_diary )
ctxt.get_desc( "EXPORT_DIARY", _( "Export diary" ), input_context::allow_all_keys )
);
center_print( w_desc, 1, c_white, desc );
center_print( w_desc, 2, c_white, ctxt.get_desc( "VIEW_SCORES",
_( "View achievements, scores, and kills" ), input_context::allow_all_keys ) );

wnoutrefresh( w_desc );
} );
Expand Down Expand Up @@ -339,6 +343,8 @@ void diary::show_diary_ui( diary *c_diary )
c_diary->new_page();
selected[window_mode::PAGE_WIN] = c_diary->pages.size() - 1;

} else if( action == "VIEW_SCORES" ) {
show_scores_ui( g->achievements(), g->stats(), g->get_kill_tracker() );
} else if( action == "DELETE PAGE" ) {
if( !c_diary->pages.empty() ) {
if( query_yn( _( "Really delete Page?" ) ) ) {
Expand Down
1 change: 0 additions & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,6 @@ input_context get_default_mode_input_context()
ctxt.register_action( "sky" );
ctxt.register_action( "missions" );
ctxt.register_action( "factions" );
ctxt.register_action( "scores" );
ctxt.register_action( "morale" );
ctxt.register_action( "messages" );
ctxt.register_action( "help" );
Expand Down
4 changes: 2 additions & 2 deletions src/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ class game
void reload_npcs();
void remove_npc( character_id const &id );
const kill_tracker &get_kill_tracker() const;
stats_tracker &stats();
achievements_tracker &achievements();
/** Add follower id to set of followers. */
void add_npc_follower( const character_id &id );
/** Remove follower id from follower set. */
Expand Down Expand Up @@ -1042,9 +1044,7 @@ class game
const scenario *scen = nullptr; // NOLINT(cata-serialize)

event_bus &events();
stats_tracker &stats();
timed_event_manager &timed_events; // NOLINT(cata-serialize)
achievements_tracker &achievements();
memorial_logger &memorial();

global_variables global_variables_instance;
Expand Down
4 changes: 0 additions & 4 deletions src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2571,10 +2571,6 @@ bool game::do_regular_action( action_id &act, avatar &player_character,
diary::show_diary_ui( u.get_avatar_diary() );
break;

case ACTION_SCORES:
show_scores_ui( *achievements_tracker_ptr, stats(), get_kill_tracker() );
break;

case ACTION_FACTIONS:
faction_manager_ptr->display();
break;
Expand Down

0 comments on commit 5b8087d

Please sign in to comment.