diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index b2f418f65c..c96a8d360e 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -176,7 +176,6 @@ public interface Client extends GameEngine List getProjectiles(); - /** * Play a sound effect at the player's current location. * This is how UI, and player-generated (e.g. mining, woodcutting) sound effects are normally played @@ -195,6 +194,45 @@ public interface Client extends GameEngine */ void playSoundEffect(int id, int x, int y, int range); + boolean getDrawBoundingBoxes2D(); + + /** + * When {@code shouldDraw} is true, a 2D bounding box will be drawn for all on-screen objects + * + * @param shouldDraw whether or not to draw 2D bounding boxes + */ + void setDrawBoundingBoxes2D(boolean shouldDraw); + + boolean getDrawBoundingBoxes3D(); + + /** + * When {@code shouldDraw} is true, 3D bounding boxes will be drawn + * either for the object under the cursor, or every object on screen + * according to {@link #setBoundingBoxAlwaysOnMode(boolean) BoundingBoxAlwaysOnMode} + * + * @param shouldDraw whether or not to draw 3D bounding boxes + */ + void setDrawBoundingBoxes3D(boolean shouldDraw); + + boolean getdrawObjectGeometry2D(); + + /** + * When {@code shouldDraw} is true, the clickbox geometry for the object under the cursor will be displayed + * + * @param shouldDraw whether or not to draw the clickbox geometry + */ + void setdrawObjectGeometry2D(boolean shouldDraw); + + boolean getBoundingBoxAlwaysOnMode(); + + /** + * Changes how {@link #getDrawBoundingBoxes3D()} behaves when active. + * When {@code alwaysDrawBoxes} is true, 3D bounding boxes will be drawn. + * When false, a 3D bounding box will only be drawn for the object under the cursor + * + * @param alwaysDrawBoxes whether or not to draw every 3D bounding box, when 3D bounding boxes are enabled + */ + void setBoundingBoxAlwaysOnMode(boolean alwaysDrawBoxes); BufferProvider getBufferProvider(); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index b29ea0fed8..bc0b642336 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -375,6 +375,27 @@ public abstract class RSClientMixin implements RSClient return new Point(getDestinationX(), getDestinationY()); } + @Inject + @Override + public boolean getBoundingBoxAlwaysOnMode() + { + return getboundingBox3DDrawMode() == getALWAYSDrawMode(); + } + + @Inject + @Override + public void setBoundingBoxAlwaysOnMode(boolean alwaysDrawBoxes) + { + if (alwaysDrawBoxes) + { + setboundingBox3DDrawMode(getALWAYSDrawMode()); + } + else + { + setboundingBox3DDrawMode(getON_MOUSEOVERDrawMode()); + } + } + @FieldHook("skillExperiences") @Inject public static void experiencedChanged(int idx) diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSBoundingBox3DDrawMode.java b/runescape-api/src/main/java/net/runelite/rs/api/RSBoundingBox3DDrawMode.java new file mode 100644 index 0000000000..c17bae9597 --- /dev/null +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSBoundingBox3DDrawMode.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018, SomeoneWithAnInternetConnection + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.rs.api; + +public interface RSBoundingBox3DDrawMode +{ + +} diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index 1ce5e8a8ea..bf3f5d04fa 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -373,6 +373,42 @@ public interface RSClient extends RSGameEngine, Client @Import("queuedSoundEffectCount") void setQueuedSoundEffectCount(int queuedSoundEffectCount); + @Import("drawBoundingBoxes2D") + @Override + boolean getDrawBoundingBoxes2D(); + + @Import("drawBoundingBoxes2D") + @Override + void setDrawBoundingBoxes2D(boolean shouldDraw); + + @Import("drawBoundingBoxes3D") + @Override + boolean getDrawBoundingBoxes3D(); + + @Import("drawBoundingBoxes3D") + @Override + void setDrawBoundingBoxes3D(boolean shouldDraw); + + @Import("drawObjectGeometry2D") + @Override + boolean getdrawObjectGeometry2D(); + + @Import("drawObjectGeometry2D") + @Override + void setdrawObjectGeometry2D(boolean shouldDraw); + + @Import("boundingBox3DDrawMode") + RSBoundingBox3DDrawMode getboundingBox3DDrawMode(); + + @Import("boundingBox3DDrawMode") + void setboundingBox3DDrawMode(RSBoundingBox3DDrawMode drawMode); + + @Import("ON_MOUSEOVER") + RSBoundingBox3DDrawMode getON_MOUSEOVERDrawMode(); + + @Import("ALWAYS") + RSBoundingBox3DDrawMode getALWAYSDrawMode(); + @Import("rasterProvider") @Override BufferProvider getBufferProvider();