Implement the freeze-frame for .ani-based ship spins.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2798 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2007-07-08 23:15:36 +00:00
parent 3834011d08
commit bda96e731e
2 changed files with 55 additions and 13 deletions
+20 -5
View File
@@ -58,19 +58,34 @@ DoShipSpin (COUNT index, MUSIC_REF hMusic)
sprintf (snbuf, "slides/spins/ship%02u.aif", (unsigned)index); sprintf (snbuf, "slides/spins/ship%02u.aif", (unsigned)index);
if (optWhichIntro == OPT_PC || !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; FRAME p, f;
sprintf (vnbuf, "slides/spins/ship%02u.ani", (unsigned)index); /* Display Standby frame */
f = CaptureDrawable (LoadGraphicFile (vnbuf)); p = CaptureDrawable (LoadGraphicFile ("slides/spins/ship.0.ani"));
if (f) if (p)
{ {
STAMP prologue;
prologue.origin.x = SCREEN_WIDTH >> 1;
prologue.origin.y = SCREEN_HEIGHT >> 1;
prologue.frame = p;
DrawStamp (&prologue);
}
clut_buf[0] = FadeAllToColor; clut_buf[0] = FadeAllToColor;
XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 20); XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 20);
FlushColorXForms (); FlushColorXForms ();
sprintf (vnbuf, "slides/spins/ship%02u.ani", (unsigned)index);
f = CaptureDrawable (LoadGraphicFile (vnbuf));
if (f)
{
ShowShipAnim (f); ShowShipAnim (f);
}
DestroyDrawable (ReleaseDrawable (f)); DestroyDrawable (ReleaseDrawable (f));
} DestroyDrawable (ReleaseDrawable (p));
clut_buf[0] = FadeAllToBlack; clut_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4)); SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4));
FlushColorXForms (); FlushColorXForms ();
+30 -3
View File
@@ -76,6 +76,7 @@ typedef struct {
/* Spinanim state */ /* Spinanim state */
STAMP anim; STAMP anim;
TimeCount last_time; TimeCount last_time;
int debounce;
} SPINANIM_INPUT_STATE; } SPINANIM_INPUT_STATE;
static BOOLEAN DoPresentation (void *pIS); static BOOLEAN DoPresentation (void *pIS);
@@ -775,16 +776,41 @@ DoSpinAnim (void *pIS)
{ {
SPINANIM_INPUT_STATE *pSIS = (SPINANIM_INPUT_STATE *)pIS; SPINANIM_INPUT_STATE *pSIS = (SPINANIM_INPUT_STATE *)pIS;
STAMP *s = &pSIS->anim; STAMP *s = &pSIS->anim;
int f = GetFrameIndex (s->frame);
if (AnyButtonPress (FALSE) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|| (GLOBAL (CurrentActivity) & CHECK_ABORT))
{ {
return FALSE; return FALSE;
} }
if (AnyButtonPress (FALSE) && !pSIS->debounce)
{
pSIS->debounce = 15;
if (f < 299)
{
f = 299;
s->frame = SetAbsFrameIndex (s->frame, 299);
}
else if (f == 299)
{
f = 300;
s->frame = SetAbsFrameIndex (s->frame, 300);
}
else
{
return FALSE;
}
}
else
{
if (pSIS->debounce) --pSIS->debounce;
}
DrawStamp (s); DrawStamp (s);
if (f != 299)
{
s->frame = SetRelFrameIndex (s->frame, 1); s->frame = SetRelFrameIndex (s->frame, 1);
}
if (GetFrameIndex (s->frame) == 0) if (GetFrameIndex (s->frame) == 0)
{ {
@@ -805,6 +831,7 @@ ShowShipAnim (FRAME anim)
is.anim.origin.y = SCREEN_HEIGHT >> 1; is.anim.origin.y = SCREEN_HEIGHT >> 1;
is.anim.frame = anim; is.anim.frame = anim;
is.last_time = GetTimeCounter (); is.last_time = GetTimeCounter ();
is.debounce = 15;
is.InputFunc = DoSpinAnim; is.InputFunc = DoSpinAnim;
is.MenuRepeatDelay = 0; is.MenuRepeatDelay = 0;