/* ======================================================================================================================= ======================================================================================================================= */ void SetKeyValue(entity_t *ent, const char *key, const char *value, bool trackAngles) { if (ent == NULL) { return; } if (!key || !key[0]) { return; } if (trackAngles) { TrackMD3Angles(ent, key, value); } ent->epairs.Set(key, value); GetVectorForKey(ent, "origin", ent->origin); // update sound in case this key was relevent Entity_UpdateSoundEmitter( ent ); }
// make sure you add any new tracking functions inside the IF, this is important! // void SetKeyValue (entity_t *ent, LPCSTR key, LPCSTR value, bool bDoTracking/*=true*/) { epair_t *ep; if (ent == NULL) return; if (!key || !key[0]) return; if (ent == world_entity && strcmp(key,sKEYFIELD_GROUPNAME)==0) return; // dumb to do this if (bDoTracking) { #ifdef SOF TrackMD3Scale(ent, key, value); #endif TrackMD3Angles(ent, key, value); } for (ep=ent->epairs ; ep ; ep=ep->next) { if (!strcmp (ep->key, key) ) { free (ep->value); ep->value = (char*)qmalloc(strlen(value)+1); strcpy (ep->value, value); return; } } ep = (epair_t*)qmalloc (sizeof(*ep)); ep->next = ent->epairs; ent->epairs = ep; ep->key = (char*)qmalloc(strlen(key)+1); strcpy (ep->key, key); ep->value = (char*)qmalloc(strlen(value)+1); strcpy (ep->value, value); }