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 #ifndef SKY_GRID_H
24 #define SKY_GRID_H
25 
26 
27 #include "common/scummsys.h"
28 #include "skydefs.h"
29 
30 namespace Sky {
31 
32 struct Compact;
33 class Disk;
34 class SkyCompact;
35 
36 class Grid {
37 public:
38 	Grid(Disk *pDisk, SkyCompact *skyCompact);
39 	~Grid();
40 
41 	// grid.asm routines
42 	void loadGrids();
43 	void removeObjectFromWalk(Compact *cpt);
44 	void objectToWalk(Compact *cpt);
45 
46 	// function.asm
47 	// note that this routine does the same as objectToWalk, it just doesn't get
48 	// its x, y, width parameters from cpt.
49 	void plotGrid(uint32 x, uint32 y, uint32 width, Compact *cpt);
50 	// same here, it's basically the same as removeObjectFromWalk
51 	void removeGrid(uint32 x, uint32 y, uint32 width, Compact *cpt);
52 	uint8 *giveGrid(uint32 pScreen);
53 
54 private:
55 	void objectToWalk(uint8 gridIdx, uint32 bitNum, uint32 width);
56 	void removeObjectFromWalk(uint8 gridIdx, uint32 bitNum, uint32 width);
57 	bool getGridValues(Compact *cpt, uint8 *resGrid, uint32 *resBitNum, uint32 *resWidth);
58 	bool getGridValues(uint32 x, uint32 y, uint32 width, Compact *cpt, uint8 *resGrid, uint32 *resBitNum, uint32 *resWidth);
59 
60 	static int8 _gridConvertTable[];
61 	uint8 *_gameGrids[TOT_NO_GRIDS];
62 	Disk *_skyDisk;
63 	SkyCompact *_skyCompact;
64 };
65 
66 } // End of namespace Sky
67 
68 #endif //SKYGRID_H
69