rnd-20041017-1-src
authorHolger Schemel <info@artsoft.org>
Sun, 17 Oct 2004 01:58:32 +0000 (03:58 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:48:12 +0000 (10:48 +0200)
* fixed bug with scrollbars getting too small when list is very large
* fixed bug with 3+3 (cross) sized explosion not making explosion sound

17 files changed:
ChangeLog
src/conftime.h
src/editor.c
src/files.c
src/game.c
src/game_em/cave.c
src/game_em/convert.c
src/game_em/file.h [deleted file]
src/game_em/game_em.h
src/game_em/global.h
src/game_em/input.c
src/game_em/main_em.h
src/game_em/synchro_1.c
src/game_em/synchro_3.c
src/libgame/gadgets.c
src/libgame/gadgets.h
src/main.h

index 59823701b1edb283534f9123d2c6c275b8ad099a..4d93a17915a73403c0de5a75b2b4263c61fc9248 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-10-17
+       * fixed bug with scrollbars getting too small when list is very large
+
+2004-10-09
+       * fixed bug with 3+3 (cross) sized explosion not making explosion sound
+
 2004-10-04
        * added most level editor configuration gadgets for new EMC elements
 
index d046070017df2a4f7ed1c818dc677b204f6f267c..fd13ab2aae43ef8f8d0f2829c380a39ef9e91c18 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2004-10-04 22:50]"
+#define COMPILE_DATE_STRING "[2004-10-17 03:55]"
index d05a5d72f93b6159108787dec92f9f0b984ba037..75c92d391f8c4ddc7897f0256cb66abe7492daef 100644 (file)
                                         MINI_TILEX / 2)
 
 /* values for the settings windows */
-#define ED_SETTINGS_XSTART             (3 * MINI_TILEX / 2)
-#define ED_SETTINGS_YSTART             (MINI_TILEY * 10)
+#define ED_LEVEL_SETTINGS_XSTART       (3 * MINI_TILEX / 2)
+#define ED_LEVEL_SETTINGS_YSTART       (5 * MINI_TILEY)
+
+#define ED_ELEMENT_SETTINGS_XSTART     (3 * MINI_TILEX / 2)
+#define ED_ELEMENT_SETTINGS_YSTART     (10 * MINI_TILEY)
 
 #define ED_XOFFSET_CHECKBOX            (ED_CHECKBUTTON_XSIZE +         \
                                         2 * ED_GADGET_DISTANCE)
 #define ED_SETTINGS_XOFFSET            ED_XOFFSET_CHECKBOX
 #define ED_SETTINGS_YOFFSET            (3 * MINI_TILEY / 2)
 
-#define ED_SETTINGS_XPOS(n)            (ED_SETTINGS_XSTART +           \
+#define ED_LEVEL_SETTINGS_XPOS(n)      (ED_LEVEL_SETTINGS_XSTART +     \
                                         (n) * ED_SETTINGS_XOFFSET)
-#define ED_SETTINGS_YPOS(n)            (ED_SETTINGS_YSTART +           \
+#define ED_LEVEL_SETTINGS_YPOS(n)      (ED_LEVEL_SETTINGS_YSTART +     \
+                                        (n) * ED_SETTINGS_YOFFSET)
+
+#define ED_ELEMENT_SETTINGS_XPOS(n)    (ED_ELEMENT_SETTINGS_XSTART +   \
+                                        (n) * ED_SETTINGS_XOFFSET)
+#define ED_ELEMENT_SETTINGS_YPOS(n)    (ED_ELEMENT_SETTINGS_YSTART +   \
                                         (n) * ED_SETTINGS_YOFFSET)
 
 #define ED_SETTINGS1_YPOS              MINI_TILEY
                                         (n) * ED_COUNTER_YDISTANCE - 2)
 
 /* values for element content drawing areas */
-#define ED_AREA_1X1_SETTINGS_XPOS(n)   (ED_SETTINGS_XPOS(n))
-#define ED_AREA_1X1_SETTINGS_YPOS(n)   (ED_SETTINGS_YPOS(n) +          \
+#define ED_AREA_1X1_SETTINGS_XPOS(n)   (ED_ELEMENT_SETTINGS_XPOS(n))
+#define ED_AREA_1X1_SETTINGS_YPOS(n)   (ED_ELEMENT_SETTINGS_YPOS(n) +  \
                                         ED_GADGET_DISTANCE)
 
-#define ED_AREA_3X3_SETTINGS_XPOS(n)   (ED_SETTINGS_XPOS(n))
-#define ED_AREA_3X3_SETTINGS_YPOS(n)   (ED_SETTINGS_YPOS(n) +          \
+#define ED_AREA_3X3_SETTINGS_XPOS(n)   (ED_ELEMENT_SETTINGS_XPOS(n))
+#define ED_AREA_3X3_SETTINGS_YPOS(n)   (ED_ELEMENT_SETTINGS_YPOS(n) +  \
                                         ED_GADGET_DISTANCE - MINI_TILEY)
 
 /* yamyam content */
 #define GADGET_ID_RANDOM_PERCENTAGE    (GADGET_ID_CHECKBUTTON_FIRST + 0)
 #define GADGET_ID_RANDOM_QUANTITY      (GADGET_ID_CHECKBUTTON_FIRST + 1)
 #define GADGET_ID_RANDOM_RESTRICTED    (GADGET_ID_CHECKBUTTON_FIRST + 2)
-#define GADGET_ID_DOUBLE_SPEED         (GADGET_ID_CHECKBUTTON_FIRST + 3)
-#define GADGET_ID_GRAVITY              (GADGET_ID_CHECKBUTTON_FIRST + 4)
-#define GADGET_ID_STICK_ELEMENT                (GADGET_ID_CHECKBUTTON_FIRST + 5)
-#define GADGET_ID_EM_SLIPPERY_GEMS     (GADGET_ID_CHECKBUTTON_FIRST + 6)
-#define GADGET_ID_USE_SPRING_BUG       (GADGET_ID_CHECKBUTTON_FIRST + 7)
-#define GADGET_ID_GROW_INTO_DIGGABLE   (GADGET_ID_CHECKBUTTON_FIRST + 8)
+#define GADGET_ID_INITIAL_GRAVITY      (GADGET_ID_CHECKBUTTON_FIRST + 3)
+#define GADGET_ID_STICK_ELEMENT                (GADGET_ID_CHECKBUTTON_FIRST + 4)
+#define GADGET_ID_EM_SLIPPERY_GEMS     (GADGET_ID_CHECKBUTTON_FIRST + 5)
+#define GADGET_ID_USE_SPRING_BUG       (GADGET_ID_CHECKBUTTON_FIRST + 6)
+#define GADGET_ID_GROW_INTO_DIGGABLE   (GADGET_ID_CHECKBUTTON_FIRST + 7)
+#define GADGET_ID_DOUBLE_SPEED         (GADGET_ID_CHECKBUTTON_FIRST + 8)
 #define GADGET_ID_BLOCK_LAST_FIELD     (GADGET_ID_CHECKBUTTON_FIRST + 9)
 #define GADGET_ID_SP_BLOCK_LAST_FIELD  (GADGET_ID_CHECKBUTTON_FIRST + 10)
 #define GADGET_ID_INSTANT_RELOCATION   (GADGET_ID_CHECKBUTTON_FIRST + 11)
 #define ED_GRAPHICBUTTON_ID_CHANGE_LAST   ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE
 
 /* values for checkbutton gadgets */
-#define ED_CHECKBUTTON_ID_DOUBLE_SPEED         0
-#define ED_CHECKBUTTON_ID_GRAVITY              1
-#define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED    2
-#define ED_CHECKBUTTON_ID_STICK_ELEMENT                3
-#define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS     4
-#define ED_CHECKBUTTON_ID_USE_SPRING_BUG       5
-#define ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE   6
+#define ED_CHECKBUTTON_ID_INITIAL_GRAVITY      0
+#define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED    1
+#define ED_CHECKBUTTON_ID_STICK_ELEMENT                2
+#define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS     3
+#define ED_CHECKBUTTON_ID_USE_SPRING_BUG       4
+#define ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE   5
+#define ED_CHECKBUTTON_ID_DOUBLE_SPEED         6
 #define ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD     7
 #define ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD  8
 #define ED_CHECKBUTTON_ID_INSTANT_RELOCATION   9
 
 #define ED_NUM_CHECKBUTTONS                    37
 
-#define ED_CHECKBUTTON_ID_LEVEL_FIRST  ED_CHECKBUTTON_ID_DOUBLE_SPEED
+#define ED_CHECKBUTTON_ID_LEVEL_FIRST  ED_CHECKBUTTON_ID_INITIAL_GRAVITY
 #define ED_CHECKBUTTON_ID_LEVEL_LAST   ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
 
 #define ED_CHECKBUTTON_ID_CUSTOM1_FIRST        ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
