From 881db86895dd5427efd3962909214be06270e1ab Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Fri, 9 Oct 2020 20:29:38 +0300 Subject: CSpecialFX and some other classes --- src/control/Script.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index aa4e109f..d05a1442 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1804,9 +1804,8 @@ void CMissionCleanup::Process() if (!CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle) TheCamera.Restore(); TheCamera.SetWideScreenOff(); - // TODO(MIAMI) - //CSpecialFX::bLiftCam = false; - //CSpecialFX::bVideoCam = false; + CSpecialFX::bLiftCam = false; + CSpecialFX::bVideoCam = false; CTimeCycle::StopExtraColour(0); for (int i = 0; i < MISSION_AUDIO_SLOTS; i++) DMAudio.ClearMissionAudio(i); @@ -12395,7 +12394,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_SWITCH_SECURITY_CAMERA: { CollectParameters(&m_nIp, 1); - debug("SWITCH_SECURITY_CAMERA is not implemented\n"); // TODO(MIAMI) + CSpecialFX::bVideoCam = ScriptParams[0] != 0; return 0; } //case COMMAND_IS_CHAR_IN_FLYING_VEHICLE: @@ -12833,7 +12832,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_SWITCH_LIFT_CAMERA: { CollectParameters(&m_nIp, 1); - debug("SWITCH_LIFT_CAMERA is not implemented\n"); // TODO(MIAMI) + CSpecialFX::bLiftCam = ScriptParams[0] != 0; return 0; } case COMMAND_CLOSE_ALL_CAR_DOORS: -- cgit v1.2.3 From c4d48213273aad8d1c076ea44238dd65c75d9961 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 11 Oct 2020 12:56:33 +0300 Subject: Control updates --- src/control/AutoPilot.cpp | 14 +- src/control/Bridge.cpp | 2 + src/control/CarCtrl.cpp | 4 +- src/control/Darkel.cpp | 150 ++++++++------ src/control/Darkel.h | 4 +- src/control/GameLogic.cpp | 5 +- src/control/Garages.cpp | 12 +- src/control/Garages.h | 1 - src/control/OnscreenTimer.cpp | 126 ++++++----- src/control/OnscreenTimer.h | 33 +-- src/control/PathFind.cpp | 250 ++++++++++++++-------- src/control/PathFind.h | 33 ++- src/control/Record.cpp | 2 + src/control/Replay.cpp | 44 +--- src/control/Restart.cpp | 2 + src/control/SceneEdit.cpp | 6 +- src/control/Script.cpp | 53 +++-- src/control/TrafficLights.cpp | 470 +++++++++++++++++++++++++++++------------- src/control/TrafficLights.h | 5 +- 19 files changed, 764 insertions(+), 452 deletions(-) (limited to 'src/control') diff --git a/src/control/AutoPilot.cpp b/src/control/AutoPilot.cpp index da661b8c..1b14e3d7 100644 --- a/src/control/AutoPilot.cpp +++ b/src/control/AutoPilot.cpp @@ -6,7 +6,8 @@ #include "Curves.h" #include "PathFind.h" -//--MIAMI: done +//--MIAMI: file done + void CAutoPilot::ModifySpeed(float speed) { m_fMaxTrafficSpeed = Max(0.01f, speed); @@ -40,7 +41,6 @@ void CAutoPilot::ModifySpeed(float speed) #endif } -//--MIAMI: done void CAutoPilot::RemoveOnePathNode() { --m_nPathFindNodesCount; @@ -49,7 +49,6 @@ void CAutoPilot::RemoveOnePathNode() } #ifdef COMPATIBLE_SAVES -//--MIAMI: TODO void CAutoPilot::Save(uint8*& buf) { WriteSaveBuf(buf, m_nCurrentRouteNode); @@ -73,6 +72,9 @@ void CAutoPilot::Save(uint8*& buf) WriteSaveBuf(buf, m_nTimeTempAction); WriteSaveBuf(buf, m_fMaxTrafficSpeed); WriteSaveBuf(buf, m_nCruiseSpeed); + WriteSaveBuf(buf, m_nCruiseSpeedMultiplierType); + SkipSaveBuf(buf, 2); + WriteSaveBuf(buf, m_fCruiseSpeedMultiplier); uint8 flags = 0; if (m_bSlowedDownBecauseOfCars) flags |= BIT(0); if (m_bSlowedDownBecauseOfPeds) flags |= BIT(1); @@ -80,6 +82,7 @@ void CAutoPilot::Save(uint8*& buf) if (m_bStayInFastLane) flags |= BIT(3); if (m_bIgnorePathfinding) flags |= BIT(4); WriteSaveBuf(buf, flags); + WriteSaveBuf(buf, m_nSwitchDistance); SkipSaveBuf(buf, 2); WriteSaveBuf(buf, m_vecDestinationCoors.x); WriteSaveBuf(buf, m_vecDestinationCoors.y); @@ -89,7 +92,6 @@ void CAutoPilot::Save(uint8*& buf) SkipSaveBuf(buf, 6); } -//--MIAMI: TODO void CAutoPilot::Load(uint8*& buf) { m_nCurrentRouteNode = ReadSaveBuf(buf); @@ -113,12 +115,16 @@ void CAutoPilot::Load(uint8*& buf) m_nTimeTempAction = ReadSaveBuf(buf); m_fMaxTrafficSpeed = ReadSaveBuf(buf); m_nCruiseSpeed = ReadSaveBuf(buf); + m_nCruiseSpeedMultiplierType = ReadSaveBuf(buf); + SkipSaveBuf(buf, 2); + m_fCruiseSpeedMultiplier = ReadSaveBuf(buf); uint8 flags = ReadSaveBuf(buf); m_bSlowedDownBecauseOfCars = !!(flags & BIT(0)); m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1)); m_bStayInCurrentLevel = !!(flags & BIT(2)); m_bStayInFastLane = !!(flags & BIT(3)); m_bIgnorePathfinding = !!(flags & BIT(4)); + m_nSwitchDistance = ReadSaveBuf(buf); SkipSaveBuf(buf, 2); m_vecDestinationCoors.x = ReadSaveBuf(buf); m_vecDestinationCoors.y = ReadSaveBuf(buf); diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp index 1e63cf30..1a1c03bd 100644 --- a/src/control/Bridge.cpp +++ b/src/control/Bridge.cpp @@ -6,6 +6,8 @@ #include "PathFind.h" #include "Stats.h" +//--MIAMI: file done + CEntity *CBridge::pLiftRoad; CEntity *CBridge::pLiftPart; CEntity *CBridge::pWeight; diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 74c4f006..7d2abce4 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -292,7 +292,7 @@ CCarCtrl::GenerateOneRandomCar() break; } } - if (!ThePaths.NewGenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY, + if (!ThePaths.GenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY, preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId, &positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1)) return; @@ -3228,7 +3228,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos) int curNode, nextNode; float posBetweenNodes; while (!created && attempts < 5){ - if (ThePaths.NewGenerateCarCreationCoors(pPlayerPos.x, pPlayerPos.y, 0.707f, 0.707f, + if (ThePaths.GenerateCarCreationCoors(pPlayerPos.x, pPlayerPos.y, 0.707f, 0.707f, 120.0f, -1.0f, true, &spawnPos, &curNode, &nextNode, &posBetweenNodes, false)){ int16 colliding[2]; if (!ThePaths.GetNode(curNode)->bWaterPath) { diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index 75d27e26..ea9fe160 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -7,6 +7,7 @@ #include "Timer.h" #include "DMAudio.h" #include "Population.h" +#include "Replay.h" #include "Weapon.h" #include "World.h" #include "Stats.h" @@ -15,6 +16,8 @@ #include "Vehicle.h" #include "GameLogic.h" +//--MIAMI: file done except TODO + #define FRENZY_ANY_PED -1 #define FRENZY_ANY_CAR -2 @@ -24,7 +27,8 @@ int32 CDarkel::TimeOfFrenzyStart; int32 CDarkel::WeaponType; int32 CDarkel::AmmoInterruptedWeapon; int32 CDarkel::KillsNeeded; -int8 CDarkel::InterruptedWeapon; +int32 CDarkel::InterruptedWeaponType; +int32 CDarkel::InterruptedWeaponSelected; /* * TODO: Collect timer/kill counter RGBA colors on top like in Hud/Frontend. @@ -58,10 +62,12 @@ CDarkel::CalcFade(uint32 time, uint32 start, uint32 end) return 0; } -// Screen positions taken from VC void CDarkel::DrawMessages() { + if (CReplay::IsPlayingBack()) + return; + switch (Status) { case KILLFRENZY_ONGOING: { @@ -70,8 +76,8 @@ CDarkel::DrawMessages() CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(30.0f)); CFont::SetCentreOn(); CFont::SetPropOn(); - uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart; - if (CDarkel::bStandardSoundAndMessages) { + uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart; + if (bStandardSoundAndMessages) { if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) { CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f)); CFont::SetJustifyOff(); @@ -96,8 +102,8 @@ CDarkel::DrawMessages() CFont::SetCentreOff(); CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); - if (CDarkel::TimeLimit >= 0) { - uint32 timeLeft = CDarkel::TimeLimit - (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart); + if (TimeLimit >= 0) { + uint32 timeLeft = TimeLimit - (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart); sprintf(gString, "%d:%02d", timeLeft / 60000, timeLeft % 60000 / 1000); AsciiToUnicode(gString, gUString); if (timeLeft > 4000 || CTimer::GetFrameCounter() & 1) { @@ -107,7 +113,7 @@ CDarkel::DrawMessages() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(108.0f), gUString); } } - sprintf(gString, "%d", (CDarkel::KillsNeeded >= 0 ? CDarkel::KillsNeeded : 0)); + sprintf(gString, "%d", (KillsNeeded >= 0 ? KillsNeeded : 0)); AsciiToUnicode(gString, gUString); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString); @@ -117,9 +123,9 @@ CDarkel::DrawMessages() } case KILLFRENZY_PASSED: { - if (CDarkel::bStandardSoundAndMessages) { - uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart; - if (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart < 5000) { + if (bStandardSoundAndMessages) { + uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart; + if (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart < 5000) { CFont::SetBackgroundOff(); CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f)); CFont::SetCentreOn(); @@ -175,7 +181,20 @@ CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle) } } RegisteredKills[vehicle->GetModelIndex()]++; - CStats::CarsExploded++; + switch (vehicle->GetVehicleAppearance()) { + case VEHICLE_APPEARANCE_CAR: + case VEHICLE_APPEARANCE_BIKE: + CStats::CarsExploded++;; + break; + case VEHICLE_APPEARANCE_HELI: + case VEHICLE_APPEARANCE_PLANE: + CStats::HelisDestroyed++; + break; + case VEHICLE_APPEARANCE_BOAT: + CStats::BoatsExploded++; + break; + } + } void @@ -226,23 +245,7 @@ CDarkel::ResetOnPlayerDeath() Status = KILLFRENZY_FAILED; TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds(); - eWeaponType fixedWeapon; - if (WeaponType == WEAPONTYPE_UZI_DRIVEBY) - fixedWeapon = WEAPONTYPE_UZI; - else - fixedWeapon = (eWeaponType)WeaponType; - - CPlayerPed *player = FindPlayerPed(); - if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) { - player->m_nSelectedWepSlot = InterruptedWeapon; - player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon; - } - - if (FindPlayerVehicle()) { - player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId); - player->m_currentWeapon = player->m_nSelectedWepSlot; - player->MakeChangesForNewWeapon(player->m_currentWeapon); - } + DealWithWeaponChangeAtEndOfFrenzy(); } void @@ -279,16 +282,19 @@ CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 mode CPlayerPed *player = FindPlayerPed(); if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) { - InterruptedWeapon = player->m_currentWeapon; - player->GiveWeapon(fixedWeapon, 0); + InterruptedWeaponSelected = player->GetWeapon()->m_eWeaponType; + player->RemoveWeaponAnims(InterruptedWeaponSelected, -1000.0f); + InterruptedWeaponType = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_eWeaponType; AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal; + if (InterruptedWeaponType) + CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponType)->m_nModelId)->AddRef(); player->GiveWeapon(fixedWeapon, 30000); - player->m_nSelectedWepSlot = player->GetWeaponSlot(fixedWeapon); + player->SetCurrentWeapon(fixedWeapon); player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot); if (FindPlayerVehicle()) { - player->m_currentWeapon = player->m_nSelectedWepSlot; - player->GetWeapon()->m_nAmmoInClip = Min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition); + player->SetCurrentWeapon(FindPlayerPed()->m_nSelectedWepSlot); + player->SetAmmo(fixedWeapon, Min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition)); player->ClearWeaponTarget(); } } @@ -319,24 +325,7 @@ CDarkel::Update() CPopulation::m_AllRandomPedsThisType = -1; Status = KILLFRENZY_FAILED; TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds(); - - eWeaponType fixedWeapon; - if (WeaponType == WEAPONTYPE_UZI_DRIVEBY) - fixedWeapon = WEAPONTYPE_UZI; - else - fixedWeapon = (eWeaponType)WeaponType; - - CPlayerPed *player = FindPlayerPed(); - if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) { - player->m_nSelectedWepSlot = InterruptedWeapon; - player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon; - } - - if (FindPlayerVehicle()) { - player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId); - player->m_currentWeapon = player->m_nSelectedWepSlot; - player->MakeChangesForNewWeapon(player->m_currentWeapon); - } + DealWithWeaponChangeAtEndOfFrenzy(); if (bStandardSoundAndMessages) DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_FAILED, 0); @@ -353,25 +342,50 @@ CDarkel::Update() FindPlayerPed()->m_pWanted->SetWantedLevel(0); - eWeaponType fixedWeapon; - if (WeaponType == WEAPONTYPE_UZI_DRIVEBY) - fixedWeapon = WEAPONTYPE_UZI; - else - fixedWeapon = (eWeaponType)WeaponType; - - CPlayerPed* player = FindPlayerPed(); - if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) { - player->m_nSelectedWepSlot = InterruptedWeapon; - player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal = CDarkel::AmmoInterruptedWeapon; - } - - if (FindPlayerVehicle()) { - player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId); - player->m_currentWeapon = player->m_nSelectedWepSlot; - player->MakeChangesForNewWeapon(player->m_currentWeapon); - } + DealWithWeaponChangeAtEndOfFrenzy(); if (bStandardSoundAndMessages) DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_PASSED, 0); } } + +void +CDarkel::DealWithWeaponChangeAtEndOfFrenzy() +{ + eWeaponType fixedWeapon; + if (WeaponType == WEAPONTYPE_UZI_DRIVEBY) + fixedWeapon = WEAPONTYPE_UZI; + else + fixedWeapon = (eWeaponType)WeaponType; + + if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS && InterruptedWeaponType) + CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponType)->m_nModelId)->RemoveRef(); + + if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) { + int slot = CWeaponInfo::GetWeaponInfo(fixedWeapon)->m_nWeaponSlot; + FindPlayerPed()->RemoveWeaponModel(FindPlayerPed()->GetWeapon(slot).GetInfo()->m_nModelId); + FindPlayerPed()->GetWeapon(slot).m_eWeaponType = WEAPONTYPE_UNARMED; + FindPlayerPed()->GetWeapon(slot).m_nAmmoTotal = 0; + FindPlayerPed()->GetWeapon(slot).m_nAmmoInClip = 0; + FindPlayerPed()->GetWeapon(slot).m_eWeaponState = WEAPONSTATE_READY; + FindPlayerPed()->RemoveWeaponAnims(fixedWeapon, -1000.0f); + CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo(fixedWeapon)->m_nModelId)->RemoveRef(); + } + + CPlayerPed* player = FindPlayerPed(); + if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) { + player->m_nSelectedWepSlot = InterruptedWeaponType; + player->GiveWeapon((eWeaponType)InterruptedWeaponType, AmmoInterruptedWeapon, true); + } + + if (FindPlayerVehicle()) { + player->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nModelId); + if (FindPlayerPed()->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType) + FindPlayerPed()->m_nSelectedWepSlot = WEAPONSLOT_SUBMACHINEGUN; + else + FindPlayerPed()->m_nSelectedWepSlot = WEAPONSLOT_UNARMED; + player->SetCurrentWeapon(FindPlayerPed()->m_nSelectedWepSlot); + player->MakeChangesForNewWeapon(player->m_currentWeapon); + //player->RemoveDriveByAnims(); // TODO(MIAMI) + } +} diff --git a/src/control/Darkel.h b/src/control/Darkel.h index 0f5c2329..91955479 100644 --- a/src/control/Darkel.h +++ b/src/control/Darkel.h @@ -23,7 +23,8 @@ private: static int32 WeaponType; static int32 AmmoInterruptedWeapon; static int32 KillsNeeded; - static int8 InterruptedWeapon; + static int32 InterruptedWeaponType; + static int32 InterruptedWeaponSelected; static bool bStandardSoundAndMessages; static bool bNeedHeadShot; static bool bProperKillFrenzy; @@ -49,5 +50,6 @@ public: static void ResetOnPlayerDeath(); static void StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot); static void Update(); + static void DealWithWeaponChangeAtEndOfFrenzy(); }; diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index 573720be..98209c85 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -45,9 +45,10 @@ CVector CGameLogic::ShortCutDropOffForMission; float CGameLogic::ShortCutDropOffOrientationForMission; bool CGameLogic::MissionDropOffReadyToBeUsed; -//--MIAMI: file done except TODO +//--MIAMI: file done #define SHORTCUT_TAXI_COST (9) +#define TOTAL_BUSTED_AUDIO (28) void CGameLogic::InitAtStartOfGame() @@ -196,7 +197,7 @@ CGameLogic::Update() sprintf(name, pPlayerInfo.m_nCurrentBustedAudio >= 10 ? "bust_%d" : "bust_0%d", pPlayerInfo.m_nCurrentBustedAudio); DMAudio.ClearMissionAudio(0); DMAudio.PreloadMissionAudio(0, name); - pPlayerInfo.m_nCurrentBustedAudio = pPlayerInfo.m_nCurrentBustedAudio % 28 + 1; // enum? const? TODO + pPlayerInfo.m_nCurrentBustedAudio = pPlayerInfo.m_nCurrentBustedAudio % TOTAL_BUSTED_AUDIO + 1; } } if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 4000 && diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index dc07d142..73992bcb 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -26,6 +26,8 @@ #include "Wanted.h" #include "World.h" +//--MIAMI: file done + #define CRUSHER_GARAGE_X1 (1135.5f) #define CRUSHER_GARAGE_Y1 (57.0f) #define CRUSHER_GARAGE_Z1 (-1.0f) @@ -236,7 +238,6 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X pGarage->m_nTimeToStartAction = 0; pGarage->field_2 = false; pGarage->m_nTargetModelIndex = targetId; - pGarage->field_96 = nil; pGarage->m_bCollectedCarsState = 0; pGarage->m_bDeactivated = false; pGarage->m_bResprayHappened = false; @@ -2141,11 +2142,11 @@ void CGarages::SetAllDoorsBackToOriginalHeight() } } -// TODO(MIAMI) void CGarages::Save(uint8 * buf, uint32 * size) { INITSAVEBUF - *size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)); + *size = 7876; // for some reason it's not actual size again + //*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)); CloseHideOutGaragesBeforeSave(); WriteSaveBuf(buf, NumGarages); WriteSaveBuf(buf, (uint32)BombsAreFree); @@ -2185,11 +2186,11 @@ const CStoredCar &CStoredCar::operator=(const CStoredCar & other) return *this; } -//TODO(MIAMI) void CGarages::Load(uint8* buf, uint32 size) { INITSAVEBUF - assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage))); + assert(size = 7876); + //assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage))); CloseHideOutGaragesBeforeSave(); NumGarages = ReadSaveBuf(buf); BombsAreFree = ReadSaveBuf(buf); @@ -2210,7 +2211,6 @@ INITSAVEBUF aGarages[i].m_pDoor1 = nil; aGarages[i].m_pDoor2 = nil; aGarages[i].m_pTarget = nil; - aGarages[i].field_96 = nil; aGarages[i].m_bRecreateDoorOnNextRefresh = true; aGarages[i].RefreshDoorPointers(true); if (aGarages[i].m_eGarageType == GARAGE_CRUSHER) diff --git a/src/control/Garages.h b/src/control/Garages.h index 43f40261..04c01719 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -132,7 +132,6 @@ class CGarage uint32 m_nTimeToStartAction; uint8 m_bCollectedCarsState; CVehicle *m_pTarget; - void* field_96; // unused CStoredCar m_sStoredCar; // not needed void OpenThisGarage(); diff --git a/src/control/OnscreenTimer.cpp b/src/control/OnscreenTimer.cpp index d94e993e..ec494019 100644 --- a/src/control/OnscreenTimer.cpp +++ b/src/control/OnscreenTimer.cpp @@ -8,28 +8,35 @@ #include "Script.h" #include "OnscreenTimer.h" +//--MIAMI: file done + void COnscreenTimer::Init() { m_bDisabled = false; - for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) { - m_sEntries[i].m_nTimerOffset = 0; - m_sEntries[i].m_nCounterOffset = 0; - for(uint32 j = 0; j < 10; j++) { - m_sEntries[i].m_aTimerText[j] = 0; - m_sEntries[i].m_aCounterText[j] = 0; - } + for (uint32 i = 0; i < NUMONSCREENCOUNTERENTRIES; i++) { + m_sCounters[i].m_nOffset = 0; + + for (uint32 j = 0; j < 10; j++) + m_sCounters[i].m_aText[j] = 0; + + m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER; + m_sCounters[i].m_bProcessed = false; + } + for (uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) { + m_sTimers[i].m_nOffset = 0; + + for (uint32 j = 0; j < 10; j++) + m_sTimers[i].m_aText[j] = 0; - m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER; - m_sEntries[i].m_bTimerProcessed = false; - m_sEntries[i].m_bCounterProcessed = false; - m_sEntries[i].m_bTimerGoingDown = true; + m_sTimers[i].m_bProcessed = false; + m_sTimers[i].m_bGoingDown = true; } } void COnscreenTimer::Process() { if(!CReplay::IsPlayingBack() && !m_bDisabled) { for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) { - m_sEntries[i].Process(); + m_sTimers[i].Process(); } } } @@ -38,7 +45,12 @@ void COnscreenTimer::ProcessForDisplay() { if(CHud::m_Wants_To_Draw_Hud) { m_bProcessed = false; for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) { - if(m_sEntries[i].ProcessForDisplay()) { + if(m_sTimers[i].ProcessForDisplay()) { + m_bProcessed = true; + } + } + for (uint32 i = 0; i < NUMONSCREENCOUNTERENTRIES; i++) { + if (m_sCounters[i].ProcessForDisplay()) { m_bProcessed = true; } } @@ -46,72 +58,72 @@ void COnscreenTimer::ProcessForDisplay() { } void COnscreenTimer::ClearCounter(uint32 offset) { - for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) { - if(offset == m_sEntries[i].m_nCounterOffset) { - m_sEntries[i].m_nCounterOffset = 0; - m_sEntries[i].m_aCounterText[0] = 0; - m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER; - m_sEntries[i].m_bCounterProcessed = 0; + for(uint32 i = 0; i < NUMONSCREENCOUNTERENTRIES; i++) { + if(offset == m_sCounters[i].m_nOffset) { + m_sCounters[i].m_nOffset = 0; + m_sCounters[i].m_aText[0] = 0; + m_sCounters[i].m_nType = COUNTER_DISPLAY_NUMBER; + m_sCounters[i].m_bProcessed = 0; } } } void COnscreenTimer::ClearClock(uint32 offset) { for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) { - if(offset == m_sEntries[i].m_nTimerOffset) { - m_sEntries[i].m_nTimerOffset = 0; - m_sEntries[i].m_aTimerText[0] = 0; - m_sEntries[i].m_bTimerProcessed = 0; + if(offset == m_sTimers[i].m_nOffset) { + m_sTimers[i].m_nOffset = 0; + m_sTimers[i].m_aText[0] = 0; + m_sTimers[i].m_bProcessed = 0; } } } void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos) { - m_sEntries[pos].m_nCounterOffset = offset; - if (m_sEntries[pos].m_aCounterText[0] != '\0') + m_sCounters[pos].m_nOffset = offset; + if (m_sCounters[pos].m_aText[0] != '\0') return; if(text) { - strncpy(m_sEntries[pos].m_aCounterText, text, 10); + strncpy(m_sCounters[pos].m_aText, text, 10); } else { - m_sEntries[pos].m_aCounterText[0] = 0; + m_sCounters[pos].m_aText[0] = 0; } - m_sEntries[pos].m_nType = type; + m_sCounters[pos].m_nType = type; } void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) { uint32 i = 0; for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) { - if(m_sEntries[i].m_nTimerOffset == 0) { + if(m_sTimers[i].m_nOffset == 0) { break; } return; } - m_sEntries[i].m_nTimerOffset = offset; - m_sEntries[i].m_bTimerGoingDown = bGoingDown; + m_sTimers[i].m_nOffset = offset; + m_sTimers[i].m_bGoingDown = bGoingDown; if(text) { - strncpy(m_sEntries[i].m_aTimerText, text, 10); + strncpy(m_sTimers[i].m_aText, text, 10); } else { - m_sEntries[i].m_aTimerText[0] = 0; + m_sTimers[i].m_aText[0] = 0; } } void COnscreenTimerEntry::Process() { - if(m_nTimerOffset == 0) { + if(m_nOffset == 0) { return; } - int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nTimerOffset); + int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nOffset); int32 oldTime = *timerPtr; - if (m_bTimerGoingDown) { + if (m_bGoingDown) { int32 newTime = oldTime - int32(CTimer::GetTimeStepInMilliseconds()); if (newTime < 0) { *timerPtr = 0; - m_bTimerProcessed = 0; - m_nTimerOffset = 0; - m_aTimerText[0] = 0; + m_bProcessed = 0; + m_nOffset = 0; + m_aText[0] = 0; } else { *timerPtr = newTime; @@ -126,32 +138,34 @@ void COnscreenTimerEntry::Process() { } bool COnscreenTimerEntry::ProcessForDisplay() { - m_bTimerProcessed = false; - m_bCounterProcessed = false; + m_bProcessed = false; - if(m_nTimerOffset == 0 && m_nCounterOffset == 0) { + if(m_nOffset == 0) return false; - } - if(m_nTimerOffset != 0) { - m_bTimerProcessed = true; - ProcessForDisplayClock(); - } + m_bProcessed = true; + ProcessForDisplayClock(); + return true; +} - if(m_nCounterOffset != 0) { - m_bCounterProcessed = true; - ProcessForDisplayCounter(); - } +bool COnscreenCounterEntry::ProcessForDisplay() { + m_bProcessed = false; + + if (m_nOffset == 0) + return false; + + m_bProcessed = true; + ProcessForDisplayCounter(); return true; } void COnscreenTimerEntry::ProcessForDisplayClock() { - uint32 time = *CTheScripts::GetPointerToScriptVariable(m_nTimerOffset); - sprintf(m_bTimerBuffer, "%02d:%02d", time / 1000 / 60, + uint32 time = *CTheScripts::GetPointerToScriptVariable(m_nOffset); + sprintf(m_bBuffer, "%02d:%02d", time / 1000 / 60, time / 1000 % 60); } -void COnscreenTimerEntry::ProcessForDisplayCounter() { - uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nCounterOffset); - sprintf(m_bCounterBuffer, "%d", counter); +void COnscreenCounterEntry::ProcessForDisplayCounter() { + uint32 counter = *CTheScripts::GetPointerToScriptVariable(m_nOffset); + sprintf(m_bBuffer, "%d", counter); } diff --git a/src/control/OnscreenTimer.h b/src/control/OnscreenTimer.h index 09473397..59014e0b 100644 --- a/src/control/OnscreenTimer.h +++ b/src/control/OnscreenTimer.h @@ -9,30 +9,37 @@ enum class COnscreenTimerEntry { public: - uint32 m_nTimerOffset; - uint32 m_nCounterOffset; - char m_aTimerText[10]; - char m_aCounterText[10]; - uint16 m_nType; - char m_bCounterBuffer[42]; - char m_bTimerBuffer[42]; - bool m_bTimerProcessed; - bool m_bTimerGoingDown; - bool m_bCounterProcessed; + uint32 m_nOffset; + char m_aText[10]; + char m_bBuffer[42]; + bool m_bProcessed; + bool m_bGoingDown; + void Process(); bool ProcessForDisplay(); void ProcessForDisplayClock(); - void ProcessForDisplayCounter(); }; -VALIDATE_SIZE(COnscreenTimerEntry, 0x74); +class COnscreenCounterEntry +{ +public: + uint32 m_nOffset; + char m_aText[10]; + uint16 m_nType; + char m_bBuffer[42]; + bool m_bProcessed; + + bool ProcessForDisplay(); + void ProcessForDisplayCounter(); +}; class COnscreenTimer { public: - COnscreenTimerEntry m_sEntries[NUMONSCREENTIMERENTRIES]; + COnscreenTimerEntry m_sTimers[NUMONSCREENTIMERENTRIES]; + COnscreenCounterEntry m_sCounters[NUMONSCREENCOUNTERENTRIES]; bool m_bProcessed; bool m_bDisabled; diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index e85893e6..b357e085 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -8,6 +8,8 @@ #include "Lines.h" // for debug #include "PathFind.h" +//--MIAMI: file done except mobile unused function + bool gbShowPedPaths; bool gbShowCarPaths; bool gbShowCarPathsLinks; @@ -226,7 +228,6 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p } } -//--MIAMI: done // Make sure all externals link TO an internal void CPathInfoForObject::SwapConnectionsToBeRightWayRound(void) @@ -246,7 +247,6 @@ CPathInfoForObject::SwapConnectionsToBeRightWayRound(void) } } -//--MIAMI: done void CPathFind::Init(void) { @@ -263,7 +263,6 @@ CPathFind::Init(void) m_pathNodes[i].distance = MAX_DIST; } -//--MIAMI: done void CPathFind::AllocatePathFindInfoMem(int16 numPathGroups) { @@ -294,14 +293,12 @@ CPathFind::AllocatePathFindInfoMem(int16 numPathGroups) NumDetachedCarNodeGroups = 0; } -//--MIAMI: done void CPathFind::RegisterMapObject(CTreadable *mapObject) { m_mapObjects[m_numMapObjects++] = mapObject; } -//--MIAMI: done void CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, float width, bool crossing, uint8 spawnRate) { @@ -329,7 +326,6 @@ CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x, InfoForTilePeds[id*12].SwapConnectionsToBeRightWayRound(); } -//--MIAMI: done void CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, float width, int8 numLeft, int8 numRight, bool disabled, bool betweenLevels, uint8 speedLimit, bool roadBlock, bool waterPath, uint8 spawnRate) @@ -358,7 +354,6 @@ CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound(); } -//--MIAMI: done void CPathFind::StoreDetachedNodeInfoPed(int32 node, int8 type, int32 next, float x, float y, float z, float width, bool crossing, bool disabled, bool betweenLevels, uint8 spawnRate) @@ -392,7 +387,6 @@ CPathFind::StoreDetachedNodeInfoPed(int32 node, int8 type, int32 next, float x, } } -//--MIAMI: done void CPathFind::StoreDetachedNodeInfoCar(int32 node, int8 type, int32 next, float x, float y, float z, float width, int8 numLeft, int8 numRight, bool disabled, bool betweenLevels, uint8 speedLimit, bool roadBlock, bool waterPath, uint8 spawnRate, bool onlySmallBoats) @@ -426,7 +420,6 @@ CPathFind::StoreDetachedNodeInfoCar(int32 node, int8 type, int32 next, float x, } } -//--MIAMI: done void CPathFind::CalcNodeCoors(float x, float y, float z, int id, CVector *out) { @@ -437,7 +430,6 @@ CPathFind::CalcNodeCoors(float x, float y, float z, int id, CVector *out) *out = m_mapObjects[id]->GetMatrix() * pos; } -//--MIAMI: done bool CPathFind::LoadPathFindData(void) { @@ -445,7 +437,6 @@ CPathFind::LoadPathFindData(void) return false; } -//--MIAMI: done void CPathFind::PreparePathData(void) { @@ -536,7 +527,6 @@ CPathFind::PreparePathData(void) printf("Done with PreparePathData\n"); } -//--MIAMI: done /* String together connected nodes in a list by a flood fill algorithm */ void CPathFind::CountFloodFillGroups(uint8 type) @@ -608,7 +598,6 @@ CPathFind::CountFloodFillGroups(uint8 type) int32 TempListLength; -//--MIAMI: done void CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo, float maxdist, CPathInfoForObject *detachednodes, int numDetached) @@ -813,7 +802,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor m_carPathLinks[m_numCarPathLinks].dirY = tempnodes[j].dirY; m_carPathLinks[m_numCarPathLinks].x = tempnodes[j].pos.x*8.0f; m_carPathLinks[m_numCarPathLinks].y = tempnodes[j].pos.y*8.0f; - m_carPathLinks[m_numCarPathLinks].flag1 = false; + m_carPathLinks[m_numCarPathLinks].trafficLightDirection = false; m_carPathLinks[m_numCarPathLinks].width = tempnodes[j].width; m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i; m_carPathLinks[m_numCarPathLinks].numLeftLanes = tempnodes[j].numLeftLanes; @@ -892,7 +881,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor m_carPathLinks[m_numCarPathLinks].dirY = dy*100.0f; m_carPathLinks[m_numCarPathLinks].x = posx*8.0f; m_carPathLinks[m_numCarPathLinks].y = posy*8.0f; - m_carPathLinks[m_numCarPathLinks].flag1 = false; + m_carPathLinks[m_numCarPathLinks].trafficLightDirection = false; m_carPathLinks[m_numCarPathLinks].width = width; m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i; m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1; @@ -1028,7 +1017,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor delete[] mapObjIndices; } -//--MIAMI: done float CPathFind::CalcRoadDensity(float x, float y) { @@ -1051,7 +1039,6 @@ CPathFind::CalcRoadDensity(float x, float y) return density/2500.0f; } -//--MIAMI: done bool CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2) { @@ -1062,7 +1049,6 @@ CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2) return false; } -//--MIAMI: done bool CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2) { @@ -1073,7 +1059,6 @@ CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2) return false; } -//--MIAMI: done void CPathFind::AddNodeToList(CPathNode *node, int32 listId) { @@ -1086,7 +1071,6 @@ CPathFind::AddNodeToList(CPathNode *node, int32 listId) node->distance = listId; } -//--MIAMI: done void CPathFind::RemoveNodeFromList(CPathNode *node) { @@ -1095,7 +1079,6 @@ CPathFind::RemoveNodeFromList(CPathNode *node) node->GetNext()->SetPrev(node->GetPrev()); } -//--MIAMI: done void CPathFind::RemoveBadStartNode(CVector pos, CPathNode **nodes, int16 *n) { @@ -1123,7 +1106,6 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena } #endif -//--MIAMI: done void CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable) { @@ -1139,7 +1121,6 @@ CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable) } } -//--MIAMI: done void CPathFind::SwitchRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable) { @@ -1155,7 +1136,6 @@ CPathFind::SwitchRoadsOffInArea(float x1, float x2, float y1, float y2, float z1 } } -//--MIAMI: done void CPathFind::SwitchPedRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable) { @@ -1171,7 +1151,6 @@ CPathFind::SwitchPedRoadsOffInArea(float x1, float x2, float y1, float y2, float } } -//--MIAMI: unused (still needed for script here) void CPathFind::SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float y2, float z2, float length, uint8 type, uint8 mode) { @@ -1223,7 +1202,6 @@ CPathFind::SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float } } -//--MIAMI: unused (still needed for script here) void CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId) { @@ -1239,7 +1217,6 @@ CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId) } } -//--MIAMI: unused (still needed for script here) void CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2) { @@ -1254,7 +1231,6 @@ CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, } } -//--MIAMI: unused (still needed for script here) void CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2) { @@ -1269,9 +1245,8 @@ CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y } } -//--MIAMI: done int32 -CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, bool ignoreFlagB4, bool bWaterPath) +CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, bool ignoreSelected, bool bWaterPath) { int i; int firstNode, lastNode; @@ -1293,7 +1268,7 @@ CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bo for(i = firstNode; i < lastNode; i++){ if(ignoreDisabled && m_pathNodes[i].bDisabled) continue; if(ignoreBetweenLevels && m_pathNodes[i].bBetweenLevels) continue; - if(ignoreFlagB4 && m_pathNodes[i].flagB4) continue; + if(ignoreSelected && m_pathNodes[i].bSelected) continue; if(bWaterPath != m_pathNodes[i].bWaterPath) continue; dist = Abs(m_pathNodes[i].GetX() - coors.x) + Abs(m_pathNodes[i].GetY() - coors.y) + @@ -1306,7 +1281,6 @@ CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bo return closestDist < distLimit ? closestNode : -1; } -//--MIAMI: done int32 CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY) { @@ -1345,7 +1319,102 @@ CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, floa return closestNode; } -//--MIAMI: done +void +CPathFind::FindNodePairClosestToCoors(CVector coors, uint8 type, int* node1, int* node2, float* angle, float minDist, float maxDist, bool ignoreDisabled, bool ignoreBetweenLevels, bool bWaterPath) +{ + int i, j; + int firstNode, lastNode, connectedNode; + float dist; + float closestDist = 10000.0f; + int closestNode = 0, closestConnectedNode = 0; + + switch (type) { + case PATH_CAR: + firstNode = 0; + lastNode = m_numCarPathNodes; + break; + case PATH_PED: + firstNode = m_numCarPathNodes; + lastNode = m_numPathNodes; + break; + } + + for (i = firstNode; i < lastNode; i++) { + if (ignoreDisabled && m_pathNodes[i].bDisabled) continue; + if (ignoreBetweenLevels && m_pathNodes[i].bBetweenLevels) continue; + if (bWaterPath != m_pathNodes[i].bWaterPath) continue; + dist = Abs(m_pathNodes[i].GetX() - coors.x) + + Abs(m_pathNodes[i].GetY() - coors.y) + + 3.0f * Abs(m_pathNodes[i].GetZ() - coors.z); + if (dist < closestDist) { + for (j = 0; j < m_pathNodes[i].numLinks; j++) { + connectedNode = ConnectedNode(m_pathNodes[i].firstLink + j); + if (ignoreDisabled && m_pathNodes[connectedNode].bDisabled) continue; + if (ignoreBetweenLevels && m_pathNodes[connectedNode].bBetweenLevels) continue; + if (bWaterPath != m_pathNodes[connectedNode].bWaterPath) continue; + if ((m_pathNodes[connectedNode].GetPosition() - m_pathNodes[i].GetPosition()).Magnitude() > minDist) { + closestDist = dist; + closestNode = i; + closestConnectedNode = connectedNode; + } + } + } + } + if (closestDist < maxDist) { + *node1 = closestNode; + *node2 = closestConnectedNode; + CVector dir(m_pathNodes[*node2].GetX() - m_pathNodes[*node1].GetX(), m_pathNodes[*node2].GetY() - m_pathNodes[*node1].GetY(), 0.0f); + dir.Normalise(); + *angle = RADTODEG(Atan2(-dir.x, dir.y)); + } + else { + *node1 = -1; + *node2 = -1; + *angle = 0.0f; + } +} + +int32 +CPathFind::FindNthNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, int N, bool bWaterPath) +{ + int i; + int firstNode, lastNode; + switch (type) { + case PATH_CAR: + firstNode = 0; + lastNode = m_numCarPathNodes; + break; + case PATH_PED: + firstNode = m_numCarPathNodes; + lastNode = m_numPathNodes; + break; + } + for (i = firstNode; i < lastNode; i++) + m_pathNodes[i].bSelected = false; + + for (; N > 0; N--) { + i = FindNodeClosestToCoors(coors, type, distLimit, ignoreDisabled, ignoreBetweenLevels, true, bWaterPath); + if (i < 0) + return -1; + m_pathNodes[i].bSelected = true; + } + return FindNodeClosestToCoors(coors, type, distLimit, ignoreDisabled, ignoreBetweenLevels, true, bWaterPath); +} + +CVector +CPathFind::FindNodeCoorsForScript(int32 id) +{ + // the point is to return valid position in case there is a divider in the middle of the road + if (!m_pathNodes[id].HasDivider() || m_pathNodes[id].numLinks == 0) + return m_pathNodes[id].GetPosition(); + CVector2D dir(m_pathNodes[ConnectedNode(m_pathNodes[id].firstLink)].GetX() - m_pathNodes[id].GetX(), + m_pathNodes[ConnectedNode(m_pathNodes[id].firstLink)].GetY() - m_pathNodes[id].GetY()); + dir.Normalise(); + if (dir.x < 0) + dir = -dir; + return m_pathNodes[id].GetPosition() + CVector(-dir.x, dir.y, 0.0f) * (LANE_WIDTH / 2 + m_pathNodes[id].GetDividerWidth()); +} + float CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId) { @@ -1357,7 +1426,6 @@ CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId) return RADTODEG(dir.Heading()); } -//--MIAMI: unused (still needed for script here) float CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards) { @@ -1401,10 +1469,8 @@ CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, flo return RADTODEG(dir.Heading()); } -// no "New" in MIAMI -//--MIAMI: TODO bool -CPathFind::NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled) +CPathFind::GenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled) { int i, j; int node1, node2; @@ -1457,67 +1523,83 @@ CPathFind::NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY, return false; } -//--MIAMI: TODO bool CPathFind::GeneratePedCreationCoors(float x, float y, float minDist, float maxDist, float minDistOffScreen, float maxDistOffScreen, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, CMatrix *camMatrix) { int i; int node1, node2; + float node1_dist, node2_dist; + static uint32 node_cnt; if(m_numPedPathNodes == 0) return false; - for(i = 0; i < 400; i++){ - node1 = m_numCarPathNodes + CGeneral::GetRandomNumber() % m_numPedPathNodes; - if(DistanceSqr2D(m_pathNodes[node1].GetPosition(), x, y) < sq(maxDist+30.0f)){ - if(m_pathNodes[node1].numLinks == 0) - continue; - int link = m_pathNodes[node1].firstLink + CGeneral::GetRandomNumber() % m_pathNodes[node1].numLinks; - if(ConnectionCrossesRoad(link)) - continue; - node2 = ConnectedNode(link); - if(m_pathNodes[node1].bDisabled || m_pathNodes[node2].bDisabled) - continue; + for(i = 0; i < 230; i++){ + if (node_cnt++ >= m_numPedPathNodes) + node_cnt = 0; + node1 = node_cnt + m_numCarPathNodes; + node1_dist = Distance2D(m_pathNodes[node1].GetPosition(), x, y); + if(node1_dist < maxDist+30.0f){ + if(m_pathNodes[node1].numLinks != 0) + break; + } + } + if (i >= 230) + return false; - float f2 = (CGeneral::GetRandomNumber()&0xFF)/256.0f; - float f1 = 1.0f - f2; - *pPositionBetweenNodes = f2; - CVector pos = m_pathNodes[node1].GetPosition()*f1 + m_pathNodes[node2].GetPosition()*f2; - if(Distance2D(pos, x, y) < maxDist+20.0f){ - pos.x += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f; - pos.y += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f; - float dist = Distance2D(pos, x, y); - - bool visible; - if(camMatrix) - visible = TheCamera.IsSphereVisible(pos, 2.0f, camMatrix); - else - visible = TheCamera.IsSphereVisible(pos, 2.0f); - if(!visible){ - minDist = minDistOffScreen; - maxDist = maxDistOffScreen; - } - if(minDist < dist && dist < maxDist){ - *pNode1 = node1; - *pNode2 = node2; - *pPosition = pos; - - bool found; - float groundZ = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z+2.0f, &found); - if(!found) - return false; - if(Abs(groundZ - pos.z) > 3.0f) - return false; - pPosition->z = groundZ; - return true; - } + for(i = 0; i < m_pathNodes[node1].numLinks; i++){ + int link = m_pathNodes[node1].firstLink + i; + if(ConnectionCrossesRoad(link)) + continue; + node2 = ConnectedNode(link); + if(m_pathNodes[node1].bDisabled || m_pathNodes[node2].bDisabled) + continue; + node2_dist = Distance2D(m_pathNodes[node2].GetPosition(), x, y); + if ((node1_dist < maxDist || node2_dist < maxDist) && (node1_dist > minDistOffScreen || node2_dist > minDistOffScreen)) + break; + } + if(i >= m_pathNodes[node1].numLinks) + return false; + + for(i = 0; i < 5; i++){ + float f2 = (CGeneral::GetRandomNumber()&0xFF)/256.0f; + float f1 = 1.0f - f2; + *pPositionBetweenNodes = f2; + CVector pos = m_pathNodes[node1].GetPosition()*f1 + m_pathNodes[node2].GetPosition()*f2; + if(Distance2D(pos, x, y) < maxDist+20.0f){ + pos.x += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f; + pos.y += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f; + float dist = Distance2D(pos, x, y); + + bool visible; + if(camMatrix) + visible = TheCamera.IsSphereVisible(pos, 2.0f, camMatrix); + else + visible = TheCamera.IsSphereVisible(pos, 2.0f); + if(!visible){ + minDist = minDistOffScreen; + maxDist = maxDistOffScreen; + } + if(visible && (minDist < dist && dist < maxDist) || + !visible && (minDistOffScreen < dist && dist < maxDistOffScreen)){ + *pNode1 = node1; + *pNode2 = node2; + *pPosition = pos; + + bool found; + float groundZ = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z+2.0f, &found); + if(!found) + return false; + if(Abs(groundZ - pos.z) > 3.0f) + return false; + pPosition->z = groundZ; + return true; } } } return false; } -//--MIAMI: done void CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode, CPathNode **nextNode, uint8 curDir, uint8 *nextDir) { @@ -1584,7 +1666,6 @@ CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode static CPathNode *apNodesToBeCleared[6525]; -//--MIAMI: done void CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector target, CPathNode **nodes, int16 *pNumNodes, int16 maxNumNodes, CVehicle *vehicle, float *pDist, float distLimit, int32 targetNodeId) { @@ -1676,7 +1757,6 @@ static CPathNode *pNodeList[32]; static int16 DummyResult; static int16 DummyResult2; -//--MIAMI: done bool CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start) { @@ -1692,7 +1772,6 @@ CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start) return dist < 100.0f; } -//--MIAMI: done void CPathFind::Save(uint8 *buf, uint32 *size) { @@ -1714,7 +1793,6 @@ CPathFind::Save(uint8 *buf, uint32 *size) buf[i/8 + n] &= ~(1 << i%8); } -//--MIAMI: done void CPathFind::Load(uint8 *buf, uint32 size) { diff --git a/src/control/PathFind.h b/src/control/PathFind.h index 820d0b86..acf9929a 100644 --- a/src/control/PathFind.h +++ b/src/control/PathFind.h @@ -52,6 +52,8 @@ public: static void AddNodeToList(CPedPathNode *pNode, int16 index, CPedPathNode *pList); static void AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition); static void AddBlockadeSectorList(CPtrList& list, CPedPathNode(*pathNodes)[40], CVector *pPosition); + static void AddBuildingBlockade(CEntity*, CPedPathNode(*)[40], CVector*); + static void AddBuildingBlockadeSectorList(CPtrList&, CPedPathNode(*)[40], CVector*); }; struct CPathNode @@ -74,7 +76,7 @@ struct CPathNode uint8 bWaterPath : 1; uint8 bOnlySmallBoats : 1; - uint8 flagB4 : 1; // where is this set? + uint8 bSelected : 1; uint8 speedLimit : 2; //uint8 flagB20 : 1; //uint8 flagB40 : 1; @@ -115,7 +117,7 @@ struct CCarPathLink int8 dirY; int8 numLeftLanes : 3; int8 numRightLanes : 3; - uint8 flag1 : 1; + uint8 trafficLightDirection : 1; uint8 trafficLightType : 2; uint8 bBridgeLights : 1; // at least in LCS... int8 width; @@ -160,6 +162,7 @@ struct CPathInfoForObject uint8 spawnRate : 4; + void CheckIntegrity(void); void SwapConnectionsToBeRightWayRound(void); }; extern CPathInfoForObject *InfoForTileCars; @@ -189,6 +192,14 @@ struct CTempNodeExternal // made up name bool isCross; }; +// from mobile +template +class CRoute +{ + T m_node[8]; +}; + + class CPathFind { public: @@ -242,12 +253,14 @@ public: void MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId); void MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2); void PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2); -// TODO(MIAMI): check callers for new arguments - int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled = false, bool ignoreBetweenLevels = false, bool ignoreFlagB4 = false, bool bWaterPath = false); + int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled = false, bool ignoreBetweenLevels = false, bool ignoreSelected = false, bool bWaterPath = false); int32 FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY); + void FindNodePairClosestToCoors(CVector coors, uint8 type, int* node1, int* node2, float* angle, float minDist, float maxDist, bool ignoreDisabled = false, bool ignoreBetweenLevels = false, bool bWaterPath = false); + int32 FindNthNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled, bool ignoreBetweenLevels, int N, bool bWaterPath = false); + CVector FindNodeCoorsForScript(int32 id); float FindNodeOrientationForCarPlacement(int32 nodeId); float FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards); - bool NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled = false); + bool GenerateCarCreationCoors(float x, float y, float dirX, float dirY, float spawnDist, float angleLimit, bool forward, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, bool ignoreDisabled = false); bool GeneratePedCreationCoors(float x, float y, float minDist, float maxDist, float minDistOffScreen, float maxDistOffScreen, CVector *pPosition, int32 *pNode1, int32 *pNode2, float *pPositionBetweenNodes, CMatrix *camMatrix); void FindNextNodeWandering(uint8, CVector, CPathNode**, CPathNode**, uint8, uint8*); void DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector target, CPathNode **nodes, int16 *numNodes, int16 maxNumNodes, CVehicle *vehicle, float *dist, float distLimit, int32 forcedTargetNode); @@ -267,6 +280,16 @@ public: void ConnectionSetTrafficLight(int id) { m_connections[id] |= 0x4000; } void DisplayPathData(void); + + // Following methods are present on mobile but are unused. TODO: implement them + void SavePathFindData(void); + void ComputeRoute(uint8, const CVector&, const CVector&, CRoute&); + void RecordNodesClosestToCoors(CVector, uint8, int, CPathNode**, float, bool, bool, bool); + void RecordNodesInCircle(const CVector&, float, uint8, int, CPathNode**, bool, bool, bool, bool); + void ArrangeOneNodeList(CPathInfoForObject*, int16); + void ArrangeNodes(int16); + void RegisterMarker(CVector*); + void Shutdown(void); }; extern CPathFind ThePaths; diff --git a/src/control/Record.cpp b/src/control/Record.cpp index 5e6c7cdb..9b4a21fc 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -10,6 +10,8 @@ #include "VehicleModelInfo.h" #include "World.h" +//--MIAMI: file done + uint16 CRecordDataForGame::RecordingState; void CRecordDataForGame::Init(void) diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 45f1a143..838967e8 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -52,6 +52,8 @@ #include "Radar.h" #include "Fluff.h" +//--MIAMI: file done except TODO + uint8 CReplay::Mode; CAddressInReplayBuffer CReplay::Record; CAddressInReplayBuffer CReplay::Playback; @@ -159,7 +161,6 @@ static void(*CBArray[])(CAnimBlendAssociation*, void*) = &CPed::PedAnimShuffleCB, &CPed::DeleteSunbatheIdleAnimCB, &StartTalkingOnMobileCB, &FinishTalkingOnMobileCB }; -// --MIAMI: Done static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*)) { for (int i = 0; i < sizeof(CBArray) / sizeof(*CBArray); i++){ @@ -170,13 +171,11 @@ static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*)) return 0; } -// --MIAMI: Done static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*) { return CBArray[id]; } -// --MIAMI: Done static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying) { if(vehicle->Damage.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){ @@ -209,7 +208,6 @@ static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flyi } } -// --MIAMI: Done void PrintElementsInPtrList(void) { for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_GENERIC).first; node; node = node->next) { @@ -217,7 +215,6 @@ void PrintElementsInPtrList(void) } } -// --MIAMI: Done void CReplay::Init(void) { pBuf0 = nil; @@ -260,20 +257,17 @@ void CReplay::Init(void) MarkEverythingAsNew(); } -// --MIAMI: Done void CReplay::DisableReplays(void) { bReplayEnabled = false; } -// --MIAMI: Done void CReplay::EnableReplays(void) { bReplayEnabled = true; } void PlayReplayFromHD(void); -// --MIAMI: Done void CReplay::Update(void) { if (CCutsceneMgr::IsCutsceneProcessing() || CPad::GetPad(0)->ArePlayerControlsDisabled() || CScriptPaths::IsOneActive() || FrontEndMenuManager.GetIsMenuActive()) { @@ -308,7 +302,6 @@ void CReplay::Update(void) } } -// --MIAMI: Done except TODO void CReplay::RecordThisFrame(void) { uint32 memory_required = sizeof(tGeneralPacket) + sizeof(tClockPacket) + sizeof(tWeatherPacket) + sizeof(tTimerPacket) + sizeof(tMiscPacket); @@ -412,7 +405,6 @@ void CReplay::RecordThisFrame(void) Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END; } -// --MIAMI: Done void CReplay::GoToNextBlock(void) { Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END; @@ -425,7 +417,6 @@ void CReplay::GoToNextBlock(void) MarkEverythingAsNew(); } -// --MIAMI: Done void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CVector& vecDir, float fSize, const RwRGBA& color) { if (Record.m_nOffset > REPLAYBUFFERSIZE - 16 - sizeof(tParticlePacket)) @@ -448,7 +439,6 @@ void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CV Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END; } -// --MIAMI: Done void CReplay::StorePedUpdate(CPed *ped, int id) { tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset]; @@ -468,7 +458,6 @@ void CReplay::StorePedUpdate(CPed *ped, int id) Record.m_nOffset += sizeof(tPedUpdatePacket); } -// --MIAMI: Done void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state) { CAnimBlendAssociation* second; @@ -514,7 +503,6 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state) } } -// --MIAMI: Done void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++){ @@ -572,7 +560,6 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState } } -// --MIAMI: Done void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset]; @@ -617,14 +604,12 @@ void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayB buffer->m_nOffset += sizeof(tPedUpdatePacket); } -// --MIAMI: Done bool HasAnimGroupLoaded(uint8 group) { CAnimBlendAssocGroup* pGroup = &CAnimManager::GetAnimAssocGroups()[group]; return pGroup->animBlock && pGroup->animBlock->isLoaded; } -// --MIAMI: Done void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state) { CAnimBlendAssociation* anim1; @@ -668,7 +653,6 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state) } } -// --MIAMI: Done void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { CAnimBlendAssociation* assoc; @@ -714,7 +698,6 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt } } -// --MIAMI: Done void CReplay::PlaybackThisFrame(void) { static int FrameSloMo = 0; @@ -742,7 +725,6 @@ void CReplay::PlaybackThisFrame(void) // next two functions are only found in mobile version // most likely they were optimized out for being unused -// --MIAMI: Done void CReplay::TriggerPlaybackLastCoupleOfSeconds(uint32 start, uint8 cam_mode, float cam_x, float cam_y, float cam_z, uint32 slomo) { if (Mode != MODE_RECORD) @@ -754,7 +736,6 @@ void CReplay::TriggerPlaybackLastCoupleOfSeconds(uint32 start, uint8 cam_mode, f Mode = MODE_RECORD; } -// --MIAMI: Done bool CReplay::FastForwardToTime(uint32 start) { uint32 timer = 0; @@ -764,7 +745,6 @@ bool CReplay::FastForwardToTime(uint32 start) return true; } -// --MIAMI: Done void CReplay::StoreCarUpdate(CVehicle *vehicle, int id) { tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&Record.m_pBase[Record.m_nOffset]; @@ -805,7 +785,6 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id) Record.m_nOffset += sizeof(tVehicleUpdatePacket); } -// --MIAMI: Done void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id) { CBike* bike = (CBike*)vehicle; @@ -831,7 +810,6 @@ void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id) Record.m_nOffset += sizeof(tBikeUpdatePacket); } -// --MIAMI: Done void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer) { tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset]; @@ -905,7 +883,6 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI ((CBoat*)vehicle)->m_fMovingSpeed = vp->skimmer_speed / 50.0f; } -// --MIAMI: Done void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddressInReplayBuffer* buffer) { CBike* bike = (CBike*)vehicle; @@ -939,7 +916,6 @@ void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddress CWorld::Add(vehicle); } -// --MIAMI: Done bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer) { CBulletTraces::Init(); @@ -1196,7 +1172,6 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo return false; } -// --MIAMI: Done void CReplay::FinishPlayback(void) { if (Mode != MODE_PLAYBACK) @@ -1219,7 +1194,6 @@ void CReplay::FinishPlayback(void) DMAudio.SetMusicFadeVol(127); } -// --MIAMI: Done void CReplay::EmptyReplayBuffer(void) { if (Mode == MODE_PLAYBACK) @@ -1235,7 +1209,6 @@ void CReplay::EmptyReplayBuffer(void) MarkEverythingAsNew(); } -// --MIAMI: Done void CReplay::ProcessReplayCamera(void) { switch (CameraMode) { @@ -1282,7 +1255,6 @@ void CReplay::ProcessReplayCamera(void) extern CWeaponEffects gCrossHair; -// --MIAMI: Done except TODO void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) { if (Mode != MODE_RECORD) @@ -1342,7 +1314,6 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca CDraw::SetFOV(70.0f); } -// --MIAMI: Done void CReplay::StoreStuffInMem(void) { #ifdef FIX_BUGS @@ -1429,7 +1400,6 @@ void CReplay::StoreStuffInMem(void) CScriptPaths::Save_ForReplay(); } -// --MIAMI: Done void CReplay::RestoreStuffFromMem(void) { CPools::GetVehiclePool()->CopyBack(pBuf0, pBuf1); @@ -1654,7 +1624,6 @@ void CReplay::RestoreStuffFromMem(void) DMAudio.ChangeMusicMode(MUSICMODE_GAME); } -// --MIAMI: Done void CReplay::EmptyPedsAndVehiclePools(void) { int i = CPools::GetVehiclePool()->GetSize(); @@ -1675,7 +1644,6 @@ void CReplay::EmptyPedsAndVehiclePools(void) } } -// --MIAMI: Done void CReplay::EmptyAllPools(void) { EmptyPedsAndVehiclePools(); @@ -1697,7 +1665,6 @@ void CReplay::EmptyAllPools(void) } } -// --MIAMI: Done void CReplay::MarkEverythingAsNew(void) { int i = CPools::GetVehiclePool()->GetSize(); @@ -1747,7 +1714,6 @@ void CReplay::SaveReplayToHD(void) CFileMgr::SetDir(""); } -// --MIAMI: Done void PlayReplayFromHD(void) { CFileMgr::SetDirMyDocuments(); @@ -1780,7 +1746,6 @@ void PlayReplayFromHD(void) CReplay::StreamAllNecessaryCarsAndPeds(); } -// --MIAMI: Done void CReplay::StreamAllNecessaryCarsAndPeds(void) { for (int slot = 0; slot < NUM_REPLAYBUFFERS; slot++) { @@ -1805,7 +1770,6 @@ void CReplay::StreamAllNecessaryCarsAndPeds(void) CStreaming::LoadAllRequestedModels(false); } -// --MIAMI: Done void CReplay::FindFirstFocusCoordinate(CVector *coord) { *coord = CVector(0.0f, 0.0f, 0.0f); @@ -1821,7 +1785,6 @@ void CReplay::FindFirstFocusCoordinate(CVector *coord) } } -// --MIAMI: Done bool CReplay::ShouldStandardCameraBeProcessed(void) { if (Mode != MODE_PLAYBACK) @@ -1831,7 +1794,6 @@ bool CReplay::ShouldStandardCameraBeProcessed(void) return FindPlayerVehicle() != nil; } -// --MIAMI: Done void CReplay::ProcessLookAroundCam(void) { if (!bAllowLookAroundCam) @@ -1888,7 +1850,6 @@ void CReplay::ProcessLookAroundCam(void) RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera)); } -// --MIAMI: Done size_t CReplay::FindSizeOfPacket(uint8 type) { switch (type) { @@ -1910,7 +1871,6 @@ size_t CReplay::FindSizeOfPacket(uint8 type) return 0; } -// --MIAMI: Done (function didn't change since III and we already had it modified) void CReplay::Display() { static int TimeCount = 0; diff --git a/src/control/Restart.cpp b/src/control/Restart.cpp index 8fa018d6..052e6b61 100644 --- a/src/control/Restart.cpp +++ b/src/control/Restart.cpp @@ -4,6 +4,8 @@ #include "Zones.h" #include "PathFind.h" +//--MIAMI: file done + uint8 CRestart::OverrideHospitalLevel; uint8 CRestart::OverridePoliceStationLevel; bool CRestart::bFadeInAfterNextArrest; diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp index a7727fde..21512290 100644 --- a/src/control/SceneEdit.cpp +++ b/src/control/SceneEdit.cpp @@ -20,6 +20,8 @@ #include "WeaponInfo.h" #include "World.h" +//--MIAMI: file done + bool CSceneEdit::m_bEditOn; int32 CSceneEdit::m_bCameraFollowActor; bool CSceneEdit::m_bRecording; @@ -1070,7 +1072,7 @@ bool CSceneEdit::SelectWeapon(void) } if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) { if (++m_nWeaponType >= WEAPONTYPE_DETONATOR) - m_nWeaponType = WEAPONTYPE_BASEBALLBAT; + m_nWeaponType = WEAPONTYPE_BRASSKNUCKLE; pActors[m_nActor]->ClearWeapons(); pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000); pActors[m_nActor]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId); @@ -1078,7 +1080,7 @@ bool CSceneEdit::SelectWeapon(void) } else if (CPad::GetPad(1)->GetRightShoulder1JustDown()){ if (--m_nWeaponType <= WEAPONTYPE_UNARMED) - m_nWeaponType = WEAPONTYPE_GRENADE; + m_nWeaponType = WEAPONTYPE_MINIGUN; pActors[m_nActor]->ClearWeapons(); pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000); pActors[m_nActor]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index aa4e109f..01a4405d 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1827,7 +1827,7 @@ void CMissionCleanup::Process() CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0; CPad::GetPad(0)->SetDrunkInputDelay(0); CWorld::Players[0].m_bDriveByAllowed = true; - // DMAudio::ShutUpPlayerTalking(0); // TODO(Miami) + DMAudio.ShutUpPlayerTalking(0); CVehicle::bDisableRemoteDetonation = false; CVehicle::bDisableRemoteDetonationOnContact = false; CGameLogic::ClearShortCut(); @@ -6372,7 +6372,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) } case COMMAND_ADD_EXPLOSION: CollectParameters(&m_nIp, 4); - CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0); + CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, true); return 0; case COMMAND_IS_CAR_UPRIGHT: @@ -7042,7 +7042,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CCoronas::RegisterCorona((uintptr)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8], - 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f); // TODO(MIAMI): more params + 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f); return 0; } case COMMAND_DRAW_LIGHT: @@ -7497,7 +7497,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f)]; + CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f, true)]; *(CVector*)&ScriptParams[0] = pNode->GetPosition(); StoreParameters(&m_nIp, 3); return 0; @@ -7508,8 +7508,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f)]; - *(CVector*)&ScriptParams[0] = pNode->GetPosition(); + *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true)); StoreParameters(&m_nIp, 3); return 0; } @@ -8978,7 +8977,6 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CollectParameters(&m_nIp, 1); char zone[KEY_LENGTH_IN_SCRIPT]; CTheScripts::ReadTextLabelFromScript(&m_nIp, zone); -// TODO(MIAMI): just getting this to compile with new argument int zone_id = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT); if (zone_id != -1) m_nIp += KEY_LENGTH_IN_SCRIPT; @@ -10344,8 +10342,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); int node = ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true); - // TODO(MIAMI): replace GetPosition with FindNodeCoorsForScript - *(CVector*)&ScriptParams[0] = ThePaths.m_pathNodes[node].GetPosition(); + *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(node); *(float*)&ScriptParams[3] = ThePaths.FindNodeOrientationForCarPlacement(node); StoreParameters(&m_nIp, 4); return 0; @@ -11204,7 +11201,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) return 0; */ case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED: - UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3 || CVehicle::bHoverCheat || CVehicle::bCheat8); // TODO(MIAMI): more cheats! + UpdateCompareFlag(CVehicle::bAllDodosCheat || CVehicle::bCheat3 || CVehicle::bHoverCheat || CVehicle::bCheat8 || CVehicle::bCheat9); return 0; case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS: { @@ -12284,10 +12281,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_GET_CLOSEST_STRAIGHT_ROAD: { CollectParameters(&m_nIp, 5); - debug("GET_CLOSEST_STRAIGHT_ROAD not implemented!\n"); - for (int i = 0; i < 7; i++) - ScriptParams[i] = 0; - StoreParameters(&m_nIp, 7); // TODO(MIAMI) + int node1, node2; + float angle; + ThePaths.FindNodePairClosestToCoors(*(CVector*)&ScriptParams[0], PATH_CAR, &node1, &node2, &angle, + *(float*)&ScriptParams[3], *(float*)&ScriptParams[4], true, true); + if (node1 == -1) { + for (int i = 0; i < 7; i++) + ScriptParams[i] = 0; + } + else { + *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(node1); + *(CVector*)&ScriptParams[3] = ThePaths.FindNodeCoorsForScript(node2); + *(float*)&ScriptParams[6] = angle; + } + StoreParameters(&m_nIp, 7); return 0; } case COMMAND_SET_CAR_FORWARD_SPEED: @@ -12461,9 +12468,11 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_GET_NTH_CLOSEST_CAR_NODE: { CollectParameters(&m_nIp, 4); - debug("GET_NTH_CLOSEST_CAR_NODE is not implemented\n"); // TODO(MIAMI) - ScriptParams[0] = 0; - StoreParameters(&m_nIp, 1); + CVector pos = *(CVector*)&ScriptParams[0]; + if (pos.z <= MAP_Z_LOW_LIMIT) + pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); + *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNthNodeClosestToCoors(pos, 0, 999999.9f, true, true, ScriptParams[3] - 1)); + StoreParameters(&m_nIp, 3); return 0; } //case COMMAND_GET_NTH_CLOSEST_CHAR_NODE: @@ -13252,7 +13261,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) case COMMAND_SET_TONIGHTS_EVENT: { CollectParameters(&m_nIp, 1); - debug("skipping SET_TONIGHTS_EVENT\n"); // TODO(MIAMI) + CScrollBar::TonightsEvent = ScriptParams[0]; return 0; } case COMMAND_CLEAR_CHAR_LAST_DAMAGE_ENTITY: @@ -13416,9 +13425,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; script_assert(pPed); if (pPed->bInVehicle) { - if (pPed->GetWeapon(5).m_eWeaponType) { // TODO(MIAMI): enum - if (pPed->GetWeapon(5).m_nAmmoTotal < ScriptParams[1]) - pPed->SetAmmo(pPed->GetWeapon(5).m_eWeaponType, ScriptParams[1]); + if (pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType) { + if (pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_nAmmoTotal < ScriptParams[1]) + pPed->SetAmmo(pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType, ScriptParams[1]); } else { pPed->GiveWeapon(WEAPONTYPE_UZI, ScriptParams[1], true); @@ -13440,7 +13449,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) case COMMAND_ADD_EXPLOSION_NO_SOUND: { CollectParameters(&m_nIp, 4); - CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0); // TODO(MIAMI): last arg is 0 + CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, false); return 0; } case COMMAND_SET_OBJECT_AREA_VISIBLE: diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index 5559b1c4..9926432b 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -15,8 +15,7 @@ #include "Weather.h" #include "World.h" -// TODO: figure out the meaning of this -enum { SOME_FLAG = 0x80 }; +//--MIAMI: file done bool CTrafficLights::bGreenLightsCheat; @@ -28,113 +27,286 @@ CTrafficLights::DisplayActualLight(CEntity *ent) int phase; if(FindTrafficLightType(ent) == 1) - phase = LightForCars1(); + phase = LightForCars1_Visual(); else - phase = LightForCars2(); - - int i; - CBaseModelInfo *mi = CModelInfo::GetModelInfo(ent->GetModelIndex()); - float x = mi->Get2dEffect(0)->pos.x; - float yMin = mi->Get2dEffect(0)->pos.y; - float yMax = mi->Get2dEffect(0)->pos.y; - float zMin = mi->Get2dEffect(0)->pos.z; - float zMax = mi->Get2dEffect(0)->pos.z; - for(i = 1; i < 6; i++){ - assert(mi->Get2dEffect(i)); - yMin = Min(yMin, mi->Get2dEffect(i)->pos.y); - yMax = Max(yMax, mi->Get2dEffect(i)->pos.y); - zMin = Min(zMin, mi->Get2dEffect(i)->pos.z); - zMax = Max(zMax, mi->Get2dEffect(i)->pos.z); + phase = LightForCars2_Visual(); + + int i, m = ent->GetModelIndex(); + if (MI_TRAFFICLIGHTS == m) { + CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex()); + float x = mi->Get2dEffect(0)->pos.x; + float yMin = mi->Get2dEffect(0)->pos.y; + float yMax = mi->Get2dEffect(0)->pos.y; + float zMin = mi->Get2dEffect(0)->pos.z; + float zMax = mi->Get2dEffect(0)->pos.z; + for (i = 1; i < 6; i++) { + assert(mi->Get2dEffect(i)); + yMin = Min(yMin, mi->Get2dEffect(i)->pos.y); + yMax = Max(yMax, mi->Get2dEffect(i)->pos.y); + zMin = Min(zMin, mi->Get2dEffect(i)->pos.z); + zMax = Max(zMax, mi->Get2dEffect(i)->pos.z); + } + + CVector pos1, pos2; + uint8 r, g; + int id; + switch (phase) { + case CAR_LIGHTS_GREEN: + r = 0; + g = 255; + pos1 = ent->GetMatrix() * CVector(x, yMax, zMin); + pos2 = ent->GetMatrix() * CVector(x, yMin, zMin); + id = 0; + break; + case CAR_LIGHTS_YELLOW: + r = 255; + g = 128; + pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin + zMax) / 2.0f); + pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin + zMax) / 2.0f); + id = 1; + break; + case CAR_LIGHTS_RED: + r = 255; + g = 0; + pos1 = ent->GetMatrix() * CVector(x, yMax, zMax); + pos2 = ent->GetMatrix() * CVector(x, yMin, zMax); + id = 2; + break; + default: + r = 0; + g = 0; + pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin + zMax) / 2.0f); + pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin + zMax) / 2.0f); + id = -1; + break; + } + + if (CWeather::TrafficLightBrightness > 0.5f) + CPointLights::AddLight(CPointLights::LIGHT_POINT, + pos1, CVector(0.0f, 0.0f, 0.0f), 8.0f, + r / 255.0f, g / 255.0f, 0 / 255.0f, CPointLights::FOG_NORMAL, true); + + if (CWeather::TrafficLightBrightness > 0.05f) + CShadows::StoreStaticShadow((uintptr)ent, + SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1, + 8.0f, 0.0f, 0.0f, -8.0f, 128, + r * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + g * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + 0 * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + 12.0f, 1.0f, 40.0f, false, 0.0f); + + if (DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f) + CCoronas::RegisterCorona((uintptr)ent + id, + r * CTimeCycle::GetSpriteBrightness() * 0.7f, + g * CTimeCycle::GetSpriteBrightness() * 0.7f, + 0 * CTimeCycle::GetSpriteBrightness() * 0.7f, + 255, + pos1, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, + CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + else + CCoronas::RegisterCorona((uintptr)ent + id + 3, + r * CTimeCycle::GetSpriteBrightness() * 0.7f, + g * CTimeCycle::GetSpriteBrightness() * 0.7f, + 0 * CTimeCycle::GetSpriteBrightness() * 0.7f, + 255, + pos2, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, + CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + + CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); + CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); } + else if (MI_TRAFFICLIGHTS_VERTICAL == m) { + CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex()); + float x = mi->Get2dEffect(0)->pos.x; + float yMin = mi->Get2dEffect(0)->pos.y; + float yMax = mi->Get2dEffect(0)->pos.y; + float zMin = mi->Get2dEffect(0)->pos.z; + float zMax = mi->Get2dEffect(0)->pos.z; + for (i = 1; i < 6; i++) { + assert(mi->Get2dEffect(i)); + yMin = Min(yMin, mi->Get2dEffect(i)->pos.y); + yMax = Max(yMax, mi->Get2dEffect(i)->pos.y); + zMin = Min(zMin, mi->Get2dEffect(i)->pos.z); + zMax = Max(zMax, mi->Get2dEffect(i)->pos.z); + } + + CVector pos1; + uint8 r, g; + int id; + switch (phase) { + case CAR_LIGHTS_GREEN: + r = 0; + g = 255; + pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos; + id = 0; + break; + case CAR_LIGHTS_YELLOW: + r = 255; + g = 128; + pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos; + id = 1; + break; + case CAR_LIGHTS_RED: + r = 255; + g = 0; + pos1 = ent->GetMatrix() * mi->Get2dEffect(0)->pos; + id = 2; + break; + default: + r = 0; + g = 0; + pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos; + id = -1; + break; + } - CVector pos1, pos2; - uint8 r, g; - int id; - switch(phase){ - case CAR_LIGHTS_GREEN: - r = 0; - g = 255; - pos1 = ent->GetMatrix() * CVector(x, yMax, zMin); - pos2 = ent->GetMatrix() * CVector(x, yMin, zMin); - id = 0; - break; - case CAR_LIGHTS_YELLOW: - r = 255; - g = 128; - pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin+zMax)/2.0f); - pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin+zMax)/2.0f); - id = 1; - break; - case CAR_LIGHTS_RED: - default: - r = 255; - g = 0; - pos1 = ent->GetMatrix() * CVector(x, yMax, zMax); - pos2 = ent->GetMatrix() * CVector(x, yMin, zMax); - id = 2; - break; + CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); + + if (CWeather::TrafficLightBrightness > 0.5f) + CPointLights::AddLight(CPointLights::LIGHT_POINT, + pos1, CVector(0.0f, 0.0f, 0.0f), 8.0f, + r / 255.0f, g / 255.0f, 0 / 255.0f, CPointLights::FOG_NORMAL, true); + + if (CWeather::TrafficLightBrightness > 0.05f) + CShadows::StoreStaticShadow((uintptr)ent, + SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1, + 8.0f, 0.0f, 0.0f, -8.0f, 128, + r * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + g * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + 0 * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + 12.0f, 1.0f, 40.0f, false, 0.0f); + + if (DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f) + CCoronas::RegisterCorona((uintptr)ent + id, + r * CTimeCycle::GetSpriteBrightness() * 0.7f, + g * CTimeCycle::GetSpriteBrightness() * 0.7f, + 0 * CTimeCycle::GetSpriteBrightness() * 0.7f, + 255, + pos1, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, + CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); } + else if (MI_TRAFFICLIGHTS_MIAMI == m || MI_TRAFFICLIGHTS_TWOVERTICAL == m) { + CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex()); + CVector pos1, pos2; + uint8 r, g; + int id; + if (MI_TRAFFICLIGHTS_MIAMI == m) { + switch (phase) { + case CAR_LIGHTS_GREEN: + r = 0; + g = 255; + pos1 = ent->GetMatrix() * mi->Get2dEffect(4)->pos; + pos2 = ent->GetMatrix() * mi->Get2dEffect(5)->pos; + id = 0; + break; + case CAR_LIGHTS_YELLOW: + r = 255; + g = 128; + pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos; + pos2 = ent->GetMatrix() * mi->Get2dEffect(3)->pos; + id = 1; + break; + case CAR_LIGHTS_RED: + r = 255; + g = 0; + pos1 = ent->GetMatrix() * mi->Get2dEffect(0)->pos; + pos2 = ent->GetMatrix() * mi->Get2dEffect(1)->pos; + id = 2; + break; + default: + r = 0; + g = 0; + pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos; + pos2 = ent->GetMatrix() * mi->Get2dEffect(3)->pos; + id = -1; + break; + } + } + else { + switch (phase) { + case CAR_LIGHTS_GREEN: + r = 0; + g = 255; + pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos; + pos2 = ent->GetMatrix() * mi->Get2dEffect(5)->pos; + id = 0; + break; + case CAR_LIGHTS_YELLOW: + r = 255; + g = 128; + pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos; + pos2 = ent->GetMatrix() * mi->Get2dEffect(4)->pos; + id = 1; + break; + case CAR_LIGHTS_RED: + r = 255; + g = 0; + pos1 = ent->GetMatrix() * mi->Get2dEffect(0)->pos; + pos2 = ent->GetMatrix() * mi->Get2dEffect(3)->pos; + id = 2; + break; + default: + r = 0; + g = 0; + pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos; + pos2 = ent->GetMatrix() * mi->Get2dEffect(4)->pos; + id = -1; + break; + } + } - if(CClock::GetHours() > 19 || CClock::GetHours() < 6 || CWeather::Foggyness > 0.05f) - CPointLights::AddLight(CPointLights::LIGHT_POINT, - pos1, CVector(0.0f, 0.0f, 0.0f), 8.0f, - r/255.0f, g/255.0f, 0/255.0f, CPointLights::FOG_NORMAL, true); - - CShadows::StoreStaticShadow((uintptr)ent, - SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1, - 8.0f, 0.0f, 0.0f, -8.0f, 128, - r*CTimeCycle::GetLightOnGroundBrightness()/8.0f, - g*CTimeCycle::GetLightOnGroundBrightness()/8.0f, - 0*CTimeCycle::GetLightOnGroundBrightness()/8.0f, - 12.0f, 1.0f, 40.0f, false, 0.0f); - - if(DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f) - CCoronas::RegisterCorona((uintptr)ent + id, - r*CTimeCycle::GetSpriteBrightness()*0.7f, - g*CTimeCycle::GetSpriteBrightness()*0.7f, - 0*CTimeCycle::GetSpriteBrightness()*0.7f, - 255, - pos1, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f, - CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, - CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); - else - CCoronas::RegisterCorona((uintptr)ent + id + 3, - r*CTimeCycle::GetSpriteBrightness()*0.7f, - g*CTimeCycle::GetSpriteBrightness()*0.7f, - 0*CTimeCycle::GetSpriteBrightness()*0.7f, - 255, - pos2, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f, - CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, - CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); - - CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); - CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); - -/* - static const float top = -0.127f; - static const float bot = -0.539f; - static const float mid = bot + (top-bot)/3.0f; - static const float left = 1.256f; - static const float right = 0.706f; - phase = CTrafficLights::LightForPeds(); - if(phase == PED_LIGHTS_DONT_WALK){ - CVector p0(2.7f, right, top); - CVector p1(2.7f, left, top); - CVector p2(2.7f, right, mid); - CVector p3(2.7f, left, mid); - CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3, - 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, - SHINYTEXT_WALK, 255, 0, 0, 60.0f); - }else if(phase == PED_LIGHTS_WALK || CTimer::GetTimeInMilliseconds() & 0x100){ - CVector p0(2.7f, right, mid); - CVector p1(2.7f, left, mid); - CVector p2(2.7f, right, bot); - CVector p3(2.7f, left, bot); - CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3, - 1.0f, 0.5f, 0.0f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f, - SHINYTEXT_WALK, 255, 255, 255, 60.0f); + CVector pos = (pos1 + pos2) / 2; + if (id >= 0) { + CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); + CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); + } + + if (CWeather::TrafficLightBrightness > 0.5f) + CPointLights::AddLight(CPointLights::LIGHT_POINT, + pos, CVector(0.0f, 0.0f, 0.0f), 8.0f, + r / 255.0f, g / 255.0f, 0 / 255.0f, CPointLights::FOG_NORMAL, true); + + if (CWeather::TrafficLightBrightness > 0.05f) + CShadows::StoreStaticShadow((uintptr)ent, + SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, + 8.0f, 0.0f, 0.0f, -8.0f, 128, + r * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + g * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + 0 * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f, + 12.0f, 1.0f, 40.0f, false, 0.0f); + + if (id >= 0) { + if (DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f) + CCoronas::RegisterCorona((uintptr)ent + id, + r * CTimeCycle::GetSpriteBrightness() * 0.7f, + g * CTimeCycle::GetSpriteBrightness() * 0.7f, + 0 * CTimeCycle::GetSpriteBrightness() * 0.7f, + 255, + pos1, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, + CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + else + CCoronas::RegisterCorona((uintptr)ent + id, + r * CTimeCycle::GetSpriteBrightness() * 0.7f, + g * CTimeCycle::GetSpriteBrightness() * 0.7f, + 0 * CTimeCycle::GetSpriteBrightness() * 0.7f, + 255, + pos2, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, + CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + } } -*/ +} + +bool DoesLineSegmentIntersect(float l1x1, float l1y1, float l1x2, float l1y2, float l2x1, float l2y1, float l2x2, float l2y2) +{ + return ((l2y2 - l1y1) * (l1x2 - l1x1) + (l1x1 - l2x2) * (l1y2 - l1y1)) * + ((l2y1 - l1y1) * (l1x2 - l1x1) + (l1x1 - l2x1) * (l1y2 - l1y1)) <= 0.0f && + ((l1y2 - l2y1) * (l2x2 - l2x1) + (l2y2 - l2y1) * (l2x1 - l1x2)) * + ((l1y1 - l2y1) * (l2x2 - l2x1) + (l2y2 - l2y1) * (l2x1 - l1x1)) <= 0.0f; } void @@ -152,33 +324,28 @@ CTrafficLights::ScanForLightsOnMap(void) if (!IsTrafficLight(light->GetModelIndex())) continue; + CVector pos1 = light->GetMatrix() * CVector(17.0f, 0.0f, 0.0f); + CVector pos2 = light->GetMatrix() * CVector(-15.0f, 0.0f, 0.0f); + // Check cars - for(i = 0; i < ThePaths.m_numCarPathLinks; i++){ - CVector2D dist = ThePaths.m_carPathLinks[i].GetPosition() - light->GetPosition(); - float dotY = Abs(DotProduct2D(dist, light->GetForward())); // forward is direction of car light - float dotX = DotProduct2D(dist, light->GetRight()); // towards base of light - // it has to be on the correct side of the node and also not very far away - if(dotX < 0.0f && dotX > -15.0f && dotY < 3.0f){ - float dz = ThePaths.m_pathNodes[ThePaths.m_carPathLinks[i].pathNodeIndex].GetZ() - - light->GetPosition().z; - if(dz < 15.0f){ - ThePaths.m_carPathLinks[i].trafficLightType = FindTrafficLightType(light); - // Find two neighbour nodes of this one - int n1 = -1; - int n2 = -1; - for(j = 0; j < ThePaths.m_numPathNodes; j++) - for(l = 0; l < ThePaths.m_pathNodes[j].numLinks; l++) - if(ThePaths.m_carPathConnections[ThePaths.m_pathNodes[j].firstLink + l] == i){ - if(n1 == -1) - n1 = j; - else - n2 = j; - } - // What's going on here? - if(ThePaths.m_pathNodes[n1].numLinks <= ThePaths.m_pathNodes[n2].numLinks) - n1 = n2; - if(ThePaths.m_carPathLinks[i].pathNodeIndex != n1) - ThePaths.m_carPathLinks[i].trafficLightType |= SOME_FLAG; + for(i = 0; i < ThePaths.m_numCarPathNodes; i++){ + if ((ThePaths.m_pathNodes[i].GetPosition() - pos1).MagnitudeSqr() >= SQR(100.0f)) + continue; + for (j = 0; j < ThePaths.m_pathNodes[i].numLinks; j++){ + int con = ThePaths.ConnectedNode(ThePaths.m_pathNodes[i].firstLink + j); + if (i < con) { + CVector i_pos = ThePaths.m_pathNodes[i].GetPosition(); + CVector con_pos = ThePaths.m_pathNodes[con].GetPosition(); + if (Abs(pos1.z - (i_pos.z + con_pos.z) / 2) < 10.0f && + DoesLineSegmentIntersect(pos1.x, pos1.y, pos2.x, pos2.y, i_pos.x, i_pos.y, con_pos.x, con_pos.y)) { + //debug("Setting up light: nodes %f %f %f - %f %f %f, light %f %f %f - %f %f %f\n", i_pos.x, i_pos.y, i_pos.z, con_pos.x, con_pos.y, con_pos.z, pos1.x, pos1.y, pos1.z, pos2.x, pos2.y, pos2.z); + int link = ThePaths.m_carPathConnections[ThePaths.m_pathNodes[i].firstLink + j]; + ThePaths.m_carPathLinks[link].trafficLightType = FindTrafficLightType(light); + if (ThePaths.m_pathNodes[i].numLinks > ThePaths.m_pathNodes[con].numLinks) + con = i; + if (ThePaths.m_carPathLinks[link].pathNodeIndex != con) + ThePaths.m_carPathLinks[link].trafficLightDirection = true; + } } } } @@ -209,15 +376,18 @@ bool CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop) { int node, type; + bool direction; node = vehicle->AutoPilot.m_nNextPathNodeInfo; type = ThePaths.m_carPathLinks[node].trafficLightType; + direction = ThePaths.m_carPathLinks[node].trafficLightDirection; + if(type){ - if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) && - (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode)) + if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) && + (!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode)) if(alwaysStop || - (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN || - (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){ + type == 1 && LightForCars1() != CAR_LIGHTS_GREEN || + type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(), ThePaths.m_carPathLinks[node].GetDirection()); if(vehicle->AutoPilot.m_nNextDirection == -1){ @@ -232,12 +402,13 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop) node = vehicle->AutoPilot.m_nCurrentPathNodeInfo; type = ThePaths.m_carPathLinks[node].trafficLightType; + direction = ThePaths.m_carPathLinks[node].trafficLightDirection; if(type){ - if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) && - (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode)) + if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) && + (!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode)) if(alwaysStop || - (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN || - (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){ + type == 1 && LightForCars1() != CAR_LIGHTS_GREEN || + type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(), ThePaths.m_carPathLinks[node].GetDirection()); if(vehicle->AutoPilot.m_nCurrentDirection == -1){ @@ -253,12 +424,13 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop) if(vehicle->GetStatus() == STATUS_PHYSICS){ node = vehicle->AutoPilot.m_nPreviousPathNodeInfo; type = ThePaths.m_carPathLinks[node].trafficLightType; + direction = ThePaths.m_carPathLinks[node].trafficLightDirection; if(type){ - if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) && - (!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode)) + if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) && + (!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode)) if(alwaysStop || - (type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN || - (type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){ + type == 1 && LightForCars1() != CAR_LIGHTS_GREEN || + type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){ float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(), ThePaths.m_carPathLinks[node].GetDirection()); if(vehicle->AutoPilot.m_nPreviousDirection == -1){ @@ -348,3 +520,19 @@ CTrafficLights::LightForCars2(void) else return CAR_LIGHTS_RED; } + +uint8 +CTrafficLights::LightForCars1_Visual(void) +{ + if (CWeather::Wind <= 1.1f) + return LightForCars1(); + return (CTimer::GetTimeInMilliseconds() & 0x400 ? CAR_LIGHTS_NONE : CAR_LIGHTS_YELLOW); +} + +uint8 +CTrafficLights::LightForCars2_Visual(void) +{ + if (CWeather::Wind <= 1.1f) + return LightForCars2(); + return (CTimer::GetTimeInMilliseconds() & 0x400 ? CAR_LIGHTS_NONE : CAR_LIGHTS_YELLOW); +} diff --git a/src/control/TrafficLights.h b/src/control/TrafficLights.h index 6cd5e04a..8dba45e1 100644 --- a/src/control/TrafficLights.h +++ b/src/control/TrafficLights.h @@ -10,7 +10,8 @@ enum { CAR_LIGHTS_GREEN = 0, CAR_LIGHTS_YELLOW, - CAR_LIGHTS_RED + CAR_LIGHTS_RED, + CAR_LIGHTS_NONE }; class CTrafficLights @@ -24,6 +25,8 @@ public: static uint8 LightForPeds(void); static uint8 LightForCars1(void); static uint8 LightForCars2(void); + static uint8 LightForCars1_Visual(void); + static uint8 LightForCars2_Visual(void); static bool ShouldCarStopForLight(CVehicle*, bool); static bool ShouldCarStopForBridge(CVehicle*); }; -- cgit v1.2.3 From 49ad471b2d81f4ef9862e7bbcf35ac9eea9a6017 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 11 Oct 2020 12:58:23 +0300 Subject: removed extra header --- src/control/Darkel.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/control') diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index 84da59da..13c49c99 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -15,9 +15,6 @@ #include "Text.h" #include "Vehicle.h" #include "GameLogic.h" -#ifdef FIX_BUGS -#include "Replay.h" -#endif //--MIAMI: file done except TODO -- cgit v1.2.3 From 68779a4dac2beda28c0b5ae520b8eb81b5cede1c Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 11 Oct 2020 13:05:41 +0300 Subject: small fix --- src/control/PathFind.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index b357e085..14aead04 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1529,7 +1529,7 @@ CPathFind::GeneratePedCreationCoors(float x, float y, float minDist, float maxDi int i; int node1, node2; float node1_dist, node2_dist; - static uint32 node_cnt; + static int32 node_cnt; if(m_numPedPathNodes == 0) return false; -- cgit v1.2.3 From 91a274da2b63a194ed2cfeea8389ebedf3b0b8d4 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 11 Oct 2020 13:11:25 +0300 Subject: small fix --- src/control/Garages.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/control') diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 73992bcb..44a961c9 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -2144,7 +2144,7 @@ void CGarages::SetAllDoorsBackToOriginalHeight() void CGarages::Save(uint8 * buf, uint32 * size) { -INITSAVEBUF +//INITSAVEBUF *size = 7876; // for some reason it's not actual size again //*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)); CloseHideOutGaragesBeforeSave(); @@ -2164,7 +2164,7 @@ INITSAVEBUF } for (int i = 0; i < NUM_GARAGES; i++) WriteSaveBuf(buf, aGarages[i]); -VALIDATESAVEBUF(*size); +//VALIDATESAVEBUF(*size); } const CStoredCar &CStoredCar::operator=(const CStoredCar & other) @@ -2188,7 +2188,7 @@ const CStoredCar &CStoredCar::operator=(const CStoredCar & other) void CGarages::Load(uint8* buf, uint32 size) { -INITSAVEBUF +//INITSAVEBUF assert(size = 7876); //assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage))); CloseHideOutGaragesBeforeSave(); @@ -2218,7 +2218,7 @@ INITSAVEBUF else aGarages[i].UpdateDoorsHeight(); } -VALIDATESAVEBUF(size); +//VALIDATESAVEBUF(size); MessageEndTime = 0; bCamShouldBeOutisde = false; -- cgit v1.2.3 From 28b47b601f48477866331d360278c62ff1c01922 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 11 Oct 2020 18:14:35 +0300 Subject: fix --- src/control/TrafficLights.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index 9926432b..ecfc7207 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -261,7 +261,7 @@ CTrafficLights::DisplayActualLight(CEntity *ent) CVector pos = (pos1 + pos2) / 2; if (id >= 0) { CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); - CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); + CBrightLights::RegisterOne(pos2, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN); } if (CWeather::TrafficLightBrightness > 0.5f) -- cgit v1.2.3 From 7a3e1ef19a67a16d75d22144a012b1780b400f78 Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Sun, 11 Oct 2020 21:40:11 +0300 Subject: SpecialFX almost done --- src/control/Replay.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/control') diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 45f1a143..796e4cab 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -393,8 +393,8 @@ void CReplay::RecordThisFrame(void) tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset]; bt->type = REPLAYPACKET_BULLET_TRACES; bt->index = i; - bt->frames = CBulletTraces::aTraces[i].m_framesInUse; - bt->lifetime = CBulletTraces::aTraces[i].m_lifeTime; +// bt->frames = CBulletTraces::aTraces[i].m_framesInUse; +// bt->lifetime = CBulletTraces::aTraces[i].m_lifeTime; bt->inf = CBulletTraces::aTraces[i].m_vecCurrentPos; bt->sup = CBulletTraces::aTraces[i].m_vecTargetPos; Record.m_nOffset += sizeof(*bt); @@ -1140,8 +1140,8 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo { tBulletTracePacket* pb = (tBulletTracePacket*)&ptr[offset]; CBulletTraces::aTraces[pb->index].m_bInUse = true; - CBulletTraces::aTraces[pb->index].m_framesInUse = pb->frames; - CBulletTraces::aTraces[pb->index].m_lifeTime = pb->lifetime; +// CBulletTraces::aTraces[pb->index].m_framesInUse = pb->frames; +// CBulletTraces::aTraces[pb->index].m_lifeTime = pb->lifetime; CBulletTraces::aTraces[pb->index].m_vecCurrentPos = pb->inf; CBulletTraces::aTraces[pb->index].m_vecTargetPos = pb->sup; buffer->m_nOffset += sizeof(tBulletTracePacket); -- cgit v1.2.3 From a96146c87b4c5d4a630221218141e82f962a31cf Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 14 Oct 2020 03:29:25 +0300 Subject: Pickup fix --- src/control/Pickups.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index eb4843c5..9215b57e 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -76,11 +76,11 @@ CPickup::GiveUsAPickUpObject(int32 handle) { CObject *object; - if (handle <= 0) object = new CObject(m_eModelIndex, false); - else { + if (handle >= 0) { CPools::MakeSureSlotInObjectPoolIsEmpty(handle); - object = new(handle) CObject(m_eModelIndex, false); - } + object = new (handle) CObject(m_eModelIndex, false); + } else + object = new CObject(m_eModelIndex, false); if (object == nil) return nil; object->ObjectCreatedBy = MISSION_OBJECT; -- cgit v1.2.3 From e4ac934dbf57392c2b231f32d4f101bb9a183a51 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Thu, 15 Oct 2020 00:33:57 +0300 Subject: Miami Glass --- src/control/Script.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index aa4e109f..55139f2e 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -31,6 +31,7 @@ #include "GameLogic.h" #include "Garages.h" #include "General.h" +#include "Glass.h" #ifdef MISSION_REPLAY #include "GenericGameStorage.h" #endif @@ -13002,12 +13003,12 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) case COMMAND_HAS_GLASS_BEEN_SHATTERED_NEARBY: { CollectParameters(&m_nIp, 3); - static bool bShowed = false; - if (!bShowed) { - debug("HAS_GLASS_BEEN_SHATTERED_NEARBY not implemented, default to TRUE\n"); // TODO(MIAMI) - bShowed = true; - } - UpdateCompareFlag(true); + + bool shattered = false; + if ( CGlass::HasGlassBeenShatteredAtCoors(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2]) ) + shattered = true; + + UpdateCompareFlag(shattered); return 0; } case COMMAND_ATTACH_CUTSCENE_OBJECT_TO_BONE: -- cgit v1.2.3 From 34b4efe242bc6304f2e340dfe32273062e0ed73e Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Thu, 15 Oct 2020 15:42:10 +0300 Subject: fix bullet traces rener and some renaming --- src/control/Replay.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/control') diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 034cfe4d..ad2aad7e 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -394,10 +394,8 @@ void CReplay::RecordThisFrame(void) tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset]; bt->type = REPLAYPACKET_BULLET_TRACES; bt->index = i; -// bt->frames = CBulletTraces::aTraces[i].m_framesInUse; -// bt->lifetime = CBulletTraces::aTraces[i].m_lifeTime; - bt->inf = CBulletTraces::aTraces[i].m_vecCurrentPos; - bt->sup = CBulletTraces::aTraces[i].m_vecTargetPos; + bt->inf = CBulletTraces::aTraces[i].m_vecStartPos; + bt->sup = CBulletTraces::aTraces[i].m_vecEndPos; Record.m_nOffset += sizeof(*bt); } tMiscPacket* misc = (tMiscPacket*)&Record.m_pBase[Record.m_nOffset]; @@ -1141,10 +1139,8 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo { tBulletTracePacket* pb = (tBulletTracePacket*)&ptr[offset]; CBulletTraces::aTraces[pb->index].m_bInUse = true; -// CBulletTraces::aTraces[pb->index].m_framesInUse = pb->frames; -// CBulletTraces::aTraces[pb->index].m_lifeTime = pb->lifetime; - CBulletTraces::aTraces[pb->index].m_vecCurrentPos = pb->inf; - CBulletTraces::aTraces[pb->index].m_vecTargetPos = pb->sup; + CBulletTraces::aTraces[pb->index].m_vecStartPos = pb->inf; + CBulletTraces::aTraces[pb->index].m_vecEndPos = pb->sup; buffer->m_nOffset += sizeof(tBulletTracePacket); break; } -- cgit v1.2.3 From ef47dad566db734b1efda862c414cf89af53d07e Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 08:23:01 +0300 Subject: Partial Pickups --- src/control/Pickups.cpp | 437 ++++++++++++++++-------------------------------- src/control/Pickups.h | 15 +- 2 files changed, 156 insertions(+), 296 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 7a9808f6..62f527ec 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -117,15 +117,36 @@ CPickup::Remove() m_eType = PICKUP_NONE; } +// --MIAMI: Done CObject * -CPickup::GiveUsAPickUpObject(int32 handle) +CPickup::GiveUsAPickUpObject(CObject **ppObject, CObject **ppExtraObject, int32 handle, int32 extraHandle) { - CObject *object; + CObject *&object = *ppObject; + CObject *&extraObject = *ppExtraObject; + + object = extraObject = nil; + + int32 modelId = -1; + if (CModelInfo::GetModelInfo(m_eModelIndex)->GetModelType() == MITYPE_WEAPON) { + CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(((CWeaponModelInfo*)CModelInfo::GetModelInfo(m_eModelIndex))->GetWeaponInfo()); + modelId = weaponInfo->m_nModelId; + if (modelId == m_eModelIndex) + modelId = weaponInfo->m_nModel2Id; + } - if (handle <= 0) object = new CObject(m_eModelIndex, false); - else { + if (handle >= 0) { CPools::MakeSureSlotInObjectPoolIsEmpty(handle); - object = new(handle) CObject(m_eModelIndex, false); + if (extraHandle >= 0) + CPools::MakeSureSlotInObjectPoolIsEmpty(extraHandle); + if (object == nil) + object = new(handle) CObject(m_eModelIndex, false); + + if (extraHandle >= 0 && modelId != -1 && extraObject == nil) + extraObject = new(extraHandle) CObject(modelId, false); + } else { + object = new CObject(m_eModelIndex, false); + if (modelId != -1) + extraObject = new CObject(modelId, false); } if (object == nil) return nil; @@ -139,15 +160,38 @@ CPickup::GiveUsAPickUpObject(int32 handle) object->bExplosionProof = true; object->bUsesCollision = false; object->bIsPickup = true; + object->obj_flag_02 = m_effects; object->bHasPreRenderEffects = true; - object->m_nBonusValue = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0; + if (extraObject) { + extraObject->ObjectCreatedBy = MISSION_OBJECT; + extraObject->SetPosition(m_vecPos); + extraObject->SetOrientation(0.0f, 0.0f, -HALFPI); + extraObject->GetMatrix().UpdateRW(); + extraObject->UpdateRwFrame(); + + extraObject->bAffectedByGravity = false; + extraObject->bExplosionProof = true; + extraObject->bUsesCollision = false; + extraObject->bIsPickup = true; + extraObject->obj_flag_02 = true; + extraObject->bHasPreRenderEffects = true; + extraObject->m_nBonusValue = 0; + extraObject->bPickupObjWithMessage = false; + extraObject->bOutOfStock = false; + } + + object->m_nBonusValue = (m_eModelIndex == MI_PICKUP_BONUS || m_eModelIndex == MI_PICKUP_CLOTHES) ? m_nQuantity : 0; switch (m_eType) { case PICKUP_IN_SHOP: object->bPickupObjWithMessage = true; object->bOutOfStock = false; + if (m_eModelIndex == MI_PICKUP_HEALTH || m_eModelIndex == MI_PICKUP_ADRENALINE) + object->m_nCostValue = 0; + else + object->m_nCostValue = CostOfWeapon[CPickups::WeaponForModel(m_eModelIndex)]; break; case PICKUP_ON_STREET: case PICKUP_ONCE: @@ -193,28 +237,20 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) float waterLevel; if (m_pObject) { - m_pObject->SetPosition(m_vecPos); - // TODO(Miami): Extra object + m_pObject->GetMatrix().GetPosition() = m_vecPos; + if (m_pExtraObject) + m_pExtraObject->GetMatrix().GetPosition() = m_vecPos; } if (m_eType == PICKUP_ASSET_REVENUE) { - uint32 oldTimer = m_nTimer; + uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nTimer; m_nTimer = CTimer::GetTimeInMilliseconds(); - float calculatedRevenue; - if ((FindPlayerCoors() - m_vecPos).Magnitude() > 10.0) { - uint32 timePassed = CTimer::GetTimeInMilliseconds() - oldTimer; - calculatedRevenue = m_nRevenue + (timePassed * m_nMoneySpeed) * sq(1.f / 1200.f); - } else { - calculatedRevenue = m_nRevenue; - } - m_nRevenue = Min(calculatedRevenue, m_nQuantity); - // TODO(Miami): For pickup glow effect? - /* - if (calculatedRevenue < 10.0) { - m_pObject->m_nCostValue = 0; - } else { - m_pObject->m_nCostValue = calculatedRevenue; - } - */ + + if (Distance(FindPlayerCoors(), m_vecPos) > 10.0f) + m_fRevenue += float(timePassed * m_nMoneySpeed) / SQR(1200.0f); + + m_fRevenue = Min(m_fRevenue, m_nQuantity); + + m_pObject->m_nCostValue = m_fRevenue < 10 ? 0 : m_fRevenue; } if (m_bRemoved) { @@ -222,7 +258,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) // respawn pickup if we're far enough float dist = (FindPlayerCoors().x - m_vecPos.x) * (FindPlayerCoors().x - m_vecPos.x) + (FindPlayerCoors().y - m_vecPos.y) * (FindPlayerCoors().y - m_vecPos.y); if (dist > 100.0f || m_eType == PICKUP_IN_SHOP && dist > 2.4f) { - m_pObject = GiveUsAPickUpObject(-1); + m_pObject = GiveUsAPickUpObject(&m_pObject, &m_pExtraObject, -1, -1); if (m_pObject) { CWorld::Add(m_pObject); m_bRemoved = false; @@ -232,6 +268,14 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) return false; } + if (!m_pObject) { + GiveUsAPickUpObject(&m_pObject, &m_pExtraObject, -1, -1); + if (m_pObject) + CWorld::Add(m_pObject); + if (m_pExtraObject) + CWorld::Add(m_pExtraObject); + } + if (!m_pObject) return false; if (!IsMine()) { @@ -261,6 +305,10 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) } } + // MIAMI code here + + // ... + // if we didn't then we've got nothing to do if (isPickupTouched && CanBePickedUp(player, playerId)) { CPad::GetPad(0)->StartShake(120, 100); @@ -345,8 +393,8 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0); return true; case PICKUP_ASSET_REVENUE: - CWorld::Players[CWorld::PlayerInFocus].m_nMoney += m_nRevenue; - m_nRevenue = 0; + CWorld::Players[CWorld::PlayerInFocus].m_nMoney += m_fRevenue; + m_fRevenue = 0; DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0); return false; // TODO(Miami): Control flow @@ -462,6 +510,23 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) return false; } +// --MIAMI: Done +void +CPickup::GetRidOfObjects() +{ + if (m_pObject) { + CWorld::Remove(m_pObject); + delete m_pObject; + m_pObject = nil; + } + if (m_pExtraObject) { + CWorld::Remove(m_pExtraObject); + delete m_pExtraObject; + m_pExtraObject = nil; + } +} + +// --MIAMI: Done void CPickups::Init(void) { @@ -470,6 +535,7 @@ CPickups::Init(void) aPickUps[i].m_eType = PICKUP_NONE; aPickUps[i].m_nIndex = 1; aPickUps[i].m_pObject = nil; + aPickUps[i].m_pExtraObject = nil; } for (int i = 0; i < NUMCOLLECTEDPICKUPS; i++) @@ -502,6 +568,7 @@ CPickups::TryToMerge_WeaponType(CVector pos, eWeaponType weapon, uint8 type, uin return false; } +// --MIAMI: Done bool CPickups::IsPickUpPickedUp(int32 pickupId) { @@ -514,11 +581,12 @@ CPickups::IsPickUpPickedUp(int32 pickupId) return false; } +// --MIAMI: Done void CPickups::PassTime(uint32 time) { for (int i = 0; i < NUMPICKUPS; i++) { - if (aPickUps[i].m_eType != PICKUP_NONE) { + if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].m_eType != PICKUP_ASSET_REVENUE) { if (aPickUps[i].m_nTimer <= time) aPickUps[i].m_nTimer = 0; else @@ -527,6 +595,7 @@ CPickups::PassTime(uint32 time) } } +// --MIAMI: Done int32 CPickups::GetActualPickupIndex(int32 index) { @@ -537,6 +606,7 @@ CPickups::GetActualPickupIndex(int32 index) return (uint16)index; } +// --MIAMI: Done bool CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex) { @@ -566,8 +636,7 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex) DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0); return true; } else if (modelIndex == MI_PICKUP_BRIBE) { - int32 level = FindPlayerPed()->m_pWanted->m_nWantedLevel - 1; - if (level < 0) level = 0; + int32 level = Max(FindPlayerPed()->m_pWanted->m_nWantedLevel - 1, 0); player->SetWantedLevel(level); DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0); return true; @@ -578,6 +647,7 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex) return false; } +// --MIAMI: Todo void CPickups::RemoveAllFloatingPickups() { @@ -592,6 +662,7 @@ CPickups::RemoveAllFloatingPickups() } } +// --MIAMI: Done void CPickups::RemovePickUp(int32 pickupIndex) { @@ -603,10 +674,16 @@ CPickups::RemovePickUp(int32 pickupIndex) delete aPickUps[index].m_pObject; aPickUps[index].m_pObject = nil; } + if (aPickUps[index].m_pExtraObject) { + CWorld::Remove(aPickUps[index].m_pExtraObject); + delete aPickUps[index].m_pExtraObject; + aPickUps[index].m_pExtraObject = nil; + } aPickUps[index].m_eType = PICKUP_NONE; aPickUps[index].m_bRemoved = true; } +// --MIAMI: Done int32 CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity, uint32 rate, bool highPriority, char* pText) { @@ -620,7 +697,8 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan break; } } - } else { + } + if (!bFreeFound) { for (slot = 0; slot < NUMGENERALPICKUPS; slot++) { if (aPickUps[slot].m_eType == PICKUP_NONE) { bFreeFound = true; @@ -640,6 +718,7 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan } if (slot >= NUMGENERALPICKUPS) return -1; + aPickUps[slot].GetRidOfObjects(); } } @@ -649,8 +728,10 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan aPickUps[slot].m_bRemoved = false; aPickUps[slot].m_nQuantity = quantity; aPickUps[slot].m_nMoneySpeed = rate; - aPickUps[slot].m_nRevenue = 0; + aPickUps[slot].m_fRevenue = 0.0f; aPickUps[slot].m_nTimer = CTimer::GetTimeInMilliseconds(); + aPickUps[slot].m_effects = highPriority; + aPickUps[slot].m_effects2 = false; if (type == PICKUP_ONCE_TIMEOUT) aPickUps[slot].m_nTimer = CTimer::GetTimeInMilliseconds() + 20000; else if (type == PICKUP_ONCE_TIMEOUT_SLOW) @@ -671,18 +752,22 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan aPickUps[slot].m_sTextKey[0] = '\0'; aPickUps[slot].m_vecPos = pos; - aPickUps[slot].m_pObject = aPickUps[slot].GiveUsAPickUpObject(-1); + aPickUps[slot].m_pObject = aPickUps[slot].GiveUsAPickUpObject(&aPickUps[slot].m_pObject, &aPickUps[slot].m_pExtraObject, -1, -1); if (aPickUps[slot].m_pObject) CWorld::Add(aPickUps[slot].m_pObject); + if (aPickUps[slot].m_pExtraObject) + CWorld::Add(aPickUps[slot].m_pExtraObject); return GetNewUniquePickupIndex(slot); } +// --MIAMI: Done int32 CPickups::GenerateNewOne_WeaponType(CVector pos, eWeaponType weaponType, uint8 type, uint32 quantity) { return GenerateNewOne(pos, ModelForWeapon(weaponType), type, quantity); } +// --MIAMI: Done int32 CPickups::GetNewUniquePickupIndex(int32 slot) { @@ -711,6 +796,7 @@ CPickups::WeaponForModel(int32 model) return (eWeaponType)((CWeaponModelInfo*)CModelInfo::GetModelInfo(model))->GetWeaponInfo(); } +// --MIAMI: Done void CPickups::AddToCollectedPickupsArray(int32 index) { @@ -754,15 +840,13 @@ CPickups::Update() } } #endif - if (CPad::GetPad(0)->CollectPickupJustDown()) { + if (CPad::GetPad(0)->CollectPickupJustDown()) CollectPickupBuffer = 6; - } else { + else CollectPickupBuffer = Max(0, CollectPickupBuffer - 1); - } - if (PlayerOnWeaponPickup) { + if (PlayerOnWeaponPickup) PlayerOnWeaponPickup = Max(0, PlayerOnWeaponPickup - 1); - } #define PICKUPS_FRAME_SPAN (6) #ifdef FIX_BUGS @@ -1102,6 +1186,7 @@ CPickups::RenderPickUpText() NumMessages = 0; } +// --MIAMI: Done void CPickups::CreateSomeMoney(CVector pos, int money) { @@ -1121,6 +1206,29 @@ CPickups::CreateSomeMoney(CVector pos, int money) } } +// --MIAMI: Done +void +CPickups::RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType weaponType) +{ + uint32 weaponSlot = CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot; + if (weaponSlot >= WEAPONSLOT_SHOTGUN && weaponSlot <= WEAPONSLOT_RIFLE) { + for (int slot = 0; slot < NUMPICKUPS; slot++) { + if (aPickUps[slot].m_eType == PICKUP_ONCE || aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT || aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT_SLOW) { + if (aPickUps[slot].m_pObject) { + if (CWeaponInfo::GetWeaponInfo(WeaponForModel(aPickUps[slot].m_pObject->GetModelIndex()))->m_nWeaponSlot == weaponSlot && + aPickUps[slot].m_nQuantity == 0) { + CWorld::Remove(aPickUps[slot].m_pObject); + delete aPickUps[slot].m_pObject; + aPickUps[slot].m_bRemoved = true; + aPickUps[slot].m_pObject = nil; + aPickUps[slot].m_eType = PICKUP_NONE; + } + } + } + } + } +} + void CPickups::Load(uint8 *buf, uint32 size) { @@ -1168,40 +1276,6 @@ VALIDATESAVEBUF(*size) void CPacManPickup::Update() { - if (FindPlayerVehicle() == nil) return; - - CVehicle *veh = FindPlayerVehicle(); - - if (DistanceSqr2D(FindPlayerVehicle()->GetPosition(), m_vecPosn.x, m_vecPosn.y) < 100.0f && veh->IsSphereTouchingVehicle(m_vecPosn.x, m_vecPosn.y, m_vecPosn.z, 1.5f)) { - switch (m_eType) - { - case PACMAN_SCRAMBLE: - { - veh->m_nPacManPickupsCarried++; - veh->m_vecMoveSpeed *= 0.65f; - float massMult = (veh->m_fMass + 250.0f) / veh->m_fMass; - veh->m_fMass *= massMult; - veh->m_fTurnMass *= massMult; - veh->m_fForceMultiplier *= massMult; - FindPlayerPed()->m_pWanted->m_nChaos += 10; - FindPlayerPed()->m_pWanted->UpdateWantedLevel(); - DMAudio.PlayFrontEndSound(SOUND_PICKUP_PACMAN_PACKAGE, 0); - break; - } - case PACMAN_RACE: - CPacManPickups::PillsEatenInRace++; - DMAudio.PlayFrontEndSound(SOUND_PICKUP_PACMAN_PILL, 0); - break; - default: - break; - } - m_eType = PACMAN_NONE; - if (m_pObject != nil) { - CWorld::Remove(m_pObject); - delete m_pObject; - m_pObject = nil; - } - } } int32 CollectGameState; @@ -1215,52 +1289,11 @@ bool CPacManPickups::bPMActive; void CPacManPickups::Init() { - for (int i = 0; i < NUMPACMANPICKUPS; i++) - aPMPickUps[i].m_eType = PACMAN_NONE; - bPMActive = false; } void CPacManPickups::Update() { - if (FindPlayerVehicle()) { - float dist = Distance(FindPlayerCoors(), CVector(1072.0f, -948.0f, 14.5f)); - switch (CollectGameState) { - case 1: - if (dist < 10.0f) { - ThingsToCollect -= FindPlayerVehicle()->m_nPacManPickupsCarried; - FindPlayerVehicle()->m_nPacManPickupsCarried = 0; - FindPlayerVehicle()->m_fMass /= FindPlayerVehicle()->m_fForceMultiplier; - FindPlayerVehicle()->m_fTurnMass /= FindPlayerVehicle()->m_fForceMultiplier; - FindPlayerVehicle()->m_fForceMultiplier = 1.0f; - } - if (ThingsToCollect <= 0) { - CollectGameState = 2; - ClearPMPickUps(); - } - break; - case 2: - if (dist > 11.0f) - CollectGameState = 0; - break; - case 20: - if (Distance(FindPlayerCoors(), LastPickUpCoors) > 30.0f) { - LastPickUpCoors = FindPlayerCoors(); - printf("%f, %f, %f,\n", LastPickUpCoors.x, LastPickUpCoors.y, LastPickUpCoors.z); - } - break; - default: - break; - } - } - if (bPMActive) { -#define PACMANPICKUPS_FRAME_SPAN (4) - for (uint32 i = (CTimer::GetFrameCounter() % PACMANPICKUPS_FRAME_SPAN) * (NUMPACMANPICKUPS / PACMANPICKUPS_FRAME_SPAN); i < ((CTimer::GetFrameCounter() % PACMANPICKUPS_FRAME_SPAN) + 1) * (NUMPACMANPICKUPS / PACMANPICKUPS_FRAME_SPAN); i++) { - if (aPMPickUps[i].m_eType != PACMAN_NONE) - aPMPickUps[i].Update(); - } -#undef PACMANPICKUPS_FRAME_SPAN - } } void @@ -1268,117 +1301,6 @@ CPacManPickups::GeneratePMPickUps(CVector pos, float scrambleMult, int16 count, { } -// diablo porn mission pickups -static const CVector aRacePoints1[] = { - CVector(913.62219f, -155.13692f, 4.9699469f), - CVector(913.92401f, -124.12943f, 4.9692569f), - CVector(913.27899f, -93.524231f, 7.4325991f), - CVector(912.60852f, -63.15905f, 7.4533591f), - CVector(934.22144f, -42.049122f, 7.4511471f), - CVector(958.88092f, -23.863735f, 7.4652338f), - CVector(978.50812f, -0.78458798f, 5.13515f), - CVector(1009.4175f, -2.1041219f, 2.4461579f), - CVector(1040.6313f, -2.0793829f, 2.293175f), - CVector(1070.7863f, -2.084095f, 2.2789791f), - CVector(1100.5773f, -8.468729f, 5.3248072f), - CVector(1119.9341f, -31.738031f, 7.1913071f), - CVector(1122.1664f, -62.762737f, 7.4703908f), - CVector(1122.814f, -93.650566f, 8.5577497f), - CVector(1125.8253f, -124.26616f, 9.9803305f), - CVector(1153.8727f, -135.47169f, 14.150617f), - CVector(1184.0831f, -135.82845f, 14.973998f), - CVector(1192.0432f, -164.57816f, 19.18627f), - CVector(1192.7761f, -194.28871f, 24.799675f), - CVector(1215.1527f, -215.0714f, 25.74975f), - CVector(1245.79f, -215.39304f, 28.70726f), - CVector(1276.2477f, -216.39485f, 33.71236f), - CVector(1306.5535f, -216.71007f, 39.711472f), - CVector(1335.0244f, -224.59329f, 46.474979f), - CVector(1355.4879f, -246.27664f, 49.934841f), - CVector(1362.6003f, -276.47064f, 49.96265f), - CVector(1363.027f, -307.30847f, 49.969173f), - CVector(1365.343f, -338.08609f, 49.967789f), - CVector(1367.5957f, -368.01105f, 50.092304f), - CVector(1368.2749f, -398.38049f, 50.061268f), - CVector(1366.9034f, -429.98483f, 50.057545f), - CVector(1356.8534f, -459.09259f, 50.035545f), - CVector(1335.5819f, -481.13544f, 47.217903f), - CVector(1306.7552f, -491.07443f, 40.202629f), - CVector(1275.5978f, -491.33194f, 33.969223f), - CVector(1244.702f, -491.46451f, 29.111021f), - CVector(1213.2222f, -491.8754f, 25.771168f), - CVector(1182.7729f, -492.19995f, 24.749964f), - CVector(1152.6874f, -491.42221f, 21.70038f), - CVector(1121.5352f, -491.94604f, 20.075182f), - CVector(1090.7056f, -492.63751f, 17.585758f), - CVector(1059.6008f, -491.65762f, 14.848632f), - CVector(1029.113f, -489.66031f, 14.918498f), - CVector(998.20679f, -486.78107f, 14.945688f), - CVector(968.00555f, -484.91266f, 15.001229f), - CVector(937.74939f, -492.09015f, 14.958629f), - CVector(927.17352f, -520.97736f, 14.972308f), - CVector(929.29749f, -552.08643f, 14.978855f), - CVector(950.69525f, -574.47778f, 14.972788f), - CVector(974.02826f, -593.56024f, 14.966445f), - CVector(989.04779f, -620.12854f, 14.951016f), - CVector(1014.1639f, -637.3905f, 14.966736f), - CVector(1017.5961f, -667.3736f, 14.956415f), - CVector(1041.9735f, -685.94391f, 15.003841f), - CVector(1043.3064f, -716.11298f, 14.974236f), - CVector(1043.5337f, -746.63855f, 14.96919f), - CVector(1044.142f, -776.93823f, 14.965424f), - CVector(1044.2657f, -807.29395f, 14.97171f), - CVector(1017.0797f, -820.1076f, 14.975431f), - CVector(986.23865f, -820.37103f, 14.972883f), - CVector(956.10065f, -820.23291f, 14.981133f), - CVector(925.86914f, -820.19049f, 14.976553f), - CVector(897.69702f, -831.08734f, 14.962709f), - CVector(868.06586f, -835.99237f, 14.970685f), - CVector(836.93054f, -836.84387f, 14.965049f), - CVector(811.63586f, -853.7915f, 15.067576f), - CVector(811.46344f, -884.27368f, 12.247812f), - CVector(811.60651f, -914.70959f, 9.2393751f), - CVector(811.10425f, -945.16272f, 5.817255f), - CVector(816.54584f, -975.64587f, 4.998558f), - CVector(828.2951f, -1003.3685f, 5.0471172f), - CVector(852.28839f, -1021.5963f, 4.9371028f), - CVector(882.50067f, -1025.4459f, 5.14077f), - CVector(912.84821f, -1026.7874f, 8.3415451f), - CVector(943.68274f, -1026.6914f, 11.341879f), - CVector(974.4129f, -1027.3682f, 14.410345f), - CVector(1004.1079f, -1036.0778f, 14.92961f), - CVector(1030.1144f, -1051.1224f, 14.850387f), - CVector(1058.7585f, -1060.342f, 14.821624f), - CVector(1087.7797f, -1068.3263f, 14.800561f), - CVector(1099.8807f, -1095.656f, 11.877907f), - CVector(1130.0005f, -1101.994f, 11.853914f), - CVector(1160.3809f, -1101.6355f, 11.854824f), - CVector(1191.8524f, -1102.1577f, 11.853843f), - CVector(1223.3307f, -1102.7448f, 11.852233f), - CVector(1253.564f, -1098.1045f, 11.853944f), - CVector(1262.0203f, -1069.1785f, 14.8147f), - CVector(1290.9998f, -1059.1882f, 14.816016f), - CVector(1316.246f, -1041.0635f, 14.81109f), - CVector(1331.7539f, -1013.835f, 14.81207f), - CVector(1334.0579f, -983.55402f, 14.827253f), - CVector(1323.2429f, -954.23083f, 14.954678f), - CVector(1302.7495f, -932.21216f, 14.962917f), - CVector(1317.418f, -905.89325f, 14.967506f), - CVector(1337.9503f, -883.5025f, 14.969675f), - CVector(1352.6929f, -855.96954f, 14.967854f), - CVector(1357.2388f, -826.26971f, 14.97295f), - CVector(1384.8668f, -812.47693f, 12.907736f), - CVector(1410.8983f, -795.39056f, 12.052228f), - CVector(1433.901f, -775.55811f, 11.96265f), - CVector(1443.8615f, -746.92511f, 11.976114f), - CVector(1457.7015f, -720.00903f, 11.971177f), - CVector(1481.5685f, -701.30237f, 11.977908f), - CVector(1511.4004f, -696.83295f, 11.972709f), - CVector(1542.1796f, -695.61676f, 11.970441f), - CVector(1570.3301f, -684.6239f, 11.969202f), - CVector(0.0f, 0.0f, 0.0f), -}; - void CPacManPickups::GeneratePMPickUpsForRace(int32 race) { @@ -1387,119 +1309,56 @@ CPacManPickups::GeneratePMPickUpsForRace(int32 race) void CPacManPickups::GenerateOnePMPickUp(CVector pos) { - bPMActive = true; - aPMPickUps[0].m_eType = PACMAN_RACE; - aPMPickUps[0].m_vecPosn = pos; } void CPacManPickups::Render() { - if (!bPMActive) return; - - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE); - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[6])); - - RwV3d pos; - float w, h; - - for (int i = 0; i < NUMPACMANPICKUPS; i++) { - switch (aPMPickUps[i].m_eType) - { - case PACMAN_SCRAMBLE: - case PACMAN_RACE: - if (CSprite::CalcScreenCoors(aPMPickUps[i].m_vecPosn, &pos, &w, &h, true) && pos.z < 100.0f) { - if (aPMPickUps[i].m_pObject != nil) { - aPMPickUps[i].m_pObject->GetMatrix().SetRotateZOnly((CTimer::GetTimeInMilliseconds() % 1024) * TWOPI / 1024.0f); - aPMPickUps[i].m_pObject->GetMatrix().UpdateRW(); - aPMPickUps[i].m_pObject->UpdateRwFrame(); - } - float fsin = Sin((CTimer::GetTimeInMilliseconds() % 1024) * 6.28f / 1024.0f); // yes, it is 6.28f when it was TWOPI just now... - CSprite::RenderOneXLUSprite(pos.x, pos.y, pos.z, 0.8f * w * fsin, 0.8f * h, 100, 50, 5, 255, 1.0f / pos.z, 255); - } - break; - default: - break; - } - } - - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE); } void CPacManPickups::ClearPMPickUps() { - bPMActive = false; - - for (int i = 0; i < NUMPACMANPICKUPS; i++) { - if (aPMPickUps[i].m_pObject != nil) { - CWorld::Remove(aPMPickUps[i].m_pObject); - delete aPMPickUps[i].m_pObject; - aPMPickUps[i].m_pObject = nil; - } - aPMPickUps[i].m_eType = PACMAN_NONE; - } } void CPacManPickups::StartPacManRace(int32 race) { - GeneratePMPickUpsForRace(race); - PillsEatenInRace = 0; } void CPacManPickups::StartPacManRecord() { - CollectGameState = 20; - LastPickUpCoors = FindPlayerCoors(); } uint32 CPacManPickups::QueryPowerPillsEatenInRace() { - return PillsEatenInRace; + return 0; } void CPacManPickups::ResetPowerPillsEatenInRace() { - PillsEatenInRace = 0; } void CPacManPickups::CleanUpPacManStuff() { - ClearPMPickUps(); } void CPacManPickups::StartPacManScramble(CVector pos, float scrambleMult, int16 count) { - GeneratePMPickUps(pos, scrambleMult, count, PACMAN_SCRAMBLE); } uint32 CPacManPickups::QueryPowerPillsCarriedByPlayer() { - if (FindPlayerVehicle()) - return FindPlayerVehicle()->m_nPacManPickupsCarried; return 0; } void CPacManPickups::ResetPowerPillsCarriedByPlayer() { - if (FindPlayerVehicle() != nil) { - FindPlayerVehicle()->m_nPacManPickupsCarried = 0; - FindPlayerVehicle()->m_fMass /= FindPlayerVehicle()->m_fForceMultiplier; - FindPlayerVehicle()->m_fTurnMass /= FindPlayerVehicle()->m_fForceMultiplier; - FindPlayerVehicle()->m_fForceMultiplier = 1.0f; - } } diff --git a/src/control/Pickups.h b/src/control/Pickups.h index d7d22174..dd5e60c6 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -34,21 +34,23 @@ class CPickup { public: CVector m_vecPos; - uint32 m_nRevenue; + float m_fRevenue; CObject *m_pObject; CObject *m_pExtraObject; - uint16 m_nQuantity; + uint32 m_nQuantity; uint32 m_nTimer; - int16 m_nMoneySpeed; + uint16 m_nMoneySpeed; int16 m_eModelIndex; uint16 m_nIndex; char m_sTextKey[8]; ePickupType m_eType; bool m_bRemoved; - uint8 m_effects; + uint8 m_effects:1; + uint8 m_effects2:1; - CObject *GiveUsAPickUpObject(int32 handle); + CObject *GiveUsAPickUpObject(CObject **object, CObject **extraObject, int32 handle, int32 extraHandle); bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId); + void GetRidOfObjects(); private: bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; } inline bool CanBePickedUp(CPlayerPed *player, int playerId); @@ -111,8 +113,7 @@ public: static CVector StaticCamCoors; static uint32 StaticCamStartTime; -//TODO(MIAMI) - static void RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType) {} + static void RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType); }; extern uint16 AmmoForWeapon[20]; -- cgit v1.2.3 From 40434eadfdcf0bcacc7a604b3e3912d7a4a0d805 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 17 Oct 2020 12:31:14 +0300 Subject: small fix --- src/control/Darkel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index 13c49c99..e44cdda9 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -391,7 +391,7 @@ CDarkel::DealWithWeaponChangeAtEndOfFrenzy() CPlayerPed* player = FindPlayerPed(); if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) { - player->m_nSelectedWepSlot = InterruptedWeaponType; + player->m_nSelectedWepSlot = CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponSelected)->m_nWeaponSlot; player->GiveWeapon((eWeaponType)InterruptedWeaponType, AmmoInterruptedWeapon, true); } -- cgit v1.2.3 From 1f36b78c205202b605797e6e29ba045124066705 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 13:48:08 +0300 Subject: Pickup fixes --- src/control/Pickups.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 9215b57e..83b31f6b 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -628,7 +628,7 @@ CPickups::Update() #ifdef CAMERA_PICKUP if ( bPickUpcamActivated ) // taken from PS2 { - float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D(); + float dist = Distance2D(StaticCamCoors, FindPlayerCoors()); float mult; if ( dist < 10.0f ) mult = 1.0f - (dist / 10.0f ); @@ -644,8 +644,7 @@ CPickups::Update() TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT); } - if ( FindPlayerVehicle() != pPlayerVehicle - || (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f + if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f || ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) ) { TheCamera.RestoreWithJumpCut(); @@ -715,7 +714,7 @@ CPickups::DoPickUpEffects(CEntity *entity) CObject *object = (CObject*)entity; if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) { - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance2D(pos, TheCamera.GetPosition()); const float MAXDIST = 12.0f; if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) { @@ -746,7 +745,7 @@ void CPickups::DoMineEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance2D(pos, TheCamera.GetPosition()); const float MAXDIST = 20.0f; if (dist < MAXDIST) { @@ -765,7 +764,7 @@ void CPickups::DoMoneyEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance2D(pos, TheCamera.GetPosition()); const float MAXDIST = 20.0f; if (dist < MAXDIST) { @@ -784,7 +783,7 @@ void CPickups::DoCollectableEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance2D(pos, TheCamera.GetPosition()); const float MAXDIST = 14.0f; if (dist < MAXDIST) { -- cgit v1.2.3 From 516a02d2da990317fd59f5620487a289b373fe88 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 15:33:22 +0300 Subject: Fix pickup fix :P --- src/control/Pickups.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 83b31f6b..78084624 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -745,7 +745,7 @@ void CPickups::DoMineEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = Distance2D(pos, TheCamera.GetPosition()); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 20.0f; if (dist < MAXDIST) { @@ -764,7 +764,7 @@ void CPickups::DoMoneyEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = Distance2D(pos, TheCamera.GetPosition()); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 20.0f; if (dist < MAXDIST) { @@ -783,7 +783,7 @@ void CPickups::DoCollectableEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = Distance2D(pos, TheCamera.GetPosition()); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 14.0f; if (dist < MAXDIST) { -- cgit v1.2.3 From 63666391d4f63570fe354e695bc32d22d9418ef9 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 15:57:12 +0300 Subject: More Pickup stuff --- src/control/Pickups.cpp | 365 +++++++++++++++++++++++++++++------------------- src/control/Pickups.h | 4 +- 2 files changed, 228 insertions(+), 141 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 62f527ec..b770ab12 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -60,19 +60,57 @@ uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS] = { }; uint16 CostOfWeapon[20] = { 0, 10, 250, 800, 1500, 3000, 5000, 10000, 25000, 25000, 2000, 2000, 0, 50000, 0, 3000, 0, 0, 0, 0 }; -// TODO(Miami): Those are all placeholders!! -uint8 aWeaponReds[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 0, 128, 255, 255, 0, 255, 0, 128, 128, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 128, 0, 255, 0 }; -uint8 aWeaponGreens[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -0, 255, 0, 255, 0 }; -uint8 aWeaponBlues[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -0, 128, 255, 0, 0 }; +struct +{ + uint8 r,g,b; + float unk; +} aPickupColors[] = { + { 128, 128, 128, 1.0f }, + { 128, 128, 128, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 97, 194, 247, 1.0f }, + { 27, 89, 130, 1.0f }, + { 27, 89, 130, 1.0f }, + { 27, 89, 130, 1.0f }, + { 27, 89, 130, 1.0f }, + { 27, 89, 130, 1.0f }, + { 149, 194, 24, 1.0f }, + { 149, 194, 24, 1.0f }, + { 45, 155, 90, 1.0f }, + { 45, 155, 90, 1.0f }, + { 45, 155, 90, 1.0f }, + { 255, 227, 79, 1.0f }, + { 255, 227, 79, 1.0f }, + { 255, 227, 79, 1.0f }, + { 255, 227, 79, 1.0f }, + { 254, 137, 0, 1.0f }, + { 254, 137, 0, 1.0f }, + { 249, 131, 215, 1.0f }, + { 249, 131, 215, 1.0f }, + { 164, 40, 178, 1.0f }, + { 164, 40, 178, 1.0f }, + { 164, 40, 178, 1.0f }, + { 164, 40, 178, 1.0f }, + { 69, 69, 69, 1.0f }, + { 69, 69, 69, 1.0f }, + { 69, 69, 69, 1.0f }, + { 255, 100, 100, 1.0f }, + { 128, 255, 128, 1.0f }, + { 100, 100, 255, 1.0f }, + { 255, 255, 100, 1.0f }, + { 255, 100, 100, 1.0f }, + { 100, 255, 100, 1.0f }, + { 255, 255, 255, 1.0f } +}; + void ModifyStringLabelForControlSetting(char *str) @@ -394,7 +432,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) return true; case PICKUP_ASSET_REVENUE: CWorld::Players[CWorld::PlayerInFocus].m_nMoney += m_fRevenue; - m_fRevenue = 0; + m_fRevenue = 0.0f; DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0); return false; // TODO(Miami): Control flow @@ -866,9 +904,24 @@ CPickups::Update() } } +// --MIAMI: Done +CPickup* +CPickups::FindPickUpForThisObject(CEntity *object) +{ + for (uint32 i = 0; i < NUMPICKUPS; i++) { + if (aPickUps[i].m_eType != PICKUP_NONE && (aPickUps[i].m_pObject == object || aPickUps[i].m_pExtraObject == object)) { + return &aPickUps[i]; + } + } + return &aPickUps[0]; +} + +// --MIAMI: Done void CPickups::DoPickUpEffects(CEntity *entity) { + CPickup *pickup = FindPickUpForThisObject(entity); + if (entity->GetModelIndex() == MI_PICKUP_KILLFRENZY) entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame; @@ -886,7 +939,7 @@ CPickups::DoPickUpEffects(CEntity *entity) doInnerGlow = true; doOuterGlow = false; } else if (entity->GetModelIndex() == MI_PICKUP_BODYARMOUR) { - colorId = WEAPONTYPE_TOTALWEAPONS + 1; + colorId = WEAPONTYPE_ARMOUR; } else if (entity->GetModelIndex() == MI_PICKUP_BRIBE) { doInnerGlow = true; doOuterGlow = false; @@ -895,33 +948,92 @@ CPickups::DoPickUpEffects(CEntity *entity) doInnerGlow = true; doOuterGlow = false; } else if (entity->GetModelIndex() == MI_PICKUP_HEALTH || entity->GetModelIndex() == MI_PICKUP_BONUS) { - colorId = WEAPONTYPE_TOTALWEAPONS; + colorId = WEAPONTYPE_HEALTH; + doInnerGlow = true; + doOuterGlow = false; + } else if (entity->GetModelIndex() == MI_PICKUP_PROPERTY) { + doInnerGlow = true; + doOuterGlow = false; + } else if (entity->GetModelIndex() == MI_PICKUP_PROPERTY_FORSALE) { + doInnerGlow = true; + doOuterGlow = false; + } else if (entity->GetModelIndex() == MI_PICKUP_REVENUE) { doInnerGlow = true; doOuterGlow = false; + } else if (entity->GetModelIndex() == MI_PICKUP_SAVEGAME) { + doInnerGlow = true; + doOuterGlow = false; + } else if (entity->GetModelIndex() == MI_PICKUP_CLOTHES) { + colorId = WEAPONTYPE_TOTALWEAPONS; + doOuterGlow = false; + doInnerGlow = true; } else colorId = WeaponForModel(entity->GetModelIndex()); - const CVector& pos = entity->GetPosition(); + const CVector& pos = pickup->m_vecPos; if (doOuterGlow) { - float colorModifier = ((CGeneral::GetRandomNumber() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f; - CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, - aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier, 4.0f, - 1.0f, 40.0f, false, 0.0f); + bool corona1 = false; + bool corona2 = false; + int timerVal = (CTimer::GetTimeInMilliseconds() >> 9) & 7; + + if (timerVal < 3) + corona1 = false; + else if (timerVal == 3) + corona1 = (CGeneral::GetRandomNumber() & 3) != 0; + else + corona1 = true; + + timerVal = (timerVal - 1) & 7; + if (timerVal < 3) + corona2 = false; + else if (timerVal == 3) + corona2 = (CGeneral::GetRandomNumber() & 3) != 0; + else + corona2 = true; - float radius = (CGeneral::GetRandomNumber() & 0xF) * 0.1f + 3.0f; - CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true); - float size = (CGeneral::GetRandomNumber() & 0xF) * 0.0005f + 0.6f; - CCoronas::RegisterCorona((uintptr)entity, - aWeaponReds[colorId] * modifiedSin / 2.0f, aWeaponGreens[colorId] * modifiedSin / 2.0f, aWeaponBlues[colorId] * modifiedSin / 2.0f, - 255, - pos, - size, 65.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + if (((CObject*)entity)->obj_flag_02) { + corona2 = false; + corona1 = false; + } + + if (corona1) { + CCoronas::RegisterCorona((uintptr)entity, + aPickupColors[colorId].r * 0.45f, aPickupColors[colorId].g * 0.45f, aPickupColors[colorId].b * 0.45f, + 255, pos, 0.76f, 65.0f, + CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, + 0.0f, false, -0.4f); + CShadows::StoreStaticShadow((uintptr)entity, + SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, + aPickupColors[colorId].r * 0.3f, aPickupColors[colorId].g * 0.3f, aPickupColors[colorId].b * 0.3f, + 4.0f, 1.0f, 40.0f, false, 0.0f); + float radius = (CGeneral::GetRandomNumber() & 0xF) * 0.1f + 3.0f; + CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aPickupColors[colorId].r / 256.0f, aPickupColors[colorId].g / 256.0f, aPickupColors[colorId].b / 256.0f, CPointLights::FOG_NONE, true); + } else + CCoronas::RegisterCorona((uintptr)entity, 0, 0, 0, 255, pos, 0.57f, 65.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + + if (corona2) { + CCoronas::RegisterCorona( + (uintptr)entity + 1, + aPickupColors[colorId].r * 0.55f, aPickupColors[colorId].g * 0.55f, aPickupColors[colorId].b * 0.55f, + 255, + pos, + 0.6f, + 65.0f, + CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, + 0.0f, false, -0.4f); + if (!corona1) + CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, + aPickupColors[colorId].r * 0.25f, aPickupColors[colorId].g * 0.25f, aPickupColors[colorId].b * 0.25f, + 4.0f, 1.0f, 40.0f, false, 0.0f); + } else + CCoronas::RegisterCorona((uintptr)entity + 1, 0, 0, 0, 255, pos, 0.45f, 65.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); } CObject *object = (CObject*)entity; - if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) { - float dist = (TheCamera.GetPosition() - pos).Magnitude(); - const float MAXDIST = 12.0f; + if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue || object->m_nCostValue) { + + float dist = Distance2D(pos, TheCamera.GetPosition()); + const float MAXDIST = 14.0f; if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) { RwV3d vecOut; @@ -932,38 +1044,79 @@ CPickups::DoPickUpEffects(CEntity *entity) aMessages[NumMessages].m_dist.x = fDistX; aMessages[NumMessages].m_dist.y = fDistY; aMessages[NumMessages].m_weaponType = WeaponForModel(entity->GetModelIndex()); - aMessages[NumMessages].m_color.red = aWeaponReds[colorId]; - aMessages[NumMessages].m_color.green = aWeaponGreens[colorId]; - aMessages[NumMessages].m_color.blue = aWeaponBlues[colorId]; + aMessages[NumMessages].m_color.red = aPickupColors[colorId].r; + aMessages[NumMessages].m_color.green = aPickupColors[colorId].g; + aMessages[NumMessages].m_color.blue = aPickupColors[colorId].b; aMessages[NumMessages].m_color.alpha = (1.0f - dist / MAXDIST) * 128.0f; aMessages[NumMessages].m_bOutOfStock = object->bOutOfStock; aMessages[NumMessages].m_quantity = object->m_nBonusValue; + aMessages[NumMessages].money = object->m_nCostValue; NumMessages++; } } } uint32 model = entity->GetModelIndex(); - CColModel* colModel = entity->GetColModel(); + CColModel *colModel = entity->GetColModel(); CVector colLength = colModel->boundingBox.max - colModel->boundingBox.min; + float maxDimension = Max(colLength.x, Max(colLength.y, colLength.z)); - float scale = (Max(1.f, 1.2f / Max(colLength.x, Max(colLength.y, colLength.z))) - 1.0f) * 0.6f + 1.0f; + float scale = (Max(1.f, 1.2f / maxDimension) - 1.0f) * 0.6f + 1.0f; if (model == MI_MINIGUN || model == MI_MINIGUN2) scale = 1.2f; entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), scale); + if (entity->GetModelIndex() == MI_MINIGUN2) { + CMatrix matrix1; + CMatrix matrix2; // unused + entity->SetPosition(pickup->m_vecPos); + matrix1.SetRotateX(0.0f); + matrix1.Rotate(DEGTORAD(4.477f), DEGTORAD(-29.731), DEGTORAD(-1.064)); + matrix1.Translate(CVector(0.829, -0.001, 0.226)); + entity->GetMatrix() *= matrix1; + } + + if (doOuterGlow) { + CVector scale(0.0f, 0.0f, 0.0f); + if (colLength.x == maxDimension) + scale.x = colLength.x; + else if (colLength.y == maxDimension) + scale.y = colLength.y; + else + scale.z = colLength.z; + + for (int i = 0; i < 4; i++) { + CVector pos = entity->GetMatrix() * (scale * ((float)i / 3.0f)); + CCoronas::RegisterCorona( + (uintptr)entity + 8 + i, + aPickupColors[colorId].r * 0.15f, + aPickupColors[colorId].g * 0.15f, + aPickupColors[colorId].b * 0.15f, + 255, + pos, + 1.0f, + 65.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, + CCoronas::REFLECTION_OFF, + CCoronas::LOSCHECK_OFF, + CCoronas::STREAK_OFF, + 0.0f); + } + } + if (doInnerGlow) - CCoronas::RegisterCorona((uintptr)entity + 1, 126, 69, 121, 255, entity->GetPosition(), 1.2f, 50.0f, - CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.f, false); + CCoronas::RegisterCorona((uintptr)entity + 8, 126, 69, 121, 255, entity->GetPosition(), 1.2f, 50.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.f); } } +// --MIAMI: Done void CPickups::DoMineEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 20.0f; if (dist < MAXDIST) { @@ -978,11 +1131,12 @@ CPickups::DoMineEffects(CEntity *entity) entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0x3FF) * DEGTORAD(360.0f / 0x400)); } +// --MIAMI: Done void CPickups::DoMoneyEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 20.0f; if (dist < MAXDIST) { @@ -997,11 +1151,12 @@ CPickups::DoMoneyEffects(CEntity *entity) entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800)); } +// --MIAMI: Done void CPickups::DoCollectableEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 14.0f; if (dist < MAXDIST) { @@ -1016,18 +1171,22 @@ CPickups::DoCollectableEffects(CEntity *entity) entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0xFFF) * DEGTORAD(360.0f / 0x1000)); } +// --MIAMI: Done void CPickups::RenderPickUpText() { wchar *strToPrint; for (int32 i = 0; i < NumMessages; i++) { - if (aMessages[i].m_quantity <= 39) { + + if (aMessages[i].money != 0) { + sprintf(gString, "$%d", aMessages[i].money); + AsciiToUnicode(gString, gUString); + strToPrint = gUString; + } else { switch (aMessages[i].m_quantity) // could use some enum maybe { case 0: - if (aMessages[i].m_weaponType == WEAPONTYPE_TOTALWEAPONS) { // unreachable code? - // what is this?? - sprintf(gString, "%d/%d", CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages, 2903); + if (aMessages[i].m_weaponType == WEAPONTYPE_HEALTH || aMessages[i].m_weaponType == WEAPONTYPE_ARMOUR) { strToPrint = nil; } else { if (aMessages[i].m_bOutOfStock) @@ -1040,121 +1199,43 @@ CPickups::RenderPickUpText() } break; case 1: - strToPrint = TheText.Get("SECURI"); + strToPrint = TheText.Get("OUTFT1"); break; case 2: - strToPrint = TheText.Get("MOONBM"); + strToPrint = TheText.Get("OUTFT2"); break; case 3: - strToPrint = TheText.Get("COACH"); + strToPrint = TheText.Get("OUTFT3"); break; case 4: - strToPrint = TheText.Get("FLATBED"); + strToPrint = TheText.Get("OUTFT4"); break; case 5: - strToPrint = TheText.Get("LINERUN"); + strToPrint = TheText.Get("OUTFT5"); break; case 6: - strToPrint = TheText.Get("TRASHM"); + strToPrint = TheText.Get("OUTFT6"); break; case 7: - strToPrint = TheText.Get("PATRIOT"); + strToPrint = TheText.Get("OUTFT7"); break; case 8: - strToPrint = TheText.Get("WHOOPEE"); + strToPrint = TheText.Get("OUTFT8"); break; case 9: - strToPrint = TheText.Get("BLISTA"); + strToPrint = TheText.Get("OUTFT9"); break; case 10: - strToPrint = TheText.Get("MULE"); + strToPrint = TheText.Get("OUTFT10"); break; case 11: - strToPrint = TheText.Get("YANKEE"); + strToPrint = TheText.Get("OUTFT11"); break; case 12: - strToPrint = TheText.Get("BOBCAT"); + strToPrint = TheText.Get("OUTFT12"); break; case 13: - strToPrint = TheText.Get("DODO"); - break; - case 14: - strToPrint = TheText.Get("BUS"); - break; - case 15: - strToPrint = TheText.Get("RUMPO"); - break; - case 16: - strToPrint = TheText.Get("PONY"); - break; - case 17: - strToPrint = TheText.Get("SENTINL"); - break; - case 18: - strToPrint = TheText.Get("CHEETAH"); - break; - case 19: - strToPrint = TheText.Get("BANSHEE"); - break; - case 20: - strToPrint = TheText.Get("IDAHO"); - break; - case 21: - strToPrint = TheText.Get("INFERNS"); - break; - case 22: - strToPrint = TheText.Get("TAXI"); - break; - case 23: - strToPrint = TheText.Get("KURUMA"); - break; - case 24: - strToPrint = TheText.Get("STRETCH"); - break; - case 25: - strToPrint = TheText.Get("PEREN"); - break; - case 26: - strToPrint = TheText.Get("STINGER"); - break; - case 27: - strToPrint = TheText.Get("MANANA"); - break; - case 28: - strToPrint = TheText.Get("LANDSTK"); - break; - case 29: - strToPrint = TheText.Get("STALION"); - break; - case 30: - strToPrint = TheText.Get("BFINJC"); - break; - case 31: - strToPrint = TheText.Get("CABBIE"); - break; - case 32: - strToPrint = TheText.Get("ESPERAN"); - break; - case 33: - strToPrint = TheText.Get("FIRETRK"); - break; - case 34: - strToPrint = TheText.Get("AMBULAN"); - break; - case 35: - strToPrint = TheText.Get("ENFORCR"); - break; - case 36: - strToPrint = TheText.Get("FBICAR"); - break; - case 37: - strToPrint = TheText.Get("RHINO"); - break; - case 38: - strToPrint = TheText.Get("BARRCKS"); - break; - case 39: - strToPrint = TheText.Get("POLICAR"); + strToPrint = TheText.Get("OUTFT13"); break; default: break; @@ -1165,12 +1246,16 @@ CPickups::RenderPickUpText() CFont::SetPropOn(); CFont::SetBackgroundOff(); - const float MAX_SCALE = 1.0f; +#ifdef FIX_BUGS + const float MAX_SCALE = SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH; +#else + const float MAX_SCALE = RsGlobal.width / DEFAULT_SCREEN_WIDTH; +#endif - float fScaleY = aMessages[i].m_dist.y / 100.0f; + float fScaleY = aMessages[i].m_dist.y / 30.0f; if (fScaleY > MAX_SCALE) fScaleY = MAX_SCALE; - float fScaleX = aMessages[i].m_dist.x / 100.0f; + float fScaleX = aMessages[i].m_dist.x / 30.0f; if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE; CFont::SetScale(fScaleX, fScaleY); diff --git a/src/control/Pickups.h b/src/control/Pickups.h index dd5e60c6..9fa90549 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -66,8 +66,9 @@ struct tPickupMessage eWeaponType m_weaponType; CVector2D m_dist; CRGBA m_color; - uint8 m_bOutOfStock : 1; + uint8 m_bOutOfStock; uint8 m_quantity; + uint16 money; }; class CPickups @@ -114,6 +115,7 @@ public: static uint32 StaticCamStartTime; static void RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType); + static CPickup *FindPickUpForThisObject(CEntity*); }; extern uint16 AmmoForWeapon[20]; -- cgit v1.2.3 From 7f3b51dd17977b42d6ab0bc723824dc109eb024f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 16:04:11 +0300 Subject: Small inner fix --- src/control/Pickups.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index b770ab12..71d7401e 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1106,8 +1106,14 @@ CPickups::DoPickUpEffects(CEntity *entity) } if (doInnerGlow) - CCoronas::RegisterCorona((uintptr)entity + 8, 126, 69, 121, 255, entity->GetPosition(), 1.2f, 50.0f, - CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.f); + CCoronas::RegisterCorona( +#ifdef FIX_BUGS + (uintptr)entity + 8 + 4, +#else + (uintptr)entity + 9, +#endif + 126, 69, 121, 255, entity->GetPosition(), 1.2f, 50.0f, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f); } } -- cgit v1.2.3 From 7fc70179edb58702725aa2bab31185da66b2b31d Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 17:06:38 +0300 Subject: Pickup save/load --- src/control/Pickups.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 71d7401e..90641960 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1320,6 +1320,7 @@ CPickups::RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType weaponType } } +// --MIAMI: Done void CPickups::Load(uint8 *buf, uint32 size) { @@ -1328,8 +1329,13 @@ INITSAVEBUF for (int32 i = 0; i < NUMPICKUPS; i++) { aPickUps[i] = ReadSaveBuf(buf); - if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].m_pObject != nil) - aPickUps[i].m_pObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pObject - 1); + if (aPickUps[i].m_eType != PICKUP_NONE) { + if (aPickUps[i].m_pObject != nil) + aPickUps[i].m_pObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pObject - 1); + if (aPickUps[i].m_pExtraObject != nil) + aPickUps[i].m_pExtraObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pExtraObject - 1); + } + } CollectedPickUpIndex = ReadSaveBuf(buf); @@ -1342,17 +1348,23 @@ INITSAVEBUF VALIDATESAVEBUF(size) } +// --MIAMI: Done void CPickups::Save(uint8 *buf, uint32 *size) { - *size = sizeof(aPickUps) + sizeof(uint16) + sizeof(uint16) + sizeof(aPickUpsCollected); + *size = sizeof(aPickUps); + *size += sizeof(uint16) + sizeof(uint16) + sizeof(aPickUpsCollected); INITSAVEBUF for (int32 i = 0; i < NUMPICKUPS; i++) { CPickup *buf_pickup = WriteSaveBuf(buf, aPickUps[i]); - if (buf_pickup->m_eType != PICKUP_NONE && buf_pickup->m_pObject != nil) - buf_pickup->m_pObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex(buf_pickup->m_pObject) + 1); + if (buf_pickup->m_eType != PICKUP_NONE) { + if (buf_pickup->m_pObject != nil) + buf_pickup->m_pObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex(buf_pickup->m_pObject) + 1); + if (buf_pickup->m_pExtraObject != nil) + buf_pickup->m_pExtraObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex(buf_pickup->m_pExtraObject) + 1); + } } WriteSaveBuf(buf, CollectedPickUpIndex); -- cgit v1.2.3 From b98864d134b747c8f594c9194918b93040f88c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Wed, 14 Oct 2020 18:07:05 +0300 Subject: Radar, WaterCannon, win/glfw skels --- src/control/Script.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.h b/src/control/Script.h index c7218847..c63025b2 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -288,8 +288,8 @@ class CTheScripts static uint16 ScriptsUpdated; static uint32 LastMissionPassedTime; static uint16 NumberOfExclusiveMissionScripts; - static bool bPlayerIsInTheStatium; public: + static bool bPlayerIsInTheStatium; static uint8 RiotIntensity; static bool bPlayerHasMetDebbieHarry; public: @@ -562,4 +562,4 @@ void RetryMission(int, int); #ifdef USE_DEBUG_SCRIPT_LOADER extern int scriptToLoad; -#endif \ No newline at end of file +#endif -- cgit v1.2.3 From e465cea07b791cf5fa76d5416cfd33dabaf3702f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 17:53:27 +0300 Subject: Pickup arrays done --- src/control/Pickups.cpp | 30 +++++++++++++++++++++--------- src/control/Pickups.h | 6 +++--- 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'src/control') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 90641960..720b77f6 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -49,16 +49,18 @@ uint32 CPickups::StaticCamStartTime; tPickupMessage CPickups::aMessages[NUMPICKUPMESSAGES]; -// TODO(Miami) -uint16 AmmoForWeapon[20] = { 0, 1, 45, 125, 25, 150, 300, 25, 5, 250, 5, 5, 0, 500, 0, 100, 0, 0, 0, 0 }; +// --MIAMI: Done +uint16 AmmoForWeapon[WEAPONTYPE_TOTALWEAPONS + 1] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, 8, 68, 24, + 32, 28, 20, 200, 120, 120, 120, 120, 120, 40, 28, 8, 300, 200, 1000, 1, 400, 36, 0 }; // --MIAMI: Done -uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS] = { - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 34, - 12, 16, 14, 10, 100, 60, 60, 60, 60, 60, 20, 14, - 4, 150, 100, 500, 1, 400, 36, 0, -}; -uint16 CostOfWeapon[20] = { 0, 10, 250, 800, 1500, 3000, 5000, 10000, 25000, 25000, 2000, 2000, 0, 50000, 0, 3000, 0, 0, 0, 0 }; +uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS + 1] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 34, 12, + 16, 14, 10, 100, 60, 60, 60, 60, 60, 20, 14, 4, 150, 100, 500, 1, 400, 36, 0 }; + +// --MIAMI: Done +uint16 CostOfWeapon[WEAPONTYPE_TOTALWEAPONS + 3] = { 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1000, 1000, + 1000, 500, 8000, 250, 400, 1200, 1250, 1250, 800, 800, 650, 1200, 5000, 400, + 10000, 10000, 8000, 8000, 8000, 10000, 1000, 11000, 500, 20, 10, 0 }; struct { @@ -704,7 +706,7 @@ CPickups::RemoveAllFloatingPickups() void CPickups::RemovePickUp(int32 pickupIndex) { - int32 index = CPickups::GetActualPickupIndex(pickupIndex); + int32 index = GetActualPickupIndex(pickupIndex); if (index == -1) return; if (aPickUps[index].m_pObject) { @@ -1404,6 +1406,16 @@ CPacManPickups::GeneratePMPickUps(CVector pos, float scrambleMult, int16 count, { } +// diablo porn mission pickups +static const CVector aRacePoints1[] = { + CVector(913.62219f, -155.13692f, 4.9699469f), + CVector(913.92401f, -124.12943f, 4.9692569f), + CVector(913.27899f, -93.524231f, 7.4325991f), + CVector(912.60852f, -63.15905f, 7.4533591f), + CVector(934.22144f, -42.049122f, 7.4511471f), + CVector(0.0f, 0.0f, 0.0f), +}; + void CPacManPickups::GeneratePMPickUpsForRace(int32 race) { diff --git a/src/control/Pickups.h b/src/control/Pickups.h index 9fa90549..6c3045f7 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -118,9 +118,9 @@ public: static CPickup *FindPickUpForThisObject(CEntity*); }; -extern uint16 AmmoForWeapon[20]; -extern uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS]; -extern uint16 CostOfWeapon[20]; +extern uint16 AmmoForWeapon[WEAPONTYPE_TOTALWEAPONS + 1]; +extern uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS + 1]; +extern uint16 CostOfWeapon[WEAPONTYPE_TOTALWEAPONS + 3]; enum ePacmanPickupType { -- cgit v1.2.3 From 82f54b946fa37f9c92be2a2f2883f8f37655f3ed Mon Sep 17 00:00:00 2001 From: shfil Date: Sun, 18 Oct 2020 00:54:27 +0200 Subject: Script.cpp missing breaks --- src/control/Script.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 650e11a7..5dceacb7 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2002,9 +2002,11 @@ void CTheScripts::Process() case 4: AllowMissionReplay = 5; RetryMission(0, 0); + break; case 6: AllowMissionReplay = 7; TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500; + break; case 7: if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) { AllowMissionReplay = 0; -- cgit v1.2.3 From cafe4e38db66eee633eb964477f65900a1d29fd0 Mon Sep 17 00:00:00 2001 From: shfil Date: Sun, 18 Oct 2020 00:54:27 +0200 Subject: Script.cpp missing breaks --- src/control/Script.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 01a4405d..1cef2a46 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2381,9 +2381,11 @@ void CTheScripts::Process() case 4: AllowMissionReplay = 5; RetryMission(0, 0); + break; case 6: AllowMissionReplay = 7; TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500; + break; case 7: if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) { AllowMissionReplay = 0; -- cgit v1.2.3 From b91f6a45501634b55f6ef2c08d57c5293d5fd3a0 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 18 Oct 2020 16:40:06 +0300 Subject: Setter for bIsStatic (became virtual in SA) --- src/control/RoadBlocks.cpp | 2 +- src/control/Script.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/control') diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 86b4caf1..1496b307 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -165,7 +165,7 @@ CRoadBlocks::GenerateRoadBlocks(void) vehicleMatrix.GetPosition().z += fModelRadius - 0.6f; pVehicle->m_matrix = vehicleMatrix; pVehicle->PlaceOnRoadProperly(); - pVehicle->bIsStatic = false; + pVehicle->SetIsStatic(false); pVehicle->m_matrix.UpdateRW(); pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; CCarCtrl::JoinCarWithRoadSystem(pVehicle); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 5dceacb7..efd17f25 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -3577,7 +3577,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); - car->bIsStatic = false; + car->SetIsStatic(false); /* Again weird usage of virtual functions. */ if (car->IsBoat()) { car->Teleport(pos); @@ -9184,14 +9184,14 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); script_assert(pObject); if (ScriptParams[1]) { - if (pObject->bIsStatic) { - pObject->bIsStatic = false; + if (pObject->GetIsStatic()) { + pObject->SetIsStatic(false); pObject->AddToMovingList(); } } else { - if (!pObject->bIsStatic) { - pObject->bIsStatic = true; + if (!pObject->GetIsStatic()) { + pObject->SetIsStatic(true); pObject->RemoveFromMovingList(); } } -- cgit v1.2.3 From cc0ae516319a028cd1ef1b317a26d58ef17ee6d0 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 18 Oct 2020 16:55:11 +0300 Subject: lil fix --- src/control/Script.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index efd17f25..50e89ecc 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -9184,13 +9184,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); script_assert(pObject); if (ScriptParams[1]) { - if (pObject->GetIsStatic()) { + if (pObject->bIsStatic) { pObject->SetIsStatic(false); pObject->AddToMovingList(); } } else { - if (!pObject->GetIsStatic()) { + if (!pObject->bIsStatic) { pObject->SetIsStatic(true); pObject->RemoveFromMovingList(); } -- cgit v1.2.3 From 6173e1dd10745a4e0970a7c0de7b58f9502bd7ca Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 18 Oct 2020 22:52:49 +0300 Subject: fix --- src/control/PathFind.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index 14aead04..5d381f66 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1412,7 +1412,7 @@ CPathFind::FindNodeCoorsForScript(int32 id) dir.Normalise(); if (dir.x < 0) dir = -dir; - return m_pathNodes[id].GetPosition() + CVector(-dir.x, dir.y, 0.0f) * (LANE_WIDTH / 2 + m_pathNodes[id].GetDividerWidth()); + return m_pathNodes[id].GetPosition() + CVector(-dir.y, dir.z, 0.0f) * (LANE_WIDTH / 2 + m_pathNodes[id].GetDividerWidth()); } float -- cgit v1.2.3 From a1112183def338654b5b7d1114ae3e201d7a72eb Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 18 Oct 2020 22:53:25 +0300 Subject: fix --- src/control/PathFind.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control') diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index 5d381f66..41dc735f 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1412,7 +1412,7 @@ CPathFind::FindNodeCoorsForScript(int32 id) dir.Normalise(); if (dir.x < 0) dir = -dir; - return m_pathNodes[id].GetPosition() + CVector(-dir.y, dir.z, 0.0f) * (LANE_WIDTH / 2 + m_pathNodes[id].GetDividerWidth()); + return m_pathNodes[id].GetPosition() + CVector(-dir.y, dir.x, 0.0f) * (LANE_WIDTH / 2 + m_pathNodes[id].GetDividerWidth()); } float -- cgit v1.2.3 From 0750f040190b5f1cd4cc97841dd74da90db184c4 Mon Sep 17 00:00:00 2001 From: erorcun Date: Tue, 20 Oct 2020 22:19:05 +0300 Subject: Messages, fix Font --- src/control/Script.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 0df6d5a2..8b046bf2 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -4126,6 +4126,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]); return 0; } + /* case COMMAND_PRINT_SOON: { wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); @@ -4133,6 +4134,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CMessages::AddMessageSoon(key, ScriptParams[0], ScriptParams[1]); return 0; } + */ case COMMAND_CLEAR_PRINTS: CMessages::ClearMessages(); return 0; -- cgit v1.2.3 From ca497e2cbdb1130a402a84b3a4e632c26af751df Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 23 Oct 2020 16:56:34 +0300 Subject: ScriptSounds --- src/control/Script.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src/control') diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 8b046bf2..86c9e86e 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1817,7 +1817,7 @@ void CMissionCleanup::Process() CStreaming::SetMissionDoesntRequireModel(MI_CUTOBJ01 + i); CStreaming::ms_disableStreaming = false; CHud::m_ItemToFlash = -1; - CHud::SetHelpMessage(nil, false); // TODO(MIAMI): third parameter is false + CHud::SetHelpMessage(nil, false); CUserDisplay::OnscnTimer.m_bDisabled = false; CTheScripts::RemoveScriptTextureDictionary(); CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByCops = false; @@ -5387,22 +5387,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_ADD_ONE_OFF_SOUND: { CollectParameters(&m_nIp, 4); - // TODO(MIAMI) - // SOUND_PART_MISSION_COMPLETE == 1 - // SOUND_RACE_START_3 == 7 - // SOUND_RACE_START_2 == 8 - // SOUND_RACE_START_1 == 9 - // SOUND_RACE_START_GO == 10 - // SOUND_AMMUNATION_BUY_WEAPON == 13 - // SOUND_AMMUNATION_BUY_WEAPON_DENIED == 14 - // SOUND_AMMUNATION_IMRAN_ARM_BOMB == 16 switch (ScriptParams[3]) { - case SCRIPT_SOUND_EVIDENCE_PICKUP: - DMAudio.PlayFrontEndSound(SOUND_EVIDENCE_PICKUP, 0); - return 0; - case SCRIPT_SOUND_UNLOAD_GOLD: - DMAudio.PlayFrontEndSound(SOUND_UNLOAD_GOLD, 0); - return 0; case SCRIPT_SOUND_PART_MISSION_COMPLETE: DMAudio.PlayFrontEndSound(SOUND_PART_MISSION_COMPLETE, 0); return 0; @@ -5418,6 +5403,15 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case SCRIPT_SOUND_RACE_START_GO: DMAudio.PlayFrontEndSound(SOUND_RACE_START_GO, 0); return 0; + case SCRIPT_SOUND_AMMUNATION_BUY_WEAPON: + DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON_BOUGHT, 0); + return 0; + case SCRIPT_SOUND_AMMUNATION_BUY_WEAPON_DENIED: + DMAudio.PlayFrontEndSound(SOUND_GARAGE_NO_MONEY, 0); + return 0; + case SCRIPT_SOUND_IMRAN_ARM_BOMB: + DMAudio.PlayFrontEndSound(SOUND_AMMUNATION_IMRAN_ARM_BOMB, 0); + return 0; default: break; } @@ -8763,11 +8757,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) } case COMMAND_INDUSTRIAL_PASSED: CStats::IndustrialPassed = true; - DMAudio.PlayRadioAnnouncement(13); //TODO: enum? + DMAudio.PlayRadioAnnouncement(STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN); return 0; case COMMAND_COMMERCIAL_PASSED: CStats::CommercialPassed = true; - DMAudio.PlayRadioAnnouncement(14); //TODO: enum? + DMAudio.PlayRadioAnnouncement(STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN); return 0; case COMMAND_SUBURBAN_PASSED: CStats::SuburbanPassed = true; @@ -12909,7 +12903,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_PRINT_HELP_FOREVER: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); - CHud::SetHelpMessage(text, false); // TODO(MIAMI): third param is true + CHud::SetHelpMessage(text, false, true); return 0; } //case COMMAND_PRINT_HELP_FOREVER_WITH_NUMBER: -- cgit v1.2.3