X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=922fc11afb2cd0d70f112d3fd8a6b5a37754f38e;hb=ec5f4027a019ebf435b41577ab1234849c77a059;hp=ca5d16b6be699cbf992e0d0983b8297456ef53b4;hpb=fe4ae2ae6dd24628a3141093d8cddea7b57812e1;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index ca5d16b6..922fc11a 100644 --- a/src/init.c +++ b/src/init.c @@ -230,6 +230,14 @@ 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,8 +249,7 @@ void InitImageTextures() if (graphic == IMG_UNDEFINED) continue; - // (re)create textures from images for fast GPU blitting, if possible - ReCreateImageTextures(graphic); + CreateImageTextures(graphic); } } } @@ -1123,10 +1130,13 @@ 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; g->post_delay_random = 0; + g->draw_order = 0; g->fade_mode = FADE_MODE_DEFAULT; g->fade_delay = -1; g->post_delay = -1; @@ -1328,7 +1338,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 +1352,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 +1369,10 @@ 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 */ + if (parameter[GFX_ARG_DRAW_ORDER] != ARG_UNDEFINED_VALUE) + 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]; @@ -2044,6 +2061,7 @@ static void ReinitializeGraphics() InitGadgets(); print_timestamp_time("InitGadgets"); InitToons(); + InitGlobalAnimations(); print_timestamp_time("InitToons"); InitDoors(); print_timestamp_time("InitDoors"); @@ -4650,7 +4668,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; } @@ -5306,6 +5325,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; @@ -5682,7 +5706,7 @@ void ReloadCustomArtwork(int force_reload) print_timestamp_init("ReloadCustomArtwork"); - game_status = GAME_MODE_LOADING; + SetGameStatus(GAME_MODE_LOADING); FadeOut(REDRAW_ALL); @@ -5717,7 +5741,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 */ @@ -5812,7 +5836,7 @@ void OpenAll() { print_timestamp_init("OpenAll"); - game_status = GAME_MODE_LOADING; + SetGameStatus(GAME_MODE_LOADING); InitCounter(); @@ -5912,7 +5936,7 @@ void OpenAll() return; } - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); FadeSetEnterScreen(); if (!(fading.fade_mode & FADE_TYPE_TRANSFORM))