| 300 | } |
| 301 | |
| 302 | int PointCollisionData::GetWaterTopHeight() |
| 303 | { |
| 304 | if (_waterTopHeight.has_value()) |
| 305 | return *_waterTopHeight; |
| 306 | |
| 307 | FloorInfo* sector = nullptr; |
| 308 | auto* room = &g_Level.Rooms[_roomNumber]; |
| 309 | int roomNumber = _roomNumber; |
| 310 | |
| 311 | int adjoiningRoomNumber = NO_VALUE; |
| 312 | do |
| 313 | { |
| 314 | int x = (_position.x - room->Position.x) / BLOCK(1); |
| 315 | int z = (_position.z - room->Position.z) / BLOCK(1); |
| 316 | |
| 317 | if (z <= 0) |
| 318 | { |
| 319 | z = 0; |
| 320 | if (x < 1) |
| 321 | { |
| 322 | x = 1; |
| 323 | } |
| 324 | else if (x > (room->XSize - 2)) |
| 325 | { |
| 326 | x = room->XSize - 2; |
| 327 | } |
| 328 | } |
| 329 | else if (z >= (room->ZSize - 1)) |
| 330 | { |
| 331 | z = room->ZSize - 1; |
| 332 | if (x < 1) |
| 333 | { |
| 334 | x = 1; |
| 335 | } |
| 336 | else if (x > (room->XSize - 2)) |
| 337 | { |
| 338 | x = room->XSize - 2; |
| 339 | } |
| 340 | } |
| 341 | else if (x < 0) |
| 342 | { |
| 343 | x = 0; |
| 344 | } |
| 345 | else if (x >= room->XSize) |
| 346 | { |
| 347 | x = room->XSize - 1; |
| 348 | } |
| 349 | |
| 350 | sector = &room->Sectors[z + (x * room->ZSize)]; |
| 351 | adjoiningRoomNumber = sector->SidePortalRoomNumber; |
| 352 | |
| 353 | if (adjoiningRoomNumber != NO_VALUE) |
| 354 | { |
| 355 | roomNumber = adjoiningRoomNumber; |
| 356 | room = &g_Level.Rooms[adjoiningRoomNumber]; |
| 357 | } |
| 358 | } |
| 359 | while (adjoiningRoomNumber != NO_VALUE); |
no test coverage detected