MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / Map_Terrain_Get

Method Map_Terrain_Get

Source/Fodder.cpp:8124–8153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8122}
8123
8124int16 cFodder::Map_Terrain_Get(int16& pY, int16& pX, int16& pData10, int16& pData14) {
8125
8126 if ((pY >> 4) > mMapLoaded->getHeight() || (pX >> 4) > mMapLoaded->getWidth())
8127 return 0;
8128
8129 int32 MapPtr = (pY >> 4) * mMapLoaded->getWidth();
8130 MapPtr += (pX >> 4);
8131 MapPtr <<= 1;
8132
8133 if (mMap->data() + (0x60 + MapPtr) >= mMap->data() + mMap->size())
8134 return 0;
8135
8136 uint16 TileID = readLE<uint16>(mMap->data() + (0x60 + MapPtr)) & 0x1FF;
8137
8138 // There is two tables, the HIT and the BHIT
8139 // HIT contains the type of terrain used by a tile, a value < 0 indicates
8140 // the tile contains two terrain types.
8141 // This is determined by looking up the terrain type and row
8142 // then checking if a bit is set for the column.
8143 // The bit being set, means we use the upper 4 bits as the terrain type
8144 // Not being set, means we use the lower 4 bits
8145
8146 // eTerrainFeature
8147 int16 TerrainType = Tile_Terrain_Get(TileID, pData10, pData14);
8148
8149 pY = mTiles_NotWalkable[TerrainType];
8150 pX = TerrainType;
8151
8152 return mTiles_NotWalkable[TerrainType];
8153}
8154
8155int16 cFodder::Map_Terrain_Get(int16 pX, int16 pY) {
8156

Callers 2

CheckRadiusFeaturesMethod · 0.80
PassableMethod · 0.80

Calls 3

getHeightMethod · 0.45
getWidthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected