- reworked global palette state for robustness.

This commit is contained in:
Christoph Oelckers 2020-01-26 10:58:00 +01:00
parent 51d5236216
commit 245aa5d3bc
33 changed files with 108 additions and 247 deletions

View file

@ -224,8 +224,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
Smacker_GetPalette(hSMK, palette);
paletteSetColorTable(kSMKPal, palette, true);
GLInterface.EnableNonTransparent255(true);
videoSetPalette(0, kSMKPal, 8+2);
videoSetPalette(0, kSMKPal, Pal_Fullscreen);
int nScale;
@ -279,8 +278,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
Smacker_Close(hSMK);
inputState.ClearAllInput();
soundEngine->StopAllChannels();
GLInterface.EnableNonTransparent255(false);
videoSetPalette(0, 0, 8+2);
videoSetPalette(0, 0, 0);
tileDelete(kSMKTile);
}

View file

@ -2924,7 +2924,7 @@ void UpdateDacs(int nPalette, bool bNoTint)
nGreen = ClipRange(nGreen, -255, 255);
nBlue = ClipRange(nBlue, -255, 255);
videoSetPalette(0, nPalette, 2);
videoSetPalette(0, nPalette, 0);
videoTintBlood(nRed, nGreen, nBlue);
}
else

View file

@ -60,7 +60,22 @@ void paletteSetBlendTable(int32_t blend, const char *tab);
void paletteFreeBlendTable(int32_t blend);
int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab);
void paletteFreeLookupTable(int32_t palnum);
void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags);
#include "tflags.h"
enum ESetPalFlag
{
Pal_DontResetFade = 1,
Pal_SceneBrightness = 2,
Pal_Fullscreen = 4,
Pal_2D = 8,
};
typedef TFlags<ESetPalFlag> ESetPalFlags;
DEFINE_TFLAGS_OPERATORS(ESetPalFlags)
extern ESetPalFlags curpaletteflags;
void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags);
void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset);
#ifdef USE_OPENGL
void videoTintBlood(int32_t r, int32_t g, int32_t b);

View file

@ -470,7 +470,8 @@ int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect)
x *= screen->GetWidth() / 2;
y *= screen->GetHeight() / 2;
DrawTexture(twod, vpxtex, screen->GetWidth() / 2 - int(x), screen->GetHeight()/2 - int(y), DTA_DestWidth, 2*int(x), DTA_DestHeight, 2*int(y), DTA_Masked, false, DTA_KeepRatio, true, TAG_DONE);
DrawTexture(twod, vpxtex, screen->GetWidth() / 2 - int(x), screen->GetHeight()/2 - int(y), DTA_DestWidth, 2*int(x), DTA_DestHeight, 2*int(y),
DTA_Masked, false, DTA_KeepRatio, true, DTA_LegacyRenderStyle, STYLE_Normal, TAG_DONE);
t = timerGetTicks()-t;
codec->sumtimes[2] += t;

View file

@ -28,6 +28,7 @@ palette_t curpalette[256]; // the current palette, unadjusted for brightness o
palette_t curpalettefaded[256]; // the current palette, adjusted for brightness and tint (ie. what gets sent to the card)
palette_t palfadergb = { 0, 0, 0, 0 };
unsigned char palfadedelta = 0;
ESetPalFlags curpaletteflags;
int32_t realmaxshade;
float frealmaxshade;
@ -715,7 +716,7 @@ void paletteFreeColorTables()
// 8: don't gltexinvalidate8()
// 16: don't reset palfade*
// 32: apply brightness to scene in OpenGL
void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags)
{
int32_t i, j;
const uint8_t* dapal;
@ -734,14 +735,9 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
dapal = basepaltable[curbasepal];
// In-scene brightness mode for RR's thunderstorm. This shouldn't affect the global gamma ramp.
if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & 32))
if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & Pal_SceneBrightness))
{
if (!(flags & 4))
{
curbrightness = clamp(dabrightness, 0, 15);
}
r_scenebrightness = curbrightness;
r_scenebrightness = clamp(dabrightness, 0, 15);
}
else
{
@ -764,15 +760,17 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
curpalettefaded[i].f = 0;
}
if ((flags & 16) && palfadedelta) // keep the fade
if ((flags & Pal_DontResetFade) && palfadedelta) // keep the fade
paletteSetFade(palfadedelta >> 2);
if ((flags & 16) == 0)
if ((flags & Pal_DontResetFade) == 0)
{
palfadergb.r = palfadergb.g = palfadergb.b = 0;
palfadedelta = 0;
}
curpaletteflags = flags;
}
palette_t paletteGetColor(int32_t col)

View file

@ -433,7 +433,7 @@ void OpenGLFrameBuffer::Draw2D()
::DrawFullscreenBlends();
DrawRateStuff();
auto savepal = curbasepal;
if (!GLInterface.NonTransparent255Enabled()) curbasepal = 0;
if (!(curpaletteflags & (Pal_Fullscreen|Pal_2D))) curbasepal = 0;
GLInterface.Draw2D(&twodgen);
curbasepal = savepal;
}

View file

@ -303,8 +303,6 @@ int32_t Anim_Play(const char *fn)
// OSD_Printf("msecs per frame: %d\n", msecsperframe);
GLInterface.EnableNonTransparent255(true);
do
{
nextframetime += msecsperframe;
@ -391,7 +389,6 @@ int32_t Anim_Play(const char *fn)
}
} while (timerGetTicks() < nextframetime);
} while (running);
GLInterface.EnableNonTransparent255(false);
#ifdef DEBUGGINGAIDS
animvpx_print_stats(&codec);
#endif
@ -439,9 +436,7 @@ int32_t Anim_Play(const char *fn)
paletteSetColorTable(ANIMPAL, ANIM_GetPalette(), true);
// setpalette(0L,256L,tempbuf);
GLInterface.EnableNonTransparent255(true);
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8 + 2);
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, Pal_Fullscreen);
#ifdef USE_OPENGL
if ((anim->frameflags & CUTSCENE_TEXTUREFILTER && hw_texfilter == TEXFILTER_ON) || anim->frameflags & CUTSCENE_FORCEFILTER)
@ -532,7 +527,6 @@ int32_t Anim_Play(const char *fn)
} while (i < numframes);
end_anim_restore_gl:
GLInterface.EnableNonTransparent255(false);
hw_texfilter = ogltexfiltermode;
gltexapplyprops();
end_anim:

View file

@ -485,7 +485,7 @@ RECHECK:
}
fadepal(0,0,0, 0,252,28);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
G_DrawBackground();
//M_DisplayMenus();
videoNextPage();

View file

@ -673,6 +673,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (pub > 0 || videoGetRenderMode() >= REND_POLYMOST) // JBF 20040101: redraw background always
{
videoClearScreen(0);
#ifndef EDUKE32_TOUCH_DEVICES
if (ud.screen_size >= 8)
#endif

View file

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h"
#include "network.h"
#include "menu/menu.h"
#include "palette.h"
BEGIN_DUKE_NS
@ -284,7 +285,7 @@ void G_PrintGameQuotes(int32_t snum);
void G_Shutdown(void);
void G_UpdatePlayerFromMenu(void);
void P_DoQuote(int32_t q,DukePlayer_t *p);
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set);
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags flags);
#define NEG_ALPHA_TO_BLEND(alpha, blend, orientation) do { \
if (alpha < 0) { blend = -alpha; alpha = 0; orientation |= RS_TRANS1; } \

View file

@ -4147,7 +4147,7 @@ badindex:
tw = vm.pPlayer->palette;
inputState.ClearAllInput();
Anim_Play(quoteMgr.GetQuote(nQuote));
P_SetGamePalette(vm.pPlayer, tw, 2 + 16);
P_SetGamePalette(vm.pPlayer, tw, Pal_DontResetFade);
dispatch();
}
@ -6034,7 +6034,7 @@ badindex:
vInstruction(CON_SETGAMEPALETTE):
insptr++;
P_SetGamePalette(vm.pPlayer, Gv_GetVar(*(insptr++)), 2 + 16);
P_SetGamePalette(vm.pPlayer, Gv_GetVar(*(insptr++)), Pal_DontResetFade);
dispatch();
vInstruction(CON_GETTEXTURECEILING):

View file

@ -934,7 +934,7 @@ void __fastcall VM_SetPlayer(int const playerNum, int const labelNum, int const
ps.gotweapon &= ~(1 << lParm2);
break;
case PLAYER_PALETTE: P_SetGamePalette(&ps, newValue, 2 + 16); break;
case PLAYER_PALETTE: P_SetGamePalette(&ps, newValue, Pal_DontResetFade); break;
case PLAYER_PALS:
switch (lParm2)

View file

@ -4694,7 +4694,7 @@ void Net_WaitForServer(void)
if (numplayers < 2 || g_netServer)
return;
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8 + 2 + 1);
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, Pal_Fullscreen);
do
{
@ -4720,7 +4720,7 @@ void Net_WaitForServer(void)
if (g_player[0].pingcnt > serverReady)
{
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8 + 2 + 1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
return;
}
} while (1);

