Cleanup of IP display code: GOOD_GUY/BAD_GUY removed; several bugs removed (some previously fixed); special-case hack code moved where it belongs; some comments
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3271 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -178,6 +178,9 @@ extern void GenerateSupox (BYTE control);
|
|||||||
extern void GenerateRainbow (BYTE control);
|
extern void GenerateRainbow (BYTE control);
|
||||||
extern void GenerateIlwrath (BYTE control);
|
extern void GenerateIlwrath (BYTE control);
|
||||||
|
|
||||||
|
// Last race the player battled with, or -1 if no battle took place.
|
||||||
|
// Set to -1 by some funcs to inhibit IP groups from intercepting
|
||||||
|
// the flagship.
|
||||||
extern SIZE EncounterRace;
|
extern SIZE EncounterRace;
|
||||||
extern BYTE EncounterGroup;
|
extern BYTE EncounterGroup;
|
||||||
|
|
||||||
|
|||||||
+97
-112
@@ -33,6 +33,8 @@ NotifyOthers (COUNT which_race, BYTE target_loc)
|
|||||||
{
|
{
|
||||||
HSHIPFRAG hGroup, hNextGroup;
|
HSHIPFRAG hGroup, hNextGroup;
|
||||||
|
|
||||||
|
// NOTE: "Others" includes the group causing the notification too.
|
||||||
|
|
||||||
for (hGroup = GetHeadLink (&GLOBAL (ip_group_q));
|
for (hGroup = GetHeadLink (&GLOBAL (ip_group_q));
|
||||||
hGroup; hGroup = hNextGroup)
|
hGroup; hGroup = hNextGroup)
|
||||||
{
|
{
|
||||||
@@ -41,44 +43,52 @@ NotifyOthers (COUNT which_race, BYTE target_loc)
|
|||||||
GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
hNextGroup = _GetSuccLink (GroupPtr);
|
hNextGroup = _GetSuccLink (GroupPtr);
|
||||||
|
|
||||||
if (GroupPtr->race_id == which_race)
|
if (GroupPtr->race_id != which_race)
|
||||||
{
|
{
|
||||||
BYTE task;
|
UnlockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
task = GroupPtr->task | IGNORE_FLAGSHIP;
|
if (target_loc == IPNL_INTERCEPT_PLAYER)
|
||||||
|
{
|
||||||
|
GroupPtr->task &= ~IGNORE_FLAGSHIP;
|
||||||
|
// XXX: orbit_pos is abused here to store the previous
|
||||||
|
// group destination, before the intercept task.
|
||||||
|
// Returned to dest_loc below.
|
||||||
|
GroupPtr->orbit_pos = GroupPtr->dest_loc;
|
||||||
|
GroupPtr->dest_loc = IPNL_INTERCEPT_PLAYER;
|
||||||
|
}
|
||||||
|
else if (target_loc == IPNL_ALL_CLEAR)
|
||||||
|
{
|
||||||
|
GroupPtr->task |= IGNORE_FLAGSHIP;
|
||||||
|
|
||||||
if (target_loc == 0)
|
if (GroupPtr->dest_loc == IPNL_INTERCEPT_PLAYER)
|
||||||
{
|
{ // The group was intercepting, so send it back where it came
|
||||||
task &= ~IGNORE_FLAGSHIP;
|
// XXX: orbit_pos was abused to store the previous
|
||||||
// XXX: orbit_pos is abused here to store the previous
|
|
||||||
// group destination, before the intercept task.
|
// group destination, before the intercept task.
|
||||||
// Returned to dest_loc below.
|
GroupPtr->dest_loc = GroupPtr->orbit_pos;
|
||||||
GroupPtr->orbit_pos = GroupPtr->dest_loc;
|
|
||||||
/* task = FLEE | IGNORE_FLAGSHIP; */
|
|
||||||
}
|
|
||||||
else if ((target_loc = GroupPtr->dest_loc) == 0)
|
|
||||||
{
|
|
||||||
// XXX: orbit_pos is abused to store the previous
|
|
||||||
// group destination, before the intercept task.
|
|
||||||
target_loc = GroupPtr->orbit_pos;
|
|
||||||
GroupPtr->orbit_pos = NORMALIZE_FACING (TFB_Random ());
|
GroupPtr->orbit_pos = NORMALIZE_FACING (TFB_Random ());
|
||||||
#ifdef OLD
|
#ifdef OLD
|
||||||
target_loc = (BYTE)((
|
GroupPtr->dest_loc = (BYTE)(((COUNT)TFB_Random ()
|
||||||
(COUNT)TFB_Random ()
|
|
||||||
% pSolarSysState->SunDesc[0].NumPlanets) + 1);
|
% pSolarSysState->SunDesc[0].NumPlanets) + 1);
|
||||||
#endif /* OLD */
|
#endif /* OLD */
|
||||||
if (!(task & REFORM_GROUP))
|
|
||||||
{
|
|
||||||
if ((task & ~IGNORE_FLAGSHIP) != EXPLORE)
|
|
||||||
GroupPtr->group_counter = 0;
|
|
||||||
else
|
|
||||||
GroupPtr->group_counter =
|
|
||||||
((COUNT) TFB_Random () % MAX_REVOLUTIONS)
|
|
||||||
<< FACING_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// If the group wasn't intercepting, it will just continue
|
||||||
|
// going about its business.
|
||||||
|
|
||||||
GroupPtr->task = task;
|
if (!(GroupPtr->task & REFORM_GROUP))
|
||||||
|
{
|
||||||
|
if ((GroupPtr->task & ~IGNORE_FLAGSHIP) != EXPLORE)
|
||||||
|
GroupPtr->group_counter = 0;
|
||||||
|
else
|
||||||
|
GroupPtr->group_counter = ((COUNT) TFB_Random ()
|
||||||
|
% MAX_REVOLUTIONS) << FACING_SHIFT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Send the group to the location.
|
||||||
|
// XXX: There is currently no use of such notify that I know of.
|
||||||
|
GroupPtr->task |= IGNORE_FLAGSHIP;
|
||||||
GroupPtr->dest_loc = target_loc;
|
GroupPtr->dest_loc = target_loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,14 +109,11 @@ ip_group_preprocess (ELEMENT *ElementPtr)
|
|||||||
IP_GROUP *GroupPtr;
|
IP_GROUP *GroupPtr;
|
||||||
|
|
||||||
EPtr = ElementPtr;
|
EPtr = ElementPtr;
|
||||||
EPtr->state_flags &=
|
EPtr->state_flags &= ~(DISAPPEARING | NONSOLID); // "I'm not quite dead"
|
||||||
~(DISAPPEARING | NONSOLID); /* "I'm not quite dead." */
|
++EPtr->life_span; // so that it will 'die' again next time
|
||||||
++EPtr->life_span; /* so that it will 'die'
|
|
||||||
* again next time.
|
|
||||||
*/
|
|
||||||
GetElementStarShip (EPtr, &GroupPtr);
|
GetElementStarShip (EPtr, &GroupPtr);
|
||||||
group_loc = GroupPtr->sys_loc;
|
group_loc = GroupPtr->sys_loc; // save old location
|
||||||
/* save old location */
|
|
||||||
DisplayArray[EPtr->PrimIndex].Object.Point = GroupPtr->loc;
|
DisplayArray[EPtr->PrimIndex].Object.Point = GroupPtr->loc;
|
||||||
|
|
||||||
if (group_loc != 0)
|
if (group_loc != 0)
|
||||||
@@ -140,7 +147,7 @@ ip_group_preprocess (ELEMENT *ElementPtr)
|
|||||||
goto ExitIPProcess;
|
goto ExitIPProcess;
|
||||||
|
|
||||||
if ((task & REFORM_GROUP) && --GroupPtr->group_counter == 0)
|
if ((task & REFORM_GROUP) && --GroupPtr->group_counter == 0)
|
||||||
{
|
{ // Finished reforming the group
|
||||||
task &= ~REFORM_GROUP;
|
task &= ~REFORM_GROUP;
|
||||||
GroupPtr->task = task;
|
GroupPtr->task = task;
|
||||||
if ((task & ~IGNORE_FLAGSHIP) != EXPLORE)
|
if ((task & ~IGNORE_FLAGSHIP) != EXPLORE)
|
||||||
@@ -150,26 +157,17 @@ ip_group_preprocess (ELEMENT *ElementPtr)
|
|||||||
% MAX_REVOLUTIONS) << FACING_SHIFT;
|
% MAX_REVOLUTIONS) << FACING_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(task & REFORM_GROUP))
|
// If fleeing *and* ignoring flagship
|
||||||
{
|
if ((task & ~(IGNORE_FLAGSHIP | REFORM_GROUP)) == FLEE
|
||||||
if ((task & ~(IGNORE_FLAGSHIP | REFORM_GROUP)) != FLEE)
|
&& (task & IGNORE_FLAGSHIP))
|
||||||
{
|
{ // Make fleeing groups non-collidable
|
||||||
if (EPtr->state_flags & BAD_GUY)
|
EPtr->state_flags |= NONSOLID;
|
||||||
EPtr->state_flags &= ~GOOD_GUY;
|
|
||||||
else
|
|
||||||
EPtr->state_flags |= BAD_GUY;
|
|
||||||
}
|
|
||||||
else if (!(task & IGNORE_FLAGSHIP)
|
|
||||||
&& !(EPtr->state_flags & (GOOD_GUY | BAD_GUY)))
|
|
||||||
{ // fleeing yehat ship collisions after menu fix
|
|
||||||
EPtr->state_flags |= BAD_GUY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target_loc = GroupPtr->dest_loc;
|
target_loc = GroupPtr->dest_loc;
|
||||||
if (!(task & (IGNORE_FLAGSHIP | REFORM_GROUP)))
|
if (!(task & (IGNORE_FLAGSHIP | REFORM_GROUP)))
|
||||||
{
|
{
|
||||||
if (target_loc == 0 && task != FLEE)
|
if (target_loc == IPNL_INTERCEPT_PLAYER && task != FLEE)
|
||||||
{
|
{
|
||||||
/* if intercepting flagship */
|
/* if intercepting flagship */
|
||||||
target_loc = flagship_loc;
|
target_loc = flagship_loc;
|
||||||
@@ -198,9 +196,10 @@ ip_group_preprocess (ELEMENT *ElementPtr)
|
|||||||
EPtr->thrust_wait = 0;
|
EPtr->thrust_wait = 0;
|
||||||
ZeroVelocityComponents (&EPtr->velocity);
|
ZeroVelocityComponents (&EPtr->velocity);
|
||||||
|
|
||||||
NotifyOthers (GroupPtr->race_id, 0);
|
NotifyOthers (GroupPtr->race_id, IPNL_INTERCEPT_PLAYER);
|
||||||
task = GroupPtr->task;
|
task = GroupPtr->task;
|
||||||
if ((target_loc = GroupPtr->dest_loc) == 0)
|
target_loc = GroupPtr->dest_loc;
|
||||||
|
if (target_loc == IPNL_INTERCEPT_PLAYER)
|
||||||
target_loc = flagship_loc;
|
target_loc = flagship_loc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,10 +208,10 @@ ip_group_preprocess (ELEMENT *ElementPtr)
|
|||||||
GetCurrentVelocityComponents (&EPtr->velocity, &vdx, &vdy);
|
GetCurrentVelocityComponents (&EPtr->velocity, &vdx, &vdy);
|
||||||
|
|
||||||
task &= ~IGNORE_FLAGSHIP;
|
task &= ~IGNORE_FLAGSHIP;
|
||||||
if (task <= ON_STATION)
|
|
||||||
#ifdef NEVER
|
#ifdef NEVER
|
||||||
if (task <= FLEE || (task == ON_STATION
|
if (task <= FLEE || (task == ON_STATION && GroupPtr->dest_loc == 0))
|
||||||
&& GroupPtr->dest_loc == 0))
|
#else
|
||||||
|
if (task <= ON_STATION)
|
||||||
#endif /* NEVER */
|
#endif /* NEVER */
|
||||||
{
|
{
|
||||||
BOOLEAN Transition;
|
BOOLEAN Transition;
|
||||||
@@ -226,12 +225,14 @@ ip_group_preprocess (ELEMENT *ElementPtr)
|
|||||||
dest_pt.x = GroupPtr->loc.x << 1;
|
dest_pt.x = GroupPtr->loc.x << 1;
|
||||||
dest_pt.y = GroupPtr->loc.y << 1;
|
dest_pt.y = GroupPtr->loc.y << 1;
|
||||||
}
|
}
|
||||||
else if (((task != ON_STATION || GroupPtr->dest_loc == 0)
|
else if (((task != ON_STATION ||
|
||||||
|
GroupPtr->dest_loc == IPNL_INTERCEPT_PLAYER)
|
||||||
&& group_loc == target_loc)
|
&& group_loc == target_loc)
|
||||||
|| (task == ON_STATION && GroupPtr->dest_loc
|
|| (task == ON_STATION &&
|
||||||
|
GroupPtr->dest_loc != IPNL_INTERCEPT_PLAYER
|
||||||
&& group_loc == 0))
|
&& group_loc == 0))
|
||||||
{
|
{
|
||||||
if (GroupPtr->dest_loc == 0)
|
if (GroupPtr->dest_loc == IPNL_INTERCEPT_PLAYER)
|
||||||
dest_pt = GLOBAL (ip_location);
|
dest_pt = GLOBAL (ip_location);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -312,7 +313,8 @@ ip_group_preprocess (ELEMENT *ElementPtr)
|
|||||||
{
|
{
|
||||||
SIZE speed;
|
SIZE speed;
|
||||||
|
|
||||||
if (EPtr->thrust_wait && GroupPtr->dest_loc != 0)
|
if (EPtr->thrust_wait &&
|
||||||
|
GroupPtr->dest_loc != IPNL_INTERCEPT_PLAYER)
|
||||||
{
|
{
|
||||||
#define ORBIT_SPEED 60
|
#define ORBIT_SPEED 60
|
||||||
speed = ORBIT_SPEED;
|
speed = ORBIT_SPEED;
|
||||||
@@ -476,6 +478,8 @@ ExitIPProcess:
|
|||||||
+ (COORD)(LOG_SPACE_HEIGHT >> 1)
|
+ (COORD)(LOG_SPACE_HEIGHT >> 1)
|
||||||
- (LOG_SPACE_HEIGHT >> (MAX_REDUCTION + 1));
|
- (LOG_SPACE_HEIGHT >> (MAX_REDUCTION + 1));
|
||||||
|
|
||||||
|
// Don't draw the group if it's not at flagship location,
|
||||||
|
// or flash the group while it's reforming
|
||||||
if (group_loc != flagship_loc
|
if (group_loc != flagship_loc
|
||||||
|| ((task & REFORM_GROUP)
|
|| ((task & REFORM_GROUP)
|
||||||
&& (GroupPtr->group_counter & 1)))
|
&& (GroupPtr->group_counter & 1)))
|
||||||
@@ -497,15 +501,16 @@ static void
|
|||||||
flag_ship_collision (ELEMENT *ElementPtr0, POINT *pPt0,
|
flag_ship_collision (ELEMENT *ElementPtr0, POINT *pPt0,
|
||||||
ELEMENT *ElementPtr1, POINT *pPt1)
|
ELEMENT *ElementPtr1, POINT *pPt1)
|
||||||
{
|
{
|
||||||
if ((GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
if (GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
||||||
|| pSolarSysState->MenuState.CurState
|
return; // ignore the rest of the collisions
|
||||||
|| (ElementPtr1->state_flags & GOOD_GUY))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(ElementPtr1->state_flags & COLLISION)) /* not processed yet */
|
if (!(ElementPtr1->state_flags & COLLISION))
|
||||||
|
{ // The other element's collision has not been processed yet
|
||||||
|
// Defer starting the encounter until it is.
|
||||||
ElementPtr0->state_flags |= COLLISION | NONSOLID;
|
ElementPtr0->state_flags |= COLLISION | NONSOLID;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // Both element's collisions have now been processed
|
||||||
ElementPtr1->state_flags &= ~COLLISION;
|
ElementPtr1->state_flags &= ~COLLISION;
|
||||||
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
||||||
}
|
}
|
||||||
@@ -518,52 +523,49 @@ ip_group_collision (ELEMENT *ElementPtr0, POINT *pPt0,
|
|||||||
ELEMENT *ElementPtr1, POINT *pPt1)
|
ELEMENT *ElementPtr1, POINT *pPt1)
|
||||||
{
|
{
|
||||||
IP_GROUP *GroupPtr;
|
IP_GROUP *GroupPtr;
|
||||||
|
void *OtherPtr;
|
||||||
|
|
||||||
if ((GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
if (GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
||||||
|| pSolarSysState->MenuState.CurState
|
return; // ignore the rest of the collisions
|
||||||
|| (ElementPtr0->state_flags & GOOD_GUY))
|
|
||||||
{
|
|
||||||
ElementPtr0->state_flags &= ~BAD_GUY;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetElementStarShip (ElementPtr0, &GroupPtr);
|
GetElementStarShip (ElementPtr0, &GroupPtr);
|
||||||
if (ElementPtr0->state_flags & ElementPtr1->state_flags & BAD_GUY)
|
GetElementStarShip (ElementPtr1, &OtherPtr);
|
||||||
{
|
if (OtherPtr)
|
||||||
|
{ // Collision with another group
|
||||||
|
// Prevent the groups from coalescing into a single ship icon
|
||||||
if ((ElementPtr0->state_flags & COLLISION)
|
if ((ElementPtr0->state_flags & COLLISION)
|
||||||
|| (ElementPtr1->current.location.x == ElementPtr1->next.location.x
|
|| (ElementPtr1->current.location.x == ElementPtr1->next.location.x
|
||||||
&& ElementPtr1->current.location.y == ElementPtr1->next.location.y))
|
&& ElementPtr1->current.location.y == ElementPtr1->next.location.y))
|
||||||
|
{
|
||||||
ElementPtr0->state_flags &= ~COLLISION;
|
ElementPtr0->state_flags &= ~COLLISION;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ElementPtr1->state_flags |= COLLISION;
|
ElementPtr1->state_flags |= COLLISION;
|
||||||
|
|
||||||
GroupPtr->loc =
|
GroupPtr->loc = DisplayArray[ElementPtr0->PrimIndex].Object.Point;
|
||||||
DisplayArray[ElementPtr0->PrimIndex].Object.Point;
|
|
||||||
ElementPtr0->next.location = ElementPtr0->current.location;
|
ElementPtr0->next.location = ElementPtr0->current.location;
|
||||||
InitIntersectEndPoint (ElementPtr0);
|
InitIntersectEndPoint (ElementPtr0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // if (!OtherPtr)
|
||||||
{
|
{ // Collision with a flagship
|
||||||
EncounterGroup = GroupPtr->group_id;
|
EncounterGroup = GroupPtr->group_id;
|
||||||
|
|
||||||
if (GroupPtr->race_id == URQUAN_DRONE_SHIP)
|
GroupPtr->task |= REFORM_GROUP;
|
||||||
{
|
GroupPtr->group_counter = 100;
|
||||||
GroupPtr->task = FLEE | IGNORE_FLAGSHIP;
|
// Send "all clear" for the time being. After the encounter, if
|
||||||
GroupPtr->dest_loc = 0;
|
// the player battles the group, the "intercept" notify will be
|
||||||
}
|
// resent.
|
||||||
else
|
NotifyOthers (GroupPtr->race_id, IPNL_ALL_CLEAR);
|
||||||
{
|
|
||||||
GroupPtr->task |= REFORM_GROUP;
|
|
||||||
GroupPtr->group_counter = 100;
|
|
||||||
NotifyOthers (GroupPtr->race_id, (BYTE)~0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(ElementPtr1->state_flags & COLLISION)) /* not processed yet */
|
if (!(ElementPtr1->state_flags & COLLISION))
|
||||||
|
{ // The other element's collision has not been processed yet
|
||||||
|
// Defer starting the encounter until it is.
|
||||||
ElementPtr0->state_flags |= COLLISION | NONSOLID;
|
ElementPtr0->state_flags |= COLLISION | NONSOLID;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // Both element's collisions have now been processed
|
||||||
ElementPtr1->state_flags &= ~COLLISION;
|
ElementPtr1->state_flags &= ~COLLISION;
|
||||||
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
||||||
}
|
}
|
||||||
@@ -580,7 +582,6 @@ spawn_ip_group (IP_GROUP *GroupPtr)
|
|||||||
hIPSHIPElement = AllocElement ();
|
hIPSHIPElement = AllocElement ();
|
||||||
if (hIPSHIPElement)
|
if (hIPSHIPElement)
|
||||||
{
|
{
|
||||||
BYTE task;
|
|
||||||
ELEMENT *IPSHIPElementPtr;
|
ELEMENT *IPSHIPElementPtr;
|
||||||
|
|
||||||
LockElement (hIPSHIPElement, &IPSHIPElementPtr);
|
LockElement (hIPSHIPElement, &IPSHIPElementPtr);
|
||||||
@@ -591,21 +592,6 @@ spawn_ip_group (IP_GROUP *GroupPtr)
|
|||||||
IPSHIPElementPtr->state_flags =
|
IPSHIPElementPtr->state_flags =
|
||||||
CHANGING | FINITE_LIFE | IGNORE_VELOCITY;
|
CHANGING | FINITE_LIFE | IGNORE_VELOCITY;
|
||||||
|
|
||||||
task = GroupPtr->task;
|
|
||||||
if (!(task & IGNORE_FLAGSHIP))
|
|
||||||
IPSHIPElementPtr->state_flags |= BAD_GUY;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IPSHIPElementPtr->state_flags |= GOOD_GUY;
|
|
||||||
// XXX: Hack: Yehat revolution start, fleeing groups
|
|
||||||
if (GroupPtr->race_id == YEHAT_SHIP
|
|
||||||
&& GET_GAME_STATE (YEHAT_CIVIL_WAR))
|
|
||||||
{
|
|
||||||
GroupPtr->task = FLEE | (task & REFORM_GROUP);
|
|
||||||
GroupPtr->dest_loc = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetPrimType (&DisplayArray[IPSHIPElementPtr->PrimIndex], STAMP_PRIM);
|
SetPrimType (&DisplayArray[IPSHIPElementPtr->PrimIndex], STAMP_PRIM);
|
||||||
// XXX: Hack: farray points to FRAME[3] and given FRAME
|
// XXX: Hack: farray points to FRAME[3] and given FRAME
|
||||||
IPSHIPElementPtr->current.image.farray = &GroupPtr->melee_icon;
|
IPSHIPElementPtr->current.image.farray = &GroupPtr->melee_icon;
|
||||||
@@ -790,8 +776,7 @@ spawn_flag_ship (void)
|
|||||||
FlagShipElementPtr->sys_loc =
|
FlagShipElementPtr->sys_loc =
|
||||||
(BYTE)(pSolarSysState->pBaseDesc->pPrevDesc
|
(BYTE)(pSolarSysState->pBaseDesc->pPrevDesc
|
||||||
- pSolarSysState->PlanetDesc + 2);
|
- pSolarSysState->PlanetDesc + 2);
|
||||||
FlagShipElementPtr->state_flags =
|
FlagShipElementPtr->state_flags = APPEARING | IGNORE_VELOCITY;
|
||||||
APPEARING | GOOD_GUY | IGNORE_VELOCITY;
|
|
||||||
if (GET_GAME_STATE (ESCAPE_COUNTER))
|
if (GET_GAME_STATE (ESCAPE_COUNTER))
|
||||||
FlagShipElementPtr->state_flags |= NONSOLID;
|
FlagShipElementPtr->state_flags |= NONSOLID;
|
||||||
FlagShipElementPtr->life_span = NORMAL_LIFE;
|
FlagShipElementPtr->life_span = NORMAL_LIFE;
|
||||||
@@ -827,8 +812,8 @@ DoMissions (void)
|
|||||||
spawn_flag_ship ();
|
spawn_flag_ship ();
|
||||||
|
|
||||||
if (EncounterRace >= 0)
|
if (EncounterRace >= 0)
|
||||||
{
|
{ // There was a battle. Call in reinforcements.
|
||||||
NotifyOthers (EncounterRace, 0);
|
NotifyOthers (EncounterRace, IPNL_INTERCEPT_PLAYER);
|
||||||
EncounterRace = -1;
|
EncounterRace = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
#include "libs/compiler.h"
|
#include "libs/compiler.h"
|
||||||
|
|
||||||
extern void NotifyOthers (COUNT which_race, BYTE target_loc);
|
extern void NotifyOthers (COUNT which_race, BYTE target_loc);
|
||||||
|
// Special target locations for NotifyOthers()
|
||||||
|
#define IPNL_INTERCEPT_PLAYER 0
|
||||||
|
#define IPNL_ALL_CLEAR ((BYTE)-1)
|
||||||
|
|
||||||
extern void DoMissions (void);
|
extern void DoMissions (void);
|
||||||
|
|
||||||
#endif /* UQM_IPDISP_H_INCL_ */
|
#endif /* UQM_IPDISP_H_INCL_ */
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ GenerateDruuge (BYTE control)
|
|||||||
{
|
{
|
||||||
if (ActivateStarShip (DRUUGE_SHIP, SPHERE_TRACKING))
|
if (ActivateStarShip (DRUUGE_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (DRUUGE_SHIP, (BYTE)~0);
|
NotifyOthers (DRUUGE_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ GenerateIlwrath (BYTE control)
|
|||||||
{
|
{
|
||||||
if (ActivateStarShip (ILWRATH_SHIP, SPHERE_TRACKING))
|
if (ActivateStarShip (ILWRATH_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (ILWRATH_SHIP, (BYTE)~0);
|
NotifyOthers (ILWRATH_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ GenerateMycon (BYTE control)
|
|||||||
if (CurStarDescPtr->Index == MYCON_DEFINED
|
if (CurStarDescPtr->Index == MYCON_DEFINED
|
||||||
|| !GET_GAME_STATE (SUN_DEVICE_UNGUARDED))
|
|| !GET_GAME_STATE (SUN_DEVICE_UNGUARDED))
|
||||||
{
|
{
|
||||||
NotifyOthers (MYCON_SHIP, (BYTE)~0);
|
NotifyOthers (MYCON_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ GenerateOrz (BYTE control)
|
|||||||
|| !GET_GAME_STATE (TAALO_UNPROTECTED))
|
|| !GET_GAME_STATE (TAALO_UNPROTECTED))
|
||||||
&& ActivateStarShip (ORZ_SHIP, SPHERE_TRACKING))
|
&& ActivateStarShip (ORZ_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (ORZ_SHIP, (BYTE)~0);
|
NotifyOthers (ORZ_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ GenerateTalkingPet (BYTE control)
|
|||||||
|| !GET_GAME_STATE (TALKING_PET)
|
|| !GET_GAME_STATE (TALKING_PET)
|
||||||
|| ActivateStarShip (UMGAH_SHIP, SPHERE_TRACKING)))
|
|| ActivateStarShip (UMGAH_SHIP, SPHERE_TRACKING)))
|
||||||
{
|
{
|
||||||
NotifyOthers (UMGAH_SHIP, (BYTE)~0);
|
NotifyOthers (UMGAH_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ GeneratePkunk (BYTE control)
|
|||||||
{
|
{
|
||||||
if (ActivateStarShip (PKUNK_SHIP, SPHERE_TRACKING))
|
if (ActivateStarShip (PKUNK_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (PKUNK_SHIP, (BYTE)~0);
|
NotifyOthers (PKUNK_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ GenerateSamatra (BYTE control)
|
|||||||
}
|
}
|
||||||
else if (GroupPtr->task & REFORM_GROUP)
|
else if (GroupPtr->task & REFORM_GROUP)
|
||||||
{
|
{
|
||||||
|
// REFORM_GROUP was set in ipdisp.c:ip_group_collision
|
||||||
|
// during a collision with the flagship.
|
||||||
GroupPtr->task &= ~REFORM_GROUP;
|
GroupPtr->task &= ~REFORM_GROUP;
|
||||||
GroupPtr->group_counter = 0;
|
GroupPtr->group_counter = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -26,21 +26,26 @@ static void
|
|||||||
check_old_shofixti (void)
|
check_old_shofixti (void)
|
||||||
{
|
{
|
||||||
HIPGROUP hGroup;
|
HIPGROUP hGroup;
|
||||||
|
IP_GROUP *GroupPtr;
|
||||||
|
|
||||||
if (GLOBAL (BattleGroupRef)
|
if (!GLOBAL (BattleGroupRef))
|
||||||
&& (hGroup = GetHeadLink (&GLOBAL (ip_group_q)))
|
return; // nothing to check
|
||||||
|
|
||||||
|
hGroup = GetHeadLink (&GLOBAL (ip_group_q));
|
||||||
|
if (!hGroup)
|
||||||
|
return; // still nothing to check
|
||||||
|
|
||||||
|
GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
|
// REFORM_GROUP was set in ipdisp.c:ip_group_collision()
|
||||||
|
// during a collision with the flagship.
|
||||||
|
if (GroupPtr->race_id == SHOFIXTI_SHIP
|
||||||
|
&& (GroupPtr->task & REFORM_GROUP)
|
||||||
&& GET_GAME_STATE (SHOFIXTI_RECRUITED))
|
&& GET_GAME_STATE (SHOFIXTI_RECRUITED))
|
||||||
{
|
{
|
||||||
IP_GROUP *GroupPtr;
|
GroupPtr->task = FLEE | IGNORE_FLAGSHIP | REFORM_GROUP;
|
||||||
|
|
||||||
GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
|
||||||
|
|
||||||
GroupPtr->task &= REFORM_GROUP;
|
|
||||||
GroupPtr->task |= FLEE | IGNORE_FLAGSHIP;
|
|
||||||
GroupPtr->dest_loc = 0;
|
GroupPtr->dest_loc = 0;
|
||||||
|
|
||||||
UnlockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
|
||||||
}
|
}
|
||||||
|
UnlockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -54,6 +54,33 @@ init_probe (void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
check_probe (void)
|
||||||
|
{
|
||||||
|
HIPGROUP hGroup;
|
||||||
|
IP_GROUP *GroupPtr;
|
||||||
|
|
||||||
|
if (!GLOBAL (BattleGroupRef))
|
||||||
|
return; // nothing to check
|
||||||
|
|
||||||
|
hGroup = GetHeadLink (&GLOBAL (ip_group_q));
|
||||||
|
if (!hGroup)
|
||||||
|
return; // still nothing to check
|
||||||
|
|
||||||
|
GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
|
// REFORM_GROUP was set in ipdisp.c:ip_group_collision()
|
||||||
|
// during a collision with the flagship.
|
||||||
|
if (GroupPtr->race_id == URQUAN_DRONE_SHIP
|
||||||
|
&& (GroupPtr->task & REFORM_GROUP))
|
||||||
|
{
|
||||||
|
// We just want the probe to take off as fast as possible,
|
||||||
|
// so clear out REFORM_GROUP
|
||||||
|
GroupPtr->task = FLEE | IGNORE_FLAGSHIP;
|
||||||
|
GroupPtr->dest_loc = 0;
|
||||||
|
}
|
||||||
|
UnlockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
generate_energy_nodes (void)
|
generate_energy_nodes (void)
|
||||||
{
|
{
|
||||||
@@ -422,7 +449,10 @@ GenerateSOL (BYTE control)
|
|||||||
break;
|
break;
|
||||||
case REINIT_NPCS:
|
case REINIT_NPCS:
|
||||||
if (GET_GAME_STATE (CHMMR_BOMB_STATE) != 3)
|
if (GET_GAME_STATE (CHMMR_BOMB_STATE) != 3)
|
||||||
|
{
|
||||||
GenerateRandomIP (REINIT_NPCS);
|
GenerateRandomIP (REINIT_NPCS);
|
||||||
|
check_probe ();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLOBAL (BattleGroupRef) = 0;
|
GLOBAL (BattleGroupRef) = 0;
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ GenerateSpathi (BYTE control)
|
|||||||
if (!GET_GAME_STATE (SPATHI_SHIELDED_SELVES)
|
if (!GET_GAME_STATE (SPATHI_SHIELDED_SELVES)
|
||||||
&& ActivateStarShip (SPATHI_SHIP, SPHERE_TRACKING))
|
&& ActivateStarShip (SPATHI_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (SPATHI_SHIP, (BYTE)~0);
|
NotifyOthers (SPATHI_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ GenerateSupox (BYTE control)
|
|||||||
{
|
{
|
||||||
if (ActivateStarShip (SUPOX_SHIP, SPHERE_TRACKING))
|
if (ActivateStarShip (SUPOX_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (SUPOX_SHIP, (BYTE)~0);
|
NotifyOthers (SUPOX_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ GenerateThradd (BYTE control)
|
|||||||
|| (!GET_GAME_STATE (HELIX_UNPROTECTED)
|
|| (!GET_GAME_STATE (HELIX_UNPROTECTED)
|
||||||
&& (BYTE)(GET_GAME_STATE (THRADD_MISSION) - 1) >= 3)))
|
&& (BYTE)(GET_GAME_STATE (THRADD_MISSION) - 1) >= 3)))
|
||||||
{
|
{
|
||||||
NotifyOthers (THRADDASH_SHIP, (BYTE)~0);
|
NotifyOthers (THRADDASH_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ GenerateUtwig (BYTE control)
|
|||||||
|| !GET_GAME_STATE (UTWIG_HAVE_ULTRON))
|
|| !GET_GAME_STATE (UTWIG_HAVE_ULTRON))
|
||||||
&& ActivateStarShip (UTWIG_SHIP, SPHERE_TRACKING))
|
&& ActivateStarShip (UTWIG_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (UTWIG_SHIP, (BYTE)~0);
|
NotifyOthers (UTWIG_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ GenerateVUX (BYTE control)
|
|||||||
&& !GET_GAME_STATE (ZEX_IS_DEAD))))
|
&& !GET_GAME_STATE (ZEX_IS_DEAD))))
|
||||||
&& ActivateStarShip (VUX_SHIP, SPHERE_TRACKING))
|
&& ActivateStarShip (VUX_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (VUX_SHIP, (BYTE)~0);
|
NotifyOthers (VUX_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ GenerateYehat (BYTE control)
|
|||||||
{
|
{
|
||||||
if (ActivateStarShip (YEHAT_SHIP, SPHERE_TRACKING))
|
if (ActivateStarShip (YEHAT_SHIP, SPHERE_TRACKING))
|
||||||
{
|
{
|
||||||
NotifyOthers (YEHAT_SHIP, (BYTE)~0);
|
NotifyOthers (YEHAT_SHIP, IPNL_ALL_CLEAR);
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
ReinitQueue (&GLOBAL (ip_group_q));
|
ReinitQueue (&GLOBAL (ip_group_q));
|
||||||
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
assert (CountLinks (&GLOBAL (npc_built_ship_q)) == 0);
|
||||||
|
|||||||
@@ -28,22 +28,25 @@ static void
|
|||||||
check_scout (void)
|
check_scout (void)
|
||||||
{
|
{
|
||||||
HIPGROUP hGroup;
|
HIPGROUP hGroup;
|
||||||
|
IP_GROUP *GroupPtr;
|
||||||
|
|
||||||
if (GLOBAL (BattleGroupRef)
|
if (!GLOBAL (BattleGroupRef))
|
||||||
&& (hGroup = GetHeadLink (&GLOBAL (ip_group_q))))
|
return; // nothing to check
|
||||||
|
|
||||||
|
hGroup = GetHeadLink (&GLOBAL (ip_group_q));
|
||||||
|
if (!hGroup)
|
||||||
|
return; // still nothing to check
|
||||||
|
|
||||||
|
GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
|
// REFORM_GROUP was set in ipdisp.c:ip_group_collision()
|
||||||
|
// during a collision with the flagship.
|
||||||
|
if (GroupPtr->race_id == ZOQFOTPIK_SHIP
|
||||||
|
&& (GroupPtr->task & REFORM_GROUP))
|
||||||
{
|
{
|
||||||
IP_GROUP *GroupPtr;
|
GroupPtr->task = FLEE | IGNORE_FLAGSHIP | REFORM_GROUP;
|
||||||
|
GroupPtr->dest_loc = 0;
|
||||||
GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
|
||||||
|
|
||||||
if (GroupPtr->task & REFORM_GROUP)
|
|
||||||
{
|
|
||||||
GroupPtr->task = FLEE | IGNORE_FLAGSHIP | REFORM_GROUP;
|
|
||||||
GroupPtr->dest_loc = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
UnlockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
|
||||||
}
|
}
|
||||||
|
UnlockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "../resinst.h"
|
#include "../resinst.h"
|
||||||
#include "../settings.h"
|
#include "../settings.h"
|
||||||
#include "../ipdisp.h"
|
#include "../ipdisp.h"
|
||||||
|
#include "../grpinfo.h"
|
||||||
#include "../process.h"
|
#include "../process.h"
|
||||||
#include "../load.h"
|
#include "../load.h"
|
||||||
#include "../setup.h"
|
#include "../setup.h"
|
||||||
@@ -1653,6 +1654,42 @@ GenerateOrbital (void) {
|
|||||||
LoadPlanet (NULL);
|
LoadPlanet (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
check_yehat_rebellion (void)
|
||||||
|
{
|
||||||
|
HIPGROUP hGroup, hNextGroup;
|
||||||
|
|
||||||
|
// XXX: Is there a better way to do this? I could not find one.
|
||||||
|
// When you talk to a Yehat ship (YEHAT_SHIP) and start the rebellion,
|
||||||
|
// there is no battle following the comm. There is *never* a battle in
|
||||||
|
// an encounter with Rebels, but the group race_id (YEHAT_REBEL_SHIP)
|
||||||
|
// is different from Royalists (YEHAT_SHIP). There is *always* a battle
|
||||||
|
// in an encounter with Royalists.
|
||||||
|
// TRANSLATION: "If the civil war has not started yet, or the player
|
||||||
|
// battled a ship -- bail."
|
||||||
|
if (!GET_GAME_STATE (YEHAT_CIVIL_WAR) || EncounterRace >= 0)
|
||||||
|
return; // not this time
|
||||||
|
|
||||||
|
// Send Yehat groups to flee the system, but only if the player
|
||||||
|
// has actually talked to a ship.
|
||||||
|
for (hGroup = GetHeadLink (&GLOBAL (ip_group_q)); hGroup;
|
||||||
|
hGroup = hNextGroup)
|
||||||
|
{
|
||||||
|
IP_GROUP *GroupPtr = LockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
|
hNextGroup = _GetSuccLink (GroupPtr);
|
||||||
|
// IGNORE_FLAGSHIP was set in ipdisp.c:ip_group_collision()
|
||||||
|
// during a collision with the flagship.
|
||||||
|
if (GroupPtr->race_id == YEHAT_SHIP
|
||||||
|
&& (GroupPtr->task & IGNORE_FLAGSHIP))
|
||||||
|
{
|
||||||
|
GroupPtr->task &= REFORM_GROUP;
|
||||||
|
GroupPtr->task |= FLEE | IGNORE_FLAGSHIP;
|
||||||
|
GroupPtr->dest_loc = 0;
|
||||||
|
}
|
||||||
|
UnlockIpGroup (&GLOBAL (ip_group_q), hGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GenerateRandomIP (BYTE control)
|
GenerateRandomIP (BYTE control)
|
||||||
{
|
{
|
||||||
@@ -1667,6 +1704,11 @@ GenerateRandomIP (BYTE control)
|
|||||||
break;
|
break;
|
||||||
case REINIT_NPCS:
|
case REINIT_NPCS:
|
||||||
GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP);
|
GetGroupInfo (GROUPS_RANDOM, GROUP_LOAD_IP);
|
||||||
|
// This is not a great place to do the Yehat rebellion check, but
|
||||||
|
// since you can start the rebellion in any star system (not just
|
||||||
|
// the Homeworld), I could not find a better place for it.
|
||||||
|
// At least it is better than where it was originally.
|
||||||
|
check_yehat_rebellion ();
|
||||||
break;
|
break;
|
||||||
case UNINIT_NPCS:
|
case UNINIT_NPCS:
|
||||||
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
PutGroupInfo (GROUPS_RANDOM, GROUP_SAVE_IP);
|
||||||
|
|||||||
Reference in New Issue
Block a user