summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2021-01-08 23:30:30 +0300
committerFire-Head <Fire-Head@users.noreply.github.com>2021-01-08 23:30:30 +0300
commit00d23c61d99a0a676de2219da42d576b5c5c0474 (patch)
tree2a6d74663312bdb01b5ae1fd9abbd1c8fc5d857f /src
parent6e42c791cf3bbcb59363ab913a4d909b5345ab1b (diff)
.ini for scaling, radar, sprites
Diffstat (limited to 'src')
-rw-r--r--src/core/Radar.h7
-rw-r--r--src/core/common.h6
-rw-r--r--src/core/re3.cpp20
-rw-r--r--src/render/Draw.cpp19
-rw-r--r--src/render/Draw.h14
-rw-r--r--src/render/Sprite.cpp2
6 files changed, 64 insertions, 4 deletions
diff --git a/src/core/Radar.h b/src/core/Radar.h
index 725c8351..5b38d350 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -1,5 +1,6 @@
#pragma once
#include "Sprite2d.h"
+#include "Draw.h"
enum eBlipType
{
@@ -95,9 +96,11 @@ VALIDATE_SIZE(sRadarTrace, 0x30);
#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 (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)
diff --git a/src/core/common.h b/src/core/common.h
index 5767b087..9253a465 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -176,6 +176,12 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#ifdef ASPECT_RATIO_SCALE
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
#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)))
+#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
#define SCREEN_SCALE_AR(a) (a)
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 6f22e999..3cfc0ec0 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -214,6 +214,16 @@ void LoadINISettings()
CustomPipes::LightmapMult = CheckAndReadIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult);
CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
#endif
+
+#ifdef PROPER_SCALING
+ CDraw::ms_bProperScaling = CheckAndReadIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling);
+#endif
+#ifdef FIX_SPRITES
+ CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar);
+#endif
+#ifdef FIX_RADAR
+ CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites);
+#endif
}
void SaveINISettings()
@@ -252,6 +262,16 @@ void SaveINISettings()
CheckAndSaveIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult, changed);
#endif
+#ifdef PROPER_SCALING
+ CheckAndSaveIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling, changed);
+#endif
+#ifdef FIX_SPRITES
+ CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed);
+#endif
+#ifdef FIX_RADAR
+ CheckAndSaveIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites, changed);
+#endif
+
if (changed)
cfg.write_file("re3.ini");
}
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index fcd5d18f..f2fdad27 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
+int32 CDraw::ms_bProperScaling = true;
+#endif
+#ifdef FIX_SPRITES
+int32 CDraw::ms_bFixRadar = true;
+#endif
+#ifdef FIX_RADAR
+int32 CDraw::ms_bFixSprites = true;
+#endif
+
float
CDraw::FindAspectRatio(void)
{
@@ -75,4 +85,11 @@ CDraw::SetFOV(float fov)
ms_fScaledFOV = fov;
#endif
ms_fFOV = fov;
-} \ No newline at end of file
+}
+
+#ifdef PROPER_SCALING
+float CDraw::ScaleY(float y)
+{
+ return ms_bProperScaling ? y : y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC);
+}
+#endif \ No newline at end of file
diff --git a/src/render/Draw.h b/src/render/Draw.h
index 45f7906f..4f8f523d 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -34,6 +34,16 @@ public:
static uint8 FadeRed;
static uint8 FadeGreen;
static uint8 FadeBlue;
+
+#ifdef PROPER_SCALING
+ static int32 ms_bProperScaling;
+#endif
+#ifdef FIX_SPRITES
+ static int32 ms_bFixRadar;
+#endif
+#ifdef FIX_RADAR
+ static int32 ms_bFixSprites;
+#endif
static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; }
static float GetNearClipZ(void) { return ms_fNearClipZ; }
@@ -56,4 +66,8 @@ public:
#else
static float GetAspectRatio(void) { return FindAspectRatio(); }
#endif
+
+#ifdef PROPER_SCALING
+ static float ScaleY(float y);
+#endif
};
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index c31c75d2..a441e08b 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -38,7 +38,7 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
float fovScale = fov / CDraw::GetFOV();
#ifdef FIX_SPRITES
- *outw = fovScale * recip * SCREEN_HEIGHT;
+ *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