diff --git a/sc2/src/sc2code/fmv.c b/sc2/src/sc2code/fmv.c index 78bfd894d..54cef8d66 100644 --- a/sc2/src/sc2code/fmv.c +++ b/sc2/src/sc2code/fmv.c @@ -30,10 +30,6 @@ #include "libs/graphics/gfx_common.h" #include "libs/inplib.h" - -/* Some ship spin animations contain extra frames that must be discarded. */ -#define SHIP_SPIN_LOOP_FRAME 89 - void DoShipSpin (COUNT index, MUSIC_REF hMusic) { @@ -168,7 +164,7 @@ Victory (void) void Logo (void) { - DoFMV ("logo"); + ShowPresentation ("slides.logo"); } diff --git a/sc2/src/sc2code/fmv.h b/sc2/src/sc2code/fmv.h index d9191f98e..885fdf971 100644 --- a/sc2/src/sc2code/fmv.h +++ b/sc2/src/sc2code/fmv.h @@ -26,15 +26,9 @@ extern void Logo (void); extern void SplashScreen (void (* DoProcessing)(DWORD TimeOut)); extern void Introduction (void); extern void Victory (void); - extern void DoShipSpin (COUNT index, MUSIC_REF hMusic); -extern BOOLEAN DoFMV (const char *name); -extern BOOLEAN DoFMVEx (const char *name, const char *audname, - const char *speechname, DWORD loopframe); - extern BOOLEAN ShowPresentation (RESOURCE presentation); -extern BOOLEAN ShowPresentationFile (const char *name); #endif /* _FMV_H */ diff --git a/sc2/src/sc2code/intro.c b/sc2/src/sc2code/intro.c index 8dad072d2..fd442e7b8 100644 --- a/sc2/src/sc2code/intro.c +++ b/sc2/src/sc2code/intro.c @@ -31,9 +31,6 @@ #include "libs/inplib.h" #include "libs/log.h" -// TODO: Fold DoFMV and friends into libs/video; then we can get rid of this. -#include "libs/video/vidintrn.h" - #include static BOOLEAN ShowSlidePresentation (STRING PresStr); @@ -90,41 +87,6 @@ typedef struct { static BOOLEAN DoPresentation (void *pIS); -BOOLEAN -DoFMVEx (const char *name, const char *audname, const char *speechname, - DWORD loopframe) -{ - VIDEO_REF VidRef; - MUSIC_REF AudRef = 0; - MUSIC_REF SpeechRef = 0; - - VidRef = LoadVideoFile (name); - if (!VidRef) - return FALSE; - if (audname) - AudRef = LoadMusicFile (audname); - if (speechname) - SpeechRef = LoadMusicFile (speechname); - - VidPlayEx (VidRef, AudRef, SpeechRef, loopframe); - VidDoInput (); - VidStop (); - - DestroyVideo (VidRef); - if (SpeechRef) - DestroyMusic (SpeechRef); - if (AudRef) - DestroyMusic (AudRef); - - return TRUE; -} - -BOOLEAN -DoFMV (const char *name) -{ - return DoFMVEx (name, NULL, NULL, VID_NO_LOOP); -} - static BOOLEAN ParseColorString (const char *Src, COLOR* pColor) { @@ -860,8 +822,9 @@ ShowPresentation (RESOURCE res) else if (!strcmp (resType, "3DOVID")) { LEGACY_VIDEO vid = LoadLegacyVideoInstance (res); - return DoFMVEx (vid->video, vid->audio, vid->speech, vid->loop); + BOOLEAN result = PlayLegacyVideo (vid); DestroyLegacyVideo (vid); + return result; } log_add (log_Warning, "Tried to present '%s', of non-presentable type '%s'", res, resType); diff --git a/sc2/src/sc2code/libs/video/Makeinfo b/sc2/src/sc2code/libs/video/Makeinfo index 0c4151ede..5c460ff6d 100644 --- a/sc2/src/sc2code/libs/video/Makeinfo +++ b/sc2/src/sc2code/libs/video/Makeinfo @@ -1 +1,2 @@ -uqm_CFILES="vfileins.c vresins.c video.c videodec.c vidplayer.c dukvid.c" +uqm_CFILES="vfileins.c vresins.c video.c videodec.c vidplayer.c dukvid.c \ + legacyplayer.c" diff --git a/sc2/src/sc2code/libs/video/legacyplayer.c b/sc2/src/sc2code/libs/video/legacyplayer.c new file mode 100644 index 000000000..80f099cdc --- /dev/null +++ b/sc2/src/sc2code/libs/video/legacyplayer.c @@ -0,0 +1,39 @@ +#include "vidintrn.h" + +BOOLEAN +PlayLegacyVideo (LEGACY_VIDEO vid) +{ + const char *name, *audname, *speechname; + DWORD loopframe; + VIDEO_REF VidRef; + MUSIC_REF AudRef = 0; + MUSIC_REF SpeechRef = 0; + + if (!vid) + return FALSE; + name = vid->video; + audname = vid->audio; + speechname = vid->speech; + loopframe = vid->loop; + + VidRef = LoadVideoFile (name); + if (!VidRef) + return FALSE; + if (audname) + AudRef = LoadMusicFile (audname); + if (speechname) + SpeechRef = LoadMusicFile (speechname); + + VidPlayEx (VidRef, AudRef, SpeechRef, loopframe); + VidDoInput (); + VidStop (); + + DestroyVideo (VidRef); + if (SpeechRef) + DestroyMusic (SpeechRef); + if (AudRef) + DestroyMusic (AudRef); + + return TRUE; +} + diff --git a/sc2/src/sc2code/libs/vidlib.h b/sc2/src/sc2code/libs/vidlib.h index 250e32662..d8d2d5b74 100644 --- a/sc2/src/sc2code/libs/vidlib.h +++ b/sc2/src/sc2code/libs/vidlib.h @@ -49,6 +49,7 @@ extern VIDEO_REF VidPlaying (void); extern void VidDoInput (void); LEGACY_VIDEO LoadLegacyVideoInstance (RESOURCE res); +BOOLEAN PlayLegacyVideo (LEGACY_VIDEO vid); BOOLEAN DestroyLegacyVideo (LEGACY_VIDEO vid); #endif /* _VIDLIB_H */