From: Holger Schemel Date: Sun, 30 Apr 2006 13:07:57 +0000 (+0200) Subject: rnd-20060430-2-src X-Git-Tag: 3.2.0^2~27 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=94514e77176075d9f654599f4ff1c018d66b7c1e;p=rocksndiamonds.git rnd-20060430-2-src * fixed bug that forced re-defining menu settings in each config file * added the possibility to define up to five title screens for each level set that are displayed after loading using (cross)fading in/out (this was added to display the various start images of the EMC sets) --- diff --git a/ChangeLog b/ChangeLog index e3694fca..280d27d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-04-30 + * fixed bug that forced re-defining menu settings in each config file + +2006-04-29 + * added the possibility to define up to five title screens for each + level set that are displayed after loading using (cross)fading in/out + (this was added to display the various start images of the EMC sets) + 2006-04-28 * added "CE score gets zero [of]" to custom element trigger conditions * added setup option to display element token name in level editor diff --git a/src/conftime.h b/src/conftime.h index f421ea5d..0224c2c5 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-04-30 04:12]" +#define COMPILE_DATE_STRING "[2006-04-30 15:04]" diff --git a/src/files.c b/src/files.c index e6baec25..a762cdb9 100644 --- a/src/files.c +++ b/src/files.c @@ -5547,10 +5547,49 @@ void LoadCustomElementDescriptions() freeSetupFileHash(setup_file_hash); } -void LoadSpecialMenuDesignSettings() +static void LoadSpecialMenuDesignSettingsFromFilename(char *filename) { - char *filename = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS); SetupFileHash *setup_file_hash; + int i; + +#if 0 + printf("LoadSpecialMenuDesignSettings from file '%s' ...\n", filename); +#endif + + if ((setup_file_hash = loadSetupFileHash(filename)) == NULL) + return; + + /* special case: initialize with default values that may be overwritten */ + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) + { + char *value_x = getHashEntry(setup_file_hash, "menu.draw_xoffset"); + char *value_y = getHashEntry(setup_file_hash, "menu.draw_yoffset"); + char *list_size = getHashEntry(setup_file_hash, "menu.list_size"); + + if (value_x != NULL) + menu.draw_xoffset[i] = get_integer_from_string(value_x); + if (value_y != NULL) + menu.draw_yoffset[i] = get_integer_from_string(value_y); + if (list_size != NULL) + menu.list_size[i] = get_integer_from_string(list_size); + } + + /* read (and overwrite with) values that may be specified in config file */ + for (i = 0; image_config_vars[i].token != NULL; i++) + { + char *value = getHashEntry(setup_file_hash, image_config_vars[i].token); + + if (value != NULL) + *image_config_vars[i].value = + get_auto_parameter_value(image_config_vars[i].token, value); + } + + freeSetupFileHash(setup_file_hash); +} + +void LoadSpecialMenuDesignSettings_NEW() +{ + char *filename_base = UNDEFINED_FILENAME, *filename_local; int i, j; /* always start with reliable default values from default config */ @@ -5561,6 +5600,43 @@ void LoadSpecialMenuDesignSettings() get_auto_parameter_value(image_config_vars[i].token, image_config[j].value); +#if 0 + if (!SETUP_OVERRIDE_ARTWORK(setup, ARTWORK_TYPE_GRAPHICS)) + { + /* first look for special settings configured in level series config */ + filename_base = getCustomArtworkLevelConfigFilename(ARTWORK_TYPE_GRAPHICS); + + if (fileExists(filename_base)) + LoadSpecialMenuDesignSettingsFromFilename(filename_base); + } + + filename_local = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS); + + if (filename_local != NULL && !strEqual(filename_base, filename_local)) + LoadSpecialMenuDesignSettingsFromFilename(filename_local); + +#else + + filename_local = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS); + + LoadSpecialMenuDesignSettingsFromFilename(filename_local); +#endif +} + +void LoadSpecialMenuDesignSettings() +{ + char *filename = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS); + SetupFileHash *setup_file_hash; + int i, j; + + /* always start with reliable default values from default config */ + for (i = 0; image_config_vars[i].token != NULL; i++) + for (j = 0; image_config[j].token != NULL; j++) + if (strEqual(image_config_vars[i].token, image_config[j].token)) + *image_config_vars[i].value = + get_auto_parameter_value(image_config_vars[i].token, + image_config[j].value); + if ((setup_file_hash = loadSetupFileHash(filename)) == NULL) return; @@ -5586,7 +5662,7 @@ void LoadSpecialMenuDesignSettings() if (value != NULL) *image_config_vars[i].value = - get_auto_parameter_value(image_config_vars[i].token, value); + get_auto_parameter_value(image_config_vars[i].token, value); } freeSetupFileHash(setup_file_hash); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 154f8343..2cf6bd84 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2067,6 +2067,10 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, if (filename == NULL) return; +#if 0 + printf("LoadArtworkConfigFromFilename '%s' ...\n", filename); +#endif + if ((setup_file_hash = loadSetupFileHash(filename)) == NULL) return; @@ -2433,10 +2437,6 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) char *filename_base = UNDEFINED_FILENAME, *filename_local; int i, j; -#if 0 - printf("GOT CUSTOM ARTWORK CONFIG FILE '%s'\n", filename); -#endif - DrawInitText("Loading artwork config:", 120, FC_GREEN); DrawInitText(ARTWORKINFO_FILENAME(artwork_info->type), 150, FC_YELLOW); diff --git a/src/tools.c b/src/tools.c index 6f2c96e2..15338973 100644 --- a/src/tools.c +++ b/src/tools.c @@ -420,49 +420,59 @@ void FadeToFront() static void FadeExt(Bitmap *bitmap_cross, int fade_ms, int fade_mode) { + static boolean initialization_needed = TRUE; + static SDL_Surface *surface_screen_copy = NULL; + static SDL_Surface *surface_black = NULL; SDL_Surface *surface_screen = backbuffer->surface; - SDL_Surface *surface_screen_copy = NULL; - SDL_Surface *surface_black = NULL; SDL_Surface *surface_cross; /* initialized later */ boolean fade_reverse; /* initialized later */ - unsigned int flags = SDL_SRCALPHA; unsigned int time_last, time_current; float alpha; int alpha_final; - /* use same surface type as screen surface */ - if ((surface_screen->flags & SDL_HWSURFACE)) - flags |= SDL_HWSURFACE; - else - flags |= SDL_SWSURFACE; - - /* create surface for copy of screen buffer */ - if ((surface_screen_copy = - SDL_CreateRGBSurface(flags, - surface_screen->w, - surface_screen->h, - surface_screen->format->BitsPerPixel, - surface_screen->format->Rmask, - surface_screen->format->Gmask, - surface_screen->format->Bmask, - surface_screen->format->Amask)) == NULL) - Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError()); - - SDL_BlitSurface(surface_screen, NULL, surface_screen_copy, NULL); + if (initialization_needed) + { + unsigned int flags = SDL_SRCALPHA; - /* create black surface for fading from/to black */ - if ((surface_black = - SDL_CreateRGBSurface(flags, - surface_screen->w, - surface_screen->h, - surface_screen->format->BitsPerPixel, - surface_screen->format->Rmask, - surface_screen->format->Gmask, - surface_screen->format->Bmask, - surface_screen->format->Amask)) == NULL) - Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError()); + /* use same surface type as screen surface */ + if ((surface_screen->flags & SDL_HWSURFACE)) + flags |= SDL_HWSURFACE; + else + flags |= SDL_SWSURFACE; + + /* create surface for temporary copy of screen buffer */ + if ((surface_screen_copy = + SDL_CreateRGBSurface(flags, + surface_screen->w, + surface_screen->h, + surface_screen->format->BitsPerPixel, + surface_screen->format->Rmask, + surface_screen->format->Gmask, + surface_screen->format->Bmask, + surface_screen->format->Amask)) == NULL) + Error(ERR_EXIT, "SDL_CreateRGBSurface( ) failed: %s", SDL_GetError()); + + /* create black surface for fading from/to black */ + if ((surface_black = + SDL_CreateRGBSurface(flags, + surface_screen->w, + surface_screen->h, + surface_screen->format->BitsPerPixel, + surface_screen->format->Rmask, + surface_screen->format->Gmask, + surface_screen->format->Bmask, + surface_screen->format->Amask)) == NULL) + Error(ERR_EXIT, "SDL_CreateRGBSurface( ) failed: %s", SDL_GetError()); + + /* completely fill the surface with black color pixels */ + SDL_FillRect(surface_black, NULL, + SDL_MapRGB(surface_screen->format, 0, 0, 0)); + + initialization_needed = FALSE; + } - SDL_FillRect(surface_black, NULL, SDL_MapRGB(surface_screen->format, 0,0,0)); + /* copy the current screen backbuffer to the temporary screen copy buffer */ + SDL_BlitSurface(surface_screen, NULL, surface_screen_copy, NULL); fade_reverse = (fade_mode == FADE_MODE_FADE_IN ? TRUE : FALSE); surface_cross = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_cross->surface : @@ -489,9 +499,6 @@ static void FadeExt(Bitmap *bitmap_cross, int fade_ms, int fade_mode) SDL_Flip(surface_screen); } - SDL_FreeSurface(surface_screen_copy); - SDL_FreeSurface(surface_black); - redraw_mask = REDRAW_NONE; }