mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-02 16:32:12 +00:00
Wallscan fix
This commit is contained in:
parent
07571da98c
commit
d5331e6095
2 changed files with 30 additions and 31 deletions
|
@ -3661,16 +3661,16 @@ void R_FillSpan_RGBA()
|
||||||
DrawerCommandQueue::QueueCommand<FillSpanRGBACommand>();
|
DrawerCommandQueue::QueueCommand<FillSpanRGBACommand>();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern FTexture *rw_pic; // For the asserts below
|
//extern FTexture *rw_pic; // For the asserts below
|
||||||
|
|
||||||
DWORD vlinec1_RGBA()
|
DWORD vlinec1_RGBA()
|
||||||
{
|
{
|
||||||
DWORD fracstep = dc_iscale;
|
/*DWORD fracstep = dc_iscale;
|
||||||
DWORD frac = dc_texturefrac;
|
DWORD frac = dc_texturefrac;
|
||||||
DWORD height = rw_pic->GetHeight();
|
DWORD height = rw_pic->GetHeight();
|
||||||
assert((frac >> vlinebits) < height);
|
assert((frac >> vlinebits) < height);
|
||||||
frac += dc_count * fracstep;
|
frac += (dc_count-1) * fracstep;
|
||||||
assert((frac >> vlinebits) <= height);
|
assert((frac >> vlinebits) <= height);*/
|
||||||
|
|
||||||
DrawerCommandQueue::QueueCommand<Vlinec1RGBACommand>();
|
DrawerCommandQueue::QueueCommand<Vlinec1RGBACommand>();
|
||||||
return dc_texturefrac + dc_count * dc_iscale;
|
return dc_texturefrac + dc_count * dc_iscale;
|
||||||
|
|
|
@ -1087,23 +1087,21 @@ uint32_t wallscan_drawcol1(int x, int y1, int y2, uint32_t uv_start, uint32_t uv
|
||||||
{
|
{
|
||||||
uint32_t uv_pos = uv_start;
|
uint32_t uv_pos = uv_start;
|
||||||
|
|
||||||
int left = y2 - y1;
|
uint32_t left = y2 - y1;
|
||||||
while (left > 0)
|
while (left > 0)
|
||||||
{
|
{
|
||||||
int next_uv_wrap = (uv_max - uv_pos + uv_step - 1) / uv_step;
|
uint32_t available = uv_max - uv_pos;
|
||||||
int count = MIN(left, next_uv_wrap);
|
uint32_t next_uv_wrap = available / uv_step;
|
||||||
if (count <= 0)
|
if (available % uv_step != 0)
|
||||||
break; // This should never happen, but it does..
|
next_uv_wrap++;
|
||||||
|
uint32_t count = MIN(left, next_uv_wrap);
|
||||||
|
|
||||||
if (count > 0)
|
dc_source = source;
|
||||||
{
|
dc_dest = (ylookup[y1] + x) * pixelsize + dc_destorg;
|
||||||
dc_source = source;
|
dc_count = count;
|
||||||
dc_dest = (ylookup[y1] + x) * pixelsize + dc_destorg;
|
dc_iscale = uv_step;
|
||||||
dc_count = count;
|
dc_texturefrac = uv_pos;
|
||||||
dc_iscale = uv_step;
|
draw1column();
|
||||||
dc_texturefrac = uv_pos;
|
|
||||||
draw1column();
|
|
||||||
}
|
|
||||||
|
|
||||||
left -= count;
|
left -= count;
|
||||||
uv_pos += uv_step * count;
|
uv_pos += uv_step * count;
|
||||||
|
@ -1138,30 +1136,28 @@ void wallscan_drawcol4(int x, int y1, int y2, uint32_t *uv_pos, uint32_t *uv_ste
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
bufplce[i] = source[i];
|
bufplce[i] = source[i];
|
||||||
|
|
||||||
int left = y2 - y1;
|
uint32_t left = y2 - y1;
|
||||||
while (left > 0)
|
while (left > 0)
|
||||||
{
|
{
|
||||||
// Find which column wraps first
|
// Find which column wraps first
|
||||||
int count = left;
|
uint32_t count = left;
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
int next_uv_wrap = (uv_max - uv_pos[i] + uv_step[i] - 1) / uv_step[i];
|
uint32_t available = uv_max - uv_pos[i];
|
||||||
|
uint32_t next_uv_wrap = available / uv_step[i];
|
||||||
|
if (available % uv_step[i] != 0)
|
||||||
|
next_uv_wrap++;
|
||||||
count = MIN(next_uv_wrap, count);
|
count = MIN(next_uv_wrap, count);
|
||||||
}
|
}
|
||||||
if (count <= 0)
|
|
||||||
break; // This should never happen, but it does..
|
|
||||||
|
|
||||||
// Draw until that column wraps
|
// Draw until that column wraps
|
||||||
if (count > 0)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++)
|
vplce[i] = uv_pos[i];
|
||||||
{
|
vince[i] = uv_step[i];
|
||||||
vplce[i] = uv_pos[i];
|
|
||||||
vince[i] = uv_step[i];
|
|
||||||
}
|
|
||||||
dc_count = count;
|
|
||||||
draw4columns();
|
|
||||||
}
|
}
|
||||||
|
dc_count = count;
|
||||||
|
draw4columns();
|
||||||
|
|
||||||
// Wrap the uv position
|
// Wrap the uv position
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
|
@ -1299,6 +1295,9 @@ void wallscan_any(
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
if (y2[i] <= y1[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!fixed)
|
if (!fixed)
|
||||||
R_SetColorMapLight(basecolormap, lights[i], wallshade);
|
R_SetColorMapLight(basecolormap, lights[i], wallshade);
|
||||||
wallscan_drawcol1(x + i, y1[i], y2[i], uv_pos[i], uv_step[i], uv_max, source[i], draw1column);
|
wallscan_drawcol1(x + i, y1[i], y2[i], uv_pos[i], uv_step[i], uv_max, source[i], draw1column);
|
||||||
|
|
Loading…
Reference in a new issue