engine: fix a possible crash with texel-hitscan.

Reproduced as follows (assuming all tiles have texel-hitscan for simplicity):
In E2L5, shoot the opening switch with the shotgun, aiming for the border.
The crash occurs because the *other*, depressed switch tile isn't yet loaded
when we index into its tile storage. Dereferencing 0+small number == BAD!

git-svn-id: https://svn.eduke32.com/eduke32@3364 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-01-02 22:33:27 +00:00
parent e4caa58cf2
commit 4a6ded3f98

View file

@ -11669,6 +11669,11 @@ restart_grand:
if (intz > daz-k && intz < daz)
{
if (picanm[tilenum].sf&PICANM_TEXHITSCAN_BIT)
{
if (!waloff[tilenum])
loadtile(tilenum);
if (waloff[tilenum])
{
// daz-intz > 0 && daz-intz < k
int32_t xtex = mulscale16(ucoefup16, tilesizx[tilenum]);
@ -11679,6 +11684,7 @@ restart_grand:
if (*texel == 255)
continue;
}
}
hit_set(hit, dasector, -1, z, intx, inty, intz);
}