Added new commands for animations - BATCH and UNBATCH
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1476 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -46,6 +46,7 @@ typedef struct
|
|||||||
FONT Font;
|
FONT Font;
|
||||||
FRAME Frame;
|
FRAME Frame;
|
||||||
MUSIC_REF MusicRef;
|
MUSIC_REF MusicRef;
|
||||||
|
BOOLEAN Batched;
|
||||||
COUNT OperIndex;
|
COUNT OperIndex;
|
||||||
COLOR TextFadeColor;
|
COLOR TextFadeColor;
|
||||||
COLOR TextColor;
|
COLOR TextColor;
|
||||||
@@ -148,6 +149,30 @@ ParseTextLines (TEXT *Lines, COUNT MaxLines, char* Buffer)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
Present_BatchGraphics (PRESENTATION_INPUT_STATE* pPIS)
|
||||||
|
{
|
||||||
|
if (!pPIS->Batched)
|
||||||
|
{
|
||||||
|
pPIS->Batched = TRUE;
|
||||||
|
LockMutex (GraphicsLock);
|
||||||
|
BatchGraphics ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
Present_UnbatchGraphics (PRESENTATION_INPUT_STATE* pPIS, BOOLEAN bYield)
|
||||||
|
{
|
||||||
|
if (pPIS->Batched)
|
||||||
|
{
|
||||||
|
UnbatchGraphics ();
|
||||||
|
UnlockMutex (GraphicsLock);
|
||||||
|
pPIS->Batched = FALSE;
|
||||||
|
if (bYield)
|
||||||
|
TaskSwitch ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DoPresentation (PVOID pIS)
|
DoPresentation (PVOID pIS)
|
||||||
{
|
{
|
||||||
@@ -242,6 +267,7 @@ DoPresentation (PVOID pIS)
|
|||||||
else if (strcmp (Opcode, "WAIT") == 0)
|
else if (strcmp (Opcode, "WAIT") == 0)
|
||||||
{ /* wait */
|
{ /* wait */
|
||||||
int msecs;
|
int msecs;
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
if (1 == sscanf (pStr, "%d", &msecs))
|
if (1 == sscanf (pStr, "%d", &msecs))
|
||||||
{
|
{
|
||||||
pPIS->TimeOut = GetTimeCounter ()
|
pPIS->TimeOut = GetTimeCounter ()
|
||||||
@@ -253,6 +279,7 @@ DoPresentation (PVOID pIS)
|
|||||||
else if (strcmp (Opcode, "SYNC") == 0)
|
else if (strcmp (Opcode, "SYNC") == 0)
|
||||||
{ /* absolute time-sync */
|
{ /* absolute time-sync */
|
||||||
int msecs;
|
int msecs;
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
if (1 == sscanf (pStr, "%d", &msecs))
|
if (1 == sscanf (pStr, "%d", &msecs))
|
||||||
{
|
{
|
||||||
pPIS->LastSyncTime = pPIS->StartTime
|
pPIS->LastSyncTime = pPIS->StartTime
|
||||||
@@ -269,6 +296,7 @@ DoPresentation (PVOID pIS)
|
|||||||
else if (strcmp (Opcode, "DSYNC") == 0)
|
else if (strcmp (Opcode, "DSYNC") == 0)
|
||||||
{ /* delta time-sync; from the last absolute sync */
|
{ /* delta time-sync; from the last absolute sync */
|
||||||
int msecs;
|
int msecs;
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
if (1 == sscanf (pStr, "%d", &msecs))
|
if (1 == sscanf (pStr, "%d", &msecs))
|
||||||
{
|
{
|
||||||
pPIS->TimeOut = pPIS->LastSyncTime
|
pPIS->TimeOut = pPIS->LastSyncTime
|
||||||
@@ -343,6 +371,8 @@ DoPresentation (PVOID pIS)
|
|||||||
pPIS->LinesCount = ParseTextLines (pPIS->TextLines,
|
pPIS->LinesCount = ParseTextLines (pPIS->TextLines,
|
||||||
MAX_TEXT_LINES, pPIS->Buffer);
|
MAX_TEXT_LINES, pPIS->Buffer);
|
||||||
|
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
GetContextFontLeading (&leading);
|
GetContextFontLeading (&leading);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
@@ -391,6 +421,8 @@ DoPresentation (PVOID pIS)
|
|||||||
{ /* text fade-out */
|
{ /* text fade-out */
|
||||||
COUNT i;
|
COUNT i;
|
||||||
|
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContextClipping (TRUE);
|
SetContextClipping (TRUE);
|
||||||
/* do transition */
|
/* do transition */
|
||||||
@@ -419,22 +451,35 @@ DoPresentation (PVOID pIS)
|
|||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (strcmp (Opcode, "BATCH") == 0)
|
||||||
|
{ /* batch graphics */
|
||||||
|
Present_BatchGraphics (pPIS);
|
||||||
|
}
|
||||||
|
else if (strcmp (Opcode, "UNBATCH") == 0)
|
||||||
|
{ /* unbatch graphics */
|
||||||
|
Present_UnbatchGraphics (pPIS, FALSE);
|
||||||
|
}
|
||||||
else if (strcmp (Opcode, "FTC") == 0)
|
else if (strcmp (Opcode, "FTC") == 0)
|
||||||
{ /* fade to color */
|
{ /* fade to color */
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
return DoFadeScreen (pPIS, pStr, FadeAllToColor);
|
return DoFadeScreen (pPIS, pStr, FadeAllToColor);
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "FTB") == 0)
|
else if (strcmp (Opcode, "FTB") == 0)
|
||||||
{ /* fade to black */
|
{ /* fade to black */
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
return DoFadeScreen (pPIS, pStr, FadeAllToBlack);
|
return DoFadeScreen (pPIS, pStr, FadeAllToBlack);
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "FTW") == 0)
|
else if (strcmp (Opcode, "FTW") == 0)
|
||||||
{ /* fade to white */
|
{ /* fade to white */
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
return DoFadeScreen (pPIS, pStr, FadeAllToWhite);
|
return DoFadeScreen (pPIS, pStr, FadeAllToWhite);
|
||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "CLS") == 0)
|
else if (strcmp (Opcode, "CLS") == 0)
|
||||||
{ /* clear screen */
|
{ /* clear screen */
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
GetContextClipRect (&r);
|
GetContextClipRect (&r);
|
||||||
r.corner.x = r.corner.y = 0;
|
r.corner.x = r.corner.y = 0;
|
||||||
@@ -446,6 +491,8 @@ DoPresentation (PVOID pIS)
|
|||||||
}
|
}
|
||||||
else if (strcmp (Opcode, "CALL") == 0)
|
else if (strcmp (Opcode, "CALL") == 0)
|
||||||
{ /* call another script */
|
{ /* call another script */
|
||||||
|
Present_UnbatchGraphics (pPIS, TRUE);
|
||||||
|
|
||||||
CopyTextString (pPIS->Buffer, sizeof(pPIS->Buffer), pStr);
|
CopyTextString (pPIS->Buffer, sizeof(pPIS->Buffer), pStr);
|
||||||
ShowPresentation (pPIS->Buffer);
|
ShowPresentation (pPIS->Buffer);
|
||||||
}
|
}
|
||||||
@@ -492,6 +539,7 @@ ShowPresentation (char *name)
|
|||||||
pis.Font = 0;
|
pis.Font = 0;
|
||||||
pis.Frame = 0;
|
pis.Frame = 0;
|
||||||
pis.MusicRef = 0;
|
pis.MusicRef = 0;
|
||||||
|
pis.Batched = FALSE;
|
||||||
pis.TextVPos = 'B';
|
pis.TextVPos = 'B';
|
||||||
pis.LastSyncTime = pis.StartTime = GetTimeCounter ();
|
pis.LastSyncTime = pis.StartTime = GetTimeCounter ();
|
||||||
pis.TimeOut = 0;
|
pis.TimeOut = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user