Fixed menu radio icons.

This commit is contained in:
gennariarmando 2020-04-17 20:22:33 +02:00
parent 5922a9b88d
commit e41c32df43
2 changed files with 43 additions and 43 deletions

View File

@ -118,7 +118,7 @@ const CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255);
const CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color const CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color
#endif #endif
const float menuXYpadding = MENUACTION_POS_Y; // *(float*)0x5F355C; // not original name const float menuXYpadding = MENUACTION_POS_Y; // TODO this is non-existant, remove it
float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE; float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE;
float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE; float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE;
@ -167,15 +167,15 @@ const char* FrontendFilenames[][2] = {
{"fe_arrows2", "" }, {"fe_arrows2", "" },
{"fe_arrows3", "" }, {"fe_arrows3", "" },
{"fe_arrows4", "" }, {"fe_arrows4", "" },
{"fe_radio1", "" }, // HEAD_RADIO {"fe_radio1", "" },
{"fe_radio2", "" }, // DOUBLE_CLEF {"fe_radio2", "" },
{"fe_radio3", "" }, // JAH_RADIO {"fe_radio3", "" },
{"fe_radio4", "" }, // RISE_FM {"fe_radio4", "" },
{"fe_radio5", "" }, // LIPS_106 {"fe_radio5", "" },
{"fe_radio6", "" }, // GAME_FM {"fe_radio6", "" },
{"fe_radio7", "" }, // MSX_FM {"fe_radio7", "" },
{"fe_radio8", "" }, // FLASHBACK {"fe_radio8", "" },
{"fe_radio9", "" }, // CHATTERBOX {"fe_radio9", "" },
}; };
#ifdef MENU_MAP #ifdef MENU_MAP
@ -231,7 +231,8 @@ ScaleAndCenterX(float x)
else { else {
if (x > DEFAULT_SCREEN_WIDTH / 2) { if (x > DEFAULT_SCREEN_WIDTH / 2) {
return SCREEN_WIDTH / 2 + SCREEN_SCALE_X(x - DEFAULT_SCREEN_WIDTH / 2); return SCREEN_WIDTH / 2 + SCREEN_SCALE_X(x - DEFAULT_SCREEN_WIDTH / 2);
} else { }
else {
return SCREEN_WIDTH / 2 - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH / 2 - x); return SCREEN_WIDTH / 2 - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH / 2 - x);
} }
} }
@ -303,6 +304,11 @@ ScaleAndCenterX(float x)
m_nHoverOption = HOVEROPTION_NOT_HOVERING; \ m_nHoverOption = HOVEROPTION_NOT_HOVERING; \
} while(0) } while(0)
#define ProcessRadioIcon(sprite, x, y, radioId, hoverOpt) \
sprite.Draw(x, y, MENU_X(MENURADIO_ICON_SCALE), MENU_Y(MENURADIO_ICON_SCALE), radioId == m_PrefsRadioStation ? CRGBA(255, 255, 255, 255) : CRGBA(225, 0, 0, 170)); \
if (CheckHover(x, x + MENU_X(MENURADIO_ICON_SCALE), y, y + MENU_Y(MENURADIO_ICON_SCALE))) \
m_nHoverOption = hoverOpt;
// --- Functions not in the game/inlined starts // --- Functions not in the game/inlined starts
inline void inline void
@ -754,9 +760,9 @@ CMenuManager::Draw()
#ifdef FIX_BUGS #ifdef FIX_BUGS
// Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in here. // Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in here.
CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(menuXYpadding), str); CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(MENUACTION_POS_Y), str);
#else #else
CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str); CFont::PrintString(MENU_X_MARGIN, MENUACTION_POS_Y, str);
#endif #endif
} }
@ -1253,27 +1259,21 @@ CMenuManager::Draw()
nextYToUse += lineHeight * CFont::GetNumberLines(menuXYpadding, nextYToUse, leftText); nextYToUse += lineHeight * CFont::GetNumberLines(menuXYpadding, nextYToUse, leftText);
// TODO: This should be rewritten as multiple macro calls instead of loop, radio order is wrong. // Radio icons
// And hover detection is missing.
float fIconSpacing = 59.52f;
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_RADIO) { if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_RADIO) {
for (int i = 0; i < POLICE_RADIO; i++) { ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO1], MENU_X_LEFT_ALIGNED(30.0f), MENU_Y(nextYToUse), 0, HOVEROPTION_RADIO_0);
#ifndef ASPECT_RATIO_SCALE ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO2], MENU_X_LEFT_ALIGNED(90.0f), MENU_Y(nextYToUse), 1, HOVEROPTION_RADIO_1);
if (i < USERTRACK) ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO5], MENU_X_LEFT_ALIGNED(150.0f), MENU_Y(nextYToUse), 2, HOVEROPTION_RADIO_2);
m_aFrontEndSprites[i + FE_RADIO1].Draw(SCREEN_STRETCH_X(MENURADIO_ICON_X + fIconSpacing * i), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(MENURADIO_ICON_Y), SCREEN_SCALE_X(MENURADIO_ICON_W), SCREEN_SCALE_Y(MENURADIO_ICON_H), i == m_PrefsRadioStation ? CRGBA(255, 255, 255, 255) : CRGBA(225, 0, 0, 170)); ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO7], MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(nextYToUse), 3, HOVEROPTION_RADIO_3);
if (i > CHATTERBOX && DMAudio.IsMP3RadioChannelAvailable()) ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO8], MENU_X_LEFT_ALIGNED(270.0f), MENU_Y(nextYToUse), 4, HOVEROPTION_RADIO_4);
m_aMenuSprites[MENUSPRITE_MP3LOGO].Draw(SCREEN_STRETCH_X(MENURADIO_ICON_X + fIconSpacing * i), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(MENURADIO_ICON_Y), SCREEN_SCALE_X(MENURADIO_ICON_W), SCREEN_SCALE_Y(MENURADIO_ICON_H), i == m_PrefsRadioStation ? CRGBA(255, 255, 255, 255) : CRGBA(225, 0, 0, 170)); ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO3], MENU_X_LEFT_ALIGNED(320.0f), MENU_Y(nextYToUse), 5, HOVEROPTION_RADIO_5);
#else ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO4], MENU_X_LEFT_ALIGNED(360.0f), MENU_Y(nextYToUse), 6, HOVEROPTION_RADIO_6);
float fMp3Pos = 0.0f; ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO6], MENU_X_LEFT_ALIGNED(420.0f), MENU_Y(nextYToUse), 7, HOVEROPTION_RADIO_7);
if (DMAudio.IsMP3RadioChannelAvailable()) ProcessRadioIcon(m_aFrontEndSprites[FE_RADIO9], MENU_X_LEFT_ALIGNED(480.0f), MENU_Y(nextYToUse), 8, HOVEROPTION_RADIO_8);
fMp3Pos = 34.0f;
if (DMAudio.IsMP3RadioChannelAvailable())
ProcessRadioIcon(m_aMenuSprites[MENUSPRITE_MP3LOGO], MENU_X_LEFT_ALIGNED(540.0f), MENU_Y(nextYToUse), 9, HOVEROPTION_RADIO_9);
if (i < USERTRACK)
m_aFrontEndSprites[i + FE_RADIO1].Draw((SCREEN_WIDTH * 0.5) + SCREEN_SCALE_X(-fMp3Pos + MENURADIO_ICON_X + (fIconSpacing * i)), MENU_Y(nextYToUse), MENU_X(menuXYpadding), MENU_Y(menuXYpadding), i == m_PrefsRadioStation ? CRGBA(255, 255, 255, 255) : CRGBA(225, 0, 0, 170));
if (i > CHATTERBOX && DMAudio.IsMP3RadioChannelAvailable())
m_aMenuSprites[MENUSPRITE_MP3LOGO].Draw((SCREEN_WIDTH * 0.5) + SCREEN_SCALE_X(-fMp3Pos + MENURADIO_ICON_X + (fIconSpacing * i)), MENU_Y(nextYToUse), MENU_X(menuXYpadding), MENU_Y(menuXYpadding), i == m_PrefsRadioStation ? CRGBA(255, 255, 255, 255) : CRGBA(225, 0, 0, 170));
#endif
}
nextYToUse += 70.0f; nextYToUse += 70.0f;
} }
} }
@ -3181,7 +3181,7 @@ CMenuManager::PrintBriefs()
CFont::SetRightJustifyOff(); CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
float nextY = 40.0f; float nextY = BRIEFS_TOP_MARGIN;
CRGBA newColor; CRGBA newColor;
for (int i = 4; i >= 0; i--) { for (int i = 4; i >= 0; i--) {
tPreviousBrief &brief = CMessages::PreviousBriefs[i]; tPreviousBrief &brief = CMessages::PreviousBriefs[i];
@ -3214,8 +3214,8 @@ CMenuManager::PrintBriefs()
newColor.a = FadeIn(255); newColor.a = FadeIn(255);
CFont::SetColor(newColor); CFont::SetColor(newColor);
#endif #endif
CFont::PrintString(MENU_X_LEFT_ALIGNED(50.0f), nextY, gUString); CFont::PrintString(MENU_X_LEFT_ALIGNED(BRIEFS_LINE_X), nextY, gUString);
nextY += MENU_Y(menuXYpadding); nextY += MENU_Y(BRIEFS_LINE_HEIGHT);
} }
} }
@ -3252,6 +3252,9 @@ void
CMenuManager::PrintStats() CMenuManager::PrintStats()
{ {
int rowNum = ConstructStatLine(99999); int rowNum = ConstructStatLine(99999);
#ifdef GTA3_1_1_PATCH
CFont::SetFontStyle(FONT_BANK);
#endif
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
float nextYChange, y, alphaMult; float nextYChange, y, alphaMult;

View File

@ -18,14 +18,7 @@
#define MENUACTION_WIDTH 38.0f #define MENUACTION_WIDTH 38.0f
#define MENUACTION_SCALE_MULT 0.9f #define MENUACTION_SCALE_MULT 0.9f
#ifndef ASPECT_RATIO_SCALE #define MENURADIO_ICON_SCALE 60.0f
#define MENURADIO_ICON_X 31.5f
#else
#define MENURADIO_ICON_X -262.0f
#endif
#define MENURADIO_ICON_Y 29.5f
#define MENURADIO_ICON_W 60.0f
#define MENURADIO_ICON_H 60.0f
#define MENUSLIDER_X 256.0f #define MENUSLIDER_X 256.0f
#define MENUSLIDER_UNK 256.0f #define MENUSLIDER_UNK 256.0f
@ -68,6 +61,10 @@
#define STATS_RATING_X 24.0f #define STATS_RATING_X 24.0f
#define STATS_RATING_Y 20.0f #define STATS_RATING_Y 20.0f
#define BRIEFS_TOP_MARGIN 40.0f
#define BRIEFS_LINE_X 50.0f
#define BRIEFS_LINE_HEIGHT 60.0f
#define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f #define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f
#define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f #define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f
#define CONTSETUP_BOUND_HIGHLIGHT_HEIGHT 10 #define CONTSETUP_BOUND_HIGHLIGHT_HEIGHT 10