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

Fix ceiling

This commit is contained in:
Miloslav Číž 2018-09-08 18:45:57 +02:00
parent 82305691a9
commit bdc4fc5bb7

View file

@ -657,9 +657,6 @@ Unit _floorCeilFunction(int16_t x, int16_t y)
void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray) void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
{ {
if (x == 25)
printf("------%d\n",hitCount);
int_maybe32_t y = _camResYLimit; // screen y (for floor), will only go up int_maybe32_t y = _camResYLimit; // screen y (for floor), will only go up
int_maybe32_t y2 = 0; // screen y (for ceil), will only fo down int_maybe32_t y2 = 0; // screen y (for ceil), will only fo down
@ -859,11 +856,12 @@ if (x == 25)
// draw ceiling until horizon // draw ceiling until horizon
if (_ceilFunction != 0)
{
p.isFloor = 0; p.isFloor = 0;
Unit ceilCameraDiff = absVal(worldZPrevCeil) * VERTICAL_DEPTH_MULTIPLY; Unit ceilCameraDiff =
_ceilFunction != 0 ?
absVal(worldZPrevCeil) * VERTICAL_DEPTH_MULTIPLY : UNITS_PER_SQUARE;
horizon = y > _middleRow ? _middleRow : y; horizon = y > _middleRow ? _middleRow : y;
for (int_maybe32_t i = y2; i < horizon; ++i) for (int_maybe32_t i = y2; i < horizon; ++i)
@ -872,7 +870,6 @@ if (x == 25)
p.depth = (i - _fogStartYTop) * _floorDepthStep + ceilCameraDiff; p.depth = (i - _fogStartYTop) * _floorDepthStep + ceilCameraDiff;
_pixelFunction(p); _pixelFunction(p);
} }
}
#undef VERTICAL_DEPTH_MULTIPLY #undef VERTICAL_DEPTH_MULTIPLY
} }