X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=3a2ccca2a197faf55d116d37b1dcff09bd548ce3;hp=83d01ab6d529d75b9c80edfc4de8c0ca7d07a63f;hb=7ecbe0a730dc19d8a46ffe6bbcb052f20d0c4152;hpb=d225818b7c89b2b60e52ac228e47ce303b5d8ef8 diff --git a/src/init.c b/src/init.c index 83d01ab6..3a2ccca2 100644 --- a/src/init.c +++ b/src/init.c @@ -102,6 +102,11 @@ void DrawInitAnim() if (!DelayReached(&action_delay, action_delay_value)) return; + if (init_last.busy.x == -1) + init_last.busy.x = WIN_XSIZE / 2; + if (init_last.busy.y == -1) + init_last.busy.y = WIN_YSIZE / 2; + x = ALIGNED_TEXT_XPOS(&init_last.busy); y = ALIGNED_TEXT_YPOS(&init_last.busy); @@ -151,10 +156,12 @@ void InitGadgets() gadgets_initialized = TRUE; } -inline void InitElementSmallImagesScaledUp(int graphic) +inline static void InitElementSmallImagesScaledUp(int graphic) { - CreateImageWithSmallImages(graphic, graphic_info[graphic].scale_up_factor, - graphic_info[graphic].tile_size); + struct GraphicInfo *g = &graphic_info[graphic]; + + // create small and game tile sized bitmaps (and scale up, if needed) + CreateImageWithSmallImages(graphic, g->scale_up_factor, g->tile_size); } void InitElementSmallImages() @@ -208,6 +215,17 @@ void InitScaledImages() ScaleImage(i, graphic_info[i].scale_up_factor); } +void InitBitmapPointers() +{ + int num_images = getImageListSize(); + int i; + + // standard size bitmap may have changed -- update default bitmap pointer + for (i = 0; i < num_images; i++) + if (graphic_info[i].bitmaps) + graphic_info[i].bitmap = graphic_info[i].bitmaps[IMG_BITMAP_STANDARD]; +} + #if 1 /* !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! */ void SetBitmaps_EM(Bitmap **em_bitmap) @@ -947,13 +965,36 @@ static int get_graphic_parameter_value(char *value_raw, char *suffix, int type) { char *value = getHashEntry(element_token_hash, value_raw); + if (value == NULL) + { + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "warning: error found in config file:"); + Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename()); + Error(ERR_INFO, "error: invalid element token '%s'", value_raw); + Error(ERR_INFO, "custom graphic rejected for this element/action"); + Error(ERR_INFO, "fallback done to undefined element for this graphic"); + Error(ERR_INFO_LINE, "-"); + } + return (value != NULL ? atoi(value) : EL_UNDEFINED); } else if (type == TYPE_GRAPHIC) { char *value = getHashEntry(graphic_token_hash, value_raw); + int fallback_graphic = IMG_CHAR_EXCLAM; + + if (value == NULL) + { + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "warning: error found in config file:"); + Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename()); + Error(ERR_INFO, "error: invalid graphic token '%s'", value_raw); + Error(ERR_INFO, "custom graphic rejected for this element/action"); + Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic"); + Error(ERR_INFO_LINE, "-"); + } - return (value != NULL ? atoi(value) : IMG_UNDEFINED); + return (value != NULL ? atoi(value) : fallback_graphic); } return -1; @@ -976,9 +1017,10 @@ static int get_scaled_graphic_height(int graphic) } static void set_graphic_parameters_ext(int graphic, int *parameter, - Bitmap *src_bitmap) + Bitmap **src_bitmaps) { struct GraphicInfo *g = &graphic_info[graphic]; + Bitmap *src_bitmap = (src_bitmaps ? src_bitmaps[IMG_BITMAP_STANDARD] : NULL); int anim_frames_per_row = 1, anim_frames_per_col = 1; int anim_frames_per_line = 1; @@ -1014,6 +1056,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->class = 0; g->style = STYLE_DEFAULT; + g->bitmaps = src_bitmaps; g->bitmap = src_bitmap; /* optional zoom factor for scaling up the image to a larger size */ @@ -1047,11 +1090,17 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->height = get_scaled_graphic_height(graphic); } + /* optional width and height of each animation frame */ + if (parameter[GFX_ARG_WIDTH] != ARG_UNDEFINED_VALUE) + g->width = parameter[GFX_ARG_WIDTH]; + if (parameter[GFX_ARG_HEIGHT] != ARG_UNDEFINED_VALUE) + g->height = parameter[GFX_ARG_HEIGHT]; + /* optional x and y tile position of animation frame sequence */ if (parameter[GFX_ARG_XPOS] != ARG_UNDEFINED_VALUE) - g->src_x = parameter[GFX_ARG_XPOS] * TILEX; + g->src_x = parameter[GFX_ARG_XPOS] * g->width; if (parameter[GFX_ARG_YPOS] != ARG_UNDEFINED_VALUE) - g->src_y = parameter[GFX_ARG_YPOS] * TILEY; + g->src_y = parameter[GFX_ARG_YPOS] * g->height; /* optional x and y pixel position of animation frame sequence */ if (parameter[GFX_ARG_X] != ARG_UNDEFINED_VALUE) @@ -1059,12 +1108,6 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, if (parameter[GFX_ARG_Y] != ARG_UNDEFINED_VALUE) g->src_y = parameter[GFX_ARG_Y]; - /* optional width and height of each animation frame */ - if (parameter[GFX_ARG_WIDTH] != ARG_UNDEFINED_VALUE) - g->width = parameter[GFX_ARG_WIDTH]; - if (parameter[GFX_ARG_HEIGHT] != ARG_UNDEFINED_VALUE) - g->height = parameter[GFX_ARG_HEIGHT]; - if (src_bitmap) { if (g->width <= 0) @@ -1263,7 +1306,7 @@ static void set_graphic_parameters(int graphic) { struct FileInfo *image = getImageListEntryFromImageID(graphic); char **parameter_raw = image->parameter; - Bitmap *src_bitmap = getBitmapFromImageID(graphic); + Bitmap **src_bitmaps = getBitmapsFromImageID(graphic); int parameter[NUM_GFX_ARGS]; int i; @@ -1277,7 +1320,7 @@ static void set_graphic_parameters(int graphic) image_config_suffix[i].token, image_config_suffix[i].type); - set_graphic_parameters_ext(graphic, parameter, src_bitmap); + set_graphic_parameters_ext(graphic, parameter, src_bitmaps); UPDATE_BUSY_STATE(); } @@ -1307,7 +1350,7 @@ static void set_cloned_graphic_parameters(int graphic) Error(ERR_INFO, "custom graphic rejected for this element/action"); if (graphic == fallback_graphic) - Error(ERR_EXIT, "fatal error: no fallback graphic available"); + Error(ERR_EXIT, "no fallback graphic available"); Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic"); Error(ERR_INFO_LINE, "-"); @@ -1331,6 +1374,10 @@ static void InitGraphicInfo() static int full_size_graphics[] = { IMG_GLOBAL_BORDER, + IMG_GLOBAL_BORDER_MAIN, + IMG_GLOBAL_BORDER_SCORES, + IMG_GLOBAL_BORDER_EDITOR, + IMG_GLOBAL_BORDER_PLAYING, IMG_GLOBAL_DOOR, IMG_BACKGROUND_ENVELOPE_1, @@ -1453,7 +1500,7 @@ static void InitGraphicInfo() Error(ERR_INFO, "custom graphic rejected for this element/action"); if (i == fallback_graphic) - Error(ERR_EXIT, "fatal error: no fallback graphic available"); + Error(ERR_EXIT, "no fallback graphic available"); Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic"); Error(ERR_INFO_LINE, "-"); @@ -1482,7 +1529,7 @@ static void InitGraphicInfo() Error(ERR_INFO, "custom graphic rejected for this element/action"); if (i == fallback_graphic) - Error(ERR_EXIT, "fatal error: no fallback graphic available"); + Error(ERR_EXIT, "no fallback graphic available"); Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic"); Error(ERR_INFO_LINE, "-"); @@ -1887,6 +1934,8 @@ static void ReinitializeGraphics() print_timestamp_time("InitElementSmallImages"); InitScaledImages(); /* scale all other images, if needed */ print_timestamp_time("InitScaledImages"); + InitBitmapPointers(); /* set standard size bitmap pointers */ + print_timestamp_time("InitBitmapPointers"); InitFontGraphicInfo(); /* initialize text drawing functions */ print_timestamp_time("InitFontGraphicInfo"); @@ -4438,6 +4487,33 @@ static void InitGlobal() font_info[i].token_name, int2str(i, 0)); + /* set default filenames for all cloned graphics in static configuration */ + for (i = 0; image_config[i].token != NULL; i++) + { + if (strEqual(image_config[i].value, UNDEFINED_FILENAME)) + { + char *token = image_config[i].token; + char *token_clone_from = getStringCat2(token, ".clone_from"); + char *token_cloned = getHashEntry(image_config_hash, token_clone_from); + + if (token_cloned != NULL) + { + char *value_cloned = getHashEntry(image_config_hash, token_cloned); + + if (value_cloned != NULL) + { + /* set default filename in static configuration */ + image_config[i].value = value_cloned; + + /* set default filename in image config hash */ + setHashEntry(image_config_hash, token, value_cloned); + } + } + + free(token_clone_from); + } + } + /* always start with reliable default values (all elements) */ for (i = 0; i < MAX_NUM_ELEMENTS; i++) ActiveElement[i] = i; @@ -4482,8 +4558,6 @@ static void InitGlobal() global.create_images_dir = NULL; global.frames_per_second = 0; - global.fps_slowdown = FALSE; - global.fps_slowdown_factor = 1; global.border_status = GAME_MODE_MAIN; @@ -4496,57 +4570,57 @@ void Execute_Command(char *command) if (strEqual(command, "print graphicsinfo.conf")) { - printf("# You can configure additional/alternative image files here.\n"); - printf("# (The entries below are default and therefore commented out.)\n"); - printf("\n"); - printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics")); - printf("\n"); - printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); - printf("\n"); + Print("# You can configure additional/alternative image files here.\n"); + Print("# (The entries below are default and therefore commented out.)\n"); + Print("\n"); + Print("%s\n", getFormattedSetupEntry("name", "Classic Graphics")); + Print("\n"); + Print("%s\n", getFormattedSetupEntry("sort_priority", "100")); + Print("\n"); for (i = 0; image_config[i].token != NULL; i++) - printf("# %s\n", getFormattedSetupEntry(image_config[i].token, - image_config[i].value)); + Print("# %s\n", getFormattedSetupEntry(image_config[i].token, + image_config[i].value)); exit(0); } else if (strEqual(command, "print soundsinfo.conf")) { - printf("# You can configure additional/alternative sound files here.\n"); - printf("# (The entries below are default and therefore commented out.)\n"); - printf("\n"); - printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds")); - printf("\n"); - printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); - printf("\n"); + Print("# You can configure additional/alternative sound files here.\n"); + Print("# (The entries below are default and therefore commented out.)\n"); + Print("\n"); + Print("%s\n", getFormattedSetupEntry("name", "Classic Sounds")); + Print("\n"); + Print("%s\n", getFormattedSetupEntry("sort_priority", "100")); + Print("\n"); for (i = 0; sound_config[i].token != NULL; i++) - printf("# %s\n", getFormattedSetupEntry(sound_config[i].token, - sound_config[i].value)); + Print("# %s\n", getFormattedSetupEntry(sound_config[i].token, + sound_config[i].value)); exit(0); } else if (strEqual(command, "print musicinfo.conf")) { - printf("# You can configure additional/alternative music files here.\n"); - printf("# (The entries below are default and therefore commented out.)\n"); - printf("\n"); - printf("%s\n", getFormattedSetupEntry("name", "Classic Music")); - printf("\n"); - printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); - printf("\n"); + Print("# You can configure additional/alternative music files here.\n"); + Print("# (The entries below are default and therefore commented out.)\n"); + Print("\n"); + Print("%s\n", getFormattedSetupEntry("name", "Classic Music")); + Print("\n"); + Print("%s\n", getFormattedSetupEntry("sort_priority", "100")); + Print("\n"); for (i = 0; music_config[i].token != NULL; i++) - printf("# %s\n", getFormattedSetupEntry(music_config[i].token, - music_config[i].value)); + Print("# %s\n", getFormattedSetupEntry(music_config[i].token, + music_config[i].value)); exit(0); } else if (strEqual(command, "print editorsetup.conf")) { - printf("# You can configure your personal editor element list here.\n"); - printf("# (The entries below are default and therefore commented out.)\n"); - printf("\n"); + Print("# You can configure your personal editor element list here.\n"); + Print("# (The entries below are default and therefore commented out.)\n"); + Print("\n"); /* this is needed to be able to check element list for cascade elements */ InitElementPropertiesStatic(); @@ -4558,30 +4632,30 @@ void Execute_Command(char *command) } else if (strEqual(command, "print helpanim.conf")) { - printf("# You can configure different element help animations here.\n"); - printf("# (The entries below are default and therefore commented out.)\n"); - printf("\n"); + Print("# You can configure different element help animations here.\n"); + Print("# (The entries below are default and therefore commented out.)\n"); + Print("\n"); for (i = 0; helpanim_config[i].token != NULL; i++) { - printf("# %s\n", getFormattedSetupEntry(helpanim_config[i].token, - helpanim_config[i].value)); + Print("# %s\n", getFormattedSetupEntry(helpanim_config[i].token, + helpanim_config[i].value)); if (strEqual(helpanim_config[i].token, "end")) - printf("#\n"); + Print("#\n"); } exit(0); } else if (strEqual(command, "print helptext.conf")) { - printf("# You can configure different element help text here.\n"); - printf("# (The entries below are default and therefore commented out.)\n"); - printf("\n"); + Print("# You can configure different element help text here.\n"); + Print("# (The entries below are default and therefore commented out.)\n"); + Print("\n"); for (i = 0; helptext_config[i].token != NULL; i++) - printf("# %s\n", getFormattedSetupEntry(helptext_config[i].token, - helptext_config[i].value)); + Print("# %s\n", getFormattedSetupEntry(helptext_config[i].token, + helptext_config[i].value)); exit(0); } @@ -4609,10 +4683,16 @@ void Execute_Command(char *command) exit(0); } - else if (strPrefix(command, "autoplay ")) + else if (strPrefix(command, "autotest ") || + strPrefix(command, "autoplay ") || + strPrefix(command, "autoffwd ")) { char *str_ptr = getStringCopy(&command[9]); /* read command parameters */ + global.autoplay_mode = (strPrefix(command, "autotest") ? AUTOPLAY_TEST : + strPrefix(command, "autoplay") ? AUTOPLAY_PLAY : + strPrefix(command, "autoffwd") ? AUTOPLAY_FFWD : 0); + while (*str_ptr != '\0') /* continue parsing string */ { /* cut leading whitespace from string, replace it by string terminator */ @@ -4667,6 +4747,12 @@ void Execute_Command(char *command) Error(ERR_EXIT, "image target directory '%s' not found or not writable", global.create_images_dir); } + else if (strPrefix(command, "create CE image ")) + { + CreateCustomElementImages(&command[16]); + + exit(0); + } #if DEBUG #if defined(TARGET_SDL2) @@ -4679,7 +4765,7 @@ void Execute_Command(char *command) // check if there are any displays available if (num_displays < 0) { - printf("No displays available: %s\n", SDL_GetError()); + Print("No displays available: %s\n", SDL_GetError()); exit(-1); } @@ -4689,13 +4775,13 @@ void Execute_Command(char *command) int num_modes = SDL_GetNumDisplayModes(i); int j; - printf("Available display modes for display %d:\n", i); + Print("Available display modes for display %d:\n", i); // check if there are any display modes available for this display if (num_modes < 0) { - printf("No display modes available for display %d: %s\n", - i, SDL_GetError()); + Print("No display modes available for display %d: %s\n", + i, SDL_GetError()); exit(-1); } @@ -4706,13 +4792,13 @@ void Execute_Command(char *command) if (SDL_GetDisplayMode(i, j, &mode) < 0) { - printf("Cannot get display mode %d for display %d: %s\n", - j, i, SDL_GetError()); + Print("Cannot get display mode %d for display %d: %s\n", + j, i, SDL_GetError()); exit(-1); } - printf("- %d x %d\n", mode.w, mode.h); + Print("- %d x %d\n", mode.w, mode.h); } } @@ -4732,7 +4818,7 @@ void Execute_Command(char *command) /* check if there are any modes available */ if (modes == NULL) { - printf("No modes available!\n"); + Print("No modes available!\n"); exit(-1); } @@ -4740,14 +4826,14 @@ void Execute_Command(char *command) /* check if our resolution is restricted */ if (modes == (SDL_Rect **)-1) { - printf("All resolutions available.\n"); + Print("All resolutions available.\n"); } else { - printf("Available display modes:\n"); + Print("Available display modes:\n"); for (i = 0; modes[i]; i++) - printf("- %d x %d\n", modes[i]->w, modes[i]->h); + Print("- %d x %d\n", modes[i]->w, modes[i]->h); } exit(0); @@ -4927,9 +5013,21 @@ static void InitMixer() void InitGfxBuffers() { + static int win_xsize_last = -1; + static int win_ysize_last = -1; + /* create additional image buffers for double-buffering and cross-fading */ - ReCreateBitmap(&bitmap_db_store, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); - ReCreateBitmap(&bitmap_db_cross, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + + if (WIN_XSIZE != win_xsize_last || WIN_YSIZE != win_ysize_last) + { + /* may contain content for cross-fading -- only re-create if changed */ + ReCreateBitmap(&bitmap_db_store, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + ReCreateBitmap(&bitmap_db_cross, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + + win_xsize_last = WIN_XSIZE; + win_ysize_last = WIN_YSIZE; + } + ReCreateBitmap(&bitmap_db_field, FXSIZE, FYSIZE, DEFAULT_DEPTH); ReCreateBitmap(&bitmap_db_panel, DXSIZE, DYSIZE, DEFAULT_DEPTH); ReCreateBitmap(&bitmap_db_door_1, 3 * DXSIZE, DYSIZE, DEFAULT_DEPTH); @@ -4947,6 +5045,9 @@ void InitGfxBuffers() InitGfxScrollbufferInfo(FXSIZE, FYSIZE); InitGfxClipRegion(FALSE, -1, -1, -1, -1); + /* required if door size definitions have changed */ + InitGraphicCompatibilityInfo_Doors(); + InitGfxBuffers_EM(); InitGfxBuffers_SP(); } @@ -4999,6 +5100,7 @@ void InitGfx() InitGfxBuffers(); InitGfxCustomArtworkInfo(); + InitGfxOtherSettings(); bitmap_font_initial = LoadCustomImage(filename_font_initial); @@ -5009,63 +5111,95 @@ void InitGfx() font_height = getFontHeight(FC_RED); - DrawInitTextAlways(getProgramInitString(), 20, FC_YELLOW); - DrawInitTextAlways(PROGRAM_COPYRIGHT_STRING, 50, FC_RED); - DrawInitTextAlways(PROGRAM_WEBSITE_STRING, WIN_YSIZE - 20 - font_height, - FC_RED); + DrawInitText(getProgramInitString(), 20, FC_YELLOW); + DrawInitText(setup.internal.program_copyright, 50, FC_RED); + DrawInitText(setup.internal.program_website, WIN_YSIZE - 20 - font_height, + FC_RED); - DrawInitTextAlways("Loading graphics", 120, FC_GREEN); + DrawInitText("Loading graphics", 120, FC_GREEN); - /* initialize busy animation with default values */ + /* initialize settings for busy animation with default values */ int parameter[NUM_GFX_ARGS]; for (i = 0; i < NUM_GFX_ARGS; i++) parameter[i] = get_graphic_parameter_value(image_config_suffix[i].value, image_config_suffix[i].token, image_config_suffix[i].type); - /* determine settings for busy animation (when displaying startup messages) */ - for (i = 0; image_config[i].token != NULL; i++) + char *anim_token = CONFIG_TOKEN_GLOBAL_BUSY; + int len_anim_token = strlen(anim_token); + + /* read settings for busy animation from default custom artwork config */ + char *gfx_config_filename = getPath3(options.graphics_directory, + GFX_DEFAULT_SUBDIR, + GRAPHICSINFO_FILENAME); + + if (fileExists(gfx_config_filename)) { - char *anim_token = CONFIG_TOKEN_GLOBAL_BUSY; - int len_anim_token = strlen(anim_token); + SetupFileHash *setup_file_hash = loadSetupFileHash(gfx_config_filename); - if (strEqual(image_config[i].token, anim_token)) - filename_anim_initial = image_config[i].value; - else if (strlen(image_config[i].token) > len_anim_token && - strncmp(image_config[i].token, anim_token, len_anim_token) == 0) + if (setup_file_hash) { - for (j = 0; image_config_suffix[j].token != NULL; j++) + char *filename = getHashEntry(setup_file_hash, anim_token); + + if (filename) { - if (strEqual(&image_config[i].token[len_anim_token], - image_config_suffix[j].token)) - parameter[j] = - get_graphic_parameter_value(image_config[i].value, - image_config_suffix[j].token, - image_config_suffix[j].type); + filename_anim_initial = getStringCopy(filename); + + for (j = 0; image_config_suffix[j].token != NULL; j++) + { + int type = image_config_suffix[j].type; + char *suffix = image_config_suffix[j].token; + char *token = getStringCat2(anim_token, suffix); + char *value = getHashEntry(setup_file_hash, token); + + checked_free(token); + + if (value) + parameter[j] = get_graphic_parameter_value(value, suffix, type); + } } + + freeSetupFileHash(setup_file_hash); } } -#if defined(CREATE_SPECIAL_EDITION_RND_JUE) - filename_anim_initial = "loading.pcx"; - - parameter[GFX_ARG_X] = 0; - parameter[GFX_ARG_Y] = 0; - parameter[GFX_ARG_WIDTH] = 128; - parameter[GFX_ARG_HEIGHT] = 40; - parameter[GFX_ARG_FRAMES] = 32; - parameter[GFX_ARG_DELAY] = 4; - parameter[GFX_ARG_FRAMES_PER_LINE] = ARG_UNDEFINED_VALUE; -#endif + if (filename_anim_initial == NULL) + { + /* read settings for busy animation from static default artwork config */ + for (i = 0; image_config[i].token != NULL; i++) + { + if (strEqual(image_config[i].token, anim_token)) + filename_anim_initial = getStringCopy(image_config[i].value); + else if (strlen(image_config[i].token) > len_anim_token && + strncmp(image_config[i].token, anim_token, len_anim_token) == 0) + { + for (j = 0; image_config_suffix[j].token != NULL; j++) + { + if (strEqual(&image_config[i].token[len_anim_token], + image_config_suffix[j].token)) + parameter[j] = + get_graphic_parameter_value(image_config[i].value, + image_config_suffix[j].token, + image_config_suffix[j].type); + } + } + } + } if (filename_anim_initial == NULL) /* should not happen */ Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_GLOBAL_BUSY); - anim_initial.bitmap = LoadCustomImage(filename_anim_initial); + anim_initial.bitmaps = + checked_calloc(sizeof(Bitmap *) * NUM_IMG_BITMAP_POINTERS); + + anim_initial.bitmaps[IMG_BITMAP_STANDARD] = + LoadCustomImage(filename_anim_initial); + + checked_free(filename_anim_initial); graphic_info = &anim_initial; /* graphic == 0 => anim_initial */ - set_graphic_parameters_ext(0, parameter, anim_initial.bitmap); + set_graphic_parameters_ext(0, parameter, anim_initial.bitmaps); graphic_info = graphic_info_last; @@ -5079,27 +5213,13 @@ void InitGfx() init_last = init; } -void RedrawBackground() -{ - BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer, - 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); - - redraw_mask = REDRAW_ALL; -} - void InitGfxBackground() { - int x, y; - fieldbuffer = bitmap_db_field; SetDrawtoField(DRAW_BACKBUFFER); ClearRectangle(backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE); - for (x = 0; x < MAX_BUF_XSIZE; x++) - for (y = 0; y < MAX_BUF_YSIZE; y++) - redraw[x][y] = 0; - redraw_tiles = 0; redraw_mask = REDRAW_ALL; } @@ -5108,6 +5228,15 @@ static void InitLevelInfo() LoadLevelInfo(); /* global level info */ LoadLevelSetup_LastSeries(); /* last played series info */ LoadLevelSetup_SeriesInfo(); /* last played level info */ + + if (global.autoplay_leveldir && + global.autoplay_mode != AUTOPLAY_TEST) + { + leveldir_current = getTreeInfoFromIdentifier(leveldir_first, + global.autoplay_leveldir); + if (leveldir_current == NULL) + leveldir_current = getFirstValidTreeInfoEntry(leveldir_first); + } } static void InitLevelArtworkInfo() @@ -5496,7 +5625,7 @@ void ReloadCustomArtwork(int force_reload) FadeOut(REDRAW_ALL); - RedrawBackground(); + RedrawGlobalBorder(); /* force redraw of (open or closed) door graphics */ SetDoorState(DOOR_OPEN_ALL); @@ -5557,7 +5686,7 @@ void DisplayExitMessage(char *format, va_list ap) sy += 3 * font_height; num_lines_printed = - DrawTextBuffer(sx, sy, program.error_filename, font_2, + DrawTextBuffer(sx, sy, program.log_filename[LOG_ERR_ID], font_2, line_length, line_length, max_lines, 0, BLIT_ON_BACKGROUND, TRUE, TRUE, FALSE); @@ -5565,6 +5694,9 @@ void DisplayExitMessage(char *format, va_list ap) redraw_mask = REDRAW_ALL; + /* force drawing exit message even if screen updates are currently limited */ + LimitScreenUpdates(FALSE); + BackToFront(); /* deactivate toons on error message screen */ @@ -5590,6 +5722,10 @@ void OpenAll() print_timestamp_time("[init global stuff]"); + InitSetup(); + + print_timestamp_time("[init setup/config stuff (1)]"); + if (options.execute_command) Execute_Command(options.execute_command); @@ -5604,10 +5740,6 @@ void OpenAll() exit(0); /* never reached, server loops forever */ } - InitSetup(); - - print_timestamp_time("[init setup/config stuff (1)]"); - InitGameInfo(); print_timestamp_time("[init setup/config stuff (2)]"); InitPlayerInfo();