The Abyss crash fix.

git-svn-id: https://svn.eduke32.com/eduke32@533 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
Plagman 2007-04-16 02:15:43 +00:00
parent a5388fc0a4
commit 2440ab75b9

View file

@ -8316,8 +8316,15 @@ long hitscan(long xs, long ys, long zs, short sectnum, long vx, long vy, long vz
if ((cstat&64) != 0) if ((cstat&64) != 0)
if ((zs > intz) == ((cstat&8)==0)) continue; if ((zs > intz) == ((cstat&8)==0)) continue;
#if 1 // Abyss crash prevention code ((intz-zs)*zx overflowing a 8-bit word)
zz=(long)((intz-zs)*vx);
intx = xs+scale(zz,1,vz);
zz=(long)((intz-zs)*vy);
inty = ys+scale(zz,1,vz);
#else
intx = xs+scale(intz-zs,vx,vz); intx = xs+scale(intz-zs,vx,vz);
inty = ys+scale(intz-zs,vy,vz); inty = ys+scale(intz-zs,vy,vz);
#endif
if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue; if (klabs(intx-xs)+klabs(inty-ys) > klabs((*hitx)-xs)+klabs((*hity)-ys)) continue;