📄 menu.c
字号:
case K_ESCAPE:
M_Menu_MultiPlayer_f ();
break;
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
if (++m_net_cursor >= m_net_items)
m_net_cursor = 0;
break;
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
if (--m_net_cursor < 0)
m_net_cursor = m_net_items - 1;
break;
case K_ENTER:
m_entersound = true;
switch (m_net_cursor)
{
case 0:
M_Menu_SerialConfig_f ();
break;
case 1:
M_Menu_SerialConfig_f ();
break;
case 2:
M_Menu_LanConfig_f ();
break;
case 3:
M_Menu_LanConfig_f ();
break;
case 4:
// multiprotocol
break;
}
}
if (m_net_cursor == 0 && !serialAvailable)
goto again;
if (m_net_cursor == 1 && !serialAvailable)
goto again;
if (m_net_cursor == 2 && !ipxAvailable)
goto again;
if (m_net_cursor == 3 && !tcpipAvailable)
goto again;
}
//=============================================================================
/* OPTIONS MENU */
// 2002-01-31 New menu system by Maddes start
// no more messing around with OPTIONS_ITEMS :)
/*
#ifdef _WIN32
#define OPTIONS_ITEMS 15 // 2001-12-16 M_LOOK cvar by Heffo/Maddes
#else
#define OPTIONS_ITEMS 14 // 2001-12-16 M_LOOK cvar by Heffo/Maddes
#endif
*/
// 2002-01-31 New menu system by Maddes end
#define SLIDER_RANGE 10
//int options_cursor; // 2002-01-31 New menu system by Maddes
void M_Menu_Options_f (void)
{
key_dest = key_menu;
m_state = m_options;
m_entersound = true;
// 2002-01-31 New menu system by Maddes start
current_menu = m_menu_options;
current_cursor = &options_cursor;
/*
#ifdef _WIN32
if ((options_cursor == 14) && (modestate != MS_WINDOWED)) // 2001-12-16 M_LOOK cvar by Heffo/Maddes
{
options_cursor = 0;
}
#endif
*/
// 2002-01-31 New menu system by Maddes end
}
// 2002-01-31 New menu system by Maddes start
/*
void M_AdjustSliders (int dir)
{
S_LocalSound ("misc/menu3.wav");
switch (options_cursor)
{
case 3: // screen size
scr_viewsize->value += dir * 10;
if (scr_viewsize->value < 30)
scr_viewsize->value = 30;
if (scr_viewsize->value > 120)
scr_viewsize->value = 120;
Cvar_SetValue (scr_viewsize, scr_viewsize->value);
break;
case 4: // gamma
v_gamma->value -= dir * 0.05;
if (v_gamma->value < 0.5)
v_gamma->value = 0.5;
if (v_gamma->value > 1)
v_gamma->value = 1;
Cvar_SetValue (v_gamma, v_gamma->value);
break;
case 5: // mouse speed
sensitivity->value += dir * 0.5;
if (sensitivity->value < 1)
sensitivity->value = 1;
if (sensitivity->value > 11)
sensitivity->value = 11;
Cvar_SetValue (sensitivity, sensitivity->value);
break;
case 6: // music volume
#ifdef _WIN32
bgmvolume->value += dir * 1.0;
#else
bgmvolume->value += dir * 0.1;
#endif
if (bgmvolume->value < 0)
bgmvolume->value = 0;
if (bgmvolume->value > 1)
bgmvolume->value = 1;
Cvar_SetValue (bgmvolume, bgmvolume->value);
break;
case 7: // sfx volume
volume->value += dir * 0.1;
if (volume->value < 0)
volume->value = 0;
if (volume->value > 1)
volume->value = 1;
Cvar_SetValue (volume, volume->value);
break;
case 8: // always run
if (cl_forwardspeed->value > 200)
{
Cvar_Set (cl_forwardspeed, "200");
Cvar_Set (cl_backspeed, "200");
}
else
{
Cvar_Set (cl_forwardspeed, "400");
Cvar_Set (cl_backspeed, "400");
}
break;
// 2001-12-16 M_LOOK cvar by Heffo/Maddes start
/ *
case 9: // invert mouse
Cvar_SetValue (m_pitch, -m_pitch->value);
break;
* /
// 2001-12-16 M_LOOK cvar by Heffo/Maddes end
case 9: // lookspring // 2001-12-16 M_LOOK cvar by Heffo/Maddes
Cvar_SetValue (lookspring, !lookspring->value);
break;
case 10: // lookstrafe // 2001-12-16 M_LOOK cvar by Heffo/Maddes
Cvar_SetValue (lookstrafe, !lookstrafe->value);
break;
// 2001-12-16 M_LOOK cvar by Heffo/Maddes start
case 11: // mouselook
Cvar_SetValue (m_look, !m_look->value);
break;
case 12: // invert mouse
Cvar_SetValue (m_pitch, -m_pitch->value);
break;
// 2001-12-16 M_LOOK cvar by Heffo/Maddes end
#ifdef _WIN32
case 14: // _windowed_mouse // 2001-12-16 M_LOOK cvar by Heffo/Maddes
Cvar_SetValue (_windowed_mouse, !_windowed_mouse->value);
break;
#endif
}
}
*/
// 2002-01-31 New menu system by Maddes end
void M_DrawSlider (int x, int y, float range)
{
int i;
if (range < 0)
range = 0;
if (range > 1)
range = 1;
M_DrawCharacter (x-8, y, 128);
for (i=0 ; i<SLIDER_RANGE ; i++)
M_DrawCharacter (x + i*8, y, 129);
M_DrawCharacter (x+i*8, y, 130);
M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
}
void M_DrawCheckbox (int x, int y, int on)
{
#if 0
if (on)
M_DrawCharacter (x, y, 131);
else
M_DrawCharacter (x, y, 129);
#endif
if (on)
M_Print (x, y, "on");
else
M_Print (x, y, "off");
}
// 2002-01-31 New menu system by Maddes end
/*
void M_Options_Draw (void)
{
float r;
qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
p = Draw_CachePic ("gfx/p_option.lmp");
M_DrawPic ( (320-p->width)/2, 4, p);
M_Print (16, 32, " Customize controls");
M_Print (16, 40, " Go to console");
M_Print (16, 48, " Reset to defaults");
M_Print (16, 56, " Screen size");
r = (scr_viewsize->value - 30) / (120 - 30);
M_DrawSlider (220, 56, r);
M_Print (16, 64, " Brightness");
r = (1.0 - v_gamma->value) / 0.5;
M_DrawSlider (220, 64, r);
M_Print (16, 72, " Mouse Speed");
r = (sensitivity->value - 1)/10;
M_DrawSlider (220, 72, r);
M_Print (16, 80, " CD Music Volume");
r = bgmvolume->value;
M_DrawSlider (220, 80, r);
M_Print (16, 88, " Sound Volume");
r = volume->value;
M_DrawSlider (220, 88, r);
M_Print (16, 96, " Always Run");
M_DrawCheckbox (220, 96, cl_forwardspeed->value > 200);
// 2001-12-16 M_LOOK cvar by Heffo/Maddes start
/ *
M_Print (16, 104, " Invert Mouse");
M_DrawCheckbox (220, 104, m_pitch->value < 0);
* /
M_Print (16, 104, " Lookspring");
M_DrawCheckbox (220, 104, lookspring->value);
M_Print (16, 112, " Lookstrafe");
M_DrawCheckbox (220, 112, lookstrafe->value);
M_Print (16, 120, " Mouselook");
M_DrawCheckbox (220, 120, m_look->value);
M_Print (16, 128, " Invert Mouse");
M_DrawCheckbox (220, 128, m_pitch->value < 0);
// 2001-12-16 M_LOOK cvar by Heffo/Maddes end
if (vid_menudrawfn)
M_Print (16, 136, " Video Options"); // 2001-12-16 M_LOOK cvar by Heffo/Maddes
#ifdef _WIN32
if (modestate == MS_WINDOWED)
{
M_Print (16, 144, " Use Mouse"); // 2001-12-16 M_LOOK cvar by Heffo/Maddes
M_DrawCheckbox (220, 144, _windowed_mouse->value); // 2001-12-16 M_LOOK cvar by Heffo/Maddes
}
#endif
// cursor
M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
}
*/
int M_DrawFunction (menu_definition_t *menu_definition, int y)
{
float r;
switch (menu_definition->funcno)
{
// Options menu
case MENU_CUSTOMIZE_CONTROLS:
M_Print (16, y, " Customize controls");
y += 8;
break;
case MENU_GO_TO_CONSOLE:
M_Print (16, y, " Go to console");
y += 8;
break;
case MENU_LOAD_DEFAULT_CFG:
M_Print (16, y, " Reset to defaults");
y += 8;
break;
case MENU_VIDEO_RESOLUTION:
M_Print (16, y, " Video Resolution");
y += 8;
break;
// Control options menu
case MENU_CONTROL_OPTIONS:
M_Print (16, y, " Control options");
y += 8;
break;
case MENU_MOUSESPEED:
M_Print (16, y, " Mouse Speed");
r = (sensitivity->value - 1)/10;
M_DrawSlider (220, y, r);
y += 8;
break;
case MENU_ALWAYS_RUN:
M_Print (16, y, " Always Run");
M_DrawCheckbox (220, y, cl_forwardspeed->value > 200);
y += 8;
break;
case MENU_LOOKSPRING:
M_Print (16, y, " Lookspring");
M_DrawCheckbox (220, y, lookspring->value);
y += 8;
break;
case MENU_LOOKSTRAFE:
M_Print (16, y, " Lookstrafe");
M_DrawCheckbox (220, y, lookstrafe->value);
y += 8;
break;
case MENU_MOUSELOOK:
M_Print (16, y, " Mouselook");
M_DrawCheckbox (220, y, m_look->value);
y += 8;
break;
case MENU_INVERT_MOUSE:
M_Print (16, y, " Invert Mouse");
M_DrawCheckbox (220, y, m_pitch->value < 0);
y += 8;
break;
#ifdef _WIN32
case MENU_USE_MOUSE:
M_Print (16, y, " Use Mouse");
M_DrawCheckbox (220, y, _windowed_mouse->value);
y += 8;
break;
#endif
// Sound options menu
case MENU_SOUND_OPTIONS:
M_Print (16, y, " Sound options");
y += 8;
break;
case MENU_CD_VOLUME:
M_Print (16, y, " CD Music Volume");
r = bgmvolume->value;
M_DrawSlider (220, y, r);
y += 8;
break;
case MENU_SOUND_VOLUME:
M_Print (16, y, " Sound Volume");
r = volume->value;
M_DrawSlider (220, y, r);
y += 8;
break;
// External data menu
case MENU_EXTERNAL_DATA:
M_Print (16, y, " External data");
y += 8;
break;
case MENU_EXTERNAL_ENT:
M_Print (16, y, " Entity data (.ENT)");
M_DrawCheckbox (220, y, external_ent->value);
y += 8;
break;
case MENU_EXTERNAL_VIS:
M_Print (16, y, "Visibility data (.VIS)");
M_DrawCheckbox (220, y, external_vis->value);
y += 8;
break;
#ifdef GLQUAKE
case MENU_EXTERNAL_LIT:
M_Print (16, y, " Colored Light (.LIT)");
M_DrawCheckbox (220, y, external_lit->value);
y += 8;
break;
#endif
// Client options menu
case MENU_CLIENT_OPTIONS:
M_Print (16, y, " Client options");
y += 8;
break;
case MENU_CL_ENTITIES_MIN:
M_Print (16, y, " Min. normal ents");
M_Print (220, y, va("%i", (int)cl_entities_min->value));
y += 8;
break;
case MENU_CL_ENTITIES_TEMP_MIN:
M_Print (16, y, " Min. temp ents");
M_Print (220, y, va("%i", (int)cl_entities_min_temp->value));
y += 8;
break;
case MENU_CL_ENTITIES_STATIC_MIN:
M_Print (16, y, " Min. static ents");
M_Print (220, y, va("%i", (int)cl_entities_min_static->value));
y += 8;
break;
case MENU_CL_COMPATIBILITY:
M_Print (16, y, " Client Compatibility");
M_DrawCheckbox (220, y, cl_compatibility->value);
y += 8;
M_Print (16, y, " (for demo recording)");
y += 8;
break;
// Server options menu
case MENU_SERVER_OPTIONS:
M_Print (16, y, " Server options");
y += 8;
break;
case MENU_SV_ENTITIES:
M_Print (16, y, " Normal ents");
M_Print (220, y, va("%i", (int)sv_entities->value));
y += 8;
break;
case MENU_SV_ENTITIES_TEMP:
M_Print (16, y, " Temp ents");
M_Print (220, y, va("%i", (int)sv_entities_temp->value));
y += 8;
break;
case MENU_SV_ENTITIES_STATIC:
M_Print (16, y, " Static ents");
M_Print (220, y, va("%i", (int)sv_entities_static->value));
y += 8;
break;
case MENU_SV_ENTITIES_COPY_TO_CL:
M_Print (16, y, " ent setup to client");
y += 8;
break;
case MENU_PR_ZONE_MIN_STRINGS:
M_Print (16, y, " String zone in KB");
M_Print (220, y, va("%i", (int)pr_zone_min_strings->value));
y += 8;
break;
case MENU_BUILTIN_REMAP:
M_Print (16, y, " Builtin Remapping");
M_DrawCheckbox (220, y, pr_builtin_remap->value);
y += 8;
break;
case MENU_SV_COMPATIBILITY:
M_Print (16, y, " Server Compatibility");
M_DrawCheckbox (220, y, sv_compatibility->value);
y += 8;
break;
case MENU_NVS_ENABLE:
M_Print (16, y, " Enhanced SVC (BETA)");
M_DrawCheckbox (220, y, nvs_svc_enable->value);
y += 8;
break;
// Video options menu
case MENU_VIDEO_OPTIONS:
M_Print (16, y, " Video options");
y += 8;
break;
case MENU_SCREENSIZE:
M_Print (16, y, " Screen size");
r = (scr_viewsize->value - 30) / (120 - 30);
M_DrawSlider (220, y, r);
y += 8;
break;
case MENU_BRIGHTNESS:
M_Print (16, y, " Brightness");
r = (1.0 - v_gamma->value) / 0.5;
M_DrawSlider (220, y, r);
y += 8;
break;
case MENU_CON_ALPHA:
M_Print (16, y, " Console transparency");
r = (1.0 - con_alpha->value);
M_DrawSlider (220, y, r);
y += 8;
break;
case MENU_CON_HEIGHT:
M_Print (16, y, " Console height");
r = scr_conheight->value;
M_DrawSlider (220, y, r);
y += 8;
break;
case MENU_SHOW_FPS:
M_Print (16, y, " Show FPS");
M_DrawCheckbox (220, y, cl_showfps->value);
y += 8;
break;
#ifdef GLQUAKE
case MENU_GL_MAXDEPTH:
M_Print (16, y, " Max. draw depth");
M_Print (220, y, va("%i", (int)gl_maxdepth->value));
y += 8;
break;
#endif
default:
M_Print (16, y, " Unknown function");
y += 8;
break;
}
return y;
}
void M_Menu_DrawCheck(menu_definition_t *menu_definition)
{
int i;
menu_first_index = 0;
menu_last_index = 0;
i = 1;
while (menu_definition[i].funcno != 0)
{
// adjust ignore flag to current situation
switch (menu_definition[i].funcno)
{
#ifdef _WIN32
case MENU_USE_MOUSE: // only present in windowed mode on Win32
if (modestate == MS_WINDOWED)
{
menu_definition[i].type = MENU_SELECTABLE; // full usage
}
else
{
menu_definition[i].type = MENU_INVISIBLE; // ignore completely
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -