Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.07 KB | None | 0 0
  1. public void readNewModel(byte[] is) {
  2. Stream nc1 = new Stream(is);
  3. Stream nc2 = new Stream(is);
  4. Stream nc3 = new Stream(is);
  5. Stream nc4 = new Stream(is);
  6. Stream nc5 = new Stream(is);
  7. Stream nc6 = new Stream(is);
  8. Stream nc7 = new Stream(is);
  9. nc1.currentOffset = is.length - 23;
  10. int numVertices = nc1.readShort();
  11. int numTriangles = nc1.readShort();
  12. int numTexTriangles = nc1.readUnsignedByte();
  13. int i_12_ = nc1.readUnsignedByte();
  14. int i_13_ = nc1.readUnsignedByte();
  15. int i_14_ = nc1.readUnsignedByte();
  16. int i_15_ = nc1.readUnsignedByte();
  17. int i_16_ = nc1.readUnsignedByte();
  18. int i_17_ = nc1.readUnsignedByte();
  19. int i_18_ = nc1.readShort();
  20. int i_19_ = nc1.readShort();
  21. int i_20_ = nc1.readShort();
  22. int i_21_ = nc1.readShort();
  23. int i_22_ = nc1.readShort();
  24. int i_23_ = 0;
  25. int i_24_ = 0;
  26. int i_25_ = 0;
  27. if (numTexTriangles > 0) {
  28. O = new byte[numTexTriangles];
  29. nc1.currentOffset = 0;
  30. for (int i_26_ = 0; i_26_ < numTexTriangles; i_26_++) {
  31. byte i_27_ = O[i_26_] = nc1.readByte();
  32. if (i_27_ == 0)
  33. i_23_++;
  34. if (i_27_ >= 1 && i_27_ <= 3)
  35. i_24_++;
  36. if (i_27_ == 2)
  37. i_25_++;
  38. }
  39. }
  40. int i_28_ = numTexTriangles;
  41. int i_29_ = i_28_;
  42. i_28_ += numVertices;
  43. int i_30_ = i_28_;
  44. if (i_12_ == 1)
  45. i_28_ += numTriangles;
  46. int i_31_ = i_28_;
  47. i_28_ += numTriangles;
  48. int i_32_ = i_28_;
  49. if (i_13_ == 255)
  50. i_28_ += numTriangles;
  51. int i_33_ = i_28_;
  52. if (i_15_ == 1)
  53. i_28_ += numTriangles;
  54. int i_34_ = i_28_;
  55. if (i_17_ == 1)
  56. i_28_ += numVertices;
  57. int i_35_ = i_28_;
  58. if (i_14_ == 1)
  59. i_28_ += numTriangles;
  60. int i_36_ = i_28_;
  61. i_28_ += i_21_;
  62. int i_37_ = i_28_;
  63. if (i_16_ == 1)
  64. i_28_ += numTriangles * 2;
  65. int i_38_ = i_28_;
  66. i_28_ += i_22_;
  67. int i_39_ = i_28_;
  68. i_28_ += numTriangles * 2;
  69. int i_40_ = i_28_;
  70. i_28_ += i_18_;
  71. int i_41_ = i_28_;
  72. i_28_ += i_19_;
  73. int i_42_ = i_28_;
  74. i_28_ += i_20_;
  75. int i_43_ = i_28_;
  76. i_28_ += i_23_ * 6;
  77. int i_44_ = i_28_;
  78. i_28_ += i_24_ * 6;
  79. int i_45_ = i_28_;
  80. i_28_ += i_24_ * 6;
  81. int i_46_ = i_28_;
  82. i_28_ += i_24_;
  83. int i_47_ = i_28_;
  84. i_28_ += i_24_;
  85. int i_48_ = i_28_;
  86. i_28_ += i_24_ + i_25_ * 2;
  87. v = numVertices;
  88. hb = numTriangles;
  89. P = numTexTriangles;
  90. vertexX = new int[numVertices];
  91. vertexY = new int[numVertices];
  92. vertexZ = new int[numVertices];
  93. facePoint1 = new int[numTriangles];
  94. facePoint2 = new int[numTriangles];
  95. facePoint3 = new int[numTriangles];
  96. if (i_17_ == 1)
  97. anIntArray2481 = new int[numVertices];
  98. if (i_12_ == 1)
  99. aByteArray2476 = new byte[numTriangles];
  100. if (i_13_ == 255)
  101. G = new byte[numTriangles];
  102. else
  103. aByte2489 = (byte) i_13_;
  104. if (i_14_ == 1)
  105. aByteArray2479 = new byte[numTriangles];
  106. if (i_15_ == 1)
  107. anIntArray2471 = new int[numTriangles];
  108. if (i_16_ == 1)
  109. D = new short[numTriangles];
  110. if (i_16_ == 1 && numTexTriangles > 0)
  111. x = new byte[numTriangles];
  112. triangleColours2 = new short[numTriangles];
  113. if (numTexTriangles > 0) {
  114. texTrianglesPoint1 = new short[numTexTriangles];
  115. texTrianglesPoint2 = new short[numTexTriangles];
  116. texTrianglesPoint3 = new short[numTexTriangles];
  117. if (i_24_ > 0) {
  118. kb = new short[i_24_];
  119. N = new short[i_24_];
  120. y = new short[i_24_];
  121. gb = new byte[i_24_];
  122. lb = new byte[i_24_];
  123. F = new byte[i_24_];
  124. }
  125. if (i_25_ > 0) {
  126. cb = new byte[i_25_];
  127. J = new byte[i_25_];
  128. }
  129. }
  130. nc1.currentOffset = i_29_;
  131. nc2.currentOffset = i_40_;
  132. nc3.currentOffset = i_41_;
  133. nc4.currentOffset = i_42_;
  134. nc5.currentOffset = i_34_;
  135. int i_49_ = 0;
  136. int i_50_ = 0;
  137. int i_51_ = 0;
  138. for (int i_52_ = 0; i_52_ < numVertices; i_52_++) {
  139. int i_53_ = nc1.readUnsignedByte();
  140. int i_54_ = 0;
  141. if ((i_53_ & 0x1) != 0)
  142. i_54_ = nc2.method960(32767);
  143. int i_55_ = 0;
  144. if ((i_53_ & 0x2) != 0)
  145. i_55_ = nc3.method960(32767);
  146. int i_56_ = 0;
  147. if ((i_53_ & 0x4) != 0)
  148. i_56_ = nc4.method960(32767);
  149. vertexX[i_52_] = i_49_ + i_54_;
  150. vertexY[i_52_] = i_50_ + i_55_;
  151. vertexZ[i_52_] = i_51_ + i_56_;
  152. i_49_ = vertexX[i_52_];
  153. i_50_ = vertexY[i_52_];
  154. i_51_ = vertexZ[i_52_];
  155. if (i_17_ == 1)
  156. anIntArray2481[i_52_] = nc5.readUnsignedByte();
  157. }
  158. nc1.currentOffset = i_39_;
  159. nc2.currentOffset = i_30_;
  160. nc3.currentOffset = i_32_;
  161. nc4.currentOffset = i_35_;
  162. nc5.currentOffset = i_33_;
  163. nc6.currentOffset = i_37_;
  164. nc7.currentOffset = i_38_;
  165. for (int i_57_ = 0; i_57_ < numTriangles; i_57_++) {
  166. triangleColours2[i_57_] = (short) nc1.readShort();
  167. if (i_12_ == 1)
  168. aByteArray2476[i_57_] = nc2.readByte();
  169. if (i_13_ == 255)
  170. G[i_57_] = nc3.readByte();
  171. if (i_14_ == 1)
  172. aByteArray2479[i_57_] = nc4.readByte();
  173. if (i_15_ == 1)
  174. anIntArray2471[i_57_] = nc5.readUnsignedByte();
  175. if (i_16_ == 1)
  176. D[i_57_] = (short) (nc6.readShort() - 1);
  177. if (x != null) {
  178. if (D[i_57_] != -1)
  179. x[i_57_] = (byte) (nc7.readUnsignedByte() - 1);
  180. else
  181. x[i_57_] = (byte) -1;
  182. }
  183. }
  184. nc1.currentOffset = i_36_;
  185. nc2.currentOffset = i_31_;
  186. int i_58_ = 0;
  187. int i_59_ = 0;
  188. int i_60_ = 0;
  189. int i_61_ = 0;
  190. for (int i_62_ = 0; i_62_ < numTriangles; i_62_++) {
  191. int i_63_ = nc2.readUnsignedByte();
  192. if (i_63_ == 1) {
  193. i_58_ = nc1.method960(32767) + i_61_;
  194. i_61_ = i_58_;
  195. i_59_ = nc1.method960(32767) + i_61_;
  196. i_61_ = i_59_;
  197. i_60_ = nc1.method960(32767) + i_61_;
  198. i_61_ = i_60_;
  199. facePoint1[i_62_] = i_58_;
  200. facePoint2[i_62_] = i_59_;
  201. facePoint3[i_62_] = i_60_;
  202. }
  203. if (i_63_ == 2) {
  204. i_59_ = i_60_;
  205. i_60_ = nc1.method960(32767) + i_61_;
  206. i_61_ = i_60_;
  207. facePoint1[i_62_] = i_58_;
  208. facePoint2[i_62_] = i_59_;
  209. facePoint3[i_62_] = i_60_;
  210. }
  211. if (i_63_ == 3) {
  212. i_58_ = i_60_;
  213. i_60_ = nc1.method960(32767) + i_61_;
  214. i_61_ = i_60_;
  215. facePoint1[i_62_] = i_58_;
  216. facePoint2[i_62_] = i_59_;
  217. facePoint3[i_62_] = i_60_;
  218. }
  219. if (i_63_ == 4) {
  220. int i_64_ = i_58_;
  221. i_58_ = i_59_;
  222. i_59_ = i_64_;
  223. i_60_ = nc1.method960(32767) + i_61_;
  224. i_61_ = i_60_;
  225. facePoint1[i_62_] = i_58_;
  226. facePoint2[i_62_] = i_59_;
  227. facePoint3[i_62_] = i_60_;
  228. }
  229. }
  230. nc1.currentOffset = i_43_;
  231. nc2.currentOffset = i_44_;
  232. nc3.currentOffset = i_45_;
  233. nc4.currentOffset = i_46_;
  234. nc5.currentOffset = i_47_;
  235. nc6.currentOffset = i_48_;
  236. for (int i_65_ = 0; i_65_ < numTexTriangles; i_65_++) {
  237. int i_66_ = O[i_65_] & 0xff;
  238. if (i_66_ == 0) {
  239. texTrianglesPoint1[i_65_] = (short) nc1.readShort();
  240. texTrianglesPoint2[i_65_] = (short) nc1.readShort();
  241. texTrianglesPoint3[i_65_] = (short) nc1.readShort();
  242. }
  243. if (i_66_ == 1) {
  244. texTrianglesPoint1[i_65_] = (short) nc2.readShort();
  245. texTrianglesPoint2[i_65_] = (short) nc2.readShort();
  246. texTrianglesPoint3[i_65_] = (short) nc2.readShort();
  247. kb[i_65_] = (short) nc3.readShort();
  248. N[i_65_] = (short) nc3.readShort();
  249. y[i_65_] = (short) nc3.readShort();
  250. gb[i_65_] = nc4.readByte();
  251. lb[i_65_] = nc5.readByte();
  252. F[i_65_] = nc6.readByte();
  253. }
  254. if (i_66_ == 2) {
  255. texTrianglesPoint1[i_65_] = (short) nc2.readShort();
  256. texTrianglesPoint2[i_65_] = (short) nc2.readShort();
  257. texTrianglesPoint3[i_65_] = (short) nc2.readShort();
  258. kb[i_65_] = (short) nc3.readShort();
  259. N[i_65_] = (short) nc3.readShort();
  260. y[i_65_] = (short) nc3.readShort();
  261. gb[i_65_] = nc4.readByte();
  262. lb[i_65_] = nc5.readByte();
  263. F[i_65_] = nc6.readByte();
  264. cb[i_65_] = nc6.readByte();
  265. J[i_65_] = nc6.readByte();
  266. }
  267. if (i_66_ == 3) {
  268. texTrianglesPoint1[i_65_] = (short) nc2.readShort();
  269. texTrianglesPoint2[i_65_] = (short) nc2.readShort();
  270. texTrianglesPoint3[i_65_] = (short) nc2.readShort();
  271. kb[i_65_] = (short) nc3.readShort();
  272. N[i_65_] = (short) nc3.readShort();
  273. y[i_65_] = (short) nc3.readShort();
  274. gb[i_65_] = nc4.readByte();
  275. lb[i_65_] = nc5.readByte();
  276. F[i_65_] = nc6.readByte();
  277. }
  278. }
  279. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement