rnd-20030902-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 1 Sep 2003 23:37:11 +0000 (01:37 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:43:37 +0000 (10:43 +0200)
15 files changed:
CHANGES
src/conf_fnt.c
src/conf_gfx.c
src/conf_gfx.h
src/conftime.h
src/editor.c
src/files.c
src/game.c
src/libgame/system.h
src/libgame/text.c
src/main.c
src/main.h
src/screens.c
src/tools.c
src/tools.h

diff --git a/CHANGES b/CHANGES
index 9ee229b4068192546b86a3161a5e8c1a3a769c70..e57b06e90501acaaa2f81ca365ec39209c4b8e77 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,7 @@ Release Version 3.0.3 [?? ??? ????]
        - fixed bug (missing array boundary check) which could crash the game
        - fixed problem with setting mouse cursor in SDL version in fullscreen
        - fixed problem with flickering when drawing toon animations
+       - fixed problem with player animation when snapping and moving
 
 Release Version 3.0.2 [22 AUG 2003]
 -----------------------------------
index 0a191dda15f257a76f19a1f25fb52e882c988d34..ef44d5383c5bc8d4c9bf4611ce53264338907131 100644 (file)
@@ -75,6 +75,10 @@ font_to_graphic[] =
     FONT_TEXT_1,                               GFX_SPECIAL_ARG_PREVIEW,
     IMG_FONT_TEXT_1_PREVIEW
   },
+  {
+    FONT_TEXT_1,                               GFX_SPECIAL_ARG_PLAYING,
+    IMG_FONT_TEXT_1_PLAYING
+  },
   {
     FONT_TEXT_1,                               GFX_SPECIAL_ARG_SCORES,
     IMG_FONT_TEXT_1_SCORES
index 258b7fde0750671b85b9d325a81940bade85311d..3bd3223f096da4b3e149e708c5e4cd29b7a89e50 100644 (file)
@@ -3263,6 +3263,11 @@ struct ConfigInfo image_config[] =
   { "font.text_1.PREVIEW.y",                   "160"                   },
   { "font.text_1.PREVIEW.width",               "16"                    },
   { "font.text_1.PREVIEW.height",              "16"                    },
+  { "font.text_1.PLAYING",                     "RocksFontEM.pcx"       },
+  { "font.text_1.PLAYING.x",                   "0"                     },
+  { "font.text_1.PLAYING.y",                   "160"                   },
+  { "font.text_1.PLAYING.width",               "16"                    },
+  { "font.text_1.PLAYING.height",              "16"                    },
   { "font.text_1.SCORES",                      "RocksFontMedium.pcx"   },
   { "font.text_1.SCORES.x",                    "0"                     },
   { "font.text_1.SCORES.y",                    "480"                   },
index 41fe2b22700ff03e067fa8cc47790449c846d233..71edd97e3339fbdeca4999c96fa96693f06b1f8b 100644 (file)
 #define IMG_FONT_TEXT_1                                        1227
 #define IMG_FONT_TEXT_1_LEVELS                         1228
 #define IMG_FONT_TEXT_1_PREVIEW                                1229
-#define IMG_FONT_TEXT_1_SCORES                         1230
-#define IMG_FONT_TEXT_1_ACTIVE_SCORES                  1231
-#define IMG_FONT_TEXT_2                                        1232
-#define IMG_FONT_TEXT_2_LEVELS                         1233
-#define IMG_FONT_TEXT_2_PREVIEW                                1234
-#define IMG_FONT_TEXT_2_SCORES                         1235
-#define IMG_FONT_TEXT_2_ACTIVE_SCORES                  1236
-#define IMG_FONT_TEXT_3                                        1237
-#define IMG_FONT_TEXT_3_LEVELS                         1238
-#define IMG_FONT_TEXT_3_PREVIEW                                1239
-#define IMG_FONT_TEXT_3_SCORES                         1240
-#define IMG_FONT_TEXT_3_ACTIVE_SCORES                  1241
-#define IMG_FONT_TEXT_4                                        1242
-#define IMG_FONT_TEXT_4_LEVELS                         1243
-#define IMG_FONT_TEXT_4_SCORES                         1244
-#define IMG_FONT_TEXT_4_ACTIVE_SCORES                  1245
-#define IMG_FONT_INPUT_1                               1246
-#define IMG_FONT_INPUT_1_MAIN                          1247
-#define IMG_FONT_INPUT_1_ACTIVE                                1248
-#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   1249
-#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  1250
-#define IMG_FONT_INPUT_2                               1251
-#define IMG_FONT_INPUT_2_ACTIVE                                1252
-#define IMG_FONT_OPTION_OFF                            1253
-#define IMG_FONT_OPTION_ON                             1254
-#define IMG_FONT_VALUE_1                               1255
-#define IMG_FONT_VALUE_2                               1256
-#define IMG_FONT_VALUE_OLD                             1257
-#define IMG_FONT_LEVEL_NUMBER                          1258
-#define IMG_FONT_TAPE_RECORDER                         1259
-#define IMG_FONT_GAME_INFO                             1260
-#define IMG_GLOBAL_BORDER                              1261
-#define IMG_GLOBAL_DOOR                                        1262
-#define IMG_EDITOR_ELEMENT_BORDER                      1263
-#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        1264
-#define IMG_BACKGROUND                                 1265
-#define IMG_BACKGROUND_MAIN                            1266
-#define IMG_BACKGROUND_LEVELS                          1267
-#define IMG_BACKGROUND_SCORES                          1268
-#define IMG_BACKGROUND_EDITOR                          1269
-#define IMG_BACKGROUND_INFO                            1270
-#define IMG_BACKGROUND_SETUP                           1271
-#define IMG_BACKGROUND_DOOR                            1272
+#define IMG_FONT_TEXT_1_PLAYING                                1230
+#define IMG_FONT_TEXT_1_SCORES                         1231
+#define IMG_FONT_TEXT_1_ACTIVE_SCORES                  1232
+#define IMG_FONT_TEXT_2                                        1233
+#define IMG_FONT_TEXT_2_LEVELS                         1234
+#define IMG_FONT_TEXT_2_PREVIEW                                1235
+#define IMG_FONT_TEXT_2_SCORES                         1236
+#define IMG_FONT_TEXT_2_ACTIVE_SCORES                  1237
+#define IMG_FONT_TEXT_3                                        1238
+#define IMG_FONT_TEXT_3_LEVELS                         1239
+#define IMG_FONT_TEXT_3_PREVIEW                                1240
+#define IMG_FONT_TEXT_3_SCORES                         1241
+#define IMG_FONT_TEXT_3_ACTIVE_SCORES                  1242
+#define IMG_FONT_TEXT_4                                        1243
+#define IMG_FONT_TEXT_4_LEVELS                         1244
+#define IMG_FONT_TEXT_4_SCORES                         1245
+#define IMG_FONT_TEXT_4_ACTIVE_SCORES                  1246
+#define IMG_FONT_INPUT_1                               1247
+#define IMG_FONT_INPUT_1_MAIN                          1248
+#define IMG_FONT_INPUT_1_ACTIVE                                1249
+#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   1250
+#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  1251
+#define IMG_FONT_INPUT_2                               1252
+#define IMG_FONT_INPUT_2_ACTIVE                                1253
+#define IMG_FONT_OPTION_OFF                            1254
+#define IMG_FONT_OPTION_ON                             1255
+#define IMG_FONT_VALUE_1                               1256
+#define IMG_FONT_VALUE_2                               1257
+#define IMG_FONT_VALUE_OLD                             1258
+#define IMG_FONT_LEVEL_NUMBER                          1259
+#define IMG_FONT_TAPE_RECORDER                         1260
+#define IMG_FONT_GAME_INFO                             1261
+#define IMG_GLOBAL_BORDER                              1262
+#define IMG_GLOBAL_DOOR                                        1263
+#define IMG_EDITOR_ELEMENT_BORDER                      1264
+#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        1265
+#define IMG_BACKGROUND                                 1266
+#define IMG_BACKGROUND_MAIN                            1267
+#define IMG_BACKGROUND_LEVELS                          1268
+#define IMG_BACKGROUND_SCORES                          1269
+#define IMG_BACKGROUND_EDITOR                          1270
+#define IMG_BACKGROUND_INFO                            1271
+#define IMG_BACKGROUND_SETUP                           1272
+#define IMG_BACKGROUND_DOOR                            1273
 
-#define NUM_IMAGE_FILES                                        1273
+#define NUM_IMAGE_FILES                                        1274
 
 #endif /* CONF_GFX_H */
index d69a3b08771cdf049858467f3319cb98d82216f1..e8d827758ad31ff0789124fa1fa1bc3e4d8986a2 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-09-01 19:13]"
+#define COMPILE_DATE_STRING "[2003-09-01 23:03]"
index 12053e073e7d9f6745413d40669c627a036cb20b..636e21dc3297ee15e67979aba4072c06a2c8f9d3 100644 (file)
@@ -1867,7 +1867,7 @@ static int edit_mode_properties;
 
 static int element_shift = 0;
 
-static int editor_el_boulderdash[] =
+static int editor_hl_boulderdash[] =
 {
   EL_CHAR('B'),
   EL_CHAR('O'),
@@ -1883,7 +1883,10 @@ static int editor_el_boulderdash[] =
   EL_CHAR('A'),
   EL_CHAR('S'),
   EL_CHAR('H'),
+};
 
+static int editor_el_boulderdash[] =
+{
   EL_PLAYER_1,
   EL_EMPTY,
   EL_SAND,
@@ -1909,9 +1912,10 @@ static int editor_el_boulderdash[] =
   EL_BD_FIREFLY_DOWN,
   EL_EMPTY,
 };
+static int num_editor_hl_boulderdash = SIZEOF_ARRAY_INT(editor_hl_boulderdash);
 static int num_editor_el_boulderdash = SIZEOF_ARRAY_INT(editor_el_boulderdash);
 
-static int editor_el_emerald_mine[] =
+static int editor_hl_emerald_mine[] =
 {
   EL_CHAR('E'),
   EL_CHAR('M'),
@@ -1927,7 +1931,10 @@ static int editor_el_emerald_mine[] =
   EL_CHAR('I'),
   EL_CHAR('N'),
   EL_CHAR('E'),
+};
 
+static int editor_el_emerald_mine[] =
+{
   EL_PLAYER_1,
   EL_PLAYER_2,
   EL_PLAYER_3,
@@ -2003,15 +2010,19 @@ static int editor_el_emerald_mine[] =
   EL_EM_GATE_3_GRAY,
   EL_EM_GATE_4_GRAY,
 };
-static int num_editor_el_emerald_mine = SIZEOF_ARRAY_INT(editor_el_emerald_mine);
+static int num_editor_hl_emerald_mine=SIZEOF_ARRAY_INT(editor_hl_emerald_mine);
+static int num_editor_el_emerald_mine=SIZEOF_ARRAY_INT(editor_el_emerald_mine);
 
-static int editor_el_more[] =
+static int editor_hl_more[] =
 {
   EL_CHAR('M'),
   EL_CHAR('O'),
   EL_CHAR('R'),
   EL_CHAR('E'),
+};
 
