diff --git a/docs/Complete_list_of_command_line_parameters.htm b/docs/Complete_list_of_command_line_parameters.htm
index 0c5d7b3f..6d0b735f 100644
--- a/docs/Complete_list_of_command_line_parameters.htm
+++ b/docs/Complete_list_of_command_line_parameters.htm
@@ -139,6 +139,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
-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)
diff --git a/docs/Complete_list_of_entity_keys.htm b/docs/Complete_list_of_entity_keys.htm
index 6ff39fd6..d049c33f 100644
--- a/docs/Complete_list_of_entity_keys.htm
+++ b/docs/Complete_list_of_entity_keys.htm
@@ -150,6 +150,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
_foghull: must be set to a sky shader without textures/ prefix when _farplanedist is used to avoid HoM effect
_ignoreleaks, ignoreleaks: when set, no leak test is performed
_keepLights: if set, light entities are not stripped from the BSP file when compiling
+ _keepModels: if set, misc_model entities are not stripped from the BSP file when compiling
_maxlight: amount of maximum light
_mingridlight: amount of minimum grid light
_minlight: amount of minimum light
diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp
index 4ae7e56a..653591f9 100644
--- a/tools/quake3/q3map2/bsp.cpp
+++ b/tools/quake3/q3map2/bsp.cpp
@@ -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;
diff --git a/tools/quake3/q3map2/bspfile_abstract.cpp b/tools/quake3/q3map2/bspfile_abstract.cpp
index 65b35b86..c82d56b6 100644
--- a/tools/quake3/q3map2/bspfile_abstract.cpp
+++ b/tools/quake3/q3map2/bspfile_abstract.cpp
@@ -445,6 +445,13 @@ void InjectCommandLine( const char *stage, const std::vector& 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;
diff --git a/tools/quake3/q3map2/games.cpp b/tools/quake3/q3map2/games.cpp
index e0686e1d..f93adea2 100644
--- a/tools/quake3/q3map2/games.cpp
+++ b/tools/quake3/q3map2/games.cpp
@@ -922,22 +922,22 @@ struct game_ja : game_sof2
const std::vector 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];
diff --git a/tools/quake3/q3map2/help.cpp b/tools/quake3/q3map2/help.cpp
index c711f096..a2023ab4 100644
--- a/tools/quake3/q3map2/help.cpp
+++ b/tools/quake3/q3map2/help.cpp
@@ -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)"},
diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h
index 4bf58d4a..66466cc6 100644
--- a/tools/quake3/q3map2/q3map2.h
+++ b/tools/quake3/q3map2/q3map2.h
@@ -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
diff --git a/tools/quake3/q3map2/writebsp.cpp b/tools/quake3/q3map2/writebsp.cpp
index 038f791c..42171460 100644
--- a/tools/quake3/q3map2/writebsp.cpp
+++ b/tools/quake3/q3map2/writebsp.cpp
@@ -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 */