File src/input.c changed (mode: 100644) (index 136cc5d..c38e446) |
... |
... |
static int input_command_append_multiplier(int multiplier) { |
58 |
58 |
multiplier = (command.multiplier*10)+multiplier; |
multiplier = (command.multiplier*10)+multiplier; |
59 |
59 |
if (multiplier > command.multiplier) { |
if (multiplier > command.multiplier) { |
60 |
60 |
command.multiplier = multiplier; |
command.multiplier = multiplier; |
61 |
|
console("InputMultiplier set to %d", command.multiplier); |
|
62 |
61 |
} |
} |
63 |
62 |
return command.multiplier; |
return command.multiplier; |
64 |
63 |
} |
} |
65 |
64 |
|
|
66 |
65 |
static void input_command_append_movement(int movement) { |
static void input_command_append_movement(int movement) { |
67 |
66 |
command.movement = movement; |
command.movement = movement; |
68 |
|
console("InputMovement set to %d", command.movement); |
|
69 |
67 |
} |
} |
70 |
68 |
|
|
71 |
69 |
static void input_command_append_action(int action) { |
static void input_command_append_action(int action) { |
72 |
70 |
command.action = action; |
command.action = action; |
73 |
|
console("InputAction set to %d", command.action); |
|
74 |
71 |
if (command.action != INPUT_ACTION_GO) { |
if (command.action != INPUT_ACTION_GO) { |
75 |
72 |
input_command_append_movement(INPUT_MOVEMENT_NA); |
input_command_append_movement(INPUT_MOVEMENT_NA); |
76 |
73 |
} |
} |
|
... |
... |
command_t * input_get() { |
98 |
95 |
} |
} |
99 |
96 |
if ((i = input_char_get_action(ch)) != INPUT_ACTION_NONE) { |
if ((i = input_char_get_action(ch)) != INPUT_ACTION_NONE) { |
100 |
97 |
if (command.action != INPUT_ACTION_NONE && command.action != i) { |
if (command.action != INPUT_ACTION_NONE && command.action != i) { |
101 |
|
console("Invalid input sequence, resetting."); |
|
|
98 |
|
debug("Invalid input sequence with double actions (%d, %d), resetting.\n", command.action, i); |
102 |
99 |
input_reset(); |
input_reset(); |
|
100 |
|
return NULL; |
103 |
101 |
} |
} |
104 |
102 |
if (command.action == INPUT_ACTION_NONE) { |
if (command.action == INPUT_ACTION_NONE) { |
105 |
103 |
input_command_append_action(i); |
input_command_append_action(i); |
|
... |
... |
command_t * input_get() { |
117 |
115 |
} |
} |
118 |
116 |
|
|
119 |
117 |
int input_handle(command_t * command) { |
int input_handle(command_t * command) { |
120 |
|
console("input_handle(): multiplier=%d, movement=%d, action=%d", command->multiplier, command->movement, command->action); |
|
|
118 |
|
debug("input_handle(): multiplier=%d, movement=%d, action=%d\n", command->multiplier, command->movement, command->action); |
121 |
119 |
if (command->action == INPUT_ACTION_QUIT) { |
if (command->action == INPUT_ACTION_QUIT) { |
122 |
120 |
shutdown(); |
shutdown(); |
123 |
121 |
return 0; |
return 0; |