@@ -925,7 +933,7 @@ static struct
   char *text_above, *text_left, *text_right;
 } counterbutton_info[ED_NUM_COUNTERBUTTONS] =
 {
-  /* ---------- level and editor settings ---------------------------------- */
+  /* ---------- current level number --------------------------------------- */
 
   {
     DX + 5 - SX,                       DY + 3 - SY,
@@ -935,8 +943,11 @@ static struct
     &level_nr,
     NULL,                              NULL, NULL
   },
+
+  /* ---------- level and editor settings ---------------------------------- */
+
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(2),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(4),
     MIN_LEV_FIELDX,                    MAX_LEV_FIELDX,
     GADGET_ID_LEVEL_XSIZE_DOWN,                GADGET_ID_LEVEL_XSIZE_UP,
     GADGET_ID_LEVEL_XSIZE_TEXT,                GADGET_ID_NONE,
@@ -944,7 +955,7 @@ static struct
     "playfield size:",                 NULL, "width",
   },
   {
-    -1,                                        ED_COUNTER_YPOS(2),
+    -1,                                        ED_LEVEL_SETTINGS_YPOS(4),
     MIN_LEV_FIELDY,                    MAX_LEV_FIELDY,
     GADGET_ID_LEVEL_YSIZE_DOWN,                GADGET_ID_LEVEL_YSIZE_UP,
     GADGET_ID_LEVEL_YSIZE_TEXT,                GADGET_ID_LEVEL_XSIZE_UP,
@@ -952,15 +963,15 @@ static struct
     NULL,                              " ", "height",
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(3),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(6),
     0,                                 999,
     GADGET_ID_LEVEL_GEMSLIMIT_DOWN,    GADGET_ID_LEVEL_GEMSLIMIT_UP,
     GADGET_ID_LEVEL_GEMSLIMIT_TEXT,    GADGET_ID_NONE,
     &level.gems_needed,
-    "number of gems to collect:",      NULL, NULL
+    NULL, "number of gems to collect:",        NULL
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(4),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(8),
     0,                                 9999,
     GADGET_ID_LEVEL_TIMELIMIT_DOWN,    GADGET_ID_LEVEL_TIMELIMIT_UP,
     GADGET_ID_LEVEL_TIMELIMIT_TEXT,    GADGET_ID_NONE,
@@ -968,7 +979,7 @@ static struct
     "time or step limit to solve level:", NULL, NULL
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(5),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(10),
     0,                                 255,
     GADGET_ID_LEVEL_TIMESCORE_DOWN,    GADGET_ID_LEVEL_TIMESCORE_UP,
     GADGET_ID_LEVEL_TIMESCORE_TEXT,    GADGET_ID_NONE,
@@ -976,7 +987,7 @@ static struct
     "score for each 10 sec/steps left:", NULL, NULL
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER2_YPOS(8),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_COUNTER2_YPOS(8),
     1,                                 100,
     GADGET_ID_LEVEL_RANDOM_DOWN,       GADGET_ID_LEVEL_RANDOM_UP,
     GADGET_ID_LEVEL_RANDOM_TEXT,       GADGET_ID_NONE,
@@ -987,7 +998,7 @@ static struct
   /* ---------- element settings: configure (various elements) ------------- */
 
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(0),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
     MIN_SCORE,                         MAX_SCORE,
     GADGET_ID_ELEMENT_VALUE1_DOWN,     GADGET_ID_ELEMENT_VALUE1_UP,
     GADGET_ID_ELEMENT_VALUE1_TEXT,     GADGET_ID_NONE,
@@ -995,7 +1006,7 @@ static struct
     NULL,                              NULL, NULL
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     MIN_SCORE,                         MAX_SCORE,
     GADGET_ID_ELEMENT_VALUE2_DOWN,     GADGET_ID_ELEMENT_VALUE2_UP,
     GADGET_ID_ELEMENT_VALUE2_TEXT,     GADGET_ID_NONE,
@@ -1003,7 +1014,7 @@ static struct
     NULL,                              NULL, NULL
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(3),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(3),
     MIN_ELEMENT_CONTENTS,              MAX_ELEMENT_CONTENTS,
     GADGET_ID_YAMYAM_CONTENT_DOWN,     GADGET_ID_YAMYAM_CONTENT_UP,
     GADGET_ID_YAMYAM_CONTENT_TEXT,     GADGET_ID_NONE,
@@ -1011,7 +1022,7 @@ static struct
     NULL,                              NULL, "number of content areas"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(0),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
     MIN_ENVELOPE_XSIZE,                        MAX_ENVELOPE_XSIZE,
     GADGET_ID_ENVELOPE_XSIZE_DOWN,     GADGET_ID_ENVELOPE_XSIZE_UP,
     GADGET_ID_ENVELOPE_XSIZE_TEXT,     GADGET_ID_NONE,
@@ -1019,7 +1030,7 @@ static struct
     NULL,                              NULL, "width",
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(0),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(0),
     MIN_ENVELOPE_YSIZE,                        MAX_ENVELOPE_YSIZE,
     GADGET_ID_ENVELOPE_YSIZE_DOWN,     GADGET_ID_ENVELOPE_YSIZE_UP,
     GADGET_ID_ENVELOPE_YSIZE_TEXT,     GADGET_ID_ENVELOPE_XSIZE_UP,
@@ -1030,7 +1041,7 @@ static struct
   /* ---------- element settings: configure 1 (custom elements) ------------ */
 
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(6),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(6),
     MIN_SCORE,                         MAX_SCORE,
     GADGET_ID_CUSTOM_SCORE_DOWN,       GADGET_ID_CUSTOM_SCORE_UP,
     GADGET_ID_CUSTOM_SCORE_TEXT,       GADGET_ID_NONE,
@@ -1038,7 +1049,7 @@ static struct
     NULL,                              "score", " "
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(6),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(6),
     MIN_COLLECT_COUNT,                 MAX_COLLECT_COUNT,
     GADGET_ID_CUSTOM_GEMCOUNT_DOWN,    GADGET_ID_CUSTOM_GEMCOUNT_UP,
     GADGET_ID_CUSTOM_GEMCOUNT_TEXT,    GADGET_ID_CUSTOM_SCORE_UP,
@@ -1046,7 +1057,7 @@ static struct
     NULL,                              "count", NULL
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(7),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(7),
     0,                                 255,
     GADGET_ID_PUSH_DELAY_FIX_DOWN,     GADGET_ID_PUSH_DELAY_FIX_UP,
     GADGET_ID_PUSH_DELAY_FIX_TEXT,     GADGET_ID_NONE,
@@ -1054,7 +1065,7 @@ static struct
     NULL,                              "push delay", NULL
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(7),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(7),
     0,                                 255,
     GADGET_ID_PUSH_DELAY_RND_DOWN,     GADGET_ID_PUSH_DELAY_RND_UP,
     GADGET_ID_PUSH_DELAY_RND_TEXT,     GADGET_ID_PUSH_DELAY_FIX_UP,
@@ -1062,7 +1073,7 @@ static struct
     NULL,                              "+random", NULL
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(8),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(8),
     0,                                 255,
     GADGET_ID_DROP_DELAY_FIX_DOWN,     GADGET_ID_DROP_DELAY_FIX_UP,
     GADGET_ID_DROP_DELAY_FIX_TEXT,     GADGET_ID_NONE,
@@ -1070,7 +1081,7 @@ static struct
     NULL,                              "drop delay", NULL
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(8),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(8),
     0,                                 255,
     GADGET_ID_DROP_DELAY_RND_DOWN,     GADGET_ID_DROP_DELAY_RND_UP,
     GADGET_ID_DROP_DELAY_RND_TEXT,     GADGET_ID_DROP_DELAY_FIX_UP,
@@ -1081,7 +1092,7 @@ static struct
   /* ---------- element settings: configure 2 (custom elements) ------------ */
 
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(5),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(5),
     0,                                 999,
     GADGET_ID_MOVE_DELAY_FIX_DOWN,     GADGET_ID_MOVE_DELAY_FIX_UP,
     GADGET_ID_MOVE_DELAY_FIX_TEXT,     GADGET_ID_NONE,
@@ -1089,7 +1100,7 @@ static struct
     NULL,                              "move delay", NULL
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(5),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(5),
     0,                                 999,
     GADGET_ID_MOVE_DELAY_RND_DOWN,     GADGET_ID_MOVE_DELAY_RND_UP,
     GADGET_ID_MOVE_DELAY_RND_TEXT,     GADGET_ID_MOVE_DELAY_FIX_UP,
@@ -1097,7 +1108,7 @@ static struct
     NULL,                              "+random", NULL
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(12),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(12),
     0,                                 255,
     GADGET_ID_EXPLOSION_DELAY_DOWN,    GADGET_ID_EXPLOSION_DELAY_UP,
     GADGET_ID_EXPLOSION_DELAY_TEXT,    GADGET_ID_NONE,
@@ -1105,7 +1116,7 @@ static struct
     NULL,                              "explosion delay", NULL
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(13),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(13),
     0,                                 255,
     GADGET_ID_IGNITION_DELAY_DOWN,     GADGET_ID_IGNITION_DELAY_UP,
     GADGET_ID_IGNITION_DELAY_TEXT,     GADGET_ID_NONE,
@@ -1116,7 +1127,7 @@ static struct
   /* ---------- element settings: configure (group elements) --------------- */
 
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(5),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(5),
     MIN_ELEMENTS_IN_GROUP,             MAX_ELEMENTS_IN_GROUP,
     GADGET_ID_GROUP_CONTENT_DOWN,      GADGET_ID_GROUP_CONTENT_UP,
     GADGET_ID_GROUP_CONTENT_TEXT,      GADGET_ID_NONE,
@@ -1127,7 +1138,7 @@ static struct
   /* ---------- element settings: advanced (custom elements) --------------- */
 
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(2),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(2),
     0,                                 999,
     GADGET_ID_CHANGE_DELAY_FIX_DOWN,   GADGET_ID_CHANGE_DELAY_FIX_UP,
     GADGET_ID_CHANGE_DELAY_FIX_TEXT,   GADGET_ID_NONE,
@@ -1135,7 +1146,7 @@ static struct
     NULL,                              "delay", NULL,
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(2),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(2),
     0,                                 999,
     GADGET_ID_CHANGE_DELAY_RND_DOWN,   GADGET_ID_CHANGE_DELAY_RND_UP,
     GADGET_ID_CHANGE_DELAY_RND_TEXT,   GADGET_ID_CHANGE_DELAY_FIX_UP,
@@ -1143,7 +1154,7 @@ static struct
     NULL,                              "+random", NULL
   },
   {
-    ED_SETTINGS_XPOS(3),               ED_SETTINGS_YPOS(12),
+    ED_ELEMENT_SETTINGS_XPOS(3),       ED_ELEMENT_SETTINGS_YPOS(12),
     0,                                 100,
     GADGET_ID_CHANGE_CONT_RND_DOWN,    GADGET_ID_CHANGE_CONT_RND_UP,
     GADGET_ID_CHANGE_CONT_RND_TEXT,    GADGET_ID_NONE,
@@ -1162,14 +1173,14 @@ static struct
 } textinput_info[ED_NUM_TEXTINPUT] =
 {
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(0),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(0),
     GADGET_ID_LEVEL_NAME,
     MAX_LEVEL_NAME_LEN,
     level.name,
     "Title:", "Title"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(1),
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(2),
     GADGET_ID_LEVEL_AUTHOR,
     MAX_LEVEL_AUTHOR_LEN,
     level.author,
@@ -1194,7 +1205,7 @@ static struct
 } textarea_info[ED_NUM_TEXTAREAS] =
 {
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(2),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(2),
     GADGET_ID_ENVELOPE_INFO,
     MAX_ENVELOPE_XSIZE, MAX_ENVELOPE_YSIZE,
     NULL,
@@ -1212,8 +1223,8 @@ static struct ValueTextInfo options_time_or_steps[] =
 
 static struct ValueTextInfo options_game_engine_type[] =
 {
-  { GAME_ENGINE_TYPE_RND,      "RND"                           },
-  { GAME_ENGINE_TYPE_EM,       "EM"                            },
+  { GAME_ENGINE_TYPE_RND,      "Rocks'n'Diamonds"              },
+  { GAME_ENGINE_TYPE_EM,       "Emerald Mine"                  },
 
   { -1,                                NULL                            }
 };
@@ -1541,7 +1552,7 @@ static struct
   /* ---------- level and editor settings ---------------------------------- */
 
   {
-    -1,                                        ED_COUNTER_YPOS(4),
+    -1,                                        ED_LEVEL_SETTINGS_YPOS(8),
     GADGET_ID_TIME_OR_STEPS,           GADGET_ID_LEVEL_TIMELIMIT_UP,
     -1,
     options_time_or_steps,
@@ -1549,7 +1560,7 @@ static struct
     NULL, "(0 => no limit)",           "time or step limit"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(6) + 8,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(5),
     GADGET_ID_GAME_ENGINE_TYPE,                GADGET_ID_NONE,
     -1,
     options_game_engine_type,
@@ -1560,7 +1571,7 @@ static struct
   /* ---------- element settings: configure 1 (custom elements) ----------- */
 
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(3),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_CUSTOM_ACCESS_TYPE,      GADGET_ID_NONE,
     -1,
     options_access_type,
@@ -1568,7 +1579,7 @@ static struct
     NULL, NULL,                                "type of access to this field"
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(3),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_CUSTOM_ACCESS_LAYER,     GADGET_ID_CUSTOM_ACCESS_TYPE,
     -1,
     options_access_layer,
@@ -1576,7 +1587,7 @@ static struct
     NULL, NULL,                                "layer of access for this field"
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(3),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_CUSTOM_ACCESS_PROTECTED, GADGET_ID_CUSTOM_ACCESS_LAYER,
     -1,
     options_access_protected,
@@ -1584,7 +1595,7 @@ static struct
     NULL, NULL,                                "protected access for this field"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(4),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(4),
     GADGET_ID_CUSTOM_ACCESS_DIRECTION, GADGET_ID_NONE,
     -1,
     options_access_direction,
@@ -1592,7 +1603,7 @@ static struct
     "from", NULL,                      "access direction for this field"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(5),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(5),
     GADGET_ID_CUSTOM_WALK_TO_ACTION,   GADGET_ID_NONE,
     -1,
     options_walk_to_action,
@@ -1603,7 +1614,7 @@ static struct
   /* ---------- element settings: configure 2 (custom elements) ----------- */
 
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_CUSTOM_MOVE_PATTERN,     GADGET_ID_NONE,
     -1,
     options_move_pattern,
@@ -1611,7 +1622,7 @@ static struct
     "can move", NULL,                  "element move pattern"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(2),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(2),
     GADGET_ID_CUSTOM_MOVE_DIRECTION,   GADGET_ID_NONE,
     -1,
     options_move_direction,
@@ -1619,7 +1630,7 @@ static struct
     "starts moving", NULL,             "initial element move direction"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(4),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(4),
     GADGET_ID_CUSTOM_MOVE_STEPSIZE,    GADGET_ID_NONE,
     -1,
     options_move_stepsize,
@@ -1627,7 +1638,7 @@ static struct
     "move/fall speed", NULL,           "speed of element movement"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(3),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE,  GADGET_ID_NONE,
     -1,
     options_move_leave_type,
@@ -1635,7 +1646,7 @@ static struct
     "can dig:    can", ":",            "leave behind or change element"
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(7),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(7),
     GADGET_ID_CUSTOM_SMASH_TARGETS,    GADGET_ID_CUSTOM_CAN_SMASH,
     -1,
     options_smash_targets,
@@ -1643,7 +1654,7 @@ static struct
     "can smash", NULL,                 "elements that can be smashed"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(8),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(8),
     GADGET_ID_CUSTOM_SLIPPERY_TYPE,    GADGET_ID_NONE,
     -1,
     options_slippery_type,
@@ -1651,7 +1662,7 @@ static struct
     "slippery", NULL,                  "where other elements fall down"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(9),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(9),
     GADGET_ID_CUSTOM_DEADLINESS,       GADGET_ID_NONE,
     -1,
     options_deadliness,
@@ -1659,7 +1670,7 @@ static struct
     "deadly when", NULL,               "deadliness of element"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(10),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(10),
     GADGET_ID_CUSTOM_EXPLOSION_TYPE,   GADGET_ID_NONE,
     -1,
     options_explosion_type,
@@ -1670,7 +1681,7 @@ static struct
   /* ---------- element settings: advanced (custom elements) --------------- */
 
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(3),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_CHANGE_TIME_UNITS,       GADGET_ID_NONE,
     -1,
     options_time_units,
@@ -1678,7 +1689,7 @@ static struct
     "delay time given in", NULL,       "delay time units for change"
   },
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(4),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(4),
     GADGET_ID_CHANGE_DIRECT_ACTION,    GADGET_ID_NONE,
     -1,
     options_change_direct_action,
@@ -1686,7 +1697,7 @@ static struct
     NULL, NULL,                                "type of direct action"
   },
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(5),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(5),
     GADGET_ID_CHANGE_OTHER_ACTION,     GADGET_ID_NONE,
     -1,
     options_change_other_action,
