Allow entites to be create in deactivated state.
This commit is contained in:
parent
31eee4a86f
commit
4b537a3bee
|
@ -278,7 +278,7 @@ static void loadEntities(cJSON *node)
|
||||||
{
|
{
|
||||||
Entity *e;
|
Entity *e;
|
||||||
char *name, *groupName;
|
char *name, *groupName;
|
||||||
int i, type, scatter, number;
|
int i, type, scatter, number, active;
|
||||||
float x, y;
|
float x, y;
|
||||||
|
|
||||||
scatter = 1;
|
scatter = 1;
|
||||||
|
@ -296,6 +296,7 @@ static void loadEntities(cJSON *node)
|
||||||
name = NULL;
|
name = NULL;
|
||||||
groupName = NULL;
|
groupName = NULL;
|
||||||
number = 1;
|
number = 1;
|
||||||
|
active = 1;
|
||||||
|
|
||||||
if (cJSON_GetObjectItem(node, "name"))
|
if (cJSON_GetObjectItem(node, "name"))
|
||||||
{
|
{
|
||||||
|
@ -312,6 +313,11 @@ static void loadEntities(cJSON *node)
|
||||||
number = cJSON_GetObjectItem(node, "number")->valueint;
|
number = cJSON_GetObjectItem(node, "number")->valueint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cJSON_GetObjectItem(node, "active"))
|
||||||
|
{
|
||||||
|
active = cJSON_GetObjectItem(node, "active")->valueint;
|
||||||
|
}
|
||||||
|
|
||||||
if (cJSON_GetObjectItem(node, "scatter"))
|
if (cJSON_GetObjectItem(node, "scatter"))
|
||||||
{
|
{
|
||||||
scatter = cJSON_GetObjectItem(node, "scatter")->valueint;
|
scatter = cJSON_GetObjectItem(node, "scatter")->valueint;
|
||||||
|
@ -351,6 +357,8 @@ static void loadEntities(cJSON *node)
|
||||||
e->x += (rand() % scatter) - (rand() % scatter);
|
e->x += (rand() % scatter) - (rand() % scatter);
|
||||||
e->y += (rand() % scatter) - (rand() % scatter);
|
e->y += (rand() % scatter) - (rand() % scatter);
|
||||||
|
|
||||||
|
e->active = active;
|
||||||
|
|
||||||
SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h);
|
SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue