#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() */
{
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);
}
{
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
{
extern uint8_t meta_control(int key, struct World * world)
{
struct WinMeta * win_meta = world->wmeta;
- struct Win * win_keys = get_win_by_id(world, '0'); /* Bad hardcoding. */
- struct Win * win_map = get_win_by_id(world, 'm'); /* TODO: Replace. */
- struct Win * win_info = get_win_by_id(world, 'i'); /* */
- struct Win * win_log = get_win_by_id(world, 'l'); /* */
+ struct Win * win_map = get_win_by_id(world, 'm');
char * err_toggle = "Trouble with toggle_window() in meta_control().";
if (key == get_available_keycode_to_action(world, "quit"))
{
}
else if (key == get_available_keycode_to_action(world, "to_g_keywin"))
{
- exit_err(toggle_window(win_meta, win_keys), world, err_toggle);
+ uint8_t test = toggle_window(win_meta, get_win_by_id(world, '0'));
+ exit_err(test, world, err_toggle);
}
else if (key == get_available_keycode_to_action(world, "to_wg_keywin"))
{
}
else if (key == get_available_keycode_to_action(world, "to_infowin"))
{
- exit_err(toggle_window(win_meta, win_info), world, err_toggle);
+ uint8_t test = toggle_window(win_meta, get_win_by_id(world, 'i'));
+ exit_err(test, world, err_toggle);
}
else if (key == get_available_keycode_to_action(world, "to_inv"))
{
}
else if (key == get_available_keycode_to_action(world, "to_logwin"))
{
- exit_err(toggle_window(win_meta, win_log), world, err_toggle);
+ uint8_t test = toggle_window(win_meta, get_win_by_id(world, 'l'));
+ exit_err(test, world, err_toggle);
}
else if (key == get_available_keycode_to_action(world, "save_conf"))
{
}
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"))
{