diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 3115e81693..02fa5723a4 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -121,26 +121,6 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first) mFlatfill = desc->mFlatfill; } S_Sound (CHAN_VOICE | CHAN_UI, desc->mSound, 1.0f, ATTN_NONE); - if (desc->mPalette.IsNotEmpty() && (lumpnum = Wads.CheckNumForFullName(desc->mPalette, true)) > 0) - { - PalEntry *palette; - uint8_t palbuffer[768]; - const uint8_t *orgpal; - FMemLump lump; - int i; - - ReadPalette(lumpnum, palbuffer); - orgpal = (uint8_t *)palbuffer; - palette = screen->GetPalette (); - for (i = 256; i > 0; i--, orgpal += 3) - { - *palette++ = PalEntry (orgpal[0], orgpal[1], orgpal[2]); - } - screen->UpdatePalette (); - mPaletteChanged = true; - NoWipe = 1; - M_EnableMenu(false); - } mOverlays.Resize(desc->mOverlays.Size()); for (unsigned i=0; i < mOverlays.Size(); i++) { @@ -208,21 +188,6 @@ void DIntermissionScreen::Drawer () void DIntermissionScreen::OnDestroy() { - if (mPaletteChanged) - { - PalEntry *palette; - int i; - - palette = screen->GetPalette (); - for (i = 0; i < 256; ++i) - { - palette[i] = GPalette.BaseColors[i]; - } - screen->UpdatePalette (); - NoWipe = 5; - mPaletteChanged = false; - M_EnableMenu(true); - } S_StopSound(CHAN_VOICE); Super::OnDestroy(); } @@ -793,7 +758,7 @@ bool DIntermissionController::Responder (event_t *ev) { if (mScreen != NULL) { - if (!mScreen->mPaletteChanged && ev->type == EV_KeyDown) + if (ev->type == EV_KeyDown) { const char *cmd = Bindings.GetBind (ev->data1); diff --git a/src/intermission/intermission.h b/src/intermission/intermission.h index 9111ebe994..a73d18a128 100644 --- a/src/intermission/intermission.h +++ b/src/intermission/intermission.h @@ -73,7 +73,6 @@ struct FIntermissionAction int mCdId; int mDuration; FString mBackground; - FString mPalette; FString mSound; bool mFlatfill; bool mMusicLooping; @@ -169,7 +168,6 @@ protected: public: int mTicker; - bool mPaletteChanged; DIntermissionScreen() {} virtual void Init(FIntermissionAction *desc, bool first); diff --git a/src/intermission/intermission_parse.cpp b/src/intermission/intermission_parse.cpp index 2841b70f71..c3fb7b53e5 100644 --- a/src/intermission/intermission_parse.cpp +++ b/src/intermission/intermission_parse.cpp @@ -135,7 +135,7 @@ bool FIntermissionAction::ParseKey(FScanner &sc) if (sc.CheckToken(',')) { sc.MustGetToken(TK_StringConst); - mPalette = sc.String; + sc.ScriptMessage("Palette override will be ignored"); } } return true; diff --git a/src/textures/formats/flattexture.cpp b/src/textures/formats/flattexture.cpp index e3ea1ca897..d3506b2501 100644 --- a/src/textures/formats/flattexture.cpp +++ b/src/textures/formats/flattexture.cpp @@ -92,6 +92,7 @@ FFlatTexture::FFlatTexture (int lumpnum) } bMasked = false; + bTranslucent = false; WidthBits = HeightBits = bits; Width = Height = 1 << bits; WidthMask = (1 << bits) - 1; diff --git a/src/textures/formats/rawpagetexture.cpp b/src/textures/formats/rawpagetexture.cpp index 50faa94b57..ffe0d7a220 100644 --- a/src/textures/formats/rawpagetexture.cpp +++ b/src/textures/formats/rawpagetexture.cpp @@ -37,6 +37,8 @@ #include "files.h" #include "w_wad.h" #include "v_palette.h" +#include "gi.h" +#include "bitmap.h" #include "textures/textures.h" @@ -48,9 +50,11 @@ class FRawPageTexture : public FWorldTexture { + int mPaletteLump = -1; public: FRawPageTexture (int lumpnum); uint8_t *MakeTexture (FRenderStyle style) override; + int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) override; }; //========================================================================== @@ -159,6 +163,13 @@ FRawPageTexture::FRawPageTexture (int lumpnum) WidthBits = 8; HeightBits = 8; WidthMask = 255; + + // Special case hack for Heretic's E2 end pic. This is not going to be exposed as an editing feature because the implications would be horrible. + if (Name.CompareNoCase("E2END") == 0 && gameinfo.gametype == GAME_Heretic) + { + mPaletteLump = Wads.CheckNumForName("E2PAL"); + if (Wads.LumpLength(mPaletteLump) < 768) mPaletteLump = -1; + } } //========================================================================== @@ -179,6 +190,9 @@ uint8_t *FRawPageTexture::MakeTexture (FRenderStyle style) const uint8_t *remap = GetRemap(style); + // This does not handle the custom palette. + // User maps are encouraged to use a real image format when replacing E2END and the original could never be used anywhere else. + // Convert the source image from row-major to column-major format for (int y = 200; y != 0; --y) { @@ -188,8 +202,29 @@ uint8_t *FRawPageTexture::MakeTexture (FRenderStyle style) dest_p += 200; source_p++; } - dest_p -= 200*320-1; + dest_p -= 200 * 320 - 1; } return Pixels; } +int FRawPageTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) +{ + if (mPaletteLump < 0) return FTexture::CopyTrueColorPixels(bmp, x, y, rotate, inf); + else + { + FMemLump lump = Wads.ReadLump(SourceLump); + FMemLump plump = Wads.ReadLump(mPaletteLump); + const uint8_t *source = (const uint8_t *)lump.GetMem(); + const uint8_t *psource = (const uint8_t *)plump.GetMem(); + PalEntry paldata[256]; + for (auto & pe : paldata) + { + pe.r = *psource++; + pe.g = *psource++; + pe.b = *psource++; + pe.a = 255; + } + bmp->CopyPixelData(x, y, source, 320, 200, 1, 320, 0, paldata, inf); + } + +} diff --git a/src/textures/formats/shadertexture.cpp b/src/textures/formats/shadertexture.cpp index 67d4db683a..cb42f25b88 100644 --- a/src/textures/formats/shadertexture.cpp +++ b/src/textures/formats/shadertexture.cpp @@ -64,6 +64,8 @@ public: Width = vertical ? 2 : 256; Height = vertical ? 256 : 2; CalcBitSize(); + bMasked = false; + bTranslucent = false; PixelsAreStatic = 2; // The alpha buffer is static, but if this gets used as a regular texture, a separate buffer needs to be made. // Fill the column/row with shading values. diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index b79ecd5f4f..d3764371ee 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -400,7 +400,7 @@ Intermission Inter_Underwater { Image { - Background = "E2END", 0, "E2PAL" + Background = "E2END", 0 } GotoTitle {