aboutsummaryrefslogtreecommitdiff
path: root/saga/isomap.cpp
diff options
context:
space:
mode:
authorAndrew Kurushin2005-07-01 17:29:23 +0000
committerAndrew Kurushin2005-07-01 17:29:23 +0000
commit13b1802a453f838cf2b8c35678b9a78fd4277534 (patch)
tree69fe73feb7d2aa72fc1ace4050cd74349dfe47f4 /saga/isomap.cpp
parenta08ecca1c024cea0a113af97045cf5cf0e83a093 (diff)
downloadscummvm-rg350-13b1802a453f838cf2b8c35678b9a78fd4277534.tar.gz
scummvm-rg350-13b1802a453f838cf2b8c35678b9a78fd4277534.tar.bz2
scummvm-rg350-13b1802a453f838cf2b8c35678b9a78fd4277534.zip
implemented sfPickClimbOutPos, sfTossRif
Komodo dragon now works svn-id: r18480
Diffstat (limited to 'saga/isomap.cpp')
-rw-r--r--saga/isomap.cpp81
1 files changed, 77 insertions, 4 deletions
diff --git a/saga/isomap.cpp b/saga/isomap.cpp
index dba57939b3..ab543981cb 100644
--- a/saga/isomap.cpp
+++ b/saga/isomap.cpp
@@ -997,14 +997,13 @@ void IsoMap::pushPoint(int16 u, int16 v, uint16 cost, uint16 direction) {
pathCell->cost = cost;
}
-IsoTileData *IsoMap::getTile(int16 u, int16 v, int16 z) {
+int16 IsoMap::getTileIndex(int16 u, int16 v, int16 z) {
int16 mtileU;
int16 mtileV;
int16 uc;
int16 vc;
int16 u0;
int16 v0;
- int16 tileIndex;
int16 platformIndex;
int16 metaTileIndex;
@@ -1044,14 +1043,20 @@ IsoTileData *IsoMap::getTile(int16 u, int16 v, int16 z) {
platformIndex = _metaTileList[metaTileIndex].stack[z];
if (platformIndex < 0) {
- return NULL;
+ return 0;
}
if (_tilePlatformsCount <= platformIndex) {
error("IsoMap::getTile wrong platformIndex");
}
- tileIndex = _tilePlatformList[platformIndex].tiles[u0][v0];
+ return _tilePlatformList[platformIndex].tiles[u0][v0];
+}
+
+IsoTileData *IsoMap::getTile(int16 u, int16 v, int16 z) {
+ int16 tileIndex;
+
+ tileIndex = getTileIndex(u, v, z);
if (tileIndex == 0) {
return NULL;
@@ -1255,6 +1260,74 @@ void IsoMap::placeOnTileMap(const Location &start, Location &result, int16 dista
result.v() = ((vBase + bestV) << 4) + 8;
}
+bool IsoMap::findNearestChasm(int16 &u0, int16 &v0, uint16 &direction) {
+ int16 u, v;
+ uint16 i;
+ u = u0;
+ v = v0;
+
+ for (i = 1; i < 5; i++) {
+ if (getTile( u - i, v, 6) == NULL) {
+ u0 = u - i - 1;
+ v0 = v;
+ direction = kDirDownLeft;
+ return true;
+ }
+
+ if (getTile( u, v - i, 6) == NULL) {
+ u0 = u;
+ v0 = v - i - 1;
+ direction = kDirDownRight;
+ return true;
+ }
+
+ if (getTile( u - i, v - i, 6) == NULL) {
+ u0 = u - i - 1;
+ v0 = v - i - 1;
+ direction = kDirDown;
+ return true;
+ }
+
+ if (getTile( u + i, v - i, 6) == NULL) {
+ u0 = u + i + 1;
+ v0 = v - i - 1;
+ direction = kDirDownRight;
+ return true;
+ }
+
+ if (getTile( u - i, v + i, 6) == NULL) {
+ u0 = u + i + 1;
+ v0 = v - i - 1;
+ direction = kDirLeft;
+ return true;
+ }
+ }
+
+ for (i = 1; i < 5; i++) {
+ if (getTile( u + i, v, 6) == NULL) {
+ u0 = u + i + 1;
+ v0 = v;
+ direction = kDirUpRight;
+ return true;
+ }
+
+ if (getTile( u, v + i, 6) == NULL) {
+ u0 = u;
+ v0 = v + i + 1;
+ direction = kDirUpLeft;
+ return true;
+ }
+
+ if (getTile( u + i, v + i, 6) == NULL) {
+ u0 = u + i + 1;
+ v0 = v + i + 1;
+ direction = kDirUp;
+ return true;
+ }
+ }
+ return false;
+}
+
void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Location &end, uint16 initialDirection) {
byte *res;
int i;