summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-09 01:50:48 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-09 01:50:48 +0200
commite917cd1f46471cc9be8da606ac03aa9ac3885b87 (patch)
treed3c0ba7ea9af26fa65ae08a0fe89cef73e765ccb /src/render
parentFix water UV on high FPS and inverted free camera (diff)
downloadre3-e917cd1f46471cc9be8da606ac03aa9ac3885b87.tar
re3-e917cd1f46471cc9be8da606ac03aa9ac3885b87.tar.gz
re3-e917cd1f46471cc9be8da606ac03aa9ac3885b87.tar.bz2
re3-e917cd1f46471cc9be8da606ac03aa9ac3885b87.tar.lz
re3-e917cd1f46471cc9be8da606ac03aa9ac3885b87.tar.xz
re3-e917cd1f46471cc9be8da606ac03aa9ac3885b87.tar.zst
re3-e917cd1f46471cc9be8da606ac03aa9ac3885b87.zip
Diffstat (limited to '')
-rw-r--r--src/render/Sprite.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index 30eaf840..1dd1aaab 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -29,13 +29,17 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
float recip = 1.0f/out->z;
out->x *= SCREEN_WIDTH * recip;
out->y *= SCREEN_HEIGHT * recip;
- // What is this? size?
- *outw = 70.0f/CDraw::GetFOV() * SCREEN_WIDTH * recip;
#ifdef ASPECT_RATIO_SCALE
- *outh = 70.0f/CDraw::GetFOV() / (DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO) * SCREEN_HEIGHT * recip;
+ float fov = CDraw::ConvertFOV(DefaultFOV);
#else
- *outh = 70.0f/CDraw::GetFOV() * SCREEN_HEIGHT * recip;
+ const float fov = DefaultFOV;
#endif
+ // this is used to scale correctly if you zoom in with sniper rifle
+ float fovScale = fov / CDraw::GetFOV();
+
+ *outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH;
+ *outh = fovScale * recip * SCREEN_HEIGHT;
+
return true;
}