diff --git a/client/src/main/java/rt4/ClientProt.java b/client/src/main/java/rt4/ClientProt.java index 27023a9..e9eab3c 100644 --- a/client/src/main/java/rt4/ClientProt.java +++ b/client/src/main/java/rt4/ClientProt.java @@ -318,7 +318,7 @@ public class ClientProt { if (GlRenderer.enabled) { i = PlayerList.self.movementQueueX[0] >> 3; chunkX = PlayerList.self.movementQueueZ[0] >> 3; - Static73.setLightPosition(chunkX, i); + FogManager.setLightPosition(chunkX, i); } LoginManager.method743(false); if (LoginManager.npcSpawnsFilesBuffer != null) { @@ -331,7 +331,7 @@ public class ClientProt { if (GlRenderer.enabled) { i = PlayerList.self.movementQueueX[0] >> 3; chunkX = PlayerList.self.movementQueueZ[0] >> 3; - Static73.setLightPosition(chunkX, i); + FogManager.setLightPosition(chunkX, i); } Static233.method4002(false); } @@ -534,7 +534,7 @@ public class ClientProt { @Pc(9) Environment local9 = new Environment(); for (@Pc(18) int local18 = 0; local18 < 13; local18++) { for (@Pc(25) int local25 = 0; local25 < 13; local25++) { - Static73.aClass92ArrayArray1[local18][local25] = local9; + FogManager.chunksAtmosphere[local18][local25] = local9; } } } diff --git a/client/src/main/java/rt4/ColorUtils.java b/client/src/main/java/rt4/ColorUtils.java index 239860e..31513fc 100644 --- a/client/src/main/java/rt4/ColorUtils.java +++ b/client/src/main/java/rt4/ColorUtils.java @@ -73,8 +73,8 @@ public class ColorUtils { @OriginalMember(owner = "client!pf", name = "a", descriptor = "(II)[F") public static float[] getRgbFloat(@OriginalArg(0) int arg0) { - @Pc(7) float local7 = FogManager.method3068() + FogManager.method3059(); - @Pc(9) int local9 = FogManager.method3064(); + @Pc(7) float local7 = FogManager.getLightingModelAmbient() + FogManager.getLight0Diffuse(); + @Pc(9) int local9 = FogManager.getLightColor(); @Pc(11) float local11 = 0.58823526F; aFloatArray28[3] = 1.0F; @Pc(24) float local24 = (float) (local9 >> 16 & 0xFF) / 255.0F; diff --git a/client/src/main/java/rt4/Environment.java b/client/src/main/java/rt4/Environment.java index 66df888..0e8503c 100644 --- a/client/src/main/java/rt4/Environment.java +++ b/client/src/main/java/rt4/Environment.java @@ -9,86 +9,87 @@ import org.openrs2.deob.annotation.Pc; public final class Environment { @OriginalMember(owner = "client!li", name = "c", descriptor = "I") - public final int anInt3526; + public final int screenColorRgb; @OriginalMember(owner = "client!li", name = "q", descriptor = "F") - public final float aFloat17; + public final float light1Diffuse; @OriginalMember(owner = "client!li", name = "d", descriptor = "I") - public final int anInt3527; + public final int lightZ; @OriginalMember(owner = "client!li", name = "n", descriptor = "F") - public final float aFloat16; + public final float lightModelAmbient; @OriginalMember(owner = "client!li", name = "a", descriptor = "I") - public final int anInt3525; + public final int fogColorRgb; @OriginalMember(owner = "client!li", name = "g", descriptor = "I") - public final int anInt3528; + public final int lightY; @OriginalMember(owner = "client!li", name = "s", descriptor = "F") - public final float aFloat18; + public final float light0Diffuse; @OriginalMember(owner = "client!li", name = "j", descriptor = "I") - public final int anInt3529; + public final int fogDepth; @OriginalMember(owner = "client!li", name = "k", descriptor = "I") - public final int anInt3530; + public final int lightX; @OriginalMember(owner = "client!li", name = "", descriptor = "()V") public Environment() { - this.anInt3526 = FogManager.anInt3923; - this.aFloat17 = 1.2F; - this.anInt3527 = -50; - this.aFloat16 = 1.1523438F; - this.anInt3525 = FogManager.anInt3922; - this.anInt3528 = -60; - this.aFloat18 = 0.69921875F; - this.anInt3529 = 0; - this.anInt3530 = -50; + this.screenColorRgb = FogManager.defaultLightColorRgb; + this.light1Diffuse = 1.2F; + this.lightZ = -50; + this.lightModelAmbient = 1.1523438F; + this.fogColorRgb = FogManager.defaulFogColorRgb; + this.lightY = -60; + this.light0Diffuse = 0.69921875F; + this.fogDepth = 0; + this.lightX = -50; } @OriginalMember(owner = "client!li", name = "", descriptor = "(Lclient!wa;)V") - public Environment(@OriginalArg(0) Buffer arg0) { - @Pc(7) int local7 = arg0.g1(); - if ((local7 & 0x1) == 0) { - this.anInt3526 = FogManager.anInt3923; + public Environment(@OriginalArg(0) Buffer buffer) { + @Pc(7) int flag = buffer.g1(); + if ((flag & 0x1) == 0) { + this.screenColorRgb = FogManager.defaultLightColorRgb; } else { - this.anInt3526 = arg0.g4(); + this.screenColorRgb = buffer.g4(); } - if ((local7 & 0x2) == 0) { - this.aFloat16 = 1.1523438F; + if ((flag & 0x2) == 0) { + this.lightModelAmbient = 1.1523438F; } else { - this.aFloat16 = (float) arg0.g2() / 256.0F; + this.lightModelAmbient = (float) buffer.g2() / 256.0F; } - if ((local7 & 0x4) == 0) { - this.aFloat18 = 0.69921875F; + if ((flag & 0x4) == 0) { + this.light0Diffuse = 0.69921875F; } else { - this.aFloat18 = (float) arg0.g2() / 256.0F; + this.light0Diffuse = (float) buffer.g2() / 256.0F; } - if ((local7 & 0x8) == 0) { - this.aFloat17 = 1.2F; + if ((flag & 0x8) == 0) { + this.light1Diffuse = 1.2F; } else { - this.aFloat17 = (float) arg0.g2() / 256.0F; + this.light1Diffuse = (float) buffer.g2() / 256.0F; } - if ((local7 & 0x10) == 0) { - this.anInt3527 = -50; - this.anInt3530 = -50; - this.anInt3528 = -60; + if ((flag & 0x10) == 0) { + this.lightZ = -50; + this.lightX = -50; + this.lightY = -60; } else { - this.anInt3530 = arg0.g2b(); - this.anInt3528 = arg0.g2b(); - this.anInt3527 = arg0.g2b(); + this.lightX = buffer.g2b(); + this.lightY = buffer.g2b(); + this.lightZ = buffer.g2b(); } - if ((local7 & 0x20) == 0) { - this.anInt3525 = FogManager.anInt3922; + if ((flag & 0x20) == 0) { + this.fogColorRgb = FogManager.defaulFogColorRgb; } else { - this.anInt3525 = arg0.g4(); + this.fogColorRgb = buffer.g4(); } - if ((local7 & 0x40) == 0) { - this.anInt3529 = 0; + if ((flag & 0x40) == 0) { + this.fogDepth = 0; } else { - this.anInt3529 = arg0.g2(); + this.fogDepth = buffer.g2(); } } + } diff --git a/client/src/main/java/rt4/FogManager.java b/client/src/main/java/rt4/FogManager.java index e8eb057..16d3458 100644 --- a/client/src/main/java/rt4/FogManager.java +++ b/client/src/main/java/rt4/FogManager.java @@ -7,38 +7,87 @@ import org.openrs2.deob.annotation.Pc; public final class FogManager { + @OriginalMember(owner = "client!ph", name = "b", descriptor = "[[Lclient!li;") + public static final Environment[][] chunksAtmosphere = new Environment[13][13]; + @OriginalMember(owner = "client!mk", name = "c", descriptor = "I") - public static int anInt3920; + public static int lightX; @OriginalMember(owner = "client!mk", name = "d", descriptor = "I") - public static int anInt3921; + public static int lightZ; + @OriginalMember(owner = "client!ig", name = "d", descriptor = "I") + public static int anInt2883; + @OriginalMember(owner = "client!jm", name = "s", descriptor = "F") + public static float aFloat13; + @OriginalMember(owner = "client!ui", name = "mb", descriptor = "F") + public static float aFloat37; + @OriginalMember(owner = "client!ej", name = "bb", descriptor = "F") + public static float aFloat6; + @OriginalMember(owner = "client!vh", name = "e", descriptor = "I") + public static int anInt4623; + @OriginalMember(owner = "client!ni", name = "h", descriptor = "I") + public static int anInt4153; + @OriginalMember(owner = "client!be", name = "Vb", descriptor = "F") + public static float aFloat4; + @OriginalMember(owner = "client!ab", name = "b", descriptor = "I") + public static int anInt5868 = 0; + @OriginalMember(owner = "client!sf", name = "c", descriptor = "I") + public static int anInt5080; + @OriginalMember(owner = "client!kd", name = "ub", descriptor = "I") + public static int anInt3255; + @OriginalMember(owner = "client!aj", name = "X", descriptor = "F") + public static float aFloat1; + @OriginalMember(owner = "client!p", name = "g", descriptor = "F") + public static float aFloat23; + @OriginalMember(owner = "client!nc", name = "a", descriptor = "I") + public static int anInt4044; + @OriginalMember(owner = "client!bm", name = "a", descriptor = "F") + public static float aFloat5; + @OriginalMember(owner = "client!ve", name = "t", descriptor = "I") + public static int anInt5731; + @OriginalMember(owner = "client!md", name = "S", descriptor = "I") + public static int anInt3709; + @OriginalMember(owner = "client!ui", name = "T", descriptor = "F") + public static float aFloat36; + @OriginalMember(owner = "client!en", name = "z", descriptor = "F") + public static float aFloat7; + @OriginalMember(owner = "client!ge", name = "q", descriptor = "I") + public static int anInt2161; + @OriginalMember(owner = "client!sa", name = "W", descriptor = "Z") + public static boolean instantScreenFade = true; + @OriginalMember(owner = "client!li", name = "t", descriptor = "I") + public static int currentLightZ; + @OriginalMember(owner = "client!mi", name = "Z", descriptor = "I") + public static int currentLightY; + @OriginalMember(owner = "client!gl", name = "f", descriptor = "I") + public static int currentLightX; @OriginalMember(owner = "client!mk", name = "i", descriptor = "F") - private static float aFloat21; + private static float lightModelAmbient; @OriginalMember(owner = "client!mk", name = "a", descriptor = "[F") - public static final float[] aFloatArray18 = new float[4]; + public static final float[] light0Position = new float[4]; @OriginalMember(owner = "client!mk", name = "b", descriptor = "I") - private static int anInt3919 = -1; + private static int lightColor = -1; @OriginalMember(owner = "client!mk", name = "e", descriptor = "I") - public static int anInt3922 = 13156520; + public static int defaulFogColorRgb = 13156520; @OriginalMember(owner = "client!mk", name = "f", descriptor = "F") - private static float aFloat19 = -1.0F; + private static float light0Diffuse = -1.0F; @OriginalMember(owner = "client!mk", name = "g", descriptor = "F") - private static float aFloat20 = -1.0F; + private static float light1Diffuse = -1.0F; @OriginalMember(owner = "client!mk", name = "h", descriptor = "[F") public static final float[] fogColor = new float[4]; @OriginalMember(owner = "client!mk", name = "j", descriptor = "[F") - private static final float[] aFloatArray20 = new float[4]; + private static final float[] light1Position = new float[4]; @OriginalMember(owner = "client!mk", name = "k", descriptor = "I") - public static int anInt3923 = 16777215; + public static int defaultLightColorRgb = 16777215; @OriginalMember(owner = "client!mk", name = "l", descriptor = "I") private static int fogOffset = -1; @@ -47,40 +96,40 @@ public final class FogManager { private static int fogColorRGB = -1; @OriginalMember(owner = "client!mk", name = "a", descriptor = "()V") - public static void method3058() { - @Pc(1) GL2 local1 = GlRenderer.gl; - local1.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, aFloatArray18, 0); - local1.glLightfv(GL2.GL_LIGHT1, GL2.GL_POSITION, aFloatArray20, 0); + public static void applyLightPosition() { + @Pc(1) GL2 gl = GlRenderer.gl; + gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, light0Position, 0); + gl.glLightfv(GL2.GL_LIGHT1, GL2.GL_POSITION, light1Position, 0); } @OriginalMember(owner = "client!mk", name = "b", descriptor = "()F") - public static float method3059() { - return aFloat19; + public static float getLight0Diffuse() { + return light0Diffuse; } @OriginalMember(owner = "client!mk", name = "a", descriptor = "(IFFF)V") - public static void method3060(@OriginalArg(0) int arg0, @OriginalArg(1) float arg1, @OriginalArg(2) float arg2, @OriginalArg(3) float arg3) { - if (anInt3919 == arg0 && aFloat21 == arg1 && aFloat19 == arg2 && aFloat20 == arg3) { + public static void setLightParams(@OriginalArg(0) int color, @OriginalArg(1) float ambientMod, @OriginalArg(2) float l0Diffuse, @OriginalArg(3) float l1Diffuse) { + if (lightColor == color && lightModelAmbient == ambientMod && light0Diffuse == l0Diffuse && light1Diffuse == l1Diffuse) { return; } - anInt3919 = arg0; - aFloat21 = arg1; - aFloat19 = arg2; - aFloat20 = arg3; - @Pc(25) GL2 local25 = GlRenderer.gl; - @Pc(34) float local34 = (float) (arg0 >> 16 & 0xFF) / 255.0F; - @Pc(43) float local43 = (float) (arg0 >> 8 & 0xFF) / 255.0F; - @Pc(50) float local50 = (float) (arg0 & 0xFF) / 255.0F; - @Pc(75) float[] local75 = new float[]{arg1 * local34, arg1 * local43, arg1 * local50, 1.0F}; - local25.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, local75, 0); - @Pc(105) float[] local105 = new float[]{arg2 * local34, arg2 * local43, arg2 * local50, 1.0F}; - local25.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, local105, 0); - @Pc(139) float[] local139 = new float[]{-arg3 * local34, -arg3 * local43, -arg3 * local50, 1.0F}; - local25.glLightfv(GL2.GL_LIGHT1, GL2.GL_DIFFUSE, local139, 0); + lightColor = color; + lightModelAmbient = ambientMod; + light0Diffuse = l0Diffuse; + light1Diffuse = l1Diffuse; + @Pc(25) GL2 gl = GlRenderer.gl; + @Pc(34) float red = (float) (color >> 16 & 0xFF) / 255.0F; + @Pc(43) float green = (float) (color >> 8 & 0xFF) / 255.0F; + @Pc(50) float blue = (float) (color & 0xFF) / 255.0F; + @Pc(75) float[] lightModelAmbientParams = new float[]{ambientMod * red, ambientMod * green, ambientMod * blue, 1.0F}; + gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, lightModelAmbientParams, 0); + @Pc(105) float[] light0Params = new float[]{l0Diffuse * red, l0Diffuse * green, l0Diffuse * blue, 1.0F}; + gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, light0Params, 0); + @Pc(139) float[] light1Params = new float[]{-l1Diffuse * red, -l1Diffuse * green, -l1Diffuse * blue, 1.0F}; + gl.glLightfv(GL2.GL_LIGHT1, GL2.GL_DIFFUSE, light1Params, 0); } @OriginalMember(owner = "client!mk", name = "a", descriptor = "(II)V") - public static void method3062(@OriginalArg(0) int color, @OriginalArg(1) int offset) { + public static void setFogParams(@OriginalArg(0) int color, @OriginalArg(1) int offset) { if (fogColorRGB == color && fogOffset == offset) { return; } @@ -104,67 +153,134 @@ public final class FogManager { } @OriginalMember(owner = "client!mk", name = "a", descriptor = "(FFF)V") - public static void method3063(@OriginalArg(0) float arg0, @OriginalArg(1) float arg1, @OriginalArg(2) float arg2) { - if (aFloatArray18[0] == arg0 && aFloatArray18[1] == arg1 && aFloatArray18[2] == arg2) { + public static void setLightPosition(@OriginalArg(0) float x, @OriginalArg(1) float y, @OriginalArg(2) float z) { + if (light0Position[0] == x && light0Position[1] == y && light0Position[2] == z) { return; } - aFloatArray18[0] = arg0; - aFloatArray18[1] = arg1; - aFloatArray18[2] = arg2; - aFloatArray20[0] = -arg0; - aFloatArray20[1] = -arg1; - aFloatArray20[2] = -arg2; - anInt3920 = (int) (arg0 * 256.0F / arg1); - anInt3921 = (int) (arg2 * 256.0F / arg1); + light0Position[0] = x; + light0Position[1] = y; + light0Position[2] = z; + light1Position[0] = -x; + light1Position[1] = -y; + light1Position[2] = -z; + lightX = (int) (x * 256.0F / y); + lightZ = (int) (z * 256.0F / y); } @OriginalMember(owner = "client!mk", name = "d", descriptor = "()I") - public static int method3064() { - return anInt3919; + public static int getLightColor() { + return lightColor; } @OriginalMember(owner = "client!mk", name = "e", descriptor = "()V") - public static void method3065() { - @Pc(1) GL2 local1 = GlRenderer.gl; - local1.glColorMaterial(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE); - local1.glEnable(GL2.GL_COLOR_MATERIAL); - @Pc(27) float[] local27 = new float[]{0.0F, 0.0F, 0.0F, 1.0F}; - local1.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, local27, 0); - local1.glEnable(GL2.GL_LIGHT0); - @Pc(55) float[] local55 = new float[]{0.0F, 0.0F, 0.0F, 1.0F}; - local1.glLightfv(GL2.GL_LIGHT1, GL2.GL_AMBIENT, local55, 0); - local1.glEnable(GL2.GL_LIGHT1); - anInt3919 = -1; + public static void setup() { + @Pc(1) GL2 gl = GlRenderer.gl; + gl.glColorMaterial(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE); + gl.glEnable(GL2.GL_COLOR_MATERIAL); + @Pc(27) float[] light0Params = new float[]{0.0F, 0.0F, 0.0F, 1.0F}; + gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, light0Params, 0); + gl.glEnable(GL2.GL_LIGHT0); + @Pc(55) float[] light1Params = new float[]{0.0F, 0.0F, 0.0F, 1.0F}; + gl.glLightfv(GL2.GL_LIGHT1, GL2.GL_AMBIENT, light1Params, 0); + gl.glEnable(GL2.GL_LIGHT1); + lightColor = -1; fogColorRGB = -1; - method3067(); + initDefaults(); } @OriginalMember(owner = "client!mk", name = "a", descriptor = "([F)V") - public static void method3066(@OriginalArg(0) float[] arg0) { - if (arg0 == null) { - arg0 = fogColor; + public static void setFogColor(@OriginalArg(0) float[] params) { + if (params == null) { + params = fogColor; } - @Pc(5) GL2 local5 = GlRenderer.gl; - local5.glFogfv(GL2.GL_FOG_COLOR, arg0, 0); + @Pc(5) GL2 gl = GlRenderer.gl; + gl.glFogfv(GL2.GL_FOG_COLOR, params, 0); } @OriginalMember(owner = "client!mk", name = "f", descriptor = "()V") - private static void method3067() { - method3060(anInt3923, 1.1523438F, 0.69921875F, 1.2F); - method3063(-50.0F, -60.0F, -50.0F); - method3062(anInt3922, 0); + private static void initDefaults() { + setLightParams(defaultLightColorRgb, 1.1523438F, 0.69921875F, 1.2F); + setLightPosition(-50.0F, -60.0F, -50.0F); + setFogParams(defaulFogColorRgb, 0); } @OriginalMember(owner = "client!mk", name = "g", descriptor = "()F") - public static float method3068() { - return aFloat21; + public static float getLightingModelAmbient() { + return lightModelAmbient; } @OriginalMember(owner = "client!si", name = "a", descriptor = "(IZ)V") - public static void method3935(@OriginalArg(0) int arg0) { - method3060(anInt3923, ((float) arg0 * 0.1F + 0.7F) * 1.1523438F, 0.69921875F, 0.69921875F); - method3063(-50.0F, -60.0F, -50.0F); - method3062(anInt3922, 0); - method3058(); + public static void init(@OriginalArg(0) int arg0) { + setLightParams(defaultLightColorRgb, ((float) arg0 * 0.1F + 0.7F) * 1.1523438F, 0.69921875F, 0.69921875F); + setLightPosition(-50.0F, -60.0F, -50.0F); + setFogParams(defaulFogColorRgb, 0); + applyLightPosition(); + } + + @OriginalMember(owner = "client!i", name = "b", descriptor = "(IIIII)I") + public static int method2235(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3) { + if (instantScreenFade) { + arg0 = 1000000; + instantScreenFade = false; + } + @Pc(15) Environment local15 = chunksAtmosphere[arg3][arg1]; + @Pc(25) float local25 = ((float) arg2 * 0.1F + 0.7F) * local15.lightModelAmbient; + @Pc(28) float local28 = local15.light0Diffuse; + @Pc(31) int local31 = local15.screenColorRgb; + @Pc(34) int local34 = local15.fogDepth; + @Pc(37) int local37 = local15.fogColorRgb; + if (!Preferences.fogEnabled) { + local34 = 0; + } + @Pc(44) float local44 = local15.light1Diffuse; + if (local31 != anInt2883 || aFloat13 != local25 || aFloat1 != local28 || local44 != aFloat4 || anInt4044 != local37 || anInt5080 != local34) { + aFloat13 = local25; + aFloat37 = aFloat36; + aFloat6 = aFloat7; + anInt2883 = local31; + anInt4623 = anInt3709; + anInt4153 = anInt2161; + aFloat4 = local44; + anInt5868 = 0; + anInt3255 = anInt5731; + anInt5080 = local34; + aFloat1 = local28; + anInt4044 = local37; + aFloat23 = aFloat5; + } + if (anInt5868 < 65536) { + anInt5868 += arg0 * 250; + if (anInt5868 >= 65536) { + anInt5868 = 65536; + } + @Pc(114) float local114 = (float) anInt5868 / 65536.0F; + @Pc(118) int local118 = anInt5868 >> 8; + @Pc(125) int local125 = 65536 - anInt5868 >> 8; + anInt3709 = (local118 * (anInt4044 & 0xFF00FF) + (anInt4623 & 0xFF00FF) * local125 & 0xFF00FF00) + (local125 * (anInt4623 & 0xFF00) + (anInt4044 & 0xFF00) * local118 & 0xFF0000) >> 8; + @Pc(162) float local162 = (float) (65536 - anInt5868) / 65536.0F; + aFloat7 = local162 * aFloat6 + local114 * aFloat13; + aFloat36 = aFloat37 * local162 + local114 * aFloat1; + aFloat5 = local114 * aFloat4 + local162 * aFloat23; + anInt5731 = ((anInt2883 & 0xFF00) * local118 + local125 * (anInt3255 & 0xFF00) & 0xFF0000) + ((anInt3255 & 0xFF00FF) * local125 + ((anInt2883 & 0xFF00FF) * local118) & 0xFF00FF00) >> 8; + anInt2161 = local118 * anInt5080 + local125 * anInt4153 >> 8; + } + setLightParams(anInt5731, aFloat7, aFloat36, aFloat5); + setFogParams(anInt3709, anInt2161); + setLightPosition((float) currentLightX, (float) currentLightY, (float) currentLightZ); + applyLightPosition(); + return anInt3709; + } + + @OriginalMember(owner = "client!gm", name = "f", descriptor = "(B)V") + public static void setInstantFade() { + instantScreenFade = true; + } + + @OriginalMember(owner = "client!fm", name = "a", descriptor = "(ZII)V") + public static void setLightPosition(@OriginalArg(1) int arg0, @OriginalArg(2) int arg1) { + currentLightX = chunksAtmosphere[arg1][arg0].lightX; + currentLightY = chunksAtmosphere[arg1][arg0].lightY; + currentLightZ = chunksAtmosphere[arg1][arg0].lightZ; + setLightPosition((float) currentLightX, (float) currentLightY, (float) currentLightZ); } } diff --git a/client/src/main/java/rt4/GlModel.java b/client/src/main/java/rt4/GlModel.java index 9f29be8..07d8a29 100644 --- a/client/src/main/java/rt4/GlModel.java +++ b/client/src/main/java/rt4/GlModel.java @@ -2394,9 +2394,9 @@ public final class GlModel extends Model { aClass3_Sub15_8.p4(local71); } } else { - local60 = (int) FogManager.aFloatArray18[0]; - local71 = (int) FogManager.aFloatArray18[1]; - local78 = (int) FogManager.aFloatArray18[2]; + local60 = (int) FogManager.light0Position[0]; + local71 = (int) FogManager.light0Position[1]; + local78 = (int) FogManager.light0Position[2]; local85 = (int) Math.sqrt(local60 * local60 + local71 * local71 + local78 * local78); local90 = (int) ((float) this.aShort29 * 1.3F); local97 = this.aShort28 * local85 >> 8; @@ -3476,21 +3476,21 @@ public final class GlModel extends Model { } @Pc(26) int local26; @Pc(40) int local40; - if (FogManager.anInt3920 > 0) { - local26 = this.vertexBuffer.aShort6 - (this.vertexBuffer.aShort3 * FogManager.anInt3920 >> 8) >> 3; - local40 = this.vertexBuffer.aShort5 - (this.vertexBuffer.aShort2 * FogManager.anInt3920 >> 8) >> 3; + if (FogManager.lightX > 0) { + local26 = this.vertexBuffer.aShort6 - (this.vertexBuffer.aShort3 * FogManager.lightX >> 8) >> 3; + local40 = this.vertexBuffer.aShort5 - (this.vertexBuffer.aShort2 * FogManager.lightX >> 8) >> 3; } else { - local26 = this.vertexBuffer.aShort6 - (this.vertexBuffer.aShort2 * FogManager.anInt3920 >> 8) >> 3; - local40 = this.vertexBuffer.aShort5 - (this.vertexBuffer.aShort3 * FogManager.anInt3920 >> 8) >> 3; + local26 = this.vertexBuffer.aShort6 - (this.vertexBuffer.aShort2 * FogManager.lightX >> 8) >> 3; + local40 = this.vertexBuffer.aShort5 - (this.vertexBuffer.aShort3 * FogManager.lightX >> 8) >> 3; } @Pc(85) int local85; @Pc(99) int local99; - if (FogManager.anInt3921 > 0) { - local85 = this.vertexBuffer.aShort8 - (this.vertexBuffer.aShort3 * FogManager.anInt3921 >> 8) >> 3; - local99 = this.vertexBuffer.aShort7 - (this.vertexBuffer.aShort2 * FogManager.anInt3921 >> 8) >> 3; + if (FogManager.lightZ > 0) { + local85 = this.vertexBuffer.aShort8 - (this.vertexBuffer.aShort3 * FogManager.lightZ >> 8) >> 3; + local99 = this.vertexBuffer.aShort7 - (this.vertexBuffer.aShort2 * FogManager.lightZ >> 8) >> 3; } else { - local85 = this.vertexBuffer.aShort8 - (this.vertexBuffer.aShort2 * FogManager.anInt3921 >> 8) >> 3; - local99 = this.vertexBuffer.aShort7 - (this.vertexBuffer.aShort3 * FogManager.anInt3921 >> 8) >> 3; + local85 = this.vertexBuffer.aShort8 - (this.vertexBuffer.aShort2 * FogManager.lightZ >> 8) >> 3; + local99 = this.vertexBuffer.aShort7 - (this.vertexBuffer.aShort3 * FogManager.lightZ >> 8) >> 3; } @Pc(134) int local134 = local40 + 1 - local26; @Pc(140) int local140 = local99 + 1 - local85; @@ -3514,8 +3514,8 @@ public final class GlModel extends Model { @Pc(248) int local248; @Pc(258) int local258; for (local194 = 0; local194 < this.vertexCount; local194++) { - @Pc(216) int local216 = (this.vertexX[local194] - (this.vertexY[local194] * FogManager.anInt3920 >> 8) >> 3) - local26; - @Pc(234) int local234 = (this.vertexZ[local194] - (this.vertexY[local194] * FogManager.anInt3921 >> 8) >> 3) - local85; + @Pc(216) int local216 = (this.vertexX[local194] - (this.vertexY[local194] * FogManager.lightX >> 8) >> 3) - local26; + @Pc(234) int local234 = (this.vertexZ[local194] - (this.vertexY[local194] * FogManager.lightZ >> 8) >> 3) - local85; @Pc(239) int local239 = this.anIntArray462[local194]; local246 = this.anIntArray462[local194 + 1]; for (local248 = local239; local248 < local246; local248++) { diff --git a/client/src/main/java/rt4/GlRenderer.java b/client/src/main/java/rt4/GlRenderer.java index 4cf273d..6ccb338 100644 --- a/client/src/main/java/rt4/GlRenderer.java +++ b/client/src/main/java/rt4/GlRenderer.java @@ -270,7 +270,7 @@ public final class GlRenderer { gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); - FogManager.method3065(); + FogManager.setup(); LightingManager.method2400(); } diff --git a/client/src/main/java/rt4/InterfaceList.java b/client/src/main/java/rt4/InterfaceList.java index 1527cc4..e1c0eb0 100644 --- a/client/src/main/java/rt4/InterfaceList.java +++ b/client/src/main/java/rt4/InterfaceList.java @@ -1061,7 +1061,7 @@ public class InterfaceList { } else { Camera.updateLoginScreenCamera(); } - Static103.setInstantFade(); + FogManager.setInstantFade(); LoginManager.setupLoadingScreenRegion(); client.setGameState(28); } diff --git a/client/src/main/java/rt4/LoginManager.java b/client/src/main/java/rt4/LoginManager.java index 893a33a..9f75d3a 100644 --- a/client/src/main/java/rt4/LoginManager.java +++ b/client/src/main/java/rt4/LoginManager.java @@ -776,7 +776,7 @@ public class LoginManager { mapFlagX -= local86; } if (GlRenderer.enabled && arg4 && (Math.abs(local86) > 104 || Math.abs(local81) > 104)) { - Static103.setInstantFade(); + FogManager.setInstantFade(); } LightingManager.anInt2875 = -1; aClass69_64.clear(); diff --git a/client/src/main/java/rt4/PathingEntity.java b/client/src/main/java/rt4/PathingEntity.java index 4ace570..a8b6da5 100644 --- a/client/src/main/java/rt4/PathingEntity.java +++ b/client/src/main/java/rt4/PathingEntity.java @@ -308,7 +308,7 @@ public abstract class PathingEntity extends Entity { this.zFine = arg0 * 64 + this.movementQueueZ[0] * 128; this.xFine = arg0 * 64 + this.movementQueueX[0] * 128; if (GlRenderer.enabled && PlayerList.self == this) { - Static103.setInstantFade(); + FogManager.setInstantFade(); } } diff --git a/client/src/main/java/rt4/PlayerAppearance.java b/client/src/main/java/rt4/PlayerAppearance.java index 102eac7..c87f074 100644 --- a/client/src/main/java/rt4/PlayerAppearance.java +++ b/client/src/main/java/rt4/PlayerAppearance.java @@ -46,6 +46,8 @@ public final class PlayerAppearance { public static final int[] anIntArray515 = new int[14]; @OriginalMember(owner = "client!kf", name = "d", descriptor = "[Lclient!cl;") public static final AnimFrameset[] aClass3_Sub2_Sub7Array7 = new AnimFrameset[14]; + @OriginalMember(owner = "client!fm", name = "fb", descriptor = "[I") + public static final int[] anIntArray183 = new int[14]; @OriginalMember(owner = "client!cj", name = "e", descriptor = "[[S") public static short[][] aShortArrayArray2; @OriginalMember(owner = "client!nj", name = "m", descriptor = "[[S") @@ -399,7 +401,7 @@ public final class PlayerAppearance { } if ((local858.tween || SeqType.applyTweening) && local367 != -1 && local367 < local858.frames.length) { anIntArray515[local353] = local858.anIntArray474[local374]; - Static73.anIntArray183[local353] = arg0[local353].anInt5404; + anIntArray183[local353] = arg0[local353].anInt5404; local979 = local858.frames[local367]; aClass3_Sub2_Sub7Array7[local353] = SeqTypeList.getAnimFrameset(local979 >>> 16); @Pc(991) int local991 = local979 & 0xFFFF; @@ -410,7 +412,7 @@ public final class PlayerAppearance { } } else { anIntArray515[local353] = 0; - Static73.anIntArray183[local353] = 0; + anIntArray183[local353] = 0; aClass3_Sub2_Sub7Array7[local353] = null; anIntArray187[local353] = -1; } @@ -487,7 +489,7 @@ public final class PlayerAppearance { local598 = 1; while (local481 < local346) { if (aClass3_Sub2_Sub7Array8[local481] != null) { - local1284.method4565(aClass3_Sub2_Sub7Array8[local481], Static241.anIntArray520[local481], aClass3_Sub2_Sub7Array7[local481], anIntArray187[local481], Static73.anIntArray183[local481] - 1, anIntArray515[local481], local598, aClass144Array2[local481].aBoolean278, this.anIntArrayArray19[local481]); + local1284.method4565(aClass3_Sub2_Sub7Array8[local481], Static241.anIntArray520[local481], aClass3_Sub2_Sub7Array7[local481], anIntArray187[local481], anIntArray183[local481] - 1, anIntArray515[local481], local598, aClass144Array2[local481].aBoolean278, this.anIntArrayArray19[local481]); } local481++; local598 <<= 0x1; diff --git a/client/src/main/java/rt4/SceneGraph.java b/client/src/main/java/rt4/SceneGraph.java index e0f9c71..e6bd9a2 100644 --- a/client/src/main/java/rt4/SceneGraph.java +++ b/client/src/main/java/rt4/SceneGraph.java @@ -765,9 +765,9 @@ public class SceneGraph { } } } else { - local168 = (int) FogManager.aFloatArray18[0]; - local173 = (int) FogManager.aFloatArray18[1]; - local178 = (int) FogManager.aFloatArray18[2]; + local168 = (int) FogManager.light0Position[0]; + local173 = (int) FogManager.light0Position[1]; + local178 = (int) FogManager.light0Position[2]; overlay = (int) Math.sqrt(local173 * local173 + local168 * local168 + local178 * local178); local200 = overlay * 1024 >> 8; for (local202 = 1; local202 < 103; local202++) { @@ -1600,7 +1600,7 @@ public class SceneGraph { if (var10 != Static152.anInt3604) { Static152.anInt3604 = var10; WaterMaterialRenderer.method619(var10); - FogManager.method3066(WaterMaterialRenderer.method2422()); + FogManager.setFogColor(WaterMaterialRenderer.method2422()); } local65 = var9 >>> 24 << 3; if (local65 != Static247.anInt730) { @@ -2860,7 +2860,7 @@ public class SceneGraph { if (GlRenderer.enabled) { MaterialManager.renderingUnderwater = false; MaterialManager.setMaterial(0, 0); - FogManager.method3066(null); + FogManager.setFogColor(null); LightingManager.method2390(); } setUnderwater(false); @@ -2943,7 +2943,7 @@ public class SceneGraph { if (local285.underwaterColor != Static152.anInt3604) { Static152.anInt3604 = local285.underwaterColor; WaterMaterialRenderer.method619(local285.underwaterColor); - FogManager.method3066(WaterMaterialRenderer.method2422()); + FogManager.setFogColor(WaterMaterialRenderer.method2422()); } local285.method1944(tiles, local294, false); } diff --git a/client/src/main/java/rt4/ScriptRunner.java b/client/src/main/java/rt4/ScriptRunner.java index b28af72..77c341e 100644 --- a/client/src/main/java/rt4/ScriptRunner.java +++ b/client/src/main/java/rt4/ScriptRunner.java @@ -302,9 +302,9 @@ public final class ScriptRunner { GlRenderer.setDepthTestEnabled(true); GlRenderer.setFogEnabled(true); if (client.gameState == 10) { - local171 = Static103.method2235(Protocol.anInt4247, Camera.renderZ >> 10, Preferences.brightness, Camera.renderX >> 10); + local171 = FogManager.method2235(Protocol.anInt4247, Camera.renderZ >> 10, Preferences.brightness, Camera.renderX >> 10); } else { - local171 = Static103.method2235(Protocol.anInt4247, PlayerList.self.movementQueueZ[0] >> 3, Preferences.brightness, PlayerList.self.movementQueueX[0] >> 3); + local171 = FogManager.method2235(Protocol.anInt4247, PlayerList.self.movementQueueZ[0] >> 3, Preferences.brightness, PlayerList.self.movementQueueX[0] >> 3); } LightingManager.method2394(client.loop, !Preferences.flickeringEffectsOn); GlRenderer.clearColorAndDepthBuffers(local171); @@ -4809,7 +4809,7 @@ public final class ScriptRunner { } } if (GlRenderer.enabled) { - Static103.setInstantFade(); + FogManager.setInstantFade(); if (!Preferences.highDetailLighting) { Static145.method2742(); } @@ -4933,7 +4933,7 @@ public final class ScriptRunner { isp--; Preferences.fogEnabled = intStack[isp] == 1; if (GlRenderer.enabled) { - Static103.setInstantFade(); + FogManager.setInstantFade(); } Preferences.write(GameShell.signLink); Preferences.sentToServer = false; diff --git a/client/src/main/java/rt4/ShadowManager.java b/client/src/main/java/rt4/ShadowManager.java index edab34e..cc34f9c 100644 --- a/client/src/main/java/rt4/ShadowManager.java +++ b/client/src/main/java/rt4/ShadowManager.java @@ -109,8 +109,8 @@ public final class ShadowManager { @Pc(19) int local19 = arg4 << 7; @Pc(29) int local29 = arg6 + arg7 + arg8 + arg9 >> 2; @Pc(33) int local33 = arg5 << 7; - @Pc(43) int local43 = local19 - (local29 * FogManager.anInt3920 >> 8) >> 3; - @Pc(53) int local53 = local33 - (local29 * FogManager.anInt3921 >> 8) >> 3; + @Pc(43) int local43 = local19 - (local29 * FogManager.lightX >> 8) >> 3; + @Pc(53) int local53 = local33 - (local29 * FogManager.lightZ >> 8) >> 3; if (arg0 != 0 && arg0 != 1 && (arg2 || arg3)) { method4210(Sprites.floorShadows[arg0], shadowMapImage, local43 + 1, local53 + 1, arg1, arg2); } else { @@ -336,8 +336,8 @@ public final class ShadowManager { @OriginalMember(owner = "client!tj", name = "a", descriptor = "(Lclient!ek;III)V") public static void method4207(@OriginalArg(0) SoftwareIndexedSprite arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3) { if (arg0 != null) { - @Pc(12) int local12 = arg1 - (arg2 * FogManager.anInt3920 >> 8) >> 3; - @Pc(22) int local22 = arg3 - (arg2 * FogManager.anInt3921 >> 8) >> 3; + @Pc(12) int local12 = arg1 - (arg2 * FogManager.lightX >> 8) >> 3; + @Pc(22) int local22 = arg3 - (arg2 * FogManager.lightZ >> 8) >> 3; method4202(arg0, shadowMapImage, local12 + 1, local22 + 1); } } @@ -369,8 +369,8 @@ public final class ShadowManager { if (arg0 == null) { return false; } else { - @Pc(13) int local13 = arg1 - (arg2 * FogManager.anInt3920 >> 8) >> 3; - @Pc(23) int local23 = arg3 - (arg2 * FogManager.anInt3921 >> 8) >> 3; + @Pc(13) int local13 = arg1 - (arg2 * FogManager.lightX >> 8) >> 3; + @Pc(23) int local23 = arg3 - (arg2 * FogManager.lightZ >> 8) >> 3; return method4200(arg0, shadowMapImage, local13 + 1, local23 + 1); } } @@ -413,8 +413,8 @@ public final class ShadowManager { @OriginalMember(owner = "client!tj", name = "c", descriptor = "(Lclient!ek;III)V") public static void method4211(@OriginalArg(0) SoftwareIndexedSprite arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3) { if (arg0 != null) { - @Pc(12) int local12 = arg1 - (arg2 * FogManager.anInt3920 >> 8) >> 3; - @Pc(22) int local22 = arg3 - (arg2 * FogManager.anInt3921 >> 8) >> 3; + @Pc(12) int local12 = arg1 - (arg2 * FogManager.lightX >> 8) >> 3; + @Pc(22) int local22 = arg3 - (arg2 * FogManager.lightZ >> 8) >> 3; method4194(arg0, shadowMapImage, local12 + 1, local22 + 1); } } diff --git a/client/src/main/java/rt4/Static103.java b/client/src/main/java/rt4/Static103.java deleted file mode 100644 index 677b6e0..0000000 --- a/client/src/main/java/rt4/Static103.java +++ /dev/null @@ -1,111 +0,0 @@ -package rt4; - -import org.openrs2.deob.annotation.OriginalArg; -import org.openrs2.deob.annotation.OriginalMember; -import org.openrs2.deob.annotation.Pc; - -public final class Static103 { - - @OriginalMember(owner = "client!i", name = "ec", descriptor = "[I") - public static int[] anIntArray254; - - @OriginalMember(owner = "client!ig", name = "d", descriptor = "I") - public static int anInt2883; - @OriginalMember(owner = "client!jm", name = "s", descriptor = "F") - public static float aFloat13; - @OriginalMember(owner = "client!ui", name = "mb", descriptor = "F") - public static float aFloat37; - @OriginalMember(owner = "client!ej", name = "bb", descriptor = "F") - public static float aFloat6; - @OriginalMember(owner = "client!vh", name = "e", descriptor = "I") - public static int anInt4623; - @OriginalMember(owner = "client!ni", name = "h", descriptor = "I") - public static int anInt4153; - @OriginalMember(owner = "client!be", name = "Vb", descriptor = "F") - public static float aFloat4; - @OriginalMember(owner = "client!ab", name = "b", descriptor = "I") - public static int anInt5868 = 0; - @OriginalMember(owner = "client!sf", name = "c", descriptor = "I") - public static int anInt5080; - @OriginalMember(owner = "client!kd", name = "ub", descriptor = "I") - public static int anInt3255; - @OriginalMember(owner = "client!aj", name = "X", descriptor = "F") - public static float aFloat1; - @OriginalMember(owner = "client!p", name = "g", descriptor = "F") - public static float aFloat23; - @OriginalMember(owner = "client!nc", name = "a", descriptor = "I") - public static int anInt4044; - @OriginalMember(owner = "client!bm", name = "a", descriptor = "F") - public static float aFloat5; - @OriginalMember(owner = "client!ve", name = "t", descriptor = "I") - public static int anInt5731; - @OriginalMember(owner = "client!md", name = "S", descriptor = "I") - public static int anInt3709; - @OriginalMember(owner = "client!ui", name = "T", descriptor = "F") - public static float aFloat36; - @OriginalMember(owner = "client!en", name = "z", descriptor = "F") - public static float aFloat7; - @OriginalMember(owner = "client!ge", name = "q", descriptor = "I") - public static int anInt2161; - @OriginalMember(owner = "client!sa", name = "W", descriptor = "Z") - public static boolean instantScreenFade = true; - - @OriginalMember(owner = "client!i", name = "b", descriptor = "(IIIII)I") - public static int method2235(@OriginalArg(0) int arg0, @OriginalArg(1) int arg1, @OriginalArg(2) int arg2, @OriginalArg(3) int arg3) { - if (instantScreenFade) { - arg0 = 1000000; - instantScreenFade = false; - } - @Pc(15) Environment local15 = Static73.aClass92ArrayArray1[arg3][arg1]; - @Pc(25) float local25 = ((float) arg2 * 0.1F + 0.7F) * local15.aFloat16; - @Pc(28) float local28 = local15.aFloat18; - @Pc(31) int local31 = local15.anInt3526; - @Pc(34) int local34 = local15.anInt3529; - @Pc(37) int local37 = local15.anInt3525; - if (!Preferences.fogEnabled) { - local34 = 0; - } - @Pc(44) float local44 = local15.aFloat17; - if (local31 != anInt2883 || aFloat13 != local25 || aFloat1 != local28 || local44 != aFloat4 || anInt4044 != local37 || anInt5080 != local34) { - aFloat13 = local25; - aFloat37 = aFloat36; - aFloat6 = aFloat7; - anInt2883 = local31; - anInt4623 = anInt3709; - anInt4153 = anInt2161; - aFloat4 = local44; - anInt5868 = 0; - anInt3255 = anInt5731; - anInt5080 = local34; - aFloat1 = local28; - anInt4044 = local37; - aFloat23 = aFloat5; - } - if (anInt5868 < 65536) { - anInt5868 += arg0 * 250; - if (anInt5868 >= 65536) { - anInt5868 = 65536; - } - @Pc(114) float local114 = (float) anInt5868 / 65536.0F; - @Pc(118) int local118 = anInt5868 >> 8; - @Pc(125) int local125 = 65536 - anInt5868 >> 8; - anInt3709 = (local118 * (anInt4044 & 0xFF00FF) + (anInt4623 & 0xFF00FF) * local125 & 0xFF00FF00) + (local125 * (anInt4623 & 0xFF00) + (anInt4044 & 0xFF00) * local118 & 0xFF0000) >> 8; - @Pc(162) float local162 = (float) (65536 - anInt5868) / 65536.0F; - aFloat7 = local162 * aFloat6 + local114 * aFloat13; - aFloat36 = aFloat37 * local162 + local114 * aFloat1; - aFloat5 = local114 * aFloat4 + local162 * aFloat23; - anInt5731 = ((anInt2883 & 0xFF00) * local118 + local125 * (anInt3255 & 0xFF00) & 0xFF0000) + ((anInt3255 & 0xFF00FF) * local125 + ((anInt2883 & 0xFF00FF) * local118) & 0xFF00FF00) >> 8; - anInt2161 = local118 * anInt5080 + local125 * anInt4153 >> 8; - } - FogManager.method3060(anInt5731, aFloat7, aFloat36, aFloat5); - FogManager.method3062(anInt3709, anInt2161); - FogManager.method3063((float) Static73.anInt2263, (float) Static73.anInt3893, (float) Static73.anInt3534); - FogManager.method3058(); - return anInt3709; - } - - @OriginalMember(owner = "client!gm", name = "f", descriptor = "(B)V") - public static void setInstantFade() { - instantScreenFade = true; - } -} diff --git a/client/src/main/java/rt4/Static145.java b/client/src/main/java/rt4/Static145.java index 1f89bfe..d0f4d1d 100644 --- a/client/src/main/java/rt4/Static145.java +++ b/client/src/main/java/rt4/Static145.java @@ -12,6 +12,16 @@ public final class Static145 { public static int[] anIntArray516; @OriginalMember(owner = "client!ri", name = "d", descriptor = "[I") public static int[] anIntArray188; + @OriginalMember(owner = "client!wb", name = "b", descriptor = "[I") + public static int[] anIntArray562; + @OriginalMember(owner = "client!nd", name = "y", descriptor = "Lclient!mm;") + public static SoftwareSprite aClass3_Sub2_Sub1_Sub1_3; + @OriginalMember(owner = "client!i", name = "ec", descriptor = "[I") + public static int[] anIntArray254; + @OriginalMember(owner = "client!t", name = "G", descriptor = "[Lclient!ek;") + public static SoftwareIndexedSprite[] aClass36_Sub1Array1; + @OriginalMember(owner = "client!hh", name = "r", descriptor = "[I") + public static int[] anIntArray235; @OriginalMember(owner = "client!lf", name = "a", descriptor = "(I)V") public static void method2742() { @@ -25,8 +35,8 @@ public final class Static145 { @OriginalMember(owner = "client!lf", name = "a", descriptor = "(ILclient!ve;)V") public static void method2743(@OriginalArg(1) Js5 arg0) { - Static233.aClass36_Sub1Array1 = SpriteLoader.method3088(Flames.anInt3443, arg0); - Static221.anIntArray235 = new int[256]; + aClass36_Sub1Array1 = SpriteLoader.method3088(Flames.anInt3443, arg0); + anIntArray235 = new int[256]; @Pc(15) int local15; for (local15 = 0; local15 < 3; local15++) { @Pc(30) int local30 = Flames.anIntArray445[local15 + 1] >> 16 & 0xFF; @@ -39,21 +49,21 @@ public final class Static145 { @Pc(88) int local88 = Flames.anIntArray445[local15 + 1] & 0xFF; @Pc(95) float local95 = ((float) local88 - local55) / 64.0F; for (@Pc(97) int local97 = 0; local97 < 64; local97++) { - Static221.anIntArray235[local97 + local15 * 64] = (int) local55 | (int) local48 << 8 | (int) local39 << 16; + anIntArray235[local97 + local15 * 64] = (int) local55 | (int) local48 << 8 | (int) local39 << 16; local48 += local80; local55 += local95; local39 += local62; } } for (local15 = 192; local15 < 255; local15++) { - Static221.anIntArray235[local15] = Flames.anIntArray445[3]; + anIntArray235[local15] = Flames.anIntArray445[3]; } - Static267.anIntArray562 = new int[32768]; + anIntArray562 = new int[32768]; anIntArray516 = new int[32768]; - Static69.method1545(null); - Static103.anIntArray254 = new int[32768]; + method1545(null); + anIntArray254 = new int[32768]; anIntArray188 = new int[32768]; - Static221.aClass3_Sub2_Sub1_Sub1_3 = new SoftwareSprite(128, 254); + aClass3_Sub2_Sub1_Sub1_3 = new SoftwareSprite(128, 254); } @OriginalMember(owner = "client!lf", name = "b", descriptor = "(I)V") @@ -85,4 +95,43 @@ public final class Static145 { Static121.method2407(InterfaceList.anInt4271, InterfaceList.anInt5138, InterfaceList.anInt436, InterfaceList.anInt761); } + @OriginalMember(owner = "client!fh", name = "a", descriptor = "(BLclient!ek;)V") + public static void method1545(@OriginalArg(1) SoftwareIndexedSprite arg0) { + @Pc(5) int local5; + for (local5 = 0; local5 < anIntArray562.length; local5++) { + anIntArray562[local5] = 0; + } + @Pc(36) int local36; + for (local5 = 0; local5 < 5000; local5++) { + local36 = (int) ((double) 256 * Math.random() * 128.0D); + anIntArray562[local36] = (int) (Math.random() * 284.0D); + } + @Pc(66) int local66; + @Pc(76) int local76; + for (local5 = 0; local5 < 20; local5++) { + for (local36 = 1; local36 < 255; local36++) { + for (local66 = 1; local66 < 127; local66++) { + local76 = local66 + (local36 << 7); + anIntArray516[local76] = (anIntArray562[local76 + 128] + anIntArray562[local76 - 1] + anIntArray562[local76 + 1] + anIntArray562[local76 + -128]) / 4; + } + } + @Pc(113) int[] local113 = anIntArray562; + anIntArray562 = anIntArray516; + anIntArray516 = local113; + } + if (arg0 == null) { + return; + } + local5 = 0; + for (local36 = 0; local36 < arg0.height; local36++) { + for (local66 = 0; local66 < arg0.width; local66++) { + if (arg0.aByteArray18[local5++] != 0) { + local76 = arg0.anInt4280 + local66 + 16; + @Pc(162) int local162 = arg0.anInt4273 + local36 + 16; + @Pc(169) int local169 = local76 + (local162 << 7); + anIntArray562[local169] = 0; + } + } + } + } } diff --git a/client/src/main/java/rt4/Static221.java b/client/src/main/java/rt4/Static221.java index 787e610..71825c1 100644 --- a/client/src/main/java/rt4/Static221.java +++ b/client/src/main/java/rt4/Static221.java @@ -10,10 +10,6 @@ public final class Static221 { public static final int[] anIntArray83 = new int[256]; @OriginalMember(owner = "client!s", name = "a", descriptor = "[I") public static int[] tt; - @OriginalMember(owner = "client!nd", name = "y", descriptor = "Lclient!mm;") - public static SoftwareSprite aClass3_Sub2_Sub1_Sub1_3; - @OriginalMember(owner = "client!hh", name = "r", descriptor = "[I") - public static int[] anIntArray235; @OriginalMember(owner = "client!s", name = "b", descriptor = "(III)V") public static void method3392(@OriginalArg(0) int arg0, @OriginalArg(2) int arg1) { @@ -35,7 +31,7 @@ public final class Static221 { @Pc(65) int local65 = SoftwareRaster.pixels[local24++ + arg0]; @Pc(70) int local70 = Static145.anIntArray188[local20++]; if (local70 == 0) { - aClass3_Sub2_Sub1_Sub1_3.pixels[local26++] = local65; + Static145.aClass3_Sub2_Sub1_Sub1_3.pixels[local26++] = local65; } else { @Pc(76) int local76 = local70 + 18; if (local76 > 255) { @@ -45,19 +41,19 @@ public final class Static221 { if (local89 > 255) { local89 = 255; } - local70 = anIntArray235[local70]; - aClass3_Sub2_Sub1_Sub1_3.pixels[local26++] = (local89 * (local65 & 0xFF00FF) + (local70 & 0xFF00FF) * local76 & 0xFF00FF00) + ((local70 & 0xFF00) * local76 + ((local65 & 0xFF00) * local89) & 0xFF0000) >> 8; + local70 = Static145.anIntArray235[local70]; + Static145.aClass3_Sub2_Sub1_Sub1_3.pixels[local26++] = (local89 * (local65 & 0xFF00FF) + (local70 & 0xFF00FF) * local76 & 0xFF00FF00) + ((local70 & 0xFF00) * local76 + ((local65 & 0xFF00) * local89) & 0xFF0000) >> 8; } } for (local55 = 0; local55 < local43; local55++) { - aClass3_Sub2_Sub1_Sub1_3.pixels[local26++] = SoftwareRaster.pixels[arg0 + local24++]; + Static145.aClass3_Sub2_Sub1_Sub1_3.pixels[local26++] = SoftwareRaster.pixels[arg0 + local24++]; } local24 += SoftwareRaster.width - 128; } if (GlRenderer.enabled) { - GlRaster.method1178(aClass3_Sub2_Sub1_Sub1_3.pixels, arg0, arg1, aClass3_Sub2_Sub1_Sub1_3.width, aClass3_Sub2_Sub1_Sub1_3.height); + GlRaster.method1178(Static145.aClass3_Sub2_Sub1_Sub1_3.pixels, arg0, arg1, Static145.aClass3_Sub2_Sub1_Sub1_3.width, Static145.aClass3_Sub2_Sub1_Sub1_3.height); } else { - aClass3_Sub2_Sub1_Sub1_3.method1415(arg0, arg1); + Static145.aClass3_Sub2_Sub1_Sub1_3.method1415(arg0, arg1); } } diff --git a/client/src/main/java/rt4/Static233.java b/client/src/main/java/rt4/Static233.java index 4e66f22..f3d83bb 100644 --- a/client/src/main/java/rt4/Static233.java +++ b/client/src/main/java/rt4/Static233.java @@ -12,9 +12,6 @@ public final class Static233 { @OriginalMember(owner = "client!t", name = "A", descriptor = "I") public static int anInt5225; - @OriginalMember(owner = "client!t", name = "G", descriptor = "[Lclient!ek;") - public static SoftwareIndexedSprite[] aClass36_Sub1Array1; - @OriginalMember(owner = "client!t", name = "y", descriptor = "I") public static int loadingScreenState = 0; diff --git a/client/src/main/java/rt4/Static267.java b/client/src/main/java/rt4/Static267.java index 1a351a5..593b7eb 100644 --- a/client/src/main/java/rt4/Static267.java +++ b/client/src/main/java/rt4/Static267.java @@ -13,8 +13,6 @@ public final class Static267 { @OriginalMember(owner = "client!vl", name = "l", descriptor = "I") public static int anInt5776 = 0; - @OriginalMember(owner = "client!wb", name = "b", descriptor = "[I") - public static int[] anIntArray562; @OriginalMember(owner = "client!vl", name = "a", descriptor = "(I)Z") public static boolean isShowingVideoAd() { @@ -37,10 +35,10 @@ public final class Static267 { } Static123.anInt3058 += arg0 * 128; @Pc(40) int local40; - if (anIntArray562.length < Static123.anInt3058) { - Static123.anInt3058 -= anIntArray562.length; + if (Static145.anIntArray562.length < Static123.anInt3058) { + Static123.anInt3058 -= Static145.anIntArray562.length; local40 = (int) (Math.random() * 12.0D); - Static69.method1545(Static233.aClass36_Sub1Array1[local40]); + Static145.method1545(Static145.aClass36_Sub1Array1[local40]); } local40 = 0; @Pc(54) int local54 = (256 - arg0) * 128; @@ -48,7 +46,7 @@ public final class Static267 { @Pc(60) int local60; @Pc(89) int local89; for (local60 = 0; local60 < local54; local60++) { - local89 = Static145.anIntArray188[local40 + local58] - arg0 * anIntArray562[anIntArray562.length - 1 & Static123.anInt3058 + local40] / 6; + local89 = Static145.anIntArray188[local40 + local58] - arg0 * Static145.anIntArray562[Static145.anIntArray562.length - 1 & Static123.anInt3058 + local40] / 6; if (local89 < 0) { local89 = 0; } @@ -97,7 +95,7 @@ public final class Static267 { local117 -= Static145.anIntArray188[local290 + local125 - local60 - 1]; } if (local290 >= 0) { - Static103.anIntArray254[local290 + local125] = local117 / (local60 * 2 + 1); + Static145.anIntArray254[local290 + local125] = local117 / (local60 * 2 + 1); } } } @@ -106,10 +104,10 @@ public final class Static267 { for (local125 = -local60; local125 < 256; local125++) { local290 = local125 * 128; if (local125 + local60 < 256) { - local117 += Static103.anIntArray254[local60 * 128 + local89 + local290]; + local117 += Static145.anIntArray254[local60 * 128 + local89 + local290]; } if (local125 - local60 - 1 >= 0) { - local117 -= Static103.anIntArray254[local89 + local290 - (local60 + 1) * 128]; + local117 -= Static145.anIntArray254[local89 + local290 - (local60 + 1) * 128]; } if (local125 >= 0) { Static145.anIntArray188[local290 + local89] = local117 / (local60 * 2 + 1); diff --git a/client/src/main/java/rt4/Static69.java b/client/src/main/java/rt4/Static69.java index a1416c1..9d00b64 100644 --- a/client/src/main/java/rt4/Static69.java +++ b/client/src/main/java/rt4/Static69.java @@ -24,44 +24,4 @@ public final class Static69 { } } - @OriginalMember(owner = "client!fh", name = "a", descriptor = "(BLclient!ek;)V") - public static void method1545(@OriginalArg(1) SoftwareIndexedSprite arg0) { - @Pc(5) int local5; - for (local5 = 0; local5 < Static267.anIntArray562.length; local5++) { - Static267.anIntArray562[local5] = 0; - } - @Pc(36) int local36; - for (local5 = 0; local5 < 5000; local5++) { - local36 = (int) ((double) 256 * Math.random() * 128.0D); - Static267.anIntArray562[local36] = (int) (Math.random() * 284.0D); - } - @Pc(66) int local66; - @Pc(76) int local76; - for (local5 = 0; local5 < 20; local5++) { - for (local36 = 1; local36 < 255; local36++) { - for (local66 = 1; local66 < 127; local66++) { - local76 = local66 + (local36 << 7); - Static145.anIntArray516[local76] = (Static267.anIntArray562[local76 + 128] + Static267.anIntArray562[local76 - 1] + Static267.anIntArray562[local76 + 1] + Static267.anIntArray562[local76 + -128]) / 4; - } - } - @Pc(113) int[] local113 = Static267.anIntArray562; - Static267.anIntArray562 = Static145.anIntArray516; - Static145.anIntArray516 = local113; - } - if (arg0 == null) { - return; - } - local5 = 0; - for (local36 = 0; local36 < arg0.height; local36++) { - for (local66 = 0; local66 < arg0.width; local66++) { - if (arg0.aByteArray18[local5++] != 0) { - local76 = arg0.anInt4280 + local66 + 16; - @Pc(162) int local162 = arg0.anInt4273 + local36 + 16; - @Pc(169) int local169 = local76 + (local162 << 7); - Static267.anIntArray562[local169] = 0; - } - } - } - } - } diff --git a/client/src/main/java/rt4/Static73.java b/client/src/main/java/rt4/Static73.java deleted file mode 100644 index 6f1b0f0..0000000 --- a/client/src/main/java/rt4/Static73.java +++ /dev/null @@ -1,30 +0,0 @@ -package rt4; - -import org.openrs2.deob.annotation.OriginalArg; -import org.openrs2.deob.annotation.OriginalMember; - -public final class Static73 { - - @OriginalMember(owner = "client!fm", name = "W", descriptor = "Lclient!na;") - public static final JagString aClass100_453 = JagString.parse(")2"); - - @OriginalMember(owner = "client!fm", name = "fb", descriptor = "[I") - public static final int[] anIntArray183 = new int[14]; - @OriginalMember(owner = "client!ph", name = "b", descriptor = "[[Lclient!li;") - public static final Environment[][] aClass92ArrayArray1 = new Environment[13][13]; - @OriginalMember(owner = "client!li", name = "t", descriptor = "I") - public static int anInt3534; - @OriginalMember(owner = "client!mi", name = "Z", descriptor = "I") - public static int anInt3893; - @OriginalMember(owner = "client!gl", name = "f", descriptor = "I") - public static int anInt2263; - - @OriginalMember(owner = "client!fm", name = "a", descriptor = "(ZII)V") - public static void setLightPosition(@OriginalArg(1) int arg0, @OriginalArg(2) int arg1) { - anInt2263 = aClass92ArrayArray1[arg1][arg0].anInt3530; - anInt3893 = aClass92ArrayArray1[arg1][arg0].anInt3528; - anInt3534 = aClass92ArrayArray1[arg1][arg0].anInt3527; - FogManager.method3063((float) anInt2263, (float) anInt3893, (float) anInt3534); - } - -} diff --git a/client/src/main/java/rt4/Static87.java b/client/src/main/java/rt4/Static87.java index 1e9f375..b1df670 100644 --- a/client/src/main/java/rt4/Static87.java +++ b/client/src/main/java/rt4/Static87.java @@ -758,7 +758,7 @@ public final class Static87 { GlRenderer.restoreLighting(); GlRenderer.setDepthTestEnabled(true); GlRenderer.setFogEnabled(false); - FogManager.method3935(Preferences.brightness); + FogManager.init(Preferences.brightness); if (ScriptRunner.aBoolean299) { GlRaster.method1177(); GlRenderer.clearDepthBuffer(); @@ -1101,7 +1101,7 @@ public final class Static87 { local243 = local117 + (arg4 >> 3); local188 = (arg3 >> 3) + local515; if (local243 >= 0 && local243 < 13 && local188 >= 0 && local188 < 13) { - Static73.aClass92ArrayArray1[local243][local188] = local490; + FogManager.chunksAtmosphere[local243][local188] = local490; } } } diff --git a/client/src/main/java/rt4/Static89.java b/client/src/main/java/rt4/Static89.java index 7d31619..906a5eb 100644 --- a/client/src/main/java/rt4/Static89.java +++ b/client/src/main/java/rt4/Static89.java @@ -349,7 +349,7 @@ public final class Static89 { if (local472 == null) { local472 = new Environment(); } - Static73.aClass92ArrayArray1[arg1 >> 3][arg4 >> 3] = local472; + FogManager.chunksAtmosphere[arg1 >> 3][arg4 >> 3] = local472; break label207; } while (local497 <= 0); for (local232 = 0; local232 < local497; local232++) { diff --git a/client/src/main/java/rt4/StringUtils.java b/client/src/main/java/rt4/StringUtils.java index c692b65..5cd4964 100644 --- a/client/src/main/java/rt4/StringUtils.java +++ b/client/src/main/java/rt4/StringUtils.java @@ -11,6 +11,8 @@ public class StringUtils { public static final JagString nonBreakingSpace = JagString.getNbsp(); @OriginalMember(owner = "client!rm", name = "i", descriptor = "Lclient!na;") public static final JagString aClass100_930 = JagString.parse("(Z"); + @OriginalMember(owner = "client!fm", name = "W", descriptor = "Lclient!na;") + public static final JagString aClass100_453 = JagString.parse(")2"); @OriginalMember(owner = "client!gj", name = "a", descriptor = "(II)Z") public static boolean isAlphaNumeric(@OriginalArg(0) int arg0) { @@ -80,7 +82,7 @@ public class StringUtils { @Pc(9) JagString local9 = Static87.allocate(0); if (arg3 < 0L) { arg3 = -arg3; - local9.method3113(Static73.aClass100_453); + local9.method3113(aClass100_453); } @Pc(26) JagString local26 = Static182.aClass100_1017; @Pc(28) JagString local28 = Static182.aClass100_185; diff --git a/client/src/main/java/rt4/WaterMaterialRenderer.java b/client/src/main/java/rt4/WaterMaterialRenderer.java index 41e8418..6082fd6 100644 --- a/client/src/main/java/rt4/WaterMaterialRenderer.java +++ b/client/src/main/java/rt4/WaterMaterialRenderer.java @@ -36,8 +36,8 @@ public final class WaterMaterialRenderer implements MaterialRenderer { @OriginalMember(owner = "client!jj", name = "a", descriptor = "(B)[F") public static float[] method2422() { - @Pc(3) float local3 = FogManager.method3068() + FogManager.method3059(); - @Pc(9) int local9 = FogManager.method3064(); + @Pc(3) float local3 = FogManager.getLightingModelAmbient() + FogManager.getLight0Diffuse(); + @Pc(9) int local9 = FogManager.getLightColor(); @Pc(18) float local18 = (float) (local9 >> 16 & 0xFF) / 255.0F; ColorUtils.aFloatArray28[3] = 1.0F; @Pc(37) float local37 = (float) (local9 >> 8 & 0xFF) / 255.0F; diff --git a/client/src/main/java/rt4/client.java b/client/src/main/java/rt4/client.java index 23e8252..6892e76 100644 --- a/client/src/main/java/rt4/client.java +++ b/client/src/main/java/rt4/client.java @@ -625,7 +625,7 @@ public final class client extends GameShell { PlayerSkillXpTable.experience[local3506] = 0; } if (GlRenderer.enabled) { - Static103.setInstantFade(); + FogManager.setInstantFade(); } Protocol.aBoolean228 = true; Protocol.verifyId = 0; @@ -929,8 +929,8 @@ public final class client extends GameShell { if (game == 1) { Cheat.shiftClick = true; - FogManager.anInt3923 = 16777215; - FogManager.anInt3922 = 0; + FogManager.defaultLightColorRgb = 16777215; + FogManager.defaulFogColorRgb = 0; PlayerAppearance.aShortArrayArray2 = PlayerAppearance.aShortArrayArray4; PlayerAppearance.aShortArrayArray7 = PlayerAppearance.aShortArrayArray1; PlayerAppearance.aShortArray65 = PlayerAppearance.aShortArray1;