+static int editor_el_more[] =
+{
   EL_KEY_1,
   EL_KEY_2,
   EL_KEY_3,
@@ -2107,9 +2118,10 @@ static int editor_el_more[] =
   EL_EMC_WALL_6,
   EL_EMC_WALL_7,
 };
+static int num_editor_hl_more = SIZEOF_ARRAY_INT(editor_hl_more);
 static int num_editor_el_more = SIZEOF_ARRAY_INT(editor_el_more);
 
-static int editor_el_sokoban[] =
+static int editor_hl_sokoban[] =
 {
   EL_CHAR('S'),
   EL_CHAR('O'),
@@ -2120,15 +2132,19 @@ static int editor_el_sokoban[] =
   EL_CHAR('B'),
   EL_CHAR('A'),
   EL_CHAR('N'),
+};
 
+static int editor_el_sokoban[] =
+{
   EL_SOKOBAN_OBJECT,
   EL_SOKOBAN_FIELD_EMPTY,
   EL_SOKOBAN_FIELD_FULL,
   EL_STEELWALL,
 };
+static int num_editor_hl_sokoban = SIZEOF_ARRAY_INT(editor_hl_sokoban);
 static int num_editor_el_sokoban = SIZEOF_ARRAY_INT(editor_el_sokoban);
 
-static int editor_el_supaplex[] =
+static int editor_hl_supaplex[] =
 {
   EL_CHAR('S'),
   EL_CHAR('U'),
@@ -2139,7 +2155,10 @@ static int editor_el_supaplex[] =
   EL_CHAR('L'),
   EL_CHAR('E'),
   EL_CHAR('X'),
+};
 
+static int editor_el_supaplex[] =
+{
   EL_SP_EMPTY,
   EL_SP_ZONK,
   EL_SP_BASE,
@@ -2190,9 +2209,10 @@ static int editor_el_supaplex[] =
   EL_SP_CHIP_TOP,
   EL_SP_CHIP_BOTTOM,
 };
+static int num_editor_hl_supaplex = SIZEOF_ARRAY_INT(editor_hl_supaplex);
 static int num_editor_el_supaplex = SIZEOF_ARRAY_INT(editor_el_supaplex);
 
-static int editor_el_diamond_caves[] =
+static int editor_hl_diamond_caves[] =
 {
   EL_CHAR('D'),
   EL_CHAR('I'),
@@ -2213,7 +2233,10 @@ static int editor_el_diamond_caves[] =
   EL_CHAR(' '),
   EL_CHAR('I'),
   EL_CHAR('I'),
+};
 
+static int editor_el_diamond_caves[] =
+{
   EL_PEARL,
   EL_CRYSTAL,
   EL_WALL_PEARL,
@@ -2274,9 +2297,10 @@ static int editor_el_diamond_caves[] =
   EL_EXTRA_TIME,
   EL_EMPTY,
 };
+static int num_editor_hl_diamond_caves = SIZEOF_ARRAY_INT(editor_hl_diamond_caves);
 static int num_editor_el_diamond_caves = SIZEOF_ARRAY_INT(editor_el_diamond_caves);
 
-static int editor_el_dx_boulderdash[] =
+static int editor_hl_dx_boulderdash[] =
 {
   EL_CHAR('D'),
   EL_CHAR('X'),
@@ -2297,7 +2321,10 @@ static int editor_el_dx_boulderdash[] =
   EL_CHAR('A'),
   EL_CHAR('S'),
   EL_CHAR('H'),
+};
 
+static int editor_el_dx_boulderdash[] =
+{
   EL_SPRING,
   EL_TUBE_RIGHT_DOWN,
   EL_TUBE_HORIZONTAL_DOWN,
@@ -2318,15 +2345,19 @@ static int editor_el_dx_boulderdash[] =
   EL_EMPTY,
   EL_EMPTY
 };
+static int num_editor_hl_dx_boulderdash = SIZEOF_ARRAY_INT(editor_hl_dx_boulderdash);
 static int num_editor_el_dx_boulderdash = SIZEOF_ARRAY_INT(editor_el_dx_boulderdash);
 
-static int editor_el_chars[] =
+static int editor_hl_chars[] =
 {
   EL_CHAR('T'),
   EL_CHAR('E'),
   EL_CHAR('X'),
   EL_CHAR('T'),
+};
 
+static int editor_el_chars[] =
+{
   EL_CHAR(' '),
   EL_CHAR('!'),
   EL_CHAR('"'),
@@ -2417,9 +2448,10 @@ static int editor_el_chars[] =
   EL_CHAR(FONT_ASCII_CURSOR),
   EL_CHAR(' ')
 };
+static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars);
 static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars);
 
-static int editor_el_custom[] =
+static int editor_hl_custom[] =
 {
   EL_CHAR('C'),
   EL_CHAR('U'),
@@ -2440,7 +2472,10 @@ static int editor_el_custom[] =
   EL_CHAR('N'),
   EL_CHAR('T'),
   EL_CHAR('S'),
+};
 
+static int editor_el_custom[] =
+{
   EL_CUSTOM_START + 0,
   EL_CUSTOM_START + 1,
   EL_CUSTOM_START + 2,
@@ -2601,8 +2636,13 @@ static int editor_el_custom[] =
   EL_CUSTOM_START + 126,
   EL_CUSTOM_START + 127
 };
+static int num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom);
 static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
 
+static int editor_hl_custom_more[] =
+{
+};
+
 static int editor_el_custom_more[] =
 {
   EL_CUSTOM_START + 128,
@@ -2765,6 +2805,7 @@ static int editor_el_custom_more[] =
   EL_CUSTOM_START + 254,
   EL_CUSTOM_START + 255
 };
+static int num_editor_hl_custom_more = SIZEOF_ARRAY_INT(editor_hl_custom_more);
 static int num_editor_el_custom_more = SIZEOF_ARRAY_INT(editor_el_custom_more);
 
 static int *editor_elements = NULL;    /* dynamically allocated */
@@ -2773,6 +2814,10 @@ static int num_editor_elements = 0;      /* dynamically determined */
 static struct
 {
   boolean *setup_value;
+
+  int *headline_list;
+  int *headline_list_size;
+
   int *element_list;
   int *element_list_size;
 
@@ -2780,28 +2825,61 @@ static struct
 }
 editor_elements_info[] =
 {
-  { &setup.editor.el_boulderdash,      editor_el_boulderdash,
-    &num_editor_el_boulderdash                                         },
-  { &setup.editor.el_emerald_mine,     editor_el_emerald_mine,
-    &num_editor_el_emerald_mine                                                },
-  { &setup.editor.el_more,             editor_el_more,
-    &num_editor_el_more                                                        },
-  { &setup.editor.el_sokoban,          editor_el_sokoban,
-    &num_editor_el_sokoban                                             },
-  { &setup.editor.el_supaplex,         editor_el_supaplex,
-    &num_editor_el_supaplex                                            },
-  { &setup.editor.el_diamond_caves,    editor_el_diamond_caves,
-    &num_editor_el_diamond_caves                                       },
-  { &setup.editor.el_dx_boulderdash,   editor_el_dx_boulderdash,
-    &num_editor_el_dx_boulderdash                                      },
-  { &setup.editor.el_chars,            editor_el_chars,
-    &num_editor_el_chars                                               },
-  { &setup.editor.el_custom,           editor_el_custom,
-    &num_editor_el_custom                                              },
-  { &setup.editor.el_custom_more,      editor_el_custom_more,
-    &num_editor_el_custom_more                                         },
-  { NULL,                              NULL,
-    NULL                                                               }
+  {
+    &setup.editor.el_boulderdash,
+    editor_hl_boulderdash,             &num_editor_hl_boulderdash,
+    editor_el_boulderdash,             &num_editor_el_boulderdash
+  },
+  {
+    &setup.editor.el_emerald_mine,
+    editor_hl_emerald_mine,            &num_editor_hl_emerald_mine,
+    editor_el_emerald_mine,            &num_editor_el_emerald_mine
+  },
+  {
+    &setup.editor.el_more,
+    editor_hl_more,                    &num_editor_hl_more,
+    editor_el_more,                    &num_editor_el_more
+  },
+  {
+    &setup.editor.el_sokoban,
+    editor_hl_sokoban,                 &num_editor_hl_sokoban,
+    editor_el_sokoban,                 &num_editor_el_sokoban
+  },
+  {
+    &setup.editor.el_supaplex,
+    editor_hl_supaplex,                        &num_editor_hl_supaplex,
+    editor_el_supaplex,                        &num_editor_el_supaplex
+  },
+  {
+    &setup.editor.el_diamond_caves,
+    editor_hl_diamond_caves,           &num_editor_hl_diamond_caves,
+    editor_el_diamond_caves,           &num_editor_el_diamond_caves
+  },
+  {
+    &setup.editor.el_dx_boulderdash,
+    editor_hl_dx_boulderdash,          &num_editor_hl_dx_boulderdash,
+    editor_el_dx_boulderdash,          &num_editor_el_dx_boulderdash
+  },
+  {
+    &setup.editor.el_chars,
+    editor_hl_chars,                   &num_editor_hl_chars,
+    editor_el_chars,                   &num_editor_el_chars
+  },
+  {
+    &setup.editor.el_custom,
+    editor_hl_custom,                  &num_editor_hl_custom,
+    editor_el_custom,                  &num_editor_el_custom
+  },
+  {
+    &setup.editor.el_custom_more,
+    editor_hl_custom_more,             &num_editor_hl_custom_more,
+    editor_el_custom_more,             &num_editor_el_custom_more
+  },
+  {
+    NULL,
+    NULL,                              NULL,
+    NULL,                              NULL
+  }
 };
 
 
