1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 /*
24  * This code is based on original Soltys source code
25  * Copyright (c) 1994-1995 Janusz B. Wisniewski and L.K. Avalon
26  */
27 
28 #ifndef CGE_BITMAP_H
29 #define CGE_BITMAP_H
30 
31 #include "cge/general.h"
32 #include "common/file.h"
33 
34 namespace CGE {
35 
36 class CGEEngine;
37 class EncryptedStream;
38 
39 #define kMaxPath  128
40 enum {
41 	kBmpEOI = 0x0000,
42 	kBmpSKP = 0x4000,
43 	kBmpREP = 0x8000,
44 	kBmpCPY = 0xC000
45 };
46 
47 #include "common/pack-start.h"
48 
49 struct HideDesc {
50 	uint16 _skip;
51 	uint16 _hide;
52 } PACKED_STRUCT;
53 
54 #include "common/pack-end.h"
55 
56 class Bitmap {
57 	CGEEngine *_vm;
58 	char *forceExt(char *buf, const char *name, const char *ext);
59 	bool loadVBM(EncryptedStream *f);
60 public:
61 	uint16 _w;
62 	uint16 _h;
63 	uint8 *_m;
64 	uint8 *_v;
65 	int32 _map;
66 	HideDesc *_b;
67 
68 	Bitmap(CGEEngine *vm, const char *fname);
69 	Bitmap(CGEEngine *vm, uint16 w, uint16 h, uint8 *map);
70 	Bitmap(CGEEngine *vm, uint16 w, uint16 h, uint8 fill);
71 	Bitmap(CGEEngine *vm, const Bitmap &bmp);
72 	~Bitmap();
73 
74 	Bitmap *code();
75 	Bitmap &operator=(const Bitmap &bmp);
76 	void hide(int16 x, int16 y);
77 	void show(int16 x, int16 y);
78 	void xShow(int16 x, int16 y);
79 	bool solidAt(int16 x, int16 y);
80 };
81 
82 
83 typedef Bitmap *BitmapPtr;
84 
85 } // End of namespace CGE
86 
87 #endif
88