MIsc bug fixes.
This commit is contained in:
parent
ed8bc92ce1
commit
8a61323362
|
@ -160,7 +160,7 @@ static void selectWeapon(void)
|
|||
|
||||
b = (Boss*)self;
|
||||
|
||||
if (world.bob->isOnGround || abs(self->y - world.bob->y) > 64)
|
||||
if (world.bob->isOnGround || fabs(self->y - world.bob->y) > 64)
|
||||
{
|
||||
b->weaponType = WPN_AIMED_PISTOL;
|
||||
b->shotsToFire = rrnd(1, 12);
|
||||
|
|
|
@ -178,7 +178,7 @@ static void selectWeapon(void)
|
|||
|
||||
b = (Boss*)self;
|
||||
|
||||
if (abs(b->y - world.bob->y) > 64)
|
||||
if (fabs(b->y - world.bob->y) > 64)
|
||||
{
|
||||
b->weaponType = WPN_AIMED_PISTOL;
|
||||
b->shotsToFire = rrnd(4, 12);
|
||||
|
|
|
@ -230,5 +230,5 @@ static void getCollisionBounds(SDL_Rect *r)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE;
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ static void returnToStart(void)
|
|||
u->dy = u->startY < u->y ? -1 : -1;
|
||||
}
|
||||
|
||||
if (abs(u->startX - u->x) <= MAP_TILE_SIZE)
|
||||
if (fabs(u->startX - u->x) <= MAP_TILE_SIZE)
|
||||
{
|
||||
u->returnToStartTimer = 0;
|
||||
}
|
||||
|
|
|
@ -72,5 +72,5 @@ static void preFire(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -45,5 +45,5 @@ Entity *initLaserBlob(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -45,5 +45,5 @@ Entity *initMachineGunBlob(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -45,5 +45,5 @@ Entity *initPlasmaBlob(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -45,5 +45,5 @@ Entity *initSpreadGunBlob(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 5;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 5;
|
||||
}
|
||||
|
|
|
@ -72,5 +72,5 @@ static void preFire(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -45,5 +45,5 @@ Entity *initLaserDroid(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -45,5 +45,5 @@ Entity *initMachineGunDroid(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -45,5 +45,5 @@ Entity *initPlasmaDroid(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 2;
|
||||
}
|
||||
|
|
|
@ -45,5 +45,5 @@ Entity *initSpreadGunDroid(void)
|
|||
|
||||
static int canFire(Entity *target)
|
||||
{
|
||||
return abs(target->y - self->y) <= MAP_TILE_SIZE * 5;
|
||||
return fabs(target->y - self->y) <= MAP_TILE_SIZE * 5;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
static void init(void);
|
||||
static void tick(void);
|
||||
static void activate(int active);
|
||||
static void touch(Entity *other);
|
||||
static void load(cJSON *root);
|
||||
static void save(cJSON *root);
|
||||
|
@ -42,6 +43,7 @@ Entity *initCardReader(void)
|
|||
|
||||
s->tick = tick;
|
||||
s->init = init;
|
||||
s->activate = activate;
|
||||
s->touch = touch;
|
||||
s->load = load;
|
||||
s->save = save;
|
||||
|
@ -110,6 +112,18 @@ static void touch(Entity *other)
|
|||
}
|
||||
}
|
||||
|
||||
static void activate(int active)
|
||||
{
|
||||
Structure *s;
|
||||
|
||||
s = (Structure*)self;
|
||||
|
||||
s->active = 1;
|
||||
s->sprite[FACING_LEFT] = s->sprite[FACING_RIGHT] = s->sprite[FACING_DIE] = getSprite("CardReader");
|
||||
s->spriteTime = 0;
|
||||
s->spriteFrame = 0;
|
||||
}
|
||||
|
||||
static void load(cJSON *root)
|
||||
{
|
||||
Structure *s;
|
||||
|
|
|
@ -138,7 +138,7 @@ static void tick(void)
|
|||
s->dx *= s->speed;
|
||||
s->dy *= s->speed;
|
||||
|
||||
if (abs(s->x - s->tx) < s->speed && abs(s->y - s->ty) < s->speed)
|
||||
if (fabs(s->x - s->tx) < s->speed && fabs(s->y - s->ty) < s->speed)
|
||||
{
|
||||
s->x = s->tx;
|
||||
s->y = s->ty;
|
||||
|
@ -153,7 +153,7 @@ static void tick(void)
|
|||
s->dx *= s->speed;
|
||||
s->dy *= s->speed;
|
||||
|
||||
if (abs(s->x - s->closedX) < s->speed && abs(self->y - s->closedY) < s->speed)
|
||||
if (fabs(s->x - s->closedX) < s->speed && fabs(self->y - s->closedY) < s->speed)
|
||||
{
|
||||
s->x = s->closedX;
|
||||
s->y = s->closedY;
|
||||
|
|
|
@ -87,7 +87,7 @@ static void action(void)
|
|||
s->dx *= s->speed;
|
||||
s->dy *= s->speed;
|
||||
|
||||
if (abs(s->x - s->startX) < s->speed && abs(s->y - s->startY) < s->speed)
|
||||
if (fabs(s->x - s->startX) < s->speed && fabs(s->y - s->startY) < s->speed)
|
||||
{
|
||||
s->x = s->startX;
|
||||
s->y = s->startY;
|
||||
|
@ -103,7 +103,7 @@ static void action(void)
|
|||
s->dx *= s->speed;
|
||||
s->dy *= s->speed;
|
||||
|
||||
if (abs(s->x - s->tx) < s->speed && abs(s->y - s->ty) < s->speed)
|
||||
if (fabs(s->x - s->tx) < s->speed && fabs(s->y - s->ty) < s->speed)
|
||||
{
|
||||
s->x = s->tx;
|
||||
s->y = s->ty;
|
||||
|
|
|
@ -26,7 +26,7 @@ void initInput(void)
|
|||
|
||||
static void doKeyDown(SDL_KeyboardEvent *event)
|
||||
{
|
||||
if (event->keysym.scancode >= 0 && event->keysym.scancode < MAX_KEYBOARD_KEYS && event->repeat == 0)
|
||||
if (event->keysym.scancode < MAX_KEYBOARD_KEYS && event->repeat == 0)
|
||||
{
|
||||
app.keyboard[event->keysym.scancode] = 1;
|
||||
|
||||
|
@ -36,7 +36,7 @@ static void doKeyDown(SDL_KeyboardEvent *event)
|
|||
|
||||
static void doKeyUp(SDL_KeyboardEvent *event)
|
||||
{
|
||||
if (event->keysym.scancode >= 0 && event->keysym.scancode < MAX_KEYBOARD_KEYS)
|
||||
if (event->keysym.scancode < MAX_KEYBOARD_KEYS)
|
||||
{
|
||||
app.keyboard[event->keysym.scancode] = 0;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ float cameraChase(Entity *e, int maxSpeed)
|
|||
tx = e->x - (SCREEN_WIDTH / 2);
|
||||
ty = e->y - (SCREEN_HEIGHT / 2);
|
||||
|
||||
diffX = abs(tx - x);
|
||||
diffY = abs(ty - y);
|
||||
diffX = fabs(tx - x);
|
||||
diffY = fabs(ty - y);
|
||||
|
||||
dist = MAX(diffX, diffY);
|
||||
|
||||
|
|
|
@ -961,8 +961,8 @@ static void handleTeleport(void)
|
|||
{
|
||||
float diffX, diffY;
|
||||
|
||||
diffX = abs(self->x - self->tx) / 20;
|
||||
diffY = abs(self->y - self->ty) / 20;
|
||||
diffX = fabs(self->x - self->tx) / 20;
|
||||
diffY = fabs(self->y - self->ty) / 20;
|
||||
|
||||
addTeleportStar(self->x + rand() % self->w, self->y + rand() % self->h);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ void doLocationTriggers(void)
|
|||
{
|
||||
activateEntities(t->targetNames, 1);
|
||||
|
||||
if (t->message != NULL)
|
||||
if (strlen(t->message) > 0)
|
||||
{
|
||||
setGameplayMessage(MSG_GAMEPLAY, t->message);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void fireTriggers(char *name)
|
|||
{
|
||||
activateEntities(t->targetNames, 1);
|
||||
|
||||
if (t->message != NULL)
|
||||
if (strlen(t->message) > 0)
|
||||
{
|
||||
setGameplayMessage(MSG_GAMEPLAY, t->message);
|
||||
}
|
||||
|
|
|
@ -572,9 +572,6 @@ static void doGameOver(void)
|
|||
{
|
||||
loadMusic("music/Sadness.ogg");
|
||||
playMusic(0);
|
||||
}
|
||||
else if (world.gameOverTimer == -FPS * 3)
|
||||
{
|
||||
showWidgetGroup("gameOver");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue