Fix: DAS delay timer now synchronized with movement cycle for continuous walk
This commit is contained in:
@@ -181,6 +181,23 @@ void engine_init(void) {
|
||||
}
|
||||
|
||||
void engine_update(uint8_t keys, uint8_t prev_keys) {
|
||||
uint8_t keys_pressed = keys & ~prev_keys;
|
||||
|
||||
if (keys_pressed) {
|
||||
das_timer = DAS_DELAY;
|
||||
das_active = 1;
|
||||
} else if (keys && das_active) {
|
||||
if (das_timer > 0) {
|
||||
das_timer--;
|
||||
}
|
||||
if (das_timer == 0 && !is_moving) {
|
||||
das_timer = DAS_REPEAT;
|
||||
keys_pressed = keys; // trigger move
|
||||
}
|
||||
} else {
|
||||
das_active = 0;
|
||||
}
|
||||
|
||||
if (is_moving) {
|
||||
move_progress++;
|
||||
|
||||
@@ -213,21 +230,6 @@ void engine_update(uint8_t keys, uint8_t prev_keys) {
|
||||
return; // Ignore other inputs while moving
|
||||
}
|
||||
|
||||
uint8_t keys_pressed = keys & ~prev_keys;
|
||||
|
||||
if (keys_pressed) {
|
||||
das_timer = DAS_DELAY;
|
||||
das_active = 1;
|
||||
} else if (keys && das_active) {
|
||||
das_timer--;
|
||||
if (das_timer == 0) {
|
||||
das_timer = DAS_REPEAT;
|
||||
keys_pressed = keys; // trigger move
|
||||
}
|
||||
} else {
|
||||
das_active = 0;
|
||||
}
|
||||
|
||||
int8_t move_lx = 0;
|
||||
int8_t move_ly = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user