diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index f2917b396..0872d7868 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -181,6 +181,11 @@ inline bool isWW2GI() return g_gameType & (GAMEFLAG_WW2GI); } +inline bool isDuke() +{ + return g_gameType & (GAMEFLAG_DUKE); +} + inline bool isRR() { return g_gameType & (GAMEFLAG_RRALL); diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 3a7108ac7..2eed4b474 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -371,6 +371,7 @@ static void insertAllSprites(const char* filename, const vec3_t* pos, int16_t* c assert(realnumsprites == Numsprites); } +void addBlockingPairs(); void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang, int16_t* cursectnum) { @@ -454,6 +455,8 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang, memcpy(wallbackup, wall, sizeof(wallbackup)); memcpy(sectorbackup, sector, sizeof(sectorbackup)); + + addBlockingPairs(); } diff --git a/source/core/rendering/scene/hw_bunchdrawer.cpp b/source/core/rendering/scene/hw_bunchdrawer.cpp index 5c3b5a434..0be90bfae 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.cpp +++ b/source/core/rendering/scene/hw_bunchdrawer.cpp @@ -41,7 +41,30 @@ #include "hw_portal.h" #include "gamestruct.h" #include "hw_voxels.h" +#include "mapinfo.h" +#include "gamecontrol.h" +TArray<int> blockingpairs[MAXWALLS]; + +// temporary hack job to make Lunatic Fringe work while searching for a proper solution. +void addBlockingPairs() +{ + for (auto& p : blockingpairs) p.Clear(); + if (!isDuke()) return; + if (wall[682].sector == 151 && wall[683].sector == 151 && wall[684].sector == 151 && + wall[694].sector == 152 && wall[695].sector == 152 && wall[695].sector == 152 && + wall[755].sector == 158 && wall[756].sector == 158 && wall[757].sector == 158 && + wall[739].sector == 158 && wall[740].sector == 158 && wall[741].sector == 158) + { + for (int i = 755; i<=757; i++) blockingpairs[682].Push(i); + blockingpairs[683] = blockingpairs[682]; + blockingpairs[684] = blockingpairs[682]; + + for (int i = 739; i <= 741; i++) blockingpairs[694].Push(i); + blockingpairs[695] = blockingpairs[694]; + blockingpairs[696] = blockingpairs[694]; + } +} //========================================================================== // @@ -92,6 +115,7 @@ void BunchDrawer::StartScene() gotsector.Zero(); gotsector2.Zero(); gotwall.Zero(); + blockwall.Zero(); } //========================================================================== @@ -196,6 +220,8 @@ bool BunchDrawer::CheckClip(walltype* wal) int BunchDrawer::ClipLine(int line, bool portal) { + if (blockwall[line]) return CL_Draw; + auto wal = &wall[line]; auto startAngleBam = wal->clipangle; @@ -277,6 +303,7 @@ void BunchDrawer::ProcessBunch(int bnch) if (clipped & CL_Draw) { + for (auto p : blockingpairs[i]) blockwall.Set(p); show2dwall.Set(i); if (!gotwall[i]) diff --git a/source/core/rendering/scene/hw_bunchdrawer.h b/source/core/rendering/scene/hw_bunchdrawer.h index 805b60a93..f230fb570 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.h +++ b/source/core/rendering/scene/hw_bunchdrawer.h @@ -30,6 +30,7 @@ class BunchDrawer FixedBitArray<MAXSECTORS> gotsector; FixedBitArray<MAXSECTORS> gotsector2; FixedBitArray<MAXWALLS> gotwall; + FixedBitArray<MAXWALLS> blockwall; binangle ang1, ang2; int sectstartang[MAXSECTORS], sectendang[MAXSECTORS];