rnd-20140514-2-src
authorHolger Schemel <info@artsoft.org>
Wed, 14 May 2014 19:57:09 +0000 (21:57 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 09:01:31 +0000 (11:01 +0200)
* cleanup of functions RedrawPlayfield() and BlitScreenToBitmap()

ChangeLog
src/cartoons.c
src/conftime.h
src/game.c
src/tools.c
src/tools.h

index 33999ffa61e071936e0a7d730bf852c36a9f7ea7..84e7d51c7868a2bcb5711e915a70406981704b28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2014-05-14
+       * cleanup of functions RedrawPlayfield() and BlitScreenToBitmap()
+
 2014-05-13
        * fixed level redraw after quick-loading tape with small tile graphics
 
@@ -81,8 +84,8 @@
 2013-12-11
        * removed limitation of artwork files to selected file types (this means
          that every file type supported by SDL_image and SDL_mixer can be used)
-       * changed default graphics vom PCX to PNG (needed for Android version to
-         prevent painfully slow loading of images, although not compressing PCX
+       * changed default graphics from PCX to PNG (needed for Android version
+         to prevent painfully slow image loading, although not compressing PCX
          files in the assets directory of the APK package might also work fine)
        * fixed bug with SDL_BlitSurface creating garbage when source and target
          surface are the same (this bug also existed in versions of SDL 1.2.x)
index 8ca4bdd5efde9c2e81ffbf96bc1796d1a2adcf17..1f430493f64334296300851c3f479f078fa7c8f7 100644 (file)
@@ -26,6 +26,9 @@ static void PrepareBackbuffer()
   if (game_status != GAME_MODE_PLAYING)
     return;
 
+#if 1
+  BlitScreenToBitmap(backbuffer);
+#else
   if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
   {
     BlitScreenToBitmap_EM(backbuffer);
@@ -43,6 +46,7 @@ static void PrepareBackbuffer()
 
     BlitBitmap(fieldbuffer, backbuffer, fx, fy, SXSIZE, SYSIZE, SX, SY);
   }
+#endif
 }
 
 boolean ToonNeedsRedraw()
index 3355c2e7872fb696fc202c52db18d9ca0ef48d3c..ee4952618e417b842766b7de7056aef27869907f 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2014-05-14 01:51"
+#define COMPILE_DATE_STRING "2014-05-14 21:52"
index 335bfdea4c08869fc32ee8f4efd82b9e35e19a64..9e6ecbd9ef590fd16e8cd8eda37802a8a1bd645c 100644 (file)
@@ -4507,15 +4507,19 @@ void InitGame()
   {
     InitGameEngine_EM();
 
+#if 0
     /* blit playfield from scroll buffer to normal back buffer for fading in */
     BlitScreenToBitmap_EM(backbuffer);
+#endif
   }
   else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
   {
     InitGameEngine_SP();
 
+#if 0
     /* blit playfield from scroll buffer to normal back buffer for fading in */
     BlitScreenToBitmap_SP(backbuffer);
+#endif
   }
   else
   {
@@ -4526,16 +4530,26 @@ void InitGame()
     if (game.timegate_time_left == 0)
       CloseAllOpenTimegates();
 
+#if 0
+    /* blit playfield from scroll buffer to normal back buffer for fading in */
 #if NEW_TILESIZE
     BlitScreenToBitmap(backbuffer);
 #else
-    /* blit playfield from scroll buffer to normal back buffer for fading in */
     if (setup.soft_scrolling)
       BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
 #endif
+#endif
 
+#if 0
     redraw_mask |= REDRAW_FROM_BACKBUFFER;
+#endif
   }
+#if 1
+  /* blit playfield from scroll buffer to normal back buffer for fading in */
+  BlitScreenToBitmap(backbuffer);
+
+  redraw_mask |= REDRAW_FROM_BACKBUFFER;
+#endif
   /* !!! FIX THIS (END) !!! */
 
 #if 1
index ea92646c6baecc36ebe2dc47d567e455f55f7ae0..62cd26a8d9ebaeb2c4f1065d8361cdb7848c073f 100644 (file)
@@ -298,59 +298,59 @@ void SetDrawtoField(int mode)
 
 #if 1
 
-void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height)
+static void RedrawPlayfield_RND()
 {
-  if (game_status == GAME_MODE_PLAYING &&
-      level.game_engine_type == GAME_ENGINE_TYPE_EM)
-  {
-    /* currently there is no partial redraw -- always redraw whole playfield */
-    RedrawPlayfield_EM(TRUE);
+  int x, y;
 
-    /* blit playfield from scroll buffer to normal back buffer for fading in */
-    BlitScreenToBitmap_EM(backbuffer);
-  }
-  else if (game_status == GAME_MODE_PLAYING &&
-          level.game_engine_type == GAME_ENGINE_TYPE_SP)
-  {
-    /* currently there is no partial redraw -- always redraw whole playfield */
-    RedrawPlayfield_SP(TRUE);
+  if (game.envelope_active)
+    return;
 
-    /* blit playfield from scroll buffer to normal back buffer for fading in */
-    BlitScreenToBitmap_SP(backbuffer);
-  }
-  else if (game_status == GAME_MODE_PLAYING &&
-          !game.envelope_active)
-  {
 #if 0
-    DrawLevel();
+  DrawLevel();
 #else
 
-    SetMainBackgroundImage(IMG_BACKGROUND_PLAYING);
-    // SetDrawBackgroundMask(REDRAW_FIELD);    // !!! CHECK THIS !!!
+  SetMainBackgroundImage(IMG_BACKGROUND_PLAYING);
+  // SetDrawBackgroundMask(REDRAW_FIELD);      // !!! CHECK THIS !!!
 
-    for (x = BX1; x <= BX2; x++)
-      for (y = BY1; y <= BY2; y++)
-       DrawScreenField(x, y);
+  for (x = BX1; x <= BX2; x++)
+    for (y = BY1; y <= BY2; y++)
+      DrawScreenField(x, y);
 
-    redraw_mask |= REDRAW_FIELD;
+  redraw_mask |= REDRAW_FIELD;
 #endif
-    DrawAllPlayers();
+  DrawAllPlayers();
 
+#if 0
 #if NEW_TILESIZE
-    BlitScreenToBitmap(backbuffer);
+  BlitScreenToBitmap(backbuffer);
 #else
-    /* blit playfield from scroll buffer to normal back buffer */
-    if (setup.soft_scrolling)
-    {
-      int fx = FX, fy = FY;
+  /* blit playfield from scroll buffer to normal back buffer */
+  if (setup.soft_scrolling)
+  {
+    int fx = FX, fy = FY;
 
-      fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
-      fy += (ScreenMovDir & (MV_UP|MV_DOWN)    ? ScreenGfxPos : 0);
+    fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
+    fy += (ScreenMovDir & (MV_UP|MV_DOWN)    ? ScreenGfxPos : 0);
 
-      BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY);
-    }
-#endif
+    BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY);
   }
