Remove the last dependencies on pSolarSysState->MenuState.Initialized; replaced with SOLARSYS_STATE.InOrbit
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3418 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -92,10 +92,8 @@ GenerateChmmr_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
{
|
||||
if (GET_GAME_STATE (CHMMR_UNLEASHED))
|
||||
{
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
InitCommunication (CHMMR_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
|
||||
{
|
||||
@@ -115,11 +113,9 @@ GenerateChmmr_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (ILWRATH_SHIP,
|
||||
&GLOBAL (npc_built_ship_q), INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6);
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
InitCommunication (ILWRATH_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
|
||||
@@ -93,11 +93,9 @@ GenerateDruuge_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (DRUUGE_SHIP,
|
||||
&GLOBAL (npc_built_ship_q), INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
InitCommunication (DRUUGE_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
GLOBAL (CurrentActivity) &= ~START_INTERPLANETARY;
|
||||
|
||||
@@ -83,11 +83,9 @@ GenerateIlwrath_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (ILWRATH_SHIP,
|
||||
&GLOBAL (npc_built_ship_q), INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
InitCommunication (ILWRATH_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
|
||||
@@ -106,7 +106,6 @@ GenerateMycon_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
&GLOBAL (npc_built_ship_q), 0);
|
||||
}
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
if (CurStarDescPtr->Index == MYCON_DEFINED)
|
||||
{
|
||||
@@ -117,7 +116,6 @@ GenerateMycon_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6);
|
||||
}
|
||||
InitCommunication (MYCON_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
return true;
|
||||
|
||||
@@ -108,10 +108,8 @@ GenerateOrz_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
}
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6);
|
||||
}
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
InitCommunication (ORZ_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
return true;
|
||||
|
||||
@@ -86,7 +86,6 @@ GenerateTalkingPet_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world
|
||||
|
||||
if (ActivateStarShip (UMGAH_SHIP, SPHERE_TRACKING))
|
||||
{
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
if (!GET_GAME_STATE (UMGAH_ZOMBIE_BLOBBIES))
|
||||
@@ -106,7 +105,6 @@ GenerateTalkingPet_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world
|
||||
}
|
||||
InitCommunication (TALKING_PET_CONVERSATION);
|
||||
}
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
}
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
|
||||
@@ -84,11 +84,9 @@ GeneratePkunk_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (PKUNK_SHIP,
|
||||
&GLOBAL (npc_built_ship_q), INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
InitCommunication (PKUNK_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
|
||||
@@ -188,7 +188,6 @@ GenerateSaMatra_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
}
|
||||
}
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
SET_GAME_STATE (URQUAN_PROTECTING_SAMATRA, 1);
|
||||
@@ -219,7 +218,6 @@ GenerateSaMatra_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
InitCommunication (YEHAT_REBEL_CONVERSATION);
|
||||
}
|
||||
}
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +57,7 @@ GenerateSlylandro_generateOrbital (SOLARSYS_STATE *solarSys,
|
||||
{
|
||||
if (matchWorld (solarSys, world, 3, MATCH_PLANET))
|
||||
{
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
InitCommunication (SLYLANDRO_HOME_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,11 +123,9 @@ GenerateSpathi_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (SPATHI_SHIP, &GLOBAL (npc_built_ship_q),
|
||||
INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
InitCommunication (SPATHI_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
|
||||
@@ -84,11 +84,9 @@ GenerateSupox_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (SUPOX_SHIP, &GLOBAL (npc_built_ship_q),
|
||||
INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
InitCommunication (SUPOX_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
|
||||
@@ -88,9 +88,7 @@ GenerateSyreen_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
if (matchWorld (solarSys, world, 0, 0))
|
||||
{
|
||||
/* Starbase */
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
InitCommunication (SYREEN_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,6 @@ GenerateThraddash_generateOrbital (SOLARSYS_STATE *solarSys,
|
||||
CloneShipFragment (THRADDASH_SHIP, &GLOBAL (npc_built_ship_q),
|
||||
INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
if (CurStarDescPtr->Index == THRADD_DEFINED)
|
||||
{
|
||||
@@ -113,7 +112,6 @@ GenerateThraddash_generateOrbital (SOLARSYS_STATE *solarSys,
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6);
|
||||
}
|
||||
InitCommunication (THRADD_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
return true;
|
||||
|
||||
@@ -112,7 +112,6 @@ GenerateUtwig_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (UTWIG_SHIP,
|
||||
&GLOBAL (npc_built_ship_q), INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
if (CurStarDescPtr->Index == UTWIG_DEFINED)
|
||||
{
|
||||
@@ -123,7 +122,6 @@ GenerateUtwig_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6);
|
||||
}
|
||||
InitCommunication (UTWIG_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
@@ -149,11 +147,9 @@ GenerateUtwig_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (DRUUGE_SHIP,
|
||||
&GLOBAL (npc_built_ship_q), 0);
|
||||
}
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6);
|
||||
InitCommunication (DRUUGE_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
return true;
|
||||
|
||||
@@ -135,10 +135,8 @@ GenerateVux_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 6);
|
||||
}
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
InitCommunication (VUX_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
return true;
|
||||
|
||||
@@ -82,11 +82,9 @@ GenerateYehat_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (YEHAT_SHIP, &GLOBAL (npc_built_ship_q),
|
||||
INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
InitCommunication (YEHAT_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
|
||||
@@ -93,11 +93,9 @@ GenerateZoqFotPik_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (BLACK_URQUAN_SHIP,
|
||||
&GLOBAL (npc_built_ship_q), 0);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
InitCommunication (BLACKURQ_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
return true;
|
||||
@@ -114,11 +112,9 @@ GenerateZoqFotPik_generateOrbital (SOLARSYS_STATE *solarSys, PLANET_DESC *world)
|
||||
CloneShipFragment (ZOQFOTPIK_SHIP, &GLOBAL (npc_built_ship_q),
|
||||
INFINITE_FLEET);
|
||||
|
||||
solarSys->MenuState.Initialized += 2;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
SET_GAME_STATE (GLOBAL_FLAGS_AND_DATA, 1 << 7);
|
||||
InitCommunication (ZOQFOTPIK_CONVERSATION);
|
||||
solarSys->MenuState.Initialized -= 2;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
|
||||
@@ -207,7 +207,7 @@ LoadPlanet (FRAME SurfDefFrame)
|
||||
return;
|
||||
#endif
|
||||
|
||||
assert (pSolarSysState->MenuState.Initialized != 3);
|
||||
assert (pSolarSysState->InOrbit && !pSolarSysState->TopoFrame);
|
||||
|
||||
if (WaitMode)
|
||||
{
|
||||
@@ -228,7 +228,6 @@ LoadPlanet (FRAME SurfDefFrame)
|
||||
|
||||
if (WaitMode)
|
||||
{
|
||||
assert (pSolarSysState->MenuState.Initialized == 2);
|
||||
ZoomInPlanetSphere ();
|
||||
LockMutex (GraphicsLock);
|
||||
DrawOrbitalDisplay (DRAW_ORBITAL_UPDATE);
|
||||
@@ -240,9 +239,6 @@ LoadPlanet (FRAME SurfDefFrame)
|
||||
DrawOrbitalDisplay (DRAW_ORBITAL_FULL);
|
||||
UnlockMutex (GraphicsLock);
|
||||
}
|
||||
|
||||
// XXX: Mark as in-orbit. This should go away eventually
|
||||
pSolarSysState->MenuState.Initialized = 3;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -228,6 +228,9 @@ struct solarsys_state
|
||||
Color Tint_rgb;
|
||||
FRAME TopoFrame;
|
||||
PLANET_ORBIT Orbit;
|
||||
BOOLEAN InOrbit;
|
||||
// Set to TRUE when player hits a world in an inner system
|
||||
// Homeworld encounters count as 'in orbit'
|
||||
};
|
||||
|
||||
extern SOLARSYS_STATE *pSolarSysState;
|
||||
|
||||
@@ -186,11 +186,7 @@ playerInSolarSystem (void)
|
||||
bool
|
||||
playerInPlanetOrbit (void)
|
||||
{
|
||||
assert (!pSolarSysState || pSolarSysState->MenuState.Initialized < 4);
|
||||
|
||||
return playerInSolarSystem () &&
|
||||
pSolarSysState->MenuState.Initialized == 3;
|
||||
// XXX: This test will change eventually
|
||||
return playerInSolarSystem () && pSolarSysState->InOrbit;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -348,11 +344,12 @@ seedRandomForSolarSys (void)
|
||||
CurStarDescPtr->star_pt.y));
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
// Returns an orbital PLANET_DESC when player is in orbit
|
||||
static PLANET_DESC *
|
||||
LoadSolarSys (void)
|
||||
{
|
||||
COUNT i;
|
||||
BOOLEAN orbital = FALSE;
|
||||
PLANET_DESC *orbital = NULL;
|
||||
PLANET_DESC *pCurDesc;
|
||||
DWORD old_seed;
|
||||
#define NUM_TEMP_RANGES 5
|
||||
@@ -433,18 +430,16 @@ LoadSolarSys (void)
|
||||
|
||||
if (GLOBAL (in_orbit))
|
||||
{ // Only when loading a game into orbital
|
||||
orbital = TRUE;
|
||||
i = GLOBAL (in_orbit) - 1;
|
||||
if (i == 0)
|
||||
{ // Orbiting the planet itself
|
||||
pSolarSysState->pOrbitalDesc =
|
||||
pSolarSysState->pBaseDesc->pPrevDesc;
|
||||
orbital = pSolarSysState->pBaseDesc->pPrevDesc;
|
||||
}
|
||||
else
|
||||
{ // Orbiting a moon
|
||||
// -1 because planet itself is 1, and moons have to be 1-based
|
||||
i -= 1;
|
||||
pSolarSysState->pOrbitalDesc = &pSolarSysState->MoonDesc[i];
|
||||
orbital = &pSolarSysState->MoonDesc[i];
|
||||
}
|
||||
GLOBAL (ip_location) = pSolarSysState->SunDesc[0].location;
|
||||
GLOBAL (in_orbit) = 0;
|
||||
@@ -465,6 +460,25 @@ LoadSolarSys (void)
|
||||
return orbital;
|
||||
}
|
||||
|
||||
static void
|
||||
saveNonOrbitalLocation (void)
|
||||
{
|
||||
// XXX: Solar system reentry test depends on ShipFacing != 0
|
||||
GLOBAL (ShipFacing) = GetFrameIndex (GLOBAL (ShipStamp.frame)) + 1;
|
||||
GLOBAL (in_orbit) = 0;
|
||||
if (!playerInInnerSystem ())
|
||||
{
|
||||
GLOBAL (ip_planet) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ip_planet is 1-based because code tests for ip_planet!=0
|
||||
GLOBAL (ip_planet) = 1 + planetIndex (pSolarSysState,
|
||||
pSolarSysState->pOrbitalDesc);
|
||||
GLOBAL (ip_location) = pSolarSysState->SunDesc[0].location;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
FreeSolarSys (void)
|
||||
{
|
||||
@@ -479,7 +493,7 @@ FreeSolarSys (void)
|
||||
pSolarSysState->MenuState.flash_task = 0;
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
SaveSolarSysLocation ();
|
||||
saveNonOrbitalLocation ();
|
||||
}
|
||||
|
||||
DestroyDrawable (ReleaseDrawable (SolarSysFrame));
|
||||
@@ -932,10 +946,7 @@ enterOrbital (PLANET_DESC *planet)
|
||||
{
|
||||
ZeroVelocityComponents (&GLOBAL (velocity));
|
||||
pSolarSysState->pOrbitalDesc = planet;
|
||||
|
||||
// XXX: This is nasty: signal enter orbital
|
||||
assert (pSolarSysState->MenuState.Initialized == 1);
|
||||
pSolarSysState->MenuState.Initialized = 2;
|
||||
pSolarSysState->InOrbit = TRUE;
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
@@ -1286,7 +1297,8 @@ EnterPlanetOrbit (void)
|
||||
CHECK_ABORT | CHECK_LOAD))
|
||||
&& GLOBAL_SIS (CrewEnlisted) != (COUNT)~0)
|
||||
{ // Reload the system and return to the inner view
|
||||
LoadSolarSys ();
|
||||
PLANET_DESC *orbital = LoadSolarSys ();
|
||||
assert (!orbital);
|
||||
CheckZoomLevel ();
|
||||
ValidateOrbits ();
|
||||
ValidateInnerOrbits ();
|
||||
@@ -1304,7 +1316,7 @@ InitSolarSys (void)
|
||||
{
|
||||
BOOLEAN InnerSystem;
|
||||
BOOLEAN Reentry;
|
||||
BOOLEAN orbital;
|
||||
PLANET_DESC *orbital;
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
|
||||
@@ -1359,8 +1371,7 @@ InitSolarSys (void)
|
||||
|
||||
if (orbital)
|
||||
{
|
||||
// XXX: signal enter orbital
|
||||
pSolarSysState->MenuState.Initialized = 2;
|
||||
enterOrbital (orbital);
|
||||
}
|
||||
else
|
||||
{ // Draw the borders, the system (inner or outer) and fade/transition
|
||||
@@ -1374,7 +1385,6 @@ InitSolarSys (void)
|
||||
DrawSISMessage (NULL);
|
||||
|
||||
ResetSolarSys ();
|
||||
pSolarSysState->MenuState.Initialized = 1;
|
||||
|
||||
if (LastActivity == (CHECK_LOAD | CHECK_RESTART))
|
||||
{ // Starting a new game, NOT from load!
|
||||
@@ -1737,6 +1747,7 @@ ExploreSolarSys (void)
|
||||
SolarSysState.genFuncs = getGenerateFunctions (CurStarDescPtr->Index);
|
||||
|
||||
InitSolarSys ();
|
||||
SolarSysState.MenuState.Initialized = TRUE;
|
||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||
DoInput (&SolarSysState.MenuState, FALSE);
|
||||
UninitSolarSys ();
|
||||
@@ -1746,7 +1757,7 @@ ExploreSolarSys (void)
|
||||
UNICODE *
|
||||
GetNamedPlanetaryBody (void)
|
||||
{
|
||||
if (!CurStarDescPtr || !playerInInnerSystem ())
|
||||
if (!CurStarDescPtr || !playerInSolarSystem () || !playerInInnerSystem ())
|
||||
return NULL; // Not inside an inner system, so no name
|
||||
|
||||
assert (pSolarSysState->pOrbitalDesc != NULL);
|
||||
@@ -1837,7 +1848,7 @@ GetPlanetOrMoonName (UNICODE *buf, COUNT bufsize)
|
||||
// Either not named or we already have a name
|
||||
utf8StringCopy (buf, bufsize, GLOBAL_SIS (PlanetName));
|
||||
|
||||
if (!playerInInnerSystem () ||
|
||||
if (!playerInSolarSystem () || !playerInInnerSystem () ||
|
||||
worldIsPlanet (pSolarSysState, pSolarSysState->pOrbitalDesc))
|
||||
{ // Outer or inner system or orbiting a planet
|
||||
return;
|
||||
@@ -1861,25 +1872,12 @@ SaveSolarSysLocation (void)
|
||||
assert (playerInSolarSystem ());
|
||||
|
||||
// This is a two-stage saving procedure
|
||||
// Stage 1: called when saving from inner/outer view, and when
|
||||
// entering orbital
|
||||
// Stage 1: called when saving from inner/outer view
|
||||
// Stage 2: called when saving from orbital
|
||||
|
||||
if (!playerInPlanetOrbit ())
|
||||
{
|
||||
// XXX: Solar system reentry test depends on ShipFacing != 0
|
||||
GLOBAL (ShipFacing) = GetFrameIndex (GLOBAL (ShipStamp.frame)) + 1;
|
||||
GLOBAL (in_orbit) = 0;
|
||||
if (!playerInInnerSystem ())
|
||||
{
|
||||
GLOBAL (ip_planet) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GLOBAL (ip_planet) = 1 + planetIndex (pSolarSysState,
|
||||
pSolarSysState->pOrbitalDesc);
|
||||
GLOBAL (ip_location) = pSolarSysState->SunDesc[0].location;
|
||||
}
|
||||
saveNonOrbitalLocation ();
|
||||
}
|
||||
else
|
||||
{ // In orbit around a planet.
|
||||
@@ -1895,6 +1893,7 @@ SaveSolarSysLocation (void)
|
||||
// GLOBAL (ip_planet) is already set
|
||||
assert (GLOBAL (ip_planet) != 0);
|
||||
|
||||
// has to be at least 1 because code tests for in_orbit!=0
|
||||
moon = 1; /* the planet itself */
|
||||
if (worldIsMoon (pSolarSysState, pSolarSysState->pOrbitalDesc))
|
||||
{
|
||||
@@ -2013,18 +2012,13 @@ DoIpFlight (MENU_STATE *pMS)
|
||||
static TimeCount NextTime;
|
||||
BOOLEAN cancel = PulsedInputState.menu[KEY_MENU_CANCEL];
|
||||
|
||||
if (!pMS->Initialized)
|
||||
{
|
||||
// XXX: This should be unreachable now
|
||||
// XXX: pMS refers to pSolarSysState->MenuState
|
||||
pMS->Initialized = 1;
|
||||
}
|
||||
else if (pMS->Initialized == 2)
|
||||
(void) pMS; // suppress unused warning
|
||||
|
||||
if (pSolarSysState->InOrbit)
|
||||
{ // CheckShipLocation() or InitSolarSys() sent us to orbital
|
||||
EnterPlanetOrbit ();
|
||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||
// XXX: pMS refers to pSolarSysState->MenuState
|
||||
pMS->Initialized = 1;
|
||||
pSolarSysState->InOrbit = FALSE;
|
||||
}
|
||||
else if (cancel || LastActivity == CHECK_LOAD)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user