X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=3406adc52f108ccde75355aaa67d1903be8f6d98;hb=d30944f339893e4c4c6bc3280b8dc84226aa55f9;hp=2e3c7ca9bbd232639c4d62e34153f2cd1ed2b0ea;hpb=0fa16ae6e75fc44a990a57ced9f9397eefb439e4;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index 2e3c7ca9..3406adc5 100644 --- a/src/events.c +++ b/src/events.c @@ -1505,7 +1505,8 @@ static int HandleDropFileEvent(char *filename) Debug("event:dropfile", "filename == '%s'", filename); // check and extract dropped zip files into correct user data directory - if (!strSuffixLower(filename, ".zip")) + if (!strSuffixLower(filename, ".zip") && + !strPrefixLower(filename, "fd:")) { Warn("file '%s' not supported", filename); @@ -1615,6 +1616,12 @@ static void HandleDropCompleteEvent(int num_level_sets_succeeded, void HandleDropEvent(Event *event) { + Debug("event:drop", (event->type == SDL_DROPBEGIN ? "SDL_DROPBEGIN" : + event->type == SDL_DROPFILE ? "SDL_DROPFILE" : + event->type == SDL_DROPTEXT ? "SDL_DROPTEXT" : + event->type == SDL_DROPCOMPLETE ? "SDL_DROPCOMPLETE" : + "(unknown drop event type)")); + static boolean confirm_on_drop_complete = FALSE; static int num_level_sets_succeeded = 0; static int num_artwork_sets_succeeded = 0; @@ -1986,6 +1993,31 @@ static void HandleKeysSpecial(Key key) } } +static boolean HandleKeysSpeed(Key key, int key_status) +{ + if (game_status == GAME_MODE_PLAYING) + { + if (key == setup.shortcut.speed_fast || + key == setup.shortcut.speed_slow) + { + int speed_factor = 4; + + GameFrameDelay = (key_status != KEY_PRESSED ? setup.game_frame_delay : + key == setup.shortcut.speed_fast ? setup.game_frame_delay / speed_factor : + key == setup.shortcut.speed_slow ? setup.game_frame_delay * speed_factor : + setup.game_frame_delay); + + GameFrameDelay = MIN(MAX(1, GameFrameDelay), 1000); + + SetVideoFrameDelay(GameFrameDelay); + + return TRUE; + } + } + + return FALSE; +} + boolean HandleKeysDebug(Key key, int key_status) { #ifdef DEBUG @@ -2073,6 +2105,9 @@ void HandleKey(Key key, int key_status) int joy = 0; int i; + if (HandleKeysSpeed(key, key_status)) + return; // do not handle already processed keys again + if (HandleKeysDebug(key, key_status)) return; // do not handle already processed keys again