7 |
|
|
8 |
|
#include "copyright.h" |
9 |
|
|
10 |
– |
#include "standard.h" |
11 |
– |
|
10 |
|
#include <graph.h> |
11 |
|
|
12 |
+ |
#include "standard.h" |
13 |
|
#include "driver.h" |
15 |
– |
|
14 |
|
#include "color.h" |
15 |
|
|
16 |
|
#define GAMMA 2.2 /* exponent for color correction */ |
17 |
|
|
18 |
|
|
19 |
< |
int vga_close(), vga_clear(), vga_paintr(), vga_comout(), vga_errout(), |
20 |
< |
vga_comin(); |
19 |
> |
static struct driver * vga_init(char *name, char *id); |
20 |
> |
static void vga_errout(char *msg); |
21 |
> |
static dr_newcolrf_t vgacolr; |
22 |
|
|
23 |
+ |
static dr_closef_t vga_close; |
24 |
+ |
static dr_clearf_t vga_clear; |
25 |
+ |
static dr_paintrf_t vga_paintr; |
26 |
+ |
static dr_comoutf_t vga_comout; |
27 |
+ |
static dr_cominf_t vga_comin; |
28 |
+ |
|
29 |
|
static struct driver vga_driver = { |
30 |
|
vga_close, vga_clear, vga_paintr, NULL, |
31 |
|
vga_comout, vga_comin, NULL, 1.0 |
32 |
|
}; |
33 |
|
|
34 |
|
static char fatalerr[128]; |
30 |
– |
|
35 |
|
static struct videoconfig config; |
36 |
|
|
33 |
– |
extern char *getenv(); |
37 |
|
|
38 |
|
|
39 |
< |
struct driver * |
40 |
< |
vga_init(name, id) /* open VGA */ |
41 |
< |
char *name, *id; |
39 |
> |
static struct driver * |
40 |
> |
vga_init( /* open VGA */ |
41 |
> |
char *name, |
42 |
> |
char *id |
43 |
> |
) |
44 |
|
{ |
45 |
|
static short mode_pref[] = {_MRES256COLOR, -1}; |
46 |
|
static short smode_pref[] = {_XRES256COLOR, _SVRES256COLOR, |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
< |
static |
95 |
< |
vga_close() /* close VGA */ |
94 |
> |
static void |
95 |
> |
vga_close(void) /* close VGA */ |
96 |
|
{ |
97 |
|
ms_gcdone(&vga_driver); |
98 |
|
_setvideomode(_DEFAULTMODE); |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
< |
static |
112 |
< |
vga_clear(x, y) /* clear VGA */ |
113 |
< |
int x, y; |
111 |
> |
static void |
112 |
> |
vga_clear( /* clear VGA */ |
113 |
> |
int x, |
114 |
> |
int y |
115 |
> |
) |
116 |
|
{ |
117 |
|
_clearscreen(_GCLEARSCREEN); |
118 |
|
new_ctab(config.numcolors-2); /* init color table */ |
119 |
|
} |
120 |
|
|
121 |
|
|
122 |
< |
static |
123 |
< |
vga_paintr(col, xmin, ymin, xmax, ymax) /* paint a rectangle */ |
124 |
< |
COLOR col; |
125 |
< |
int xmin, ymin, xmax, ymax; |
122 |
> |
static void |
123 |
> |
vga_paintr( /* paint a rectangle */ |
124 |
> |
COLOR col, |
125 |
> |
int xmin, |
126 |
> |
int ymin, |
127 |
> |
int xmax, |
128 |
> |
int ymax |
129 |
> |
) |
130 |
|
{ |
120 |
– |
extern int vgacolr(); |
121 |
– |
|
131 |
|
_setcolor(get_pixel(col, vgacolr)+2); |
132 |
|
_rectangle(_GFILLINTERIOR, xmin, vga_driver.ysiz-ymax, |
133 |
|
xmax-1, vga_driver.ysiz-1-ymin); |
135 |
|
} |
136 |
|
|
137 |
|
|
138 |
< |
static |
139 |
< |
vga_comout(s) /* put s to text output */ |
140 |
< |
register char *s; |
138 |
> |
static void |
139 |
> |
vga_comout( /* put s to text output */ |
140 |
> |
register char *s |
141 |
> |
) |
142 |
|
{ |
143 |
|
struct rccoord tpos; |
144 |
|
char buf[128]; |
168 |
|
} |
169 |
|
|
170 |
|
|
171 |
< |
static |
172 |
< |
vga_errout(msg) |
173 |
< |
register char *msg; |
171 |
> |
static void |
172 |
> |
vga_errout( |
173 |
> |
register char *msg |
174 |
> |
) |
175 |
|
{ |
176 |
|
static char *fep = fatalerr; |
177 |
|
|
184 |
|
} |
185 |
|
|
186 |
|
|
187 |
< |
static |
188 |
< |
vga_comin(buf, prompt) /* get input line from console */ |
189 |
< |
char *buf; |
190 |
< |
char *prompt; |
187 |
> |
static void |
188 |
> |
vga_comin( /* get input line from console */ |
189 |
> |
char *buf, |
190 |
> |
char *prompt |
191 |
> |
) |
192 |
|
{ |
193 |
|
extern int getch(); |
194 |
|
|
199 |
|
} |
200 |
|
|
201 |
|
|
202 |
< |
static |
203 |
< |
vgacolr(index, r, g, b) /* enter a color into our table */ |
204 |
< |
int index; |
205 |
< |
int r, g, b; |
202 |
> |
static void |
203 |
> |
vgacolr( /* enter a color into our table */ |
204 |
> |
int index, |
205 |
> |
int r, |
206 |
> |
int g, |
207 |
> |
int b |
208 |
> |
) |
209 |
|
{ |
210 |
|
register long cl; |
211 |
|
|