aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/map-loader.h
blob: d2266818b39713ce9d8f6c460ef4c75db7f7b340 (plain)
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
/* 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 HDB_MAP_LOADER_H
#define HDB_MAP_LOADER_H

#include "common/system.h"

namespace HDB {

enum {
	kScreenXTiles = 17,
	kScreenYTiles = 16
};

struct MSMIcon {
	uint16	icon;					// index into icon list
	uint16	x;
	uint16	y;

	char	funcInit[32];		// Lua init function for this entity
	char	funcAction[32];
	char	funcUse[32];
	uint16	dir;					// direction entity is facing
	uint16	level;					// which floor level entity is on
	uint16	value1, value2;
};

struct SeeThroughTile {
	uint16 x;
	uint16 y;
	uint16 tile;
};

class Map {
public:
	Map();

	int loadTiles();
	bool load(Common::SeekableReadStream *stream);
	void draw();
	uint16 getMapBGTileIndex(int x, int y);
	uint16 getMapFGTileIndex(int x, int y);
	void getMapXY(int *x, int *y);
	void setMapXY(int x, int y);
	void centerMapXY(int x, int y);

	int _mapX, _mapY; // Coordinates of Map
	int _mapTileX, _mapTileY; // Tile Coordinates of Map
	int _mapTileXOff, _mapTileYOff; // Tile Coordinates Offset (0-31)

private:
	char _name[32];
	uint16 _width;
	uint16 _height;
	uint32 _backgroundOffset;
	uint32 _foregroundOffset;
	uint16 _iconNum;
	uint32 _iconListOffset;
	uint16 _infoNum;
	uint32 _infoListOffset;

	uint16 *_background;
	uint16 *_foreground;
	MSMIcon *_iconList;

	byte *_mapExplosions;
	byte *_mapExpBarrels;
	byte *_mapLaserBeams;

	bool _mapLoaded;
};
}

#endif // !HDB_MAP_LOADER_H