From 7a3ee349da51543f5e273df1a7d932a25602ea2a Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sat, 9 Jan 2021 01:01:41 +0300 Subject: sync with re3 -radardisc shadow fix -fix for the dimension where moon is round -correct radar based on the early gta 3 screenshot -proper scaling based on ps2 gta 3 -ini and debugmenu options --- src/render/Draw.cpp | 22 ++++++++++++++-------- src/render/Draw.h | 13 +++++++++++++ src/render/Hud.cpp | 23 +++++++++++++++++------ src/render/Sprite.cpp | 4 ++++ 4 files changed, 48 insertions(+), 14 deletions(-) (limited to 'src/render') diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 912399c9..507653f6 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -20,6 +20,16 @@ uint8 CDraw::FadeRed; uint8 CDraw::FadeGreen; uint8 CDraw::FadeBlue; +#ifdef PROPER_SCALING +bool CDraw::ms_bProperScaling = true; +#endif +#ifdef FIX_RADAR +bool CDraw::ms_bFixRadar = true; +#endif +#ifdef FIX_SPRITES +bool CDraw::ms_bFixSprites = true; +#endif + float CDraw::CalculateAspectRatio(void) { @@ -75,13 +85,9 @@ CDraw::SetFOV(float fov) ms_fFOV = fov; } -#ifdef ASPECT_RATIO_SCALE -float -ScaleAndCenterX(float x) +#ifdef PROPER_SCALING +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); + return ms_bProperScaling ? y : y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC); } -#endif \ No newline at end of file +#endif \ No newline at end of file diff --git a/src/render/Draw.h b/src/render/Draw.h index 2976dc34..1a63c980 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -30,6 +30,16 @@ public: static uint8 FadeRed; static uint8 FadeGreen; static uint8 FadeBlue; + +#ifdef PROPER_SCALING + static bool ms_bProperScaling; +#endif +#ifdef FIX_RADAR + static bool ms_bFixRadar; +#endif +#ifdef FIX_SPRITES + static bool ms_bFixSprites; +#endif static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; } static float GetNearClipZ(void) { return ms_fNearClipZ; } @@ -50,4 +60,7 @@ public: #endif static float GetAspectRatio(void) { return ms_fAspectRatio; } static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; } +#ifdef PROPER_SCALING + static float ScaleY(float y); +#endif }; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 3432f32c..b3cc5deb 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -28,6 +28,16 @@ // --MIAMI: file done +#if defined(FIX_BUGS) + #define SCREEN_SCALE_X_FIX(a) SCREEN_SCALE_X(a) + #define SCREEN_SCALE_Y_FIX(a) SCREEN_SCALE_Y(a) + #define SCALE_AND_CENTER_X_FIX(a) SCALE_AND_CENTER_X(a) +#else + #define SCREEN_SCALE_X_FIX(a) (a) + #define SCREEN_SCALE_Y_FIX(a) (a) + #define SCALE_AND_CENTER_X_FIX(a) (a) +#endif + // Game has colors inlined in code. // For easier modification we collect them here: CRGBA MONEY_COLOR(0, 207, 133, 255); @@ -1052,16 +1062,17 @@ void CHud::Draw() CRadar::DrawMap(); if (FrontEndMenuManager.m_PrefsRadarMode != 1) { CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); + + rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + #ifdef FIX_BUGS - rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + rect.Grow(SCREEN_SCALE_X(6.0f), SCREEN_SCALE_X(6.0f), SCREEN_SCALE_Y(6.0f), SCREEN_SCALE_Y(6.0f)); #else - rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); -#endif - rect.Grow(6.0f); - rect.Translate(0.0f, 2.0f); +#endif + rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(2.0f)); Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); - rect.Translate(0.0f, -2.0f); + rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(-2.0f)); Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR); } CRadar::DrawBlips(); diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 401eebd0..ba6ab291 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -33,7 +33,11 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, // this is used to scale correctly if you zoom in with sniper rifle float fovScale = fov / CDraw::GetFOV(); +#ifdef FIX_SPRITES + *outw = CDraw::ms_bFixSprites ? (fovScale * recip * SCREEN_HEIGHT) : (fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH); +#else *outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH; +#endif *outh = fovScale * recip * SCREEN_HEIGHT; return true; -- cgit v1.2.3