@@ -1694,7 +1705,7 @@ static struct
     NULL, "element:",                  "type of other element action"
   },
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(6),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(6),
     GADGET_ID_CHANGE_SIDE,             GADGET_ID_NONE,
     -1,
     options_change_trigger_side,
@@ -1702,7 +1713,7 @@ static struct
     "at", "side",                      "element side that causes change"
   },
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(7),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(7),
     GADGET_ID_CHANGE_PLAYER,           GADGET_ID_NONE,
     -1,
     options_change_trigger_player,
@@ -1710,7 +1721,7 @@ static struct
     "player:", " ",                    "player that causes change"
   },
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(7),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(7),
     GADGET_ID_CHANGE_PAGE,             GADGET_ID_CHANGE_PLAYER,
     -1,
     options_change_trigger_page,
@@ -1718,7 +1729,7 @@ static struct
     "page:", NULL,                     "change page that causes change"
   },
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(10),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(10),
     GADGET_ID_CHANGE_REPLACE_WHEN,     GADGET_ID_NONE,
     -1,
     options_change_replace_when,
@@ -1726,7 +1737,7 @@ static struct
     "replace when", NULL,              "which elements can be replaced"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(14),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(14),
     GADGET_ID_SELECT_CHANGE_PAGE,      GADGET_ID_NONE,
     3,
     options_change_page,
@@ -1737,7 +1748,7 @@ static struct
   /* ---------- element settings: configure (group elements) --------------- */
 
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(6),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(6),
     GADGET_ID_GROUP_CHOICE_MODE,       GADGET_ID_NONE,
     -1,
     options_group_choice_mode,
@@ -1758,69 +1769,69 @@ static struct
 {
 #if 1
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_COUNTER_YPOS(1),
     GADGET_ID_PROPERTIES_INFO,         GADGET_ID_NONE,
     8,                                 "Info",                 
     NULL, NULL,                                "Show information about element"
   },
   {
-    ED_SETTINGS_XPOS(0) + 124,         ED_COUNTER_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0) + 124, ED_COUNTER_YPOS(1),
     GADGET_ID_PROPERTIES_CONFIG,       GADGET_ID_NONE,
     8,                                 "Config",
     NULL, NULL,                                "Configure element properties"
   },
   {
-    ED_SETTINGS_XPOS(0) + 124,         ED_COUNTER_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0) + 124, ED_COUNTER_YPOS(1),
     GADGET_ID_PROPERTIES_CONFIG_1,     GADGET_ID_NONE,
     8,                                 "Config 1",
     NULL, NULL,                                "Configure custom element properties"
   },
   {
-    ED_SETTINGS_XPOS(0) + 248,         ED_COUNTER_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0) + 248, ED_COUNTER_YPOS(1),
     GADGET_ID_PROPERTIES_CONFIG_2,     GADGET_ID_NONE,
     8,                                 "Config 2",
     NULL, NULL,                                "Configure custom element properties"
   },
   {
-    ED_SETTINGS_XPOS(0) + 372,         ED_COUNTER_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0) + 372, ED_COUNTER_YPOS(1),
     GADGET_ID_PROPERTIES_CHANGE,       GADGET_ID_NONE,
     8,                                 "Change",
     NULL, NULL,                                "Custom element change configuration"
   },
 #else
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_COUNTER_YPOS(1),
     GADGET_ID_PROPERTIES_INFO,         GADGET_ID_NONE,
     11,                                        "Information",                  
     NULL, NULL,                                "Show information about element"
   },
   {
-    ED_SETTINGS_XPOS(0) + 166,         ED_COUNTER_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0) + 166, ED_COUNTER_YPOS(1),
     GADGET_ID_PROPERTIES_CONFIG,       GADGET_ID_NONE,
     11,                                        "Configure",
     NULL, NULL,                                "Configure element properties"
   },
   {
-    ED_SETTINGS_XPOS(0) + 332,         ED_COUNTER_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0) + 332, ED_COUNTER_YPOS(1),
     GADGET_ID_PROPERTIES_CHANGE,       GADGET_ID_NONE,
     11,                                        "Advanced",
     NULL, NULL,                                "Advanced element configuration"
   },
 #endif
   {
-    -1,                                        ED_SETTINGS_YPOS(2),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(2),
     GADGET_ID_SAVE_AS_TEMPLATE,                GADGET_ID_CUSTOM_USE_TEMPLATE,
     -1,                                        "Save",
     " ", "As Template",                        "Save current settings as new template"
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(14),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(14),
     GADGET_ID_ADD_CHANGE_PAGE,         GADGET_ID_PASTE_CHANGE_PAGE,
     -1,                                        "New",
     NULL, NULL,                                "Add new change page"
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(14),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(14),
     GADGET_ID_DEL_CHANGE_PAGE,         GADGET_ID_ADD_CHANGE_PAGE,
     -1,                                        "Delete",
     NULL, NULL,                                "Delete current change page"
@@ -1839,28 +1850,28 @@ static struct
 {
   {
     ED_BUTTON_MINUS_XPOS,              ED_BUTTON_COUNT_YPOS,
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(14),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(14),
     ED_BUTTON_COUNT_XSIZE,             ED_BUTTON_COUNT_YSIZE,
     GADGET_ID_PREV_CHANGE_PAGE,                GADGET_ID_NONE,
     NULL, NULL,                                "select previous change page"
   },
   {
     ED_BUTTON_PLUS_XPOS,               ED_BUTTON_COUNT_YPOS,
-    -1,                                        ED_SETTINGS_YPOS(14),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(14),
     ED_BUTTON_COUNT_XSIZE,             ED_BUTTON_COUNT_YSIZE,
     GADGET_ID_NEXT_CHANGE_PAGE,                GADGET_ID_SELECT_CHANGE_PAGE,
     NULL, "change page",               "select next change page"
   },
   {
     ED_COPY_CHANGE_PAGE_XPOS,          ED_COPY_CHANGE_PAGE_YPOS,
-    -1,                                        ED_SETTINGS_YPOS(14),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(14),
     ED_BUTTON_COUNT_XSIZE,             ED_BUTTON_COUNT_YSIZE,
     GADGET_ID_COPY_CHANGE_PAGE,                GADGET_ID_NEXT_CHANGE_PAGE,
     " ", NULL,                         "copy settings from this change page"
   },
   {
     ED_PASTE_CHANGE_PAGE_XPOS,         ED_PASTE_CHANGE_PAGE_YPOS,
-    -1,                                        ED_SETTINGS_YPOS(14),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(14),
     ED_BUTTON_COUNT_XSIZE,             ED_BUTTON_COUNT_YSIZE,
     GADGET_ID_PASTE_CHANGE_PAGE,       GADGET_ID_COPY_CHANGE_PAGE,
     NULL, NULL,                                "paste settings to this change page"
@@ -1988,19 +1999,14 @@ static struct
   /* ---------- level and editor settings ---------------------------------- */
 
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER_YPOS(6) - MINI_TILEY,
-    GADGET_ID_DOUBLE_SPEED,            GADGET_ID_NONE,
-    &level.double_speed,
-    NULL, "double speed movement",     "set movement speed of player"
-  },
-  {
-    -1,                                        ED_COUNTER_YPOS(6) - MINI_TILEY,
-    GADGET_ID_GRAVITY,                 GADGET_ID_DOUBLE_SPEED,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(11),
+    GADGET_ID_INITIAL_GRAVITY,         GADGET_ID_NONE,
     &level.initial_gravity,
-    " ", "gravity",                    "set level gravity"
+    NULL,
+    "initial gravity",                 "set initial level gravity"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_COUNTER2_YPOS(9) - MINI_TILEY,
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_COUNTER2_YPOS(9) - MINI_TILEY,
     GADGET_ID_RANDOM_RESTRICTED,       GADGET_ID_NONE,
     &random_placement_background_restricted,
     NULL,
@@ -2010,77 +2016,84 @@ static struct
   /* ---------- element settings: configure (various elements) ------------- */
 
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(0),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
     GADGET_ID_STICK_ELEMENT,           GADGET_ID_NONE,
     &stick_element_properties_window,
     NULL,
     "stick this screen to edit content","stick this screen to edit content"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_EM_SLIPPERY_GEMS,                GADGET_ID_NONE,
     &level.em_slippery_gems,
     NULL,
     "slip down from certain flat walls","use EM style slipping behaviour"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_USE_SPRING_BUG,          GADGET_ID_NONE,
     &level.use_spring_bug,
     NULL,
     "use spring pushing bug",          "use odd spring pushing behaviour"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(0),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
     GADGET_ID_GROW_INTO_DIGGABLE,      GADGET_ID_NONE,
     &level.grow_into_diggable,
     NULL,
     "can grow into anything diggable", "grow into more than just sand"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(4),
+    GADGET_ID_DOUBLE_SPEED,            GADGET_ID_NONE,
+    &level.double_speed,
+    NULL,
+    "double speed movement",           "set initial movement speed of player"
+  },
+  {
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_BLOCK_LAST_FIELD,                GADGET_ID_NONE,
     &level.block_last_field,
     NULL,
     "block last field when moving",    "player blocks last field when moving"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_SP_BLOCK_LAST_FIELD,     GADGET_ID_NONE,
     &level.sp_block_last_field,
     NULL,
     "block last field when moving",    "player blocks last field when moving"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(2),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(2),
     GADGET_ID_INSTANT_RELOCATION,      GADGET_ID_NONE,
     &level.instant_relocation,
     NULL,
     "no scrolling when relocating",    "player gets relocated without delay"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(3),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_CAN_PASS_TO_WALKABLE,    GADGET_ID_NONE,
     &level.can_pass_to_walkable,
     NULL,
     "can pass to walkable element",    "player can pass to empty or walkable"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(0),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
     GADGET_ID_CAN_FALL_INTO_ACID,      GADGET_ID_NONE,
     &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
     NULL,
     "can fall into acid (with gravity)","player can fall into acid pool"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(0),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
     GADGET_ID_CAN_MOVE_INTO_ACID,      GADGET_ID_NONE,
     &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
     NULL,
     "can move into acid",              "element can move into acid pool"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_DONT_COLLIDE_WITH,       GADGET_ID_NONE,
     &custom_element_properties[EP_DONT_COLLIDE_WITH],
     NULL,
@@ -2090,7 +2103,7 @@ static struct
   /* ---------- element settings: configure 1 (custom elements) ----------- */
 
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_CUSTOM_USE_GRAPHIC,      GADGET_ID_NONE,
     &custom_element.use_gfx_element,
 
@@ -2102,31 +2115,31 @@ static struct
 #endif
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(2),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(2),
     GADGET_ID_CUSTOM_USE_TEMPLATE,     GADGET_ID_NONE,
     &level.use_custom_template,
     NULL, "use template",              "use template for custom properties"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(3),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_CUSTOM_ACCESSIBLE,       GADGET_ID_NONE,
     &custom_element_properties[EP_ACCESSIBLE],
     NULL, NULL,                                "player can walk to or pass this field"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(10),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(10),
     GADGET_ID_CUSTOM_GRAV_REACHABLE,   GADGET_ID_NONE,
     &custom_element_properties[EP_GRAVITY_REACHABLE],
     NULL, "reachable despite gravity", "player can walk/dig despite gravity"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(5),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(5),
     GADGET_ID_CUSTOM_WALK_TO_OBJECT,   GADGET_ID_NONE,
     &custom_element_properties[EP_WALK_TO_OBJECT],
     NULL, NULL,                                "player can dig/collect/push element"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(9),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(9),
     GADGET_ID_CUSTOM_INDESTRUCTIBLE,   GADGET_ID_NONE,
     &custom_element_properties[EP_INDESTRUCTIBLE],
     NULL, "indestructible",            "element is indestructible"
@@ -2135,55 +2148,55 @@ static struct
   /* ---------- element settings: configure 2 (custom elements) ----------- */
 
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_CUSTOM_CAN_MOVE,         GADGET_ID_NONE,
     &custom_element_properties[EP_CAN_MOVE],
     NULL, NULL,                                "element can move with some pattern"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(7),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(7),
     GADGET_ID_CUSTOM_CAN_FALL,         GADGET_ID_NONE,
     &custom_element_properties[EP_CAN_FALL],
     NULL, "can fall",                  "element can fall down"
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(7),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(7),
     GADGET_ID_CUSTOM_CAN_SMASH,                GADGET_ID_CUSTOM_CAN_FALL,
     &custom_element_properties[EP_CAN_SMASH],
     " ", NULL,                         "element can smash other elements"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(8),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(8),
     GADGET_ID_CUSTOM_SLIPPERY,         GADGET_ID_NONE,
     &custom_element_properties[EP_SLIPPERY],
     NULL, NULL,                                "other elements can fall down from it"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(9),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(9),
     GADGET_ID_CUSTOM_DEADLY,           GADGET_ID_NONE,
     &custom_element_properties[EP_DEADLY],
     NULL, NULL,                                "element can kill the player"
   },
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(10),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(10),
     GADGET_ID_CUSTOM_CAN_EXPLODE,      GADGET_ID_NONE,
     &custom_element_properties[EP_CAN_EXPLODE],
     NULL, NULL,                                "element can explode"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(11),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(11),
     GADGET_ID_CUSTOM_EXPLODE_FIRE,     GADGET_ID_NONE,
     &custom_element_properties[EP_EXPLODES_BY_FIRE],
     NULL, "by fire",                   "element can explode by fire/explosion"
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(11),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(11),
     GADGET_ID_CUSTOM_EXPLODE_SMASH,    GADGET_ID_CUSTOM_EXPLODE_FIRE,
     &custom_element_properties[EP_EXPLODES_SMASHED],
     " ", "smashed",                    "element can explode when smashed"
   },
   {
-    -1,                                        ED_SETTINGS_YPOS(11),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(11),
     GADGET_ID_CUSTOM_EXPLODE_IMPACT,   GADGET_ID_CUSTOM_EXPLODE_SMASH,
     &custom_element_properties[EP_EXPLODES_IMPACT],
     " ", "impact",                     "element can explode on impact"
@@ -2192,49 +2205,49 @@ static struct
   /* ---------- element settings: advanced (custom elements) --------------- */
 
   {
-    ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_CUSTOM_CAN_CHANGE,       GADGET_ID_NONE,
     &custom_element_change.can_change,
     NULL, "element changes to:",       "element can change to other element"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(2),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(2),
     GADGET_ID_CHANGE_DELAY,            GADGET_ID_NONE,
     &custom_element_change_events[CE_DELAY],
     NULL, NULL,                                "element changes after delay"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(4),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(4),
     GADGET_ID_CHANGE_BY_DIRECT_ACT,    GADGET_ID_NONE,
     &custom_element_change_events[CE_BY_DIRECT_ACTION],
     NULL, NULL,                                "element changes by direct action"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(5),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(5),
     GADGET_ID_CHANGE_BY_OTHER_ACT,     GADGET_ID_NONE,
     &custom_element_change_events[CE_BY_OTHER_ACTION],
     NULL, NULL,                                "element changes by other element"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(8),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(8),
     GADGET_ID_CHANGE_USE_EXPLOSION,    GADGET_ID_NONE,
     &custom_element_change.explode,
     NULL, "explode instead of change", "element explodes instead of change"
   },
   {
-    ED_SETTINGS_XPOS(1),               ED_SETTINGS_YPOS(9),
+    ED_ELEMENT_SETTINGS_XPOS(1),       ED_ELEMENT_SETTINGS_YPOS(9),
     GADGET_ID_CHANGE_USE_CONTENT,      GADGET_ID_NONE,
     &custom_element_change.use_target_content,
     NULL, "use extended change target:","element changes to more elements"
   },
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(11),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(11),
     GADGET_ID_CHANGE_ONLY_COMPLETE,    GADGET_ID_NONE,
     &custom_element_change.only_if_complete,
     NULL, "replace all or nothing",    "only replace when all can be changed"
   },
   {
-    ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(12),
+    ED_ELEMENT_SETTINGS_XPOS(2),       ED_ELEMENT_SETTINGS_YPOS(12),
     GADGET_ID_CHANGE_USE_RANDOM,       GADGET_ID_NONE,
     &custom_element_change.use_random_replace,
     NULL, NULL,                                "use percentage for random replace"
@@ -2448,7 +2461,7 @@ static struct
   /* ---------- random background (for random painting) -------------------- */
 
   {
-    -1,                                        ED_SETTINGS_YPOS(14),
+    -1,                                        ED_ELEMENT_SETTINGS_YPOS(14),
     1, 1,
     GADGET_ID_RANDOM_BACKGROUND,       GADGET_ID_RANDOM_RESTRICTED,
     NULL, NULL,                                NULL
@@ -6884,8 +6897,8 @@ char *getElementDescriptionFilename(int element)
 static boolean PrintInfoText(char *text, int font_nr, int start_line)
 {
   int font_height = getFontHeight(font_nr);
-  int pad_x = ED_SETTINGS_XPOS(0);
-  int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+  int pad_x = ED_ELEMENT_SETTINGS_XPOS(0);
+  int pad_y = ED_ELEMENT_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
   int sx = SX + pad_x;
   int sy = SY + pad_y;
   int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
@@ -6905,8 +6918,8 @@ static int PrintElementDescriptionFromFile(char *filename, int start_line)
   int font_nr = FONT_TEXT_2;
   int font_width = getFontWidth(font_nr);
   int font_height = getFontHeight(font_nr);
-  int pad_x = ED_SETTINGS_XPOS(0);
-  int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+  int pad_x = ED_ELEMENT_SETTINGS_XPOS(0);
+  int pad_y = ED_ELEMENT_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
   int sx = SX + pad_x;
   int sy = SY + pad_y + start_line * font_height;
   int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
@@ -6923,8 +6936,8 @@ static int PrintElementDescriptionFromFile(char *filename, int start_line)
   int font_nr = FONT_TEXT_2;
   int font_width = getFontWidth(font_nr);
   int font_height = getFontHeight(font_nr);
-  int pad_x = ED_SETTINGS_XPOS(0);
-  int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+  int pad_x = ED_ELEMENT_SETTINGS_XPOS(0);
+  int pad_y = ED_ELEMENT_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
   int sx = SX + pad_x;
   int sy = SY + pad_y;
   int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
@@ -7118,8 +7131,8 @@ static void DrawPropertiesInfo()
   int font2_nr = FONT_TEXT_2;
   int font1_width = getFontWidth(font1_nr);
   int font2_height = getFontHeight(font2_nr);
-  int pad_x = ED_SETTINGS_XPOS(0);
-  int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+  int pad_x = ED_ELEMENT_SETTINGS_XPOS(0);
+  int pad_y = ED_ELEMENT_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
   int screen_line = 0;
   int i, x, y;
 
@@ -7330,7 +7343,7 @@ static void DrawPropertiesConfig()
       int counter_id = ED_COUNTER_ID_ELEMENT_VALUE1 + num_element_counters;
 
       counterbutton_info[counter_id].y =
-       ED_SETTINGS_YPOS((HAS_CONTENT(properties_element) ? 1 : 0) +
+       ED_ELEMENT_SETTINGS_YPOS((HAS_CONTENT(properties_element) ? 1 : 0) +
                         (CAN_GROW(properties_element) ? 1 : 0) +
                         (COULD_MOVE_INTO_ACID(properties_element) ? 1 : 0) +
                         (MAYBE_DONT_COLLIDE_WITH(properties_element) ? 1 : 0)+
@@ -7373,6 +7386,7 @@ static void DrawPropertiesConfig()
                         ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD);
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_INSTANT_RELOCATION);
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_PASS_TO_WALKABLE);
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_DOUBLE_SPEED);
   }
 
   if (IS_GEM(properties_element))
@@ -7385,9 +7399,9 @@ static void DrawPropertiesConfig()
   {
     /* set position for checkbutton for "can move into acid" */
     checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].x =
-      ED_SETTINGS_XPOS(IS_CUSTOM_ELEMENT(properties_element) ? 1 : 0);
+      ED_ELEMENT_SETTINGS_XPOS(IS_CUSTOM_ELEMENT(properties_element) ? 1 : 0);
     checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].y =
