From 5556756d43c98e1d2df71e5b702084bfd4cb5739 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 Jun 2021 09:32:30 +0200 Subject: [PATCH] - map fix for Hickston Swamp (RR mod) E1L3: Wall sprite is placed in the wrong sector which makes the new renderer's far stricter checks to reduce sprite flicker fail to position it correctly. --- source/core/gamefuncs.h | 15 +++++++++++++++ source/core/maphack.cpp | 10 ++++++++++ .../35ffa2f17ab074263f0963449dc7d463.mhk | 2 ++ 3 files changed, 27 insertions(+) create mode 100644 wadsrc/static/engine/compatibility/35ffa2f17ab074263f0963449dc7d463.mhk diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index dd3191a79..bc11f3428 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -77,16 +77,31 @@ inline DVector2 WallDelta(const walltype* wallnum) return WallEnd(wallnum) - WallStart(wallnum); } +inline double SpriteX(spritetype* spr) +{ + return spr->x * (1 / 16.); +} + inline double SpriteX(int wallnum) { return sprite[wallnum].x * (1 / 16.); } +inline double SpriteY(spritetype* spr) +{ + return spr->y * (1 / -16.); +} + inline double SpriteY(int wallnum) { return sprite[wallnum].y * (1 / -16.); } +inline DVector2 SpritePos(spritetype* spr) +{ + return { SpriteX(spr), SpriteY(spr) }; +} + inline double PointOnLineSide(double x, double y, double linex, double liney, double deltax, double deltay) { return (x - linex) * deltay - (y - liney) * deltax; diff --git a/source/core/maphack.cpp b/source/core/maphack.cpp index e2749c281..70f5a37df 100644 --- a/source/core/maphack.cpp +++ b/source/core/maphack.cpp @@ -146,6 +146,16 @@ static int32_t LoadMapHack(const char *filename) blockingpairs[currentwall].Push(sc.Number); } } + else if (sc.Compare("sector")) + { + if (sc.CheckNumber()) + { + if (currentsprite != -1 && validateSprite()) + { + sprite[currentsprite].sectnum = sc.Number; + } + } + } else if (sc.Compare("picnum")) { if (sc.CheckNumber()) diff --git a/wadsrc/static/engine/compatibility/35ffa2f17ab074263f0963449dc7d463.mhk b/wadsrc/static/engine/compatibility/35ffa2f17ab074263f0963449dc7d463.mhk new file mode 100644 index 000000000..8e7c73da6 --- /dev/null +++ b/wadsrc/static/engine/compatibility/35ffa2f17ab074263f0963449dc7d463.mhk @@ -0,0 +1,2 @@ +// Hickston Swamp E1L3 (RR mod) wall sprite in wrong sector flickers with new renderer +sprite 225 sector 565