diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index 54c97d06..5559b1c4 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -18,6 +18,8 @@ // TODO: figure out the meaning of this enum { SOME_FLAG = 0x80 }; +bool CTrafficLights::bGreenLightsCheat; + void CTrafficLights::DisplayActualLight(CEntity *ent) { @@ -310,6 +312,12 @@ CTrafficLights::LightForPeds(void) uint8 CTrafficLights::LightForCars1(void) { + if (CWeather::Wind > 1.1f) + return CAR_LIGHTS_GREEN; + + if (bGreenLightsCheat) + return CAR_LIGHTS_GREEN; + uint32 period = CTimer::GetTimeInMilliseconds() % 16384; if(period < 5000) @@ -323,6 +331,12 @@ CTrafficLights::LightForCars1(void) uint8 CTrafficLights::LightForCars2(void) { + if (CWeather::Wind > 1.1f) + return CAR_LIGHTS_GREEN; + + if (bGreenLightsCheat) + return CAR_LIGHTS_GREEN; + uint32 period = CTimer::GetTimeInMilliseconds() % 16384; if(period < 6000) diff --git a/src/control/TrafficLights.h b/src/control/TrafficLights.h index f3df6cd5..6cd5e04a 100644 --- a/src/control/TrafficLights.h +++ b/src/control/TrafficLights.h @@ -16,6 +16,8 @@ enum { class CTrafficLights { public: + static bool bGreenLightsCheat; + static void DisplayActualLight(CEntity *ent); static void ScanForLightsOnMap(void); static int FindTrafficLightType(CEntity *light); diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 715e9061..cdecb8b4 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -5369,6 +5369,7 @@ CMenuManager::ConstructStatLine(int rowIdx) STAT_LINE("FEST_CC", &CStats::CriminalsCaught, false, nil); STAT_LINE("FEST_FE", &CStats::FiresExtinguished, false, nil); STAT_LINE("DAYPLC", &(nTemp = CTimer::GetTimeInMilliseconds() + 100), false, nil); + //TODO(MIAMI): move this function to the CStats and add reading of Stat lines tied with "MEDIA" for the "CHASESTAT" cheatcode return counter; #undef STAT_LINE diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 42b26c63..193ca1c5 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -47,6 +47,7 @@ #include "platform.h" #include "Stats.h" #include "CarCtrl.h" +#include "TrafficLights.h" #ifdef GTA_PS2 #include "eetypes.h" @@ -208,15 +209,20 @@ void HealthCheat() } } -void VehicleCheat(bool something, int model) +void VehicleCheat(int model) { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); - CStreaming::RequestModel(model, 0); - CStreaming::LoadAllRequestedModels(something); + CStreaming::RequestModel(model, STREAMFLAGS_DONT_REMOVE); + CStreaming::LoadAllRequestedModels(false); if (CStreaming::ms_aInfoForModel[model].m_loadState == STREAMSTATE_LOADED) { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); - int32 node = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 100.0f); + if (!(CStreaming::ms_aInfoForModel[model].m_loadState & STREAMFLAGS_DONT_REMOVE)) { + CStreaming::SetModelIsDeletable(model); + CStreaming::SetModelTxdIsDeletable(model); + } + + int32 node = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 100.0f); if (node < 0) return; #ifdef FIX_BUGS @@ -362,18 +368,18 @@ void SunnyWeatherCheat() CWeather::ForceWeatherNow(WEATHER_SUNNY); } +void ExtraSunnyWeatherCheat() +{ + CHud::SetHelpMessage(TheText.Get("CHEAT7"), true); + CWeather::ForceWeatherNow(WEATHER_EXTRA_SUNNY); +} + void CloudyWeatherCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT7"), true); CWeather::ForceWeatherNow(WEATHER_CLOUDY); } -void StormyWeatherCheat() -{ - CHud::SetHelpMessage(TheText.Get("CHEAT7"), true); - CWeather::ForceWeatherNow(WEATHER_HURRICANE); -} - void RainyWeatherCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT7"), true); @@ -442,6 +448,12 @@ void PinkCarsCheat() gbPinkCars = true; } +void TrafficLightsCheat() +{ + CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); + CTrafficLights::bGreenLightsCheat = true; +} + void MadCarsCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); @@ -548,6 +560,11 @@ void FlyingFishCheat(void) CVehicle::bCheat8 = !CVehicle::bCheat8; } +void DoShowChaseStatCheat(void) { + CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); + CStats::ShowChaseStatOnScreen = 1; +} + bool CControllerState::CheckForInput(void) { @@ -1030,7 +1047,7 @@ void CPad::AddToCheatString(char c) // "CCCCCC321TCT" - CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE R1 L2 L1 TRIANGLE CIRCLE TRIANGLE else if ( !_CHEATCMP("TCT123CCCCCC") ) - VehicleCheat(true, MI_RHINO); + VehicleCheat(MI_RHINO); // "CCCSSSSS1TCT" - CIRCLE CIRCLE CIRCLE SQUARE SQUARE SQUARE SQUARE SQUARE L1 TRIANGLE CIRCLE TRIANGLE else if ( !_CHEATCMP("TCT1SSSSSCCC") ) @@ -1142,19 +1159,22 @@ void CPad::AddToPCCheatString(char c) // "APLEASANTDAY" else if (!Cheat_strncmp(KeyBoardCheatString, "\\FKU[\\VHFW]I")) { KeyBoardCheatString[0] = ' '; - CloudyWeatherCheat(); + SunnyWeatherCheat(); } // "ALOVELYDAY" else if (!Cheat_strncmp(KeyBoardCheatString, "\\FKZY`YVML")) { KeyBoardCheatString[0] = ' '; - SunnyWeatherCheat(); + ExtraSunnyWeatherCheat(); } // "ABITDRIEG" - + else if (!Cheat_strncmp(KeyBoardCheatString, "JJPSQoLIB")) { + KeyBoardCheatString[0] = ' '; + CloudyWeatherCheat(); + } // "CATSANDDOGS" else if (!Cheat_strncmp(KeyBoardCheatString, "VLVEQiDZULP")) { KeyBoardCheatString[0] = ' '; - StormyWeatherCheat(); + RainyWeatherCheat(); } // "CANTSEEATHING" else if (!Cheat_strncmp(KeyBoardCheatString, "JSPIa\\HLT_[IJ")) { @@ -1164,10 +1184,13 @@ void CPad::AddToPCCheatString(char c) // "PANZER" else if (!Cheat_strncmp(KeyBoardCheatString, "UJaONk")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_RHINO); + VehicleCheat(MI_RHINO); } // "LIFEISPASSINGMEBY" - + else if (!Cheat_strncmp(KeyBoardCheatString, "\\GLNTiLZTL][PeSOh")) { + KeyBoardCheatString[0] = ' '; + FastWeatherCheat(); + } // "BIGBANG" else if (!Cheat_strncmp(KeyBoardCheatString, "JSHCTdE")) { KeyBoardCheatString[0] = ' '; @@ -1221,6 +1244,7 @@ void CPad::AddToPCCheatString(char c) // "CHASESTAT" else if (!Cheat_strncmp(KeyBoardCheatString, "WF[TRnDOD")) { KeyBoardCheatString[0] = ' '; + DoShowChaseStatCheat(); } // "CHICKSWITHGUNS" else if (!Cheat_strncmp(KeyBoardCheatString, "VS\\HUoL^TVPQOc")) { @@ -1235,6 +1259,7 @@ void CPad::AddToPCCheatString(char c) // "GREENLIGHT" else if (!Cheat_strncmp(KeyBoardCheatString, "WMNJYiHLSR")) { KeyBoardCheatString[0] = ' '; + TrafficLightsCheat(); } // "MIAMITRAFFIC" else if (!Cheat_strncmp(KeyBoardCheatString, "FNMGNmWPNLVU")) { @@ -1254,47 +1279,47 @@ void CPad::AddToPCCheatString(char c) // "TRAVELINSTYLE" else if (!Cheat_strncmp(KeyBoardCheatString, "HQ`U`iLSFaNZ[")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_BLOODRA); + VehicleCheat(MI_BLOODRA); } // "THELASTRIDE" else if (!Cheat_strncmp(KeyBoardCheatString, "HIPSanDSFSa")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_ROMERO); + VehicleCheat(MI_ROMERO); } // "ROCKANDROLLCAR" else if (!Cheat_strncmp(KeyBoardCheatString, "UFJMYjUKOLXKVr")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_LOVEFIST); + VehicleCheat(MI_LOVEFIST); } // "RUBBISHCAR" else if (!Cheat_strncmp(KeyBoardCheatString, "UFJI`dEIV]")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_TRASH); + VehicleCheat(MI_TRASH); } // "GETTHEREQUICKLY" else if (!Cheat_strncmp(KeyBoardCheatString, "\\QRDVpTLSPU\\[eT")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_BLOODRB); + VehicleCheat(MI_BLOODRB); } // "GETTHEREFAST" else if (!Cheat_strncmp(KeyBoardCheatString, "WXHGRmHOU_RO")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_SABRETUR); + VehicleCheat(MI_SABRETUR); } // "BETTERTHANWALKING" else if (!Cheat_strncmp(KeyBoardCheatString, "JSPLY\\ZUBSaZLtaK^")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_CADDY); + VehicleCheat(MI_CADDY); } // "GETTHEREFASTINDEED" else if (!Cheat_strncmp(KeyBoardCheatString, "GJLE[dWZBQfZLvRXa[^WHL")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_HOTRINA); + VehicleCheat(MI_HOTRINA); } // "GETTHEREAMAZINGLYFAST" else if (!Cheat_strncmp(KeyBoardCheatString, "WXHGfgJUJeNUHe_Kdg^HJ")) { KeyBoardCheatString[0] = ' '; - VehicleCheat(true, MI_HOTRINB); + VehicleCheat(MI_HOTRINB); } // LOOKLIKELANCE else if (!Cheat_strncmp(KeyBoardCheatString, "HHUBY`NPMV\\WS")) { @@ -1346,6 +1371,16 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; ChangePlayerModel("igdiaz"); } + // DEEPFRIEDMARSBARS + else if (!Cheat_strncmp(KeyBoardCheatString, "VWHC`mDTEPVZMpRK")) { + KeyBoardCheatString[0] = ' '; + gfTommyFatness = 0.26f; + } + // PROGRAMMER + else if (!Cheat_strncmp(KeyBoardCheatString, "UJTNNmJVS[")) { + KeyBoardCheatString[0] = ' '; + gfTommyFatness = -0.3f; + } // SEAWAYS else if (!Cheat_strncmp(KeyBoardCheatString, "V^HXN`V")) { KeyBoardCheatString[0] = ' '; @@ -1366,17 +1401,6 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; FannyMagnetCheat(); } - // "ILOVESCOTLAND" - if (!_CHEATCMP("DNALTOCSEVOLI")) - RainyWeatherCheat(); - - // "MADWEATHER" - if (!_CHEATCMP("REHTAEWDAM")) - FastWeatherCheat(); - - // "CHITTYCHITTYBB" - if (!_CHEATCMP("BBYTTIHCYTTIHC")) - ChittyChittyBangBangCheat(); // "NASTYLIMBSCHEAT" if (!_CHEATCMP("TAEHCSBMILYTSAN")) @@ -3117,6 +3141,8 @@ void CPad::ResetCheats(void) gbBlackCars = false; gbPinkCars = false; CCarCtrl::bMadDriversCheat = false; + CTrafficLights::bGreenLightsCheat = false; + CStats::ShowChaseStatOnScreen = 0; gbFastTime = false; CTimer::SetTimeScale(1.0f); } diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp index 1efcee01..9c3ad084 100644 --- a/src/core/Stats.cpp +++ b/src/core/Stats.cpp @@ -341,6 +341,30 @@ wchar *CStats::FindCriminalRatingString() return TheText.Get(CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney > 10000000 ? "RATNG52" : "RATNG51"); } +wchar *CStats::FindChaseString(float fMediaLevel) { + if (fMediaLevel < 20.0f) return TheText.Get("MEDIA1"); + if (fMediaLevel < 50.0f) return TheText.Get("MEDIA2"); + if (fMediaLevel < 75.0f) return TheText.Get("MEDIA3"); + if (fMediaLevel < 100.0f) return TheText.Get("MEDIA4"); + if (fMediaLevel < 150.0f) return TheText.Get("MEDIA5"); + if (fMediaLevel < 200.0f) return TheText.Get("MEDIA6"); + if (fMediaLevel < 250.0f) return TheText.Get("MEDIA7"); + if (fMediaLevel < 300.0f) return TheText.Get("MEDIA8"); + if (fMediaLevel < 350.0f) return TheText.Get("MEDIA9"); + if (fMediaLevel < 400.0f) return TheText.Get("MEDIA10"); + if (fMediaLevel < 500.0f) return TheText.Get("MEDIA11"); + if (fMediaLevel < 600.0f) return TheText.Get("MEDIA12"); + if (fMediaLevel < 700.0f) return TheText.Get("MEDIA13"); + if (fMediaLevel < 800.0f) return TheText.Get("MEDIA14"); + if (fMediaLevel < 900.0f) return TheText.Get("MEDIA15"); + if (fMediaLevel < 1000.0f) return TheText.Get("MEDIA16"); + if (fMediaLevel < 1200.0f) return TheText.Get("MEDIA17"); + if (fMediaLevel < 1400.0f) return TheText.Get("MEDIA18"); + if (fMediaLevel < 1600.0f) return TheText.Get("MEDIA19"); + if (fMediaLevel < 1800.0f) return TheText.Get("MEDIA20"); + return TheText.Get("MEDIA21"); +} + int32 CStats::FindCriminalRatingNumber() { int32 rating; diff --git a/src/core/Stats.h b/src/core/Stats.h index f9ad4174..ad6fe516 100644 --- a/src/core/Stats.h +++ b/src/core/Stats.h @@ -118,6 +118,7 @@ public: static void RegisterLevelFireMission(int32); static void AnotherFireExtinguished(); static wchar *FindCriminalRatingString(); + static wchar *FindChaseString(float fMediaLevel); static void AnotherKillFrenzyPassed(); static void SetTotalNumberKillFrenzies(int32); static void SetTotalNumberMissions(int32); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 0b80862e..1393314c 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -80,7 +80,7 @@ void WeaponCheat1(); void WeaponCheat2(); void WeaponCheat3(); void HealthCheat(); -void VehicleCheat(bool something, int model); +void VehicleCheat(int model); void BlowUpCarsCheat(); void ChangePlayerCheat(); void MayhemCheat(); @@ -353,7 +353,7 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Cheats", "Health", HealthCheat); DebugMenuAddCmd("Cheats", "Wanted level up", WantedLevelUpCheat); DebugMenuAddCmd("Cheats", "Wanted level down", WantedLevelDownCheat); - DebugMenuAddCmd("Cheats", "Tank", []() { VehicleCheat(true, MI_TAXI); }); + DebugMenuAddCmd("Cheats", "Tank", []() { VehicleCheat(MI_TAXI); }); DebugMenuAddCmd("Cheats", "Blow up cars", BlowUpCarsCheat); DebugMenuAddCmd("Cheats", "Change player", ChangePlayerCheat); DebugMenuAddCmd("Cheats", "Mayhem", MayhemCheat); diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 0cc5eeaf..b5fc00e4 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -145,6 +145,8 @@ void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->N void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); } +float gfTommyFatness = 1.0f; + // --MIAMI: Done CPed::~CPed(void) { @@ -16441,7 +16443,78 @@ CPed::PreRender(void) RwMatrixScale(head, &zero, rwCOMBINEPRECONCAT); } - // TODO(Miami): Some cheat?? + if (IsPlayer() && gfTommyFatness != 1.0f) { + RpHAnimHierarchy* hier = GetAnimHierarchyFromSkinClump(GetClump()); + int32 idx; + RwV3d scale; + + scale.x = 1.0f; + scale.y = 1.0f + gfTommyFatness * 0.7f; + scale.z = 1.0f + gfTommyFatness * 0.7f; + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_HEAD)); + RwMatrix* head = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(head, &scale, rwCOMBINEPRECONCAT); + + scale.y = 1.0f + gfTommyFatness * 0.2f; + scale.z = 1.0f + gfTommyFatness * 0.2f; + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_NECK)); + RwMatrix* neck = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(neck, &scale, rwCOMBINEPRECONCAT); + + scale.y = 1.0f + gfTommyFatness * 0.5f; + scale.z = 1.0f + gfTommyFatness * 0.5f; + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_MID)); + RwMatrix* mid = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(mid, &scale, rwCOMBINEPRECONCAT); + + scale.y = 1.0f + gfTommyFatness; + scale.z = 1.0f + gfTommyFatness; + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_UPPERLEGL)); + RwMatrix* upperLegL = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(upperLegL, &scale, rwCOMBINEPRECONCAT); + + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_UPPERLEGR)); + RwMatrix* upperLegR = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(upperLegR, &scale, rwCOMBINEPRECONCAT); + + scale.y = 1.0f + gfTommyFatness * 0.5f; + scale.z = 1.0f + gfTommyFatness * 0.5f; + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_LOWERLEGR)); + RwMatrix* lowerLegR = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(lowerLegR, &scale, rwCOMBINEPRECONCAT); + + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_LOWERLEGL)); + RwMatrix* lowerLegL = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(lowerLegL, &scale, rwCOMBINEPRECONCAT); + + scale.y = 1.0f + gfTommyFatness * 0.23f; + scale.z = 1.0f + gfTommyFatness * 0.23f; + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_FOOTL)); + RwMatrix* footL = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(footL, &scale, rwCOMBINEPRECONCAT); + + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_FOOTR)); + RwMatrix* footR = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(footR, &scale, rwCOMBINEPRECONCAT); + + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_UPPERARML)); + RwMatrix* upperArmL = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(upperArmL, &scale, rwCOMBINEPRECONCAT); + + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_UPPERARMR)); + RwMatrix* upperArmR = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(upperArmR, &scale, rwCOMBINEPRECONCAT); + + scale.y = 1.0f + gfTommyFatness * 0.2f; + scale.z = 1.0f + gfTommyFatness * 0.2f; + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_FOREARML)); + RwMatrix* foreArmL = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(foreArmL, &scale, rwCOMBINEPRECONCAT); + + idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_FOREARMR)); + RwMatrix* foreArmR = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; + RwMatrixScale(foreArmR, &scale, rwCOMBINEPRECONCAT); + } if (bBodyPartJustCameOff && bIsPedDieAnimPlaying && m_bodyPartBleeding != -1 && (CTimer::GetFrameCounter() & 7) > 3) { CVector bloodDir(0.0f, 0.0f, 0.0f); diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 815d9c2d..944c851e 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -358,6 +358,8 @@ enum eMoveState { PEDMOVE_THROWN }; +extern float gfTommyFatness; + class CVehicle; class CPed : public CPhysical diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 77d2af2a..31bf92a8 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -1611,13 +1611,13 @@ void CScriptPath::Clear(void) { m_state = SCRIPT_PATH_DISABLED; } -void CScriptPath::InitialiseOne(int32 numNodes, float width) { +void CScriptPath::InitialiseOne(int32 numNodes, float length) { char Dest[32]; sprintf(Dest, "data\\paths\\spath%d.dat", numNodes); m_pNode = CPlane::LoadPath(Dest, m_numNodes, m_fTotalLength, false); m_fSpeed = 1.0f; m_fPosition = 0.0f; - m_fObjectLength = width; + m_fObjectLength = length; m_state = SCRIPT_PATH_INITIALIZED; } @@ -1697,7 +1697,7 @@ INITSAVEBUF VALIDATESAVEBUF(*size); } -CObject* g_pScriptPathObjects[18]; +CObject *g_pScriptPathObjects[18]; void CScriptPaths::Load_ForReplay(void) { for (int i = 0; i < 3; i++) { diff --git a/src/render/Fluff.h b/src/render/Fluff.h index a31ac335..0fc57c73 100644 --- a/src/render/Fluff.h +++ b/src/render/Fluff.h @@ -24,7 +24,7 @@ public: void Clear(void); void Update(void); - void InitialiseOne(int32 numNodes, float width); + void InitialiseOne(int32 numNodes, float length); void FindCoorsFromDistanceOnPath(float t, float *pX, float *pY, float *pZ); void SetObjectToControl(CObject *pObj); }; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index cbf3c7f2..c05a3d31 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -21,6 +21,8 @@ #include "User.h" #include "World.h" #include "CutsceneMgr.h" +#include "Stats.h" +#include "main.h" // Game has colors inlined in code. // For easier modification we collect them here: @@ -91,6 +93,8 @@ float CHud::PagerXOffset; int16 CHud::PagerTimer; int16 CHud::PagerOn; +wchar *prevChaseString; + uint32 CHud::m_WantedFadeTimer; uint32 CHud::m_WantedState; uint32 CHud::m_WantedTimer; @@ -524,6 +528,53 @@ void CHud::Draw() } } + static int32 nMediaLevelCounter = 0; + if (CStats::ShowChaseStatOnScreen != 0) { + float fCurAttentionLevel = CWorld::Players[CWorld::PlayerInFocus].m_fMediaAttention; + if (0.7f * CStats::HighestChaseValue > fCurAttentionLevel + || fCurAttentionLevel <= 40.0f || CTheScripts::IsPlayerOnAMission()) { + nMediaLevelCounter = 0; + } + else { + if (fCurAttentionLevel == CStats::HighestChaseValue) { + sprintf(gString, "%s %d", UnicodeToAscii(TheText.Get("CHSE")), (int32)fCurAttentionLevel); + } + else { + sprintf(gString, "%s %d" "-%d-", UnicodeToAscii(TheText.Get("CHSE")), (int32)fCurAttentionLevel, (int32)CStats::HighestChaseValue); + } + AsciiToUnicode(gString, gUString); + CFont::SetBackgroundOff(); + CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y)); + CFont::SetCentreOff(); + CFont::SetRightJustifyOn(); + CFont::SetRightJustifyWrap(0.0f); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(FONT_HEADING); + CFont::SetPropOff(); + CFont::SetDropShadowPosition(2); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); + + CRGBA colour; + if (CTimer::GetTimeInMilliseconds() & 0x200) + colour = CRGBA(204, 0, 185, 180); + else + colour = CRGBA(178, 0, 162, 180); + CFont::SetColor(colour); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(113.0f), gUString); + + if (CStats::FindChaseString(fCurAttentionLevel) != prevChaseString) { + prevChaseString = CStats::FindChaseString(fCurAttentionLevel); + nMediaLevelCounter = 100; + } + + if (nMediaLevelCounter != 0) { + nMediaLevelCounter--; + UnicodeMakeUpperCase(gUString, CStats::FindChaseString(fCurAttentionLevel)); + CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(138.0f), gUString); + } + } + } + /* DrawZoneName */ diff --git a/src/text/Text.cpp b/src/text/Text.cpp index dab1cae3..64f303eb 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -494,6 +494,20 @@ UnicodeToAsciiForMemoryCard(wchar *src) return aStr; } +void +UnicodeMakeUpperCase(wchar *dst, wchar *src) //idk what to do with it, seems to be incorrect implementation by R* +{ + while (*src != '\0') { + if (*src < 'a' || *src > 'z') + *dst = *src; + else + *dst = *src - 32; + dst++; + src++; + } + *dst = '\0'; +} + void UnicodeStrcpy(wchar *dst, const wchar *src) { diff --git a/src/text/Text.h b/src/text/Text.h index d163b9c9..0bad9a83 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -8,6 +8,7 @@ void UnicodeStrcpy(wchar *dst, const wchar *src); void UnicodeStrcat(wchar *dst, wchar *append); int UnicodeStrlen(const wchar *str); void TextCopy(wchar *dst, const wchar *src); +void UnicodeMakeUpperCase(wchar *dst, wchar *src); struct CKeyEntry {