From 590e9a86daa2b0d3923673bfe02525766224808e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 10 Mar 2007 01:31:59 +0100 Subject: [PATCH] rnd-20070310-1-src * changed some numerical limits in the level editor from 255 to 999 --- ChangeLog | 3 + src/conf_gfx.c | 49 +++++---- src/conftime.h | 2 +- src/editor.c | 18 ++-- src/libgame/misc.c | 2 +- src/libgame/platform.h | 134 ++++++++++++++++++------- src/libgame/sdl.c | 6 +- src/libgame/setup.c | 50 ++++++---- src/libgame/system.h | 4 +- src/main.c | 28 ++++++ src/main.h | 8 +- src/screens.c | 220 ++++++++++++++++++++++++++++------------- 12 files changed, 356 insertions(+), 168 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c479e15..0b2f8f1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-03-08 + * changed some numerical limits in the level editor from 255 to 999 + 2007-03-07 * added option "system.sdl_videodriver" to select SDL video driver * added output of SDL video and audio driver to "version info" page diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 2a02b3c1..7f9e89fb 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5207,6 +5207,30 @@ struct ConfigInfo image_config[] = { "main.text.level_info_2.y", "523" }, { "main.text.level_info_2.align", "center" }, { "main.text.level_info_2.chars", "-1" }, + { "main.text.level_name.x", "-1" }, + { "main.text.level_name.y", "-1" }, + { "main.text.level_name.align", "left" }, + { "main.text.level_name.chars", "-1" }, + { "main.text.level_author.x", "-1" }, + { "main.text.level_author.y", "-1" }, + { "main.text.level_author.align", "left" }, + { "main.text.level_author.chars", "-1" }, + { "main.text.level_year.x", "-1" }, + { "main.text.level_year.y", "-1" }, + { "main.text.level_year.align", "left" }, + { "main.text.level_year.chars", "-1" }, + { "main.text.level_imported_from.x", "-1" }, + { "main.text.level_imported_from.y", "-1" }, + { "main.text.level_imported_from.align", "left" }, + { "main.text.level_imported_from.chars", "-1" }, + { "main.text.level_imported_by.x", "-1" }, + { "main.text.level_imported_by.y", "-1" }, + { "main.text.level_imported_by.align", "left" }, + { "main.text.level_imported_by.chars", "-1" }, + { "main.text.level_tested_by.x", "-1" }, + { "main.text.level_tested_by.y", "-1" }, + { "main.text.level_tested_by.align", "left" }, + { "main.text.level_tested_by.chars", "-1" }, { "main.text.title_1.x", "272" }, { "main.text.title_1.y", "8" }, { "main.text.title_1.align", "center" }, @@ -5245,7 +5269,6 @@ struct ConfigInfo image_config[] = { "door_2.step_delay", "10" }, { "door_2.anim_mode", "default" }, -#if 1 { "game.panel.level.x", "51" }, { "game.panel.level.y", "20" }, { "game.panel.level.align", "center" }, @@ -5269,30 +5292,6 @@ struct ConfigInfo image_config[] = { "game.panel.time.y", "194" }, { "game.panel.time.align", "center" }, { "game.panel.time.digits", "-1" }, -#else - { "game.panel.level.x", "37" }, - { "game.panel.level.y", "20" }, - { "game.panel.level.align", "left" }, - { "game.panel.level.digits", "-1" }, - { "game.panel.gems.x", "29" }, - { "game.panel.gems.y", "54" }, - { "game.panel.gems.align", "left" }, - { "game.panel.gems.digits", "-1" }, - { "game.panel.inventory.x", "29" }, - { "game.panel.inventory.y", "89" }, - { "game.panel.inventory.align", "left" }, - { "game.panel.inventory.digits", "-1" }, - { "game.panel.keys.x", "18" }, - { "game.panel.keys.y", "123" }, - { "game.panel.score.x", "15" }, - { "game.panel.score.y", "159" }, - { "game.panel.score.align", "left" }, - { "game.panel.score.digits", "-1" }, - { "game.panel.time.x", "29" }, - { "game.panel.time.y", "194" }, - { "game.panel.time.align", "left" }, - { "game.panel.time.digits", "-1" }, -#endif #if 0 /* --- not yet available (start) --- */ diff --git a/src/conftime.h b/src/conftime.h index b00a6acb..6aa98417 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-03-07 10:13" +#define COMPILE_DATE_STRING "2007-03-10 01:04" diff --git a/src/editor.c b/src/editor.c index 9f2ec785..009297ae 100644 --- a/src/editor.c +++ b/src/editor.c @@ -916,11 +916,11 @@ /* values for elements with score for certain actions */ #define MIN_SCORE 0 -#define MAX_SCORE 255 +#define MAX_SCORE 999 /* values for elements with count for collecting */ #define MIN_COLLECT_COUNT 0 -#define MAX_COLLECT_COUNT 255 +#define MAX_COLLECT_COUNT 999 /* values for random placement */ #define RANDOM_USE_PERCENTAGE 0 @@ -1047,7 +1047,7 @@ static struct }, { ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(9), - 0, 255, + 0, 999, GADGET_ID_LEVEL_TIMESCORE_DOWN, GADGET_ID_LEVEL_TIMESCORE_UP, GADGET_ID_LEVEL_TIMESCORE_TEXT, GADGET_ID_NONE, &level.score[SC_TIME_BONUS], @@ -1173,7 +1173,7 @@ static struct }, { ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(7), - 0, 255, + 0, 999, GADGET_ID_PUSH_DELAY_FIX_DOWN, GADGET_ID_PUSH_DELAY_FIX_UP, GADGET_ID_PUSH_DELAY_FIX_TEXT, GADGET_ID_NONE, &custom_element.push_delay_fixed, @@ -1181,7 +1181,7 @@ static struct }, { -1, ED_ELEMENT_SETTINGS_YPOS(7), - 0, 255, + 0, 999, GADGET_ID_PUSH_DELAY_RND_DOWN, GADGET_ID_PUSH_DELAY_RND_UP, GADGET_ID_PUSH_DELAY_RND_TEXT, GADGET_ID_PUSH_DELAY_FIX_UP, &custom_element.push_delay_random, @@ -1189,7 +1189,7 @@ static struct }, { ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(8), - 0, 255, + 0, 999, GADGET_ID_DROP_DELAY_FIX_DOWN, GADGET_ID_DROP_DELAY_FIX_UP, GADGET_ID_DROP_DELAY_FIX_TEXT, GADGET_ID_NONE, &custom_element.drop_delay_fixed, @@ -1197,7 +1197,7 @@ static struct }, { -1, ED_ELEMENT_SETTINGS_YPOS(8), - 0, 255, + 0, 999, GADGET_ID_DROP_DELAY_RND_DOWN, GADGET_ID_DROP_DELAY_RND_UP, GADGET_ID_DROP_DELAY_RND_TEXT, GADGET_ID_DROP_DELAY_FIX_UP, &custom_element.drop_delay_random, @@ -1224,7 +1224,7 @@ static struct }, { ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(12), - 0, 255, + 0, 999, GADGET_ID_EXPLOSION_DELAY_DOWN, GADGET_ID_EXPLOSION_DELAY_UP, GADGET_ID_EXPLOSION_DELAY_TEXT, GADGET_ID_NONE, &custom_element.explosion_delay, @@ -1232,7 +1232,7 @@ static struct }, { ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(13), - 0, 255, + 0, 999, GADGET_ID_IGNITION_DELAY_DOWN, GADGET_ID_IGNITION_DELAY_UP, GADGET_ID_IGNITION_DELAY_TEXT, GADGET_ID_NONE, &custom_element.ignition_delay, diff --git a/src/libgame/misc.c b/src/libgame/misc.c index eb3e7a0f..0f5a2c0f 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2683,7 +2683,7 @@ static void LoadCustomArtwork(struct ArtworkListInfo *artwork_info, struct FileInfo *file_list_entry) { #if 0 - printf("GOT CUSTOM ARTWORK FILE '%s'\n", filename); + printf("GOT CUSTOM ARTWORK FILE '%s'\n", file_list_entry->filename); #endif if (strEqual(file_list_entry->filename, UNDEFINED_FILENAME)) diff --git a/src/libgame/platform.h b/src/libgame/platform.h index 7ac79f3b..1e6d1c0f 100644 --- a/src/libgame/platform.h +++ b/src/libgame/platform.h @@ -15,13 +15,13 @@ #define PLATFORM_H /* ========================================================================= */ -/* define keywords for supported main platforms (Unix, DOS and Windows) */ +/* define main platform keywords */ /* ========================================================================= */ #if defined(MSDOS) #define PLATFORM_MSDOS #define PLATFORM_STRING "DOS" -#elif defined(WIN32) +#elif defined(WIN32) || defined(_WIN32) #define PLATFORM_WIN32 #define PLATFORM_STRING "Windows" #else @@ -31,41 +31,69 @@ /* ========================================================================= */ -/* define additional keywords for MS-DOS platform */ +/* define additional platform keywords */ /* ========================================================================= */ -#if defined(PLATFORM_MSDOS) +#if defined(_AIX) +#define PLATFORM_AIX +#undef PLATFORM_STRING +#define PLATFORM_STRING "AIX" +#endif -#ifndef TARGET_ALLEGRO -#define TARGET_ALLEGRO +#if defined(AMIGA) || defined(__AMIGA) || defined(__amigados__) +#define PLATFORM_AMIGA +#undef PLATFORM_STRING +#define PLATFORM_STRING "AmigaOS" #endif -#ifndef TARGET_X11 -#define TARGET_X11 +#if defined(__BEOS__) +#define PLATFORM_BEOS +#undef PLATFORM_STRING +#define PLATFORM_STRING "BeOS" #endif +#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) +#define PLATFORM_BSDI +#define PLATFORM_BSD +#undef PLATFORM_STRING +#define PLATFORM_STRING "BSDI" #endif +#if defined(_arch_dreamcast) +#define PLATFORM_DREAMCAST +#undef PLATFORM_STRING +#define PLATFORM_STRING "Dreamcast" +#endif -/* ========================================================================= */ -/* define additional keywords for several Unix platforms */ -/* ========================================================================= */ +#if defined(__FreeBSD__) || defined(__DragonFly__) +#define PLATFORM_FREEBSD +#define PLATFORM_BSD +#undef PLATFORM_STRING +#define PLATFORM_STRING "FreeBSD" +#endif -#if defined(PLATFORM_UNIX) && defined(TARGET_X11) -#define TARGET_X11_NATIVE +#if defined(hpux) || defined(__hpux) || defined(__hpux__) +#define PLATFORM_HPUX +#undef PLATFORM_STRING +#define PLATFORM_STRING "HP-UX" #endif -#if defined(linux) +#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) +#define PLATFORM_IRIX +#undef PLATFORM_STRING +#define PLATFORM_STRING "IRIX" +#endif + +#if defined(linux) || defined(__linux) || defined(__linux__) #define PLATFORM_LINUX #undef PLATFORM_STRING #define PLATFORM_STRING "Linux" #endif -#if defined(__FreeBSD__) -#define PLATFORM_FREEBSD -#define PLATFORM_BSD +#if defined(__APPLE__) && defined(__MACH__) +#define PLATFORM_MACOSX #undef PLATFORM_STRING -#define PLATFORM_STRING "FreeBSD" +#define PLATFORM_STRING "Mac OS X" #endif #if defined(__NetBSD__) @@ -75,41 +103,71 @@ #define PLATFORM_STRING "NetBSD" #endif -#if defined(__bsdi__) -#define PLATFORM_BSDI +#if defined(NeXT) +#define PLATFORM_NEXT +#undef PLATFORM_STRING +#define PLATFORM_STRING "NeXT" +#endif + +#if defined(__OpenBSD__) +#define PLATFORM_OPENBSD #define PLATFORM_BSD #undef PLATFORM_STRING -#define PLATFORM_STRING "BSDI" +#define PLATFORM_STRING "OpenBSD" #endif -#if defined(sparc) && defined(sun) -#define PLATFORM_SUNOS +#if defined(__OS2__) +#define PLATFORM_OS2 #undef PLATFORM_STRING -#define PLATFORM_STRING "Solaris" +#define PLATFORM_STRING "OS/2" #endif -#if defined(__APPLE__) && defined(__MACH__) -#define PLATFORM_MACOSX +#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) +#define PLATFORM_OSF #undef PLATFORM_STRING -#define PLATFORM_STRING "Mac OS X" +#define PLATFORM_STRING "OSF/1" #endif -#if defined(NeXT) -#define PLATFORM_NEXT +#if defined(__QNXNTO__) +#define PLATFORM_QNX #undef PLATFORM_STRING -#define PLATFORM_STRING "NeXT" +#define PLATFORM_STRING "QNX" #endif -/* detecting HP-UX by the following compiler keyword definitions: - - in K&R mode (the default), the HP C compiler defines "hpux" - - in ANSI mode (-Aa or -Ae), the HP C compiler defines "__hpux" - - the gcc (Gnu) C compiler defines "__hpux__" - Thanks to Jarkko Hietaniemi for this note. */ +#if defined(riscos) || defined(__riscos) || defined(__riscos__) +#define PLATFORM_RISCOS +#undef PLATFORM_STRING +#define PLATFORM_STRING "RISC OS" +#endif -#if defined(__hpux__) || defined(__hpux) || defined(hpux) -#define PLATFORM_HPUX +#if defined(sparc) || defined(sun) || defined(__SVR4) +#define PLATFORM_SOLARIS #undef PLATFORM_STRING -#define PLATFORM_STRING "HP-UX" +#define PLATFORM_STRING "Solaris" +#endif + +#if defined(_WIN32_WCE) +#define PLATFORM_WINDOWS_CE +#undef PLATFORM_STRING +#define PLATFORM_STRING "Windows CE" +#endif + + +/* ========================================================================= */ +/* define additional target keywords */ +/* ========================================================================= */ + +#if defined(PLATFORM_MSDOS) +#ifndef TARGET_ALLEGRO +#define TARGET_ALLEGRO +#endif +#ifndef TARGET_X11 +#define TARGET_X11 +#endif +#endif + +#if defined(PLATFORM_UNIX) && defined(TARGET_X11) +#define TARGET_X11_NATIVE #endif diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index f3f57567..605f2342 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -95,9 +95,9 @@ static void SDLSetWindowIcon(char *basename) void SDLInitVideoDisplay(void) { if (!strEqual(setup.system.sdl_videodriver, ARG_DEFAULT)) - putenv(getStringCat2("SDL_VIDEODRIVER=", setup.system.sdl_videodriver)); + SDL_putenv(getStringCat2("SDL_VIDEODRIVER=", setup.system.sdl_videodriver)); - putenv("SDL_VIDEO_CENTERED=1"); + SDL_putenv("SDL_VIDEO_CENTERED=1"); /* initialize SDL video */ if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) @@ -1587,7 +1587,7 @@ void SDLSetMouseCursor(struct MouseCursorInfo *cursor_info) void SDLOpenAudio(void) { if (!strEqual(setup.system.sdl_audiodriver, ARG_DEFAULT)) - putenv(getStringCat2("SDL_AUDIODRIVER=", setup.system.sdl_audiodriver)); + SDL_putenv(getStringCat2("SDL_AUDIODRIVER=", setup.system.sdl_audiodriver)); if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 922f8314..3688af7d 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -1909,25 +1909,27 @@ void checkSetupFileHashIdentifier(SetupFileHash *setup_file_hash, #define LEVELINFO_TOKEN_NAME 1 #define LEVELINFO_TOKEN_NAME_SORTING 2 #define LEVELINFO_TOKEN_AUTHOR 3 -#define LEVELINFO_TOKEN_IMPORTED_FROM 4 -#define LEVELINFO_TOKEN_IMPORTED_BY 5 -#define LEVELINFO_TOKEN_LEVELS 6 -#define LEVELINFO_TOKEN_FIRST_LEVEL 7 -#define LEVELINFO_TOKEN_SORT_PRIORITY 8 -#define LEVELINFO_TOKEN_LATEST_ENGINE 9 -#define LEVELINFO_TOKEN_LEVEL_GROUP 10 -#define LEVELINFO_TOKEN_READONLY 11 -#define LEVELINFO_TOKEN_GRAPHICS_SET_ECS 12 -#define LEVELINFO_TOKEN_GRAPHICS_SET_AGA 13 -#define LEVELINFO_TOKEN_GRAPHICS_SET 14 -#define LEVELINFO_TOKEN_SOUNDS_SET 15 -#define LEVELINFO_TOKEN_MUSIC_SET 16 -#define LEVELINFO_TOKEN_FILENAME 17 -#define LEVELINFO_TOKEN_FILETYPE 18 -#define LEVELINFO_TOKEN_HANDICAP 19 -#define LEVELINFO_TOKEN_SKIP_LEVELS 20 - -#define NUM_LEVELINFO_TOKENS 21 +#define LEVELINFO_TOKEN_YEAR 4 +#define LEVELINFO_TOKEN_IMPORTED_FROM 5 +#define LEVELINFO_TOKEN_IMPORTED_BY 6 +#define LEVELINFO_TOKEN_TESTED_BY 7 +#define LEVELINFO_TOKEN_LEVELS 8 +#define LEVELINFO_TOKEN_FIRST_LEVEL 9 +#define LEVELINFO_TOKEN_SORT_PRIORITY 10 +#define LEVELINFO_TOKEN_LATEST_ENGINE 11 +#define LEVELINFO_TOKEN_LEVEL_GROUP 12 +#define LEVELINFO_TOKEN_READONLY 13 +#define LEVELINFO_TOKEN_GRAPHICS_SET_ECS 14 +#define LEVELINFO_TOKEN_GRAPHICS_SET_AGA 15 +#define LEVELINFO_TOKEN_GRAPHICS_SET 16 +#define LEVELINFO_TOKEN_SOUNDS_SET 17 +#define LEVELINFO_TOKEN_MUSIC_SET 18 +#define LEVELINFO_TOKEN_FILENAME 19 +#define LEVELINFO_TOKEN_FILETYPE 20 +#define LEVELINFO_TOKEN_HANDICAP 21 +#define LEVELINFO_TOKEN_SKIP_LEVELS 22 + +#define NUM_LEVELINFO_TOKENS 23 static LevelDirTree ldi; @@ -1938,8 +1940,10 @@ static struct TokenInfo levelinfo_tokens[] = { TYPE_STRING, &ldi.name, "name" }, { TYPE_STRING, &ldi.name_sorting, "name_sorting" }, { TYPE_STRING, &ldi.author, "author" }, + { TYPE_STRING, &ldi.year, "year" }, { TYPE_STRING, &ldi.imported_from, "imported_from" }, { TYPE_STRING, &ldi.imported_by, "imported_by" }, + { TYPE_STRING, &ldi.tested_by, "tested_by" }, { TYPE_INTEGER, &ldi.levels, "levels" }, { TYPE_INTEGER, &ldi.first_level, "first_level" }, { TYPE_INTEGER, &ldi.sort_priority, "sort_priority" }, @@ -1999,6 +2003,7 @@ static void setTreeInfoToDefaults(TreeInfo *ti, int type) ti->name = getStringCopy(ANONYMOUS_NAME); ti->name_sorting = NULL; ti->author = getStringCopy(ANONYMOUS_NAME); + ti->year = NULL; ti->sort_priority = LEVELCLASS_UNDEFINED; /* default: least priority */ ti->latest_engine = FALSE; /* default: get from level */ @@ -2014,6 +2019,7 @@ static void setTreeInfoToDefaults(TreeInfo *ti, int type) { ti->imported_from = NULL; ti->imported_by = NULL; + ti->tested_by = NULL; ti->graphics_set_ecs = NULL; ti->graphics_set_aga = NULL; @@ -2068,6 +2074,7 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent) ti->name = getStringCopy(ANONYMOUS_NAME); ti->name_sorting = NULL; ti->author = getStringCopy(parent->author); + ti->year = getStringCopy(parent->year); ti->sort_priority = parent->sort_priority; ti->latest_engine = parent->latest_engine; @@ -2083,6 +2090,7 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent) { ti->imported_from = getStringCopy(parent->imported_from); ti->imported_by = getStringCopy(parent->imported_by); + ti->tested_by = getStringCopy(parent->tested_by); ti->graphics_set_ecs = NULL; ti->graphics_set_aga = NULL; @@ -2130,8 +2138,10 @@ static TreeInfo *getTreeInfoCopy(TreeInfo *ti) ti_copy->name = getStringCopy(ti->name); ti_copy->name_sorting = getStringCopy(ti->name_sorting); ti_copy->author = getStringCopy(ti->author); + ti_copy->year = getStringCopy(ti->year); ti_copy->imported_from = getStringCopy(ti->imported_from); ti_copy->imported_by = getStringCopy(ti->imported_by); + ti_copy->tested_by = getStringCopy(ti->tested_by); ti_copy->graphics_set_ecs = getStringCopy(ti->graphics_set_ecs); ti_copy->graphics_set_aga = getStringCopy(ti->graphics_set_aga); @@ -2182,6 +2192,7 @@ static void freeTreeInfo(TreeInfo *ti) checked_free(ti->name); checked_free(ti->name_sorting); checked_free(ti->author); + checked_free(ti->year); checked_free(ti->class_desc); @@ -2191,6 +2202,7 @@ static void freeTreeInfo(TreeInfo *ti) { checked_free(ti->imported_from); checked_free(ti->imported_by); + checked_free(ti->tested_by); checked_free(ti->graphics_set_ecs); checked_free(ti->graphics_set_aga); diff --git a/src/libgame/system.h b/src/libgame/system.h index b3811e61..55caac9a 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -844,8 +844,10 @@ struct TreeInfo char *name; /* tree info name, as displayed in selection menues */ char *name_sorting; /* optional sorting name for correct name sorting */ char *author; /* level or artwork author name */ + char *year; /* optional year of creation for levels or artwork */ char *imported_from; /* optional comment for imported levels or artwork */ char *imported_by; /* optional comment for imported levels or artwork */ + char *tested_by; /* optional comment to name people who tested a set */ char *graphics_set_ecs; /* special EMC custom graphics set (ECS graphics) */ char *graphics_set_aga; /* special EMC custom graphics set (AGA graphics) */ @@ -1013,7 +1015,6 @@ struct Rect int width, height; }; -#if 1 struct MenuPosInfo { int x, y; @@ -1028,7 +1029,6 @@ struct TextPosInfo int align; int chars; }; -#endif /* ========================================================================= */ diff --git a/src/main.c b/src/main.c index bfa11abd..873a344d 100644 --- a/src/main.c +++ b/src/main.c @@ -6144,6 +6144,34 @@ struct TokenIntPtrInfo image_config_vars[] = { "main.text.level_info_2.y", &menu.main.text.level_info_2.y }, { "main.text.level_info_2.align", &menu.main.text.level_info_2.align }, { "main.text.level_info_2.chars", &menu.main.text.level_info_2.chars }, + { "main.text.level_name.x", &menu.main.text.level_name.x }, + { "main.text.level_name.y", &menu.main.text.level_name.y }, + { "main.text.level_name.align", &menu.main.text.level_name.align }, + { "main.text.level_name.chars", &menu.main.text.level_name.chars }, + { "main.text.level_author.x", &menu.main.text.level_author.x }, + { "main.text.level_author.y", &menu.main.text.level_author.y }, + { "main.text.level_author.align", &menu.main.text.level_author.align }, + { "main.text.level_author.chars", &menu.main.text.level_author.chars }, + { "main.text.level_year.x", &menu.main.text.level_year.x }, + { "main.text.level_year.y", &menu.main.text.level_year.y }, + { "main.text.level_year.align", &menu.main.text.level_year.align }, + { "main.text.level_year.chars", &menu.main.text.level_year.chars }, + { "main.text.level_imported_from.x", &menu.main.text.level_imported_from.x }, + { "main.text.level_imported_from.y", &menu.main.text.level_imported_from.y }, + { "main.text.level_imported_from.align", + &menu.main.text.level_imported_from.align }, + { "main.text.level_imported_from.chars", + &menu.main.text.level_imported_from.chars }, + { "main.text.level_imported_by.x", &menu.main.text.level_imported_by.x }, + { "main.text.level_imported_by.y", &menu.main.text.level_imported_by.y }, + { "main.text.level_imported_by.align", + &menu.main.text.level_imported_by.align }, + { "main.text.level_imported_by.chars", + &menu.main.text.level_imported_by.chars }, + { "main.text.level_tested_by.x", &menu.main.text.level_tested_by.x }, + { "main.text.level_tested_by.y", &menu.main.text.level_tested_by.y }, + { "main.text.level_tested_by.align", &menu.main.text.level_tested_by.align }, + { "main.text.level_tested_by.chars", &menu.main.text.level_tested_by.chars }, { "main.text.title_1.x", &menu.main.text.title_1.x }, { "main.text.title_1.y", &menu.main.text.title_1.y }, { "main.text.title_1.align", &menu.main.text.title_1.align }, diff --git a/src/main.h b/src/main.h index 3137db79..ade881e0 100644 --- a/src/main.h +++ b/src/main.h @@ -2030,6 +2030,12 @@ struct MenuMainTextInfo struct TextPosInfo last_level; struct TextPosInfo level_info_1; struct TextPosInfo level_info_2; + struct TextPosInfo level_name; + struct TextPosInfo level_author; + struct TextPosInfo level_year; + struct TextPosInfo level_imported_from; + struct TextPosInfo level_imported_by; + struct TextPosInfo level_tested_by; struct TextPosInfo title_1; struct TextPosInfo title_2; struct TextPosInfo title_3; @@ -2037,7 +2043,7 @@ struct MenuMainTextInfo struct MenuMainInputInfo { - struct MenuPosInfo name; + struct TextPosInfo name; }; struct MenuMainInfo diff --git a/src/screens.c b/src/screens.c index d37a3f14..61f34507 100644 --- a/src/screens.c +++ b/src/screens.c @@ -260,30 +260,56 @@ struct TitleControlInfo title_controls[MAX_NUM_TITLE_SCREENS]; /* main menu display and control definitions */ -#define MAIN_CONTROL_NAME 0 -#define MAIN_CONTROL_LEVELS 1 -#define MAIN_CONTROL_SCORES 2 -#define MAIN_CONTROL_EDITOR 3 -#define MAIN_CONTROL_INFO 4 -#define MAIN_CONTROL_GAME 5 -#define MAIN_CONTROL_SETUP 6 -#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_LEVEL_INFO_1 13 -#define MAIN_CONTROL_LEVEL_INFO_2 14 -#define MAIN_CONTROL_TITLE_1 15 -#define MAIN_CONTROL_TITLE_2 16 -#define MAIN_CONTROL_TITLE_3 17 - -static char main_text_name[10]; -static char main_text_current_level[10]; -static char main_text_first_level[10]; -static char main_text_last_level[10]; -static char main_input_name[MAX_PLAYER_NAME_LEN + 1]; +#define MAIN_CONTROL_NAME 0 +#define MAIN_CONTROL_LEVELS 1 +#define MAIN_CONTROL_SCORES 2 +#define MAIN_CONTROL_EDITOR 3 +#define MAIN_CONTROL_INFO 4 +#define MAIN_CONTROL_GAME 5 +#define MAIN_CONTROL_SETUP 6 +#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_LEVEL_INFO_1 13 +#define MAIN_CONTROL_LEVEL_INFO_2 14 +#define MAIN_CONTROL_LEVEL_NAME 15 +#define MAIN_CONTROL_LEVEL_AUTHOR 16 +#define MAIN_CONTROL_LEVEL_YEAR 17 +#define MAIN_CONTROL_LEVEL_IMPORTED_FROM 18 +#define MAIN_CONTROL_LEVEL_IMPORTED_BY 19 +#define MAIN_CONTROL_LEVEL_TESTED_BY 20 +#define MAIN_CONTROL_TITLE_1 21 +#define MAIN_CONTROL_TITLE_2 22 +#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 *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_levels = "Levelset"; +static char *main_text_scores = "Hall Of Fame"; +static char *main_text_editor = "Level Creator"; +static char *main_text_info = "Info Screen"; +static char *main_text_game = "Start Game"; +static char *main_text_setup = "Setup"; +static char *main_text_quit = "Quit"; +static char *main_text_level_name = level.name; +static char *main_text_level_author = level.author; +static char *main_text_level_year = NULL; +static char *main_text_level_imported_from = NULL; +static char *main_text_level_imported_by = NULL; +static char *main_text_level_tested_by = NULL; +static char *main_text_title_1 = PROGRAM_TITLE_STRING; +static char *main_text_title_2 = PROGRAM_COPYRIGHT_STRING; +static char *main_text_title_3 = PROGRAM_GAME_BY_STRING; struct MainControlInfo { @@ -293,11 +319,11 @@ struct MainControlInfo int button_graphic; struct TextPosInfo *pos_text; - char *text; + char **text; int font_text; - struct MenuPosInfo *pos_input; - char *input; + struct TextPosInfo *pos_input; + char **input; int font_input; }; @@ -306,49 +332,49 @@ static struct MainControlInfo main_controls[] = { MAIN_CONTROL_NAME, &menu.main.button.name, IMG_MENU_BUTTON, - &menu.main.text.name, main_text_name, FONT_MENU_1, - &menu.main.input.name, main_input_name, FONT_INPUT_1, + &menu.main.text.name, &main_text_name, FONT_MENU_1, + &menu.main.input.name, &setup.player_name, FONT_INPUT_1, }, { MAIN_CONTROL_LEVELS, &menu.main.button.levels, IMG_MENU_BUTTON_ENTER_MENU, - &menu.main.text.levels, "Levelset", FONT_MENU_1, + &menu.main.text.levels, &main_text_levels, FONT_MENU_1, NULL, NULL, -1, }, { MAIN_CONTROL_SCORES, &menu.main.button.scores, IMG_MENU_BUTTON, - &menu.main.text.scores, "Hall Of Fame", FONT_MENU_1, + &menu.main.text.scores, &main_text_scores, FONT_MENU_1, NULL, NULL, -1, }, { MAIN_CONTROL_EDITOR, &menu.main.button.editor, IMG_MENU_BUTTON, - &menu.main.text.editor, "Level Creator", FONT_MENU_1, + &menu.main.text.editor, &main_text_editor, FONT_MENU_1, NULL, NULL, -1, }, { MAIN_CONTROL_INFO, &menu.main.button.info, IMG_MENU_BUTTON_ENTER_MENU, - &menu.main.text.info, "Info Screen", FONT_MENU_1, + &menu.main.text.info, &main_text_info, FONT_MENU_1, NULL, NULL, -1, }, { MAIN_CONTROL_GAME, &menu.main.button.game, IMG_MENU_BUTTON, - &menu.main.text.game, "Start Game", FONT_MENU_1, + &menu.main.text.game, &main_text_game, FONT_MENU_1, NULL, NULL, -1, }, { MAIN_CONTROL_SETUP, &menu.main.button.setup, IMG_MENU_BUTTON_ENTER_MENU, - &menu.main.text.setup, "Setup", FONT_MENU_1, + &menu.main.text.setup, &main_text_setup, FONT_MENU_1, NULL, NULL, -1, }, { MAIN_CONTROL_QUIT, &menu.main.button.quit, IMG_MENU_BUTTON, - &menu.main.text.quit, "Quit", FONT_MENU_1, + &menu.main.text.quit, &main_text_quit, FONT_MENU_1, NULL, NULL, -1, }, #if 0 @@ -369,19 +395,19 @@ static struct MainControlInfo main_controls[] = { MAIN_CONTROL_CURRENT_LEVEL, NULL, -1, - &menu.main.text.current_level, main_text_current_level,FONT_VALUE_1, + &menu.main.text.current_level, &main_text_current_level, FONT_VALUE_1, NULL, NULL, -1, }, { MAIN_CONTROL_FIRST_LEVEL, NULL, -1, - &menu.main.text.first_level, main_text_first_level, FONT_TEXT_3, + &menu.main.text.first_level, &main_text_first_level, FONT_TEXT_3, NULL, NULL, -1, }, { MAIN_CONTROL_LAST_LEVEL, NULL, -1, - &menu.main.text.last_level, main_text_last_level, FONT_TEXT_3, + &menu.main.text.last_level, &main_text_last_level, FONT_TEXT_3, NULL, NULL, -1, }, { @@ -396,22 +422,60 @@ static struct MainControlInfo main_controls[] = &menu.main.text.level_info_2, NULL, -1, NULL, NULL, -1, }, + { + MAIN_CONTROL_LEVEL_NAME, + NULL, -1, + &menu.main.text.level_name, &main_text_level_name, FONT_TEXT_2, + NULL, NULL, -1, + }, + { + MAIN_CONTROL_LEVEL_AUTHOR, + NULL, -1, + &menu.main.text.level_author, &main_text_level_author,FONT_TEXT_2, + NULL, NULL, -1, + }, + { + MAIN_CONTROL_LEVEL_YEAR, + NULL, -1, + &menu.main.text.level_year, &main_text_level_year, FONT_TEXT_2, + NULL, NULL, -1, + }, + { + MAIN_CONTROL_LEVEL_IMPORTED_FROM, + NULL, -1, + &menu.main.text.level_imported_from, &main_text_level_imported_from, + FONT_TEXT_2, + NULL, NULL, -1, + }, + { + MAIN_CONTROL_LEVEL_IMPORTED_BY, + NULL, -1, + &menu.main.text.level_imported_by, &main_text_level_imported_by, + FONT_TEXT_2, + NULL, NULL, -1, + }, + { + MAIN_CONTROL_LEVEL_TESTED_BY, + NULL, -1, + &menu.main.text.level_tested_by, &main_text_level_tested_by, FONT_TEXT_2, + NULL, NULL, -1, + }, { MAIN_CONTROL_TITLE_1, NULL, -1, - &menu.main.text.title_1, PROGRAM_TITLE_STRING, FONT_TITLE_1, + &menu.main.text.title_1, &main_text_title_1, FONT_TITLE_1, NULL, NULL, -1, }, { MAIN_CONTROL_TITLE_2, NULL, -1, - &menu.main.text.title_2, PROGRAM_COPYRIGHT_STRING, FONT_TITLE_2, + &menu.main.text.title_2, &main_text_title_2, FONT_TITLE_2, NULL, NULL, -1, }, { MAIN_CONTROL_TITLE_3, NULL, -1, - &menu.main.text.title_3, PROGRAM_GAME_BY_STRING, FONT_TITLE_2, + &menu.main.text.title_3, &main_text_title_3, FONT_TITLE_2, NULL, NULL, -1, }, @@ -501,6 +565,16 @@ static void InitializeTitleControls(boolean show_title_initial) compareTitleControlInfo); } +static boolean visibleMenuPos(struct MenuPosInfo *pos) +{ + return (pos != NULL && pos->x != -1 && pos->y != -1); +} + +static boolean visibleTextPos(struct TextPosInfo *pos) +{ + return (pos != NULL && pos->x != -1 && pos->y != -1); +} + static void InitializeMainControls() { boolean local_team_mode = (!options.network && setup.team_mode); @@ -511,7 +585,11 @@ static void InitializeMainControls() 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_input_name, "%s", setup.player_name); + + main_text_level_year = leveldir_current->year; + main_text_level_imported_from = leveldir_current->imported_from; + main_text_level_imported_by = leveldir_current->imported_by; + main_text_level_tested_by = leveldir_current->tested_by; /* set main control screen positions to dynamically determined values */ for (i = 0; main_controls[i].nr != -1; i++) @@ -520,9 +598,9 @@ static void InitializeMainControls() int nr = mci->nr; struct MenuPosInfo *pos_button = mci->pos_button; struct TextPosInfo *pos_text = mci->pos_text; - struct MenuPosInfo *pos_input = mci->pos_input; - char *text = mci->text; - char *input = mci->input; + struct TextPosInfo *pos_input = mci->pos_input; + char *text = (mci->text ? *mci->text : NULL); + char *input = (mci->input ? *mci->input : NULL); int button_graphic = mci->button_graphic; int font_text = mci->font_text; int font_input = mci->font_input; @@ -561,7 +639,7 @@ static void InitializeMainControls() #endif } - if (pos_button != NULL) + if (pos_button != NULL) /* (x/y may be -1/-1 here) */ { if (pos_button->width == 0) pos_button->width = button_width; @@ -569,15 +647,18 @@ static void InitializeMainControls() pos_button->height = button_height; } - if (pos_text != NULL) + if (pos_text != NULL) /* (x/y may be -1/-1 here) */ { /* calculate width for non-clickable text -- needed for text alignment */ boolean calculate_text_width = (pos_button == NULL && text != NULL); - if (pos_text->x == -1 && pos_button != NULL) - pos_text->x = pos_button->x + pos_button->width; - if (pos_text->y == -1 && pos_button != NULL) - pos_text->y = pos_button->y; + if (visibleMenuPos(pos_button)) + { + if (pos_text->x == -1) + pos_text->x = pos_button->x + pos_button->width; + if (pos_text->y == -1) + pos_text->y = pos_button->y; + } if (pos_text->width == -1 || calculate_text_width) pos_text->width = text_width; @@ -585,12 +666,15 @@ static void InitializeMainControls() pos_text->height = text_height; } - if (pos_input != NULL) + if (pos_input != NULL) /* (x/y may be -1/-1 here) */ { - if (pos_input->x == -1 && pos_text != NULL) - pos_input->x = pos_text->x + pos_text->width; - if (pos_input->y == -1 && pos_text != NULL) - pos_input->y = pos_text->y; + if (visibleTextPos(pos_text)) + { + if (pos_input->x == -1) + pos_input->x = pos_text->x + pos_text->width; + if (pos_input->y == -1) + pos_input->y = pos_text->y; + } if (pos_input->width == -1) pos_input->width = input_width; @@ -613,9 +697,9 @@ static void DrawCursorAndText_Main_Ext(int nr, boolean active_text, { struct MenuPosInfo *pos_button = mci->pos_button; struct TextPosInfo *pos_text = mci->pos_text; - struct MenuPosInfo *pos_input = mci->pos_input; - char *text = mci->text; - char *input = mci->input; + struct TextPosInfo *pos_input = mci->pos_input; + char *text = (mci->text ? *mci->text : NULL); + char *input = (mci->input ? *mci->input : NULL); int button_graphic = mci->button_graphic; int font_text = mci->font_text; int font_input = mci->font_input; @@ -631,7 +715,7 @@ static void DrawCursorAndText_Main_Ext(int nr, boolean active_text, font_input = FONT_ACTIVE(font_input); } - if (pos_button != NULL) + if (visibleMenuPos(pos_button)) { struct MenuPosInfo *pos = pos_button; int x = mSX + pos->x; @@ -641,7 +725,7 @@ static void DrawCursorAndText_Main_Ext(int nr, boolean active_text, DrawGraphicThruMaskExt(drawto, x, y, button_graphic, 0); } - if (pos_text != NULL && text != NULL) + if (visibleTextPos(pos_text) && text != NULL) { struct TextPosInfo *pos = pos_text; int x = mSX + ALIGNED_MENU_XPOS(pos); @@ -651,9 +735,9 @@ static void DrawCursorAndText_Main_Ext(int nr, boolean active_text, DrawText(x, y, text, font_text); } - if (pos_input != NULL && input != NULL) + if (visibleTextPos(pos_input) && input != NULL) { - struct MenuPosInfo *pos = pos_input; + struct TextPosInfo *pos = pos_input; int x = mSX + ALIGNED_MENU_XPOS(pos); int y = mSY + ALIGNED_MENU_YPOS(pos); @@ -1585,7 +1669,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) { if (insideMenuPosRect(main_controls[i].pos_button, mx - mSX, my - mSY) || insideTextPosRect(main_controls[i].pos_text, mx - mSX, my - mSY) || - insideMenuPosRect(main_controls[i].pos_input, mx - mSX, my - mSY)) + insideTextPosRect(main_controls[i].pos_input, mx - mSX, my - mSY)) { pos = main_controls[i].nr; @@ -2943,7 +3027,7 @@ void DrawInfoScreen_Version() ystart2 += 3 * ystep; DrawTextF(xstart1, ystart2, font_header, "Driver"); DrawTextF(xstart2, ystart2, font_header, "Requested"); - DrawTextF(xstart3, ystart2, font_header, "Active"); + DrawTextF(xstart3, ystart2, font_header, "Used"); SDL_VideoDriverName(driver_name, driver_name_len); @@ -3134,7 +3218,7 @@ void HandleTypeName(int newxpos, Key key) static char last_player_name[MAX_PLAYER_NAME_LEN + 1]; struct MainControlInfo *mci = getMainControlInfo(MAIN_CONTROL_NAME); #if 1 - struct MenuPosInfo *pos = mci->pos_input; + struct TextPosInfo *pos = mci->pos_input; int startx = mSX + ALIGNED_MENU_XPOS(pos); int starty = mSY + ALIGNED_MENU_YPOS(pos); #endif @@ -3249,8 +3333,6 @@ void HandleTypeName(int newxpos, Key key) DrawText(startx, starty, setup.player_name, font_nr); } - - sprintf(main_input_name, "%s", setup.player_name); } -- 2.34.1