summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-02-12 17:00:20 +0100
committerSergeanur <s.anureev@yandex.ua>2021-02-12 17:00:20 +0100
commite98164ec41c3629c592bb31d8b110d85626c5e3c (patch)
treef4e345af3889cbec4d2a9239b6570ee21ee1e9f4 /src/render
parentUpdate TXDs (diff)
downloadre3-e98164ec41c3629c592bb31d8b110d85626c5e3c.tar
re3-e98164ec41c3629c592bb31d8b110d85626c5e3c.tar.gz
re3-e98164ec41c3629c592bb31d8b110d85626c5e3c.tar.bz2
re3-e98164ec41c3629c592bb31d8b110d85626c5e3c.tar.lz
re3-e98164ec41c3629c592bb31d8b110d85626c5e3c.tar.xz
re3-e98164ec41c3629c592bb31d8b110d85626c5e3c.tar.zst
re3-e98164ec41c3629c592bb31d8b110d85626c5e3c.zip
Diffstat (limited to '')
-rw-r--r--src/render/Draw.cpp36
-rw-r--r--src/render/Draw.h6
2 files changed, 33 insertions, 9 deletions
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index 13cbd1b3..9c5921c3 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -30,28 +30,48 @@ bool CDraw::ms_bFixRadar = true;
bool CDraw::ms_bFixSprites = true;
#endif
+#ifdef ASPECT_RATIO_SCALE
+float
+FindAspectRatio(void)
+{
+ switch (FrontEndMenuManager.m_PrefsUseWideScreen) {
+ case AR_AUTO:
+ return SCREEN_WIDTH / SCREEN_HEIGHT;
+ default:
+ case AR_4_3:
+ return 4.0f / 3.0f;
+ case AR_5_4:
+ return 5.0f / 4.0f;
+ case AR_16_10:
+ return 16.0f / 10.0f;
+ case AR_16_9:
+ return 16.0f / 9.0f;
+ case AR_21_9:
+ return 21.0f / 9.0f;
+ };
+}
+#endif
+
float
CDraw::CalculateAspectRatio(void)
{
- if (FrontEndMenuManager.m_PrefsUseWideScreen) {
#ifdef ASPECT_RATIO_SCALE
- if (TheCamera.m_WideScreenOn)
- CDraw::ms_fAspectRatio = FrontEndMenuManager.m_PrefsUseWideScreen == AR_AUTO ?
- (5.f / 3.f) * (SCREEN_WIDTH / SCREEN_HEIGHT) / (16.f / 9.f) :
- 5.f / 3.f; // It's used on theatrical showings according to Wiki
- else
- CDraw::ms_fAspectRatio = FrontEndMenuManager.m_PrefsUseWideScreen == AR_AUTO ? SCREEN_WIDTH / SCREEN_HEIGHT : 16.f / 9.f;
+ if (TheCamera.m_WideScreenOn)
+ CDraw::ms_fAspectRatio = (5.f / 3.f) * FindAspectRatio() / (16.f / 9.f); // It's used on theatrical showings according to Wiki
+ else
+ CDraw::ms_fAspectRatio = FindAspectRatio();
#else
+ if(FrontEndMenuManager.m_PrefsUseWideScreen) {
if (TheCamera.m_WideScreenOn)
CDraw::ms_fAspectRatio = 5.f / 3.f; // It's used on theatrical showings according to Wiki
else
CDraw::ms_fAspectRatio = 16.f / 9.f;
-#endif
} else if (TheCamera.m_WideScreenOn) {
CDraw::ms_fAspectRatio = 5.f/4.f;
} else {
CDraw::ms_fAspectRatio = 4.f/3.f;
}
+#endif
return CDraw::ms_fAspectRatio;
}
diff --git a/src/render/Draw.h b/src/render/Draw.h
index e67ab42b..b96fa813 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -4,10 +4,14 @@ enum eAspectRatio
{
// Make sure these work the same as FrontEndMenuManager.m_PrefsUseWideScreen
// without widescreen support
+ AR_AUTO,
AR_4_3,
+ AR_5_4,
+ AR_16_10,
AR_16_9,
+ AR_21_9,
- AR_AUTO,
+ AR_MAX,
};
class CDraw