mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +00:00
[win] Clean up a pile of messy externs
This commit is contained in:
parent
596cd164a3
commit
81a837da0f
6 changed files with 29 additions and 129 deletions
|
@ -47,6 +47,10 @@ extern RECT win_dst_rect;
|
||||||
extern RECT win_window_rect;
|
extern RECT win_window_rect;
|
||||||
extern HDC win_gdi;
|
extern HDC win_gdi;
|
||||||
extern struct sw_ctx_s *win_sw_context;
|
extern struct sw_ctx_s *win_sw_context;
|
||||||
|
extern int win_minimized;
|
||||||
|
|
||||||
|
LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
void Win_Activate (BOOL fActive, BOOL minimize);
|
||||||
|
|
||||||
void Win_UnloadAllDrivers (void);
|
void Win_UnloadAllDrivers (void);
|
||||||
void Win_CreateDriver (void);
|
void Win_CreateDriver (void);
|
||||||
|
|
|
@ -52,6 +52,10 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_DDRAW_H
|
||||||
|
# include <ddraw.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MGRAPH_H
|
#ifdef HAVE_MGRAPH_H
|
||||||
# include <mgraph.h>
|
# include <mgraph.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,23 +71,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern HINSTANCE global_hInstance;
|
extern HINSTANCE global_hInstance;
|
||||||
extern int global_nCmdShow;
|
|
||||||
|
|
||||||
#ifdef HAVE_DDRAW_H
|
|
||||||
# include <ddraw.h>
|
|
||||||
extern LPDIRECTDRAW lpDD;
|
|
||||||
extern LPDIRECTDRAWSURFACE lpPrimary;
|
|
||||||
extern LPDIRECTDRAWSURFACE lpFrontBuffer;
|
|
||||||
extern LPDIRECTDRAWSURFACE lpBackBuffer;
|
|
||||||
extern LPDIRECTDRAWPALETTE lpDDPal;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t;
|
typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t;
|
||||||
|
|
||||||
extern modestate_t modestate;
|
extern modestate_t modestate;
|
||||||
|
|
||||||
extern qboolean ActiveApp, Minimized;
|
|
||||||
|
|
||||||
extern qboolean WinNT;
|
extern qboolean WinNT;
|
||||||
|
|
||||||
extern qboolean winsock_lib_initialized;
|
extern qboolean winsock_lib_initialized;
|
||||||
|
@ -95,34 +87,6 @@ extern RECT window_rect;
|
||||||
extern HWND hwnd_dialog;
|
extern HWND hwnd_dialog;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern HANDLE hinput, houtput;
|
|
||||||
|
|
||||||
void S_BlockSound (void);
|
|
||||||
void S_UnblockSound (void);
|
|
||||||
|
|
||||||
DWORD *DSOUND_LockBuffer(qboolean lockit);
|
|
||||||
void DSOUND_ClearBuffer(int clear);
|
|
||||||
void DSOUND_Restore(void);
|
|
||||||
|
|
||||||
extern int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData);
|
|
||||||
extern int (PASCAL FAR *pWSACleanup)(void);
|
|
||||||
extern int (PASCAL FAR *pWSAGetLastError)(void);
|
|
||||||
extern SOCKET (PASCAL FAR *psocket)(int af, int type, int protocol);
|
|
||||||
extern int (PASCAL FAR *pioctlsocket)(SOCKET s, long cmd, u_long FAR *argp);
|
|
||||||
extern int (PASCAL FAR *psetsockopt)(SOCKET s, int level, int optname, const char FAR * optval, int optlen);
|
|
||||||
extern int (PASCAL FAR *precvfrom)(SOCKET s, char FAR * buf, int len, int flags, struct sockaddr FAR *from, int FAR * fromlen);
|
|
||||||
extern int (PASCAL FAR *psendto)(SOCKET s, const char FAR * buf, int len, int flags, const struct sockaddr FAR *to, int tolen);
|
|
||||||
extern int (PASCAL FAR *pclosesocket)(SOCKET s);
|
|
||||||
extern int (PASCAL FAR *pgethostname)(char FAR * name, int namelen);
|
|
||||||
extern struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name);
|
|
||||||
extern struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr, int len, int type);
|
|
||||||
extern int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name, int FAR * namelen);
|
|
||||||
|
|
||||||
HWND WINAPI InitializeWindow (HINSTANCE hInstance, int nCmdShow);
|
|
||||||
LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
||||||
LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
||||||
void AppActivate (BOOL fActive, BOOL minimize);
|
|
||||||
|
|
||||||
#undef E_POINTER
|
#undef E_POINTER
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
|
@ -96,6 +96,7 @@ static general_funcs_t plugin_info_general_funcs;
|
||||||
static snd_output_data_t plugin_info_snd_output_data;
|
static snd_output_data_t plugin_info_snd_output_data;
|
||||||
static snd_output_funcs_t plugin_info_snd_output_funcs;
|
static snd_output_funcs_t plugin_info_snd_output_funcs;
|
||||||
|
|
||||||
|
static DWORD *DSOUND_LockBuffer (qboolean lockit);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SNDDMA_Init_Cvars (void)
|
SNDDMA_Init_Cvars (void)
|
||||||
|
@ -424,7 +425,7 @@ SNDDMA_shutdown (void)
|
||||||
FreeSound ();
|
FreeSound ();
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD *
|
static DWORD *
|
||||||
DSOUND_LockBuffer (qboolean lockit)
|
DSOUND_LockBuffer (qboolean lockit)
|
||||||
{
|
{
|
||||||
int reps;
|
int reps;
|
||||||
|
@ -469,7 +470,7 @@ DSOUND_LockBuffer (qboolean lockit)
|
||||||
return (pbuf1);
|
return (pbuf1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void __attribute__((used)) //FIXME make it true
|
||||||
DSOUND_ClearBuffer (int clear)
|
DSOUND_ClearBuffer (int clear)
|
||||||
{
|
{
|
||||||
DWORD *pData;
|
DWORD *pData;
|
||||||
|
@ -480,7 +481,7 @@ DSOUND_ClearBuffer (int clear)
|
||||||
DSOUND_LockBuffer (false);
|
DSOUND_LockBuffer (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void __attribute__((used)) //FIXME make it true
|
||||||
DSOUND_Restore (void)
|
DSOUND_Restore (void)
|
||||||
{
|
{
|
||||||
// if the buffer was lost or stopped, restore it and/or restart it
|
// if the buffer was lost or stopped, restore it and/or restart it
|
||||||
|
|
|
@ -49,6 +49,7 @@ HDC win_maindc;
|
||||||
HDC win_dib_section;
|
HDC win_dib_section;
|
||||||
int win_using_ddraw;
|
int win_using_ddraw;
|
||||||
int win_palettized;
|
int win_palettized;
|
||||||
|
int win_minimized;
|
||||||
LPDIRECTDRAWSURFACE win_dd_frontbuffer;
|
LPDIRECTDRAWSURFACE win_dd_frontbuffer;
|
||||||
LPDIRECTDRAWSURFACE win_dd_backbuffer;
|
LPDIRECTDRAWSURFACE win_dd_backbuffer;
|
||||||
RECT win_src_rect;
|
RECT win_src_rect;
|
||||||
|
@ -56,7 +57,6 @@ RECT win_dst_rect;
|
||||||
RECT win_window_rect;
|
RECT win_window_rect;
|
||||||
HDC win_gdi;
|
HDC win_gdi;
|
||||||
int win_canalttab = 0;
|
int win_canalttab = 0;
|
||||||
int win_palettized;
|
|
||||||
sw_ctx_t *win_sw_context;
|
sw_ctx_t *win_sw_context;
|
||||||
|
|
||||||
#define MODE_WINDOWED 0
|
#define MODE_WINDOWED 0
|
||||||
|
@ -92,20 +92,15 @@ static cvar_t *vid_window_y;
|
||||||
#define MAX_MODE_LIST 36
|
#define MAX_MODE_LIST 36
|
||||||
#define VID_ROW_SIZE 3
|
#define VID_ROW_SIZE 3
|
||||||
|
|
||||||
extern qboolean Minimized;
|
static int DIBWidth, DIBHeight;
|
||||||
|
static RECT WindowRect;
|
||||||
|
static DWORD WindowStyle, ExWindowStyle;
|
||||||
|
|
||||||
HWND WINAPI InitializeWindow (HINSTANCE hInstance, int nCmdShow);
|
int window_center_x, window_center_y, window_width, window_height;
|
||||||
|
RECT window_rect;
|
||||||
int DIBWidth, DIBHeight;
|
|
||||||
RECT WindowRect;
|
|
||||||
DWORD WindowStyle, ExWindowStyle;
|
|
||||||
|
|
||||||
int window_center_x, window_center_y, window_width, window_height;
|
|
||||||
RECT window_rect;
|
|
||||||
|
|
||||||
DEVMODE win_gdevmode;
|
DEVMODE win_gdevmode;
|
||||||
static qboolean startwindowed = 0, windowed_mode_set;
|
static qboolean startwindowed = 0, windowed_mode_set;
|
||||||
static qboolean vid_palettized;
|
|
||||||
static int vid_fulldib_on_focus_mode;
|
static int vid_fulldib_on_focus_mode;
|
||||||
static qboolean force_minimized, in_mode_set, force_mode_set;
|
static qboolean force_minimized, in_mode_set, force_mode_set;
|
||||||
static qboolean vid_mode_set;
|
static qboolean vid_mode_set;
|
||||||
|
@ -427,25 +422,8 @@ Win_UnloadAllDrivers (void)
|
||||||
win_using_ddraw = false;
|
win_using_ddraw = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// compatibility
|
|
||||||
qboolean DDActive;
|
|
||||||
|
|
||||||
void VID_MenuDraw (void);
|
|
||||||
void VID_MenuKey (int key);
|
|
||||||
|
|
||||||
LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
||||||
void AppActivate (BOOL fActive, BOOL minimize);
|
|
||||||
|
|
||||||
static int VID_SetMode (int modenum, const byte *palette);
|
static int VID_SetMode (int modenum, const byte *palette);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
VID_RememberWindowPos
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
static void __attribute__ ((used))
|
static void __attribute__ ((used))
|
||||||
VID_RememberWindowPos (void)
|
VID_RememberWindowPos (void)
|
||||||
{
|
{
|
||||||
|
@ -462,11 +440,6 @@ VID_RememberWindowPos (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
VID_CheckWindowXY
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
static void
|
static void
|
||||||
VID_CheckWindowXY (void)
|
VID_CheckWindowXY (void)
|
||||||
{
|
{
|
||||||
|
@ -479,11 +452,6 @@ VID_CheckWindowXY (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
VID_UpdateWindowStatus
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
Win_UpdateWindowStatus (int window_x, int window_y)
|
Win_UpdateWindowStatus (int window_x, int window_y)
|
||||||
{
|
{
|
||||||
|
@ -497,11 +465,6 @@ Win_UpdateWindowStatus (int window_x, int window_y)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
ClearAllStates
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
static void
|
static void
|
||||||
ClearAllStates (void)
|
ClearAllStates (void)
|
||||||
{
|
{
|
||||||
|
@ -517,11 +480,6 @@ ClearAllStates (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
VID_CheckAdequateMem
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
static qboolean
|
static qboolean
|
||||||
VID_CheckAdequateMem (int width, int height)
|
VID_CheckAdequateMem (int width, int height)
|
||||||
{
|
{
|
||||||
|
@ -598,11 +556,6 @@ VID_InitModes (HINSTANCE hInstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
VID_GetDisplayModes
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
static void
|
static void
|
||||||
VID_GetDisplayModes (void)
|
VID_GetDisplayModes (void)
|
||||||
{
|
{
|
||||||
|
@ -716,7 +669,7 @@ Win_CloseDisplay (void)
|
||||||
PostMessage (HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM) win_mainwindow,
|
PostMessage (HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM) win_mainwindow,
|
||||||
(LPARAM) 0);
|
(LPARAM) 0);
|
||||||
PostMessage (HWND_BROADCAST, WM_SYSCOLORCHANGE, (WPARAM) 0, (LPARAM) 0);
|
PostMessage (HWND_BROADCAST, WM_SYSCOLORCHANGE, (WPARAM) 0, (LPARAM) 0);
|
||||||
AppActivate (false, false);
|
Win_Activate (false, false);
|
||||||
|
|
||||||
//FIXME? if (hwnd_dialog) DestroyWindow (hwnd_dialog);
|
//FIXME? if (hwnd_dialog) DestroyWindow (hwnd_dialog);
|
||||||
if (win_mainwindow)
|
if (win_mainwindow)
|
||||||
|
@ -1032,9 +985,9 @@ VID_SetMode (int modenum, const byte *palette)
|
||||||
|
|
||||||
hdc = GetDC (NULL);
|
hdc = GetDC (NULL);
|
||||||
if (GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE) {
|
if (GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE) {
|
||||||
vid_palettized = true;
|
win_palettized = true;
|
||||||
} else {
|
} else {
|
||||||
vid_palettized = false;
|
win_palettized = false;
|
||||||
}
|
}
|
||||||
ReleaseDC (NULL, hdc);
|
ReleaseDC (NULL, hdc);
|
||||||
|
|
||||||
|
@ -1323,26 +1276,6 @@ Win_SetGamma (double gamma)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
VID_SaveGamma (void)
|
|
||||||
{
|
|
||||||
HDC hdc = GetDC (NULL);
|
|
||||||
|
|
||||||
GetDeviceGammaRamp (hdc, &systemgammaramps[0][0]);
|
|
||||||
ReleaseDC (NULL, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
VID_RestoreGamma (void)
|
|
||||||
{
|
|
||||||
HDC hdc = GetDC (NULL);
|
|
||||||
|
|
||||||
SetDeviceGammaRamp (hdc, &systemgammaramps[0][0]);
|
|
||||||
ReleaseDC (NULL, hdc);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CVAR_ORIGINAL CVAR_NONE // FIXME
|
#define CVAR_ORIGINAL CVAR_NONE // FIXME
|
||||||
void
|
void
|
||||||
Win_Init_Cvars (void)
|
Win_Init_Cvars (void)
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
#include "QF/qargs.h"
|
#include "QF/qargs.h"
|
||||||
#include "QF/screen.h"
|
#include "QF/screen.h"
|
||||||
|
#include "QF/sound.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
@ -700,30 +701,27 @@ MapKey (unsigned int keycode, int press, int *k, int *u)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
AppActivate
|
|
||||||
|
|
||||||
fActive - True if app is activating
|
fActive - True if app is activating
|
||||||
If the application is activating, then swap the system into SYSPAL_NOSTATIC
|
If the application is activating, then swap the system into SYSPAL_NOSTATIC
|
||||||
mode so that our palettes will display correctly.
|
mode so that our palettes will display correctly.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
AppActivate (BOOL fActive, BOOL minimize)
|
Win_Activate (BOOL active, BOOL minimize)
|
||||||
{
|
{
|
||||||
static BOOL sound_active;
|
static BOOL sound_active;
|
||||||
|
|
||||||
ActiveApp = fActive;
|
win_minimized = minimize;
|
||||||
Minimized = minimize;
|
|
||||||
|
|
||||||
// enable/disable sound on focus gain/loss
|
// enable/disable sound on focus gain/loss
|
||||||
if (!ActiveApp && sound_active) {
|
if (!active && sound_active) {
|
||||||
S_BlockSound ();
|
S_BlockSound ();
|
||||||
sound_active = false;
|
sound_active = false;
|
||||||
} else if (ActiveApp && !sound_active) {
|
} else if (active && !sound_active) {
|
||||||
S_UnblockSound ();
|
S_UnblockSound ();
|
||||||
sound_active = true;
|
sound_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fActive) {
|
if (active) {
|
||||||
if (modestate == MS_FULLDIB) {
|
if (modestate == MS_FULLDIB) {
|
||||||
IN_ActivateMouse ();
|
IN_ActivateMouse ();
|
||||||
IN_HideMouse ();
|
IN_HideMouse ();
|
||||||
|
@ -858,7 +856,7 @@ MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
fActive = LOWORD (wParam);
|
fActive = LOWORD (wParam);
|
||||||
fMinimized = (BOOL) HIWORD (wParam);
|
fMinimized = (BOOL) HIWORD (wParam);
|
||||||
AppActivate (!(fActive == WA_INACTIVE), fMinimized);
|
Win_Activate (!(fActive == WA_INACTIVE), fMinimized);
|
||||||
// fix leftover Alt from any Alt-Tab or the like that switched us
|
// fix leftover Alt from any Alt-Tab or the like that switched us
|
||||||
// away
|
// away
|
||||||
IN_ClearStates ();
|
IN_ClearStates ();
|
||||||
|
|
|
@ -76,7 +76,7 @@ win_set_palette (const byte *palette)
|
||||||
st2d_8to32table[i].bgra[2] = viddef.gammatable[pal[0]];
|
st2d_8to32table[i].bgra[2] = viddef.gammatable[pal[0]];
|
||||||
st2d_8to32table[i].bgra[3] = 255;
|
st2d_8to32table[i].bgra[3] = 255;
|
||||||
}
|
}
|
||||||
if (!Minimized && !win_using_ddraw && win_dib_section) {
|
if (!win_minimized && !win_using_ddraw && win_dib_section) {
|
||||||
RGBQUAD colors[256];
|
RGBQUAD colors[256];
|
||||||
memcpy (colors, st2d_8to32table, sizeof (colors));
|
memcpy (colors, st2d_8to32table, sizeof (colors));
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue