Basic support for .ani based ship spins.
At the moment there are no pauseframes or annotations. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2764 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Changes towards version 0.7:
|
||||
- Basic support for .ani-based shipspin animations - Michael
|
||||
- Fixed some Melnorme history info timestamps - Alex
|
||||
- Fixed Ur-Quan story timestamps, from Vlad-Ceru Opran
|
||||
- Removed the 256-frame limit on .ani files - Michael
|
||||
|
||||
+19
-1
@@ -56,7 +56,25 @@ DoShipSpin (COUNT index, MUSIC_REF hMusic)
|
||||
|
||||
sprintf (vnbuf, "slides/spins/ship%02u.duk", (unsigned)index);
|
||||
sprintf (snbuf, "slides/spins/ship%02u.aif", (unsigned)index);
|
||||
DoFMVEx (vnbuf, "slides/spins/spin.aif", snbuf, SHIP_SPIN_LOOP_FRAME);
|
||||
if (optWhichIntro == OPT_PC || !DoFMVEx (vnbuf, "slides/spins/spin.aif", snbuf, SHIP_SPIN_LOOP_FRAME))
|
||||
{
|
||||
FRAME f;
|
||||
sprintf (vnbuf, "slides/spins/ship%02u.ani", (unsigned)index);
|
||||
f = CaptureDrawable (LoadGraphicFile (vnbuf));
|
||||
if (f)
|
||||
{
|
||||
clut_buf[0] = FadeAllToColor;
|
||||
XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 20);
|
||||
FlushColorXForms ();
|
||||
|
||||
ShowShipAnim (f);
|
||||
|
||||
DestroyDrawable (ReleaseDrawable (f));
|
||||
}
|
||||
clut_buf[0] = FadeAllToBlack;
|
||||
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4));
|
||||
FlushColorXForms ();
|
||||
}
|
||||
|
||||
GetContextClipRect (&old_r);
|
||||
r.corner.x = r.corner.y = 0;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#define _FMV_H
|
||||
|
||||
#include "libs/compiler.h"
|
||||
#include "libs/sndlib.h"
|
||||
#include "libs/gfxlib.h"
|
||||
#define WANT_SHIP_SPINS
|
||||
|
||||
extern void Logo (void);
|
||||
@@ -25,7 +27,6 @@ extern void SplashScreen (void (* DoProcessing)(DWORD TimeOut));
|
||||
extern void Introduction (void);
|
||||
extern void Victory (void);
|
||||
|
||||
#include "libs/sndlib.h"
|
||||
extern void DoShipSpin (COUNT index, MUSIC_REF hMusic);
|
||||
|
||||
extern BOOLEAN DoFMV (const char *name);
|
||||
@@ -35,6 +36,7 @@ extern BOOLEAN DoFMVEx (const char *name, const char *audname,
|
||||
extern BOOLEAN ShowPresentation (STRING PresStr);
|
||||
extern BOOLEAN ShowPresentationFile (const char *name);
|
||||
|
||||
extern BOOLEAN ShowShipAnim (FRAME anim);
|
||||
|
||||
#endif /* _FMV_H */
|
||||
|
||||
|
||||
+55
-1
@@ -68,9 +68,18 @@ typedef struct
|
||||
|
||||
} PRESENTATION_INPUT_STATE;
|
||||
|
||||
typedef struct {
|
||||
/* standard state required by DoInput */
|
||||
BOOLEAN (*InputFunc) (void *pInputState);
|
||||
COUNT MenuRepeatDelay;
|
||||
|
||||
/* Spinanim state */
|
||||
STAMP anim;
|
||||
TimeCount last_time;
|
||||
} SPINANIM_INPUT_STATE;
|
||||
|
||||
static BOOLEAN DoPresentation (void *pIS);
|
||||
|
||||
static BOOLEAN DoSpinAnim (void *pIS);
|
||||
|
||||
BOOLEAN
|
||||
DoFMVEx (const char *name, const char *audname, const char *speechname,
|
||||
@@ -758,4 +767,49 @@ ShowPresentation (STRING PresStr)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* This needs expansion; in particular, it needs to handle pause
|
||||
* frames and annotations */
|
||||
|
||||
static BOOLEAN
|
||||
DoSpinAnim (void *pIS)
|
||||
{
|
||||
SPINANIM_INPUT_STATE *pSIS = (SPINANIM_INPUT_STATE *)pIS;
|
||||
STAMP *s = &pSIS->anim;
|
||||
|
||||
if (AnyButtonPress (FALSE)
|
||||
|| (GLOBAL (CurrentActivity) & CHECK_ABORT))
|
||||
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DrawStamp (s);
|
||||
s->frame = SetRelFrameIndex (s->frame, 1);
|
||||
|
||||
if (GetFrameIndex(s->frame) == 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SleepThread (pSIS->last_time + ONE_SECOND / 30 - GetTimeCounter ());
|
||||
pSIS->last_time = GetTimeCounter ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
ShowShipAnim (FRAME anim)
|
||||
{
|
||||
SPINANIM_INPUT_STATE is;
|
||||
|
||||
is.anim.origin.x = SCREEN_WIDTH >> 1;
|
||||
is.anim.origin.y = SCREEN_HEIGHT >> 1;
|
||||
is.anim.frame = anim;
|
||||
is.last_time = GetTimeCounter ();
|
||||
|
||||
is.InputFunc = DoSpinAnim;
|
||||
is.MenuRepeatDelay = 0;
|
||||
|
||||
DoInput (&is, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user