X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fcontrol.c;h=504b0f52bdbd7cdfa8b5a55f3c263ccdc56dc94c;hb=d1dfbfa5a6f5f05d761238010b4f853088e3a373;hp=975010e49fbb1cd6133455c91bcbce01456c63d4;hpb=cff4ca6783209fdf4272ae83b23b18e7ddf2a4df;p=plomrogue diff --git a/src/control.c b/src/control.c index 975010e..504b0f5 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() */ #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 { @@ -286,23 +306,32 @@ extern uint8_t meta_control(int key, struct World * world) } else if (key == get_available_keycode_to_action(world, "map_u")) { - map_scroll(world->map, NORTH, win_map->frame.size); - } + map_scroll(win_map, world->map->size, NORTH); + } else if (key == get_available_keycode_to_action(world, "map_d")) { - map_scroll(world->map, SOUTH, win_map->frame.size); + map_scroll(win_map, world->map->size, SOUTH); } else if (key == get_available_keycode_to_action(world, "map_r")) { - map_scroll(world->map, EAST, win_map->frame.size); + map_scroll(win_map, world->map->size, EAST); } else if (key == get_available_keycode_to_action(world, "map_l")) { - map_scroll(world->map, WEST, win_map->frame.size); + map_scroll(win_map, world->map->size, WEST); } else if (key == get_available_keycode_to_action(world, "map_c")) { - map_center_player(world->map, world->player, win_map->frame.size); + struct MapObj * player = get_player(world); + win_map->center = player->pos; + } + 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")) {