From: divverent Date: Sun, 29 Mar 2009 17:17:08 +0000 (+0000) Subject: VorteX: KeyExists function, cast shadows from func_wall by default in prophecy and dq X-Git-Tag: svn-r421~184 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7e4c830250628ef34f14582c969fbfb6369858af;p=xonotic%2Fnetradiant.git VorteX: KeyExists function, cast shadows from func_wall by default in prophecy and dq git-svn-id: svn://svn.icculus.org/netradiant/trunk@236 61c419a2-8eb2-4b30-bcec-8cead039b335 --- diff --git a/tools/quake3/q3map2/bspfile_abstract.c b/tools/quake3/q3map2/bspfile_abstract.c index ef43a2ac..cf059ca0 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -744,7 +744,25 @@ void SetKeyValue( entity_t *ent, const char *key, const char *value ) ep->value = copystring( value ); } +/* +KeyExists() +returns true if entity has this key +*/ + +qboolean KeyExists( const entity_t *ent, const char *key ) +{ + epair_t *ep; + + /* walk epair list */ + for( ep = ent->epairs; ep != NULL; ep = ep->next ) + { + if( !EPAIR_STRCMP( ep->key, key ) ) + return qtrue; + } + /* no match */ + return qfalse; +} /* ValueForKey() @@ -864,7 +882,6 @@ void GetEntityShadowFlags( const entity_t *ent, const entity_t *ent2, int *castS { const char *value; - /* get cast shadows */ if( castShadows != NULL ) { @@ -892,5 +909,19 @@ void GetEntityShadowFlags( const entity_t *ent, const entity_t *ent2, int *castS if( value[ 0 ] != '\0' ) *recvShadows = atoi( value ); } + + /* vortex: game-specific default eneity keys */ + value = ValueForKey( ent, "classname" ); + if (!Q_stricmp( game->magic, "dq" ) || !Q_stricmp( game->magic, "prophecy" ) ) + { + /* vortex: deluxe quake default shadow flags */ + if (!Q_stricmp( value, "func_wall" ) ) + { + if( recvShadows != NULL ) + *recvShadows = 1; + if( castShadows != NULL ) + *castShadows = 1; + } + } } diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index f0cf4899..ddc5b0a9 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1802,6 +1802,7 @@ void ParseEntities( void ); void UnparseEntities( void ); void PrintEntity( const entity_t *ent ); void SetKeyValue( entity_t *ent, const char *key, const char *value ); +qboolean KeyExists( const entity_t *ent, const char *key ); /* VorteX: check if key exists */ const char *ValueForKey( const entity_t *ent, const char *key ); int IntForKey( const entity_t *ent, const char *key ); vec_t FloatForKey( const entity_t *ent, const char *key ); diff --git a/tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch b/tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch index 4e5dcf3b..bcf9d93b 100644 --- a/tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch +++ b/tools/quake3/q3map2/q3map2_fsr_newfiles/q3map2_fsr_svn158.patch @@ -1,62 +1,3 @@ -Index: bspfile_abstract.c -=================================================================== ---- bspfile_abstract.c (revision 158) -+++ bspfile_abstract.c (working copy) -@@ -683,8 +683,26 @@ - ep->value = copystring( value ); - } - -+/* -+KeyExists() -+returns true if entity has this key -+*/ - -+qboolean KeyExists( const entity_t *ent, const char *key ) -+{ -+ epair_t *ep; -+ -+ /* walk epair list */ -+ for( ep = ent->epairs; ep != NULL; ep = ep->next ) -+ { -+ if( !EPAIR_STRCMP( ep->key, key ) ) -+ return qtrue; -+ } - -+ /* no match */ -+ return qfalse; -+} -+ - /* - ValueForKey() - gets the value for an entity key -@@ -803,7 +821,6 @@ - { - const char *value; - -- - /* get cast shadows */ - if( castShadows != NULL ) - { -@@ -831,5 +848,19 @@ - if( value[ 0 ] != '\0' ) - *recvShadows = atoi( value ); - } -+ -+ /* vortex: game-specific default eneity keys */ -+ value = ValueForKey( ent, "classname" ); -+ if (!Q_stricmp( game->magic, "dq" ) || !Q_stricmp( game->magic, "prophecy" ) ) -+ { -+ /* vortex: deluxe quake default shadow flags */ -+ if (!Q_stricmp( value, "func_wall" ) ) -+ { -+ if( recvShadows != NULL ) -+ *recvShadows = 1; -+ if( castShadows != NULL ) -+ *castShadows = 1; -+ } -+ } - } - Index: game_ef.h =================================================================== --- game_ef.h (revision 158) @@ -2869,14 +2810,6 @@ Index: q3map2.h /* image.c */ void ImageFree( image_t *image ); image_t *ImageFind( const char *filename ); -@@ -1783,6 +1816,7 @@ - void UnparseEntities( void ); - void PrintEntity( const entity_t *ent ); - void SetKeyValue( entity_t *ent, const char *key, const char *value ); -+qboolean KeyExists( const entity_t *ent, const char *key ); /* VorteX: check if key exists */ - const char *ValueForKey( const entity_t *ent, const char *key ); - int IntForKey( const entity_t *ent, const char *key ); - vec_t FloatForKey( const entity_t *ent, const char *key ); @@ -1845,6 +1879,12 @@ , #include "game_qfusion.h" /* qfusion game */