From: Holger Schemel Date: Sun, 10 Mar 2024 14:41:28 +0000 (+0100) Subject: added support for game cycle delay in BD engine to level editor X-Git-Tag: 4.4.0.0-test-1~217 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6e065ecbabc724e459b1fa0b60dd493aa165dfd0;p=rocksndiamonds.git added support for game cycle delay in BD engine to level editor --- diff --git a/src/editor.c b/src/editor.c index bc82cd1f..c5b1b4a7 100644 --- a/src/editor.c +++ b/src/editor.c @@ -429,6 +429,12 @@ enum GADGET_ID_LEVELSET_NUM_LEVELS_DOWN, GADGET_ID_LEVELSET_NUM_LEVELS_TEXT, GADGET_ID_LEVELSET_NUM_LEVELS_UP, + GADGET_ID_BD_CYCLE_DELAY_MS_DOWN, + GADGET_ID_BD_CYCLE_DELAY_MS_TEXT, + GADGET_ID_BD_CYCLE_DELAY_MS_UP, + GADGET_ID_BD_CYCLE_DELAY_C64_DOWN, + GADGET_ID_BD_CYCLE_DELAY_C64_TEXT, + GADGET_ID_BD_CYCLE_DELAY_C64_UP, GADGET_ID_ELEMENT_VALUE1_DOWN, GADGET_ID_ELEMENT_VALUE1_TEXT, GADGET_ID_ELEMENT_VALUE1_UP, @@ -752,6 +758,8 @@ enum ED_COUNTER_ID_LEVEL_RANDOM_SEED, ED_COUNTER_ID_LEVELSET_NUM_LEVELS, ED_COUNTER_ID_LEVEL_RANDOM, + ED_COUNTER_ID_BD_CYCLE_DELAY_MS, + ED_COUNTER_ID_BD_CYCLE_DELAY_C64, ED_COUNTER_ID_ELEMENT_VALUE1, ED_COUNTER_ID_ELEMENT_VALUE2, ED_COUNTER_ID_ELEMENT_VALUE3, @@ -1489,6 +1497,24 @@ static struct &random_placement_value, "random element placement:", NULL, "in" }, + { + ED_COUNTER_ID_BD_CYCLE_DELAY_MS, + ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(3), + 50, 500, + GADGET_ID_BD_CYCLE_DELAY_MS_DOWN, GADGET_ID_BD_CYCLE_DELAY_MS_UP, + GADGET_ID_BD_CYCLE_DELAY_MS_TEXT, GADGET_ID_NONE, + &level.bd_cycle_delay_ms, + NULL, NULL, "game cycle delay (ms)" + }, + { + ED_COUNTER_ID_BD_CYCLE_DELAY_C64, + ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(3), + 0, 32, + GADGET_ID_BD_CYCLE_DELAY_C64_DOWN, GADGET_ID_BD_CYCLE_DELAY_C64_UP, + GADGET_ID_BD_CYCLE_DELAY_C64_TEXT, GADGET_ID_NONE, + &level.bd_cycle_delay_c64, + NULL, NULL, "game cycle delay (C64-style)" + }, // ---------- element settings: configure (various elements) ---------------- @@ -10044,6 +10070,12 @@ static void DrawLevelConfigEngine(void) { int i; + // draw counter gadgets + if (level.bd_scheduling_type == GD_SCHEDULING_MILLISECONDS) + MapCounterButtons(ED_COUNTER_ID_BD_CYCLE_DELAY_MS); + else + MapCounterButtons(ED_COUNTER_ID_BD_CYCLE_DELAY_C64); + // draw checkbutton gadgets for (i = ED_CHECKBUTTON_ID_ENGINE_FIRST; i <= ED_CHECKBUTTON_ID_ENGINE_LAST; i++) MapCheckbuttonGadget(i); @@ -14561,6 +14593,11 @@ static void HandleSelectboxGadgets(struct GadgetInfo *gi) ReinitializeElementList(); ModifyEditorElementList(); } + else if (type_id == ED_SELECTBOX_ID_BD_SCHEDULING_TYPE) + { + // update BD cycle delay counter gadgets depending on BD scheduling type + DrawLevelConfigWindow(); + } // do not mark level as modified for certain non-level-changing gadgets if (type_id == ED_SELECTBOX_ID_LEVELSET_SAVE_MODE || diff --git a/src/files.c b/src/files.c index 4b2db0f8..898b33bb 100644 --- a/src/files.c +++ b/src/files.c @@ -291,6 +291,18 @@ static struct LevelFileConfigInfo chunk_config_INFO[] = &li.bd_pal_timing, FALSE }, + { + -1, -1, + TYPE_INTEGER, CONF_VALUE_16_BIT(6), + &li.bd_cycle_delay_ms, 200 + }, + + { + -1, -1, + TYPE_INTEGER, CONF_VALUE_8_BIT(17), + &li.bd_cycle_delay_c64, 0 + }, + { -1, -1, -1, -1, @@ -3727,14 +3739,16 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->level_time[i] = level->time; cave->level_diamonds[i] = level->gems_needed; cave->level_magic_wall_time[i] = level->time_magic_wall; + + cave->level_speed[i] = level->bd_cycle_delay_ms; + cave->level_ckdelay[i] = level->bd_cycle_delay_c64; + cave->level_timevalue[i] = level->score[SC_TIME_BONUS]; } cave->diamond_value = level->score[SC_EMERALD]; cave->extra_diamond_value = level->score[SC_DIAMOND_EXTRA]; - cave->level_speed[0] = 160; // set cave speed - cave->scheduling = level->bd_scheduling_type; cave->pal_timing = level->bd_pal_timing; cave->intermission = level->bd_intermission; @@ -3762,6 +3776,9 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->gems_needed = cave->level_diamonds[bd_level_nr]; level->time_magic_wall = cave->level_magic_wall_time[bd_level_nr]; + level->bd_cycle_delay_ms = cave->level_speed[bd_level_nr]; + level->bd_cycle_delay_c64 = cave->level_ckdelay[bd_level_nr]; + 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; diff --git a/src/main.h b/src/main.h index 18479583..fc1a1cec 100644 --- a/src/main.h +++ b/src/main.h @@ -3482,6 +3482,8 @@ struct LevelInfo boolean bd_scheduling_type; // BD engine scheduling type boolean bd_pal_timing; // BD engine special timing + boolean bd_cycle_delay_ms; // BD game cycle delay (in milliseconds) + boolean bd_cycle_delay_c64; // BD game cycle delay (in C64 game units) boolean bd_intermission; // BD level is intermission boolean bd_diagonal_movements; // BD style diagonal movements boolean em_slippery_gems; // EM style "gems slip from wall" behaviour