Arilou gate task retired; now called in-line every battle frame
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3287 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+14
-42
@@ -45,44 +45,24 @@
|
|||||||
volatile int MainExited = FALSE;
|
volatile int MainExited = FALSE;
|
||||||
|
|
||||||
// Open or close the periodically occuring QuasiSpace portal.
|
// Open or close the periodically occuring QuasiSpace portal.
|
||||||
// A seperate thread is always inside this function when the player
|
// It changes the appearant portal size when necessary.
|
||||||
// is in hyperspace. This thread awakens every BATTLE_FRAME_RATE seconds.
|
static void
|
||||||
// It then changes the appearant portal size when necessary.
|
checkArilouGate (void)
|
||||||
static int
|
|
||||||
arilou_gate_task(void *data)
|
|
||||||
{
|
{
|
||||||
BYTE counter;
|
BYTE counter;
|
||||||
DWORD TimeIn;
|
|
||||||
Task task = (Task) data;
|
|
||||||
|
|
||||||
TimeIn = GetTimeCounter ();
|
|
||||||
|
|
||||||
counter = GET_GAME_STATE (ARILOU_SPACE_COUNTER);
|
counter = GET_GAME_STATE (ARILOU_SPACE_COUNTER);
|
||||||
while (!Task_ReadState (task, TASK_EXIT))
|
if (GET_GAME_STATE (ARILOU_SPACE) == OPENING)
|
||||||
{
|
{ // The portal is opening or fully open
|
||||||
LockGameClock ();
|
if (counter < 9)
|
||||||
if (GET_GAME_STATE (ARILOU_SPACE) == OPENING)
|
++counter;
|
||||||
{
|
|
||||||
if (++counter == 10)
|
|
||||||
counter = 9;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (counter-- == 0)
|
|
||||||
counter = 0;
|
|
||||||
}
|
|
||||||
UnlockGameClock ();
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
|
||||||
SET_GAME_STATE (ARILOU_SPACE_COUNTER, counter);
|
|
||||||
UnlockMutex (GraphicsLock);
|
|
||||||
|
|
||||||
SleepThreadUntil (TimeIn + BATTLE_FRAME_RATE);
|
|
||||||
TimeIn = GetTimeCounter ();
|
|
||||||
}
|
}
|
||||||
FinishTask (task);
|
else
|
||||||
|
{ // The portal is closing or fully closed
|
||||||
return 0;
|
if (counter > 0)
|
||||||
|
--counter;
|
||||||
|
}
|
||||||
|
SET_GAME_STATE (ARILOU_SPACE_COUNTER, counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Battle frame callback function.
|
// Battle frame callback function.
|
||||||
@@ -91,6 +71,7 @@ static void
|
|||||||
on_battle_frame (void)
|
on_battle_frame (void)
|
||||||
{
|
{
|
||||||
GameClockTick ();
|
GameClockTick ();
|
||||||
|
checkArilouGate ();
|
||||||
|
|
||||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||||
SeedUniverse ();
|
SeedUniverse ();
|
||||||
@@ -270,20 +251,11 @@ while (--ac > 0)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Entering HyperSpace or QuasiSpace.
|
// Entering HyperSpace or QuasiSpace.
|
||||||
Task ArilouTask;
|
|
||||||
|
|
||||||
GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0);
|
GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0);
|
||||||
|
|
||||||
ArilouTask = AssignTask (arilou_gate_task, 128,
|
|
||||||
"quasispace portal manager");
|
|
||||||
|
|
||||||
TaskSwitch ();
|
|
||||||
|
|
||||||
DrawAutoPilotMessage (TRUE);
|
DrawAutoPilotMessage (TRUE);
|
||||||
SetGameClockRate (HYPERSPACE_CLOCK_RATE);
|
SetGameClockRate (HYPERSPACE_CLOCK_RATE);
|
||||||
Battle (&on_battle_frame);
|
Battle (&on_battle_frame);
|
||||||
if (ArilouTask)
|
|
||||||
Task_SetState (ArilouTask, TASK_EXIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
|
|||||||
Reference in New Issue
Block a user