Skip to content

Commit 7a4b44c

Browse files
committed
Clean up w/ initial values of world lighting params
1 parent 399ba8f commit 7a4b44c

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/engine/renderer/tr_bsp.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5039,11 +5039,15 @@ void RE_LoadWorldMap( const char *name )
50395039
// try will not look at the partially loaded version
50405040
tr.world = nullptr;
50415041

5042-
// tr.worldDeluxeMapping will be set by R_LoadLightmaps()
5043-
tr.worldLightMapping = false;
5044-
// tr.worldDeluxeMapping will be set by R_LoadEntities()
5045-
tr.worldDeluxeMapping = false;
5046-
tr.worldHDR_RGBE = false;
5042+
// It's probably a mistake if any of these lighting parameters are actually
5043+
// used before a map is loaded.
5044+
tr.worldLightMapping = false; // set by R_LoadLightmaps
5045+
tr.worldDeluxeMapping = false; // set by R_LoadEntities
5046+
tr.worldHDR_RGBE = false; // set by R_LoadEntities
5047+
tr.mapOverBrightBits = r_overbrightDefaultExponent.Get(); // maybe set by R_LoadEntities
5048+
tr.overbrightBits = std::min( tr.mapOverBrightBits, r_overbrightBits.Get() ); // set by RE_LoadWorldMap
5049+
tr.mapLightFactor = 1.0f; // set by RE_LoadWorldMap
5050+
tr.identityLight = 1.0f; // set by RE_LoadWorldMap
50475051

50485052
s_worldData = {};
50495053
Q_strncpyz( s_worldData.name, name, sizeof( s_worldData.name ) );
@@ -5131,7 +5135,6 @@ void RE_LoadWorldMap( const char *name )
51315135
tr.worldLight = tr.lightMode;
51325136
tr.modelLight = lightMode_t::FULLBRIGHT;
51335137
tr.modelDeluxe = deluxeMode_t::NONE;
5134-
tr.mapLightFactor = tr.identityLight = 1.0f;
51355138

51365139
// Use fullbright lighting for everything if the world is fullbright.
51375140
if ( tr.worldLight != lightMode_t::FULLBRIGHT )

src/engine/renderer/tr_image.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,10 +3120,6 @@ void R_InitImages()
31203120
For even more information, see https://github.com/DaemonEngine/Daemon/issues/1542.
31213121
*/
31223122

3123-
// TODO is there any reason to set these before a map is loaded?
3124-
tr.mapOverBrightBits = r_overbrightDefaultExponent.Get();
3125-
tr.overbrightBits = std::min(tr.mapOverBrightBits, r_overbrightBits.Get());
3126-
31273123
// create default texture and white texture
31283124
R_CreateBuiltinImages();
31293125
}

0 commit comments

Comments
 (0)