* -keepmodels in -bsp / _keepModels on worldspawn: keep misc_model entities in the BSP file after compile

This commit is contained in:
Garux 2023-08-17 19:22:21 +06:00
parent affe89e774
commit 1da9dbfea9
8 changed files with 35 additions and 20 deletions

View File

@ -139,6 +139,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
<li><strong><code>-flat</code>:</strong> Enable flat shading (good for combining with -celshader)</li>
<li><strong><code>-fulldetail</code>:</strong> Treat detail brushes as structural ones</li>
<li><strong><code>-keeplights</code>:</strong> Keep light entities in the BSP file after compile</li>
<li><strong><code>-keepmodels</code>:</strong> Keep misc_model entities in the BSP file after compile</li>
<li><strong><code>-leaktest</code>:</strong> Abort if a leak was found</li>
<li><strong><code>-maxarea</code>:</strong> Use Max Area face surface generation</li>
<li><strong><code>-meta</code>:</strong> Combine adjacent triangles of the same texture to surfaces (ALWAYS USE THIS)</li>

View File

@ -150,6 +150,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
<li><strong><code>_foghull</code>:</strong> must be set to a sky shader without <strong><code>textures/</code></strong> prefix when <code>_farplanedist</code> is used to avoid HoM effect</li>
<li><strong><code>_ignoreleaks</code>, <code>ignoreleaks</code>:</strong> when set, no leak test is performed</li>
<li><strong><code>_keepLights</code>:</strong> if set, <strong><code>light</code></strong> entities are not stripped from the <code>BSP</code> file when compiling</li>
<li><strong><code>_keepModels</code>:</strong> if set, <strong><code>misc_model</code></strong> entities are not stripped from the <code>BSP</code> file when compiling</li>
<li><strong><code>_maxlight</code>:</strong> amount of maximum light</li>
<li><strong><code>_mingridlight</code>:</strong> amount of minimum grid light</li>
<li><strong><code>_minlight</code>:</strong> amount of minimum light</li>

View File

@ -670,6 +670,10 @@ int BSPMain( Args& args ){
keepLights = true;
Sys_Printf( "Leaving light entities on map after compile\n" );
}
while ( args.takeArg( "-keepmodels" ) ) {
keepModels = true;
Sys_Printf( "Leaving misc_model entities on map after compile\n" );
}
while ( args.takeArg( "-nodetail" ) ) {
Sys_Printf( "Ignoring detail brushes\n" );
nodetail = true;

View File

@ -445,6 +445,13 @@ void InjectCommandLine( const char *stage, const std::vector<const char *>& args
void UnparseEntities(){
StringOutputStream data( 8192 );
/* -keepmodels option: force misc_models to be kept and ignore what the map file says */
if ( keepModels )
entities[0].setKeyValue( "_keepModels", "1" ); // -keepmodels is -bsp option; save key in worldspawn to pass it to the next stages
/* determine if we keep misc_models in the bsp */
entities[ 0 ].read_keyvalue( keepModels, "_keepModels" );
/* run through entity list */
for ( std::size_t i = 0; i < numBSPEntities && i < entities.size(); ++i )
{
@ -455,7 +462,7 @@ void UnparseEntities(){
}
/* ydnar: certain entities get stripped from bsp file */
const char *classname = e.classname();
if ( striEqual( classname, "misc_model" ) ||
if ( ( striEqual( classname, "misc_model" ) && !keepModels ) ||
striEqual( classname, "_decal" ) ||
striEqual( classname, "_skybox" ) ) {
continue;

View File

@ -922,22 +922,22 @@ struct game_ja : game_sof2
const std::vector<game_t> g_games = { game_quake3(),
game_quakelive(),
game_nexuiz(),
game_xonotic(),
game_tremulous(),
game_unvanquished(),
game_tenebrae(),
game_wolf(),
game_wolfet(),
game_etut(),
game_ef(),
game_qfusion(),
game_reaction(),
game_darkplaces(),
game_dq(),
game_prophecy(),
game_sof2(),
game_jk2(),
game_ja(),
};
game_nexuiz(),
game_xonotic(),
game_tremulous(),
game_unvanquished(),
game_tenebrae(),
game_wolf(),
game_wolfet(),
game_etut(),
game_ef(),
game_qfusion(),
game_reaction(),
game_darkplaces(),
game_dq(),
game_prophecy(),
game_sof2(),
game_jk2(),
game_ja(),
};
const game_t *g_game = &g_games[0];

View File

@ -102,6 +102,7 @@ static void HelpBsp()
{"-flat", "Enable flat shading (good for combining with -celshader)"},
{"-fulldetail", "Treat detail brushes as structural ones"},
{"-keeplights", "Keep light entities in the BSP file after compile"},
{"-keepmodels", "Keep misc_model entities in the BSP file after compile"},
{"-leaktest", "Abort if a leak was found"},
{"-maxarea", "Use Max Area face surface generation"},
{"-meta", "Combine adjacent triangles of the same texture to surfaces (ALWAYS USE THIS)"},

View File

@ -1771,6 +1771,7 @@ inline int metaGoodScore = -1;
inline bool g_noob;
inline String64 globalCelShader;
inline bool keepLights;
inline bool keepModels;
#if Q3MAP2_EXPERIMENTAL_SNAP_NORMAL_FIX
// Increasing the normalEpsilon to compensate for new logic in SnapNormal(), where

View File

@ -236,7 +236,7 @@ void SetLightStyles(){
/* -keeplights option: force lights to be kept and ignore what the map file says */
if ( keepLights ) {
entities[0].setKeyValue( "_keepLights", "1" );
entities[0].setKeyValue( "_keepLights", "1" ); // -keeplights is -bsp option; save key in worldspawn to pass it to the next stages
}
/* ydnar: determine if we keep lights in the bsp */