X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=6605186c42351afa7c5ae78eb7a467834390361b;hb=c118d37bf6ad02e90d4ea7c4a4d7d34d8f745c26;hp=b2a6367623180705e8a5067c829d005f0b5f9e6d;hpb=1d7af05c874d80ee2102ce1420bc99c7c26cdbb5;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index b2a63676..6605186c 100644 --- a/src/init.c +++ b/src/init.c @@ -110,14 +110,14 @@ static int copy_properties[][5] = static int get_graphic_parameter_value(char *, char *, int); -static Bitmap *getLoadingBackgroundBitmap(int graphic) +static int getLoadingBackgroundImage(int graphic) { - return getBitmapFromGraphicOrDefault(graphic, INITIAL_IMG_BACKGROUND); + return getImageFromGraphicOrDefault(graphic, INITIAL_IMG_BACKGROUND); } static void SetLoadingWindowBackgroundImage(int graphic) { - SetWindowBackgroundBitmap(getLoadingBackgroundBitmap(graphic)); + SetBackgroundImage(getLoadingBackgroundImage(graphic), REDRAW_ALL); } static void SetLoadingBackgroundImage(void) @@ -381,7 +381,7 @@ void InitImageTextures(void) CreateImageTextures(texture_graphics[i]); } -static int getFontBitmapID(int font_nr) +static int getFontSpecialSuffix(void) { int special = -1; @@ -394,6 +394,13 @@ static int getFontBitmapID(int font_nr) else if (game_status == GAME_MODE_PSEUDO_TYPENAMES) special = GFX_SPECIAL_ARG_NAMES; + return special; +} + +static int getFontBitmapID(int font_nr) +{ + int special = getFontSpecialSuffix(); + if (special != -1) return font_info[font_nr].special_bitmap_id[special]; else @@ -411,6 +418,22 @@ static int getFontFromToken(char *token) return FONT_INITIAL_1; } +static char *getTokenFromFont(int font_nr) +{ + static char *token = NULL; + int special = getFontSpecialSuffix(); + + checked_free(token); + + if (special != -1) + token = getStringCat2(font_info[font_nr].token_name, + special_suffix_info[special].suffix); + else + token = getStringCopy(font_info[font_nr].token_name); + + return token; +} + static void InitFontGraphicInfo(void) { static struct FontBitmapInfo *font_bitmap_info = NULL; @@ -422,7 +445,7 @@ static void InitFontGraphicInfo(void) if (graphic_info == NULL) // still at startup phase { InitFontInfo(font_initial, NUM_INITIAL_FONTS, - getFontBitmapID, getFontFromToken); + getFontBitmapID, getFontFromToken, getTokenFromFont); return; } @@ -647,7 +670,7 @@ static void InitFontGraphicInfo(void) } InitFontInfo(font_bitmap_info, num_font_bitmaps, - getFontBitmapID, getFontFromToken); + getFontBitmapID, getFontFromToken, getTokenFromFont); } static void InitGlobalAnimGraphicInfo(void) @@ -1561,6 +1584,9 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, // animation synchronized with global frame counter, not move position g->anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC]; + // animation synchronized with global anim frame counter, not move position + g->anim_global_anim_sync = parameter[GFX_ARG_GLOBAL_ANIM_SYNC]; + // optional element for cloning crumble graphics if (parameter[GFX_ARG_CRUMBLED_LIKE] != ARG_UNDEFINED_VALUE) g->crumbled_like = parameter[GFX_ARG_CRUMBLED_LIKE]; @@ -1665,6 +1691,12 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->active_yoffset = parameter[GFX_ARG_ACTIVE_YOFFSET]; g->pressed_xoffset = parameter[GFX_ARG_PRESSED_XOFFSET]; g->pressed_yoffset = parameter[GFX_ARG_PRESSED_YOFFSET]; + + // this is only used for drawing stacked global animations + g->stacked_xfactor = parameter[GFX_ARG_STACKED_XFACTOR]; + g->stacked_yfactor = parameter[GFX_ARG_STACKED_YFACTOR]; + g->stacked_xoffset = parameter[GFX_ARG_STACKED_XOFFSET]; + g->stacked_yoffset = parameter[GFX_ARG_STACKED_YOFFSET]; } static void set_graphic_parameters(int graphic) @@ -2247,6 +2279,11 @@ static void InitSoundInfo(void) } set_sound_parameters(i, sound->parameter); + +#if 0 + Debug("init:InitSoundInfo", "loop mode: %d ['%s']", + sound_info[i].loop, sound->token); +#endif } free(sound_effect_properties); @@ -4237,6 +4274,7 @@ void InitElementPropertiesStatic(void) EL_BD_AMOEBA, EL_EMC_MAGIC_BALL, EL_EMC_ANDROID, + EL_MM_GRAY_BALL, -1 }; @@ -5438,6 +5476,12 @@ static void InitSetup(void) if (setup.options.verbose) options.verbose = TRUE; + if (setup.options.debug) + options.debug = TRUE; + + if (!strEqual(setup.options.debug_mode, ARG_UNDEFINED_STRING)) + options.debug_mode = getStringCopy(setup.options.debug_mode); + if (setup.debug.show_frames_per_second) global.show_frames_per_second = TRUE; } @@ -5651,7 +5695,6 @@ void InitGfxBuffers(void) } ReCreateBitmap(&bitmap_db_field, FXSIZE, FYSIZE); - ReCreateBitmap(&bitmap_db_panel, DXSIZE, DYSIZE); ReCreateBitmap(&bitmap_db_door_1, 3 * DXSIZE, DYSIZE); ReCreateBitmap(&bitmap_db_door_2, 3 * VXSIZE, VYSIZE); @@ -5979,17 +6022,14 @@ static void InitImages(void) print_timestamp_done("InitImages"); } -static void InitSound(char *identifier) +static void InitSound(void) { print_timestamp_init("InitSound"); - if (identifier == NULL) - identifier = artwork.snd_current->identifier; - // set artwork path to send it to the sound server process setLevelArtworkDir(artwork.snd_first); - InitReloadCustomSounds(identifier); + InitReloadCustomSounds(); print_timestamp_time("InitReloadCustomSounds"); ReinitializeSounds(); @@ -5998,17 +6038,14 @@ static void InitSound(char *identifier) print_timestamp_done("InitSound"); } -static void InitMusic(char *identifier) +static void InitMusic(void) { print_timestamp_init("InitMusic"); - if (identifier == NULL) - identifier = artwork.mus_current->identifier; - // set artwork path to send it to the sound server process setLevelArtworkDir(artwork.mus_first); - InitReloadCustomMusic(identifier); + InitReloadCustomMusic(); print_timestamp_time("InitReloadCustomMusic"); ReinitializeMusic(); @@ -6342,13 +6379,13 @@ void ReloadCustomArtwork(int force_reload) if (snd_new_identifier != NULL || force_reload_snd) { - InitSound(snd_new_identifier); + InitSound(); print_timestamp_time("InitSound"); } if (mus_new_identifier != NULL || force_reload_mus) { - InitMusic(mus_new_identifier); + InitMusic(); print_timestamp_time("InitMusic"); } @@ -6423,7 +6460,7 @@ void DisplayExitMessage(char *format, va_list ap) sy += 3 * font_height; num_lines_printed = - DrawTextBuffer(sx, sy, program.log_filename[LOG_ERR_ID], font_2, + DrawTextBuffer(sx, sy, program.log_filename, font_2, line_length, line_length, max_lines, 0, BLIT_ON_BACKGROUND, TRUE, TRUE, FALSE); @@ -6536,10 +6573,10 @@ void OpenAll(void) InitImages(); // needs to know current level directory print_timestamp_time("InitImages"); - InitSound(NULL); // needs to know current level directory + InitSound(); // needs to know current level directory print_timestamp_time("InitSound"); - InitMusic(NULL); // needs to know current level directory + InitMusic(); // needs to know current level directory print_timestamp_time("InitMusic"); InitArtworkDone();