|
If you've followed the QSG Coloured Lighting Tutorials (and who hasn't?) you may have noticed a bug when you add a Brush Model (eg. a Health Box/Ammo Box/Exploding Box) to a map. Because the Brush Model is a different Version to the BSP, the engine will get confused. There are a number of possible solutions to this: you could expand White Light for a version 29 BSP to RGBA in Mod_LoadLighting, or make Coloured Light versions of the Models for use in a map with coloured light in it, for example. I offer a totally different way, that lets you get away with this with a minimum of messing around, and also lets you put Brush Models with Coloured Light in a BSP with White Light. This is a true fix, not a work-around. (Note: If the parameters to any functions are changed, you'll also have to change the prototypes for the functions. But you already knew that.) 1. gl_model.h changes.Look for the definition of the msurface_s/msurface_t structure and add the following right at the very end:
// coloured lighting
qboolean rgb; // true if surface is lit in colour
2. gl_model.c changes. Look for the Mod_loadFaces function. Replace the declaration with this:
void Mod_LoadFaces (lump_t *l, int is_coloured)
if (is_coloured)
out->rgb = true;
else out->rgb = false;
if (!bspextensions)
bspextensions = i - BSPVERSION;
bspextensions = i - BSPVERSION;
Mod_LoadFaces (&header->lumps[LUMP_FACES], bspextensions);
mod->numframes = 2; // regular and alternate animation
// MFAH - reset bspextensions for the next brush model
bspextensions = 0;
// MFAH - reset bspextensions for the next brush model
3. gl_rsurf.c changes. In the R_BuildLightMap function, replace the entire if (lightmap) block with:
if (lightmap)
{
if (surf->rgb)
{
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ; maps++)
{
scale = d_lightstylevalue[surf->styles[maps]];
surf->cached_light[maps] = scale; // 8.8 fraction
for (i=0, j=0 ; iGo to the SV_SpawnServer function, and right at the top (after the variables) add:
// MFAH - reset bspextensions for the next server
bspextensions = 0;
// MFAH - reset bspextensions for the next server
The usual compile and enjoy final directives apply... |