Add PSP scaling macros

This commit is contained in:
Sergeanur 2021-01-23 18:56:27 +02:00
parent de44a17e64
commit 13507d422b
2 changed files with 24 additions and 16 deletions

View file

@ -200,6 +200,13 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x) #define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
#endif #endif
#define PSP_DEFAULT_SCREEN_WIDTH (480)
#define PSP_DEFAULT_SCREEN_HEIGHT (272)
#define PSP_SCREEN_SCALE_X(a) SCREEN_SCALE_AR(SCREEN_STRETCH_X(a * ((float)DEFAULT_SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH)))
#define PSP_SCREEN_SCALE_Y(a) SCREEN_STRETCH_Y(a* ((float)DEFAULT_SCREEN_HEIGHT / PSP_DEFAULT_SCREEN_HEIGHT))
#define PSP_SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - PSP_SCREEN_SCALE_X(a))
#define PSP_SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - PSP_SCREEN_SCALE_Y(a))
#include "maths.h" #include "maths.h"
#include "Vector.h" #include "Vector.h"
#include "Vector2D.h" #include "Vector2D.h"

View file

@ -45,8 +45,8 @@ CRGBA ARMOUR_COLOR(185, 185, 185, 255);
CRGBA NOTWANTED_COLOR(27, 89, 130, 255); CRGBA NOTWANTED_COLOR(27, 89, 130, 255);
CRGBA WANTED_COLOR_FLASH(62, 141, 181, 255); CRGBA WANTED_COLOR_FLASH(62, 141, 181, 255);
CRGBA WANTED_COLOR(97, 194, 247, 255); CRGBA WANTED_COLOR(97, 194, 247, 255);
CRGBA ZONE_COLOR(45, 155, 90, 255); CRGBA ZONE_COLOR(255, 255, 255, 255);
CRGBA VEHICLE_COLOR(97, 194, 247, 255); CRGBA VEHICLE_COLOR(255, 255, 255, 255);
CRGBA CLOCK_COLOR(97, 194, 247, 255); CRGBA CLOCK_COLOR(97, 194, 247, 255);
CRGBA TIMER_COLOR(97, 194, 247, 255); CRGBA TIMER_COLOR(97, 194, 247, 255);
CRGBA COUNTER_COLOR(97, 194, 247, 255); CRGBA COUNTER_COLOR(97, 194, 247, 255);
@ -785,14 +785,14 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_SPANISH) if (FrontEndMenuManager.m_PrefsUseWideScreen)
CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.8f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(PSP_SCREEN_SCALE_X(0.42768f), PSP_SCREEN_SCALE_Y(0.88f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(PSP_SCREEN_SCALE_X(0.4752f), PSP_SCREEN_SCALE_Y(0.88f));
CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f));
CFont::SetSlant(0.15f);
//CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f));
//CFont::SetSlant(0.15f);
CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
@ -802,9 +802,9 @@ void CHud::Draw()
CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha)); CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
if (!CTheScripts::bPlayerIsInTheStatium) if (!CTheScripts::bPlayerIsInTheStatium)
CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint); CFont::PrintStringFromBottom(PSP_SCREEN_SCALE_FROM_RIGHT(24.0f), PSP_SCREEN_SCALE_FROM_BOTTOM(16.0f), m_ZoneToPrint);
CFont::SetSlant(0.f); //CFont::SetSlant(0.f);
} else { } else {
m_ZoneState = 3; m_ZoneState = 3;
} }
@ -885,13 +885,14 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (FrontEndMenuManager.m_PrefsLanguage != CMenuManager::LANGUAGE_ITALIAN && FrontEndMenuManager.m_PrefsLanguage != CMenuManager::LANGUAGE_SPANISH) if (FrontEndMenuManager.m_PrefsUseWideScreen)
CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(PSP_SCREEN_SCALE_X(0.42768f), PSP_SCREEN_SCALE_Y(0.88f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.85f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(PSP_SCREEN_SCALE_X(0.4752f), PSP_SCREEN_SCALE_Y(0.88f));
CFont::SetSlantRefPoint(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f)); CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetSlant(0.15f); CFont::SetSlantRefPoint(PSP_SCREEN_SCALE_FROM_RIGHT(24.0f), PSP_SCREEN_SCALE_FROM_BOTTOM(35.6f));
CFont::SetSlant(0.f);
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f); CFont::SetRightJustifyWrap(0.0f);
@ -901,7 +902,7 @@ void CHud::Draw()
CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha)); CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha));
CFont::SetDropColor(CRGBA(0, 0, 0, fVehicleAlpha)); CFont::SetDropColor(CRGBA(0, 0, 0, fVehicleAlpha));
CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f), m_pVehicleNameToPrint); CFont::PrintStringFromBottom(PSP_SCREEN_SCALE_FROM_RIGHT(24.0f), PSP_SCREEN_SCALE_FROM_BOTTOM(35.6f), m_pVehicleNameToPrint);
CFont::SetSlant(0.f); CFont::SetSlant(0.f);
} }