aboutsummaryrefslogtreecommitdiff
path: root/saga/isomap.h
blob: 31275237b458bb83e62dbcebeb15ef0f61f7b8e8 (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
95
96
97
98
99
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2004 The ScummVM project
 *
 * The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
 *
 * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header$
 *
 */

// Isometric level module - private header

#ifndef SAGA_ISOMAP_H_
#define SAGA_ISOMAP_H_

namespace Saga {

struct ISOTILE_ENTRY {
	int tile_h;
	int mask_rule;
	size_t tile_offset;
	int terrain_mask;
	int mask;
};

#define SAGA_ISOTILE_ENTRY_LEN 8
#define SAGA_ISOTILE_WIDTH 32
#define SAGA_ISOTILE_BASEHEIGHT 15

#define SAGA_METATILE_W 8
#define SAGA_METATILE_H 8
#define SAGA_METATILE_SIZE 64

#define SAGA_METAMAP_W 16
#define SAGA_METAMAP_H 16
#define SAGA_METAMAP_SIZE 256

struct ISO_METATILE_ENTRY {
	int mtile_n;
	int height;
	int highest_pixel;
	byte v_bits;
	byte u_bits;
	int tile_tbl[SAGA_METATILE_SIZE];
};

#define SAGA_METATILE_ENTRY_LEN 136

class Gfx;

class IsoMap {
public:
	IsoMap(Gfx *gfx);
	int loadTileset(const byte *, size_t);
	int loadMetaTileset(const byte *, size_t);
	int loadMetamap(const byte *mm_res_p, size_t mm_res_len);
	int draw(SURFACE *dst_s);
private:
	int drawTile(SURFACE *dst_s, uint16 tile_i, int tile_x, int tile_y);
	int drawMetaTile(SURFACE *dst_s, uint16 mtile_i, int mtile_x, int mtile_y);
	int drawMetamap(SURFACE *dst_s, int map_x, int map_y);
	int _init;
	int _tiles_loaded;
	const byte *_tileres_p;
	size_t _tileres_len;
	uint16 _tile_ct;
	ISOTILE_ENTRY *_tile_tbl;

	int _mtiles_loaded;
	const byte *_mtileres_p;
	size_t _mtileres_len;
	uint16 _mtile_ct;
	ISO_METATILE_ENTRY *_mtile_tbl;

	int _metamap_loaded;
	int _metamap_n;
	uint16 _metamap_tbl[SAGA_METAMAP_SIZE];
	const byte *_mm_res_p;
	size_t _mm_res_len;

	Gfx *_gfx;
};

} // End of namespace Saga

#endif