rnd-20080802-1-src
authorHolger Schemel <info@artsoft.org>
Sat, 2 Aug 2008 15:35:31 +0000 (17:35 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:57:06 +0000 (10:57 +0200)
* fixed some bugs regarding the new level/CE random seed reset options

12 files changed:
ChangeLog
src/conftime.h
src/editor.c
src/events.c
src/files.c
src/game.c
src/libgame/misc.c
src/libgame/misc.h
src/main.h
src/network.c
src/screens.c
src/tape.c

index a002c20557aa3f44ffeed4188911e56eeb003a29..8349425ea1bef0e7f925aa04d6c1a42f24edc76a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
+2008-08-02
+       * fixed some bugs regarding the new level/CE random seed reset options
+
 2008-07-14
        * moved "level settings" and "editor settings" to two tabbed screens in
          level editor to gain space for additional level property settings
+       * added level setting to start a level with always the same random seed
+       * added CE action "set random seed" to re-initialize random seed in game
+         (this is the only CE action that gets executed before the CE changes,
+         which is needed to use the newly set random seed during the CE change)
 
 2008-06-16
        * fixed redraw problem of special editor door when playing from editor
index a2b0bd32f7432916eb33df53b891602f75679a20..13218c2c73fba9e6de96cffaa029eb8ad7e0da4b 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2008-07-14 17:08"
+#define COMPILE_DATE_STRING "2008-08-02 17:34"
index 995d15fe8391f0a9fc402981c75adedbff3d057b..5fb4dd93b4444f26017086e13c78fbcd145dee6c 100644 (file)
 #define GADGET_ID_LEVEL_TIMESCORE_DOWN (GADGET_ID_COUNTER_FIRST + 18)
 #define GADGET_ID_LEVEL_TIMESCORE_TEXT (GADGET_ID_COUNTER_FIRST + 19)
 #define GADGET_ID_LEVEL_TIMESCORE_UP   (GADGET_ID_COUNTER_FIRST + 20)
-#define GADGET_ID_ELEMENT_VALUE1_DOWN  (GADGET_ID_COUNTER_FIRST + 21)
-#define GADGET_ID_ELEMENT_VALUE1_TEXT  (GADGET_ID_COUNTER_FIRST + 22)
-#define GADGET_ID_ELEMENT_VALUE1_UP    (GADGET_ID_COUNTER_FIRST + 23)
-#define GADGET_ID_ELEMENT_VALUE2_DOWN  (GADGET_ID_COUNTER_FIRST + 24)
-#define GADGET_ID_ELEMENT_VALUE2_TEXT  (GADGET_ID_COUNTER_FIRST + 25)
-#define GADGET_ID_ELEMENT_VALUE2_UP    (GADGET_ID_COUNTER_FIRST + 26)
-#define GADGET_ID_ELEMENT_VALUE3_DOWN  (GADGET_ID_COUNTER_FIRST + 27)
-#define GADGET_ID_ELEMENT_VALUE3_TEXT  (GADGET_ID_COUNTER_FIRST + 28)
-#define GADGET_ID_ELEMENT_VALUE3_UP    (GADGET_ID_COUNTER_FIRST + 29)
-#define GADGET_ID_ELEMENT_VALUE4_DOWN  (GADGET_ID_COUNTER_FIRST + 30)
-#define GADGET_ID_ELEMENT_VALUE4_TEXT  (GADGET_ID_COUNTER_FIRST + 31)
-#define GADGET_ID_ELEMENT_VALUE4_UP    (GADGET_ID_COUNTER_FIRST + 32)
-#define GADGET_ID_YAMYAM_CONTENT_DOWN  (GADGET_ID_COUNTER_FIRST + 33)
-#define GADGET_ID_YAMYAM_CONTENT_TEXT  (GADGET_ID_COUNTER_FIRST + 34)
-#define GADGET_ID_YAMYAM_CONTENT_UP    (GADGET_ID_COUNTER_FIRST + 35)
-#define GADGET_ID_BALL_CONTENT_DOWN    (GADGET_ID_COUNTER_FIRST + 36)
-#define GADGET_ID_BALL_CONTENT_TEXT    (GADGET_ID_COUNTER_FIRST + 37)
-#define GADGET_ID_BALL_CONTENT_UP      (GADGET_ID_COUNTER_FIRST + 38)
-#define GADGET_ID_ANDROID_CONTENT_DOWN (GADGET_ID_COUNTER_FIRST + 39)
-#define GADGET_ID_ANDROID_CONTENT_TEXT (GADGET_ID_COUNTER_FIRST + 40)
-#define GADGET_ID_ANDROID_CONTENT_UP   (GADGET_ID_COUNTER_FIRST + 41)
-#define GADGET_ID_ENVELOPE_XSIZE_DOWN  (GADGET_ID_COUNTER_FIRST + 42)
-#define GADGET_ID_ENVELOPE_XSIZE_TEXT  (GADGET_ID_COUNTER_FIRST + 43)
-#define GADGET_ID_ENVELOPE_XSIZE_UP    (GADGET_ID_COUNTER_FIRST + 44)
-#define GADGET_ID_ENVELOPE_YSIZE_DOWN  (GADGET_ID_COUNTER_FIRST + 45)
-#define GADGET_ID_ENVELOPE_YSIZE_TEXT  (GADGET_ID_COUNTER_FIRST + 46)
-#define GADGET_ID_ENVELOPE_YSIZE_UP    (GADGET_ID_COUNTER_FIRST + 47)
-#define GADGET_ID_INVENTORY_SIZE_DOWN  (GADGET_ID_COUNTER_FIRST + 48)
-#define GADGET_ID_INVENTORY_SIZE_TEXT  (GADGET_ID_COUNTER_FIRST + 49)
-#define GADGET_ID_INVENTORY_SIZE_UP    (GADGET_ID_COUNTER_FIRST + 50)
-#define GADGET_ID_CUSTOM_SCORE_DOWN    (GADGET_ID_COUNTER_FIRST + 51)
-#define GADGET_ID_CUSTOM_SCORE_TEXT    (GADGET_ID_COUNTER_FIRST + 52)
-#define GADGET_ID_CUSTOM_SCORE_UP      (GADGET_ID_COUNTER_FIRST + 53)
-#define GADGET_ID_CUSTOM_GEMCOUNT_DOWN (GADGET_ID_COUNTER_FIRST + 54)
-#define GADGET_ID_CUSTOM_GEMCOUNT_TEXT (GADGET_ID_COUNTER_FIRST + 55)
-#define GADGET_ID_CUSTOM_GEMCOUNT_UP   (GADGET_ID_COUNTER_FIRST + 56)
-#define GADGET_ID_CUSTOM_VALUE_FIX_DOWN        (GADGET_ID_COUNTER_FIRST + 57)
-#define GADGET_ID_CUSTOM_VALUE_FIX_TEXT        (GADGET_ID_COUNTER_FIRST + 58)
-#define GADGET_ID_CUSTOM_VALUE_FIX_UP  (GADGET_ID_COUNTER_FIRST + 59)
-#define GADGET_ID_CUSTOM_VALUE_RND_DOWN        (GADGET_ID_COUNTER_FIRST + 60)
-#define GADGET_ID_CUSTOM_VALUE_RND_TEXT        (GADGET_ID_COUNTER_FIRST + 61)
-#define GADGET_ID_CUSTOM_VALUE_RND_UP  (GADGET_ID_COUNTER_FIRST + 62)
-#define GADGET_ID_PUSH_DELAY_FIX_DOWN  (GADGET_ID_COUNTER_FIRST + 63)
-#define GADGET_ID_PUSH_DELAY_FIX_TEXT  (GADGET_ID_COUNTER_FIRST + 64)
-#define GADGET_ID_PUSH_DELAY_FIX_UP    (GADGET_ID_COUNTER_FIRST + 65)
-#define GADGET_ID_PUSH_DELAY_RND_DOWN  (GADGET_ID_COUNTER_FIRST + 66)
-#define GADGET_ID_PUSH_DELAY_RND_TEXT  (GADGET_ID_COUNTER_FIRST + 67)
-#define GADGET_ID_PUSH_DELAY_RND_UP    (GADGET_ID_COUNTER_FIRST + 68)
-#define GADGET_ID_DROP_DELAY_FIX_DOWN  (GADGET_ID_COUNTER_FIRST + 69)
-#define GADGET_ID_DROP_DELAY_FIX_TEXT  (GADGET_ID_COUNTER_FIRST + 70)
-#define GADGET_ID_DROP_DELAY_FIX_UP    (GADGET_ID_COUNTER_FIRST + 71)
-#define GADGET_ID_DROP_DELAY_RND_DOWN  (GADGET_ID_COUNTER_FIRST + 72)
-#define GADGET_ID_DROP_DELAY_RND_TEXT  (GADGET_ID_COUNTER_FIRST + 73)
-#define GADGET_ID_DROP_DELAY_RND_UP    (GADGET_ID_COUNTER_FIRST + 74)
-#define GADGET_ID_MOVE_DELAY_FIX_DOWN  (GADGET_ID_COUNTER_FIRST + 75)
-#define GADGET_ID_MOVE_DELAY_FIX_TEXT  (GADGET_ID_COUNTER_FIRST + 76)
-#define GADGET_ID_MOVE_DELAY_FIX_UP    (GADGET_ID_COUNTER_FIRST + 77)
-#define GADGET_ID_MOVE_DELAY_RND_DOWN  (GADGET_ID_COUNTER_FIRST + 78)
-#define GADGET_ID_MOVE_DELAY_RND_TEXT  (GADGET_ID_COUNTER_FIRST + 79)
-#define GADGET_ID_MOVE_DELAY_RND_UP    (GADGET_ID_COUNTER_FIRST + 80)
-#define GADGET_ID_EXPLOSION_DELAY_DOWN (GADGET_ID_COUNTER_FIRST + 81)
-#define GADGET_ID_EXPLOSION_DELAY_TEXT (GADGET_ID_COUNTER_FIRST + 82)
-#define GADGET_ID_EXPLOSION_DELAY_UP   (GADGET_ID_COUNTER_FIRST + 83)
-#define GADGET_ID_IGNITION_DELAY_DOWN  (GADGET_ID_COUNTER_FIRST + 84)
-#define GADGET_ID_IGNITION_DELAY_TEXT  (GADGET_ID_COUNTER_FIRST + 85)
-#define GADGET_ID_IGNITION_DELAY_UP    (GADGET_ID_COUNTER_FIRST + 86)
-#define GADGET_ID_CHANGE_DELAY_FIX_DOWN        (GADGET_ID_COUNTER_FIRST + 87)
-#define GADGET_ID_CHANGE_DELAY_FIX_TEXT        (GADGET_ID_COUNTER_FIRST + 88)
-#define GADGET_ID_CHANGE_DELAY_FIX_UP  (GADGET_ID_COUNTER_FIRST + 89)
-#define GADGET_ID_CHANGE_DELAY_RND_DOWN        (GADGET_ID_COUNTER_FIRST + 90)
-#define GADGET_ID_CHANGE_DELAY_RND_TEXT        (GADGET_ID_COUNTER_FIRST + 91)
-#define GADGET_ID_CHANGE_DELAY_RND_UP  (GADGET_ID_COUNTER_FIRST + 92)
-#define GADGET_ID_CHANGE_CONT_RND_DOWN (GADGET_ID_COUNTER_FIRST + 93)
-#define GADGET_ID_CHANGE_CONT_RND_TEXT (GADGET_ID_COUNTER_FIRST + 94)
-#define GADGET_ID_CHANGE_CONT_RND_UP   (GADGET_ID_COUNTER_FIRST + 95)
-#define GADGET_ID_GROUP_CONTENT_DOWN   (GADGET_ID_COUNTER_FIRST + 96)
-#define GADGET_ID_GROUP_CONTENT_TEXT   (GADGET_ID_COUNTER_FIRST + 97)
-#define GADGET_ID_GROUP_CONTENT_UP     (GADGET_ID_COUNTER_FIRST + 98)
+#define GADGET_ID_LEVEL_RANDOM_SEED_DOWN (GADGET_ID_COUNTER_FIRST + 21)
+#define GADGET_ID_LEVEL_RANDOM_SEED_TEXT (GADGET_ID_COUNTER_FIRST + 22)
+#define GADGET_ID_LEVEL_RANDOM_SEED_UP (GADGET_ID_COUNTER_FIRST + 23)
+#define GADGET_ID_ELEMENT_VALUE1_DOWN  (GADGET_ID_COUNTER_FIRST + 24)
+#define GADGET_ID_ELEMENT_VALUE1_TEXT  (GADGET_ID_COUNTER_FIRST + 25)
+#define GADGET_ID_ELEMENT_VALUE1_UP    (GADGET_ID_COUNTER_FIRST + 26)
+#define GADGET_ID_ELEMENT_VALUE2_DOWN  (GADGET_ID_COUNTER_FIRST + 27)
+#define GADGET_ID_ELEMENT_VALUE2_TEXT  (GADGET_ID_COUNTER_FIRST + 28)
+#define GADGET_ID_ELEMENT_VALUE2_UP    (GADGET_ID_COUNTER_FIRST + 29)
+#define GADGET_ID_ELEMENT_VALUE3_DOWN  (GADGET_ID_COUNTER_FIRST + 30)
+#define GADGET_ID_ELEMENT_VALUE3_TEXT  (GADGET_ID_COUNTER_FIRST + 31)
+#define GADGET_ID_ELEMENT_VALUE3_UP    (GADGET_ID_COUNTER_FIRST + 32)
+#define GADGET_ID_ELEMENT_VALUE4_DOWN  (GADGET_ID_COUNTER_FIRST + 33)
+#define GADGET_ID_ELEMENT_VALUE4_TEXT  (GADGET_ID_COUNTER_FIRST + 34)
+#define GADGET_ID_ELEMENT_VALUE4_UP    (GADGET_ID_COUNTER_FIRST + 35)
+#define GADGET_ID_YAMYAM_CONTENT_DOWN  (GADGET_ID_COUNTER_FIRST + 36)
+#define GADGET_ID_YAMYAM_CONTENT_TEXT  (GADGET_ID_COUNTER_FIRST + 37)
+#define GADGET_ID_YAMYAM_CONTENT_UP    (GADGET_ID_COUNTER_FIRST + 38)
+#define GADGET_ID_BALL_CONTENT_DOWN    (GADGET_ID_COUNTER_FIRST + 39)
+#define GADGET_ID_BALL_CONTENT_TEXT    (GADGET_ID_COUNTER_FIRST + 40)
+#define GADGET_ID_BALL_CONTENT_UP      (GADGET_ID_COUNTER_FIRST + 41)
+#define GADGET_ID_ANDROID_CONTENT_DOWN (GADGET_ID_COUNTER_FIRST + 42)
+#define GADGET_ID_ANDROID_CONTENT_TEXT (GADGET_ID_COUNTER_FIRST + 43)
+#define GADGET_ID_ANDROID_CONTENT_UP   (GADGET_ID_COUNTER_FIRST + 44)
+#define GADGET_ID_ENVELOPE_XSIZE_DOWN  (GADGET_ID_COUNTER_FIRST + 45)
+#define GADGET_ID_ENVELOPE_XSIZE_TEXT  (GADGET_ID_COUNTER_FIRST + 46)
+#define GADGET_ID_ENVELOPE_XSIZE_UP    (GADGET_ID_COUNTER_FIRST + 47)
+#define GADGET_ID_ENVELOPE_YSIZE_DOWN  (GADGET_ID_COUNTER_FIRST + 48)
+#define GADGET_ID_ENVELOPE_YSIZE_TEXT  (GADGET_ID_COUNTER_FIRST + 49)
+#define GADGET_ID_ENVELOPE_YSIZE_UP    (GADGET_ID_COUNTER_FIRST + 50)
+#define GADGET_ID_INVENTORY_SIZE_DOWN  (GADGET_ID_COUNTER_FIRST + 51)
+#define GADGET_ID_INVENTORY_SIZE_TEXT  (GADGET_ID_COUNTER_FIRST + 52)
+#define GADGET_ID_INVENTORY_SIZE_UP    (GADGET_ID_COUNTER_FIRST + 53)
+#define GADGET_ID_CUSTOM_SCORE_DOWN    (GADGET_ID_COUNTER_FIRST + 54)
+#define GADGET_ID_CUSTOM_SCORE_TEXT    (GADGET_ID_COUNTER_FIRST + 55)
+#define GADGET_ID_CUSTOM_SCORE_UP      (GADGET_ID_COUNTER_FIRST + 56)
+#define GADGET_ID_CUSTOM_GEMCOUNT_DOWN (GADGET_ID_COUNTER_FIRST + 57)
+#define GADGET_ID_CUSTOM_GEMCOUNT_TEXT (GADGET_ID_COUNTER_FIRST + 58)
+#define GADGET_ID_CUSTOM_GEMCOUNT_UP   (GADGET_ID_COUNTER_FIRST + 59)
+#define GADGET_ID_CUSTOM_VALUE_FIX_DOWN        (GADGET_ID_COUNTER_FIRST + 60)
+#define GADGET_ID_CUSTOM_VALUE_FIX_TEXT        (GADGET_ID_COUNTER_FIRST + 61)
+#define GADGET_ID_CUSTOM_VALUE_FIX_UP  (GADGET_ID_COUNTER_FIRST + 62)
+#define GADGET_ID_CUSTOM_VALUE_RND_DOWN        (GADGET_ID_COUNTER_FIRST + 63)
+#define GADGET_ID_CUSTOM_VALUE_RND_TEXT        (GADGET_ID_COUNTER_FIRST + 64)
+#define GADGET_ID_CUSTOM_VALUE_RND_UP  (GADGET_ID_COUNTER_FIRST + 65)
+#define GADGET_ID_PUSH_DELAY_FIX_DOWN  (GADGET_ID_COUNTER_FIRST + 66)
+#define GADGET_ID_PUSH_DELAY_FIX_TEXT  (GADGET_ID_COUNTER_FIRST + 67)
+#define GADGET_ID_PUSH_DELAY_FIX_UP    (GADGET_ID_COUNTER_FIRST + 68)
+#define GADGET_ID_PUSH_DELAY_RND_DOWN  (GADGET_ID_COUNTER_FIRST + 69)
+#define GADGET_ID_PUSH_DELAY_RND_TEXT  (GADGET_ID_COUNTER_FIRST + 70)
+#define GADGET_ID_PUSH_DELAY_RND_UP    (GADGET_ID_COUNTER_FIRST + 71)
+#define GADGET_ID_DROP_DELAY_FIX_DOWN  (GADGET_ID_COUNTER_FIRST + 72)
+#define GADGET_ID_DROP_DELAY_FIX_TEXT  (GADGET_ID_COUNTER_FIRST + 73)
+#define GADGET_ID_DROP_DELAY_FIX_UP    (GADGET_ID_COUNTER_FIRST + 74)
+#define GADGET_ID_DROP_DELAY_RND_DOWN  (GADGET_ID_COUNTER_FIRST + 75)
+#define GADGET_ID_DROP_DELAY_RND_TEXT  (GADGET_ID_COUNTER_FIRST + 76)
+#define GADGET_ID_DROP_DELAY_RND_UP    (GADGET_ID_COUNTER_FIRST + 77)
+#define GADGET_ID_MOVE_DELAY_FIX_DOWN  (GADGET_ID_COUNTER_FIRST + 78)
+#define GADGET_ID_MOVE_DELAY_FIX_TEXT  (GADGET_ID_COUNTER_FIRST + 79)
+#define GADGET_ID_MOVE_DELAY_FIX_UP    (GADGET_ID_COUNTER_FIRST + 80)
+#define GADGET_ID_MOVE_DELAY_RND_DOWN  (GADGET_ID_COUNTER_FIRST + 81)
+#define GADGET_ID_MOVE_DELAY_RND_TEXT  (GADGET_ID_COUNTER_FIRST + 82)
+#define GADGET_ID_MOVE_DELAY_RND_UP    (GADGET_ID_COUNTER_FIRST + 83)
+#define GADGET_ID_EXPLOSION_DELAY_DOWN (GADGET_ID_COUNTER_FIRST + 84)
+#define GADGET_ID_EXPLOSION_DELAY_TEXT (GADGET_ID_COUNTER_FIRST + 85)
+#define GADGET_ID_EXPLOSION_DELAY_UP   (GADGET_ID_COUNTER_FIRST + 86)
+#define GADGET_ID_IGNITION_DELAY_DOWN  (GADGET_ID_COUNTER_FIRST + 87)
+#define GADGET_ID_IGNITION_DELAY_TEXT  (GADGET_ID_COUNTER_FIRST + 88)
+#define GADGET_ID_IGNITION_DELAY_UP    (GADGET_ID_COUNTER_FIRST + 89)
+#define GADGET_ID_CHANGE_DELAY_FIX_DOWN        (GADGET_ID_COUNTER_FIRST + 90)
+#define GADGET_ID_CHANGE_DELAY_FIX_TEXT        (GADGET_ID_COUNTER_FIRST + 91)
+#define GADGET_ID_CHANGE_DELAY_FIX_UP  (GADGET_ID_COUNTER_FIRST + 92)
+#define GADGET_ID_CHANGE_DELAY_RND_DOWN        (GADGET_ID_COUNTER_FIRST + 93)
+#define GADGET_ID_CHANGE_DELAY_RND_TEXT        (GADGET_ID_COUNTER_FIRST + 94)
+#define GADGET_ID_CHANGE_DELAY_RND_UP  (GADGET_ID_COUNTER_FIRST + 95)
+#define GADGET_ID_CHANGE_CONT_RND_DOWN (GADGET_ID_COUNTER_FIRST + 96)
+#define GADGET_ID_CHANGE_CONT_RND_TEXT (GADGET_ID_COUNTER_FIRST + 97)
+#define GADGET_ID_CHANGE_CONT_RND_UP   (GADGET_ID_COUNTER_FIRST + 98)
+#define GADGET_ID_GROUP_CONTENT_DOWN   (GADGET_ID_COUNTER_FIRST + 99)
+#define GADGET_ID_GROUP_CONTENT_TEXT   (GADGET_ID_COUNTER_FIRST + 100)
+#define GADGET_ID_GROUP_CONTENT_UP     (GADGET_ID_COUNTER_FIRST + 101)
 
 /* drawing area identifiers */
-#define GADGET_ID_DRAWING_AREA_FIRST   (GADGET_ID_COUNTER_FIRST + 99)
+#define GADGET_ID_DRAWING_AREA_FIRST   (GADGET_ID_COUNTER_FIRST + 102)
 
 #define GADGET_ID_DRAWING_LEVEL                (GADGET_ID_DRAWING_AREA_FIRST + 0)
 #define GADGET_ID_YAMYAM_CONTENT_0     (GADGET_ID_DRAWING_AREA_FIRST + 1)
 #define ED_COUNTER_ID_LEVEL_GEMSLIMIT  3
 #define ED_COUNTER_ID_LEVEL_TIMELIMIT  4
 #define ED_COUNTER_ID_LEVEL_TIMESCORE  5
-#define ED_COUNTER_ID_LEVEL_RANDOM     6
-#define ED_COUNTER_ID_ELEMENT_VALUE1   7
-#define ED_COUNTER_ID_ELEMENT_VALUE2   8
-#define ED_COUNTER_ID_ELEMENT_VALUE3   9
-#define ED_COUNTER_ID_ELEMENT_VALUE4   10
-#define ED_COUNTER_ID_YAMYAM_CONTENT   11
-#define ED_COUNTER_ID_BALL_CONTENT     12
-#define ED_COUNTER_ID_ANDROID_CONTENT  13
-#define ED_COUNTER_ID_ENVELOPE_XSIZE   14
-#define ED_COUNTER_ID_ENVELOPE_YSIZE   15
-#define ED_COUNTER_ID_INVENTORY_SIZE   16
-#define ED_COUNTER_ID_CUSTOM_SCORE     17
-#define ED_COUNTER_ID_CUSTOM_GEMCOUNT  18
-#define ED_COUNTER_ID_CUSTOM_VALUE_FIX 19
-#define ED_COUNTER_ID_CUSTOM_VALUE_RND 20
-#define ED_COUNTER_ID_PUSH_DELAY_FIX   21
-#define ED_COUNTER_ID_PUSH_DELAY_RND   22
-#define ED_COUNTER_ID_DROP_DELAY_FIX   23
-#define ED_COUNTER_ID_DROP_DELAY_RND   24
-#define ED_COUNTER_ID_MOVE_DELAY_FIX   25
-#define ED_COUNTER_ID_MOVE_DELAY_RND   26
-#define ED_COUNTER_ID_EXPLOSION_DELAY  27
-#define ED_COUNTER_ID_IGNITION_DELAY   28
-#define ED_COUNTER_ID_GROUP_CONTENT    29
-#define ED_COUNTER_ID_CHANGE_DELAY_FIX 30
-#define ED_COUNTER_ID_CHANGE_DELAY_RND 31
-#define ED_COUNTER_ID_CHANGE_CONT_RND  32
-
-#define ED_NUM_COUNTERBUTTONS          33
+#define ED_COUNTER_ID_LEVEL_RANDOM_SEED        6
+#define ED_COUNTER_ID_LEVEL_RANDOM     7
+#define ED_COUNTER_ID_ELEMENT_VALUE1   8
+#define ED_COUNTER_ID_ELEMENT_VALUE2   9
+#define ED_COUNTER_ID_ELEMENT_VALUE3   10
+#define ED_COUNTER_ID_ELEMENT_VALUE4   11
+#define ED_COUNTER_ID_YAMYAM_CONTENT   12
+#define ED_COUNTER_ID_BALL_CONTENT     13
+#define ED_COUNTER_ID_ANDROID_CONTENT  14
+#define ED_COUNTER_ID_ENVELOPE_XSIZE   15
+#define ED_COUNTER_ID_ENVELOPE_YSIZE   16
+#define ED_COUNTER_ID_INVENTORY_SIZE   17
+#define ED_COUNTER_ID_CUSTOM_SCORE     18
+#define ED_COUNTER_ID_CUSTOM_GEMCOUNT  19
+#define ED_COUNTER_ID_CUSTOM_VALUE_FIX 20
+#define ED_COUNTER_ID_CUSTOM_VALUE_RND 21
+#define ED_COUNTER_ID_PUSH_DELAY_FIX   22
+#define ED_COUNTER_ID_PUSH_DELAY_RND   23
+#define ED_COUNTER_ID_DROP_DELAY_FIX   24
+#define ED_COUNTER_ID_DROP_DELAY_RND   25
+#define ED_COUNTER_ID_MOVE_DELAY_FIX   26
+#define ED_COUNTER_ID_MOVE_DELAY_RND   27
+#define ED_COUNTER_ID_EXPLOSION_DELAY  28
+#define ED_COUNTER_ID_IGNITION_DELAY   29
+#define ED_COUNTER_ID_GROUP_CONTENT    30
+#define ED_COUNTER_ID_CHANGE_DELAY_FIX 31
+#define ED_COUNTER_ID_CHANGE_DELAY_RND 32
+#define ED_COUNTER_ID_CHANGE_CONT_RND  33
+
+#define ED_NUM_COUNTERBUTTONS          34
 
 #define ED_COUNTER_ID_LEVEL_FIRST      ED_COUNTER_ID_LEVEL_XSIZE
-#define ED_COUNTER_ID_LEVEL_LAST       ED_COUNTER_ID_LEVEL_TIMESCORE
+#define ED_COUNTER_ID_LEVEL_LAST       ED_COUNTER_ID_LEVEL_RANDOM_SEED
 #define ED_COUNTER_ID_EDITOR_FIRST     ED_COUNTER_ID_LEVEL_RANDOM
 #define ED_COUNTER_ID_EDITOR_LAST      ED_COUNTER_ID_LEVEL_RANDOM
 
@@ -1073,7 +1077,7 @@ static struct
     GADGET_ID_LEVEL_GEMSLIMIT_DOWN,    GADGET_ID_LEVEL_GEMSLIMIT_UP,
     GADGET_ID_LEVEL_GEMSLIMIT_TEXT,    GADGET_ID_NONE,
     &level.gems_needed,
-    NULL, "number of gems to collect:",        NULL
+    NULL,                              "number of gems to collect:", NULL
   },
   {
     ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(7),
@@ -1091,6 +1095,14 @@ static struct
     &level.score[SC_TIME_BONUS],
     "score for each second/step left:",        NULL, NULL
   },
+  {
+    ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(12),
+    0,                                 9999,
+    GADGET_ID_LEVEL_RANDOM_SEED_DOWN,  GADGET_ID_LEVEL_RANDOM_SEED_UP,
+    GADGET_ID_LEVEL_RANDOM_SEED_TEXT,  GADGET_ID_NONE,
+    &level.random_seed,
+    NULL,                              "random seed:", "(0 => random)"
+  },
   {
     ED_LEVEL_SETTINGS_XPOS(0),         ED_LEVEL_SETTINGS_YPOS(0),
     1,                                 100,
@@ -1725,6 +1737,7 @@ static struct ValueTextInfo options_action_type[] =
   { CA_SET_LEVEL_SCORE,                "set score"                     },
   { CA_SET_LEVEL_GEMS,         "set gems"                      },
   { CA_SET_LEVEL_WIND,         "set wind dir."                 },
+  { CA_SET_LEVEL_RANDOM_SEED,  "set rand. seed"                },
   { CA_UNDEFINED,              " "                             },
   { CA_HEADLINE_PLAYER_ACTIONS,        "[player]"                      },
   { CA_MOVE_PLAYER,            "move player"                   },
@@ -2059,6 +2072,7 @@ action_arg_options[] =
   { CA_SET_LEVEL_GEMS,         3,      options_action_arg_number,      },
   { CA_SET_LEVEL_SCORE,                3,      options_action_arg_number,      },
   { CA_SET_LEVEL_WIND,         1,      options_action_arg_direction,   },
+  { CA_SET_LEVEL_RANDOM_SEED,  1,      options_action_arg_number,      },
   { CA_SET_PLAYER_KEYS,                2,      options_action_arg_key,         },
   { CA_SET_PLAYER_SPEED,       1,      options_action_arg_speed,       },
   { CA_SET_PLAYER_SHIELD,      1,      options_action_arg_shield,      },
@@ -11238,7 +11252,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
 
        level_editor_test_game = TRUE;
 
-       StartGameActions(FALSE, setup.autorecord, NEW_RANDOMIZE);
+       StartGameActions(FALSE, setup.autorecord, level.random_seed);
       }
       break;
 
index 6d52228b5d4a050eb8e632cb0abe29cfc81d0325..278704e6763f9924142f2a6cc4c74c00f055773a 100644 (file)
@@ -744,7 +744,7 @@ void HandleKey(Key key, int key_status)
   if (game_status == GAME_MODE_MAIN &&
       (key == setup.shortcut.toggle_pause || key == KSYM_space))
   {
-    StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE);
+    StartGameActions(options.network, setup.autorecord, level.random_seed);
 
     return;
   }
index c3676315d254b2fda0038dddc3e2925ae7dd312e..c32777225a076a5a2477b678b15150dbe8b2a627 100644 (file)
@@ -182,6 +182,12 @@ static struct LevelFileConfigInfo chunk_config_INFO[] =
     &li.gems_needed,                   0
   },
 
+  {
+    -1,                                        -1,
+    TYPE_INTEGER,                      CONF_VALUE_32_BIT(2),
+    &li.random_seed,                   0
+  },
+
   {
     -1,                                        -1,
     TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(2),
index 653cd8c2588dca28d182da5ebdecaeb38381063a..a32fcfa7f5e4111302fe2a814b7363248861660a 100644 (file)
@@ -10430,6 +10430,33 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
       break;
     }
 
+    case CA_SET_LEVEL_RANDOM_SEED:
+    {
+#if 1
+      /* ensure that setting a new random seed while playing is predictable */
+      InitRND(action_arg_number_new ? action_arg_number_new : RND(1000000) + 1);
+#else
+      InitRND(action_arg_number_new);
+#endif
+
+#if 0
+      printf("::: %d -> %d\n", action_arg_number_new, RND(10));
+#endif
+
+#if 0
+      {
+       int i;
+
+       printf("::: ");
+       for (i = 0; i < 9; i++)
+         printf("%d, ", RND(2));
+       printf("\n");
+      }
+#endif
+
+      break;
+    }
+
     /* ---------- player actions  ------------------------------------------ */
 
     case CA_MOVE_PLAYER:
