1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-11-24 20:59:58 +01:00

Fix drawing bug

This commit is contained in:
Miloslav Číž 2018-09-07 18:35:55 +02:00
parent f83bdf40e3
commit df8b84a0d5

View file

@ -676,6 +676,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
int_maybe32_t z1ScreenNoClamp = z1Screen; int_maybe32_t z1ScreenNoClamp = z1Screen;
z1Screen = clamp(z1Screen,0,_camResYLimit); z1Screen = clamp(z1Screen,0,_camResYLimit);
z1Screen = z1Screen > y2 ? z1Screen : y2;
int_maybe32_t z1ScreenCeil = _middleRow - perspectiveScale( int_maybe32_t z1ScreenCeil = _middleRow - perspectiveScale(
(worldZPrevCeil * _camera.resolution.y) / UNITS_PER_SQUARE,dist); (worldZPrevCeil * _camera.resolution.y) / UNITS_PER_SQUARE,dist);
@ -683,6 +684,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
int_maybe32_t z1ScreenCeilNoClamp = z1ScreenCeil; int_maybe32_t z1ScreenCeilNoClamp = z1ScreenCeil;
z1ScreenCeil = clamp(z1ScreenCeil,0,_camResYLimit); z1ScreenCeil = clamp(z1ScreenCeil,0,_camResYLimit);
z1ScreenCeil = z1ScreenCeil < y ? z1ScreenCeil : y;
int_maybe32_t z2Screen = _middleRow - perspectiveScale( int_maybe32_t z2Screen = _middleRow - perspectiveScale(
(worldZ2 * _camera.resolution.y) / UNITS_PER_SQUARE,dist); (worldZ2 * _camera.resolution.y) / UNITS_PER_SQUARE,dist);
@ -693,6 +695,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
wallScreenHeightNoClamp : 1; wallScreenHeightNoClamp : 1;
z2Screen = clamp(z2Screen,0,_camResYLimit); z2Screen = clamp(z2Screen,0,_camResYLimit);
z2Screen = z2Screen > y2 ? z2Screen : y2;
int_maybe32_t z2ScreenCeil = _middleRow - perspectiveScale( int_maybe32_t z2ScreenCeil = _middleRow - perspectiveScale(
(worldZ2Ceil * _camera.resolution.y) / UNITS_PER_SQUARE,dist); (worldZ2Ceil * _camera.resolution.y) / UNITS_PER_SQUARE,dist);
@ -704,6 +707,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
wallScreenHeightCeilNoClamp : 1; wallScreenHeightCeilNoClamp : 1;
z2ScreenCeil = clamp(z2ScreenCeil,0,_camResYLimit); z2ScreenCeil = clamp(z2ScreenCeil,0,_camResYLimit);
z2ScreenCeil = z2ScreenCeil < y ? z2ScreenCeil : y;
int_maybe32_t zTop = z1Screen < z2Screen ? z1Screen : z2Screen; int_maybe32_t zTop = z1Screen < z2Screen ? z1Screen : z2Screen;