Checkpoint bug fix.

This commit is contained in:
Steve 2018-02-19 19:14:32 +00:00
parent dbcd2debc3
commit 28d3c70183
2 changed files with 23 additions and 21 deletions

View File

@ -96,6 +96,8 @@ Entity *initBob(void)
b->load = load;
b->save = save;
checkpointTimer = 0;
return (Entity*)b;
}
@ -153,7 +155,7 @@ static void doAlive(void)
{
handeImmunity();
world.bob->checkpointTimer = MAX(world.bob->checkpointTimer - 1, 0);
checkpointTimer = MAX(checkpointTimer - 1, 0);
world.bob->reload = limit(world.bob->reload - 1, 0, FPS);
@ -233,7 +235,7 @@ static void handeImmunity(void)
world.bob->flags &= ~(EF_FLICKER | EF_IMMUNE);
}
}
else if (world.bob->checkpointTimer == 0 && world.bob->isOnGround && completelyOnGround() && world.bob->environment == ENV_AIR && world.bob->riding == NULL)
else if (checkpointTimer == 0 && world.bob->isOnGround && completelyOnGround() && world.bob->environment == ENV_AIR && world.bob->riding == NULL)
{
for (i = MAX_CHECKPOINTS - 1 ; i > 0 ; i--)
{

View File

@ -142,19 +142,14 @@ static void tick(void)
static void reappear(void)
{
int valid, r;
int r;
valid = 0;
do
{
r = rand() % MAX_CHECKPOINTS;
self->x = world.bob->checkpoints[r].x;
self->y = world.bob->checkpoints[r].y;
valid = (self->x != 0 && self->y != 0);
}
while (!valid);
if (self->x != 0 && self->y != 0)
{
self->y -= (self->h + 10);
self->action = self->walk;
@ -164,6 +159,11 @@ static void reappear(void)
addTeleportStars(self);
playSound(SND_APPEAR, CH_ANY);
}
else
{
self->thinkTime = FPS;
}
}
static void applyDamage(int damage)