Improved control map handling

This commit is contained in:
2025-08-08 22:39:48 -04:00
parent 35621d8b4d
commit e20752a97e
7 changed files with 188 additions and 71 deletions

View File

@@ -40,16 +40,10 @@ ErrorContext *controller_handle_event(void *appstate, SDL_Event *event)
event->key.key == curcontrol->key)
);
if ( event->type == curcontrol->event_on && eventButtonComboMatch) {
SDL_Log("event %d (button %d / key %d) ACTIVATES controlmap %d control %d", event->type, event->gbutton.which, event->key.key, i, j);
BITMASK_DEL(curmap->target->state, curcontrol->target_del_state_on);
BITMASK_ADD(curmap->target->state, curcontrol->target_add_state_on);
SDL_Log("new target actor state: %d", curmap->target->state);
CATCH(errctx, curcontrol->handler_on(curmap->target, event));
goto _controller_handle_event_success;
} else if ( event->type == curcontrol->event_off && eventButtonComboMatch ) {
SDL_Log("event %d (button %d / key %d) DE-ACTIVATES controlmap %d control %d", event->type, event->gbutton.which, event->key.key, i, j);
BITMASK_DEL(curmap->target->state, curcontrol->target_del_state_off);
BITMASK_ADD(curmap->target->state, curcontrol->target_add_state_off);
SDL_Log("new target actor state: %d", curmap->target->state);
CATCH(errctx, curcontrol->handler_off(curmap->target, event));
goto _controller_handle_event_success;
}
}