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 Sfinx source code
25  * Copyright (c) 1994-1997 Janus B. Wisniewski and L.K. Avalon
26  */
27 
28 #ifndef CGE2_BITMAP_H
29 #define CGE2_BITMAP_H
30 
31 #include "cge2/general.h"
32 #include "common/file.h"
33 
34 namespace CGE2 {
35 
36 class CGE2Engine;
37 class EncryptedStream;
38 class V2D;
39 
40 #define kMaxPath      128
41 
42 enum {
43 	kBmpEOI = 0x0000,
44 	kBmpSKP = 0x4000,
45 	kBmpREP = 0x8000,
46 	kBmpCPY = 0xC000
47 };
48 
49 #include "common/pack-start.h"
50 
51 struct HideDesc {
52 	uint16 _skip;
53 	uint16 _hide;
54 };
55 
56 #include "common/pack-end.h"
57 
58 class Bitmap {
59 	CGE2Engine *_vm;
60 
61 	Common::String setExtension(const Common::String &str, const Common::String &ext);
62 	bool loadVBM(EncryptedStream *f);
63 public:
64 	uint16 _w;
65 	uint16 _h;
66 	uint8 *_v;
67 	int32 _map;
68 	HideDesc *_b;
69 
70 	Bitmap();
71 	Bitmap(CGE2Engine *vm, const char *fname);
72 	Bitmap(CGE2Engine *vm, uint16 w, uint16 h, uint8 *map);
73 	Bitmap(CGE2Engine *vm, uint16 w, uint16 h, uint8 fill);
74 	Bitmap(CGE2Engine *vm, const Bitmap &bmp);
75 	~Bitmap();
76 
77 	void setVM(CGE2Engine *vm);
78 	Bitmap *code(uint8 *map);
79 	Bitmap &operator=(const Bitmap &bmp);
80 	void release();
81 	void hide(V2D pos);
82 	void show(V2D pos);
83 	bool solidAt(V2D pos);
84 	void xLatPos(V2D &p);
85 
86 	static uint8 *makeSpeechBubbleTail(int des, uint8 colorSet[][4]);
87 };
88 
89 
90 typedef Bitmap *BitmapPtr;
91 
92 } // End of namespace CGE2
93 
94 #endif // CGE2_BITMAP_H
95