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

Method Map_Destroy_Tiles

Source/Fodder.cpp:9369–9475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9367}
9368
9369void cFodder::Map_Destroy_Tiles() {
9370 uint8* MapPtr = 0;
9371 const int16* IndestructibleTypes = 0;
9372 int32 Data0, Data4, MapTile, TileType;
9373 sMapPosition LastTile;
9374
9375 if (mMap_Destroy_Tiles_Countdown) {
9376 --mMap_Destroy_Tiles_Countdown;
9377 goto loc_2DFC7;
9378 }
9379
9380
9381 for (auto& Tile : mMap_Destroy_Tiles) {
9382 bool TriggerExplosion = false;
9383
9384 LastTile = Tile;
9385
9386 Data0 = Tile.mX;
9387 Data4 = Tile.mY;
9388
9389 mMap_Destroy_Tile_X = Tile.mX;
9390 mMap_Destroy_Tile_Y = Tile.mY;
9391
9392 if (mMap_Destroy_Tile_Y < 0) {
9393 TriggerExplosion = true;
9394 Data4 = -Data4;
9395 mMap_Destroy_Tile_Y = -Tile.mY;
9396 }
9397 //loc_2DE89
9398 Data4 >>= 4;
9399 Data4 *= mMapLoaded->getWidth();
9400
9401 Data0 >>= 4;
9402 Data4 += Data0;
9403 Data4 <<= 1;
9404
9405 // In some cases, tiles outside the map can be 'destroyed'. This continue prevents memory corruption
9406 if ((size_t)(0x60 + Data4) >= mMap->size())
9407 continue;
9408
9409 MapPtr = mMap->data() + 0x60 + Data4;
9410 MapTile = readLE<uint16>(MapPtr);
9411 MapTile &= 0x1FF;
9412 TileType = MapTile;
9413
9414 Data4 = mTile_Destroy_Swap[MapTile];
9415 if (Data4 < 0)
9416 continue;
9417
9418 if (TriggerExplosion)
9419 goto loc_2DF7B;
9420
9421 IndestructibleTypes = mTiles_Indestructible[mMapLoaded->getTileType()];
9422
9423 int16 ax;
9424 do {
9425 if (*IndestructibleTypes < 0)
9426 goto loc_2DF7B;

Callers

nothing calls this directly

Calls 6

writeLEWordFunction · 0.85
getTileTypeMethod · 0.80
getWidthMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected