From 68dba8b4e08c6f159f8cc890885fac31509f2e6a Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 9 Apr 2026 11:58:15 +0500 Subject: [PATCH] engine: add litwater support --- engine/common/mod_bmodel.c | 12 ++++++++++++ engine/common/mod_local.h | 4 ++++ engine/ref_api.h | 1 + 3 files changed, 17 insertions(+) diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index 4b8245a9..59bcfe1e 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -2407,6 +2407,9 @@ static void Mod_LoadEntities( model_t *mod, const dbspmodel_t *bmod ) world.wadlist = NULL; world.wadcount = 0; + world.litwater_minlight = -1; + world.litwater_scale = -1.0f; + // parse all the wads for loading textures in right ordering while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL ) { @@ -2450,6 +2453,15 @@ static void Mod_LoadEntities( model_t *mod, const dbspmodel_t *bmod ) Mem_Free( world.generator ); world.generator = copystring( token ); } + else if( !Q_stricmp( keyname, "_litwater" )) + { + if( Q_atoi( token ) != 0 ) + SetBits( world.flags, FWORLD_HAS_LITWATER ); + } + else if( !Q_stricmp( keyname, "_litwater_minlight" )) + world.litwater_minlight = Q_atoi( token ); + else if( !Q_stricmp( keyname, "_litwater_scale" )) + world.litwater_scale = Q_atof( token ); } return; // all done } diff --git a/engine/common/mod_local.h b/engine/common/mod_local.h index e1c32351..cd2cc234 100644 --- a/engine/common/mod_local.h +++ b/engine/common/mod_local.h @@ -124,6 +124,10 @@ typedef struct world_static_s wadentry_t *wadlist; int wadcount; + + // lightmapped water extra info + float litwater_scale; + int litwater_minlight; } world_static_t; #ifndef REF_DLL diff --git a/engine/ref_api.h b/engine/ref_api.h index 7b9f8253..72999f8c 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -105,6 +105,7 @@ GNU General Public License for more details. #define FWORLD_CUSTOM_SKYBOX BIT( 1 ) #define FWORLD_WATERALPHA BIT( 2 ) #define FWORLD_HAS_DELUXEMAP BIT( 3 ) +#define FWORLD_HAS_LITWATER BIT( 4 ) // special rendermode for screenfade modulate // (probably will be expanded at some point)