zoom plugin: fix range bounds for ctrl zoom value config

Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
Ryan
2019-07-25 11:54:49 -04:00
committed by Adam
parent c801c05551
commit d5bf137ca7
2 changed files with 9 additions and 9 deletions

View File

@@ -34,6 +34,12 @@ public interface ZoomConfig extends Config
{
int OUTER_LIMIT_MIN = -400;
int OUTER_LIMIT_MAX = 400;
/**
* The largest (most zoomed in) value that can be used without the client crashing.
*
* Larger values trigger an overflow in the engine's fov to scale code.
*/
int INNER_ZOOM_LIMIT = 1004;
@ConfigItem(
keyName = "inner",
@@ -91,7 +97,7 @@ public interface ZoomConfig extends Config
)
@Range(
min = OUTER_LIMIT_MIN,
max = OUTER_LIMIT_MAX
max = INNER_ZOOM_LIMIT
)
default int ctrlZoomValue()
{

View File

@@ -50,12 +50,6 @@ import net.runelite.client.plugins.PluginDescriptor;
)
public class ZoomPlugin extends Plugin implements KeyListener
{
/**
* The largest (most zoomed in) value that can be used without the client crashing.
*
* Larger values trigger an overflow in the engine's fov to scale code.
*/
private static final int INNER_ZOOM_LIMIT = 1004;
private static final int DEFAULT_ZOOM_INCREMENT = 25;
private boolean controlDown;
@@ -98,7 +92,7 @@ public class ZoomPlugin extends Plugin implements KeyListener
if ("innerZoomLimit".equals(event.getEventName()) && zoomConfig.innerLimit())
{
intStack[intStackSize - 1] = INNER_ZOOM_LIMIT;
intStack[intStackSize - 1] = ZoomConfig.INNER_ZOOM_LIMIT;
return;
}
@@ -195,7 +189,7 @@ public class ZoomPlugin extends Plugin implements KeyListener
if (zoomConfig.controlFunction() == ControlFunction.CONTROL_TO_RESET)
{
final int zoomValue = Ints.constrainToRange(zoomConfig.ctrlZoomValue(), zoomConfig.OUTER_LIMIT_MIN, INNER_ZOOM_LIMIT);
final int zoomValue = Ints.constrainToRange(zoomConfig.ctrlZoomValue(), ZoomConfig.OUTER_LIMIT_MIN, ZoomConfig.INNER_ZOOM_LIMIT);
clientThread.invokeLater(() -> client.runScript(ScriptID.CAMERA_DO_ZOOM, zoomValue, zoomValue));
}
}