I started cleaning and refactoring the client I'm working on and for some reasons the floor went black. I'm receiving an error from method171 in ObjectManager but after comparing the code with the original, there's no change whatsoever.
Anybody has a hint on what I'm doing wrong? Thanks.
The line causing the error in Client class.
Code:
mapRegion.method171(clippingPlanes, sceneGraph);
Here is method171.
Quote:
Code:
public final void method171(CollisionMap aclass11[], SceneGraph sceneGraph) {
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 104; k++) {
for (int i1 = 0; i1 < 104; i1++)
if ((tileSettings[j][k][i1] & 1) == 1) {
int k1 = j;
if ((tileSettings[1][k][i1] & 2) == 2)
k1--;
if (k1 >= 0)
aclass11[k1].appendSolidFlag(i1, k);
}
}
}
anIntArray124Offset += (int) (Math.random() * 5D) - 2;
if (anIntArray124Offset < -8)
anIntArray124Offset = -8;
if (anIntArray124Offset > 8)
anIntArray124Offset = 8;
offsetLightning += (int) (Math.random() * 5D) - 2;
if (offsetLightning < -16)
offsetLightning = -16;
if (offsetLightning > 16)
offsetLightning = 16;
for (int plane = 0; plane < 4; plane++) {
byte abyte0[][] = aByteArrayArrayArray134[plane];
byte byte0 = 96;
char c = '\u0300';
byte byte1 = -50;
byte byte2 = -10;
byte byte3 = -50;
int j3 = (int) Math.sqrt(byte1 * byte1 + byte2 * byte2 + byte3
* byte3);
int l3 = c * j3 >> 8;
for (int j4 = 1; j4 < anInt147 - 1; j4++) {
for (int j5 = 1; j5 < anInt146 - 1; j5++) {
int k6 = heightMap[plane][j5 + 1][j4]
- heightMap[plane][j5 - 1][j4];
int l7 = heightMap[plane][j5][j4 + 1]
- heightMap[plane][j5][j4 - 1];
int j9 = (int) Math.sqrt(k6 * k6 + 0x10000 + l7 * l7);
int k12 = (k6 << 8) / j9;
int l13 = 0x10000 / j9;
int j15 = (l7 << 8) / j9;
int j16 = byte0 + (byte1 * k12 + byte2 * l13 + byte3 * j15)
/ l3;
int j17 = (abyte0[j5 - 1][j4] >> 2)
+ (abyte0[j5 + 1][j4] >> 3)
+ (abyte0[j5][j4 - 1] >> 2)
+ (abyte0[j5][j4 + 1] >> 3) + (abyte0[j5][j4] >> 1);
tileShadowArray[j5][j4] = j16 - j17;
}
}
for (int k5 = 0; k5 < anInt147; k5++) {
anIntArray124[k5] = 0;
anIntArray125[k5] = 0;
anIntArray126[k5] = 0;
anIntArray127[k5] = 0;
anIntArray128[k5] = 0;
}
for (int x = -5; x < anInt146 + 5; x++) {
for (int tileY = 0; tileY < anInt147; tileY++) {
int tileX_ = x + 5;
if (tileX_ >= 0 && tileX_ < anInt146) {
int l12 = underLay[plane][tileX_][tileY] & 0xff;
if (l12 > 0) {
if(l12 >= FloorDefinition.cache.length)
l12 = FloorDefinition.cache.length;
FloorDefinition floorDefinition = FloorDefinition.cache[l12 - 1];
anIntArray124[tileY] += floorDefinition.hue2;
anIntArray125[tileY] += floorDefinition.saturation;
anIntArray126[tileY] += floorDefinition.lightness;
anIntArray127[tileY] += floorDefinition.hue_weight;
anIntArray128[tileY]++;
}
}
int tileX = x - 5;
if (tileX >= 0 && tileX < anInt146) {
int i14 = underLay[plane][tileX][tileY] & 0xff;
if (i14 > 0) {
if(i14 >= FloorDefinition.cache.length)
i14 = FloorDefinition.cache.length;
FloorDefinition flo_1 = FloorDefinition.cache[i14 - 1];
anIntArray124[tileY] -= flo_1.hue2;
anIntArray125[tileY] -= flo_1.saturation;
anIntArray126[tileY] -= flo_1.lightness;
anIntArray127[tileY] -= flo_1.hue_weight;
anIntArray128[tileY]--;
}
}
}
if (x >= 1 && x < anInt146 - 1) {
int blended_anIntArray124 = 0;
int blended_anIntArray125 = 0;
int blended_anIntArray126 = 0;
int blended_anIntArray124_divisor = 0;
int blend_direction_tracker = 0;
for (int y = -5; y < anInt147 + 5; y++) {
int j18 = y + 5;
if (j18 >= 0 && j18 < anInt147) {
blended_anIntArray124 += anIntArray124[j18];
blended_anIntArray125 += anIntArray125[j18];
blended_anIntArray126 += anIntArray126[j18];
blended_anIntArray124_divisor += anIntArray127[j18];
blend_direction_tracker += anIntArray128[j18];
}
int k18 = y - 5;
if (k18 >= 0 && k18 < anInt147) {
blended_anIntArray124 -= anIntArray124[k18];
blended_anIntArray125 -= anIntArray125[k18];
blended_anIntArray126 -= anIntArray126[k18];
blended_anIntArray124_divisor -= anIntArray127[k18];
blend_direction_tracker -= anIntArray128[k18];
}
if (y >= 1 && y < anInt147 - 1 && (!lowMem
|| (tileSettings[0][x][y] & 2) != 0 || (tileSettings[plane][x][y] & 0x10) == 0
&& method182(y, plane, x) == anInt131)) {
if (plane < highestPlane)
highestPlane = plane;
int underlay_floor_id = underLay[plane][x][y] & 0xff;
int overlay_floor_id = overLay[plane][x][y] & 0xff;
if (underlay_floor_id > 0 || overlay_floor_id > 0) {
int tileZA = heightMap[plane][x][y];
int tileZB = heightMap[plane][x + 1][y];
int tileZD = heightMap[plane][x + 1][y + 1];
int tileZC = heightMap[plane][x][y + 1];
int tileShadowA = tileShadowArray[x][y];
int tileShadowB = tileShadowArray[x + 1][y];
int tileShadowD = tileShadowArray[x + 1][y + 1];
int tileShadowC = tileShadowArray[x][y + 1];
int hsl_bitset_unmodified = -1;
int hsl_bitset_randomized = -1;
/*if (underlay_floor_id > 0) {
int anIntArray124 = (blended_anIntArray124 * 256) / blended_anIntArray124_divisor;
int sat = blended_anIntArray125 / blend_direction_tracker;
int lum = blended_anIntArray126 / blend_direction_tracker;
hsl_bitset_unmodified = method177(anIntArray124, sat, lum);
anIntArray124 = anIntArray124 + anIntArray124Offset & 0xff;
lum += offsetLightning;
if (lum < 0)
lum = 0;
else if (lum > 255)
lum = 255;
hsl_bitset_randomized = method177(anIntArray124, sat, lum);
}*/
if(underlay_floor_id > 0 || overlay_floor_id != 0)
{
int anIntArray124 = -1;
int sat = 0;
int lum = 0;
if(underlay_floor_id == 0)
{
anIntArray124 = -1;
sat = 0;
lum = 0;
} else
if (underlay_floor_id > 0)
{
if(blended_anIntArray124_divisor < 1)
blended_anIntArray124_divisor = 1;
anIntArray124 = (blended_anIntArray124 << 8) / blended_anIntArray124_divisor;
sat = blended_anIntArray125 / blend_direction_tracker;
lum = blended_anIntArray126 / blend_direction_tracker;
hsl_bitset_unmodified = method177(anIntArray124, sat, lum);
anIntArray124 = anIntArray124 + anIntArray124Offset & 0xff;
lum += offsetLightning;
if (lum < 0)
lum = 0;
else if (lum > 255)
lum = 255;
} else
{
anIntArray124 = underlay_floor_id;
sat = 0;
lum = 0;
}
if(anIntArray124 != -1 && hsl_bitset_randomized == -1)
hsl_bitset_randomized = method177(anIntArray124, sat, lum);
if(hsl_bitset_unmodified == -1)
hsl_bitset_unmodified = hsl_bitset_randomized;
}
if (plane > 0) {
boolean flag = true;
if (underlay_floor_id == 0
&& overlayClippingPaths[plane][x][y] != 0)
flag = false;
if(overlay_floor_id >= OverLayFlo317.overLayFlo317s.length)
overlay_floor_id = OverLayFlo317.overLayFlo317s.length-1;
if (overlay_floor_id > 0
&& !OverLayFlo317.overLayFlo317s[overlay_floor_id - 1].aBoolean393)
flag = false;
if (flag && tileZA == tileZB && tileZA == tileZD
&& tileZA == tileZC)
anIntArrayArrayArray135[plane][x][y] |= 0x924;
}
int rgb_bitset_randomized = 0;
if (hsl_bitset_unmodified != -1)
rgb_bitset_randomized = Rasterizer.hsl2rgb[getShadow(hsl_bitset_randomized,
96)];
if (overlay_floor_id == 0) {
/**
* Draws shaped tile
*/
if(Client.getOption("hd_tex")) {
if(underlay_floor_id-1 >= FloorDefinition.cache.length)
underlay_floor_id = FloorDefinition.cache.length-1;
FloorDefinition floorDefinition = FloorDefinition.cache[underlay_floor_id - 1];
int underlay_texture_id = floorDefinition.texture;
if (underlay_texture_id != -1)
underlay_texture_id = 154; //632, 154
underlay_floor_texture = underlay_texture_id;
underlay_floor_map_color = getOverlayShadow(hsl_bitset_unmodified, 96);
int tile_opcode = overlayClippingPaths[plane][x][y] + 1;
if (tile_opcode == 1) {
tile_opcode = 434;
}
byte tile_orientation = overlayClippingPathRotations[plane][x][y];
/**
* Adds underlay tile
*/
int overlay_hsl = method177(floorDefinition.hue, floorDefinition.saturation, floorDefinition.lightness);
sceneGraph.addTile(plane, x, y,
tile_opcode, tile_orientation, underlay_texture_id, tileZA, tileZB, tileZD, tileZC,
getShadow(hsl_bitset_unmodified, tileShadowA),
getShadow(hsl_bitset_unmodified, tileShadowB),
getShadow(hsl_bitset_unmodified, tileShadowD),
getShadow(hsl_bitset_unmodified, tileShadowC),
getOverlayShadow(overlay_hsl, tileShadowA),
getOverlayShadow(overlay_hsl, tileShadowB),
getOverlayShadow(overlay_hsl, tileShadowD),
getOverlayShadow(overlay_hsl, tileShadowC),
rgb_bitset_randomized, rgb_bitset_randomized, underlay_floor_map_color,
underlay_floor_texture, underlay_floor_map_color, false);
} else {
sceneGraph.addTile(plane, x, y, 0, 0, -1, tileZA, tileZB, tileZD, tileZC,
getShadow(hsl_bitset_unmodified, tileShadowA),
getShadow(hsl_bitset_unmodified, tileShadowB),
getShadow(hsl_bitset_unmodified, tileShadowD),
getShadow(hsl_bitset_unmodified, tileShadowC),
0,
0,
0,
0,
rgb_bitset_randomized, rgb_bitset_randomized, -1, 0, 0, true);
}
} else {
int overlay_map_color = 0;
int overlay_floor_texture_color = -1;
int tile_opcode = overlayClippingPaths[plane][x][y] + 1;
byte tile_orientation = overlayClippingPathRotations[plane][x][y];
if(overlay_floor_id-1 >= OverLayFlo317.overLayFlo317s.length)
overlay_floor_id = OverLayFlo317.overLayFlo317s.length - 1;
OverLayFlo317 over = OverLayFlo317.overLayFlo317s[overlay_floor_id - 1];
int overlay_texture_id = over.groundTextureOverlay;
int overlay_hsl;
int overlay_rgb = 0;
if (overlay_texture_id > 50 && !Client.getOption("hd_tex")) {
overlay_texture_id = -1;
}
if (overlay_texture_id >= 0) {
if(overlay_texture_id < 51 || !Client.getOption("hd_tex"))
overlay_rgb = TextureLoader317.getAverageTextureColour(overlay_texture_id);
overlay_hsl = -1;
} else if (over.groundColorOverlay == 0xff00ff) {
overlay_rgb = 0;
overlay_hsl = -2;
overlay_texture_id = -1;
} else if(over.groundColorOverlay == 0x333333) {
overlay_rgb = Rasterizer.hsl2rgb[getOverlayShadow(over.hslOverlayColor, 96)];
overlay_hsl = -2;
overlay_texture_id = -1;
} else {
overlay_hsl = method177(over.groundHueOverlay, over.groundSaturationOverlay, over.groundLightnessOverlay);
overlay_rgb = Rasterizer.hsl2rgb[getOverlayShadow(over.hslOverlayColor, 96)];
}
if ((overlay_floor_id-1) == 54) {
overlay_rgb = over.groundColorOverlay = 0x8B8B83;
overlay_hsl = -2;
}
if((overlay_floor_id-1) == 111){
overlay_rgb = TextureLoader317.getAverageTextureColour(1);
overlay_hsl = -1;//method177(150,100,100);
overlay_texture_id = 1;
} else if (overlay_hsl == 6363) { //river bank (brown shit) 508
overlay_rgb = 0x483B21;
overlay_hsl = method177(25,146,24);
} else if((overlay_floor_id-1) == 54){
overlay_rgb = over.groundColorOverlay;
overlay_hsl = -2;
overlay_texture_id = -1;
}
if(Client.getOption("hd_tex")) {
if(over.detailedColor != -1)
{
overlay_map_color = (Rasterizer.hsl2rgb[over.detailedColor] != 1) ? Rasterizer.hsl2rgb[over.detailedColor] : 0;
}
if ((!Client.getOption("hd_tex") ? (overlay_texture_id >= 0 && overlay_texture_id < 51) : (overlay_texture_id >= 0)))
{
overlay_hsl = -1;
if (over.groundColorOverlay != 0xff00ff)
{
overlay_hsl = over.groundColorOverlay;
if(overlay_texture_id > 50)
overlay_rgb = (overlay_hsl != -1 ? Rasterizer.hsl2rgb[overlay_hsl] : 0);
overlay_floor_texture_color = getOverlayShadow(over.groundColorOverlay, 96);
} else
{
if(overlay_texture_id > 50)
overlay_rgb = over.detailedColor;
overlay_hsl = -2;
underlay_floor_map_color = -1;
overlay_floor_texture_color = -1;
}
} else if (over.groundColorOverlay == -1)
{
if(overlay_texture_id > 50)
overlay_rgb = overlay_map_color;
overlay_hsl = -2;
//?
if(plane > 0)
underlay_floor_texture = -1;
overlay_texture_id = -1;
} else
{
overlay_floor_texture_color = getOverlayShadow(over.groundColorOverlay, 96);
overlay_hsl = over.groundColorOverlay;
if(overlay_texture_id > 50)
overlay_rgb = Rasterizer.hsl2rgb[overlay_floor_texture_color];
}
}
if(Client.getOption("hd_tex")) {
sceneGraph.addTile(plane, x, y,
tile_opcode, tile_orientation, overlay_texture_id, tileZA, tileZB, tileZD, tileZC,
getShadow(hsl_bitset_unmodified, tileShadowA), getShadow(hsl_bitset_unmodified, tileShadowB),
getShadow(hsl_bitset_unmodified, tileShadowD),getShadow(hsl_bitset_unmodified, tileShadowC),
getOverlayShadow(overlay_hsl, tileShadowA), getOverlayShadow(overlay_hsl, tileShadowB),
getOverlayShadow(overlay_hsl, tileShadowD), getOverlayShadow(overlay_hsl, tileShadowC),
rgb_bitset_randomized, overlay_rgb, overlay_floor_texture_color,
underlay_floor_texture, underlay_floor_map_color, false);
} else {
sceneGraph.addTile(plane, x, y, tile_opcode,
tile_orientation, overlay_texture_id, tileZA, tileZB, tileZD, tileZC,
getShadow(hsl_bitset_unmodified, tileShadowA), getShadow(hsl_bitset_unmodified,
tileShadowB), getShadow(hsl_bitset_unmodified, tileShadowD),
getShadow(hsl_bitset_unmodified, tileShadowC), getOverlayShadow(overlay_hsl,
tileShadowA), getOverlayShadow(overlay_hsl, tileShadowB),
getOverlayShadow(overlay_hsl, tileShadowD), getOverlayShadow(overlay_hsl,
tileShadowC), rgb_bitset_randomized, overlay_rgb, -1, 0 ,0, true);
}
}
}
}
}
}
}
for (int j8 = 1; j8 < anInt147 - 1; j8++) {
for (int i10 = 1; i10 < anInt146 - 1; i10++)
sceneGraph.setVisiblePlanesFor(plane, i10, j8, method182(j8, plane, i10));
}
}
sceneGraph.shadeModels(-10, -50, -50);
for (int j1 = 0; j1 < anInt146; j1++) {
for (int l1 = 0; l1 < anInt147; l1++)
if ((tileSettings[1][j1][l1] & 2) == 2)
sceneGraph.applyBridgeMode(l1, j1);
}
int i2 = 1;
int j2 = 2;
int k2 = 4;
for (int l2 = 0; l2 < 4; l2++) {
if (l2 > 0) {
i2 <<= 3;
j2 <<= 3;
k2 <<= 3;
}
for (int i3 = 0; i3 <= l2; i3++) {
for (int k3 = 0; k3 <= anInt147; k3++) {
for (int i4 = 0; i4 <= anInt146; i4++) {
if ((anIntArrayArrayArray135[i3][i4][k3] & i2) != 0) {
int k4 = k3;
int l5 = k3;
int i7 = i3;
int k8 = i3;
for (; k4 > 0
&& (anIntArrayArrayArray135[i3][i4][k4 - 1] & i2) != 0; k4--)
;
for (; l5 < anInt147
&& (anIntArrayArrayArray135[i3][i4][l5 + 1] & i2) != 0; l5++)
;
label0: for (; i7 > 0; i7--) {
for (int j10 = k4; j10 <= l5; j10++)
if ((anIntArrayArrayArray135[i7 - 1][i4][j10] & i2) == 0)
break label0;
}
label1: for (; k8 < l2; k8++) {
for (int k10 = k4; k10 <= l5; k10++)
if ((anIntArrayArrayArray135[k8 + 1][i4][k10] & i2) == 0)
break label1;
}
int l10 = ((k8 + 1) - i7) * ((l5 - k4) + 1);
if (l10 >= 8) {
char c1 = '\360';
int k14 = heightMap[k8][i4][k4]
- c1;
int l15 = heightMap[i7][i4][k4];
SceneGraph.createCullingCluster(l2, i4 * 128, l15,
i4 * 128, l5 * 128 + 128, k14,
k4 * 128, 1);
for (int l16 = i7; l16 <= k8; l16++) {
for (int l17 = k4; l17 <= l5; l17++)
anIntArrayArrayArray135[l16][i4][l17] &= ~i2;
}
}
}
if ((anIntArrayArrayArray135[i3][i4][k3] & j2) != 0) {
int l4 = i4;
int i6 = i4;
int j7 = i3;
int l8 = i3;
for (; l4 > 0
&& (anIntArrayArrayArray135[i3][l4 - 1][k3] & j2) != 0; l4--)
;
for (; i6 < anInt146
&& (anIntArrayArrayArray135[i3][i6 + 1][k3] & j2) != 0; i6++)
;
label2: for (; j7 > 0; j7--) {
for (int i11 = l4; i11 <= i6; i11++)
if ((anIntArrayArrayArray135[j7 - 1][i11][k3] & j2) == 0)
break label2;
}
label3: for (; l8 < l2; l8++) {
for (int j11 = l4; j11 <= i6; j11++)
if ((anIntArrayArrayArray135[l8 + 1][j11][k3] & j2) == 0)
break label3;
}
int k11 = ((l8 + 1) - j7) * ((i6 - l4) + 1);
if (k11 >= 8) {
char c2 = '\360';
int l14 = heightMap[l8][l4][k3]
- c2;
int i16 = heightMap[j7][l4][k3];
SceneGraph.createCullingCluster(l2, l4 * 128, i16,
i6 * 128 + 128, k3 * 128, l14,
k3 * 128, 2);
for (int i17 = j7; i17 <= l8; i17++) {
for (int i18 = l4; i18 <= i6; i18++)
anIntArrayArrayArray135[i17][i18][k3] &= ~j2;
}
}
}
if ((anIntArrayArrayArray135[i3][i4][k3] & k2) != 0) {
int i5 = i4;
int j6 = i4;
int k7 = k3;
int i9 = k3;
for (; k7 > 0
&& (anIntArrayArrayArray135[i3][i4][k7 - 1] & k2) != 0; k7--)
;
for (; i9 < anInt147
&& (anIntArrayArrayArray135[i3][i4][i9 + 1] & k2) != 0; i9++)
;
label4: for (; i5 > 0; i5--) {
for (int l11 = k7; l11 <= i9; l11++)
if ((anIntArrayArrayArray135[i3][i5 - 1][l11] & k2) == 0)
break label4;
}
label5: for (; j6 < anInt146; j6++) {
for (int i12 = k7; i12 <= i9; i12++)
if ((anIntArrayArrayArray135[i3][j6 + 1][i12] & k2) == 0)
break label5;
}
if (((j6 - i5) + 1) * ((i9 - k7) + 1) >= 4) {
int j12 = heightMap[i3][i5][k7];
SceneGraph.createCullingCluster(l2, i5 * 128, j12,
j6 * 128 + 128, i9 * 128 + 128, j12,
k7 * 128, 4);
for (int k13 = i5; k13 <= j6; k13++) {
for (int i15 = k7; i15 <= i9; i15++)
anIntArrayArrayArray135[i3][k13][i15] &= ~k2;
}
}
}
}
}
}
}
}
A few screenshots;
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]