rnd-20070425-1-src
authorHolger Schemel <info@artsoft.org>
Wed, 25 Apr 2007 21:35:54 +0000 (23:35 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:55:44 +0000 (10:55 +0200)
14 files changed:
Makefile
src/Makefile
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/game.h
src/game_em/graphics.c
src/libgame/misc.c
src/libgame/misc.h
src/libgame/sound.c
src/libgame/system.h
src/main.h
src/screens.c
src/tools.c

index 7e91482df7e3f66286206c7a806fe3c110068e56..a7a30e7d962bd053071f0a794fbfae45dacba7ba 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -91,6 +91,10 @@ cross-msdos:
 cross-win32:
        @PATH=$(CROSS_PATH_WIN32)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-win32
 
+cross-win32-jue:
+       @PATH=$(CROSS_PATH_WIN32)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-win32 \
+                                                         SPECIAL_ICON=jue
+
 clean:
        @$(MAKE_CMD) clean
 
index d13e68bc6ba84e18ad78d1875428c02acfaabbd1..8d8df9422341556b7b0d5c2ce7a059ed7a01bba2 100644 (file)
@@ -214,7 +214,12 @@ RNDLIBS = $(LIBGAME) $(GAME_EM)
 
 ICONBASE = windows_icon
 ifeq ($(PLATFORM),cross-win32)
-ICON32X32 = ../graphics/$(ICONBASE)_32x32.bmp
+ifdef SPECIAL_ICON
+ICONSUFFIX = 32x32_$(SPECIAL_ICON)
+else
+ICONSUFFIX = 32x32
+endif
+ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp
 ICON = $(ICONBASE).o
 endif
 
index a94e34611f8d8337e55f9f4144ed9341619f56ff..0ea0ef868408cd73fe33bd34780db2a202fc8bd9 100644 (file)
@@ -6315,6 +6315,8 @@ struct ConfigInfo image_config[] =
 
   { "game.forced_scroll_delay_value",          "-1"                    },
 
+  { "game.use_native_emc_graphics_engine",     "false"                 },
+
   { "[player].boring_delay_fixed",             "1000"                  },
   { "[player].boring_delay_random",            "1000"                  },
   { "[player].sleeping_delay_fixed",           "2000"                  },
index 5766be74e8c2884765e9853bc926cb20a4b2beff..dbe6c460941538541bcde19f39d34b026cb40cfc 100644 (file)
@@ -4948,6 +4948,10 @@ struct TokenIntPtrInfo image_config_vars[] =
     "game.forced_scroll_delay_value",
     &game.forced_scroll_delay_value
   },
+  {
+    "game.use_native_emc_graphics_engine",
+    &game.use_native_emc_graphics_engine
+  },
   {
     "[player].boring_delay_fixed",
     &game.player_boring_delay_fixed
index 8935086cd02f9cd5953bdf84f8b85c9bdb2fdb9e..6b7e2e5433e01910c4b88089ce12433a3602bc77 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-04-24 02:01"
+#define COMPILE_DATE_STRING "2007-04-25 23:33"
index 05aa8300d66d5e458534add29d466677933eff82..d68147085c70fd0a9110834513e54513c443fb1b 100644 (file)
@@ -115,6 +115,7 @@ struct GameInfo
   struct GameButtonInfo button;
 
   /* values for graphics engine customization */
+  boolean use_native_emc_graphics_engine;
   int forced_scroll_delay_value;
   int scroll_delay_value;
 
index 3ffdb105fac7762d855a2b81ca7640589d199b65..f33d4db800e610b6f53ead1bb26fd9aee8d6f261 100644 (file)
@@ -144,17 +144,31 @@ void blitscreen(void)
   BackToFront_EM();
 }
 
