mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-23 20:49:57 +01:00
Fix drawing bug
This commit is contained in:
parent
8435ddadca
commit
7b914e0d5a
1 changed files with 12 additions and 0 deletions
12
raycastlib.h
12
raycastlib.h
|
@ -671,6 +671,9 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
|
|
||||||
int_maybe32_t wallScreenHeightNoClamp = z2Screen - z1ScreenNoClamp;
|
int_maybe32_t wallScreenHeightNoClamp = z2Screen - z1ScreenNoClamp;
|
||||||
|
|
||||||
|
wallScreenHeightNoClamp = wallScreenHeightNoClamp != 0 ?
|
||||||
|
wallScreenHeightNoClamp : 1;
|
||||||
|
|
||||||
z2Screen = clamp(z2Screen,0,_camResYLimit);
|
z2Screen = clamp(z2Screen,0,_camResYLimit);
|
||||||
|
|
||||||
int_maybe32_t z2ScreenCeil = _middleRow - perspectiveScale(
|
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 =
|
int_maybe32_t wallScreenHeightCeilNoClamp =
|
||||||
z2ScreenCeil - z1ScreenCeilNoClamp;
|
z2ScreenCeil - z1ScreenCeilNoClamp;
|
||||||
|
|
||||||
|
wallScreenHeightCeilNoClamp = wallScreenHeightCeilNoClamp != 0 ?
|
||||||
|
wallScreenHeightCeilNoClamp : 1;
|
||||||
|
|
||||||
z2ScreenCeil = clamp(z2ScreenCeil,0,_camResYLimit);
|
z2ScreenCeil = clamp(z2ScreenCeil,0,_camResYLimit);
|
||||||
|
|
||||||
int_maybe32_t zTop = z1Screen < z2Screen ? z1Screen : z2Screen;
|
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);
|
_pixelFunction(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (z1Screen < y)
|
||||||
|
y = z1Screen;
|
||||||
|
|
||||||
// draw ceiling until wall
|
// draw ceiling until wall
|
||||||
|
|
||||||
p.isFloor = 0;
|
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
|
// draw floor wall
|
||||||
|
|
||||||
p.isWall = 1;
|
p.isWall = 1;
|
||||||
|
|
Loading…
Reference in a new issue