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

Method Tile_Terrain_Get

Source/Fodder.cpp:8173–8203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8171}
8172
8173int16 cFodder::Tile_Terrain_Get(const int16 pTileID, int16 pX, int16 pY) {
8174 // There is two tables, the HIT and the BHIT
8175 // HIT contains the type of terrain used by a tile, a value < 0 indicates
8176 // the tile contains two terrain types.
8177 // This is determined by looking up the terrain type and row
8178 // then checking if a bit is set for the column.
8179 // The bit being set, means we use the upper 4 bits as the terrain type
8180 // Not being set, means we use the lower 4 bits
8181
8182 int16 TerrainType = mTile_Hit[pTileID];
8183
8184 if (TerrainType < 0) {
8185 pX >>= 1;
8186 pX &= 0x07;
8187
8188 int16 TilePixel = 7;
8189 TilePixel -= pX;
8190
8191 // Y
8192 pY >>= 1;
8193 pY &= 0x07;
8194
8195 int8 RowTerrainType = mTile_BHit[pTileID][pY];
8196
8197 // If the bit for this X position is set, we use the UpperBits for the terrain type
8198 if (RowTerrainType & (1 << TilePixel))
8199 TerrainType >>= 4;
8200 }
8201
8202 return (TerrainType & 0x0F);
8203}
8204
8205void cFodder::Squad_Walk_Target_Set(int16 pTargetX, int16 pTargetY, int16 pSquadNumber, int16 pData10) {
8206 int16 Data1C;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected