mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Make vis decay with time independent of FPS, treat p->visibility<0 like 0.
Now, if p->visibility differs from the constant visibility, the former converges toward the latter by three-quartering the difference each second totalclock increment (1/60th second). Negative player visibilities are not handled consistently throughout the different renderers, so make it look the same as 0 (can view to infinity). git-svn-id: https://svn.eduke32.com/eduke32@3960 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
66d126e9ff
commit
19b85dc5ee
1 changed files with 26 additions and 5 deletions
|
@ -4370,7 +4370,10 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
else
|
||||
smoothratio = calc_smoothratio(totalclock, ototalclock);
|
||||
|
||||
g_visibility = (int32_t)(p->visibility * (numplayers > 1 ? 1.f : r_ambientlightrecip));
|
||||
{
|
||||
int32_t vis = p->visibility;
|
||||
g_visibility = (vis <= 0) ? 0 : vis * (numplayers > 1 ? 1.f : r_ambientlightrecip);
|
||||
}
|
||||
|
||||
CAMERA(sect) = p->cursectnum;
|
||||
|
||||
|
@ -4708,12 +4711,30 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
|
||||
G_RestoreInterpolations();
|
||||
|
||||
if (totalclock < lastvisinc)
|
||||
{
|
||||
if (klabs(p->visibility-ud.const_visibility) > 8)
|
||||
p->visibility += (ud.const_visibility-p->visibility)>>2;
|
||||
// Totalclock count of last step of p->visibility converging towards
|
||||
// ud.const_visibility.
|
||||
static int32_t lastvist;
|
||||
const int32_t visdif = ud.const_visibility-p->visibility;
|
||||
|
||||
// Check if totalclock was cleared (e.g. restarted game).
|
||||
if (totalclock < lastvist)
|
||||
lastvist = 0;
|
||||
|
||||
// Every 2nd totalclock increment (each 1/60th second), ...
|
||||
while (totalclock >= lastvist+2)
|
||||
{
|
||||
// ... approximately three-quarter the difference between
|
||||
// p->visibility and ud.const_visibility.
|
||||
const int32_t visinc = visdif>>2;
|
||||
|
||||
if (klabs(visinc) == 0)
|
||||
break;
|
||||
|
||||
p->visibility += visinc;
|
||||
lastvist = totalclock;
|
||||
}
|
||||
}
|
||||
else p->visibility = ud.const_visibility;
|
||||
|
||||
if (r_usenewaspect)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue