ps2 hud, restore original code

This commit is contained in:
Fire-Head
2020-12-07 21:12:13 +03:00
parent 0fbf624623
commit c5fbb594a5
17 changed files with 954 additions and 358 deletions

View File

@ -39,11 +39,20 @@ CCredits::PrintCreditSpace(float space, uint32 &line)
void
CCredits::PrintCreditText(float scaleX, float scaleY, wchar *text, uint32 &lineoffset, float scrolloffset)
{
#ifdef FIX_BUGS
float start = DEFAULT_SCREEN_HEIGHT + 50.0f;
#else
float start = SCREEN_HEIGHT + 50.0f;
#endif
float y = lineoffset + start - scrolloffset;
if(y > -50.0f && y < start){
#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(scaleX), SCREEN_SCALE_Y(scaleY));
CFont::PrintString(SCREEN_WIDTH/2.0f, SCREEN_SCALE_Y(y), (uint16*)text);
#else
CFont::SetScale(scaleX, scaleY);
CFont::PrintString(SCREEN_WIDTH/2.0f, y, (uint16*)text);
#endif
}
lineoffset += scaleY*25.0f;
}
@ -62,7 +71,11 @@ CCredits::Render(void)
scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f;
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
#ifdef FIX_BUGS
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
#else
CFont::SetCentreSize(SCREEN_WIDTH - 20);
#endif
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(220, 220, 220, 220));
@ -489,8 +502,14 @@ CCredits::Render(void)
if(TheCamera.m_WideScreenOn)
TheCamera.DrawBordersForWideScreen();
#ifdef FIX_BUGS
if(lineoffset + DEFAULT_SCREEN_HEIGHT - scrolloffset < -10.0f)
#else
if(lineoffset + SCREEN_HEIGHT - scrolloffset < -10.0f)
#endif
{
bCreditsGoing = false;
}
}
bool CCredits::AreCreditsDone(void)

View File

@ -267,13 +267,18 @@ CFont::Initialise(void)
SetScale(1.0f, 1.0f);
SetSlantRefPoint(SCREEN_WIDTH, 0.0f);
SetSlant(0.0f);
SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0));
SetColor(CRGBA(255, 255, 255, 0));
SetJustifyOff();
SetCentreOff();
SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
SetCentreSize(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
#ifdef FIX_BUGS
SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
#else
SetWrapx(DEFAULT_SCREEN_WIDTH);
SetCentreSize(DEFAULT_SCREEN_WIDTH);
#endif
SetBackgroundOff();
SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80));
SetBackgroundColor(CRGBA(128, 128, 128, 128));
SetBackGroundOnlyTextOff();
SetPropOn();
SetFontStyle(FONT_BANK);
@ -360,7 +365,11 @@ void
CFont::PrintChar(float x, float y, wchar c)
{
if(x <= 0.0f || x > SCREEN_WIDTH ||
y <= 0.0f || y > SCREEN_HEIGHT) // BUG: game uses SCREENW again
#ifdef FIX_BUGS
y <= 0.0f || y > SCREEN_HEIGHT)
#else
y <= 0.0f || y > SCREEN_WIDTH)
#endif
return;
float w = GetCharacterWidth(c) / 32.0f;
@ -421,6 +430,7 @@ CFont::PrintChar(float x, float y, wchar c)
xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, (yoff + 1.0f) / 25.6f - 0.0001f);
#endif
}else
{
CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
CRect(x, y,
x + 32.0f * Details.scaleX * w,
@ -430,6 +440,7 @@ CFont::PrintChar(float x, float y, wchar c)
(xoff+w)/16.0f, yoff/16.0f,
xoff/16.0f, (yoff+1.0f)/16.0f,
(xoff+w)/16.0f - 0.0001f, (yoff+1.0f)/16.0f - 0.0001f);
}
}
#ifdef MORE_LANGUAGES

File diff suppressed because it is too large Load Diff

View File

@ -37,63 +37,45 @@ enum eSprites
class CHud
{
public:
static int16 m_ItemToFlash;
static CSprite2d Sprites[NUM_HUD_SPRITES];
static wchar m_HelpMessage[HELP_MSG_LENGTH];
static wchar m_LastHelpMessage[HELP_MSG_LENGTH];
static uint32 m_HelpMessageState;
static uint32 m_HelpMessageTimer;
static int32 m_HelpMessageFadeTimer;
static wchar m_HelpMessageToPrint[HELP_MSG_LENGTH];
static float m_HelpMessageDisplayTime;
static bool m_HelpMessageQuick;
static uint32 m_ZoneState;
static int32 m_ZoneFadeTimer;
static uint32 m_ZoneNameTimer;
static wchar *m_pZoneName;
static wchar *m_pLastZoneName;
static wchar *m_ZoneToPrint;
static wchar *m_VehicleName;
static wchar *m_pLastVehicleName;
static wchar *m_pVehicleNameToPrint;
static uint32 m_VehicleState;
static int32 m_VehicleFadeTimer;
static uint32 m_VehicleNameTimer;
static wchar m_Message[256];
static wchar m_BigMessage[6][128];
static wchar m_PagerMessage[256];
static uint32 m_ZoneNameTimer;
static int32 m_ZoneFadeTimer;
static uint32 m_ZoneState;
static wchar m_HelpMessage[HELP_MSG_LENGTH];
static wchar m_LastHelpMessage[HELP_MSG_LENGTH];
static wchar m_HelpMessageToPrint[HELP_MSG_LENGTH];
static uint32 m_HelpMessageTimer;
static int32 m_HelpMessageFadeTimer;
static uint32 m_HelpMessageState;
static bool m_HelpMessageQuick;
static float m_HelpMessageDisplayTime;
static int32 SpriteBrightness;
static bool m_Wants_To_Draw_Hud;
static bool m_Wants_To_Draw_3dMarkers;
static wchar m_BigMessage[6][128];
static int16 m_ItemToFlash;
// These aren't really in CHud
static float BigMessageInUse[6];
static float BigMessageAlpha[6];
static float BigMessageX[6];
static float OddJob2OffTimer;
static bool CounterOnLastFrame;
static float OddJob2XOffset;
static uint16 CounterFlashTimer;
static uint16 OddJob2Timer;
static bool TimerOnLastFrame;
static int16 OddJob2On;
static uint16 TimerFlashTimer;
static int16 PagerSoundPlayed;
static int32 SpriteBrightness;
static float PagerXOffset;
static int16 PagerTimer;
static int16 PagerOn;
static wchar *m_pVehicleName;
static wchar *m_pLastVehicleName;
static uint32 m_VehicleNameTimer;
static int32 m_VehicleFadeTimer;
static uint32 m_VehicleState;
static wchar *m_pVehicleNameToPrint;
public:
static void Initialise();
static void Shutdown();
static void ReInitialise();
static void GetRidOfAllHudMessages();
static void SetZoneName(wchar *name);
static void SetHelpMessage(wchar *message, bool quick);
static void SetVehicleName(wchar *name);
static void Draw();
static void DrawAfterFade();
static void GetRidOfAllHudMessages();
static void Initialise();
static void ReInitialise();
static void SetBigMessage(wchar *message, uint16 style);
static void SetHelpMessage(wchar *message, bool quick);
static void SetMessage(wchar *message);
static void SetBigMessage(wchar *message, uint16 style);
static void SetPagerMessage(wchar *message);
static void SetVehicleName(wchar *name);
static void SetZoneName(wchar *name);
static void Shutdown();
};

View File

@ -1048,17 +1048,21 @@ CMoneyMessage::Render()
RwV3d vecOut;
float fDistX, fDistY;
if (CSprite::CalcScreenCoors(m_vecPosition + CVector(0.0f, 0.0f, fLifeTime), &vecOut, &fDistX, &fDistY, true)) {
fDistX *= (0.7 * fLifeTime + 2.0) * m_fSize;
fDistY *= (0.7 * fLifeTime + 2.0) * m_fSize;
fDistX *= (0.7f * fLifeTime + 2.0f) * m_fSize;
fDistY *= (0.7f * fLifeTime + 2.0f) * m_fSize;
CFont::SetPropOn();
CFont::SetBackgroundOff();
float fScaleY = Min(fDistY / 100.0f, MAX_SCALE);
float fScaleX = Min(fDistX / 100.0f, MAX_SCALE);
CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here?
#ifdef FIX_BUGS
CFont::SetScale(SCREEN_SCALE_X(fScaleX), SCREEN_SCALE_Y(fScaleY));
#else
CFont::SetScale(fScaleX, fScaleY);
#endif
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetCentreSize(SCREEN_WIDTH);
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity));
CFont::SetBackGroundOnlyTextOff();