Use saveDelay, to prevent premature saving while manually quitting levels.
This commit is contained in:
parent
6b2139b6ce
commit
74383264c2
|
@ -84,8 +84,7 @@ static void tick(void)
|
|||
|
||||
m = (MIA*)self;
|
||||
|
||||
m->shudderTimer--;
|
||||
if (m->shudderTimer <= 0)
|
||||
if (--m->shudderTimer <= 0)
|
||||
{
|
||||
m->x = (m->tx + rand() % 4);
|
||||
m->shudderTimer = 2;
|
||||
|
@ -93,12 +92,13 @@ static void tick(void)
|
|||
|
||||
if (!m->isMissionTarget)
|
||||
{
|
||||
m->starTimer--;
|
||||
if (m->starTimer <= 0)
|
||||
if (--m->starTimer <= 0)
|
||||
{
|
||||
addMIATeleportStars(m->x + rand() % m->w, m->y + rand() % m->h);
|
||||
m->starTimer = 1;
|
||||
}
|
||||
|
||||
world.saveDelay = FPS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,8 @@ static void preTeleport(void)
|
|||
m->flags |= (EF_NO_CLIP | EF_WEIGHTLESS);
|
||||
m->dy = -5;
|
||||
}
|
||||
|
||||
world.saveDelay = FPS;
|
||||
}
|
||||
|
||||
static void teleport(void)
|
||||
|
@ -147,6 +149,8 @@ static void teleport(void)
|
|||
updateObjective("MIA");
|
||||
m->alive = ALIVE_DEAD;
|
||||
}
|
||||
|
||||
world.saveDelay = FPS;
|
||||
}
|
||||
|
||||
static void load(cJSON *root)
|
||||
|
|
|
@ -467,6 +467,7 @@ typedef struct {
|
|||
int helperItemTimer;
|
||||
int spawnInterval;
|
||||
int numToSpawn;
|
||||
int saveDelay;
|
||||
Bob *bob;
|
||||
Boss *boss;
|
||||
Entity *entityToTrack;
|
||||
|
|
|
@ -138,6 +138,7 @@ void doEntities(void)
|
|||
|
||||
if (self->flags & EF_TELEPORTING)
|
||||
{
|
||||
world.saveDelay = FPS;
|
||||
handleTeleport();
|
||||
prev = self;
|
||||
continue;
|
||||
|
@ -235,6 +236,11 @@ void doEntities(void)
|
|||
self->die();
|
||||
}
|
||||
}
|
||||
|
||||
if (self->alive == ALIVE_DYING)
|
||||
{
|
||||
world.saveDelay = FPS;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(self->flags & (EF_TELEPORTING | EF_GONE)))
|
||||
|
|
|
@ -139,6 +139,12 @@ void initWorld(void)
|
|||
app.restrictTrophyAlert = 1;
|
||||
|
||||
endSectionTransition();
|
||||
|
||||
/*
|
||||
startMission();
|
||||
world.bob->x = 17 * MAP_TILE_SIZE;
|
||||
world.bob->y = 89 * MAP_TILE_SIZE;
|
||||
*/
|
||||
}
|
||||
|
||||
static void logic(void)
|
||||
|
@ -147,6 +153,8 @@ static void logic(void)
|
|||
{
|
||||
world.betweenTimer = 0;
|
||||
|
||||
world.saveDelay = limit(world.saveDelay - 1, 0, FPS);
|
||||
|
||||
switch (world.state)
|
||||
{
|
||||
case WS_START:
|
||||
|
@ -166,6 +174,7 @@ static void logic(void)
|
|||
break;
|
||||
|
||||
case WS_COMPLETE:
|
||||
case WS_QUIT:
|
||||
doWorldComplete();
|
||||
break;
|
||||
|
||||
|
@ -516,13 +525,14 @@ static void doWorldComplete(void)
|
|||
{
|
||||
world.missionCompleteTimer--;
|
||||
|
||||
if (world.missionCompleteTimer == 0)
|
||||
if (world.missionCompleteTimer <= 0 && world.saveDelay <= 0)
|
||||
{
|
||||
dropCarriedItems();
|
||||
|
||||
initPostMission();
|
||||
}
|
||||
else if (world.missionCompleteTimer == FPS * 1.5)
|
||||
{
|
||||
dropCarriedItems();
|
||||
world.bob->flags |= EF_GONE;
|
||||
addTeleportStars((Entity*)world.bob);
|
||||
playSound(SND_TELEPORT, world.bob->uniqueId % MAX_SND_CHANNELS);
|
||||
|
@ -878,7 +888,7 @@ void quitMission(void)
|
|||
{
|
||||
resume();
|
||||
stopMusic();
|
||||
world.state = WS_COMPLETE;
|
||||
world.state = WS_QUIT;
|
||||
world.missionCompleteTimer = (FPS * 1.5) + 1;
|
||||
|
||||
if (world.missionType == MT_TRAINING)
|
||||
|
@ -926,6 +936,8 @@ void autoCompleteMission(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
world.state = WS_COMPLETE;
|
||||
}
|
||||
|
||||
void destroyWorld(void)
|
||||
|
|
|
@ -116,6 +116,7 @@ extern int rrnd(int low, int high);
|
|||
extern void showWidgetGroup(char *group);
|
||||
extern void startSectionTransition(void);
|
||||
extern void stopMusic(void);
|
||||
extern float limit(float i, float a, float b);
|
||||
|
||||
extern App app;
|
||||
extern Camera camera;
|
||||
|
|
Loading…
Reference in New Issue