rnd-20100628-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 28 Jun 2010 16:30:01 +0000 (18:30 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:59:39 +0000 (10:59 +0200)
src/conftime.h
src/files.c
src/game_em/graphics.c
src/game_sp/DDSpriteBuffer.c
src/game_sp/MainForm.c
src/libgame/system.h
src/main.c
src/screens.c
src/tools.c

index fe5d77ae55f8900b0462b17512bacfa491fcf621..e6600b902bc3253c95589463695439c8d75e820c 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-06-24 20:41"
+#define COMPILE_DATE_STRING "2010-06-28 18:25"
index d25a47988ea1485e5ca929f3318cc9a9d83c899e..74702b8d0a7d05c2ad11fa072a6add4643702d05 100644 (file)
@@ -9001,14 +9001,15 @@ void SaveScore(int nr)
 #define SETUP_TOKEN_PREFER_AGA_GRAPHICS                23
 #define SETUP_TOKEN_GAME_FRAME_DELAY           24
 #define SETUP_TOKEN_SP_SHOW_BORDER_ELEMENTS    25
-#define SETUP_TOKEN_GRAPHICS_SET               26
-#define SETUP_TOKEN_SOUNDS_SET                 27
-#define SETUP_TOKEN_MUSIC_SET                  28
-#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS    29
-#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS      30
-#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC       31
+#define SETUP_TOKEN_SMALL_GAME_GRAPHICS                26
+#define SETUP_TOKEN_GRAPHICS_SET               27
+#define SETUP_TOKEN_SOUNDS_SET                 28
+#define SETUP_TOKEN_MUSIC_SET                  29
+#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS    30
+#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS      31
+#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC       32
 
-#define NUM_GLOBAL_SETUP_TOKENS                        32
+#define NUM_GLOBAL_SETUP_TOKENS                        33
 
 /* editor setup */
 #define SETUP_TOKEN_EDITOR_EL_BOULDERDASH      0
@@ -9144,6 +9145,7 @@ static struct TokenInfo global_setup_tokens[] =
   { TYPE_SWITCH, &si.prefer_aga_graphics,     "prefer_aga_graphics"    },
   { TYPE_INTEGER,&si.game_frame_delay,        "game_frame_delay"       },
   { TYPE_SWITCH, &si.sp_show_border_elements, "sp_show_border_elements"        },
+  { TYPE_SWITCH, &si.small_game_graphics,     "small_game_graphics"    },
   { TYPE_STRING, &si.graphics_set,            "graphics_set"           },
   { TYPE_STRING, &si.sounds_set,              "sounds_set"             },
   { TYPE_STRING, &si.music_set,               "music_set"              },
@@ -9311,6 +9313,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->prefer_aga_graphics = TRUE;
   si->game_frame_delay = GAME_FRAME_DELAY;
   si->sp_show_border_elements = FALSE;
+  si->small_game_graphics = FALSE;
 
   si->graphics_set = getStringCopy(GFX_DEFAULT_SUBDIR);
   si->sounds_set = getStringCopy(SND_DEFAULT_SUBDIR);
index ff6e4c6c9aced59ab9c596449eae3dfd7e424533..455979ea932a8e43596930a79266f3caa0e78f2e 100644 (file)
@@ -65,6 +65,16 @@ void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
 {
   int x = screen_x % (MAX_BUF_XSIZE * TILEX);
   int y = screen_y % (MAX_BUF_YSIZE * TILEY);
+  int sx, sy, sxsize, sysize;
+  int xsize = SXSIZE;
+  int ysize = SYSIZE;
+  int full_xsize = lev.width  * TILEX;
+  int full_ysize = lev.height * TILEY;
+
+  sxsize = (full_xsize < xsize ? full_xsize : xsize);
+  sysize = (full_ysize < ysize ? full_ysize : ysize);
+  sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0);
+  sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0);
 
 #if 0
   printf("::: %d, %d\n", screenBitmap->width, screenBitmap->height);
