mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2026-09-10 18:46:43 -06:00
Add scrollwheel zoom :)
This commit is contained in:
parent
71d479a399
commit
443187fb60
5 changed files with 27 additions and 1 deletions
|
|
@ -68,6 +68,7 @@ public class Camera {
|
|||
public static boolean aBoolean205 = false;
|
||||
@OriginalMember(owner = "client!gk", name = "d", descriptor = "F")
|
||||
public static float aFloat10;
|
||||
public static int ZOOM = 600;
|
||||
|
||||
public static double mod(double a, double b) {
|
||||
return ((a % b) + b) % b;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import org.openrs2.deob.annotation.OriginalClass;
|
|||
import org.openrs2.deob.annotation.OriginalMember;
|
||||
import org.openrs2.deob.annotation.Pc;
|
||||
|
||||
import static rt4.MathUtils.clamp;
|
||||
|
||||
@OriginalClass("client!o")
|
||||
public final class JavaMouseWheel extends MouseWheel implements MouseWheelListener {
|
||||
|
||||
|
|
@ -31,7 +33,13 @@ public final class JavaMouseWheel extends MouseWheel implements MouseWheelListen
|
|||
@OriginalMember(owner = "client!o", name = "mouseWheelMoved", descriptor = "(Ljava/awt/event/MouseWheelEvent;)V")
|
||||
@Override
|
||||
public final synchronized void mouseWheelMoved(@OriginalArg(0) MouseWheelEvent arg0) {
|
||||
int previous = this.anInt4233;
|
||||
this.anInt4233 += arg0.getWheelRotation();
|
||||
int diff = this.anInt4233 - previous;
|
||||
|
||||
if (Keyboard.instance.isShiftPressed()) {
|
||||
Camera.ZOOM = clamp(200, 1200, Camera.ZOOM + (diff >= 0 ? 50: -50));
|
||||
}
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!o", name = "a", descriptor = "(Ljava/awt/Component;I)V")
|
||||
|
|
|
|||
|
|
@ -337,6 +337,19 @@ public final class Keyboard implements KeyListener, FocusListener {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isShiftPressed() {
|
||||
//I did this the Jagex(TM) way just for you Pazaz xoxo
|
||||
boolean isPressed = false;
|
||||
for (int keyCode : eventQueue) {
|
||||
if (keyCode == 81)
|
||||
isPressed = true;
|
||||
else if (keyCode == ~(81 & 0xFFFFFF7F))
|
||||
isPressed = false;
|
||||
}
|
||||
|
||||
return isPressed;
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!uf", name = "keyTyped", descriptor = "(Ljava/awt/event/KeyEvent;)V")
|
||||
@Override
|
||||
public final void keyTyped(@OriginalArg(0) KeyEvent event) {
|
||||
|
|
|
|||
|
|
@ -32,4 +32,8 @@ public final class MathUtils {
|
|||
cos[i] = (int) (Math.cos((double) i * 0.0030679615D) * 65536.0D);
|
||||
}
|
||||
}
|
||||
|
||||
public static int clamp(int min, int max, int value) {
|
||||
return Math.max(min, Math.min(max, value));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public final class Static253 {
|
|||
if (Static176.customCameraActive[4] && Camera.cameraAmplitude[4] + 128 > local59) {
|
||||
local59 = Camera.cameraAmplitude[4] + 128;
|
||||
}
|
||||
Static18.method555(Camera.cameraX, arg0, SceneGraph.getTileHeight(Player.level, PlayerList.self.xFine, PlayerList.self.zFine) - 50, 600 - -(local59 * 3), local57, Camera.cameraZ, local59);
|
||||
Static18.method555(Camera.cameraX, arg0, SceneGraph.getTileHeight(Player.level, PlayerList.self.xFine, PlayerList.self.zFine) - 50, Camera.ZOOM - -(local59 * 3), local57, Camera.cameraZ, local59);
|
||||
}
|
||||
local57 = Static5.anInt40;
|
||||
local59 = Camera.renderX;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue