rnd-20061013-2-src
authorHolger Schemel <info@artsoft.org>
Fri, 13 Oct 2006 18:23:11 +0000 (20:23 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:53:16 +0000 (10:53 +0200)
* added page fading effects for remaining info sub-screens
* fixed small bug that caused some delays when answering door request

ChangeLog
src/conftime.h
src/screens.c
src/tools.c

index 31f250cb5c566de6f1a0128e1a99bed114e7c1f4..cef02a75face6f00f8723d7e9a6f2a50ea08b0e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-10-13
+       * added page fading effects for remaining info sub-screens
+       * fixed small bug that caused some delays when answering door request
+
 2006-10-12
        * added directives "border.draw_masked.*" for menu/playfield area and
          door areas to display overlapping/masked borders from "global.border"
index 795a767949ec4fe0307c8263487268d385745a16..58580f4d34e7ff4db86880470dfc73246ffa88cb 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2006-10-13 03:06]"
+#define COMPILE_DATE_STRING "[2006-10-13 20:20]"
index 94c63b8826d76d06b704da0c041cb5e3491089e1..17a7910c5746ccb8f36ac00286b3ded4eda465e7 100644 (file)
@@ -128,9 +128,10 @@ static void HandleChooseTree(int, int, int, int, int, TreeInfo **);
 
 static void DrawChooseLevel(void);
 static void DrawInfoScreen(void);
+static void DrawAndFadeInInfoScreen(int);
 static void DrawSetupScreen(void);
 
-static void DrawInfoScreenExt(int);
+static void DrawInfoScreenExt(int, int);
 static void DrawInfoScreen_NotAvailable(char *, char *);
 static void DrawInfoScreen_HelpAnim(int, int, boolean);
 static void DrawInfoScreen_HelpText(int, int, int, int);
@@ -579,7 +580,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
       OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
 
       info_mode = INFO_MODE_MAIN;
-      DrawInfoScreenExt(use_fading_main_menu);
+      DrawInfoScreenExt(REDRAW_ALL, use_fading_main_menu);
     }
     else       /* default: return to main menu */
     {
@@ -814,7 +815,7 @@ static struct TokenInfo info_info_main[] =
   { 0,                 NULL,                   NULL                    }
 };
 
-static void DrawInfoScreen_Main(boolean do_fading)
+static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading)
 {
   int i;
 
@@ -854,7 +855,7 @@ static void DrawInfoScreen_Main(boolean do_fading)
   DrawMaskedBorder(REDRAW_ALL);
 
   if (do_fading)
-    FadeIn(REDRAW_ALL);
+    FadeIn(redraw_mask);
   else
     BackToFront();
 
@@ -1136,12 +1137,15 @@ void DrawInfoScreen_Elements()
 {
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_ELEMENTS);
 
+  FadeOut(REDRAW_FIELD);
+
   LoadHelpAnimInfo();
   LoadHelpTextInfo();
 
   HandleInfoScreen_Elements(MB_MENU_INITIALIZE);
 
-  FadeToFront();
+  FadeIn(REDRAW_FIELD);
+
   InitAnimation();
 }
 
@@ -1190,14 +1194,21 @@ void HandleInfoScreen_Elements(int button)
     if (page >= num_pages)
     {
       FadeSoundsAndMusic();
+      FadeOut(REDRAW_FIELD);
 
       info_mode = INFO_MODE_MAIN;
-      DrawInfoScreen();
+      DrawAndFadeInInfoScreen(REDRAW_FIELD);
 
       return;
     }
 
+    if (button != MB_MENU_INITIALIZE)
+      FadeCrossSaveBackbuffer();
+
     DrawInfoScreen_HelpAnim(page * anims_per_page, num_anims, TRUE);
+
+    if (button != MB_MENU_INITIALIZE)
+      FadeCross(REDRAW_FIELD);
   }
   else
   {
@@ -1213,12 +1224,16 @@ void DrawInfoScreen_Music()
 {
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_MUSIC);
 
+  FadeOut(REDRAW_FIELD);
+
   ClearWindow();
   DrawHeadline();
 
   LoadMusicInfo();
 
   HandleInfoScreen_Music(MB_MENU_INITIALIZE);
+
+  FadeIn(REDRAW_FIELD);
 }
 
 void HandleInfoScreen_Music(int button)
