mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 20:00:49 +00:00
- added render workaround for CP07.
This commit is contained in:
parent
d8b808576f
commit
d206a767b2
8 changed files with 185 additions and 17 deletions
|
@ -37,6 +37,7 @@
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "md4.h"
|
#include "md4.h"
|
||||||
|
#include "hw_sections.h"
|
||||||
|
|
||||||
static TArray<usermaphack_t> usermaphacks;
|
static TArray<usermaphack_t> usermaphacks;
|
||||||
TArray<int> blockingpairs[MAXWALLS];
|
TArray<int> blockingpairs[MAXWALLS];
|
||||||
|
@ -173,6 +174,16 @@ static int32_t LoadMapHack(const char *filename)
|
||||||
wall[currentwall].overpicnum = sc.Number;
|
wall[currentwall].overpicnum = sc.Number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("split"))
|
||||||
|
{
|
||||||
|
int start = -1, end = -1;
|
||||||
|
if (sc.CheckNumber()) start = sc.Number;
|
||||||
|
if (sc.CheckNumber()) end = sc.Number;
|
||||||
|
if (end >= 0 && validateSector())
|
||||||
|
{
|
||||||
|
hw_SetSplitSector(currentsector, start, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (sc.Compare("clearflags"))
|
else if (sc.Compare("clearflags"))
|
||||||
{
|
{
|
||||||
if (currentsector != -1 && validateSector())
|
if (currentsector != -1 && validateSector())
|
||||||
|
|
|
@ -453,6 +453,8 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
||||||
G_LoadMapHack(filename, md4);
|
G_LoadMapHack(filename, md4);
|
||||||
setWallSectors();
|
setWallSectors();
|
||||||
hw_BuildSections();
|
hw_BuildSections();
|
||||||
|
sectorGeometry.SetSize(numsections);
|
||||||
|
|
||||||
|
|
||||||
memcpy(wallbackup, wall, sizeof(wallbackup));
|
memcpy(wallbackup, wall, sizeof(wallbackup));
|
||||||
memcpy(sectorbackup, sector, sizeof(sectorbackup));
|
memcpy(sectorbackup, sector, sizeof(sectorbackup));
|
||||||
|
@ -491,5 +493,4 @@ void setWallSectors()
|
||||||
wall[sector[i].wallptr + w].sector = i;
|
wall[sector[i].wallptr + w].sector = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sectorGeometry.SetSize(numsectors);
|
|
||||||
}
|
}
|
|
@ -48,6 +48,10 @@ TArray<int> sectionspersector[MAXSECTORS]; // reverse map, mainly for the automa
|
||||||
int numsections;
|
int numsections;
|
||||||
int numsectionlines;
|
int numsectionlines;
|
||||||
|
|
||||||
|
void hw_SplitSector(int sector, int startpos, int endpos);
|
||||||
|
|
||||||
|
TArray<int> splits;
|
||||||
|
|
||||||
|
|
||||||
void hw_BuildSections()
|
void hw_BuildSections()
|
||||||
{
|
{
|
||||||
|
@ -72,4 +76,146 @@ void hw_BuildSections()
|
||||||
sectionspersector[i].Resize(1);
|
sectionspersector[i].Resize(1);
|
||||||
sectionspersector[i][0] = i;
|
sectionspersector[i][0] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < splits.Size(); i += 3)
|
||||||
|
hw_SplitSector(splits[i], splits[i + 1], splits[i + 2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void SplitSection(int section, int start, int end)
|
||||||
|
{
|
||||||
|
// note: to do this, the sector's lines must be well ordered and there must only be one outline and no holes.
|
||||||
|
// This also can only apply a single split to a given sector.
|
||||||
|
int firstsection = numsections++;
|
||||||
|
int secondsection = numsections++;
|
||||||
|
|
||||||
|
auto& sect = sections[section];
|
||||||
|
Section* sect1 = §ions[firstsection];
|
||||||
|
Section* sect2 = §ions[secondsection];
|
||||||
|
sect1->sector = sect.sector;
|
||||||
|
sect2->sector = sect.sector;
|
||||||
|
sect1->lines.Clear();
|
||||||
|
sect2->lines.Clear();
|
||||||
|
for (int aline : sect.lines)
|
||||||
|
{
|
||||||
|
int line = sectionLines[aline].wall;
|
||||||
|
if (line < start || line >= end)
|
||||||
|
{
|
||||||
|
sect1->lines.Push(aline);
|
||||||
|
}
|
||||||
|
if (line == start)
|
||||||
|
{
|
||||||
|
sect1->lines.Push(-1);
|
||||||
|
sect2->lines.Push(-1);
|
||||||
|
}
|
||||||
|
if (line >= start && line < end)
|
||||||
|
{
|
||||||
|
sect2->lines.Push(aline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int firstnewline = numsectionlines;
|
||||||
|
int thisline = numsectionlines;
|
||||||
|
int splitline1, splitline2;
|
||||||
|
//numsectionlines += sect1->lines.Size() + 1;
|
||||||
|
for (unsigned i = 0; i < sect1->lines.Size(); i++)// auto& sline : sect1->lines)
|
||||||
|
{
|
||||||
|
int sline = sect1->lines[i];
|
||||||
|
sect1->lines[i] = thisline;
|
||||||
|
if (sline != -1)
|
||||||
|
{
|
||||||
|
SectionLine& newline = sectionLines[thisline];
|
||||||
|
newline = sectionLines[sline];
|
||||||
|
newline.section = int16_t(sect1 - sections);
|
||||||
|
if (i != sect1->lines.Size() - 1) newline.point2index = thisline + 1 - firstnewline;
|
||||||
|
else newline.point2index = 0;
|
||||||
|
assert(newline.point2index >= 0);
|
||||||
|
|
||||||
|
// relink the partner
|
||||||
|
auto& partnerline = sectionLines[newline.partner];
|
||||||
|
partnerline.partner = thisline;
|
||||||
|
partnerline.partnersection = newline.section;
|
||||||
|
thisline++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
splitline1 = thisline++;
|
||||||
|
sectionLines[splitline1].wall = -1;
|
||||||
|
sectionLines[splitline1].section = int16_t(sect1 - sections);
|
||||||
|
sectionLines[splitline1].partnersection = int16_t(sect2 - sections);
|
||||||
|
sectionLines[splitline1].startpoint = start;
|
||||||
|
sectionLines[splitline1].endpoint = end;
|
||||||
|
sectionLines[splitline1].point2index = splitline1 + 1 - firstnewline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
firstnewline = thisline;
|
||||||
|
for (unsigned i = 0; i < sect2->lines.Size(); i++)// auto& sline : sect1->lines)
|
||||||
|
{
|
||||||
|
int sline = sect2->lines[i];
|
||||||
|
sect2->lines[i] = thisline;
|
||||||
|
if (sline != -1)
|
||||||
|
{
|
||||||
|
SectionLine& newline = sectionLines[thisline];
|
||||||
|
newline = sectionLines[sline];
|
||||||
|
newline.section = int16_t(sect2 - sections);
|
||||||
|
if (i != sect2->lines.Size() - 1) newline.point2index = thisline + 1 - firstnewline;
|
||||||
|
else newline.point2index = 0;
|
||||||
|
assert(newline.point2index >= 0);
|
||||||
|
|
||||||
|
// relink the partner
|
||||||
|
auto& partnerline = sectionLines[newline.partner];
|
||||||
|
partnerline.partner = thisline;
|
||||||
|
partnerline.partnersection = newline.section;
|
||||||
|
thisline++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
splitline2 = thisline++;
|
||||||
|
sectionLines[splitline2].wall = -1;
|
||||||
|
sectionLines[splitline2].section = int16_t(sect2 - sections);
|
||||||
|
sectionLines[splitline2].partnersection = int16_t(sect1 - sections);
|
||||||
|
sectionLines[splitline2].startpoint = end;
|
||||||
|
sectionLines[splitline2].endpoint = start;
|
||||||
|
sectionLines[splitline2].point2index = splitline2 + 1 - firstnewline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sectionLines[splitline1].partner = splitline2;
|
||||||
|
sectionLines[splitline2].partner = splitline1;
|
||||||
|
|
||||||
|
sectionspersector[sect.sector].Resize(2);
|
||||||
|
sectionspersector[sect.sector][0] = int16_t(sect1 - sections);
|
||||||
|
sectionspersector[sect.sector][1] = int16_t(sect2 - sections);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hw_SplitSector(int sectnum, int start, int end)
|
||||||
|
{
|
||||||
|
int wallstart = sector[sectnum].wallptr;
|
||||||
|
int wallend = wallstart + sector[sectnum].wallnum;
|
||||||
|
if (start < wallstart || start >= wallend || end < wallstart || end >= wallend || end < start) return;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < sectionspersector[sectnum].Size(); i++)
|
||||||
|
{
|
||||||
|
int sect = sectionspersector[sectnum][i];
|
||||||
|
bool foundstart = false, foundend = false;
|
||||||
|
for (int aline : sections[sect].lines)
|
||||||
|
{
|
||||||
|
int line = sectionLines[aline].wall;
|
||||||
|
if (line == start) foundstart = true;
|
||||||
|
if (line == end) foundend = true;
|
||||||
|
}
|
||||||
|
if (foundstart && foundend)
|
||||||
|
{
|
||||||
|
sectionspersector->Delete(i);
|
||||||
|
SplitSection(sect, start, end);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void hw_SetSplitSector(int sectnum, int start, int end)
|
||||||
|
{
|
||||||
|
splits.Push(sectnum);
|
||||||
|
splits.Push(start);
|
||||||
|
splits.Push(end);
|
||||||
}
|
}
|
|
@ -29,3 +29,4 @@ extern int numsectionlines;
|
||||||
|
|
||||||
|
|
||||||
void hw_BuildSections();
|
void hw_BuildSections();
|
||||||
|
void hw_SetSplitSector(int sector, int startpos, int endpos);
|
||||||
|
|
|
@ -283,8 +283,11 @@ void BunchDrawer::ProcessBunch(int bnch)
|
||||||
|
|
||||||
if (clipped & CL_Draw)
|
if (clipped & CL_Draw)
|
||||||
{
|
{
|
||||||
for (auto p : blockingpairs[i]) blockwall.Set(sectionLines[p].wall);
|
int ww = sectionLines[i].wall;
|
||||||
show2dwall.Set(sectionLines[i].wall);
|
if (ww != -1)
|
||||||
|
{
|
||||||
|
for (auto p : blockingpairs[ww]) blockwall.Set(sectionLines[p].wall);
|
||||||
|
show2dwall.Set(ww);
|
||||||
|
|
||||||
if (!gotwall[i])
|
if (!gotwall[i])
|
||||||
{
|
{
|
||||||
|
@ -294,8 +297,7 @@ void BunchDrawer::ProcessBunch(int bnch)
|
||||||
SetupWall.Clock();
|
SetupWall.Clock();
|
||||||
|
|
||||||
HWWall hwwall;
|
HWWall hwwall;
|
||||||
int j = sectionLines[i].wall;
|
hwwall.Process(di, &wall[ww], §or[bunch->sectnum], wall[ww].nextsector < 0 ? nullptr : §or[wall[ww].nextsector]);
|
||||||
hwwall.Process(di, &wall[j], §or[bunch->sectnum], wall[j].nextsector < 0 ? nullptr : §or[wall[j].nextsector]);
|
|
||||||
rendered_lines++;
|
rendered_lines++;
|
||||||
|
|
||||||
SetupWall.Unclock();
|
SetupWall.Unclock();
|
||||||
|
@ -303,6 +305,7 @@ void BunchDrawer::ProcessBunch(int bnch)
|
||||||
ClipWall.Clock();
|
ClipWall.Clock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (clipped & CL_Pass)
|
if (clipped & CL_Pass)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include "gamefuncs.h"
|
#include "gamefuncs.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "hw_sections.h"
|
#include "hw_sections.h"
|
||||||
|
#include "sectorgeometry.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -641,6 +642,7 @@ void SerializeMap(FSerializer& arc)
|
||||||
{
|
{
|
||||||
setWallSectors();
|
setWallSectors();
|
||||||
hw_BuildSections();
|
hw_BuildSections();
|
||||||
|
sectorGeometry.SetSize(numsections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "raze_sound.h"
|
#include "raze_sound.h"
|
||||||
#include "gamefuncs.h"
|
#include "gamefuncs.h"
|
||||||
#include "hw_sections.h"
|
#include "hw_sections.h"
|
||||||
|
#include "sectorgeometry.h"
|
||||||
|
|
||||||
#include "blood.h"
|
#include "blood.h"
|
||||||
|
|
||||||
|
@ -1069,6 +1070,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
|
||||||
|
|
||||||
setWallSectors();
|
setWallSectors();
|
||||||
hw_BuildSections();
|
hw_BuildSections();
|
||||||
|
sectorGeometry.SetSize(numsections);
|
||||||
memcpy(wallbackup, wall, sizeof(wallbackup));
|
memcpy(wallbackup, wall, sizeof(wallbackup));
|
||||||
memcpy(sectorbackup, sector, sizeof(sectorbackup));
|
memcpy(sectorbackup, sector, sizeof(sectorbackup));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
// CP07 sector bleeds into another area.
|
||||||
|
sector 33 split 192 196
|
Loading…
Reference in a new issue