Destroy stuff at end of mission.
This commit is contained in:
parent
94db89cc08
commit
357fbdc8a4
|
@ -182,3 +182,17 @@ static int isMissingHeartCell(char *targetName)
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void destroyObjectives(void)
|
||||
{
|
||||
Objective *o;
|
||||
|
||||
while (world.objectiveHead.next)
|
||||
{
|
||||
o = world.objectiveHead.next;
|
||||
|
||||
world.objectiveHead.next = o->next;
|
||||
|
||||
free(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -295,3 +295,17 @@ static Particle *createParticle(void)
|
|||
|
||||
return p;
|
||||
}
|
||||
|
||||
void destroyParticles(void)
|
||||
{
|
||||
Particle *p;
|
||||
|
||||
while (world.particleHead.next)
|
||||
{
|
||||
p = world.particleHead.next;
|
||||
|
||||
world.particleHead.next = p->next;
|
||||
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,3 +84,17 @@ void fireTriggers(char *name)
|
|||
prev = t;
|
||||
}
|
||||
}
|
||||
|
||||
void destroyTriggers(void)
|
||||
{
|
||||
Trigger *t;
|
||||
|
||||
while (world.triggerHead.next)
|
||||
{
|
||||
t = world.triggerHead.next;
|
||||
|
||||
world.triggerHead.next = t->next;
|
||||
|
||||
free(t);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ static void options(void);
|
|||
static void stats(void);
|
||||
static void trophies(void);
|
||||
static void quit(void);
|
||||
static void destroyWorld(void);
|
||||
|
||||
static Texture *background;
|
||||
static int observationIndex;
|
||||
|
@ -49,7 +50,7 @@ static int showingWidgets;
|
|||
|
||||
void initWorld(void)
|
||||
{
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
loadWorld(game.worldId);
|
||||
|
||||
background = getTexture(world.background);
|
||||
|
||||
|
@ -69,6 +70,10 @@ void initWorld(void)
|
|||
|
||||
initItems();
|
||||
|
||||
initMap();
|
||||
|
||||
initEntities();
|
||||
|
||||
world.enemySpawnTimer = (FPS * rrnd(world.minEnemySpawnTime, world.maxEnemySpawnTime));
|
||||
|
||||
world.state = WS_START;
|
||||
|
@ -101,8 +106,6 @@ void initWorld(void)
|
|||
|
||||
app.delegate.logic = logic;
|
||||
app.delegate.draw = draw;
|
||||
|
||||
startMission();
|
||||
}
|
||||
|
||||
static void logic(void)
|
||||
|
@ -398,6 +401,10 @@ static void doWorldComplete(void)
|
|||
addTeleportStars((Entity*)world.bob);
|
||||
playSound(SND_TELEPORT, CH_BOB);
|
||||
}
|
||||
else if (world.missionCompleteTimer == 0)
|
||||
{
|
||||
destroyWorld();
|
||||
}
|
||||
else
|
||||
{
|
||||
doBob();
|
||||
|
@ -669,3 +676,25 @@ static void trophies(void)
|
|||
static void quit(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void destroyWorld(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < world.numEnemyTypes ; i++)
|
||||
{
|
||||
free(world.enemyTypes[i]);
|
||||
}
|
||||
|
||||
free(world.enemyTypes);
|
||||
|
||||
destroyTriggers();
|
||||
|
||||
destroyObjectives();
|
||||
|
||||
destroyEntities();
|
||||
|
||||
destroyParticles();
|
||||
|
||||
destroyQuadtree();
|
||||
}
|
||||
|
|
|
@ -76,9 +76,16 @@ extern void drawWidgets(void);
|
|||
extern void showWidgetGroup(char *group);
|
||||
extern void drawRect(int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
extern void drawOutlineRect(int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
extern void hideAllWidgets(void);
|
||||
extern void doWidgets(void);
|
||||
extern Widget *getWidget(char *name, char *group);
|
||||
extern void destroyTriggers(void);
|
||||
extern void destroyObjectives(void);
|
||||
extern void destroyEntities(void);
|
||||
extern void destroyParticles(void);
|
||||
extern void destroyQuadtree(void);
|
||||
extern void loadWorld(char *id);
|
||||
extern void initMap(void);
|
||||
extern void initEntities(void);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
|
Loading…
Reference in New Issue