From 224e805fe4e7a4d5366b228072834674f77fa0ba Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Tue, 29 Dec 2020 20:24:16 +0300 Subject: Sprite Scaling option --- gamefiles/TEXT/american.gxt | Bin 220080 -> 220172 bytes src/core/Frontend.cpp | 17 +++++++++++++++-- src/core/Frontend.h | 3 +++ src/core/MenuScreensCustom.cpp | 17 +++++++++++++++++ src/core/Radar.cpp | 10 ++++++++-- src/core/common.h | 13 ++++++++----- src/render/Draw.cpp | 19 +++++++++++++------ src/render/Draw.h | 16 ++++++++++++++++ src/render/Hud.cpp | 7 ++++++- src/render/Sprite.cpp | 9 +++++++++ utils/gxt/american.txt | 10 ++++++++++ 11 files changed, 105 insertions(+), 16 deletions(-) diff --git a/gamefiles/TEXT/american.gxt b/gamefiles/TEXT/american.gxt index 1054ca12..4d0009e1 100644 Binary files a/gamefiles/TEXT/american.gxt and b/gamefiles/TEXT/american.gxt differ diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 9c33c397..e8cc43f1 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 @@ -1455,9 +1459,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); @@ -5221,12 +5234,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 d9fc5065..a81a76c3 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -83,6 +83,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 *vehPipelineNames[] = { "FED_MFX", "FED_NEO" }; const char *off_on[] = { "FEM_OFF", "FEM_ON" }; @@ -342,6 +348,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, }, @@ -396,6 +411,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 @@ -827,6 +843,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 ffae30bf..ebde3a65 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -116,7 +116,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) @@ -150,8 +150,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))) @@ -170,8 +170,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; } diff --git a/utils/gxt/american.txt b/utils/gxt/american.txt index cdee16f9..c680a734 100644 --- a/utils/gxt/american.txt +++ b/utils/gxt/american.txt @@ -8058,12 +8058,22 @@ NEO [FEM_PS2] PS2 +[FEM_PC] +PC + [FEM_XBX] XBOX +[FEM_AUT] +AUTO + [FEC_IVP] INVERT PAD VERTICALLY +[FEC_SCL] +SPRITE SCALING MODE + + { end of file } [DUMMY] -- cgit v1.2.3 From 97f83c9fb2b69358fec88e52e046e16cb9afc49b Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Tue, 29 Dec 2020 20:34:00 +0300 Subject: fix gxt --- gamefiles/TEXT/american.gxt | Bin 220172 -> 220216 bytes utils/gxt/american.txt | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gamefiles/TEXT/american.gxt b/gamefiles/TEXT/american.gxt index 4d0009e1..b8a677e9 100644 Binary files a/gamefiles/TEXT/american.gxt and b/gamefiles/TEXT/american.gxt differ diff --git a/utils/gxt/american.txt b/utils/gxt/american.txt index c680a734..3d5d25c5 100644 --- a/utils/gxt/american.txt +++ b/utils/gxt/american.txt @@ -8070,10 +8070,12 @@ AUTO [FEC_IVP] INVERT PAD VERTICALLY +[FEM_TWP] +Toggle Waypoint + [FEC_SCL] SPRITE SCALING MODE - { end of file } [DUMMY] -- cgit v1.2.3 From 737d41e18444469b75a3d4092c174a3d9e8227aa Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Tue, 29 Dec 2020 20:35:03 +0300 Subject: Revert "fix gxt" This reverts commit 97f83c9fb2b69358fec88e52e046e16cb9afc49b. --- gamefiles/TEXT/american.gxt | Bin 220216 -> 220172 bytes utils/gxt/american.txt | 4 +--- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/gamefiles/TEXT/american.gxt b/gamefiles/TEXT/american.gxt index b8a677e9..4d0009e1 100644 Binary files a/gamefiles/TEXT/american.gxt and b/gamefiles/TEXT/american.gxt differ diff --git a/utils/gxt/american.txt b/utils/gxt/american.txt index 3d5d25c5..c680a734 100644 --- a/utils/gxt/american.txt +++ b/utils/gxt/american.txt @@ -8070,12 +8070,10 @@ AUTO [FEC_IVP] INVERT PAD VERTICALLY -[FEM_TWP] -Toggle Waypoint - [FEC_SCL] SPRITE SCALING MODE + { end of file } [DUMMY] -- cgit v1.2.3 From 7b9e58f7c68e6ebcf304f07bb2999dcbd34e2488 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Tue, 29 Dec 2020 20:50:29 +0300 Subject: master gxt --- gamefiles/TEXT/american.gxt | Bin 220172 -> 220124 bytes utils/gxt/american.txt | 11 ++--------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/gamefiles/TEXT/american.gxt b/gamefiles/TEXT/american.gxt index 4d0009e1..aba89f11 100644 Binary files a/gamefiles/TEXT/american.gxt and b/gamefiles/TEXT/american.gxt differ diff --git a/utils/gxt/american.txt b/utils/gxt/american.txt index c680a734..6410d0d9 100644 --- a/utils/gxt/american.txt +++ b/utils/gxt/american.txt @@ -8058,21 +8058,14 @@ NEO [FEM_PS2] PS2 -[FEM_PC] -PC - [FEM_XBX] XBOX -[FEM_AUT] -AUTO - [FEC_IVP] INVERT PAD VERTICALLY -[FEC_SCL] -SPRITE SCALING MODE - +[FEM_TWP] +Toggle Waypoint { end of file } -- cgit v1.2.3 From 24eb7c98f2faeb6f1a4bf12a11acbaa7437c7215 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Tue, 29 Dec 2020 20:58:15 +0300 Subject: gxt changes --- gamefiles/TEXT/american.gxt | Bin 220124 -> 220216 bytes utils/gxt/american.txt | 9 +++++++++ 2 files changed, 9 insertions(+) diff --git a/gamefiles/TEXT/american.gxt b/gamefiles/TEXT/american.gxt index aba89f11..b8a677e9 100644 Binary files a/gamefiles/TEXT/american.gxt and b/gamefiles/TEXT/american.gxt differ diff --git a/utils/gxt/american.txt b/utils/gxt/american.txt index 6410d0d9..3d5d25c5 100644 --- a/utils/gxt/american.txt +++ b/utils/gxt/american.txt @@ -8058,15 +8058,24 @@ NEO [FEM_PS2] PS2 +[FEM_PC] +PC + [FEM_XBX] XBOX +[FEM_AUT] +AUTO + [FEC_IVP] INVERT PAD VERTICALLY [FEM_TWP] Toggle Waypoint +[FEC_SCL] +SPRITE SCALING MODE + { end of file } [DUMMY] -- cgit v1.2.3 From 30236a804dba4240b4d16e54f8785a7e71fbd9d0 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Tue, 29 Dec 2020 21:01:36 +0300 Subject: fix ini key --- src/core/MenuScreensCustom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp index 9f090e39..42ddd908 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -74,7 +74,7 @@ #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) }, + #define HUD_ASPECT_RATIO_SELECTOR MENUACTION_CFO_SELECT, "FEC_SCL", { new CCFOSelect((int8*)&CMenuManager::m_PrefsSpriteScalingMode, "SpriteScaling", SpriteScalingModes, ARRAY_SIZE(SpriteScalingModes), false, nil) }, #else #define HUD_ASPECT_RATIO_SELECTOR #endif -- cgit v1.2.3 From 8fadca196bf0e3aefe2c6ebd1130d954ab08270b Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Tue, 29 Dec 2020 22:16:52 +0300 Subject: gxt key, default value --- src/core/Frontend.cpp | 17 ++++++++++++----- src/render/Draw.h | 3 +-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index a6edd444..93322fd9 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -142,7 +142,7 @@ int8 CMenuManager::m_nDisplayMSAALevel = 0; #endif #ifdef ASPECT_RATIO_SCALE -int32 CMenuManager::m_PrefsSpriteScalingMode = 0; +int32 CMenuManager::m_PrefsSpriteScalingMode = SCL_AUTO; #endif #ifdef NO_ISLAND_LOADING @@ -1463,27 +1463,34 @@ CMenuManager::Draw() #else switch (m_PrefsUseWideScreen) { case AR_AUTO: - sprintf(asciiTemp, "AUTO"); + rightText = TheText.Get("FEM_AUT"); break; case AR_4_3: sprintf(asciiTemp, "4:3"); + AsciiToUnicode(asciiTemp, unicodeTemp); + rightText = unicodeTemp; break; case AR_5_4: sprintf(asciiTemp, "5:4"); + AsciiToUnicode(asciiTemp, unicodeTemp); + rightText = unicodeTemp; break; case AR_16_10: sprintf(asciiTemp, "16:10"); + AsciiToUnicode(asciiTemp, unicodeTemp); + rightText = unicodeTemp; break; case AR_16_9: sprintf(asciiTemp, "16:9"); + AsciiToUnicode(asciiTemp, unicodeTemp); + rightText = unicodeTemp; break; case AR_21_9: sprintf(asciiTemp, "21:9"); + AsciiToUnicode(asciiTemp, unicodeTemp); + rightText = unicodeTemp; break; } - - AsciiToUnicode(asciiTemp, unicodeTemp); - rightText = unicodeTemp; #endif break; case MENUACTION_RADIO: diff --git a/src/render/Draw.h b/src/render/Draw.h index 9b98ca17..bacbe18f 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -4,13 +4,12 @@ enum eAspectRatio { // Make sure these work the same as FrontEndMenuManager.m_PrefsUseWideScreen // without widescreen support + AR_AUTO, AR_4_3, AR_5_4, AR_16_10, AR_16_9, AR_21_9, - - AR_AUTO, AR_MAX, }; -- cgit v1.2.3 From 7a360b1181590df6c37e104a2f63e9da5609bd38 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Thu, 31 Dec 2020 07:56:50 +0300 Subject: hud cleanup --- src/render/Hud.cpp | 527 +++++++++++++---------------------------------------- 1 file changed, 126 insertions(+), 401 deletions(-) diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 9a2f718f..37a69cb5 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -21,6 +21,60 @@ #include "User.h" #include "World.h" +#ifdef PS2_HUD +#define MONEY_X 100.0f +#define WEAPON_X 91.0f +#define AMMO_X 59.0f +#define HEALTH_X 100.0f +#define STARS_X 49.0f +#define ZONE_Y 61.0f +#define VEHICLE_Y 81.0f +#define CLOCK_X 101.0f +#define SUBS_Y 83.0f +#define WASTEDBUSTED_Y 122.0f +#define BIGMESSAGE_Y 80.0f +#else +#define MONEY_X 110.0f +#define WEAPON_X 99.0f +#define AMMO_X 66.0f +#define HEALTH_X 110.0f +#define STARS_X 60.0f +#define ZONE_Y 30.0f +#define VEHICLE_Y 55.0f +#define CLOCK_X 111.0f +#define SUBS_Y 68.0f +#define WASTEDBUSTED_Y 82.0f +#define BIGMESSAGE_Y 84.0f +#endif + +#ifdef FIX_BUGS +#define TIMER_RIGHT_OFFSET 34.0f // Taken from VC frenzy timer +#define BIGMESSAGE_Y_OFFSET 18.0f +#else +#define TIMER_RIGHT_OFFSET 27.0f +#define BIGMESSAGE_Y_OFFSET 20.0f +#endif + +#if defined(PS2_HUD) && !defined(FIX_BUGS) + #define SCREEN_SCALE_X_PC(a) (a) + #define SCREEN_SCALE_Y_PC(a) (a) + #define SCALE_AND_CENTER_X_PC(a) (a) +#else + #define SCREEN_SCALE_X_PC(a) SCREEN_SCALE_X(a) + #define SCREEN_SCALE_Y_PC(a) SCREEN_SCALE_Y(a) + #define SCALE_AND_CENTER_X_PC(a) SCALE_AND_CENTER_X(a) +#endif + +#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(89, 115, 150, 255); @@ -387,11 +441,7 @@ void CHud::Draw() RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRocketSightTex)); -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, 40.0f, 40.0f, (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); -#else - CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_SCALE_X(40.0f), SCREEN_SCALE_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); -#endif + CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_SCALE_X_PC(40.0f), SCREEN_SCALE_Y_PC(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); } else { // Sniper @@ -452,24 +502,10 @@ void CHud::Draw() CFont::SetFontStyle(FONT_HEADING); CFont::SetPropOff(); CFont::SetColor(CRGBA(0, 0, 0, 255)); - -#ifdef PS2_HUD -#define MONEY_X 100.0f -#else -#define MONEY_X 110.0f -#endif - -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MONEY_X) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(43.0f) + SCREEN_SCALE_Y(2.0f), sPrint); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MONEY_X) + 2.0f, SCREEN_SCALE_Y(43.0f) + 2.0f, sPrint); -#endif - + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MONEY_X) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(43.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrint); CFont::SetColor(MONEY_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MONEY_X), SCREEN_SCALE_Y(43.0f), sPrint); -#undef MONEY_X - /* DrawAmmo */ @@ -506,14 +542,6 @@ void CHud::Draw() /* DrawWeaponIcon */ -#ifdef PS2_HUD -#define WEAPON_X 91.0f -#define AMMO_X 59.0f -#else -#define WEAPON_X 99.0f -#define AMMO_X 66.0f -#endif - Sprites[WeaponType].Draw( CRect( SCREEN_SCALE_FROM_RIGHT(WEAPON_X), @@ -543,19 +571,9 @@ void CHud::Draw() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(AMMO_X), SCREEN_SCALE_Y(73.0f), sPrint); } -#undef WEAPON_X -#undef AMMO_X - /* DrawHealth */ - -#ifdef PS2_HUD -#define HEALTH_X 100.0f -#else -#define HEALTH_X 110.0f -#endif - CFont::SetBackgroundOff(); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetJustifyOff(); @@ -579,35 +597,20 @@ void CHud::Draw() sprintf(sTemp, "%03d", (int32)FindPlayerPed()->m_fHealth); #endif AsciiToUnicode(sTemp, sPrint); - CFont::SetColor(CRGBA(0, 0, 0, 255)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y(2.0f), sPrint); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + 2.0f, SCREEN_SCALE_Y(65.0f) + 2.0f, sPrint); -#endif + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrint); - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(56.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y(2.0f), sPrintIcon); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + 2.0f - SCREEN_SCALE_X(56.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + 2.0f, sPrintIcon); -#endif - } + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X_FIX(2.0f) - SCREEN_SCALE_X(56.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrintIcon); + CFont::SetColor(HEALTH_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X), SCREEN_SCALE_Y(65.0f), sPrint); - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(56.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + 2.0f - SCREEN_SCALE_X(56.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); -#endif - } + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X_FIX(2.0f) - SCREEN_SCALE_X(56.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon); } } -#undef HEALTH_X /* DrawArmour @@ -624,19 +627,10 @@ void CHud::Draw() AsciiToUnicode(sTemp, sPrint); CFont::SetColor(CRGBA(0, 0, 0, 255)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y(2.0f), sPrint); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + 2.0f, SCREEN_SCALE_Y(65.0f) + 2.0f, sPrint); -#endif + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrint); - if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) { -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(54.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y(2.0f), sPrintIcon); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + 2.0f - SCREEN_SCALE_X(54.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + 2.0f, sPrintIcon); -#endif - } + if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + SCREEN_SCALE_X_FIX(2.0f) - SCREEN_SCALE_X(54.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrintIcon); CFont::SetColor(ARMOUR_COLOR); @@ -651,13 +645,6 @@ void CHud::Draw() /* DrawWantedLevel */ - -#ifdef PS2_HUD -#define STARS_X 49.0f -#else -#define STARS_X 60.0f -#endif - CFont::SetBackgroundOff(); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetJustifyOff(); @@ -672,11 +659,8 @@ void CHud::Draw() for (int i = 0; i < 6; i++) { CFont::SetColor(CRGBA(0, 0, 0, 255)); -#ifdef FIX_BUGS - CFont::PrintString(fStarsX + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(87.0f) + SCREEN_SCALE_Y(2.0f), sPrintIcon); -#else - CFont::PrintString(fStarsX + 2.0f, SCREEN_SCALE_Y(87.0f) + 2.0f, sPrintIcon); -#endif + CFont::PrintString(fStarsX + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(87.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrintIcon); + if (FindPlayerPed()->m_pWanted->m_nWantedLevel > i && (CTimer::GetTimeInMilliseconds() > FindPlayerPed()->m_pWanted->m_nLastWantedLevelChange + 2000 || CTimer::GetFrameCounter() & 4)) { @@ -687,17 +671,10 @@ void CHud::Draw() fStarsX -= SCREEN_SCALE_X(23.0f); } - -#undef STARS_X /* DrawZoneName */ -#ifdef PS2_HUD -#define ZONE_Y 61.0f -#else -#define ZONE_Y 30.0f -#endif if (m_pZoneName) { float fZoneAlpha = 255.0f; @@ -783,29 +760,16 @@ void CHud::Draw() CFont::SetBackGroundOnlyTextOff(); CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(ZONE_Y) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + 1.0f, SCREEN_SCALE_FROM_BOTTOM(ZONE_Y) + 1.0f, m_ZoneToPrint); -#endif - + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X_FIX(1.0f), SCREEN_SCALE_FROM_BOTTOM(ZONE_Y) + SCREEN_SCALE_Y_FIX(1.0f), m_ZoneToPrint); CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(ZONE_Y), m_ZoneToPrint); } } } -#undef ZONE_Y /* DrawVehicleName */ - -#ifdef PS2_HUD -#define VEHICLE_Y 81.0f -#else -#define VEHICLE_Y 55.0f -#endif - if (m_pVehicleName) { float fVehicleAlpha = 0.0f; @@ -890,13 +854,7 @@ void CHud::Draw() CFont::SetBackGroundOnlyTextOff(); CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); - -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(VEHICLE_Y) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + 1.0f, SCREEN_SCALE_FROM_BOTTOM(VEHICLE_Y) + 1.0f, m_pVehicleNameToPrint); -#endif - + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X_FIX(1.0f), SCREEN_SCALE_FROM_BOTTOM(VEHICLE_Y) + SCREEN_SCALE_Y_FIX(1.0f), m_pVehicleNameToPrint); CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(VEHICLE_Y), m_pVehicleNameToPrint); } @@ -908,16 +866,10 @@ void CHud::Draw() m_VehicleFadeTimer = 0; m_VehicleNameTimer = 0; } -#undef VEHICLE_Y /* DrawClock */ -#ifdef PS2_HUD -#define CLOCK_X 101.0f -#else -#define CLOCK_X 111.0f -#endif CFont::SetJustifyOff(); CFont::SetCentreOff(); CFont::SetBackgroundOff(); @@ -932,22 +884,13 @@ void CHud::Draw() AsciiToUnicode(sTemp, sPrint); CFont::SetColor(CRGBA(0, 0, 0, 255)); - -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(CLOCK_X) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), sPrint); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(CLOCK_X) + 2.0f, SCREEN_SCALE_Y(22.0f) + 2.0f, sPrint); -#endif - + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(CLOCK_X) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrint); CFont::SetColor(CLOCK_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(CLOCK_X), SCREEN_SCALE_Y(22.0f), sPrint); -#undef CLOCK_X - /* DrawOnScreenTimer */ - wchar sTimer[16]; if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed) @@ -955,11 +898,6 @@ void CHud::Draw() if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed) CounterOnLastFrame = false; -#ifdef FIX_BUGS -#define TIMER_RIGHT_OFFSET 34.0f // Taken from VC frenzy timer -#else -#define TIMER_RIGHT_OFFSET 27.0f -#endif if (CUserDisplay::OnscnTimer.m_bProcessed) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed) { if (!TimerOnLastFrame) @@ -983,11 +921,7 @@ void CHud::Draw() CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), sTimer); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + 2.0f, SCREEN_SCALE_Y(110.0f) + 2.0f, sTimer); -#endif + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y_FIX(2.0f), sTimer); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetColor(TIMER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(110.0f), sTimer); @@ -996,12 +930,7 @@ void CHud::Draw() CFont::SetPropOn(); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetScale(SCREEN_SCALE_X(0.8f * 0.8f), SCREEN_SCALE_Y(1.35f)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + 2.0f, TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); -#endif - + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y_FIX(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); CFont::SetColor(TIMER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f), SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); } @@ -1032,14 +961,8 @@ void CHud::Draw() CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH)); CFont::SetPropOff(); CFont::SetBackGroundOnlyTextOn(); - CFont::SetColor(CRGBA(0, 0, 0, 255)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), sTimer); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + 2.0f, SCREEN_SCALE_Y(132.0f) + 2.0f, sTimer); -#endif - + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y_FIX(2.0f), sTimer); CFont::SetColor(COUNTER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(132.0f), sTimer); } else { @@ -1051,23 +974,10 @@ void CHud::Draw() ( CRect ( -#ifdef FIX_BUGS - SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), -#else - SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + 4.0f, -#endif + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X_FIX(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), -#ifdef FIX_BUGS - SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(4.0f), -#else - SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + 4.0f, -#endif - -#if !defined(PS2_HUD) || defined(FIX_BUGS) - SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f) -#else - SCREEN_SCALE_Y(132.0f) + 11.0f + SCREEN_SCALE_Y(8.0f) -#endif + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X_FIX(4.0f), + SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y_PC(11.0f) + SCREEN_SCALE_Y(8.0f) ), CRGBA(0, 106, 164, 80) ); @@ -1076,30 +986,10 @@ void CHud::Draw() ( CRect ( -#ifdef FIX_BUGS - SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), -#else - SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + 4.0f, -#endif + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X_FIX(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), - -#if !defined(PS2_HUD) || defined(FIX_BUGS) - SCREEN_SCALE_X(counter) / 2.0f + -#else - (float)(counter) / 2.0f + -#endif - -#ifdef FIX_BUGS - SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2.0f + SCREEN_SCALE_X(4.0f), -#else - SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2.0f + 4.0f, -#endif - -#if !defined(PS2_HUD) || defined(FIX_BUGS) - SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f) -#else - SCREEN_SCALE_Y(132.0f) + 11.0f + SCREEN_SCALE_Y(8.0f) -#endif + SCREEN_SCALE_X_PC((float)counter) / 2.0f + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2.0f + SCREEN_SCALE_X_FIX(4.0f), + SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y_PC(11.0f) + SCREEN_SCALE_Y(8.0f) ), CRGBA(0, 106, 164, 255) ); @@ -1109,19 +999,13 @@ void CHud::Draw() CFont::SetPropOn(); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + 2.0f, TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); -#endif - + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y_FIX(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); CFont::SetColor(COUNTER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f), SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); } } } } -#undef TIMER_RIGHT_OFFSET ///////////////////////////////// /* @@ -1158,13 +1042,7 @@ void CHud::Draw() PagerOn = 0; } } - -#ifdef FIX_BUGS - Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X(PagerXOffset), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X(PagerXOffset), SCREEN_SCALE_Y(80.0f) + SCREEN_SCALE_Y(27.0f)), CRGBA(255, 255, 255, 255)); -#else - Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f) - PagerXOffset, SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0f) + SCREEN_SCALE_X(26.0f) - PagerXOffset, SCREEN_SCALE_Y(80.0f) + SCREEN_SCALE_Y(27.0f)), CRGBA(255, 255, 255, 255)); -#endif - + Sprites[HUD_PAGER].Draw(CRect(SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X_FIX(PagerXOffset), SCREEN_SCALE_Y(27.0f), SCREEN_SCALE_X(160.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X_FIX(PagerXOffset), SCREEN_SCALE_Y(80.0f) + SCREEN_SCALE_Y(27.0f)), CRGBA(255, 255, 255, 255)); CFont::SetBackgroundOff(); CFont::SetScale(SCREEN_SCALE_X(0.84f), SCREEN_SCALE_Y(1.0f)); CFont::SetColor(PAGER_COLOR); @@ -1175,12 +1053,7 @@ void CHud::Draw() CFont::SetJustifyOff(); CFont::SetPropOff(); CFont::SetFontStyle(FONT_PAGER); - -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_X(52.0f) - SCREEN_SCALE_X(PagerXOffset), SCREEN_SCALE_Y(54.0f), m_PagerMessage); -#else - CFont::PrintString(SCREEN_SCALE_X(52.0f) - PagerXOffset, SCREEN_SCALE_Y(54.0f), m_PagerMessage); -#endif + CFont::PrintString(SCREEN_SCALE_X(52.0f) - SCREEN_SCALE_X_FIX(PagerXOffset), SCREEN_SCALE_Y(54.0f), m_PagerMessage); } /* @@ -1194,11 +1067,7 @@ void CHud::Draw() 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)); -#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 PS2_HUD #ifdef FIX_BUGS @@ -1231,11 +1100,12 @@ void CHud::Draw() if (!CTimer::GetIsUserPaused()) { for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) { if (CTheScripts::IntroTextLines[i].m_Text[0] && CTheScripts::IntroTextLines[i].m_bTextBeforeFade) { -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(CTheScripts::IntroTextLines[i].m_fScaleX, CTheScripts::IntroTextLines[i].m_fScaleY); -#else - CFont::SetScale(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f)); + CFont::SetScale(SCREEN_SCALE_X_PC(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y_PC(CTheScripts::IntroTextLines[i].m_fScaleY +#if !defined(PS2_HUD) || defined(FIX_BUGS) + * 0.5f #endif + )); + CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor); if (CTheScripts::IntroTextLines[i].m_bJustify) @@ -1253,18 +1123,10 @@ void CHud::Draw() else CFont::SetCentreOff(); -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetWrapx(CTheScripts::IntroTextLines[i].m_fWrapX); -#else - CFont::SetWrapx(SCALE_AND_CENTER_X(CTheScripts::IntroTextLines[i].m_fWrapX)); -#endif - -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetCentreSize(CTheScripts::IntroTextLines[i].m_fCenterSize); -#else - CFont::SetCentreSize(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fCenterSize)); -#endif - + CFont::SetWrapx(SCALE_AND_CENTER_X_PC(CTheScripts::IntroTextLines[i].m_fWrapX)); + + CFont::SetCentreSize(SCREEN_SCALE_X_PC(CTheScripts::IntroTextLines[i].m_fCenterSize)); + if (CTheScripts::IntroTextLines[i].m_bBackground) CFont::SetBackgroundOn(); else @@ -1320,20 +1182,11 @@ void CHud::Draw() /* DrawSubtitles */ -#ifdef PS2_HUD -#define SUBS_Y 83.0f -#else -#define SUBS_Y 68.0f -#endif if (m_Message[0] && !m_BigMessage[2][0] && (FrontEndMenuManager.m_PrefsShowSubtitles == 1 || !TheCamera.m_WideScreenOn)) { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(0.48f, 1.12f); -#else - CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.12f)); -#endif + CFont::SetScale(SCREEN_SCALE_X_PC(0.48f), SCREEN_SCALE_Y_PC(1.12f)); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); @@ -1358,17 +1211,10 @@ void CHud::Draw() CFont::SetColor(CRGBA(235, 235, 235, 255)); // I'm not sure shadow substaction was intentional here, might be a leftover if CFont::PrintString was used for a shadow draw call - #if defined(FIX_BUGS) - CFont::PrintString(rectWidth / 2.0f + radarBulge - SCREEN_SCALE_X(shadow), SCREEN_SCALE_Y(4.0f) + SCREEN_SCALE_FROM_BOTTOM(SUBS_Y) - SCREEN_SCALE_Y(shadow), m_Message); - #elif defined(PS2_HUD) - CFont::PrintString(rectWidth / 2.0f + radarBulge - shadow, 4.0f + SCREEN_SCALE_FROM_BOTTOM(SUBS_Y) - shadow, m_Message); - #else - CFont::PrintString(rectWidth / 2.0f + radarBulge - shadow, SCREEN_SCALE_Y(4.0f) + SCREEN_SCALE_FROM_BOTTOM(SUBS_Y) - shadow, m_Message); - #endif + CFont::PrintString(rectWidth / 2.0f + radarBulge - SCREEN_SCALE_X_FIX(shadow), SCREEN_SCALE_Y_PC(4.0f) + SCREEN_SCALE_FROM_BOTTOM(SUBS_Y) - SCREEN_SCALE_Y_FIX(shadow), m_Message); CFont::SetDropShadowPosition(0); #endif // #ifdef XBOX_SUBTITLES } -#undef SUBS_Y /* DrawBigMessage @@ -1381,17 +1227,9 @@ void CHud::Draw() CFont::SetBackGroundOnlyTextOff(); if (CGame::frenchGame || CGame::germanGame) -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(1.8f, 1.8f); -#else - CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f)); -#endif + CFont::SetScale(SCREEN_SCALE_X_PC(1.8f), SCREEN_SCALE_Y_PC(1.8f)); else -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(1.8f, 1.8f); -#else - CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f)); -#endif + CFont::SetScale(SCREEN_SCALE_X_PC(1.8f), SCREEN_SCALE_Y_PC(1.8f)); CFont::SetPropOn(); CFont::SetCentreOn(); @@ -1419,30 +1257,18 @@ void CHud::Draw() } } else { -#ifdef FIX_BUGS - BigMessageX[0] += SCREEN_SCALE_X((CTimer::GetTimeStepInMilliseconds() * 0.3f)); -#else - BigMessageX[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f); -#endif + BigMessageX[0] += SCREEN_SCALE_X_FIX(CTimer::GetTimeStepInMilliseconds() * 0.3f); BigMessageAlpha[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f); if (BigMessageAlpha[0] > 255.0f) BigMessageAlpha[0] = 255.0f; } - CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0])); -#ifdef FIX_BUGS -#define Y_OFFSET 18.0f -#else -#define Y_OFFSET 20.0f -#endif -#if defined(FIX_BUGS) - CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(Y_OFFSET) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]); -#elif defined(PS2_HUD) // yeah, that's right. ps2 uses y=ScaleX(a) - CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(120.0f) + 2.0f, m_BigMessage[0]); +#if defined(PS2_HUD) && !defined(FIX_BUGS) // yeah, that's right. ps2 uses y=ScaleX(a) + CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X_FIX(2.0f), (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(120.0f) + SCREEN_SCALE_Y_FIX(2.0f), m_BigMessage[0]); #else - CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(Y_OFFSET) + 2.0f, m_BigMessage[0]); + CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X_FIX(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y_OFFSET) + SCREEN_SCALE_Y_FIX(2.0f), m_BigMessage[0]); #endif CFont::SetColor(CRGBA(BIGMESSAGE_COLOR.r, BIGMESSAGE_COLOR.g, BIGMESSAGE_COLOR.b, BigMessageAlpha[0])); #if defined(PS2_HUD) && !defined(FIX_BUGS) // same @@ -1450,16 +1276,10 @@ void CHud::Draw() #else CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f), m_BigMessage[0]); #endif - -#undef Y_OFFSET } else { BigMessageAlpha[0] = 0.0f; -#ifdef FIX_BUGS - BigMessageX[0] = SCALE_AND_CENTER_X(-60.0f); -#else - BigMessageX[0] = -60.0f; -#endif + BigMessageX[0] = SCALE_AND_CENTER_X_FIX(-60.0f); BigMessageInUse[0] = 1.0f; } } @@ -1468,11 +1288,6 @@ void CHud::Draw() } // WastedBustedText -#ifdef PS2_HUD -#define WASTEDBUSTED_Y 122.0f -#else -#define WASTEDBUSTED_Y 82.0f -#endif if (m_BigMessage[2][0]) { if (BigMessageInUse[2] != 0.0f) { BigMessageAlpha[2] += (CTimer::GetTimeStepInMilliseconds() * 0.4f); @@ -1482,29 +1297,17 @@ void CHud::Draw() CFont::SetBackgroundOff(); -#if defined(PS2_HUD) && !defined(FIX_BUGS) if (CGame::frenchGame || CGame::germanGame) - CFont::SetScale(1.4f, 1.4f); + CFont::SetScale(SCREEN_SCALE_X_PC(1.4f), SCREEN_SCALE_Y_PC(1.4f)); else - CFont::SetScale(2.0f, 2.0f); -#else - if (CGame::frenchGame || CGame::germanGame) - CFont::SetScale(SCREEN_SCALE_X(1.4f), SCREEN_SCALE_Y(1.4f)); - else - CFont::SetScale(SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(2.0f)); -#endif + CFont::SetScale(SCREEN_SCALE_X_PC(2.0f), SCREEN_SCALE_Y_PC(2.0f)); CFont::SetPropOn(); CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]*0.75f)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_FROM_BOTTOM(WASTEDBUSTED_Y) + SCREEN_SCALE_Y(4.0f), m_BigMessage[2]); -#else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + 4.0f, SCREEN_SCALE_FROM_BOTTOM(WASTEDBUSTED_Y) + SCREEN_SCALE_Y(4.0f), m_BigMessage[2]); -#endif - + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X_FIX(4.0f), SCREEN_SCALE_FROM_BOTTOM(WASTEDBUSTED_Y) + SCREEN_SCALE_Y(4.0f), m_BigMessage[2]); CFont::SetColor(CRGBA(WASTEDBUSTED_COLOR.r, WASTEDBUSTED_COLOR.g, WASTEDBUSTED_COLOR.b, BigMessageAlpha[2])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(WASTEDBUSTED_Y), m_BigMessage[2]); } @@ -1516,7 +1319,6 @@ void CHud::Draw() else { BigMessageInUse[2] = 0.0f; } -#undef WASTEDBUSTED_Y } } @@ -1611,28 +1413,16 @@ void CHud::DrawAfterFade() CFont::SetJustifyOff(); #ifdef MORE_LANGUAGES if (CFont::IsJapanese()) - #ifdef FIX_BUGS - CFont::SetWrapx(SCREEN_SCALE_X(229.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X(4.0f)); - #else - CFont::SetWrapx(SCREEN_SCALE_X(229.0f) + SCREEN_SCALE_X(26.0f) - 4.0f); - #endif + CFont::SetWrapx(SCREEN_SCALE_X(229.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X_FIX(4.0f)); else #endif - #ifdef FIX_BUGS - CFont::SetWrapx(SCREEN_SCALE_X(200.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X(4.0f)); - #else - CFont::SetWrapx(SCREEN_SCALE_X(200.0f) + SCREEN_SCALE_X(26.0f) - 4.0f); - #endif + CFont::SetWrapx(SCREEN_SCALE_X(200.0f) + SCREEN_SCALE_X(26.0f) - SCREEN_SCALE_X_FIX(4.0f)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetBackgroundOn(); CFont::SetBackGroundOnlyTextOff(); CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f)); CFont::SetColor(CRGBA(175, 175, 175, 255)); -#ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), m_HelpMessageToPrint); -#else - CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f) + (150.0f - PagerXOffset) * 0.6f, m_HelpMessageToPrint); -#endif + CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f) + SCREEN_SCALE_Y_FIX((150.0f - PagerXOffset) * 0.6f), m_HelpMessageToPrint); CFont::SetAlphaFade(255.0f); } } @@ -1640,11 +1430,12 @@ void CHud::DrawAfterFade() for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) { intro_text_line &line = CTheScripts::IntroTextLines[i]; if (line.m_Text[0] != '\0' && !line.m_bTextBeforeFade) { -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(line.m_fScaleX, line.m_fScaleY); -#else - CFont::SetScale(SCREEN_SCALE_X(line.m_fScaleX), SCREEN_SCALE_Y(line.m_fScaleY) / 2); + + CFont::SetScale(SCREEN_SCALE_X_PC(line.m_fScaleX), SCREEN_SCALE_Y_PC(line.m_fScaleY) +#if !defined(PS2_HUD) || defined(FIX_BUGS) + / 2 #endif + ); CFont::SetColor(line.m_sColor); if (line.m_bJustify) CFont::SetJustifyOn(); @@ -1661,13 +1452,8 @@ void CHud::DrawAfterFade() else CFont::SetCentreOff(); -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetWrapx(line.m_fWrapX); - CFont::SetCentreSize(line.m_fCenterSize); -#else - CFont::SetWrapx(SCALE_AND_CENTER_X(line.m_fWrapX)); - CFont::SetCentreSize(SCREEN_SCALE_X(line.m_fCenterSize)); -#endif + CFont::SetWrapx(SCALE_AND_CENTER_X_PC(line.m_fWrapX)); + CFont::SetCentreSize(SCREEN_SCALE_X_PC(line.m_fCenterSize)); if (line.m_bBackground) CFont::SetBackgroundOn(); @@ -1711,61 +1497,34 @@ void CHud::DrawAfterFade() /* DrawBigMessage2 */ -#ifdef PS2_HUD - #define BIGMESSAGE_Y 80.0f -#else - #define BIGMESSAGE_Y 84.0f -#endif - // Oddjob if (m_BigMessage[3][0]) { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(1.2f, 1.5f); -#else - CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); -#endif + CFont::SetScale(SCREEN_SCALE_X_PC(1.2f), SCREEN_SCALE_Y_PC(1.5f)); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 40)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetColor(CRGBA(0, 0, 0, 255)); - -#ifdef FIX_BUGS - CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]); -#else - CFont::PrintString((SCREEN_WIDTH / 2) + 2.0f, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) + 2.0f, m_BigMessage[3]); -#endif - + CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X_FIX(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) + SCREEN_SCALE_Y_FIX(2.0f), m_BigMessage[3]); CFont::SetColor(ODDJOB_COLOR); - CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y), m_BigMessage[3]); } if (!m_BigMessage[1][0] && m_BigMessage[4][0]) { CFont::SetJustifyOff(); CFont::SetBackgroundOff(); -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(1.2f, 1.5f); -#else - CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); -#endif + CFont::SetScale(SCREEN_SCALE_X_PC(1.2f), SCREEN_SCALE_Y_PC(1.5f)); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20)); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); - -#ifdef FIX_BUGS - CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]); -#else - CFont::PrintString((SCREEN_WIDTH / 2) - 2.0f, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) - 2.0f, m_BigMessage[4]); -#endif + CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X_FIX(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y) - SCREEN_SCALE_Y_FIX(2.0f), m_BigMessage[4]); CFont::SetColor(ODDJOB_COLOR); CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(BIGMESSAGE_Y), m_BigMessage[4]); } -#undef BIGMESSAGE_Y // Oddjob result if (OddJob2OffTimer > 0) @@ -1824,19 +1583,11 @@ void CHud::DrawAfterFade() CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); #ifdef BETA_SLIDING_TEXT - #if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + 2.0f, m_BigMessage[5]); - #else - CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); - #endif + CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X_PC(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y_PC(2.0f), m_BigMessage[5]); CFont::SetColor(ODDJOB2_COLOR); CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]); #else - #if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::PrintString(SCREEN_WIDTH / 2 + 2.0f, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + 2.0f, m_BigMessage[5]); - #else - CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); - #endif + CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X_PC(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y_PC(2.0f), m_BigMessage[5]); CFont::SetColor(ODDJOB2_COLOR); CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]); #endif @@ -1852,17 +1603,9 @@ void CHud::DrawAfterFade() CFont::SetBackgroundOff(); if (CGame::frenchGame || FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_SPANISH) -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(0.884f, 1.36f); -#else - CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f)); -#endif + CFont::SetScale(SCREEN_SCALE_X_PC(0.884f), SCREEN_SCALE_Y_PC(1.36f)); else -#if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::SetScale(1.04f, 1.6f); -#else - CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f)); -#endif + CFont::SetScale(SCREEN_SCALE_X_PC(1.04f), SCREEN_SCALE_Y_PC(1.6f)); CFont::SetPropOn(); #ifdef FIX_BUGS @@ -1873,11 +1616,7 @@ void CHud::DrawAfterFade() CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); -#ifdef FIX_BUGS - if (BigMessageX[1] >= SCREEN_WIDTH - SCREEN_SCALE_X(20.0f)) -#else - if (BigMessageX[1] >= SCREEN_WIDTH - 20.0f) -#endif + if (BigMessageX[1] >= SCREEN_WIDTH - SCREEN_SCALE_X_FIX(20.0f)) { BigMessageInUse[1] += CTimer::GetTimeStep(); @@ -1890,11 +1629,7 @@ void CHud::DrawAfterFade() BigMessageAlpha[1] = 0.0f; } } else { -#ifdef FIX_BUGS - BigMessageX[1] += SCREEN_SCALE_X((CTimer::GetTimeStepInMilliseconds() * 0.3f)); -#else - BigMessageX[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f); -#endif + BigMessageX[1] += SCREEN_SCALE_X_FIX(CTimer::GetTimeStepInMilliseconds() * 0.3f); BigMessageAlpha[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f); if (BigMessageAlpha[1] > 255.0f) @@ -1903,21 +1638,11 @@ void CHud::DrawAfterFade() CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); #ifdef BETA_SLIDING_TEXT - #if defined(PS2_HUD) && !defined(FIX_BUGS) - CFont::PrintString(SCREEN_SCALE_X(2.0f) + BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(120.0f) + 2.0f, m_BigMessage[1]); - #else - CFont::PrintString(SCREEN_SCALE_X(2.0f) + BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]); - #endif + CFont::PrintString(SCREEN_SCALE_X(2.0f) + BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y_PC(2.0f), m_BigMessage[1]); CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1])); CFont::PrintString(BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]); #else - #ifdef FIX_BUGS - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]); - #elif defined(PS2_HUD) - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + 2.0f, SCREEN_SCALE_FROM_BOTTOM(120.0f) + 2.0f, m_BigMessage[1]); - #else - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + 2.0f, SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]); - #endif + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y_PC(2.0f), m_BigMessage[1]); CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]); #endif -- cgit v1.2.3 From bc7161754f9be556e11d1049c9666770eaad94fa Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Thu, 31 Dec 2020 18:10:08 +0300 Subject: fix compiling --- src/render/Hud.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 37a69cb5..2adcbb81 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1100,11 +1100,11 @@ void CHud::Draw() if (!CTimer::GetIsUserPaused()) { for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) { if (CTheScripts::IntroTextLines[i].m_Text[0] && CTheScripts::IntroTextLines[i].m_bTextBeforeFade) { - CFont::SetScale(SCREEN_SCALE_X_PC(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y_PC(CTheScripts::IntroTextLines[i].m_fScaleY + CFont::SetScale(SCREEN_SCALE_X_PC(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y_PC(CTheScripts::IntroTextLines[i].m_fScaleY) #if !defined(PS2_HUD) || defined(FIX_BUGS) * 0.5f #endif - )); + ); CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor); -- cgit v1.2.3 From 11de714d9dbeabb59129d29acb9e433c538ba4ba Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Tue, 5 Jan 2021 04:17:18 +0300 Subject: remake --- gamefiles/TEXT/american.gxt | Bin 220216 -> 220146 bytes src/core/Frontend.cpp | 4 ---- src/core/Frontend.h | 3 --- src/core/MenuScreensCustom.cpp | 17 ----------------- src/core/Radar.cpp | 7 +++++-- src/core/re3.cpp | 12 ++++++++++++ src/render/Draw.cpp | 8 +++++++- src/render/Draw.h | 6 +++++- src/render/Hud.cpp | 9 ++++++--- src/render/Sprite.cpp | 2 +- utils/gxt/american.txt | 6 ------ 11 files changed, 36 insertions(+), 38 deletions(-) diff --git a/gamefiles/TEXT/american.gxt b/gamefiles/TEXT/american.gxt index b8a677e9..cf4bb1e5 100644 Binary files a/gamefiles/TEXT/american.gxt and b/gamefiles/TEXT/american.gxt differ diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 93322fd9..a8041902 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -141,10 +141,6 @@ int8 CMenuManager::m_nPrefsMSAALevel = 0; int8 CMenuManager::m_nDisplayMSAALevel = 0; #endif -#ifdef ASPECT_RATIO_SCALE -int32 CMenuManager::m_PrefsSpriteScalingMode = SCL_AUTO; -#endif - #ifdef NO_ISLAND_LOADING int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW; #endif diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 68f249ee..8cf3dd28 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -636,9 +636,6 @@ 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 42ddd908..9a763f8c 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -73,12 +73,6 @@ #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, "SpriteScaling", 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" }; @@ -337,15 +331,6 @@ 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, }, @@ -400,7 +385,6 @@ 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 @@ -832,7 +816,6 @@ 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 2b72e0fb..7af51929 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1298,9 +1298,12 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &i #endif { #ifdef ASPECT_RATIO_SCALE -#define _RADAR_WIDTH ((CMenuManager::m_PrefsSpriteScalingMode==SCL_AUTO) ? (RADAR_HEIGHT) : (RADAR_WIDTH)) +// The values are from from an early screenshot taken before R* broke radar +#define _RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_WIDTH)) +#define _RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_HEIGHT)) #else #define _RADAR_WIDTH RADAR_WIDTH +#define _RADAR_HEIGHT RADAR_HEIGHT #endif #ifdef FIX_BUGS @@ -1308,7 +1311,7 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &i #else 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); + 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/re3.cpp b/src/core/re3.cpp index 87244e2a..14457db4 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -214,6 +214,12 @@ void LoadINISettings() CustomPipes::LightmapMult = CheckAndReadIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult); CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult); #endif + +#ifdef ASPECT_RATIO_SCALE + CDraw::ms_nScalingMode = CheckAndReadIniInt("Draw", "ScalingMode", CDraw::ms_nScalingMode); + CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar); + CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSpritesAspectRatio", CDraw::ms_bFixSprites); +#endif } void SaveINISettings() @@ -253,6 +259,12 @@ void SaveINISettings() CheckAndSaveIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult, changed); #endif +#ifdef ASPECT_RATIO_SCALE + CheckAndSaveIniInt("Draw", "ScalingMode", CDraw::ms_nScalingMode, changed); + CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed); + CheckAndSaveIniInt("Draw", "FixSpritesAspectRatio", 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 2a4739c9..42015176 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -20,6 +20,12 @@ uint8 CDraw::FadeRed; uint8 CDraw::FadeGreen; uint8 CDraw::FadeBlue; +#ifdef ASPECT_RATIO_SCALE +int32 CDraw::ms_nScalingMode = SCL_PS2; +int32 CDraw::ms_bFixRadar = true; +int32 CDraw::ms_bFixSprites = true; +#endif + float CDraw::FindAspectRatio(void) { @@ -80,7 +86,7 @@ CDraw::SetFOV(float fov) #ifdef ASPECT_RATIO_SCALE float CDraw::ScaleY(float y) { - switch ( CMenuManager::m_PrefsSpriteScalingMode ) + switch ( ms_nScalingMode ) { case SCL_PC: return y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC); default: diff --git a/src/render/Draw.h b/src/render/Draw.h index bacbe18f..bd97f76f 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -18,7 +18,6 @@ enum eSpriteScalingMode { SCL_PC, SCL_PS2, - SCL_AUTO, }; class CDraw @@ -41,6 +40,11 @@ public: static uint8 FadeRed; static uint8 FadeGreen; static uint8 FadeBlue; +#ifdef ASPECT_RATIO_SCALE + static int32 ms_nScalingMode; + static int32 ms_bFixRadar; + static int32 ms_bFixSprites; +#endif static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; } static float GetNearClipZ(void) { return ms_fNearClipZ; } diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 2adcbb81..b6f173c7 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1060,14 +1060,17 @@ void CHud::Draw() DrawRadar */ #ifdef ASPECT_RATIO_SCALE -#define _RADAR_WIDTH ((CMenuManager::m_PrefsSpriteScalingMode==SCL_AUTO) ? (RADAR_HEIGHT) : (RADAR_WIDTH)) +// The values are from from an early screenshot taken before R* broke radar +#define _RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_WIDTH)) +#define _RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_HEIGHT)) #else #define _RADAR_WIDTH RADAR_WIDTH +#define _RADAR_HEIGHT RADAR_HEIGHT #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)); - rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + 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 PS2_HUD #ifdef FIX_BUGS diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 4be64ef2..390737f3 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -41,7 +41,7 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, *outh = fovScale * recip * SCREEN_HEIGHT; #ifdef ASPECT_RATIO_SCALE - if ( CMenuManager::m_PrefsSpriteScalingMode==SCL_AUTO ) + if ( CDraw::ms_bFixSprites ) *outw = fovScale * recip * SCREEN_HEIGHT; #endif diff --git a/utils/gxt/american.txt b/utils/gxt/american.txt index 3d5d25c5..76b51a89 100644 --- a/utils/gxt/american.txt +++ b/utils/gxt/american.txt @@ -8058,9 +8058,6 @@ NEO [FEM_PS2] PS2 -[FEM_PC] -PC - [FEM_XBX] XBOX @@ -8073,9 +8070,6 @@ INVERT PAD VERTICALLY [FEM_TWP] Toggle Waypoint -[FEC_SCL] -SPRITE SCALING MODE - { end of file } [DUMMY] -- cgit v1.2.3 From 148383ff53845fdec41c65aeb0770df46864bd0e Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 6 Jan 2021 18:56:13 +0300 Subject: upd --- src/core/Radar.cpp | 2 +- src/render/Hud.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 7af51929..f8227bf7 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1298,7 +1298,7 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &i #endif { #ifdef ASPECT_RATIO_SCALE -// The values are from from an early screenshot taken before R* broke radar +// The values are from an early screenshot taken before R* broke radar #define _RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_WIDTH)) #define _RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_HEIGHT)) #else diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index b6f173c7..84146fba 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1060,7 +1060,7 @@ void CHud::Draw() DrawRadar */ #ifdef ASPECT_RATIO_SCALE -// The values are from from an early screenshot taken before R* broke radar +// The values are from an early screenshot taken before R* broke radar #define _RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_WIDTH)) #define _RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_HEIGHT)) #else -- cgit v1.2.3 From 368d2f3279b474056e888dcccea234f32614b506 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Fri, 8 Jan 2021 19:31:48 +0300 Subject: bb .ini hello defines --- src/core/Radar.cpp | 15 +++------------ src/core/Radar.h | 18 ++++++++++++++++++ src/core/common.h | 6 +----- src/core/config.h | 4 ++++ src/core/re3.cpp | 12 ------------ src/render/Draw.cpp | 20 +------------------- src/render/Draw.h | 15 --------------- src/render/Hud.cpp | 12 ++---------- src/render/Sprite.cpp | 9 ++++----- 9 files changed, 33 insertions(+), 78 deletions(-) diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index f8227bf7..816da6b9 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1297,21 +1297,12 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &i } else #endif { -#ifdef ASPECT_RATIO_SCALE -// The values are from an early screenshot taken before R* broke radar -#define _RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_WIDTH)) -#define _RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_HEIGHT)) -#else -#define _RADAR_WIDTH RADAR_WIDTH -#define _RADAR_HEIGHT RADAR_HEIGHT -#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); + 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/Radar.h b/src/core/Radar.h index 5caf5bbb..725c8351 100644 --- a/src/core/Radar.h +++ b/src/core/Radar.h @@ -91,8 +91,26 @@ VALIDATE_SIZE(sRadarTrace, 0x30); #else #define RADAR_BOTTOM (47.0f) #endif + +#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) +#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_HEIGHT (76.0f) +#endif class CRadar { diff --git a/src/core/common.h b/src/core/common.h index 44d94370..5767b087 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(ASPECT_RATIO_SCALE) +#if defined(PROPER_SCALING) || defined(PS2_HUD) #ifdef FORCE_PC_SCALING #define DEFAULT_SCREEN_WIDTH (640) #define DEFAULT_SCREEN_HEIGHT (448) @@ -176,10 +176,6 @@ 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))) - #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/core/config.h b/src/core/config.h index a9bb1a17..3d5ef281 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -241,6 +241,7 @@ enum Config { //# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names. // NB: keep this enabled unless your map IDEs have these flags baked in #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 USE_TXD_CDIMAGE // generate and load textures from txd.img #define PS2_ALPHA_TEST // emulate ps2 alpha test @@ -254,6 +255,8 @@ enum Config { #define SCREEN_DROPLETS // neo water droplets #endif +#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc) + #ifndef EXTENDED_COLOURFILTER #undef SCREEN_DROPLETS // we need the backbuffer for this effect #endif @@ -282,6 +285,7 @@ enum Config { #define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better. // #define BETA_SLIDING_TEXT #define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC +#define FIX_RADAR // use radar size from early version before R* broke it // #define XBOX_SUBTITLES // the infamous outlines #define RADIO_OFF_TEXT #define PC_MENU diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 14457db4..87244e2a 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -214,12 +214,6 @@ void LoadINISettings() CustomPipes::LightmapMult = CheckAndReadIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult); CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult); #endif - -#ifdef ASPECT_RATIO_SCALE - CDraw::ms_nScalingMode = CheckAndReadIniInt("Draw", "ScalingMode", CDraw::ms_nScalingMode); - CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar); - CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSpritesAspectRatio", CDraw::ms_bFixSprites); -#endif } void SaveINISettings() @@ -259,12 +253,6 @@ void SaveINISettings() CheckAndSaveIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult, changed); #endif -#ifdef ASPECT_RATIO_SCALE - CheckAndSaveIniInt("Draw", "ScalingMode", CDraw::ms_nScalingMode, changed); - CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed); - CheckAndSaveIniInt("Draw", "FixSpritesAspectRatio", 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 42015176..fcd5d18f 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -20,12 +20,6 @@ uint8 CDraw::FadeRed; uint8 CDraw::FadeGreen; uint8 CDraw::FadeBlue; -#ifdef ASPECT_RATIO_SCALE -int32 CDraw::ms_nScalingMode = SCL_PS2; -int32 CDraw::ms_bFixRadar = true; -int32 CDraw::ms_bFixSprites = true; -#endif - float CDraw::FindAspectRatio(void) { @@ -81,16 +75,4 @@ CDraw::SetFOV(float fov) ms_fScaledFOV = fov; #endif ms_fFOV = fov; -} - -#ifdef ASPECT_RATIO_SCALE -float CDraw::ScaleY(float y) -{ - switch ( ms_nScalingMode ) - { - case SCL_PC: return y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC); - default: - return y; - } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/src/render/Draw.h b/src/render/Draw.h index bd97f76f..45f7906f 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -14,12 +14,6 @@ enum eAspectRatio AR_MAX, }; -enum eSpriteScalingMode -{ - SCL_PC, - SCL_PS2, -}; - class CDraw { private: @@ -40,11 +34,6 @@ public: static uint8 FadeRed; static uint8 FadeGreen; static uint8 FadeBlue; -#ifdef ASPECT_RATIO_SCALE - static int32 ms_nScalingMode; - static int32 ms_bFixRadar; - static int32 ms_bFixSprites; -#endif static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; } static float GetNearClipZ(void) { return ms_fNearClipZ; } @@ -67,8 +56,4 @@ 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 84146fba..ae7b7eb3 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1059,18 +1059,10 @@ void CHud::Draw() /* DrawRadar */ -#ifdef ASPECT_RATIO_SCALE -// The values are from an early screenshot taken before R* broke radar -#define _RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_WIDTH)) -#define _RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (RADAR_HEIGHT)) -#else -#define _RADAR_WIDTH RADAR_WIDTH -#define _RADAR_HEIGHT RADAR_HEIGHT -#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)); - rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + _RADAR_HEIGHT)); + 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 PS2_HUD #ifdef FIX_BUGS diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 390737f3..c31c75d2 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -37,13 +37,12 @@ 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 = fovScale * recip * SCREEN_HEIGHT; +#else *outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH; - *outh = fovScale * recip * SCREEN_HEIGHT; - -#ifdef ASPECT_RATIO_SCALE - if ( CDraw::ms_bFixSprites ) - *outw = fovScale * recip * SCREEN_HEIGHT; #endif + *outh = fovScale * recip * SCREEN_HEIGHT; return true; } -- cgit v1.2.3