summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/Frontend.cpp17
-rw-r--r--src/core/Frontend.h3
-rw-r--r--src/core/MenuScreensCustom.cpp17
-rw-r--r--src/core/Radar.cpp10
-rw-r--r--src/core/common.h13
-rw-r--r--src/render/Draw.cpp19
-rw-r--r--src/render/Draw.h16
-rw-r--r--src/render/Hud.cpp7
-rw-r--r--src/render/Sprite.cpp9
9 files changed, 95 insertions, 16 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 4c963a13..a6edd444 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -141,6 +141,10 @@ int8 CMenuManager::m_nPrefsMSAALevel = 0;
int8 CMenuManager::m_nDisplayMSAALevel = 0;
#endif
+#ifdef ASPECT_RATIO_SCALE
+int32 CMenuManager::m_PrefsSpriteScalingMode = 0;
+#endif
+
#ifdef NO_ISLAND_LOADING
int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW;
#endif
@@ -1464,9 +1468,18 @@ CMenuManager::Draw()
case AR_4_3:
sprintf(asciiTemp, "4:3");
break;
+ case AR_5_4:
+ sprintf(asciiTemp, "5:4");
+ break;
+ case AR_16_10:
+ sprintf(asciiTemp, "16:10");
+ break;
case AR_16_9:
sprintf(asciiTemp, "16:9");
break;
+ case AR_21_9:
+ sprintf(asciiTemp, "21:9");
+ break;
}
AsciiToUnicode(asciiTemp, unicodeTemp);
@@ -5248,12 +5261,12 @@ CMenuManager::ProcessButtonPresses(void)
case MENUACTION_WIDESCREEN:
if (changeValueBy > 0) {
m_PrefsUseWideScreen++;
- if (m_PrefsUseWideScreen > 2)
+ if (m_PrefsUseWideScreen > AR_MAX-1)
m_PrefsUseWideScreen = 0;
} else {
m_PrefsUseWideScreen--;
if (m_PrefsUseWideScreen < 0)
- m_PrefsUseWideScreen = 2;
+ m_PrefsUseWideScreen = AR_MAX-1;
}
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
SaveSettings();
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 8cf3dd28..68f249ee 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -636,6 +636,9 @@ public:
static int8 m_nDisplayMSAALevel;
#endif
+#ifdef ASPECT_RATIO_SCALE
+ static int32 m_PrefsSpriteScalingMode;
+#endif
enum LANGUAGE
{
LANGUAGE_AMERICAN,
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index 9a763f8c..9f090e39 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -73,6 +73,12 @@
#define INVERT_PAD_SELECTOR
#endif
+#ifdef ASPECT_RATIO_SCALE
+ #define HUD_ASPECT_RATIO_SELECTOR MENUACTION_CFO_SELECT, "FEC_SCL", { new CCFOSelect((int8*)&CMenuManager::m_PrefsSpriteScalingMode, "HudAspectRatio", SpriteScalingModes, ARRAY_SIZE(SpriteScalingModes), false, nil) },
+#else
+ #define HUD_ASPECT_RATIO_SELECTOR
+#endif
+
const char *filterNames[] = { "FEM_NON", "FEM_SIM", "FEM_NRM", "FEM_MOB" };
const char *off_on[] = { "FEM_OFF", "FEM_ON" };
@@ -331,6 +337,15 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
}
#endif
+#ifdef ASPECT_RATIO_SCALE
+const char* SpriteScalingModes[] =
+{
+ "FEM_PC",
+ "FEM_PS2",
+ "FEM_AUT"
+};
+#endif
+
CMenuScreenCustom aScreens[MENUPAGES] = {
// MENUPAGE_NONE = 0
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil, },
@@ -385,6 +400,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
#endif
MENUACTION_SUBTITLES, "FED_SUB", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
+ HUD_ASPECT_RATIO_SELECTOR
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
VIDEOMODE_SELECTOR
MULTISAMPLING_SELECTOR
@@ -816,6 +832,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
+ HUD_ASPECT_RATIO_SELECTOR
VIDEOMODE_SELECTOR
MENUACTION_FRAMESYNC, "FEM_VSC", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 816da6b9..2b72e0fb 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -1297,10 +1297,16 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &i
} else
#endif
{
+#ifdef ASPECT_RATIO_SCALE
+#define _RADAR_WIDTH ((CMenuManager::m_PrefsSpriteScalingMode==SCL_AUTO) ? (RADAR_HEIGHT) : (RADAR_WIDTH))
+#else
+#define _RADAR_WIDTH RADAR_WIDTH
+#endif
+
#ifdef FIX_BUGS
- out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
+ out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(_RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
#else
- out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(RADAR_WIDTH) + RADAR_LEFT;
+ out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(_RADAR_WIDTH) + RADAR_LEFT;
#endif
out.y = (1.0f - in.y) * 0.5f * SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
}
diff --git a/src/core/common.h b/src/core/common.h
index 50002ab5..44d94370 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -121,7 +121,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#include "skeleton.h"
#include "Draw.h"
-#if defined(USE_PROPER_SCALING)
+#if defined(ASPECT_RATIO_SCALE)
#ifdef FORCE_PC_SCALING
#define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448)
@@ -155,8 +155,8 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define SCREEN_HEIGHT ((float)RsGlobal.height)
#endif
-#define SCREEN_HEIGHT_PAL (512)
-#define SCREEN_HEIGHT_NTSC (448)
+#define SCREEN_HEIGHT_PAL ((float)512)
+#define SCREEN_HEIGHT_NTSC ((float)448)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
@@ -175,8 +175,11 @@ 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)
-extern float ScaleAndCenterX(float x);
-#define SCALE_AND_CENTER_X(x) ScaleAndCenterX(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)))
+ #ifndef FORCE_PC_SCALING
+ #undef SCREEN_SCALE_Y
+ #define SCREEN_SCALE_Y(a) CDraw::ScaleY(SCREEN_STRETCH_Y(a))
+ #endif
#else
#define SCREEN_SCALE_AR(a) (a)
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
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;
}