Exposed ColouredZoneNames to debug menu (on 1.0 only)

This commit is contained in:
Silent 2017-11-15 00:20:17 +01:00
parent 2272250483
commit ff823f1eb9
2 changed files with 44 additions and 34 deletions

View file

@ -47,6 +47,7 @@ public:
// SilentPatch // SilentPatch
CRGBA* BlendGangColour(uint8_t r, uint8_t g, uint8_t b, uint8_t a); CRGBA* BlendGangColour(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
CRGBA* BlendGangColour_Dynamic(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
}; };
class CRect class CRect

View file

@ -664,6 +664,21 @@ void DrawMoonWithPhases(int moonColor, float* screenPos, float sizeX, float size
//D3DPERF_EndEvent(); //D3DPERF_EndEvent();
} }
static bool bColouredZoneNames;
CRGBA* CRGBA::BlendGangColour_Dynamic(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
if ( bColouredZoneNames )
{
const double colourIntensity = std::min( static_cast<double>(pCurrZoneInfo->ZoneColour.a) / 120.0, 1.0 );
*this = CRGBA(BlendSqr( HudColour[3], CRGBA(r, g, b), colourIntensity ), a);
}
else
{
*this = HudColour[3];
}
return this;
}
CRGBA* CRGBA::BlendGangColour(uint8_t r, uint8_t g, uint8_t b, uint8_t a) CRGBA* CRGBA::BlendGangColour(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{ {
const double colourIntensity = std::min( static_cast<double>(pCurrZoneInfo->ZoneColour.a) / 120.0, 1.0 ); const double colourIntensity = std::min( static_cast<double>(pCurrZoneInfo->ZoneColour.a) / 120.0, 1.0 );
@ -2256,19 +2271,19 @@ BOOL InjectDelayedPatches_10()
Patch<const void*>(0x4E9F38, &fSteamRadioNameSizeX); Patch<const void*>(0x4E9F38, &fSteamRadioNameSizeX);
} }
{ if ( int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", -1, wcModulePath); INIoption != -1 )
int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", -1, wcModulePath);
if ( INIoption == 1 )
{ {
// Coloured zone names // Coloured zone names
bColouredZoneNames = INIoption != 0;
Patch<WORD>(0x58ADBE, 0x0E75); Patch<WORD>(0x58ADBE, 0x0E75);
Patch<WORD>(0x58ADC5, 0x0775); Patch<WORD>(0x58ADC5, 0x0775);
InjectHook(0x58ADE4, &CRGBA::BlendGangColour); InjectHook(0x58ADE4, &CRGBA::BlendGangColour_Dynamic);
}
else if ( INIoption == 0 ) if ( bHasDebugMenu )
{ {
Patch<BYTE>(0x58ADAE, 0xEB); DebugMenuAddVar( "SilentPatch", "Coloured zone names", &bColouredZoneNames, nullptr );
} }
} }
@ -2589,9 +2604,7 @@ BOOL InjectDelayedPatches_11()
Patch<const void*>(0x4EA388, &fSteamRadioNameSizeX); Patch<const void*>(0x4EA388, &fSteamRadioNameSizeX);
} }
{ if ( int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", -1, wcModulePath); INIoption == 1 )
int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", -1, wcModulePath);
if ( INIoption == 1 )
{ {
// Coloured zone names // Coloured zone names
Patch<WORD>(0x58B58E, 0x0E75); Patch<WORD>(0x58B58E, 0x0E75);
@ -2603,7 +2616,6 @@ BOOL InjectDelayedPatches_11()
{ {
Patch<BYTE>(0x58B57E, 0xEB); Patch<BYTE>(0x58B57E, 0xEB);
} }
}
// ImVehFt conflicts // ImVehFt conflicts
if ( !bHasImVehFt ) if ( !bHasImVehFt )
@ -2754,9 +2766,7 @@ BOOL InjectDelayedPatches_Steam()
Patch<const void*>(0x4F59BF, &dRetailRadioNameSizeX); Patch<const void*>(0x4F59BF, &dRetailRadioNameSizeX);
} }
{ if ( int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", -1, wcModulePath); INIoption == 1 )
int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", -1, wcModulePath);
if ( INIoption == 1 )
{ {
// Coloured zone names // Coloured zone names
Patch<WORD>(0x598F65, 0x0C75); Patch<WORD>(0x598F65, 0x0C75);
@ -2768,7 +2778,6 @@ BOOL InjectDelayedPatches_Steam()
{ {
Patch<BYTE>(0x598F56, 0xEB); Patch<BYTE>(0x598F56, 0xEB);
} }
}
// ImVehFt conflicts // ImVehFt conflicts
if ( !bHasImVehFt ) if ( !bHasImVehFt )