Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package client;
- public final class Texture extends DrawingArea {
- public static void nullLoader() {
- anIntArray1468 = null;
- anIntArray1468 = null;
- anIntArray1470 = null;
- anIntArray1471 = null;
- anIntArray1472 = null;
- aBackgroundArray1474s = null;
- aBooleanArray1475 = null;
- anIntArray1476 = null;
- anIntArrayArray1478 = null;
- anIntArrayArray1479 = null;
- anIntArray1480 = null;
- anIntArray1482 = null;
- anIntArrayArray1483 = null;
- }
- public static void method364() {
- anIntArray1472 = new int[DrawingArea.height];
- for (int j = 0; j < DrawingArea.height; j++)
- anIntArray1472[j] = DrawingArea.width * j;
- textureInt1 = DrawingArea.width / 2;
- textureInt2 = DrawingArea.height / 2;
- }
- public static void method365(int j, int k) {
- anIntArray1472 = new int[k];
- for (int l = 0; l < k; l++)
- anIntArray1472[l] = j * l;
- textureInt1 = j / 2;
- textureInt2 = k / 2;
- }
- public static void method366() {
- anIntArrayArray1478 = null;
- for (int j = 0; j < 52; j++)
- anIntArrayArray1479[j] = null;
- }
- public static void method367() {
- if (anIntArrayArray1478 == null) {
- anInt1477 = 20;// was parameter
- if (lowMem)
- anIntArrayArray1478 = new int[anInt1477][16384];
- else
- anIntArrayArray1478 = new int[anInt1477][0x10000];
- for (int k = 0; k < 52; k++)
- anIntArrayArray1479[k] = null;
- }
- }
- public static void unpack(StreamLoader streamLoader) {
- anInt1473 = 0;
- for (int j = 0; j < 52; j++)
- try {
- aBackgroundArray1474s[j] = new Background(streamLoader,
- String.valueOf(j), 0);
- if (lowMem && aBackgroundArray1474s[j].anInt1456 == 128)
- aBackgroundArray1474s[j].method356();
- else
- aBackgroundArray1474s[j].method357();
- anInt1473++;
- } catch (Exception _ex) {
- }
- }
- public static void method368(StreamLoader streamLoader) {
- anInt1473 = 0;
- for (int j = 0; j < 52; j++)
- try {
- aBackgroundArray1474s[j] = new Background(streamLoader,
- String.valueOf(j), 0);
- if (lowMem && aBackgroundArray1474s[j].anInt1456 == 128)
- aBackgroundArray1474s[j].method356();
- else
- aBackgroundArray1474s[j].method357();
- anInt1473++;
- } catch (Exception _ex) {
- }
- }
- public static int method369(int i) {
- if (anIntArray1476[i] != 0)
- return anIntArray1476[i];
- int k = 0;
- int l = 0;
- int i1 = 0;
- int j1 = anIntArrayArray1483[i].length;
- for (int k1 = 0; k1 < j1; k1++) {
- k += anIntArrayArray1483[i][k1] >> 16 & 0xff;
- l += anIntArrayArray1483[i][k1] >> 8 & 0xff;
- i1 += anIntArrayArray1483[i][k1] & 0xff;
- }
- int l1 = (k / j1 << 16) + (l / j1 << 8) + i1 / j1;
- l1 = method373(l1, 1.3999999999999999D);
- if (l1 == 0)
- l1 = 1;
- anIntArray1476[i] = l1;
- return l1;
- }
- public static void method370(int i) {
- if (anIntArrayArray1479[i] == null)
- return;
- anIntArrayArray1478[anInt1477++] = anIntArrayArray1479[i];
- anIntArrayArray1479[i] = null;
- }
- private static int[] getTexturePixels(int textureId) {
- anIntArray1480[textureId] = anInt1481++;
- if (anIntArrayArray1479[textureId] != null)
- return anIntArrayArray1479[textureId];
- int ai[];
- if (anInt1477 > 0) {
- ai = anIntArrayArray1478[--anInt1477];
- anIntArrayArray1478[anInt1477] = null;
- } else {
- int j = 0;
- int k = -1;
- for (int l = 0; l < anInt1473; l++)
- if (anIntArrayArray1479[l] != null
- && (anIntArray1480[l] < j || k == -1)) {
- j = anIntArray1480[l];
- k = l;
- }
- ai = anIntArrayArray1479[k];
- anIntArrayArray1479[k] = null;
- }
- anIntArrayArray1479[textureId] = ai;
- Background background = aBackgroundArray1474s[textureId];
- int ai1[] = anIntArrayArray1483[textureId];
- if (lowMem) {
- aBooleanArray1475[textureId] = false;
- for (int i1 = 0; i1 < 4096; i1++) {
- int i2 = ai[i1] = ai1[background.aByteArray1450[i1]] & 0xf8f8ff;
- if (i2 == 0)
- aBooleanArray1475[textureId] = true;
- ai[4096 + i1] = i2 - (i2 >>> 3) & 0xf8f8ff;
- ai[8192 + i1] = i2 - (i2 >>> 2) & 0xf8f8ff;
- ai[12288 + i1] = i2 - (i2 >>> 2) - (i2 >>> 3) & 0xf8f8ff;
- }
- } else {
- if (background.anInt1452 == 64) {
- for (int j1 = 0; j1 < 128; j1++) {
- for (int j2 = 0; j2 < 128; j2++)
- ai[j2 + (j1 << 7)] = ai1[background.aByteArray1450[(j2 >> 1)
- + ((j1 >> 1) << 6)]];
- }
- } else {
- for (int k1 = 0; k1 < 16384; k1++)
- ai[k1] = ai1[background.aByteArray1450[k1]];
- }
- aBooleanArray1475[textureId] = false;
- for (int l1 = 0; l1 < 16384; l1++) {
- ai[l1] &= 0xf8f8ff;
- int k2 = ai[l1];
- if (k2 == 0)
- aBooleanArray1475[textureId] = true;
- ai[16384 + l1] = k2 - (k2 >>> 3) & 0xf8f8ff;
- ai[32768 + l1] = k2 - (k2 >>> 2) & 0xf8f8ff;
- ai[49152 + l1] = k2 - (k2 >>> 2) - (k2 >>> 3) & 0xf8f8ff;
- }
- }
- return ai;
- }
- public static void method372(double d) {
- d += Math.random() * 0.029999999999999999D - 0.014999999999999999D;
- int j = 0;
- for (int k = 0; k < 512; k++) {
- double d1 = k / 8 / 64D + 0.0078125D;
- double d2 = (k & 7) / 8D + 0.0625D;
- for (int k1 = 0; k1 < 128; k1++) {
- double d3 = k1 / 128D;
- double d4 = d3;
- double d5 = d3;
- double d6 = d3;
- if (d2 != 0.0D) {
- double d7;
- if (d3 < 0.5D)
- d7 = d3 * (1.0D + d2);
- else
- d7 = (d3 + d2) - d3 * d2;
- double d8 = 2D * d3 - d7;
- double d9 = d1 + 0.33333333333333331D;
- if (d9 > 1.0D)
- d9--;
- double d10 = d1;
- double d11 = d1 - 0.33333333333333331D;
- if (d11 < 0.0D)
- d11++;
- if (6D * d9 < 1.0D)
- d4 = d8 + (d7 - d8) * 6D * d9;
- else if (2D * d9 < 1.0D)
- d4 = d7;
- else if (3D * d9 < 2D)
- d4 = d8 + (d7 - d8) * (0.66666666666666663D - d9) * 6D;
- else
- d4 = d8;
- if (6D * d10 < 1.0D)
- d5 = d8 + (d7 - d8) * 6D * d10;
- else if (2D * d10 < 1.0D)
- d5 = d7;
- else if (3D * d10 < 2D)
- d5 = d8 + (d7 - d8) * (0.66666666666666663D - d10) * 6D;
- else
- d5 = d8;
- if (6D * d11 < 1.0D)
- d6 = d8 + (d7 - d8) * 6D * d11;
- else if (2D * d11 < 1.0D)
- d6 = d7;
- else if (3D * d11 < 2D)
- d6 = d8 + (d7 - d8) * (0.66666666666666663D - d11) * 6D;
- else
- d6 = d8;
- }
- int l1 = (int) (d4 * 256D);
- int i2 = (int) (d5 * 256D);
- int j2 = (int) (d6 * 256D);
- int k2 = (l1 << 16) + (i2 << 8) + j2;
- k2 = method373(k2, d);
- if (k2 == 0)
- k2 = 1;
- anIntArray1482[j++] = k2;
- }
- }
- for (int l = 0; l < 52; l++)
- if (aBackgroundArray1474s[l] != null) {
- int ai[] = aBackgroundArray1474s[l].anIntArray1451;
- anIntArrayArray1483[l] = new int[ai.length];
- for (int j1 = 0; j1 < ai.length; j1++) {
- anIntArrayArray1483[l][j1] = method373(ai[j1], d);
- if ((anIntArrayArray1483[l][j1] & 0xf8f8ff) == 0 && j1 != 0)
- anIntArrayArray1483[l][j1] = 1;
- }
- }
- for (int i1 = 0; i1 < 52; i1++)
- method370(i1);
- }
- private static int method373(int i, double d) {
- double d1 = (i >> 16) / 256D;
- double d2 = (i >> 8 & 0xff) / 256D;
- double d3 = (i & 0xff) / 256D;
- d1 = Math.pow(d1, d);
- d2 = Math.pow(d2, d);
- d3 = Math.pow(d3, d);
- int j = (int) (d1 * 256D);
- int k = (int) (d2 * 256D);
- int l = (int) (d3 * 256D);
- return (j << 16) + (k << 8) + l;
- }
- public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_b, int x_c, int hsl1, int hsl2, int hsl3, float z_a, float z_b, float z_c) {
- if (z_a < 0 || z_b < 0 || z_c < 0)
- return;
- int a_to_b = 0;
- int k2 = 0;
- if (y_b != y_a) {
- a_to_b = (x_b - x_a << 16) / (y_b - y_a);
- k2 = (hsl2 - hsl1 << 15) / (y_b - y_a);
- }
- int b_to_c = 0;
- int i3 = 0;
- if (y_c != y_b) {
- b_to_c = (x_c - x_b << 16) / (y_c - y_b);
- i3 = (hsl3 - hsl2 << 15) / (y_c - y_b);
- }
- int c_to_a = 0;
- int k3 = 0;
- if (y_c != y_a) {
- c_to_a = (x_a - x_c << 16) / (y_a - y_c);
- k3 = (hsl1 - hsl3 << 15) / (y_a - y_c);
- }
- float b_aX = x_b - x_a;
- float b_aY = y_b - y_a;
- float c_aX = x_c - x_a;
- float c_aY = y_c - y_a;
- float b_aZ = z_b - z_a;
- float c_aZ = z_c - z_a;
- float div = b_aX * c_aY - c_aX * b_aY;
- float depth_slope = (b_aZ * c_aY - c_aZ * b_aY) / div;
- float depth_increment = (c_aZ * b_aX - b_aZ * c_aX) / div;
- if (y_a <= y_b && y_a <= y_c) {
- if (y_a >= DrawingArea.bottomY)
- return;
- if (y_b > DrawingArea.bottomY)
- y_b = DrawingArea.bottomY;
- if (y_c > DrawingArea.bottomY)
- y_c = DrawingArea.bottomY;
- z_a = z_a - depth_slope * x_a + depth_slope;
- if (y_b < y_c) {
- x_c = x_a <<= 16;
- hsl3 = hsl1 <<= 15;
- if (y_a < 0) {
- x_c -= c_to_a * y_a;
- x_a -= a_to_b * y_a;
- hsl3 -= k3 * y_a;
- hsl1 -= k2 * y_a;
- z_a -= depth_increment * y_a;
- y_a = 0;
- }
- x_b <<= 16;
- hsl2 <<= 15;
- if (y_b < 0) {
- x_b -= b_to_c * y_b;
- hsl2 -= i3 * y_b;
- y_b = 0;
- }
- if (y_a != y_b && c_to_a < a_to_b || y_a == y_b && c_to_a > b_to_c) {
- y_c -= y_b;
- y_b -= y_a;
- for (y_a = anIntArray1472[y_a]; --y_b >= 0; y_a += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_a, x_c >> 16, x_a >> 16, hsl3 >> 7, hsl1 >> 7, z_a, depth_slope);
- x_c += c_to_a;
- x_a += a_to_b;
- hsl3 += k3;
- hsl1 += k2;
- z_a += depth_increment;
- }
- while (--y_c >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_a, x_c >> 16, x_b >> 16, hsl3 >> 7, hsl2 >> 7, z_a, depth_slope);
- x_c += c_to_a;
- x_b += b_to_c;
- hsl3 += k3;
- hsl2 += i3;
- y_a += DrawingArea.width;
- z_a += depth_increment;
- }
- return;
- }
- y_c -= y_b;
- y_b -= y_a;
- for (y_a = anIntArray1472[y_a]; --y_b >= 0; y_a += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_a, x_a >> 16, x_c >> 16, hsl1 >> 7, hsl3 >> 7, z_a, depth_slope);
- x_c += c_to_a;
- x_a += a_to_b;
- hsl3 += k3;
- hsl1 += k2;
- z_a += depth_increment;
- }
- while (--y_c >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_a, x_b >> 16, x_c >> 16, hsl2 >> 7, hsl3 >> 7, z_a, depth_slope);
- x_c += c_to_a;
- x_b += b_to_c;
- hsl3 += k3;
- hsl2 += i3;
- y_a += DrawingArea.width;
- z_a += depth_increment;
- }
- return;
- }
- x_b = x_a <<= 16;
- hsl2 = hsl1 <<= 15;
- if (y_a < 0) {
- x_b -= c_to_a * y_a;
- x_a -= a_to_b * y_a;
- hsl2 -= k3 * y_a;
- hsl1 -= k2 * y_a;
- z_a -= depth_increment * y_a;
- y_a = 0;
- }
- x_c <<= 16;
- hsl3 <<= 15;
- if (y_c < 0) {
- x_c -= b_to_c * y_c;
- hsl3 -= i3 * y_c;
- y_c = 0;
- }
- if (y_a != y_c && c_to_a < a_to_b || y_a == y_c && b_to_c > a_to_b) {
- y_b -= y_c;
- y_c -= y_a;
- for (y_a = anIntArray1472[y_a]; --y_c >= 0; y_a += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_a, x_b >> 16, x_a >> 16, hsl2 >> 7, hsl1 >> 7, z_a, depth_slope);
- x_b += c_to_a;
- x_a += a_to_b;
- hsl2 += k3;
- hsl1 += k2;
- z_a += depth_increment;
- }
- while (--y_b >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_a, x_c >> 16, x_a >> 16, hsl3 >> 7, hsl1 >> 7, z_a, depth_slope);
- x_c += b_to_c;
- x_a += a_to_b;
- hsl3 += i3;
- hsl1 += k2;
- y_a += DrawingArea.width;
- z_a += depth_increment;
- }
- return;
- }
- y_b -= y_c;
- y_c -= y_a;
- for (y_a = anIntArray1472[y_a]; --y_c >= 0; y_a += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_a, x_a >> 16, x_b >> 16, hsl1 >> 7, hsl2 >> 7, z_a, depth_slope);
- x_b += c_to_a;
- x_a += a_to_b;
- hsl2 += k3;
- hsl1 += k2;
- z_a += depth_increment;
- }
- while (--y_b >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_a, x_a >> 16, x_c >> 16, hsl1 >> 7, hsl3 >> 7, z_a, depth_slope);
- x_c += b_to_c;
- x_a += a_to_b;
- hsl3 += i3;
- hsl1 += k2;
- y_a += DrawingArea.width;
- z_a += depth_increment;
- }
- return;
- }
- if (y_b <= y_c) {
- if (y_b >= DrawingArea.bottomY)
- return;
- if (y_c > DrawingArea.bottomY)
- y_c = DrawingArea.bottomY;
- if (y_a > DrawingArea.bottomY)
- y_a = DrawingArea.bottomY;
- z_b = z_b - depth_slope * x_b + depth_slope;
- if (y_c < y_a) {
- x_a = x_b <<= 16;
- hsl1 = hsl2 <<= 15;
- if (y_b < 0) {
- x_a -= a_to_b * y_b;
- x_b -= b_to_c * y_b;
- hsl1 -= k2 * y_b;
- hsl2 -= i3 * y_b;
- z_b -= depth_increment * y_b;
- y_b = 0;
- }
- x_c <<= 16;
- hsl3 <<= 15;
- if (y_c < 0) {
- x_c -= c_to_a * y_c;
- hsl3 -= k3 * y_c;
- y_c = 0;
- }
- if (y_b != y_c && a_to_b < b_to_c || y_b == y_c && a_to_b > c_to_a) {
- y_a -= y_c;
- y_c -= y_b;
- for (y_b = anIntArray1472[y_b]; --y_c >= 0; y_b += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_b, x_a >> 16, x_b >> 16, hsl1 >> 7, hsl2 >> 7, z_b, depth_slope);
- x_a += a_to_b;
- x_b += b_to_c;
- hsl1 += k2;
- hsl2 += i3;
- z_b += depth_increment;
- }
- while (--y_a >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_b, x_a >> 16, x_c >> 16, hsl1 >> 7, hsl3 >> 7, z_b, depth_slope);
- x_a += a_to_b;
- x_c += c_to_a;
- hsl1 += k2;
- hsl3 += k3;
- y_b += DrawingArea.width;
- z_b += depth_increment;
- }
- return;
- }
- y_a -= y_c;
- y_c -= y_b;
- for (y_b = anIntArray1472[y_b]; --y_c >= 0; y_b += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_b, x_b >> 16, x_a >> 16, hsl2 >> 7, hsl1 >> 7, z_b, depth_slope);
- x_a += a_to_b;
- x_b += b_to_c;
- hsl1 += k2;
- hsl2 += i3;
- z_b += depth_increment;
- }
- while (--y_a >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_b, x_c >> 16, x_a >> 16, hsl3 >> 7, hsl1 >> 7, z_b, depth_slope);
- x_a += a_to_b;
- x_c += c_to_a;
- hsl1 += k2;
- hsl3 += k3;
- y_b += DrawingArea.width;
- z_b += depth_increment;
- }
- return;
- }
- x_c = x_b <<= 16;
- hsl3 = hsl2 <<= 15;
- if (y_b < 0) {
- x_c -= a_to_b * y_b;
- x_b -= b_to_c * y_b;
- hsl3 -= k2 * y_b;
- hsl2 -= i3 * y_b;
- z_b -= depth_increment * y_b;
- y_b = 0;
- }
- x_a <<= 16;
- hsl1 <<= 15;
- if (y_a < 0) {
- x_a -= c_to_a * y_a;
- hsl1 -= k3 * y_a;
- y_a = 0;
- }
- if (a_to_b < b_to_c) {
- y_c -= y_a;
- y_a -= y_b;
- for (y_b = anIntArray1472[y_b]; --y_a >= 0; y_b += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_b, x_c >> 16, x_b >> 16, hsl3 >> 7, hsl2 >> 7, z_b, depth_slope);
- x_c += a_to_b;
- x_b += b_to_c;
- hsl3 += k2;
- hsl2 += i3;
- z_b += depth_increment;
- }
- while (--y_c >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_b, x_a >> 16, x_b >> 16, hsl1 >> 7, hsl2 >> 7, z_b, depth_slope);
- x_a += c_to_a;
- x_b += b_to_c;
- hsl1 += k3;
- hsl2 += i3;
- y_b += DrawingArea.width;
- z_b += depth_increment;
- }
- return;
- }
- y_c -= y_a;
- y_a -= y_b;
- for (y_b = anIntArray1472[y_b]; --y_a >= 0; y_b += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_b, x_b >> 16, x_c >> 16, hsl2 >> 7, hsl3 >> 7, z_b, depth_slope);
- x_c += a_to_b;
- x_b += b_to_c;
- hsl3 += k2;
- hsl2 += i3;
- z_b += depth_increment;
- }
- while (--y_c >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_b, x_b >> 16, x_a >> 16, hsl2 >> 7, hsl1 >> 7, z_b, depth_slope);
- x_a += c_to_a;
- x_b += b_to_c;
- hsl1 += k3;
- hsl2 += i3;
- y_b += DrawingArea.width;
- z_b += depth_increment;
- }
- return;
- }
- if (y_c >= DrawingArea.bottomY)
- return;
- if (y_a > DrawingArea.bottomY)
- y_a = DrawingArea.bottomY;
- if (y_b > DrawingArea.bottomY)
- y_b = DrawingArea.bottomY;
- z_c = z_c - depth_slope * x_c + depth_slope;
- if (y_a < y_b) {
- x_b = x_c <<= 16;
- hsl2 = hsl3 <<= 15;
- if (y_c < 0) {
- x_b -= b_to_c * y_c;
- x_c -= c_to_a * y_c;
- hsl2 -= i3 * y_c;
- hsl3 -= k3 * y_c;
- z_c -= depth_increment * y_c;
- y_c = 0;
- }
- x_a <<= 16;
- hsl1 <<= 15;
- if (y_a < 0) {
- x_a -= a_to_b * y_a;
- hsl1 -= k2 * y_a;
- y_a = 0;
- }
- if (b_to_c < c_to_a) {
- y_b -= y_a;
- y_a -= y_c;
- for (y_c = anIntArray1472[y_c]; --y_a >= 0; y_c += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_c, x_b >> 16, x_c >> 16, hsl2 >> 7, hsl3 >> 7, z_c, depth_slope);
- x_b += b_to_c;
- x_c += c_to_a;
- hsl2 += i3;
- hsl3 += k3;
- z_c += depth_increment;
- }
- while (--y_b >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_c, x_b >> 16, x_a >> 16, hsl2 >> 7, hsl1 >> 7, z_c, depth_slope);
- x_b += b_to_c;
- x_a += a_to_b;
- hsl2 += i3;
- hsl1 += k2;
- y_c += DrawingArea.width;
- z_c += depth_increment;
- }
- return;
- }
- y_b -= y_a;
- y_a -= y_c;
- for (y_c = anIntArray1472[y_c]; --y_a >= 0; y_c += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_c, x_c >> 16, x_b >> 16, hsl3 >> 7, hsl2 >> 7, z_c, depth_slope);
- x_b += b_to_c;
- x_c += c_to_a;
- hsl2 += i3;
- hsl3 += k3;
- z_c += depth_increment;
- }
- while (--y_b >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_c, x_a >> 16, x_b >> 16, hsl1 >> 7, hsl2 >> 7, z_c, depth_slope);
- x_b += b_to_c;
- x_a += a_to_b;
- hsl2 += i3;
- hsl1 += k2;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- return;
- }
- x_a = x_c <<= 16;
- hsl1 = hsl3 <<= 15;
- if (y_c < 0) {
- x_a -= b_to_c * y_c;
- x_c -= c_to_a * y_c;
- hsl1 -= i3 * y_c;
- hsl3 -= k3 * y_c;
- z_c -= depth_increment * y_c;
- y_c = 0;
- }
- x_b <<= 16;
- hsl2 <<= 15;
- if (y_b < 0) {
- x_b -= a_to_b * y_b;
- hsl2 -= k2 * y_b;
- y_b = 0;
- }
- if (b_to_c < c_to_a) {
- y_a -= y_b;
- y_b -= y_c;
- for (y_c = anIntArray1472[y_c]; --y_b >= 0; y_c += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_c, x_a >> 16, x_c >> 16, hsl1 >> 7, hsl3 >> 7, z_c, depth_slope);
- x_a += b_to_c;
- x_c += c_to_a;
- hsl1 += i3;
- hsl3 += k3;
- z_c += depth_increment;
- }
- while (--y_a >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_c, x_b >> 16, x_c >> 16, hsl2 >> 7, hsl3 >> 7, z_c, depth_slope);
- x_b += a_to_b;
- x_c += c_to_a;
- hsl2 += k2;
- hsl3 += k3;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- return;
- }
- y_a -= y_b;
- y_b -= y_c;
- for (y_c = anIntArray1472[y_c]; --y_b >= 0; y_c += DrawingArea.width) {
- drawShadedScanline(DrawingArea.pixels, y_c, x_c >> 16, x_a >> 16, hsl3 >> 7, hsl1 >> 7, z_c, depth_slope);
- x_a += b_to_c;
- x_c += c_to_a;
- hsl1 += i3;
- hsl3 += k3;
- z_c += depth_increment;
- }
- while (--y_a >= 0) {
- drawShadedScanline(DrawingArea.pixels, y_c, x_c >> 16, x_b >> 16, hsl3 >> 7, hsl2 >> 7, z_c, depth_slope);
- x_b += a_to_b;
- x_c += c_to_a;
- hsl2 += k2;
- hsl3 += k3;
- y_c += DrawingArea.width;
- z_c += depth_increment;
- }
- }
- public static void drawShadedScanline(int[] dest, int offset, int x1, int x2, int j1, int k1, float depth, float depth_slope) {
- int j;
- int k;
- int l1 = 0;
- if (aBoolean1462) {
- if (x2 > DrawingArea.centerX)
- x2 = DrawingArea.centerX;
- if (x1 < 0) {
- j1 -= x1 * l1;
- x1 = 0;
- }
- }
- if (x1 < x2) {
- offset += x1;
- j1 += l1 * x1;
- if (aBoolean1464) {
- k = x2 - x1 >> 2;
- if (k > 0)
- l1 = (k1 - j1) * anIntArray1468[k] >> 15;
- else
- l1 = 0;
- if (anInt1465 == 0) {
- if (k > 0) {
- do {
- j = anIntArray1482[j1 >> 8];
- j1 += l1;
- dest[offset] = j;
- offset++;
- dest[offset] = j;
- offset++;
- dest[offset] = j;
- offset++;
- dest[offset] = j;
- offset++;
- } while (--k > 0);
- }
- k = x2 - x1 & 0x3;
- if (k > 0) {
- j = anIntArray1482[j1 >> 8];
- do
- dest[offset++] = j;
- while (--k > 0);
- }
- } else {
- int j2 = anInt1465;
- int l2 = 256 - anInt1465;
- if (k > 0) {
- do {
- j = anIntArray1482[j1 >> 8];
- j1 += l1;
- j = (((j & 0xff00ff) * l2 >> 8 & 0xff00ff) + ((j & 0xff00)
- * l2 >> 8 & 0xff00));
- int h = dest[offset];
- dest[offset] = (j + ((h & 0xff00ff) * j2 >> 8 & 0xff00ff) + ((h & 0xff00)
- * j2 >> 8 & 0xff00));
- offset++;
- h = dest[offset];
- dest[offset] = (j + ((h & 0xff00ff) * j2 >> 8 & 0xff00ff) + ((h & 0xff00)
- * j2 >> 8 & 0xff00));
- offset++;
- h = dest[offset];
- dest[offset] = (j + ((h & 0xff00ff) * j2 >> 8 & 0xff00ff) + ((h & 0xff00)
- * j2 >> 8 & 0xff00));
- offset++;
- h = dest[offset];
- dest[offset] = (j + ((h & 0xff00ff) * j2 >> 8 & 0xff00ff) + ((h & 0xff00)
- * j2 >> 8 & 0xff00));
- offset++;
- } while (--k > 0);
- }
- k = x2 - x1 & 0x3;
- if (k > 0) {
- j = anIntArray1482[j1 >> 8];
- j = (((j & 0xff00ff) * l2 >> 8 & 0xff00ff) + ((j & 0xff00)
- * l2 >> 8 & 0xff00));
- do {
- int i_61_ = dest[offset];
- dest[offset] = (j
- + ((i_61_ & 0xff00ff) * j2 >> 8 & 0xff00ff) + ((i_61_ & 0xff00)
- * j2 >> 8 & 0xff00));
- offset++;
- } while (--k > 0);
- }
- }
- } else {
- int i2 = (k1 - j1) / (x2 - x1);
- k = x2 - x1;
- depth += depth_slope * (float) x1;
- if (anInt1465 == 0) {
- do {
- dest[offset] = anIntArray1482[j1 >> 8];
- DrawingArea.depthBuffer[offset] = depth;
- depth += depth_slope;
- offset++;
- j1 += i2;
- } while (--k > 0);
- } else {
- int i_62_ = anInt1465;
- int i_63_ = 256 - anInt1465;
- do {
- j = anIntArray1482[j1 >> 8];
- j1 += i2;
- j = (((j & 0xff00ff) * i_63_ >> 8 & 0xff00ff) + ((j & 0xff00) * i_63_ >> 8 & 0xff00));
- int i_64_ = dest[offset];
- dest[offset] = (j + ((i_64_ & 0xff00ff) * i_62_ >> 8 & 0xff00ff) + ((i_64_ & 0xff00) * i_62_ >> 8 & 0xff00));
- DrawingArea.depthBuffer[offset] = depth;
- depth += depth_slope;
- offset++;
- } while (--k > 0);
- }
- }
- }
- }
- public static void drawFlatTriangle(int y_a, int y_b, int y_c, int x_a, int x_b, int x_c, int k1, float z_a, float z_b, float z_c) {
- if (z_a < 0 || z_b < 0 || z_c < 0) {
- return;
- }
- int a_to_b = 0;
- if (y_b != y_a)
- a_to_b = (x_b - x_a << 16) / (y_b - y_a);
- int b_to_c = 0;
- if (y_c != y_b)
- b_to_c = (x_c - x_b << 16) / (y_c - y_b);
- int c_to_a = 0;
- if (y_c != y_a)
- c_to_a = (x_a - x_c << 16) / (y_a - y_c);
- float b_aX = x_b - x_a;
- float b_aY = y_b - y_a;
- float c_aX = x_c - x_a;
- float c_aY = y_c - y_a;
- float b_aZ = z_b - z_a;
- float c_aZ = z_c - z_a;
- float div = b_aX * c_aY - c_aX * b_aY;
- float depth_slope = (b_aZ * c_aY - c_aZ * b_aY) / div;
- float depth_increment = (c_aZ * b_aX - b_aZ * c_aX) / div;
- if (y_a <= y_b && y_a <= y_c) {
- if (y_a >= DrawingArea.bottomY)
- return;
- if (y_b > DrawingArea.bottomY)
- y_b = DrawingArea.bottomY;
- if (y_c > DrawingArea.bottomY)
- y_c = DrawingArea.bottomY;
- z_a = z_a - depth_slope * x_a + depth_slope;
- if (y_b < y_c) {
- x_c = x_a <<= 16;
- if (y_a < 0) {
- x_c -= c_to_a * y_a;
- x_a -= a_to_b * y_a;
- z_a -= depth_increment * y_a;
- y_a = 0;
- }
- x_b <<= 16;
- if (y_b < 0) {
- x_b -= b_to_c * y_b;
- y_b = 0;
- }
- if (y_a != y_b && c_to_a < a_to_b || y_a == y_b && c_to_a > b_to_c) {
- y_c -= y_b;
- y_b -= y_a;
- for (y_a = anIntArray1472[y_a]; --y_b >= 0; y_a += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_a, k1, x_c >> 16, x_a >> 16, z_a, depth_slope);
- x_c += c_to_a;
- x_a += a_to_b;
- z_a += depth_increment;
- }
- while (--y_c >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_a, k1, x_c >> 16, x_b >> 16, z_a, depth_slope);
- x_c += c_to_a;
- x_b += b_to_c;
- y_a += DrawingArea.width;
- z_a += depth_increment;
- }
- return;
- }
- y_c -= y_b;
- y_b -= y_a;
- for (y_a = anIntArray1472[y_a]; --y_b >= 0; y_a += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_a, k1, x_a >> 16, x_c >> 16, z_a, depth_slope);
- x_c += c_to_a;
- x_a += a_to_b;
- z_a += depth_increment;
- }
- while (--y_c >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_a, k1, x_b >> 16, x_c >> 16, z_a, depth_slope);
- x_c += c_to_a;
- x_b += b_to_c;
- y_a += DrawingArea.width;
- z_a += depth_increment;
- }
- return;
- }
- x_b = x_a <<= 16;
- if (y_a < 0) {
- x_b -= c_to_a * y_a;
- x_a -= a_to_b * y_a;
- z_a -= depth_increment * y_a;
- y_a = 0;
- }
- x_c <<= 16;
- if (y_c < 0) {
- x_c -= b_to_c * y_c;
- y_c = 0;
- }
- if (y_a != y_c && c_to_a < a_to_b || y_a == y_c && b_to_c > a_to_b) {
- y_b -= y_c;
- y_c -= y_a;
- for (y_a = anIntArray1472[y_a]; --y_c >= 0; y_a += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_a, k1, x_b >> 16, x_a >> 16, z_a, depth_slope);
- z_a += depth_increment;
- x_b += c_to_a;
- x_a += a_to_b;
- }
- while (--y_b >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_a, k1, x_c >> 16, x_a >> 16, z_a, depth_slope);
- z_a += depth_increment;
- x_c += b_to_c;
- x_a += a_to_b;
- y_a += DrawingArea.width;
- }
- return;
- }
- y_b -= y_c;
- y_c -= y_a;
- for (y_a = anIntArray1472[y_a]; --y_c >= 0; y_a += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_a, k1, x_a >> 16, x_b >> 16, z_a, depth_slope);
- z_a += depth_increment;
- x_b += c_to_a;
- x_a += a_to_b;
- }
- while (--y_b >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_a, k1, x_a >> 16, x_c >> 16, z_a, depth_slope);
- z_a += depth_increment;
- x_c += b_to_c;
- x_a += a_to_b;
- y_a += DrawingArea.width;
- }
- return;
- }
- if (y_b <= y_c) {
- if (y_b >= DrawingArea.bottomY)
- return;
- if (y_c > DrawingArea.bottomY)
- y_c = DrawingArea.bottomY;
- if (y_a > DrawingArea.bottomY)
- y_a = DrawingArea.bottomY;
- z_b = z_b - depth_slope * x_b + depth_slope;
- if (y_c < y_a) {
- x_a = x_b <<= 16;
- if (y_b < 0) {
- x_a -= a_to_b * y_b;
- x_b -= b_to_c * y_b;
- z_b -= depth_increment * y_b;
- y_b = 0;
- }
- x_c <<= 16;
- if (y_c < 0) {
- x_c -= c_to_a * y_c;
- y_c = 0;
- }
- if (y_b != y_c && a_to_b < b_to_c || y_b == y_c && a_to_b > c_to_a) {
- y_a -= y_c;
- y_c -= y_b;
- for (y_b = anIntArray1472[y_b]; --y_c >= 0; y_b += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_b, k1, x_a >> 16, x_b >> 16, z_b, depth_slope);
- z_b += depth_increment;
- x_a += a_to_b;
- x_b += b_to_c;
- }
- while (--y_a >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_b, k1, x_a >> 16, x_c >> 16, z_b, depth_slope);
- z_b += depth_increment;
- x_a += a_to_b;
- x_c += c_to_a;
- y_b += DrawingArea.width;
- }
- return;
- }
- y_a -= y_c;
- y_c -= y_b;
- for (y_b = anIntArray1472[y_b]; --y_c >= 0; y_b += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_b, k1, x_b >> 16, x_a >> 16, z_b, depth_slope);
- z_b += depth_increment;
- x_a += a_to_b;
- x_b += b_to_c;
- }
- while (--y_a >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_b, k1, x_c >> 16, x_a >> 16, z_b, depth_slope);
- z_b += depth_increment;
- x_a += a_to_b;
- x_c += c_to_a;
- y_b += DrawingArea.width;
- }
- return;
- }
- x_c = x_b <<= 16;
- if (y_b < 0) {
- x_c -= a_to_b * y_b;
- x_b -= b_to_c * y_b;
- z_b -= depth_increment * y_b;
- y_b = 0;
- }
- x_a <<= 16;
- if (y_a < 0) {
- x_a -= c_to_a * y_a;
- y_a = 0;
- }
- if (a_to_b < b_to_c) {
- y_c -= y_a;
- y_a -= y_b;
- for (y_b = anIntArray1472[y_b]; --y_a >= 0; y_b += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_b, k1, x_c >> 16, x_b >> 16, z_b, depth_slope);
- z_b += depth_increment;
- x_c += a_to_b;
- x_b += b_to_c;
- }
- while (--y_c >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_b, k1, x_a >> 16, x_b >> 16, z_b, depth_slope);
- z_b += depth_increment;
- x_a += c_to_a;
- x_b += b_to_c;
- y_b += DrawingArea.width;
- }
- return;
- }
- y_c -= y_a;
- y_a -= y_b;
- for (y_b = anIntArray1472[y_b]; --y_a >= 0; y_b += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_b, k1, x_b >> 16, x_c >> 16, z_b, depth_slope);
- z_b += depth_increment;
- x_c += a_to_b;
- x_b += b_to_c;
- }
- while (--y_c >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_b, k1, x_b >> 16, x_a >> 16, z_b, depth_slope);
- z_b += depth_increment;
- x_a += c_to_a;
- x_b += b_to_c;
- y_b += DrawingArea.width;
- }
- return;
- }
- if (y_c >= DrawingArea.bottomY)
- return;
- if (y_a > DrawingArea.bottomY)
- y_a = DrawingArea.bottomY;
- if (y_b > DrawingArea.bottomY)
- y_b = DrawingArea.bottomY;
- z_c = z_c - depth_slope * x_c + depth_slope;
- if (y_a < y_b) {
- x_b = x_c <<= 16;
- if (y_c < 0) {
- x_b -= b_to_c * y_c;
- x_c -= c_to_a * y_c;
- z_c -= depth_increment * y_c;
- y_c = 0;
- }
- x_a <<= 16;
- if (y_a < 0) {
- x_a -= a_to_b * y_a;
- y_a = 0;
- }
- if (b_to_c < c_to_a) {
- y_b -= y_a;
- y_a -= y_c;
- for (y_c = anIntArray1472[y_c]; --y_a >= 0; y_c += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_c, k1, x_b >> 16, x_c >> 16, z_c, depth_slope);
- z_c += depth_increment;
- x_b += b_to_c;
- x_c += c_to_a;
- }
- while (--y_b >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_c, k1, x_b >> 16, x_a >> 16, z_c, depth_slope);
- z_c += depth_increment;
- x_b += b_to_c;
- x_a += a_to_b;
- y_c += DrawingArea.width;
- }
- return;
- }
- y_b -= y_a;
- y_a -= y_c;
- for (y_c = anIntArray1472[y_c]; --y_a >= 0; y_c += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_c, k1, x_c >> 16, x_b >> 16, z_c, depth_slope);
- z_c += depth_increment;
- x_b += b_to_c;
- x_c += c_to_a;
- }
- while (--y_b >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_c, k1, x_a >> 16, x_b >> 16, z_c, depth_slope);
- z_c += depth_increment;
- x_b += b_to_c;
- x_a += a_to_b;
- y_c += DrawingArea.width;
- }
- return;
- }
- x_a = x_c <<= 16;
- if (y_c < 0) {
- x_a -= b_to_c * y_c;
- x_c -= c_to_a * y_c;
- z_c -= depth_increment * y_c;
- y_c = 0;
- }
- x_b <<= 16;
- if (y_b < 0) {
- x_b -= a_to_b * y_b;
- y_b = 0;
- }
- if (b_to_c < c_to_a) {
- y_a -= y_b;
- y_b -= y_c;
- for (y_c = anIntArray1472[y_c]; --y_b >= 0; y_c += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_c, k1, x_a >> 16, x_c >> 16, z_c, depth_slope);
- z_c += depth_increment;
- x_a += b_to_c;
- x_c += c_to_a;
- }
- while (--y_a >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_c, k1, x_b >> 16, x_c >> 16, z_c, depth_slope);
- z_c += depth_increment;
- x_b += a_to_b;
- x_c += c_to_a;
- y_c += DrawingArea.width;
- }
- return;
- }
- y_a -= y_b;
- y_b -= y_c;
- for (y_c = anIntArray1472[y_c]; --y_b >= 0; y_c += DrawingArea.width) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_c, k1, x_c >> 16, x_a >> 16, z_c, depth_slope);
- z_c += depth_increment;
- x_a += b_to_c;
- x_c += c_to_a;
- }
- while (--y_a >= 0) {
- drawFlatTexturedScanline(DrawingArea.pixels, y_c, k1, x_c >> 16, x_b >> 16, z_c, depth_slope);
- z_c += depth_increment;
- x_b += a_to_b;
- x_c += c_to_a;
- y_c += DrawingArea.width;
- }
- }
- private static void drawFlatTexturedScanline(int dest[], int dest_off, int loops, int start_x, int end_x, float depth, float depth_slope) {
- int rgb;// was parameter
- if (aBoolean1462) {
- if (end_x > DrawingArea.centerX)
- end_x = DrawingArea.centerX;
- if (start_x < 0)
- start_x = 0;
- }
- if (start_x >= end_x)
- return;
- dest_off += start_x;
- rgb = end_x - start_x >> 2;
- depth += depth_slope * (float) start_x;
- if (anInt1465 == 0) {
- while (--rgb >= 0) {
- for (int i = 0; i < 4; i++) {
- dest[dest_off] = loops;
- DrawingArea.depthBuffer[dest_off] = depth;
- dest_off++;
- depth += depth_slope;
- }
- }
- for (rgb = end_x - start_x & 3; --rgb >= 0;) {
- dest[dest_off] = loops;
- DrawingArea.depthBuffer[dest_off] = depth;
- dest_off++;
- depth += depth_slope;
- }
- return;
- }
- int dest_alpha = anInt1465;
- int src_alpha = 256 - anInt1465;
- loops = ((loops & 0xff00ff) * src_alpha >> 8 & 0xff00ff)
- + ((loops & 0xff00) * src_alpha >> 8 & 0xff00);
- while (--rgb >= 0) {
- for (int i = 0; i < 4; i++) {
- dest[dest_off] = loops + ((dest[dest_off] & 0xff00ff) * dest_alpha >> 8 & 0xff00ff) + ((dest[dest_off] & 0xff00) * dest_alpha >> 8 & 0xff00);
- DrawingArea.depthBuffer[dest_off] = depth;
- dest_off++;
- depth += depth_slope;
- }
- }
- for (rgb = end_x - start_x & 3; --rgb >= 0;) {
- dest[dest_off] = loops + ((dest[dest_off] & 0xff00ff) * dest_alpha >> 8 & 0xff00ff) + ((dest[dest_off] & 0xff00) * dest_alpha >> 8 & 0xff00);
- DrawingArea.depthBuffer[dest_off] = depth;
- dest_off++;
- depth += depth_slope;
- }
- }
- public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int x_b, int x_c,
- int k1, int l1, int i2, int Px, int Mx, int Nx, int Pz, int Mz,
- int Nz, int Py, int My, int Ny, int k4, float z_a, float z_b, float z_c) {
- if (z_a < 0 || z_b < 0 || z_c < 0)
- return;
- int texture[] = getTexturePixels(k4);
- aBoolean1463 = !aBooleanArray1475[k4];
- Mx = Px - Mx;
- Mz = Pz - Mz;
- My = Py - My;
- Nx -= Px;
- Nz -= Pz;
- Ny -= Py;
- int Oa = Nx * Pz - Nz * Px << (Client.viewDistance == 9 ? 14 : 15);
- int Ha = Nz * Py - Ny * Pz << 8;
- int Va = Ny * Px - Nx * Py << 5;
- int Ob = Mx * Pz - Mz * Px << (Client.viewDistance == 9 ? 14 : 15);
- int Hb = Mz * Py - My * Pz << 8;
- int Vb = My * Px - Mx * Py << 5;
- int Oc = Mz * Nx - Mx * Nz << (Client.viewDistance == 9 ? 14 : 15);
- int Hc = My * Nz - Mz * Ny << 8;
- int Vc = Mx * Ny - My * Nx << 5;
- int a_to_b = 0;
- int grad_a_off = 0;
- if (y_b != y_a) {
- a_to_b = (x_b - x_a << 16) / (y_b - y_a);
- grad_a_off = (l1 - k1 << 16) / (y_b - y_a);
- }
- int b_to_c = 0;
- int grad_b_off = 0;
- if (y_c != y_b) {
- b_to_c = (x_c - x_b << 16) / (y_c - y_b);
- grad_b_off = (i2 - l1 << 16) / (y_c - y_b);
- }
- int c_to_a = 0;
- int grad_c_off = 0;
- if (y_c != y_a) {
- c_to_a = (x_a - x_c << 16) / (y_a - y_c);
- grad_c_off = (k1 - i2 << 16) / (y_a - y_c);
- }
- float b_aX = x_b - x_a;
- float b_aY = y_b - y_a;
- float c_aX = x_c - x_a;
- float c_aY = y_c - y_a;
- float b_aZ = z_b - z_a;
- float c_aZ = z_c - z_a;
- float div = b_aX * c_aY - c_aX * b_aY;
- float depth_slope = (b_aZ * c_aY - c_aZ * b_aY) / div;
- float depth_increment = (c_aZ * b_aX - b_aZ * c_aX) / div;
- if (y_a <= y_b && y_a <= y_c) {
- if (y_a >= DrawingArea.bottomY)
- return;
- if (y_b > DrawingArea.bottomY)
- y_b = DrawingArea.bottomY;
- if (y_c > DrawingArea.bottomY)
- y_c = DrawingArea.bottomY;
- z_a = z_a - depth_slope * x_a + depth_slope;
- if (y_b < y_c) {
- x_c = x_a <<= 16;
- i2 = k1 <<= 16;
- if (y_a < 0) {
- x_c -= c_to_a * y_a;
- x_a -= a_to_b * y_a;
- z_a -= depth_increment * y_a;
- i2 -= grad_c_off * y_a;
- k1 -= grad_a_off * y_a;
- y_a = 0;
- }
- x_b <<= 16;
- l1 <<= 16;
- if (y_b < 0) {
- x_b -= b_to_c * y_b;
- l1 -= grad_b_off * y_b;
- y_b = 0;
- }
- int k8 = y_a - textureInt2;
- Oa += Va * k8;
- Ob += Vb * k8;
- Oc += Vc * k8;
- if (y_a != y_b && c_to_a < a_to_b || y_a == y_b && c_to_a > b_to_c) {
- y_c -= y_b;
- y_b -= y_a;
- y_a = anIntArray1472[y_a];
- while (--y_b >= 0) {
- method379(DrawingArea.pixels, texture, y_a, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope);
- x_c += c_to_a;
- x_a += a_to_b;
- z_a += depth_increment;
- i2 += grad_c_off;
- k1 += grad_a_off;
- y_a += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_c >= 0) {
- method379(DrawingArea.pixels, texture, y_a, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope);
- x_c += c_to_a;
- x_b += b_to_c;
- z_a += depth_increment;
- i2 += grad_c_off;
- l1 += grad_b_off;
- y_a += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- y_c -= y_b;
- y_b -= y_a;
- y_a = anIntArray1472[y_a];
- while (--y_b >= 0) {
- method379(DrawingArea.pixels, texture, y_a, x_a >> 16, x_c >> 16,
- k1 >> 8, i2 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope);
- x_c += c_to_a;
- x_a += a_to_b;
- z_a += depth_increment;
- i2 += grad_c_off;
- k1 += grad_a_off;
- y_a += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_c >= 0) {
- method379(DrawingArea.pixels, texture, y_a, x_b >> 16, x_c >> 16,
- l1 >> 8, i2 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope);
- x_c += c_to_a;
- x_b += b_to_c;
- z_a += depth_increment;
- i2 += grad_c_off;
- l1 += grad_b_off;
- y_a += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- x_b = x_a <<= 16;
- l1 = k1 <<= 16;
- if (y_a < 0) {
- x_b -= c_to_a * y_a;
- x_a -= a_to_b * y_a;
- z_a -= depth_increment * y_a;
- l1 -= grad_c_off * y_a;
- k1 -= grad_a_off * y_a;
- y_a = 0;
- }
- x_c <<= 16;
- i2 <<= 16;
- if (y_c < 0) {
- x_c -= b_to_c * y_c;
- i2 -= grad_b_off * y_c;
- y_c = 0;
- }
- int l8 = y_a - textureInt2;
- Oa += Va * l8;
- Ob += Vb * l8;
- Oc += Vc * l8;
- if (y_a != y_c && c_to_a < a_to_b || y_a == y_c && b_to_c > a_to_b) {
- y_b -= y_c;
- y_c -= y_a;
- y_a = anIntArray1472[y_a];
- while (--y_c >= 0) {
- method379(DrawingArea.pixels, texture, y_a, x_b >> 16, x_a >> 16,
- l1 >> 8, k1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope);
- x_b += c_to_a;
- x_a += a_to_b;
- l1 += grad_c_off;
- k1 += grad_a_off;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_b >= 0) {
- method379(DrawingArea.pixels, texture, y_a, x_c >> 16, x_a >> 16,
- i2 >> 8, k1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope);
- x_c += b_to_c;
- x_a += a_to_b;
- i2 += grad_b_off;
- k1 += grad_a_off;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- y_b -= y_c;
- y_c -= y_a;
- y_a = anIntArray1472[y_a];
- while (--y_c >= 0) {
- method379(DrawingArea.pixels, texture, y_a, x_a >> 16, x_b >> 16,
- k1 >> 8, l1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope);
- x_b += c_to_a;
- x_a += a_to_b;
- l1 += grad_c_off;
- k1 += grad_a_off;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_b >= 0) {
- method379(DrawingArea.pixels, texture, y_a, x_a >> 16, x_c >> 16,
- k1 >> 8, i2 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope);
- x_c += b_to_c;
- x_a += a_to_b;
- i2 += grad_b_off;
- k1 += grad_a_off;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- if (y_b <= y_c) {
- if (y_b >= DrawingArea.bottomY)
- return;
- if (y_c > DrawingArea.bottomY)
- y_c = DrawingArea.bottomY;
- if (y_a > DrawingArea.bottomY)
- y_a = DrawingArea.bottomY;
- z_b = z_b - depth_slope * x_b + depth_slope;
- if (y_c < y_a) {
- x_a = x_b <<= 16;
- k1 = l1 <<= 16;
- if (y_b < 0) {
- x_a -= a_to_b * y_b;
- x_b -= b_to_c * y_b;
- z_b -= depth_increment * y_b;
- k1 -= grad_a_off * y_b;
- l1 -= grad_b_off * y_b;
- y_b = 0;
- }
- x_c <<= 16;
- i2 <<= 16;
- if (y_c < 0) {
- x_c -= c_to_a * y_c;
- i2 -= grad_c_off * y_c;
- y_c = 0;
- }
- int i9 = y_b - textureInt2;
- Oa += Va * i9;
- Ob += Vb * i9;
- Oc += Vc * i9;
- if (y_b != y_c && a_to_b < b_to_c || y_b == y_c && a_to_b > c_to_a) {
- y_a -= y_c;
- y_c -= y_b;
- y_b = anIntArray1472[y_b];
- while (--y_c >= 0) {
- method379(DrawingArea.pixels, texture, y_b, x_a >> 16, x_b >> 16,
- k1 >> 8, l1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope);
- x_a += a_to_b;
- x_b += b_to_c;
- k1 += grad_a_off;
- l1 += grad_b_off;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_a >= 0) {
- method379(DrawingArea.pixels, texture, y_b, x_a >> 16, x_c >> 16,
- k1 >> 8, i2 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope);
- x_a += a_to_b;
- x_c += c_to_a;
- k1 += grad_a_off;
- i2 += grad_c_off;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- y_a -= y_c;
- y_c -= y_b;
- y_b = anIntArray1472[y_b];
- while (--y_c >= 0) {
- method379(DrawingArea.pixels, texture, y_b, x_b >> 16, x_a >> 16,
- l1 >> 8, k1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope);
- x_a += a_to_b;
- x_b += b_to_c;
- k1 += grad_a_off;
- l1 += grad_b_off;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_a >= 0) {
- method379(DrawingArea.pixels, texture, y_b, x_c >> 16, x_a >> 16,
- i2 >> 8, k1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope);
- x_a += a_to_b;
- x_c += c_to_a;
- k1 += grad_a_off;
- i2 += grad_c_off;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- x_c = x_b <<= 16;
- i2 = l1 <<= 16;
- if (y_b < 0) {
- x_c -= a_to_b * y_b;
- x_b -= b_to_c * y_b;
- z_b -= depth_increment * y_b;
- i2 -= grad_a_off * y_b;
- l1 -= grad_b_off * y_b;
- y_b = 0;
- }
- x_a <<= 16;
- k1 <<= 16;
- if (y_a < 0) {
- x_a -= c_to_a * y_a;
- k1 -= grad_c_off * y_a;
- y_a = 0;
- }
- int j9 = y_b - textureInt2;
- Oa += Va * j9;
- Ob += Vb * j9;
- Oc += Vc * j9;
- if (a_to_b < b_to_c) {
- y_c -= y_a;
- y_a -= y_b;
- y_b = anIntArray1472[y_b];
- while (--y_a >= 0) {
- method379(DrawingArea.pixels, texture, y_b, x_c >> 16, x_b >> 16,
- i2 >> 8, l1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope);
- x_c += a_to_b;
- x_b += b_to_c;
- i2 += grad_a_off;
- l1 += grad_b_off;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_c >= 0) {
- method379(DrawingArea.pixels, texture, y_b, x_a >> 16, x_b >> 16,
- k1 >> 8, l1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope);
- x_a += c_to_a;
- x_b += b_to_c;
- k1 += grad_c_off;
- l1 += grad_b_off;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- y_c -= y_a;
- y_a -= y_b;
- y_b = anIntArray1472[y_b];
- while (--y_a >= 0) {
- method379(DrawingArea.pixels, texture, y_b, x_b >> 16, x_c >> 16,
- l1 >> 8, i2 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope);
- x_c += a_to_b;
- x_b += b_to_c;
- i2 += grad_a_off;
- l1 += grad_b_off;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_c >= 0) {
- method379(DrawingArea.pixels, texture, y_b, x_b >> 16, x_a >> 16,
- l1 >> 8, k1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope);
- x_a += c_to_a;
- x_b += b_to_c;
- k1 += grad_c_off;
- l1 += grad_b_off;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- if (y_c >= DrawingArea.bottomY)
- return;
- if (y_a > DrawingArea.bottomY)
- y_a = DrawingArea.bottomY;
- if (y_b > DrawingArea.bottomY)
- y_b = DrawingArea.bottomY;
- z_c = z_c - depth_slope * x_c + depth_slope;
- if (y_a < y_b) {
- x_b = x_c <<= 16;
- l1 = i2 <<= 16;
- if (y_c < 0) {
- x_b -= b_to_c * y_c;
- x_c -= c_to_a * y_c;
- z_c -= depth_increment * y_c;
- l1 -= grad_b_off * y_c;
- i2 -= grad_c_off * y_c;
- y_c = 0;
- }
- x_a <<= 16;
- k1 <<= 16;
- if (y_a < 0) {
- x_a -= a_to_b * y_a;
- k1 -= grad_a_off * y_a;
- y_a = 0;
- }
- int k9 = y_c - textureInt2;
- Oa += Va * k9;
- Ob += Vb * k9;
- Oc += Vc * k9;
- if (b_to_c < c_to_a) {
- y_b -= y_a;
- y_a -= y_c;
- y_c = anIntArray1472[y_c];
- while (--y_a >= 0) {
- method379(DrawingArea.pixels, texture, y_c, x_b >> 16, x_c >> 16,
- l1 >> 8, i2 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_c, depth_slope);
- x_b += b_to_c;
- x_c += c_to_a;
- l1 += grad_b_off;
- i2 += grad_c_off;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_b >= 0) {
- method379(DrawingArea.pixels, texture, y_c, x_b >> 16, x_a >> 16,
- l1 >> 8, k1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_c, depth_slope);
- x_b += b_to_c;
- x_a += a_to_b;
- l1 += grad_b_off;
- k1 += grad_a_off;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- y_b -= y_a;
- y_a -= y_c;
- y_c = anIntArray1472[y_c];
- while (--y_a >= 0) {
- method379(DrawingArea.pixels, texture, y_c, x_c >> 16, x_b >> 16,
- i2 >> 8, l1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_c, depth_slope);
- x_b += b_to_c;
- x_c += c_to_a;
- l1 += grad_b_off;
- i2 += grad_c_off;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_b >= 0) {
- method379(DrawingArea.pixels, texture, y_c, x_a >> 16, x_b >> 16,
- k1 >> 8, l1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_c, depth_slope);
- x_b += b_to_c;
- x_a += a_to_b;
- l1 += grad_b_off;
- k1 += grad_a_off;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- x_a = x_c <<= 16;
- k1 = i2 <<= 16;
- if (y_c < 0) {
- x_a -= b_to_c * y_c;
- x_c -= c_to_a * y_c;
- z_c -= depth_increment * y_c;
- k1 -= grad_b_off * y_c;
- i2 -= grad_c_off * y_c;
- y_c = 0;
- }
- x_b <<= 16;
- l1 <<= 16;
- if (y_b < 0) {
- x_b -= a_to_b * y_b;
- l1 -= grad_a_off * y_b;
- y_b = 0;
- }
- int l9 = y_c - textureInt2;
- Oa += Va * l9;
- Ob += Vb * l9;
- Oc += Vc * l9;
- if (b_to_c < c_to_a) {
- y_a -= y_b;
- y_b -= y_c;
- y_c = anIntArray1472[y_c];
- while (--y_b >= 0) {
- method379(DrawingArea.pixels, texture, y_c, x_a >> 16, x_c >> 16,
- k1 >> 8, i2 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_c, depth_slope);
- x_a += b_to_c;
- x_c += c_to_a;
- k1 += grad_b_off;
- i2 += grad_c_off;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_a >= 0) {
- method379(DrawingArea.pixels, texture, y_c, x_b >> 16, x_c >> 16,
- l1 >> 8, i2 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_c, depth_slope);
- x_b += a_to_b;
- x_c += c_to_a;
- l1 += grad_a_off;
- i2 += grad_c_off;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- return;
- }
- y_a -= y_b;
- y_b -= y_c;
- y_c = anIntArray1472[y_c];
- while (--y_b >= 0) {
- method379(DrawingArea.pixels, texture, y_c, x_c >> 16, x_a >> 16, i2 >> 8,
- k1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_c, depth_slope);
- x_a += b_to_c;
- x_c += c_to_a;
- k1 += grad_b_off;
- i2 += grad_c_off;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- while (--y_a >= 0) {
- method379(DrawingArea.pixels, texture, y_c, x_c >> 16, x_b >> 16, i2 >> 8,
- l1 >> 8, Oa, Ob, Oc, Ha, Hb, Hc, z_c, depth_slope);
- x_b += a_to_b;
- x_c += c_to_a;
- l1 += grad_a_off;
- i2 += grad_c_off;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- Oa += Va;
- Ob += Vb;
- Oc += Vc;
- }
- }
- private static void method379(int dest[], int texture[], int dest_off, int start_x, int end_x,
- int shadeValue, int gradient, int l1, int i2, int j2, int k2, int l2, int i3, float depth, float depth_slope) {
- int rgb = 0;// was parameter
- int loops = 0;// was parameter
- if (start_x >= end_x)
- return;
- int j3;
- int k3;
- if (aBoolean1462) {
- j3 = (gradient - shadeValue) / (end_x - start_x);
- if (end_x > DrawingArea.centerX)
- end_x = DrawingArea.centerX;
- if (start_x < 0) {
- shadeValue -= start_x * j3;
- start_x = 0;
- }
- if (start_x >= end_x)
- return;
- k3 = end_x - start_x >> 3;
- j3 <<= 12;
- shadeValue <<= 9;
- } else {
- if (end_x - start_x > 7) {
- k3 = end_x - start_x >> 3;
- j3 = (gradient - shadeValue) * anIntArray1468[k3] >> 6;
- } else {
- k3 = 0;
- j3 = 0;
- }
- shadeValue <<= 9;
- }
- dest_off += start_x;
- depth += depth_slope * (float) start_x;
- if (lowMem) {
- int i4 = 0;
- int k4 = 0;
- int k6 = start_x - textureInt1;
- l1 += (k2 >> 3) * k6;
- i2 += (l2 >> 3) * k6;
- j2 += (i3 >> 3) * k6;
- int i5 = j2 >> 12;
- if (i5 != 0) {
- rgb = l1 / i5;
- loops = i2 / i5;
- if (rgb < 0)
- rgb = 0;
- else if (rgb > 4032)
- rgb = 4032;
- }
- l1 += k2;
- i2 += l2;
- j2 += i3;
- i5 = j2 >> 12;
- if (i5 != 0) {
- i4 = l1 / i5;
- k4 = i2 / i5;
- if (i4 < 7)
- i4 = 7;
- else if (i4 > 4032)
- i4 = 4032;
- }
- int i7 = i4 - rgb >> 3;
- int k7 = k4 - loops >> 3;
- rgb += (shadeValue & 0x600000) >> 3;
- int i8 = shadeValue >> 23;
- if (aBoolean1463) {
- while (k3-- > 0) {
- for (int i = 0; i < 8; i++) {
- dest[dest_off] = texture[(loops & 0xfc0) + (rgb >> 6)] >>> i8;
- DrawingArea.depthBuffer[dest_off] = depth;
- dest_off++;
- depth += depth_slope;
- rgb += i7;
- loops += k7;
- }
- rgb = i4;
- loops = k4;
- l1 += k2;
- i2 += l2;
- j2 += i3;
- int j5 = j2 >> 12;
- if (j5 != 0) {
- i4 = l1 / j5;
- k4 = i2 / j5;
- if (i4 < 7)
- i4 = 7;
- else if (i4 > 4032)
- i4 = 4032;
- }
- i7 = i4 - rgb >> 3;
- k7 = k4 - loops >> 3;
- shadeValue += j3;
- rgb += (shadeValue & 0x600000) >> 3;
- i8 = shadeValue >> 23;
- }
- for (k3 = end_x - start_x & 7; k3-- > 0;) {
- dest[dest_off] = texture[(loops & 0xfc0) + (rgb >> 6)] >>> i8;
- DrawingArea.depthBuffer[dest_off] = depth;
- dest_off++;
- depth += depth_slope;
- rgb += i7;
- loops += k7;
- }
- return;
- }
- while (k3-- > 0) {
- int k8;
- for (int i = 0; i < 8; i++) {
- if ((k8 = texture[(loops & 0xfc0) + (rgb >> 6)] >>> i8) != 0) {
- dest[dest_off] = k8;
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- dest_off++;
- depth += depth_slope;
- rgb += i7;
- loops += k7;
- }
- rgb = i4;
- loops = k4;
- l1 += k2;
- i2 += l2;
- j2 += i3;
- int k5 = j2 >> 12;
- if (k5 != 0) {
- i4 = l1 / k5;
- k4 = i2 / k5;
- if (i4 < 7)
- i4 = 7;
- else if (i4 > 4032)
- i4 = 4032;
- }
- i7 = i4 - rgb >> 3;
- k7 = k4 - loops >> 3;
- shadeValue += j3;
- rgb += (shadeValue & 0x600000) >> 3;
- i8 = shadeValue >> 23;
- }
- for (k3 = end_x - start_x & 7; k3-- > 0;) {
- int l8;
- if ((l8 = texture[(loops & 0xfc0) + (rgb >> 6)] >>> i8) != 0) {
- dest[dest_off] = l8;
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- dest_off++;
- depth += depth_slope;
- rgb += i7;
- loops += k7;
- }
- return;
- }
- int j4 = 0;
- int l4 = 0;
- int l6 = start_x - textureInt1;
- l1 += (k2 >> 3) * l6;
- i2 += (l2 >> 3) * l6;
- j2 += (i3 >> 3) * l6;
- int l5 = j2 >> 14;
- if (l5 != 0) {
- rgb = l1 / l5;
- loops = i2 / l5;
- if (rgb < 0)
- rgb = 0;
- else if (rgb > 16256)
- rgb = 16256;
- }
- l1 += k2;
- i2 += l2;
- j2 += i3;
- l5 = j2 >> 14;
- if (l5 != 0) {
- j4 = l1 / l5;
- l4 = i2 / l5;
- if (j4 < 7)
- j4 = 7;
- else if (j4 > 16256)
- j4 = 16256;
- }
- int j7 = j4 - rgb >> 3;
- int l7 = l4 - loops >> 3;
- rgb += shadeValue & 0x600000;
- int j8 = shadeValue >> 23;
- if (aBoolean1463) {
- while (k3-- > 0) {
- for (int i = 0; i < 8; i++) {
- dest[dest_off] = texture[(loops & 0x3f80) + (rgb >> 7)] >>> j8;
- DrawingArea.depthBuffer[dest_off] = depth;
- depth += depth_slope;
- dest_off++;
- rgb += j7;
- loops += l7;
- }
- rgb = j4;
- loops = l4;
- l1 += k2;
- i2 += l2;
- j2 += i3;
- int i6 = j2 >> 14;
- if (i6 != 0) {
- j4 = l1 / i6;
- l4 = i2 / i6;
- if (j4 < 7)
- j4 = 7;
- else if (j4 > 16256)
- j4 = 16256;
- }
- j7 = j4 - rgb >> 3;
- l7 = l4 - loops >> 3;
- shadeValue += j3;
- rgb += shadeValue & 0x600000;
- j8 = shadeValue >> 23;
- }
- for (k3 = end_x - start_x & 7; k3-- > 0;) {
- dest[dest_off] = texture[(loops & 0x3f80) + (rgb >> 7)] >>> j8;
- DrawingArea.depthBuffer[dest_off] = depth;
- dest_off++;
- depth += depth_slope;
- rgb += j7;
- loops += l7;
- }
- return;
- }
- while (k3-- > 0) {
- int i9;
- for (int i = 0; i < 8; i++) {
- if ((i9 = texture[(loops & 0x3f80) + (rgb >> 7)] >>> j8) != 0) {
- dest[dest_off] = i9;
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- dest_off++;
- depth += depth_slope;
- rgb += j7;
- loops += l7;
- }
- rgb = j4;
- loops = l4;
- l1 += k2;
- i2 += l2;
- j2 += i3;
- int j6 = j2 >> 14;
- if (j6 != 0) {
- j4 = l1 / j6;
- l4 = i2 / j6;
- if (j4 < 7)
- j4 = 7;
- else if (j4 > 16256)
- j4 = 16256;
- }
- j7 = j4 - rgb >> 3;
- l7 = l4 - loops >> 3;
- shadeValue += j3;
- rgb += shadeValue & 0x600000;
- j8 = shadeValue >> 23;
- }
- for (int l3 = end_x - start_x & 7; l3-- > 0;) {
- int j9;
- if ((j9 = texture[(loops & 0x3f80) + (rgb >> 7)] >>> j8) != 0) {
- dest[dest_off] = j9;
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- dest_off++;
- rgb += j7;
- loops += l7;
- }
- }
- public static void drawDepthTriangle(int x_a, int x_b, int x_c, int y_a, int y_b, int y_c, float z_a, float z_b, float z_c) {
- int a_to_b = 0;
- if (y_b != y_a) {
- a_to_b = (x_b - x_a << 16) / (y_b - y_a);
- }
- int b_to_c = 0;
- if (y_c != y_b) {
- b_to_c = (x_c - x_b << 16) / (y_c - y_b);
- }
- int c_to_a = 0;
- if (y_c != y_a) {
- c_to_a = (x_a - x_c << 16) / (y_a - y_c);
- }
- float b_aX = x_b - x_a;
- float b_aY = y_b - y_a;
- float c_aX = x_c - x_a;
- float c_aY = y_c - y_a;
- float b_aZ = z_b - z_a;
- float c_aZ = z_c - z_a;
- float div = b_aX * c_aY - c_aX * b_aY;
- float depth_slope = (b_aZ * c_aY - c_aZ * b_aY) / div;
- float depth_increment = (c_aZ * b_aX - b_aZ * c_aX) / div;
- if (y_a <= y_b && y_a <= y_c) {
- if (y_a < DrawingArea.bottomY) {
- if (y_b > DrawingArea.bottomY)
- y_b = DrawingArea.bottomY;
- if (y_c > DrawingArea.bottomY)
- y_c = DrawingArea.bottomY;
- z_a = z_a - depth_slope * x_a + depth_slope;
- if (y_b < y_c) {
- x_c = x_a <<= 16;
- if (y_a < 0) {
- x_c -= c_to_a * y_a;
- x_a -= a_to_b * y_a;
- z_a -= depth_increment * y_a;
- y_a = 0;
- }
- x_b <<= 16;
- if (y_b < 0) {
- x_b -= b_to_c * y_b;
- y_b = 0;
- }
- if (y_a != y_b && c_to_a < a_to_b || y_a == y_b && c_to_a > b_to_c) {
- y_c -= y_b;
- y_b -= y_a;
- y_a = anIntArray1472[y_a];
- while (--y_b >= 0) {
- drawDepthTriangleScanline(y_a, x_c >> 16, x_a >> 16, z_a, depth_slope);
- x_c += c_to_a;
- x_a += a_to_b;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- }
- while (--y_c >= 0) {
- drawDepthTriangleScanline(y_a, x_c >> 16, x_b >> 16, z_a, depth_slope);
- x_c += c_to_a;
- x_b += b_to_c;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- }
- } else {
- y_c -= y_b;
- y_b -= y_a;
- y_a = anIntArray1472[y_a];
- while (--y_b >= 0) {
- drawDepthTriangleScanline(y_a, x_a >> 16, x_c >> 16, z_a, depth_slope);
- x_c += c_to_a;
- x_a += a_to_b;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- }
- while (--y_c >= 0) {
- drawDepthTriangleScanline(y_a, x_b >> 16, x_c >> 16, z_a, depth_slope);
- x_c += c_to_a;
- x_b += b_to_c;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- }
- }
- } else {
- x_b = x_a <<= 16;
- if (y_a < 0) {
- x_b -= c_to_a * y_a;
- x_a -= a_to_b * y_a;
- z_a -= depth_increment * y_a;
- y_a = 0;
- }
- x_c <<= 16;
- if (y_c < 0) {
- x_c -= b_to_c * y_c;
- y_c = 0;
- }
- if (y_a != y_c && c_to_a < a_to_b || y_a == y_c && b_to_c > a_to_b) {
- y_b -= y_c;
- y_c -= y_a;
- y_a = anIntArray1472[y_a];
- while (--y_c >= 0) {
- drawDepthTriangleScanline(y_a, x_b >> 16, x_a >> 16, z_a, depth_slope);
- x_b += c_to_a;
- x_a += a_to_b;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- }
- while (--y_b >= 0) {
- drawDepthTriangleScanline(y_a, x_c >> 16, x_a >> 16, z_a, depth_slope);
- x_c += b_to_c;
- x_a += a_to_b;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- }
- } else {
- y_b -= y_c;
- y_c -= y_a;
- y_a = anIntArray1472[y_a];
- while (--y_c >= 0) {
- drawDepthTriangleScanline(y_a, x_a >> 16, x_b >> 16, z_a, depth_slope);
- x_b += c_to_a;
- x_a += a_to_b;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- }
- while (--y_b >= 0) {
- drawDepthTriangleScanline(y_a, x_a >> 16, x_c >> 16, z_a, depth_slope);
- x_c += b_to_c;
- x_a += a_to_b;
- z_a += depth_increment;
- y_a += DrawingArea.width;
- }
- }
- }
- }
- } else if (y_b <= y_c) {
- if (y_b < DrawingArea.bottomY) {
- if (y_c > DrawingArea.bottomY)
- y_c = DrawingArea.bottomY;
- if (y_a > DrawingArea.bottomY)
- y_a = DrawingArea.bottomY;
- z_b = z_b - depth_slope * x_b + depth_slope;
- if (y_c < y_a) {
- x_a = x_b <<= 16;
- if (y_b < 0) {
- x_a -= a_to_b * y_b;
- x_b -= b_to_c * y_b;
- z_b -= depth_increment * y_b;
- y_b = 0;
- }
- x_c <<= 16;
- if (y_c < 0) {
- x_c -= c_to_a * y_c;
- y_c = 0;
- }
- if (y_b != y_c && a_to_b < b_to_c || y_b == y_c && a_to_b > c_to_a) {
- y_a -= y_c;
- y_c -= y_b;
- y_b = anIntArray1472[y_b];
- while (--y_c >= 0) {
- drawDepthTriangleScanline(y_b, x_a >> 16, x_b >> 16, z_b, depth_slope);
- x_a += a_to_b;
- x_b += b_to_c;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- }
- while (--y_a >= 0) {
- drawDepthTriangleScanline(y_b, x_a >> 16, x_c >> 16, z_b, depth_slope);
- x_a += a_to_b;
- x_c += c_to_a;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- }
- } else {
- y_a -= y_c;
- y_c -= y_b;
- y_b = anIntArray1472[y_b];
- while (--y_c >= 0) {
- drawDepthTriangleScanline(y_b, x_b >> 16, x_a >> 16, z_b, depth_slope);
- x_a += a_to_b;
- x_b += b_to_c;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- }
- while (--y_a >= 0) {
- drawDepthTriangleScanline(y_b, x_c >> 16, x_a >> 16, z_b, depth_slope);
- x_a += a_to_b;
- x_c += c_to_a;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- }
- }
- } else {
- x_c = x_b <<= 16;
- if (y_b < 0) {
- x_c -= a_to_b * y_b;
- x_b -= b_to_c * y_b;
- z_b -= depth_increment * y_b;
- y_b = 0;
- }
- x_a <<= 16;
- if (y_a < 0) {
- x_a -= c_to_a * y_a;
- y_a = 0;
- }
- if (a_to_b < b_to_c) {
- y_c -= y_a;
- y_a -= y_b;
- y_b = anIntArray1472[y_b];
- while (--y_a >= 0) {
- drawDepthTriangleScanline(y_b, x_c >> 16, x_b >> 16, z_b, depth_slope);
- x_c += a_to_b;
- x_b += b_to_c;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- }
- while (--y_c >= 0) {
- drawDepthTriangleScanline(y_b, x_a >> 16, x_b >> 16, z_b, depth_slope);
- x_a += c_to_a;
- x_b += b_to_c;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- }
- } else {
- y_c -= y_a;
- y_a -= y_b;
- y_b = anIntArray1472[y_b];
- while (--y_a >= 0) {
- drawDepthTriangleScanline(y_b, x_b >> 16, x_c >> 16, z_b, depth_slope);
- x_c += a_to_b;
- x_b += b_to_c;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- }
- while (--y_c >= 0) {
- drawDepthTriangleScanline(y_b, x_b >> 16, x_a >> 16, z_b, depth_slope);
- x_a += c_to_a;
- x_b += b_to_c;
- z_b += depth_increment;
- y_b += DrawingArea.width;
- }
- }
- }
- }
- } else if (y_c < DrawingArea.bottomY) {
- if (y_a > DrawingArea.bottomY)
- y_a = DrawingArea.bottomY;
- if (y_b > DrawingArea.bottomY)
- y_b = DrawingArea.bottomY;
- z_c = z_c - depth_slope * x_c + depth_slope;
- if (y_a < y_b) {
- x_b = x_c <<= 16;
- if (y_c < 0) {
- x_b -= b_to_c * y_c;
- x_c -= c_to_a * y_c;
- z_c -= depth_increment * y_c;
- y_c = 0;
- }
- x_a <<= 16;
- if (y_a < 0) {
- x_a -= a_to_b * y_a;
- y_a = 0;
- }
- if (b_to_c < c_to_a) {
- y_b -= y_a;
- y_a -= y_c;
- y_c = anIntArray1472[y_c];
- while (--y_a >= 0) {
- drawDepthTriangleScanline(y_c, x_b >> 16, x_c >> 16, z_c, depth_slope);
- x_b += b_to_c;
- x_c += c_to_a;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- while (--y_b >= 0) {
- drawDepthTriangleScanline(y_c, x_b >> 16, x_a >> 16, z_c, depth_slope);
- x_b += b_to_c;
- x_a += a_to_b;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- } else {
- y_b -= y_a;
- y_a -= y_c;
- y_c = anIntArray1472[y_c];
- while (--y_a >= 0) {
- drawDepthTriangleScanline(y_c, x_c >> 16, x_b >> 16, z_c, depth_slope);
- x_b += b_to_c;
- x_c += c_to_a;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- while (--y_b >= 0) {
- drawDepthTriangleScanline(y_c, x_a >> 16, x_b >> 16, z_c, depth_slope);
- x_b += b_to_c;
- x_a += a_to_b;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- }
- } else {
- x_a = x_c <<= 16;
- if (y_c < 0) {
- x_a -= b_to_c * y_c;
- x_c -= c_to_a * y_c;
- z_c -= depth_increment * y_c;
- y_c = 0;
- }
- x_b <<= 16;
- if (y_b < 0) {
- x_b -= a_to_b * y_b;
- y_b = 0;
- }
- if (b_to_c < c_to_a) {
- y_a -= y_b;
- y_b -= y_c;
- y_c = anIntArray1472[y_c];
- while (--y_b >= 0) {
- drawDepthTriangleScanline(y_c, x_a >> 16, x_c >> 16, z_c, depth_slope);
- x_a += b_to_c;
- x_c += c_to_a;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- while (--y_a >= 0) {
- drawDepthTriangleScanline(y_c, x_b >> 16, x_c >> 16, z_c, depth_slope);
- x_b += a_to_b;
- x_c += c_to_a;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- } else {
- y_a -= y_b;
- y_b -= y_c;
- y_c = anIntArray1472[y_c];
- while (--y_b >= 0) {
- drawDepthTriangleScanline(y_c, x_c >> 16, x_a >> 16, z_c, depth_slope);
- x_a += b_to_c;
- x_c += c_to_a;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- while (--y_a >= 0) {
- drawDepthTriangleScanline(y_c, x_c >> 16, x_b >> 16, z_c, depth_slope);
- x_b += a_to_b;
- x_c += c_to_a;
- z_c += depth_increment;
- y_c += DrawingArea.width;
- }
- }
- }
- }
- }
- private static void drawDepthTriangleScanline(int dest_off, int start_x, int end_x, float depth, float depth_slope) {
- int dbl = DrawingArea.depthBuffer.length;
- if (aBoolean1462) {
- if (end_x > DrawingArea.width) {
- end_x = DrawingArea.width;
- }
- if (start_x < 0) {
- start_x = 0;
- }
- }
- if (start_x >= end_x) {
- return;
- }
- dest_off += start_x - 1;
- int loops = end_x - start_x >> 2;
- depth += depth_slope * (float) start_x;
- if (anInt1465 == 0) {
- while (--loops >= 0) {
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- }
- for (loops = end_x - start_x & 3; --loops >= 0;) {
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- }
- return;
- }
- while (--loops >= 0) {
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- }
- for (loops = end_x - start_x & 3; --loops >= 0;) {
- dest_off++;
- if (dest_off >= 0 && dest_off < dbl && true) {
- DrawingArea.depthBuffer[dest_off] = depth;
- }
- depth += depth_slope;
- }
- }
- public static final int anInt1459 = -477;
- public static boolean lowMem = true;
- static boolean aBoolean1462;
- private static boolean aBoolean1463;
- public static boolean aBoolean1464 = true;
- public static int anInt1465;
- public static int textureInt1;
- public static int textureInt2;
- private static int[] anIntArray1468;
- public static final int[] anIntArray1469;
- public static int anIntArray1470[];
- public static int anIntArray1471[];
- public static int anIntArray1472[];
- private static int anInt1473;
- public static Background aBackgroundArray1474s[] = new Background[52];
- private static boolean[] aBooleanArray1475 = new boolean[52];
- private static int[] anIntArray1476 = new int[52];
- private static int anInt1477;
- private static int[][] anIntArrayArray1478;
- private static int[][] anIntArrayArray1479 = new int[52][];
- public static int anIntArray1480[] = new int[52];
- public static int anInt1481;
- public static int anIntArray1482[] = new int[0x10000];
- private static int[][] anIntArrayArray1483 = new int[52][];
- static {
- anIntArray1468 = new int[512];
- anIntArray1469 = new int[2048];
- anIntArray1470 = new int[2048];
- anIntArray1471 = new int[2048];
- for (int i = 1; i < 512; i++)
- anIntArray1468[i] = 32768 / i;
- for (int j = 1; j < 2048; j++)
- anIntArray1469[j] = 0x10000 / j;
- for (int k = 0; k < 2048; k++) {
- anIntArray1470[k] = (int) (65536D * Math
- .sin(k * 0.0030679614999999999D));
- anIntArray1471[k] = (int) (65536D * Math
- .cos(k * 0.0030679614999999999D));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement