X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fcontrol.c;h=c59053923a7d9cf1c60d6e558d8a439cb0f5e468;hb=657d5dbc6d362d7b20693c63b38d8d99f3d2dbbd;hp=975010e49fbb1cd6133455c91bcbce01456c63d4;hpb=cff4ca6783209fdf4272ae83b23b18e7ddf2a4df;p=plomrogue diff --git a/src/control.c b/src/control.c index 975010e..c590539 100644 --- a/src/control.c +++ b/src/control.c @@ -8,18 +8,22 @@ #include "keybindings.h" /* for get_keycode_to_action(), mod_selected_keyb(), * move_keyb_mod_selection() */ -#include "map.h" /* for map_scroll(), map_center_player(), dir enum */ +#include "map.h" /* for map_scroll(), map_center_object() */ #include "main.h" /* for World struct */ #include "rexit.h" /* for exit_err() */ #include "wincontrol.h" /* for scroll_pad(), toggle_window(), * growshrink_active_window(), toggle_winconfig(), * toggle_win_height_type(), toggle_win_width_type() */ -#include "map_object_actions.h" /* for player_wait(), move_player() */ +#include "map_object_actions.h" /* for player_wait(), move_player(), + * player_drop(), player_pick() + */ #include "command_db.h" /* for is_command_id_shortdsc() */ #include "misc.h" /* for load_interface_conf(), unload_interface_conf(), - * save_interface_conf() + * save_interface_conf(), nav_inventory() */ +#include "yx_uint16.h" /* for dir enum */ +#include "map_objects.h" /* for get_player() */ @@ -71,13 +75,25 @@ extern void record_control(int action, struct World * world) { move_player(world, WEST); } + else if (is_command_id_shortdsc(world, action, "drop")) + { + player_drop(world); + } + else if (is_command_id_shortdsc(world, action, "pick")) + { + player_pick(world); + } } extern uint8_t player_control(int key, struct World * world) { - if (key == get_available_keycode_to_action(world, "player_u")) + if (key == get_available_keycode_to_action(world, "wait")) + { + player_wait(world); + } + else if (key == get_available_keycode_to_action(world, "player_u")) { move_player(world, NORTH); } @@ -93,9 +109,13 @@ extern uint8_t player_control(int key, struct World * world) { move_player(world, WEST); } - else if (key == get_available_keycode_to_action(world, "wait")) + else if (key == get_available_keycode_to_action(world, "drop")) { - player_wait(world); + player_drop(world); + } + else if (key == get_available_keycode_to_action(world, "pick")) + { + player_pick(world); } else { @@ -302,7 +322,15 @@ extern uint8_t meta_control(int key, struct World * world) } else if (key == get_available_keycode_to_action(world, "map_c")) { - map_center_player(world->map, world->player, win_map->frame.size); + map_center_object(world->map, get_player(world), win_map->frame.size); + } + else if (key == get_available_keycode_to_action(world, "inv_u")) + { + nav_inventory(world, 'u'); + } + else if (key == get_available_keycode_to_action(world, "inv_d")) + { + nav_inventory(world, 'd'); } else if (key == get_available_keycode_to_action(world, "reload_conf")) {