[sw,sw32] Fix broken software skies

All for an unfortunate unsigned promotion. I guess I just wasn't testing
the software renderers enough.
This commit is contained in:
Bill Currie 2022-02-18 12:54:54 +09:00
parent d75726dd22
commit 981fcca76d
2 changed files with 8 additions and 4 deletions

View file

@ -42,14 +42,16 @@ D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t)
{
float wu, wv, temp;
vec3_t end;
int half_width = vid.width >> 1;
int half_height = vid.height >> 1;
if (r_refdef.vrect.width >= r_refdef.vrect.height)
temp = (float) r_refdef.vrect.width;
else
temp = (float) r_refdef.vrect.height;
wu = 8192.0 * (float) (u - (vid.width >> 1)) / temp;
wv = 8192.0 * (float) ((vid.height >> 1) - v) / temp;
wu = 8192.0 * (float) (u - half_width) / temp;
wv = 8192.0 * (float) (half_height - v) / temp;
end[0] = 4096 * vpn[0] + wu * vright[0] + wv * vup[0];
end[1] = 4096 * vpn[1] + wu * vright[1] + wv * vup[1];

View file

@ -47,14 +47,16 @@ D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t)
{
float wu, wv, temp;
vec3_t end;
int half_width = vid.width >> 1;
int half_height = vid.height >> 1;
if (r_refdef.vrect.width >= r_refdef.vrect.height)
temp = (float) r_refdef.vrect.width;
else
temp = (float) r_refdef.vrect.height;
wu = 8192.0 * (float) (u - (vid.width >> 1)) / temp;
wv = 8192.0 * (float) ((vid.height >> 1) - v) / temp;
wu = 8192.0 * (float) (u - half_width) / temp;
wv = 8192.0 * (float) (half_height - v) / temp;
end[0] = 4096 * vpn[0] + wu * vright[0] + wv * vup[0];
end[1] = 4096 * vpn[1] + wu * vright[1] + wv * vup[1];