1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-12-25 01:46:19 +01:00

Fix drawing bug

This commit is contained in:
Miloslav Číž 2018-09-05 19:49:39 +02:00
parent 8435ddadca
commit 7b914e0d5a

View file

@ -671,6 +671,9 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
int_maybe32_t wallScreenHeightNoClamp = z2Screen - z1ScreenNoClamp;
wallScreenHeightNoClamp = wallScreenHeightNoClamp != 0 ?
wallScreenHeightNoClamp : 1;
z2Screen = clamp(z2Screen,0,_camResYLimit);
int_maybe32_t z2ScreenCeil = _middleRow - perspectiveScale(
@ -679,6 +682,9 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
int_maybe32_t wallScreenHeightCeilNoClamp =
z2ScreenCeil - z1ScreenCeilNoClamp;
wallScreenHeightCeilNoClamp = wallScreenHeightCeilNoClamp != 0 ?
wallScreenHeightCeilNoClamp : 1;
z2ScreenCeil = clamp(z2ScreenCeil,0,_camResYLimit);
int_maybe32_t zTop = z1Screen < z2Screen ? z1Screen : z2Screen;
@ -703,6 +709,9 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
_pixelFunction(p);
}
if (z1Screen < y)
y = z1Screen;
// draw ceiling until wall
p.isFloor = 0;
@ -719,6 +728,9 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
}
}
if (z1ScreenCeil > y2)
y2 = z1ScreenCeil;
// draw floor wall
p.isWall = 1;