diff --git a/Source/ActorPickNode.cpp b/Source/ActorPickNode.cpp index d7141704..803875c8 100644 --- a/Source/ActorPickNode.cpp +++ b/Source/ActorPickNode.cpp @@ -239,9 +239,7 @@ void CView::Update() { this->camera.desiredTarget[0] = position.x; this->camera.desiredTarget[1] = position.y; this->camera.desiredTarget[2] = position.z; - const float rendererScale = g_renderer->UiScaleY(); - CameraProjectionOutputs outputs{g_tangent, g_cotangent, g_cameraScaleY, g_cameraScaleX}; - this->camera.Smooth(g_serviceOptions, rendererScale, g_projectionScale, g_cameraBaseDistance, outputs); + this->camera.Smooth(); this->shake.Apply(this->camera, g_worldViewDrawn); const TerrainHeight terrain = static_cast(g_modeMgr.GetGameMode())->scene->terrain->Grid(); this->frame.Refresh(this->camera, terrain, *g_renderer); diff --git a/Source/Contents/Camera/Camera.h b/Source/Contents/Camera/Camera.h index 4f0e3016..261c6962 100644 --- a/Source/Contents/Camera/Camera.h +++ b/Source/Contents/Camera/Camera.h @@ -13,6 +13,7 @@ class CSkyBox; extern float g_cameraDistance; extern float g_cameraMinDistance; extern float g_cameraBaseDistance; +extern float g_projectionScale; extern float g_cameraPitch; extern float g_indoorCameraPitch; extern float g_indoorCameraDistance; diff --git a/Source/Contents/Camera/CameraSmoothing.cpp b/Source/Contents/Camera/CameraSmoothing.cpp index 58e7de62..273effc2 100644 --- a/Source/Contents/Camera/CameraSmoothing.cpp +++ b/Source/Contents/Camera/CameraSmoothing.cpp @@ -1,5 +1,9 @@ +#include "Contents/Camera/Camera.h" #include "Contents/Camera/CameraState.h" #include "Contents/Configuration/ServiceOptions.h" +#include "Render/Projection/RendererViewport.h" +#include "Render/Renderer.h" +#include "Render/SpriteGeometry.h" #include "Utility/Math/AffineMatrix.h" #include "Utility/Math/ScalarConversion.h" @@ -23,9 +27,7 @@ void CameraState::AddYaw(float delta) { // OFFSET: 0x00ADBCD0 // FUNCTION: fn_17926 -void CameraState::Smooth( - const ServiceOptions& options, const float& rendererScale, const float& projectionScale, const float& baseDistance, CameraProjectionOutputs& output -) { +void CameraState::Smooth() { while (this->desiredYaw >= 360.0f) { this->desiredYaw = this->desiredYaw - 360.0f; } @@ -56,7 +58,7 @@ void CameraState::Smooth( this->pitch = (this->desiredPitch - this->pitch) / 10.0f + this->pitch; this->distance = (this->desiredDistance - this->distance) / 10.0f + this->distance; - const bool immediate = options.Get(54) != 0; + const bool immediate = g_serviceOptions.Get(54) != 0; float next[3] = {this->desiredTarget[0], this->desiredTarget[1], this->desiredTarget[2]}; if (!immediate) { @@ -73,11 +75,11 @@ void CameraState::Smooth( const float cosine = ClientCosine(angle); const float tangent = static_cast(static_cast(sine) / cosine); const float cotangent = static_cast(static_cast(cosine) / sine); - const float scaledTangent = tangent * projectionScale; - output.tangent = static_cast(static_cast(scaledTangent) / rendererScale); - const float scaledCotangent = cotangent * projectionScale; - output.cotangent = static_cast(static_cast(scaledCotangent) / rendererScale); + const float scaledTangent = tangent * g_projectionScale; + g_tangent = static_cast(static_cast(scaledTangent) / g_renderer->UiScaleY()); + const float scaledCotangent = cotangent * g_projectionScale; + g_cotangent = static_cast(static_cast(scaledCotangent) / g_renderer->UiScaleY()); const float relativeSine = static_cast((static_cast(sine) / ClientSine(45)) * 0.000009f); - output.scaleY = (baseDistance / this->distance) * relativeSine; - output.scaleX = (baseDistance / this->distance) * 0.000036f; + g_cameraScaleY = (g_cameraBaseDistance / this->distance) * relativeSine; + g_cameraScaleX = (g_cameraBaseDistance / this->distance) * 0.000036f; } diff --git a/Source/Contents/Camera/CameraState.h b/Source/Contents/Camera/CameraState.h index 0955e5a7..e9538c35 100644 --- a/Source/Contents/Camera/CameraState.h +++ b/Source/Contents/Camera/CameraState.h @@ -26,16 +26,7 @@ struct CameraState { void AddDistance(float delta); void AddPitch(float delta); void AddYaw(float delta); - void Smooth( - const ServiceOptions& options, const float& rendererScale, const float& projectionScale, const float& baseDistance, struct CameraProjectionOutputs& output - ); -}; - -struct CameraProjectionOutputs { - float& tangent; - float& cotangent; - float& scaleY; - float& scaleX; + void Smooth(); }; struct CameraShake {