- avoid using global palette settings when drawing 2D content with a custom palette.

Instead pass the palette info with the render call to avoid stale global state.
This commit is contained in:
Christoph Oelckers 2020-05-23 14:36:35 +02:00
parent 57efff200a
commit b971bc2717
26 changed files with 139 additions and 184 deletions

View file

@ -856,7 +856,7 @@ void videoClearScreen(int32_t dacol);
void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang); void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang);
void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend,
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, FTexture *pic = nullptr); int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, FTexture *pic = nullptr, int basepal = 0);
void renderDrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint8_t col); void renderDrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint8_t col);
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t p); void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t p);
void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p); void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p);
@ -864,15 +864,15 @@ void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p);
////////// specialized rotatesprite wrappers for (very) often used cases ////////// ////////// specialized rotatesprite wrappers for (very) often used cases //////////
static FORCE_INLINE void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, static FORCE_INLINE void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
int8_t dashade, uint8_t dapalnum, int32_t dastat, int8_t dashade, uint8_t dapalnum, int32_t dastat,
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, FTexture* pic = nullptr) int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, FTexture* pic = nullptr, int basepal = 0)
{ {
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, cx1, cy1, cx2, cy2, pic); rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, cx1, cy1, cx2, cy2, pic, basepal);
} }
// Don't clip at all, i.e. the whole screen real estate is available: // Don't clip at all, i.e. the whole screen real estate is available:
static FORCE_INLINE void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, static FORCE_INLINE void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
int8_t dashade, uint8_t dapalnum, int32_t dastat, FTexture* pic = nullptr) int8_t dashade, uint8_t dapalnum, int32_t dastat, FTexture* pic = nullptr, int basepal = 0)
{ {
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0,0,xdim-1,ydim-1, pic); rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0,0,xdim-1,ydim-1, pic, basepal);
} }
static FORCE_INLINE void rotatesprite_fs_alpha(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, static FORCE_INLINE void rotatesprite_fs_alpha(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,

View file

@ -13,6 +13,9 @@
#include "renderstyle.h" #include "renderstyle.h"
#include "filesystem.h" #include "filesystem.h"
#include "zstring.h"
#include "palentry.h"
#include "templates.h"
#define MAXBASEPALS 256 #define MAXBASEPALS 256
#define MAXPALOOKUPS 256 #define MAXPALOOKUPS 256
@ -32,6 +35,7 @@ enum
}; };
extern uint8_t curbasepal; extern uint8_t curbasepal;
extern int32_t r_scenebrightness;
extern uint8_t PaletteIndexFullbrights[32]; extern uint8_t PaletteIndexFullbrights[32];
@ -65,11 +69,13 @@ void paletteFreeLookupTable(int32_t palnum);
enum ESetPalFlag enum ESetPalFlag
{ {
Pal_DontResetFade = 1, Pal_DontResetFade = 1,
Pal_SceneBrightness = 2,
Pal_Fullscreen = 4,
Pal_2D = 8,
}; };
inline void videoSetBrightness(int brightness)
{
r_scenebrightness = clamp(brightness, 0, 15);
}
typedef TFlags<ESetPalFlag> ESetPalFlags; typedef TFlags<ESetPalFlag> ESetPalFlags;
DEFINE_TFLAGS_OPERATORS(ESetPalFlags) DEFINE_TFLAGS_OPERATORS(ESetPalFlags)

View file

@ -5002,7 +5002,7 @@ void renderSetAspect(int32_t daxrange, int32_t daaspect)
// //
void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend,
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, FTexture *tex) int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, FTexture *tex, int basepal)
{ {
if (!tex && (unsigned)picnum >= MAXTILES) if (!tex && (unsigned)picnum >= MAXTILES)
return; return;
@ -5028,7 +5028,7 @@ void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
} }
// We must store all calls in the 2D drawer so that the backend can operate on a clean 3D view. // We must store all calls in the 2D drawer so that the backend can operate on a clean 3D view.
twod->rotatesprite(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, cx1, cy1, cx2, cy2, tex); twod->rotatesprite(sx, sy, z, a, picnum, dashade, dapalnum, dastat, daalpha, dablend, cx1, cy1, cx2, cy2, tex, basepal);
// RS_PERM code was removed because the current backend supports only one page that needs to be redrawn each frame in which case the perm list was skipped anyway. // RS_PERM code was removed because the current backend supports only one page that needs to be redrawn each frame in which case the perm list was skipped anyway.
} }

View file

@ -569,23 +569,12 @@ void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uin
// 4: don't calc curbrightness from dabrightness, DON'T USE THIS FLAG! // 4: don't calc curbrightness from dabrightness, DON'T USE THIS FLAG!
// 8: don't gltexinvalidate8() // 8: don't gltexinvalidate8()
// 16: don't reset palfade* // 16: don't reset palfade*
// 32: apply brightness to scene in OpenGL
void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags) void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags)
{ {
if (GPalette.GetTranslation(Translation_BasePalettes, dapalid) == nullptr) if (GPalette.GetTranslation(Translation_BasePalettes, dapalid) == nullptr)
dapalid = 0; dapalid = 0;
curbasepal = dapalid; curbasepal = dapalid;
// In-scene brightness mode for RR's thunderstorm. This shouldn't affect the global gamma ramp.
if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & Pal_SceneBrightness))
{
r_scenebrightness = clamp(dabrightness, 0, 15);
}
else
{
r_scenebrightness = 0;
}
if ((flags & Pal_DontResetFade) == 0) if ((flags & Pal_DontResetFade) == 0)
{ {
palfadergb.r = palfadergb.g = palfadergb.b = 0; palfadergb.r = palfadergb.g = palfadergb.b = 0;

View file

@ -142,8 +142,10 @@ enum ERenderFlags
STYLEF_FadeToBlack = 64, STYLEF_FadeToBlack = 64,
}; };
union FRenderStyle struct FRenderStyle
{ {
union
{
struct struct
{ {
uint8_t BlendOp; // Of ERenderOp type uint8_t BlendOp; // Of ERenderOp type
@ -152,6 +154,9 @@ union FRenderStyle
uint8_t Flags; uint8_t Flags;
}; };
uint32_t AsDWORD; uint32_t AsDWORD;
};
FRenderStyle() = default;
inline FRenderStyle &operator= (ERenderStyle legacy); inline FRenderStyle &operator= (ERenderStyle legacy);
bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; } bool operator==(const FRenderStyle &o) const { return AsDWORD == o.AsDWORD; }
@ -181,4 +186,3 @@ inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy)
*this = LegacyRenderStyles[legacy]; *this = LegacyRenderStyles[legacy];
return *this; return *this;
} }

View file

@ -628,7 +628,7 @@ static int32_t dorotspr_handle_bit2(int32_t* sxptr, int32_t* syptr, int32_t* z,
void F2DDrawer::rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, void F2DDrawer::rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend,
int32_t clipx1, int32_t clipy1, int32_t clipx2, int32_t clipy2, FTexture *pic) int32_t clipx1, int32_t clipy1, int32_t clipx2, int32_t clipy2, FTexture *pic, int basepal)
{ {
RenderCommand dg = {}; RenderCommand dg = {};
int method = 0; int method = 0;
@ -659,7 +659,7 @@ void F2DDrawer::rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
PalEntry p = 0xffffffff; PalEntry p = 0xffffffff;
dg.mTexture = pic? pic : TileFiles.tiles[picnum]; dg.mTexture = pic? pic : TileFiles.tiles[picnum];
dg.mRemapIndex = dapalnum | (dashade << 16); dg.mRemapIndex = dapalnum | (basepal << 8) | (dashade << 16);
dg.mVertCount = 4; dg.mVertCount = 4;
dg.mVertIndex = (int)mVertices.Reserve(4); dg.mVertIndex = (int)mVertices.Reserve(4);
auto ptr = &mVertices[dg.mVertIndex]; auto ptr = &mVertices[dg.mVertIndex];

View file

@ -142,7 +142,7 @@ public:
void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int8_t dashade, uint8_t dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend,
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, FTexture *pic); int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, FTexture *pic = nullptr, int basepal = 0);
void Clear(); void Clear();

View file

@ -432,10 +432,7 @@ void OpenGLFrameBuffer::Draw2D()
GLRenderer->mBuffers->BindCurrentFB(); GLRenderer->mBuffers->BindCurrentFB();
::DrawFullscreenBlends(); ::DrawFullscreenBlends();
DrawRateStuff(); DrawRateStuff();
auto savepal = curbasepal;
if (!(curpaletteflags & (Pal_Fullscreen|Pal_2D))) curbasepal = 0;
GLInterface.Draw2D(&twodgen); GLInterface.Draw2D(&twodgen);
curbasepal = savepal;
} }
} }

View file

@ -16,7 +16,7 @@ struct FWriter;
struct FReader; struct FReader;
class FFont; class FFont;
class FSoundID; class FSoundID;
union FRenderStyle; struct FRenderStyle;
inline bool nullcmp(const void *buffer, size_t length) inline bool nullcmp(const void *buffer, size_t length)
{ {

View file

@ -1624,12 +1624,12 @@ static void Net_SyncPlayer(ENetEvent *event)
static void display_betascreen(void) static void display_betascreen(void)
{ {
rotatesprite_fs(160 << 16, 100 << 16, 65536, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, TITLEPAL);
rotatesprite_fs(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8); rotatesprite_fs(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8, nullptr, TITLEPAL);
rotatesprite_fs(160 << 16, (129) << 16, 30 << 11, 0, THREEDEE, 0, 0, 2 + 8); rotatesprite_fs(160 << 16, (129) << 16, 30 << 11, 0, THREEDEE, 0, 0, 2 + 8, nullptr, TITLEPAL);
if (PLUTOPAK) // JBF 20030804 if (PLUTOPAK) // JBF 20030804
rotatesprite_fs(160 << 16, (151) << 16, 30 << 11, 0, PLUTOPAKSPRITE + 1, 0, 0, 2 + 8); rotatesprite_fs(160 << 16, (151) << 16, 30 << 11, 0, PLUTOPAKSPRITE + 1, 0, 0, 2 + 8, nullptr, TITLEPAL);
} }
@ -4696,8 +4696,6 @@ void Net_WaitForServer(void)
if (numplayers < 2 || g_netServer) if (numplayers < 2 || g_netServer)
return; return;
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, Pal_2D);
do do
{ {
if (G_FPSLimit()) if (G_FPSLimit())

View file

@ -1045,7 +1045,7 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_
} }
// START and END limits are always inclusive! // START and END limits are always inclusive!
static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t tile) static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t tile, int basepal)
{ {
if (ud.screenfade == 0) if (ud.screenfade == 0)
return; return;
@ -1064,7 +1064,7 @@ static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t
return; return;
} }
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, tile, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, tile, 0, 0, 2+8+64+BGSTRETCH, nullptr, basepal);
G_FadePalette(r, g, b, start); G_FadePalette(r, g, b, start);
start += step; start += step;
} while (start != end+step); } while (start != end+step);
@ -1091,11 +1091,11 @@ void gameDisplayTENScreen()
inputState.ClearAllInput(); inputState.ClearAllInput();
totalclock = 0; totalclock = 0;
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, TENSCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, TENSCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN); fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN, BASEPAL);
while (!inputState.CheckAllInput() && totalclock < 2400) while (!inputState.CheckAllInput() && totalclock < 2400)
gameHandleEvents(); gameHandleEvents();
fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN); fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN, BASEPAL);
inputState.ClearAllInput(); inputState.ClearAllInput();
#ifdef __ANDROID__ #ifdef __ANDROID__
inExtraScreens = 0; inExtraScreens = 0;
@ -1114,14 +1114,14 @@ void gameDisplaySharewareScreens()
fadepal(0, 0, 0, 0, 252, 28); fadepal(0, 0, 0, 0, 252, 28);
inputState.ClearAllInput(); inputState.ClearAllInput();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3291, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3291, 0, 0, 2 + 8 + 64 + BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, 3291); fadepaltile(0, 0, 0, 252, 0, -28, 3291, BASEPAL);
while (!inputState.CheckAllInput()) while (!inputState.CheckAllInput())
gameHandleEvents(); gameHandleEvents();
fadepaltile(0, 0, 0, 0, 252, 28, 3291); fadepaltile(0, 0, 0, 0, 252, 28, 3291, BASEPAL);
inputState.ClearAllInput(); inputState.ClearAllInput();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3290, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3290, 0, 0, 2 + 8 + 64 + BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, 3290); fadepaltile(0, 0, 0, 252, 0, -28, 3290, BASEPAL);
while (!inputState.CheckAllInput()) while (!inputState.CheckAllInput())
gameHandleEvents(); gameHandleEvents();
@ -1158,12 +1158,11 @@ void gameDisplay3DRScreen()
{ {
videoClearScreen(0); videoClearScreen(0);
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, Pal_Fullscreen); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28); fadepal(0, 0, 0, 0, 252, 28);
renderFlushPerms(); renderFlushPerms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, DREALMSPAL);
videoNextPage(); videoNextPage();
fadepaltile(0, 0, 0, 252, 0, -28, DREALMS); fadepaltile(0, 0, 0, 252, 0, -28, DREALMS, DREALMSPAL);
totalclock = 0; totalclock = 0;
while (totalclock < (120 * 7) && !inputState.CheckAllInput()) while (totalclock < (120 * 7) && !inputState.CheckAllInput())
@ -1171,13 +1170,13 @@ void gameDisplay3DRScreen()
if (G_FPSLimit()) if (G_FPSLimit())
{ {
videoClearScreen(0); videoClearScreen(0);
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, DREALMSPAL);
gameHandleEvents(); gameHandleEvents();
videoNextPage(); videoNextPage();
} }
} }
fadepaltile(0, 0, 0, 0, 252, 28, DREALMS); fadepaltile(0, 0, 0, 0, 252, 28, DREALMS, DREALMSPAL);
} }
} }
} }
@ -1189,12 +1188,9 @@ void gameDisplayTitleScreen(void)
videoClearScreen(0); videoClearScreen(0);
// g_player[myconnectindex].ps->palette = titlepal; rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, TITLEPAL);
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, Pal_2D); // JBF 20040308
renderFlushPerms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH);
inputState.keyFlushChars(); inputState.keyFlushChars();
fadepaltile(0, 0, 0, 252, 0, -28, BETASCREEN); fadepaltile(0, 0, 0, 252, 0, -28, BETASCREEN, TITLEPAL);
totalclock = 0; totalclock = 0;
while ( while (
@ -1206,7 +1202,7 @@ void gameDisplayTitleScreen(void)
if (G_FPSLimit()) if (G_FPSLimit())
{ {
videoClearScreen(0); videoClearScreen(0);
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, TITLEPAL);
if (logoflags & LOGO_DUKENUKEM) if (logoflags & LOGO_DUKENUKEM)
{ {
if (totalclock > 120 && totalclock < (120 + 60)) if (totalclock > 120 && totalclock < (120 + 60))
@ -1216,10 +1212,10 @@ void gameDisplayTitleScreen(void)
titlesound++; titlesound++;
S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI);
} }
rotatesprite_fs(160 << 16, 104 << 16, ((int32_t) totalclock - 120) << 10, 0, DUKENUKEM, 0, 0, 2 + 8); rotatesprite_fs(160 << 16, 104 << 16, ((int32_t) totalclock - 120) << 10, 0, DUKENUKEM, 0, 0, 2 + 8, nullptr, TITLEPAL);
} }
else if (totalclock >= (120 + 60)) else if (totalclock >= (120 + 60))
rotatesprite_fs(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8); rotatesprite_fs(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8, nullptr, TITLEPAL);
} }
else else
titlesound++; titlesound++;
@ -1234,11 +1230,11 @@ void gameDisplayTitleScreen(void)
S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI);
} }
rotatesprite_fs(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8); rotatesprite_fs(160 << 16, (104) << 16, 60 << 10, 0, DUKENUKEM, 0, 0, 2 + 8, nullptr, TITLEPAL);
rotatesprite_fs(160 << 16, (129) << 16, ((int32_t) totalclock - 220) << 11, 0, THREEDEE, 0, 0, 2 + 8); rotatesprite_fs(160 << 16, (129) << 16, ((int32_t) totalclock - 220) << 11, 0, THREEDEE, 0, 0, 2 + 8, nullptr, TITLEPAL);
} }
else if (totalclock >= (220 + 30)) else if (totalclock >= (220 + 30))
rotatesprite_fs(160 << 16, (129) << 16, 30 << 11, 0, THREEDEE, 0, 0, 2 + 8); rotatesprite_fs(160 << 16, (129) << 16, 30 << 11, 0, THREEDEE, 0, 0, 2 + 8, nullptr, TITLEPAL);
} }
else else
titlesound++; titlesound++;
@ -1249,7 +1245,7 @@ void gameDisplayTitleScreen(void)
if (totalclock >= 280 && totalclock < 395) if (totalclock >= 280 && totalclock < 395)
{ {
rotatesprite_fs(160 << 16, (151) << 16, (410 - (int32_t) totalclock) << 12, 0, PLUTOPAKSPRITE + 1, rotatesprite_fs(160 << 16, (151) << 16, (410 - (int32_t) totalclock) << 12, 0, PLUTOPAKSPRITE + 1,
(sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0, 2 + 8); (sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0, 2 + 8, nullptr, TITLEPAL);
if (titlesound == 2) if (titlesound == 2)
{ {
titlesound++; titlesound++;
@ -1264,21 +1260,12 @@ void gameDisplayTitleScreen(void)
S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI);
} }
rotatesprite_fs(160 << 16, (151) << 16, 30 << 11, 0, PLUTOPAKSPRITE + 1, (sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0, rotatesprite_fs(160 << 16, (151) << 16, 30 << 11, 0, PLUTOPAKSPRITE + 1, (sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0,
2 + 8); 2 + 8, nullptr, TITLEPAL);
} }
} }
#ifdef LUNATIC
g_elEventError = 0;
#endif
VM_OnEvent(EVENT_LOGO, -1, screenpeek); VM_OnEvent(EVENT_LOGO, -1, screenpeek);
videoNextPage(); videoNextPage();
#ifdef LUNATIC
if (g_elEventError)
break;
#endif
} }
gameHandleEvents(); gameHandleEvents();
@ -1418,9 +1405,8 @@ static void G_BonusCutscenes(void)
350, 380, VICTORY1+8, 86, 59 // duplicate row to alleviate overflow in the for loop below "boss" 350, 380, VICTORY1+8, 86, 59 // duplicate row to alleviate overflow in the for loop below "boss"
}; };
P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, Pal_Fullscreen); // JBF 20040308
videoClearScreen(0L); videoClearScreen(0L);
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(0, 50 << 16, 65536L, 0, VICTORY1, 0, 0, 2 + 8 + 16 + 64 + 128 + BGSTRETCH, nullptr, ENDINGPAL);
videoNextPage(); videoNextPage();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
@ -1432,7 +1418,7 @@ static void G_BonusCutscenes(void)
if (G_FPSLimit()) if (G_FPSLimit())
{ {
videoClearScreen(0L); videoClearScreen(0L);
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH, nullptr, ENDINGPAL);
// boss // boss
if (totalclock > 390 && totalclock < 780) if (totalclock > 390 && totalclock < 780)
@ -1444,7 +1430,7 @@ static void G_BonusCutscenes(void)
S_PlaySound(SQUISHED, CHAN_AUTO, CHANF_UI); S_PlaySound(SQUISHED, CHAN_AUTO, CHANF_UI);
bonuscnt++; bonuscnt++;
} }
rotatesprite_fs(bossmove[t+3]<<16, bossmove[t+4]<<16, 65536L, 0, bossmove[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(bossmove[t+3]<<16, bossmove[t+4]<<16, 65536L, 0, bossmove[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH, nullptr, ENDINGPAL);
} }
// Breathe // Breathe
@ -1460,7 +1446,7 @@ static void G_BonusCutscenes(void)
if (totalclock >= 750) if (totalclock >= 750)
{ {
rotatesprite_fs(86<<16, 59<<16, 65536L, 0, VICTORY1+8, 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(86<<16, 59<<16, 65536L, 0, VICTORY1+8, 0, 0, 2+8+16+64+128+BGSTRETCH, nullptr, ENDINGPAL);
if (totalclock >= 750 && bonuscnt == 2) if (totalclock >= 750 && bonuscnt == 2)
{ {
S_PlaySound(DUKETALKTOBOSS, CHAN_AUTO, CHANF_UI); S_PlaySound(DUKETALKTOBOSS, CHAN_AUTO, CHANF_UI);
@ -1476,7 +1462,7 @@ static void G_BonusCutscenes(void)
S_PlaySound(BOSSTALKTODUKE, CHAN_AUTO, CHANF_UI); S_PlaySound(BOSSTALKTODUKE, CHAN_AUTO, CHANF_UI);
bonuscnt++; bonuscnt++;
} }
rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH, nullptr, ENDINGPAL);
} }
} }
videoNextPage(); videoNextPage();

