* point entities are understood as miscmodels, if <model attribute is present in xml .ent definition
* <model key= is not hardcoded to 'model' anymore, can use 'mdl'(q1) or w/e
This commit is contained in:
parent
387c4c0846
commit
f9157a6993
|
|
@ -107,6 +107,8 @@ CopiedString m_name;
|
||||||
StringList m_parent;
|
StringList m_parent;
|
||||||
bool fixedsize;
|
bool fixedsize;
|
||||||
bool unknown; // wasn't found in source
|
bool unknown; // wasn't found in source
|
||||||
|
bool miscmodel_is; // definable via model attribute presence in xml .ent definition
|
||||||
|
CopiedString m_miscmodel_key;
|
||||||
Vector3 mins;
|
Vector3 mins;
|
||||||
Vector3 maxs;
|
Vector3 maxs;
|
||||||
|
|
||||||
|
|
@ -141,6 +143,9 @@ const char* modelpath() const {
|
||||||
const char* skin() const {
|
const char* skin() const {
|
||||||
return m_skin.c_str();
|
return m_skin.c_str();
|
||||||
}
|
}
|
||||||
|
const char* miscmodel_key() const {
|
||||||
|
return m_miscmodel_key.c_str();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const char* EntityClass_valueForKey( const EntityClass& entityClass, const char* key ){
|
inline const char* EntityClass_valueForKey( const EntityClass& entityClass, const char* key ){
|
||||||
|
|
@ -159,6 +164,17 @@ inline EntityClassAttributePair& EntityClass_insertAttribute( EntityClass& entit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool classname_equal( const char* classname, const char* other ){
|
||||||
|
return string_equal_nocase( classname, other );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EntityClass_miscmodel_is( const EntityClass* entityClass ){
|
||||||
|
return entityClass->miscmodel_is
|
||||||
|
|| ( string_compare_nocase_n( entityClass->name(), "misc_", 5 ) == 0 && string_equal_nocase( entityClass->name() + string_length( entityClass->name() ) - 5, "model" ) ) // misc_*model (also misc_model)
|
||||||
|
|| classname_equal( entityClass->name(), "model_static" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void buffer_write_colour_add( char buffer[128], const Colour3& colour ){
|
inline void buffer_write_colour_add( char buffer[128], const Colour3& colour ){
|
||||||
sprintf( buffer, "{%g %g %g}", colour[0], colour[1], colour[2] );
|
sprintf( buffer, "{%g %g %g}", colour[0], colour[1], colour[2] );
|
||||||
}
|
}
|
||||||
|
|
@ -241,6 +257,8 @@ inline EntityClass* Eclass_Alloc(){
|
||||||
|
|
||||||
e->fixedsize = false;
|
e->fixedsize = false;
|
||||||
e->unknown = false;
|
e->unknown = false;
|
||||||
|
e->miscmodel_is = false;
|
||||||
|
e->m_miscmodel_key = "model";
|
||||||
memset( e->flagnames, 0, MAX_FLAGS * 32 );
|
memset( e->flagnames, 0, MAX_FLAGS * 32 );
|
||||||
|
|
||||||
e->maxs = Vector3( -1,-1,-1 );
|
e->maxs = Vector3( -1,-1,-1 );
|
||||||
|
|
@ -262,10 +280,6 @@ inline void Eclass_Free( EntityClass* e ){
|
||||||
delete e;
|
delete e;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool classname_equal( const char* classname, const char* other ){
|
|
||||||
return string_equal( classname, other );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline EntityClass* EClass_Create( const char* name, const Vector3& colour, const char* comments ){
|
inline EntityClass* EClass_Create( const char* name, const Vector3& colour, const char* comments ){
|
||||||
EntityClass *e = Eclass_Alloc();
|
EntityClass *e = Eclass_Alloc();
|
||||||
e->free = &Eclass_Free;
|
e->free = &Eclass_Free;
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,7 @@
|
||||||
EGameType g_gameType;
|
EGameType g_gameType;
|
||||||
|
|
||||||
inline scene::Node& entity_for_eclass( EntityClass* eclass ){
|
inline scene::Node& entity_for_eclass( EntityClass* eclass ){
|
||||||
if ( ( string_compare_nocase_n( eclass->name(), "misc_", 5 ) == 0 && string_equal_nocase( eclass->name() + string_length( eclass->name() ) - 5, "model" ) ) // misc_*model (also misc_model) // TODO make classname_* wrapper functions for this
|
if ( EntityClass_miscmodel_is( eclass ) ) {
|
||||||
|| classname_equal( eclass->name(), "model_static" ) ) {
|
|
||||||
return New_MiscModel( eclass );
|
return New_MiscModel( eclass );
|
||||||
}
|
}
|
||||||
else if ( classname_equal( eclass->name(), "light" )
|
else if ( classname_equal( eclass->name(), "light" )
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ Callback m_evaluateTransform;
|
||||||
void construct(){
|
void construct(){
|
||||||
m_keyObservers.insert( "classname", ClassnameFilter::ClassnameChangedCaller( m_filter ) );
|
m_keyObservers.insert( "classname", ClassnameFilter::ClassnameChangedCaller( m_filter ) );
|
||||||
m_keyObservers.insert( Static<KeyIsName>::instance().m_nameKey, NamedEntity::IdentifierChangedCaller( m_named ) );
|
m_keyObservers.insert( Static<KeyIsName>::instance().m_nameKey, NamedEntity::IdentifierChangedCaller( m_named ) );
|
||||||
m_keyObservers.insert( "model", SingletonModel::ModelChangedCaller( m_model ) );
|
m_keyObservers.insert( m_entity.getEntityClass().miscmodel_key(), SingletonModel::ModelChangedCaller( m_model ) );
|
||||||
m_keyObservers.insert( "origin", OriginKey::OriginChangedCaller( m_originKey ) );
|
m_keyObservers.insert( "origin", OriginKey::OriginChangedCaller( m_originKey ) );
|
||||||
m_keyObservers.insert( "angle", AnglesKey::AngleChangedCaller( m_anglesKey ) );
|
m_keyObservers.insert( "angle", AnglesKey::AngleChangedCaller( m_anglesKey ) );
|
||||||
m_keyObservers.insert( "angles", AnglesKey::AnglesChangedCaller( m_anglesKey ) );
|
m_keyObservers.insert( "angles", AnglesKey::AnglesChangedCaller( m_anglesKey ) );
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,10 @@ AttributeImporter( StringOutputStream& comment, EntityClass* entityClass, const
|
||||||
ASSERT_MESSAGE( string_empty( entityClass->flagnames[bit] ), "non-unique flag bit" );
|
ASSERT_MESSAGE( string_empty( entityClass->flagnames[bit] ), "non-unique flag bit" );
|
||||||
strcpy( entityClass->flagnames[bit], key );
|
strcpy( entityClass->flagnames[bit], key );
|
||||||
}
|
}
|
||||||
|
else if( entityClass->fixedsize && string_equal( type, "model" ) ){
|
||||||
|
entityClass->miscmodel_is = true;
|
||||||
|
entityClass->m_miscmodel_key = key;
|
||||||
|
}
|
||||||
|
|
||||||
m_comment << key;
|
m_comment << key;
|
||||||
m_comment << " : ";
|
m_comment << " : ";
|
||||||
|
|
|
||||||
|
|
@ -369,9 +369,8 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
|
||||||
|
|
||||||
EntityClass* entityClass = GlobalEntityClassManager().findOrInsert( name, true );
|
EntityClass* entityClass = GlobalEntityClassManager().findOrInsert( name, true );
|
||||||
|
|
||||||
bool isModel = ( string_compare_nocase_n( name, "misc_", 5 ) == 0 && string_equal_nocase( name + string_length( name ) - 5, "model" ) ) // misc_*model (also misc_model)
|
const bool isModel = EntityClass_miscmodel_is( entityClass )
|
||||||
|| string_equal_nocase( name, "model_static" )
|
|| ( GlobalSelectionSystem().countSelected() == 0 && classname_equal( name, "func_static" ) && g_pGameDescription->mGameType == "doom3" );
|
||||||
|| ( GlobalSelectionSystem().countSelected() == 0 && string_equal_nocase( name, "func_static" ) && g_pGameDescription->mGameType == "doom3" );
|
|
||||||
|
|
||||||
bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
|
bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
|
||||||
|
|
||||||
|
|
@ -465,7 +464,7 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
|
||||||
if ( isModel ) {
|
if ( isModel ) {
|
||||||
const char* model = misc_model_dialog( GTK_WIDGET( MainFrame_getWindow() ) );
|
const char* model = misc_model_dialog( GTK_WIDGET( MainFrame_getWindow() ) );
|
||||||
if ( model != 0 ) {
|
if ( model != 0 ) {
|
||||||
Node_getEntity( node )->setKeyValue( "model", model );
|
Node_getEntity( node )->setKeyValue( entityClass->miscmodel_key() , model );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user