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#ifdef _WIN32
23#pragma warning( disable : 4229 )  // mgraph gets this
24
25#include <windows.h>
26#define WM_MOUSEWHEEL                   0x020A
27
28#ifndef SERVERONLY
29#include <ddraw.h>
30#include <dsound.h>
31#ifndef GLQUAKE
32#include <mgraph.h>
33#endif
34#endif
35
36extern	HINSTANCE	global_hInstance;
37extern	int			global_nCmdShow;
38
39#ifndef SERVERONLY
40
41extern LPDIRECTDRAW		lpDD;
42extern qboolean			DDActive;
43extern LPDIRECTDRAWSURFACE	lpPrimary;
44extern LPDIRECTDRAWSURFACE	lpFrontBuffer;
45extern LPDIRECTDRAWSURFACE	lpBackBuffer;
46extern LPDIRECTDRAWPALETTE	lpDDPal;
47extern LPDIRECTSOUND pDS;
48extern LPDIRECTSOUNDBUFFER pDSBuf;
49
50extern DWORD gSndBufSize;
51//#define SNDBUFSIZE 65536
52
53void	VID_LockBuffer (void);
54void	VID_UnlockBuffer (void);
55
56#endif
57
58typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t;
59
60extern modestate_t	modestate;
61
62extern HWND			mainwindow;
63extern qboolean		ActiveApp, Minimized;
64
65extern qboolean	WinNT;
66
67int VID_ForceUnlockedAndReturnState (void);
68void VID_ForceLockState (int lk);
69
70void IN_ShowMouse (void);
71void IN_DeactivateMouse (void);
72void IN_HideMouse (void);
73void IN_ActivateMouse (void);
74void IN_RestoreOriginalMouseState (void);
75void IN_SetQuakeMouseState (void);
76void IN_MouseEvent (int mstate);
77
78extern qboolean	winsock_lib_initialized;
79
80extern int		window_center_x, window_center_y;
81extern RECT		window_rect;
82
83extern qboolean	mouseinitialized;
84extern HWND		hwnd_dialog;
85
86extern HANDLE	hinput, houtput;
87
88void IN_UpdateClipCursor (void);
89void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify);
90
91void S_BlockSound (void);
92void S_UnblockSound (void);
93
94void VID_SetDefaultMode (void);
95
96int (PASCAL FAR *pWSAStartup)(WORD wVersionRequired, LPWSADATA lpWSAData);
97int (PASCAL FAR *pWSACleanup)(void);
98int (PASCAL FAR *pWSAGetLastError)(void);
99SOCKET (PASCAL FAR *psocket)(int af, int type, int protocol);
100int (PASCAL FAR *pioctlsocket)(SOCKET s, long cmd, u_long FAR *argp);
101int (PASCAL FAR *psetsockopt)(SOCKET s, int level, int optname,
102							  const char FAR * optval, int optlen);
103int (PASCAL FAR *precvfrom)(SOCKET s, char FAR * buf, int len, int flags,
104							struct sockaddr FAR *from, int FAR * fromlen);
105int (PASCAL FAR *psendto)(SOCKET s, const char FAR * buf, int len, int flags,
106						  const struct sockaddr FAR *to, int tolen);
107int (PASCAL FAR *pclosesocket)(SOCKET s);
108int (PASCAL FAR *pgethostname)(char FAR * name, int namelen);
109struct hostent FAR * (PASCAL FAR *pgethostbyname)(const char FAR * name);
110struct hostent FAR * (PASCAL FAR *pgethostbyaddr)(const char FAR * addr,
111												  int len, int type);
112int (PASCAL FAR *pgetsockname)(SOCKET s, struct sockaddr FAR *name,
113							   int FAR * namelen);
114#endif
115