mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-10 14:42:06 +00:00
This is a big change.. I added two new functions that must be in every
target's video file. These functions are VID_ExtraOptionDraw() and VID_ExtraOptionCmd(int options_cursor). These are to help modulize the option menu a bit, now all you have to do is define #OPTIONS_ITEMS to one more then the number of items there are (this is done in your target's vid*.c/gl_vid*.c file) I also removed a bunch of #ifdefs, although a few #ifdef _WIN32's remain. -- Eric Windisch
This commit is contained in:
parent
7df47c6fdb
commit
c5b5abd9ee
14 changed files with 260 additions and 54 deletions
|
@ -827,3 +827,14 @@ void IN_Move (usercmd_t *cmd)
|
|||
{
|
||||
IN_MouseMove(cmd);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
// No extra option menu items yet
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd()
|
||||
{
|
||||
// Read the previous function
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <X11/extensions/xf86dga.h>
|
||||
#endif
|
||||
|
||||
#ifdef XMESA
|
||||
#include <GL/xmesa.h>
|
||||
|
||||
#define OPTIONS_ITEMS 15
|
||||
#else
|
||||
#define OPTIONS_ITEMS 14
|
||||
#endif
|
||||
|
||||
#define WARP_WIDTH 320
|
||||
#define WARP_HEIGHT 200
|
||||
|
@ -61,6 +68,10 @@ unsigned char d_15to8table[65536];
|
|||
|
||||
cvar_t _windowed_mouse = {"_windowed_mouse","0", true};
|
||||
cvar_t vid_mode = {"vid_mode","0",false};
|
||||
|
||||
#ifdef XMESA
|
||||
cvar_t vid_mesa_mode = {"vid_mesa_mode", "0"};
|
||||
#endif
|
||||
|
||||
static float mouse_x, mouse_y;
|
||||
static float old_mouse_x, old_mouse_y;
|
||||
|
@ -785,3 +796,40 @@ void IN_Move (usercmd_t *cmd)
|
|||
{
|
||||
IN_MouseMove(cmd);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
|
||||
// Windowed Mouse
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
|
||||
|
||||
#ifdef XMESA
|
||||
// Mesa has a fullscreen / windowed glx hack.
|
||||
|
||||
M_Print (16, 134, " Fullscreen");
|
||||
M_DrawCheckbox (220, 136, vid_mesa_mode.value);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
|
||||
#ifdef XMESA
|
||||
case 13:
|
||||
Cvar_SetValue ("vid_mesa_mode",!vid_mesa_mode.value);
|
||||
XMesaSetFXmode(vid_mesa_mode.value ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define NO_MODE (MODE_WINDOWED - 1)
|
||||
#define MODE_FULLSCREEN_DEFAULT (MODE_WINDOWED + 1)
|
||||
|
||||
#define OPTIONS_ITEMS 14
|
||||
|
||||
typedef struct {
|
||||
modestate_t type;
|
||||
int width;
|
||||
|
@ -1942,3 +1944,22 @@ void VID_MenuKey (int key)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
// Windowed Mouse
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,12 @@ int VID_SetMode (int modenum, unsigned char *palette);
|
|||
void VID_HandlePause (qboolean pause);
|
||||
// called only on Win32, when pause happens, so the mouse can be released
|
||||
|
||||
void VID_ExtraOptionDraw();
|
||||
// draw extra option menu entries
|
||||
|
||||
void VID_ExtraOptionCmd(int options_cursor);
|
||||
// commands for the extra menu options of the target
|
||||
|
||||
#ifdef GLQUAKE
|
||||
qboolean VID_Is8bit(void);
|
||||
#endif
|
||||
|
|
|
@ -779,3 +779,19 @@ void VID_MenuKey (int key)
|
|||
}
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
/* Port specific Options menu entrys */
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
/*
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // Always start with 12
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -925,3 +925,22 @@ void IN_Move(usercmd_t *cmd)
|
|||
}
|
||||
mouse_x = mouse_y = 0.0;
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
// Windowed Mouse
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,4 +86,19 @@ void D_EndDirectRect (int x, int y, int width, int height)
|
|||
{
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
/* Port specific Options menu entrys */
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
/*
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // Always start with 12
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -412,3 +412,22 @@ char *Sys_ConsoleInput (void)
|
|||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
// Windowed Mouse
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1241,3 +1241,22 @@ void IN_Move (usercmd_t *cmd)
|
|||
}
|
||||
mouse_x = mouse_y = 0.0;
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
// Windowed Mouse
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1263,3 +1263,21 @@ void IN_Move (usercmd_t *cmd)
|
|||
}
|
||||
mouse_x = mouse_y = 0.0;
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
// Windowed Mouse
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1019,3 +1019,20 @@ char *VID_ModeInfo (int modenum)
|
|||
return (badmodestr);
|
||||
}
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
/* Port specific Options menu entrys */
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
/*
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // Always start with 12
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define MAX_MODE_LIST 30
|
||||
#define VID_ROW_SIZE 3
|
||||
#define OPTIONS_ITEMS 3
|
||||
|
||||
qboolean dibonly;
|
||||
|
||||
|
@ -3389,3 +3390,25 @@ void VID_MenuKey (int key)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
if(modestate == MS_WINDOWED)
|
||||
{
|
||||
// Windowed Mouse
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
}
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "quakedef.h"
|
||||
#include "d_local.h"
|
||||
|
||||
#define OPTIONS_ITEMS 14
|
||||
|
||||
cvar_t _windowed_mouse = {"_windowed_mouse","0", true};
|
||||
cvar_t m_filter = {"m_filter","0", true};
|
||||
float old_windowed_mouse;
|
||||
|
@ -1085,3 +1087,22 @@ void IN_Move (usercmd_t *cmd)
|
|||
}
|
||||
mouse_x = mouse_y = 0.0;
|
||||
}
|
||||
|
||||
void VID_ExtraOptionDraw()
|
||||
{
|
||||
// Windowed Mouse
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
}
|
||||
|
||||
void VID_ExtraOptionCmd(int option_cursor)
|
||||
{
|
||||
switch(option_cursor)
|
||||
{
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "winquake.h"
|
||||
#endif
|
||||
|
||||
//if defined (FX) && defined (XMESA)
|
||||
#ifdef XMESA
|
||||
#include <GL/xmesa.h>
|
||||
#endif
|
||||
|
||||
cvar_t vid_mesa_mode = {"vid_mesa_mode", "0"};
|
||||
|
||||
void (*vid_menudrawfn)(void);
|
||||
void (*vid_menukeyfn)(int key);
|
||||
|
@ -1071,23 +1065,12 @@ again:
|
|||
//=============================================================================
|
||||
/* OPTIONS MENU */
|
||||
|
||||
#ifdef _WIN32
|
||||
#define OPTIONS_ITEMS 13
|
||||
#endif
|
||||
|
||||
#ifdef X11
|
||||
#define OPTIONS_ITEMS 13
|
||||
#endif
|
||||
|
||||
#ifdef XMESA
|
||||
#define OPTIONS_ITEMS 15
|
||||
#endif
|
||||
|
||||
#ifndef OPTIONS_ITEMS
|
||||
#define OPTIONS_ITEMS 13
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define SLIDER_RANGE 10
|
||||
|
||||
int options_cursor;
|
||||
|
@ -1183,18 +1166,8 @@ void M_AdjustSliders (int dir)
|
|||
Cvar_SetValue ("lookstrafe", !lookstrafe.value);
|
||||
break;
|
||||
|
||||
#if defined(X11) || defined(GLQUAKE) || defined(_WIN32)
|
||||
case 12: // _windowed_mouse
|
||||
Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef XMESA
|
||||
case 13:
|
||||
Cvar_SetValue ("vid_mesa_mode",!vid_mesa_mode.value);
|
||||
XMesaSetFXmode(vid_mesa_mode.value ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
Vid_ExtraOptionCmd(options_cursor);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1275,31 +1248,11 @@ void M_Options_Draw (void)
|
|||
M_Print (16, 120, " Lookstrafe");
|
||||
M_DrawCheckbox (220, 120, lookstrafe.value);
|
||||
|
||||
#ifdef _WIN32
|
||||
if (modestate == MS_WINDOWED)
|
||||
{
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GLQUAKE
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
#endif
|
||||
|
||||
#ifdef X11
|
||||
M_Print (16, 128, " Use Mouse");
|
||||
M_DrawCheckbox (220, 128, _windowed_mouse.value);
|
||||
#endif
|
||||
|
||||
#if defined(XMESA) && defined(GLQUAKE)
|
||||
// Mesa has a fullscreen / windowed glx hack.
|
||||
M_Print (16, 134, " Fullscreen");
|
||||
M_DrawCheckbox (220, 136, vid_mesa_mode.value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (vid_menudrawfn) M_Print (16, 144, " Video Options");
|
||||
*/
|
||||
|
||||
VID_ExtraOptionDraw();
|
||||
|
||||
// cursor
|
||||
M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
|
||||
|
|
Loading…
Reference in a new issue