@@ -11123,6 +11150,7 @@ static void HandleElementChange(int x, int y, int page)
   int element = MovingOrBlocked2Element(x, y);
   struct ElementInfo *ei = &element_info[element];
   struct ElementChangeInfo *change = &ei->change_page[page];
+  boolean handle_action_before_change = FALSE;
 
 #ifdef DEBUG
   if (!CAN_CHANGE_OR_HAS_ACTION(element) &&
@@ -11205,6 +11233,15 @@ static void HandleElementChange(int x, int y, int page)
       return;
     }
 
+#if 1
+    /* special case: set new level random seed before changing element */
+    if (change->has_action && change->action_type == CA_SET_LEVEL_RANDOM_SEED)
+      handle_action_before_change = TRUE;
+
+    if (change->has_action && handle_action_before_change)
+      ExecuteCustomElementAction(x, y, element, page);
+#endif
+
     if (change->can_change)
     {
       if (ChangeElement(x, y, element, page))
@@ -11214,7 +11251,7 @@ static void HandleElementChange(int x, int y, int page)
       }
     }
 
-    if (change->has_action)
+    if (change->has_action && !handle_action_before_change)
       ExecuteCustomElementAction(x, y, element, page);
   }
 }
@@ -12010,7 +12047,7 @@ void GameActions()
   }
 
   if (game.restart_level)
