Skip to content

Commit

Permalink
* fix: don't turn lights with targetname to styled for IBSP, as they …
Browse files Browse the repository at this point in the history
…are not switchable there
  • Loading branch information
Garux committed Aug 17, 2023
1 parent 1da9dbf commit a5bad3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions tools/quake3/q3map2/light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

/* dependencies */
#include "q3map2.h"
#include "bspfile_rbsp.h"



Expand Down Expand Up @@ -330,8 +331,8 @@ static void CreateEntityLights(){
continue;
}

/* lights with target names (and therefore styles) are only parsed from BSP */
if ( !strEmpty( e.valueForKey( "targetname" ) ) && i >= numBSPEntities ) {
/* lights with target names (and therefore styles in RBSP) are only parsed from BSP */
if ( !strEmpty( e.valueForKey( "targetname" ) ) && g_game->load == LoadRBSPFile && i >= numBSPEntities ) {
continue;
}

Expand Down
7 changes: 4 additions & 3 deletions tools/quake3/q3map2/writebsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

/* dependencies */
#include "q3map2.h"
#include "bspfile_rbsp.h"



Expand Down Expand Up @@ -242,7 +243,7 @@ void SetLightStyles(){
/* ydnar: determine if we keep lights in the bsp */
entities[ 0 ].read_keyvalue( keepLights, "_keepLights" );

/* any light that is controlled (has a targetname) must have a unique style number generated for it */
/* any light that is controlled (has a targetname) must have a unique style number generated for it in RBSP */
numStyles = 0;
for ( std::size_t i = 1; i < entities.size(); ++i )
{
Expand All @@ -252,7 +253,7 @@ void SetLightStyles(){
continue;
}
const char *t;
if ( !e.read_keyvalue( t, "targetname" ) ) {
if ( !( e.read_keyvalue( t, "targetname" ) && g_game->load == LoadRBSPFile ) ) { // only RBSP has switchable light styles
/* ydnar: strip the light from the BSP file */
if ( !keepLights ) {
e.epairs.clear();
Expand Down Expand Up @@ -461,7 +462,7 @@ void EmitFogs(){
}

/* warn about overflow */
if( strEqual( g_game->bspIdent, "RBSP" ) ){
if( g_game->load == LoadRBSPFile ){
if( mapFogs.size() > MAX_RBSP_FOGS )
Sys_Warning( "MAX_RBSP_FOGS (%i) exceeded (%zu). Visual inconsistencies are expected.\n", MAX_RBSP_FOGS, mapFogs.size() );
}
Expand Down

0 comments on commit a5bad3d

Please sign in to comment.