1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 03:56:10 +08:00

Sync with upstream (Issue #30).

Recompiled tier1 and mathlib  for all platforms will come in next commit.
This commit is contained in:
Nicholas Hastings
2016-11-30 10:01:15 -05:00
parent 98fe5b5a34
commit 3957adff10
491 changed files with 29846 additions and 10698 deletions

View File

@ -66,6 +66,8 @@ int g_nDXLevel = 0; // default dxlevel if you don't specify it on the command-
CUtlVector<int> g_SkyAreas;
char outbase[32];
char g_szEmbedDir[MAX_PATH] = { 0 };
// HLTOOLS: Introduce these calcs to make the block algorithm proportional to the proper
// world coordinate extents. Assumes square spatial constraints.
#define BLOCKS_SIZE 1024
@ -896,6 +898,12 @@ int RunVBSP( int argc, char **argv )
Q_FileBase( source, mapbase, sizeof( mapbase ) );
strlwr( mapbase );
// Maintaining legacy behavior here to avoid breaking tools: regardless of the extension we are passed, we strip it
// to get the "source" name, and append extensions as desired...
char mapFile[1024];
V_strncpy( mapFile, source, sizeof( mapFile ) );
V_strncat( mapFile, ".bsp", sizeof( mapFile ) );
LoadCmdLineFromFile( argc, argv, mapbase, "vbsp" );
Msg( "Valve Software - vbsp.exe (%s)\n", __DATE__ );
@ -1095,7 +1103,7 @@ int RunVBSP( int argc, char **argv )
{
// nothing to do here, but don't bail on this option
}
else if ( !Q_stricmp( argv[i], "-vproject" ) || !Q_stricmp( argv[i], "-game" ) )
else if ( !Q_stricmp( argv[i], "-vproject" ) || !Q_stricmp( argv[i], "-game" ) || !Q_stricmp( argv[i], "-insert_search_path" ) )
{
++i;
}
@ -1129,6 +1137,19 @@ int RunVBSP( int argc, char **argv )
{
EnableFullMinidumps( true );
}
else if ( !Q_stricmp( argv[i], "-embed" ) && i < argc - 1 )
{
V_MakeAbsolutePath( g_szEmbedDir, sizeof( g_szEmbedDir ), argv[++i], "." );
V_FixSlashes( g_szEmbedDir );
if ( !V_RemoveDotSlashes( g_szEmbedDir ) )
{
Error( "Bad -embed - Can't resolve pathname for '%s'", g_szEmbedDir );
break;
}
V_StripTrailingSlash( g_szEmbedDir );
g_pFullFileSystem->AddSearchPath( g_szEmbedDir, "GAME", PATH_ADD_TO_TAIL );
g_pFullFileSystem->AddSearchPath( g_szEmbedDir, "MOD", PATH_ADD_TO_TAIL );
}
else if (argv[i][0] == '-')
{
Warning("VBSP: Unknown option \"%s\"\n\n", argv[i]);
@ -1162,6 +1183,9 @@ int RunVBSP( int argc, char **argv )
" what affects visibility.\n"
" -nowater : Get rid of water brushes.\n"
" -low : Run as an idle-priority process.\n"
" -embed <directory> : Use <directory> as an additional search path for assets\n"
" and embed all assets in this directory into the compiled\n"
" map\n"
"\n"
" -vproject <directory> : Override the VPROJECT environment variable.\n"
" -game <directory> : Same as -vproject.\n"
@ -1220,6 +1244,17 @@ int RunVBSP( int argc, char **argv )
CmdLib_Exit( 1 );
}
// Sanity check
if ( *g_szEmbedDir && ( onlyents || onlyprops ) )
{
Warning( "-embed only makes sense alongside full BSP compiles.\n"
"\n"
"Use the bspzip utility to update embedded files.\n" );
DeleteCmdLine( argc, argv );
CmdLib_Cleanup();
CmdLib_Exit( 1 );
}
start = Plat_FloatTime();
// Run in the background?
@ -1261,7 +1296,7 @@ int RunVBSP( int argc, char **argv )
sprintf( materialPath, "%smaterials", gamedir );
InitMaterialSystem( materialPath, CmdLib_GetFileSystemFactory() );
Msg( "materialPath: %s\n", materialPath );
// delete portal and line files
sprintf (path, "%s.prt", source);
remove (path);
@ -1280,9 +1315,6 @@ int RunVBSP( int argc, char **argv )
}
}
char platformBSPFileName[1024];
GetPlatformMapPath( source, platformBSPFileName, g_nDXLevel, 1024 );
// if we're combining materials, load the script file
if ( g_ReplaceMaterials )
{
@ -1294,7 +1326,7 @@ int RunVBSP( int argc, char **argv )
//
if (onlyents)
{
LoadBSPFile (platformBSPFileName);
LoadBSPFile (mapFile);
num_entities = 0;
// Clear out the cubemap samples since they will be reparsed even with -onlyents
g_nCubemapSamples = 0;
@ -1326,12 +1358,12 @@ int RunVBSP( int argc, char **argv )
// Doing this here because stuff abov may filter out entities
UnparseEntities ();
WriteBSPFile (platformBSPFileName);
WriteBSPFile (mapFile);
}
else if (onlyprops)
{
// In the only props case, deal with static + detail props only
LoadBSPFile (platformBSPFileName);
LoadBSPFile (mapFile);
LoadMapFile(name);
SetModelNumbers();
@ -1344,7 +1376,7 @@ int RunVBSP( int argc, char **argv )
LoadEmitDetailObjectDictionary( gamedir );
EmitDetailObjects();
WriteBSPFile (platformBSPFileName);
WriteBSPFile (mapFile);
}
else
{
@ -1353,9 +1385,9 @@ int RunVBSP( int argc, char **argv )
//
// Load just the file system from the bsp
if( g_bKeepStaleZip && FileExists( platformBSPFileName ) )
if( g_bKeepStaleZip && FileExists( mapFile ) )
{
LoadBSPFile_FileSystemOnly (platformBSPFileName);
LoadBSPFile_FileSystemOnly (mapFile);
// Mark as stale since the lighting could be screwed with new ents.
AddBufferToPak( GetPakFile(), "stale.txt", "stale", strlen( "stale" ) + 1, false );
}
@ -1372,6 +1404,13 @@ int RunVBSP( int argc, char **argv )
SetLightStyles ();
LoadEmitDetailObjectDictionary( gamedir );
ProcessModels ();
// Add embed dir if provided
if ( *g_szEmbedDir )
{
AddDirToPak( GetPakFile(), g_szEmbedDir );
WriteBSPFile( mapFile );
}
}
end = Plat_FloatTime();

View File

@ -178,6 +178,7 @@ $Project "Vbsp"
$Lib mathlib
$Lib tier2
$Lib vtf
$Lib "$LIBCOMMON/lzma"
}
$File "notes.txt"

View File

@ -1271,23 +1271,24 @@ void EndBSPFile (void)
// Compute bounds after creating disp info because we need to reference it
ComputeBoundsNoSkybox();
// Make sure that we have a water lod control eneity if we have water in the map.
EnsurePresenceOfWaterLODControlEntity();
// Doing this here because stuff about may filter out entities
UnparseEntities ();
// remove unused texinfos
CompactTexinfos();
// Figure out which faces want macro textures.
DiscoverMacroTextures();
char targetPath[1024];
GetPlatformMapPath( source, targetPath, g_nDXLevel, 1024 );
Msg ("Writing %s\n", targetPath);
WriteBSPFile (targetPath);
char fileName[1024];
V_strncpy( fileName, source, sizeof( fileName ) );
V_DefaultExtension( fileName, ".bsp", sizeof( fileName ) );
Msg ("Writing %s\n", fileName);
WriteBSPFile (fileName);
}