From 2113959dd536a6898ba87ec3f37b98893b0ca712 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 4 Apr 2012 18:56:31 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/game.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 7afbbd9dd..9575244d5 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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)