From: Holger Schemel Date: Fri, 19 Nov 2021 10:26:43 +0000 (+0100) Subject: added graphics animation mode "random_static" (unchanged for each tile) X-Git-Tag: 4.3.1.0~24 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=207dd0ba7951139a27a87a091c7eb98c395f3c70 added graphics animation mode "random_static" (unchanged for each tile) --- diff --git a/src/files.c b/src/files.c index 9a4999b8..a0e77bcc 100644 --- a/src/files.c +++ b/src/files.c @@ -11978,6 +11978,7 @@ int get_parameter_value(char *value_raw, char *suffix, int type) string_has_parameter(value, "pingpong") ? ANIM_PINGPONG : string_has_parameter(value, "pingpong2") ? ANIM_PINGPONG2 : string_has_parameter(value, "random") ? ANIM_RANDOM : + string_has_parameter(value, "random_static") ? ANIM_RANDOM_STATIC : string_has_parameter(value, "ce_value") ? ANIM_CE_VALUE : string_has_parameter(value, "ce_score") ? ANIM_CE_SCORE : string_has_parameter(value, "ce_delay") ? ANIM_CE_DELAY : diff --git a/src/game.c b/src/game.c index 0383a35f..d4c04025 100644 --- a/src/game.c +++ b/src/game.c @@ -3878,6 +3878,7 @@ void InitGame(void) GfxFrame[x][y] = 0; GfxRandom[x][y] = INIT_GFX_RANDOM(); + GfxRandomStatic[x][y] = INIT_GFX_RANDOM(); GfxElement[x][y] = EL_UNDEFINED; GfxAction[x][y] = ACTION_DEFAULT; GfxDir[x][y] = MV_NONE; @@ -15968,6 +15969,7 @@ static ListNode *SaveEngineSnapshotBuffers(void) SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(GfxFrame)); SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(GfxRandom)); + SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(GfxRandomStatic)); SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(GfxElement)); SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(GfxAction)); SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(GfxDir)); diff --git a/src/libgame/system.h b/src/libgame/system.h index 90a7fe4f..327cba88 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -370,6 +370,7 @@ #define ANIM_ALL (1 << 14) #define ANIM_ONCE (1 << 15) #define ANIM_TILED (1 << 16) +#define ANIM_RANDOM_STATIC (1 << 17) #define ANIM_DEFAULT ANIM_LOOP diff --git a/src/main.c b/src/main.c index 8dd3712b..1d99a74d 100644 --- a/src/main.c +++ b/src/main.c @@ -67,6 +67,7 @@ int PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +int GfxRandomStatic[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; int GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; int GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; diff --git a/src/main.h b/src/main.h index ea915a9a..14c2e885 100644 --- a/src/main.h +++ b/src/main.h @@ -3738,6 +3738,7 @@ extern int PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +extern int GfxRandomStatic[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern int GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern int GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; diff --git a/src/tools.c b/src/tools.c index 0271abfc..bf79b048 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1496,6 +1496,15 @@ int getGraphicAnimationFrameXY(int graphic, int lx, int ly) return sync_frame % g->anim_frames; } + else if (graphic_info[graphic].anim_mode & ANIM_RANDOM_STATIC) + { + struct GraphicInfo *g = &graphic_info[graphic]; + int x = (lx + lev_fieldx) % lev_fieldx; + int y = (ly + lev_fieldy) % lev_fieldy; + int sync_frame = GfxRandomStatic[x][y]; + + return sync_frame % g->anim_frames; + } return getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]); } @@ -3951,7 +3960,7 @@ void DrawLevelGraphicAnimationIfNeeded(int x, int y, int graphic) if (!IS_NEW_FRAME(GfxFrame[x][y], graphic)) return; - if (ANIM_MODE(graphic) & ANIM_TILED) + if (ANIM_MODE(graphic) & (ANIM_TILED | ANIM_RANDOM_STATIC)) return; DrawGraphicAnimation(sx, sy, graphic);