-    StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE);
+    StartGameActions(options.network, setup.autorecord, level.random_seed);
 
   if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
   {
index 05dae3dd96449470e069b8de75acc4a7ba5743e4..5e4b9310bc4701f9921603fa1b353a94398462d9 100644 (file)
@@ -337,13 +337,26 @@ unsigned int init_random_number(int nr, long seed)
 {
   if (seed == NEW_RANDOMIZE)
   {
-#if defined(TARGET_SDL)
-    seed = (long)SDL_GetTicks();
-#else
+    /* default random seed */
+    seed = (long)time(NULL);                   // seconds since the epoch
+
+#if !defined(PLATFORM_WIN32)
+    /* add some more randomness */
     struct timeval current_time;
 
     gettimeofday(&current_time, NULL);
-    seed = (long)current_time.tv_usec;
+
+    seed += (long)current_time.tv_usec;                // microseconds since the epoch
+#endif
+
+#if defined(TARGET_SDL)
+    /* add some more randomness */
+    seed += (long)SDL_GetTicks();              // milliseconds since SDL init
+#endif
+
+#if 1
+    /* add some more randomness */
+    seed += GetSimpleRandom(1000000);
 #endif
   }
 
index 66dbda052f7cef02f52481e947d1790e9dbb2e6f..56467dc1220255a11c51d9870a660b2dad4c6a75 100644 (file)
@@ -25,7 +25,7 @@
 #define READ_COUNTER                   1
 
 /* values for InitRND() */
-#define NEW_RANDOMIZE                  -1
+#define NEW_RANDOMIZE                  0
 
 #define RANDOM_ENGINE                  0
 #define RANDOM_SIMPLE                  1
index 84d71d62f0b963b2e7f08fda8c9937ffbb0d6334..d47b40686a75dfdf113932272fd9e2b48df710fe 100644 (file)
 #define CA_SET_ENGINE_SCAN_MODE                17
 #define CA_SET_PLAYER_INVENTORY                18
 #define CA_SET_CE_ARTWORK              19
+#define CA_SET_LEVEL_RANDOM_SEED       20
 
 #define CA_HEADLINE_LEVEL_ACTIONS      250
 #define CA_HEADLINE_PLAYER_ACTIONS     251
@@ -2293,6 +2294,8 @@ struct LevelInfo
   char name[MAX_LEVEL_NAME_LEN + 1];
   char author[MAX_LEVEL_AUTHOR_LEN + 1];
 
+  int random_seed;
+
   struct EnvelopeInfo envelope[NUM_ENVELOPES];
 
   int score[LEVEL_SCORE_ELEMENTS];
index 1a0feda699008b9eaf90d9b937f7ed447e8f2f49..fd98b62d8e72ca9ce7522f905d799ca468a563cd 100644 (file)
@@ -308,7 +308,7 @@ void SendToServer_NrWanted(int nr_wanted)
 
 void SendToServer_StartPlaying()
 {
-  unsigned long new_random_seed = InitRND(NEW_RANDOMIZE);
+  unsigned long new_random_seed = InitRND(level.random_seed);
 
   int dummy = 0;               /* !!! HAS NO MEANING ANYMORE !!! */
                                /* the name of the level must be enough */
index 6097a04b2a160d90abc753fe317673a3cc836f3d..60bba4561f390f7af8f3bc768ca9bcf12b8d9ef8 100644 (file)
@@ -1776,7 +1776,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
       }
       else if (pos == MAIN_CONTROL_GAME)
       {
-       StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE);
+       StartGameActions(options.network, setup.autorecord, level.random_seed);
       }
       else if (pos == MAIN_CONTROL_SETUP)
       {
index fc90ad51461d9beccc831c1cb5c712268ae48074..49f06aa32272c5f77c13e0de6584d78411a23561 100644 (file)
@@ -475,7 +475,7 @@ void TapeErase()
   tape.pos[tape.counter].delay = 0;
   tape.changed = TRUE;
 
-  tape.random_seed = InitRND(NEW_RANDOMIZE);
+  tape.random_seed = InitRND(level.random_seed);
 
   tape.file_version = FILE_VERSION_ACTUAL;
   tape.game_version = GAME_VERSION_ACTUAL;
@@ -538,7 +538,7 @@ void TapeStartRecording(long random_seed)
 
 static void TapeStartGameRecording()
 {
-  TapeStartRecording(NEW_RANDOMIZE);
+  TapeStartRecording(level.random_seed);
 
 #if defined(NETWORK_AVALIABLE)
   if (options.network)