@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.mixins;
|
package net.runelite.mixins;
|
||||||
|
|
||||||
|
import net.runelite.api.Perspective;
|
||||||
import net.runelite.api.mixins.FieldHook;
|
import net.runelite.api.mixins.FieldHook;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
@@ -39,34 +40,35 @@ public abstract class CameraMixin implements RSClient
|
|||||||
@Shadow("clientInstance")
|
@Shadow("clientInstance")
|
||||||
static RSClient client;
|
static RSClient client;
|
||||||
|
|
||||||
|
@Shadow("isDrawingRegion")
|
||||||
|
static boolean isDrawingRegion;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
static boolean pitchRelaxEnabled = false;
|
static boolean pitchRelaxEnabled = false;
|
||||||
|
|
||||||
@Shadow("visibilityMaps")
|
|
||||||
static boolean[][][][] visibilityMaps;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
static int lastPitch = 128;
|
static int lastPitch = 128;
|
||||||
|
|
||||||
static
|
|
||||||
|
@Inject
|
||||||
|
public void setCameraPitchRelaxerEnabled(boolean enabled)
|
||||||
{
|
{
|
||||||
// The first index is pitch. In the default client it is 9, here it is 13 because we increase the pitch limit
|
if (pitchRelaxEnabled == enabled)
|
||||||
visibilityMaps = new boolean[13][35][53][53];
|
|
||||||
for (boolean[][][] z : visibilityMaps)
|
|
||||||
{
|
{
|
||||||
for (boolean[][] y : z)
|
return;
|
||||||
|
}
|
||||||
|
pitchRelaxEnabled = enabled;
|
||||||
|
if (!enabled)
|
||||||
|
{
|
||||||
|
int pitch = client.getCameraPitchTarget();
|
||||||
|
if (pitch > STANDARD_PITCH_MAX)
|
||||||
{
|
{
|
||||||
for (boolean[] x : y)
|
client.setCameraPitchTarget(STANDARD_PITCH_MAX);
|
||||||
{
|
|
||||||
for (int i = 0; i < x.length; i++)
|
|
||||||
{
|
|
||||||
x[i] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@FieldHook("cameraPitchTarget")
|
@FieldHook("cameraPitchTarget")
|
||||||
@Inject
|
@Inject
|
||||||
static void onCameraPitchChanged(int idx)
|
static void onCameraPitchChanged(int idx)
|
||||||
@@ -89,21 +91,26 @@ public abstract class CameraMixin implements RSClient
|
|||||||
lastPitch = pitch;
|
lastPitch = pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All of this is to bypass a check in Region.drawRegion
|
||||||
|
|
||||||
|
@FieldHook("pitchSin")
|
||||||
@Inject
|
@Inject
|
||||||
public void setCameraPitchRelaxerEnabled(boolean enabled)
|
static void onPitchSinChanged(int idx)
|
||||||
{
|
{
|
||||||
if (pitchRelaxEnabled == enabled)
|
if (pitchRelaxEnabled && isDrawingRegion)
|
||||||
{
|
{
|
||||||
return;
|
client.setPitchSin(Perspective.SINE[client.getCameraPitch()]);
|
||||||
}
|
}
|
||||||
pitchRelaxEnabled = enabled;
|
}
|
||||||
if (!enabled)
|
|
||||||
|
|
||||||
|
@FieldHook("pitchCos")
|
||||||
|
@Inject
|
||||||
|
static void onPitchCosChanged(int idx)
|
||||||
|
{
|
||||||
|
if (pitchRelaxEnabled && isDrawingRegion)
|
||||||
{
|
{
|
||||||
int pitch = client.getCameraPitchTarget();
|
client.setPitchCos(Perspective.COSINE[client.getCameraPitch()]);
|
||||||
if (pitch > STANDARD_PITCH_MAX)
|
|
||||||
{
|
|
||||||
client.setCameraPitchTarget(STANDARD_PITCH_MAX);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Abex
|
||||||
|
* 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.mixins;
|
||||||
|
|
||||||
|
import net.runelite.api.mixins.Copy;
|
||||||
|
import net.runelite.api.mixins.Inject;
|
||||||
|
import net.runelite.api.mixins.Mixin;
|
||||||
|
import net.runelite.api.mixins.Replace;
|
||||||
|
import net.runelite.rs.api.RSRegion;
|
||||||
|
|
||||||
|
@Mixin(RSRegion.class)
|
||||||
|
public abstract class RSRegionMixin implements RSRegion
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
static boolean isDrawingRegion;
|
||||||
|
|
||||||
|
@Copy("drawRegion")
|
||||||
|
abstract void rs$drawRegion(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane);
|
||||||
|
|
||||||
|
@Replace("drawRegion")
|
||||||
|
void rl$drawRegion(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
isDrawingRegion = true;
|
||||||
|
rs$drawRegion(cameraX, cameraY, cameraZ, cameraPitch, cameraYaw, plane);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
isDrawingRegion = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -487,6 +487,12 @@ public interface RSClient extends RSGameEngine, Client
|
|||||||
@Import("cameraPitchTarget")
|
@Import("cameraPitchTarget")
|
||||||
void setCameraPitchTarget(int pitch);
|
void setCameraPitchTarget(int pitch);
|
||||||
|
|
||||||
|
@Import("pitchSin")
|
||||||
|
void setPitchSin(int v);
|
||||||
|
|
||||||
|
@Import("pitchCos")
|
||||||
|
void setPitchCos(int v);
|
||||||
|
|
||||||
@Import("renderOverview")
|
@Import("renderOverview")
|
||||||
RSRenderOverview getRenderOverview();
|
RSRenderOverview getRenderOverview();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user