Refactored spincontrol menu control with value lists, simplifying menu implementations.

Simplified loading and saving of cvars in slider menu control.
Enlarged text in Game, Multiplayer, and Options menus.
Fixed repeat of failed file causing HTTP downloads to restart.
Added cl_zoommode cvar to simplify Lazarus zoom command.
Changed zoom command to use new cl_zoommode cvar in default Lazarus and missionpack DLLs.
Removed unused "crossh" cvar in default Lazarus and missionpack DLLs.
Fixed Makron not having a classname when spawned from Jorg in default Lazarus and missionpack DLLs.
Made Tactician Gunner ignore small amounts of damage in missionpack DLL.
This commit is contained in:
Knightmare66 2021-09-04 02:18:06 -04:00
parent 69bbad2b9a
commit 3ce18b138c
48 changed files with 1508 additions and 1446 deletions

View file

@ -714,7 +714,7 @@ void CL_DownloadFileName (char *dest, int destlen, const char *fn)
// Knightmare- store the names of last downloads that failed
#define NUM_FAIL_DLDS 64
#define NUM_FAIL_DLDS 512
char lastFailedDownload[NUM_FAIL_DLDS][MAX_OSPATH];
static unsigned failedDlListIndex;

View file

@ -1841,8 +1841,7 @@ void CL_AddViewWeapon (player_state_t *ps, player_state_t *ops)
if ( IsThirdPerson() )
return;
// allow the gun to be completely removed
// if (!cl_gun->value)
if (!cl_gun->integer)
if ( !cl_gun->integer || cl_zoommode->integer )
return;
// don't draw gun if in wide angle view

View file

@ -61,7 +61,7 @@ bandwidth.
// Knightmare- store the names of last HTTP downloads from this server that failed
// This is needed because some player model download failures can cause endless HTTP download loops
#define NUM_FAIL_DLDS 64
#define NUM_FAIL_DLDS 256
char lastFailedHTTPDownload[NUM_FAIL_DLDS][MAX_OSPATH];
static unsigned failed_HTTP_Dl_ListIndex;
@ -632,8 +632,8 @@ qboolean CL_QueueHTTPDownload (const char *quakePath, qboolean filelistUseGamedi
// Knightmare- don't try again to download via HTTP a file that failed
if ( !isFilelist /*&& !needList*/ ) {
if (CL_CheckHTTPDownloadFailed((char *)quakePath)) {
Com_Printf ("[HTTP] Refusing to download %s again, already in failed HTTP download list.\n", quakePath);
return false;
// Com_Printf ("[HTTP] Refusing to download %s again, already in failed HTTP download list.\n", quakePath);
return true;
}
}

View file

@ -80,6 +80,9 @@ cvar_t *cl_particle_scale;
// whether to adjust fov for wide aspect rattio
cvar_t *cl_widescreen_fov;
// hook to simplify Lazarus zoom feature
cvar_t *cl_zoommode;
// Psychospaz's chasecam
cvar_t *cg_thirdperson;
cvar_t *cg_thirdperson_angle;
@ -2006,6 +2009,10 @@ void CL_InitLocal (void)
cl_widescreen_fov = Cvar_Get ("cl_widescreen_fov", "1", CVAR_ARCHIVE);
Cvar_SetDescription ("cl_widescreen_fov", "Enables automatic scaling of FOV for widescreen video modes.");
// hook to simplify Lazarus zoom feature
cl_zoommode = Cvar_Get ("cl_zoommode", "0", 0);
Cvar_SetDescription ("cl_zoommode", "Disables gun model and crosshair for Lazarus zoom feature.");
cl_noskins = Cvar_Get ("cl_noskins", "0", 0);
Cvar_SetDescription ("cl_noskins", "Forces all skins to male/grunt when enabled.");
// cl_autoskins = Cvar_Get ("cl_autoskins", "0", 0); // unused

View file

@ -1769,10 +1769,9 @@ Moved from cl_view.c, what the hell was it doing there?
// Psychospaz's new crosshair code
void SCR_DrawCrosshair (void)
{
float /*scale,*/ scaledSize, alpha, pulsealpha;
float scaledSize, alpha, pulsealpha;
// if (!crosshair->value || scr_hidehud)
if (!crosshair->integer || scr_hidehud)
if ( !crosshair->integer || cl_zoommode->integer || scr_hidehud )
return;
if (crosshair->modified)
@ -1780,7 +1779,7 @@ void SCR_DrawCrosshair (void)
crosshair->modified = false;
SCR_TouchPics ();
if ( FS_ModType("dday") ) //dday has no crosshair (FORCED)
if ( FS_ModType("dday") ) // D-Day has no crosshair (FORCED)
Cvar_SetValue("crosshair", 0);
}
@ -1796,15 +1795,9 @@ void SCR_DrawCrosshair (void)
if (!crosshair_pic[0])
return;
//scale = crosshair_scale->value * (viddef.width*DIV640);
//alpha = 0.75 + 0.25*sin(anglemod(cl.time*0.005));
scaledSize = crosshair_scale->value * CROSSHAIR_SIZE;
pulsealpha = crosshair_alpha->value * crosshair_pulse->value;
alpha = max(min(crosshair_alpha->value - pulsealpha + pulsealpha*sin(anglemod(cl.time*0.005)), 1.0), 0.0);
// R_DrawScaledPic (scr_vrect.x + (int)(((float)scr_vrect.width - scale*(float)crosshair_width)*0.5), // x
// scr_vrect.y + (int)(((float)scr_vrect.height - scale*(float)crosshair_height)*0.5), // y
// scale, alpha, crosshair_pic);
SCR_DrawPic ( ((float)SCREEN_WIDTH - scaledSize)*0.5, ((float)SCREEN_HEIGHT - scaledSize)*0.5,
scaledSize, scaledSize, ALIGN_CENTER, false, crosshair_pic, alpha);
}

View file

@ -412,6 +412,9 @@ extern cvar_t *cl_particle_scale;
// whether to adjust fov for wide aspect rattio
extern cvar_t *cl_widescreen_fov;
// hook to simplify Lazarus zoom feature
extern cvar_t *cl_zoommode;
extern cvar_t *scr_conalpha; // Psychospaz's transparent console
extern cvar_t *scr_newconback; // whether to use new console background
extern cvar_t *scr_oldconbar; // whether to draw bottom bar on old console

View file

@ -1685,20 +1685,25 @@ void SetLazarusCrosshair (edict_t *ent)
if (ent->client->zoomed || ent->client->zooming)
return;
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
gi.cvar_forceset("lazarus_crosshair", va("%d", (int)(crosshair->value)));
gi.cvar_forceset("lazarus_cl_gun", va("%d", (int)(cl_gun->value)));
#endif
}
void SetSensitivities (edict_t *ent, qboolean reset)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
char string[512];
#endif
if (deathmatch->value || coop->value) return;
if (!ent->inuse) return;
if (!ent->client) return;
if (reset)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
#ifdef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
stuffcmd (ent, "cl_zoommode 0\n");
#else
gi.cvar_set ("m_pitch", va("%f", lazarus_pitch->value));
gi.cvar_set ("m_yaw", va("%f", lazarus_yaw->value));
gi.cvar_set ("joy_pitchsensitivity", va("%f", lazarus_joyp->value));
@ -1707,7 +1712,7 @@ void SetSensitivities (edict_t *ent, qboolean reset)
// m_yaw->value = lazarus_yaw->value;
// joy_pitchsensitivity->value = lazarus_joyp->value;
// joy_yawsensitivity->value = lazarus_joyy->value;
#endif
if (crosshair->value != lazarus_crosshair->value)
{
Com_sprintf (string, sizeof(string), "crosshair %i\n", atoi(lazarus_crosshair->string));
@ -1718,39 +1723,40 @@ void SetSensitivities (edict_t *ent, qboolean reset)
Com_sprintf (string, sizeof(string), "cl_gun %i\n", atoi(lazarus_cl_gun->string));
stuffcmd (ent, string);
}
#endif
ent->client->pers.hand = hand->value;
}
else
{
#ifdef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
stuffcmd (ent, "cl_zoommode 1\n");
#else
float ratio;
// save in lazarus_crosshair
Com_sprintf (string, sizeof(string), "lazarus_crosshair %i\n", atoi(crosshair->string));
stuffcmd (ent, string);
Com_sprintf(string, sizeof(string), "crosshair 0");
Com_sprintf (string, sizeof(string), "crosshair 0\n");
stuffcmd (ent, string);
Com_sprintf (string, sizeof(string), "lazarus_cl_gun %i\n", atoi(cl_gun->string));
stuffcmd (ent, string);
Com_sprintf(string, sizeof(string), "cl_gun 0");
Com_sprintf (string, sizeof(string), "cl_gun 0\n");
stuffcmd (ent, string);
if (!ent->client->sensitivities_init)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
ent->client->m_pitch = m_pitch->value;
ent->client->m_yaw = m_yaw->value;
ent->client->joy_pitchsensitivity = joy_pitchsensitivity->value;
ent->client->joy_yawsensitivity = joy_yawsensitivity->value;
#endif
ent->client->sensitivities_init = true;
}
if (ent->client->ps.fov >= ent->client->original_fov)
ratio = 1.;
ratio = 1.0f;
else
ratio = ent->client->ps.fov / ent->client->original_fov;
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
gi.cvar_set ("m_pitch", va("%f", ent->client->m_pitch * ratio));
gi.cvar_set ("m_yaw", va("%f", ent->client->m_yaw * ratio));
gi.cvar_set ("joy_pitchsensitivity", va("%f", ent->client->joy_pitchsensitivity * ratio));
@ -2116,7 +2122,6 @@ void ClientCommand (edict_t *ent)
else if (Q_stricmp (cmd, "entcount") == 0)
Cmd_EntCount_f(ent);
// alternate attack mode
/*else if (!Q_stricmp(cmd,"attack2_off"))
Cmd_attack2_f(ent,false);
@ -2128,9 +2133,12 @@ void ClientCommand (edict_t *ent)
{
if (!deathmatch->value && !coop->value && !ent->client->chasetoggle)
{
if (ent->client->ps.fov > 5) {
if (ent->client->ps.fov > 5)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
if (cl_gun->value)
stuffcmd (ent, "cl_gun 0\n");
#endif
ent->client->frame_zoomrate = zoomrate->value * ent->client->secs_per_frame;
ent->client->zooming = 1;
ent->client->zoomed = true;
@ -2141,9 +2149,12 @@ void ClientCommand (edict_t *ent)
{
if (!deathmatch->value && !coop->value && !ent->client->chasetoggle)
{
if (ent->client->ps.fov < ent->client->original_fov) {
if (ent->client->ps.fov < ent->client->original_fov)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
if (cl_gun->value)
stuffcmd (ent, "cl_gun 0\n");
#endif
ent->client->frame_zoomrate = zoomrate->value * ent->client->secs_per_frame;
ent->client->zooming = -1;
ent->client->zoomed = true;
@ -2166,8 +2177,10 @@ void ClientCommand (edict_t *ent)
{
ent->client->ps.fov = zoomsnap->value;
ent->client->pers.hand = 2;
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
if (cl_gun->value)
stuffcmd (ent, "cl_gun 0\n");
#endif
ent->client->zooming = 0;
ent->client->zoomed = true;
SetSensitivities (ent, false);
@ -2194,8 +2207,10 @@ void ClientCommand (edict_t *ent)
{
ent->client->ps.fov = zoomsnap->value;
ent->client->pers.hand = 2;
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
if (cl_gun->value)
stuffcmd (ent, "cl_gun 0\n");
#endif
ent->client->zooming = 0;
ent->client->zoomed = true;
SetSensitivities (ent, false);

View file

@ -786,7 +786,7 @@ extern cvar_t *cl_thirdperson; // Knightmare added
extern cvar_t *corpse_fade;
extern cvar_t *corpse_fadetime;
extern cvar_t *crosshair;
extern cvar_t *crossh;
//extern cvar_t *crossh;
extern cvar_t *developer;
extern cvar_t *footstep_sounds;
extern cvar_t *fov;

View file

@ -458,22 +458,24 @@ void InitGame (void)
gi.cvar_forceset("m_yaw", va("%f", lazarus_yaw->value));
gi.cvar_forceset("cl_gun", va("%d", (int)(lazarus_cl_gun->value)));
gi.cvar_forceset("crosshair", va("%d", (int)(lazarus_crosshair->value)));
} else {*/
}
else
{*/
gi.cvar_forceset("lazarus_cd_loop", va("%d", (int)(cd_loopcount->value)));
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
gi.cvar_forceset("lazarus_pitch", va("%f", m_pitch->value));
gi.cvar_forceset("lazarus_yaw", va("%f", m_yaw->value));
gi.cvar_forceset("lazarus_joyp", va("%f", joy_pitchsensitivity->value));
gi.cvar_forceset("lazarus_joyy", va("%f", joy_yawsensitivity->value));
#endif
gi.cvar_forceset("lazarus_cl_gun", va("%d", (int)(cl_gun->value)));
gi.cvar_forceset("lazarus_crosshair", va("%d", (int)(crosshair->value)));
#endif
//}
}
tpp = gi.cvar ("tpp", "0", CVAR_ARCHIVE);
tpp_auto = gi.cvar ("tpp_auto", "1", 0);
crossh = gi.cvar ("crossh", "1", 0);
// crossh = gi.cvar ("crossh", "1", 0);
allow_download = gi.cvar("allow_download", "0", 0);
g_showlogic = gi.cvar("g_showlogic", "0", 0); // Knightmare added

View file

@ -515,7 +515,11 @@ void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
if ((self->spawnflags & 4) && activator->client && !deathmatch->value && !coop->value)
{
nostatus = 1;
#ifdef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
stuffcmd (activator, "cl_zoommode 1\n");
#else
stuffcmd (activator, "cl_gun 0;crosshair 0\n");
#endif
activator->client->pers.hand = 2;
}

View file

@ -970,6 +970,8 @@ void MakronSpawn (edict_t *self)
vec3_t vec;
edict_t *player;
self->classname = "monster_makron"; // Knightmare- set the right classname
SP_monster_makron_put (self);
// Knightmare- gross hack for map6 of COS3- don't jump

View file

@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cvar_t *tpp;
cvar_t *tpp_auto;
cvar_t *crossh;
//cvar_t *crossh;
void ChasecamTrack (edict_t *ent);

View file

@ -1539,20 +1539,25 @@ void SetLazarusCrosshair (edict_t *ent)
if (ent->client->zoomed || ent->client->zooming)
return;
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
gi.cvar_forceset("lazarus_crosshair", va("%d", (int)(crosshair->value)));
gi.cvar_forceset("lazarus_cl_gun", va("%d", (int)(cl_gun->value)));
#endif
}
void SetSensitivities (edict_t *ent, qboolean reset)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
char string[512];
#endif
if (deathmatch->value || coop->value) return;
if (!ent->inuse) return;
if (!ent->client) return;
if (reset)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
#ifdef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
stuffcmd (ent, "cl_zoommode 0\n");
#else
gi.cvar_set ("m_pitch", va("%f", lazarus_pitch->value));
gi.cvar_set ("m_yaw", va("%f", lazarus_yaw->value));
gi.cvar_set ("joy_pitchsensitivity", va("%f", lazarus_joyp->value));
@ -1561,10 +1566,10 @@ void SetSensitivities (edict_t *ent,qboolean reset)
// m_yaw->value = lazarus_yaw->value;
// joy_pitchsensitivity->value = lazarus_joyp->value;
// joy_yawsensitivity->value = lazarus_joyy->value;
#endif
if (crosshair->value != lazarus_crosshair->value)
{
Com_sprintf(string, sizeof(string), "set crosshair %0d\n",(int)(lazarus_crosshair->value));
Com_sprintf (string, sizeof(string), "crosshair %i\n", atoi(lazarus_crosshair->string));
stuffcmd (ent, string);
}
if (cl_gun->value != lazarus_cl_gun->value)
@ -1572,39 +1577,40 @@ void SetSensitivities (edict_t *ent,qboolean reset)
Com_sprintf (string, sizeof(string), "cl_gun %i\n", atoi(lazarus_cl_gun->string));
stuffcmd (ent, string);
}
#endif
ent->client->pers.hand = hand->value;
}
else
{
#ifdef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
stuffcmd (ent, "cl_zoommode 1\n");
#else
float ratio;
// save in lazarus_crosshair
Com_sprintf (string, sizeof(string), "lazarus_crosshair %i\n", atoi(crosshair->string));
stuffcmd (ent, string);
Com_sprintf(string, sizeof(string), "crosshair 0");
Com_sprintf (string, sizeof(string), "crosshair 0\n");
stuffcmd (ent, string);
Com_sprintf (string, sizeof(string), "lazarus_cl_gun %i\n", atoi(cl_gun->string));
stuffcmd (ent, string);
Com_sprintf(string, sizeof(string), "cl_gun 0");
Com_sprintf (string, sizeof(string), "cl_gun 0\n");
stuffcmd (ent, string);
if (!ent->client->sensitivities_init)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
ent->client->m_pitch = m_pitch->value;
ent->client->m_yaw = m_yaw->value;
ent->client->joy_pitchsensitivity = joy_pitchsensitivity->value;
ent->client->joy_yawsensitivity = joy_yawsensitivity->value;
#endif
ent->client->sensitivities_init = true;
}
if (ent->client->ps.fov >= ent->client->original_fov)
ratio = 1.;
ratio = 1.0f;
else
ratio = ent->client->ps.fov / ent->client->original_fov;
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
gi.cvar_set ("m_pitch", va("%f", ent->client->m_pitch * ratio));
gi.cvar_set ("m_yaw", va("%f", ent->client->m_yaw * ratio));
gi.cvar_set ("joy_pitchsensitivity", va("%f", ent->client->joy_pitchsensitivity * ratio));
@ -1615,7 +1621,7 @@ void SetSensitivities (edict_t *ent,qboolean reset)
// joy_yawsensitivity->value = ent->client->joy_yawsensitivity * ratio;
#endif
}
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
Com_sprintf (string, sizeof(string), "m_pitch %g;m_yaw %g;joy_pitchsensitivity %g;joy_yawsensitivity %g\n",
m_pitch->value, m_yaw->value, joy_pitchsensitivity->value, joy_yawsensitivity->value);
stuffcmd (ent, string);
@ -1952,8 +1958,10 @@ void ClientCommand (edict_t *ent)
{
if (ent->client->ps.fov > 5)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
if (cl_gun->value)
stuffcmd (ent, "cl_gun 0\n");
#endif
ent->client->frame_zoomrate = zoomrate->value * ent->client->secs_per_frame;
ent->client->zooming = 1;
ent->client->zoomed = true;
@ -1966,8 +1974,10 @@ void ClientCommand (edict_t *ent)
{
if (ent->client->ps.fov < ent->client->original_fov)
{
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
if (cl_gun->value)
stuffcmd (ent, "cl_gun 0\n");
#endif
ent->client->frame_zoomrate = zoomrate->value * ent->client->secs_per_frame;
ent->client->zooming = -1;
ent->client->zoomed = true;
@ -1993,8 +2003,10 @@ void ClientCommand (edict_t *ent)
{
ent->client->ps.fov = zoomsnap->value;
ent->client->pers.hand = 2;
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
if (cl_gun->value)
stuffcmd (ent, "cl_gun 0\n");
#endif
ent->client->zooming = 0;
ent->client->zoomed = true;
SetSensitivities (ent, false);
@ -2022,8 +2034,10 @@ void ClientCommand (edict_t *ent)
{
ent->client->ps.fov = zoomsnap->value;
ent->client->pers.hand = 2;
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
if (cl_gun->value)
stuffcmd (ent, "cl_gun 0\n");
#endif
ent->client->zooming = 0;
ent->client->zoomed = true;
SetSensitivities (ent, false);

View file

@ -1040,7 +1040,7 @@ extern cvar_t *cl_thirdperson; // Knightmare added
extern cvar_t *corpse_fade;
extern cvar_t *corpse_fadetime;
extern cvar_t *crosshair;
extern cvar_t *crossh;
//extern cvar_t *crossh;
extern cvar_t *developer;
extern cvar_t *fmod_nomusic;
extern cvar_t *footstep_sounds;

View file

@ -72,7 +72,7 @@ cvar_t *cl_thirdperson; // Knightmare added
cvar_t *corpse_fade;
cvar_t *corpse_fadetime;
cvar_t *crosshair;
cvar_t *crossh;
//cvar_t *crossh;
cvar_t *developer;
cvar_t *fmod_nomusic;
cvar_t *footstep_sounds;

View file

@ -533,30 +533,28 @@ void InitGame (void)
{
/*if (lazarus_pitch->value) {
gi.cvar_forceset("cd_loopcount", va("%d", (int)(lazarus_cd_loop->value)));
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
gi.cvar_forceset("m_pitch", va("%f", lazarus_pitch->value));
gi.cvar_forceset("m_yaw", va("%f", lazarus_yaw->value));
#endif
//gi.cvar_forceset("cl_gun", va("%d",(int)(lazarus_cl_gun->value)));
//gi.cvar_forceset("crosshair", va("%d",(int)(lazarus_crosshair->value)));
gi.cvar_forceset("cl_gun", va("%d", (int)(lazarus_cl_gun->value)));
gi.cvar_forceset("crosshair", va("%d", (int)(lazarus_crosshair->value)));
}
else
{*/
gi.cvar_forceset("lazarus_cd_loop", va("%d", (int)(cd_loopcount->value)));
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
gi.cvar_forceset("lazarus_pitch", va("%f", m_pitch->value));
gi.cvar_forceset("lazarus_yaw", va("%f", m_yaw->value));
gi.cvar_forceset("lazarus_joyp", va("%f", joy_pitchsensitivity->value));
gi.cvar_forceset("lazarus_joyy", va("%f", joy_yawsensitivity->value));
#endif
gi.cvar_forceset("lazarus_cl_gun", va("%d", (int)(cl_gun->value)));
gi.cvar_forceset("lazarus_crosshair", va("%d", (int)(crosshair->value)));
#endif
//}
}
tpp = gi.cvar ("tpp", "0", CVAR_ARCHIVE);
tpp_auto = gi.cvar ("tpp_auto", "1", 0);
crossh = gi.cvar ("crossh", "1", 0);
// crossh = gi.cvar ("crossh", "1", 0);
allow_download = gi.cvar("allow_download", "0", 0);
// If this is an SP game and "readout" is not set, force allow_download off

View file

@ -454,7 +454,11 @@ void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
if ((self->spawnflags & 4) && activator->client && !deathmatch->value && !coop->value)
{
nostatus = 1;
#ifdef KMQUAKE2_ENGINE_MOD // engine has zoom mode and autosensitivity
stuffcmd (activator, "cl_zoommode 1\n");
#else
stuffcmd (activator, "cl_gun 0;crosshair 0\n");
#endif
activator->client->pers.hand = 2;
}
if (activator && activator->client) //Knightmare- paranoia

View file

@ -992,6 +992,9 @@ void MakronSpawn (edict_t *self)
vec3_t vec;
edict_t *player;
self->classname = "monster_makron"; // Knightmare- set the right classname
SP_monster_makron_put (self);
// Knightmare- gross hack for map6 of COS3- don't jump

View file

@ -306,8 +306,9 @@ void gunner_pain (edict_t *self, edict_t *other, float kick, int damage)
monster_done_dodge (self);
// if ( (self->moreflags & FL2_COMMANDER) && (damage < 10) )
// return;
// Tactician Gunner shrugs off small damage
if ( (self->moreflags & FL2_COMMANDER) && (damage < 10) )
return;
if (!self->groundentity)
{

View file

@ -1200,7 +1200,7 @@ void G_SetClientEffects (edict_t *ent)
}
// show god mode
if ((coop->value || deathmatch->value) && ent->flags & FL_GODMODE && !(ent->client && ent->client->chaseactive))
if ( (coop->value || deathmatch->value) && (ent->flags & FL_GODMODE) && !(ent->client && ent->client->chaseactive) )
{
ent->s.effects |= EF_COLOR_SHELL;
ent->s.renderfx |= (RF_SHELL_RED|RF_SHELL_GREEN|RF_SHELL_BLUE);

View file

@ -87,7 +87,7 @@ typedef struct
int minimize, maximize;
} glmode_t;
glmode_t modes[] = {
glmode_t gl_modes[] = {
{"GL_NEAREST", GL_NEAREST, GL_NEAREST},
{"GL_LINEAR", GL_LINEAR, GL_LINEAR},
{"GL_NEAREST_MIPMAP_NEAREST", GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST},
@ -96,7 +96,7 @@ glmode_t modes[] = {
{"GL_LINEAR_MIPMAP_LINEAR", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR}
};
#define NUM_GL_MODES (sizeof(modes) / sizeof (glmode_t))
#define NUM_GL_MODES (sizeof(gl_modes) / sizeof (glmode_t))
typedef struct
{
@ -174,7 +174,7 @@ void GL_TextureMode( char *string )
for (i=0; i< NUM_GL_MODES; i++)
{
if ( !Q_stricmp( modes[i].name, string ) )
if ( !Q_stricmp(gl_modes[i].name, string) )
break;
}
@ -184,8 +184,8 @@ void GL_TextureMode( char *string )
return;
}
gl_filter_min = modes[i].minimize;
gl_filter_max = modes[i].maximize;
gl_filter_min = gl_modes[i].minimize;
gl_filter_max = gl_modes[i].maximize;
// clamp selected anisotropy
if (glConfig.anisotropic)

View file

@ -2342,6 +2342,8 @@ void R_BeginFrame( float camera_separation )
{
GL_TextureMode (r_texturemode->string);
r_texturemode->modified = false;
// we've already set anisotropy, so don't bother setting it again this frame
r_anisotropic->modified = false;
}
if (r_anisotropic->modified) // added anisotropic filter update

View file

@ -89,87 +89,81 @@ static void CreditsFunc (void *unused)
Menu_Credits_f ();
}
//=======================================================================
void Menu_Game_Init (void)
{
static const char *difficulty_names[] =
{
"easy",
"medium",
"hard",
0
};
int y = 0;
int x = 0, y = 0;
s_game_menu.x = SCREEN_WIDTH*0.5 - 24;
//s_game_menu.y = 0;
s_game_menu.x = SCREEN_WIDTH*0.5 - 3*MENU_LINE_SIZE;
s_game_menu.y = SCREEN_HEIGHT*0.5 - 5*MENU_LINE_SIZE; // 0
s_game_menu.nitems = 0;
s_easy_game_action.generic.type = MTYPE_ACTION;
s_easy_game_action.generic.textSize = MENU_FONT_SIZE;
s_easy_game_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_easy_game_action.generic.flags = QMF_LEFT_JUSTIFY;
s_easy_game_action.generic.x = 0;
s_easy_game_action.generic.x = x;
s_easy_game_action.generic.y = y; // 0
s_easy_game_action.generic.name = " easy";
s_easy_game_action.generic.name = "Easy";
s_easy_game_action.generic.callback = EasyGameFunc;
s_medium_game_action.generic.type = MTYPE_ACTION;
s_medium_game_action.generic.textSize = MENU_FONT_SIZE;
s_medium_game_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_medium_game_action.generic.flags = QMF_LEFT_JUSTIFY;
s_medium_game_action.generic.x = 0;
s_medium_game_action.generic.y = y += MENU_LINE_SIZE;
s_medium_game_action.generic.name = " medium";
s_medium_game_action.generic.x = x;
s_medium_game_action.generic.y = y += 1.5*MENU_LINE_SIZE;
s_medium_game_action.generic.name = "Medium";
s_medium_game_action.generic.callback = MediumGameFunc;
s_hard_game_action.generic.type = MTYPE_ACTION;
s_hard_game_action.generic.textSize = MENU_FONT_SIZE;
s_hard_game_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_hard_game_action.generic.flags = QMF_LEFT_JUSTIFY;
s_hard_game_action.generic.x = 0;
s_hard_game_action.generic.y = y += MENU_LINE_SIZE;
s_hard_game_action.generic.name = " hard";
s_hard_game_action.generic.x = x;
s_hard_game_action.generic.y = y += 1.5*MENU_LINE_SIZE;
s_hard_game_action.generic.name = "Hard";
s_hard_game_action.generic.callback = HardGameFunc;
s_nitemare_game_action.generic.type = MTYPE_ACTION;
s_nitemare_game_action.generic.textSize = MENU_FONT_SIZE;
s_nitemare_game_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_nitemare_game_action.generic.flags = QMF_LEFT_JUSTIFY;
s_nitemare_game_action.generic.x = 0;
s_nitemare_game_action.generic.y = y += MENU_LINE_SIZE;
s_nitemare_game_action.generic.name = " nightmare";
s_nitemare_game_action.generic.x = x;
s_nitemare_game_action.generic.y = y += 1.5*MENU_LINE_SIZE;
s_nitemare_game_action.generic.name = "Nightmare";
s_nitemare_game_action.generic.callback = NitemareGameFunc;
s_blankline.generic.type = MTYPE_SEPARATOR;
s_blankline.generic.textSize = MENU_FONT_SIZE;
s_load_game_action.generic.type = MTYPE_ACTION;
s_load_game_action.generic.textSize = MENU_FONT_SIZE;
s_load_game_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_load_game_action.generic.flags = QMF_LEFT_JUSTIFY;
s_load_game_action.generic.x = 0;
s_load_game_action.generic.y = y += 2*MENU_LINE_SIZE;
s_load_game_action.generic.name = " load game";
s_load_game_action.generic.x = x;
s_load_game_action.generic.y = y += 2*MENU_HEADER_LINE_SIZE; // 2*MENU_LINE_SIZE
s_load_game_action.generic.name = "Load Game";
s_load_game_action.generic.callback = LoadGameFunc;
s_save_game_action.generic.type = MTYPE_ACTION;
s_save_game_action.generic.textSize = MENU_FONT_SIZE;
s_save_game_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_save_game_action.generic.flags = QMF_LEFT_JUSTIFY;
s_save_game_action.generic.x = 0;
s_save_game_action.generic.y = y += MENU_LINE_SIZE;
s_save_game_action.generic.name = " save game";
s_save_game_action.generic.x = x;
s_save_game_action.generic.y = y += 1.5*MENU_LINE_SIZE;
s_save_game_action.generic.name = "Save Game";
s_save_game_action.generic.callback = SaveGameFunc;
s_credits_action.generic.type = MTYPE_ACTION;
s_credits_action.generic.textSize = MENU_FONT_SIZE;
s_credits_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_credits_action.generic.flags = QMF_LEFT_JUSTIFY;
s_credits_action.generic.x = 0;
s_credits_action.generic.y = y += MENU_LINE_SIZE;
s_credits_action.generic.name = " credits";
s_credits_action.generic.x = x;
s_credits_action.generic.y = y += 2*MENU_HEADER_LINE_SIZE; // 1.5*MENU_LINE_SIZE
s_credits_action.generic.name = "Credits";
s_credits_action.generic.callback = CreditsFunc;
s_game_back_action.generic.type = MTYPE_ACTION;
s_game_back_action.generic.textSize = MENU_FONT_SIZE;
s_game_back_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_game_back_action.generic.flags = QMF_LEFT_JUSTIFY;
s_game_back_action.generic.x = 0;
s_game_back_action.generic.y = y += 2*MENU_LINE_SIZE;
s_game_back_action.generic.name = " back to main";
s_game_back_action.generic.x = x;
s_game_back_action.generic.y = y += 3*MENU_HEADER_LINE_SIZE; // 2*MENU_LINE_SIZE
s_game_back_action.generic.name = "Back to Main";
s_game_back_action.generic.callback = UI_BackMenu;
UI_AddMenuItem (&s_game_menu, (void *) &s_easy_game_action);
@ -187,7 +181,7 @@ void Menu_Game_Init (void)
UI_AddMenuItem (&s_game_menu, (void *) &s_game_back_action);
UI_CenterMenu (&s_game_menu);
// UI_CenterMenu (&s_game_menu);
}
void Menu_Game_Draw (void)

View file

@ -80,8 +80,8 @@ extern menulist_s s_rules_box;
qboolean CTF_menumode (void)
{
if ( (FS_RoguePath() && s_rules_box.curvalue >= 3)
|| (!FS_RoguePath() && s_rules_box.curvalue >= 2) )
if ( (FS_RoguePath() && s_rules_box.curValue >= 3)
|| (!FS_RoguePath() && s_rules_box.curValue >= 2) )
return true;
return false;
}
@ -96,7 +96,7 @@ static void DMFlagCallback (void *self)
if ( f == &s_friendlyfire_box )
{
if ( f->curvalue )
if ( f->curValue )
flags &= ~DF_NO_FRIENDLY_FIRE;
else
flags |= DF_NO_FRIENDLY_FIRE;
@ -104,7 +104,7 @@ static void DMFlagCallback (void *self)
}
else if ( f == &s_falls_box )
{
if ( f->curvalue )
if ( f->curValue )
flags &= ~DF_NO_FALLING;
else
flags |= DF_NO_FALLING;
@ -124,7 +124,7 @@ static void DMFlagCallback (void *self)
}
else if ( f == &s_powerups_box )
{
if ( f->curvalue )
if ( f->curValue )
flags &= ~DF_NO_ITEMS;
else
flags |= DF_NO_ITEMS;
@ -132,7 +132,7 @@ static void DMFlagCallback (void *self)
}
else if ( f == &s_health_box )
{
if ( f->curvalue )
if ( f->curValue )
flags &= ~DF_NO_HEALTH;
else
flags |= DF_NO_HEALTH;
@ -144,12 +144,12 @@ static void DMFlagCallback (void *self)
}
else if ( f == &s_teamplay_box )
{
if ( f->curvalue == 1 )
if ( f->curValue == 1 )
{
flags |= DF_SKINTEAMS;
flags &= ~DF_MODELTEAMS;
}
else if ( f->curvalue == 2 )
else if ( f->curValue == 2 )
{
flags |= DF_MODELTEAMS;
flags &= ~DF_SKINTEAMS;
@ -171,7 +171,7 @@ static void DMFlagCallback (void *self)
}
else if ( f == &s_armor_box )
{
if ( f->curvalue )
if ( f->curValue )
flags &= ~DF_NO_ARMOR;
else
flags |= DF_NO_ARMOR;
@ -239,7 +239,7 @@ static void DMFlagCallback (void *self)
if ( f )
{
if ( f->curvalue == 0 )
if ( f->curValue == 0 )
flags &= ~bit;
else
flags |= bit;
@ -274,8 +274,8 @@ void Menu_DMOptions_Init (void)
s_falls_box.generic.y = y; // 0
s_falls_box.generic.name = "falling damage";
s_falls_box.generic.callback = DMFlagCallback;
s_falls_box.itemnames = yes_no_names;
s_falls_box.curvalue = ( dmflags & DF_NO_FALLING ) == 0;
s_falls_box.itemNames = yes_no_names;
s_falls_box.curValue = ( dmflags & DF_NO_FALLING ) == 0;
s_weapons_stay_box.generic.type = MTYPE_SPINCONTROL;
s_weapons_stay_box.generic.textSize = MENU_FONT_SIZE;
@ -283,8 +283,8 @@ void Menu_DMOptions_Init (void)
s_weapons_stay_box.generic.y = y += MENU_LINE_SIZE;
s_weapons_stay_box.generic.name = "weapons stay";
s_weapons_stay_box.generic.callback = DMFlagCallback;
s_weapons_stay_box.itemnames = yes_no_names;
s_weapons_stay_box.curvalue = ( dmflags & DF_WEAPONS_STAY ) != 0;
s_weapons_stay_box.itemNames = yes_no_names;
s_weapons_stay_box.curValue = ( dmflags & DF_WEAPONS_STAY ) != 0;
s_instant_powerups_box.generic.type = MTYPE_SPINCONTROL;
s_instant_powerups_box.generic.textSize = MENU_FONT_SIZE;
@ -292,8 +292,8 @@ void Menu_DMOptions_Init (void)
s_instant_powerups_box.generic.y = y += MENU_LINE_SIZE;
s_instant_powerups_box.generic.name = "instant powerups";
s_instant_powerups_box.generic.callback = DMFlagCallback;
s_instant_powerups_box.itemnames = yes_no_names;
s_instant_powerups_box.curvalue = ( dmflags & DF_INSTANT_ITEMS ) != 0;
s_instant_powerups_box.itemNames = yes_no_names;
s_instant_powerups_box.curValue = ( dmflags & DF_INSTANT_ITEMS ) != 0;
s_powerups_box.generic.type = MTYPE_SPINCONTROL;
s_powerups_box.generic.textSize = MENU_FONT_SIZE;
@ -301,8 +301,8 @@ void Menu_DMOptions_Init (void)
s_powerups_box.generic.y = y += MENU_LINE_SIZE;
s_powerups_box.generic.name = "allow powerups";
s_powerups_box.generic.callback = DMFlagCallback;
s_powerups_box.itemnames = yes_no_names;
s_powerups_box.curvalue = ( dmflags & DF_NO_ITEMS ) == 0;
s_powerups_box.itemNames = yes_no_names;
s_powerups_box.curValue = ( dmflags & DF_NO_ITEMS ) == 0;
s_health_box.generic.type = MTYPE_SPINCONTROL;
s_health_box.generic.textSize = MENU_FONT_SIZE;
@ -310,8 +310,8 @@ void Menu_DMOptions_Init (void)
s_health_box.generic.y = y += MENU_LINE_SIZE;
s_health_box.generic.callback = DMFlagCallback;
s_health_box.generic.name = "allow health";
s_health_box.itemnames = yes_no_names;
s_health_box.curvalue = ( dmflags & DF_NO_HEALTH ) == 0;
s_health_box.itemNames = yes_no_names;
s_health_box.curValue = ( dmflags & DF_NO_HEALTH ) == 0;
s_armor_box.generic.type = MTYPE_SPINCONTROL;
s_armor_box.generic.textSize = MENU_FONT_SIZE;
@ -319,8 +319,8 @@ void Menu_DMOptions_Init (void)
s_armor_box.generic.y = y += MENU_LINE_SIZE;
s_armor_box.generic.name = "allow armor";
s_armor_box.generic.callback = DMFlagCallback;
s_armor_box.itemnames = yes_no_names;
s_armor_box.curvalue = ( dmflags & DF_NO_ARMOR ) == 0;
s_armor_box.itemNames = yes_no_names;
s_armor_box.curValue = ( dmflags & DF_NO_ARMOR ) == 0;
s_spawn_farthest_box.generic.type = MTYPE_SPINCONTROL;
s_spawn_farthest_box.generic.textSize = MENU_FONT_SIZE;
@ -328,8 +328,8 @@ void Menu_DMOptions_Init (void)
s_spawn_farthest_box.generic.y = y += MENU_LINE_SIZE;
s_spawn_farthest_box.generic.name = "spawn farthest";
s_spawn_farthest_box.generic.callback = DMFlagCallback;
s_spawn_farthest_box.itemnames = yes_no_names;
s_spawn_farthest_box.curvalue = ( dmflags & DF_SPAWN_FARTHEST ) != 0;
s_spawn_farthest_box.itemNames = yes_no_names;
s_spawn_farthest_box.curValue = ( dmflags & DF_SPAWN_FARTHEST ) != 0;
s_samelevel_box.generic.type = MTYPE_SPINCONTROL;
s_samelevel_box.generic.textSize = MENU_FONT_SIZE;
@ -337,8 +337,8 @@ void Menu_DMOptions_Init (void)
s_samelevel_box.generic.y = y += MENU_LINE_SIZE;
s_samelevel_box.generic.name = "same map";
s_samelevel_box.generic.callback = DMFlagCallback;
s_samelevel_box.itemnames = yes_no_names;
s_samelevel_box.curvalue = ( dmflags & DF_SAME_LEVEL ) != 0;
s_samelevel_box.itemNames = yes_no_names;
s_samelevel_box.curValue = ( dmflags & DF_SAME_LEVEL ) != 0;
s_force_respawn_box.generic.type = MTYPE_SPINCONTROL;
s_force_respawn_box.generic.textSize = MENU_FONT_SIZE;
@ -346,8 +346,8 @@ void Menu_DMOptions_Init (void)
s_force_respawn_box.generic.y = y += MENU_LINE_SIZE;
s_force_respawn_box.generic.name = "force respawn";
s_force_respawn_box.generic.callback = DMFlagCallback;
s_force_respawn_box.itemnames = yes_no_names;
s_force_respawn_box.curvalue = ( dmflags & DF_FORCE_RESPAWN ) != 0;
s_force_respawn_box.itemNames = yes_no_names;
s_force_respawn_box.curValue = ( dmflags & DF_FORCE_RESPAWN ) != 0;
s_teamplay_box.generic.type = MTYPE_SPINCONTROL;
s_teamplay_box.generic.textSize = MENU_FONT_SIZE;
@ -355,8 +355,8 @@ void Menu_DMOptions_Init (void)
s_teamplay_box.generic.y = y += MENU_LINE_SIZE;
s_teamplay_box.generic.name = "teamplay";
s_teamplay_box.generic.callback = DMFlagCallback;
s_teamplay_box.itemnames = teamplay_names;
s_teamplay_box.curvalue = (dmflags & DF_SKINTEAMS) ? 1 : ((dmflags & DF_MODELTEAMS) ? 2 : 0);
s_teamplay_box.itemNames = teamplay_names;
s_teamplay_box.curValue = (dmflags & DF_SKINTEAMS) ? 1 : ((dmflags & DF_MODELTEAMS) ? 2 : 0);
s_allow_exit_box.generic.type = MTYPE_SPINCONTROL;
s_allow_exit_box.generic.textSize = MENU_FONT_SIZE;
@ -364,8 +364,8 @@ void Menu_DMOptions_Init (void)
s_allow_exit_box.generic.y = y += MENU_LINE_SIZE;
s_allow_exit_box.generic.name = "allow exit";
s_allow_exit_box.generic.callback = DMFlagCallback;
s_allow_exit_box.itemnames = yes_no_names;
s_allow_exit_box.curvalue = ( dmflags & DF_ALLOW_EXIT ) != 0;
s_allow_exit_box.itemNames = yes_no_names;
s_allow_exit_box.curValue = ( dmflags & DF_ALLOW_EXIT ) != 0;
s_infinite_ammo_box.generic.type = MTYPE_SPINCONTROL;
s_infinite_ammo_box.generic.textSize = MENU_FONT_SIZE;
@ -373,8 +373,8 @@ void Menu_DMOptions_Init (void)
s_infinite_ammo_box.generic.y = y += MENU_LINE_SIZE;
s_infinite_ammo_box.generic.name = "infinite ammo";
s_infinite_ammo_box.generic.callback = DMFlagCallback;
s_infinite_ammo_box.itemnames = yes_no_names;
s_infinite_ammo_box.curvalue = ( dmflags & DF_INFINITE_AMMO ) != 0;
s_infinite_ammo_box.itemNames = yes_no_names;
s_infinite_ammo_box.curValue = ( dmflags & DF_INFINITE_AMMO ) != 0;
s_fixed_fov_box.generic.type = MTYPE_SPINCONTROL;
s_fixed_fov_box.generic.textSize = MENU_FONT_SIZE;
@ -382,8 +382,8 @@ void Menu_DMOptions_Init (void)
s_fixed_fov_box.generic.y = y += MENU_LINE_SIZE;
s_fixed_fov_box.generic.name = "fixed FOV";
s_fixed_fov_box.generic.callback = DMFlagCallback;
s_fixed_fov_box.itemnames = yes_no_names;
s_fixed_fov_box.curvalue = ( dmflags & DF_FIXED_FOV ) != 0;
s_fixed_fov_box.itemNames = yes_no_names;
s_fixed_fov_box.curValue = ( dmflags & DF_FIXED_FOV ) != 0;
s_quad_drop_box.generic.type = MTYPE_SPINCONTROL;
s_quad_drop_box.generic.textSize = MENU_FONT_SIZE;
@ -391,8 +391,8 @@ void Menu_DMOptions_Init (void)
s_quad_drop_box.generic.y = y += MENU_LINE_SIZE;
s_quad_drop_box.generic.name = "quad drop";
s_quad_drop_box.generic.callback = DMFlagCallback;
s_quad_drop_box.itemnames = yes_no_names;
s_quad_drop_box.curvalue = ( dmflags & DF_QUAD_DROP ) != 0;
s_quad_drop_box.itemNames = yes_no_names;
s_quad_drop_box.curValue = ( dmflags & DF_QUAD_DROP ) != 0;
s_friendlyfire_box.generic.type = MTYPE_SPINCONTROL;
s_friendlyfire_box.generic.textSize = MENU_FONT_SIZE;
@ -400,8 +400,8 @@ void Menu_DMOptions_Init (void)
s_friendlyfire_box.generic.y = y += MENU_LINE_SIZE;
s_friendlyfire_box.generic.name = "friendly fire";
s_friendlyfire_box.generic.callback = DMFlagCallback;
s_friendlyfire_box.itemnames = yes_no_names;
s_friendlyfire_box.curvalue = ( dmflags & DF_NO_FRIENDLY_FIRE ) == 0;
s_friendlyfire_box.itemNames = yes_no_names;
s_friendlyfire_box.curValue = ( dmflags & DF_NO_FRIENDLY_FIRE ) == 0;
// Knightmare added
if ( FS_ModType("xatrix") )
@ -412,8 +412,8 @@ void Menu_DMOptions_Init (void)
s_quadfire_drop_box.generic.y = y += MENU_LINE_SIZE;
s_quadfire_drop_box.generic.name = "dualfire drop";
s_quadfire_drop_box.generic.callback = DMFlagCallback;
s_quadfire_drop_box.itemnames = yes_no_names;
s_quadfire_drop_box.curvalue = ( dmflags & DF_QUADFIRE_DROP ) != 0;
s_quadfire_drop_box.itemNames = yes_no_names;
s_quadfire_drop_box.curValue = ( dmflags & DF_QUADFIRE_DROP ) != 0;
}
//============
//ROGUE
@ -426,8 +426,8 @@ void Menu_DMOptions_Init (void)
s_no_mines_box.generic.y = y += MENU_LINE_SIZE;
s_no_mines_box.generic.name = "remove mines";
s_no_mines_box.generic.callback = DMFlagCallback;
s_no_mines_box.itemnames = yes_no_names;
s_no_mines_box.curvalue = ( dmflags & DF_NO_MINES ) != 0;
s_no_mines_box.itemNames = yes_no_names;
s_no_mines_box.curValue = ( dmflags & DF_NO_MINES ) != 0;
s_no_nukes_box.generic.type = MTYPE_SPINCONTROL;
s_no_nukes_box.generic.textSize = MENU_FONT_SIZE;
@ -435,8 +435,8 @@ void Menu_DMOptions_Init (void)
s_no_nukes_box.generic.y = y += MENU_LINE_SIZE;
s_no_nukes_box.generic.name = "remove nukes";
s_no_nukes_box.generic.callback = DMFlagCallback;
s_no_nukes_box.itemnames = yes_no_names;
s_no_nukes_box.curvalue = ( dmflags & DF_NO_NUKES ) != 0;
s_no_nukes_box.itemNames = yes_no_names;
s_no_nukes_box.curValue = ( dmflags & DF_NO_NUKES ) != 0;
s_stack_double_box.generic.type = MTYPE_SPINCONTROL;
s_stack_double_box.generic.textSize = MENU_FONT_SIZE;
@ -444,8 +444,8 @@ void Menu_DMOptions_Init (void)
s_stack_double_box.generic.y = y += MENU_LINE_SIZE;
s_stack_double_box.generic.name = "2x/4x stacking off";
s_stack_double_box.generic.callback = DMFlagCallback;
s_stack_double_box.itemnames = yes_no_names;
s_stack_double_box.curvalue = ( dmflags & DF_NO_STACK_DOUBLE ) != 0;
s_stack_double_box.itemNames = yes_no_names;
s_stack_double_box.curValue = ( dmflags & DF_NO_STACK_DOUBLE ) != 0;
s_no_spheres_box.generic.type = MTYPE_SPINCONTROL;
s_no_spheres_box.generic.textSize = MENU_FONT_SIZE;
@ -453,8 +453,8 @@ void Menu_DMOptions_Init (void)
s_no_spheres_box.generic.y = y += MENU_LINE_SIZE;
s_no_spheres_box.generic.name = "remove spheres";
s_no_spheres_box.generic.callback = DMFlagCallback;
s_no_spheres_box.itemnames = yes_no_names;
s_no_spheres_box.curvalue = ( dmflags & DF_NO_SPHERES ) != 0;
s_no_spheres_box.itemNames = yes_no_names;
s_no_spheres_box.curValue = ( dmflags & DF_NO_SPHERES ) != 0;
}
//ROGUE
@ -468,8 +468,8 @@ void Menu_DMOptions_Init (void)
s_ctf_forceteam_box.generic.y = y += MENU_LINE_SIZE;
s_ctf_forceteam_box.generic.name = "force team join";
s_ctf_forceteam_box.generic.callback = DMFlagCallback;
s_ctf_forceteam_box.itemnames = yes_no_names;
s_ctf_forceteam_box.curvalue = ( dmflags & DF_CTF_FORCEJOIN ) != 0;
s_ctf_forceteam_box.itemNames = yes_no_names;
s_ctf_forceteam_box.curValue = ( dmflags & DF_CTF_FORCEJOIN ) != 0;
s_ctf_armor_protect_box.generic.type = MTYPE_SPINCONTROL;
s_ctf_armor_protect_box.generic.textSize = MENU_FONT_SIZE;
@ -477,8 +477,8 @@ void Menu_DMOptions_Init (void)
s_ctf_armor_protect_box.generic.y = y += MENU_LINE_SIZE;
s_ctf_armor_protect_box.generic.name = "team armor protect";
s_ctf_armor_protect_box.generic.callback = DMFlagCallback;
s_ctf_armor_protect_box.itemnames = yes_no_names;
s_ctf_armor_protect_box.curvalue = ( dmflags & DF_ARMOR_PROTECT ) != 0;
s_ctf_armor_protect_box.itemNames = yes_no_names;
s_ctf_armor_protect_box.curValue = ( dmflags & DF_ARMOR_PROTECT ) != 0;
s_ctf_notechs_box.generic.type = MTYPE_SPINCONTROL;
s_ctf_notechs_box.generic.textSize = MENU_FONT_SIZE;
@ -486,8 +486,8 @@ void Menu_DMOptions_Init (void)
s_ctf_notechs_box.generic.y = y += MENU_LINE_SIZE;
s_ctf_notechs_box.generic.name = "disable techs";
s_ctf_notechs_box.generic.callback = DMFlagCallback;
s_ctf_notechs_box.itemnames = yes_no_names;
s_ctf_notechs_box.curvalue = ( dmflags & DF_CTF_NO_TECH ) != 0;
s_ctf_notechs_box.itemNames = yes_no_names;
s_ctf_notechs_box.curValue = ( dmflags & DF_CTF_NO_TECH ) != 0;
}
s_dmoptions_back_action.generic.type = MTYPE_ACTION;

View file

@ -43,8 +43,8 @@ static menuseparator_s s_download_title;
static menulist_s s_allow_download_box;
#ifdef USE_CURL // HTTP downloading from R1Q2
static menulist_s s_allow_http_download_box;
static menulist_s s_allow_http_fallback_box;
static menulist_s s_http_download_box;
static menulist_s s_http_fallback_box;
#endif // USE_CURL
static menulist_s s_allow_download_maps_box;
@ -55,53 +55,68 @@ static menulist_s s_allow_download_sounds_box;
static menuaction_s s_download_back_action;
static void DownloadCallback (void *self)
{
menulist_s *f = (menulist_s *) self;
//=======================================================================
if (f == &s_allow_download_box)
static void AllowDownloadCallback (void *unused)
{
Cvar_SetValue("allow_download", f->curvalue);
UI_MenuSpinControl_SaveValue (&s_allow_download_box, "allow_download");
}
#ifdef USE_CURL // HTTP downloading from R1Q2
if (f == &s_allow_http_download_box)
static void HTTPDownloadCallback (void *unused)
{
Cvar_SetValue("cl_http_downloads", f->curvalue);
UI_MenuSpinControl_SaveValue (&s_http_download_box, "cl_http_downloads");
}
else if (f == &s_allow_http_fallback_box)
static void HTTPFallbackCallback (void *unused)
{
Cvar_SetValue("cl_http_fallback", f->curvalue);
UI_MenuSpinControl_SaveValue (&s_http_fallback_box, "cl_http_fallback");
}
#endif // USE_CURL
else if (f == &s_allow_download_maps_box)
static void DownloadMapsCallback (void *unused)
{
Cvar_SetValue("allow_download_maps", f->curvalue);
UI_MenuSpinControl_SaveValue (&s_allow_download_maps_box, "allow_download_maps");
}
// Knightmare- option to allow downloading 24-bit textures
else if (f == &s_allow_download_textures_24bit_box)
static void DownloadTextures24BitCallback (void *unused)
{
Cvar_SetValue("allow_download_textures_24bit", f->curvalue);
UI_MenuSpinControl_SaveValue (&s_allow_download_textures_24bit_box, "allow_download_textures_24bit");
}
else if (f == &s_allow_download_models_box)
static void DownloadPlayersCallback (void *unused)
{
Cvar_SetValue("allow_download_models", f->curvalue);
UI_MenuSpinControl_SaveValue (&s_allow_download_players_box, "allow_download_players");
}
else if (f == &s_allow_download_players_box)
static void DownloadModelsCallback (void *unused)
{
Cvar_SetValue("allow_download_players", f->curvalue);
UI_MenuSpinControl_SaveValue (&s_allow_download_models_box, "allow_download_models");
}
else if (f == &s_allow_download_sounds_box)
static void DownloadSoundsCallback (void *unused)
{
Cvar_SetValue("allow_download_sounds", f->curvalue);
UI_MenuSpinControl_SaveValue (&s_allow_download_sounds_box, "allow_download_sounds");
}
//=======================================================================
static void M_Download_SetMenuItemValues (void)
{
UI_MenuSpinControl_SetValue (&s_allow_download_box, "allow_download", 0, 1, true);
#ifdef USE_CURL // HTTP downloading from R1Q2
UI_MenuSpinControl_SetValue (&s_http_download_box, "cl_http_downloads", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_http_fallback_box, "cl_http_fallback", 0, 1, true);
#endif // USE_CURL
UI_MenuSpinControl_SetValue (&s_allow_download_maps_box, "allow_download_maps", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_allow_download_textures_24bit_box, "allow_download_textures_24bit", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_allow_download_players_box, "allow_download_players", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_allow_download_models_box, "allow_download_models", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_allow_download_sounds_box, "allow_download_sounds", 0, 1, true);
}
//=======================================================================
void Menu_DownloadOptions_Init (void)
{
static const char *yes_no_names[] =
@ -110,14 +125,10 @@ void Menu_DownloadOptions_Init (void)
"yes",
0
};
// int y = 0;
int y = 3*MENU_LINE_SIZE;
int y = 3*MENU_LINE_SIZE; // 0
s_downloadoptions_menu.x = SCREEN_WIDTH*0.5;
s_downloadoptions_menu.y = SCREEN_HEIGHT*0.5 - 58;
// s_downloadoptions_menu.x = viddef.width * 0.50;
// s_downloadoptions_menu.y = 0;
s_downloadoptions_menu.nitems = 0;
s_download_title.generic.type = MTYPE_SEPARATOR;
@ -131,31 +142,28 @@ void Menu_DownloadOptions_Init (void)
s_allow_download_box.generic.x = 0;
s_allow_download_box.generic.y = y += 2*MENU_LINE_SIZE;
s_allow_download_box.generic.name = "allow downloading";
s_allow_download_box.generic.callback = DownloadCallback;
s_allow_download_box.itemnames = yes_no_names;
s_allow_download_box.curvalue = (Cvar_VariableValue("allow_download") != 0);
s_allow_download_box.generic.callback = AllowDownloadCallback; // DownloadCallback
s_allow_download_box.itemNames = yes_no_names;
s_allow_download_box.generic.statusbar = "enable or disable all downloading";
#ifdef USE_CURL // HTTP downloading from R1Q2
s_allow_http_download_box.generic.type = MTYPE_SPINCONTROL;
s_allow_http_download_box.generic.textSize = MENU_FONT_SIZE;
s_allow_http_download_box.generic.x = 0;
s_allow_http_download_box.generic.y = y += MENU_LINE_SIZE;
s_allow_http_download_box.generic.name = "HTTP downloading";
s_allow_http_download_box.generic.callback = DownloadCallback;
s_allow_http_download_box.itemnames = yes_no_names;
s_allow_http_download_box.curvalue = (Cvar_VariableValue("cl_http_downloads") != 0);
s_allow_http_download_box.generic.statusbar = "use HTTP downloading on supported servers";
s_http_download_box.generic.type = MTYPE_SPINCONTROL;
s_http_download_box.generic.textSize = MENU_FONT_SIZE;
s_http_download_box.generic.x = 0;
s_http_download_box.generic.y = y += MENU_LINE_SIZE;
s_http_download_box.generic.name = "HTTP downloading";
s_http_download_box.generic.callback = HTTPDownloadCallback; // DownloadCallback
s_http_download_box.itemNames = yes_no_names;
s_http_download_box.generic.statusbar = "use HTTP downloading on supported servers";
s_allow_http_fallback_box.generic.type = MTYPE_SPINCONTROL;
s_allow_http_fallback_box.generic.textSize = MENU_FONT_SIZE;
s_allow_http_fallback_box.generic.x = 0;
s_allow_http_fallback_box.generic.y = y += MENU_LINE_SIZE;
s_allow_http_fallback_box.generic.name = "HTTP fallback";
s_allow_http_fallback_box.generic.callback = DownloadCallback;
s_allow_http_fallback_box.itemnames = yes_no_names;
s_allow_http_fallback_box.curvalue = (Cvar_VariableValue("cl_http_fallback") != 0);
s_allow_http_fallback_box.generic.statusbar = "enable to allow HTTP downloads to fall back to Q2Pro path and UDP";
s_http_fallback_box.generic.type = MTYPE_SPINCONTROL;
s_http_fallback_box.generic.textSize = MENU_FONT_SIZE;
s_http_fallback_box.generic.x = 0;
s_http_fallback_box.generic.y = y += MENU_LINE_SIZE;
s_http_fallback_box.generic.name = "HTTP fallback";
s_http_fallback_box.generic.callback = HTTPFallbackCallback; // DownloadCallback
s_http_fallback_box.itemNames = yes_no_names;
s_http_fallback_box.generic.statusbar = "enable to allow HTTP downloads to fall back to Q2Pro path and UDP";
#endif // USE_CURL
s_allow_download_maps_box.generic.type = MTYPE_SPINCONTROL;
@ -163,9 +171,8 @@ void Menu_DownloadOptions_Init (void)
s_allow_download_maps_box.generic.x = 0;
s_allow_download_maps_box.generic.y = y += 2*MENU_LINE_SIZE;
s_allow_download_maps_box.generic.name = "maps/textures";
s_allow_download_maps_box.generic.callback = DownloadCallback;
s_allow_download_maps_box.itemnames = yes_no_names;
s_allow_download_maps_box.curvalue = (Cvar_VariableValue("allow_download_maps") != 0);
s_allow_download_maps_box.generic.callback = DownloadMapsCallback; // DownloadCallback
s_allow_download_maps_box.itemNames = yes_no_names;
s_allow_download_maps_box.generic.statusbar = "enable to allow downloading of maps and textures";
// Knightmare- option to allow downloading 24-bit textures
@ -174,10 +181,9 @@ void Menu_DownloadOptions_Init (void)
s_allow_download_textures_24bit_box.generic.x = 0;
s_allow_download_textures_24bit_box.generic.y = y += MENU_LINE_SIZE;
s_allow_download_textures_24bit_box.generic.name = "24-bit textures";
s_allow_download_textures_24bit_box.generic.callback = DownloadCallback;
s_allow_download_textures_24bit_box.generic.callback = DownloadTextures24BitCallback; // DownloadCallback
s_allow_download_textures_24bit_box.generic.statusbar = "enable to allow downloading of JPG and TGA textures";
s_allow_download_textures_24bit_box.itemnames = yes_no_names;
s_allow_download_textures_24bit_box.curvalue = (Cvar_VariableValue("allow_download_textures_24bit") != 0);
s_allow_download_textures_24bit_box.itemNames = yes_no_names;
s_allow_download_textures_24bit_box.generic.statusbar = "enable to allow downloading of JPG and TGA textures";
s_allow_download_players_box.generic.type = MTYPE_SPINCONTROL;
@ -185,9 +191,8 @@ void Menu_DownloadOptions_Init (void)
s_allow_download_players_box.generic.x = 0;
s_allow_download_players_box.generic.y = y += MENU_LINE_SIZE;
s_allow_download_players_box.generic.name = "player models/skins";
s_allow_download_players_box.generic.callback = DownloadCallback;
s_allow_download_players_box.itemnames = yes_no_names;
s_allow_download_players_box.curvalue = (Cvar_VariableValue("allow_download_players") != 0);
s_allow_download_players_box.generic.callback = DownloadPlayersCallback; // DownloadCallback
s_allow_download_players_box.itemNames = yes_no_names;
s_allow_download_players_box.generic.statusbar = "enable to allow downloading of player models";
s_allow_download_models_box.generic.type = MTYPE_SPINCONTROL;
@ -195,9 +200,8 @@ void Menu_DownloadOptions_Init (void)
s_allow_download_models_box.generic.x = 0;
s_allow_download_models_box.generic.y = y += MENU_LINE_SIZE;
s_allow_download_models_box.generic.name = "models";
s_allow_download_models_box.generic.callback = DownloadCallback;
s_allow_download_models_box.itemnames = yes_no_names;
s_allow_download_models_box.curvalue = (Cvar_VariableValue("allow_download_models") != 0);
s_allow_download_models_box.generic.callback = DownloadModelsCallback; // DownloadCallback
s_allow_download_models_box.itemNames = yes_no_names;
s_allow_download_models_box.generic.statusbar = "enable to allow downloading of models";
s_allow_download_sounds_box.generic.type = MTYPE_SPINCONTROL;
@ -205,9 +209,8 @@ void Menu_DownloadOptions_Init (void)
s_allow_download_sounds_box.generic.x = 0;
s_allow_download_sounds_box.generic.y = y += MENU_LINE_SIZE;
s_allow_download_sounds_box.generic.name = "sounds";
s_allow_download_sounds_box.generic.callback = DownloadCallback;
s_allow_download_sounds_box.itemnames = yes_no_names;
s_allow_download_sounds_box.curvalue = (Cvar_VariableValue("allow_download_sounds") != 0);
s_allow_download_sounds_box.generic.callback = DownloadSoundsCallback; // DownloadCallback
s_allow_download_sounds_box.itemNames = yes_no_names;
s_allow_download_sounds_box.generic.statusbar = "enable to allow downloading of sounds";
s_download_back_action.generic.type = MTYPE_ACTION;
@ -218,12 +221,14 @@ void Menu_DownloadOptions_Init (void)
s_download_back_action.generic.name = " back";
s_download_back_action.generic.callback = UI_BackMenu;
M_Download_SetMenuItemValues ();
UI_AddMenuItem (&s_downloadoptions_menu, &s_download_title);
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_download_box);
#ifdef USE_CURL // HTTP downloading from R1Q2
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_http_download_box);
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_http_fallback_box);
UI_AddMenuItem (&s_downloadoptions_menu, &s_http_download_box);
UI_AddMenuItem (&s_downloadoptions_menu, &s_http_fallback_box);
#endif // USE_CURL
UI_AddMenuItem (&s_downloadoptions_menu, &s_allow_download_maps_box);

View file

@ -52,7 +52,7 @@ JOIN SERVER MENU
// Knightmare- client compatibility option
static void ClientCompatibilityFunc (void *unused)
{
Cvar_SetValue( "cl_servertrick", s_joinserver_compatibility_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_joinserver_compatibility_box, "cl_servertrick");
}
void JoinServerFunc (void *self)
@ -69,33 +69,31 @@ void AddressBookFunc (void *self)
Menu_AddressBook_f ();
}
// Knightmare- init client compatibility menu option
static void JoinserverSetMenuItemValues (void)
{
Cvar_SetValue( "cl_servertrick", ClampCvar( 0, 1, Cvar_VariableValue("cl_servertrick") ) );
s_joinserver_compatibility_box.curvalue = Cvar_VariableValue("cl_servertrick");
}
void SearchLocalGamesFunc (void *self)
{
UI_SearchLocalGames ();
}
//=======================================================================
// Knightmare- init client compatibility menu option
static void M_Joinserver_SetMenuItemValues (void)
{
UI_MenuSpinControl_SetValue (&s_joinserver_compatibility_box, "cl_servertrick", 0, 1, true);
}
//=========================================================
void Menu_JoinServer_Init (void)
{
int i;
int y = 0;
static const char *compatibility_names[] =
{
"version 56 (KMQuake2)", // was 35
"version 56 (KMQuake2)",
"version 34 (stock Quake2)",
0
};
JoinserverSetMenuItemValues (); // init item values
int i;
int y = 0;
s_joinserver_menu.x = SCREEN_WIDTH*0.5 - 160;
s_joinserver_menu.y = SCREEN_HEIGHT*0.5 - 80;
@ -113,10 +111,10 @@ void Menu_JoinServer_Init (void)
s_joinserver_compatibility_box.generic.name = "";
s_joinserver_compatibility_box.generic.x = -32;
s_joinserver_compatibility_box.generic.y = y += MENU_LINE_SIZE;
s_joinserver_compatibility_box.generic.cursor_offset = -24;
s_joinserver_compatibility_box.generic.callback = ClientCompatibilityFunc;
s_joinserver_compatibility_box.itemNames = compatibility_names;
s_joinserver_compatibility_box.generic.statusbar = "set to version 34 to join non-KMQuake2 servers";
s_joinserver_compatibility_box.itemnames = compatibility_names;
s_joinserver_compatibility_box.generic.cursor_offset = 0;
s_joinserver_address_book_action.generic.type = MTYPE_ACTION;
s_joinserver_address_book_action.generic.textSize = MENU_FONT_SIZE;
@ -163,6 +161,8 @@ void Menu_JoinServer_Init (void)
s_joinserver_back_action.generic.y = y += (UI_MAX_LOCAL_SERVERS+2)*MENU_LINE_SIZE;
s_joinserver_back_action.generic.callback = UI_BackMenu;
M_Joinserver_SetMenuItemValues (); // init item values
UI_AddMenuItem (&s_joinserver_menu, &s_joinserver_compat_title);
UI_AddMenuItem (&s_joinserver_menu, &s_joinserver_compatibility_box);

View file

@ -55,20 +55,15 @@ static menuaction_s s_playerconfig_back_action;
#define NUM_SKINBOX_ITEMS 7
static int rate_tbl[] = { 2500, 3200, 5000, 10000, 15000, 25000, 0 };
static const char *rate_names[] = { "28.8 Modem", "33.6 Modem", "56K/Single ISDN",
"Dual ISDN", "Cable/DSL", "T1/LAN", "User defined", 0 };
static void HandednessCallback (void *unused)
{
Cvar_SetValue ("hand", s_playerconfig_handedness_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_playerconfig_handedness_box, "hand");
}
static void RateCallback (void *unused)
{
if (s_playerconfig_rate_box.curvalue != sizeof(rate_tbl) / sizeof(*rate_tbl) - 1)
Cvar_SetValue ("rate", rate_tbl[s_playerconfig_rate_box.curvalue]);
UI_MenuSpinControl_SaveValue (&s_playerconfig_rate_box, "rate");
}
@ -76,10 +71,10 @@ static void Menu_PlayerModelCallback (void *unused)
{
int mNum, sNum;
mNum = s_playerconfig_model_box.curvalue;
s_playerconfig_skin_box.itemnames = ui_pmi[mNum].skinDisplayNames;
s_playerconfig_skin_box.curvalue = 0;
sNum = s_playerconfig_skin_box.curvalue;
mNum = s_playerconfig_model_box.curValue;
s_playerconfig_skin_box.itemNames = ui_pmi[mNum].skinDisplayNames;
s_playerconfig_skin_box.curValue = 0;
sNum = s_playerconfig_skin_box.curValue;
UI_UpdatePlayerModelInfo (mNum, sNum);
}
@ -89,8 +84,8 @@ static void Menu_PlayerSkinCallback (void *unused)
{
int mNum, sNum;
mNum = s_playerconfig_model_box.curvalue;
sNum = s_playerconfig_skin_box.curvalue;
mNum = s_playerconfig_model_box.curValue;
sNum = s_playerconfig_skin_box.curValue;
UI_UpdatePlayerSkinInfo (mNum, sNum);
}
@ -101,17 +96,34 @@ static void Menu_PlayerSkinCallback (void *unused)
qboolean Menu_PlayerConfig_Init (void)
{
int i, y;
int y;
int mNum = 0, sNum = 0;
cvar_t *hand = Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE);
static const char *handedness_names[] = { "right", "left", "center", 0 };
if ( (hand->integer < 0) || (hand->integer > 2) )
Cvar_SetValue ("hand", 0);
static const char *rate_names[] =
{
"28.8 Modem",
"33.6 Modem",
"56K/Single ISDN",
"Dual ISDN",
"Cable/DSL",
"T1/LAN",
"User defined",
0
};
static const char *rate_values[] =
{
"2500",
"3200",
"5000",
"10000",
"15000",
"25000",
UI_ITEMVALUE_WILDCARD,
0
};
// if (ui_numplayermodels == 0)
if ( !UI_HaveValidPlayerModels(NULL) )
return false;
@ -140,73 +152,70 @@ qboolean Menu_PlayerConfig_Init (void)
s_playerconfig_model_title.generic.textSize = MENU_FONT_SIZE;
s_playerconfig_model_title.generic.flags = QMF_LEFT_JUSTIFY;
s_playerconfig_model_title.generic.name = "model";
s_playerconfig_model_title.generic.x = -MENU_FONT_SIZE;
s_playerconfig_model_title.generic.x = -2*MENU_FONT_SIZE;
s_playerconfig_model_title.generic.y = y += 3*MENU_LINE_SIZE;
s_playerconfig_model_box.generic.type = MTYPE_SPINCONTROL;
s_playerconfig_model_box.generic.textSize = MENU_FONT_SIZE;
s_playerconfig_model_box.generic.x = -7*MENU_FONT_SIZE;
s_playerconfig_model_box.generic.x = -8*MENU_FONT_SIZE;
s_playerconfig_model_box.generic.y = y += MENU_LINE_SIZE;
s_playerconfig_model_box.generic.callback = Menu_PlayerModelCallback;
s_playerconfig_model_box.generic.cursor_offset = -6*MENU_FONT_SIZE;
s_playerconfig_model_box.curvalue = mNum;
s_playerconfig_model_box.itemnames = ui_pmnames;
s_playerconfig_model_box.generic.cursor_offset = -1*MENU_FONT_SIZE;
s_playerconfig_model_box.curValue = mNum;
s_playerconfig_model_box.itemNames = ui_pmnames;
s_playerconfig_skin_title.generic.type = MTYPE_SEPARATOR;
s_playerconfig_skin_title.generic.textSize = MENU_FONT_SIZE;
s_playerconfig_skin_title.generic.flags = QMF_LEFT_JUSTIFY;
s_playerconfig_skin_title.generic.name = "skin";
s_playerconfig_skin_title.generic.x = -2*MENU_FONT_SIZE;
s_playerconfig_skin_title.generic.x = -3*MENU_FONT_SIZE;
s_playerconfig_skin_title.generic.y = y += 2*MENU_LINE_SIZE;
s_playerconfig_skin_box.generic.type = MTYPE_SPINCONTROL;
s_playerconfig_skin_box.generic.textSize = MENU_FONT_SIZE;
s_playerconfig_skin_box.generic.x = -7*MENU_FONT_SIZE;
s_playerconfig_skin_box.generic.x = -8*MENU_FONT_SIZE;
s_playerconfig_skin_box.generic.y = y += MENU_LINE_SIZE;
s_playerconfig_skin_box.generic.name = 0;
s_playerconfig_skin_box.generic.callback = Menu_PlayerSkinCallback; // Knightmare added, was 0
s_playerconfig_skin_box.generic.cursor_offset = -6*MENU_FONT_SIZE;
s_playerconfig_skin_box.curvalue = sNum;
s_playerconfig_skin_box.itemnames = ui_pmi[mNum].skinDisplayNames;
s_playerconfig_skin_box.generic.cursor_offset = -1*MENU_FONT_SIZE;
s_playerconfig_skin_box.curValue = sNum;
s_playerconfig_skin_box.itemNames = ui_pmi[mNum].skinDisplayNames;
s_playerconfig_skin_box.generic.flags |= QMF_SKINLIST;
s_playerconfig_hand_title.generic.type = MTYPE_SEPARATOR;
s_playerconfig_hand_title.generic.textSize = MENU_FONT_SIZE;
s_playerconfig_hand_title.generic.flags = QMF_LEFT_JUSTIFY;
s_playerconfig_hand_title.generic.name = "handedness";
s_playerconfig_hand_title.generic.x = 4*MENU_FONT_SIZE;
s_playerconfig_hand_title.generic.x = 3*MENU_FONT_SIZE;
s_playerconfig_hand_title.generic.y = y += 2*MENU_LINE_SIZE;
s_playerconfig_handedness_box.generic.type = MTYPE_SPINCONTROL;
s_playerconfig_handedness_box.generic.textSize = MENU_FONT_SIZE;
s_playerconfig_handedness_box.generic.x = -7*MENU_FONT_SIZE;
s_playerconfig_handedness_box.generic.x = -8*MENU_FONT_SIZE;
s_playerconfig_handedness_box.generic.y = y += MENU_LINE_SIZE;
s_playerconfig_handedness_box.generic.name = 0;
s_playerconfig_handedness_box.generic.cursor_offset = -6*MENU_FONT_SIZE;
s_playerconfig_handedness_box.generic.cursor_offset = -1*MENU_FONT_SIZE;
s_playerconfig_handedness_box.generic.callback = HandednessCallback;
s_playerconfig_handedness_box.curvalue = Cvar_VariableValue( "hand" );
s_playerconfig_handedness_box.itemnames = handedness_names;
for (i = 0; i < sizeof(rate_tbl) / sizeof(*rate_tbl) - 1; i++)
if (Cvar_VariableValue("rate") == rate_tbl[i])
break;
s_playerconfig_handedness_box.itemNames = handedness_names;
UI_MenuSpinControl_SetValue (&s_playerconfig_handedness_box, "hand", 0, 2, true);
s_playerconfig_rate_title.generic.type = MTYPE_SEPARATOR;
s_playerconfig_rate_title.generic.textSize = MENU_FONT_SIZE;
s_playerconfig_rate_title.generic.flags = QMF_LEFT_JUSTIFY;
s_playerconfig_rate_title.generic.name = "connect speed";
s_playerconfig_rate_title.generic.x = 7*MENU_FONT_SIZE;
s_playerconfig_rate_title.generic.x = 6*MENU_FONT_SIZE;
s_playerconfig_rate_title.generic.y = y += 2*MENU_LINE_SIZE;
s_playerconfig_rate_box.generic.type = MTYPE_SPINCONTROL;
s_playerconfig_rate_box.generic.textSize = MENU_FONT_SIZE;
s_playerconfig_rate_box.generic.x = -7*MENU_FONT_SIZE;
s_playerconfig_rate_box.generic.x = -8*MENU_FONT_SIZE;
s_playerconfig_rate_box.generic.y = y += MENU_LINE_SIZE;
s_playerconfig_rate_box.generic.name = 0;
s_playerconfig_rate_box.generic.cursor_offset = -6*MENU_FONT_SIZE;
s_playerconfig_rate_box.generic.cursor_offset = -1*MENU_FONT_SIZE;
s_playerconfig_rate_box.generic.callback = RateCallback;
s_playerconfig_rate_box.curvalue = i;
s_playerconfig_rate_box.itemnames = rate_names;
s_playerconfig_rate_box.itemNames = rate_names;
s_playerconfig_rate_box.itemValues = rate_values;
UI_MenuSpinControl_SetValue (&s_playerconfig_rate_box, "rate", 0, 0, false);
s_playerconfig_back_action.generic.type = MTYPE_ACTION;
s_playerconfig_back_action.generic.textSize = MENU_FONT_SIZE;
@ -220,7 +229,7 @@ qboolean Menu_PlayerConfig_Init (void)
UI_AddMenuItem (&s_player_config_menu, &s_playerconfig_name_field);
UI_AddMenuItem (&s_player_config_menu, &s_playerconfig_model_title);
UI_AddMenuItem (&s_player_config_menu, &s_playerconfig_model_box);
if ( s_playerconfig_skin_box.itemnames )
if ( s_playerconfig_skin_box.itemNames )
{
UI_AddMenuItem (&s_player_config_menu, &s_playerconfig_skin_title);
UI_AddMenuItem (&s_player_config_menu, &s_playerconfig_skin_box);
@ -252,13 +261,13 @@ qboolean Menu_PlayerConfig_CheckIncrement (int dir, float x, float y, float w, f
{
if (dir) // dir == 1 is left
{
if (s_playerconfig_skin_box.curvalue > 0)
s_playerconfig_skin_box.curvalue--;
if (s_playerconfig_skin_box.curValue > 0)
s_playerconfig_skin_box.curValue--;
}
else
{
if (s_playerconfig_skin_box.curvalue < ui_pmi[s_playerconfig_model_box.curvalue].nskins)
s_playerconfig_skin_box.curvalue++;
if (s_playerconfig_skin_box.curValue < ui_pmi[s_playerconfig_model_box.curValue].nskins)
s_playerconfig_skin_box.curValue++;
}
sound = menu_move_sound;
@ -287,12 +296,12 @@ void Menu_PlayerConfig_MouseClick (void)
for (i=0; i<NUM_SKINBOX_ITEMS; i++)
buttons[i].index =- 1;
if ( (ui_pmi[s_playerconfig_model_box.curvalue].nskins < NUM_SKINBOX_ITEMS) || (s_playerconfig_skin_box.curvalue < 4) )
if ( (ui_pmi[s_playerconfig_model_box.curValue].nskins < NUM_SKINBOX_ITEMS) || (s_playerconfig_skin_box.curValue < 4) )
i = 0;
else if (s_playerconfig_skin_box.curvalue > ui_pmi[s_playerconfig_model_box.curvalue].nskins-4)
i = ui_pmi[s_playerconfig_model_box.curvalue].nskins-NUM_SKINBOX_ITEMS;
else if (s_playerconfig_skin_box.curValue > ui_pmi[s_playerconfig_model_box.curValue].nskins-4)
i = ui_pmi[s_playerconfig_model_box.curValue].nskins-NUM_SKINBOX_ITEMS;
else
i = s_playerconfig_skin_box.curvalue-3;
i = s_playerconfig_skin_box.curValue-3;
if (i > 0)
if (Menu_PlayerConfig_CheckIncrement (1, icon_x-39, icon_y, 32, 32))
@ -300,7 +309,7 @@ void Menu_PlayerConfig_MouseClick (void)
for (count=0; count<NUM_SKINBOX_ITEMS; i++,count++)
{
if ( (i < 0) || (i >= ui_pmi[s_playerconfig_model_box.curvalue].nskins) )
if ( (i < 0) || (i >= ui_pmi[s_playerconfig_model_box.curValue].nskins) )
continue;
UI_AddButton (&buttons[count], i, icon_x+icon_offset, icon_y, 32, 32);
@ -308,7 +317,7 @@ void Menu_PlayerConfig_MouseClick (void)
}
icon_offset = NUM_SKINBOX_ITEMS*34;
if (ui_pmi[s_playerconfig_model_box.curvalue].nskins-i > 0)
if (ui_pmi[s_playerconfig_model_box.curValue].nskins-i > 0)
if (Menu_PlayerConfig_CheckIncrement (0, icon_x+icon_offset+5, icon_y, 32, 32))
return;
@ -322,7 +331,7 @@ void Menu_PlayerConfig_MouseClick (void)
{
if (!ui_mousecursor.buttonused[MOUSEBUTTON1] && ui_mousecursor.buttonclicks[MOUSEBUTTON1]==1)
{
s_playerconfig_skin_box.curvalue = buttons[i].index;
s_playerconfig_skin_box.curValue = buttons[i].index;
sound = menu_move_sound;
ui_mousecursor.buttonused[MOUSEBUTTON1] = true;
@ -355,12 +364,12 @@ void Menu_PlayerConfig_DrawSkinSelection (void)
Vector4Copy (stCoord_arrow_left, arrowTemp[0]);
Vector4Copy (stCoord_arrow_right, arrowTemp[1]);
if ( (ui_pmi[s_playerconfig_model_box.curvalue].nskins < NUM_SKINBOX_ITEMS) || (s_playerconfig_skin_box.curvalue < 4) )
if ( (ui_pmi[s_playerconfig_model_box.curValue].nskins < NUM_SKINBOX_ITEMS) || (s_playerconfig_skin_box.curValue < 4) )
i = 0;
else if ( s_playerconfig_skin_box.curvalue > (ui_pmi[s_playerconfig_model_box.curvalue].nskins - 4) )
i = ui_pmi[s_playerconfig_model_box.curvalue].nskins-NUM_SKINBOX_ITEMS;
else if ( s_playerconfig_skin_box.curValue > (ui_pmi[s_playerconfig_model_box.curValue].nskins - 4) )
i = ui_pmi[s_playerconfig_model_box.curValue].nskins-NUM_SKINBOX_ITEMS;
else
i = s_playerconfig_skin_box.curvalue - 3;
i = s_playerconfig_skin_box.curValue - 3;
// left arrow
if (i > 0) {
@ -389,14 +398,14 @@ void Menu_PlayerConfig_DrawSkinSelection (void)
for (count=0; count<NUM_SKINBOX_ITEMS; i++,count++)
{
if ( (i < 0) || (i >= ui_pmi[s_playerconfig_model_box.curvalue].nskins) )
if ( (i < 0) || (i >= ui_pmi[s_playerconfig_model_box.curValue].nskins) )
continue;
Com_sprintf (scratch, sizeof(scratch), "/players/%s/%s_i.pcx",
ui_pmi[s_playerconfig_model_box.curvalue].directory,
ui_pmi[s_playerconfig_model_box.curvalue].skinDisplayNames[i] );
ui_pmi[s_playerconfig_model_box.curValue].directory,
ui_pmi[s_playerconfig_model_box.curValue].skinDisplayNames[i] );
if (i == s_playerconfig_skin_box.curvalue)
if (i == s_playerconfig_skin_box.curValue)
UI_DrawFill (icon_x + icon_offset-1, icon_y-1, 34, 34, ALIGN_CENTER, false, color[0], color[1] ,color[2], 255);
UI_DrawPic (icon_x + icon_offset, icon_y, 32, 32, ALIGN_CENTER, false, scratch, 1.0);
icon_offset += 34;
@ -404,7 +413,7 @@ void Menu_PlayerConfig_DrawSkinSelection (void)
// right arrow
icon_offset = NUM_SKINBOX_ITEMS*34;
if ( ui_pmi[s_playerconfig_model_box.curvalue].nskins-i > 0 ) {
if ( ui_pmi[s_playerconfig_model_box.curValue].nskins-i > 0 ) {
Vector4Set (arrowColor, color[0], color[1], color[2], 255);
// Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right.pcx");
}
@ -438,7 +447,7 @@ void Menu_PlayerConfig_Draw (void)
refdef.fov_y = CalcFov (refdef.fov_x, refdef.width, refdef.height);
refdef.time = cls.realtime*0.001;
if ( ui_pmi[s_playerconfig_model_box.curvalue].skinDisplayNames )
if ( ui_pmi[s_playerconfig_model_box.curValue].skinDisplayNames )
{
int yaw;
int maxframe = 29;
@ -527,8 +536,8 @@ void Menu_PConfigSaveChanges (void)
Cvar_Set ("name", s_playerconfig_name_field.buffer);
mNum = s_playerconfig_model_box.curvalue;
sNum = s_playerconfig_skin_box.curvalue;
mNum = s_playerconfig_model_box.curValue;
sNum = s_playerconfig_skin_box.curValue;
Com_sprintf (scratch, sizeof( scratch ), "%s/%s",
ui_pmi[mNum].directory, ui_pmi[mNum].skinDisplayNames[sNum]);
Cvar_Set ("skin", scratch);

View file

@ -55,10 +55,10 @@ static menuaction_s s_startserver_back_action;
/*
===============
Menu_RefreshMapList
M_RefreshMapList
===============
*/
void Menu_RefreshMapList (maptype_t maptype)
void M_RefreshMapList (maptype_t maptype)
{
int i;
@ -69,31 +69,31 @@ void Menu_RefreshMapList (maptype_t maptype)
UI_UpdateMapList (maptype);
// reset startmap if it's in the part of the list that changed
if (s_startmap_list.curvalue >= ui_svr_listfile_nummaps)
s_startmap_list.curvalue = 0;
if (s_startmap_list.curValue >= ui_svr_listfile_nummaps)
s_startmap_list.curValue = 0;
s_startmap_list.itemnames = ui_svr_mapnames;
for (i=0; s_startmap_list.itemnames[i]; i++);
s_startmap_list.numitemnames = i;
s_startmap_list.itemNames = ui_svr_mapnames;
for (i=0; s_startmap_list.itemNames[i]; i++);
s_startmap_list.numItems = i;
}
//=============================================================================
void DMOptionsFunc (void *self)
void M_DMOptionsFunc (void *self)
{
if (s_rules_box.curvalue == 1)
if (s_rules_box.curValue == 1)
return;
Menu_DMOptions_f ();
}
void RulesChangeFunc (void *self)
void M_RulesChangeFunc (void *self)
{
maptype_t maptype = MAP_DM;
UI_SetCoopMenuMode (false);
UI_SetCTFMenuMode (false);
if (s_rules_box.curvalue == 0) // DM
if (s_rules_box.curValue == 0) // DM
{
s_maxclients_field.generic.statusbar = NULL;
if (atoi(s_maxclients_field.buffer) <= 8) // set default of 8
@ -102,7 +102,7 @@ void RulesChangeFunc (void *self)
s_startserver_dmoptions_action.generic.statusbar = NULL;
maptype = MAP_DM;
}
else if (s_rules_box.curvalue == 1) // coop // PGM
else if (s_rules_box.curValue == 1) // coop // PGM
{
s_maxclients_field.generic.statusbar = "4 maximum for cooperative";
if (atoi(s_maxclients_field.buffer) > 4)
@ -112,7 +112,7 @@ void RulesChangeFunc (void *self)
maptype = MAP_COOP;
UI_SetCoopMenuMode (true);
}
else if (s_rules_box.curvalue == 2) // CTF
else if (s_rules_box.curValue == 2) // CTF
{
s_maxclients_field.generic.statusbar = NULL;
if (atoi(s_maxclients_field.buffer) <= 12) // set default of 12
@ -122,7 +122,7 @@ void RulesChangeFunc (void *self)
maptype = MAP_CTF;
UI_SetCTFMenuMode (true);
}
else if (s_rules_box.curvalue == 3) // 3Team CTF
else if (s_rules_box.curValue == 3) // 3Team CTF
{
s_maxclients_field.generic.statusbar = NULL;
if (atoi(s_maxclients_field.buffer) <= 18) // set default of 18
@ -133,7 +133,7 @@ void RulesChangeFunc (void *self)
UI_SetCTFMenuMode (true);
}
// ROGUE GAMES
else if (FS_RoguePath() && s_rules_box.curvalue == 4) // tag
else if (FS_RoguePath() && s_rules_box.curValue == 4) // tag
{
s_maxclients_field.generic.statusbar = NULL;
if (atoi(s_maxclients_field.buffer) <= 8) // set default of 8
@ -143,7 +143,7 @@ void RulesChangeFunc (void *self)
maptype = MAP_DM;
}
Menu_RefreshMapList (maptype);
M_RefreshMapList (maptype);
}
void Menu_StartServerActionFunc (void *self)
@ -153,7 +153,7 @@ void Menu_StartServerActionFunc (void *self)
int fraglimit;
int maxclients;
Q_strncpyz (startmap, sizeof(startmap), strchr( ui_svr_mapnames[s_startmap_list.curvalue], '\n' ) + 1);
Q_strncpyz (startmap, sizeof(startmap), strchr( ui_svr_mapnames[s_startmap_list.curValue], '\n' ) + 1);
maxclients = atoi( s_maxclients_field.buffer );
timelimit = atoi( s_timelimit_field.buffer );
@ -164,13 +164,13 @@ void Menu_StartServerActionFunc (void *self)
Cvar_SetValue ("fraglimit", ClampCvar( 0, fraglimit, fraglimit ) );
Cvar_Set("hostname", s_hostname_field.buffer );
Cvar_SetValue ("deathmatch", s_rules_box.curvalue != 1);
Cvar_SetValue ("coop", s_rules_box.curvalue == 1);
Cvar_SetValue ("ctf", s_rules_box.curvalue == 2);
Cvar_SetValue ("ttctf", s_rules_box.curvalue == 3);
Cvar_SetValue ("gamerules", FS_RoguePath() ? ((s_rules_box.curvalue == 4) ? 2 : 0) : 0);
Cvar_SetValue ("deathmatch", s_rules_box.curValue != 1);
Cvar_SetValue ("coop", s_rules_box.curValue == 1);
Cvar_SetValue ("ctf", s_rules_box.curValue == 2);
Cvar_SetValue ("ttctf", s_rules_box.curValue == 3);
Cvar_SetValue ("gamerules", FS_RoguePath() ? ((s_rules_box.curValue == 4) ? 2 : 0) : 0);
UI_StartServer (startmap, (s_dedicated_box.curvalue != 0));
UI_StartServer (startmap, (s_dedicated_box.curValue != 0));
}
void Menu_StartServer_Init (void)
@ -213,7 +213,7 @@ void Menu_StartServer_Init (void)
s_startmap_list.generic.x = 0;
s_startmap_list.generic.y = y;
s_startmap_list.generic.name = "initial map";
s_startmap_list.itemnames = ui_svr_mapnames;
s_startmap_list.itemNames = ui_svr_mapnames;
s_rules_box.generic.type = MTYPE_SPINCONTROL;
s_rules_box.generic.textSize = MENU_FONT_SIZE;
@ -222,21 +222,21 @@ void Menu_StartServer_Init (void)
s_rules_box.generic.name = "rules";
//PGM - rogue games only available with rogue DLL.
if ( FS_RoguePath() )
s_rules_box.itemnames = dm_coop_names_rogue;
s_rules_box.itemNames = dm_coop_names_rogue;
else
s_rules_box.itemnames = dm_coop_names;
s_rules_box.itemNames = dm_coop_names;
//PGM
if (Cvar_VariableValue("ttctf"))
s_rules_box.curvalue = 3;
s_rules_box.curValue = 3;
else if (Cvar_VariableValue("ctf"))
s_rules_box.curvalue = 2;
s_rules_box.curValue = 2;
else if (FS_RoguePath() && Cvar_VariableValue("gamerules") == 2)
s_rules_box.curvalue = 4;
s_rules_box.curValue = 4;
else if (Cvar_VariableValue("coop"))
s_rules_box.curvalue = 1;
s_rules_box.curValue = 1;
else
s_rules_box.curvalue = 0;
s_rules_box.generic.callback = RulesChangeFunc;
s_rules_box.curValue = 0;
s_rules_box.generic.callback = M_RulesChangeFunc;
s_timelimit_field.generic.type = MTYPE_FIELD;
s_timelimit_field.generic.textSize = MENU_FONT_SIZE;
@ -300,9 +300,9 @@ void Menu_StartServer_Init (void)
s_dedicated_box.generic.name = "dedicated server";;
s_dedicated_box.generic.x = 0;
s_dedicated_box.generic.y = y += 2*MENU_FONT_SIZE;
s_dedicated_box.curvalue = 0; // always start off
s_dedicated_box.curValue = 0; // always start off
s_dedicated_box.generic.statusbar = "makes the server faster, but you can't play on this computer";
s_dedicated_box.itemnames = yesno_names;
s_dedicated_box.itemNames = yesno_names;
s_startserver_dmoptions_action.generic.type = MTYPE_ACTION;
s_startserver_dmoptions_action.generic.textSize = MENU_FONT_SIZE;
@ -311,7 +311,7 @@ void Menu_StartServer_Init (void)
s_startserver_dmoptions_action.generic.x = 24;
s_startserver_dmoptions_action.generic.y = y += 2*MENU_FONT_SIZE;
s_startserver_dmoptions_action.generic.statusbar = NULL;
s_startserver_dmoptions_action.generic.callback = DMOptionsFunc;
s_startserver_dmoptions_action.generic.callback = M_DMOptionsFunc;
s_startserver_start_action.generic.type = MTYPE_ACTION;
s_startserver_start_action.generic.textSize = MENU_FONT_SIZE;
@ -343,12 +343,12 @@ void Menu_StartServer_Init (void)
UI_CenterMenu (&s_startserver_menu);
// call this now to set proper inital state
RulesChangeFunc (NULL);
M_RulesChangeFunc (NULL);
}
void Menu_DrawStartSeverLevelshot (void)
{
char *mapshotname = UI_UpdateStartSeverLevelshot (s_startmap_list.curvalue);
char *mapshotname = UI_UpdateStartSeverLevelshot (s_startmap_list.curValue);
UI_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, false, 60,60,60,255);

View file

@ -71,48 +71,50 @@ void DownloadOptionsFunc (void *unused)
void Menu_Multiplayer_Init (void)
{
s_multiplayer_menu.x = SCREEN_WIDTH*0.5 - 64;
// s_multiplayer_menu.y = 0;
int x = 0, y = 0;
s_multiplayer_menu.x = SCREEN_WIDTH*0.5 - 9*MENU_FONT_SIZE; // -64
s_multiplayer_menu.y = SCREEN_HEIGHT*0.5 - 5*MENU_LINE_SIZE; // 0
s_multiplayer_menu.nitems = 0;
s_join_network_server_action.generic.type = MTYPE_ACTION;
s_join_network_server_action.generic.textSize = MENU_FONT_SIZE;
s_join_network_server_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_join_network_server_action.generic.flags = QMF_LEFT_JUSTIFY;
s_join_network_server_action.generic.x = 0;
s_join_network_server_action.generic.y = 0;
s_join_network_server_action.generic.name = " join network server";
s_join_network_server_action.generic.x = x;
s_join_network_server_action.generic.y = y;
s_join_network_server_action.generic.name = "Join Network Server";
s_join_network_server_action.generic.callback = JoinNetworkServerFunc;
s_start_network_server_action.generic.type = MTYPE_ACTION;
s_start_network_server_action.generic.textSize = MENU_FONT_SIZE;
s_start_network_server_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_start_network_server_action.generic.flags = QMF_LEFT_JUSTIFY;
s_start_network_server_action.generic.x = 0;
s_start_network_server_action.generic.y = 2*MENU_FONT_SIZE;
s_start_network_server_action.generic.name = " start network server";
s_start_network_server_action.generic.x = x;
s_start_network_server_action.generic.y = y += 2*MENU_LINE_SIZE; // 2*MENU_FONT_SIZE
s_start_network_server_action.generic.name = "Start Network Server";
s_start_network_server_action.generic.callback = StartNetworkServerFunc;
s_player_setup_action.generic.type = MTYPE_ACTION;
s_player_setup_action.generic.textSize = MENU_FONT_SIZE;
s_player_setup_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_player_setup_action.generic.flags = QMF_LEFT_JUSTIFY;
s_player_setup_action.generic.x = 0;
s_player_setup_action.generic.y = 4*MENU_FONT_SIZE;
s_player_setup_action.generic.name = " player setup";
s_player_setup_action.generic.x = x;
s_player_setup_action.generic.y = y += 2*MENU_LINE_SIZE; // 4*MENU_FONT_SIZE
s_player_setup_action.generic.name = "Player Setup";
s_player_setup_action.generic.callback = PlayerSetupFunc;
s_download_options_action.generic.type = MTYPE_ACTION;
s_download_options_action.generic.textSize = MENU_FONT_SIZE;
s_download_options_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_download_options_action.generic.flags = QMF_LEFT_JUSTIFY;
s_download_options_action.generic.x = 0;
s_download_options_action.generic.y = 6*MENU_FONT_SIZE;
s_download_options_action.generic.name = " download options";
s_download_options_action.generic.x = x;
s_download_options_action.generic.y = y += 2*MENU_LINE_SIZE; // 6*MENU_FONT_SIZE
s_download_options_action.generic.name = "Download Options";
s_download_options_action.generic.callback = DownloadOptionsFunc;
s_backmain_action.generic.type = MTYPE_ACTION;
s_backmain_action.generic.textSize = MENU_FONT_SIZE;
s_backmain_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_backmain_action.generic.flags = QMF_LEFT_JUSTIFY;
s_backmain_action.generic.x = 0;
s_backmain_action.generic.y = 9*MENU_FONT_SIZE;
s_backmain_action.generic.name = " back to main";
s_backmain_action.generic.x = x;
s_backmain_action.generic.y = y += 3*MENU_HEADER_LINE_SIZE; // 9*MENU_FONT_SIZE
s_backmain_action.generic.name = "Back to Main";
s_backmain_action.generic.callback = UI_BackMenu;
UI_AddMenuItem (&s_multiplayer_menu, (void *) &s_join_network_server_action);
@ -123,7 +125,7 @@ void Menu_Multiplayer_Init (void)
UI_SetMenuStatusBar (&s_multiplayer_menu, NULL);
UI_CenterMenu (&s_multiplayer_menu);
// UI_CenterMenu (&s_multiplayer_menu);
}
static void Menu_Multiplayer_Draw (void)

View file

@ -45,27 +45,27 @@ static menuaction_s s_options_effects_section;
static menuaction_s s_options_interface_section;
static menuaction_s s_options_back_action;
static void MenuSoundFunc (void *unused)
static void M_MenuSoundFunc (void *unused)
{
Menu_Options_Sound_f ();
}
static void MenuControlsFunc (void *unused)
static void M_MenuControlsFunc (void *unused)
{
Menu_Options_Controls_f ();
}
static void MenuScreenFunc (void *unused)
static void M_MenuScreenFunc (void *unused)
{
Menu_Options_Screen_f ();
}
static void MenuEffectsFunc (void *unused)
static void M_MenuEffectsFunc (void *unused)
{
Menu_Options_Effects_f ();
}
static void MenuInterfaceFunc (void *unused)
static void M_MenuInterfaceFunc (void *unused)
{
Menu_Options_Interface_f ();
}
@ -74,68 +74,64 @@ static void MenuInterfaceFunc (void *unused)
void Menu_Options_Init (void)
{
s_options_menu.x = SCREEN_WIDTH*0.5 - 24;
s_options_menu.y = SCREEN_HEIGHT*0.5 - 58;
int x = 0, y = 0;
s_options_menu.x = SCREEN_WIDTH*0.5 - 3*MENU_FONT_SIZE;
s_options_menu.y = SCREEN_HEIGHT*0.5 - 5*MENU_LINE_SIZE;
s_options_menu.nitems = 0;
s_options_sound_section.generic.type = MTYPE_ACTION;
s_options_sound_section.generic.textSize = MENU_FONT_SIZE;
s_options_sound_section.generic.textSize = MENU_HEADER_FONT_SIZE;
s_options_sound_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_sound_section.generic.name = " sound";
s_options_sound_section.generic.x = 0;
s_options_sound_section.generic.y = MENU_FONT_SIZE * 2;
s_options_sound_section.generic.callback = MenuSoundFunc;
s_options_sound_section.generic.name = "Sound";
s_options_sound_section.generic.x = x;
s_options_sound_section.generic.y = y; // MENU_FONT_SIZE * 2
s_options_sound_section.generic.callback = M_MenuSoundFunc;
s_options_sound_section.generic.statusbar = "change sound settings";
// s_options_sound_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_controls_section.generic.type = MTYPE_ACTION;
s_options_controls_section.generic.textSize = MENU_FONT_SIZE;
s_options_controls_section.generic.textSize = MENU_HEADER_FONT_SIZE;
s_options_controls_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_controls_section.generic.name = " controls";
s_options_controls_section.generic.x = 0;
s_options_controls_section.generic.y = MENU_FONT_SIZE * 4;
s_options_controls_section.generic.callback = MenuControlsFunc;
s_options_controls_section.generic.name = "Controls";
s_options_controls_section.generic.x = x;
s_options_controls_section.generic.y = y += 2*MENU_LINE_SIZE; // MENU_FONT_SIZE * 4
s_options_controls_section.generic.callback = M_MenuControlsFunc;
s_options_controls_section.generic.statusbar = "change control settings and bind keys";
// s_options_controls_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_screen_section.generic.type = MTYPE_ACTION;
s_options_screen_section.generic.textSize = MENU_FONT_SIZE;
s_options_screen_section.generic.textSize = MENU_HEADER_FONT_SIZE;
s_options_screen_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_screen_section.generic.name = " screen";
s_options_screen_section.generic.x = 0;
s_options_screen_section.generic.y = MENU_FONT_SIZE * 6;
s_options_screen_section.generic.callback = MenuScreenFunc;
s_options_screen_section.generic.name = "Screen";
s_options_screen_section.generic.x = x;
s_options_screen_section.generic.y = y += 2*MENU_LINE_SIZE; // MENU_FONT_SIZE * 6s
s_options_screen_section.generic.callback = M_MenuScreenFunc;
s_options_screen_section.generic.statusbar = "change HUD/crosshair settings";
// s_options_screen_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_effects_section.generic.type = MTYPE_ACTION;
s_options_effects_section.generic.textSize = MENU_FONT_SIZE;
s_options_effects_section.generic.textSize = MENU_HEADER_FONT_SIZE;
s_options_effects_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_effects_section.generic.name = " effects";
s_options_effects_section.generic.x = 0;
s_options_effects_section.generic.y = MENU_FONT_SIZE * 8;
s_options_effects_section.generic.callback = MenuEffectsFunc;
s_options_effects_section.generic.name = "Effects";
s_options_effects_section.generic.x = x;
s_options_effects_section.generic.y = y += 2*MENU_LINE_SIZE; // MENU_FONT_SIZE * 8
s_options_effects_section.generic.callback = M_MenuEffectsFunc;
s_options_effects_section.generic.statusbar = "change ingame effects settings";
// s_options_effects_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_interface_section.generic.type = MTYPE_ACTION;
s_options_interface_section.generic.textSize = MENU_FONT_SIZE;
s_options_interface_section.generic.textSize = MENU_HEADER_FONT_SIZE;
s_options_interface_section.generic.flags = QMF_LEFT_JUSTIFY;
s_options_interface_section.generic.name = " interface";
s_options_interface_section.generic.x = 0;
s_options_interface_section.generic.y = MENU_FONT_SIZE * 10;
s_options_interface_section.generic.callback = MenuInterfaceFunc;
s_options_interface_section.generic.name = "Interface";
s_options_interface_section.generic.x = x;
s_options_interface_section.generic.y = y += 2*MENU_LINE_SIZE; // MENU_FONT_SIZE * 10
s_options_interface_section.generic.callback = M_MenuInterfaceFunc;
s_options_interface_section.generic.statusbar = "change menu/console settings";
// s_options_interface_section.generic.cursor_offset = -(MENU_FONT_SIZE*10);
s_options_back_action.generic.type = MTYPE_ACTION;
s_options_back_action.generic.textSize = MENU_FONT_SIZE;
s_options_back_action.generic.textSize = MENU_HEADER_FONT_SIZE;
s_options_back_action.generic.flags = QMF_LEFT_JUSTIFY;
s_options_back_action.generic.name = " back to main";
s_options_back_action.generic.x = 0;
s_options_back_action.generic.y = MENU_FONT_SIZE * 13;
s_options_back_action.generic.name = "Back to Main";
s_options_back_action.generic.x = x;
s_options_back_action.generic.y = y += 3*MENU_HEADER_LINE_SIZE; // MENU_FONT_SIZE * 13
s_options_back_action.generic.callback = UI_BackMenu;
// s_options_back_action.generic.cursor_offset = -(MENU_FONT_SIZE*10);
UI_AddMenuItem (&s_options_menu, (void *) &s_options_sound_section);
UI_AddMenuItem (&s_options_menu, (void *) &s_options_controls_section);

View file

@ -58,63 +58,63 @@ static menuaction_s s_options_controls_back_action;
static void MouseSpeedFunc (void *unused)
{
Cvar_SetValue( "sensitivity", UI_MenuSlider_GetValue(&s_options_controls_sensitivity_slider) );
UI_MenuSlider_SaveValue (&s_options_controls_sensitivity_slider, "sensitivity");
}
static void AlwaysRunFunc (void *unused)
{
Cvar_SetValue( "cl_run", s_options_controls_alwaysrun_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_controls_alwaysrun_box, "cl_run");
}
// Psychospaz's chaseam
static void ThirdPersonFunc (void *unused)
{
Cvar_SetValue( "cg_thirdperson", s_options_controls_thirdperson_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_controls_thirdperson_box, "cg_thirdperson");
}
static void ThirdPersonDistFunc (void *unused)
{
Cvar_SetValue( "cg_thirdperson_dist", UI_MenuSlider_GetValue(&s_options_controls_thirdperson_distance_slider) );
UI_MenuSlider_SaveValue (&s_options_controls_thirdperson_distance_slider, "cg_thirdperson_dist");
}
static void ThirdPersonOffsetFunc (void *unused)
{
Cvar_SetValue( "cg_thirdperson_offset", UI_MenuSlider_GetValue(&s_options_controls_thirdperson_offset_slider) );
UI_MenuSlider_SaveValue (&s_options_controls_thirdperson_offset_slider, "cg_thirdperson_offset");
}
static void ThirdPersonAngleFunc (void *unused)
{
Cvar_SetValue( "cg_thirdperson_angle", UI_MenuSlider_GetValue(&s_options_controls_thirdperson_angle_slider) );
UI_MenuSlider_SaveValue (&s_options_controls_thirdperson_angle_slider, "cg_thirdperson_angle");
}
static void FreeLookFunc (void *unused)
{
Cvar_SetValue( "freelook", s_options_controls_freelook_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_controls_freelook_box, "freelook");
}
static void InvertMouseFunc (void *unused)
{
Cvar_SetValue( "m_pitch", -m_pitch->value );
UI_MenuSpinControl_SaveValue (&s_options_controls_invertmouse_box, "m_pitch");
}
static void AutosensitivityFunc (void *unused)
{
Cvar_SetValue( "in_autosensitivity", s_options_controls_autosensitivity_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_controls_autosensitivity_box, "in_autosensitivity");
}
static void LookspringFunc (void *unused)
{
Cvar_SetValue( "lookspring", !lookspring->value );
UI_MenuSpinControl_SaveValue (&s_options_controls_lookspring_box, "lookspring");
}
static void LookstrafeFunc (void *unused)
{
Cvar_SetValue( "lookstrafe", !lookstrafe->value );
UI_MenuSpinControl_SaveValue (&s_options_controls_lookstrafe_box, "lookstrafe");
}
static void JoystickFunc (void *unused)
{
Cvar_SetValue( "in_joystick", s_options_controls_joystick_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_controls_joystick_box, "in_joystick");
}
static void CustomizeControlsFunc(void *unused)
@ -122,38 +122,25 @@ static void CustomizeControlsFunc(void *unused)
Menu_Keys_f ();
}
static void ControlsSetMenuItemValues (void)
static void M_ControlsSetMenuItemValues (void)
{
UI_MenuSlider_SetValue (&s_options_controls_sensitivity_slider, Cvar_VariableValue("sensitivity"));
UI_MenuSlider_SetValue (&s_options_controls_sensitivity_slider, "sensitivity", 1.0f, 11.0f, false);
UI_MenuSpinControl_SetValue (&s_options_controls_invertmouse_box, "m_pitch", 0, 0, false);
UI_MenuSpinControl_SetValue (&s_options_controls_autosensitivity_box, "in_autosensitivity", 0, 1, true);
s_options_controls_invertmouse_box.curvalue = Cvar_VariableValue("m_pitch") < 0;
UI_MenuSpinControl_SetValue (&s_options_controls_thirdperson_box, "cg_thirdperson", 0, 1, true);
UI_MenuSlider_SetValue (&s_options_controls_thirdperson_distance_slider, "cg_thirdperson_dist", 10.0f, 150.0f, true);
UI_MenuSlider_SetValue (&s_options_controls_thirdperson_offset_slider, "cg_thirdperson_offset", 0.0f, 64.0f, true);
UI_MenuSlider_SetValue (&s_options_controls_thirdperson_angle_slider, "cg_thirdperson_angle", 0.0f, 30.0f, true);
Cvar_SetValue( "in_autosensitivity", ClampCvar( 0, 1, Cvar_VariableValue("in_autosensitivity") ) );
s_options_controls_autosensitivity_box.curvalue = Cvar_VariableValue("in_autosensitivity");
Cvar_SetValue( "cg_thirdperson", ClampCvar( 0, 1, Cvar_VariableValue("cg_thirdperson") ) );
s_options_controls_thirdperson_box.curvalue = Cvar_VariableValue("cg_thirdperson");
UI_MenuSlider_SetValue (&s_options_controls_thirdperson_distance_slider, Cvar_VariableValue("cg_thirdperson_dist"));
UI_MenuSlider_SetValue (&s_options_controls_thirdperson_offset_slider, Cvar_VariableValue("cg_thirdperson_offset"));
UI_MenuSlider_SetValue (&s_options_controls_thirdperson_angle_slider, Cvar_VariableValue("cg_thirdperson_angle"));
Cvar_SetValue( "cl_run", ClampCvar( 0, 1, Cvar_VariableValue("cl_run") ) );
s_options_controls_alwaysrun_box.curvalue = Cvar_VariableValue("cl_run");
Cvar_SetValue( "lookspring", ClampCvar( 0, 1, Cvar_VariableValue("lookspring") ) );
s_options_controls_lookspring_box.curvalue = Cvar_VariableValue("lookspring");
Cvar_SetValue( "lookstrafe", ClampCvar( 0, 1, Cvar_VariableValue("lookstrafe") ) );
s_options_controls_lookstrafe_box.curvalue = Cvar_VariableValue("lookstrafe");
Cvar_SetValue( "freelook", ClampCvar( 0, 1, Cvar_VariableValue("freelook") ) );
s_options_controls_freelook_box.curvalue = Cvar_VariableValue("freelook");
Cvar_SetValue( "in_joystick", ClampCvar( 0, 1, Cvar_VariableValue("in_joystick") ) );
s_options_controls_joystick_box.curvalue = Cvar_VariableValue("in_joystick");
UI_MenuSpinControl_SetValue (&s_options_controls_alwaysrun_box, "cl_run", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_controls_lookspring_box, "lookspring", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_controls_lookstrafe_box, "lookstrafe", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_controls_freelook_box, "freelook", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_controls_joystick_box, "in_joystick", 0, 1, true);
}
static void ControlsResetDefaultsFunc (void *unused)
static void M_ControlsResetDefaultsFunc (void *unused)
{
// Cvar_SetToDefault ("sensitivity");
// Cvar_SetToDefault ("m_pitch");
@ -172,7 +159,7 @@ static void ControlsResetDefaultsFunc (void *unused)
Cbuf_AddText ("exec defaultbinds.cfg\n"); // reset default binds
Cbuf_Execute();
ControlsSetMenuItemValues ();
M_ControlsSetMenuItemValues ();
}
void Menu_Options_Controls_Init (void)
@ -214,7 +201,8 @@ void Menu_Options_Controls_Init (void)
s_options_controls_invertmouse_box.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_invertmouse_box.generic.name = "invert mouse";
s_options_controls_invertmouse_box.generic.callback = InvertMouseFunc;
s_options_controls_invertmouse_box.itemnames = yesno_names;
s_options_controls_invertmouse_box.itemNames = yesno_names;
s_options_controls_invertmouse_box.invertValue = true;
s_options_controls_invertmouse_box.generic.statusbar = "inverts mouse y-axis movement";
s_options_controls_autosensitivity_box.generic.type = MTYPE_SPINCONTROL;
@ -223,7 +211,7 @@ void Menu_Options_Controls_Init (void)
s_options_controls_autosensitivity_box.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_autosensitivity_box.generic.name = "scale mouse to FOV";
s_options_controls_autosensitivity_box.generic.callback = AutosensitivityFunc;
s_options_controls_autosensitivity_box.itemnames = yesno_names;
s_options_controls_autosensitivity_box.itemNames = yesno_names;
s_options_controls_autosensitivity_box.generic.statusbar = "adjusts mouse sensitivity to zoomed FOV";
s_options_controls_thirdperson_box.generic.type = MTYPE_SPINCONTROL;
@ -232,7 +220,7 @@ void Menu_Options_Controls_Init (void)
s_options_controls_thirdperson_box.generic.y = y+=2*MENU_LINE_SIZE;
s_options_controls_thirdperson_box.generic.name = "third person";
s_options_controls_thirdperson_box.generic.callback = ThirdPersonFunc;
s_options_controls_thirdperson_box.itemnames = yesno_names;
s_options_controls_thirdperson_box.itemNames = yesno_names;
s_options_controls_thirdperson_box.generic.statusbar = "enables third-person mode";
s_options_controls_thirdperson_distance_slider.generic.type = MTYPE_SLIDER;
@ -277,7 +265,7 @@ void Menu_Options_Controls_Init (void)
s_options_controls_alwaysrun_box.generic.y = y+=2*MENU_LINE_SIZE;
s_options_controls_alwaysrun_box.generic.name = "always run";
s_options_controls_alwaysrun_box.generic.callback = AlwaysRunFunc;
s_options_controls_alwaysrun_box.itemnames = yesno_names;
s_options_controls_alwaysrun_box.itemNames = yesno_names;
s_options_controls_alwaysrun_box.generic.statusbar = "enables running as default movement";
s_options_controls_lookspring_box.generic.type = MTYPE_SPINCONTROL;
@ -286,7 +274,7 @@ void Menu_Options_Controls_Init (void)
s_options_controls_lookspring_box.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_lookspring_box.generic.name = "lookspring";
s_options_controls_lookspring_box.generic.callback = LookspringFunc;
s_options_controls_lookspring_box.itemnames = yesno_names;
s_options_controls_lookspring_box.itemNames = yesno_names;
s_options_controls_lookstrafe_box.generic.type = MTYPE_SPINCONTROL;
s_options_controls_lookstrafe_box.generic.textSize = MENU_FONT_SIZE;
@ -294,7 +282,7 @@ void Menu_Options_Controls_Init (void)
s_options_controls_lookstrafe_box.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_lookstrafe_box.generic.name = "lookstrafe";
s_options_controls_lookstrafe_box.generic.callback = LookstrafeFunc;
s_options_controls_lookstrafe_box.itemnames = yesno_names;
s_options_controls_lookstrafe_box.itemNames = yesno_names;
s_options_controls_freelook_box.generic.type = MTYPE_SPINCONTROL;
s_options_controls_freelook_box.generic.textSize = MENU_FONT_SIZE;
@ -302,7 +290,7 @@ void Menu_Options_Controls_Init (void)
s_options_controls_freelook_box.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_freelook_box.generic.name = "free look";
s_options_controls_freelook_box.generic.callback = FreeLookFunc;
s_options_controls_freelook_box.itemnames = yesno_names;
s_options_controls_freelook_box.itemNames = yesno_names;
s_options_controls_freelook_box.generic.statusbar = "enables free head movement with mouse";
s_options_controls_joystick_box.generic.type = MTYPE_SPINCONTROL;
@ -311,7 +299,7 @@ void Menu_Options_Controls_Init (void)
s_options_controls_joystick_box.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_joystick_box.generic.name = "use joystick";
s_options_controls_joystick_box.generic.callback = JoystickFunc;
s_options_controls_joystick_box.itemnames = yesno_names;
s_options_controls_joystick_box.itemNames = yesno_names;
s_options_controls_joystick_box.generic.statusbar = "enables use of joystick";
s_options_controls_customize_keys_action.generic.type = MTYPE_ACTION;
@ -326,7 +314,7 @@ void Menu_Options_Controls_Init (void)
s_options_controls_defaults_action.generic.x = MENU_FONT_SIZE;
s_options_controls_defaults_action.generic.y = 20*MENU_LINE_SIZE;
s_options_controls_defaults_action.generic.name = "reset defaults";
s_options_controls_defaults_action.generic.callback = ControlsResetDefaultsFunc;
s_options_controls_defaults_action.generic.callback = M_ControlsResetDefaultsFunc;
s_options_controls_defaults_action.generic.statusbar = "resets all control settings to internal defaults";
s_options_controls_back_action.generic.type = MTYPE_ACTION;
@ -353,7 +341,7 @@ void Menu_Options_Controls_Init (void)
UI_AddMenuItem (&s_options_controls_menu, (void *) &s_options_controls_defaults_action);
UI_AddMenuItem (&s_options_controls_menu, (void *) &s_options_controls_back_action);
ControlsSetMenuItemValues ();
M_ControlsSetMenuItemValues ();
}
void Menu_Options_Controls_Draw (void)

View file

@ -54,95 +54,84 @@ static menuaction_s s_options_effects_back_action;
static void BloodFunc (void *unused)
{
Cvar_SetValue( "cl_blood", s_options_effects_blood_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_effects_blood_box, "cl_blood");
}
static void OldExplosionFunc (void *unused)
{
Cvar_SetValue( "cl_old_explosions", s_options_effects_oldexplosions_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_effects_oldexplosions_box, "cl_old_explosions");
}
static void PlasmaExploSoundFunc (void *unused)
{
Cvar_SetValue( "cl_plasma_explo_sound", s_options_effects_plasmaexplosound_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_effects_plasmaexplosound_box, "cl_plasma_explo_sound");
}
static void ItemBobFunc (void *unused)
{
Cvar_SetValue( "cl_item_bobbing", s_options_effects_itembob_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_effects_itembob_box, "cl_item_bobbing");
}
static void ParticleCompFunc (void *unused)
{
Cvar_SetValue( "cl_particle_scale", UI_MenuSlider_GetValue(&s_options_effects_particle_comp_slider) );
UI_MenuSlider_SaveValue (&s_options_effects_particle_comp_slider, "cl_particle_scale");
}
static void DecalCallback (void *unused)
{
Cvar_SetValue( "r_decals", UI_MenuSlider_GetValue(&s_options_effects_decal_slider) );
UI_MenuSlider_SaveValue (&s_options_effects_decal_slider, "r_decals");
}
// Psychospaz's changeable rail trail
static void RailTrailFunc (void *unused)
{
Cvar_SetValue( "cl_railtype", s_options_effects_railtrail_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_effects_railtrail_box, "cl_railtype");
}
static void RailColorRedFunc (void *unused)
{
Cvar_SetValue( "cl_railred", UI_MenuSlider_GetValue(&s_options_effects_railcolor_slider[0]) );
UI_MenuSlider_SaveValue (&s_options_effects_railcolor_slider[0], "cl_railred");
}
static void RailColorGreenFunc (void *unused)
{
Cvar_SetValue( "cl_railgreen", UI_MenuSlider_GetValue(&s_options_effects_railcolor_slider[1]) );
UI_MenuSlider_SaveValue (&s_options_effects_railcolor_slider[1], "cl_railgreen");
}
static void RailColorBlueFunc (void *unused)
{
Cvar_SetValue( "cl_railblue", UI_MenuSlider_GetValue(&s_options_effects_railcolor_slider[2]) );
UI_MenuSlider_SaveValue (&s_options_effects_railcolor_slider[2], "cl_railblue");
}
// foostep override option
static void FootStepFunc (void *unused)
{
Cvar_SetValue( "cl_footstep_override", s_options_effects_footstep_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_effects_footstep_box, "cl_footstep_override");
}
//=======================================================================
static void EffectsSetMenuItemValues (void)
static void M_EffectsSetMenuItemValues (void)
{
Cvar_SetValue( "cl_blood", ClampCvar( 0, 4, Cvar_VariableValue("cl_blood") ) );
s_options_effects_blood_box.curvalue = Cvar_VariableValue("cl_blood");
UI_MenuSpinControl_SetValue (&s_options_effects_blood_box, "cl_blood", 0, 4, true);
Cvar_SetValue( "cl_old_explosions", ClampCvar( 0, 1, Cvar_VariableValue("cl_old_explosions") ) );
s_options_effects_oldexplosions_box.curvalue = Cvar_VariableValue("cl_old_explosions");
UI_MenuSpinControl_SetValue (&s_options_effects_oldexplosions_box, "cl_old_explosions", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_effects_plasmaexplosound_box, "cl_plasma_explo_sound", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_effects_itembob_box, "cl_item_bobbing", 0, 1, true);
Cvar_SetValue( "cl_plasma_explo_sound", ClampCvar( 0, 1, Cvar_VariableValue("cl_plasma_explo_sound") ) );
s_options_effects_plasmaexplosound_box.curvalue = Cvar_VariableValue("cl_plasma_explo_sound");
UI_MenuSlider_SetValue (&s_options_effects_decal_slider, "r_decals", 0, 1000, true);
UI_MenuSlider_SetValue (&s_options_effects_particle_comp_slider, "cl_particle_scale", 1, 5, true);
Cvar_SetValue( "cl_item_bobbing", ClampCvar( 0, 1, Cvar_VariableValue("cl_item_bobbing") ) );
s_options_effects_itembob_box.curvalue = Cvar_VariableValue("cl_item_bobbing");
UI_MenuSpinControl_SetValue (&s_options_effects_railtrail_box, "cl_railtype", 0, 2, true);
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[0], "cl_railred", 0, 256, true);
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[1], "cl_railgreen", 0, 256, true);
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[2], "cl_railblue", 0, 256, true);
Cvar_SetValue( "r_decals", ClampCvar (0, 1000, Cvar_VariableValue("r_decals")) );
UI_MenuSlider_SetValue (&s_options_effects_decal_slider, Cvar_VariableValue("r_decals"));
Cvar_SetValue( "cl_particle_scale", ClampCvar( 0, 5, Cvar_VariableValue("cl_particle_scale") ) );
UI_MenuSlider_SetValue (&s_options_effects_particle_comp_slider, Cvar_VariableValue("cl_particle_scale"));
Cvar_SetValue( "cl_railtype", ClampCvar( 0, 2, Cvar_VariableValue("cl_railtype") ) );
s_options_effects_railtrail_box.curvalue = Cvar_VariableValue("cl_railtype");
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[0], Cvar_VariableValue("cl_railred"));
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[1], Cvar_VariableValue("cl_railgreen"));
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[2], Cvar_VariableValue("cl_railblue"));
Cvar_SetValue( "cl_footstep_override", ClampCvar( 0, 1, Cvar_VariableValue("cl_footstep_override") ) );
s_options_effects_footstep_box.curvalue = Cvar_VariableValue("cl_footstep_override");
UI_MenuSpinControl_SetValue (&s_options_effects_footstep_box, "cl_footstep_override", 0, 1, true);
}
static void EffectsResetDefaultsFunc (void *unused)
static void M_EffectsResetDefaultsFunc (void *unused)
{
Cvar_SetToDefault ("cl_blood");
Cvar_SetToDefault ("cl_old_explosions");
@ -156,7 +145,7 @@ static void EffectsResetDefaultsFunc (void *unused)
Cvar_SetToDefault ("cl_railblue");
Cvar_SetToDefault ("cl_footstep_override");
EffectsSetMenuItemValues ();
M_EffectsSetMenuItemValues ();
}
void Options_Effects_MenuInit (void)
@ -167,7 +156,6 @@ void Options_Effects_MenuInit (void)
"yes",
0
};
static const char *blood_names[] =
{
"none",
@ -177,7 +165,6 @@ void Options_Effects_MenuInit (void)
"gore",
0
};
static const char *railtrail_names[] =
{
"colored spiral",
@ -185,8 +172,6 @@ void Options_Effects_MenuInit (void)
"colored devrail",
0
};
int y = 3*MENU_LINE_SIZE;
s_options_effects_menu.x = SCREEN_WIDTH*0.5;
@ -205,7 +190,7 @@ void Options_Effects_MenuInit (void)
s_options_effects_blood_box.generic.y = y;
s_options_effects_blood_box.generic.name = "blood type";
s_options_effects_blood_box.generic.callback = BloodFunc;
s_options_effects_blood_box.itemnames = blood_names;
s_options_effects_blood_box.itemNames = blood_names;
s_options_effects_blood_box.generic.statusbar = "changes blood effect type";
s_options_effects_oldexplosions_box.generic.type = MTYPE_SPINCONTROL;
@ -214,7 +199,7 @@ void Options_Effects_MenuInit (void)
s_options_effects_oldexplosions_box.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_oldexplosions_box.generic.name = "old style explosions";
s_options_effects_oldexplosions_box.generic.callback = OldExplosionFunc;
s_options_effects_oldexplosions_box.itemnames = yesno_names;
s_options_effects_oldexplosions_box.itemNames = yesno_names;
s_options_effects_oldexplosions_box.generic.statusbar = "brings back those cheesy model explosions";
s_options_effects_plasmaexplosound_box.generic.type = MTYPE_SPINCONTROL;
@ -223,7 +208,7 @@ void Options_Effects_MenuInit (void)
s_options_effects_plasmaexplosound_box.generic.y = y += MENU_LINE_SIZE;
s_options_effects_plasmaexplosound_box.generic.name = "unique plasma explode sound";
s_options_effects_plasmaexplosound_box.generic.callback = PlasmaExploSoundFunc;
s_options_effects_plasmaexplosound_box.itemnames = yesno_names;
s_options_effects_plasmaexplosound_box.itemNames = yesno_names;
s_options_effects_plasmaexplosound_box.generic.statusbar = "gives Phalanx Cannon plasma explosions a unique sound";
s_options_effects_itembob_box.generic.type = MTYPE_SPINCONTROL;
@ -232,7 +217,7 @@ void Options_Effects_MenuInit (void)
s_options_effects_itembob_box.generic.y = y += MENU_LINE_SIZE;
s_options_effects_itembob_box.generic.name = "item bobbing";
s_options_effects_itembob_box.generic.callback = ItemBobFunc;
s_options_effects_itembob_box.itemnames = yesno_names;
s_options_effects_itembob_box.itemNames = yesno_names;
s_options_effects_itembob_box.generic.statusbar = "adds bobbing effect to rotating items";
s_options_effects_decal_slider.generic.type = MTYPE_SLIDER;
@ -266,7 +251,7 @@ void Options_Effects_MenuInit (void)
s_options_effects_railtrail_box.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_railtrail_box.generic.name = "railtrail type";
s_options_effects_railtrail_box.generic.callback = RailTrailFunc;
s_options_effects_railtrail_box.itemnames = railtrail_names;
s_options_effects_railtrail_box.itemNames = railtrail_names;
s_options_effects_railtrail_box.generic.statusbar = "changes railgun particle effect";
s_options_effects_railcolor_slider[0].generic.type = MTYPE_SLIDER;
@ -312,7 +297,7 @@ void Options_Effects_MenuInit (void)
s_options_effects_footstep_box.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_footstep_box.generic.name = "override footstep sounds";
s_options_effects_footstep_box.generic.callback = FootStepFunc;
s_options_effects_footstep_box.itemnames = yesno_names;
s_options_effects_footstep_box.itemNames = yesno_names;
s_options_effects_footstep_box.generic.statusbar = "sets footstep sounds with definitions in texsurfs.txt";
s_options_effects_defaults_action.generic.type = MTYPE_ACTION;
@ -320,7 +305,7 @@ void Options_Effects_MenuInit (void)
s_options_effects_defaults_action.generic.x = MENU_FONT_SIZE;
s_options_effects_defaults_action.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_defaults_action.generic.name = "reset defaults";
s_options_effects_defaults_action.generic.callback = EffectsResetDefaultsFunc;
s_options_effects_defaults_action.generic.callback = M_EffectsResetDefaultsFunc;
s_options_effects_defaults_action.generic.statusbar = "resets all effects settings to internal defaults";
s_options_effects_back_action.generic.type = MTYPE_ACTION;
@ -345,7 +330,7 @@ void Options_Effects_MenuInit (void)
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_defaults_action);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_back_action);
EffectsSetMenuItemValues ();
M_EffectsSetMenuItemValues ();
}
void Menu_Options_Effects_Draw (void)

View file

@ -60,140 +60,91 @@ cvar_t *scr_font;
static void MouseMenuFunc (void *unused)
{
Cvar_SetValue( "ui_sensitivity", UI_MenuSlider_GetValue(&s_options_interface_menumouse_slider) );
UI_MenuSlider_SaveValue (&s_options_interface_menumouse_slider, "ui_sensitivity");
}
// menu alpha option
static void MenuAlphaFunc (void *unused)
{
Cvar_SetValue( "ui_background_alpha", UI_MenuSlider_GetValue(&s_options_interface_menualpha_slider) );
UI_MenuSlider_SaveValue (&s_options_interface_menualpha_slider, "ui_background_alpha");
}
static void ConFontFunc (void *unused)
{
UI_MenuSpinControl_SaveValue (&s_options_interface_confont_box, "con_font");
}
static void FontSizeFunc (void *unused)
{
UI_MenuSlider_SaveValue (&s_options_interface_fontsize_slider, "con_font_size");
}
static void UIFontFunc (void *unused)
{
UI_MenuSpinControl_SaveValue (&s_options_interface_uifont_box, "ui_font");
}
static void ScrFontFunc (void *unused)
{
UI_MenuSpinControl_SaveValue (&s_options_interface_scrfont_box, "scr_font");
}
static void AltTextColorFunc (void *unused)
{
Cvar_SetValue( "alt_text_color", s_options_interface_alt_text_color_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_options_interface_alt_text_color_box, "alt_text_color");
}
// Psychospaz's transparent console
static void ConAlphaFunc (void *unused)
{
Cvar_SetValue( "scr_conalpha", UI_MenuSlider_GetValue(&s_options_interface_conalpha_slider) );
UI_MenuSlider_SaveValue (&s_options_interface_conalpha_slider, "scr_conalpha");
}
#if 0
// variable console height
/*static void ConHeightFunc (void *unused)
static void ConHeightFunc (void *unused)
{
Cvar_SetValue( "scr_conheight", UI_MenuSlider_GetValue(&s_options_interface_conheight_slider) );
}*/
UI_MenuSlider_SaveValue (&s_options_interface_conheight_slider, "scr_conheight");
}
#endif
static void SimpleLoadscreenFunc (void *unused)
{
Cvar_SetValue( "scr_simple_loadscreen", s_options_interface_simple_loadscreen_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_interface_simple_loadscreen_box, "scr_simple_loadscreen");
}
static void NewConbackFunc (void *unused)
{
Cvar_SetValue( "scr_newconback", s_options_interface_newconback_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_interface_newconback_box, "scr_newconback");
}
static void NoAltTabFunc (void *unused)
{
Cvar_SetValue( "win_noalttab", s_options_interface_noalttab_box.curvalue );
}
static void FontSizeFunc (void *unused)
{
Cvar_SetValue( "con_font_size", UI_MenuSlider_GetValue(&s_options_interface_fontsize_slider) );
}
static void ConFontFunc (void *unused)
{
Cvar_Set( "con_font", ui_font_names[s_options_interface_confont_box.curvalue] );
}
static void UIFontFunc (void *unused)
{
Cvar_Set( "ui_font", ui_font_names[s_options_interface_uifont_box.curvalue] );
}
static void ScrFontFunc (void *unused)
{
Cvar_Set( "scr_font", ui_font_names[s_options_interface_scrfont_box.curvalue] );
}
void SetFontCursor (void)
{
int i;
s_options_interface_confont_box.curvalue = 0;
s_options_interface_uifont_box.curvalue = 0;
s_options_interface_scrfont_box.curvalue = 0;
if (!con_font)
con_font = Cvar_Get ("con_font", "default", CVAR_ARCHIVE);
if (!ui_font)
ui_font = Cvar_Get ("ui_font", "default", CVAR_ARCHIVE);
if (!scr_font)
scr_font = Cvar_Get ("scr_font", "default", CVAR_ARCHIVE);
if (ui_numfonts > 1)
{
for (i=0; ui_font_names[i]; i++)
{
if (!Q_strcasecmp(con_font->string, ui_font_names[i]))
{
s_options_interface_confont_box.curvalue = i;
break;
}
}
for (i=0; ui_font_names[i]; i++)
{
if (!Q_strcasecmp(ui_font->string, ui_font_names[i]))
{
s_options_interface_uifont_box.curvalue = i;
break;
}
}
for (i=0; ui_font_names[i]; i++)
{
if (!Q_strcasecmp(scr_font->string, ui_font_names[i]))
{
s_options_interface_scrfont_box.curvalue = i;
break;
}
}
}
UI_MenuSpinControl_SaveValue (&s_options_interface_noalttab_box, "win_noalttab");
}
//=======================================================================
static void InterfaceSetMenuItemValues (void)
static void M_InterfaceSetMenuItemValues (void)
{
SetFontCursor ();
UI_MenuSlider_SetValue (&s_options_interface_menumouse_slider, "ui_sensitivity", 0.25f, 2.0f, true);
UI_MenuSlider_SetValue (&s_options_interface_menualpha_slider, "ui_background_alpha", 0.0f, 1.0f, true );
UI_MenuSlider_SetValue (&s_options_interface_menumouse_slider, Cvar_VariableValue("ui_sensitivity"));
UI_MenuSlider_SetValue (&s_options_interface_menualpha_slider, Cvar_VariableValue("ui_background_alpha"));
UI_MenuSlider_SetValue (&s_options_interface_fontsize_slider, Cvar_VariableValue("con_font_size"));
UI_MenuSpinControl_SetValue (&s_options_interface_confont_box, "con_font", 0, 0, false);
UI_MenuSlider_SetValue (&s_options_interface_fontsize_slider, "con_font_size", 6.0f, 16.0f, true);
UI_MenuSpinControl_SetValue (&s_options_interface_uifont_box, "ui_font", 0, 0, false);
UI_MenuSpinControl_SetValue (&s_options_interface_scrfont_box, "scr_font", 0, 0, false);
UI_MenuSpinControl_SetValue (&s_options_interface_alt_text_color_box, "alt_text_color", 0, 9, true);
Cvar_SetValue( "alt_text_color", ClampCvar( 0, 9, Cvar_VariableValue("alt_text_color") ) );
s_options_interface_alt_text_color_box.curvalue = Cvar_VariableValue("alt_text_color");
UI_MenuSlider_SetValue (&s_options_interface_conalpha_slider, "scr_conalpha", 0.0f, 1.0f, true);
// UI_MenuSlider_SetValue (&s_options_interface_conheight_slider, "scr_conheight", 0.10f, 1.0f, true);
UI_MenuSpinControl_SetValue (&s_options_interface_simple_loadscreen_box, "scr_simple_loadscreen", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_interface_newconback_box, "scr_newconback", 0, 1, true);
Cvar_SetValue( "scr_conalpha", ClampCvar( 0, 1, Cvar_VariableValue("scr_conalpha") ) );
UI_MenuSlider_SetValue (&s_options_interface_conalpha_slider, Cvar_VariableValue("scr_conalpha"));
// Cvar_SetValue( "scr_conheight", ClampCvar( 0.25, 0.75, Cvar_VariableValue("scr_conheight") ) );
// UI_MenuSlider_SetValue (&s_options_interface_conheight_slider, Cvar_VariableValue("scr_conheight"));
Cvar_SetValue( "scr_simple_loadscreen", ClampCvar( 0, 1, Cvar_VariableValue("scr_simple_loadscreen") ) );
s_options_interface_simple_loadscreen_box.curvalue = Cvar_VariableValue("scr_simple_loadscreen");
Cvar_SetValue( "scr_newconback", ClampCvar( 0, 1, Cvar_VariableValue("scr_newconback") ) );
s_options_interface_newconback_box.curvalue = Cvar_VariableValue("scr_newconback");
s_options_interface_noalttab_box.curvalue = Cvar_VariableValue("win_noalttab");
UI_MenuSpinControl_SetValue (&s_options_interface_noalttab_box, "win_noalttab", 0, 1, true);
}
static void InterfaceResetDefaultsFunc (void *unused)
static void M_InterfaceResetDefaultsFunc (void *unused)
{
Cvar_SetToDefault ("ui_sensitivity");
Cvar_SetToDefault ("ui_background_alpha");
@ -208,7 +159,7 @@ static void InterfaceResetDefaultsFunc (void *unused)
Cvar_SetToDefault ("scr_newconback");
Cvar_SetToDefault ("win_noalttab");
InterfaceSetMenuItemValues ();
M_InterfaceSetMenuItemValues ();
}
void Options_Interface_MenuInit (void)
@ -219,7 +170,6 @@ void Options_Interface_MenuInit (void)
"yes",
0
};
static const char *textcolor_names[] =
{
"gray",
@ -234,7 +184,6 @@ void Options_Interface_MenuInit (void)
"orange",
0
};
int y = 3*MENU_LINE_SIZE;
s_options_interface_menu.x = SCREEN_WIDTH*0.5;
@ -278,7 +227,8 @@ void Options_Interface_MenuInit (void)
s_options_interface_confont_box.generic.y = y+=2*MENU_LINE_SIZE;
s_options_interface_confont_box.generic.name = "console font";
s_options_interface_confont_box.generic.callback = ConFontFunc;
s_options_interface_confont_box.itemnames = ui_font_names;
s_options_interface_confont_box.itemNames = ui_font_names;
s_options_interface_confont_box.itemValues = ui_font_names;
s_options_interface_confont_box.generic.statusbar = "changes font of console text";
s_options_interface_fontsize_slider.generic.type = MTYPE_SLIDER;
@ -299,7 +249,8 @@ void Options_Interface_MenuInit (void)
s_options_interface_uifont_box.generic.y = y+=MENU_LINE_SIZE;
s_options_interface_uifont_box.generic.name = "menu font";
s_options_interface_uifont_box.generic.callback = UIFontFunc;
s_options_interface_uifont_box.itemnames = ui_font_names;
s_options_interface_uifont_box.itemNames = ui_font_names;
s_options_interface_uifont_box.itemValues = ui_font_names;
s_options_interface_uifont_box.generic.statusbar = "changes font of menu text";
s_options_interface_scrfont_box.generic.type = MTYPE_SPINCONTROL;
@ -308,7 +259,8 @@ void Options_Interface_MenuInit (void)
s_options_interface_scrfont_box.generic.y = y+=MENU_LINE_SIZE;
s_options_interface_scrfont_box.generic.name = "HUD font";
s_options_interface_scrfont_box.generic.callback = ScrFontFunc;
s_options_interface_scrfont_box.itemnames = ui_font_names;
s_options_interface_scrfont_box.itemNames = ui_font_names;
s_options_interface_scrfont_box.itemValues = ui_font_names;
s_options_interface_scrfont_box.generic.statusbar = "changes font of HUD text";
s_options_interface_alt_text_color_box.generic.type = MTYPE_SPINCONTROL;
@ -317,7 +269,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_alt_text_color_box.generic.y = y+=MENU_LINE_SIZE;
s_options_interface_alt_text_color_box.generic.name = "alt text color";
s_options_interface_alt_text_color_box.generic.callback = AltTextColorFunc;
s_options_interface_alt_text_color_box.itemnames = textcolor_names;
s_options_interface_alt_text_color_box.itemNames = textcolor_names;
s_options_interface_alt_text_color_box.generic.statusbar = "changes color of highlighted text";
s_options_interface_conalpha_slider.generic.type = MTYPE_SLIDER;
@ -352,7 +304,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_simple_loadscreen_box.generic.y = y+=2*MENU_LINE_SIZE;
s_options_interface_simple_loadscreen_box.generic.name = "simple load screens";
s_options_interface_simple_loadscreen_box.generic.callback = SimpleLoadscreenFunc;
s_options_interface_simple_loadscreen_box.itemnames = yesno_names;
s_options_interface_simple_loadscreen_box.itemNames = yesno_names;
s_options_interface_simple_loadscreen_box.generic.statusbar = "toggles simple map load screen";
s_options_interface_newconback_box.generic.type = MTYPE_SPINCONTROL;
@ -361,7 +313,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_newconback_box.generic.y = y+=MENU_LINE_SIZE;
s_options_interface_newconback_box.generic.name = "new console background";
s_options_interface_newconback_box.generic.callback = NewConbackFunc;
s_options_interface_newconback_box.itemnames = yesno_names;
s_options_interface_newconback_box.itemNames = yesno_names;
s_options_interface_newconback_box.generic.statusbar = "enables Q3-style console background";
s_options_interface_noalttab_box.generic.type = MTYPE_SPINCONTROL;
@ -370,7 +322,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_noalttab_box.generic.y = y+=2*MENU_LINE_SIZE;
s_options_interface_noalttab_box.generic.name = "disable alt-tab";
s_options_interface_noalttab_box.generic.callback = NoAltTabFunc;
s_options_interface_noalttab_box.itemnames = yesno_names;
s_options_interface_noalttab_box.itemNames = yesno_names;
s_options_interface_noalttab_box.generic.statusbar = "disables alt-tabbing to desktop";
s_options_interface_defaults_action.generic.type = MTYPE_ACTION;
@ -378,7 +330,7 @@ void Options_Interface_MenuInit (void)
s_options_interface_defaults_action.generic.x = MENU_FONT_SIZE;
s_options_interface_defaults_action.generic.y = 18*MENU_LINE_SIZE;
s_options_interface_defaults_action.generic.name = "reset defaults";
s_options_interface_defaults_action.generic.callback = InterfaceResetDefaultsFunc;
s_options_interface_defaults_action.generic.callback = M_InterfaceResetDefaultsFunc;
s_options_interface_defaults_action.generic.statusbar = "resets all interface settings to internal defaults";
s_options_interface_back_action.generic.type = MTYPE_ACTION;
@ -404,7 +356,7 @@ void Options_Interface_MenuInit (void)
UI_AddMenuItem (&s_options_interface_menu, (void *) &s_options_interface_defaults_action);
UI_AddMenuItem (&s_options_interface_menu, (void *) &s_options_interface_back_action);
InterfaceSetMenuItemValues ();
M_InterfaceSetMenuItemValues ();
}
void Menu_Options_Interface_Draw (void)

View file

@ -98,9 +98,7 @@ static void M_UnbindCommand (char *command)
static void M_FindKeysForCommand (char *command, int *twokeys)
{
int count;
int j;
int l;
int count, j, l;
char *b;
twokeys[0] = twokeys[1] = -1;
@ -125,7 +123,7 @@ static void M_FindKeysForCommand (char *command, int *twokeys)
}
}
static void KeysBackCursorDrawFunc (menuaction_s *self) // back action
static void M_KeysBackCursorDrawFunc (menuaction_s *self) // back action
{
char *cursor;
@ -137,7 +135,7 @@ static void KeysBackCursorDrawFunc (menuaction_s *self) // back action
*/
}
static void KeyCursorDrawFunc (menuframework_s *menu)
static void M_KeyCursorDrawFunc (menuframework_s *menu)
{
char *cursor;
@ -156,7 +154,7 @@ static void KeyCursorDrawFunc (menuframework_s *menu)
*/
}
static void DrawKeyBindingFunc (void *self)
static void M_DrawKeyBindingFunc (void *self)
{
int keys[2];
menuaction_s *a = (menuaction_s *) self;
@ -190,7 +188,7 @@ static void DrawKeyBindingFunc (void *self)
}
}
static void KeyBindingFunc (void *self)
static void M_KeyBindingFunc (void *self)
{
menuaction_s *a = ( menuaction_s * ) self;
int keys[2];
@ -205,17 +203,17 @@ static void KeyBindingFunc (void *self)
UI_SetMenuStatusBar (&s_keys_menu, "press a key or button for this action");
}
void addBindOption (int i, char *list[][2])
void M_AddBindOption (int i, char *list[][2])
{
s_keys_binds[i].generic.type = MTYPE_ACTION;
s_keys_binds[i].generic.textSize = MENU_FONT_SIZE;
s_keys_binds[i].generic.flags = QMF_GRAYED;
s_keys_binds[i].generic.x = 0;
s_keys_binds[i].generic.y = i*MENU_LINE_SIZE;
s_keys_binds[i].generic.ownerdraw = DrawKeyBindingFunc;
s_keys_binds[i].generic.ownerdraw = M_DrawKeyBindingFunc;
s_keys_binds[i].generic.localdata[0] = i;
s_keys_binds[i].generic.name = list[s_keys_binds[i].generic.localdata[0]][1];
s_keys_binds[i].generic.callback = KeyBindingFunc;
s_keys_binds[i].generic.callback = M_KeyBindingFunc;
if (strstr ("MENUSPACE", list[i][0]))
s_keys_binds[i].generic.type = MTYPE_SEPARATOR;
@ -229,11 +227,11 @@ static void Menu_Keys_Init (void)
s_keys_menu.x = SCREEN_WIDTH*0.5;
s_keys_menu.y = SCREEN_HEIGHT*0.5 - 72;
s_keys_menu.nitems = 0;
s_keys_menu.cursordraw = KeyCursorDrawFunc;
s_keys_menu.cursordraw = M_KeyCursorDrawFunc;
BINDS_MAX = listSize(bindnames);
for (i=0;i<BINDS_MAX;i++)
addBindOption (i, bindnames);
M_AddBindOption (i, bindnames);
s_keys_back_action.generic.type = MTYPE_ACTION;
s_keys_back_action.generic.textSize = MENU_FONT_SIZE;
@ -242,7 +240,7 @@ static void Menu_Keys_Init (void)
s_keys_back_action.generic.y = (BINDS_MAX+2)*MENU_LINE_SIZE;
s_keys_back_action.generic.name = " back";
s_keys_back_action.generic.callback = UI_BackMenu;
s_keys_back_action.generic.cursordraw = KeysBackCursorDrawFunc;
s_keys_back_action.generic.cursordraw = M_KeysBackCursorDrawFunc;
for (i=0;i<BINDS_MAX;i++)
UI_AddMenuItem (&s_keys_menu, (void *) &s_keys_binds[i]);
@ -293,7 +291,7 @@ static const char *Menu_Keys_Key (int key)
case K_ENTER:
if (item == &s_keys_back_action) { // back action hack
UI_BackMenu(item); return NULL; }
KeyBindingFunc (item);
M_KeyBindingFunc (item);
return menu_in_sound;
case K_BACKSPACE: // delete bindings
case K_DEL: // delete bindings

View file

@ -50,115 +50,68 @@ static menulist_s s_options_screen_fps_box;
static menuaction_s s_options_screen_defaults_action;
static menuaction_s s_options_screen_back_action;
//=======================================================================
static void CrosshairFunc (void *unused)
{
UI_MenuSpinControl_SaveValue (&s_options_screen_crosshair_box, "crosshair");
}
// Psychospaz's changeable size crosshair
static void CrosshairSizeFunc (void *unused)
{
Cvar_SetValue( "crosshair_scale", UI_MenuSlider_GetValue(&s_options_screen_crosshairscale_slider) );
UI_MenuSlider_SaveValue (&s_options_screen_crosshairscale_slider, "crosshair_scale");
}
static void CrosshairAlphaFunc (void *unused)
{
Cvar_SetValue( "crosshair_alpha", UI_MenuSlider_GetValue(&s_options_screen_crosshairalpha_slider) );
UI_MenuSlider_SaveValue (&s_options_screen_crosshairalpha_slider, "crosshair_alpha");
}
static void CrosshairPulseFunc (void *unused)
{
Cvar_SetValue( "crosshair_pulse", UI_MenuSlider_GetValue(&s_options_screen_crosshairpulse_slider) );
UI_MenuSlider_SaveValue (&s_options_screen_crosshairpulse_slider, "crosshair_pulse");
}
// hud scaling option
static void HudScaleFunc (void *unused)
{
Cvar_SetValue( "scr_hudsize", UI_MenuSlider_GetValue(&s_options_screen_hudscale_slider) );
UI_MenuSlider_SaveValue (&s_options_screen_hudscale_slider, "scr_hudsize");
}
// hud trans option
static void HudAlphaFunc (void *unused)
{
Cvar_SetValue( "scr_hudalpha", UI_MenuSlider_GetValue(&s_options_screen_hudalpha_slider) );
UI_MenuSlider_SaveValue (&s_options_screen_hudalpha_slider, "scr_hudalpha");
}
// hud squeeze digits option
static void HudSqueezeDigitsFunc (void *unused)
{
Cvar_SetValue( "scr_hudsqueezedigits", s_options_screen_hudsqueezedigits_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_options_screen_hudsqueezedigits_box, "scr_hudsqueezedigits");
}
// FPS counter option
static void FPSFunc (void *unused)
{
Cvar_SetValue( "cl_drawfps", s_options_screen_fps_box.curvalue);
}
/*
=======================================================================
Crosshair loading
=======================================================================
*/
/*static void OldCrosshairFunc (void *unused)
{
Cvar_SetValue( "crosshair", s_options_crosshair_box.curvalue );
}*/
static void CrosshairFunc (void *unused)
{
if (s_options_screen_crosshair_box.curvalue == 0) {
Cvar_SetValue( "crosshair", 0);
return;
}
else
Cvar_SetValue( "crosshair", atoi(strdup(ui_crosshair_names[s_options_screen_crosshair_box.curvalue]+2)) );
}
void SetCrosshairCursor (void)
{
int i;
s_options_screen_crosshair_box.curvalue = 0;
if (ui_numcrosshairs > 1)
for (i=0; ui_crosshair_names[i]; i++)
{
if (!Q_strcasecmp(va("ch%i", (int)Cvar_VariableValue("crosshair")), ui_crosshair_names[i]))
{
s_options_screen_crosshair_box.curvalue = i;
return;
}
}
UI_MenuSpinControl_SaveValue (&s_options_screen_fps_box, "cl_drawfps");
}
//=======================================================================
static void ScreenSetMenuItemValues (void)
static void M_ScreenSetMenuItemValues (void)
{
Cvar_SetValue( "crosshair", ClampCvar( 0, 100, Cvar_VariableValue("crosshair") ) );
SetCrosshairCursor ();
Cvar_SetValue( "crosshair_scale", ClampCvar( 0.25, 5, Cvar_VariableValue("crosshair_scale") ) );
UI_MenuSlider_SetValue (&s_options_screen_crosshairscale_slider, Cvar_VariableValue("crosshair_scale"));
Cvar_SetValue( "crosshair_alpha", ClampCvar( 0.05, 1, Cvar_VariableValue("crosshair_alpha") ) );
UI_MenuSlider_SetValue (&s_options_screen_crosshairalpha_slider, Cvar_VariableValue("crosshair_alpha"));
Cvar_SetValue( "crosshair_pulse", ClampCvar( 0, 0.5, Cvar_VariableValue("crosshair_pulse") ) );
UI_MenuSlider_SetValue (&s_options_screen_crosshairpulse_slider, Cvar_VariableValue("crosshair_pulse"));
Cvar_SetValue( "scr_hudsize", ClampCvar( 0, 8, Cvar_VariableValue("scr_hudsize") ) );
UI_MenuSlider_SetValue (&s_options_screen_hudscale_slider, Cvar_VariableValue("scr_hudsize"));
Cvar_SetValue( "scr_hudalpha", ClampCvar( 0, 1, Cvar_VariableValue("scr_hudalpha") ) );
UI_MenuSlider_SetValue (&s_options_screen_hudalpha_slider, Cvar_VariableValue("scr_hudalpha"));
Cvar_SetValue( "scr_hudsqueezedigits", ClampCvar( 0, 1, Cvar_VariableValue("scr_hudsqueezedigits") ) );
s_options_screen_hudsqueezedigits_box.curvalue = Cvar_VariableValue("scr_hudsqueezedigits");
Cvar_SetValue( "cl_drawfps", ClampCvar( 0, 1, Cvar_VariableValue("cl_drawfps") ) );
s_options_screen_fps_box.curvalue = Cvar_VariableValue("cl_drawfps");
UI_MenuSpinControl_SetValue (&s_options_screen_crosshair_box, "crosshair", 0, 100, true);
UI_MenuSlider_SetValue (&s_options_screen_crosshairscale_slider, "crosshair_scale", 0.25f, 5.0f, true);
UI_MenuSlider_SetValue (&s_options_screen_crosshairalpha_slider, "crosshair_alpha", 0.05f, 1.0f, true);
UI_MenuSlider_SetValue (&s_options_screen_crosshairpulse_slider, "crosshair_pulse", 0.0f, 0.5f, true);
UI_MenuSlider_SetValue (&s_options_screen_hudscale_slider, "scr_hudsize", 0, 8, true);
UI_MenuSlider_SetValue (&s_options_screen_hudalpha_slider, "scr_hudalpha", 0.0f, 1.0f, true);
UI_MenuSpinControl_SetValue (&s_options_screen_hudsqueezedigits_box, "scr_hudsqueezedigits", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_screen_fps_box, "cl_drawfps", 0, 1, true);
}
static void ScreenResetDefaultsFunc (void *unused)
static void M_ScreenResetDefaultsFunc (void *unused)
{
Cvar_SetToDefault ("crosshair");
Cvar_SetToDefault ("crosshair_scale");
@ -169,7 +122,7 @@ static void ScreenResetDefaultsFunc (void *unused)
Cvar_SetToDefault ("scr_hudsqueezedigits");
Cvar_SetToDefault ("cl_drawfps");
ScreenSetMenuItemValues();
M_ScreenSetMenuItemValues ();
}
void Menu_Options_Screen_Init (void)
@ -199,7 +152,8 @@ void Menu_Options_Screen_Init (void)
s_options_screen_crosshair_box.generic.y = y;
s_options_screen_crosshair_box.generic.name = "crosshair";
s_options_screen_crosshair_box.generic.callback = CrosshairFunc;
s_options_screen_crosshair_box.itemnames = ui_crosshair_names;
s_options_screen_crosshair_box.itemNames = ui_crosshair_names;
s_options_screen_crosshair_box.itemValues = ui_crosshair_values;
s_options_screen_crosshair_box.generic.statusbar = "changes crosshair";
// Psychospaz's changeable size crosshair
@ -272,7 +226,7 @@ void Menu_Options_Screen_Init (void)
s_options_screen_hudsqueezedigits_box.generic.y = y += MENU_LINE_SIZE;
s_options_screen_hudsqueezedigits_box.generic.name = "status bar digit squeezing";
s_options_screen_hudsqueezedigits_box.generic.callback = HudSqueezeDigitsFunc;
s_options_screen_hudsqueezedigits_box.itemnames = yesno_names;
s_options_screen_hudsqueezedigits_box.itemNames = yesno_names;
s_options_screen_hudsqueezedigits_box.generic.statusbar = "enables showing of longer numbers on HUD";
s_options_screen_fps_box.generic.type = MTYPE_SPINCONTROL;
@ -281,7 +235,7 @@ void Menu_Options_Screen_Init (void)
s_options_screen_fps_box.generic.y = y += 2*MENU_LINE_SIZE;
s_options_screen_fps_box.generic.name = "FPS counter";
s_options_screen_fps_box.generic.callback = FPSFunc;
s_options_screen_fps_box.itemnames = yesno_names;
s_options_screen_fps_box.itemNames = yesno_names;
s_options_screen_fps_box.generic.statusbar = "enables FPS counter";
s_options_screen_defaults_action.generic.type = MTYPE_ACTION;
@ -289,7 +243,7 @@ void Menu_Options_Screen_Init (void)
s_options_screen_defaults_action.generic.x = MENU_FONT_SIZE;
s_options_screen_defaults_action.generic.y = y+=2*MENU_LINE_SIZE;
s_options_screen_defaults_action.generic.name = "reset defaults";
s_options_screen_defaults_action.generic.callback = ScreenResetDefaultsFunc;
s_options_screen_defaults_action.generic.callback = M_ScreenResetDefaultsFunc;
s_options_screen_defaults_action.generic.statusbar = "resets all screen settings to internal defaults";
s_options_screen_back_action.generic.type = MTYPE_ACTION;
@ -311,7 +265,7 @@ void Menu_Options_Screen_Init (void)
UI_AddMenuItem (&s_options_screen_menu, (void *) &s_options_screen_defaults_action);
UI_AddMenuItem (&s_options_screen_menu, (void *) &s_options_screen_back_action);
ScreenSetMenuItemValues ();
M_ScreenSetMenuItemValues ();
}
void Menu_Options_Screen_Crosshair_MouseClick (void)
@ -333,9 +287,9 @@ void Menu_Options_Screen_Crosshair_MouseClick (void)
{
if (!ui_mousecursor.buttonused[MOUSEBUTTON1] && (ui_mousecursor.buttonclicks[MOUSEBUTTON1] == 1) )
{
s_options_screen_crosshair_box.curvalue++;
if (s_options_screen_crosshair_box.curvalue > ui_numcrosshairs-1)
s_options_screen_crosshair_box.curvalue = 0; // wrap around
s_options_screen_crosshair_box.curValue++;
if (s_options_screen_crosshair_box.curValue > ui_numcrosshairs-1)
s_options_screen_crosshair_box.curValue = 0; // wrap around
CrosshairFunc (NULL);
ui_mousecursor.buttonused[MOUSEBUTTON1] = true;
@ -346,9 +300,9 @@ void Menu_Options_Screen_Crosshair_MouseClick (void)
}
if (!ui_mousecursor.buttonused[MOUSEBUTTON2] && (ui_mousecursor.buttonclicks[MOUSEBUTTON2] == 1) )
{
s_options_screen_crosshair_box.curvalue--;
if (s_options_screen_crosshair_box.curvalue < 0)
s_options_screen_crosshair_box.curvalue = ui_numcrosshairs-1; // wrap around
s_options_screen_crosshair_box.curValue--;
if (s_options_screen_crosshair_box.curValue < 0)
s_options_screen_crosshair_box.curValue = ui_numcrosshairs-1; // wrap around
CrosshairFunc (NULL);
ui_mousecursor.buttonused[MOUSEBUTTON2] = true;
@ -367,11 +321,11 @@ void Menu_Options_Screen_DrawCrosshair (void)
UI_DrawFill (SCREEN_WIDTH*0.5 - 17, s_options_screen_menu.y + 43,
34, 34, ALIGN_CENTER, false, 0,0,0,255);
if (s_options_screen_crosshair_box.curvalue < 1)
if (s_options_screen_crosshair_box.curValue < 1)
return;
UI_DrawPic (SCREEN_WIDTH*0.5-16, s_options_screen_menu.y + 44,
32, 32, ALIGN_CENTER, false, ui_crosshair_names[s_options_screen_crosshair_box.curvalue], 1.0);
32, 32, ALIGN_CENTER, false, ui_crosshair_names[s_options_screen_crosshair_box.curValue], 1.0);
}
void Menu_Options_Screen_Draw (void)

