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
This commit is contained in:
Fire-Head 2021-01-09 01:01:41 +03:00
parent c6c55d0130
commit 7a3ee349da
11 changed files with 145 additions and 24 deletions

View File

@ -7,7 +7,7 @@
#include "FrontEndControls.h" #include "FrontEndControls.h"
#define X SCREEN_SCALE_X #define X SCREEN_SCALE_X
#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL))) #define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL)))
void void
CPlaceableShText::Draw(float x, float y) CPlaceableShText::Draw(float x, float y)

View File

@ -3,6 +3,7 @@
#include <dinput.h> #include <dinput.h>
#endif #endif
#define FORCE_PC_SCALING
#define WITHWINDOWS #define WITHWINDOWS
#include "common.h" #include "common.h"
#ifndef PS2_MENU #ifndef PS2_MENU

View File

@ -43,7 +43,7 @@ void DoRWStuffEndOfFrame(void);
#define X SCREEN_SCALE_X #define X SCREEN_SCALE_X
#define Y SCREEN_SCALE_Y #define Y SCREEN_SCALE_Y
#define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL))) #define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL)))
//#define X(x) ((x)/640.0f*SCRW) //#define X(x) ((x)/640.0f*SCRW)
//#define Y(y) ((y)/448.0f*SCRH) //#define Y(y) ((y)/448.0f*SCRH)

View File

@ -156,8 +156,28 @@ struct sRadarTraceSave
// Values for screen space // Values for screen space
#define RADAR_LEFT (40.0f) #define RADAR_LEFT (40.0f)
#define RADAR_BOTTOM (40.0f) #define RADAR_BOTTOM (40.0f)
#ifdef FIX_RADAR
/*
The values are from an early screenshot taken before R* broke radar
#define RADAR_WIDTH (82.0f)
#define RADAR_HEIGHT (82.0f)
*/
#define RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (94.0f))
#define RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (76.0f))
#else
/*
broken since forever, someone tried to fix size for 640x512(PAL)
http://aap.rockstarvision.com/pics/gta3/ps2screens/gta3_interface.jpg
but failed:
http://aap.rockstarvision.com/pics/gta3/artwork/gta3_artwork_16.jpg
most likely the guy used something like this:
int y = 82 * (640.0/512.0)/(640.0/480.0);
int x = y * (640.0/512.0);
*/
#define RADAR_WIDTH (94.0f) #define RADAR_WIDTH (94.0f)
#define RADAR_HEIGHT (76.0f) #define RADAR_HEIGHT (76.0f)
#endif
class CRadar class CRadar
{ {

View File

@ -123,17 +123,43 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#include "skeleton.h" #include "skeleton.h"
#include "Draw.h" #include "Draw.h"
#if defined(PROPER_SCALING)
#ifdef FORCE_PC_SCALING
#define DEFAULT_SCREEN_WIDTH (640) #define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448) #define DEFAULT_SCREEN_HEIGHT (448)
#define DEFAULT_SCREEN_HEIGHT_PAL (512) #else
#define DEFAULT_SCREEN_HEIGHT_NTSC (448) #define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (480)
#endif
#elif defined(GTA_PS2)
#define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (480)
#else //elif defined(GTA_PC)
#define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448)
#endif
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f) #define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
#define DEFAULT_VIEWWINDOW (0.7f) #define DEFAULT_VIEWWINDOW (0.7f)
// game uses maximumWidth/Height, but this probably won't work // game uses maximumWidth/Height, but this probably won't work
// with RW windowed mode // with RW windowed mode
#ifdef GTA_PS2
#ifdef GTA_PAL
#define SCREEN_WIDTH ((float)640)
#define SCREEN_HEIGHT ((float)512)
#else
#define SCREEN_WIDTH ((float)640)
#define SCREEN_HEIGHT ((float)448)
#endif
#else
#define SCREEN_WIDTH ((float)RsGlobal.width) #define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height) #define SCREEN_HEIGHT ((float)RsGlobal.height)
#endif
#define SCREEN_HEIGHT_PAL ((float)512)
#define SCREEN_HEIGHT_NTSC ((float)448)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) #define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f))) #define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
@ -151,8 +177,13 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#ifdef ASPECT_RATIO_SCALE #ifdef ASPECT_RATIO_SCALE
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO) #define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
extern float ScaleAndCenterX(float x); #define SCALE_AND_CENTER_X(x) ((SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) ? (x) : (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X((x)))
#define SCALE_AND_CENTER_X(x) ScaleAndCenterX(x) #ifdef PROPER_SCALING
#ifndef FORCE_PC_SCALING
#undef SCREEN_SCALE_Y
#define SCREEN_SCALE_Y(a) CDraw::ScaleY(SCREEN_STRETCH_Y(a))
#endif
#endif
#else #else
#define SCREEN_SCALE_AR(a) (a) #define SCREEN_SCALE_AR(a) (a)
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x) #define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)

View File

