1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19*/
20// winquake.h: Win32-specific Quake header file
21
22#pragma warning( disable : 4229 )  // mgraph gets this
23
24#include <windows.h>
25#define WM_MOUSEWHEEL                   0x020A
26
27#ifndef SERVERONLY
28#include <ddraw.h>
29#include <dsound.h>
30#ifndef GLQUAKE
31#include <mgraph.h>
32#endif
33#endif
34
35extern	HINSTANCE	global_hInstance;
36extern	int			global_nCmdShow;
37
38#ifndef SERVERONLY
39
40extern LPDIRECTDRAW		lpDD;
41extern qboolean			DDActive;
42extern LPDIRECTDRAWSURFACE	lpPrimary;
43extern LPDIRECTDRAWSURFACE	lpFrontBuffer;
44extern LPDIRECTDRAWSURFACE	lpBackBuffer;
45extern LPDIRECTDRAWPALETTE	lpDDPal;
46extern LPDIRECTSOUND pDS;
47extern LPDIRECTSOUNDBUFFER pDSBuf;
48
49extern DWORD gSndBufSize;
50//#define SNDBUFSIZE 65536
51
52void	VID_LockBuffer (void);
53void	VID_UnlockBuffer (void);
54
55#endif
56
57typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t;
58
59extern modestate_t	modestate;
60
61extern HWND			mainwindow;
62extern qboolean		ActiveApp, Minimized;
63
64extern qboolean	WinNT;
65
66int VID_ForceUnlockedAndReturnState (void);
67void VID_ForceLockState (int lk);
68
69void IN_ShowMouse (void);
70void IN_DeactivateMouse (void);
71void IN_HideMouse (void);
72void IN_ActivateMouse (void);
73void IN_RestoreOriginalMouseState (void);
74void IN_SetQuakeMouseState (void);
75void IN_MouseEvent (int mstate);
76
77extern qboolean	winsock_lib_initialized;
78
79extern cvar_t		_windowed_mouse;
80
81extern int		window_center_x, window_center_y;
82extern RECT		window_rect;
83
84extern qboolean	mouseinitialized;
85extern HWND		hwnd_dialog;
86
87extern HANDLE	hinput, houtput;
88
89void IN_UpdateClipCursor (void);
90void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify);
91
92void S_BlockSound (void);
93void S_UnblockSound (void);
94
95void VID_SetDefaultMode (void);
96
97int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData);
98int (PASCAL FAR *pWSACleanup)(void);
99int (PASCAL FAR *pWSAGetLastError)(void);
100SOCKET (PASCAL FAR *psocket)(int af, int type, int protocol);
101int (PASCAL FAR *pioctlsocket)(SOCKET s, long cmd, u_long FAR *argp);
102int (PASCAL FAR *psetsockopt)(SOCKET s, int level, int optname,
103							  const char FAR * optval, int optlen);
104int (PASCAL FAR *precvfrom)(SOCKET s, char FAR * buf, int len, int flags,
105							struct sockaddr FAR *from, int FAR * fromlen);
106int (PASCAL FAR *psendto)(SOCKET s, const char FAR * buf, int len, int flags,
107						  const struct sockaddr FAR *to, int tolen);
108int (PASCAL FAR *pclosesocket)(SOCKET s);
109int (PASCAL FAR *pgethostname)(char FAR * name, int namelen);
110struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name);
111struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr,
112												  int len, int type);
113int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name,
114							   int FAR * namelen);
115