Merge remote-tracking branch 'runelite/master' into 2009-merge
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.Entity;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Shape;
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.Perspective;
|
||||
import java.awt.geom.Area;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.rs.api.RSBoundaryObject;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSEntity;
|
||||
import net.runelite.rs.api.RSModel;
|
||||
|
||||
@Mixin(RSBoundaryObject.class)
|
||||
public abstract class RSBoundaryObjectMixin implements RSBoundaryObject
|
||||
@@ -34,9 +37,9 @@ public abstract class RSBoundaryObjectMixin implements RSBoundaryObject
|
||||
}
|
||||
|
||||
@Inject
|
||||
public Model getModelA()
|
||||
public RSModel getModelA()
|
||||
{
|
||||
Entity entity = getEntity1();
|
||||
RSEntity entity = getEntity1();
|
||||
if (entity == null)
|
||||
{
|
||||
return null;
|
||||
@@ -44,7 +47,7 @@ public abstract class RSBoundaryObjectMixin implements RSBoundaryObject
|
||||
|
||||
if (entity instanceof Model)
|
||||
{
|
||||
return (Model) entity;
|
||||
return (RSModel) entity;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -53,9 +56,9 @@ public abstract class RSBoundaryObjectMixin implements RSBoundaryObject
|
||||
}
|
||||
|
||||
@Inject
|
||||
public Model getModelB()
|
||||
public RSModel getModelB()
|
||||
{
|
||||
Entity entity = getEntity2();
|
||||
RSEntity entity = getEntity2();
|
||||
if (entity == null)
|
||||
{
|
||||
return null;
|
||||
@@ -63,7 +66,7 @@ public abstract class RSBoundaryObjectMixin implements RSBoundaryObject
|
||||
|
||||
if (entity instanceof Model)
|
||||
{
|
||||
return (Model) entity;
|
||||
return (RSModel) entity;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,12 +76,10 @@ public abstract class RSBoundaryObjectMixin implements RSBoundaryObject
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Area getClickbox()
|
||||
public Shape getClickbox()
|
||||
{
|
||||
Area clickbox = new Area();
|
||||
|
||||
Area clickboxA = Perspective.getClickbox(client, getModelA(), 0, getLocalLocation());
|
||||
Area clickboxB = Perspective.getClickbox(client, getModelB(), 0, getLocalLocation());
|
||||
Shape clickboxA = Perspective.getClickbox(client, getModelA(), 0, getLocalLocation());
|
||||
Shape clickboxB = Perspective.getClickbox(client, getModelB(), 0, getLocalLocation());
|
||||
|
||||
if (clickboxA == null && clickboxB == null)
|
||||
{
|
||||
@@ -87,14 +88,26 @@ public abstract class RSBoundaryObjectMixin implements RSBoundaryObject
|
||||
|
||||
if (clickboxA != null)
|
||||
{
|
||||
clickbox.add(clickboxA);
|
||||
return clickboxA;
|
||||
}
|
||||
|
||||
if (clickboxB != null)
|
||||
return clickboxB;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Polygon getConvexHull()
|
||||
{
|
||||
RSModel model = getModelA();
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
clickbox.add(clickboxB);
|
||||
return null;
|
||||
}
|
||||
|
||||
return clickbox;
|
||||
int tileHeight = Perspective.getTileHeight(client, new LocalPoint(getX(), getY()), client.getPlane());
|
||||
return model.getConvexHull(getX(), getY(), 0, tileHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Shape;
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Entity;
|
||||
import java.awt.geom.Area;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
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.RSEntity;
|
||||
import net.runelite.rs.api.RSFloorDecoration;
|
||||
import net.runelite.rs.api.RSModel;
|
||||
|
||||
@Mixin(RSFloorDecoration.class)
|
||||
public abstract class RSFloorDecorationMixin implements RSFloorDecoration
|
||||
@@ -35,9 +38,9 @@ public abstract class RSFloorDecorationMixin implements RSFloorDecoration
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Model getModel()
|
||||
public RSModel getModel()
|
||||
{
|
||||
Entity entity = getEntity();
|
||||
RSEntity entity = getEntity();
|
||||
if (entity == null)
|
||||
{
|
||||
return null;
|
||||
@@ -45,7 +48,7 @@ public abstract class RSFloorDecorationMixin implements RSFloorDecoration
|
||||
|
||||
if (entity instanceof Model)
|
||||
{
|
||||
return (Model) entity;
|
||||
return (RSModel) entity;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -53,9 +56,26 @@ public abstract class RSFloorDecorationMixin implements RSFloorDecoration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Area getClickbox()
|
||||
public Polygon getConvexHull()
|
||||
{
|
||||
RSModel model = getModel();
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int tileHeight = Perspective.getTileHeight(client, new LocalPoint(getX(), getY()), client.getPlane());
|
||||
return model.getConvexHull(getX(), getY(), 0, tileHeight);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Shape getClickbox()
|
||||
{
|
||||
return Perspective.getClickbox(client, getModel(), 0, getLocalLocation());
|
||||
}
|
||||
|
||||
@@ -25,10 +25,7 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import java.awt.Polygon;
|
||||
import java.awt.geom.Area;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.runelite.api.Model;
|
||||
import java.awt.Shape;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.Angle;
|
||||
@@ -36,8 +33,6 @@ import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.api.model.Triangle;
|
||||
import net.runelite.api.model.Vertex;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSEntity;
|
||||
import net.runelite.rs.api.RSGameObject;
|
||||
@@ -85,94 +80,11 @@ public abstract class RSGameObjectMixin implements RSGameObject
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Area getClickbox()
|
||||
public Shape getClickbox()
|
||||
{
|
||||
return Perspective.getClickbox(client, getModel(), getRsOrientation(), getLocalLocation());
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Polygon[] getPolygons()
|
||||
{
|
||||
Model model = getModel();
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int localX = getX();
|
||||
int localY = getY();
|
||||
|
||||
int orientation = getRsOrientation();
|
||||
|
||||
final int tileHeight = Perspective.getTileHeight(client, new LocalPoint(localX, localY), client.getPlane());
|
||||
|
||||
List<Triangle> triangles = model.getTriangles();
|
||||
|
||||
triangles = rotate(triangles, orientation);
|
||||
|
||||
List<Polygon> polys = new ArrayList<Polygon>();
|
||||
for (Triangle triangle : triangles)
|
||||
{
|
||||
Vertex vx = triangle.getA();
|
||||
Vertex vy = triangle.getB();
|
||||
Vertex vz = triangle.getC();
|
||||
|
||||
Point x = Perspective.localToCanvas(client,
|
||||
localX - vx.getX(),
|
||||
localY - vx.getZ(),
|
||||
tileHeight + vx.getY());
|
||||
|
||||
Point y = Perspective.localToCanvas(client,
|
||||
localX - vy.getX(),
|
||||
localY - vy.getZ(),
|
||||
tileHeight + vy.getY());
|
||||
|
||||
Point z = Perspective.localToCanvas(client,
|
||||
localX - vz.getX(),
|
||||
localY - vz.getZ(),
|
||||
tileHeight + vz.getY());
|
||||
|
||||
if (x == null || y == null || z == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int[] xx =
|
||||
{
|
||||
x.getX(), y.getX(), z.getX()
|
||||
};
|
||||
int[] yy =
|
||||
{
|
||||
x.getY(), y.getY(), z.getY()
|
||||
};
|
||||
polys.add(new Polygon(xx, yy, 3));
|
||||
}
|
||||
|
||||
return polys.toArray(new Polygon[0]);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private List<Triangle> rotate(List<Triangle> triangles, int orientation)
|
||||
{
|
||||
List<Triangle> rotatedTriangles = new ArrayList<Triangle>();
|
||||
for (Triangle triangle : triangles)
|
||||
{
|
||||
Vertex a = triangle.getA();
|
||||
Vertex b = triangle.getB();
|
||||
Vertex c = triangle.getC();
|
||||
|
||||
Triangle rotatedTriangle = new Triangle(
|
||||
a.rotate(orientation),
|
||||
b.rotate(orientation),
|
||||
c.rotate(orientation)
|
||||
);
|
||||
rotatedTriangles.add(rotatedTriangle);
|
||||
}
|
||||
return rotatedTriangles;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Polygon getConvexHull()
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package net.runelite.mixins;
|
||||
|
||||
import java.awt.Polygon;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.runelite.api.HeadIcon;
|
||||
import static net.runelite.api.HeadIcon.MAGIC;
|
||||
import static net.runelite.api.HeadIcon.MELEE;
|
||||
@@ -43,17 +46,14 @@ import static net.runelite.api.SkullIcon.DEAD_MAN_TWO;
|
||||
import static net.runelite.api.SkullIcon.SKULL;
|
||||
import static net.runelite.api.SkullIcon.SKULL_FIGHT_PIT;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.mixins.MethodHook;
|
||||
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.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.Triangle;
|
||||
import net.runelite.api.model.Vertex;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSModel;
|
||||
import net.runelite.rs.api.RSPlayer;
|
||||
@@ -169,28 +169,28 @@ public abstract class RSPlayerMixin implements RSPlayer
|
||||
System.err.println("vx: " + vx.getX() + " localX: " + localX);
|
||||
|
||||
Point x = Perspective.localToCanvas(client,
|
||||
localX - vx.getX(),
|
||||
localY - vx.getZ(),
|
||||
tileHeight + vx.getY());
|
||||
localX - vx.getX(),
|
||||
localY - vx.getZ(),
|
||||
tileHeight + vx.getY());
|
||||
|
||||
Point y = Perspective.localToCanvas(client,
|
||||
localX - vy.getX(),
|
||||
localY - vy.getZ(),
|
||||
tileHeight + vy.getY());
|
||||
localX - vy.getX(),
|
||||
localY - vy.getZ(),
|
||||
tileHeight + vy.getY());
|
||||
|
||||
Point z = Perspective.localToCanvas(client,
|
||||
localX - vz.getX(),
|
||||
localY - vz.getZ(),
|
||||
tileHeight + vz.getY());
|
||||
localX - vz.getX(),
|
||||
localY - vz.getZ(),
|
||||
tileHeight + vz.getY());
|
||||
|
||||
int[] xx =
|
||||
{
|
||||
x.getX(), y.getX(), z.getX()
|
||||
};
|
||||
{
|
||||
x.getX(), y.getX(), z.getX()
|
||||
};
|
||||
int[] yy =
|
||||
{
|
||||
x.getY(), y.getY(), z.getY()
|
||||
};
|
||||
{
|
||||
x.getY(), y.getY(), z.getY()
|
||||
};
|
||||
polys.add(new Polygon(xx, yy, 3));
|
||||
}
|
||||
|
||||
@@ -222,9 +222,9 @@ public abstract class RSPlayerMixin implements RSPlayer
|
||||
Vertex c = triangle.getC();
|
||||
|
||||
Triangle rotatedTriangle = new Triangle(
|
||||
a.rotate(orientation),
|
||||
b.rotate(orientation),
|
||||
c.rotate(orientation)
|
||||
a.rotate(orientation),
|
||||
b.rotate(orientation),
|
||||
c.rotate(orientation)
|
||||
);
|
||||
rotatedTriangles.add(rotatedTriangle);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.Area;
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.geom.Area;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
@@ -86,14 +87,14 @@ public abstract class RSWallDecorationMixin implements RSWallDecoration
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Area getClickbox()
|
||||
public Shape getClickbox()
|
||||
{
|
||||
Area clickbox = new Area();
|
||||
|
||||
LocalPoint lp = getLocalLocation();
|
||||
Area clickboxA = Perspective.getClickbox(client, getModel1(), 0,
|
||||
Shape clickboxA = Perspective.getClickbox(client, getModel1(), 0,
|
||||
new LocalPoint(lp.getX() + getXOffset(), lp.getY() + getYOffset()));
|
||||
Area clickboxB = Perspective.getClickbox(client, getModel2(), 0, lp);
|
||||
Shape clickboxB = Perspective.getClickbox(client, getModel2(), 0, lp);
|
||||
|
||||
if (clickboxA == null && clickboxB == null)
|
||||
{
|
||||
@@ -102,15 +103,10 @@ public abstract class RSWallDecorationMixin implements RSWallDecoration
|
||||
|
||||
if (clickboxA != null)
|
||||
{
|
||||
clickbox.add(clickboxA);
|
||||
return clickboxA;
|
||||
}
|
||||
|
||||
if (clickboxB != null)
|
||||
{
|
||||
clickbox.add(clickboxB);
|
||||
}
|
||||
|
||||
return clickbox;
|
||||
return clickboxB;
|
||||
}
|
||||
|
||||
@Inject
|
||||
|
||||
Reference in New Issue
Block a user