19 Aug 2009
This commit is contained in:
parent
65fc6c3631
commit
2afdf3ab8c
|
@ -72,5 +72,5 @@ if exist xtools\xtools.plg del /f /q xtools\xtools.plg
|
|||
echo Build succeeded!
|
||||
echo Please wait. Xash is now loading
|
||||
cd D:\Xash3D\
|
||||
quake3.exe -log -dev 3 +map wamphi1
|
||||
xash.exe -log -dev 3 +map wamphi1
|
||||
:done
|
|
@ -112,9 +112,9 @@ extern host_parm_t host;
|
|||
// host.c
|
||||
//
|
||||
|
||||
void Host_Init ( int argc, char **argv );
|
||||
void Host_Main ( void );
|
||||
void Host_Free ( void );
|
||||
void Host_Init( const int argc, const char **argv );
|
||||
void Host_Main( void );
|
||||
void Host_Free( void );
|
||||
void Host_SetServerState( int state );
|
||||
int Host_ServerState( void );
|
||||
int Host_MaxClients( void );
|
||||
|
|
|
@ -109,7 +109,7 @@ void Host_FreeRender( void )
|
|||
Sys_FreeLibrary( &render_dll );
|
||||
}
|
||||
|
||||
void Host_InitVprogs( int argc, char **argv )
|
||||
void Host_InitVprogs( const int argc, const char **argv )
|
||||
{
|
||||
launch_t CreateVprogs;
|
||||
|
||||
|
@ -458,7 +458,7 @@ static void Host_Crash_f (void)
|
|||
*(int *)0 = 0xffffffff;
|
||||
}
|
||||
|
||||
void Host_InitCommon( int argc, char **argv )
|
||||
void Host_InitCommon( const int argc, const char **argv )
|
||||
{
|
||||
char dev_level[4];
|
||||
|
||||
|
@ -489,7 +489,7 @@ void Host_FreeCommon( void )
|
|||
Host_Init
|
||||
=================
|
||||
*/
|
||||
void Host_Init( int argc, char **argv )
|
||||
void Host_Init( const int argc, const char **argv )
|
||||
{
|
||||
char *s;
|
||||
|
||||
|
|
|
@ -1487,7 +1487,7 @@ void FS_Init( void )
|
|||
Cmd_AddCommand( "fs_path", FS_Path_f, "show filesystem search pathes" );
|
||||
Cmd_AddCommand( "fs_clearpaths", FS_ClearPaths_f, "clear filesystem search pathes" );
|
||||
fs_wadsupport = Cvar_Get( "fs_wadsupport", "0", CVAR_SYSTEMINFO, "enable wad-archive support" );
|
||||
fs_defaultdir = Cvar_Get( "fs_defaultdir", "tmpQuArK", CVAR_SYSTEMINFO, "engine default directory" );
|
||||
fs_defaultdir = Cvar_Get( "fs_defaultdir", "tmpQuArK", CVAR_SYSTEMINFO, "user-game default directory" );
|
||||
|
||||
Cbuf_ExecuteText( EXEC_NOW, "systemcfg\n" );
|
||||
Cbuf_Execute(); // apply system cvars immediately
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: launch - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BB6.tmp" with contents
|
||||
[
|
||||
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "imagelib" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\launch\!debug/" /Fo"..\temp\launch\!debug/" /Fd"..\temp\launch\!debug/" /FD /GZ /c
|
||||
"D:\Xash3D\src_main\launch\system.c"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BB6.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BB7.tmp" with contents
|
||||
[
|
||||
zlib.lib png.lib jpg.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /dll /incremental:yes /pdb:"..\temp\launch\!debug/launch.pdb" /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\launch\!debug/launch.dll" /implib:"..\temp\launch\!debug/launch.lib" /pdbtype:sept /libpath:"./imagelib"
|
||||
"\Xash3D\src_main\temp\launch\!debug\cmd.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\console.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\cpuinfo.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\crclib.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\cvar.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\export.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\filesystem.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_bmp.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_dds.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_jpg.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_main.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_pcx.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_png.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_tga.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_utils.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_vtf.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\img_wad.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\memlib.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\network.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\parselib.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\patch.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\stdlib.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\system.obj"
|
||||
"\Xash3D\src_main\temp\launch\!debug\utils.obj"
|
||||
]
|
||||
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BB7.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BB8.bat" with contents
|
||||
[
|
||||
@echo off
|
||||
copy \Xash3D\src_main\temp\launch\!debug\launch.dll "D:\Xash3D\bin\launch.dll"
|
||||
]
|
||||
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BB8.bat"
|
||||
Compiling...
|
||||
system.c
|
||||
Linking...
|
||||
<h3>Output Window</h3>
|
||||
Performing Custom Build Step on \Xash3D\src_main\temp\launch\!debug\launch.dll
|
||||
‘Ş®Ż¨ŕ®˘ ® ä ©«®˘: 1.
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
launch.dll - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -345,6 +345,9 @@ void Sys_LookupInstance( void )
|
|||
Sys.linked_dll = &xtools_dll; // pointer to common.dll info
|
||||
com_strcpy(Sys.log_path, "bsplib.log" ); // xash3d root directory
|
||||
com_strcpy(Sys.caption, "Xash3D BSP Compiler");
|
||||
|
||||
// TEMPORARY HACK FOR DEBUG NEW BSPLIB
|
||||
Sys.developer = 3;
|
||||
}
|
||||
else if(!com_strcmp(Sys.progname, "qcclib"))
|
||||
{
|
||||
|
|
|
@ -183,7 +183,7 @@ Returns SIDE_FRONT, SIDE_BACK, or SIDE_ON
|
|||
*/
|
||||
_inline int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const cplane_t *p )
|
||||
{
|
||||
if (p->type < 3) return ((emaxs[p->type] >= p->dist) | ((emins[p->type] < p->dist) << 1));
|
||||
if( p->type < 3 ) return ((emaxs[p->type] >= p->dist) | ((emins[p->type] < p->dist) << 1));
|
||||
switch( p->signbits )
|
||||
{
|
||||
default:
|
||||
|
@ -209,7 +209,7 @@ typedef struct launch_exp_s
|
|||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(launch_api_t)
|
||||
|
||||
void ( *Init ) ( int argc, char **argv ); // init host
|
||||
void ( *Init ) ( const int argc, const char **argv ); // init host
|
||||
void ( *Main ) ( void ); // host frame
|
||||
void ( *Free ) ( void ); // close host
|
||||
void (*CPrint) ( const char *msg ); // host print
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
#define VectorLerp( v1, lerp, v2, c ) ((c)[0] = (v1)[0] + (lerp) * ((v2)[0] - (v1)[0]), (c)[1] = (v1)[1] + (lerp) * ((v2)[1] - (v1)[1]), (c)[2] = (v1)[2] + (lerp) * ((v2)[2] - (v1)[2]))
|
||||
#define VectorNormalize( v ) { float ilength = (float)sqrt(DotProduct(v, v));if (ilength) ilength = 1.0f / ilength;v[0] *= ilength;v[1] *= ilength;v[2] *= ilength; }
|
||||
#define VectorNormalize2( v, dest ) {float ilength = (float) sqrt(DotProduct(v,v));if (ilength) ilength = 1.0f / ilength;dest[0] = v[0] * ilength;dest[1] = v[1] * ilength;dest[2] = v[2] * ilength; }
|
||||
#define VectorNormalizeDouble( v ) {double ilength = sqrt(DotProduct(v,v));if (ilength) ilength = 1.0 / ilength;v[0] *= ilength;v[1] *= ilength;v[2] *= ilength; }
|
||||
#define VectorNormalizeFast( v ) {float ilength = (float)rsqrt(DotProduct(v,v)); v[0] *= ilength; v[1] *= ilength; v[2] *= ilength; }
|
||||
#define VectorNegate(x, y) {y[0] =-x[0]; y[1]=-x[1]; y[2]=-x[2];}
|
||||
#define VectorM(scale1, b1, c) ((c)[0] = (scale1) * (b1)[0],(c)[1] = (scale1) * (b1)[1],(c)[2] = (scale1) * (b1)[2])
|
||||
|
@ -194,7 +193,7 @@ _inline float VectorNormalizeLength2( const vec3_t v, vec3_t out )
|
|||
float length, ilength;
|
||||
|
||||
length = v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
|
||||
length = rsqrt( length );
|
||||
length = sqrt( length );
|
||||
|
||||
if( length )
|
||||
{
|
||||
|
|
|
@ -167,8 +167,8 @@ typedef struct vprogs_exp_s
|
|||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(vprogs_api_t)
|
||||
|
||||
void ( *Init ) ( int argc, char **argv ); // init host
|
||||
void ( *Free ) ( void ); // close host
|
||||
void ( *Init )( const int argc, const char **argv );
|
||||
void ( *Free )( void );
|
||||
|
||||
// compiler functions
|
||||
void ( *PrepareDAT )( const char *dir, const char *name );
|
||||
|
|
|
@ -217,18 +217,18 @@ void PR_InitCompile( const char *name )
|
|||
}
|
||||
}
|
||||
|
||||
void PRVM_Init( int argc, char **argv )
|
||||
void PRVM_Init( const int argc, const char **argv )
|
||||
{
|
||||
char dev_level[4];
|
||||
|
||||
com_argc = argc;
|
||||
com_argv = argv;
|
||||
com_argv = (char **)argv;
|
||||
|
||||
qccpool = Mem_AllocPool( "VM progs" );
|
||||
host_instance = g_Instance;
|
||||
|
||||
if(FS_GetParmFromCmdLine("-dev", dev_level ))
|
||||
prvm_developer = com.atoi(dev_level);
|
||||
if( FS_GetParmFromCmdLine( "-dev", dev_level ))
|
||||
prvm_developer = com.atoi( dev_level );
|
||||
|
||||
Cmd_AddCommand("prvm_edict", PRVM_ED_PrintEdict_f, "print all data about an entity number in the selected VM (server, client, uimenu)");
|
||||
Cmd_AddCommand("prvm_edicts", PRVM_ED_PrintEdicts_f, "set a property on an entity number in the selected VM (server, client, uimenu)");
|
||||
|
|
|
@ -622,8 +622,8 @@ handles creation of a bsp from a map file
|
|||
|
||||
int BSPMain( int argc, char **argv )
|
||||
{
|
||||
int i;
|
||||
char path[ 1024 ], tempSource[ 1024 ];
|
||||
int i;
|
||||
char path[ 1024 ];
|
||||
bool onlyents = false;
|
||||
|
||||
|
||||
|
@ -634,8 +634,6 @@ int BSPMain( int argc, char **argv )
|
|||
mapDrawSurfs = Malloc( sizeof( mapDrawSurface_t ) * MAX_MAP_DRAW_SURFS );
|
||||
numMapDrawSurfs = 0;
|
||||
|
||||
tempSource[ 0 ] = '\0';
|
||||
|
||||
/* set standard game flags */
|
||||
maxSurfaceVerts = game->maxSurfaceVerts;
|
||||
maxSurfaceIndexes = game->maxSurfaceIndexes;
|
||||
|
@ -649,10 +647,6 @@ int BSPMain( int argc, char **argv )
|
|||
MsgDev( D_INFO, "Running entity-only compile\n" );
|
||||
onlyents = true;
|
||||
}
|
||||
else if( !strcmp( argv[ i ], "-tempname" ) )
|
||||
strcpy( tempSource, argv[ ++i ] );
|
||||
else if( !strcmp( argv[ i ], "-tmpout" ) )
|
||||
strcpy( outbase, "/tmp" );
|
||||
else if( !strcmp( argv[ i ], "-nowater" ) )
|
||||
{
|
||||
MsgDev( D_INFO, "Disabling water\n" );
|
||||
|
@ -837,7 +831,7 @@ int BSPMain( int argc, char **argv )
|
|||
Sys_Break( "usage: q3map [options] mapfile" );
|
||||
|
||||
/* copy source name */
|
||||
strcpy( source, argv[i] );
|
||||
strcpy( source, gs_filename );
|
||||
FS_StripExtension( source );
|
||||
|
||||
/* ydnar: set default sample size */
|
||||
|
@ -845,23 +839,12 @@ int BSPMain( int argc, char **argv )
|
|||
|
||||
/* delete portal, line and surface files */
|
||||
com.sprintf( path, "%s.prt", source );
|
||||
remove( path );
|
||||
FS_Delete( path );
|
||||
com.sprintf( path, "%s.lin", source );
|
||||
remove( path );
|
||||
//% com.sprintf( path, "%s.srf", source ); /* ydnar */
|
||||
//% remove( path );
|
||||
|
||||
/* expand mapname */
|
||||
strcpy( name, argv[i] );
|
||||
if( strcmp( name + strlen( name ) - 4, ".reg" ) )
|
||||
{
|
||||
/* if we are doing a full map, delete the last saved region map */
|
||||
com.sprintf( path, "%s.reg", source );
|
||||
remove( path );
|
||||
FS_DefaultExtension( name, ".map" ); /* might be .reg */
|
||||
}
|
||||
|
||||
/* if onlyents, just grab the entites and resave */
|
||||
FS_Delete( path );
|
||||
|
||||
com.snprintf( name, sizeof( name ), "maps/%s.map", gs_filename );
|
||||
|
||||
if( onlyents )
|
||||
{
|
||||
OnlyEnts();
|
||||
|
@ -872,10 +855,7 @@ int BSPMain( int argc, char **argv )
|
|||
LoadShaderInfo();
|
||||
|
||||
/* load original file from temp spot in case it was renamed by the editor on the way in */
|
||||
if( strlen( tempSource ) > 0 )
|
||||
LoadMapFile( tempSource, false );
|
||||
else
|
||||
LoadMapFile( name, false );
|
||||
LoadMapFile( name, false );
|
||||
|
||||
/* ydnar: decal setup */
|
||||
ProcessDecals();
|
||||
|
@ -895,11 +875,6 @@ int BSPMain( int argc, char **argv )
|
|||
/* finish and write bsp */
|
||||
EndBSPFile();
|
||||
|
||||
/* remove temp map source file if appropriate */
|
||||
if( strlen( tempSource ) > 0)
|
||||
remove( tempSource );
|
||||
|
||||
/* return to sender */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -339,26 +339,13 @@ writes a bsp file
|
|||
|
||||
void WriteBSPFile( const char *filename )
|
||||
{
|
||||
char tempname[ 1024 ];
|
||||
time_t tm;
|
||||
|
||||
|
||||
/* dummy check */
|
||||
if( game == NULL || game->write == NULL )
|
||||
Sys_Break( "WriteBSPFile: unsupported BSP file format" );
|
||||
|
||||
/* make fake temp name so existing bsp file isn't damaged in case write process fails */
|
||||
time( &tm );
|
||||
com.sprintf( tempname, "%s.%08X", filename, (int) tm );
|
||||
|
||||
/* byteswap, write the bsp, then swap back so it can be manipulated further */
|
||||
|
||||
// byteswap, write the bsp, then swap back so it can be manipulated further
|
||||
SwapBSPFile();
|
||||
game->write( tempname );
|
||||
game->write( filename );
|
||||
SwapBSPFile();
|
||||
|
||||
/* replace existing bsp file */
|
||||
FS_Delete( filename );
|
||||
rename( tempname, filename );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2."
|
|||
#include "q3map2.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
bool (*BspFunc)( int argc, char **argv );
|
||||
int com_argc;
|
||||
char **com_argv;
|
||||
|
||||
/*
|
||||
Random()
|
||||
|
@ -48,70 +51,42 @@ vec_t Random( void )
|
|||
return (vec_t) rand() / RAND_MAX;
|
||||
}
|
||||
|
||||
/*
|
||||
ExitQ3Map()
|
||||
cleanup routine
|
||||
*/
|
||||
void Bsp_PrintLog( const char *pMsg )
|
||||
{
|
||||
if( !enable_log ) return;
|
||||
if( !bsplog ) bsplog = FS_Open( va( "maps/%s.log", gs_filename ), "wb" );
|
||||
FS_Print( bsplog, pMsg );
|
||||
}
|
||||
|
||||
static void ExitQ3Map( void )
|
||||
/*
|
||||
GetGame() - ydnar
|
||||
gets the game_t based on a -game argument
|
||||
returns NULL if no match found
|
||||
*/
|
||||
game_t *GetGame( char *arg )
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if( arg == NULL || arg[ 0 ] == '\0' )
|
||||
return NULL;
|
||||
|
||||
while( games[i].arg != NULL )
|
||||
{
|
||||
if( !com.stricmp( arg, games[i].arg ))
|
||||
return &games[i];
|
||||
i++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void Bsp_Shutdown( void )
|
||||
{
|
||||
BSPFilesCleanup();
|
||||
if( mapDrawSurfs != NULL )
|
||||
Mem_Free( mapDrawSurfs );
|
||||
}
|
||||
|
||||
/*
|
||||
FixClipMap()
|
||||
resets an clipmap checksum to match the given BSP
|
||||
*/
|
||||
int FixClipMap( int argc, char **argv )
|
||||
{
|
||||
int length, checksum;
|
||||
void *buffer;
|
||||
file_t *file;
|
||||
char clipmap[MAX_SYSPATH];
|
||||
|
||||
/* arg checking */
|
||||
if( argc < 2 )
|
||||
{
|
||||
Msg( "Usage: q3map -fixaas [-v] <mapname>\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* do some path mangling */
|
||||
strcpy( source, argv[argc-1] );
|
||||
FS_StripExtension( source );
|
||||
FS_DefaultExtension( source, ".bsp" );
|
||||
|
||||
Msg( "--- FixClipMap ---\n" );
|
||||
|
||||
Msg( "Loading %s\n", source );
|
||||
buffer = FS_LoadFile( source, &length );
|
||||
if( !buffer ) Sys_Break( "can't load %s\n", source );
|
||||
|
||||
/* create bsp checksum */
|
||||
Msg( "Creating checksum...\n" );
|
||||
checksum = LittleLong( Com_BlockChecksum( buffer, length ));
|
||||
Mem_Free( buffer );
|
||||
|
||||
/* mangle name */
|
||||
FS_FileBase( source, source );
|
||||
com.sprintf( clipmap, "maps/clipmaps/%s.bin", source );
|
||||
|
||||
/* fix it */
|
||||
file = FS_Open( clipmap, "r+b" );
|
||||
if( !file ) return 1;
|
||||
|
||||
FS_Seek( file, 0, SEEK_SET );
|
||||
if( FS_Write( file, &checksum, sizeof( int )) != sizeof( int ))
|
||||
Sys_Break( "Error writing checksum to %s\n", clipmap );
|
||||
FS_Close( file );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
AnalyzeBSP() - ydnar
|
||||
analyzes a Quake engine BSP file
|
||||
|
@ -528,128 +503,66 @@ int ConvertBSPMain( int argc, char **argv )
|
|||
return convertFunc( source );
|
||||
}
|
||||
|
||||
void InitGameType( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
main()
|
||||
q3map mojo...
|
||||
*/
|
||||
|
||||
bool Q3MapMain( int argc, char **argv )
|
||||
bool PrepareBSPModel( int argc, char **argv )
|
||||
{
|
||||
int i, r;
|
||||
double start, end;
|
||||
|
||||
|
||||
/* we want consistent 'randomness' */
|
||||
srand( 0 );
|
||||
|
||||
/* start timer */
|
||||
start = Sys_DoubleTime();
|
||||
int i;
|
||||
|
||||
/* this was changed to emit version number over the network */
|
||||
srand( 0 );
|
||||
|
||||
com_argc = argc;
|
||||
com_argv = argv;
|
||||
|
||||
Msg( Q3MAP_VERSION "\n" );
|
||||
Msg( "%s\n", Q3MAP_MOTD );
|
||||
|
||||
// check for general parms
|
||||
if( FS_CheckParm( "-force" )) force = true;
|
||||
patch_subdivide = Cvar_Get( "bsp_patch_subdivide", "8", CVAR_SYSTEMINFO, "bsplib patch subdivisions" );
|
||||
Cvar_SetValue( "bsp_patch_subdivide", bound( 1, patch_subdivide->integer, 128 ));
|
||||
|
||||
/* set exit call */
|
||||
atexit( ExitQ3Map );
|
||||
|
||||
/* read general options first */
|
||||
for( i = 1; i < argc; i++ )
|
||||
{
|
||||
/* force */
|
||||
if( !strcmp( argv[ i ], "-force" ) )
|
||||
{
|
||||
force = true;
|
||||
argv[ i ] = NULL;
|
||||
}
|
||||
|
||||
/* patch subdivisions */
|
||||
else if( !strcmp( argv[ i ], "-subdivisions" ) )
|
||||
{
|
||||
argv[ i ] = NULL;
|
||||
i++;
|
||||
patchSubdivisions = atoi( argv[ i ] );
|
||||
argv[ i ] = NULL;
|
||||
if( patchSubdivisions <= 0 )
|
||||
patchSubdivisions = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* init model library */
|
||||
// init model library
|
||||
PicoInit();
|
||||
PicoSetMallocFunc( NULL );
|
||||
PicoSetFreeFunc( NULL );
|
||||
PicoSetMallocFunc( PicoMalloc );
|
||||
PicoSetFreeFunc( PicoFree );
|
||||
PicoSetPrintFunc( PicoPrintFunc );
|
||||
PicoSetLoadFileFunc( PicoLoadFileFunc );
|
||||
PicoSetFreeFileFunc( NULL );
|
||||
|
||||
/* generate sinusoid jitter table */
|
||||
PicoSetFreeFileFunc( PicoFree );
|
||||
|
||||
// generate sinusoidal jitter table
|
||||
for( i = 0; i < MAX_JITTERS; i++ )
|
||||
jitters[ i ] = sin( i * 139.54152147 );
|
||||
|
||||
/* we print out two versions, q3map's main version (since it evolves a bit out of GtkRadiant)
|
||||
and we put the GtkRadiant version to make it easy to track with what version of Radiant it was built with */
|
||||
Msg( "Q3Map - v1.0r (c) 1999 Id Software Inc.\n" );
|
||||
Msg( "Q3Map (ydnar) - v" Q3MAP_VERSION "\n" );
|
||||
Msg( "%s\n", Q3MAP_MOTD );
|
||||
|
||||
/* ydnar: new path initialization */
|
||||
InitPaths( &argc, argv );
|
||||
|
||||
/* check if we have enough options left to attempt something */
|
||||
if( argc < 2 ) Sys_Break( "Usage: %s [general options] [options] mapfile", argv[ 0 ] );
|
||||
|
||||
/* fixaas */
|
||||
if( !strcmp( argv[ 1 ], "-fixclip" ) )
|
||||
r = FixClipMap( argc - 1, argv + 1 );
|
||||
|
||||
/* analyze */
|
||||
else if( !strcmp( argv[ 1 ], "-analyze" ) )
|
||||
r = AnalyzeBSP( argc - 1, argv + 1 );
|
||||
|
||||
/* info */
|
||||
else if( !strcmp( argv[ 1 ], "-info" ) )
|
||||
r = BSPInfo( argc - 2, argv + 2 );
|
||||
|
||||
/* vis */
|
||||
else if( !strcmp( argv[ 1 ], "-vis" ) )
|
||||
r = VisMain( argc - 1, argv + 1 );
|
||||
|
||||
/* light */
|
||||
else if( !strcmp( argv[ 1 ], "-light" ) )
|
||||
r = LightMain( argc - 1, argv + 1 );
|
||||
|
||||
/* vlight */
|
||||
else if( !strcmp( argv[ 1 ], "-vlight" ) )
|
||||
{
|
||||
Msg( "WARNING: VLight is no longer supported, defaulting to -light -fast instead\n\n" );
|
||||
argv[ 1 ] = "-fast"; /* eek a hack */
|
||||
r = LightMain( argc, argv );
|
||||
}
|
||||
|
||||
/* ydnar: lightmap export */
|
||||
else if( !strcmp( argv[ 1 ], "-export" ) )
|
||||
r = ExportLightmapsMain( argc - 1, argv + 1 );
|
||||
|
||||
/* ydnar: lightmap import */
|
||||
else if( !strcmp( argv[ 1 ], "-import" ) )
|
||||
r = ImportLightmapsMain( argc - 1, argv + 1 );
|
||||
|
||||
/* ydnar: bsp scaling */
|
||||
else if( !strcmp( argv[ 1 ], "-scale" ) )
|
||||
r = ScaleBSPMain( argc - 1, argv + 1 );
|
||||
|
||||
/* ydnar: bsp conversion */
|
||||
else if( !strcmp( argv[ 1 ], "-convert" ) )
|
||||
r = ConvertBSPMain( argc - 1, argv + 1 );
|
||||
|
||||
/* ydnar: otherwise create a bsp */
|
||||
else
|
||||
r = BSPMain( argc, argv );
|
||||
|
||||
/* emit time */
|
||||
end = Sys_DoubleTime();
|
||||
Msg( "%9.0f seconds elapsed\n", end - start );
|
||||
|
||||
return r;
|
||||
game = &games[0]; // defaulting to Q3A ...
|
||||
FS_LoadGameInfo( "gameinfo.txt" );
|
||||
BspFunc = NULL;
|
||||
enable_log = true;
|
||||
|
||||
if( FS_CheckParm( "-analyze" )) BspFunc = AnalyzeBSP;
|
||||
else if( FS_CheckParm( "-info" )) BspFunc = BSPInfo;
|
||||
else if( FS_CheckParm( "-vis" )) BspFunc = VisMain;
|
||||
else if( FS_CheckParm( "-light" )) BspFunc = LightMain;
|
||||
else if( FS_CheckParm( "-export" )) BspFunc = ExportLightmapsMain;
|
||||
else if( FS_CheckParm( "-import" )) BspFunc = ImportLightmapsMain;
|
||||
else if( FS_CheckParm( "-scale" )) BspFunc = ScaleBSPMain;
|
||||
else if( FS_CheckParm( "-convert" )) BspFunc = ConvertBSPMain;
|
||||
else BspFunc = BSPMain;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CompileBSPModel ( void )
|
||||
{
|
||||
if( !BspFunc ) return false;
|
||||
|
||||
return BspFunc( com_argc, com_argv );
|
||||
}
|
|
@ -470,7 +470,7 @@ void ProcessDecals( void )
|
|||
if( distance > 0.125f )
|
||||
{
|
||||
/* tesselate the patch */
|
||||
iterations = IterationsForCurve( p->longestCurve, patchSubdivisions );
|
||||
iterations = IterationsForCurve( p->longestCurve, patch_subdivide->integer );
|
||||
subdivided = SubdivideMesh2( p->mesh, iterations );
|
||||
|
||||
/* fit it to the curve and remove colinear verts on rows/columns */
|
||||
|
@ -720,7 +720,7 @@ static void ProjectDecalOntoPatch( decalProjector_t *dp, mapDrawSurface_t *ds )
|
|||
src.width = ds->patchWidth;
|
||||
src.height = ds->patchHeight;
|
||||
src.verts = ds->verts;
|
||||
iterations = IterationsForCurve( ds->longestCurve, patchSubdivisions );
|
||||
iterations = IterationsForCurve( ds->longestCurve, patch_subdivide->integer );
|
||||
subdivided = SubdivideMesh2( src, iterations );
|
||||
|
||||
/* fit it to the curve and remove colinear verts on rows/columns */
|
||||
|
|
|
@ -946,7 +946,7 @@ void SetupSurfaceLightmaps( void )
|
|||
info->recvShadows = GetSurfaceExtraRecvShadows( num );
|
||||
info->sampleSize = GetSurfaceExtraSampleSize( num );
|
||||
info->longestCurve = GetSurfaceExtraLongestCurve( num );
|
||||
info->patchIterations = IterationsForCurve( info->longestCurve, patchSubdivisions );
|
||||
info->patchIterations = IterationsForCurve( info->longestCurve, patch_subdivide->integer );
|
||||
GetSurfaceExtraLightmapAxis( num, info->axis );
|
||||
|
||||
/* mark parent */
|
||||
|
|
|
@ -36,13 +36,7 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2."
|
|||
/* dependencies */
|
||||
#include "q3map2.h"
|
||||
|
||||
|
||||
|
||||
/* FIXME: remove these vars */
|
||||
|
||||
/* undefine to make plane finding use linear sort (note: really slow) */
|
||||
#define USE_HASHING
|
||||
#define PLANE_HASHES 8192
|
||||
#define PLANE_HASHES 8192
|
||||
|
||||
plane_t *planehash[ PLANE_HASHES ];
|
||||
|
||||
|
@ -207,13 +201,10 @@ must be within an epsilon distance of the plane
|
|||
*/
|
||||
|
||||
int FindFloatPlane( vec3_t normal, vec_t dist, int numPoints, vec3_t *points )
|
||||
|
||||
#ifdef USE_HASHING
|
||||
|
||||
{
|
||||
int i, j, hash, h;
|
||||
plane_t *p;
|
||||
vec_t d;
|
||||
plane_t *p;
|
||||
vec_t d;
|
||||
|
||||
|
||||
/* hash the plane */
|
||||
|
@ -251,25 +242,6 @@ int FindFloatPlane( vec3_t normal, vec_t dist, int numPoints, vec3_t *points )
|
|||
return CreateNewFloatPlane( normal, dist );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
{
|
||||
int i;
|
||||
plane_t *p;
|
||||
|
||||
|
||||
SnapPlane( normal, &dist );
|
||||
for( i = 0, p = mapplanes; i < nummapplanes; i++, p++ )
|
||||
{
|
||||
if( PlaneEqual( p, normal, dist ) )
|
||||
return i;
|
||||
}
|
||||
|
||||
return CreateNewFloatPlane( normal, dist );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
=====================
|
||||
PlaneFromPoints
|
||||
|
|
|
@ -38,6 +38,23 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2."
|
|||
#include "matrix_lib.h"
|
||||
#include "stdio.h" // sscanf
|
||||
|
||||
/*
|
||||
PicoMalloc()
|
||||
callback for picomodel.lib
|
||||
*/
|
||||
void *PicoMalloc( size_t size )
|
||||
{
|
||||
return Malloc( size );
|
||||
}
|
||||
|
||||
/*
|
||||
PicoFree()
|
||||
callback for picomodel.lib
|
||||
*/
|
||||
void PicoFree( void *mem )
|
||||
{
|
||||
Mem_Free( mem );
|
||||
}
|
||||
|
||||
/*
|
||||
PicoPrintFunc()
|
||||
|
|
|
@ -334,8 +334,8 @@ void ParsePatch( bool onlyLights )
|
|||
{
|
||||
ExpandLongestCurve( &longestCurve, verts[ i * m.width + j ].xyz, verts[ i * m.width + (j + 1) ].xyz, verts[ i * m.width + (j + 2) ].xyz ); /* row */
|
||||
ExpandLongestCurve( &longestCurve, verts[ i * m.width + j ].xyz, verts[ (i + 1) * m.width + j ].xyz, verts[ (i + 2) * m.width + j ].xyz ); /* col */
|
||||
ExpandMaxIterations( &maxIterations, patchSubdivisions, verts[ i * m.width + j ].xyz, verts[ i * m.width + (j + 1) ].xyz, verts[ i * m.width + (j + 2) ].xyz ); /* row */
|
||||
ExpandMaxIterations( &maxIterations, patchSubdivisions, verts[ i * m.width + j ].xyz, verts[ (i + 1) * m.width + j ].xyz, verts[ (i + 2) * m.width + j ].xyz ); /* col */
|
||||
ExpandMaxIterations( &maxIterations, patch_subdivide->integer, verts[ i * m.width + j ].xyz, verts[ i * m.width + (j + 1) ].xyz, verts[ i * m.width + (j + 2) ].xyz ); /* row */
|
||||
ExpandMaxIterations( &maxIterations, patch_subdivide->integer, verts[ i * m.width + j ].xyz, verts[ (i + 1) * m.width + j ].xyz, verts[ (i + 2) * m.width + j ].xyz ); /* col */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,446 +0,0 @@
|
|||
/* -------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
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."
|
||||
|
||||
------------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
/* marker */
|
||||
#define PATH_INIT_C
|
||||
|
||||
|
||||
|
||||
/* dependencies */
|
||||
#include "q3map2.h"
|
||||
|
||||
|
||||
|
||||
/* path support */
|
||||
#define MAX_BASE_PATHS 10
|
||||
#define MAX_GAME_PATHS 10
|
||||
|
||||
char *homePath;
|
||||
char installPath[ MAX_SYSPATH ];
|
||||
|
||||
int numBasePaths;
|
||||
char *basePaths[ MAX_BASE_PATHS ];
|
||||
int numGamePaths;
|
||||
char *gamePaths[ MAX_GAME_PATHS ];
|
||||
|
||||
|
||||
|
||||
/*
|
||||
some of this code is based off the original q3map port from loki
|
||||
and finds various paths. moved here from bsp.c for clarity.
|
||||
*/
|
||||
|
||||
/*
|
||||
PathLokiGetHomeDir()
|
||||
gets the user's home dir (for ~/.q3a)
|
||||
*/
|
||||
|
||||
char *LokiGetHomeDir( void )
|
||||
{
|
||||
#ifndef Q_UNIX
|
||||
return NULL;
|
||||
#else
|
||||
char *home;
|
||||
uid_t id;
|
||||
struct passwd *pwd;
|
||||
|
||||
|
||||
/* get the home environment variable */
|
||||
home = getenv( "HOME" );
|
||||
if( home == NULL )
|
||||
{
|
||||
/* do some more digging */
|
||||
id = getuid();
|
||||
setpwent();
|
||||
while( (pwd = getpwent()) != NULL )
|
||||
{
|
||||
if( pwd->pw_uid == id )
|
||||
{
|
||||
home = pwd->pw_dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
endpwent();
|
||||
}
|
||||
|
||||
/* return it */
|
||||
return home;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
PathLokiInitPaths()
|
||||
initializes some paths on linux/os x
|
||||
*/
|
||||
|
||||
void LokiInitPaths( char *argv0 )
|
||||
{
|
||||
#ifndef Q_UNIX
|
||||
/* this is kinda crap, but hey */
|
||||
strcpy( installPath, "../" );
|
||||
#else
|
||||
char temp[ MAX_OS_PATH ];
|
||||
char *home;
|
||||
char *path;
|
||||
char *last;
|
||||
bool found;
|
||||
|
||||
|
||||
/* get home dir */
|
||||
home = LokiGetHomeDir();
|
||||
if( home == NULL )
|
||||
home = ".";
|
||||
|
||||
/* do some path divining */
|
||||
strcpy( temp, argv0 );
|
||||
if( strrchr( temp, '/' ) )
|
||||
argv0 = strrchr( argv0, '/' ) + 1;
|
||||
else
|
||||
{
|
||||
/* get path environment variable */
|
||||
path = getenv( "PATH" );
|
||||
|
||||
/* minor setup */
|
||||
last[ 0 ] = path[ 0 ];
|
||||
last[ 1 ] = '\0';
|
||||
found = false;
|
||||
|
||||
/* go through each : segment of path */
|
||||
while( last[ 0 ] != '\0' && found == false )
|
||||
{
|
||||
/* null out temp */
|
||||
temp[ 0 ] = '\0';
|
||||
|
||||
/* find next chunk */
|
||||
last = strchr( path, ':' );
|
||||
if( last == NULL )
|
||||
last = path + strlen( path );
|
||||
|
||||
/* found home dir candidate */
|
||||
if( *path == '~' )
|
||||
{
|
||||
strcpy( temp, home );
|
||||
path++;
|
||||
}
|
||||
|
||||
/* concatenate */
|
||||
if( last > (path + 1) )
|
||||
{
|
||||
strncat( temp, path, (last - path) );
|
||||
strcat( temp, "/" );
|
||||
}
|
||||
strcat( temp, "./" );
|
||||
strcat( temp, argv0 );
|
||||
|
||||
/* verify the path */
|
||||
if( access( temp, X_OK ) == 0 )
|
||||
found++;
|
||||
path = last + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* flake */
|
||||
if( realpath( temp, installPath ) )
|
||||
{
|
||||
/* q3map is in "tools/" */
|
||||
*(strrchr( installPath, '/' )) = '\0';
|
||||
*(strrchr( installPath, '/' ) + 1) = '\0';
|
||||
}
|
||||
|
||||
/* set home path */
|
||||
homePath = home;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
CleanPath() - ydnar
|
||||
cleans a dos path \ -> /
|
||||
*/
|
||||
|
||||
void CleanPath( char *path )
|
||||
{
|
||||
while( *path )
|
||||
{
|
||||
if( *path == '\\' )
|
||||
*path = '/';
|
||||
path++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
GetGame() - ydnar
|
||||
gets the game_t based on a -game argument
|
||||
returns NULL if no match found
|
||||
*/
|
||||
|
||||
game_t *GetGame( char *arg )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* dummy check */
|
||||
if( arg == NULL || arg[ 0 ] == '\0' )
|
||||
return NULL;
|
||||
|
||||
/* test it */
|
||||
i = 0;
|
||||
while( games[i].arg != NULL )
|
||||
{
|
||||
if( com.stricmp( arg, games[ i ].arg ) == 0 )
|
||||
return &games[ i ];
|
||||
i++;
|
||||
}
|
||||
|
||||
/* no matching game */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
AddBasePath() - ydnar
|
||||
adds a base path to the list
|
||||
*/
|
||||
|
||||
void AddBasePath( char *path )
|
||||
{
|
||||
/* dummy check */
|
||||
if( path == NULL || path[ 0 ] == '\0' || numBasePaths >= MAX_BASE_PATHS )
|
||||
return;
|
||||
|
||||
/* add it to the list */
|
||||
basePaths[ numBasePaths ] = copystring( path );
|
||||
CleanPath( basePaths[ numBasePaths ] );
|
||||
numBasePaths++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
AddHomeBasePath() - ydnar
|
||||
adds a base path to the beginning of the list, prefixed by ~/
|
||||
*/
|
||||
|
||||
void AddHomeBasePath( char *path )
|
||||
{
|
||||
#ifdef Q_UNIX
|
||||
int i;
|
||||
char temp[ MAX_OS_PATH ];
|
||||
|
||||
|
||||
/* dummy check */
|
||||
if( path == NULL || path[ 0 ] == '\0' )
|
||||
return;
|
||||
|
||||
/* make a hole */
|
||||
for( i = 0; i < (MAX_BASE_PATHS - 1); i++ )
|
||||
basePaths[ i + 1 ] = basePaths[ i ];
|
||||
|
||||
/* concatenate home dir and path */
|
||||
com.sprintf( temp, "%s/%s", homePath, path );
|
||||
|
||||
/* add it to the list */
|
||||
basePaths[ 0 ] = safe_malloc( strlen( temp ) + 1 );
|
||||
strcpy( basePaths[ 0 ], temp );
|
||||
CleanPath( basePaths[ 0 ] );
|
||||
numBasePaths++;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
AddGamePath() - ydnar
|
||||
adds a game path to the list
|
||||
*/
|
||||
|
||||
void AddGamePath( char *path )
|
||||
{
|
||||
/* dummy check */
|
||||
if( path == NULL || path[ 0 ] == '\0' || numGamePaths >= MAX_GAME_PATHS )
|
||||
return;
|
||||
|
||||
/* add it to the list */
|
||||
gamePaths[ numGamePaths ] = copystring( path );
|
||||
CleanPath( gamePaths[ numGamePaths ] );
|
||||
numGamePaths++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
InitPaths() - ydnar
|
||||
cleaned up some of the path initialization code from bsp.c
|
||||
will remove any arguments it uses
|
||||
*/
|
||||
|
||||
void InitPaths( int *argc, char **argv )
|
||||
{
|
||||
int i, j, k, len, len2;
|
||||
char temp[ MAX_SYSPATH ];
|
||||
|
||||
|
||||
/* note it */
|
||||
MsgDev( D_NOTE, "--- InitPaths ---\n" );
|
||||
|
||||
/* get the install path for backup */
|
||||
LokiInitPaths( argv[ 0 ] );
|
||||
|
||||
/* set game to default (q3a) */
|
||||
game = &games[ 0 ];
|
||||
numBasePaths = 0;
|
||||
numGamePaths = 0;
|
||||
|
||||
/* parse through the arguments and extract those relevant to paths */
|
||||
for( i = 0; i < *argc; i++ )
|
||||
{
|
||||
/* check for null */
|
||||
if( argv[ i ] == NULL )
|
||||
continue;
|
||||
|
||||
/* -game */
|
||||
if( strcmp( argv[ i ], "-game" ) == 0 )
|
||||
{
|
||||
if( ++i >= *argc )
|
||||
Sys_Error( "Out of arguments: No game specified after %s", argv[ i - 1 ] );
|
||||
argv[ i - 1 ] = NULL;
|
||||
game = GetGame( argv[ i ] );
|
||||
if( game == NULL )
|
||||
game = &games[ 0 ];
|
||||
argv[ i ] = NULL;
|
||||
}
|
||||
|
||||
/* -fs_basepath */
|
||||
else if( strcmp( argv[ i ], "-fs_basepath" ) == 0 )
|
||||
{
|
||||
if( ++i >= *argc )
|
||||
Sys_Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] );
|
||||
argv[ i - 1 ] = NULL;
|
||||
AddBasePath( argv[ i ] );
|
||||
argv[ i ] = NULL;
|
||||
}
|
||||
|
||||
/* -fs_game */
|
||||
else if( strcmp( argv[ i ], "-fs_game" ) == 0 )
|
||||
{
|
||||
if( ++i >= *argc )
|
||||
Sys_Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] );
|
||||
argv[ i - 1 ] = NULL;
|
||||
AddGamePath( argv[ i ] );
|
||||
argv[ i ] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* remove processed arguments */
|
||||
for( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
|
||||
{
|
||||
for( ; j < *argc && argv[ j ] == NULL; j++ );
|
||||
argv[ i ] = argv[ j ];
|
||||
if( argv[ i ] != NULL )
|
||||
k++;
|
||||
}
|
||||
*argc = k;
|
||||
|
||||
/* add standard game path */
|
||||
AddGamePath( game->gamePath );
|
||||
|
||||
/* if there is no base path set, figure it out */
|
||||
if( numBasePaths == 0 )
|
||||
{
|
||||
/* this is another crappy replacement for SetQdirFromPath() */
|
||||
len2 = strlen( game->magic );
|
||||
for( i = 0; i < *argc && numBasePaths == 0; i++ )
|
||||
{
|
||||
/* extract the arg */
|
||||
strcpy( temp, argv[ i ] );
|
||||
CleanPath( temp );
|
||||
len = strlen( temp );
|
||||
MsgDev ( D_WARN, "Searching for \"%s\" in \"%s\" (%d)...\n", game->magic, temp, i );
|
||||
|
||||
/* this is slow, but only done once */
|
||||
for( j = 0; j < (len - len2); j++ )
|
||||
{
|
||||
/* check for the game's magic word */
|
||||
if( com.strnicmp( &temp[ j ], game->magic, len2 ) == 0 )
|
||||
{
|
||||
/* now find the next slash and nuke everything after it */
|
||||
while( temp[ ++j ] != '/' && temp[ j ] != '\0' );
|
||||
temp[ j ] = '\0';
|
||||
|
||||
/* add this as a base path */
|
||||
AddBasePath( temp );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* add install path */
|
||||
if( numBasePaths == 0 )
|
||||
AddBasePath( installPath );
|
||||
|
||||
/* check again */
|
||||
if( numBasePaths == 0 )
|
||||
Sys_Error( "Failed to find a valid base path.\n" );
|
||||
}
|
||||
|
||||
/* this only affects unix */
|
||||
AddHomeBasePath( game->homeBasePath );
|
||||
|
||||
/* initialize vfs paths */
|
||||
if( numBasePaths > MAX_BASE_PATHS )
|
||||
numBasePaths = MAX_BASE_PATHS;
|
||||
if( numGamePaths > MAX_GAME_PATHS )
|
||||
numGamePaths = MAX_GAME_PATHS;
|
||||
|
||||
/* walk the list of game paths */
|
||||
for( j = 0; j < numGamePaths; j++ )
|
||||
{
|
||||
/* walk the list of base paths */
|
||||
for( i = 0; i < numBasePaths; i++ )
|
||||
{
|
||||
/* create a full path and initialize it */
|
||||
com.sprintf( temp, "%s/%s/", basePaths[ i ], gamePaths[ j ] );
|
||||
FS_AddGameHierarchy( temp );
|
||||
}
|
||||
}
|
||||
|
||||
/* done */
|
||||
Msg( "\n" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -273,19 +273,19 @@ void WritePortalFile( tree_t *tree )
|
|||
MsgDev( D_NOTE, "--- WritePortalFile ---\n" );
|
||||
|
||||
// write the file
|
||||
com.sprintf( filename, "%s.prt", source );
|
||||
com.sprintf( filename, "maps/%s.prt", source );
|
||||
Msg( "writing %s\n", filename );
|
||||
pf = FS_Open( filename, "w" );
|
||||
|
||||
if( !pf ) Sys_Error( "error opening %s\n", filename );
|
||||
|
||||
FS_Printf (pf, "%s\n", PORTALfile_t);
|
||||
FS_Printf (pf, "%i\n", num_visclusters);
|
||||
FS_Printf (pf, "%i\n", num_visportals);
|
||||
FS_Printf (pf, "%i\n", num_solidfaces);
|
||||
FS_Printf( pf, "%s\n", PORTALfile_t );
|
||||
FS_Printf( pf, "%i\n", num_visclusters );
|
||||
FS_Printf( pf, "%i\n", num_visportals );
|
||||
FS_Printf( pf, "%i\n", num_solidfaces );
|
||||
|
||||
WritePortalFile_r(tree->headnode);
|
||||
WriteFaceFile_r(tree->headnode);
|
||||
WritePortalFile_r( tree->headnode );
|
||||
WriteFaceFile_r( tree->headnode );
|
||||
|
||||
FS_Close( pf );
|
||||
}
|
|
@ -147,9 +147,6 @@ constants
|
|||
|
||||
/* vis */
|
||||
#define VIS_HEADER_SIZE 8
|
||||
|
||||
#define SEPERATORCACHE /* seperator caching helps a bit */
|
||||
|
||||
#define PORTALFILE "PRT1"
|
||||
|
||||
#define MAX_PORTALS 32768
|
||||
|
@ -1122,10 +1119,8 @@ typedef struct pstack_s
|
|||
|
||||
visPlane_t portalplane;
|
||||
int depth;
|
||||
#ifdef SEPERATORCACHE
|
||||
visPlane_t seperators[ 2 ][ MAX_SEPERATORS ];
|
||||
int numseperators[ 2 ];
|
||||
#endif
|
||||
}
|
||||
pstack_t;
|
||||
|
||||
|
@ -1320,32 +1315,31 @@ rawGridPoint_t;
|
|||
|
||||
typedef struct surfaceInfo_s
|
||||
{
|
||||
bspModel_t *model;
|
||||
shaderInfo_t *si;
|
||||
rawLightmap_t *lm;
|
||||
int parentSurfaceNum, childSurfaceNum;
|
||||
int entityNum, castShadows, recvShadows, sampleSize, patchIterations;
|
||||
float longestCurve;
|
||||
float *plane;
|
||||
vec3_t axis, mins, maxs;
|
||||
bool hasLightmap, approximated;
|
||||
int firstSurfaceCluster, numSurfaceClusters;
|
||||
}
|
||||
surfaceInfo_t;
|
||||
bspModel_t *model;
|
||||
shaderInfo_t *si;
|
||||
rawLightmap_t *lm;
|
||||
int parentSurfaceNum, childSurfaceNum;
|
||||
int entityNum, castShadows, recvShadows, sampleSize, patchIterations;
|
||||
float longestCurve;
|
||||
float *plane;
|
||||
vec3_t axis, mins, maxs;
|
||||
bool hasLightmap, approximated;
|
||||
int firstSurfaceCluster, numSurfaceClusters;
|
||||
} surfaceInfo_t;
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
prototypes
|
||||
|
||||
------------------------------------------------------------------------------- */
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* main.c */
|
||||
vec_t Random( void );
|
||||
int BSPInfo( int count, char **fileNames );
|
||||
int ScaleBSPMain( int argc, char **argv );
|
||||
int ConvertMain( int argc, char **argv );
|
||||
/* bsplib.c */
|
||||
float Random( void );
|
||||
int BSPInfo( int count, char **fileNames );
|
||||
int ScaleBSPMain( int argc, char **argv );
|
||||
int ConvertMain( int argc, char **argv );
|
||||
|
||||
/* md5.c */
|
||||
typedef struct
|
||||
|
@ -1360,21 +1354,16 @@ void MD5_Update( MD5_CTX *ctx, const byte *buf, uint len );
|
|||
void MD5_Final( MD5_CTX *ctx, byte digest[16] );
|
||||
dword MD5_BlockChecksum( const void *data, int length );
|
||||
|
||||
/* path_init.c */
|
||||
game_t *GetGame( char *arg );
|
||||
void InitPaths( int *argc, char **argv );
|
||||
|
||||
|
||||
/* bsp.c */
|
||||
int BSPMain( int argc, char **argv );
|
||||
int BSPMain( int argc, char **argv );
|
||||
|
||||
|
||||
/* convert_map.c */
|
||||
int ConvertBSPToMap( char *bspName );
|
||||
int ConvertBSPToMap( char *bspName );
|
||||
|
||||
|
||||
/* convert_ase.c */
|
||||
int ConvertBSPToASE( char *bspName );
|
||||
int ConvertBSPToASE( char *bspName );
|
||||
|
||||
|
||||
/* brush.c */
|
||||
|
@ -1496,12 +1485,14 @@ tree_t *FaceBSP( face_t *list );
|
|||
|
||||
|
||||
/* model.c */
|
||||
void PicoPrintFunc( int level, const char *str );
|
||||
void PicoLoadFileFunc( char *name, byte **buffer, int *bufSize );
|
||||
picoModel_t *FindModel( char *name, int frame );
|
||||
picoModel_t *LoadModel( char *name, int frame );
|
||||
void InsertModel( char *name, int frame, matrix4x4 transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale );
|
||||
void AddTriangleModels( entity_t *e );
|
||||
void *PicoMalloc( size_t size );
|
||||
void PicoFree( void *mem );
|
||||
void PicoPrintFunc( int level, const char *str );
|
||||
void PicoLoadFileFunc( char *name, byte **buffer, int *bufSize );
|
||||
picoModel_t *FindModel( char *name, int frame );
|
||||
picoModel_t *LoadModel( char *name, int frame );
|
||||
void InsertModel( char *name, int frame, matrix4x4 transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale );
|
||||
void AddTriangleModels( entity_t *e );
|
||||
|
||||
|
||||
/* surface.c */
|
||||
|
@ -1576,11 +1567,11 @@ void ComputeAxisBase( vec3_t normal, vec3_t texX, vec3_t texY);
|
|||
|
||||
|
||||
/* vis.c */
|
||||
fixedWinding_t *NewFixedWinding( int points );
|
||||
int VisMain( int argc, char **argv );
|
||||
fixedWinding_t *NewFixedWinding( int points );
|
||||
int VisMain( int argc, char **argv );
|
||||
|
||||
/* visflow.c */
|
||||
int CountBits( byte *bits, int numbits );
|
||||
int CountBits( byte *bits, int numbits );
|
||||
void PassageFlow( int portalnum );
|
||||
void CreatePassages( int portalnum );
|
||||
void PassageMemory( void );
|
||||
|
@ -1592,11 +1583,11 @@ void PassagePortalFlow( int portalnum );
|
|||
|
||||
|
||||
/* light.c */
|
||||
float PointToPolygonFormFactor( const vec3_t point, const vec3_t normal, const winding_t *w );
|
||||
int LightContributionToSample( light_trace_t *trace );
|
||||
void LightingAtSample( light_trace_t *trace, byte styles[ MAX_LIGHTMAPS ], vec3_t colors[ MAX_LIGHTMAPS ] );
|
||||
int LightContributionToPoint( light_trace_t *trace );
|
||||
int LightMain( int argc, char **argv );
|
||||
float PointToPolygonFormFactor( const vec3_t point, const vec3_t normal, const winding_t *w );
|
||||
int LightContributionToSample( light_trace_t *trace );
|
||||
void LightingAtSample( light_trace_t *trace, byte styles[MAX_LIGHTMAPS], vec3_t colors[MAX_LIGHTMAPS] );
|
||||
int LightContributionToPoint( light_trace_t *trace );
|
||||
int LightMain( int argc, char **argv );
|
||||
|
||||
|
||||
/* light_trace.c */
|
||||
|
@ -1643,8 +1634,8 @@ void CreateTraceLightsForSurface( int num, light_trace_t *trace );
|
|||
/* lightmaps_ydnar.c */
|
||||
void ExportLightmaps( void );
|
||||
|
||||
int ExportLightmapsMain( int argc, char **argv );
|
||||
int ImportLightmapsMain( int argc, char **argv );
|
||||
int ExportLightmapsMain( int argc, char **argv );
|
||||
int ImportLightmapsMain( int argc, char **argv );
|
||||
|
||||
void SetupSurfaceLightmaps( void );
|
||||
void StitchSurfaceLightmaps( void );
|
||||
|
@ -1801,7 +1792,7 @@ Q_EXTERN bool noHint Q_ASSIGN( false ); /* ydnar */
|
|||
Q_EXTERN bool renameModelShaders Q_ASSIGN( false ); /* ydnar */
|
||||
Q_EXTERN bool skyFixHack Q_ASSIGN( false ); /* ydnar */
|
||||
|
||||
Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */
|
||||
Q_EXTERN cvar_t *patch_subdivide;
|
||||
|
||||
Q_EXTERN int maxLMSurfaceVerts Q_ASSIGN( 64 ); /* ydnar */
|
||||
Q_EXTERN int maxSurfaceVerts Q_ASSIGN( 999 ); /* ydnar */
|
||||
|
|
|
@ -65,14 +65,6 @@ void AddScriptToStack (const char *filename, int index)
|
|||
|
||||
if (size == -1)
|
||||
Msg ("Script file %s was not found\n", script->filename);
|
||||
else
|
||||
{
|
||||
if (index > 0)
|
||||
Msg ("entering %s (%d)\n", script->filename, index+1);
|
||||
else
|
||||
Msg ("entering %s\n", script->filename);
|
||||
}
|
||||
|
||||
script->line = 1;
|
||||
script->script_p = script->buffer;
|
||||
script->end_p = script->buffer + size;
|
||||
|
|
|
@ -1995,59 +1995,26 @@ static void ParseCustomInfoParms( void )
|
|||
|
||||
/*
|
||||
LoadShaderInfo()
|
||||
the shaders are parsed out of shaderlist.txt from a main directory
|
||||
that is, if using -fs_game we ignore the shader scripts that might be in baseq3/
|
||||
on linux there's an additional twist, we actually merge the stuff from ~/.q3a/ and from the base dir
|
||||
*/
|
||||
|
||||
#define MAX_SHADER_FILES 1024
|
||||
|
||||
void LoadShaderInfo( void )
|
||||
{
|
||||
search_t *search;
|
||||
int i, numShaderFiles;
|
||||
char filename[MAX_SYSPATH];
|
||||
char *shaderFiles[ MAX_SHADER_FILES ];
|
||||
|
||||
|
||||
/* rr2do2: parse custom infoparms first */
|
||||
// parse custom infoparms first
|
||||
if( useCustomInfoParms ) ParseCustomInfoParms();
|
||||
|
||||
/* start with zero */
|
||||
|
||||
numShaderFiles = 0;
|
||||
search = FS_Search( va( "%s/*.shader", game->shaderPath ), true );
|
||||
if( !search ) return;
|
||||
|
||||
/* load shader list */
|
||||
com.sprintf( filename, "%s/shaderlist.txt", game->shaderPath );
|
||||
LoadScriptFile( filename, 0 );
|
||||
|
||||
/* parse it */
|
||||
while( GetToken( true ) )
|
||||
for( i = 0; i < search->numfilenames; i++ )
|
||||
{
|
||||
/* check for duplicate entries */
|
||||
for( i = 0; i < numShaderFiles; i++ )
|
||||
if( !strcmp( shaderFiles[ i ], token ) )
|
||||
break;
|
||||
|
||||
/* test limit */
|
||||
if( i >= MAX_SHADER_FILES )
|
||||
Sys_Error( "MAX_SHADER_FILES (%d) reached, trim your shaderlist.txt!", (int) MAX_SHADER_FILES );
|
||||
|
||||
/* new shader file */
|
||||
if( i == numShaderFiles )
|
||||
{
|
||||
shaderFiles[ numShaderFiles ] = Malloc( MAX_SYSPATH );
|
||||
strcpy( shaderFiles[ numShaderFiles ], token );
|
||||
numShaderFiles++;
|
||||
}
|
||||
ParseShaderFile( search->filenames[i] );
|
||||
numShaderFiles++;
|
||||
}
|
||||
|
||||
/* parse the shader files */
|
||||
for( i = 0; i < numShaderFiles; i++ )
|
||||
{
|
||||
com.sprintf( filename, "%s/%s.shader", game->shaderPath, shaderFiles[ i ] );
|
||||
ParseShaderFile( filename );
|
||||
Mem_Free( shaderFiles[ i ] );
|
||||
}
|
||||
|
||||
/* emit some statistics */
|
||||
Mem_Free( search );
|
||||
|
||||
MsgDev( D_INFO, "%9d shaderInfo\n", numShaderInfo );
|
||||
}
|
||||
|
|
|
@ -3237,7 +3237,7 @@ int AddSurfaceModels( mapDrawSurface_t *ds )
|
|||
src.height = ds->patchHeight;
|
||||
src.verts = ds->verts;
|
||||
//% subdivided = SubdivideMesh( src, 8.0f, 512 );
|
||||
iterations = IterationsForCurve( ds->longestCurve, patchSubdivisions );
|
||||
iterations = IterationsForCurve( ds->longestCurve, patch_subdivide->integer );
|
||||
subdivided = SubdivideMesh2( src, iterations );
|
||||
|
||||
/* fit it to the curve and remove colinear verts on rows/columns */
|
||||
|
|
|
@ -239,9 +239,9 @@ void WriteSurfaceExtraFile( const char *path )
|
|||
MsgDev( D_NOTE, "--- WriteSurfaceExtraFile ---\n" );
|
||||
|
||||
/* open the file */
|
||||
com.strcpy( srfPath, path );
|
||||
com.snprintf( srfPath, sizeof( srfPath ), "maps/%s", path );
|
||||
FS_StripExtension( srfPath );
|
||||
com.strcat( srfPath, ".srf" );
|
||||
FS_DefaultExtension( srfPath, ".srf" );
|
||||
Msg( "Writing %s\n", srfPath );
|
||||
sf = FS_Open( srfPath, "w" );
|
||||
if( sf == NULL ) Sys_Error( "Error opening %s for writing", srfPath );
|
||||
|
@ -333,9 +333,9 @@ void LoadSurfaceExtraFile( const char *path )
|
|||
return;
|
||||
|
||||
/* load the file */
|
||||
com.strcpy( srfPath, path );
|
||||
com.snprintf( srfPath, sizeof( srfPath ), "maps/%s", path );
|
||||
FS_StripExtension( srfPath );
|
||||
com.strcat( srfPath, ".srf" );
|
||||
FS_DefaultExtension( srfPath, ".srf" );
|
||||
Msg( "Loading %s\n", srfPath );
|
||||
buffer = (void *)FS_LoadFile( srfPath, &size );
|
||||
if( size <= 0 )
|
||||
|
|
|
@ -328,7 +328,7 @@ void TriangulatePatchSurface( mapDrawSurface_t *ds )
|
|||
src.height = ds->patchHeight;
|
||||
src.verts = ds->verts;
|
||||
//% subdivided = SubdivideMesh( src, 8, 999 );
|
||||
iterations = IterationsForCurve( ds->longestCurve, patchSubdivisions );
|
||||
iterations = IterationsForCurve( ds->longestCurve, patch_subdivide->integer );
|
||||
subdivided = SubdivideMesh2( src, iterations ); //% ds->maxIterations
|
||||
|
||||
/* fit it to the curve and remove colinear verts on rows/columns */
|
||||
|
@ -1017,8 +1017,8 @@ void SmoothMetaTriangles( void )
|
|||
if( maxShadeAngle <= 0 )
|
||||
{
|
||||
MsgDev( D_INFO, "No smoothing angles specified, aborting\n" );
|
||||
Mem_Free( shadeAngles );
|
||||
Mem_Free( smoothed );
|
||||
if( shadeAngles ) Mem_Free( shadeAngles );
|
||||
if( smoothed ) Mem_Free( smoothed );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -224,14 +224,7 @@ CalcPortalVis
|
|||
*/
|
||||
void CalcPortalVis (void)
|
||||
{
|
||||
#ifdef MREDEBUG
|
||||
MsgDev( D_INFO, "%6d portals out of %d", 0, numportals*2);
|
||||
//get rid of the counter
|
||||
RunThreadsOnIndividual (numportals*2, false, PortalFlow);
|
||||
#else
|
||||
RunThreadsOnIndividual (numportals*2, true, PortalFlow);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -243,20 +236,11 @@ void CalcPassageVis(void)
|
|||
{
|
||||
PassageMemory();
|
||||
|
||||
#ifdef MREDEBUG
|
||||
MsgDev( D_NOTE, "%6d portals out of %d", 0, numportals * 2 );
|
||||
RunThreadsOnIndividual (numportals*2, false, CreatePassages);
|
||||
MsgDev( D_NOTE, "\n" );
|
||||
MsgDev( D_NOTE, "%6d portals out of %d", 0, numportals * 2 );
|
||||
RunThreadsOnIndividual (numportals*2, false, PassageFlow);
|
||||
MsgDev( D_NOTE, "\n" );
|
||||
#else
|
||||
MsgDev( D_NOTE, "\n--- CreatePassages (%d) ---\n", numportals * 2 );
|
||||
RunThreadsOnIndividual( numportals*2, true, CreatePassages );
|
||||
|
||||
MsgDev( D_NOTE, "\n--- PassageFlow (%d) ---\n", numportals * 2 );
|
||||
RunThreadsOnIndividual( numportals * 2, true, PassageFlow );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -268,20 +252,11 @@ void CalcPassagePortalVis(void)
|
|||
{
|
||||
PassageMemory();
|
||||
|
||||
#ifdef MREDEBUG
|
||||
MsgDev( D_NOTE, "%6d portals out of %d", 0, numportals * 2 );
|
||||
RunThreadsOnIndividual (numportals*2, false, CreatePassages);
|
||||
MsgDev( D_NOTE, "\n" );
|
||||
MsgDev( D_NOTE, "%6d portals out of %d", 0, numportals * 2 );
|
||||
RunThreadsOnIndividual (numportals*2, false, PassagePortalFlow);
|
||||
MsgDev( D_NOTE, "\n" );
|
||||
#else
|
||||
MsgDev( D_NOTE, "\n--- CreatePassages (%d) ---\n", numportals * 2 );
|
||||
RunThreadsOnIndividual( numportals * 2, true, CreatePassages);
|
||||
|
||||
MsgDev( D_NOTE, "\n--- PassagePortalFlow (%d) ---\n", numportals * 2 );
|
||||
RunThreadsOnIndividual( numportals * 2, true, PassagePortalFlow );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1091,16 +1066,16 @@ int VisMain( int argc, char **argv )
|
|||
|
||||
|
||||
/* load the bsp */
|
||||
com.sprintf( source, "%s%s", inbase, argv[ i ] );
|
||||
com.sprintf( source, "maps/%s", gs_filename );
|
||||
FS_StripExtension( source );
|
||||
com.strcat( source, ".bsp" );
|
||||
MsgDev( D_INFO, "Loading %s\n", source );
|
||||
LoadBSPFile( source );
|
||||
|
||||
/* load the portal file */
|
||||
com.sprintf( portalfile, "%s%s", inbase, argv[i] );
|
||||
com.strcpy( portalfile, source );
|
||||
FS_StripExtension( portalfile );
|
||||
com.strcat( portalfile, ".prt" );
|
||||
FS_DefaultExtension( portalfile, ".prt" );
|
||||
MsgDev( D_INFO, "Loading %s\n", portalfile );
|
||||
LoadPortals( portalfile );
|
||||
|
||||
|
|
|
@ -375,11 +375,10 @@ fixedWinding_t *ClipToSeperators (fixedWinding_t *source, fixedWinding_t *pass,
|
|||
plane.dist = -plane.dist;
|
||||
}
|
||||
|
||||
#ifdef SEPERATORCACHE
|
||||
stack->seperators[flipclip][stack->numseperators[flipclip]] = plane;
|
||||
if (++stack->numseperators[flipclip] >= MAX_SEPERATORS)
|
||||
Sys_Error("MAX_SEPERATORS");
|
||||
#endif
|
||||
|
||||
//MrE: fast check first
|
||||
d = DotProduct (stack->portal->origin, plane.normal) - plane.dist;
|
||||
//if completely at the back of the seperator plane
|
||||
|
@ -432,11 +431,8 @@ void RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
|
|||
stack.leaf = leaf;
|
||||
stack.portal = NULL;
|
||||
stack.depth = prevstack->depth + 1;
|
||||
|
||||
#ifdef SEPERATORCACHE
|
||||
stack.numseperators[0] = 0;
|
||||
stack.numseperators[1] = 0;
|
||||
#endif
|
||||
|
||||
might = (long *)stack.mightsee;
|
||||
vis = (long *)thread->base->portalvis;
|
||||
|
@ -580,7 +576,6 @@ void RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifdef SEPERATORCACHE
|
||||
if (stack.numseperators[0])
|
||||
{
|
||||
for (n = 0; n < stack.numseperators[0]; n++)
|
||||
|
@ -596,13 +591,9 @@ void RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
|
|||
{
|
||||
stack.pass = ClipToSeperators (prevstack->source, prevstack->pass, stack.pass, false, &stack);
|
||||
}
|
||||
#else
|
||||
stack.pass = ClipToSeperators (stack.source, prevstack->pass, stack.pass, false, &stack);
|
||||
#endif
|
||||
if (!stack.pass)
|
||||
continue;
|
||||
|
||||
#ifdef SEPERATORCACHE
|
||||
if (stack.numseperators[1])
|
||||
{
|
||||
for (n = 0; n < stack.numseperators[1]; n++)
|
||||
|
@ -616,9 +607,6 @@ void RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
|
|||
{
|
||||
stack.pass = ClipToSeperators (prevstack->pass, prevstack->source, stack.pass, true, &stack);
|
||||
}
|
||||
#else
|
||||
stack.pass = ClipToSeperators (prevstack->pass, stack.source, stack.pass, true, &stack);
|
||||
#endif
|
||||
if (!stack.pass)
|
||||
continue;
|
||||
|
||||
|
@ -646,10 +634,6 @@ void PortalFlow (int portalnum)
|
|||
vportal_t *p;
|
||||
int c_might, c_can;
|
||||
|
||||
#ifdef MREDEBUG
|
||||
Msg("\r%6d", portalnum);
|
||||
#endif
|
||||
|
||||
p = sorted_portals[portalnum];
|
||||
|
||||
if (p->removed)
|
||||
|
@ -773,10 +757,6 @@ void PassageFlow (int portalnum)
|
|||
vportal_t *p;
|
||||
// int c_might, c_can;
|
||||
|
||||
#ifdef MREDEBUG
|
||||
Msg("\r%6d", portalnum);
|
||||
#endif
|
||||
|
||||
p = sorted_portals[portalnum];
|
||||
|
||||
if (p->removed)
|
||||
|
@ -838,11 +818,8 @@ void RecursivePassagePortalFlow (vportal_t *portal, threaddata_t *thread, pstack
|
|||
stack.leaf = leaf;
|
||||
stack.portal = NULL;
|
||||
stack.depth = prevstack->depth + 1;
|
||||
|
||||
#ifdef SEPERATORCACHE
|
||||
stack.numseperators[0] = 0;
|
||||
stack.numseperators[1] = 0;
|
||||
#endif
|
||||
|
||||
vis = (long *)thread->base->portalvis;
|
||||
|
||||
|
@ -972,7 +949,6 @@ void RecursivePassagePortalFlow (vportal_t *portal, threaddata_t *thread, pstack
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifdef SEPERATORCACHE
|
||||
if (stack.numseperators[0])
|
||||
{
|
||||
for (n = 0; n < stack.numseperators[0]; n++)
|
||||
|
@ -988,13 +964,9 @@ void RecursivePassagePortalFlow (vportal_t *portal, threaddata_t *thread, pstack
|
|||
{
|
||||
stack.pass = ClipToSeperators (prevstack->source, prevstack->pass, stack.pass, false, &stack);
|
||||
}
|
||||
#else
|
||||
stack.pass = ClipToSeperators (stack.source, prevstack->pass, stack.pass, false, &stack);
|
||||
#endif
|
||||
if (!stack.pass)
|
||||
continue;
|
||||
|
||||
#ifdef SEPERATORCACHE
|
||||
if (stack.numseperators[1])
|
||||
{
|
||||
for (n = 0; n < stack.numseperators[1]; n++)
|
||||
|
@ -1008,9 +980,6 @@ void RecursivePassagePortalFlow (vportal_t *portal, threaddata_t *thread, pstack
|
|||
{
|
||||
stack.pass = ClipToSeperators (prevstack->pass, prevstack->source, stack.pass, true, &stack);
|
||||
}
|
||||
#else
|
||||
stack.pass = ClipToSeperators (prevstack->pass, stack.source, stack.pass, true, &stack);
|
||||
#endif
|
||||
if (!stack.pass)
|
||||
continue;
|
||||
|
||||
|
@ -1036,10 +1005,6 @@ void PassagePortalFlow (int portalnum)
|
|||
vportal_t *p;
|
||||
// int c_might, c_can;
|
||||
|
||||
#ifdef MREDEBUG
|
||||
Msg("\r%6d", portalnum);
|
||||
#endif
|
||||
|
||||
p = sorted_portals[portalnum];
|
||||
|
||||
if (p->removed)
|
||||
|
@ -1328,11 +1293,6 @@ void CreatePassages(int portalnum)
|
|||
visPlane_t seperators[MAX_SEPERATORS*2];
|
||||
fixedWinding_t *w;
|
||||
fixedWinding_t in, out, *res;
|
||||
|
||||
|
||||
#ifdef MREDEBUG
|
||||
Msg("\r%6d", portalnum);
|
||||
#endif
|
||||
|
||||
portal = sorted_portals[portalnum];
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ void EndBSPFile( void )
|
|||
WriteSurfaceExtraFile( source );
|
||||
|
||||
/* write the bsp */
|
||||
com.sprintf( path, "%s.bsp", source );
|
||||
com.sprintf( path, "maps/%s.bsp", source );
|
||||
Msg( "Writing %s\n", path );
|
||||
WriteBSPFile( path );
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ extern byte *basepool;
|
|||
extern byte *zonepool;
|
||||
extern bool enable_log;
|
||||
extern stdlib_api_t com;
|
||||
extern file_t *bsplog;
|
||||
|
||||
#define Sys_Error com.error
|
||||
#define Malloc( size ) Mem_Alloc( basepool, size )
|
||||
|
@ -41,8 +42,7 @@ bool CompileStudioModel( byte *mempool, const char *name, byte parms );
|
|||
bool CompileSpriteModel( byte *mempool, const char *name, byte parms );
|
||||
bool CompileWad3Archive( byte *mempool, const char *name, byte parms );
|
||||
bool CompileDPVideo( byte *mempool, const char *name, byte parms );
|
||||
bool PrepareBSPModel( const char *dir, const char *name );
|
||||
bool Q3MapMain( int argc, char **argv );
|
||||
bool PrepareBSPModel( int argc, char **argv );
|
||||
bool CompileBSPModel( void );
|
||||
|
||||
#endif//UTILS_H
|
|
@ -15,7 +15,8 @@ dll_info_t vprogs_dll = { "vprogs.dll", NULL, "CreateAPI", NULL, NULL, true, siz
|
|||
vprogs_exp_t *PRVM;
|
||||
stdlib_api_t com;
|
||||
|
||||
#define MAX_SEARCHMASK 256
|
||||
#define MAX_SEARCHMASK 256
|
||||
|
||||
string searchmask[MAX_SEARCHMASK];
|
||||
int num_searchmask = 0;
|
||||
string gs_searchmask;
|
||||
|
@ -54,7 +55,7 @@ platform.dll needs for some setup operations
|
|||
so do it manually
|
||||
==================
|
||||
*/
|
||||
void InitCommon( int argc, char **argv )
|
||||
void InitCommon( const int argc, const char **argv )
|
||||
{
|
||||
int imageflags = 0;
|
||||
launch_t CreateVprogs;
|
||||
|
@ -70,12 +71,9 @@ void InitCommon( int argc, char **argv )
|
|||
com.strncpy( gs_basedir, Cvar_VariableString( "fs_defaultdir" ), sizeof( gs_basedir ));
|
||||
if( !FS_GetParmFromCmdLine( "+map", gs_filename ))
|
||||
com.strncpy( gs_filename, "newmap", sizeof( gs_filename ));
|
||||
|
||||
|
||||
// initialize ImageLibrary
|
||||
start = Sys_DoubleTime();
|
||||
Q3MapMain( argc, argv );
|
||||
//PrepareBSPModel( gs_basedir, gs_filename );
|
||||
PrepareBSPModel( (int)argc, (char **)argv );
|
||||
break;
|
||||
case HOST_QCCLIB:
|
||||
Sys_LoadLibrary( &vprogs_dll ); // load qcclib
|
||||
|
@ -138,7 +136,7 @@ void CommonMain( void )
|
|||
break;
|
||||
case HOST_BSPLIB:
|
||||
AddMask( "*.map" );
|
||||
//CompileBSPModel();
|
||||
CompileBSPModel();
|
||||
break;
|
||||
case HOST_WADLIB:
|
||||
CompileMod = CompileWad3Archive;
|
||||
|
@ -215,6 +213,7 @@ void FreeCommon( void )
|
|||
}
|
||||
else if( app_name == HOST_BSPLIB )
|
||||
{
|
||||
Bsp_Shutdown();
|
||||
if( bsplog ) FS_Close( bsplog );
|
||||
}
|
||||
|
||||
|
@ -235,7 +234,7 @@ launch_exp_t DLLEXPORT *CreateAPI( stdlib_api_t *input, void *unused )
|
|||
Com.Init = InitCommon;
|
||||
Com.Main = CommonMain;
|
||||
Com.Free = FreeCommon;
|
||||
Com.CPrint = NULL;
|
||||
Com.CPrint = Bsp_PrintLog;
|
||||
|
||||
return &Com;
|
||||
}
|
|
@ -21,7 +21,9 @@ void ClosePlatform ( void ); // close host
|
|||
// extragen export
|
||||
//=====================================
|
||||
bool ConvertResource( byte *mempool, const char *filename, byte parms );
|
||||
void Bsp_PrintLog( const char *pMsg );
|
||||
void Skin_FinalizeScript( void );
|
||||
void Bsp_Shutdown( void );
|
||||
void Conv_RunSearch( void );
|
||||
|
||||
// shared tools
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: xtools - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BFD.tmp" with contents
|
||||
[
|
||||
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "bsplib" /I "models" /I "ripper" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\xtools\!debug/" /Fo"..\temp\xtools\!debug/" /Fd"..\temp\xtools\!debug/" /FD /GZ /c
|
||||
"D:\Xash3D\src_main\xtools\bsplib\bsplib.c"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BFD.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BFE.tmp" with contents
|
||||
[
|
||||
msvcrtd.lib user32.lib /nologo /dll /incremental:yes /pdb:"..\temp\xtools\!debug/xtools.pdb" /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\xtools\!debug/xtools.dll" /implib:"..\temp\xtools\!debug/xtools.lib" /pdbtype:sept
|
||||
"\Xash3D\src_main\temp\xtools\!debug\brush.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\brush_primit.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\bsp.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\bspfile_abstract.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\bspfile_ibsp.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\bspfile_rbsp.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\conv_bsplumps.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\conv_doom.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\conv_image.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\conv_main.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\conv_shader.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\conv_sprite.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\convert_ase.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\convert_map.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\decals.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\dpvencoder.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\facebsp.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\fog.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\image.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\leakfile.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\light.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\light_bounce.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\light_trace.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\light_ydnar.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\lightmaps_ydnar.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\map.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\mesh.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\model.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\patch.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\portals.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\prtfile.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\shaders.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\spritegen.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\studio.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\studio_utils.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\surface.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\surface_extra.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\surface_foliage.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\surface_fur.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\surface_meta.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\tjunction.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\tree.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\utils.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\vis.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\visflow.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\wadlib.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\writebsp.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\xtools.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\bsplib.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\md5.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\polylib.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\picointernal.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\picomodel.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\picomodules.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\pm_3ds.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\pm_ase.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\pm_fm.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\pm_md2.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\pm_md3.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\pm_mdc.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\pm_ms3d.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\pm_obj.obj"
|
||||
"\Xash3D\src_main\temp\xtools\!debug\scriplib.obj"
|
||||
]
|
||||
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BFE.tmp"
|
||||
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BFF.bat" with contents
|
||||
[
|
||||
@echo off
|
||||
copy \Xash3D\src_main\temp\xtools\!debug\xtools.dll "D:\Xash3D\bin\xtools.dll"
|
||||
]
|
||||
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSP1BFF.bat"
|
||||
Compiling...
|
||||
bsplib.c
|
||||
Linking...
|
||||
Creating library ..\temp\xtools\!debug/xtools.lib and object ..\temp\xtools\!debug/xtools.exp
|
||||
<h3>Output Window</h3>
|
||||
Performing Custom Build Step on \Xash3D\src_main\temp\xtools\!debug\xtools.dll
|
||||
‘ª®¯¨à®¢ ® ä ©«®¢: 1.
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
xtools.dll - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue