forked from rheit/zdbsp
-
Notifications
You must be signed in to change notification settings - Fork 2
/
processor.h
132 lines (106 loc) · 4.3 KB
/
processor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#ifndef __PROCESSOR_H__
#define __PROCESSOR_H__
#ifdef _MSC_VER
#pragma once
#endif
#include "wad.h"
#include "doomdata.h"
#include "workdata.h"
#include "tarray.h"
#include "nodebuild.h"
#include "blockmapbuilder.h"
#include <zlib.h>
class ZLibOut
{
public:
ZLibOut (FWadWriter &out);
~ZLibOut ();
ZLibOut &operator << (BYTE);
ZLibOut &operator << (WORD);
ZLibOut &operator << (SWORD);
ZLibOut &operator << (DWORD);
ZLibOut &operator << (fixed_t);
void Write (BYTE *data, int len);
private:
enum { BUFFER_SIZE = 8192 };
z_stream Stream;
BYTE Buffer[BUFFER_SIZE];
FWadWriter &Out;
};
class FProcessor
{
public:
FProcessor (FWadReader &inwad, int lump);
void Write (FWadWriter &out);
private:
void LoadUDMF();
void LoadThings ();
void LoadLines ();
void LoadVertices ();
void LoadSides ();
void LoadSectors ();
void GetPolySpots ();
MapNodeEx *NodesToEx (const MapNode *nodes, int count);
MapSubsectorEx *SubsectorsToEx (const MapSubsector *ssec, int count);
MapSegGLEx *SegGLsToEx (const MapSegGL *segs, int count);
BYTE *FixReject (const BYTE *oldreject);
bool CheckForFracSplitters(const MapNodeEx *nodes, int count);
void WriteLines (FWadWriter &out);
void WriteVertices (FWadWriter &out, int count);
void WriteSectors (FWadWriter &out);
void WriteSides (FWadWriter &out);
void WriteSegs (FWadWriter &out);
void WriteSSectors (FWadWriter &out) const;
void WriteNodes (FWadWriter &out) const;
void WriteBlockmap (FWadWriter &out);
void WriteReject (FWadWriter &out);
void WriteGLVertices (FWadWriter &out, bool v5);
void WriteGLSegs (FWadWriter &out, bool v5);
void WriteGLSegs5 (FWadWriter &out);
void WriteGLSSect (FWadWriter &out, bool v5);
void WriteGLNodes (FWadWriter &out, bool v5);
void WriteBSPZ (FWadWriter &out, const char *label);
void WriteGLBSPZ (FWadWriter &out, const char *label);
void WriteVerticesZ (ZLibOut &out, const WideVertex *verts, int orgverts, int newverts);
void WriteSubsectorsZ (ZLibOut &out, const MapSubsectorEx *subs, int numsubs);
void WriteSegsZ (ZLibOut &out, const MapSegEx *segs, int numsegs);
void WriteGLSegsZ (ZLibOut &out, const MapSegGLEx *segs, int numsegs, int nodever);
void WriteNodesZ (ZLibOut &out, const MapNodeEx *nodes, int numnodes, int nodever);
void WriteBSPX (FWadWriter &out, const char *label);
void WriteGLBSPX (FWadWriter &out, const char *label);
void WriteVerticesX (FWadWriter &out, const WideVertex *verts, int orgverts, int newverts);
void WriteSubsectorsX (FWadWriter &out, const MapSubsectorEx *subs, int numsubs);
void WriteSegsX (FWadWriter &out, const MapSegEx *segs, int numsegs);
void WriteGLSegsX (FWadWriter &out, const MapSegGLEx *segs, int numsegs, int nodever);
void WriteNodesX (FWadWriter &out, const MapNodeEx *nodes, int numnodes, int nodever);
void WriteNodes2 (FWadWriter &out, const char *name, const MapNodeEx *zaNodes, int count) const;
void WriteSSectors2 (FWadWriter &out, const char *name, const MapSubsectorEx *zaSubs, int count) const;
void WriteNodes5 (FWadWriter &out, const char *name, const MapNodeEx *zaNodes, int count) const;
void WriteSSectors5 (FWadWriter &out, const char *name, const MapSubsectorEx *zaSubs, int count) const;
const char *ParseKey(const char *&value);
bool CheckKey(const char *&key, const char *&value);
void ParseThing(IntThing *th);
void ParseLinedef(IntLineDef *ld);
void ParseSidedef(IntSideDef *sd);
void ParseSector(IntSector *sec);
void ParseVertex(WideVertex *vt, IntVertex *vtp);
void ParseMapProperties();
void ParseTextMap(int lump);
void WriteProps(FWadWriter &out, TArray<UDMFKey> &props);
void WriteIntProp(FWadWriter &out, const char *key, int value);
void WriteThingUDMF(FWadWriter &out, IntThing *th, int num);
void WriteLinedefUDMF(FWadWriter &out, IntLineDef *ld, int num);
void WriteSidedefUDMF(FWadWriter &out, IntSideDef *sd, int num);
void WriteSectorUDMF(FWadWriter &out, IntSector *sec, int num);
void WriteVertexUDMF(FWadWriter &out, IntVertex *vt, int num);
void WriteTextMap(FWadWriter &out);
void WriteUDMF(FWadWriter &out);
FLevel Level;
TArray<FNodeBuilder::FPolyStart> PolyStarts;
TArray<FNodeBuilder::FPolyStart> PolyAnchors;
bool Extended;
bool isUDMF;
FWadReader &Wad;
int Lump;
};
#endif //__PROCESSOR_H__