// 0x38: TNT crates
 // [XX XX] [YY YY] [ZZ ZZ] [TE] [TY] [H8 H8] [HA HA]
 private void decodeTNTCrates(byte[] data)
 {
     uint start = BE.U32(data, 0x38);
      uint end = BE.U32(data, 0x3C);
      for (uint idx = start; idx < end; idx += 12)
      {
     Int16 x, y, z, h8;
     UInt16 power;
     x = BE.I16(data, idx);
     y = BE.I16(data, idx + 2);
     z = BE.I16(data, idx + 4);
     h8 = BE.I16(data, idx + 8);
     power = BE.U16(data, idx + 0xA);
     TNTCrate tnt = new TNTCrate(x, y, z, data[idx + 6], data[idx + 7], h8, power);
     tntCrates.Add(tnt);
      }
 }
 private void BlastCorpsViewer_MouseUp(object sender, MouseEventArgs e)
 {
     if (level != null && e.Button == System.Windows.Forms.MouseButtons.Left)
      {
     switch (Mode)
     {
        case MouseMode.Move:
           if (dragItem != null)
           {
              selectedItem = dragItem;
              OnSelectionChangedEvent(new SelectionChangedEventArgs(selectedItem, false, false));
              dragItem = null;
              Invalidate();
           }
           break;
        case MouseMode.Add:
           Int16 x = (Int16)levelX(e.X);
           Int16 z = (Int16)levelZ(e.Y);
           if (AddType == typeof(AmmoBox))
           {
              AmmoBox box = new AmmoBox(x, level.carrier.y, z, 0);
              selectedItem = box;
              level.ammoBoxes.Add(box);
           }
           else if (AddType == typeof(CommPoint))
           {
              CommPoint comm = new CommPoint(x, level.carrier.y, z, 0);
              selectedItem = comm;
              level.commPoints.Add(comm);
           }
           else if (AddType == typeof(RDU))
           {
              RDU rdu = new RDU(x, level.carrier.y, z);
              selectedItem = rdu;
              level.rdus.Add(rdu);
           }
           else if (AddType == typeof(TNTCrate))
           {
              TNTCrate tnt = new TNTCrate(x, level.carrier.y, z, 0, 0, 0, 0);
              selectedItem = tnt;
              level.tntCrates.Add(tnt);
           }
           else if (AddType == typeof(SquareBlock))
           {
              SquareBlock block = new SquareBlock(x, level.carrier.y, z, SquareBlock.Type.Block, SquareBlock.Shape.Square);
              selectedItem = block;
              level.squareBlocks.Add(block);
           }
           else if (AddType == typeof(Vehicle))
           {
              Vehicle vehicle = new Vehicle(0, x, level.carrier.y, z, 0);
              selectedItem = vehicle;
              level.vehicles.Add(vehicle);
           }
           else if (AddType == typeof(Building))
           {
              Building building = new Building(x, level.carrier.y, z, 0, 0, 0, 0, 0);
              selectedItem = building;
              level.buildings.Add(building);
           }
           OnSelectionChangedEvent(new SelectionChangedEventArgs(selectedItem, true, false));
           Invalidate();
           break;
     }
      }
 }