@@ -43,10 +43,7 @@ public class Scene {
43
43
public static int cameraPosX ;
44
44
public static int cameraPositionTileX ;
45
45
public static int renderCameraPitchSine ;
46
- public static int mapBoundsX ;
47
- public static int currentPositionY ;
48
46
public static int cameraPosZ ;
49
- public static int currentPositionX ;
50
47
public static int activeOccluderCount = 0 ;
51
48
public static int cameraPosY ;
52
49
public static int renderCameraYawCosine ;
@@ -57,7 +54,6 @@ public class Scene {
57
54
public static LinkedList tileList = new LinkedList ();
58
55
public static int anInt109 = 0 ;
59
56
public static int renderCameraPitchCosine ;
60
- public static int mapBoundsY ;
61
57
public static int drawWidthMidpoint ;
62
58
public static int drawHeight ;
63
59
public static int drawHeightMidpoint ;
@@ -101,6 +97,12 @@ public class Scene {
101
97
*/
102
98
public int hoveredTileY = -1 ;
103
99
100
+ private int drawFromTileX ;
101
+ private int drawFromTileY ;
102
+
103
+ private int drawToTileX ;
104
+ private int drawToTileY ;
105
+
104
106
public int mapSizeX = 104 ;
105
107
public int mapSizeY = 104 ;
106
108
public int mapSizeZ = 4 ;
@@ -429,28 +431,28 @@ public void render(Camera camera, int plane) {
429
431
Scene .cameraPosY = cameraPosY ;
430
432
cameraPositionTileX = cameraPosX / 128 ;
431
433
cameraPositionTileY = cameraPosY / 128 ;
432
- currentPositionX = cameraPositionTileX - TILE_DRAW_DISTANCE ;
433
- if (currentPositionX < 0 ) {
434
- currentPositionX = 0 ;
434
+ drawFromTileX = cameraPositionTileX - TILE_DRAW_DISTANCE ;
435
+ if (drawFromTileX < 0 ) {
436
+ drawFromTileX = 0 ;
435
437
}
436
- currentPositionY = cameraPositionTileY - TILE_DRAW_DISTANCE ;
437
- if (currentPositionY < 0 ) {
438
- currentPositionY = 0 ;
438
+ drawFromTileY = cameraPositionTileY - TILE_DRAW_DISTANCE ;
439
+ if (drawFromTileY < 0 ) {
440
+ drawFromTileY = 0 ;
439
441
}
440
- mapBoundsX = cameraPositionTileX + TILE_DRAW_DISTANCE ;
441
- if (mapBoundsX > mapSizeX ) {
442
- mapBoundsX = mapSizeX ;
442
+ drawToTileX = cameraPositionTileX + TILE_DRAW_DISTANCE ;
443
+ if (drawToTileX > mapSizeX ) {
444
+ drawToTileX = mapSizeX ;
443
445
}
444
- mapBoundsY = cameraPositionTileY + TILE_DRAW_DISTANCE ;
445
- if (mapBoundsY > mapSizeY ) {
446
- mapBoundsY = mapSizeY ;
446
+ drawToTileY = cameraPositionTileY + TILE_DRAW_DISTANCE ;
447
+ if (drawToTileY > mapSizeY ) {
448
+ drawToTileY = mapSizeY ;
447
449
}
448
450
processCulling (plane );
449
451
anInt109 = 0 ;
450
452
for (int z = this .plane ; z < mapSizeZ ; z ++) {
451
453
SceneTile [][] sceneTiles = tileArray [z ];
452
- for (int x = currentPositionX ; x < mapBoundsX ; x ++) {
453
- for (int y = currentPositionY ; y < mapBoundsY ; y ++) {
454
+ for (int x = drawFromTileX ; x < drawToTileX ; x ++) {
455
+ for (int y = drawFromTileY ; y < drawToTileY ; y ++) {
454
456
SceneTile sceneTile = sceneTiles [x ][y ];
455
457
if (sceneTile != null ) {
456
458
if (sceneTile .drawLevel > plane || !TILE_VISIBILITY_MAP [x - cameraPositionTileX + TILE_DRAW_DISTANCE ][y - cameraPositionTileY + TILE_DRAW_DISTANCE ] && heightMap [z ][x ][y ] - cameraPosZ < 70000 ) {
@@ -472,32 +474,32 @@ public void render(Camera camera, int plane) {
472
474
for (int i_25_ = -TILE_DRAW_DISTANCE ; i_25_ <= 0 ; i_25_ ++) {
473
475
int i_26_ = cameraPositionTileX + i_25_ ;
474
476
int i_27_ = cameraPositionTileX - i_25_ ;
475
- if (i_26_ >= currentPositionX || i_27_ < mapBoundsX ) {
477
+ if (i_26_ >= drawFromTileX || i_27_ < drawToTileX ) {
476
478
for (int i_28_ = -TILE_DRAW_DISTANCE ; i_28_ <= 0 ; i_28_ ++) {
477
479
int i_29_ = cameraPositionTileY + i_28_ ;
478
480
int i_30_ = cameraPositionTileY - i_28_ ;
479
- if (i_26_ >= currentPositionX ) {
480
- if (i_29_ >= currentPositionY ) {
481
+ if (i_26_ >= drawFromTileX ) {
482
+ if (i_29_ >= drawFromTileY ) {
481
483
SceneTile sceneTile = sceneTiles [i_26_ ][i_29_ ];
482
484
if (sceneTile != null && sceneTile .draw ) {
483
485
renderTile (sceneTile , true );
484
486
}
485
487
}
486
- if (i_30_ < mapBoundsY ) {
488
+ if (i_30_ < drawToTileY ) {
487
489
SceneTile sceneTile = sceneTiles [i_26_ ][i_30_ ];
488
490
if (sceneTile != null && sceneTile .draw ) {
489
491
renderTile (sceneTile , true );
490
492
}
491
493
}
492
494
}
493
- if (i_27_ < mapBoundsX ) {
494
- if (i_29_ >= currentPositionY ) {
495
+ if (i_27_ < drawToTileX ) {
496
+ if (i_29_ >= drawFromTileY ) {
495
497
SceneTile sceneTile = sceneTiles [i_27_ ][i_29_ ];
496
498
if (sceneTile != null && sceneTile .draw ) {
497
499
renderTile (sceneTile , true );
498
500
}
499
501
}
500
- if (i_30_ < mapBoundsY ) {
502
+ if (i_30_ < drawToTileY ) {
501
503
SceneTile sceneTile = sceneTiles [i_27_ ][i_30_ ];
502
504
if (sceneTile != null && sceneTile .draw ) {
503
505
renderTile (sceneTile , true );
@@ -517,32 +519,32 @@ public void render(Camera camera, int plane) {
517
519
for (int i_31_ = -TILE_DRAW_DISTANCE ; i_31_ <= 0 ; i_31_ ++) {
518
520
int i_32_ = cameraPositionTileX + i_31_ ;
519
521
int i_33_ = cameraPositionTileX - i_31_ ;
520
- if (i_32_ >= currentPositionX || i_33_ < mapBoundsX ) {
522
+ if (i_32_ >= drawFromTileX || i_33_ < drawToTileX ) {
521
523
for (int i_34_ = -TILE_DRAW_DISTANCE ; i_34_ <= 0 ; i_34_ ++) {
522
524
int i_35_ = cameraPositionTileY + i_34_ ;
523
525
int i_36_ = cameraPositionTileY - i_34_ ;
524
- if (i_32_ >= currentPositionX ) {
525
- if (i_35_ >= currentPositionY ) {
526
+ if (i_32_ >= drawFromTileX ) {
527
+ if (i_35_ >= drawFromTileY ) {
526
528
SceneTile sceneTile = sceneTiles [i_32_ ][i_35_ ];
527
529
if (sceneTile != null && sceneTile .draw ) {
528
530
renderTile (sceneTile , false );
529
531
}
530
532
}
531
- if (i_36_ < mapBoundsY ) {
533
+ if (i_36_ < drawToTileY ) {
532
534
SceneTile sceneTile = sceneTiles [i_32_ ][i_36_ ];
533
535
if (sceneTile != null && sceneTile .draw ) {
534
536
renderTile (sceneTile , false );
535
537
}
536
538
}
537
539
}
538
- if (i_33_ < mapBoundsX ) {
539
- if (i_35_ >= currentPositionY ) {
540
+ if (i_33_ < drawToTileX ) {
541
+ if (i_35_ >= drawFromTileY ) {
540
542
SceneTile sceneTile = sceneTiles [i_33_ ][i_35_ ];
541
543
if (sceneTile != null && sceneTile .draw ) {
542
544
renderTile (sceneTile , false );
543
545
}
544
546
}
545
- if (i_36_ < mapBoundsY ) {
547
+ if (i_36_ < drawToTileY ) {
546
548
SceneTile sceneTile = sceneTiles [i_33_ ][i_36_ ];
547
549
if (sceneTile != null && sceneTile .draw ) {
548
550
renderTile (sceneTile , false );
@@ -871,25 +873,25 @@ public void renderTile(SceneTile _tile, boolean arg1) {
871
873
continue ;
872
874
}
873
875
}
874
- if (x <= cameraPositionTileX && x > currentPositionX ) {
876
+ if (x <= cameraPositionTileX && x > drawFromTileX ) {
875
877
SceneTile tile = sceneTiles [x - 1 ][y ];
876
878
if (tile != null && tile .visible && (tile .draw || (groundTile .interactiveObjectsSizeOR & 0x1 ) == 0 )) {
877
879
continue ;
878
880
}
879
881
}
880
- if (x >= cameraPositionTileX && x < mapBoundsX - 1 ) {
882
+ if (x >= cameraPositionTileX && x < drawToTileX - 1 ) {
881
883
SceneTile tile = sceneTiles [x + 1 ][y ];
882
884
if (tile != null && tile .visible && (tile .draw || (groundTile .interactiveObjectsSizeOR & 0x4 ) == 0 )) {
883
885
continue ;
884
886
}
885
887
}
886
- if (y <= cameraPositionTileY && y > currentPositionY ) {
888
+ if (y <= cameraPositionTileY && y > drawFromTileY ) {
887
889
SceneTile tile = sceneTiles [x ][y - 1 ];
888
890
if (tile != null && tile .visible && (tile .draw || (groundTile .interactiveObjectsSizeOR & 0x8 ) == 0 )) {
889
891
continue ;
890
892
}
891
893
}
892
- if (y >= cameraPositionTileY && y < mapBoundsY - 1 ) {
894
+ if (y >= cameraPositionTileY && y < drawToTileY - 1 ) {
893
895
SceneTile tile = sceneTiles [x ][y + 1 ];
894
896
if (tile != null && tile .visible && (tile .draw || (groundTile .interactiveObjectsSizeOR & 0x2 ) == 0 )) {
895
897
continue ;
@@ -1174,25 +1176,25 @@ public void renderTile(SceneTile _tile, boolean arg1) {
1174
1176
}
1175
1177
if (groundTile .visible ) {
1176
1178
if (groundTile .wallCullDirection == 0 ) {
1177
- if (x <= cameraPositionTileX && x > currentPositionX ) {
1179
+ if (x <= cameraPositionTileX && x > drawFromTileX ) {
1178
1180
SceneTile sceneTile_125_ = sceneTiles [x - 1 ][y ];
1179
1181
if (sceneTile_125_ != null && sceneTile_125_ .visible ) {
1180
1182
continue ;
1181
1183
}
1182
1184
}
1183
- if (x >= cameraPositionTileX && x < mapBoundsX - 1 ) {
1185
+ if (x >= cameraPositionTileX && x < drawToTileX - 1 ) {
1184
1186
SceneTile sceneTile_126_ = sceneTiles [x + 1 ][y ];
1185
1187
if (sceneTile_126_ != null && sceneTile_126_ .visible ) {
1186
1188
continue ;
1187
1189
}
1188
1190
}
1189
- if (y <= cameraPositionTileY && y > currentPositionY ) {
1191
+ if (y <= cameraPositionTileY && y > drawFromTileY ) {
1190
1192
SceneTile sceneTile_127_ = sceneTiles [x ][y - 1 ];
1191
1193
if (sceneTile_127_ != null && sceneTile_127_ .visible ) {
1192
1194
continue ;
1193
1195
}
1194
1196
}
1195
- if (y >= cameraPositionTileY && y < mapBoundsY - 1 ) {
1197
+ if (y >= cameraPositionTileY && y < drawToTileY - 1 ) {
1196
1198
SceneTile sceneTile_128_ = sceneTiles [x ][y + 1 ];
1197
1199
if (sceneTile_128_ != null && sceneTile_128_ .visible ) {
1198
1200
continue ;
0 commit comments