Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 90.07 KB | None | 0 0
  1. package com.graardor.client.world;
  2.  
  3. import com.graardor.Configuration;
  4. import com.graardor.client.Client;
  5. import com.graardor.client.VertexNormal;
  6. import com.graardor.client.accounts.LocalSettings;
  7. import com.graardor.client.cache.node.Deque;
  8. import com.graardor.client.graphics.Raster;
  9. import com.graardor.client.renderable.Animable;
  10.  
  11. public final class WorldController {
  12.  
  13. private static boolean isClicked;
  14.  
  15. private static boolean[][] TILE_VISIBILITY_MAP;
  16.  
  17. private static byte TILE_DRAW_DISTANCE = 25;
  18.  
  19. public void setDrawDistance(int distance) {
  20. TILE_DRAW_DISTANCE = (byte) distance;
  21. TILE_VISIBILITY_MAPS = new boolean[8][32][(TILE_DRAW_DISTANCE << 1) | 1][(TILE_DRAW_DISTANCE << 1) | 1];
  22. }
  23.  
  24. private static boolean[][][][] TILE_VISIBILITY_MAPS = new boolean[8][32][(TILE_DRAW_DISTANCE << 1) | 1][(TILE_DRAW_DISTANCE << 1) | 1];
  25.  
  26. private static Deque aClass19_477 = new Deque();
  27.  
  28. private static InteractiveObject[] interactiveObjects = new InteractiveObject[100];
  29.  
  30. private static final CullingCluster[] processed_culling_clusters = new CullingCluster[500];
  31. private static CullingCluster[][] cullingClusters;
  32. private static int anInt446;
  33. private static int plane;
  34. private static int anInt448;
  35. private static int anInt449;
  36. private static int anInt450;
  37. private static int anInt451;
  38. private static int anInt452;
  39. private static int xCameraPositionTile;
  40. private static int yCameraPositionTile;
  41. private static int xCameraPosition;
  42. private static int zCameraPosition;
  43. private static int yCameraPosition;
  44. private static int yCurveSine;
  45. private static int yCurveCosine;
  46. private static int xCurveSine;
  47. private static int xCurveCosine;
  48. private static int anInt468;
  49. private static int anInt469;
  50. public static int clickedTileX = -1;
  51. public static int clickedTileY = -1;
  52. private static final int anInt472;
  53. private static int processed_culling_clusters_ptr;
  54. private static int anInt493;
  55. private static int anInt494;
  56. private static int anInt495;
  57. private static int anInt496;
  58. private static int anInt497;
  59. private static int anInt498;
  60. private static final int[] anIntArray463 = { 53, -53, -53, 53 };
  61. private static final int[] anIntArray464 = { -53, -53, 53, 53 };
  62. private static final int[] anIntArray465 = { -45, 45, 45, -45 };
  63. private static final int[] anIntArray466 = { 45, 45, -45, -45 };
  64. private static int[] cullingClusterPointer;
  65. private static final int[] anIntArray478 = { 19, 55, 38, 155, 255, 110,
  66. 137, 205, 76 };
  67. private static final int[] anIntArray479 = { 160, 192, 80, 96, 0, 144, 80,
  68. 48, 160 };
  69. private static final int[] anIntArray480 = { 76, 8, 137, 4, 0, 1, 38, 2, 19 };
  70. private static final int[] anIntArray481 = { 0, 0, 2, 0, 0, 2, 1, 1, 0 };
  71. private static final int[] anIntArray482 = { 2, 0, 0, 2, 0, 0, 0, 4, 4 };
  72. private static final int[] anIntArray483 = { 0, 4, 4, 8, 0, 0, 8, 0, 0 };
  73. private static final int[] anIntArray484 = { 1, 1, 0, 0, 0, 8, 0, 0, 8 };
  74. private static final int[] textureRGBColour = { 41, 39248, 41, 4643, 41, 41,
  75. 41, 41, 41, 41, 41, 41, 41, 41, 41, 43086, 41, 41, 41, 41, 41, 41,
  76. 41, 8602, 41, 28992, 41, 41, 41, 41, 41, 5056, 41, 41, 41, 7079,
  77. 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 3131, 41, 41, 41,
  78.  
  79. 41, 39248, 41, 4643, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 43086,
  80. 41, 41, 41, 41, 41, 41, 41, 8602, 41, 28992, 41, 41, 41, 41, 41, 5056, 41, 41, 41, 7079, 41, 41, 41, 41, 41,
  81. 41, 41, 41, 41, 41, 3131, 41, 41, 41};
  82. public static boolean lowDetail = true;
  83. static {
  84. anInt472 = 4;
  85. cullingClusterPointer = new int[anInt472];
  86. cullingClusters = new CullingCluster[anInt472][500];
  87. }
  88.  
  89. static void createCullingCluster(int z, int lowest_x, int lowest_z, int highest_x, int highest_y, int highest_z, int lowest_y, int search_mask) {
  90. CullingCluster cullingCluster = new CullingCluster();
  91. cullingCluster.tileStartX = lowest_x / 128;
  92. cullingCluster.tileEndX = highest_x / 128;
  93. cullingCluster.tileStartY = lowest_y / 128;
  94. cullingCluster.tileEndY = highest_y / 128;
  95. cullingCluster.searchMask = search_mask;
  96. cullingCluster.worldStartX = lowest_x;
  97. cullingCluster.worldEndX = highest_x;
  98. cullingCluster.worldStartY = lowest_y;
  99. cullingCluster.worldEndY = highest_y;
  100. cullingCluster.worldStartZ = highest_z;
  101. cullingCluster.worldEndZ = lowest_z;
  102. cullingClusters[z][cullingClusterPointer[z]++] = cullingCluster;
  103. }
  104.  
  105. public static void method310(int i, int j, int k, int l, int ai[]) {
  106. anInt495 = 0;
  107. anInt496 = 0;
  108. anInt497 = k;
  109. anInt498 = l;
  110. anInt493 = k / 2;
  111. anInt494 = l / 2;
  112. boolean aflag[][][][] = new boolean[9][32][(TILE_DRAW_DISTANCE << 1) + 3][(TILE_DRAW_DISTANCE << 1) + 3];
  113. for (int i1 = 128; i1 <= 384; i1 += 32) {
  114. for (int j1 = 0; j1 < 2048; j1 += 64) {
  115. yCurveSine = Model.SINE[i1];
  116. yCurveCosine = Model.COSINE[i1];
  117. xCurveSine = Model.SINE[j1];
  118. xCurveCosine = Model.COSINE[j1];
  119. int l1 = (i1 - 128) / 32;
  120. int j2 = j1 / 64;
  121. for (int l2 = -TILE_DRAW_DISTANCE - 1; l2 <= TILE_DRAW_DISTANCE + 1; l2++) {
  122. for (int j3 = -TILE_DRAW_DISTANCE - 1; j3 <= TILE_DRAW_DISTANCE + 1; j3++) {
  123. int k3 = l2 * 128;
  124. int i4 = j3 * 128;
  125. boolean flag2 = false;
  126. for (int k4 = -i; k4 <= j; k4 += 128) {
  127. if (!tileIsVisible(ai[l1] + k4, i4, k3)) {
  128. continue;
  129. }
  130. flag2 = true;
  131. break;
  132. }
  133.  
  134. aflag[l1][j2][l2 + TILE_DRAW_DISTANCE + 1][j3 + TILE_DRAW_DISTANCE + 1] = flag2;
  135. }
  136.  
  137. }
  138.  
  139. }
  140.  
  141. }
  142.  
  143. for (int k1 = 0; k1 < 8; k1++) {
  144. for (int i2 = 0; i2 < 32; i2++) {
  145. for (int k2 = -TILE_DRAW_DISTANCE; k2 < TILE_DRAW_DISTANCE; k2++) {
  146. for (int i3 = -TILE_DRAW_DISTANCE; i3 < TILE_DRAW_DISTANCE; i3++) {
  147. boolean flag1 = false;
  148. label0: for (int l3 = -1; l3 <= 1; l3++) {
  149. for (int j4 = -1; j4 <= 1; j4++) {
  150. if (aflag[k1][i2][k2 + l3 + TILE_DRAW_DISTANCE + 1][i3 + j4 + TILE_DRAW_DISTANCE + 1]) {
  151. flag1 = true;
  152. } else if (aflag[k1][(i2 + 1) % 31][k2 + l3 + TILE_DRAW_DISTANCE + 1][i3 + j4 + TILE_DRAW_DISTANCE + 1]) {
  153. flag1 = true;
  154. } else if (aflag[k1 + 1][i2][k2 + l3 + TILE_DRAW_DISTANCE + 1][i3 + j4 + TILE_DRAW_DISTANCE + 1]) {
  155. flag1 = true;
  156. } else {
  157. if (!aflag[k1 + 1][(i2 + 1) % 31][k2 + l3 + TILE_DRAW_DISTANCE + 1][i3 + j4 + TILE_DRAW_DISTANCE + 1]) {
  158. continue;
  159. }
  160.  
  161. flag1 = true;
  162. }
  163.  
  164. break label0;
  165. }
  166. }
  167.  
  168. TILE_VISIBILITY_MAPS[k1][i2][k2 + TILE_DRAW_DISTANCE][i3 + TILE_DRAW_DISTANCE] = flag1;
  169. }
  170. }
  171. }
  172. }
  173. }
  174.  
  175. private static boolean tileIsVisible(int i, int j, int k) {
  176. int l = j * xCurveSine + k * xCurveCosine >> 16;
  177. int i1 = j * xCurveCosine - k * xCurveSine >> 16;
  178. int j1 = i * yCurveSine + i1 * yCurveCosine >> 16;
  179. int k1 = i * yCurveCosine - i1 * yCurveSine >> 16;
  180.  
  181. if(j1 < Configuration.CAM_NEAR || j1 > (Configuration.INCREASED_RENDER_DISTANCE ? 7000 : Configuration.CAM_FAR)) {
  182. return false;
  183. }
  184.  
  185. int l1 = anInt493 + (l << Client.log_view_dist) / j1;
  186. int i2 = anInt494 + (k1 << Client.log_view_dist) / j1;
  187. return l1 >= anInt495 && l1 <= anInt497 && i2 >= anInt496 && i2 <= anInt498;
  188. }
  189.  
  190. public static void nullify() {
  191. interactiveObjects = null;
  192. cullingClusterPointer = null;
  193. cullingClusters = null;
  194. aClass19_477 = null;
  195. TILE_VISIBILITY_MAPS = null;
  196. TILE_VISIBILITY_MAP = null;
  197. }
  198.  
  199. private boolean aBoolean434;
  200. private final int zMapSize;
  201. private final int xMapSize;
  202. private final int yMapSize;
  203. private int currentHL;
  204. private int anInt488;
  205. private final int[] anIntArray486;
  206. private final int[] anIntArray487;
  207. private final int[][] tileShapePoints = { new int[16],
  208. { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
  209. { 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1 },
  210. { 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
  211. { 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1 },
  212. { 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
  213. { 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
  214. { 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 },
  215. { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 },
  216. { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1 },
  217. { 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
  218. { 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1 },
  219. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1 } };
  220. private final int[][] tileShapeIndices = {
  221. { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
  222. { 12, 8, 4, 0, 13, 9, 5, 1, 14, 10, 6, 2, 15, 11, 7, 3 },
  223. { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
  224. { 3, 7, 11, 15, 2, 6, 10, 14, 1, 5, 9, 13, 0, 4, 8, 12 } };
  225. private final int[][][] heightmap;
  226. private final int[][][] anIntArrayArrayArray445;
  227. private final Tile[][][] tileArray;
  228. private final InteractiveObject[] interactiveObjectCache;
  229. private int interactableObjectCacheCurrPos;
  230.  
  231. public WorldController(int heightmap[][][]) {
  232. int i = 104;// was parameter
  233. int j = 104;// was parameter
  234. int k = 4;// was parameter
  235. aBoolean434 = true;
  236. interactiveObjectCache = new InteractiveObject[5000];
  237. anIntArray486 = new int[10000];
  238. anIntArray487 = new int[10000];
  239. zMapSize = k;
  240. xMapSize = j;
  241. yMapSize = i;
  242. tileArray = new Tile[k][j][i];
  243. anIntArrayArrayArray445 = new int[k][j + 1][i + 1];
  244. this.heightmap = heightmap;
  245. reset();
  246. }
  247.  
  248. public void clearObj5Cache() {
  249. for (int i = 0; i < interactableObjectCacheCurrPos; i++) {
  250. InteractiveObject object5 = interactiveObjectCache[i];
  251. remove(object5);
  252. interactiveObjectCache[i] = null;
  253. }
  254. interactableObjectCacheCurrPos = 0;
  255. }
  256.  
  257. public void reset() {
  258. for (int j = 0; j < zMapSize; j++) {
  259. for (int k = 0; k < xMapSize; k++) {
  260. for (int i1 = 0; i1 < yMapSize; i1++) {
  261. tileArray[j][k][i1] = null;
  262. }
  263.  
  264. }
  265.  
  266. }
  267. for (int l = 0; l < anInt472; l++) {
  268. for (int j1 = 0; j1 < cullingClusterPointer[l]; j1++) {
  269. cullingClusters[l][j1] = null;
  270. }
  271.  
  272. cullingClusterPointer[l] = 0;
  273. }
  274.  
  275. for (int k1 = 0; k1 < interactableObjectCacheCurrPos; k1++) {
  276. interactiveObjectCache[k1] = null;
  277. }
  278.  
  279. interactableObjectCacheCurrPos = 0;
  280. for (int l1 = 0; l1 < interactiveObjects.length; l1++) {
  281. interactiveObjects[l1] = null;
  282. }
  283.  
  284. }
  285.  
  286. public void fill(int i) {
  287. currentHL = i;
  288. for (int k = 0; k < xMapSize; k++) {
  289. for (int l = 0; l < yMapSize; l++) {
  290. if (tileArray[i][k][l] == null) {
  291. tileArray[i][k][l] = new Tile(i, k, l);
  292. }
  293. }
  294. }
  295. }
  296.  
  297. void applyBridgeMode(int y, int x) {
  298. Tile level0_tile = tileArray[0][x][y];
  299. for (int l = 0; l < 3; l++) {
  300. Tile tile = tileArray[l][x][y] = tileArray[l + 1][x][y];
  301. if (tile != null) {
  302. tile.tileZ--;
  303. for (int j1 = 0; j1 < tile.entityCount; j1++) {
  304. InteractiveObject worldEntity = tile.interactiveObjects[j1];
  305. if ((worldEntity.uid >> 29 & 3) == 2 && worldEntity.tileLeft == x && worldEntity.tileTop == y) {
  306. worldEntity.zPos--;
  307. }
  308. }
  309. }
  310. }
  311.  
  312. if (tileArray[0][x][y] == null) {
  313. tileArray[0][x][y] = new Tile(0, x, y);
  314. }
  315.  
  316. tileArray[0][x][y].tileBelow0 = level0_tile;
  317. tileArray[3][x][y] = null;
  318. }
  319.  
  320. void setTileLogicHeight(int z, int x, int y, int l_z) {
  321. Tile tile = tileArray[z][x][y];
  322.  
  323. if (tile != null) {
  324. tileArray[z][x][y].logicHeight = l_z;
  325. }
  326. }
  327.  
  328. void addTile(int zz, int x, int y, int shape, int i1, int overlaytex, int underlaytex, int zA, int zB, int zD, int zC, int colourA, int colourB, int colourD, int colourC, int colourAA, int colourBA, int colourDA, int colourCA, int cRGB2, int RGBA, boolean tex) {
  329. if (shape == 0) {
  330. PlainTile plainTile = new PlainTile(colourA, colourB, colourD, colourC, underlaytex > Rasterizer.TEXTURE_COUNT ? -1 : underlaytex, cRGB2, false, tex);
  331.  
  332. for (int i5 = zz; i5 >= 0; i5--) {
  333. if (tileArray[i5][x][y] == null) {
  334. tileArray[i5][x][y] = new Tile(i5, x, y);
  335. }
  336. }
  337.  
  338. tileArray[zz][x][y].myPlainTile = plainTile;
  339. return;
  340. }
  341.  
  342. if (shape == 1) {
  343. PlainTile plainTile_1 = new PlainTile(colourAA, colourBA, colourDA, colourCA, overlaytex > Rasterizer.TEXTURE_COUNT ? -1 : overlaytex, RGBA, zA == zB && zA == zD && zA == zC, tex);
  344.  
  345. for (int z = zz; z >= 0; z--) {
  346. if (tileArray[z][x][y] == null) {
  347. tileArray[z][x][y] = new Tile(z, x, y);
  348. }
  349. }
  350.  
  351. tileArray[zz][x][y].myPlainTile = plainTile_1;
  352. return;
  353. }
  354.  
  355. ShapedTile shapedTile = new ShapedTile(y, colourAA, colourC, zD, overlaytex, underlaytex, colourDA, i1, colourA, cRGB2, colourD, zC, zB, zA, shape, colourCA, colourBA, colourB, x, RGBA, tex);
  356.  
  357. for (int z = zz; z >= 0; z--) {
  358. if (tileArray[z][x][y] == null) {
  359. tileArray[z][x][y] = new Tile(z, x, y);
  360. }
  361. }
  362.  
  363. tileArray[zz][x][y].shapedTile = shapedTile;
  364. }
  365.  
  366. void addGroundDecoration(int Z, int z3d, int Y, Animable jagexNode, byte byte0, int i1, int X, int id) {
  367. if (jagexNode == null) {
  368. return;
  369. }
  370.  
  371. GroundDecoration groundDecoration = new GroundDecoration();
  372. groundDecoration.aClass30_Sub2_Sub4_814 = jagexNode;
  373. groundDecoration.xPos = (X * 128) + 64;
  374. groundDecoration.yPos = (Y * 128) + 64;
  375. groundDecoration.zPos = z3d;
  376. groundDecoration.uid = i1;
  377. groundDecoration.id = id;
  378. groundDecoration.objConf = byte0;
  379. if (tileArray[Z][X][Y] == null)
  380. tileArray[Z][X][Y] = new Tile(Z, X, Y);
  381.  
  382. tileArray[Z][X][Y].groundDecoration = groundDecoration;
  383. }
  384.  
  385. public void addGroundItemTile(int x, int j, Animable secondGroundItem, int k, Animable thirdGroundItem, Animable firstGroundItem, int z, int y) {
  386. GroundItemTile itemTile = new GroundItemTile();
  387. itemTile.firstGroundItem = firstGroundItem;
  388. itemTile.xPos = x * 128 + 64;
  389. itemTile.yPos = y * 128 + 64;
  390. itemTile.zPos = k;
  391. itemTile.uid = j;
  392. itemTile.secondGroundItem = secondGroundItem;
  393. itemTile.thirdGroundItem = thirdGroundItem;
  394. int j1 = 0;
  395. Tile class30_sub3 = tileArray[z][x][y];
  396.  
  397. if (class30_sub3 != null) {
  398. for (int k1 = 0; k1 < class30_sub3.entityCount; k1++) {
  399. if (class30_sub3.interactiveObjects[k1].jagexNode instanceof Model) {
  400. int l1 = ((Model) class30_sub3.interactiveObjects[k1].jagexNode).anInt1654;
  401. if (l1 > j1) {
  402. j1 = l1;
  403. }
  404. }
  405. }
  406. }
  407.  
  408. itemTile.anInt52 = j1;
  409.  
  410. if (tileArray[z][x][y] == null) {
  411. tileArray[z][x][y] = new Tile(z, x, y);
  412. }
  413.  
  414. tileArray[z][x][y].groundItemTile = itemTile;
  415. }
  416.  
  417. void addWallObject(int i, Animable jagexNode, int j, int y, byte byte0, int x, Animable jagexNode2, int i1, int j1, int zz, int var) {
  418. if (jagexNode == null && jagexNode2 == null) {
  419. return;
  420. }
  421.  
  422. WallObject wallObject = new WallObject();
  423. wallObject.uid = j;
  424. wallObject.setNewUID(var);
  425. wallObject.objConf = byte0;
  426. wallObject.xPos = x * 128 + 64;
  427. wallObject.yPos = y * 128 + 64;
  428. wallObject.zPos = i1;
  429. wallObject.node1 = jagexNode;
  430. wallObject.node2 = jagexNode2;
  431. wallObject.orientation = i;
  432. wallObject.orientation1 = j1;
  433. for (int z = zz; z >= 0; z--) {
  434. if (tileArray[z][x][y] == null) {
  435. tileArray[z][x][y] = new Tile(z, x, y);
  436. }
  437. }
  438.  
  439. tileArray[zz][x][y].wallObject = wallObject;
  440. }
  441.  
  442. void addWallDecoration(int i, int y, int face, int z, int x3dOff, int k1, Animable jagexNode, int x, byte byte0, int y3dOff, int facebits) {
  443. if (jagexNode == null) {
  444. return;
  445. }
  446.  
  447. WallDecoration wallDecoration = new WallDecoration();
  448. wallDecoration.uid = i;
  449. wallDecoration.objConf = byte0;
  450. wallDecoration.xPos = x * 128 + 64 + x3dOff;
  451. wallDecoration.yPos = y * 128 + 64 + y3dOff;
  452. wallDecoration.zPos = k1;
  453. wallDecoration.myMob = jagexNode;
  454. wallDecoration.configBits = facebits;
  455. wallDecoration.face = face;
  456. for (int zz = z; zz >= 0; zz--) {
  457. if (tileArray[zz][x][y] == null) {
  458. tileArray[zz][x][y] = new Tile(zz, x, y);
  459. }
  460. }
  461.  
  462. tileArray[z][x][y].wallDecoration = wallDecoration;
  463. }
  464.  
  465. boolean addEntityB(int i, byte byte0, int j, int k, Animable entity, int l, int i1, int j1, int k1, int l1, int var) {
  466. if (entity == null) {
  467. return true;
  468. } else {
  469. int i2 = l1 * 128 + 64 * l;
  470. int j2 = k1 * 128 + 64 * k;
  471. return addEntityC(i1, l1, k1, l, k, i2, j2, j, entity, j1, false, i, byte0, var);
  472. }
  473. }
  474.  
  475. public boolean addEntityA(int plane, int rotation, int drawHeight, int l, int boundExtentY, int j1, int boundExtentX, Animable npc, boolean flag) {
  476. if (npc == null) {
  477. return true;
  478. }
  479. int x = boundExtentX - j1;
  480. int y = boundExtentY - j1;
  481. int j2 = boundExtentX + j1;
  482. int k2 = boundExtentY + j1;
  483. if (flag) {
  484. if (rotation > 640 && rotation < 1408) {
  485. k2 += 128;
  486. }
  487. if (rotation > 1152 && rotation < 1920) {
  488. j2 += 128;
  489. }
  490. if (rotation > 1664 || rotation < 384) {
  491. y -= 128;
  492. }
  493. if (rotation > 128 && rotation < 896) {
  494. x -= 128;
  495. }
  496. }
  497. x /= 128;
  498. y /= 128;
  499. j2 /= 128;
  500. k2 /= 128;
  501. return addEntityC(plane, x, y, j2 - x + 1, k2 - y + 1, boundExtentX, boundExtentY, drawHeight, npc, rotation, true, l, (byte) 0, 0);
  502. }
  503.  
  504. public boolean addEntity(int j, int k, Animable class30_sub2_sub4, int l, int i1, int j1, int k1, int l1, int i2, int j2, int k2) {
  505. return class30_sub2_sub4 == null || addEntityC(j, l1, k2, i2 - l1 + 1, i1 - k2 + 1, j1, k, k1, class30_sub2_sub4, l, true, j2, (byte) 0, 0);
  506. }
  507.  
  508. private boolean addEntityC(int z, int x, int y, int tileHeight, int tileWidth, int worldX, int worldY, int worldZ, Animable jagexNode, int rotation, boolean flag, int j2, byte byte0, int var) {
  509. for (int _x = x; _x < x + tileHeight; _x++) {
  510. for (int _y = y; _y < y + tileWidth; _y++) {
  511. if (_x < 0 || _y < 0 || _x >= xMapSize || _y >= yMapSize) {
  512. return false;
  513. }
  514. Tile class30_sub3 = tileArray[z][_x][_y];
  515. if (class30_sub3 != null && class30_sub3.entityCount >= 5) {
  516. return false;
  517. }
  518. }
  519.  
  520. }
  521.  
  522. InteractiveObject interactiveObject = new InteractiveObject();
  523. interactiveObject.uid = j2;
  524. interactiveObject.setNewUID(var);
  525. interactiveObject.objConf = byte0;
  526. interactiveObject.zPos = z;
  527. interactiveObject.worldX = worldX;
  528. interactiveObject.worldY = worldY;
  529. interactiveObject.worldZ = worldZ;
  530. interactiveObject.jagexNode = jagexNode;
  531. interactiveObject.rotation = rotation;
  532. interactiveObject.tileLeft = x;
  533. interactiveObject.tileTop = y;
  534. interactiveObject.tileRight = x + tileHeight - 1;
  535. interactiveObject.tileBottom = y + tileWidth - 1;
  536. for (int _x = x; _x < x + tileHeight; _x++) {
  537. for (int j3 = y; j3 < y + tileWidth; j3++) {
  538. int k3 = 0;
  539. if (_x > x) {
  540. k3++;
  541. }
  542. if (_x < x + tileHeight - 1) {
  543. k3 += 4;
  544. }
  545. if (j3 > y) {
  546. k3 += 8;
  547. }
  548. if (j3 < y + tileWidth - 1) {
  549. k3 += 2;
  550. }
  551. for (int l3 = z; l3 >= 0; l3--) {
  552. if (tileArray[l3][_x][j3] == null) {
  553. tileArray[l3][_x][j3] = new Tile(l3, _x, j3);
  554. }
  555. }
  556.  
  557. Tile class30_sub3_1 = tileArray[z][_x][j3];
  558. class30_sub3_1.interactiveObjects[class30_sub3_1.entityCount] = interactiveObject;
  559. class30_sub3_1.anIntArray1319[class30_sub3_1.entityCount] = k3;
  560. class30_sub3_1.anInt1320 |= k3;
  561. class30_sub3_1.entityCount++;
  562. }
  563.  
  564. }
  565.  
  566. if (flag) {
  567. interactiveObjectCache[interactableObjectCacheCurrPos++] = interactiveObject;
  568. }
  569. return true;
  570. }
  571.  
  572. private void remove(InteractiveObject interactiveObject) {
  573. for (int j = interactiveObject.tileLeft; j <= interactiveObject.tileRight; j++) {
  574. for (int k = interactiveObject.tileTop; k <= interactiveObject.tileBottom; k++) {
  575. Tile class30_sub3 = tileArray[interactiveObject.zPos][j][k];
  576. if (class30_sub3 != null) {
  577. for (int l = 0; l < class30_sub3.entityCount; l++) {
  578. if (class30_sub3.interactiveObjects[l] != interactiveObject) {
  579. continue;
  580. }
  581. class30_sub3.entityCount--;
  582. for (int i1 = l; i1 < class30_sub3.entityCount; i1++) {
  583. class30_sub3.interactiveObjects[i1] = class30_sub3.interactiveObjects[i1 + 1];
  584. class30_sub3.anIntArray1319[i1] = class30_sub3.anIntArray1319[i1 + 1];
  585. }
  586.  
  587. class30_sub3.interactiveObjects[class30_sub3.entityCount] = null;
  588. break;
  589. }
  590.  
  591. class30_sub3.anInt1320 = 0;
  592. for (int j1 = 0; j1 < class30_sub3.entityCount; j1++) {
  593. class30_sub3.anInt1320 |= class30_sub3.anIntArray1319[j1];
  594. }
  595. }
  596. }
  597. }
  598. }
  599.  
  600. void method290(int i, int k, int l, int i1) {
  601. Tile tile = tileArray[i1][l][i];
  602.  
  603. if (tile == null) {
  604. return;
  605. }
  606.  
  607. WallDecoration class26 = tile.wallDecoration;
  608.  
  609. if (class26 != null) {
  610. int j1 = l * 128 + 64;
  611. int k1 = i * 128 + 64;
  612. class26.xPos = j1 + (class26.xPos - j1) * k / 16;
  613. class26.yPos = k1 + (class26.yPos - k1) * k / 16;
  614. }
  615. }
  616.  
  617. public void removeWallObject(int x, int z, int y, byte byte0) {
  618. Tile tile = tileArray[z][x][y];
  619.  
  620. if (byte0 != -119) {
  621. aBoolean434 = !aBoolean434;
  622. }
  623.  
  624. if (tile != null) {
  625. tile.wallObject = null;
  626. }
  627. }
  628.  
  629. public void removeWallDecoration(int y, int z, int x) {
  630. Tile tile = tileArray[z][x][y];
  631. if (tile != null) {
  632. tile.wallDecoration = null;
  633. }
  634. }
  635.  
  636. public void method293(int i, int k, int l) {
  637. Tile tile = tileArray[i][k][l];
  638. if (tile == null) {
  639. return;
  640. }
  641.  
  642. for (int j1 = 0; j1 < tile.entityCount; j1++) {
  643. InteractiveObject interactiveObject = tile.interactiveObjects[j1];
  644.  
  645. if ((interactiveObject.uid >> 29 & 3) == 2 && interactiveObject.tileLeft == k && interactiveObject.tileTop == l) {
  646. remove(interactiveObject);
  647. return;
  648. }
  649. }
  650. }
  651.  
  652. public void removeGroundDecoration(int z, int y, int x) {
  653. Tile tile = tileArray[z][x][y];
  654. if (tile == null) {
  655. return;
  656. }
  657.  
  658. tile.groundDecoration = null;
  659. }
  660.  
  661. public void removeGroundItemTile(int z, int x, int y) {
  662. Tile tile = tileArray[z][x][y];
  663. if (tile != null) {
  664. tile.groundItemTile = null;
  665. }
  666. }
  667.  
  668. public WallObject getWallObject(int z, int x, int y) {
  669. Tile tile = tileArray[z][x][y];
  670. if (tile == null) {
  671. return null;
  672. } else {
  673. return tile.wallObject;
  674. }
  675. }
  676.  
  677. public WallDecoration getWallDecoration(int x, int y, int z) {
  678. Tile tile = tileArray[z][x][y];
  679. if (tile == null) {
  680. return null;
  681. } else {
  682. return tile.wallDecoration;
  683. }
  684. }
  685.  
  686. public InteractiveObject getInteractableObject(int x, int y, int z) {
  687. Tile tile = tileArray[z][x][y];
  688. if (tile == null) {
  689. return null;
  690. }
  691.  
  692. for (int l = 0; l < tile.entityCount; l++) {
  693. InteractiveObject interactiveObject = tile.interactiveObjects[l];
  694.  
  695. if ((interactiveObject.uid >> 29 & 3) == 2 && interactiveObject.tileLeft == x && interactiveObject.tileTop == y) {
  696. return interactiveObject;
  697. }
  698. }
  699.  
  700. return null;
  701. }
  702.  
  703. public GroundDecoration getGroundDecoration(int y, int x, int z) {
  704. Tile tile = tileArray[z][x][y];
  705.  
  706. if (tile == null || tile.groundDecoration == null) {
  707. return null;
  708. } else {
  709. return tile.groundDecoration;
  710. }
  711. }
  712.  
  713. public int getWallObjectUID(int z, int x, int y) {
  714. Tile tile = tileArray[z][x][y];
  715. if (tile == null || tile.wallObject == null) {
  716. return 0;
  717. } else {
  718. return tile.wallObject.uid;
  719. }
  720. }
  721.  
  722. // fetchWallObjectNewUID
  723. public int fetchWallObjectNewUID(int i, int j, int k) {
  724. Tile tile = tileArray[i][j][k];
  725. if (tile == null || tile.wallObject == null) {
  726. return 0;
  727. } else {
  728. return tile.wallObject.getNewUID();
  729. }
  730. }
  731.  
  732. public int getWallDecorationUID(int z, int x, int y) {
  733. Tile tile = tileArray[z][x][y];
  734. if (tile == null || tile.wallDecoration == null) {
  735. return 0;
  736. } else {
  737. return tile.wallDecoration.uid;
  738. }
  739. }
  740.  
  741. // fetchWallDecorationNewUID
  742. public int fetchWallDecorationNewUID(int i, int j, int l) {
  743. Tile tile = tileArray[i][j][l];
  744. if (tile == null || tile.wallDecoration == null) {
  745. return 0;
  746. } else {
  747. return tile.wallDecoration.getNewUID();
  748. }
  749. }
  750.  
  751. // fetchObjectMeshUID
  752. public int getInteractableObjectUID(int z, int x, int y) {
  753. if (z == 4) {
  754. z = 0;
  755. }
  756. Tile tile = tileArray[z][x][y];
  757. if (tile == null) {
  758. return 0;
  759. }
  760. for (int l = 0; l < tile.entityCount; l++) {
  761. InteractiveObject interactableObject = tile.interactiveObjects[l];
  762. if ((interactableObject.uid >> 29 & 3) == 2 && interactableObject.tileLeft == x && interactableObject.tileTop == y) {
  763. return interactableObject.uid;
  764. }
  765. }
  766. return 0;
  767. }
  768.  
  769. // fetchObjectMeshNewUID
  770. public int fetchObjectMeshNewUID(int z, int x, int y) {
  771. Tile tile = tileArray[z][x][y];
  772. if (tile == null) {
  773. return 0;
  774. }
  775. for (int l = 0; l < tile.entityCount; l++) {
  776. InteractiveObject interactableObject = tile.interactiveObjects[l];
  777. if ((interactableObject.uid >> 29 & 3) == 2 && interactableObject.tileLeft == x && interactableObject.tileTop == y) {
  778. return interactableObject.getNewUID();
  779. }
  780. }
  781. return 0;
  782. }
  783.  
  784. // fetchGroundDecorationUID
  785. public int getGroundDecorationUID(int z, int x, int y) {
  786. Tile tile = tileArray[z][x][y];
  787. if (tile == null || tile.groundDecoration == null) {
  788. return 0;
  789. } else {
  790. return tile.groundDecoration.uid;
  791. }
  792. }
  793.  
  794. // fetchGroundDecorationNewUID
  795. public int fetchGroundDecorationNewUID(int i, int j, int k) {
  796. Tile tile = tileArray[i][j][k];
  797. if (tile == null || tile.groundDecoration == null) {
  798. return 0;
  799. } else {
  800. return tile.groundDecoration.id;
  801. }
  802. }
  803.  
  804. public int fetchObjectIDTagForPosition(int z, int x, int y, int objectMesh) {
  805. Tile tile = tileArray[z][x][y];
  806. if (tile == null) {
  807. return -1;
  808. }
  809. if (tile.wallObject != null && tile.wallObject.uid == objectMesh) {
  810. return tile.wallObject.objConf & 0xff;
  811. }
  812. if (tile.wallDecoration != null && tile.wallDecoration.uid == objectMesh) {
  813. return tile.wallDecoration.objConf & 0xff;
  814. }
  815. if (tile.groundDecoration != null && tile.groundDecoration.uid == objectMesh) {
  816. return tile.groundDecoration.objConf & 0xff;
  817. }
  818. for (int i1 = 0; i1 < tile.entityCount; i1++) {
  819. // entityCount = count?
  820. if (tile.interactiveObjects[i1].uid == objectMesh) {
  821. return tile.interactiveObjects[i1].objConf & 0xff;
  822. }
  823. }
  824.  
  825. return -1;
  826. }
  827.  
  828. void shadeModels(int i, int k, int i1) {
  829. int j = 75;//check this for draw distance
  830. int l = 1800;
  831. int k1 = l >> 4;
  832.  
  833. for (int l1 = 0; l1 < zMapSize; l1++) {
  834. for (int i2 = 0; i2 < xMapSize; i2++) {
  835. for (int j2 = 0; j2 < yMapSize; j2++) {
  836. Tile tile = tileArray[l1][i2][j2];
  837.  
  838. if (tile != null) {
  839. WallObject class10 = tile.wallObject;
  840. if (class10 != null && class10.node1 != null && class10.node1.vertex_normals != null) {
  841. method307(l1, 1, 1, i2, j2, (Model) class10.node1);
  842. if (class10.node2 != null && class10.node2.vertex_normals != null) {
  843. method307(l1, 1, 1, i2, j2, (Model) class10.node2);
  844. method308((Model) class10.node1, (Model) class10.node2, 0, 0, 0, false);
  845. ((Model) class10.node2).doShading(j, k1, k, i, i1);
  846. }
  847. ((Model) class10.node1).doShading(j, k1, k, i, i1);
  848. }
  849. for (int k2 = 0; k2 < tile.entityCount; k2++) {
  850. InteractiveObject class28 = tile.interactiveObjects[k2];
  851. if (class28 != null && class28.jagexNode != null && class28.jagexNode.vertex_normals != null) {
  852. method307(l1, class28.tileRight - class28.tileLeft + 1, class28.tileBottom - class28.tileTop + 1, i2, j2, (Model) class28.jagexNode);
  853. ((Model) class28.jagexNode).doShading(j, k1, k, i, i1);
  854. }
  855. }
  856.  
  857. GroundDecoration class49 = tile.groundDecoration;
  858. if (class49 != null && class49.aClass30_Sub2_Sub4_814.vertex_normals != null) {
  859. method306(i2, l1, (Model) class49.aClass30_Sub2_Sub4_814, j2);
  860. ((Model) class49.aClass30_Sub2_Sub4_814).doShading(j, k1, k, i, i1);
  861. }
  862. }
  863. }
  864.  
  865. }
  866.  
  867. }
  868.  
  869. }
  870.  
  871. private void method306(int x, int z, Model model, int y) {
  872. if (x < xMapSize) {
  873. Tile tile = tileArray[z][x + 1][y];
  874. if (tile != null && tile.groundDecoration != null && tile.groundDecoration.aClass30_Sub2_Sub4_814.vertex_normals != null) {
  875. method308(model, (Model) tile.groundDecoration.aClass30_Sub2_Sub4_814, 128, 0, 0, true);
  876. }
  877. }
  878. if (y < xMapSize) {
  879. Tile tile = tileArray[z][x][y + 1];
  880. if (tile != null && tile.groundDecoration != null && tile.groundDecoration.aClass30_Sub2_Sub4_814.vertex_normals != null) {
  881. method308(model, (Model) tile.groundDecoration.aClass30_Sub2_Sub4_814, 0, 0, 128, true);
  882. }
  883. }
  884. if (x < xMapSize && y < yMapSize) {
  885. Tile tile = tileArray[z][x + 1][y + 1];
  886. if (tile != null && tile.groundDecoration != null && tile.groundDecoration.aClass30_Sub2_Sub4_814.vertex_normals != null) {
  887. method308(model, (Model) tile.groundDecoration.aClass30_Sub2_Sub4_814, 128, 0, 128, true);
  888. }
  889. }
  890. if (x < xMapSize && y > 0) {
  891. Tile tile = tileArray[z][x + 1][y - 1];
  892. if (tile != null && tile.groundDecoration != null && tile.groundDecoration.aClass30_Sub2_Sub4_814.vertex_normals != null) {
  893. method308(model, (Model) tile.groundDecoration.aClass30_Sub2_Sub4_814, 128, 0, -128, true);
  894. }
  895. }
  896. }
  897.  
  898. private void method307(int z, int j, int k, int x, int y, Model model) {
  899. boolean flag = true;
  900. int j1 = x;
  901. int k1 = x + j;
  902. int l1 = y - 1;
  903. int i2 = y + k;
  904. for (int j2 = z; j2 <= z + 1; j2++) {
  905. if (j2 != zMapSize) {
  906. for (int k2 = j1; k2 <= k1; k2++) {
  907. if (k2 >= 0 && k2 < xMapSize) {
  908. for (int l2 = l1; l2 <= i2; l2++) {
  909. if (l2 >= 0 && l2 < yMapSize && (!flag || k2 >= k1 || l2 >= i2 || l2 < y && k2 != x)) {
  910. Tile class30_sub3 = tileArray[j2][k2][l2];
  911. if (class30_sub3 != null) {
  912. int i3 = (heightmap[j2][k2][l2] + heightmap[j2][k2 + 1][l2] + heightmap[j2][k2][l2 + 1] + heightmap[j2][k2 + 1][l2 + 1]) / 4 - (heightmap[z][x][y] + heightmap[z][x + 1][y] + heightmap[z][x][y + 1] + heightmap[z][x + 1][y + 1]) / 4;
  913. WallObject class10 = class30_sub3.wallObject;
  914. if (class10 != null && class10.node1 != null && class10.node1.vertex_normals != null) {
  915. method308(model, (Model) class10.node1, (k2 - x) * 128 + (1 - j) * 64, i3, (l2 - y) * 128 + (1 - k) * 64, flag);
  916. }
  917. if (class10 != null && class10.node2 != null && class10.node2.vertex_normals != null) {
  918. method308(model, (Model) class10.node2, (k2 - x) * 128 + (1 - j) * 64, i3, (l2 - y) * 128 + (1 - k) * 64, flag);
  919. }
  920. for (int j3 = 0; j3 < class30_sub3.entityCount; j3++) {
  921. InteractiveObject class28 = class30_sub3.interactiveObjects[j3];
  922. if (class28 != null && class28.jagexNode != null && class28.jagexNode.vertex_normals != null) {
  923. int k3 = class28.tileRight - class28.tileLeft + 1;
  924. int l3 = class28.tileBottom - class28.tileTop + 1;
  925. method308(model, (Model) class28.jagexNode, (class28.tileLeft - x) * 128 + (k3 - j) * 64, i3, (class28.tileTop - y) * 128 + (l3 - k) * 64, flag);
  926. }
  927. }
  928.  
  929. }
  930. }
  931. }
  932.  
  933. }
  934. }
  935.  
  936. j1--;
  937. flag = false;
  938. }
  939. }
  940.  
  941. }
  942.  
  943. private void method308(Model model, Model model_1, int i, int j, int k, boolean flag) {
  944. anInt488++;
  945. int l = 0;
  946. int ai[] = model_1.verticesXCoordinate;
  947. int i1 = model_1.numberOfVerticeCoordinates;
  948. for (int j1 = 0; j1 < model.numberOfVerticeCoordinates; j1++) {
  949. VertexNormal vertexNormal = model.vertex_normals[j1];
  950. VertexNormal vertexNormal_1 = model.vertexNormalOffset[j1];
  951. if (vertexNormal_1.magnitude != 0) {
  952. int i2 = (model.verticesYCoordinate[j1] >> (model.scaling ? 2 : 0)) - j;
  953. if (i2 <= model_1.maxY) {
  954. int j2 = (model.verticesXCoordinate[j1] >> (model.scaling ? 2 : 0)) - i;
  955. if (j2 >= model_1.minX && j2 <= model_1.maxX) {
  956. int k2 = (model.verticesZCoordinate[j1] >> (model.scaling ? 2 : 0)) - k;
  957. if (k2 >= model_1.minZ && k2 <= model_1.maxZ) {
  958. for (int l2 = 0; l2 < i1; l2++) {
  959. VertexNormal vertexNormal_2 = model_1.vertex_normals[l2];
  960. VertexNormal vertexNormal_3 = model_1.vertexNormalOffset[l2];
  961. if (j2 == ai[l2] >> (model_1.scaling ? 2 : 0) && k2 == model_1.verticesZCoordinate[l2] >> (model_1.scaling ? 2 : 0) && i2 == model_1.verticesYCoordinate[l2] >> (model_1.scaling ? 2 : 0) && vertexNormal_3.magnitude != 0) {
  962. vertexNormal.x += vertexNormal_3.x;
  963. vertexNormal.y += vertexNormal_3.y;
  964. vertexNormal.z += vertexNormal_3.z;
  965. vertexNormal.magnitude += vertexNormal_3.magnitude;
  966. vertexNormal_2.x += vertexNormal_1.x;
  967. vertexNormal_2.y += vertexNormal_1.y;
  968. vertexNormal_2.z += vertexNormal_1.z;
  969. vertexNormal_2.magnitude += vertexNormal_1.magnitude;
  970. l++;
  971. anIntArray486[j1] = anInt488;
  972. anIntArray487[l2] = anInt488;
  973. }
  974. }
  975.  
  976. }
  977. }
  978. }
  979. }
  980. }
  981.  
  982. if (l < 3 || !flag) {
  983. return;
  984. }
  985. for (int k1 = 0; k1 < model.numberOfTriangleFaces; k1++) {
  986. if (anIntArray486[model.face_a[k1]] == anInt488 && anIntArray486[model.face_b[k1]] == anInt488 && anIntArray486[model.face_c[k1]] == anInt488) {
  987. model.face_render_type[k1] = -1;
  988. }
  989. }
  990.  
  991. for (int l1 = 0; l1 < model_1.numberOfTriangleFaces; l1++) {
  992. if (anIntArray487[model_1.face_a[l1]] == anInt488 && anIntArray487[model_1.face_b[l1]] == anInt488 && anIntArray487[model_1.face_c[l1]] == anInt488) {
  993. model_1.face_render_type[l1] = -1;
  994. }
  995. }
  996.  
  997. }
  998.  
  999. public void drawMinimapTile(int pixels[], int pixelPointer, int k, int l, int i1) {
  1000. int j = 512;// was parameter
  1001. Tile currentTile = tileArray[k][l][i1];
  1002. if (currentTile == null) {
  1003. return;
  1004. }
  1005. PlainTile plainTile = currentTile.myPlainTile;
  1006. if (plainTile != null) {
  1007. if (LocalSettings.getBoolean("hd_minimap") && plainTile.colourA != 12345678) {
  1008. if (plainTile.colourRGB == 0) {
  1009. return;
  1010. }
  1011. int hs = plainTile.colourA & ~0x7f;
  1012. int l1 = plainTile.anInt719 & 0x7f;
  1013. int l2 = plainTile.colourD & 0x7f;
  1014. int l3 = (plainTile.colourA & 0x7f) - l1;
  1015. int l4 = (plainTile.anInt717 & 0x7f) - l2;
  1016. l1 <<= 2;
  1017. l2 <<= 2;
  1018. for (int k1 = 0; k1 < 4; k1++) {
  1019. if (!plainTile.textured) {
  1020. pixels[pixelPointer] = Rasterizer.hsl2rgb[hs | l1 >> 2];
  1021. pixels[pixelPointer + 1] = Rasterizer.hsl2rgb[hs | l1 * 3 + l2 >> 4];
  1022. pixels[pixelPointer + 2] = Rasterizer.hsl2rgb[hs | l1 + l2 >> 3];
  1023. pixels[pixelPointer + 3] = Rasterizer.hsl2rgb[hs | l1 + l2 * 3 >> 4];
  1024. } else {
  1025. int j1 = plainTile.colourRGB;
  1026. int lig = 0xff - ((l1 >> 1) * (l1 >> 1) >> 8);
  1027. pixels[pixelPointer] = ((j1 & 0xff00ff) * lig & ~0xff00ff) + ((j1 & 0xff00) * lig & 0xff0000) >> 8;
  1028. lig = 0xff - ((l1 * 3 + l2 >> 3) * (l1 * 3 + l2 >> 3) >> 8);
  1029. pixels[pixelPointer + 1] = ((j1 & 0xff00ff) * lig & ~0xff00ff) + ((j1 & 0xff00) * lig & 0xff0000) >> 8;
  1030. lig = 0xff - ((l1 + l2 >> 2) * (l1 + l2 >> 2) >> 8);
  1031. pixels[pixelPointer + 2] = ((j1 & 0xff00ff) * lig & ~0xff00ff) + ((j1 & 0xff00) * lig & 0xff0000) >> 8;
  1032. lig = 0xff - ((l1 + l2 * 3 >> 3) * (l1 + l2 * 3 >> 3) >> 8);
  1033. pixels[pixelPointer + 3] = ((j1 & 0xff00ff) * lig & ~0xff00ff) + ((j1 & 0xff00) * lig & 0xff0000) >> 8;
  1034. }
  1035. l1 += l3;
  1036. l2 += l4;
  1037. pixelPointer += j;
  1038. }
  1039. return;
  1040. }
  1041. int tileRGB = plainTile.colourRGB;
  1042. if (tileRGB == 0) {
  1043. return;
  1044. }
  1045. for (int k1 = 0; k1 < 4; k1++) {
  1046. pixels[pixelPointer] = tileRGB;
  1047. pixels[pixelPointer + 1] = tileRGB;
  1048. pixels[pixelPointer + 2] = tileRGB;
  1049. pixels[pixelPointer + 3] = tileRGB;
  1050. pixelPointer += j;
  1051. }
  1052.  
  1053. return;
  1054. }
  1055. ShapedTile shapedTile = currentTile.shapedTile;
  1056. if (shapedTile == null) {
  1057. return;
  1058. }
  1059. int shapeA = shapedTile.shape;
  1060. int shapeB = shapedTile.rotation;
  1061. int underlayRGB = shapedTile.colourRGB;
  1062. int overlayRGB = shapedTile.colourRGBA;
  1063. int shapePoints[] = tileShapePoints[shapeA];
  1064. int shapeIndices[] = tileShapeIndices[shapeB];
  1065. int shapePtr = 0;
  1066. if (LocalSettings.getBoolean("hd_minimap") && shapedTile.color62 != 12345678) {
  1067. int hs1 = shapedTile.color62 & ~0x7f;
  1068. int l11 = shapedTile.color92 & 0x7f;
  1069. int l21 = shapedTile.color82 & 0x7f;
  1070. int l31 = (shapedTile.color62 & 0x7f) - l11;
  1071. int l41 = (shapedTile.color72 & 0x7f) - l21;
  1072. l11 <<= 2;
  1073. l21 <<= 2;
  1074. for (int k1 = 0; k1 < 4; k1++) {
  1075. if (!shapedTile.textured) {
  1076. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1077. pixels[pixelPointer] = Rasterizer.hsl2rgb[hs1 | l11 >> 2];
  1078. }
  1079. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1080. pixels[pixelPointer + 1] = Rasterizer.hsl2rgb[hs1 | l11 * 3 + l21 >> 4];
  1081. }
  1082. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1083. pixels[pixelPointer + 2] = Rasterizer.hsl2rgb[hs1 | l11 + l21 >> 3];
  1084. }
  1085. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1086. pixels[pixelPointer + 3] = Rasterizer.hsl2rgb[hs1 | l11 + l21 * 3 >> 4];
  1087. }
  1088. } else {
  1089. int j1 = overlayRGB;
  1090. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1091. int lig = 0xff - ((l11 >> 1) * (l11 >> 1) >> 8);
  1092. pixels[pixelPointer] = ((j1 & 0xff00ff) * lig & ~0xff00ff) + ((j1 & 0xff00) * lig & 0xff0000) >> 8;
  1093. }
  1094. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1095. int lig = 0xff - ((l11 * 3 + l21 >> 3) * (l11 * 3 + l21 >> 3) >> 8);
  1096. pixels[pixelPointer + 1] = ((j1 & 0xff00ff) * lig & ~0xff00ff) + ((j1 & 0xff00) * lig & 0xff0000) >> 8;
  1097. }
  1098. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1099. int lig = 0xff - ((l11 + l21 >> 2) * (l11 + l21 >> 2) >> 8);
  1100. pixels[pixelPointer + 2] = ((j1 & 0xff00ff) * lig & ~0xff00ff) + ((j1 & 0xff00) * lig & 0xff0000) >> 8;
  1101. }
  1102. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1103. int lig = 0xff - ((l11 + l21 * 3 >> 3) * (l11 + l21 * 3 >> 3) >> 8);
  1104. pixels[pixelPointer + 3] = ((j1 & 0xff00ff) * lig & ~0xff00ff) + ((j1 & 0xff00) * lig & 0xff0000) >> 8;
  1105. }
  1106. }
  1107. l11 += l31;
  1108. l21 += l41;
  1109. pixelPointer += j;
  1110. }
  1111. if (underlayRGB != 0 && shapedTile.color61 != 12345678) {
  1112. pixelPointer -= j << 2;
  1113. shapePtr -= 16;
  1114. hs1 = shapedTile.color61 & ~0x7f;
  1115. l11 = shapedTile.color91 & 0x7f;
  1116. l21 = shapedTile.color81 & 0x7f;
  1117. l31 = (shapedTile.color61 & 0x7f) - l11;
  1118. l41 = (shapedTile.color71 & 0x7f) - l21;
  1119. l11 <<= 2;
  1120. l21 <<= 2;
  1121. for (int k1 = 0; k1 < 4; k1++) {
  1122. if (shapePoints[shapeIndices[shapePtr++]] == 0) {
  1123. pixels[pixelPointer] = Rasterizer.hsl2rgb[hs1 | l11 >> 2];
  1124. }
  1125. if (shapePoints[shapeIndices[shapePtr++]] == 0) {
  1126. pixels[pixelPointer + 1] = Rasterizer.hsl2rgb[hs1 | l11 * 3 + l21 >> 4];
  1127. }
  1128. if (shapePoints[shapeIndices[shapePtr++]] == 0) {
  1129. pixels[pixelPointer + 2] = Rasterizer.hsl2rgb[hs1 | l11 + l21 >> 3];
  1130. }
  1131. if (shapePoints[shapeIndices[shapePtr++]] == 0) {
  1132. pixels[pixelPointer + 3] = Rasterizer.hsl2rgb[hs1 | l11 + l21 * 3 >> 4];
  1133. }
  1134. l11 += l31;
  1135. l21 += l41;
  1136. pixelPointer += j;
  1137. }
  1138. }
  1139. return;
  1140. }
  1141. if (underlayRGB != 0) {
  1142. for (int i3 = 0; i3 < 4; i3++) {
  1143. pixels[pixelPointer] = shapePoints[shapeIndices[shapePtr++]] != 0 ? overlayRGB : underlayRGB;
  1144. pixels[pixelPointer + 1] = shapePoints[shapeIndices[shapePtr++]] != 0 ? overlayRGB : underlayRGB;
  1145. pixels[pixelPointer + 2] = shapePoints[shapeIndices[shapePtr++]] != 0 ? overlayRGB : underlayRGB;
  1146. pixels[pixelPointer + 3] = shapePoints[shapeIndices[shapePtr++]] != 0 ? overlayRGB : underlayRGB;
  1147. pixelPointer += j;
  1148. }
  1149.  
  1150. return;
  1151. }
  1152. for (int j3 = 0; j3 < 4; j3++) {
  1153. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1154. pixels[pixelPointer] = overlayRGB;
  1155. }
  1156. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1157. pixels[pixelPointer + 1] = overlayRGB;
  1158. }
  1159. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1160. pixels[pixelPointer + 2] = overlayRGB;
  1161. }
  1162. if (shapePoints[shapeIndices[shapePtr++]] != 0) {
  1163. pixels[pixelPointer + 3] = overlayRGB;
  1164. }
  1165. pixelPointer += j;
  1166. }
  1167.  
  1168. }
  1169.  
  1170. public void method312(int i, int j) {
  1171. isClicked = true;
  1172. anInt468 = j;
  1173. anInt469 = i;
  1174. clickedTileX = -1;
  1175. clickedTileY = -1;
  1176. }
  1177.  
  1178. public void method313(int xCampos, int yCampos, int xCurve, int zCampos, int plane, int yCurve) {
  1179.  
  1180. if (xCampos < 0) {
  1181. xCampos = 0;
  1182. } else if (xCampos >= xMapSize * 128) {
  1183. xCampos = xMapSize * 128 - 1;
  1184. }
  1185. if (yCampos < 0) {
  1186. yCampos = 0;
  1187. } else if (yCampos >= yMapSize * 128) {
  1188. yCampos = yMapSize * 128 - 1;
  1189. }
  1190. anInt448++;
  1191. yCurveSine = Model.SINE[yCurve];
  1192. yCurveCosine = Model.COSINE[yCurve];
  1193. xCurveSine = Model.SINE[xCurve];
  1194. xCurveCosine = Model.COSINE[xCurve];
  1195. TILE_VISIBILITY_MAP = TILE_VISIBILITY_MAPS[(yCurve - 128) / 32][xCurve / 64];
  1196. xCameraPosition = xCampos;
  1197. zCameraPosition = zCampos;
  1198. yCameraPosition = yCampos;
  1199. xCameraPositionTile = xCampos / 128;
  1200. yCameraPositionTile = yCampos / 128;
  1201. WorldController.plane = plane;
  1202. anInt449 = xCameraPositionTile - TILE_DRAW_DISTANCE;
  1203. if (anInt449 < 0) {
  1204. anInt449 = 0;
  1205. }
  1206. anInt451 = yCameraPositionTile - TILE_DRAW_DISTANCE;
  1207. if (anInt451 < 0) {
  1208. anInt451 = 0;
  1209. }
  1210. anInt450 = xCameraPositionTile + TILE_DRAW_DISTANCE;
  1211. if (anInt450 > xMapSize) {
  1212. anInt450 = xMapSize;
  1213. }
  1214. anInt452 = yCameraPositionTile + TILE_DRAW_DISTANCE;
  1215. if (anInt452 > yMapSize) {
  1216. anInt452 = yMapSize;
  1217. }
  1218. process_culling();
  1219. anInt446 = 0;
  1220. for (int k1 = currentHL; k1 < zMapSize; k1++) {
  1221. Tile floorTiles[][] = tileArray[k1];
  1222. for (int i2 = anInt449; i2 < anInt450; i2++) {
  1223. for (int k2 = anInt451; k2 < anInt452; k2++) {
  1224. Tile singleTile = floorTiles[i2][k2];
  1225. if (singleTile != null) {
  1226. if (singleTile.logicHeight > plane || !TILE_VISIBILITY_MAP[i2 - xCameraPositionTile + TILE_DRAW_DISTANCE][k2 - yCameraPositionTile + TILE_DRAW_DISTANCE] && heightmap[k1][i2][k2] - zCampos < (Configuration.INCREASED_RENDER_DISTANCE ? 4000 : 2000)) {
  1227. singleTile.aBoolean1322 = false;
  1228. singleTile.aBoolean1323 = false;
  1229. singleTile.anInt1325 = 0;
  1230. } else {
  1231. singleTile.aBoolean1322 = true;
  1232. singleTile.aBoolean1323 = true;
  1233. singleTile.aBoolean1324 = singleTile.entityCount > 0;
  1234. anInt446++;
  1235. }
  1236. }
  1237. }
  1238.  
  1239. }
  1240.  
  1241. }
  1242.  
  1243. for (int l1 = currentHL; l1 < zMapSize; l1++) {
  1244. Tile tiles[][] = tileArray[l1];
  1245. for (int l2 = -TILE_DRAW_DISTANCE; l2 <= 0; l2++) {
  1246. int i3 = xCameraPositionTile + l2;
  1247. int k3 = xCameraPositionTile - l2;
  1248. if (i3 >= anInt449 || k3 < anInt450) {
  1249. for (int i4 = -TILE_DRAW_DISTANCE; i4 <= 0; i4++) {
  1250. int k4 = yCameraPositionTile + i4;
  1251. int i5 = yCameraPositionTile - i4;
  1252. if (i3 >= anInt449) {
  1253. if (k4 >= anInt451) {
  1254. Tile class30_sub3_1 = tiles[i3][k4];
  1255. if (class30_sub3_1 != null && class30_sub3_1.aBoolean1322) {
  1256. renderTile(class30_sub3_1, true);
  1257. }
  1258. }
  1259. if (i5 < anInt452) {
  1260. Tile class30_sub3_2 = tiles[i3][i5];
  1261. if (class30_sub3_2 != null && class30_sub3_2.aBoolean1322) {
  1262. renderTile(class30_sub3_2, true);
  1263. }
  1264. }
  1265. }
  1266. if (k3 < anInt450) {
  1267. if (k4 >= anInt451) {
  1268. Tile class30_sub3_3 = tiles[k3][k4];
  1269. if (class30_sub3_3 != null && class30_sub3_3.aBoolean1322) {
  1270. renderTile(class30_sub3_3, true);
  1271. }
  1272. }
  1273. if (i5 < anInt452) {
  1274. Tile class30_sub3_4 = tiles[k3][i5];
  1275. if (class30_sub3_4 != null && class30_sub3_4.aBoolean1322) {
  1276. renderTile(class30_sub3_4, true);
  1277. }
  1278. }
  1279. }
  1280. if (anInt446 == 0) {
  1281. isClicked = false;
  1282. return;
  1283. }
  1284. }
  1285.  
  1286. }
  1287. }
  1288.  
  1289. }
  1290.  
  1291. for (int j2 = currentHL; j2 < zMapSize; j2++) {
  1292. Tile aclass30_sub3_2[][] = tileArray[j2];
  1293. for (int j3 = -TILE_DRAW_DISTANCE; j3 <= 0; j3++) {
  1294. int l3 = xCameraPositionTile + j3;
  1295. int j4 = xCameraPositionTile - j3;
  1296. if (l3 >= anInt449 || j4 < anInt450) {
  1297. for (int l4 = -TILE_DRAW_DISTANCE; l4 <= 0; l4++) {
  1298. int j5 = yCameraPositionTile + l4;
  1299. int k5 = yCameraPositionTile - l4;
  1300. if (l3 >= anInt449) {
  1301. if (j5 >= anInt451) {
  1302. Tile class30_sub3_5 = aclass30_sub3_2[l3][j5];
  1303. if (class30_sub3_5 != null && class30_sub3_5.aBoolean1322) {
  1304. renderTile(class30_sub3_5, false);
  1305. }
  1306. }
  1307. if (k5 < anInt452) {
  1308. Tile class30_sub3_6 = aclass30_sub3_2[l3][k5];
  1309. if (class30_sub3_6 != null && class30_sub3_6.aBoolean1322) {
  1310. renderTile(class30_sub3_6, false);
  1311. }
  1312. }
  1313. }
  1314. if (j4 < anInt450) {
  1315. if (j5 >= anInt451) {
  1316. Tile class30_sub3_7 = aclass30_sub3_2[j4][j5];
  1317. if (class30_sub3_7 != null && class30_sub3_7.aBoolean1322) {
  1318. renderTile(class30_sub3_7, false);
  1319. }
  1320. }
  1321. if (k5 < anInt452) {
  1322. Tile class30_sub3_8 = aclass30_sub3_2[j4][k5];
  1323. if (class30_sub3_8 != null && class30_sub3_8.aBoolean1322) {
  1324. renderTile(class30_sub3_8, false);
  1325. }
  1326. }
  1327. }
  1328. if (anInt446 == 0) {
  1329. isClicked = false;
  1330. return;
  1331. }
  1332. }
  1333.  
  1334. }
  1335. }
  1336.  
  1337. }
  1338.  
  1339. isClicked = false;
  1340. }
  1341.  
  1342. private void renderTile(Tile class30_sub3, boolean flag) {
  1343. aClass19_477.insertHead(class30_sub3);
  1344. do {
  1345. Tile tile;
  1346. do {
  1347. tile = (Tile) aClass19_477.popHead();
  1348. if (tile == null) {
  1349. return;
  1350. }
  1351. } while (!tile.aBoolean1323);
  1352. int tileX = tile.tileX;
  1353. int tileY = tile.tileY;
  1354. int tileZ = tile.tileZ;
  1355. int l = tile.anInt1310;
  1356. Tile aclass30_sub3[][] = tileArray[tileZ];
  1357. if (tile.aBoolean1322) {
  1358. if (flag) {
  1359. if (tileZ > 0) {
  1360. Tile class30_sub3_2 = tileArray[tileZ - 1][tileX][tileY];
  1361. if (class30_sub3_2 != null && class30_sub3_2.aBoolean1323) {
  1362. continue;
  1363. }
  1364. }
  1365. if (tileX <= xCameraPositionTile && tileX > anInt449) {
  1366. Tile class30_sub3_3 = aclass30_sub3[tileX - 1][tileY];
  1367. if (class30_sub3_3 != null && class30_sub3_3.aBoolean1323 && (class30_sub3_3.aBoolean1322 || (tile.anInt1320 & 1) == 0)) {
  1368. continue;
  1369. }
  1370. }
  1371. if (tileX >= xCameraPositionTile && tileX < anInt450 - 1) {
  1372. Tile class30_sub3_4 = aclass30_sub3[tileX + 1][tileY];
  1373. if (class30_sub3_4 != null && class30_sub3_4.aBoolean1323 && (class30_sub3_4.aBoolean1322 || (tile.anInt1320 & 4) == 0)) {
  1374. continue;
  1375. }
  1376. }
  1377. if (tileY <= yCameraPositionTile && tileY > anInt451) {
  1378. Tile class30_sub3_5 = aclass30_sub3[tileX][tileY - 1];
  1379. if (class30_sub3_5 != null && class30_sub3_5.aBoolean1323 && (class30_sub3_5.aBoolean1322 || (tile.anInt1320 & 8) == 0)) {
  1380. continue;
  1381. }
  1382. }
  1383. if (tileY >= yCameraPositionTile && tileY < anInt452 - 1) {
  1384. Tile class30_sub3_6 = aclass30_sub3[tileX][tileY + 1];
  1385. if (class30_sub3_6 != null && class30_sub3_6.aBoolean1323 && (class30_sub3_6.aBoolean1322 || (tile.anInt1320 & 2) == 0)) {
  1386. continue;
  1387. }
  1388. }
  1389. } else {
  1390. flag = true;
  1391. }
  1392. tile.aBoolean1322 = false;
  1393. if (tile.tileBelow0 != null) {
  1394. Tile class30_sub3_7 = tile.tileBelow0;
  1395. if (class30_sub3_7.myPlainTile != null) {
  1396. if (!method320(0, tileX, tileY)) {
  1397. renderPlainTile(class30_sub3_7.myPlainTile, 0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, tileX, tileY);
  1398. }
  1399. } else if (class30_sub3_7.shapedTile != null && !method320(0, tileX, tileY)) {
  1400. renderShapedTile(tileX, yCurveSine, xCurveSine, class30_sub3_7.shapedTile, yCurveCosine, tileY, xCurveCosine);
  1401. }
  1402. WallObject wallObject = class30_sub3_7.wallObject;
  1403. if (wallObject != null && wallObject.node1 != null) {
  1404. wallObject.node1.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, wallObject.xPos - xCameraPosition, wallObject.zPos - zCameraPosition, wallObject.yPos - yCameraPosition, wallObject.uid, wallObject.getNewUID());
  1405. }
  1406. for (int i2 = 0; i2 < class30_sub3_7.entityCount; i2++) {
  1407. InteractiveObject interactiveObject = class30_sub3_7.interactiveObjects[i2];
  1408. if (interactiveObject != null) {
  1409. interactiveObject.jagexNode.renderAtPoint(interactiveObject.rotation, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, interactiveObject.worldX - xCameraPosition, interactiveObject.worldZ - zCameraPosition, interactiveObject.worldY - yCameraPosition, interactiveObject.uid, interactiveObject.getNewUID());
  1410. }
  1411. }
  1412.  
  1413. }
  1414. boolean flag1 = false;
  1415. if (tile.myPlainTile != null) {
  1416. if (!method320(l, tileX, tileY)) {
  1417. flag1 = true;
  1418. renderPlainTile(tile.myPlainTile, l, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, tileX, tileY);
  1419. }
  1420. } else if (tile.shapedTile != null && !method320(l, tileX, tileY)) {
  1421. flag1 = true;
  1422. renderShapedTile(tileX, yCurveSine, xCurveSine, tile.shapedTile, yCurveCosine, tileY, xCurveCosine);
  1423. }
  1424. int j1 = 0;
  1425. int j2 = 0;
  1426. WallObject class10_3 = tile.wallObject;
  1427. WallDecoration class26_1 = tile.wallDecoration;
  1428. if (class10_3 != null || class26_1 != null) {
  1429. if (xCameraPositionTile == tileX) {
  1430. j1++;
  1431. } else if (xCameraPositionTile < tileX) {
  1432. j1 += 2;
  1433. }
  1434. if (yCameraPositionTile == tileY) {
  1435. j1 += 3;
  1436. } else if (yCameraPositionTile > tileY) {
  1437. j1 += 6;
  1438. }
  1439. j2 = anIntArray478[j1];
  1440. tile.anInt1328 = anIntArray480[j1];
  1441. }
  1442. if (class10_3 != null) {
  1443. if ((class10_3.orientation & anIntArray479[j1]) != 0) {
  1444. if (class10_3.orientation == 16) {
  1445. tile.anInt1325 = 3;
  1446. tile.anInt1326 = anIntArray481[j1];
  1447. tile.anInt1327 = 3 - tile.anInt1326;
  1448. } else if (class10_3.orientation == 32) {
  1449. tile.anInt1325 = 6;
  1450. tile.anInt1326 = anIntArray482[j1];
  1451. tile.anInt1327 = 6 - tile.anInt1326;
  1452. } else if (class10_3.orientation == 64) {
  1453. tile.anInt1325 = 12;
  1454. tile.anInt1326 = anIntArray483[j1];
  1455. tile.anInt1327 = 12 - tile.anInt1326;
  1456. } else {
  1457. tile.anInt1325 = 9;
  1458. tile.anInt1326 = anIntArray484[j1];
  1459. tile.anInt1327 = 9 - tile.anInt1326;
  1460. }
  1461. } else {
  1462. tile.anInt1325 = 0;
  1463. }
  1464. if ((class10_3.orientation & j2) != 0 && !method321(l, tileX, tileY, class10_3.orientation) && class10_3.node1 != null) {
  1465. class10_3.node1.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class10_3.xPos - xCameraPosition, class10_3.zPos - zCameraPosition, class10_3.yPos - yCameraPosition, class10_3.uid, class10_3.getNewUID());
  1466. }
  1467. if ((class10_3.orientation1 & j2) != 0 && !method321(l, tileX, tileY, class10_3.orientation1)) {
  1468. class10_3.node2.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class10_3.xPos - xCameraPosition, class10_3.zPos - zCameraPosition, class10_3.yPos - yCameraPosition, class10_3.uid, class10_3.getNewUID());
  1469. }
  1470. }
  1471. if (class26_1 != null && !method322(l, tileX, tileY, class26_1.myMob.modelHeight)) {
  1472. if ((class26_1.configBits & j2) != 0) {
  1473. class26_1.myMob.renderAtPoint(class26_1.face, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class26_1.xPos - xCameraPosition, class26_1.zPos - zCameraPosition, class26_1.yPos - yCameraPosition, class26_1.uid, class26_1.getNewUID());
  1474. } else if ((class26_1.configBits & 0x300) != 0) {
  1475. int j4 = class26_1.xPos - xCameraPosition;
  1476. int l5 = class26_1.zPos - zCameraPosition;
  1477. int k6 = class26_1.yPos - yCameraPosition;
  1478. int i8 = class26_1.face;
  1479. int k9;
  1480. if (i8 == 1 || i8 == 2) {
  1481. k9 = -j4;
  1482. } else {
  1483. k9 = j4;
  1484. }
  1485. int k10;
  1486. if (i8 == 2 || i8 == 3) {
  1487. k10 = -k6;
  1488. } else {
  1489. k10 = k6;
  1490. }
  1491. if ((class26_1.configBits & 0x100) != 0 && k10 < k9) {
  1492. int i11 = j4 + anIntArray463[i8];
  1493. int k11 = k6 + anIntArray464[i8];
  1494. class26_1.myMob.renderAtPoint(i8 * 512 + 256, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, i11, l5, k11, class26_1.uid, class26_1.getNewUID());
  1495. }
  1496. if ((class26_1.configBits & 0x200) != 0 && k10 > k9) {
  1497. int j11 = j4 + anIntArray465[i8];
  1498. int l11 = k6 + anIntArray466[i8];
  1499. class26_1.myMob.renderAtPoint(i8 * 512 + 1280 & 0x7ff, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, j11, l5, l11, class26_1.uid, class26_1.getNewUID());
  1500. }
  1501. }
  1502. }
  1503. if (flag1) {
  1504. GroundDecoration class49 = tile.groundDecoration;
  1505. if (class49 != null) {
  1506. class49.aClass30_Sub2_Sub4_814.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class49.xPos - xCameraPosition, class49.zPos - zCameraPosition, class49.yPos - yCameraPosition, class49.uid, class49.id);
  1507. }
  1508. GroundItemTile groundItemTile_1 = tile.groundItemTile;
  1509. if (groundItemTile_1 != null && groundItemTile_1.anInt52 == 0) {
  1510. if (groundItemTile_1.secondGroundItem != null) {
  1511. groundItemTile_1.secondGroundItem.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, groundItemTile_1.xPos - xCameraPosition, groundItemTile_1.zPos - zCameraPosition, groundItemTile_1.yPos - yCameraPosition, groundItemTile_1.uid, groundItemTile_1.getNewUID());
  1512. }
  1513. if (groundItemTile_1.thirdGroundItem != null) {
  1514. groundItemTile_1.thirdGroundItem.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, groundItemTile_1.xPos - xCameraPosition, groundItemTile_1.zPos - zCameraPosition, groundItemTile_1.yPos - yCameraPosition, groundItemTile_1.uid, groundItemTile_1.getNewUID());
  1515. }
  1516. if (groundItemTile_1.firstGroundItem != null) {
  1517. groundItemTile_1.firstGroundItem.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, groundItemTile_1.xPos - xCameraPosition, groundItemTile_1.zPos - zCameraPosition, groundItemTile_1.yPos - yCameraPosition, groundItemTile_1.uid, groundItemTile_1.getNewUID());
  1518. }
  1519. }
  1520. }
  1521. int k4 = tile.anInt1320;
  1522. if (k4 != 0) {
  1523. if (tileX < xCameraPositionTile && (k4 & 4) != 0) {
  1524. Tile class30_sub3_17 = aclass30_sub3[tileX + 1][tileY];
  1525. if (class30_sub3_17 != null && class30_sub3_17.aBoolean1323) {
  1526. aClass19_477.insertHead(class30_sub3_17);
  1527. }
  1528. }
  1529. if (tileY < yCameraPositionTile && (k4 & 2) != 0) {
  1530. Tile class30_sub3_18 = aclass30_sub3[tileX][tileY + 1];
  1531. if (class30_sub3_18 != null && class30_sub3_18.aBoolean1323) {
  1532. aClass19_477.insertHead(class30_sub3_18);
  1533. }
  1534. }
  1535. if (tileX > xCameraPositionTile && (k4 & 1) != 0) {
  1536. Tile class30_sub3_19 = aclass30_sub3[tileX - 1][tileY];
  1537. if (class30_sub3_19 != null && class30_sub3_19.aBoolean1323) {
  1538. aClass19_477.insertHead(class30_sub3_19);
  1539. }
  1540. }
  1541. if (tileY > yCameraPositionTile && (k4 & 8) != 0) {
  1542. Tile class30_sub3_20 = aclass30_sub3[tileX][tileY - 1];
  1543. if (class30_sub3_20 != null && class30_sub3_20.aBoolean1323) {
  1544. aClass19_477.insertHead(class30_sub3_20);
  1545. }
  1546. }
  1547. }
  1548. }
  1549. if (tile.anInt1325 != 0) {
  1550. boolean flag2 = true;
  1551. for (int k1 = 0; k1 < tile.entityCount; k1++) {
  1552. if (tile.interactiveObjects[k1].anInt528 == anInt448 || (tile.anIntArray1319[k1] & tile.anInt1325) != tile.anInt1326) {
  1553. continue;
  1554. }
  1555. flag2 = false;
  1556. break;
  1557. }
  1558.  
  1559. if (flag2) {
  1560. WallObject class10_1 = tile.wallObject;
  1561. if (!method321(l, tileX, tileY, class10_1.orientation)) {
  1562. class10_1.node1.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class10_1.xPos - xCameraPosition, class10_1.zPos - zCameraPosition, class10_1.yPos - yCameraPosition, class10_1.uid, class10_1.getNewUID());
  1563. }
  1564. tile.anInt1325 = 0;
  1565. }
  1566. }
  1567. if (tile.aBoolean1324) {
  1568. try {
  1569. int i1 = tile.entityCount;
  1570. tile.aBoolean1324 = false;
  1571. int l1 = 0;
  1572. label0:
  1573. for (int k2 = 0; k2 < i1; k2++) {
  1574. InteractiveObject class28_1 = tile.interactiveObjects[k2];
  1575. if (class28_1.anInt528 == anInt448) {
  1576. continue;
  1577. }
  1578. for (int k3 = class28_1.tileLeft; k3 <= class28_1.tileRight; k3++) {
  1579. for (int l4 = class28_1.tileTop; l4 <= class28_1.tileBottom; l4++) {
  1580. Tile class30_sub3_21 = aclass30_sub3[k3][l4];
  1581. if (class30_sub3_21.aBoolean1322) {
  1582. tile.aBoolean1324 = true;
  1583. } else {
  1584. if (class30_sub3_21.anInt1325 == 0) {
  1585. continue;
  1586. }
  1587. int l6 = 0;
  1588. if (k3 > class28_1.tileLeft) {
  1589. l6++;
  1590. }
  1591. if (k3 < class28_1.tileRight) {
  1592. l6 += 4;
  1593. }
  1594. if (l4 > class28_1.tileTop) {
  1595. l6 += 8;
  1596. }
  1597. if (l4 < class28_1.tileBottom) {
  1598. l6 += 2;
  1599. }
  1600. if ((l6 & class30_sub3_21.anInt1325) != tile.anInt1327) {
  1601. continue;
  1602. }
  1603. tile.aBoolean1324 = true;
  1604. }
  1605. continue label0;
  1606. }
  1607.  
  1608. }
  1609.  
  1610. interactiveObjects[l1++] = class28_1;
  1611. int i5 = xCameraPositionTile - class28_1.tileLeft;
  1612. int i6 = class28_1.tileRight - xCameraPositionTile;
  1613. if (i6 > i5) {
  1614. i5 = i6;
  1615. }
  1616. int i7 = yCameraPositionTile - class28_1.tileTop;
  1617. int j8 = class28_1.tileBottom - yCameraPositionTile;
  1618. if (j8 > i7) {
  1619. class28_1.anInt527 = i5 + j8;
  1620. } else {
  1621. class28_1.anInt527 = i5 + i7;
  1622. }
  1623. }
  1624.  
  1625. while (l1 > 0) {
  1626. int i3 = -50;
  1627. int l3 = -1;
  1628. for (int j5 = 0; j5 < l1; j5++) {
  1629. InteractiveObject class28_2 = interactiveObjects[j5];
  1630. if (class28_2.anInt528 != anInt448) {
  1631. if (class28_2.anInt527 > i3) {
  1632. i3 = class28_2.anInt527;
  1633. l3 = j5;
  1634. } else if (class28_2.anInt527 == i3) {
  1635. int j7 = class28_2.worldX - xCameraPosition;
  1636. int k8 = class28_2.worldY - yCameraPosition;
  1637. int l9 = interactiveObjects[l3].worldX - xCameraPosition;
  1638. int l10 = interactiveObjects[l3].worldY - yCameraPosition;
  1639. if (j7 * j7 + k8 * k8 > l9 * l9 + l10 * l10) {
  1640. l3 = j5;
  1641. }
  1642. }
  1643. }
  1644. }
  1645.  
  1646. if (l3 == -1) {
  1647. break;
  1648. }
  1649. InteractiveObject class28_3 = interactiveObjects[l3];
  1650. class28_3.anInt528 = anInt448;
  1651. if (!method323(l, class28_3.tileLeft, class28_3.tileRight, class28_3.tileTop, class28_3.tileBottom, class28_3.jagexNode.modelHeight)) {
  1652. class28_3.jagexNode.renderAtPoint(class28_3.rotation, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class28_3.worldX - xCameraPosition, class28_3.worldZ - zCameraPosition, class28_3.worldY - yCameraPosition, class28_3.uid, class28_3.getNewUID());
  1653. }
  1654. for (int k7 = class28_3.tileLeft; k7 <= class28_3.tileRight; k7++) {
  1655. for (int l8 = class28_3.tileTop; l8 <= class28_3.tileBottom; l8++) {
  1656. Tile class30_sub3_22 = aclass30_sub3[k7][l8];
  1657. if (class30_sub3_22.anInt1325 != 0) {
  1658. aClass19_477.insertHead(class30_sub3_22);
  1659. } else if ((k7 != tileX || l8 != tileY) && class30_sub3_22.aBoolean1323) {
  1660. aClass19_477.insertHead(class30_sub3_22);
  1661. }
  1662. }
  1663.  
  1664. }
  1665.  
  1666. }
  1667. if (tile.aBoolean1324) {
  1668. continue;
  1669. }
  1670. } catch (Exception _ex) {
  1671. tile.aBoolean1324 = false;
  1672. }
  1673. }
  1674. if (!tile.aBoolean1323 || tile.anInt1325 != 0) {
  1675. continue;
  1676. }
  1677. if (tileX <= xCameraPositionTile && tileX > anInt449) {
  1678. Tile class30_sub3_8 = aclass30_sub3[tileX - 1][tileY];
  1679. if (class30_sub3_8 != null && class30_sub3_8.aBoolean1323) {
  1680. continue;
  1681. }
  1682. }
  1683. if (tileX >= xCameraPositionTile && tileX < anInt450 - 1) {
  1684. Tile class30_sub3_9 = aclass30_sub3[tileX + 1][tileY];
  1685. if (class30_sub3_9 != null && class30_sub3_9.aBoolean1323) {
  1686. continue;
  1687. }
  1688. }
  1689. if (tileY <= yCameraPositionTile && tileY > anInt451) {
  1690. Tile class30_sub3_10 = aclass30_sub3[tileX][tileY - 1];
  1691. if (class30_sub3_10 != null && class30_sub3_10.aBoolean1323) {
  1692. continue;
  1693. }
  1694. }
  1695. if (tileY >= yCameraPositionTile && tileY < anInt452 - 1) {
  1696. Tile class30_sub3_11 = aclass30_sub3[tileX][tileY + 1];
  1697. if (class30_sub3_11 != null && class30_sub3_11.aBoolean1323) {
  1698. continue;
  1699. }
  1700. }
  1701. tile.aBoolean1323 = false;
  1702. anInt446--;
  1703. GroundItemTile groundItemTile = tile.groundItemTile;
  1704. if (groundItemTile != null && groundItemTile.anInt52 != 0) {
  1705. if (groundItemTile.secondGroundItem != null) {
  1706. groundItemTile.secondGroundItem.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, groundItemTile.xPos - xCameraPosition, groundItemTile.zPos - zCameraPosition - groundItemTile.anInt52, groundItemTile.yPos - yCameraPosition, groundItemTile.uid, groundItemTile.getNewUID());
  1707. }
  1708. if (groundItemTile.thirdGroundItem != null) {
  1709. groundItemTile.thirdGroundItem.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, groundItemTile.xPos - xCameraPosition, groundItemTile.zPos - zCameraPosition - groundItemTile.anInt52, groundItemTile.yPos - yCameraPosition, groundItemTile.uid, groundItemTile.getNewUID());
  1710. }
  1711. if (groundItemTile.firstGroundItem != null) {
  1712. groundItemTile.firstGroundItem.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, groundItemTile.xPos - xCameraPosition, groundItemTile.zPos - zCameraPosition - groundItemTile.anInt52, groundItemTile.yPos - yCameraPosition, groundItemTile.uid, groundItemTile.getNewUID());
  1713. }
  1714. }
  1715. if (tile.anInt1328 != 0) {
  1716. WallDecoration class26 = tile.wallDecoration;
  1717. if (class26 != null && !method322(l, tileX, tileY, class26.myMob.modelHeight)) {
  1718. if ((class26.configBits & tile.anInt1328) != 0) {
  1719. class26.myMob.renderAtPoint(class26.face, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class26.xPos - xCameraPosition, class26.zPos - zCameraPosition, class26.yPos - yCameraPosition, class26.uid, class26.getNewUID());
  1720. } else if ((class26.configBits & 0x300) != 0) {
  1721. int l2 = class26.xPos - xCameraPosition;
  1722. int j3 = class26.zPos - zCameraPosition;
  1723. int i4 = class26.yPos - yCameraPosition;
  1724. int k5 = class26.face;
  1725. int j6;
  1726. if (k5 == 1 || k5 == 2) {
  1727. j6 = -l2;
  1728. } else {
  1729. j6 = l2;
  1730. }
  1731. int l7;
  1732. if (k5 == 2 || k5 == 3) {
  1733. l7 = -i4;
  1734. } else {
  1735. l7 = i4;
  1736. }
  1737. if ((class26.configBits & 0x100) != 0 && l7 >= j6) {
  1738. int i9 = l2 + anIntArray463[k5];
  1739. int i10 = i4 + anIntArray464[k5];
  1740. class26.myMob.renderAtPoint(k5 * 512 + 256, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, i9, j3, i10, class26.uid, class26.getNewUID());
  1741. }
  1742. if ((class26.configBits & 0x200) != 0 && l7 <= j6) {
  1743. int j9 = l2 + anIntArray465[k5];
  1744. int j10 = i4 + anIntArray466[k5];
  1745. class26.myMob.renderAtPoint(k5 * 512 + 1280 & 0x7ff, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, j9, j3, j10, class26.uid, class26.getNewUID());
  1746. }
  1747. }
  1748. }
  1749. WallObject class10_2 = tile.wallObject;
  1750. if (class10_2 != null) {
  1751. if ((class10_2.orientation1 & tile.anInt1328) != 0 && !method321(l, tileX, tileY, class10_2.orientation1)) {
  1752. class10_2.node2.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class10_2.xPos - xCameraPosition, class10_2.zPos - zCameraPosition, class10_2.yPos - yCameraPosition, class10_2.uid, class10_2.getNewUID());
  1753. }
  1754. if ((class10_2.orientation & tile.anInt1328) != 0 && !method321(l, tileX, tileY, class10_2.orientation) && class10_2.node1 != null) {
  1755. class10_2.node1.renderAtPoint(0, yCurveSine, yCurveCosine, xCurveSine, xCurveCosine, class10_2.xPos - xCameraPosition, class10_2.zPos - zCameraPosition, class10_2.yPos - yCameraPosition, class10_2.uid, class10_2.getNewUID());
  1756. }
  1757. }
  1758. }
  1759. if (tileZ < zMapSize - 1) {
  1760. Tile class30_sub3_12 = tileArray[tileZ + 1][tileX][tileY];
  1761. if (class30_sub3_12 != null && class30_sub3_12.aBoolean1323) {
  1762. aClass19_477.insertHead(class30_sub3_12);
  1763. }
  1764. }
  1765. if (tileX < xCameraPositionTile) {
  1766. Tile class30_sub3_13 = aclass30_sub3[tileX + 1][tileY];
  1767. if (class30_sub3_13 != null && class30_sub3_13.aBoolean1323) {
  1768. aClass19_477.insertHead(class30_sub3_13);
  1769. }
  1770. }
  1771. if (tileY < yCameraPositionTile) {
  1772. Tile class30_sub3_14 = aclass30_sub3[tileX][tileY + 1];
  1773. if (class30_sub3_14 != null && class30_sub3_14.aBoolean1323) {
  1774. aClass19_477.insertHead(class30_sub3_14);
  1775. }
  1776. }
  1777. if (tileX > xCameraPositionTile) {
  1778. Tile class30_sub3_15 = aclass30_sub3[tileX - 1][tileY];
  1779. if (class30_sub3_15 != null && class30_sub3_15.aBoolean1323) {
  1780. aClass19_477.insertHead(class30_sub3_15);
  1781. }
  1782. }
  1783. if (tileY > yCameraPositionTile) {
  1784. Tile class30_sub3_16 = aclass30_sub3[tileX][tileY - 1];
  1785. if (class30_sub3_16 != null && class30_sub3_16.aBoolean1323) {
  1786. aClass19_477.insertHead(class30_sub3_16);
  1787. }
  1788. }
  1789. } while (true);
  1790. }
  1791.  
  1792. private void renderPlainTile(PlainTile plainTile, int tZ, int ysin, int ycos, int xsin, int xcos, int tX, int tY) {
  1793. int xC;
  1794. int xA = xC = (tX << 7) - xCameraPosition;
  1795. int yB;
  1796. int yA = yB = (tY << 7) - yCameraPosition;
  1797. int xD;
  1798. int xB = xD = xA + 128;
  1799. int yC;
  1800. int yD = yC = yA + 128;
  1801. int zA = heightmap[tZ][tX][tY] - zCameraPosition;
  1802. int zB = heightmap[tZ][tX + 1][tY] - zCameraPosition;
  1803. int zD = heightmap[tZ][tX + 1][tY + 1] - zCameraPosition;
  1804. int zC = heightmap[tZ][tX][tY + 1] - zCameraPosition;
  1805. int l4 = yA * xsin + xA * xcos >> 16;
  1806. yA = yA * xcos - xA * xsin >> 16;
  1807. xA = l4;
  1808. l4 = zA * ycos - yA * ysin >> 16;
  1809. yA = zA * ysin + yA * ycos >> 16;
  1810. zA = l4;
  1811. if (yA < Configuration.CAM_NEAR) {
  1812. return;
  1813. }
  1814. l4 = yB * xsin + xB * xcos >> 16;
  1815. yB = yB * xcos - xB * xsin >> 16;
  1816. xB = l4;
  1817. l4 = zB * ycos - yB * ysin >> 16;
  1818. yB = zB * ysin + yB * ycos >> 16;
  1819. zB = l4;
  1820. if (yB < Configuration.CAM_NEAR) {
  1821. return;
  1822. }
  1823. l4 = yD * xsin + xD * xcos >> 16;
  1824. yD = yD * xcos - xD * xsin >> 16;
  1825. xD = l4;
  1826. l4 = zD * ycos - yD * ysin >> 16;
  1827. yD = zD * ysin + yD * ycos >> 16;
  1828. zD = l4;
  1829. if (yD < Configuration.CAM_NEAR) {
  1830. return;
  1831. }
  1832. l4 = yC * xsin + xC * xcos >> 16;
  1833. yC = yC * xcos - xC * xsin >> 16;
  1834. xC = l4;
  1835. l4 = zC * ycos - yC * ysin >> 16;
  1836. yC = zC * ysin + yC * ycos >> 16;
  1837. zC = l4;
  1838. if (yC < Configuration.CAM_NEAR) {
  1839. return;
  1840. }
  1841. int screenXA = Rasterizer.centerX + (xA << Client.log_view_dist) / yA;
  1842. int screenYA = Rasterizer.centerY + (zA << Client.log_view_dist) / yA;
  1843. int screenXB = Rasterizer.centerX + (xB << Client.log_view_dist) / yB;
  1844. int screenYB = Rasterizer.centerY + (zB << Client.log_view_dist) / yB;
  1845. int screenXD = Rasterizer.centerX + (xD << Client.log_view_dist) / yD;
  1846. int screenYD = Rasterizer.centerY + (zD << Client.log_view_dist) / yD;
  1847. int screenXC = Rasterizer.centerX + (xC << Client.log_view_dist) / yC;
  1848. int screenYC = Rasterizer.centerY + (zC << Client.log_view_dist) / yC;
  1849. Rasterizer.alpha = 0;
  1850. if ((screenXD - screenXC) * (screenYB - screenYC) - (screenYD - screenYC) * (screenXB - screenXC) > 0) {
  1851. Rasterizer.restrict_edges = screenXD < 0 || screenXC < 0 || screenXB < 0 || screenXD > Raster.viewportRx || screenXC > Raster.viewportRx || screenXB > Raster.viewportRx;
  1852. if (isClicked && isMouseWithinTriangle(anInt468, anInt469, screenYD, screenYC, screenYB, screenXD, screenXC, screenXB)) {
  1853. clickedTileX = tX;
  1854. clickedTileY = tY;
  1855. }
  1856. if(plainTile.texture == -1)
  1857. {
  1858. if(plainTile.colourD != 0xbc614e) {
  1859. if(Configuration.DEPTH_BUFFER)
  1860. Rasterizer.drawShadedTriangle(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.anInt719, plainTile.anInt717, yD, yC, yB);
  1861. else
  1862. Rasterizer.method374(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.anInt719, plainTile.anInt717);
  1863. }
  1864. } else if(!lowDetail)
  1865. {
  1866. if (plainTile.flat) {
  1867. if(Configuration.DEPTH_BUFFER)
  1868. Rasterizer.drawTexturedTriangle(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.anInt719, plainTile.anInt717, xA, xB, xC, zA, zB, zC, yA, yB, yC, plainTile.texture, yD, yC, yB);
  1869. else
  1870. Rasterizer.method378(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.anInt719, plainTile.anInt717, xA, xB, xC, zA, zB, zC, yA, yB, yC, plainTile.texture);
  1871. } else {
  1872. if(Configuration.DEPTH_BUFFER)
  1873. Rasterizer.drawTexturedTriangle(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.anInt719, plainTile.anInt717, xD, xC, xB, zD, zC, zB, yD, yC, yB, plainTile.texture, yD, yC, yB);
  1874. else
  1875. Rasterizer.method378(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, plainTile.colourD, plainTile.anInt719, plainTile.anInt717, xD, xC, xB, zD, zC, zB, yD, yC, yB, plainTile.texture);
  1876. }
  1877. } else
  1878. {
  1879. int i7 = textureRGBColour[plainTile.texture];
  1880. if(Configuration.DEPTH_BUFFER)
  1881. Rasterizer.drawShadedTriangle(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, mixColour(i7, plainTile.colourD), mixColour(i7, plainTile.anInt719), mixColour(i7, plainTile.anInt717), yD, yC, yB);
  1882. else
  1883. Rasterizer.method374(screenYD, screenYC, screenYB, screenXD, screenXC, screenXB, mixColour(i7, plainTile.colourD), mixColour(i7, plainTile.anInt719), mixColour(i7, plainTile.anInt717));
  1884. }
  1885. }
  1886. if((screenXA - screenXB) * (screenYC - screenYB) - (screenYA - screenYB) * (screenXC - screenXB) > 0)
  1887. {
  1888. Rasterizer.restrict_edges = screenXA < 0 || screenXB < 0 || screenXC < 0 || screenXA > Raster.viewportRx || screenXB > Raster.viewportRx || screenXC > Raster.viewportRx;
  1889. if(isClicked && isMouseWithinTriangle(anInt468, anInt469, screenYA, screenYB, screenYC, screenXA, screenXB, screenXC))
  1890. {
  1891. clickedTileX = tX;
  1892. clickedTileY = tY;
  1893. }
  1894. if (plainTile.texture == -1) {
  1895. if (plainTile.colourA != 0xbc614e) {
  1896. if(Configuration.DEPTH_BUFFER)
  1897. Rasterizer.drawShadedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, plainTile.colourA, plainTile.anInt717, plainTile.anInt719, yA, yB, yC);
  1898. else
  1899. Rasterizer.method374(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, plainTile.colourA, plainTile.anInt717, plainTile.anInt719);
  1900. }
  1901. } else {
  1902. if (!lowDetail) {
  1903. if(Configuration.DEPTH_BUFFER)
  1904. Rasterizer.drawTexturedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, plainTile.colourA, plainTile.anInt717, plainTile.anInt719, xA, xB, xC, zA, zB, zC, yA, yB, yC, plainTile.texture, yA, yB, yC);
  1905. else
  1906. Rasterizer.method378(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, plainTile.colourA, plainTile.anInt717, plainTile.anInt719, xA, xB, xC, zA, zB, zC, yA, yB, yC, plainTile.texture);
  1907. return;
  1908. }
  1909. int j7 = textureRGBColour[plainTile.texture];
  1910. if(Configuration.DEPTH_BUFFER)
  1911. Rasterizer.drawShadedTriangle(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, mixColour(j7, plainTile.colourA), mixColour(j7, plainTile.anInt717), mixColour(j7, plainTile.anInt719), yA, yB, yC);
  1912. else
  1913. Rasterizer.method374(screenYA, screenYB, screenYC, screenXA, screenXB, screenXC, mixColour(j7, plainTile.colourA), mixColour(j7, plainTile.anInt717), mixColour(j7, plainTile.anInt719));
  1914. }
  1915. }
  1916. }
  1917.  
  1918. private void renderShapedTile(int i, int ysin, int xsin, ShapedTile shapedTile, int ycos, int i1, int xcos) {
  1919. int triangleCount = shapedTile.origVertexX.length;
  1920. for (int l1 = 0; l1 < triangleCount; l1++) {
  1921. int viewspaceX = shapedTile.origVertexX[l1] - xCameraPosition;
  1922. int viewspaceY = shapedTile.origVertexY[l1] - zCameraPosition;
  1923. int viewspaceZ = shapedTile.origVertexZ[l1] - yCameraPosition;
  1924. int k3 = viewspaceZ * xsin + viewspaceX * xcos >> 16;
  1925. viewspaceZ = viewspaceZ * xcos - viewspaceX * xsin >> 16;
  1926. viewspaceX = k3;
  1927. k3 = viewspaceY * ycos - viewspaceZ * ysin >> 16;
  1928. viewspaceZ = viewspaceY * ysin + viewspaceZ * ycos >> 16;
  1929. viewspaceY = k3;
  1930. if (viewspaceZ < Configuration.CAM_NEAR) {
  1931. return;
  1932. }
  1933. if (LocalSettings.getBoolean("hd_textures") || shapedTile.triangleTexture != null) {
  1934. ShapedTile.viewSpaceX[l1] = viewspaceX;
  1935. ShapedTile.viewSpaceY[l1] = viewspaceY;
  1936. ShapedTile.viewSpaceZ[l1] = viewspaceZ;
  1937. }
  1938. ShapedTile.screenX[l1] = Rasterizer.centerX + (viewspaceX << Client.log_view_dist) / viewspaceZ;
  1939. ShapedTile.screenY[l1] = Rasterizer.centerY + (viewspaceY << Client.log_view_dist) / viewspaceZ;
  1940. ShapedTile.depthPoint[l1] = viewspaceZ;
  1941. }
  1942. Rasterizer.alpha = 0;
  1943. triangleCount = shapedTile.triangleA.length;
  1944. for (int triIdx = 0; triIdx < triangleCount; triIdx++) {
  1945. int indexA = shapedTile.triangleA[triIdx];
  1946. int indexB = shapedTile.triangleB[triIdx];
  1947. int indexC = shapedTile.triangleC[triIdx];
  1948. int x1 = ShapedTile.screenX[indexA];
  1949. int x2 = ShapedTile.screenX[indexB];
  1950. int x3 = ShapedTile.screenX[indexC];
  1951. int y1 = ShapedTile.screenY[indexA];
  1952. int y2 = ShapedTile.screenY[indexB];
  1953. int y3 = ShapedTile.screenY[indexC];
  1954. if ((x1 - x2) * (y3 - y2) - (y1 - y2) * (x3 - x2) > 0) {
  1955. Rasterizer.restrict_edges = x1 < 0 || x2 < 0 || x3 < 0 || x1 > Raster.viewportRx || x2 > Raster.viewportRx || x3 > Raster.viewportRx;
  1956. if (isClicked && isMouseWithinTriangle(anInt468, anInt469, y1, y2, y3, x1, x2, x3)) {
  1957. clickedTileX = i;
  1958. clickedTileY = i1;
  1959. }
  1960. if (shapedTile.triangleTexture == null || shapedTile.triangleTexture[triIdx] == -1 || shapedTile.triangleTexture[triIdx] > Rasterizer.TEXTURE_COUNT) {
  1961. if (shapedTile.triangleHslA[triIdx] != 0xbc614e) {
  1962. if(Configuration.DEPTH_BUFFER)
  1963. Rasterizer.drawShadedTriangle(y1, y2, y3, x1, x2, x3, shapedTile.triangleHslA[triIdx], shapedTile.anIntArray677[triIdx], shapedTile.anIntArray678[triIdx], ShapedTile.depthPoint[indexA], ShapedTile.depthPoint[indexB], ShapedTile.depthPoint[indexC]);
  1964. else
  1965. Rasterizer.method374(y1, y2, y3, x1, x2, x3, shapedTile.triangleHslA[triIdx], shapedTile.anIntArray677[triIdx], shapedTile.anIntArray678[triIdx]);
  1966. }
  1967. } else if (!lowDetail) {
  1968. if (shapedTile.flat) {
  1969. if(Configuration.DEPTH_BUFFER)
  1970. Rasterizer.drawTexturedTriangle(y1, y2, y3, x1, x2, x3, shapedTile.triangleHslA[triIdx], shapedTile.anIntArray677[triIdx], shapedTile.anIntArray678[triIdx], ShapedTile.viewSpaceX[0], ShapedTile.viewSpaceX[1], ShapedTile.viewSpaceX[3], ShapedTile.viewSpaceY[0], ShapedTile.viewSpaceY[1], ShapedTile.viewSpaceY[3], ShapedTile.viewSpaceZ[0], ShapedTile.viewSpaceZ[1], ShapedTile.viewSpaceZ[3], shapedTile.triangleTexture[triIdx], ShapedTile.depthPoint[indexA], ShapedTile.depthPoint[indexB], ShapedTile.depthPoint[indexC]);
  1971. else
  1972. Rasterizer.method378(y1, y2, y3, x1, x2, x3, shapedTile.triangleHslA[triIdx], shapedTile.anIntArray677[triIdx], shapedTile.anIntArray678[triIdx], ShapedTile.viewSpaceX[0], ShapedTile.viewSpaceX[1], ShapedTile.viewSpaceX[3], ShapedTile.viewSpaceY[0], ShapedTile.viewSpaceY[1], ShapedTile.viewSpaceY[3], ShapedTile.viewSpaceZ[0], ShapedTile.viewSpaceZ[1], ShapedTile.viewSpaceZ[3], shapedTile.triangleTexture[triIdx]);
  1973. } else {
  1974. if(Configuration.DEPTH_BUFFER)
  1975. Rasterizer.drawTexturedTriangle(y1, y2, y3, x1, x2, x3, shapedTile.triangleHslA[triIdx], shapedTile.anIntArray677[triIdx], shapedTile.anIntArray678[triIdx], ShapedTile.viewSpaceX[indexA], ShapedTile.viewSpaceX[indexB], ShapedTile.viewSpaceX[indexC], ShapedTile.viewSpaceY[indexA], ShapedTile.viewSpaceY[indexB], ShapedTile.viewSpaceY[indexC], ShapedTile.viewSpaceZ[indexA], ShapedTile.viewSpaceZ[indexB], ShapedTile.viewSpaceZ[indexC], shapedTile.triangleTexture[triIdx], ShapedTile.depthPoint[indexA], ShapedTile.depthPoint[indexB], ShapedTile.depthPoint[indexC]);
  1976. else
  1977. Rasterizer.method378(y1, y2, y3, x1, x2, x3, shapedTile.triangleHslA[triIdx], shapedTile.anIntArray677[triIdx], shapedTile.anIntArray678[triIdx], ShapedTile.viewSpaceX[indexA], ShapedTile.viewSpaceX[indexB], ShapedTile.viewSpaceX[indexC], ShapedTile.viewSpaceY[indexA], ShapedTile.viewSpaceY[indexB], ShapedTile.viewSpaceY[indexC], ShapedTile.viewSpaceZ[indexA], ShapedTile.viewSpaceZ[indexB], ShapedTile.viewSpaceZ[indexC], shapedTile.triangleTexture[triIdx]);
  1978. }
  1979. } else {
  1980. int k5 = textureRGBColour[shapedTile.triangleTexture[triIdx]];
  1981. if(Configuration.DEPTH_BUFFER)
  1982. Rasterizer.drawShadedTriangle(y1, y2, y3, x1, x2, x3, mixColour(k5, shapedTile.triangleHslA[triIdx]), mixColour(k5, shapedTile.anIntArray677[triIdx]), mixColour(k5, shapedTile.anIntArray678[triIdx]), ShapedTile.depthPoint[indexA], ShapedTile.depthPoint[indexB], ShapedTile.depthPoint[indexC]);
  1983. else
  1984. Rasterizer.method374(y1, y2, y3, x1, x2, x3, mixColour(k5, shapedTile.triangleHslA[triIdx]), mixColour(k5, shapedTile.anIntArray677[triIdx]), mixColour(k5, shapedTile.anIntArray678[triIdx]));
  1985. }
  1986. }
  1987. }
  1988. }
  1989.  
  1990. private int mixColour(int j, int k) {
  1991. k = 127 - k;
  1992. k = k * (j & 0x7f) / 160;
  1993. if (k < 2) {
  1994. k = 2;
  1995. } else if (k > 126) {
  1996. k = 126;
  1997. }
  1998. return (j & 0xff80) + k;
  1999. }
  2000.  
  2001. private boolean isMouseWithinTriangle(int mouseX, int mouseY, int k, int l, int i1, int j1, int k1, int l1) {
  2002. if (mouseY < k && mouseY < l && mouseY < i1) {
  2003. return false;
  2004. }
  2005. if (mouseY > k && mouseY > l && mouseY > i1) {
  2006. return false;
  2007. }
  2008. if (mouseX < j1 && mouseX < k1 && mouseX < l1) {
  2009. return false;
  2010. }
  2011. if (mouseX > j1 && mouseX > k1 && mouseX > l1) {
  2012. return false;
  2013. }
  2014. int i2 = (mouseY - k) * (k1 - j1) - (mouseX - j1) * (l - k);
  2015. int j2 = (mouseY - i1) * (j1 - l1) - (mouseX - l1) * (k - i1);
  2016. int k2 = (mouseY - l) * (l1 - k1) - (mouseX - k1) * (i1 - l);
  2017. return i2 * k2 > 0 && k2 * j2 > 0;
  2018. }
  2019.  
  2020. private void process_culling() {
  2021. int cluster_count = cullingClusterPointer[plane];
  2022. CullingCluster clusters[] = cullingClusters[plane];
  2023. processed_culling_clusters_ptr = 0;
  2024. for (int ptr = 0; ptr < cluster_count; ptr++) {
  2025. CullingCluster cullingCluster = clusters[ptr];
  2026. if (cullingCluster.searchMask == 1) {
  2027. int x_dist_from_camera_start = cullingCluster.tileStartX - xCameraPositionTile + TILE_DRAW_DISTANCE;
  2028. if (x_dist_from_camera_start < 0 || x_dist_from_camera_start > (TILE_DRAW_DISTANCE << 1)) {
  2029. continue;
  2030. }
  2031. int y_dist_from_camera_start = cullingCluster.tileStartY - yCameraPositionTile + TILE_DRAW_DISTANCE;
  2032. if (y_dist_from_camera_start < 0) {
  2033. y_dist_from_camera_start = 0;
  2034. }
  2035. int y_dist_from_camera_end = cullingCluster.tileEndY - yCameraPositionTile + TILE_DRAW_DISTANCE;
  2036. if (y_dist_from_camera_end > (TILE_DRAW_DISTANCE << 1)) {
  2037. y_dist_from_camera_end = (TILE_DRAW_DISTANCE << 1);
  2038. }
  2039. boolean is_visible = false;
  2040. while (y_dist_from_camera_start <= y_dist_from_camera_end) {
  2041. if (TILE_VISIBILITY_MAP[x_dist_from_camera_start][y_dist_from_camera_start++]) {
  2042. is_visible = true;
  2043. break;
  2044. }
  2045. }
  2046. if (!is_visible) {
  2047. continue;
  2048. }
  2049. int x_dist_from_camera_start_real = xCameraPosition - cullingCluster.worldStartX;
  2050. if (x_dist_from_camera_start_real > 32) {
  2051. cullingCluster.tileDistanceEnum = 1;
  2052. } else {
  2053. if (x_dist_from_camera_start_real >= -32) {
  2054. continue;
  2055. }
  2056. cullingCluster.tileDistanceEnum = 2;
  2057. x_dist_from_camera_start_real = -x_dist_from_camera_start_real;
  2058. }
  2059. cullingCluster.worldDistanceFromCameraStartY = (cullingCluster.worldStartY - yCameraPosition << 8) / x_dist_from_camera_start_real;
  2060. cullingCluster.worldDistanceFromCameraEndY = (cullingCluster.worldEndY - yCameraPosition << 8) / x_dist_from_camera_start_real;
  2061. cullingCluster.worldDistanceFromCameraStartZ = (cullingCluster.worldStartZ - zCameraPosition << 8) / x_dist_from_camera_start_real;
  2062. cullingCluster.worldDistanceFromCameraEndZ = (cullingCluster.worldEndZ - zCameraPosition << 8) / x_dist_from_camera_start_real;
  2063. processed_culling_clusters[processed_culling_clusters_ptr++] = cullingCluster;
  2064. continue;
  2065. }
  2066. if (cullingCluster.searchMask == 2) {
  2067. int i1 = cullingCluster.tileStartY - yCameraPositionTile + TILE_DRAW_DISTANCE;
  2068. if (i1 < 0 || i1 > (TILE_DRAW_DISTANCE << 1)) {
  2069. continue;
  2070. }
  2071. int l1 = cullingCluster.tileStartX - xCameraPositionTile + TILE_DRAW_DISTANCE;
  2072. if (l1 < 0) {
  2073. l1 = 0;
  2074. }
  2075. int k2 = cullingCluster.tileEndX - xCameraPositionTile + TILE_DRAW_DISTANCE;
  2076. if (k2 > (TILE_DRAW_DISTANCE << 1)) {
  2077. k2 = (TILE_DRAW_DISTANCE << 1);
  2078. }
  2079. boolean flag1 = false;
  2080. while (l1 <= k2) {
  2081. if (TILE_VISIBILITY_MAP[l1++][i1]) {
  2082. flag1 = true;
  2083. break;
  2084. }
  2085. }
  2086. if (!flag1) {
  2087. continue;
  2088. }
  2089. int y_dist_from_camera_start_real = yCameraPosition - cullingCluster.worldStartY;
  2090. if (y_dist_from_camera_start_real > 32) {
  2091. cullingCluster.tileDistanceEnum = 3;
  2092. } else {
  2093. if (y_dist_from_camera_start_real >= -32) {
  2094. continue;
  2095. }
  2096. cullingCluster.tileDistanceEnum = 4;
  2097. y_dist_from_camera_start_real = -y_dist_from_camera_start_real;
  2098. }
  2099. cullingCluster.worldDistanceFromCameraStartX = (cullingCluster.worldStartX - xCameraPosition << 8) / y_dist_from_camera_start_real;
  2100. cullingCluster.worldDistanceFromCameraEndX = (cullingCluster.worldEndX - xCameraPosition << 8) / y_dist_from_camera_start_real;
  2101. cullingCluster.worldDistanceFromCameraStartZ = (cullingCluster.worldStartZ - zCameraPosition << 8) / y_dist_from_camera_start_real;
  2102. cullingCluster.worldDistanceFromCameraEndZ = (cullingCluster.worldEndZ - zCameraPosition << 8) / y_dist_from_camera_start_real;
  2103. processed_culling_clusters[processed_culling_clusters_ptr++] = cullingCluster;
  2104. } else if (cullingCluster.searchMask == 4) {
  2105. int j1 = cullingCluster.worldStartZ - zCameraPosition;
  2106. if (j1 > 128) {
  2107. int i2 = cullingCluster.tileStartY - yCameraPositionTile + TILE_DRAW_DISTANCE;
  2108. if (i2 < 0) {
  2109. i2 = 0;
  2110. }
  2111. int l2 = cullingCluster.tileEndY - yCameraPositionTile + TILE_DRAW_DISTANCE;
  2112. if (l2 > (TILE_DRAW_DISTANCE << 1)) {
  2113. l2 = (TILE_DRAW_DISTANCE << 1);
  2114. }
  2115. if (i2 <= l2) {
  2116. int i3 = cullingCluster.tileStartX - xCameraPositionTile + TILE_DRAW_DISTANCE;
  2117. if (i3 < 0) {
  2118. i3 = 0;
  2119. }
  2120. int l3 = cullingCluster.tileEndX - xCameraPositionTile + TILE_DRAW_DISTANCE;
  2121. if (l3 > (TILE_DRAW_DISTANCE << 1)) {
  2122. l3 = (TILE_DRAW_DISTANCE << 1);
  2123. }
  2124. boolean flag2 = false;
  2125. label0: for (int i4 = i3; i4 <= l3; i4++) {
  2126. for (int j4 = i2; j4 <= l2; j4++) {
  2127. if (!TILE_VISIBILITY_MAP[i4][j4]) {
  2128. continue;
  2129. }
  2130. flag2 = true;
  2131. break label0;
  2132. }
  2133.  
  2134. }
  2135.  
  2136. if (flag2) {
  2137. cullingCluster.tileDistanceEnum = 5;
  2138. cullingCluster.worldDistanceFromCameraStartX = (cullingCluster.worldStartX - xCameraPosition << 8) / j1;
  2139. cullingCluster.worldDistanceFromCameraEndX = (cullingCluster.worldEndX - xCameraPosition << 8) / j1;
  2140. cullingCluster.worldDistanceFromCameraStartY = (cullingCluster.worldStartY - yCameraPosition << 8) / j1;
  2141. cullingCluster.worldDistanceFromCameraEndY = (cullingCluster.worldEndY - yCameraPosition << 8) / j1;
  2142. processed_culling_clusters[processed_culling_clusters_ptr++] = cullingCluster;
  2143. }
  2144. }
  2145. }
  2146. }
  2147. }
  2148.  
  2149. }
  2150.  
  2151. private boolean method320(int i, int j, int k) {
  2152. int l = anIntArrayArrayArray445[i][j][k];
  2153. if (l == -anInt448) {
  2154. return false;
  2155. }
  2156. if (l == anInt448) {
  2157. return true;
  2158. }
  2159. int i1 = j << 7;
  2160. int j1 = k << 7;
  2161. if (method324(i1 + 1, heightmap[i][j][k], j1 + 1) && method324(i1 + 128 - 1, heightmap[i][j + 1][k], j1 + 1) && method324(i1 + 128 - 1, heightmap[i][j + 1][k + 1], j1 + 128 - 1) && method324(i1 + 1, heightmap[i][j][k + 1], j1 + 128 - 1)) {
  2162. anIntArrayArrayArray445[i][j][k] = anInt448;
  2163. return true;
  2164. } else {
  2165. anIntArrayArrayArray445[i][j][k] = -anInt448;
  2166. return false;
  2167. }
  2168. }
  2169.  
  2170. private boolean method321(int i, int j, int k, int l) {
  2171. if (!method320(i, j, k)) {
  2172. return false;
  2173. }
  2174. int i1 = j << 7;
  2175. int j1 = k << 7;
  2176. int k1 = heightmap[i][j][k] - 1;
  2177. int l1 = k1 - 120;
  2178. int i2 = k1 - 230;
  2179. int j2 = k1 - 238;
  2180. if (l < 16) {
  2181. if (l == 1) {
  2182. if (i1 > xCameraPosition) {
  2183. if (!method324(i1, k1, j1)) {
  2184. return false;
  2185. }
  2186. if (!method324(i1, k1, j1 + 128)) {
  2187. return false;
  2188. }
  2189. }
  2190. if (i > 0) {
  2191. if (!method324(i1, l1, j1)) {
  2192. return false;
  2193. }
  2194. if (!method324(i1, l1, j1 + 128)) {
  2195. return false;
  2196. }
  2197. }
  2198. return method324(i1, i2, j1) && method324(i1, i2, j1 + 128);
  2199. }
  2200. if (l == 2) {
  2201. if (j1 < yCameraPosition) {
  2202. if (!method324(i1, k1, j1 + 128)) {
  2203. return false;
  2204. }
  2205. if (!method324(i1 + 128, k1, j1 + 128)) {
  2206. return false;
  2207. }
  2208. }
  2209. if (i > 0) {
  2210. if (!method324(i1, l1, j1 + 128)) {
  2211. return false;
  2212. }
  2213. if (!method324(i1 + 128, l1, j1 + 128)) {
  2214. return false;
  2215. }
  2216. }
  2217. return method324(i1, i2, j1 + 128) && method324(i1 + 128, i2, j1 + 128);
  2218. }
  2219. if (l == 4) {
  2220. if (i1 < xCameraPosition) {
  2221. if (!method324(i1 + 128, k1, j1)) {
  2222. return false;
  2223. }
  2224. if (!method324(i1 + 128, k1, j1 + 128)) {
  2225. return false;
  2226. }
  2227. }
  2228. if (i > 0) {
  2229. if (!method324(i1 + 128, l1, j1)) {
  2230. return false;
  2231. }
  2232. if (!method324(i1 + 128, l1, j1 + 128)) {
  2233. return false;
  2234. }
  2235. }
  2236. return method324(i1 + 128, i2, j1) && method324(i1 + 128, i2, j1 + 128);
  2237. }
  2238. if (l == 8) {
  2239. if (j1 > yCameraPosition) {
  2240. if (!method324(i1, k1, j1)) {
  2241. return false;
  2242. }
  2243. if (!method324(i1 + 128, k1, j1)) {
  2244. return false;
  2245. }
  2246. }
  2247. if (i > 0) {
  2248. if (!method324(i1, l1, j1)) {
  2249. return false;
  2250. }
  2251. if (!method324(i1 + 128, l1, j1)) {
  2252. return false;
  2253. }
  2254. }
  2255. return method324(i1, i2, j1) && method324(i1 + 128, i2, j1);
  2256. }
  2257. }
  2258. if (!method324(i1 + 64, j2, j1 + 64)) {
  2259. return false;
  2260. }
  2261. if (l == 16) {
  2262. return method324(i1, i2, j1 + 128);
  2263. }
  2264. if (l == 32) {
  2265. return method324(i1 + 128, i2, j1 + 128);
  2266. }
  2267. if (l == 64) {
  2268. return method324(i1 + 128, i2, j1);
  2269. }
  2270. if (l == 128) {
  2271. return method324(i1, i2, j1);
  2272. } else {
  2273. System.out.println("Warning unsupported wall type");
  2274. return true;
  2275. }
  2276. }
  2277.  
  2278. private boolean method322(int i, int j, int k, int l) {
  2279. if (!method320(i, j, k)) {
  2280. return false;
  2281. }
  2282. int i1 = j << 7;
  2283. int j1 = k << 7;
  2284. return method324(i1 + 1, heightmap[i][j][k] - l, j1 + 1) && method324(i1 + 128 - 1, heightmap[i][j + 1][k] - l, j1 + 1) && method324(i1 + 128 - 1, heightmap[i][j + 1][k + 1] - l, j1 + 128 - 1) && method324(i1 + 1, heightmap[i][j][k + 1] - l, j1 + 128 - 1);
  2285. }
  2286.  
  2287. private boolean method323(int i, int j, int k, int l, int i1, int j1) {
  2288. if (j == k && l == i1) {
  2289. if (!method320(i, j, l)) {
  2290. return false;
  2291. }
  2292. int k1 = j << 7;
  2293. int i2 = l << 7;
  2294. return method324(k1 + 1, heightmap[i][j][l] - j1, i2 + 1) && method324(k1 + 128 - 1, heightmap[i][j + 1][l] - j1, i2 + 1) && method324(k1 + 128 - 1, heightmap[i][j + 1][l + 1] - j1, i2 + 128 - 1) && method324(k1 + 1, heightmap[i][j][l + 1] - j1, i2 + 128 - 1);
  2295. }
  2296. for (int l1 = j; l1 <= k; l1++) {
  2297. for (int j2 = l; j2 <= i1; j2++) {
  2298. if (anIntArrayArrayArray445[i][l1][j2] == -anInt448) {
  2299. return false;
  2300. }
  2301. }
  2302.  
  2303. }
  2304.  
  2305. int k2 = (j << 7) + 1;
  2306. int l2 = (l << 7) + 2;
  2307. int i3 = heightmap[i][j][l] - j1;
  2308. if (!method324(k2, i3, l2)) {
  2309. return false;
  2310. }
  2311. int j3 = (k << 7) - 1;
  2312. if (!method324(j3, i3, l2)) {
  2313. return false;
  2314. }
  2315. int k3 = (i1 << 7) - 1;
  2316. return method324(k2, i3, k3) && method324(j3, i3, k3);
  2317. }
  2318.  
  2319. private boolean method324(int i, int j, int k) {
  2320. for (int l = 0; l < processed_culling_clusters_ptr; l++) {
  2321. CullingCluster cullingCluster = processed_culling_clusters[l];
  2322. if (cullingCluster.tileDistanceEnum == 1) {
  2323. int i1 = cullingCluster.worldStartX - i;
  2324. if (i1 > 0) {
  2325. int j2 = cullingCluster.worldStartY + (cullingCluster.worldDistanceFromCameraStartY * i1 >> 8);
  2326. int k3 = cullingCluster.worldEndY + (cullingCluster.worldDistanceFromCameraEndY * i1 >> 8);
  2327. int l4 = cullingCluster.worldStartZ + (cullingCluster.worldDistanceFromCameraStartZ * i1 >> 8);
  2328. int i6 = cullingCluster.worldEndZ + (cullingCluster.worldDistanceFromCameraEndZ * i1 >> 8);
  2329. if (k >= j2 && k <= k3 && j >= l4 && j <= i6) {
  2330. return true;
  2331. }
  2332. }
  2333. } else if (cullingCluster.tileDistanceEnum == 2) {
  2334. int j1 = i - cullingCluster.worldStartX;
  2335. if (j1 > 0) {
  2336. int k2 = cullingCluster.worldStartY + (cullingCluster.worldDistanceFromCameraStartY * j1 >> 8);
  2337. int l3 = cullingCluster.worldEndY + (cullingCluster.worldDistanceFromCameraEndY * j1 >> 8);
  2338. int i5 = cullingCluster.worldStartZ + (cullingCluster.worldDistanceFromCameraStartZ * j1 >> 8);
  2339. int j6 = cullingCluster.worldEndZ + (cullingCluster.worldDistanceFromCameraEndZ * j1 >> 8);
  2340. if (k >= k2 && k <= l3 && j >= i5 && j <= j6) {
  2341. return true;
  2342. }
  2343. }
  2344. } else if (cullingCluster.tileDistanceEnum == 3) {
  2345. int k1 = cullingCluster.worldStartY - k;
  2346. if (k1 > 0) {
  2347. int l2 = cullingCluster.worldStartX + (cullingCluster.worldDistanceFromCameraStartX * k1 >> 8);
  2348. int i4 = cullingCluster.worldEndX + (cullingCluster.worldDistanceFromCameraEndX * k1 >> 8);
  2349. int j5 = cullingCluster.worldStartZ + (cullingCluster.worldDistanceFromCameraStartZ * k1 >> 8);
  2350. int k6 = cullingCluster.worldEndZ + (cullingCluster.worldDistanceFromCameraEndZ * k1 >> 8);
  2351. if (i >= l2 && i <= i4 && j >= j5 && j <= k6) {
  2352. return true;
  2353. }
  2354. }
  2355. } else if (cullingCluster.tileDistanceEnum == 4) {
  2356. int l1 = k - cullingCluster.worldStartY;
  2357. if (l1 > 0) {
  2358. int i3 = cullingCluster.worldStartX + (cullingCluster.worldDistanceFromCameraStartX * l1 >> 8);
  2359. int j4 = cullingCluster.worldEndX + (cullingCluster.worldDistanceFromCameraEndX * l1 >> 8);
  2360. int k5 = cullingCluster.worldStartZ + (cullingCluster.worldDistanceFromCameraStartZ * l1 >> 8);
  2361. int l6 = cullingCluster.worldEndZ + (cullingCluster.worldDistanceFromCameraEndZ * l1 >> 8);
  2362. if (i >= i3 && i <= j4 && j >= k5 && j <= l6) {
  2363. return true;
  2364. }
  2365. }
  2366. } else if (cullingCluster.tileDistanceEnum == 5) {
  2367. int i2 = j - cullingCluster.worldStartZ;
  2368. if (i2 > 0) {
  2369. int j3 = cullingCluster.worldStartX + (cullingCluster.worldDistanceFromCameraStartX * i2 >> 8);
  2370. int k4 = cullingCluster.worldEndX + (cullingCluster.worldDistanceFromCameraEndX * i2 >> 8);
  2371. int l5 = cullingCluster.worldStartY + (cullingCluster.worldDistanceFromCameraStartY * i2 >> 8);
  2372. int i7 = cullingCluster.worldEndY + (cullingCluster.worldDistanceFromCameraEndY * i2 >> 8);
  2373. if (i >= j3 && i <= k4 && k >= l5 && k <= i7) {
  2374. return true;
  2375. }
  2376. }
  2377. }
  2378. }
  2379.  
  2380. return false;
  2381. }
  2382. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement