From: Holger Schemel Date: Wed, 15 Apr 2015 07:26:04 +0000 (+0200) Subject: added option for window icon file to run-time special edition support X-Git-Tag: 4.0.0.0-rc1~215 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=9afa3bb01a86fb8640e763afb05b492619958b7f added option for window icon file to run-time special edition support --- diff --git a/ChangeLog b/ChangeLog index 9c67528f..4d7295a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2015-04-15 + * added option "program_icon_file" to run-time "special edition" support + 2015-04-14 * added run-time "special edition" support; this change is especially targeted to the "R'n'D jue" special edition diff --git a/src/files.c b/src/files.c index 62bab202..6382467a 100644 --- a/src/files.c +++ b/src/files.c @@ -8028,16 +8028,17 @@ void SaveScore(int nr) #define SETUP_TOKEN_INT_PROGRAM_WEBSITE 3 #define SETUP_TOKEN_INT_PROGRAM_COPYRIGHT 4 #define SETUP_TOKEN_INT_PROGRAM_COMPANY 5 -#define SETUP_TOKEN_INT_DEFAULT_GRAPHICS_SET 6 -#define SETUP_TOKEN_INT_DEFAULT_SOUNDS_SET 7 -#define SETUP_TOKEN_INT_DEFAULT_MUSIC_SET 8 -#define SETUP_TOKEN_INT_FALLBACK_GRAPHICS_FILE 9 -#define SETUP_TOKEN_INT_FALLBACK_SOUNDS_FILE 10 -#define SETUP_TOKEN_INT_FALLBACK_MUSIC_FILE 11 -#define SETUP_TOKEN_INT_DEFAULT_LEVEL_SERIES 12 -#define SETUP_TOKEN_INT_CHOOSE_FROM_TOP_LEVELDIR 13 - -#define NUM_INTERNAL_SETUP_TOKENS 14 +#define SETUP_TOKEN_INT_PROGRAM_ICON_FILE 6 +#define SETUP_TOKEN_INT_DEFAULT_GRAPHICS_SET 7 +#define SETUP_TOKEN_INT_DEFAULT_SOUNDS_SET 8 +#define SETUP_TOKEN_INT_DEFAULT_MUSIC_SET 9 +#define SETUP_TOKEN_INT_FALLBACK_GRAPHICS_FILE 10 +#define SETUP_TOKEN_INT_FALLBACK_SOUNDS_FILE 11 +#define SETUP_TOKEN_INT_FALLBACK_MUSIC_FILE 12 +#define SETUP_TOKEN_INT_DEFAULT_LEVEL_SERIES 13 +#define SETUP_TOKEN_INT_CHOOSE_FROM_TOP_LEVELDIR 14 + +#define NUM_INTERNAL_SETUP_TOKENS 15 /* options setup */ #define SETUP_TOKEN_OPTIONS_VERBOSE 0 @@ -8200,6 +8201,7 @@ static struct TokenInfo internal_setup_tokens[] = { TYPE_STRING, &sxi.program_website, "program_website" }, { TYPE_STRING, &sxi.program_copyright, "program_copyright" }, { TYPE_STRING, &sxi.program_company, "program_company" }, + { TYPE_STRING, &sxi.program_icon_file, "program_icon_file" }, { TYPE_STRING, &sxi.default_graphics_set, "default_graphics_set" }, { TYPE_STRING, &sxi.default_sounds_set, "default_sounds_set" }, { TYPE_STRING, &sxi.default_music_set, "default_music_set" }, @@ -8357,6 +8359,8 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->internal.program_copyright = getStringCopy(PROGRAM_COPYRIGHT_STRING); si->internal.program_company = getStringCopy(PROGRAM_COMPANY_STRING); + si->internal.program_icon_file = getStringCopy(PROGRAM_ICON_FILENAME); + si->internal.default_graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR); si->internal.default_sounds_set = getStringCopy(SND_CLASSIC_SUBDIR); si->internal.default_music_set = getStringCopy(MUS_CLASSIC_SUBDIR); diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 327d20b5..32635b53 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -454,7 +454,7 @@ void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window, /* !!! SDL2 can only set the window icon if the window already exists !!! */ /* set window icon */ - SDLSetWindowIcon(program.sdl_icon_filename); + SDLSetWindowIcon(program.icon_filename); /* set window and icon title */ #if defined(TARGET_SDL2) diff --git a/src/libgame/system.c b/src/libgame/system.c index 9a0bed5a..1088f17c 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -67,7 +67,7 @@ int FrameCounter = 0; void InitProgramInfo(char *argv0, char *config_filename, char *userdata_subdir, char *userdata_subdir_unix, char *program_title, char *icon_title, - char *sdl_icon_filename, char *cookie_prefix, + char *icon_filename, char *cookie_prefix, int program_version) { program.command_basepath = getBasePath(argv0); @@ -83,7 +83,7 @@ void InitProgramInfo(char *argv0, char *config_filename, program.window_title = "(undefined)"; program.icon_title = icon_title; - program.sdl_icon_filename = sdl_icon_filename; + program.icon_filename = icon_filename; program.cookie_prefix = cookie_prefix; diff --git a/src/libgame/system.h b/src/libgame/system.h index d0a22f24..b2840a24 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -673,7 +673,7 @@ struct ProgramInfo char *window_title; char *icon_title; - char *sdl_icon_filename; + char *icon_filename; char *cookie_prefix; @@ -945,6 +945,8 @@ struct SetupInternalInfo char *program_copyright; char *program_company; + char *program_icon_file; + char *default_graphics_set; char *default_sounds_set; char *default_music_set; diff --git a/src/main.c b/src/main.c index 1e912477..5bc7e681 100644 --- a/src/main.c +++ b/src/main.c @@ -5630,6 +5630,7 @@ static void InitProgramConfig(char *command_filename) char *command_basename = getBaseName(command_filename); char *config_filename = getProgramConfigFilename(command_filename); char *program_title = PROGRAM_TITLE_STRING; + char *program_icon_file = PROGRAM_ICON_FILENAME; char *userdata_subdir; char *userdata_subdir_unix; @@ -5642,6 +5643,11 @@ static void InitProgramConfig(char *command_filename) strlen(setup.internal.program_title) > 0) program_title = getStringCopy(setup.internal.program_title); + // set program icon file from potentially redefined program icon file + if (setup.internal.program_icon_file != NULL && + strlen(setup.internal.program_icon_file) > 0) + program_icon_file = getStringCopy(setup.internal.program_icon_file); + // strip trailing executable suffix from command basename if (strSuffix(command_basename, ".exe")) command_basename[strlen(command_basename) - 4] = '\0'; @@ -5662,7 +5668,7 @@ static void InitProgramConfig(char *command_filename) userdata_subdir_unix, program_title, program_title, - SDL_ICON_FILENAME, + program_icon_file, COOKIE_PREFIX, GAME_VERSION_ACTUAL); } diff --git a/src/main.h b/src/main.h index 5b919cd3..812f0951 100644 --- a/src/main.h +++ b/src/main.h @@ -1990,12 +1990,12 @@ #define PROGRAM_COPYRIGHT_STRING "Copyright \xa9""1995-2015 by Holger Schemel" #define PROGRAM_COMPANY_STRING "A Game by Artsoft Entertainment" +#define PROGRAM_ICON_FILENAME "RocksIcon32x32.png" + #define COOKIE_PREFIX "ROCKSNDIAMONDS" #define USERDATA_DIRECTORY_OTHER "userdata" -#define SDL_ICON_FILENAME "RocksIcon32x32.png" - /* file version numbers for resource files (levels, tapes, score, setup, etc.) ** currently supported/known file version numbers: ** 1.0 (old)