Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1.  
  2. int addedObj = 0;
  3.  
  4. int objID = -1;//-1;
  5.  
  6. do
  7. {
  8. int objOffset = 0;//object ids are not stored, just the difference from the last one
  9. if (addedObj == 0)
  10. objOffset = objectId[addedObj] + 1;
  11. else if (addedObj == totalObjects)
  12. {//reach the end
  13. objOffset = 0;
  14. }
  15. else
  16. {
  17. objOffset = (objectId[addedObj] - objectId[addedObj - 1]);
  18. }
  19. data.writeSmart((byte)37, objOffset);
  20. if (objOffset == 0)//stops writting
  21. break;
  22.  
  23. int j1 = 0;
  24.  
  25. objID += objOffset;
  26.  
  27. do
  28. {
  29. int height1 = height[addedObj];
  30. int localY1 = objectY[addedObj];
  31. int localX1 = objectX[addedObj];
  32.  
  33. int type1 = type[addedObj];
  34. int face1 = face[addedObj];
  35.  
  36. int y = 0;
  37. int x = 0;
  38. int k1 = 0;
  39. int type_face = 0;
  40.  
  41. int tempj1 = 0;
  42. tempj1 += localY1;
  43. tempj1 += localX1 << 6;
  44. tempj1 += height1 << 12;
  45.  
  46. k1 = (tempj1 - j1) + 1;
  47. j1 = tempj1;
  48.  
  49. data.writeSmart((byte)37, k1);
  50.  
  51. type_face = (type1 << 2) + face1;
  52. data.writeByte(type_face);
  53.  
  54. if (objectId[addedObj + 1] > objectId[addedObj] || addedObj + 1 == totalObjects)
  55. {
  56. addedObj++;
  57. data.writeSmart((byte)37, 0);
  58. break;
  59. }
  60. else
  61. {
  62. addedObj++;
  63. }
  64.  
  65. } while (true);
  66.  
  67. } while (true);
  68.  
  69. data.writeFile("F:/"+mapId+".dat", data.GetBytesFromList());
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement