mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-12 09:30:22 -07:00
Mouse wheel camera movement
This commit is contained in:
parent
5711fb89c0
commit
72ab182425
7 changed files with 54 additions and 32 deletions
|
|
@ -8,13 +8,18 @@ import org.openrs2.deob.annotation.OriginalClass;
|
||||||
import org.openrs2.deob.annotation.OriginalMember;
|
import org.openrs2.deob.annotation.OriginalMember;
|
||||||
import org.openrs2.deob.annotation.Pc;
|
import org.openrs2.deob.annotation.Pc;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
@OriginalClass("client!ug")
|
@OriginalClass("client!ug")
|
||||||
public final class Mouse implements MouseListener, MouseMotionListener, FocusListener {
|
public final class Mouse implements MouseListener, MouseMotionListener, FocusListener {
|
||||||
|
|
||||||
|
public int mouseWheelX;
|
||||||
|
public int mouseWheelY;
|
||||||
|
|
||||||
@OriginalMember(owner = "client!ug", name = "mouseMoved", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
@OriginalMember(owner = "client!ug", name = "mouseMoved", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
||||||
@Override
|
@Override
|
||||||
public final synchronized void mouseMoved(@OriginalArg(0) MouseEvent arg0) {
|
public final synchronized void mouseMoved(@OriginalArg(0) MouseEvent arg0) {
|
||||||
if (Static93.aClass150_1 != null) {
|
if (Static93.instance != null) {
|
||||||
Static93.anInt2467 = 0;
|
Static93.anInt2467 = 0;
|
||||||
Static147.anInt3521 = arg0.getX();
|
Static147.anInt3521 = arg0.getX();
|
||||||
Static165.anInt4039 = arg0.getY();
|
Static165.anInt4039 = arg0.getY();
|
||||||
|
|
@ -24,25 +29,36 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
|
||||||
@OriginalMember(owner = "client!ug", name = "focusLost", descriptor = "(Ljava/awt/event/FocusEvent;)V")
|
@OriginalMember(owner = "client!ug", name = "focusLost", descriptor = "(Ljava/awt/event/FocusEvent;)V")
|
||||||
@Override
|
@Override
|
||||||
public final synchronized void focusLost(@OriginalArg(0) FocusEvent arg0) {
|
public final synchronized void focusLost(@OriginalArg(0) FocusEvent arg0) {
|
||||||
if (Static93.aClass150_1 != null) {
|
if (Static93.instance != null) {
|
||||||
Static57.anInt1759 = 0;
|
Static57.anInt1759 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OriginalMember(owner = "client!ug", name = "mouseDragged", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
@OriginalMember(owner = "client!ug", name = "mouseDragged", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
||||||
@Override
|
@Override
|
||||||
public final synchronized void mouseDragged(@OriginalArg(0) MouseEvent arg0) {
|
public final synchronized void mouseDragged(@OriginalArg(0) MouseEvent event) {
|
||||||
if (Static93.aClass150_1 != null) {
|
int x = event.getX();
|
||||||
|
int y = event.getY();
|
||||||
|
if (SwingUtilities.isMiddleMouseButton(event)) {
|
||||||
|
int accelX = this.mouseWheelX - x;
|
||||||
|
int accelY = this.mouseWheelY - y;
|
||||||
|
this.mouseWheelX = x;
|
||||||
|
this.mouseWheelY = y;
|
||||||
|
Static57.yawTarget += accelX * 2;
|
||||||
|
Static72.pitchTarget -= (accelY << 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Static93.instance != null) {
|
||||||
Static93.anInt2467 = 0;
|
Static93.anInt2467 = 0;
|
||||||
Static147.anInt3521 = arg0.getX();
|
Static147.anInt3521 = x;
|
||||||
Static165.anInt4039 = arg0.getY();
|
Static165.anInt4039 = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OriginalMember(owner = "client!ug", name = "mouseReleased", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
@OriginalMember(owner = "client!ug", name = "mouseReleased", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
||||||
@Override
|
@Override
|
||||||
public final synchronized void mouseReleased(@OriginalArg(0) MouseEvent arg0) {
|
public final synchronized void mouseReleased(@OriginalArg(0) MouseEvent arg0) {
|
||||||
if (Static93.aClass150_1 != null) {
|
if (Static93.instance != null) {
|
||||||
Static93.anInt2467 = 0;
|
Static93.anInt2467 = 0;
|
||||||
Static57.anInt1759 = 0;
|
Static57.anInt1759 = 0;
|
||||||
@Pc(14) int local14 = arg0.getModifiers();
|
@Pc(14) int local14 = arg0.getModifiers();
|
||||||
|
|
@ -73,20 +89,26 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
|
||||||
|
|
||||||
@OriginalMember(owner = "client!ug", name = "mousePressed", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
@OriginalMember(owner = "client!ug", name = "mousePressed", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
||||||
@Override
|
@Override
|
||||||
public final synchronized void mousePressed(@OriginalArg(0) MouseEvent arg0) {
|
public final synchronized void mousePressed(@OriginalArg(0) MouseEvent event) {
|
||||||
if (Static93.aClass150_1 != null) {
|
if (SwingUtilities.isMiddleMouseButton(event)) {
|
||||||
|
this.mouseWheelX = event.getX();
|
||||||
|
this.mouseWheelY = event.getY();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Static93.instance != null) {
|
||||||
Static93.anInt2467 = 0;
|
Static93.anInt2467 = 0;
|
||||||
Static34.anInt1034 = arg0.getX();
|
Static34.anInt1034 = event.getX();
|
||||||
Static222.anInt4973 = arg0.getY();
|
Static222.anInt4973 = event.getY();
|
||||||
Static209.aLong161 = MonotonicClock.currentTimeMillis();
|
Static209.aLong161 = MonotonicClock.currentTimeMillis();
|
||||||
if ((arg0.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == 0) {
|
if ((event.getModifiersEx() & MouseEvent.BUTTON3_DOWN_MASK) == 0) {
|
||||||
Static41.anInt1313 = 1;
|
Static41.anInt1313 = 1;
|
||||||
Static57.anInt1759 = 1;
|
Static57.anInt1759 = 1;
|
||||||
} else {
|
} else {
|
||||||
Static41.anInt1313 = 2;
|
Static41.anInt1313 = 2;
|
||||||
Static57.anInt1759 = 2;
|
Static57.anInt1759 = 2;
|
||||||
}
|
}
|
||||||
@Pc(29) int local29 = arg0.getModifiers();
|
@Pc(29) int local29 = event.getModifiers();
|
||||||
if ((local29 & 0x10) == 0) {
|
if ((local29 & 0x10) == 0) {
|
||||||
}
|
}
|
||||||
if ((local29 & 0x4) != 0) {
|
if ((local29 & 0x4) != 0) {
|
||||||
|
|
@ -94,15 +116,15 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
|
||||||
if ((local29 & 0x8) != 0) {
|
if ((local29 & 0x8) != 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arg0.isPopupTrigger()) {
|
if (event.isPopupTrigger()) {
|
||||||
arg0.consume();
|
event.consume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OriginalMember(owner = "client!ug", name = "mouseExited", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
@OriginalMember(owner = "client!ug", name = "mouseExited", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
||||||
@Override
|
@Override
|
||||||
public final synchronized void mouseExited(@OriginalArg(0) MouseEvent arg0) {
|
public final synchronized void mouseExited(@OriginalArg(0) MouseEvent arg0) {
|
||||||
if (Static93.aClass150_1 != null) {
|
if (Static93.instance != null) {
|
||||||
Static93.anInt2467 = 0;
|
Static93.anInt2467 = 0;
|
||||||
Static147.anInt3521 = -1;
|
Static147.anInt3521 = -1;
|
||||||
Static165.anInt4039 = -1;
|
Static165.anInt4039 = -1;
|
||||||
|
|
@ -112,7 +134,7 @@ public final class Mouse implements MouseListener, MouseMotionListener, FocusLis
|
||||||
@OriginalMember(owner = "client!ug", name = "mouseEntered", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
@OriginalMember(owner = "client!ug", name = "mouseEntered", descriptor = "(Ljava/awt/event/MouseEvent;)V")
|
||||||
@Override
|
@Override
|
||||||
public final synchronized void mouseEntered(@OriginalArg(0) MouseEvent arg0) {
|
public final synchronized void mouseEntered(@OriginalArg(0) MouseEvent arg0) {
|
||||||
if (Static93.aClass150_1 != null) {
|
if (Static93.instance != null) {
|
||||||
Static93.anInt2467 = 0;
|
Static93.anInt2467 = 0;
|
||||||
Static147.anInt3521 = arg0.getX();
|
Static147.anInt3521 = arg0.getX();
|
||||||
Static165.anInt4039 = arg0.getY();
|
Static165.anInt4039 = arg0.getY();
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,8 @@ public final class Static111 {
|
||||||
|
|
||||||
@OriginalMember(owner = "client!ii", name = "b", descriptor = "(I)V")
|
@OriginalMember(owner = "client!ii", name = "b", descriptor = "(I)V")
|
||||||
public static void handleMouse() {
|
public static void handleMouse() {
|
||||||
@Pc(2) Mouse local2 = Static93.aClass150_1;
|
@Pc(2) Mouse local2 = Static93.instance;
|
||||||
synchronized (Static93.aClass150_1) {
|
synchronized (Static93.instance) {
|
||||||
Static22.anInt723 = Static57.anInt1759;
|
Static22.anInt723 = Static57.anInt1759;
|
||||||
Static215.anInt4873 = Static147.anInt3521;
|
Static215.anInt4873 = Static147.anInt3521;
|
||||||
Static223.anInt5032 = Static165.anInt4039;
|
Static223.anInt5032 = Static165.anInt4039;
|
||||||
|
|
|
||||||
|
|
@ -161,9 +161,9 @@ public final class Static223 {
|
||||||
|
|
||||||
@OriginalMember(owner = "client!sc", name = "a", descriptor = "(ILjava/awt/Component;)V")
|
@OriginalMember(owner = "client!sc", name = "a", descriptor = "(ILjava/awt/Component;)V")
|
||||||
public static void method3866(@OriginalArg(1) Component arg0) {
|
public static void method3866(@OriginalArg(1) Component arg0) {
|
||||||
arg0.removeMouseListener(Static93.aClass150_1);
|
arg0.removeMouseListener(Static93.instance);
|
||||||
arg0.removeMouseMotionListener(Static93.aClass150_1);
|
arg0.removeMouseMotionListener(Static93.instance);
|
||||||
arg0.removeFocusListener(Static93.aClass150_1);
|
arg0.removeFocusListener(Static93.instance);
|
||||||
Static57.anInt1759 = 0;
|
Static57.anInt1759 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,10 @@ public final class Static251 {
|
||||||
|
|
||||||
@OriginalMember(owner = "client!ug", name = "a", descriptor = "(I)V")
|
@OriginalMember(owner = "client!ug", name = "a", descriptor = "(I)V")
|
||||||
public static void method4277() {
|
public static void method4277() {
|
||||||
if (Static93.aClass150_1 != null) {
|
if (Static93.instance != null) {
|
||||||
@Pc(5) Mouse local5 = Static93.aClass150_1;
|
@Pc(5) Mouse local5 = Static93.instance;
|
||||||
synchronized (Static93.aClass150_1) {
|
synchronized (Static93.instance) {
|
||||||
Static93.aClass150_1 = null;
|
Static93.instance = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ public final class Static48 {
|
||||||
|
|
||||||
@OriginalMember(owner = "client!dl", name = "a", descriptor = "(II)V")
|
@OriginalMember(owner = "client!dl", name = "a", descriptor = "(II)V")
|
||||||
public static void setIdleLoops(@OriginalArg(1) int arg0) {
|
public static void setIdleLoops(@OriginalArg(1) int arg0) {
|
||||||
@Pc(10) Mouse local10 = Static93.aClass150_1;
|
@Pc(10) Mouse local10 = Static93.instance;
|
||||||
synchronized (Static93.aClass150_1) {
|
synchronized (Static93.instance) {
|
||||||
Static93.anInt2467 = arg0;
|
Static93.anInt2467 = arg0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4147,8 +4147,8 @@ public final class Static88 {
|
||||||
|
|
||||||
@OriginalMember(owner = "client!h", name = "a", descriptor = "(Ljava/awt/Component;Z)V")
|
@OriginalMember(owner = "client!h", name = "a", descriptor = "(Ljava/awt/Component;Z)V")
|
||||||
public static void start(@OriginalArg(0) java.awt.Component arg0) {
|
public static void start(@OriginalArg(0) java.awt.Component arg0) {
|
||||||
arg0.addMouseListener(Static93.aClass150_1);
|
arg0.addMouseListener(Static93.instance);
|
||||||
arg0.addMouseMotionListener(Static93.aClass150_1);
|
arg0.addMouseMotionListener(Static93.instance);
|
||||||
arg0.addFocusListener(Static93.aClass150_1);
|
arg0.addFocusListener(Static93.instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public final class Static93 {
|
||||||
public static final HashTable aClass133_7 = new HashTable(16);
|
public static final HashTable aClass133_7 = new HashTable(16);
|
||||||
|
|
||||||
@OriginalMember(owner = "client!he", name = "bb", descriptor = "Lclient!ug;")
|
@OriginalMember(owner = "client!he", name = "bb", descriptor = "Lclient!ug;")
|
||||||
public static Mouse aClass150_1 = new Mouse();
|
public static Mouse instance = new Mouse();
|
||||||
|
|
||||||
@OriginalMember(owner = "client!he", name = "db", descriptor = "Lclient!na;")
|
@OriginalMember(owner = "client!he", name = "db", descriptor = "Lclient!na;")
|
||||||
public static final JagString aClass100_517 = Static28.parse("");
|
public static final JagString aClass100_517 = Static28.parse("");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue