@@ -31,13 +31,14 @@ public class Scene {
31
31
public static int [] WALL_CORNER_TYPE_64_BLOCK_OBJ_SPANS = new int []{0 , 4 , 4 , 8 , 0 , 0 , 8 , 0 , 0 };
32
32
public static int [] WALL_CORNER_TYPE_128_BLOCK_OBJ_SPANS = new int []{1 , 1 , 0 , 0 , 0 , 8 , 0 , 0 , 8 };
33
33
34
+ public static boolean lowMemory = true ;
35
+ public static int cycle ;
36
+
34
37
public static int cameraPosX ;
35
38
public static int cameraPositionTileX ;
36
39
public static int renderCameraPitchSine ;
37
40
public static int mapBoundsX ;
38
- public static int cycle ;
39
41
public static int currentPositionY ;
40
- public static boolean lowMemory = true ;
41
42
public static int cameraPosZ ;
42
43
public static int anInt90 = 4 ;
43
44
public static int currentPositionX ;
@@ -68,17 +69,14 @@ public class Scene {
68
69
public static int [] viewspaceY = new int [6 ];
69
70
70
71
public SceneTile [][][] tileArray ;
71
- public int [][][] anIntArrayArrayArray83 ;
72
- public int sceneSpawnRequestsCacheCurrentPos ;
72
+ public int [][][] tileOcclusionCycles ;
73
+ public int sceneSpawnRequestsCacheCurrentPos = 0 ;
73
74
public InteractiveObject [] sceneSpawnRequestsCache = new InteractiveObject [5000 ];
74
- public int mapSizeX ;
75
75
public int currentPositionZ = 0 ;
76
76
public int [][][] heightMap ;
77
- public int mapSizeZ ;
78
- public int mapSizeY ;
79
- public int [] mergeIndexB ;
80
- public int anInt126 ;
81
- public int [] mergeIndexA ;
77
+ public int anInt126 = 0 ;
78
+ public int [] mergeIndexA = new int [10000 ];
79
+ public int [] mergeIndexB = new int [10000 ];
82
80
83
81
private boolean clicked = false ;
84
82
private int clickX = 0 ;
@@ -102,19 +100,13 @@ public class Scene {
102
100
*/
103
101
public int hoveredTileY = -1 ;
104
102
103
+ public int mapSizeX = 104 ;
104
+ public int mapSizeY = 104 ;
105
+ public int mapSizeZ = 4 ;
106
+
105
107
public Scene (int [][][] heightMap ) {
106
- final int length = 104 ;// was parameter
107
- final int width = 104 ;// was parameter
108
- final int height = 4 ;// was parameter
109
- sceneSpawnRequestsCacheCurrentPos = 0 ;
110
- mergeIndexB = new int [10000 ];
111
- anInt126 = 0 ;
112
- mergeIndexA = new int [10000 ];
113
- mapSizeZ = height ;
114
- mapSizeX = width ;
115
- mapSizeY = length ;
116
- tileArray = new SceneTile [height ][width ][length ];
117
- anIntArrayArrayArray83 = new int [height ][width + 1 ][length + 1 ];
108
+ tileArray = new SceneTile [mapSizeZ ][mapSizeX ][mapSizeY ];
109
+ tileOcclusionCycles = new int [mapSizeZ ][mapSizeX + 1 ][mapSizeY + 1 ];
118
110
this .heightMap = heightMap ;
119
111
initToNull ();
120
112
}
@@ -622,7 +614,7 @@ public WallDecoration getWallDecoration(int level, int x, int y) {
622
614
}
623
615
624
616
public boolean isTileOccluded (int x , int y , int z ) {
625
- int i = anIntArrayArrayArray83 [z ][x ][y ];
617
+ int i = tileOcclusionCycles [z ][x ][y ];
626
618
if (i == -cycle ) {
627
619
return false ;
628
620
}
@@ -632,10 +624,10 @@ public boolean isTileOccluded(int x, int y, int z) {
632
624
int worldX = x << 7 ;
633
625
int worldY = y << 7 ;
634
626
if (isPointOccluded (worldX + 1 , heightMap [z ][x ][y ], worldY + 1 ) && isPointOccluded (worldX + 128 - 1 , heightMap [z ][x + 1 ][y ], worldY + 1 ) && isPointOccluded (worldX + 128 - 1 , heightMap [z ][x + 1 ][y + 1 ], worldY + 128 - 1 ) && isPointOccluded (worldX + 1 , heightMap [z ][x ][y + 1 ], worldY + 128 - 1 )) {
635
- anIntArrayArrayArray83 [z ][x ][y ] = cycle ;
627
+ tileOcclusionCycles [z ][x ][y ] = cycle ;
636
628
return true ;
637
629
}
638
- anIntArrayArrayArray83 [z ][x ][y ] = -cycle ;
630
+ tileOcclusionCycles [z ][x ][y ] = -cycle ;
639
631
return false ;
640
632
}
641
633
@@ -1469,7 +1461,7 @@ public boolean isAreaOccluded(int z, int minimumX, int maximumX, int minimumY, i
1469
1461
}
1470
1462
for (int x = minimumX ; x <= maximumX ; x ++) {
1471
1463
for (int y = minimumY ; y <= maximumY ; y ++) {
1472
- if (anIntArrayArrayArray83 [z ][x ][y ] == -cycle ) {
1464
+ if (tileOcclusionCycles [z ][x ][y ] == -cycle ) {
1473
1465
return false ;
1474
1466
}
1475
1467
}
0 commit comments