mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 03:52:12 -04:00
Prevent light scale overflow (#1605)
This commit is contained in:
parent
57c2b98999
commit
2cf75df1f3
@ -480,7 +480,7 @@ void R_SmoothLight(void)
|
|||||||
|
|
||||||
int R_GetLightIndex(fixed_t scale)
|
int R_GetLightIndex(fixed_t scale)
|
||||||
{
|
{
|
||||||
const int index = FixedDiv(scale * 160, lightfocallength) >> LIGHTSCALESHIFT;
|
const int index = ((int64_t)scale * (160 << FRACBITS) / lightfocallength) >> LIGHTSCALESHIFT;
|
||||||
return BETWEEN(0, MAXLIGHTSCALE - 1, index);
|
return BETWEEN(0, MAXLIGHTSCALE - 1, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user