diff options
author | Fire-Head <Fire-Head@users.noreply.github.com> | 2020-12-29 18:24:16 +0100 |
---|---|---|
committer | Fire-Head <Fire-Head@users.noreply.github.com> | 2020-12-29 18:24:16 +0100 |
commit | 224e805fe4e7a4d5366b228072834674f77fa0ba (patch) | |
tree | e28b27bea8a0b8c5d78b1a67231713c58f430e9f /src/render | |
parent | Merge branch 'master' of github.com:GTAmodding/re3 (diff) | |
download | re3-224e805fe4e7a4d5366b228072834674f77fa0ba.tar re3-224e805fe4e7a4d5366b228072834674f77fa0ba.tar.gz re3-224e805fe4e7a4d5366b228072834674f77fa0ba.tar.bz2 re3-224e805fe4e7a4d5366b228072834674f77fa0ba.tar.lz re3-224e805fe4e7a4d5366b228072834674f77fa0ba.tar.xz re3-224e805fe4e7a4d5366b228072834674f77fa0ba.tar.zst re3-224e805fe4e7a4d5366b228072834674f77fa0ba.zip |
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Draw.cpp | 19 | ||||
-rw-r--r-- | src/render/Draw.h | 16 | ||||
-rw-r--r-- | src/render/Hud.cpp | 7 | ||||
-rw-r--r-- | src/render/Sprite.cpp | 9 |
4 files changed, 44 insertions, 7 deletions
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 4e323ec2..2a4739c9 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -35,8 +35,14 @@ CDraw::FindAspectRatio(void) 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 } @@ -72,12 +78,13 @@ CDraw::SetFOV(float fov) } #ifdef ASPECT_RATIO_SCALE -float -ScaleAndCenterX(float x) +float CDraw::ScaleY(float y) { - if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) - return x; - else - return (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X(x); + switch ( CMenuManager::m_PrefsSpriteScalingMode ) + { + case SCL_PC: return y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC); + default: + return y; + } } #endif
\ No newline at end of file diff --git a/src/render/Draw.h b/src/render/Draw.h index 5c4f95b1..9b98ca17 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -5,9 +5,21 @@ enum eAspectRatio // Make sure these work the same as FrontEndMenuManager.m_PrefsUseWideScreen // without widescreen support AR_4_3, + AR_5_4, + AR_16_10, AR_16_9, + AR_21_9, AR_AUTO, + + AR_MAX, +}; + +enum eSpriteScalingMode +{ + SCL_PC, + SCL_PS2, + SCL_AUTO, }; class CDraw @@ -52,4 +64,8 @@ public: #else static float GetAspectRatio(void) { return FindAspectRatio(); } #endif + +#ifdef ASPECT_RATIO_SCALE + static float ScaleY(float y); +#endif }; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index dcc703e9..9a2f718f 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1186,9 +1186,14 @@ void CHud::Draw() /* DrawRadar */ +#ifdef ASPECT_RATIO_SCALE +#define _RADAR_WIDTH ((CMenuManager::m_PrefsSpriteScalingMode==SCL_AUTO) ? (RADAR_HEIGHT) : (RADAR_WIDTH)) +#else +#define _RADAR_WIDTH RADAR_WIDTH +#endif if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) { CRadar::DrawMap(); - CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); + CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(_RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); #ifdef FIX_BUGS rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); #else diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 9ec7b002..4be64ef2 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -5,6 +5,10 @@ #include "Camera.h" #include "Sprite.h" +#ifdef ASPECT_RATIO_SCALE +#include "Frontend.h" +#endif + float CSprite::m_f2DNearScreenZ; float CSprite::m_f2DFarScreenZ; float CSprite::m_fRecipNearClipPlane; @@ -35,6 +39,11 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, *outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH; *outh = fovScale * recip * SCREEN_HEIGHT; + +#ifdef ASPECT_RATIO_SCALE + if ( CMenuManager::m_PrefsSpriteScalingMode==SCL_AUTO ) + *outw = fovScale * recip * SCREEN_HEIGHT; +#endif return true; } |