mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-02 15:22:11 +00:00
Cache the worldspawn entity.
It is an error (for now) if there is not exactly one worldspawn entity.
This commit is contained in:
parent
4f0a1df3c1
commit
f1a18742f1
2 changed files with 19 additions and 8 deletions
tools/qflight
|
@ -87,6 +87,7 @@ typedef struct entity_s {
|
||||||
|
|
||||||
extern entity_t *entities;
|
extern entity_t *entities;
|
||||||
extern int num_entities;
|
extern int num_entities;
|
||||||
|
extern entity_t *world_entity;
|
||||||
|
|
||||||
const char *ValueForKey (entity_t *ent, const char *key);
|
const char *ValueForKey (entity_t *ent, const char *key);
|
||||||
void SetKeyValue (entity_t *ent, const char *key, const char *value);
|
void SetKeyValue (entity_t *ent, const char *key, const char *value);
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
|
|
||||||
entity_t *entities;
|
entity_t *entities;
|
||||||
int num_entities;
|
int num_entities;
|
||||||
|
entity_t *world_entity;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ENTITY FILE PARSING
|
ENTITY FILE PARSING
|
||||||
|
@ -233,7 +234,13 @@ LoadEntities (void)
|
||||||
entity->style);
|
entity->style);
|
||||||
|
|
||||||
// all fields have been parsed
|
// all fields have been parsed
|
||||||
if (entity->classname && !strncmp (entity->classname, "light", 5)) {
|
if (entity->classname) {
|
||||||
|
if (strcmp (entity->classname, "worldspawn")) {
|
||||||
|
if (world_entity)
|
||||||
|
Sys_Error ("More than one worldspawn entity");
|
||||||
|
world_entity = entity;
|
||||||
|
}
|
||||||
|
if (!strncmp (entity->classname, "light", 5)) {
|
||||||
set_properties (entity, dict);
|
set_properties (entity, dict);
|
||||||
if (!entity->light)
|
if (!entity->light)
|
||||||
entity->light = DEFAULTLIGHTLEVEL;
|
entity->light = DEFAULTLIGHTLEVEL;
|
||||||
|
@ -242,6 +249,7 @@ LoadEntities (void)
|
||||||
if (!entity->persistence)
|
if (!entity->persistence)
|
||||||
entity->persistence = 1;
|
entity->persistence = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
PL_Free (dict);
|
PL_Free (dict);
|
||||||
|
|
||||||
if (entity->light) {
|
if (entity->light) {
|
||||||
|
@ -311,6 +319,8 @@ LoadEntities (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!world_entity)
|
||||||
|
Sys_Error ("no worldspawn entity");
|
||||||
|
|
||||||
if (options.verbosity >= 0)
|
if (options.verbosity >= 0)
|
||||||
printf ("%d entities read\n", num_entities);
|
printf ("%d entities read\n", num_entities);
|
||||||
|
|
Loading…
Reference in a new issue