From 7ed519c28b15cd2eac41c95cc40e5716dfc5720b Mon Sep 17 00:00:00 2001 From: silent Date: Sun, 22 Dec 2013 19:45:24 +0000 Subject: [PATCH] Renamed some stuff to match libGTASA More textures moved to use SPTA git-svn-id: svn://localhost/vcspc/trunk@29 9f344024-d43e-4b27-bde7-3d027e20192d --- VCS PC/CFont.cpp | 130 +++++++++++--------------------- VCS PC/CFont.h | 33 +++++---- VCS PC/CGridref.cpp | 4 +- VCS PC/CText.cpp | 2 +- VCS PC/Darkel.cpp | 14 ++-- VCS PC/Frontend.cpp | 71 +++++++++--------- VCS PC/Frontend.h | 2 +- VCS PC/Garages.cpp | 10 +-- VCS PC/Hud.cpp | Bin 67388 -> 67982 bytes VCS PC/Hud.h | 8 +- VCS PC/PNGArchive.cpp | 112 +++++++++++++++------------- VCS PC/PNGArchive.h | 18 +++-- VCS PC/Radar.cpp | 30 ++++++++ VCS PC/Radar.h | 11 ++- VCS PC/Script.cpp | 2 +- VCS PC/Sprite.h | 2 +- VCS PC/Stats.cpp | 68 ++++++++--------- VCS PC/StdAfx.h | 6 +- VCS PC/UpdateManager.cpp | 28 +++---- VCS PC/VCSPC.cpp | 140 ++++++++++++++++++----------------- VCS PC/WidescreenSupport.cpp | 8 +- 21 files changed, 358 insertions(+), 341 deletions(-) diff --git a/VCS PC/CFont.cpp b/VCS PC/CFont.cpp index 4729092..6c7bfab 100644 --- a/VCS PC/CFont.cpp +++ b/VCS PC/CFont.cpp @@ -2,76 +2,12 @@ CSprite2d CFont::Sprite[NUM_FONT_SHEETS]; CFont::sFontSizes CFont::Size[NUM_FONT_SHEETS]; +CFont::tDetails& CFont::Details = *(CFont::tDetails*)0xC71A60; WRAPPER void CFont::SetWrapx(float fWrap) { WRAPARG(fWrap); EAXJMP(0x7194D0); } +WRAPPER void CFont::LoadFontValues() { EAXJMP(0x7187C0); } -void CFont::ReadFontsDAT() -{ - DWORD dwFunc = (DWORD)FUNC_CFont__ReadFontsDAT; - _asm call dwFunc -} - -/*signed char Upcase(signed char character, signed char unk) -{ - if ( unk == 1 ) - { - if ( character == 26 ) - return 154; - - if ( character >= 8 && character <= 9 ) - { - unsigned char result = character; - result += 86; - return result; - } - - if ( character == 4 ) - return 93; - - if ( character == 7 ) - return 206; - - if ( character == 14 ) - return 207; - } - if ( character != 1 || unk != 1 ) - { - if ( character == 143 ) - return 205; - - if ( character == 31 ) - return 91; - - if ( character == 6 ) - return 10; - - if ( character == 62 ) - return 32; - - if ( character >= 16 && character <= 25 ) - return (character + 128); - - if ( character >= 33 && character <= 58 ) - return (character + 122); - - if ( character >= 65 && character <= 90 ) - return (character + 90); - - if ( character >= 96 && character <= 118 ) - return (character + 85); - - if ( character >= 119 && character <= 140 ) - return (character + 62); - - if ( character >= 141 && character <= 142 ) - return 204; - } - else - return 208; - return character; -}*/ - -unsigned char CFont::AssignBottomFontIndex(unsigned char character, unsigned char bFontType) +unsigned char CFont::FindSubFontCharacter(char character, unsigned char bFontType) { UNREFERENCED_PARAMETER(bFontType); if ( character == 4 ) @@ -149,26 +85,26 @@ unsigned char CFont::AssignBottomFontIndex(unsigned char character, unsigned cha return character; } -void CFont::SetTextLetterSize(float scaleX, float scaleY) +void CFont::SetScale(float scaleX, float scaleY) { - fontDetails->textLetterSizeX = scaleX; - fontDetails->textLetterSizeY = scaleY; + Details.textLetterSizeX = scaleX; + Details.textLetterSizeY = scaleY; } -void CFont::SetTextLetterSizeWithLanguageScaling(float scaleX, float scaleY) +void CFont::SetScaleLang(float scaleX, float scaleY) { - fontDetails->textLetterSizeY = scaleY; - switch ( menu->GetLanguage() ) + Details.textLetterSizeY = scaleY; + switch ( FrontEndMenuManager.GetLanguage() ) { //case LANG_Spanish: - // fontDetails->textLetterSizeX = scaleX * 0.85f; - // break; + // Details.textLetterSizeX = scaleX * 0.85f; + // return; case LANG_Polish: - fontDetails->textLetterSizeX = scaleX * 0.95f; - break; + Details.textLetterSizeX = scaleX * 0.95f; + return; default: // LANG_English - fontDetails->textLetterSizeX = scaleX; - break; + Details.textLetterSizeX = scaleX; + return; } } @@ -176,17 +112,17 @@ void CFont::SetFontStyle(unsigned char bFont) { if ( bFont == FONT_Hud ) { - fontDetails->bSpriteToUse = 3; - fontDetails->bFontStyle = 1; + Details.bSpriteToUse = 3; + Details.bFontStyle = 1; } else { - fontDetails->bSpriteToUse = bFont; - fontDetails->bFontStyle = 0; + Details.bSpriteToUse = bFont; + Details.bFontStyle = 0; } } -void CFont::SetTextColour(CRGBA colour) +void CFont::SetColor(CRGBA colour) { DWORD dwFunc = (DWORD)FUNC_CFont__SetTextColour; _asm @@ -340,4 +276,28 @@ void CFont::SetTextAlignment(unsigned char bAlign) } WRAPPER void CFont::PrintString(float posX, float posY, const char* pText) { WRAPARG(posX); WRAPARG(posY); WRAPARG(pText); EAXJMP(0x71A700); } -WRAPPER void CFont::PrintStringFromBottom(float posX, float posY, const char* pText) { WRAPARG(posX); WRAPARG(posY); WRAPARG(pText); EAXJMP(0x71A820); } \ No newline at end of file +WRAPPER void CFont::PrintStringFromBottom(float posX, float posY, const char* pText) { WRAPARG(posX); WRAPARG(posY); WRAPARG(pText); EAXJMP(0x71A820); } + +void CFont::Initialise() +{ + CPNGArchive FontsSPTA("models\\fonts.spta"); + FontsSPTA.SetDirectory(nullptr); + + Sprite[0].SetTextureFromSPTA(FontsSPTA, "font1"); + Sprite[1].SetTextureFromSPTA(FontsSPTA, "font2"); + Sprite[2].SetTextureFromSPTA(FontsSPTA, "font3"); + Sprite[3].SetTextureFromSPTA(FontsSPTA, "font4"); + + FontsSPTA.CloseArchive(); + + // TODO: Dummy CFont stuff may not be needed at all? + LoadFontValues(); + + // TODO: Buttons +} + +void CFont::Shutdown() +{ + for ( int i = 0; i < NUM_FONT_SHEETS; ++i ) + Sprite[i].Delete(); +} \ No newline at end of file diff --git a/VCS PC/CFont.h b/VCS PC/CFont.h index 1b4e5d5..56e7553 100644 --- a/VCS PC/CFont.h +++ b/VCS PC/CFont.h @@ -1,9 +1,6 @@ #ifndef __CFONT #define __CFONT -#define WIN32_LEAN_AND_MEAN - -#define FUNC_CFont__ReadFontsDAT 0x7187C0 #define FUNC_CFont__ResetSlantedTextPos 0x719400 #define FUNC_CFont__SetTextSlanted 0x719420 #define FUNC_CFont__SetTextColour 0x719430 @@ -46,7 +43,7 @@ enum eFontFileIDs class CFont { public: - struct Details + struct tDetails { CRGBA textDrawBoxColor; float textLetterSizeX; @@ -67,26 +64,31 @@ class CFont signed char bFontOutline, bFontOutline2; }; -public: - static CSprite2d Sprite[NUM_FONT_SHEETS]; - #pragma pack(push, 1) - static struct sFontSizes + struct sFontSizes { unsigned char bPropValue[208]; unsigned char bSpaceChar; unsigned char bUnpropValue; - } Size[NUM_FONT_SHEETS]; + }; #pragma pack(pop) public: - static void ReadFontsDAT(); - static unsigned char AssignBottomFontIndex(unsigned char character, unsigned char bFontType); - static void SetTextLetterSize(float scaleX, float scaleY); - static void SetTextLetterSizeWithLanguageScaling(float scaleX, float scaleY); + // TODO: Make private? + static CSprite2d Sprite[NUM_FONT_SHEETS]; + static sFontSizes Size[NUM_FONT_SHEETS]; + static tDetails& Details; + +private: + static void LoadFontValues(); + +public: + static unsigned char FindSubFontCharacter(char character, unsigned char bFontType); + static void SetScale(float scaleX, float scaleY); + static void SetScaleLang(float scaleX, float scaleY); static void SetFontStyle(unsigned char bFont); - static void SetTextColour(CRGBA colour); + static void SetColor(CRGBA colour); static void SetTextBorderRGBA(CRGBA colour); static void SetTextShadow(unsigned char bShadow); static void SetTextOutline(unsigned char bOutline); @@ -102,6 +104,9 @@ class CFont static void PrintString(float posX, float posY, const char* pText); static void PrintStringFromBottom(float posX, float posY, const char* pText); static void SetWrapx(float fWrap); + + static void Initialise(); + static void Shutdown(); }; const char* GetFontsDATByLanguage(); diff --git a/VCS PC/CGridref.cpp b/VCS PC/CGridref.cpp index 5cc6a15..dc72ff3 100644 --- a/VCS PC/CGridref.cpp +++ b/VCS PC/CGridref.cpp @@ -15,8 +15,8 @@ void CGridref::Draw() CFont::SetTextAlignment(ALIGN_Center); CFont::SetTextOutline(1); CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, 255)); - CFont::SetTextLetterSize(_width(0.35), _height(0.65)); - CFont::SetTextColour(CRGBA(BaseColors[2])); + CFont::SetScale(_width(0.35), _height(0.65)); + CFont::SetColor(CRGBA(BaseColors[2])); _snprintf(ZoneID, sizeof(ZoneID), "%c%d", zoneX + 100, zoneY); CFont::PrintString(_x(150.0), _y(7.5), ZoneID); CFont::PrintString(_x(115.0), _y(7.5), GetNameByID(zoneX, zoneY)); diff --git a/VCS PC/CText.cpp b/VCS PC/CText.cpp index b3b6eff..b759e4d 100644 --- a/VCS PC/CText.cpp +++ b/VCS PC/CText.cpp @@ -54,7 +54,7 @@ void CText::ReloadFontsFiles(bool bUnk) CTxdStore::SetCurrentTxd(slot); texFonts[0].Load("font2", "font2m"); texFonts[1].Load("font1", "font1m"); - CFont::ReadFontsDAT(); + CFont::LoadFontValues(); CTxdStore::PopCurrentTxd(); } #endif diff --git a/VCS PC/Darkel.cpp b/VCS PC/Darkel.cpp index 1d54ed8..7bc003a 100644 --- a/VCS PC/Darkel.cpp +++ b/VCS PC/Darkel.cpp @@ -62,13 +62,13 @@ void CDarkel::DrawMessages() } } CFont::SetTextBackground(0, 0); - CFont::SetTextLetterSize(_width(0.5f), _height(1.1f)); + CFont::SetScale(_width(0.5f), _height(1.1f)); CFont::SetTextAlignment(ALIGN_Right); CFont::SetTextWrapX(0.0f); // ? CFont::SetFontStyle(FONT_Eurostile); CFont::SetTextOutline(1); CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, 255)); - CFont::SetTextColour(BaseColors[4]); + CFont::SetColor(BaseColors[4]); if ( TimeLimit >= 0 ) { @@ -85,10 +85,10 @@ void CDarkel::DrawMessages() // TODO: Flashing CFont::SetTextUseProportionalValues(true); - CFont::PrintString(_x(88.0f + fPosXOffset), _y(148.0f), gxt->GetText("TIME")); + CFont::PrintString(_x(88.0f + fPosXOffset), _y(148.0f), TheText.GetText("TIME")); CFont::SetTextUseProportionalValues(false); - CFont::SetTextColour(BaseColors[11]); + CFont::SetColor(BaseColors[11]); CFont::PrintString(_x(32.0f), _y(148.0f), gString); } @@ -103,8 +103,8 @@ void CDarkel::DrawMessages() fPosXOffset = 0.0f; CFont::SetTextUseProportionalValues(true); - CFont::SetTextColour(BaseColors[8]); - CFont::PrintString(_x(88.0f + fPosXOffset), _y(175.0f), gxt->GetText("RAMP_KL")); + CFont::SetColor(BaseColors[8]); + CFont::PrintString(_x(88.0f + fPosXOffset), _y(175.0f), TheText.GetText("RAMP_KL")); CFont::SetTextUseProportionalValues(false); CFont::PrintString(_x(32.0f), _y(175.0f), gString); @@ -115,7 +115,7 @@ void CDarkel::DrawMessages() if ( bStandardSoundAndMessages ) { if ( CTimer::m_snTimeInMilliseconds - TimeOfFrenzyStart < 5000 ) - CMessages::AddBigMessage(gxt->GetText("KILLPA"), 3000, 0); + CMessages::AddBigMessage(TheText.GetText("KILLPA"), 3000, 0); } return; } diff --git a/VCS PC/Frontend.cpp b/VCS PC/Frontend.cpp index 796907a..1a05a57 100644 --- a/VCS PC/Frontend.cpp +++ b/VCS PC/Frontend.cpp @@ -357,7 +357,7 @@ MenuItem CMenuManager::ms_pMenus[] = { static inline const char* GetTitlePCByLanguage() { static const char* const cTitlePCNames[] = { "title_pc_EN", /*"title_pc_ES",*/ "title_pc_PL" }; - return cTitlePCNames[menu->GetLanguage()]; + return cTitlePCNames[FrontEndMenuManager.GetLanguage()]; } WRAPPER void CMenuManager::ShowFullscreenMessage(const char* pMessage, bool bUnk1, bool bUnk2) @@ -394,8 +394,8 @@ void CMenuManager::DrawBackEnd() CFont::SetTextWrapX(0.0); CFont::SetTextOutline(1); CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, 255)); - CFont::SetTextLetterSize(_width(0.25f), _height(0.4f)); - CFont::SetTextColour(BaseColors[11]); + CFont::SetScale(_width(0.25f), _height(0.4f)); + CFont::SetColor(BaseColors[11]); CFont::PrintString(_x(2.5f), _ydown(13.0f), MOD_VERSION" BUILD "BUILDNUMBER_STR); #ifdef DEBUG @@ -424,22 +424,22 @@ void CMenuManager::DrawBackEnd() textures[16].Draw(CRect(_x(135.0f), _y(122.5f), _x(15.0f), _y(2.5f)), CRGBA(255, 255, 255, 255)); CFont::SetTextUseProportionalValues(true); - CFont::SetTextLetterSize(_width(0.8f), _height(1.2f)); + CFont::SetScale(_width(0.8f), _height(1.2f)); CFont::SetFontStyle(FONT_RageItalic); //CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, 255)); //CFont::SetTextOutline(1); CFont::SetTextAlignment(ALIGN_Center); - CFont::SetTextColour(CRGBA(MODDB_RED_R, MODDB_RED_G, MODDB_RED_B, 255)); - CFont::PrintString(_x(75.0f), _y(115.0f), gxt->GetText("FEP_MOD")); + CFont::SetColor(CRGBA(MODDB_RED_R, MODDB_RED_G, MODDB_RED_B, 255)); + CFont::PrintString(_x(75.0f), _y(115.0f), TheText.GetText("FEP_MOD")); CFont::SetTextUseProportionalValues(false); CFont::SetFontStyle(FONT_PagerFont); - CFont::SetTextLetterSize(_width(0.375f), _height(0.725f)); + CFont::SetScale(_width(0.375f), _height(0.725f)); if ( nDaysTillDeadline >= 3 ) - CFont::SetTextColour(CRGBA(255, 255, 255, 255)); + CFont::SetColor(CRGBA(255, 255, 255, 255)); - CMessages::InsertNumberInString(gxt->GetText(nDaysTillDeadline == 1 ? "FEP_DY2" : "FEP_DYZ"), nDaysTillDeadline, -1, -1, -1, -1, -1, gString); + CMessages::InsertNumberInString(TheText.GetText(nDaysTillDeadline == 1 ? "FEP_DY2" : "FEP_DYZ"), nDaysTillDeadline, -1, -1, -1, -1, -1, gString); CFont::PrintString(_x(75.0f), _y(140.0f), gString); } } @@ -682,15 +682,15 @@ void CMenuManager::PrintStats() CFont::SetTextOutline(1); // Criminal Rating - CFont::SetTextLetterSize(_width(0.425f), _height(0.85f)); + CFont::SetScale(_width(0.425f), _height(0.85f)); CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, 255)); CFont::SetTextAlignment(ALIGN_Left); - CFont::SetTextColour(CRGBA(MENU_INACTIVE_R, MENU_INACTIVE_G, MENU_INACTIVE_B, 255)); - CFont::PrintString(_xleft(50.0f), _y(85.0f), gxt->GetText("CRIMRA")); + CFont::SetColor(CRGBA(MENU_INACTIVE_R, MENU_INACTIVE_G, MENU_INACTIVE_B, 255)); + CFont::PrintString(_xleft(50.0f), _y(85.0f), TheText.GetText("CRIMRA")); CFont::SetTextAlignment(ALIGN_Right); CFont::PrintString(_x(50.0f), _y(85.0f), CStats::FindCriminalRatingNumber()); - CFont::SetTextLetterSize(_width(0.3f), _height(0.7f)); + CFont::SetScale(_width(0.3f), _height(0.7f)); while ( dwLoopCounter < dwStatsToShow ) { @@ -719,7 +719,7 @@ void CMenuManager::PrintStats() CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, static_cast(fTextAlpha))); CFont::SetTextAlignment(ALIGN_Left); - CFont::SetTextColour(CRGBA(255, 255, 255, static_cast(fTextAlpha))); + CFont::SetColor(CRGBA(255, 255, 255, static_cast(fTextAlpha))); CFont::PrintString(_xleft(50.0f + (nIndents * 3.0f)), fStartingPos, gString); CFont::SetTextAlignment(ALIGN_Right); CFont::PrintString(_x(50.0f), fStartingPos, gUString); @@ -730,18 +730,18 @@ void CMenuManager::PrintStats() void CMenuManager::PrintUpdaterScreen() { - CFont::SetTextLetterSize(_width(0.8f), _height(1.2f)); + CFont::SetScale(_width(0.8f), _height(1.2f)); CFont::SetFontStyle(FONT_RageItalic); CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, 255)); CFont::SetTextOutline(1); CFont::SetTextAlignment(ALIGN_Center); - CFont::SetTextColour(CRGBA(MENU_INACTIVE_R, MENU_INACTIVE_G, MENU_INACTIVE_B, 255)); - CFont::PrintString(_x(137.5f), _y(15.0f), gxt->GetText("FEU_POW")); + CFont::SetColor(CRGBA(MENU_INACTIVE_R, MENU_INACTIVE_G, MENU_INACTIVE_B, 255)); + CFont::PrintString(_x(137.5f), _y(15.0f), TheText.GetText("FEU_POW")); CFont::SetFontStyle(FONT_Eurostile); - CFont::SetTextLetterSize(_width(0.3f), _height(0.7f)); - CFont::SetTextColour(CRGBA(255, 255, 255, 255)); + CFont::SetScale(_width(0.3f), _height(0.7f)); + CFont::SetColor(CRGBA(255, 255, 255, 255)); CFont::SetTextAlignment(ALIGN_Left); float fStartingPos = _height(100.0f); @@ -772,12 +772,12 @@ void CMenuManager::PrintUpdaterScreen() if ( dDownloadPercentage != 100.0f ) CSprite2d::DrawRect(CRect(_xmiddle(-270.0f + (5.4f * dDownloadPercentage)), _ydown(90.0f), _xmiddle(270.0f), _ydown(110.0f)), CRGBA(MENU_INACTIVE_PINK_R, MENU_INACTIVE_PINK_G, MENU_INACTIVE_PINK_B, 255)); - CFont::SetTextLetterSize(_width(0.35f), _height(0.7f)); + CFont::SetScale(_width(0.35f), _height(0.7f)); CFont::SetFontStyle(FONT_PagerFont); CFont::SetTextAlignment(ALIGN_Center); if ( CUpdateManager::IsDownloading() ) { - CMessages::InsertNumberInString(gxt->GetText("FEU_PRC"), static_cast(dDownloadPercentage), -1, -1, -1, -1, -1, gString); + CMessages::InsertNumberInString(TheText.GetText("FEU_PRC"), static_cast(dDownloadPercentage), -1, -1, -1, -1, -1, gString); CFont::PrintString(static_cast(RsGlobal.MaximumWidth / 2), _ydown(105.0f), gString); } @@ -810,20 +810,20 @@ void CMenuManager::PrintDLCScreen() CVideoPlayer::PlayNextFrame(); CFont::SetWrapx(_x(30.0f)); - CFont::SetTextColour(CRGBA(255, 255, 255, 255)); + CFont::SetColor(CRGBA(255, 255, 255, 255)); CFont::SetTextShadow(1); CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, 255)); - CFont::SetTextLetterSize(_width(0.35f), _height(0.7f)); + CFont::SetScale(_width(0.35f), _height(0.7f)); CFont::SetFontStyle(FONT_PagerFont); CFont::SetTextJustify(true); - CFont::PrintString(_x(249.0f), _ymiddle(142.5f), gxt->GetText(cGXTName)); + CFont::PrintString(_x(249.0f), _ymiddle(142.5f), TheText.GetText(cGXTName)); if ( bThisDLCIsEnabled ) - CFont::SetTextColour(CRGBA(MENU_UPDATES_R, MENU_UPDATES_G, MENU_UPDATES_B, 255)); - CFont::SetTextLetterSize(_width(0.6f), _height(1.1f)); + CFont::SetColor(CRGBA(MENU_UPDATES_R, MENU_UPDATES_G, MENU_UPDATES_B, 255)); + CFont::SetScale(_width(0.6f), _height(1.1f)); CFont::SetTextJustify(false); CFont::SetTextAlignment(ALIGN_Center); - CFont::PrintString(_x(140.0f), _ymiddle(-87.5f), gxt->GetText(bThisDLCIsEnabled ? "FEE_ON" : "FEE_OFF")); + CFont::PrintString(_x(140.0f), _ymiddle(-87.5f), TheText.GetText(bThisDLCIsEnabled ? "FEE_ON" : "FEE_OFF")); } else { @@ -834,7 +834,7 @@ void CMenuManager::PrintDLCScreen() void CMenuManager::ReadFrontendTextures() { - static const char* const frontend1TexNames[] = { + const char* const frontend1TexNames[] = { "radio_flash", "radio_vrock", "radio_paradise", @@ -846,13 +846,16 @@ void CMenuManager::ReadFrontendTextures() "radio_emotion", "radio_TPLAYER" }; - static const char* const frontend2TexNames[] = { + const char* const frontend2TexNames[] = { "background", "modbase", "map", - "banner" }; +#ifdef INCLUDE_PROMO_BANNER + "banner" +#endif + }; - static const char* const frontendpcTexNames[] = { + const char* const frontendpcTexNames[] = { "mouse", "crosshair" }; @@ -1087,12 +1090,12 @@ float CMenuManager::GetTextYPosNextItem(const MenuItem::MenuEntry& pPosition) fprintf(hFile, "GRAND THEFT AUTO VICE CITY STORIES "); wcstombs(multiByteBuf, L"Śtątystykię!", 512); // fputs(, hFile); - fprintf(hFile, "%s
GetText("FEH_STA"), 0))); + fprintf(hFile, "%s
------------------------------------------------------------------- \n"); fprintf(hFile, "   \n"); fprintf(hFile, " \n"); -// fwprintf(hFile, L"

%s: \n", CStats::SACharsToASCII(gxt->GetText("FES_DAT"), 0)); -// fwprintf(hFile, L"%s
%s:
", dateBuf, CStats::SACharsToASCII(gxt->GetText("FES_CMI"), 0)); +// fwprintf(hFile, L"

%s: \n", CStats::SACharsToASCII(TheText.GetText("FES_DAT"), 0)); +// fwprintf(hFile, L"%s
%s:
", dateBuf, CStats::SACharsToASCII(TheText.GetText("FES_CMI"), 0)); fclose(hFile); diff --git a/VCS PC/Frontend.h b/VCS PC/Frontend.h index 42a255b..e1494fe 100644 --- a/VCS PC/Frontend.h +++ b/VCS PC/Frontend.h @@ -16,7 +16,7 @@ //#define COMPILE_BOUNCING_ICONS //#define COMPILE_SMOOTHBEATING_ICONS #define COMPILE_BEATING_ICONS -#define INCLUDE_PROMO_BANNER +//#define INCLUDE_PROMO_BANNER #define MENU_INACTIVE_R 0x1E #define MENU_INACTIVE_G 0xFF diff --git a/VCS PC/Garages.cpp b/VCS PC/Garages.cpp index 7c9d034..3cd8430 100644 --- a/VCS PC/Garages.cpp +++ b/VCS PC/Garages.cpp @@ -6,13 +6,13 @@ void CGarages::PrintMessages() garages->MessageIDString[0] = '\0'; else { - CFont::SetTextLetterSize(_width(0.6f), _height(1.1f)); + CFont::SetScale(_width(0.6f), _height(1.1f)); CFont::SetTextUseProportionalValues(true); CFont::SetTextBackground(0, 0); CFont::SetCentreSize(_width(500.0f)); CFont::SetTextAlignment(ALIGN_Center); CFont::SetFontStyle(FONT_Eurostile); - CFont::SetTextColour(CRGBA(BaseColors[3])); + CFont::SetColor(CRGBA(BaseColors[3])); CFont::SetTextOutline(1); CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, 255)); @@ -20,16 +20,16 @@ void CGarages::PrintMessages() if ( garages->MessageNumber2 < 0 ) { if ( garages->MessageNumber1 < 0 ) - CFont::PrintString(static_cast(RsGlobal.MaximumWidth / 2), _y(275.0f), gxt->GetText(garages->MessageIDString)); + CFont::PrintString(static_cast(RsGlobal.MaximumWidth / 2), _y(275.0f), TheText.GetText(garages->MessageIDString)); else { - gxt->TextNumberFormat(gxt->GetText(garages->MessageIDString), garages->MessageNumber1, -1, -1, -1, -1, -1, tmpString); + TheText.TextNumberFormat(TheText.GetText(garages->MessageIDString), garages->MessageNumber1, -1, -1, -1, -1, -1, tmpString); CFont::PrintString(static_cast(RsGlobal.MaximumWidth / 2), _y(275.0f), tmpString); } } else { - gxt->TextNumberFormat(gxt->GetText(garages->MessageIDString), garages->MessageNumber1, garages->MessageNumber2, -1, -1, -1, -1, tmpString); + TheText.TextNumberFormat(TheText.GetText(garages->MessageIDString), garages->MessageNumber1, garages->MessageNumber2, -1, -1, -1, -1, tmpString); CFont::PrintString(static_cast(RsGlobal.MaximumWidth / 2), _y(275.0f), tmpString); } } diff --git a/VCS PC/Hud.cpp b/VCS PC/Hud.cpp index 8a974f1464d922e73dd82e75c33b73390c484f0f..f96cca0e06faf009597ada67b6acc97642b0ac15 100644 GIT binary patch delta 1797 zcmZ`&T})eL7=HU_Y1sy`(aNmz048*7>1Y%+vO=ZOu{g9)@WNV1r3a~$wmSu#8X;bo zc(shYTjn2TYBWp8wvaF0s8PHyCf$X)km;1o=!G#}ZFgR1^f{;JoSs6>$#>5AzW05f z=Xrm=&rdo}vh&non`h;rIlNZ;&W^ckx8L7Q5=~Q)3RI>A^5BWlFfCG+9>J5O5-F5} zMTT9X2v+dysLST_b<=+8p%XMnk79)>PO^q4yO--3JUW9F zJr3VISPF=n*Vt0@1WnKgO~HGD9>X_D2^yoLG)_bKPwRSK!MB5E5U;X!&_Qiq)>V%{ z+JpHW#|l!Ora2JRLKIMEu@t;juxT^uS?%;mlw|=Ta}X(;wi0a5VXxpsqF1Sp*Tuc! zs(ZuErJtS431o2uB~k!4i_jO~s#dvLV>P33Sc3?jhomg5c~C!tXIAS%2)hz!Gw|3? zeYBgr+VapLJQAX1M3(fkdejgl55l~F;^iPfhJ*!>DD;v>_##d+2(30B@VvHXz}KMI zeEo=@r55k9wP9sS0X0n^(Ku8gCxE}GF~#vNLRc-qdTDBtjFZ}kH5vkyLrV{UisJ;F%YUnG?X;Xwy2d}L3uOCzf2t*-sgXOJ3ND`~wPxf?G8&QDNAy8y-pVT|Hh;Ig8V{}6z-8STK zC!qoP@MnQJcMQy^1-HvxV)CB%TCE5CKjqT@RbZW?D5?{(@OwM-sBZs;9VOFkfM)H4;5Y@A}JaChvtx$^g>38@(KNHUP_SO5(3? zr8+Q?xKgq0^cDHdLDNrsc{OL>>BAcpr&zkSHQ-+%|a0|Iz+{?q)w@gL7H(oRT z#Wy$JsTJZv#m`IE;v7x)bL&=sZ~ho%=`M-C;BMYHBk|U+e;9#UT7Um`#cdhEU;a!7 F{sWv)rosRK delta 1199 zcmeC1%(ADCWrEE_r?iRd%qB}P32n|`{Kd$t%#gy6%8;PwHEl>lKXL($~*(9xo8LJrFk!I;s7-0Jm)jIB zbiMyWBsT>s~^0xajn?Gy}Ks6Vf zo*K?^Y%beUC5gq|lP_#!nap?21;sI7r#GB)14Rbe4icU0HBVtP$7OJuLU ftell(hArchiveHandle) ) + while ( dwRootDirOffset > ftell(m_hArchiveHandle) ) { DWORD dwCurrentDirOffset; char DirectoryName[16]; if ( !bReadingFirstDir ) { - fread(&dwCurrentDirOffset, 4, 1, hArchiveHandle); + fread(&dwCurrentDirOffset, 4, 1, m_hArchiveHandle); dwCurrentOffset += 4; } else @@ -59,84 +60,89 @@ void CPNGArchive::SetDirectory(const char* pDirName) dwCurrentDirOffset = dwRootDirOffset; bReadingFirstDir = false; } - fseek(hArchiveHandle, dwCurrentDirOffset, SEEK_SET); - fread(DirectoryName, 16, 1, hArchiveHandle); + fseek(m_hArchiveHandle, dwCurrentDirOffset, SEEK_SET); + fread(DirectoryName, 16, 1, m_hArchiveHandle); if ( !_strnicmp(DirectoryName, pDirName, 16) ) return; - fseek(hArchiveHandle, dwCurrentOffset, SEEK_SET); + fseek(m_hArchiveHandle, dwCurrentOffset, SEEK_SET); } } else - fseek(hArchiveHandle, dwRootDirOffset+16, SEEK_SET); + fseek(m_hArchiveHandle, dwRootDirOffset+16, SEEK_SET); } } RwTexture* CPNGArchive::ReadTexture(const char* pTextureName) { - RwTexture* pTexture = nullptr; + RwTexture* pTexture = nullptr; - if ( hArchiveHandle ) + if ( m_hArchiveHandle && m_bSetDir && pTextureName ) { - // Push archive handle position - DWORD dwSavedPos = ftell(hArchiveHandle); + if ( pTextureName[0] ) + { + assert(m_bSetDir == true); + + // Push archive handle position + DWORD dwSavedPos = ftell(m_hArchiveHandle); - RwChar* pTexName = RsPathnameCreate(pTextureName); - char* pExtensionPos = strstr(pTexName, ".spta"); - if ( pExtensionPos ) - *pExtensionPos = '\0'; + RwChar* pTexName = RsPathnameCreate(pTextureName); + char* pExtensionPos = strstr(pTexName, ".spta"); + if ( pExtensionPos ) + *pExtensionPos = '\0'; - WORD wTexturesInDir; + WORD wTexturesInDir; - fread(&wTexturesInDir, 2, 1, hArchiveHandle); + fread(&wTexturesInDir, 2, 1, m_hArchiveHandle); - for ( WORD i = 0; i < wTexturesInDir; ++ i ) - { - struct + for ( WORD i = 0; i < wTexturesInDir; ++ i ) { - DWORD dwOffsetToTexture; - char TextureName[16]; - } ArchiveEntry; + struct + { + DWORD dwOffsetToTexture; + char TextureName[16]; + } ArchiveEntry; - fread(&ArchiveEntry, 20, 1, hArchiveHandle); - if ( !_strnicmp(ArchiveEntry.TextureName, pTexName, 16) ) - { - fseek(hArchiveHandle, ArchiveEntry.dwOffsetToTexture, SEEK_SET); + fread(&ArchiveEntry, 20, 1, m_hArchiveHandle); + if ( !_strnicmp(ArchiveEntry.TextureName, pTexName, 16) ) + { + fseek(m_hArchiveHandle, ArchiveEntry.dwOffsetToTexture, SEEK_SET); - // Patch RtPNGImageRead - Memory::Patch(0x7CF9CA, rwSTREAMCUSTOM); + // Patch RtPNGImageRead + Memory::Patch(0x7CF9CA, rwSTREAMCUSTOM); - RwStreamCustom StreamStruct; + RwStreamCustom StreamStruct; - StreamStruct.sfnclose = SPTAClose; - StreamStruct.sfnread = SPTARead; - StreamStruct.sfnskip = SPTASkip; - StreamStruct.sfnwrite = SPTAWrite; - StreamStruct.data = hArchiveHandle; + StreamStruct.sfnclose = SPTAClose; + StreamStruct.sfnread = SPTARead; + StreamStruct.sfnskip = SPTASkip; + StreamStruct.sfnwrite = SPTAWrite; + StreamStruct.data = m_hArchiveHandle; - // Load it - RwInt32 dwWidth, dwHeight, dwDepth, dwFlags; - RwImage* pImage = RtPNGImageRead(reinterpret_cast(&StreamStruct)); - RwRaster* pRaster; + // Load it + RwInt32 dwWidth, dwHeight, dwDepth, dwFlags; + RwImage* pImage = RtPNGImageRead(reinterpret_cast(&StreamStruct)); + RwRaster* pRaster; - RwImageFindRasterFormat(pImage, rwRASTERTYPETEXTURE, &dwWidth, &dwHeight, &dwDepth, &dwFlags); - pRaster = RwRasterCreate(dwWidth, dwHeight, dwDepth, dwFlags); - RwRasterSetFromImage(pRaster, pImage); + RwImageFindRasterFormat(pImage, rwRASTERTYPETEXTURE, &dwWidth, &dwHeight, &dwDepth, &dwFlags); + pRaster = RwRasterCreate(dwWidth, dwHeight, dwDepth, dwFlags); + RwRasterSetFromImage(pRaster, pImage); - pTexture = RwTextureCreate(pRaster); - RwTextureSetName(pTexture, pTexName); - RwImageDestroy(pImage); + pTexture = RwTextureCreate(pRaster); + RwTextureSetName(pTexture, pTexName); + RwImageDestroy(pImage); - // Revert RtPNGImageRead - Memory::Patch(0x7CF9CA, rwSTREAMFILENAME); - break; + // Revert RtPNGImageRead + Memory::Patch(0x7CF9CA, rwSTREAMFILENAME); + break; + } } - } - RsPathnameDestroy(pTexName); + RsPathnameDestroy(pTexName); - fseek(hArchiveHandle, dwSavedPos, SEEK_SET); + fseek(m_hArchiveHandle, dwSavedPos, SEEK_SET); + } } return pTexture; } \ No newline at end of file diff --git a/VCS PC/PNGArchive.h b/VCS PC/PNGArchive.h index ece97a2..12cd4a4 100644 --- a/VCS PC/PNGArchive.h +++ b/VCS PC/PNGArchive.h @@ -16,13 +16,14 @@ Next section contains raw PNGs data, one after another (no padding) */ class CPNGArchive { private: - FILE* hArchiveHandle; + FILE* m_hArchiveHandle; + bool m_bSetDir; public: inline CPNGArchive() - : hArchiveHandle(nullptr) - { - } + : m_hArchiveHandle(nullptr), m_bSetDir(false) + {} + inline CPNGArchive(const char* pFilePath) { OpenArchive(pFilePath); } @@ -30,13 +31,14 @@ class CPNGArchive { CloseArchive(); } inline void OpenArchive(const char* pFilePath) - { hArchiveHandle = pFilePath[0] ? fopen(pFilePath, "rb") : nullptr; } + { m_hArchiveHandle = pFilePath[0] ? fopen(pFilePath, "rb") : nullptr; } + inline void CloseArchive() { - if ( hArchiveHandle ) + if ( m_hArchiveHandle ) { - fclose(hArchiveHandle); - hArchiveHandle = nullptr; + fclose(m_hArchiveHandle); + m_hArchiveHandle = nullptr; } } diff --git a/VCS PC/Radar.cpp b/VCS PC/Radar.cpp index 4bdd551..25cd049 100644 --- a/VCS PC/Radar.cpp +++ b/VCS PC/Radar.cpp @@ -1,7 +1,26 @@ #include "StdAfx.h" +CSprite2d* const CRadar::RadarBlipSprites = (CSprite2d*)0xBAA250; + WRAPPER void CRadar::ChangeBlipBrightness(int nBlipID, int nBrightness) { WRAPARG(nBlipID); WRAPARG(nBrightness); EAXJMP(0x583C70); } +static const char* const RadarBlipSpriteFilenames[NUM_BLIP_SPRITES] = { "", "", "radar_centre", "arrow", + "radar_north", "", "radar_gun", "radar_bomb", + "", "", "", "", + "", "", "", "", + "", "", "radar_gunshop", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "radar_save", + "", "", "", "", + "", "radar_waypoint", "", "radar_louise", + "radar_marty", "radar_cshop", "radar_phil", "radar_jerry", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "radar_spray" }; + DWORD CRadar::GetRadarTraceColour(int colour, bool bDark, bool bFriend) { switch ( colour ) @@ -104,4 +123,15 @@ DWORD CRadar::GetRadarTraceColour(int colour, bool bDark, bool bFriend) default: return colour; } +} + +void CRadar::LoadTextures() +{ + CPNGArchive HudSPTA("models\\hud.spta"); + HudSPTA.SetDirectory("blips"); + + for ( int i = 0; i < NUM_BLIP_SPRITES; ++i ) + RadarBlipSprites[i].SetTextureFromSPTA(HudSPTA, RadarBlipSpriteFilenames[i]); + + HudSPTA.CloseArchive(); } \ No newline at end of file diff --git a/VCS PC/Radar.h b/VCS PC/Radar.h index 57917bc..1747386 100644 --- a/VCS PC/Radar.h +++ b/VCS PC/Radar.h @@ -1,11 +1,18 @@ #ifndef __RADAR #define __RADAR +#define NUM_BLIP_SPRITES 64 + class CRadar { +private: + static CSprite2d* const RadarBlipSprites; + public: - static void ChangeBlipBrightness(int nBlipID, int nBrightness); - static DWORD GetRadarTraceColour(int colour, bool bDark, bool bFriend); + static void ChangeBlipBrightness(int nBlipID, int nBrightness); + + static DWORD GetRadarTraceColour(int colour, bool bDark, bool bFriend); + static void LoadTextures(); }; #endif \ No newline at end of file diff --git a/VCS PC/Script.cpp b/VCS PC/Script.cpp index fe2256f..fd6d536 100644 --- a/VCS PC/Script.cpp +++ b/VCS PC/Script.cpp @@ -342,7 +342,7 @@ void CRunningScript::ProcessVCSCommands(WORD opcode) char cString[8]; GetStringParam(cString, 8); CollectParameters(2); - CUserDisplay::Pager.AddMessage(const_cast(gxt->GetText(cString)), static_cast(scriptParams[0].iParam), static_cast(scriptParams[1].iParam)); + CUserDisplay::Pager.AddMessage(const_cast(TheText.GetText(cString)), static_cast(scriptParams[0].iParam), static_cast(scriptParams[1].iParam)); return; } diff --git a/VCS PC/Sprite.h b/VCS PC/Sprite.h index 992413f..61ce0c1 100644 --- a/VCS PC/Sprite.h +++ b/VCS PC/Sprite.h @@ -14,7 +14,7 @@ class CSprite2d {} inline ~CSprite2d() - { Delete(); } + { /*Delete();*/ } inline void SetAddressing(int nAddressing) { if ( m_pTexture ) RwTextureSetAddressing(m_pTexture, nAddressing); } diff --git a/VCS PC/Stats.cpp b/VCS PC/Stats.cpp index 81bc9d6..2655b84 100644 --- a/VCS PC/Stats.cpp +++ b/VCS PC/Stats.cpp @@ -227,47 +227,47 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { if ( nStat == nTempValue++ ) { - strcpy(gString, gxt->GetText("ST_GANG")); + strcpy(gString, TheText.GetText("ST_GANG")); switch ( nTheMostHatedGang ) { case 7: { - strcpy(gUString, gxt->GetText("ST_GNG1")); + strcpy(gUString, TheText.GetText("ST_GNG1")); return 0; } case 8: { - strcpy(gUString, gxt->GetText("ST_GNG2")); + strcpy(gUString, TheText.GetText("ST_GNG2")); return 0; } case 9: { - strcpy(gUString, gxt->GetText("ST_GNG3")); + strcpy(gUString, TheText.GetText("ST_GNG3")); return 0; } case 10: { - strcpy(gUString, gxt->GetText("ST_GNG4")); + strcpy(gUString, TheText.GetText("ST_GNG4")); return 0; } case 11: { - strcpy(gUString, gxt->GetText("ST_GNG5")); + strcpy(gUString, TheText.GetText("ST_GNG5")); return 0; } case 12: { - strcpy(gUString, gxt->GetText("ST_GNG6")); + strcpy(gUString, TheText.GetText("ST_GNG6")); return 0; } case 13: { - strcpy(gUString, gxt->GetText("ST_GNG7")); + strcpy(gUString, TheText.GetText("ST_GNG7")); return 0; } case 14: { - strcpy(gUString, gxt->GetText("ST_GNG8")); + strcpy(gUString, TheText.GetText("ST_GNG8")); return 0; } } @@ -471,7 +471,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Greatest insane stunt gUString[0] = '\0'; - strcpy(gString, gxt->GetText("BSTSTU")); + strcpy(gString, TheText.GetText("BSTSTU")); return 0; } @@ -482,67 +482,67 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { case 1: { - strcpy(gUString, gxt->GetText("INSTUN")); + strcpy(gUString, TheText.GetText("INSTUN")); return 0; } case 2: { - strcpy(gUString, gxt->GetText("FLINST")); + strcpy(gUString, TheText.GetText("FLINST")); return 0; } case 3: { - strcpy(gUString, gxt->GetText("PRINST")); + strcpy(gUString, TheText.GetText("PRINST")); return 0; } case 4: { - strcpy(gUString, gxt->GetText("DBINST")); + strcpy(gUString, TheText.GetText("DBINST")); return 0; } case 5: { - strcpy(gUString, gxt->GetText("DBFINS")); + strcpy(gUString, TheText.GetText("DBFINS")); return 0; } case 6: { - strcpy(gUString, gxt->GetText("DBPINS")); + strcpy(gUString, TheText.GetText("DBPINS")); return 0; } case 7: { - strcpy(gUString, gxt->GetText("TRINST")); + strcpy(gUString, TheText.GetText("TRINST")); return 0; } case 8: { - strcpy(gUString, gxt->GetText("FLTRST")); + strcpy(gUString, TheText.GetText("FLTRST")); return 0; } case 9: { - strcpy(gUString, gxt->GetText("PRTRST")); + strcpy(gUString, TheText.GetText("PRTRST")); return 0; } case 10: { - strcpy(gUString, gxt->GetText("QUINST")); + strcpy(gUString, TheText.GetText("QUINST")); return 0; } case 11: { - strcpy(gUString, gxt->GetText("FQUINS")); + strcpy(gUString, TheText.GetText("FQUINS")); return 0; } case 12: { - strcpy(gUString, gxt->GetText("PQUINS")); + strcpy(gUString, TheText.GetText("PQUINS")); return 0; } default: { - strcpy(gUString, gxt->GetText("NOSTUC")); + strcpy(gUString, TheText.GetText("NOSTUC")); return 0; } } @@ -791,7 +791,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Course name _snprintf(gUString, sizeof(gUString), "ST_R_%02d", i + 1); - strcpy(gString, gxt->GetText(gUString)); + strcpy(gString, TheText.GetText(gUString)); gUString[0] = '\0'; return 0; } @@ -833,7 +833,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Sanchez Time Trial gUString[0] = '\0'; - strcpy(gString, gxt->GetText("ST_SATT")); + strcpy(gString, TheText.GetText("ST_SATT")); return 0; } @@ -845,7 +845,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Course X _snprintf(gUString, sizeof(gUString), "ST_C_%02d", i + 1); - strcpy(gString, gxt->GetText(gUString)); + strcpy(gString, TheText.GetText(gUString)); gUString[0] = '\0'; nIndents = 1; return 0; @@ -889,7 +889,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // BMX Time Trial gUString[0] = '\0'; - strcpy(gString, gxt->GetText("ST_BMXT")); + strcpy(gString, TheText.GetText("ST_BMXT")); return 0; } @@ -901,7 +901,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Course X _snprintf(gUString, sizeof(gUString), "ST_C_%02d", i + 1); - strcpy(gString, gxt->GetText(gUString)); + strcpy(gString, TheText.GetText(gUString)); gUString[0] = '\0'; nIndents = 1; return 0; @@ -945,7 +945,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Quad Bike Time Trial gUString[0] = '\0'; - strcpy(gString, gxt->GetText("ST_QBTT")); + strcpy(gString, TheText.GetText("ST_QBTT")); return 0; } @@ -957,7 +957,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Course X _snprintf(gUString, sizeof(gUString), "ST_C_%02d", i + 1); - strcpy(gString, gxt->GetText(gUString)); + strcpy(gString, TheText.GetText(gUString)); gUString[0] = '\0'; nIndents = 1; return 0; @@ -1001,7 +1001,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Monster Truck Time Trial gUString[0] = '\0'; - strcpy(gString, gxt->GetText("ST_MOTT")); + strcpy(gString, TheText.GetText("ST_MOTT")); return 0; } @@ -1013,7 +1013,7 @@ long CStats::ConstructStatLine(int nStat, int& nIndents) { // Course X _snprintf(gUString, sizeof(gUString), "ST_C_%02d", i + 1); - strcpy(gString, gxt->GetText(gUString)); + strcpy(gString, TheText.GetText(gUString)); gUString[0] = '\0'; nIndents = 1; return 0; @@ -1117,7 +1117,7 @@ void CStats::BuildStatLine(char* pEntryName, void* pVal1, int nType, void* pVal2 { if ( pEntryName ) { - const char* pText = gxt->GetText(pEntryName); + const char* pText = TheText.GetText(pEntryName); gUString[0] = '\0'; strncpy(gString, pText, sizeof(gString)); @@ -1165,7 +1165,7 @@ void CStats::BuildStatLine(char* pEntryName, void* pVal1, int nType, void* pVal2 } case STATTYPE_OUTOF: { - _snprintf(gUString, sizeof(gUString), "%d %s %d", *static_cast(pVal1), gxt->GetText("FEST_OO"), *static_cast(pVal2)); + _snprintf(gUString, sizeof(gUString), "%d %s %d", *static_cast(pVal1), TheText.GetText("FEST_OO"), *static_cast(pVal2)); return; } } diff --git a/VCS PC/StdAfx.h b/VCS PC/StdAfx.h index a642a51..d699e62 100644 --- a/VCS PC/StdAfx.h +++ b/VCS PC/StdAfx.h @@ -222,7 +222,6 @@ extern DWORD* activeInterior; extern DWORD* memoryAvailable; extern DWORD* memoryUsed; extern eFlash* wFlashingComponentID; -extern CFont::Details* fontDetails; extern long* CTRubberMinPos; extern long* CTRubberMaxPos; extern float* WidthAspectRatio; @@ -237,12 +236,11 @@ extern float* currentFPS; extern RsGlobalType& RsGlobal; extern CClock* clock_struct; extern CRGBA* BaseColors; -extern CMenuManager* menu; +extern CMenuManager& FrontEndMenuManager; extern CMusicManager* MusicManager; extern std::pair* const materialRestoreData; -extern CSprite2d* hudTextures; //extern CGridref* gridref; -extern CText* gxt; +extern CText& TheText; extern void** rwengine; extern CCamera* camera; extern CGarages* garages; diff --git a/VCS PC/UpdateManager.cpp b/VCS PC/UpdateManager.cpp index 2e26d24..15d88f4 100644 --- a/VCS PC/UpdateManager.cpp +++ b/VCS PC/UpdateManager.cpp @@ -75,7 +75,7 @@ void CUpdateManager::Process() break; case UPTMODULESTATE_ALL_READY: - EchoMessage(gxt->GetText("UPT_INS")); + EchoMessage(TheText.GetText("UPT_INS")); bSeenUpdaterScreenYet = false; break; } @@ -96,7 +96,7 @@ void CUpdateManager::Process() bTemp = true; else { - if ( !menu->IsActive() && !CTheScripts::IsPlayerOnAMission() ) + if ( !FrontEndMenuManager.IsActive() && !CTheScripts::IsPlayerOnAMission() ) { ++nTempCtr; @@ -192,7 +192,7 @@ void CUpdateManager::Display() float fStep = 0.05f * (CTimer::m_snTimeInMillisecondsPauseMode - dwPerformanceStepCounter); dwPerformanceStepCounter = CTimer::m_snTimeInMillisecondsPauseMode; - /*if ( menu->IsActive() ) + /*if ( FrontEndMenuManager.IsActive() ) fStep = 1000.0 / (*currentFPS); else fStep = CTimer::ms_fTimeStep;*/ @@ -244,33 +244,33 @@ void CUpdateManager::Display() CFont::SetFontStyle(FONT_Eurostile); CFont::SetTextAlignment(ALIGN_Right); CFont::SetTextOutline(1); - CFont::SetTextLetterSize(_width(0.35f), _height(0.65f)); + CFont::SetScale(_width(0.35f), _height(0.65f)); CFont::SetTextBorderRGBA(CRGBA(0, 0, 0, static_cast(nTextAlpha))); if ( nDrawingState == 2 || nDrawingState == 5 ) - CFont::SetTextColour(CRGBA(MENU_UPDATES_R, MENU_UPDATES_G, MENU_UPDATES_B, static_cast(nTextAlpha))); + CFont::SetColor(CRGBA(MENU_UPDATES_R, MENU_UPDATES_G, MENU_UPDATES_B, static_cast(nTextAlpha))); else - CFont::SetTextColour(CRGBA(255, 255, 255, static_cast(nTextAlpha))); + CFont::SetColor(CRGBA(255, 255, 255, static_cast(nTextAlpha))); switch ( nInterfaceStatus ) { case UPTMODULESTATE_IDLE: - CFont::PrintString(_x(15.0f), _y(7.5f), gxt->GetText(pUptModuleInterface->UpdateServiceOn() ? "FEU_NOU" : "FEU_USA")); + CFont::PrintString(_x(15.0f), _y(7.5f), TheText.GetText(pUptModuleInterface->UpdateServiceOn() ? "FEU_NOU" : "FEU_USA")); break; case UPTMODULESTATE_CHECKING: - CFont::PrintString(_x(15.0f), _y(7.5f), gxt->GetText("FEU_CHK")); + CFont::PrintString(_x(15.0f), _y(7.5f), TheText.GetText("FEU_CHK")); break; case UPTMODULESTATE_NEW_UPDATES: - CFont::PrintString(_x(15.0f), _y(7.5f), gxt->GetText("FEU_NEW")); + CFont::PrintString(_x(15.0f), _y(7.5f), TheText.GetText("FEU_NEW")); break; case UPTMODULESTATE_DOWNLOADING: - CMessages::InsertNumberInString(gxt->GetText("FEU_DLU"), static_cast(pUptModuleInterface->GetProgress()), -1, -1, -1, -1, -1, gString); + CMessages::InsertNumberInString(TheText.GetText("FEU_DLU"), static_cast(pUptModuleInterface->GetProgress()), -1, -1, -1, -1, -1, gString); CFont::PrintString(_x(15.0f), _y(7.5f), gString); break; case UPTMODULESTATE_ALL_READY: - CFont::PrintString(_x(15.0f), _y(7.5f), gxt->GetText("FEU_RDY")); + CFont::PrintString(_x(15.0f), _y(7.5f), TheText.GetText("FEU_RDY")); break; } } @@ -315,15 +315,15 @@ const char* CUpdateManager::GetGXTEntryForButton() switch ( nInterfaceStatus ) { case UPTMODULESTATE_CHECKING: - CFont::SetTextColour(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); + CFont::SetColor(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); return "FEU_UCK"; case UPTMODULESTATE_NEW_UPDATES: return "FEU_UPN"; case UPTMODULESTATE_DOWNLOADING: - CFont::SetTextColour(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); + CFont::SetColor(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); return "FEU_UDL"; case UPTMODULESTATE_ALL_READY: - CFont::SetTextColour(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); + CFont::SetColor(CRGBA(MENU_LOCKED_R, MENU_LOCKED_G, MENU_LOCKED_B)); default: return "FEU_UPC"; } diff --git a/VCS PC/VCSPC.cpp b/VCS PC/VCSPC.cpp index f7cea79..4f570e9 100644 --- a/VCS PC/VCSPC.cpp +++ b/VCS PC/VCSPC.cpp @@ -20,7 +20,7 @@ void InjectArrowMarker(); void OpaqueRadarHack2(RwPrimitiveType primType, RwIm2DVertex* vertices, RwInt32 numVertices); float __stdcall HelperPosXHack(int); void ReadLoadingSplashes(bool bIntroSplash, int nIntroSplashID); -void InitRegionalLanguageSets(); +void InitialiseLanguage(); void LoadGameFailedMessage(unsigned char bMessageIndex); void MessageLoop(); void CdStreamClearNames(); @@ -95,7 +95,7 @@ void PedDataConstructorInject_Civilian(); void PedDataConstructorInject_Cop(); void NodeCrashFix(); void NodeCrashFix2(); -void HUDInitialiseBreak(); +//void HUDInitialiseBreak(); void TimestampSignatureHack(); void LoadGameFailedMessage_Inject(); void SaveFallback_InjectOnLoad(); @@ -145,8 +145,8 @@ void FrameLimit_SetFPS(); void FrameLimit_SetFPS2(); void CameraInitHack(); void OpaqueRadarHack(); -void LoadFontsHack(); -void ReleaseFontsHack(); +/*void LoadFontsHack(); +void ReleaseFontsHack();*/ void SetCutsceneModelHack(); void ErrorSoundCentre(); void BuySoundCentre(); @@ -258,8 +258,8 @@ void* VideoPlayerRelease_JumpBack; void* MaxosFrameLimitHack_JumpBack; void* FrameLimit_SwitchInject_JumpBack; void* FrameLimit_StringInject_JumpBack; -void* LoadFontsHack_JumpBack; -void* ReleaseFontsHack_JumpBack; +/*void* LoadFontsHack_JumpBack; +void* ReleaseFontsHack_JumpBack;*/ void* SetCutsceneModelHack_JumpBack; #ifdef INCLUDE_MULTIFONTFILES void* MultipleFontsDAT_JumpBack; @@ -299,13 +299,11 @@ char* Garage_MessageIDString; float* currentFPS; RsGlobalType& RsGlobal = *(RsGlobalType*)0xC17040; CCamera* camera; -CFont::Details* fontDetails; -CText* gxt; +CText& TheText = *(CText*)0xC1B340; CClock* clock_struct; CRGBA* BaseColors; -CMenuManager* menu; +CMenuManager& FrontEndMenuManager = *(CMenuManager*)0xBA6748; CMusicManager* MusicManager; -CSprite2d* hudTextures; RpClump** arrowClump; std::pair* const materialRestoreData = (std::pair*)0xB4DBE8; CBlurStage* blurStages; @@ -822,8 +820,8 @@ __forceinline void DefineVariables() MaxosFrameLimitHack_JumpBack = (void*)0x748DA3; FrameLimit_SwitchInject_JumpBack = (void*)0x57CECF; FrameLimit_StringInject_JumpBack = (void*)0x57A168; - LoadFontsHack_JumpBack = (void*)0x5BA6E5; - ReleaseFontsHack_JumpBack = (void*)0x7189C6; + /*LoadFontsHack_JumpBack = (void*)0x5BA6E5; + ReleaseFontsHack_JumpBack = (void*)0x7189C6;*/ SetCutsceneModelHack_JumpBack = (void*)0x5B10DE; #ifdef INCLUDE_MULTIFONTFILES MultipleFontsDAT_JumpBack = (void*)0x7187DB; @@ -851,7 +849,6 @@ __forceinline void DefineVariables() fFOV = (float*)0x8D5038; bHideStyledTextWhileFading = (bool*)0xA44489; camera = (CCamera*)0xB6F028; - fontDetails = (CFont::Details*)0xC71A60; latestMissionName = (char*)0xB78A00; StyledText_1 = (char*)0xBAACC0; StyledText_2 = (char*)0xBAAD40; @@ -863,12 +860,9 @@ __forceinline void DefineVariables() PriorityText = (char*)0xBAB040; Garage_MessageIDString = (char*)0x96C014; currentFPS = (float*)0xB7CB50; - gxt = (CText*)0xC1B340; clock_struct = (CClock*)0xB70144; BaseColors = (CRGBA*)0xBAB22C; - menu = (CMenuManager*)0xBA6748; MusicManager = (CMusicManager*)0xB6BC90; - hudTextures = (CSprite2d*)0xBAB1FC; arrowClump = (RpClump**)0xC7C6F0; blurStages = (CBlurStage*)0x8D5190; //gridref = (CGridref*)0xC72FB0; @@ -2147,9 +2141,12 @@ __forceinline void Main_Patches() Patch(0x58A913, &fRadarPosY); Patch(0x58A9C7, &fRadarPosY); } + InjectHook(0x5BD76F, CHud::Initialise); + InjectHook(0x53BD51, CHud::ReInitialise); + InjectHook(0x53CA84, CHud::ReInitialise); InjectHook(0x4E9EF8, RadioNameInject, PATCH_JUMP); InjectHook(0x588B44, CHud::GetRidOfAllCustomHUDMessages, PATCH_JUMP); - InjectHook(0x588A4B, HUDInitialiseBreak, PATCH_JUMP); + //InjectHook(0x588A4B, HUDInitialiseBreak, PATCH_JUMP); InjectHook(0x588F50, CHud::SetVehicleName, PATCH_JUMP); InjectHook(0x588BB0, CHud::SetZoneName, PATCH_JUMP); InjectHook(0x58D542, CHud::DrawAreaText); @@ -2331,7 +2328,7 @@ __forceinline void Main_Patches() InjectHook(0x440F38, EnexMarkersColorBreak, PATCH_JUMP); // Font scale fix - InjectHook(0x7193A0, CFont::SetTextLetterSizeWithLanguageScaling, PATCH_JUMP); + InjectHook(0x7193A0, CFont::SetScaleLang, PATCH_JUMP); // Own textures loading /*#if DEBUG @@ -2580,32 +2577,34 @@ __forceinline void Main_Patches() call(0x5732A3, dwFunc, PATCH_NOTHING); #endif // Fonts related things - patch(0x718B6C, 4, 2); - patch(0x718B6F, 0x85, 1); - patch(0x71985E, CFont::Sprite, 4); - patch(0x719B08, CFont::Sprite, 4); - patch(0x718797, CFont::Size->bPropValue, 4); - patch(0x7188E7, CFont::Size->bPropValue, 4); - patch(0x719704, CFont::Size->bPropValue, 4); - patch(0x7197A6, CFont::Size->bPropValue, 4); - patch(0x719A91, CFont::Size->bPropValue, 4); - patch(0x7188BF, &CFont::Size->bSpaceChar, 4); - patch(0x7187AD, &CFont::Size->bUnpropValue, 4); - patch(0x718985, &CFont::Size->bUnpropValue, 4); - patch(0x71972E, &CFont::Size->bUnpropValue, 4); - patch(0x7197DF, &CFont::Size->bUnpropValue, 4); - patch(0x719AAF, &CFont::Size->bUnpropValue, 4); - call(0x7192C0, &CFont::AssignBottomFontIndex, PATCH_JUMP); - call(0x5BA6BD, &LoadFontsHack, PATCH_JUMP); - call(0x7189B2, &ReleaseFontsHack, PATCH_JUMP); - call(0x719490, &CFont::SetFontStyle, PATCH_JUMP); - nop(0x718B64, 6); - //call(0x7196DB, &CFont::AssignBottomFontIndex, PATCH_NOTHING); - //call(0x719770, &CFont::AssignBottomFontIndex, PATCH_NOTHING); - //call(0x7199C3, &CFont::AssignBottomFontIndex, PATCH_NOTHING); + Patch(0x718B6C, 4); + Patch(0x718B6F, 0x85); + Patch(0x71985E, CFont::Sprite); + Patch(0x719B08, CFont::Sprite); + Patch(0x718797, CFont::Size->bPropValue); + Patch(0x7188E7, CFont::Size->bPropValue); + Patch(0x719704, CFont::Size->bPropValue); + Patch(0x7197A6, CFont::Size->bPropValue); + Patch(0x719A91, CFont::Size->bPropValue); + Patch(0x7188BF, &CFont::Size->bSpaceChar); + Patch(0x7187AD, &CFont::Size->bUnpropValue); + Patch(0x718985, &CFont::Size->bUnpropValue); + Patch(0x71972E, &CFont::Size->bUnpropValue); + Patch(0x7197DF, &CFont::Size->bUnpropValue); + Patch(0x719AAF, &CFont::Size->bUnpropValue); + InjectHook(0x7192C0, CFont::FindSubFontCharacter, PATCH_JUMP); + //call(0x5BA6BD, &LoadFontsHack, PATCH_JUMP); + //call(0x7189B2, &ReleaseFontsHack, PATCH_JUMP); + InjectHook(0x719490, CFont::SetFontStyle, PATCH_JUMP); + InjectHook(0x5BD76A, CFont::Initialise); + InjectHook(0x53BBA7, CFont::Shutdown); + Nop(0x718B64, 6); + //call(0x7196DB, &CFont::FindSubFontCharacter, PATCH_NOTHING); + //call(0x719770, &CFont::FindSubFontCharacter, PATCH_NOTHING); + //call(0x7199C3, &CFont::FindSubFontCharacter, PATCH_NOTHING); // Language regional settings - call(0x74747E, &InitRegionalLanguageSets, PATCH_NOTHING); + InjectHook(0x74747E, InitialiseLanguage); // SPTA support /*_asm @@ -3688,6 +3687,9 @@ __forceinline void Main_Patches() // No csplay loading // patch(0x4D5E93, 0, 1); + // Radar blip names + InjectHook(0x5BA2CA, CRadar::LoadTextures); + // Global zone name strncpy((char*)0x86506C, "VICE_C", 7); @@ -3701,13 +3703,13 @@ __forceinline void Main_Patches() // Blip textures patches //VirtualProtect((char*)0x8665C0, 0x39C, PAGE_EXECUTE_READWRITE, &dwProtect[0]); - charptr(0x8D0898, "radar_JERRY"); + /*charptr(0x8D0898, "radar_JERRY"); charptr(0x8D0890, "radar_PHIL"); charptr(0x8D0880, "radar_MARTY"); charptr(0x8D0878, "radar_LOUISE"); charptr(0x8D0888, "radar_cshop"); charptr(0x8D0838, "radar_save"); - charptr(0x8D0758, "radar_bomb"); + charptr(0x8D0758, "radar_bomb");*/ // strncpy((char*)0x866694, "radar_JERRY", 12); // strncpy((char*)0x8666A0, "radar_PHIL", 16); // strncpy((char*)0x8666B0, "radar_cshop", 16); @@ -3725,10 +3727,10 @@ __forceinline void Main_Patches() // Pager //VirtualProtect((char*)0x86A470, 0x18, PAGE_EXECUTE_READWRITE, &dwProtect[0]); - strncpy((char*)0x86A470, "pagerA", 12); + /*strncpy((char*)0x86A470, "pagerA", 12); strncpy((char*)0x86A47C, "pager", 12); strncpy((char*)0x86A488, "barOutlineA", 16); - strncpy((char*)0x86A498, "barOutline", 16); + strncpy((char*)0x86A498, "barOutline", 16);*/ //VirtualProtect((char*)0x86A470, 0x18, dwProtect[0], &dwProtect[1]); // Handling data patches @@ -4338,7 +4340,7 @@ const char* GetFontsTXDByLanguage() eFontFileIDs GetFontsIDByLanguage() { - switch ( menu->GetLanguage() ) + switch ( FrontEndMenuManager.GetLanguage() ) { case LANG_Polish: return FONTF_Polish; @@ -4349,37 +4351,37 @@ eFontFileIDs GetFontsIDByLanguage() #endif -void InitRegionalLanguageSets() +void InitialiseLanguage() { - menu->SetTitleLanguage(0); + FrontEndMenuManager.SetTitleLanguage(0); switch ( (int)GetKeyboardLayout(0) & 0x3FF ) { //case LANG_SPANISH: - // menu->SetTextLanguage(LANG_Spanish); + // FrontEndMenuManager.SetTextLanguage(LANG_Spanish); // break; case LANG_POLISH: - menu->SetTextLanguage(LANG_Polish); + FrontEndMenuManager.SetTextLanguage(LANG_Polish); break; default: - menu->SetTextLanguage(LANG_English); + FrontEndMenuManager.SetTextLanguage(LANG_English); break; } switch ( GetUserDefaultLCID() & 0x3FF ) { //case LANG_SPANISH: - // menu->SetLanguage(LANG_Spanish); + // FrontEndMenuManager.SetLanguage(LANG_Spanish); // break; case LANG_POLISH: - menu->SetLanguage(LANG_Polish); + FrontEndMenuManager.SetLanguage(LANG_Polish); break; default: - menu->SetLanguage(LANG_English); + FrontEndMenuManager.SetLanguage(LANG_English); break; } - gxt->Clear(0); - gxt->Load(0); + TheText.Clear(0); + TheText.Load(0); } void LoadGameFailedMessage(unsigned char bMessageIndex) @@ -4406,7 +4408,7 @@ void LoadGameFailedMessage(unsigned char bMessageIndex) { MessageLoop(); CPad::UpdatePads(); - menu->ShowFullscreenMessage(pMessage, true, false); + FrontEndMenuManager.ShowFullscreenMessage(pMessage, true, false); if ( ( currKeyState->enter && !prevKeyState->enter ) || ( currKeyState->extenter && !prevKeyState->extenter ) || CPad::GetPad(0)->CrossJustDown() ) @@ -5162,7 +5164,7 @@ void __declspec(naked) Clock_StringInject() { _asm { - mov ecx, [gxt] + mov ecx, [TheText] cmp al, 1 jnz Clock_StringInject_Compare12H push offset aFem_24H @@ -5500,14 +5502,14 @@ void __declspec(naked) NodeCrashFix2() } } -void __declspec(naked) HUDInitialiseBreak() +/*void __declspec(naked) HUDInitialiseBreak() { _asm { pop edi jmp CHud::Initialise } -} +}*/ /*void __declspec(naked) TimestampSignatureHack() { @@ -5857,7 +5859,7 @@ void __declspec(naked) WidescreenSupportRecalculateHack() { mov eax, [RsGlobal] mov [eax].MaximumHeight, edx - mov eax, [menu] + mov eax, [FrontEndMenuManager] mov al, [eax].m_bAspectRatioMode test al, al jnz WidescreenSupportRecalculateHack_SkipRecalculation @@ -6028,7 +6030,7 @@ void __declspec(naked) Widescreen_StringInject() push offset gString call _snprintf add esp, 10h - mov ecx, [gxt] + mov ecx, [TheText] push offset gString jmp Clock_StringInject_JumpBack } @@ -6339,7 +6341,7 @@ void __declspec(naked) FrameLimit_StringInject() { _asm { - mov ecx, [gxt] + mov ecx, [TheText] test al, al jz FrameLimit_StringInject_Off movzx eax, al @@ -6428,7 +6430,7 @@ void __declspec(naked) OpaqueRadarHack() } -void __declspec(naked) LoadFontsHack() +/*void __declspec(naked) LoadFontsHack() { CFont::Sprite[0].SetTexture("font1", "font1m"); CFont::Sprite[1].SetTexture("font2", "font2m"); @@ -6444,7 +6446,7 @@ void __declspec(naked) ReleaseFontsHack() CFont::Sprite[2].Delete(); CFont::Sprite[3].Delete(); _asm jmp ReleaseFontsHack_JumpBack -} +}*/ void __declspec(naked) SetCutsceneModelHack() { @@ -6593,7 +6595,7 @@ void __declspec(naked) UpdaterTextSwap() call CUpdateManager::GetGXTEntryForButton UpdaterTextSwap_GetText: - mov ecx, [gxt] + mov ecx, [TheText] push eax push 579D73h retn @@ -6613,7 +6615,7 @@ void __declspec(naked) UpdaterTextSwap() UpdaterTextSwap_NotDLCText: cmp cl, ACTION_JOYMOUSE - mov ecx, [gxt] + mov ecx, [TheText] push 579D58h retn } @@ -6796,7 +6798,7 @@ void __declspec(naked) InjectWindowedMode() //mov ebx, eax //mov eax, [esp+30h] //push offset aWindowed - //mov ecx, gxt + //mov ecx, TheText //call CText::GetText //mov stackPtr, eax //pushad diff --git a/VCS PC/WidescreenSupport.cpp b/VCS PC/WidescreenSupport.cpp index 3b36014..ace142c 100644 --- a/VCS PC/WidescreenSupport.cpp +++ b/VCS PC/WidescreenSupport.cpp @@ -74,7 +74,7 @@ void WidescreenSupport::Recalculate(long nWidth, long nHeight, bool bAlways) savedResWidth = nWidth; savedResHeight = nHeight; - if ( !menu->m_bAspectRatioMode ) + if ( !FrontEndMenuManager.m_bAspectRatioMode ) { if ( nWidth == 720 && nHeight == 576 ) { @@ -97,8 +97,8 @@ void WidescreenSupport::Recalculate(long nWidth, long nHeight, bool bAlways) } else { - fNewResolutionWidthMultiplier = fPrecalculatedMultipliers[menu->m_bAspectRatioMode - 1]; - fNewResolutionHeightMultiplier = fPrecalculatedHeightMults[menu->m_bAspectRatioMode - 1]; + fNewResolutionWidthMultiplier = fPrecalculatedMultipliers[FrontEndMenuManager.m_bAspectRatioMode - 1]; + fNewResolutionHeightMultiplier = fPrecalculatedHeightMults[FrontEndMenuManager.m_bAspectRatioMode - 1]; } nCTRubberSlider = fNewResolutionWidthMultiplier/2.0; @@ -157,7 +157,7 @@ void WidescreenSupport::Recalculate(long nWidth, long nHeight, bool bAlways) float WidescreenSupport::SetAspectRatio() { - switch ( menu->m_bAspectRatioMode ) + switch ( FrontEndMenuManager.m_bAspectRatioMode ) { case 1: return *ScreenAspectRatio = 4.0/3.0;