+ for (i = 0; i < NUM_INITIAL_IMAGES; i++)
+ {
+ if (filename_image_initial[i] == NULL)
+ {
+ int len_token = strlen(image_token[i]);
+
+ // read settings for initial images from static default artwork config
+ for (j = 0; image_config[j].token != NULL; j++)
+ {
+ if (strEqual(image_config[j].token, image_token[i]))
+ {
+ filename_image_initial[i] = getStringCopy(image_config[j].value);
+ }
+ else if (strlen(image_config[j].token) > len_token &&
+ strncmp(image_config[j].token, image_token[i], len_token) == 0)
+ {
+ for (k = 0; image_config_suffix[k].token != NULL; k++)
+ {
+ if (strEqual(&image_config[j].token[len_token],
+ image_config_suffix[k].token))
+ parameter[i][k] =
+ get_graphic_parameter_value(image_config[j].value,
+ image_config_suffix[k].token,
+ image_config_suffix[k].type);
+ }
+ }
+ }
+ }
+ }
+
+ for (i = 0; i < NUM_INITIAL_IMAGES; i++)
+ {
+ if (filename_image_initial[i] == NULL) // should not happen
+ Fail("cannot get filename for '%s'", image_token[i]);
+
+ image_initial[i].bitmaps =
+ checked_calloc(sizeof(Bitmap *) * NUM_IMG_BITMAP_POINTERS);
+
+ if (!strEqual(filename_image_initial[i], UNDEFINED_FILENAME))
+ image_initial[i].bitmaps[IMG_BITMAP_STANDARD] =
+ LoadCustomImage(filename_image_initial[i]);
+
+ checked_free(filename_image_initial[i]);
+ }
+
+ for (i = 0; i < NUM_INITIAL_IMAGES; i++)
+ image_initial[i].use_image_size = TRUE;
+
+ graphic_info = image_initial; // graphic == 0 => image_initial
+
+ for (i = 0; i < NUM_INITIAL_IMAGES; i++)
+ set_graphic_parameters_ext(i, parameter[i], image_initial[i].bitmaps);
+
+ graphic_info = graphic_info_last;
+
+ for (i = 0; i < NUM_INITIAL_IMAGES_BUSY; i++)
+ {
+ // set image size for busy animations
+ init_busy[i]->width = image_initial[i].width;
+ init_busy[i]->height = image_initial[i].height;
+ }
+
+ SetLoadingBackgroundImage();
+
+ ClearRectangleOnBackground(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
+
+ DrawProgramInfo();
+
+ InitGfxDrawBusyAnimFunction(DrawInitAnim);
+ InitGfxDrawGlobalAnimFunction(DrawGlobalAnimations);
+ InitGfxDrawGlobalBorderFunction(DrawMaskedBorderToTarget);
+ InitGfxDrawTileCursorFunction(DrawTileCursor);
+ InitGfxDrawEnvelopeRequestFunction(DrawEnvelopeRequestToScreen);
+
+ gfx.fade_border_source_status = global.border_status;
+ gfx.fade_border_target_status = global.border_status;
+ gfx.masked_border_bitmap_ptr = backbuffer;
+
+ // use copy of busy animation to prevent change while reloading artwork
+ init_last = init;
+}
+
+static void InitGfxBackground(void)
+{
+ fieldbuffer = bitmap_db_field;
+ SetDrawtoField(DRAW_TO_BACKBUFFER);
+
+ ClearRectangle(backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE);
+
+ redraw_mask = REDRAW_ALL;
+}
+
+static void InitSnd(void)
+{
+ InitSoundSettings_Static();
+
+ // read settings for initial sounds from default custom artwork config
+ char *snd_config_filename = getPath3(options.sounds_directory,
+ SND_DEFAULT_SUBDIR,
+ SOUNDSINFO_FILENAME);
+
+ if (fileExists(snd_config_filename))
+ {
+ SetupFileHash *setup_file_hash = loadSetupFileHash(snd_config_filename);
+
+ if (setup_file_hash)
+ {
+ // read values from custom sounds config file
+ InitSoundSettings_FromHash(setup_file_hash, FALSE);
+
+ freeSetupFileHash(setup_file_hash);
+ }
+ }
+}
+
+static void InitLevelInfo(void)
+{
+ LoadLevelInfo(); // global level info
+ LoadLevelSetup_LastSeries(); // last played series info
+ LoadLevelSetup_SeriesInfo(); // last played level info
+
+ if (global.autoplay_leveldir &&
+ global.autoplay_mode != AUTOPLAY_MODE_TEST)
+ {
+ leveldir_current = getTreeInfoFromIdentifier(leveldir_first,
+ global.autoplay_leveldir);
+ if (leveldir_current == NULL)
+ leveldir_current = getFirstValidTreeInfoEntry(leveldir_first);
+ }
+
+ SetLevelSetInfo(leveldir_current->identifier, level_nr);
+}
+
+static void InitLevelArtworkInfo(void)
+{
+ LoadLevelArtworkInfo();
+}
+
+static void InitImages(void)
+{
+ print_timestamp_init("InitImages");
+
+#if 0
+ Debug("init:InitImages", "leveldir_current->identifier == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier);
+ Debug("init:InitImages", "leveldir_current->graphics_path == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path);
+ Debug("init:InitImages", "leveldir_current->graphics_set == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set);
+ Debug("init:InitImages", "getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'",
+ leveldir_current == NULL ? "[NULL]" : LEVELDIR_ARTWORK_SET(leveldir_current, ARTWORK_TYPE_GRAPHICS));
+#endif
+
+ setLevelArtworkDir(artwork.gfx_first);
+
+#if 0
+ Debug("init:InitImages", "leveldir_current->identifier == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier);
+ Debug("init:InitImages", "leveldir_current->graphics_path == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path);
+ Debug("init:InitImages", "leveldir_current->graphics_set == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set);
+ Debug("init:InitImages", "getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'",
+ leveldir_current == NULL ? "[NULL]" : LEVELDIR_ARTWORK_SET(leveldir_current, ARTWORK_TYPE_GRAPHICS));
+#endif
+
+#if 0
+ Debug("init:InitImages", "InitImages for '%s' ['%s', '%s'] ['%s', '%s']",
+ leveldir_current->identifier,
+ artwork.gfx_current_identifier,
+ artwork.gfx_current->identifier,
+ leveldir_current->graphics_set,
+ leveldir_current->graphics_path);
+#endif
+
+ UPDATE_BUSY_STATE();
+
+ ReloadCustomImages();
+ print_timestamp_time("ReloadCustomImages");
+
+ UPDATE_BUSY_STATE();
+
+ LoadCustomElementDescriptions();
+ print_timestamp_time("LoadCustomElementDescriptions");
+
+ UPDATE_BUSY_STATE();
+
+ LoadMenuDesignSettings();
+ print_timestamp_time("LoadMenuDesignSettings");
+
+ UPDATE_BUSY_STATE();