X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=inline;f=src%2Fevents.c;h=470271cbefe3a68b6de54c4fc79d1a6d9b23cc6c;hb=6504e94ad5344b188eae829e8136b804437e70bf;hp=e2f9db8ec530d9f93614a2ae27fb82cbfc39e2ba;hpb=41cfe645942062496cd063eb46e17d677a76c645;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index e2f9db8e..470271cb 100644 --- a/src/events.c +++ b/src/events.c @@ -79,13 +79,15 @@ void EventLoop(void) } } } - - HandleNoXEvent(); + else + HandleNoEvent(); /* don't use all CPU time when idle; the main loop while playing has its own synchronization and is CPU friendly, too */ - if (game_status != PLAYING) + if (game_status == PLAYING) + HandleGameActions(); + else { SyncDisplay(); if (!PendingEvent()) /* delay only if no pending events */ @@ -121,7 +123,7 @@ void HandleOtherEvents(Event *event) HandleClientMessageEvent((ClientMessageEvent *) event); break; -#ifdef USE_SDL_LIBRARY +#ifdef USE_SDL_JOYSTICK case SDL_JOYAXISMOTION: case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: @@ -258,7 +260,7 @@ void HandleMotionEvent(MotionEvent *event) if (!PointerInWindow(window)) return; /* window and pointer are on different screens */ -#if 0 +#if 1 if (button_status == MB_RELEASED && game_status != LEVELED) return; #endif @@ -424,6 +426,7 @@ void HandleButton(int mx, int my, int button) void HandleKey(Key key, int key_status) { int joy = 0; + boolean anyTextGadgetActiveOrJustFinished = anyTextGadgetActive(); static struct SetupKeyboardInfo custom_key; static struct { @@ -587,7 +590,8 @@ void HandleKey(Key key, int key_status) break; case LEVELED: - HandleLevelEditorKeyInput(key); + if (!anyTextGadgetActiveOrJustFinished) + HandleLevelEditorKeyInput(key); break; case PLAYING: @@ -619,6 +623,38 @@ void HandleKey(Key key, int key_status) GAME_FRAME_DELAY * 100 / GameFrameDelay, GameFrameDelay); break; + case KEY_d: + if (options.debug) + { + options.debug = FALSE; + printf("debug mode disabled\n"); + } + else + { + options.debug = TRUE; + printf("debug mode enabled\n"); + } + break; + + case KEY_s: + if (!global.fps_slowdown) + { + global.fps_slowdown = TRUE; + global.fps_slowdown_factor = 2; + printf("fps slowdown enabled -- display only every 2nd frame\n"); + } + else if (global.fps_slowdown_factor == 2) + { + global.fps_slowdown_factor = 4; + printf("fps slowdown enabled -- display only every 4th frame\n"); + } + else + { + global.fps_slowdown = FALSE; + global.fps_slowdown_factor = 1; + printf("fps slowdown disabled\n"); + } + break; #if 0 case KEY_a: @@ -706,7 +742,7 @@ void HandleKey(Key key, int key_status) } } -void HandleNoXEvent() +void HandleNoEvent() { if (button_status && game_status != PLAYING) { @@ -714,15 +750,12 @@ void HandleNoXEvent() return; } -#ifndef MSDOS +#if !defined(MSDOS) && !defined(WIN32) if (options.network) HandleNetworking(); #endif HandleJoystick(); - - if (game_status == PLAYING) - HandleGameActions(); } static int HandleJoystickForAllPlayers()