22#ifndef ULTIMA1_DATA_MAP_H
23#define ULTIMA1_DATA_MAP_H
25#include "common/array.h"
26#include "common/rect.h"
27#include "common/serializer.h"
28#include "graphics/managed_surface.h"
29#include "ultima/ultima1/data/tiles.h"
35constexpr int OVERWORLD_WIDTH = 168;
36constexpr int OVERWORLD_HEIGHT = 156;
37constexpr int OVERWORLD_SIZE = OVERWORLD_WIDTH * OVERWORLD_HEIGHT;
38constexpr int OVERWORLD_VISIBLE_WIDTH = 19;
39constexpr int OVERWORLD_VISIBLE_HEIGHT = 9;
40constexpr int OVERWORLD_VISIBLE_CENTER_X = 9;
41constexpr int OVERWORLD_VISIBLE_CENTER_Y = 4;
43constexpr int CITY_WIDTH = 38;
44constexpr int CITY_HEIGHT = 18;
45constexpr int CITY_SIZE = CITY_WIDTH * CITY_HEIGHT;
47constexpr int MONDAIN_WIDTH = 19;
48constexpr int MONDAIN_HEIGHT = 9;
51constexpr int MONDAIN_GEM_X = 14;
52constexpr int MONDAIN_GEM_Y = 4;
54constexpr int LOCATION_COUNT = 84;
63 DIR_LEFT = 1, DIR_RIGHT = 2, DIR_UP = 3, DIR_DOWN = 4, DIR_UNSPECIFIED = -1
67 MAPTYPE_OVERWORLD = 0,
77extern const char *DIRECTION_NAMES[5];
78extern const char *SPACE_DIRECTION_NAMES[5];
79extern const char *LOCATION_NAMES[LOCATION_COUNT];
80extern const char *CONTINENT_NAMES[4];
86 byte _mondainMap[MONDAIN_HEIGHT][MONDAIN_WIDTH] = {};
89 int _mapWidth = 0, _mapHeight = 0;
90 byte _outsideMapTile = 0xff;
97 Map *_owner =
nullptr;
98 byte *_data =
nullptr;
102 Row(
Map *owner,
byte *data) : _owner(owner), _data(data) {}
110 if (!_data || (_owner->_outsideMapTile != 0xff && (x < 0 || x >= _owner->_mapWidth)))
111 return _owner->_outsideMapTile;
115 return _data[_owner->_mapWidth + x];
116 return _data[x % _owner->_mapWidth];
131 void loadDungeonMap();
134 byte _tilePlayerCenter = 0;
135 byte _tilePlayerUp = 0, _tilePlayerDown = 0,
136 _tilePlayerLeft = 0, _tilePlayerRight = 0;
137 int _woodsCount = 0, _grassCount = 0, _waterCount = 0;
138 bool _isLordBritishCastle =
false;
140 int _mapType = MAPTYPE_OVERWORLD;
142 int _castleNum = 0, _castleNum2 = 0;
205 return _spaceShipTiles;
212 return _enemyFighterTiles;
219 if (_outsideMapTile != 0xff && (y < 0 || y >= _mapHeight))
221 return _mapRows[_mapHeight];
225 return _mapRows[_mapHeight + y];
226 return _mapRows[y % _mapHeight];
240 int getTileAt(
int x,
int y,
int creatureIndex = 1)
const;
254 int wrapOverworldY(
int y)
const;
Definition: serializer.h:80
Definition: managed_surface.h:51
const Graphics::ManagedSurface * tiles() const
Definition: map.h:193
bool mapRangeCheckX(int xp) const
int getMapTile(int x, int y) const
int getOverworldTileAt(int x, int y) const
bool mapRangeCheckY(int yp) const
int width() const
Definition: map.h:179
int getContinentAt(int x, int y) const
const Graphics::ManagedSurface * spaceShipTiles() const
Definition: map.h:204
void countSurroundingTiles()
const Row & operator[](int y) const
Definition: map.h:218
int getTileAt(int x, int y, int creatureIndex=1) const
int getLocationAt(int x, int y) const
void synchronize(Common::Serializer &s)
const Graphics::ManagedSurface * enemyFighterTiles() const
Definition: map.h:211
int height() const
Definition: map.h:186
int wrapOverworldX(int x) const