View file

@ -56,7 +56,7 @@ inline int Cos(int angle)
} }
int movesprite(short spritenum, int dx, int dy, int dz, int ceildist, int flordist, unsigned int clipmask); int movesprite(short spritenum, int dx, int dy, int dz, int ceildist, int flordist, unsigned int clipmask);
void overwritesprite(int thex, int they, short tilenum, signed char shade, char stat, char dapalnum); void overwritesprite(int thex, int they, short tilenum, signed char shade, char stat, char dapalnum, int basepal = 0);
void precache(); void precache();
void resettiming(); void resettiming();
void printext(int x, int y, const char* buffer, short tilenum, char invisiblecol); void printext(int x, int y, const char* buffer, short tilenum, char invisiblecol);

View file

@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS BEGIN_PS_NS
void overwritesprite(int thex, int they, short tilenum, signed char shade, char stat, char dapalnum) void overwritesprite(int thex, int they, short tilenum, signed char shade, char stat, char dapalnum, int basepal)
{ {
#if 0 #if 0
rotatesprite(thex << 16, they << 16, 0x10000, (short)((flags & 8) << 7), tilenum, shade, dapalnum, rotatesprite(thex << 16, they << 16, 0x10000, (short)((flags & 8) << 7), tilenum, shade, dapalnum,
@ -55,7 +55,7 @@ void overwritesprite(int thex, int they, short tilenum, signed char shade, char
they += offy; they += offy;
rotatesprite(thex << 16, they << 16, 65536L, (stat & 8) << 7, tilenum, shade, dapalnum, rotatesprite(thex << 16, they << 16, 65536L, (stat & 8) << 7, tilenum, shade, dapalnum,
16 + (stat & 2) + ((stat & 4) >> 2) + (((stat & 16) >> 2) ^ ((stat & 8) >> 1)), 16 + (stat & 2) + ((stat & 4) >> 2) + (((stat & 16) >> 2) ^ ((stat & 8) >> 1)),
windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y, nullptr, basepal);
picanm[tilenum].sf = animbak; picanm[tilenum].sf = animbak;
} }

View file

@ -2507,25 +2507,20 @@ void KeyFn1()
videoNextPage(); videoNextPage();
} }
extern int currentCinemaPalette;
void DoGameOverScene() void DoGameOverScene()
{ {
FadeOut(0); FadeOut(0);
inputState.ClearAllInput(); inputState.ClearAllInput();
if (LoadCinemaPalette(16) < 0) {
return;
}
SetOverscan(ANIMPAL);
NoClip(); NoClip();
overwritesprite(0, 0, kTile3591, 0, 2, kPalNormal); overwritesprite(0, 0, kTile3591, 0, 2, kPalNormal, 16);
Clip(); Clip();
videoNextPage(); videoNextPage();
CinemaFadeIn(); CinemaFadeIn();
PlayGameOverSound(); PlayGameOverSound();
WaitAnyKey(3); WaitAnyKey(3);
FadeOut(0); FadeOut(0);
SetOverscan(BASEPAL);
} }
void DoTitle() void DoTitle()
@ -2739,7 +2734,7 @@ int CopyCharToBitmap(char nChar, int nTile, int xPos, int yPos)
} }
// Note: strings passed should be uppercase // Note: strings passed should be uppercase
int myprintext(int x, int y, const char *str, int shade) int myprintext(int x, int y, const char *str, int shade, int basepal)
{ {
if (y < -15 || y >= 200) if (y < -15 || y >= 200)
return x; return x;
@ -2749,7 +2744,7 @@ int myprintext(int x, int y, const char *str, int shade)
while (*c != '\0') while (*c != '\0')
{ {
int nTile = seq_GetSeqPicnum(kSeqFont2, 0, (*c) - 32); int nTile = seq_GetSeqPicnum(kSeqFont2, 0, (*c) - 32);
overwritesprite(x, y, nTile, shade, 2, kPalNormal); overwritesprite(x, y, nTile, shade, 2, kPalNormal, basepal);
int tileWidth = tilesiz[nTile].x; int tileWidth = tilesiz[nTile].x;

View file

@ -192,7 +192,7 @@ void WaitTicks(int nTicks);
void FadeIn(); void FadeIn();
void FadeOut(int bFadeMusic); void FadeOut(int bFadeMusic);
int myprintext(int x, int y, const char *str, int shade); int myprintext(int x, int y, const char *str, int shade, int basepal = 0);
int MyGetStringWidth(const char *str); int MyGetStringWidth(const char *str);
void mychangespritesect(int nSprite, int nSector); void mychangespritesect(int nSprite, int nSector);

View file

@ -52,6 +52,7 @@ enum
kTagRamses = 61, kTagRamses = 61,
}; };
void uploadCinemaPalettes();
ClockTicks ototalclock = 0; ClockTicks ototalclock = 0;
int initx, inity, initz; int initx, inity, initz;
@ -216,7 +217,7 @@ void InstallEngine()
{ {
G_FatalEngineError(); G_FatalEngineError();
} }
uploadCinemaPalettes();
LoadPaletteLookups(); LoadPaletteLookups();
V_Init2(); V_Init2();

View file

@ -93,9 +93,6 @@ int LoadPaletteLookups()
} }
hFile.Read(buffer, 256*64); hFile.Read(buffer, 256*64);
// TODO: dumb hack
if (lookuptables[i])
ALIGNED_FREE_AND_NULL(lookuptables[i]);
paletteSetLookupTable(i, buffer); paletteSetLookupTable(i, buffer);
bGreenPal = 0; bGreenPal = 0;

