Checkstyle fixes
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSModel;
|
||||
|
||||
/**
|
||||
* Class to check clickboxes of models. Mostly refactored code from the client.
|
||||
@@ -14,19 +11,40 @@ import net.runelite.rs.api.RSModel;
|
||||
@Mixin(RSClient.class)
|
||||
public abstract class ClickboxMixin implements RSClient
|
||||
{
|
||||
@Shadow("client")
|
||||
private static RSClient client;
|
||||
|
||||
private static final int MAX_ENTITES_AT_MOUSE = 1000;
|
||||
private static final int CLICKBOX_CLOSE = 50;
|
||||
private static final int CLICKBOX_FAR = 10000;
|
||||
private static final int OBJECT_INTERACTION_FAR = 100; // Max distance, in tiles, from camera
|
||||
|
||||
@Inject
|
||||
private static final int[] rl$modelViewportXs = new int[4700];
|
||||
|
||||
@Inject
|
||||
private static final int[] rl$modelViewportYs = new int[4700];
|
||||
@Shadow("client")
|
||||
private static RSClient client;
|
||||
|
||||
@Inject
|
||||
private static int rl$rot1(int var0, int var1, int var2, int var3)
|
||||
{
|
||||
return var0 * var2 + var3 * var1 >> 16;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private static int rl$rot2(int var0, int var1, int var2, int var3)
|
||||
{
|
||||
return var2 * var1 - var3 * var0 >> 16;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private static int rl$rot3(int var0, int var1, int var2, int var3)
|
||||
{
|
||||
return var0 * var2 - var3 * var1 >> 16;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private static int rl$rot4(int var0, int var1, int var2, int var3)
|
||||
{
|
||||
return var3 * var0 + var2 * var1 >> 16;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void checkClickbox(net.runelite.api.Model model, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, long l2)
|
||||
@@ -118,11 +136,8 @@ public abstract class ClickboxMixin implements RSClient
|
||||
int n28 = rl$modelViewportXs[n12];
|
||||
int n29 = rl$modelViewportXs[n10];
|
||||
int n30 = rl$modelViewportXs[n24];
|
||||
if (n25 != -5000 && n26 != -5000 && n27 != -5000 && (bl5 = (n23 = (n22 = rSModel.isClickable() ? 20
|
||||
: 5) + n11) < n28 && n23 < n29 && n23 < n30 ? false
|
||||
: ((n23 = n11 - n22) > n28 && n23 > n29 && n23 > n30 ? false
|
||||
: ((n23 = n22 + n14) < n25 && n23 < n26 && n23 < n27 ? false
|
||||
: (n23 = n14 - n22) <= n25 || n23 <= n26 || n23 <= n27))))
|
||||
if (n25 != -5000 && n26 != -5000 && n27 != -5000 && (bl5 = ((n23 = (n22 = rSModel.isClickable() ? 20
|
||||
: 5) + n11) >= n28 || n23 >= n29 || n23 >= n30) && (((n23 = n11 - n22) <= n28 || n23 <= n29 || n23 <= n30) && (((n23 = n22 + n14) >= n25 || n23 >= n26 || n23 >= n27) && ((n23 = n14 - n22) <= n25 || n23 <= n26 || n23 <= n27)))))
|
||||
{
|
||||
this.addHashAtMouse(l2);
|
||||
return;
|
||||
@@ -211,34 +226,6 @@ public abstract class ClickboxMixin implements RSClient
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Math.abs(n39 * n23 - n38 * n24) <= n33 * n26 + n32 * n27)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private static int rl$rot1(int var0, int var1, int var2, int var3)
|
||||
{
|
||||
return var0 * var2 + var3 * var1 >> 16;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private static int rl$rot2(int var0, int var1, int var2, int var3)
|
||||
{
|
||||
return var2 * var1 - var3 * var0 >> 16;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private static int rl$rot3(int var0, int var1, int var2, int var3)
|
||||
{
|
||||
return var0 * var2 - var3 * var1 >> 16;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private static int rl$rot4(int var0, int var1, int var2, int var3)
|
||||
{
|
||||
return var3 * var0 + var2 * var1 >> 16;
|
||||
return Math.abs(n39 * n23 - n38 * n24) <= n33 * n26 + n32 * n27;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,21 +24,21 @@
|
||||
*/
|
||||
package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.model.Jarvis;
|
||||
import net.runelite.api.model.Triangle;
|
||||
import net.runelite.api.model.Vertex;
|
||||
import java.awt.Polygon;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.mixins.Copy;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.MethodHook;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Replace;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.api.model.Jarvis;
|
||||
import net.runelite.api.model.Triangle;
|
||||
import net.runelite.api.model.Vertex;
|
||||
import net.runelite.rs.api.RSAnimation;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSFrames;
|
||||
@@ -77,9 +77,112 @@ public abstract class RSModelMixin implements RSModel
|
||||
}
|
||||
|
||||
@Inject
|
||||
public boolean isClickable() {
|
||||
public boolean isClickable()
|
||||
{
|
||||
return isClickable;
|
||||
};
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void interpolateFrames(RSFrames frames, int frameId, RSFrames nextFrames, int nextFrameId, int interval, int intervalCount)
|
||||
{
|
||||
if (getVertexGroups() != null)
|
||||
{
|
||||
if (frameId != -1)
|
||||
{
|
||||
RSAnimation frame = frames.getFrames()[frameId];
|
||||
RSSkeleton skin = frame.getSkin();
|
||||
RSAnimation nextFrame = null;
|
||||
if (nextFrames != null)
|
||||
{
|
||||
nextFrame = nextFrames.getFrames()[nextFrameId];
|
||||
if (nextFrame.getSkin() != skin)
|
||||
{
|
||||
nextFrame = null;
|
||||
}
|
||||
}
|
||||
|
||||
client.setAnimOffsetX(0);
|
||||
client.setAnimOffsetY(0);
|
||||
client.setAnimOffsetZ(0);
|
||||
|
||||
interpolateFrames(skin, frame, nextFrame, interval, intervalCount);
|
||||
resetBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Inject
|
||||
public Polygon getConvexHull(int localX, int localY, int orientation, int tileHeight)
|
||||
{
|
||||
List<Vertex> vertices = getVertices();
|
||||
|
||||
// rotate vertices
|
||||
for (int i = 0; i < vertices.size(); ++i)
|
||||
{
|
||||
Vertex v = vertices.get(i);
|
||||
vertices.set(i, v.rotate(orientation));
|
||||
}
|
||||
|
||||
List<Point> points = new ArrayList<Point>();
|
||||
|
||||
for (Vertex v : vertices)
|
||||
{
|
||||
// Compute canvas location of vertex
|
||||
Point p = Perspective.localToCanvas(client,
|
||||
localX - v.getX(),
|
||||
localY - v.getZ(),
|
||||
tileHeight + v.getY());
|
||||
if (p != null)
|
||||
{
|
||||
points.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
// Run Jarvis march algorithm
|
||||
points = Jarvis.convexHull(points);
|
||||
if (points == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Convert to a polygon
|
||||
Polygon p = new Polygon();
|
||||
for (Point point : points)
|
||||
{
|
||||
p.addPoint(point.getX(), point.getY());
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public float[][] getFaceTextureUCoordinates()
|
||||
{
|
||||
return rl$faceTextureUCoordinates;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setFaceTextureUCoordinates(float[][] faceTextureUCoordinates)
|
||||
{
|
||||
this.rl$faceTextureUCoordinates = faceTextureUCoordinates;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public float[][] getFaceTextureVCoordinates()
|
||||
{
|
||||
return rl$faceTextureVCoordinates;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setFaceTextureVCoordinates(float[][] faceTextureVCoordinates)
|
||||
{
|
||||
this.rl$faceTextureVCoordinates = faceTextureVCoordinates;
|
||||
}
|
||||
|
||||
@MethodHook(value = "<init>", end = true)
|
||||
@Inject
|
||||
@@ -174,6 +277,48 @@ public abstract class RSModelMixin implements RSModel
|
||||
return triangles;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getSceneId()
|
||||
{
|
||||
return rl$sceneId;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setSceneId(int sceneId)
|
||||
{
|
||||
this.rl$sceneId = sceneId;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getBufferOffset()
|
||||
{
|
||||
return rl$bufferOffset;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setBufferOffset(int bufferOffset)
|
||||
{
|
||||
rl$bufferOffset = bufferOffset;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getUvBufferOffset()
|
||||
{
|
||||
return rl$uvBufferOffset;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setUvBufferOffset(int bufferOffset)
|
||||
{
|
||||
rl$uvBufferOffset = bufferOffset;
|
||||
}
|
||||
|
||||
@Copy("contourGround")
|
||||
public abstract Model rs$contourGround(int[][] tileHeights, int packedX, int height, int packedY, boolean copy, int contouredGround);
|
||||
|
||||
@@ -201,36 +346,6 @@ public abstract class RSModelMixin implements RSModel
|
||||
rsModel.setFaceTextureVCoordinates(rl$faceTextureVCoordinates);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void interpolateFrames(RSFrames frames, int frameId, RSFrames nextFrames, int nextFrameId, int interval,
|
||||
int intervalCount)
|
||||
{
|
||||
if (getVertexGroups() != null)
|
||||
{
|
||||
if (frameId != -1)
|
||||
{
|
||||
RSAnimation frame = frames.getFrames()[frameId];
|
||||
RSSkeleton skin = frame.getSkin();
|
||||
RSAnimation nextFrame = null;
|
||||
if (nextFrames != null)
|
||||
{
|
||||
nextFrame = nextFrames.getFrames()[nextFrameId];
|
||||
if (nextFrame.getSkin() != skin)
|
||||
{
|
||||
nextFrame = null;
|
||||
}
|
||||
}
|
||||
|
||||
client.setAnimOffsetX(0);
|
||||
client.setAnimOffsetY(0);
|
||||
client.setAnimOffsetZ(0);
|
||||
|
||||
interpolateFrames(skin, frame, nextFrame, interval, intervalCount);
|
||||
resetBounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void interpolateFrames(RSSkeleton skin, RSAnimation frame, RSAnimation nextFrame, int interval, int intervalCount)
|
||||
{
|
||||
@@ -334,119 +449,4 @@ public abstract class RSModelMixin implements RSModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Inject
|
||||
public Polygon getConvexHull(int localX, int localY, int orientation, int tileHeight)
|
||||
{
|
||||
List<Vertex> vertices = getVertices();
|
||||
|
||||
// rotate vertices
|
||||
for (int i = 0; i < vertices.size(); ++i)
|
||||
{
|
||||
Vertex v = vertices.get(i);
|
||||
vertices.set(i, v.rotate(orientation));
|
||||
}
|
||||
|
||||
List<Point> points = new ArrayList<Point>();
|
||||
|
||||
for (Vertex v : vertices)
|
||||
{
|
||||
// Compute canvas location of vertex
|
||||
Point p = Perspective.localToCanvas(client,
|
||||
localX - v.getX(),
|
||||
localY - v.getZ(),
|
||||
tileHeight + v.getY());
|
||||
if (p != null)
|
||||
{
|
||||
points.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
// Run Jarvis march algorithm
|
||||
points = Jarvis.convexHull(points);
|
||||
if (points == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Convert to a polygon
|
||||
Polygon p = new Polygon();
|
||||
for (Point point : points)
|
||||
{
|
||||
p.addPoint(point.getX(), point.getY());
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getSceneId()
|
||||
{
|
||||
return rl$sceneId;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setSceneId(int sceneId)
|
||||
{
|
||||
this.rl$sceneId = sceneId;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getBufferOffset()
|
||||
{
|
||||
return rl$bufferOffset;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setBufferOffset(int bufferOffset)
|
||||
{
|
||||
rl$bufferOffset = bufferOffset;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getUvBufferOffset()
|
||||
{
|
||||
return rl$uvBufferOffset;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setUvBufferOffset(int bufferOffset)
|
||||
{
|
||||
rl$uvBufferOffset = bufferOffset;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public float[][] getFaceTextureUCoordinates()
|
||||
{
|
||||
return rl$faceTextureUCoordinates;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setFaceTextureUCoordinates(float[][] faceTextureUCoordinates)
|
||||
{
|
||||
this.rl$faceTextureUCoordinates = faceTextureUCoordinates;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public float[][] getFaceTextureVCoordinates()
|
||||
{
|
||||
return rl$faceTextureVCoordinates;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setFaceTextureVCoordinates(float[][] faceTextureVCoordinates)
|
||||
{
|
||||
this.rl$faceTextureVCoordinates = faceTextureVCoordinates;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user