mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
* gl_screen.c: removed oldscreensize, oldfov, oldsbarscale, oldsbaralpha.
use the callbacks for scr_fov, scr_viewsize, scr_conwidth & scr_conscale changes by simply setting vid.recalc_refdef to 1: now that Cvar_Set() doesn't do anything when there is no change, this has the same effect. * snd_dma.c: removed oldvol, set a callback to sfxvol in order to call SND_InitScaletable() upon every volume change. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@567 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
1928f2e1b8
commit
e2a17c9bcf
2 changed files with 20 additions and 43 deletions
|
@ -77,8 +77,6 @@ int glx, gly, glwidth, glheight;
|
|||
float scr_con_current;
|
||||
float scr_conlines; // lines of console to display
|
||||
|
||||
float oldscreensize, oldfov, oldsbarscale, oldsbaralpha; //johnfitz -- added oldsbarscale and oldsbaralpha
|
||||
|
||||
//johnfitz -- new cvars
|
||||
cvar_t scr_menuscale = {"scr_menuscale", "1", CVAR_ARCHIVE};
|
||||
cvar_t scr_sbarscale = {"scr_sbarscale", "1", CVAR_ARCHIVE};
|
||||
|
@ -261,8 +259,6 @@ static void SCR_CalcRefdef (void)
|
|||
{
|
||||
float size, scale; //johnfitz -- scale
|
||||
|
||||
vid.recalc_refdef = 0;
|
||||
|
||||
// force the status bar to redraw
|
||||
Sbar_Changed ();
|
||||
|
||||
|
@ -280,6 +276,8 @@ static void SCR_CalcRefdef (void)
|
|||
if (scr_fov.value > 170)
|
||||
Cvar_Set ("fov","170");
|
||||
|
||||
vid.recalc_refdef = 0;
|
||||
|
||||
//johnfitz -- rewrote this section
|
||||
size = scr_viewsize.value;
|
||||
scale = CLAMP (1.0, scr_sbarscale.value, (float)glwidth / 320.0);
|
||||
|
@ -318,7 +316,6 @@ Keybinding command
|
|||
void SCR_SizeUp_f (void)
|
||||
{
|
||||
Cvar_SetValue ("viewsize",scr_viewsize.value+10);
|
||||
vid.recalc_refdef = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -332,6 +329,10 @@ Keybinding command
|
|||
void SCR_SizeDown_f (void)
|
||||
{
|
||||
Cvar_SetValue ("viewsize",scr_viewsize.value-10);
|
||||
}
|
||||
|
||||
static void SCR_Callback_refdef (cvar_t *var)
|
||||
{
|
||||
vid.recalc_refdef = 1;
|
||||
}
|
||||
|
||||
|
@ -342,6 +343,7 @@ SCR_Conwidth_f -- johnfitz -- called when scr_conwidth or scr_conscale changes
|
|||
*/
|
||||
void SCR_Conwidth_f (cvar_t *var)
|
||||
{
|
||||
vid.recalc_refdef = 1;
|
||||
vid.conwidth = (scr_conwidth.value > 0) ? (int)scr_conwidth.value : (scr_conscale.value > 0) ? (int)(vid.width/scr_conscale.value) : vid.width;
|
||||
vid.conwidth = CLAMP (320, vid.conwidth, vid.width);
|
||||
vid.conwidth &= 0xFFFFFFF8;
|
||||
|
@ -372,16 +374,17 @@ void SCR_Init (void)
|
|||
Cvar_RegisterVariable (&scr_menuscale);
|
||||
Cvar_RegisterVariable (&scr_sbarscale);
|
||||
Cvar_RegisterVariable (&scr_sbaralpha);
|
||||
Cvar_RegisterVariable (&scr_conwidth);
|
||||
Cvar_RegisterVariable (&scr_conscale);
|
||||
Cvar_SetCallback (&scr_conwidth, &SCR_Conwidth_f);
|
||||
Cvar_SetCallback (&scr_conscale, &SCR_Conwidth_f);
|
||||
Cvar_RegisterVariable (&scr_conwidth);
|
||||
Cvar_RegisterVariable (&scr_conscale);
|
||||
Cvar_RegisterVariable (&scr_scale);
|
||||
Cvar_RegisterVariable (&scr_crosshairscale);
|
||||
Cvar_RegisterVariable (&scr_showfps);
|
||||
Cvar_RegisterVariable (&scr_clock);
|
||||
//johnfitz
|
||||
|
||||
Cvar_SetCallback (&scr_fov, SCR_Callback_refdef);
|
||||
Cvar_SetCallback (&scr_viewsize, SCR_Callback_refdef);
|
||||
Cvar_RegisterVariable (&scr_fov);
|
||||
Cvar_RegisterVariable (&scr_viewsize);
|
||||
Cvar_RegisterVariable (&scr_conspeed);
|
||||
|
@ -981,33 +984,6 @@ void SCR_UpdateScreen (void)
|
|||
//
|
||||
// determine size of refresh window
|
||||
//
|
||||
|
||||
if (oldfov != scr_fov.value)
|
||||
{
|
||||
oldfov = scr_fov.value;
|
||||
vid.recalc_refdef = true;
|
||||
}
|
||||
|
||||
if (oldscreensize != scr_viewsize.value)
|
||||
{
|
||||
oldscreensize = scr_viewsize.value;
|
||||
vid.recalc_refdef = true;
|
||||
}
|
||||
|
||||
//johnfitz -- added oldsbarscale and oldsbaralpha
|
||||
if (oldsbarscale != scr_sbarscale.value)
|
||||
{
|
||||
oldsbarscale = scr_sbarscale.value;
|
||||
vid.recalc_refdef = true;
|
||||
}
|
||||
|
||||
if (oldsbaralpha != scr_sbaralpha.value)
|
||||
{
|
||||
oldsbaralpha = scr_sbaralpha.value;
|
||||
vid.recalc_refdef = true;
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
if (vid.recalc_refdef)
|
||||
SCR_CalcRefdef ();
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
// snd_dma.c -- main control for any streaming sound output device
|
||||
|
||||
#include "quakedef.h"
|
||||
|
@ -76,8 +77,6 @@ cvar_t loadas8bit = {"loadas8bit", "0", CVAR_NONE};
|
|||
|
||||
cvar_t sndspeed = {"sndspeed", "11025", CVAR_NONE};
|
||||
|
||||
static float oldvolume = -1.0;
|
||||
|
||||
static cvar_t nosound = {"nosound", "0", CVAR_NONE};
|
||||
static cvar_t ambient_level = {"ambient_level", "0.3", CVAR_NONE};
|
||||
static cvar_t ambient_fade = {"ambient_fade", "100", CVAR_NONE};
|
||||
|
@ -104,6 +103,12 @@ static void S_SoundInfo_f (void)
|
|||
}
|
||||
|
||||
|
||||
static void SND_Callback_sfxvolume (cvar_t *var)
|
||||
{
|
||||
SND_InitScaletable ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
S_Startup
|
||||
|
@ -180,6 +185,8 @@ void S_Init (void)
|
|||
Con_Printf ("loading all sounds as 8bit\n");
|
||||
}
|
||||
|
||||
Cvar_SetCallback(&sfxvolume, SND_Callback_sfxvolume);
|
||||
|
||||
SND_InitScaletable ();
|
||||
|
||||
known_sfx = (sfx_t *) Hunk_AllocName (MAX_SFX*sizeof(sfx_t), "sfx_t");
|
||||
|
@ -760,12 +767,6 @@ void S_Update (vec3_t origin, vec3_t forward, vec3_t right, vec3_t up)
|
|||
if (!sound_started || (snd_blocked > 0))
|
||||
return;
|
||||
|
||||
if (sfxvolume.value != oldvolume)
|
||||
{
|
||||
oldvolume = sfxvolume.value;
|
||||
SND_InitScaletable ();
|
||||
}
|
||||
|
||||
VectorCopy(origin, listener_origin);
|
||||
VectorCopy(forward, listener_forward);
|
||||
VectorCopy(right, listener_right);
|
||||
|
|
Loading…
Reference in a new issue