Merge pull request #701 from Abextm/camera-sorry

Fix Perspective when near tall terain
This commit is contained in:
Adam
2018-02-26 08:42:15 -05:00
committed by GitHub
3 changed files with 21 additions and 7 deletions

View File

@@ -58,6 +58,9 @@ public interface Client extends GameEngine
int getCameraZ(); int getCameraZ();
/**
* This returns the actual pitch of the camera in JAUs
*/
int getCameraPitch(); int getCameraPitch();
int getCameraYaw(); int getCameraYaw();

View File

@@ -67,11 +67,11 @@ public abstract class CameraMixin implements RSClient
} }
} }
@FieldHook("cameraPitch") @FieldHook("cameraPitchTarget")
@Inject @Inject
static void onCameraPitchChanged(int idx) static void onCameraPitchChanged(int idx)
{ {
int newPitch = client.getCameraPitch(); int newPitch = client.getCameraPitchTarget();
int pitch = newPitch; int pitch = newPitch;
if (pitchRelaxEnabled) if (pitchRelaxEnabled)
{ {
@@ -83,7 +83,7 @@ public abstract class CameraMixin implements RSClient
{ {
pitch = NEW_PITCH_MAX; pitch = NEW_PITCH_MAX;
} }
client.setCameraPitch(pitch); client.setCameraPitchTarget(pitch);
} }
} }
lastPitch = pitch; lastPitch = pitch;
@@ -99,10 +99,10 @@ public abstract class CameraMixin implements RSClient
pitchRelaxEnabled = enabled; pitchRelaxEnabled = enabled;
if (!enabled) if (!enabled)
{ {
int pitch = client.getCameraPitch(); int pitch = client.getCameraPitchTarget();
if (pitch > STANDARD_PITCH_MAX) if (pitch > STANDARD_PITCH_MAX)
{ {
client.setCameraPitch(STANDARD_PITCH_MAX); client.setCameraPitchTarget(STANDARD_PITCH_MAX);
} }
} }
} }

View File

@@ -473,8 +473,19 @@ public interface RSClient extends RSGameEngine, Client
@Override @Override
RSPreferences getPreferences(); RSPreferences getPreferences();
@Import("cameraPitch") /**
void setCameraPitch(int pitch); * This is the pitch the user has set the camera to.
* It should be between 128 and (pitchUnlimiter?512:383) JAUs(1).
* The difference between this and cameraPitch is that cameraPitch has a lower limit, imposed by the surrounding
* terrain.
*
* (1) JAU - Jagex Angle Unit; 1/1024 of a revolution
*/
@Import("cameraPitchTarget")
int getCameraPitchTarget();
@Import("cameraPitchTarget")
void setCameraPitchTarget(int pitch);
@Import("renderOverview") @Import("renderOverview")
RSRenderOverview getRenderOverview(); RSRenderOverview getRenderOverview();