Added video menu resolution list generation from vid_modes table via VID_GetModeInfo().

Added video menu anisotropic mode list generation from cvar.
Cleanup of menus and UI utils code from last refactoring.
Added player obituary for Makron in Zaaero game DLL.
This commit is contained in:
Knightmare66 2021-08-29 22:52:34 -04:00
parent 8ec00f2f51
commit 69bbad2b9a
20 changed files with 316 additions and 767 deletions

View file

@ -38,3 +38,4 @@ extern viddef_t viddef; // global video state
void VID_Init (void);
void VID_Shutdown (void);
void VID_CheckChanges (void);
qboolean VID_GetModeInfo (int *width, int *height, int mode);

View file

@ -306,6 +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;
if (!self->groundentity)
{
// if ((g_showlogic) && (g_showlogic->value))

View file

@ -57,25 +57,11 @@ static void ClientCompatibilityFunc (void *unused)
void JoinServerFunc (void *self)
{
// char buffer[128];
int index;
index = ( menuaction_s * ) self - s_joinserver_server_actions;
index = (menuaction_s *) self - s_joinserver_server_actions;
#if 1
UI_JoinServer (index);
#else
if ( Q_stricmp( ui_local_server_names[index], NO_SERVER_STRING ) == 0 )
return;
if (index >= ui_num_servers)
return;
Com_sprintf (buffer, sizeof(buffer), "connect %s\n", NET_AdrToString (ui_local_server_netadr[index]));
Cbuf_AddText (buffer);
UI_ForceMenuOff ();
cls.disable_screen = 1; // Knightmare- show loading screen
#endif
}
void AddressBookFunc (void *self)

View file

@ -75,55 +75,23 @@ static void RateCallback (void *unused)
static void Menu_PlayerModelCallback (void *unused)
{
int mNum, sNum;
// char scratch[MAX_QPATH];
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;
#if 1
UI_UpdatePlayerModelInfo (mNum, sNum);
#else
// only register model and skin on starup or when changed
Com_sprintf( scratch, sizeof(scratch), "players/%s/tris.md2", ui_pmi[mNum].directory );
ui_playermodel = R_RegisterModel (scratch);
Com_sprintf( scratch, sizeof(scratch), "players/%s/%s.pcx", ui_pmi[mNum].directory, ui_pmi[mNum].skinDisplayNames[sNum] );
ui_playerskin = R_RegisterSkin (scratch);
// show current weapon model (if any)
if (ui_currentweaponmodel && strlen(ui_currentweaponmodel)) {
Com_sprintf (scratch, sizeof(scratch), "players/%s/%s", ui_pmi[mNum].directory, ui_currentweaponmodel);
ui_weaponmodel = R_RegisterModel(scratch);
if (!ui_weaponmodel) {
Com_sprintf (scratch, sizeof(scratch), "players/%s/weapon.md2", ui_pmi[mNum].directory);
ui_weaponmodel = R_RegisterModel (scratch);
}
}
else {
Com_sprintf (scratch, sizeof(scratch), "players/%s/weapon.md2", ui_pmi[mNum].directory);
ui_weaponmodel = R_RegisterModel (scratch);
}
#endif
}
static void Menu_PlayerSkinCallback (void *unused)
{
#if 1
int mNum, sNum;
mNum = s_playerconfig_model_box.curvalue;
sNum = s_playerconfig_skin_box.curvalue;
UI_UpdatePlayerSkinInfo (mNum, sNum);
#else
char scratch[MAX_QPATH];
// only register skin on starup and when changed
Com_sprintf(scratch, sizeof(scratch), "players/%s/%s.pcx", ui_pmi[s_player_model_box.curvalue].directory, ui_pmi[s_player_model_box.curvalue].skinDisplayNames[s_player_skin_box.curvalue]);
ui_playerskin = R_RegisterSkin(scratch);
#endif
}
//=======================================================================
@ -133,11 +101,8 @@ static void Menu_PlayerSkinCallback (void *unused)
qboolean Menu_PlayerConfig_Init (void)
{
// char currentdirectory[1024];
// char currentskin[1024];
// char scratch[MAX_QPATH];
int i, y;
int mNum = 0, sNum = 0;
int i, y;
int mNum = 0, sNum = 0;
cvar_t *hand = Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE);
@ -146,62 +111,12 @@ qboolean Menu_PlayerConfig_Init (void)
if ( (hand->integer < 0) || (hand->integer > 2) )
Cvar_SetValue ("hand", 0);
// UI_PlayerConfig_ScanDirectories (); // Replaced by UI_LoadPlayerModels() called from UI_Init()
// if (ui_numplayermodels == 0)
if ( !UI_HaveValidPlayerModels(NULL) )
return false;
#if 1
// get model and skin index and precache them
UI_InitPlayerModelInfo (&mNum, &sNum);
#else
// strncpy(currentdirectory, Cvar_VariableString("skin"));
Q_strncpyz (currentdirectory, sizeof(currentdirectory), Cvar_VariableString("skin"));
if ( strchr( currentdirectory, '/' ) )
{
// strncpy(currentskin, strchr( currentdirectory, '/' ) + 1);
Q_strncpyz (currentskin, sizeof(currentskin), strchr( currentdirectory, '/' ) + 1);
*strchr(currentdirectory, '/') = 0;
}
else if ( strchr( currentdirectory, '\\' ) )
{
// strncpy( currentskin, strchr( currentdirectory, '\\' ) + 1 );
Q_strncpyz (currentskin, sizeof(currentskin), strchr( currentdirectory, '\\' ) + 1);
*strchr(currentdirectory, '\\') = 0;
}
else
{
// strncpy( currentdirectory, "male" );
// strncpy( currentskin, "grunt" );
Q_strncpyz (currentdirectory, sizeof(currentdirectory), "male");
Q_strncpyz (currentskin, sizeof(currentskin), "grunt");
}
qsort( ui_pmi, ui_numplayermodels, sizeof( ui_pmi[0] ), UI_PlayerModelCmpFunc );
memset( ui_pmnames, 0, sizeof( ui_pmnames ) );
for ( i = 0; i < ui_numplayermodels; i++ )
{
ui_pmnames[i] = ui_pmi[i].displayname;
if ( Q_stricmp( ui_pmi[i].directory, currentdirectory ) == 0 )
{
int j;
mNum = i;
for ( j = 0; j < ui_pmi[i].nskins; j++ )
{
if ( Q_stricmp( ui_pmi[i].skinDisplayNames[j], currentskin ) == 0 )
{
sNum = j;
break;
}
}
}
}
#endif
y = 0;
@ -302,30 +217,6 @@ qboolean Menu_PlayerConfig_Init (void)
s_playerconfig_back_action.generic.statusbar = NULL;
s_playerconfig_back_action.generic.callback = UI_BackMenu;
#if 0 // Replaced by UI_UpdatePlayerModelInfo(), called from UI_InitPlayerModelInfo()
// only register model and skin on startup or when changed
Com_sprintf( scratch, sizeof( scratch ), "players/%s/tris.md2", ui_pmi[mNum].directory );
ui_playermodel = R_RegisterModel( scratch );
Com_sprintf( scratch, sizeof( scratch ), "players/%s/%s.pcx", ui_pmi[mNum].directory, ui_pmi[mNum].skinDisplayNames[sNum] );
ui_playerskin = R_RegisterSkin( scratch );
// show current weapon model (if any)
if (ui_currentweaponmodel && strlen(ui_currentweaponmodel)) {
Com_sprintf( scratch, sizeof( scratch ), "players/%s/%s", ui_pmi[mNum].directory, ui_currentweaponmodel );
ui_weaponmodel = R_RegisterModel( scratch );
if (!ui_weaponmodel) {
Com_sprintf( scratch, sizeof( scratch ), "players/%s/weapon.md2", ui_pmi[mNum].directory );
ui_weaponmodel = R_RegisterModel( scratch );
}
}
else
{
Com_sprintf( scratch, sizeof( scratch ), "players/%s/weapon.md2", ui_pmi[mNum].directory );
ui_weaponmodel = R_RegisterModel( scratch );
}
#endif
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);
@ -560,8 +451,6 @@ void Menu_PlayerConfig_Draw (void)
yaw = anglemod(cl.time/10);
// RF_MIRRORMODEL now eliminates the need to change origin based on handeness
// VectorSet (modelOrg, 150, (lefthand)?25:-25, 0); // was 80, 0, 0
VectorSet (modelOrg, 150, -25, 0); // was 80, 0, 0
// Setup player model
@ -585,16 +474,9 @@ void Menu_PlayerConfig_Draw (void)
ent->oldframe = 0;
ent->backlerp = 0.0;
ent->angles[1] = yaw;
// if ( ++yaw > 360 )
// yaw -= 360;
// RF_MIRRORMODEL now eliminates the need to reverse rotation
// if (lefthand)
// ent->angles[1] = 360 - ent->angles[1];
refdef.num_entities++;
// Setup weapon model
ent = &entity[1];
memset (&entity[1], 0, sizeof(entity[1]));
@ -620,10 +502,6 @@ void Menu_PlayerConfig_Draw (void)
ent->backlerp = 0.0;
ent->angles[1] = yaw;
// RF_MIRRORMODEL now eliminates the need to reverse rotation
// if (lefthand)
// ent->angles[1] = 360 - ent->angles[1];
refdef.num_entities++;
}
@ -644,34 +522,16 @@ void Menu_PlayerConfig_Draw (void)
void Menu_PConfigSaveChanges (void)
{
// int i;
int mNum, sNum;
char scratch[1024];
Cvar_Set( "name", s_playerconfig_name_field.buffer );
Cvar_Set ("name", s_playerconfig_name_field.buffer);
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 );
#if 0 // This is now freed when menu subsystem shuts down
for ( i = 0; i < ui_numplayermodels; i++ )
{
int j;
for ( j = 0; j < ui_pmi[i].nskins; j++ )
{
if ( ui_pmi[i].skinDisplayNames[j] )
free( ui_pmi[i].skinDisplayNames[j] );
ui_pmi[i].skinDisplayNames[j] = 0;
}
free( ui_pmi[i].skinDisplayNames );
ui_pmi[i].skinDisplayNames = 0;
ui_pmi[i].nskins = 0;
}
#endif
Com_sprintf (scratch, sizeof( scratch ), "%s/%s",
ui_pmi[mNum].directory, ui_pmi[mNum].skinDisplayNames[sNum]);
Cvar_Set ("skin", scratch);
}
const char *Menu_PlayerConfig_Key (int key)
@ -685,7 +545,7 @@ const char *Menu_PlayerConfig_Key (int key)
void Menu_PlayerConfig_f (void)
{
if (!Menu_PlayerConfig_Init())
if ( !Menu_PlayerConfig_Init() )
{
UI_SetMenuStatusBar (&s_multiplayer_menu, "No valid player models found");
return;

View file

@ -51,71 +51,6 @@ static menulist_s s_dedicated_box;
static menuaction_s s_startserver_back_action;
#if 0
/*
===============
UI_BuildMapList
===============
*/
void UI_BuildMapList (maptype_t maptype)
{
int i;
if (ui_svr_mapnames) free (ui_svr_mapnames);
ui_svr_nummaps = ui_svr_listfile_nummaps + ui_svr_arena_nummaps[maptype];
ui_svr_mapnames = malloc( sizeof( char * ) * ( ui_svr_nummaps + 1 ) );
memset( ui_svr_mapnames, 0, sizeof( char * ) * ( ui_svr_nummaps + 1 ) );
for (i = 0; i < ui_svr_nummaps; i++)
{
if (i < ui_svr_listfile_nummaps)
ui_svr_mapnames[i] = ui_svr_listfile_mapnames[i];
else
ui_svr_mapnames[i] = ui_svr_arena_mapnames[maptype][i-ui_svr_listfile_nummaps];
}
ui_svr_mapnames[ui_svr_nummaps] = 0;
ui_svr_maptype = maptype;
if (s_startmap_list.curvalue >= ui_svr_nummaps) // paranoia
s_startmap_list.curvalue = 0;
}
/*
===============
UI_RefreshMapList
===============
*/
void UI_RefreshMapList (maptype_t maptype)
{
int i;
if (maptype == ui_svr_maptype) // no change
return;
// 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;
UI_BuildMapList (maptype);
s_startmap_list.itemnames = ui_svr_mapnames;
for (i=0; s_startmap_list.itemnames[i]; i++);
s_startmap_list.numitemnames = i;
// levelshot found table
if (ui_svr_mapshotvalid) free(ui_svr_mapshotvalid);
ui_svr_mapshotvalid = malloc( sizeof( byte ) * ( ui_svr_nummaps + 1 ) );
memset( ui_svr_mapshotvalid, 0, sizeof( byte ) * ( ui_svr_nummaps + 1 ) );
// register null levelshot
if (ui_svr_mapshotvalid[ui_svr_nummaps] == M_UNSET) {
if (R_DrawFindPic("/gfx/ui/noscreen.pcx"))
ui_svr_mapshotvalid[ui_svr_nummaps] = M_FOUND;
else
ui_svr_mapshotvalid[ui_svr_nummaps] = M_MISSING;
}
}
#endif
//=============================================================================
/*
@ -208,7 +143,6 @@ void RulesChangeFunc (void *self)
maptype = MAP_DM;
}
// UI_RefreshMapList (maptype);
Menu_RefreshMapList (maptype);
}
@ -218,9 +152,7 @@ void Menu_StartServerActionFunc (void *self)
int timelimit;
int fraglimit;
int maxclients;
// char *spot;
// strncpy (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 );
@ -238,43 +170,7 @@ void Menu_StartServerActionFunc (void *self)
Cvar_SetValue ("ttctf", s_rules_box.curvalue == 3);
Cvar_SetValue ("gamerules", FS_RoguePath() ? ((s_rules_box.curvalue == 4) ? 2 : 0) : 0);
#if 1
UI_StartServer (startmap, (s_dedicated_box.curvalue != 0));
#else
spot = NULL;
if (s_rules_box.curvalue == 1) // PGM
{
if(Q_stricmp(startmap, "bunk1") == 0)
spot = "start";
else if(Q_stricmp(startmap, "mintro") == 0)
spot = "start";
else if(Q_stricmp(startmap, "fact1") == 0)
spot = "start";
else if(Q_stricmp(startmap, "power1") == 0)
spot = "pstart";
else if(Q_stricmp(startmap, "biggun") == 0)
spot = "bstart";
else if(Q_stricmp(startmap, "hangar1") == 0)
spot = "unitstart";
else if(Q_stricmp(startmap, "city1") == 0)
spot = "unitstart";
else if(Q_stricmp(startmap, "boss1") == 0)
spot = "bosstart";
}
if (spot)
{
if (Com_ServerState())
Cbuf_AddText ("disconnect\n");
Cbuf_AddText (va("gamemap \"*%s$%s\"\n", startmap, spot));
}
else
{
Cbuf_AddText (va("map %s\n", startmap));
}
UI_ForceMenuOff ();
#endif
}
void Menu_StartServer_Init (void)
@ -305,22 +201,6 @@ void Menu_StartServer_Init (void)
int y = 0;
#if 0
UI_BuildMapList (ui_svr_maptype); // was MAP_DM
// levelshot found table
if (ui_svr_mapshotvalid) free(ui_svr_mapshotvalid);
ui_svr_mapshotvalid = malloc( sizeof( byte ) * ( ui_svr_nummaps + 1 ) );
memset( ui_svr_mapshotvalid, 0, sizeof( byte ) * ( ui_svr_nummaps + 1 ) );
// register null levelshot
if (ui_svr_mapshotvalid[ui_svr_nummaps] == M_UNSET) {
if (R_DrawFindPic("/gfx/ui/noscreen.pcx"))
ui_svr_mapshotvalid[ui_svr_nummaps] = M_FOUND;
else
ui_svr_mapshotvalid[ui_svr_nummaps] = M_MISSING;
}
#endif
//
// initialize the menu stuff
//
@ -341,7 +221,7 @@ void Menu_StartServer_Init (void)
s_rules_box.generic.y = y += 2*MENU_LINE_SIZE;
s_rules_box.generic.name = "rules";
//PGM - rogue games only available with rogue DLL.
if (FS_RoguePath())
if ( FS_RoguePath() )
s_rules_box.itemnames = dm_coop_names_rogue;
else
s_rules_box.itemnames = dm_coop_names;
@ -367,7 +247,6 @@ void Menu_StartServer_Init (void)
s_timelimit_field.generic.statusbar = "0 = no limit";
s_timelimit_field.length = 4;
s_timelimit_field.visible_length = 4;
// strncpy(s_timelimit_field.buffer, Cvar_VariableString("timelimit"));
Q_strncpyz (s_timelimit_field.buffer, sizeof(s_timelimit_field.buffer), Cvar_VariableString("timelimit"));
s_timelimit_field.cursor = (int)strlen( s_timelimit_field.buffer );
@ -380,7 +259,6 @@ void Menu_StartServer_Init (void)
s_fraglimit_field.generic.statusbar = "0 = no limit";
s_fraglimit_field.length = 4;
s_fraglimit_field.visible_length = 4;
// strncpy( s_fraglimit_field.buffer, Cvar_VariableString("fraglimit") );
Q_strncpyz (s_fraglimit_field.buffer, sizeof(s_fraglimit_field.buffer), Cvar_VariableString("fraglimit"));
s_fraglimit_field.cursor = (int)strlen( s_fraglimit_field.buffer );
@ -400,10 +278,8 @@ void Menu_StartServer_Init (void)
s_maxclients_field.length = 3;
s_maxclients_field.visible_length = 3;
if ( Cvar_VariableValue( "maxclients" ) == 1 )
// strncpy(s_maxclients_field.buffer, "8");
Q_strncpyz (s_maxclients_field.buffer, sizeof(s_maxclients_field.buffer), "8");
else
// strncpy(s_maxclients_field.buffer, Cvar_VariableString("maxclients"));
Q_strncpyz (s_maxclients_field.buffer, sizeof(s_maxclients_field.buffer), Cvar_VariableString("maxclients"));
s_maxclients_field.cursor = (int)strlen( s_maxclients_field.buffer );
@ -416,7 +292,6 @@ void Menu_StartServer_Init (void)
s_hostname_field.generic.statusbar = NULL;
s_hostname_field.length = 16;
s_hostname_field.visible_length = 16;
// strncpy( s_hostname_field.buffer, Cvar_VariableString("hostname") );
Q_strncpyz (s_hostname_field.buffer, sizeof(s_hostname_field.buffer), Cvar_VariableString("hostname"));
s_hostname_field.cursor = (int)strlen( s_hostname_field.buffer );
@ -471,8 +346,7 @@ void Menu_StartServer_Init (void)
RulesChangeFunc (NULL);
}
#if 1
void DrawStartSeverLevelshot (void)
void Menu_DrawStartSeverLevelshot (void)
{
char *mapshotname = UI_UpdateStartSeverLevelshot (s_startmap_list.curvalue);
@ -483,41 +357,12 @@ void DrawStartSeverLevelshot (void)
else
UI_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, 0,0,0,255);
}
#else
void DrawStartSeverLevelshot (void)
{
char startmap[MAX_QPATH];
char mapshotname [MAX_QPATH];
int i = s_startmap_list.curvalue;
Q_strncpyz (startmap, sizeof(startmap), strchr( ui_svr_mapnames[i], '\n' ) + 1);
UI_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, false, 60,60,60,255);
if ( ui_svr_mapshotvalid[i] == M_UNSET) { // init levelshot
Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", startmap);
if (R_DrawFindPic(mapshotname))
ui_svr_mapshotvalid[i] = M_FOUND;
else
ui_svr_mapshotvalid[i] = M_MISSING;
}
if ( ui_svr_mapshotvalid[i] == M_FOUND) {
Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", startmap);
UI_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, mapshotname, 1.0);
}
else if (ui_svr_mapshotvalid[ui_svr_nummaps] == M_FOUND)
UI_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, "/gfx/ui/noscreen.pcx", 1.0);
else
UI_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, 0,0,0,255);
}
#endif
void Menu_StartServer_Draw (void)
{
UI_DrawBanner ("m_banner_start_server"); // Knightmare added
UI_DrawMenu (&s_startserver_menu);
DrawStartSeverLevelshot (); // added levelshots
Menu_DrawStartSeverLevelshot (); // added levelshots
}
const char *Menu_StartServer_Key (int key)

View file

@ -58,7 +58,6 @@ static menuaction_s s_options_controls_back_action;
static void MouseSpeedFunc (void *unused)
{
// Cvar_SetValue( "sensitivity", s_options_controls_sensitivity_slider.curvalue / 2.0f );
Cvar_SetValue( "sensitivity", UI_MenuSlider_GetValue(&s_options_controls_sensitivity_slider) );
}
@ -75,19 +74,16 @@ static void ThirdPersonFunc (void *unused)
static void ThirdPersonDistFunc (void *unused)
{
// Cvar_SetValue( "cg_thirdperson_dist", (int)(s_options_controls_thirdperson_distance_slider.curvalue * 25) );
Cvar_SetValue( "cg_thirdperson_dist", UI_MenuSlider_GetValue(&s_options_controls_thirdperson_distance_slider) );
}
static void ThirdPersonOffsetFunc (void *unused)
{
// Cvar_SetValue( "cg_thirdperson_offset", (int)(s_options_controls_thirdperson_offset_slider.curvalue * 4) );
Cvar_SetValue( "cg_thirdperson_offset", UI_MenuSlider_GetValue(&s_options_controls_thirdperson_offset_slider) );
}
static void ThirdPersonAngleFunc (void *unused)
{
// Cvar_SetValue( "cg_thirdperson_angle", (int)(s_options_controls_thirdperson_angle_slider.curvalue * 10) );
Cvar_SetValue( "cg_thirdperson_angle", UI_MenuSlider_GetValue(&s_options_controls_thirdperson_angle_slider) );
}
@ -103,7 +99,7 @@ static void InvertMouseFunc (void *unused)
static void AutosensitivityFunc (void *unused)
{
Cvar_SetValue( "autosensitivity", s_options_controls_autosensitivity_box.curvalue );
Cvar_SetValue( "in_autosensitivity", s_options_controls_autosensitivity_box.curvalue );
}
static void LookspringFunc (void *unused)
@ -128,19 +124,15 @@ static void CustomizeControlsFunc(void *unused)
static void ControlsSetMenuItemValues (void)
{
// s_options_controls_sensitivity_slider.curvalue = ( Cvar_VariableValue("sensitivity") ) * 2;
UI_MenuSlider_SetValue (&s_options_controls_sensitivity_slider, Cvar_VariableValue("sensitivity"));
s_options_controls_invertmouse_box.curvalue = Cvar_VariableValue("m_pitch") < 0;
Cvar_SetValue( "autosensitivity", ClampCvar( 0, 1, Cvar_VariableValue("autosensitivity") ) );
s_options_controls_autosensitivity_box.curvalue = Cvar_VariableValue("autosensitivity");
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");
// s_options_controls_thirdperson_distance_slider.curvalue = Cvar_VariableValue("cg_thirdperson_dist") / 25;
// s_options_controls_thirdperson_offset_slider.curvalue = Cvar_VariableValue("cg_thirdperson_offset") / 4;
// s_options_controls_thirdperson_angle_slider.curvalue = Cvar_VariableValue("cg_thirdperson_angle") / 10;
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"));
@ -163,18 +155,18 @@ static void ControlsSetMenuItemValues (void)
static void ControlsResetDefaultsFunc (void *unused)
{
//Cvar_SetToDefault ("sensitivity");
//Cvar_SetToDefault ("m_pitch");
Cvar_SetToDefault ("autosensitivity");
// Cvar_SetToDefault ("sensitivity");
// Cvar_SetToDefault ("m_pitch");
Cvar_SetToDefault ("in_autosensitivity");
Cvar_SetToDefault ("cg_thirdperson");
Cvar_SetToDefault ("cg_thirdperson_dist");
Cvar_SetToDefault ("cg_thirdperson_offset");
Cvar_SetToDefault ("cg_thirdperson_angle");
//Cvar_SetToDefault ("cl_run");
//Cvar_SetToDefault ("lookspring");
//Cvar_SetToDefault ("lookstrafe");
//Cvar_SetToDefault ("freelook");
// Cvar_SetToDefault ("cl_run");
// Cvar_SetToDefault ("lookspring");
// Cvar_SetToDefault ("lookstrafe");
// Cvar_SetToDefault ("freelook");
Cvar_SetToDefault ("in_joystick");
Cbuf_AddText ("exec defaultbinds.cfg\n"); // reset default binds
@ -210,8 +202,6 @@ void Menu_Options_Controls_Init (void)
s_options_controls_sensitivity_slider.generic.y = y;
s_options_controls_sensitivity_slider.generic.name = "mouse speed";
s_options_controls_sensitivity_slider.generic.callback = MouseSpeedFunc;
// s_options_controls_sensitivity_slider.minvalue = 2;
// s_options_controls_sensitivity_slider.maxvalue = 22;
s_options_controls_sensitivity_slider.maxPos = 20;
s_options_controls_sensitivity_slider.baseValue = 1.0f;
s_options_controls_sensitivity_slider.increment = 0.5f;
@ -251,8 +241,6 @@ void Menu_Options_Controls_Init (void)
s_options_controls_thirdperson_distance_slider.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_thirdperson_distance_slider.generic.name = "camera distance";
s_options_controls_thirdperson_distance_slider.generic.callback = ThirdPersonDistFunc;
// s_options_controls_thirdperson_distance_slider.minvalue = 1;
// s_options_controls_thirdperson_distance_slider.maxvalue = 5;
s_options_controls_thirdperson_distance_slider.maxPos = 10;
s_options_controls_thirdperson_distance_slider.baseValue = 25.0f;
s_options_controls_thirdperson_distance_slider.increment = 5.0f;
@ -265,8 +253,6 @@ void Menu_Options_Controls_Init (void)
s_options_controls_thirdperson_offset_slider.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_thirdperson_offset_slider.generic.name = "camera offset";
s_options_controls_thirdperson_offset_slider.generic.callback = ThirdPersonOffsetFunc;
// s_options_controls_thirdperson_offset_slider.minvalue = 0;
// s_options_controls_thirdperson_offset_slider.maxvalue = 8;
s_options_controls_thirdperson_offset_slider.maxPos = 8;
s_options_controls_thirdperson_offset_slider.baseValue = 0.0f;
s_options_controls_thirdperson_offset_slider.increment = 4.0f;
@ -279,8 +265,6 @@ void Menu_Options_Controls_Init (void)
s_options_controls_thirdperson_angle_slider.generic.y = y+=MENU_LINE_SIZE;
s_options_controls_thirdperson_angle_slider.generic.name = "camera angle";
s_options_controls_thirdperson_angle_slider.generic.callback = ThirdPersonAngleFunc;
// s_options_controls_thirdperson_angle_slider.minvalue = 0;
// s_options_controls_thirdperson_angle_slider.maxvalue = 4;
s_options_controls_thirdperson_angle_slider.maxPos = 6;
s_options_controls_thirdperson_angle_slider.baseValue = 0.0f;
s_options_controls_thirdperson_angle_slider.increment = 5.0f;

View file

@ -74,13 +74,11 @@ static void ItemBobFunc (void *unused)
static void ParticleCompFunc (void *unused)
{
// Cvar_SetValue( "cl_particle_scale", (s_options_effects_particle_comp_slider.curvalue-3)*-1+3);
Cvar_SetValue( "cl_particle_scale", UI_MenuSlider_GetValue(&s_options_effects_particle_comp_slider) );
}
static void DecalCallback (void *unused)
{
// Cvar_SetValue( "r_decals", s_options_effects_decal_slider.curvalue * 50);
Cvar_SetValue( "r_decals", UI_MenuSlider_GetValue(&s_options_effects_decal_slider) );
}
@ -92,19 +90,16 @@ static void RailTrailFunc (void *unused)
static void RailColorRedFunc (void *unused)
{
// Cvar_SetValue( "cl_railred", s_options_effects_railcolor_slider[0].curvalue*16 );
Cvar_SetValue( "cl_railred", UI_MenuSlider_GetValue(&s_options_effects_railcolor_slider[0]) );
}
static void RailColorGreenFunc (void *unused)
{
// Cvar_SetValue( "cl_railgreen", s_options_effects_railcolor_slider[1].curvalue*16 );
Cvar_SetValue( "cl_railgreen", UI_MenuSlider_GetValue(&s_options_effects_railcolor_slider[1]) );
}
static void RailColorBlueFunc (void *unused)
{
// Cvar_SetValue( "cl_railblue", s_options_effects_railcolor_slider[2].curvalue*16 );
Cvar_SetValue( "cl_railblue", UI_MenuSlider_GetValue(&s_options_effects_railcolor_slider[2]) );
}
@ -132,18 +127,13 @@ static void EffectsSetMenuItemValues (void)
s_options_effects_itembob_box.curvalue = Cvar_VariableValue("cl_item_bobbing");
Cvar_SetValue( "r_decals", ClampCvar (0, 1000, Cvar_VariableValue("r_decals")) );
// s_options_effects_decal_slider.curvalue = Cvar_VariableValue("r_decals") / 50;
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") ) );
// s_options_effects_particle_comp_slider.curvalue = (Cvar_VariableValue("cl_particle_scale") -3)*-1+3;
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");
// s_options_effects_railcolor_slider[0].curvalue = Cvar_VariableValue("cl_railred")/16;
// s_options_effects_railcolor_slider[1].curvalue = Cvar_VariableValue("cl_railgreen")/16;
// s_options_effects_railcolor_slider[2].curvalue = Cvar_VariableValue("cl_railblue")/16;
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"));
@ -251,8 +241,6 @@ void Options_Effects_MenuInit (void)
s_options_effects_decal_slider.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_decal_slider.generic.name = "decal quantity";
s_options_effects_decal_slider.generic.callback = DecalCallback;
// s_options_effects_decal_slider.minvalue = 0;
// s_options_effects_decal_slider.maxvalue = 20;
s_options_effects_decal_slider.maxPos = 20;
s_options_effects_decal_slider.baseValue = 0.0f;
s_options_effects_decal_slider.increment = 50.0f;
@ -265,8 +253,6 @@ void Options_Effects_MenuInit (void)
s_options_effects_particle_comp_slider.generic.y = y += MENU_LINE_SIZE;
s_options_effects_particle_comp_slider.generic.name = "particle effect complexity";
s_options_effects_particle_comp_slider.generic.callback = ParticleCompFunc;
// s_options_effects_particle_comp_slider.minvalue = 1;
// s_options_effects_particle_comp_slider.maxvalue = 5;
s_options_effects_particle_comp_slider.maxPos = 4;
s_options_effects_particle_comp_slider.baseValue = 5.0f;
s_options_effects_particle_comp_slider.increment = -1.0f;
@ -289,8 +275,6 @@ void Options_Effects_MenuInit (void)
s_options_effects_railcolor_slider[0].generic.y = y += MENU_LINE_SIZE;
s_options_effects_railcolor_slider[0].generic.name = "railtrail - red";
s_options_effects_railcolor_slider[0].generic.callback = RailColorRedFunc;
// s_options_effects_railcolor_slider[0].minvalue = 0;
// s_options_effects_railcolor_slider[0].maxvalue = 16;
s_options_effects_railcolor_slider[0].maxPos = 64;
s_options_effects_railcolor_slider[0].baseValue = 0.0f;
s_options_effects_railcolor_slider[0].increment = 4.0f;
@ -303,8 +287,6 @@ void Options_Effects_MenuInit (void)
s_options_effects_railcolor_slider[1].generic.y = y += MENU_LINE_SIZE;
s_options_effects_railcolor_slider[1].generic.name = "railtrail - green";
s_options_effects_railcolor_slider[1].generic.callback = RailColorGreenFunc;
// s_options_effects_railcolor_slider[1].minvalue = 0;
// s_options_effects_railcolor_slider[1].maxvalue = 16;
s_options_effects_railcolor_slider[1].maxPos = 64;
s_options_effects_railcolor_slider[1].baseValue = 0.0f;
s_options_effects_railcolor_slider[1].increment = 4.0f;
@ -317,8 +299,6 @@ void Options_Effects_MenuInit (void)
s_options_effects_railcolor_slider[2].generic.y = y += MENU_LINE_SIZE;
s_options_effects_railcolor_slider[2].generic.name = "railtrail - blue";
s_options_effects_railcolor_slider[2].generic.callback = RailColorBlueFunc;
// s_options_effects_railcolor_slider[2].minvalue = 0;
// s_options_effects_railcolor_slider[2].maxvalue = 16;
s_options_effects_railcolor_slider[2].maxPos = 64;
s_options_effects_railcolor_slider[2].baseValue = 0.0f;
s_options_effects_railcolor_slider[2].increment = 4.0f;

View file

@ -60,14 +60,12 @@ cvar_t *scr_font;
static void MouseMenuFunc (void *unused)
{
// Cvar_SetValue( "ui_sensitivity", s_options_interface_menumouse_slider.curvalue / 4.0f );
Cvar_SetValue( "ui_sensitivity", UI_MenuSlider_GetValue(&s_options_interface_menumouse_slider) );
}
// menu alpha option
static void MenuAlphaFunc (void *unused)
{
// Cvar_SetValue( "ui_background_alpha", s_options_interface_menualpha_slider.curvalue / 20.0f);
Cvar_SetValue( "ui_background_alpha", UI_MenuSlider_GetValue(&s_options_interface_menualpha_slider) );
}
@ -79,14 +77,12 @@ static void AltTextColorFunc (void *unused)
// Psychospaz's transparent console
static void ConAlphaFunc (void *unused)
{
// Cvar_SetValue( "scr_conalpha", s_options_interface_conalpha_slider.curvalue * 0.05 );
Cvar_SetValue( "scr_conalpha", UI_MenuSlider_GetValue(&s_options_interface_conalpha_slider) );
}
// variable console height
/*static void ConHeightFunc (void *unused)
{
// Cvar_SetValue( "scr_conheight", 0.25 + (s_options_interface_conheight_slider.curvalue * 0.05) );
Cvar_SetValue( "scr_conheight", UI_MenuSlider_GetValue(&s_options_interface_conheight_slider) );
}*/
@ -107,7 +103,6 @@ static void NoAltTabFunc (void *unused)
static void FontSizeFunc (void *unused)
{
// Cvar_SetValue( "con_font_size", s_options_interface_fontsize_slider.curvalue * 2 );
Cvar_SetValue( "con_font_size", UI_MenuSlider_GetValue(&s_options_interface_fontsize_slider) );
}
@ -176,9 +171,6 @@ static void InterfaceSetMenuItemValues (void)
{
SetFontCursor ();
// s_options_interface_menumouse_slider.curvalue = ( Cvar_VariableValue("ui_sensitivity") ) * 4;
// s_options_interface_menualpha_slider.curvalue = ( Cvar_VariableValue("ui_background_alpha") ) * 20;
// s_options_interface_fontsize_slider.curvalue = ( Cvar_VariableValue("con_font_size") ) * 0.5;
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"));
@ -187,11 +179,9 @@ static void InterfaceSetMenuItemValues (void)
s_options_interface_alt_text_color_box.curvalue = Cvar_VariableValue("alt_text_color");
Cvar_SetValue( "scr_conalpha", ClampCvar( 0, 1, Cvar_VariableValue("scr_conalpha") ) );
// s_options_interface_conalpha_slider.curvalue = ( Cvar_VariableValue("scr_conalpha") ) * 20;
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") ) );
// s_options_interface_conheight_slider.curvalue = 20 * (Cvar_VariableValue("scr_conheight") - 0.25);
// 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") ) );
@ -264,8 +254,6 @@ void Options_Interface_MenuInit (void)
s_options_interface_menumouse_slider.generic.y = y;
s_options_interface_menumouse_slider.generic.name = "mouse speed";
s_options_interface_menumouse_slider.generic.callback = MouseMenuFunc;
// s_options_interface_menumouse_slider.minvalue = 1;
// s_options_interface_menumouse_slider.maxvalue = 8;
s_options_interface_menumouse_slider.maxPos = 7;
s_options_interface_menumouse_slider.baseValue = 0.25f;
s_options_interface_menumouse_slider.increment = 0.25f;
@ -278,23 +266,12 @@ void Options_Interface_MenuInit (void)
s_options_interface_menualpha_slider.generic.y = y+=MENU_LINE_SIZE;
s_options_interface_menualpha_slider.generic.name = "ingame menu transparency";
s_options_interface_menualpha_slider.generic.callback = MenuAlphaFunc;
// s_options_interface_menualpha_slider.minvalue = 0;
// s_options_interface_menualpha_slider.maxvalue = 20;
s_options_interface_menualpha_slider.maxPos = 20;
s_options_interface_menualpha_slider.baseValue = 0.0f;
s_options_interface_menualpha_slider.increment = 0.05f;
s_options_interface_menualpha_slider.displayAsPercent = true;
s_options_interface_menualpha_slider.generic.statusbar = "changes opacity of menu background";
#if 0
// free any loaded fonts to prevent memory leak
if (ui_numfonts > 0) {
FS_FreeFileList (ui_font_names, ui_numfonts);
}
ui_numfonts = 0;
ui_font_names = UI_SetFontNames ();
#endif
s_options_interface_confont_box.generic.type = MTYPE_SPINCONTROL;
s_options_interface_confont_box.generic.textSize = MENU_FONT_SIZE;
s_options_interface_confont_box.generic.x = 0;
@ -310,8 +287,6 @@ void Options_Interface_MenuInit (void)
s_options_interface_fontsize_slider.generic.y = y+=MENU_LINE_SIZE;
s_options_interface_fontsize_slider.generic.name = "console font size";
s_options_interface_fontsize_slider.generic.callback = FontSizeFunc;
// s_options_interface_fontsize_slider.minvalue = 3;
// s_options_interface_fontsize_slider.maxvalue = 8;
s_options_interface_fontsize_slider.maxPos = 5;
s_options_interface_fontsize_slider.baseValue = 6.0f;
s_options_interface_fontsize_slider.increment = 2.0f;
@ -351,8 +326,6 @@ void Options_Interface_MenuInit (void)
s_options_interface_conalpha_slider.generic.y = y+=2*MENU_LINE_SIZE;
s_options_interface_conalpha_slider.generic.name = "console transparency";
s_options_interface_conalpha_slider.generic.callback = ConAlphaFunc;
// s_options_interface_conalpha_slider.minvalue = 0;
// s_options_interface_conalpha_slider.maxvalue = 20;
s_options_interface_conalpha_slider.maxPos = 20;
s_options_interface_conalpha_slider.baseValue = 0.0f;
s_options_interface_conalpha_slider.increment = 0.05f;
@ -366,8 +339,6 @@ void Options_Interface_MenuInit (void)
s_options_interface_conheight_slider.generic.y = y+=MENU_LINE_SIZE;
s_options_interface_conheight_slider.generic.name = "console height";
s_options_interface_conheight_slider.generic.callback = ConHeightFunc;
// s_options_interface_conheight_slider.minvalue = 0;
// s_options_interface_conheight_slider.maxvalue = 10;
s_options_interface_conheight_slider.maxPos = 10;
s_options_interface_conheight_slider.baseValue = 0.25f;
s_options_interface_conheight_slider.increment = 0.05f;

View file

@ -54,33 +54,28 @@ static menuaction_s s_options_screen_back_action;
// Psychospaz's changeable size crosshair
static void CrosshairSizeFunc (void *unused)
{
// Cvar_SetValue( "crosshair_scale", s_options_screen_crosshairscale_slider.curvalue*0.25);
Cvar_SetValue( "crosshair_scale", UI_MenuSlider_GetValue(&s_options_screen_crosshairscale_slider) );
}
static void CrosshairAlphaFunc (void *unused)
{
// Cvar_SetValue( "crosshair_alpha", s_options_screen_crosshairalpha_slider.curvalue*0.05);
Cvar_SetValue( "crosshair_alpha", UI_MenuSlider_GetValue(&s_options_screen_crosshairalpha_slider) );
}
static void CrosshairPulseFunc (void *unused)
{
// Cvar_SetValue( "crosshair_pulse", s_options_screen_crosshairpulse_slider.curvalue*0.05);
Cvar_SetValue( "crosshair_pulse", UI_MenuSlider_GetValue(&s_options_screen_crosshairpulse_slider) );
}
// hud scaling option
static void HudScaleFunc (void *unused)
{
// Cvar_SetValue( "scr_hudsize", s_options_screen_hudscale_slider.curvalue);
Cvar_SetValue( "scr_hudsize", UI_MenuSlider_GetValue(&s_options_screen_hudscale_slider) );
}
// hud trans option
static void HudAlphaFunc (void *unused)
{
// Cvar_SetValue( "scr_hudalpha", (s_options_screen_hudalpha_slider.curvalue-1)/10);
Cvar_SetValue( "scr_hudalpha", UI_MenuSlider_GetValue(&s_options_screen_hudalpha_slider) );
}
@ -139,27 +134,21 @@ void SetCrosshairCursor (void)
static void ScreenSetMenuItemValues (void)
{
Cvar_SetValue( "crosshair", ClampCvar( 0, 100, Cvar_VariableValue("crosshair") ) );
//s_options_crosshair_box.curvalue = Cvar_VariableValue("crosshair");
SetCrosshairCursor ();
Cvar_SetValue( "crosshair_scale", ClampCvar( 0.25, 5, Cvar_VariableValue("crosshair_scale") ) );
// s_options_screen_crosshairscale_slider.curvalue = Cvar_VariableValue("crosshair_scale")*4;
UI_MenuSlider_SetValue (&s_options_screen_crosshairscale_slider, Cvar_VariableValue("crosshair_scale"));
Cvar_SetValue( "crosshair_alpha", ClampCvar( 0.05, 1, Cvar_VariableValue("crosshair_alpha") ) );
// s_options_screen_crosshairalpha_slider.curvalue = Cvar_VariableValue("crosshair_alpha")*20;
UI_MenuSlider_SetValue (&s_options_screen_crosshairalpha_slider, Cvar_VariableValue("crosshair_alpha"));
Cvar_SetValue( "crosshair_pulse", ClampCvar( 0, 0.5, Cvar_VariableValue("crosshair_pulse") ) );
// s_options_screen_crosshairpulse_slider.curvalue = Cvar_VariableValue("crosshair_pulse")*20;
UI_MenuSlider_SetValue (&s_options_screen_crosshairpulse_slider, Cvar_VariableValue("crosshair_pulse"));
Cvar_SetValue( "scr_hudsize", ClampCvar( 0, 8, Cvar_VariableValue("scr_hudsize") ) );
// s_options_screen_hudscale_slider.curvalue = 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") ) );
// s_options_screen_hudalpha_slider.curvalue = Cvar_VariableValue("scr_hudalpha")*10 + 1;
UI_MenuSlider_SetValue (&s_options_screen_hudalpha_slider, Cvar_VariableValue("scr_hudalpha"));
Cvar_SetValue( "scr_hudsqueezedigits", ClampCvar( 0, 1, Cvar_VariableValue("scr_hudsqueezedigits") ) );
@ -204,15 +193,6 @@ void Menu_Options_Screen_Init (void)
s_options_screen_header.generic.x = MENU_HEADER_FONT_SIZE/2 * (int)strlen(s_options_screen_header.generic.name);
s_options_screen_header.generic.y = -2*MENU_LINE_SIZE; // 0
#if 0
// free any loaded crosshairs to prevent memory leak
if (ui_numcrosshairs > 0) {
FS_FreeFileList (ui_crosshair_names, ui_numcrosshairs);
}
ui_numcrosshairs = 0;
ui_crosshair_names = UI_SetCrosshairNames ();
#endif
s_options_screen_crosshair_box.generic.type = MTYPE_SPINCONTROL;
s_options_screen_crosshair_box.generic.textSize = MENU_FONT_SIZE;
s_options_screen_crosshair_box.generic.x = 0;
@ -229,8 +209,6 @@ void Menu_Options_Screen_Init (void)
s_options_screen_crosshairscale_slider.generic.y = y += 5*MENU_LINE_SIZE;
s_options_screen_crosshairscale_slider.generic.name = "crosshair scale";
s_options_screen_crosshairscale_slider.generic.callback = CrosshairSizeFunc;
// s_options_screen_crosshairscale_slider.minvalue = 1;
// s_options_screen_crosshairscale_slider.maxvalue = 20;
s_options_screen_crosshairscale_slider.maxPos = 19;
s_options_screen_crosshairscale_slider.baseValue = 0.25f;
s_options_screen_crosshairscale_slider.increment = 0.25f;
@ -243,8 +221,6 @@ void Menu_Options_Screen_Init (void)
s_options_screen_crosshairalpha_slider.generic.y = y += MENU_LINE_SIZE;
s_options_screen_crosshairalpha_slider.generic.name = "crosshair alpha";
s_options_screen_crosshairalpha_slider.generic.callback = CrosshairAlphaFunc;
// s_options_screen_crosshairalpha_slider.minvalue = 1;
// s_options_screen_crosshairalpha_slider.maxvalue = 20;
s_options_screen_crosshairalpha_slider.maxPos = 19;
s_options_screen_crosshairalpha_slider.baseValue = 0.05f;
s_options_screen_crosshairalpha_slider.increment = 0.05f;
@ -257,8 +233,6 @@ void Menu_Options_Screen_Init (void)
s_options_screen_crosshairpulse_slider.generic.y = y += MENU_LINE_SIZE;
s_options_screen_crosshairpulse_slider.generic.name = "crosshair pulse";
s_options_screen_crosshairpulse_slider.generic.callback = CrosshairPulseFunc;
// s_options_screen_crosshairpulse_slider.minvalue = 0;
// s_options_screen_crosshairpulse_slider.maxvalue = 10;
s_options_screen_crosshairpulse_slider.maxPos = 10;
s_options_screen_crosshairpulse_slider.baseValue = 0.0f;
s_options_screen_crosshairpulse_slider.increment = 0.05f;
@ -272,8 +246,6 @@ void Menu_Options_Screen_Init (void)
s_options_screen_hudscale_slider.generic.y = y += 2*MENU_LINE_SIZE;
s_options_screen_hudscale_slider.generic.name = "status bar scale";
s_options_screen_hudscale_slider.generic.callback = HudScaleFunc;
// s_options_screen_hudscale_slider.minvalue = 0;
// s_options_screen_hudscale_slider.maxvalue = 8;
s_options_screen_hudscale_slider.maxPos = 8;
s_options_screen_hudscale_slider.baseValue = 0.0f;
s_options_screen_hudscale_slider.increment = 1.0f;
@ -287,8 +259,6 @@ void Menu_Options_Screen_Init (void)
s_options_screen_hudalpha_slider.generic.y = y += MENU_LINE_SIZE;
s_options_screen_hudalpha_slider.generic.name = "status bar transparency";
s_options_screen_hudalpha_slider.generic.callback = HudAlphaFunc;
// s_options_screen_hudalpha_slider.minvalue = 1;
// s_options_screen_hudalpha_slider.maxvalue = 11;
s_options_screen_hudalpha_slider.maxPos = 20;
s_options_screen_hudalpha_slider.baseValue = 0.0f;
s_options_screen_hudalpha_slider.increment = 0.05f;

View file

@ -51,13 +51,11 @@ static menuaction_s s_options_sound_back_action;
static void UpdateVolumeFunc (void *unused)
{
// Cvar_SetValue( "s_volume", s_options_sound_sfxvolume_slider.curvalue / 10 );
Cvar_SetValue( "s_volume", UI_MenuSlider_GetValue(&s_options_sound_sfxvolume_slider) );
}
static void UpdateMusicVolumeFunc (void *unused)
{
// Cvar_SetValue( "s_musicvolume", s_options_sound_musicvolume_slider.curvalue / 10 );
Cvar_SetValue( "s_musicvolume", UI_MenuSlider_GetValue(&s_options_sound_musicvolume_slider) );
}
@ -111,14 +109,11 @@ static void UpdateSoundQualityFunc (void *unused)
static void SoundSetMenuItemValues (void)
{
// s_options_sound_sfxvolume_slider.curvalue = Cvar_VariableValue("s_volume") * 10;
// s_options_sound_musicvolume_slider.curvalue = Cvar_VariableValue("s_musicvolume") * 10;
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");
//s_options_sound_quality_list.curvalue = !Cvar_VariableValue( "s_loadas8bit" );
//** DMP convert setting into index for option display text
switch((int)Cvar_VariableValue("s_khz"))
{
@ -194,9 +189,6 @@ void Menu_Options_Sound_Init (void)
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.minvalue = 0;
// s_options_sound_sfxvolume_slider.maxvalue = 10;
// s_options_sound_sfxvolume_slider.curvalue = Cvar_VariableValue( "s_volume" ) * 10;
s_options_sound_sfxvolume_slider.maxPos = 20;
s_options_sound_sfxvolume_slider.baseValue = 0.0f;
s_options_sound_sfxvolume_slider.increment = 0.05f;
@ -210,9 +202,6 @@ void Menu_Options_Sound_Init (void)
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.minvalue = 0;
// s_options_sound_musicvolume_slider.maxvalue = 10;
// s_options_sound_musicvolume_slider.curvalue = Cvar_VariableValue( "s_musicvolume" ) * 10;
s_options_sound_musicvolume_slider.maxPos = 20;
s_options_sound_musicvolume_slider.baseValue = 0.0f;
s_options_sound_musicvolume_slider.increment = 0.05f;

View file

@ -63,16 +63,17 @@ static menuaction_s s_backmain_action;
static void VidModeCallback (void *unused)
{
s_customwidth_title.generic.flags = (s_mode_list.curvalue != 0) ? QMF_HIDDEN : 0;
s_customwidth_field.generic.flags = (s_mode_list.curvalue != 0) ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
s_customheight_title.generic.flags = (s_mode_list.curvalue != 0) ? QMF_HIDDEN : 0;
s_customheight_field.generic.flags = (s_mode_list.curvalue != 0) ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
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;
s_customheight_title.generic.flags = customHidden ? QMF_HIDDEN : 0;
s_customheight_field.generic.flags = customHidden ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
}
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", (1.3 - (s_brightness_slider.curvalue/20.0f)) );
Cvar_SetValue( "vid_gamma", UI_MenuSlider_GetValue(&s_brightness_slider) );
}
@ -131,7 +132,6 @@ static void ResetVideoDefaults (void *unused)
Cvar_SetToDefault ("r_shelltype");
Cvar_SetToDefault ("r_celshading");
Cvar_SetToDefault ("r_celshading_width");
// Cvar_SetToDefault ("r_screenshot_jpeg");
Cvar_SetToDefault ("r_screenshot_format");
Cvar_SetToDefault ("r_screenshot_jpeg_quality");
Cvar_SetToDefault ("r_saveshotsize");
@ -140,7 +140,7 @@ static void ResetVideoDefaults (void *unused)
Menu_Video_Init();
}
static void prepareVideoRefresh (void)
static void Menu_PrepareVideoRefresh (void)
{
// set the right mode for refresh
Cvar_Set( "vid_ref", "gl" );
@ -151,32 +151,29 @@ static void prepareVideoRefresh (void)
}
static void ApplyChanges (void *unused)
static void Menu_ApplyVideoChanges (void *unused)
{
int temp, customW, customH;
int customW, customH;
char *customStr;
temp = s_mode_list.curvalue;
Cvar_SetValue( "r_mode", (temp == 0) ? -1 : temp + 2 ); // offset for eliminating < 640x480 modes
if (temp == 0) // Knightmare- use custom mode fields
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
{
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_SetValue ("r_customwidth", ClampCvar( 640, 99999, customW ));
Cvar_SetValue ("r_customheight", ClampCvar( 480, 99999, customH ));
// update fields in case values were clamped
customStr = Cvar_VariableString("r_customwidth");
Q_strncpyz (s_customwidth_field.buffer, sizeof(s_customwidth_field.buffer), customStr);
s_customwidth_field.cursor = (int)strlen( customStr );
s_customwidth_field.cursor = (int)strlen(customStr);
customStr = Cvar_VariableString("r_customheight");
Q_strncpyz (s_customheight_field.buffer, sizeof(s_customwidth_field.buffer), customStr);
s_customheight_field.cursor = (int)strlen( customStr );
s_customheight_field.cursor = (int)strlen(customStr);
}
Cvar_SetValue( "vid_fullscreen", s_fs_box.curvalue );
// invert sense so greater = brighter, and scale to a range of 0.3 to 1.3
// Cvar_SetValue( "vid_gamma", (1.3 - (s_brightness_slider.curvalue/20.0)) );
Cvar_SetValue( "vid_gamma", UI_MenuSlider_GetValue(&s_brightness_slider) );
Cvar_SetValue( "r_picmip", 4-s_texqual_box.curvalue );
@ -254,14 +251,14 @@ static void ApplyChanges (void *unused)
Cvar_SetValue( "cl_widescreen_fov", s_adjust_fov_box.curvalue );
Cvar_SetValue( "cl_async", s_async_box.curvalue );
prepareVideoRefresh ();
Menu_PrepareVideoRefresh ();
//UI_ForceMenuOff();
// UI_ForceMenuOff();
}
// Knightmare added
int texfilter_box_setval (void)
int Menu_GetTexfilterCurValue (void)
{
char *texmode = Cvar_VariableString("r_texturemode");
if (!Q_strcasecmp(texmode, "GL_LINEAR_MIPMAP_NEAREST"))
@ -270,10 +267,11 @@ int texfilter_box_setval (void)
return 1;
}
// Knightmare- refresh rate option
int refresh_box_setval (void)
int Menu_GetRefreshCurValue (void)
{
int refreshVar = (int)Cvar_VariableValue ("r_displayrefresh");
int refreshVar = Cvar_VariableInteger ("r_displayrefresh");
if (refreshVar == 240)
return 14;
@ -307,66 +305,13 @@ int refresh_box_setval (void)
return 0;
}
static const char *aniso0_names[] =
{
"not supported",
0
};
static const char *aniso2_names[] =
{
"off",
"2x",
0
};
static const char *aniso4_names[] =
{
"off",
"2x",
"4x",
0
};
static const char *aniso8_names[] =
{
"off",
"2x",
"4x",
"8x",
0
};
static const char *aniso16_names[] =
{
"off",
"2x",
"4x",
"8x",
"16x",
0
};
static const char **GetAnisoNames (void)
{
float aniso_avail = Cvar_VariableValue("r_anisotropic_avail");
if (aniso_avail < 2.0)
return aniso0_names;
else if (aniso_avail < 4.0)
return aniso2_names;
else if (aniso_avail < 8.0)
return aniso4_names;
else if (aniso_avail < 16.0)
return aniso8_names;
else // >= 16.0
return aniso16_names;
}
float GetAnisoCurValue (void)
// 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)
@ -389,10 +334,6 @@ Menu_Video_Init
*/
void Menu_Video_Init (void)
{
static const char *resolutions[] =
{
#include "../qcommon/vid_resolutions.h"
};
static const char *fullscreen_names[] =
{
"windowed",
@ -440,9 +381,9 @@ void Menu_Video_Init (void)
"highest",
0
};
int y = 0;
float temp;
char *customStr;
int y = 0;
char *customStr;
qboolean customHidden;
if ( !con_font_size )
con_font_size = Cvar_Get ("con_font_size", "8", CVAR_ARCHIVE);
@ -457,22 +398,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 = resolutions;
s_mode_list.itemnames = ui_resolution_names;
s_mode_list.generic.callback = VidModeCallback;
temp = Cvar_VariableValue("r_mode");
s_mode_list.curvalue = (temp == -1) ? 0 : max(temp - 2, 1); // offset for getting rid of < 640x480 resolutions
s_mode_list.curvalue = UI_GetIndexForStringValue(ui_video_modes, Cvar_VariableString("r_mode"));
s_mode_list.generic.statusbar = "changes screen resolution";
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 = (s_mode_list.curvalue != 0) ? QMF_HIDDEN : 0;
s_customwidth_title.generic.flags = customHidden ? QMF_HIDDEN : 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 = (s_mode_list.curvalue != 0) ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
s_customwidth_field.generic.flags = customHidden ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
// s_customwidth_field.generic.name = "custom width";
s_customwidth_field.generic.callback = 0;
s_customwidth_field.generic.x = -14*MENU_FONT_SIZE;
@ -485,14 +426,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 = (s_mode_list.curvalue != 0) ? QMF_HIDDEN : 0;
s_customheight_title.generic.flags = customHidden ? QMF_HIDDEN : 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 = (s_mode_list.curvalue != 0) ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
s_customheight_field.generic.flags = customHidden ? (QMF_NUMBERSONLY|QMF_HIDDEN) : QMF_NUMBERSONLY;
// s_customheight_field.generic.name = "custom height";
s_customheight_field.generic.callback = 0;
s_customheight_field.generic.x = 2*MENU_FONT_SIZE;
@ -519,9 +460,6 @@ void Menu_Video_Init (void)
s_brightness_slider.generic.y = y += MENU_LINE_SIZE;
s_brightness_slider.generic.name = "brightness";
s_brightness_slider.generic.callback = BrightnessCallback;
// s_brightness_slider.minvalue = 0;
// s_brightness_slider.maxvalue = 20;
// s_brightness_slider.curvalue = (1.3 - Cvar_VariableValue("vid_gamma")) * 20;
s_brightness_slider.maxPos = 20;
s_brightness_slider.baseValue = 1.3f;
s_brightness_slider.increment = -0.05f;
@ -534,7 +472,7 @@ void Menu_Video_Init (void)
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 = texfilter_box_setval();
s_texfilter_box.curvalue = Menu_GetTexfilterCurValue();
s_texfilter_box.itemnames = mip_names;
s_texfilter_box.generic.statusbar = "changes texture filtering mode";
@ -543,8 +481,8 @@ void Menu_Video_Init (void)
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 = GetAnisoCurValue();
s_aniso_box.itemnames = GetAnisoNames();
s_aniso_box.curvalue = Menu_GetAnisoCurValue();
s_aniso_box.itemnames = ui_aniso_names;
s_aniso_box.generic.statusbar = "changes level of anisotropic mipmap filtering";
s_texqual_box.generic.type = MTYPE_SPINCONTROL;
@ -599,7 +537,7 @@ 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 = refresh_box_setval();
s_refresh_box.curvalue = Menu_GetRefreshCurValue();
s_refresh_box.itemnames = refreshrate_names;
s_refresh_box.generic.statusbar = "sets refresh rate for fullscreen modes";
@ -644,7 +582,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 = ApplyChanges;
s_apply_action.generic.callback = Menu_ApplyVideoChanges;
s_backmain_action.generic.type = MTYPE_ACTION;
s_backmain_action.generic.textSize = MENU_FONT_SIZE;

View file

@ -76,11 +76,9 @@ static void Video_Advanced_MenuSetValues (void)
char *sshotformat;
Cvar_SetValue ("r_modulate", ClampCvar( 1, 2, Cvar_VariableValue("r_modulate") ));
// s_lightmapscale_slider.curvalue = (Cvar_VariableValue("r_modulate") - 1) * 10;
UI_MenuSlider_SetValue (&s_lightmapscale_slider, Cvar_VariableValue("r_modulate"));
Cvar_SetValue ("r_intensity", ClampCvar( 1, 2, Cvar_VariableValue("r_intensity") ));
// s_textureintensity_slider.curvalue = (Cvar_VariableValue("r_intensity") - 1) * 10;
UI_MenuSlider_SetValue (&s_textureintensity_slider, Cvar_VariableValue("r_intensity"));
Cvar_SetValue ("r_rgbscale", ClampCvar( 1, 2, Cvar_VariableValue("r_rgbscale") ));
@ -96,7 +94,6 @@ static void Video_Advanced_MenuSetValues (void)
s_warp_lighting_box.curvalue = Cvar_VariableValue("r_warp_lighting");
Cvar_SetValue ("r_lightcutoff", ClampCvar( 0, 64, Cvar_VariableValue("r_lightcutoff") ));
// s_lightcutoff_slider.curvalue = Cvar_VariableValue("r_lightcutoff") / 8.0f;
UI_MenuSlider_SetValue (&s_lightcutoff_slider, Cvar_VariableValue("r_lightcutoff"));
Cvar_SetValue ("r_glass_envmaps", ClampCvar( 0, 1, Cvar_VariableValue("r_glass_envmaps") ));
@ -109,7 +106,6 @@ static void Video_Advanced_MenuSetValues (void)
s_texshader_warp_box.curvalue = Cvar_VariableValue("r_pixel_shader_warp");
Cvar_SetValue ("r_waterwave", ClampCvar( 0, 24, Cvar_VariableValue("r_waterwave") ));
// s_waterwave_slider.curvalue = 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") ));
@ -137,7 +133,6 @@ static void Video_Advanced_MenuSetValues (void)
s_celshading_box.curvalue = Cvar_VariableValue("r_celshading");
Cvar_SetValue ("r_celshading_width", ClampCvar( 1, 12, Cvar_VariableValue("r_celshading_width") ));
// s_celshading_width_slider.curvalue = Cvar_VariableValue("r_celshading_width") - 1;
UI_MenuSlider_SetValue (&s_celshading_width_slider, Cvar_VariableValue("r_celshading_width"));
sshotformat = Cvar_VariableString("r_screenshot_format");
@ -149,7 +144,6 @@ static void Video_Advanced_MenuSetValues (void)
s_screenshotformat_box.curvalue = 2;
Cvar_SetValue ("r_screenshot_jpeg_quality", ClampCvar( 50, 100, Cvar_VariableValue("r_screenshot_jpeg_quality") ));
// s_screenshotjpegquality_slider.curvalue = (Cvar_VariableValue("r_screenshot_jpeg_quality") - 50) / 5;
UI_MenuSlider_SetValue (&s_screenshotjpegquality_slider, Cvar_VariableValue("r_screenshot_jpeg_quality"));
Cvar_SetValue ("r_saveshotsize", ClampCvar( 0, 1, Cvar_VariableValue("r_saveshotsize") ));
@ -161,13 +155,11 @@ static void Video_Advanced_MenuSetValues (void)
static void LightMapScaleCallback (void *unused)
{
// Cvar_SetValue ("r_modulate", s_lightmapscale_slider.curvalue / 10 + 1);
Cvar_SetValue ("r_modulate", UI_MenuSlider_GetValue(&s_lightmapscale_slider) );
}
static void TextureIntensCallback (void *unused)
{
// Cvar_SetValue ("r_intensity", s_textureintensity_slider.curvalue / 10 + 1);
Cvar_SetValue ("r_intensity", UI_MenuSlider_GetValue(&s_textureintensity_slider));
}
@ -188,7 +180,6 @@ static void WarpLightingCallback (void *unused)
static void LightCutoffCallback(void *unused)
{
// Cvar_SetValue ("r_lightcutoff", s_lightcutoff_slider.curvalue * 8.0f);
Cvar_SetValue ("r_lightcutoff", UI_MenuSlider_GetValue(&s_lightcutoff_slider));
}
@ -209,7 +200,6 @@ static void TexShaderWarpCallback (void *unused)
static void WaterWaveCallback (void *unused)
{
// Cvar_SetValue ("r_waterwave", s_waterwave_slider.curvalue);
Cvar_SetValue ("r_waterwave", UI_MenuSlider_GetValue(&s_waterwave_slider));
}
@ -255,7 +245,6 @@ static void CelShadingCallback (void *unused)
static void CelShadingWidthCallback (void *unused)
{
// Cvar_SetValue ("r_celshading_width", s_celshading_width_slider.curvalue + 1);
Cvar_SetValue ("r_celshading_width", UI_MenuSlider_GetValue(&s_celshading_width_slider));
}
@ -390,8 +379,6 @@ void Menu_Video_Advanced_Init (void)
s_lightmapscale_slider.generic.y = y += 2*MENU_LINE_SIZE;
s_lightmapscale_slider.generic.name = "lightmap scale";
s_lightmapscale_slider.generic.callback = LightMapScaleCallback;
// s_lightmapscale_slider.minvalue = 0;
// s_lightmapscale_slider.maxvalue = 10;
s_lightmapscale_slider.maxPos = 10;
s_lightmapscale_slider.baseValue = 1.0f;
s_lightmapscale_slider.increment = 0.1f;
@ -404,8 +391,6 @@ void Menu_Video_Advanced_Init (void)
s_textureintensity_slider.generic.y = y += MENU_LINE_SIZE;
s_textureintensity_slider.generic.name = "texture intensity";
s_textureintensity_slider.generic.callback = TextureIntensCallback;
// s_textureintensity_slider.minvalue = 0;
// s_textureintensity_slider.maxvalue = 10;
s_textureintensity_slider.maxPos = 10;
s_textureintensity_slider.baseValue = 1.0f;
s_textureintensity_slider.increment = 0.1f;
@ -445,8 +430,6 @@ void Menu_Video_Advanced_Init (void)
s_lightcutoff_slider.generic.y = y += MENU_LINE_SIZE;
s_lightcutoff_slider.generic.name = "dynamic light cutoff";
s_lightcutoff_slider.generic.callback = LightCutoffCallback;
// s_lightcutoff_slider.minvalue = 0;
// s_lightcutoff_slider.maxvalue = 8;
s_lightcutoff_slider.maxPos = 8;
s_lightcutoff_slider.baseValue = 0.0f;
s_lightcutoff_slider.increment = 8.0f;
@ -486,8 +469,6 @@ void Menu_Video_Advanced_Init (void)
s_waterwave_slider.generic.y = y += MENU_LINE_SIZE;
s_waterwave_slider.generic.name = "water wave size";
s_waterwave_slider.generic.callback = WaterWaveCallback;
// s_waterwave_slider.minvalue = 0;
// s_waterwave_slider.maxvalue = 24;
s_waterwave_slider.maxPos = 24;
s_waterwave_slider.baseValue = 0.0f;
s_waterwave_slider.increment = 1.0f;
@ -572,8 +553,6 @@ void Menu_Video_Advanced_Init (void)
s_celshading_width_slider.generic.y = y += MENU_LINE_SIZE;
s_celshading_width_slider.generic.name = "cel shading width";
s_celshading_width_slider.generic.callback = CelShadingWidthCallback;
// s_celshading_width_slider.minvalue = 0;
// s_celshading_width_slider.maxvalue = 11;
s_celshading_width_slider.maxPos = 11;
s_celshading_width_slider.baseValue = 1.0f;
s_celshading_width_slider.increment = 1.0f;
@ -595,8 +574,6 @@ void Menu_Video_Advanced_Init (void)
s_screenshotjpegquality_slider.generic.y = y += MENU_LINE_SIZE;
s_screenshotjpegquality_slider.generic.name = "JPEG screenshot quality";
s_screenshotjpegquality_slider.generic.callback = JPEGScreenshotQualityCallback;
// s_screenshotjpegquality_slider.minvalue = 0;
// s_screenshotjpegquality_slider.maxvalue = 10;
s_screenshotjpegquality_slider.maxPos = 10;
s_screenshotjpegquality_slider.baseValue = 50.0f;
s_screenshotjpegquality_slider.increment = 5.0f;

View file

@ -116,10 +116,6 @@ typedef struct
{
menucommon_s generic;
// float minvalue;
// float maxvalue;
// float curvalue;
// Knightmare added
unsigned int maxPos;
int curPos;
@ -232,6 +228,12 @@ extern cursor_t ui_mousecursor;
//
// ui_utils.c
//
extern char **ui_resolution_names;
extern char **ui_video_modes;
extern char **ui_aniso_names;
//extern char **ui_aniso_values;
extern char **ui_font_names;
extern int ui_numfonts;
@ -323,6 +325,7 @@ extern struct image_s *ui_playerskin;
//=======================================================
qboolean UI_IsValidImageFilename (char *name);
int UI_GetIndexForStringValue (const char **item_values, char *value);
int UI_MouseOverAlpha (menucommon_s *m);
void *UI_ItemAtMenuCursor (menuframework_s *m);
void UI_SetMenuStatusBar (menuframework_s *s, const char *string);
@ -331,7 +334,9 @@ int UI_TallyMenuSlots (menuframework_s *menu);
void UIStartSPGame (void);
void UI_StartServer (char *startmap, qboolean dedicated);
//char **UI_SetFontNames (void);
void UI_GetVideoInfo (void);
void UI_FreeVideoInfo (void);
void UI_LoadFontNames (void);
void UI_FreeFontNames (void);
@ -339,7 +344,6 @@ void UI_FreeFontNames (void);
//void UI_FreeHudNames (void);
void UI_SortCrosshairs (char **list, int len);
//char **UI_SetCrosshairNames (void);
void UI_LoadCrosshairs (void);
void UI_FreeCrosshairs (void);

View file

@ -239,11 +239,12 @@ void UI_Init (void)
Cvar_SetDescription ("ui_item_rotate", "Reverses direction of mouse click rotation for menu lists.");
ui_cursor_scale = Cvar_Get ("ui_cursor_scale", "0.4", 0);
Cvar_SetDescription ("ui_cursor_scale", "Sets scale for drawing the menu mouse cursor.");
ui_new_textbox = Cvar_Get ("ui_new_textbox", "1", 0);
ui_new_textbox = Cvar_Get ("ui_new_textbox", "1", CVAR_ARCHIVE);
Cvar_SetDescription ("ui_new_textbox", "Toggles use of new text box image. Setting this to 0 uses old font-based tiles.");
ui_new_textfield = Cvar_Get ("ui_new_textfield", "1", 0);
ui_new_textfield = Cvar_Get ("ui_new_textfield", "1", CVAR_ARCHIVE);
Cvar_SetDescription ("ui_new_textfield", "Toggles use of new text field image. Setting this to 0 uses old font-based tiles.");
UI_GetVideoInfo (); // build video mode list
UI_LoadFontNames (); // load font list
// UI_LoadHudNames (); // load hud list
UI_LoadCrosshairs (); // load crosshairs
@ -293,6 +294,7 @@ void UI_Shutdown (void)
if (!ui_initialized)
return;
UI_FreeVideoInfo ();
UI_FreeFontNames ();
// UI_FreeHudNames ();
UI_FreeCrosshairs ();

View file

@ -118,6 +118,30 @@ qboolean UI_IsValidImageFilename (char *name)
return false;
}
/*
==========================
UI_GetIndexForStringValue
==========================
*/
int UI_GetIndexForStringValue (const char **item_values, char *value)
{
int i, index = 0;
// catch null array
if (!item_values) {
Com_Printf ("UI_GetIndexForStringValue: null itemValues!\n");
return 0;
}
for (i=0; item_values[i]; i++)
if ( !Q_strcasecmp(va("%s",item_values[i]), value) )
{ index = i; break; }
return index;
}
/*
==========================
UI_MouseOverAlpha
@ -270,6 +294,210 @@ void UI_StartServer (char *startmap, qboolean dedicated)
// UI_ForceMenuOff ();
}
/*
=======================================================================
VIDEO INFO LOADING
=======================================================================
*/
#define UI_MAX_VIDMODES 128
char **ui_resolution_names = NULL;
char **ui_video_modes = NULL;
int ui_num_video_modes = 0;
/*
==========================
UI_GetVideoModes
==========================
*/
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;
// count video modes >= 640x480
for (i=0; i<UI_MAX_VIDMODES; i++)
{
if ( !VID_GetModeInfo(&w, &h, i) )
break;
if (w >= 640 && h >= 480) {
numModes++;
if (numModes == 1)
firstMode = i;
}
}
// allocate lists
ui_resolution_names = malloc ((numModes+2) * sizeof(char *));
memset (ui_resolution_names, 0, (numModes+2) * sizeof(char *));
ui_video_modes = malloc ((numModes+2) * sizeof(char *));
memset (ui_video_modes, 0, (numModes+2) * sizeof(char *));
// add custom resolution item
// ui_resolution_names[0] = strdup ("custom ???");
ui_resolution_names[0] = strdup ("[custom ] [ ??? ]");
ui_video_modes[0] = strdup ("-1");
// add to lists
for (i=firstMode, j=1; i<(firstMode+numModes); i++, j++)
{
if ( !VID_GetModeInfo(&w, &h, i) )
break;
if (w >= 640 && h >= 480)
{
aspect = (float)w / (float)h;
memset (resBuf, 0, sizeof(resBuf));
memset (aspectBuf, 0, sizeof(aspectBuf));
memset (nameBuf, 0, sizeof(nameBuf));
Com_sprintf (resBuf, sizeof(resBuf), "%dx%d", w, h);
// catch surround modes
if (aspect > 3.6f) {
aspect /= 3.0f;
surround = true;
}
if (aspect > 2.39f)
tok = "24:10";
else if (aspect > 2.3f)
tok = "21:9";
else if (aspect > 1.9f)
tok = "16:8";
else if (aspect > 1.85f)
tok = "17:10";
else if (aspect > 1.65f)
tok = "16:9";
else if (aspect > 1.6f)
tok = "15:9";
else if (aspect > 1.55f)
tok = "16:10";
else if (aspect > 1.3f)
tok = "4:3";
else if (aspect > 1.2f)
tok = "5:4";
else
tok = va("%3.1f:1", aspect);
if (surround)
Com_sprintf (aspectBuf, sizeof(aspectBuf), "3x%s", tok);
else
Com_sprintf (aspectBuf, sizeof(aspectBuf), "%s", tok);
// Com_sprintf (nameBuf, sizeof(nameBuf), "%-12s%s", resBuf, aspectBuf);
Com_sprintf (nameBuf, sizeof(nameBuf), "[%-9s] [%-5s]", resBuf, aspectBuf);
ui_resolution_names[j] = strdup (nameBuf);
ui_video_modes[j] = strdup (va("%i", i));
}
}
ui_num_video_modes = numModes;
}
/*
==========================
UI_FreeVideoModes
==========================
*/
void UI_FreeVideoModes (void)
{
if (ui_num_video_modes > 0) {
FS_FreeFileList (ui_resolution_names, ui_num_video_modes);
FS_FreeFileList (ui_video_modes, ui_num_video_modes);
}
ui_resolution_names = NULL;
ui_video_modes = NULL;
}
char **ui_aniso_names = NULL;
//char **ui_aniso_values = NULL;
int ui_num_aniso_values = 0;
/*
==========================
UI_GetAnisoValues
==========================
*/
void UI_GetAnisoValues (void)
{
int i, numValues;
float aniso_avail = Cvar_VariableValue("r_anisotropic_avail");
if (aniso_avail < 2.0)
numValues = 1;
else if (aniso_avail < 4.0)
numValues = 2;
else if (aniso_avail < 8.0)
numValues = 3;
else if (aniso_avail < 16.0)
numValues = 4;
else // >= 16.0
numValues = 5;
// 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 *));
// set names and values
for (i=0; i<numValues; i++)
{
if (i == 0)
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_num_aniso_values = numValues;
}
/*
==========================
UI_FreeAnisoValues
==========================
*/
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);
}
ui_aniso_names = NULL;
// ui_aniso_values = NULL;
}
/*
==========================
UI_GetVideoInfo
==========================
*/
void UI_GetVideoInfo (void)
{
UI_GetVideoModes ();
UI_GetAnisoValues ();
}
/*
==========================
UI_FreeVideoInfo
==========================
*/
void UI_FreeVideoInfo (void)
{
UI_FreeVideoModes ();
UI_FreeAnisoValues ();
}
/*
=======================================================================
@ -473,86 +701,6 @@ char **UI_LoadAssetList (char *dir, char *nameMask, char *firstItem, int *return
char **ui_font_names = NULL;
int ui_numfonts = 0;
#if 0
void UI_InsertFont (char **list, char *insert, int len)
{
int i, j;
if (!list) return;
// i=1 so default stays first!
for (i=1; i<len; i++)
{
if (!list[i])
break;
if (strcmp( list[i], insert ))
{
for (j=len; j>i ;j--)
list[j] = list[j-1];
list[i] = strdup(insert);
return;
}
}
list[len] = strdup(insert);
}
char **UI_SetFontNames (void)
{
char *curFont;
char **list = 0, *p;//, *s;
int nfonts = 0, nfontnames;
char **fontfiles;
char *path = NULL;
int i;//, j;
list = malloc( sizeof( char * ) * UI_MAX_FONTS );
memset( list, 0, sizeof( char * ) * UI_MAX_FONTS );
list[0] = strdup("default");
nfontnames = 1;
fontfiles = FS_GetFileList("fonts/*.*", NULL, &nfonts);
for (i=0; i<nfonts && nfontnames < UI_MAX_FONTS; i++)
{
int num;
if (!fontfiles || !fontfiles[i]) // Knightmare added array base check
continue;
if ( !UI_IsValidImageFilename(fontfiles[i]) )
continue;
p = strrchr(fontfiles[i], '/'); p++;
num = (int)strlen(p)-4;
p[num] = 0; // NULL
curFont = p;
if (!FS_ItemInList(curFont, nfontnames, list))
{
// UI_InsertFont not needed due to sorting in FS_GetFileList()
// UI_InsertFont (list, strdup(curFont), nfontnames);
FS_InsertInList(list, strdup(curFont), nfontnames, 1); // start=1 so default stays first!
nfontnames++;
}
// set back so whole string get deleted.
p[num] = '.';
}
if (nfonts)
FS_FreeFileList( fontfiles, nfonts );
ui_numfonts = nfontnames;
return list;
}
#endif
/*
==========================
UI_IsValidFontName
@ -693,76 +841,6 @@ void UI_SortCrosshairs (char **list, int len)
}
#if 0
char **UI_SetCrosshairNames (void)
{
char *curCrosshair;
char **list = 0, *p;
int ncrosshairs = 0, ncrosshairnames;
char **crosshairfiles;
char *path = NULL;
int i;
list = malloc( sizeof( char * ) * UI_MAX_CROSSHAIRS+1 );
memset( list, 0, sizeof( char * ) * UI_MAX_CROSSHAIRS+1 );
list[0] = strdup("none"); // was default
ncrosshairnames = 1;
crosshairfiles = FS_GetFileList("pics/ch*.*", NULL, &ncrosshairs);
for (i=0; i<ncrosshairs && ncrosshairnames < UI_MAX_CROSSHAIRS; i++)
{
int num, namelen;
if ( !crosshairfiles || !crosshairfiles[i] )
continue;
if ( !UI_IsValidImageFilename(crosshairfiles[i]) )
continue;
p = strrchr(crosshairfiles[i], '/'); p++;
// filename must be chxxx
if (strncmp(p, "ch", 2))
continue;
namelen = (int)strlen(strdup(p));
if (namelen < 7 || namelen > 9)
continue;
if (!isNumeric(p[2]))
continue;
if (namelen >= 8 && !isNumeric(p[3]))
continue;
// ch100 is only valid 5-char name
if (namelen == 9 && (p[2] != '1' || p[3] != '0' || p[4] != '0'))
continue;
num = (int)strlen(p)-4;
p[num] = 0; //NULL;
curCrosshair = p;
if (!FS_ItemInList(curCrosshair, ncrosshairnames, list))
{
FS_InsertInList(list, strdup(curCrosshair), ncrosshairnames, 1); // i=1 so none stays first!
ncrosshairnames++;
}
//set back so whole string get deleted.
p[num] = '.';
}
// sort the list
UI_SortCrosshairs (list, ncrosshairnames);
if (ncrosshairs)
FS_FreeFileList( crosshairfiles, ncrosshairs );
ui_numcrosshairs = ncrosshairnames;
return list;
}
#endif
/*
==========================
UI_IsValidCrosshairName
@ -866,7 +944,6 @@ qboolean ui_savechanged[UI_MAX_SAVEGAMES];
qboolean ui_saveshotvalid[UI_MAX_SAVEGAMES+1];
char ui_mapname[MAX_QPATH];
//qboolean ui_mapshotvalid;
char ui_saveload_shotname[MAX_QPATH];
/*
@ -903,7 +980,6 @@ void UI_Load_Savestrings (qboolean update)
fp = fopen (name, "rb");
if (!fp) {
// Com_Printf("Save file %s not found.\n", name);
// strncpy (ui_savestrings[i], EMPTY_GAME_STRING);
Q_strncpyz (ui_savestrings[i], sizeof(ui_savestrings[i]), EMPTY_GAME_STRING);
ui_savevalid[i] = false;
ui_savetimestamps[i] = 0;
@ -917,7 +993,6 @@ void UI_Load_Savestrings (qboolean update)
if (!f)
{
//Com_Printf("Save file %s not found.\n", name);
// strncpy (m_savestrings[i], EMPTY_GAME_STRING);
Q_strncpyz (ui_savestrings[i], sizeof(ui_savestrings[i]), EMPTY_GAME_STRING);
ui_savevalid[i] = false;
ui_savetimestamps[i] = 0;
@ -953,7 +1028,6 @@ void UI_ValidateSaveshots (void)
{
int i;
char shotname[MAX_QPATH];
// char mapshotname[MAX_QPATH];
for ( i = 0; i < UI_MAX_SAVEGAMES; i++ )
{
@ -979,25 +1053,6 @@ void UI_ValidateSaveshots (void)
else
ui_saveshotvalid[i] = false;
}
/* if (loadmenu)
{ // register mapshot for autosave
if (ui_savevalid[0]) {
Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", ui_mapname);
if (R_DrawFindPic(mapshotname))
ui_mapshotvalid = true;
else
ui_mapshotvalid = false;
}
else
ui_mapshotvalid = false;
}
// register null saveshot, this is only done once
if (R_DrawFindPic("/gfx/ui/noscreen.pcx"))
ui_saveshotvalid[UI_MAX_SAVEGAMES] = true;
else
ui_saveshotvalid[UI_MAX_SAVEGAMES] = false;
*/
}
@ -1473,7 +1528,6 @@ void UI_LoadArenas (void)
#if 1
arenafiles = FS_GetFileList ("scripts", "arena", &narenas);
// arenafiles = FS_GetFileList ("scripts/*.arena", NULL, &narenas);
for (i = 0; i < narenas && narenanames < MAX_ARENAS; i++)
{
if (!arenafiles || !arenafiles[i])
@ -2015,7 +2069,6 @@ static qboolean UI_IsSkinIcon (char *name)
int len;
char *s, scratch[1024];
// strncpy(scratch, name);
Q_strncpyz(scratch, sizeof(scratch), name);
*strrchr(scratch, '.') = 0;
s = scratch;
@ -2031,13 +2084,11 @@ UI_IconOfSkinExists
*/
static qboolean UI_IconOfSkinExists (char *skin, char **files, int nfiles, char *suffix)
{
int i;
char scratch[1024];
int i;
char scratch[1024];
// strncpy(scratch, skin);
Q_strncpyz (scratch, sizeof(scratch), skin);
*strrchr(scratch, '.') = 0;
// strncat(scratch, suffix);
Q_strncatz (scratch, sizeof(scratch), suffix);
// strncat(scratch, "_i.pcx");
@ -2263,7 +2314,7 @@ UI_FreePlayerModels
*/
void UI_FreePlayerModels (void)
{
int i;
int i;
for (i = 0; i < ui_numplayermodels; i++)
{
@ -2327,25 +2378,20 @@ void UI_InitPlayerModelInfo (int *modelNum, int *skinNum)
return;
}
// strncpy( currentdirectory, Cvar_VariableString ("skin") );
Q_strncpyz(currentdirectory, sizeof(currentdirectory), Cvar_VariableString ("skin"));
if ( strchr( currentdirectory, '/' ) )
{
// strncpy( currentskin, strchr( currentdirectory, '/' ) + 1 );
Q_strncpyz(currentskin, sizeof(currentskin), strchr( currentdirectory, '/' ) + 1);
*strchr( currentdirectory, '/' ) = 0;
}
else if ( strchr( currentdirectory, '\\' ) )
{
// strncpy( currentskin, strchr( currentdirectory, '\\' ) + 1 );
Q_strncpyz(currentskin, sizeof(currentskin), strchr( currentdirectory, '\\' ) + 1);
*strchr( currentdirectory, '\\' ) = 0;
}
else
{
// strncpy( currentdirectory, "male" );
// strncpy( currentskin, "grunt" );
Q_strncpyz(currentdirectory, sizeof(currentdirectory), "male");
Q_strncpyz(currentskin, sizeof(currentskin), "grunt");
}

View file

@ -375,13 +375,6 @@ float UI_MenuSlider_GetValue (menuslider_s *s)
void MenuSlider_DoSlide (menuslider_s *s, int dir)
{
/* s->curvalue += dir;
if (s->curvalue > s->maxvalue)
s->curvalue = s->maxvalue;
else if (s->curvalue < s->minvalue)
s->curvalue = s->minvalue;
*/
s->curPos += dir;
s->curPos = min(max(s->curPos, 0), s->maxPos);
@ -406,7 +399,6 @@ void MenuSlider_Draw (menuslider_s *s)
if (!s->increment)
s->increment = 1.0f;
// s->range = (s->curvalue - s->minvalue) / (float)(s->maxvalue - s->minvalue);
s->range = (float)s->curPos / (float)s->maxPos;
if (s->range < 0)

View file

@ -34,7 +34,7 @@ static int old_mouse_x, old_mouse_y;
static qboolean mlooking;
cvar_t *m_filter;
cvar_t *in_dgamouse;
cvar_t *autosensitivity;
cvar_t *in_autosensitivity;
cvar_t *in_menumouse; /// FIXME Menu Mouse on windowed mode
extern cursor_t ui_mousecursor;
@ -68,7 +68,7 @@ void IN_Init (void)
in_dgamouse = Cvar_Get ("in_dgamouse", "1", CVAR_ARCHIVE);
in_menumouse = Cvar_Get ("in_menumouse", "0", CVAR_ARCHIVE);
// Knightmare added
autosensitivity = Cvar_Get ("autosensitivity", "1", CVAR_ARCHIVE);
in_autosensitivity = Cvar_Get ("in_autosensitivity", "1", CVAR_ARCHIVE);
Cvar_SetDescription ("autosensitivity", "Enables scaling of mouse and joystick sensitivty when zoomed in.");
Cmd_AddCommand ("+mlook", IN_MLookDown);
@ -111,8 +111,8 @@ void IN_Move (usercmd_t *cmd)
if (!mouse_avail)
return;
if (!autosensitivity)
autosensitivity = Cvar_Get ("autosensitivity", "1", CVAR_ARCHIVE);
if (!in_autosensitivity)
in_autosensitivity = Cvar_Get ("in_autosensitivity", "1", CVAR_ARCHIVE);
if (m_filter->value)
{

View file

@ -571,8 +571,6 @@ qboolean VID_GetModeInfo (int *width, int *height, int mode)
if (mode == -1) // custom mode
{
// *width = r_customwidth->value;
// *height = r_customheight->value;
*width = r_customwidth->integer;
*height = r_customheight->integer;
return true;

View file

@ -876,6 +876,8 @@ void MakronSpawn (edict_t *self)
vec3_t vec;
edict_t *player;
self->classname = "monster_makron"; // Knightmare- set the right classname
SP_monster_makron (self);
// jump at player

View file

@ -216,6 +216,7 @@ struct monsterObit {
"monster_supertank", "%s was stomped by a Super Tank.\n",
"monster_boss2", "%s was killed by some flying boss thingy.\n",
"monster_jorg", "%s was assassinated by a Jorg.\n",
"monster_makron", "%s was laid low by the Makron.\n",
NULL, NULL
};