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// vid_dos.h: header file for DOS-specific video stuff
21
22typedef struct vmode_s {
23	struct vmode_s	*pnext;
24	char		*name;
25	char		*header;
26	unsigned	width;
27	unsigned	height;
28	float		aspect;
29	unsigned	rowbytes;
30	int			planar;
31	int			numpages;
32	void		*pextradata;
33	int			(*setmode)(viddef_t *vid, struct vmode_s *pcurrentmode);
34	void		(*swapbuffers)(viddef_t *vid, struct vmode_s *pcurrentmode,
35							   vrect_t *rects);
36	void		(*setpalette)(viddef_t *vid, struct vmode_s *pcurrentmode,
37							  unsigned char *palette);
38	void		(*begindirectrect)(viddef_t *vid, struct vmode_s *pcurrentmode,
39								   int x, int y, byte *pbitmap, int width,
40								   int height);
41	void		(*enddirectrect)(viddef_t *vid, struct vmode_s *pcurrentmode,
42								 int x, int y, int width, int height);
43} vmode_t;
44
45// vid_wait settings
46#define VID_WAIT_NONE			0
47#define VID_WAIT_VSYNC			1
48#define VID_WAIT_DISPLAY_ENABLE	2
49
50extern int		numvidmodes;
51extern vmode_t	*pvidmodes;
52
53extern int		VGA_width, VGA_height, VGA_rowbytes, VGA_bufferrowbytes;
54extern byte		*VGA_pagebase;
55extern vmode_t	*VGA_pcurmode;
56
57extern cvar_t	vid_wait;
58extern cvar_t	vid_nopageflip;
59extern cvar_t	_vid_wait_override;
60
61extern unsigned char colormap256[32][256];
62
63extern void	*vid_surfcache;
64extern int	vid_surfcachesize;
65
66void VGA_Init (void);
67void VID_InitVESA (void);
68void VID_InitExtra (void);
69void VGA_WaitVsync (void);
70void VGA_ClearVideoMem (int planar);
71void VGA_SetPalette(viddef_t *vid, vmode_t *pcurrentmode, unsigned char *pal);
72void VGA_SwapBuffersCopy (viddef_t *vid, vmode_t *pcurrentmode,
73	vrect_t *rects);
74qboolean VGA_FreeAndAllocVidbuffer (viddef_t *vid, int allocnewbuffer);
75qboolean VGA_CheckAdequateMem (int width, int height, int rowbytes,
76	int allocnewbuffer);
77void VGA_BeginDirectRect (viddef_t *vid, struct vmode_s *pcurrentmode, int x,
78	int y, byte *pbitmap, int width, int height);
79void VGA_EndDirectRect (viddef_t *vid, struct vmode_s *pcurrentmode, int x,
80	int y, int width, int height);
81void VGA_UpdateLinearScreen (void *srcptr, void *destptr, int width,
82	int height, int srcrowbytes, int destrowbytes);
83
84