@ -252,6 +252,7 @@ enum Config {
// Rendering/display // Rendering/display
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios #define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio).
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img #define USE_TXD_CDIMAGE // generate and load textures from txd.img
#define PS2_ALPHA_TEST // emulate ps2 alpha test #define PS2_ALPHA_TEST // emulate ps2 alpha test
@ -266,6 +267,8 @@ enum Config {
#define NEW_RENDERER // leeds-like world rendering, needs librw #define NEW_RENDERER // leeds-like world rendering, needs librw
#endif #endif
#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc)
#ifndef EXTENDED_COLOURFILTER #ifndef EXTENDED_COLOURFILTER
#undef SCREEN_DROPLETS // we need the backbuffer for this effect #undef SCREEN_DROPLETS // we need the backbuffer for this effect
#endif #endif
@ -296,6 +299,8 @@ enum Config {
// Hud, frontend and radar // Hud, frontend and radar
#define PC_MENU #define PC_MENU
#define FIX_RADAR // use radar size from early version before R* broke it
#ifndef PC_MENU #ifndef PC_MENU
# define PS2_MENU # define PS2_MENU
//# define PS2_MENU_USEALLPAGEICONS //# define PS2_MENU_USEALLPAGEICONS

View File

@ -220,6 +220,16 @@ void LoadINISettings()
CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult); CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
#endif #endif
gBackfaceCulling = CheckAndReadIniInt("Rendering", "BackfaceCulling", gBackfaceCulling); gBackfaceCulling = CheckAndReadIniInt("Rendering", "BackfaceCulling", gBackfaceCulling);
#ifdef PROPER_SCALING
CDraw::ms_bProperScaling = CheckAndReadIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling);
#endif
#ifdef FIX_RADAR
CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar);
#endif
#ifdef FIX_SPRITES
CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites);
#endif
} }
void SaveINISettings() void SaveINISettings()
@ -259,6 +269,16 @@ void SaveINISettings()
#endif #endif
CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed); CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed);
#ifdef PROPER_SCALING
CheckAndSaveIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling, changed);
#endif
#ifdef FIX_RADAR
CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed);
#endif
#ifdef FIX_SPRITES
CheckAndSaveIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites, changed);
#endif
if (changed) if (changed)
cfg.write_file("reVC.ini"); cfg.write_file("reVC.ini");
} }
@ -674,6 +694,16 @@ extern bool gbRenderWorld2;
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil); DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil); DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
#ifdef PROPER_SCALING
DebugMenuAddVarBool8("Draw", "Proper Scaling", &CDraw::ms_bProperScaling, nil);
#endif
#ifdef FIX_RADAR
DebugMenuAddVarBool8("Draw", "Fix Radar", &CDraw::ms_bFixRadar, nil);
#endif
#ifdef FIX_SPRITES
DebugMenuAddVarBool8("Draw", "Fix Sprites", &CDraw::ms_bFixSprites, nil);
#endif
#ifndef FINAL #ifndef FINAL
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil); DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
#ifdef USE_CUSTOM_ALLOCATOR #ifdef USE_CUSTOM_ALLOCATOR

View File

@ -20,6 +20,16 @@ uint8 CDraw::FadeRed;
uint8 CDraw::FadeGreen; uint8 CDraw::FadeGreen;
uint8 CDraw::FadeBlue; 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 float
CDraw::CalculateAspectRatio(void) CDraw::CalculateAspectRatio(void)
{ {
@ -75,13 +85,9 @@ CDraw::SetFOV(float fov)
ms_fFOV = fov; ms_fFOV = fov;
} }
#ifdef ASPECT_RATIO_SCALE #ifdef PROPER_SCALING
float float CDraw::ScaleY(float y)
ScaleAndCenterX(float x)
{ {
if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) return ms_bProperScaling ? y : y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC);
return x;
else
return (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X(x);
} }
#endif #endif

View File

@ -31,6 +31,16 @@ public:
static uint8 FadeGreen; static uint8 FadeGreen;
static uint8 FadeBlue; 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 void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; }
static float GetNearClipZ(void) { return ms_fNearClipZ; } static float GetNearClipZ(void) { return ms_fNearClipZ; }
static void SetFarClipZ(float farclip) { ms_fFarClipZ = farclip; } static void SetFarClipZ(float farclip) { ms_fFarClipZ = farclip; }
@ -50,4 +60,7 @@ public:
#endif #endif
static float GetAspectRatio(void) { return ms_fAspectRatio; } static float GetAspectRatio(void) { return ms_fAspectRatio; }
static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; } static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; }
#ifdef PROPER_SCALING
static float ScaleY(float y);
#endif
}; };

View File

@ -28,6 +28,16 @@
// --MIAMI: file done // --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. // Game has colors inlined in code.
// For easier modification we collect them here: // For easier modification we collect them here:
CRGBA MONEY_COLOR(0, 207, 133, 255); CRGBA MONEY_COLOR(0, 207, 133, 255);
@ -1052,16 +1062,17 @@ void CHud::Draw()
CRadar::DrawMap(); CRadar::DrawMap();
if (FrontEndMenuManager.m_PrefsRadarMode != 1) { if (FrontEndMenuManager.m_PrefsRadarMode != 1) {
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
rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
#endif
rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
#ifdef FIX_BUGS
rect.Grow(SCREEN_SCALE_X(6.0f), SCREEN_SCALE_X(6.0f), SCREEN_SCALE_Y(6.0f), SCREEN_SCALE_Y(6.0f));
#else
rect.Grow(6.0f); 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)); 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); Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR);
} }
CRadar::DrawBlips(); CRadar::DrawBlips();

View File

@ -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 // this is used to scale correctly if you zoom in with sniper rifle
float fovScale = fov / CDraw::GetFOV(); 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; *outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH;
#endif
*outh = fovScale * recip * SCREEN_HEIGHT; *outh = fovScale * recip * SCREEN_HEIGHT;
return true; return true;