From: Holger Schemel Date: Fri, 24 Nov 2017 20:21:19 +0000 (+0100) Subject: added support for main menu titles in level and graphics config file X-Git-Tag: 4.1.0.0~45 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=33775032e403b28c89ee7c60b64a456d30a013fb added support for main menu titles in level and graphics config file --- diff --git a/src/init.c b/src/init.c index b0043d49..ff9f0344 100644 --- a/src/init.c +++ b/src/init.c @@ -5123,6 +5123,10 @@ static void InitArtworkConfig() { "name", "sort_priority", + "program_title", + "program_copyright", + "program_company", + NULL }; static char **ignore_image_tokens; diff --git a/src/libgame/setup.c b/src/libgame/setup.c index f2f5984f..bbfbe9c3 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -2236,27 +2236,30 @@ SetupFileHash *loadSetupFileHash(char *filename) #define LEVELINFO_TOKEN_NAME_SORTING 2 #define LEVELINFO_TOKEN_AUTHOR 3 #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_SPECIAL_FLAGS 21 -#define LEVELINFO_TOKEN_HANDICAP 22 -#define LEVELINFO_TOKEN_SKIP_LEVELS 23 - -#define NUM_LEVELINFO_TOKENS 24 +#define LEVELINFO_TOKEN_PROGRAM_TITLE 5 +#define LEVELINFO_TOKEN_PROGRAM_COPYRIGHT 6 +#define LEVELINFO_TOKEN_PROGRAM_COMPANY 7 +#define LEVELINFO_TOKEN_IMPORTED_FROM 8 +#define LEVELINFO_TOKEN_IMPORTED_BY 9 +#define LEVELINFO_TOKEN_TESTED_BY 10 +#define LEVELINFO_TOKEN_LEVELS 11 +#define LEVELINFO_TOKEN_FIRST_LEVEL 12 +#define LEVELINFO_TOKEN_SORT_PRIORITY 13 +#define LEVELINFO_TOKEN_LATEST_ENGINE 14 +#define LEVELINFO_TOKEN_LEVEL_GROUP 15 +#define LEVELINFO_TOKEN_READONLY 16 +#define LEVELINFO_TOKEN_GRAPHICS_SET_ECS 17 +#define LEVELINFO_TOKEN_GRAPHICS_SET_AGA 18 +#define LEVELINFO_TOKEN_GRAPHICS_SET 19 +#define LEVELINFO_TOKEN_SOUNDS_SET 20 +#define LEVELINFO_TOKEN_MUSIC_SET 21 +#define LEVELINFO_TOKEN_FILENAME 22 +#define LEVELINFO_TOKEN_FILETYPE 23 +#define LEVELINFO_TOKEN_SPECIAL_FLAGS 24 +#define LEVELINFO_TOKEN_HANDICAP 25 +#define LEVELINFO_TOKEN_SKIP_LEVELS 26 + +#define NUM_LEVELINFO_TOKENS 27 static LevelDirTree ldi; @@ -2268,6 +2271,9 @@ static struct TokenInfo levelinfo_tokens[] = { TYPE_STRING, &ldi.name_sorting, "name_sorting" }, { TYPE_STRING, &ldi.author, "author" }, { TYPE_STRING, &ldi.year, "year" }, + { TYPE_STRING, &ldi.program_title, "program_title" }, + { TYPE_STRING, &ldi.program_copyright, "program_copyright" }, + { TYPE_STRING, &ldi.program_company, "program_company" }, { TYPE_STRING, &ldi.imported_from, "imported_from" }, { TYPE_STRING, &ldi.imported_by, "imported_by" }, { TYPE_STRING, &ldi.tested_by, "tested_by" }, @@ -2297,6 +2303,9 @@ static struct TokenInfo artworkinfo_tokens[] = { TYPE_STRING, &ldi.name, "name" }, { TYPE_STRING, &ldi.name_sorting, "name_sorting" }, { TYPE_STRING, &ldi.author, "author" }, + { TYPE_STRING, &ldi.program_title, "program_title" }, + { TYPE_STRING, &ldi.program_copyright, "program_copyright" }, + { TYPE_STRING, &ldi.program_company, "program_company" }, { TYPE_INTEGER, &ldi.sort_priority, "sort_priority" }, { TYPE_STRING, &ldi.basepath, "basepath" }, { TYPE_STRING, &ldi.fullpath, "fullpath" }, @@ -2333,6 +2342,10 @@ static void setTreeInfoToDefaults(TreeInfo *ti, int type) ti->author = getStringCopy(ANONYMOUS_NAME); ti->year = NULL; + ti->program_title = NULL; + ti->program_copyright = NULL; + ti->program_company = NULL; + ti->sort_priority = LEVELCLASS_UNDEFINED; /* default: least priority */ ti->latest_engine = FALSE; /* default: get from level */ ti->parent_link = FALSE; @@ -2406,6 +2419,10 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent) ti->author = getStringCopy(parent->author); ti->year = getStringCopy(parent->year); + ti->program_title = getStringCopy(parent->program_title); + ti->program_copyright = getStringCopy(parent->program_copyright); + ti->program_company = getStringCopy(parent->program_company); + ti->sort_priority = parent->sort_priority; ti->latest_engine = parent->latest_engine; ti->parent_link = FALSE; @@ -2471,6 +2488,11 @@ static TreeInfo *getTreeInfoCopy(TreeInfo *ti) ti_copy->name_sorting = getStringCopy(ti->name_sorting); ti_copy->author = getStringCopy(ti->author); ti_copy->year = getStringCopy(ti->year); + + ti_copy->program_title = getStringCopy(ti->program_title); + ti_copy->program_copyright = getStringCopy(ti->program_copyright); + ti_copy->program_company = getStringCopy(ti->program_company); + ti_copy->imported_from = getStringCopy(ti->imported_from); ti_copy->imported_by = getStringCopy(ti->imported_by); ti_copy->tested_by = getStringCopy(ti->tested_by); @@ -2528,6 +2550,10 @@ void freeTreeInfo(TreeInfo *ti) checked_free(ti->author); checked_free(ti->year); + checked_free(ti->program_title); + checked_free(ti->program_copyright); + checked_free(ti->program_company); + checked_free(ti->class_desc); checked_free(ti->infotext); @@ -3620,6 +3646,14 @@ char *getArtworkIdentifierForUserLevelSet(int type) classic_artwork_set); } +TreeInfo *getArtworkTreeInfoForUserLevelSet(int type) +{ + char *artwork_set = getArtworkIdentifierForUserLevelSet(type); + TreeInfo *artwork_first_node = ARTWORK_FIRST_NODE(artwork, type); + + return getTreeInfoFromIdentifier(artwork_first_node, artwork_set); +} + boolean checkIfCustomArtworkExistsForCurrentLevelSet() { char *graphics_set = diff --git a/src/libgame/setup.h b/src/libgame/setup.h index fab96438..ff12637a 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -314,6 +314,7 @@ void LoadArtworkInfo(void); void LoadLevelArtworkInfo(void); char *getArtworkIdentifierForUserLevelSet(int); +TreeInfo *getArtworkTreeInfoForUserLevelSet(int); boolean checkIfCustomArtworkExistsForCurrentLevelSet(); void AddUserLevelSetToLevelInfo(char *); boolean UpdateUserLevelSet(char *, char *, char *, int); diff --git a/src/libgame/system.h b/src/libgame/system.h index 7f6f17ca..d11f71b4 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1200,6 +1200,11 @@ struct TreeInfo 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 *program_title; /* optional alternative text for program title */ + char *program_copyright; /* optional alternative text for program copyright */ + char *program_company; /* optional alternative text for program company */ + 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 */ diff --git a/src/screens.c b/src/screens.c index 58a2ecba..8c8119d6 100644 --- a/src/screens.c +++ b/src/screens.c @@ -581,6 +581,9 @@ 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 = NULL; +static char *main_text_title_2 = NULL; +static char *main_text_title_3 = NULL; struct MainControlInfo { @@ -730,19 +733,19 @@ static struct MainControlInfo main_controls[] = { MAIN_CONTROL_TITLE_1, NULL, -1, - &menu.main.text.title_1, &setup.internal.program_title, + &menu.main.text.title_1, &main_text_title_1, NULL, NULL, }, { MAIN_CONTROL_TITLE_2, NULL, -1, - &menu.main.text.title_2, &setup.internal.program_copyright, + &menu.main.text.title_2, &main_text_title_2, NULL, NULL, }, { MAIN_CONTROL_TITLE_3, NULL, -1, - &menu.main.text.title_3, &setup.internal.program_company, + &menu.main.text.title_3, &main_text_title_3, NULL, NULL, }, @@ -996,6 +999,8 @@ static boolean visibleTextPos(struct TextPosInfo *pos) static void InitializeMainControls() { + TreeInfo *graphics_current = + getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS); boolean local_team_mode = (!options.network && setup.team_mode); int i; @@ -1014,6 +1019,22 @@ static void InitializeMainControls() main_text_level_imported_by = leveldir_current->imported_by; main_text_level_tested_by = leveldir_current->tested_by; + main_text_title_1 = (leveldir_current->program_title ? + leveldir_current->program_title : + graphics_current->program_title ? + graphics_current->program_title : + setup.internal.program_title); + main_text_title_2 = (leveldir_current->program_copyright ? + leveldir_current->program_copyright : + graphics_current->program_copyright ? + graphics_current->program_copyright : + setup.internal.program_copyright); + main_text_title_3 = (leveldir_current->program_company ? + leveldir_current->program_company : + graphics_current->program_company ? + graphics_current->program_company : + setup.internal.program_company); + /* set main control screen positions to dynamically determined values */ for (i = 0; main_controls[i].nr != -1; i++) {