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
|
@ -369,7 +369,7 @@ static void wzpng_write_data(png_structp png_ptr, png_bytep data, png_size_t len
|
|||
static void wzpng_flush_data(png_structp png_ptr)
|
||||
{
|
||||
PHYSFS_file* fileHandle = (PHYSFS_file*)png_get_io_ptr(png_ptr);
|
||||
|
||||
|
||||
PHYSFS_flush(fileHandle);
|
||||
}
|
||||
|
||||
|
@ -424,15 +424,15 @@ static inline void screen_DumpPNG(PHYSFS_file* fileHandle, const unsigned char*
|
|||
// Z_NO_COMPRESSION:
|
||||
// black (except for GUI): 398 msec
|
||||
// 381, 391, 404, 360 msec
|
||||
//
|
||||
//
|
||||
// Z_BEST_SPEED:
|
||||
// black (except for GUI): 325 msec
|
||||
// 611, 406, 461, 608 msec
|
||||
//
|
||||
//
|
||||
// Z_DEFAULT_COMPRESSION:
|
||||
// black (except for GUI): 374 msec
|
||||
// 1154, 1121, 627, 790 msec
|
||||
//
|
||||
//
|
||||
// Z_BEST_COMPRESSION:
|
||||
// black (except for GUI): 439 msec
|
||||
// 1600, 1078, 1613, 1700 msec
|
||||
|
@ -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