X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fevents.c;h=31d45abff4cc3946e05589270ad869d05765e3d4;hp=bc6e2eb083604889ca75802a0ab1c139df8bd418;hb=ac173e23840c40f57ca10fc76e5267064faeda55;hpb=7270af24b41bc33fbb89a97227a7696e343eacbb diff --git a/src/events.c b/src/events.c index bc6e2eb0..31d45abf 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) { @@ -1934,13 +1938,13 @@ boolean HandleKeysDebug(Key key, int key_status) SetVideoFrameDelay(GameFrameDelay); if (GameFrameDelay > ONE_SECOND_DELAY) - Error(ERR_DEBUG, "frame delay == %d ms", GameFrameDelay); + Error(ERR_INFO, "frame delay == %d ms", GameFrameDelay); else if (GameFrameDelay != 0) - Error(ERR_DEBUG, "frame delay == %d ms (max. %d fps / %d %%)", + Error(ERR_INFO, "frame delay == %d ms (max. %d fps / %d %%)", GameFrameDelay, ONE_SECOND_DELAY / GameFrameDelay, GAME_FRAME_DELAY * 100 / GameFrameDelay); else - Error(ERR_DEBUG, "frame delay == 0 ms (maximum speed)"); + Error(ERR_INFO, "frame delay == 0 ms (maximum speed)"); return TRUE; } @@ -1953,14 +1957,14 @@ boolean HandleKeysDebug(Key key, int key_status) { options.debug = !options.debug; - Error(ERR_DEBUG, "debug mode %s", + Error(ERR_INFO, "debug mode %s", (options.debug ? "enabled" : "disabled")); return TRUE; } else if (key == KSYM_v) { - Error(ERR_DEBUG, "currently using game engine version %d", + Error(ERR_INFO, "currently using game engine version %d", game.engine_version); return TRUE; @@ -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) {