Commit c4310a2e authored by nukeykt's avatar nukeykt
Browse files

engine: fix integer overflow of x/y panning in floor sprite rendering code

parent d9081237
......@@ -5865,6 +5865,8 @@ draw_as_face_sprite:
vec2f_t sg_f = {}, sg_f2 = {};
vec2_t sg1 = {};
int64_t gxp = 0, gyp = 0;
if (slope != 0)
{
int daz = 0;
......@@ -5955,8 +5957,8 @@ draw_as_face_sprite:
globaly2 = divscale18(day,bot);
//Calculate globals for hline texture mapping function
globalxpanning = (rxi[z]<<12);
globalypanning = (rzi[z]<<12);
gxp = (int64_t(rxi[z])<<12);
gyp = (int64_t(rzi[z])<<12);
globalzd = decltype(globalzd)(ryi[z])<<12;
rzi[0] = mulscale16(rzi[0],viewingrange);
......@@ -6465,9 +6467,8 @@ next_most:
globalx2 = mulscale(globalx2,xspan,x);
}
#endif
dax = globalxpanning; day = globalypanning;
globalxpanning = -dmulscale6(globalx1,day,globalx2,dax);
globalypanning = -dmulscale6(globaly1,day,globaly2,dax);
globalxpanning = -(int32_t)((globalx1*gyp+globalx2*gxp)>>6);
globalypanning = -(int32_t)((globaly1*gyp+globaly2*gxp)>>6);
globalx2 = mulscale16(globalx2,viewingrange);
globaly2 = mulscale16(globaly2,viewingrange);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment