X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=943839edba5acecd02e708e51bce2e444158806a;hp=e33a5adb8e7037d22a2fef9be46d92db6f3760ce;hb=2178db0a0652bc87717aa1a55c888258ad6701e5;hpb=8d67b62445143c8f9fdde2cea730bfee49cc4271 diff --git a/src/init.c b/src/init.c index e33a5adb..943839ed 100644 --- a/src/init.c +++ b/src/init.c @@ -226,10 +226,18 @@ void InitBitmapPointers() graphic_info[i].bitmap = graphic_info[i].bitmaps[IMG_BITMAP_STANDARD]; } -static void InitGlobalAnimImages() +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++) @@ -241,7 +249,6 @@ static void InitGlobalAnimImages() if (graphic == IMG_UNDEFINED) continue; - // create textures from images for fast GPU blitting, if possible CreateImageTextures(graphic); } } @@ -1123,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; @@ -1328,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) @@ -1338,11 +1351,10 @@ 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 */ + /* 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_frames = parameter[GFX_ARG_STEP_FRAMES]; g->step_delay = parameter[GFX_ARG_STEP_DELAY]; g->direction = parameter[GFX_ARG_DIRECTION]; g->position = parameter[GFX_ARG_POSITION]; @@ -1356,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]; @@ -2026,8 +2041,9 @@ static void ReinitializeGraphics() print_timestamp_time("InitFontGraphicInfo"); InitGlobalAnimGraphicInfo(); /* initialize global animation config */ print_timestamp_time("InitGlobalAnimGraphicInfo"); - InitGlobalAnimImages(); /* initialize global animation images */ - print_timestamp_time("InitGlobalAnimImages"); + + InitImageTextures(); /* create textures for certain images */ + print_timestamp_time("InitImageTextures"); InitGraphicInfo_EM(); /* graphic mapping for EM engine */ print_timestamp_time("InitGraphicInfo_EM"); @@ -2043,6 +2059,7 @@ static void ReinitializeGraphics() InitGadgets(); print_timestamp_time("InitGadgets"); InitToons(); + InitGlobalAnimations(); print_timestamp_time("InitToons"); InitDoors(); print_timestamp_time("InitDoors"); @@ -4649,7 +4666,8 @@ static void InitGlobal() global.frames_per_second = 0; - global.border_status = GAME_MODE_MAIN; + global.border_status = GAME_MODE_LOADING; + global.anim_status = global.anim_status_next = GAME_MODE_LOADING; global.use_envelope_request = FALSE; } @@ -5305,6 +5323,11 @@ void InitGfx() InitGfxDrawBusyAnimFunction(DrawInitAnim); InitGfxDrawGlobalAnimFunction(DrawGlobalAnim); + InitGfxDrawGlobalBorderFunction(DrawMaskedBorderToTarget); + + 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; @@ -5681,7 +5704,7 @@ void ReloadCustomArtwork(int force_reload) print_timestamp_init("ReloadCustomArtwork"); - game_status = GAME_MODE_LOADING; + SetGameStatus(GAME_MODE_LOADING); FadeOut(REDRAW_ALL); @@ -5716,7 +5739,7 @@ void ReloadCustomArtwork(int force_reload) print_timestamp_time("InitMusic"); } - game_status = last_game_status; /* restore current game status */ + SetGameStatus(last_game_status); /* restore current game status */ init_last = init; /* switch to new busy animation */ @@ -5811,7 +5834,7 @@ void OpenAll() { print_timestamp_init("OpenAll"); - game_status = GAME_MODE_LOADING; + SetGameStatus(GAME_MODE_LOADING); InitCounter(); @@ -5911,7 +5934,7 @@ void OpenAll() return; } - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); FadeSetEnterScreen(); if (!(fading.fade_mode & FADE_TYPE_TRANSFORM))