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

Method GetWaterSurfaceHeight

TombEngine/Game/collision/Point.cpp:175–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173 }
174
175 int PointCollisionData::GetWaterSurfaceHeight()
176 {
177 if (_waterSurfaceHeight.has_value())
178 return *_waterSurfaceHeight;
179
180 auto* room = &g_Level.Rooms[_roomNumber];
181 const auto* sector = Room::GetSector(room, _position.x - room->Position.x, _position.z - room->Position.z);
182
183 // Set water surface height.
184 bool isBelow = !TestEnvironment(ENV_FLAG_WATER, room);
185 while (sector->GetNextRoomNumber(_position, isBelow).has_value())
186 {
187 room = &g_Level.Rooms[sector->GetNextRoomNumber(_position, isBelow).value_or(sector->RoomNumber)];
188 if (isBelow == TestEnvironment(ENV_FLAG_WATER, room))
189 {
190 _waterSurfaceHeight = sector->GetSurfaceHeight(_position.x, _position.z, isBelow);
191 return *_waterSurfaceHeight;
192 }
193
194 sector = Room::GetSector(room, _position.x - room->Position.x, _position.z - room->Position.z);
195 }
196
197 _waterSurfaceHeight = NO_HEIGHT;
198 return *_waterSurfaceHeight;
199 }
200
201 int PointCollisionData::GetWaterBottomHeight()
202 {

Callers 8

EagleControlFunction · 0.45
DoVehicleWaterMovementFunction · 0.45
ScubaControlFunction · 0.45
UPVControlFunction · 0.45
GetPushableCollisionFunction · 0.45
ControlWaterfallFunction · 0.45
CreaturePathfindFunction · 0.45
UpdateWeatherMethod · 0.45

Calls 5

GetSectorFunction · 0.85
TestEnvironmentFunction · 0.85
GetNextRoomNumberMethod · 0.80
GetSurfaceHeightMethod · 0.80
has_valueMethod · 0.45

Tested by

no test coverage detected