X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fevents.c;h=b3e4c81f599fe00ab070f7353b040a7fa573ff58;hp=bc6e2eb083604889ca75802a0ab1c139df8bd418;hb=c2db569638939bd90635f738953f81168421a41e;hpb=7270af24b41bc33fbb89a97227a7696e343eacbb diff --git a/src/events.c b/src/events.c index bc6e2eb0..b3e4c81f 100644 --- a/src/events.c +++ b/src/events.c @@ -268,12 +268,14 @@ void HandleOtherEvents(Event *event) HandleJoystickEvent(event); break; +#if defined(USE_DRAG_AND_DROP) case SDL_DROPBEGIN: case SDL_DROPCOMPLETE: case SDL_DROPFILE: case SDL_DROPTEXT: HandleDropEvent(event); break; +#endif default: break; @@ -1525,6 +1527,7 @@ void HandleClientMessageEvent(ClientMessageEvent *event) CloseAllAndExit(0); } +#if defined(USE_DRAG_AND_DROP) static boolean HandleDropFileEvent(char *filename) { Error(ERR_DEBUG, "DROP FILE EVENT: '%s'", filename); @@ -1643,6 +1646,7 @@ void HandleDropEvent(Event *event) if (event->drop.file != NULL) SDL_free(event->drop.file); } +#endif void HandleButton(int mx, int my, int button, int button_nr) { @@ -2015,6 +2019,7 @@ void HandleKey(Key key, int key_status) for (pnr = 0; pnr < MAX_PLAYERS; pnr++) { byte key_action = 0; + byte key_snap_action = 0; if (setup.input[pnr].use_joystick) continue; @@ -2030,15 +2035,33 @@ void HandleKey(Key key, int key_status) { ssi = setup.shortcut; + // also remember normal snap key when handling snap+direction keys + key_snap_action |= key_action & JOY_BUTTON_SNAP; + for (i = 0; i < NUM_DIRECTIONS; i++) + { if (key == *key_info[i].key_snap) - key_action |= key_info[i].action | JOY_BUTTON_SNAP; + { + key_action |= key_info[i].action | JOY_BUTTON_SNAP; + key_snap_action |= key_info[i].action; + } + } } if (key_status == KEY_PRESSED) - stored_player[pnr].action |= key_action; + { + stored_player[pnr].action |= key_action; + stored_player[pnr].snap_action |= key_snap_action; + } else - stored_player[pnr].action &= ~key_action; + { + stored_player[pnr].action &= ~key_action; + stored_player[pnr].snap_action &= ~key_snap_action; + } + + // restore snap action if one of several pressed snap keys was released + if (stored_player[pnr].snap_action) + stored_player[pnr].action |= JOY_BUTTON_SNAP; if (tape.single_step && tape.recording && tape.pausing && !tape.use_mouse) {