Cleanups
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1834 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -59,11 +59,59 @@ MUSIC_REF SpaceMusic;
|
|||||||
#define GRAB_BKGND (1 << 7)
|
#define GRAB_BKGND (1 << 7)
|
||||||
|
|
||||||
static SIZE old_radius;
|
static SIZE old_radius;
|
||||||
BYTE draw_sys_flags = DRAW_STARS
|
BYTE draw_sys_flags = DRAW_STARS | DRAW_PLANETS | DRAW_ORBITS
|
||||||
| DRAW_PLANETS
|
| DRAW_HYPER_COORDS | GRAB_BKGND;
|
||||||
| DRAW_ORBITS
|
|
||||||
| DRAW_HYPER_COORDS
|
static void
|
||||||
| GRAB_BKGND;
|
GeneratePlanets (void)
|
||||||
|
{
|
||||||
|
COUNT i;
|
||||||
|
PPLANET_DESC pCurDesc;
|
||||||
|
|
||||||
|
for (i = pSolarSysState->SunDesc[0].NumPlanets,
|
||||||
|
pCurDesc = &pSolarSysState->PlanetDesc[0]; i;
|
||||||
|
--i, ++pCurDesc)
|
||||||
|
{
|
||||||
|
DWORD rand_val;
|
||||||
|
BYTE byte_val;
|
||||||
|
BYTE num_moons;
|
||||||
|
BYTE type;
|
||||||
|
|
||||||
|
rand_val = TFB_Random ();
|
||||||
|
byte_val = LOBYTE (rand_val);
|
||||||
|
|
||||||
|
num_moons = 0;
|
||||||
|
type = PlanData[pCurDesc->data_index & ~PLANET_SHIELDED].Type;
|
||||||
|
switch (PLANSIZE (type))
|
||||||
|
{
|
||||||
|
case LARGE_ROCKY_WORLD:
|
||||||
|
if (byte_val < 0x00FF * 25 / 100)
|
||||||
|
{
|
||||||
|
if (byte_val < 0x00FF * 5 / 100)
|
||||||
|
++num_moons;
|
||||||
|
++num_moons;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GAS_GIANT:
|
||||||
|
if (byte_val < 0x00FF * 90 / 100)
|
||||||
|
{
|
||||||
|
if (byte_val < 0x00FF * 75 / 100)
|
||||||
|
{
|
||||||
|
if (byte_val < 0x00FF * 50 / 100)
|
||||||
|
{
|
||||||
|
if (byte_val < 0x00FF * 25 / 100)
|
||||||
|
++num_moons;
|
||||||
|
++num_moons;
|
||||||
|
}
|
||||||
|
++num_moons;
|
||||||
|
}
|
||||||
|
++num_moons;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pCurDesc->NumPlanets = num_moons;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
GenerateMoons (void)
|
GenerateMoons (void)
|
||||||
@@ -103,17 +151,17 @@ GenerateMoons (void)
|
|||||||
pMoonDesc->temp_color = pCurDesc->temp_color;
|
pMoonDesc->temp_color = pCurDesc->temp_color;
|
||||||
|
|
||||||
data_index = pMoonDesc->data_index;
|
data_index = pMoonDesc->data_index;
|
||||||
/* Starbase */
|
|
||||||
if (data_index == (BYTE)~0)
|
if (data_index == (BYTE)~0)
|
||||||
{
|
{
|
||||||
pMoonDesc->image.frame = SetAbsFrameIndex (
|
/* Starbase */
|
||||||
SpaceJunkFrame, 16);
|
pMoonDesc->image.frame =
|
||||||
|
SetAbsFrameIndex (SpaceJunkFrame, 16);
|
||||||
}
|
}
|
||||||
/* Samatra */
|
|
||||||
else if (data_index == (BYTE)(~0 - 1))
|
else if (data_index == (BYTE)(~0 - 1))
|
||||||
{
|
{
|
||||||
pMoonDesc->image.frame = SetAbsFrameIndex (
|
/* Sa-Matra */
|
||||||
SpaceJunkFrame, 19);
|
pMoonDesc->image.frame =
|
||||||
|
SetAbsFrameIndex (SpaceJunkFrame, 19);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,11 +214,11 @@ LoadSolarSys (void)
|
|||||||
#define NUM_TEMP_RANGES 5
|
#define NUM_TEMP_RANGES 5
|
||||||
COLOR temp_color_array[NUM_TEMP_RANGES] =
|
COLOR temp_color_array[NUM_TEMP_RANGES] =
|
||||||
{
|
{
|
||||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0xE), 0x54),
|
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x0E), 0x54),
|
||||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0x6, 0x8), 0x62),
|
BUILD_COLOR (MAKE_RGB15 (0x00, 0x06, 0x08), 0x62),
|
||||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0xB, 0x00), 0x6D),
|
BUILD_COLOR (MAKE_RGB15 (0x00, 0x0B, 0x00), 0x6D),
|
||||||
BUILD_COLOR (MAKE_RGB15 (0xF, 0x00, 0x00), 0x2D),
|
BUILD_COLOR (MAKE_RGB15 (0x0F, 0x00, 0x00), 0x2D),
|
||||||
BUILD_COLOR (MAKE_RGB15 (0xF, 0x8, 0x00), 0x75),
|
BUILD_COLOR (MAKE_RGB15 (0x0F, 0x08, 0x00), 0x75),
|
||||||
};
|
};
|
||||||
|
|
||||||
pSolarSysState->MenuState.CurState = 0;
|
pSolarSysState->MenuState.CurState = 0;
|
||||||
@@ -385,8 +433,7 @@ CheckIntersect (BOOLEAN just_checking)
|
|||||||
PlanetIntersect.EndPoint = PlanetIntersect.IntersectStamp.origin;
|
PlanetIntersect.EndPoint = PlanetIntersect.IntersectStamp.origin;
|
||||||
if (pSolarSysState->WaitIntersect != (COUNT)~0
|
if (pSolarSysState->WaitIntersect != (COUNT)~0
|
||||||
&& pSolarSysState->WaitIntersect != MAKE_WORD (
|
&& pSolarSysState->WaitIntersect != MAKE_WORD (
|
||||||
pCurDesc - pSolarSysState->PlanetDesc + 1, 1
|
pCurDesc - pSolarSysState->PlanetDesc + 1, 1))
|
||||||
))
|
|
||||||
PlanetIntersect.IntersectStamp.frame = DecFrameIndex (stars_in_space);
|
PlanetIntersect.IntersectStamp.frame = DecFrameIndex (stars_in_space);
|
||||||
else
|
else
|
||||||
PlanetIntersect.IntersectStamp.frame = pCurDesc->image.frame;
|
PlanetIntersect.IntersectStamp.frame = pCurDesc->image.frame;
|
||||||
@@ -425,7 +472,6 @@ ShowPlanet:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
for (i = pCurDesc->NumPlanets,
|
for (i = pCurDesc->NumPlanets,
|
||||||
pCurDesc = pSolarSysState->pBaseDesc; i; --i, ++pCurDesc)
|
pCurDesc = pSolarSysState->pBaseDesc; i; --i, ++pCurDesc)
|
||||||
{
|
{
|
||||||
@@ -511,7 +557,6 @@ ShowPlanet:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pSolarSysState->WaitIntersect != (COUNT)~0 || NewWaitPlanet == 0)
|
if (pSolarSysState->WaitIntersect != (COUNT)~0 || NewWaitPlanet == 0)
|
||||||
pSolarSysState->WaitIntersect = NewWaitPlanet;
|
pSolarSysState->WaitIntersect = NewWaitPlanet;
|
||||||
@@ -781,11 +826,10 @@ ProcessShipControls (void)
|
|||||||
|
|
||||||
if (delta_x || delta_y < 0)
|
if (delta_x || delta_y < 0)
|
||||||
{
|
{
|
||||||
GLOBAL (autopilot.x) =
|
GLOBAL (autopilot.x) = ~0;
|
||||||
GLOBAL (autopilot.y) = ~0;
|
GLOBAL (autopilot.y) = ~0;
|
||||||
}
|
}
|
||||||
else if (GLOBAL (autopilot.x) != ~0
|
else if (GLOBAL (autopilot.x) != ~0 && GLOBAL (autopilot.y) != ~0)
|
||||||
&& GLOBAL (autopilot.y) != ~0)
|
|
||||||
delta_y = -1;
|
delta_y = -1;
|
||||||
else
|
else
|
||||||
delta_y = 0;
|
delta_y = 0;
|
||||||
@@ -801,8 +845,7 @@ ProcessShipControls (void)
|
|||||||
index = NORMALIZE_FACING (index + 1);
|
index = NORMALIZE_FACING (index + 1);
|
||||||
|
|
||||||
GLOBAL (ShipStamp.frame) =
|
GLOBAL (ShipStamp.frame) =
|
||||||
SetAbsFrameIndex (GLOBAL (ShipStamp.frame),
|
SetAbsFrameIndex (GLOBAL (ShipStamp.frame), index);
|
||||||
index);
|
|
||||||
|
|
||||||
pSolarSysState->turn_counter = pSolarSysState->turn_wait;
|
pSolarSysState->turn_counter = pSolarSysState->turn_wait;
|
||||||
}
|
}
|
||||||
@@ -851,10 +894,8 @@ UndrawShip (void)
|
|||||||
pSolarSysState->pBaseDesc = pSolarSysState->PlanetDesc;
|
pSolarSysState->pBaseDesc = pSolarSysState->PlanetDesc;
|
||||||
|
|
||||||
pSolarSysState->WaitIntersect = MAKE_WORD (
|
pSolarSysState->WaitIntersect = MAKE_WORD (
|
||||||
pPlanetDesc - pSolarSysState->PlanetDesc + 1, 0
|
pPlanetDesc - pSolarSysState->PlanetDesc + 1, 0);
|
||||||
);
|
GLOBAL (ip_location) = pSolarSysState->SunDesc[0].location;
|
||||||
GLOBAL (ip_location) =
|
|
||||||
pSolarSysState->SunDesc[0].location;
|
|
||||||
ZeroVelocityComponents (&GLOBAL (velocity));
|
ZeroVelocityComponents (&GLOBAL (velocity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,7 +1037,7 @@ ScaleSystem (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Constants and routines for handling interplanetary play. TODO:
|
/* Constants and routines for handling interplanetary play. TODO:
|
||||||
this is NOT INSTANTIABLE; only one IP task may be active at any
|
this is NOT THREAD-SAFE; only one IP task may be active at any
|
||||||
given time. --Michael */
|
given time. --Michael */
|
||||||
|
|
||||||
#define IP_FRAME_RATE (ONE_SECOND / 30)
|
#define IP_FRAME_RATE (ONE_SECOND / 30)
|
||||||
@@ -1331,10 +1372,8 @@ StartGroups:
|
|||||||
pSolarSysState->pOrbitalDesc->image.origin;
|
pSolarSysState->pOrbitalDesc->image.origin;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLOBAL (ShipStamp.origin.x) =
|
GLOBAL (ShipStamp.origin.x) = SIS_SCREEN_WIDTH >> 1;
|
||||||
SIS_SCREEN_WIDTH >> 1;
|
GLOBAL (ShipStamp.origin.y) = SIS_SCREEN_HEIGHT >> 1;
|
||||||
GLOBAL (ShipStamp.origin.y) =
|
|
||||||
SIS_SCREEN_HEIGHT >> 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1528,7 +1567,6 @@ GenerateRandomIP (BYTE control)
|
|||||||
{
|
{
|
||||||
COUNT i;
|
COUNT i;
|
||||||
DWORD rand_val;
|
DWORD rand_val;
|
||||||
PPLANET_DESC pCurDesc;
|
|
||||||
|
|
||||||
switch (control)
|
switch (control)
|
||||||
{
|
{
|
||||||
@@ -1606,47 +1644,7 @@ GenerateRandomIP (BYTE control)
|
|||||||
case GENERATE_PLANETS:
|
case GENERATE_PLANETS:
|
||||||
{
|
{
|
||||||
FillOrbits ((BYTE)~0, &pSolarSysState->PlanetDesc[0], FALSE);
|
FillOrbits ((BYTE)~0, &pSolarSysState->PlanetDesc[0], FALSE);
|
||||||
for (i = pSolarSysState->SunDesc[0].NumPlanets,
|
GeneratePlanets();
|
||||||
pCurDesc = &pSolarSysState->PlanetDesc[0]; i;
|
|
||||||
--i, ++pCurDesc)
|
|
||||||
{
|
|
||||||
BYTE byte_val;
|
|
||||||
BYTE num_moons;
|
|
||||||
|
|
||||||
rand_val = TFB_Random ();
|
|
||||||
byte_val = LOBYTE (rand_val);
|
|
||||||
|
|
||||||
num_moons = 0;
|
|
||||||
switch (PLANSIZE (PlanData[
|
|
||||||
pCurDesc->data_index & ~PLANET_SHIELDED].Type))
|
|
||||||
{
|
|
||||||
case LARGE_ROCKY_WORLD:
|
|
||||||
if (byte_val < 0x00FF * 25 / 100)
|
|
||||||
{
|
|
||||||
if (byte_val < 0x00FF * 5 / 100)
|
|
||||||
++num_moons;
|
|
||||||
++num_moons;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GAS_GIANT:
|
|
||||||
if (byte_val < 0x00FF * 90 / 100)
|
|
||||||
{
|
|
||||||
if (byte_val < 0x00FF * 75 / 100)
|
|
||||||
{
|
|
||||||
if (byte_val < 0x00FF * 50 / 100)
|
|
||||||
{
|
|
||||||
if (byte_val < 0x00FF * 25 / 100)
|
|
||||||
++num_moons;
|
|
||||||
++num_moons;
|
|
||||||
}
|
|
||||||
++num_moons;
|
|
||||||
}
|
|
||||||
++num_moons;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pCurDesc->NumPlanets = num_moons;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1774,8 +1772,7 @@ DrawStarBackGround (BOOLEAN ForPlanet)
|
|||||||
|
|
||||||
old_seed = TFB_SeedRandom (
|
old_seed = TFB_SeedRandom (
|
||||||
MAKE_DWORD (CurStarDescPtr->star_pt.x,
|
MAKE_DWORD (CurStarDescPtr->star_pt.x,
|
||||||
CurStarDescPtr->star_pt.y)
|
CurStarDescPtr->star_pt.y));
|
||||||
);
|
|
||||||
|
|
||||||
#define NUM_DIM_PIECES 8
|
#define NUM_DIM_PIECES 8
|
||||||
s.frame = SpaceJunkFrame;
|
s.frame = SpaceJunkFrame;
|
||||||
@@ -1821,16 +1818,16 @@ DrawStarBackGround (BOOLEAN ForPlanet)
|
|||||||
|
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
|
|
||||||
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA),
|
SetContextForeGroundColor (
|
||||||
0x08));
|
BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
|
||||||
r.corner.x = SIS_ORG_X - 1;
|
r.corner.x = SIS_ORG_X - 1;
|
||||||
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT - 4;
|
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT - 4;
|
||||||
r.extent.width = SIS_SCREEN_WIDTH + 2;
|
r.extent.width = SIS_SCREEN_WIDTH + 2;
|
||||||
r.extent.height = 3;
|
r.extent.height = 3;
|
||||||
DrawFilledRectangle (&r);
|
DrawFilledRectangle (&r);
|
||||||
|
|
||||||
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8),
|
SetContextForeGroundColor (
|
||||||
0x1F));
|
BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8), 0x1F));
|
||||||
r.extent.width = 1;
|
r.extent.width = 1;
|
||||||
r.extent.height = MAP_HEIGHT + 1;
|
r.extent.height = MAP_HEIGHT + 1;
|
||||||
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT;
|
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT;
|
||||||
@@ -1844,8 +1841,8 @@ DrawStarBackGround (BOOLEAN ForPlanet)
|
|||||||
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT - 5;
|
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT - 5;
|
||||||
DrawFilledRectangle (&r);
|
DrawFilledRectangle (&r);
|
||||||
|
|
||||||
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (
|
SetContextForeGroundColor (
|
||||||
0x10, 0x10, 0x10), 0x19));
|
BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19));
|
||||||
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT - 1;
|
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT - 1;
|
||||||
r.extent.width = MAP_WIDTH + 2;
|
r.extent.width = MAP_WIDTH + 2;
|
||||||
r.corner.x = (SIS_ORG_X + SIS_SCREEN_WIDTH) - MAP_WIDTH - 1;
|
r.corner.x = (SIS_ORG_X + SIS_SCREEN_WIDTH) - MAP_WIDTH - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user