View file

@ -422,39 +422,6 @@ static int osdcmd_give(osdcmdptr_t parm)
return OSDCMD_SHOWHELP;
}
void onvideomodechange(int32_t newmode)
{
uint8_t palid;
// XXX?
if (!newmode || g_player[screenpeek].ps->palette < BASEPALCOUNT)
palid = g_player[screenpeek].ps->palette;
else
palid = BASEPAL;
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
{
int32_t i = 0;
while (i < MAXSPRITES)
{
if (actor[i].lightptr)
{
polymer_deletelight(actor[i].lightId);
actor[i].lightptr = NULL;
actor[i].lightId = -1;
}
i++;
}
}
#endif
videoSetPalette(0, palid, 0);
g_restorePalette = -1;
g_crosshairSum = -1;
}
static int osdcmd_dumpmapstate(osdfuncparm_t const * const)
{

View file

@ -355,7 +355,7 @@ static void G_DoLoadScreen(const char *statustext, int percent)
int const screenSize = ud.screen_size;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
if (statustext == NULL)
{

View file

@ -78,7 +78,7 @@ static int32_t G_PlaySoundWhileNoInput(int32_t soundnum)
#endif
//////////
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set)
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags set)
{
if (palid >= MAXBASEPALS)
palid = 0;
@ -717,7 +717,7 @@ void G_DisplayRest(int32_t smoothratio)
int32_t pal = pp->palette;
// g_restorePalette < 0: reset tinting, too (e.g. when loading new game)
P_SetGamePalette(pp, pal, 2 + (g_restorePalette>0)*16);
P_SetGamePalette(pp, pal, (g_restorePalette > 0) ? Pal_DontResetFade : ESetPalFlags::FromInt(0));
g_restorePalette = 0;
}
else
@ -1096,7 +1096,7 @@ void gameDisplayTENScreen()
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
renderFlushPerms();
// g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28);
inputState.ClearAllInput();
totalclock = 0;
@ -1120,7 +1120,7 @@ void gameDisplaySharewareScreens()
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
renderFlushPerms();
// g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28);
inputState.ClearAllInput();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3291, 0, 0, 2 + 8 + 64 + BGSTRETCH);
@ -1168,7 +1168,7 @@ void gameDisplay3DRScreen()
{
videoClearScreen(0);
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, 8 + 2 + 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, Pal_Fullscreen); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28);
renderFlushPerms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH);
@ -1206,7 +1206,7 @@ void gameDisplayTitleScreen(void)
videoClearScreen(0);
// g_player[myconnectindex].ps->palette = titlepal;
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8 + 2 + 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, Pal_Fullscreen); // JBF 20040308
renderFlushPerms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH);
inputState.keyFlushChars();
@ -1399,7 +1399,7 @@ void G_DisplayLogo(void)
void G_DoOrderScreen(void)
{
videoSetViewableArea(0, 0, xdim-1, ydim-1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
for (int i=0; i<4; i++)
{
@ -1440,7 +1440,7 @@ static void G_BonusCutscenes(void)
350, 380, VICTORY1+8, 86, 59 // duplicate row to alleviate overflow in the for loop below "boss"
};
P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, Pal_2D); // JBF 20040308
videoClearScreen(0L);
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH);
videoNextPage();
@ -1516,7 +1516,7 @@ static void G_BonusCutscenes(void)
goto VOL1_END;
inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3292, 0, 0, 2+8+64+BGSTRETCH);
fadepal(0, 0, 0, 252, 0, -4);
@ -1555,7 +1555,7 @@ static void G_BonusCutscenes(void)
return;
inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3293, 0, 0, 2+8+64+BGSTRETCH);
fadepal(0, 0, 0, 252, 0, -4);
G_HandleEventsWhileNoInput();
@ -1608,7 +1608,7 @@ static void G_BonusCutscenes(void)
goto VOL4_DUKETEAM;
G_FadePalette(0, 0, 0, 0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
// G_FadePalette(0,0,0,252);
videoClearScreen(0L);
menutext_center(60, GStrings("Thanks to all our"));
@ -1892,7 +1892,7 @@ void G_BonusScreen(int32_t bonusonly)
G_BonusCutscenes();
#endif
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
G_FadePalette(0, 0, 0, 252); // JBF 20031228
inputState.keyFlushChars();
totalclock = 0;

View file

@ -78,7 +78,7 @@ void kensetpalette(unsigned char *vgapal)
Bmemcpy(palette, vgapal, 768);
for (auto &i : palette)
i <<= 2;
videoSetPalette(0, 0, /*4 | */2);
videoSetPalette(0, 0, 0);
#if 0
char vesapal[1024];

View file

@ -198,7 +198,7 @@ void GrabPalette()
{
SetOverscan(BASEPAL);
videoSetPalette(0, BASEPAL, 2+8);
videoSetPalette(0, BASEPAL, 0);
nPalDiff = 0;
nPalDelay = 0;
@ -206,32 +206,19 @@ void GrabPalette()
btint = 0;
gtint = 0;
rtint = 0;
#ifdef USE_OPENGL
videoTintBlood(0, 0, 0);
#endif
}
void BlackOut()
{
for (int i = 0; i < 256; i++)
{
curpalettefaded[i].r = 0;
curpalettefaded[i].g = 0;
curpalettefaded[i].b = 0;
}
//videoUpdatePalette(0, 256);
g_lastpalettesum = -1;
#ifdef USE_OPENGL
videoTintBlood(0, 0, 0);
#endif
}
void RestorePalette()
{
videoSetPalette(0, BASEPAL, 2+8);
#ifdef USE_OPENGL
videoSetPalette(0, BASEPAL, 0);
videoTintBlood(0, 0, 0);
#endif
}
void WaitTicks(int nTicks)
@ -419,7 +406,7 @@ int DoFadeIn()
if (videoGetRenderMode() >= REND_POLYMOST)
{
paletteSetColorTable(curbasepal, basepaltable[BASEPAL]);
videoSetPalette(0, curbasepal, 2+8);
videoSetPalette(0, curbasepal, 0);
videoNextPage();
return 0;
}
@ -468,7 +455,7 @@ void FadeIn()
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST)
{
videoSetPalette(0, BASEPAL, 2+8);
videoSetPalette(0, BASEPAL, 0);
videoNextPage();
return;
}
@ -501,53 +488,6 @@ void FixPalette()
nPalDelay = 5;
#ifdef USE_OPENGL
if (videoGetRenderMode() == REND_CLASSIC)
#endif
for (int i = 0; i < 256; i++)
{
short nVal;
nVal = curpalettefaded[i].r - curpalette[i].r;
if (nVal > 0)
{
if (nVal > 20)
{
curpalettefaded[i].r -= 20;
}
else
{
curpalettefaded[i].r = curpalette[i].r;
}
}
nVal = curpalettefaded[i].g - curpalette[i].g;
if (nVal > 0)
{
if (nVal > 20)
{
curpalettefaded[i].g -= 20;
}
else
{
curpalettefaded[i].g = curpalette[i].g;
}
}
nVal = curpalettefaded[i].b - curpalette[i].b;
if (nVal > 0)
{
if (nVal > 20)
{
curpalettefaded[i].b -= 20;
}
else
{
curpalettefaded[i].b = curpalette[i].b;
}
}
}
nPalDiff -= 20;
gtint -= 20;
rtint -= 20;

