Fixed a potential compatibility problem.
The plain int type is only guaranteed to be at least 16 bits, and yet the flags variable was expecting at least 22 bits. This turns out to be true for x86 and x86-64 systems, but to ensure compatibility, the variable has been changed to an unsigned long int. Also added the "L" suffix to flags that were more than 16 bits.
This commit is contained in:
parent
08260b1d6c
commit
e0809c02b0
|
@ -146,7 +146,7 @@ one attempt per call (one call per frame) to find a suitable target. If the targ
|
||||||
it picks is dead or outside the screen range, then it returns NULL. A suitable
|
it picks is dead or outside the screen range, then it returns NULL. A suitable
|
||||||
target will be returned as the object address.
|
target will be returned as the object address.
|
||||||
*/
|
*/
|
||||||
static object *getRandomEnemy(object *bullet)
|
static object *bullet_getTarget(object *bullet)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ void doBullets()
|
||||||
if (bullet->flags & WF_HOMING)
|
if (bullet->flags & WF_HOMING)
|
||||||
{
|
{
|
||||||
if (bullet->target == NULL)
|
if (bullet->target == NULL)
|
||||||
bullet->target = getRandomEnemy(bullet);
|
bullet->target = bullet_getTarget(bullet);
|
||||||
|
|
||||||
if (bullet->owner->flags & FL_FRIEND)
|
if (bullet->owner->flags & FL_FRIEND)
|
||||||
homingMissileSpeed = 0.25;
|
homingMissileSpeed = 0.25;
|
||||||
|
|
16
src/defs.h
16
src/defs.h
|
@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Compile-time options
|
// Compile-time options
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
#define VERSION "devbuild"
|
#define VERSION "???"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DATADIR
|
#ifndef DATADIR
|
||||||
|
@ -64,13 +64,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define FL_RUNSAWAY 8192
|
#define FL_RUNSAWAY 8192
|
||||||
#define FL_ALWAYSFACE 16384 // Kline doesn't turn his back on you! ;)
|
#define FL_ALWAYSFACE 16384 // Kline doesn't turn his back on you! ;)
|
||||||
#define FL_CIRCLES 32768 // Kline can circle around
|
#define FL_CIRCLES 32768 // Kline can circle around
|
||||||
#define FL_CONTINUOUS_FIRE 65536 // Go absolutely nutts(!)
|
#define FL_CONTINUOUS_FIRE 65536L // Go absolutely nutts(!)
|
||||||
#define FL_DEPLOYDRONES 131072 // Deploys small drone - Used by Boss 2
|
#define FL_DEPLOYDRONES 131072L // Deploys small drone - Used by Boss 2
|
||||||
#define FL_CANCLOAK 262144
|
#define FL_CANCLOAK 262144L
|
||||||
#define FL_ISCLOAKED 524288
|
#define FL_ISCLOAKED 524288L
|
||||||
#define FL_ACTIVATE 1048576
|
#define FL_ACTIVATE 1048576L
|
||||||
#define FL_HASMINIMUMSPEED 2097152
|
#define FL_HASMINIMUMSPEED 2097152L
|
||||||
#define FL_FIRELASER 4194304
|
#define FL_FIRELASER 4194304L
|
||||||
|
|
||||||
// Explosions
|
// Explosions
|
||||||
#define E_SMALL_EXPLOSION 4
|
#define E_SMALL_EXPLOSION 4
|
||||||
|
|
|
@ -173,7 +173,7 @@ void blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
|
||||||
showErrorAndExit(2, "");
|
showErrorAndExit(2, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only ff it is to the screen, mark the region as damaged
|
// Only if it is to the screen, mark the region as damaged
|
||||||
if (dest == screen)
|
if (dest == screen)
|
||||||
addBuffer(blitRect.x, blitRect.y, blitRect.w, blitRect.h);
|
addBuffer(blitRect.x, blitRect.y, blitRect.w, blitRect.h);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,9 @@ void loadGameGraphics()
|
||||||
switch (shipShape[i]->format->BitsPerPixel)
|
switch (shipShape[i]->format->BitsPerPixel)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
|
SDL_LockSurface(shipShape[i]);
|
||||||
p32 = (Uint32 *)shipShape[i]->pixels;
|
p32 = (Uint32 *)shipShape[i]->pixels;
|
||||||
|
SDL_UnlockSurface(shipShape[i]);
|
||||||
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
||||||
{
|
{
|
||||||
if (p32[j])
|
if (p32[j])
|
||||||
|
@ -95,7 +97,9 @@ void loadGameGraphics()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
|
SDL_LockSurface(shipShape[i]);
|
||||||
p16 = (Uint16 *)shipShape[i]->pixels;
|
p16 = (Uint16 *)shipShape[i]->pixels;
|
||||||
|
SDL_UnlockSurface(shipShape[i]);
|
||||||
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
||||||
{
|
{
|
||||||
if (p16[j])
|
if (p16[j])
|
||||||
|
@ -104,7 +108,9 @@ void loadGameGraphics()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
|
SDL_LockSurface(shipShape[i]);
|
||||||
p8 = (Uint8 *)shipShape[i]->pixels;
|
p8 = (Uint8 *)shipShape[i]->pixels;
|
||||||
|
SDL_UnlockSurface(shipShape[i]);
|
||||||
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
||||||
{
|
{
|
||||||
if (p8[j])
|
if (p8[j])
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct object {
|
||||||
int collectType; // What the object is carrying
|
int collectType; // What the object is carrying
|
||||||
int collectValue; // What it is worth
|
int collectValue; // What it is worth
|
||||||
|
|
||||||
int flags; // Various flags for an object
|
unsigned long int flags; // Various flags for an object
|
||||||
|
|
||||||
float x, y, dx, dy;
|
float x, y, dx, dy;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue