musicvolume uses callback, cosmetic fix to qclib, disabled sw r_drawflat until there's a solution to make it like gl's r_drawflat
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2250 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
18de9855ae
commit
913e26b1ae
8 changed files with 70 additions and 81 deletions
|
@ -46,7 +46,6 @@ static qboolean wasPlaying = false;
|
||||||
static qboolean initialized = false;
|
static qboolean initialized = false;
|
||||||
static qboolean enabled = true;
|
static qboolean enabled = true;
|
||||||
static qboolean playLooping = false;
|
static qboolean playLooping = false;
|
||||||
static float cdvolume;
|
|
||||||
static qbyte remap[100];
|
static qbyte remap[100];
|
||||||
static qbyte playTrack;
|
static qbyte playTrack;
|
||||||
static qbyte maxTrack;
|
static qbyte maxTrack;
|
||||||
|
@ -160,7 +159,7 @@ void CDAudio_Play(int track, qboolean looping)
|
||||||
playTrack = track;
|
playTrack = track;
|
||||||
playing = true;
|
playing = true;
|
||||||
|
|
||||||
if (cdvolume == 0.0)
|
if (!bgmvolume.value)
|
||||||
CDAudio_Pause ();
|
CDAudio_Pause ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +329,21 @@ static void CD_f (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BGMVolume_Callback(struct cvar_s *var, char *oldvalue)
|
||||||
|
{
|
||||||
|
int cdvolume;
|
||||||
|
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
cdvolume = atof(oldvalue);
|
||||||
|
|
||||||
|
if (cdvolume && !var->value)
|
||||||
|
CDAudio_Pause ();
|
||||||
|
else if (!cdvolume && var->value)
|
||||||
|
CDAudio_Resume ();
|
||||||
|
}
|
||||||
|
|
||||||
void CDAudio_Update(void)
|
void CDAudio_Update(void)
|
||||||
{
|
{
|
||||||
struct cdrom_subchnl subchnl;
|
struct cdrom_subchnl subchnl;
|
||||||
|
@ -338,22 +352,6 @@ void CDAudio_Update(void)
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bgmvolume.value != cdvolume)
|
|
||||||
{
|
|
||||||
if (cdvolume)
|
|
||||||
{
|
|
||||||
Cvar_SetValue (&bgmvolume, 0.0);
|
|
||||||
cdvolume = bgmvolume.value;
|
|
||||||
CDAudio_Pause ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Cvar_SetValue (&bgmvolume, 1.0);
|
|
||||||
cdvolume = bgmvolume.value;
|
|
||||||
CDAudio_Resume ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playing && lastchk < time(NULL)) {
|
if (playing && lastchk < time(NULL)) {
|
||||||
lastchk = time(NULL) + 2; //two seconds between chks
|
lastchk = time(NULL) + 2; //two seconds between chks
|
||||||
subchnl.cdsc_format = CDROM_MSF;
|
subchnl.cdsc_format = CDROM_MSF;
|
||||||
|
@ -407,6 +405,8 @@ int CDAudio_Init(void)
|
||||||
|
|
||||||
Cmd_AddCommand ("cd", CD_f);
|
Cmd_AddCommand ("cd", CD_f);
|
||||||
|
|
||||||
|
Cvar_Hook(&bgmvolume, BGMVolume_Callback);
|
||||||
|
|
||||||
Con_Printf("CD Audio Initialized\n");
|
Con_Printf("CD Audio Initialized\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -420,5 +420,6 @@ void CDAudio_Shutdown(void)
|
||||||
CDAudio_Stop();
|
CDAudio_Stop();
|
||||||
close(cdfile);
|
close(cdfile);
|
||||||
cdfile = -1;
|
cdfile = -1;
|
||||||
|
Cvar_Unhook(&bgmvolume);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,7 +10,6 @@ static qboolean wasPlaying = false;
|
||||||
static qboolean initialized = false;
|
static qboolean initialized = false;
|
||||||
static qboolean enabled = false;
|
static qboolean enabled = false;
|
||||||
static qboolean playLooping = false;
|
static qboolean playLooping = false;
|
||||||
static float cdvolume;
|
|
||||||
static qbyte remap[100];
|
static qbyte remap[100];
|
||||||
static qbyte playTrack;
|
static qbyte playTrack;
|
||||||
static qbyte maxTrack;
|
static qbyte maxTrack;
|
||||||
|
@ -90,7 +89,7 @@ void CDAudio_Play(int track, qboolean looping)
|
||||||
playTrack = track;
|
playTrack = track;
|
||||||
playing = true;
|
playing = true;
|
||||||
|
|
||||||
if (cdvolume == 0.0)
|
if (!bgmvolume.value)
|
||||||
CDAudio_Pause ();
|
CDAudio_Pause ();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -306,26 +305,23 @@ LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CDAudio_Update(void)
|
void BGMVolume_Callback(struct cvar_s *var, char *oldvalue)
|
||||||
{
|
{
|
||||||
|
int cdvolume;
|
||||||
|
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bgmvolume.value != cdvolume)
|
cdvolume = atof(oldvalue);
|
||||||
{
|
|
||||||
if (cdvolume)
|
if (cdvolume && !var->value)
|
||||||
{
|
CDAudio_Pause ();
|
||||||
Cvar_SetValue (&bgmvolume, 0.0);
|
else if (!cdvolume && var->value)
|
||||||
cdvolume = bgmvolume.value;
|
CDAudio_Resume ();
|
||||||
CDAudio_Pause ();
|
}
|
||||||
}
|
|
||||||
else
|
void CDAudio_Update(void)
|
||||||
{
|
{
|
||||||
Cvar_SetValue (&bgmvolume, 1.0);
|
|
||||||
cdvolume = bgmvolume.value;
|
|
||||||
CDAudio_Resume ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -369,6 +365,7 @@ int CDAudio_Init(void)
|
||||||
|
|
||||||
Cmd_AddCommand ("cd", CD_f);
|
Cmd_AddCommand ("cd", CD_f);
|
||||||
|
|
||||||
|
Cvar_Hook(&bgmvolume, BGMVolume_Callback);
|
||||||
// Con_Printf("CD Audio Initialized\n");
|
// Con_Printf("CD Audio Initialized\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -384,4 +381,6 @@ void CDAudio_Shutdown(void)
|
||||||
SDL_CDClose(cddevice);
|
SDL_CDClose(cddevice);
|
||||||
cddevice = NULL;
|
cddevice = NULL;
|
||||||
initialized = false;
|
initialized = false;
|
||||||
|
|
||||||
|
Cvar_Unhook(&bgmvolume);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ static qboolean wasPlaying = false;
|
||||||
static qboolean initialized = false;
|
static qboolean initialized = false;
|
||||||
static qboolean enabled = false;
|
static qboolean enabled = false;
|
||||||
static qboolean playLooping = false;
|
static qboolean playLooping = false;
|
||||||
static float cdvolume;
|
|
||||||
static qbyte remap[100];
|
static qbyte remap[100];
|
||||||
static qbyte playTrack;
|
static qbyte playTrack;
|
||||||
static qbyte maxTrack;
|
static qbyte maxTrack;
|
||||||
|
@ -189,7 +188,7 @@ void CDAudio_Play(int track, qboolean looping)
|
||||||
playTrack = track;
|
playTrack = track;
|
||||||
playing = true;
|
playing = true;
|
||||||
|
|
||||||
if (cdvolume == 0.0)
|
if (!bgmvolume.value)
|
||||||
CDAudio_Pause ();
|
CDAudio_Pause ();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -250,7 +249,7 @@ void CDAudio_Resume(void)
|
||||||
if (!wasPlaying)
|
if (!wasPlaying)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!cdvolume)
|
if (!bgmvolume.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0);
|
mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0);
|
||||||
|
@ -379,7 +378,7 @@ static void CD_f (void)
|
||||||
Con_Printf("Currently %s track %u\n", playLooping ? "looping" : "playing", playTrack);
|
Con_Printf("Currently %s track %u\n", playLooping ? "looping" : "playing", playTrack);
|
||||||
else if (wasPlaying)
|
else if (wasPlaying)
|
||||||
Con_Printf("Paused %s track %u\n", playLooping ? "looping" : "playing", playTrack);
|
Con_Printf("Paused %s track %u\n", playLooping ? "looping" : "playing", playTrack);
|
||||||
Con_Printf("Volume is %f\n", cdvolume);
|
Con_Printf("Volume is %f\n", bgmvolume.value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,27 +417,24 @@ LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BGMVolume_Callback(struct cvar_s *var, char *oldvalue)
|
||||||
void CDAudio_Update(void)
|
|
||||||
{
|
{
|
||||||
|
int cdvolume;
|
||||||
|
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bgmvolume.value != cdvolume)
|
cdvolume = atof(oldvalue);
|
||||||
{
|
|
||||||
if (cdvolume)
|
if (cdvolume && !var->value)
|
||||||
{
|
CDAudio_Pause ();
|
||||||
Cvar_SetValue (&bgmvolume, 0.0);
|
else if (!cdvolume && var->value)
|
||||||
cdvolume = bgmvolume.value;
|
CDAudio_Resume ();
|
||||||
CDAudio_Pause ();
|
}
|
||||||
}
|
|
||||||
else
|
void CDAudio_Update(void)
|
||||||
{
|
{
|
||||||
Cvar_SetValue (&bgmvolume, 1.0);
|
|
||||||
cdvolume = bgmvolume.value;
|
|
||||||
CDAudio_Resume ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -489,6 +485,7 @@ int CDAudio_Init(void)
|
||||||
|
|
||||||
Cmd_AddCommand ("cd", CD_f);
|
Cmd_AddCommand ("cd", CD_f);
|
||||||
|
|
||||||
|
Cvar_Hook(&bgmvolume, BGMVolume_Callback);
|
||||||
// Con_Printf("CD Audio Initialized\n");
|
// Con_Printf("CD Audio Initialized\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -502,4 +499,6 @@ void CDAudio_Shutdown(void)
|
||||||
CDAudio_Stop();
|
CDAudio_Stop();
|
||||||
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)NULL))
|
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)NULL))
|
||||||
Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
|
Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
|
||||||
|
|
||||||
|
Cvar_Unhook(&bgmvolume);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,8 @@ cvar_t r_drawflame = SCVAR("r_drawflame", "1");
|
||||||
|
|
||||||
static qboolean allowremotecmd = true;
|
static qboolean allowremotecmd = true;
|
||||||
|
|
||||||
|
extern int total_loading_size, current_loading_size, loading_stage;
|
||||||
|
|
||||||
//
|
//
|
||||||
// info mirrors
|
// info mirrors
|
||||||
//
|
//
|
||||||
|
@ -2080,6 +2082,11 @@ client_connect: //fixme: make function
|
||||||
cls.state = ca_connected;
|
cls.state = ca_connected;
|
||||||
Con_TPrintf (TLC_CONNECTED);
|
Con_TPrintf (TLC_CONNECTED);
|
||||||
allowremotecmd = false; // localid required now for remote cmds
|
allowremotecmd = false; // localid required now for remote cmds
|
||||||
|
|
||||||
|
total_loading_size = 100;
|
||||||
|
current_loading_size = 0;
|
||||||
|
loading_stage = 2;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// remote command from gui front end
|
// remote command from gui front end
|
||||||
|
@ -2225,6 +2232,11 @@ void CLNQ_ConnectionlessPacket(void)
|
||||||
cls.protocol = CP_NETQUAKE;
|
cls.protocol = CP_NETQUAKE;
|
||||||
cls.state = ca_connected;
|
cls.state = ca_connected;
|
||||||
Con_TPrintf (TLC_CONNECTED);
|
Con_TPrintf (TLC_CONNECTED);
|
||||||
|
|
||||||
|
total_loading_size = 100;
|
||||||
|
current_loading_size = 0;
|
||||||
|
loading_stage = 2;
|
||||||
|
|
||||||
allowremotecmd = false; // localid required now for remote cmds
|
allowremotecmd = false; // localid required now for remote cmds
|
||||||
|
|
||||||
//send a dummy packet.
|
//send a dummy packet.
|
||||||
|
|
|
@ -2399,13 +2399,13 @@ void QCC_PR_PrintScope (void)
|
||||||
if (pr_scope)
|
if (pr_scope)
|
||||||
{
|
{
|
||||||
if (errorscope != pr_scope)
|
if (errorscope != pr_scope)
|
||||||
printf ("in function %s (line %i)\n", pr_scope->name, pr_scope->s_line);
|
printf ("in function %s (line %i),\n", pr_scope->name, pr_scope->s_line);
|
||||||
errorscope = pr_scope;
|
errorscope = pr_scope;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (errorscope)
|
if (errorscope)
|
||||||
printf ("at global scope\n");
|
printf ("at global scope,\n");
|
||||||
errorscope = NULL;
|
errorscope = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,26 +231,6 @@ void D_DrawSurfaces (void)
|
||||||
D_DrawZSpans (s->spans);
|
D_DrawZSpans (s->spans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: could preset a lot of this at mode set time
|
|
||||||
else if (r_drawflat.value)
|
|
||||||
{
|
|
||||||
for (s = &surfaces[1] ; s<surface_p ; s++)
|
|
||||||
{
|
|
||||||
if (!s->spans)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
d_zistepu = s->d_zistepu;
|
|
||||||
d_zistepv = s->d_zistepv;
|
|
||||||
d_ziorigin = s->d_ziorigin;
|
|
||||||
|
|
||||||
#ifdef __alpha__
|
|
||||||
D_DrawSolidSurface (s, (int)((long)s->data & 0xFF));
|
|
||||||
#else
|
|
||||||
D_DrawSolidSurface (s, (int)s->data & 0xFF);
|
|
||||||
#endif
|
|
||||||
D_DrawZSpans (s->spans);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (s = &surfaces[1] ; s<surface_p ; s++)
|
for (s = &surfaces[1] ; s<surface_p ; s++)
|
||||||
|
|
|
@ -89,7 +89,6 @@ typedef struct
|
||||||
int color;
|
int color;
|
||||||
} zpointdesc_t;
|
} zpointdesc_t;
|
||||||
|
|
||||||
extern cvar_t r_drawflat;
|
|
||||||
extern int d_spanpixcount;
|
extern int d_spanpixcount;
|
||||||
extern int r_framecount; // sequence # of current frame since Quake
|
extern int r_framecount; // sequence # of current frame since Quake
|
||||||
// started
|
// started
|
||||||
|
|
|
@ -64,7 +64,6 @@ extern cvar_t r_fullbright;
|
||||||
extern cvar_t r_drawentities;
|
extern cvar_t r_drawentities;
|
||||||
extern cvar_t r_aliasstats;
|
extern cvar_t r_aliasstats;
|
||||||
extern cvar_t r_dspeeds;
|
extern cvar_t r_dspeeds;
|
||||||
extern cvar_t r_drawflat;
|
|
||||||
extern cvar_t r_ambient;
|
extern cvar_t r_ambient;
|
||||||
extern cvar_t r_reportsurfout;
|
extern cvar_t r_reportsurfout;
|
||||||
extern cvar_t r_maxsurfs;
|
extern cvar_t r_maxsurfs;
|
||||||
|
|
Loading…
Reference in a new issue