From: Holger Schemel Date: Sat, 2 Aug 2008 15:35:31 +0000 (+0200) Subject: rnd-20080802-1-src X-Git-Tag: 3.2.6.0^2~6 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9991027ba0e61f105a15d517461614fce184ba48;p=rocksndiamonds.git rnd-20080802-1-src * fixed some bugs regarding the new level/CE random seed reset options --- diff --git a/ChangeLog b/ChangeLog index a002c205..8349425e 100644 --- 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 diff --git a/src/conftime.h b/src/conftime.h index a2b0bd32..13218c2c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2008-07-14 17:08" +#define COMPILE_DATE_STRING "2008-08-02 17:34" diff --git a/src/editor.c b/src/editor.c index 995d15fe..5fb4dd93 100644 --- a/src/editor.c +++ b/src/editor.c @@ -359,87 +359,90 @@ #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) @@ -635,38 +638,39 @@ #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; diff --git a/src/events.c b/src/events.c index 6d52228b..278704e6 100644 --- a/src/events.c +++ b/src/events.c @@ -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; } diff --git a/src/files.c b/src/files.c index c3676315..c3277722 100644 --- a/src/files.c +++ b/src/files.c @@ -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), diff --git a/src/game.c b/src/game.c index 653cd8c2..a32fcfa7 100644 --- a/src/game.c +++ b/src/game.c @@ -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) { diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 05dae3dd..5e4b9310 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -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(¤t_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 } diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 66dbda05..56467dc1 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -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 diff --git a/src/main.h b/src/main.h index 84d71d62..d47b4068 100644 --- a/src/main.h +++ b/src/main.h @@ -359,6 +359,7 @@ #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]; diff --git a/src/network.c b/src/network.c index 1a0feda6..fd98b62d 100644 --- a/src/network.c +++ b/src/network.c @@ -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 */ diff --git a/src/screens.c b/src/screens.c index 6097a04b..60bba456 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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) { diff --git a/src/tape.c b/src/tape.c index fc90ad51..49f06aa3 100644 --- a/src/tape.c +++ b/src/tape.c @@ -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)