@@ -2823,8 +2901,15 @@ static void ReinitializeElementList()
 
   /* determine size of element list */
   for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+  {
     if (*editor_elements_info[i].setup_value)
+    {
+      if (setup.editor.el_headlines)
+       num_editor_elements += *editor_elements_info[i].headline_list_size;
+
       num_editor_elements += *editor_elements_info[i].element_list_size;
+    }
+  }
 
   if (num_editor_elements < ED_NUM_ELEMENTLIST_BUTTONS)
   {
@@ -2839,9 +2924,17 @@ static void ReinitializeElementList()
 
   /* fill element list */
   for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+  {
     if (*editor_elements_info[i].setup_value)
-      for (j=0; j<*editor_elements_info[i].element_list_size; j++)
+    {
+      if (setup.editor.el_headlines)
+       for (j=0; j < *editor_elements_info[i].headline_list_size; j++)
+         editor_elements[pos++] = editor_elements_info[i].headline_list[j];
+
+      for (j=0; j < *editor_elements_info[i].element_list_size; j++)
        editor_elements[pos++] = editor_elements_info[i].element_list[j];
+    }
+  }
 
   /* correct position of element list scrollbar */
   if (element_shift < 0)
@@ -2852,14 +2945,20 @@ static void ReinitializeElementList()
 
 static void ReinitializeElementListButtons()
 {
+  static boolean last_setup_value_headlines = FALSE;
   static boolean initialization_needed = TRUE;
   int i;
 
   if (!initialization_needed)  /* check if editor element setup has changed */
+  {
+    if (last_setup_value_headlines != setup.editor.el_headlines)
+      initialization_needed = TRUE;
+
     for (i=0; editor_elements_info[i].setup_value != NULL; i++)
       if (editor_elements_info[i].last_setup_value !=
          *editor_elements_info[i].setup_value)
        initialization_needed = TRUE;
+  }
 
   if (!initialization_needed)
     return;
@@ -2868,6 +2967,7 @@ static void ReinitializeElementListButtons()
   CreateLevelEditorGadgets();
 
   /* store current setup values for next invocation of this function */
+  last_setup_value_headlines = setup.editor.el_headlines;
   for (i=0; editor_elements_info[i].setup_value != NULL; i++)
     editor_elements_info[i].last_setup_value =
       *editor_elements_info[i].setup_value;
index db3a432d41aa3623ee0d26ac783343663f6f25c6..4ef0174af5d82563ac31646637060ea587327f72 100644 (file)
@@ -719,6 +719,170 @@ void LoadLevelFromFilename(struct LevelInfo *level, char *filename)
   fclose(file);
 }
 
+#if 1
+
+static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename)
+{
+  if (leveldir_current == NULL)                /* only when dumping level */
+    return;
+
+  /* determine correct game engine version of current level */
+  if (IS_LEVELCLASS_CONTRIBUTION(leveldir_current) ||
+      IS_LEVELCLASS_USER(leveldir_current))
+  {
+#if 0
+    printf("\n::: This level is private or contributed: '%s'\n", filename);
+#endif
+
+    /* For user contributed and private levels, use the version of
+       the game engine the levels were created for.
+       Since 2.0.1, the game engine version is now directly stored
+       in the level file (chunk "VERS"), so there is no need anymore
+       to set the game version from the file version (except for old,
+       pre-2.0 levels, where the game version is still taken from the
+       file format version used to store the level -- see above). */
+
+    /* do some special adjustments to support older level versions */
+    if (level->file_version == FILE_VERSION_1_0)
+    {
+      Error(ERR_WARN, "level file '%s'has version number 1.0", filename);
+      Error(ERR_WARN, "using high speed movement for player");
+
+      /* player was faster than monsters in (pre-)1.0 levels */
+      level->double_speed = TRUE;
+    }
+
+    /* Default behaviour for EM style gems was "slippery" only in 2.0.1 */
+    if (level->game_version == VERSION_IDENT(2,0,1))
+      level->em_slippery_gems = TRUE;
+  }
+  else
+  {
+#if 0
+    printf("\n::: ALWAYS USE LATEST ENGINE FOR THIS LEVEL: [%d] '%s'\n",
+          leveldir_current->sort_priority, filename);
+#endif
+
+    /* Always use the latest version of the game engine for all but
+       user contributed and private levels; this allows for actual
+       corrections in the game engine to take effect for existing,
+       converted levels (from "classic" or other existing games) to
+       make the game emulation more accurate, while (hopefully) not
+       breaking existing levels created from other players. */
+
+    level->game_version = GAME_VERSION_ACTUAL;
+
+    /* Set special EM style gems behaviour: EM style gems slip down from
+       normal, steel and growing wall. As this is a more fundamental change,
+       it seems better to set the default behaviour to "off" (as it is more
+       natural) and make it configurable in the level editor (as a property
+       of gem style elements). Already existing converted levels (neither
+       private nor contributed levels) are changed to the new behaviour. */
+
+    if (level->file_version < FILE_VERSION_2_0)
+      level->em_slippery_gems = TRUE;
+  }
+}
+
+static void LoadLevel_InitElements(struct LevelInfo *level, char *filename)
+{
+  int i, j;
+
+  /* map custom element change events that have changed in newer versions
+     (these following values have accidentally changed in version 3.0.1) */
+  if (level->game_version <= VERSION_IDENT(3,0,0))
+  {
+    for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+    {
+      int element = EL_CUSTOM_START + i;
+
+      /* order of checking events to be mapped is important */
+      for (j=CE_BY_OTHER; j >= CE_BY_PLAYER; j--)
+      {
+       if (HAS_CHANGE_EVENT(element, j - 2))
+       {
+         SET_CHANGE_EVENT(element, j - 2, FALSE);
+         SET_CHANGE_EVENT(element, j, TRUE);
+       }
+      }
+
+      /* order of checking events to be mapped is important */
+      for (j=CE_OTHER_GETS_COLLECTED; j >= CE_COLLISION; j--)
+      {
+       if (HAS_CHANGE_EVENT(element, j - 1))
+       {
+         SET_CHANGE_EVENT(element, j - 1, FALSE);
+         SET_CHANGE_EVENT(element, j, TRUE);
+       }
+      }
+    }
+  }
+
+  /* initialize "can_change" field for old levels with only one change page */
+  if (level->game_version <= VERSION_IDENT(3,0,2))
+  {
+    for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+    {
+      int element = EL_CUSTOM_START + i;
+
+      if (CAN_CHANGE(element))
+       element_info[element].change->can_change = TRUE;
+    }
+  }
+
+  /* initialize element properties for level editor etc. */
+  InitElementPropertiesEngine(level->game_version);
+}
+
+static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename)
+{
+  int x, y;
+
+  /* map elements that have changed in newer versions */
+  for(y=0; y<level->fieldy; y++)
+  {
+    for(x=0; x<level->fieldx; x++)
+    {
+      int element = level->field[x][y];
+
+      if (level->game_version <= VERSION_IDENT(2,2,0))
+      {
+       /* map game font elements */
+       element = (element == EL_CHAR('[')  ? EL_CHAR_AUMLAUT :
+                  element == EL_CHAR('\\') ? EL_CHAR_OUMLAUT :
+                  element == EL_CHAR(']')  ? EL_CHAR_UUMLAUT :
+                  element == EL_CHAR('^')  ? EL_CHAR_COPYRIGHT : element);
+      }
+
+      if (level->game_version < VERSION_IDENT(3,0,0))
+      {
+       /* map Supaplex gravity tube elements */
+       element = (element == EL_SP_GRAVITY_PORT_LEFT  ? EL_SP_PORT_LEFT  :
+                  element == EL_SP_GRAVITY_PORT_RIGHT ? EL_SP_PORT_RIGHT :
+                  element == EL_SP_GRAVITY_PORT_UP    ? EL_SP_PORT_UP    :
+                  element == EL_SP_GRAVITY_PORT_DOWN  ? EL_SP_PORT_DOWN  :
+                  element);
+      }
+
+      level->field[x][y] = element;
+    }
+  }
+
+  /* copy elements to runtime playfield array */
+  for(x=0; x<MAX_LEV_FIELDX; x++)
+    for(y=0; y<MAX_LEV_FIELDY; y++)
+      Feld[x][y] = level->field[x][y];
+
+  /* initialize level size variables for faster access */
+  lev_fieldx = level->fieldx;
+  lev_fieldy = level->fieldy;
+
+  /* determine border element for this level */
+  SetBorderElement();
+}
+
+#else
+
 static void LoadLevel_InitLevel(struct LevelInfo *level, char *filename)
 {
   int i, j, x, y;
@@ -871,12 +1035,17 @@ static void LoadLevel_InitLevel(struct LevelInfo *level, char *filename)
   InitElementPropertiesEngine(level->game_version);
 }
 
+#endif
+
 void LoadLevelTemplate(int level_nr)
 {
   char *filename = getLevelFilename(level_nr);
 
   LoadLevelFromFilename(&level_template, filename);
 
+  LoadLevel_InitVersion(&level, filename);
+  LoadLevel_InitElements(&level, filename);
+
   ActivateLevelTemplate();
 }
 
@@ -889,7 +1058,13 @@ void LoadLevel(int level_nr)
   if (level.use_custom_template)
     LoadLevelTemplate(-1);
 
+#if 1
+  LoadLevel_InitVersion(&level, filename);
+  LoadLevel_InitElements(&level, filename);
+  LoadLevel_InitPlayfield(&level, filename);
+#else
   LoadLevel_InitLevel(&level, filename);
+#endif
 }
 
 static void SaveLevel_VERS(FILE *file, struct LevelInfo *level)
@@ -1890,8 +2065,9 @@ void SaveScore(int level_nr)
 #define SETUP_TOKEN_EDITOR_EL_DX_BOULDERDASH   6
 #define SETUP_TOKEN_EDITOR_EL_CHARS            7
 #define SETUP_TOKEN_EDITOR_EL_CUSTOM           8
+#define SETUP_TOKEN_EDITOR_EL_HEADLINES                9
 
-#define NUM_EDITOR_SETUP_TOKENS                        9
+#define NUM_EDITOR_SETUP_TOKENS                        10
 
 /* shortcut setup */
 #define SETUP_TOKEN_SHORTCUT_SAVE_GAME         0
@@ -1977,6 +2153,7 @@ static struct TokenInfo editor_setup_tokens[] =
   { TYPE_SWITCH, &sei.el_chars,                "editor.el_chars"               },
   { TYPE_SWITCH, &sei.el_custom,       "editor.el_custom"              },
   { TYPE_SWITCH, &sei.el_custom_more,  "editor.el_custom_more"         },
+  { TYPE_SWITCH, &sei.el_headlines,    "editor.el_headlines"           },
 };
 
 static struct TokenInfo shortcut_setup_tokens[] =
@@ -2074,6 +2251,8 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->editor.el_custom = TRUE;
   si->editor.el_custom_more = FALSE;
 
+  si->editor.el_headlines = TRUE;
+
   si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME;
   si->shortcut.load_game = DEFAULT_KEY_LOAD_GAME;
   si->shortcut.toggle_pause = DEFAULT_KEY_TOGGLE_PAUSE;
index 0f2aff310c07a1e89555c6d5fa9be3a317eb6a66..91c8841ab9657c815e9cdb87359febc4adf9b0d7 100644 (file)
@@ -1989,6 +1989,75 @@ void CheckDynamite(int x, int y)
   Bang(x, y);
 }
 
