Initially add all entities to quadtree, to avoid the popping effect.

This commit is contained in:
Steve 2016-03-08 07:12:06 +00:00
parent 99013a4e99
commit 22b5267ffd
3 changed files with 13 additions and 0 deletions

View File

@ -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);

View File

@ -223,6 +223,8 @@ void loadMission(char *filename)
initPlayer();
initMissionInfo();
addAllEntsToQuadtree();
playMusic(music);
}

View File

@ -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;