MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / GetNearbyStatics

Function GetNearbyStatics

TombEngine/Game/collision/Los.cpp:81–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79 }
80
81 static std::vector<StaticMesh*> GetNearbyStatics(const std::vector<int>& roomNumbers)
82 {
83 // Collect neighbor room numbers.
84 auto neighborRoomNumbers = std::set<int>{};
85 for (int roomNumber : roomNumbers)
86 {
87 const auto& room = g_Level.Rooms[roomNumber];
88 neighborRoomNumbers.insert(room.NeighborRoomNumbers.begin(), room.NeighborRoomNumbers.end());
89 }
90
91 // Run through neighbor rooms.
92 auto statics = std::vector<StaticMesh*>{};
93 for (int neighborRoomNumber : neighborRoomNumbers)
94 {
95 auto& neighborRoom = g_Level.Rooms[neighborRoomNumber];
96 if (!neighborRoom.Active())
97 continue;
98
99 // Run through statics.
100 for (auto& staticObj : neighborRoom.mesh)
101 {
102 // Check visibility.
103 if (!(staticObj.Flags & StaticMeshFlags::SM_VISIBLE))
104 continue;
105
106 // Collect static.
107 statics.push_back(&staticObj);
108 }
109 }
110
111 return statics;
112 }
113
114 LosCollisionData GetLosCollision(const Vector3& origin, int roomNumber, const Vector3& dir, float dist,
115 bool collideItemBoxes, bool collideItemSpheres, bool collideStatics)

Callers 1

GetLosCollisionFunction · 0.85

Calls 5

ActiveMethod · 0.80
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected