Yeah that's when it started. I'm going to have a play around next week and see if I can it right without it going back to the shit-storm that it was. I think because the original calculations were using xdimen and xyaspect as part of the multiplications and aren't anymore, that's probably where the reason lays.
Snippet of old code from
0bd460d9e3bbaf239f4a33f9ce589dff58660bea:
Code: Select all
i = mulscale16(xdimenscale,viewingrangerecip);
globalpisibility = mulscale16(parallaxvisibility,i);
globalvisibility = g_visibility * xdimen;
globalvisibility2 = mulscale16(g_visibility, i);
globalhisibility = mulscale16(globalvisibility,xyaspect);
globalcisibility = mulscale8(globalhisibility,320);
#ifdef USE_OPENGL
globalhisibility2 = mulscale16(globalvisibility2,xyaspect);
globalcisibility2 = mulscale8(globalhisibility2,320);
#endif
EDIT: I've submitted
PR #78 for review and discussion on this issue. Preliminary testing shows that this yields a correct result on my laptop at 1080p but I need to validate this against my home computer at 1440p.
Further to the discussion, I'm wondering whether any other changes in
0bd460d9e3bbaf239f4a33f9ce589dff58660bea have created a potential overall net-negative. Take the below block of code for instance changed from:
Code: Select all
globvis2 = (sector[sectnum].visibility != 0) ?
mulscale4(globalcisibility2, (uint8_t)(sector[sectnum].visibility + 16)) :
globalcisibility2;
PrintVis(sector[sectnum].visibility, 'c');
GLInterface.SetVisibility(globvis2, fviewingrange);
to:
Code: Select all
GLInterface.SetVisibility(sectorVisibility(sectnum))
As per the first code block, globalcisibility2 was calculated off globalhisibility2, which was calculated off globalvisibility2, with globalvisibility2 being based on values from xdimenscale and viewingrangerecip, and globalhisibility2 based on xyaspect.
In addition to the above resolution variables not being factored anymore, GLInterface.SetVisibility() isn't factoring in fviewingrange anymore. I'd have to do some Printf() lines to get the resulting numbers before and after the changes, but it feels like this code has been simplified at the cost of some accuracy.