mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-16 00:01:53 +02:00
entity_t and brush_t now converted to idEditorEntity and idEditorBrush
This commit is contained in:
@@ -36,9 +36,7 @@ int g_entityId = 1;
|
||||
|
||||
#define CURVE_TAG "curve_"
|
||||
|
||||
extern void Brush_Resize(brush_t *b, idVec3 vMin, idVec3 vMax);
|
||||
|
||||
int GetNumKeys(entity_t *ent)
|
||||
int idEditorEntity::GetNumKeys()
|
||||
{
|
||||
// int iCount = 0;
|
||||
// for (epair_t* ep=ent->epairs ; ep ; ep=ep->next)
|
||||
@@ -46,11 +44,11 @@ int GetNumKeys(entity_t *ent)
|
||||
// iCount++;
|
||||
// }
|
||||
|
||||
int iCount = ent->epairs.GetNumKeyVals();
|
||||
int iCount = epairs.GetNumKeyVals();
|
||||
return iCount;
|
||||
}
|
||||
|
||||
const char *GetKeyString(entity_t *ent, int iIndex)
|
||||
const char *idEditorEntity::GetKeyString(int iIndex)
|
||||
{
|
||||
// for (epair_t* ep=ent->epairs ; ep ; ep=ep->next)
|
||||
// {
|
||||
@@ -61,9 +59,9 @@ const char *GetKeyString(entity_t *ent, int iIndex)
|
||||
// assert(0);
|
||||
// return NULL;
|
||||
|
||||
if ( iIndex < GetNumKeys(ent) )
|
||||
if ( iIndex < GetNumKeys() )
|
||||
{
|
||||
return ent->epairs.GetKeyVal(iIndex)->GetKey().c_str();
|
||||
return epairs.GetKeyVal(iIndex)->GetKey().c_str();
|
||||
}
|
||||
|
||||
assert(0);
|
||||
@@ -75,29 +73,29 @@ const char *GetKeyString(entity_t *ent, int iIndex)
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
const char *ValueForKey(entity_t *ent, const char *key) {
|
||||
return ent->epairs.GetString(key);
|
||||
const char *idEditorEntity::ValueForKey(const char *key) {
|
||||
return epairs.GetString(key);
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void TrackMD3Angles(entity_t *e, const char *key, const char *value) {
|
||||
void TrackMD3Angles(idEditorEntity *e, const char *key, const char *value) {
|
||||
if ( idStr::Icmp(key, "angle") != 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((e->eclass->fixedsize && e->eclass->nShowFlags & ECLASS_MISCMODEL) || EntityHasModel(e)) {
|
||||
float a = FloatForKey(e, "angle");
|
||||
if ((e->eclass->fixedsize && e->eclass->nShowFlags & ECLASS_MISCMODEL) || e->EntityHasModel()) {
|
||||
float a = e->FloatForKey("angle");
|
||||
float b = atof(value);
|
||||
if (a != b) {
|
||||
idVec3 vAngle;
|
||||
vAngle[0] = vAngle[1] = 0;
|
||||
vAngle[2] = -a;
|
||||
Brush_Rotate(e->brushes.onext, vAngle, e->origin, true);
|
||||
e->brushes.onext->Brush_Rotate(vAngle, e->origin, true);
|
||||
vAngle[2] = b;
|
||||
Brush_Rotate(e->brushes.onext, vAngle, e->origin, true);
|
||||
e->brushes.onext->Brush_Rotate(vAngle, e->origin, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,54 +104,42 @@ void TrackMD3Angles(entity_t *e, const char *key, const char *value) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void SetKeyValue(entity_t *ent, const char *key, const char *value, bool trackAngles) {
|
||||
if (ent == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
void idEditorEntity::SetKeyValue(const char *key, const char *value, bool trackAngles) {
|
||||
if (!key || !key[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trackAngles) {
|
||||
TrackMD3Angles(ent, key, value);
|
||||
TrackMD3Angles(this, key, value);
|
||||
}
|
||||
|
||||
ent->epairs.Set(key, value);
|
||||
GetVectorForKey(ent, "origin", ent->origin);
|
||||
epairs.Set(key, value);
|
||||
GetVectorForKey("origin", origin);
|
||||
|
||||
// update sound in case this key was relevent
|
||||
Entity_UpdateSoundEmitter( ent );
|
||||
Entity_UpdateSoundEmitter();
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void SetKeyVec3(entity_t *ent, const char *key, idVec3 v) {
|
||||
if (ent == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
void idEditorEntity::SetKeyVec3(const char *key, idVec3 v) {
|
||||
if (!key || !key[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
idStr str;
|
||||
sprintf(str, "%g %g %g", v.x, v.y, v.z);
|
||||
ent->epairs.Set(key, str);
|
||||
GetVectorForKey(ent, "origin", ent->origin);
|
||||
epairs.Set(key, str);
|
||||
GetVectorForKey("origin", origin);
|
||||
}
|
||||
|
||||
/*
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void SetKeyMat3(entity_t *ent, const char *key, idMat3 m) {
|
||||
if (ent == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
void idEditorEntity::SetKeyMat3(const char *key, idMat3 m) {
|
||||
if (!key || !key[0]) {
|
||||
return;
|
||||
}
|
||||
@@ -162,8 +148,8 @@ void SetKeyMat3(entity_t *ent, const char *key, idMat3 m) {
|
||||
|
||||
sprintf(str, "%g %g %g %g %g %g %g %g %g",m[0][0],m[0][1],m[0][2],m[1][0],m[1][1],m[1][2],m[2][0],m[2][1],m[2][2]);
|
||||
|
||||
ent->epairs.Set(key, str);
|
||||
GetVectorForKey(ent, "origin", ent->origin);
|
||||
epairs.Set(key, str);
|
||||
GetVectorForKey("origin", origin);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,10 +158,10 @@ void SetKeyMat3(entity_t *ent, const char *key, idMat3 m) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void DeleteKey(entity_t *ent, const char *key) {
|
||||
ent->epairs.Delete(key);
|
||||
void idEditorEntity::DeleteKey(const char *key) {
|
||||
epairs.Delete(key);
|
||||
if (stricmp(key, "rotation") == 0) {
|
||||
ent->rotation.Identity();
|
||||
rotation.Identity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,10 +169,10 @@ void DeleteKey(entity_t *ent, const char *key) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
float FloatForKey(entity_t *ent, const char *key) {
|
||||
float idEditorEntity::FloatForKey(const char *key) {
|
||||
const char *k;
|
||||
|
||||
k = ValueForKey(ent, key);
|
||||
k = ValueForKey(key);
|
||||
if (k && *k) {
|
||||
return atof(k);
|
||||
}
|
||||
@@ -198,10 +184,10 @@ float FloatForKey(entity_t *ent, const char *key) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
int IntForKey(entity_t *ent, const char *key) {
|
||||
int idEditorEntity::IntForKey(const char *key) {
|
||||
const char *k;
|
||||
|
||||
k = ValueForKey(ent, key);
|
||||
k = ValueForKey(key);
|
||||
return atoi(k);
|
||||
}
|
||||
|
||||
@@ -209,9 +195,9 @@ int IntForKey(entity_t *ent, const char *key) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool GetVectorForKey(entity_t *ent, const char *key, idVec3 &vec) {
|
||||
bool idEditorEntity::GetVectorForKey(const char *key, idVec3 &vec) {
|
||||
const char *k;
|
||||
k = ValueForKey(ent, key);
|
||||
k = ValueForKey(key);
|
||||
if (k && strlen(k) > 0) {
|
||||
sscanf(k, "%f %f %f", &vec[0], &vec[1], &vec[2]);
|
||||
return true;
|
||||
@@ -227,9 +213,9 @@ bool GetVectorForKey(entity_t *ent, const char *key, idVec3 &vec) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool GetVector4ForKey(entity_t *ent, const char *key, idVec4 &vec) {
|
||||
bool idEditorEntity::GetVector4ForKey(const char *key, idVec4 &vec) {
|
||||
const char *k;
|
||||
k = ValueForKey(ent, key);
|
||||
k = ValueForKey(key);
|
||||
if (k && strlen(k) > 0) {
|
||||
sscanf(k, "%f %f %f %f", &vec[0], &vec[1], &vec[2], &vec[3]);
|
||||
return true;
|
||||
@@ -245,9 +231,9 @@ bool GetVector4ForKey(entity_t *ent, const char *key, idVec4 &vec) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool GetFloatForKey(entity_t *ent, const char *key, float *f) {
|
||||
bool idEditorEntity::GetFloatForKey(const char *key, float *f) {
|
||||
const char *k;
|
||||
k = ValueForKey(ent, key);
|
||||
k = ValueForKey(key);
|
||||
if (k && strlen(k) > 0) {
|
||||
*f = atof(k);
|
||||
return true;
|
||||
@@ -261,9 +247,9 @@ bool GetFloatForKey(entity_t *ent, const char *key, float *f) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool GetMatrixForKey(entity_t *ent, const char *key, idMat3 &mat) {
|
||||
bool idEditorEntity::GetMatrixForKey(const char *key, idMat3 &mat) {
|
||||
const char *k;
|
||||
k = ValueForKey(ent, key);
|
||||
k = ValueForKey(key);
|
||||
if (k && strlen(k) > 0) {
|
||||
sscanf
|
||||
(
|
||||
@@ -293,8 +279,8 @@ bool GetMatrixForKey(entity_t *ent, const char *key, idMat3 &mat) {
|
||||
Entity_FreeEpairs Frees the entity epairs.
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_FreeEpairs(entity_t *e) {
|
||||
e->epairs.Clear();
|
||||
void idEditorEntity::Entity_FreeEpairs() {
|
||||
epairs.Clear();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -302,7 +288,9 @@ void Entity_FreeEpairs(entity_t *e) {
|
||||
Entity_AddToList
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_AddToList(entity_t *e, entity_t *list) {
|
||||
void idEditorEntity::Entity_AddToList(idEditorEntity *list) {
|
||||
idEditorEntity *e = this;
|
||||
|
||||
if (e->next || e->prev) {
|
||||
Error("Entity_AddToList: allready linked");
|
||||
}
|
||||
@@ -318,7 +306,9 @@ void Entity_AddToList(entity_t *e, entity_t *list) {
|
||||
Entity_RemoveFromList
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_RemoveFromList(entity_t *e) {
|
||||
void idEditorEntity::Entity_RemoveFromList() {
|
||||
idEditorEntity *e = this;
|
||||
|
||||
if ( !e->next || !e->prev ) {
|
||||
Error("Entity_RemoveFromList: not linked");
|
||||
}
|
||||
@@ -333,7 +323,7 @@ void Entity_RemoveFromList(entity_t *e) {
|
||||
Entity_Free Frees the entity and any brushes is has. The entity is removed from the global entities list.
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_Free( entity_t *e ) {
|
||||
void idEditorEntity::Entity_Free( idEditorEntity *e ) {
|
||||
|
||||
while ( e->brushes.onext != &e->brushes ) {
|
||||
Brush_Free(e->brushes.onext);
|
||||
@@ -344,7 +334,7 @@ void Entity_Free( entity_t *e ) {
|
||||
e->prev->next = e->next;
|
||||
}
|
||||
|
||||
Entity_FreeEpairs( e );
|
||||
e->Entity_FreeEpairs();
|
||||
|
||||
delete e;
|
||||
}
|
||||
@@ -355,15 +345,16 @@ void Entity_Free( entity_t *e ) {
|
||||
=======================================================================================================================
|
||||
*/
|
||||
|
||||
int Entity_MemorySize( entity_t *e )
|
||||
int idEditorEntity::Entity_MemorySize()
|
||||
{
|
||||
brush_t *b;
|
||||
idEditorEntity *e = this;
|
||||
idEditorBrush *b;
|
||||
int size;
|
||||
|
||||
size = sizeof( entity_t ) + e->epairs.Size();
|
||||
size = sizeof( idEditorEntity ) + e->epairs.Size();
|
||||
for( b = e->brushes.onext; b != &e->brushes; b = b->onext )
|
||||
{
|
||||
size += Brush_MemorySize( b );
|
||||
size += b->Brush_MemorySize();
|
||||
}
|
||||
return( size );
|
||||
}
|
||||
@@ -438,14 +429,12 @@ void ParseEpair(idDict *dict) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool EntityHasModel(entity_t *ent) {
|
||||
if (ent) {
|
||||
const char *model = ValueForKey(ent, "model");
|
||||
const char *name = ValueForKey(ent, "name");
|
||||
if (model && *model) {
|
||||
if ( idStr::Icmp(model, name) ) {
|
||||
return true;
|
||||
}
|
||||
bool idEditorEntity::EntityHasModel() {
|
||||
const char *model = ValueForKey("model");
|
||||
const char *name = ValueForKey("name");
|
||||
if (model && *model) {
|
||||
if ( idStr::Icmp(model, name) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,8 +445,8 @@ bool EntityHasModel(entity_t *ent) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
entity_t *Entity_New() {
|
||||
entity_t *ent = new entity_t;
|
||||
idEditorEntity *idEditorEntity::Entity_New() {
|
||||
idEditorEntity *ent = new idEditorEntity;
|
||||
|
||||
ent->prev = ent->next = NULL;
|
||||
ent->brushes.prev = ent->brushes.next = NULL;
|
||||
@@ -480,7 +469,8 @@ entity_t *Entity_New() {
|
||||
return ent;
|
||||
}
|
||||
|
||||
void Entity_UpdateCurveData( entity_t *ent ) {
|
||||
void idEditorEntity::Entity_UpdateCurveData() {
|
||||
idEditorEntity *ent = this;
|
||||
|
||||
if ( ent == NULL || ent->curve == NULL ) {
|
||||
return;
|
||||
@@ -513,7 +503,8 @@ void Entity_UpdateCurveData( entity_t *ent ) {
|
||||
|
||||
}
|
||||
|
||||
idCurve<idVec3> *Entity_MakeCurve( entity_t *ent ) {
|
||||
idCurve<idVec3> *idEditorEntity::Entity_MakeCurve() {
|
||||
idEditorEntity *ent = this;
|
||||
const idKeyValue *kv = ent->epairs.MatchPrefix( CURVE_TAG );
|
||||
if ( kv ) {
|
||||
idStr str = kv->GetKey().Right( kv->GetKey().Length() - strlen( CURVE_TAG ) );
|
||||
@@ -526,9 +517,10 @@ idCurve<idVec3> *Entity_MakeCurve( entity_t *ent ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Entity_SetCurveData( entity_t *ent ) {
|
||||
void idEditorEntity::Entity_SetCurveData() {
|
||||
idEditorEntity *ent = this;
|
||||
|
||||
ent->curve = Entity_MakeCurve( ent );
|
||||
ent->curve = Entity_MakeCurve();
|
||||
const idKeyValue *kv = ent->epairs.MatchPrefix( CURVE_TAG );
|
||||
if ( kv && ent->curve ) {
|
||||
idLexer lex;
|
||||
@@ -552,16 +544,17 @@ void Entity_SetCurveData( entity_t *ent ) {
|
||||
|
||||
}
|
||||
|
||||
entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
idEditorEntity *idEditorEntity::Entity_PostParse(idEditorBrush *pList) {
|
||||
idEditorEntity *ent = this;
|
||||
bool has_brushes;
|
||||
eclass_t *e;
|
||||
brush_t *b;
|
||||
idEditorBrush *b;
|
||||
idVec3 mins, maxs, zero;
|
||||
idBounds bo;
|
||||
|
||||
zero.Zero();
|
||||
|
||||
Entity_SetCurveData( ent );
|
||||
ent->Entity_SetCurveData();
|
||||
|
||||
if (ent->brushes.onext == &ent->brushes) {
|
||||
has_brushes = false;
|
||||
@@ -570,15 +563,15 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
has_brushes = true;
|
||||
}
|
||||
|
||||
bool needsOrigin = !GetVectorForKey(ent, "origin", ent->origin);
|
||||
const char *pModel = ValueForKey(ent, "model");
|
||||
bool needsOrigin = !ent->GetVectorForKey("origin", ent->origin);
|
||||
const char *pModel = ent->ValueForKey("model");
|
||||
|
||||
const char *cp = ValueForKey(ent, "classname");
|
||||
const char *cp = ent->ValueForKey("classname");
|
||||
|
||||
if (strlen(cp)) {
|
||||
e = Eclass_ForName(cp, has_brushes);
|
||||
} else {
|
||||
const char *cp2 = ValueForKey(ent, "name");
|
||||
const char *cp2 = ent->ValueForKey("name");
|
||||
if (strlen(cp2)) {
|
||||
char buff[1024];
|
||||
strcpy(buff, cp2);
|
||||
@@ -588,7 +581,7 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
len--;
|
||||
}
|
||||
e = Eclass_ForName(buff, has_brushes);
|
||||
SetKeyValue(ent, "classname", buff, false);
|
||||
ent->SetKeyValue("classname", buff, false);
|
||||
} else {
|
||||
e = Eclass_ForName("", has_brushes);
|
||||
}
|
||||
@@ -602,7 +595,7 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
|
||||
ent->eclass = e;
|
||||
|
||||
bool hasModel = EntityHasModel(ent);
|
||||
bool hasModel = ent->EntityHasModel();
|
||||
|
||||
if (hasModel) {
|
||||
ent->eclass->defArgs.GetString("model", "", str);
|
||||
@@ -617,14 +610,14 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
needsOrigin = false;
|
||||
ent->epairs.Delete( "model" );
|
||||
} else if (e->nShowFlags & ECLASS_LIGHT) {
|
||||
if (GetVectorForKey(ent, "light_origin", ent->lightOrigin)) {
|
||||
GetMatrixForKey(ent, "light_rotation", ent->lightRotation);
|
||||
if (ent->GetVectorForKey("light_origin", ent->lightOrigin)) {
|
||||
ent->GetMatrixForKey("light_rotation", ent->lightRotation);
|
||||
ent->trackLightOrigin = true;
|
||||
} else if (hasModel) {
|
||||
SetKeyValue(ent, "light_origin", ValueForKey(ent, "origin"));
|
||||
ent->SetKeyValue("light_origin", ent->ValueForKey("origin"));
|
||||
ent->lightOrigin = ent->origin;
|
||||
if (GetMatrixForKey(ent, "rotation", ent->lightRotation)) {
|
||||
SetKeyValue(ent, "light_rotation", ValueForKey(ent, "rotation"));
|
||||
if (ent->GetMatrixForKey("rotation", ent->lightRotation)) {
|
||||
ent->SetKeyValue("light_rotation", ent->ValueForKey("rotation"));
|
||||
}
|
||||
ent->trackLightOrigin = true;
|
||||
}
|
||||
@@ -678,22 +671,19 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
b->modelHandle = modelHandle;
|
||||
|
||||
float yaw = 0;
|
||||
bool convertAngles = GetFloatForKey(ent, "angle", &yaw);
|
||||
extern void Brush_Rotate(brush_t *b, idMat3 matrix, idVec3 origin, bool bBuild);
|
||||
extern void Brush_Rotate(brush_t *b, idVec3 rot, idVec3 origin, bool bBuild);
|
||||
|
||||
bool convertAngles = ent->GetFloatForKey("angle", &yaw);
|
||||
if (convertAngles) {
|
||||
idVec3 rot(0, 0, yaw);
|
||||
Brush_Rotate(b, rot, ent->origin, false);
|
||||
b->Brush_Rotate(rot, ent->origin, false);
|
||||
}
|
||||
|
||||
if (GetMatrixForKey(ent, "rotation", ent->rotation)) {
|
||||
if (ent->GetMatrixForKey("rotation", ent->rotation)) {
|
||||
idBounds bo2;
|
||||
bo2.FromTransformedBounds(bo, ent->origin, ent->rotation);
|
||||
b->owner = ent;
|
||||
Brush_Resize(b, bo2[0], bo2[1]);
|
||||
b->Brush_Resize(bo2[0], bo2[1]);
|
||||
}
|
||||
Entity_LinkBrush(ent, b);
|
||||
ent->Entity_LinkBrush(b);
|
||||
}
|
||||
|
||||
if (!hasModel || (ent->eclass->nShowFlags & ECLASS_LIGHT && hasModel)) {
|
||||
@@ -707,14 +697,14 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
}
|
||||
|
||||
b = Brush_Create(mins, maxs, &e->texdef);
|
||||
GetMatrixForKey(ent, "rotation", ent->rotation);
|
||||
Entity_LinkBrush(ent, b);
|
||||
ent->GetMatrixForKey("rotation", ent->rotation);
|
||||
ent->Entity_LinkBrush(b);
|
||||
b->trackLightOrigin = ent->trackLightOrigin;
|
||||
if ( e->texdef.name == NULL ) {
|
||||
brushprimit_texdef_t bp;
|
||||
texdef_t td;
|
||||
td.SetName( ent->eclass->defMaterial );
|
||||
Brush_SetTexture( b, &td, &bp, false );
|
||||
b->Brush_SetTexture(&td, &bp, false );
|
||||
}
|
||||
}
|
||||
} else { // brush entity
|
||||
@@ -723,9 +713,9 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
}
|
||||
|
||||
if (!needsOrigin) {
|
||||
idStr cn = ValueForKey(ent, "classname");
|
||||
idStr name = ValueForKey(ent, "name");
|
||||
idStr model = ValueForKey(ent, "model");
|
||||
idStr cn = ent->ValueForKey("classname");
|
||||
idStr name = ent->ValueForKey("name");
|
||||
idStr model = ent->ValueForKey("model");
|
||||
if (cn.Icmp("func_static") == 0) {
|
||||
if (name.Icmp(model) == 0) {
|
||||
needsOrigin = true;
|
||||
@@ -742,7 +732,7 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
|
||||
// add in the origin
|
||||
for (b = ent->brushes.onext; b != &ent->brushes; b = b->onext) {
|
||||
Brush_Build(b, true, false, false);
|
||||
b->Brush_Build(true, false, false);
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (b->mins[i] < mins[i]) {
|
||||
mins[i] = b->mins[i];
|
||||
@@ -759,16 +749,16 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
}
|
||||
|
||||
sprintf(text, "%i %i %i", (int)ent->origin[0], (int)ent->origin[1], (int)ent->origin[2]);
|
||||
SetKeyValue(ent, "origin", text);
|
||||
ent->SetKeyValue("origin", text);
|
||||
}
|
||||
|
||||
if (!(e->nShowFlags & ECLASS_WORLDSPAWN)) {
|
||||
if (e->defArgs.FindKey("model") == NULL && (pModel == NULL || (pModel && strlen(pModel) == 0))) {
|
||||
SetKeyValue(ent, "model", ValueForKey(ent, "name"));
|
||||
ent->SetKeyValue("model", ent->ValueForKey("name"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
DeleteKey(ent, "origin");
|
||||
ent->DeleteKey("origin");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -794,8 +784,8 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) {
|
||||
global list. Used for parsing the project.
|
||||
=======================================================================================================================
|
||||
*/
|
||||
entity_t *Entity_Parse(bool onlypairs, brush_t *pList) {
|
||||
entity_t *ent;
|
||||
idEditorEntity *idEditorEntity::Entity_Parse(bool onlypairs, idEditorBrush *pList) {
|
||||
idEditorEntity *ent;
|
||||
|
||||
if (!GetToken(true)) {
|
||||
return NULL;
|
||||
@@ -805,7 +795,7 @@ entity_t *Entity_Parse(bool onlypairs, brush_t *pList) {
|
||||
Error("ParseEntity: { not found");
|
||||
}
|
||||
|
||||
ent = Entity_New();
|
||||
ent = idEditorEntity::Entity_New();
|
||||
ent->brushes.onext = ent->brushes.oprev = &ent->brushes;
|
||||
ent->origin.Zero();
|
||||
|
||||
@@ -821,8 +811,8 @@ entity_t *Entity_Parse(bool onlypairs, brush_t *pList) {
|
||||
}
|
||||
|
||||
if (!strcmp(token, "{")) {
|
||||
GetVectorForKey(ent, "origin", ent->origin);
|
||||
brush_t *b = Brush_Parse(ent->origin);
|
||||
ent->GetVectorForKey("origin", ent->origin);
|
||||
idEditorBrush *b = Brush_Parse(ent->origin);
|
||||
if (b != NULL) {
|
||||
b->owner = ent;
|
||||
|
||||
@@ -845,7 +835,7 @@ entity_t *Entity_Parse(bool onlypairs, brush_t *pList) {
|
||||
return ent;
|
||||
}
|
||||
|
||||
return Entity_PostParse(ent, pList);
|
||||
return ent->Entity_PostParse(pList);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -863,8 +853,9 @@ void VectorMidpoint(idVec3 va, idVec3 vb, idVec3 &out) {
|
||||
Entity_Write
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_Write(entity_t *e, FILE *f, bool use_region) {
|
||||
brush_t *b;
|
||||
void idEditorEntity::Entity_Write(FILE *f, bool use_region) {
|
||||
idEditorEntity *e = this;
|
||||
idEditorBrush *b;
|
||||
idVec3 origin;
|
||||
char text[128];
|
||||
int count;
|
||||
@@ -872,7 +863,7 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
|
||||
// if none of the entities brushes are in the region, don't write the entity at all
|
||||
if (use_region) {
|
||||
// in region mode, save the camera position as playerstart
|
||||
if (!strcmp(ValueForKey(e, "classname"), "info_player_start")) {
|
||||
if (!strcmp(e->ValueForKey("classname"), "info_player_start")) {
|
||||
fprintf(f, "{\n");
|
||||
fprintf(f, "\"classname\" \"info_player_start\"\n");
|
||||
fprintf
|
||||
@@ -903,15 +894,15 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
|
||||
// NOTE: the whole brush placement / origin stuff is a mess
|
||||
VectorCopy(e->origin, origin);
|
||||
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue(e, "origin", text);
|
||||
e->SetKeyValue("origin", text);
|
||||
}
|
||||
|
||||
// if fixedsize, calculate a new origin based on the current brush position
|
||||
else if (e->eclass->fixedsize || EntityHasModel(e)) {
|
||||
if (!GetVectorForKey(e, "origin", origin)) {
|
||||
else if (e->eclass->fixedsize || e->EntityHasModel()) {
|
||||
if (!e->GetVectorForKey("origin", origin)) {
|
||||
VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin);
|
||||
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue(e, "origin", text);
|
||||
e->SetKeyValue("origin", text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -922,7 +913,7 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
|
||||
fprintf(f, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str());
|
||||
}
|
||||
|
||||
if (!EntityHasModel(e)) {
|
||||
if (!e->EntityHasModel()) {
|
||||
count = 0;
|
||||
for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
|
||||
if (e->eclass->fixedsize && !b->entityModel) {
|
||||
@@ -931,7 +922,7 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
|
||||
if (!use_region || !Map_IsBrushFiltered(b)) {
|
||||
fprintf(f, "// brush %i\n", count);
|
||||
count++;
|
||||
Brush_Write( b, f, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
|
||||
b->Brush_Write(f, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -943,8 +934,8 @@ void Entity_Write(entity_t *e, FILE *f, bool use_region) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
bool IsBrushSelected(brush_t *bSel) {
|
||||
for (brush_t * b = selected_brushes.next; b != NULL && b != &selected_brushes; b = b->next) {
|
||||
bool IsBrushSelected(idEditorBrush *bSel) {
|
||||
for (idEditorBrush * b = selected_brushes.next; b != NULL && b != &selected_brushes; b = b->next) {
|
||||
if (b == bSel) {
|
||||
return true;
|
||||
}
|
||||
@@ -958,8 +949,9 @@ bool IsBrushSelected(brush_t *bSel) {
|
||||
// Entity_WriteSelected
|
||||
// =======================================================================================================================
|
||||
//
|
||||
void Entity_WriteSelected(entity_t *e, FILE *f) {
|
||||
brush_t *b;
|
||||
void idEditorEntity::Entity_WriteSelected(FILE *f) {
|
||||
idEditorEntity *e = this;
|
||||
idEditorBrush *b;
|
||||
idVec3 origin;
|
||||
char text[128];
|
||||
int count;
|
||||
@@ -975,11 +967,11 @@ void Entity_WriteSelected(entity_t *e, FILE *f) {
|
||||
}
|
||||
|
||||
// if fixedsize, calculate a new origin based on the current brush position
|
||||
if (e->eclass->fixedsize || EntityHasModel(e)) {
|
||||
if (!GetVectorForKey(e, "origin", origin)) {
|
||||
if (e->eclass->fixedsize || e->EntityHasModel()) {
|
||||
if (!e->GetVectorForKey("origin", origin)) {
|
||||
VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin);
|
||||
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue(e, "origin", text);
|
||||
e->SetKeyValue("origin", text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,7 +982,7 @@ void Entity_WriteSelected(entity_t *e, FILE *f) {
|
||||
fprintf(f, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str());
|
||||
}
|
||||
|
||||
if (!EntityHasModel(e)) {
|
||||
if (!e->EntityHasModel()) {
|
||||
count = 0;
|
||||
for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
|
||||
if (e->eclass->fixedsize && !b->entityModel) {
|
||||
@@ -999,7 +991,7 @@ void Entity_WriteSelected(entity_t *e, FILE *f) {
|
||||
if (IsBrushSelected(b)) {
|
||||
fprintf(f, "// brush %i\n", count);
|
||||
count++;
|
||||
Brush_Write( b, f, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
|
||||
b->Brush_Write(f, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1012,8 +1004,9 @@ void Entity_WriteSelected(entity_t *e, FILE *f) {
|
||||
// Entity_WriteSelected to a CMemFile
|
||||
// =======================================================================================================================
|
||||
//
|
||||
void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
|
||||
brush_t *b;
|
||||
void idEditorEntity::Entity_WriteSelected(CMemFile *pMemFile) {
|
||||
idEditorEntity *e = this;
|
||||
idEditorBrush *b;
|
||||
idVec3 origin;
|
||||
char text[128];
|
||||
int count;
|
||||
@@ -1029,11 +1022,11 @@ void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
|
||||
}
|
||||
|
||||
// if fixedsize, calculate a new origin based on the current brush position
|
||||
if (e->eclass->fixedsize || EntityHasModel(e)) {
|
||||
if (!GetVectorForKey(e, "origin", origin)) {
|
||||
if (e->eclass->fixedsize || e->EntityHasModel()) {
|
||||
if (!e->GetVectorForKey("origin", origin)) {
|
||||
VectorSubtract(e->brushes.onext->mins, e->eclass->mins, origin);
|
||||
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue(e, "origin", text);
|
||||
e->SetKeyValue("origin", text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1044,7 +1037,7 @@ void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
|
||||
MemFile_fprintf(pMemFile, "\"%s\" \"%s\"\n", e->epairs.GetKeyVal(j)->GetKey().c_str(), e->epairs.GetKeyVal(j)->GetValue().c_str());
|
||||
}
|
||||
|
||||
if (!EntityHasModel(e)) {
|
||||
if (!e->EntityHasModel()) {
|
||||
count = 0;
|
||||
for (b = e->brushes.onext; b != &e->brushes; b = b->onext) {
|
||||
if (e->eclass->fixedsize && !b->entityModel) {
|
||||
@@ -1053,7 +1046,7 @@ void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
|
||||
if (IsBrushSelected(b)) {
|
||||
MemFile_fprintf(pMemFile, "// brush %i\n", count);
|
||||
count++;
|
||||
Brush_Write( b, pMemFile, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
|
||||
b->Brush_Write(pMemFile, e->origin, ( g_PrefsDlg.m_bNewMapFormat != FALSE ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1065,12 +1058,13 @@ void Entity_WriteSelected(entity_t *e, CMemFile *pMemFile) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_SetName(entity_t *e, const char *name) {
|
||||
CString oldName = ValueForKey(e, "name");
|
||||
CString oldModel = ValueForKey(e, "model");
|
||||
SetKeyValue(e, "name", name);
|
||||
void idEditorEntity::Entity_SetName(const char *name) {
|
||||
idEditorEntity *e = this;
|
||||
CString oldName = e->ValueForKey("name");
|
||||
CString oldModel = e->ValueForKey("model");
|
||||
e->SetKeyValue("name", name);
|
||||
if (oldName == oldModel) {
|
||||
SetKeyValue(e, "model", name);
|
||||
e->SetKeyValue("model", name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1080,8 +1074,9 @@ extern bool Entity_NameIsUnique(const char *name);
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_Name(entity_t *e, bool force) {
|
||||
const char *name = ValueForKey(e, "name");
|
||||
void idEditorEntity::Entity_Name(bool force) {
|
||||
idEditorEntity *e = this;
|
||||
const char *name = e->ValueForKey("name");
|
||||
|
||||
if (!force && name && name[0]) {
|
||||
return;
|
||||
@@ -1093,7 +1088,7 @@ void Entity_Name(entity_t *e, bool force) {
|
||||
|
||||
bool setModel = false;
|
||||
if (name[0]) {
|
||||
const char *model = ValueForKey(e, "model");
|
||||
const char *model = e->ValueForKey("model");
|
||||
if (model[0]) {
|
||||
if ( idStr::Icmp(model, name) == 0 ) {
|
||||
setModel = true;
|
||||
@@ -1101,20 +1096,20 @@ void Entity_Name(entity_t *e, bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *eclass = ValueForKey(e, "classname");
|
||||
const char *eclass = e->ValueForKey("classname");
|
||||
if (eclass && eclass[0]) {
|
||||
idStr str = cvarSystem->GetCVarString( "radiant_nameprefix" );
|
||||
int id = Map_GetUniqueEntityID(str, eclass);
|
||||
if (str.Length()) {
|
||||
SetKeyValue(e, "name", va("%s_%s_%i", str.c_str(), eclass, id));
|
||||
e->SetKeyValue("name", va("%s_%s_%i", str.c_str(), eclass, id));
|
||||
} else {
|
||||
SetKeyValue(e, "name", va("%s_%i", eclass, id));
|
||||
e->SetKeyValue("name", va("%s_%i", eclass, id));
|
||||
}
|
||||
if (setModel) {
|
||||
if (str.Length()) {
|
||||
SetKeyValue(e, "model", va("%s_%s_%i", str.c_str(), eclass, id));
|
||||
e->SetKeyValue("model", va("%s_%s_%i", str.c_str(), eclass, id));
|
||||
} else {
|
||||
SetKeyValue(e, "model", va("%s_%i", eclass, id));
|
||||
e->SetKeyValue("model", va("%s_%i", eclass, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1126,9 +1121,9 @@ void Entity_Name(entity_t *e, bool force) {
|
||||
are only used to find a midpoint. Otherwise, the brushes have their ownership transfered to the new entity.
|
||||
=======================================================================================================================
|
||||
*/
|
||||
entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
|
||||
entity_t *e;
|
||||
brush_t *b;
|
||||
idEditorEntity *idEditorEntity::Entity_Create(eclass_t *c, bool forceFixed) {
|
||||
idEditorEntity *e;
|
||||
idEditorBrush *b;
|
||||
idVec3 mins, maxs, origin;
|
||||
char text[32];
|
||||
texdef_t td;
|
||||
@@ -1149,15 +1144,15 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
|
||||
}
|
||||
|
||||
// create it
|
||||
e = Entity_New();
|
||||
e = idEditorEntity::Entity_New();
|
||||
e->brushes.onext = e->brushes.oprev = &e->brushes;
|
||||
e->eclass = c;
|
||||
e->epairs.Copy(c->args);
|
||||
SetKeyValue(e, "classname", c->name);
|
||||
Entity_Name(e, false);
|
||||
e->SetKeyValue("classname", c->name);
|
||||
e->Entity_Name(false);
|
||||
|
||||
// add the entity to the entity list
|
||||
Entity_AddToList(e, &entities);
|
||||
e->Entity_AddToList(&entities);
|
||||
|
||||
if (c->fixedsize) {
|
||||
//
|
||||
@@ -1173,11 +1168,11 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
|
||||
|
||||
b = Brush_Create(mins, maxs, &c->texdef);
|
||||
|
||||
Entity_LinkBrush(e, b);
|
||||
e->Entity_LinkBrush(b);
|
||||
|
||||
if (c->defMaterial.Length()) {
|
||||
td.SetName(c->defMaterial);
|
||||
Brush_SetTexture(b, &td, &bp, false);
|
||||
b->Brush_SetTexture(&td, &bp, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1188,7 +1183,7 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
|
||||
b->next = b->prev = &selected_brushes;
|
||||
selected_brushes.next = selected_brushes.prev = b;
|
||||
|
||||
Brush_Build(b);
|
||||
b->Brush_Build();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1196,12 +1191,12 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
|
||||
|
||||
// change the selected brushes over to the new entity
|
||||
for (b = selected_brushes.next; b != &selected_brushes; b = b->next) {
|
||||
Entity_UnlinkBrush(b);
|
||||
Entity_LinkBrush(e, b);
|
||||
Brush_Build(b); // so the key brush gets a name
|
||||
idEditorEntity::Entity_UnlinkBrush(b);
|
||||
e->Entity_LinkBrush(b);
|
||||
b->Brush_Build(); // so the key brush gets a name
|
||||
if (c->defMaterial.Length()) {
|
||||
td.SetName(c->defMaterial);
|
||||
Brush_SetTexture(b, &td, &bp, false);
|
||||
b->Brush_SetTexture(&td, &bp, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1211,19 +1206,19 @@ entity_t *Entity_Create(eclass_t *c, bool forceFixed) {
|
||||
//}
|
||||
|
||||
if (!forceFixed) {
|
||||
SetKeyValue(e, "model", ValueForKey(e, "name"));
|
||||
e->SetKeyValue("model", e->ValueForKey("name"));
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue(e, "origin", text);
|
||||
e->SetKeyValue("origin", text);
|
||||
VectorCopy(origin, e->origin);
|
||||
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
return e;
|
||||
}
|
||||
|
||||
void Brush_MakeDirty(brush_t *b) {
|
||||
void Brush_MakeDirty(idEditorBrush *b) {
|
||||
for (face_t *f = b->brush_faces; f; f = f->next) {
|
||||
f->dirty = true;
|
||||
}
|
||||
@@ -1233,7 +1228,9 @@ void Brush_MakeDirty(brush_t *b) {
|
||||
Entity_LinkBrush
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_LinkBrush(entity_t *e, brush_t *b) {
|
||||
void idEditorEntity::Entity_LinkBrush(idEditorBrush *b) {
|
||||
idEditorEntity *e = this;
|
||||
|
||||
if (b->oprev || b->onext) {
|
||||
Error("Entity_LinkBrush: Allready linked");
|
||||
}
|
||||
@@ -1253,7 +1250,7 @@ void Entity_LinkBrush(entity_t *e, brush_t *b) {
|
||||
Entity_UnlinkBrush
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void Entity_UnlinkBrush(brush_t *b) {
|
||||
void idEditorEntity::Entity_UnlinkBrush(idEditorBrush *b) {
|
||||
// if (!b->owner || !b->onext || !b->oprev)
|
||||
if (!b->onext || !b->oprev) {
|
||||
Error("Entity_UnlinkBrush: Not currently linked");
|
||||
@@ -1270,17 +1267,17 @@ void Entity_UnlinkBrush(brush_t *b) {
|
||||
Entity_Clone
|
||||
=======================================================================================================================
|
||||
*/
|
||||
entity_t *Entity_Clone(entity_t *e) {
|
||||
entity_t *n;
|
||||
idEditorEntity *idEditorEntity::Entity_Clone(idEditorEntity *e) {
|
||||
idEditorEntity *n;
|
||||
|
||||
n = Entity_New();
|
||||
n = idEditorEntity::Entity_New();
|
||||
n->brushes.onext = n->brushes.oprev = &n->brushes;
|
||||
n->eclass = e->eclass;
|
||||
n->rotation = e->rotation;
|
||||
n->origin = e->origin;
|
||||
|
||||
// add the entity to the entity list
|
||||
Entity_AddToList(n, &entities);
|
||||
n->Entity_AddToList(&entities);
|
||||
|
||||
n->epairs = e->epairs;
|
||||
|
||||
@@ -1291,10 +1288,10 @@ entity_t *Entity_Clone(entity_t *e) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
int GetUniqueTargetId(int iHint) {
|
||||
int idEditorEntity::GetUniqueTargetId(int iHint) {
|
||||
int iMin, iMax, i;
|
||||
BOOL fFound;
|
||||
entity_t *pe;
|
||||
idEditorEntity *pe;
|
||||
|
||||
fFound = FALSE;
|
||||
pe = entities.next;
|
||||
@@ -1302,7 +1299,7 @@ int GetUniqueTargetId(int iHint) {
|
||||
iMax = 0;
|
||||
|
||||
for (; pe != NULL && pe != &entities; pe = pe->next) {
|
||||
i = IntForKey(pe, "target");
|
||||
i = pe->IntForKey("target");
|
||||
if (i) {
|
||||
iMin = Min(i, iMin);
|
||||
iMax = Max(i, iMax);
|
||||
@@ -1324,13 +1321,13 @@ int GetUniqueTargetId(int iHint) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
entity_t *FindEntity(const char *pszKey, const char *pszValue) {
|
||||
entity_t *pe;
|
||||
idEditorEntity *idEditorEntity::FindEntity(const char *pszKey, const char *pszValue) {
|
||||
idEditorEntity *pe;
|
||||
|
||||
pe = entities.next;
|
||||
|
||||
for (; pe != NULL && pe != &entities; pe = pe->next) {
|
||||
if (!strcmp(ValueForKey(pe, pszKey), pszValue)) {
|
||||
if (!strcmp(pe->ValueForKey(pszKey), pszValue)) {
|
||||
return pe;
|
||||
}
|
||||
}
|
||||
@@ -1342,13 +1339,13 @@ entity_t *FindEntity(const char *pszKey, const char *pszValue) {
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
*/
|
||||
entity_t *FindEntityInt(const char *pszKey, int iValue) {
|
||||
entity_t *pe;
|
||||
idEditorEntity *idEditorEntity::FindEntityInt(const char *pszKey, int iValue) {
|
||||
idEditorEntity *pe;
|
||||
|
||||
pe = entities.next;
|
||||
|
||||
for (; pe != NULL && pe != &entities; pe = pe->next) {
|
||||
if (IntForKey(pe, pszKey) == iValue) {
|
||||
if (pe->IntForKey(pszKey) == iValue) {
|
||||
return pe;
|
||||
}
|
||||
}
|
||||
@@ -1366,7 +1363,8 @@ to it not having one, being filtered away, or the sound mode being turned off.
|
||||
Creates or updates the soundEmitter if needed
|
||||
====================
|
||||
*/
|
||||
void Entity_UpdateSoundEmitter( entity_t *ent ) {
|
||||
void idEditorEntity::Entity_UpdateSoundEmitter() {
|
||||
idEditorEntity *ent = this;
|
||||
bool playing = false;
|
||||
|
||||
// if an entity doesn't have any brushes at all, don't do anything
|
||||
@@ -1374,7 +1372,7 @@ void Entity_UpdateSoundEmitter( entity_t *ent ) {
|
||||
if ( g_pParentWnd->GetCamera()->GetSoundMode()
|
||||
&& ent->brushes.onext != &ent->brushes && !FilterBrush(ent->brushes.onext) ) {
|
||||
// check for sounds
|
||||
const char *v = ValueForKey( ent, "s_shader" );
|
||||
const char *v = ent->ValueForKey("s_shader");
|
||||
if ( v[0] ) {
|
||||
refSound_t sound;
|
||||
|
||||
@@ -1398,4 +1396,3 @@ void Entity_UpdateSoundEmitter( entity_t *ent ) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user