SceneOccluder
Random stuff
This commit is contained in:
1 parent
301f11073c
commit
a4a81657f5
11 files changed
+1551
-1317
No files matched your search
@@ -27,7 +27,7 @@ public class FloType {
|
||||
public int rgb;
|
||||
public int textureID = -1;
|
||||
public boolean unusedBool = false;
|
||||
public boolean aBoolean393 = true;
|
||||
public boolean occludes = true;
|
||||
public int hue;
|
||||
public int saturation;
|
||||
public int lightness;
|
||||
@@ -52,7 +52,7 @@ public class FloType {
|
||||
} else if (i == 3) {
|
||||
unusedBool = true;
|
||||
} else if (i == 5) {
|
||||
aBoolean393 = false;
|
||||
occludes = false;
|
||||
} else if (i == 6) {
|
||||
unusedString = buffer.readString();
|
||||
} else if (i == 7) {
|
||||
|
||||
+11
-18
@@ -944,21 +944,21 @@ public class Game extends GameShell {
|
||||
imageRedstone2 = new Image8(archiveMedia, "redstone2", 0);
|
||||
imageRedstone3 = new Image8(archiveMedia, "redstone3", 0);
|
||||
imageRedstone1h = new Image8(archiveMedia, "redstone1", 0);
|
||||
imageRedstone1h.flipH();
|
||||
imageRedstone1h.flipHorizontally();
|
||||
imageRedstone2h = new Image8(archiveMedia, "redstone2", 0);
|
||||
imageRedstone2h.flipH();
|
||||
imageRedstone2h.flipHorizontally();
|
||||
imageRedstone1v = new Image8(archiveMedia, "redstone1", 0);
|
||||
imageRedstone1v.flipV();
|
||||
imageRedstone1v.flipVertically();
|
||||
imageRedstone2v = new Image8(archiveMedia, "redstone2", 0);
|
||||
imageRedstone2v.flipV();
|
||||
imageRedstone2v.flipVertically();
|
||||
imageRedstone3v = new Image8(archiveMedia, "redstone3", 0);
|
||||
imageRedstone3v.flipV();
|
||||
imageRedstone3v.flipVertically();
|
||||
imageRedstone1hv = new Image8(archiveMedia, "redstone1", 0);
|
||||
imageRedstone1hv.flipH();
|
||||
imageRedstone1hv.flipV();
|
||||
imageRedstone1hv.flipHorizontally();
|
||||
imageRedstone1hv.flipVertically();
|
||||
imageRedstone2hv = new Image8(archiveMedia, "redstone2", 0);
|
||||
imageRedstone2hv.flipH();
|
||||
imageRedstone2hv.flipV();
|
||||
imageRedstone2hv.flipHorizontally();
|
||||
imageRedstone2hv.flipVertically();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
imageModIcons[i] = new Image8(archiveMedia, "mod_icons", i);
|
||||
}
|
||||
@@ -1061,14 +1061,7 @@ public class Game extends GameShell {
|
||||
Draw3D.init3D(512, 334);
|
||||
areaViewportOffsets = Draw3D.lineOffset;
|
||||
|
||||
int[] ai = new int[9];
|
||||
for (int i = 0; i < 9; i++) {
|
||||
int angle = 128 + (i * 32) + 15;
|
||||
int l8 = 600 + (angle * 3);
|
||||
ai[i] = (l8 * Draw3D.sin[angle]) >> 16;
|
||||
}
|
||||
|
||||
Scene.method310(500, 800, 512, 334, ai);
|
||||
Scene.init(512, 334);
|
||||
Censor.method487(archiveWordenc);
|
||||
|
||||
mouseRecorder = new MouseRecorder(this);
|
||||
@@ -1768,7 +1761,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
}
|
||||
out.writeOp(0);
|
||||
sceneBuilder.method171(levelCollisionMap, scene);
|
||||
sceneBuilder.build(levelCollisionMap, scene);
|
||||
areaViewport.bind();
|
||||
out.writeOp(0);
|
||||
int k3 = SceneBuilder.minLevel;
|
||||
|
||||
+70
-71
@@ -19,12 +19,12 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
cropX = cropY = 0;
|
||||
}
|
||||
|
||||
public Image24(byte[] abyte0, java.awt.Component component) {
|
||||
public Image24(byte[] src, java.awt.Component component) {
|
||||
try {
|
||||
java.awt.Image image = Toolkit.getDefaultToolkit().createImage(abyte0);
|
||||
MediaTracker mediatracker = new MediaTracker(component);
|
||||
mediatracker.addImage(image, 0);
|
||||
mediatracker.waitForAll();
|
||||
java.awt.Image image = Toolkit.getDefaultToolkit().createImage(src);
|
||||
MediaTracker tracker = new MediaTracker(component);
|
||||
tracker.addImage(image, 0);
|
||||
tracker.waitForAll();
|
||||
width = image.getWidth(component);
|
||||
height = image.getHeight(component);
|
||||
cropW = width;
|
||||
@@ -40,41 +40,41 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
}
|
||||
|
||||
public Image24(FileArchive archive, String file, int index) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read(file + ".dat"));
|
||||
Buffer buffer_1 = new Buffer(archive.read("index.dat"));
|
||||
buffer_1.position = buffer.read16U();
|
||||
cropW = buffer_1.read16U();
|
||||
cropH = buffer_1.read16U();
|
||||
int j = buffer_1.read8U();
|
||||
int[] ai = new int[j];
|
||||
for (int k = 0; k < (j - 1); k++) {
|
||||
ai[k + 1] = buffer_1.read24();
|
||||
if (ai[k + 1] == 0) {
|
||||
ai[k + 1] = 1;
|
||||
Buffer dat = new Buffer(archive.read(file + ".dat"));
|
||||
Buffer idx = new Buffer(archive.read("index.dat"));
|
||||
idx.position = dat.read16U();
|
||||
cropW = idx.read16U();
|
||||
cropH = idx.read16U();
|
||||
int paletteSize = idx.read8U();
|
||||
int[] palette = new int[paletteSize];
|
||||
for (int k = 0; k < (paletteSize - 1); k++) {
|
||||
palette[k + 1] = idx.read24();
|
||||
if (palette[k + 1] == 0) {
|
||||
palette[k + 1] = 1;
|
||||
}
|
||||
}
|
||||
for (int l = 0; l < index; l++) {
|
||||
buffer_1.position += 2;
|
||||
buffer.position += buffer_1.read16U() * buffer_1.read16U();
|
||||
buffer_1.position++;
|
||||
for (int i = 0; i < index; i++) {
|
||||
idx.position += 2;
|
||||
dat.position += idx.read16U() * idx.read16U();
|
||||
idx.position++;
|
||||
}
|
||||
cropX = buffer_1.read8U();
|
||||
cropY = buffer_1.read8U();
|
||||
width = buffer_1.read16U();
|
||||
height = buffer_1.read16U();
|
||||
int layout = buffer_1.read8U();
|
||||
cropX = idx.read8U();
|
||||
cropY = idx.read8U();
|
||||
width = idx.read16U();
|
||||
height = idx.read16U();
|
||||
int layout = idx.read8U();
|
||||
int pixelLen = width * height;
|
||||
pixels = new int[pixelLen];
|
||||
if (layout == 0) {
|
||||
for (int k1 = 0; k1 < pixelLen; k1++) {
|
||||
pixels[k1] = ai[buffer.read8U()];
|
||||
for (int i = 0; i < pixelLen; i++) {
|
||||
pixels[i] = palette[dat.read8U()];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (layout == 1) {
|
||||
for (int l1 = 0; l1 < width; l1++) {
|
||||
for (int i2 = 0; i2 < height; i2++) {
|
||||
pixels[l1 + (i2 * width)] = ai[buffer.read8U()];
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
pixels[x + (y * width)] = palette[dat.read8U()];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,14 +170,14 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
public void copyPixels(int dstOff, int w, int h, int srcStep, int srcOff, int dstStep, int[] src, int[] dst) {
|
||||
int quarterWidth = -(w >> 2);
|
||||
w = -(w & 3);
|
||||
for (int i2 = -h; i2 < 0; i2++) {
|
||||
for (int j2 = quarterWidth; j2 < 0; j2++) {
|
||||
for (int y = -h; y < 0; y++) {
|
||||
for (int i = quarterWidth; i < 0; i++) {
|
||||
dst[dstOff++] = src[srcOff++];
|
||||
dst[dstOff++] = src[srcOff++];
|
||||
dst[dstOff++] = src[srcOff++];
|
||||
dst[dstOff++] = src[srcOff++];
|
||||
}
|
||||
for (int k2 = w; k2 < 0; k2++) {
|
||||
for (int i = w; i < 0; i++) {
|
||||
dst[dstOff++] = src[srcOff++];
|
||||
}
|
||||
dstOff += dstStep;
|
||||
@@ -195,23 +195,23 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
int dstStep = Draw2D.width - w;
|
||||
int srcStep = 0;
|
||||
if (y < Draw2D.top) {
|
||||
int j2 = Draw2D.top - y;
|
||||
h -= j2;
|
||||
int trim = Draw2D.top - y;
|
||||
h -= trim;
|
||||
y = Draw2D.top;
|
||||
srcOff += j2 * w;
|
||||
dstOff += j2 * Draw2D.width;
|
||||
srcOff += trim * w;
|
||||
dstOff += trim * Draw2D.width;
|
||||
}
|
||||
if ((y + h) > Draw2D.bottom) {
|
||||
h -= (y + h) - Draw2D.bottom;
|
||||
}
|
||||
if (x < Draw2D.left) {
|
||||
int k2 = Draw2D.left - x;
|
||||
w -= k2;
|
||||
int trim = Draw2D.left - x;
|
||||
w -= trim;
|
||||
x = Draw2D.left;
|
||||
srcOff += k2;
|
||||
dstOff += k2;
|
||||
srcStep += k2;
|
||||
dstStep += k2;
|
||||
srcOff += trim;
|
||||
dstOff += trim;
|
||||
srcStep += trim;
|
||||
dstStep += trim;
|
||||
}
|
||||
if ((x + w) > Draw2D.right) {
|
||||
int trim = (x + w) - Draw2D.right;
|
||||
@@ -271,43 +271,43 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
public void draw(int x, int y, int alpha) {
|
||||
x += cropX;
|
||||
y += cropY;
|
||||
int i1 = x + (y * Draw2D.width);
|
||||
int j1 = 0;
|
||||
int k1 = height;
|
||||
int dstOff = x + (y * Draw2D.width);
|
||||
int srcOff = 0;
|
||||
int h = height;
|
||||
int w = width;
|
||||
int i2 = Draw2D.width - w;
|
||||
int j2 = 0;
|
||||
int dstStep = Draw2D.width - w;
|
||||
int srcStep = 0;
|
||||
if (y < Draw2D.top) {
|
||||
int k2 = Draw2D.top - y;
|
||||
k1 -= k2;
|
||||
int trim = Draw2D.top - y;
|
||||
h -= trim;
|
||||
y = Draw2D.top;
|
||||
j1 += k2 * w;
|
||||
i1 += k2 * Draw2D.width;
|
||||
srcOff += trim * w;
|
||||
dstOff += trim * Draw2D.width;
|
||||
}
|
||||
if ((y + k1) > Draw2D.bottom) {
|
||||
k1 -= (y + k1) - Draw2D.bottom;
|
||||
if ((y + h) > Draw2D.bottom) {
|
||||
h -= (y + h) - Draw2D.bottom;
|
||||
}
|
||||
if (x < Draw2D.left) {
|
||||
int l2 = Draw2D.left - x;
|
||||
w -= l2;
|
||||
int trim = Draw2D.left - x;
|
||||
w -= trim;
|
||||
x = Draw2D.left;
|
||||
j1 += l2;
|
||||
i1 += l2;
|
||||
j2 += l2;
|
||||
i2 += l2;
|
||||
srcOff += trim;
|
||||
dstOff += trim;
|
||||
srcStep += trim;
|
||||
dstStep += trim;
|
||||
}
|
||||
if ((x + w) > Draw2D.right) {
|
||||
int i3 = (x + w) - Draw2D.right;
|
||||
w -= i3;
|
||||
j2 += i3;
|
||||
i2 += i3;
|
||||
int trim = (x + w) - Draw2D.right;
|
||||
w -= trim;
|
||||
srcStep += trim;
|
||||
dstStep += trim;
|
||||
}
|
||||
if ((w > 0) && (k1 > 0)) {
|
||||
copyPixelsAlpha(j1, w, Draw2D.pixels, pixels, j2, k1, i2, alpha, i1);
|
||||
if ((w > 0) && (h > 0)) {
|
||||
copyPixelsAlpha(srcOff, w, Draw2D.pixels, pixels, srcStep, h, dstStep, alpha, dstOff);
|
||||
}
|
||||
}
|
||||
|
||||
public void copyPixelsAlpha(int srcOff, int w, int[] dst, int[] src, int srcstep, int h, int dstStep, int alpha, int dstOff) {
|
||||
public void copyPixelsAlpha(int srcOff, int w, int[] dst, int[] src, int srcStep, int h, int dstStep, int alpha, int dstOff) {
|
||||
int invAlpha = 256 - alpha;
|
||||
for (int k2 = -h; k2 < 0; k2++) {
|
||||
for (int l2 = -w; l2 < 0; l2++) {
|
||||
@@ -320,7 +320,7 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
}
|
||||
}
|
||||
dstOff += dstStep;
|
||||
srcOff += srcstep;
|
||||
srcOff += srcStep;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
w = -(w & 3);
|
||||
for (int y = -h; y < 0; y++) {
|
||||
int rgb;
|
||||
for (int k2 = quarterW; k2 < 0; k2++) {
|
||||
for (int i = quarterW; i < 0; i++) {
|
||||
rgb = src[srcOff++];
|
||||
if ((rgb != 0) && (mask[dstOff] == 0)) {
|
||||
dst[dstOff++] = rgb;
|
||||
@@ -457,7 +457,7 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
dstOff++;
|
||||
}
|
||||
}
|
||||
for (int l2 = w; l2 < 0; l2++) {
|
||||
for (int i = w; i < 0; i++) {
|
||||
rgb = src[srcOff++];
|
||||
if ((rgb != 0) && (mask[dstOff] == 0)) {
|
||||
dst[dstOff++] = rgb;
|
||||
@@ -469,5 +469,4 @@ public class Image24 extends DoublyLinkedList.Node {
|
||||
srcOff += srcStep;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+97
-93
@@ -11,39 +11,41 @@ public class Image8 {
|
||||
public int cropW;
|
||||
public int cropH;
|
||||
|
||||
public Image8(FileArchive archive, String s, int i) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read(s + ".dat"));
|
||||
Buffer buffer_1 = new Buffer(archive.read("index.dat"));
|
||||
buffer_1.position = buffer.read16U();
|
||||
cropW = buffer_1.read16U();
|
||||
cropH = buffer_1.read16U();
|
||||
int j = buffer_1.read8U();
|
||||
palette = new int[j];
|
||||
for (int k = 0; k < (j - 1); k++) {
|
||||
palette[k + 1] = buffer_1.read24();
|
||||
public Image8(FileArchive archive, String name, int index) throws IOException {
|
||||
Buffer dat = new Buffer(archive.read(name + ".dat"));
|
||||
Buffer idx = new Buffer(archive.read("index.dat"));
|
||||
idx.position = dat.read16U();
|
||||
cropW = idx.read16U();
|
||||
cropH = idx.read16U();
|
||||
int paletteSize = idx.read8U();
|
||||
palette = new int[paletteSize];
|
||||
for (int i = 0; i < (paletteSize - 1); i++) {
|
||||
palette[i + 1] = idx.read24();
|
||||
}
|
||||
for (int l = 0; l < i; l++) {
|
||||
buffer_1.position += 2;
|
||||
buffer.position += buffer_1.read16U() * buffer_1.read16U();
|
||||
buffer_1.position++;
|
||||
for (int i = 0; i < index; i++) {
|
||||
idx.position += 2;
|
||||
dat.position += idx.read16U() * idx.read16U();
|
||||
idx.position++;
|
||||
}
|
||||
cropX = buffer_1.read8U();
|
||||
cropY = buffer_1.read8U();
|
||||
width = buffer_1.read16U();
|
||||
height = buffer_1.read16U();
|
||||
int i1 = buffer_1.read8U();
|
||||
int j1 = width * height;
|
||||
pixels = new byte[j1];
|
||||
if (i1 == 0) {
|
||||
for (int k1 = 0; k1 < j1; k1++) {
|
||||
pixels[k1] = buffer.read8();
|
||||
cropX = idx.read8U();
|
||||
cropY = idx.read8U();
|
||||
width = idx.read16U();
|
||||
height = idx.read16U();
|
||||
int pixelOrder = idx.read8U();
|
||||
int pixelCount = width * height;
|
||||
pixels = new byte[pixelCount];
|
||||
|
||||
if (pixelOrder == 0) {
|
||||
for (int i = 0; i < pixelCount; i++) {
|
||||
pixels[i] = dat.read8();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (i1 == 1) {
|
||||
for (int l1 = 0; l1 < width; l1++) {
|
||||
for (int i2 = 0; i2 < height; i2++) {
|
||||
pixels[l1 + (i2 * width)] = buffer.read8();
|
||||
|
||||
if (pixelOrder == 1) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
pixels[x + (y * width)] = dat.read8();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,10 +55,10 @@ public class Image8 {
|
||||
cropW /= 2;
|
||||
cropH /= 2;
|
||||
byte[] pixels = new byte[cropW * cropH];
|
||||
int i = 0;
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int k = 0; k < width; k++) {
|
||||
pixels[((k + cropX) >> 1) + (((j + cropY) >> 1) * cropW)] = this.pixels[i++];
|
||||
int off = 0;
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
pixels[((x + cropX) >> 1) + (((y + cropY) >> 1) * cropW)] = this.pixels[off++];
|
||||
}
|
||||
}
|
||||
this.pixels = pixels;
|
||||
@@ -71,10 +73,10 @@ public class Image8 {
|
||||
return;
|
||||
}
|
||||
byte[] pixels = new byte[cropW * cropH];
|
||||
int i = 0;
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int k = 0; k < width; k++) {
|
||||
pixels[k + cropX + ((j + cropY) * cropW)] = this.pixels[i++];
|
||||
int off = 0;
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
pixels[x + cropX + ((y + cropY) * cropW)] = this.pixels[off++];
|
||||
}
|
||||
}
|
||||
this.pixels = pixels;
|
||||
@@ -84,19 +86,19 @@ public class Image8 {
|
||||
cropY = 0;
|
||||
}
|
||||
|
||||
public void flipH() {
|
||||
public void flipHorizontally() {
|
||||
byte[] pixels = new byte[width * height];
|
||||
int i = 0;
|
||||
int off = 0;
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = width - 1; x >= 0; x--) {
|
||||
pixels[i++] = this.pixels[x + (y * width)];
|
||||
pixels[off++] = this.pixels[x + (y * width)];
|
||||
}
|
||||
}
|
||||
this.pixels = pixels;
|
||||
cropX = cropW - width - cropX;
|
||||
}
|
||||
|
||||
public void flipV() {
|
||||
public void flipVertically() {
|
||||
byte[] pixels = new byte[width * height];
|
||||
int i = 0;
|
||||
for (int y = height - 1; y >= 0; y--) {
|
||||
@@ -138,82 +140,84 @@ public class Image8 {
|
||||
public void blit(int x, int y) {
|
||||
x += cropX;
|
||||
y += cropY;
|
||||
int l = x + (y * Draw2D.width);
|
||||
int i1 = 0;
|
||||
int j1 = height;
|
||||
int k1 = width;
|
||||
int l1 = Draw2D.width - k1;
|
||||
int i2 = 0;
|
||||
int dstOff = x + (y * Draw2D.width);
|
||||
int srcOff = 0;
|
||||
int height = this.height;
|
||||
int width = this.width;
|
||||
int dstStep = Draw2D.width - width;
|
||||
int srcStep = 0;
|
||||
if (y < Draw2D.top) {
|
||||
int j2 = Draw2D.top - y;
|
||||
j1 -= j2;
|
||||
int trim = Draw2D.top - y;
|
||||
height -= trim;
|
||||
y = Draw2D.top;
|
||||
i1 += j2 * k1;
|
||||
l += j2 * Draw2D.width;
|
||||
srcOff += trim * width;
|
||||
dstOff += trim * Draw2D.width;
|
||||
}
|
||||
if ((y + j1) > Draw2D.bottom) {
|
||||
j1 -= (y + j1) - Draw2D.bottom;
|
||||
if ((y + height) > Draw2D.bottom) {
|
||||
height -= (y + height) - Draw2D.bottom;
|
||||
}
|
||||
if (x < Draw2D.left) {
|
||||
int k2 = Draw2D.left - x;
|
||||
k1 -= k2;
|
||||
int trim = Draw2D.left - x;
|
||||
width -= trim;
|
||||
x = Draw2D.left;
|
||||
i1 += k2;
|
||||
l += k2;
|
||||
i2 += k2;
|
||||
l1 += k2;
|
||||
srcOff += trim;
|
||||
dstOff += trim;
|
||||
srcStep += trim;
|
||||
dstStep += trim;
|
||||
}
|
||||
if ((x + k1) > Draw2D.right) {
|
||||
int l2 = (x + k1) - Draw2D.right;
|
||||
k1 -= l2;
|
||||
i2 += l2;
|
||||
l1 += l2;
|
||||
if ((x + width) > Draw2D.right) {
|
||||
int trim = (x + width) - Draw2D.right;
|
||||
width -= trim;
|
||||
srcStep += trim;
|
||||
dstStep += trim;
|
||||
}
|
||||
if ((k1 > 0) && (j1 > 0)) {
|
||||
blit(j1, Draw2D.pixels, pixels, l1, l, k1, i1, palette, i2);
|
||||
if ((width > 0) && (height > 0)) {
|
||||
blit(height, Draw2D.pixels, pixels, dstStep, dstOff, width, srcOff, palette, srcStep);
|
||||
}
|
||||
}
|
||||
|
||||
public void blit(int i, int[] ai, byte[] abyte0, int j, int k, int l, int i1, int[] ai1, int j1) {
|
||||
int k1 = -(l >> 2);
|
||||
l = -(l & 3);
|
||||
for (int l1 = -i; l1 < 0; l1++) {
|
||||
for (int i2 = k1; i2 < 0; i2++) {
|
||||
byte byte1 = abyte0[i1++];
|
||||
if (byte1 != 0) {
|
||||
ai[k++] = ai1[byte1 & 0xff];
|
||||
public void blit(int height, int[] dst, byte[] src, int dstStep, int dstOff, int width, int srcOff, int[] palette, int srcStep) {
|
||||
int quarterWidth = -(width >> 2);
|
||||
width = -(width & 3);
|
||||
for (int y = -height; y < 0; y++) {
|
||||
for (int w = quarterWidth; w < 0; w++) {
|
||||
byte paletteIndex = src[srcOff++];
|
||||
|
||||
if (paletteIndex != 0) {
|
||||
dst[dstOff++] = palette[paletteIndex & 0xff];
|
||||
} else {
|
||||
k++;
|
||||
dstOff++;
|
||||
}
|
||||
byte1 = abyte0[i1++];
|
||||
if (byte1 != 0) {
|
||||
ai[k++] = ai1[byte1 & 0xff];
|
||||
|
||||
paletteIndex = src[srcOff++];
|
||||
if (paletteIndex != 0) {
|
||||
dst[dstOff++] = palette[paletteIndex & 0xff];
|
||||
} else {
|
||||
k++;
|
||||
dstOff++;
|
||||
}
|
||||
byte1 = abyte0[i1++];
|
||||
if (byte1 != 0) {
|
||||
ai[k++] = ai1[byte1 & 0xff];
|
||||
paletteIndex = src[srcOff++];
|
||||
if (paletteIndex != 0) {
|
||||
dst[dstOff++] = palette[paletteIndex & 0xff];
|
||||
} else {
|
||||
k++;
|
||||
dstOff++;
|
||||
}
|
||||
byte1 = abyte0[i1++];
|
||||
if (byte1 != 0) {
|
||||
ai[k++] = ai1[byte1 & 0xff];
|
||||
paletteIndex = src[srcOff++];
|
||||
if (paletteIndex != 0) {
|
||||
dst[dstOff++] = palette[paletteIndex & 0xff];
|
||||
} else {
|
||||
k++;
|
||||
dstOff++;
|
||||
}
|
||||
}
|
||||
for (int j2 = l; j2 < 0; j2++) {
|
||||
byte byte2 = abyte0[i1++];
|
||||
if (byte2 != 0) {
|
||||
ai[k++] = ai1[byte2 & 0xff];
|
||||
for (int i = width; i < 0; i++) {
|
||||
byte paletteIndex = src[srcOff++];
|
||||
if (paletteIndex != 0) {
|
||||
dst[dstOff++] = palette[paletteIndex & 0xff];
|
||||
} else {
|
||||
k++;
|
||||
dstOff++;
|
||||
}
|
||||
}
|
||||
k += j;
|
||||
i1 += j1;
|
||||
dstOff += dstStep;
|
||||
srcOff += srcStep;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ public class Model extends Entity {
|
||||
*/
|
||||
public boolean pickable = false;
|
||||
/**
|
||||
* A storage for the original vertex normals to give {@link Scene#method308(Model, Model, int, int, int, boolean)}
|
||||
* A storage for the original vertex normals to give {@link Scene#mergeNormals(Model, Model, int, int, int, boolean)}
|
||||
* a reference.
|
||||
*/
|
||||
public VertexNormal[] vertexNormalOriginal;
|
||||
|
||||
+682
-543
File diff suppressed because it is too large.
Load diff
+392
-342
@@ -8,9 +8,9 @@ public class SceneBuilder {
|
||||
public static final int[] WALL_ROTATION_OCCLUDE_TYPE_1 = {16, 32, 64, 128};
|
||||
public static final int[] anIntArray144 = {0, -1, 0, 1};
|
||||
public static final int[] WALL_ROTATION_OCCLUDE_TYPE = {1, 2, 4, 8};
|
||||
public static int anInt123 = (int) (Math.random() * 17.0) - 8;
|
||||
public static int randomHueOffset = (int) (Math.random() * 17.0) - 8;
|
||||
public static int anInt131;
|
||||
public static int anInt133 = (int) (Math.random() * 33.0) - 16;
|
||||
public static int randomLightnessOffset = (int) (Math.random() * 33.0) - 16;
|
||||
public static int minLevel = 99;
|
||||
public static boolean lowmem = true;
|
||||
|
||||
@@ -387,21 +387,21 @@ public class SceneBuilder {
|
||||
return bool;
|
||||
}
|
||||
|
||||
public final int[] anIntArray124;
|
||||
public final int[] anIntArray125;
|
||||
public final int[] anIntArray126;
|
||||
public final int[] anIntArray127;
|
||||
public final int[] anIntArray128;
|
||||
public final int[] blendChroma;
|
||||
public final int[] blendSaturation;
|
||||
public final int[] blendLightness;
|
||||
public final int[] blendLuminance;
|
||||
public final int[] blendMagnitude;
|
||||
public final int[][][] levelHeightmap;
|
||||
public final byte[][][] aByteArrayArrayArray130;
|
||||
public final byte[][][] levelTileOverlayIDs;
|
||||
public final byte[][][] levelShademap;
|
||||
public final int[][][] levelOccludemap;
|
||||
public final byte[][][] aByteArrayArrayArray136;
|
||||
public final byte[][][] levelTileOverlayShape;
|
||||
public final int[][] levelLightmap;
|
||||
public final byte[][][] aByteArrayArrayArray142;
|
||||
public final byte[][][] levelTileUnderlayIDs;
|
||||
public final int maxTileX;
|
||||
public final int maxTileZ;
|
||||
public final byte[][][] aByteArrayArrayArray148;
|
||||
public final byte[][][] levelTileOverlayRotation;
|
||||
public final byte[][][] levelTileFlags;
|
||||
|
||||
public SceneBuilder(byte[][][] levelTileFlags, int maxTileZ, int maxTileX, int[][][] levelHeightmap) {
|
||||
@@ -410,24 +410,41 @@ public class SceneBuilder {
|
||||
this.maxTileZ = maxTileZ;
|
||||
this.levelHeightmap = levelHeightmap;
|
||||
this.levelTileFlags = levelTileFlags;
|
||||
aByteArrayArrayArray142 = new byte[4][this.maxTileX][this.maxTileZ];
|
||||
aByteArrayArrayArray130 = new byte[4][this.maxTileX][this.maxTileZ];
|
||||
aByteArrayArrayArray136 = new byte[4][this.maxTileX][this.maxTileZ];
|
||||
aByteArrayArrayArray148 = new byte[4][this.maxTileX][this.maxTileZ];
|
||||
levelTileUnderlayIDs = new byte[4][this.maxTileX][this.maxTileZ];
|
||||
levelTileOverlayIDs = new byte[4][this.maxTileX][this.maxTileZ];
|
||||
levelTileOverlayShape = new byte[4][this.maxTileX][this.maxTileZ];
|
||||
levelTileOverlayRotation = new byte[4][this.maxTileX][this.maxTileZ];
|
||||
levelOccludemap = new int[4][this.maxTileX + 1][this.maxTileZ + 1];
|
||||
levelShademap = new byte[4][this.maxTileX + 1][this.maxTileZ + 1];
|
||||
levelLightmap = new int[this.maxTileX + 1][this.maxTileZ + 1];
|
||||
anIntArray124 = new int[this.maxTileZ];
|
||||
anIntArray125 = new int[this.maxTileZ];
|
||||
anIntArray126 = new int[this.maxTileZ];
|
||||
anIntArray127 = new int[this.maxTileZ];
|
||||
anIntArray128 = new int[this.maxTileZ];
|
||||
blendChroma = new int[this.maxTileZ];
|
||||
blendSaturation = new int[this.maxTileZ];
|
||||
blendLightness = new int[this.maxTileZ];
|
||||
blendLuminance = new int[this.maxTileZ];
|
||||
blendMagnitude = new int[this.maxTileZ];
|
||||
}
|
||||
|
||||
public void method171(SceneCollisionMap[] levelCollisionMaps, Scene scene) {
|
||||
public void build(SceneCollisionMap[] levelCollisionMaps, Scene scene) {
|
||||
applyBlockFlags(levelCollisionMaps);
|
||||
randomize();
|
||||
|
||||
for (int level = 0; level < 4; level++) {
|
||||
buildTerrainLighting(level);
|
||||
buildTiles(scene, level);
|
||||
updateDrawLevels(scene, level);
|
||||
}
|
||||
|
||||
scene.buildModels(64, 768, -50, -10, -50);
|
||||
|
||||
buildBridges(scene);
|
||||
buildOccluders();
|
||||
}
|
||||
|
||||
private void applyBlockFlags(SceneCollisionMap[] levelCollisionMaps) {
|
||||
for (int level = 0; level < 4; level++) {
|
||||
for (int x = 0; x < 104; x++) {
|
||||
for (int z = 0; z < 104; z++) {
|
||||
// solid?
|
||||
if ((levelTileFlags[level][x][z] & 0x1) == 1) {
|
||||
int trueLevel = level;
|
||||
|
||||
@@ -440,220 +457,232 @@ public class SceneBuilder {
|
||||
levelCollisionMaps[trueLevel].addSolid(z, x);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
anInt123 += (int) (Math.random() * 5.0) - 2;
|
||||
}
|
||||
|
||||
if (anInt123 < -8) {
|
||||
anInt123 = -8;
|
||||
private static void randomize() {
|
||||
randomHueOffset += (int) (Math.random() * 5.0) - 2;
|
||||
|
||||
if (randomHueOffset < -8) {
|
||||
randomHueOffset = -8;
|
||||
}
|
||||
|
||||
if (anInt123 > 8) {
|
||||
anInt123 = 8;
|
||||
if (randomHueOffset > 8) {
|
||||
randomHueOffset = 8;
|
||||
}
|
||||
|
||||
anInt133 += (int) (Math.random() * 5.0) - 2;
|
||||
randomLightnessOffset += (int) (Math.random() * 5.0) - 2;
|
||||
|
||||
if (anInt133 < -16) {
|
||||
anInt133 = -16;
|
||||
if (randomLightnessOffset < -16) {
|
||||
randomLightnessOffset = -16;
|
||||
}
|
||||
|
||||
if (anInt133 > 16) {
|
||||
anInt133 = 16;
|
||||
if (randomLightnessOffset > 16) {
|
||||
randomLightnessOffset = 16;
|
||||
}
|
||||
}
|
||||
|
||||
for (int level = 0; level < 4; level++) {
|
||||
byte[][] shademap = levelShademap[level];
|
||||
int lightAmbient = 96;
|
||||
int lightAttenuation = 768;
|
||||
int lightX = -50;
|
||||
int lightY = -10;
|
||||
int lightZ = -50;
|
||||
int lightMagnitude = (lightAttenuation * (int) Math.sqrt((lightX * lightX) + (lightY * lightY) + (lightZ * lightZ))) >> 8;
|
||||
|
||||
for (int z = 1; z < (maxTileZ - 1); z++) {
|
||||
for (int x = 1; x < (maxTileX - 1); x++) {
|
||||
int dx = levelHeightmap[level][x + 1][z] - levelHeightmap[level][x - 1][z];
|
||||
int dz = levelHeightmap[level][x][z + 1] - levelHeightmap[level][x][z - 1];
|
||||
int len = (int) Math.sqrt((dx * dx) + 65536 + (dz * dz));
|
||||
int nx = (dx << 8) / len;
|
||||
int ny = 65536 / len;
|
||||
int nz = (dz << 8) / len;
|
||||
int light = lightAmbient + (((lightX * nx) + (lightY * ny) + (lightZ * nz)) / lightMagnitude);
|
||||
int shade = (shademap[x - 1][z] >> 2) + (shademap[x + 1][z] >> 3) + (shademap[x][z - 1] >> 2) + (shademap[x][z + 1] >> 3) + (shademap[x][z] >> 1);
|
||||
levelLightmap[x][z] = light - shade;
|
||||
}
|
||||
private void updateDrawLevels(Scene scene, int level) {
|
||||
for (int stz = 1; stz < (maxTileZ - 1); stz++) {
|
||||
for (int stx = 1; stx < (maxTileX - 1); stx++) {
|
||||
scene.setDrawLevel(level, stx, stz, getDrawLevel(level, stx, stz));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int z = 0; z < maxTileZ; z++) {
|
||||
anIntArray124[z] = 0;
|
||||
anIntArray125[z] = 0;
|
||||
anIntArray126[z] = 0;
|
||||
anIntArray127[z] = 0;
|
||||
anIntArray128[z] = 0;
|
||||
}
|
||||
private void buildTiles(Scene scene, int level) {
|
||||
for (int z = 0; z < maxTileZ; z++) {
|
||||
blendChroma[z] = 0;
|
||||
blendSaturation[z] = 0;
|
||||
blendLightness[z] = 0;
|
||||
blendLuminance[z] = 0;
|
||||
blendMagnitude[z] = 0;
|
||||
}
|
||||
|
||||
for (int x0 = -5; x0 < (maxTileX + 5); x0++) {
|
||||
for (int z0 = 0; z0 < maxTileZ; z0++) {
|
||||
int x1 = x0 + 5;
|
||||
for (int x0 = -5; x0 < (maxTileX + 5); x0++) {
|
||||
for (int z0 = 0; z0 < maxTileZ; z0++) {
|
||||
int x1 = x0 + 5;
|
||||
|
||||
if ((x1 >= 0) && (x1 < maxTileX)) {
|
||||
int floID = aByteArrayArrayArray142[level][x1][z0] & 0xff;
|
||||
if ((x1 >= 0) && (x1 < maxTileX)) {
|
||||
int floID = levelTileUnderlayIDs[level][x1][z0] & 0xff;
|
||||
|
||||
if (floID > 0) {
|
||||
FloType flo = FloType.instances[floID - 1];
|
||||
anIntArray124[z0] += flo.chroma;
|
||||
anIntArray125[z0] += flo.saturation;
|
||||
anIntArray126[z0] += flo.lightness;
|
||||
anIntArray127[z0] += flo.luminance;
|
||||
anIntArray128[z0]++;
|
||||
}
|
||||
}
|
||||
|
||||
int x2 = x0 - 5;
|
||||
|
||||
if ((x2 >= 0) && (x2 < maxTileX)) {
|
||||
int floID = aByteArrayArrayArray142[level][x2][z0] & 0xff;
|
||||
|
||||
if (floID > 0) {
|
||||
FloType flo = FloType.instances[floID - 1];
|
||||
anIntArray124[z0] -= flo.chroma;
|
||||
anIntArray125[z0] -= flo.saturation;
|
||||
anIntArray126[z0] -= flo.lightness;
|
||||
anIntArray127[z0] -= flo.luminance;
|
||||
anIntArray128[z0]--;
|
||||
}
|
||||
if (floID > 0) {
|
||||
FloType flo = FloType.instances[floID - 1];
|
||||
blendChroma[z0] += flo.chroma;
|
||||
blendSaturation[z0] += flo.saturation;
|
||||
blendLightness[z0] += flo.lightness;
|
||||
blendLuminance[z0] += flo.luminance;
|
||||
blendMagnitude[z0]++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((x0 >= 1) && (x0 < (maxTileX - 1))) {
|
||||
int i_35_ = 0;
|
||||
int i_36_ = 0;
|
||||
int i_37_ = 0;
|
||||
int i_38_ = 0;
|
||||
int i_39_ = 0;
|
||||
int x2 = x0 - 5;
|
||||
|
||||
for (int z0 = -5; z0 < (maxTileZ + 5); z0++) {
|
||||
int dz1 = z0 + 5;
|
||||
if ((x2 >= 0) && (x2 < maxTileX)) {
|
||||
int floID = levelTileUnderlayIDs[level][x2][z0] & 0xff;
|
||||
|
||||
if ((dz1 >= 0) && (dz1 < maxTileZ)) {
|
||||
i_35_ += anIntArray124[dz1];
|
||||
i_36_ += anIntArray125[dz1];
|
||||
i_37_ += anIntArray126[dz1];
|
||||
i_38_ += anIntArray127[dz1];
|
||||
i_39_ += anIntArray128[dz1];
|
||||
if (floID > 0) {
|
||||
FloType flo = FloType.instances[floID - 1];
|
||||
blendChroma[z0] -= flo.chroma;
|
||||
blendSaturation[z0] -= flo.saturation;
|
||||
blendLightness[z0] -= flo.lightness;
|
||||
blendLuminance[z0] -= flo.luminance;
|
||||
blendMagnitude[z0]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((x0 >= 1) && (x0 < (maxTileX - 1))) {
|
||||
int hueAccumulator = 0;
|
||||
int saturationAccumulator = 0;
|
||||
int lightnessAccumulator = 0;
|
||||
int luminanceAccumulator = 0;
|
||||
int magnitudeAccumulator = 0;
|
||||
|
||||
for (int z0 = -5; z0 < (maxTileZ + 5); z0++) {
|
||||
int dz1 = z0 + 5;
|
||||
|
||||
if ((dz1 >= 0) && (dz1 < maxTileZ)) {
|
||||
hueAccumulator += blendChroma[dz1];
|
||||
saturationAccumulator += blendSaturation[dz1];
|
||||
lightnessAccumulator += blendLightness[dz1];
|
||||
luminanceAccumulator += blendLuminance[dz1];
|
||||
magnitudeAccumulator += blendMagnitude[dz1];
|
||||
}
|
||||
|
||||
int dz2 = z0 - 5;
|
||||
|
||||
if ((dz2 >= 0) && (dz2 < maxTileZ)) {
|
||||
hueAccumulator -= blendChroma[dz2];
|
||||
saturationAccumulator -= blendSaturation[dz2];
|
||||
lightnessAccumulator -= blendLightness[dz2];
|
||||
luminanceAccumulator -= blendLuminance[dz2];
|
||||
magnitudeAccumulator -= blendMagnitude[dz2];
|
||||
}
|
||||
|
||||
if ((z0 >= 1) && (z0 < (maxTileZ - 1)) && (!lowmem || ((levelTileFlags[0][x0][z0] & 0x2) != 0) || (((levelTileFlags[level][x0][z0] & 0x10) == 0) && (getDrawLevel(level, x0, z0) == anInt131)))) {
|
||||
if (level < minLevel) {
|
||||
minLevel = level;
|
||||
}
|
||||
|
||||
int dz2 = z0 - 5;
|
||||
int underlayID = levelTileUnderlayIDs[level][x0][z0] & 0xff;
|
||||
int overlayID = levelTileOverlayIDs[level][x0][z0] & 0xff;
|
||||
|
||||
if ((dz2 >= 0) && (dz2 < maxTileZ)) {
|
||||
i_35_ -= anIntArray124[dz2];
|
||||
i_36_ -= anIntArray125[dz2];
|
||||
i_37_ -= anIntArray126[dz2];
|
||||
i_38_ -= anIntArray127[dz2];
|
||||
i_39_ -= anIntArray128[dz2];
|
||||
}
|
||||
if ((underlayID > 0) || (overlayID > 0)) {
|
||||
int heightSW = levelHeightmap[level][x0][z0];
|
||||
int heightSE = levelHeightmap[level][x0 + 1][z0];
|
||||
int heightNE = levelHeightmap[level][x0 + 1][z0 + 1];
|
||||
int heightNW = levelHeightmap[level][x0][z0 + 1];
|
||||
|
||||
if ((z0 >= 1) && (z0 < (maxTileZ - 1)) && (!lowmem || ((levelTileFlags[0][x0][z0] & 0x2) != 0) || (((levelTileFlags[level][x0][z0] & 0x10) == 0) && (getDrawLevel(level, x0, z0) == anInt131)))) {
|
||||
if (level < minLevel) {
|
||||
minLevel = level;
|
||||
int lightSW = levelLightmap[x0][z0];
|
||||
int lightSE = levelLightmap[x0 + 1][z0];
|
||||
int lightNE = levelLightmap[x0 + 1][z0 + 1];
|
||||
int lightNW = levelLightmap[x0][z0 + 1];
|
||||
|
||||
int baseColor = -1;
|
||||
int tintColor = -1;
|
||||
|
||||
if (underlayID > 0) {
|
||||
int hue = (hueAccumulator * 256) / luminanceAccumulator;
|
||||
int saturation = saturationAccumulator / magnitudeAccumulator;
|
||||
int lightness = lightnessAccumulator / magnitudeAccumulator;
|
||||
|
||||
baseColor = decimateHSL(hue, saturation, lightness);
|
||||
|
||||
hue = (hue + randomHueOffset) & 0xff;
|
||||
lightness += randomLightnessOffset;
|
||||
|
||||
if (lightness < 0) {
|
||||
lightness = 0;
|
||||
} else if (lightness > 255) {
|
||||
lightness = 255;
|
||||
}
|
||||
|
||||
tintColor = decimateHSL(hue, saturation, lightness);
|
||||
}
|
||||
|
||||
int i_43_ = aByteArrayArrayArray142[level][x0][z0] & 0xff;
|
||||
int floID = aByteArrayArrayArray130[level][x0][z0] & 0xff;
|
||||
if (level > 0) {
|
||||
boolean occludes = true;
|
||||
|
||||
if ((i_43_ > 0) || (floID > 0)) {
|
||||
int heightSW = levelHeightmap[level][x0][z0];
|
||||
int heightSE = levelHeightmap[level][x0 + 1][z0];
|
||||
int heightNE = levelHeightmap[level][x0 + 1][z0 + 1];
|
||||
int heightNW = levelHeightmap[level][x0][z0 + 1];
|
||||
|
||||
int tileHeight00 = levelLightmap[x0][z0];
|
||||
int tileHeight10 = levelLightmap[x0 + 1][z0];
|
||||
int tileHeight11 = levelLightmap[x0 + 1][z0 + 1];
|
||||
int tileHeight01 = levelLightmap[x0][z0 + 1];
|
||||
|
||||
int i_53_ = -1;
|
||||
int i_54_ = -1;
|
||||
|
||||
if (i_43_ > 0) {
|
||||
int hue = (i_35_ * 256) / i_38_;
|
||||
int saturation = i_36_ / i_39_;
|
||||
int lightness = i_37_ / i_39_;
|
||||
|
||||
i_53_ = decimateHSL(hue, saturation, lightness);
|
||||
|
||||
hue = (hue + anInt123) & 0xff;
|
||||
lightness += anInt133;
|
||||
|
||||
if (lightness < 0) {
|
||||
lightness = 0;
|
||||
} else if (lightness > 255) {
|
||||
lightness = 255;
|
||||
}
|
||||
|
||||
i_54_ = decimateHSL(hue, saturation, lightness);
|
||||
if ((underlayID == 0) && (levelTileOverlayShape[level][x0][z0] != 0)) {
|
||||
occludes = false;
|
||||
}
|
||||
|
||||
if (level > 0) {
|
||||
boolean bool = true;
|
||||
if ((i_43_ == 0) && (aByteArrayArrayArray136[level][x0][z0] != 0)) {
|
||||
bool = false;
|
||||
}
|
||||
if ((floID > 0) && !FloType.instances[floID - 1].aBoolean393) {
|
||||
bool = false;
|
||||
}
|
||||
if (bool && (heightSW == heightSE) && (heightSW == heightNE) && (heightSW == heightNW)) {
|
||||
levelOccludemap[level][x0][z0] |= 0x924;
|
||||
}
|
||||
if ((overlayID > 0) && !FloType.instances[overlayID - 1].occludes) {
|
||||
occludes = false;
|
||||
}
|
||||
|
||||
int i_58_ = 0;
|
||||
|
||||
if (i_53_ != -1) {
|
||||
i_58_ = Draw3D.palette[mulHSL(i_54_, 96)];
|
||||
// occludes && flat
|
||||
if (occludes && (heightSW == heightSE) && (heightSW == heightNE) && (heightSW == heightNW)) {
|
||||
levelOccludemap[level][x0][z0] |= 0b100_100_100_100;
|
||||
}
|
||||
}
|
||||
|
||||
if (floID == 0) {
|
||||
scene.setTile(level, x0, z0, 0, 0, -1, heightSW, heightSE, heightNE, heightNW, mulHSL(i_53_, tileHeight00), mulHSL(i_53_, tileHeight10), mulHSL(i_53_, tileHeight11), mulHSL(i_53_, tileHeight01), 0, 0, 0, 0, i_58_, 0);
|
||||
int shadeColor = 0;
|
||||
|
||||
if (baseColor != -1) {
|
||||
shadeColor = Draw3D.palette[mulHSL(tintColor, 96)];
|
||||
}
|
||||
|
||||
if (overlayID == 0) {
|
||||
scene.setTile(level, x0, z0, 0, 0, -1, heightSW, heightSE, heightNE, heightNW, mulHSL(baseColor, lightSW), mulHSL(baseColor, lightSE), mulHSL(baseColor, lightNE), mulHSL(baseColor, lightNW), 0, 0, 0, 0, shadeColor, 0);
|
||||
} else {
|
||||
int shape = levelTileOverlayShape[level][x0][z0] + 1;
|
||||
byte rotation = levelTileOverlayRotation[level][x0][z0];
|
||||
FloType flo = FloType.instances[overlayID - 1];
|
||||
int textureID = flo.textureID;
|
||||
int rgb;
|
||||
int hsl;
|
||||
|
||||
if (textureID >= 0) {
|
||||
rgb = Draw3D.getAverageTextureRGB(textureID);
|
||||
hsl = -1;
|
||||
} else if (flo.rgb == 16711935) {
|
||||
rgb = 0;
|
||||
hsl = -2;
|
||||
textureID = -1;
|
||||
} else {
|
||||
int i_59_ = aByteArrayArrayArray136[level][x0][z0] + 1;
|
||||
byte i_60_ = aByteArrayArrayArray148[level][x0][z0];
|
||||
FloType flo = FloType.instances[floID - 1];
|
||||
int textureID = flo.textureID;
|
||||
int rgb;
|
||||
int hsl;
|
||||
|
||||
if (textureID >= 0) {
|
||||
rgb = Draw3D.getAverageTextureRGB(textureID);
|
||||
hsl = -1;
|
||||
} else if (flo.rgb == 16711935) {
|
||||
rgb = 0;
|
||||
hsl = -2;
|
||||
textureID = -1;
|
||||
} else {
|
||||
hsl = decimateHSL(flo.hue, flo.saturation, flo.lightness);
|
||||
rgb = Draw3D.palette[adjustLightness(flo.hsl, 96)];
|
||||
}
|
||||
|
||||
scene.setTile(level, x0, z0, i_59_, i_60_, textureID, heightSW, heightSE, heightNE, heightNW, mulHSL(i_53_, tileHeight00), mulHSL(i_53_, tileHeight10), mulHSL(i_53_, tileHeight11), mulHSL(i_53_, tileHeight01), adjustLightness(hsl, tileHeight00), adjustLightness(hsl, tileHeight10), adjustLightness(hsl, tileHeight11), adjustLightness(hsl, tileHeight01), i_58_, rgb);
|
||||
hsl = decimateHSL(flo.hue, flo.saturation, flo.lightness);
|
||||
rgb = Draw3D.palette[adjustLightness(flo.hsl, 96)];
|
||||
}
|
||||
|
||||
scene.setTile(level, x0, z0, shape, rotation, textureID, heightSW, heightSE, heightNE, heightNW, mulHSL(baseColor, lightSW), mulHSL(baseColor, lightSE), mulHSL(baseColor, lightNE), mulHSL(baseColor, lightNW), adjustLightness(hsl, lightSW), adjustLightness(hsl, lightSE), adjustLightness(hsl, lightNE), adjustLightness(hsl, lightNW), shadeColor, rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int stz = 1; stz < (maxTileZ - 1); stz++) {
|
||||
for (int stx = 1; stx < (maxTileX - 1); stx++) {
|
||||
scene.setDrawLevel(level, stx, stz, getDrawLevel(level, stx, stz));
|
||||
}
|
||||
private void buildTerrainLighting(int level) {
|
||||
byte[][] shademap = levelShademap[level];
|
||||
int lightAmbient = 96;
|
||||
int lightAttenuation = 768;
|
||||
int lightX = -50;
|
||||
int lightY = -10;
|
||||
int lightZ = -50;
|
||||
int lightMagnitude = (lightAttenuation * (int) Math.sqrt((lightX * lightX) + (lightY * lightY) + (lightZ * lightZ))) >> 8;
|
||||
|
||||
for (int z = 1; z < (maxTileZ - 1); z++) {
|
||||
for (int x = 1; x < (maxTileX - 1); x++) {
|
||||
int dx = levelHeightmap[level][x + 1][z] - levelHeightmap[level][x - 1][z];
|
||||
int dz = levelHeightmap[level][x][z + 1] - levelHeightmap[level][x][z - 1];
|
||||
int len = (int) Math.sqrt((dx * dx) + 65536 + (dz * dz));
|
||||
int nx = (dx << 8) / len;
|
||||
int ny = 65536 / len;
|
||||
int nz = (dz << 8) / len;
|
||||
int light = lightAmbient + (((lightX * nx) + (lightY * ny) + (lightZ * nz)) / lightMagnitude);
|
||||
int shade = (shademap[x - 1][z] >> 2) + (shademap[x + 1][z] >> 3) + (shademap[x][z - 1] >> 2) + (shademap[x][z + 1] >> 3) + (shademap[x][z] >> 1);
|
||||
levelLightmap[x][z] = light - shade;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene.applyLighting(-10, 64, -50, 768, -50);
|
||||
|
||||
private void buildBridges(Scene scene) {
|
||||
for (int x = 0; x < maxTileX; x++) {
|
||||
for (int z = 0; z < maxTileZ; z++) {
|
||||
if ((levelTileFlags[1][x][z] & 0x2) == 2) {
|
||||
@@ -661,162 +690,183 @@ public class SceneBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Find a reasonable name for these.
|
||||
int maskA = 0b001;
|
||||
int maskB = 0b010;
|
||||
int maskC = 0b100;
|
||||
private void buildOccluders() {
|
||||
int wall0 = 0b001; // this flag is set by walls with rotation 0 or 2
|
||||
int wall1 = 0b010; // this flag is set by walls with rotation 1 or 3
|
||||
int floor = 0b100; // this flag is set by floors which are flat
|
||||
|
||||
for (int current = 0; current < 4; current++) {
|
||||
if (current > 0) {
|
||||
maskA <<= 3;
|
||||
maskB <<= 3;
|
||||
maskC <<= 3;
|
||||
for (int top = 0; top < 4; top++) {
|
||||
if (top > 0) {
|
||||
wall0 <<= 3;
|
||||
wall1 <<= 3;
|
||||
floor <<= 3;
|
||||
}
|
||||
|
||||
for (int level = 0; level <= current; level++) {
|
||||
for (int level = 0; level <= top; level++) {
|
||||
for (int tileZ = 0; tileZ <= maxTileZ; tileZ++) {
|
||||
for (int tileX = 0; tileX <= maxTileX; tileX++) {
|
||||
if ((levelOccludemap[level][tileX][tileZ] & maskA) != 0) {
|
||||
int minZ = tileZ;
|
||||
int maxZ = tileZ;
|
||||
int minLevel = level;
|
||||
int maxLevel = level;
|
||||
for (/**/; minZ > 0; minZ--) {
|
||||
if ((levelOccludemap[level][tileX][minZ - 1] & maskA) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (/**/; maxZ < maxTileZ; maxZ++) {
|
||||
if ((levelOccludemap[level][tileX][maxZ + 1] & maskA) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
buildWallOccluders0(wall0, top, level, tileX, tileZ);
|
||||
buildWallOccluders1(wall1, top, level, tileX, tileZ);
|
||||
buildFloorOccluders(floor, top, level, tileX, tileZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
find_min_level:
|
||||
for (/**/; minLevel > 0; minLevel--) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
if ((levelOccludemap[minLevel - 1][tileX][z] & maskA) == 0) {
|
||||
break find_min_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void buildFloorOccluders(int floor, int top, int level, int tileX, int tileZ) {
|
||||
if ((levelOccludemap[level][tileX][tileZ] & floor) != 0) {
|
||||
int minTileX = tileX;
|
||||
int maxTileX = tileX;
|
||||
int minTileZ = tileZ;
|
||||
int maxTileZ = tileZ;
|
||||
|
||||
find_max_level:
|
||||
for (/**/; maxLevel < current; maxLevel++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
if ((levelOccludemap[maxLevel + 1][tileX][z] & maskA) == 0) {
|
||||
break find_max_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (/**/; minTileZ > 0; minTileZ--) {
|
||||
if ((levelOccludemap[level][tileX][minTileZ - 1] & floor) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (/**/; maxTileZ < this.maxTileZ; maxTileZ++) {
|
||||
if ((levelOccludemap[level][tileX][maxTileZ + 1] & floor) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int area = ((maxLevel + 1) - minLevel) * ((maxZ - minZ) + 1);
|
||||
find_min_tile_x:
|
||||
for (/**/; minTileX > 0; minTileX--) {
|
||||
for (int z = minTileZ; z <= maxTileZ; z++) {
|
||||
if ((levelOccludemap[level][minTileX - 1][z] & floor) == 0) {
|
||||
break find_min_tile_x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (area >= 8) {
|
||||
int maxY = levelHeightmap[maxLevel][tileX][minZ] - 240;
|
||||
int minY = levelHeightmap[minLevel][tileX][minZ];
|
||||
find_max_tile_x:
|
||||
for (/**/; maxTileX < this.maxTileX; maxTileX++) {
|
||||
for (int z = minTileZ; z <= maxTileZ; z++) {
|
||||
if ((levelOccludemap[level][maxTileX + 1][z] & floor) == 0) {
|
||||
break find_max_tile_x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Scene.method277(current, tileX * 128, minY, tileX * 128, (maxZ * 128) + 128, maxY, minZ * 128, 1);
|
||||
if ((((maxTileX - minTileX) + 1) * ((maxTileZ - minTileZ) + 1)) >= 4) {
|
||||
int y = levelHeightmap[level][minTileX][minTileZ];
|
||||
|
||||
for (int l = minLevel; l <= maxLevel; l++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
levelOccludemap[l][tileX][z] &= ~maskA;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Scene.addOccluder(top, minTileX * 128, y, (maxTileX * 128) + 128, (maxTileZ * 128) + 128, y, minTileZ * 128, 4);
|
||||
|
||||
if ((levelOccludemap[level][tileX][tileZ] & maskB) != 0) {
|
||||
int minX = tileX;
|
||||
int maxX = tileX;
|
||||
int minLevel = level;
|
||||
int maxLevel = level;
|
||||
for (int x = minTileX; x <= maxTileX; x++) {
|
||||
for (int z = minTileZ; z <= maxTileZ; z++) {
|
||||
levelOccludemap[level][x][z] &= ~floor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (/**/; minX > 0; minX--) {
|
||||
if ((levelOccludemap[level][minX - 1][tileZ] & maskB) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (/**/; maxX < maxTileX; maxX++) {
|
||||
if ((levelOccludemap[level][maxX + 1][tileZ] & maskB) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void buildWallOccluders1(int wall1, int top, int level, int tileX, int tileZ) {
|
||||
if ((levelOccludemap[level][tileX][tileZ] & wall1) != 0) {
|
||||
int minTileX = tileX;
|
||||
int maxTileX = tileX;
|
||||
int minLevel = level;
|
||||
int maxLevel = level;
|
||||
|
||||
find_min_level:
|
||||
for (/**/; minLevel > 0; minLevel--) {
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
if ((levelOccludemap[minLevel - 1][x][tileZ] & maskB) == 0) {
|
||||
break find_min_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (/**/; minTileX > 0; minTileX--) {
|
||||
if ((levelOccludemap[level][minTileX - 1][tileZ] & wall1) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (/**/; maxTileX < this.maxTileX; maxTileX++) {
|
||||
if ((levelOccludemap[level][maxTileX + 1][tileZ] & wall1) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
find_max_level:
|
||||
for (/**/; maxLevel < current; maxLevel++) {
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
if ((levelOccludemap[maxLevel + 1][x][tileZ] & maskB) == 0) {
|
||||
break find_max_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
find_min_level:
|
||||
for (/**/; minLevel > 0; minLevel--) {
|
||||
for (int x = minTileX; x <= maxTileX; x++) {
|
||||
if ((levelOccludemap[minLevel - 1][x][tileZ] & wall1) == 0) {
|
||||
break find_min_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int area = ((maxLevel + 1) - minLevel) * ((maxX - minX) + 1);
|
||||
find_max_level:
|
||||
for (/**/; maxLevel < top; maxLevel++) {
|
||||
for (int x = minTileX; x <= maxTileX; x++) {
|
||||
if ((levelOccludemap[maxLevel + 1][x][tileZ] & wall1) == 0) {
|
||||
break find_max_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (area >= 8) {
|
||||
int maxY = levelHeightmap[maxLevel][minX][tileZ] - 240;
|
||||
int minY = levelHeightmap[minLevel][minX][tileZ];
|
||||
Scene.method277(current, minX * 128, minY, (maxX * 128) + 128, tileZ * 128, maxY, tileZ * 128, 2);
|
||||
for (int i_97_ = minLevel; i_97_ <= maxLevel; i_97_++) {
|
||||
for (int i_98_ = minX; i_98_ <= maxX; i_98_++) {
|
||||
levelOccludemap[i_97_][i_98_][tileZ] &= ~maskB;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int area = ((maxLevel + 1) - minLevel) * ((maxTileX - minTileX) + 1);
|
||||
|
||||
if ((levelOccludemap[level][tileX][tileZ] & maskC) != 0) {
|
||||
int i_99_ = tileX;
|
||||
int i_100_ = tileX;
|
||||
int i_101_ = tileZ;
|
||||
int i_102_ = tileZ;
|
||||
for (/**/; i_101_ > 0; i_101_--) {
|
||||
if ((levelOccludemap[level][tileX][i_101_ - 1] & maskC) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (/**/; i_102_ < maxTileZ; i_102_++) {
|
||||
if ((levelOccludemap[level][tileX][i_102_ + 1] & maskC) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
while_4_:
|
||||
for (/**/; i_99_ > 0; i_99_--) {
|
||||
for (int i_103_ = i_101_; i_103_ <= i_102_; i_103_++) {
|
||||
if ((levelOccludemap[level][i_99_ - 1][i_103_] & maskC) == 0) {
|
||||
break while_4_;
|
||||
}
|
||||
}
|
||||
}
|
||||
while_5_:
|
||||
for (/**/; i_100_ < maxTileX; i_100_++) {
|
||||
for (int i_104_ = i_101_; i_104_ <= i_102_; i_104_++) {
|
||||
if ((levelOccludemap[level][i_100_ + 1][i_104_] & maskC) == 0) {
|
||||
break while_5_;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((((i_100_ - i_99_) + 1) * ((i_102_ - i_101_) + 1)) >= 4) {
|
||||
int i_105_ = levelHeightmap[level][i_99_][i_101_];
|
||||
Scene.method277(current, i_99_ * 128, i_105_, (i_100_ * 128) + 128, (i_102_ * 128) + 128, i_105_, i_101_ * 128, 4);
|
||||
for (int i_106_ = i_99_; i_106_ <= i_100_; i_106_++) {
|
||||
for (int i_107_ = i_101_; i_107_ <= i_102_; i_107_++) {
|
||||
levelOccludemap[level][i_106_][i_107_] &= ~maskC;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (area >= 8) {
|
||||
int minY = levelHeightmap[maxLevel][minTileX][tileZ] - 240;
|
||||
int maxY = levelHeightmap[minLevel][minTileX][tileZ];
|
||||
|
||||
Scene.addOccluder(top, minTileX * 128, maxY, (maxTileX * 128) + 128, tileZ * 128, minY, tileZ * 128, 2);
|
||||
|
||||
for (int l = minLevel; l <= maxLevel; l++) {
|
||||
for (int x = minTileX; x <= maxTileX; x++) {
|
||||
levelOccludemap[l][x][tileZ] &= ~wall1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buildWallOccluders0(int wall0, int top, int level, int tileX, int tileZ) {
|
||||
if ((levelOccludemap[level][tileX][tileZ] & wall0) != 0) {
|
||||
int minTileZ = tileZ;
|
||||
int maxTileZ = tileZ;
|
||||
int minLevel = level;
|
||||
int maxLevel = level;
|
||||
|
||||
for (/**/; minTileZ > 0; minTileZ--) {
|
||||
if ((levelOccludemap[level][tileX][minTileZ - 1] & wall0) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (/**/; maxTileZ < this.maxTileZ; maxTileZ++) {
|
||||
if ((levelOccludemap[level][tileX][maxTileZ + 1] & wall0) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
find_min_level:
|
||||
for (/**/; minLevel > 0; minLevel--) {
|
||||
for (int z = minTileZ; z <= maxTileZ; z++) {
|
||||
if ((levelOccludemap[minLevel - 1][tileX][z] & wall0) == 0) {
|
||||
break find_min_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
find_max_level:
|
||||
for (/**/; maxLevel < top; maxLevel++) {
|
||||
for (int z = minTileZ; z <= maxTileZ; z++) {
|
||||
if ((levelOccludemap[maxLevel + 1][tileX][z] & wall0) == 0) {
|
||||
break find_max_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int area = ((maxLevel + 1) - minLevel) * ((maxTileZ - minTileZ) + 1);
|
||||
|
||||
if (area >= 8) {
|
||||
int minY = levelHeightmap[maxLevel][tileX][minTileZ] - 240;
|
||||
int maxY = levelHeightmap[minLevel][tileX][minTileZ];
|
||||
|
||||
Scene.addOccluder(top, tileX * 128, maxY, tileX * 128, (maxTileZ * 128) + 128, minY, minTileZ * 128, 1);
|
||||
|
||||
for (int l = minLevel; l <= maxLevel; l++) {
|
||||
for (int z = minTileZ; z <= maxTileZ; z++) {
|
||||
levelOccludemap[l][tileX][z] &= ~wall0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -951,7 +1001,7 @@ public class SceneBuilder {
|
||||
scene.add(entity, level, x, z, heightmapAverage, 1, 1, 0, bitset, info);
|
||||
|
||||
if ((kind >= 12) && (kind <= 17) && (kind != 13) && (level > 0)) {
|
||||
levelOccludemap[level][x][z] |= 0x924;
|
||||
levelOccludemap[level][x][z] |= 0b100_100_100_100;
|
||||
}
|
||||
|
||||
if (type.solid && (collision != null)) {
|
||||
@@ -974,7 +1024,7 @@ public class SceneBuilder {
|
||||
levelShademap[level][x][z + 1] = (byte) 50;
|
||||
}
|
||||
if (type.occludes) {
|
||||
levelOccludemap[level][x][z] |= 0x249;
|
||||
levelOccludemap[level][x][z] |= 0b001_001_001_001;
|
||||
}
|
||||
} else if (rotation == 1) {
|
||||
if (type.castShadow) {
|
||||
@@ -982,7 +1032,7 @@ public class SceneBuilder {
|
||||
levelShademap[level][x + 1][z + 1] = (byte) 50;
|
||||
}
|
||||
if (type.occludes) {
|
||||
levelOccludemap[level][x][z + 1] |= 0x492;
|
||||
levelOccludemap[level][x][z + 1] |= 0b010_010_010_010;
|
||||
}
|
||||
} else if (rotation == 2) {
|
||||
if (type.castShadow) {
|
||||
@@ -990,7 +1040,7 @@ public class SceneBuilder {
|
||||
levelShademap[level][x + 1][z + 1] = (byte) 50;
|
||||
}
|
||||
if (type.occludes) {
|
||||
levelOccludemap[level][x + 1][z] |= 0x249;
|
||||
levelOccludemap[level][x + 1][z] |= 0b001_001_001_001;
|
||||
}
|
||||
} else if (rotation == 3) {
|
||||
if (type.castShadow) {
|
||||
@@ -998,7 +1048,7 @@ public class SceneBuilder {
|
||||
levelShademap[level][x + 1][z] = (byte) 50;
|
||||
}
|
||||
if (type.occludes) {
|
||||
levelOccludemap[level][x][z] |= 0x492;
|
||||
levelOccludemap[level][x][z] |= 0b010_010_010_010;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1049,17 +1099,17 @@ public class SceneBuilder {
|
||||
scene.setWall(WALL_ROTATION_OCCLUDE_TYPE[rotation], entity, WALL_ROTATION_OCCLUDE_TYPE[i_137_], entity_138_, level, x, z, heightmapAverage, bitset, info);
|
||||
if (type.occludes) {
|
||||
if (rotation == 0) {
|
||||
levelOccludemap[level][x][z] |= 0x249;
|
||||
levelOccludemap[level][x][z + 1] |= 0x492;
|
||||
levelOccludemap[level][x][z] |= 0b001_001_001_001;
|
||||
levelOccludemap[level][x][z + 1] |= 0b010_010_010_010;
|
||||
} else if (rotation == 1) {
|
||||
levelOccludemap[level][x][z + 1] |= 0x492;
|
||||
levelOccludemap[level][x + 1][z] |= 0x249;
|
||||
levelOccludemap[level][x][z + 1] |= 0b010_010_010_010;
|
||||
levelOccludemap[level][x + 1][z] |= 0b001_001_001_001;
|
||||
} else if (rotation == 2) {
|
||||
levelOccludemap[level][x + 1][z] |= 0x249;
|
||||
levelOccludemap[level][x][z] |= 0x492;
|
||||
levelOccludemap[level][x + 1][z] |= 0b001_001_001_001;
|
||||
levelOccludemap[level][x][z] |= 0b010_010_010_010;
|
||||
} else if (rotation == 3) {
|
||||
levelOccludemap[level][x][z] |= 0x492;
|
||||
levelOccludemap[level][x][z] |= 0x249;
|
||||
levelOccludemap[level][x][z] |= 0b010_010_010_010;
|
||||
levelOccludemap[level][x][z] |= 0b001_001_001_001;
|
||||
}
|
||||
}
|
||||
if (type.solid && (collision != null)) {
|
||||
@@ -1259,13 +1309,13 @@ public class SceneBuilder {
|
||||
break;
|
||||
}
|
||||
if (i_191_ <= 49) {
|
||||
aByteArrayArrayArray130[i_187_][i_186_][i] = buffer.read8();
|
||||
aByteArrayArrayArray136[i_187_][i_186_][i] = (byte) ((i_191_ - 2) / 4);
|
||||
aByteArrayArrayArray148[i_187_][i_186_][i] = (byte) (((i_191_ - 2) + i_188_) & 0x3);
|
||||
levelTileOverlayIDs[i_187_][i_186_][i] = buffer.read8();
|
||||
levelTileOverlayShape[i_187_][i_186_][i] = (byte) ((i_191_ - 2) / 4);
|
||||
levelTileOverlayRotation[i_187_][i_186_][i] = (byte) (((i_191_ - 2) + i_188_) & 0x3);
|
||||
} else if (i_191_ <= 81) {
|
||||
levelTileFlags[i_187_][i_186_][i] = (byte) (i_191_ - 49);
|
||||
} else {
|
||||
aByteArrayArrayArray142[i_187_][i_186_][i] = (byte) (i_191_ - 81);
|
||||
levelTileUnderlayIDs[i_187_][i_186_][i] = (byte) (i_191_ - 81);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -4,24 +4,24 @@
|
||||
|
||||
public class SceneOccluder {
|
||||
|
||||
public int anInt787;
|
||||
public int anInt788;
|
||||
public int anInt789;
|
||||
public int anInt790;
|
||||
public int anInt791;
|
||||
public int anInt792;
|
||||
public int anInt793;
|
||||
public int anInt794;
|
||||
public int anInt795;
|
||||
public int anInt796;
|
||||
public int anInt797;
|
||||
public int minTileX;
|
||||
public int maxTileX;
|
||||
public int minTileZ;
|
||||
public int maxTileZ;
|
||||
public int type;
|
||||
public int minX;
|
||||
public int maxX;
|
||||
public int minZ;
|
||||
public int maxZ;
|
||||
public int minY;
|
||||
public int maxY;
|
||||
public int mode;
|
||||
public int anInt799;
|
||||
public int anInt800;
|
||||
public int anInt801;
|
||||
public int anInt802;
|
||||
public int anInt803;
|
||||
public int anInt804;
|
||||
public int minDeltaX;
|
||||
public int maxDeltaX;
|
||||
public int minDeltaZ;
|
||||
public int maxDeltaZ;
|
||||
public int minDeltaY;
|
||||
public int maxDeltaY;
|
||||
|
||||
public SceneOccluder() {
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
public class SceneTile extends DoublyLinkedList.Node {
|
||||
|
||||
public final int anInt1308;
|
||||
public final int anInt1309;
|
||||
public final int anInt1310;
|
||||
public final int x;
|
||||
public final int z;
|
||||
public final int level;
|
||||
public final SceneLoc[] locs = new SceneLoc[5];
|
||||
public final int[] locFlags = new int[5];
|
||||
public int anInt1307;
|
||||
public int dataLevel;
|
||||
public SceneTileUnderlay underlay;
|
||||
public SceneTileOverlay overlay;
|
||||
public SceneWall wall;
|
||||
@@ -18,6 +18,10 @@ public class SceneTile extends DoublyLinkedList.Node {
|
||||
public SceneObjStack objStack;
|
||||
public int locCount;
|
||||
public int flags;
|
||||
/**
|
||||
* Used as a short circuit to prevent drawing tiles above the top level. Mostly applies to lowmem.
|
||||
* @see Scene#draw(int, int, int, int, int, int)
|
||||
*/
|
||||
public int drawLevel;
|
||||
public boolean aBoolean1322;
|
||||
public boolean aBoolean1323;
|
||||
@@ -28,10 +32,10 @@ public class SceneTile extends DoublyLinkedList.Node {
|
||||
public int anInt1328;
|
||||
public SceneTile bridge;
|
||||
|
||||
public SceneTile(int i, int j, int k) {
|
||||
anInt1310 = anInt1307 = i;
|
||||
anInt1308 = j;
|
||||
anInt1309 = k;
|
||||
public SceneTile(int level, int x, int z) {
|
||||
this.level = dataLevel = level;
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
}
|
||||
+253
-207
@@ -4,213 +4,259 @@
|
||||
|
||||
public class SceneTileOverlay {
|
||||
|
||||
public static final int[][] anIntArrayArray696 = {{1, 3, 5, 7}, {1, 3, 5, 7}, {1, 3, 5, 7}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 6}, {1, 3, 5, 7, 2, 6}, {1, 3, 5, 7, 2, 8}, {1, 3, 5, 7, 2, 8}, {1, 3, 5, 7, 11, 12}, {1, 3, 5, 7, 11, 12}, {1, 3, 5, 7, 13, 14}};
|
||||
public static final int[][] anIntArrayArray697 = {{0, 1, 2, 3, 0, 0, 1, 3}, {1, 1, 2, 3, 1, 0, 1, 3}, {0, 1, 2, 3, 1, 0, 1, 3}, {0, 0, 1, 2, 0, 0, 2, 4, 1, 0, 4, 3}, {0, 0, 1, 4, 0, 0, 4, 3, 1, 1, 2, 4}, {0, 0, 4, 3, 1, 0, 1, 2, 1, 0, 2, 4}, {0, 1, 2, 4, 1, 0, 1, 4, 1, 0, 4, 3}, {0, 4, 1, 2, 0, 4, 2, 5, 1, 0, 4, 5, 1, 0, 5, 3}, {0, 4, 1, 2, 0, 4, 2, 3, 0, 4, 3, 5, 1, 0, 4, 5}, {0, 0, 4, 5, 1, 4, 1, 2, 1, 4, 2, 3, 1, 4, 3, 5}, {0, 0, 1, 5, 0, 1, 4, 5, 0, 1, 2, 4, 1, 0, 5, 3, 1, 5, 4, 3, 1, 4, 2, 3}, {1, 0, 1, 5, 1, 1, 4, 5, 1, 1, 2, 4, 0, 0, 5, 3, 0, 5, 4, 3, 0, 4, 2, 3}, {1, 0, 5, 4, 1, 0, 1, 5, 0, 0, 4, 3, 0, 4, 5, 3, 0, 5, 2, 3, 0, 1, 2, 5}};
|
||||
public static final int[] anIntArray688 = new int[6];
|
||||
public static final int[] anIntArray689 = new int[6];
|
||||
public static final int[] anIntArray690 = new int[6];
|
||||
public static final int[] anIntArray691 = new int[6];
|
||||
public static final int[] anIntArray692 = new int[6];
|
||||
public final int[] anIntArray673;
|
||||
public final int[] anIntArray674;
|
||||
public final int[] anIntArray675;
|
||||
public final int[] anIntArray676;
|
||||
public final int[] anIntArray677;
|
||||
public final int[] anIntArray678;
|
||||
public final int[] anIntArray679;
|
||||
public final int[] anIntArray680;
|
||||
public final int[] anIntArray681;
|
||||
public final boolean aBoolean683;
|
||||
public final int shape;
|
||||
public final int angle;
|
||||
public final int backgroundRGB;
|
||||
public final int foregroundRGB;
|
||||
public int[] anIntArray682;
|
||||
public static final int[][] SHAPE_POINTS = {
|
||||
{1, 3, 5, 7},
|
||||
{1, 3, 5, 7},
|
||||
{1, 3, 5, 7},
|
||||
{1, 3, 5, 7, 6},
|
||||
{1, 3, 5, 7, 6},
|
||||
{1, 3, 5, 7, 6},
|
||||
{1, 3, 5, 7, 6},
|
||||
{1, 3, 5, 7, 2, 6},
|
||||
{1, 3, 5, 7, 2, 8},
|
||||
{1, 3, 5, 7, 2, 8},
|
||||
{1, 3, 5, 7, 11, 12},
|
||||
{1, 3, 5, 7, 11, 12},
|
||||
{1, 3, 5, 7, 13, 14},
|
||||
};
|
||||
public static final int[][] SHAPE_PATHS = {
|
||||
{0, 1, 2, 3, 0, 0, 1, 3},
|
||||
{1, 1, 2, 3, 1, 0, 1, 3},
|
||||
{0, 1, 2, 3, 1, 0, 1, 3},
|
||||
{0, 0, 1, 2, 0, 0, 2, 4, 1, 0, 4, 3},
|
||||
{0, 0, 1, 4, 0, 0, 4, 3, 1, 1, 2, 4},
|
||||
{0, 0, 4, 3, 1, 0, 1, 2, 1, 0, 2, 4},
|
||||
{0, 1, 2, 4, 1, 0, 1, 4, 1, 0, 4, 3},
|
||||
{0, 4, 1, 2, 0, 4, 2, 5, 1, 0, 4, 5, 1, 0, 5, 3},
|
||||
{0, 4, 1, 2, 0, 4, 2, 3, 0, 4, 3, 5, 1, 0, 4, 5},
|
||||
{0, 0, 4, 5, 1, 4, 1, 2, 1, 4, 2, 3, 1, 4, 3, 5},
|
||||
{0, 0, 1, 5, 0, 1, 4, 5, 0, 1, 2, 4, 1, 0, 5, 3, 1, 5, 4, 3, 1, 4, 2, 3},
|
||||
{1, 0, 1, 5, 1, 1, 4, 5, 1, 1, 2, 4, 0, 0, 5, 3, 0, 5, 4, 3, 0, 4, 2, 3},
|
||||
{1, 0, 5, 4, 1, 0, 1, 5, 0, 0, 4, 3, 0, 4, 5, 3, 0, 5, 2, 3, 0, 1, 2, 5},
|
||||
};
|
||||
|
||||
public SceneTileOverlay(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2, int k2, int l2, int i3, int j3, int k3, int l3, int i4, int k4, int l4) {
|
||||
aBoolean683 = (i3 == l2) && (i3 == l) && (i3 == k2);
|
||||
shape = j3;
|
||||
angle = k1;
|
||||
backgroundRGB = i2;
|
||||
foregroundRGB = l4;
|
||||
char c = '\200';
|
||||
int i5 = c / 2;
|
||||
int j5 = c / 4;
|
||||
int k5 = (c * 3) / 4;
|
||||
int[] ai = anIntArrayArray696[j3];
|
||||
int l5 = ai.length;
|
||||
anIntArray673 = new int[l5];
|
||||
anIntArray674 = new int[l5];
|
||||
anIntArray675 = new int[l5];
|
||||
int[] ai1 = new int[l5];
|
||||
int[] ai2 = new int[l5];
|
||||
int i6 = k4 * c;
|
||||
int j6 = i * c;
|
||||
for (int k6 = 0; k6 < l5; k6++) {
|
||||
int l6 = ai[k6];
|
||||
if (((l6 & 1) == 0) && (l6 <= 8)) {
|
||||
l6 = ((l6 - k1 - k1 - 1) & 7) + 1;
|
||||
}
|
||||
if ((l6 > 8) && (l6 <= 12)) {
|
||||
l6 = ((l6 - 9 - k1) & 3) + 9;
|
||||
}
|
||||
if ((l6 > 12) && (l6 <= 16)) {
|
||||
l6 = ((l6 - 13 - k1) & 3) + 13;
|
||||
}
|
||||
int i7;
|
||||
int k7;
|
||||
int i8;
|
||||
int k8;
|
||||
int j9;
|
||||
if (l6 == 1) {
|
||||
i7 = i6;
|
||||
k7 = j6;
|
||||
i8 = i3;
|
||||
k8 = l1;
|
||||
j9 = j;
|
||||
} else if (l6 == 2) {
|
||||
i7 = i6 + i5;
|
||||
k7 = j6;
|
||||
i8 = (i3 + l2) >> 1;
|
||||
k8 = (l1 + i4) >> 1;
|
||||
j9 = (j + l3) >> 1;
|
||||
} else if (l6 == 3) {
|
||||
i7 = i6 + c;
|
||||
k7 = j6;
|
||||
i8 = l2;
|
||||
k8 = i4;
|
||||
j9 = l3;
|
||||
} else if (l6 == 4) {
|
||||
i7 = i6 + c;
|
||||
k7 = j6 + i5;
|
||||
i8 = (l2 + l) >> 1;
|
||||
k8 = (i4 + j2) >> 1;
|
||||
j9 = (l3 + j1) >> 1;
|
||||
} else if (l6 == 5) {
|
||||
i7 = i6 + c;
|
||||
k7 = j6 + c;
|
||||
i8 = l;
|
||||
k8 = j2;
|
||||
j9 = j1;
|
||||
} else if (l6 == 6) {
|
||||
i7 = i6 + i5;
|
||||
k7 = j6 + c;
|
||||
i8 = (l + k2) >> 1;
|
||||
k8 = (j2 + k) >> 1;
|
||||
j9 = (j1 + k3) >> 1;
|
||||
} else if (l6 == 7) {
|
||||
i7 = i6;
|
||||
k7 = j6 + c;
|
||||
i8 = k2;
|
||||
k8 = k;
|
||||
j9 = k3;
|
||||
} else if (l6 == 8) {
|
||||
i7 = i6;
|
||||
k7 = j6 + i5;
|
||||
i8 = (k2 + i3) >> 1;
|
||||
k8 = (k + l1) >> 1;
|
||||
j9 = (k3 + j) >> 1;
|
||||
} else if (l6 == 9) {
|
||||
i7 = i6 + i5;
|
||||
k7 = j6 + j5;
|
||||
i8 = (i3 + l2) >> 1;
|
||||
k8 = (l1 + i4) >> 1;
|
||||
j9 = (j + l3) >> 1;
|
||||
} else if (l6 == 10) {
|
||||
i7 = i6 + k5;
|
||||
k7 = j6 + i5;
|
||||
i8 = (l2 + l) >> 1;
|
||||
k8 = (i4 + j2) >> 1;
|
||||
j9 = (l3 + j1) >> 1;
|
||||
} else if (l6 == 11) {
|
||||
i7 = i6 + i5;
|
||||
k7 = j6 + k5;
|
||||
i8 = (l + k2) >> 1;
|
||||
k8 = (j2 + k) >> 1;
|
||||
j9 = (j1 + k3) >> 1;
|
||||
} else if (l6 == 12) {
|
||||
i7 = i6 + j5;
|
||||
k7 = j6 + i5;
|
||||
i8 = (k2 + i3) >> 1;
|
||||
k8 = (k + l1) >> 1;
|
||||
j9 = (k3 + j) >> 1;
|
||||
} else if (l6 == 13) {
|
||||
i7 = i6 + j5;
|
||||
k7 = j6 + j5;
|
||||
i8 = i3;
|
||||
k8 = l1;
|
||||
j9 = j;
|
||||
} else if (l6 == 14) {
|
||||
i7 = i6 + k5;
|
||||
k7 = j6 + j5;
|
||||
i8 = l2;
|
||||
k8 = i4;
|
||||
j9 = l3;
|
||||
} else if (l6 == 15) {
|
||||
i7 = i6 + k5;
|
||||
k7 = j6 + k5;
|
||||
i8 = l;
|
||||
k8 = j2;
|
||||
j9 = j1;
|
||||
} else {
|
||||
i7 = i6 + j5;
|
||||
k7 = j6 + k5;
|
||||
i8 = k2;
|
||||
k8 = k;
|
||||
j9 = k3;
|
||||
}
|
||||
anIntArray673[k6] = i7;
|
||||
anIntArray674[k6] = i8;
|
||||
anIntArray675[k6] = k7;
|
||||
ai1[k6] = k8;
|
||||
ai2[k6] = j9;
|
||||
}
|
||||
int[] ai3 = anIntArrayArray697[j3];
|
||||
int j7 = ai3.length / 4;
|
||||
anIntArray679 = new int[j7];
|
||||
anIntArray680 = new int[j7];
|
||||
anIntArray681 = new int[j7];
|
||||
anIntArray676 = new int[j7];
|
||||
anIntArray677 = new int[j7];
|
||||
anIntArray678 = new int[j7];
|
||||
if (i1 != -1) {
|
||||
anIntArray682 = new int[j7];
|
||||
}
|
||||
int l7 = 0;
|
||||
for (int j8 = 0; j8 < j7; j8++) {
|
||||
int l8 = ai3[l7];
|
||||
int k9 = ai3[l7 + 1];
|
||||
int i10 = ai3[l7 + 2];
|
||||
int k10 = ai3[l7 + 3];
|
||||
l7 += 4;
|
||||
if (k9 < 4) {
|
||||
k9 = (k9 - k1) & 3;
|
||||
}
|
||||
if (i10 < 4) {
|
||||
i10 = (i10 - k1) & 3;
|
||||
}
|
||||
if (k10 < 4) {
|
||||
k10 = (k10 - k1) & 3;
|
||||
}
|
||||
anIntArray679[j8] = k9;
|
||||
anIntArray680[j8] = i10;
|
||||
anIntArray681[j8] = k10;
|
||||
if (l8 == 0) {
|
||||
anIntArray676[j8] = ai1[k9];
|
||||
anIntArray677[j8] = ai1[i10];
|
||||
anIntArray678[j8] = ai1[k10];
|
||||
if (anIntArray682 != null) {
|
||||
anIntArray682[j8] = -1;
|
||||
}
|
||||
} else {
|
||||
anIntArray676[j8] = ai2[k9];
|
||||
anIntArray677[j8] = ai2[i10];
|
||||
anIntArray678[j8] = ai2[k10];
|
||||
if (anIntArray682 != null) {
|
||||
anIntArray682[j8] = i1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static final int[] tmpScreenX = new int[6];
|
||||
public static final int[] tmpScreenY = new int[6];
|
||||
public static final int[] tmpViewspaceX = new int[6];
|
||||
public static final int[] tmpViewspaceY = new int[6];
|
||||
public static final int[] tmpViewspaceZ = new int[6];
|
||||
public final int[] vertexX;
|
||||
public final int[] vertexY;
|
||||
public final int[] vertexZ;
|
||||
public final int[] triangleColorA;
|
||||
public final int[] triangleColorB;
|
||||
public final int[] triangleColorC;
|
||||
public final int[] triangleVertexA;
|
||||
public final int[] triangleVertexB;
|
||||
public final int[] triangleVertexC;
|
||||
public final boolean flat;
|
||||
public final int shape;
|
||||
public final int rotation;
|
||||
public final int backgroundRGB;
|
||||
public final int foregroundRGB;
|
||||
public int[] triangleTextureIDs;
|
||||
|
||||
public SceneTileOverlay(int tileZ, int southwestColor2, int northwestColor1, int northeastY, int textureID, int northeastColor2, int rotation, int southwestColor1, int backgroundRGB, int northeastColor1, int northwestY, int southeastY, int southwestY, int shape, int northwestColor2, int southeastColor2, int southeastColor1, int tileX, int foregroundRGB) {
|
||||
flat = (southwestY == southeastY) && (southwestY == northeastY) && (southwestY == northwestY);
|
||||
this.shape = shape;
|
||||
this.rotation = rotation;
|
||||
this.backgroundRGB = backgroundRGB;
|
||||
this.foregroundRGB = foregroundRGB;
|
||||
|
||||
final int ONE = 128;
|
||||
final int HALF = ONE / 2;
|
||||
final int QUARTER = ONE / 4;
|
||||
final int THREE_QUARTER = (ONE * 3) / 4;
|
||||
|
||||
int[] points = SHAPE_POINTS[shape];
|
||||
int vertexCount = points.length;
|
||||
vertexX = new int[vertexCount];
|
||||
vertexY = new int[vertexCount];
|
||||
vertexZ = new int[vertexCount];
|
||||
int[] primaryColors = new int[vertexCount];
|
||||
int[] secondaryColors = new int[vertexCount];
|
||||
|
||||
int sceneX = tileX * ONE;
|
||||
int sceneZ = tileZ * ONE;
|
||||
|
||||
for (int v = 0; v < vertexCount; v++) {
|
||||
int type = points[v];
|
||||
|
||||
if (((type & 1) == 0) && (type <= 8)) {
|
||||
type = ((type - rotation - rotation - 1) & 7) + 1;
|
||||
}
|
||||
|
||||
if ((type > 8) && (type <= 12)) {
|
||||
type = ((type - 9 - rotation) & 3) + 9;
|
||||
}
|
||||
|
||||
if ((type > 12) && (type <= 16)) {
|
||||
type = ((type - 13 - rotation) & 3) + 13;
|
||||
}
|
||||
|
||||
int x;
|
||||
int z;
|
||||
int y;
|
||||
int color1;
|
||||
int color2;
|
||||
if (type == 1) {
|
||||
x = sceneX;
|
||||
z = sceneZ;
|
||||
y = southwestY;
|
||||
color1 = southwestColor1;
|
||||
color2 = southwestColor2;
|
||||
} else if (type == 2) {
|
||||
x = sceneX + HALF;
|
||||
z = sceneZ;
|
||||
y = (southwestY + southeastY) >> 1;
|
||||
color1 = (southwestColor1 + southeastColor1) >> 1;
|
||||
color2 = (southwestColor2 + southeastColor2) >> 1;
|
||||
} else if (type == 3) {
|
||||
x = sceneX + ONE;
|
||||
z = sceneZ;
|
||||
y = southeastY;
|
||||
color1 = southeastColor1;
|
||||
color2 = southeastColor2;
|
||||
} else if (type == 4) {
|
||||
x = sceneX + ONE;
|
||||
z = sceneZ + HALF;
|
||||
y = (southeastY + northeastY) >> 1;
|
||||
color1 = (southeastColor1 + northeastColor1) >> 1;
|
||||
color2 = (southeastColor2 + northeastColor2) >> 1;
|
||||
} else if (type == 5) {
|
||||
x = sceneX + ONE;
|
||||
z = sceneZ + ONE;
|
||||
y = northeastY;
|
||||
color1 = northeastColor1;
|
||||
color2 = northeastColor2;
|
||||
} else if (type == 6) {
|
||||
x = sceneX + HALF;
|
||||
z = sceneZ + ONE;
|
||||
y = (northeastY + northwestY) >> 1;
|
||||
color1 = (northeastColor1 + northwestColor1) >> 1;
|
||||
color2 = (northeastColor2 + northwestColor2) >> 1;
|
||||
} else if (type == 7) {
|
||||
x = sceneX;
|
||||
z = sceneZ + ONE;
|
||||
y = northwestY;
|
||||
color1 = northwestColor1;
|
||||
color2 = northwestColor2;
|
||||
} else if (type == 8) {
|
||||
x = sceneX;
|
||||
z = sceneZ + HALF;
|
||||
y = (northwestY + southwestY) >> 1;
|
||||
color1 = (northwestColor1 + southwestColor1) >> 1;
|
||||
color2 = (northwestColor2 + southwestColor2) >> 1;
|
||||
} else if (type == 9) {
|
||||
x = sceneX + HALF;
|
||||
z = sceneZ + QUARTER;
|
||||
y = (southwestY + southeastY) >> 1;
|
||||
color1 = (southwestColor1 + southeastColor1) >> 1;
|
||||
color2 = (southwestColor2 + southeastColor2) >> 1;
|
||||
} else if (type == 10) {
|
||||
x = sceneX + THREE_QUARTER;
|
||||
z = sceneZ + HALF;
|
||||
y = (southeastY + northeastY) >> 1;
|
||||
color1 = (southeastColor1 + northeastColor1) >> 1;
|
||||
color2 = (southeastColor2 + northeastColor2) >> 1;
|
||||
} else if (type == 11) {
|
||||
x = sceneX + HALF;
|
||||
z = sceneZ + THREE_QUARTER;
|
||||
y = (northeastY + northwestY) >> 1;
|
||||
color1 = (northeastColor1 + northwestColor1) >> 1;
|
||||
color2 = (northeastColor2 + northwestColor2) >> 1;
|
||||
} else if (type == 12) {
|
||||
x = sceneX + QUARTER;
|
||||
z = sceneZ + HALF;
|
||||
y = (northwestY + southwestY) >> 1;
|
||||
color1 = (northwestColor1 + southwestColor1) >> 1;
|
||||
color2 = (northwestColor2 + southwestColor2) >> 1;
|
||||
} else if (type == 13) {
|
||||
x = sceneX + QUARTER;
|
||||
z = sceneZ + QUARTER;
|
||||
y = southwestY;
|
||||
color1 = southwestColor1;
|
||||
color2 = southwestColor2;
|
||||
} else if (type == 14) {
|
||||
x = sceneX + THREE_QUARTER;
|
||||
z = sceneZ + QUARTER;
|
||||
y = southeastY;
|
||||
color1 = southeastColor1;
|
||||
color2 = southeastColor2;
|
||||
} else if (type == 15) {
|
||||
x = sceneX + THREE_QUARTER;
|
||||
z = sceneZ + THREE_QUARTER;
|
||||
y = northeastY;
|
||||
color1 = northeastColor1;
|
||||
color2 = northeastColor2;
|
||||
} else {
|
||||
x = sceneX + QUARTER;
|
||||
z = sceneZ + THREE_QUARTER;
|
||||
y = northwestY;
|
||||
color1 = northwestColor1;
|
||||
color2 = northwestColor2;
|
||||
}
|
||||
vertexX[v] = x;
|
||||
vertexY[v] = y;
|
||||
vertexZ[v] = z;
|
||||
primaryColors[v] = color1;
|
||||
secondaryColors[v] = color2;
|
||||
}
|
||||
|
||||
int[] paths = SHAPE_PATHS[shape];
|
||||
int triangleCount = paths.length / 4;
|
||||
triangleVertexA = new int[triangleCount];
|
||||
triangleVertexB = new int[triangleCount];
|
||||
triangleVertexC = new int[triangleCount];
|
||||
triangleColorA = new int[triangleCount];
|
||||
triangleColorB = new int[triangleCount];
|
||||
triangleColorC = new int[triangleCount];
|
||||
|
||||
if (textureID != -1) {
|
||||
triangleTextureIDs = new int[triangleCount];
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (int i = 0; i < triangleCount; i++) {
|
||||
int color = paths[index];
|
||||
int a = paths[index + 1];
|
||||
int b = paths[index + 2];
|
||||
int c = paths[index + 3];
|
||||
|
||||
index += 4;
|
||||
|
||||
if (a < 4) {
|
||||
a = (a - rotation) & 3;
|
||||
}
|
||||
|
||||
if (b < 4) {
|
||||
b = (b - rotation) & 3;
|
||||
}
|
||||
|
||||
if (c < 4) {
|
||||
c = (c - rotation) & 3;
|
||||
}
|
||||
|
||||
triangleVertexA[i] = a;
|
||||
triangleVertexB[i] = b;
|
||||
triangleVertexC[i] = c;
|
||||
|
||||
if (color == 0) {
|
||||
triangleColorA[i] = primaryColors[a];
|
||||
triangleColorB[i] = primaryColors[b];
|
||||
triangleColorC[i] = primaryColors[c];
|
||||
if (triangleTextureIDs != null) {
|
||||
triangleTextureIDs[i] = -1;
|
||||
}
|
||||
} else {
|
||||
triangleColorA[i] = secondaryColors[a];
|
||||
triangleColorB[i] = secondaryColors[b];
|
||||
triangleColorC[i] = secondaryColors[c];
|
||||
if (triangleTextureIDs != null) {
|
||||
triangleTextureIDs[i] = textureID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,23 +4,22 @@
|
||||
|
||||
public class SceneTileUnderlay {
|
||||
|
||||
public final int anInt716;
|
||||
public final int anInt717;
|
||||
public final int anInt718;
|
||||
public final int anInt719;
|
||||
public final int anInt720;
|
||||
public final int southwestColor;
|
||||
public final int southeastColor;
|
||||
public final int northeastColor;
|
||||
public final int northwestColor;
|
||||
public final int textureID;
|
||||
public final int rgb;
|
||||
public boolean aBoolean721;
|
||||
public boolean flat;
|
||||
|
||||
public SceneTileUnderlay(int i, int j, int k, int l, int i1, int j1, boolean flag) {
|
||||
aBoolean721 = true;
|
||||
anInt716 = i;
|
||||
anInt717 = j;
|
||||
anInt718 = k;
|
||||
anInt719 = l;
|
||||
anInt720 = i1;
|
||||
rgb = j1;
|
||||
aBoolean721 = flag;
|
||||
public SceneTileUnderlay(int southwestColor, int southeastColor, int northeastColor, int northwestColor, int textureID, int rgb, boolean flat) {
|
||||
this.southwestColor = southwestColor;
|
||||
this.southeastColor = southeastColor;
|
||||
this.northeastColor = northeastColor;
|
||||
this.northwestColor = northwestColor;
|
||||
this.textureID = textureID;
|
||||
this.rgb = rgb;
|
||||
this.flat = flat;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user