git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1834 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-07-10 00:17:12 +00:00
parent db2ec77dcf
commit ca84db6414
+81 -84
View File
@@ -59,11 +59,59 @@ MUSIC_REF SpaceMusic;
#define GRAB_BKGND (1 << 7)
static SIZE old_radius;
BYTE draw_sys_flags = DRAW_STARS
| DRAW_PLANETS
| DRAW_ORBITS
| DRAW_HYPER_COORDS
| GRAB_BKGND;
BYTE draw_sys_flags = DRAW_STARS | DRAW_PLANETS | DRAW_ORBITS
| DRAW_HYPER_COORDS | GRAB_BKGND;
static void
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
GenerateMoons (void)
@@ -103,17 +151,17 @@ GenerateMoons (void)
pMoonDesc->temp_color = pCurDesc->temp_color;
data_index = pMoonDesc->data_index;
/* Starbase */
if (data_index == (BYTE)~0)
{
pMoonDesc->image.frame = SetAbsFrameIndex (
SpaceJunkFrame, 16);
/* Starbase */
pMoonDesc->image.frame =
SetAbsFrameIndex (SpaceJunkFrame, 16);
}
/* Samatra */
else if (data_index == (BYTE)(~0 - 1))
{
pMoonDesc->image.frame = SetAbsFrameIndex (
SpaceJunkFrame, 19);
/* Sa-Matra */
pMoonDesc->image.frame =
SetAbsFrameIndex (SpaceJunkFrame, 19);
}
}
}
@@ -166,11 +214,11 @@ LoadSolarSys (void)
#define NUM_TEMP_RANGES 5
COLOR temp_color_array[NUM_TEMP_RANGES] =
{
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0xE), 0x54),
BUILD_COLOR (MAKE_RGB15 (0x00, 0x6, 0x8), 0x62),
BUILD_COLOR (MAKE_RGB15 (0x00, 0xB, 0x00), 0x6D),
BUILD_COLOR (MAKE_RGB15 (0xF, 0x00, 0x00), 0x2D),
BUILD_COLOR (MAKE_RGB15 (0xF, 0x8, 0x00), 0x75),
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x0E), 0x54),
BUILD_COLOR (MAKE_RGB15 (0x00, 0x06, 0x08), 0x62),
BUILD_COLOR (MAKE_RGB15 (0x00, 0x0B, 0x00), 0x6D),
BUILD_COLOR (MAKE_RGB15 (0x0F, 0x00, 0x00), 0x2D),
BUILD_COLOR (MAKE_RGB15 (0x0F, 0x08, 0x00), 0x75),
};
pSolarSysState->MenuState.CurState = 0;
@@ -385,8 +433,7 @@ CheckIntersect (BOOLEAN just_checking)
PlanetIntersect.EndPoint = PlanetIntersect.IntersectStamp.origin;
if (pSolarSysState->WaitIntersect != (COUNT)~0
&& pSolarSysState->WaitIntersect != MAKE_WORD (
pCurDesc - pSolarSysState->PlanetDesc + 1, 1
))
pCurDesc - pSolarSysState->PlanetDesc + 1, 1))
PlanetIntersect.IntersectStamp.frame = DecFrameIndex (stars_in_space);
else
PlanetIntersect.IntersectStamp.frame = pCurDesc->image.frame;
@@ -425,7 +472,6 @@ ShowPlanet:
}
}
{
for (i = pCurDesc->NumPlanets,
pCurDesc = pSolarSysState->pBaseDesc; i; --i, ++pCurDesc)
{
@@ -511,7 +557,6 @@ ShowPlanet:
break;
}
}
}
if (pSolarSysState->WaitIntersect != (COUNT)~0 || NewWaitPlanet == 0)
pSolarSysState->WaitIntersect = NewWaitPlanet;
@@ -781,11 +826,10 @@ ProcessShipControls (void)
if (delta_x || delta_y < 0)
{
GLOBAL (autopilot.x) =
GLOBAL (autopilot.x) = ~0;
GLOBAL (autopilot.y) = ~0;
}
else if (GLOBAL (autopilot.x) != ~0
&& GLOBAL (autopilot.y) != ~0)
else if (GLOBAL (autopilot.x) != ~0 && GLOBAL (autopilot.y) != ~0)
delta_y = -1;
else
delta_y = 0;
@@ -801,8 +845,7 @@ ProcessShipControls (void)
index = NORMALIZE_FACING (index + 1);
GLOBAL (ShipStamp.frame) =
SetAbsFrameIndex (GLOBAL (ShipStamp.frame),
index);
SetAbsFrameIndex (GLOBAL (ShipStamp.frame), index);
pSolarSysState->turn_counter = pSolarSysState->turn_wait;
}
@@ -851,10 +894,8 @@ UndrawShip (void)
pSolarSysState->pBaseDesc = pSolarSysState->PlanetDesc;
pSolarSysState->WaitIntersect = MAKE_WORD (
pPlanetDesc - pSolarSysState->PlanetDesc + 1, 0
);
GLOBAL (ip_location) =
pSolarSysState->SunDesc[0].location;
pPlanetDesc - pSolarSysState->PlanetDesc + 1, 0);
GLOBAL (ip_location) = pSolarSysState->SunDesc[0].location;
ZeroVelocityComponents (&GLOBAL (velocity));
}
@@ -996,7 +1037,7 @@ ScaleSystem (void)
}
/* 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 */
#define IP_FRAME_RATE (ONE_SECOND / 30)
@@ -1331,10 +1372,8 @@ StartGroups:
pSolarSysState->pOrbitalDesc->image.origin;
else
{
GLOBAL (ShipStamp.origin.x) =
SIS_SCREEN_WIDTH >> 1;
GLOBAL (ShipStamp.origin.y) =
SIS_SCREEN_HEIGHT >> 1;
GLOBAL (ShipStamp.origin.x) = SIS_SCREEN_WIDTH >> 1;
GLOBAL (ShipStamp.origin.y) = SIS_SCREEN_HEIGHT >> 1;
}
}
@@ -1528,7 +1567,6 @@ GenerateRandomIP (BYTE control)
{
COUNT i;
DWORD rand_val;
PPLANET_DESC pCurDesc;
switch (control)
{
@@ -1606,47 +1644,7 @@ GenerateRandomIP (BYTE control)
case GENERATE_PLANETS:
{
FillOrbits ((BYTE)~0, &pSolarSysState->PlanetDesc[0], FALSE);
for (i = pSolarSysState->SunDesc[0].NumPlanets,
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;
}
GeneratePlanets();
break;
}
}
@@ -1774,8 +1772,7 @@ DrawStarBackGround (BOOLEAN ForPlanet)
old_seed = TFB_SeedRandom (
MAKE_DWORD (CurStarDescPtr->star_pt.x,
CurStarDescPtr->star_pt.y)
);
CurStarDescPtr->star_pt.y));
#define NUM_DIM_PIECES 8
s.frame = SpaceJunkFrame;
@@ -1821,16 +1818,16 @@ DrawStarBackGround (BOOLEAN ForPlanet)
SetContext (ScreenContext);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA),
0x08));
SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08));
r.corner.x = SIS_ORG_X - 1;
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT - 4;
r.extent.width = SIS_SCREEN_WIDTH + 2;
r.extent.height = 3;
DrawFilledRectangle (&r);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8),
0x1F));
SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8), 0x1F));
r.extent.width = 1;
r.extent.height = MAP_HEIGHT + 1;
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;
DrawFilledRectangle (&r);
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (
0x10, 0x10, 0x10), 0x19));
SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19));
r.corner.y = (SIS_ORG_Y + SIS_SCREEN_HEIGHT) - MAP_HEIGHT - 1;
r.extent.width = MAP_WIDTH + 2;
r.corner.x = (SIS_ORG_X + SIS_SCREEN_WIDTH) - MAP_WIDTH - 1;