From 68a192ca5b9f81833abb24501e22a590678f68b9 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 15 Jan 2014 20:20:38 +0100 Subject: [PATCH] rnd-20140115-2-src * fixed toons stopping on continuous touch events on Mac OS X --- ChangeLog | 3 +++ src/conftime.h | 2 +- src/events.c | 48 ++++++++++++++++++++++++++++++++++++++---------- src/events.h | 1 + src/screens.c | 20 ++++++++++++++++---- src/tools.c | 18 ++++++++++++++---- src/tools.h | 3 ++- 7 files changed, 75 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d35816c..03bb49af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2014-01-15 + * fixed toons stopping on continuous touch events on Mac OS X + 2014-01-14 * fixed bug when displaying game envelope with even sized playfield * added graphic configuration options for request (dialog) buttons diff --git a/src/conftime.h b/src/conftime.h index 2921eb0c..db55b7e1 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-01-15 19:23" +#define COMPILE_DATE_STRING "2014-01-15 20:15" diff --git a/src/events.c b/src/events.c index 88fc3214..2593dd2f 100644 --- a/src/events.c +++ b/src/events.c @@ -188,13 +188,6 @@ void EventLoop(void) } } } - - // !!! CHECK THIS: - // !!! this may result in "HandleNoEvent()" never being called - // !!! (especially due to continuously processed tocuh events) - // !!! and therefore toon animations being stopped while events - // !!! are being processed (even if they are all thrown away) - else { /* when playing, display a special mouse pointer inside the playfield */ @@ -213,9 +206,15 @@ void EventLoop(void) playfield_cursor_set = FALSE; } +#if 0 HandleNoEvent(); +#endif } +#if 1 + HandleNoEvent(); +#endif + /* don't use all CPU time when idle; the main loop while playing has its own synchronization and is CPU friendly, too */ @@ -1425,7 +1424,13 @@ void HandleNoEvent() { HandleButton(0, 0, -button_status, button_status); +#if 0 return; +#endif + } + else + { + HandleJoystick(); } #if defined(NETWORK_AVALIABLE) @@ -1433,7 +1438,28 @@ void HandleNoEvent() HandleNetworking(); #endif - HandleJoystick(); + switch (game_status) + { + case GAME_MODE_MAIN: + DrawPreviewLevelAnimation(); + DoAnimation(); + break; + + case GAME_MODE_LEVELS: + case GAME_MODE_LEVELNR: + case GAME_MODE_SETUP: + case GAME_MODE_INFO: + case GAME_MODE_SCORES: + DoAnimation(); + break; + + case GAME_MODE_EDITOR: + HandleLevelEditorIdle(); + break; + + default: + break; + } } static int HandleJoystickForAllPlayers() @@ -1510,18 +1536,20 @@ void HandleJoystick() HandleHallOfFame(0, 0, dx, dy, !newbutton); break; +#if 0 case GAME_MODE_EDITOR: HandleLevelEditorIdle(); break; +#endif case GAME_MODE_PLAYING: if (tape.playing || keyboard) newbutton = ((joy & JOY_BUTTON) != 0); #if 0 - if (local_player->LevelSolved_GameEnd && newbutton) + if (newbutton && local_player->LevelSolved_GameEnd) #else - if (AllPlayersGone && newbutton) + if (newbutton && AllPlayersGone) #endif { GameEnd(); diff --git a/src/events.h b/src/events.h index eb19b650..2b1022b0 100644 --- a/src/events.h +++ b/src/events.h @@ -42,6 +42,7 @@ void HandleClientMessageEvent(ClientMessageEvent *); void HandleWindowManagerEvent(Event *); void HandleNoEvent(void); +void HandleToonAnimations(void); void HandleButton(int, int, int, int); void HandleKey(Key, int); diff --git a/src/screens.c b/src/screens.c index 6543e168..7f694d98 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1418,7 +1418,7 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) InitializeMainControls(); DrawCursorAndText_Main(-1, FALSE); - DrawPreviewLevel(TRUE); + DrawPreviewLevelInitial(); HandleMainMenu(0, 0, 0, 0, MB_MENU_INITIALIZE); @@ -1757,13 +1757,13 @@ void HandleMainMenu_SelectLevel(int step, int direction) mci->pos_text->font); LoadLevel(level_nr); - DrawPreviewLevel(TRUE); + DrawPreviewLevelInitial(); TapeErase(); LoadTape(level_nr); DrawCompleteVideoDisplay(); - /* needed because DrawPreviewLevel() takes some time */ + /* needed because DrawPreviewLevelInitial() takes some time */ BackToFront(); SyncDisplay(); } @@ -1926,11 +1926,13 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } } +#if 0 if (game_status == GAME_MODE_MAIN) { - DrawPreviewLevel(FALSE); + DrawPreviewLevelAnimation(); DoAnimation(); } +#endif } @@ -3303,7 +3305,9 @@ void HandleInfoScreen(int mx, int my, int dx, int dy, int button) else HandleInfoScreen_Main(mx, my, dx, dy, button); +#if 0 DoAnimation(); +#endif } @@ -3849,7 +3853,9 @@ void HandleChooseLevelSet(int mx, int my, int dx, int dy, int button) { HandleChooseTree(mx, my, dx, dy, button, &leveldir_current); +#if 0 DoAnimation(); +#endif } void DrawChooseLevelNr() @@ -3920,7 +3926,9 @@ void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button) HandleChooseTree(mx, my, dx, dy, button, &leveldir_current); #endif +#if 0 DoAnimation(); +#endif } void DrawHallOfFame(int highlight_position) @@ -4066,7 +4074,9 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) if (game_status == GAME_MODE_SCORES) PlayMenuSoundIfLoop(); +#if 0 DoAnimation(); +#endif } @@ -6182,7 +6192,9 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button) else HandleSetupScreen_Generic(mx, my, dx, dy, button); +#if 0 DoAnimation(); +#endif } void HandleGameActions() diff --git a/src/tools.c b/src/tools.c index f7735c70..5766b7af 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2957,7 +2957,7 @@ void DrawMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) redraw_mask |= REDRAW_FIELD; } -static void DrawPreviewLevelExt(int from_x, int from_y) +static void DrawPreviewLevelPlayfieldExt(int from_x, int from_y) { boolean show_level_border = (BorderElement != EL_EMPTY); int level_xsize = lev_fieldx + (show_level_border ? 2 : 0); @@ -3093,7 +3093,7 @@ static void DrawPreviewLevelLabelExt(int mode) redraw_mask |= REDRAW_MICROLEVEL; } -void DrawPreviewLevel(boolean restart) +static void DrawPreviewLevelExt(boolean restart) { static unsigned int scroll_delay = 0; static unsigned int label_delay = 0; @@ -3130,7 +3130,7 @@ void DrawPreviewLevel(boolean restart) label_state = 1; label_counter = 0; - DrawPreviewLevelExt(from_x, from_y); + DrawPreviewLevelPlayfieldExt(from_x, from_y); DrawPreviewLevelLabelExt(label_state); /* initialize delay counters */ @@ -3232,7 +3232,7 @@ void DrawPreviewLevel(boolean restart) break; } - DrawPreviewLevelExt(from_x, from_y); + DrawPreviewLevelPlayfieldExt(from_x, from_y); } /* !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!! */ @@ -3279,6 +3279,16 @@ void DrawPreviewLevel(boolean restart) game_status = last_game_status; /* restore current game status */ } +void DrawPreviewLevelInitial() +{ + DrawPreviewLevelExt(TRUE); +} + +void DrawPreviewLevelAnimation() +{ + DrawPreviewLevelExt(FALSE); +} + inline void DrawGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y, int graphic, int sync_frame, int mask_mode) { diff --git a/src/tools.h b/src/tools.h index 424c7fe1..b7eed06f 100644 --- a/src/tools.h +++ b/src/tools.h @@ -187,7 +187,8 @@ void ShowEnvelopeDoor(char *text, int); void DrawLevel(void); void DrawMiniLevel(int, int, int, int); -void DrawPreviewLevel(boolean); +void DrawPreviewLevelInitial(void); +void DrawPreviewLevelAnimation(void); void WaitForEventToContinue(); boolean Request(char *, unsigned int); -- 2.34.1