Battle & ship code cleanup: GOOD_GUY/BAD_GUY flags removed from Hyperspace; some comments
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3274 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+2
-2
@@ -1575,14 +1575,14 @@ RaceCommunication (void)
|
||||
COUNT NumShips;
|
||||
ENCOUNTER *EncounterPtr;
|
||||
|
||||
// The encounter globe that the flagship collided with is moved
|
||||
// to the head of the queue in hyper.c:cleanup_hyperspace()
|
||||
hEncounter = GetHeadEncounter ();
|
||||
LockEncounter (hEncounter, &EncounterPtr);
|
||||
|
||||
NumShips = LONIBBLE (EncounterPtr->SD.Index);
|
||||
for (i = 0; i < NumShips; ++i)
|
||||
{
|
||||
// XXX: Bug 996 lives here: crew is set to default (0)
|
||||
// None of ship info is actually used!
|
||||
CloneShipFragment (EncounterPtr->SD.Type,
|
||||
&GLOBAL (npc_built_ship_q),
|
||||
EncounterPtr->ShipList[i].crew_level);
|
||||
|
||||
+29
-5
@@ -404,8 +404,10 @@ cleanup_hyperspace (void)
|
||||
|
||||
LockElement (EncounterPtr->hElement, &ElementPtr);
|
||||
|
||||
if (ElementPtr->state_flags & BAD_GUY)
|
||||
{
|
||||
if (ElementPtr->hTarget)
|
||||
{ // This is the encounter that collided with flagship
|
||||
// Move the encounter to the head of the queue so that
|
||||
// comm.c:RaceCommunication() gets the right one.
|
||||
RemoveEncounter (hEncounter);
|
||||
InsertEncounter (hEncounter, GetHeadEncounter ());
|
||||
}
|
||||
@@ -861,6 +863,24 @@ encounter_transition (ELEMENT *ElementPtr)
|
||||
}
|
||||
}
|
||||
|
||||
static HELEMENT
|
||||
getSisElement (void)
|
||||
{
|
||||
HSTARSHIP hSis;
|
||||
HELEMENT hShip;
|
||||
STARSHIP *StarShipPtr;
|
||||
|
||||
hSis = GetHeadLink (&race_q[RPG_PLAYER_NUM]);
|
||||
if (!hSis)
|
||||
return NULL;
|
||||
|
||||
StarShipPtr = LockStarShip (&race_q[RPG_PLAYER_NUM], hSis);
|
||||
hShip = StarShipPtr->hShip;
|
||||
UnlockStarShip (&race_q[RPG_PLAYER_NUM], hSis);
|
||||
|
||||
return hShip;
|
||||
}
|
||||
|
||||
static void
|
||||
encounter_collision (ELEMENT *ElementPtr0, POINT *pPt0,
|
||||
ELEMENT *ElementPtr1, POINT *pPt1)
|
||||
@@ -893,7 +913,10 @@ encounter_collision (ELEMENT *ElementPtr0, POINT *pPt0,
|
||||
UnlockEncounter (hEncounter);
|
||||
}
|
||||
|
||||
ElementPtr0->state_flags |= BAD_GUY;
|
||||
// Mark this element as collided with flagship
|
||||
// XXX: We could simply set hTarget to 1 or to ElementPtr1,
|
||||
// but that would be too hacky ;)
|
||||
ElementPtr0->hTarget = getSisElement ();
|
||||
ZeroVelocityComponents (&ElementPtr0->velocity);
|
||||
}
|
||||
(void) pPt0; /* Satisfying compiler (unused parameter) */
|
||||
@@ -1162,8 +1185,9 @@ DeleteEncounter:
|
||||
&delta_x, &delta_y, 1);
|
||||
if (ElementPtr->thrust_wait)
|
||||
--ElementPtr->thrust_wait;
|
||||
else if (!(ElementPtr->state_flags & BAD_GUY))
|
||||
{
|
||||
else if (!ElementPtr->hTarget)
|
||||
{ // This is an encounter that did not collide with flagship
|
||||
// The colliding encounter does not move
|
||||
COUNT cur_facing, delta_facing;
|
||||
|
||||
cur_facing = ANGLE_TO_FACING (
|
||||
|
||||
Reference in New Issue
Block a user