@@ -72,6 +82,46 @@ void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
   return;
 #endif
 
+#if 1
+  if (x < 2 * TILEX && y < 2 * TILEY)
+  {
+    BlitBitmap(screenBitmap, target_bitmap, x, y,
+              sxsize, sysize, sx, sy);
+  }
+  else if (x < 2 * TILEX && y >= 2 * TILEY)
+  {
+    BlitBitmap(screenBitmap, target_bitmap, x, y,
+              sxsize, MAX_BUF_YSIZE * TILEY - y,
+              sx, sy);
+    BlitBitmap(screenBitmap, target_bitmap, x, 0,
+              sxsize, y - 2 * TILEY,
+              sx, sy + MAX_BUF_YSIZE * TILEY - y);
+  }
+  else if (x >= 2 * TILEX && y < 2 * TILEY)
+  {
+    BlitBitmap(screenBitmap, target_bitmap, x, y,
+              MAX_BUF_XSIZE * TILEX - x, sysize,
+              sx, sy);
+    BlitBitmap(screenBitmap, target_bitmap, 0, y,
+              x - 2 * TILEX, sysize,
+              sx + MAX_BUF_XSIZE * TILEX - x, sy);
+  }
+  else
+  {
+    BlitBitmap(screenBitmap, target_bitmap, x, y,
+              MAX_BUF_XSIZE * TILEX - x, MAX_BUF_YSIZE * TILEY - y,
+              sx, sy);
+    BlitBitmap(screenBitmap, target_bitmap, 0, y,
+              x - 2 * TILEX, MAX_BUF_YSIZE * TILEY - y,
+              sx + MAX_BUF_XSIZE * TILEX - x, sy);
+    BlitBitmap(screenBitmap, target_bitmap, x, 0,
+              MAX_BUF_XSIZE * TILEX - x, y - 2 * TILEY,
+              sx, sy + MAX_BUF_YSIZE * TILEY - y);
+    BlitBitmap(screenBitmap, target_bitmap, 0, 0,
+              x - 2 * TILEX, y - 2 * TILEY,
+              sx + MAX_BUF_XSIZE * TILEX - x, sy + MAX_BUF_YSIZE * TILEY - y);
+  }
+#else
   if (x < 2 * TILEX && y < 2 * TILEY)
   {
     BlitBitmap(screenBitmap, target_bitmap, x, y,
@@ -110,6 +160,7 @@ void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
               x - 2 * TILEX, y - 2 * TILEY,
               SX + MAX_BUF_XSIZE * TILEX - x, SY + MAX_BUF_YSIZE * TILEY - y);
   }
+#endif
 }
 
 void BackToFront_EM(void)
@@ -150,6 +201,17 @@ void BackToFront_EM(void)
     boolean half_shifted_y = (EVEN(SCR_FIELDY) && screen_y % TILEY != 0);
 #endif
 
+    int sx, sy, sxsize, sysize;
+    int xsize = SXSIZE;
+    int ysize = SYSIZE;
+    int full_xsize = lev.width  * TILEX;
+    int full_ysize = lev.height * TILEY;
+
+    sxsize = (full_xsize < xsize ? full_xsize : xsize);
+    sysize = (full_ysize < ysize ? full_ysize : ysize);
+    sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0);
+    sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0);
+
 #if 0
 #if 1
     printf("::: %d, %d\n", EVEN(SCR_FIELDX), screen_x);
@@ -176,8 +238,8 @@ void BackToFront_EM(void)
        if (redraw[xx][yy])
          BlitBitmap(screenBitmap, window,
                     xx * TILEX, yy * TILEY, TILEX, TILEY,
-                    SX + x * TILEX - scroll_xoffset,
-                    SY + y * TILEY - scroll_yoffset);
+                    sx + x * TILEX - scroll_xoffset,
+                    sy + y * TILEY - scroll_yoffset);
       }
     }
 
