From 74ed6f367314f4b4f373b45f82cedd04595a2608 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 14 Mar 2007 00:36:26 +0100 Subject: [PATCH] rnd-20070314-1-src * added internal ad-hoc config settings for displaying text files like title messages or "readme.txt" style level set info files: - .autowrap: true,false (default: true) - .centered: true,false (default: false) - .skip_comments: true,false (default: true) (the leading '.' and the separating ':' are mandatory here) --- ChangeLog | 8 ++ src/conf_gfx.c | 101 ++++++++------- src/conf_var.c | 252 +++++++++++++++++-------------------- src/conftime.h | 2 +- src/game.c | 234 ++++++++++++++++++++++++----------- src/game.h | 18 +-- src/libgame/misc.c | 5 + src/libgame/misc.h | 2 + src/libgame/setup.c | 294 +++++++++++++++++++++++++++++++++++++++++++- src/libgame/setup.h | 2 + src/libgame/text.c | 88 +++++++++++++ src/main.h | 2 +- src/screens.c | 32 ++--- 13 files changed, 745 insertions(+), 295 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b2f8f1b..5a9ed202 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-03-14 + * added internal ad-hoc config settings for displaying text files like + title messages or "readme.txt" style level set info files: + - .autowrap: true,false (default: true) + - .centered: true,false (default: false) + - .skip_comments: true,false (default: true) + (the leading '.' and the separating ':' are mandatory here) + 2007-03-08 * changed some numerical limits in the level editor from 255 to 999 diff --git a/src/conf_gfx.c b/src/conf_gfx.c index c9ae0772..f75a4671 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5217,10 +5217,6 @@ struct ConfigInfo image_config[] = { "main.text.quit.align", "left" }, { "main.text.quit.font", "font.menu_1" }, - { "main.text.current_level.x", "352" }, - { "main.text.current_level.y", "96" }, - { "main.text.current_level.align", "left" }, - { "main.text.current_level.font", "font.value_1" }, { "main.text.first_level.x", "488" }, { "main.text.first_level.y", "98" }, { "main.text.first_level.align", "left" }, @@ -5229,6 +5225,10 @@ struct ConfigInfo image_config[] = { "main.text.last_level.y", "112" }, { "main.text.last_level.align", "left" }, { "main.text.last_level.font", "font.text_3" }, + { "main.text.level_number.x", "352" }, + { "main.text.level_number.y", "96" }, + { "main.text.level_number.align", "left" }, + { "main.text.level_number.font", "font.value_1" }, { "main.text.level_info_1.x", "272" }, { "main.text.level_info_1.y", "352" }, { "main.text.level_info_1.align", "center" }, @@ -5312,30 +5312,55 @@ struct ConfigInfo image_config[] = { "door_2.step_delay", "10" }, { "door_2.anim_mode", "default" }, - { "game.panel.level.x", "51" }, - { "game.panel.level.y", "20" }, - { "game.panel.level.align", "center" }, - { "game.panel.level.chars", "-1" }, - { "game.panel.level.font", "font.text_2" }, - { "game.panel.level.font_narrow", "font.text_1" }, + { "game.panel.level_number.x", "51" }, + { "game.panel.level_number.y", "20" }, + { "game.panel.level_number.align", "center" }, + { "game.panel.level_number.chars", "-1" }, + { "game.panel.level_number.font", "font.text_2" }, + { "game.panel.level_number.font_narrow", "font.text_1" }, + { "game.panel.gems.x", "50" }, { "game.panel.gems.y", "54" }, { "game.panel.gems.align", "center" }, { "game.panel.gems.chars", "3" }, { "game.panel.gems.font", "font.text_2" }, + { "game.panel.inventory.x", "50" }, { "game.panel.inventory.y", "89" }, { "game.panel.inventory.align", "center" }, { "game.panel.inventory.chars", "3" }, { "game.panel.inventory.font", "font.text_2" }, - { "game.panel.keys.x", "50" }, - { "game.panel.keys.y", "123" }, - { "game.panel.keys.align", "center" }, + + { "game.panel.key_1.x", "18" }, + { "game.panel.key_1.y", "123" }, + { "game.panel.key_2.x", "34" }, + { "game.panel.key_2.y", "123" }, + { "game.panel.key_3.x", "50" }, + { "game.panel.key_3.y", "123" }, + { "game.panel.key_4.x", "66" }, + { "game.panel.key_4.y", "123" }, + { "game.panel.key_5.x", "-1" }, + { "game.panel.key_5.y", "-1" }, + { "game.panel.key_6.x", "-1" }, + { "game.panel.key_6.y", "-1" }, + { "game.panel.key_7.x", "-1" }, + { "game.panel.key_7.y", "-1" }, + { "game.panel.key_8.x", "-1" }, + { "game.panel.key_8.y", "-1" }, + { "game.panel.key_white.x", "-1" }, + { "game.panel.key_white.y", "-1" }, + { "game.panel.key_white_count.x", "-1" }, + { "game.panel.key_white_count.y", "-1" }, + { "game.panel.key_white_count.align", "left" }, + { "game.panel.key_white_count.chars", "-1" }, + { "game.panel.key_white_count.font", "font.text_2" }, + { "game.panel.score.x", "50" }, { "game.panel.score.y", "159" }, { "game.panel.score.align", "center" }, { "game.panel.score.chars", "5" }, { "game.panel.score.font", "font.text_2" }, + { "game.panel.time.x", "50" }, { "game.panel.time.y", "194" }, { "game.panel.time.align", "center" }, @@ -5375,32 +5400,6 @@ struct ConfigInfo image_config[] = { "game.panel.drop_next_7.y", "-1" }, { "game.panel.drop_next_8.x", "-1" }, { "game.panel.drop_next_8.y", "-1" }, - { "game.panel.emc_keys.x", "-1" }, - { "game.panel.emc_keys.y", "-1" }, - { "game.panel.emc_keys.align", "left" }, - { "game.panel.key_1.x", "-1" }, - { "game.panel.key_1.y", "-1" }, - { "game.panel.key_2.x", "-1" }, - { "game.panel.key_2.y", "-1" }, - { "game.panel.key_3.x", "-1" }, - { "game.panel.key_3.y", "-1" }, - { "game.panel.key_4.x", "-1" }, - { "game.panel.key_4.y", "-1" }, - { "game.panel.key_5.x", "-1" }, - { "game.panel.key_5.y", "-1" }, - { "game.panel.key_6.x", "-1" }, - { "game.panel.key_6.y", "-1" }, - { "game.panel.key_7.x", "-1" }, - { "game.panel.key_7.y", "-1" }, - { "game.panel.key_8.x", "-1" }, - { "game.panel.key_8.y", "-1" }, - { "game.panel.key_white.x", "-1" }, - { "game.panel.key_white.y", "-1" }, - { "game.panel.key_white_count.x", "-1" }, - { "game.panel.key_white_count.y", "-1" }, - { "game.panel.key_white_count.align", "left" }, - { "game.panel.key_white_count.chars", "-1" }, - { "game.panel.key_white_count.font", "font.text_2" }, { "game.panel.shield_normal.x", "-1" }, { "game.panel.shield_normal.y", "-1" }, @@ -5555,18 +5554,18 @@ struct ConfigInfo image_config[] = { "game.panel.level_author.chars", "-1" }, { "game.panel.level_author.font", "font.text_2" }, - { "game.button.stop.x", "-1" }, - { "game.button.stop.y", "-1" }, - { "game.button.pause.x", "-1" }, - { "game.button.pause.y", "-1" }, - { "game.button.play.x", "-1" }, - { "game.button.play.y", "-1" }, - { "game.button.sound_music.x", "-1" }, - { "game.button.sound_music.y", "-1" }, - { "game.button.sound_loops.x", "-1" }, - { "game.button.sound_loops.y", "-1" }, - { "game.button.sound_simple.x", "-1" }, - { "game.button.sound_simple.y", "-1" }, + { "game.button.stop.x", "5" }, + { "game.button.stop.y", "215" }, + { "game.button.pause.x", "35" }, + { "game.button.pause.y", "215" }, + { "game.button.play.x", "65" }, + { "game.button.play.y", "215" }, + { "game.button.sound_music.x", "5" }, + { "game.button.sound_music.y", "245" }, + { "game.button.sound_loops.x", "35" }, + { "game.button.sound_loops.y", "245" }, + { "game.button.sound_simple.x", "65" }, + { "game.button.sound_simple.y", "245" }, { "[player].boring_delay_fixed", "1000" }, { "[player].boring_delay_random", "1000" }, diff --git a/src/conf_var.c b/src/conf_var.c index 997ba2b1..ff66e47a 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -1008,22 +1008,6 @@ struct TokenIntPtrInfo image_config_vars[] = "main.text.quit.font", &menu.main.text.quit.font }, - { - "main.text.current_level.x", - &menu.main.text.current_level.x - }, - { - "main.text.current_level.y", - &menu.main.text.current_level.y - }, - { - "main.text.current_level.align", - &menu.main.text.current_level.align - }, - { - "main.text.current_level.font", - &menu.main.text.current_level.font - }, { "main.text.first_level.x", &menu.main.text.first_level.x @@ -1056,6 +1040,22 @@ struct TokenIntPtrInfo image_config_vars[] = "main.text.last_level.font", &menu.main.text.last_level.font }, + { + "main.text.level_number.x", + &menu.main.text.level_number.x + }, + { + "main.text.level_number.y", + &menu.main.text.level_number.y + }, + { + "main.text.level_number.align", + &menu.main.text.level_number.align + }, + { + "main.text.level_number.font", + &menu.main.text.level_number.font + }, { "main.text.level_info_1.x", &menu.main.text.level_info_1.x @@ -1369,28 +1369,28 @@ struct TokenIntPtrInfo image_config_vars[] = &door_2.anim_mode }, { - "game.panel.level.x", - &game.panel.level.x + "game.panel.level_number.x", + &game.panel.level_number.x }, { - "game.panel.level.y", - &game.panel.level.y + "game.panel.level_number.y", + &game.panel.level_number.y }, { - "game.panel.level.align", - &game.panel.level.align + "game.panel.level_number.align", + &game.panel.level_number.align }, { - "game.panel.level.chars", - &game.panel.level.chars + "game.panel.level_number.chars", + &game.panel.level_number.chars }, { - "game.panel.level.font", - &game.panel.level.font + "game.panel.level_number.font", + &game.panel.level_number.font }, { - "game.panel.level.font_narrow", - &game.panel.level.font_alt + "game.panel.level_number.font_narrow", + &game.panel.level_number.font_alt }, { "game.panel.gems.x", @@ -1433,16 +1433,96 @@ struct TokenIntPtrInfo image_config_vars[] = &game.panel.inventory.font }, { - "game.panel.keys.x", - &game.panel.keys.x + "game.panel.key_1.x", + &game.panel.key[0].x + }, + { + "game.panel.key_1.y", + &game.panel.key[0].y + }, + { + "game.panel.key_2.x", + &game.panel.key[1].x + }, + { + "game.panel.key_2.y", + &game.panel.key[1].y + }, + { + "game.panel.key_3.x", + &game.panel.key[2].x + }, + { + "game.panel.key_3.y", + &game.panel.key[2].y + }, + { + "game.panel.key_4.x", + &game.panel.key[3].x + }, + { + "game.panel.key_4.y", + &game.panel.key[3].y + }, + { + "game.panel.key_5.x", + &game.panel.key[4].x + }, + { + "game.panel.key_5.y", + &game.panel.key[4].y + }, + { + "game.panel.key_6.x", + &game.panel.key[5].x + }, + { + "game.panel.key_6.y", + &game.panel.key[5].y + }, + { + "game.panel.key_7.x", + &game.panel.key[6].x + }, + { + "game.panel.key_7.y", + &game.panel.key[6].y + }, + { + "game.panel.key_8.x", + &game.panel.key[7].x + }, + { + "game.panel.key_8.y", + &game.panel.key[7].y + }, + { + "game.panel.key_white.x", + &game.panel.key_white.x + }, + { + "game.panel.key_white.y", + &game.panel.key_white.y + }, + { + "game.panel.key_white_count.x", + &game.panel.key_white_count.x }, { - "game.panel.keys.y", - &game.panel.keys.y + "game.panel.key_white_count.y", + &game.panel.key_white_count.y + }, + { + "game.panel.key_white_count.align", + &game.panel.key_white_count.align + }, + { + "game.panel.key_white_count.chars", + &game.panel.key_white_count.chars }, { - "game.panel.keys.align", - &game.panel.keys.align + "game.panel.key_white_count.font", + &game.panel.key_white_count.font }, { "game.panel.score.x", @@ -1612,110 +1692,6 @@ struct TokenIntPtrInfo image_config_vars[] = "game.panel.drop_next_8.y", &game.panel.drop_next_8.y }, - { - "game.panel.emc_keys.x", - &game.panel.emc_keys.x - }, - { - "game.panel.emc_keys.y", - &game.panel.emc_keys.y - }, - { - "game.panel.emc_keys.align", - &game.panel.emc_keys.align - }, - { - "game.panel.key_1.x", - &game.panel.key_1.x - }, - { - "game.panel.key_1.y", - &game.panel.key_1.y - }, - { - "game.panel.key_2.x", - &game.panel.key_2.x - }, - { - "game.panel.key_2.y", - &game.panel.key_2.y - }, - { - "game.panel.key_3.x", - &game.panel.key_3.x - }, - { - "game.panel.key_3.y", - &game.panel.key_3.y - }, - { - "game.panel.key_4.x", - &game.panel.key_4.x - }, - { - "game.panel.key_4.y", - &game.panel.key_4.y - }, - { - "game.panel.key_5.x", - &game.panel.key_5.x - }, - { - "game.panel.key_5.y", - &game.panel.key_5.y - }, - { - "game.panel.key_6.x", - &game.panel.key_6.x - }, - { - "game.panel.key_6.y", - &game.panel.key_6.y - }, - { - "game.panel.key_7.x", - &game.panel.key_7.x - }, - { - "game.panel.key_7.y", - &game.panel.key_7.y - }, - { - "game.panel.key_8.x", - &game.panel.key_8.x - }, - { - "game.panel.key_8.y", - &game.panel.key_8.y - }, - { - "game.panel.key_white.x", - &game.panel.key_white.x - }, - { - "game.panel.key_white.y", - &game.panel.key_white.y - }, - { - "game.panel.key_white_count.x", - &game.panel.key_white_count.x - }, - { - "game.panel.key_white_count.y", - &game.panel.key_white_count.y - }, - { - "game.panel.key_white_count.align", - &game.panel.key_white_count.align - }, - { - "game.panel.key_white_count.chars", - &game.panel.key_white_count.chars - }, - { - "game.panel.key_white_count.font", - &game.panel.key_white_count.font - }, { "game.panel.shield_normal.x", &game.panel.shield_normal.x diff --git a/src/conftime.h b/src/conftime.h index 7b4a23e4..335ff3a5 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-03-12 23:44" +#define COMPILE_DATE_STRING "2007-03-14 00:32" diff --git a/src/game.c b/src/game.c index 6b920a51..297efe85 100644 --- a/src/game.c +++ b/src/game.c @@ -140,74 +140,72 @@ #define GAME_CONTROL_LEVEL 0 #define GAME_CONTROL_GEMS 1 #define GAME_CONTROL_INVENTORY 2 -#define GAME_CONTROL_KEYS 3 -#define GAME_CONTROL_SCORE 4 -#define GAME_CONTROL_TIME 5 -#define GAME_CONTROL_TIME_HH 6 -#define GAME_CONTROL_TIME_MM 7 -#define GAME_CONTROL_TIME_SS 8 -#define GAME_CONTROL_DROP_NEXT_1 9 -#define GAME_CONTROL_DROP_NEXT_2 10 -#define GAME_CONTROL_DROP_NEXT_3 11 -#define GAME_CONTROL_DROP_NEXT_4 12 -#define GAME_CONTROL_DROP_NEXT_5 13 -#define GAME_CONTROL_DROP_NEXT_6 14 -#define GAME_CONTROL_DROP_NEXT_7 15 -#define GAME_CONTROL_DROP_NEXT_8 16 -#define GAME_CONTROL_EMC_KEYS 17 -#define GAME_CONTROL_KEY_1 18 -#define GAME_CONTROL_KEY_2 19 -#define GAME_CONTROL_KEY_3 20 -#define GAME_CONTROL_KEY_4 21 -#define GAME_CONTROL_KEY_5 22 -#define GAME_CONTROL_KEY_6 23 -#define GAME_CONTROL_KEY_7 24 -#define GAME_CONTROL_KEY_8 25 -#define GAME_CONTROL_KEY_WHITE 26 -#define GAME_CONTROL_KEY_WHITE_COUNT 27 -#define GAME_CONTROL_SHIELD_NORMAL 28 -#define GAME_CONTROL_SHIELD_NORMAL_TIME 29 -#define GAME_CONTROL_SHIELD_DEADLY 30 -#define GAME_CONTROL_SHIELD_DEADLY_TIME 31 -#define GAME_CONTROL_EXIT 32 -#define GAME_CONTROL_EM_EXIT 33 -#define GAME_CONTROL_SP_EXIT 34 -#define GAME_CONTROL_STEEL_EXIT 35 -#define GAME_CONTROL_EM_STEEL_EXIT 36 -#define GAME_CONTROL_EMC_MAGIC_BALL 37 -#define GAME_CONTROL_EMC_MAGIC_BALL_TIME 38 -#define GAME_CONTROL_LIGHT_SWITCH 39 -#define GAME_CONTROL_LIGHT_SWITCH_TIME 40 -#define GAME_CONTROL_TIMEGATE_SWITCH 41 -#define GAME_CONTROL_TIMEGATE_SWITCH_TIME 42 -#define GAME_CONTROL_SWITCHGATE_SWITCH 43 -#define GAME_CONTROL_EMC_LENSES 44 -#define GAME_CONTROL_EMC_LENSES_TIME 45 -#define GAME_CONTROL_EMC_MAGNIFIER 46 -#define GAME_CONTROL_EMC_MAGNIFIER_TIME 47 -#define GAME_CONTROL_BALLOON_SWITCH 48 -#define GAME_CONTROL_DYNABOMB_NUMBER 49 -#define GAME_CONTROL_DYNABOMB_SIZE 50 -#define GAME_CONTROL_DYNABOMB_POWER 51 -#define GAME_CONTROL_PENGUINS 52 -#define GAME_CONTROL_SOKOBAN_OBJECTS 53 -#define GAME_CONTROL_SOKOBAN_FIELDS 54 -#define GAME_CONTROL_ROBOT_WHEEL 55 -#define GAME_CONTROL_CONVEYOR_BELT_1 56 -#define GAME_CONTROL_CONVEYOR_BELT_1_SWITCH 57 -#define GAME_CONTROL_CONVEYOR_BELT_2 58 -#define GAME_CONTROL_CONVEYOR_BELT_2_SWITCH 59 -#define GAME_CONTROL_CONVEYOR_BELT_3 60 -#define GAME_CONTROL_CONVEYOR_BELT_3_SWITCH 61 -#define GAME_CONTROL_CONVEYOR_BELT_4 62 -#define GAME_CONTROL_CONVEYOR_BELT_4_SWITCH 63 -#define GAME_CONTROL_MAGIC_WALL 64 -#define GAME_CONTROL_MAGIC_WALL_TIME 65 -#define GAME_CONTROL_BD_MAGIC_WALL 66 -#define GAME_CONTROL_DC_MAGIC_WALL 67 -#define GAME_CONTROL_PLAYER_NAME 68 -#define GAME_CONTROL_LEVEL_NAME 69 -#define GAME_CONTROL_LEVEL_AUTHOR 70 +#define GAME_CONTROL_KEY_1 3 +#define GAME_CONTROL_KEY_2 4 +#define GAME_CONTROL_KEY_3 5 +#define GAME_CONTROL_KEY_4 6 +#define GAME_CONTROL_KEY_5 7 +#define GAME_CONTROL_KEY_6 8 +#define GAME_CONTROL_KEY_7 9 +#define GAME_CONTROL_KEY_8 10 +#define GAME_CONTROL_KEY_WHITE 11 +#define GAME_CONTROL_KEY_WHITE_COUNT 12 +#define GAME_CONTROL_SCORE 13 +#define GAME_CONTROL_TIME 14 +#define GAME_CONTROL_TIME_HH 15 +#define GAME_CONTROL_TIME_MM 16 +#define GAME_CONTROL_TIME_SS 17 +#define GAME_CONTROL_DROP_NEXT_1 18 +#define GAME_CONTROL_DROP_NEXT_2 19 +#define GAME_CONTROL_DROP_NEXT_3 20 +#define GAME_CONTROL_DROP_NEXT_4 21 +#define GAME_CONTROL_DROP_NEXT_5 22 +#define GAME_CONTROL_DROP_NEXT_6 23 +#define GAME_CONTROL_DROP_NEXT_7 24 +#define GAME_CONTROL_DROP_NEXT_8 25 +#define GAME_CONTROL_SHIELD_NORMAL 26 +#define GAME_CONTROL_SHIELD_NORMAL_TIME 27 +#define GAME_CONTROL_SHIELD_DEADLY 28 +#define GAME_CONTROL_SHIELD_DEADLY_TIME 29 +#define GAME_CONTROL_EXIT 30 +#define GAME_CONTROL_EM_EXIT 31 +#define GAME_CONTROL_SP_EXIT 32 +#define GAME_CONTROL_STEEL_EXIT 33 +#define GAME_CONTROL_EM_STEEL_EXIT 34 +#define GAME_CONTROL_EMC_MAGIC_BALL 35 +#define GAME_CONTROL_EMC_MAGIC_BALL_TIME 36 +#define GAME_CONTROL_LIGHT_SWITCH 37 +#define GAME_CONTROL_LIGHT_SWITCH_TIME 38 +#define GAME_CONTROL_TIMEGATE_SWITCH 39 +#define GAME_CONTROL_TIMEGATE_SWITCH_TIME 40 +#define GAME_CONTROL_SWITCHGATE_SWITCH 41 +#define GAME_CONTROL_EMC_LENSES 42 +#define GAME_CONTROL_EMC_LENSES_TIME 43 +#define GAME_CONTROL_EMC_MAGNIFIER 44 +#define GAME_CONTROL_EMC_MAGNIFIER_TIME 45 +#define GAME_CONTROL_BALLOON_SWITCH 46 +#define GAME_CONTROL_DYNABOMB_NUMBER 47 +#define GAME_CONTROL_DYNABOMB_SIZE 48 +#define GAME_CONTROL_DYNABOMB_POWER 49 +#define GAME_CONTROL_PENGUINS 50 +#define GAME_CONTROL_SOKOBAN_OBJECTS 51 +#define GAME_CONTROL_SOKOBAN_FIELDS 52 +#define GAME_CONTROL_ROBOT_WHEEL 53 +#define GAME_CONTROL_CONVEYOR_BELT_1 54 +#define GAME_CONTROL_CONVEYOR_BELT_1_SWITCH 55 +#define GAME_CONTROL_CONVEYOR_BELT_2 56 +#define GAME_CONTROL_CONVEYOR_BELT_2_SWITCH 57 +#define GAME_CONTROL_CONVEYOR_BELT_3 58 +#define GAME_CONTROL_CONVEYOR_BELT_3_SWITCH 59 +#define GAME_CONTROL_CONVEYOR_BELT_4 60 +#define GAME_CONTROL_CONVEYOR_BELT_4_SWITCH 61 +#define GAME_CONTROL_MAGIC_WALL 62 +#define GAME_CONTROL_MAGIC_WALL_TIME 63 +#define GAME_CONTROL_BD_MAGIC_WALL 64 +#define GAME_CONTROL_DC_MAGIC_WALL 65 +#define GAME_CONTROL_PLAYER_NAME 66 +#define GAME_CONTROL_LEVEL_NAME 67 +#define GAME_CONTROL_LEVEL_AUTHOR 68 struct GameControlInfo { @@ -1843,7 +1841,7 @@ void DrawGameValue_Time(int value) void DrawGameValue_Level(int value) { - struct TextPosInfo *pos = &game.panel.level; + struct TextPosInfo *pos = &game.panel.level_number; int chars1 = 2; int chars2 = 3; int chars = pos->chars; @@ -1873,25 +1871,59 @@ void DrawGameValue_Level(int value) void DrawGameValue_Keys(int key[MAX_NUM_KEYS]) { +#if 0 struct TextPosInfo *pos = &game.panel.keys; +#endif +#if 0 int base_key_graphic = EL_KEY_1; +#endif int i; +#if 0 if (PANEL_DEACTIVATED(pos)) return; +#endif +#if 0 if (level.game_engine_type == GAME_ENGINE_TYPE_EM) base_key_graphic = EL_EM_KEY_1; +#endif +#if 0 pos->width = 4 * MINI_TILEX; +#endif +#if 1 + for (i = 0; i < MAX_NUM_KEYS; i++) +#else /* currently only 4 of 8 possible keys are displayed */ for (i = 0; i < STD_NUM_KEYS; i++) +#endif { +#if 1 + struct TextPosInfo *pos = &game.panel.key[i]; +#endif int src_x = DOOR_GFX_PAGEX5 + 18; int src_y = DOOR_GFX_PAGEY1 + 123; +#if 1 + int dst_x = PANEL_XPOS(pos); + int dst_y = PANEL_YPOS(pos); +#else int dst_x = PANEL_XPOS(pos) + i * MINI_TILEX; int dst_y = PANEL_YPOS(pos); +#endif + +#if 1 + int element = (i >= STD_NUM_KEYS ? EL_EMC_KEY_5 - 4 : + level.game_engine_type == GAME_ENGINE_TYPE_EM ? EL_EM_KEY_1 : + EL_KEY_1) + i; + int graphic = el2edimg(element); +#endif + +#if 1 + if (PANEL_DEACTIVATED(pos)) + continue; +#endif #if 0 /* masked blit with tiles from half-size scaled bitmap does not work yet @@ -1903,7 +1935,9 @@ void DrawGameValue_Keys(int key[MAX_NUM_KEYS]) if (key[i]) { +#if 0 int graphic = el2edimg(base_key_graphic + i); +#endif Bitmap *src_bitmap; int src_x, src_y; @@ -1914,12 +1948,20 @@ void DrawGameValue_Keys(int key[MAX_NUM_KEYS]) BlitBitmapMasked(src_bitmap, drawto, src_x, src_y, MINI_TILEX, MINI_TILEY, dst_x, dst_y); } +#else +#if 1 + if (key[i]) + DrawMiniGraphicExt(drawto, dst_x, dst_y, graphic); + else + BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, src_x, src_y, + MINI_TILEX, MINI_TILEY, dst_x, dst_y); #else if (key[i]) DrawMiniGraphicExt(drawto, dst_x, dst_y, el2edimg(base_key_graphic + i)); else BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, src_x, src_y, MINI_TILEX, MINI_TILEY, dst_x, dst_y); +#endif #endif } } @@ -14422,11 +14464,50 @@ boolean CheckEngineSnapshot() static struct { - int x, y; + int *x, *y; + int gd_x, gd_y; int gadget_id; char *infotext; } gamebutton_info[NUM_GAME_BUTTONS] = { +#if 1 + { + &game.button.stop.x, &game.button.stop.y, + GAME_BUTTON_STOP_XPOS, GAME_BUTTON_YPOS, + GAME_CTRL_ID_STOP, + "stop game" + }, + { + &game.button.pause.x, &game.button.pause.y, + GAME_BUTTON_PAUSE_XPOS, GAME_BUTTON_YPOS, + GAME_CTRL_ID_PAUSE, + "pause game" + }, + { + &game.button.play.x, &game.button.play.y, + GAME_BUTTON_PLAY_XPOS, GAME_BUTTON_YPOS, + GAME_CTRL_ID_PLAY, + "play game" + }, + { + &game.button.sound_music.x, &game.button.sound_music.y, + SOUND_BUTTON_MUSIC_XPOS, SOUND_BUTTON_YPOS, + SOUND_CTRL_ID_MUSIC, + "background music on/off" + }, + { + &game.button.sound_loops.x, &game.button.sound_loops.y, + SOUND_BUTTON_LOOPS_XPOS, SOUND_BUTTON_YPOS, + SOUND_CTRL_ID_LOOPS, + "sound loops on/off" + }, + { + &game.button.sound_simple.x,&game.button.sound_simple.y, + SOUND_BUTTON_SIMPLE_XPOS, SOUND_BUTTON_YPOS, + SOUND_CTRL_ID_SIMPLE, + "normal sounds on/off" + } +#else { GAME_BUTTON_STOP_XPOS, GAME_BUTTON_YPOS, GAME_CTRL_ID_STOP, @@ -14457,6 +14538,7 @@ static struct SOUND_CTRL_ID_SIMPLE, "normal sounds on/off" } +#endif }; void CreateGameButtons() @@ -14470,12 +14552,15 @@ void CreateGameButtons() int button_type; boolean checked; unsigned long event_mask; + int x, y; int gd_xoffset, gd_yoffset; int gd_x1, gd_x2, gd_y1, gd_y2; int id = i; - gd_xoffset = gamebutton_info[i].x; - gd_yoffset = gamebutton_info[i].y; + x = DX + *gamebutton_info[i].x; + y = DY + *gamebutton_info[i].y; + gd_xoffset = gamebutton_info[i].gd_x; + gd_yoffset = gamebutton_info[i].gd_y; gd_x1 = DOOR_GFX_PAGEX4 + gd_xoffset; gd_x2 = DOOR_GFX_PAGEX3 + gd_xoffset; @@ -14503,8 +14588,13 @@ void CreateGameButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_INFO_TEXT, gamebutton_info[i].infotext, +#if 1 + GDI_X, x, + GDI_Y, y, +#else GDI_X, DX + gd_xoffset, GDI_Y, DY + gd_yoffset, +#endif GDI_WIDTH, GAME_BUTTON_XSIZE, GDI_HEIGHT, GAME_BUTTON_YSIZE, GDI_TYPE, button_type, diff --git a/src/game.h b/src/game.h index fcd284d5..b93c9750 100644 --- a/src/game.h +++ b/src/game.h @@ -25,13 +25,14 @@ #if 1 struct GamePanelInfo { - struct TextPosInfo level; + struct TextPosInfo level_number; struct TextPosInfo gems; struct TextPosInfo inventory; - struct TextPosInfo keys; + struct TextPosInfo key[MAX_NUM_KEYS]; + struct TextPosInfo key_white; + struct TextPosInfo key_white_count; struct TextPosInfo score; struct TextPosInfo time; - struct TextPosInfo time_hh; struct TextPosInfo time_mm; struct TextPosInfo time_ss; @@ -43,17 +44,6 @@ struct GamePanelInfo struct TextPosInfo drop_next_6; struct TextPosInfo drop_next_7; struct TextPosInfo drop_next_8; - struct TextPosInfo emc_keys; - struct TextPosInfo key_1; - struct TextPosInfo key_2; - struct TextPosInfo key_3; - struct TextPosInfo key_4; - struct TextPosInfo key_5; - struct TextPosInfo key_6; - struct TextPosInfo key_7; - struct TextPosInfo key_8; - struct TextPosInfo key_white; - struct TextPosInfo key_white_count; struct TextPosInfo shield_normal; struct TextPosInfo shield_normal_time; struct TextPosInfo shield_deadly; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index e08a45c9..448b39ce 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -156,6 +156,11 @@ int log_2(unsigned int x) return e; } +boolean getTokenValueFromString(char *string, char **token, char **value) +{ + return getTokenValueFromSetupLine(string, token, value); +} + /* ------------------------------------------------------------------------- */ /* counter functions */ diff --git a/src/libgame/misc.h b/src/libgame/misc.h index de94e2ec..7cf5df63 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -77,6 +77,8 @@ char *int2str(int, int); char *i_to_a(unsigned int); int log_2(unsigned int); +boolean getTokenValueFromString(char *, char **, char **); + void InitCounter(void); unsigned long Counter(void); void Delay(unsigned long); diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 3688af7d..45a9895a 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -1610,6 +1610,156 @@ static void printSetupFileHash(SetupFileHash *hash) #define ALLOW_TOKEN_VALUE_SEPARATOR_BEING_WHITESPACE 1 #define CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING 0 +static boolean token_value_separator_found = FALSE; +#if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING +static boolean token_value_separator_warning = FALSE; +#endif + +static boolean getTokenValueFromSetupLineExt(char *line, + char **token_ptr, char **value_ptr, + char *filename, char *line_raw, + int line_nr, + boolean separator_required) +{ + static char line_copy[MAX_LINE_LEN + 1], line_raw_copy[MAX_LINE_LEN + 1]; + char *token, *value, *line_ptr; + + /* when externally invoked via ReadTokenValueFromLine(), copy line buffers */ + if (line_raw == NULL) + { + strncpy(line_copy, line, MAX_LINE_LEN); + line_copy[MAX_LINE_LEN] = '\0'; + line = line_copy; + + strcpy(line_raw_copy, line_copy); + line_raw = line_raw_copy; + } + + /* cut trailing comment from input line */ + for (line_ptr = line; *line_ptr; line_ptr++) + { + if (*line_ptr == '#') + { + *line_ptr = '\0'; + break; + } + } + + /* cut trailing whitespaces from input line */ + for (line_ptr = &line[strlen(line)]; line_ptr >= line; line_ptr--) + if ((*line_ptr == ' ' || *line_ptr == '\t') && *(line_ptr + 1) == '\0') + *line_ptr = '\0'; + + /* ignore empty lines */ + if (*line == '\0') + return FALSE; + + /* cut leading whitespaces from token */ + for (token = line; *token; token++) + if (*token != ' ' && *token != '\t') + break; + + /* start with empty value as reliable default */ + value = ""; + + token_value_separator_found = FALSE; + + /* find end of token to determine start of value */ + for (line_ptr = token; *line_ptr; line_ptr++) + { +#if 1 + /* first look for an explicit token/value separator, like ':' or '=' */ + if (*line_ptr == ':' || *line_ptr == '=') +#else + if (*line_ptr == ' ' || *line_ptr == '\t' || *line_ptr == ':') +#endif + { + *line_ptr = '\0'; /* terminate token string */ + value = line_ptr + 1; /* set beginning of value */ + + token_value_separator_found = TRUE; + + break; + } + } + +#if ALLOW_TOKEN_VALUE_SEPARATOR_BEING_WHITESPACE + /* fallback: if no token/value separator found, also allow whitespaces */ + if (!token_value_separator_found && !separator_required) + { + for (line_ptr = token; *line_ptr; line_ptr++) + { + if (*line_ptr == ' ' || *line_ptr == '\t') + { + *line_ptr = '\0'; /* terminate token string */ + value = line_ptr + 1; /* set beginning of value */ + + token_value_separator_found = TRUE; + + break; + } + } + +#if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING + if (token_value_separator_found) + { + if (!token_value_separator_warning) + { + Error(ERR_INFO_LINE, "-"); + + if (filename != NULL) + { + Error(ERR_WARN, "missing token/value separator(s) in config file:"); + Error(ERR_INFO, "- config file: '%s'", filename); + } + else + { + Error(ERR_WARN, "missing token/value separator(s):"); + } + + token_value_separator_warning = TRUE; + } + + if (filename != NULL) + Error(ERR_INFO, "- line %d: '%s'", line_nr, line_raw); + else + Error(ERR_INFO, "- line: '%s'", line_raw); + } +#endif + } +#endif + + /* cut trailing whitespaces from token */ + for (line_ptr = &token[strlen(token)]; line_ptr >= token; line_ptr--) + if ((*line_ptr == ' ' || *line_ptr == '\t') && *(line_ptr + 1) == '\0') + *line_ptr = '\0'; + + /* cut leading whitespaces from value */ + for (; *value; value++) + if (*value != ' ' && *value != '\t') + break; + +#if 0 + if (*value == '\0') + value = "true"; /* treat tokens without value as "true" */ +#endif + + *token_ptr = token; + *value_ptr = value; + + return TRUE; +} + +boolean getTokenValueFromSetupLine(char *line, char **token, char **value) +{ + /* while the internal (old) interface does not require a token/value + separator (for downwards compatibility with existing files which + don't use them), it is mandatory for the external (new) interface */ + + return getTokenValueFromSetupLineExt(line, token, value, NULL, NULL, 0, TRUE); +} + +#if 1 static void loadSetupFileData(void *setup_file_data, char *filename, boolean top_recursion_level, boolean is_hash) { @@ -1618,14 +1768,153 @@ static void loadSetupFileData(void *setup_file_data, char *filename, char *token, *value, *line_ptr; void *insert_ptr = NULL; boolean read_continued_line = FALSE; - boolean token_value_separator_found; + FILE *file; + int line_nr = 0; + int token_count = 0; + +#if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING + token_value_separator_warning = FALSE; +#endif + + if (!(file = fopen(filename, MODE_READ))) + { + Error(ERR_WARN, "cannot open configuration file '%s'", filename); + + return; + } + + /* use "insert pointer" to store list end for constant insertion complexity */ + if (!is_hash) + insert_ptr = setup_file_data; + + /* on top invocation, create hash to mark included files (to prevent loops) */ + if (top_recursion_level) + include_filename_hash = newSetupFileHash(); + + /* mark this file as already included (to prevent including it again) */ + setHashEntry(include_filename_hash, getBaseNamePtr(filename), "true"); + + while (!feof(file)) + { + /* read next line of input file */ + if (!fgets(line, MAX_LINE_LEN, file)) + 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') + *line_ptr = '\0'; + + /* copy raw input line for later use (mainly debugging output) */ + strcpy(line_raw, line); + + if (read_continued_line) + { +#if 0 + /* !!! ??? WHY ??? !!! */ + /* cut leading whitespaces from input line */ + for (line_ptr = line; *line_ptr; line_ptr++) + if (*line_ptr != ' ' && *line_ptr != '\t') + break; +#endif + + /* append new line to existing line, if there is enough space */ + if (strlen(previous_line) + strlen(line_ptr) < MAX_LINE_LEN) + strcat(previous_line, line_ptr); + + strcpy(line, previous_line); /* copy storage buffer to line */ + + read_continued_line = FALSE; + } + + /* if the last character is '\', continue at next line */ + if (strlen(line) > 0 && line[strlen(line) - 1] == '\\') + { + line[strlen(line) - 1] = '\0'; /* cut off trailing backslash */ + strcpy(previous_line, line); /* copy line to storage buffer */ + + read_continued_line = TRUE; + + continue; + } + + if (!getTokenValueFromSetupLineExt(line, &token, &value, filename, + line_raw, line_nr, FALSE)) + continue; + + if (*token) + { + if (strEqual(token, "include")) + { + if (getHashEntry(include_filename_hash, value) == NULL) + { + char *basepath = getBasePath(filename); + char *basename = getBaseName(value); + char *filename_include = getPath2(basepath, basename); + +#if 0 + Error(ERR_INFO, "[including file '%s']", filename_include); +#endif + + loadSetupFileData(setup_file_data, filename_include, FALSE, is_hash); + + free(basepath); + free(basename); + free(filename_include); + } + else + { + Error(ERR_WARN, "ignoring already processed file '%s'", value); + } + } + else + { + if (is_hash) + setHashEntry((SetupFileHash *)setup_file_data, token, value); + else + insert_ptr = addListEntry((SetupFileList *)insert_ptr, token, value); + + token_count++; + } + } + } + + fclose(file); + #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING - boolean token_value_separator_warning = FALSE; + if (token_value_separator_warning) + Error(ERR_INFO_LINE, "-"); #endif + + if (token_count == 0) + Error(ERR_WARN, "configuration file '%s' is empty", filename); + + if (top_recursion_level) + freeSetupFileHash(include_filename_hash); +} + +#else + +static void loadSetupFileData(void *setup_file_data, char *filename, + boolean top_recursion_level, boolean is_hash) +{ + static SetupFileHash *include_filename_hash = NULL; + char line[MAX_LINE_LEN], line_raw[MAX_LINE_LEN], previous_line[MAX_LINE_LEN]; + char *token, *value, *line_ptr; + void *insert_ptr = NULL; + boolean read_continued_line = FALSE; FILE *file; int line_nr = 0; int token_count = 0; +#if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING + token_value_separator_warning = FALSE; +#endif + if (!(file = fopen(filename, MODE_READ))) { Error(ERR_WARN, "cannot open configuration file '%s'", filename); @@ -1837,6 +2126,7 @@ static void loadSetupFileData(void *setup_file_data, char *filename, if (top_recursion_level) freeSetupFileHash(include_filename_hash); } +#endif void saveSetupFileHash(SetupFileHash *hash, char *filename) { diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 38a53e81..571cdbcc 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -281,6 +281,8 @@ boolean checkCookieString(const char *, const char *); char *getFormattedSetupEntry(char *, char *); +boolean getTokenValueFromSetupLine(char *, char **, char **); + SetupFileList *newSetupFileList(char *, char *); void freeSetupFileList(SetupFileList *); char *getListEntry(SetupFileList *, char *); diff --git a/src/libgame/text.c b/src/libgame/text.c index 58826350..f781a563 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -679,13 +679,59 @@ int DrawTextFromFile_OLD(int x, int y, char *filename, int font_nr, } #endif +static boolean getCheckedTokenValueFromString(char *string, char **token, + char **value) +{ + char *ptr; + + if (!getTokenValueFromString(string, token, value)) + return FALSE; + + if (**token != '.') /* token should begin with dot */ + return FALSE; + + for (ptr = *token; *ptr; ptr++) /* token should contain no whitespace */ + if (*ptr == ' ' || *ptr == '\t') + return FALSE; + + for (ptr = *value; *ptr; ptr++) /* value should contain no whitespace */ + if (*ptr == ' ' || *ptr == '\t') + return FALSE; + + return TRUE; +} + +static void DrawTextBuffer_Flush(int x, int y, char *buffer, int font_nr, + int line_length, int cut_length, int mask_mode, + boolean centered, int current_line) +{ + int buffer_len = strlen(buffer); + int font_width = getFontWidth(font_nr); + int font_height = getFontHeight(font_nr); + int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0); + int offset_xsize = + (centered ? font_width * (line_length - buffer_len) / 2 : 0); + int final_cut_length = MAX(0, cut_length - offset_chars); + int xx = x + offset_xsize; + int yy = y + current_line * font_height; + + buffer[final_cut_length] = '\0'; + + if (mask_mode != -1) + DrawTextExt(drawto, xx, yy, buffer, font_nr, mask_mode); + else + DrawText(xx, yy, buffer, font_nr); +} + int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, int line_length, int cut_length, int max_lines, int mask_mode, boolean autowrap, boolean centered, boolean skip_comments) { +#if 0 int font_width = getFontWidth(font_nr); int font_height = getFontHeight(font_nr); +#endif char buffer[line_length + 1]; int buffer_len; int current_line = 0; @@ -716,9 +762,40 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, break; line[i] = '\0'; + /* prevent 'num_line_chars' sized lines to cause additional empty line */ + if (i == num_line_chars && *text_buffer == '\n') + text_buffer++; + /* skip comments (lines directly beginning with '#') */ if (line[0] == '#' && skip_comments) + { + char *token, *value; + + /* try to read generic token/value pair definition after comment sign */ + if (getCheckedTokenValueFromString(line + 1, &token, &value)) + { + /* if found, flush the current buffer, if non-empty */ + if (buffer_len > 0 && current_line < max_lines) + { + DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length, + mask_mode, centered, current_line); + + current_line++; + + buffer[0] = '\0'; + buffer_len = 0; + } + + if (strEqual(token, ".autowrap")) + autowrap = get_boolean_from_string(value); + else if (strEqual(token, ".centered")) + centered = get_boolean_from_string(value); + else if (strEqual(token, ".skip_comments")) + skip_comments = get_boolean_from_string(value); + } + continue; + } /* cut trailing newline and carriage return from input line */ for (line_ptr = line; *line_ptr; line_ptr++) @@ -753,6 +830,7 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, } else { + /* !!! CAN NEVER HAPPEN -- CHECK + CORRECT !!! */ buffer_len = line_length; strncpy(buffer, line_ptr, line_length); } @@ -765,6 +843,10 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, if (buffer_filled) { +#if 1 + DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length, + mask_mode, centered, current_line); +#else int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0); int offset_xsize = (centered ? font_width * (line_length - buffer_len) / 2 : 0); @@ -778,6 +860,7 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, font_nr, mask_mode); else DrawText(xx, y + current_line * font_height, buffer, font_nr); +#endif current_line++; @@ -791,6 +874,10 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, if (buffer_len > 0 && current_line < max_lines) { +#if 1 + DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length, + mask_mode, centered, current_line); +#else int offset_chars = (centered ? (line_length - buffer_len) / 2 : 0); int offset_xsize = (centered ? font_width * (line_length - buffer_len) / 2 : 0); @@ -804,6 +891,7 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, font_nr, mask_mode); else DrawText(xx, y + current_line * font_height, buffer, font_nr); +#endif current_line++; } diff --git a/src/main.h b/src/main.h index 7c00b8f1..8ea48949 100644 --- a/src/main.h +++ b/src/main.h @@ -2027,9 +2027,9 @@ struct MenuMainTextInfo struct TextPosInfo setup; struct TextPosInfo quit; - struct TextPosInfo current_level; struct TextPosInfo first_level; struct TextPosInfo last_level; + struct TextPosInfo level_number; struct TextPosInfo level_info_1; struct TextPosInfo level_info_2; struct TextPosInfo level_name; diff --git a/src/screens.c b/src/screens.c index 978033fd..a5c9c003 100644 --- a/src/screens.c +++ b/src/screens.c @@ -270,9 +270,9 @@ struct TitleControlInfo title_controls[MAX_NUM_TITLE_SCREENS]; #define MAIN_CONTROL_QUIT 7 #define MAIN_CONTROL_PREV_LEVEL 8 #define MAIN_CONTROL_NEXT_LEVEL 9 -#define MAIN_CONTROL_CURRENT_LEVEL 10 -#define MAIN_CONTROL_FIRST_LEVEL 11 -#define MAIN_CONTROL_LAST_LEVEL 12 +#define MAIN_CONTROL_FIRST_LEVEL 10 +#define MAIN_CONTROL_LAST_LEVEL 11 +#define MAIN_CONTROL_LEVEL_NUMBER 12 #define MAIN_CONTROL_LEVEL_INFO_1 13 #define MAIN_CONTROL_LEVEL_INFO_2 14 #define MAIN_CONTROL_LEVEL_NAME 15 @@ -286,14 +286,14 @@ struct TitleControlInfo title_controls[MAX_NUM_TITLE_SCREENS]; #define MAIN_CONTROL_TITLE_3 23 static char str_main_text_name[10]; -static char str_main_text_current_level[10]; static char str_main_text_first_level[10]; static char str_main_text_last_level[10]; +static char str_main_text_level_number[10]; static char *main_text_name = str_main_text_name; -static char *main_text_current_level = str_main_text_current_level; static char *main_text_first_level = str_main_text_first_level; static char *main_text_last_level = str_main_text_last_level; +static char *main_text_level_number = str_main_text_level_number; static char *main_text_levels = "Levelset"; static char *main_text_scores = "Hall Of Fame"; static char *main_text_editor = "Level Creator"; @@ -390,12 +390,6 @@ static struct MainControlInfo main_controls[] = NULL, NULL, }, #endif - { - MAIN_CONTROL_CURRENT_LEVEL, - NULL, -1, - &menu.main.text.current_level, &main_text_current_level, - NULL, NULL, - }, { MAIN_CONTROL_FIRST_LEVEL, NULL, -1, @@ -408,6 +402,12 @@ static struct MainControlInfo main_controls[] = &menu.main.text.last_level, &main_text_last_level, NULL, NULL, }, + { + MAIN_CONTROL_LEVEL_NUMBER, + NULL, -1, + &menu.main.text.level_number, &main_text_level_number, + NULL, NULL, + }, { MAIN_CONTROL_LEVEL_INFO_1, NULL, -1, @@ -577,10 +577,10 @@ static void InitializeMainControls() int i; /* set main control text values to dynamically determined values */ - sprintf(main_text_name, "%s", local_team_mode ? "Team:" : "Name:"); - sprintf(main_text_current_level, "%s", int2str(level_nr, 3)); - sprintf(main_text_first_level, "%03d", leveldir_current->first_level); - sprintf(main_text_last_level, "%03d", leveldir_current->last_level); + sprintf(main_text_name, "%s", local_team_mode ? "Team:" : "Name:"); + sprintf(main_text_first_level, "%03d", leveldir_current->first_level); + sprintf(main_text_last_level, "%03d", leveldir_current->last_level); + sprintf(main_text_level_number, "%s", int2str(level_nr, 3)); main_text_level_year = leveldir_current->year; main_text_level_imported_from = leveldir_current->imported_from; @@ -1632,7 +1632,7 @@ void HandleMainMenu_SelectLevel(int step, int direction) if (new_level_nr != old_level_nr) { - struct MainControlInfo *mci= getMainControlInfo(MAIN_CONTROL_CURRENT_LEVEL); + struct MainControlInfo *mci= getMainControlInfo(MAIN_CONTROL_LEVEL_NUMBER); PlaySound(SND_MENU_ITEM_SELECTING); -- 2.34.1