Checkpoint bug fix.
This commit is contained in:
parent
dbcd2debc3
commit
28d3c70183
|
@ -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,14 +235,14 @@ 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--)
|
||||
{
|
||||
world.bob->checkpoints[i].x = world.bob->checkpoints[i - 1].x;
|
||||
world.bob->checkpoints[i].y = world.bob->checkpoints[i - 1].y;
|
||||
}
|
||||
|
||||
|
||||
world.bob->checkpoints[0].x = world.bob->x;
|
||||
world.bob->checkpoints[0].y = world.bob->y;
|
||||
checkpointTimer = FPS;
|
||||
|
|
|
@ -142,28 +142,28 @@ static void tick(void)
|
|||
|
||||
static void reappear(void)
|
||||
{
|
||||
int valid, r;
|
||||
int r;
|
||||
|
||||
valid = 0;
|
||||
r = rand() % MAX_CHECKPOINTS;
|
||||
self->x = world.bob->checkpoints[r].x;
|
||||
self->y = world.bob->checkpoints[r].y;
|
||||
|
||||
do
|
||||
if (self->x != 0 && self->y != 0)
|
||||
{
|
||||
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);
|
||||
self->y -= (self->h + 10);
|
||||
|
||||
self->action = self->walk;
|
||||
|
||||
self->flags &= ~EF_GONE;
|
||||
|
||||
addTeleportStars(self);
|
||||
|
||||
playSound(SND_APPEAR, CH_ANY);
|
||||
}
|
||||
else
|
||||
{
|
||||
self->thinkTime = FPS;
|
||||
}
|
||||
while (!valid);
|
||||
|
||||
self->y -= (self->h + 10);
|
||||
|
||||
self->action = self->walk;
|
||||
|
||||
self->flags &= ~EF_GONE;
|
||||
|
||||
addTeleportStars(self);
|
||||
|
||||
playSound(SND_APPEAR, CH_ANY);
|
||||
}
|
||||
|
||||
static void applyDamage(int damage)
|
||||
|
|
Loading…
Reference in New Issue