View file

@ -64,7 +64,6 @@ uint8_t * PlasmaBuffer;
uint8_t energytile[66 * 66] = {0}; uint8_t energytile[66 * 66] = {0};
uint8_t cinemapal[768];
short nLeft[50] = {0}; short nLeft[50] = {0};
int line; int line;
@ -991,30 +990,21 @@ int nextclock;
short nHeight; short nHeight;
short nCrawlY; short nCrawlY;
short cinematile; short cinematile;
int currentCinemaPalette;
// TODO - moveme void uploadCinemaPalettes()
int LoadCinemaPalette(int nPal)
{ {
nPal--; for (int i = 0; i < countof(cinpalfname); i++)
{
if (nPal < 0 || nPal >= kMaxCinemaPals) { uint8_t palette[768] = {};
return -2; auto hFile = fileSystem.OpenFileReader(cinpalfname[i]);
} if (hFile.isOpen())
hFile.Read(palette, 768);
// original code strcpy'd into a buffer first... for (auto& c : palette)
auto hFile = fileSystem.OpenFileReader(cinpalfname[nPal]);
if (!hFile.isOpen()) {
return -2;
}
hFile.Read(cinemapal, sizeof(cinemapal));
for (auto &c : cinemapal)
c <<= 2; c <<= 2;
paletteSetColorTable(ANIMPAL+i, palette);
return nPal; }
} }
//int IncrementCinemaFadeIn() //int IncrementCinemaFadeIn()
@ -1053,8 +1043,7 @@ void CinemaFadeIn()
{ {
BlackOut(); BlackOut();
paletteSetColorTable(ANIMPAL, cinemapal); //videoSetPalette(0, ANIMPAL, Pal_Fullscreen);
videoSetPalette(0, ANIMPAL, Pal_Fullscreen);
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST) if (videoGetRenderMode() >= REND_POLYMOST)
@ -1135,7 +1124,7 @@ bool AdvanceCinemaText()
while (i < linecount && y <= 199) while (i < linecount && y <= 199)
{ {
if (y >= -10) { if (y >= -10) {
myprintext(nLeft[i], y, gString[line + i], 0); myprintext(nLeft[i], y, gString[line + i], 0, currentCinemaPalette);
} }
i++; i++;
@ -1171,7 +1160,7 @@ void DoCinemaText(short nVal)
while (bContinue) while (bContinue)
{ {
overwritesprite(0, 0, cinematile, 0, 2, kPalNormal); overwritesprite(0, 0, cinematile, 0, 2, kPalNormal, currentCinemaPalette);
bContinue = AdvanceCinemaText(); bContinue = AdvanceCinemaText();
@ -1191,53 +1180,47 @@ void GoToTheCinema(int nVal)
case 0: case 0:
{ {
LoadCinemaPalette(1);
cinematile = 3454; cinematile = 3454;
break; break;
} }
case 1: case 1:
{ {
LoadCinemaPalette(2);
cinematile = 3452; cinematile = 3452;
break; break;
} }
case 2: case 2:
{ {
LoadCinemaPalette(3);
cinematile = 3449; cinematile = 3449;
break; break;
} }
case 3: case 3:
{ {
LoadCinemaPalette(4);
cinematile = 3445; cinematile = 3445;
break; break;
} }
case 4: case 4:
{ {
LoadCinemaPalette(5);
cinematile = 3451; cinematile = 3451;
break; break;
} }
case 5: case 5:
{ {
LoadCinemaPalette(6);
cinematile = 3448; cinematile = 3448;
break; break;
} }
case 6: case 6:
{ {
LoadCinemaPalette(7);
cinematile = 3446; cinematile = 3446;
break; break;
} }
} }
currentCinemaPalette = nVal;
#if 0 #if 0
if (ISDEMOVER) { if (ISDEMOVER) {
@ -1251,12 +1234,12 @@ void GoToTheCinema(int nVal)
StopAllSounds(); StopAllSounds();
NoClip(); NoClip();
overwritesprite(0, 0, kMovieTile, 100, 2, kPalNormal); overwritesprite(0, 0, kMovieTile, 100, 2, kPalNormal, currentCinemaPalette);
videoNextPage(); videoNextPage();
// int386(16, (const union REGS *)&val, (union REGS *)&val) // int386(16, (const union REGS *)&val, (union REGS *)&val)
overwritesprite(0, 0, cinematile, 0, 2, kPalNormal); overwritesprite(0, 0, cinematile, 0, 2, kPalNormal, currentCinemaPalette);
videoNextPage(); videoNextPage();
CinemaFadeIn(); CinemaFadeIn();
@ -1321,7 +1304,7 @@ void GoToTheCinema(int nVal)
FadeOut(kTrue); FadeOut(kTrue);
overwritesprite(0, 0, kMovieTile, 100, 2, kPalNormal); overwritesprite(0, 0, kMovieTile, 100, 2, kPalNormal, currentCinemaPalette);
videoNextPage(); videoNextPage();
GrabPalette(); GrabPalette();

View file

@ -605,8 +605,6 @@ bool GameInterface::GenerateSavePic()
return true; return true;
} }
void NoClip() void NoClip()
{ {
videoSetViewableArea(0, 0, xdim - 1, ydim - 1); videoSetViewableArea(0, 0, xdim - 1, ydim - 1);

View file

@ -296,7 +296,7 @@ int PaletteManager::LookupPalette(int palette, int palswap, bool brightmap, bool
PaletteData* paldata = &palettes[realpal]; PaletteData* paldata = &palettes[realpal];
PalswapData* swapdata = &palswaps[realswap]; PalswapData* swapdata = &palswaps[realswap];
PalEntry swappedpalette[256]; PalEntry swappedpalette[256];
int end = nontransparent255 ? 256 : 255; int end = paldata->colors[255].a == 255 ? 256 : 255;
if (!brightmap) if (!brightmap)
{ {
for (int i = 0; i < end; i++) for (int i = 0; i < end; i++)
@ -331,7 +331,7 @@ int PaletteManager::LookupPalette(int palette, int palswap, bool brightmap, bool
return -1; return -1;
} }
} }
if (!nontransparent255) swappedpalette[255] = 0; if (end == 255) swappedpalette[255] = 0;
int palid = FindPalette((uint8_t*)swappedpalette); int palid = FindPalette((uint8_t*)swappedpalette);
swappedpalmap.Insert(combined, palid); swappedpalmap.Insert(combined, palid);
return palid; return palid;

View file

@ -201,7 +201,7 @@ bool GLInstance::SetTextureInternal(int picnum, FTexture* tex, int palette, int
applytint = true; applytint = true;
if (!(h.f & HICTINT_APPLYOVERPALSWAP)) usepalswap = 0; if (!(h.f & HICTINT_APPLYOVERPALSWAP)) usepalswap = 0;
} }
lookuppal = palmanager.LookupPalette(usepalette, usepalswap, false,fixpalette < 0? !!(curpaletteflags & Pal_Fullscreen) : 0); lookuppal = palmanager.LookupPalette(usepalette, usepalswap, false, 0);
} }
} }
@ -286,7 +286,7 @@ bool GLInstance::SetTextureInternal(int picnum, FTexture* tex, int palette, int
} }
} }
#if 1 #if 1
if (!(tex->PicAnim.sf & PICANM_NOFULLBRIGHT_BIT) && !(globalflags & GLOBAL_NO_GL_FULLBRIGHT) && !tex->NoBrightmapFlag[usepalswap] && !(curpaletteflags & (Pal_Fullscreen|Pal_2D))) if (!(tex->PicAnim.sf & PICANM_NOFULLBRIGHT_BIT) && !(globalflags & GLOBAL_NO_GL_FULLBRIGHT) && !tex->NoBrightmapFlag[usepalswap])
{ {
if (TextureType == TT_HICREPLACE) if (TextureType == TT_HICREPLACE)
{ {

View file

@ -41,6 +41,7 @@
#include "v_draw.h" #include "v_draw.h"
#include "palette.h" #include "palette.h"
#include "flatvertices.h" #include "flatvertices.h"
#include "build.h"
extern int16_t numshades; extern int16_t numshades;
extern TArray<VSMatrix> matrixArray; extern TArray<VSMatrix> matrixArray;
@ -173,7 +174,13 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
// todo: Set up hictinting. (broken as the feature is...) // todo: Set up hictinting. (broken as the feature is...)
SetShade(cmd.mRemapIndex >> 16, numshades); SetShade(cmd.mRemapIndex >> 16, numshades);
SetFadeDisable(false); SetFadeDisable(false);
SetTexture(0, tex, cmd.mRemapIndex & 0xffff, 4/*DAMETH_CLAMPED*/, cmd.mFlags & F2DDrawer::DTF_Wrap ? SamplerRepeat : SamplerClampXY); auto saved = curbasepal; // screw Build's dependencies on global state variables. We only need to change this for the following SetTexture call.
curbasepal = (cmd.mRemapIndex >> 8) & 0xff;
auto savedf = globalflags;
if (curbasepal > 0) globalflags |= GLOBAL_NO_GL_FULLBRIGHT; // temp. hack to disable brightmaps.
SetTexture(0, tex, cmd.mRemapIndex & 0xff, 4/*DAMETH_CLAMPED*/, cmd.mFlags & F2DDrawer::DTF_Wrap ? SamplerRepeat : SamplerClampXY);
curbasepal = saved;
globalflags = savedf;
} }
else else
{ {

View file

@ -132,12 +132,12 @@ void Net_SyncPlayer(ENetEvent *event)
static void display_betascreen(void) static void display_betascreen(void)
{ {
rotatesprite_fs(160<<16,100<<16,65536,0,BETASCREEN,0,0,2+8+64+BGSTRETCH); rotatesprite_fs(160<<16,100<<16,65536,0,BETASCREEN,0,0,2+8+64+BGSTRETCH, nullptr, TITLEPAL);
rotatesprite_fs(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8); rotatesprite_fs(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8, nullptr, TITLEPAL);
rotatesprite_fs(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8); rotatesprite_fs(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8, nullptr, TITLEPAL);
if (PLUTOPAK) // JBF 20030804 if (PLUTOPAK) // JBF 20030804
rotatesprite_fs(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8); rotatesprite_fs(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8, nullptr, TITLEPAL);
} }
void faketimerhandler(void) void faketimerhandler(void)
@ -166,8 +166,6 @@ void Net_WaitForEverybody(void)
} }
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, Pal_2D);
do do
{ {
if (G_FPSLimit()) if (G_FPSLimit())

View file

@ -1010,7 +1010,7 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_
} }
// START and END limits are always inclusive! // START and END limits are always inclusive!
static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t tile) static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t tile, int basepal)
{ {
if (ud.screenfade == 0) if (ud.screenfade == 0)
return; return;
@ -1028,7 +1028,7 @@ static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t
videoFadePalette(r, g, b, end); // have to set to end fade value if we break! videoFadePalette(r, g, b, end); // have to set to end fade value if we break!
return; return;
} }
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, tile, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, tile, 0, 0, 2+8+64+BGSTRETCH, nullptr, basepal);
G_FadePalette(r, g, b, start); G_FadePalette(r, g, b, start);
start += step; start += step;
@ -1051,13 +1051,13 @@ void G_DisplayExtraScreens(void)
fadepal(0, 0, 0, 0, 252, 28); fadepal(0, 0, 0, 0, 252, 28);
inputState.ClearAllInput(); inputState.ClearAllInput();
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3291, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3291, 0, 0, 2+8+64+BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, 3291); fadepaltile(0, 0, 0, 252, 0, -28, 3291, BASEPAL);
while (!inputState.CheckAllInput()) while (!inputState.CheckAllInput())
G_HandleAsync(); G_HandleAsync();
fadepaltile(0, 0, 0, 0, 252, 28, 3291); fadepaltile(0, 0, 0, 0, 252, 28, 3291, BASEPAL);
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3290, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3290, 0, 0, 2+8+64+BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, 3290); fadepaltile(0, 0, 0, 252, 0, -28, 3290, BASEPAL);
while (!inputState.CheckAllInput()) while (!inputState.CheckAllInput())
G_HandleAsync(); G_HandleAsync();
@ -1073,11 +1073,11 @@ void G_DisplayExtraScreens(void)
inputState.ClearAllInput(); inputState.ClearAllInput();
totalclock = 0; totalclock = 0;
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TENSCREEN, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TENSCREEN, 0, 0, 2+8+64+BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN); fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN, BASEPAL);
while (!inputState.CheckAllInput() && totalclock < 2400) while (!inputState.CheckAllInput() && totalclock < 2400)
G_HandleAsync(); G_HandleAsync();
fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN); fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN, BASEPAL);
inputState.ClearAllInput(); inputState.ClearAllInput();
} }
} }
@ -1113,7 +1113,7 @@ void G_DisplayLogo(void)
renderFlushPerms(); renderFlushPerms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 7106, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 7106, 0, 0, 2 + 8 + 64 + BGSTRETCH);
videoNextPage(); videoNextPage();
fadepaltile(0, 0, 0, 252, 0, -4, 7106); fadepaltile(0, 0, 0, 252, 0, -4, 7106, BASEPAL);
totalclock = 0; totalclock = 0;
while (totalclock < (120 * 3) && !inputState.CheckAllInput()) while (totalclock < (120 * 3) && !inputState.CheckAllInput())
@ -1133,7 +1133,7 @@ void G_DisplayLogo(void)
} }
} }
fadepaltile(0, 0, 0, 0, 252, 4, 7106); fadepaltile(0, 0, 0, 0, 252, 4, 7106, BASEPAL);
} }
videoClearScreen(0L); videoClearScreen(0L);
@ -1158,7 +1158,7 @@ void G_DisplayLogo(void)
renderFlushPerms(); renderFlushPerms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 7107, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 7107, 0, 0, 2 + 8 + 64 + BGSTRETCH);
videoNextPage(); videoNextPage();
fadepaltile(0, 0, 0, 252, 0, -4, 7107); fadepaltile(0, 0, 0, 252, 0, -4, 7107, BASEPAL);
totalclock = 0; totalclock = 0;
while (totalclock < (120 * 3) && !inputState.CheckAllInput()) while (totalclock < (120 * 3) && !inputState.CheckAllInput())
@ -1178,7 +1178,7 @@ void G_DisplayLogo(void)
} }
} }
fadepaltile(0, 0, 0, 0, 252, 4, 7107); fadepaltile(0, 0, 0, 0, 252, 4, 7107, BASEPAL);
} }
inputState.ClearAllInput(); inputState.ClearAllInput();
@ -1285,12 +1285,11 @@ void G_DisplayLogo(void)
{ {
videoClearScreen(0); videoClearScreen(0);
P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, Pal_Fullscreen); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28); fadepal(0, 0, 0, 0, 252, 28);
renderFlushPerms(); renderFlushPerms();
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, DREALMSPAL);
videoNextPage(); videoNextPage();
fadepaltile(0, 0, 0, 252, 0, -28, DREALMS); fadepaltile(0, 0, 0, 252, 0, -28, DREALMS, DREALMSPAL);
totalclock = 0; totalclock = 0;
while (totalclock < (120 * 7) && !inputState.CheckAllInput()) while (totalclock < (120 * 7) && !inputState.CheckAllInput())
@ -1298,13 +1297,13 @@ void G_DisplayLogo(void)
if (G_FPSLimit()) if (G_FPSLimit())
{ {
videoClearScreen(0); videoClearScreen(0);
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH, nullptr, DREALMSPAL);
G_HandleAsync(); G_HandleAsync();
videoNextPage(); videoNextPage();
} }
} }
fadepaltile(0, 0, 0, 0, 252, 28, DREALMS); fadepaltile(0, 0, 0, 0, 252, 28, DREALMS, DREALMSPAL);
} }
} }
@ -1319,11 +1318,10 @@ void G_DisplayLogo(void)
videoClearScreen(0); videoClearScreen(0);
//g_player[myconnectindex].ps->palette = titlepal; //g_player[myconnectindex].ps->palette = titlepal;
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, Pal_2D); // JBF 20040308
renderFlushPerms(); renderFlushPerms();
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH, nullptr, TITLEPAL);
inputState.keyFlushChars(); inputState.keyFlushChars();
fadepaltile(0, 0, 0, 252, 0, -28, BETASCREEN); fadepaltile(0, 0, 0, 252, 0, -28, BETASCREEN, TITLEPAL);
totalclock = 0; totalclock = 0;
while ( while (
@ -1333,7 +1331,7 @@ void G_DisplayLogo(void)
if (G_FPSLimit()) if (G_FPSLimit())
{ {
videoClearScreen(0); videoClearScreen(0);
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH, nullptr, TITLEPAL);
if (totalclock > 120 && totalclock < (120+60)) if (totalclock > 120 && totalclock < (120+60))
{ {
@ -1342,10 +1340,10 @@ void G_DisplayLogo(void)
soundanm++; soundanm++;
S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI);
} }
rotatesprite_fs(160<<16, 104<<16, ((int32_t) totalclock-120)<<10, 0, DUKENUKEM, 0, 0, 2+8); rotatesprite_fs(160<<16, 104<<16, ((int32_t) totalclock-120)<<10, 0, DUKENUKEM, 0, 0, 2+8, nullptr, TITLEPAL);
} }
else if (totalclock >= (120+60)) else if (totalclock >= (120+60))
rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8); rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8, nullptr, TITLEPAL);
if (totalclock > 220 && totalclock < (220+30)) if (totalclock > 220 && totalclock < (220+30))
{ {
@ -1355,18 +1353,18 @@ void G_DisplayLogo(void)
S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI);
} }
rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8); rotatesprite_fs(160<<16, (104)<<16, 60<<10, 0, DUKENUKEM, 0, 0, 2+8, nullptr, TITLEPAL);
rotatesprite_fs(160<<16, (129)<<16, ((int32_t) totalclock - 220)<<11, 0, THREEDEE, 0, 0, 2+8); rotatesprite_fs(160<<16, (129)<<16, ((int32_t) totalclock - 220)<<11, 0, THREEDEE, 0, 0, 2+8, nullptr, TITLEPAL);
} }
else if (totalclock >= (220+30)) else if (totalclock >= (220+30))
rotatesprite_fs(160<<16, (129)<<16, 30<<11, 0, THREEDEE, 0, 0, 2+8); rotatesprite_fs(160<<16, (129)<<16, 30<<11, 0, THREEDEE, 0, 0, 2+8, nullptr, TITLEPAL);
if (PLUTOPAK) if (PLUTOPAK)
{ {
// JBF 20030804 // JBF 20030804
if (totalclock >= 280 && totalclock < 395) if (totalclock >= 280 && totalclock < 395)
{ {
rotatesprite_fs(160<<16, (151)<<16, (410-(int32_t) totalclock)<<12, 0, PLUTOPAKSPRITE+1, (sintable[((int32_t) totalclock<<4)&2047]>>11), 0, 2+8); rotatesprite_fs(160<<16, (151)<<16, (410-(int32_t) totalclock)<<12, 0, PLUTOPAKSPRITE+1, (sintable[((int32_t) totalclock<<4)&2047]>>11), 0, 2+8, nullptr, TITLEPAL);
if (soundanm == 2) if (soundanm == 2)
{ {
soundanm++; soundanm++;
@ -1380,7 +1378,7 @@ void G_DisplayLogo(void)
soundanm++; soundanm++;
S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI); S_PlaySound(PIPEBOMB_EXPLODE, CHAN_AUTO, CHANF_UI);
} }
rotatesprite_fs(160<<16, (151)<<16, 30<<11, 0, PLUTOPAKSPRITE+1, (sintable[((int32_t) totalclock<<4)&2047]>>11), 0, 2+8); rotatesprite_fs(160<<16, (151)<<16, 30<<11, 0, PLUTOPAKSPRITE+1, (sintable[((int32_t) totalclock<<4)&2047]>>11), 0, 2+8, nullptr, TITLEPAL);
} }
} }
@ -1509,9 +1507,8 @@ static void G_BonusCutscenes(void)
350, 380, VICTORY1+8, 86, 59 // duplicate row to alleviate overflow in the for loop below "boss" 350, 380, VICTORY1+8, 86, 59 // duplicate row to alleviate overflow in the for loop below "boss"
}; };
P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, Pal_Fullscreen); // JBF 20040308
videoClearScreen(0L); videoClearScreen(0L);
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH, nullptr, ENDINGPAL);
videoNextPage(); videoNextPage();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
@ -1523,7 +1520,7 @@ static void G_BonusCutscenes(void)
if (G_FPSLimit()) if (G_FPSLimit())
{ {
videoClearScreen(0L); videoClearScreen(0L);
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(0, 50 << 16, 65536L, 0, VICTORY1, 0, 0, 2 + 8 + 16 + 64 + 128 + BGSTRETCH, nullptr, ENDINGPAL);
// boss // boss
if (totalclock > 390 && totalclock < 780) if (totalclock > 390 && totalclock < 780)
@ -1535,7 +1532,7 @@ static void G_BonusCutscenes(void)
S_PlaySound(SQUISHED, CHAN_AUTO, CHANF_UI); S_PlaySound(SQUISHED, CHAN_AUTO, CHANF_UI);
bonuscnt++; bonuscnt++;
} }
rotatesprite_fs(bossmove[t+3]<<16, bossmove[t+4]<<16, 65536L, 0, bossmove[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(bossmove[t+3]<<16, bossmove[t+4]<<16, 65536L, 0, bossmove[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH, nullptr, ENDINGPAL);
} }
// Breathe // Breathe
@ -1551,7 +1548,7 @@ static void G_BonusCutscenes(void)
if (totalclock >= 750) if (totalclock >= 750)
{ {
rotatesprite_fs(86<<16, 59<<16, 65536L, 0, VICTORY1+8, 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(86<<16, 59<<16, 65536L, 0, VICTORY1+8, 0, 0, 2+8+16+64+128+BGSTRETCH, nullptr, ENDINGPAL);
if (totalclock >= 750 && bonuscnt == 2) if (totalclock >= 750 && bonuscnt == 2)
{ {
S_PlaySound(DUKETALKTOBOSS, CHAN_AUTO, CHANF_UI); S_PlaySound(DUKETALKTOBOSS, CHAN_AUTO, CHANF_UI);
@ -1567,7 +1564,7 @@ static void G_BonusCutscenes(void)
S_PlaySound(BOSSTALKTODUKE, CHAN_AUTO, CHANF_UI); S_PlaySound(BOSSTALKTODUKE, CHAN_AUTO, CHANF_UI);
bonuscnt++; bonuscnt++;
} }
rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH); rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH, nullptr, ENDINGPAL);
} }
} }

View file

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

View file

@ -1417,7 +1417,6 @@ void LogoLevel(void)
DSPRINTF(ds,"LogoLevel..."); DSPRINTF(ds,"LogoLevel...");
MONO_PRINT(ds); MONO_PRINT(ds);
videoSetPalette(0, DREALMSPAL, Pal_Fullscreen);
MONO_PRINT(ds); MONO_PRINT(ds);
//FadeOut(0, 0); //FadeOut(0, 0);
@ -1434,7 +1433,7 @@ void LogoLevel(void)
while (TRUE) while (TRUE)
{ {
twod->ClearScreen(); twod->ClearScreen();
rotatesprite(0, 0, RS_SCALE, 0, THREED_REALMS_PIC, 0, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1); rotatesprite(0, 0, RS_SCALE, 0, THREED_REALMS_PIC, 0, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1, nullptr, DREALMSPAL);
videoNextPage(); videoNextPage();
handleevents(); handleevents();