Skip to content

Commit 757198d

Browse files
committed
refactor: rename/move mouse/keyboard inactivity
1 parent 6137882 commit 757198d

File tree

8 files changed

+23
-32
lines changed

8 files changed

+23
-32
lines changed

src/main/java/org/runejs/client/Class17.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ public class Class17 {
1313
public static ProducingGraphicsBuffer aProducingGraphicsBuffer_463;
1414
public static int[] anIntArray466 = new int[256];
1515

16-
public static int method274() {
17-
return Class49.anInt1147++;
18-
}
19-
2016
public static void animatePlayers(int playerIndex) {
2117
for(int currentPlayerIndex = playerIndex; Player.localPlayerCount > currentPlayerIndex; currentPlayerIndex++) {
2218
int actualIndex;

src/main/java/org/runejs/client/Class49.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
package org.runejs.client;
22

33
import org.runejs.client.cache.CacheArchive;
4-
import org.runejs.client.input.MouseHandler;
5-
import org.runejs.client.media.renderable.Model;
6-
import org.runejs.client.media.renderable.actor.Player;
7-
import org.runejs.client.scene.SceneCamera;
8-
import org.runejs.client.scene.SceneCluster;
94

105
public class Class49 {
11-
public static volatile int anInt1147 = 0;
126
public static CacheArchive definitionCache;
137
public static int anInt1154;
148

src/main/java/org/runejs/client/Game.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,8 +1550,8 @@ else if(ChatBox.dialogueId != -1)
15501550
for(int i_19_ = 0; i_19_ < 5; i_19_++)
15511551
SceneCamera.customCameraTimer[i_19_]++;
15521552
GameInterface.manageTextInputs();
1553-
int i_20_ = Npc.method400(-1);
1554-
int i_21_ = Class17.method274();
1553+
int i_20_ = MouseHandler.resetFramesSinceMouseInput();
1554+
int i_21_ = KeyFocusListener.resetFramesSinceKeyboardInput();
15551555
if(i_20_ > 4500 && i_21_ > 4500) {
15561556
SceneCluster.idleLogout = 250;
15571557
MovedStatics.method650(4000);

src/main/java/org/runejs/client/LinkedList.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public class LinkedList {
1717
public static int selectedInventorySlot;
1818
public static LinkedList aLinkedList_1064 = new LinkedList();
1919
public static int[] terrainDataIds;
20-
public static volatile int anInt1073 = 0;
2120
public static int crossType = 0;
2221

2322
/**

src/main/java/org/runejs/client/MovedStatics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ public static ProducingGraphicsBuffer createGraphicsBuffer(int width, int height
10241024
}
10251025

10261026
public static void method650(int arg1) {
1027-
LinkedList.anInt1073 = arg1;
1027+
MouseHandler.framesSinceMouseInput = arg1;
10281028
}
10291029

10301030
public static void method652() {

src/main/java/org/runejs/client/input/KeyFocusListener.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class KeyFocusListener implements KeyListener, FocusListener {
1919
public static LinkedList aLinkedList_1278 = new LinkedList();
2020
public static int[] crc8LookupTable = new int[256];
2121
public static ProducingGraphicsBuffer aProducingGraphicsBuffer_1285;
22+
public static volatile int framesSinceKeyboardInput = 0;
2223

2324
static {
2425
for (int divident = 0; divident < 256; divident++) {
@@ -119,6 +120,10 @@ public static void removeListeners(Component arg1) {
119120
arg1.removeFocusListener(Class59.keyFocusListener);
120121
}
121122

123+
public static int resetFramesSinceKeyboardInput() {
124+
return framesSinceKeyboardInput++;
125+
}
126+
122127
public void keyTyped(KeyEvent arg0) {
123128
arg0.consume();
124129
}
@@ -134,7 +139,7 @@ public synchronized void focusLost(FocusEvent arg0) {
134139

135140
public synchronized void keyPressed(KeyEvent keyEvent) {
136141
if (Class59.keyFocusListener != null) {
137-
Class49.anInt1147 = 0;
142+
framesSinceKeyboardInput = 0;
138143
int obfuscatedKeyCode = keyEvent.getKeyCode();
139144
int eventKeyCode = keyEvent.getKeyCode();
140145
if (obfuscatedKeyCode >= 0 && MovedStatics.anIntArray1564.length > obfuscatedKeyCode) {
@@ -179,7 +184,7 @@ public synchronized void keyPressed(KeyEvent keyEvent) {
179184

180185
public synchronized void keyReleased(KeyEvent arg0) {
181186
if (Class59.keyFocusListener != null) {
182-
Class49.anInt1147 = 0;
187+
framesSinceKeyboardInput = 0;
183188
int i = arg0.getKeyCode();
184189

185190
if (i < 0 || MovedStatics.anIntArray1564.length <= i) {

src/main/java/org/runejs/client/input/MouseHandler.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class MouseHandler implements MouseListener, MouseMotionListener, FocusLi
3535
public static int cursorY;
3636
public static int cursorX;
3737
public static boolean gameScreenClickable;
38+
public static volatile int framesSinceMouseInput = 0;
3839
private static volatile int eventClickX = 0;
3940
private static volatile long lastClick = 0L;
4041
public boolean mouseWheelDown;
@@ -177,17 +178,21 @@ public static void addListeners(Component arg0) {
177178
arg0.addMouseWheelListener(GameObject.frame);
178179
}
179180

181+
public static int resetFramesSinceMouseInput() {
182+
return framesSinceMouseInput++;
183+
}
184+
180185
public synchronized void mouseEntered(MouseEvent arg0) {
181186
if(GameObject.frame != null) {
182-
LinkedList.anInt1073 = 0;
187+
framesSinceMouseInput = 0;
183188
eventMouseX = arg0.getX();
184189
eventMouseY = arg0.getY();
185190
}
186191
}
187192

188193
public synchronized void mouseExited(MouseEvent arg0) {
189194
if(GameObject.frame != null) {
190-
LinkedList.anInt1073 = 0;
195+
framesSinceMouseInput = 0;
191196
eventMouseX = -1;
192197
eventMouseY = -1;
193198
}
@@ -202,7 +207,7 @@ public synchronized void mouseDragged(MouseEvent mouseEvent) {
202207
int mouseX = mouseEvent.getX();
203208
int mouseY = mouseEvent.getY();
204209
if(GameObject.frame != null) {
205-
LinkedList.anInt1073 = 0;
210+
framesSinceMouseInput = 0;
206211
}
207212
if(mouseWheelDown) {
208213
mouseY = mouseWheelX - mouseEvent.getX();
@@ -217,7 +222,7 @@ public synchronized void mouseDragged(MouseEvent mouseEvent) {
217222
}
218223

219224
private void mouseWheelDragged(int i, int j) {
220-
LinkedList.anInt1073 = 0;
225+
framesSinceMouseInput = 0;
221226

222227
if(!mouseWheelDown)
223228
return;
@@ -232,7 +237,7 @@ public synchronized void mousePressed(MouseEvent event) {
232237
if(GameObject.frame != null) {
233238
int mouseX = event.getX();
234239
int mouseY = event.getY();
235-
LinkedList.anInt1073 = 0;
240+
framesSinceMouseInput = 0;
236241
eventClickX = mouseX;
237242
MovedStatics.eventClickY = mouseY;
238243
lastClick = System.currentTimeMillis();
@@ -256,7 +261,7 @@ public synchronized void mousePressed(MouseEvent event) {
256261

257262
public void mouseWheelMoved(MouseWheelEvent event) {
258263
int rotation = event.getWheelRotation();
259-
LinkedList.anInt1073 = 0;
264+
framesSinceMouseInput = 0;
260265

261266
if(!handleInterfaceScrolling(event)) {
262267
int currentZoom = Game.playerCamera.getZoom();
@@ -382,15 +387,15 @@ public boolean handleInterfaceScrolling(MouseWheelEvent event) {
382387

383388
public synchronized void mouseMoved(MouseEvent arg0) {
384389
if(GameObject.frame != null) {
385-
LinkedList.anInt1073 = 0;
390+
framesSinceMouseInput = 0;
386391
eventMouseX = arg0.getX();
387392
eventMouseY = arg0.getY();
388393
}
389394
}
390395

391396
public synchronized void mouseReleased(MouseEvent arg0) {
392397
if(GameObject.frame != null) {
393-
LinkedList.anInt1073 = 0;
398+
framesSinceMouseInput = 0;
394399
mouseButtonPressed = 0;
395400
mouseWheelDown = false;
396401
}

src/main/java/org/runejs/client/media/renderable/actor/Npc.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.runejs.client.media.renderable.Model;
88
import org.runejs.client.net.PacketBuffer;
99
import org.runejs.client.scene.Scene;
10-
import org.runejs.client.scene.SceneCluster;
1110

1211
public class Npc extends Actor {
1312
public static int anInt3294 = 0;
@@ -102,13 +101,6 @@ public static void parseNpcUpdateMasks(PacketBuffer buffer) {
102101
}
103102
}
104103

105-
public static int method400(int arg0) {
106-
if(arg0 != -1)
107-
SceneCluster.packetBuffer = null;
108-
return LinkedList.anInt1073++;
109-
110-
}
111-
112104
public Model getRotatedModel() {
113105
if(actorDefinition == null)
114106
return null;

0 commit comments

Comments
 (0)