Advertisement
Guest User

Untitled

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