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

Function SetSectorAttribs

TombEngine/Game/collision/collide_room.cpp:139–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139static void SetSectorAttribs(CollisionPositionData& sectorAttribs, const CollisionSetupData& collSetup, PointCollisionData& pointColl,
140 const Vector3i& probePos, int realRoomNumber)
141{
142 constexpr auto ASPECT_ANGLE_DELTA_MAX = ANGLE(90.0f);
143
144 auto floorNormal = pointColl.GetFloorNormal();
145 short aspectAngle = Geometry::GetSurfaceAspectAngle(floorNormal);
146 short aspectAngleDelta = Geometry::GetShortestAngle(collSetup.ForwardAngle, aspectAngle);
147
148 if (collSetup.BlockFloorSlopeUp &&
149 sectorAttribs.FloorSlope &&
150 sectorAttribs.Floor <= STEPUP_HEIGHT &&
151 sectorAttribs.Floor >= -STEPUP_HEIGHT &&
152 abs(aspectAngleDelta) >= ASPECT_ANGLE_DELTA_MAX)
153 {
154 sectorAttribs.Floor = MAX_HEIGHT;
155 }
156 else if (collSetup.BlockFloorSlopeDown &&
157 sectorAttribs.FloorSlope &&
158 sectorAttribs.Floor <= STEPUP_HEIGHT &&
159 sectorAttribs.Floor >= -STEPUP_HEIGHT &&
160 abs(aspectAngleDelta) <= ASPECT_ANGLE_DELTA_MAX)
161 {
162 sectorAttribs.Floor = MAX_HEIGHT;
163 }
164 else if (collSetup.BlockCeilingSlope &&
165 sectorAttribs.CeilingSlope)
166 {
167 sectorAttribs.Floor = MAX_HEIGHT;
168 }
169 else if (collSetup.BlockDeathFloorDown &&
170 sectorAttribs.Floor >= CLICK(0.5f) &&
171 pointColl.GetBottomSector().Flags.Death)
172 {
173 sectorAttribs.Floor = MAX_HEIGHT;
174 }
175 else if (collSetup.BlockMonkeySwingEdge)
176 {
177 auto pointColl = GetPointCollision(probePos, realRoomNumber, Vector3::UnitY, collSetup.Height);
178 if (!pointColl.GetBottomSector().Flags.Monkeyswing)
179 sectorAttribs.Floor = MAX_HEIGHT;
180 }
181}
182
183static void HandleDiagonalShift(ItemInfo& item, CollisionInfo& coll, const Vector3i& pos, CardinalDirection quadrant, bool isRightShift)
184{

Callers 1

GetCollisionInfoFunction · 0.85

Calls 5

ANGLEFunction · 0.85
GetSurfaceAspectAngleFunction · 0.85
GetShortestAngleFunction · 0.85
GetPointCollisionFunction · 0.85
GetFloorNormalMethod · 0.45

Tested by

no test coverage detected