diff --git a/build.gradle.kts b/build.gradle.kts index 3c50b45..aad77c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,10 +13,10 @@ plugins { `maven-publish` } -val oprsver = "1.5.44-SNAPSHOT" +val oprsver = "3.1.0" group = "com.openosrs" -version = "1.0.3.1" +version = "1.0.3.2" repositories { mavenCentral() diff --git a/src/main/java/com/openosrs/injector/injectors/raw/RasterizerAlpha.java b/src/main/java/com/openosrs/injector/injectors/raw/RasterizerAlpha.java index 8f1d333..e099947 100644 --- a/src/main/java/com/openosrs/injector/injectors/raw/RasterizerAlpha.java +++ b/src/main/java/com/openosrs/injector/injectors/raw/RasterizerAlpha.java @@ -125,13 +125,16 @@ public class RasterizerAlpha extends AbstractInjector StackContext alphaPop = isub.getPops().get(0); InstructionContext alphaPusher = alphaPop.getPushed(); InstructionContext isubResult = isub.getPushes().get(0).getPopped().get(0); + boolean shouldSubtractLocal = false; if (pushesToSameVar(isubResult, alphaPusher)) { - alphaPusher = resolveFieldThroughInvokes(alphaPop); + shouldSubtractLocal = true; + alphaPusher = isubResult; + /*alphaPusher = resolveFieldThroughInvokes(alphaPop); if (alphaPusher == null) - throw new RuntimeException("Alpha var is overwritten and we don't know what pushed it"); // cheeky unchecked + throw new RuntimeException("Alpha var is overwritten and we don't know what pushed it"); // cheeky unchecked*/ } int storeIdx = instrs.getInstructions().indexOf(instruction); @@ -139,13 +142,22 @@ public class RasterizerAlpha extends AbstractInjector Instruction alphaPushI = alphaPusher.getInstruction(); if (alphaPushI instanceof GetStatic) { - //instrs.addInstruction(storeIdx++, new LDC(instrs, 255)); + instrs.addInstruction(storeIdx++, new LDC(instrs, 255)); instrs.addInstruction(storeIdx++, new GetStatic(instrs, ((GetStatic) alphaPushI).getField())); - //instrs.addInstruction(storeIdx++, new ISub(instrs, InstructionType.ISUB)); + instrs.addInstruction(storeIdx++, new ISub(instrs, InstructionType.ISUB)); } else if (alphaPushI instanceof LVTInstruction) { - instrs.addInstruction(storeIdx++, new ILoad(instrs, ((LVTInstruction) alphaPushI).getVariableIndex())); + if (shouldSubtractLocal) + { + instrs.addInstruction(storeIdx++, new LDC(instrs, 255)); + instrs.addInstruction(storeIdx++, new ILoad(instrs, ((LVTInstruction) alphaPushI).getVariableIndex())); + instrs.addInstruction(storeIdx++, new ISub(instrs, InstructionType.ISUB)); + } + else + { + instrs.addInstruction(storeIdx++, new ILoad(instrs, ((LVTInstruction) alphaPushI).getVariableIndex())); + } } instrs.getInstructions().set(storeIdx, new InvokeStatic(instrs, DRAWALPHA));