summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/FileLoader.cpp14
-rw-r--r--src/core/Stats.cpp2
-rw-r--r--src/core/Stats.h1
-rw-r--r--src/core/World.cpp55
-rw-r--r--src/core/World.h2
5 files changed, 73 insertions, 1 deletions
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index e073b4cb..612851fb 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -956,7 +956,7 @@ CFileLoader::LoadCarPathNode(const char *line, int id, int node, bool waterPath)
void
CFileLoader::Load2dEffect(const char *line)
{
- int id, r, g, b, a, type;
+ int id, r, g, b, a, type, ptype;
float x, y, z;
char corona[32], shadow[32];
int shadowIntens, lightType, roadReflection, flare, flags, probability;
@@ -1029,6 +1029,18 @@ CFileLoader::Load2dEffect(const char *line)
effect->attractor.flags = flags;
effect->attractor.probability = probability;
break;
+ case EFFECT_PED_ATTRACTOR:
+ sscanf(line, "%d %f %f %f %d %d %d %d %d %d %f %f %f %f %f %f",
+ &id, &x, &y, &z, &r, &g, &b, &a, &type,
+ &ptype,
+ &effect->pedattr.queueDir.x,
+ &effect->pedattr.queueDir.y,
+ &effect->pedattr.queueDir.z,
+ &effect->pedattr.useDir.x,
+ &effect->pedattr.useDir.y,
+ &effect->pedattr.useDir.z);
+ effect->pedattr.type = ptype;
+ break;
}
CTxdStore::PopCurrentTxd();
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index ea934dca..d50be0d5 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -60,6 +60,7 @@ int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
int32 CStats::Sprayings;
float CStats::AutoPaintingBudget;
+int32 CStats::NoMoreHurricanes;
void CStats::Init()
{
@@ -119,6 +120,7 @@ void CStats::Init()
Sprayings = 0;
AutoPaintingBudget = 0.0f;
+ NoMoreHurricanes = 0;
}
void CStats::RegisterFastestTime(int32 index, int32 time)
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 51f1d091..bf40a5a6 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -64,6 +64,7 @@ public:
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
static int32 Sprayings;
static float AutoPaintingBudget;
+ static int32 NoMoreHurricanes;
public:
static void Init(void);
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 8c69d846..ef124c07 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -2240,3 +2240,58 @@ CWorld::UseDetonator(CEntity *pEntity)
}
CProjectileInfo::RemoveDetonatorProjectiles();
}
+
+bool
+CWorld::IsWanderPathClear(CVector const& point1, CVector const& point2, float distance, int maxSteps)
+{
+ if (Abs(point1.z - point2.z) > distance)
+ return false;
+ if (!GetIsLineOfSightClear(point1, point2, true, false, false, false, false, false, false))
+ return false;
+ CVector vecBetween = point2 - point1;
+ uint32 nSteps = Max(vecBetween.Magnitude(), maxSteps);
+ if (nSteps == 0)
+ return true;
+ vecBetween.Normalise();
+ uint32 step = 1;
+ for (step = 1; step < nSteps; step++) {
+ CVector posThisStep = point1 + vecBetween * step;
+ float level;
+ if (!CWaterLevel::GetWaterLevel(posThisStep, &level, false))
+ continue;
+ posThisStep.z = level;
+ AdvanceCurrentScanCode();
+
+ CVector vecCheckedPos(posThisStep.x, posThisStep.y, Max(point1.z, point2.z));
+ CColPoint colpoint;
+ CEntity* entity;
+ if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
+ CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
+ return false;
+ }
+
+ CVector posThisStep = point1;
+ AdvanceCurrentScanCode();
+ CVector vecCheckedPos(posThisStep.x, posThisStep.y, point1.z - 5.0f);
+
+ CColPoint colpoint;
+ CEntity* entity;
+ if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
+ CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
+ return false;
+
+ float heightNextStep = colpoint.point.z + 0.5f;
+ for (step = 1; step < nSteps; step++) {
+ CVector posThisStep = point1 + vecBetween * step;
+ posThisStep.z = heightNextStep;
+ AdvanceCurrentScanCode();
+ CVector vecCheckedPos(posThisStep.x, posThisStep.y, heightNextStep - 2.0f);
+ if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
+ CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
+ return false;
+ if (Abs(colpoint.point.z - heightNextStep) > 1.0f)
+ return false;
+ heightNextStep = colpoint.point.z + 0.5f;
+ }
+ return true;
+}
diff --git a/src/core/World.h b/src/core/World.h
index bc905bf5..89f05cfd 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -125,6 +125,8 @@ public:
static void CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY);
static void CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2);
+ static bool IsWanderPathClear(CVector const&, CVector const&, float, int);
+
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
static int GetSectorIndexX(float f) { return (int)GetSectorX(f); }