Allow the episode 4 cutscenes to be skipped in their entirety with one keypress, as in the original DOS game, instead of requiring input for each ANM file.

git-svn-id: https://svn.eduke32.com/eduke32@4243 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-01-12 14:02:30 +00:00
parent 9e968b0093
commit 1014af812f
4 changed files with 32 additions and 11 deletions

View file

@ -207,7 +207,7 @@ static void endanimvol43(int32_t fr)
} }
} }
void G_PlayAnim(const char *fn, char t) int32_t G_PlayAnim(const char *fn, char t)
{ {
uint8_t *animbuf; uint8_t *animbuf;
int32_t i, length=0, numframes=0; int32_t i, length=0, numframes=0;
@ -216,6 +216,7 @@ void G_PlayAnim(const char *fn, char t)
#endif #endif
int32_t handle=-1; int32_t handle=-1;
int32_t frametime = 0; int32_t frametime = 0;
int32_t running = 1;
// t parameter: // t parameter:
// //
@ -237,6 +238,7 @@ void G_PlayAnim(const char *fn, char t)
if (I_CheckAllInput()) if (I_CheckAllInput())
{ {
FX_StopAllSounds(); FX_StopAllSounds();
running = 0;
goto end_anim; goto end_anim;
} }
@ -249,7 +251,6 @@ void G_PlayAnim(const char *fn, char t)
animvpx_codec_ctx codec; animvpx_codec_ctx codec;
uint8_t *pic; uint8_t *pic;
uint32_t msecsperframe, nextframetime; uint32_t msecsperframe, nextframetime;
int32_t running = 1;
int32_t animidx, framenum=0, soundidx=0, numtotalsounds=0; // custom anim sounds int32_t animidx, framenum=0, soundidx=0, numtotalsounds=0; // custom anim sounds
Bstrncpyz(vpxfn, fn, BMAX_PATH); Bstrncpyz(vpxfn, fn, BMAX_PATH);
@ -273,7 +274,7 @@ void G_PlayAnim(const char *fn, char t)
OSD_Printf("Failed reading IVF file: %s\n", OSD_Printf("Failed reading IVF file: %s\n",
animvpx_read_ivf_header_errmsg[i]); animvpx_read_ivf_header_errmsg[i]);
kclose(handle); kclose(handle);
return; return 0;
} }
animvpx_setup_glstate(); animvpx_setup_glstate();
@ -281,7 +282,7 @@ void G_PlayAnim(const char *fn, char t)
{ {
OSD_Printf("Error initializing VPX codec.\n"); OSD_Printf("Error initializing VPX codec.\n");
animvpx_restore_glstate(); animvpx_restore_glstate();
return; return 0;
} }
animidx = t-1; animidx = t-1;
@ -352,14 +353,14 @@ void G_PlayAnim(const char *fn, char t)
animvpx_uninit_codec(&codec); animvpx_uninit_codec(&codec);
I_ClearAllInput(); I_ClearAllInput();
return; // done with playing VP8! return !running; // done with playing VP8!
} }
#endif #endif
// ANM playback --- v v v --- // ANM playback --- v v v ---
handle = kopen4load(fn, 0); handle = kopen4load(fn, 0);
if (handle == -1) if (handle == -1)
return; return 0;
length = kfilelength(handle); length = kfilelength(handle);
if (length == 0) if (length == 0)
@ -421,7 +422,10 @@ void G_PlayAnim(const char *fn, char t)
G_HandleAsync(); G_HandleAsync();
if (I_CheckAllInput()) if (I_CheckAllInput())
{
running = 0;
goto end_anim_restore_gl; goto end_anim_restore_gl;
}
if (g_restorePalette == 1) if (g_restorePalette == 1)
{ {
@ -464,4 +468,6 @@ end_anim:
I_ClearAllInput(); I_ClearAllInput();
ANIM_FreeAnim(); ANIM_FreeAnim();
walock[TILE_ANIM] = 1; walock[TILE_ANIM] = 1;
return !running;
} }

View file

@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern uint16_t anim_hi_numsounds[NUM_HARDCODED_ANIMS], *anim_hi_sounds[NUM_HARDCODED_ANIMS]; extern uint16_t anim_hi_numsounds[NUM_HARDCODED_ANIMS], *anim_hi_sounds[NUM_HARDCODED_ANIMS];
# endif # endif
void G_PlayAnim(const char *fn,char t); int32_t G_PlayAnim(const char *fn,char t);
/* /*
void endanimvol43(int32_t fr); void endanimvol43(int32_t fr);
void endanimvol42(int32_t fr); void endanimvol42(int32_t fr);

View file

@ -12300,17 +12300,24 @@ static void G_BonusCutscenes(void)
if (ud.lockout == 0) if (ud.lockout == 0)
{ {
I_ClearInputWaiting(); I_ClearInputWaiting();
G_PlayAnim("vol4e1.anm",8); t = G_PlayAnim("vol4e1.anm",8);
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
G_PlayAnim("vol4e2.anm",10); if (t)
goto end_vol4e;
t = G_PlayAnim("vol4e2.anm",10);
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
if (t)
goto end_vol4e;
G_PlayAnim("vol4e3.anm",11); G_PlayAnim("vol4e3.anm",11);
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
} }
end_vol4e:
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
S_PlaySound(ENDSEQVOL3SND4); S_PlaySound(ENDSEQVOL3SND4);

View file

@ -1390,15 +1390,23 @@ void G_NewGame(int32_t vn, int32_t ln, int32_t sk)
clearview(0L); clearview(0L);
nextpage(); nextpage();
G_PlayAnim("vol41a.anm",6); i = G_PlayAnim("vol41a.anm",6);
clearview(0L); clearview(0L);
nextpage(); nextpage();
if (i)
goto end_vol4a;
i = G_PlayAnim("vol42a.anm",7);
clearview(0L);
nextpage();
if (i)
goto end_vol4a;
G_PlayAnim("vol42a.anm",7);
G_PlayAnim("vol43a.anm",9); G_PlayAnim("vol43a.anm",9);
clearview(0L); clearview(0L);
nextpage(); nextpage();
end_vol4a:
FX_StopAllSounds(); FX_StopAllSounds();
} }