Rename PROJ_OBJECT -> PROJECTILE and OBJ_BULLET -> OBJ_PROJECTILE for consistency

with other objects. To quickly adapt your patches and avoid conflict noise, run this 
on the revision prior to this one:

  sed -i s/OBJ_BULLET/OBJ_PROJECTILE/g src/*.c src/*.h src/*.l src/*.y
  sed -i s/PROJ_OBJECT/PROJECTILE/g src/*.c src/*.h src/*.l src/*.y


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2061 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-07-12 19:32:26 +00:00
parent 6f358cf600
commit b69de06264
9 changed files with 74 additions and 74 deletions

View File

@ -55,7 +55,7 @@ audio_ObjectDead( void * psObj )
{
SIMPLE_OBJECT *psSimpleObj = (SIMPLE_OBJECT *) psObj;
BASE_OBJECT *psBaseObj;
PROJ_OBJECT *psProj;
PROJECTILE *psProj;
/* check is valid simple object pointer */
if ( psSimpleObj == NULL )
@ -65,9 +65,9 @@ audio_ObjectDead( void * psObj )
}
/* check projectiles */
if ( psSimpleObj->type == OBJ_BULLET )
if ( psSimpleObj->type == OBJ_PROJECTILE )
{
psProj = (PROJ_OBJECT *) psSimpleObj;
psProj = (PROJECTILE *) psSimpleObj;
if ( psProj == NULL )
{
debug( LOG_NEVER, "audio_ObjectDead: projectile object pointer invalid\n" );

View File

@ -42,7 +42,7 @@ typedef enum _object_type
OBJ_DROID, // Droids
OBJ_STRUCTURE, // All Buildings
OBJ_FEATURE, // Things like roads, trees, bridges, fires
OBJ_BULLET, // Comes out of guns, stupid :-)
OBJ_PROJECTILE, // Comes out of guns, stupid :-)
OBJ_TARGET, // for the camera tracking
} OBJECT_TYPE;
@ -112,7 +112,7 @@ SIMPLE_OBJECT;
do { \
assert(object != NULL); \
assert(object->type == OBJ_DROID || object->type == OBJ_STRUCTURE \
|| object->type == OBJ_FEATURE || object->type == OBJ_BULLET \
|| object->type == OBJ_FEATURE || object->type == OBJ_PROJECTILE \
|| object->type == OBJ_TARGET); \
assert(object->type == OBJ_FEATURE || object->type == OBJ_TARGET \
|| object->player < MAX_PLAYERS); \

View File

@ -287,7 +287,7 @@ extern BOOL bucketRenderCurrentList(void)
case RENDER_PROJECTILE:
case RENDER_PROJECTILE_TRANSPARENT:
renderProjectile((PROJ_OBJECT*)thisTag->pObject);
renderProjectile((PROJECTILE*)thisTag->pObject);
break;
case RENDER_ANIMATION:
renderAnimComponent((COMPONENT_OBJECT*)thisTag->pObject);
@ -370,11 +370,11 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
break;
case RENDER_PROJECTILE://not depth sorted
case RENDER_PROJECTILE_TRANSPARENT:
// ((PROJ_OBJECT*)pObject)->psWStats;
// ((PROJECTILE*)pObject)->psWStats;
/* these guys should never be added to the list anyway */
if(((PROJ_OBJECT*)pObject)->psWStats->weaponSubClass == WSC_FLAME ||
((PROJ_OBJECT*)pObject)->psWStats->weaponSubClass == WSC_COMMAND ||
((PROJ_OBJECT*)pObject)->psWStats->weaponSubClass == WSC_EMP)
if(((PROJECTILE*)pObject)->psWStats->weaponSubClass == WSC_FLAME ||
((PROJECTILE*)pObject)->psWStats->weaponSubClass == WSC_COMMAND ||
((PROJECTILE*)pObject)->psWStats->weaponSubClass == WSC_EMP)
{
/* We don't do projectiles from these guys, cos there's an effect instead */
z = -1;
@ -383,7 +383,7 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void* pObject)
{
//the weapon stats holds the reference to which graphic to use
pImd = ((PROJ_OBJECT*)pObject)->psWStats->pInFlightGraphic;
pImd = ((PROJECTILE*)pObject)->psWStats->pInFlightGraphic;
px = player.p.x & (TILE_UNITS-1);
pz = player.p.z & (TILE_UNITS-1);
@ -756,7 +756,7 @@ static SDWORD bucketCalculateState(RENDER_TYPE objectType, void* pObject)
break;
case RENDER_PROJECTILE:
pie = ((PROJ_OBJECT*)pObject)->psWStats->pInFlightGraphic;
pie = ((PROJECTILE*)pObject)->psWStats->pInFlightGraphic;
z = NUM_BUCKETS - pie->texpage;
break;
case RENDER_ANIMATION:

View File

@ -41,14 +41,14 @@ PROJ_STATE;
/***************************************************************************/
struct PROJ_OBJECT;
struct PROJECTILE;
typedef void (* PROJECTILE_FUNC) ( struct PROJ_OBJECT *psObj );
typedef void (* PROJECTILE_FUNC) ( struct PROJECTILE *psObj );
typedef struct PROJ_OBJECT
typedef struct PROJECTILE
{
/* Use only simple object elements */
SIMPLE_ELEMENTS( struct PROJ_OBJECT );
SIMPLE_ELEMENTS( struct PROJECTILE );
UBYTE state; /* current projectile state */
UBYTE airTarget; /* whether the projectile was fired at an airborn target */
@ -73,7 +73,7 @@ typedef struct PROJ_OBJECT
PROJECTILE_FUNC pInFlightFunc;
}
PROJ_OBJECT;
PROJECTILE;
/***************************************************************************/

View File

@ -1084,7 +1084,7 @@ static void calcFlagPosScreenCoords(SDWORD *pX, SDWORD *pY, SDWORD *pR)
/* Renders the bullets and their effects in 3D */
static void display3DProjectiles( void )
{
PROJ_OBJECT *psObj;
PROJECTILE *psObj;
psObj = proj_GetFirst();
@ -1136,7 +1136,7 @@ static void display3DProjectiles( void )
} /* end of function display3DProjectiles */
void renderProjectile(PROJ_OBJECT *psCurr)
void renderProjectile(PROJECTILE *psCurr)
{
WEAPON_STATS *psStats;
Vector3i dv;

View File

@ -50,7 +50,7 @@ extern void renderFeature ( FEATURE *psFeature );
extern void renderProximityMsg ( PROXIMITY_DISPLAY *psProxDisp);
extern void drawTerrainTile ( UDWORD i, UDWORD j, BOOL onWaterEdge );
extern void drawTerrainWaterTile ( UDWORD i, UDWORD j);
extern void renderProjectile ( PROJ_OBJECT *psCurr);
extern void renderProjectile ( PROJECTILE *psCurr);
extern void renderAnimComponent ( const COMPONENT_OBJECT *psObj );
extern void renderDeliveryPoint ( FLAG_POSITION *psPosition );
extern void debugToggleSensorDisplay ( void );

View File

@ -884,7 +884,7 @@ static void ProcessDroidOrder(DROID *psDroid, DROID_ORDER order, UDWORD x, UDWOR
}
break;
case OBJ_BULLET: // shouldn't be getting this!
case OBJ_PROJECTILE: // shouldn't be getting this!
debug( LOG_ERROR, "multibot: order specified destination as a bullet. what am i to do??" );
abort();
break;

View File

@ -134,18 +134,18 @@ extern BOOL godMode;
static UDWORD establishTargetRadius( BASE_OBJECT *psTarget );
static UDWORD establishTargetHeight( BASE_OBJECT *psTarget );
static void proj_InFlightDirectFunc( PROJ_OBJECT *psObj );
static void proj_InFlightIndirectFunc( PROJ_OBJECT *psObj );
static void proj_ImpactFunc( PROJ_OBJECT *psObj );
static void proj_PostImpactFunc( PROJ_OBJECT *psObj );
static void proj_checkBurnDamage( BASE_OBJECT *apsList, PROJ_OBJECT *psProj,
static void proj_InFlightDirectFunc( PROJECTILE *psObj );
static void proj_InFlightIndirectFunc( PROJECTILE *psObj );
static void proj_ImpactFunc( PROJECTILE *psObj );
static void proj_PostImpactFunc( PROJECTILE *psObj );
static void proj_checkBurnDamage( BASE_OBJECT *apsList, PROJECTILE *psProj,
FIRE_BOX *pFireBox );
static SDWORD objectDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD weaponClass,UDWORD weaponSubClass, DROID_HIT_SIDE impactSide);
static DROID_HIT_SIDE getHitSide (PROJ_OBJECT *psObj, DROID *psTarget);
static DROID_HIT_SIDE getHitSide (PROJECTILE *psObj, DROID *psTarget);
/***************************************************************************/
BOOL gfxVisible(PROJ_OBJECT *psObj)
BOOL gfxVisible(PROJECTILE *psObj)
{
BOOL bVisible = FALSE;
@ -212,7 +212,7 @@ proj_InitSystem( void )
{
/* allocate object hashtable */
hashTable_Create( &g_pProjObjTable, PROJ_HASH_TABLE_SIZE,
PROJ_INIT, PROJ_EXT, sizeof(PROJ_OBJECT) );
PROJ_INIT, PROJ_EXT, sizeof(PROJECTILE) );
return TRUE;
}
@ -241,7 +241,7 @@ proj_Shutdown( void )
/***************************************************************************/
static void proj_Destroy(PROJ_OBJECT *psObj)
static void proj_Destroy(PROJECTILE *psObj)
{
CHECK_PROJECTILE(psObj);
@ -260,24 +260,24 @@ static void proj_Destroy(PROJ_OBJECT *psObj)
/***************************************************************************/
PROJ_OBJECT *
PROJECTILE *
proj_GetFirst( void )
{
return (PROJ_OBJECT*)hashTable_GetFirst( g_pProjObjTable );
return (PROJECTILE*)hashTable_GetFirst( g_pProjObjTable );
}
/***************************************************************************/
PROJ_OBJECT *
PROJECTILE *
proj_GetNext( void )
{
return (PROJ_OBJECT*)hashTable_GetNext( g_pProjObjTable );
return (PROJECTILE*)hashTable_GetNext( g_pProjObjTable );
}
/***************************************************************************/
// update the kills after a target is damaged/destroyed
static void proj_UpdateKills(PROJ_OBJECT *psObj, SDWORD percentDamage)
static void proj_UpdateKills(PROJECTILE *psObj, SDWORD percentDamage)
{
DROID *psDroid;
BASE_OBJECT *psSensor;
@ -334,7 +334,7 @@ BOOL
proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
UDWORD tarX, UDWORD tarY, UDWORD tarZ, BASE_OBJECT *psTarget, BOOL bVisible, BOOL bPenetrate, int weapon_slot )
{
PROJ_OBJECT *psObj;
PROJECTILE *psObj;
SDWORD tarHeight, srcHeight, iMinSq;
SDWORD altChange, dx, dy, dz, iVelSq, iVel;
FRACT_D fR, fA, fS, fT, fC;
@ -347,7 +347,7 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
"proj_SendProjectile: invalid weapon stats" );
/* get unused projectile object from hashtable*/
psObj = (PROJ_OBJECT*)hashTable_GetElement( g_pProjObjTable );
psObj = (PROJECTILE*)hashTable_GetElement( g_pProjObjTable );
/* get muzzle offset */
if (psAttacker == NULL)
@ -376,7 +376,7 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
}
/* Initialise the structure */
psObj->type = OBJ_BULLET;
psObj->type = OBJ_PROJECTILE;
psObj->state = PROJ_INFLIGHT;
psObj->psWStats = asWeaponStats + psWeap->nStat;
psObj->x = (UWORD)muzzle.x;
@ -407,9 +407,9 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
if (bPenetrate && psAttacker)
{
// psAttacker is a projectile if bPenetrate
PROJ_OBJECT *psProj = (PROJ_OBJECT*)psAttacker;
PROJECTILE *psProj = (PROJECTILE*)psAttacker;
ASSERT(psProj->type == OBJ_BULLET, "Penetrating but not projectile?");
ASSERT(psProj->type == OBJ_PROJECTILE, "Penetrating but not projectile?");
if (psProj->psSource && !psProj->psSource->died)
{
@ -449,8 +449,8 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
heightVariance = rand()%8;
break;
case OBJ_BULLET:
ASSERT(!"invalid object type: bullet", "proj_SendProjectile: invalid object type: OBJ_BULLET");
case OBJ_PROJECTILE:
ASSERT(!"invalid object type: bullet", "proj_SendProjectile: invalid object type: OBJ_PROJECTILE");
break;
case OBJ_TARGET:
@ -645,7 +645,7 @@ proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player,
/***************************************************************************/
void
proj_InFlightDirectFunc( PROJ_OBJECT *psObj )
proj_InFlightDirectFunc( PROJECTILE *psObj )
{
WEAPON_STATS *psStats;
SDWORD timeSoFar;
@ -815,7 +815,7 @@ proj_InFlightDirectFunc( PROJ_OBJECT *psObj )
}
//Watermelon;so a projectile wont collide with another projectile unless it's a counter-missile weapon
if ( psTempObj->type == OBJ_BULLET && !( bMissile || ((PROJ_OBJECT *)psTempObj)->psWStats->weaponSubClass == WSC_COUNTER ) )
if ( psTempObj->type == OBJ_PROJECTILE && !( bMissile || ((PROJECTILE *)psTempObj)->psWStats->weaponSubClass == WSC_COUNTER ) )
{
continue;
}
@ -830,7 +830,7 @@ proj_InFlightDirectFunc( PROJ_OBJECT *psObj )
if ( psTempObj->player != psObj->player &&
( psTempObj->type == OBJ_DROID ||
psTempObj->type == OBJ_STRUCTURE ||
psTempObj->type == OBJ_BULLET ||
psTempObj->type == OBJ_PROJECTILE ||
psTempObj->type == OBJ_FEATURE ) &&
!aiCheckAlliances(psTempObj->player,psObj->player) )
{
@ -961,7 +961,7 @@ proj_InFlightDirectFunc( PROJ_OBJECT *psObj )
/***************************************************************************/
void
proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
proj_InFlightIndirectFunc( PROJECTILE *psObj )
{
WEAPON_STATS *psStats;
SDWORD iTime, iRad, iDist, dx, dy, dz, iX, iY;
@ -1080,7 +1080,7 @@ proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
}
//Watermelon;dont collide with any other projectiles
if ( psTempObj->type == OBJ_BULLET )
if ( psTempObj->type == OBJ_PROJECTILE )
{
continue;
}
@ -1095,7 +1095,7 @@ proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
if (psTempObj->player != psObj->player &&
(psTempObj->type == OBJ_DROID ||
psTempObj->type == OBJ_STRUCTURE ||
psTempObj->type == OBJ_BULLET ||
psTempObj->type == OBJ_PROJECTILE ||
psTempObj->type == OBJ_FEATURE) &&
!aiCheckAlliances(psTempObj->player,psObj->player))
{
@ -1225,7 +1225,7 @@ proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
/***************************************************************************/
void
proj_ImpactFunc( PROJ_OBJECT *psObj )
proj_ImpactFunc( PROJECTILE *psObj )
{
WEAPON_STATS *psStats;
SDWORD i, iAudioImpactID;
@ -1708,7 +1708,7 @@ proj_ImpactFunc( PROJ_OBJECT *psObj )
/***************************************************************************/
void
proj_PostImpactFunc( PROJ_OBJECT *psObj )
proj_PostImpactFunc( PROJECTILE *psObj )
{
WEAPON_STATS *psStats;
SDWORD i, age;
@ -1756,7 +1756,7 @@ proj_PostImpactFunc( PROJ_OBJECT *psObj )
/***************************************************************************/
static void
proj_Update( PROJ_OBJECT *psObj )
proj_Update( PROJECTILE *psObj )
{
CHECK_PROJECTILE(psObj);
@ -1777,7 +1777,7 @@ proj_Update( PROJ_OBJECT *psObj )
}
//Watermelon:get naybors
projGetNaybors((PROJ_OBJECT *)psObj);
projGetNaybors((PROJECTILE *)psObj);
switch (psObj->state)
{
@ -1800,22 +1800,22 @@ proj_Update( PROJ_OBJECT *psObj )
void
proj_UpdateAll( void )
{
PROJ_OBJECT *psObj;
PROJECTILE *psObj;
psObj = (PROJ_OBJECT *) hashTable_GetFirst( g_pProjObjTable );
psObj = (PROJECTILE *) hashTable_GetFirst( g_pProjObjTable );
while ( psObj != NULL )
{
proj_Update( psObj );
psObj = (PROJ_OBJECT *) hashTable_GetNext( g_pProjObjTable );
psObj = (PROJECTILE *) hashTable_GetNext( g_pProjObjTable );
}
}
/***************************************************************************/
void
proj_checkBurnDamage( BASE_OBJECT *apsList, PROJ_OBJECT *psProj,
proj_checkBurnDamage( BASE_OBJECT *apsList, PROJECTILE *psProj,
FIRE_BOX *pFireBox )
{
BASE_OBJECT *psCurr, *psNext;
@ -1939,7 +1939,7 @@ SDWORD proj_GetLongRange(WEAPON_STATS *psStats, SDWORD dz)
/***************************************************************************/
//Watemelon:added case for OBJ_BULLET
//Watemelon:added case for OBJ_PROJECTILE
UDWORD establishTargetRadius( BASE_OBJECT *psTarget )
{
UDWORD radius;
@ -1984,7 +1984,7 @@ FEATURE *psFeat;
psFeat = (FEATURE *)psTarget;
radius = (MAX(psFeat->psStats->baseBreadth,psFeat->psStats->baseWidth) * TILE_UNITS) / 2;
break;
case OBJ_BULLET:
case OBJ_PROJECTILE:
//Watermelon 1/2 radius of a droid?
radius = TILE_UNITS/8;
default:
@ -2099,8 +2099,8 @@ SDWORD objectDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD weaponClass,UDWORD
return featureDamage((FEATURE *)psObj, damage, weaponSubClass);
break;
case OBJ_BULLET:
ASSERT(!"invalid object type: bullet", "objectDamage: invalid object type: OBJ_BULLET");
case OBJ_PROJECTILE:
ASSERT(!"invalid object type: bullet", "objectDamage: invalid object type: OBJ_PROJECTILE");
break;
case OBJ_TARGET:
@ -2120,7 +2120,7 @@ SDWORD objectDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD weaponClass,UDWORD
* only the `direct' target of the projectile. Since impact sides also apply for
* any splash damage a projectile might do the exact target is needed.
*/
static DROID_HIT_SIDE getHitSide (PROJ_OBJECT *psObj, DROID *psTarget)
static DROID_HIT_SIDE getHitSide (PROJECTILE *psObj, DROID *psTarget)
{
int deltaX, deltaY;
int impactAngle;
@ -2203,8 +2203,8 @@ STRUCTURE *psStructure;
return TRUE;
break;
case OBJ_BULLET:
ASSERT(!"invalid object type: bullet", "justBeenHitByEW: invalid object type: OBJ_BULLET");
case OBJ_PROJECTILE:
ASSERT(!"invalid object type: bullet", "justBeenHitByEW: invalid object type: OBJ_PROJECTILE");
abort();
break;
@ -2282,7 +2282,7 @@ static void addProjNaybor(BASE_OBJECT *psObj, UDWORD distSqr)
//Watermelon: projGetNaybors ripped from droid.c
/* Find all the objects close to the projectile */
void projGetNaybors(PROJ_OBJECT *psObj)
void projGetNaybors(PROJECTILE *psObj)
{
SDWORD xdiff, ydiff;
UDWORD dx,dy, distSqr;
@ -2408,7 +2408,7 @@ UDWORD establishTargetHeight( BASE_OBJECT *psTarget )
case OBJ_FEATURE:
// Just use imd ymax+ymin
return (psTarget->sDisplay.imd->ymax + psTarget->sDisplay.imd->ymin) /2;
case OBJ_BULLET:
case OBJ_PROJECTILE:
// 16 for bullet
return 16;
default:

View File

@ -57,8 +57,8 @@ BOOL proj_InitSystem( void );
void proj_UpdateAll( void );
BOOL proj_Shutdown( void );
PROJ_OBJECT * proj_GetFirst( void );
PROJ_OBJECT * proj_GetNext( void );
PROJECTILE * proj_GetFirst( void );
PROJECTILE * proj_GetNext( void );
void proj_FreeAllProjectiles( void );
//Watermelon:added another BOOL value bPenetrate added weapon_slot
@ -116,7 +116,7 @@ typedef struct _proj_naybor_info
*/
extern UDWORD calcDamage(UDWORD baseDamage, WEAPON_EFFECT weaponEffect,
BASE_OBJECT *psTarget);
extern BOOL gfxVisible(PROJ_OBJECT *psObj);
extern BOOL gfxVisible(PROJECTILE *psObj);
/***************************************************************************/
@ -124,7 +124,7 @@ extern BOOL justBeenHitByEW ( BASE_OBJECT *psObj );
extern void objectShimmy ( BASE_OBJECT *psObj );
// Watermelon:naybor related functions
extern void projGetNaybors(PROJ_OBJECT *psObj);
extern void projGetNaybors(PROJECTILE *psObj);
//used for passing data to the checkBurnDamage function
typedef struct _fire_box
@ -135,19 +135,19 @@ typedef struct _fire_box
} FIRE_BOX;
/*Apply the damage to an object due to fire range*/
extern void checkBurnDamage(BASE_OBJECT* apsList, PROJ_OBJECT* psBullet, FIRE_BOX* pFireBox);
extern void checkBurnDamage(BASE_OBJECT* apsList, PROJECTILE* psBullet, FIRE_BOX* pFireBox);
static inline void setProjectileDestination(PROJ_OBJECT *psProj, BASE_OBJECT *psObj)
static inline void setProjectileDestination(PROJECTILE *psProj, BASE_OBJECT *psObj)
{
psProj->psDest = psObj;
}
static inline void setProjectileSource(PROJ_OBJECT *psProj, BASE_OBJECT *psObj)
static inline void setProjectileSource(PROJECTILE *psProj, BASE_OBJECT *psObj)
{
psProj->psSource = psObj;
}
static inline void setProjectileDamaged(PROJ_OBJECT *psProj, BASE_OBJECT *psObj)
static inline void setProjectileDamaged(PROJECTILE *psProj, BASE_OBJECT *psObj)
{
psProj->psDamaged = psObj;
}
@ -156,7 +156,7 @@ static inline void setProjectileDamaged(PROJ_OBJECT *psProj, BASE_OBJECT *psObj)
#define CHECK_PROJECTILE(object) \
do { \
assert(object != NULL); \
assert(object->type == OBJ_BULLET); \
assert(object->type == OBJ_PROJECTILE); \
assert(object->player < MAX_PLAYERS); \
assert(object->state == PROJ_INFLIGHT || object->state == PROJ_IMPACT \
|| object->state == PROJ_POSTIMPACT); \