View file

@ -49,52 +49,32 @@ static menuaction_s s_options_sound_defaults_action;
static menuaction_s s_options_sound_back_action;
static void UpdateVolumeFunc (void *unused)
static void VolumeFunc (void *unused)
{
Cvar_SetValue( "s_volume", UI_MenuSlider_GetValue(&s_options_sound_sfxvolume_slider) );
UI_MenuSlider_SaveValue (&s_options_sound_sfxvolume_slider, "s_volume");
}
static void UpdateMusicVolumeFunc (void *unused)
static void MusicVolumeFunc (void *unused)
{
Cvar_SetValue( "s_musicvolume", UI_MenuSlider_GetValue(&s_options_sound_musicvolume_slider) );
UI_MenuSlider_SaveValue (&s_options_sound_musicvolume_slider, "s_musicvolume");
}
static void UpdateOggMusicFunc (void *unused)
static void OggMusicFunc (void *unused)
{
Cvar_SetValue( "cl_ogg_music", s_options_sound_oggmusic_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_sound_oggmusic_box, "cl_ogg_music");
}
static void UpdateCDVolumeFunc (void *unused)
static void CDVolumeFunc (void *unused)
{
Cvar_SetValue( "cd_nocd", !s_options_sound_cdvolume_box.curvalue );
UI_MenuSpinControl_SaveValue (&s_options_sound_cdvolume_box, "cd_nocd");
}
static void UpdateSoundQualityFunc (void *unused)
static void M_UpdateSoundQualityFunc (void *unused)
{
// Knightmare- added DMP's 44/48 KHz sound support
//** DMP check the newly added sound quality menu options
switch (s_options_sound_quality_list.curvalue)
{
case 1:
Cvar_SetValue( "s_khz", 22 );
Cvar_SetValue( "s_loadas8bit", false );
break;
case 2:
Cvar_SetValue( "s_khz", 44 );
Cvar_SetValue( "s_loadas8bit", false );
break;
case 3:
Cvar_SetValue( "s_khz", 48 );
Cvar_SetValue( "s_loadas8bit", false );
break;
default:
Cvar_SetValue( "s_khz", 11 );
Cvar_SetValue( "s_loadas8bit", true );
break;
}
//** DMP end sound menu changes
UI_MenuSpinControl_SaveValue (&s_options_sound_quality_list, "s_khz");
Cvar_SetInteger ("s_loadas8bit", (s_options_sound_quality_list.curValue == 0));
Cvar_SetValue ("s_primary", s_options_sound_compatibility_list.curvalue);
UI_MenuSpinControl_SaveValue (&s_options_sound_compatibility_list, "s_primary");
UI_DrawTextBox (168, 192, 36, 3);
UI_DrawString (188, 192+MENU_FONT_SIZE, MENU_FONT_SIZE, S_COLOR_ALT"Restarting the sound system. This", 255);
@ -107,26 +87,17 @@ static void UpdateSoundQualityFunc (void *unused)
CL_Snd_Restart_f();
}
static void SoundSetMenuItemValues (void)
static void M_SoundSetMenuItemValues (void)
{
UI_MenuSlider_SetValue (&s_options_sound_sfxvolume_slider, Cvar_VariableValue("s_volume"));
UI_MenuSlider_SetValue (&s_options_sound_musicvolume_slider, Cvar_VariableValue("s_musicvolume"));
s_options_sound_oggmusic_box.curvalue = (Cvar_VariableValue("cl_ogg_music") > 0);
s_options_sound_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd");
//** DMP convert setting into index for option display text
switch((int)Cvar_VariableValue("s_khz"))
{
case 48: s_options_sound_quality_list.curvalue = 3; break;
case 44: s_options_sound_quality_list.curvalue = 2; break;
case 22: s_options_sound_quality_list.curvalue = 1; break;
default: s_options_sound_quality_list.curvalue = 0; break;
}
//** DMP end sound menu changes
s_options_sound_compatibility_list.curvalue = Cvar_VariableValue( "s_primary");
UI_MenuSlider_SetValue (&s_options_sound_sfxvolume_slider, "s_volume", 0.0f, 1.0f, true);
UI_MenuSlider_SetValue (&s_options_sound_musicvolume_slider, "s_musicvolume", 0.0f, 1.0f, true);
UI_MenuSpinControl_SetValue (&s_options_sound_oggmusic_box, "cl_ogg_music", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_sound_cdvolume_box, "cd_nocd", 0, 0, false);
UI_MenuSpinControl_SetValue (&s_options_sound_quality_list, "s_khz", 0, 0, false);
UI_MenuSpinControl_SetValue (&s_options_sound_compatibility_list, "s_primary", 0, 1, true);
}
static void SoundResetDefaultsFunc (void *unused)
static void M_SoundResetDefaultsFunc (void *unused)
{
Cvar_SetToDefault ("s_volume");
Cvar_SetToDefault ("cd_nocd");
@ -145,7 +116,7 @@ static void SoundResetDefaultsFunc (void *unused)
CL_Snd_Restart_f();
SoundSetMenuItemValues();
M_SoundSetMenuItemValues();
}
void Menu_Options_Sound_Init (void)
@ -156,7 +127,12 @@ void Menu_Options_Sound_Init (void)
"enabled",
0
};
static const char *cd_music_values[] =
{
"1",
"0",
0
};
static const char *quality_items[] =
{
"low (11KHz/8-bit)", //** DMP - changed text
@ -165,10 +141,19 @@ void Menu_Options_Sound_Init (void)
"highest (48KHz/16-bit)", //** DMP - added 48 Khz menu item
0
};
static const char *quality_values[] =
{
"11",
"22",
"44",
"48",
0
};
static const char *compatibility_items[] =
{
"max compatibility", "max performance", 0
"max compatibility",
"max performance",
0
};
int y = 3*MENU_LINE_SIZE;
@ -188,73 +173,75 @@ void Menu_Options_Sound_Init (void)
s_options_sound_sfxvolume_slider.generic.x = 0;
s_options_sound_sfxvolume_slider.generic.y = y;
s_options_sound_sfxvolume_slider.generic.name = "effects volume";
s_options_sound_sfxvolume_slider.generic.callback = UpdateVolumeFunc;
s_options_sound_sfxvolume_slider.generic.callback = VolumeFunc;
s_options_sound_sfxvolume_slider.maxPos = 20;
s_options_sound_sfxvolume_slider.baseValue = 0.0f;
s_options_sound_sfxvolume_slider.increment = 0.05f;
s_options_sound_sfxvolume_slider.displayAsPercent = true;
UI_MenuSlider_SetValue (&s_options_sound_sfxvolume_slider, Cvar_VariableValue("s_volume"));
s_options_sound_sfxvolume_slider.generic.statusbar = "volume of sound effects";
UI_MenuSlider_SetValue (&s_options_sound_sfxvolume_slider, "s_volume", 0.0f, 1.0f, true);
s_options_sound_musicvolume_slider.generic.type = MTYPE_SLIDER;
s_options_sound_musicvolume_slider.generic.textSize = MENU_FONT_SIZE;
s_options_sound_musicvolume_slider.generic.x = 0;
s_options_sound_musicvolume_slider.generic.y = y+=MENU_LINE_SIZE;
s_options_sound_musicvolume_slider.generic.name = "music volume";
s_options_sound_musicvolume_slider.generic.callback = UpdateMusicVolumeFunc;
s_options_sound_musicvolume_slider.generic.callback = MusicVolumeFunc;
s_options_sound_musicvolume_slider.maxPos = 20;
s_options_sound_musicvolume_slider.baseValue = 0.0f;
s_options_sound_musicvolume_slider.increment = 0.05f;
s_options_sound_musicvolume_slider.displayAsPercent = true;
UI_MenuSlider_SetValue (&s_options_sound_musicvolume_slider, Cvar_VariableValue("s_musicvolume"));
s_options_sound_musicvolume_slider.generic.statusbar = "volume of ogg vorbis music";
UI_MenuSlider_SetValue (&s_options_sound_musicvolume_slider, "s_musicvolume", 0.0f, 1.0f, true);
s_options_sound_oggmusic_box.generic.type = MTYPE_SPINCONTROL;
s_options_sound_oggmusic_box.generic.textSize = MENU_FONT_SIZE;
s_options_sound_oggmusic_box.generic.x = 0;
s_options_sound_oggmusic_box.generic.y = y+=MENU_LINE_SIZE;
s_options_sound_oggmusic_box.generic.name = "ogg vorbis music";
s_options_sound_oggmusic_box.generic.callback = UpdateOggMusicFunc;
s_options_sound_oggmusic_box.itemnames = cd_music_items;
s_options_sound_oggmusic_box.curvalue = (Cvar_VariableValue("cl_ogg_music") > 0);
s_options_sound_oggmusic_box.generic.callback = OggMusicFunc;
s_options_sound_oggmusic_box.itemNames = cd_music_items;
s_options_sound_oggmusic_box.generic.statusbar = "override of CD music with ogg vorbis tracks";
UI_MenuSpinControl_SetValue (&s_options_sound_oggmusic_box,"cl_ogg_music", 0, 1, true);
s_options_sound_cdvolume_box.generic.type = MTYPE_SPINCONTROL;
s_options_sound_cdvolume_box.generic.textSize = MENU_FONT_SIZE;
s_options_sound_cdvolume_box.generic.x = 0;
s_options_sound_cdvolume_box.generic.y = y+=MENU_LINE_SIZE;
s_options_sound_cdvolume_box.generic.name = "CD music";
s_options_sound_cdvolume_box.generic.callback = UpdateCDVolumeFunc;
s_options_sound_cdvolume_box.itemnames = cd_music_items;
s_options_sound_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd");
s_options_sound_cdvolume_box.generic.callback = CDVolumeFunc;
s_options_sound_cdvolume_box.itemNames = cd_music_items;
s_options_sound_cdvolume_box.itemValues = cd_music_values;
s_options_sound_cdvolume_box.generic.statusbar = "enables or disables CD music";
UI_MenuSpinControl_SetValue (&s_options_sound_cdvolume_box, "cd_nocd", 0, 0, false);
s_options_sound_quality_list.generic.type = MTYPE_SPINCONTROL;
s_options_sound_quality_list.generic.textSize = MENU_FONT_SIZE;
s_options_sound_quality_list.generic.x = 0;
s_options_sound_quality_list.generic.y = y+=MENU_LINE_SIZE;
s_options_sound_quality_list.generic.name = "sound quality";
s_options_sound_quality_list.generic.callback = UpdateSoundQualityFunc;
s_options_sound_quality_list.itemnames = quality_items;
s_options_sound_quality_list.curvalue = !Cvar_VariableValue( "s_loadas8bit" );
s_options_sound_quality_list.generic.callback = M_UpdateSoundQualityFunc;
s_options_sound_quality_list.itemNames = quality_items;
s_options_sound_quality_list.itemValues = quality_values;
s_options_sound_quality_list.generic.statusbar = "changes quality of sound";
UI_MenuSpinControl_SetValue (&s_options_sound_quality_list, "s_khz", 0, 0, false);
s_options_sound_compatibility_list.generic.type = MTYPE_SPINCONTROL;
s_options_sound_compatibility_list.generic.textSize = MENU_FONT_SIZE;
s_options_sound_compatibility_list.generic.x = 0;
s_options_sound_compatibility_list.generic.y = y+=MENU_LINE_SIZE;
s_options_sound_compatibility_list.generic.name = "sound compatibility";
s_options_sound_compatibility_list.generic.callback = UpdateSoundQualityFunc;
s_options_sound_compatibility_list.itemnames = compatibility_items;
s_options_sound_compatibility_list.curvalue = Cvar_VariableValue( "s_primary" );
s_options_sound_compatibility_list.generic.callback = M_UpdateSoundQualityFunc;
s_options_sound_compatibility_list.itemNames = compatibility_items;
s_options_sound_compatibility_list.generic.statusbar = "changes buffering mode of sound system";
UI_MenuSpinControl_SetValue (&s_options_sound_compatibility_list, "s_primary", 0, 1, true);
s_options_sound_defaults_action.generic.type = MTYPE_ACTION;
s_options_sound_defaults_action.generic.textSize = MENU_FONT_SIZE;
s_options_sound_defaults_action.generic.x = MENU_FONT_SIZE;
s_options_sound_defaults_action.generic.y = 18*MENU_LINE_SIZE;
s_options_sound_defaults_action.generic.name = "reset defaults";
s_options_sound_defaults_action.generic.callback = SoundResetDefaultsFunc;
s_options_sound_defaults_action.generic.callback = M_SoundResetDefaultsFunc;
s_options_sound_defaults_action.generic.statusbar = "resets all sound settings to internal defaults";
s_options_sound_back_action.generic.type = MTYPE_ACTION;
@ -274,7 +261,7 @@ void Menu_Options_Sound_Init (void)
UI_AddMenuItem (&s_options_sound_menu, (void *) &s_options_sound_defaults_action);
UI_AddMenuItem (&s_options_sound_menu, (void *) &s_options_sound_back_action);
SoundSetMenuItemValues();
M_SoundSetMenuItemValues ();
}
void Menu_Options_Sound_Draw (void)