@@ -1265,8 +1280,11 @@ void HandleInfoScreen_Music(int button)
 
     if (list == NULL)
     {
+      FadeSoundsAndMusic();
+      FadeOut(REDRAW_FIELD);
+
       info_mode = INFO_MODE_MAIN;
-      DrawInfoScreen();
+      DrawAndFadeInInfoScreen(REDRAW_FIELD);
 
       return;
     }
@@ -1351,6 +1369,9 @@ static boolean DrawInfoScreen_CreditsScreen(int screen_nr)
   int ystart = 150, ystep = 30;
   int ybottom = SYSIZE - 20;
 
+  if (screen_nr > 8)
+    return FALSE;
+
   ClearWindow();
   DrawHeadline();
 
@@ -1505,10 +1526,12 @@ static boolean DrawInfoScreen_CreditsScreen(int screen_nr)
     DrawTextSCentered(ystart + 4 * ystep, FONT_TEXT_3,
                      "since 1995");
   }
+#if 0
   else
   {
     return FALSE;
   }
+#endif
 
   DrawTextSCentered(ybottom, FONT_TEXT_4,
                    "Press any key or button for next page");
@@ -1522,7 +1545,11 @@ void DrawInfoScreen_Credits()
 
   FadeSoundsAndMusic();
 
+  FadeOut(REDRAW_FIELD);
+
   HandleInfoScreen_Credits(MB_MENU_INITIALIZE);
+
+  FadeIn(REDRAW_FIELD);
 }
 
 void HandleInfoScreen_Credits(int button)
@@ -1559,9 +1586,10 @@ void HandleInfoScreen_Credits(int button)
     else
     {
       FadeSoundsAndMusic();
+      FadeOut(REDRAW_FIELD);
 
       info_mode = INFO_MODE_MAIN;
-      DrawInfoScreen();
+      DrawAndFadeInInfoScreen(REDRAW_FIELD);
     }
   }
   else
@@ -1577,6 +1605,8 @@ void DrawInfoScreen_Program()
 
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_PROGRAM);
 
+  FadeOut(REDRAW_FIELD);
+
   ClearWindow();
   DrawHeadline();
 
@@ -1611,6 +1641,8 @@ void DrawInfoScreen_Program()
 
   DrawTextSCentered(ybottom, FONT_TEXT_4,
                    "Press any key or button for info menu");
+
+  FadeIn(REDRAW_FIELD);
 }
 
 void HandleInfoScreen_Program(int button)
@@ -1628,9 +1660,10 @@ void HandleInfoScreen_Program(int button)
   if (button_released)
   {
     FadeSoundsAndMusic();
+    FadeOut(REDRAW_FIELD);
 
     info_mode = INFO_MODE_MAIN;
-    DrawInfoScreen();
+    DrawAndFadeInInfoScreen(REDRAW_FIELD);
   }
   else
   {
@@ -1655,6 +1688,8 @@ void DrawInfoScreen_LevelSet()
 
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
 
+  FadeOut(REDRAW_FIELD);
+
   ClearWindow();
   DrawHeadline();
 
@@ -1669,6 +1704,8 @@ void DrawInfoScreen_LevelSet()
   else
     DrawTextSCentered(ystart, FONT_TEXT_2,
                      "No information for this level set.");
+
+  FadeIn(REDRAW_FIELD);
 }
 
 void HandleInfoScreen_LevelSet(int button)
@@ -1686,9 +1723,10 @@ void HandleInfoScreen_LevelSet(int button)
   if (button_released)
   {
     FadeSoundsAndMusic();
+    FadeOut(REDRAW_FIELD);
 
     info_mode = INFO_MODE_MAIN;
-    DrawInfoScreen();
+    DrawAndFadeInInfoScreen(REDRAW_FIELD);
   }
   else
   {
@@ -1696,7 +1734,7 @@ void HandleInfoScreen_LevelSet(int button)
   }
 }
 
