1 // Rolling Thunder hacker #3: Title graphics
13 // With C++ string constants, you need to use a double backslash in
14 // order to indicate a single backslash. Confusing? You bet!
15 // [It's called "escaping the escape character."]
17 #define fn1 "c:\\games\\romhac~1\\r5"
18 #define fn2 "c:\\games\\romhac~1\\r6"
22 char far *screen = (char far *) MK_FP(0xA000,0);
25 0, 1, 2, 3, 4, 5, 6, 7,
26 0, 1, 2, 3, 4, 5, 6, 7,
27 8, 9, 10, 11, 12, 13, 14, 15,
28 8, 9, 10, 11, 12, 13, 14, 15,
29 16, 17, 0, 1, 16, 17, 0, 1,
30 16, 17, 0, 1, 16, 17, 0, 1,
31 16, 17, 0, 1, 16, 17, 0, 1,
32 16, 17, 0, 1, 16, 17, 0, 1,
33 2, 3, 4, 5, 6, 7, 8, 9,
34 2, 3, 4, 5, 6, 7, 8, 9,
35 10, 11, 12, 13, 14, 15, 16, 17,
36 10, 11, 12, 13, 14, 15, 16, 17,
37 0, 1, 2, 3, 4, 5, 6, 7,
38 0, 1, 2, 3, 4, 5, 6, 7,
39 8, 9, 10, 11, 12, 13, 14, 15,
40 8, 9, 10, 11, 12, 13, 14, 15}, scy[128] = {
42 0, 0, 0, 0, 0, 0, 0, 0,
43 1, 1, 1, 1, 1, 1, 1, 1,
44 0, 0, 0, 0, 0, 0, 0, 0,
45 1, 1, 1, 1, 1, 1, 1, 1,
46 0, 0, 2, 2, 2, 2, 4, 4,
47 1, 1, 3, 3, 3, 3, 5, 5,
48 4, 4, 6, 6, 6, 6, 8, 8,
49 5, 5, 7, 7, 7, 7, 9, 9,
50 8, 8, 8, 8, 8, 8, 8, 8,
51 9, 9, 9, 9, 9, 9, 9, 9,
52 8, 8, 8, 8, 8, 8, 8, 8,
53 9, 9, 9, 9, 9, 9, 9, 9,
54 10, 10, 10, 10, 10, 10, 10, 10,
55 11, 11, 11, 11, 11, 11, 11, 11,
56 10, 10, 10, 10, 10, 10, 10, 10,
57 11, 11, 11, 11, 11, 11, 11, 11};
59 // Plot point on the screen
61 void plot(int x, int y, int c)
63 screen[x + y*320] = c;
66 // Decode the color info from three bytes @ xx, yy
68 void decode(int b1, int b2, int b3, int xx, int yy)
70 int cc = ((b1 & 0x80) >> 5) | ((b1 & 0x08) >> 2) | ((b3 & 0x80) >> 7);
72 cc = ((b1 & 0x40) >> 4) | ((b1 & 0x04) >> 1) | ((b3 & 0x40) >> 6);
74 cc = ((b1 & 0x20) >> 3) | (b1 & 0x02) | ((b3 & 0x20) >> 5);
76 cc = ((b1 & 0x10) >> 2) | ((b1 & 0x01) << 1) | ((b3 & 0x10) >> 4);
78 cc = ((b2 & 0x80) >> 5) | ((b2 & 0x08) >> 2) | ((b3 & 0x08) >> 3);
80 cc = ((b2 & 0x40) >> 4) | ((b2 & 0x04) >> 1) | ((b3 & 0x04) >> 2);
82 cc = ((b2 & 0x20) >> 3) | (b2 & 0x02) | ((b3 & 0x02) >> 1);
84 cc = ((b2 & 0x10) >> 2) | ((b2 & 0x01) << 1) | (b3 & 0x01);
90 char pal[768] = {0, 0, 0, 41, 0, 0, 0, 50, 0, 46, 46, 46,
91 0, 63, 63, 24, 24, 24, 31, 31, 0, 31, 31, 31};
94 ifstream ff, ff2; // Creates an IFSTREAM but without any file hooks
96 ff.open(fn1, ios::binary); // Open as a binary file
97 ff2.open(fn2, ios::binary); // ditto
99 ff.ignore(8*8*32*2); ff2.ignore(8*8*32);
101 if (!ff) cerr << "Could not open 'ff'";
102 if (!ff2) cerr << "Could not open 'ff2'";
104 setmode(0x13); // Set up VGA screen
106 setpalette(pal); // Set the pallete
110 for(int in=0; in<128; in++)
112 i = scx[in]; j = scy[in];
114 x = i * 16; y = j * 16;
115 for(int a=0; a<8; a++)
117 ff.get(ch); int b1 = (int)ch;
118 ff.get(ch); int b2 = (int)ch;
119 ff2.get(ch); int b3 = (int)ch;
120 decode(b1, b2, b3, x, y+a);
123 for(int a=0; a<8; a++)
125 ff.get(ch); int b1 = (int)ch;
126 ff.get(ch); int b2 = (int)ch;
127 ff2.get(ch); int b3 = (int)ch;
128 decode(b1, b2, b3, x, y+a);
131 for(int a=0; a<8; a++)
133 ff.get(ch); int b1 = (int)ch;
134 ff.get(ch); int b2 = (int)ch;
135 ff2.get(ch); int b3 = (int)ch;
136 decode(b1, b2, b3, x, y+a);
139 for(int a=0; a<8; a++)
141 ff.get(ch); int b1 = (int)ch;
142 ff.get(ch); int b2 = (int)ch;
143 ff2.get(ch); int b3 = (int)ch;
144 decode(b1, b2, b3, x, y+a);
148 if (i==27) break; // Break out on ESC
150 setmode(0x03); // Reset text mode