View file

@ -1147,7 +1147,7 @@ void CinemaFadeIn()
BlackOut();
paletteSetColorTable(ANIMPAL, cinemapal);
videoSetPalette(0, ANIMPAL, 2+8);
videoSetPalette(0, ANIMPAL, Pal_Fullscreen);
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST)

View file

@ -95,7 +95,7 @@ int ReadFrame(FileReader &fp)
c <<= 2;
paletteSetColorTable(ANIMPAL, palette);
videoSetPalette(0, ANIMPAL, 2+8);
videoSetPalette(0, ANIMPAL, Pal_Fullscreen);
memset(CurFrame, overscanindex, 4); //sizeof(CurFrame));
continue;
@ -222,7 +222,7 @@ void PlayMovie(const char* fileName)
int angle = 1536;
int z = 0;
videoSetPalette(0, ANIMPAL, 2 + 8);
videoSetPalette(0, ANIMPAL, Pal_Fullscreen);
// Read a frame in first
if (ReadFrame(fp))

View file

@ -186,7 +186,7 @@ bool GLInstance::SetTextureInternal(int picnum, FTexture* tex, int palette, int
applytint = true;
if (!(h.f & HICTINT_APPLYOVERPALSWAP)) usepalswap = 0;
}
lookuppal = palmanager.LookupPalette(usepalette, usepalswap, false, g_nontransparent255);
lookuppal = palmanager.LookupPalette(usepalette, usepalswap, false,fixpalette < 0? !!(curpaletteflags & Pal_Fullscreen) : 0);
}
}

View file

@ -160,7 +160,6 @@ class GLInstance
FTexture* currentTexture = nullptr;
int TextureType;
int MatrixChange = 0;
bool g_nontransparent255 = false; // Ugh... This is for movie playback and needs to be maintained as global state.
// Cached GL state.
GLState lastState;
@ -198,14 +197,6 @@ public:
void DrawElement(EDrawType type, size_t start, size_t count, PolymostRenderState& renderState);
FHardwareTexture* NewTexture();
void EnableNonTransparent255(bool on)
{
g_nontransparent255 = on;
}
bool NonTransparent255Enabled()
{
return g_nontransparent255;
}
void SetVertexBuffer(IVertexBuffer* vb, int offset1, int offset2);
void SetIndexBuffer(IIndexBuffer* vb);

View file

@ -339,7 +339,6 @@ int32_t Anim_Play(const char *fn)
// OSD_Printf("msecs per frame: %d\n", msecsperframe);
GLInterface.EnableNonTransparent255(true);
do
{
nextframetime += msecsperframe;
@ -421,7 +420,6 @@ int32_t Anim_Play(const char *fn)
}
} while (timerGetTicks() < nextframetime);
} while (running);
GLInterface.EnableNonTransparent255(false);
#ifdef DEBUGGINGAIDS
animvpx_print_stats(&codec);
@ -478,9 +476,7 @@ int32_t Anim_Play(const char *fn)
paletteSetColorTable(ANIMPAL, ANIM_GetPalette(), true);
// setpalette(0L,256L,tempbuf);
GLInterface.EnableNonTransparent255(true);
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8 + 2);
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, Pal_Fullscreen);
ototalclock = totalclock;
@ -564,7 +560,6 @@ int32_t Anim_Play(const char *fn)
} while (i < numframes);
end_anim_restore_gl:
GLInterface.EnableNonTransparent255(false);
hw_texfilter = ogltexfiltermode;
gltexapplyprops();
end_anim:

View file

@ -485,7 +485,7 @@ RECHECK:
}
fadepal(0,0,0, 0,252,28);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
G_DrawBackground();
//M_DisplayMenus();
videoNextPage();

View file

@ -22,9 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma once
#ifndef game_h_
#define game_h_
#ifndef ONLY_USERDEFS
#include "premap.h" // XXX
#endif
@ -34,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamedef.h"
#include "net.h"
#include "mmulti.h"
#include "palette.h"
BEGIN_RR_NS
@ -282,7 +280,7 @@ void G_PrintGameQuotes(int32_t snum);
void G_Shutdown(void);
void G_UpdatePlayerFromMenu(void);
void P_DoQuote(int32_t q,DukePlayer_t *p);
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set);
void P_SetGamePalette(DukePlayer_t* player, uint32_t palid, ESetPalFlags flags);
void G_OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum);
void G_OffMotorcycle(DukePlayer_t *pPlayer);
void G_OnBoat(DukePlayer_t *pPlayer, int spriteNum);
@ -495,6 +493,4 @@ EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue)
#endif
#endif
END_RR_NS

View file

@ -164,7 +164,7 @@ void Net_WaitForEverybody(void)
}
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8+2+1);
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, Pal_Fullscreen);
do
{
@ -199,7 +199,7 @@ void Net_WaitForEverybody(void)
if (i != myconnectindex) Net_SendPacket(i, packbuf, 1);
}
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
return;
}
}

View file

