match frontend to vc more; isolate crgba

This commit is contained in:
Xinerki 2020-05-19 13:47:55 +03:00
parent 00ee82aba6
commit 9e14e8553f
2 changed files with 41 additions and 19 deletions

View File

@ -37,6 +37,18 @@
#include "Messages.h" #include "Messages.h"
#include "FileLoader.h" #include "FileLoader.h"
// Similar story to Hud.cpp:
// Game has colors inlined in code.
// For easier modification we collect them here:
CRGBA LABEL_COLOR(255, 150, 225, 255);
CRGBA SELECTIONBORDER_COLOR(25, 130, 70, 255);
CRGBA MENUOPTION_COLOR(255, 150, 225, 255);
CRGBA SELECTEDMENUOPTION_COLOR(255, 150, 225, 255);
CRGBA HEADER_COLOR(255, 150, 255, 255);
CRGBA DARKMENUOPTION_COLOR(195, 90, 165, 255);
CRGBA SLIDERON_COLOR(97, 194, 247, 255);
CRGBA SLIDEROFF_COLOR(27, 89, 130, 255);
#define TIDY_UP_PBP // ProcessButtonPresses #define TIDY_UP_PBP // ProcessButtonPresses
#define MAX_VISIBLE_LIST_ROW 30 #define MAX_VISIBLE_LIST_ROW 30
#define SCROLLBAR_MAX_HEIGHT 263.0f // not in end result #define SCROLLBAR_MAX_HEIGHT 263.0f // not in end result
@ -269,7 +281,7 @@ ScaleAndCenterX(float x)
#endif #endif
#define PREPARE_MENU_HEADER \ #define PREPARE_MENU_HEADER \
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); \ CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255))); \
CFont::SetRightJustifyOn(); \ CFont::SetRightJustifyOn(); \
CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); \ CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); \
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
@ -636,15 +648,15 @@ CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostR
int lastActiveBarX = 0; int lastActiveBarX = 0;
float curBarX = 0.0f; float curBarX = 0.0f;
float spacing = SCREEN_SCALE_X(10.0f); float spacing = SCREEN_SCALE_X(4.0f); // TODO: find actual numbers used in the game
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
curBarX = i * rectSize/16.0f + x; curBarX = i * rectSize/32.0f + x;
if (i / 16.0f + 1 / 32.0f < progress) { if (i / 16.0f + 1 / 32.0f < progress) {
color = CRGBA(255, 217, 106, FadeIn(255)); color = CRGBA(SLIDERON_COLOR.r, SLIDERON_COLOR.g, SLIDERON_COLOR.b, FadeIn(255));
lastActiveBarX = curBarX; lastActiveBarX = curBarX;
} else } else
color = CRGBA(185, 120, 0, FadeIn(255)); color = CRGBA(SLIDEROFF_COLOR.r, SLIDEROFF_COLOR.g, SLIDEROFF_COLOR.b, FadeIn(255));
maxBarHeight = Max(mostLeftBarSize, mostRightBarSize); maxBarHeight = Max(mostLeftBarSize, mostRightBarSize);
@ -685,8 +697,10 @@ CMenuManager::Draw()
CFont::SetCentreOff(); CFont::SetCentreOff();
CFont::SetJustifyOn(); CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn(); CFont::SetBackGroundOnlyTextOn();
#ifdef GTA3_1_1_PATCH
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); // no V1.1 text in vc obv
#if 0 //def GTA3_1_1_PATCH
CFont::SetColor(CRGBA(255, 150, 225, FadeIn(255)));
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
CFont::SetScale(MENU_X(0.7f), MENU_Y(0.5f)); CFont::SetScale(MENU_X(0.7f), MENU_Y(0.5f));
@ -696,6 +710,7 @@ CMenuManager::Draw()
AsciiToUnicode(gString, gUString); AsciiToUnicode(gString, gUString);
CFont::PrintString(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 45, gUString); CFont::PrintString(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 45, gUString);
#endif #endif
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH)); CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
@ -721,9 +736,13 @@ CMenuManager::Draw()
if(!m_bRenderGameInMenu) if(!m_bRenderGameInMenu)
#endif #endif
if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') { if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') {
PREPARE_MENU_HEADER PREPARE_MENU_HEADER
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255)));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(17.f), SCREEN_SCALE_Y(17.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
PREPARE_MENU_HEADER
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(10.f), SCREEN_SCALE_Y(10.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
// Weird place to put that. // Weird place to put that.
nextYToUse += 24.0f + 10.0f; nextYToUse += 24.0f + 10.0f;
@ -732,7 +751,7 @@ CMenuManager::Draw()
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y)); CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y));
CFont::SetRightJustifyOff(); CFont::SetRightJustifyOff();
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); CFont::SetColor(CRGBA(LABEL_COLOR.r, LABEL_COLOR.g, LABEL_COLOR.b, FadeIn(255)));
// Label // Label
wchar *str; wchar *str;
@ -830,7 +849,7 @@ CMenuManager::Draw()
break; break;
case MENUPAGE_START_MENU: case MENUPAGE_START_MENU:
columnWidth = 320; columnWidth = 320;
headerHeight = 140; headerHeight = 110;
lineHeight = 24; lineHeight = 24;
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE));
@ -883,7 +902,7 @@ CMenuManager::Draw()
} }
float usableLineHeight = lineHeight * 0.9f; // also height of biggest bar in slider float usableLineHeight = lineHeight * 0.9f; // also height of biggest bar in slider
float smallestSliderBar = lineHeight * 0.1f; float smallestSliderBar = lineHeight * 0.25f; // TODO: find actual number
bool foundTheHoveringItem = false; bool foundTheHoveringItem = false;
wchar unicodeTemp[64]; wchar unicodeTemp[64];
char asciiTemp[32]; char asciiTemp[32];
@ -1211,7 +1230,7 @@ CMenuManager::Draw()
// We keep stretching, because we also stretch background image and we want that bar to be aligned with borders of background // We keep stretching, because we also stretch background image and we want that bar to be aligned with borders of background
CSprite2d::DrawRect(CRect(StretchX(10.0f), MENU_Y(bitAboveNextItemY), CSprite2d::DrawRect(CRect(StretchX(10.0f), MENU_Y(bitAboveNextItemY),
SCREEN_STRETCH_FROM_RIGHT(11.0f), MENU_Y(usableLineHeight + nextItemY)), SCREEN_STRETCH_FROM_RIGHT(11.0f), MENU_Y(usableLineHeight + nextItemY)),
CRGBA(100, 200, 50, FadeIn(50))); CRGBA(SELECTIONBORDER_COLOR.r, SELECTIONBORDER_COLOR.g, SELECTIONBORDER_COLOR.b, FadeIn(255)));
} }
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90))); CFont::SetColor(CRGBA(0, 0, 0, FadeIn(90)));
@ -1230,14 +1249,14 @@ CMenuManager::Draw()
if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES") if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES")
&& !m_bGameNotLoaded && textLayer == 1) { && !m_bGameNotLoaded && textLayer == 1) {
CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255))); CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
} }
CFont::PrintString(MENU_X_RIGHT_ALIGNED(columnWidth - textLayer), itemY, rightText); CFont::PrintString(MENU_X_RIGHT_ALIGNED(columnWidth - textLayer), itemY, rightText);
} }
if (i == m_nCurrOption && itemsAreSelectable){ if (i == m_nCurrOption && itemsAreSelectable){
CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255))); CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
} else { } else {
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); CFont::SetColor(CRGBA(SELECTEDMENUOPTION_COLOR.r, SELECTEDMENUOPTION_COLOR.g, SELECTEDMENUOPTION_COLOR.b, FadeIn(255)));
} }
} }
@ -2361,12 +2380,15 @@ CMenuManager::DrawFrontEndNormal()
// GTA LOGO // GTA LOGO
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
/*
if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_PAUSE_MENU) { if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_PAUSE_MENU) {
if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame) if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(205.0f), MENU_Y(70.0f), MENU_X_LEFT_ALIGNED(435.0f), MENU_Y(180.0f)), CRGBA(255, 255, 255, FadeIn(255))); m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(205.0f), MENU_Y(70.0f), MENU_X_LEFT_ALIGNED(435.0f), MENU_Y(180.0f)), CRGBA(255, 255, 255, FadeIn(255)));
else else
m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(225.0f), MENU_Y(40.0f), MENU_X_LEFT_ALIGNED(415.0f), MENU_Y(210.0f)), CRGBA(255, 255, 255, FadeIn(255))); m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X_LEFT_ALIGNED(225.0f), MENU_Y(40.0f), MENU_X_LEFT_ALIGNED(415.0f), MENU_Y(210.0f)), CRGBA(255, 255, 255, FadeIn(255)));
} }
*/
m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_SCALE_X(27.0f), MENU_Y(8.0f), SCREEN_SCALE_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255)));
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP); RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);

View File

@ -7,8 +7,8 @@
#define MENUHEADER_POS_Y 75.0f #define MENUHEADER_POS_Y 75.0f
#define MENUHEADER_HEIGHT 1.3f #define MENUHEADER_HEIGHT 1.3f
#else #else
#define MENUHEADER_POS_X 35.0f #define MENUHEADER_POS_X 0.0f
#define MENUHEADER_POS_Y 93.0f #define MENUHEADER_POS_Y 412.0f
#define MENUHEADER_HEIGHT 1.6f #define MENUHEADER_HEIGHT 1.6f
#endif #endif
#define MENUHEADER_WIDTH 0.84f #define MENUHEADER_WIDTH 0.84f
@ -20,7 +20,7 @@
#define MENURADIO_ICON_SCALE 60.0f #define MENURADIO_ICON_SCALE 60.0f
#define MENUSLIDER_X 256.0f #define MENUSLIDER_X 128.0f
#define MENUSLIDER_UNK 256.0f #define MENUSLIDER_UNK 256.0f
#define BIGTEXT_X_SCALE 0.75f #define BIGTEXT_X_SCALE 0.75f