mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
qw-client-wgl and nq-wgl get to (but fail) the link stage
This commit is contained in:
parent
1dcaf3bb3f
commit
dbca31519f
5 changed files with 41 additions and 295 deletions
|
@ -34,15 +34,13 @@
|
|||
|
||||
#include "winquake.h"
|
||||
#include <dinput.h>
|
||||
#include "client.h"
|
||||
|
||||
#include "QF/keys.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/input.h"
|
||||
#include "cl_input.h"
|
||||
#include "view.h"
|
||||
|
||||
#define DINPUT_BUFFERSIZE 16
|
||||
#define iDirectInputCreate(a,b,c,d) pDirectInputCreate(a,b,c,d)
|
||||
|
@ -53,8 +51,6 @@ HRESULT (WINAPI * pDirectInputCreate) (HINSTANCE hinst, DWORD dwVersion,
|
|||
|
||||
// mouse public variables
|
||||
|
||||
float mouse_x, mouse_y;
|
||||
qboolean mouseactive;
|
||||
unsigned int uiWheelMessage;
|
||||
|
||||
// mouse local variables
|
||||
|
@ -62,7 +58,7 @@ unsigned int uiWheelMessage;
|
|||
static int mouse_buttons;
|
||||
static int mouse_oldbuttonstate;
|
||||
static POINT current_pos;
|
||||
static float old_mouse_x, old_mouse_y, mx_accum, my_accum;
|
||||
static float mx_accum, my_accum;
|
||||
static qboolean mouseinitialized;
|
||||
static cvar_t *m_filter;
|
||||
static qboolean restore_spi;
|
||||
|
@ -125,15 +121,6 @@ extern void JOY_Init (void);
|
|||
extern void JOY_AdvancedUpdate_f (void);
|
||||
extern void JOY_Move (void);
|
||||
|
||||
/*
|
||||
Force_CenterView_f
|
||||
*/
|
||||
static void
|
||||
Force_CenterView_f (void)
|
||||
{
|
||||
cl.viewangles[PITCH] = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
IN_UpdateClipCursor
|
||||
|
@ -142,7 +129,7 @@ void
|
|||
IN_UpdateClipCursor (void)
|
||||
{
|
||||
|
||||
if (mouseinitialized && mouseactive && !dinput) {
|
||||
if (mouseinitialized && in_mouse_avail && !dinput) {
|
||||
ClipCursor (&window_rect);
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +192,7 @@ IN_ActivateMouse (void)
|
|||
ClipCursor (&window_rect);
|
||||
}
|
||||
|
||||
mouseactive = true;
|
||||
in_mouse_avail = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +233,7 @@ IN_DeactivateMouse (void)
|
|||
ReleaseCapture ();
|
||||
}
|
||||
|
||||
mouseactive = false;
|
||||
in_mouse_avail = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,8 +397,6 @@ IN_StartupMouse (void)
|
|||
void
|
||||
IN_Init (void)
|
||||
{
|
||||
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "Force view of player to center");
|
||||
|
||||
uiWheelMessage = RegisterWindowMessage ("MSWHEEL_ROLLMSG");
|
||||
|
||||
|
||||
|
@ -426,8 +411,10 @@ IN_Init_Cvars (void)
|
|||
// mouse variables
|
||||
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL,
|
||||
"Toggle mouse input filtering.");
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL,
|
||||
"Grab the mouse from X while playing quake");
|
||||
|
||||
JOY_Init_Cvars();
|
||||
JOY_Init_Cvars();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -460,7 +447,7 @@ IN_MouseEvent (int mstate)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (mouseactive && !dinput) {
|
||||
if (in_mouse_avail && !dinput) {
|
||||
// perform button actions
|
||||
for (i = 0; i < mouse_buttons; i++) {
|
||||
if ((mstate & (1 << i)) && !(mouse_oldbuttonstate & (1 << i))) {
|
||||
|
@ -491,7 +478,7 @@ IN_MouseMove (void)
|
|||
DWORD dwElements;
|
||||
HRESULT hr;
|
||||
|
||||
if (!mouseactive)
|
||||
if (!in_mouse_avail)
|
||||
return;
|
||||
|
||||
if (dinput) {
|
||||
|
@ -570,34 +557,8 @@ IN_MouseMove (void)
|
|||
my_accum = 0;
|
||||
}
|
||||
|
||||
if (m_filter->value) {
|
||||
mouse_x = (mx + old_mouse_x) * 0.5;
|
||||
mouse_y = (my + old_mouse_y) * 0.5;
|
||||
} else {
|
||||
mouse_x = mx;
|
||||
mouse_y = my;
|
||||
}
|
||||
|
||||
old_mouse_x = mx;
|
||||
old_mouse_y = my;
|
||||
|
||||
mouse_x *= sensitivity->value;
|
||||
mouse_y *= sensitivity->value;
|
||||
|
||||
// add mouse X/Y movement to cmd
|
||||
if ((in_strafe.state & 1) || (lookstrafe->int_val && freelook))
|
||||
viewdelta.position[0] += mouse_x;
|
||||
else
|
||||
viewdelta.angles[YAW] -= mouse_x;
|
||||
|
||||
if (freelook && !(in_strafe.state & 1)) {
|
||||
viewdelta.angles[PITCH] += mouse_y;
|
||||
} else {
|
||||
if (in_strafe.state & 1)
|
||||
viewdelta.position[1] -= mouse_y;
|
||||
else
|
||||
viewdelta.position[2] -= mouse_y;
|
||||
}
|
||||
in_mouse_x = mx;
|
||||
in_mouse_y = my;
|
||||
|
||||
// if the mouse has moved, force it to the center, so there's room to move
|
||||
if (mx || my) {
|
||||
|
@ -631,7 +592,7 @@ IN_Accumulate (void)
|
|||
|
||||
// if (dinput) return; // If using dinput we don't probably need this
|
||||
|
||||
if (mouseactive) {
|
||||
if (in_mouse_avail) {
|
||||
GetCursorPos (¤t_pos);
|
||||
|
||||
mx_accum += current_pos.x - window_center_x;
|
||||
|
@ -650,7 +611,7 @@ void
|
|||
IN_ClearStates (void)
|
||||
{
|
||||
|
||||
if (mouseactive) {
|
||||
if (in_mouse_avail) {
|
||||
mx_accum = 0;
|
||||
my_accum = 0;
|
||||
mouse_oldbuttonstate = 0;
|
||||
|
|
|
@ -1643,9 +1643,8 @@ VID_SetMode (int modenum, unsigned char *palette)
|
|||
// fix the leftover Alt from any Alt-Tab or the like that switched us away
|
||||
ClearAllStates ();
|
||||
|
||||
if (!msg_suppress_1)
|
||||
Con_Printf ("Video mode %s initialized\n",
|
||||
VID_GetModeDescription (vid_modenum));
|
||||
Con_Printf ("Video mode %s initialized\n",
|
||||
VID_GetModeDescription (vid_modenum));
|
||||
|
||||
VID_SetPalette (palette);
|
||||
|
||||
|
|
|
@ -36,18 +36,24 @@
|
|||
#include "QF/cmd.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "draw.h"
|
||||
#include "glquake.h"
|
||||
#include "in_win.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qendian.h"
|
||||
#include "resource.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "sbar.h"
|
||||
#include "screen.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
#include "glquake.h"
|
||||
#include "in_win.h"
|
||||
#include "resource.h"
|
||||
|
||||
extern void GL_Init_Common (void);
|
||||
extern void VID_Init8bitPalette (void);
|
||||
|
||||
extern void (*vid_menudrawfn) (void);
|
||||
extern void (*vid_menukeyfn) (int);
|
||||
|
@ -94,13 +100,7 @@ const char *gl_renderer;
|
|||
const char *gl_version;
|
||||
const char *gl_extensions;
|
||||
|
||||
// ARB Multitexture
|
||||
qboolean gl_mtex_capable = false;
|
||||
GLenum gl_mtex_enum = GL_TEXTURE0_ARB;
|
||||
|
||||
// 8-bit and permedia support
|
||||
QF_glColorTableEXT qglColorTableEXT = NULL;
|
||||
qboolean is8bit = false;
|
||||
qboolean isPermedia = false;
|
||||
|
||||
// FIXME: Only used by MGL ..
|
||||
|
@ -144,7 +144,6 @@ extern void CL_ClearStates ();
|
|||
|
||||
extern viddef_t vid; // global video state
|
||||
|
||||
unsigned short d_8to16table[256];
|
||||
unsigned int d_8to24table[256];
|
||||
unsigned char d_15to8table[65536];
|
||||
|
||||
|
@ -182,33 +181,12 @@ VID_ForceLockState (int lk)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
VID_LockBuffer (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
VID_UnlockBuffer (void)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
VID_ForceUnlockedAndReturnState (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
D_BeginDirectRect (int x, int y, byte * pbitmap, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
D_EndDirectRect (int x, int y, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CenterWindow (HWND hWndCenter, int width, int height, BOOL lefttopjustify)
|
||||
{
|
||||
|
@ -456,9 +434,8 @@ VID_SetMode (int modenum, unsigned char *palette)
|
|||
// fix the leftover Alt from any Alt-Tab or the like that switched us away
|
||||
ClearAllStates ();
|
||||
|
||||
if (!msg_suppress_1)
|
||||
Con_Printf ("Video mode %s initialized.\n",
|
||||
VID_GetModeDescription (vid_modenum));
|
||||
Con_Printf ("Video mode %s initialized.\n",
|
||||
VID_GetModeDescription (vid_modenum));
|
||||
|
||||
VID_SetPalette (palette);
|
||||
|
||||
|
@ -485,94 +462,18 @@ VID_UpdateWindowStatus (void)
|
|||
IN_UpdateClipCursor ();
|
||||
}
|
||||
|
||||
int texture_extension_number = 1;
|
||||
|
||||
void
|
||||
CheckMultiTextureExtensions (void)
|
||||
{
|
||||
Con_Printf ("Checking for multitexture... ");
|
||||
if (COM_CheckParm ("-nomtex")) {
|
||||
Con_Printf ("disabled.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (QFGL_ExtensionPresent ("GL_ARB_multitexture")) {
|
||||
|
||||
int max_texture_units = 0;
|
||||
|
||||
glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units);
|
||||
if (max_texture_units >= 2) {
|
||||
Con_Printf ("enabled, %d TMUs.\n", max_texture_units);
|
||||
qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB");
|
||||
qglActiveTexture = QFGL_ExtensionAddress ("glActiveTextureARB");
|
||||
gl_mtex_enum = GL_TEXTURE0_ARB;
|
||||
gl_mtex_capable = true;
|
||||
} else {
|
||||
Con_Printf ("disabled, not enough TMUs.\n");
|
||||
}
|
||||
} else {
|
||||
Con_Printf ("not found.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GL_Init
|
||||
*/
|
||||
void
|
||||
GL_Init (void)
|
||||
{
|
||||
gl_vendor = glGetString (GL_VENDOR);
|
||||
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
|
||||
gl_renderer = glGetString (GL_RENDERER);
|
||||
Con_Printf ("GL_RENDERER: %s\n", gl_renderer);
|
||||
|
||||
gl_version = glGetString (GL_VERSION);
|
||||
Con_Printf ("GL_VERSION: %s\n", gl_version);
|
||||
gl_extensions = glGetString (GL_EXTENSIONS);
|
||||
Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions);
|
||||
|
||||
// Con_Printf ("%s %s\n", gl_renderer, gl_version);
|
||||
|
||||
GL_Init_Common ();
|
||||
if (strnicmp (gl_renderer, "PowerVR", 7) == 0)
|
||||
fullsbardraw = true;
|
||||
|
||||
if (strnicmp (gl_renderer, "Permedia", 8) == 0)
|
||||
isPermedia = true;
|
||||
|
||||
CheckMultiTextureExtensions ();
|
||||
|
||||
glClearColor (0, 0, 0, 0);
|
||||
glCullFace (GL_FRONT);
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
|
||||
glEnable (GL_ALPHA_TEST);
|
||||
glAlphaFunc (GL_GREATER, 0.666);
|
||||
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||
glShadeModel (GL_FLAT);
|
||||
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
glEnable (GL_BLEND);
|
||||
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
GL_BeginRendering
|
||||
*/
|
||||
void
|
||||
GL_BeginRendering (int *x, int *y, int *width, int *height)
|
||||
{
|
||||
*x = *y = 0;
|
||||
*width = WindowRect.right - WindowRect.left;
|
||||
*height = WindowRect.bottom - WindowRect.top;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -591,10 +492,10 @@ GL_EndRendering (void)
|
|||
}
|
||||
} else {
|
||||
windowed_mouse = true;
|
||||
if (key_dest == key_game && !mouseactive && ActiveApp) {
|
||||
if (key_dest == key_game && !in_mouse_avail && ActiveApp) {
|
||||
IN_ActivateMouse ();
|
||||
IN_HideMouse ();
|
||||
} else if (mouseactive && key_dest != key_game) {
|
||||
} else if (in_mouse_avail && key_dest != key_game) {
|
||||
IN_DeactivateMouse ();
|
||||
IN_ShowMouse ();
|
||||
}
|
||||
|
@ -604,81 +505,6 @@ GL_EndRendering (void)
|
|||
Sbar_Changed ();
|
||||
}
|
||||
|
||||
void
|
||||
VID_SetPalette (unsigned char *palette)
|
||||
{
|
||||
byte *pal;
|
||||
unsigned int r, g, b;
|
||||
unsigned int v;
|
||||
int r1, g1, b1;
|
||||
int k;
|
||||
unsigned short i;
|
||||
unsigned int *table;
|
||||
QFile *f;
|
||||
char s[255];
|
||||
float dist, bestdist;
|
||||
static qboolean palflag = false;
|
||||
|
||||
//
|
||||
// 8 8 8 encoding
|
||||
//
|
||||
// Con_Printf("Converting 8to24\n");
|
||||
|
||||
pal = palette;
|
||||
table = d_8to24table;
|
||||
for (i = 0; i < 256; i++) {
|
||||
r = pal[0];
|
||||
g = pal[1];
|
||||
b = pal[2];
|
||||
pal += 3;
|
||||
|
||||
// v = (255<<24) + (r<<16) + (g<<8) + (b<<0);
|
||||
// v = (255<<0) + (r<<8) + (g<<16) + (b<<24);
|
||||
v = (255 << 24) + (r << 0) + (g << 8) + (b << 16);
|
||||
*table++ = v;
|
||||
}
|
||||
d_8to24table[255] &= 0; // 255 is transparent
|
||||
|
||||
// JACK: 3D distance calcs - k is last closest, l is the distance.
|
||||
|
||||
if (palflag)
|
||||
return;
|
||||
palflag = true;
|
||||
|
||||
COM_FOpenFile ("glquake/15to8.pal", &f);
|
||||
if (f) {
|
||||
Qread (f, d_15to8table, 1 << 15);
|
||||
Qclose (f);
|
||||
} else {
|
||||
for (i = 0; i < (1 << 15); i++) {
|
||||
/* Maps 000000000000000 000000000011111 = Red = 0x1F
|
||||
000001111100000 = Blue = 0x03E0 111110000000000 = Grn =
|
||||
0x7C00 */
|
||||
r = ((i & 0x1F) << 3) + 4;
|
||||
g = ((i & 0x03E0) >> 2) + 4;
|
||||
b = ((i & 0x7C00) >> 7) + 4;
|
||||
pal = (unsigned char *) d_8to24table;
|
||||
for (v = 0, k = 0, bestdist = 10000.0; v < 256; v++, pal += 4) {
|
||||
r1 = (int) r - (int) pal[0];
|
||||
g1 = (int) g - (int) pal[1];
|
||||
b1 = (int) b - (int) pal[2];
|
||||
dist = sqrt (((r1 * r1) + (g1 * g1) + (b1 * b1)));
|
||||
if (dist < bestdist) {
|
||||
k = v;
|
||||
bestdist = dist;
|
||||
}
|
||||
}
|
||||
d_15to8table[i] = k;
|
||||
}
|
||||
snprintf (s, sizeof (s), "%s/glquake/15to8.pal", com_gamedir);
|
||||
COM_CreatePath (s);
|
||||
if ((f = Qopen (s, "wb")) != NULL) {
|
||||
Qwrite (f, d_15to8table, 1 << 15);
|
||||
Qclose (f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
VID_ShiftPalette (unsigned char *palette)
|
||||
{
|
||||
|
@ -1373,51 +1199,6 @@ VID_InitFullDIB (HINSTANCE hInstance)
|
|||
Con_Printf ("No fullscreen DIB modes found\n");
|
||||
}
|
||||
|
||||
qboolean
|
||||
VID_Is8bit ()
|
||||
{
|
||||
return is8bit;
|
||||
}
|
||||
|
||||
void
|
||||
VID_Init8bitPalette (void)
|
||||
{
|
||||
int i;
|
||||
GLubyte thePalette[256 * 3];
|
||||
GLubyte *oldPalette, *newPalette;
|
||||
|
||||
vid_use8bit =
|
||||
Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL,
|
||||
"Use 8-bit shared palettes.");
|
||||
|
||||
if (!vid_use8bit->int_val) return;
|
||||
|
||||
if (is8bit) { // already done...
|
||||
return;
|
||||
}
|
||||
|
||||
if (QFGL_ExtensionPresent ("GL_EXT_shared_texture_palette")) {
|
||||
if (!(qglColorTableEXT = QFGL_ExtensionAddress ("glColorTableEXT"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
Con_Printf ("8-bit GL extension enabled.\n");
|
||||
|
||||
glEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
|
||||
oldPalette = (GLubyte *) d_8to24table; // d_8to24table3dfx;
|
||||
newPalette = thePalette;
|
||||
for (i = 0; i < 256; i++) {
|
||||
*newPalette++ = *oldPalette++;
|
||||
*newPalette++ = *oldPalette++;
|
||||
*newPalette++ = *oldPalette++;
|
||||
oldPalette++;
|
||||
}
|
||||
qglColorTableEXT (GL_SHARED_TEXTURE_PALETTE_EXT, GL_RGB, 256, GL_RGB,
|
||||
GL_UNSIGNED_BYTE, (GLvoid *) thePalette);
|
||||
is8bit = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
VID_Init
|
||||
*/
|
||||
|
@ -1656,8 +1437,6 @@ VID_Init (unsigned char *palette)
|
|||
void
|
||||
VID_Init_Cvars ()
|
||||
{
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL,
|
||||
"Grab the mouse from X while playing quake");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1691,3 +1470,10 @@ VID_SetCaption (char *text)
|
|||
SetWindowText (mainwindow, (LPSTR) va ("%s %s", PROGRAM, VERSION));
|
||||
}
|
||||
}
|
||||
|
||||
qboolean
|
||||
VID_SetGamma (double gamma)
|
||||
{
|
||||
// FIXME: Need function for HW gamma correction
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "client.h"
|
||||
#include "game.h"
|
||||
#include "host.h"
|
||||
#include "screen.h"
|
||||
#include "QF/screen.h"
|
||||
|
||||
#define MINIMUM_WIN_MEMORY 0x0880000
|
||||
#define MAXIMUM_WIN_MEMORY 0x1000000
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "host.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "resource.h"
|
||||
#include "screen.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/vid.h"
|
||||
|
|
Loading…
Reference in a new issue