One less dependency on pSolarSysState.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3336 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2009-11-22 11:12:37 +00:00
parent 9d1009ae96
commit 3ed5978b79
+28 -36
View File
@@ -133,11 +133,11 @@ matchWorld (const SOLARSYS_STATE *solarSys, const PLANET_DESC *world,
} }
static void static void
GenerateMoons (void) GenerateMoons (SOLARSYS_STATE *system, PLANET_DESC *planet)
{ {
COUNT i, facing; COUNT i;
COUNT facing;
PLANET_DESC *pMoonDesc; PLANET_DESC *pMoonDesc;
PLANET_DESC *pCurDesc;
DWORD old_seed; DWORD old_seed;
GLOBAL (ip_location.x) = GLOBAL (ip_location.x) =
@@ -148,42 +148,36 @@ GenerateMoons (void)
(SIZE)((long)(GLOBAL (ShipStamp.origin.y) (SIZE)((long)(GLOBAL (ShipStamp.origin.y)
- (SIS_SCREEN_HEIGHT >> 1)) - (SIS_SCREEN_HEIGHT >> 1))
* MAX_ZOOM_RADIUS / (DISPLAY_FACTOR >> 1)); * MAX_ZOOM_RADIUS / (DISPLAY_FACTOR >> 1));
pCurDesc = pSolarSysState->pBaseDesc; old_seed = TFB_SeedRandom (planet->rand_seed);
old_seed = TFB_SeedRandom (pCurDesc->rand_seed);
(*pSolarSysState->genFuncs->generateName) (pSolarSysState, pCurDesc); (*system->genFuncs->generateName) (system, planet);
(*pSolarSysState->genFuncs->generateMoons) (pSolarSysState, pCurDesc); (*system->genFuncs->generateMoons) (system, planet);
facing = NORMALIZE_FACING (ANGLE_TO_FACING ( facing = NORMALIZE_FACING (ANGLE_TO_FACING (
ARCTAN (pCurDesc->location.x, pCurDesc->location.y))); ARCTAN (planet->location.x, planet->location.y)));
for (i = 0, pMoonDesc = &pSolarSysState->MoonDesc[0]; for (i = 0, pMoonDesc = &system->MoonDesc[0];
i < MAX_MOONS; ++i, ++pMoonDesc) i < MAX_MOONS; ++i, ++pMoonDesc)
{ {
pMoonDesc->pPrevDesc = pCurDesc; BYTE data_index;
if (pSolarSysState->MenuState.Initialized > 1
|| i >= pCurDesc->NumPlanets) pMoonDesc->pPrevDesc = planet;
; if (system->MenuState.Initialized > 1 || i >= planet->NumPlanets)
else continue;
pMoonDesc->temp_color = planet->temp_color;
data_index = pMoonDesc->data_index;
if (data_index == HIERARCHY_STARBASE)
{ {
BYTE data_index; pMoonDesc->image.frame = SetAbsFrameIndex (SpaceJunkFrame, 16);
}
pMoonDesc->temp_color = pCurDesc->temp_color; else if (data_index == SA_MATRA)
{
data_index = pMoonDesc->data_index; pMoonDesc->image.frame = SetAbsFrameIndex (SpaceJunkFrame, 19);
if (data_index == HIERARCHY_STARBASE)
{
pMoonDesc->image.frame =
SetAbsFrameIndex (SpaceJunkFrame, 16);
}
else if (data_index == SA_MATRA)
{
pMoonDesc->image.frame =
SetAbsFrameIndex (SpaceJunkFrame, 19);
}
} }
} }
pSolarSysState->pBaseDesc = pSolarSysState->MoonDesc; system->pBaseDesc = system->MoonDesc;
TFB_SeedRandom (old_seed); TFB_SeedRandom (old_seed);
} }
@@ -382,7 +376,7 @@ LoadSolarSys (void)
pSolarSysState->pOrbitalDesc = 0; pSolarSysState->pOrbitalDesc = 0;
pSolarSysState->pBaseDesc = &pSolarSysState->PlanetDesc[i - 1]; pSolarSysState->pBaseDesc = &pSolarSysState->PlanetDesc[i - 1];
pSolarSysState->SunDesc[0].location = GLOBAL (ip_location); pSolarSysState->SunDesc[0].location = GLOBAL (ip_location);
GenerateMoons (); GenerateMoons (pSolarSysState, pSolarSysState->pBaseDesc);
SET_GAME_STATE (PLANETARY_LANDING, 0); SET_GAME_STATE (PLANETARY_LANDING, 0);
} }
@@ -562,13 +556,11 @@ ShowPlanet:
GLOBAL (ShipStamp.origin.x) = GLOBAL (ShipStamp.origin.x) =
(SIS_SCREEN_WIDTH >> 1) + COSINE ( (SIS_SCREEN_WIDTH >> 1) + COSINE (
angle, MIN_MOON_RADIUS angle, MIN_MOON_RADIUS
+ ((MAX_MOONS - 1) * MOON_DELTA) + ((MAX_MOONS - 1) * MOON_DELTA) + (MOON_DELTA >> 2));
+ (MOON_DELTA >> 2));
GLOBAL (ShipStamp.origin.y) = GLOBAL (ShipStamp.origin.y) =
(SIS_SCREEN_HEIGHT >> 1) + SINE ( (SIS_SCREEN_HEIGHT >> 1) + SINE (
angle, MIN_MOON_RADIUS angle, MIN_MOON_RADIUS
+ ((MAX_MOONS - 1) * MOON_DELTA) + ((MAX_MOONS - 1) * MOON_DELTA) + (MOON_DELTA >> 2));
+ (MOON_DELTA >> 2));
if (GLOBAL (ShipStamp.origin.y) < 0) if (GLOBAL (ShipStamp.origin.y) < 0)
GLOBAL (ShipStamp.origin.y) = 1; GLOBAL (ShipStamp.origin.y) = 1;
else if (GLOBAL (ShipStamp.origin.y) >= SIS_SCREEN_HEIGHT) else if (GLOBAL (ShipStamp.origin.y) >= SIS_SCREEN_HEIGHT)
@@ -578,7 +570,7 @@ ShowPlanet:
XFormIPLoc (&pCurDesc->image.origin, XFormIPLoc (&pCurDesc->image.origin,
&pSolarSysState->SunDesc[0].location, FALSE); &pSolarSysState->SunDesc[0].location, FALSE);
ZeroVelocityComponents (&GLOBAL (velocity)); ZeroVelocityComponents (&GLOBAL (velocity));
GenerateMoons (); GenerateMoons (pSolarSysState, pCurDesc);
NewWaitPlanet = 0; NewWaitPlanet = 0;
SetTransitionSource (NULL); SetTransitionSource (NULL);