From cbab48e3ea7c2821978dccb4f299e81e9c567050 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 7 Mar 2016 00:15:23 +0100 Subject: [PATCH] changed screen specific global animations to stop when fading screens --- src/cartoons.c | 28 ++++++++++++++-------------- src/init.c | 1 + src/main.c | 1 + src/main.h | 14 ++++++++++---- src/tools.c | 6 ++++++ 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/cartoons.c b/src/cartoons.c index 0048d4b7..593066bd 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -62,7 +62,7 @@ struct GlobalAnimPartControlInfo int drawing_stage; int state; - int last_game_status; + int last_anim_status; }; struct GlobalAnimMainControlInfo @@ -136,7 +136,7 @@ static unsigned int anim_sync_frame_delay_value = GAME_FRAME_DELAY; static int game_mode_anim_classes[NUM_GAME_MODES]; static int anim_class_game_modes[NUM_ANIM_CLASSES]; -static int game_status_last = GAME_MODE_DEFAULT; +static int anim_status_last = GAME_MODE_DEFAULT; static int anim_classes_last = ANIM_CLASS_NONE; @@ -269,7 +269,7 @@ static void InitToonControls() part->step_delay_value = graphic_info[control].step_delay; part->state = ANIM_STATE_INACTIVE; - part->last_game_status = -1; + part->last_anim_status = -1; anim->num_parts++; part_nr++; @@ -355,7 +355,7 @@ void InitGlobalAnimControls() part->step_delay_value = graphic_info[control].step_delay; part->state = ANIM_STATE_INACTIVE; - part->last_game_status = -1; + part->last_anim_status = -1; if (p < GLOBAL_ANIM_ID_PART_BASE) { @@ -391,7 +391,7 @@ void InitGlobalAnimControls() anim_class_game_modes[anim_class_game_modes_list[i].class_bit] = anim_class_game_modes_list[i].game_mode; - game_status_last = GAME_MODE_LOADING; + anim_status_last = GAME_MODE_LOADING; anim_classes_last = ANIM_CLASS_NONE; } @@ -402,25 +402,25 @@ void InitGlobalAnimations() void DrawGlobalAnimExt(int drawing_stage) { - int anim_classes = game_mode_anim_classes[game_status]; + int anim_classes = game_mode_anim_classes[global.anim_status_next]; int mode_nr; int i; // start or stop global animations by change of game mode // (special handling of animations for "current screen" and "all screens") - if (game_status != game_status_last) + if (global.anim_status != anim_status_last) { // stop animations for last screen - HandleGlobalAnim(ANIM_STOP, game_status_last); + HandleGlobalAnim(ANIM_STOP, anim_status_last); // start animations for current screen - HandleGlobalAnim(ANIM_START, game_status); + HandleGlobalAnim(ANIM_START, global.anim_status); // start animations for all screens after loading new artwork set - if (game_status_last == GAME_MODE_LOADING) + if (anim_status_last == GAME_MODE_LOADING) HandleGlobalAnim(ANIM_START, GAME_MODE_DEFAULT); - game_status_last = game_status; + anim_status_last = global.anim_status; } // start or stop global animations by change of animation class @@ -443,7 +443,7 @@ void DrawGlobalAnimExt(int drawing_stage) anim_classes_last = anim_classes; } - if (!setup.toons || game_status == GAME_MODE_LOADING) + if (!setup.toons || global.anim_status == GAME_MODE_LOADING) return; if (drawing_stage == DRAW_GLOBAL_ANIM_STAGE_1) @@ -553,10 +553,10 @@ boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part) int viewport_height; boolean changed = FALSE; - if (part->last_game_status == game_status) + if (part->last_anim_status == global.anim_status) return FALSE; - part->last_game_status = game_status; + part->last_anim_status = global.anim_status; part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_1; diff --git a/src/init.c b/src/init.c index d7bf92f5..30ff6b9b 100644 --- a/src/init.c +++ b/src/init.c @@ -4667,6 +4667,7 @@ static void InitGlobal() global.frames_per_second = 0; global.border_status = GAME_MODE_MAIN; + global.anim_status = global.anim_status_next = GAME_MODE_LOADING; global.use_envelope_request = FALSE; } diff --git a/src/main.c b/src/main.c index 7593e017..a7c5c83b 100644 --- a/src/main.c +++ b/src/main.c @@ -5492,6 +5492,7 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] = { ".TYPENAME", GFX_SPECIAL_ARG_TYPENAME, }, { ".MENU", GFX_SPECIAL_ARG_MENU, }, { ".TOONS", GFX_SPECIAL_ARG_TOONS, }, + { ".FADING", GFX_SPECIAL_ARG_FADING, }, { ".QUIT", GFX_SPECIAL_ARG_QUIT, }, /* empty suffix always matches -- check as last entry in InitMusicInfo() */ diff --git a/src/main.h b/src/main.h index 05c28b8e..36500844 100644 --- a/src/main.h +++ b/src/main.h @@ -1804,9 +1804,10 @@ #define GFX_SPECIAL_ARG_TYPENAME 17 #define GFX_SPECIAL_ARG_MENU 18 #define GFX_SPECIAL_ARG_TOONS 19 -#define GFX_SPECIAL_ARG_QUIT 20 +#define GFX_SPECIAL_ARG_FADING 20 +#define GFX_SPECIAL_ARG_QUIT 21 -#define NUM_SPECIAL_GFX_ARGS 21 +#define NUM_SPECIAL_GFX_ARGS 22 /* these additional definitions are currently only used for draw offsets */ #define GFX_SPECIAL_ARG_INFO_MAIN 0 @@ -2006,9 +2007,10 @@ #define GAME_MODE_PSEUDO_TYPENAME 17 #define GAME_MODE_PSEUDO_MENU 18 #define GAME_MODE_PSEUDO_TOONS 19 -#define GAME_MODE_QUIT 20 +#define GAME_MODE_PSEUDO_FADING 20 +#define GAME_MODE_QUIT 21 -#define NUM_GAME_MODES 21 +#define NUM_GAME_MODES 22 /* special definitions currently only used for custom artwork configuration */ #define MUSIC_PREFIX_BACKGROUND 0 @@ -2584,6 +2586,10 @@ struct GlobalInfo /* global values for fading screens and masking borders */ int border_status; + /* values for global animations */ + int anim_status; + int anim_status_next; + boolean use_envelope_request; }; diff --git a/src/tools.c b/src/tools.c index 2fa69f11..4a524360 100644 --- a/src/tools.c +++ b/src/tools.c @@ -643,10 +643,14 @@ void FadeIn(int fade_mask) FADE_SY = REAL_SY; FADE_SXSIZE = FULL_SXSIZE; FADE_SYSIZE = FULL_SYSIZE; + + global.anim_status = global.anim_status_next; } void FadeOut(int fade_mask) { + global.anim_status = GAME_MODE_PSEUDO_FADING; + #if 0 DrawMaskedBorder(REDRAW_ALL); #endif @@ -8181,6 +8185,8 @@ void JoinRectangles(int *x, int *y, int *width, int *height, void SetGameStatus(int game_status_new) { game_status = game_status_new; + + global.anim_status_next = game_status; } void ChangeViewportPropertiesIfNeeded() -- 2.34.1