Move DoFMV and its friends into the video library.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3102 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2008-11-29 04:09:20 +00:00
parent 460aaa5b56
commit 7ef692df98
6 changed files with 45 additions and 51 deletions
+1 -5
View File
@@ -30,10 +30,6 @@
#include "libs/graphics/gfx_common.h" #include "libs/graphics/gfx_common.h"
#include "libs/inplib.h" #include "libs/inplib.h"
/* Some ship spin animations contain extra frames that must be discarded. */
#define SHIP_SPIN_LOOP_FRAME 89
void void
DoShipSpin (COUNT index, MUSIC_REF hMusic) DoShipSpin (COUNT index, MUSIC_REF hMusic)
{ {
@@ -168,7 +164,7 @@ Victory (void)
void void
Logo (void) Logo (void)
{ {
DoFMV ("logo"); ShowPresentation ("slides.logo");
} }
-6
View File
@@ -26,15 +26,9 @@ extern void Logo (void);
extern void SplashScreen (void (* DoProcessing)(DWORD TimeOut)); extern void SplashScreen (void (* DoProcessing)(DWORD TimeOut));
extern void Introduction (void); extern void Introduction (void);
extern void Victory (void); extern void Victory (void);
extern void DoShipSpin (COUNT index, MUSIC_REF hMusic); 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 ShowPresentation (RESOURCE presentation);
extern BOOLEAN ShowPresentationFile (const char *name);
#endif /* _FMV_H */ #endif /* _FMV_H */
+2 -39
View File
@@ -31,9 +31,6 @@
#include "libs/inplib.h" #include "libs/inplib.h"
#include "libs/log.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 <ctype.h> #include <ctype.h>
static BOOLEAN ShowSlidePresentation (STRING PresStr); static BOOLEAN ShowSlidePresentation (STRING PresStr);
@@ -90,41 +87,6 @@ typedef struct {
static BOOLEAN DoPresentation (void *pIS); 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 static BOOLEAN
ParseColorString (const char *Src, COLOR* pColor) ParseColorString (const char *Src, COLOR* pColor)
{ {
@@ -860,8 +822,9 @@ ShowPresentation (RESOURCE res)
else if (!strcmp (resType, "3DOVID")) else if (!strcmp (resType, "3DOVID"))
{ {
LEGACY_VIDEO vid = LoadLegacyVideoInstance (res); LEGACY_VIDEO vid = LoadLegacyVideoInstance (res);
return DoFMVEx (vid->video, vid->audio, vid->speech, vid->loop); BOOLEAN result = PlayLegacyVideo (vid);
DestroyLegacyVideo (vid); DestroyLegacyVideo (vid);
return result;
} }
log_add (log_Warning, "Tried to present '%s', of non-presentable type '%s'", res, resType); log_add (log_Warning, "Tried to present '%s', of non-presentable type '%s'", res, resType);
+2 -1
View File
@@ -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"
+39
View File
@@ -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;
}
+1
View File
@@ -49,6 +49,7 @@ extern VIDEO_REF VidPlaying (void);
extern void VidDoInput (void); extern void VidDoInput (void);
LEGACY_VIDEO LoadLegacyVideoInstance (RESOURCE res); LEGACY_VIDEO LoadLegacyVideoInstance (RESOURCE res);
BOOLEAN PlayLegacyVideo (LEGACY_VIDEO vid);
BOOLEAN DestroyLegacyVideo (LEGACY_VIDEO vid); BOOLEAN DestroyLegacyVideo (LEGACY_VIDEO vid);
#endif /* _VIDLIB_H */ #endif /* _VIDLIB_H */