[quake2] Quake2 skydistance patch
Nick Warne
nick at linicks.net
Fri Aug 26 07:42:37 EDT 2005
On Friday 26 August 2005 10:59, Nick Warne wrote:
> Hi Brendan,
>
> On Friday 26 August 2005 00:23, brendanburns at comcast.net wrote:
> > if (skydistance->modified)
> > {
> > skydistance->modified = false;
> > boxsize = skydistance->value;
> > boxsize -= 252 * ceil(boxsize / 2300);
> > farz = pow(2,floor(log(boxsize))+1);
> > ri.Con_Printf(PRINT_DEVELOPER, "farz now set to %g\n", farz);
> > }
>
> This doesn't work for me - all I get is a corrupt display when entering a
> map - doesn't crash though, just all messed up.
OK, looking at this, you don't need any of the calculation at all, and can
drop the boxsize stuff. Drawing up a table based on original code of
skydistance, boxsize, and farz, we get:
sd bs farz
500 248 512
1000 748 2048
1500 1248 4096
2500 1996 4096
3000 2496 8192
4500 3996 8192
5000 4244 16384
9000 7992 16384
So, all we need do is base farz on the skydistance value. Nobody will EVER
need a skydistance > 9000 (4x the default value of 2300 almost), therefore
top limit will be farz = 16384. Quake2 default skydistance is 2300, so the
lowest value farz will be is 4096.
Therefore, all it needs is to select the farz from the skydistance. I use the
breakpoints here to select the farz value.
if (skydistance->modified)
{
skydistance->modified = false;
if (skydistance->value > 4852) {
farz = 16384.00; // This value goes right up to a skydistance
of 9452 - cap it!
} else if (skydistance->value > 2552) { // Break point of
change from 4096 - 8192
farz = 8192.00;
} else {
farz = 4096.00; // This covers the default quake2 skydistance
of 2300
}
ri.Con_Printf(PRINT_DEVELOPER, "farz now set to %g\n", farz);
}
No calculations required!
I have attached a new diff file.
Nick
--
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gl_rmain.c.diff
Type: text/x-diff
Size: 2338 bytes
Desc: not available
URL: <http://icculus.org/pipermail/quake2/attachments/20050826/ec8da65b/attachment.bin>
More information about the quake2
mailing list