-static void DrawInfoScreenExt(boolean do_fading)
+static void DrawInfoScreenExt(int redraw_mask, boolean do_fading)
 {
   SetMainBackgroundImage(IMG_BACKGROUND_INFO);
 
@@ -1713,7 +1751,7 @@ static void DrawInfoScreenExt(boolean do_fading)
   else if (info_mode == INFO_MODE_LEVELSET)
     DrawInfoScreen_LevelSet();
   else
-    DrawInfoScreen_Main(do_fading);
+    DrawInfoScreen_Main(redraw_mask, do_fading);
 
   if (info_mode != INFO_MODE_MAIN &&
       info_mode != INFO_MODE_TITLE &&
@@ -1724,9 +1762,14 @@ static void DrawInfoScreenExt(boolean do_fading)
   }
 }
 
+void DrawAndFadeInInfoScreen(int redraw_mask)
+{
+  DrawInfoScreenExt(redraw_mask, TRUE);
+}
+
 void DrawInfoScreen()
 {
-  DrawInfoScreenExt(0);
+  DrawInfoScreenExt(REDRAW_ALL, FALSE);
 }
 
 void HandleInfoScreen(int mx, int my, int dx, int dy, int button)
index 21c5315352ca4e1e5b0c20730ea2d343a2910172..ff28a2c1785e1c8cc45034335d054891248374b9 100644 (file)
@@ -268,6 +268,11 @@ void BackToFront()
   if (redraw_mask == REDRAW_NONE)
     return;
 
+  if (redraw_mask & REDRAW_TILES &&
+      game_status == GAME_MODE_PLAYING &&
+      border.draw_masked[game_status])
+    redraw_mask |= REDRAW_FIELD;
+
   if (global.fps_slowdown && game_status == GAME_MODE_PLAYING)
   {
     static boolean last_frame_skipped = FALSE;
@@ -305,8 +310,15 @@ void BackToFront()
 
   SyncDisplay();
 
+#if 1
+  DrawMaskedBorder(redraw_mask);
+#endif
+
   if (redraw_mask & REDRAW_ALL)
   {
+#if 0
+    DrawMaskedBorder(REDRAW_ALL);
+#endif
     BlitBitmap(backbuffer, window, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
 
     redraw_mask = REDRAW_NONE;
@@ -317,7 +329,9 @@ void BackToFront()
     if (game_status != GAME_MODE_PLAYING ||
        redraw_mask & REDRAW_FROM_BACKBUFFER)
     {
+#if 0
       DrawMaskedBorder(REDRAW_FIELD);
+#endif
       BlitBitmap(backbuffer, window,
                 REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, REAL_SX, REAL_SY);
     }
@@ -375,19 +389,25 @@ void BackToFront()
   {
     if (redraw_mask & REDRAW_DOOR_1)
     {
+#if 0
       DrawMaskedBorder(REDRAW_DOOR_1);
+#endif
       BlitBitmap(backbuffer, window, DX, DY, DXSIZE, DYSIZE, DX, DY);
     }
 
     if (redraw_mask & REDRAW_DOOR_2)
     {
+#if 0
       DrawMaskedBorder(REDRAW_DOOR_2);
+#endif
       BlitBitmap(backbuffer, window, VX, VY, VXSIZE, VYSIZE, VX, VY);
     }
 
     if (redraw_mask & REDRAW_DOOR_3)
     {
+#if 0
       DrawMaskedBorder(REDRAW_DOOR_3);
+#endif
       BlitBitmap(backbuffer, window, EX, EY, EXSIZE, EYSIZE, EX, EY);
     }
 
@@ -2627,8 +2647,13 @@ boolean Request(char *text, unsigned int req_state)
 
     DoAnimation();
 
+#if 1
+    if (!PendingEvent())       /* delay only if no pending events */
+      Delay(10);
+#else
     /* don't eat all CPU time */
     Delay(10);
+#endif
   }
 
   if (game_status != GAME_MODE_MAIN)