-static void DrawLevelField_EM(int x, int y, int sx, int sy,
-                             boolean draw_masked)
+static struct GraphicInfo_EM *getObjectGraphic(int x, int y)
 {
   int tile = Draw[y][x];
   struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
 
-#if USE_EXTENDED_GRAPHICS_ENGINE
-  getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y,
-                              x - 2, y - 2);
-#endif
+  if (!game.use_native_emc_graphics_engine)
+    getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y,
+                                x - 2, y - 2);
+  return g;
+}
+
+static struct GraphicInfo_EM *getPlayerGraphic(int player_nr, int anim)
+{
+  struct GraphicInfo_EM *g = &graphic_info_em_player[player_nr][anim][frame];
 
+  if (!game.use_native_emc_graphics_engine)
+    getGraphicSourcePlayerExt_EM(player_nr, anim, frame,
+                                &g->bitmap, &g->src_x, &g->src_y);
+  return g;
+}
+
+static void DrawLevelField_EM(int x, int y, int sx, int sy,
+                             boolean draw_masked)
+{
+  struct GraphicInfo_EM *g = getObjectGraphic(x, y);
   int src_x = g->src_x + g->src_offset_x;
   int src_y = g->src_y + g->src_offset_y;
   int dst_x = sx * TILEX + g->dst_offset_x;
@@ -193,14 +207,7 @@ static void DrawLevelField_EM(int x, int y, int sx, int sy,
 static void DrawLevelFieldCrumbled_EM(int x, int y, int sx, int sy,
                                      int crm, boolean draw_masked)
 {
-  int tile = Draw[y][x];
-  struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
-
-#if USE_EXTENDED_GRAPHICS_ENGINE
-  getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y,
-                              x - 2, y - 2);
-#endif
-
+  struct GraphicInfo_EM *g = getObjectGraphic(x, y);
   int left = screen_x / TILEX;
   int top  = screen_y / TILEY;
   int i;
@@ -259,13 +266,7 @@ static void DrawLevelFieldCrumbled_EM(int x, int y, int sx, int sy,
 static void DrawLevelPlayer_EM(int x1, int y1, int player_nr, int anim,
                               boolean draw_masked)
 {
-  struct GraphicInfo_EM *g = &graphic_info_em_player[player_nr][anim][frame];
-
-#if USE_EXTENDED_GRAPHICS_ENGINE
-  getGraphicSourcePlayerExt_EM(player_nr, anim, frame,
-                              &g->bitmap, &g->src_x, &g->src_y);
-#endif
-
+  struct GraphicInfo_EM *g = getPlayerGraphic(player_nr, anim);
   int src_x = g->src_x, src_y = g->src_y;
   int dst_x, dst_y;
 
@@ -343,11 +344,10 @@ static void animscreen(void)
     { 0, +1 }
   };
 
-#if USE_EXTENDED_GRAPHICS_ENGINE
-  for (y = 2; y < EM_MAX_CAVE_HEIGHT - 2; y++)
-    for (x = 2; x < EM_MAX_CAVE_WIDTH - 2; x++)
-      SetGfxAnimation_EM(Draw[y][x], frame, x - 2, y - 2);
-#endif
+  if (!game.use_native_emc_graphics_engine)
+    for (y = 2; y < EM_MAX_CAVE_HEIGHT - 2; y++)
+      for (x = 2; x < EM_MAX_CAVE_WIDTH - 2; x++)
+       SetGfxAnimation_EM(Draw[y][x], frame, x - 2, y - 2);
 
   for (y = top; y < top + MAX_BUF_YSIZE; y++)
   {
@@ -359,6 +359,7 @@ static void animscreen(void)
       struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
       int obj = g->unique_identifier;
       int crm = 0;
+      boolean redraw_screen_tile = FALSE;
 
       /* re-calculate crumbled state of this tile */
       if (g->has_crumbled_graphics)
@@ -380,12 +381,15 @@ static void animscreen(void)
        }
       }
 
+      redraw_screen_tile = (screentiles[sy][sx]    != obj ||
+                           crumbled_state[sy][sx] != crm);
+
+      /* !!! TEST ONLY -- CHANGE THIS !!! */
+      if (!game.use_native_emc_graphics_engine)
+       redraw_screen_tile = TRUE;
+
       /* only redraw screen tiles if they (or their crumbled state) changed */
-#if USE_EXTENDED_GRAPHICS_ENGINE
-      // if (screentiles[sy][sx] != obj || crumbled_state[sy][sx] != crm)
-#else
-      if (screentiles[sy][sx] != obj || crumbled_state[sy][sx] != crm)
-#endif
+      if (redraw_screen_tile)
       {
        DrawLevelField_EM(x, y, sx, sy, FALSE);
        DrawLevelFieldCrumbled_EM(x, y, sx, sy, crm, FALSE);
index cfee3b2de339d5a5eb4029605b6fd8074e0e6fd1..f94cc376097e2e040d790c43c784c34bb0d524ae 100644 (file)
@@ -950,6 +950,19 @@ void checked_free(void *ptr)
     free(ptr);
 }
 
+void clear_mem(void *ptr, unsigned long size)
+{
+#if defined(PLATFORM_WIN32)
+  /* for unknown reason, memset() sometimes crashes when compiled with MinGW */
+  char *cptr = (char *)ptr;
+
+  while (size--)
+    *cptr++ = 0;
+#else
+  memset(ptr, 0, size);
+#endif
+}
+
 
 /* ------------------------------------------------------------------------- */
 /* various helper functions                                                  */
index 3d011184260d5e65b87b9cc1371154246c92028a..36544b4d8f8f521844d4016b4013bfe8af92bcc0 100644 (file)
@@ -121,6 +121,7 @@ void *checked_malloc(unsigned long);
 void *checked_calloc(unsigned long);
 void *checked_realloc(void *, unsigned long);
 void checked_free(void *);
+void clear_mem(void *, unsigned long);
 
 void swap_numbers(int *, int *);
 void swap_number_pairs(int *, int *, int *, int *);
index 51b62efc7a5572a24176b56f31f2a8d0d1eaadcd..c10575b8660625bd4182b62fccaee55a309c3481 100644 (file)
@@ -2110,7 +2110,7 @@ void PlaySoundExt(int nr, int volume, int stereo_position, int state)
   else if (stereo_position > SOUND_MAX_RIGHT)
     stereo_position = SOUND_MAX_RIGHT;
 
-  memset(&snd_ctrl, 0, sizeof(SoundControl));  /* to make valgrind happy */
+  clear_mem(&snd_ctrl, sizeof(SoundControl));  /* to make valgrind happy */
 
   snd_ctrl.active = TRUE;
   snd_ctrl.nr = nr;
index 32da6cc16f1b826998d44d1ee15f53c7aa699368..4d3ca648fa922399bd8063eac8e7614504874305 100644 (file)
@@ -48,8 +48,8 @@
 #define FULLSCREEN_NOT_AVAILABLE       FALSE
 #define FULLSCREEN_AVAILABLE           TRUE
 
-#define CREATE_SPECIAL_EDITION         FALSE
-#define CREATE_SPECIAL_EDITION_RND_JUE FALSE
+#define CREATE_SPECIAL_EDITION         TRUE
+#define CREATE_SPECIAL_EDITION_RND_JUE TRUE
 
 /* default input keys */
 #define DEFAULT_KEY_LEFT               KSYM_Left
index 550d93c6a82ac3847e1824f307817d3ca6c00ee9..223013de4c3590e120f09524b62b9fdd8c19fd6a 100644 (file)
 
 #if CREATE_SPECIAL_EDITION_RND_JUE
 #undef  PROGRAM_TITLE_STRING
-#define PROGRAM_TITLE_STRING           "Rocks'n'Diamonds - Version Jue"
+#define PROGRAM_TITLE_STRING           "R'n'D - Version Jue"
 #undef  PROGRAM_UNIX_DATADIR_STRING
 #define PROGRAM_UNIX_DATADIR_STRING    ".rocksndiamonds-jue"
 #endif
index 4784307b3fcf6c52471b696b4d689a282eeb2c6e..527fbd055ac26f701447e875973bb3fc041bd239 100644 (file)
@@ -1316,7 +1316,8 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
 
   FadeSetLeaveScreen();
 
-#if 1
+  /* (does not work well when changing to editor, which fades out itself) */
+#if 0
   FadeOut(redraw_mask);
 #endif
 
@@ -1342,6 +1343,10 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
     return;
   }
 
+#if 1
+  FadeOut(redraw_mask);
+#endif
+
   /* needed if last screen was the editor screen */
   UndrawSpecialEditorDoor();
 
index 66b11c62b4b89353b9682a1894b4f5e0c1bfb2dc..014ae9ce04297cce285466cf91b71c21c77ad9b4 100644 (file)
@@ -6078,7 +6078,9 @@ void ResetGfxAnimation_EM(int x, int y, int tile)
 
 void SetGfxAnimation_EM(int tile, int frame_em, int x, int y)
 {
+#if 0
   int element         = object_mapping[tile].element_rnd;
+#endif
   int action          = object_mapping[tile].action;
   int direction       = object_mapping[tile].direction;
   boolean is_backside = object_mapping[tile].is_backside;