"CrLi"
};
-// to convert predictable slime values to bit masks
-static int slime_shift_msb(int c64_data)
+// Take a slime predictability byte, and convert it to a bitmask.
+// Used for caves created with the original construction kit.
+// (This conversion method is used by the new game engine.)
+static int slime_plck_new(int c64_data)
+{
+ const int values[] = { 0x00, 0x10, 0x18, 0x38, 0x3c, 0x7c, 0x7e, 0xfe, 0xff };
+
+ if (c64_data > ARRAY_SIZE(values))
+ {
+ Warn("Invalid PLCK slime permeability value %x", c64_data);
+
+ return 0xff;
+ }
+
+ return values[c64_data];
+}
+
+// Take a slime predictability byte, and convert it to a bitmask.
+// Used for caves created with the original construction kit.
+// (This conversion method was used by the old game engine.)
+static int slime_plck_old(int c64_data)
{
int i, perm;
cave->level_ckdelay[i] = data[0x1b8];
cave->level_magic_wall_time[i] = data[0x1c6];
- cave->level_slime_permeability_c64[i] = slime_shift_msb(data[0x1c2]);
+ cave->level_slime_permeability_c64[i] = slime_plck_new(data[0x1c2]);
+ cave->level_slime_permeability_old[i] = slime_plck_old(data[0x1c2]);
}
if (format == GD_FORMAT_PLC_ATARI)
cave->level_amoeba_time[i] = 999;
cave->level_magic_wall_time[i] = data[7];
- cave->level_slime_permeability_c64[i] = slime_shift_msb(data[5]);
+ cave->level_slime_permeability_c64[i] = slime_plck_new(data[5]);
+ cave->level_slime_permeability_old[i] = slime_plck_old(data[5]);
}
cave->diamond_value = data[3];
int level_slime_permeability[5]; // true random slime
int level_slime_permeability_c64[5]; // Appearing in bd 2
+ int level_slime_permeability_old[5]; // Appearing in bd 2 (only used by old engine)
int level_slime_seed_c64[5]; // predictable slime random seed
boolean slime_predictable; // predictable random start for slime. yes for plck.
boolean slime_correct_random; // correct random number generator for rendered caves
{ CAVE_OFFSET(slime_predictable), TRUE },
{ CAVE_OFFSET(level_slime_seed_c64), -1 },
{ CAVE_OFFSET(level_slime_permeability_c64), 0 },
+ { CAVE_OFFSET(level_slime_permeability_old), 0 },
{ CAVE_OFFSET(level_slime_permeability), 1000000 },
{ CAVE_OFFSET(slime_eats_1), O_DIAMOND },
{ CAVE_OFFSET(slime_converts_1), O_DIAMOND_F },
cave->hatching_delay_time = data->level_hatching_delay_time[level];
cave->hatching_delay_frame = data->level_hatching_delay_frame[level];
+ // if using old game engine and old slime permeability value is defined, use that
+ if (game_bd.game != NULL && game_bd.game->use_old_engine &&
+ data->level_slime_permeability_old[level] != 0)
+ cave->slime_permeability_c64 = data->level_slime_permeability_old[level];
+
if (!cave->map)
{
// if we have no map, fill with predictable random generator.