From 401dc19c395441a3589f6f4c712baba7c1a36c34 Mon Sep 17 00:00:00 2001 From: Ensiform Date: Tue, 29 Sep 2015 16:55:01 -0500 Subject: [PATCH] Jedi Academy misc_model_static support for radiant. This patch adds misc_model_static model rendering for radiant and tidies up the string check code for model classnames in a couple of places. --- radiant/eclass_def.cpp | 4 +++- radiant/filters.cpp | 2 ++ radiant/xywindow.cpp | 24 +++++++++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/radiant/eclass_def.cpp b/radiant/eclass_def.cpp index 7db391c5..b46c9b85 100644 --- a/radiant/eclass_def.cpp +++ b/radiant/eclass_def.cpp @@ -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 ){ char *t; int len; @@ -253,7 +255,7 @@ eclass_t *Eclass_InitFromText( char *text ){ if ( strcmpi( e->name, "path" ) == 0 ) { e->nShowFlags |= ECLASS_PATH; } - if ( strcmpi( e->name, "misc_model" ) == 0 ) { + if ( IsModelEntity( e->name ) == qtrue ) { e->nShowFlags |= ECLASS_MISCMODEL; } diff --git a/radiant/filters.cpp b/radiant/filters.cpp index 1b909db8..7a59b0e4 100644 --- a/radiant/filters.cpp +++ b/radiant/filters.cpp @@ -141,6 +141,8 @@ bfilter_t *FilterAddBase( bfilter_t *pFilter ){ 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_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_PATH,NULL,EXCLUDE_PATHS,true ); pFilter = FilterAddImpl( pFilter,1,0,"lightgrid",EXCLUDE_LIGHTGRID,true ); diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index c8734cc0..5a9616ab 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -356,6 +356,28 @@ void DrawPathLines( void ){ 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 ){ entity_t *e; brush_t* b; @@ -431,7 +453,7 @@ void CreateEntityFromName( const char* name, const vec3_t origin ){ } 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 ); AssignModel(); }