Advertisement
Guest User

Untitled

a guest
Jun 27th, 2011
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.95 KB | None | 0 0
  1.             if ((m.connectionType & (1 << 3)) != 0)
  2.             {
  3.                 Connection c = m.connectionUp;
  4.                 gb.WriteByte(c.bank);
  5.                 gb.WriteByte(c.number);
  6.                 Map otherMap = Program.form1.getMap(c.bank, c.number);
  7.                 if (otherMap == null)
  8.                 {
  9.                     gb.BufferLocation += 10;
  10.                 }
  11.                 else
  12.                 {
  13.                     int p = otherMap.tileDataLocation;
  14.                     int h = otherMap.width - m.width;
  15.                     if (h > 0)
  16.                         p += (h * otherMap.height) + (otherMap.height * 3) + (otherMap.height + 3);
  17.                     else
  18.                         p += (otherMap.height * otherMap.width) - (otherMap.width * 3);
  19.  
  20.                     c.tileDataPointer = gb.Get2BytePointer(p);
  21.                     gb.WriteBytes(new byte[] { (byte)(c.tileDataPointer[0]), c.tileDataPointer[1] });
  22.                     gb.WriteBytes(c.memoryOtherPointer);
  23.                     gb.WriteBytes(new byte[] { c.height, c.width });
  24.                     gb.WriteByte(c.yOffset);
  25.                     gb.WriteByte(c.xOffset);
  26.                     gb.WriteBytes(c.memoryCurrentPointer);
  27.                 }
  28.             }
  29.             if ((m.connectionType & (1 << 2)) != 0)
  30.             {
  31.                 Connection c = m.connectionDown;
  32.                 gb.WriteByte(c.bank);
  33.                 gb.WriteByte(c.number);
  34.                 Map otherMap = Program.form1.getMap(c.bank, c.number);
  35.                 if (otherMap == null)
  36.                 {
  37.                     gb.BufferLocation += 10;
  38.                 }
  39.                 else
  40.                 {
  41.                     c.tileDataPointer = gb.Get2BytePointer(otherMap.tileDataLocation);
  42.                     gb.WriteBytes(c.tileDataPointer);
  43.                     gb.WriteBytes(c.memoryOtherPointer);
  44.                     gb.WriteBytes(new byte[] { c.height, c.width });
  45.                     gb.WriteByte(c.yOffset);
  46.                     gb.WriteByte(c.xOffset);
  47.                     gb.WriteBytes(c.memoryCurrentPointer);
  48.                 }
  49.             }
  50.             if ((m.connectionType & (1 << 1)) != 0)
  51.             {
  52.                 Connection c = m.connectionLeft;
  53.                 gb.WriteByte(c.bank);
  54.                 gb.WriteByte(c.number);
  55.                 Map otherMap = Program.form1.getMap(c.bank, c.number);
  56.                 if (otherMap == null)
  57.                 {
  58.                     gb.BufferLocation += 10;
  59.                 }
  60.                 else
  61.                 {
  62.                     int p = otherMap.tileDataLocation;
  63.                     int h = otherMap.height - m.height;
  64.                     if (h > 0)
  65.                         p += (h * otherMap.width) - (otherMap.width * 3) + (otherMap.width - 3);
  66.                     else
  67.                         p += otherMap.width - 3;
  68.  
  69.                     c.tileDataPointer = gb.Get2BytePointer(p);
  70.                     gb.WriteBytes(new byte[] { (byte)(c.tileDataPointer[0]), c.tileDataPointer[1] });
  71.                     gb.WriteBytes(c.memoryOtherPointer);
  72.                     gb.WriteBytes(new byte[] { c.height, c.width });
  73.                     gb.WriteByte(c.yOffset);
  74.                     gb.WriteByte(c.xOffset);
  75.                     gb.WriteBytes(c.memoryCurrentPointer);
  76.                 }
  77.             }
  78.             if ((m.connectionType & 1) != 0)
  79.             {
  80.                 Connection c = m.connectionRight;
  81.                 gb.WriteByte(c.bank);
  82.                 gb.WriteByte(c.number);
  83.                 Map otherMap = Program.form1.getMap(c.bank, c.number);
  84.                 if (otherMap == null)
  85.                 {
  86.                     gb.BufferLocation += 10;
  87.                 }
  88.                 else
  89.                 {
  90.                     c.tileDataPointer = gb.Get2BytePointer(otherMap.tileDataLocation);
  91.                     gb.WriteBytes(c.tileDataPointer);
  92.                     gb.WriteBytes(c.memoryOtherPointer);
  93.                     gb.WriteBytes(new byte[] { c.height, c.width });
  94.                     gb.WriteByte(c.yOffset);
  95.                     gb.WriteByte(c.xOffset);
  96.                     gb.WriteBytes(c.memoryCurrentPointer);
  97.                 }
  98.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement