| 7940 | } |
| 7941 | |
| 7942 | int16 cFodder::Map_PathCheck_CanPass(int16& pTileHit) { |
| 7943 | |
| 7944 | int32 Data4 = mCheckPattern_Position.mY; |
| 7945 | |
| 7946 | uint8* MapTilePtr = mMap->data() + 0x60; |
| 7947 | uint16 TileID = 0; |
| 7948 | |
| 7949 | Data4 *= mMapLoaded->getWidth(); |
| 7950 | Data4 += mCheckPattern_Position.mX; |
| 7951 | |
| 7952 | MapTilePtr += (Data4 << 1); |
| 7953 | |
| 7954 | for (size_t x = 0; x < mMap_PathToDest.size(); ++x) { |
| 7955 | int16 Movement = mMap_PathToDest[x]; |
| 7956 | |
| 7957 | if (Movement == 0 || (x + 1) >= mMap_PathToDest.size()) |
| 7958 | goto loc_2A728; |
| 7959 | |
| 7960 | if(mMap_PathToDest[x+1] == 0) |
| 7961 | goto loc_2A728; |
| 7962 | |
| 7963 | MapTilePtr += Movement; |
| 7964 | Movement = mMap_PathToDest[++x]; |
| 7965 | |
| 7966 | loc_2A728:; |
| 7967 | MapTilePtr += Movement; |
| 7968 | |
| 7969 | //loc_2A6A1 |
| 7970 | if (MapTilePtr > mMap->data() && MapTilePtr < mMap->data() + mMap->size()) { |
| 7971 | TileID = readLE<uint16>(MapTilePtr); |
| 7972 | } else |
| 7973 | TileID = 0; |
| 7974 | |
| 7975 | pTileHit = mTile_Hit[TileID & 0x1FF]; |
| 7976 | |
| 7977 | // Tile has hit? |
| 7978 | if (pTileHit >= 0) { |
| 7979 | pTileHit &= 0x0F; |
| 7980 | |
| 7981 | // Check if tile is passable |
| 7982 | if (mTiles_NotWalkable[pTileHit]) { |
| 7983 | pTileHit = -1; |
| 7984 | return -1; |
| 7985 | } |
| 7986 | } |
| 7987 | } |
| 7988 | |
| 7989 | pTileHit = 0; |
| 7990 | return 0; |
| 7991 | } |
| 7992 | |
| 7993 | /** |
| 7994 | * Calculate the distance between two points on the map |