X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=e7cbd04a43af6d10c3515e66e5300a32469dd393;hp=e4b15279a401e5024b84b343b1fb16613e1f0f06;hb=f78f30b84a0345ea31b30c5bd95e338c9d9ebd4b;hpb=3282aa616432ea42399d4dc4ffe637c4406a71c4 diff --git a/src/init.c b/src/init.c index e4b15279..e7cbd04a 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,7 +156,7 @@ void InitGadgets() gadgets_initialized = TRUE; } -inline void InitElementSmallImagesScaledUp(int graphic) +inline static void InitElementSmallImagesScaledUp(int graphic) { struct GraphicInfo *g = &graphic_info[graphic]; @@ -221,6 +226,35 @@ void InitBitmapPointers() graphic_info[i].bitmap = graphic_info[i].bitmaps[IMG_BITMAP_STANDARD]; } +void InitImageTextures() +{ + int i, j, k; + + FreeAllImageTextures(); + + for (i = IMG_GLOBAL_BORDER_FIRST; i <= IMG_GLOBAL_BORDER_LAST; i++) + CreateImageTextures(i); + + for (i = 0; i < MAX_NUM_TOONS; i++) + CreateImageTextures(IMG_TOON_1 + i); + + for (i = 0; i < NUM_GLOBAL_ANIMS; i++) + { + for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++) + { + for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++) + { + int graphic = global_anim_info[i].graphic[j][k]; + + if (graphic == IMG_UNDEFINED) + continue; + + CreateImageTextures(graphic); + } + } + } +} + #if 1 /* !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! */ void SetBitmaps_EM(Bitmap **em_bitmap) @@ -500,6 +534,65 @@ void InitFontGraphicInfo() getFontBitmapID, getFontFromToken); } +void InitGlobalAnimGraphicInfo() +{ + struct PropertyMapping *property_mapping = getImageListPropertyMapping(); + int num_property_mappings = getImageListPropertyMappingSize(); + int i, j, k; + + if (graphic_info == NULL) /* still at startup phase */ + return; + + /* always start with reliable default values (no global animations) */ + for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++) + for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++) + for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++) + global_anim_info[i].graphic[j][k] = IMG_UNDEFINED; + + /* initialize global animation definitions from static configuration */ + for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++) + { + int j = GLOBAL_ANIM_ID_PART_BASE; + int k = GFX_SPECIAL_ARG_DEFAULT; + + global_anim_info[i].graphic[j][k] = IMG_GLOBAL_ANIM_1_GFX + i; + } + + /* initialize global animation definitions from dynamic configuration */ + for (i = 0; i < num_property_mappings; i++) + { + int anim_nr = property_mapping[i].base_index - MAX_NUM_ELEMENTS - NUM_FONTS; + int part_nr = property_mapping[i].ext1_index - ACTION_PART_1; + int special = property_mapping[i].ext3_index; + int graphic = property_mapping[i].artwork_index; + + if (anim_nr < 0 || anim_nr >= NUM_GLOBAL_ANIM_TOKENS) + continue; + + /* set animation part to base part, if not specified */ + if (!IS_GLOBAL_ANIM_PART(part_nr)) + part_nr = GLOBAL_ANIM_ID_PART_BASE; + + /* set animation screen to default, if not specified */ + if (!IS_SPECIAL_GFX_ARG(special)) + special = GFX_SPECIAL_ARG_DEFAULT; + + global_anim_info[anim_nr].graphic[part_nr][special] = graphic; + } + +#if 0 + printf("::: InitGlobalAnimGraphicInfo\n"); + + for (i = 0; i < NUM_GLOBAL_ANIMS; i++) + for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++) + for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++) + if (global_anim_info[i].graphic[j][k] != IMG_UNDEFINED && + graphic_info[global_anim_info[i].graphic[j][k]].bitmap != NULL) + printf("::: - anim %d, part %d, mode %d => %d\n", + i, j, k, global_anim_info[i].graphic[j][k]); +#endif +} + void InitElementGraphicInfo() { struct PropertyMapping *property_mapping = getImageListPropertyMapping(); @@ -1037,6 +1130,8 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->scale_up_factor = 1; /* default: no scaling up */ g->tile_size = TILESIZE; /* default: standard tile size */ g->clone_from = -1; /* do not use clone graphic */ + g->init_delay_fixed = 0; + g->init_delay_random = 0; g->anim_delay_fixed = 0; g->anim_delay_random = 0; g->post_delay_fixed = 0; @@ -1071,11 +1166,9 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->tile_size = TILESIZE; /* standard tile size */ #endif -#if 0 - // CHECK: when setting tile size, should this set width and height? + // when setting tile size, also set width and height accordingly g->width = g->tile_size; g->height = g->tile_size; -#endif } if (g->use_image_size) @@ -1244,7 +1337,11 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, if (parameter[GFX_ARG_BORDER_SIZE] != ARG_UNDEFINED_VALUE) g->border_size = parameter[GFX_ARG_BORDER_SIZE]; - /* this is only used for player "boring" and "sleeping" actions */ + /* used for global animations and player "boring" and "sleeping" actions */ + if (parameter[GFX_ARG_INIT_DELAY_FIXED] != ARG_UNDEFINED_VALUE) + g->init_delay_fixed = parameter[GFX_ARG_INIT_DELAY_FIXED]; + if (parameter[GFX_ARG_INIT_DELAY_RANDOM] != ARG_UNDEFINED_VALUE) + g->init_delay_random = parameter[GFX_ARG_INIT_DELAY_RANDOM]; if (parameter[GFX_ARG_ANIM_DELAY_FIXED] != ARG_UNDEFINED_VALUE) g->anim_delay_fixed = parameter[GFX_ARG_ANIM_DELAY_FIXED]; if (parameter[GFX_ARG_ANIM_DELAY_RANDOM] != ARG_UNDEFINED_VALUE) @@ -1254,9 +1351,15 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, if (parameter[GFX_ARG_POST_DELAY_RANDOM] != ARG_UNDEFINED_VALUE) g->post_delay_random = parameter[GFX_ARG_POST_DELAY_RANDOM]; - /* this is only used for toon animations */ - g->step_offset = parameter[GFX_ARG_STEP_OFFSET]; - g->step_delay = parameter[GFX_ARG_STEP_DELAY]; + /* used for toon animations and global animations */ + g->step_offset = parameter[GFX_ARG_STEP_OFFSET]; + g->step_xoffset = parameter[GFX_ARG_STEP_XOFFSET]; + g->step_yoffset = parameter[GFX_ARG_STEP_YOFFSET]; + g->step_delay = parameter[GFX_ARG_STEP_DELAY]; + g->direction = parameter[GFX_ARG_DIRECTION]; + g->position = parameter[GFX_ARG_POSITION]; + g->x = parameter[GFX_ARG_X]; // (may be uninitialized, + g->y = parameter[GFX_ARG_Y]; // unlike src_x and src_y) /* this is only used for drawing font characters */ g->draw_xoffset = parameter[GFX_ARG_DRAW_XOFFSET]; @@ -1265,6 +1368,9 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, /* this is only used for drawing envelope graphics */ g->draw_masked = parameter[GFX_ARG_DRAW_MASKED]; + /* used for toon animations and global animations */ + g->draw_order = parameter[GFX_ARG_DRAW_ORDER]; + /* optional graphic for cloning all graphics settings */ if (parameter[GFX_ARG_CLONE_FROM] != ARG_UNDEFINED_VALUE) g->clone_from = parameter[GFX_ARG_CLONE_FROM]; @@ -1369,6 +1475,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, @@ -1929,6 +2039,11 @@ static void ReinitializeGraphics() print_timestamp_time("InitBitmapPointers"); InitFontGraphicInfo(); /* initialize text drawing functions */ print_timestamp_time("InitFontGraphicInfo"); + InitGlobalAnimGraphicInfo(); /* initialize global animation config */ + print_timestamp_time("InitGlobalAnimGraphicInfo"); + + InitImageTextures(); /* create textures for certain images */ + print_timestamp_time("InitImageTextures"); InitGraphicInfo_EM(); /* graphic mapping for EM engine */ print_timestamp_time("InitGraphicInfo_EM"); @@ -1944,6 +2059,7 @@ static void ReinitializeGraphics() InitGadgets(); print_timestamp_time("InitGadgets"); InitToons(); + InitGlobalAnimations(); print_timestamp_time("InitToons"); InitDoors(); print_timestamp_time("InitDoors"); @@ -4549,8 +4665,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; @@ -4563,57 +4677,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(); @@ -4625,30 +4739,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); } @@ -4676,10 +4790,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 */ @@ -4734,6 +4854,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) @@ -4746,7 +4872,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); } @@ -4756,13 +4882,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); } @@ -4773,13 +4899,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); } } @@ -4799,7 +4925,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); } @@ -4807,14 +4933,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); @@ -4884,7 +5010,9 @@ static char *get_level_id_suffix(int id_nr) static void InitArtworkConfig() { - static char *image_id_prefix[MAX_NUM_ELEMENTS + NUM_FONTS + 1]; + static char *image_id_prefix[MAX_NUM_ELEMENTS + + NUM_FONTS + + NUM_GLOBAL_ANIM_TOKENS + 1]; static char *sound_id_prefix[2 * MAX_NUM_ELEMENTS + 1]; static char *music_id_prefix[NUM_MUSIC_PREFIXES + 1]; static char *action_id_suffix[NUM_ACTIONS + 1]; @@ -4945,7 +5073,10 @@ static void InitArtworkConfig() image_id_prefix[i] = element_info[i].token_name; for (i = 0; i < NUM_FONTS; i++) image_id_prefix[MAX_NUM_ELEMENTS + i] = font_info[i].token_name; - image_id_prefix[MAX_NUM_ELEMENTS + NUM_FONTS] = NULL; + for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++) + image_id_prefix[MAX_NUM_ELEMENTS + NUM_FONTS + i] = + global_anim_info[i].token_name; + image_id_prefix[MAX_NUM_ELEMENTS + NUM_FONTS + NUM_GLOBAL_ANIM_TOKENS] = NULL; for (i = 0; i < MAX_NUM_ELEMENTS; i++) sound_id_prefix[i] = element_info[i].token_name; @@ -4994,9 +5125,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); @@ -5069,6 +5212,7 @@ void InitGfx() InitGfxBuffers(); InitGfxCustomArtworkInfo(); + InitGfxOtherSettings(); bitmap_font_initial = LoadCustomImage(filename_font_initial); @@ -5080,52 +5224,79 @@ void InitGfx() font_height = getFontHeight(FC_RED); DrawInitText(getProgramInitString(), 20, FC_YELLOW); - DrawInitText(PROGRAM_COPYRIGHT_STRING, 50, FC_RED); - DrawInitText(PROGRAM_WEBSITE_STRING, WIN_YSIZE - 20 - font_height, FC_RED); + DrawInitText(setup.internal.program_copyright, 50, FC_RED); + DrawInitText(setup.internal.program_website, WIN_YSIZE - 20 - font_height, + FC_RED); 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); @@ -5136,6 +5307,8 @@ void InitGfx() 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.bitmaps); @@ -5146,33 +5319,22 @@ void InitGfx() init.busy.height = anim_initial.height; InitMenuDesignSettings_Static(); + InitGfxDrawBusyAnimFunction(DrawInitAnim); + InitGfxDrawGlobalAnimFunction(DrawGlobalAnim); + InitGfxDrawGlobalBorderFunction(DrawMaskedBorderToScreen); /* use copy of busy animation to prevent change while reloading artwork */ 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; } @@ -5181,6 +5343,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() @@ -5569,7 +5740,7 @@ void ReloadCustomArtwork(int force_reload) FadeOut(REDRAW_ALL); - RedrawBackground(); + RedrawGlobalBorder(); /* force redraw of (open or closed) door graphics */ SetDoorState(DOOR_OPEN_ALL); @@ -5630,7 +5801,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); @@ -5666,6 +5837,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); @@ -5680,10 +5855,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();