22#ifndef ULTIMA2_DATA_MAP_DUNGEON_H
23#define ULTIMA2_DATA_MAP_DUNGEON_H
25#include "common/scummsys.h"
26#include "common/serializer.h"
32constexpr int DUNGEON_WIDTH = 16;
33constexpr int DUNGEON_HEIGHT = 16;
34constexpr int DUNGEON_LEVELS = 16;
38 DUNGEON_LADDER_UP = 0x10,
39 DUNGEON_LADDER_DOWN = 0x20,
40 DUNGEON_LADDER_UP_DOWN = 0x30,
44 DUNGEON_SECRET_DOOR = 0xE0
55 byte _cells[DUNGEON_LEVELS][DUNGEON_HEIGHT][DUNGEON_WIDTH] = {};
57 void load(
int mapEra,
int mapType);
60 s.
syncBytes(&_cells[0][0][0],
sizeof(_cells));
69 byte &
cell(
int level,
int x,
int y) {
72 for (
int i = 0; i < 4; ++i) {
74 row = (byte)(row << 1);
77 int index = (row + (byte)x + carry) & 0xFF;
78 return _cells[level & 0xF][index / DUNGEON_WIDTH][index % DUNGEON_WIDTH];
81 DungeonTerrain terrainAt(
int level,
int x,
int y)
const {
82 return (DungeonTerrain)(_cells[level][y][x] & 0xF0);
84 bool hasMonsterAt(
int level,
int x,
int y)
const {
85 return (_cells[level][y][x] & 7) != 0;
Definition: serializer.h:80
void syncBytes(byte *buf, uint32 size, Version minVersion=0, Version maxVersion=kLastVersion)
Definition: serializer.h:205
Definition: map_dungeon.h:54
byte & cell(int level, int x, int y)
Definition: map_dungeon.h:69