Cleanup of lander: ELEMENT.playerNr introduced; GOOD_GUY/BAD_GUY removed
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3272 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -107,6 +107,10 @@ struct element
|
|||||||
CollisionFunc *collision_func;
|
CollisionFunc *collision_func;
|
||||||
void (*death_func) (struct element *ElementPtr);
|
void (*death_func) (struct element *ElementPtr);
|
||||||
|
|
||||||
|
// Player this element belongs to
|
||||||
|
// 0: Bottom player in Melee; The Player in full-game
|
||||||
|
COUNT playerNr;
|
||||||
|
|
||||||
ELEMENT_FLAGS state_flags;
|
ELEMENT_FLAGS state_flags;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ CheckObjectCollision (COUNT index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (&DisplayArray[ElementPtr->PrimIndex] != pPrim
|
if (&DisplayArray[ElementPtr->PrimIndex] != pPrim
|
||||||
|| !(ElementPtr->state_flags & BAD_GUY))
|
|| ElementPtr->playerNr != PS_NON_PLAYER)
|
||||||
{
|
{
|
||||||
UnlockElement (hElement);
|
UnlockElement (hElement);
|
||||||
continue;
|
continue;
|
||||||
@@ -950,7 +950,8 @@ AddLightning (void)
|
|||||||
|
|
||||||
LockElement (hLightningElement, &LightningElementPtr);
|
LockElement (hLightningElement, &LightningElementPtr);
|
||||||
|
|
||||||
LightningElementPtr->state_flags = FINITE_LIFE | BAD_GUY;
|
LightningElementPtr->playerNr = PS_NON_PLAYER;
|
||||||
|
LightningElementPtr->state_flags = FINITE_LIFE;
|
||||||
LightningElementPtr->preprocess_func = lightning_process;
|
LightningElementPtr->preprocess_func = lightning_process;
|
||||||
if ((BYTE)TFB_Random () >= (256 >> 2))
|
if ((BYTE)TFB_Random () >= (256 >> 2))
|
||||||
LightningElementPtr->mass_points = 0; /* harmless */
|
LightningElementPtr->mass_points = 0; /* harmless */
|
||||||
@@ -1002,7 +1003,8 @@ AddGroundDisaster (COUNT which_disaster)
|
|||||||
|
|
||||||
pPrim = &DisplayArray[GroundDisasterElementPtr->PrimIndex];
|
pPrim = &DisplayArray[GroundDisasterElementPtr->PrimIndex];
|
||||||
GroundDisasterElementPtr->mass_points = which_disaster;
|
GroundDisasterElementPtr->mass_points = which_disaster;
|
||||||
GroundDisasterElementPtr->state_flags = FINITE_LIFE | BAD_GUY;
|
GroundDisasterElementPtr->playerNr = PS_NON_PLAYER;
|
||||||
|
GroundDisasterElementPtr->state_flags = FINITE_LIFE;
|
||||||
GroundDisasterElementPtr->preprocess_func = object_animation;
|
GroundDisasterElementPtr->preprocess_func = object_animation;
|
||||||
|
|
||||||
rand_val = TFB_Random ();
|
rand_val = TFB_Random ();
|
||||||
@@ -1115,7 +1117,7 @@ BuildObjectList (void)
|
|||||||
ElementPtr->next.location.x += dx;
|
ElementPtr->next.location.x += dx;
|
||||||
ElementPtr->next.location.y += dy;
|
ElementPtr->next.location.y += dy;
|
||||||
/* if not lander's shot */
|
/* if not lander's shot */
|
||||||
if (ElementPtr->state_flags != (FINITE_LIFE | GOOD_GUY))
|
if (ElementPtr->playerNr != PS_HUMAN_PLAYER)
|
||||||
{
|
{
|
||||||
if (ElementPtr->next.location.y < 0)
|
if (ElementPtr->next.location.y < 0)
|
||||||
ElementPtr->next.location.y = 0;
|
ElementPtr->next.location.y = 0;
|
||||||
@@ -1673,8 +1675,9 @@ SetVelocityComponents (
|
|||||||
|
|
||||||
LockElement (hExplosionElement, &ExplosionElementPtr);
|
LockElement (hExplosionElement, &ExplosionElementPtr);
|
||||||
|
|
||||||
|
ExplosionElementPtr->playerNr = PS_HUMAN_PLAYER;
|
||||||
ExplosionElementPtr->mass_points = DEATH_EXPLOSION;
|
ExplosionElementPtr->mass_points = DEATH_EXPLOSION;
|
||||||
ExplosionElementPtr->state_flags = FINITE_LIFE | GOOD_GUY;
|
ExplosionElementPtr->state_flags = FINITE_LIFE;
|
||||||
ExplosionElementPtr->next.location =
|
ExplosionElementPtr->next.location =
|
||||||
pSolarSysState->MenuState.first_item;
|
pSolarSysState->MenuState.first_item;
|
||||||
ExplosionElementPtr->preprocess_func = object_animation;
|
ExplosionElementPtr->preprocess_func = object_animation;
|
||||||
@@ -1781,9 +1784,10 @@ SetVelocityComponents (
|
|||||||
|
|
||||||
LockElement (hWeaponElement, &WeaponElementPtr);
|
LockElement (hWeaponElement, &WeaponElementPtr);
|
||||||
|
|
||||||
|
WeaponElementPtr->playerNr = PS_HUMAN_PLAYER;
|
||||||
WeaponElementPtr->mass_points = 1;
|
WeaponElementPtr->mass_points = 1;
|
||||||
WeaponElementPtr->life_span = 12;
|
WeaponElementPtr->life_span = 12;
|
||||||
WeaponElementPtr->state_flags = FINITE_LIFE | GOOD_GUY;
|
WeaponElementPtr->state_flags = FINITE_LIFE;
|
||||||
WeaponElementPtr->next.location =
|
WeaponElementPtr->next.location =
|
||||||
pSolarSysState->MenuState.first_item;
|
pSolarSysState->MenuState.first_item;
|
||||||
WeaponElementPtr->current.location.x =
|
WeaponElementPtr->current.location.x =
|
||||||
|
|||||||
@@ -61,6 +61,12 @@ extern void FreeLanderData (void);
|
|||||||
|
|
||||||
extern void object_animation (ELEMENT *ElementPtr);
|
extern void object_animation (ELEMENT *ElementPtr);
|
||||||
|
|
||||||
|
// ELEMENT.playerNr constants
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PS_HUMAN_PLAYER,
|
||||||
|
PS_NON_PLAYER,
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* _LANDER_H */
|
#endif /* _LANDER_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1232,7 +1232,7 @@ GeneratePlanetSide (void)
|
|||||||
(*pSolarSysState->GenFunc) ((BYTE)(scan + GENERATE_MINERAL));
|
(*pSolarSysState->GenFunc) ((BYTE)(scan + GENERATE_MINERAL));
|
||||||
|
|
||||||
NodeElementPtr->scan_node = MAKE_WORD (scan, num_nodes + 1);
|
NodeElementPtr->scan_node = MAKE_WORD (scan, num_nodes + 1);
|
||||||
NodeElementPtr->state_flags = BAD_GUY;
|
NodeElementPtr->playerNr = PS_NON_PLAYER;
|
||||||
NodeElementPtr->current.location.x =
|
NodeElementPtr->current.location.x =
|
||||||
pSolarSysState->SysInfo.PlanetInfo.CurPt.x;
|
pSolarSysState->SysInfo.PlanetInfo.CurPt.x;
|
||||||
NodeElementPtr->current.location.y =
|
NodeElementPtr->current.location.y =
|
||||||
|
|||||||
Reference in New Issue
Block a user