View file

@ -61,9 +61,11 @@ static menuaction_s s_defaults_action;
static menuaction_s s_apply_action;
static menuaction_s s_backmain_action;
static void VidModeCallback (void *unused)
//=======================================================================
static void M_ShowCustomFields (void)
{
qboolean customHidden = (strcmp(ui_video_modes[s_mode_list.curvalue], "-1") != 0);
qboolean customHidden = (strcmp(ui_video_modes[s_mode_list.curValue], "-1") != 0);
s_customwidth_title.generic.flags = customHidden ? QMF_HIDDEN : 0;
s_customwidth_field.generic.flags = customHidden ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
@ -71,37 +73,58 @@ static void VidModeCallback (void *unused)
s_customheight_field.generic.flags = customHidden ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
}
static void VidModeCallback (void *unused)
{
M_ShowCustomFields ();
}
static void BrightnessCallback (void *s)
{
// invert sense so greater = brighter, and scale to a range of 0.3 to 1.3
Cvar_SetValue( "vid_gamma", UI_MenuSlider_GetValue(&s_brightness_slider) );
UI_MenuSlider_SaveValue (&s_brightness_slider, "vid_gamma");
}
static void AnisoCallback (void *s)
{
UI_MenuSpinControl_SaveValue (&s_aniso_box, "r_anisotropic");
}
static void VsyncCallback (void *unused)
{
Cvar_SetValue( "r_swapinterval", s_vsync_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_vsync_box, "r_swapinterval");
}
static void AdjustFOVCallback (void *unused)
{
Cvar_SetValue( "cl_widescreen_fov", s_adjust_fov_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_adjust_fov_box, "cl_widescreen_fov");
}
static void AsyncCallback (void *unused)
{
Cvar_SetValue( "cl_async", s_async_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_async_box, "cl_async");
}
static void AdvancedOptions (void *s)
static void M_AdvancedOptions (void *s)
{
Menu_Video_Advanced_f ();
}
static void ResetVideoDefaults (void *unused)
//=======================================================================
static void M_PrepareVideoRefresh (void)
{
// set the right mode for refresh
Cvar_Set( "vid_ref", "gl" );
Cvar_Set( "gl_driver", "opengl32" );
// tell them they're modified so they refresh
vid_ref->modified = true;
}
static void M_ResetVideoDefaults (void *unused)
{
Cvar_SetToDefault ("r_mode");
Cvar_SetToDefault ("vid_fullscreen");
Cvar_SetToDefault ("vid_gamma");
Cvar_SetToDefault ("r_mode");
Cvar_SetToDefault ("r_texturemode");
Cvar_SetToDefault ("r_anisotropic");
Cvar_SetToDefault ("r_picmip");
@ -140,29 +163,18 @@ static void ResetVideoDefaults (void *unused)
Menu_Video_Init();
}
static void Menu_PrepareVideoRefresh (void)
{
// set the right mode for refresh
Cvar_Set( "vid_ref", "gl" );
Cvar_Set( "gl_driver", "opengl32" );
// tell them they're modified so they refresh
vid_ref->modified = true;
}
static void Menu_ApplyVideoChanges (void *unused)
static void M_ApplyVideoChanges (void *unused)
{
int customW, customH;
char *customStr;
Cvar_Set ("r_mode", ui_video_modes[s_mode_list.curvalue]);
if (strcmp(ui_video_modes[s_mode_list.curvalue], "-1") == 0) // use custom mode fields
UI_MenuSpinControl_SaveValue (&s_mode_list, "r_mode");
if (strcmp(ui_video_modes[s_mode_list.curValue], "-1") == 0) // use custom mode fields
{
customW = atoi(s_customwidth_field.buffer);
customH = atoi(s_customheight_field.buffer);
Cvar_SetValue ("r_customwidth", ClampCvar( 640, 99999, customW ));
Cvar_SetValue ("r_customheight", ClampCvar( 480, 99999, customH ));
Cvar_SetInteger ("r_customwidth", ClampCvar( 640, 99999, customW ));
Cvar_SetInteger ("r_customheight", ClampCvar( 480, 99999, customH ));
// update fields in case values were clamped
customStr = Cvar_VariableString("r_customwidth");
@ -173,160 +185,25 @@ static void Menu_ApplyVideoChanges (void *unused)
Q_strncpyz (s_customheight_field.buffer, sizeof(s_customwidth_field.buffer), customStr);
s_customheight_field.cursor = (int)strlen(customStr);
}
Cvar_SetValue( "vid_fullscreen", s_fs_box.curvalue );
Cvar_SetValue( "vid_gamma", UI_MenuSlider_GetValue(&s_brightness_slider) );
Cvar_SetValue( "r_picmip", 4-s_texqual_box.curvalue );
// Knightmare- refesh rate option
switch (s_refresh_box.curvalue)
{
case 14:
Cvar_SetValue ("r_displayrefresh", 240);
break;
case 13:
Cvar_SetValue ("r_displayrefresh", 180);
break;
case 12:
Cvar_SetValue ("r_displayrefresh", 165);
break;
case 11:
Cvar_SetValue ("r_displayrefresh", 160);
break;
case 10:
Cvar_SetValue ("r_displayrefresh", 150);
break;
case 9:
Cvar_SetValue ("r_displayrefresh", 144);
break;
case 8:
Cvar_SetValue ("r_displayrefresh", 120);
break;
case 7:
Cvar_SetValue ("r_displayrefresh", 110);
break;
case 6:
Cvar_SetValue ("r_displayrefresh", 100);
break;
case 5:
Cvar_SetValue ("r_displayrefresh", 85);
break;
case 4:
Cvar_SetValue ("r_displayrefresh", 75);
break;
case 3:
Cvar_SetValue ("r_displayrefresh", 72);
break;
case 2:
Cvar_SetValue ("r_displayrefresh", 70);
break;
case 1:
Cvar_SetValue ("r_displayrefresh", 60);
break;
case 0:
default:
Cvar_SetValue ("r_displayrefresh", 0);
break;
}
UI_MenuSpinControl_SaveValue (&s_fs_box, "vid_fullscreen");
UI_MenuSlider_SaveValue (&s_brightness_slider, "vid_gamma");
UI_MenuSpinControl_SaveValue (&s_texfilter_box, "r_texturemode");
UI_MenuSpinControl_SaveValue (&s_aniso_box, "r_anisotropic");
UI_MenuSpinControl_SaveValue (&s_texqual_box, "r_picmip");
UI_MenuSpinControl_SaveValue (&s_npot_mipmap_box, "r_nonpoweroftwo_mipmaps");
UI_MenuSpinControl_SaveValue (&s_sgis_mipmap_box, "r_sgis_generatemipmap");
// UI_MenuSpinControl_SaveValue (&s_texcompress_box, "r_ext_texture_compression");
UI_MenuSpinControl_SaveValue (&s_vsync_box, "r_swapinterval");
UI_MenuSpinControl_SaveValue (&s_refresh_box, "r_displayrefresh");
UI_MenuSpinControl_SaveValue (&s_adjust_fov_box, "cl_widescreen_fov");
UI_MenuSpinControl_SaveValue (&s_async_box, "cl_async");
if (s_texfilter_box.curvalue == 0)
Cvar_Set("r_texturemode", "GL_LINEAR_MIPMAP_NEAREST");
else if (s_texfilter_box.curvalue == 1)
Cvar_Set("r_texturemode", "GL_LINEAR_MIPMAP_LINEAR");
switch ((int)s_aniso_box.curvalue)
{
case 1: Cvar_SetValue( "r_anisotropic", 2.0 ); break;
case 2: Cvar_SetValue( "r_anisotropic", 4.0 ); break;
case 3: Cvar_SetValue( "r_anisotropic", 8.0 ); break;
case 4: Cvar_SetValue( "r_anisotropic", 16.0 ); break;
default:
case 0: Cvar_SetValue( "r_anisotropic", 0.0 ); break;
}
Cvar_SetValue( "r_nonpoweroftwo_mipmaps", s_npot_mipmap_box.curvalue );
Cvar_SetValue( "r_sgis_generatemipmap", s_sgis_mipmap_box.curvalue );
// Cvar_SetValue( "r_ext_texture_compression", s_texcompress_box.curvalue );
Cvar_SetValue( "r_swapinterval", s_vsync_box.curvalue );
Cvar_SetValue( "cl_widescreen_fov", s_adjust_fov_box.curvalue );
Cvar_SetValue( "cl_async", s_async_box.curvalue );
Menu_PrepareVideoRefresh ();
M_PrepareVideoRefresh ();
// UI_ForceMenuOff();
}
// Knightmare added
int Menu_GetTexfilterCurValue (void)
{
char *texmode = Cvar_VariableString("r_texturemode");
if (!Q_strcasecmp(texmode, "GL_LINEAR_MIPMAP_NEAREST"))
return 0;
else
return 1;
}
// Knightmare- refresh rate option
int Menu_GetRefreshCurValue (void)
{
int refreshVar = Cvar_VariableInteger ("r_displayrefresh");
if (refreshVar == 240)
return 14;
else if (refreshVar == 180)
return 13;
else if (refreshVar == 165)
return 12;
else if (refreshVar == 160)
return 11;
else if (refreshVar == 150)
return 10;
else if (refreshVar == 144)
return 9;
else if (refreshVar == 120)
return 8;
else if (refreshVar == 110)
return 7;
else if (refreshVar == 100)
return 6;
else if (refreshVar == 85)
return 5;
else if (refreshVar == 75)
return 4;
else if (refreshVar == 72)
return 3;
else if (refreshVar == 70)
return 2;
else if (refreshVar == 60)
return 1;
else
return 0;
}
// Knightmare- anisotropic option
float Menu_GetAnisoCurValue (void)
{
float aniso_avail = Cvar_VariableValue("r_anisotropic_avail");
float anisoValue = ClampCvar (0, aniso_avail, Cvar_VariableValue("r_anisotropic"));
if (aniso_avail == 0) // not available
return 0;
if (anisoValue < 2.0)
return 0;
else if (anisoValue < 4.0)
return 1;
else if (anisoValue < 8.0)
return 2;
else if (anisoValue < 16.0)
return 3;
else // >= 16.0
return 4;
}
/*
================
Menu_Video_Init
@ -334,6 +211,12 @@ Menu_Video_Init
*/
void Menu_Video_Init (void)
{
static const char *yesno_names[] =
{
"no",
"yes",
0
};
static const char *fullscreen_names[] =
{
"windowed",
@ -360,18 +243,37 @@ void Menu_Video_Init (void)
"[240Hz ]",
0
};
static const char *yesno_names[] =
static const char *refreshrate_values[] =
{
"no",
"yes",
"0",
"60",
"70",
"72",
"75",
"85",
"100",
"110",
"120",
"144",
"150",
"160",
"165",
"180",
"240",
0
};
static const char *mip_names[] =
static const char *texfilter_names[] =
{
"bilinear",
"trilinear",
0
};
static const char *texfilter_values[] =
{
"GL_LINEAR_MIPMAP_NEAREST",
"GL_LINEAR_MIPMAP_LINEAR",
0
};
static const char *lmh_names[] =
{
"lowest",
@ -381,9 +283,17 @@ void Menu_Video_Init (void)
"highest",
0
};
static const char *lmh_values[] =
{
"4",
"3",
"2",
"1",
"0",
0
};
int y = 0;
char *customStr;
qboolean customHidden;
if ( !con_font_size )
con_font_size = Cvar_Get ("con_font_size", "8", CVAR_ARCHIVE);
@ -398,22 +308,22 @@ void Menu_Video_Init (void)
s_mode_list.generic.name = "video mode";
s_mode_list.generic.x = 0;
s_mode_list.generic.y = y;
s_mode_list.itemnames = ui_resolution_names;
s_mode_list.itemNames = ui_resolution_names;
s_mode_list.itemValues = ui_video_modes;
s_mode_list.generic.callback = VidModeCallback;
s_mode_list.curvalue = UI_GetIndexForStringValue(ui_video_modes, Cvar_VariableString("r_mode"));
s_mode_list.generic.statusbar = "changes screen resolution";
UI_MenuSpinControl_SetValue (&s_mode_list, "r_mode", 0, 0, false);
customHidden = (strcmp(ui_video_modes[s_mode_list.curvalue], "-1") != 0);
s_customwidth_title.generic.type = MTYPE_SEPARATOR;
s_customwidth_title.generic.textSize = MENU_FONT_SIZE;
s_customwidth_title.generic.flags = customHidden ? QMF_HIDDEN : 0;
s_customwidth_title.generic.flags = 0;
s_customwidth_title.generic.name = "custom width";
s_customwidth_title.generic.x = -2*MENU_FONT_SIZE;
s_customwidth_title.generic.y = y += 1.5*MENU_LINE_SIZE;
s_customwidth_field.generic.type = MTYPE_FIELD;
s_customwidth_field.generic.textSize = MENU_FONT_SIZE;
s_customwidth_field.generic.flags = customHidden ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
s_customwidth_field.generic.flags = QMF_NUMBERSONLY;
// s_customwidth_field.generic.name = "custom width";
s_customwidth_field.generic.callback = 0;
s_customwidth_field.generic.x = -14*MENU_FONT_SIZE;
@ -426,14 +336,14 @@ void Menu_Video_Init (void)
s_customheight_title.generic.type = MTYPE_SEPARATOR;
s_customheight_title.generic.textSize = MENU_FONT_SIZE;
s_customheight_title.generic.flags = customHidden ? QMF_HIDDEN : 0;
s_customheight_title.generic.flags = 0;
s_customheight_title.generic.name = "custom height";
s_customheight_title.generic.x = 14.5*MENU_FONT_SIZE;
s_customheight_title.generic.y = y;
s_customheight_field.generic.type = MTYPE_FIELD;
s_customheight_field.generic.textSize = MENU_FONT_SIZE;
s_customheight_field.generic.flags = customHidden ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
s_customheight_field.generic.flags = QMF_NUMBERSONLY;
// s_customheight_field.generic.name = "custom height";
s_customheight_field.generic.callback = 0;
s_customheight_field.generic.x = 2*MENU_FONT_SIZE;
@ -449,10 +359,10 @@ void Menu_Video_Init (void)
s_fs_box.generic.x = 0;
s_fs_box.generic.y = y += 3.5*MENU_LINE_SIZE;
s_fs_box.generic.name = "display type"; // "fullscreen"
s_fs_box.itemnames = fullscreen_names; // yesno_names
s_fs_box.curvalue = Cvar_VariableValue("vid_fullscreen");
s_fs_box.itemNames = fullscreen_names;
// s_fs_box.generic.statusbar = "changes bettween fullscreen and windowed display";
s_fs_box.generic.statusbar = "changes bettween fullscreen, borderless window, and windowed display";
UI_MenuSpinControl_SetValue (&s_fs_box, "vid_fullscreen", 0, 2, true);
s_brightness_slider.generic.type = MTYPE_SLIDER;
s_brightness_slider.generic.textSize = MENU_FONT_SIZE;
@ -464,62 +374,66 @@ void Menu_Video_Init (void)
s_brightness_slider.baseValue = 1.3f;
s_brightness_slider.increment = -0.05f;
s_brightness_slider.displayAsPercent = false;
UI_MenuSlider_SetValue (&s_brightness_slider, Cvar_VariableValue("vid_gamma"));
s_brightness_slider.generic.statusbar = "changes display brightness";
UI_MenuSlider_SetValue (&s_brightness_slider, "vid_gamma", 0.3f, 1.3f, true);
s_texfilter_box.generic.type = MTYPE_SPINCONTROL;
s_texfilter_box.generic.textSize = MENU_FONT_SIZE;
s_texfilter_box.generic.x = 0;
s_texfilter_box.generic.y = y += 2*MENU_LINE_SIZE;
s_texfilter_box.generic.name = "texture filter";
s_texfilter_box.curvalue = Menu_GetTexfilterCurValue();
s_texfilter_box.itemnames = mip_names;
s_texfilter_box.itemNames = texfilter_names;
s_texfilter_box.itemValues = texfilter_values;
s_texfilter_box.generic.statusbar = "changes texture filtering mode";
UI_MenuSpinControl_SetValue (&s_texfilter_box, "r_texturemode", 0, 0, false);
s_aniso_box.generic.type = MTYPE_SPINCONTROL;
s_aniso_box.generic.textSize = MENU_FONT_SIZE;
s_aniso_box.generic.x = 0;
s_aniso_box.generic.y = y += MENU_LINE_SIZE;
s_aniso_box.generic.name = "anisotropic filter";
s_aniso_box.curvalue = Menu_GetAnisoCurValue();
s_aniso_box.itemnames = ui_aniso_names;
s_aniso_box.itemNames = ui_aniso_names;
s_aniso_box.itemValues = ui_aniso_values;
s_aniso_box.generic.callback = AnisoCallback;
s_aniso_box.generic.statusbar = "changes level of anisotropic mipmap filtering";
UI_MenuSpinControl_SetValue (&s_aniso_box, "r_anisotropic", 0, 0, false);
s_texqual_box.generic.type = MTYPE_SPINCONTROL;
s_texqual_box.generic.textSize = MENU_FONT_SIZE;
s_texqual_box.generic.x = 0;
s_texqual_box.generic.y = y += MENU_LINE_SIZE;
s_texqual_box.generic.name = "texture quality";
s_texqual_box.curvalue = ClampCvar (0, 4, 4-Cvar_VariableValue("r_picmip"));
s_texqual_box.itemnames = lmh_names;
s_texqual_box.itemNames = lmh_names;
s_texqual_box.itemValues = lmh_values;
s_texqual_box.generic.statusbar = "changes maximum texture size (highest = no limit)";
UI_MenuSpinControl_SetValue (&s_texqual_box, "r_picmip", 0, 0, false);
s_npot_mipmap_box.generic.type = MTYPE_SPINCONTROL;
s_npot_mipmap_box.generic.textSize = MENU_FONT_SIZE;
s_npot_mipmap_box.generic.x = 0;
s_npot_mipmap_box.generic.y = y += MENU_LINE_SIZE;
s_npot_mipmap_box.generic.name = "non-power-of-2 mipmaps";
s_npot_mipmap_box.itemnames = yesno_names;
s_npot_mipmap_box.curvalue = Cvar_VariableValue("r_nonpoweroftwo_mipmaps");
s_npot_mipmap_box.itemNames = yesno_names;
s_npot_mipmap_box.generic.statusbar = "enables non-power-of-2 mipmapped textures (requires driver support)";
UI_MenuSpinControl_SetValue (&s_npot_mipmap_box, "r_nonpoweroftwo_mipmaps", 0, 1, true);
s_sgis_mipmap_box.generic.type = MTYPE_SPINCONTROL;
s_sgis_mipmap_box.generic.textSize = MENU_FONT_SIZE;
s_sgis_mipmap_box.generic.x = 0;
s_sgis_mipmap_box.generic.y = y += MENU_LINE_SIZE;
s_sgis_mipmap_box.generic.name = "SGIS mipmaps";
s_sgis_mipmap_box.itemnames = yesno_names;
s_sgis_mipmap_box.curvalue = Cvar_VariableValue("r_sgis_generatemipmap");
s_sgis_mipmap_box.itemNames = yesno_names;
s_sgis_mipmap_box.generic.statusbar = "enables driver-based mipmap generation";
UI_MenuSpinControl_SetValue (&s_sgis_mipmap_box, "r_sgis_generatemipmap", 0, 1, true);
/*
s_texcompress_box.generic.type = MTYPE_SPINCONTROL;
s_texcompress_box.generic.textSize = MENU_FONT_SIZE;
s_texcompress_box.generic.x = 0;
s_texcompress_box.generic.y = y += MENU_LINE_SIZE;
s_texcompress_box.generic.name = "texture compression";
s_texcompress_box.curvalue = Cvar_VariableValue("r_ext_texture_compression");
s_texcompress_box.itemnames = yesno_names;
s_texcompress_box.itemNames = yesno_names;
s_texcompress_box.generic.statusbar = "reduces quality, increases performance (leave off unless needed)";
UI_MenuSpinControl_SetValue (&s_texcompress_box, "r_ext_texture_compression", 0, 1, true);
*/
s_vsync_box.generic.type = MTYPE_SPINCONTROL;
s_vsync_box.generic.textSize = MENU_FONT_SIZE;
@ -527,9 +441,9 @@ void Menu_Video_Init (void)
s_vsync_box.generic.y = y += 2*MENU_LINE_SIZE;
s_vsync_box.generic.name = "video sync";
s_vsync_box.generic.callback = VsyncCallback;
s_vsync_box.curvalue = Cvar_VariableValue("r_swapinterval");
s_vsync_box.itemnames = yesno_names;
s_vsync_box.itemNames = yesno_names;
s_vsync_box.generic.statusbar = "sync framerate with monitor refresh";
UI_MenuSpinControl_SetValue (&s_vsync_box, "r_swapinterval", 0, 1, true);
// Knightmare- refresh rate option
s_refresh_box.generic.type = MTYPE_SPINCONTROL;
@ -537,9 +451,10 @@ void Menu_Video_Init (void)
s_refresh_box.generic.x = 0;
s_refresh_box.generic.y = y += MENU_LINE_SIZE;
s_refresh_box.generic.name = "refresh rate";
s_refresh_box.curvalue = Menu_GetRefreshCurValue();
s_refresh_box.itemnames = refreshrate_names;
s_refresh_box.itemNames = refreshrate_names;
s_refresh_box.itemValues = refreshrate_values;
s_refresh_box.generic.statusbar = "sets refresh rate for fullscreen modes";
UI_MenuSpinControl_SetValue (&s_refresh_box, "r_displayrefresh", 0, 0, false);
s_adjust_fov_box.generic.type = MTYPE_SPINCONTROL;
s_adjust_fov_box.generic.textSize = MENU_FONT_SIZE;
@ -547,9 +462,9 @@ void Menu_Video_Init (void)
s_adjust_fov_box.generic.y = y += MENU_LINE_SIZE;
s_adjust_fov_box.generic.name = "fov autoscaling";
s_adjust_fov_box.generic.callback = AdjustFOVCallback;
s_adjust_fov_box.curvalue = Cvar_VariableValue("cl_widescreen_fov");
s_adjust_fov_box.itemnames = yesno_names;
s_adjust_fov_box.itemNames = yesno_names;
s_adjust_fov_box.generic.statusbar = "automatic scaling of fov for widescreen modes";
UI_MenuSpinControl_SetValue (&s_adjust_fov_box, "cl_widescreen_fov", 0, 1, true);
s_async_box.generic.type = MTYPE_SPINCONTROL;
s_async_box.generic.textSize = MENU_FONT_SIZE;
@ -557,23 +472,23 @@ void Menu_Video_Init (void)
s_async_box.generic.y = y += MENU_LINE_SIZE;
s_async_box.generic.name = "async refresh";
s_async_box.generic.callback = AsyncCallback;
s_async_box.curvalue = Cvar_VariableValue("cl_async");
s_async_box.itemnames = yesno_names;
s_async_box.itemNames = yesno_names;
s_async_box.generic.statusbar = "decouples network framerate from render framerate";
UI_MenuSpinControl_SetValue (&s_async_box, "cl_async", 0, 1, true);
s_advanced_action.generic.type = MTYPE_ACTION;
s_advanced_action.generic.textSize = MENU_FONT_SIZE;
s_advanced_action.generic.name = "advanced options";
s_advanced_action.generic.x = 0;
s_advanced_action.generic.y = y += 3*MENU_LINE_SIZE;
s_advanced_action.generic.callback = AdvancedOptions;
s_advanced_action.generic.callback = M_AdvancedOptions;
s_defaults_action.generic.type = MTYPE_ACTION;
s_defaults_action.generic.textSize = MENU_FONT_SIZE;
s_defaults_action.generic.name = "reset to defaults";
s_defaults_action.generic.x = 0;
s_defaults_action.generic.y = y += 3*MENU_LINE_SIZE;
s_defaults_action.generic.callback = ResetVideoDefaults;
s_defaults_action.generic.callback = M_ResetVideoDefaults;
s_defaults_action.generic.statusbar = "resets all video settings to internal defaults";
// changed cancel to apply changes, thanx to MrG
@ -582,7 +497,7 @@ void Menu_Video_Init (void)
s_apply_action.generic.name = "apply changes";
s_apply_action.generic.x = 0;
s_apply_action.generic.y = y += 2*MENU_LINE_SIZE;
s_apply_action.generic.callback = Menu_ApplyVideoChanges;
s_apply_action.generic.callback = M_ApplyVideoChanges;
s_backmain_action.generic.type = MTYPE_ACTION;
s_backmain_action.generic.textSize = MENU_FONT_SIZE;
@ -653,4 +568,5 @@ void Menu_Video_f (void)
{
Menu_Video_Init ();
UI_PushMenu (Menu_Video_Draw, Menu_Video_Key);
M_ShowCustomFields ();
}

View file

@ -70,224 +70,164 @@ static menulist_s s_upscale_font_box;
static menuaction_s s_advanced_apply_action;
static menuaction_s s_back_action;
//=======================================================================
static void Video_Advanced_MenuSetValues (void)
{
char *sshotformat;
Cvar_SetValue ("r_modulate", ClampCvar( 1, 2, Cvar_VariableValue("r_modulate") ));
UI_MenuSlider_SetValue (&s_lightmapscale_slider, Cvar_VariableValue("r_modulate"));
Cvar_SetValue ("r_intensity", ClampCvar( 1, 2, Cvar_VariableValue("r_intensity") ));
UI_MenuSlider_SetValue (&s_textureintensity_slider, Cvar_VariableValue("r_intensity"));
Cvar_SetValue ("r_rgbscale", ClampCvar( 1, 2, Cvar_VariableValue("r_rgbscale") ));
if (Cvar_VariableValue("r_rgbscale") == 1)
s_rgbscale_box.curvalue = 0;
else
s_rgbscale_box.curvalue = 1;
Cvar_SetValue ("r_trans_lighting", ClampCvar( 0, 2, Cvar_VariableValue("r_trans_lighting") ));
s_trans_lighting_box.curvalue = Cvar_VariableValue("r_trans_lighting");
Cvar_SetValue ("r_warp_lighting", ClampCvar( 0, 1, Cvar_VariableValue("r_warp_lighting") ));
s_warp_lighting_box.curvalue = Cvar_VariableValue("r_warp_lighting");
Cvar_SetValue ("r_lightcutoff", ClampCvar( 0, 64, Cvar_VariableValue("r_lightcutoff") ));
UI_MenuSlider_SetValue (&s_lightcutoff_slider, Cvar_VariableValue("r_lightcutoff"));
Cvar_SetValue ("r_glass_envmaps", ClampCvar( 0, 1, Cvar_VariableValue("r_glass_envmaps") ));
s_glass_envmap_box.curvalue = Cvar_VariableValue("r_glass_envmaps");
Cvar_SetValue ("r_solidalpha", ClampCvar( 0, 1, Cvar_VariableValue("r_solidalpha") ));
s_solidalpha_box.curvalue = Cvar_VariableValue("r_solidalpha");
Cvar_SetValue ("r_pixel_shader_warp", ClampCvar( 0, 1, Cvar_VariableValue("r_pixel_shader_warp") ));
s_texshader_warp_box.curvalue = Cvar_VariableValue("r_pixel_shader_warp");
Cvar_SetValue ("r_waterwave", ClampCvar( 0, 24, Cvar_VariableValue("r_waterwave") ));
UI_MenuSlider_SetValue (&s_waterwave_slider, Cvar_VariableValue("r_waterwave"));
Cvar_SetValue ("r_caustics", ClampCvar( 0, 2, Cvar_VariableValue("r_caustics") ));
s_caustics_box.curvalue = Cvar_VariableValue("r_caustics");
Cvar_SetValue ("r_particle_overdraw", ClampCvar( 0, 1, Cvar_VariableValue("r_particle_overdraw") ));
s_particle_overdraw_box.curvalue = Cvar_VariableValue("r_particle_overdraw");
Cvar_SetValue ("r_bloom", ClampCvar( 0, 1, Cvar_VariableValue("r_bloom") ));
s_lightbloom_box.curvalue = Cvar_VariableValue("r_bloom");
Cvar_SetValue ("r_model_shading", ClampCvar( 0, 3, Cvar_VariableValue("r_model_shading") ));
s_modelshading_box.curvalue = Cvar_VariableValue("r_model_shading");
Cvar_SetValue ("r_shadows", ClampCvar( 0, 3, Cvar_VariableValue("r_shadows") ));
s_shadows_box.curvalue = Cvar_VariableValue("r_shadows");
Cvar_SetValue ("r_stencilTwoSide", ClampCvar( 0, 1, Cvar_VariableValue("r_stencilTwoSide") ));
s_two_side_stencil_box.curvalue = Cvar_VariableValue("r_stencilTwoSide");
Cvar_SetValue ("r_shelltype", ClampCvar( 0, 2, Cvar_VariableValue("r_shelltype") ));
s_ent_shell_box.curvalue = Cvar_VariableValue("r_shelltype");
Cvar_SetValue ("r_celshading", ClampCvar( 0, 1, Cvar_VariableValue("r_celshading") ));
s_celshading_box.curvalue = Cvar_VariableValue("r_celshading");
Cvar_SetValue ("r_celshading_width", ClampCvar( 1, 12, Cvar_VariableValue("r_celshading_width") ));
UI_MenuSlider_SetValue (&s_celshading_width_slider, Cvar_VariableValue("r_celshading_width"));
sshotformat = Cvar_VariableString("r_screenshot_format");
if ( !Q_strcasecmp(sshotformat, "jpg") )
s_screenshotformat_box.curvalue = 0;
else if ( !Q_strcasecmp(sshotformat, "png") )
s_screenshotformat_box.curvalue = 1;
else // tga
s_screenshotformat_box.curvalue = 2;
Cvar_SetValue ("r_screenshot_jpeg_quality", ClampCvar( 50, 100, Cvar_VariableValue("r_screenshot_jpeg_quality") ));
UI_MenuSlider_SetValue (&s_screenshotjpegquality_slider, Cvar_VariableValue("r_screenshot_jpeg_quality"));
Cvar_SetValue ("r_saveshotsize", ClampCvar( 0, 1, Cvar_VariableValue("r_saveshotsize") ));
s_saveshotsize_box.curvalue = Cvar_VariableValue("r_saveshotsize");
Cvar_SetValue ("r_font_upscale", ClampCvar( 0, 2, Cvar_VariableValue("r_font_upscale") ));
s_upscale_font_box.curvalue = Cvar_VariableValue("r_font_upscale");
}
static void LightMapScaleCallback (void *unused)
{
Cvar_SetValue ("r_modulate", UI_MenuSlider_GetValue(&s_lightmapscale_slider) );
UI_MenuSlider_SaveValue (&s_lightmapscale_slider, "r_modulate");
}
static void TextureIntensCallback (void *unused)
{
Cvar_SetValue ("r_intensity", UI_MenuSlider_GetValue(&s_textureintensity_slider));
UI_MenuSlider_SaveValue (&s_textureintensity_slider, "r_intensity");
}
static void RGBSCaleCallback (void *unused)
{
Cvar_SetValue ("r_rgbscale", s_rgbscale_box.curvalue + 1);
UI_MenuSpinControl_SaveValue (&s_rgbscale_box, "r_rgbscale");
}
static void TransLightingCallback (void *unused)
{
Cvar_SetValue ("r_trans_lighting", s_trans_lighting_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_trans_lighting_box, "r_trans_lighting");
}
static void WarpLightingCallback (void *unused)
{
Cvar_SetValue ("r_warp_lighting", s_warp_lighting_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_warp_lighting_box, "r_warp_lighting");
}
static void LightCutoffCallback(void *unused)
{
Cvar_SetValue ("r_lightcutoff", UI_MenuSlider_GetValue(&s_lightcutoff_slider));
UI_MenuSlider_SaveValue (&s_lightcutoff_slider, "r_lightcutoff");
}
static void GlassEnvmapCallback (void *unused)
{
Cvar_SetValue ("r_glass_envmaps", s_glass_envmap_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_glass_envmap_box, "r_glass_envmaps");
}
static void SolidAlphaCallback (void *unused)
{
Cvar_SetValue ("r_solidalpha", s_solidalpha_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_solidalpha_box, "r_solidalpha");
}
static void TexShaderWarpCallback (void *unused)
{
Cvar_SetValue ("r_pixel_shader_warp", s_texshader_warp_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_texshader_warp_box, "r_pixel_shader_warp");
}
static void WaterWaveCallback (void *unused)
{
Cvar_SetValue ("r_waterwave", UI_MenuSlider_GetValue(&s_waterwave_slider));
UI_MenuSlider_SaveValue (&s_waterwave_slider, "r_waterwave");
}
static void CausticsCallback (void *unused)
{
Cvar_SetValue ("r_caustics", s_caustics_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_caustics_box, "r_caustics");
}
static void ParticleOverdrawCallback(void *unused)
{
Cvar_SetValue ("r_particle_overdraw", s_particle_overdraw_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_particle_overdraw_box, "r_particle_overdraw");
}
static void LightBloomCallback(void *unused)
{
Cvar_SetValue ("r_bloom", s_lightbloom_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_lightbloom_box, "r_bloom");
}
static void ModelShadingCallback (void *unused)
{
Cvar_SetValue ("r_model_shading", s_modelshading_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_modelshading_box, "r_model_shading");
}
static void ShadowsCallback (void *unused)
{
Cvar_SetValue ("r_shadows", s_shadows_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_shadows_box, "r_shadows");
}
static void TwoSideStencilCallback (void *unused)
{
Cvar_SetValue ("r_stencilTwoSide", s_two_side_stencil_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_two_side_stencil_box, "r_stencilTwoSide");
}
static void EntShellCallback (void *unused)
{
Cvar_SetValue ("r_shelltype", s_ent_shell_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_ent_shell_box, "r_shelltype");
}
static void CelShadingCallback (void *unused)
{
Cvar_SetValue ("r_celshading", s_celshading_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_celshading_box, "r_celshading");
}
static void CelShadingWidthCallback (void *unused)
{
Cvar_SetValue ("r_celshading_width", UI_MenuSlider_GetValue(&s_celshading_width_slider));
UI_MenuSlider_SaveValue (&s_celshading_width_slider, "r_celshading_width");
}
static void ScreenshotFormatCallback (void *unused)
{
switch (s_screenshotformat_box.curvalue)
{
case 0:
Cvar_Set( "r_screenshot_format", "jpg");
break;
case 1:
Cvar_Set( "r_screenshot_format", "png");
break;
case 2:
default:
Cvar_Set( "r_screenshot_format", "tga");
break;
}
UI_MenuSpinControl_SaveValue (&s_screenshotformat_box, "r_screenshot_format");
}
static void JPEGScreenshotQualityCallback (void *unused)
{
// Cvar_SetValue ("r_screenshot_jpeg_quality", (s_screenshotjpegquality_slider.curvalue * 5 + 50));
Cvar_SetValue ("r_screenshot_jpeg_quality", UI_MenuSlider_GetValue(&s_screenshotjpegquality_slider));
UI_MenuSlider_SaveValue (&s_screenshotjpegquality_slider, "r_screenshot_jpeg_quality");
}
static void SaveshotSizeCallback (void *unused)
{
Cvar_SetValue ("r_saveshotsize", s_saveshotsize_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_saveshotsize_box, "r_saveshotsize");
}
static void UpscaleFontCallback (void *unused)
{
Cvar_SetValue ("r_font_upscale", s_upscale_font_box.curvalue);
UI_MenuSpinControl_SaveValue (&s_upscale_font_box, "r_font_upscale");
}
static void AdvancedMenuApplyChanges (void *unused)
//=======================================================================
static void M_AdvancedVideo_MenuSetValues (void)
{
UI_MenuSlider_SetValue (&s_lightmapscale_slider, "r_modulate", 1, 2, true);
UI_MenuSlider_SetValue (&s_textureintensity_slider, "r_intensity", 1, 2, true);
UI_MenuSpinControl_SetValue (&s_rgbscale_box, "r_rgbscale", 1, 4, true);
UI_MenuSpinControl_SetValue (&s_trans_lighting_box, "r_trans_lighting", 0, 2, true);
UI_MenuSpinControl_SetValue (&s_warp_lighting_box, "r_warp_lighting", 0, 1, true);
UI_MenuSlider_SetValue (&s_lightcutoff_slider, "r_lightcutoff", 0, 64, true);
UI_MenuSpinControl_SetValue (&s_glass_envmap_box, "r_glass_envmaps", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_solidalpha_box, "r_solidalpha", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_texshader_warp_box, "r_pixel_shader_warp", 0, 1, true);
UI_MenuSlider_SetValue (&s_waterwave_slider, "r_waterwave", 0, 24, true);
UI_MenuSpinControl_SetValue (&s_caustics_box, "r_caustics", 0, 2, true);
UI_MenuSpinControl_SetValue (&s_particle_overdraw_box, "r_particle_overdraw", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_lightbloom_box, "r_bloom", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_modelshading_box, "r_model_shading", 0, 3, true);
UI_MenuSpinControl_SetValue (&s_shadows_box, "r_shadows", 0, 3, true);
UI_MenuSpinControl_SetValue (&s_two_side_stencil_box, "r_stencilTwoSide", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_ent_shell_box, "r_shelltype", 0, 2, true);
UI_MenuSpinControl_SetValue (&s_celshading_box, "r_celshading", 0, 1, true);
UI_MenuSlider_SetValue (&s_celshading_width_slider, "r_celshading_width", 1, 12, true);
UI_MenuSpinControl_SetValue (&s_screenshotformat_box, "r_screenshot_format", 0, 2, false);
UI_MenuSlider_SetValue (&s_screenshotjpegquality_slider, "r_screenshot_jpeg_quality", 50, 100, true);
UI_MenuSpinControl_SetValue (&s_saveshotsize_box, "r_saveshotsize", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_upscale_font_box, "r_font_upscale", 0, 2, true);
}
static void M_AdvancedMenuApplyChanges (void *unused)
{
// update for modified r_intensity and r_stencilTwoSide
if ( r_intensity->modified || r_font_upscale->modified )
vid_ref->modified = true;
}
//=======================================================================
/*
================
Menu_Video_Advanced_Init
@ -301,6 +241,20 @@ void Menu_Video_Advanced_Init (void)
"yes",
0
};
static const char *rgbscale_names[] =
{
"1x",
"2x",
"4x",
0
};
static const char *rgbscale_values[] =
{
"1",
"2",
"4",
0
};
static const char *lighting_names[] =
{
"no",
@ -351,6 +305,13 @@ void Menu_Video_Advanced_Init (void)
"TGA",
0
};
static const char *screenshotformat_values[] =
{
"jpg",
"png",
"tga",
0
};
static const char *font_upscale_names[] =
{
"no",
@ -401,9 +362,10 @@ void Menu_Video_Advanced_Init (void)
s_rgbscale_box.generic.textSize = MENU_FONT_SIZE;
s_rgbscale_box.generic.x = 0;
s_rgbscale_box.generic.y = y += MENU_LINE_SIZE;
s_rgbscale_box.generic.name = "RGB enhance";
s_rgbscale_box.generic.name = "RGB enhance factor";
s_rgbscale_box.generic.callback = RGBSCaleCallback;
s_rgbscale_box.itemnames = yesno_names;
s_rgbscale_box.itemNames = rgbscale_names;
s_rgbscale_box.itemValues = rgbscale_values;
s_rgbscale_box.generic.statusbar = "brightens textures without washing them out";
s_trans_lighting_box.generic.type = MTYPE_SPINCONTROL;
@ -412,7 +374,7 @@ void Menu_Video_Advanced_Init (void)
s_trans_lighting_box.generic.y = y += MENU_LINE_SIZE;
s_trans_lighting_box.generic.name = "translucent lighting";
s_trans_lighting_box.generic.callback = TransLightingCallback;
s_trans_lighting_box.itemnames = lighting_names;
s_trans_lighting_box.itemNames = lighting_names;
s_trans_lighting_box.generic.statusbar = "lighting on translucent surfaces";
s_warp_lighting_box.generic.type = MTYPE_SPINCONTROL;
@ -421,7 +383,7 @@ void Menu_Video_Advanced_Init (void)
s_warp_lighting_box.generic.y = y += MENU_LINE_SIZE;
s_warp_lighting_box.generic.name = "warp surface lighting";
s_warp_lighting_box.generic.callback = WarpLightingCallback;
s_warp_lighting_box.itemnames = yesno_names;
s_warp_lighting_box.itemNames = yesno_names;
s_warp_lighting_box.generic.statusbar = "vertex lighting on water and other warping surfaces";
s_lightcutoff_slider.generic.type = MTYPE_SLIDER;
@ -442,7 +404,7 @@ void Menu_Video_Advanced_Init (void)
s_glass_envmap_box.generic.y = y += MENU_LINE_SIZE;
s_glass_envmap_box.generic.name = "glass envmaps";
s_glass_envmap_box.generic.callback = GlassEnvmapCallback;
s_glass_envmap_box.itemnames = yesno_names;
s_glass_envmap_box.itemNames = yesno_names;
s_glass_envmap_box.generic.statusbar = "enable environment mapping on transparent surfaces";
s_solidalpha_box.generic.type = MTYPE_SPINCONTROL;
@ -451,7 +413,7 @@ void Menu_Video_Advanced_Init (void)
s_solidalpha_box.generic.y = y += MENU_LINE_SIZE;
s_solidalpha_box.generic.name = "solid alphas";
s_solidalpha_box.generic.callback = SolidAlphaCallback;
s_solidalpha_box.itemnames = yesno_names;
s_solidalpha_box.itemNames = yesno_names;
s_solidalpha_box.generic.statusbar = "enable solid drawing of trans33 + trans66 surfaces";
s_texshader_warp_box.generic.type = MTYPE_SPINCONTROL;
@ -460,7 +422,7 @@ void Menu_Video_Advanced_Init (void)
s_texshader_warp_box.generic.y = y += MENU_LINE_SIZE;
s_texshader_warp_box.generic.name = "texture shader warp";
s_texshader_warp_box.generic.callback = TexShaderWarpCallback;
s_texshader_warp_box.itemnames = ifsupported_names;
s_texshader_warp_box.itemNames = ifsupported_names;
s_texshader_warp_box.generic.statusbar = "enables hardware water warping effect";
s_waterwave_slider.generic.type = MTYPE_SLIDER;
@ -481,7 +443,7 @@ void Menu_Video_Advanced_Init (void)
s_caustics_box.generic.y = y += MENU_LINE_SIZE;
s_caustics_box.generic.name = "underwater caustics";
s_caustics_box.generic.callback = CausticsCallback;
s_caustics_box.itemnames = caustics_names;
s_caustics_box.itemNames = caustics_names;
s_caustics_box.generic.statusbar = "caustic effect on underwater surfaces";
s_particle_overdraw_box.generic.type = MTYPE_SPINCONTROL;
@ -490,7 +452,7 @@ void Menu_Video_Advanced_Init (void)
s_particle_overdraw_box.generic.y = y += 2*MENU_LINE_SIZE;
s_particle_overdraw_box.generic.name = "particle overdraw";
s_particle_overdraw_box.generic.callback = ParticleOverdrawCallback;
s_particle_overdraw_box.itemnames = yesno_names;
s_particle_overdraw_box.itemNames = yesno_names;
s_particle_overdraw_box.generic.statusbar = "redraw particles over trans surfaces";
s_lightbloom_box.generic.type = MTYPE_SPINCONTROL;
@ -499,7 +461,7 @@ void Menu_Video_Advanced_Init (void)
s_lightbloom_box.generic.y = y += MENU_LINE_SIZE;
s_lightbloom_box.generic.name = "light blooms";
s_lightbloom_box.generic.callback = LightBloomCallback;
s_lightbloom_box.itemnames = yesno_names;
s_lightbloom_box.itemNames = yesno_names;
s_lightbloom_box.generic.statusbar = "enables blooming of bright lights";
s_modelshading_box.generic.type = MTYPE_SPINCONTROL;
@ -508,7 +470,7 @@ void Menu_Video_Advanced_Init (void)
s_modelshading_box.generic.y = y += MENU_LINE_SIZE;
s_modelshading_box.generic.name = "model shading";
s_modelshading_box.generic.callback = ModelShadingCallback;
s_modelshading_box.itemnames = shading_names;
s_modelshading_box.itemNames = shading_names;
s_modelshading_box.generic.statusbar = "level of shading to use on models";
s_shadows_box.generic.type = MTYPE_SPINCONTROL;
@ -517,7 +479,7 @@ void Menu_Video_Advanced_Init (void)
s_shadows_box.generic.y = y += MENU_LINE_SIZE;
s_shadows_box.generic.name = "entity shadows";
s_shadows_box.generic.callback = ShadowsCallback;
s_shadows_box.itemnames = shadow_names;
s_shadows_box.itemNames = shadow_names;
s_shadows_box.generic.statusbar = "type of model shadows to draw";
s_two_side_stencil_box.generic.type = MTYPE_SPINCONTROL;
@ -526,7 +488,7 @@ void Menu_Video_Advanced_Init (void)
s_two_side_stencil_box.generic.y = y += MENU_LINE_SIZE;
s_two_side_stencil_box.generic.name = "two-sided stenciling";
s_two_side_stencil_box.generic.callback = TwoSideStencilCallback;
s_two_side_stencil_box.itemnames = ifsupported_names;
s_two_side_stencil_box.itemNames = ifsupported_names;
s_two_side_stencil_box.generic.statusbar = "use single-pass shadow stenciling";
s_ent_shell_box.generic.type = MTYPE_SPINCONTROL;
@ -535,7 +497,7 @@ void Menu_Video_Advanced_Init (void)
s_ent_shell_box.generic.y = y += MENU_LINE_SIZE;
s_ent_shell_box.generic.name = "entity shell type";
s_ent_shell_box.generic.callback = EntShellCallback;
s_ent_shell_box.itemnames = shell_names;
s_ent_shell_box.itemNames = shell_names;
s_ent_shell_box.generic.statusbar = "envmap effect may cause instability on ATI cards";
s_celshading_box.generic.type = MTYPE_SPINCONTROL;
@ -544,7 +506,7 @@ void Menu_Video_Advanced_Init (void)
s_celshading_box.generic.y = y += MENU_LINE_SIZE;
s_celshading_box.generic.name = "cel shading";
s_celshading_box.generic.callback = CelShadingCallback;
s_celshading_box.itemnames = yesno_names;
s_celshading_box.itemNames = yesno_names;
s_celshading_box.generic.statusbar = "cartoon-style rendering of models";
s_celshading_width_slider.generic.type = MTYPE_SLIDER;
@ -565,7 +527,8 @@ void Menu_Video_Advanced_Init (void)
s_screenshotformat_box.generic.y = y += 2*MENU_LINE_SIZE;
s_screenshotformat_box.generic.name = "screenshot format";
s_screenshotformat_box.generic.callback = ScreenshotFormatCallback;
s_screenshotformat_box.itemnames = screenshotformat_names;
s_screenshotformat_box.itemNames = screenshotformat_names;
s_screenshotformat_box.itemValues = screenshotformat_values;
s_screenshotformat_box.generic.statusbar = "image format for screenshots";
s_screenshotjpegquality_slider.generic.type = MTYPE_SLIDER;
@ -586,7 +549,7 @@ void Menu_Video_Advanced_Init (void)
s_saveshotsize_box.generic.y = y += MENU_LINE_SIZE;
s_saveshotsize_box.generic.name = "hi-res saveshots";
s_saveshotsize_box.generic.callback = SaveshotSizeCallback;
s_saveshotsize_box.itemnames = yesno_names;
s_saveshotsize_box.itemNames = yesno_names;
s_saveshotsize_box.generic.statusbar = "hi-res saveshots when running at 800x600 or higher";
s_upscale_font_box.generic.type = MTYPE_SPINCONTROL;
@ -595,7 +558,7 @@ void Menu_Video_Advanced_Init (void)
s_upscale_font_box.generic.y = y += 2*MENU_LINE_SIZE;
s_upscale_font_box.generic.name = "upscale old fonts";
s_upscale_font_box.generic.callback = UpscaleFontCallback;
s_upscale_font_box.itemnames = font_upscale_names;
s_upscale_font_box.itemNames = font_upscale_names;
s_upscale_font_box.generic.statusbar = "upscales 128x128 fonts to higher res based on screen resolution";
s_advanced_apply_action.generic.type = MTYPE_ACTION;
@ -603,7 +566,7 @@ void Menu_Video_Advanced_Init (void)
s_advanced_apply_action.generic.name = "apply changes";
s_advanced_apply_action.generic.x = 0;
s_advanced_apply_action.generic.y = y += 2*MENU_LINE_SIZE;
s_advanced_apply_action.generic.callback = AdvancedMenuApplyChanges;
s_advanced_apply_action.generic.callback = M_AdvancedMenuApplyChanges;
s_back_action.generic.type = MTYPE_ACTION;
s_back_action.generic.textSize = MENU_FONT_SIZE;
@ -612,7 +575,7 @@ void Menu_Video_Advanced_Init (void)
s_back_action.generic.y = y += 2*MENU_LINE_SIZE;
s_back_action.generic.callback = UI_BackMenu;
Video_Advanced_MenuSetValues ();
M_AdvancedVideo_MenuSetValues ();
UI_AddMenuItem (&s_video_advanced_menu, (void *) &s_options_advanced_header);
UI_AddMenuItem (&s_video_advanced_menu, (void *) &s_lightmapscale_slider);

View file

@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MTYPE_SPINCONTROL 3
#define MTYPE_SEPARATOR 4
#define MTYPE_FIELD 5
#define MTYPE_KEYBIND 6
#define K_TAB 9
#define K_ENTER 13
@ -131,10 +132,12 @@ typedef struct
{
menucommon_s generic;
int curvalue;
qboolean invertValue; // Knightmare added
int curValue;
const char **itemnames;
int numitemnames;
const char **itemNames;
const char **itemValues; // Knightmare added
int numItems;
} menulist_s;
typedef struct
@ -147,6 +150,16 @@ typedef struct
menucommon_s generic;
} menuseparator_s;
typedef struct
{
menucommon_s generic;
char *commandName;
const char *enter_statusbar;
int keys[2];
qboolean grabBind;
} menukeybind_s;
typedef enum {
LISTBOX_TEXT,
LISTBOX_IMAGE,
@ -163,16 +176,16 @@ typedef struct
menucommon_s generic;
listboxtype_t type;
scrolltype_t scrolltype;
scrolltype_t scrollType;
int items_x;
int items_y;
int item_width;
int item_height;
int scrollpos;
int curvalue;
int scrollPos;
int curValue;
const char **itemnames;
int numitemnames;
const char **itemNames;
int numItems;
} menulistbox_s;
typedef struct
@ -232,7 +245,7 @@ extern char **ui_resolution_names;
extern char **ui_video_modes;
extern char **ui_aniso_names;
//extern char **ui_aniso_values;
extern char **ui_aniso_values;
extern char **ui_font_names;
extern int ui_numfonts;
@ -242,7 +255,7 @@ extern int ui_numfonts;
extern char **ui_crosshair_names;
//extern char **ui_crosshair_display_names;
//extern char **ui_crosshair_values;
extern char **ui_crosshair_values;
extern int ui_numcrosshairs;
//=======================================================
@ -325,8 +338,11 @@ extern struct image_s *ui_playerskin;
//=======================================================
qboolean UI_IsValidImageFilename (char *name);
void UI_ClampCvar (const char *varName, float cvarMin, float cvarMax);
int UI_GetIndexForStringValue (const char **item_values, char *value);
int UI_MouseOverAlpha (menucommon_s *m);
void UI_UnbindCommand (char *command);
void UI_FindKeysForCommand (char *command, int *twokeys);
void *UI_ItemAtMenuCursor (menuframework_s *m);
void UI_SetMenuStatusBar (menuframework_s *s, const char *string);
int UI_TallyMenuSlots (menuframework_s *menu);
@ -379,7 +395,7 @@ void UI_UpdatePlayerSkinInfo (int mNum, int sNum);
qboolean UI_HaveValidPlayerModels (void *unused);
//
// ui_backend.c
// ui_widgets.c
//
extern vec4_t stCoord_arrow_left;
extern vec4_t stCoord_arrow_right;
@ -387,8 +403,13 @@ extern vec4_t stCoord_arrow_up;
extern vec4_t stCoord_arrow_down;
qboolean UI_MenuField_Key (menufield_s *field, int key);
void UI_MenuSlider_SetValue (menuslider_s *s, float value);
void UI_MenuSlider_SetValue (menuslider_s *s, const char *varName, float cvarMin, float cvarMax, qboolean clamp);
void UI_MenuSlider_SaveValue (menuslider_s *s, const char *varName);
float UI_MenuSlider_GetValue (menuslider_s *s);
void UI_MenuSpinControl_SetValue (menulist_s *s, const char *varName, float cvarMin, float cvarMax, qboolean clamp);
void UI_MenuSpinControl_SaveValue (menulist_s *s, const char *varName);
const char *UI_MenuSpinControl_GetValue (menulist_s *s);
void UI_DrawMenuItem (void *item);
qboolean UI_SelectMenuItem (menuframework_s *s);
@ -495,6 +516,8 @@ void UI_Draw_Cursor (void);
#define UI_SLIDER_PIC "/gfx/ui/widgets/slider.pcx"
#define UI_ARROWS_PIC "/gfx/ui/widgets/arrows.pcx"
#define UI_ITEMVALUE_WILDCARD "???"
extern cvar_t *ui_sensitivity;
extern cvar_t *ui_background_alpha;
extern cvar_t *ui_item_rotate;

View file

@ -210,7 +210,7 @@ UI_AddMenuItem
*/
void UI_AddMenuItem (menuframework_s *menu, void *item)
{
int i;
int i, j;
menulist_s *list;
menucommon_s *baseItem;
@ -230,8 +230,16 @@ void UI_AddMenuItem (menuframework_s *menu, void *item)
switch (list->generic.type) {
case MTYPE_SPINCONTROL:
for (i=0; list->itemnames[i]; i++);
list->numitemnames = i;
for (i=0; list->itemNames[i]; i++);
list->numItems = i;
if (list->itemValues) // Check if itemvalues count matches itemnames
{
for (j=0; list->itemValues[j]; j++);
if (j != i) {
Com_Printf (S_COLOR_YELLOW"UI_AddMenuItem: itemvalues size mismatch for %s!\n",
(list->generic.name && (list->generic.name[0] != 0)) ? list->generic.name : "<noname>");
}
}
break;
}
@ -383,10 +391,13 @@ void UI_DrawMenu (menuframework_s *menu)
cursor = ((int)(Sys_Milliseconds()/250)&1) ? UI_ITEMCURSOR_DEFAULT_PIC : UI_ITEMCURSOR_BLINK_PIC;
if (item->flags & QMF_LEFT_JUSTIFY)
cursorX = menu->x + item->x + item->cursor_offset - 24;
else
cursorX = menu->x + item->cursor_offset;
// if (item->flags & QMF_LEFT_JUSTIFY)
// cursorX = menu->x + item->x + item->cursor_offset - 24;
// else
// cursorX = menu->x + item->cursor_offset;
cursorX = menu->x + item->x + item->cursor_offset;
if ( (item->flags & QMF_LEFT_JUSTIFY) && (item->type == MTYPE_ACTION) )
cursorX -= 4*MENU_FONT_SIZE;
UI_DrawPic (cursorX, menu->y+item->y, item->textSize, item->textSize, ALIGN_CENTER, false, cursor, 255);

View file

@ -316,7 +316,7 @@ void UI_Mouseover_Check (menuframework_s *menu)
min[0] -= SCR_ScaledScreen(len*item->textSize - LCOLUMN_OFFSET*2);
}
len = (int)strlen(spin->itemnames[spin->curvalue]);
len = (int)strlen(spin->itemNames[spin->curValue]);
// max[0] += SCR_ScaledScreen(len*MENU_FONT_SIZE);
max[0] += SCR_ScaledScreen(len*item->textSize);

View file

@ -119,6 +119,17 @@ qboolean UI_IsValidImageFilename (char *name)
}
/*
==========================
UI_ClampCvar
==========================
*/
void UI_ClampCvar (const char *varName, float cvarMin, float cvarMax)
{
Cvar_SetValue ((char *)varName, ClampCvar( cvarMin, cvarMax, Cvar_VariableValue((char *)varName) ));
}
/*
==========================
UI_GetIndexForStringValue
@ -126,7 +137,8 @@ UI_GetIndexForStringValue
*/
int UI_GetIndexForStringValue (const char **item_values, char *value)
{
int i, index = 0;
int i, index = 0, widlcardIndex = -1;
qboolean found = false;
// catch null array
if (!item_values) {
@ -135,9 +147,19 @@ int UI_GetIndexForStringValue (const char **item_values, char *value)
}
for (i=0; item_values[i]; i++)
if ( !Q_strcasecmp(va("%s",item_values[i]), value) )
{ index = i; break; }
{ // Store index of wildcard entry
if ( !Q_stricmp(va("%s", item_values[i]), UI_ITEMVALUE_WILDCARD) )
{ widlcardIndex = i; }
if ( !Q_strcasecmp(va("%s", item_values[i]), value) ) {
index = i;
found = true;
break;
}
}
// Assign index of wildcard entry if not found
if ( !found && (widlcardIndex >= 0) ) {
index = widlcardIndex;
}
return index;
}
@ -165,6 +187,63 @@ int UI_MouseOverAlpha (menucommon_s *m)
}
/*
==========================
UI_UnbindCommand
==========================
*/
void UI_UnbindCommand (char *command)
{
int j, len, len2;
char *b;
len = (int)strlen(command);
for (j=0; j<256; j++)
{
b = keybindings[j];
if (!b)
continue;
len2 = (int)strlen(b);
// compare with longer length to prevent +attack2 being confused with +attack
if ( !strncmp(b, command, max(len, len2)) )
Key_SetBinding (j, "");
}
}
/*
==========================
UI_FindKeysForCommand
==========================
*/
void UI_FindKeysForCommand (char *command, int *twokeys)
{
int count, j, len, len2;
char *b;
twokeys[0] = twokeys[1] = -1;
len = (int)strlen(command);
count = 0;
for (j=0; j<256; j++)
{
b = keybindings[j];
if (!b)
continue;
len2 = (int)strlen(b);
// compare with longer length to prevent +attack2 being confused with +attack
if ( !strncmp(b, command, max(len, len2)) )
{
twokeys[count] = j;
count++;
if (count == 2)
break;
}
}
}
/*
=================
UI_ItemAtMenuCursor
@ -207,7 +286,7 @@ int UI_TallyMenuSlots (menuframework_s *menu)
if ( ((menucommon_s *)menu->items[i])->type == MTYPE_LIST )
{
int nitems = 0;
const char **n = ((menulist_s *)menu->items[i])->itemnames;
const char **n = ((menulist_s *)menu->items[i])->itemNames;
while (*n)
nitems++, n++;
@ -318,7 +397,8 @@ void UI_GetVideoModes (void)
int i, j=0, w=0, h=0, firstMode=0, numModes=0;
float aspect;
char *tok, resBuf[12], aspectBuf[8], nameBuf[20];
qboolean surround = false;
// qboolean surround = false;
// cvar_t *surround_threshold = Cvar_Get ("scr_surroundthreshold", "3.6", 0);
// count video modes >= 640x480
for (i=0; i<UI_MAX_VIDMODES; i++)
@ -358,10 +438,10 @@ void UI_GetVideoModes (void)
Com_sprintf (resBuf, sizeof(resBuf), "%dx%d", w, h);
// catch surround modes
if (aspect > 3.6f) {
/* if (aspect > surround_threshold->value) { // 3.6f
aspect /= 3.0f;
surround = true;
}
} */
if (aspect > 2.39f)
tok = "24:10";
else if (aspect > 2.3f)
@ -383,9 +463,9 @@ void UI_GetVideoModes (void)
else
tok = va("%3.1f:1", aspect);
if (surround)
/* if (surround)
Com_sprintf (aspectBuf, sizeof(aspectBuf), "3x%s", tok);
else
else */
Com_sprintf (aspectBuf, sizeof(aspectBuf), "%s", tok);
// Com_sprintf (nameBuf, sizeof(nameBuf), "%-12s%s", resBuf, aspectBuf);
@ -417,7 +497,7 @@ void UI_FreeVideoModes (void)
char **ui_aniso_names = NULL;
//char **ui_aniso_values = NULL;
char **ui_aniso_values = NULL;
int ui_num_aniso_values = 0;
/*
@ -444,8 +524,8 @@ void UI_GetAnisoValues (void)
// allocate lists
ui_aniso_names = malloc ((numValues+1) * sizeof(char *));
memset (ui_aniso_names, 0, (numValues+1) * sizeof(char *));
// ui_aniso_values = malloc ((numValues+1) * sizeof(char *));
// memset (ui_aniso_values, 0, (numValues+1) * sizeof(char *));
ui_aniso_values = malloc ((numValues+1) * sizeof(char *));
memset (ui_aniso_values, 0, (numValues+1) * sizeof(char *));
// set names and values
for (i=0; i<numValues; i++)
@ -454,7 +534,7 @@ void UI_GetAnisoValues (void)
ui_aniso_names[i] = (numValues == 1) ? strdup("not supported") : strdup("off");
else
ui_aniso_names[i] = strdup(va("%ix", 1<<i));
// ui_aniso_values[i] = strdup(va("%i", 1<<i));
ui_aniso_values[i] = strdup(va("%i", 1<<i));
}
ui_num_aniso_values = numValues;
@ -470,10 +550,10 @@ void UI_FreeAnisoValues (void)
{
if (ui_num_aniso_values > 0) {
FS_FreeFileList (ui_aniso_names, ui_num_aniso_values);
// FS_FreeFileList (ui_aniso_values, ui_num_aniso_values);
FS_FreeFileList (ui_aniso_values, ui_num_aniso_values);
}
ui_aniso_names = NULL;
// ui_aniso_values = NULL;
ui_aniso_values = NULL;
}
/*
@ -804,7 +884,7 @@ void UI_FreeHudNames (void)
#define UI_MAX_CROSSHAIRS 101 // none + ch1-ch100
char **ui_crosshair_names = NULL;
//char **ui_crosshair_display_names = NULL;
//char **ui_crosshair_values = NULL;
char **ui_crosshair_values = NULL;
int ui_numcrosshairs = 0;
/*
@ -887,7 +967,7 @@ UI_LoadCrosshairs
*/
void UI_LoadCrosshairs (void)
{
// int i;
int i;
ui_crosshair_names = UI_LoadAssetList ("pics", "ch*.*", "none", &ui_numcrosshairs, UI_MAX_CROSSHAIRS, true, false, UI_IsValidCrosshairName);
UI_SortCrosshairs (ui_crosshair_names, ui_numcrosshairs);
@ -895,12 +975,12 @@ void UI_LoadCrosshairs (void)
/* ui_crosshair_display_names = malloc( sizeof(char *) * (UI_MAX_CROSSHAIRS+1) );
memcpy(ui_crosshair_display_names, ui_crosshair_names, sizeof(char *) * (UI_MAX_CROSSHAIRS+1));
ui_crosshair_display_names[0] = strdup("chnone");
*/
ui_crosshair_values = malloc( sizeof(char *) * (UI_MAX_CROSSHAIRS+1) );
memset(ui_crosshair_values, 0, sizeof(char *) * (UI_MAX_CROSSHAIRS+1) );
for (i=0; i<ui_numcrosshairs; i++)
ui_crosshair_values[i] = (i == 0) ? strdup("0") : strdup(strtok(ui_crosshair_names[i], "ch")); */
ui_crosshair_values[i] = (i == 0) ? strdup("0") : strdup(strtok(ui_crosshair_names[i], "ch"));
}
@ -920,12 +1000,12 @@ void UI_FreeCrosshairs (void)
free (ui_crosshair_display_names[0]);
}
free (ui_crosshair_display_names);
}
FS_FreeFileList (ui_crosshair_values, ui_numcrosshairs); */
} */
FS_FreeFileList (ui_crosshair_values, ui_numcrosshairs);
}
ui_crosshair_names = NULL;
// ui_crosshair_display_names = NULL;
// ui_crosshair_values = NULL;
ui_crosshair_values = NULL;
ui_numcrosshairs = 0;
}

View file

@ -66,13 +66,19 @@ extern viddef_t viddef;
void MenuAction_DoEnter (menuaction_s *a)
{
if (!a) return;
if (a->generic.callback)
a->generic.callback(a);
}
void MenuAction_Draw (menuaction_s *a)
{
int alpha = UI_MouseOverAlpha(&a->generic);
int alpha;
if (!a) return;
alpha = UI_MouseOverAlpha(&a->generic);
if (a->generic.flags & QMF_LEFT_JUSTIFY)
{
@ -96,8 +102,12 @@ void MenuAction_Draw (menuaction_s *a)
a->generic.ownerdraw(a);
}
//=========================================================
qboolean MenuField_DoEnter (menufield_s *f)
{
if (!f) return false;
if (f->generic.callback)
{
f->generic.callback(f);
@ -108,10 +118,14 @@ qboolean MenuField_DoEnter (menufield_s *f)
void MenuField_Draw (menufield_s *f)
{
int i, alpha = UI_MouseOverAlpha(&f->generic), xtra;
int i, alpha, xtra;
char tempbuffer[128]="";
int offset;
if (!f) return;
alpha = UI_MouseOverAlpha(&f->generic);
if (f->generic.name)
UI_DrawStringR2LDark (f->generic.x + f->generic.parent->x + LCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y, f->generic.textSize, f->generic.name, 255);
@ -182,6 +196,8 @@ qboolean UI_MenuField_Key (menufield_s *f, int key)
{
extern int keydown[];
if (!f) return false;
switch ( key )
{
case K_KP_SLASH:
@ -311,13 +327,17 @@ qboolean UI_MenuField_Key (menufield_s *f, int key)
return true;
}
//=========================================================
void Menulist_DoEnter (menulist_s *l)
{
int start;
if (!l) return;
start = l->generic.y / 10 + 1;
l->curvalue = l->generic.parent->cursor - start;
l->curValue = l->generic.parent->cursor - start;
if (l->generic.callback)
l->generic.callback(l);
@ -326,16 +346,20 @@ void Menulist_DoEnter (menulist_s *l)
void MenuList_Draw (menulist_s *l)
{
const char **n;
int y = 0, alpha = UI_MouseOverAlpha(&l->generic);
int y = 0, alpha;
if (!l) return;
alpha = UI_MouseOverAlpha(&l->generic);
UI_DrawStringR2LDark (l->generic.x + l->generic.parent->x + LCOLUMN_OFFSET, // - 2*MENU_FONT_SIZE,
l->generic.y + l->generic.parent->y, l->generic.textSize, l->generic.name, alpha);
n = l->itemnames;
n = l->itemNames;
// UI_DrawFill (l->generic.parent->x + l->generic.x - 112, l->generic.parent->y + l->generic.y + (l->curvalue+1)*MENU_LINE_SIZE,
// UI_DrawFill (l->generic.parent->x + l->generic.x - 112, l->generic.parent->y + l->generic.y + (l->curValue+1)*MENU_LINE_SIZE,
// 128, MENU_LINE_SIZE, ALIGN_CENTER, false, 16);
UI_DrawFill (l->generic.parent->x + l->generic.x - 112, l->generic.parent->y + l->generic.y + (l->curvalue+1)*MENU_LINE_SIZE,
UI_DrawFill (l->generic.parent->x + l->generic.x - 112, l->generic.parent->y + l->generic.y + (l->curValue+1)*MENU_LINE_SIZE,
128, MENU_LINE_SIZE, ALIGN_CENTER, false, color8red(16), color8green(16), color8blue(16), 255);
while (*n)
@ -347,26 +371,49 @@ void MenuList_Draw (menulist_s *l)
}
}
//=========================================================
void MenuSeparator_Draw (menuseparator_s *s)
{
int alpha = UI_MouseOverAlpha(&s->generic);
int alpha;
if (!s) return;
alpha = UI_MouseOverAlpha(&s->generic);
if (s->generic.name)
UI_DrawStringR2LDark (s->generic.x + s->generic.parent->x,
s->generic.y + s->generic.parent->y, s->generic.textSize, s->generic.name, alpha);
}
void UI_MenuSlider_SetValue (menuslider_s *s, float value)
//=========================================================
void UI_MenuSlider_SetValue (menuslider_s *s, const char *varName, float cvarMin, float cvarMax, qboolean clamp)
{
if (!s || !varName || varName[0] == '\0')
return;
if (!s->increment)
s->increment = 1.0f;
s->curPos = (int)ceil((value - s->baseValue) / s->increment);
if (clamp) {
UI_ClampCvar (varName, cvarMin, cvarMax);
}
s->curPos = (int)ceil((Cvar_VariableValue((char *)varName) - s->baseValue) / s->increment);
s->curPos = min(max(s->curPos, 0), s->maxPos);
}
void UI_MenuSlider_SaveValue (menuslider_s *s, const char *varName)
{
if (!s || !varName || varName[0] == '\0')
return;
Cvar_SetValue ((char *)varName, ((float)s->curPos * s->increment) + s->baseValue);
}
float UI_MenuSlider_GetValue (menuslider_s *s)
{
if (!s) return 0.0f;
if (!s->increment)
s->increment = 1.0f;
@ -375,6 +422,8 @@ float UI_MenuSlider_GetValue (menuslider_s *s)
void MenuSlider_DoSlide (menuslider_s *s, int dir)
{
if (!s) return;
s->curPos += dir;
s->curPos = min(max(s->curPos, 0), s->maxPos);
@ -387,10 +436,14 @@ void MenuSlider_DoSlide (menuslider_s *s, int dir)
void MenuSlider_Draw (menuslider_s *s)
{
int i, x, y, alpha = UI_MouseOverAlpha(&s->generic);
int i, x, y, alpha;
float tmpValue;
char valueText[8];
if (!s) return;
alpha = UI_MouseOverAlpha(&s->generic);
UI_DrawStringR2LDark (s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y, s->generic.textSize, s->generic.name, alpha);
@ -454,14 +507,93 @@ void MenuSlider_Draw (menuslider_s *s)
// s->generic.y + s->generic.parent->y + 1, MENU_FONT_SIZE-2, valueText, alpha);
}
void MenuSpinControl_DoEnter (menulist_s *s)
//=========================================================
void UI_MenuSpinControl_SetValue (menulist_s *s, const char *varName, float cvarMin, float cvarMax, qboolean clamp)
{
if (!s->itemnames || !s->numitemnames)
if (!s || !varName || varName[0] == '\0')
return;
s->curvalue++;
if (s->itemnames[s->curvalue] == 0)
s->curvalue = 0;
if (clamp) {
UI_ClampCvar (varName, cvarMin, cvarMax);
}
if (s->itemValues) {
s->curValue = UI_GetIndexForStringValue(s->itemValues, Cvar_VariableString((char *)varName));
}
else
{
if (s->invertValue) {
s->curValue = (Cvar_VariableValue((char *)varName) < 0);
}
else {
s->curValue = (int)min(max(Cvar_VariableValue((char *)varName), cvarMin), cvarMax);
}
}
}
void UI_MenuSpinControl_SaveValue (menulist_s *s, const char *varName)
{
if (!s || !varName || varName[0] == '\0')
return;
if (!s->numItems) {
Com_Printf (S_COLOR_YELLOW"UI_MenuSpinControl_SaveValue: not initialized!\n");
return;
}
if ( (s->curValue < 0) || (s->curValue >= s->numItems) ) {
Com_Printf (S_COLOR_YELLOW"UI_MenuSpinControl_SaveValue: curvalue out of bounds!\n");
return;
}
if (s->itemValues) {
// Don't save to cvar if this itemvalue is the wildcard
if ( Q_stricmp(va("%s", s->itemValues[s->curValue]), UI_ITEMVALUE_WILDCARD) != 0 )
Cvar_Set ((char *)varName, va("%s", s->itemValues[s->curValue]));
}
else
{
if (s->invertValue) {
Cvar_SetValue ((char *)varName, Cvar_VariableValue((char *)varName) * -1 );
}
else {
Cvar_SetInteger ((char *)varName, s->curValue);
}
}
}
const char *UI_MenuSpinControl_GetValue (menulist_s *s)
{
const char *value;
if (!s)
return NULL;
if (!s->numItems) {
Com_Printf (S_COLOR_YELLOW"UI_MenuSpinControl_GetValue: not initialized!\n");
return NULL;
}
if ( (s->curValue < 0) || (s->curValue >= s->numItems) ) {
Com_Printf (S_COLOR_YELLOW"UI_MenuSpinControl_GetValue: curvalue out of bounds!\n");
return NULL;
}
if (s->itemValues) {
value = s->itemValues[s->curValue];
}
else {
value = va("%d", s->curValue);
}
return value;
}
void MenuSpinControl_DoEnter (menulist_s *s)
{
if (!s || !s->itemNames || !s->numItems)
return;
s->curValue++;
if (s->itemNames[s->curValue] == 0)
s->curValue = 0;
if (s->generic.callback)
s->generic.callback(s);
@ -469,23 +601,23 @@ void MenuSpinControl_DoEnter (menulist_s *s)
void MenuSpinControl_DoSlide (menulist_s *s, int dir)
{
if (!s->itemnames || !s->numitemnames)
if (!s || !s->itemNames || !s->numItems)
return;
s->curvalue += dir;
s->curValue += dir;
if (s->generic.flags & QMF_SKINLIST) // don't allow looping around for skin lists
{
if (s->curvalue < 0)
s->curvalue = 0;
else if (s->itemnames[s->curvalue] == 0)
s->curvalue--;
if (s->curValue < 0)
s->curValue = 0;
else if (s->itemNames[s->curValue] == 0)
s->curValue--;
}
else {
if (s->curvalue < 0)
s->curvalue = s->numitemnames-1; // was 0
else if (s->itemnames[s->curvalue] == 0)
s->curvalue = 0; // was --
if (s->curValue < 0)
s->curValue = s->numItems-1; // was 0
else if (s->itemNames[s->curValue] == 0)
s->curValue = 0; // was --
}
if (s->generic.callback)
@ -494,33 +626,40 @@ void MenuSpinControl_DoSlide (menulist_s *s, int dir)
void MenuSpinControl_Draw (menulist_s *s)
{
int alpha = UI_MouseOverAlpha(&s->generic);
int alpha;
char buffer[100];
if (!s) return;
alpha = UI_MouseOverAlpha(&s->generic);
if (s->generic.name)
{
UI_DrawStringR2LDark (s->generic.x + s->generic.parent->x + LCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y, s->generic.textSize, s->generic.name, alpha);
}
if (!strchr(s->itemnames[s->curvalue], '\n'))
if (!strchr(s->itemNames[s->curValue], '\n'))
{
UI_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y, s->generic.textSize, s->itemnames[s->curvalue], alpha);
s->generic.y + s->generic.parent->y, s->generic.textSize, s->itemNames[s->curValue], alpha);
}
else
{
// strncpy(buffer, s->itemnames[s->curvalue]);
Q_strncpyz (buffer, sizeof(buffer), s->itemnames[s->curvalue]);
Q_strncpyz (buffer, sizeof(buffer), s->itemNames[s->curValue]);
*strchr(buffer, '\n') = 0;
UI_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y, s->generic.textSize, buffer, alpha);
// strncpy(buffer, strchr( s->itemnames[s->curvalue], '\n' ) + 1 );
Q_strncpyz (buffer, sizeof(buffer), strchr( s->itemnames[s->curvalue], '\n' ) + 1);
Q_strncpyz (buffer, sizeof(buffer), strchr( s->itemNames[s->curValue], '\n' ) + 1);
UI_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y + MENU_LINE_SIZE, s->generic.textSize, buffer, alpha);
}
}
//=========================================================
//=========================================================
/*
@ -570,7 +709,11 @@ UI_SelectMenuItem
*/
qboolean UI_SelectMenuItem (menuframework_s *s)
{
menucommon_s *item = (menucommon_s *)UI_ItemAtMenuCursor(s);
menucommon_s *item=NULL;
if (!s) return false;
item = (menucommon_s *)UI_ItemAtMenuCursor(s);
if (item)
{
@ -602,6 +745,8 @@ UI_MouseSelectItem
*/
qboolean UI_MouseSelectItem (menucommon_s *item)
{
if (!item) return false;
if (item)
{
switch (item->type)
@ -629,7 +774,11 @@ UI_SlideMenuItem
*/
void UI_SlideMenuItem (menuframework_s *s, int dir)
{
menucommon_s *item = (menucommon_s *) UI_ItemAtMenuCursor(s);
menucommon_s *item=NULL;
if (!s) return;
item = (menucommon_s *) UI_ItemAtMenuCursor(s);
if (item)
{

View file

@ -2150,8 +2150,11 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
} while (time < 1);*/
// Con_Printf ("time:%5.2f - %5.2f = %5.2f\n", newtime, oldtime, time);
#if defined(_M_IX86) || defined(__i386__)
// _controlfp( ~( _EM_ZERODIVIDE /*| _EM_INVALID*/ ), _MCW_EM );
_controlfp( _PC_24, _MCW_PC );
#endif
Qcommon_Frame (time);
oldtime = newtime;