mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2026-08-28 05:45:15 -06:00
Merge pull request #5 from Ceikry/scrollwheel-zoom
Find + Refactor Camera Zoom Var + Add Scrollwheel Zoom :)
This commit is contained in:
commit
5792a3c92b
7 changed files with 33 additions and 5 deletions
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"ip_management": "test.2009scape.org",
|
||||
"ip_address": "test.2009scape.org",
|
||||
"ip_management": "localhost",
|
||||
"ip_address": "localhost",
|
||||
"world": 1,
|
||||
"server_port": 43594,
|
||||
"wl_port": 5555,
|
||||
"js5_port": 43593
|
||||
"wl_port": 43595,
|
||||
"js5_port": 43595,
|
||||
"mouseWheelZoom": true
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -25,4 +25,5 @@ public class GlobalJsonConfig {
|
|||
int server_port;
|
||||
int wl_port;
|
||||
int js5_port;
|
||||
boolean mouseWheelZoom;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 (GlobalJsonConfig.instance.mouseWheelZoom && 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