game.c: make fadepal/fadepaltile first calculate inclusive end limit.

When requesting an increasing ramp, the upper limit is taken to be exclusive.
When it is passed to G_FadePalette, only the lowest 6 bits are passed further
to setpalettefade, which means that a limit of 64 is incorrectly set as 0.
Also, when breaking from the fade loop, set the fade value to the end one for
fadepal!

git-svn-id: https://svn.eduke32.com/eduke32@2582 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-04-04 18:56:31 +00:00
parent fa1521703c
commit 2113959dd5

View file

@ -1991,6 +1991,10 @@ void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e)
void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step)
{
// for positive steps, the upper limit is exclusive!
if (step > 0)
end--; // ... make it inclusive
if (getrendermode() >= 3)
{
G_FadePalette(r, g, b, end);
@ -1999,13 +2003,15 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_
if (step > 0)
{
for (; start < end; start += step)
for (; start <= end; start += step)
{
if (KB_KeyPressed(sc_Space))
{
KB_ClearKeyDown(sc_Space);
setpalettefade(r,g,b,end); // have to set to end fade value if we break!
return;
}
G_FadePalette(r,g,b,start);
}
}
@ -2014,17 +2020,26 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_
if (KB_KeyPressed(sc_Space))
{
KB_ClearKeyDown(sc_Space);
setpalettefade(r,g,b,end);
return;
}
G_FadePalette(r,g,b,start);
}
}
static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t tile)
{
if (getrendermode() >= 3)
clearview(0);
// for positive steps, the upper limit is exclusive!
if (step > 0)
end--; // ... make it inclusive
if (step > 0)
{
for (; start < end; start += step)
for (; start <= end; start += step)
{
if (KB_KeyPressed(sc_Space))
{
@ -11379,8 +11394,8 @@ FRAGBONUS:
{
int32_t yy = 0, zz;
Net_GetPackets();
handleevents();
G_HandleAsync();
MUSIC_Update();
if (g_player[myconnectindex].ps->gm&MODE_EOL)