int CopyLump_Allocate( bspHeader_t *header, int lump, void **dest, int size, int *allocationVariable )
{
- int length, offset;
-
/* get lump length and offset */
*allocationVariable = header->lumps[ lump ].length / size;
*dest = realloc(*dest, size * *allocationVariable);
/* setup */
+ AUTOEXPAND_BY_REALLOC(bspEntData, 0, allocatedBSPEntData, 1024);
buf = bspEntData;
end = buf;
*end = 0;
+
/* run through entity list */
for( i = 0; i < numBSPEntities && i < numEntities; i++ )
{
+ {
+ int sz = end - buf;
+ AUTOEXPAND_BY_REALLOC(bspEntData, sz + 65536, allocatedBSPEntData, 1024);
+ buf = bspEntData;
+ end = buf + sz;
+ }
+
/* get epair */
ep = entities[ i ].epairs;
if( ep == NULL )
end += 2;
/* check for overflow */
- if( end > buf + MAX_MAP_ENTSTRING )
+ if( end > buf + allocatedBSPEntData )
Error( "Entity text too long" );
}
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()
{
const char *value;
-
/* get cast shadows */
if( castShadows != NULL )
{
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;
+ }
+ }
}