#include "files.h"
#include "init.h"
#include "screens.h"
+#include "editor.h"
#include "tools.h"
#include "tape.h"
#include "config.h"
TYPE_INTEGER, CONF_VALUE_8_BIT(1),
&li.game_engine_type, GAME_ENGINE_TYPE_RND
},
-
{
-1, SAVE_CONF_ALWAYS,
TYPE_INTEGER, CONF_VALUE_16_BIT(1),
TYPE_INTEGER, CONF_VALUE_16_BIT(2),
&li.fieldy, STD_LEV_FIELDY
},
-
{
-1, SAVE_CONF_ALWAYS,
TYPE_INTEGER, CONF_VALUE_16_BIT(3),
&li.time, 100
},
-
{
-1, SAVE_CONF_ALWAYS,
TYPE_INTEGER, CONF_VALUE_16_BIT(4),
&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),
&li.use_step_counter, FALSE
},
-
{
-1, -1,
TYPE_BITFIELD, CONF_VALUE_8_BIT(4),
&li.wind_direction_initial, MV_NONE
},
-
{
-1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(5),
&li.em_slippery_gems, FALSE
},
-
{
-1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(6),
&li.use_custom_template, FALSE
},
-
{
-1, -1,
TYPE_BITFIELD, CONF_VALUE_32_BIT(1),
&li.can_move_into_acid_bits, ~0 // default: everything can
},
-
{
-1, -1,
TYPE_BITFIELD, CONF_VALUE_8_BIT(7),
&li.dont_collide_with_bits, ~0 // default: always deadly
},
-
{
-1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(8),
&li.em_explodes_by_fire, FALSE
},
-
{
-1, -1,
TYPE_INTEGER, CONF_VALUE_16_BIT(5),
&li.score[SC_TIME_BONUS], 1
},
-
{
-1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(9),
&li.auto_exit_sokoban, FALSE
},
-
{
-1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(10),
&li.auto_count_gems, FALSE
},
-
{
-1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(11),
&li.solved_by_one_player, FALSE
},
-
{
-1, -1,
TYPE_INTEGER, CONF_VALUE_8_BIT(12),
&li.time_score_base, 1
},
-
{
-1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(13),
&li.rate_time_over_score, FALSE
},
+ {
+ -1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(14),
+ &li.bd_intermission, FALSE
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(15),
+ &li.bd_scheduling_type, GD_SCHEDULING_MILLISECONDS
+ },
+ {
+ -1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(16),
+ &li.bd_pal_timing, FALSE
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(6),
+ &li.bd_cycle_delay_ms, 160
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(17),
+ &li.bd_cycle_delay_c64, 0
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(18),
+ &li.bd_hatching_delay_cycles, 21
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(19),
+ &li.bd_hatching_delay_seconds, 2
+ },
+ {
+ -1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(20),
+ &li.bd_line_shifting_borders, FALSE
+ },
+ {
+ -1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(21),
+ &li.bd_scan_first_and_last_row, TRUE
+ },
+ {
+ -1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(22),
+ &li.bd_short_explosions, TRUE
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(23),
+ &li.bd_cave_random_seed_c64, 0
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_32_BIT(3),
+ &li.bd_color_b, GD_C64_COLOR(0)
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_32_BIT(4),
+ &li.bd_color_0, GD_C64_COLOR(0)
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_32_BIT(5),
+ &li.bd_color_1, GD_C64_COLOR(8)
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_32_BIT(6),
+ &li.bd_color_2, GD_C64_COLOR(11)
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_32_BIT(7),
+ &li.bd_color_3, GD_C64_COLOR(1)
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_32_BIT(8),
+ &li.bd_color_4, GD_C64_COLOR(5)
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_32_BIT(9),
+ &li.bd_color_5, GD_C64_COLOR(6)
+ },
{
-1, -1,
&li.initial_inventory_size[3], 1, MAX_INITIAL_INVENTORY_SIZE
},
+ // (these values are only valid for BD style levels)
+ // (some values for BD style amoeba following below)
+ {
+ EL_BDX_PLAYER, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_diagonal_movements, FALSE
+ },
+ {
+ EL_BDX_PLAYER, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
+ &li.bd_topmost_player_active, TRUE
+ },
+ {
+ EL_BDX_PLAYER, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(3),
+ &li.bd_pushing_prob, 25
+ },
+ {
+ EL_BDX_PLAYER, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(4),
+ &li.bd_pushing_prob_with_sweet, 100
+ },
+ {
+ EL_BDX_PLAYER, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(5),
+ &li.bd_push_mega_rock_with_sweet, FALSE
+ },
+ {
+ EL_BDX_PLAYER, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(6),
+ &li.bd_snap_element, EL_EMPTY
+ },
+
+ {
+ EL_BDX_SAND_1, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_sand_looks_like, EL_BDX_SAND_1
+ },
+
+ {
+ EL_BDX_ROCK, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_rock_turns_to_on_falling, EL_BDX_ROCK_FALLING
+ },
+ {
+ EL_BDX_ROCK, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(2),
+ &li.bd_rock_turns_to_on_impact, EL_BDX_ROCK
+ },
+
+ {
+ EL_BDX_DIAMOND, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(1),
+ &li.score[SC_DIAMOND_EXTRA], 20
+ },
+ {
+ EL_BDX_DIAMOND, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(2),
+ &li.bd_diamond_turns_to_on_falling, EL_BDX_DIAMOND_FALLING
+ },
+ {
+ EL_BDX_DIAMOND, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(3),
+ &li.bd_diamond_turns_to_on_impact, EL_BDX_DIAMOND
+ },
+
+ {
+ EL_BDX_FIREFLY_1, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_firefly_1_explodes_to, EL_BDX_EXPLODING_1
+ },
+
+ {
+ EL_BDX_FIREFLY_2, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_firefly_2_explodes_to, EL_BDX_EXPLODING_1
+ },
+
+ {
+ EL_BDX_BUTTERFLY_1, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_butterfly_1_explodes_to, EL_BDX_DIAMOND_GROWING_1
+ },
+
+ {
+ EL_BDX_BUTTERFLY_2, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_butterfly_2_explodes_to, EL_BDX_DIAMOND_GROWING_1
+ },
+
+ {
+ EL_BDX_STONEFLY, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_stonefly_explodes_to, EL_BDX_ROCK_GROWING_1
+ },
+
+ {
+ EL_BDX_DRAGONFLY, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_dragonfly_explodes_to, EL_BDX_EXPLODING_1
+ },
+
+ {
+ EL_BDX_DIAMOND_GROWING_5, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_diamond_birth_turns_to, EL_BDX_DIAMOND
+ },
+
+ {
+ EL_BDX_BOMB_EXPLODING_4, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_bomb_explosion_turns_to, EL_BDX_WALL
+ },
+
+ {
+ EL_BDX_NITRO_PACK_EXPLODING_4, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_nitro_explosion_turns_to, EL_EMPTY
+ },
+
+ {
+ EL_BDX_EXPLODING_5, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_explosion_turns_to, EL_EMPTY
+ },
+
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_magic_wall_wait_hatching, FALSE
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
+ &li.bd_magic_wall_stops_amoeba, TRUE
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(3),
+ &li.bd_magic_wall_zero_infinite, TRUE
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(4),
+ &li.bd_magic_wall_break_scan, FALSE
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(1),
+ &li.bd_magic_wall_time, 999
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(2),
+ &li.bd_magic_wall_diamond_to, EL_BDX_ROCK_FALLING
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(3),
+ &li.bd_magic_wall_rock_to, EL_BDX_DIAMOND_FALLING
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(4),
+ &li.bd_magic_wall_mega_rock_to, EL_BDX_NITRO_PACK_FALLING
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(5),
+ &li.bd_magic_wall_nut_to, EL_BDX_NUT_FALLING
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(6),
+ &li.bd_magic_wall_nitro_pack_to, EL_BDX_MEGA_ROCK_FALLING
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(7),
+ &li.bd_magic_wall_flying_diamond_to, EL_BDX_FLYING_ROCK_FLYING
+ },
+ {
+ EL_BDX_MAGIC_WALL, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(8),
+ &li.bd_magic_wall_flying_rock_to, EL_BDX_FLYING_DIAMOND_FLYING
+ },
+
+ {
+ EL_BDX_CLOCK, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(1),
+ &li.bd_clock_extra_time, 30
+ },
+
+ {
+ EL_BDX_VOODOO_DOLL, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_voodoo_collects_diamonds, FALSE
+ },
+ {
+ EL_BDX_VOODOO_DOLL, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
+ &li.bd_voodoo_hurt_kills_player, FALSE
+ },
+ {
+ EL_BDX_VOODOO_DOLL, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(3),
+ &li.bd_voodoo_dies_by_rock, FALSE
+ },
+ {
+ EL_BDX_VOODOO_DOLL, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(4),
+ &li.bd_voodoo_vanish_by_explosion, TRUE
+ },
+ {
+ EL_BDX_VOODOO_DOLL, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(5),
+ &li.bd_voodoo_penalty_time, 30
+ },
+
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_slime_is_predictable, TRUE
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(2),
+ &li.bd_slime_permeability_rate, 100
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(3),
+ &li.bd_slime_permeability_bits_c64, 0
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_INTEGER, CONF_VALUE_32_BIT(1),
+ &li.bd_slime_random_seed_c64, -1
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_slime_eats_element_1, EL_BDX_DIAMOND
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(2),
+ &li.bd_slime_converts_to_element_1, EL_BDX_DIAMOND_FALLING
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(3),
+ &li.bd_slime_eats_element_2, EL_BDX_ROCK
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(4),
+ &li.bd_slime_converts_to_element_2, EL_BDX_ROCK_FALLING
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(5),
+ &li.bd_slime_eats_element_3, EL_BDX_NUT
+ },
+ {
+ EL_BDX_SLIME, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(6),
+ &li.bd_slime_converts_to_element_3, EL_BDX_NUT_FALLING
+ },
+
+ {
+ EL_BDX_ACID, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_acid_eats_element, EL_BDX_SAND_1
+ },
+ {
+ EL_BDX_ACID, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(1),
+ &li.bd_acid_spread_rate, 3
+ },
+ {
+ EL_BDX_ACID, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(2),
+ &li.bd_acid_turns_to_element, EL_BDX_EXPLODING_3
+ },
+
+ {
+ EL_BDX_BITER, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(1),
+ &li.bd_biter_move_delay, 0
+ },
+ {
+ EL_BDX_BITER, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_biter_eats_element, EL_BDX_DIAMOND
+ },
+
+ {
+ EL_BDX_BLADDER, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_bladder_converts_by_element, EL_BDX_VOODOO_DOLL
+ },
+
+ {
+ EL_BDX_EXPANDABLE_WALL_ANY, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_change_expanding_wall, FALSE
+ },
+ {
+ EL_BDX_EXPANDABLE_WALL_ANY, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_expanding_wall_looks_like, EL_BDX_WALL
+ },
+
+ {
+ EL_BDX_REPLICATOR, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_replicators_active, TRUE
+ },
+ {
+ EL_BDX_REPLICATOR, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(2),
+ &li.bd_replicator_create_delay, 4
+ },
+
+ {
+ EL_BDX_CONVEYOR_LEFT, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_conveyor_belts_active, TRUE
+ },
+ {
+ EL_BDX_CONVEYOR_LEFT, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
+ &li.bd_conveyor_belts_changed, FALSE
+ },
+
+ {
+ EL_BDX_WATER, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_water_cannot_flow_down, FALSE
+ },
+
+ {
+ EL_BDX_NUT, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(1),
+ &li.bd_nut_content, EL_BDX_NUT_BREAKING_1
+ },
+
+ {
+ EL_BDX_PNEUMATIC_HAMMER, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(1),
+ &li.bd_hammer_walls_break_delay, 5
+ },
+ {
+ EL_BDX_PNEUMATIC_HAMMER, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
+ &li.bd_hammer_walls_reappear, FALSE
+ },
+ {
+ EL_BDX_PNEUMATIC_HAMMER, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(3),
+ &li.bd_hammer_walls_reappear_delay, 100
+ },
+
+ {
+ EL_BDX_ROCKET_LAUNCHER, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_infinite_rockets, FALSE
+ },
+
+ {
+ EL_BDX_SKELETON, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(1),
+ &li.bd_num_skeletons_needed_for_pot, 5
+ },
+ {
+ EL_BDX_SKELETON, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(2),
+ &li.bd_skeleton_worth_num_diamonds, 0
+ },
+
+ {
+ EL_BDX_CREATURE_SWITCH, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.bd_creatures_start_backwards, FALSE
+ },
+ {
+ EL_BDX_CREATURE_SWITCH, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
+ &li.bd_creatures_turn_on_hatching, FALSE
+ },
+ {
+ EL_BDX_CREATURE_SWITCH, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(1),
+ &li.bd_creatures_auto_turn_delay, 0
+ },
+
+ {
+ EL_BDX_GRAVITY_SWITCH, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(1),
+ &li.bd_gravity_direction, GD_MV_DOWN
+ },
+ {
+ EL_BDX_GRAVITY_SWITCH, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
+ &li.bd_gravity_switch_active, FALSE
+ },
+ {
+ EL_BDX_GRAVITY_SWITCH, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(3),
+ &li.bd_gravity_switch_delay, 10
+ },
+ {
+ EL_BDX_GRAVITY_SWITCH, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(4),
+ &li.bd_gravity_affects_all, TRUE
+ },
+
+ // (the following values are related to various game elements)
+
{
EL_EMERALD, -1,
TYPE_INTEGER, CONF_VALUE_16_BIT(1),
&li.grow_into_diggable, TRUE
},
+ {
+ EL_BDX_AMOEBA_1, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(1),
+ &li.bd_amoeba_1_threshold_too_big, 200
+ },
+ {
+ EL_BDX_AMOEBA_1, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(2),
+ &li.bd_amoeba_1_slow_growth_time, 200
+ },
+ {
+ EL_BDX_AMOEBA_1, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(3),
+ &li.bd_amoeba_1_content_too_big, EL_BDX_ROCK
+ },
+ {
+ EL_BDX_AMOEBA_1, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(4),
+ &li.bd_amoeba_1_content_enclosed, EL_BDX_DIAMOND
+ },
+ {
+ EL_BDX_AMOEBA_1, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(1),
+ &li.bd_amoeba_1_slow_growth_rate, 3
+ },
+ {
+ EL_BDX_AMOEBA_1, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(2),
+ &li.bd_amoeba_1_fast_growth_rate, 25
+ },
+ {
+ EL_BDX_AMOEBA_1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(3),
+ &li.bd_amoeba_wait_for_hatching, FALSE
+ },
+ {
+ EL_BDX_AMOEBA_1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(4),
+ &li.bd_amoeba_start_immediately, TRUE
+ },
+
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(1),
+ &li.bd_amoeba_2_threshold_too_big, 200
+ },
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(2),
+ &li.bd_amoeba_2_slow_growth_time, 200
+ },
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(3),
+ &li.bd_amoeba_2_content_too_big, EL_BDX_ROCK
+ },
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(4),
+ &li.bd_amoeba_2_content_enclosed, EL_BDX_DIAMOND
+ },
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(5),
+ &li.bd_amoeba_2_content_exploding, EL_EMPTY
+ },
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_ELEMENT, CONF_VALUE_16_BIT(6),
+ &li.bd_amoeba_2_content_looks_like, EL_BDX_AMOEBA_2
+ },
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(1),
+ &li.bd_amoeba_2_slow_growth_rate, 3
+ },
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(2),
+ &li.bd_amoeba_2_fast_growth_rate, 25
+ },
+ {
+ EL_BDX_AMOEBA_2, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(3),
+ &li.bd_amoeba_2_explode_by_amoeba, TRUE
+ },
+
{
EL_YAMYAM, -1,
TYPE_CONTENT_LIST, CONF_VALUE_BYTES(1),
&li.score[SC_ELEM_BONUS], 10
},
- // ---------- unused values -------------------------------------------------
-
- {
- EL_UNKNOWN, SAVE_CONF_NEVER,
- TYPE_INTEGER, CONF_VALUE_16_BIT(1),
- &li.score[SC_UNKNOWN_15], 10
- },
-
{
-1, -1,
-1, -1,
static void setLevelInfoToDefaults_Level(struct LevelInfo *level)
{
+ boolean add_border = FALSE;
+ int x1 = 0;
+ int y1 = 0;
+ int x2 = STD_LEV_FIELDX - 1;
+ int y2 = STD_LEV_FIELDY - 1;
int i, x, y;
li = *level; // copy level data into temporary buffer
strcpy(level->name, NAMELESS_LEVEL_NAME);
strcpy(level->author, ANONYMOUS_NAME);
+ // set default game engine type
+ level->game_engine_type = setup.default_game_engine_type;
+
+ // some game engines should have a default playfield with border elements
+ if (level->game_engine_type == GAME_ENGINE_TYPE_BD ||
+ level->game_engine_type == GAME_ENGINE_TYPE_EM ||
+ level->game_engine_type == GAME_ENGINE_TYPE_SP)
+ {
+ add_border = TRUE;
+ x1++;
+ y1++;
+ x2--;
+ y2--;
+ }
+
// set level playfield to playable default level with player and exit
for (x = 0; x < MAX_LEV_FIELDX; x++)
+ {
for (y = 0; y < MAX_LEV_FIELDY; y++)
- level->field[x][y] = EL_SAND;
+ {
+ if (add_border && (x == 0 || x == STD_LEV_FIELDX - 1 ||
+ y == 0 || y == STD_LEV_FIELDY - 1))
+ level->field[x][y] = getEngineElement(EL_STEELWALL);
+ else
+ level->field[x][y] = getEngineElement(EL_SAND);
+ }
+ }
- level->field[0][0] = EL_PLAYER_1;
- level->field[STD_LEV_FIELDX - 1][STD_LEV_FIELDY - 1] = EL_EXIT_CLOSED;
+ level->field[x1][y1] = getEngineElement(EL_PLAYER_1);
+ level->field[x2][y2] = getEngineElement(EL_EXIT_CLOSED);
- BorderElement = EL_STEELWALL;
+ BorderElement = getEngineElement(EL_STEELWALL);
// detect custom elements when loading them
level->file_has_custom_elements = FALSE;
+ // set random colors for BD style levels according to preferred color type
+ SetRandomLevelColors_BD(setup.bd_default_color_type);
+
+ // set default color type and colors for BD style level colors
+ SetDefaultLevelColorType_BD();
+ SetDefaultLevelColors_BD();
+
// set all bug compatibility flags to "false" => do not emulate this bug
level->use_action_after_change_bug = FALSE;
}
}
+boolean isLevelsetFilename_BD(char *filename)
+{
+ return (strSuffixLower(filename, ".bd") ||
+ strSuffixLower(filename, ".bdr") ||
+ strSuffixLower(filename, ".brc") ||
+ strSuffixLower(filename, ".gds"));
+}
+
+static boolean checkForPackageFromBasename_BD(char *basename)
+{
+ // check for native BD level file extensions
+ if (!isLevelsetFilename_BD(basename))
+ return FALSE;
+
+ // check for standard single-level BD files (like "001.bd")
+ if (strSuffixLower(basename, ".bd") &&
+ strlen(basename) == 6 &&
+ basename[0] >= '0' && basename[0] <= '9' &&
+ basename[1] >= '0' && basename[1] <= '9' &&
+ basename[2] >= '0' && basename[2] <= '9')
+ return FALSE;
+
+ // this is a level package in native BD file format
+ return TRUE;
+}
+
static char *getLevelFilenameFromBasename(char *basename)
{
static char *filename = NULL;
strchr(basename, '%') == NULL)
return LEVEL_FILE_TYPE_SB;
+ // check for typical filename of a Boulder Dash (GDash) level package file
+ if (checkForPackageFromBasename_BD(basename))
+ return LEVEL_FILE_TYPE_BD;
+
// ---------- try to determine file type from filesize ----------
checked_free(filename);
char *getGlobalLevelTemplateFilename(void)
{
- // global variable "leveldir_current" must be modified in the loop below
- LevelDirTree *leveldir_current_last = leveldir_current;
- char *filename = NULL;
-
- // check for template level in path from current to topmost tree node
-
- while (leveldir_current != NULL)
- {
- filename = getDefaultLevelFilename(-1);
-
- if (fileExists(filename))
- break;
-
- leveldir_current = leveldir_current->node_parent;
- }
-
- // restore global variable "leveldir_current" modified in above loop
- leveldir_current = leveldir_current_last;
-
- return filename;
+ return getFilenameFromCurrentLevelDirUpward(LEVELTEMPLATE_FILENAME);
}
static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi)
if (fileExists(lfi->filename))
return;
+ // check for native Boulder Dash level file
+ setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_BD, "%03d.bd", nr);
+ if (fileExists(lfi->filename))
+ return;
+
// check for Emerald Mine level file (V1)
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_EM, "a%c%c",
'a' + (nr / 10) % 26, '0' + nr % 10);
// functions for loading BD level
// ----------------------------------------------------------------------------
+#define LEVEL_TO_CAVE(e) (map_element_RND_to_BD_cave(e))
+#define CAVE_TO_LEVEL(e) (map_element_BD_to_RND_cave(e))
+
static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
{
struct LevelInfo_BD *level_bd = level->native_bd_level;
+ GdCave *cave = NULL; // will be changed below
+ int cave_w = MIN(level->fieldx, MAX_PLAYFIELD_WIDTH);
+ int cave_h = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT);
+ int x, y;
- level_bd->width = MIN(level->fieldx, MAX_PLAYFIELD_WIDTH);
- level_bd->height = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT);
+ setLevelInfoToDefaults_BD_Ext(cave_w, cave_h);
+
+ // cave and map newly allocated when set to defaults above
+ cave = level_bd->cave;
+
+ // level type
+ cave->intermission = level->bd_intermission;
+
+ // level settings
+ cave->level_time[0] = level->time;
+ cave->level_diamonds[0] = level->gems_needed;
+
+ // game timing
+ cave->scheduling = level->bd_scheduling_type;
+ cave->pal_timing = level->bd_pal_timing;
+ cave->level_speed[0] = level->bd_cycle_delay_ms;
+ cave->level_ckdelay[0] = level->bd_cycle_delay_c64;
+ cave->level_hatching_delay_frame[0] = level->bd_hatching_delay_cycles;
+ cave->level_hatching_delay_time[0] = level->bd_hatching_delay_seconds;
+
+ // scores
+ cave->level_timevalue[0] = level->score[SC_TIME_BONUS];
+ cave->diamond_value = level->score[SC_EMERALD];
+ cave->extra_diamond_value = level->score[SC_DIAMOND_EXTRA];
+
+ // compatibility settings
+ cave->lineshift = level->bd_line_shifting_borders;
+ cave->border_scan_first_and_last = level->bd_scan_first_and_last_row;
+ cave->short_explosions = level->bd_short_explosions;
+
+ // player properties
+ cave->diagonal_movements = level->bd_diagonal_movements;
+ cave->active_is_first_found = level->bd_topmost_player_active;
+ cave->pushing_stone_prob = level->bd_pushing_prob * 10000;
+ cave->pushing_stone_prob_sweet = level->bd_pushing_prob_with_sweet * 10000;
+ cave->mega_stones_pushable_with_sweet = level->bd_push_mega_rock_with_sweet;
+ cave->snap_element = LEVEL_TO_CAVE(level->bd_snap_element);
+
+ // element properties
+ cave->level_bonus_time[0] = level->bd_clock_extra_time;
+ cave->voodoo_collects_diamonds = level->bd_voodoo_collects_diamonds;
+ cave->voodoo_any_hurt_kills_player = level->bd_voodoo_hurt_kills_player;
+ cave->voodoo_dies_by_stone = level->bd_voodoo_dies_by_rock;
+ cave->voodoo_disappear_in_explosion = level->bd_voodoo_vanish_by_explosion;
+ cave->level_penalty_time[0] = level->bd_voodoo_penalty_time;
+ cave->level_magic_wall_time[0] = level->bd_magic_wall_time;
+ cave->magic_timer_zero_is_infinite = level->bd_magic_wall_zero_infinite;
+ cave->magic_timer_wait_for_hatching = level->bd_magic_wall_wait_hatching;
+ cave->magic_wall_stops_amoeba = level->bd_magic_wall_stops_amoeba;
+ cave->magic_wall_breakscan = level->bd_magic_wall_break_scan;
+
+ cave->magic_diamond_to = LEVEL_TO_CAVE(level->bd_magic_wall_diamond_to);
+ cave->magic_stone_to = LEVEL_TO_CAVE(level->bd_magic_wall_rock_to);
+ cave->magic_mega_stone_to = LEVEL_TO_CAVE(level->bd_magic_wall_mega_rock_to);
+ cave->magic_nut_to = LEVEL_TO_CAVE(level->bd_magic_wall_nut_to);
+ cave->magic_nitro_pack_to = LEVEL_TO_CAVE(level->bd_magic_wall_nitro_pack_to);
+ cave->magic_flying_diamond_to = LEVEL_TO_CAVE(level->bd_magic_wall_flying_diamond_to);
+ cave->magic_flying_stone_to = LEVEL_TO_CAVE(level->bd_magic_wall_flying_rock_to);
+
+ cave->amoeba_timer_wait_for_hatching = level->bd_amoeba_wait_for_hatching;
+ cave->amoeba_timer_started_immediately= level->bd_amoeba_start_immediately;
+ cave->amoeba_2_explodes_by_amoeba = level->bd_amoeba_2_explode_by_amoeba;
+ cave->level_amoeba_threshold[0] = level->bd_amoeba_1_threshold_too_big;
+ cave->level_amoeba_time[0] = level->bd_amoeba_1_slow_growth_time;
+ cave->amoeba_growth_prob = level->bd_amoeba_1_slow_growth_rate * 10000;
+ cave->amoeba_fast_growth_prob = level->bd_amoeba_1_fast_growth_rate * 10000;
+ cave->level_amoeba_2_threshold[0] = level->bd_amoeba_2_threshold_too_big;
+ cave->level_amoeba_2_time[0] = level->bd_amoeba_2_slow_growth_time;
+ cave->amoeba_2_growth_prob = level->bd_amoeba_2_slow_growth_rate * 10000;
+ cave->amoeba_2_fast_growth_prob = level->bd_amoeba_2_fast_growth_rate * 10000;
+
+ cave->amoeba_too_big_effect = LEVEL_TO_CAVE(level->bd_amoeba_1_content_too_big);
+ cave->amoeba_enclosed_effect = LEVEL_TO_CAVE(level->bd_amoeba_1_content_enclosed);
+ cave->amoeba_2_too_big_effect = LEVEL_TO_CAVE(level->bd_amoeba_2_content_too_big);
+ cave->amoeba_2_enclosed_effect = LEVEL_TO_CAVE(level->bd_amoeba_2_content_enclosed);
+ cave->amoeba_2_explosion_effect = LEVEL_TO_CAVE(level->bd_amoeba_2_content_exploding);
+ cave->amoeba_2_looks_like = LEVEL_TO_CAVE(level->bd_amoeba_2_content_looks_like);
+
+ cave->slime_predictable = level->bd_slime_is_predictable;
+ cave->slime_correct_random = level->bd_slime_correct_random;
+ cave->level_slime_permeability[0] = level->bd_slime_permeability_rate * 10000;
+ cave->level_slime_permeability_c64[0] = level->bd_slime_permeability_bits_c64;
+ cave->level_slime_seed_c64[0] = level->bd_slime_random_seed_c64;
+ cave->level_rand[0] = level->bd_cave_random_seed_c64;
+ cave->slime_eats_1 = LEVEL_TO_CAVE(level->bd_slime_eats_element_1);
+ cave->slime_converts_1 = LEVEL_TO_CAVE(level->bd_slime_converts_to_element_1);
+ cave->slime_eats_2 = LEVEL_TO_CAVE(level->bd_slime_eats_element_2);
+ cave->slime_converts_2 = LEVEL_TO_CAVE(level->bd_slime_converts_to_element_2);
+ cave->slime_eats_3 = LEVEL_TO_CAVE(level->bd_slime_eats_element_3);
+ cave->slime_converts_3 = LEVEL_TO_CAVE(level->bd_slime_converts_to_element_3);
+
+ cave->acid_eats_this = LEVEL_TO_CAVE(level->bd_acid_eats_element);
+ cave->acid_spread_ratio = level->bd_acid_spread_rate * 10000;
+ cave->acid_turns_to = LEVEL_TO_CAVE(level->bd_acid_turns_to_element);
+
+ cave->biter_delay_frame = level->bd_biter_move_delay;
+ cave->biter_eat = LEVEL_TO_CAVE(level->bd_biter_eats_element);
+
+ cave->bladder_converts_by = LEVEL_TO_CAVE(level->bd_bladder_converts_by_element);
+
+ cave->expanding_wall_changed = level->bd_change_expanding_wall;
+
+ cave->replicators_active = level->bd_replicators_active;
+ cave->replicator_delay_frame = level->bd_replicator_create_delay;
+
+ cave->conveyor_belts_active = level->bd_conveyor_belts_active;
+ cave->conveyor_belts_direction_changed= level->bd_conveyor_belts_changed;
+
+ cave->water_does_not_flow_down = level->bd_water_cannot_flow_down;
+
+ cave->nut_turns_to_when_crushed = LEVEL_TO_CAVE(level->bd_nut_content);
+
+ cave->pneumatic_hammer_frame = level->bd_hammer_walls_break_delay;
+ cave->hammered_walls_reappear = level->bd_hammer_walls_reappear;
+ cave->hammered_wall_reappear_frame = level->bd_hammer_walls_reappear_delay;
+
+ cave->infinite_rockets = level->bd_infinite_rockets;
+
+ cave->skeletons_needed_for_pot = level->bd_num_skeletons_needed_for_pot;
+ cave->skeletons_worth_diamonds = level->bd_skeleton_worth_num_diamonds;
+
+ cave->expanding_wall_looks_like = LEVEL_TO_CAVE(level->bd_expanding_wall_looks_like);
+ cave->dirt_looks_like = LEVEL_TO_CAVE(level->bd_sand_looks_like);
+
+ cave->creatures_backwards = level->bd_creatures_start_backwards;
+ cave->creatures_direction_auto_change_on_start = level->bd_creatures_turn_on_hatching;
+ cave->creatures_direction_auto_change_time = level->bd_creatures_auto_turn_delay;
+
+ cave->gravity = level->bd_gravity_direction;
+ cave->gravity_switch_active = level->bd_gravity_switch_active;
+ cave->gravity_change_time = level->bd_gravity_switch_delay;
+ cave->gravity_affects_all = level->bd_gravity_affects_all;
+
+ cave->stone_falling_effect = LEVEL_TO_CAVE(level->bd_rock_turns_to_on_falling);
+ cave->stone_bouncing_effect = LEVEL_TO_CAVE(level->bd_rock_turns_to_on_impact);
+ cave->diamond_falling_effect = LEVEL_TO_CAVE(level->bd_diamond_turns_to_on_falling);
+ cave->diamond_bouncing_effect = LEVEL_TO_CAVE(level->bd_diamond_turns_to_on_impact);
+
+ cave->firefly_explode_to = LEVEL_TO_CAVE(level->bd_firefly_1_explodes_to);
+ cave->alt_firefly_explode_to = LEVEL_TO_CAVE(level->bd_firefly_2_explodes_to);
+ cave->butterfly_explode_to = LEVEL_TO_CAVE(level->bd_butterfly_1_explodes_to);
+ cave->alt_butterfly_explode_to = LEVEL_TO_CAVE(level->bd_butterfly_2_explodes_to);
+ cave->stonefly_explode_to = LEVEL_TO_CAVE(level->bd_stonefly_explodes_to);
+ cave->dragonfly_explode_to = LEVEL_TO_CAVE(level->bd_dragonfly_explodes_to);
+
+ cave->diamond_birth_effect = LEVEL_TO_CAVE(level->bd_diamond_birth_turns_to);
+ cave->bomb_explosion_effect = LEVEL_TO_CAVE(level->bd_bomb_explosion_turns_to);
+ cave->nitro_explosion_effect = LEVEL_TO_CAVE(level->bd_nitro_explosion_turns_to);
+ cave->explosion_effect = LEVEL_TO_CAVE(level->bd_explosion_turns_to);
+
+ cave->colorb = level->bd_color_b;
+ cave->color0 = level->bd_color_0;
+ cave->color1 = level->bd_color_1;
+ cave->color2 = level->bd_color_2;
+ cave->color3 = level->bd_color_3;
+ cave->color4 = level->bd_color_4;
+ cave->color5 = level->bd_color_5;
+
+ // level name
+ strncpy(cave->name, level->name, sizeof(GdString));
+ cave->name[sizeof(GdString) - 1] = '\0';
+
+ // playfield elements
+ for (x = 0; x < cave->w; x++)
+ for (y = 0; y < cave->h; y++)
+ cave->map[y][x] = LEVEL_TO_CAVE(level->field[x][y]);
}
static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
{
struct LevelInfo_BD *level_bd = level->native_bd_level;
+ GdCave *cave = level_bd->cave;
+ int bd_level_nr = level_bd->level_nr;
+ int x, y;
+
+ level->fieldx = MIN(cave->w, MAX_LEV_FIELDX);
+ level->fieldy = MIN(cave->h, MAX_LEV_FIELDY);
+
+ // level type
+ level->bd_intermission = cave->intermission;
+
+ // level settings
+ level->time = cave->level_time[bd_level_nr];
+ level->gems_needed = cave->level_diamonds[bd_level_nr];
+
+ // game timing
+ level->bd_scheduling_type = cave->scheduling;
+ level->bd_pal_timing = cave->pal_timing;
+ level->bd_cycle_delay_ms = cave->level_speed[bd_level_nr];
+ level->bd_cycle_delay_c64 = cave->level_ckdelay[bd_level_nr];
+ level->bd_hatching_delay_cycles = cave->level_hatching_delay_frame[bd_level_nr];
+ level->bd_hatching_delay_seconds = cave->level_hatching_delay_time[bd_level_nr];
+
+ // scores
+ level->score[SC_TIME_BONUS] = cave->level_timevalue[bd_level_nr];
+ level->score[SC_EMERALD] = cave->diamond_value;
+ level->score[SC_DIAMOND_EXTRA] = cave->extra_diamond_value;
+
+ // compatibility settings
+ level->bd_line_shifting_borders = cave->lineshift;
+ level->bd_scan_first_and_last_row = cave->border_scan_first_and_last;
+ level->bd_short_explosions = cave->short_explosions;
+
+ // player properties
+ level->bd_diagonal_movements = cave->diagonal_movements;
+ level->bd_topmost_player_active = cave->active_is_first_found;
+ level->bd_pushing_prob = cave->pushing_stone_prob / 10000;
+ level->bd_pushing_prob_with_sweet = cave->pushing_stone_prob_sweet / 10000;
+ level->bd_push_mega_rock_with_sweet = cave->mega_stones_pushable_with_sweet;
+ level->bd_snap_element = CAVE_TO_LEVEL(cave->snap_element);
+
+ // element properties
+ level->bd_clock_extra_time = cave->level_bonus_time[bd_level_nr];
+ level->bd_voodoo_collects_diamonds = cave->voodoo_collects_diamonds;
+ level->bd_voodoo_hurt_kills_player = cave->voodoo_any_hurt_kills_player;
+ level->bd_voodoo_dies_by_rock = cave->voodoo_dies_by_stone;
+ level->bd_voodoo_vanish_by_explosion = cave->voodoo_disappear_in_explosion;
+ level->bd_voodoo_penalty_time = cave->level_penalty_time[bd_level_nr];
+ level->bd_magic_wall_time = cave->level_magic_wall_time[bd_level_nr];
+ level->bd_magic_wall_zero_infinite = cave->magic_timer_zero_is_infinite;
+ level->bd_magic_wall_wait_hatching = cave->magic_timer_wait_for_hatching;
+ level->bd_magic_wall_stops_amoeba = cave->magic_wall_stops_amoeba;
+ level->bd_magic_wall_break_scan = cave->magic_wall_breakscan;
+
+ level->bd_magic_wall_diamond_to = CAVE_TO_LEVEL(cave->magic_diamond_to);
+ level->bd_magic_wall_rock_to = CAVE_TO_LEVEL(cave->magic_stone_to);
+ level->bd_magic_wall_mega_rock_to = CAVE_TO_LEVEL(cave->magic_mega_stone_to);
+ level->bd_magic_wall_nut_to = CAVE_TO_LEVEL(cave->magic_nut_to);
+ level->bd_magic_wall_nitro_pack_to = CAVE_TO_LEVEL(cave->magic_nitro_pack_to);
+ level->bd_magic_wall_flying_diamond_to= CAVE_TO_LEVEL(cave->magic_flying_diamond_to);
+ level->bd_magic_wall_flying_rock_to = CAVE_TO_LEVEL(cave->magic_flying_stone_to);
+
+ level->bd_amoeba_wait_for_hatching = cave->amoeba_timer_wait_for_hatching;
+ level->bd_amoeba_start_immediately = cave->amoeba_timer_started_immediately;
+ level->bd_amoeba_2_explode_by_amoeba = cave->amoeba_2_explodes_by_amoeba;
+ level->bd_amoeba_1_threshold_too_big = cave->level_amoeba_threshold[bd_level_nr];
+ level->bd_amoeba_1_slow_growth_time = cave->level_amoeba_time[bd_level_nr];
+ level->bd_amoeba_1_slow_growth_rate = cave->amoeba_growth_prob / 10000;
+ level->bd_amoeba_1_fast_growth_rate = cave->amoeba_fast_growth_prob / 10000;
+ level->bd_amoeba_2_threshold_too_big = cave->level_amoeba_2_threshold[bd_level_nr];
+ level->bd_amoeba_2_slow_growth_time = cave->level_amoeba_2_time[bd_level_nr];
+ level->bd_amoeba_2_slow_growth_rate = cave->amoeba_2_growth_prob / 10000;
+ level->bd_amoeba_2_fast_growth_rate = cave->amoeba_2_fast_growth_prob / 10000;
+
+ level->bd_amoeba_1_content_too_big = CAVE_TO_LEVEL(cave->amoeba_too_big_effect);
+ level->bd_amoeba_1_content_enclosed = CAVE_TO_LEVEL(cave->amoeba_enclosed_effect);
+ level->bd_amoeba_2_content_too_big = CAVE_TO_LEVEL(cave->amoeba_2_too_big_effect);
+ level->bd_amoeba_2_content_enclosed = CAVE_TO_LEVEL(cave->amoeba_2_enclosed_effect);
+ level->bd_amoeba_2_content_exploding = CAVE_TO_LEVEL(cave->amoeba_2_explosion_effect);
+ level->bd_amoeba_2_content_looks_like = CAVE_TO_LEVEL(cave->amoeba_2_looks_like);
+
+ level->bd_slime_is_predictable = cave->slime_predictable;
+ level->bd_slime_correct_random = cave->slime_correct_random;
+ level->bd_slime_permeability_rate = cave->level_slime_permeability[bd_level_nr] / 10000;
+ level->bd_slime_permeability_bits_c64 = cave->level_slime_permeability_c64[bd_level_nr];
+ level->bd_slime_random_seed_c64 = cave->level_slime_seed_c64[bd_level_nr];
+ level->bd_cave_random_seed_c64 = cave->level_rand[bd_level_nr];
+ level->bd_slime_eats_element_1 = CAVE_TO_LEVEL(cave->slime_eats_1);
+ level->bd_slime_converts_to_element_1 = CAVE_TO_LEVEL(cave->slime_converts_1);
+ level->bd_slime_eats_element_2 = CAVE_TO_LEVEL(cave->slime_eats_2);
+ level->bd_slime_converts_to_element_2 = CAVE_TO_LEVEL(cave->slime_converts_2);
+ level->bd_slime_eats_element_3 = CAVE_TO_LEVEL(cave->slime_eats_3);
+ level->bd_slime_converts_to_element_3 = CAVE_TO_LEVEL(cave->slime_converts_3);
+
+ level->bd_acid_eats_element = CAVE_TO_LEVEL(cave->acid_eats_this);
+ level->bd_acid_spread_rate = cave->acid_spread_ratio / 10000;
+ level->bd_acid_turns_to_element = CAVE_TO_LEVEL(cave->acid_turns_to);
+
+ level->bd_biter_move_delay = cave->biter_delay_frame;
+ level->bd_biter_eats_element = CAVE_TO_LEVEL(cave->biter_eat);
+
+ level->bd_bladder_converts_by_element = CAVE_TO_LEVEL(cave->bladder_converts_by);
+
+ level->bd_change_expanding_wall = cave->expanding_wall_changed;
+
+ level->bd_replicators_active = cave->replicators_active;
+ level->bd_replicator_create_delay = cave->replicator_delay_frame;
+
+ level->bd_conveyor_belts_active = cave->conveyor_belts_active;
+ level->bd_conveyor_belts_changed = cave->conveyor_belts_direction_changed;
+
+ level->bd_water_cannot_flow_down = cave->water_does_not_flow_down;
+
+ level->bd_nut_content = CAVE_TO_LEVEL(cave->nut_turns_to_when_crushed);
+
+ level->bd_hammer_walls_break_delay = cave->pneumatic_hammer_frame;
+ level->bd_hammer_walls_reappear = cave->hammered_walls_reappear;
+ level->bd_hammer_walls_reappear_delay = cave->hammered_wall_reappear_frame;
+
+ level->bd_infinite_rockets = cave->infinite_rockets;
+
+ level->bd_num_skeletons_needed_for_pot= cave->skeletons_needed_for_pot;
+ level->bd_skeleton_worth_num_diamonds = cave->skeletons_worth_diamonds;
+
+ level->bd_expanding_wall_looks_like = CAVE_TO_LEVEL(cave->expanding_wall_looks_like);
+ level->bd_sand_looks_like = CAVE_TO_LEVEL(cave->dirt_looks_like);
+
+ level->bd_creatures_start_backwards = cave->creatures_backwards;
+ level->bd_creatures_turn_on_hatching = cave->creatures_direction_auto_change_on_start;
+ level->bd_creatures_auto_turn_delay = cave->creatures_direction_auto_change_time;
+
+ level->bd_gravity_direction = cave->gravity;
+ level->bd_gravity_switch_active = cave->gravity_switch_active;
+ level->bd_gravity_switch_delay = cave->gravity_change_time;
+ level->bd_gravity_affects_all = cave->gravity_affects_all;
+
+ level->bd_rock_turns_to_on_falling = CAVE_TO_LEVEL(cave->stone_falling_effect);
+ level->bd_rock_turns_to_on_impact = CAVE_TO_LEVEL(cave->stone_bouncing_effect);
+ level->bd_diamond_turns_to_on_falling = CAVE_TO_LEVEL(cave->diamond_falling_effect);
+ level->bd_diamond_turns_to_on_impact = CAVE_TO_LEVEL(cave->diamond_bouncing_effect);
+
+ level->bd_firefly_1_explodes_to = CAVE_TO_LEVEL(cave->firefly_explode_to);
+ level->bd_firefly_2_explodes_to = CAVE_TO_LEVEL(cave->alt_firefly_explode_to);
+ level->bd_butterfly_1_explodes_to = CAVE_TO_LEVEL(cave->butterfly_explode_to);
+ level->bd_butterfly_2_explodes_to = CAVE_TO_LEVEL(cave->alt_butterfly_explode_to);
+ level->bd_stonefly_explodes_to = CAVE_TO_LEVEL(cave->stonefly_explode_to);
+ level->bd_dragonfly_explodes_to = CAVE_TO_LEVEL(cave->dragonfly_explode_to);
+
+ level->bd_diamond_birth_turns_to = CAVE_TO_LEVEL(cave->diamond_birth_effect);
+ level->bd_bomb_explosion_turns_to = CAVE_TO_LEVEL(cave->bomb_explosion_effect);
+ level->bd_nitro_explosion_turns_to = CAVE_TO_LEVEL(cave->nitro_explosion_effect);
+ level->bd_explosion_turns_to = CAVE_TO_LEVEL(cave->explosion_effect);
+
+ level->bd_color_b = cave->colorb;
+ level->bd_color_0 = cave->color0;
+ level->bd_color_1 = cave->color1;
+ level->bd_color_2 = cave->color2;
+ level->bd_color_3 = cave->color3;
+ level->bd_color_4 = cave->color4;
+ level->bd_color_5 = cave->color5;
+
+ // set default color type and colors for BD style level colors
+ SetDefaultLevelColorType_BD();
+ SetDefaultLevelColors_BD();
+
+ // level name
+ char *cave_name_latin1 = getLatin1FromUTF8(cave->name);
+ char *cave_name_final = (gd_caveset_has_levels() ?
+ getStringPrint("%s / %d", cave_name_latin1, bd_level_nr + 1) :
+ getStringCopy(cave_name_latin1));
+
+ strncpy(level->name, cave_name_final, MAX_LEVEL_NAME_LEN);
+ level->name[MAX_LEVEL_NAME_LEN] = '\0';
+
+ // playfield elements
+ for (x = 0; x < level->fieldx; x++)
+ for (y = 0; y < level->fieldy; y++)
+ level->field[x][y] = CAVE_TO_LEVEL(cave->map[y][x]);
+
+ checked_free(cave_name_latin1);
+ checked_free(cave_name_final);
+}
+
+static void setTapeInfoToDefaults(void);
+
+static void CopyNativeTape_BD_to_RND(struct LevelInfo *level)
+{
+ struct LevelInfo_BD *level_bd = level->native_bd_level;
+ GdCave *cave = level_bd->cave;
+ GdReplay *replay = level_bd->replay;
+ int i;
+
+ if (replay == NULL)
+ return;
+
+ // always start with reliable default values
+ setTapeInfoToDefaults();
+
+ tape.level_nr = level_nr; // (currently not used)
+ tape.random_seed = replay->seed;
+
+ TapeSetDateFromIsoDateString(replay->date);
+
+ tape.counter = 0;
+ tape.pos[tape.counter].delay = 0;
+
+ tape.bd_replay = TRUE;
+
+ // all time calculations only used to display approximate tape time
+ int cave_speed = cave->speed;
+ int milliseconds_game = 0;
+ int milliseconds_elapsed = 20;
+
+ for (i = 0; i < replay->movements->len; i++)
+ {
+ int replay_action = replay->movements->data[i];
+ int tape_action = map_action_BD_to_RND(replay_action);
+ byte action[MAX_TAPE_ACTIONS] = { tape_action };
+ boolean success = 0;
+
+ while (1)
+ {
+ success = TapeAddAction(action);
+
+ milliseconds_game += milliseconds_elapsed;
+
+ if (milliseconds_game >= cave_speed)
+ {
+ milliseconds_game -= cave_speed;
- level->fieldx = MIN(level_bd->width, MAX_LEV_FIELDX);
- level->fieldy = MIN(level_bd->height, MAX_LEV_FIELDY);
+ break;
+ }
+ }
+
+ tape.counter++;
+ tape.pos[tape.counter].delay = 0;
+ tape.pos[tape.counter].action[0] = 0;
+
+ if (!success)
+ {
+ Warn("BD replay truncated: size exceeds maximum tape size %d", MAX_TAPE_LEN);
+
+ break;
+ }
+ }
+
+ TapeHaltRecording();
+
+ if (!replay->success)
+ Warn("BD replay is marked as not successful");
}
demo->is_available = TRUE;
}
-static void setTapeInfoToDefaults(void);
-
static void CopyNativeTape_SP_to_RND(struct LevelInfo *level)
{
struct LevelInfo_SP *level_sp = level->native_sp_level;
boolean invalid_playfield_char = FALSE;
boolean load_xsb_to_ces = check_special_flags("load_xsb_to_ces");
int file_level_nr = 0;
- int line_nr = 0;
int x = 0, y = 0; // initialized to make compilers happy
last_comment[0] = '\0';
if (!getStringFromFile(file, line, MAX_LINE_LEN))
break;
- // check if line was completely read and is terminated by line break
- if (strlen(line) > 0 && line[strlen(line) - 1] == '\n')
- line_nr++;
-
// cut trailing line break (this can be newline and/or carriage return)
for (line_ptr = &line[strlen(line)]; line_ptr >= line; line_ptr--)
if ((*line_ptr == '\n' || *line_ptr == '\r') && *(line_ptr + 1) == '\0')
// functions for handling native levels
// -------------------------------------------------------------------------
+static void LoadLevelFromFileInfo_BD(struct LevelInfo *level,
+ struct LevelFileInfo *level_file_info,
+ boolean level_info_only)
+{
+ int pos = 0;
+
+ // determine position of requested level inside level package
+ if (level_file_info->packed)
+ pos = level_file_info->nr - leveldir_current->first_level;
+
+ if (!LoadNativeLevel_BD(level_file_info->filename, pos, level_info_only))
+ level->no_valid_file = TRUE;
+}
+
static void LoadLevelFromFileInfo_EM(struct LevelInfo *level,
struct LevelFileInfo *level_file_info,
boolean level_info_only)
void SaveNativeLevel(struct LevelInfo *level)
{
- if (level->game_engine_type == GAME_ENGINE_TYPE_SP)
+ // saving native level files only supported for some game engines
+ if (level->game_engine_type != GAME_ENGINE_TYPE_BD &&
+ level->game_engine_type != GAME_ENGINE_TYPE_SP)
+ return;
+
+ char *file_ext = (level->game_engine_type == GAME_ENGINE_TYPE_BD ? "bd" :
+ level->game_engine_type == GAME_ENGINE_TYPE_SP ? "sp" : "");
+ char *basename = getSingleLevelBasenameExt(level->file_info.nr, file_ext);
+ char *filename = getLevelFilenameFromBasename(basename);
+
+ if (fileExists(filename) && !Request("Native level file already exists! Overwrite it?", REQ_ASK))
+ return;
+
+ boolean success = FALSE;
+
+ if (level->game_engine_type == GAME_ENGINE_TYPE_BD)
{
- char *basename = getSingleLevelBasenameExt(level->file_info.nr, "sp");
- char *filename = getLevelFilenameFromBasename(basename);
+ CopyNativeLevel_RND_to_BD(level);
+ // CopyNativeTape_RND_to_BD(level);
+ success = SaveNativeLevel_BD(filename);
+ }
+ else if (level->game_engine_type == GAME_ENGINE_TYPE_SP)
+ {
CopyNativeLevel_RND_to_SP(level);
CopyNativeTape_RND_to_SP(level);
- SaveNativeLevel_SP(filename);
+ success = SaveNativeLevel_SP(filename);
}
+
+ if (success)
+ Request("Native level file saved!", REQ_CONFIRM);
+ else
+ Request("Failed to save native level file!", REQ_CONFIRM);
}
LoadLevelFromFileInfo_RND(level, level_file_info, level_info_only);
break;
+ case LEVEL_FILE_TYPE_BD:
+ LoadLevelFromFileInfo_BD(level, level_file_info, level_info_only);
+ level->game_engine_type = GAME_ENGINE_TYPE_BD;
+ break;
+
case LEVEL_FILE_TYPE_EM:
LoadLevelFromFileInfo_EM(level, level_file_info, level_info_only);
level->game_engine_type = GAME_ENGINE_TYPE_EM;
if (level->no_valid_file)
setLevelInfoToDefaults(level, level_info_only, FALSE);
+ if (check_special_flags("use_native_bd_game_engine"))
+ level->game_engine_type = GAME_ENGINE_TYPE_BD;
+
if (level->game_engine_type == GAME_ENGINE_TYPE_UNKNOWN)
level->game_engine_type = GAME_ENGINE_TYPE_RND;
LoadLevelFromFileInfo(level, &level_file_info, FALSE);
}
+static void LoadLevel_FixEnvelopes(struct LevelInfo *level, boolean skip_single_lines)
+{
+ // This function removes newlines in envelopes after lines of text ending in the last column
+ // of the envelope. In earlier versions, these newlines were removed when displaying envelopes,
+ // but caused trouble in the level editor. In version 4.3.2.3, this problem was partially
+ // fixed in the level editor (but only for single full-width text lines followed by a newline,
+ // not for multiple lines ending in the last column, followed by a newline), but now produced
+ // unwanted newlines in the game for envelopes stored by previous game versions, which was not
+ // intended by the level author (and sometimes caused text lines not being displayed anymore at
+ // the bottom of the envelope).
+ //
+ // This function should solve these problems by removing such newline characters from envelopes
+ // stored by older game versions.
+
+ int envelope_nr;
+
+ for (envelope_nr = 0; envelope_nr < NUM_ENVELOPES; envelope_nr++)
+ {
+ char *envelope_ptr = level->envelope[envelope_nr].text;
+ int envelope_xsize = level->envelope[envelope_nr].xsize;
+ int envelope_size = strlen(envelope_ptr);
+ int start = 0;
+ int i;
+
+ for (i = 0; i < envelope_size; i++)
+ {
+ // check for newlines in envelope
+ if (envelope_ptr[i] == '\n')
+ {
+ int line_length = i - start;
+
+ // check for (non-empty) lines that are a multiple of the envelope width,
+ // causing a line break inside the envelope (text area in editor and in game)
+ if (line_length > 0 && line_length % envelope_xsize == 0)
+ {
+ // special case: skip fixing single lines for newer versions
+ boolean skip_fixing_line = (line_length == 1 && skip_single_lines);
+
+ if (!skip_fixing_line)
+ {
+ int j;
+
+ // remove newline character from string
+ for (j = i; j < envelope_size; j++)
+ envelope_ptr[j] = envelope_ptr[j + 1];
+ }
+
+ // continue with next line (that was copied over the newline)
+ start = i;
+ }
+ else
+ {
+ // continue with next character after newline
+ start = i + 1;
+ }
+ }
+ }
+ }
+}
+
static void LoadLevel_InitVersion(struct LevelInfo *level)
{
int i, j;
// CE changing to player was kept under the player if walkable up to 4.2.3.1
if (level->game_version <= VERSION_IDENT(4,2,3,1))
level->keep_walkable_ce = TRUE;
+
+ // envelopes may contain broken or too many line breaks before 4.4.0.0
+ if (level->game_version < VERSION_IDENT(4,4,0,0))
+ LoadLevel_FixEnvelopes(level, (level->game_version >= VERSION_IDENT(4,3,2,3)));
}
static void LoadLevel_InitSettings_SB(struct LevelInfo *level)
CloseAllAndExit(0);
}
+void DumpLevelsetFromFilename_BD(char *filename)
+{
+ if (leveldir_current == NULL) // no levelsets loaded yet
+ bd_open_all();
+
+ if (!LoadNativeLevel_BD(filename, 0, FALSE))
+ CloseAllAndExit(0); // function has already printed warning
+
+ PrintLine("-", 79);
+ Print("Levelset '%s'\n", filename);
+ PrintLine("-", 79);
+
+ DumpLevelset_BD();
+
+ PrintLine("-", 79);
+
+ CloseAllAndExit(0);
+}
+
+void DumpLevelset(void)
+{
+ static LevelDirTree *dumplevelset_leveldir = NULL;
+
+ dumplevelset_leveldir = getTreeInfoFromIdentifier(leveldir_first,
+ global.dumplevelset_leveldir);
+ if (dumplevelset_leveldir == NULL)
+ Fail("no such level identifier: '%s'", global.dumplevelset_leveldir);
+
+ PrintLine("-", 79);
+ Print("Levelset '%s'\n", dumplevelset_leveldir->identifier);
+ PrintLine("-", 79);
+
+ Print("Number of levels: %d\n", dumplevelset_leveldir->levels);
+ Print("First level number: %d\n", dumplevelset_leveldir->first_level);
+
+ PrintLine("-", 79);
+
+ CloseAllAndExit(0);
+}
+
// ============================================================================
// tape file functions
LoadTapeFromFilename(filename);
- if (TAPE_IS_EMPTY(tape) &&
- level.game_engine_type == GAME_ENGINE_TYPE_SP &&
- level.native_sp_level->demo.is_available)
- CopyNativeTape_SP_to_RND(&level);
+ if (TAPE_IS_EMPTY(tape))
+ {
+ if (level.game_engine_type == GAME_ENGINE_TYPE_BD &&
+ level.native_bd_level->replay != NULL)
+ CopyNativeTape_BD_to_RND(&level);
+ else if (level.game_engine_type == GAME_ENGINE_TYPE_SP &&
+ level.native_sp_level->demo.is_available)
+ CopyNativeTape_SP_to_RND(&level);
+ }
}
void LoadScoreTape(char *score_tape_basename, int nr)
TYPE_SWITCH,
&setup.skip_levels, "skip_levels"
},
+ {
+ TYPE_SWITCH_3_STATES,
+ &setup.allow_skipping_levels, "allow_skipping_levels"
+ },
{
TYPE_SWITCH,
&setup.increment_levels, "increment_levels"
TYPE_INTEGER,
&setup.game_frame_delay, "game_frame_delay"
},
+ {
+ TYPE_INTEGER,
+ &setup.default_game_engine_type, "default_game_engine_type"
+ },
+ {
+ TYPE_SWITCH,
+ &setup.bd_skip_uncovering, "bd_skip_uncovering"
+ },
+ {
+ TYPE_SWITCH,
+ &setup.bd_skip_hatching, "bd_skip_hatching"
+ },
+ {
+ TYPE_SWITCH,
+ &setup.bd_scroll_delay, "bd_scroll_delay"
+ },
+ {
+ TYPE_SWITCH,
+ &setup.bd_show_invisible_outbox, "bd_show_invisible_outbox"
+ },
+ {
+ TYPE_SWITCH_3_STATES,
+ &setup.bd_smooth_movements, "bd_smooth_movements"
+ },
+ {
+ TYPE_SWITCH_3_STATES,
+ &setup.bd_pushing_graphics, "bd_pushing_graphics"
+ },
+ {
+ TYPE_SWITCH_3_STATES,
+ &setup.bd_up_down_graphics, "bd_up_down_graphics"
+ },
+ {
+ TYPE_SWITCH_3_STATES,
+ &setup.bd_falling_sounds, "bd_falling_sounds"
+ },
+ {
+ TYPE_INTEGER,
+ &setup.bd_palette_c64, "bd_palette_c64"
+ },
+ {
+ TYPE_INTEGER,
+ &setup.bd_palette_c64dtv, "bd_palette_c64dtv"
+ },
+ {
+ TYPE_INTEGER,
+ &setup.bd_palette_atari, "bd_palette_atari"
+ },
+ {
+ TYPE_INTEGER,
+ &setup.bd_default_color_type, "bd_default_color_type"
+ },
+ {
+ TYPE_SWITCH,
+ &setup.bd_random_colors, "bd_random_colors"
+ },
{
TYPE_SWITCH,
&setup.sp_show_border_elements, "sp_show_border_elements"
&setup.music_set, "music_set"
},
{
- TYPE_SWITCH3,
+ TYPE_SWITCH_3_STATES,
&setup.override_level_graphics, "override_level_graphics"
},
{
- TYPE_SWITCH3,
+ TYPE_SWITCH_3_STATES,
&setup.override_level_sounds, "override_level_sounds"
},
{
- TYPE_SWITCH3,
+ TYPE_SWITCH_3_STATES,
&setup.override_level_music, "override_level_music"
},
{
TYPE_INTEGER,
&setup.volume_music, "volume_music"
},
+ {
+ TYPE_SWITCH,
+ &setup.audio_sample_rate_44100, "audio_sample_rate_44100"
+ },
{
TYPE_SWITCH,
&setup.network_mode, "network_mode"
TYPE_SWITCH,
&setup.editor.show_element_token, "editor.show_element_token"
},
+ {
+ TYPE_SWITCH,
+ &setup.editor.fast_game_start, "editor.fast_game_start"
+ },
{
TYPE_SWITCH,
&setup.editor.show_read_only_warning, "editor.show_read_only_warning"
TYPE_SWITCH,
&setup.editor_cascade.el_bd, "editor.cascade.el_bd"
},
+ {
+ TYPE_SWITCH,
+ &setup.editor_cascade.el_bdx, "editor.cascade.el_bdx"
+ },
+ {
+ TYPE_SWITCH,
+ &setup.editor_cascade.el_bdx_effects, "editor.cascade.el_bdx_effects"
+ },
{
TYPE_SWITCH,
&setup.editor_cascade.el_em, "editor.cascade.el_em"
TYPE_KEY_X11,
&setup.shortcut.snap_down, "shortcut.snap_down"
},
+ {
+ TYPE_KEY_X11,
+ &setup.shortcut.speed_fast, "shortcut.speed_fast"
+ },
+ {
+ TYPE_KEY_X11,
+ &setup.shortcut.speed_slow, "shortcut.speed_slow"
+ },
};
static struct SetupInputInfo setup_input;
TYPE_BOOLEAN,
&setup.internal.menu_shortcuts_snap, "menu_shortcuts_snap"
},
+ {
+ TYPE_BOOLEAN,
+ &setup.internal.menu_shortcuts_speed, "menu_shortcuts_speed"
+ },
{
TYPE_BOOLEAN,
&setup.internal.info_title, "info_title"
&setup.debug.show_frames_per_second, "debug.show_frames_per_second"
},
{
- TYPE_SWITCH3,
+ TYPE_SWITCH_3_STATES,
&setup.debug.xsn_mode, "debug.xsn_mode"
},
{
si->team_mode = FALSE;
si->handicap = TRUE;
si->skip_levels = TRUE;
+ si->allow_skipping_levels = STATE_ASK;
si->increment_levels = TRUE;
si->auto_play_next_level = TRUE;
si->count_score_after_game = TRUE;
si->prefer_extra_panel_items = TRUE;
si->game_speed_extended = FALSE;
si->game_frame_delay = GAME_FRAME_DELAY;
+ si->default_game_engine_type = GAME_ENGINE_TYPE_RND;
+ si->bd_skip_uncovering = FALSE;
+ si->bd_skip_hatching = FALSE;
+ si->bd_scroll_delay = TRUE;
+ si->bd_show_invisible_outbox = FALSE;
+ si->bd_smooth_movements = STATE_TRUE;
+ si->bd_pushing_graphics = STATE_TRUE;
+ si->bd_up_down_graphics = STATE_TRUE;
+ si->bd_falling_sounds = STATE_AUTO;
+ si->bd_palette_c64 = GD_DEFAULT_PALETTE_C64;
+ si->bd_palette_c64dtv = GD_DEFAULT_PALETTE_C64DTV;
+ si->bd_palette_atari = GD_DEFAULT_PALETTE_ATARI;
+ si->bd_default_color_type = GD_DEFAULT_COLOR_TYPE;
+ si->bd_random_colors = FALSE;
si->sp_show_border_elements = FALSE;
si->small_game_graphics = FALSE;
si->show_load_save_buttons = FALSE;
si->sounds_set = getStringCopy(SND_CLASSIC_SUBDIR);
si->music_set = getStringCopy(MUS_CLASSIC_SUBDIR);
- si->override_level_graphics = FALSE;
- si->override_level_sounds = FALSE;
- si->override_level_music = FALSE;
+ si->override_level_graphics = STATE_FALSE;
+ si->override_level_sounds = STATE_FALSE;
+ si->override_level_music = STATE_FALSE;
si->volume_simple = 100; // percent
si->volume_loops = 100; // percent
si->volume_music = 100; // percent
+ si->audio_sample_rate_44100 = FALSE;
si->network_mode = FALSE;
si->network_player_nr = 0; // first player
si->touch.overlay_buttons = FALSE;
si->editor.el_boulderdash = TRUE;
+ si->editor.el_boulderdash_native = TRUE;
+ si->editor.el_boulderdash_effects = TRUE;
si->editor.el_emerald_mine = TRUE;
si->editor.el_emerald_mine_club = TRUE;
si->editor.el_more = TRUE;
si->editor.el_headlines = TRUE;
si->editor.show_element_token = FALSE;
+ si->editor.fast_game_start = FALSE;
si->editor.show_read_only_warning = TRUE;
si->shortcut.snap_up = DEFAULT_KEY_SNAP_UP;
si->shortcut.snap_down = DEFAULT_KEY_SNAP_DOWN;
+ si->shortcut.speed_fast = DEFAULT_KEY_SPEED_FAST;
+ si->shortcut.speed_slow = DEFAULT_KEY_SPEED_SLOW;
+
for (i = 0; i < MAX_PLAYERS; i++)
{
si->input[i].use_joystick = FALSE;
si->debug.show_frames_per_second = FALSE;
- si->debug.xsn_mode = AUTO;
+ si->debug.xsn_mode = STATE_AUTO;
si->debug.xsn_percent = 0;
si->options.verbose = FALSE;
static void setSetupInfoToDefaults_EditorCascade(struct SetupInfo *si)
{
si->editor_cascade.el_bd = TRUE;
+ si->editor_cascade.el_bdx = TRUE;
+ si->editor_cascade.el_bdx_effects = FALSE;
si->editor_cascade.el_em = TRUE;
si->editor_cascade.el_emc = TRUE;
si->editor_cascade.el_rnd = TRUE;
fprintf(file, "\n");
for (i = 0; i < ARRAY_SIZE(debug_setup_tokens); i++)
if (!strPrefix(debug_setup_tokens[i].text, "debug.xsn_") ||
- setup.debug.xsn_mode != AUTO)
+ setup.debug.xsn_mode != STATE_AUTO)
fprintf(file, "%s\n", getSetupLine(debug_setup_tokens, "", i));
fprintf(file, "\n");
{
if (isURL(token))
{
- result = get_hash_from_key(token); // unsigned int => int
+ result = get_hash_from_string(token); // unsigned int => int
result = ABS(result); // may be negative now
result += (result < MAX_IMAGE_FILES ? MAX_IMAGE_FILES : 0);
else if (strEqual(suffix, ".class"))
{
result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE :
- get_hash_from_key(value));
+ get_hash_from_string(value));
}
else if (strEqual(suffix, ".style"))
{
InitMenuDesignSettings_SpecialPostProcessing_AfterGraphics();
}
+void InitSoundSettings_FromHash(SetupFileHash *setup_file_hash,
+ boolean ignore_defaults)
+{
+ int i;
+
+ for (i = 0; sound_config_vars[i].token != NULL; i++)
+ {
+ char *value = getHashEntry(setup_file_hash, sound_config_vars[i].token);
+
+ // (ignore definitions set to "[DEFAULT]" which are already initialized)
+ if (ignore_defaults && strEqual(value, ARG_DEFAULT))
+ continue;
+
+ if (value != NULL)
+ *sound_config_vars[i].value =
+ get_token_parameter_value(sound_config_vars[i].token, value);
+ }
+}
+
+void InitSoundSettings_Static(void)
+{
+ // always start with reliable default values from static default config
+ InitSoundSettings_FromHash(sound_config_hash, FALSE);
+}
+
+static void LoadSoundSettingsFromFilename(char *filename)
+{
+ SetupFileHash *setup_file_hash;
+
+ if ((setup_file_hash = loadSetupFileHash(filename)) == NULL)
+ return;
+
+ // read (and overwrite with) values that may be specified in config file
+ InitSoundSettings_FromHash(setup_file_hash, TRUE);
+
+ freeSetupFileHash(setup_file_hash);
+}
+
+void LoadSoundSettings(void)
+{
+ char *filename_base = UNDEFINED_FILENAME, *filename_local;
+
+ InitSoundSettings_Static();
+
+ if (!GFX_OVERRIDE_ARTWORK(ARTWORK_TYPE_SOUNDS))
+ {
+ // first look for special settings configured in level series config
+ filename_base = getCustomArtworkLevelConfigFilename(ARTWORK_TYPE_SOUNDS);
+
+ if (fileExists(filename_base))
+ LoadSoundSettingsFromFilename(filename_base);
+ }
+
+ filename_local = getCustomArtworkConfigFilename(ARTWORK_TYPE_SOUNDS);
+
+ if (filename_local != NULL && !strEqual(filename_base, filename_local))
+ LoadSoundSettingsFromFilename(filename_local);
+}
+
void LoadUserDefinedEditorElementList(int **elements, int *num_elements)
{
char *filename = getEditorSetupFilename();