mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-27 11:34:14 +01:00
commit
1e11c1eac6
@ -6,7 +6,8 @@
|
|||||||
#include "Curves.h"
|
#include "Curves.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
|
||||||
//--MIAMI: done
|
//--MIAMI: file done
|
||||||
|
|
||||||
void CAutoPilot::ModifySpeed(float speed)
|
void CAutoPilot::ModifySpeed(float speed)
|
||||||
{
|
{
|
||||||
m_fMaxTrafficSpeed = Max(0.01f, speed);
|
m_fMaxTrafficSpeed = Max(0.01f, speed);
|
||||||
@ -40,7 +41,6 @@ void CAutoPilot::ModifySpeed(float speed)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void CAutoPilot::RemoveOnePathNode()
|
void CAutoPilot::RemoveOnePathNode()
|
||||||
{
|
{
|
||||||
--m_nPathFindNodesCount;
|
--m_nPathFindNodesCount;
|
||||||
@ -49,7 +49,6 @@ void CAutoPilot::RemoveOnePathNode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
//--MIAMI: TODO
|
|
||||||
void CAutoPilot::Save(uint8*& buf)
|
void CAutoPilot::Save(uint8*& buf)
|
||||||
{
|
{
|
||||||
WriteSaveBuf<int32>(buf, m_nCurrentRouteNode);
|
WriteSaveBuf<int32>(buf, m_nCurrentRouteNode);
|
||||||
@ -73,6 +72,9 @@ void CAutoPilot::Save(uint8*& buf)
|
|||||||
WriteSaveBuf<uint32>(buf, m_nTimeTempAction);
|
WriteSaveBuf<uint32>(buf, m_nTimeTempAction);
|
||||||
WriteSaveBuf<float>(buf, m_fMaxTrafficSpeed);
|
WriteSaveBuf<float>(buf, m_fMaxTrafficSpeed);
|
||||||
WriteSaveBuf<uint8>(buf, m_nCruiseSpeed);
|
WriteSaveBuf<uint8>(buf, m_nCruiseSpeed);
|
||||||
|
WriteSaveBuf<uint8>(buf, m_nCruiseSpeedMultiplierType);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
WriteSaveBuf<float>(buf, m_fCruiseSpeedMultiplier);
|
||||||
uint8 flags = 0;
|
uint8 flags = 0;
|
||||||
if (m_bSlowedDownBecauseOfCars) flags |= BIT(0);
|
if (m_bSlowedDownBecauseOfCars) flags |= BIT(0);
|
||||||
if (m_bSlowedDownBecauseOfPeds) flags |= BIT(1);
|
if (m_bSlowedDownBecauseOfPeds) flags |= BIT(1);
|
||||||
@ -80,6 +82,7 @@ void CAutoPilot::Save(uint8*& buf)
|
|||||||
if (m_bStayInFastLane) flags |= BIT(3);
|
if (m_bStayInFastLane) flags |= BIT(3);
|
||||||
if (m_bIgnorePathfinding) flags |= BIT(4);
|
if (m_bIgnorePathfinding) flags |= BIT(4);
|
||||||
WriteSaveBuf<uint8>(buf, flags);
|
WriteSaveBuf<uint8>(buf, flags);
|
||||||
|
WriteSaveBuf<uint8>(buf, m_nSwitchDistance);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.x);
|
WriteSaveBuf<float>(buf, m_vecDestinationCoors.x);
|
||||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.y);
|
WriteSaveBuf<float>(buf, m_vecDestinationCoors.y);
|
||||||
@ -89,7 +92,6 @@ void CAutoPilot::Save(uint8*& buf)
|
|||||||
SkipSaveBuf(buf, 6);
|
SkipSaveBuf(buf, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: TODO
|
|
||||||
void CAutoPilot::Load(uint8*& buf)
|
void CAutoPilot::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
|
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
|
||||||
@ -113,12 +115,16 @@ void CAutoPilot::Load(uint8*& buf)
|
|||||||
m_nTimeTempAction = ReadSaveBuf<uint32>(buf);
|
m_nTimeTempAction = ReadSaveBuf<uint32>(buf);
|
||||||
m_fMaxTrafficSpeed = ReadSaveBuf<float>(buf);
|
m_fMaxTrafficSpeed = ReadSaveBuf<float>(buf);
|
||||||
m_nCruiseSpeed = ReadSaveBuf<uint8>(buf);
|
m_nCruiseSpeed = ReadSaveBuf<uint8>(buf);
|
||||||
|
m_nCruiseSpeedMultiplierType = ReadSaveBuf<uint8>(buf);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
m_fCruiseSpeedMultiplier = ReadSaveBuf<float>(buf);
|
||||||
uint8 flags = ReadSaveBuf<uint8>(buf);
|
uint8 flags = ReadSaveBuf<uint8>(buf);
|
||||||
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
||||||
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
||||||
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
||||||
m_bStayInFastLane = !!(flags & BIT(3));
|
m_bStayInFastLane = !!(flags & BIT(3));
|
||||||
m_bIgnorePathfinding = !!(flags & BIT(4));
|
m_bIgnorePathfinding = !!(flags & BIT(4));
|
||||||
|
m_nSwitchDistance = ReadSaveBuf<uint8>(buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_vecDestinationCoors.x = ReadSaveBuf<float>(buf);
|
m_vecDestinationCoors.x = ReadSaveBuf<float>(buf);
|
||||||
m_vecDestinationCoors.y = ReadSaveBuf<float>(buf);
|
m_vecDestinationCoors.y = ReadSaveBuf<float>(buf);
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
CEntity *CBridge::pLiftRoad;
|
CEntity *CBridge::pLiftRoad;
|
||||||
CEntity *CBridge::pLiftPart;
|
CEntity *CBridge::pLiftPart;
|
||||||
CEntity *CBridge::pWeight;
|
CEntity *CBridge::pWeight;
|
||||||
|
@ -292,7 +292,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||||||
break;
|
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,
|
preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId,
|
||||||
&positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1))
|
&positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1))
|
||||||
return;
|
return;
|
||||||
@ -3228,7 +3228,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
|
|||||||
int curNode, nextNode;
|
int curNode, nextNode;
|
||||||
float posBetweenNodes;
|
float posBetweenNodes;
|
||||||
while (!created && attempts < 5){
|
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)){
|
120.0f, -1.0f, true, &spawnPos, &curNode, &nextNode, &posBetweenNodes, false)){
|
||||||
int16 colliding[2];
|
int16 colliding[2];
|
||||||
if (!ThePaths.GetNode(curNode)->bWaterPath) {
|
if (!ThePaths.GetNode(curNode)->bWaterPath) {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
#include "Population.h"
|
#include "Population.h"
|
||||||
|
#include "Replay.h"
|
||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
@ -14,9 +15,8 @@
|
|||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "GameLogic.h"
|
#include "GameLogic.h"
|
||||||
#ifdef FIX_BUGS
|
|
||||||
#include "Replay.h"
|
//--MIAMI: file done except TODO
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FRENZY_ANY_PED -1
|
#define FRENZY_ANY_PED -1
|
||||||
#define FRENZY_ANY_CAR -2
|
#define FRENZY_ANY_CAR -2
|
||||||
@ -27,7 +27,8 @@ int32 CDarkel::TimeOfFrenzyStart;
|
|||||||
int32 CDarkel::WeaponType;
|
int32 CDarkel::WeaponType;
|
||||||
int32 CDarkel::AmmoInterruptedWeapon;
|
int32 CDarkel::AmmoInterruptedWeapon;
|
||||||
int32 CDarkel::KillsNeeded;
|
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.
|
* TODO: Collect timer/kill counter RGBA colors on top like in Hud/Frontend.
|
||||||
@ -61,14 +62,12 @@ CDarkel::CalcFade(uint32 time, uint32 start, uint32 end)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Screen positions taken from VC
|
|
||||||
void
|
void
|
||||||
CDarkel::DrawMessages()
|
CDarkel::DrawMessages()
|
||||||
{
|
{
|
||||||
#ifdef FIX_BUGS
|
|
||||||
if (CReplay::IsPlayingBack())
|
if (CReplay::IsPlayingBack())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
switch (Status) {
|
switch (Status) {
|
||||||
case KILLFRENZY_ONGOING:
|
case KILLFRENZY_ONGOING:
|
||||||
{
|
{
|
||||||
@ -77,8 +76,8 @@ CDarkel::DrawMessages()
|
|||||||
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(30.0f));
|
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(30.0f));
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
|
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
|
||||||
if (CDarkel::bStandardSoundAndMessages) {
|
if (bStandardSoundAndMessages) {
|
||||||
if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
|
if (timePassedSinceStart >= 3000 && timePassedSinceStart < 11000) {
|
||||||
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
|
CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f));
|
||||||
CFont::SetJustifyOff();
|
CFont::SetJustifyOff();
|
||||||
@ -103,8 +102,8 @@ CDarkel::DrawMessages()
|
|||||||
CFont::SetCentreOff();
|
CFont::SetCentreOff();
|
||||||
CFont::SetRightJustifyOn();
|
CFont::SetRightJustifyOn();
|
||||||
CFont::SetFontStyle(FONT_HEADING);
|
CFont::SetFontStyle(FONT_HEADING);
|
||||||
if (CDarkel::TimeLimit >= 0) {
|
if (TimeLimit >= 0) {
|
||||||
uint32 timeLeft = CDarkel::TimeLimit - (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart);
|
uint32 timeLeft = TimeLimit - (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart);
|
||||||
sprintf(gString, "%d:%02d", timeLeft / 60000, timeLeft % 60000 / 1000);
|
sprintf(gString, "%d:%02d", timeLeft / 60000, timeLeft % 60000 / 1000);
|
||||||
AsciiToUnicode(gString, gUString);
|
AsciiToUnicode(gString, gUString);
|
||||||
if (timeLeft > 4000 || CTimer::GetFrameCounter() & 1) {
|
if (timeLeft > 4000 || CTimer::GetFrameCounter() & 1) {
|
||||||
@ -114,7 +113,7 @@ CDarkel::DrawMessages()
|
|||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(108.0f), gUString);
|
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);
|
AsciiToUnicode(gString, gUString);
|
||||||
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString);
|
||||||
@ -124,9 +123,9 @@ CDarkel::DrawMessages()
|
|||||||
}
|
}
|
||||||
case KILLFRENZY_PASSED:
|
case KILLFRENZY_PASSED:
|
||||||
{
|
{
|
||||||
if (CDarkel::bStandardSoundAndMessages) {
|
if (bStandardSoundAndMessages) {
|
||||||
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart;
|
uint32 timePassedSinceStart = CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart;
|
||||||
if (CTimer::GetTimeInMilliseconds() - CDarkel::TimeOfFrenzyStart < 5000) {
|
if (CTimer::GetTimeInMilliseconds() - TimeOfFrenzyStart < 5000) {
|
||||||
CFont::SetBackgroundOff();
|
CFont::SetBackgroundOff();
|
||||||
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
|
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
@ -186,7 +185,20 @@ CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RegisteredKills[vehicle->GetModelIndex()]++;
|
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
|
void
|
||||||
@ -245,23 +257,7 @@ CDarkel::ResetOnPlayerDeath()
|
|||||||
Status = KILLFRENZY_FAILED;
|
Status = KILLFRENZY_FAILED;
|
||||||
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
|
||||||
eWeaponType fixedWeapon;
|
DealWithWeaponChangeAtEndOfFrenzy();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -298,16 +294,19 @@ CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 mode
|
|||||||
|
|
||||||
CPlayerPed *player = FindPlayerPed();
|
CPlayerPed *player = FindPlayerPed();
|
||||||
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
|
||||||
InterruptedWeapon = player->m_currentWeapon;
|
InterruptedWeaponSelected = player->GetWeapon()->m_eWeaponType;
|
||||||
player->GiveWeapon(fixedWeapon, 0);
|
player->RemoveWeaponAnims(InterruptedWeaponSelected, -1000.0f);
|
||||||
|
InterruptedWeaponType = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_eWeaponType;
|
||||||
AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal;
|
AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal;
|
||||||
|
if (InterruptedWeaponType)
|
||||||
|
CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponType)->m_nModelId)->AddRef();
|
||||||
player->GiveWeapon(fixedWeapon, 30000);
|
player->GiveWeapon(fixedWeapon, 30000);
|
||||||
player->m_nSelectedWepSlot = player->GetWeaponSlot(fixedWeapon);
|
player->SetCurrentWeapon(fixedWeapon);
|
||||||
player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot);
|
player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot);
|
||||||
|
|
||||||
if (FindPlayerVehicle()) {
|
if (FindPlayerVehicle()) {
|
||||||
player->m_currentWeapon = player->m_nSelectedWepSlot;
|
player->SetCurrentWeapon(FindPlayerPed()->m_nSelectedWepSlot);
|
||||||
player->GetWeapon()->m_nAmmoInClip = Min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition);
|
player->SetAmmo(fixedWeapon, Min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition));
|
||||||
player->ClearWeaponTarget();
|
player->ClearWeaponTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -343,24 +342,7 @@ CDarkel::Update()
|
|||||||
CPopulation::m_AllRandomPedsThisType = -1;
|
CPopulation::m_AllRandomPedsThisType = -1;
|
||||||
Status = KILLFRENZY_FAILED;
|
Status = KILLFRENZY_FAILED;
|
||||||
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
TimeOfFrenzyStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
DealWithWeaponChangeAtEndOfFrenzy();
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bStandardSoundAndMessages)
|
if (bStandardSoundAndMessages)
|
||||||
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_FAILED, 0);
|
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_FAILED, 0);
|
||||||
@ -377,25 +359,50 @@ CDarkel::Update()
|
|||||||
|
|
||||||
FindPlayerPed()->m_pWanted->SetWantedLevel(0);
|
FindPlayerPed()->m_pWanted->SetWantedLevel(0);
|
||||||
|
|
||||||
eWeaponType fixedWeapon;
|
DealWithWeaponChangeAtEndOfFrenzy();
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bStandardSoundAndMessages)
|
if (bStandardSoundAndMessages)
|
||||||
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_PASSED, 0);
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -23,7 +23,8 @@ private:
|
|||||||
static int32 WeaponType;
|
static int32 WeaponType;
|
||||||
static int32 AmmoInterruptedWeapon;
|
static int32 AmmoInterruptedWeapon;
|
||||||
static int32 KillsNeeded;
|
static int32 KillsNeeded;
|
||||||
static int8 InterruptedWeapon;
|
static int32 InterruptedWeaponType;
|
||||||
|
static int32 InterruptedWeaponSelected;
|
||||||
static bool bStandardSoundAndMessages;
|
static bool bStandardSoundAndMessages;
|
||||||
static bool bNeedHeadShot;
|
static bool bNeedHeadShot;
|
||||||
static bool bProperKillFrenzy;
|
static bool bProperKillFrenzy;
|
||||||
@ -49,5 +50,6 @@ public:
|
|||||||
static void ResetOnPlayerDeath();
|
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 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 Update();
|
||||||
|
static void DealWithWeaponChangeAtEndOfFrenzy();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -45,9 +45,10 @@ CVector CGameLogic::ShortCutDropOffForMission;
|
|||||||
float CGameLogic::ShortCutDropOffOrientationForMission;
|
float CGameLogic::ShortCutDropOffOrientationForMission;
|
||||||
bool CGameLogic::MissionDropOffReadyToBeUsed;
|
bool CGameLogic::MissionDropOffReadyToBeUsed;
|
||||||
|
|
||||||
//--MIAMI: file done except TODO
|
//--MIAMI: file done
|
||||||
|
|
||||||
#define SHORTCUT_TAXI_COST (9)
|
#define SHORTCUT_TAXI_COST (9)
|
||||||
|
#define TOTAL_BUSTED_AUDIO (28)
|
||||||
|
|
||||||
void
|
void
|
||||||
CGameLogic::InitAtStartOfGame()
|
CGameLogic::InitAtStartOfGame()
|
||||||
@ -196,7 +197,7 @@ CGameLogic::Update()
|
|||||||
sprintf(name, pPlayerInfo.m_nCurrentBustedAudio >= 10 ? "bust_%d" : "bust_0%d", pPlayerInfo.m_nCurrentBustedAudio);
|
sprintf(name, pPlayerInfo.m_nCurrentBustedAudio >= 10 ? "bust_%d" : "bust_0%d", pPlayerInfo.m_nCurrentBustedAudio);
|
||||||
DMAudio.ClearMissionAudio(0);
|
DMAudio.ClearMissionAudio(0);
|
||||||
DMAudio.PreloadMissionAudio(0, name);
|
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 &&
|
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 4000 &&
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
#define CRUSHER_GARAGE_X1 (1135.5f)
|
#define CRUSHER_GARAGE_X1 (1135.5f)
|
||||||
#define CRUSHER_GARAGE_Y1 (57.0f)
|
#define CRUSHER_GARAGE_Y1 (57.0f)
|
||||||
#define CRUSHER_GARAGE_Z1 (-1.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->m_nTimeToStartAction = 0;
|
||||||
pGarage->field_2 = false;
|
pGarage->field_2 = false;
|
||||||
pGarage->m_nTargetModelIndex = targetId;
|
pGarage->m_nTargetModelIndex = targetId;
|
||||||
pGarage->field_96 = nil;
|
|
||||||
pGarage->m_bCollectedCarsState = 0;
|
pGarage->m_bCollectedCarsState = 0;
|
||||||
pGarage->m_bDeactivated = false;
|
pGarage->m_bDeactivated = false;
|
||||||
pGarage->m_bResprayHappened = false;
|
pGarage->m_bResprayHappened = false;
|
||||||
@ -2141,11 +2142,11 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(MIAMI)
|
|
||||||
void CGarages::Save(uint8 * buf, uint32 * size)
|
void CGarages::Save(uint8 * buf, uint32 * size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
//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();
|
CloseHideOutGaragesBeforeSave();
|
||||||
WriteSaveBuf(buf, NumGarages);
|
WriteSaveBuf(buf, NumGarages);
|
||||||
WriteSaveBuf(buf, (uint32)BombsAreFree);
|
WriteSaveBuf(buf, (uint32)BombsAreFree);
|
||||||
@ -2163,7 +2164,7 @@ INITSAVEBUF
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < NUM_GARAGES; i++)
|
for (int i = 0; i < NUM_GARAGES; i++)
|
||||||
WriteSaveBuf(buf, aGarages[i]);
|
WriteSaveBuf(buf, aGarages[i]);
|
||||||
VALIDATESAVEBUF(*size);
|
//VALIDATESAVEBUF(*size);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
|
const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
|
||||||
@ -2185,11 +2186,11 @@ const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(MIAMI)
|
|
||||||
void CGarages::Load(uint8* buf, uint32 size)
|
void CGarages::Load(uint8* buf, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
//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();
|
CloseHideOutGaragesBeforeSave();
|
||||||
NumGarages = ReadSaveBuf<uint32>(buf);
|
NumGarages = ReadSaveBuf<uint32>(buf);
|
||||||
BombsAreFree = ReadSaveBuf<uint32>(buf);
|
BombsAreFree = ReadSaveBuf<uint32>(buf);
|
||||||
@ -2210,7 +2211,6 @@ INITSAVEBUF
|
|||||||
aGarages[i].m_pDoor1 = nil;
|
aGarages[i].m_pDoor1 = nil;
|
||||||
aGarages[i].m_pDoor2 = nil;
|
aGarages[i].m_pDoor2 = nil;
|
||||||
aGarages[i].m_pTarget = nil;
|
aGarages[i].m_pTarget = nil;
|
||||||
aGarages[i].field_96 = nil;
|
|
||||||
aGarages[i].m_bRecreateDoorOnNextRefresh = true;
|
aGarages[i].m_bRecreateDoorOnNextRefresh = true;
|
||||||
aGarages[i].RefreshDoorPointers(true);
|
aGarages[i].RefreshDoorPointers(true);
|
||||||
if (aGarages[i].m_eGarageType == GARAGE_CRUSHER)
|
if (aGarages[i].m_eGarageType == GARAGE_CRUSHER)
|
||||||
@ -2218,7 +2218,7 @@ INITSAVEBUF
|
|||||||
else
|
else
|
||||||
aGarages[i].UpdateDoorsHeight();
|
aGarages[i].UpdateDoorsHeight();
|
||||||
}
|
}
|
||||||
VALIDATESAVEBUF(size);
|
//VALIDATESAVEBUF(size);
|
||||||
|
|
||||||
MessageEndTime = 0;
|
MessageEndTime = 0;
|
||||||
bCamShouldBeOutisde = false;
|
bCamShouldBeOutisde = false;
|
||||||
|
@ -132,7 +132,6 @@ class CGarage
|
|||||||
uint32 m_nTimeToStartAction;
|
uint32 m_nTimeToStartAction;
|
||||||
uint8 m_bCollectedCarsState;
|
uint8 m_bCollectedCarsState;
|
||||||
CVehicle *m_pTarget;
|
CVehicle *m_pTarget;
|
||||||
void* field_96; // unused
|
|
||||||
CStoredCar m_sStoredCar; // not needed
|
CStoredCar m_sStoredCar; // not needed
|
||||||
|
|
||||||
void OpenThisGarage();
|
void OpenThisGarage();
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include "Lines.h" // for debug
|
#include "Lines.h" // for debug
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done except mobile unused function
|
||||||
|
|
||||||
bool gbShowPedPaths;
|
bool gbShowPedPaths;
|
||||||
bool gbShowCarPaths;
|
bool gbShowCarPaths;
|
||||||
bool gbShowCarPathsLinks;
|
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
|
// Make sure all externals link TO an internal
|
||||||
void
|
void
|
||||||
CPathInfoForObject::SwapConnectionsToBeRightWayRound(void)
|
CPathInfoForObject::SwapConnectionsToBeRightWayRound(void)
|
||||||
@ -246,7 +247,6 @@ CPathInfoForObject::SwapConnectionsToBeRightWayRound(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::Init(void)
|
CPathFind::Init(void)
|
||||||
{
|
{
|
||||||
@ -263,7 +263,6 @@ CPathFind::Init(void)
|
|||||||
m_pathNodes[i].distance = MAX_DIST;
|
m_pathNodes[i].distance = MAX_DIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
|
CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
|
||||||
{
|
{
|
||||||
@ -294,14 +293,12 @@ CPathFind::AllocatePathFindInfoMem(int16 numPathGroups)
|
|||||||
NumDetachedCarNodeGroups = 0;
|
NumDetachedCarNodeGroups = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::RegisterMapObject(CTreadable *mapObject)
|
CPathFind::RegisterMapObject(CTreadable *mapObject)
|
||||||
{
|
{
|
||||||
m_mapObjects[m_numMapObjects++] = mapObject;
|
m_mapObjects[m_numMapObjects++] = mapObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::StoreNodeInfoPed(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, float width, bool crossing, uint8 spawnRate)
|
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();
|
InfoForTilePeds[id*12].SwapConnectionsToBeRightWayRound();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::StoreNodeInfoCar(int16 id, int16 node, int8 type, int8 next, int16 x, int16 y, int16 z, float width, int8 numLeft, int8 numRight,
|
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)
|
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();
|
InfoForTileCars[id*12].SwapConnectionsToBeRightWayRound();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::StoreDetachedNodeInfoPed(int32 node, int8 type, int32 next, float x, float y, float z, float width, bool crossing,
|
CPathFind::StoreDetachedNodeInfoPed(int32 node, int8 type, int32 next, float x, float y, float z, float width, bool crossing,
|
||||||
bool disabled, bool betweenLevels, uint8 spawnRate)
|
bool disabled, bool betweenLevels, uint8 spawnRate)
|
||||||
@ -392,7 +387,6 @@ CPathFind::StoreDetachedNodeInfoPed(int32 node, int8 type, int32 next, float x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::StoreDetachedNodeInfoCar(int32 node, int8 type, int32 next, float x, float y, float z, float width, int8 numLeft, int8 numRight,
|
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)
|
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
|
void
|
||||||
CPathFind::CalcNodeCoors(float x, float y, float z, int id, CVector *out)
|
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;
|
*out = m_mapObjects[id]->GetMatrix() * pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
bool
|
bool
|
||||||
CPathFind::LoadPathFindData(void)
|
CPathFind::LoadPathFindData(void)
|
||||||
{
|
{
|
||||||
@ -445,7 +437,6 @@ CPathFind::LoadPathFindData(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::PreparePathData(void)
|
CPathFind::PreparePathData(void)
|
||||||
{
|
{
|
||||||
@ -536,7 +527,6 @@ CPathFind::PreparePathData(void)
|
|||||||
printf("Done with PreparePathData\n");
|
printf("Done with PreparePathData\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
/* String together connected nodes in a list by a flood fill algorithm */
|
/* String together connected nodes in a list by a flood fill algorithm */
|
||||||
void
|
void
|
||||||
CPathFind::CountFloodFillGroups(uint8 type)
|
CPathFind::CountFloodFillGroups(uint8 type)
|
||||||
@ -608,7 +598,6 @@ CPathFind::CountFloodFillGroups(uint8 type)
|
|||||||
|
|
||||||
int32 TempListLength;
|
int32 TempListLength;
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo,
|
CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoForObject *objectpathinfo,
|
||||||
float maxdist, CPathInfoForObject *detachednodes, int numDetached)
|
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].dirY = tempnodes[j].dirY;
|
||||||
m_carPathLinks[m_numCarPathLinks].x = tempnodes[j].pos.x*8.0f;
|
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].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].width = tempnodes[j].width;
|
||||||
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
||||||
m_carPathLinks[m_numCarPathLinks].numLeftLanes = tempnodes[j].numLeftLanes;
|
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].dirY = dy*100.0f;
|
||||||
m_carPathLinks[m_numCarPathLinks].x = posx*8.0f;
|
m_carPathLinks[m_numCarPathLinks].x = posx*8.0f;
|
||||||
m_carPathLinks[m_numCarPathLinks].y = posy*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].width = width;
|
||||||
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
||||||
m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1;
|
m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1;
|
||||||
@ -1028,7 +1017,6 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
|||||||
delete[] mapObjIndices;
|
delete[] mapObjIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
float
|
float
|
||||||
CPathFind::CalcRoadDensity(float x, float y)
|
CPathFind::CalcRoadDensity(float x, float y)
|
||||||
{
|
{
|
||||||
@ -1051,7 +1039,6 @@ CPathFind::CalcRoadDensity(float x, float y)
|
|||||||
return density/2500.0f;
|
return density/2500.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
bool
|
bool
|
||||||
CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2)
|
CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2)
|
||||||
{
|
{
|
||||||
@ -1062,7 +1049,6 @@ CPathFind::TestForPedTrafficLight(CPathNode *n1, CPathNode *n2)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
bool
|
bool
|
||||||
CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2)
|
CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2)
|
||||||
{
|
{
|
||||||
@ -1073,7 +1059,6 @@ CPathFind::TestCrossesRoad(CPathNode *n1, CPathNode *n2)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::AddNodeToList(CPathNode *node, int32 listId)
|
CPathFind::AddNodeToList(CPathNode *node, int32 listId)
|
||||||
{
|
{
|
||||||
@ -1086,7 +1071,6 @@ CPathFind::AddNodeToList(CPathNode *node, int32 listId)
|
|||||||
node->distance = listId;
|
node->distance = listId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::RemoveNodeFromList(CPathNode *node)
|
CPathFind::RemoveNodeFromList(CPathNode *node)
|
||||||
{
|
{
|
||||||
@ -1095,7 +1079,6 @@ CPathFind::RemoveNodeFromList(CPathNode *node)
|
|||||||
node->GetNext()->SetPrev(node->GetPrev());
|
node->GetNext()->SetPrev(node->GetPrev());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::RemoveBadStartNode(CVector pos, CPathNode **nodes, int16 *n)
|
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
|
#endif
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
|
CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
|
||||||
{
|
{
|
||||||
@ -1139,7 +1121,6 @@ CPathFind::SwitchOffNodeAndNeighbours(int32 nodeId, bool disable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::SwitchRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable)
|
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
|
void
|
||||||
CPathFind::SwitchPedRoadsOffInArea(float x1, float x2, float y1, float y2, float z1, float z2, bool disable)
|
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
|
void
|
||||||
CPathFind::SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float y2, float z2, float length, uint8 type, uint8 mode)
|
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
|
void
|
||||||
CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId)
|
CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId)
|
||||||
{
|
{
|
||||||
@ -1239,7 +1217,6 @@ CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: unused (still needed for script here)
|
|
||||||
void
|
void
|
||||||
CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
|
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
|
void
|
||||||
CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
|
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
|
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 i;
|
||||||
int firstNode, lastNode;
|
int firstNode, lastNode;
|
||||||
@ -1293,7 +1268,7 @@ CPathFind::FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bo
|
|||||||
for(i = firstNode; i < lastNode; i++){
|
for(i = firstNode; i < lastNode; i++){
|
||||||
if(ignoreDisabled && m_pathNodes[i].bDisabled) continue;
|
if(ignoreDisabled && m_pathNodes[i].bDisabled) continue;
|
||||||
if(ignoreBetweenLevels && m_pathNodes[i].bBetweenLevels) 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;
|
if(bWaterPath != m_pathNodes[i].bWaterPath) continue;
|
||||||
dist = Abs(m_pathNodes[i].GetX() - coors.x) +
|
dist = Abs(m_pathNodes[i].GetX() - coors.x) +
|
||||||
Abs(m_pathNodes[i].GetY() - coors.y) +
|
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;
|
return closestDist < distLimit ? closestNode : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
int32
|
int32
|
||||||
CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY)
|
CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY)
|
||||||
{
|
{
|
||||||
@ -1345,7 +1319,102 @@ CPathFind::FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, floa
|
|||||||
return closestNode;
|
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
|
float
|
||||||
CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId)
|
CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId)
|
||||||
{
|
{
|
||||||
@ -1357,7 +1426,6 @@ CPathFind::FindNodeOrientationForCarPlacement(int32 nodeId)
|
|||||||
return RADTODEG(dir.Heading());
|
return RADTODEG(dir.Heading());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: unused (still needed for script here)
|
|
||||||
float
|
float
|
||||||
CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards)
|
CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards)
|
||||||
{
|
{
|
||||||
@ -1401,10 +1469,8 @@ CPathFind::FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, flo
|
|||||||
return RADTODEG(dir.Heading());
|
return RADTODEG(dir.Heading());
|
||||||
}
|
}
|
||||||
|
|
||||||
// no "New" in MIAMI
|
|
||||||
//--MIAMI: TODO
|
|
||||||
bool
|
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 i, j;
|
||||||
int node1, node2;
|
int node1, node2;
|
||||||
@ -1457,67 +1523,83 @@ CPathFind::NewGenerateCarCreationCoors(float x, float y, float dirX, float dirY,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: TODO
|
|
||||||
bool
|
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)
|
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 i;
|
||||||
int node1, node2;
|
int node1, node2;
|
||||||
|
float node1_dist, node2_dist;
|
||||||
|
static int32 node_cnt;
|
||||||
|
|
||||||
if(m_numPedPathNodes == 0)
|
if(m_numPedPathNodes == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for(i = 0; i < 400; i++){
|
for(i = 0; i < 230; i++){
|
||||||
node1 = m_numCarPathNodes + CGeneral::GetRandomNumber() % m_numPedPathNodes;
|
if (node_cnt++ >= m_numPedPathNodes)
|
||||||
if(DistanceSqr2D(m_pathNodes[node1].GetPosition(), x, y) < sq(maxDist+30.0f)){
|
node_cnt = 0;
|
||||||
if(m_pathNodes[node1].numLinks == 0)
|
node1 = node_cnt + m_numCarPathNodes;
|
||||||
continue;
|
node1_dist = Distance2D(m_pathNodes[node1].GetPosition(), x, y);
|
||||||
int link = m_pathNodes[node1].firstLink + CGeneral::GetRandomNumber() % m_pathNodes[node1].numLinks;
|
if(node1_dist < maxDist+30.0f){
|
||||||
if(ConnectionCrossesRoad(link))
|
if(m_pathNodes[node1].numLinks != 0)
|
||||||
continue;
|
break;
|
||||||
node2 = ConnectedNode(link);
|
}
|
||||||
if(m_pathNodes[node1].bDisabled || m_pathNodes[node2].bDisabled)
|
}
|
||||||
continue;
|
if (i >= 230)
|
||||||
|
return false;
|
||||||
|
|
||||||
float f2 = (CGeneral::GetRandomNumber()&0xFF)/256.0f;
|
for(i = 0; i < m_pathNodes[node1].numLinks; i++){
|
||||||
float f1 = 1.0f - f2;
|
int link = m_pathNodes[node1].firstLink + i;
|
||||||
*pPositionBetweenNodes = f2;
|
if(ConnectionCrossesRoad(link))
|
||||||
CVector pos = m_pathNodes[node1].GetPosition()*f1 + m_pathNodes[node2].GetPosition()*f2;
|
continue;
|
||||||
if(Distance2D(pos, x, y) < maxDist+20.0f){
|
node2 = ConnectedNode(link);
|
||||||
pos.x += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f;
|
if(m_pathNodes[node1].bDisabled || m_pathNodes[node2].bDisabled)
|
||||||
pos.y += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f;
|
continue;
|
||||||
float dist = Distance2D(pos, x, y);
|
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;
|
||||||
|
|
||||||
bool visible;
|
for(i = 0; i < 5; i++){
|
||||||
if(camMatrix)
|
float f2 = (CGeneral::GetRandomNumber()&0xFF)/256.0f;
|
||||||
visible = TheCamera.IsSphereVisible(pos, 2.0f, camMatrix);
|
float f1 = 1.0f - f2;
|
||||||
else
|
*pPositionBetweenNodes = f2;
|
||||||
visible = TheCamera.IsSphereVisible(pos, 2.0f);
|
CVector pos = m_pathNodes[node1].GetPosition()*f1 + m_pathNodes[node2].GetPosition()*f2;
|
||||||
if(!visible){
|
if(Distance2D(pos, x, y) < maxDist+20.0f){
|
||||||
minDist = minDistOffScreen;
|
pos.x += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f;
|
||||||
maxDist = maxDistOffScreen;
|
pos.y += ((CGeneral::GetRandomNumber()&0xFF)-128)*0.01f;
|
||||||
}
|
float dist = Distance2D(pos, x, y);
|
||||||
if(minDist < dist && dist < maxDist){
|
|
||||||
*pNode1 = node1;
|
|
||||||
*pNode2 = node2;
|
|
||||||
*pPosition = pos;
|
|
||||||
|
|
||||||
bool found;
|
bool visible;
|
||||||
float groundZ = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z+2.0f, &found);
|
if(camMatrix)
|
||||||
if(!found)
|
visible = TheCamera.IsSphereVisible(pos, 2.0f, camMatrix);
|
||||||
return false;
|
else
|
||||||
if(Abs(groundZ - pos.z) > 3.0f)
|
visible = TheCamera.IsSphereVisible(pos, 2.0f);
|
||||||
return false;
|
if(!visible){
|
||||||
pPosition->z = groundZ;
|
minDist = minDistOffScreen;
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::FindNextNodeWandering(uint8 type, CVector coors, CPathNode **lastNode, CPathNode **nextNode, uint8 curDir, uint8 *nextDir)
|
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];
|
static CPathNode *apNodesToBeCleared[6525];
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
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)
|
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 DummyResult;
|
||||||
static int16 DummyResult2;
|
static int16 DummyResult2;
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
bool
|
bool
|
||||||
CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
|
CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
|
||||||
{
|
{
|
||||||
@ -1692,7 +1772,6 @@ CPathFind::TestCoorsCloseness(CVector target, uint8 type, CVector start)
|
|||||||
return dist < 100.0f;
|
return dist < 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::Save(uint8 *buf, uint32 *size)
|
CPathFind::Save(uint8 *buf, uint32 *size)
|
||||||
{
|
{
|
||||||
@ -1714,7 +1793,6 @@ CPathFind::Save(uint8 *buf, uint32 *size)
|
|||||||
buf[i/8 + n] &= ~(1 << i%8);
|
buf[i/8 + n] &= ~(1 << i%8);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done
|
|
||||||
void
|
void
|
||||||
CPathFind::Load(uint8 *buf, uint32 size)
|
CPathFind::Load(uint8 *buf, uint32 size)
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,8 @@ public:
|
|||||||
static void AddNodeToList(CPedPathNode *pNode, int16 index, CPedPathNode *pList);
|
static void AddNodeToList(CPedPathNode *pNode, int16 index, CPedPathNode *pList);
|
||||||
static void AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition);
|
static void AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition);
|
||||||
static void AddBlockadeSectorList(CPtrList& list, 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
|
struct CPathNode
|
||||||
@ -74,7 +76,7 @@ struct CPathNode
|
|||||||
|
|
||||||
uint8 bWaterPath : 1;
|
uint8 bWaterPath : 1;
|
||||||
uint8 bOnlySmallBoats : 1;
|
uint8 bOnlySmallBoats : 1;
|
||||||
uint8 flagB4 : 1; // where is this set?
|
uint8 bSelected : 1;
|
||||||
uint8 speedLimit : 2;
|
uint8 speedLimit : 2;
|
||||||
//uint8 flagB20 : 1;
|
//uint8 flagB20 : 1;
|
||||||
//uint8 flagB40 : 1;
|
//uint8 flagB40 : 1;
|
||||||
@ -115,7 +117,7 @@ struct CCarPathLink
|
|||||||
int8 dirY;
|
int8 dirY;
|
||||||
int8 numLeftLanes : 3;
|
int8 numLeftLanes : 3;
|
||||||
int8 numRightLanes : 3;
|
int8 numRightLanes : 3;
|
||||||
uint8 flag1 : 1;
|
uint8 trafficLightDirection : 1;
|
||||||
uint8 trafficLightType : 2;
|
uint8 trafficLightType : 2;
|
||||||
uint8 bBridgeLights : 1; // at least in LCS...
|
uint8 bBridgeLights : 1; // at least in LCS...
|
||||||
int8 width;
|
int8 width;
|
||||||
@ -160,6 +162,7 @@ struct CPathInfoForObject
|
|||||||
|
|
||||||
uint8 spawnRate : 4;
|
uint8 spawnRate : 4;
|
||||||
|
|
||||||
|
void CheckIntegrity(void);
|
||||||
void SwapConnectionsToBeRightWayRound(void);
|
void SwapConnectionsToBeRightWayRound(void);
|
||||||
};
|
};
|
||||||
extern CPathInfoForObject *InfoForTileCars;
|
extern CPathInfoForObject *InfoForTileCars;
|
||||||
@ -189,6 +192,14 @@ struct CTempNodeExternal // made up name
|
|||||||
bool isCross;
|
bool isCross;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// from mobile
|
||||||
|
template<typename T>
|
||||||
|
class CRoute
|
||||||
|
{
|
||||||
|
T m_node[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class CPathFind
|
class CPathFind
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -242,12 +253,14 @@ public:
|
|||||||
void MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId);
|
void MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId);
|
||||||
void MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2);
|
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);
|
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 ignoreSelected = false, bool bWaterPath = false);
|
||||||
int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled = false, bool ignoreBetweenLevels = false, bool ignoreFlagB4 = false, bool bWaterPath = false);
|
|
||||||
int32 FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY);
|
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 FindNodeOrientationForCarPlacement(int32 nodeId);
|
||||||
float FindNodeOrientationForCarPlacementFacingDestination(int32 nodeId, float x, float y, bool towards);
|
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);
|
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 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);
|
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 ConnectionSetTrafficLight(int id) { m_connections[id] |= 0x4000; }
|
||||||
|
|
||||||
void DisplayPathData(void);
|
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<CPathNode*>&);
|
||||||
|
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;
|
extern CPathFind ThePaths;
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "VehicleModelInfo.h"
|
#include "VehicleModelInfo.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
uint16 CRecordDataForGame::RecordingState;
|
uint16 CRecordDataForGame::RecordingState;
|
||||||
|
|
||||||
void CRecordDataForGame::Init(void)
|
void CRecordDataForGame::Init(void)
|
||||||
|
@ -53,6 +53,8 @@
|
|||||||
#include "Fluff.h"
|
#include "Fluff.h"
|
||||||
#include "WaterCreatures.h"
|
#include "WaterCreatures.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done except TODO
|
||||||
|
|
||||||
uint8 CReplay::Mode;
|
uint8 CReplay::Mode;
|
||||||
CAddressInReplayBuffer CReplay::Record;
|
CAddressInReplayBuffer CReplay::Record;
|
||||||
CAddressInReplayBuffer CReplay::Playback;
|
CAddressInReplayBuffer CReplay::Playback;
|
||||||
@ -160,7 +162,6 @@ static void(*CBArray[])(CAnimBlendAssociation*, void*) =
|
|||||||
&CPed::PedAnimShuffleCB, &CPed::DeleteSunbatheIdleAnimCB, &StartTalkingOnMobileCB, &FinishTalkingOnMobileCB
|
&CPed::PedAnimShuffleCB, &CPed::DeleteSunbatheIdleAnimCB, &StartTalkingOnMobileCB, &FinishTalkingOnMobileCB
|
||||||
};
|
};
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
|
static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < sizeof(CBArray) / sizeof(*CBArray); i++){
|
for (int i = 0; i < sizeof(CBArray) / sizeof(*CBArray); i++){
|
||||||
@ -171,13 +172,11 @@ static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
|
static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
|
||||||
{
|
{
|
||||||
return CBArray[id];
|
return CBArray[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying)
|
static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying)
|
||||||
{
|
{
|
||||||
if(vehicle->Damage.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){
|
if(vehicle->Damage.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){
|
||||||
@ -210,7 +209,6 @@ static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flyi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void PrintElementsInPtrList(void)
|
void PrintElementsInPtrList(void)
|
||||||
{
|
{
|
||||||
for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_GENERIC).first; node; node = node->next) {
|
for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_GENERIC).first; node; node = node->next) {
|
||||||
@ -218,7 +216,6 @@ void PrintElementsInPtrList(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::Init(void)
|
void CReplay::Init(void)
|
||||||
{
|
{
|
||||||
pBuf0 = nil;
|
pBuf0 = nil;
|
||||||
@ -261,20 +258,17 @@ void CReplay::Init(void)
|
|||||||
MarkEverythingAsNew();
|
MarkEverythingAsNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::DisableReplays(void)
|
void CReplay::DisableReplays(void)
|
||||||
{
|
{
|
||||||
bReplayEnabled = false;
|
bReplayEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::EnableReplays(void)
|
void CReplay::EnableReplays(void)
|
||||||
{
|
{
|
||||||
bReplayEnabled = true;
|
bReplayEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayReplayFromHD(void);
|
void PlayReplayFromHD(void);
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::Update(void)
|
void CReplay::Update(void)
|
||||||
{
|
{
|
||||||
if (CCutsceneMgr::IsCutsceneProcessing() || CPad::GetPad(0)->ArePlayerControlsDisabled() || CScriptPaths::IsOneActive() || FrontEndMenuManager.GetIsMenuActive()) {
|
if (CCutsceneMgr::IsCutsceneProcessing() || CPad::GetPad(0)->ArePlayerControlsDisabled() || CScriptPaths::IsOneActive() || FrontEndMenuManager.GetIsMenuActive()) {
|
||||||
@ -309,7 +303,6 @@ void CReplay::Update(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done except TODO
|
|
||||||
void CReplay::RecordThisFrame(void)
|
void CReplay::RecordThisFrame(void)
|
||||||
{
|
{
|
||||||
uint32 memory_required = sizeof(tGeneralPacket) + sizeof(tClockPacket) + sizeof(tWeatherPacket) + sizeof(tTimerPacket) + sizeof(tMiscPacket);
|
uint32 memory_required = sizeof(tGeneralPacket) + sizeof(tClockPacket) + sizeof(tWeatherPacket) + sizeof(tTimerPacket) + sizeof(tMiscPacket);
|
||||||
@ -413,7 +406,6 @@ void CReplay::RecordThisFrame(void)
|
|||||||
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::GoToNextBlock(void)
|
void CReplay::GoToNextBlock(void)
|
||||||
{
|
{
|
||||||
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
||||||
@ -426,7 +418,6 @@ void CReplay::GoToNextBlock(void)
|
|||||||
MarkEverythingAsNew();
|
MarkEverythingAsNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CVector& vecDir, float fSize, const RwRGBA& color)
|
void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CVector& vecDir, float fSize, const RwRGBA& color)
|
||||||
{
|
{
|
||||||
if (Record.m_nOffset > REPLAYBUFFERSIZE - 16 - sizeof(tParticlePacket))
|
if (Record.m_nOffset > REPLAYBUFFERSIZE - 16 - sizeof(tParticlePacket))
|
||||||
@ -449,7 +440,6 @@ void CReplay::RecordParticle(tParticleType type, const CVector& vecPos, const CV
|
|||||||
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
Record.m_pBase[Record.m_nOffset] = REPLAYPACKET_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StorePedUpdate(CPed *ped, int id)
|
void CReplay::StorePedUpdate(CPed *ped, int id)
|
||||||
{
|
{
|
||||||
tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
|
tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
@ -469,7 +459,6 @@ void CReplay::StorePedUpdate(CPed *ped, int id)
|
|||||||
Record.m_nOffset += sizeof(tPedUpdatePacket);
|
Record.m_nOffset += sizeof(tPedUpdatePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
||||||
{
|
{
|
||||||
CAnimBlendAssociation* second;
|
CAnimBlendAssociation* second;
|
||||||
@ -515,7 +504,6 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
|
void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++){
|
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++){
|
||||||
@ -573,7 +561,6 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer)
|
void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer)
|
||||||
{
|
{
|
||||||
tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
|
tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
|
||||||
@ -618,14 +605,12 @@ void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayB
|
|||||||
buffer->m_nOffset += sizeof(tPedUpdatePacket);
|
buffer->m_nOffset += sizeof(tPedUpdatePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool HasAnimGroupLoaded(uint8 group)
|
bool HasAnimGroupLoaded(uint8 group)
|
||||||
{
|
{
|
||||||
CAnimBlendAssocGroup* pGroup = &CAnimManager::GetAnimAssocGroups()[group];
|
CAnimBlendAssocGroup* pGroup = &CAnimManager::GetAnimAssocGroups()[group];
|
||||||
return pGroup->animBlock && pGroup->animBlock->isLoaded;
|
return pGroup->animBlock && pGroup->animBlock->isLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
|
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
|
||||||
{
|
{
|
||||||
CAnimBlendAssociation* anim1;
|
CAnimBlendAssociation* anim1;
|
||||||
@ -669,7 +654,6 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
|
void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
|
||||||
{
|
{
|
||||||
CAnimBlendAssociation* assoc;
|
CAnimBlendAssociation* assoc;
|
||||||
@ -715,7 +699,6 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::PlaybackThisFrame(void)
|
void CReplay::PlaybackThisFrame(void)
|
||||||
{
|
{
|
||||||
static int FrameSloMo = 0;
|
static int FrameSloMo = 0;
|
||||||
@ -743,7 +726,6 @@ void CReplay::PlaybackThisFrame(void)
|
|||||||
|
|
||||||
// next two functions are only found in mobile version
|
// next two functions are only found in mobile version
|
||||||
// most likely they were optimized out for being unused
|
// 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)
|
void CReplay::TriggerPlaybackLastCoupleOfSeconds(uint32 start, uint8 cam_mode, float cam_x, float cam_y, float cam_z, uint32 slomo)
|
||||||
{
|
{
|
||||||
if (Mode != MODE_RECORD)
|
if (Mode != MODE_RECORD)
|
||||||
@ -755,7 +737,6 @@ void CReplay::TriggerPlaybackLastCoupleOfSeconds(uint32 start, uint8 cam_mode, f
|
|||||||
Mode = MODE_RECORD;
|
Mode = MODE_RECORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool CReplay::FastForwardToTime(uint32 start)
|
bool CReplay::FastForwardToTime(uint32 start)
|
||||||
{
|
{
|
||||||
uint32 timer = 0;
|
uint32 timer = 0;
|
||||||
@ -765,7 +746,6 @@ bool CReplay::FastForwardToTime(uint32 start)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
|
void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
|
||||||
{
|
{
|
||||||
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
|
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
@ -806,7 +786,6 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
|
|||||||
Record.m_nOffset += sizeof(tVehicleUpdatePacket);
|
Record.m_nOffset += sizeof(tVehicleUpdatePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id)
|
void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id)
|
||||||
{
|
{
|
||||||
CBike* bike = (CBike*)vehicle;
|
CBike* bike = (CBike*)vehicle;
|
||||||
@ -832,7 +811,6 @@ void CReplay::StoreBikeUpdate(CVehicle* vehicle, int id)
|
|||||||
Record.m_nOffset += sizeof(tBikeUpdatePacket);
|
Record.m_nOffset += sizeof(tBikeUpdatePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer)
|
void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer)
|
||||||
{
|
{
|
||||||
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
|
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
|
||||||
@ -906,7 +884,6 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
|
|||||||
((CBoat*)vehicle)->m_fMovingSpeed = vp->skimmer_speed / 50.0f;
|
((CBoat*)vehicle)->m_fMovingSpeed = vp->skimmer_speed / 50.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddressInReplayBuffer* buffer)
|
void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddressInReplayBuffer* buffer)
|
||||||
{
|
{
|
||||||
CBike* bike = (CBike*)vehicle;
|
CBike* bike = (CBike*)vehicle;
|
||||||
@ -940,7 +917,6 @@ void CReplay::ProcessBikeUpdate(CVehicle* vehicle, float interpolation, CAddress
|
|||||||
CWorld::Add(vehicle);
|
CWorld::Add(vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer)
|
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer)
|
||||||
{
|
{
|
||||||
CBulletTraces::Init();
|
CBulletTraces::Init();
|
||||||
@ -1197,7 +1173,6 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::FinishPlayback(void)
|
void CReplay::FinishPlayback(void)
|
||||||
{
|
{
|
||||||
if (Mode != MODE_PLAYBACK)
|
if (Mode != MODE_PLAYBACK)
|
||||||
@ -1220,7 +1195,6 @@ void CReplay::FinishPlayback(void)
|
|||||||
DMAudio.SetMusicFadeVol(127);
|
DMAudio.SetMusicFadeVol(127);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::EmptyReplayBuffer(void)
|
void CReplay::EmptyReplayBuffer(void)
|
||||||
{
|
{
|
||||||
if (Mode == MODE_PLAYBACK)
|
if (Mode == MODE_PLAYBACK)
|
||||||
@ -1236,7 +1210,6 @@ void CReplay::EmptyReplayBuffer(void)
|
|||||||
MarkEverythingAsNew();
|
MarkEverythingAsNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessReplayCamera(void)
|
void CReplay::ProcessReplayCamera(void)
|
||||||
{
|
{
|
||||||
switch (CameraMode) {
|
switch (CameraMode) {
|
||||||
@ -1283,7 +1256,6 @@ void CReplay::ProcessReplayCamera(void)
|
|||||||
|
|
||||||
extern CWeaponEffects gCrossHair;
|
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)
|
void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene)
|
||||||
{
|
{
|
||||||
if (Mode != MODE_RECORD)
|
if (Mode != MODE_RECORD)
|
||||||
@ -1343,7 +1315,6 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
|
|||||||
CDraw::SetFOV(70.0f);
|
CDraw::SetFOV(70.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StoreStuffInMem(void)
|
void CReplay::StoreStuffInMem(void)
|
||||||
{
|
{
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
@ -1430,7 +1401,6 @@ void CReplay::StoreStuffInMem(void)
|
|||||||
CScriptPaths::Save_ForReplay();
|
CScriptPaths::Save_ForReplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::RestoreStuffFromMem(void)
|
void CReplay::RestoreStuffFromMem(void)
|
||||||
{
|
{
|
||||||
CPools::GetVehiclePool()->CopyBack(pBuf0, pBuf1);
|
CPools::GetVehiclePool()->CopyBack(pBuf0, pBuf1);
|
||||||
@ -1655,7 +1625,6 @@ void CReplay::RestoreStuffFromMem(void)
|
|||||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::EmptyPedsAndVehiclePools(void)
|
void CReplay::EmptyPedsAndVehiclePools(void)
|
||||||
{
|
{
|
||||||
int i = CPools::GetVehiclePool()->GetSize();
|
int i = CPools::GetVehiclePool()->GetSize();
|
||||||
@ -1676,7 +1645,6 @@ void CReplay::EmptyPedsAndVehiclePools(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::EmptyAllPools(void)
|
void CReplay::EmptyAllPools(void)
|
||||||
{
|
{
|
||||||
EmptyPedsAndVehiclePools();
|
EmptyPedsAndVehiclePools();
|
||||||
@ -1698,7 +1666,6 @@ void CReplay::EmptyAllPools(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::MarkEverythingAsNew(void)
|
void CReplay::MarkEverythingAsNew(void)
|
||||||
{
|
{
|
||||||
int i = CPools::GetVehiclePool()->GetSize();
|
int i = CPools::GetVehiclePool()->GetSize();
|
||||||
@ -1748,7 +1715,6 @@ void CReplay::SaveReplayToHD(void)
|
|||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void PlayReplayFromHD(void)
|
void PlayReplayFromHD(void)
|
||||||
{
|
{
|
||||||
CFileMgr::SetDirMyDocuments();
|
CFileMgr::SetDirMyDocuments();
|
||||||
@ -1781,7 +1747,6 @@ void PlayReplayFromHD(void)
|
|||||||
CReplay::StreamAllNecessaryCarsAndPeds();
|
CReplay::StreamAllNecessaryCarsAndPeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
||||||
{
|
{
|
||||||
for (int slot = 0; slot < NUM_REPLAYBUFFERS; slot++) {
|
for (int slot = 0; slot < NUM_REPLAYBUFFERS; slot++) {
|
||||||
@ -1806,7 +1771,6 @@ void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
|||||||
CStreaming::LoadAllRequestedModels(false);
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::FindFirstFocusCoordinate(CVector *coord)
|
void CReplay::FindFirstFocusCoordinate(CVector *coord)
|
||||||
{
|
{
|
||||||
*coord = CVector(0.0f, 0.0f, 0.0f);
|
*coord = CVector(0.0f, 0.0f, 0.0f);
|
||||||
@ -1822,7 +1786,6 @@ void CReplay::FindFirstFocusCoordinate(CVector *coord)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
bool CReplay::ShouldStandardCameraBeProcessed(void)
|
bool CReplay::ShouldStandardCameraBeProcessed(void)
|
||||||
{
|
{
|
||||||
if (Mode != MODE_PLAYBACK)
|
if (Mode != MODE_PLAYBACK)
|
||||||
@ -1832,7 +1795,6 @@ bool CReplay::ShouldStandardCameraBeProcessed(void)
|
|||||||
return FindPlayerVehicle() != nil;
|
return FindPlayerVehicle() != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
void CReplay::ProcessLookAroundCam(void)
|
void CReplay::ProcessLookAroundCam(void)
|
||||||
{
|
{
|
||||||
if (!bAllowLookAroundCam)
|
if (!bAllowLookAroundCam)
|
||||||
@ -1889,7 +1851,6 @@ void CReplay::ProcessLookAroundCam(void)
|
|||||||
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
|
||||||
size_t CReplay::FindSizeOfPacket(uint8 type)
|
size_t CReplay::FindSizeOfPacket(uint8 type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -1911,7 +1872,6 @@ size_t CReplay::FindSizeOfPacket(uint8 type)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done (function didn't change since III and we already had it modified)
|
|
||||||
void CReplay::Display()
|
void CReplay::Display()
|
||||||
{
|
{
|
||||||
static int TimeCount = 0;
|
static int TimeCount = 0;
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
uint8 CRestart::OverrideHospitalLevel;
|
uint8 CRestart::OverrideHospitalLevel;
|
||||||
uint8 CRestart::OverridePoliceStationLevel;
|
uint8 CRestart::OverridePoliceStationLevel;
|
||||||
bool CRestart::bFadeInAfterNextArrest;
|
bool CRestart::bFadeInAfterNextArrest;
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include "WeaponInfo.h"
|
#include "WeaponInfo.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
bool CSceneEdit::m_bEditOn;
|
bool CSceneEdit::m_bEditOn;
|
||||||
int32 CSceneEdit::m_bCameraFollowActor;
|
int32 CSceneEdit::m_bCameraFollowActor;
|
||||||
bool CSceneEdit::m_bRecording;
|
bool CSceneEdit::m_bRecording;
|
||||||
@ -1070,7 +1072,7 @@ bool CSceneEdit::SelectWeapon(void)
|
|||||||
}
|
}
|
||||||
if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) {
|
if (CPad::GetPad(1)->GetLeftShoulder1JustDown()) {
|
||||||
if (++m_nWeaponType >= WEAPONTYPE_DETONATOR)
|
if (++m_nWeaponType >= WEAPONTYPE_DETONATOR)
|
||||||
m_nWeaponType = WEAPONTYPE_BASEBALLBAT;
|
m_nWeaponType = WEAPONTYPE_BRASSKNUCKLE;
|
||||||
pActors[m_nActor]->ClearWeapons();
|
pActors[m_nActor]->ClearWeapons();
|
||||||
pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
|
pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
|
||||||
pActors[m_nActor]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId);
|
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()){
|
else if (CPad::GetPad(1)->GetRightShoulder1JustDown()){
|
||||||
if (--m_nWeaponType <= WEAPONTYPE_UNARMED)
|
if (--m_nWeaponType <= WEAPONTYPE_UNARMED)
|
||||||
m_nWeaponType = WEAPONTYPE_GRENADE;
|
m_nWeaponType = WEAPONTYPE_MINIGUN;
|
||||||
pActors[m_nActor]->ClearWeapons();
|
pActors[m_nActor]->ClearWeapons();
|
||||||
pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
|
pActors[m_nActor]->GiveWeapon((eWeaponType)m_nWeaponType, 1000);
|
||||||
pActors[m_nActor]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId);
|
pActors[m_nActor]->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pActors[m_nActor]->GetWeapon()->m_eWeaponType)->m_nModelId);
|
||||||
|
@ -1827,7 +1827,7 @@ void CMissionCleanup::Process()
|
|||||||
CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0;
|
CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0;
|
||||||
CPad::GetPad(0)->SetDrunkInputDelay(0);
|
CPad::GetPad(0)->SetDrunkInputDelay(0);
|
||||||
CWorld::Players[0].m_bDriveByAllowed = true;
|
CWorld::Players[0].m_bDriveByAllowed = true;
|
||||||
// DMAudio::ShutUpPlayerTalking(0); // TODO(Miami)
|
DMAudio.ShutUpPlayerTalking(0);
|
||||||
CVehicle::bDisableRemoteDetonation = false;
|
CVehicle::bDisableRemoteDetonation = false;
|
||||||
CVehicle::bDisableRemoteDetonationOnContact = false;
|
CVehicle::bDisableRemoteDetonationOnContact = false;
|
||||||
CGameLogic::ClearShortCut();
|
CGameLogic::ClearShortCut();
|
||||||
@ -6372,7 +6372,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||||||
}
|
}
|
||||||
case COMMAND_ADD_EXPLOSION:
|
case COMMAND_ADD_EXPLOSION:
|
||||||
CollectParameters(&m_nIp, 4);
|
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;
|
return 0;
|
||||||
|
|
||||||
case COMMAND_IS_CAR_UPRIGHT:
|
case COMMAND_IS_CAR_UPRIGHT:
|
||||||
@ -7042,7 +7042,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
CCoronas::RegisterCorona((uintptr)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8],
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_DRAW_LIGHT:
|
case COMMAND_DRAW_LIGHT:
|
||||||
@ -7497,7 +7497,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||||||
CVector pos = *(CVector*)&ScriptParams[0];
|
CVector pos = *(CVector*)&ScriptParams[0];
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
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();
|
*(CVector*)&ScriptParams[0] = pNode->GetPosition();
|
||||||
StoreParameters(&m_nIp, 3);
|
StoreParameters(&m_nIp, 3);
|
||||||
return 0;
|
return 0;
|
||||||
@ -7508,8 +7508,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||||||
CVector pos = *(CVector*)&ScriptParams[0];
|
CVector pos = *(CVector*)&ScriptParams[0];
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f)];
|
*(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true));
|
||||||
*(CVector*)&ScriptParams[0] = pNode->GetPosition();
|
|
||||||
StoreParameters(&m_nIp, 3);
|
StoreParameters(&m_nIp, 3);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -8978,7 +8977,6 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
char zone[KEY_LENGTH_IN_SCRIPT];
|
char zone[KEY_LENGTH_IN_SCRIPT];
|
||||||
CTheScripts::ReadTextLabelFromScript(&m_nIp, zone);
|
CTheScripts::ReadTextLabelFromScript(&m_nIp, zone);
|
||||||
// TODO(MIAMI): just getting this to compile with new argument
|
|
||||||
int zone_id = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT);
|
int zone_id = CTheZones::FindZoneByLabelAndReturnIndex(zone, ZONE_DEFAULT);
|
||||||
if (zone_id != -1)
|
if (zone_id != -1)
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||||
@ -10344,8 +10342,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
int node = ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true);
|
int node = ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true);
|
||||||
// TODO(MIAMI): replace GetPosition with FindNodeCoorsForScript
|
*(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(node);
|
||||||
*(CVector*)&ScriptParams[0] = ThePaths.m_pathNodes[node].GetPosition();
|
|
||||||
*(float*)&ScriptParams[3] = ThePaths.FindNodeOrientationForCarPlacement(node);
|
*(float*)&ScriptParams[3] = ThePaths.FindNodeOrientationForCarPlacement(node);
|
||||||
StoreParameters(&m_nIp, 4);
|
StoreParameters(&m_nIp, 4);
|
||||||
return 0;
|
return 0;
|
||||||
@ -11204,7 +11201,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||||||
return 0;
|
return 0;
|
||||||
*/
|
*/
|
||||||
case COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED:
|
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;
|
return 0;
|
||||||
case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS:
|
case COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS:
|
||||||
{
|
{
|
||||||
@ -12284,10 +12281,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
|||||||
case COMMAND_GET_CLOSEST_STRAIGHT_ROAD:
|
case COMMAND_GET_CLOSEST_STRAIGHT_ROAD:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 5);
|
CollectParameters(&m_nIp, 5);
|
||||||
debug("GET_CLOSEST_STRAIGHT_ROAD not implemented!\n");
|
int node1, node2;
|
||||||
for (int i = 0; i < 7; i++)
|
float angle;
|
||||||
ScriptParams[i] = 0;
|
ThePaths.FindNodePairClosestToCoors(*(CVector*)&ScriptParams[0], PATH_CAR, &node1, &node2, &angle,
|
||||||
StoreParameters(&m_nIp, 7); // TODO(MIAMI)
|
*(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;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_CAR_FORWARD_SPEED:
|
case COMMAND_SET_CAR_FORWARD_SPEED:
|
||||||
@ -12461,9 +12468,11 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
|||||||
case COMMAND_GET_NTH_CLOSEST_CAR_NODE:
|
case COMMAND_GET_NTH_CLOSEST_CAR_NODE:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 4);
|
CollectParameters(&m_nIp, 4);
|
||||||
debug("GET_NTH_CLOSEST_CAR_NODE is not implemented\n"); // TODO(MIAMI)
|
CVector pos = *(CVector*)&ScriptParams[0];
|
||||||
ScriptParams[0] = 0;
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
StoreParameters(&m_nIp, 1);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
//case COMMAND_GET_NTH_CLOSEST_CHAR_NODE:
|
//case COMMAND_GET_NTH_CLOSEST_CHAR_NODE:
|
||||||
@ -13252,7 +13261,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
|||||||
case COMMAND_SET_TONIGHTS_EVENT:
|
case COMMAND_SET_TONIGHTS_EVENT:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
debug("skipping SET_TONIGHTS_EVENT\n"); // TODO(MIAMI)
|
CScrollBar::TonightsEvent = ScriptParams[0];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_CLEAR_CHAR_LAST_DAMAGE_ENTITY:
|
case COMMAND_CLEAR_CHAR_LAST_DAMAGE_ENTITY:
|
||||||
@ -13416,9 +13425,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
|||||||
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
||||||
script_assert(pPed);
|
script_assert(pPed);
|
||||||
if (pPed->bInVehicle) {
|
if (pPed->bInVehicle) {
|
||||||
if (pPed->GetWeapon(5).m_eWeaponType) { // TODO(MIAMI): enum
|
if (pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType) {
|
||||||
if (pPed->GetWeapon(5).m_nAmmoTotal < ScriptParams[1])
|
if (pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_nAmmoTotal < ScriptParams[1])
|
||||||
pPed->SetAmmo(pPed->GetWeapon(5).m_eWeaponType, ScriptParams[1]);
|
pPed->SetAmmo(pPed->GetWeapon(WEAPONSLOT_SUBMACHINEGUN).m_eWeaponType, ScriptParams[1]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pPed->GiveWeapon(WEAPONTYPE_UZI, ScriptParams[1], true);
|
pPed->GiveWeapon(WEAPONTYPE_UZI, ScriptParams[1], true);
|
||||||
@ -13440,7 +13449,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
|||||||
case COMMAND_ADD_EXPLOSION_NO_SOUND:
|
case COMMAND_ADD_EXPLOSION_NO_SOUND:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 4);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_OBJECT_AREA_VISIBLE:
|
case COMMAND_SET_OBJECT_AREA_VISIBLE:
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
// TODO: figure out the meaning of this
|
//--MIAMI: file done
|
||||||
enum { SOME_FLAG = 0x80 };
|
|
||||||
|
|
||||||
bool CTrafficLights::bGreenLightsCheat;
|
bool CTrafficLights::bGreenLightsCheat;
|
||||||
|
|
||||||
@ -28,113 +27,286 @@ CTrafficLights::DisplayActualLight(CEntity *ent)
|
|||||||
|
|
||||||
int phase;
|
int phase;
|
||||||
if(FindTrafficLightType(ent) == 1)
|
if(FindTrafficLightType(ent) == 1)
|
||||||
phase = LightForCars1();
|
phase = LightForCars1_Visual();
|
||||||
else
|
else
|
||||||
phase = LightForCars2();
|
phase = LightForCars2_Visual();
|
||||||
|
|
||||||
int i;
|
int i, m = ent->GetModelIndex();
|
||||||
CBaseModelInfo *mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
|
if (MI_TRAFFICLIGHTS == m) {
|
||||||
float x = mi->Get2dEffect(0)->pos.x;
|
CBaseModelInfo* mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
|
||||||
float yMin = mi->Get2dEffect(0)->pos.y;
|
float x = mi->Get2dEffect(0)->pos.x;
|
||||||
float yMax = mi->Get2dEffect(0)->pos.y;
|
float yMin = mi->Get2dEffect(0)->pos.y;
|
||||||
float zMin = mi->Get2dEffect(0)->pos.z;
|
float yMax = mi->Get2dEffect(0)->pos.y;
|
||||||
float zMax = mi->Get2dEffect(0)->pos.z;
|
float zMin = mi->Get2dEffect(0)->pos.z;
|
||||||
for(i = 1; i < 6; i++){
|
float zMax = mi->Get2dEffect(0)->pos.z;
|
||||||
assert(mi->Get2dEffect(i));
|
for (i = 1; i < 6; i++) {
|
||||||
yMin = Min(yMin, mi->Get2dEffect(i)->pos.y);
|
assert(mi->Get2dEffect(i));
|
||||||
yMax = Max(yMax, mi->Get2dEffect(i)->pos.y);
|
yMin = Min(yMin, mi->Get2dEffect(i)->pos.y);
|
||||||
zMin = Min(zMin, mi->Get2dEffect(i)->pos.z);
|
yMax = Max(yMax, mi->Get2dEffect(i)->pos.y);
|
||||||
zMax = Max(zMax, mi->Get2dEffect(i)->pos.z);
|
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, pos2;
|
CVector pos1;
|
||||||
uint8 r, g;
|
uint8 r, g;
|
||||||
int id;
|
int id;
|
||||||
switch(phase){
|
switch (phase) {
|
||||||
case CAR_LIGHTS_GREEN:
|
case CAR_LIGHTS_GREEN:
|
||||||
r = 0;
|
r = 0;
|
||||||
g = 255;
|
g = 255;
|
||||||
pos1 = ent->GetMatrix() * CVector(x, yMax, zMin);
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(2)->pos;
|
||||||
pos2 = ent->GetMatrix() * CVector(x, yMin, zMin);
|
id = 0;
|
||||||
id = 0;
|
break;
|
||||||
break;
|
case CAR_LIGHTS_YELLOW:
|
||||||
case CAR_LIGHTS_YELLOW:
|
r = 255;
|
||||||
r = 255;
|
g = 128;
|
||||||
g = 128;
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos;
|
||||||
pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin+zMax)/2.0f);
|
id = 1;
|
||||||
pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin+zMax)/2.0f);
|
break;
|
||||||
id = 1;
|
case CAR_LIGHTS_RED:
|
||||||
break;
|
r = 255;
|
||||||
case CAR_LIGHTS_RED:
|
g = 0;
|
||||||
default:
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(0)->pos;
|
||||||
r = 255;
|
id = 2;
|
||||||
g = 0;
|
break;
|
||||||
pos1 = ent->GetMatrix() * CVector(x, yMax, zMax);
|
default:
|
||||||
pos2 = ent->GetMatrix() * CVector(x, yMin, zMax);
|
r = 0;
|
||||||
id = 2;
|
g = 0;
|
||||||
break;
|
pos1 = ent->GetMatrix() * mi->Get2dEffect(1)->pos;
|
||||||
|
id = -1;
|
||||||
|
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)
|
CVector pos = (pos1 + pos2) / 2;
|
||||||
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
if (id >= 0) {
|
||||||
pos1, CVector(0.0f, 0.0f, 0.0f), 8.0f,
|
CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
||||||
r/255.0f, g/255.0f, 0/255.0f, CPointLights::FOG_NORMAL, true);
|
CBrightLights::RegisterOne(pos2, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
||||||
|
}
|
||||||
|
|
||||||
CShadows::StoreStaticShadow((uintptr)ent,
|
if (CWeather::TrafficLightBrightness > 0.5f)
|
||||||
SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1,
|
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
||||||
8.0f, 0.0f, 0.0f, -8.0f, 128,
|
pos, CVector(0.0f, 0.0f, 0.0f), 8.0f,
|
||||||
r*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
|
r / 255.0f, g / 255.0f, 0 / 255.0f, CPointLights::FOG_NORMAL, true);
|
||||||
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)
|
if (CWeather::TrafficLightBrightness > 0.05f)
|
||||||
CCoronas::RegisterCorona((uintptr)ent + id,
|
CShadows::StoreStaticShadow((uintptr)ent,
|
||||||
r*CTimeCycle::GetSpriteBrightness()*0.7f,
|
SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos,
|
||||||
g*CTimeCycle::GetSpriteBrightness()*0.7f,
|
8.0f, 0.0f, 0.0f, -8.0f, 128,
|
||||||
0*CTimeCycle::GetSpriteBrightness()*0.7f,
|
r * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
255,
|
g * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
pos1, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f,
|
0 * CTimeCycle::GetLightOnGroundBrightness() * CWeather::TrafficLightBrightness / 8.0f,
|
||||||
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
12.0f, 1.0f, 40.0f, false, 0.0f);
|
||||||
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);
|
if (id >= 0) {
|
||||||
CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
if (DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f)
|
||||||
|
CCoronas::RegisterCorona((uintptr)ent + id,
|
||||||
/*
|
r * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
static const float top = -0.127f;
|
g * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
static const float bot = -0.539f;
|
0 * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
static const float mid = bot + (top-bot)/3.0f;
|
255,
|
||||||
static const float left = 1.256f;
|
pos1, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f,
|
||||||
static const float right = 0.706f;
|
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
||||||
phase = CTrafficLights::LightForPeds();
|
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||||
if(phase == PED_LIGHTS_DONT_WALK){
|
else
|
||||||
CVector p0(2.7f, right, top);
|
CCoronas::RegisterCorona((uintptr)ent + id,
|
||||||
CVector p1(2.7f, left, top);
|
r * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
CVector p2(2.7f, right, mid);
|
g * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
CVector p3(2.7f, left, mid);
|
0 * CTimeCycle::GetSpriteBrightness() * 0.7f,
|
||||||
CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3,
|
255,
|
||||||
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
|
pos2, 1.75f * CTimeCycle::GetSpriteSize(), 50.0f,
|
||||||
SHINYTEXT_WALK, 255, 0, 0, 60.0f);
|
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
||||||
}else if(phase == PED_LIGHTS_WALK || CTimer::GetTimeInMilliseconds() & 0x100){
|
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
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
|
void
|
||||||
@ -152,33 +324,28 @@ CTrafficLights::ScanForLightsOnMap(void)
|
|||||||
if (!IsTrafficLight(light->GetModelIndex()))
|
if (!IsTrafficLight(light->GetModelIndex()))
|
||||||
continue;
|
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
|
// Check cars
|
||||||
for(i = 0; i < ThePaths.m_numCarPathLinks; i++){
|
for(i = 0; i < ThePaths.m_numCarPathNodes; i++){
|
||||||
CVector2D dist = ThePaths.m_carPathLinks[i].GetPosition() - light->GetPosition();
|
if ((ThePaths.m_pathNodes[i].GetPosition() - pos1).MagnitudeSqr() >= SQR(100.0f))
|
||||||
float dotY = Abs(DotProduct2D(dist, light->GetForward())); // forward is direction of car light
|
continue;
|
||||||
float dotX = DotProduct2D(dist, light->GetRight()); // towards base of light
|
for (j = 0; j < ThePaths.m_pathNodes[i].numLinks; j++){
|
||||||
// it has to be on the correct side of the node and also not very far away
|
int con = ThePaths.ConnectedNode(ThePaths.m_pathNodes[i].firstLink + j);
|
||||||
if(dotX < 0.0f && dotX > -15.0f && dotY < 3.0f){
|
if (i < con) {
|
||||||
float dz = ThePaths.m_pathNodes[ThePaths.m_carPathLinks[i].pathNodeIndex].GetZ() -
|
CVector i_pos = ThePaths.m_pathNodes[i].GetPosition();
|
||||||
light->GetPosition().z;
|
CVector con_pos = ThePaths.m_pathNodes[con].GetPosition();
|
||||||
if(dz < 15.0f){
|
if (Abs(pos1.z - (i_pos.z + con_pos.z) / 2) < 10.0f &&
|
||||||
ThePaths.m_carPathLinks[i].trafficLightType = FindTrafficLightType(light);
|
DoesLineSegmentIntersect(pos1.x, pos1.y, pos2.x, pos2.y, i_pos.x, i_pos.y, con_pos.x, con_pos.y)) {
|
||||||
// Find two neighbour nodes of this one
|
//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 n1 = -1;
|
int link = ThePaths.m_carPathConnections[ThePaths.m_pathNodes[i].firstLink + j];
|
||||||
int n2 = -1;
|
ThePaths.m_carPathLinks[link].trafficLightType = FindTrafficLightType(light);
|
||||||
for(j = 0; j < ThePaths.m_numPathNodes; j++)
|
if (ThePaths.m_pathNodes[i].numLinks > ThePaths.m_pathNodes[con].numLinks)
|
||||||
for(l = 0; l < ThePaths.m_pathNodes[j].numLinks; l++)
|
con = i;
|
||||||
if(ThePaths.m_carPathConnections[ThePaths.m_pathNodes[j].firstLink + l] == i){
|
if (ThePaths.m_carPathLinks[link].pathNodeIndex != con)
|
||||||
if(n1 == -1)
|
ThePaths.m_carPathLinks[link].trafficLightDirection = true;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,15 +376,18 @@ bool
|
|||||||
CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
||||||
{
|
{
|
||||||
int node, type;
|
int node, type;
|
||||||
|
bool direction;
|
||||||
|
|
||||||
node = vehicle->AutoPilot.m_nNextPathNodeInfo;
|
node = vehicle->AutoPilot.m_nNextPathNodeInfo;
|
||||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||||
|
direction = ThePaths.m_carPathLinks[node].trafficLightDirection;
|
||||||
|
|
||||||
if(type){
|
if(type){
|
||||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) &&
|
if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) &&
|
||||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode))
|
(!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode))
|
||||||
if(alwaysStop ||
|
if(alwaysStop ||
|
||||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
type == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
||||||
ThePaths.m_carPathLinks[node].GetDirection());
|
ThePaths.m_carPathLinks[node].GetDirection());
|
||||||
if(vehicle->AutoPilot.m_nNextDirection == -1){
|
if(vehicle->AutoPilot.m_nNextDirection == -1){
|
||||||
@ -232,12 +402,13 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
|||||||
|
|
||||||
node = vehicle->AutoPilot.m_nCurrentPathNodeInfo;
|
node = vehicle->AutoPilot.m_nCurrentPathNodeInfo;
|
||||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||||
|
direction = ThePaths.m_carPathLinks[node].trafficLightDirection;
|
||||||
if(type){
|
if(type){
|
||||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) &&
|
if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) &&
|
||||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode))
|
(!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode))
|
||||||
if(alwaysStop ||
|
if(alwaysStop ||
|
||||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
type == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
||||||
ThePaths.m_carPathLinks[node].GetDirection());
|
ThePaths.m_carPathLinks[node].GetDirection());
|
||||||
if(vehicle->AutoPilot.m_nCurrentDirection == -1){
|
if(vehicle->AutoPilot.m_nCurrentDirection == -1){
|
||||||
@ -253,12 +424,13 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
|||||||
if(vehicle->GetStatus() == STATUS_PHYSICS){
|
if(vehicle->GetStatus() == STATUS_PHYSICS){
|
||||||
node = vehicle->AutoPilot.m_nPreviousPathNodeInfo;
|
node = vehicle->AutoPilot.m_nPreviousPathNodeInfo;
|
||||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||||
|
direction = ThePaths.m_carPathLinks[node].trafficLightDirection;
|
||||||
if(type){
|
if(type){
|
||||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) &&
|
if((direction || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) &&
|
||||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode))
|
(!direction || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode))
|
||||||
if(alwaysStop ||
|
if(alwaysStop ||
|
||||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
type == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
type == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].GetPosition(),
|
||||||
ThePaths.m_carPathLinks[node].GetDirection());
|
ThePaths.m_carPathLinks[node].GetDirection());
|
||||||
if(vehicle->AutoPilot.m_nPreviousDirection == -1){
|
if(vehicle->AutoPilot.m_nPreviousDirection == -1){
|
||||||
@ -348,3 +520,19 @@ CTrafficLights::LightForCars2(void)
|
|||||||
else
|
else
|
||||||
return CAR_LIGHTS_RED;
|
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);
|
||||||
|
}
|
||||||
|
@ -10,7 +10,8 @@ enum {
|
|||||||
|
|
||||||
CAR_LIGHTS_GREEN = 0,
|
CAR_LIGHTS_GREEN = 0,
|
||||||
CAR_LIGHTS_YELLOW,
|
CAR_LIGHTS_YELLOW,
|
||||||
CAR_LIGHTS_RED
|
CAR_LIGHTS_RED,
|
||||||
|
CAR_LIGHTS_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTrafficLights
|
class CTrafficLights
|
||||||
@ -24,6 +25,8 @@ public:
|
|||||||
static uint8 LightForPeds(void);
|
static uint8 LightForPeds(void);
|
||||||
static uint8 LightForCars1(void);
|
static uint8 LightForCars1(void);
|
||||||
static uint8 LightForCars2(void);
|
static uint8 LightForCars2(void);
|
||||||
|
static uint8 LightForCars1_Visual(void);
|
||||||
|
static uint8 LightForCars2_Visual(void);
|
||||||
static bool ShouldCarStopForLight(CVehicle*, bool);
|
static bool ShouldCarStopForLight(CVehicle*, bool);
|
||||||
static bool ShouldCarStopForBridge(CVehicle*);
|
static bool ShouldCarStopForBridge(CVehicle*);
|
||||||
};
|
};
|
||||||
|
@ -53,6 +53,9 @@ public:
|
|||||||
CVector2D operator/(float t) const {
|
CVector2D operator/(float t) const {
|
||||||
return CVector2D(x/t, y/t);
|
return CVector2D(x/t, y/t);
|
||||||
}
|
}
|
||||||
|
CVector2D operator-() const {
|
||||||
|
return CVector2D(-x, -y);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline float
|
inline float
|
||||||
|
@ -387,6 +387,8 @@ CMovingThing CMovingThings::EndCloseList;
|
|||||||
int16 CMovingThings::Num;
|
int16 CMovingThings::Num;
|
||||||
CMovingThing CMovingThings::aMovingThings[NUMMOVINGTHINGS];
|
CMovingThing CMovingThings::aMovingThings[NUMMOVINGTHINGS];
|
||||||
|
|
||||||
|
int32 CScrollBar::TonightsEvent;
|
||||||
|
|
||||||
void CMovingThings::Init()
|
void CMovingThings::Init()
|
||||||
{
|
{
|
||||||
CPlaneTrails::Init();
|
CPlaneTrails::Init();
|
||||||
@ -1603,7 +1605,7 @@ void CScriptPath::Update(void) {
|
|||||||
|
|
||||||
void CScriptPath::Clear(void) {
|
void CScriptPath::Clear(void) {
|
||||||
if (m_pNode)
|
if (m_pNode)
|
||||||
delete m_pNode;
|
delete[] m_pNode;
|
||||||
m_pNode = nil;
|
m_pNode = nil;
|
||||||
m_numNodes = 0;
|
m_numNodes = 0;
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
|
@ -169,6 +169,9 @@ private:
|
|||||||
uint8 m_uBlue;
|
uint8 m_uBlue;
|
||||||
float m_fScale;
|
float m_fScale;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static int TonightsEvent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetVisibility(bool visible) { m_bVisible = visible; }
|
void SetVisibility(bool visible) { m_bVisible = visible; }
|
||||||
bool IsVisible() { return m_bVisible; }
|
bool IsVisible() { return m_bVisible; }
|
||||||
|
@ -54,7 +54,17 @@ enum eWeaponType
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TOTAL_WEAPON_SLOTS = 10,
|
WEAPONSLOT_UNARMED = 0,
|
||||||
|
WEAPONSLOT_MELEE,
|
||||||
|
WEAPONSLOT_PROJECTILE,
|
||||||
|
WEAPONSLOT_HANDGUN,
|
||||||
|
WEAPONSLOT_SHOTGUN,
|
||||||
|
WEAPONSLOT_SUBMACHINEGUN,
|
||||||
|
WEAPONSLOT_RIFLE,
|
||||||
|
WEAPONSLOT_HEAVY,
|
||||||
|
WEAPONSLOT_SNIPER,
|
||||||
|
WEAPONSLOT_OTHER,
|
||||||
|
TOTAL_WEAPON_SLOTS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eWeaponFire {
|
enum eWeaponFire {
|
||||||
|
Loading…
Reference in New Issue
Block a user