summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-01-12 11:45:56 +0100
committerSergeanur <s.anureev@yandex.ua>2021-01-12 11:55:07 +0100
commitcb4b4d584c4d08791207ff92870b400a84faa742 (patch)
treefc740c000f1283fb695de5556cdd59efcf71e65b /src/render
parentMerge branch 'lcs-dev' into lcs (diff)
parentpremake: add startrpoject; add lto option; fix copying of binary to gamedir; update premake5.exe (diff)
downloadre3-cb4b4d584c4d08791207ff92870b400a84faa742.tar
re3-cb4b4d584c4d08791207ff92870b400a84faa742.tar.gz
re3-cb4b4d584c4d08791207ff92870b400a84faa742.tar.bz2
re3-cb4b4d584c4d08791207ff92870b400a84faa742.tar.lz
re3-cb4b4d584c4d08791207ff92870b400a84faa742.tar.xz
re3-cb4b4d584c4d08791207ff92870b400a84faa742.tar.zst
re3-cb4b4d584c4d08791207ff92870b400a84faa742.zip
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Draw.cpp22
-rw-r--r--src/render/Draw.h13
-rw-r--r--src/render/Font.cpp8
-rw-r--r--src/render/Hud.cpp23
-rw-r--r--src/render/Particle.cpp6
-rw-r--r--src/render/ParticleType.h2
-rw-r--r--src/render/Sprite.cpp4
7 files changed, 56 insertions, 22 deletions
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/Font.cpp b/src/render/Font.cpp
index 3517031d..6d569591 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -444,7 +444,7 @@ CFont::PrintChar(float x, float y, wchar c)
}
#endif
- if(Details.style == FONT_BANK || Details.style == FONT_STANDARD){
+ if(RenderState.style == FONT_BANK || RenderState.style == FONT_STANDARD){
if (bDontPrint) return;
if (RenderState.slant == 0.0f) {
#ifdef FIX_BUGS
@@ -1051,10 +1051,10 @@ CFont::GetCharacterWidth(wchar c)
return Size[LanguageSet][Details.style][192];
#else
- if (Details.proportional)
- return Size[Details.style][c];
+ if (RenderState.proportional)
+ return Size[RenderState.style][c];
else
- return Size[Details.style][209];
+ return Size[RenderState.style][209];
#endif // MORE_LANGUAGES
}
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 1c870fd2..d7a9d75d 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/Particle.cpp b/src/render/Particle.cpp
index 0ad4681d..51249844 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -2331,9 +2331,9 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize
vecStepPos,
CVector
(
- CGeneral::GetRandomNumberInRange(-0.2f, 0.2f),
- CGeneral::GetRandomNumberInRange(-0.2f, 0.2f),
- CGeneral::GetRandomNumberInRange(-0.2f, 0.0f)
+ CGeneral::GetRandomNumberInRange(-0.02f, 0.02f),
+ CGeneral::GetRandomNumberInRange(-0.02f, 0.02f),
+ CGeneral::GetRandomNumberInRange(-0.02f, 0.0f)
),
nil,
fSize, color, 0, 0, 0, 0);
diff --git a/src/render/ParticleType.h b/src/render/ParticleType.h
index 0af9a1e1..9578083d 100644
--- a/src/render/ParticleType.h
+++ b/src/render/ParticleType.h
@@ -88,5 +88,5 @@ enum tParticleType
MAX_PARTICLES,
PARTICLE_FIRST = PARTICLE_SPARK,
- PARTICLE_LAST = PARTICLE_RAINDROP_2D
+ PARTICLE_LAST = PARTICLE_HEATHAZE_IN_DIST
}; \ No newline at end of file
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;