]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
mod_q3bsp_nolightmaps: do not load lightmaps, use the bad q3map2-written vertex light...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 25 Oct 2008 10:37:40 +0000 (10:37 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 25 Oct 2008 10:37:40 +0000 (10:37 +0000)
modplug: turn up the volume, if the installed libmodplug allows it.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8539 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c
snd_modplug.c

index e7f1f1318a4d369b98df28891fdd5d146598f292..648af66055ca30bc88abc86854ac7e65f92d8b41 100644 (file)
@@ -43,6 +43,7 @@ cvar_t mod_q3bsp_curves_collisions = {0, "mod_q3bsp_curves_collisions", "1", "en
 cvar_t mod_q3bsp_optimizedtraceline = {0, "mod_q3bsp_optimizedtraceline", "1", "whether to use optimized traceline code for line traces (as opposed to tracebox code)"};
 cvar_t mod_q3bsp_debugtracebrush = {0, "mod_q3bsp_debugtracebrush", "0", "selects different tracebrush bsp recursion algorithms (for debugging purposes only)"};
 cvar_t mod_q3bsp_lightmapmergepower = {CVAR_SAVE, "mod_q3bsp_lightmapmergepower", "4", "merges the quake3 128x128 lightmap textures into larger lightmap group textures to speed up rendering, 1 = 256x256, 2 = 512x512, 3 = 1024x1024, 4 = 2048x2048, 5 = 4096x4096, ..."};
+cvar_t mod_q3bsp_nolightmaps = {CVAR_SAVE, "mod_q3bsp_nolightmaps", "0", "do not load lightmaps in Q3BSP maps (to save video RAM, but be warned: it looks ugly)"};
 
 static texture_t mod_q1bsp_texture_solid;
 static texture_t mod_q1bsp_texture_sky;
@@ -69,6 +70,7 @@ void Mod_BrushInit(void)
        Cvar_RegisterVariable(&mod_q3bsp_optimizedtraceline);
        Cvar_RegisterVariable(&mod_q3bsp_debugtracebrush);
        Cvar_RegisterVariable(&mod_q3bsp_lightmapmergepower);
+       Cvar_RegisterVariable(&mod_q3bsp_nolightmaps);
 
        memset(&mod_q1bsp_texture_solid, 0, sizeof(mod_q1bsp_texture_solid));
        strlcpy(mod_q1bsp_texture_solid.name, "solid" , sizeof(mod_q1bsp_texture_solid.name));
@@ -4477,7 +4479,11 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump)
        if (cls.state == ca_dedicated)
                return;
 
-       if(l->filelen)
+       if(mod_q3bsp_nolightmaps.integer)
+       {
+               return;
+       }
+       else if(l->filelen)
        {
                // prefer internal LMs for compatibility (a BSP contains no info on whether external LMs exist)
                if (developer_loading.integer)
@@ -4749,7 +4755,8 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l)
                                n = -1;
                        else if (n >= loadmodel->brushq3.num_originallightmaps)
                        {
-                               Con_Printf("Mod_Q3BSP_LoadFaces: face #%i (texture \"%s\"): invalid lightmapindex %i (%i lightmaps)\n", i, out->texture->name, n, loadmodel->brushq3.num_originallightmaps);
+                               if(loadmodel->brushq3.num_originallightmaps != 0)
+                                       Con_Printf("Mod_Q3BSP_LoadFaces: face #%i (texture \"%s\"): invalid lightmapindex %i (%i lightmaps)\n", i, out->texture->name, n, loadmodel->brushq3.num_originallightmaps);
                                n = -1;
                        }
                        else
index a3179868200f419615c7edfc7a1a9c59be2ebebe..35b255c91e7f57e2ac2c79bcb2a439b32219c757 100644 (file)
@@ -96,6 +96,8 @@ static int (*ModPlug_Read) (ModPlugFile* file, void* buffer, int size);
 static void (*ModPlug_Seek) (ModPlugFile* file, int millisecond);
 static void (*ModPlug_GetSettings) (ModPlug_Settings* settings);
 static void (*ModPlug_SetSettings) (const ModPlug_Settings* settings);
+static void (*ModPlug_SetMasterVolume) (ModPlugFile* file,unsigned int cvol) ;
+
 
 static dllfunction_t modplugfuncs[] =
 {
@@ -155,7 +157,15 @@ qboolean ModPlug_OpenLibrary (void)
        // Load the DLLs
        // We need to load both by hand because some OSes seem to not load
        // the modplug DLL automatically when loading the modplugFile DLL
-       return Sys_LoadLibrary (dllnames_modplug, &modplug_dll, modplugfuncs);
+       if(Sys_LoadLibrary (dllnames_modplug, &modplug_dll, modplugfuncs))
+       {
+               ModPlug_SetMasterVolume = Sys_GetProcAddress(modplug_dll, "ModPlug_SetMasterVolume");
+               if(!ModPlug_SetMasterVolume)
+                       Con_Print("Warning: modplug volume control not supported. Try getting a newer version of libmodplug.\n");
+               return true;
+       }
+       else
+               return false;
 }
 
 
@@ -245,6 +255,10 @@ static const snd_buffer_t* ModPlug_FetchSound (void *sfxfetcher, void **chfetche
                        Mem_Free (per_ch);
                        return NULL;
                }
+
+               if(ModPlug_SetMasterVolume)
+                       ModPlug_SetMasterVolume(per_ch->mf, 512); // max volume, DP scales down!
+
                per_ch->bs = 0;
 
                per_ch->sb_offset = 0;
@@ -452,6 +466,9 @@ qboolean ModPlug_LoadModPlugFile (const char *filename, sfx_t *sfx)
                return false;
        }
 
+       if(ModPlug_SetMasterVolume)
+               ModPlug_SetMasterVolume(mf, 512); // max volume, DP scales down!
+
        if (developer_loading.integer >= 2)
                Con_Printf ("\"%s\" will be streamed\n", filename);
        per_sfx = (modplug_stream_persfx_t *)Mem_Alloc (snd_mempool, sizeof (*per_sfx));