27#include "saga/actor.h"
33#define SAGA_ISOTILE_WIDTH 32
34#define SAGA_ISOTILE_BASEHEIGHT 15
35#define SAGA_TILE_NOMINAL_H 16
36#define SAGA_MAX_TILE_H 64
38#define SAGA_TILEPLATFORMDATA_LEN 136
39#define SAGA_PLATFORM_W 8
40#define SAGA_MAX_PLATFORM_H 16
42#define SAGA_TILEMAP_LEN 514
43#define SAGA_TILEMAP_W 16
44#define SAGA_TILEMAP_H 16
46#define SAGA_METATILEDATA_LEN 36
48#define SAGA_MULTI_TILE (1 << 15)
50#define SAGA_SCROLL_LIMIT_X1 32
51#define SAGA_SCROLL_LIMIT_X2 64
52#define SAGA_SCROLL_LIMIT_Y1 8
53#define SAGA_SCROLL_LIMIT_Y2 32
55#define SAGA_DRAGON_SEARCH_CENTER 24
56#define SAGA_DRAGON_SEARCH_DIAMETER (SAGA_DRAGON_SEARCH_CENTER * 2)
58#define SAGA_SEARCH_CENTER 15
59#define SAGA_SEARCH_DIAMETER (SAGA_SEARCH_CENTER * 2)
60#define SAGA_SEARCH_QUEUE_SIZE 128
61#define SAGA_IMPASSABLE ((1 << kTerrBlock) | (1 << kTerrWater))
63#define SAGA_STRAIGHT_NORMAL_COST 4
64#define SAGA_DIAG_NORMAL_COST 6
66#define SAGA_STRAIGHT_EASY_COST 2
67#define SAGA_DIAG_EASY_COST 3
69#define SAGA_STRAIGHT_HARD_COST 9
70#define SAGA_DIAG_HARD_COST 10
71#define SAGA_MAX_PATH_DIRECTIONS 256
97 int8 getMaskRule()
const {
98 return attributes & 0x0F;
100 byte getFGDAttr()
const {
101 return FGDBGDAttr >> 4;
103 byte getBGDAttr()
const {
104 return FGDBGDAttr & 0x0F;
106 uint16 getFGDMask()
const {
107 return 1 << getFGDAttr();
109 uint16 getBGDMask()
const {
110 return 1 << getBGDAttr();
120 int16 tiles[SAGA_PLATFORM_W][SAGA_PLATFORM_W];
125 int16 tilePlatforms[SAGA_TILEMAP_W][SAGA_TILEMAP_H];
129 uint16 highestPlatform;
131 int16 stack[SAGA_MAX_PLATFORM_H];
154 void loadImages(
const ByteArray &resourceData);
155 void loadMap(
const ByteArray &resourceData);
156 void loadPlatforms(
const ByteArray &resourceData);
157 void loadMetaTiles(
const ByteArray &resourceData);
158 void loadMulti(
const ByteArray &resourceData);
161 void drawSprite(
SpriteList &spriteList,
int spriteNumber,
const Location &location,
const Point &screenPosition,
int scale);
162 void adjustScroll(
bool jump);
163 void tileCoordsToScreenPoint(
const Location &location,
Point &position) {
164 position.
x = location.u() - location.v() + (128 * SAGA_TILEMAP_W) - _viewScroll.
x + 16;
165 position.
y = -(location.uv() >> 1) + (128 * SAGA_TILEMAP_W) - _viewScroll.
y - location.z;
167 void screenPointToTileCoords(
const Point &position,
Location &location);
168 void placeOnTileMap(
const Location &start,
Location &result, int16 distance, uint16 direction);
170 bool findNearestChasm(int16 &u0, int16 &v0, uint16 &direction);
173 void setTileDoorState(
int doorNumber,
int doorState);
174 Point getMapPosition() {
return _mapPosition; }
175 void setMapPosition(
int x,
int y);
176 int16 getTileIndex(int16 u, int16 v, int16 z);
179 void drawTiles(
const Location *location);
180 void drawMetaTile(uint16 metaTileIndex,
const Point &point, int16 absU, int16 absV);
181 void drawSpriteMetaTile(uint16 metaTileIndex,
const Point &point,
Location &location, int16 absU, int16 absV);
182 void drawPlatform(uint16 platformIndex,
const Point &point, int16 absU, int16 absV, int16 absH);
183 void drawSpritePlatform(uint16 platformIndex,
const Point &point,
const Location &location, int16 absU, int16 absV, int16 absH);
184 void drawTile(uint16 tileIndex,
const Point &point,
const Location *location);
185 int16 smoothSlide(int16 value, int16 min, int16 max) {
187 if (value < min - 100 || value > min - 4) {
194 if (value > max + 100 || value < max + 4) {
203 int16 findMulti(int16 tileIndex, int16 absU, int16 absV, int16 absH);
204 void pushPoint(int16 u, int16 v, uint16 cost, uint16 direction);
205 void pushDragonPoint(int16 u, int16 v, uint16 direction);
206 bool checkDragonPoint(int16 u, int16 v, uint16 direction);
207 void testPossibleDirections(int16 u, int16 v, uint16 terraComp[8],
int skipCenter);
225 uint16 _platformHeight;
227 struct DragonPathCell {
228 uint8 visited:1,direction:3;
230 struct DragonTilePoint {
235 uint16 visited:1,direction:3,cost:12;
241 uint16 direction:4,cost:12;
245 struct DragonSearchArray {
246 DragonPathCell cell[SAGA_DRAGON_SEARCH_DIAMETER][SAGA_DRAGON_SEARCH_DIAMETER];
247 DragonTilePoint queue[SAGA_SEARCH_QUEUE_SIZE];
248 DragonTilePoint *getQueue(uint16 i) {
249 assert(i < SAGA_SEARCH_QUEUE_SIZE);
252 DragonPathCell *getPathCell(uint16 u, uint16 v) {
253 assert((u < SAGA_DRAGON_SEARCH_DIAMETER) && (v < SAGA_DRAGON_SEARCH_DIAMETER));
258 PathCell cell[SAGA_SEARCH_DIAMETER][SAGA_SEARCH_DIAMETER];
259 TilePoint queue[SAGA_SEARCH_QUEUE_SIZE];
260 TilePoint *getQueue(uint16 i) {
261 assert(i < SAGA_SEARCH_QUEUE_SIZE);
264 PathCell *getPathCell(uint16 u, uint16 v) {
265 assert((u < SAGA_SEARCH_DIAMETER) && (v < SAGA_SEARCH_DIAMETER));
272 SearchArray _searchArray;
273 DragonSearchArray _dragonSearchArray;
274 byte _pathDirections[SAGA_MAX_PATH_DIRECTIONS];
Definition: display_client.h:58