Initially add all entities to quadtree, to avoid the popping effect.
This commit is contained in:
parent
99013a4e99
commit
22b5267ffd
|
@ -556,6 +556,16 @@ void countNumEnemies(void)
|
|||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "battle.numInitialEnemies=%d", battle.numInitialEnemies);
|
||||
}
|
||||
|
||||
void addAllEntsToQuadtree(void)
|
||||
{
|
||||
Entity *e;
|
||||
|
||||
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
|
||||
{
|
||||
addToQuadtree(e, &battle.quadtree);
|
||||
}
|
||||
}
|
||||
|
||||
static int drawComparator(const void *a, const void *b)
|
||||
{
|
||||
Entity *e1 = *((Entity**)a);
|
||||
|
|
|
@ -224,6 +224,8 @@ void loadMission(char *filename)
|
|||
|
||||
initMissionInfo();
|
||||
|
||||
addAllEntsToQuadtree();
|
||||
|
||||
playMusic(music);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ extern char *getPlanetTextureName(int n);
|
|||
extern char *getMusicFilename(int n);
|
||||
extern int getJSONValue(cJSON *node, char *name, int defValue);
|
||||
extern char *getJSONValueStr(cJSON *node, char *name, char *defValue);
|
||||
extern void addAllEntsToQuadtree(void);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
|
|
Loading…
Reference in New Issue