1 /*
2 
3 Copyright (C) 2015-2018 Night Dive Studios, LLC.
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 /*
20  * $Source: r:/prj/lib/src/2d/RCS/grd.c $
21  * $Revision: 1.10 $
22  * $Author: kevin $
23  * $Date: 1994/12/05 21:07:24 $
24  *
25  * Global stuff.
26  *
27  * This file is part of the 2d library.
28  */
29 
30 #include "grs.h"
31 
32 /* pointer to the currently set screen. */
33 grs_screen *grd_screen=NULL;
34 
35 /* pointer to palette */
36 uchar grd_default_pal[768];
37 uchar *grd_pal=grd_default_pal;
38 
39 /* pointer to blend palette */
40 grs_rgb grd_default_bpal[1024];
41 grs_rgb *grd_bpal=grd_default_bpal;
42 
43 /* pointer to inverse palette */
44 uchar *grd_ipal=NULL;
45 
46 /* pointer to a canvas for the current virtual screen. */
47 grs_canvas *grd_screen_canvas;
48 
49 /* pointer to a canvas for the visible sub-region of the virtual screen. */
50 grs_canvas *grd_visible_canvas;
51 
52 /* pointer to currently set canvas. */
53 grs_canvas *grd_canvas;
54 
55 /* info for current graphics setup. */
56 grs_sys_info grd_info;
57 
58 grs_drvcap grd_mode_cap;
59 
60 /* capability info for currently set driver. */
61 grs_drvcap *grd_cap = &grd_mode_cap;
62 
63 /* pointer to start of current device driver's function table. */
64 void (**grd_device_table)();
65 
66 void (**grd_pixel_table)();
67 
68 /* pointer to start of current bitmap driver's function table for clipped
69    primitives. */
70 void (**grd_canvas_table)();
71 
72 /* currently active graphics mode. -1 means unrecognized mode */
73 int grd_mode=-1;
74 
75 /* flag for whether we are executing in an interrupt. */
76 uchar grd_interrupt=0;
77 
78 /* Function chaining globals.  Set during gr_set_canvas; that's why I moved them here. */
79 short grd_pixel_index, grd_canvas_index;
80 uchar chn_flags;
81 
82 /* Graphics capability detection function pointer. */
83 int (*grd_detect_func)(grs_sys_info *info);
84