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:
TimeServ 2006-05-07 20:57:30 +00:00
parent 18de9855ae
commit 913e26b1ae
8 changed files with 70 additions and 81 deletions

View File

@ -46,7 +46,6 @@ static qboolean wasPlaying = false;
static qboolean initialized = false;
static qboolean enabled = true;
static qboolean playLooping = false;
static float cdvolume;
static qbyte remap[100];
static qbyte playTrack;
static qbyte maxTrack;
@ -160,7 +159,7 @@ void CDAudio_Play(int track, qboolean looping)
playTrack = track;
playing = true;
if (cdvolume == 0.0)
if (!bgmvolume.value)
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)
{
struct cdrom_subchnl subchnl;
@ -338,22 +352,6 @@ void CDAudio_Update(void)
if (!enabled)
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)) {
lastchk = time(NULL) + 2; //two seconds between chks
subchnl.cdsc_format = CDROM_MSF;
@ -407,6 +405,8 @@ int CDAudio_Init(void)
Cmd_AddCommand ("cd", CD_f);
Cvar_Hook(&bgmvolume, BGMVolume_Callback);
Con_Printf("CD Audio Initialized\n");
return 0;
@ -420,5 +420,6 @@ void CDAudio_Shutdown(void)
CDAudio_Stop();
close(cdfile);
cdfile = -1;
Cvar_Unhook(&bgmvolume);
}
#endif

View File

@ -10,7 +10,6 @@ static qboolean wasPlaying = false;
static qboolean initialized = false;
static qboolean enabled = false;
static qboolean playLooping = false;
static float cdvolume;
static qbyte remap[100];
static qbyte playTrack;
static qbyte maxTrack;
@ -90,7 +89,7 @@ void CDAudio_Play(int track, qboolean looping)
playTrack = track;
playing = true;
if (cdvolume == 0.0)
if (!bgmvolume.value)
CDAudio_Pause ();
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)
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 ();
}
}
cdvolume = atof(oldvalue);
if (cdvolume && !var->value)
CDAudio_Pause ();
else if (!cdvolume && var->value)
CDAudio_Resume ();
}
void CDAudio_Update(void)
{
}
@ -369,6 +365,7 @@ int CDAudio_Init(void)
Cmd_AddCommand ("cd", CD_f);
Cvar_Hook(&bgmvolume, BGMVolume_Callback);
// Con_Printf("CD Audio Initialized\n");
return 0;
@ -384,4 +381,6 @@ void CDAudio_Shutdown(void)
SDL_CDClose(cddevice);
cddevice = NULL;
initialized = false;
Cvar_Unhook(&bgmvolume);
}

View File

@ -36,7 +36,6 @@ static qboolean wasPlaying = false;
static qboolean initialized = false;
static qboolean enabled = false;
static qboolean playLooping = false;
static float cdvolume;
static qbyte remap[100];
static qbyte playTrack;
static qbyte maxTrack;
@ -189,7 +188,7 @@ void CDAudio_Play(int track, qboolean looping)
playTrack = track;
playing = true;
if (cdvolume == 0.0)
if (!bgmvolume.value)
CDAudio_Pause ();
return;
@ -250,7 +249,7 @@ void CDAudio_Resume(void)
if (!wasPlaying)
return;
if (!cdvolume)
if (!bgmvolume.value)
return;
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);
else if (wasPlaying)
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;
}
}
@ -418,27 +417,24 @@ LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return 0;
}
void CDAudio_Update(void)
void BGMVolume_Callback(struct cvar_s *var, char *oldvalue)
{
int cdvolume;
if (!enabled)
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 ();
}
}
cdvolume = atof(oldvalue);
if (cdvolume && !var->value)
CDAudio_Pause ();
else if (!cdvolume && var->value)
CDAudio_Resume ();
}
void CDAudio_Update(void)
{
}
@ -489,6 +485,7 @@ int CDAudio_Init(void)
Cmd_AddCommand ("cd", CD_f);
Cvar_Hook(&bgmvolume, BGMVolume_Callback);
// Con_Printf("CD Audio Initialized\n");
return 0;
@ -502,4 +499,6 @@ void CDAudio_Shutdown(void)
CDAudio_Stop();
if (mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR)NULL))
Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
Cvar_Unhook(&bgmvolume);
}

View File

@ -90,6 +90,8 @@ cvar_t r_drawflame = SCVAR("r_drawflame", "1");
static qboolean allowremotecmd = true;
extern int total_loading_size, current_loading_size, loading_stage;
//
// info mirrors
//
@ -2080,6 +2082,11 @@ client_connect: //fixme: make function
cls.state = ca_connected;
Con_TPrintf (TLC_CONNECTED);
allowremotecmd = false; // localid required now for remote cmds
total_loading_size = 100;
current_loading_size = 0;
loading_stage = 2;
return;
}
// remote command from gui front end
@ -2225,6 +2232,11 @@ void CLNQ_ConnectionlessPacket(void)
cls.protocol = CP_NETQUAKE;
cls.state = ca_connected;
Con_TPrintf (TLC_CONNECTED);
total_loading_size = 100;
current_loading_size = 0;
loading_stage = 2;
allowremotecmd = false; // localid required now for remote cmds
//send a dummy packet.

View File

@ -2399,13 +2399,13 @@ void QCC_PR_PrintScope (void)
if (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;
}
else
{
if (errorscope)
printf ("at global scope\n");
printf ("at global scope,\n");
errorscope = NULL;
}
}

View File

@ -231,26 +231,6 @@ void D_DrawSurfaces (void)
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
{
for (s = &surfaces[1] ; s<surface_p ; s++)

View File

@ -89,7 +89,6 @@ typedef struct
int color;
} zpointdesc_t;
extern cvar_t r_drawflat;
extern int d_spanpixcount;
extern int r_framecount; // sequence # of current frame since Quake
// started

View File

@ -64,7 +64,6 @@ extern cvar_t r_fullbright;
extern cvar_t r_drawentities;
extern cvar_t r_aliasstats;
extern cvar_t r_dspeeds;
extern cvar_t r_drawflat;
extern cvar_t r_ambient;
extern cvar_t r_reportsurfout;
extern cvar_t r_maxsurfs;