X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=8817d9634e95a0e039ff029df600da25d916eb20;hb=092cfc403b3bcf3a390e961f594f28056b5f6aec;hp=ea7c8f9a744742b46fdf179a7d40ac3f5b719506;hpb=17c100ba4bca1cf8475905b6eeb502e581489c5c;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index ea7c8f9a..8817d963 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; @@ -1714,10 +1717,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 +1738,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 +1768,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 || @@ -4257,6 +4261,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 +4284,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 +4683,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; @@ -4835,6 +4824,7 @@ static void InitGlobal() global.create_images_dir = NULL; global.frames_per_second = 0; + global.show_frames_per_second = FALSE; global.border_status = GAME_MODE_LOADING; global.anim_status = global.anim_status_next = GAME_MODE_LOADING; @@ -5049,11 +5039,15 @@ void Execute_Command(char *command) static void InitSetup() { LoadSetup(); /* global setup info */ + LoadSetup_AutoSetup(); /* global auto setup info */ /* set some options from setup file */ if (setup.options.verbose) options.verbose = TRUE; + + if (setup.debug.show_frames_per_second) + global.show_frames_per_second = TRUE; } static void InitGameInfo() @@ -6032,6 +6026,7 @@ void OpenAll() em_open_all(); sp_open_all(); + mm_open_all(); if (global.autoplay_leveldir) { @@ -6108,7 +6103,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();