@@ -96,8 +96,6 @@ public class Scene {
96
96
97
97
private InteractiveObject [] interactiveObjects = new InteractiveObject [100 ];
98
98
private LinkedList tileList = new LinkedList ();
99
- private int currentCameraTileY ;
100
- private int currentCameraTileX ;
101
99
102
100
private Camera currentCamera ;
103
101
private CameraTileVisibility tileVisibilityInfo ;
@@ -292,21 +290,19 @@ public void render(Camera camera, int plane) {
292
290
293
291
cycle ++;
294
292
currentTileVisibilityMap = tileVisibilityInfo .visibilityInfo [(pitch - 128 ) / 32 ][yaw / 64 ];
295
- currentCameraTileX = cameraPos .x / 128 ;
296
- currentCameraTileY = cameraPos .y / 128 ;
297
- drawFromTileX = currentCameraTileX - TILE_DRAW_DISTANCE ;
293
+ drawFromTileX = currentCamera .getPosition ().tileX - TILE_DRAW_DISTANCE ;
298
294
if (drawFromTileX < 0 ) {
299
295
drawFromTileX = 0 ;
300
296
}
301
- drawFromTileY = currentCameraTileY - TILE_DRAW_DISTANCE ;
297
+ drawFromTileY = currentCamera . getPosition (). tileY - TILE_DRAW_DISTANCE ;
302
298
if (drawFromTileY < 0 ) {
303
299
drawFromTileY = 0 ;
304
300
}
305
- drawToTileX = currentCameraTileX + TILE_DRAW_DISTANCE ;
301
+ drawToTileX = currentCamera . getPosition (). tileX + TILE_DRAW_DISTANCE ;
306
302
if (drawToTileX > mapSizeX ) {
307
303
drawToTileX = mapSizeX ;
308
304
}
309
- drawToTileY = currentCameraTileY + TILE_DRAW_DISTANCE ;
305
+ drawToTileY = currentCamera . getPosition (). tileY + TILE_DRAW_DISTANCE ;
310
306
if (drawToTileY > mapSizeY ) {
311
307
drawToTileY = mapSizeY ;
312
308
}
@@ -318,7 +314,7 @@ public void render(Camera camera, int plane) {
318
314
for (int y = drawFromTileY ; y < drawToTileY ; y ++) {
319
315
SceneTile sceneTile = sceneTiles [x ][y ];
320
316
if (sceneTile != null ) {
321
- if (sceneTile .drawLevel > plane || !currentTileVisibilityMap [x - currentCameraTileX + TILE_DRAW_DISTANCE ][y - currentCameraTileY + TILE_DRAW_DISTANCE ] && heightMap [z ][x ][y ] - cameraPosZ < 70000 ) {
317
+ if (sceneTile .drawLevel > plane || !currentTileVisibilityMap [x - currentCamera . getPosition (). tileX + TILE_DRAW_DISTANCE ][y - currentCamera . getPosition (). tileY + TILE_DRAW_DISTANCE ] && heightMap [z ][x ][y ] - cameraPosZ < 70000 ) {
322
318
sceneTile .draw = false ;
323
319
sceneTile .visible = false ;
324
320
sceneTile .wallCullDirection = 0 ;
@@ -335,12 +331,12 @@ public void render(Camera camera, int plane) {
335
331
for (int i = this .plane ; i < mapSizeZ ; i ++) {
336
332
SceneTile [][] sceneTiles = tileArray [i ];
337
333
for (int i_25_ = -TILE_DRAW_DISTANCE ; i_25_ <= 0 ; i_25_ ++) {
338
- int i_26_ = currentCameraTileX + i_25_ ;
339
- int i_27_ = currentCameraTileX - i_25_ ;
334
+ int i_26_ = currentCamera . getPosition (). tileX + i_25_ ;
335
+ int i_27_ = currentCamera . getPosition (). tileX - i_25_ ;
340
336
if (i_26_ >= drawFromTileX || i_27_ < drawToTileX ) {
341
337
for (int i_28_ = -TILE_DRAW_DISTANCE ; i_28_ <= 0 ; i_28_ ++) {
342
- int i_29_ = currentCameraTileY + i_28_ ;
343
- int i_30_ = currentCameraTileY - i_28_ ;
338
+ int i_29_ = currentCamera . getPosition (). tileY + i_28_ ;
339
+ int i_30_ = currentCamera . getPosition (). tileY - i_28_ ;
344
340
if (i_26_ >= drawFromTileX ) {
345
341
if (i_29_ >= drawFromTileY ) {
346
342
SceneTile sceneTile = sceneTiles [i_26_ ][i_29_ ];
@@ -380,12 +376,12 @@ public void render(Camera camera, int plane) {
380
376
for (int i = this .plane ; i < mapSizeZ ; i ++) {
381
377
SceneTile [][] sceneTiles = tileArray [i ];
382
378
for (int i_31_ = -TILE_DRAW_DISTANCE ; i_31_ <= 0 ; i_31_ ++) {
383
- int i_32_ = currentCameraTileX + i_31_ ;
384
- int i_33_ = currentCameraTileX - i_31_ ;
379
+ int i_32_ = currentCamera . getPosition (). tileX + i_31_ ;
380
+ int i_33_ = currentCamera . getPosition (). tileX - i_31_ ;
385
381
if (i_32_ >= drawFromTileX || i_33_ < drawToTileX ) {
386
382
for (int i_34_ = -TILE_DRAW_DISTANCE ; i_34_ <= 0 ; i_34_ ++) {
387
- int i_35_ = currentCameraTileY + i_34_ ;
388
- int i_36_ = currentCameraTileY - i_34_ ;
383
+ int i_35_ = currentCamera . getPosition (). tileY + i_34_ ;
384
+ int i_36_ = currentCamera . getPosition (). tileY - i_34_ ;
389
385
if (i_32_ >= drawFromTileX ) {
390
386
if (i_35_ >= drawFromTileY ) {
391
387
SceneTile sceneTile = sceneTiles [i_32_ ][i_35_ ];
@@ -736,25 +732,25 @@ public void renderTile(SceneTile _tile, boolean arg1) {
736
732
continue ;
737
733
}
738
734
}
739
- if (x <= currentCameraTileX && x > drawFromTileX ) {
735
+ if (x <= currentCamera . getPosition (). tileX && x > drawFromTileX ) {
740
736
SceneTile tile = sceneTiles [x - 1 ][y ];
741
737
if (tile != null && tile .visible && (tile .draw || (groundTile .interactiveObjectsSizeOR & 0x1 ) == 0 )) {
742
738
continue ;
743
739
}
744
740
}
745
- if (x >= currentCameraTileX && x < drawToTileX - 1 ) {
741
+ if (x >= currentCamera . getPosition (). tileX && x < drawToTileX - 1 ) {
746
742
SceneTile tile = sceneTiles [x + 1 ][y ];
747
743
if (tile != null && tile .visible && (tile .draw || (groundTile .interactiveObjectsSizeOR & 0x4 ) == 0 )) {
748
744
continue ;
749
745
}
750
746
}
751
- if (y <= currentCameraTileY && y > drawFromTileY ) {
747
+ if (y <= currentCamera . getPosition (). tileY && y > drawFromTileY ) {
752
748
SceneTile tile = sceneTiles [x ][y - 1 ];
753
749
if (tile != null && tile .visible && (tile .draw || (groundTile .interactiveObjectsSizeOR & 0x8 ) == 0 )) {
754
750
continue ;
755
751
}
756
752
}
757
- if (y >= currentCameraTileY && y < drawToTileY - 1 ) {
753
+ if (y >= currentCamera . getPosition (). tileY && y < drawToTileY - 1 ) {
758
754
SceneTile tile = sceneTiles [x ][y + 1 ];
759
755
if (tile != null && tile .visible && (tile .draw || (groundTile .interactiveObjectsSizeOR & 0x2 ) == 0 )) {
760
756
continue ;
@@ -803,14 +799,14 @@ public void renderTile(SceneTile _tile, boolean arg1) {
803
799
Wall wall = groundTile .wall ;
804
800
WallDecoration wallDecoration = groundTile .wallDecoration ;
805
801
if (wall != null || wallDecoration != null ) {
806
- if (currentCameraTileX == x ) {
802
+ if (currentCamera . getPosition (). tileX == x ) {
807
803
i_86_ ++;
808
- } else if (currentCameraTileX < x ) {
804
+ } else if (currentCamera . getPosition (). tileX < x ) {
809
805
i_86_ += 2 ;
810
806
}
811
- if (currentCameraTileY == y ) {
807
+ if (currentCamera . getPosition (). tileY == y ) {
812
808
i_86_ += 3 ;
813
- } else if (currentCameraTileY > y ) {
809
+ } else if (currentCamera . getPosition (). tileY > y ) {
814
810
i_86_ += 6 ;
815
811
}
816
812
i_87_ = FRONT_WALL_TYPES [i_86_ ];
@@ -897,25 +893,25 @@ public void renderTile(SceneTile _tile, boolean arg1) {
897
893
}
898
894
int i_98_ = groundTile .interactiveObjectsSizeOR ;
899
895
if (i_98_ != 0 ) {
900
- if (x < currentCameraTileX && (i_98_ & 0x4 ) != 0 ) {
896
+ if (x < currentCamera . getPosition (). tileX && (i_98_ & 0x4 ) != 0 ) {
901
897
SceneTile sceneTile_99_ = sceneTiles [x + 1 ][y ];
902
898
if (sceneTile_99_ != null && sceneTile_99_ .visible ) {
903
899
tileList .addLast (sceneTile_99_ );
904
900
}
905
901
}
906
- if (y < currentCameraTileY && (i_98_ & 0x2 ) != 0 ) {
902
+ if (y < currentCamera . getPosition (). tileY && (i_98_ & 0x2 ) != 0 ) {
907
903
SceneTile sceneTile_100_ = sceneTiles [x ][y + 1 ];
908
904
if (sceneTile_100_ != null && sceneTile_100_ .visible ) {
909
905
tileList .addLast (sceneTile_100_ );
910
906
}
911
907
}
912
- if (x > currentCameraTileX && (i_98_ & 0x1 ) != 0 ) {
908
+ if (x > currentCamera . getPosition (). tileX && (i_98_ & 0x1 ) != 0 ) {
913
909
SceneTile sceneTile_101_ = sceneTiles [x - 1 ][y ];
914
910
if (sceneTile_101_ != null && sceneTile_101_ .visible ) {
915
911
tileList .addLast (sceneTile_101_ );
916
912
}
917
913
}
918
- if (y > currentCameraTileY && (i_98_ & 0x8 ) != 0 ) {
914
+ if (y > currentCamera . getPosition (). tileY && (i_98_ & 0x8 ) != 0 ) {
919
915
SceneTile tile = sceneTiles [x ][y - 1 ];
920
916
if (tile != null && tile .visible ) {
921
917
tileList .addLast (tile );
@@ -977,13 +973,13 @@ public void renderTile(SceneTile _tile, boolean arg1) {
977
973
}
978
974
}
979
975
interactiveObjects [i_105_ ++] = entity ;
980
- int i_111_ = currentCameraTileX - entity .tileLeft ;
981
- int i_112_ = entity .tileRight - currentCameraTileX ;
976
+ int i_111_ = currentCamera . getPosition (). tileX - entity .tileLeft ;
977
+ int i_112_ = entity .tileRight - currentCamera . getPosition (). tileX ;
982
978
if (i_112_ > i_111_ ) {
983
979
i_111_ = i_112_ ;
984
980
}
985
- int i_113_ = currentCameraTileY - entity .tileTop ;
986
- int i_114_ = entity .tileBottom - currentCameraTileY ;
981
+ int i_113_ = currentCamera . getPosition (). tileY - entity .tileTop ;
982
+ int i_114_ = entity .tileBottom - currentCamera . getPosition (). tileY ;
987
983
if (i_114_ > i_113_ ) {
988
984
entity .anInt491 = i_111_ + i_114_ ;
989
985
} else {
@@ -1039,25 +1035,25 @@ public void renderTile(SceneTile _tile, boolean arg1) {
1039
1035
}
1040
1036
if (groundTile .visible ) {
1041
1037
if (groundTile .wallCullDirection == 0 ) {
1042
- if (x <= currentCameraTileX && x > drawFromTileX ) {
1038
+ if (x <= currentCamera . getPosition (). tileX && x > drawFromTileX ) {
1043
1039
SceneTile sceneTile_125_ = sceneTiles [x - 1 ][y ];
1044
1040
if (sceneTile_125_ != null && sceneTile_125_ .visible ) {
1045
1041
continue ;
1046
1042
}
1047
1043
}
1048
- if (x >= currentCameraTileX && x < drawToTileX - 1 ) {
1044
+ if (x >= currentCamera . getPosition (). tileX && x < drawToTileX - 1 ) {
1049
1045
SceneTile sceneTile_126_ = sceneTiles [x + 1 ][y ];
1050
1046
if (sceneTile_126_ != null && sceneTile_126_ .visible ) {
1051
1047
continue ;
1052
1048
}
1053
1049
}
1054
- if (y <= currentCameraTileY && y > drawFromTileY ) {
1050
+ if (y <= currentCamera . getPosition (). tileY && y > drawFromTileY ) {
1055
1051
SceneTile sceneTile_127_ = sceneTiles [x ][y - 1 ];
1056
1052
if (sceneTile_127_ != null && sceneTile_127_ .visible ) {
1057
1053
continue ;
1058
1054
}
1059
1055
}
1060
- if (y >= currentCameraTileY && y < drawToTileY - 1 ) {
1056
+ if (y >= currentCamera . getPosition (). tileY && y < drawToTileY - 1 ) {
1061
1057
SceneTile sceneTile_128_ = sceneTiles [x ][y + 1 ];
1062
1058
if (sceneTile_128_ != null && sceneTile_128_ .visible ) {
1063
1059
continue ;
@@ -1127,25 +1123,25 @@ public void renderTile(SceneTile _tile, boolean arg1) {
1127
1123
tileList .addLast (sceneTile_139_ );
1128
1124
}
1129
1125
}
1130
- if (x < currentCameraTileX ) {
1126
+ if (x < currentCamera . getPosition (). tileX ) {
1131
1127
SceneTile sceneTile_140_ = sceneTiles [x + 1 ][y ];
1132
1128
if (sceneTile_140_ != null && sceneTile_140_ .visible ) {
1133
1129
tileList .addLast (sceneTile_140_ );
1134
1130
}
1135
1131
}
1136
- if (y < currentCameraTileY ) {
1132
+ if (y < currentCamera . getPosition (). tileY ) {
1137
1133
SceneTile sceneTile_141_ = sceneTiles [x ][y + 1 ];
1138
1134
if (sceneTile_141_ != null && sceneTile_141_ .visible ) {
1139
1135
tileList .addLast (sceneTile_141_ );
1140
1136
}
1141
1137
}
1142
- if (x > currentCameraTileX ) {
1138
+ if (x > currentCamera . getPosition (). tileX ) {
1143
1139
SceneTile sceneTile_142_ = sceneTiles [x - 1 ][y ];
1144
1140
if (sceneTile_142_ != null && sceneTile_142_ .visible ) {
1145
1141
tileList .addLast (sceneTile_142_ );
1146
1142
}
1147
1143
}
1148
- if (y > currentCameraTileY ) {
1144
+ if (y > currentCamera . getPosition (). tileY ) {
1149
1145
SceneTile sceneTile_143_ = sceneTiles [x ][y - 1 ];
1150
1146
if (sceneTile_143_ != null && sceneTile_143_ .visible ) {
1151
1147
tileList .addLast (sceneTile_143_ );
@@ -1427,13 +1423,13 @@ public void processCulling(int plane) {
1427
1423
for (int i_172_ = 0 ; i_172_ < i ; i_172_ ++) {
1428
1424
SceneCluster sceneCluster = sceneClusters [i_172_ ];
1429
1425
if (sceneCluster .searchMask == 1 ) {
1430
- int i_173_ = sceneCluster .tileStartX - currentCameraTileX + TILE_DRAW_DISTANCE ;
1426
+ int i_173_ = sceneCluster .tileStartX - currentCamera . getPosition (). tileX + TILE_DRAW_DISTANCE ;
1431
1427
if (i_173_ >= 0 && i_173_ <= 50 ) {
1432
- int i_174_ = sceneCluster .tileStartY - currentCameraTileY + TILE_DRAW_DISTANCE ;
1428
+ int i_174_ = sceneCluster .tileStartY - currentCamera . getPosition (). tileY + TILE_DRAW_DISTANCE ;
1433
1429
if (i_174_ < 0 ) {
1434
1430
i_174_ = 0 ;
1435
1431
}
1436
- int i_175_ = sceneCluster .tileEndY - currentCameraTileY + TILE_DRAW_DISTANCE ;
1432
+ int i_175_ = sceneCluster .tileEndY - currentCamera . getPosition (). tileY + TILE_DRAW_DISTANCE ;
1437
1433
if (i_175_ > 50 ) {
1438
1434
i_175_ = 50 ;
1439
1435
}
@@ -1463,13 +1459,13 @@ public void processCulling(int plane) {
1463
1459
}
1464
1460
}
1465
1461
} else if (sceneCluster .searchMask == 2 ) {
1466
- int i_177_ = sceneCluster .tileStartY - currentCameraTileY + TILE_DRAW_DISTANCE ;
1462
+ int i_177_ = sceneCluster .tileStartY - currentCamera . getPosition (). tileY + TILE_DRAW_DISTANCE ;
1467
1463
if (i_177_ >= 0 && i_177_ <= 50 ) {
1468
- int i_178_ = sceneCluster .tileStartX - currentCameraTileX + TILE_DRAW_DISTANCE ;
1464
+ int i_178_ = sceneCluster .tileStartX - currentCamera . getPosition (). tileX + TILE_DRAW_DISTANCE ;
1469
1465
if (i_178_ < 0 ) {
1470
1466
i_178_ = 0 ;
1471
1467
}
1472
- int i_179_ = sceneCluster .tileEndX - currentCameraTileX + TILE_DRAW_DISTANCE ;
1468
+ int i_179_ = sceneCluster .tileEndX - currentCamera . getPosition (). tileX + TILE_DRAW_DISTANCE ;
1473
1469
if (i_179_ > 50 ) {
1474
1470
i_179_ = 50 ;
1475
1471
}
@@ -1501,20 +1497,20 @@ public void processCulling(int plane) {
1501
1497
} else if (sceneCluster .searchMask == 4 ) {
1502
1498
int i_181_ = sceneCluster .worldEndZ - currentCamera .getPosition ().z ;
1503
1499
if (i_181_ > 128 ) {
1504
- int i_182_ = sceneCluster .tileStartY - currentCameraTileY + TILE_DRAW_DISTANCE ;
1500
+ int i_182_ = sceneCluster .tileStartY - currentCamera . getPosition (). tileY + TILE_DRAW_DISTANCE ;
1505
1501
if (i_182_ < 0 ) {
1506
1502
i_182_ = 0 ;
1507
1503
}
1508
- int i_183_ = sceneCluster .tileEndY - currentCameraTileY + TILE_DRAW_DISTANCE ;
1504
+ int i_183_ = sceneCluster .tileEndY - currentCamera . getPosition (). tileY + TILE_DRAW_DISTANCE ;
1509
1505
if (i_183_ > 50 ) {
1510
1506
i_183_ = 50 ;
1511
1507
}
1512
1508
if (i_182_ <= i_183_ ) {
1513
- int i_184_ = sceneCluster .tileStartX - currentCameraTileX + TILE_DRAW_DISTANCE ;
1509
+ int i_184_ = sceneCluster .tileStartX - currentCamera . getPosition (). tileX + TILE_DRAW_DISTANCE ;
1514
1510
if (i_184_ < 0 ) {
1515
1511
i_184_ = 0 ;
1516
1512
}
1517
- int i_185_ = sceneCluster .tileEndX - currentCameraTileX + TILE_DRAW_DISTANCE ;
1513
+ int i_185_ = sceneCluster .tileEndX - currentCamera . getPosition (). tileX + TILE_DRAW_DISTANCE ;
1518
1514
if (i_185_ > 50 ) {
1519
1515
i_185_ = 50 ;
1520
1516
}
0 commit comments