Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical Menu Implementation #54763

Merged
merged 13 commits into from
Apr 18, 2022
Merged
14 changes: 14 additions & 0 deletions data/raw/keybindings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,13 @@
"name": "Toggle activate/examine",
"bindings": [ { "input_method": "keyboard_char", "key": "!" }, { "input_method": "keyboard_code", "key": "1", "mod": [ "shift" ] } ]
},
{
"type": "keybinding",
"id": "APPLY",
"category": "MEDICAL",
"name": "Apply or Use Item",
Maleclypse marked this conversation as resolved.
Show resolved Hide resolved
"bindings": [ { "input_method": "keyboard_char", "key": "A" }, { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } ]
},
{
"type": "keybinding",
"name": "Pause",
Expand Down Expand Up @@ -2218,6 +2225,13 @@
"id": "mutations",
"bindings": [ { "input_method": "keyboard_any", "key": "[" } ]
},
{
"type": "keybinding",
"name": "View Medical",
"category": "DEFAULTMODE",
"id": "medical",
"bindings": [ { "input_method": "keyboard_char", "key": "N" }, { "input_method": "keyboard_code", "key": "n", "mod": [ "shift" ] } ]
},
{
"type": "keybinding",
"name": "Re-layer armor/clothing",
Expand Down
4 changes: 4 additions & 0 deletions src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ std::string action_ident( action_id act )
return "factions";
case ACTION_SCORES:
return "scores";
case ACTION_MEDICAL:
return "medical";
case ACTION_MORALE:
return "morale";
case ACTION_MESSAGES:
Expand Down Expand Up @@ -431,6 +433,7 @@ bool can_action_change_worldstate( const action_id act )
case ACTION_SCORES:
case ACTION_FACTIONS:
case ACTION_MORALE:
case ACTION_MEDICAL:
case ACTION_MESSAGES:
case ACTION_HELP:
case ACTION_MAIN_MENU:
Expand Down Expand Up @@ -947,6 +950,7 @@ action_id handle_action_menu()
REGISTER_ACTION( ACTION_SCORES );
REGISTER_ACTION( ACTION_FACTIONS );
REGISTER_ACTION( ACTION_MORALE );
REGISTER_ACTION( ACTION_MEDICAL );
REGISTER_ACTION( ACTION_MESSAGES );
} else if( category == _( "Misc" ) ) {
REGISTER_ACTION( ACTION_WAIT );
Expand Down
2 changes: 2 additions & 0 deletions src/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ enum action_id : int {
ACTION_FACTIONS,
/** Display morale effects screen */
ACTION_MORALE,
/** Displays medical menu */
ACTION_MEDICAL,
/** Display messages screen */
ACTION_MESSAGES,
/** Display help screen */
Expand Down
2 changes: 2 additions & 0 deletions src/avatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class avatar : public Character

/** Provides the window and detailed morale data */
void disp_morale();
/** Opens the medical window */
void disp_medical();
/** Resets stats, and applies effects in an idempotent manner */
void reset_stats() override;
/** Resets all missions before saving character to template */
Expand Down
2 changes: 1 addition & 1 deletion src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ std::pair<std::string, nc_color> display::vehicle_fuel_percent_text_color( const
}

// Return status/color pairs for all statuses affecting body part (bleeding, bitten, bandaged, etc.)
static std::map<bodypart_status, nc_color> bodypart_status_colors( const Character &u,
std::map<bodypart_status, nc_color> display::bodypart_status_colors( const Character &u,
const bodypart_id &bp, const std::string &wgt_id )
{
// List of active statuses and associated colors
Expand Down
1 change: 1 addition & 0 deletions src/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ std::pair<std::string, nc_color> fatigue_text_color( const Character &u );
std::pair<std::string, nc_color> health_text_color( const Character &u );
std::pair<std::string, nc_color> pain_text_color( const Creature &c );
std::pair<std::string, nc_color> pain_text_color( const Character &u );
std::map<bodypart_status, nc_color> bodypart_status_colors(const Character& u, const bodypart_id& bp, const std::string& wgt_id);
// Change in character body temperature, as colorized arrows
std::pair<std::string, nc_color> temp_delta_arrows( const Character &u );
// Character morale, as a color-coded ascii emoticon face
Expand Down
1 change: 1 addition & 0 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2311,6 +2311,7 @@ input_context get_default_mode_input_context()
ctxt.register_action( "drop_adj" );
ctxt.register_action( "bionics" );
ctxt.register_action( "mutations" );
ctxt.register_action( "medical" );
ctxt.register_action( "sort_armor" );
ctxt.register_action( "wait" );
ctxt.register_action( "craft" );
Expand Down
4 changes: 4 additions & 0 deletions src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2484,6 +2484,10 @@ bool game::do_regular_action( action_id &act, avatar &player_character,
player_character.disp_morale();
break;

case ACTION_MEDICAL:
player_character.disp_medical();
break;

case ACTION_MESSAGES:
Messages::display_messages();
break;
Expand Down
Loading