Screen fade task retired; also replace XFormColorMap() hacks with a separate new call FadeScreen()

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3412 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2009-12-10 08:23:51 +00:00
parent 2d13f9a9d7
commit 1d508c0b4c
16 changed files with 102 additions and 192 deletions
+3 -2
View File
@@ -258,7 +258,7 @@ extern HOT_SPOT MAKE_HOT_SPOT (COORD, COORD);
extern INTERSECT_CODE BoxIntersect (RECT *pr1, RECT *pr2, RECT *printer); extern INTERSECT_CODE BoxIntersect (RECT *pr1, RECT *pr2, RECT *printer);
extern void BoxUnion (RECT *pr1, RECT *pr2, RECT *punion); extern void BoxUnion (RECT *pr1, RECT *pr2, RECT *punion);
enum typedef enum
{ {
FadeAllToWhite = 250, FadeAllToWhite = 250,
FadeSomeToWhite, FadeSomeToWhite,
@@ -266,7 +266,7 @@ enum
FadeAllToColor, FadeAllToColor,
FadeSomeToBlack, FadeSomeToBlack,
FadeSomeToColor FadeSomeToColor
}; } ScreenFadeType;
extern BOOLEAN InitGraphics (int argc, char *argv[], COUNT extern BOOLEAN InitGraphics (int argc, char *argv[], COUNT
KbytesRequired); KbytesRequired);
@@ -356,6 +356,7 @@ extern DRAWABLE GetFrameParentDrawable (FRAME Frame);
extern BOOLEAN SetColorMap (COLORMAPPTR ColorMapPtr); extern BOOLEAN SetColorMap (COLORMAPPTR ColorMapPtr);
extern DWORD XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval); extern DWORD XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval);
extern DWORD FadeScreen (ScreenFadeType fadeType, SIZE TimeInterval);
extern void FlushColorXForms (void); extern void FlushColorXForms (void);
#define InitColorMapResources InitStringTableResources #define InitColorMapResources InitStringTableResources
#define LoadColorMapFile LoadStringTableFile #define LoadColorMapFile LoadStringTableFile
+54 -72
View File
@@ -17,23 +17,12 @@
*/ */
#include "gfx_common.h" #include "gfx_common.h"
#include "libs/tasklib.h" #include "libs/timelib.h"
#include "libs/inplib.h" #include "libs/inplib.h"
#include "libs/log.h" #include "libs/log.h"
#include <string.h> #include <string.h>
static struct
{
COLORMAPPTR CMapPtr;
SIZE Ticks;
union
{
COUNT NumCycles;
Task XFormTask;
} tc;
} FadeControl;
typedef struct xform_control typedef struct xform_control
{ {
int CMapIndex; // -1 means unused int CMapIndex; // -1 means unused
@@ -53,8 +42,10 @@ static struct
Mutex Lock; Mutex Lock;
} XFormControl; } XFormControl;
volatile int FadeAmount = FADE_NORMAL_INTENSITY; static int fadeAmount = FADE_NORMAL_INTENSITY;
static volatile int FadeEnd, XForming; static int fadeDelta;
static TimeCount fadeStartTime;
static sint32 fadeInterval;
#define SPARE_COLORMAPS 20 #define SPARE_COLORMAPS 20
#define MAP_POOL_SIZE (MAX_COLORMAPS + SPARE_COLORMAPS) #define MAP_POOL_SIZE (MAX_COLORMAPS + SPARE_COLORMAPS)
@@ -313,63 +304,59 @@ SetColorMap (COLORMAPPTR map)
/* Fade Transforms */ /* Fade Transforms */
static int int
fade_xform_task (void *data) GetFadeAmount (void)
{ {
SIZE TDelta, TTotal; int newAmount;
DWORD CurTime;
Task task = (Task)data;
XForming = TRUE; LockMutex (XFormControl.Lock);
while (FadeControl.tc.XFormTask == 0
&& (!Task_ReadState (task, TASK_EXIT)))
TaskSwitch ();
TTotal = FadeControl.Ticks;
FadeControl.tc.XFormTask = 0;
{ if (fadeInterval)
CurTime = GetTimeCounter (); { // have a pending fade
do TimeCount Now = GetTimeCounter ();
{ sint32 elapsed;
DWORD StartTime;
StartTime = CurTime; elapsed = Now - fadeStartTime;
SleepThreadUntil (CurTime + ONE_SECOND / 60); if (elapsed > fadeInterval)
CurTime = GetTimeCounter (); elapsed = fadeInterval;
if (!XForming || (TDelta = (SIZE)(CurTime - StartTime)) > TTotal)
TDelta = TTotal;
FadeAmount += (FadeEnd - FadeAmount) * TDelta / TTotal; newAmount = fadeAmount + (long)fadeDelta * elapsed / fadeInterval;
//log_add (log_Debug, "fade_xform_task FadeAmount %d\n", FadeAmount);
} while ((TTotal -= TDelta) && (!Task_ReadState (task, TASK_EXIT))); if (elapsed >= fadeInterval)
{ // fade is over
fadeAmount = newAmount;
fadeInterval = 0;
}
}
else
{ // no fade pending, return the current
newAmount = fadeAmount;
} }
XForming = FALSE; UnlockMutex (XFormControl.Lock);
FinishTask (task); return newAmount;
return 0;
} }
static void static void
FlushFadeXForms (void) FlushFadeXForms (void)
{ {
if (XForming) LockMutex (XFormControl.Lock);
{ if (fadeInterval)
XForming = FALSE; { // end the fade immediately
TaskSwitch (); fadeAmount += fadeDelta;
fadeInterval = 0;
} }
UnlockMutex (XFormControl.Lock);
} }
static DWORD DWORD
XFormFade (COLORMAPPTR ColorMapPtr, SIZE TimeInterval) FadeScreen (ScreenFadeType fadeType, SIZE TimeInterval)
{ {
BYTE what; TimeCount TimeOut;
DWORD TimeOut; int FadeEnd;
FlushFadeXForms (); switch (fadeType)
what = *ColorMapPtr;
switch (what)
{ {
case FadeAllToBlack: case FadeAllToBlack:
case FadeSomeToBlack: case FadeSomeToBlack:
@@ -387,24 +374,26 @@ XFormFade (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
return (GetTimeCounter ()); return (GetTimeCounter ());
} }
FadeControl.Ticks = TimeInterval; LockMutex (XFormControl.Lock);
if (FadeControl.Ticks <= 0 ||
(FadeControl.tc.XFormTask = AssignTask (fade_xform_task, if (TimeInterval <= 0)
1024, "fade transform")) == 0) { // end the fade immediately
{ fadeAmount = FadeEnd;
FadeAmount = FadeEnd; // cancel any pending fades
fadeInterval = 0;
TimeOut = GetTimeCounter (); TimeOut = GetTimeCounter ();
} }
else else
{ {
do fadeInterval = TimeInterval;
TaskSwitch (); fadeDelta = FadeEnd - fadeAmount;
while (FadeControl.tc.XFormTask); fadeStartTime = GetTimeCounter ();
TimeOut = fadeStartTime + TimeInterval + 1;
TimeOut = GetTimeCounter () + TimeInterval + 1;
} }
return (TimeOut); UnlockMutex (XFormControl.Lock);
return TimeOut;
} }
/* Colormap Transforms */ /* Colormap Transforms */
@@ -598,22 +587,15 @@ XFormPLUT (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
return (EndTime); return (EndTime);
} }
DWORD DWORD
XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval) XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval)
{ {
int what;
if (!ColorMapPtr) if (!ColorMapPtr)
return (0); return (0);
if (QuitPosted) // Don't make users wait for fades if (QuitPosted) // Don't make users wait for fades
TimeInterval = 0; TimeInterval = 0;
what = *ColorMapPtr;
if (what >= (int)FadeAllToWhite && what <= (int)FadeSomeToColor)
return XFormFade (ColorMapPtr, TimeInterval);
else
return XFormPLUT (ColorMapPtr, TimeInterval); return XFormPLUT (ColorMapPtr, TimeInterval);
} }
+1 -1
View File
@@ -47,7 +47,7 @@ typedef struct tfb_colormap
struct tfb_colormap *next; struct tfb_colormap *next;
} TFB_ColorMap; } TFB_ColorMap;
extern volatile int FadeAmount; extern int GetFadeAmount (void);
extern void InitColorMaps (void); extern void InitColorMaps (void);
extern void UninitColorMaps (void); extern void UninitColorMaps (void);
+2 -2
View File
@@ -253,7 +253,7 @@ TFB_SwapBuffers (int force_full_redraw)
static int last_fade_amount = 255, last_transition_amount = 255; static int last_fade_amount = 255, last_transition_amount = 255;
static int fade_amount = 255, transition_amount = 255; static int fade_amount = 255, transition_amount = 255;
fade_amount = FadeAmount; fade_amount = GetFadeAmount ();
transition_amount = TransitionAmount; transition_amount = TransitionAmount;
if (force_full_redraw == TFB_REDRAW_NO && !TFB_BBox.valid && if (force_full_redraw == TFB_REDRAW_NO && !TFB_BBox.valid &&
@@ -618,7 +618,7 @@ TFB_FlushGraphics (void) // Only call from main thread!!
{ {
static int last_fade = 255; static int last_fade = 255;
static int last_transition = 255; static int last_transition = 255;
int current_fade = FadeAmount; int current_fade = GetFadeAmount ();
int current_transition = TransitionAmount; int current_transition = TransitionAmount;
if ((current_fade != 255 && current_fade != last_fade) || if ((current_fade != 255 && current_fade != last_fade) ||
+1 -2
View File
@@ -750,9 +750,8 @@ CommIntroTransition (void)
} }
else if (curIntroMode == CIM_FADE_IN_SCREEN) else if (curIntroMode == CIM_FADE_IN_SCREEN)
{ {
BYTE clut_buf[] = {FadeAllToColor};
UnbatchGraphics (); UnbatchGraphics ();
XFormColorMap ((COLORMAPPTR)clut_buf, fadeTime); FadeScreen (FadeAllToColor, fadeTime);
} }
else else
{ // Uknown transition { // Uknown transition
+2 -5
View File
@@ -776,7 +776,6 @@ on_input_frame (void)
void void
Credits (BOOLEAN WithOuttakes) Credits (BOOLEAN WithOuttakes)
{ {
BYTE fade_buf[1];
MUSIC_REF hMusic; MUSIC_REF hMusic;
CREDITS_INPUT_STATE cis; CREDITS_INPUT_STATE cis;
RECT screenRect; RECT screenRect;
@@ -801,8 +800,7 @@ Credits (BOOLEAN WithOuttakes)
s.frame = CreditsBack; s.frame = CreditsBack;
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
DrawStamp (&s); DrawStamp (&s);
fade_buf[0] = FadeAllToColor; FadeScreen (FadeAllToColor, ONE_SECOND / 2);
XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
// set the position of outtakes comm // set the position of outtakes comm
@@ -842,8 +840,7 @@ Credits (BOOLEAN WithOuttakes)
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
SetContext (ScreenContext); SetContext (ScreenContext);
fade_buf[0] = FadeAllToBlack; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2));
FlushColorXForms (); FlushColorXForms ();
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
+9 -26
View File
@@ -35,14 +35,12 @@ DoShipSpin (COUNT index, MUSIC_REF hMusic)
{ {
#ifdef WANT_SHIP_SPINS #ifdef WANT_SHIP_SPINS
char vnbuf[32]; char vnbuf[32];
BYTE clut_buf[1];
RECT old_r; RECT old_r;
LoadIntoExtraScreen (NULL); LoadIntoExtraScreen (NULL);
#if 0 #if 0
/* This is cut out right now but should be part of the 3DO side */ /* This is cut out right now but should be part of the 3DO side */
clut_buf[0] = FadeAllToBlack; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 4));
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4));
FlushColorXForms (); FlushColorXForms ();
#endif #endif
@@ -55,8 +53,7 @@ DoShipSpin (COUNT index, MUSIC_REF hMusic)
sprintf (vnbuf, "slides.spins.%02u", (unsigned)index); sprintf (vnbuf, "slides.spins.%02u", (unsigned)index);
ShowPresentation (vnbuf); ShowPresentation (vnbuf);
clut_buf[0] = FadeAllToBlack; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 4));
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4));
FlushColorXForms (); FlushColorXForms ();
GetContextClipRect (&old_r); GetContextClipRect (&old_r);
@@ -67,8 +64,7 @@ DoShipSpin (COUNT index, MUSIC_REF hMusic)
if (hMusic) if (hMusic)
PlayMusic (hMusic, TRUE, 1); PlayMusic (hMusic, TRUE, 1);
clut_buf[0] = FadeAllToColor; SleepThreadUntil (FadeScreen (FadeAllToColor, ONE_SECOND / 4));
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 4));
FlushColorXForms (); FlushColorXForms ();
#else #else
(void) index; /* Satisfy compiler */ (void) index; /* Satisfy compiler */
@@ -79,13 +75,10 @@ DoShipSpin (COUNT index, MUSIC_REF hMusic)
void void
SplashScreen (void (* DoProcessing)(DWORD TimeOut)) SplashScreen (void (* DoProcessing)(DWORD TimeOut))
{ {
BYTE xform_buf[1];
STAMP s; STAMP s;
DWORD TimeOut; DWORD TimeOut;
xform_buf[0] = FadeAllToBlack; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 120));
SleepThreadUntil (XFormColorMap (
(COLORMAPPTR) xform_buf, ONE_SECOND / 120));
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
SetContext (ScreenContext); SetContext (ScreenContext);
s.origin.x = s.origin.y = 0; s.origin.x = s.origin.y = 0;
@@ -94,8 +87,7 @@ SplashScreen (void (* DoProcessing)(DWORD TimeOut))
DestroyDrawable (ReleaseDrawable (s.frame)); DestroyDrawable (ReleaseDrawable (s.frame));
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
xform_buf[0] = FadeAllToColor; TimeOut = FadeScreen (FadeAllToColor, ONE_SECOND / 2);
TimeOut = XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2);
if (DoProcessing) if (DoProcessing)
DoProcessing (TimeOut); DoProcessing (TimeOut);
@@ -118,35 +110,26 @@ SplashScreen (void (* DoProcessing)(DWORD TimeOut))
} }
GLOBAL (CurrentActivity) &= ~CHECK_ABORT; GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
xform_buf[0] = FadeAllToBlack; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2));
} }
void void
Introduction (void) Introduction (void)
{ {
BYTE xform_buf[1];
ShowPresentation (INTROPRES_STRTAB); ShowPresentation (INTROPRES_STRTAB);
SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
xform_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2));
} }
void void
Victory (void) Victory (void)
{ {
BYTE xform_buf[1]; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
xform_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2));
/* by default we do 3DO cinematics; or PC slides when 3DO files are /* by default we do 3DO cinematics; or PC slides when 3DO files are
* not present */ * not present */
ShowPresentation (FINALPRES_STRTAB); ShowPresentation (FINALPRES_STRTAB);
xform_buf[0] = FadeAllToBlack; FadeScreen (FadeAllToBlack, 0);
XFormColorMap ((COLORMAPPTR)xform_buf, 0);
} }
void void
+1 -3
View File
@@ -1052,10 +1052,8 @@ ChangeGameSelection:
} }
if (LastActivity == CHECK_LOAD && first_time) if (LastActivity == CHECK_LOAD && first_time)
{ {
BYTE clut_buf[] = {FadeAllToColor};
UnbatchGraphics (); UnbatchGraphics ();
XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2); FadeScreen (FadeAllToColor, ONE_SECOND / 2);
} }
else else
{ {
+4 -11
View File
@@ -114,12 +114,11 @@ ParseColorString (const char *Src, Color* pColor)
static BOOLEAN static BOOLEAN
DoFadeScreen (PRESENTATION_INPUT_STATE* pPIS, const char *Src, BYTE FadeType) DoFadeScreen (PRESENTATION_INPUT_STATE* pPIS, const char *Src, BYTE FadeType)
{ {
BYTE xform_buf[1] = {FadeType};
int msecs; int msecs;
if (1 == sscanf (Src, "%d", &msecs)) if (1 == sscanf (Src, "%d", &msecs))
{ {
pPIS->TimeOut = XFormColorMap ((COLORMAPPTR) xform_buf, pPIS->TimeOut = FadeScreen (FadeType, msecs * ONE_SECOND / 1000)
(SIZE)(msecs * ONE_SECOND / 1000)) + ONE_SECOND / 10; + ONE_SECOND / 10;
pPIS->TimeOutOnSkip = FALSE; pPIS->TimeOutOnSkip = FALSE;
} }
return TRUE; return TRUE;
@@ -851,11 +850,7 @@ DoVideoInput (void *pIS)
static void static void
FadeClearScreen (void) FadeClearScreen (void)
{ {
BYTE xform_buf[1]; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
xform_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap (
(COLORMAPPTR) xform_buf, ONE_SECOND / 2));
// clear the screen with black // clear the screen with black
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
@@ -864,9 +859,7 @@ FadeClearScreen (void)
ClearDrawable (); ClearDrawable ();
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
// fade in black rect instantly FadeScreen (FadeAllToColor, 0);
xform_buf[0] = FadeAllToColor;
XFormColorMap ((COLORMAPPTR) xform_buf, 0);
} }
static BOOLEAN static BOOLEAN
+5 -14
View File
@@ -1678,11 +1678,9 @@ static void
StartMelee (MELEE_STATE *pMS) StartMelee (MELEE_STATE *pMS)
{ {
{ {
BYTE black_buf[] = {FadeAllToBlack};
FadeMusic (0, ONE_SECOND / 2); FadeMusic (0, ONE_SECOND / 2);
SleepThreadUntil (XFormColorMap ( SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2)
(COLORMAPPTR)black_buf, ONE_SECOND / 2) + ONE_SECOND / 60); + ONE_SECOND / 60);
FlushColorXForms (); FlushColorXForms ();
StopMusic (); StopMusic ();
} }
@@ -1712,14 +1710,10 @@ StartMelee (MELEE_STATE *pMS)
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
return; return;
{ SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2)
BYTE black_buf[] = { FadeAllToBlack };
SleepThreadUntil (XFormColorMap (
(COLORMAPPTR)black_buf, ONE_SECOND / 2)
+ ONE_SECOND / 60); + ONE_SECOND / 60);
FlushColorXForms (); FlushColorXForms ();
}
} while (0 /* !(GLOBAL (CurrentActivity) & CHECK_ABORT) */); } while (0 /* !(GLOBAL (CurrentActivity) & CHECK_ABORT) */);
GLOBAL (CurrentActivity) = SUPER_MELEE; GLOBAL (CurrentActivity) = SUPER_MELEE;
@@ -2099,11 +2093,8 @@ DoMelee (MELEE_STATE *pMS)
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
InitMelee (pMS); InitMelee (pMS);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
{
BYTE clut_buf[] = {FadeAllToColor};
XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2); FadeScreen (FadeAllToColor, ONE_SECOND / 2);
}
pMS->LastInputTime = GetTimeCounter (); pMS->LastInputTime = GetTimeCounter ();
return TRUE; return TRUE;
} }
+2 -5
View File
@@ -696,12 +696,9 @@ GetInitialMeleeStarShips (HSTARSHIP *result)
} }
// Fade in // Fade in
{ SleepThreadUntil (FadeScreen (FadeAllToColor, ONE_SECOND / 2)
BYTE fade_buf[] = {FadeAllToColor}; + ONE_SECOND / 60);
SleepThreadUntil (XFormColorMap
((COLORMAPPTR) fade_buf, ONE_SECOND / 2) + ONE_SECOND / 60);
FlushColorXForms (); FlushColorXForms ();
}
playerMask = 0; playerMask = 0;
for (playerI = 0; playerI < NUM_PLAYERS; playerI++) for (playerI = 0; playerI < NUM_PLAYERS; playerI++)
+2 -7
View File
@@ -306,19 +306,14 @@ DeviceFailed (BYTE which_device)
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
&& playerInPlanetOrbit ()) && playerInPlanetOrbit ())
{ {
BYTE fade_buf[1];
PlayMenuSound (MENU_SOUND_INVOKED); PlayMenuSound (MENU_SOUND_INVOKED);
fade_buf[0] = FadeAllToWhite; SleepThreadUntil (FadeScreen (FadeAllToWhite, ONE_SECOND * 1)
SleepThreadUntil (
XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND * 1)
+ (ONE_SECOND * 2)); + (ONE_SECOND * 2));
if (CurStarDescPtr->Index != CHMMR_DEFINED if (CurStarDescPtr->Index != CHMMR_DEFINED
|| pSolarSysState->pOrbitalDesc != || pSolarSysState->pOrbitalDesc !=
&pSolarSysState->PlanetDesc[1]) &pSolarSysState->PlanetDesc[1])
{ {
fade_buf[0] = FadeAllToColor; FadeScreen (FadeAllToColor, ONE_SECOND * 2);
XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND * 2);
} }
else else
{ {
+1 -3
View File
@@ -239,9 +239,7 @@ ZapToUrquanEncounter (void)
{ {
#define LOST_DAYS 15 #define LOST_DAYS 15
BYTE black_buf[] = {FadeAllToBlack}; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND * 2));
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf, ONE_SECOND * 2));
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
MoveGameClockDays (LOST_DAYS); MoveGameClockDays (LOST_DAYS);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
+1 -3
View File
@@ -1379,12 +1379,10 @@ InitSolarSys (void)
if (LastActivity == (CHECK_LOAD | CHECK_RESTART)) if (LastActivity == (CHECK_LOAD | CHECK_RESTART))
{ // Starting a new game, NOT from load! { // Starting a new game, NOT from load!
// We have to fade the screen in from intro or menu // We have to fade the screen in from intro or menu
BYTE clut_buf[] = {FadeAllToColor};
DrawOuterSystem (); DrawOuterSystem ();
RedrawQueue (FALSE); RedrawQueue (FALSE);
UnbatchGraphics (); UnbatchGraphics ();
XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2); FadeScreen (FadeAllToColor, ONE_SECOND / 2);
LastActivity = 0; LastActivity = 0;
} }
+7 -23
View File
@@ -141,11 +141,7 @@ DoRestart (MENU_STATE *pMS)
LastInputTime = GetTimeCounter (); LastInputTime = GetTimeCounter ();
pMS->Initialized = TRUE; pMS->Initialized = TRUE;
{ SleepThreadUntil (FadeScreen (FadeAllToColor, ONE_SECOND / 2));
BYTE clut_buf[] = {FadeAllToColor};
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf,
ONE_SECOND / 2));
}
} }
else if (GLOBAL (CurrentActivity) & CHECK_ABORT) else if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{ {
@@ -153,8 +149,6 @@ DoRestart (MENU_STATE *pMS)
} }
else if (PulsedInputState.menu[KEY_MENU_SELECT]) else if (PulsedInputState.menu[KEY_MENU_SELECT])
{ {
BYTE fade_buf[1];
switch (pMS->CurState) switch (pMS->CurState)
{ {
case LOAD_SAVED_GAME: case LOAD_SAVED_GAME:
@@ -185,10 +179,7 @@ DoRestart (MENU_STATE *pMS)
UnbatchGraphics (); UnbatchGraphics ();
return TRUE; return TRUE;
case QUIT_GAME: case QUIT_GAME:
fade_buf[0] = FadeAllToBlack; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
SleepThreadUntil (XFormColorMap (
(COLORMAPPTR)fade_buf, ONE_SECOND / 2));
GLOBAL (CurrentActivity) = CHECK_ABORT; GLOBAL (CurrentActivity) = CHECK_ABORT;
break; break;
} }
@@ -270,13 +261,10 @@ static BOOLEAN
RestartMenu (MENU_STATE *pMS) RestartMenu (MENU_STATE *pMS)
{ {
TimeCount TimeOut; TimeCount TimeOut;
BYTE black_buf[1];
ReinitQueue (&race_q[0]); ReinitQueue (&race_q[0]);
ReinitQueue (&race_q[1]); ReinitQueue (&race_q[1]);
black_buf[0] = FadeAllToBlack;
SetContext (ScreenContext); SetContext (ScreenContext);
GLOBAL (CurrentActivity) |= CHECK_ABORT; GLOBAL (CurrentActivity) |= CHECK_ABORT;
@@ -284,12 +272,10 @@ RestartMenu (MENU_STATE *pMS)
&& GET_GAME_STATE (UTWIG_BOMB_ON_SHIP) && GET_GAME_STATE (UTWIG_BOMB_ON_SHIP)
&& !GET_GAME_STATE (UTWIG_BOMB)) && !GET_GAME_STATE (UTWIG_BOMB))
{ // player blew himself up with Utwig bomb { // player blew himself up with Utwig bomb
BYTE white_buf[] = {FadeAllToWhite};
SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0); SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0);
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)white_buf, SleepThreadUntil (FadeScreen (FadeAllToWhite, ONE_SECOND / 8)
ONE_SECOND / 8) + ONE_SECOND / 60); + ONE_SECOND / 60);
SetContextBackGroundColor ( SetContextBackGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)); BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F));
ClearDrawable (); ClearDrawable ();
@@ -316,7 +302,7 @@ RestartMenu (MENU_STATE *pMS)
LastActivity = 0; LastActivity = 0;
NextActivity = 0; NextActivity = 0;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf, TimeOut)); SleepThreadUntil (FadeScreen (FadeAllToBlack, TimeOut));
if (TimeOut == ONE_SECOND / 8) if (TimeOut == ONE_SECOND / 8)
SleepThread (ONE_SECOND * 3); SleepThread (ONE_SECOND * 3);
DrawRestartMenuGraphic (pMS); DrawRestartMenuGraphic (pMS);
@@ -341,7 +327,7 @@ RestartMenu (MENU_STATE *pMS)
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
return (FALSE); // quit return (FALSE); // quit
TimeOut = XFormColorMap ((COLORMAPPTR)black_buf, ONE_SECOND / 2); TimeOut = FadeScreen (FadeAllToBlack, ONE_SECOND / 2);
SleepThreadUntil (TimeOut); SleepThreadUntil (TimeOut);
FlushColorXForms (); FlushColorXForms ();
@@ -373,9 +359,7 @@ TryStartGame (void)
} }
else if (GLOBAL (CurrentActivity) == (ACTIVITY)~0) else if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
{ // timed out { // timed out
BYTE black_buf[] = {FadeAllToBlack}; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND / 2));
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf,
ONE_SECOND / 2));
return (FALSE); return (FALSE);
} }
else if (GLOBAL (CurrentActivity) & CHECK_ABORT) else if (GLOBAL (CurrentActivity) & CHECK_ABORT)
+2 -8
View File
@@ -443,10 +443,7 @@ static void
DoTimePassage (void) DoTimePassage (void)
{ {
#define LOST_DAYS 14 #define LOST_DAYS 14
BYTE clut_buf[1]; SleepThreadUntil (FadeScreen (FadeAllToBlack, ONE_SECOND * 2));
clut_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND * 2));
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
MoveGameClockDays (LOST_DAYS); MoveGameClockDays (LOST_DAYS);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
@@ -556,8 +553,6 @@ CleanupAfterStarBase (void)
void void
InstallBombAtEarth (void) InstallBombAtEarth (void)
{ {
BYTE clut_buf[1];
DoTimePassage (); DoTimePassage ();
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
@@ -567,8 +562,7 @@ InstallBombAtEarth (void)
ClearDrawable (); ClearDrawable ();
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
clut_buf[0] = FadeAllToColor; SleepThreadUntil (FadeScreen (FadeAllToColor, 0));
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, 0));
SET_GAME_STATE (CHMMR_BOMB_STATE, 3); /* bomb processed */ SET_GAME_STATE (CHMMR_BOMB_STATE, 3); /* bomb processed */
GLOBAL (CurrentActivity) = CHECK_LOAD; /* fake a load game */ GLOBAL (CurrentActivity) = CHECK_LOAD; /* fake a load game */