From 7b599c671072cd3c1095819acbd11136ad600443 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Tue, 19 Nov 2024 20:27:23 +0700 Subject: [PATCH 1/6] fix id24 interlevel animation for 1-3 episodes of Doom 1 --- src/wi_stuff.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wi_stuff.c b/src/wi_stuff.c index be31b1c6d..b38f970a5 100644 --- a/src/wi_stuff.c +++ b/src/wi_stuff.c @@ -1382,6 +1382,11 @@ static void WI_drawShowNextLoc(void) // draw animated background WI_drawAnimatedBack(); + if (animation && array_size(animation->states)) + { + return; + } + // custom interpic. if (exitpic || (enterpic && state != StatCount)) { From 56e5a6076e01dea29c5041b2d68487cb8f9fc7b7 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 20 Nov 2024 08:14:11 +0700 Subject: [PATCH 2/6] fix enterpic/exitpic --- src/wi_stuff.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wi_stuff.c b/src/wi_stuff.c index b38f970a5..b56c8c67e 100644 --- a/src/wi_stuff.c +++ b/src/wi_stuff.c @@ -1382,11 +1382,6 @@ static void WI_drawShowNextLoc(void) // draw animated background WI_drawAnimatedBack(); - if (animation && array_size(animation->states)) - { - return; - } - // custom interpic. if (exitpic || (enterpic && state != StatCount)) { @@ -1394,6 +1389,11 @@ static void WI_drawShowNextLoc(void) return; } + if (animation && array_size(animation->states)) + { + return; + } + if ( gamemode != commercial) { if (wbs->epsd > 2) From b644b0056dc36d2f023b29b1ae72d3c86c683e7a Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 20 Nov 2024 09:46:53 +0700 Subject: [PATCH 3/6] another fix --- src/wi_stuff.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/wi_stuff.c b/src/wi_stuff.c index b56c8c67e..75fcc33b8 100644 --- a/src/wi_stuff.c +++ b/src/wi_stuff.c @@ -1389,11 +1389,6 @@ static void WI_drawShowNextLoc(void) return; } - if (animation && array_size(animation->states)) - { - return; - } - if ( gamemode != commercial) { if (wbs->epsd > 2) @@ -1401,7 +1396,9 @@ static void WI_drawShowNextLoc(void) WI_drawEL(); // "Entering..." if not E1 or E2 return; } - + + if (!animation || !array_size(animation->states)) + { last = (wbs->last == 8) ? wbs->next - 1 : wbs->last; // draw a splat on taken cities. @@ -1415,6 +1412,7 @@ static void WI_drawShowNextLoc(void) // draw flashing ptr if (snl_pointeron) WI_drawOnLnode(wbs->next, yah); + } } // draws which level you are entering.. From 23a49b55848b14c20e32477e104e9edf9d0fe34e Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 21 Nov 2024 11:08:09 +0700 Subject: [PATCH 4/6] fix double duration for first frame --- src/wi_stuff.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/wi_stuff.c b/src/wi_stuff.c index 75fcc33b8..729352475 100644 --- a/src/wi_stuff.c +++ b/src/wi_stuff.c @@ -501,6 +501,17 @@ static void UpdateAnimationStates(wi_animationstate_t *states) if (state->duration_left == 0) { + if (!state->frame_start) + { + state->frame_index++; + if (state->frame_index == array_size(state->frames)) + { + state->frame_index = 0; + } + + frame = &state->frames[state->frame_index]; + } + int tics = 1; switch (frame->type) { @@ -525,15 +536,6 @@ static void UpdateAnimationStates(wi_animationstate_t *states) } state->duration_left = MAX(tics, 1); - - if (!state->frame_start) - { - state->frame_index++; - if (state->frame_index == array_size(state->frames)) - { - state->frame_index = 0; - } - } } state->duration_left--; From 587a383acc1fb3d1332a83bfe665acf5ff1e7cb2 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Sat, 23 Nov 2024 02:04:39 +0700 Subject: [PATCH 5/6] fix condition --- src/wi_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wi_stuff.c b/src/wi_stuff.c index 729352475..eecacdddf 100644 --- a/src/wi_stuff.c +++ b/src/wi_stuff.c @@ -1399,7 +1399,7 @@ static void WI_drawShowNextLoc(void) return; } - if (!animation || !array_size(animation->states)) + if (!animation || !animation->entering_states) { last = (wbs->last == 8) ? wbs->next - 1 : wbs->last; From 455cd9633db28880a629162554c9930d7401ee32 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Sat, 23 Nov 2024 12:00:35 +0700 Subject: [PATCH 6/6] refactoring --- src/wi_stuff.c | 104 ++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 58 deletions(-) diff --git a/src/wi_stuff.c b/src/wi_stuff.c index eecacdddf..77276e8f0 100644 --- a/src/wi_stuff.c +++ b/src/wi_stuff.c @@ -407,9 +407,6 @@ typedef struct interlevel_t *interlevel_exiting; interlevel_t *interlevel_entering; - wi_animationstate_t *exiting_states; - wi_animationstate_t *entering_states; - wi_animationstate_t *states; char *background_lump; } wi_animation_t; @@ -487,10 +484,15 @@ static boolean CheckConditions(interlevelcond_t *conditions, return conditionsmet; } -static void UpdateAnimationStates(wi_animationstate_t *states) +static boolean UpdateAnimation(void) { + if (!animation || !animation->states) + { + return false; + } + wi_animationstate_t *state; - array_foreach(state, states) + array_foreach(state, animation->states) { interlevelframe_t *frame = &state->frames[state->frame_index]; @@ -541,35 +543,6 @@ static void UpdateAnimationStates(wi_animationstate_t *states) state->duration_left--; state->frame_start = false; } -} - -static boolean UpdateAnimation(boolean enteringcondition) -{ - if (!animation) - { - return false; - } - - animation->states = NULL; - animation->background_lump = NULL; - - if (!enteringcondition) - { - if (animation->interlevel_exiting) - { - animation->states = animation->exiting_states; - animation->background_lump = - animation->interlevel_exiting->background_lump; - } - } - else if (animation->interlevel_entering) - { - animation->states = animation->entering_states; - animation->background_lump = - animation->interlevel_entering->background_lump; - } - - UpdateAnimationStates(animation->states); return true; } @@ -636,31 +609,42 @@ static wi_animationstate_t *SetupAnimationStates(interlevellayer_t *layers, return states; } -static boolean SetupAnimation(void) +static boolean SetupAnimation(boolean enteringcondition) { if (!animation) { return false; } - if (animation->interlevel_exiting) + interlevel_t *interlevel = NULL; + if (!enteringcondition) + { + if (animation->interlevel_exiting) + { + interlevel = animation->interlevel_exiting; + } + } + else if (animation->interlevel_entering) { - animation->exiting_states = - SetupAnimationStates(animation->interlevel_exiting->layers, false); + interlevel = animation->interlevel_entering; } - if (animation->interlevel_entering) + if (interlevel) { - animation->entering_states = - SetupAnimationStates(animation->interlevel_entering->layers, true); + animation->states = + SetupAnimationStates(interlevel->layers, enteringcondition); + animation->background_lump = interlevel->background_lump; + return true; } - return true; + animation->states = NULL; + animation->background_lump = NULL; + return false; } static boolean NextLocAnimation(void) { - if (animation && animation->entering_states + if (animation && animation->interlevel_entering && !(demorecording || demoplayback)) { return true; @@ -669,30 +653,34 @@ static boolean NextLocAnimation(void) return false; } -static boolean UpdateMusic(boolean enteringcondition) +static boolean SetupMusic(boolean enteringcondition) { if (!animation) { return false; } - int musicnum = -1; - if (enteringcondition) + interlevel_t *interlevel = NULL; + if (!enteringcondition) { - if (animation->interlevel_entering) + if (animation->interlevel_exiting) { - musicnum = W_GetNumForName(animation->interlevel_entering->music_lump); + interlevel = animation->interlevel_exiting; } } - else if (animation->interlevel_exiting) + else if (animation->interlevel_entering) { - musicnum = W_GetNumForName(animation->interlevel_exiting->music_lump); + interlevel = animation->interlevel_entering; } - if (musicnum > 0) + if (interlevel) { - S_ChangeMusInfoMusic(musicnum, true); - return true; + int musicnum = W_GetNumForName(interlevel->music_lump); + if (musicnum >= 0) + { + S_ChangeMusInfoMusic(musicnum, true); + return true; + } } return false; @@ -904,7 +892,7 @@ static void WI_initAnimatedBack(boolean firstcall) int i; anim_t* a; - if (SetupAnimation()) + if (SetupAnimation(state != StatCount)) { return; } @@ -955,7 +943,7 @@ static void WI_updateAnimatedBack(void) int i; anim_t* a; - if (UpdateAnimation(state != StatCount)) + if (UpdateAnimation()) { return; } @@ -1316,7 +1304,7 @@ static boolean snl_pointeron = false; // static void WI_initShowNextLoc(void) { - UpdateMusic(true); + SetupMusic(true); if (gamemapinfo) { @@ -1399,7 +1387,7 @@ static void WI_drawShowNextLoc(void) return; } - if (!animation || !animation->entering_states) + if (!animation || !animation->states) { last = (wbs->last == 8) ? wbs->next - 1 : wbs->last; @@ -2246,7 +2234,7 @@ void WI_Ticker(void) // counter for general background animation bcnt++; - if (bcnt == 1 && !UpdateMusic(false)) + if (bcnt == 1 && !SetupMusic(false)) { // intermission music if ( gamemode == commercial )