Skip to content

Commit edebe51

Browse files
committed
more deob
1 parent f9b78a3 commit edebe51

File tree

12 files changed

+80
-81
lines changed

12 files changed

+80
-81
lines changed

src/main/java/com/jagex/runescape/Class22.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static void method309(int arg0, int arg1) {
123123
HuffmanEncoding.method1030((byte) 127);
124124
int i = Npc.method795((byte) -70, arg1).anInt2633;
125125
if(i != 0) {
126-
int i_21_ = GroundItemTile.varbitMasks[arg1];
126+
int i_21_ = GroundItemTile.varPlayers[arg1];
127127
if(i == 1) {
128128
if(i_21_ == 1) {
129129
Rasterizer3D.method711(0.9);

src/main/java/com/jagex/runescape/ClientScriptRunner.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,12 @@ public static void runClientScripts(Object[] listeners, int arg1, int arg2, Game
339339
}
340340
if(scriptOpcode == 1) {
341341
int operand = intOperands[scriptIndex];
342-
scriptIntValues[intValueIndex++] = GroundItemTile.varbitMasks[operand];
342+
scriptIntValues[intValueIndex++] = GroundItemTile.varPlayers[operand];
343343
continue;
344344
}
345345
if(scriptOpcode == 2) {
346346
int operand = intOperands[scriptIndex];
347-
GroundItemTile.varbitMasks[operand] = scriptIntValues[--intValueIndex];
347+
GroundItemTile.varPlayers[operand] = scriptIntValues[--intValueIndex];
348348
continue;
349349
}
350350
if(scriptOpcode == 3) {
@@ -398,7 +398,7 @@ public static void runClientScripts(Object[] listeners, int arg1, int arg2, Game
398398
}
399399
if(scriptOpcode == 25) {
400400
int operand = intOperands[scriptIndex];
401-
scriptIntValues[intValueIndex++] = VarbitDefinition.getVarbitMorphIndex(operand);
401+
scriptIntValues[intValueIndex++] = VarbitDefinition.getVarbitValue(operand);
402402
continue;
403403
}
404404
if(scriptOpcode == 27) {

src/main/java/com/jagex/runescape/MovedStatics.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,11 +736,11 @@ public static void method522(int arg0, int arg1) {
736736
int i = varbitDefinition.leastSignificantBit;
737737
int i_0_ = varbitDefinition.index;
738738
int i_1_ = varbitDefinition.mostSignificantBit;
739-
int i_3_ = ProducingGraphicsBuffer_Sub1.anIntArray2199[i_1_ + -i];
739+
int i_3_ = VarbitDefinition.varbitMasks[i_1_ + -i];
740740
if (arg0 < 0 || i_3_ < arg0)
741741
arg0 = 0;
742742
i_3_ <<= i;
743-
GroundItemTile.varbitMasks[i_0_] = UnderlayDefinition.bitWiseOR(HuffmanEncoding.method1021(GroundItemTile.varbitMasks[i_0_], i_3_ ^ 0xffffffff), HuffmanEncoding.method1021(i_3_, arg0 << i));
743+
GroundItemTile.varPlayers[i_0_] = UnderlayDefinition.bitWiseOR(HuffmanEncoding.method1021(GroundItemTile.varPlayers[i_0_], i_3_ ^ 0xffffffff), HuffmanEncoding.method1021(i_3_, arg0 << i));
744744
}
745745

746746
public static int method525(byte[] arg0, int arg1, byte arg2) {

src/main/java/com/jagex/runescape/ProducingGraphicsBuffer_Sub1.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,12 @@
1616
import java.nio.charset.StandardCharsets;
1717

1818
public class ProducingGraphicsBuffer_Sub1 extends ProducingGraphicsBuffer implements ImageProducer, ImageObserver {
19-
public static int[] anIntArray2199 = new int[32];
2019
public static ImageRGB[] aClass40_Sub5_Sub14_Sub4Array2204;
2120
public static int[] anIntArray2207 = {0, -1, 0, 1};
2221
public static int anInt2210;
2322
public static int anInt2211 = 2;
2423
public static ProducingGraphicsBuffer aProducingGraphicsBuffer_2213;
2524

26-
static {
27-
int i = 2;
28-
for(int i_7_ = 0; i_7_ < 32; i_7_++) {
29-
anIntArray2199[i_7_] = -1 + i;
30-
i += i;
31-
}
32-
}
33-
3425
public ColorModel colorModel;
3526
public ImageConsumer imageConsumer;
3627

src/main/java/com/jagex/runescape/cache/cs/ClientScript.java

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -88,31 +88,31 @@ public static int parseClientScripts(int scriptIndex, boolean arg1, GameInterfac
8888
if (arg1) {
8989
HuffmanEncoding.anInt1559 = -63;
9090
}
91-
int i_15_ = 0;
91+
int operator = 0;
9292
while (true) {
93-
int i_16_ = 0;
94-
int i_17_ = 0;
93+
int operand = 0;
94+
int nextOperator = 0;
9595
int opcode = opcodes[scriptDataIndex++];
9696
if (opcode == 0) {
9797
return i;
9898
}
9999
if (opcode == 15) {
100-
i_17_ = 1;
100+
nextOperator = 1;
101101
}
102102
if (opcode == 16) {
103-
i_17_ = 2;
103+
nextOperator = 2;
104104
}
105105
if (opcode == 1) {
106-
i_16_ = Player.playerLevels[opcodes[scriptDataIndex++]];
106+
operand = Player.playerLevels[opcodes[scriptDataIndex++]];
107107
}
108108
if (opcode == 2) {
109-
i_16_ = Player.nextLevels[opcodes[scriptDataIndex++]];
109+
operand = Player.nextLevels[opcodes[scriptDataIndex++]];
110110
}
111111
if (opcode == 3) {
112-
i_16_ = Player.playerExperience[opcodes[scriptDataIndex++]];
112+
operand = Player.playerExperience[opcodes[scriptDataIndex++]];
113113
}
114114
if (opcode == 17) {
115-
i_17_ = 3;
115+
nextOperator = 3;
116116
}
117117
if (opcode == 4) {
118118
int i_19_ = opcodes[scriptDataIndex++] << 16;
@@ -122,29 +122,29 @@ public static int parseClientScripts(int scriptIndex, boolean arg1, GameInterfac
122122
if (i_20_ != -1 && (!ItemDefinition.forId(i_20_, 10).members || Class22.membersWorld)) {
123123
for (int i_21_ = 0; i_21_ < gameInterface.items.length; i_21_++) {
124124
if (1 + i_20_ == gameInterface.items[i_21_]) {
125-
i_16_ += gameInterface.itemAmounts[i_21_];
125+
operand += gameInterface.itemAmounts[i_21_];
126126
}
127127
}
128128
}
129129
}
130130
if (opcode == 5) {
131131
int temp = opcodes[scriptDataIndex++];
132-
i_16_ = GroundItemTile.varbitMasks[temp];
132+
operand = GroundItemTile.varPlayers[temp];
133133
}
134134
if (opcode == 6) {
135-
i_16_ = Player.experienceForLevels[-1 + Player.nextLevels[opcodes[scriptDataIndex++]]];
135+
operand = Player.experienceForLevels[-1 + Player.nextLevels[opcodes[scriptDataIndex++]]];
136136
}
137137
if (opcode == 7) {
138-
int temp = opcodes[scriptDataIndex++];
139-
i_16_ = 100 * GroundItemTile.varbitMasks[temp] / 46875;
138+
int varPlayerIndex = opcodes[scriptDataIndex++];
139+
operand = 100 * GroundItemTile.varPlayers[varPlayerIndex] / 46875;
140140
}
141141
if (opcode == 8) {
142-
i_16_ = Player.localPlayer.combatLevel;
142+
operand = Player.localPlayer.combatLevel;
143143
}
144144
if (opcode == 9) {
145145
for (int i_22_ = 0; i_22_ < 25; i_22_++) {
146146
if (Class22.aBooleanArray548[i_22_]) {
147-
i_16_ += Player.nextLevels[i_22_];
147+
operand += Player.nextLevels[i_22_];
148148
}
149149
}
150150
}
@@ -156,52 +156,52 @@ public static int parseClientScripts(int scriptIndex, boolean arg1, GameInterfac
156156
if (i_24_ != -1 && (!ItemDefinition.forId(i_24_, 10).members || Class22.membersWorld)) {
157157
for (int i_25_ = 0; gameInterface.items.length > i_25_; i_25_++) {
158158
if (i_24_ + 1 == gameInterface.items[i_25_]) {
159-
i_16_ = 999999999;
159+
operand = 999999999;
160160
break;
161161
}
162162
}
163163
}
164164
}
165165
if (opcode == 11) {
166-
i_16_ = ClientScriptRunner.runEnergy;
166+
operand = ClientScriptRunner.runEnergy;
167167
}
168168
if (opcode == 12) {
169-
i_16_ = GenericTile.anInt1222;
169+
operand = GenericTile.carryWeight;
170170
}
171171
if (opcode == 13) {
172-
int i_26_ = GroundItemTile.varbitMasks[opcodes[scriptDataIndex++]];
173-
int i_27_ = opcodes[scriptDataIndex++];
174-
i_16_ = (1 << i_27_ & i_26_) != 0 ? 1 : 0;
172+
int varPlayerValue = GroundItemTile.varPlayers[opcodes[scriptDataIndex++]];
173+
int leastSignificantBit = opcodes[scriptDataIndex++];
174+
operand = (1 << leastSignificantBit & varPlayerValue) != 0 ? 1 : 0;
175175
}
176176
if (opcode == 14) {
177-
int i_28_ = opcodes[scriptDataIndex++];
178-
i_16_ = VarbitDefinition.getVarbitMorphIndex(i_28_);
177+
int varbitId = opcodes[scriptDataIndex++];
178+
operand = VarbitDefinition.getVarbitValue(varbitId);
179179
}
180180
if (opcode == 18) {
181-
i_16_ = (Player.localPlayer.worldX >> 7) + SpotAnimDefinition.baseX;
181+
operand = (Player.localPlayer.worldX >> 7) + SpotAnimDefinition.baseX;
182182
}
183183
if (opcode == 19) {
184-
i_16_ = (Player.localPlayer.worldY >> 7) + Class26.baseY;
184+
operand = (Player.localPlayer.worldY >> 7) + Class26.baseY;
185185
}
186186
if (opcode == 20) {
187-
i_16_ = opcodes[scriptDataIndex++];
187+
operand = opcodes[scriptDataIndex++];
188188
}
189-
if (i_17_ == 0) {
190-
if (i_15_ == 0) {
191-
i += i_16_;
189+
if (nextOperator == 0) {
190+
if (operator == 0) {
191+
i += operand;
192192
}
193-
if (i_15_ == 1) {
194-
i -= i_16_;
193+
if (operator == 1) {
194+
i -= operand;
195195
}
196-
if (i_15_ == 2 && i_16_ != 0) {
197-
i /= i_16_;
196+
if (operator == 2 && operand != 0) {
197+
i /= operand;
198198
}
199-
if (i_15_ == 3) {
200-
i *= i_16_;
199+
if (operator == 3) {
200+
i *= operand;
201201
}
202-
i_15_ = 0;
202+
operator = 0;
203203
} else {
204-
i_15_ = i_17_;
204+
operator = nextOperator;
205205
}
206206
}
207207
} catch (Exception exception) {

src/main/java/com/jagex/runescape/cache/def/ActorDefinition.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ public boolean method571(int arg0) {
199199
}
200200
int i = arg0;
201201
if(varBitId != -1) {
202-
i = VarbitDefinition.getVarbitMorphIndex(varBitId);
202+
i = VarbitDefinition.getVarbitValue(varBitId);
203203
} else if(varpIndex != -1) {
204-
i = GroundItemTile.varbitMasks[varpIndex];
204+
i = GroundItemTile.varPlayers[varpIndex];
205205
}
206206
return i >= 0 && childrenIds.length > i && childrenIds[i] != -1;
207207
}
@@ -341,9 +341,9 @@ public Model getHeadModel() {
341341
public ActorDefinition getChildDefinition(int arg0) {
342342
int childId = arg0;
343343
if(varBitId != -1) {
344-
childId = VarbitDefinition.getVarbitMorphIndex(varBitId);
344+
childId = VarbitDefinition.getVarbitValue(varBitId);
345345
} else if(varpIndex != -1) {
346-
childId = GroundItemTile.varbitMasks[varpIndex];
346+
childId = GroundItemTile.varPlayers[varpIndex];
347347
}
348348
if(childId < 0 || childId >= childrenIds.length || childrenIds[childId] == -1) {
349349
return null;

src/main/java/com/jagex/runescape/cache/def/GameObjectDefinition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,10 @@ public GameObjectDefinition getChildDefinition() {
549549
int i = -1;
550550
if(varbitId == -1) {
551551
if(configId != -1) {
552-
i = GroundItemTile.varbitMasks[configId];
552+
i = GroundItemTile.varPlayers[configId];
553553
}
554554
} else {
555-
i = VarbitDefinition.getVarbitMorphIndex(varbitId);
555+
i = VarbitDefinition.getVarbitValue(varbitId);
556556

557557
}
558558
if(i < 0 || configChangeDest.length <= i || configChangeDest[i] == -1) {

src/main/java/com/jagex/runescape/cache/def/VarbitDefinition.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ public class VarbitDefinition extends CachedNode {
1616
public static int[] anIntArray2361 = new int[]{0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647, -1};
1717
public static CacheArchive aCacheArchive_2364;
1818
public static int destinationX = 0;
19+
public static int[] varbitMasks = new int[32];
20+
21+
static {
22+
int i = 2;
23+
for(int i_7_ = 0; i_7_ < 32; i_7_++) {
24+
varbitMasks[i_7_] = -1 + i;
25+
i += i;
26+
}
27+
}
1928

2029
public int index;
2130
public int leastSignificantBit;
@@ -34,18 +43,17 @@ public static VarbitDefinition getDefinition(int varbitId) {
3443
}
3544

3645
/**
37-
* Returns the index to morph actor/object into, based on set config
38-
* @param varbitId
39-
* @return index to morph into
46+
* Returns the varbit value from a varPlayer, respecting the varbit MSB and LSB
47+
* @param varbitId The varbit ID to fetch the value for
48+
* @return the varbit value as currently stored in the client
4049
*/
41-
public static int getVarbitMorphIndex(int varbitId) {
50+
public static int getVarbitValue(int varbitId) {
4251
VarbitDefinition varbitDefinition = getDefinition(varbitId);
52+
int varPlayerIndex = varbitDefinition.index;
4353
int mostSignificantBit = varbitDefinition.mostSignificantBit;
44-
int configId = varbitDefinition.index;
4554
int leastSignificantBit = varbitDefinition.leastSignificantBit;
46-
// TODO: Unknown
47-
int i_8_ = ProducingGraphicsBuffer_Sub1.anIntArray2199[mostSignificantBit - leastSignificantBit];
48-
return GroundItemTile.varbitMasks[configId] >> leastSignificantBit & i_8_;
55+
int mask = varbitMasks[mostSignificantBit - leastSignificantBit];
56+
return GroundItemTile.varPlayers[varPlayerIndex] >> leastSignificantBit & mask;
4957
}
5058

5159
public void readValues(Buffer buffer) {

src/main/java/com/jagex/runescape/cache/media/gameInterface/GameInterface.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,8 @@ public static void processMenuActions(int arg0, int arg1) {
676676
GameInterface gameInterface = getInterface(i_10_);
677677
if(gameInterface.clientScripts != null && gameInterface.clientScripts[0][0] == 5) {
678678
int i_16_ = gameInterface.clientScripts[0][1];
679-
if(gameInterface.alternateRhs[0] != GroundItemTile.varbitMasks[i_16_]) {
680-
GroundItemTile.varbitMasks[i_16_] = gameInterface.alternateRhs[0];
679+
if(gameInterface.alternateRhs[0] != GroundItemTile.varPlayers[i_16_]) {
680+
GroundItemTile.varPlayers[i_16_] = gameInterface.alternateRhs[0];
681681
Class22.method309(-1, i_16_);
682682
redrawTabArea = true;
683683
}
@@ -789,7 +789,7 @@ public static void processMenuActions(int arg0, int arg1) {
789789
GameInterface gameInterface = getInterface(i_10_);
790790
if(gameInterface.clientScripts != null && gameInterface.clientScripts[0][0] == 5) {
791791
int i_17_ = gameInterface.clientScripts[0][1];
792-
GroundItemTile.varbitMasks[i_17_] = -GroundItemTile.varbitMasks[i_17_] + 1;
792+
GroundItemTile.varPlayers[i_17_] = -GroundItemTile.varPlayers[i_17_] + 1;
793793
Class22.method309(-1, i_17_);
794794
redrawTabArea = true;
795795
}

src/main/java/com/jagex/runescape/net/IncomingPackets.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ public static boolean parseIncomingPackets(boolean arg0) {
186186
int i_8_ = incomingPacketBuffer.getByte();
187187
int i_9_ = incomingPacketBuffer.getUnsignedShortBE();
188188
Buffer.anIntArray1984[i_9_] = i_8_;
189-
if(GroundItemTile.varbitMasks[i_9_] != i_8_) {
190-
GroundItemTile.varbitMasks[i_9_] = i_8_;
189+
if(GroundItemTile.varPlayers[i_9_] != i_8_) {
190+
GroundItemTile.varPlayers[i_9_] = i_8_;
191191
Class22.method309(-1, i_9_);
192192
GameInterface.redrawTabArea = true;
193193
if(ChatBox.dialogueId != -1)
@@ -741,8 +741,8 @@ public static boolean parseIncomingPackets(boolean arg0) {
741741
int configValue = incomingPacketBuffer.getIntBE();
742742
int configId = incomingPacketBuffer.getUnsignedShortBE();
743743
Buffer.anIntArray1984[configId] = configValue;
744-
if(configValue != GroundItemTile.varbitMasks[configId]) {
745-
GroundItemTile.varbitMasks[configId] = configValue;
744+
if(configValue != GroundItemTile.varPlayers[configId]) {
745+
GroundItemTile.varPlayers[configId] = configValue;
746746
Class22.method309(-1, configId);
747747
if(ChatBox.dialogueId != -1)
748748
ChatBox.redrawChatbox = true;
@@ -846,7 +846,7 @@ public static boolean parseIncomingPackets(boolean arg0) {
846846
if(incomingPacket == UPDATE_CARRY_WEIGHT) { // update carry weight
847847
if(Player.currentTabId == 12)
848848
GameInterface.redrawTabArea = true;
849-
GenericTile.anInt1222 = incomingPacketBuffer.getShortBE();
849+
GenericTile.carryWeight = incomingPacketBuffer.getShortBE();
850850
incomingPacket = -1;
851851
return true;
852852
}
@@ -861,7 +861,7 @@ public static boolean parseIncomingPackets(boolean arg0) {
861861
Class40_Sub5_Sub11 class40_sub5_sub11 = Npc.method795((byte) -114, i_80_);
862862
if(class40_sub5_sub11 != null && class40_sub5_sub11.anInt2633 == 0) {
863863
Buffer.anIntArray1984[i_80_] = 0;
864-
GroundItemTile.varbitMasks[i_80_] = 0;
864+
GroundItemTile.varPlayers[i_80_] = 0;
865865
}
866866
}
867867
if(ChatBox.dialogueId != -1)
@@ -1067,9 +1067,9 @@ else if(fromPlayerRights == 1)
10671067
return true;
10681068
}
10691069
if(incomingPacket == 72) { // reset varbits?
1070-
for(int maskIndex = 0; maskIndex < GroundItemTile.varbitMasks.length; maskIndex++) {
1071-
if(Buffer.anIntArray1984[maskIndex] != GroundItemTile.varbitMasks[maskIndex]) {
1072-
GroundItemTile.varbitMasks[maskIndex] = Buffer.anIntArray1984[maskIndex];
1070+
for(int maskIndex = 0; maskIndex < GroundItemTile.varPlayers.length; maskIndex++) {
1071+
if(Buffer.anIntArray1984[maskIndex] != GroundItemTile.varPlayers[maskIndex]) {
1072+
GroundItemTile.varPlayers[maskIndex] = Buffer.anIntArray1984[maskIndex];
10731073
Class22.method309(-1, maskIndex);
10741074
GameInterface.redrawTabArea = true;
10751075
}

0 commit comments

Comments
 (0)