mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 10:02:01 +00:00
Clamp lindex during vissprite light calculation
Mitigates against negative or very large xscale values causing lindex to evaluate < 0, preventing a potential colormap indexing-related crash.
This commit is contained in:
parent
23b565cec5
commit
f4b4c664c4
1 changed files with 2 additions and 2 deletions
|
|
@ -2538,8 +2538,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
// diminished light
|
||||
lindex = FixedMul(xscale, LIGHTRESOLUTIONFIX)>>(LIGHTSCALESHIFT);
|
||||
|
||||
if (lindex >= MAXLIGHTSCALE)
|
||||
lindex = MAXLIGHTSCALE-1;
|
||||
// Mitigate against negative xscale and arithmetic overflow
|
||||
lindex = std::clamp(lindex, 0, MAXLIGHTSCALE - 1);
|
||||
|
||||
if (vis->cut & SC_SEMIBRIGHT)
|
||||
lindex = (MAXLIGHTSCALE/2) + (lindex >> 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue