From 94f7bef2ff1a114133b04b6798d93bc9bef9aacc Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 19 Dec 2016 10:40:31 +0200 Subject: [PATCH 1/4] Added compatibility parameter to set sector special --- src/compatibility.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 24897ac27..60f9d8ad6 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -80,6 +80,7 @@ enum CP_CLEARSPECIAL, CP_SETACTIVATION, CP_SECTORFLOOROFFSET, + CP_SETSECTORSPECIAL, CP_SETWALLYSCALE, CP_SETTHINGZ, CP_SETTAG, @@ -294,6 +295,15 @@ void ParseCompatibility() sc.MustGetFloat(); CompatParams.Push(int(sc.Float*65536.)); } + else if (sc.Compare("setsectorspecial")) + { + if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); + CompatParams.Push(CP_SETSECTORSPECIAL); + sc.MustGetNumber(); + CompatParams.Push(sc.Number); + sc.MustGetNumber(); + CompatParams.Push(sc.Number); + } else if (sc.Compare("setwallyscale")) { if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); @@ -529,6 +539,16 @@ void SetCompatibilityParams() i += 3; break; } + case CP_SETSECTORSPECIAL: + { + const int index = CompatParams[i + 1]; + if (index < numsectors) + { + sectors[index].special = CompatParams[i + 2]; + } + i += 3; + break; + } case CP_SETWALLYSCALE: { if (CompatParams[i+1] < numlines) From 28a23d4ff3988fee9e83ecd184e386b7dfcb3cca Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 19 Dec 2016 10:43:20 +0200 Subject: [PATCH 2/4] Removed unreachable secrets from Doom IWADs See https://forum.zdoom.org/viewtopic.php?t=54632 --- wadsrc/static/compatibility.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 73a4f5af2..b131cd0ad 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -453,3 +453,27 @@ D7F6E9F08C39A17026349A04F8C0B0BE // Return to Hadron, e1m9 { pointonline } + +// Remove unreachable secrets +F6EE16F770AD309D608EA0B1F1E249FC // Ultimate Doom, e4m3 +{ + setsectorspecial 124 0 + setsectorspecial 125 0 +} +94D4C869A0C02EF4F7375022B36AAE45 // Ultimate Doom, e4m7 +{ + setsectorspecial 263 0 + setsectorspecial 264 0 +} +1A540BA717BF9EC85F8522594C352F2A // Doom II, map15 +{ + setsectorspecial 147 0 +} +110F84DE041052B59307FAF0293E6BC0 // Doom II, map27 +{ + setsectorspecial 93 0 +} +ABC4EB5A1535ECCD0061AD14F3547908 // Plutonia Experiment, map26 +{ + setsectorspecial 156 0 +} From f6b0f2648c62d8c35368ba272b261de862259078 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 19 Dec 2016 12:44:04 +0200 Subject: [PATCH 3/4] Cleared staircase to secret area in Ultimate Doom E4M3 Only the final room with goodies is marked as secret --- wadsrc/static/compatibility.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index b131cd0ad..c486b48ae 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -459,6 +459,25 @@ F6EE16F770AD309D608EA0B1F1E249FC // Ultimate Doom, e4m3 { setsectorspecial 124 0 setsectorspecial 125 0 + // clear staircase to secret area + setsectorspecial 127 0 + setsectorspecial 128 0 + setsectorspecial 129 0 + setsectorspecial 130 0 + setsectorspecial 131 0 + setsectorspecial 132 0 + setsectorspecial 133 0 + setsectorspecial 134 0 + setsectorspecial 136 0 + setsectorspecial 137 0 + setsectorspecial 138 0 + setsectorspecial 147 0 + setsectorspecial 148 0 + setsectorspecial 149 0 + setsectorspecial 150 0 + setsectorspecial 151 0 + setsectorspecial 152 0 + setsectorspecial 155 0 } 94D4C869A0C02EF4F7375022B36AAE45 // Ultimate Doom, e4m7 { From 5d85990d5f1bc3a6456ee2c195c6615774001d3a Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Mon, 19 Dec 2016 07:18:20 -0500 Subject: [PATCH 4/4] - Implementing RGB666-to-Palette colormatching for textures. --- src/textures/ddstexture.cpp | 8 ++++---- src/textures/jpegtexture.cpp | 4 ++-- src/textures/multipatchtexture.cpp | 2 +- src/textures/pcxtexture.cpp | 2 +- src/textures/pngtexture.cpp | 6 +++--- src/textures/tgatexture.cpp | 8 ++++---- src/v_video.cpp | 7 +++++++ src/v_video.h | 8 ++++++++ 8 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/textures/ddstexture.cpp b/src/textures/ddstexture.cpp index 31e748022..a2c69b38b 100644 --- a/src/textures/ddstexture.cpp +++ b/src/textures/ddstexture.cpp @@ -551,7 +551,7 @@ void FDDSTexture::ReadRGB (FWadLump &lump, BYTE *tcbuf) DWORD r = (c & RMask) << RShiftL; r |= r >> RShiftR; DWORD g = (c & GMask) << GShiftL; g |= g >> GShiftR; DWORD b = (c & BMask) << BShiftL; b |= b >> BShiftR; - *pixelp = RGB32k.RGB[r >> 27][g >> 27][b >> 27]; + *pixelp = RGB256k.RGB[r >> 26][g >> 26][b >> 26]; } else { @@ -637,7 +637,7 @@ void FDDSTexture::DecompressDXT1 (FWadLump &lump, BYTE *tcbuf) // Pick colors from the palette for each of the four colors. /*if (!tcbuf)*/ for (i = 3; i >= 0; --i) { - palcol[i] = color[i].a ? RGB32k.RGB[color[i].r >> 3][color[i].g >> 3][color[i].b >> 3] : 0; + palcol[i] = color[i].a ? RGB256k.RGB[color[i].r >> 2][color[i].g >> 2][color[i].b >> 2] : 0; } // Now decode this 4x4 block to the pixel buffer. for (y = 0; y < 4; ++y) @@ -717,7 +717,7 @@ void FDDSTexture::DecompressDXT3 (FWadLump &lump, bool premultiplied, BYTE *tcbu // Pick colors from the palette for each of the four colors. if (!tcbuf) for (i = 3; i >= 0; --i) { - palcol[i] = RGB32k.RGB[color[i].r >> 3][color[i].g >> 3][color[i].b >> 3]; + palcol[i] = RGB256k.RGB[color[i].r >> 2][color[i].g >> 2][color[i].b >> 2]; } // Now decode this 4x4 block to the pixel buffer. for (y = 0; y < 4; ++y) @@ -822,7 +822,7 @@ void FDDSTexture::DecompressDXT5 (FWadLump &lump, bool premultiplied, BYTE *tcbu // Pick colors from the palette for each of the four colors. if (!tcbuf) for (i = 3; i >= 0; --i) { - palcol[i] = RGB32k.RGB[color[i].r >> 3][color[i].g >> 3][color[i].b >> 3]; + palcol[i] = RGB256k.RGB[color[i].r >> 2][color[i].g >> 2][color[i].b >> 2]; } // Now decode this 4x4 block to the pixel buffer. for (y = 0; y < 4; ++y) diff --git a/src/textures/jpegtexture.cpp b/src/textures/jpegtexture.cpp index 225396598..c138edbfa 100644 --- a/src/textures/jpegtexture.cpp +++ b/src/textures/jpegtexture.cpp @@ -406,7 +406,7 @@ void FJPEGTexture::MakeTexture () case JCS_RGB: for (int x = Width; x > 0; --x) { - *out = RGB32k.RGB[in[0]>>3][in[1]>>3][in[2]>>3]; + *out = RGB256k.RGB[in[0]>>2][in[1]>>2][in[2]>>2]; out += Height; in += 3; } @@ -430,7 +430,7 @@ void FJPEGTexture::MakeTexture () int r = in[3] - (((256-in[0])*in[3]) >> 8); int g = in[3] - (((256-in[1])*in[3]) >> 8); int b = in[3] - (((256-in[2])*in[3]) >> 8); - *out = RGB32k.RGB[r >> 3][g >> 3][b >> 3]; + *out = RGB256k.RGB[r >> 2][g >> 2][b >> 2]; out += Height; in += 4; } diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index e68c4e20f..991893845 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -531,7 +531,7 @@ void FMultiPatchTexture::MakeTexture () { if (*out == 0 && in[3] != 0) { - *out = RGB32k.RGB[in[2]>>3][in[1]>>3][in[0]>>3]; + *out = RGB256k.RGB[in[2]>>2][in[1]>>2][in[0]>>2]; } out += Height; in += 4; diff --git a/src/textures/pcxtexture.cpp b/src/textures/pcxtexture.cpp index 0ec5d2933..dda431993 100644 --- a/src/textures/pcxtexture.cpp +++ b/src/textures/pcxtexture.cpp @@ -528,7 +528,7 @@ void FPCXTexture::MakeTexture() { for(int x=0; x < Width; x++) { - Pixels[y+Height*x] = RGB32k.RGB[row[0]>>3][row[1]>>3][row[2]>>3]; + Pixels[y+Height*x] = RGB256k.RGB[row[0]>>2][row[1]>>2][row[2]>>2]; row+=3; } } diff --git a/src/textures/pngtexture.cpp b/src/textures/pngtexture.cpp index d24cd92d1..414c424b8 100644 --- a/src/textures/pngtexture.cpp +++ b/src/textures/pngtexture.cpp @@ -536,7 +536,7 @@ void FPNGTexture::MakeTexture () { if (!HaveTrans) { - *out++ = RGB32k.RGB[in[0]>>3][in[1]>>3][in[2]>>3]; + *out++ = RGB256k.RGB[in[0]>>2][in[1]>>2][in[2]>>2]; } else { @@ -548,7 +548,7 @@ void FPNGTexture::MakeTexture () } else { - *out++ = RGB32k.RGB[in[0]>>3][in[1]>>3][in[2]>>3]; + *out++ = RGB256k.RGB[in[0]>>2][in[1]>>2][in[2]>>2]; } } in += pitch; @@ -593,7 +593,7 @@ void FPNGTexture::MakeTexture () { for (y = Height; y > 0; --y) { - *out++ = in[3] < 128 ? 0 : RGB32k.RGB[in[0]>>3][in[1]>>3][in[2]>>3]; + *out++ = in[3] < 128 ? 0 : RGB256k.RGB[in[0]>>2][in[1]>>2][in[2]>>2]; in += pitch; } in -= backstep; diff --git a/src/textures/tgatexture.cpp b/src/textures/tgatexture.cpp index b208a51a3..331747cfe 100644 --- a/src/textures/tgatexture.cpp +++ b/src/textures/tgatexture.cpp @@ -393,7 +393,7 @@ void FTGATexture::MakeTexture () for(int x=0;x>10) & 0x1f][(v>>5) & 0x1f][v & 0x1f]; + Pixels[x*Height+y] = RGB256k.RGB[((v>>10) & 0x1f)*2][((v>>5) & 0x1f)*2][(v & 0x1f)*2]; p+=step_x; } } @@ -405,7 +405,7 @@ void FTGATexture::MakeTexture () BYTE * p = ptr + y * Pitch; for(int x=0;x>3][p[1]>>3][p[0]>>3]; + Pixels[x*Height+y] = RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2]; p+=step_x; } } @@ -419,7 +419,7 @@ void FTGATexture::MakeTexture () BYTE * p = ptr + y * Pitch; for(int x=0;x>3][p[1]>>3][p[0]>>3]; + Pixels[x*Height+y] = RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2]; p+=step_x; } } @@ -431,7 +431,7 @@ void FTGATexture::MakeTexture () BYTE * p = ptr + y * Pitch; for(int x=0;x= 128? RGB32k.RGB[p[2]>>3][p[1]>>3][p[0]>>3] : 0; + Pixels[x*Height+y] = p[3] >= 128? RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2] : 0; p+=step_x; } } diff --git a/src/v_video.cpp b/src/v_video.cpp index efe93aa04..6077f878e 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -144,8 +144,10 @@ DWORD Col2RGB8[65][256]; DWORD *Col2RGB8_LessPrecision[65]; DWORD Col2RGB8_Inverse[65][256]; ColorTable32k RGB32k; +ColorTable256k RGB256k; } + static DWORD Col2RGB8_2[63][256]; // [RH] The framebuffer is no longer a mere byte array. @@ -669,6 +671,11 @@ static void BuildTransTable (const PalEntry *palette) for (g = 0; g < 32; g++) for (b = 0; b < 32; b++) RGB32k.RGB[r][g][b] = ColorMatcher.Pick ((r<<3)|(r>>2), (g<<3)|(g>>2), (b<<3)|(b>>2)); + // create the RGB666 lookup table + for (r = 0; r < 64; r++) + for (g = 0; g < 64; g++) + for (b = 0; b < 64; b++) + RGB256k.RGB[r][g][b] = ColorMatcher.Pick ((r<<2)|(r>>4), (g<<2)|(g>>4), (b<<2)|(b>>4)); int x, y; diff --git a/src/v_video.h b/src/v_video.h index b72f67094..57d15869c 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -462,6 +462,14 @@ union ColorTable32k }; extern "C" ColorTable32k RGB32k; +// [SP] RGB666 support +union ColorTable256k +{ + BYTE RGB[64][64][64]; + BYTE All[64 *64 *64]; +}; +extern "C" ColorTable256k RGB256k; + // Col2RGB8 is a pre-multiplied palette for color lookup. It is stored in a // special R10B10G10 format for efficient blending computation. // --RRRRRrrr--BBBBBbbb--GGGGGggg-- at level 64