Ejemplo n.º 1
0
 // 0x20: Ammo
 // [XX XX] [YY YY] [ZZ ZZ] [TT TT]
 private void decodeAmmoBoxes(byte[] data)
 {
     uint start = BE.U32(data, 0x20);
      uint end = BE.U32(data, 0x24);
      for (uint idx = start; idx < end; idx += 8)
      {
     Int16 x, y, z;
     UInt16 t;
     x = BE.I16(data, idx);
     y = BE.I16(data, idx + 2);
     z = BE.I16(data, idx + 4);
     t = BE.U16(data, idx + 6);
     AmmoBox ammo = new AmmoBox(x, y, z, t);
     ammoBoxes.Add(ammo);
      }
 }
Ejemplo n.º 2
0
 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;
     }
      }
 }