-      ED_SETTINGS_YPOS(IS_CUSTOM_ELEMENT(properties_element) ? 6 :
+      ED_ELEMENT_SETTINGS_YPOS(IS_CUSTOM_ELEMENT(properties_element) ? 6 :
                       HAS_CONTENT(properties_element) ? 1 : 0);
 
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID);
@@ -7402,7 +7416,7 @@ static void DrawPropertiesConfig()
   if (CAN_GROW(properties_element))
   {
     checkbutton_info[ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE].y =
-      ED_SETTINGS_YPOS(HAS_CONTENT(properties_element) ? 1 : 0);
+      ED_ELEMENT_SETTINGS_YPOS(HAS_CONTENT(properties_element) ? 1 : 0);
 
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE);
   }
@@ -7561,7 +7575,7 @@ static void DrawElementName(int x, int y, int element)
   int font_nr = FONT_TEXT_1;
   int font_width = getFontWidth(font_nr);
   int font_height = getFontHeight(font_nr);
-  int max_text_width = SXSIZE - x - ED_SETTINGS_XPOS(0);
+  int max_text_width = SXSIZE - x - ED_ELEMENT_SETTINGS_XPOS(0);
   int max_chars_per_line = max_text_width / font_width;
   char buffer[max_chars_per_line + 1];
 
index 3651ace4252b631058278db15b17c4a9ad544727..d616c10caf618e5fcdd8238e51b9cb335eb5d9f6 100644 (file)
@@ -111,9 +111,10 @@ void setElementChangeInfoToDefaults(struct ElementChangeInfo *change)
 static void setLevelInfoToDefaults(struct LevelInfo *level)
 {
   static boolean clipboard_elements_initialized = FALSE;
-
   int i, j, x, y;
 
+  setLevelInfoToDefaults_EM();
+
   level->native_em_level = &native_em_level;
 
   level->game_engine_type = GAME_ENGINE_TYPE_RND;
@@ -1808,7 +1809,7 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   lev->width  = MIN(level->fieldx, EM_MAX_CAVE_WIDTH);
   lev->height = MIN(level->fieldy, EM_MAX_CAVE_HEIGHT);
 
-  lev->time_initial     = level->time;
+  lev->time_initial     = level->time * 5;
   lev->required_initial = level->gems_needed;
 
   lev->emerald_score   = level->score[SC_EMERALD];
@@ -1819,7 +1820,8 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   lev->eater_score     = level->score[SC_YAMYAM];
   lev->nut_score       = level->score[SC_NUT];
   lev->dynamite_score  = level->score[SC_DYNAMITE];
-  lev->key_score       = level->score[SC_TIME_BONUS];  /* ??? CHECK THIS */
+  lev->key_score       = level->score[SC_KEY];
+  lev->exit_score      = level->score[SC_TIME_BONUS];
 
   for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
     for (y = 0; y < 3; y++)
@@ -1836,9 +1838,11 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   lev->ball_random             = level->ball_random;
   lev->ball_state_initial      = level->ball_state_initial;
   lev->ball_time               = level->ball_time;
+
   lev->lenses_score            = level->lenses_score;
   lev->magnify_score           = level->magnify_score;
   lev->slurp_score             = level->slurp_score;
+
   lev->lenses_time             = level->lenses_time;
   lev->magnify_time            = level->magnify_time;
   lev->wind_direction_initial  = level->wind_direction_initial;
@@ -1914,7 +1918,7 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
   level->fieldx = MIN(lev->width,  MAX_LEV_FIELDX);
   level->fieldy = MIN(lev->height, MAX_LEV_FIELDY);
 
-  level->time        = lev->time_initial;
+  level->time        = lev->time_initial / 5;
   level->gems_needed = lev->required_initial;
 
   sprintf(level->name, "Level %d", level->file_info.nr);
@@ -1927,7 +1931,8 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
   level->score[SC_YAMYAM]      = lev->eater_score;
   level->score[SC_NUT]         = lev->nut_score;
   level->score[SC_DYNAMITE]    = lev->dynamite_score;
-  level->score[SC_TIME_BONUS]  = lev->key_score;       /* ??? CHECK THIS */
+  level->score[SC_KEY]         = lev->key_score;
+  level->score[SC_TIME_BONUS]  = lev->exit_score;
 
   level->num_yamyam_contents = MAX_ELEMENT_CONTENTS;
 
@@ -1946,9 +1951,11 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
   level->ball_random           = lev->ball_random;
   level->ball_state_initial    = lev->ball_state_initial;
   level->ball_time             = lev->ball_time;
+
   level->lenses_score          = lev->lenses_score;
   level->magnify_score         = lev->magnify_score;
   level->slurp_score           = lev->slurp_score;
+
   level->lenses_time           = lev->lenses_time;
   level->magnify_time          = lev->magnify_time;
   level->wind_direction_initial        = lev->wind_direction_initial;
@@ -1975,6 +1982,10 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
   /* in case of both players set to the same field, use the first player */
   level->field[ply2->x_initial - 1][ply2->y_initial - 1] = EL_PLAYER_2;
   level->field[ply1->x_initial - 1][ply1->y_initial - 1] = EL_PLAYER_1;
+
+#if 1
+  printf("::: native Emerald Mine file version: %d\n", level_em->file_version);
+#endif
 }
 
 static void LoadLevelFromFileInfo_EM(struct LevelInfo *level,
index 087c63e25c7bc2b2b5ccf2f4964a1c495c9f2425..f280dbacc2825b7d973b4b34e22a264394f26232 100644 (file)
@@ -3134,8 +3134,15 @@ void Explode(int ex, int ey, int phase, int mode)
       return;
 #endif
 
+#if 1
+    if (mode == EX_TYPE_NORMAL ||
+       mode == EX_TYPE_CENTER ||
+       mode == EX_TYPE_CROSS)
+      PlayLevelSoundAction(ex, ey, ACTION_EXPLODING);
+#else
     if (mode == EX_TYPE_NORMAL || mode == EX_TYPE_CENTER)
       PlayLevelSoundAction(ex, ey, ACTION_EXPLODING);
+#endif
 
     /* remove things displayed in background while burning dynamite */
     if (Back[ex][ey] != EL_EMPTY && !IS_INDESTRUCTIBLE(Back[ex][ey]))
index 4f8500cc2b05758f7baa5bc783c00191cfb96f80..22ea317e33d146044806760c8389bef81ab38586 100644 (file)
@@ -6,11 +6,16 @@
 #include "global.h"
 #include "tile.h"
 #include "level.h"
-#include "file.h"
 
 
-static void setLevelInfoToDefaults_EM(void)
+struct LevelInfo_EM native_em_level;
+
+void setLevelInfoToDefaults_EM(void)
 {
+  int i;
+
+  native_em_level.file_version = FILE_VERSION_EM_ACTUAL;
+
   native_em_level.lev = &lev;
   native_em_level.ply1 = &ply1;
   native_em_level.ply2 = &ply2;
@@ -23,6 +28,27 @@ static void setLevelInfoToDefaults_EM(void)
 
   ply2.x_initial = 0;
   ply2.y_initial = 0;
+
+  lev.lenses_cnt_initial = 0;
+  lev.magnify_cnt_initial = 0;
+
+  lev.wheel_cnt_initial = 0;
+  lev.wheel_x_initial = 1;
+  lev.wheel_y_initial = 1;
+
+  lev.wind_time = 9999;
+  lev.wind_cnt_initial = 0;
+
+  lev.wonderwall_state_initial = 0;
+  lev.wonderwall_time_initial = 0;
+
+  for (i = 0; i < TILE_MAX; i++)
+    lev.android_array[i] = Xblank;
+
+  lev.home_initial = 1;                /* initial number of players in this level */
+
+  ply1.alive_initial = (lev.home_initial >= 1);
+  ply2.alive_initial = (lev.home_initial >= 2);
 }
 
 
@@ -37,6 +63,7 @@ boolean LoadNativeLevel_EM(char *filename)
 {
   unsigned char raw_leveldata[MAX_EM_LEVEL_SIZE];
   int raw_leveldata_length;
+  int file_version;
   FILE *file;
 
   /* always start with reliable default values */
@@ -60,14 +87,14 @@ boolean LoadNativeLevel_EM(char *filename)
     return FALSE;
   }
 
-  if (!cleanup_em_level(raw_leveldata, &raw_leveldata_length))
+  if (!(file_version = cleanup_em_level(raw_leveldata, raw_leveldata_length)))
   {
     Error(ERR_WARN, "unknown EM level '%s' -- using empty level", filename);
 
     return FALSE;
   }
 
-  convert_em_level(raw_leveldata);
+  convert_em_level(raw_leveldata, file_version);
   prepare_em_level();
 
   return TRUE;
index 3f86d332a3157c233d5127e621259ffd729a93b8..12d7f351220687318c3a1b9dc371efc0bd790915 100644 (file)
@@ -88,60 +88,64 @@ static unsigned char remap_v4eater[28] =
   146,147,175,65,66,64,2,18
 };
 
-boolean cleanup_em_level(unsigned char *src, int *length)
+int cleanup_em_level(unsigned char *src, int length)
 {
-  unsigned int i;
+  int file_version = 0;
+  int i;
 
-  if (*length >= 2172 &&
+  if (length >= 2172 &&
       src[2106] == 255 &&
       src[2107] == 54 &&
       src[2108] == 48 &&
       src[2109] == 48)
   {
+    /* ---------- this cave has V6 file format ---------- */
+    file_version = FILE_VERSION_EM_V6;
+
     for (i = 0; i < 2048; i++)
       src[i] = remap_v6[src[i]];
     for (i = 2048; i < 2084; i++)
       src[i] = remap_v6[src[i]];
     for (i = 2112; i < 2148; i++)
       src[i] = remap_v6[src[i]];
-
-    goto v6;
   }
-
-  if (*length >= 2110 &&
-      src[2106] == 255 &&
-      src[2107] == 53 &&
-      src[2108] == 48 &&
-      src[2109] == 48)
+  else if (length >= 2110 &&
+          src[2106] == 255 &&
+          src[2107] == 53 &&
+          src[2108] == 48 &&
+          src[2109] == 48)
   {
+    /* ---------- this cave has V5 file format ---------- */
+    file_version = FILE_VERSION_EM_V5;
+
     for (i = 0; i < 2048; i++)
       src[i] = remap_v5[src[i]];
     for (i = 2048; i < 2084; i++)
       src[i] = remap_v5[src[i]];
     for (i = 2112; i < 2148; i++)
       src[i] = src[i - 64];
-
-    goto v5;
   }
-
-  if (*length >= 2106 &&
-      src[1983] == 116)
+  else if (length >= 2106 &&
+          src[1983] == 116)
   {
+    /* ---------- this cave has V4 file format ---------- */
+    file_version = FILE_VERSION_EM_V4;
+
     for (i = 0; i < 2048; i++)
       src[i] = remap_v4[src[i]];
     for (i = 2048; i < 2084; i++)
       src[i] = remap_v4eater[src[i] >= 28 ? 0 : src[i]];
     for (i = 2112; i < 2148; i++) src[i] = src[i - 64];
-
-    goto v4;
   }
-
-  if (*length >= 2106 &&
-      src[0] == 241 &&
-      src[1983] == 27)
+  else if (length >= 2106 &&
+          src[0] == 241 &&
+          src[1983] == 27)
   {
     unsigned char j = 94;
 
+    /* ---------- this cave has V3 file format ---------- */
+    file_version = FILE_VERSION_EM_V3;
+
     for (i = 0; i < 2106; i++)
       src[i] = (src[i] ^ (j += 7)) - 0x11;
     src[1] = 131;
@@ -151,34 +155,35 @@ boolean cleanup_em_level(unsigned char *src, int *length)
       src[i] = remap_v4eater[src[i] >= 28 ? 0 : src[i]];
     for (i = 2112; i < 2148; i++)
       src[i] = src[i - 64];
-
-    goto v3;
   }
+  else
+  {
+    /* ---------- this cave has unknown file format ---------- */
 
-  return FALSE;                /* unrecognized cave */
-
- v3:
- v4:
- v5:
-
-  /* id */
-  src[2106] = 255;
-  src[2107] = 54;
-  src[2108] = 48;
-  src[2109] = 48;
-
-  /* time */
-  i = src[2094] * 10;
-  src[2110] = i >> 8;
-  src[2111] = i;
-
-  for (i = 2148; i < 2172; i++)
-    src[i] = 0;
+    return 0;
+  }
 
-  /* ball data */
-  src[2159] = 128;
+  if (file_version < FILE_VERSION_EM_V6)
+  {
+    /* id */
+    src[2106] = 255;
+    src[2107] = 54;
+    src[2108] = 48;
+    src[2109] = 48;
+
+    /* time */
+    i = src[2094] * 10;
+    src[2110] = i >> 8;
+    src[2111] = i;
+
+    for (i = 2148; i < 2172; i++)
+      src[i] = 0;
+
+    /* ball data */
+    src[2159] = 128;
+  }
 
- v6:
+  /* ---------- at this stage, the cave data always has V6 format ---------- */
 
   /* fix wheel */
   for (i = 0; i < 2048; i++)
@@ -319,9 +324,9 @@ boolean cleanup_em_level(unsigned char *src, int *length)
   src[2168] &= 31;
 
   /* size of v6 cave */
-  *length = 2172;
+  length = 2172;
 
-  return TRUE;
+  return file_version;
 }
 
 /* 2000-07-30T00:26:00Z
@@ -421,7 +426,7 @@ static unsigned short remap_emerald[256] =
   Xblank, Xblank, Xblank, Xblank, Xblank, Xblank, Xblank, Xblank,
 };
 
-void convert_em_level(unsigned char *src)
+void convert_em_level(unsigned char *src, int file_version)
 {
   static int eater_offset[8] =
   {
@@ -469,17 +474,9 @@ void convert_em_level(unsigned char *src)
   lev.slurp_score = src[0x869];
 
   lev.lenses_time = src[0x86A] << 8 | src[0x86B];
-  lev.lenses_cnt_initial = 0;
-
   lev.magnify_time = src[0x86C] << 8 | src[0x86D];
-  lev.magnify_cnt_initial = 0;
-
   lev.wheel_time = src[0x838] << 8 | src[0x839];
-  lev.wheel_cnt_initial = 0;
-  lev.wheel_x_initial = 1;
-  lev.wheel_y_initial = 1;
 
-  lev.wind_time = 9999;
   lev.wind_cnt_initial = src[0x865] & 15 ? lev.wind_time : 0;
   temp = src[0x865];
   lev.wind_direction_initial = (temp & 8 ? 0 :
@@ -487,7 +484,6 @@ void convert_em_level(unsigned char *src)
                                temp & 2 ? 2 :
                                temp & 4 ? 3 : 0);
 
-  lev.wonderwall_state_initial = 0;
   lev.wonderwall_time_initial = src[0x836] << 8 | src[0x837];
 
   for (i = 0; i < 8; i++)
@@ -515,9 +511,6 @@ void convert_em_level(unsigned char *src)
     }
   }
 
-  for (temp = 0; temp < TILE_MAX; temp++)
-    lev.android_array[temp] = Xblank;
-
   temp = src[0x878] << 8 | src[0x879];
 
   if (temp & 1)
@@ -748,11 +741,6 @@ void convert_em_level(unsigned char *src)
     }
   }
 
-  lev.home_initial = 1;                /* initial number of players in this level */
-
-  ply1.alive_initial = (lev.home_initial >= 1);
-  ply2.alive_initial = (lev.home_initial >= 2);
-
   /* first fill the complete playfield with the default border element */
   for (y = 0; y < HEIGHT; y++)
     for (x = 0; x < WIDTH; x++)
@@ -769,6 +757,8 @@ void convert_em_level(unsigned char *src)
     native_em_level.cave[ply1.x_initial][ply1.y_initial] = Zplayer;
   if (ply2.alive_initial)
     native_em_level.cave[ply2.x_initial][ply2.y_initial] = Zplayer;
+
+  native_em_level.file_version = file_version;
 }
 
 void prepare_em_level(void)
diff --git a/src/game_em/file.h b/src/game_em/file.h
deleted file mode 100644 (file)
index adf69a5..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef FILE_H
-#define FILE_H
-
-/* 2000-09-28T09:07:50Z */
-
-#include "global.h"
-
-struct cave_node
-{
-  struct cave_node *next;
-  char path[MAXNAME+2];
-  char name[32];
-};
-
-extern struct cave_node *cave_list;
-
-#endif
index fd003ffbb231e60ba1ffb80867c796db1ba6ab30..5595d26ca0b1eb3fd6d5711331a25cf6f068c5d0 100644 (file)
@@ -44,6 +44,7 @@ extern void em_close_all();
 extern void InitGameEngine_EM();
 extern void GameActions_EM(byte);
 
