Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 94.43 KB | None | 0 0
  1. package com;
  2.  
  3. public class Model extends Renderable {
  4.  
  5. public static void nullLoader() {
  6. header = null;
  7. aBooleanArray1663 = null;
  8. scale_textures = null;
  9. vertex_viewpoint_y = null;
  10. anIntArray1667 = null;
  11. texture_viewpoint_x = null;
  12. texture_viewpoint_y = null;
  13. texture_viewpoint_z = null;
  14. anIntArray1671 = null;
  15. anIntArrayArray1672 = null;
  16. anIntArray1673 = null;
  17. anIntArrayArray1674 = null;
  18. anIntArray1675 = null;
  19. anIntArray1676 = null;
  20. anIntArray1677 = null;
  21. SINE = null;
  22. COSINE = null;
  23. modelIntArray3 = null;
  24. modelIntArray4 = null;
  25. }
  26.  
  27.  
  28. public void decode_old(byte[] data, int modelId) {
  29. boolean has_face_type = false;
  30. boolean has_texture_type = false;
  31. Buffer stream = new Buffer(data);
  32. Buffer stream1 = new Buffer(data);
  33. Buffer stream2 = new Buffer(data);
  34. Buffer stream3 = new Buffer(data);
  35. Buffer stream4 = new Buffer(data);
  36. stream.currentPosition = data.length - 18;
  37. vertices = stream.readUShort();
  38. faces = stream.readUShort();
  39. texture_faces = stream.readUnsignedByte();
  40. int type_opcode = stream.readUnsignedByte();
  41. int priority_opcode = stream.readUnsignedByte();
  42. int alpha_opcode = stream.readUnsignedByte();
  43. int tSkin_opcode = stream.readUnsignedByte();
  44. int vSkin_opcode = stream.readUnsignedByte();
  45. int i_254_ = stream.readUShort();
  46. int i_255_ = stream.readUShort();
  47. int i_256_ = stream.readUShort();
  48. int i_257_ = stream.readUShort();
  49. int i_258_ = 0;
  50.  
  51. int i_259_ = i_258_;
  52. i_258_ += vertices;
  53.  
  54. int i_260_ = i_258_;
  55. i_258_ += faces;
  56.  
  57. int i_261_ = i_258_;
  58. if (priority_opcode == 255)
  59. i_258_ += faces;
  60.  
  61. int i_262_ = i_258_;
  62. if (tSkin_opcode == 1)
  63. i_258_ += faces;
  64.  
  65. int i_263_ = i_258_;
  66. if (type_opcode == 1)
  67. i_258_ += faces;
  68.  
  69. int i_264_ = i_258_;
  70. if (vSkin_opcode == 1)
  71. i_258_ += vertices;
  72.  
  73. int i_265_ = i_258_;
  74. if (alpha_opcode == 1)
  75. i_258_ += faces;
  76.  
  77. int i_266_ = i_258_;
  78. i_258_ += i_257_;
  79.  
  80. int i_267_ = i_258_;
  81. i_258_ += faces * 2;
  82.  
  83. int i_268_ = i_258_;
  84. i_258_ += texture_faces * 6;
  85.  
  86. int i_269_ = i_258_;
  87. i_258_ += i_254_;
  88.  
  89. int i_270_ = i_258_;
  90. i_258_ += i_255_;
  91.  
  92. int i_271_ = i_258_;
  93. i_258_ += i_256_;
  94.  
  95. particle_vertices = new int[vertices];
  96. vertexX = new int[vertices];
  97. vertexY = new int[vertices];
  98. vertexZ = new int[vertices];
  99. edge_a = new int[faces];
  100. edge_b = new int[faces];
  101. edge_c = new int[faces];
  102. if (texture_faces > 0) {
  103. texture_type = new byte[texture_faces];
  104. texture_edge_a = new short[texture_faces];
  105. texture_edge_b = new short[texture_faces];
  106. texture_edge_c = new short[texture_faces];
  107. }
  108.  
  109. if (vSkin_opcode == 1)
  110. vSkin = new int[vertices];
  111.  
  112. if (type_opcode == 1) {
  113. render_type = new int[faces];
  114. texture_coordinates = new byte[faces];
  115. texture = new short[faces];
  116. }
  117.  
  118. if (priority_opcode == 255)
  119. render_priorities = new byte[faces];
  120. else
  121. priority = (byte) priority_opcode;
  122.  
  123. if (alpha_opcode == 1)
  124. alpha = new int[faces];
  125.  
  126. if (tSkin_opcode == 1)
  127. tSkin = new int[faces];
  128.  
  129. color = new short[faces];
  130. stream.currentPosition = i_259_;
  131. stream1.currentPosition = i_269_;
  132. stream2.currentPosition = i_270_;
  133. stream3.currentPosition = i_271_;
  134. stream4.currentPosition = i_264_;
  135. int start_x = 0;
  136. int start_y = 0;
  137. int start_z = 0;
  138. for (int point = 0; point < vertices; point++) {
  139. int flag = stream.readUnsignedByte();
  140. int x = 0;
  141. if ((flag & 0x1) != 0)
  142. x = stream1.readSmart();
  143. int y = 0;
  144. if ((flag & 0x2) != 0)
  145. y = stream2.readSmart();
  146. int z = 0;
  147. if ((flag & 0x4) != 0)
  148. z = stream3.readSmart();
  149.  
  150. vertexX[point] = start_x + x;
  151. vertexY[point] = start_y + y;
  152. vertexZ[point] = start_z + z;
  153. start_x = vertexX[point];
  154. start_y = vertexY[point];
  155. start_z = vertexZ[point];
  156. if (vSkin_opcode == 1)
  157. vSkin[point] = stream4.readUnsignedByte();
  158.  
  159. }
  160. stream.currentPosition = i_267_;
  161. stream1.currentPosition = i_263_;
  162. stream2.currentPosition = i_261_;
  163. stream3.currentPosition = i_265_;
  164. stream4.currentPosition = i_262_;
  165. for (int face = 0; face < faces; face++) {
  166. color[face] = (short) stream.readUShort();
  167. if (type_opcode == 1) {
  168. int flag = stream1.readUnsignedByte();
  169. if ((flag & 0x1) == 1) {
  170. render_type[face] = 1;
  171. has_face_type = true;
  172. } else {
  173. render_type[face] = 0;
  174. }
  175.  
  176. if ((flag & 0x2) != 0) {
  177. texture_coordinates[face] = (byte) (flag >> 2);
  178. texture[face] = color[face];
  179. color[face] = 127;
  180. if (texture[face] != -1)
  181. has_texture_type = true;
  182.  
  183.  
  184. } else {
  185. texture_coordinates[face] = -1;
  186. texture[face] = -1;
  187. }
  188. }
  189. if (priority_opcode == 255)
  190. render_priorities[face] = stream2.readSignedByte();
  191.  
  192. if (alpha_opcode == 1) {
  193. alpha[face] = stream3.readSignedByte();
  194. if (alpha[face] < 0)
  195. alpha[face] = (256 + alpha[face]);
  196.  
  197. }
  198. if (tSkin_opcode == 1)
  199. tSkin[face] = stream4.readUnsignedByte();
  200.  
  201. }
  202. stream.currentPosition = i_266_;
  203. stream1.currentPosition = i_260_;
  204. int coordinate_a = 0;
  205. int coordinate_b = 0;
  206. int coordinate_c = 0;
  207. int offset = 0;
  208. int coordinate;
  209. for (int face = 0; face < faces; face++) {
  210. int opcode = stream1.readUnsignedByte();
  211. if (opcode == 1) {
  212. coordinate_a = (stream.readSmart() + offset);
  213. offset = coordinate_a;
  214. coordinate_b = (stream.readSmart() + offset);
  215. offset = coordinate_b;
  216. coordinate_c = (stream.readSmart() + offset);
  217. offset = coordinate_c;
  218. edge_a[face] = coordinate_a;
  219. edge_b[face] = coordinate_b;
  220. edge_c[face] = coordinate_c;
  221. }
  222. if (opcode == 2) {
  223. coordinate_b = coordinate_c;
  224. coordinate_c = (stream.readSmart() + offset);
  225. offset = coordinate_c;
  226. edge_a[face] = coordinate_a;
  227. edge_b[face] = coordinate_b;
  228. edge_c[face] = coordinate_c;
  229. }
  230. if (opcode == 3) {
  231. coordinate_a = coordinate_c;
  232. coordinate_c = (stream.readSmart() + offset);
  233. offset = coordinate_c;
  234. edge_a[face] = coordinate_a;
  235. edge_b[face] = coordinate_b;
  236. edge_c[face] = coordinate_c;
  237. }
  238. if (opcode == 4) {
  239. coordinate = coordinate_a;
  240. coordinate_a = coordinate_b;
  241. coordinate_b = coordinate;
  242. coordinate_c = (stream.readSmart() + offset);
  243. offset = coordinate_c;
  244. edge_a[face] = coordinate_a;
  245. edge_b[face] = coordinate_b;
  246. edge_c[face] = coordinate_c;
  247. }
  248. }
  249. stream.currentPosition = i_268_;
  250. for (int face = 0; face < texture_faces; face++) {
  251. texture_type[face] = 0;
  252. texture_edge_a[face] = (short) stream.readUShort();
  253. texture_edge_b[face] = (short) stream.readUShort();
  254. texture_edge_c[face] = (short) stream.readUShort();
  255. }
  256. if (texture_coordinates != null) {
  257. boolean textured = false;
  258. for (int face = 0; face < faces; face++) {
  259. coordinate = texture_coordinates[face] & 0xff;
  260. if (coordinate != 255) {
  261. if (((texture_edge_a[coordinate] & 0xffff) == edge_a[face]) && ((texture_edge_b[coordinate] & 0xffff) == edge_b[face]) && ((texture_edge_c[coordinate] & 0xffff) == edge_c[face])) {
  262. texture_coordinates[face] = -1;
  263. } else {
  264. textured = true;
  265. }
  266. }
  267. }
  268. if (!textured)
  269. texture_coordinates = null;
  270. }
  271. if (!has_texture_type)
  272. texture = null;
  273.  
  274. if (!has_face_type)
  275. render_type = null;
  276.  
  277. }
  278.  
  279. public void decode_new(byte data[], int modelId) {
  280. Buffer vertex_data_1 = new Buffer(data);
  281. Buffer vertex_data_2 = new Buffer(data);
  282. Buffer vertex_data_3 = new Buffer(data);
  283. Buffer vertex_data_4 = new Buffer(data);
  284. Buffer skin_data = new Buffer(data);
  285. Buffer texture_data = new Buffer(data);
  286. Buffer texture_coordinate_data = new Buffer(data);
  287.  
  288. vertex_data_1.currentPosition = data.length - 23;
  289.  
  290. vertices = vertex_data_1.readUShort();
  291. faces = vertex_data_1.readUShort();
  292. texture_faces = vertex_data_1.readUnsignedByte();
  293.  
  294. ModelHeader def = header[modelId] = new ModelHeader();
  295. def.aByteArray368 = data;
  296. def.anInt369 = vertices;
  297. def.anInt370 = faces;
  298. def.anInt371 = texture_faces;
  299.  
  300. int model_render_type = vertex_data_1.readUnsignedByte();
  301. int model_priority = vertex_data_1.readUnsignedByte();
  302. int model_alpha = vertex_data_1.readUnsignedByte();
  303. int model_muscle = vertex_data_1.readUnsignedByte();
  304. int model_texture = vertex_data_1.readUnsignedByte();
  305. int model_bones = vertex_data_1.readUnsignedByte();
  306. int model_vertex_x = vertex_data_1.readUShort();
  307. int model_vertex_y = vertex_data_1.readUShort();
  308. int model_vertex_z = vertex_data_1.readUShort();
  309. int model_vertex_points = vertex_data_1.readUShort();
  310.  
  311. int model_texture_coordinates = vertex_data_1.readUShort();
  312. int texture_id = 0;
  313. int texture_triangles = 0;
  314. int texture_unknown = 0;
  315. int face;
  316. if (texture_faces > 0) {
  317. texture_type = new byte[texture_faces];
  318. vertex_data_1.currentPosition = 0;
  319. for (face = 0; face < texture_faces; face++) {
  320. byte opcode = texture_type[face] = vertex_data_1.readSignedByte();
  321. if (opcode == 0) {
  322. texture_id++;
  323. }
  324. if (opcode >= 1 && opcode <= 3) {
  325. texture_triangles++;
  326. }
  327. if (opcode == 2) {
  328. texture_unknown++;
  329. }
  330. }
  331. }
  332. int pos = texture_faces;
  333.  
  334. int model_vertex_offset = pos;
  335. pos += vertices;
  336.  
  337. int model_render_type_offset = pos;
  338. if (model_render_type == 1)
  339. pos += faces;
  340.  
  341. int model_face_offset = pos;
  342. pos += faces;
  343.  
  344. int model_face_priorities_offset = pos;
  345. if (model_priority == 255)
  346. pos += faces;
  347.  
  348. int model_muscle_offset = pos;
  349. if (model_muscle == 1)
  350. pos += faces;
  351.  
  352. int model_bones_offset = pos;
  353. if (model_bones == 1)
  354. pos += vertices;
  355.  
  356. int model_alpha_offset = pos;
  357. if (model_alpha == 1)
  358. pos += faces;
  359.  
  360. int model_points_offset = pos;
  361. pos += model_vertex_points;
  362.  
  363. int model_texture_id = pos;
  364. if (model_texture == 1)
  365. pos += faces * 2;
  366.  
  367. int model_texture_coordinate_offset = pos;
  368. pos += model_texture_coordinates;
  369.  
  370. int model_color_offset = pos;
  371. pos += faces * 2;
  372.  
  373. int model_vertex_x_offset = pos;
  374. pos += model_vertex_x;
  375.  
  376. int model_vertex_y_offset = pos;
  377. pos += model_vertex_y;
  378.  
  379. int model_vertex_z_offset = pos;
  380. pos += model_vertex_z;
  381.  
  382. int model_texture_offset = pos;
  383. pos += texture_id * 6;
  384.  
  385. int model_texture_unknown_1 = pos;
  386. pos += texture_triangles * 6;
  387.  
  388. int model_texture_unknown_2 = pos;
  389. pos += texture_triangles * 6;
  390.  
  391. int model_texture_unknown_3 = pos;
  392. pos += texture_triangles * 2;
  393.  
  394. int model_texture_unknown_4 = pos;
  395. pos += texture_triangles;
  396.  
  397. int model_texture_unknown_5 = pos;
  398. pos += texture_triangles * 2 + texture_unknown * 2;
  399.  
  400. particle_vertices = new int[vertices];
  401. vertexX = new int[vertices];
  402. vertexY = new int[vertices];
  403. vertexZ = new int[vertices];
  404. edge_a = new int[faces];
  405. edge_b = new int[faces];
  406. edge_c = new int[faces];
  407. if (model_bones == 1)
  408. vSkin = new int[vertices];
  409.  
  410. if (model_render_type == 1)
  411. render_type = new int[faces];
  412.  
  413. if (model_priority == 255)
  414. render_priorities = new byte[faces];
  415. else
  416. priority = (byte) model_priority;
  417.  
  418. if (model_alpha == 1)
  419. alpha = new int[faces];
  420.  
  421. if (model_muscle == 1)
  422. tSkin = new int[faces];
  423.  
  424. if (model_texture == 1)
  425. texture = new short[faces];
  426.  
  427. if (model_texture == 1 && texture_faces > 0)
  428. texture_coordinates = new byte[faces];
  429.  
  430. color = new short[faces];
  431. if (texture_faces > 0) {
  432. texture_edge_a = new short[texture_faces];
  433. texture_edge_b = new short[texture_faces];
  434. texture_edge_c = new short[texture_faces];
  435. }
  436. vertex_data_1.currentPosition = model_vertex_offset;
  437. vertex_data_2.currentPosition = model_vertex_x_offset;
  438. vertex_data_3.currentPosition = model_vertex_y_offset;
  439. vertex_data_4.currentPosition = model_vertex_z_offset;
  440. skin_data.currentPosition = model_bones_offset;
  441. int start_x = 0;
  442. int start_y = 0;
  443. int start_z = 0;
  444. for (int point = 0; point < vertices; point++) {
  445. int position_mask = vertex_data_1.readUnsignedByte();
  446. int x = 0;
  447. if ((position_mask & 1) != 0) {
  448. x = vertex_data_2.readSmart();
  449. }
  450. int y = 0;
  451. if ((position_mask & 2) != 0) {
  452. y = vertex_data_3.readSmart();
  453. }
  454. int z = 0;
  455. if ((position_mask & 4) != 0) {
  456. z = vertex_data_4.readSmart();
  457. }
  458. vertexX[point] = start_x + x;
  459. vertexY[point] = start_y + y;
  460. vertexZ[point] = start_z + z;
  461. start_x = vertexX[point];
  462. start_y = vertexY[point];
  463. start_z = vertexZ[point];
  464. if (vSkin != null)
  465. vSkin[point] = skin_data.readUnsignedByte();
  466.  
  467. }
  468. vertex_data_1.currentPosition = model_color_offset;
  469. vertex_data_2.currentPosition = model_render_type_offset;
  470. vertex_data_3.currentPosition = model_face_priorities_offset;
  471. vertex_data_4.currentPosition = model_alpha_offset;
  472. skin_data.currentPosition = model_muscle_offset;
  473. texture_data.currentPosition = model_texture_id;
  474. texture_coordinate_data.currentPosition = model_texture_coordinate_offset;
  475. for (face = 0; face < faces; face++) {
  476. color[face] = (short) vertex_data_1.readUShort();
  477. if (model_render_type == 1) {
  478. render_type[face] = vertex_data_2.readSignedByte();
  479. }
  480. if (model_priority == 255) {
  481. render_priorities[face] = vertex_data_3.readSignedByte();
  482. }
  483. if (model_alpha == 1) {
  484. alpha[face] = vertex_data_4.readSignedByte();
  485. if (alpha[face] < 0)
  486. alpha[face] = (256 + alpha[face]);
  487.  
  488. }
  489. if (model_muscle == 1)
  490. tSkin[face] = skin_data.readUnsignedByte();
  491.  
  492. if (model_texture == 1) {
  493. texture[face] = (short) (texture_data.readUShort() - 1);
  494. if(texture[face] >= 0) {
  495. if(render_type != null) {
  496. if(render_type[face] < 2
  497. && color[face] != 127
  498. && color[face] != -27075
  499. && color[face] != 8128
  500. && color[face] != 7510) {
  501. texture[face] = -1;
  502. }
  503. }
  504. }
  505. if(texture[face] != -1)
  506. color[face] = 127;
  507. }
  508. if (texture_coordinates != null && texture[face] != -1) {
  509. texture_coordinates[face] = (byte) (texture_coordinate_data.readUnsignedByte() - 1);
  510. }
  511. }
  512. vertex_data_1.currentPosition = model_points_offset;
  513. vertex_data_2.currentPosition = model_face_offset;
  514. int coordinate_a = 0;
  515. int coordinate_b = 0;
  516. int coordinate_c = 0;
  517. int last_coordinate = 0;
  518. for (face = 0; face < faces; face++) {
  519. int opcode = vertex_data_2.readUnsignedByte();
  520. if (opcode == 1) {
  521. coordinate_a = vertex_data_1.readSmart() + last_coordinate;
  522. last_coordinate = coordinate_a;
  523. coordinate_b = vertex_data_1.readSmart() + last_coordinate;
  524. last_coordinate = coordinate_b;
  525. coordinate_c = vertex_data_1.readSmart() + last_coordinate;
  526. last_coordinate = coordinate_c;
  527. edge_a[face] = coordinate_a;
  528. edge_b[face] = coordinate_b;
  529. edge_c[face] = coordinate_c;
  530. }
  531. if (opcode == 2) {
  532. coordinate_b = coordinate_c;
  533. coordinate_c = vertex_data_1.readSmart() + last_coordinate;
  534. last_coordinate = coordinate_c;
  535. edge_a[face] = coordinate_a;
  536. edge_b[face] = coordinate_b;
  537. edge_c[face] = coordinate_c;
  538. }
  539. if (opcode == 3) {
  540. coordinate_a = coordinate_c;
  541. coordinate_c = vertex_data_1.readSmart() + last_coordinate;
  542. last_coordinate = coordinate_c;
  543. edge_a[face] = coordinate_a;
  544. edge_b[face] = coordinate_b;
  545. edge_c[face] = coordinate_c;
  546. }
  547. if (opcode == 4) {
  548. int l14 = coordinate_a;
  549. coordinate_a = coordinate_b;
  550. coordinate_b = l14;
  551. coordinate_c = vertex_data_1.readSmart() + last_coordinate;
  552. last_coordinate = coordinate_c;
  553. edge_a[face] = coordinate_a;
  554. edge_b[face] = coordinate_b;
  555. edge_c[face] = coordinate_c;
  556. }
  557. }
  558. vertex_data_1.currentPosition = model_texture_offset;
  559. vertex_data_2.currentPosition = model_texture_unknown_1;
  560. vertex_data_3.currentPosition = model_texture_unknown_2;
  561. vertex_data_4.currentPosition = model_texture_unknown_3;
  562. skin_data.currentPosition = model_texture_unknown_4;
  563. texture_data.currentPosition = model_texture_unknown_5;
  564. for (face = 0; face < texture_faces; face++) {
  565. int opcode = texture_type[face] & 0xff;
  566. if (opcode == 0) {
  567. texture_edge_a[face] = (short) vertex_data_1.readUShort();
  568. texture_edge_b[face] = (short) vertex_data_1.readUShort();
  569. texture_edge_c[face] = (short) vertex_data_1.readUShort();
  570. }
  571. if (opcode == 1) {
  572. texture_edge_a[face] = (short) vertex_data_2.readUShort();
  573. texture_edge_b[face] = (short) vertex_data_2.readUShort();
  574. texture_edge_c[face] = (short) vertex_data_2.readUShort();
  575. }
  576. if (opcode == 2) {
  577. texture_edge_a[face] = (short) vertex_data_2.readUShort();
  578. texture_edge_b[face] = (short) vertex_data_2.readUShort();
  579. texture_edge_c[face] = (short) vertex_data_2.readUShort();
  580. }
  581. if (opcode == 3) {
  582. texture_edge_a[face] = (short) vertex_data_2.readUShort();
  583. texture_edge_b[face] = (short) vertex_data_2.readUShort();
  584. texture_edge_c[face] = (short) vertex_data_2.readUShort();
  585. }
  586. }
  587. vertex_data_1.currentPosition = pos;
  588. face = vertex_data_1.readUnsignedByte();
  589. }
  590.  
  591. public Model(int modelId) {
  592. byte[] data = header[modelId].aByteArray368;
  593. if (data[data.length - 1] == -1 && data[data.length - 2] == -1) {
  594. decode_new(data, modelId);
  595. } else {
  596. decode_old(data, modelId);
  597. }
  598. }
  599.  
  600. public static void method460(byte abyte0[], int j) {
  601. try {
  602. if (abyte0 == null) {
  603. ModelHeader class21 = header[j] = new ModelHeader();
  604. class21.anInt369 = 0;
  605. class21.anInt370 = 0;
  606. class21.anInt371 = 0;
  607. return;
  608. }
  609. Buffer stream = new Buffer(abyte0);
  610. stream.currentPosition = abyte0.length - 18;
  611. ModelHeader class21_1 = header[j] = new ModelHeader();
  612. class21_1.aByteArray368 = abyte0;
  613. class21_1.anInt369 = stream.readUShort();
  614. class21_1.anInt370 = stream.readUShort();
  615. class21_1.anInt371 = stream.readUnsignedByte();
  616. int k = stream.readUnsignedByte();
  617. int l = stream.readUnsignedByte();
  618. int i1 = stream.readUnsignedByte();
  619. int j1 = stream.readUnsignedByte();
  620. int k1 = stream.readUnsignedByte();
  621. int l1 = stream.readUShort();
  622. int i2 = stream.readUShort();
  623. int j2 = stream.readUShort();
  624. int k2 = stream.readUShort();
  625. int l2 = 0;
  626. class21_1.anInt372 = l2;
  627. l2 += class21_1.anInt369;
  628. class21_1.anInt378 = l2;
  629. l2 += class21_1.anInt370;
  630. class21_1.anInt381 = l2;
  631. if (l == 255)
  632. l2 += class21_1.anInt370;
  633. else
  634. class21_1.anInt381 = -l - 1;
  635. class21_1.anInt383 = l2;
  636. if (j1 == 1)
  637. l2 += class21_1.anInt370;
  638. else
  639. class21_1.anInt383 = -1;
  640. class21_1.anInt380 = l2;
  641. if (k == 1)
  642. l2 += class21_1.anInt370;
  643. else
  644. class21_1.anInt380 = -1;
  645. class21_1.anInt376 = l2;
  646. if (k1 == 1)
  647. l2 += class21_1.anInt369;
  648. else
  649. class21_1.anInt376 = -1;
  650. class21_1.anInt382 = l2;
  651. if (i1 == 1)
  652. l2 += class21_1.anInt370;
  653. else
  654. class21_1.anInt382 = -1;
  655. class21_1.anInt377 = l2;
  656. l2 += k2;
  657. class21_1.anInt379 = l2;
  658. l2 += class21_1.anInt370 * 2;
  659. class21_1.anInt384 = l2;
  660. l2 += class21_1.anInt371 * 6;
  661. class21_1.anInt373 = l2;
  662. l2 += l1;
  663. class21_1.anInt374 = l2;
  664. l2 += i2;
  665. class21_1.anInt375 = l2;
  666. l2 += j2;
  667. } catch (Exception _ex) {
  668. _ex.printStackTrace();
  669. }
  670. }
  671.  
  672. public static void method459(int id, Provider onDemandFetcherParent) {
  673. header = new ModelHeader[id];
  674. resourceProvider = onDemandFetcherParent;
  675. }
  676.  
  677. public static void method461(int file) {//clear
  678. header[file] = null;
  679. }
  680.  
  681. public static Model getModel(int file) {
  682. if (header == null)
  683. return null;
  684.  
  685. ModelHeader class21 = header[file];
  686. if (class21 == null) {
  687. resourceProvider.provide(file);
  688. return null;
  689. } else {
  690. return new Model(file);
  691. }
  692. }
  693.  
  694. public static boolean cached(int file) {
  695. if (header == null)
  696. return false;
  697.  
  698. ModelHeader class21 = header[file];
  699. if (class21 == null) {
  700. resourceProvider.provide(file);
  701. return false;
  702. } else {
  703. return true;
  704. }
  705. }
  706.  
  707. private Model(boolean flag) {
  708. aBoolean1618 = true;//?
  709. fits_on_single_square = false;
  710. if (!flag)
  711. aBoolean1618 = !aBoolean1618;
  712.  
  713. }
  714.  
  715. public Model(int length, Model model_segments[]) {
  716. this(length, model_segments, false);
  717. }
  718.  
  719. public Model(int length, Model model_segments[], boolean player) {
  720. try {
  721. aBoolean1618 = true;
  722. fits_on_single_square = false;
  723. anInt1620++;
  724. boolean type_flag = false;
  725. boolean priority_flag = false;
  726. boolean alpha_flag = false;
  727. boolean tSkin_flag = false;
  728. boolean color_flag = false;
  729. boolean texture_flag = false;
  730. boolean coordinate_flag = false;
  731. vertices = 0;
  732. faces = 0;
  733. texture_faces = 0;
  734. priority = -1;
  735. Model build;
  736. for (int segment_index = 0; segment_index < length; segment_index++) {
  737. build = model_segments[segment_index];
  738. if (build != null) {
  739. vertices += build.vertices;
  740. faces += build.faces;
  741. texture_faces += build.texture_faces;
  742. type_flag |= build.render_type != null;
  743. alpha_flag |= build.alpha != null;
  744. if (build.render_priorities != null) {
  745. priority_flag = true;
  746. } else {
  747. if (priority == -1)
  748. priority = build.priority;
  749.  
  750. if (priority != build.priority)
  751. priority_flag = true;
  752. }
  753. tSkin_flag |= build.tSkin != null;
  754. color_flag |= build.color != null;
  755. texture_flag |= build.texture != null;
  756. coordinate_flag |= build.texture_coordinates != null;
  757. }
  758. }
  759. particle_vertices = new int[vertices];
  760. vertexX = new int[vertices];
  761. vertexY = new int[vertices];
  762. vertexZ = new int[vertices];
  763. vSkin = new int[vertices];
  764. edge_a = new int[faces];
  765. edge_b = new int[faces];
  766. edge_c = new int[faces];
  767. if(color_flag)
  768. color = new short[faces];
  769.  
  770. if (type_flag)
  771. render_type = new int[faces];
  772.  
  773. if (priority_flag)
  774. render_priorities = new byte[faces];
  775.  
  776. if (alpha_flag)
  777. alpha = new int[faces];
  778.  
  779. if (tSkin_flag)
  780. tSkin = new int[faces];
  781.  
  782. if(texture_flag)
  783. texture = new short[faces];
  784.  
  785. if (coordinate_flag)
  786. texture_coordinates = new byte[faces];
  787.  
  788. if(texture_faces > 0) {
  789. texture_type = new byte[texture_faces];
  790. texture_edge_a = new short[texture_faces];
  791. texture_edge_b = new short[texture_faces];
  792. texture_edge_c = new short[texture_faces];
  793. }
  794.  
  795. vertices = 0;
  796. faces = 0;
  797. texture_faces = 0;
  798. for (int segment_index = 0; segment_index < length; segment_index++) {
  799. build = model_segments[segment_index];
  800. if (build != null) {
  801. for (int face = 0; face < build.faces; face++) {
  802. /*if (type_flag) {
  803. if (build.render_type == null) {
  804. render_type[faces] = 0;
  805. } else {
  806. int type = build.render_type[face];
  807. if ((type & 2) == 2)
  808. type += texture_faces << 2;
  809.  
  810. render_type[faces] = type;
  811. }
  812. }*/
  813. if(type_flag && build.render_type != null)
  814. render_type[faces] = build.render_type[face];
  815.  
  816. if (priority_flag)
  817. if (build.render_priorities == null)
  818. render_priorities[faces] = build.priority;
  819. else
  820. render_priorities[faces] = build.render_priorities[face];
  821.  
  822. if (alpha_flag && build.alpha != null)
  823. alpha[faces] = build.alpha[face];
  824.  
  825. if (tSkin_flag && build.tSkin != null)
  826. tSkin[faces] = build.tSkin[face];
  827.  
  828. if(texture_flag) {
  829. if(build.texture != null)
  830. texture[faces] = build.texture[face];
  831. else
  832. texture[faces] = -1;
  833. }
  834. if(coordinate_flag) {
  835. if(build.texture_coordinates != null && build.texture_coordinates[face] != -1) {
  836. texture_coordinates[faces] = (byte) (build.texture_coordinates[face] + texture_faces);
  837. } else {
  838. texture_coordinates[faces] = -1;
  839. }
  840. }
  841.  
  842. if(color_flag && build.color != null)
  843. color[faces] = build.color[face];
  844.  
  845. edge_a[faces] = method465(build, build.edge_a[face]);
  846. edge_b[faces] = method465(build, build.edge_b[face]);
  847. edge_c[faces] = method465(build, build.edge_c[face]);
  848. faces++;
  849. }
  850. for (int texture_edge = 0; texture_edge < build.texture_faces; texture_edge++) {
  851. byte opcode = texture_type[texture_faces] = build.texture_type[texture_edge];
  852. if(opcode == 0) {
  853. texture_edge_a[texture_faces] = (short) method465(build, build.texture_edge_a[texture_edge]);
  854. texture_edge_b[texture_faces] = (short) method465(build, build.texture_edge_b[texture_edge]);
  855. texture_edge_c[texture_faces] = (short) method465(build, build.texture_edge_c[texture_edge]);
  856. }
  857. if(opcode >= 1 && opcode <= 3) {
  858. texture_edge_a[texture_faces] = build.texture_edge_a[texture_edge];
  859. texture_edge_b[texture_faces] = build.texture_edge_b[texture_edge];
  860. texture_edge_c[texture_faces] = build.texture_edge_c[texture_edge];
  861. }
  862. if(opcode == 2) {
  863.  
  864. }
  865. if(player)
  866. texture_faces++;
  867. }
  868. if(!player)
  869. texture_faces++;
  870. }
  871. }
  872. } catch (Exception e) {
  873. e.printStackTrace();
  874. }
  875. }
  876.  
  877. //Players - graphics in particular
  878. public Model(Model model_segments[]) {
  879. int length = 2;
  880. aBoolean1618 = true;
  881. fits_on_single_square = false;
  882. anInt1620++;
  883. boolean type_flag = false;
  884. boolean priority_flag = false;
  885. boolean alpha_flag = false;
  886. boolean color_flag = false;
  887. boolean texture_flag = false;
  888. boolean coordinate_flag = false;
  889. vertices = 0;
  890. faces = 0;
  891. texture_faces = 0;
  892. int i_668_ = 0;
  893. int i_669_ = 0;
  894. priority = -1;
  895. Model build;
  896. for (int segment_index = 0; segment_index < length; segment_index++) {
  897. build = model_segments[segment_index];
  898. if (build != null) {
  899. vertices += build.vertices;
  900. faces += build.faces;
  901. texture_faces += build.texture_faces;
  902. type_flag |= render_type != null;
  903. if (build.render_priorities != null) {
  904. priority_flag = true;
  905. } else {
  906. if (priority == -1)
  907. priority = build.priority;
  908.  
  909. if (priority != build.priority)
  910. priority_flag = true;
  911. }
  912. alpha_flag |= build.alpha != null;
  913. color_flag |= build.color != null;
  914. texture_flag |= build.texture != null;
  915. coordinate_flag |= build.texture_coordinates != null;
  916. if(build.aClass158Array3788 != null)
  917. i_668_ += build.aClass158Array3788.length;
  918.  
  919. if(build.aClass169Array3776 != null)
  920. i_669_ += build.aClass169Array3776.length;
  921. }
  922. }
  923. particle_vertices = new int[vertices];
  924. vertexX = new int[vertices];
  925. vertexY = new int[vertices];
  926. vertexZ = new int[vertices];
  927. edge_a = new int[faces];
  928. edge_b = new int[faces];
  929. edge_c = new int[faces];
  930. hue_a = new int[faces];
  931. hue_b = new int[faces];
  932. hue_c = new int[faces];
  933.  
  934. if (type_flag)
  935. render_type = new int[faces];
  936.  
  937. if (priority_flag)
  938. render_priorities = new byte[faces];
  939.  
  940. if (alpha_flag)
  941. alpha = new int[faces];
  942.  
  943. if (texture_flag)
  944. texture = new short[faces];
  945.  
  946. if (coordinate_flag)
  947. texture_coordinates = new byte[faces];
  948.  
  949. if(texture_faces > 0) {
  950. texture_type = new byte[texture_faces];
  951. texture_edge_a = new short[texture_faces];
  952. texture_edge_b = new short[texture_faces];
  953. texture_edge_c = new short[texture_faces];
  954. }
  955. if(i_668_ > 0) {
  956. this.aClass158Array3788 = new ModelParticleEmitter[i_668_];
  957. }
  958. if(i_669_ > 0) {
  959. this.aClass169Array3776 = new ModelParticleMagnet[i_669_];
  960. }
  961.  
  962. if (color_flag)
  963. color = new short[faces];
  964.  
  965. vertices = 0;
  966. faces = 0;
  967. texture_faces = 0;
  968. for (int segment_index = 0; segment_index < length; segment_index++) {
  969. build = model_segments[segment_index];
  970. if (build != null) {
  971. int vertex = vertices;
  972. for (int point = 0; point < build.vertices; point++) {
  973. particle_vertices[vertices] = build.particle_vertices[point];
  974. vertexX[vertices] = build.vertexX[point];
  975. vertexY[vertices] = build.vertexY[point];
  976. vertexZ[vertices] = build.vertexZ[point];
  977. vertices++;
  978. }
  979. for (int face = 0; face < build.faces; face++) {
  980. edge_a[faces] = build.edge_a[face] + vertex;
  981. edge_b[faces] = build.edge_b[face] + vertex;
  982. edge_c[faces] = build.edge_c[face] + vertex;
  983. hue_a[faces] = build.hue_a[face];
  984. hue_b[faces] = build.hue_b[face];
  985. hue_c[faces] = build.hue_c[face];
  986. /*if (type_flag)
  987. if (build.render_type == null) {
  988. render_type[faces] = 0;
  989. } else {
  990. int type = build.render_type[face];
  991. if ((type & 2) == 2) //texture
  992. type += texture_faces << 2;
  993.  
  994. render_type[faces] = type;
  995. }*/
  996.  
  997. if(type_flag && build.render_type != null) {
  998. render_type[faces] = build.render_type[face];
  999. }
  1000.  
  1001. if (alpha_flag && build.alpha != null) {
  1002. alpha[faces] = build.alpha[face];
  1003. }
  1004.  
  1005. if (priority_flag)
  1006. if (build.render_priorities == null)
  1007. render_priorities[faces] = build.priority;
  1008. else
  1009. render_priorities[faces] = build.render_priorities[face];
  1010.  
  1011. if (color_flag && build.color != null)
  1012. color[faces] = build.color[face];
  1013.  
  1014. if(texture_flag) {
  1015. if(build.texture != null) {
  1016. texture[faces] = build.texture[face];
  1017. } else
  1018. texture[faces] = -1;
  1019. }
  1020. if(coordinate_flag) {
  1021. if(build.texture_coordinates != null && build.texture_coordinates[face] != -1) {
  1022. texture_coordinates[faces] = (byte) (build.texture_coordinates[face] + texture_faces);
  1023.  
  1024. } else
  1025. texture_coordinates[faces] = -1;
  1026.  
  1027. }
  1028. faces++;
  1029. }
  1030.  
  1031. for (int texture_edge = 0; texture_edge < build.texture_faces; texture_edge++) {
  1032. texture_edge_a[texture_faces] = (short) (build.texture_edge_a[texture_edge] + vertex);
  1033. texture_edge_b[texture_faces] = (short) (build.texture_edge_b[texture_edge] + vertex);
  1034. texture_edge_c[texture_faces] = (short) (build.texture_edge_c[texture_edge] + vertex);
  1035. texture_faces++;
  1036. }
  1037. texture_faces += build.texture_faces;//texture_faces++;
  1038. }
  1039. }
  1040. method466();
  1041. }
  1042.  
  1043. public Model(boolean color_flag, boolean alpha_flag, boolean animated, Model model) {
  1044. this(color_flag, alpha_flag, animated, false, model);
  1045. }
  1046.  
  1047. public Model(boolean color_flag, boolean alpha_flag, boolean animated, boolean texture_flag, Model model) {
  1048. aBoolean1618 = true;
  1049. fits_on_single_square = false;
  1050. anInt1620++;
  1051. vertices = model.vertices;
  1052. faces = model.faces;
  1053. texture_faces = model.texture_faces;
  1054. if (animated) {
  1055. particle_vertices = model.particle_vertices;
  1056. vertexX = model.vertexX;
  1057. vertexY = model.vertexY;
  1058. vertexZ = model.vertexZ;
  1059. } else {
  1060. particle_vertices = new int[vertices];
  1061. vertexX = new int[vertices];
  1062. vertexY = new int[vertices];
  1063. vertexZ = new int[vertices];
  1064. for (int point = 0; point < vertices; point++) {
  1065. particle_vertices[point] = model.particle_vertices[point];
  1066. vertexX[point] = model.vertexX[point];
  1067. vertexY[point] = model.vertexY[point];
  1068. vertexZ[point] = model.vertexZ[point];
  1069. }
  1070.  
  1071. }
  1072. if (color_flag) {
  1073. color = model.color;
  1074. } else {
  1075. color = new short[faces];
  1076. for (int face = 0; face < faces; face++)
  1077. color[face] = model.color[face];
  1078.  
  1079. }
  1080. if(!texture_flag && model.texture != null) {
  1081. texture = new short[faces];
  1082. for(int face = 0; face < faces; face++) {
  1083. texture[face] = model.texture[face];
  1084. }
  1085. } else {
  1086. texture = model.texture;
  1087. }
  1088.  
  1089. if (alpha_flag) {
  1090. alpha = model.alpha;
  1091. } else {
  1092. alpha = new int[faces];
  1093. if (model.alpha == null) {
  1094. for (int l = 0; l < faces; l++)
  1095. alpha[l] = 0;
  1096.  
  1097. } else {
  1098. for (int i1 = 0; i1 < faces; i1++)
  1099. alpha[i1] = model.alpha[i1];
  1100.  
  1101. }
  1102. }
  1103. vSkin = model.vSkin;
  1104. tSkin = model.tSkin;
  1105. render_type = model.render_type;
  1106. edge_a = model.edge_a;
  1107. edge_b = model.edge_b;
  1108. edge_c = model.edge_c;
  1109. render_priorities = model.render_priorities;
  1110. texture_coordinates = model.texture_coordinates;
  1111. texture_type = model.texture_type;
  1112. priority = model.priority;
  1113. texture_edge_a = model.texture_edge_a;
  1114. texture_edge_b = model.texture_edge_b;
  1115. texture_edge_c = model.texture_edge_c;
  1116. this.aClass158Array3788 = model.aClass158Array3788;
  1117. this.aClass169Array3776 = model.aClass169Array3776;
  1118. }
  1119.  
  1120. public Model(boolean adjust_elevation, boolean gouraud_shading, Model model) {
  1121. aBoolean1618 = true;
  1122. fits_on_single_square = false;
  1123. anInt1620++;
  1124. vertices = model.vertices;
  1125. faces = model.faces;
  1126. texture_faces = model.texture_faces;
  1127. if (adjust_elevation) {
  1128. vertexY = new int[vertices];
  1129. for (int point = 0; point < vertices; point++)
  1130. vertexY[point] = model.vertexY[point];
  1131.  
  1132. } else {
  1133. vertexY = model.vertexY;
  1134. }
  1135. if (gouraud_shading) {
  1136. hue_a = new int[faces];
  1137. hue_b = new int[faces];
  1138. hue_c = new int[faces];
  1139. for (int face = 0; face < faces; face++) {
  1140. hue_a[face] = model.hue_a[face];
  1141. hue_b[face] = model.hue_b[face];
  1142. hue_c[face] = model.hue_c[face];
  1143. }
  1144.  
  1145. render_type = new int[faces];
  1146. if (model.render_type == null) {
  1147. for (int face = 0; face < faces; face++)
  1148. render_type[face] = 0;
  1149.  
  1150. } else {
  1151. for (int face = 0; face < faces; face++)
  1152. render_type[face] = model.render_type[face];
  1153.  
  1154. }
  1155. super.aClass33Array1425 = new Vertex[vertices];
  1156. for (int point = 0; point < vertices; point++) {
  1157. Vertex class33 = super.aClass33Array1425[point] = new Vertex();
  1158. Vertex class33_1 = model.aClass33Array1425[point];
  1159. class33.anInt602 = class33_1.anInt602;
  1160. class33.anInt603 = class33_1.anInt603;
  1161. class33.anInt604 = class33_1.anInt604;
  1162. class33.anInt605 = class33_1.anInt605;
  1163. }
  1164. gouraud_vertex = model.gouraud_vertex;
  1165.  
  1166. } else {
  1167. hue_a = model.hue_a;
  1168. hue_b = model.hue_b;
  1169. hue_c = model.hue_c;
  1170. render_type = model.render_type;
  1171. }
  1172. particle_vertices = model.particle_vertices;
  1173. vertexX = model.vertexX;
  1174. vertexZ = model.vertexZ;
  1175. edge_a = model.edge_a;
  1176. edge_b = model.edge_b;
  1177. edge_c = model.edge_c;
  1178. render_priorities = model.render_priorities;
  1179. alpha = model.alpha;
  1180. texture_coordinates = model.texture_coordinates;
  1181. color = model.color;
  1182. texture = model.texture;
  1183. priority = model.priority;
  1184. texture_type = model.texture_type;
  1185. texture_edge_a = model.texture_edge_a;
  1186. texture_edge_b = model.texture_edge_b;
  1187. texture_edge_c = model.texture_edge_c;
  1188. super.modelHeight = model.modelHeight;
  1189. anInt1650 = model.anInt1650;
  1190. anInt1653 = model.anInt1653;
  1191. anInt1652 = model.anInt1652;
  1192. anInt1646 = model.anInt1646;
  1193. anInt1648 = model.anInt1648;
  1194. anInt1649 = model.anInt1649;
  1195. anInt1647 = model.anInt1647;
  1196. }
  1197.  
  1198. public void method464(Model model, boolean alpha_flag) {
  1199. vertices = model.vertices;
  1200. faces = model.faces;
  1201. texture_faces = model.texture_faces;
  1202. if (anIntArray1622.length < vertices) {
  1203. anIntArray1622 = new int[vertices + 10000];
  1204. anIntArray1623 = new int[vertices + 10000];
  1205. anIntArray1624 = new int[vertices + 10000];
  1206. }
  1207. particle_vertices = new int[vertices];
  1208. vertexX = anIntArray1622;
  1209. vertexY = anIntArray1623;
  1210. vertexZ = anIntArray1624;
  1211. for (int point = 0; point < vertices; point++) {
  1212. if (particle_vertices != null)
  1213. particle_vertices[point] = model.particle_vertices[point];
  1214.  
  1215. vertexX[point] = model.vertexX[point];
  1216. vertexY[point] = model.vertexY[point];
  1217. vertexZ[point] = model.vertexZ[point];
  1218. }
  1219. if (alpha_flag) {
  1220. alpha = model.alpha;
  1221. } else {
  1222. if (anIntArray1625.length < faces)
  1223. anIntArray1625 = new int[faces + 100];
  1224.  
  1225. alpha = anIntArray1625;
  1226. if (model.alpha == null) {
  1227. for (int face = 0; face < faces; face++)
  1228. alpha[face] = 0;
  1229.  
  1230. } else {
  1231. for (int face = 0; face < faces; face++)
  1232. alpha[face] = model.alpha[face];
  1233.  
  1234. }
  1235. }
  1236. render_type = model.render_type;
  1237. color = model.color;
  1238. render_priorities = model.render_priorities;
  1239. priority = model.priority;
  1240. face_skin = model.face_skin;
  1241. vertex_skin = model.vertex_skin;
  1242. edge_a = model.edge_a;
  1243. edge_b = model.edge_b;
  1244. edge_c = model.edge_c;
  1245. hue_a = model.hue_a;
  1246. hue_b = model.hue_b;
  1247. hue_c = model.hue_c;
  1248. texture_edge_a = model.texture_edge_a;
  1249. texture_edge_b = model.texture_edge_b;
  1250. texture_edge_c = model.texture_edge_c;
  1251. texture_coordinates = model.texture_coordinates;
  1252. texture_type = model.texture_type;
  1253. texture = model.texture;
  1254. }
  1255.  
  1256. private final int method465(Model model, int face) {
  1257. int vertex = -1;
  1258. int particle_point = model.particle_vertices[face];
  1259. int x = model.vertexX[face];
  1260. int y = model.vertexY[face];
  1261. int z = model.vertexZ[face];
  1262. for (int index = 0; index < vertices; index++) {
  1263. if (x != vertexX[index] || y != vertexY[index] || z != vertexZ[index])
  1264. continue;
  1265. vertex = index;
  1266. break;
  1267. }
  1268. if (vertex == -1) {
  1269. particle_vertices[vertices] = particle_point;
  1270. vertexX[vertices] = x;
  1271. vertexY[vertices] = y;
  1272. vertexZ[vertices] = z;
  1273. if (model.vSkin != null)
  1274. vSkin[vertices] = model.vSkin[face];
  1275.  
  1276. vertex = vertices++;
  1277. }
  1278. return vertex;
  1279. }
  1280.  
  1281. public void method466() {
  1282. super.modelHeight = 0;
  1283. anInt1650 = 0;
  1284. anInt1651 = 0;
  1285. for (int index = 0; index < vertices; index++) {
  1286. int x = vertexX[index];
  1287. int y = vertexY[index];
  1288. int z = vertexZ[index];
  1289. if (-y > super.modelHeight)
  1290. super.modelHeight = -y;
  1291.  
  1292. if (y > anInt1651)
  1293. anInt1651 = y;
  1294.  
  1295. int i1 = x * x + z * z;
  1296. if (i1 > anInt1650)
  1297. anInt1650 = i1;
  1298. }
  1299. anInt1650 = (int) (Math.sqrt(anInt1650) + 0.98999999999999999D);
  1300. anInt1653 = (int) (Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight) + 0.98999999999999999D);//aShort3763
  1301. anInt1652 = anInt1653 + (int) (Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651) + 0.98999999999999999D);//aShort3785
  1302. }
  1303.  
  1304. public void computeSphericalBounds() {
  1305. super.modelHeight = 0;
  1306. anInt1651 = 0;
  1307. for (int index = 0; index < vertices; index++) {
  1308. int j = vertexY[index];
  1309. if (-j > super.modelHeight)
  1310. super.modelHeight = -j;
  1311.  
  1312. if (j > anInt1651)
  1313. anInt1651 = j;
  1314.  
  1315. }
  1316. anInt1653 = (int) (Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight) + 0.98999999999999999D);
  1317. anInt1652 = anInt1653 + (int) (Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651) + 0.98999999999999999D);
  1318. }
  1319.  
  1320. public void method468(int i) {
  1321. super.modelHeight = 0;
  1322. anInt1650 = 0;
  1323. anInt1651 = 0;
  1324. anInt1646 = 0xf423f;
  1325. anInt1647 = 0xfff0bdc1;
  1326. anInt1648 = 0xfffe7961;
  1327. anInt1649 = 0x1869f;
  1328. for (int j = 0; j < vertices; j++) {
  1329. int x = vertexX[j];
  1330. int y = vertexY[j];
  1331. int z = vertexZ[j];
  1332. if (x < anInt1646)
  1333. anInt1646 = x;
  1334. if (x > anInt1647)
  1335. anInt1647 = x;
  1336. if (z < anInt1649)
  1337. anInt1649 = z;
  1338. if (z > anInt1648)
  1339. anInt1648 = z;
  1340. if (-y > super.modelHeight)
  1341. super.modelHeight = -y;
  1342. if (y > anInt1651)
  1343. anInt1651 = y;
  1344. int j1 = x * x + z * z;
  1345. if (j1 > anInt1650)
  1346. anInt1650 = j1;
  1347. }
  1348. anInt1650 = (int) Math.sqrt(anInt1650);
  1349. anInt1653 = (int) Math.sqrt(anInt1650 * anInt1650 + super.modelHeight * super.modelHeight);
  1350. if (i != 21073) {
  1351. return;
  1352. } else {
  1353. anInt1652 = anInt1653 + (int) Math.sqrt(anInt1650 * anInt1650 + anInt1651 * anInt1651);
  1354. return;
  1355. }
  1356. }
  1357.  
  1358. public void skin() {
  1359. if (vSkin != null) {
  1360. int ai[] = new int[256];
  1361. int j = 0;
  1362. for (int l = 0; l < vertices; l++) {
  1363. int j1 = vSkin[l];
  1364. ai[j1]++;
  1365. if (j1 > j)
  1366. j = j1;
  1367. }
  1368. vertex_skin = new int[j + 1][];
  1369. for (int k1 = 0; k1 <= j; k1++) {
  1370. vertex_skin[k1] = new int[ai[k1]];
  1371. ai[k1] = 0;
  1372. }
  1373. for (int j2 = 0; j2 < vertices; j2++) {
  1374. int l2 = vSkin[j2];
  1375. vertex_skin[l2][ai[l2]++] = j2;
  1376. }
  1377. vSkin = null;
  1378. }
  1379. if (tSkin != null) {
  1380. int ai1[] = new int[256];
  1381. int k = 0;
  1382. for (int i1 = 0; i1 < faces; i1++) {
  1383. int l1 = tSkin[i1];
  1384. ai1[l1]++;
  1385. if (l1 > k)
  1386. k = l1;
  1387. }
  1388. face_skin = new int[k + 1][];
  1389. for (int i2 = 0; i2 <= k; i2++) {
  1390. face_skin[i2] = new int[ai1[i2]];
  1391. ai1[i2] = 0;
  1392. }
  1393. for (int k2 = 0; k2 < faces; k2++) {
  1394. int i3 = tSkin[k2];
  1395. face_skin[i3][ai1[i3]++] = k2;
  1396. }
  1397. tSkin = null;
  1398. }
  1399. }
  1400.  
  1401. public void method470(int frame, int nextFrame, int end, int cycle) {
  1402. if (!Settings.toggle_tweening) {
  1403. apply(frame);
  1404. return;
  1405. }
  1406. if (vertex_skin != null && frame != -1) {
  1407. Frame currentAnimation = Frame.method531(frame);
  1408. FrameBase list1 = currentAnimation.aClass18_637;
  1409. anInt1681 = 0;
  1410. anInt1682 = 0;
  1411. anInt1683 = 0;
  1412. Frame nextAnimation = null;
  1413. FrameBase list2 = null;
  1414. if (nextFrame != -1) {
  1415. nextAnimation = Frame.method531(nextFrame);
  1416. if (nextAnimation.aClass18_637 != list1)
  1417. nextAnimation = null;
  1418. list2 = nextAnimation.aClass18_637;
  1419. }
  1420. if (nextAnimation == null || list2 == null) {
  1421. for (int i_263_ = 0; i_263_ < currentAnimation.anInt638; i_263_++) {
  1422. int i_264_ = currentAnimation.anIntArray639[i_263_];
  1423. method472(list1.anIntArray342[i_264_], list1.anIntArrayArray343[i_264_],
  1424. currentAnimation.anIntArray640[i_263_],
  1425. currentAnimation.anIntArray641[i_263_],
  1426. currentAnimation.anIntArray642[i_263_]);
  1427. }
  1428. } else {
  1429. for (int i1 = 0; i1 < currentAnimation.anInt638; i1++) {
  1430. int n1 = currentAnimation.anIntArray639[i1];
  1431. int opcode = list1.anIntArray342[n1];
  1432. int[] skin = list1.anIntArrayArray343[n1];
  1433. int x = currentAnimation.anIntArray640[i1];
  1434. int y = currentAnimation.anIntArray641[i1];
  1435. int z = currentAnimation.anIntArray642[i1];
  1436. boolean found = false;
  1437. for (int i2 = 0; i2 < nextAnimation.anInt638; i2++) {
  1438. int n2 = nextAnimation.anIntArray639[i2];
  1439. if (list2.anIntArrayArray343[n2].equals(skin)) {
  1440. if (opcode != 2) {
  1441. x += (nextAnimation.anIntArray640[i2] - x) * cycle / end;
  1442. y += (nextAnimation.anIntArray641[i2] - y) * cycle / end;
  1443. z += (nextAnimation.anIntArray642[i2] - z) * cycle / end;
  1444. } else {
  1445. x &= 0x7ff;
  1446. y &= 0x7ff;
  1447. z &= 0x7ff;
  1448. int dx = nextAnimation.anIntArray640[i2] - x & 0x7ff;
  1449. int dy = nextAnimation.anIntArray641[i2] - y & 0x7ff;
  1450. int dz = nextAnimation.anIntArray642[i2] - z & 0x7ff;
  1451. if (dx >= 1024) {
  1452. dx -= 2048;
  1453. }
  1454. if (dy >= 1024) {
  1455. dy -= 2048;
  1456. }
  1457. if (dz >= 1024) {
  1458. dz -= 2048;
  1459. }
  1460. x = x + dx * cycle / end & 0x7ff;
  1461. y = y + dy * cycle / end & 0x7ff;
  1462. z = z + dz * cycle / end & 0x7ff;
  1463. }
  1464. found = true;
  1465. break;
  1466. }
  1467. }
  1468. if (!found) {
  1469. if (opcode != 3 && opcode != 2) {
  1470. x = x * (end - cycle) / end;
  1471. y = y * (end - cycle) / end;
  1472. z = z * (end - cycle) / end;
  1473. } else if (opcode == 3) {
  1474. x = (x * (end - cycle) + (cycle << 7)) / end;
  1475. y = (y * (end - cycle) + (cycle << 7)) / end;
  1476. z = (z * (end - cycle) + (cycle << 7)) / end;
  1477. } else {
  1478. x &= 0x7ff;
  1479. y &= 0x7ff;
  1480. z &= 0x7ff;
  1481. int dx = -x & 0x7ff;
  1482. int dy = -y & 0x7ff;
  1483. int dz = -z & 0x7ff;
  1484. if (dx >= 1024) {
  1485. dx -= 2048;
  1486. }
  1487. if (dy >= 1024) {
  1488. dy -= 2048;
  1489. }
  1490. if (dz >= 1024) {//128
  1491. dz -= 2048;//256
  1492. }
  1493. x = x + dx * cycle / end & 0x7ff;//0xff
  1494. y = y + dy * cycle / end & 0x7ff;
  1495. z = z + dz * cycle / end & 0x7ff;
  1496. }
  1497. }
  1498. method472(opcode, skin, x, y, z);
  1499. }
  1500. }
  1501. }
  1502. }
  1503.  
  1504. public void apply(int id) {
  1505. if (vertex_skin == null)
  1506. return;
  1507.  
  1508. if (id == -1)
  1509. return;
  1510.  
  1511. Frame frame = Frame.method531(id);
  1512. if (frame == null)
  1513. return;
  1514.  
  1515. FrameBase skin = frame.aClass18_637;
  1516. anInt1681 = 0;
  1517. anInt1682 = 0;
  1518. anInt1683 = 0;
  1519. for (int k = 0; k < frame.anInt638; k++) {
  1520. int l = frame.anIntArray639[k];
  1521. method472(skin.anIntArray342[l], skin.anIntArrayArray343[l], frame.anIntArray640[k], frame.anIntArray641[k], frame.anIntArray642[k]);
  1522. }
  1523.  
  1524. }
  1525.  
  1526. public void method471(int label[], int idle, int current) {//interpolate
  1527. if (current == -1)
  1528. return;
  1529.  
  1530. if (label == null || idle == -1) {
  1531. apply(current);
  1532. return;
  1533. }
  1534. Frame anim = Frame.method531(current);
  1535. if (anim == null)
  1536. return;
  1537. Frame skin = Frame.method531(idle);
  1538. if (skin == null) {
  1539. apply(current);
  1540. return;
  1541. }
  1542. FrameBase list = anim.aClass18_637;
  1543. anInt1681 = 0;
  1544. anInt1682 = 0;
  1545. anInt1683 = 0;
  1546. int id = 0;
  1547. int table = label[id++];
  1548. for (int index = 0; index < anim.anInt638; index++) {
  1549. int condition;
  1550. for (condition = anim.anIntArray639[index]; condition > table; table = label[id++])
  1551. ;//empty
  1552. if (condition != table || list.anIntArray342[condition] == 0)//opcode check
  1553. method472(list.anIntArray342[condition], list.anIntArrayArray343[condition], anim.anIntArray640[index], anim.anIntArray641[index], anim.anIntArray642[index]);
  1554. }
  1555. anInt1681 = 0;
  1556. anInt1682 = 0;
  1557. anInt1683 = 0;
  1558. id = 0;
  1559. table = label[id++];
  1560. for (int index = 0; index < skin.anInt638; index++) {
  1561. int condition;
  1562. for (condition = skin.anIntArray639[index]; condition > table; table = label[id++])
  1563. ;//empty
  1564. if (condition == table || list.anIntArray342[condition] == 0)//opcode check
  1565. method472(list.anIntArray342[condition], list.anIntArrayArray343[condition], skin.anIntArray640[index], skin.anIntArray641[index], skin.anIntArray642[index]);
  1566. }
  1567. }
  1568.  
  1569. private void method472(int opcode, int skin[], int x, int y, int z) {
  1570. int length = skin.length;
  1571. if (opcode == 0) {
  1572. int j1 = 0;
  1573. anInt1681 = 0;
  1574. anInt1682 = 0;
  1575. anInt1683 = 0;
  1576. for (int index = 0; index < length; index++) {
  1577. int l3 = skin[index];
  1578. if (l3 < vertex_skin.length) {
  1579. int ai5[] = vertex_skin[l3];
  1580. for (int i5 = 0; i5 < ai5.length; i5++) {
  1581. int j6 = ai5[i5];
  1582. anInt1681 += vertexX[j6];
  1583. anInt1682 += vertexY[j6];
  1584. anInt1683 += vertexZ[j6];
  1585. j1++;
  1586. }
  1587.  
  1588. }
  1589. }
  1590.  
  1591. if (j1 > 0) {
  1592. anInt1681 = anInt1681 / j1 + x;
  1593. anInt1682 = anInt1682 / j1 + y;
  1594. anInt1683 = anInt1683 / j1 + z;
  1595. return;
  1596. } else {
  1597. anInt1681 = x;
  1598. anInt1682 = y;
  1599. anInt1683 = z;
  1600. return;
  1601. }
  1602. }
  1603. if (opcode == 1) {
  1604. for (int index = 0; index < length; index++) {
  1605. int l2 = skin[index];
  1606. if (l2 < vertex_skin.length) {
  1607. int ai1[] = vertex_skin[l2];
  1608. for (int i4 = 0; i4 < ai1.length; i4++) {
  1609. int j5 = ai1[i4];
  1610. vertexX[j5] += x;
  1611. vertexY[j5] += y;
  1612. vertexZ[j5] += z;
  1613. }
  1614.  
  1615. }
  1616. }
  1617.  
  1618. return;
  1619. }
  1620. if (opcode == 2) {//rotation
  1621. for (int index = 0; index < length; index++) {
  1622. int i3 = skin[index];
  1623. if (i3 < vertex_skin.length) {
  1624. int ai2[] = vertex_skin[i3];
  1625. for (int j4 = 0; j4 < ai2.length; j4++) {
  1626. int k5 = ai2[j4];
  1627. vertexX[k5] -= anInt1681;
  1628. vertexY[k5] -= anInt1682;
  1629. vertexZ[k5] -= anInt1683;
  1630. //int k6 = (x & 0xff) * 8;
  1631. //int l6 = (y & 0xff) * 8;
  1632. //int i7 = (z & 0xff) * 8;
  1633. if(z != 0) {//if (i7 != 0) {
  1634. int j7 = SINE[z];//i7
  1635. int i8 = COSINE[z];//i7
  1636. int l8 = vertexY[k5] * j7 + vertexX[k5] * i8 >> 16;
  1637. vertexY[k5] = vertexY[k5] * i8 - vertexX[k5] * j7 >> 16;
  1638. vertexX[k5] = l8;
  1639. }
  1640. if(x != 0) {//if (k6 != 0) {
  1641. int k7 = SINE[x];//k6
  1642. int j8 = COSINE[x];//k6
  1643. int i9 = vertexY[k5] * j8 - vertexZ[k5] * k7 >> 16;
  1644. vertexZ[k5] = vertexY[k5] * k7 + vertexZ[k5] * j8 >> 16;
  1645. vertexY[k5] = i9;
  1646. }
  1647. if(y != 0) {//if (l6 != 0) {
  1648. int l7 = SINE[y];//l6
  1649. int k8 = COSINE[y];//l6
  1650. int j9 = vertexZ[k5] * l7 + vertexX[k5] * k8 >> 16;
  1651. vertexZ[k5] = vertexZ[k5] * k8 - vertexX[k5] * l7 >> 16;
  1652. vertexX[k5] = j9;
  1653. }
  1654. vertexX[k5] += anInt1681;
  1655. vertexY[k5] += anInt1682;
  1656. vertexZ[k5] += anInt1683;
  1657. }
  1658.  
  1659. }
  1660. }
  1661. return;
  1662. }
  1663. if (opcode == 3) {
  1664. for (int index = 0; index < length; index++) {
  1665. int j3 = skin[index];
  1666. if (j3 < vertex_skin.length) {
  1667. int ai3[] = vertex_skin[j3];
  1668. for (int k4 = 0; k4 < ai3.length; k4++) {
  1669. int l5 = ai3[k4];
  1670. vertexX[l5] -= anInt1681;
  1671. vertexY[l5] -= anInt1682;
  1672. vertexZ[l5] -= anInt1683;
  1673. vertexX[l5] = (vertexX[l5] * x) / 128;
  1674. vertexY[l5] = (vertexY[l5] * y) / 128;
  1675. vertexZ[l5] = (vertexZ[l5] * z) / 128;
  1676. vertexX[l5] += anInt1681;
  1677. vertexY[l5] += anInt1682;
  1678. vertexZ[l5] += anInt1683;
  1679. }
  1680. }
  1681. }
  1682. return;
  1683. }
  1684. if (opcode == 5 && face_skin != null && alpha != null) {
  1685. for (int index = 0; index < length; index++) {
  1686. int k3 = skin[index];
  1687. if (k3 < face_skin.length) {
  1688. int ai4[] = face_skin[k3];
  1689. for (int l4 = 0; l4 < ai4.length; l4++) {
  1690. int i6 = ai4[l4];
  1691.  
  1692. alpha[i6] += x * 8;
  1693. if (alpha[i6] < 0)
  1694. alpha[i6] = 0;
  1695.  
  1696. if (alpha[i6] > 255)
  1697. alpha[i6] = 255;
  1698.  
  1699. }
  1700. }
  1701. }
  1702. }
  1703. }
  1704.  
  1705. public void method473() {
  1706. for (int point = 0; point < vertices; point++) {
  1707. int k = vertexX[point];
  1708. vertexX[point] = vertexZ[point];
  1709. vertexZ[point] = -k;
  1710. }
  1711. }
  1712.  
  1713. public void method474(int i) {
  1714. int k = SINE[i];
  1715. int l = COSINE[i];
  1716. for (int point = 0; point < vertices; point++) {
  1717. int j1 = vertexY[point] * l - vertexZ[point] * k >> 16;
  1718. vertexZ[point] = vertexY[point] * k + vertexZ[point] * l >> 16;
  1719. vertexY[point] = j1;
  1720. }
  1721. }
  1722.  
  1723. public void translate(int x, int y, int z) {
  1724. for (int point = 0; point < vertices; point++) {
  1725. vertexX[point] += x;
  1726. vertexY[point] += y;
  1727. vertexZ[point] += z;
  1728. }
  1729. }
  1730.  
  1731. public void recolor(int found, int replace) {
  1732. if(color != null) {
  1733. for (int face = 0; face < faces; face++) {
  1734. if (color[face] == (short) found)
  1735. color[face] = (short) replace;
  1736.  
  1737. }
  1738. }
  1739. }
  1740.  
  1741. public void retexture(short found, short replace) {
  1742. if(texture != null)
  1743. for (int face = 0; face < faces; face++) {
  1744. if (texture[face] == found) {
  1745. texture[face] = replace;
  1746. }
  1747. }
  1748.  
  1749. }
  1750.  
  1751. public void color_to_texture(int found, short tex) {
  1752.  
  1753. texture_faces = faces;
  1754. int set_type = 0;
  1755. if(render_type == null) {
  1756. render_type = new int[faces];
  1757. }
  1758. if(color == null) {
  1759. color = new short[faces];
  1760. }
  1761. if(color[faces] == -2) {
  1762. texture_edge_a = new short[faces];
  1763. texture_edge_b = new short[faces];
  1764. texture_edge_c = new short[faces];
  1765. for(int index = 0; index < faces; index++) {
  1766. if(color[index] != 0) {
  1767. color[index] = tex;
  1768. render_type[index] = 3 + set_type;
  1769. set_type += 4;
  1770. texture_edge_a[index] = (short) edge_a[index];
  1771. texture_edge_b[index] = (short) edge_b[index];
  1772. texture_edge_c[index] = (short) edge_c[index];
  1773. }
  1774. }
  1775. }
  1776.  
  1777. }
  1778.  
  1779. public void method477() {
  1780. for (int index = 0; index < vertices; index++)
  1781. vertexZ[index] = -vertexZ[index];
  1782.  
  1783. for (int face = 0; face < faces; face++) {
  1784. int l = edge_a[face];
  1785. edge_a[face] = edge_c[face];
  1786. edge_c[face] = l;
  1787. }
  1788. }
  1789.  
  1790. public void scale() {//fix 600+ model scaling
  1791. for (int index = 0; index < vertices; index++) {
  1792. vertexX[index] >>= 2;
  1793. vertexY[index] >>= 2;
  1794. vertexZ[index] >>= 2;
  1795. }
  1796. }
  1797.  
  1798. public void scale(int i, int j, int l) {//478
  1799. for (int index = 0; index < vertices; index++) {
  1800. vertexX[index] = (vertexX[index] * i) / 128;
  1801. vertexY[index] = (vertexY[index] * l) / 128;
  1802. vertexZ[index] = (vertexZ[index] * j) / 128;
  1803. }
  1804.  
  1805. }
  1806.  
  1807. public void light(int intensity, int mag, int x, int y, int z, boolean flat_shading) {
  1808. light(intensity, mag, x, y, z, flat_shading, false);
  1809. }
  1810.  
  1811. public void light(int intensity, int mag, int x, int y, int z, boolean flat_shading, boolean player) {
  1812. int pre_mag = (int) Math.sqrt(x * x + y * y + z * z);
  1813. int fall_off = mag * pre_mag >> 8;
  1814. hue_a = new int[faces];
  1815. hue_b = new int[faces];
  1816. hue_c = new int[faces];
  1817. if (super.aClass33Array1425 == null) {
  1818. super.aClass33Array1425 = new Vertex[vertices];
  1819. for (int index = 0; index < vertices; index++)
  1820. super.aClass33Array1425[index] = new Vertex();
  1821.  
  1822. }
  1823. for (int face = 0; face < faces; face++) {
  1824. int j2 = edge_a[face];
  1825. int l2 = edge_b[face];
  1826. int i3 = edge_c[face];
  1827. int j3 = vertexX[l2] - vertexX[j2];
  1828. int k3 = vertexY[l2] - vertexY[j2];
  1829. int l3 = vertexZ[l2] - vertexZ[j2];
  1830. int i4 = vertexX[i3] - vertexX[j2];
  1831. int j4 = vertexY[i3] - vertexY[j2];
  1832. int k4 = vertexZ[i3] - vertexZ[j2];
  1833. int l4 = k3 * k4 - j4 * l3;
  1834. int i5 = l3 * i4 - k4 * j3;
  1835. int j5;
  1836. for (j5 = j3 * j4 - i4 * k3; l4 > 8192 || i5 > 8192 || j5 > 8192 || l4 < -8192 || i5 < -8192 || j5 < -8192; j5 >>= 1) {
  1837. l4 >>= 1;
  1838. i5 >>= 1;
  1839. }
  1840. int k5 = (int) Math.sqrt(l4 * l4 + i5 * i5 + j5 * j5);
  1841. if (k5 <= 0)
  1842. k5 = 1;
  1843.  
  1844. l4 = (l4 * 256) / k5;
  1845. i5 = (i5 * 256) / k5;
  1846. j5 = (j5 * 256) / k5;
  1847.  
  1848. int type;
  1849. if(render_type == null)
  1850. type = 0;
  1851. else
  1852. type = render_type[face];
  1853.  
  1854. int transparent;
  1855. if(alpha == null)
  1856. transparent = 0;
  1857. else
  1858. transparent = alpha[face];
  1859.  
  1860. short texture_id;
  1861. if(texture == null)
  1862. texture_id = -1;
  1863. else
  1864. texture_id = texture[face];
  1865.  
  1866. if(transparent == -2) {
  1867. type = 3;
  1868. }
  1869. if(transparent == -1) {
  1870. type = 2;
  1871. }
  1872. if (render_type == null || (render_type[face] & 1) == 0) {
  1873. Vertex class33_2 = super.aClass33Array1425[j2];
  1874. class33_2.anInt602 += l4;
  1875. class33_2.anInt603 += i5;
  1876. class33_2.anInt604 += j5;
  1877. class33_2.anInt605++;
  1878. class33_2 = super.aClass33Array1425[l2];
  1879. class33_2.anInt602 += l4;
  1880. class33_2.anInt603 += i5;
  1881. class33_2.anInt604 += j5;
  1882. class33_2.anInt605++;
  1883. class33_2 = super.aClass33Array1425[i3];
  1884. class33_2.anInt602 += l4;
  1885. class33_2.anInt603 += i5;
  1886. class33_2.anInt604 += j5;
  1887. class33_2.anInt605++;
  1888. } else {
  1889. int light = intensity + (x * l4 + y * i5 + z * j5) / (fall_off + fall_off / 2);
  1890. if(texture_id != -1) {
  1891. if(type == 1) {
  1892. hue_a[face] = method481(light);
  1893. hue_c[face] = -1;
  1894. } else {
  1895. hue_c[face] = -2;
  1896. }
  1897. } else {
  1898. if(type != 0) {
  1899. if(type == 1) {
  1900. hue_a[face] = method481(color[face] & 0xffff, light);
  1901. hue_c[face] = -1;
  1902. } else if(type == 3) {
  1903. hue_a[face] = 128;
  1904. hue_c[face] = -1;
  1905. } else {
  1906. hue_a[face] = method481(color[face] & 0xffff, light);
  1907. hue_c[face] = -1;
  1908. }
  1909. } else {
  1910. hue_a[face] = method481(color[face] & 0xffff, light);
  1911. hue_c[face] = -1;
  1912. }
  1913. }
  1914. }
  1915. }
  1916. if (flat_shading) {
  1917. method480(intensity, fall_off, x, y, z, player);
  1918. } else {
  1919. gouraud_vertex = new Vertex[vertices];
  1920. for (int point = 0; point < vertices; point++) {
  1921. Vertex class33 = super.aClass33Array1425[point];
  1922. Vertex class33_1 = gouraud_vertex[point] = new Vertex();
  1923. class33_1.anInt602 = class33.anInt602;
  1924. class33_1.anInt603 = class33.anInt603;
  1925. class33_1.anInt604 = class33.anInt604;
  1926. class33_1.anInt605 = class33.anInt605;
  1927. }
  1928. }
  1929. if (flat_shading) {
  1930. method466();
  1931. return;
  1932. } else {
  1933. method468(21073);
  1934. return;
  1935. }
  1936. }
  1937.  
  1938. public final void method480(int intensity, int fall_off, int x, int y, int z) {
  1939. method480(intensity, fall_off, x, y, z, false);
  1940. }
  1941.  
  1942. public final void method480(int intensity, int fall_off, int x, int y, int z, boolean player) {
  1943. for (int face = 0; face < faces; face++) {
  1944. int a = edge_a[face];
  1945. int b = edge_b[face];
  1946. int c = edge_c[face];
  1947. short texture_id;
  1948. if(texture == null) {
  1949. texture_id = -1;
  1950. } else {
  1951. texture_id = texture[face];
  1952. if(player) {
  1953. //These checks are all important! - black triangle check
  1954. if(alpha != null && color != null) {
  1955. if(color[face] == 0 && render_priorities[face] == 0) {
  1956. if(render_type[face] == 2 && texture[face] == -1) {
  1957. alpha[face] = 255;
  1958. }
  1959. }
  1960. } else if(alpha == null) {
  1961. if(color[face] == 0 && render_priorities[face] == 0) {
  1962. if(texture[face] == -1) {
  1963. alpha = new int[faces];
  1964. if(render_type[face] == 2) {
  1965. alpha[face] = 255;
  1966. }
  1967. }
  1968. }
  1969. }
  1970. }
  1971. }
  1972. if (render_type == null) {
  1973. int hsl = color[face] & '\uffff';
  1974. Vertex vertex = super.aClass33Array1425[a];
  1975. int light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
  1976. hue_a[face] = method481(hsl, light, 0);
  1977. vertex = super.aClass33Array1425[b];
  1978. light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
  1979. hue_b[face] = method481(hsl, light, 0);
  1980. vertex = super.aClass33Array1425[c];
  1981. light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
  1982. hue_c[face] = method481(hsl, light, 0);
  1983. } else if ((render_type[face] & 1) == 0) {
  1984. int type = render_type[face];
  1985. int hsl = color[face] & '\uffff';
  1986. Vertex vertex = super.aClass33Array1425[a];
  1987. int light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
  1988. hue_a[face] = method481(hsl, light, type);
  1989. vertex = super.aClass33Array1425[b];
  1990. light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
  1991. hue_b[face] = method481(hsl, light, type);
  1992. vertex = super.aClass33Array1425[c];
  1993. light = intensity + (x * vertex.anInt602 + y * vertex.anInt603 + z * vertex.anInt604) / (fall_off * vertex.anInt605);
  1994. hue_c[face] = method481(hsl, light, type);
  1995. }
  1996. }
  1997. super.aClass33Array1425 = null;
  1998. gouraud_vertex = null;
  1999. vSkin = null;
  2000. tSkin = null;
  2001. if (render_type != null) {
  2002. for (int face = 0; face < faces; face++)
  2003. if ((render_type[face] & 2) == 2)
  2004. return;
  2005. }
  2006. color = null;
  2007. }
  2008.  
  2009. public static final int method481(int light) {
  2010. if(light >= 2) {
  2011. if(light > 126) {
  2012. light = 126;
  2013. }
  2014. } else {
  2015. light = 2;
  2016. }
  2017. return light;
  2018. }
  2019.  
  2020. public static final int method481(int hsl, int light) {
  2021. light = light * (hsl & 127) >> 7;
  2022. if(light < 2) {
  2023. light = 2;
  2024. } else if(light > 126) {
  2025. light = 126;
  2026. }
  2027. return (hsl & '\uff80') + light;
  2028. }
  2029.  
  2030. public static final int method481(int hsl, int light, int type) {
  2031. if ((type & 2) == 2)
  2032. return method481(light);
  2033.  
  2034. return method481(hsl, light);
  2035. }
  2036.  
  2037. //inventory / widget model rendering
  2038. public final void method482(int roll, int yaw, int pitch, int start_x, int start_y, int zoom) {
  2039. int depth = 0;
  2040. int center_x = Rasterizer.textureInt1;
  2041. int center_y = Rasterizer.textureInt2;
  2042. int depth_sin = SINE[depth];
  2043. int depth_cos = COSINE[depth];
  2044. int roll_sin = SINE[roll];
  2045. int roll_cos = COSINE[roll];
  2046. int yaw_sin = SINE[yaw];
  2047. int yaw_cos = COSINE[yaw];
  2048. int pitch_sin = SINE[pitch];
  2049. int pitch_cos = COSINE[pitch];
  2050. int position = start_y * pitch_sin + zoom * pitch_cos >> 16;
  2051. for (int index = 0; index < vertices; index++) {
  2052. int x = vertexX[index];
  2053. int y = vertexY[index];
  2054. int z = vertexZ[index];
  2055. if (yaw != 0) {
  2056. int k5 = y * yaw_sin + x * yaw_cos >> 16;
  2057. y = y * yaw_cos - x * yaw_sin >> 16;
  2058. x = k5;
  2059. }
  2060. if (depth != 0) {
  2061. int l5 = y * depth_cos - z * depth_sin >> 16;
  2062. z = y * depth_sin + z * depth_cos >> 16;
  2063. y = l5;
  2064. }
  2065. if (roll != 0) {
  2066. int i6 = z * roll_sin + x * roll_cos >> 16;
  2067. z = z * roll_cos - x * roll_sin >> 16;
  2068. x = i6;
  2069. }
  2070. x += start_x;
  2071. y += start_y;
  2072. z += zoom;
  2073.  
  2074. int j6 = y * pitch_cos - z * pitch_sin >> 16;
  2075. z = y * pitch_sin + z * pitch_cos >> 16;
  2076. y = j6;
  2077.  
  2078. anIntArray1667[index] = z - position;
  2079. vertex_viewpoint_z[index] = z;//was set to 0, changed to z?
  2080. vertex_viewpoint_x[index] = center_x + (x << 9) / z;
  2081. vertex_viewpoint_y[index] = center_y + (y << 9) / z;
  2082. if (texture_faces > 0) {
  2083. texture_viewpoint_x[index] = x;
  2084. texture_viewpoint_y[index] = y;
  2085. texture_viewpoint_z[index] = z;
  2086. }
  2087. }
  2088. try {
  2089. method483(false, false, false, 0, anInt1653, 0, -1, -1, -1, null);
  2090. return;
  2091. } catch (Exception _ex) {
  2092. return;
  2093. }
  2094. }
  2095.  
  2096. //Scene models
  2097. @Override
  2098. public final void method443(int orientation, int object_cosine_y, int object_sine_y, int object_sine_x, int object_cosine_x, int start_x, int start_y, int depth, long uid, ParticleEngine class108_sub2) {
  2099.  
  2100. this.method2593(orientation);
  2101.  
  2102. int j2 = depth * object_cosine_x - start_x * object_sine_x >> 16;
  2103. int k2 = start_y * object_cosine_y + j2 * object_sine_y >> 16;
  2104. int l2 = anInt1650 * object_sine_y >> 16;
  2105. int i3 = k2 + l2;
  2106. if (i3 <= 50 || k2 >= 3500)
  2107. return;
  2108.  
  2109. int j3 = depth * object_sine_x + start_x * object_cosine_x >> 16;
  2110. int k3 = j3 - anInt1650 << SceneGraph.viewDistance;
  2111. if (k3 / i3 >= Raster.center_y)
  2112. return;
  2113.  
  2114. int l3 = j3 + anInt1650 << SceneGraph.viewDistance;
  2115. if (l3 / i3 <= -Raster.center_y)
  2116. return;
  2117.  
  2118. int i4 = start_y * object_sine_y - j2 * object_cosine_y >> 16;
  2119. int j4 = anInt1650 * object_cosine_y >> 16;
  2120. int k4 = i4 + j4 << SceneGraph.viewDistance;
  2121. if (k4 / i3 <= -Raster.viewport_center_x)
  2122. return;
  2123.  
  2124. int l4 = j4 + (super.modelHeight * object_sine_y >> 16);
  2125. int i5 = i4 - l4 << SceneGraph.viewDistance;
  2126. if (i5 / i3 >= Raster.viewport_center_x)
  2127. return;
  2128.  
  2129. int j5 = l2 + (super.modelHeight * object_cosine_y >> 16);
  2130. boolean in_viewable_raster = false;//wrong
  2131. if (k2 - j5 <= 50)
  2132. in_viewable_raster = true;
  2133.  
  2134. boolean large_object = false;
  2135.  
  2136. if(class108_sub2 != null) {
  2137.  
  2138. }
  2139.  
  2140. int x;
  2141. int width;
  2142. int y;
  2143. int height;
  2144. int color;
  2145. int mouse_x;
  2146. int mouse_y;
  2147. if ((CubeList.draw_rect || CubeList.draw_cube) && uid > 0) {
  2148. int var39 = k2 - l2;
  2149. if (var39 <= 50) {
  2150. var39 = 50;
  2151. }
  2152. if (j3 > 0) {
  2153. x = k3 / i3;
  2154. width = l3 / var39;
  2155. } else {
  2156. width = l3 / i3;
  2157. x = k3 / var39;
  2158. }
  2159. if (i4 > 0) {
  2160. y = i5 / i3;
  2161. height = k4 / var39;
  2162. } else {
  2163. height = k4 / i3;
  2164. y = i5 / var39;
  2165. }
  2166. color = (CubeList.draw_rect ? -8355840 : -16776961);
  2167. mouse_x = anInt1685 - Rasterizer.textureInt1;
  2168. mouse_y = anInt1686 - Rasterizer.textureInt2;
  2169. if (mouse_x > x && mouse_x < width && mouse_y > y && mouse_y < height) {
  2170. color = (CubeList.draw_rect ? -256 : -65281);
  2171. }
  2172. if(CubeList.draw_rect)
  2173. RectangleNode.add(x + Rasterizer.textureInt1, y + Rasterizer.textureInt2, width + Rasterizer.textureInt1, height + Rasterizer.textureInt2, color);
  2174.  
  2175. if(CubeList.draw_cube) {
  2176. CubeNode.add(this, start_x, start_y, depth, color);
  2177. }
  2178. }
  2179.  
  2180. if (uid > 0 && objectExists) {
  2181. int k5 = k2 - l2;
  2182. if (k5 <= 50)
  2183. k5 = 50;
  2184. if (j3 > 0) {
  2185. k3 /= i3;
  2186. l3 /= k5;
  2187. } else {
  2188. l3 /= i3;
  2189. k3 /= k5;
  2190. }
  2191. if (i4 > 0) {
  2192. i5 /= i3;
  2193. k4 /= k5;
  2194. } else {
  2195. k4 /= i3;
  2196. i5 /= k5;
  2197. }
  2198. int i6 = anInt1685 - Rasterizer.textureInt1;
  2199. int k6 = anInt1686 - Rasterizer.textureInt2;
  2200. if (i6 > k3 && i6 < l3 && k6 > i5 && k6 < k4) {
  2201. if (fits_on_single_square) {
  2202. objectsInCurrentRegion[anInt1687++] = uid;
  2203. } else {
  2204. large_object = true;
  2205. }
  2206. }
  2207. }
  2208. int center_x = Rasterizer.textureInt1;
  2209. int center_y = Rasterizer.textureInt2;
  2210. int sine_x = 0;
  2211. int cosine_x = 0;
  2212. if (orientation != 0) {
  2213. sine_x = SINE[orientation];
  2214. cosine_x = COSINE[orientation];
  2215. }
  2216.  
  2217. for (int index = 0; index < vertices; index++) {
  2218. int raster_x = vertexX[index];
  2219. int raster_y = vertexY[index];
  2220. int raster_z = vertexZ[index];
  2221. if (orientation != 0) {
  2222. int rotated_x = raster_z * sine_x + raster_x * cosine_x >> 16;
  2223. raster_z = raster_z * cosine_x - raster_x * sine_x >> 16;
  2224. raster_x = rotated_x;
  2225. }
  2226. raster_x += start_x;
  2227. raster_y += start_y;
  2228. raster_z += depth;
  2229. int position = raster_z * object_sine_x + raster_x * object_cosine_x >> 16;
  2230. raster_z = raster_z * object_cosine_x - raster_x * object_sine_x >> 16;
  2231. raster_x = position;
  2232.  
  2233. position = raster_y * object_sine_y - raster_z * object_cosine_y >> 16;
  2234. raster_z = raster_y * object_cosine_y + raster_z * object_sine_y >> 16;
  2235. raster_y = position;
  2236.  
  2237. anIntArray1667[index] = raster_z - k2;
  2238. vertex_viewpoint_z[index] = raster_z;
  2239. if (raster_z >= 50) {
  2240. vertex_viewpoint_x[index] = center_x + (raster_x << SceneGraph.viewDistance) / raster_z;
  2241. vertex_viewpoint_y[index] = center_y + (raster_y << SceneGraph.viewDistance) / raster_z;
  2242. } else {
  2243. vertex_viewpoint_x[index] = -5000;
  2244. in_viewable_raster = true;
  2245. }
  2246. if (in_viewable_raster || texture_faces > 0) {
  2247. texture_viewpoint_x[index] = raster_x;
  2248. texture_viewpoint_y[index] = raster_y;
  2249. texture_viewpoint_z[index] = raster_z;
  2250. }
  2251. }
  2252. if (class108_sub2 != null) {
  2253. final int i_147_ = ParticleEngine.offsetX + center_x;
  2254. final int i_148_ = ParticleEngine.offsetY + center_y;
  2255. for (int i_149_ = 0; i_149_ < class108_sub2.aClass108_Sub3_Sub1Array2355.length; i_149_++) {
  2256. final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_149_];
  2257. if (class108_sub3_sub1 != null && !class108_sub3_sub1.aBoolean3097) {
  2258. int i_150_ = (class108_sub3_sub1.position_x >> 12) - Client.instance.absoluteX;
  2259. int i_151_ = (class108_sub3_sub1.position_y >> 12) - Client.instance.anchor;
  2260. int i_152_ = (class108_sub3_sub1.position_z >> 12) - Client.instance.absoluteY;
  2261. int i_153_ = i_152_ * object_sine_x + i_150_ * object_cosine_x >> 16;
  2262. i_152_ = i_152_ * object_cosine_x - i_150_ * object_sine_x >> 16;
  2263. i_150_ = i_153_;
  2264. i_153_ = i_151_ * object_sine_y - i_152_ * object_cosine_y >> 16;
  2265. i_152_ = i_151_ * object_cosine_y + i_152_ * object_sine_y >> 16;
  2266. i_151_ = i_153_;
  2267. if (i_152_ >= 50) {
  2268. anIntArray3812[i_149_] = i_147_ + (i_150_ << 9) / i_152_;
  2269. anIntArray3806[i_149_] = i_148_ + (i_151_ << 9) / i_152_;
  2270. anIntArray3834[i_149_] = i_152_;
  2271. anIntArray3821[i_149_] = i_152_ - k2;
  2272. } else {
  2273. anIntArray3821[i_149_] = -2147483648;
  2274. }
  2275. } else {
  2276. anIntArray3821[i_149_] = -2147483648;
  2277. }
  2278. }
  2279. }
  2280. try {
  2281. method483(in_viewable_raster, large_object, fits_on_single_square, uid, k2 - j5, orientation, start_x, start_y, depth, class108_sub2);
  2282. return;
  2283. } catch (Exception _ex) {
  2284. return;
  2285. }
  2286. }
  2287.  
  2288. private final void method483(boolean in_viewable_raster, boolean large_object, boolean loaded, long uid, int i, int orientation, int start_x, int start_y, int depth, final ParticleEngine class108_sub2) {
  2289. int i_11_ = 0;
  2290. int i_12_ = 0;
  2291. if (!aBoolean3833) {
  2292. for (int j = 0; j < anInt1652; j++) {
  2293. anIntArray1671[j] = 0;
  2294. }
  2295.  
  2296. for(int k = 0; k < 32; k++) {
  2297. anIntArray3815[k] = 0;
  2298. }
  2299. anInt3814 = 0;
  2300. }
  2301.  
  2302. int var5 = loaded ? 20 : 5;
  2303. if(CubeList.draw_vertices && large_object) {
  2304. RectangleNode.method4817(this, var5);
  2305. }
  2306.  
  2307. for (int face = 0; face < faces; face++) {
  2308. if (render_type == null || render_type[face] != -1) {
  2309. int a = edge_a[face];
  2310. int b = edge_b[face];
  2311. int c = edge_c[face];
  2312. int x_a = vertex_viewpoint_x[a];
  2313. int x_b = vertex_viewpoint_x[b];
  2314. int x_c = vertex_viewpoint_x[c];
  2315. if (in_viewable_raster && (x_a == -5000 || x_b == -5000 || x_c == -5000)) {
  2316. scale_textures[face] = true;
  2317. int j5 = (anIntArray1667[a] + anIntArray1667[b] + anIntArray1667[c]) / 3 + anInt1653;
  2318. if(anIntArray1671[j5] < 64) {
  2319. anIntArrayArray1672[j5][anIntArray1671[j5]++] = face;
  2320. } else {
  2321. int i_35_ = anIntArray1671[j5];
  2322. if (i_35_ == 64) {
  2323. if (anInt3814 == 512) {
  2324. continue;
  2325. }
  2326. anIntArray1671[j5] = i_35_ = 65 + anInt3814++;
  2327. }
  2328. i_35_ -= 65;
  2329. anIntArrayArray3809[i_35_][anIntArray3815[i_35_]++] = face;
  2330. }
  2331. } else {
  2332. if (large_object && method486(anInt1685, anInt1686, vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c], x_a, x_b, x_c)) {
  2333. objectsInCurrentRegion[anInt1687++] = uid;
  2334. large_object = false;
  2335. }
  2336. if ((x_a - x_b) * (vertex_viewpoint_y[c] - vertex_viewpoint_y[b]) - (vertex_viewpoint_y[a] - vertex_viewpoint_y[b]) * (x_c - x_b) > 0) {
  2337. scale_textures[face] = false;
  2338. if (x_a < 0 || x_b < 0 || x_c < 0 || x_a > Raster.center_x || x_b > Raster.center_x || x_c > Raster.center_x)
  2339. aBooleanArray1663[face] = true;
  2340. else
  2341. aBooleanArray1663[face] = false;
  2342.  
  2343. int k5 = (anIntArray1667[a] + anIntArray1667[b] + anIntArray1667[c]) / 3 + anInt1653;
  2344. if(anIntArray1671[k5] < 64) {
  2345. anIntArrayArray1672[k5][anIntArray1671[k5]++] = face;
  2346. } else {
  2347. int k6 = anIntArray1671[k5];
  2348. if(k6 == 64) {
  2349. if(anInt3814 == 512)
  2350. continue;
  2351.  
  2352. anIntArray1671[face] = k6 = 65 + anInt3814++;
  2353. }
  2354. k6 -= 65;
  2355. anIntArrayArray3809[k6][anIntArray3815[k6]++] = face;
  2356. }
  2357.  
  2358. }
  2359. }
  2360. }
  2361. }
  2362. if (class108_sub2 != null && !aBoolean3833) {
  2363. int i_38_ = 0;
  2364. for (/**/; i_38_ < anIntArray3821.length; i_38_++) {
  2365. final int i_39_ = anIntArray3821[i_38_] + i;
  2366. if (i_39_ >= 0 && i_39_ < 1600) {
  2367. if (anIntArray1671[i_39_] < 64) {
  2368. anIntArrayArray1672[i_39_][anIntArray1671[i_39_]++] = i_38_ + 1 << 16;
  2369. } else {
  2370. int i_40_ = anIntArray1671[i_39_];
  2371. if (i_40_ == 64) {
  2372. if (anInt3814 == 512) {
  2373. continue;
  2374. }
  2375. anIntArray1671[i_39_] = i_40_ = 65 + anInt3814++;
  2376. }
  2377. i_40_ -= 65;
  2378. anIntArrayArray3809[i_40_][anIntArray3815[i_40_]++] = i_38_ + 1 << 16;
  2379. }
  2380. }
  2381. }
  2382. }
  2383. if (render_priorities == null) {
  2384. for (int i1 = anInt1652 - 1; i1 >= 0; i1--) {
  2385. int l1 = anIntArray1671[i1];
  2386. if (l1 > 0) {
  2387. final int i_50_ = l1 > 64 ? 64 : l1;
  2388. int ai[] = anIntArrayArray1672[i1];
  2389. for (int j3 = 0; j3 < i_50_; j3++) {
  2390. final int i_52_ = ai[j3];
  2391. if(i_52_ < 65536) {
  2392. render_textures(ai[j3]);
  2393. } else {
  2394. final int i_53_ = (i_52_ >> 16) - 1;
  2395. final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_53_];
  2396. int i_54_ = anIntArray3834[i_53_] * 400;
  2397. if (i_54_ == 0) {
  2398. i_54_ = 1;
  2399. }
  2400. Raster.drawAlphaCircle(anIntArray3812[i_53_], anIntArray3806[i_53_], (class108_sub3_sub1.particle_emitter.emitterType.size << 16) / i_54_, class108_sub3_sub1.color, class108_sub3_sub1.color >> 24 & 0xff);
  2401. }
  2402. }
  2403.  
  2404. }
  2405. if (l1 > 64) {
  2406. final int i_55_ = anIntArray1671[i1] - 64 - 1;
  2407. int ai[] = anIntArrayArray3809[i_55_];
  2408. for (int j3 = 0; j3 < anIntArray3815[i_55_]; j3++) {
  2409. final int i_57_ = ai[j3];
  2410. if(i_57_ < 65536)
  2411. render_textures(ai[j3]);
  2412. else {
  2413. final int i_58_ = (i_57_ >> 16) - 1;
  2414. final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_58_];
  2415. int i_59_ = anIntArray3834[i_58_] * 400;
  2416. if (i_59_ == 0) {
  2417. i_59_ = 1;
  2418. }
  2419. Raster.drawAlphaCircle(anIntArray3812[i_58_], anIntArray3806[i_58_], (class108_sub3_sub1.particle_emitter.emitterType.size << 16) / i_59_, class108_sub3_sub1.color, class108_sub3_sub1.color >> 24 & 0xff);
  2420. }
  2421. }
  2422. }
  2423. }
  2424. return;
  2425. }
  2426.  
  2427. for (int j1 = 0; j1 < 12; j1++) {
  2428. anIntArray1673[j1] = 0;
  2429. anIntArray1677[j1] = 0;
  2430. }
  2431. for (int i2 = anInt1652 - 1; i2 >= 0; i2--) {
  2432. int k2 = anIntArray1671[i2];
  2433. if (k2 > 0) {
  2434. int i_63_;
  2435. if (k2 > 64) {
  2436. i_63_ = 64;
  2437. } else {
  2438. i_63_ = k2;
  2439. }
  2440. int ai1[] = anIntArrayArray1672[i2];
  2441. for (int i4 = 0; i4 < i_63_; i4++) {
  2442. int l4 = ai1[i4];
  2443. if(l4 < 65536) {
  2444. byte l5 = render_priorities[l4];
  2445. int j6 = anIntArray1673[l5]++;
  2446. anIntArrayArray1674[l5][j6] = l4;
  2447. if (l5 < 10)
  2448. anIntArray1677[l5] += i2;
  2449. else if (l5 == 10)
  2450. anIntArray1675[j6] = i2;
  2451. else
  2452. anIntArray1676[j6] = i2;
  2453. } else {
  2454. anIntArray3818[i_12_++] = (l4 >> 16) - 1;
  2455. }
  2456.  
  2457. }
  2458. }
  2459. if(k2 > 64) {
  2460. final int i_68_ = anIntArray1671[i2] - 64 - 1;
  2461. final int[] is = anIntArrayArray3809[i_68_];
  2462. for (int i_69_ = 0; i_69_ < anIntArray3815[i_68_]; i_69_++) {
  2463. final int i_70_ = is[i_69_];
  2464. if (i_70_ < 65536) {
  2465. final byte i_71_ = render_priorities[i_70_];
  2466. final int i_72_ = anIntArray1673[i_71_]++;
  2467. anIntArrayArray1674[i_71_][i_72_] = i_70_;
  2468. if (i_71_ < 10) {
  2469. anIntArray1677[i_71_] += i2;
  2470. } else if (i_71_ == 10) {
  2471. anIntArray1675[i_72_] = i2;
  2472. } else {
  2473. anIntArray1676[i_72_] = i2;
  2474. }
  2475. } else {
  2476. anIntArray3818[i_12_++] = (i_70_ >> 16) - 1;
  2477. }
  2478. }
  2479. }
  2480.  
  2481. }
  2482.  
  2483. int l2 = 0;
  2484. if (anIntArray1673[1] > 0 || anIntArray1673[2] > 0)
  2485. l2 = (anIntArray1677[1] + anIntArray1677[2]) / (anIntArray1673[1] + anIntArray1673[2]);
  2486. int k3 = 0;
  2487. if (anIntArray1673[3] > 0 || anIntArray1673[4] > 0)
  2488. k3 = (anIntArray1677[3] + anIntArray1677[4]) / (anIntArray1673[3] + anIntArray1673[4]);
  2489. int j4 = 0;
  2490. if (anIntArray1673[6] > 0 || anIntArray1673[8] > 0)
  2491. j4 = (anIntArray1677[6] + anIntArray1677[8]) / (anIntArray1673[6] + anIntArray1673[8]);
  2492.  
  2493. int i6 = 0;
  2494. int k6 = anIntArray1673[10];
  2495. int ai2[] = anIntArrayArray1674[10];
  2496. int ai3[] = anIntArray1675;
  2497. int i_79_ = 0;
  2498. if (i6 == k6) {
  2499. i6 = 0;
  2500. k6 = anIntArray1673[11];
  2501. ai2 = anIntArrayArray1674[11];
  2502. ai3 = anIntArray1676;
  2503. }
  2504. int i5;
  2505. if (i6 < k6)
  2506. i5 = ai3[i6];
  2507. else
  2508. i5 = -1000;
  2509.  
  2510. for (int l6 = 0; l6 < 10; l6++) {
  2511. while (l6 == 0 && i5 > l2) {
  2512. render_textures(ai2[i6++]);
  2513. if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
  2514. i6 = 0;
  2515. k6 = anIntArray1673[11];
  2516. ai2 = anIntArrayArray1674[11];
  2517. ai3 = anIntArray1676;
  2518. }
  2519. if (i6 < k6)
  2520. i5 = ai3[i6];
  2521. else
  2522. i5 = -1000;
  2523. }
  2524. while (l6 == 3 && i5 > k3) {
  2525. render_textures(ai2[i6++]);
  2526. if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
  2527. i6 = 0;
  2528. k6 = anIntArray1673[11];
  2529. ai2 = anIntArrayArray1674[11];
  2530. ai3 = anIntArray1676;
  2531. }
  2532. if (i6 < k6)
  2533. i5 = ai3[i6];
  2534. else
  2535. i5 = -1000;
  2536. }
  2537. while (l6 == 5 && i5 > j4) {
  2538. render_textures(ai2[i6++]);
  2539. if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
  2540. i6 = 0;
  2541. k6 = anIntArray1673[11];
  2542. ai2 = anIntArrayArray1674[11];
  2543. ai3 = anIntArray1676;
  2544. }
  2545. if (i6 < k6)
  2546. i5 = ai3[i6];
  2547. else
  2548. i5 = -1000;
  2549. }
  2550. int i7 = anIntArray1673[l6];
  2551. int ai4[] = anIntArrayArray1674[l6];
  2552. if(class108_sub2 != null) {
  2553. int i_84_ = 2147483647;
  2554. if (i7 != 0) {
  2555. i_84_ = anIntArray1677[l6] / i7;
  2556. }
  2557. for (int i_85_ = anIntArray3818[i_79_]; anIntArray3821[i_85_] + i > i_84_; i_85_ = anIntArray3818[i_79_++]) {
  2558. final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_85_];
  2559. int i_86_ = anIntArray3834[i_85_] * 400;
  2560. if (i_86_ == 0) {
  2561. i_86_ = 1;
  2562. }
  2563. Raster.drawAlphaCircle(anIntArray3812[i_85_], anIntArray3806[i_85_], (class108_sub3_sub1.particle_emitter.emitterType.size << 16) / i_86_, class108_sub3_sub1.color, class108_sub3_sub1.color >> 24 & 0xff);
  2564. if (i_79_ >= i_12_) {
  2565. break;
  2566. }
  2567. }
  2568. }
  2569.  
  2570. for (int j7 = 0; j7 < i7; j7++)
  2571. render_textures(ai4[j7]);
  2572.  
  2573. }
  2574. while (i5 != -1000) {
  2575. render_textures(ai2[i6++]);
  2576. if (i6 == k6 && ai2 != anIntArrayArray1674[11]) {
  2577. i6 = 0;
  2578. ai2 = anIntArrayArray1674[11];
  2579. k6 = anIntArray1673[11];
  2580. ai3 = anIntArray1676;
  2581. }
  2582. if (i6 < k6)
  2583. i5 = ai3[i6];
  2584. else
  2585. i5 = -1000;
  2586. }
  2587.  
  2588. if (class108_sub2 != null) {
  2589. int i_88_ = anIntArray3818[i_79_];
  2590. while (i_79_ < i_12_) {
  2591. final ParticleHandler class108_sub3_sub1 = class108_sub2.aClass108_Sub3_Sub1Array2355[i_88_];
  2592. int i_89_ = anIntArray3834[i_88_] * 400;
  2593. if (i_89_ == 0) {
  2594. i_89_ = 1;
  2595. }
  2596. Raster.drawAlphaCircle(anIntArray3812[i_88_], anIntArray3806[i_88_], (class108_sub3_sub1.particle_emitter.emitterType.size << 16) / i_89_, class108_sub3_sub1.color, class108_sub3_sub1.color >> 24 & 0xff);
  2597. i_88_ = anIntArray3818[i_79_++];
  2598. }
  2599. }
  2600.  
  2601.  
  2602. /*int sine = 0;
  2603. int cosine = 0;
  2604. if(orientation != 0) {
  2605. sine = SINE[orientation];
  2606. cosine = COSINE[orientation];
  2607. }
  2608. for(int point = 0; point < vertices; point++) {
  2609. int particle_id = particle_vertices[point] - 1;
  2610. if(particle_id < 0)
  2611. continue;
  2612.  
  2613. ParticleDefinition def = ParticleDefinition.cache[particle_id];
  2614. int raster_x = vertexX[point];
  2615. int raster_y = vertexY[point];
  2616. int raster_z = vertexZ[point];
  2617. int buffer = vertex_viewpoint_z[point];
  2618. if(orientation != 0) {
  2619. int rotated_offset = raster_z * sine + raster_x * cosine >> 16;
  2620. raster_z = raster_z * cosine - raster_x * sine >> 16;
  2621. raster_x = rotated_offset;
  2622. }
  2623. raster_x += (start_x + Client.instance.absoluteX);
  2624. //raster_y += (start_y + Client.instance.anchor);
  2625. raster_z += (depth + Client.instance.absoluteY);
  2626. Vector pos = new Vector(raster_x, -raster_y, raster_z);
  2627. for(int alive = 0; alive < def.getSpawnRate(); alive++) {
  2628. Particle particle = new Particle(def, pos, buffer, particle_id);
  2629. Client.instance.addParticle(particle);
  2630. }
  2631.  
  2632. }*/
  2633. }
  2634.  
  2635. private final void render_textures(int face) {
  2636. if (scale_textures[face]) {
  2637. render_viewport_textures(face);
  2638. return;
  2639. }
  2640. int a = edge_a[face];
  2641. int b = edge_b[face];
  2642. int c = edge_c[face];
  2643. Rasterizer.aBoolean1462 = aBooleanArray1663[face];
  2644. if (alpha == null)
  2645. Rasterizer.anInt1465 = 0;
  2646. else
  2647. Rasterizer.anInt1465 = alpha[face] & 0xff;
  2648.  
  2649. int type;
  2650. if (render_type == null)
  2651. type = 0;
  2652. else
  2653. type = render_type[face] & 3;
  2654.  
  2655. if(texture != null && texture[face] != -1) {
  2656. int texture_a = a;
  2657. int texture_b = b;
  2658. int texture_c = c;
  2659. if(texture_coordinates != null && texture_coordinates[face] != -1) {
  2660. int coordinate = texture_coordinates[face] & 0xff;
  2661. texture_a = texture_edge_a[coordinate];
  2662. texture_b = texture_edge_b[coordinate];
  2663. texture_c = texture_edge_c[coordinate];
  2664. }
  2665. if(hue_c[face] == -1) {
  2666. Rasterizer.drawTexturedTriangle(
  2667. vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c],
  2668. vertex_viewpoint_x[a], vertex_viewpoint_x[b], vertex_viewpoint_x[c],
  2669. hue_a[face], hue_a[face], hue_a[face],
  2670. texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
  2671. texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
  2672. texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
  2673. texture[face],
  2674. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2675. } else {
  2676. Rasterizer.drawTexturedTriangle(
  2677. vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c],
  2678. vertex_viewpoint_x[a], vertex_viewpoint_x[b],vertex_viewpoint_x[c],
  2679. hue_a[face], hue_b[face], hue_c[face],
  2680. texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
  2681. texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
  2682. texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
  2683. texture[face],
  2684. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2685. }
  2686. } else if(hue_c[face] == -1) {
  2687. Rasterizer.drawFlatTriangle1(
  2688. vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c],
  2689. vertex_viewpoint_x[a], vertex_viewpoint_x[b], vertex_viewpoint_x[c],
  2690. modelIntArray3[hue_a[face]],
  2691. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2692. } else {
  2693. if (type == 0) {
  2694. Rasterizer.drawShadedTriangle(
  2695. vertex_viewpoint_y[a], vertex_viewpoint_y[b], vertex_viewpoint_y[c],
  2696. vertex_viewpoint_x[a], vertex_viewpoint_x[b], vertex_viewpoint_x[c],
  2697. hue_a[face], hue_b[face], hue_c[face],
  2698. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2699. }
  2700. }
  2701. }
  2702.  
  2703. private final void render_viewport_textures(int face) {
  2704. int center_x = Rasterizer.textureInt1;
  2705. int center_y = Rasterizer.textureInt2;
  2706. int l = 0;
  2707. int a = edge_a[face];
  2708. int b = edge_b[face];
  2709. int c = edge_c[face];
  2710. int l1 = texture_viewpoint_z[a];
  2711. int i2 = texture_viewpoint_z[b];
  2712. int j2 = texture_viewpoint_z[c];
  2713. if (l1 >= 50) {
  2714. anIntArray1678[l] = vertex_viewpoint_x[a];
  2715. anIntArray1679[l] = vertex_viewpoint_y[a];
  2716. anIntArray1680[l++] = hue_a[face];
  2717. } else {
  2718. int k2 = texture_viewpoint_x[a];
  2719. int k3 = texture_viewpoint_y[a];
  2720. int k4 = hue_a[face];
  2721. if (j2 >= 50) {
  2722. int k5 = (50 - l1) * modelIntArray4[j2 - l1];
  2723. anIntArray1678[l] = center_x + (k2 + ((texture_viewpoint_x[c] - k2) * k5 >> 16) << SceneGraph.viewDistance) / 50;
  2724. anIntArray1679[l] = center_y + (k3 + ((texture_viewpoint_y[c] - k3) * k5 >> 16) << SceneGraph.viewDistance) / 50;
  2725. anIntArray1680[l++] = k4 + ((hue_c[face] - k4) * k5 >> 16);
  2726. }
  2727. if (i2 >= 50) {
  2728. int l5 = (50 - l1) * modelIntArray4[i2 - l1];
  2729. anIntArray1678[l] = center_x + (k2 + ((texture_viewpoint_x[b] - k2) * l5 >> 16) << SceneGraph.viewDistance) / 50;
  2730. anIntArray1679[l] = center_y + (k3 + ((texture_viewpoint_y[b] - k3) * l5 >> 16) << SceneGraph.viewDistance) / 50;
  2731. anIntArray1680[l++] = k4 + ((hue_b[face] - k4) * l5 >> 16);
  2732. }
  2733. }
  2734. if (i2 >= 50) {
  2735. anIntArray1678[l] = vertex_viewpoint_x[b];
  2736. anIntArray1679[l] = vertex_viewpoint_y[b];
  2737. anIntArray1680[l++] = hue_b[face];
  2738. } else {
  2739. int l2 = texture_viewpoint_x[b];
  2740. int l3 = texture_viewpoint_y[b];
  2741. int l4 = hue_b[face];
  2742. if (l1 >= 50) {
  2743. int i6 = (50 - i2) * modelIntArray4[l1 - i2];
  2744. anIntArray1678[l] = center_x + (l2 + ((texture_viewpoint_x[a] - l2) * i6 >> 16) << SceneGraph.viewDistance) / 50;
  2745. anIntArray1679[l] = center_y + (l3 + ((texture_viewpoint_y[a] - l3) * i6 >> 16) << SceneGraph.viewDistance) / 50;
  2746. anIntArray1680[l++] = l4 + ((hue_a[face] - l4) * i6 >> 16);
  2747. }
  2748. if (j2 >= 50) {
  2749. int j6 = (50 - i2) * modelIntArray4[j2 - i2];
  2750. anIntArray1678[l] = center_x + (l2 + ((texture_viewpoint_x[c] - l2) * j6 >> 16) << SceneGraph.viewDistance) / 50;
  2751. anIntArray1679[l] = center_y + (l3 + ((texture_viewpoint_y[c] - l3) * j6 >> 16) << SceneGraph.viewDistance) / 50;
  2752. anIntArray1680[l++] = l4 + ((hue_c[face] - l4) * j6 >> 16);
  2753. }
  2754. }
  2755. if (j2 >= 50) {
  2756. anIntArray1678[l] = vertex_viewpoint_x[c];
  2757. anIntArray1679[l] = vertex_viewpoint_y[c];
  2758. anIntArray1680[l++] = hue_c[face];
  2759. } else {
  2760. int i3 = texture_viewpoint_x[c];
  2761. int i4 = texture_viewpoint_y[c];
  2762. int i5 = hue_c[face];
  2763. if (i2 >= 50) {
  2764. int k6 = (50 - j2) * modelIntArray4[i2 - j2];
  2765. anIntArray1678[l] = center_x + (i3 + ((texture_viewpoint_x[b] - i3) * k6 >> 16) << SceneGraph.viewDistance) / 50;
  2766. anIntArray1679[l] = center_y + (i4 + ((texture_viewpoint_y[b] - i4) * k6 >> 16) << SceneGraph.viewDistance) / 50;
  2767. anIntArray1680[l++] = i5 + ((hue_b[face] - i5) * k6 >> 16);
  2768. }
  2769. if (l1 >= 50) {
  2770. int l6 = (50 - j2) * modelIntArray4[l1 - j2];
  2771. anIntArray1678[l] = center_x + (i3 + ((texture_viewpoint_x[a] - i3) * l6 >> 16) << SceneGraph.viewDistance) / 50;
  2772. anIntArray1679[l] = center_y + (i4 + ((texture_viewpoint_y[a] - i4) * l6 >> 16) << SceneGraph.viewDistance) / 50;
  2773. anIntArray1680[l++] = i5 + ((hue_a[face] - i5) * l6 >> 16);
  2774. }
  2775. }
  2776. int y_a = anIntArray1678[0];
  2777. int y_b = anIntArray1678[1];
  2778. int y_c = anIntArray1678[2];
  2779. int x_a = anIntArray1679[0];
  2780. int x_b = anIntArray1679[1];
  2781. int x_c = anIntArray1679[2];
  2782. if ((y_a - y_b) * (x_c - x_b) - (x_a - x_b) * (y_c - y_b) > 0) {
  2783. Rasterizer.aBoolean1462 = false;
  2784. int texture_a = a;
  2785. int texture_b = b;
  2786. int texture_c = c;
  2787. if (l == 3) {
  2788. if (y_a < 0 || y_b < 0 || y_c < 0 || y_a > Raster.center_x || y_b > Raster.center_x || y_c > Raster.center_x)
  2789. Rasterizer.aBoolean1462 = true;
  2790.  
  2791. int type;
  2792. if (render_type == null)
  2793. type = 0;
  2794. else
  2795. type = render_type[face] & 3;
  2796.  
  2797. if(texture != null && texture[face] != -1) {
  2798. if(texture_coordinates != null && texture_coordinates[face] != -1) {
  2799. int coordinate = texture_coordinates[face] & 0xff;
  2800. texture_a = texture_edge_a[coordinate];
  2801. texture_b = texture_edge_b[coordinate];
  2802. texture_c = texture_edge_c[coordinate];
  2803. }
  2804. if(hue_c[face] == -1) {
  2805. Rasterizer.drawTexturedTriangle(
  2806. x_a, x_b, x_c,
  2807. y_a, y_b, y_c,
  2808. hue_a[face], hue_a[face], hue_a[face],
  2809. texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
  2810. texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
  2811. texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
  2812. texture[face],
  2813. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2814. } else {
  2815. Rasterizer.drawTexturedTriangle(
  2816. x_a, x_b, x_c,
  2817. y_a, y_b, y_c,
  2818. anIntArray1680[0], anIntArray1680[1], anIntArray1680[2],
  2819. texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
  2820. texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
  2821. texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
  2822. texture[face],
  2823. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2824. }
  2825. } else if(hue_c[face] == -1) {
  2826. Rasterizer.drawFlatTriangle(x_a, x_b, x_c, y_a, y_b, y_c, modelIntArray3[hue_a[face]], -1f, -1f, -1f);
  2827. } else {
  2828. if (type == 0) {
  2829. Rasterizer.drawShadedTriangle(x_a, x_b, x_c, y_a, y_b, y_c, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2], -1f, -1f, -1f);
  2830. }
  2831. }
  2832.  
  2833.  
  2834. }
  2835. if (l == 4) {
  2836. if (y_a < 0 || y_b < 0 || y_c < 0 || y_a > Raster.center_x || y_b > Raster.center_x || y_c > Raster.center_x || anIntArray1678[3] < 0 || anIntArray1678[3] > Raster.center_x)
  2837. Rasterizer.aBoolean1462 = true;
  2838. int type;
  2839. if (render_type == null)
  2840. type = 0;
  2841. else
  2842. type = render_type[face] & 3;
  2843.  
  2844. if(texture != null && texture[face] != -1) {
  2845. if(texture_coordinates != null && texture_coordinates[face] != -1) {
  2846. int coordinate = texture_coordinates[face] & 0xff;
  2847. texture_a = texture_edge_a[coordinate];
  2848. texture_b = texture_edge_b[coordinate];
  2849. texture_c = texture_edge_c[coordinate];
  2850. }
  2851. if(hue_c[face] == -1) {
  2852. Rasterizer.drawTexturedTriangle(
  2853. x_a, x_b, x_c,
  2854. y_a, y_b, y_c,
  2855. hue_a[face], hue_a[face], hue_a[face],
  2856. texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
  2857. texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
  2858. texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
  2859. texture[face],
  2860. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2861. Rasterizer.drawTexturedTriangle(
  2862. x_a, x_c, anIntArray1679[3],
  2863. y_a, y_c, anIntArray1678[3],
  2864. hue_a[face], hue_a[face], hue_a[face],
  2865. texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
  2866. texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
  2867. texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
  2868. texture[face],
  2869. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2870. } else {
  2871. Rasterizer.drawTexturedTriangle(
  2872. x_a, x_b, x_c,
  2873. y_a, y_b, y_c,
  2874. anIntArray1680[0], anIntArray1680[1], anIntArray1680[2],
  2875. texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
  2876. texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
  2877. texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
  2878. texture[face],
  2879. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2880. Rasterizer.drawTexturedTriangle(
  2881. x_a, x_c, anIntArray1679[3],
  2882. y_a, y_c, anIntArray1678[3],
  2883. anIntArray1680[0], anIntArray1680[2], anIntArray1680[3],
  2884. texture_viewpoint_x[texture_a], texture_viewpoint_x[texture_b], texture_viewpoint_x[texture_c],
  2885. texture_viewpoint_y[texture_a], texture_viewpoint_y[texture_b], texture_viewpoint_y[texture_c],
  2886. texture_viewpoint_z[texture_a], texture_viewpoint_z[texture_b], texture_viewpoint_z[texture_c],
  2887. texture[face],
  2888. vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2889. return;
  2890. }
  2891. } else if(hue_c[face] == -1) {
  2892. int l8 = modelIntArray3[hue_a[face]];
  2893. Rasterizer.drawFlatTriangle(x_a, x_b, x_c, y_a, y_b, y_c, l8, -1f, -1f, -1f);
  2894. Rasterizer.drawFlatTriangle(x_a, x_c, anIntArray1679[3], y_a, y_c, anIntArray1678[3], l8, vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2895. return;
  2896. } else {
  2897. if (type == 0) {
  2898. Rasterizer.drawShadedTriangle(x_a, x_b, x_c, y_a, y_b, y_c, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2], -1f, -1f, -1f);
  2899. Rasterizer.drawShadedTriangle(x_a, x_c, anIntArray1679[3], y_a, y_c, anIntArray1678[3], anIntArray1680[0], anIntArray1680[2], anIntArray1680[3], vertex_viewpoint_z[a], vertex_viewpoint_z[b], vertex_viewpoint_z[c]);
  2900. return;
  2901. }
  2902. }
  2903.  
  2904. }
  2905. }
  2906. }
  2907.  
  2908. private final boolean method486(int i, int j, int k, int l, int i1, int x_a, int x_b, int x_c) {
  2909. if (j < k && j < l && j < i1)
  2910. return false;
  2911. if (j > k && j > l && j > i1)
  2912. return false;
  2913. if (i < x_a && i < x_b && i < x_c)
  2914. return false;
  2915. return i <= x_a || i <= x_b || i <= x_c;
  2916. }
  2917.  
  2918. //*Added*//
  2919. public short[] texture;//face_material
  2920. public byte[] texture_coordinates;//face_texture
  2921. public byte[] texture_type;//texture_map
  2922.  
  2923. public int[] particle_vertices;
  2924.  
  2925. //*Default*//
  2926. private boolean aBoolean1618;
  2927. public static int anInt1620;
  2928. public static Model EMPTY_MODEL = new Model(true);
  2929. private static int anIntArray1622[] = new int[2000];
  2930. private static int anIntArray1623[] = new int[2000];
  2931. private static int anIntArray1624[] = new int[2000];
  2932. private static int anIntArray1625[] = new int[2000];
  2933. public int vertices;
  2934. public int vertexX[];
  2935. public int vertexY[];
  2936. public int vertexZ[];
  2937. public int faces;
  2938. public int edge_a[];
  2939. public int edge_b[];
  2940. public int edge_c[];
  2941. public int hue_a[];
  2942. public int hue_b[];
  2943. public int hue_c[];
  2944. public int render_type[];
  2945. public byte render_priorities[];
  2946. public int alpha[];
  2947. public short color[];
  2948. public byte priority = 0;
  2949. public int texture_faces;
  2950. public short texture_edge_a[];//texture_edge_p
  2951. public short texture_edge_b[];//texture_edge_m
  2952. public short texture_edge_c[];//texture_edge_n
  2953. public int anInt1646;
  2954. public int anInt1647;
  2955. public int anInt1648;
  2956. public int anInt1649;
  2957. public int anInt1650;
  2958. public int anInt1651;
  2959. public int anInt1652;
  2960. public int anInt1653;
  2961. public int anInt1654;
  2962. public int vSkin[];//bone_skin
  2963. public int tSkin[];//muscle_skin
  2964. public int vertex_skin[][];
  2965. public int face_skin[][];
  2966. public boolean fits_on_single_square;
  2967. public Vertex gouraud_vertex[];
  2968. static ModelHeader header[];
  2969. static Provider resourceProvider;
  2970. static boolean aBooleanArray1663[] = new boolean[4700];
  2971. static boolean scale_textures[] = new boolean[4700];
  2972. static int vertex_viewpoint_x[] = new int[4700];
  2973. static int vertex_viewpoint_y[] = new int[4700];
  2974. static int vertex_viewpoint_z[] = new int[4700];
  2975. static int anIntArray1667[] = new int[4700];
  2976. static int texture_viewpoint_x[] = new int[4700];
  2977. static int texture_viewpoint_y[] = new int[4700];
  2978. static int texture_viewpoint_z[] = new int[4700];
  2979. static int anIntArray1671[] = new int[1600];//1500
  2980. static int anIntArrayArray1672[][] = new int[1600][64];//1500 / 512 //anIntArrayArray3809
  2981. static int anIntArray1673[] = new int[12];
  2982. static int anIntArrayArray1674[][] = new int[12][2000];//1500
  2983. static int anIntArray1676[] = new int[2000];//1500
  2984. static int anIntArray1675[] = new int[2000];//1500
  2985. static int anIntArray1677[] = new int[12];
  2986. static int anIntArray1678[] = new int[10];
  2987. static int anIntArray1679[] = new int[10];
  2988. static int anIntArray1680[] = new int[10];
  2989. static int anInt1681;
  2990. static int anInt1682;
  2991. static int anInt1683;
  2992. public static boolean objectExists;
  2993. public static int anInt1685;
  2994. public static int anInt1686;
  2995. public static int anInt1687;
  2996. public static long objectsInCurrentRegion[] = new long[1000];
  2997. public static int SINE[];
  2998. public static int COSINE[];
  2999. static int modelIntArray3[];
  3000. static int modelIntArray4[];
  3001.  
  3002.  
  3003.  
  3004. static final void method2395() {
  3005. aBoolean3833 = false;
  3006. anIntArray3826 = null;
  3007. anIntArray3810 = null;
  3008. anIntArray3832 = new int[1600];
  3009. anIntArrayArray3813 = new int[1600][64];
  3010. anIntArray3815 = new int[32];
  3011. anIntArrayArray3809 = new int[32][512];
  3012. }
  3013.  
  3014. static final void method2404() {
  3015. aBoolean3833 = true;
  3016. anIntArray3826 = new int[4096];
  3017. anIntArray3810 = new int[4096];
  3018. anIntArray3832 = null;
  3019. anIntArrayArray3813 = null;
  3020. anIntArray3815 = null;
  3021. anIntArrayArray3809 = null;
  3022. }
  3023.  
  3024. private static int anInt3814;
  3025. private static boolean aBoolean3833;//tile_particle
  3026. private static int[] anIntArray3826;
  3027. private static int[] anIntArray3810;
  3028. private static int[] anIntArray3832;
  3029. private static int[][] anIntArrayArray3813;
  3030. private static int[] anIntArray3815;
  3031. private static int[][] anIntArrayArray3809;
  3032. ModelParticleEmitter[] aClass158Array3788;
  3033. ModelParticleMagnet[] aClass169Array3776;
  3034.  
  3035. private static int[] anIntArray3812;
  3036. private static int[] anIntArray3806;
  3037. private static int[] anIntArray3834;
  3038. private static int[] anIntArray3821;
  3039. private static int[] anIntArray3818;
  3040.  
  3041. static {
  3042. SINE = Rasterizer.SINE;
  3043. COSINE = Rasterizer.COSINE;
  3044. modelIntArray3 = Rasterizer.anIntArray1482;
  3045. modelIntArray4 = Rasterizer.anIntArray1469;
  3046.  
  3047. anInt3814 = 0;
  3048. aBoolean3833 = false;
  3049. if (aBoolean3833) {
  3050. anIntArray3826 = new int[4096];
  3051. anIntArray3810 = new int[4096];
  3052. } else {
  3053. anIntArray3832 = new int[1600];
  3054. anIntArrayArray3813 = new int[1600][64];
  3055. anIntArray3815 = new int[32];
  3056. anIntArrayArray3809 = new int[32][512];
  3057. }
  3058. anIntArray3812 = new int[8192];
  3059. anIntArray3806 = new int[8192];
  3060. anIntArray3834 = new int[8192];
  3061. anIntArray3821 = new int[8192];
  3062. anIntArray3818 = new int[8192];
  3063. }
  3064.  
  3065.  
  3066. public int field1944;
  3067. public int field1947;
  3068. public int field1963;
  3069. public int field1948;
  3070. public int field1946;
  3071. public int field1924;
  3072.  
  3073.  
  3074.  
  3075.  
  3076. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement