Watermelon: projfix11a:
1. Fixed a bug (I made some parenthesis order mistakes, near predictX and predictY, which might corrupt predictX, predictY) 2. Fixed a value corruption when predictX or predictY becomes negative, since proj_SendProjectile only expects UDWORD (now set them to 0 when they become negative, so the turret wont try to fire projectiles to some off-map coords) 3. Fixed zero height building bug (invincible rearm pads) when an imd's ymin is equal to ymax... lib/ivis_opengl/screen.c: \param channels git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1524 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
486ac3ed11
commit
5c79953e18
|
@ -463,7 +463,7 @@ static inline void screen_DumpPNG(PHYSFS_file* fileHandle, const unsigned char*
|
|||
/** Retrieves the currently displayed screen and throws it in a buffer
|
||||
* \param width the screen's width
|
||||
* \param height the screen's height
|
||||
* \param the number of channels per pixel (since we're using RGB, 3 is a sane default)
|
||||
* \param channels the number of channels per pixel (since we're using RGB, 3 is a sane default)
|
||||
* \return a pointer to a buffer holding all pixels of the image
|
||||
*/
|
||||
static const unsigned char* screen_DumpInBuffer(unsigned int width, unsigned int height, unsigned int channels)
|
||||
|
|
26
src/combat.c
26
src/combat.c
|
@ -394,10 +394,19 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
//Watermelon:Target prediction
|
||||
if(psTarget->type == OBJ_DROID)
|
||||
{
|
||||
predictX = (sinf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.dir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
|
||||
predictX = (SDWORD)(trigSin(((DROID *)psTarget)->sMove.dir) * ((DROID *)psTarget)->sMove.speed * dist /psStats->flightSpeed);
|
||||
predictX += psTarget->x;
|
||||
predictY = (cosf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.dir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
|
||||
predictY = (SDWORD)(trigCos(((DROID *)psTarget)->sMove.dir) * ((DROID *)psTarget)->sMove.speed * dist /psStats->flightSpeed);
|
||||
predictY += psTarget->y;
|
||||
//to prevent negative number from corrupting UDWORD parameter tarX,tarY in proj_SendProjectile
|
||||
if (predictX < 0)
|
||||
{
|
||||
predictX = 0;
|
||||
}
|
||||
if (predictY < 0)
|
||||
{
|
||||
predictY = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -445,10 +454,19 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
//Watermelon:Target prediction
|
||||
if(psTarget->type == OBJ_DROID)
|
||||
{
|
||||
predictX = (sinf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.dir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
|
||||
predictX = (SDWORD)(trigSin(((DROID *)psTarget)->sMove.dir) * ((DROID *)psTarget)->sMove.speed * dist /psStats->flightSpeed);
|
||||
predictX += psTarget->x;
|
||||
predictY = (cosf(((float)M_PI / 180) * (((DROID *)psTarget)->sMove.dir)) * ((DROID *)psTarget)->sMove.speed * dist) / psStats->flightSpeed;
|
||||
predictY = (SDWORD)(trigCos(((DROID *)psTarget)->sMove.dir) * ((DROID *)psTarget)->sMove.speed * dist /psStats->flightSpeed);
|
||||
predictY += psTarget->y;
|
||||
//to prevent negative number from corrupting UDWORD parameter tarX,tarY in proj_SendProjectile
|
||||
if (predictX < 0)
|
||||
{
|
||||
predictX = 0;
|
||||
}
|
||||
if (predictY < 0)
|
||||
{
|
||||
predictY = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2423,17 +2423,17 @@ UDWORD establishTargetHeight( BASE_OBJECT *psTarget )
|
|||
break;
|
||||
}
|
||||
|
||||
utilityHeight = yMax - yMin;
|
||||
utilityHeight = (yMax + yMin)/2;
|
||||
height += utilityHeight;
|
||||
|
||||
return height;
|
||||
|
||||
case OBJ_STRUCTURE:
|
||||
psStructureStats = ((STRUCTURE *)psTarget)->pStructureType;
|
||||
return (psStructureStats->pIMD->ymax - psStructureStats->pIMD->ymin);
|
||||
return (psStructureStats->pIMD->ymax + psStructureStats->pIMD->ymin) /2;
|
||||
case OBJ_FEATURE:
|
||||
// Just use imd ymax+ymin
|
||||
return (psTarget->sDisplay.imd->ymax - psTarget->sDisplay.imd->ymin);
|
||||
return (psTarget->sDisplay.imd->ymax + psTarget->sDisplay.imd->ymin) /2;
|
||||
case OBJ_BULLET:
|
||||
// 16 for bullet
|
||||
return 16;
|
||||
|
|
Loading…
Reference in New Issue