Planet rotation task retired; this introduces a DoInput frame callback and lays the foundation for the removal of credits task

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3393 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2009-12-05 22:15:23 +00:00
parent 8b61f282d0
commit e151b933f8
14 changed files with 183 additions and 178 deletions
+5 -8
View File
@@ -108,13 +108,7 @@ DoConfirmExit (void)
SetSystemRect (&r);
DrawConfirmationWindow (response);
// Releasing the lock lets the rotate_planet_task
// draw a frame. PauseRotate can still allow one more frame
// to be drawn, so it is safer to just not release the lock
//UnlockMutex (GraphicsLock);
FlushGraphics ();
//LockMutex (GraphicsLock);
FlushInput ();
done = FALSE;
@@ -188,7 +182,8 @@ DoPopup (struct popup_state *self)
(void)self;
SleepThread (ONE_SECOND / 20);
return !(PulsedInputState.menu[KEY_MENU_SELECT] ||
PulsedInputState.menu[KEY_MENU_CANCEL]);
PulsedInputState.menu[KEY_MENU_CANCEL] ||
(GLOBAL (CurrentActivity) & CHECK_ABORT));
}
void
@@ -205,7 +200,7 @@ DoPopupWindow (const char *msg)
RECT windowRect;
POPUP_STATE state;
MENU_SOUND_FLAGS s0, s1;
InputFrameCallback *oldCallback;
if (!bank)
{
@@ -247,10 +242,12 @@ DoPopupWindow (const char *msg)
GetMenuSounds (&s0, &s1);
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
oldCallback = SetInputCallback (NULL);
state.InputFunc = DoPopup;
DoInput (&state, TRUE);
SetInputCallback (oldCallback);
ClearSystemRect ();
DrawStamp (&s);
DestroyDrawable (ReleaseDrawable (s.frame));
+7
View File
@@ -113,6 +113,13 @@ BOOLEAN WaitForNoInput (TimePeriod duration, BOOLEAN resetInput);
BOOLEAN WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput);
void DoPopupWindow(const char *msg);
typedef void (InputFrameCallback) (void);
// Anything using input callbacks MUST NOT keep GraphicsLock across
// InputFunc executions. This also means NOT holding GraphicsLock
// when calling DoInput().
InputFrameCallback* SetInputCallback (InputFrameCallback *);
// pInputState must point to a struct derived from INPUT_STATE_DESC
void DoInput (void *pInputState, BOOLEAN resetInput);
extern volatile BOOLEAN GamePaused;
+18
View File
@@ -68,6 +68,8 @@ volatile CONTROLLER_INPUT_STATE ImmediateInputState;
volatile BOOLEAN ExitRequested;
volatile BOOLEAN GamePaused;
static InputFrameCallback *inputCallback;
static void
_clear_menu_state (void)
{
@@ -275,6 +277,18 @@ UpdateInputState (void)
ExitRequested = TRUE;
}
InputFrameCallback *
SetInputCallback (InputFrameCallback *callback)
{
InputFrameCallback *old = inputCallback;
// Replacing an existing callback with another is not a problem,
// but currently this should never happen, which is why the assert.
assert (!old || !callback);
inputCallback = callback;
return old;
}
void
SetMenuRepeatDelay (DWORD min, DWORD max, DWORD step, BOOLEAN gestalt)
@@ -384,6 +398,10 @@ DoInput (void *pInputState, BOOLEAN resetInput)
PlaySoundEffect (S, 0, NotPositional (), NULL, 0);
}
if (inputCallback)
inputCallback ();
} while (((INPUT_STATE_DESC*)pInputState)->InputFunc (pInputState));
if (resetInput)
+7 -8
View File
@@ -1099,14 +1099,12 @@ PickGame (MENU_STATE *pMS)
RECT DlgRect;
STAMP DlgStamp;
TimeCount TimeOut;
InputFrameCallback *oldCallback;
TimeOut = FadeMusic (0, ONE_SECOND / 2);
if (pSolarSysState)
{
pSolarSysState->PauseRotate = 1;
TaskSwitch ();
}
// Deactivate any background drawing, like planet rotation
oldCallback = SetInputCallback (NULL);
LoadGameDescriptions (desc_array);
@@ -1128,6 +1126,7 @@ PickGame (MENU_STATE *pMS)
FadeMusic (NORMAL_VOLUME, 0);
DoInput (pMS, TRUE);
LockMutex (GraphicsLock);
pMS->Initialized = FALSE;
pMS->InputFunc = DoGameOptions;
@@ -1148,9 +1147,6 @@ PickGame (MENU_STATE *pMS)
DrawStamp (&DlgStamp);
ScreenTransition (3, &DlgRect);
UnbatchGraphics ();
if (pSolarSysState)
pSolarSysState->PauseRotate = 0;
}
DestroyDrawable (ReleaseDrawable (DlgStamp.frame));
@@ -1158,6 +1154,9 @@ PickGame (MENU_STATE *pMS)
SetContext (OldContext);
UnlockMutex (GraphicsLock);
// Reactivate any background drawing, like planet rotation
SetInputCallback (oldCallback);
return (retval);
}
+2
View File
@@ -28,6 +28,8 @@ typedef struct GenerateFunctions GenerateFunctions;
* - split off pickupMineral, pickupEnergy, pickupLife from Generate*
* - split off generateOrbital in a calculation and an activation
* (graphics and music) part.
* - make generateOrbital return a meaningful value, specifically, whether
* or not the player is going into orbit
* - for GenerateNameFunction, set the name in an argument, instead
* of in GLOBAL_SYS(PlanetName)
* - make generateName work for moons
+61 -63
View File
@@ -1311,53 +1311,79 @@ ScrollPlanetSide (SIZE dx, SIZE dy, int landingOffset)
UnlockMutex (GraphicsLock);
}
static void
animationInterframe (TimeCount *TimeIn, COUNT periods)
{
#define ANIM_FRAME_RATE (ONE_SECOND / 30)
for ( ; periods; --periods)
{
LockMutex (GraphicsLock);
RotatePlanetSphere (TRUE);
UnlockMutex (GraphicsLock);
SleepThreadUntil (*TimeIn + ANIM_FRAME_RATE);
*TimeIn = GetTimeCounter ();
}
}
static void
AnimateLaunch (FRAME farray)
{
RECT r;
STAMP s;
COUNT num_frames;
DWORD Time;
TimeCount NextTime;
Time = GetTimeCounter ();
LockMutex (GraphicsLock);
SetContext (SpaceContext);
s.origin.x = s.origin.y = 0;
s.frame = DecFrameIndex (farray);
r.corner.x = 0;
r.corner.y = 0;
r.extent.width = 0;
s.origin.x = 0;
s.origin.y = 0;
s.frame = farray;
num_frames = GetFrameCount (s.frame);
do
for (num_frames = GetFrameCount (s.frame); num_frames; --num_frames)
{
GetFrameRect (s.frame, &r);
s.frame = IncFrameIndex (s.frame);
RepairBackRect (&r);
DrawStamp (&s);
NextTime = GetTimeCounter () + (ONE_SECOND / 22);
BatchGraphics ();
RepairBackRect (&r);
#ifdef SPIN_ON_LAUNCH
RotatePlanetSphere (FALSE);
#else
DrawDefaultPlanetSphere ();
#endif
DrawStamp (&s);
UnbatchGraphics ();
UnlockMutex (GraphicsLock);
SleepThreadUntil (Time + (ONE_SECOND / 22));
Time = GetTimeCounter ();
GetFrameRect (s.frame, &r);
s.frame = IncFrameIndex (s.frame);
SleepThreadUntil (NextTime);
LockMutex (GraphicsLock);
} while (--num_frames);
}
GetFrameRect (s.frame, &r);
RepairBackRect (&r);
UnlockMutex (GraphicsLock);
}
static void
InitPlanetSide (POINT pt)
AnimateLanderWarmup (void)
{
SIZE num_crew;
STAMP s;
CONTEXT OldContext;
DWORD Time;
TimeCount TimeIn = GetTimeCounter ();
LockMutex (GraphicsLock);
OldContext = SetContext (RadarContext);
UnlockMutex (GraphicsLock);
Time = GetTimeCounter ();
s.origin.x = 0;
s.origin.y = 0;
s.frame = SetAbsFrameIndex (LanderFrame[0],
@@ -1367,22 +1393,20 @@ InitPlanetSide (POINT pt)
DrawStamp (&s);
UnlockMutex (GraphicsLock);
SleepThread (ONE_SECOND / 15);
Time = GetTimeCounter ();
animationInterframe (&TimeIn, 2);
for (num_crew = 0; num_crew < (NUM_CREW_COLS * NUM_CREW_ROWS)
&& GLOBAL_SIS (CrewEnlisted); ++num_crew)
{
SleepThreadUntil (Time + ONE_SECOND / 30);
Time = GetTimeCounter ();
animationInterframe (&TimeIn, 1);
LockMutex (GraphicsLock);
DeltaSISGauges (-1, 0, 0);
DeltaLanderCrew (1, 0);
UnlockMutex (GraphicsLock);
}
SleepThreadUntil (Time + (ONE_SECOND / 15));
Time = GetTimeCounter ();
animationInterframe (&TimeIn, 2);
if (GET_GAME_STATE (IMPROVED_LANDER_SHOT))
s.frame = SetAbsFrameIndex (s.frame, 58);
@@ -1393,8 +1417,7 @@ InitPlanetSide (POINT pt)
DrawStamp (&s);
UnlockMutex (GraphicsLock);
SleepThreadUntil (Time + (ONE_SECOND / 15));
Time = GetTimeCounter ();
animationInterframe (&TimeIn, 2);
if (GET_GAME_STATE (IMPROVED_LANDER_SPEED))
s.frame = SetAbsFrameIndex (s.frame, 57);
@@ -1406,8 +1429,7 @@ InitPlanetSide (POINT pt)
DrawStamp (&s);
UnlockMutex (GraphicsLock);
SleepThreadUntil (Time + (ONE_SECOND / 15));
Time = GetTimeCounter ();
animationInterframe (&TimeIn, 2);
s.frame = IncFrameIndex (s.frame);
}
@@ -1417,31 +1439,23 @@ InitPlanetSide (POINT pt)
if (GET_GAME_STATE (IMPROVED_LANDER_CARGO))
{
SleepThreadUntil (Time + (ONE_SECOND / 15));
Time = GetTimeCounter ();
animationInterframe (&TimeIn, 2);
s.frame = SetAbsFrameIndex (s.frame, 59);
LockMutex (GraphicsLock);
DrawStamp (&s);
UnlockMutex (GraphicsLock);
}
#ifndef SPIN_ON_LAUNCH
pSolarSysState->PauseRotate = 1;
#endif
SleepThreadUntil (Time + (ONE_SECOND / 15));
LockMutex (GraphicsLock);
animationInterframe (&TimeIn, 2);
PlaySound (SetAbsSoundIndex (LanderSounds, LANDER_DEPARTS),
NotPositional (), NULL, GAME_SOUND_PRIORITY + 1);
SetContext (SpaceContext);
AnimateLaunch (LanderFrame[5]);
#ifdef SPIN_ON_LAUNCH
pSolarSysState->PauseRotate = 1;
UnlockMutex (GraphicsLock);
TaskSwitch ();
LockMutex (GraphicsLock);
#endif
}
static void
InitPlanetSide (POINT pt)
{
// Adjust landing location by a random jitter.
#define RANDOM_MISS 64
// Jitter the X landing point.
@@ -1460,6 +1474,7 @@ InitPlanetSide (POINT pt)
curLanderLoc = pt;
LockMutex (GraphicsLock);
SetContext (SpaceContext);
SetContextFont (TinyFont);
@@ -1495,12 +1510,8 @@ InitPlanetSide (POINT pt)
ScreenTransition (3, &r);
UnbatchGraphics ();
LoadIntoExtraScreen (&r);
}
SetContext (OldContext);
UnlockMutex (GraphicsLock);
SET_GAME_STATE (PLANETARY_LANDING, 1);
@@ -1810,7 +1821,6 @@ ReturnToOrbit (RECT *pRect)
ScreenTransition (3, pRect);
UnbatchGraphics ();
LoadIntoExtraScreen (pRect);
SetContext (OldContext);
UnlockMutex (GraphicsLock);
}
@@ -1960,8 +1970,9 @@ PlanetSide (POINT planetLoc)
crew_left = 0;
damage_index = 0;
explosion_index = 0;
pSolarSysState->MenuState.Initialized += 4;
AnimateLanderWarmup ();
AnimateLaunch (LanderFrame[5]);
InitPlanetSide (planetLoc);
landerInputState.NextTime = GetTimeCounter () + PLANET_SIDE_RATE;
@@ -1999,18 +2010,9 @@ PlanetSide (POINT planetLoc)
LandingTakeoffSequence (&landerInputState, FALSE);
ReturnToOrbit (&r);
#ifdef SPIN_ON_LAUNCH
// If PauseRotate is set to 2 the plaet will be displayed, but won't rotate
// Until the lander animation is complete
pSolarSysState->PauseRotate = 0;
// Give The RotatePlanet thread a slice to draw the planet
SleepThread (1);
#endif
AnimateLaunch (LanderFrame[6]);
LockMutex (GraphicsLock);
SetContext (SpaceContext);
AnimateLaunch (LanderFrame[6]);
DeltaSISGauges (crew_left, 0, 0);
if (PSD.ElementLevel)
@@ -2024,7 +2026,6 @@ PlanetSide (POINT planetLoc)
}
DrawStorageBays (FALSE);
}
UnlockMutex (GraphicsLock);
GLOBAL_SIS (TotalBioMass) += PSD.BiologicalLevel;
@@ -2058,9 +2059,6 @@ PlanetSide (POINT planetLoc)
ZeroVelocityComponents (&GLOBAL (velocity));
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
pSolarSysState->MenuState.Initialized -= 4;
pSolarSysState->PauseRotate = 0;
}
void
+24
View File
@@ -69,6 +69,15 @@ DrawPlanetSphere (int x, int y)
UnbatchGraphics ();
}
void
DrawDefaultPlanetSphere (void)
{
CONTEXT oldContext;
oldContext = SetContext (SpaceContext);
DrawPlanetSphere (SIS_SCREEN_WIDTH / 2, PLANET_ORG_Y);
SetContext (oldContext);
}
void
InitSphereRotation (int direction, BOOLEAN shielded)
@@ -218,6 +227,21 @@ ZoomInPlanetSphere (void)
}
}
void
RotatePlanetSphere (BOOLEAN keepRate)
{
static TimeCount NextTime;
TimeCount Now = GetTimeCounter ();
if (keepRate && Now < NextTime)
return; // not time yet
NextTime = Now + PLANET_ROTATION_RATE;
DrawDefaultPlanetSphere ();
PrepareNextRotationFrame ();
}
// rgb.a is ignored
void
DrawPlanet (int x, int y, int dy, Color rgb)
+33 -33
View File
@@ -35,9 +35,6 @@
#include "libs/graphics/gfx_common.h"
extern int rotate_planet_task (void *data);
void
DrawScannedObjects (BOOLEAN Reversed)
{
@@ -170,7 +167,12 @@ DrawOrbitalDisplay (DRAW_ORBITAL_MODE Mode)
DrawStamp (&s);
DestroyDrawable (ReleaseDrawable (s.frame));
}
else
else if (Mode == DRAW_ORBITAL_FULL)
{
DrawDefaultPlanetSphere ();
}
if (Mode != DRAW_ORBITAL_WAIT)
{
DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH,
SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, BLACK_COLOR);
@@ -185,6 +187,7 @@ DrawOrbitalDisplay (DRAW_ORBITAL_MODE Mode)
if (Mode != DRAW_ORBITAL_WAIT)
{
// for later RepairBackRect()
LoadIntoExtraScreen (&r);
}
}
@@ -207,7 +210,7 @@ LoadPlanet (FRAME SurfDefFrame)
#endif
WaitMode = !(LastActivity & CHECK_LOAD) &&
(pSolarSysState->MenuState.Initialized <= 2);
(pSolarSysState->MenuState.Initialized != 3);
if (WaitMode)
{
@@ -216,9 +219,11 @@ LoadPlanet (FRAME SurfDefFrame)
UnlockMutex (GraphicsLock);
}
if (pSolarSysState->MenuState.flash_task == 0)
// TODO: split off the scan screen redraw code into a separate
// function so that we could lose this hack.
if (!pSolarSysState->TopoFrame)
{
// The "rotate planets" task is not initialised yet.
// TopoFrame has not been initialised yet.
// This means the call to LoadPlanet is made from some
// GenerateFunctions.generateOribital() function.
PLANET_DESC *pPlanetDesc;
@@ -231,10 +236,6 @@ LoadPlanet (FRAME SurfDefFrame)
GeneratePlanetSurface (pPlanetDesc, SurfDefFrame);
SetPlanetMusic (pPlanetDesc->data_index & ~PLANET_SHIELDED);
if (pPlanetDesc->pPrevDesc != &pSolarSysState->SunDesc[0])
pPlanetDesc = pPlanetDesc->pPrevDesc;
GeneratePlanetSide ();
}
@@ -245,20 +246,14 @@ LoadPlanet (FRAME SurfDefFrame)
if (!PLRPlaying ((MUSIC_REF)~0))
PlayMusic (LanderMusic, TRUE, 1);
if (pSolarSysState->MenuState.flash_task == 0)
if (WaitMode)
{
assert (pSolarSysState->MenuState.Initialized == 2);
// Only zoom when not already in orbit
if (!(LastActivity & CHECK_LOAD))
ZoomInPlanetSphere ();
ZoomInPlanetSphere ();
// XXX: Mark as in-orbit. This should go away eventually
pSolarSysState->MenuState.Initialized = 3;
pSolarSysState->MenuState.flash_task =
AssignTask (rotate_planet_task, 4096,
"rotate planets");
}
}
@@ -268,13 +263,6 @@ FreePlanet (void)
COUNT i;
PLANET_ORBIT *Orbit = &pSolarSysState->Orbit;
if (pSolarSysState->MenuState.flash_task)
{
ConcludeTask (pSolarSysState->MenuState.flash_task);
// Task_SetState (pSolarSysState->MenuState.flash_task, TASK_EXIT);
pSolarSysState->MenuState.flash_task = 0;
}
UninitSphereRotation ();
StopMusic ();
@@ -331,7 +319,6 @@ FreePlanet (void)
));
pSolarSysState->SysInfo.PlanetInfo.DiscoveryString = 0;
FreeLanderFont (&pSolarSysState->SysInfo.PlanetInfo);
pSolarSysState->PauseRotate = 0;
UnlockMutex (GraphicsLock);
}
@@ -402,24 +389,25 @@ DoPlanetOrbit (MENU_STATE *pMS)
case STARMAP:
{
BOOLEAN AutoPilotSet;
InputFrameCallback *oldCallback;
// Deactivate planet rotation
oldCallback = SetInputCallback (NULL);
LockMutex (GraphicsLock);
pSolarSysState->PauseRotate = 1;
RepairSISBorder ();
UnlockMutex (GraphicsLock);
TaskSwitch ();
AutoPilotSet = StarMap ();
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
return FALSE;
// Reactivate planet rotation
SetInputCallback (oldCallback);
if (!AutoPilotSet)
{ // Redraw the orbital display
LoadPlanet (NULL);
LockMutex (GraphicsLock);
pSolarSysState->PauseRotate = 0;
UnlockMutex (GraphicsLock);
break;
}
// Fall through !!!
@@ -444,10 +432,19 @@ DoPlanetOrbit (MENU_STATE *pMS)
return TRUE;
}
static void
on_input_frame (void)
{
LockMutex (GraphicsLock);
RotatePlanetSphere (TRUE);
UnlockMutex (GraphicsLock);
}
void
PlanetOrbitMenu (void)
{
void *oldInputFunc = pSolarSysState->MenuState.InputFunc;
InputFrameCallback *oldCallback;
DrawMenuStateStrings (PM_SCAN, SCAN);
LockMutex (GraphicsLock);
@@ -456,12 +453,15 @@ PlanetOrbitMenu (void)
pSolarSysState->MenuState.CurState = SCAN;
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
oldCallback = SetInputCallback (on_input_frame);
// XXX: temporary; will have an own MENU_STATE
pSolarSysState->MenuState.InputFunc = DoPlanetOrbit;
DoInput (&pSolarSysState->MenuState, TRUE);
pSolarSysState->MenuState.InputFunc = oldInputFunc;
SetInputCallback (oldCallback);
LockMutex (GraphicsLock);
SetFlashRect (NULL);
UnlockMutex (GraphicsLock);
+2 -1
View File
@@ -226,7 +226,6 @@ struct solarsys_state
* [5] = bio 3 (world-specific)
*/
Color Tint_rgb;
UBYTE PauseRotate;
FRAME TopoFrame;
PLANET_ORBIT Orbit;
};
@@ -269,10 +268,12 @@ extern void InitSphereRotation (int direction, BOOLEAN shielded);
extern void UninitSphereRotation (void);
extern void PrepareNextRotationFrame (void);
extern void DrawPlanetSphere (int x, int y);
extern void DrawDefaultPlanetSphere (void);
extern void RenderPlanetSphere (FRAME Frame, int offset, BOOLEAN doThrob);
extern void SetShieldThrobEffect (FRAME FromFrame, int offset, FRAME ToFrame);
extern void ZoomInPlanetSphere (void);
extern void RotatePlanetSphere (BOOLEAN keepRate);
extern void DrawScannedObjects (BOOLEAN Reversed);
extern void GeneratePlanetSurface (PLANET_DESC *pPlanetDesc,
-51
View File
@@ -1958,54 +1958,3 @@ GeneratePlanetSurface (PLANET_DESC *pPlanetDesc, FRAME SurfDefFrame)
TFB_SeedRandom (old_seed);
}
int
rotate_planet_task (void *data)
{
Task task = (Task) data;
DWORD TimeIn;
SOLARSYS_STATE *pSS;
pSS = pSolarSysState;
TimeIn = GetTimeCounter ();
while (!Task_ReadState (task, TASK_EXIT))
{
CONTEXT oldContext;
{
// This lock was placed before the RotatePlanet call
// To prevent the thread from being interrupted by the flash
// task while computing the Planet Frame. This should help
// to smooth out the planet rotation animation.
// The PauseRotate needs to be placed after the lock,
// to guarantee that PauseRotate doesn't change while waiting
// to acquire the graphics lock
LockMutex (GraphicsLock);
if (*(volatile UBYTE *)&pSS->PauseRotate != 1
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT))
{
//PauseRotate == 2 is a single-step
if (*(volatile UBYTE *)&pSS->PauseRotate == 2)
pSS->PauseRotate = 1;
oldContext = SetContext (SpaceContext);
DrawPlanetSphere (SIS_SCREEN_WIDTH / 2, PLANET_ORG_Y);
SetContext (oldContext);
PrepareNextRotationFrame ();
}
UnlockMutex (GraphicsLock);
SleepThreadUntil (TimeIn + PLANET_ROTATION_RATE);
TimeIn = GetTimeCounter ();
}
}
FinishTask (task);
return 0;
}
+11 -7
View File
@@ -645,6 +645,7 @@ PickPlanetSide (MENU_STATE *pMS)
{
DWORD TimeIn = GetTimeCounter ();
BOOLEAN select, cancel;
select = PulsedInputState.menu[KEY_MENU_SELECT];
cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
@@ -689,6 +690,7 @@ PickPlanetSide (MENU_STATE *pMS)
}
else
{
InputFrameCallback *oldCallback;
COUNT fuel_required;
fuel_required = (COUNT)(
@@ -698,6 +700,9 @@ PickPlanetSide (MENU_STATE *pMS)
EraseCoarseScan ();
// Deactivate planet rotation callback
oldCallback = SetInputCallback (NULL);
LockMutex (GraphicsLock);
DeltaSISGauges (0, -(SIZE)fuel_required, 0);
SetContext (ScanContext);
@@ -743,6 +748,9 @@ PickPlanetSide (MENU_STATE *pMS)
PrintCoarseScanPC ();
else
PrintCoarseScan3DO ();
// Reactivate planet rotation callback
SetInputCallback (oldCallback);
}
DrawMenuStateStrings (PM_MIN_SCAN, DISPATCH_SHUTTLE);
@@ -1019,11 +1027,6 @@ DoScan (MENU_STATE *pMS)
return (TRUE);
}
pSolarSysState->MenuState.Initialized += 4;
#ifndef SPIN_ON_SCAN
pSolarSysState->PauseRotate = 1;
#endif
min_scan = pMS->CurState;
if (min_scan != AUTO_SCAN)
max_scan = min_scan;
@@ -1117,6 +1120,9 @@ DoScan (MENU_STATE *pMS)
DrawPlanet (0, 0, i, rgb);
DrawScannedStuff (i, min_scan);
UnbatchGraphics ();
#ifdef SPIN_ON_SCAN
RotatePlanetSphere (TRUE);
#endif
UnlockMutex (GraphicsLock);
}
@@ -1157,8 +1163,6 @@ DoScan (MENU_STATE *pMS)
else
UnlockMutex (GraphicsLock);
pSolarSysState->MenuState.Initialized -= 4;
pSolarSysState->PauseRotate = 0;
FlushInput ();
}
else if (optWhichMenu == OPT_PC ||
+6 -3
View File
@@ -186,8 +186,10 @@ playerInSolarSystem (void)
bool
playerInPlanetOrbit (void)
{
assert (!pSolarSysState || pSolarSysState->MenuState.Initialized < 4);
return playerInSolarSystem () &&
pSolarSysState->MenuState.Initialized >= 3;
pSolarSysState->MenuState.Initialized == 3;
// XXX: This test will change eventually
}
@@ -1275,8 +1277,9 @@ EnterPlanetOrbit (void)
|| GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
return;
if (pSolarSysState->MenuState.flash_task)
{ // We've entered orbit; LoadPlanet() set flash_task to rotate planet
// Implement a to-do in generate.h for a better test
if (pSolarSysState->TopoFrame)
{ // We've entered orbit; LoadPlanet() called planet surface-gen code
PlanetOrbitMenu ();
FreePlanet ();
}
+4
View File
@@ -43,6 +43,10 @@
#include "libs/inplib.h"
// TODO: This entire module fails to uphold the GraphicsLock semantics
// This either has to be fixed, or GraphicsLock completely ignored,
// or will become irrelevant if GraphicsLock completely removed.
enum
{
START_NEW_GAME = 0,
+2 -3
View File
@@ -172,9 +172,8 @@ PauseGame (void)
SetSystemRect (&r);
DrawStamp (&s);
// Releasing the lock lets the rotate_planet_task
// draw a frame. PauseRotate can still allow one more frame
// to be drawn, so it is safer to just not release the lock
// It is safer to just not release the lock so any graphics tasks
// would be blocked
//UnlockMutex (GraphicsLock);
FlushGraphics ();
//LockMutex (GraphicsLock);