Merge pull request #313 from ensiform/misc_model_static_fix

Jedi Academy misc_model_static support for radiant.
This commit is contained in:
Timothee "TTimo" Besset 2015-10-03 11:50:10 -05:00
commit 6ab189f0b1
3 changed files with 28 additions and 2 deletions

View file

@ -121,6 +121,8 @@ void setSpecialLoad( eclass_t *e, const char* pWhat, char*& p ){
} }
} }
qboolean IsModelEntity( const char *name );
eclass_t *Eclass_InitFromText( char *text ){ eclass_t *Eclass_InitFromText( char *text ){
char *t; char *t;
int len; int len;
@ -253,7 +255,7 @@ eclass_t *Eclass_InitFromText( char *text ){
if ( strcmpi( e->name, "path" ) == 0 ) { if ( strcmpi( e->name, "path" ) == 0 ) {
e->nShowFlags |= ECLASS_PATH; e->nShowFlags |= ECLASS_PATH;
} }
if ( strcmpi( e->name, "misc_model" ) == 0 ) { if ( IsModelEntity( e->name ) == qtrue ) {
e->nShowFlags |= ECLASS_MISCMODEL; e->nShowFlags |= ECLASS_MISCMODEL;
} }

View file

@ -141,6 +141,8 @@ bfilter_t *FilterAddBase( bfilter_t *pFilter ){
pFilter = FilterAddImpl( pFilter,3,0,"trigger",EXCLUDE_TRIGGERS,true ); pFilter = FilterAddImpl( pFilter,3,0,"trigger",EXCLUDE_TRIGGERS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_model",EXCLUDE_MODELS,true ); pFilter = FilterAddImpl( pFilter,3,0,"misc_model",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_gamemodel",EXCLUDE_MODELS,true ); pFilter = FilterAddImpl( pFilter,3,0,"misc_gamemodel",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_model_static",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"model_static",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,4,ECLASS_LIGHT,NULL,EXCLUDE_LIGHTS,true ); pFilter = FilterAddImpl( pFilter,4,ECLASS_LIGHT,NULL,EXCLUDE_LIGHTS,true );
pFilter = FilterAddImpl( pFilter,4,ECLASS_PATH,NULL,EXCLUDE_PATHS,true ); pFilter = FilterAddImpl( pFilter,4,ECLASS_PATH,NULL,EXCLUDE_PATHS,true );
pFilter = FilterAddImpl( pFilter,1,0,"lightgrid",EXCLUDE_LIGHTGRID,true ); pFilter = FilterAddImpl( pFilter,1,0,"lightgrid",EXCLUDE_LIGHTGRID,true );

View file

@ -356,6 +356,28 @@ void DrawPathLines( void ){
extern void AssignModel(); extern void AssignModel();
static const char *model_classnames[] =
{
"misc_model",
"misc_model_static",
"misc_gamemodel",
"model_static",
};
static const size_t model_classnames_count = sizeof( model_classnames ) / sizeof( *model_classnames );
qboolean IsModelEntity( const char *name )
{
for ( size_t i = 0; i < model_classnames_count; i++ )
{
if ( stricmp( name, model_classnames[i] ) == 0 )
{
return qtrue;
}
}
return qfalse;
}
void CreateEntityFromName( const char* name, const vec3_t origin ){ void CreateEntityFromName( const char* name, const vec3_t origin ){
entity_t *e; entity_t *e;
brush_t* b; brush_t* b;
@ -431,7 +453,7 @@ void CreateEntityFromName( const char* name, const vec3_t origin ){
} }
Select_Brush( e->brushes.onext ); Select_Brush( e->brushes.onext );
if ( ( stricmp( name, "misc_model" ) == 0 ) || ( stricmp( name, "misc_gamemodel" ) == 0 ) || ( strcmpi( name, "model_static" ) == 0 ) ) { if ( IsModelEntity( name ) == qtrue ) {
SetInspectorMode( W_ENTITY ); SetInspectorMode( W_ENTITY );
AssignModel(); AssignModel();
} }