+void setLevelInfoToDefaults_EM();
 boolean LoadNativeLevel_EM(char *);
 
 
index bf4d26ed1af9a3cfeb8b77ca4b76aedaf610b4eb..88c6a5e22f5f55046161abf07eacd95520cadba0 100644 (file)
@@ -45,12 +45,12 @@ void synchro_1(void);
 void synchro_2(void);
 void synchro_3(void);
 
-boolean cleanup_em_level(unsigned char *src, int *length);
-void    convert_em_level(unsigned char *src);
-void    prepare_em_level(void);
+int  cleanup_em_level(unsigned char *, int);
+void convert_em_level(unsigned char *, int);
+void prepare_em_level(void);
 
 int sound_thread(void);
-int read_sample(char *name, short **data, long *length);
+int read_sample(char *, short **, long *);
 
 void read_cave_list(void);
 void free_cave_list(void);
index f04718f7e4a5b19000c457551d1355ee342cd2ec..98a896e191209aae6604c238e9125e82f0c25276 100644 (file)
@@ -14,8 +14,6 @@ struct PLAYER ply1;
 struct PLAYER ply2;
 struct LEVEL lev;
 
-struct LevelInfo_EM native_em_level;
-
 unsigned short **Boom;
 unsigned short **Cave;
 unsigned short **Next;
index f54f5d407ae67be4055e9323f44a8b2be7bc349c..abf566f03ac92dacba42f7605b98ac7f4dad3bfd 100644 (file)
@@ -560,8 +560,23 @@ struct PLAYER
   unsigned joy_spin:1;
 };
 
+
+/* ------------------------------------------------------------------------- */
+/* definitions and structures for use by the main game functions             */
+/* ------------------------------------------------------------------------- */
+
+/* values for native Emerald Mine game version */
+#define FILE_VERSION_EM_V3     3
+#define FILE_VERSION_EM_V4     4
+#define FILE_VERSION_EM_V5     5
+#define FILE_VERSION_EM_V6     6
+
+#define FILE_VERSION_EM_ACTUAL FILE_VERSION_EM_V6
+
 struct LevelInfo_EM
 {
+  int file_version;
+
   struct LEVEL *lev;
   struct PLAYER *ply1, *ply2;
 
index a8ff691a2d65828392b9d1d53dc77861bba46bd7..640822f15623794a1eb5d848b2fc26b8d057fbe2 100644 (file)
@@ -87,8 +87,8 @@ static int test(struct PLAYER *ply)
   if (!ply->alive)
     return 0;
 
-  if (lev.time == 0)
-    return(1);
+  if (lev.time_initial > 0 && lev.time == 0)
+    return 1;
 
   switch(Cave[y-1][x])
   {
@@ -108,7 +108,7 @@ static int test(struct PLAYER *ply)
     case Xtank_goe:
     case Xtank_gos:
     case Xtank_gow:
-      return(1);
+      return 1;
   }
 
   switch(Cave[y][x+1])
@@ -129,7 +129,7 @@ static int test(struct PLAYER *ply)
     case Xtank_goe:
     case Xtank_gos:
     case Xtank_gow:
-      return(1);
+      return 1;
   }
 
   switch(Cave[y+1][x])
@@ -150,7 +150,7 @@ static int test(struct PLAYER *ply)
     case Xtank_goe:
     case Xtank_gos:
     case Xtank_gow:
-      return(1);
+      return 1;
   }
 
   switch(Cave[y][x-1])
@@ -171,7 +171,7 @@ static int test(struct PLAYER *ply)
     case Xtank_goe:
     case Xtank_gos:
     case Xtank_gow:
-      return(1);
+      return 1;
   }
 
   switch(Cave[y][x])
@@ -184,10 +184,10 @@ static int test(struct PLAYER *ply)
     case Xdynamite_2:
     case Xdynamite_3:
     case Xdynamite_4:
-      return(0);
+      return 0;
   }
 
-  return(1);
+  return 1;
 }
 
 static void die(struct PLAYER *ply)
@@ -987,8 +987,8 @@ static void player(struct PLAYER *ply)
       case Xexit_2:
       case Xexit_3:
        play_element_sound(x, y, SAMPLE_exit, Xexit_1);
-       if (--lev.home == 0)
-         lev.score += lev.time * lev.exit_score / 100;
+       if (--lev.home == 0 && lev.time_initial > 0)
+           lev.score += lev.time * lev.exit_score / 100;
        ply->anim = SPR_walk + anim;
        ply->x = x;
        ply->y = y;
index af7d9f8fcafa36cf86cd17a6b8c6a6d59b4d0669..f094ceebc3684c42cbed64fe4d229c82acc52472 100644 (file)
@@ -22,8 +22,16 @@ void synchro_3(void)
   if (lev.score > 9999)
     lev.score = 9999;
 
+#if 1
+  if (lev.time_initial == 0)
+    lev.time++;
+  else if (lev.time)
+    lev.time--;
+#else
   if (lev.time)
     lev.time--;
+#endif
+
   if (lev.android_move_cnt-- == 0)
     lev.android_move_cnt = lev.android_move_time;
   if (lev.android_clone_cnt-- == 0)
@@ -42,7 +50,8 @@ void synchro_3(void)
   if (lev.wonderwall_time && lev.wonderwall_state)
     lev.wonderwall_time--;
 
-  if (lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0)
+  if (lev.time_initial > 0 &&
+      lev.time > 0 && lev.time <= 50 && lev.time % 5 == 0)
     play_sound(-1, -1, SAMPLE_time);
 
   if (lev.wheel_cnt)
index 3431719caeb799898974860d5982cced01e4df71..57de63e72a36c581eb0a818a86fe301794d1817c 100644 (file)
@@ -1101,16 +1101,23 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
   if (gi->type & GD_TYPE_SCROLLBAR)
   {
     struct GadgetScrollbar *gs = &gi->scrollbar;
+    int scrollbar_size_cmp;
 
     if (gi->width == 0 || gi->height == 0 ||
        gs->items_max == 0 || gs->items_visible == 0)
       Error(ERR_EXIT, "scrollbar gadget incomplete (missing tags)");
 
     /* calculate internal scrollbar values */
+    gs->size_min = (gi->type == GD_TYPE_SCROLLBAR_VERTICAL ?
+                   gi->width : gi->height);
     gs->size_max = (gi->type == GD_TYPE_SCROLLBAR_VERTICAL ?
                    gi->height : gi->width);
-    gs->size = gs->size_max * gs->items_visible / gs->items_max;
-    gs->position = gs->size_max * gs->item_position / gs->items_max;
+
+    scrollbar_size_cmp = gs->size_max * gs->items_visible / gs->items_max;
+    gs->size = MAX(scrollbar_size_cmp, gs->size_min);
+    gs->size_max_cmp = (gs->size_max - (gs->size - scrollbar_size_cmp));
+
+    gs->position = gs->size_max_cmp * gs->item_position / gs->items_max;
     gs->position_max = gs->size_max - gs->size;
     gs->correction = gs->size_max / gs->items_max / 2;
 
@@ -1789,7 +1796,7 @@ boolean HandleGadgets(int mx, int my, int button)
        gs->position = gs->position_max;
 
       gs->item_position =
-       gs->items_max * (gs->position + gs->correction) / gs->size_max;
+       gs->items_max * (gs->position + gs->correction) / gs->size_max_cmp;
 
       if (gs->item_position < 0)
        gs->item_position = 0;
index 5c71680466463186c3c910691ad22b1200e5be9e..ec03d0b724f349a8e65d1c9f27ab36e99e1ac85e 100644 (file)
@@ -195,7 +195,9 @@ struct GadgetScrollbar
   int items_max;                       /* number of items to access */
   int items_visible;                   /* number of visible items */
   int item_position;                   /* actual item position */
+  int size_min;                                /* minimal scrollbar size */
   int size_max;                                /* this is either width or height */
+  int size_max_cmp;                    /* needed for minimal scrollbar size */
   int size;                            /* scrollbar size on screen */
   int position;                                /* scrollbar position on screen */
   int position_max;                    /* bottom/right scrollbar position */
index e12649efc4ad7e3b3d96322a7af34fb0a3fb6c8e..1ec25ad6fd2295d8e2010f2568ef198f575eaa6a 100644 (file)
@@ -1518,11 +1518,11 @@ struct LevelInfo
 {
   struct LevelFileInfo file_info;
 
-  /* level stored in native format for the native game engines */
-  struct LevelInfo_EM *native_em_level;
-
   int game_engine_type;
 
+  /* level stored in native format for the alternative native game engines */
+  struct LevelInfo_EM *native_em_level;
+
   int file_version;    /* file format version the level is stored with    */
   int game_version;    /* game release version the level was created with */