Add charviewer utility for viewing character / sprite files

This commit is contained in:
2025-08-04 21:37:36 -04:00
parent fb3ff6f2b3
commit 9ecfc7dc42
4 changed files with 192 additions and 4 deletions

View File

@@ -22,8 +22,8 @@ ErrorContext *controller_handle_event(void *appstate, SDL_Event *event)
if ( curmap->target == NULL ) {
continue;
}
SDL_Log("Control map %d maps to actor %s", i, curmap->target->name);
SDL_Log("event from keyboard %d", event->key.which);
//SDL_Log("Control map %d maps to actor %s", i, curmap->target->name);
//SDL_Log("event from keyboard %d", event->key.which);
for ( j = 0; j < MAX_CONTROLS; j++ ) {
curcontrol = &curmap->controls[j];
//SDL_Log("button/key is processed by controlmap %d control %d", i, j);
@@ -32,20 +32,24 @@ ErrorContext *controller_handle_event(void *appstate, SDL_Event *event)
eventButtonComboMatch = (
((event->type == SDL_EVENT_GAMEPAD_BUTTON_DOWN ||
event->type == SDL_EVENT_GAMEPAD_BUTTON_UP) &&
event->gbutton.which == curmap->jsid &&
event->gbutton.button == curcontrol->button) ||
((event->type == SDL_EVENT_KEY_DOWN ||
event->type == SDL_EVENT_KEY_UP) &&
event->key.which == curmap->kbid &&
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.which, i, j);
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);
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.which, i, j);
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);
goto _controller_handle_event_success;
}
}