| 808 | } |
| 809 | |
| 810 | bool CameraCollisionBounds(GameVector* ideal, int push, bool yFirst) |
| 811 | { |
| 812 | int x = ideal->x; |
| 813 | int y = ideal->y; |
| 814 | int z = ideal->z; |
| 815 | |
| 816 | auto pointColl = GetPointCollision(Vector3i(x, y, z), ideal->RoomNumber); |
| 817 | if (yFirst) |
| 818 | { |
| 819 | int buffer = CLICK(1) - 1; |
| 820 | if ((y - buffer) < pointColl.GetCeilingHeight() && |
| 821 | (y + buffer) > pointColl.GetFloorHeight() && |
| 822 | pointColl.GetCeilingHeight() < pointColl.GetFloorHeight() && |
| 823 | pointColl.GetCeilingHeight() != NO_HEIGHT && |
| 824 | pointColl.GetFloorHeight() != NO_HEIGHT) |
| 825 | { |
| 826 | y = (pointColl.GetFloorHeight() + pointColl.GetCeilingHeight()) / 2; |
| 827 | } |
| 828 | else if ((y + buffer) > pointColl.GetFloorHeight() && |
| 829 | pointColl.GetCeilingHeight() < pointColl.GetFloorHeight() && |
| 830 | pointColl.GetCeilingHeight() != NO_HEIGHT && |
| 831 | pointColl.GetFloorHeight() != NO_HEIGHT) |
| 832 | { |
| 833 | y = pointColl.GetFloorHeight() - buffer; |
| 834 | } |
| 835 | else if ((y - buffer) < pointColl.GetCeilingHeight() && |
| 836 | pointColl.GetCeilingHeight() < pointColl.GetFloorHeight() && |
| 837 | pointColl.GetCeilingHeight() != NO_HEIGHT && |
| 838 | pointColl.GetFloorHeight() != NO_HEIGHT) |
| 839 | { |
| 840 | y = pointColl.GetCeilingHeight() + buffer; |
| 841 | } |
| 842 | } |
| 843 | |
| 844 | pointColl = GetPointCollision(Vector3i(x - push, y, z), ideal->RoomNumber); |
| 845 | if (y > pointColl.GetFloorHeight() || |
| 846 | pointColl.GetFloorHeight() == NO_HEIGHT || |
| 847 | pointColl.GetCeilingHeight() == NO_HEIGHT || |
| 848 | pointColl.GetCeilingHeight() >= pointColl.GetFloorHeight() || |
| 849 | y < pointColl.GetCeilingHeight()) |
| 850 | { |
| 851 | x = (x & (~1023)) + push; |
| 852 | } |
| 853 | |
| 854 | pointColl = GetPointCollision(Vector3i(x, y, z - push), ideal->RoomNumber); |
| 855 | if (y > pointColl.GetFloorHeight() || |
| 856 | pointColl.GetFloorHeight() == NO_HEIGHT || |
| 857 | pointColl.GetCeilingHeight() == NO_HEIGHT || |
| 858 | pointColl.GetCeilingHeight() >= pointColl.GetFloorHeight() || |
| 859 | y < pointColl.GetCeilingHeight()) |
| 860 | { |
| 861 | z = (z & (~1023)) + push; |
| 862 | } |
| 863 | |
| 864 | pointColl = GetPointCollision(Vector3i(x + push, y, z), ideal->RoomNumber); |
| 865 | if (y > pointColl.GetFloorHeight() || |
| 866 | pointColl.GetFloorHeight() == NO_HEIGHT || |
| 867 | pointColl.GetCeilingHeight() == NO_HEIGHT || |
no test coverage detected