+ uint16_t keycode = get_keycode_to_action(world->kb_global.kbs, name);
+ if (0 != keycode || 0 == world->wmeta->active)
+ {
+ return keycode;
+ }
+ struct WinConf * wc = get_winconf_by_win(world, world->wmeta->active);
+ if (0 == wc->view)
+ {
+ keycode = get_keycode_to_action(wc->kb.kbs, name);
+ }
+ else if (1 == wc->view)
+ {
+ keycode = get_keycode_to_action(world->kb_wingeom.kbs, name);
+ }
+ else if (2 == wc->view)
+ {
+ keycode = get_keycode_to_action(world->kb_winkeys.kbs, name);
+ }
+ return keycode;
+}
+
+
+
+extern void record_control(int action, struct World * world)
+{
+ if (is_command_id_shortdsc(world, action, "wait"))
+ {
+ player_wait(world);
+ }
+ else if (is_command_id_shortdsc(world, action, "player_u"))
+ {
+ move_player(world, NORTH);
+ }
+ else if (is_command_id_shortdsc(world, action, "player_r"))
+ {
+ move_player(world, EAST);
+ }
+ else if (is_command_id_shortdsc(world, action, "player_d"))
+ {
+ move_player(world, SOUTH);
+ }
+ else if (is_command_id_shortdsc(world, action, "player_l"))
+ {
+ 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, "wait"))
+ {
+ player_wait(world);
+ }
+ else if (key == get_available_keycode_to_action(world, "player_u"))
+ {
+ move_player(world, NORTH);
+ }
+ else if (key == get_available_keycode_to_action(world, "player_r"))
+ {
+ move_player(world, EAST);
+ }
+ else if (key == get_available_keycode_to_action(world, "player_d"))
+ {
+ move_player(world, SOUTH);
+ }
+ else if (key == get_available_keycode_to_action(world, "player_l"))
+ {
+ move_player(world, WEST);
+ }
+ else if (key == get_available_keycode_to_action(world, "drop"))
+ {
+ player_drop(world);
+ }
+ else if (key == get_available_keycode_to_action(world, "pick"))
+ {
+ player_pick(world);
+ }
+ else
+ {
+ return 0;
+ }
+ return 1;
+}
+
+
+
+extern uint8_t wingeom_control(int key, struct World * world)
+{
+ char * err_shift = "Trouble with shift_active_win() in wingeom_control().";