Fix bad clipping of projectile coordinates. Was slipping through negative

coordinates.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4292 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-03-24 12:31:38 +00:00
parent 95bd262c7a
commit 284b157ba0
2 changed files with 8 additions and 10 deletions

View File

@ -327,9 +327,8 @@ static void proj_UpdateKills(PROJECTILE *psObj, float experienceInc)
/***************************************************************************/
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 )
BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, int tarX, int tarY, int tarZ,
BASE_OBJECT *psTarget, BOOL bVisible, BOOL bPenetrate, int weapon_slot)
{
PROJECTILE *psObj = malloc(sizeof(PROJECTILE));
SDWORD tarHeight, srcHeight, iMinSq;
@ -872,10 +871,10 @@ proj_InFlightDirectFunc( PROJECTILE *psObj )
// Determine position to fire a missile at
// (must be at least 0 because we don't use signed integers
// this shouldn't be larger than the height and width of the map either)
TargetX = MAX(psObj->startX + extendRad * dx / rad, 0);
TargetX = MIN(TargetX, world_coord(mapWidth - 1));
TargetY = MAX(psObj->startY + extendRad * dy / rad, 0);
TargetY = MIN(TargetY, world_coord(mapHeight - 1));
TargetX = psObj->startX + extendRad * dx / rad;
TargetY = psObj->startY + extendRad * dy / rad;
CLIP(TargetX, 0, world_coord(mapWidth - 1));
CLIP(TargetY, 0, world_coord(mapHeight - 1));
proj_SendProjectile( &asWeap, (BASE_OBJECT*)psObj, psObj->player, TargetX, TargetY, psObj->pos.z, NULL, TRUE, bPenetrate, -1 );
}
else

View File

@ -59,9 +59,8 @@ PROJECTILE * proj_GetFirst( void );
PROJECTILE * proj_GetNext( void );
void proj_FreeAllProjectiles( void );
//Watermelon:added another BOOL value bPenetrate added weapon_slot
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 );
BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, int tarX, int tarY, int tarZ,
BASE_OBJECT *psTarget, BOOL bVisible, BOOL bPenetrate, int weapon_slot);
// return whether a weapon is direct or indirect
bool proj_Direct(const WEAPON_STATS* psStats);