2021-03-18 11:32:31 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "tarray.h"
|
|
|
|
#include "basics.h"
|
|
|
|
|
2021-03-18 16:18:03 +00:00
|
|
|
struct HWDrawInfo;
|
2021-03-18 11:32:31 +00:00
|
|
|
class Clipper;
|
|
|
|
|
|
|
|
struct FBunch
|
|
|
|
{
|
2021-12-01 23:01:45 +00:00
|
|
|
int sectornum;
|
2021-03-18 11:32:31 +00:00
|
|
|
int startline;
|
|
|
|
int endline;
|
2021-04-06 17:25:40 +00:00
|
|
|
bool portal;
|
2021-04-07 14:09:25 +00:00
|
|
|
binangle startangle;
|
2021-03-22 22:40:25 +00:00
|
|
|
binangle endangle;
|
2021-03-18 11:32:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BunchDrawer
|
|
|
|
{
|
2021-03-18 16:18:03 +00:00
|
|
|
HWDrawInfo *di;
|
2021-03-18 11:32:31 +00:00
|
|
|
Clipper *clipper;
|
|
|
|
int LastBunch;
|
|
|
|
int StartTime;
|
|
|
|
TArray<FBunch> Bunches;
|
|
|
|
TArray<int> CompareData;
|
|
|
|
double viewx, viewy;
|
2021-03-25 22:16:32 +00:00
|
|
|
vec2_t iview;
|
|
|
|
float gcosang, gsinang;
|
2021-03-18 11:32:31 +00:00
|
|
|
FixedBitArray<MAXSECTORS> gotsector;
|
2021-05-02 22:15:09 +00:00
|
|
|
FixedBitArray<MAXSECTORS*5/4> gotsection2;
|
2021-11-20 23:03:56 +00:00
|
|
|
BitArray gotwall;
|
|
|
|
BitArray blockwall;
|
2021-05-14 08:50:22 +00:00
|
|
|
binangle ang1, ang2, angrange;
|
2021-03-18 11:32:31 +00:00
|
|
|
|
2021-05-02 22:15:09 +00:00
|
|
|
int sectionstartang[MAXSECTORS*5/4], sectionendang[MAXSECTORS*5/4];
|
2021-04-24 10:08:38 +00:00
|
|
|
|
2021-03-18 11:32:31 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CL_Skip = 0,
|
|
|
|
CL_Draw = 1,
|
|
|
|
CL_Pass = 2,
|
|
|
|
};
|
|
|
|
|
2021-05-14 08:50:22 +00:00
|
|
|
binangle ClipAngle(int wal) { return wall[wal].clipangle - ang1; }
|
2021-03-18 11:32:31 +00:00
|
|
|
void StartScene();
|
2021-04-07 14:09:25 +00:00
|
|
|
bool StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal);
|
|
|
|
bool AddLineToBunch(int line, binangle newan);
|
2021-03-18 11:32:31 +00:00
|
|
|
void DeleteBunch(int index);
|
|
|
|
bool CheckClip(walltype* wal);
|
2021-04-06 17:25:40 +00:00
|
|
|
int ClipLine(int line, bool portal);
|
2021-03-18 11:32:31 +00:00
|
|
|
void ProcessBunch(int bnch);
|
|
|
|
int WallInFront(int wall1, int wall2);
|
2021-05-21 12:31:12 +00:00
|
|
|
int ColinearBunchInFront(FBunch* b1, FBunch* b2);
|
2021-03-18 11:32:31 +00:00
|
|
|
int BunchInFront(FBunch* b1, FBunch* b2);
|
|
|
|
int FindClosestBunch();
|
2021-05-02 22:15:09 +00:00
|
|
|
void ProcessSection(int sectnum, bool portal);
|
2021-03-18 11:32:31 +00:00
|
|
|
|
|
|
|
public:
|
2021-04-06 22:02:36 +00:00
|
|
|
void Init(HWDrawInfo* _di, Clipper* c, vec2_t& view, binangle a1, binangle a2);
|
2021-04-06 17:25:40 +00:00
|
|
|
void RenderScene(const int* viewsectors, unsigned sectcount, bool portal);
|
2021-04-01 18:47:05 +00:00
|
|
|
const FixedBitArray<MAXSECTORS>& GotSector() const { return gotsector; }
|
2021-03-18 11:32:31 +00:00
|
|
|
};
|