See commits
61c3da0 (incomplete fix) and
c92edfe9 (final fix) for
details about this problem that was introduced (by a partial fix) in
version 3.3.1.0 and finally fixed in version 4.0.1.2, which resulted
in many tapes recorded between these versions with the EM game engine
to be broken.
To fix these broken tapes, it is required to set a new property bit in
all existing tape files that are affected by this bug.
The functionality to automatically patch these tapes will be added as
a new command line option.
game_em.use_snap_key_bug =
(game.engine_version < VERSION_IDENT(4,0,1,0));
+ game_em.use_random_bug =
+ (tape.property_bits & TAPE_PROPERTY_EM_RANDOM_BUG);
+
boolean use_old_em_engine = (game.engine_version < VERSION_IDENT(4,2,0,0));
game_em.use_old_explosions = use_old_em_engine;
//
// - game_em.use_single_button (default: TRUE)
// - game_em.use_snap_key_bug (default: FALSE)
+ // - game_em.use_random_bug (default: FALSE)
// - game_em.use_old_explosions (default: FALSE)
// - game_em.use_old_android (default: FALSE)
// - game_em.use_old_push_elements (default: FALSE)
// flags to handle bugs in and changes between different engine versions
boolean use_single_button;
boolean use_snap_key_bug;
+ boolean use_random_bug;
boolean use_old_explosions;
boolean use_old_android;
boolean use_old_push_elements;
#define ACID_ROLL /* rolling objects go into acid rather than remove it */
#define ACID_PLAYER /* player gets killed by acid, but without explosion */
+#define RANDOM_BUG /* handle problem with old tapes using 64-bit random */
+
#define RANDOM(x) ((seed = seed << 31 | seed >> 1) % x)
static short **cave, **next, **boom;
int x;
int y;
int count;
- unsigned int random;
+#ifdef RANDOM_BUG
+ uint64_t random;
+#else
+ uint32_t random;
+#endif
cave = lev.cave;
next = lev.next;
Lamoeba(x, y);
random = random * 129 + 1;
+
+#ifdef RANDOM_BUG
+ if (!game_em.use_random_bug)
+ random = (uint32_t)random;
+#endif
}
game_em.random = random;
// values for tape properties stored in tape file
#define TAPE_PROPERTY_NONE 0
+#define TAPE_PROPERTY_EM_RANDOM_BUG (1 << 0)
// some positions in the video tape control window
#define VIDEO_DISPLAY1_XPOS 5