2008-07-25 07:31:37 +00:00
|
|
|
/* -------------------------------------------------------------------------------
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
|
|
|
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
This file is part of GtkRadiant.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GtkRadiant; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
----------------------------------------------------------------------------------
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
This code has been altered significantly from its original form, to support
|
|
|
|
several games based on the Quake III Arena engine, in the form of "Q3Map2."
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
------------------------------------------------------------------------------- */
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* marker */
|
|
|
|
#define SURFACE_EXTRA_C
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* dependencies */
|
|
|
|
#include "q3map2.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------------
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
ydnar: srf file module
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
------------------------------------------------------------------------------- */
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
typedef struct surfaceExtra_s
|
|
|
|
{
|
2012-03-17 20:01:54 +00:00
|
|
|
mapDrawSurface_t *mds;
|
|
|
|
shaderInfo_t *si;
|
|
|
|
int parentSurfaceNum;
|
|
|
|
int entityNum;
|
|
|
|
int castShadows, recvShadows;
|
|
|
|
int sampleSize;
|
|
|
|
float longestCurve;
|
|
|
|
vec3_t lightmapAxis;
|
2007-11-04 03:34:51 +00:00
|
|
|
}
|
|
|
|
surfaceExtra_t;
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
#define GROW_SURFACE_EXTRAS 1024
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int numSurfaceExtras = 0;
|
|
|
|
int maxSurfaceExtras = 0;
|
|
|
|
surfaceExtra_t *surfaceExtras;
|
|
|
|
surfaceExtra_t seDefault = { NULL, NULL, -1, 0, WORLDSPAWN_CAST_SHADOWS, WORLDSPAWN_RECV_SHADOWS, 0, 0, { 0, 0, 0 } };
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
AllocSurfaceExtra()
|
|
|
|
allocates a new extra storage
|
|
|
|
*/
|
|
|
|
|
|
|
|
static surfaceExtra_t *AllocSurfaceExtra( void ){
|
|
|
|
surfaceExtra_t *se;
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
/* enough space? */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( numSurfaceExtras >= maxSurfaceExtras ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
/* reallocate more room */
|
|
|
|
maxSurfaceExtras += GROW_SURFACE_EXTRAS;
|
|
|
|
se = safe_malloc( maxSurfaceExtras * sizeof( surfaceExtra_t ) );
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( surfaceExtras != NULL ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
memcpy( se, surfaceExtras, numSurfaceExtras * sizeof( surfaceExtra_t ) );
|
|
|
|
free( surfaceExtras );
|
|
|
|
}
|
|
|
|
surfaceExtras = se;
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* add another */
|
|
|
|
se = &surfaceExtras[ numSurfaceExtras ];
|
|
|
|
numSurfaceExtras++;
|
|
|
|
memcpy( se, &seDefault, sizeof( surfaceExtra_t ) );
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* return it */
|
|
|
|
return se;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
SetDefaultSampleSize()
|
|
|
|
sets the default lightmap sample size
|
|
|
|
*/
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void SetDefaultSampleSize( int sampleSize ){
|
2007-11-04 03:34:51 +00:00
|
|
|
seDefault.sampleSize = sampleSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
SetSurfaceExtra()
|
|
|
|
stores extra (q3map2) data for the specific numbered drawsurface
|
|
|
|
*/
|
|
|
|
|
|
|
|
void SetSurfaceExtra( mapDrawSurface_t *ds, int num ){
|
|
|
|
surfaceExtra_t *se;
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
/* dummy check */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( ds == NULL || num < 0 ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
return;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* get a new extra */
|
|
|
|
se = AllocSurfaceExtra();
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* copy out the relevant bits */
|
|
|
|
se->mds = ds;
|
|
|
|
se->si = ds->shaderInfo;
|
|
|
|
se->parentSurfaceNum = ds->parent != NULL ? ds->parent->outputNum : -1;
|
|
|
|
se->entityNum = ds->entityNum;
|
|
|
|
se->castShadows = ds->castShadows;
|
|
|
|
se->recvShadows = ds->recvShadows;
|
|
|
|
se->sampleSize = ds->sampleSize;
|
|
|
|
se->longestCurve = ds->longestCurve;
|
|
|
|
VectorCopy( ds->lightmapAxis, se->lightmapAxis );
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* debug code */
|
|
|
|
//% Sys_FPrintf( SYS_VRB, "SetSurfaceExtra(): entityNum = %d\n", ds->entityNum );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
GetSurfaceExtra*()
|
|
|
|
getter functions for extra surface data
|
|
|
|
*/
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
static surfaceExtra_t *GetSurfaceExtra( int num ){
|
|
|
|
if ( num < 0 || num >= numSurfaceExtras ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
return &seDefault;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
2007-11-04 03:34:51 +00:00
|
|
|
return &surfaceExtras[ num ];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
shaderInfo_t *GetSurfaceExtraShaderInfo( int num ){
|
|
|
|
surfaceExtra_t *se = GetSurfaceExtra( num );
|
2007-11-04 03:34:51 +00:00
|
|
|
return se->si;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int GetSurfaceExtraParentSurfaceNum( int num ){
|
|
|
|
surfaceExtra_t *se = GetSurfaceExtra( num );
|
2007-11-04 03:34:51 +00:00
|
|
|
return se->parentSurfaceNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int GetSurfaceExtraEntityNum( int num ){
|
|
|
|
surfaceExtra_t *se = GetSurfaceExtra( num );
|
2007-11-04 03:34:51 +00:00
|
|
|
return se->entityNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int GetSurfaceExtraCastShadows( int num ){
|
|
|
|
surfaceExtra_t *se = GetSurfaceExtra( num );
|
2007-11-04 03:34:51 +00:00
|
|
|
return se->castShadows;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int GetSurfaceExtraRecvShadows( int num ){
|
|
|
|
surfaceExtra_t *se = GetSurfaceExtra( num );
|
2007-11-04 03:34:51 +00:00
|
|
|
return se->recvShadows;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int GetSurfaceExtraSampleSize( int num ){
|
|
|
|
surfaceExtra_t *se = GetSurfaceExtra( num );
|
2007-11-04 03:34:51 +00:00
|
|
|
return se->sampleSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
float GetSurfaceExtraLongestCurve( int num ){
|
|
|
|
surfaceExtra_t *se = GetSurfaceExtra( num );
|
2007-11-04 03:34:51 +00:00
|
|
|
return se->longestCurve;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void GetSurfaceExtraLightmapAxis( int num, vec3_t lightmapAxis ){
|
|
|
|
surfaceExtra_t *se = GetSurfaceExtra( num );
|
2007-11-04 03:34:51 +00:00
|
|
|
VectorCopy( se->lightmapAxis, lightmapAxis );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
WriteSurfaceExtraFile()
|
|
|
|
writes out a surface info file (<map>.srf)
|
|
|
|
*/
|
|
|
|
|
|
|
|
void WriteSurfaceExtraFile( const char *path ){
|
|
|
|
char srfPath[ 1024 ];
|
|
|
|
FILE *sf;
|
|
|
|
surfaceExtra_t *se;
|
|
|
|
int i;
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
/* dummy check */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( path == NULL || path[ 0 ] == '\0' ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
return;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* note it */
|
|
|
|
Sys_Printf( "--- WriteSurfaceExtraFile ---\n" );
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* open the file */
|
|
|
|
strcpy( srfPath, path );
|
|
|
|
StripExtension( srfPath );
|
|
|
|
strcat( srfPath, ".srf" );
|
|
|
|
Sys_Printf( "Writing %s\n", srfPath );
|
|
|
|
sf = fopen( srfPath, "w" );
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( sf == NULL ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
Error( "Error opening %s for writing", srfPath );
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* lap through the extras list */
|
2012-03-17 20:01:54 +00:00
|
|
|
for ( i = -1; i < numSurfaceExtras; i++ )
|
2007-11-04 03:34:51 +00:00
|
|
|
{
|
|
|
|
/* get extra */
|
|
|
|
se = GetSurfaceExtra( i );
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* default or surface num? */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( i < 0 ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
fprintf( sf, "default" );
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
else{
|
2007-11-04 03:34:51 +00:00
|
|
|
fprintf( sf, "%d", i );
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* valid map drawsurf? */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( se->mds == NULL ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
fprintf( sf, "\n" );
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
2007-11-04 03:34:51 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fprintf( sf, " // %s V: %d I: %d %s\n",
|
2012-03-17 20:01:54 +00:00
|
|
|
surfaceTypes[ se->mds->type ],
|
|
|
|
se->mds->numVerts,
|
|
|
|
se->mds->numIndexes,
|
|
|
|
( se->mds->planar ? "planar" : "" ) );
|
2007-11-04 03:34:51 +00:00
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* open braces */
|
|
|
|
fprintf( sf, "{\n" );
|
2012-03-17 20:01:54 +00:00
|
|
|
|
|
|
|
/* shader */
|
|
|
|
if ( se->si != NULL ) {
|
|
|
|
fprintf( sf, "\tshader %s\n", se->si->shader );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* parent surface number */
|
|
|
|
if ( se->parentSurfaceNum != seDefault.parentSurfaceNum ) {
|
|
|
|
fprintf( sf, "\tparent %d\n", se->parentSurfaceNum );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* entity number */
|
|
|
|
if ( se->entityNum != seDefault.entityNum ) {
|
|
|
|
fprintf( sf, "\tentity %d\n", se->entityNum );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* cast shadows */
|
|
|
|
if ( se->castShadows != seDefault.castShadows || se == &seDefault ) {
|
|
|
|
fprintf( sf, "\tcastShadows %d\n", se->castShadows );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* recv shadows */
|
|
|
|
if ( se->recvShadows != seDefault.recvShadows || se == &seDefault ) {
|
|
|
|
fprintf( sf, "\treceiveShadows %d\n", se->recvShadows );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* lightmap sample size */
|
|
|
|
if ( se->sampleSize != seDefault.sampleSize || se == &seDefault ) {
|
|
|
|
fprintf( sf, "\tsampleSize %d\n", se->sampleSize );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* longest curve */
|
|
|
|
if ( se->longestCurve != seDefault.longestCurve || se == &seDefault ) {
|
|
|
|
fprintf( sf, "\tlongestCurve %f\n", se->longestCurve );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* lightmap axis vector */
|
|
|
|
if ( VectorCompare( se->lightmapAxis, seDefault.lightmapAxis ) == qfalse ) {
|
|
|
|
fprintf( sf, "\tlightmapAxis ( %f %f %f )\n", se->lightmapAxis[ 0 ], se->lightmapAxis[ 1 ], se->lightmapAxis[ 2 ] );
|
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* close braces */
|
|
|
|
fprintf( sf, "}\n\n" );
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* close the file */
|
|
|
|
fclose( sf );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
LoadSurfaceExtraFile()
|
|
|
|
reads a surface info file (<map>.srf)
|
|
|
|
*/
|
|
|
|
|
|
|
|
void LoadSurfaceExtraFile( const char *path ){
|
|
|
|
char srfPath[ 1024 ];
|
|
|
|
surfaceExtra_t *se;
|
|
|
|
int surfaceNum, size;
|
|
|
|
byte *buffer;
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
/* dummy check */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( path == NULL || path[ 0 ] == '\0' ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
return;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* load the file */
|
|
|
|
strcpy( srfPath, path );
|
|
|
|
StripExtension( srfPath );
|
|
|
|
strcat( srfPath, ".srf" );
|
|
|
|
Sys_Printf( "Loading %s\n", srfPath );
|
|
|
|
size = LoadFile( srfPath, (void**) &buffer );
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( size <= 0 ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
Sys_Printf( "WARNING: Unable to find surface file %s, using defaults.\n", srfPath );
|
|
|
|
return;
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* parse the file */
|
|
|
|
ParseFromMemory( buffer, size );
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* tokenize it */
|
2012-03-17 20:01:54 +00:00
|
|
|
while ( 1 )
|
2007-11-04 03:34:51 +00:00
|
|
|
{
|
|
|
|
/* test for end of file */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !GetToken( qtrue ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
break;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* default? */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !Q_stricmp( token, "default" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
se = &seDefault;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
/* surface number */
|
|
|
|
else
|
|
|
|
{
|
|
|
|
surfaceNum = atoi( token );
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( surfaceNum < 0 || surfaceNum > MAX_MAP_DRAW_SURFS ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
Error( "ReadSurfaceExtraFile(): %s, line %d: bogus surface num %d", srfPath, scriptline, surfaceNum );
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
while ( surfaceNum >= numSurfaceExtras )
|
2007-11-04 03:34:51 +00:00
|
|
|
se = AllocSurfaceExtra();
|
|
|
|
se = &surfaceExtras[ surfaceNum ];
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* handle { } section */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !GetToken( qtrue ) || strcmp( token, "{" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
Error( "ReadSurfaceExtraFile(): %s, line %d: { not found", srfPath, scriptline );
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
while ( 1 )
|
2007-11-04 03:34:51 +00:00
|
|
|
{
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !GetToken( qtrue ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
break;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
if ( !strcmp( token, "}" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
break;
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* shader */
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( !Q_stricmp( token, "shader" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
GetToken( qfalse );
|
|
|
|
se->si = ShaderInfoForShader( token );
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* parent surface number */
|
2012-03-17 20:01:54 +00:00
|
|
|
else if ( !Q_stricmp( token, "parent" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
GetToken( qfalse );
|
|
|
|
se->parentSurfaceNum = atoi( token );
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* entity number */
|
2012-03-17 20:01:54 +00:00
|
|
|
else if ( !Q_stricmp( token, "entity" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
GetToken( qfalse );
|
|
|
|
se->entityNum = atoi( token );
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* cast shadows */
|
2012-03-17 20:01:54 +00:00
|
|
|
else if ( !Q_stricmp( token, "castShadows" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
GetToken( qfalse );
|
|
|
|
se->castShadows = atoi( token );
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* recv shadows */
|
2012-03-17 20:01:54 +00:00
|
|
|
else if ( !Q_stricmp( token, "receiveShadows" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
GetToken( qfalse );
|
|
|
|
se->recvShadows = atoi( token );
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* lightmap sample size */
|
2012-03-17 20:01:54 +00:00
|
|
|
else if ( !Q_stricmp( token, "sampleSize" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
GetToken( qfalse );
|
|
|
|
se->sampleSize = atoi( token );
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* longest curve */
|
2012-03-17 20:01:54 +00:00
|
|
|
else if ( !Q_stricmp( token, "longestCurve" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
GetToken( qfalse );
|
|
|
|
se->longestCurve = atof( token );
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* lightmap axis vector */
|
2012-03-17 20:01:54 +00:00
|
|
|
else if ( !Q_stricmp( token, "lightmapAxis" ) ) {
|
2007-11-04 03:34:51 +00:00
|
|
|
Parse1DMatrix( 3, se->lightmapAxis );
|
2012-03-17 20:01:54 +00:00
|
|
|
}
|
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* ignore all other tokens on the line */
|
2012-03-17 20:01:54 +00:00
|
|
|
while ( TokenAvailable() )
|
2007-11-04 03:34:51 +00:00
|
|
|
GetToken( qfalse );
|
|
|
|
}
|
|
|
|
}
|
2012-03-17 20:01:54 +00:00
|
|
|
|
2007-11-04 03:34:51 +00:00
|
|
|
/* free the buffer */
|
|
|
|
free( buffer );
|
|
|
|
}
|