22#ifndef ULTIMA4_MAP_TILE_H
23#define ULTIMA4_MAP_TILE_H
25#include "ultima/ultima4/map/direction.h"
26#include "ultima/ultima4/core/types.h"
27#include "ultima/ultima4/map/tileset.h"
38#define MASK_SHIP 0x0001
39#define MASK_HORSE 0x0002
40#define MASK_BALLOON 0x0004
41#define MASK_DISPEL 0x0008
42#define MASK_TALKOVER 0x0010
43#define MASK_DOOR 0x0020
44#define MASK_LOCKEDDOOR 0x0040
45#define MASK_CHEST 0x0080
46#define MASK_ATTACKOVER 0x0100
47#define MASK_CANLANDBALLOON 0x0200
48#define MASK_REPLACEMENT 0x0400
49#define MASK_WATER_REPLACEMENT 0x0800
50#define MASK_FOREGROUND 0x1000
51#define MASK_LIVING_THING 0x2000
55#define MASK_SWIMABLE 0x0001
56#define MASK_SAILABLE 0x0002
57#define MASK_UNFLYABLE 0x0004
58#define MASK_CREATURE_UNWALKABLE 0x0008
74 TileId getId()
const {
80 int getWidth()
const {
83 int getHeight()
const {
86 int getFrames()
const {
89 int getScale()
const {
92 TileAnim *getAnim()
const {
100 bool isTiledInDungeon()
const {
101 return _tiledInDungeon;
103 bool isLandForeground()
const {
106 bool isWaterForeground()
const {
107 return _waterForeground;
110 int canWalkOn(Direction d)
const {
111 return DIR_IN_MASK(d, rule->_walkOnDirs);
113 int canWalkOff(Direction d)
const {
114 return DIR_IN_MASK(d, rule->_walkOffDirs);
122 return isWalkable() || isSwimable() || isSailable() || (rule->_mask & MASK_ATTACKOVER);
124 int canLandBalloon()
const {
125 return rule->_mask & MASK_CANLANDBALLOON;
127 int isLivingObject()
const {
128 return rule->_mask & MASK_LIVING_THING;
130 int isReplacement()
const {
131 return rule->_mask & MASK_REPLACEMENT;
133 int isWaterReplacement()
const {
134 return rule->_mask & MASK_WATER_REPLACEMENT;
137 int isWalkable()
const {
138 return rule->_walkOnDirs > 0;
140 bool isCreatureWalkable()
const {
141 return canWalkOn(DIR_ADVANCE) && !(rule->_movementMask & MASK_CREATURE_UNWALKABLE);
143 bool isDungeonWalkable()
const;
144 bool isDungeonFloor()
const;
145 int isSwimable()
const {
146 return rule->_movementMask & MASK_SWIMABLE;
148 int isSailable()
const {
149 return rule->_movementMask & MASK_SAILABLE;
151 bool isWater()
const {
152 return (isSwimable() || isSailable());
154 int isFlyable()
const {
155 return !(rule->_movementMask & MASK_UNFLYABLE);
158 return rule->_mask & MASK_DOOR;
160 int isLockedDoor()
const {
161 return rule->_mask & MASK_LOCKEDDOOR;
163 int isChest()
const {
164 return rule->_mask & MASK_CHEST;
167 return rule->_mask & MASK_SHIP;
169 bool isPirateShip()
const {
170 return _name ==
"pirate_ship";
172 int isHorse()
const {
173 return rule->_mask & MASK_HORSE;
175 int isBalloon()
const {
176 return rule->_mask & MASK_BALLOON;
178 int canDispel()
const {
179 return rule->_mask & MASK_DISPEL;
181 int canTalkOver()
const {
182 return rule->_mask & MASK_TALKOVER;
184 TileSpeed getSpeed()
const {
187 TileEffect getEffect()
const {
188 return rule->_effect;
191 bool isOpaque()
const;
198 Direction directionForFrame(
int frame)
const;
199 int frameForDirection(Direction d)
const;
201 static void resetNextId() {
204 static bool canTalkOverTile(
const Tile *tile) {
205 return tile->canTalkOver() != 0;
207 static bool canAttackOverTile(
const Tile *tile) {
208 return tile->canAttackOver() != 0;
229 bool _waterForeground;
236 bool _tiledInDungeon;
242 static TileId _nextId;
bool isForeground() const
void loadProperties(const ConfigElement &conf)
int canAttackOver() const
Definition: tile.h:121