Reverted: Occluder Threshold
Constants: LocType Type
This commit is contained in:
1 parent
2c7e3211b3
commit
eb802eccd3
4 files changed
+624
-650
No files matched your search
+478
-454
File diff suppressed because it is too large.
Load diff
+87
-105
@@ -6,10 +6,10 @@ import java.util.Arrays;
|
||||
|
||||
public class Scene {
|
||||
|
||||
public static final int[] DIAGONAL_WALL_DECORATION0_ROTATION_OFFSET_X = {53, -53, -53, 53};
|
||||
public static final int[] DIAGONAL_WALL_DECORATION0_ROTATION_OFFSET_Z = {-53, -53, 53, 53};
|
||||
public static final int[] DIAGONAL_WALL_DECORATION1_ROTATION_OFFSET_X = {-45, 45, 45, -45};
|
||||
public static final int[] DIAGONAL_WALL_DECORATION1_ROTATION_OFFSET_Z = {45, 45, -45, -45};
|
||||
public static final int[] WALL_DECORATION_INSET_X = {53, -53, -53, 53};
|
||||
public static final int[] WALL_DECORATION_INSET_Z = {-53, -53, 53, 53};
|
||||
public static final int[] WALL_DECORATION_OUTSET_X = {-45, 45, 45, -45};
|
||||
public static final int[] WALL_DECORATION_OUTSET_Z = {45, 45, -45, -45};
|
||||
/**
|
||||
* Occlusion flags for walls of kind 0, 2 and decorations 4, 5,
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ public class Scene {
|
||||
1 << 6,
|
||||
1 << 7,
|
||||
};
|
||||
public static final int[] DIRECTION_ALLOW_WALL_TYPE_PRIMARY = {
|
||||
public static final int[] FRONT_WALL_TYPES = {
|
||||
0b00010011, // eyeTileX > tileX && eyeTileZ < tileZ
|
||||
0b00110111, // eyeTileX == tileX && eyeTileZ < tileZ
|
||||
0b00100110, // eyeTileX < tileX && eyeTileZ < tileZ
|
||||
@@ -50,7 +50,7 @@ public class Scene {
|
||||
0b00110000, // eyeTileX = tileX && eyeTileZ > tileZ
|
||||
0b10100000, // eyeTileX < tileX && eyeTileZ > tileZ
|
||||
};
|
||||
public static final int[] DIRECTION_ALLOW_WALL_TYPE_SECONDARY = {
|
||||
public static final int[] BACK_WALL_TYPES = {
|
||||
0b01001100, // eyeTileX > tileX && eyeTileZ < tileZ
|
||||
0b00001000, // eyeTileX == tileX && eyeTileZ < tileZ
|
||||
0b10001001, // eyeTileX < tileX && eyeTileZ < tileZ
|
||||
@@ -469,25 +469,25 @@ public class Scene {
|
||||
levelTiles[level][tileX][tileZ].wall = wall;
|
||||
}
|
||||
|
||||
public void setWallDecoration(int type, Entity entity, int level, int tileX, int tileZ, int y, int yaw, int offsetX, int offsetZ, int bitset, byte info) {
|
||||
public void setWallDecoration(int type, Entity entity, int level, int tileX, int tileZ, int y, int rotation, int offsetX, int offsetZ, int bitset, byte info) {
|
||||
if (entity == null) {
|
||||
return;
|
||||
}
|
||||
SceneWallDecoration deco = new SceneWallDecoration();
|
||||
deco.bitset = bitset;
|
||||
deco.info = info;
|
||||
deco.x = (tileX * 128) + 64 + offsetX;
|
||||
deco.z = (tileZ * 128) + 64 + offsetZ;
|
||||
deco.y = y;
|
||||
deco.entity = entity;
|
||||
deco.type = type;
|
||||
deco.rotation = yaw;
|
||||
SceneWallDecoration decor = new SceneWallDecoration();
|
||||
decor.bitset = bitset;
|
||||
decor.info = info;
|
||||
decor.x = (tileX * 128) + 64 + offsetX;
|
||||
decor.z = (tileZ * 128) + 64 + offsetZ;
|
||||
decor.y = y;
|
||||
decor.entity = entity;
|
||||
decor.type = type;
|
||||
decor.rotation = rotation;
|
||||
for (int p = level; p >= 0; p--) {
|
||||
if (levelTiles[p][tileX][tileZ] == null) {
|
||||
levelTiles[p][tileX][tileZ] = new SceneTile(p, tileX, tileZ);
|
||||
}
|
||||
}
|
||||
levelTiles[level][tileX][tileZ].wallDecoration = deco;
|
||||
levelTiles[level][tileX][tileZ].wallDecoration = decor;
|
||||
}
|
||||
|
||||
public boolean add(Entity entity, int level, int tileX, int tileZ, int y, int width, int length, int yaw, int bitset, byte info) {
|
||||
@@ -654,12 +654,12 @@ public class Scene {
|
||||
if (tile == null) {
|
||||
return;
|
||||
}
|
||||
SceneWallDecoration decoration = tile.wallDecoration;
|
||||
if (decoration != null) {
|
||||
SceneWallDecoration decor = tile.wallDecoration;
|
||||
if (decor != null) {
|
||||
int sx = (stx * 128) + 64;
|
||||
int sz = (stz * 128) + 64;
|
||||
decoration.x = sx + (((decoration.x - sx) * offset) / 16);
|
||||
decoration.z = sz + (((decoration.z - sz) * offset) / 16);
|
||||
decor.x = sx + (((decor.x - sx) * offset) / 16);
|
||||
decor.z = sz + (((decor.z - sz) * offset) / 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1366,12 +1366,12 @@ public class Scene {
|
||||
boolean tileDrawn = drawTileUnderlayOrOverlay(tile, tileX, tileZ, occludeLevel);
|
||||
|
||||
int direction = 0;
|
||||
int allowWallTypes = 0;
|
||||
int frontWallTypes = 0;
|
||||
|
||||
SceneWall wall = tile.wall;
|
||||
SceneWallDecoration wallDecoration = tile.wallDecoration;
|
||||
SceneWallDecoration decor = tile.wallDecoration;
|
||||
|
||||
if ((wall != null) || (wallDecoration != null)) {
|
||||
if ((wall != null) || (decor != null)) {
|
||||
if (eyeTileX == tileX) {
|
||||
direction++;
|
||||
} else if (eyeTileX < tileX) {
|
||||
@@ -1384,12 +1384,8 @@ public class Scene {
|
||||
direction += 6;
|
||||
}
|
||||
|
||||
// Essentially what's happening here is when there are multiple wall types on the same tile, we have
|
||||
// to decide which ones to draw in which order. allowWallTypes determines the first walls that draw,
|
||||
// and then tile.allowWallTypes determines the second walls to draw. This order is dependent on the
|
||||
// direction the camera is relative to the tile.
|
||||
allowWallTypes = DIRECTION_ALLOW_WALL_TYPE_PRIMARY[direction];
|
||||
tile.allowWallTypes = DIRECTION_ALLOW_WALL_TYPE_SECONDARY[direction];
|
||||
frontWallTypes = FRONT_WALL_TYPES[direction];
|
||||
tile.backWallTypes = BACK_WALL_TYPES[direction];
|
||||
}
|
||||
|
||||
if (wall != null) {
|
||||
@@ -1423,26 +1419,24 @@ public class Scene {
|
||||
tile.checkLocSpans = 0;
|
||||
}
|
||||
|
||||
if (((wall.typeA & allowWallTypes) != 0) && !wallOccluded(occludeLevel, tileX, tileZ, wall.typeA)) {
|
||||
if (((wall.typeA & frontWallTypes) != 0) && !wallOccluded(occludeLevel, tileX, tileZ, wall.typeA)) {
|
||||
wall.entityA.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
}
|
||||
|
||||
if (((wall.typeB & allowWallTypes) != 0) && !wallOccluded(occludeLevel, tileX, tileZ, wall.typeB)) {
|
||||
if (((wall.typeB & frontWallTypes) != 0) && !wallOccluded(occludeLevel, tileX, tileZ, wall.typeB)) {
|
||||
wall.entityB.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
}
|
||||
}
|
||||
|
||||
if (wallDecoration != null) {
|
||||
if (!occluded(occludeLevel, tileX, tileZ, wallDecoration.entity.minY)) {
|
||||
drawWallDecoration(allowWallTypes, wallDecoration);
|
||||
}
|
||||
if (decor != null && !occluded(occludeLevel, tileX, tileZ, decor.entity.minY)) {
|
||||
drawWallDecor(frontWallTypes, decor, true);
|
||||
}
|
||||
|
||||
if (tileDrawn) {
|
||||
SceneGroundDecoration groundDecoration = tile.groundDecoration;
|
||||
SceneGroundDecoration groundDecor = tile.groundDecoration;
|
||||
|
||||
if (groundDecoration != null) {
|
||||
groundDecoration.entity.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, groundDecoration.x - eyeX, groundDecoration.y - eyeY, groundDecoration.z - eyeZ, groundDecoration.bitset);
|
||||
if (groundDecor != null) {
|
||||
groundDecor.entity.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, groundDecor.x - eyeX, groundDecor.y - eyeY, groundDecor.z - eyeZ, groundDecor.bitset);
|
||||
}
|
||||
|
||||
SceneObjStack stack = tile.objStack;
|
||||
@@ -1455,28 +1449,28 @@ public class Scene {
|
||||
int spans = tile.locSpans;
|
||||
|
||||
if (spans != 0) {
|
||||
if ((tileX < eyeTileX) && ((spans & 4) != 0)) {
|
||||
if ((tileX < eyeTileX) && ((spans & 0x4) != 0)) {
|
||||
SceneTile adjacent = tiles[tileX + 1][tileZ];
|
||||
if ((adjacent != null) && adjacent.update) {
|
||||
drawTileQueue.pushBack(adjacent);
|
||||
}
|
||||
}
|
||||
|
||||
if ((tileZ < eyeTileZ) && ((spans & 2) != 0)) {
|
||||
if ((tileZ < eyeTileZ) && ((spans & 0x2) != 0)) {
|
||||
SceneTile adjacent = tiles[tileX][tileZ + 1];
|
||||
if ((adjacent != null) && adjacent.update) {
|
||||
drawTileQueue.pushBack(adjacent);
|
||||
}
|
||||
}
|
||||
|
||||
if ((tileX > eyeTileX) && ((spans & 1) != 0)) {
|
||||
if ((tileX > eyeTileX) && ((spans & 0x1) != 0)) {
|
||||
SceneTile adjacent = tiles[tileX - 1][tileZ];
|
||||
if ((adjacent != null) && adjacent.update) {
|
||||
drawTileQueue.pushBack(adjacent);
|
||||
}
|
||||
}
|
||||
|
||||
if ((tileZ > eyeTileZ) && ((spans & 8) != 0)) {
|
||||
if ((tileZ > eyeTileZ) && ((spans & 0x8) != 0)) {
|
||||
SceneTile adjacent = tiles[tileX][tileZ - 1];
|
||||
if ((adjacent != null) && adjacent.update) {
|
||||
drawTileQueue.pushBack(adjacent);
|
||||
@@ -1606,8 +1600,8 @@ public class Scene {
|
||||
SceneLoc farthest = locBuffer[farthestIndex];
|
||||
farthest.cycle = cycle;
|
||||
|
||||
if (!occluded(occludeLevel, farthest.minSceneTileX, farthest.maxSceneTileX, farthest.minSceneTileZ, farthest.maxSceneTileZ, farthest.entity.minY)) {
|
||||
farthest.entity.draw(farthest.yaw, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, farthest.x - eyeX, farthest.y - eyeY, farthest.z - eyeZ, farthest.bitset);
|
||||
if (!occluded(occludeLevel, farthest.minSceneTileX, farthest.maxSceneTileX, farthest.minSceneTileZ, farthest.maxSceneTileZ, farthest.entity.minY)) {
|
||||
farthest.entity.draw(farthest.yaw, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, farthest.x - eyeX, farthest.y - eyeY, farthest.z - eyeZ, farthest.bitset);
|
||||
}
|
||||
|
||||
for (int x = farthest.minSceneTileX; x <= farthest.maxSceneTileX; x++) {
|
||||
@@ -1672,54 +1666,21 @@ public class Scene {
|
||||
drawObjStack(stack, stack.offset);
|
||||
}
|
||||
|
||||
if (tile.allowWallTypes != 0) {
|
||||
SceneWallDecoration wallDecoration = tile.wallDecoration;
|
||||
if (tile.backWallTypes != 0) {
|
||||
SceneWallDecoration decor = tile.wallDecoration;
|
||||
|
||||
if ((wallDecoration != null) && !occluded(occludeLevel, tileX, tileZ, wallDecoration.entity.minY)) {
|
||||
if ((wallDecoration.type & tile.allowWallTypes) != 0) {
|
||||
wallDecoration.entity.draw(wallDecoration.rotation, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wallDecoration.x - eyeX, wallDecoration.y - eyeY, wallDecoration.z - eyeZ, wallDecoration.bitset);
|
||||
} else if ((wallDecoration.type & 0x300) != 0) {
|
||||
int dx = wallDecoration.x - eyeX;
|
||||
int dy = wallDecoration.y - eyeY;
|
||||
int dz = wallDecoration.z - eyeZ;
|
||||
|
||||
int rotation = wallDecoration.rotation;
|
||||
int nearestX;
|
||||
int nearestZ;
|
||||
|
||||
if ((rotation == 1) || (rotation == 2)) {
|
||||
nearestX = -dx;
|
||||
} else {
|
||||
nearestX = dx;
|
||||
}
|
||||
|
||||
if ((rotation == 2) || (rotation == 3)) {
|
||||
nearestZ = -dz;
|
||||
} else {
|
||||
nearestZ = dz;
|
||||
}
|
||||
|
||||
if (((wallDecoration.type & 0x100) != 0) && (nearestZ >= nearestX)) {
|
||||
int x = dx + DIAGONAL_WALL_DECORATION0_ROTATION_OFFSET_X[rotation];
|
||||
int z = dz + DIAGONAL_WALL_DECORATION0_ROTATION_OFFSET_Z[rotation];
|
||||
wallDecoration.entity.draw((rotation * 512) + 256, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, x, dy, z, wallDecoration.bitset);
|
||||
}
|
||||
|
||||
if (((wallDecoration.type & 0x200) != 0) && (nearestZ <= nearestX)) {
|
||||
int x = dx + DIAGONAL_WALL_DECORATION1_ROTATION_OFFSET_X[rotation];
|
||||
int z = dz + DIAGONAL_WALL_DECORATION1_ROTATION_OFFSET_Z[rotation];
|
||||
wallDecoration.entity.draw(((rotation * 512) + 1280) & 0x7ff, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, x, dy, z, wallDecoration.bitset);
|
||||
}
|
||||
}
|
||||
if (decor != null && !occluded(occludeLevel, tileX, tileZ, decor.entity.minY)) {
|
||||
drawWallDecor(tile.backWallTypes, decor, false);
|
||||
}
|
||||
|
||||
SceneWall wall = tile.wall;
|
||||
|
||||
if (wall != null) {
|
||||
if (((wall.typeB & tile.allowWallTypes) != 0) && !wallOccluded(occludeLevel, tileX, tileZ, wall.typeB)) {
|
||||
if (((wall.typeB & tile.backWallTypes) != 0) && !wallOccluded(occludeLevel, tileX, tileZ, wall.typeB)) {
|
||||
wall.entityB.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
}
|
||||
if (((wall.typeA & tile.allowWallTypes) != 0) && !wallOccluded(occludeLevel, tileX, tileZ, wall.typeA)) {
|
||||
|
||||
if (((wall.typeA & tile.backWallTypes) != 0) && !wallOccluded(occludeLevel, tileX, tileZ, wall.typeA)) {
|
||||
wall.entityA.draw(0, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wall.x - eyeX, wall.y - eyeY, wall.z - eyeZ, wall.bitset);
|
||||
}
|
||||
}
|
||||
@@ -1774,39 +1735,60 @@ public class Scene {
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawWallDecoration(int occlusions, SceneWallDecoration wallDecoration) {
|
||||
if ((wallDecoration.type & occlusions) != 0) {
|
||||
wallDecoration.entity.draw(wallDecoration.rotation, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, wallDecoration.x - eyeX, wallDecoration.y - eyeY, wallDecoration.z - eyeZ, wallDecoration.bitset);
|
||||
} else if ((wallDecoration.type & 0x300) != 0) {
|
||||
int dx = wallDecoration.x - eyeX;
|
||||
int y = wallDecoration.y - eyeY;
|
||||
int dz = wallDecoration.z - eyeZ;
|
||||
int rotation = wallDecoration.rotation;
|
||||
private static void drawWallDecor(int allowWallTypes, SceneWallDecoration decor, boolean front) {
|
||||
if ((decor.type & allowWallTypes) != 0) {
|
||||
decor.entity.draw(decor.rotation, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, decor.x - eyeX, decor.y - eyeY, decor.z - eyeZ, decor.bitset);
|
||||
} else if ((decor.type & 0x300) != 0) {
|
||||
int x = decor.x - eyeX;
|
||||
int y = decor.y - eyeY;
|
||||
int z = decor.z - eyeZ;
|
||||
int rotation = decor.rotation;
|
||||
|
||||
int nearestX;
|
||||
int nearestZ;
|
||||
|
||||
if ((rotation == 1) || (rotation == 2)) {
|
||||
nearestX = -dx;
|
||||
nearestX = -x;
|
||||
} else {
|
||||
nearestX = dx;
|
||||
nearestX = x;
|
||||
}
|
||||
|
||||
if ((rotation == 2) || (rotation == 3)) {
|
||||
nearestZ = -dz;
|
||||
nearestZ = -z;
|
||||
} else {
|
||||
nearestZ = dz;
|
||||
nearestZ = z;
|
||||
}
|
||||
|
||||
if (((wallDecoration.type & 0x100) != 0) && (nearestZ < nearestX)) {
|
||||
int x = dx + DIAGONAL_WALL_DECORATION0_ROTATION_OFFSET_X[rotation];
|
||||
int z = dz + DIAGONAL_WALL_DECORATION0_ROTATION_OFFSET_Z[rotation];
|
||||
wallDecoration.entity.draw((rotation * 512) + 256, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, x, y, z, wallDecoration.bitset);
|
||||
if ((decor.type & 0x100) != 0) {
|
||||
boolean draw = false;
|
||||
|
||||
if (front && nearestZ < nearestX) {
|
||||
draw = true;
|
||||
} else if (!front && nearestZ >= nearestX) {
|
||||
draw = true;
|
||||
}
|
||||
|
||||
if (draw) {
|
||||
int drawX = x + WALL_DECORATION_INSET_X[rotation];
|
||||
int drawZ = z + WALL_DECORATION_INSET_Z[rotation];
|
||||
decor.entity.draw((rotation * 512) + 256, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, drawX, y, drawZ, decor.bitset);
|
||||
}
|
||||
}
|
||||
|
||||
if (((wallDecoration.type & 0x200) != 0) && (nearestZ > nearestX)) {
|
||||
int x = dx + DIAGONAL_WALL_DECORATION1_ROTATION_OFFSET_X[rotation];
|
||||
int z = dz + DIAGONAL_WALL_DECORATION1_ROTATION_OFFSET_Z[rotation];
|
||||
wallDecoration.entity.draw(((rotation * 512) + 1280) & 0x7ff, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, x, y, z, wallDecoration.bitset);
|
||||
if ((decor.type & 0x200) != 0) {
|
||||
boolean draw = false;
|
||||
|
||||
if (front && nearestZ > nearestX) {
|
||||
draw = true;
|
||||
} else if (!front && nearestZ <= nearestX) {
|
||||
draw = true;
|
||||
}
|
||||
|
||||
if (draw) {
|
||||
int drawX = x + WALL_DECORATION_OUTSET_X[rotation];
|
||||
int drawZ = z + WALL_DECORATION_OUTSET_Z[rotation];
|
||||
decor.entity.draw(((rotation * 512) + 1280) & 0x7ff, sinEyePitch, cosEyePitch, sinEyeYaw, cosEyeYaw, drawX, y, drawZ, decor.bitset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
public class SceneBuilder {
|
||||
|
||||
public static final int[] WALL_DECORATION_FORWARD_X = {1, 0, -1, 0};
|
||||
public static final int[] WALL_DECORATION_FORWARD_Z = {0, -1, 0, 1};
|
||||
public static final int[] WALL_DECORATION_ROTATION_FORWARD_X = {1, 0, -1, 0};
|
||||
public static final int[] WALL_DECORATION_ROTATION_FORWARD_Z = {0, -1, 0, 1};
|
||||
public static int randomHueOffset = (int) (Math.random() * 17.0) - 8;
|
||||
public static int level;
|
||||
public static int randomLightnessOffset = (int) (Math.random() * 33.0) - 16;
|
||||
@@ -114,7 +114,7 @@ public class SceneBuilder {
|
||||
return (hsl & 0xff80) + lightness;
|
||||
}
|
||||
|
||||
public static void addLoc(Scene scene, int rotation, int z, int kind, int tileLevel, CollisionMap collision, int[][][] levelHeightmap, int x, int locID, int level) {
|
||||
public static void addLoc(Scene scene, int rotation, int z, int type, int tileLevel, CollisionMap collision, int[][][] levelHeightmap, int x, int locID, int level) {
|
||||
int heightSW = levelHeightmap[tileLevel][x][z];
|
||||
int heightSE = levelHeightmap[tileLevel][x + 1][z];
|
||||
int heightNE = levelHeightmap[tileLevel][x + 1][z + 1];
|
||||
@@ -128,24 +128,24 @@ public class SceneBuilder {
|
||||
bitset += 0x80000000;
|
||||
}
|
||||
|
||||
byte info = (byte) ((rotation << 6) + kind);
|
||||
byte info = (byte) ((rotation << 6) + type);
|
||||
|
||||
if (kind == 22) {
|
||||
if (type == LocType.TYPE_GROUND_DECOR) {
|
||||
addGroundDecoration(scene, rotation, z, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if ((kind == 10) || (kind == 11)) {
|
||||
addLoc(scene, rotation, z, kind, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind >= 12) {
|
||||
addDiagonalWall(scene, rotation, z, kind, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 0) {
|
||||
addWall(scene, rotation, z, kind, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 1) {
|
||||
addDiagonalWallCorner(scene, rotation, z, kind, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 2) {
|
||||
addFullWallCorner(scene, rotation, z, kind, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 3) {
|
||||
addWallCorner(scene, rotation, z, kind, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 9) {
|
||||
addDiagonalWall(scene, rotation, z, kind, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if ((type == LocType.TYPE_CENTREPIECE) || (type == LocType.TYPE_CENTREPIECE_DIAGONAL)) {
|
||||
addLoc(scene, rotation, z, type, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (type >= LocType.TYPE_ROOF_STRAIGHT) {
|
||||
addRoofOrDiagonalWall(scene, rotation, z, type, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (type == LocType.TYPE_WALL_STRAIGHT) {
|
||||
addWallStraight(scene, rotation, z, type, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (type == LocType.TYPE_WALL_CORNER_DIAGONAL) {
|
||||
addWallCornerDiagonal(scene, rotation, z, type, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (type == LocType.TYPE_WALL_L) {
|
||||
addWallL(scene, rotation, z, type, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (type == LocType.TYPE_WALL_SQUARE_CORNER) {
|
||||
addWallSquareCorner(scene, rotation, z, type, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (type == LocType.TYPE_WALL_DIAGONAL) {
|
||||
addRoofOrDiagonalWall(scene, rotation, z, type, collision, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else {
|
||||
if (loc.adjustToTerrain) {
|
||||
if (rotation == 1) {
|
||||
@@ -170,16 +170,16 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
if (kind == 4) {
|
||||
addWallDecoration(scene, rotation, z, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 5) {
|
||||
addWallDecorationOutside(scene, rotation, z, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 6) {
|
||||
addDiagonalWallDecorationInside(z, scene, level, x, locID, rotation, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 7) {
|
||||
addDiagonalWallDecorationOutside(z, scene, level, x, locID, rotation, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (kind == 8) {
|
||||
addDiagonalWallDecorationBoth(z, scene, level, x, locID, rotation, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
if (type == LocType.TYPE_WALLDECOR_STRAIGHT) {
|
||||
addWallDecor(scene, Scene.ROTATION_WALL_TYPE[rotation], loc, locID, bitset, info, level, x, z, rotation * 512, heightSW, heightSE, heightNE, heightNW, y);
|
||||
} else if (type == LocType.TYPE_WALLDECOR_STRAIGHT_OFFSET) {
|
||||
addWallDecorOffset(scene, rotation, z, x, locID, level, heightSW, heightSE, heightNE, heightNW, y, loc, bitset, info);
|
||||
} else if (type == LocType.TYPE_WALLDECOR_DIAGONAL_NOOFFSET) {
|
||||
addWallDecor(scene, 0x100, loc, locID, bitset, info, level, x, z, rotation, heightSW, heightSE, heightNE, heightNW, y);
|
||||
} else if (type == LocType.TYPE_WALLDECOR_DIAGONAL_OFFSET) {
|
||||
addWallDecor(scene, 0x200, loc, locID, bitset, info, level, x, z, rotation, heightSW, heightSE, heightNE, heightNW, y);
|
||||
} else if (type == LocType.TYPE_WALLDECOR_DIAGONAL_BOTH) {
|
||||
addWallDecor(scene, 0x300, loc, locID, bitset, info, level, x, z, rotation, heightSW, heightSE, heightNE, heightNW, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,7 +234,7 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addWall(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
private static void addWallStraight(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
Entity entity;
|
||||
|
||||
if ((loc.seqID == -1) && (loc.overrideTypeIDs == null)) {
|
||||
@@ -250,7 +250,7 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addDiagonalWallCorner(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
private static void addWallCornerDiagonal(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
Entity entity;
|
||||
|
||||
if ((loc.seqID == -1) && (loc.overrideTypeIDs == null)) {
|
||||
@@ -266,7 +266,7 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addFullWallCorner(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
private static void addWallL(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
int nextRotation = (rotation + 1) & 0x3;
|
||||
Entity locA;
|
||||
Entity locB;
|
||||
@@ -286,7 +286,7 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addWallCorner(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
private static void addWallSquareCorner(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
Entity entity;
|
||||
|
||||
if ((loc.seqID == -1) && (loc.overrideTypeIDs == null)) {
|
||||
@@ -302,19 +302,7 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addWallDecoration(Scene scene, int rotation, int z, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
Entity entity;
|
||||
|
||||
if ((loc.seqID == -1) && (loc.overrideTypeIDs == null)) {
|
||||
entity = loc.getModel(4, 0, heightSW, heightSE, heightNE, heightNW, -1);
|
||||
} else {
|
||||
entity = new LocEntity(locID, 0, 4, heightSE, heightNE, heightSW, heightNW, loc.seqID, true);
|
||||
}
|
||||
|
||||
scene.setWallDecoration(Scene.ROTATION_WALL_TYPE[rotation], entity, level, x, z, y, rotation * 512, 0, 0, bitset, info);
|
||||
}
|
||||
|
||||
private static void addDiagonalWall(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
private static void addRoofOrDiagonalWall(Scene scene, int rotation, int z, int kind, CollisionMap collision, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
Entity entity;
|
||||
|
||||
if ((loc.seqID == -1) && (loc.overrideTypeIDs == null)) {
|
||||
@@ -330,12 +318,12 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addWallDecorationOutside(Scene scene, int rotation, int z, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
int padding = 16;
|
||||
private static void addWallDecorOffset(Scene scene, int rotation, int z, int x, int locID, int level, int heightSW, int heightSE, int heightNE, int heightNW, int y, LocType loc, int bitset, byte info) {
|
||||
int offset = 16;
|
||||
int wallBitset = scene.getWallBitset(level, x, z);
|
||||
|
||||
if (wallBitset > 0) {
|
||||
padding = LocType.get((wallBitset >> 14) & 0x7fff).decorationPadding;
|
||||
offset = LocType.get((wallBitset >> 14) & 0x7fff).decorOffset;
|
||||
}
|
||||
|
||||
Entity entity;
|
||||
@@ -346,7 +334,7 @@ public class SceneBuilder {
|
||||
entity = new LocEntity(locID, 0, 4, heightSE, heightNE, heightSW, heightNW, loc.seqID, true);
|
||||
}
|
||||
|
||||
scene.setWallDecoration(Scene.ROTATION_WALL_TYPE[rotation], entity, level, x, z, y, rotation * 512, WALL_DECORATION_FORWARD_X[rotation] * padding, WALL_DECORATION_FORWARD_Z[rotation] * padding, bitset, info);
|
||||
scene.setWallDecoration(Scene.ROTATION_WALL_TYPE[rotation], entity, level, x, z, y, rotation * 512, WALL_DECORATION_ROTATION_FORWARD_X[rotation] * offset, WALL_DECORATION_ROTATION_FORWARD_Z[rotation] * offset, bitset, info);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -782,7 +770,7 @@ public class SceneBuilder {
|
||||
|
||||
int area = ((maxLevel + 1) - minLevel) * ((maxTileZ - minTileZ) + 1);
|
||||
|
||||
if (area >= 2) {
|
||||
if (area >= 8) {
|
||||
int minY = levelHeightmap[maxLevel][tileX][minTileZ] - 240;
|
||||
int maxY = levelHeightmap[minLevel][tileX][minTileZ];
|
||||
|
||||
@@ -835,7 +823,7 @@ public class SceneBuilder {
|
||||
|
||||
int area = ((maxLevel + 1) - minLevel) * ((maxTileX - minTileX) + 1);
|
||||
|
||||
if (area >= 2) {
|
||||
if (area >= 8) {
|
||||
int minY = levelHeightmap[maxLevel][minTileX][tileZ] - 240;
|
||||
int maxY = levelHeightmap[minLevel][minTileX][tileZ];
|
||||
|
||||
@@ -886,7 +874,7 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
if ((((maxTileX - minTileX) + 1) * ((maxTileZ - minTileZ) + 1)) >= 4) {
|
||||
if ((((maxTileX - minTileX) + 1) * ((maxTileZ - minTileZ) + 1)) >= 8) {
|
||||
int y = levelHeightmap[level][minTileX][minTileZ];
|
||||
|
||||
Scene.addOccluder(topLevel, minTileX * 128, y, minTileZ * 128, (maxTileX * 128) + 128, y, (maxTileZ * 128) + 128, SceneOccluder.TYPE_GROUND);
|
||||
@@ -968,13 +956,13 @@ public class SceneBuilder {
|
||||
} else if (kind == 0) {
|
||||
addWall(scene, collision, locID, kind, rotation, level, x, z, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
} else if (kind == 1) {
|
||||
addDiagonalWallCorner(scene, collision, locID, kind, rotation, level, x, z, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
addWallCornerDiagonal(scene, collision, locID, kind, rotation, level, x, z, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
} else if (kind == 2) {
|
||||
addFullWall(scene, collision, locID, kind, rotation, level, x, z, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
} else if (kind == 3) {
|
||||
addWallCorner(scene, collision, locID, kind, rotation, level, x, z, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
addWallSquareCorner(scene, collision, locID, kind, rotation, level, x, z, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
} else if (kind == 9) {
|
||||
addDiagonalWall(scene, collision, locID, kind, rotation, level, x, z, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
addRoofOrDiagonalWall(scene, collision, locID, kind, rotation, level, x, z, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
} else {
|
||||
if (type.adjustToTerrain) {
|
||||
if (rotation == 1) {
|
||||
@@ -1000,15 +988,15 @@ public class SceneBuilder {
|
||||
}
|
||||
|
||||
if (kind == 4) {
|
||||
addWallDecoration(scene, rotation, z, x, locID, level, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
addWallDecor(scene, Scene.ROTATION_WALL_TYPE[rotation], type, locID, bitset, info, level, x, z, rotation * 512, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage);
|
||||
} else if (kind == 5) {
|
||||
addWallDecorationOutside(scene, rotation, z, x, locID, level, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
addWallDecorOffset(scene, rotation, z, x, locID, level, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
} else if (kind == 6) {
|
||||
addDiagonalWallDecorationInside(z, scene, level, x, locID, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
addWallDecor(scene, 0x100, type, locID, bitset, info, level, x, z, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage);
|
||||
} else if (kind == 7) {
|
||||
addDiagonalWallDecorationOutside(z, scene, level, x, locID, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
addWallDecor(scene, 0x200, type, locID, bitset, info, level, x, z, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage);
|
||||
} else if (kind == 8) {
|
||||
addDiagonalWallDecorationBoth(z, scene, level, x, locID, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage, type, bitset, info);
|
||||
addWallDecor(scene, 0x300, type, locID, bitset, info, level, x, z, rotation, heightmapSW, heightmapSE, heightmapNE, heightmapNW, heightmapAverage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1159,12 +1147,12 @@ public class SceneBuilder {
|
||||
collision.addWall(x, z, kind, rotation, type.blocksProjectiles);
|
||||
}
|
||||
|
||||
if (type.decorationPadding != 16) {
|
||||
scene.setWallDecorationOffset(level, x, z, type.decorationPadding);
|
||||
if (type.decorOffset != 16) {
|
||||
scene.setWallDecorationOffset(level, x, z, type.decorOffset);
|
||||
}
|
||||
}
|
||||
|
||||
private void addDiagonalWallCorner(Scene scene, CollisionMap collision, int locID, int kind, int rotation, int level, int x, int z, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
private void addWallCornerDiagonal(Scene scene, CollisionMap collision, int locID, int kind, int rotation, int level, int x, int z, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
Entity entity;
|
||||
|
||||
if ((type.seqID == -1) && (type.overrideTypeIDs == null)) {
|
||||
@@ -1227,12 +1215,12 @@ public class SceneBuilder {
|
||||
collision.addWall(x, z, kind, rotation, type.blocksProjectiles);
|
||||
}
|
||||
|
||||
if (type.decorationPadding != 16) {
|
||||
scene.setWallDecorationOffset(level, x, z, type.decorationPadding);
|
||||
if (type.decorOffset != 16) {
|
||||
scene.setWallDecorationOffset(level, x, z, type.decorOffset);
|
||||
}
|
||||
}
|
||||
|
||||
private void addWallCorner(Scene scene, CollisionMap collision, int locID, int kind, int rotation, int level, int x, int z, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
private void addWallSquareCorner(Scene scene, CollisionMap collision, int locID, int kind, int rotation, int level, int x, int z, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
Entity entity;
|
||||
|
||||
if ((type.seqID == -1) && (type.overrideTypeIDs == null)) {
|
||||
@@ -1260,7 +1248,7 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addDiagonalWall(Scene scene, CollisionMap collision, int locID, int kind, int rotation, int level, int x, int z, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
private static void addRoofOrDiagonalWall(Scene scene, CollisionMap collision, int locID, int kind, int rotation, int level, int x, int z, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
Entity entity;
|
||||
|
||||
if ((type.seqID == -1) && (type.overrideTypeIDs == null)) {
|
||||
@@ -1275,34 +1263,14 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addDiagonalWallDecorationInside(int z, Scene scene, int level, int x, int locID, int rotation, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
private static void addWallDecor(Scene scene, int decorType, LocType type, int locID, int locBitset, byte locInfo, int level, int x, int z, int rotation, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage) {
|
||||
Entity entity;
|
||||
if ((type.seqID == -1) && (type.overrideTypeIDs == null)) {
|
||||
entity = type.getModel(4, 0, heightmapSW, heightmapSE, heightmapNE, heightmapNW, -1);
|
||||
} else {
|
||||
entity = new LocEntity(locID, 0, 4, heightmapSE, heightmapNE, heightmapSW, heightmapNW, type.seqID, true);
|
||||
}
|
||||
scene.setWallDecoration(0x100, entity, level, x, z, heightmapAverage, rotation, 0, 0, bitset, info);
|
||||
}
|
||||
|
||||
private static void addDiagonalWallDecorationOutside(int z, Scene scene, int level, int x, int locID, int rotation, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
Entity entity;
|
||||
if ((type.seqID == -1) && (type.overrideTypeIDs == null)) {
|
||||
entity = type.getModel(4, 0, heightmapSW, heightmapSE, heightmapNE, heightmapNW, -1);
|
||||
} else {
|
||||
entity = new LocEntity(locID, 0, 4, heightmapSE, heightmapNE, heightmapSW, heightmapNW, type.seqID, true);
|
||||
}
|
||||
scene.setWallDecoration(0x200, entity, level, x, z, heightmapAverage, rotation, 0, 0, bitset, info);
|
||||
}
|
||||
|
||||
private static void addDiagonalWallDecorationBoth(int z, Scene scene, int level, int x, int locID, int rotation, int heightmapSW, int heightmapSE, int heightmapNE, int heightmapNW, int heightmapAverage, LocType type, int bitset, byte info) {
|
||||
Entity entity;
|
||||
if ((type.seqID == -1) && (type.overrideTypeIDs == null)) {
|
||||
entity = type.getModel(4, 0, heightmapSW, heightmapSE, heightmapNE, heightmapNW, -1);
|
||||
} else {
|
||||
entity = new LocEntity(locID, 0, 4, heightmapSE, heightmapNE, heightmapSW, heightmapNW, type.seqID, true);
|
||||
}
|
||||
scene.setWallDecoration(0x300, entity, level, x, z, heightmapAverage, rotation, 0, 0, bitset, info);
|
||||
scene.setWallDecoration(decorType, entity, level, x, z, heightmapAverage, rotation, 0, 0, locBitset, locInfo);
|
||||
}
|
||||
|
||||
public int decimateHSL(int hue, int saturation, int lightness) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SceneTile extends DoublyLinkedList.Node {
|
||||
public int checkLocSpans;
|
||||
public int blockLocSpans;
|
||||
public int inverseBlockLocSpans;
|
||||
public int allowWallTypes;
|
||||
public int backWallTypes;
|
||||
public SceneTile bridge;
|
||||
|
||||
public SceneTile(int level, int x, int z) {
|
||||
|
||||
Reference in new issue
Block a user