X-Git-Url: https://plomlompom.com/repos/index.html?a=blobdiff_plain;f=src%2Fcontrol.c;h=35a8c31b66f55f39bbc64f5ed64bd1bbfe93e020;hb=4ca4f2fc97bd592bcbbef5ed2b21b320c7336425;hp=e10a93cbbc78ab149ec0daad7c94f1691c4e967e;hpb=fcf58a650b9c0a9c3aa08c2c25ea14d70e08f8c7;p=plomrogue
diff --git a/src/control.c b/src/control.c
index e10a93c..35a8c31 100644
--- a/src/control.c
+++ b/src/control.c
@@ -14,10 +14,68 @@
#include "misc.h" /* for scroll_pad(), toggle_window(),
* growshrink_active_window()
*/
+#include "map_object_actions.h" /* for player_wait(), move_player() */
-extern uint8_t meta_keys(int key, struct World * world)
+extern void record_control(int action, struct World * world)
+{
+ if (0 == action)
+ {
+ player_wait(world);
+ }
+ else if (NORTH == action)
+ {
+ move_player(world, NORTH);
+ }
+ else if (EAST == action)
+ {
+ move_player(world, EAST);
+ }
+ else if (SOUTH == action)
+ {
+ move_player(world, SOUTH);
+ }
+ else if (WEST == action)
+ {
+ move_player(world, WEST);
+ }
+}
+
+
+
+extern uint8_t player_control(int key, struct World * world)
+{
+ if (key == get_action_key(world->keybindings, "player up"))
+ {
+ move_player(world, NORTH);
+ }
+ else if (key == get_action_key(world->keybindings, "player right"))
+ {
+ move_player(world, EAST);
+ }
+ else if (key == get_action_key(world->keybindings, "player down"))
+ {
+ move_player(world, SOUTH);
+ }
+ else if (key == get_action_key(world->keybindings, "player left"))
+ {
+ move_player(world, WEST);
+ }
+ else if (key == get_action_key(world->keybindings, "wait / next turn"))
+ {
+ player_wait(world);
+ }
+ else
+ {
+ return 1;
+ }
+ return 0;
+}
+
+
+
+extern uint8_t meta_control(int key, struct World * world)
{
struct WinMeta * win_meta = world->wins.meta;
struct Win * win_keys = world->wins.keys;