@ -326,40 +326,6 @@ static int osdcmd_give(osdcmdptr_t parm)
return OSDCMD_SHOWHELP;
}
void onvideomodechange(int32_t newmode)
{
uint8_t palid;
// XXX?
if (!newmode || g_player[screenpeek].ps->palette < BASEPALCOUNT)
palid = g_player[screenpeek].ps->palette;
else
palid = BASEPAL;
#ifdef POLYMER
if (videoGetRenderMode() == REND_POLYMER)
{
int32_t i = 0;
while (i < MAXSPRITES)
{
if (actor[i].lightptr)
{
polymer_deletelight(actor[i].lightId);
actor[i].lightptr = NULL;
actor[i].lightId = -1;
}
i++;
}
}
#endif
videoSetPalette(0, palid, 0);
g_restorePalette = -1;
g_crosshairSum = -1;
}
#if !defined NETCODE_DISABLE
static int osdcmd_disconnect(osdcmdptr_t UNUSED(parm))
{

View file

@ -481,7 +481,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
int32_t i = 0;
//g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
if (!statustext)
{

View file

@ -77,7 +77,7 @@ static int32_t G_PlaySoundWhileNoInput(int32_t soundnum)
}
//////////
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set)
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags set)
{
if (palid >= MAXBASEPALS)
palid = 0;
@ -737,7 +737,7 @@ void G_DisplayRest(int32_t smoothratio)
#endif
// g_restorePalette < 0: reset tinting, too (e.g. when loading new game)
P_SetGamePalette(pp, pal, 2 + (g_restorePalette>0)*16);
P_SetGamePalette(pp, pal, (g_restorePalette>0)? Pal_DontResetFade : ESetPalFlags::FromInt(0));
#ifdef SPLITSCREEN_MOD_HACKS
if (pp2) // keep first player's pal as its member!
@ -1104,7 +1104,7 @@ void G_DisplayExtraScreens(void)
videoSetViewableArea(0, 0, xdim-1, ydim-1);
renderFlushPerms();
//g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28);
inputState.ClearAllInput();
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3291, 0, 0, 2+8+64+BGSTRETCH);
@ -1131,7 +1131,7 @@ void G_DisplayExtraScreens(void)
videoSetViewableArea(0, 0, xdim-1, ydim-1);
renderFlushPerms();
//g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28);
inputState.ClearAllInput();
totalclock = 0;
@ -1257,7 +1257,7 @@ void G_DisplayLogo(void)
{
videoClearScreen(0);
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, 8 + 2 + 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, Pal_Fullscreen); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28);
renderFlushPerms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH);
@ -1297,7 +1297,7 @@ void G_DisplayLogo(void)
videoClearScreen(0);
//g_player[myconnectindex].ps->palette = titlepal;
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, Pal_Fullscreen); // JBF 20040308
renderFlushPerms();
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH);
inputState.keyFlushChars();
@ -1397,7 +1397,7 @@ void G_DoOrderScreen(void)
videoSetViewableArea(0, 0, xdim-1, ydim-1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
for (i=0; i<4; i++)
{
@ -1437,7 +1437,7 @@ static void G_BonusCutscenes(void)
ud.eog = 0;
fadepal(0, 0, 0, 0, 252, 4);
inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
rotatesprite_fs(0, 0, 65536L, 0, TENSCREEN, 0, 0, 2+8+16+64+128+BGSTRETCH);
videoNextPage();
fadepal(0, 0, 0, 252, 0, -4);
@ -1464,7 +1464,7 @@ static void G_BonusCutscenes(void)
fadepal(0, 0, 0, 0, 252, 4);
videoSetViewableArea(0, 0, xdim-1, ydim-1);
inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8 + 2 + 1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
rotatesprite_fs(0, 0, 65536L, 0, TENSCREEN, 0, 0, 2 + 8 + 16 + 64 + 128 + BGSTRETCH);
videoNextPage();
fadepal(0, 0, 0, 252, 0, -4);
@ -1495,7 +1495,7 @@ static void G_BonusCutscenes(void)
350, 380, VICTORY1+8, 86, 59 // duplicate row to alleviate overflow in the for loop below "boss"
};
P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, Pal_2D); // JBF 20040308
videoClearScreen(0L);
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH);
videoNextPage();
@ -1569,7 +1569,7 @@ static void G_BonusCutscenes(void)
}
inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3292, 0, 0, 2+8+64+BGSTRETCH);
fadepal(0, 0, 0, 252, 0, -4);
@ -1601,7 +1601,7 @@ static void G_BonusCutscenes(void)
}
inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3293, 0, 0, 2+8+64+BGSTRETCH);
fadepal(0, 0, 0, 252, 0, -4);
G_HandleEventsWhileNoInput();
@ -1645,7 +1645,7 @@ static void G_BonusCutscenes(void)
inputState.ClearAllInput();
G_FadePalette(0, 0, 0, 0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
// G_FadePalette(0,0,0,252);
videoClearScreen(0L);
menutext_center(60, GStrings("Thanks to all our"));
@ -1908,7 +1908,7 @@ void G_BonusScreen(int32_t bonusonly)
if (!bonusonly)
G_BonusCutscenes();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
G_FadePalette(0, 0, 0, 252); // JBF 20031228
inputState.keyFlushChars();
totalclock = 0;
@ -2477,17 +2477,17 @@ void G_BonusScreenRRRA(int32_t bonusonly)
Mus_Stop();
inputState.keyFlushChars();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
G_ShowMapFrame();
fadepal(0, 0, 0, 252, 0, -4);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
}
}
if (!bonusonly)
G_BonusCutscenes();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308
//G_FadePalette(0, 0, 0, 252); // JBF 20031228
inputState.keyFlushChars();
totalclock = 0;
@ -2808,7 +2808,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
videoNextPage();
S_PlaySound(35);
G_FadePalette(0, 0, 0, 0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
while (1)
{
switch (((int32_t) totalclock >> 4) & 1)
@ -2817,14 +2817,14 @@ void G_BonusScreenRRRA(int32_t bonusonly)
rotatesprite(0,0,65536,0,RRTILE8677,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1);
videoNextPage();
G_FadePalette(0, 0, 0, 0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
Net_GetPackets();
break;
case 1:
rotatesprite(0,0,65536,0,RRTILE8677+1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1);
videoNextPage();
G_FadePalette(0, 0, 0, 0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
Net_GetPackets();
break;
}

View file

@ -5238,7 +5238,7 @@ void G_Thunder(void)
{
brightness = 0;
g_thunderFlash = 0;
videoSetPalette(0,g_player[screenpeek].ps->palette,32);
videoSetPalette(0,g_player[screenpeek].ps->palette,Pal_SceneBrightness);
g_visibility = g_player[screenpeek].ps->visibility;
}
}
@ -5281,7 +5281,7 @@ void G_Thunder(void)
g_visibility = 2048;
if (brightness > 8)
brightness = 0;
videoSetPalette(brightness,g_player[screenpeek].ps->palette,32);
videoSetPalette(brightness,g_player[screenpeek].ps->palette,Pal_SceneBrightness);
}
if (g_winderFlash == 1)
{

View file

@ -260,7 +260,7 @@ playanm(short anim_num)
videoClearViewableArea(0L);
paletteSetColorTable(ANIMPAL, ANIM_GetPalette());
videoSetPalette(0, ANIMPAL, 2);
videoSetPalette(0, ANIMPAL, Pal_Fullscreen);
if (ANIMnum == 1)
{
// draw the first frame
@ -273,7 +273,6 @@ playanm(short anim_num)
//ototalclock = totalclock + 120*2;
ototalclock = (int32_t) totalclock;
GLInterface.EnableNonTransparent255(true);
for (i = 1; i < numframes; i++)
{
while (totalclock < ototalclock)
@ -325,11 +324,10 @@ playanm(short anim_num)
ENDOFANIMLOOP:
GLInterface.EnableNonTransparent255(false);
twod->ClearScreen();
videoNextPage();
videoSetPalette(0, BASEPAL, 2);
videoSetPalette(0, BASEPAL, 0);
inputState.ClearAllInput();
ANIM_FreeAnim();

View file

@ -439,7 +439,7 @@ void SetPaletteToVESA(unsigned char *pal)
VBE_setPalette(0, 256, pal_buff);
*/
paletteSetColorTable(BASEPAL, pal);
videoSetPalette(0, BASEPAL, 4|2);
videoSetPalette(0, BASEPAL, 0);
// fprintf(stderr,"SetPaletteToVESA() called\n");
}

View file

@ -1451,7 +1451,7 @@ void LogoLevel(void)
c <<= 2;
paletteSetColorTable(DREALMSPAL, pal.Data());
videoSetPalette(0, DREALMSPAL, 2);
videoSetPalette(0, DREALMSPAL, Pal_Fullscreen);
}
DSPRINTF(ds,"Just read in 3drealms.pal...");
MONO_PRINT(ds);
@ -1490,7 +1490,7 @@ void LogoLevel(void)
twod->ClearScreen();
videoNextPage();
videoSetPalette(0, BASEPAL, 2);
videoSetPalette(0, BASEPAL, 0);
// put up a blank screen while loading