From bda96e731eb160516b62dfe94933274ad7860120 Mon Sep 17 00:00:00 2001 From: mcmartin Date: Sun, 8 Jul 2007 23:15:36 +0000 Subject: [PATCH] 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 --- sc2/src/sc2code/fmv.c | 29 ++++++++++++++++++++++------- sc2/src/sc2code/intro.c | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/sc2/src/sc2code/fmv.c b/sc2/src/sc2code/fmv.c index 4fc560301..2965a5acb 100644 --- a/sc2/src/sc2code/fmv.c +++ b/sc2/src/sc2code/fmv.c @@ -58,19 +58,34 @@ DoShipSpin (COUNT index, MUSIC_REF hMusic) sprintf (snbuf, "slides/spins/ship%02u.aif", (unsigned)index); if (optWhichIntro == OPT_PC || !DoFMVEx (vnbuf, "slides/spins/spin.aif", snbuf, SHIP_SPIN_LOOP_FRAME)) { - FRAME f; + FRAME p, f; + /* Display Standby frame */ + p = CaptureDrawable (LoadGraphicFile ("slides/spins/ship.0.ani")); + 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; + XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 20); + FlushColorXForms (); + 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)); } + + DestroyDrawable (ReleaseDrawable (f)); + DestroyDrawable (ReleaseDrawable (p)); + clut_buf[0] = FadeAllToBlack; SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4)); FlushColorXForms (); diff --git a/sc2/src/sc2code/intro.c b/sc2/src/sc2code/intro.c index ab7e251b6..4a0e88476 100644 --- a/sc2/src/sc2code/intro.c +++ b/sc2/src/sc2code/intro.c @@ -76,6 +76,7 @@ typedef struct { /* Spinanim state */ STAMP anim; TimeCount last_time; + int debounce; } SPINANIM_INPUT_STATE; static BOOLEAN DoPresentation (void *pIS); @@ -775,18 +776,43 @@ DoSpinAnim (void *pIS) { SPINANIM_INPUT_STATE *pSIS = (SPINANIM_INPUT_STATE *)pIS; STAMP *s = &pSIS->anim; + int f = GetFrameIndex (s->frame); - if (AnyButtonPress (FALSE) - || (GLOBAL (CurrentActivity) & CHECK_ABORT)) - + if (GLOBAL (CurrentActivity) & CHECK_ABORT) { return FALSE; } - DrawStamp (s); - s->frame = SetRelFrameIndex (s->frame, 1); + 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; + } - if (GetFrameIndex(s->frame) == 0) + DrawStamp (s); + if (f != 299) + { + s->frame = SetRelFrameIndex (s->frame, 1); + } + + if (GetFrameIndex (s->frame) == 0) { return FALSE; } @@ -805,6 +831,7 @@ ShowShipAnim (FRAME anim) is.anim.origin.y = SCREEN_HEIGHT >> 1; is.anim.frame = anim; is.last_time = GetTimeCounter (); + is.debounce = 15; is.InputFunc = DoSpinAnim; is.MenuRepeatDelay = 0;