+void ShowEnvelope()
+{
+  int i, x, y;
+
+  /* open envelope window horizontally */
+  for (i=2; i <= level.envelope_xsize + 2; i += 2)
+  {
+    int startx = (SXSIZE / MINI_TILEX - i) / 2;
+    int starty = (SYSIZE / MINI_TILEY) / 2 - 1;
+
+    SetDrawtoField(DRAW_BUFFERED);
+
+    BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+
+    SetDrawtoField(DRAW_BACKBUFFER);
+
+    for (y=0; y < 2; y++) for (x=0; x < i; x++)
+    {
+      int ex = (x == 0 ? -1 : x == i - 1 ? +1 : 0);
+      int ey = (y == 0 ? -1 : y == 1     ? +1 : 0);
+
+      DrawEnvelopeBorder(startx + x, starty + y, ex, ey);
+    }
+
+    redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
+    BackToFront();
+
+    Delay(GAME_FRAME_DELAY);
+  }
+
+  /* open envelope window vertically */
+  for (i=2; i <= level.envelope_ysize + 2; i += 2)
+  {
+    int xsize = level.envelope_xsize + 2;
+    int startx = (SXSIZE / MINI_TILEX - (xsize - 1)) / 2;
+    int starty = (SYSIZE / MINI_TILEY - i) / 2;
+
+    SetDrawtoField(DRAW_BUFFERED);
+
+    BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+
+    SetDrawtoField(DRAW_BACKBUFFER);
+
+    for (y=0; y < i; y++) for (x=0; x < xsize; x++)
+    {
+      int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0);
+      int ey = (y == 0 ? -1 : y == i - 1     ? +1 : 0);
+
+      DrawEnvelopeBorder(startx + x, starty + y, ex, ey);
+    }
+
+    DrawTextToTextArea(SX + (startx + 1) * MINI_TILEX,
+                      SY + (starty + 1) * MINI_TILEY, level.envelope,
+                      FONT_TEXT_1, level.envelope_xsize, i - 2);
+
+    redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
+    BackToFront();
+
+    Delay(GAME_FRAME_DELAY);
+  }
+
+  Delay(3000);
+
+  SetDrawtoField(DRAW_BUFFERED);
+
+  redraw_mask |= REDRAW_FIELD;
+  BackToFront();
+}
+
 void RelocatePlayer(int x, int y, int element)
 {
   struct PlayerInfo *player = &stored_player[element - EL_PLAYER_1];
@@ -6721,7 +6790,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
 
     /* check for change of center element (but change it only once) */
     if (IS_CUSTOM_ELEMENT(center_element) &&
-       element_info[center_element].change_events & CE_OTHER_IS_TOUCHING &&
+       HAS_ANY_CHANGE_EVENT(center_element, CE_OTHER_IS_TOUCHING) &&
        !change_center_element)
     {
       for (j=0; j < element_info[center_element].num_change_pages; j++)
@@ -6729,7 +6798,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
        struct ElementChangeInfo *change =
          &element_info[center_element].change_page[j];
 
-       if (change->events & CE_OTHER_IS_TOUCHING &&
+       if (change->events & CH_EVENT_BIT(CE_OTHER_IS_TOUCHING) &&
            change->trigger_element == border_element)
        {
          change_center_element = TRUE;
@@ -6742,14 +6811,14 @@ void TestIfElementTouchesCustomElement(int x, int y)
 
     /* check for change of border element */
     if (IS_CUSTOM_ELEMENT(border_element) &&
-       element_info[border_element].change_events & CE_OTHER_IS_TOUCHING)
+       HAS_ANY_CHANGE_EVENT(border_element, CE_OTHER_IS_TOUCHING))
     {
       for (j=0; j < element_info[border_element].num_change_pages; j++)
       {
        struct ElementChangeInfo *change =
          &element_info[border_element].change_page[j];
 
-       if (change->events & CE_OTHER_IS_TOUCHING &&
+       if (change->events & CH_EVENT_BIT(CE_OTHER_IS_TOUCHING) &&
            change->trigger_element == center_element)
        {
          CheckElementChangeExt(xx,yy, border_element,CE_OTHER_IS_TOUCHING, j);
@@ -7511,6 +7580,10 @@ int DigField(struct PlayerInfo *player,
                             el2edimg(EL_KEY_1 + key_nr));
          redraw_mask |= REDRAW_DOOR_1;
        }
+       else if (element == EL_ENVELOPE)
+       {
+         ShowEnvelope();
+       }
        else if (IS_DROPPABLE(element)) /* can be collected and dropped */
        {
          int i;
index a9f1efa1786ad01efeb85cb7b8d2321da3640dee..73ec0f79aae512a66301a2563628baf24bfb7352 100644 (file)
@@ -485,6 +485,8 @@ struct SetupEditorInfo
   boolean el_chars;
   boolean el_custom;
   boolean el_custom_more;
+
+  boolean el_headlines;
 };
 
 struct SetupShortcutInfo
index d7c264d87115e2609e221102cd3a2f28b89e8123..6b5f03e0e521529b36f5f9b088342cd3cb029459 100644 (file)
@@ -330,7 +330,7 @@ void DrawTextToTextArea(int x, int y, char *text, int font_nr,
                        int area_xsize, int area_ysize)
 {
   int area_line = 0;
-  int font_height = getFontWidth(font_nr);
+  int font_height = getFontHeight(font_nr);
 
   if (text == NULL)
     return;
index 479e0122634d42a0a02e6964d4c0c175f6469794..380af747136b26ab94b5d9de164e54381a4e2c27 100644 (file)
@@ -3687,6 +3687,7 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] =
   { ".EDITOR",         GAME_MODE_EDITOR,               },
   { ".INFO",           GAME_MODE_INFO,                 },
   { ".SETUP",          GAME_MODE_SETUP,                },
+  { ".PLAYING",                GAME_MODE_PLAYING,              },
   { ".DOOR",           GAME_MODE_PSEUDO_DOOR,          },
   { ".PREVIEW",                GAME_MODE_PSEUDO_PREVIEW,       },
   { ".CRUMBLED",       GAME_MODE_PSEUDO_CRUMBLED,      },
index 8a0fca2c30269df31ab100a379625bde365543bf..68ad89ca303d0a240c3c656f0e3d25204e26c355 100644 (file)
 #define GFX_SPECIAL_ARG_EDITOR                 3
 #define GFX_SPECIAL_ARG_INFO                   4
 #define GFX_SPECIAL_ARG_SETUP                  5
-#define GFX_SPECIAL_ARG_DOOR                   6
-#define GFX_SPECIAL_ARG_PREVIEW                        7
-#define GFX_SPECIAL_ARG_CRUMBLED               8
+#define GFX_SPECIAL_ARG_PLAYING                        6
+#define GFX_SPECIAL_ARG_DOOR                   7
+#define GFX_SPECIAL_ARG_PREVIEW                        8
+#define GFX_SPECIAL_ARG_CRUMBLED               9
 
-#define NUM_SPECIAL_GFX_ARGS                   9
+#define NUM_SPECIAL_GFX_ARGS                   10
 
 
 /* values for image configuration suffixes */
 #define GAME_MODE_EDITOR                       3
 #define GAME_MODE_INFO                         4
 #define GAME_MODE_SETUP                                5
-#define GAME_MODE_PSEUDO_DOOR                  6
-#define GAME_MODE_PSEUDO_PREVIEW               7
-#define GAME_MODE_PSEUDO_CRUMBLED              8
+#define GAME_MODE_PLAYING                      6
+#define GAME_MODE_PSEUDO_DOOR                  7
+#define GAME_MODE_PSEUDO_PREVIEW               8
+#define GAME_MODE_PSEUDO_CRUMBLED              9
 
 /* there are no special config file suffixes for these modes */
-#define GAME_MODE_PLAYING                      9
 #define GAME_MODE_PSEUDO_TYPENAME              10
 #define GAME_MODE_QUIT                         11
 
index 2b13ad56d5b6151298db70fff9798a28b9c30b86..0d3b008ab9f44f115c8a6bc09e9f843ad554700b 100644 (file)
@@ -1813,6 +1813,8 @@ static struct TokenInfo setup_info_editor[] =
   { TYPE_SWITCH,       &setup.editor.el_custom,        "Custom:"       },
   { TYPE_SWITCH,       &setup.editor.el_custom_more,   "More Custom:"  },
   { TYPE_EMPTY,                NULL,                   ""                      },
+  { TYPE_SWITCH,       &setup.editor.el_headlines,     "Headlines:"    },
+  { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
   { 0,                 NULL,                   NULL                    }
 };
index b986e81eae00fc64d28496ba2aacc9e3c7d57b10..d50b99dd3d23b79d09f4b142a573fc6ec869e852 100644 (file)
@@ -1371,12 +1371,12 @@ static int getBorderElement(int x, int y)
     { EL_STEELWALL,                    EL_INVISIBLE_STEELWALL             }
   };
   int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1);
-  int steel_position = (x == -1 && y == -1                     ? 0 :
-                       x == lev_fieldx && y == -1              ? 1 :
-                       x == -1 && y == lev_fieldy              ? 2 :
-                       x == lev_fieldx && y == lev_fieldy      ? 3 :
-                       x == -1 || x == lev_fieldx              ? 4 :
-                       y == -1 || y == lev_fieldy              ? 5 : 6);
+  int steel_position = (x == -1                && y == -1              ? 0 :
+                       x == lev_fieldx && y == -1              ? 1 :
+                       x == -1         && y == lev_fieldy      ? 2 :
+                       x == lev_fieldx && y == lev_fieldy      ? 3 :
+                       x == -1         || x == lev_fieldx      ? 4 :
+                       y == -1         || y == lev_fieldy      ? 5 : 6);
 
   return border[steel_position][steel_type];
 }
@@ -1525,6 +1525,31 @@ void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y)
     DrawMiniGraphic(sx, sy, el2edimg(getBorderElement(x, y)));
 }
 
+void DrawEnvelopeBorder(int sx, int sy, int ex, int ey)
+{
+  int border[8][2] =
+  {
+    { EL_STEELWALL_TOPLEFT,            EL_INVISIBLE_STEELWALL_TOPLEFT     },
+    { EL_STEELWALL_TOPRIGHT,           EL_INVISIBLE_STEELWALL_TOPRIGHT    },
+    { EL_STEELWALL_BOTTOMLEFT,         EL_INVISIBLE_STEELWALL_BOTTOMLEFT  },
+    { EL_STEELWALL_BOTTOMRIGHT,                EL_INVISIBLE_STEELWALL_BOTTOMRIGHT },
+    { EL_STEELWALL_VERTICAL,           EL_INVISIBLE_STEELWALL_VERTICAL    },
+    { EL_STEELWALL_HORIZONTAL,         EL_INVISIBLE_STEELWALL_HORIZONTAL  },
+    { EL_STEELWALL,                    EL_INVISIBLE_STEELWALL             },
+    { EL_EMPTY,                                EL_EMPTY                           }
+  };
+  int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1);
+  int steel_position = (ex == -1 && ey == -1 ? 0 :
+                       ex == +1 && ey == -1 ? 1 :
+                       ex == -1 && ey == +1 ? 2 :
+                       ex == +1 && ey == +1 ? 3 :
+                       ex == -1 || ex == +1 ? 4 :
+                       ey == -1 || ey == +1 ? 5 : 7);
+  int element = border[steel_position][steel_type];
+
+  DrawMiniGraphic(sx, sy, el2edimg(element));
+}
+
 void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
 {
   Bitmap *src_bitmap = graphic_info[graphic].bitmap;
index e7a65872bcf2593d3e54ce884610504637990567..05f6ed307983cd7f70713ac19359b477e4e2b5f5 100644 (file)
@@ -112,6 +112,7 @@ void DrawLevelField(int, int);
 
 void DrawMiniElement(int, int, int);
 void DrawMiniElementOrWall(int, int, int, int);
+void DrawEnvelopeBorder(int, int, int, int);
 
 void getMicroGraphicSource(int, Bitmap **, int *, int *);
 void DrawMicroElement(int, int, int);