From: Holger Schemel Date: Sat, 9 Dec 2023 17:35:59 +0000 (+0100) Subject: fixed "level_nr" style global animations on level selection screen X-Git-Tag: 4.3.8.0~2 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=c4cfe09e6e5db671cf17fa7e7689d3773255eca3;p=rocksndiamonds.git fixed "level_nr" style global animations on level selection screen --- diff --git a/src/anim.c b/src/anim.c index 7f50b28b..82cb8dd2 100644 --- a/src/anim.c +++ b/src/anim.c @@ -315,7 +315,7 @@ int getAnimationFrame(int num_frames, int delay, int mode, int start_frame, } else if (mode & ANIM_LEVEL_NR) // play frames by level number { - int level_pos = level_nr - leveldir_current->first_level; + int level_pos = level_nr - gfx.anim_first_level; frame = level_pos % num_frames; } diff --git a/src/libgame/system.h b/src/libgame/system.h index d00c47ba..bcfee01e 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1241,6 +1241,7 @@ struct GfxInfo char * (*get_token_from_font_function)(int); int anim_random_frame; + int anim_first_level; void (*draw_busy_anim_function)(boolean); void (*draw_global_anim_function)(int, int); diff --git a/src/screens.c b/src/screens.c index d48ba4ec..c919220e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1792,6 +1792,9 @@ void DrawMainMenu(void) // store valid level series information leveldir_last_valid = leveldir_current; + // store first level of this level set for "level_nr" style animations + SetAnimationFirstLevel(leveldir_current->first_level); + // needed if last screen (level choice) changed graphics, sounds or music ReloadCustomArtwork(0); diff --git a/src/tools.c b/src/tools.c index 3f551d63..4083e77e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1517,6 +1517,11 @@ void SetRandomAnimationValue(int x, int y) gfx.anim_random_frame = GfxRandom[x][y]; } +void SetAnimationFirstLevel(int first_level) +{ + gfx.anim_first_level = first_level; +} + int getGraphicAnimationFrame(int graphic, int sync_frame) { // animation synchronized with global frame counter, not move position diff --git a/src/tools.h b/src/tools.h index 5f597f42..1ccfcea3 100644 --- a/src/tools.h +++ b/src/tools.h @@ -131,6 +131,7 @@ void FloodFillLevel(int, int, int, short[MAX_LEV_FIELDX][MAX_LEV_FIELDY], int, i void FloodFillLevelExt(int, int, int, int x, int y, short field[x][y], int, int); void SetRandomAnimationValue(int, int); +void SetAnimationFirstLevel(int); int getGraphicAnimationFrame(int, int); int getGraphicAnimationFrameXY(int, int, int);