]> 4ch.mooo.com Git - 16.git/blob - src/v2/source/verge/MAPED/VDRIVER.C
wwww
[16.git] / src / v2 / source / verge / MAPED / VDRIVER.C
1 /*\r
2 Copyright (C) 1998 BJ Eirich (aka vecna)\r
3 This program is free software; you can redistribute it and/or\r
4 modify it under the terms of the GNU General Public License\r
5 as published by the Free Software Foundation; either version 2\r
6 of the License, or (at your option) any later version.\r
7 This program is distributed in the hope that it will be useful,\r
8 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
10 See the GNU General Public Lic\r
11 See the GNU General Public License for more details.\r
12 You should have received a copy of the GNU General Public License\r
13 along with this program; if not, write to the Free Software\r
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
15 */\r
16 \r
17 #include <conio.h>\r
18 \r
19 #include "mode13h.h"\r
20 #include "modex.h"\r
21 \r
22 // ================================= Data ====================================\r
23 \r
24 // Driver function-pointers.\r
25 int (*ShutdownVideo) (void);\r
26 int (*ShowPage) (void);\r
27 int (*CopySprite) (int x, int y, int width, int height, char *src);\r
28 int (*CCopySprite) (int x, int y, int width, int height, char *src);\r
29 int (*TCCopySprite) (int x, int y, int width, int height, char *src);\r
30 int (*TCopySprite) (int x, int y, int width, int height, char *src);\r
31 int (*CopyTile) (int x, int y, char *src);\r
32 int (*FilledBox) (int x, int y, int width, int height, char c);\r
33 int (*VLine) (int x, int y, int height, char color);\r
34 int (*HLine) (int x, int y, int width, char color);\r
35 int (*ColorGrid) (int x, int y, char c);\r
36 int (*ClearScreen) (void);\r
37 int (*CopySpriteLucentClip) (int x, int y, int width, int height, unsigned char *src);\r
38 \r
39 unsigned char pal[768], pal2[768];\r
40 unsigned char *screen=0;\r
41 \r
42 int sx=0, sy=0;\r
43 int tx=0, ty=0;\r
44 int tsx=0, tsy=0;\r
45 int map_scroll_x=1;\r
46 int map_scroll_y=1;\r
47 \r
48 // ================================= Code ====================================\r
49 \r
50 void InitVideo(int mode)\r
51 {\r
52   switch (mode)\r
53   {\r
54     case 0: InitMode13h(); break;\r
55     case 1: InitModeX();             // 320x240\r
56             break;\r
57   }\r
58 }\r
59 \r
60 void SetPalette(unsigned char *pall)\r
61 { unsigned int i;\r
62 \r
63   outp(0x03c8,0);\r
64   for (i=0; i<768; i++)\r
65     outp(0x03c9,pall[i]);\r
66 }\r
67 \r
68 void GetPalette(void)\r
69 { unsigned int i;\r
70 \r
71   outp(0x03c7,0);\r
72   for (i=0; i<768; i++)\r
73     pal[i]=inp(0x03c9);\r
74 }\r
75 \r
76 void set_intensity(unsigned int n)\r
77 { unsigned int i;\r
78 \r
79   for (i=0; i<768; i++)\r
80     pal2[i]=(pal[i]*n)>>6;\r
81 \r
82   SetPalette(pal2);\r
83 }\r
84 \r
85 #define byte unsigned char\r
86 int cx1=16, cy1=16, cx2=336, cy2=256;\r
87 \r
88 char stipple[256]={\r
89   1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,\r
90   0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,\r
91   1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,\r
92   0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,\r
93   1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,\r
94   0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,\r
95   1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,\r
96   0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,\r
97   1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,\r
98   0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,\r
99   1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,\r
100   0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,\r
101   1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,\r
102   0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,\r
103   1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,\r
104   0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,\r
105 };\r