-
Notifications
You must be signed in to change notification settings - Fork 1
/
graphics.h
146 lines (128 loc) · 8.58 KB
/
graphics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef DUNE_GRAPHICS_H
#define DUNE_GRAPHICS_H
#include "common/endian.h"
namespace Common {
class ReadStream;
}
namespace Dune {
class DuneEngine;
class Graphics {
DuneEngine *_engine;
byte *_framebuffer;
int _global_y_offset;
bool _pal1_slot_active[256];
byte _pal1[256][3] = { { 0 } };
byte _pal2[256][3] = {
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2A }, { 0x00, 0x2A, 0x00 }, { 0x00, 0x2A, 0x2A },
{ 0x2A, 0x00, 0x00 }, { 0x3F, 0x34, 0x14 }, { 0x2A, 0x15, 0x00 }, { 0x2A, 0x2A, 0x2A },
{ 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3F }, { 0x15, 0x3F, 0x15 }, { 0x15, 0x3F, 0x3F },
{ 0x3F, 0x15, 0x15 }, { 0x3F, 0x15, 0x3F }, { 0x3F, 0x3F, 0x15 }, { 0x3F, 0x3F, 0x3F },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x3E, 0x39, 0x1B }, { 0x3F, 0x3F, 0x26 }, { 0x3F, 0x3D, 0x15 }, { 0x3F, 0x36, 0x1B },
{ 0x3F, 0x2D, 0x00 }, { 0x36, 0x24, 0x0A }, { 0x36, 0x18, 0x0A }, { 0x2D, 0x10, 0x00 },
{ 0x24, 0x12, 0x00 }, { 0x1B, 0x12, 0x0F }, { 0x1B, 0x0E, 0x08 }, { 0x12, 0x00, 0x0F },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x30, 0x3F, 0x34 }, { 0x28, 0x36, 0x2E }, { 0x21, 0x2D, 0x28 }, { 0x1A, 0x24, 0x21 },
{ 0x13, 0x1B, 0x1A }, { 0x0D, 0x13, 0x13 }, { 0x08, 0x04, 0x08 }, { 0x10, 0x04, 0x18 },
{ 0x08, 0x00, 0x10 }, { 0x04, 0x00, 0x0C }, { 0x0A, 0x00, 0x02 }, { 0x14, 0x1C, 0x1A },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x14, 0x18, 0x1C }, { 0x01, 0x01, 0x02 },
{ 0x04, 0x04, 0x05 }, { 0x07, 0x06, 0x09 }, { 0x09, 0x09, 0x0C }, { 0x0C, 0x0B, 0x0F },
{ 0x0F, 0x0E, 0x12 }, { 0x11, 0x11, 0x16 }, { 0x14, 0x13, 0x19 }, { 0x17, 0x16, 0x1C },
{ 0x1E, 0x1A, 0x21 }, { 0x27, 0x1D, 0x27 }, { 0x2D, 0x20, 0x29 }, { 0x33, 0x23, 0x28 },
{ 0x39, 0x28, 0x26 }, { 0x3F, 0x33, 0x29 }, { 0x3F, 0x3F, 0x29 }, { 0x00, 0x00, 0x3F },
{ 0x02, 0x00, 0x3B }, { 0x05, 0x00, 0x37 }, { 0x08, 0x00, 0x34 }, { 0x0A, 0x00, 0x30 },
{ 0x0C, 0x00, 0x2C }, { 0x0E, 0x00, 0x29 }, { 0x0E, 0x00, 0x25 }, { 0x0F, 0x00, 0x21 },
{ 0x0F, 0x00, 0x1E }, { 0x0F, 0x00, 0x1A }, { 0x0E, 0x00, 0x16 }, { 0x0D, 0x00, 0x13 },
{ 0x0B, 0x00, 0x0F }, { 0x09, 0x00, 0x0B }, { 0x07, 0x00, 0x08 }, { 0x3B, 0x30, 0x28 },
{ 0x3B, 0x31, 0x28 }, { 0x3B, 0x31, 0x29 }, { 0x3C, 0x32, 0x2A }, { 0x3C, 0x33, 0x2B },
{ 0x3C, 0x33, 0x2C }, { 0x3C, 0x34, 0x2C }, { 0x3D, 0x34, 0x2E }, { 0x3D, 0x35, 0x2E },
{ 0x3D, 0x36, 0x2F }, { 0x08, 0x10, 0x0A }, { 0x3F, 0x3F, 0x3F }, { 0x2E, 0x3D, 0x32 },
{ 0x22, 0x30, 0x28 }, { 0x1F, 0x2A, 0x26 }, { 0x26, 0x34, 0x2C }, { 0x08, 0x0A, 0x10 },
{ 0x0B, 0x0B, 0x10 }, { 0x0C, 0x0B, 0x10 }, { 0x0D, 0x0B, 0x10 }, { 0x0F, 0x0B, 0x10 },
{ 0x10, 0x0B, 0x10 }, { 0x10, 0x0B, 0x0F }, { 0x10, 0x0B, 0x0D }, { 0x10, 0x0B, 0x0C },
{ 0x10, 0x0B, 0x0B }, { 0x32, 0x32, 0x32 }, { 0x2F, 0x2A, 0x37 }, { 0x1E, 0x16, 0x3E },
{ 0x1C, 0x0B, 0x3F }, { 0x0F, 0x10, 0x0B }, { 0x3D, 0x34, 0x2E }, { 0x0C, 0x10, 0x0B },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x3F, 0x3F, 0x3F }
};
byte _pal3[16][3] = {
{ 0x12, 0x12, 0x12 }, { 0x15, 0x15, 0x15 }, { 0x18, 0x18, 0x18 }, { 0x1B, 0x1B, 0x1B },
{ 0x1E, 0x1E, 0x1E }, { 0x21, 0x21, 0x21 }, { 0x24, 0x24, 0x24 }, { 0x27, 0x27, 0x27 },
{ 0x2A, 0x2A, 0x2A }, { 0x2D, 0x2D, 0x2D }, { 0x30, 0x30, 0x30 }, { 0x33, 0x33, 0x33 },
{ 0x36, 0x36, 0x36 }, { 0x39, 0x39, 0x39 }, { 0x3C, 0x3C, 0x3C }, { 0x3F, 0x3F, 0x3F },
};
public:
Graphics(DuneEngine *_engine);
/* 00 */ void setMode();
/* 01 */ void getInfo(byte **screen, int *size);
void setFrameBuffer(byte *framebuffer) {
_framebuffer = framebuffer;
}
void drawCursor(int x, int y, const byte *cursorData);
void setGlobalYOffset(int y_offset);
byte *getPixelPtr(int x, int y);
void draw_4bpp (bool flip_x, bool flip_y, Common::ReadStream *r, int x_offset, int y_offset, int w, int h, byte mode);
void draw_4bpp_rle(bool flip_x, bool flip_y, Common::ReadStream *r, int x_offset, int y_offset, int w, int h, byte mode);
void draw_8bpp (bool flip_x, bool flip_y, Common::ReadStream *r, int x_offset, int y_offset, int w, int h, byte mode);
void draw_8bpp_rle(bool flip_x, bool flip_y, Common::ReadStream *r, int x_offset, int y_offset, int w, int h, byte mode);
void blitGraphics(Common::ReadStream *r, int x_offset, int y_offset, int w, int h, byte flags, byte mode);
void blitGraphics(byte *buf, int buf_len, int x_offset, int y_offset, int w, int h, byte flags, byte mode);
void copyScaled(byte *src, uint16 src_pitch, int x_offset, int y_offset, int dst_w, int dst_h, byte flags, byte pal_offset, uint16 src_delta_fp);
void drawNoise(uint16 x, uint16 y, uint16 count, uint16 start_value, uint16 increment, uint16 xor_state, uint16 xor_increment);
};
} // End of namespace Dune
#endif