Some cleanups.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1458 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+58
-78
@@ -87,7 +87,7 @@ BuildGroups (void)
|
|||||||
YEHAT_DEFINED, /* YEHAT_SHIP */
|
YEHAT_DEFINED, /* YEHAT_SHIP */
|
||||||
0, /* MELNORME_SHIP */
|
0, /* MELNORME_SHIP */
|
||||||
DRUUGE_DEFINED, /* DRUUGE_SHIP */
|
DRUUGE_DEFINED, /* DRUUGE_SHIP */
|
||||||
ILWRATH_DEFINED,/* ILWRATH_SHIP */
|
ILWRATH_DEFINED, /* ILWRATH_SHIP */
|
||||||
MYCON_DEFINED, /* MYCON_SHIP */
|
MYCON_DEFINED, /* MYCON_SHIP */
|
||||||
0, /* SLYLANDRO_SHIP */
|
0, /* SLYLANDRO_SHIP */
|
||||||
UMGAH_DEFINED, /* UMGAH_SHIP */
|
UMGAH_DEFINED, /* UMGAH_SHIP */
|
||||||
@@ -117,9 +117,7 @@ BuildGroups (void)
|
|||||||
EXTENDED_SHIP_FRAGMENTPTR TemplatePtr;
|
EXTENDED_SHIP_FRAGMENTPTR TemplatePtr;
|
||||||
|
|
||||||
TemplatePtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
|
TemplatePtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
|
||||||
&GLOBAL (avail_race_q),
|
&GLOBAL (avail_race_q), hTemplate);
|
||||||
hTemplate
|
|
||||||
);
|
|
||||||
hNextShip = _GetSuccLink (TemplatePtr);
|
hNextShip = _GetSuccLink (TemplatePtr);
|
||||||
|
|
||||||
if ((encounter_radius = TemplatePtr->ShipInfo.actual_strength)
|
if ((encounter_radius = TemplatePtr->ShipInfo.actual_strength)
|
||||||
@@ -128,6 +126,9 @@ BuildGroups (void)
|
|||||||
SIZE dx, dy;
|
SIZE dx, dy;
|
||||||
DWORD d_squared;
|
DWORD d_squared;
|
||||||
|
|
||||||
|
// XXX: i is redefined in the line below, so the assignment
|
||||||
|
// to i a few lines ago is useless... is there a bug?
|
||||||
|
// TODO: investigate
|
||||||
if ((i = HomeWorld[Index]) && CurStarDescPtr->Index == (BYTE)i)
|
if ((i = HomeWorld[Index]) && CurStarDescPtr->Index == (BYTE)i)
|
||||||
{
|
{
|
||||||
BestIndex = Index;
|
BestIndex = Index;
|
||||||
@@ -176,10 +177,7 @@ BuildGroups (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FoundHome:
|
FoundHome:
|
||||||
UnlockStarShip (
|
UnlockStarShip (&GLOBAL (avail_race_q), hTemplate);
|
||||||
&GLOBAL (avail_race_q),
|
|
||||||
hTemplate
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BestPercent)
|
if (BestPercent)
|
||||||
@@ -200,13 +198,13 @@ FoundHome:
|
|||||||
num_groups = 5;
|
num_groups = 5;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
for (Index = HINIBBLE (EncounterMakeup[BestIndex]); Index; --Index)
|
for (Index = HINIBBLE (EncounterMakeup[BestIndex]); Index;
|
||||||
|
--Index)
|
||||||
{
|
{
|
||||||
if (Index <= LONIBBLE (EncounterMakeup[BestIndex])
|
if (Index <= LONIBBLE (EncounterMakeup[BestIndex])
|
||||||
|| (COUNT)TFB_Random () % 100 < 50)
|
|| (COUNT)TFB_Random () % 100 < 50)
|
||||||
CloneShipFragment (
|
CloneShipFragment (BestIndex, &GLOBAL (npc_built_ship_q),
|
||||||
BestIndex, &GLOBAL (npc_built_ship_q), 0
|
0);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PutGroupInfo (0L, ++which_group);
|
PutGroupInfo (0L, ++which_group);
|
||||||
@@ -218,8 +216,7 @@ FoundHome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
|
FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID fp)
|
||||||
fp)
|
|
||||||
{
|
{
|
||||||
BYTE RaceType, NumShips;
|
BYTE RaceType, NumShips;
|
||||||
HSTARSHIP hStarShip;
|
HSTARSHIP hStarShip;
|
||||||
@@ -243,8 +240,7 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
|
|||||||
BYTE crew_level;
|
BYTE crew_level;
|
||||||
|
|
||||||
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
|
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
|
||||||
&temp_q, hStarShip
|
&temp_q, hStarShip);
|
||||||
);
|
|
||||||
hNextShip = _GetSuccLink (FragPtr);
|
hNextShip = _GetSuccLink (FragPtr);
|
||||||
crew_level = FragPtr->ShipInfo.crew_level;
|
crew_level = FragPtr->ShipInfo.crew_level;
|
||||||
which_group = GET_GROUP_ID (FragPtr);
|
which_group = GET_GROUP_ID (FragPtr);
|
||||||
@@ -259,12 +255,8 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
|
|||||||
else
|
else
|
||||||
FlushGroupInfo (pGH, 0L, which_group, fp);
|
FlushGroupInfo (pGH, 0L, which_group, fp);
|
||||||
pGH->GroupOffset[which_group] = 0;
|
pGH->GroupOffset[which_group] = 0;
|
||||||
RemoveQueue (
|
RemoveQueue (&temp_q, hStarShip);
|
||||||
&temp_q, hStarShip
|
FreeStarShip (&temp_q, hStarShip);
|
||||||
);
|
|
||||||
FreeStarShip (
|
|
||||||
&temp_q, hStarShip
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GLOBAL (npc_built_ship_q) = temp_q;
|
GLOBAL (npc_built_ship_q) = temp_q;
|
||||||
@@ -279,20 +271,18 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
|
|||||||
|
|
||||||
hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q));
|
hStarShip = GetHeadLink (&GLOBAL (npc_built_ship_q));
|
||||||
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
|
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
&GLOBAL (npc_built_ship_q), hStarShip);
|
||||||
);
|
|
||||||
RaceType = GET_RACE_ID (FragPtr);
|
RaceType = GET_RACE_ID (FragPtr);
|
||||||
SeekResFile (fp, pGH->GroupOffset[which_group], SEEK_SET);
|
SeekResFile (fp, pGH->GroupOffset[which_group], SEEK_SET);
|
||||||
WriteResFile ((PBYTE)&RaceType, sizeof (RaceType), 1, fp);
|
WriteResFile ((PBYTE)&RaceType, sizeof (RaceType), 1, fp);
|
||||||
UnlockStarShip (
|
UnlockStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
SeekResFile (fp, offset, SEEK_SET);
|
SeekResFile (fp, offset, SEEK_SET);
|
||||||
WriteResFile (pGH, sizeof (*pGH), 1, fp);
|
WriteResFile (pGH, sizeof (*pGH), 1, fp);
|
||||||
#ifdef DEBUG_GROUPS
|
#ifdef DEBUG_GROUPS
|
||||||
fprintf (stderr, "1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, SI = %u\n",
|
fprintf (stderr, "1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, "
|
||||||
offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_index);
|
"SI = %u\n", offset, which_group, pGH->GroupOffset[which_group],
|
||||||
|
pGH->NumGroups, pGH->star_index);
|
||||||
#endif /* DEBUG_GROUPS */
|
#endif /* DEBUG_GROUPS */
|
||||||
|
|
||||||
NumShips = (BYTE)CountLinks (&GLOBAL (npc_built_ship_q));
|
NumShips = (BYTE)CountLinks (&GLOBAL (npc_built_ship_q));
|
||||||
@@ -334,11 +324,8 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
|
|||||||
#endif /* DEBUG_GROUPS */
|
#endif /* DEBUG_GROUPS */
|
||||||
Ptr = (PBYTE)&FragPtr->RaceDescPtr;
|
Ptr = (PBYTE)&FragPtr->RaceDescPtr;
|
||||||
WriteResFile ((PBYTE)Ptr,
|
WriteResFile ((PBYTE)Ptr,
|
||||||
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,
|
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr, 1, fp);
|
||||||
1, fp);
|
UnlockStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
|
||||||
UnlockStarShip (
|
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
|
||||||
);
|
|
||||||
hStarShip = hNextShip;
|
hStarShip = hNextShip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,7 +348,8 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
SeekResFile (fp, offset, SEEK_SET);
|
SeekResFile (fp, offset, SEEK_SET);
|
||||||
ReadResFile (&GH, sizeof (GH), 1, fp);
|
ReadResFile (&GH, sizeof (GH), 1, fp);
|
||||||
#ifdef DEBUG_GROUPS
|
#ifdef DEBUG_GROUPS
|
||||||
fprintf (stderr, "GetGroupInfo(%lu): %u(%lu) out of %u\n", offset, which_group, GH.GroupOffset[which_group], GH.NumGroups);
|
fprintf (stderr, "GetGroupInfo(%lu): %u(%lu) out of %u\n", offset,
|
||||||
|
which_group, GH.GroupOffset[which_group], GH.NumGroups);
|
||||||
#endif /* DEBUG_GROUPS */
|
#endif /* DEBUG_GROUPS */
|
||||||
if (which_group == (BYTE)~0)
|
if (which_group == (BYTE)~0)
|
||||||
{
|
{
|
||||||
@@ -369,7 +357,8 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
|
|
||||||
ReinitQueue (&GLOBAL (npc_built_ship_q));
|
ReinitQueue (&GLOBAL (npc_built_ship_q));
|
||||||
#ifdef DEBUG_GROUPS
|
#ifdef DEBUG_GROUPS
|
||||||
fprintf (stderr, "%u == %u\n", GH.star_index, (COUNT)(CurStarDescPtr - star_array));
|
fprintf (stderr, "%u == %u\n", GH.star_index,
|
||||||
|
(COUNT)(CurStarDescPtr - star_array));
|
||||||
#endif /* DEBUG_GROUPS */
|
#endif /* DEBUG_GROUPS */
|
||||||
day_index = GH.day_index;
|
day_index = GH.day_index;
|
||||||
month_index = GH.month_index;
|
month_index = GH.month_index;
|
||||||
@@ -383,8 +372,9 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
|
|
||||||
#ifdef DEBUG_GROUPS
|
#ifdef DEBUG_GROUPS
|
||||||
if (GH.star_index == (COUNT)(CurStarDescPtr - star_array))
|
if (GH.star_index == (COUNT)(CurStarDescPtr - star_array))
|
||||||
fprintf (stderr, "GetGroupInfo: battle groups out of date %u/%u/%u!\n",
|
fprintf (stderr, "GetGroupInfo: battle groups out of "
|
||||||
month_index, day_index, year_index);
|
"date %u/%u/%u!\n", month_index, day_index,
|
||||||
|
year_index);
|
||||||
#endif /* DEBUG_GROUPS */
|
#endif /* DEBUG_GROUPS */
|
||||||
fp = res_OpenResFile (tempDir, RANDGRPINFO_FILE, "wb");
|
fp = res_OpenResFile (tempDir, RANDGRPINFO_FILE, "wb");
|
||||||
GH.NumGroups = 0;
|
GH.NumGroups = 0;
|
||||||
@@ -394,7 +384,8 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (which_group = 1; which_group <= GH.NumGroups; ++which_group)
|
for (which_group = 1; which_group <= GH.NumGroups;
|
||||||
|
++which_group)
|
||||||
{
|
{
|
||||||
if (GH.GroupOffset[which_group] == 0)
|
if (GH.GroupOffset[which_group] == 0)
|
||||||
continue;
|
continue;
|
||||||
@@ -411,17 +402,17 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
hStarShip = CloneShipFragment (RaceType,
|
hStarShip = CloneShipFragment (RaceType,
|
||||||
&GLOBAL (npc_built_ship_q), 0);
|
&GLOBAL (npc_built_ship_q), 0);
|
||||||
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
|
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
&GLOBAL (npc_built_ship_q), hStarShip);
|
||||||
);
|
|
||||||
OwnStarShip (FragPtr, BAD_GUY, 0);
|
OwnStarShip (FragPtr, BAD_GUY, 0);
|
||||||
SET_GROUP_ID (FragPtr, which_group);
|
SET_GROUP_ID (FragPtr, which_group);
|
||||||
|
|
||||||
rand_val = TFB_Random ();
|
rand_val = TFB_Random ();
|
||||||
task = (BYTE)(LOBYTE (LOWORD (rand_val)) % ON_STATION);
|
task = (BYTE)(LOBYTE (LOWORD (rand_val))
|
||||||
|
% ON_STATION);
|
||||||
if (task == FLEE)
|
if (task == FLEE)
|
||||||
task = ON_STATION;
|
task = ON_STATION;
|
||||||
SET_ORBIT_LOC (FragPtr,
|
SET_ORBIT_LOC (FragPtr, NORMALIZE_FACING (
|
||||||
NORMALIZE_FACING (LOBYTE (HIWORD (rand_val))));
|
LOBYTE (HIWORD (rand_val))));
|
||||||
|
|
||||||
group_loc = pSolarSysState->SunDesc[0].NumPlanets;
|
group_loc = pSolarSysState->SunDesc[0].NumPlanets;
|
||||||
if (group_loc == 1 && task == EXPLORE)
|
if (group_loc == 1 && task == EXPLORE)
|
||||||
@@ -438,8 +429,7 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
(HIWORD (rand_val) % 10000) - 5000;
|
(HIWORD (rand_val) % 10000) - 5000;
|
||||||
if (task == EXPLORE)
|
if (task == EXPLORE)
|
||||||
FragPtr->ShipInfo.group_counter =
|
FragPtr->ShipInfo.group_counter =
|
||||||
((COUNT)TFB_Random ()
|
((COUNT)TFB_Random () % MAX_REVOLUTIONS)
|
||||||
% MAX_REVOLUTIONS)
|
|
||||||
<< FACING_SHIFT;
|
<< FACING_SHIFT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -449,16 +439,11 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
COUNT angle;
|
COUNT angle;
|
||||||
POINT org;
|
POINT org;
|
||||||
|
|
||||||
XFormIPLoc (
|
XFormIPLoc (&pSolarSysState->PlanetDesc[
|
||||||
&pSolarSysState->PlanetDesc[
|
group_loc - 1].image.origin, &org,
|
||||||
group_loc - 1
|
FALSE);
|
||||||
].image.origin,
|
angle = FACING_TO_ANGLE (GET_ORBIT_LOC (
|
||||||
&org,
|
FragPtr) + 1);
|
||||||
FALSE
|
|
||||||
);
|
|
||||||
angle = FACING_TO_ANGLE (
|
|
||||||
GET_ORBIT_LOC (FragPtr) + 1
|
|
||||||
);
|
|
||||||
FragPtr->ShipInfo.loc.x = org.x
|
FragPtr->ShipInfo.loc.x = org.x
|
||||||
+ COSINE (angle, STATION_RADIUS);
|
+ COSINE (angle, STATION_RADIUS);
|
||||||
FragPtr->ShipInfo.loc.y = org.y
|
FragPtr->ShipInfo.loc.y = org.y
|
||||||
@@ -471,8 +456,8 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
SET_GROUP_LOC (FragPtr, group_loc);
|
SET_GROUP_LOC (FragPtr, group_loc);
|
||||||
|
|
||||||
#ifdef DEBUG_GROUPS
|
#ifdef DEBUG_GROUPS
|
||||||
fprintf (stderr, "battle group %u(0x%04x) strength %u, "
|
fprintf (stderr, "battle group %u(0x%04x) strength "
|
||||||
"type %u, loc %u<%d, %d>, task %u\n",
|
"%u, type %u, loc %u<%d, %d>, task %u\n",
|
||||||
which_group,
|
which_group,
|
||||||
hStarShip,
|
hStarShip,
|
||||||
NumShips,
|
NumShips,
|
||||||
@@ -482,9 +467,8 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
FragPtr->ShipInfo.loc.y,
|
FragPtr->ShipInfo.loc.y,
|
||||||
task);
|
task);
|
||||||
#endif /* DEBUG_GROUPS */
|
#endif /* DEBUG_GROUPS */
|
||||||
UnlockStarShip (
|
UnlockStarShip (&GLOBAL (npc_built_ship_q),
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
hStarShip);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -544,16 +528,16 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
&GLOBAL (npc_built_ship_q), 0);
|
&GLOBAL (npc_built_ship_q), 0);
|
||||||
|
|
||||||
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
|
FragPtr = (SHIP_FRAGMENTPTR)LockStarShip (
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
&GLOBAL (npc_built_ship_q), hStarShip);
|
||||||
);
|
|
||||||
Ptr = (PBYTE)&FragPtr->RaceDescPtr;
|
Ptr = (PBYTE)&FragPtr->RaceDescPtr;
|
||||||
ReadResFile ((PBYTE)Ptr,
|
ReadResFile ((PBYTE)Ptr,
|
||||||
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,
|
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr, 1,
|
||||||
1, fp);
|
fp);
|
||||||
|
|
||||||
#ifdef DEBUG_GROUPS
|
#ifdef DEBUG_GROUPS
|
||||||
if (which_group == 0)
|
if (which_group == 0)
|
||||||
fprintf (stderr, "G) type %u, loc %u<%d, %d>, task 0x%02x:%u\n",
|
fprintf (stderr, "G) type %u, loc %u<%d, %d>, "
|
||||||
|
"task 0x%02x:%u\n",
|
||||||
RaceType,
|
RaceType,
|
||||||
GET_GROUP_LOC (FragPtr),
|
GET_GROUP_LOC (FragPtr),
|
||||||
FragPtr->ShipInfo.loc.x,
|
FragPtr->ShipInfo.loc.x,
|
||||||
@@ -591,15 +575,9 @@ GetGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
#ifdef DEBUG_GROUPS
|
#ifdef DEBUG_GROUPS
|
||||||
fprintf (stderr, " -- REMOVING\n");
|
fprintf (stderr, " -- REMOVING\n");
|
||||||
#endif /* DEBUG_GROUPS */
|
#endif /* DEBUG_GROUPS */
|
||||||
UnlockStarShip (
|
UnlockStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
RemoveQueue (&GLOBAL (npc_built_ship_q), hStarShip);
|
||||||
);
|
FreeStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
|
||||||
RemoveQueue (
|
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
|
||||||
);
|
|
||||||
FreeStarShip (
|
|
||||||
&GLOBAL (npc_built_ship_q), hStarShip
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -652,7 +630,8 @@ PutGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
month_index = 0;
|
month_index = 0;
|
||||||
day_index = 7;
|
day_index = 7;
|
||||||
year_index = 0;
|
year_index = 0;
|
||||||
ValidateEvent (RELATIVE_EVENT, &month_index, &day_index, &year_index);
|
ValidateEvent (RELATIVE_EVENT, &month_index, &day_index,
|
||||||
|
&year_index);
|
||||||
GH.day_index = (BYTE)day_index;
|
GH.day_index = (BYTE)day_index;
|
||||||
GH.month_index = (BYTE)month_index;
|
GH.month_index = (BYTE)month_index;
|
||||||
GH.year_index = year_index;
|
GH.year_index = year_index;
|
||||||
@@ -660,8 +639,8 @@ PutGroupInfo (DWORD offset, BYTE which_group)
|
|||||||
GH.star_index = CurStarDescPtr - star_array;
|
GH.star_index = CurStarDescPtr - star_array;
|
||||||
#ifdef DEBUG_GROUPS
|
#ifdef DEBUG_GROUPS
|
||||||
fprintf (stderr, "PutGroupInfo(%lu): %u out of %u -- %u/%u/%u\n",
|
fprintf (stderr, "PutGroupInfo(%lu): %u out of %u -- %u/%u/%u\n",
|
||||||
offset, which_group, GH.NumGroups,
|
offset, which_group, GH.NumGroups,
|
||||||
GH.month_index, GH.day_index, GH.year_index);
|
GH.month_index, GH.day_index, GH.year_index);
|
||||||
#endif /* DEBUG_GROUPS */
|
#endif /* DEBUG_GROUPS */
|
||||||
|
|
||||||
FlushGroupInfo (&GH, offset, which_group, fp);
|
FlushGroupInfo (&GH, offset, which_group, fp);
|
||||||
@@ -672,3 +651,4 @@ GH.month_index, GH.day_index, GH.year_index);
|
|||||||
return (offset);
|
return (offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
|
|
||||||
|
// If DEBUG_DEVICES is defined, the device list shown in the game will
|
||||||
|
// include the pictures of all devices defined, regardless of which
|
||||||
|
// devices the player actually possesses.
|
||||||
//#define DEBUG_DEVICES
|
//#define DEBUG_DEVICES
|
||||||
|
|
||||||
static COUNT
|
static COUNT
|
||||||
|
|||||||
@@ -82,8 +82,11 @@ const LIFEFORM_DESC CreatureData[] =
|
|||||||
{SPEED_MOTIONLESS | DANGER_WEAK, MAKE_BYTE (8, 5)},
|
{SPEED_MOTIONLESS | DANGER_WEAK, MAKE_BYTE (8, 5)},
|
||||||
|
|
||||||
{SPEED_MOTIONLESS | DANGER_MONSTROUS, MAKE_BYTE (1, 1)},
|
{SPEED_MOTIONLESS | DANGER_MONSTROUS, MAKE_BYTE (1, 1)},
|
||||||
|
// Evil One
|
||||||
{BEHAVIOR_UNPREDICTABLE | SPEED_SLOW | DANGER_HARMLESS, MAKE_BYTE (0, 1)},
|
{BEHAVIOR_UNPREDICTABLE | SPEED_SLOW | DANGER_HARMLESS, MAKE_BYTE (0, 1)},
|
||||||
|
// Brainbox Bulldozer
|
||||||
{BEHAVIOR_HUNT | AWARENESS_HIGH | SPEED_FAST | DANGER_MONSTROUS, MAKE_BYTE (15, 15)},
|
{BEHAVIOR_HUNT | AWARENESS_HIGH | SPEED_FAST | DANGER_MONSTROUS, MAKE_BYTE (15, 15)},
|
||||||
|
// Zex's Beauty
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FLASH_WIDTH 9
|
#define FLASH_WIDTH 9
|
||||||
@@ -204,9 +207,8 @@ object_animation (PELEMENT ElementPtr)
|
|||||||
{
|
{
|
||||||
COLOR c;
|
COLOR c;
|
||||||
|
|
||||||
if ((c = DamageColorCycle (
|
c = DamageColorCycle (GetPrimColor (pPrim), 0);
|
||||||
GetPrimColor (pPrim), 0
|
if (c == WHITE_COLOR)
|
||||||
)) == WHITE_COLOR)
|
|
||||||
{
|
{
|
||||||
SetPrimType (pPrim, STAMP_PRIM);
|
SetPrimType (pPrim, STAMP_PRIM);
|
||||||
if (ElementPtr->hit_points == 0)
|
if (ElementPtr->hit_points == 0)
|
||||||
@@ -321,6 +323,16 @@ object_animation (PELEMENT ElementPtr)
|
|||||||
DetectPercent = (((BYTE)(CreatureData[index].Attributes
|
DetectPercent = (((BYTE)(CreatureData[index].Attributes
|
||||||
& AWARENESS_MASK) >> AWARENESS_SHIFT) + 1)
|
& AWARENESS_MASK) >> AWARENESS_SHIFT) + 1)
|
||||||
* (30 / 6);
|
* (30 / 6);
|
||||||
|
// XXX: Shouldn't this be dependant on
|
||||||
|
// PLANET_SIDE_RATE somehow? And why is it
|
||||||
|
// written as '30 / 6' instead of 5? Does the 30
|
||||||
|
// specify the (PC) framerate? That doesn't make
|
||||||
|
// sense; I would expect it to be in the
|
||||||
|
// denominator. And even then, it wouldn't give
|
||||||
|
// the same results with different frame rates,
|
||||||
|
// as repeating 'random(x / 30)' 30 times doesn't
|
||||||
|
// generally have the same result as repeating
|
||||||
|
// 'random(x / 35)' 25 times. - SvdB
|
||||||
if (((BYTE)TFB_Random () % 100) < DetectPercent)
|
if (((BYTE)TFB_Random () % 100) < DetectPercent)
|
||||||
{
|
{
|
||||||
ElementPtr->thrust_wait = 0;
|
ElementPtr->thrust_wait = 0;
|
||||||
@@ -383,11 +395,8 @@ object_animation (PELEMENT ElementPtr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetVelocityComponents (
|
SetVelocityComponents (&ElementPtr->velocity,
|
||||||
&ElementPtr->velocity,
|
COSINE (angle, speed), SINE (angle, speed));
|
||||||
COSINE (angle, speed),
|
|
||||||
SINE (angle, speed)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -705,8 +714,7 @@ CheckObjectCollision (COUNT index)
|
|||||||
SetPrimColor (pPrim, WHITE_COLOR);
|
SetPrimColor (pPrim, WHITE_COLOR);
|
||||||
|
|
||||||
PlaySound (SetAbsSoundIndex (
|
PlaySound (SetAbsSoundIndex (
|
||||||
LanderSounds, LANDER_HITS
|
LanderSounds, LANDER_HITS), NotPositional (), NULL, GAME_SOUND_PRIORITY);
|
||||||
), NotPositional (), NULL, GAME_SOUND_PRIORITY);
|
|
||||||
}
|
}
|
||||||
UnlockElement (hElement);
|
UnlockElement (hElement);
|
||||||
break;
|
break;
|
||||||
@@ -726,10 +734,8 @@ CheckObjectCollision (COUNT index)
|
|||||||
{
|
{
|
||||||
if (pPSD->ElementLevel
|
if (pPSD->ElementLevel
|
||||||
+ NumRetrieved > pPSD->MaxElementLevel)
|
+ NumRetrieved > pPSD->MaxElementLevel)
|
||||||
NumRetrieved = (COUNT)(
|
NumRetrieved = (COUNT)(pPSD->MaxElementLevel
|
||||||
pPSD->MaxElementLevel
|
- pPSD->ElementLevel);
|
||||||
- pPSD->ElementLevel
|
|
||||||
);
|
|
||||||
FillLanderHold (pPSD, scan, NumRetrieved);
|
FillLanderHold (pPSD, scan, NumRetrieved);
|
||||||
if (scan == MINERAL_SCAN)
|
if (scan == MINERAL_SCAN)
|
||||||
{
|
{
|
||||||
@@ -1798,39 +1804,22 @@ LoadLanderData (void)
|
|||||||
if (LanderFrame[0] == 0)
|
if (LanderFrame[0] == 0)
|
||||||
{
|
{
|
||||||
LanderFrame[0] =
|
LanderFrame[0] =
|
||||||
CaptureDrawable (
|
CaptureDrawable (LoadGraphic (LANDER_MASK_PMAP_ANIM));
|
||||||
LoadGraphic (LANDER_MASK_PMAP_ANIM)
|
|
||||||
);
|
|
||||||
LanderFrame[1] =
|
LanderFrame[1] =
|
||||||
CaptureDrawable (
|
CaptureDrawable (LoadGraphic (QUAKE_MASK_PMAP_ANIM));
|
||||||
LoadGraphic (QUAKE_MASK_PMAP_ANIM)
|
|
||||||
);
|
|
||||||
LanderFrame[2] =
|
LanderFrame[2] =
|
||||||
CaptureDrawable (
|
CaptureDrawable (LoadGraphic (LIGHTNING_MASK_ANIM));
|
||||||
LoadGraphic (LIGHTNING_MASK_ANIM)
|
|
||||||
);
|
|
||||||
LanderFrame[3] =
|
LanderFrame[3] =
|
||||||
CaptureDrawable (
|
CaptureDrawable (LoadGraphic (LAVA_MASK_PMAP_ANIM));
|
||||||
LoadGraphic (LAVA_MASK_PMAP_ANIM)
|
LanderFrame[4] = CaptureDrawable (LoadGraphic (LANDER_SHIELD_MASK_ANIM));
|
||||||
);
|
|
||||||
LanderFrame[4] =
|
|
||||||
CaptureDrawable (
|
|
||||||
LoadGraphic (LANDER_SHIELD_MASK_ANIM)
|
|
||||||
);
|
|
||||||
LanderFrame[5] =
|
LanderFrame[5] =
|
||||||
CaptureDrawable (
|
CaptureDrawable (LoadGraphic (LANDER_LAUNCH_MASK_PMAP_ANIM));
|
||||||
LoadGraphic (LANDER_LAUNCH_MASK_PMAP_ANIM)
|
|
||||||
);
|
|
||||||
LanderFrame[6] =
|
LanderFrame[6] =
|
||||||
CaptureDrawable (
|
CaptureDrawable (LoadGraphic (LANDER_RETURN_MASK_PMAP_ANIM));
|
||||||
LoadGraphic (LANDER_RETURN_MASK_PMAP_ANIM)
|
|
||||||
);
|
|
||||||
LanderSounds = CaptureSound (LoadSound (LANDER_SOUNDS));
|
LanderSounds = CaptureSound (LoadSound (LANDER_SOUNDS));
|
||||||
|
|
||||||
LanderFrame[7] =
|
LanderFrame[7] =
|
||||||
CaptureDrawable (
|
CaptureDrawable (LoadGraphic (ORBIT_VIEW_ANIM));
|
||||||
LoadGraphic (ORBIT_VIEW_ANIM)
|
|
||||||
);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
COUNT i;
|
COUNT i;
|
||||||
|
|||||||
Reference in New Issue
Block a user