Skip to content

Commit b070e63

Browse files
meji46Shauren
authored andcommitted
Core/AreaTriggers: Fix triggering of client areatriggers for some shapes
1 parent 38e99e1 commit b070e63

File tree

17 files changed

+324
-112
lines changed

17 files changed

+324
-112
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
--
2+
-- Table structure for table `location`
3+
--
4+
DROP TABLE IF EXISTS `location`;
5+
CREATE TABLE `location` (
6+
`ID` int unsigned NOT NULL DEFAULT '0',
7+
`PosX` float NOT NULL DEFAULT '0',
8+
`PosY` float NOT NULL DEFAULT '0',
9+
`PosZ` float NOT NULL DEFAULT '0',
10+
`Rot1` float NOT NULL DEFAULT '0',
11+
`Rot2` float NOT NULL DEFAULT '0',
12+
`Rot3` float NOT NULL DEFAULT '0',
13+
`VerifiedBuild` int NOT NULL DEFAULT '0',
14+
PRIMARY KEY (`ID`,`VerifiedBuild`)
15+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
16+
17+
--
18+
-- Table structure for table `path`
19+
--
20+
DROP TABLE IF EXISTS `path`;
21+
CREATE TABLE `path` (
22+
`ID` int unsigned NOT NULL DEFAULT '0',
23+
`Type` tinyint unsigned NOT NULL DEFAULT '0',
24+
`SplineType` tinyint unsigned NOT NULL DEFAULT '0',
25+
`Red` tinyint unsigned NOT NULL DEFAULT '0',
26+
`Green` tinyint unsigned NOT NULL DEFAULT '0',
27+
`Blue` tinyint unsigned NOT NULL DEFAULT '0',
28+
`Alpha` tinyint unsigned NOT NULL DEFAULT '0',
29+
`Flags` tinyint unsigned NOT NULL DEFAULT '0',
30+
`VerifiedBuild` int NOT NULL DEFAULT '0',
31+
PRIMARY KEY (`ID`,`VerifiedBuild`)
32+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
33+
34+
--
35+
-- Table structure for table `path_node`
36+
--
37+
DROP TABLE IF EXISTS `path_node`;
38+
CREATE TABLE `path_node` (
39+
`ID` int unsigned NOT NULL DEFAULT '0',
40+
`PathID` smallint unsigned NOT NULL DEFAULT '0',
41+
`Sequence` smallint NOT NULL DEFAULT '0',
42+
`LocationID` int NOT NULL DEFAULT '0',
43+
`VerifiedBuild` int NOT NULL DEFAULT '0',
44+
PRIMARY KEY (`ID`,`VerifiedBuild`)
45+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

src/server/database/Database/Implementation/HotfixDatabase.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,10 @@ void HotfixDatabaseConnection::DoPrepareStatements()
11101110
"Coefficient3, Coefficient4 FROM liquid_type WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
11111111
PREPARE_MAX_ID_STMT(HOTFIX_SEL_LIQUID_TYPE, "SELECT MAX(ID) + 1 FROM liquid_type", CONNECTION_SYNCH);
11121112

1113+
// Location.db2
1114+
PrepareStatement(HOTFIX_SEL_LOCATION, "SELECT ID, PosX, PosY, PosZ, Rot1, Rot2, Rot3 FROM location WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
1115+
PREPARE_MAX_ID_STMT(HOTFIX_SEL_LOCATION, "SELECT MAX(ID) + 1 FROM location", CONNECTION_SYNCH);
1116+
11131117
// Lock.db2
11141118
PrepareStatement(HOTFIX_SEL_LOCK, "SELECT ID, Flags, Index1, Index2, Index3, Index4, Index5, Index6, Index7, Index8, Skill1, Skill2, Skill3, "
11151119
"Skill4, Skill5, Skill6, Skill7, Skill8, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8, Action1, Action2, Action3, Action4, Action5, "
@@ -1223,6 +1227,14 @@ void HotfixDatabaseConnection::DoPrepareStatements()
12231227
" WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
12241228
PREPARE_MAX_ID_STMT(HOTFIX_SEL_PARAGON_REPUTATION, "SELECT MAX(ID) + 1 FROM paragon_reputation", CONNECTION_SYNCH);
12251229

1230+
// Path.db2
1231+
PrepareStatement(HOTFIX_SEL_PATH, "SELECT ID, Type, SplineType, Red, Green, Blue, Alpha, Flags FROM path WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
1232+
PREPARE_MAX_ID_STMT(HOTFIX_SEL_PATH, "SELECT MAX(ID) + 1 FROM path", CONNECTION_SYNCH);
1233+
1234+
// PathNode.db2
1235+
PrepareStatement(HOTFIX_SEL_PATH_NODE, "SELECT ID, PathID, Sequence, LocationID FROM path_node WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
1236+
PREPARE_MAX_ID_STMT(HOTFIX_SEL_PATH_NODE, "SELECT MAX(ID) + 1 FROM path_node", CONNECTION_SYNCH);
1237+
12261238
// Phase.db2
12271239
PrepareStatement(HOTFIX_SEL_PHASE, "SELECT ID, Flags FROM phase WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH);
12281240
PREPARE_MAX_ID_STMT(HOTFIX_SEL_PHASE, "SELECT MAX(ID) + 1 FROM phase", CONNECTION_SYNCH);

src/server/database/Database/Implementation/HotfixDatabase.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,9 @@ enum HotfixDatabaseStatements : uint32
637637
HOTFIX_SEL_LIQUID_TYPE,
638638
HOTFIX_SEL_LIQUID_TYPE_MAX_ID,
639639

640+
HOTFIX_SEL_LOCATION,
641+
HOTFIX_SEL_LOCATION_MAX_ID,
642+
640643
HOTFIX_SEL_LOCK,
641644
HOTFIX_SEL_LOCK_MAX_ID,
642645

@@ -706,6 +709,12 @@ enum HotfixDatabaseStatements : uint32
706709
HOTFIX_SEL_PARAGON_REPUTATION,
707710
HOTFIX_SEL_PARAGON_REPUTATION_MAX_ID,
708711

712+
HOTFIX_SEL_PATH,
713+
HOTFIX_SEL_PATH_MAX_ID,
714+
715+
HOTFIX_SEL_PATH_NODE,
716+
HOTFIX_SEL_PATH_NODE_MAX_ID,
717+
709718
HOTFIX_SEL_PHASE,
710719
HOTFIX_SEL_PHASE_MAX_ID,
711720

src/server/game/DataStores/DB2LoadInfo.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3601,6 +3601,22 @@ struct LiquidTypeLoadInfo
36013601
static constexpr DB2LoadInfo Instance{ Fields, 56, &LiquidTypeMeta::Instance, HOTFIX_SEL_LIQUID_TYPE };
36023602
};
36033603

3604+
struct LocationLoadInfo
3605+
{
3606+
static constexpr DB2FieldMeta Fields[7] =
3607+
{
3608+
{ false, FT_INT, "ID" },
3609+
{ false, FT_FLOAT, "PosX" },
3610+
{ false, FT_FLOAT, "PosY" },
3611+
{ false, FT_FLOAT, "PosZ" },
3612+
{ false, FT_FLOAT, "Rot1" },
3613+
{ false, FT_FLOAT, "Rot2" },
3614+
{ false, FT_FLOAT, "Rot3" },
3615+
};
3616+
3617+
static constexpr DB2LoadInfo Instance{ Fields, 7, &LocationMeta::Instance, HOTFIX_SEL_LOCATION };
3618+
};
3619+
36043620
struct LockLoadInfo
36053621
{
36063622
static constexpr DB2FieldMeta Fields[34] =
@@ -3964,6 +3980,36 @@ struct ParagonReputationLoadInfo
39643980
static constexpr DB2LoadInfo Instance{ Fields, 4, &ParagonReputationMeta::Instance, HOTFIX_SEL_PARAGON_REPUTATION };
39653981
};
39663982

3983+
struct PathLoadInfo
3984+
{
3985+
static constexpr DB2FieldMeta Fields[8] =
3986+
{
3987+
{ false, FT_INT, "ID" },
3988+
{ false, FT_BYTE, "Type" },
3989+
{ false, FT_BYTE, "SplineType" },
3990+
{ false, FT_BYTE, "Red" },
3991+
{ false, FT_BYTE, "Green" },
3992+
{ false, FT_BYTE, "Blue" },
3993+
{ false, FT_BYTE, "Alpha" },
3994+
{ false, FT_BYTE, "Flags" },
3995+
};
3996+
3997+
static constexpr DB2LoadInfo Instance{ Fields, 8, &PathMeta::Instance, HOTFIX_SEL_PATH };
3998+
};
3999+
4000+
struct PathNodeLoadInfo
4001+
{
4002+
static constexpr DB2FieldMeta Fields[4] =
4003+
{
4004+
{ false, FT_INT, "ID" },
4005+
{ false, FT_SHORT, "PathID" },
4006+
{ true, FT_SHORT, "Sequence" },
4007+
{ true, FT_INT, "LocationID" },
4008+
};
4009+
4010+
static constexpr DB2LoadInfo Instance{ Fields, 4, &PathNodeMeta::Instance, HOTFIX_SEL_PATH_NODE };
4011+
};
4012+
39674013
struct PhaseLoadInfo
39684014
{
39694015
static constexpr DB2FieldMeta Fields[2] =

src/server/game/DataStores/DB2Stores.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ DB2Storage<LanguagesEntry> sLanguagesStore("Languages.db2",
224224
DB2Storage<LFGDungeonsEntry> sLFGDungeonsStore("LFGDungeons.db2", &LfgDungeonsLoadInfo::Instance);
225225
DB2Storage<LightEntry> sLightStore("Light.db2", &LightLoadInfo::Instance);
226226
DB2Storage<LiquidTypeEntry> sLiquidTypeStore("LiquidType.db2", &LiquidTypeLoadInfo::Instance);
227+
DB2Storage<LocationEntry> sLocationStore("Location.db2", &LocationLoadInfo::Instance);
227228
DB2Storage<LockEntry> sLockStore("Lock.db2", &LockLoadInfo::Instance);
228229
DB2Storage<MailTemplateEntry> sMailTemplateStore("MailTemplate.db2", &MailTemplateLoadInfo::Instance);
229230
DB2Storage<MapEntry> sMapStore("Map.db2", &MapLoadInfo::Instance);
@@ -245,6 +246,8 @@ DB2Storage<NamesReservedLocaleEntry> sNamesReservedLocaleStore("Names
245246
DB2Storage<NumTalentsAtLevelEntry> sNumTalentsAtLevelStore("NumTalentsAtLevel.db2", &NumTalentsAtLevelLoadInfo::Instance);
246247
DB2Storage<OverrideSpellDataEntry> sOverrideSpellDataStore("OverrideSpellData.db2", &OverrideSpellDataLoadInfo::Instance);
247248
DB2Storage<ParagonReputationEntry> sParagonReputationStore("ParagonReputation.db2", &ParagonReputationLoadInfo::Instance);
249+
DB2Storage<PathEntry> sPathStore("Path.db2", &PathLoadInfo::Instance);
250+
DB2Storage<PathNodeEntry> sPathNodeStore("PathNode.db2", &PathNodeLoadInfo::Instance);
248251
DB2Storage<PhaseEntry> sPhaseStore("Phase.db2", &PhaseLoadInfo::Instance);
249252
DB2Storage<PhaseXPhaseGroupEntry> sPhaseXPhaseGroupStore("PhaseXPhaseGroup.db2", &PhaseXPhaseGroupLoadInfo::Instance);
250253
DB2Storage<PlayerConditionEntry> sPlayerConditionStore("PlayerCondition.db2", &PlayerConditionLoadInfo::Instance);
@@ -411,6 +414,7 @@ typedef std::unordered_map<uint32, DB2Manager::MountTypeXCapabilitySet> MountCap
411414
typedef std::unordered_map<uint32, DB2Manager::MountXDisplayContainer> MountDisplaysCointainer;
412415
typedef std::unordered_map<uint32, std::array<std::vector<NameGenEntry const*>, 2>> NameGenContainer;
413416
typedef std::array<std::vector<Trinity::wregex>, TOTAL_LOCALES + 1> NameValidationRegexContainer;
417+
typedef std::unordered_map<uint32 /*pathID*/, std::vector<DBCPosition3D>> PathNodesContainer;
414418
typedef std::unordered_map<uint32, std::vector<uint32>> PhaseGroupContainer;
415419
typedef std::array<PowerTypeEntry const*, MAX_POWERS> PowerTypesContainer;
416420
typedef std::unordered_map<uint32, std::pair<std::vector<QuestPackageItemEntry const*>, std::vector<QuestPackageItemEntry const*>>> QuestPackageItemContainer;
@@ -492,6 +496,7 @@ namespace
492496
NameGenContainer _nameGenData;
493497
NameValidationRegexContainer _nameValidators;
494498
std::unordered_map<uint32, ParagonReputationEntry const*> _paragonReputations;
499+
PathNodesContainer _pathNodes;
495500
PhaseGroupContainer _phasesByGroup;
496501
PowerTypesContainer _powerTypes;
497502
std::unordered_map<uint32, uint8> _pvpItemBonus;
@@ -828,6 +833,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
828833
LOAD_DB2(sLFGDungeonsStore);
829834
LOAD_DB2(sLightStore);
830835
LOAD_DB2(sLiquidTypeStore);
836+
LOAD_DB2(sLocationStore);
831837
LOAD_DB2(sLockStore);
832838
LOAD_DB2(sMailTemplateStore);
833839
LOAD_DB2(sMapStore);
@@ -849,6 +855,8 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
849855
LOAD_DB2(sNumTalentsAtLevelStore);
850856
LOAD_DB2(sOverrideSpellDataStore);
851857
LOAD_DB2(sParagonReputationStore);
858+
LOAD_DB2(sPathStore);
859+
LOAD_DB2(sPathNodeStore);
852860
LOAD_DB2(sPhaseStore);
853861
LOAD_DB2(sPhaseXPhaseGroupStore);
854862
LOAD_DB2(sPlayerConditionStore);
@@ -1396,6 +1404,26 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
13961404
if (sFactionStore.HasRecord(paragonReputation->FactionID))
13971405
_paragonReputations[paragonReputation->FactionID] = paragonReputation;
13981406

1407+
{
1408+
std::unordered_map<uint32 /*pathID*/, std::vector<PathNodeEntry const*>> unsortedNodes;
1409+
for (PathNodeEntry const* pathNode : sPathNodeStore)
1410+
if (sPathStore.LookupEntry(pathNode->PathID))
1411+
if (sLocationStore.LookupEntry(pathNode->LocationID))
1412+
unsortedNodes[pathNode->PathID].push_back(pathNode);
1413+
1414+
for (auto& [pathId, pathNodes] : unsortedNodes)
1415+
{
1416+
std::sort(pathNodes.begin(), pathNodes.end(), [](PathNodeEntry const* node1, PathNodeEntry const* node2) { return node1->Sequence < node2->Sequence; });
1417+
std::vector<DBCPosition3D>& nodes = _pathNodes[pathId];
1418+
nodes.resize(pathNodes.size());
1419+
std::transform(pathNodes.begin(), pathNodes.end(), nodes.begin(), [](PathNodeEntry const* node)
1420+
{
1421+
LocationEntry const* location = sLocationStore.AssertEntry(node->LocationID);
1422+
return location->Pos;
1423+
});
1424+
}
1425+
}
1426+
13991427
for (PhaseXPhaseGroupEntry const* group : sPhaseXPhaseGroupStore)
14001428
if (PhaseEntry const* phase = sPhaseStore.LookupEntry(group->PhaseID))
14011429
_phasesByGroup[group->PhaseGroupID].push_back(phase->ID);
@@ -2787,6 +2815,11 @@ ParagonReputationEntry const* DB2Manager::GetParagonReputation(uint32 factionId)
27872815
return Trinity::Containers::MapGetValuePtr(_paragonReputations, factionId);
27882816
}
27892817

2818+
std::vector<DBCPosition3D> const* DB2Manager::GetNodesForPath(uint32 pathId) const
2819+
{
2820+
return Trinity::Containers::MapGetValuePtr(_pathNodes, pathId);
2821+
}
2822+
27902823
PVPDifficultyEntry const* DB2Manager::GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
27912824
{
27922825
PVPDifficultyEntry const* maxEntry = nullptr; // used for level > max listed level case

src/server/game/DataStores/DB2Stores.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ TC_GAME_API extern DB2Storage<LanguagesEntry> sLanguagesSt
181181
TC_GAME_API extern DB2Storage<LFGDungeonsEntry> sLFGDungeonsStore;
182182
TC_GAME_API extern DB2Storage<LightEntry> sLightStore;
183183
TC_GAME_API extern DB2Storage<LiquidTypeEntry> sLiquidTypeStore;
184+
TC_GAME_API extern DB2Storage<LocationEntry> sLocationStore;
184185
TC_GAME_API extern DB2Storage<LockEntry> sLockStore;
185186
TC_GAME_API extern DB2Storage<MailTemplateEntry> sMailTemplateStore;
186187
TC_GAME_API extern DB2Storage<MapEntry> sMapStore;
@@ -194,6 +195,8 @@ TC_GAME_API extern DB2Storage<MovieEntry> sMovieStore;
194195
TC_GAME_API extern DB2Storage<MythicPlusSeasonEntry> sMythicPlusSeasonStore;
195196
TC_GAME_API extern DB2Storage<OverrideSpellDataEntry> sOverrideSpellDataStore;
196197
TC_GAME_API extern DB2Storage<ParagonReputationEntry> sParagonReputationStore;
198+
TC_GAME_API extern DB2Storage<PathEntry> sPathStore;
199+
TC_GAME_API extern DB2Storage<PathNodeEntry> sPathNodeStore;
197200
TC_GAME_API extern DB2Storage<PhaseEntry> sPhaseStore;
198201
TC_GAME_API extern DB2Storage<PlayerConditionEntry> sPlayerConditionStore;
199202
TC_GAME_API extern DB2Storage<PowerDisplayEntry> sPowerDisplayStore;
@@ -492,6 +495,7 @@ class TC_GAME_API DB2Manager
492495
ResponseCodes ValidateName(std::wstring const& name, LocaleConstant locale) const;
493496
static int32 GetNumTalentsAtLevel(uint32 level, Classes playerClass);
494497
ParagonReputationEntry const* GetParagonReputation(uint32 factionId) const;
498+
std::vector<DBCPosition3D> const* GetNodesForPath(uint32 pathId) const;
495499
std::vector<uint32> const* GetPhasesForGroup(uint32 group) const;
496500
PowerTypeEntry const* GetPowerTypeEntry(Powers power) const;
497501
PowerTypeEntry const* GetPowerTypeByName(std::string const& name) const;

src/server/game/DataStores/DB2Structure.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,6 +2679,13 @@ struct LiquidTypeEntry
26792679
std::array<float, 4> Coefficient;
26802680
};
26812681

2682+
struct LocationEntry
2683+
{
2684+
uint32 ID;
2685+
DBCPosition3D Pos;
2686+
std::array<float, 3> Rot;
2687+
};
2688+
26822689
#define MAX_LOCK_CASE 8
26832690

26842691
struct LockEntry
@@ -2977,6 +2984,26 @@ struct ParagonReputationEntry
29772984
int32 QuestID;
29782985
};
29792986

2987+
struct PathEntry
2988+
{
2989+
uint32 ID;
2990+
uint8 Type;
2991+
uint8 SplineType;
2992+
uint8 Red;
2993+
uint8 Green;
2994+
uint8 Blue;
2995+
uint8 Alpha;
2996+
uint8 Flags;
2997+
};
2998+
2999+
struct PathNodeEntry
3000+
{
3001+
uint32 ID;
3002+
uint16 PathID;
3003+
int16 Sequence;
3004+
int32 LocationID;
3005+
};
3006+
29803007
struct PhaseEntry
29813008
{
29823009
uint32 ID;

src/server/game/Entities/AreaTrigger/AreaTrigger.cpp

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ void AreaTrigger::SearchUnitInPolygon(std::vector<Unit*>& targetList)
705705
{
706706
return unit->GetPositionZ() < minZ
707707
|| unit->GetPositionZ() > maxZ
708-
|| !CheckIsInPolygon2D(unit);
708+
|| !unit->IsInPolygon2D(*this, _polygonVertices);
709709
});
710710
}
711711

@@ -919,75 +919,6 @@ void AreaTrigger::UpdatePolygonVertices()
919919
_verticesUpdatePreviousOrientation = newOrientation;
920920
}
921921

922-
bool AreaTrigger::CheckIsInPolygon2D(Position const* pos) const
923-
{
924-
float testX = pos->GetPositionX();
925-
float testY = pos->GetPositionY();
926-
927-
//this method uses the ray tracing algorithm to determine if the point is in the polygon
928-
bool locatedInPolygon = false;
929-
930-
for (std::size_t vertex = 0; vertex < _polygonVertices.size(); ++vertex)
931-
{
932-
std::size_t nextVertex;
933-
934-
//repeat loop for all sets of points
935-
if (vertex == (_polygonVertices.size() - 1))
936-
{
937-
//if i is the last vertex, let j be the first vertex
938-
nextVertex = 0;
939-
}
940-
else
941-
{
942-
//for all-else, let j=(i+1)th vertex
943-
nextVertex = vertex + 1;
944-
}
945-
946-
float vertX_i = GetPositionX() + _polygonVertices[vertex].GetPositionX();
947-
float vertY_i = GetPositionY() + _polygonVertices[vertex].GetPositionY();
948-
float vertX_j = GetPositionX() + _polygonVertices[nextVertex].GetPositionX();
949-
float vertY_j = GetPositionY() + _polygonVertices[nextVertex].GetPositionY();
950-
951-
// following statement checks if testPoint.Y is below Y-coord of i-th vertex
952-
bool belowLowY = vertY_i > testY;
953-
// following statement checks if testPoint.Y is below Y-coord of i+1-th vertex
954-
bool belowHighY = vertY_j > testY;
955-
956-
/* following statement is true if testPoint.Y satisfies either (only one is possible)
957-
-->(i).Y < testPoint.Y < (i+1).Y OR
958-
-->(i).Y > testPoint.Y > (i+1).Y
959-
960-
(Note)
961-
Both of the conditions indicate that a point is located within the edges of the Y-th coordinate
962-
of the (i)-th and the (i+1)- th vertices of the polygon. If neither of the above
963-
conditions is satisfied, then it is assured that a semi-infinite horizontal line draw
964-
to the right from the testpoint will NOT cross the line that connects vertices i and i+1
965-
of the polygon
966-
*/
967-
bool withinYsEdges = belowLowY != belowHighY;
968-
969-
if (withinYsEdges)
970-
{
971-
// this is the slope of the line that connects vertices i and i+1 of the polygon
972-
float slopeOfLine = (vertX_j - vertX_i) / (vertY_j - vertY_i);
973-
974-
// this looks up the x-coord of a point lying on the above line, given its y-coord
975-
float pointOnLine = (slopeOfLine* (testY - vertY_i)) + vertX_i;
976-
977-
//checks to see if x-coord of testPoint is smaller than the point on the line with the same y-coord
978-
bool isLeftToLine = testX < pointOnLine;
979-
980-
if (isLeftToLine)
981-
{
982-
//this statement changes true to false (and vice-versa)
983-
locatedInPolygon = !locatedInPolygon;
984-
}//end if (isLeftToLine)
985-
}//end if (withinYsEdges
986-
}
987-
988-
return locatedInPolygon;
989-
}
990-
991922
bool AreaTrigger::HasOverridePosition() const
992923
{
993924
return m_areaTriggerData->OverrideMoveCurveX->OverrideActive

0 commit comments

Comments
 (0)