+#endif
+#endif
+}
+
+void RedrawPlayfield()
+{
+  if (game_status != GAME_MODE_PLAYING)
+    return;
+
+  if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+    RedrawPlayfield_EM(TRUE);
+  else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+    RedrawPlayfield_SP(TRUE);
+  else if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
+    RedrawPlayfield_RND();
+
+  BlitScreenToBitmap(backbuffer);
 
   BlitBitmap(drawto, window, gfx.sx, gfx.sy, gfx.sxsize, gfx.sysize,
             gfx.sx, gfx.sy);
@@ -497,7 +497,7 @@ void DrawMaskedBorder(int redraw_mask)
   }
 }
 
-void BlitScreenToBitmap(Bitmap *target_bitmap)
+static void BlitScreenToBitmap_RND(Bitmap *target_bitmap)
 {
   DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field);
   int fx = FX, fy = FY;
@@ -594,6 +594,16 @@ void BlitScreenToBitmap(Bitmap *target_bitmap)
   }
 }
 
+void BlitScreenToBitmap(Bitmap *target_bitmap)
+{
+  if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
+    BlitScreenToBitmap_EM(target_bitmap);
+  else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
+    BlitScreenToBitmap_SP(target_bitmap);
+  else if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
+    BlitScreenToBitmap_RND(target_bitmap);
+}
+
 void BackToFront()
 {
   int x, y;
@@ -723,7 +733,7 @@ void BackToFront()
     else
     {
 #if 1
-      BlitScreenToBitmap(window);
+      BlitScreenToBitmap_RND(window);
 #else
       int fx = FX, fy = FY;
 
@@ -3339,12 +3349,16 @@ void ShowEnvelopeRequest(char *text, unsigned int req_state, int action)
   if (game_status == GAME_MODE_PLAYING)
   {
 #if 1
+#if 1
+    BlitScreenToBitmap(backbuffer);
+#else
     if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
       BlitScreenToBitmap_EM(backbuffer);
     else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
       BlitScreenToBitmap_SP(backbuffer);
     else
-      BlitScreenToBitmap(backbuffer);
+      BlitScreenToBitmap_RND(backbuffer);
+#endif
 #else
     if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
       BlitScreenToBitmap_EM(backbuffer);
@@ -4655,10 +4669,14 @@ static boolean RequestDoor(char *text, unsigned int req_state)
 
   if (game_status == GAME_MODE_PLAYING)
   {
+#if 1
+    BlitScreenToBitmap(backbuffer);
+#else
     if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
       BlitScreenToBitmap_EM(backbuffer);
     else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
       BlitScreenToBitmap_SP(backbuffer);
+#endif
   }
 
   /* disable deactivated drawing when quick-loading level tape recording */
@@ -4852,12 +4870,16 @@ static boolean RequestEnvelope(char *text, unsigned int req_state)
   if (game_status == GAME_MODE_PLAYING)
   {
 #if 1
+#if 1
+    BlitScreenToBitmap(backbuffer);
+#else
     if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
       BlitScreenToBitmap_EM(backbuffer);
     else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
       BlitScreenToBitmap_SP(backbuffer);
     else
-      BlitScreenToBitmap(backbuffer);
+      BlitScreenToBitmap_RND(backbuffer);
+#endif
 #else
     if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
       BlitScreenToBitmap_EM(backbuffer);
@@ -5074,10 +5096,14 @@ boolean Request(char *text, unsigned int req_state)
 
   if (game_status == GAME_MODE_PLAYING)
   {
+#if 1
+    BlitScreenToBitmap(backbuffer);
+#else
     if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
       BlitScreenToBitmap_EM(backbuffer);
     else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
       BlitScreenToBitmap_SP(backbuffer);
+#endif
   }
 
   /* disable deactivated drawing when quick-loading level tape recording */
index 3d7c96eac71745f42f7fd78f169f45190dd2255c..e042fa66bf5ae3561eb8aea7c49f865f92f93477 100644 (file)
@@ -80,7 +80,11 @@ void DrawMaskedBorder_ALL();
 void DrawMaskedBorder(int);
 
 void SetDrawtoField(int);
+#if 1
+void RedrawPlayfield();
+#else
 void RedrawPlayfield(boolean, int, int, int, int);
+#endif
 void BlitScreenToBitmap(Bitmap *);
 void BackToFront();