index 8f524c0228b261d86a8d00010d2c53d0a1ea1d87..47ec6aa39e3e5fdd489deba1f88a05dfc8d58b86 100644 (file)
@@ -8,16 +8,23 @@
 static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY)
 {
 #if NEW_TILESIZE
+#if 0
   int pseudo_sxsize = SXSIZE * TILESIZE / TILESIZE_VAR;
   int pseudo_sysize = SYSIZE * TILESIZE / TILESIZE_VAR;
+#endif
 #endif
   int scx = (mScrollX_last < 0 ? 0 : mScrollX_last);
   int scy = (mScrollY_last < 0 ? 0 : mScrollY_last);
   int sx1 = scx - 2 * TILEX;
   int sy1 = scy - 2 * TILEY;
 #if NEW_TILESIZE
+#if 1
+  int sx2 = scx + (SCR_FIELDX + 1) * TILEX;
+  int sy2 = scy + (SCR_FIELDY + 1) * TILEY;
+#else
   int sx2 = scx + pseudo_sxsize + 1 * TILEX;
   int sy2 = scy + pseudo_sysize + 1 * TILEY;
+#endif
 #else
   int sx2 = scx + SXSIZE + 1 * TILEX;
   int sy2 = scy + SYSIZE + 1 * TILEY;
index d2e401b049abaaf13977807ffa858ddbe97e288a..d33191d69d585ea4b62a522164c8d11c107e750a 100644 (file)
@@ -188,8 +188,10 @@ static void ReStretch()
 void SetScrollEdges()
 {
 #if NEW_TILESIZE
+#if 0
   int pseudo_sxsize = SXSIZE * TILESIZE / TILESIZE_VAR;
   int pseudo_sysize = SYSIZE * TILESIZE / TILESIZE_VAR;
+#endif
 #endif
   int border1_offset = (menBorder ? 1 : 2);
   int border2_offset = (menBorder ? 0 : TILESIZE / 2);
@@ -198,8 +200,13 @@ void SetScrollEdges()
   ScrollMinX = 0;
   ScrollMinY = 0;
 #if NEW_TILESIZE
+#if 1
+  ScrollMaxX = (DisplayMaxX + border1_offset - SCR_FIELDX) * TILEX;
+  ScrollMaxY = (DisplayMaxY + border1_offset - SCR_FIELDY) * TILEY;
+#else
   ScrollMaxX = (DisplayMaxX + border1_offset) * TILEX - pseudo_sxsize;
   ScrollMaxY = (DisplayMaxY + border1_offset) * TILEY - pseudo_sysize;
+#endif
 #else
   ScrollMaxX = (DisplayMaxX + border1_offset) * TILEX - SXSIZE;
   ScrollMaxY = (DisplayMaxY + border1_offset) * TILEY - SYSIZE;
index 06ad220d111a04c3eaf86c23a03487751fe41403..d9b42bac13136b145d027aafd0897146420648ba 100644 (file)
@@ -917,6 +917,7 @@ struct SetupInfo
   boolean prefer_aga_graphics;
   int game_frame_delay;
   boolean sp_show_border_elements;
+  boolean small_game_graphics;
 
   char *graphics_set;
   char *sounds_set;
index 796fb9fbb58338610d347dfecc776c00d865fd54..3e3ad2a7421c400e64ce1632d7796cb15a9aee6d 100644 (file)
@@ -105,7 +105,7 @@ int                 SXSIZE = 17 * TILEX;    /* SCR_FIELDX * TILEX */
 int                    SYSIZE = 17 * TILEY;    /* SCR_FIELDY * TILEY */
 int                    FULL_SXSIZE = 2 + 17 * TILEX + 2; /* 2 + SXSIZE + 2 */
 int                    FULL_SYSIZE = 2 + 17 * TILEY + 2; /* 2 + SYSIZE + 2 */
-int                    TILESIZE_VAR = TILESIZE / 2;
+int                    TILESIZE_VAR = TILESIZE;
 
 #if 1
 int                    FX, FY;
index a20d5c2494b6a3783883fd17c4cf9f1943e4a290..cd9edc4637b60f0fa5997d54917823fc222afce7 100644 (file)
@@ -4241,6 +4241,7 @@ static struct TokenInfo setup_info_graphics[] =
   { TYPE_SWITCH,       &setup.toons,           "Show Toons:"           },
   { TYPE_ECS_AGA,      &setup.prefer_aga_graphics,"EMC graphics preference:" },
   { TYPE_SWITCH, &setup.sp_show_border_elements,"Supaplex Border Elements:" },
+  { TYPE_SWITCH,       &setup.small_game_graphics, "Small Game Graphics:" },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
 
index 82fb4d0c34425e5a0b81a0d20384a0c876d349da..9fa295648f06bf90b40fee431eaf6e43273eaffd 100644 (file)
@@ -8831,17 +8831,27 @@ void ChangeViewportPropertiesIfNeeded()
   int border_size = vp_playfield->border_size;
   int new_sx = vp_playfield->x + border_size;
   int new_sy = vp_playfield->y + border_size;
-  int tilesize = (gfx_game_mode == GAME_MODE_PLAYING ? TILESIZE_VAR :
-                 gfx_game_mode == GAME_MODE_EDITOR ? MINI_TILESIZE : TILESIZE);
   int new_sxsize = vp_playfield->width  - 2 * border_size;
   int new_sysize = vp_playfield->height - 2 * border_size;
+  int new_real_sx = vp_playfield->x;
+  int new_real_sy = vp_playfield->y;
+  int new_full_sxsize = vp_playfield->width;
+  int new_full_sysize = vp_playfield->height;
 #if NEW_TILESIZE
+  int new_tilesize_var = TILESIZE / (setup.small_game_graphics ? 2 : 1);
+  int tilesize = (gfx_game_mode == GAME_MODE_PLAYING ? new_tilesize_var :
+                 gfx_game_mode == GAME_MODE_EDITOR ? MINI_TILESIZE : TILESIZE);
   int new_scr_fieldx = new_sxsize / tilesize;
   int new_scr_fieldy = new_sysize / tilesize;
+  int new_scr_fieldx_buffers = new_sxsize / new_tilesize_var;
+  int new_scr_fieldy_buffers = new_sysize / new_tilesize_var;
 #else
   int new_scr_fieldx = (vp_playfield->width  - 2 * border_size) / TILESIZE;
   int new_scr_fieldy = (vp_playfield->height - 2 * border_size) / TILESIZE;
 #endif
+  boolean init_gfx_buffers = FALSE;
+  boolean init_video_buffer = FALSE;
+  boolean init_gadgets_and_toons = FALSE;
 
 #if 0
   /* !!! TEST ONLY !!! */
@@ -8855,6 +8865,10 @@ void ChangeViewportPropertiesIfNeeded()
     WIN_XSIZE = viewport.window.width;
     WIN_YSIZE = viewport.window.height;
 
+#if 1
+    init_video_buffer = TRUE;
+    init_gfx_buffers = TRUE;
+#else
     InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
     InitGfxBuffers();
 
@@ -8864,45 +8878,123 @@ void ChangeViewportPropertiesIfNeeded()
 
     // RedrawBackground();
 #endif
+#endif
+
+    // printf("::: video: init_video_buffer, init_gfx_buffers\n");
   }
 
   if (new_scr_fieldx != SCR_FIELDX ||
-      new_scr_fieldy != SCR_FIELDY ||
-      new_sx != SX ||
+      new_scr_fieldy != SCR_FIELDY)
+  {
+    /* this always toggles between MAIN and GAME when using small tile size */
+
+    SCR_FIELDX = new_scr_fieldx;
+    SCR_FIELDY = new_scr_fieldy;
+
+    // printf("::: new_scr_fieldx != SCR_FIELDX ...\n");
+  }
+
+#if 0
+  if (new_tilesize_var != TILESIZE_VAR &&
+      gfx_game_mode == GAME_MODE_PLAYING)
+  {
+    /* doing this outside GAME_MODE_PLAYING would give wrong playfield size */
+
+    TILESIZE_VAR = new_tilesize_var;
+
+    init_gfx_buffers = TRUE;
+
+    // printf("::: tilesize: init_gfx_buffers\n");
+  }
+#endif
+
+  if (new_sx != SX ||
       new_sy != SY ||
-      vp_playfield->x != REAL_SX ||
-      vp_playfield->y != REAL_SY ||
+      new_sxsize != SXSIZE ||
+      new_sysize != SYSIZE ||
+      new_real_sx != REAL_SX ||
+      new_real_sy != REAL_SY ||
+      new_full_sxsize != FULL_SXSIZE ||
+      new_full_sysize != FULL_SYSIZE ||
+      new_tilesize_var != TILESIZE_VAR ||
       vp_door_1->x != *door_1_x ||
       vp_door_1->y != *door_1_y ||
       vp_door_2->x != *door_2_x ||
       vp_door_2->y != *door_2_y)
   {
-    SCR_FIELDX = new_scr_fieldx;
-    SCR_FIELDY = new_scr_fieldy;
     SX = new_sx;
     SY = new_sy;
-    REAL_SX = vp_playfield->x;
-    REAL_SY = vp_playfield->y;
-
     SXSIZE = new_sxsize;
     SYSIZE = new_sysize;
-    FULL_SXSIZE = vp_playfield->width;
-    FULL_SYSIZE = vp_playfield->width;
+    REAL_SX = new_real_sx;
+    REAL_SY = new_real_sy;
+    FULL_SXSIZE = new_full_sxsize;
+    FULL_SYSIZE = new_full_sysize;
+    TILESIZE_VAR = new_tilesize_var;
+
+#if 0
+    printf("::: %d, %d, %d [%d]\n",
+          SCR_FIELDX, SCR_FIELDY, TILESIZE_VAR,
+          setup.small_game_graphics);
+#endif
 
     *door_1_x = vp_door_1->x;
     *door_1_y = vp_door_1->y;
     *door_2_x = vp_door_2->x;
     *door_2_y = vp_door_2->y;
 
+#if 1
+    init_gfx_buffers = TRUE;
+
+    // printf("::: viewports: init_gfx_buffers\n");
+#else
     InitGfxBuffers();
+#endif
 
     if (gfx_game_mode == GAME_MODE_MAIN)
     {
+#if 1
+      init_gadgets_and_toons = TRUE;
+
+      // printf("::: viewports: init_gadgets_and_toons\n");
+#else
       InitGadgets();
       InitToons();
+#endif
     }
   }
 
+  if (init_gfx_buffers)
+  {
+    // printf("::: init_gfx_buffers\n");
+
+    SCR_FIELDX = new_scr_fieldx_buffers;
+    SCR_FIELDY = new_scr_fieldy_buffers;
+
+    InitGfxBuffers();
+
+    SCR_FIELDX = new_scr_fieldx;
+    SCR_FIELDY = new_scr_fieldy;
+  }
+
+  if (init_video_buffer)
+  {
+    // printf("::: init_video_buffer\n");
+
+    InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
+
+    SetDrawDeactivationMask(REDRAW_NONE);
+    SetDrawBackgroundMask(REDRAW_FIELD);
+  }
+
+  if (init_gadgets_and_toons)
+  {
+    // printf("::: init_gadgets_and_toons\n");
+
+    InitGadgets();
+    InitToons();
+  }
+
 #if 0
   printf("::: %d, %d  /  %d, %d [%d]\n", VX, VY, EX, EY, game_status);
 #endif