light: entities: refactor EntDict_VectorForKey
This commit is contained in:
parent
f716e14c89
commit
dc8525dfd2
|
|
@ -152,7 +152,7 @@ const std::vector<entity_t>& GetLights();
|
|||
|
||||
const entdict_t *FindEntDictWithKeyPair(const std::string &key, const std::string &value);
|
||||
const char *ValueForKey(const entity_t *ent, const char *key);
|
||||
void GetVectorForKey(const entdict_t *ent, const char *key, vec3_t vec);
|
||||
void EntDict_VectorForKey(const entdict_t &ent, const std::string &key, vec3_t vec);
|
||||
|
||||
std::string EntDict_StringForKey(const entdict_t &dict, const std::string key);
|
||||
float EntDict_FloatForKey(const entdict_t &dict, const std::string key);
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ SetupSpotlights(void)
|
|||
for (entity_t &entity : all_lights) {
|
||||
if (entity.targetent) {
|
||||
vec3_t targetOrigin;
|
||||
GetVectorForKey(entity.targetent, "origin", targetOrigin);
|
||||
EntDict_VectorForKey(*entity.targetent, "origin", targetOrigin);
|
||||
VectorSubtract(targetOrigin, *entity.origin.vec3Value(), entity.spotvec);
|
||||
VectorNormalize(entity.spotvec);
|
||||
entity.spotlight = true;
|
||||
|
|
@ -1158,9 +1158,9 @@ const entdict_t *FindEntDictWithKeyPair(const std::string &key, const std::strin
|
|||
}
|
||||
|
||||
void
|
||||
GetVectorForKey(const entdict_t *ent, const char *key, vec3_t vec)
|
||||
EntDict_VectorForKey(const entdict_t &ent, const std::string &key, vec3_t vec)
|
||||
{
|
||||
std::string value = EntDict_StringForKey(*ent, key);
|
||||
std::string value = EntDict_StringForKey(ent, key);
|
||||
sscanf(value.c_str(), "%f %f %f", &vec[0], &vec[1], &vec[2]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ FindModelInfo(const bsp2_t *bsp, const char *lmscaleoverride)
|
|||
|
||||
/* Set up the offset for rotate_* entities */
|
||||
if (EntDict_StringForKey(*entdict, "classname").find("rotate_") == 0) {
|
||||
GetVectorForKey(entdict, "origin", info.offset);
|
||||
EntDict_VectorForKey(*entdict, "origin", info.offset);
|
||||
}
|
||||
|
||||
/* Enable .lit if needed */
|
||||
|
|
|
|||
Loading…
Reference in New Issue