X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=45f08cd69aac51c75b34b248260252107111dc1f;hp=2a5807a4867de736dceaf9aece45f64b0be15eca;hb=14801844faf14be284c590b66f030c6bf7cea5c2;hpb=a6a203764b16840a0f5ae3d776f2d881f270d71b diff --git a/src/init.c b/src/init.c index 2a5807a4..45f08cd6 100644 --- a/src/init.c +++ b/src/init.c @@ -97,6 +97,9 @@ void DrawInitAnim() int sync_frame = FrameCounter; int x, y; + /* prevent OS (Windows) from complaining about program not responding */ + CheckQuitEvent(); + if (game_status != GAME_MODE_LOADING) return; @@ -548,6 +551,11 @@ void InitFontGraphicInfo() font_bitmap_info[font_bitmap_id].width = graphic_info[graphic].width; font_bitmap_info[font_bitmap_id].height = graphic_info[graphic].height; + font_bitmap_info[font_bitmap_id].offset_x = + graphic_info[graphic].offset_x; + font_bitmap_info[font_bitmap_id].offset_y = + graphic_info[graphic].offset_y; + font_bitmap_info[font_bitmap_id].draw_xoffset = graphic_info[graphic].draw_xoffset; font_bitmap_info[font_bitmap_id].draw_yoffset = @@ -1045,6 +1053,8 @@ void InitElementGraphicInfo() default_action_graphic = element_info[EL_SP_DEFAULT].graphic[act]; if (IS_SB_ELEMENT(i) && element_info[EL_SB_DEFAULT].graphic[act] != -1) default_action_graphic = element_info[EL_SB_DEFAULT].graphic[act]; + if (IS_MM_ELEMENT(i) && element_info[EL_MM_DEFAULT].graphic[act] != -1) + default_action_graphic = element_info[EL_MM_DEFAULT].graphic[act]; if (IS_BD_ELEMENT(i) && element_info[EL_BD_DEFAULT].crumbled[act] != -1) default_action_crumbled = element_info[EL_BD_DEFAULT].crumbled[act]; @@ -1052,6 +1062,8 @@ void InitElementGraphicInfo() default_action_crumbled = element_info[EL_SP_DEFAULT].crumbled[act]; if (IS_SB_ELEMENT(i) && element_info[EL_SB_DEFAULT].crumbled[act] != -1) default_action_crumbled = element_info[EL_SB_DEFAULT].crumbled[act]; + if (IS_MM_ELEMENT(i) && element_info[EL_MM_DEFAULT].crumbled[act] != -1) + default_action_crumbled = element_info[EL_MM_DEFAULT].crumbled[act]; /* !!! needed because EL_EMPTY_SPACE treated as IS_SP_ELEMENT !!! */ /* !!! make this better !!! */ @@ -1714,10 +1726,10 @@ static void InitGraphicInfo() for (i = 0; i < num_images; i++) { - Bitmap *src_bitmap; + Bitmap *src_bitmap = graphic_info[i].bitmap; int src_x, src_y; int width, height; - int first_frame, last_frame; + int last_frame; int src_bitmap_width, src_bitmap_height; /* now check if no animation frames are outside of the loaded image */ @@ -1735,9 +1747,7 @@ static void InitGraphicInfo() /* check if first animation frame is inside specified bitmap */ - first_frame = 0; - getFixedGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y); - + /* do not use getGraphicSourceXY() here to get position of first frame; */ /* this avoids calculating wrong start position for out-of-bounds frame */ src_x = graphic_info[i].src_x; src_y = graphic_info[i].src_y; @@ -1767,12 +1777,15 @@ static void InitGraphicInfo() Error(ERR_INFO_LINE, "-"); graphic_info[i] = graphic_info[fallback_graphic]; + + /* if first frame out of bounds, do not check last frame anymore */ + continue; } /* check if last animation frame is inside specified bitmap */ last_frame = graphic_info[i].anim_frames - 1; - getFixedGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y); + getGraphicSourceXY(i, last_frame, &src_x, &src_y, FALSE); if (src_x < 0 || src_y < 0 || src_x + width > src_bitmap_width || @@ -1923,6 +1936,8 @@ static void InitElementSoundInfo() default_action_sound = element_info[EL_SP_DEFAULT].sound[act]; if (IS_SB_ELEMENT(i) && element_info[EL_SB_DEFAULT].sound[act] != -1) default_action_sound = element_info[EL_SB_DEFAULT].sound[act]; + if (IS_MM_ELEMENT(i) && element_info[EL_MM_DEFAULT].sound[act] != -1) + default_action_sound = element_info[EL_MM_DEFAULT].sound[act]; /* !!! needed because EL_EMPTY_SPACE treated as IS_SP_ELEMENT !!! */ /* !!! make this better !!! */ @@ -4257,6 +4272,8 @@ void InitElementPropertiesStatic() EL_INTERNAL_CASCADE_SP_ACTIVE, EL_INTERNAL_CASCADE_DC_ACTIVE, EL_INTERNAL_CASCADE_DX_ACTIVE, + EL_INTERNAL_CASCADE_MM_ACTIVE, + EL_INTERNAL_CASCADE_DF_ACTIVE, EL_INTERNAL_CASCADE_CHARS_ACTIVE, EL_INTERNAL_CASCADE_STEEL_CHARS_ACTIVE, EL_INTERNAL_CASCADE_CE_ACTIVE, @@ -4278,6 +4295,8 @@ void InitElementPropertiesStatic() EL_INTERNAL_CASCADE_SP, EL_INTERNAL_CASCADE_DC, EL_INTERNAL_CASCADE_DX, + EL_INTERNAL_CASCADE_MM, + EL_INTERNAL_CASCADE_DF, EL_INTERNAL_CASCADE_CHARS, EL_INTERNAL_CASCADE_STEEL_CHARS, EL_INTERNAL_CASCADE_CE, @@ -4675,25 +4694,6 @@ void InitElementPropertiesEngine(int engine_version) InitElementGraphicInfo(); } -void InitElementPropertiesAfterLoading(int engine_version) -{ - int i; - - /* set some other uninitialized values of custom elements in older levels */ - if (engine_version < VERSION_IDENT(3,1,0,0)) - { - for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) - { - int element = EL_CUSTOM_START + i; - - element_info[element].access_direction = MV_ALL_DIRECTIONS; - - element_info[element].explosion_delay = 17; - element_info[element].ignition_delay = 8; - } - } -} - void InitElementPropertiesGfxElement() { int i; @@ -5050,6 +5050,7 @@ void Execute_Command(char *command) static void InitSetup() { LoadSetup(); /* global setup info */ + LoadSetup_AutoSetup(); /* global auto setup info */ /* set some options from setup file */ @@ -5063,6 +5064,7 @@ static void InitSetup() static void InitGameInfo() { game.restart_level = FALSE; + game.restart_game_message = NULL; } static void InitPlayerInfo() @@ -5122,6 +5124,10 @@ static void InitArtworkConfig() { "name", "sort_priority", + "program_title", + "program_copyright", + "program_company", + NULL }; static char **ignore_image_tokens; @@ -5426,6 +5432,7 @@ void InitGfx() InitGfxDrawBusyAnimFunction(DrawInitAnim); InitGfxDrawGlobalAnimFunction(DrawGlobalAnimations); InitGfxDrawGlobalBorderFunction(DrawMaskedBorderToTarget); + InitGfxDrawTileCursorFunction(DrawTileCursor); gfx.fade_border_source_status = global.border_status; gfx.fade_border_target_status = global.border_status; @@ -5882,6 +5889,10 @@ void KeyboardAutoRepeatOffUnlessAutoplay() void DisplayExitMessage(char *format, va_list ap) { + // also check for initialized video (headless flag may be temporarily unset) + if (program.headless || !video.initialized) + return; + // check if draw buffer and fonts for exit message are already available if (drawto == NULL || font_initial[NUM_INITIAL_FONTS - 1].bitmap == NULL) return; @@ -5995,9 +6006,11 @@ void OpenAll() print_timestamp_time("[init setup/config stuff]"); + InitVideoDefaults(); InitVideoDisplay(); InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen); + InitTileCursorInfo(); InitOverlayInfo(); print_timestamp_time("[init video stuff]"); @@ -6036,6 +6049,7 @@ void OpenAll() em_open_all(); sp_open_all(); + mm_open_all(); if (global.autoplay_leveldir) { @@ -6112,7 +6126,7 @@ void CloseAllAndExit(int exit_value) CloseVideoDisplay(); ClosePlatformDependentStuff(); - if (exit_value != 0) + if (exit_value != 0 && !options.execute_command) { /* fall back to default level set (current set may have caused an error) */ SaveLevelSetup_LastSeries_Deactivate();