- added a hack to help the new renderer with Lunatic Fringe.

This is by no means a permanent solution but having it buys some time to find something more universal that won't affect performance too badly and investigate the need for a more robust solution.
The idea here is to define pairs of walls where when the first element of the pair is seen, it will treat the second one as view blocking.
This is used as the two offending windows (sectors 151 and 152) to cope with the lack of a height sensitive clipper.
This commit is contained in:
Christoph Oelckers 2021-04-24 20:00:54 +02:00
parent be08a2f800
commit 5585351c0f
4 changed files with 36 additions and 0 deletions

View File

@ -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);

View File

@ -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();
}

View File

@ -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])

View File

@ -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];