diff --git a/include/QF/model.h b/include/QF/model.h index c33ec0006..fe1991ec6 100644 --- a/include/QF/model.h +++ b/include/QF/model.h @@ -482,4 +482,6 @@ extern char loadname[32]; extern byte *mod_base; extern byte mod_novis[MAX_MAP_LEAFS / 8]; +extern int mod_lightmap_bytes; + #endif // _MODEL_H diff --git a/libs/video/renderer/r_cvar.c b/libs/video/renderer/r_cvar.c index 7bcdc510a..33ab20851 100644 --- a/libs/video/renderer/r_cvar.c +++ b/libs/video/renderer/r_cvar.c @@ -37,6 +37,7 @@ static const char rcsid[] = #endif #include "QF/cvar.h" +#include "QF/model.h" #include "r_cvar.h" #include "r_dynamic.h" @@ -146,6 +147,21 @@ r_particles_max_f (cvar_t *var) R_MaxParticlesCheck (r_particles, var); } +static void +r_lightmap_components_f (cvar_t *var) +{ + switch (var->int_val) { + case 1: + mod_lightmap_bytes = 1; + break; + case 3: + case 4: + default: + mod_lightmap_bytes = 3; + break; + } +} + void R_Init_Cvars (void) { @@ -278,7 +294,8 @@ R_Init_Cvars (void) "Set the number of lines displayed in the " "various graphs"); r_lightmap_components = Cvar_Get ("r_lightmap_components", "3", CVAR_ROM, - NULL, "Lightmap texture components. 1 " + r_lightmap_components_f, + "Lightmap texture components. 1 " "is greyscale, 3 is RGB, 4 is RGBA."); r_maxedges = Cvar_Get ("r_maxedges", "0", CVAR_NONE, NULL, "Sets the maximum number of edges"); diff --git a/nq/source/sv_model.c b/nq/source/sv_model.c index 53d9c4472..f39e25c1f 100644 --- a/nq/source/sv_model.c +++ b/nq/source/sv_model.c @@ -35,7 +35,7 @@ static const char rcsid[] = #include "QF/cvar.h" #include "QF/model.h" -const int mod_lightmap_bytes = 1; +int mod_lightmap_bytes = 1; void Mod_LoadBrushModel (model_t *mod, void *buffer); diff --git a/qw/source/sv_model.c b/qw/source/sv_model.c index 53d9c4472..f39e25c1f 100644 --- a/qw/source/sv_model.c +++ b/qw/source/sv_model.c @@ -35,7 +35,7 @@ static const char rcsid[] = #include "QF/cvar.h" #include "QF/model.h" -const int mod_lightmap_bytes = 1; +int mod_lightmap_bytes = 1; void Mod_LoadBrushModel (model_t *mod, void *buffer);