Remove pSolarSysState->MenuState completely
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3420 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -426,22 +426,22 @@ on_input_frame (void)
|
|||||||
void
|
void
|
||||||
PlanetOrbitMenu (void)
|
PlanetOrbitMenu (void)
|
||||||
{
|
{
|
||||||
void *oldInputFunc = pSolarSysState->MenuState.InputFunc;
|
MENU_STATE MenuState;
|
||||||
InputFrameCallback *oldCallback;
|
InputFrameCallback *oldCallback;
|
||||||
|
|
||||||
|
memset (&MenuState, 0, sizeof MenuState);
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_SCAN, SCAN);
|
DrawMenuStateStrings (PM_SCAN, SCAN);
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetFlashRect (SFR_MENU_3DO);
|
SetFlashRect (SFR_MENU_3DO);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
pSolarSysState->MenuState.CurState = SCAN;
|
MenuState.CurState = SCAN;
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
oldCallback = SetInputCallback (on_input_frame);
|
oldCallback = SetInputCallback (on_input_frame);
|
||||||
|
|
||||||
// XXX: temporary; will have an own MENU_STATE
|
MenuState.InputFunc = DoPlanetOrbit;
|
||||||
pSolarSysState->MenuState.InputFunc = DoPlanetOrbit;
|
DoInput (&MenuState, TRUE);
|
||||||
DoInput (&pSolarSysState->MenuState, TRUE);
|
|
||||||
pSolarSysState->MenuState.InputFunc = oldInputFunc;
|
|
||||||
|
|
||||||
SetInputCallback (oldCallback);
|
SetInputCallback (oldCallback);
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,12 @@ struct planet_orbit
|
|||||||
// filled.
|
// filled.
|
||||||
struct solarsys_state
|
struct solarsys_state
|
||||||
{
|
{
|
||||||
MENU_STATE MenuState;
|
// Standard field required by DoInput()
|
||||||
|
BOOLEAN (*InputFunc) (struct solarsys_state *);
|
||||||
|
|
||||||
|
BOOLEAN InIpFlight;
|
||||||
|
// Set to TRUE when player is flying around in interplanetary
|
||||||
|
// Reset to FALSE when going into orbit or encounter
|
||||||
|
|
||||||
COUNT WaitIntersect;
|
COUNT WaitIntersect;
|
||||||
// Planet/moon number with which the flagship should not collide
|
// Planet/moon number with which the flagship should not collide
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
#define IP_FRAME_RATE (ONE_SECOND / 30)
|
#define IP_FRAME_RATE (ONE_SECOND / 30)
|
||||||
|
|
||||||
static BOOLEAN DoIpFlight (MENU_STATE *pMS);
|
static BOOLEAN DoIpFlight (SOLARSYS_STATE *pSS);
|
||||||
static void DrawSystem (SIZE radius, BOOLEAN IsInnerSystem);
|
static void DrawSystem (SIZE radius, BOOLEAN IsInnerSystem);
|
||||||
static FRAME CreateStarBackGround (void);
|
static FRAME CreateStarBackGround (void);
|
||||||
static void DrawInnerSystem (void);
|
static void DrawInnerSystem (void);
|
||||||
@@ -482,15 +482,9 @@ saveNonOrbitalLocation (void)
|
|||||||
static void
|
static void
|
||||||
FreeSolarSys (void)
|
FreeSolarSys (void)
|
||||||
{
|
{
|
||||||
if (pSolarSysState->MenuState.flash_task)
|
if (pSolarSysState->InIpFlight)
|
||||||
{
|
{
|
||||||
if (pSolarSysState->MenuState.flash_task != (Task)(~0))
|
pSolarSysState->InIpFlight = FALSE;
|
||||||
{
|
|
||||||
log_add (log_Warning, "DIAGNOSTIC: FreeSolarSys cancels a "
|
|
||||||
"flash_task that wasn't the placeholder for IP flight");
|
|
||||||
ConcludeTask (pSolarSysState->MenuState.flash_task);
|
|
||||||
}
|
|
||||||
pSolarSysState->MenuState.flash_task = 0;
|
|
||||||
|
|
||||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||||
saveNonOrbitalLocation ();
|
saveNonOrbitalLocation ();
|
||||||
@@ -1226,7 +1220,7 @@ ResetSolarSys (void)
|
|||||||
// Originally there was a flash_task test here, however, I found no cases
|
// Originally there was a flash_task test here, however, I found no cases
|
||||||
// where flash_task could be set at the time of call. The test was
|
// where flash_task could be set at the time of call. The test was
|
||||||
// probably needed on 3DO when IP_frame() was a task.
|
// probably needed on 3DO when IP_frame() was a task.
|
||||||
assert (!pSolarSysState->MenuState.flash_task);
|
assert (!pSolarSysState->InIpFlight);
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_STARMAP, -(PM_NAVIGATE - PM_SCAN));
|
DrawMenuStateStrings (PM_STARMAP, -(PM_NAVIGATE - PM_SCAN));
|
||||||
|
|
||||||
@@ -1237,7 +1231,7 @@ ResetSolarSys (void)
|
|||||||
// Figure out and note which planet/moon we just left, if any
|
// Figure out and note which planet/moon we just left, if any
|
||||||
CheckIntersect (TRUE);
|
CheckIntersect (TRUE);
|
||||||
|
|
||||||
pSolarSysState->MenuState.flash_task = (Task)(~0);
|
pSolarSysState->InIpFlight = TRUE;
|
||||||
|
|
||||||
// Do not start playing the music if we entered the solarsys only
|
// Do not start playing the music if we entered the solarsys only
|
||||||
// to load a game (load invoked from Main menu)
|
// to load a game (load invoked from Main menu)
|
||||||
@@ -1252,7 +1246,7 @@ ResetSolarSys (void)
|
|||||||
static void
|
static void
|
||||||
EnterPlanetOrbit (void)
|
EnterPlanetOrbit (void)
|
||||||
{
|
{
|
||||||
if (pSolarSysState->MenuState.flash_task)
|
if (pSolarSysState->InIpFlight)
|
||||||
{ // This means we hit a planet in IP flight; not a Load into orbit
|
{ // This means we hit a planet in IP flight; not a Load into orbit
|
||||||
FreeSolarSys ();
|
FreeSolarSys ();
|
||||||
|
|
||||||
@@ -1311,7 +1305,7 @@ EnterPlanetOrbit (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
InitSolarSys (void)
|
InitSolarSys (void)
|
||||||
{
|
{
|
||||||
BOOLEAN InnerSystem;
|
BOOLEAN InnerSystem;
|
||||||
@@ -1324,8 +1318,6 @@ InitSolarSys (void)
|
|||||||
LoadLanderData ();
|
LoadLanderData ();
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
pSolarSysState->MenuState.InputFunc = DoIpFlight;
|
|
||||||
|
|
||||||
Reentry = (GLOBAL (ShipFacing) != 0);
|
Reentry = (GLOBAL (ShipFacing) != 0);
|
||||||
if (!Reentry)
|
if (!Reentry)
|
||||||
{
|
{
|
||||||
@@ -1747,9 +1739,9 @@ ExploreSolarSys (void)
|
|||||||
SolarSysState.genFuncs = getGenerateFunctions (CurStarDescPtr->Index);
|
SolarSysState.genFuncs = getGenerateFunctions (CurStarDescPtr->Index);
|
||||||
|
|
||||||
InitSolarSys ();
|
InitSolarSys ();
|
||||||
SolarSysState.MenuState.Initialized = TRUE;
|
|
||||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||||
DoInput (&SolarSysState.MenuState, FALSE);
|
SolarSysState.InputFunc = DoIpFlight;
|
||||||
|
DoInput (&SolarSysState, FALSE);
|
||||||
UninitSolarSys ();
|
UninitSolarSys ();
|
||||||
pSolarSysState = 0;
|
pSolarSysState = 0;
|
||||||
}
|
}
|
||||||
@@ -1915,7 +1907,6 @@ DoSolarSysMenu (MENU_STATE *pMS)
|
|||||||
|| GLOBAL_SIS (CrewEnlisted) == (COUNT)~0)
|
|| GLOBAL_SIS (CrewEnlisted) == (COUNT)~0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// XXX: pMS actually refers to pSolarSysState->MenuState
|
|
||||||
handled = DoMenuChooser (pMS, PM_STARMAP);
|
handled = DoMenuChooser (pMS, PM_STARMAP);
|
||||||
if (handled)
|
if (handled)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1980,16 +1971,18 @@ DoSolarSysMenu (MENU_STATE *pMS)
|
|||||||
static void
|
static void
|
||||||
SolarSysMenu (void)
|
SolarSysMenu (void)
|
||||||
{
|
{
|
||||||
void *oldInputFunc = pSolarSysState->MenuState.InputFunc;
|
MENU_STATE MenuState;
|
||||||
|
|
||||||
|
memset (&MenuState, 0, sizeof MenuState);
|
||||||
|
|
||||||
if (LastActivity == CHECK_LOAD)
|
if (LastActivity == CHECK_LOAD)
|
||||||
{ // Selected LOAD from main menu
|
{ // Selected LOAD from main menu
|
||||||
pSolarSysState->MenuState.CurState = GAME_MENU;
|
MenuState.CurState = GAME_MENU;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawMenuStateStrings (PM_STARMAP, STARMAP);
|
DrawMenuStateStrings (PM_STARMAP, STARMAP);
|
||||||
pSolarSysState->MenuState.CurState = STARMAP;
|
MenuState.CurState = STARMAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
@@ -1998,27 +1991,23 @@ SolarSysMenu (void)
|
|||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
// XXX: temporary; will have an own MENU_STATE
|
MenuState.InputFunc = DoSolarSysMenu;
|
||||||
pSolarSysState->MenuState.InputFunc = DoSolarSysMenu;
|
DoInput (&MenuState, TRUE);
|
||||||
DoInput (&pSolarSysState->MenuState, TRUE);
|
|
||||||
pSolarSysState->MenuState.InputFunc = oldInputFunc;
|
|
||||||
|
|
||||||
DrawMenuStateStrings (PM_STARMAP, -NAVIGATION);
|
DrawMenuStateStrings (PM_STARMAP, -NAVIGATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
DoIpFlight (MENU_STATE *pMS)
|
DoIpFlight (SOLARSYS_STATE *pSS)
|
||||||
{
|
{
|
||||||
static TimeCount NextTime;
|
static TimeCount NextTime;
|
||||||
BOOLEAN cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
|
BOOLEAN cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
|
||||||
|
|
||||||
(void) pMS; // suppress unused warning
|
if (pSS->InOrbit)
|
||||||
|
|
||||||
if (pSolarSysState->InOrbit)
|
|
||||||
{ // CheckShipLocation() or InitSolarSys() sent us to orbital
|
{ // CheckShipLocation() or InitSolarSys() sent us to orbital
|
||||||
EnterPlanetOrbit ();
|
EnterPlanetOrbit ();
|
||||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||||
pSolarSysState->InOrbit = FALSE;
|
pSS->InOrbit = FALSE;
|
||||||
}
|
}
|
||||||
else if (cancel || LastActivity == CHECK_LOAD)
|
else if (cancel || LastActivity == CHECK_LOAD)
|
||||||
{
|
{
|
||||||
@@ -2027,6 +2016,7 @@ DoIpFlight (MENU_STATE *pMS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
assert (pSS->InIpFlight);
|
||||||
IP_frame ();
|
IP_frame ();
|
||||||
SleepThreadUntil (NextTime);
|
SleepThreadUntil (NextTime);
|
||||||
NextTime = GetTimeCounter () + IP_FRAME_RATE;
|
NextTime = GetTimeCounter () + IP_FRAME_RATE;
|
||||||
|
|||||||
Reference in New Issue
Block a user