From afb2cd3b82ca34dd99a2d5f0ed1a9b1916aa4067 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 Apr 2021 18:15:56 +0200 Subject: [PATCH] - fixed NoFullbrightRange. Ever since the texture system switchover this only set a dead bit, it has to explicitly mark the texture as not having a brightmap. --- source/build/src/defs.cpp | 16 +++-------- source/common/textures/gametexture.h | 1 + source/core/parsefuncs.h | 40 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 370f10e6e..e5f380338 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -1526,20 +1526,10 @@ static int32_t defsparser(scriptfile *script) break; case T_TEXHITSCANRANGE: + parseTexHitscanRange(*script, pos); + break; case T_NOFULLBRIGHTRANGE: - { - int32_t b,e, i; - - if (scriptfile_getsymbol(script,&b)) break; - if (scriptfile_getsymbol(script,&e))break; - - b = max(b, 0); - e = min(e, MAXUSERTILES-1); - - for (i=b; i<=e; i++) - picanm[i].sf |= (tokn==T_TEXHITSCANRANGE) ? - PICANM_TEXHITSCAN_BIT : PICANM_NOFULLBRIGHT_BIT; - } + parseNoFullbrightRange(*script, pos); break; case T_SOUND: diff --git a/source/common/textures/gametexture.h b/source/common/textures/gametexture.h index c7a753372..e9851fbe3 100644 --- a/source/common/textures/gametexture.h +++ b/source/common/textures/gametexture.h @@ -231,6 +231,7 @@ public: void SetFullbright() { flags |= GTexf_RenderFullbright; } void SetDisableFullbright(bool on) { if (on) flags |= GTexf_DisableFullbrightSprites; else flags &= ~GTexf_DisableFullbrightSprites; } void SetGlowing(PalEntry color) { flags = (flags & ~GTexf_AutoGlowing) | GTexf_Glowing; GlowColor = color; } + void SetDisableBrightmap() { flags |= GTexf_BrightmapChecked; Brightmap = nullptr; } bool isUserContent() const; int CheckRealHeight() { return xs_RoundToInt(Base->CheckRealHeight() / ScaleY); } diff --git a/source/core/parsefuncs.h b/source/core/parsefuncs.h index f95496d0a..0c6e42ab9 100644 --- a/source/core/parsefuncs.h +++ b/source/core/parsefuncs.h @@ -678,3 +678,43 @@ void parseNewGameChoices(FScanner& sc, FScriptPosition& pos) while (!sc.FoundEndBrace(blockend)) {} } +//=========================================================================== +// +// +// +//=========================================================================== + +void parseTexHitscanRange(FScanner& sc, FScriptPosition& pos) +{ + int start, end; + + if (!sc.GetNumber(start, true)) return; + if (!sc.GetNumber(end, true)) return; + + if (start < 0) start = 0; + if (end >= MAXUSERTILES) end = MAXUSERTILES - 1; + for (int i = start; i <= end; i++) + TileFiles.tiledata[i].picanm.sf |= PICANM_TEXHITSCAN_BIT; +} + +//=========================================================================== +// +// +// +//=========================================================================== + +void parseNoFullbrightRange(FScanner& sc, FScriptPosition& pos) +{ + int start, end; + + if (!sc.GetNumber(start, true)) return; + if (!sc.GetNumber(end, true)) return; + + if (start < 0) start = 0; + if (end >= MAXUSERTILES) end = MAXUSERTILES - 1; + for (int i = start; i <= end; i++) + { + auto tex = tileGetTexture(i); + if (tex->isValid()) tex->SetDisableBrightmap(); + } +}