- Finish the merge of kexDoomMap into FLevel

This commit is contained in:
Magnus Norddahl 2018-10-26 13:00:35 +02:00
parent be1ada81a6
commit fe9368b048
9 changed files with 618 additions and 1299 deletions

View file

@ -2,6 +2,9 @@
#pragma once #pragma once
#include "framework/tarray.h" #include "framework/tarray.h"
#include "lightmap/kexlib/math/mathlib.h"
#undef MIN
#undef MAX
enum enum
{ {
@ -228,12 +231,78 @@ struct vertex_t;
struct surface_t; struct surface_t;
struct thingLight_t; struct thingLight_t;
struct FloatVertex
{
float x;
float y;
};
struct leaf_t struct leaf_t
{ {
vertex_t *vertex; FloatVertex vertex;
MapSegGLEx *seg; MapSegGLEx *seg;
}; };
struct lightDef_t
{
int doomednum;
float height;
float radius;
float intensity;
float falloff;
bool bCeiling;
kexVec3 rgb;
};
struct mapDef_t
{
int map;
int sunIgnoreTag;
kexVec3 sunDir;
kexVec3 sunColor;
};
struct thingLight_t
{
IntThing *mapThing;
kexVec2 origin;
kexVec3 rgb;
float intensity;
float falloff;
float height;
float radius;
bool bCeiling;
IntSector *sector;
MapSubsectorEx *ssect;
};
struct surfaceLightDef
{
int tag;
float outerCone;
float innerCone;
float falloff;
float distance;
float intensity;
bool bIgnoreFloor;
bool bIgnoreCeiling;
bool bNoCenterPoint;
kexVec3 rgb;
};
enum mapFlags_t
{
ML_BLOCKING = 1, // Solid, is an obstacle.
ML_BLOCKMONSTERS = 2, // Blocks monsters only.
ML_TWOSIDED = 4, // Backside will not be present at all if not two sided.
ML_TRANSPARENT1 = 2048, // 25% or 75% transcluency?
ML_TRANSPARENT2 = 4096 // 25% or 75% transcluency?
};
#define NO_SIDE_INDEX -1
#define NO_LINE_INDEX 0xFFFF
#define NF_SUBSECTOR 0x8000
struct FLevel struct FLevel
{ {
FLevel (); FLevel ();
@ -277,30 +346,34 @@ struct FLevel
// Dlight helpers // Dlight helpers
leaf_t *leafs; leaf_t *leafs = nullptr;
uint8_t *mapPVS; uint8_t *mapPVS = nullptr;
bool *bSkySectors; bool *bSkySectors = nullptr;
bool *bSSectsVisibleToSky; bool *bSSectsVisibleToSky = nullptr;
int numLeafs; int numLeafs = 0;
int *segLeafLookup; int *segLeafLookup = nullptr;
int *ssLeafLookup; int *ssLeafLookup = nullptr;
int *ssLeafCount; int *ssLeafCount = nullptr;
kexBBox *ssLeafBounds; kexBBox *ssLeafBounds = nullptr;
kexBBox *nodeBounds; kexBBox *nodeBounds = nullptr;
surface_t **segSurfaces[3]; surface_t **segSurfaces[3] = { nullptr, nullptr, nullptr };
surface_t **leafSurfaces[2]; surface_t **leafSurfaces[2] = { nullptr, nullptr };
TArray<thingLight_t*> thingLights; TArray<thingLight_t*> thingLights;
TArray<kexLightSurface*> lightSurfaces; TArray<kexLightSurface*> lightSurfaces;
void SetupDlight();
void ParseConfigFile(const char *file);
void CreateLights();
void CleanupThingLights();
const kexVec3 &GetSunColor() const; const kexVec3 &GetSunColor() const;
const kexVec3 &GetSunDirection() const; const kexVec3 &GetSunDirection() const;
IntSideDef *GetSideDef(const MapSegGLEx *seg); IntSideDef *GetSideDef(const MapSegGLEx *seg);
IntSector *GetFrontSector(const MapSegGLEx *seg); IntSector *GetFrontSector(const MapSegGLEx *seg);
IntSector *GetBackSector(const MapSegGLEx *seg); IntSector *GetBackSector(const MapSegGLEx *seg);
@ -308,8 +381,20 @@ struct FLevel
MapSubsectorEx *PointInSubSector(const int x, const int y); MapSubsectorEx *PointInSubSector(const int x, const int y);
bool PointInsideSubSector(const float x, const float y, const MapSubsectorEx *sub); bool PointInsideSubSector(const float x, const float y, const MapSubsectorEx *sub);
bool LineIntersectSubSector(const kexVec3 &start, const kexVec3 &end, const MapSubsectorEx *sub, kexVec2 &out); bool LineIntersectSubSector(const kexVec3 &start, const kexVec3 &end, const MapSubsectorEx *sub, kexVec2 &out);
vertex_t *GetSegVertex(int index); FloatVertex GetSegVertex(int index);
bool CheckPVS(MapSubsectorEx *s1, MapSubsectorEx *s2); bool CheckPVS(MapSubsectorEx *s1, MapSubsectorEx *s2);
private:
void BuildNodeBounds();
void BuildLeafs();
void BuildPVS();
void CheckSkySectors();
TArray<lightDef_t> lightDefs;
TArray<surfaceLightDef> surfaceLightDefs;
TArray<mapDef_t> mapDefs;
mapDef_t *mapDef = nullptr;
}; };
const int BLOCKSIZE = 128; const int BLOCKSIZE = 128;

View file

@ -38,6 +38,7 @@
#include "worker.h" #include "worker.h"
#include "kexlib/binFile.h" #include "kexlib/binFile.h"
#include "wad.h" #include "wad.h"
#include "framework/templates.h"
//#define EXPORT_TEXELS_OBJ //#define EXPORT_TEXELS_OBJ
@ -314,7 +315,7 @@ kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &ori
dir.Normalize(); dir.Normalize();
float r = MAX(radius - dist, 0); float r = MAX(radius - dist, 0.0f);
colorAdd = ((r * plane.Normal().Dot(dir)) / radius) * intensity; colorAdd = ((r * plane.Normal().Dot(dir)) / radius) * intensity;
kexMath::Clamp(colorAdd, 0, 1); kexMath::Clamp(colorAdd, 0, 1);
@ -651,11 +652,11 @@ void kexLightmapBuilder::LightSurface(const int surfid)
// and against all nearby thing lights // and against all nearby thing lights
// //
kexVec3 kexLightmapBuilder::LightCellSample(const int gridid, kexTrace &trace, const kexVec3 &origin, const mapSubSector_t *sub) kexVec3 kexLightmapBuilder::LightCellSample(const int gridid, kexTrace &trace, const kexVec3 &origin, const MapSubsectorEx *sub)
{ {
kexVec3 color; kexVec3 color;
kexVec3 dir; kexVec3 dir;
mapSector_t *mapSector; IntSector *mapSector;
float intensity; float intensity;
float radius; float radius;
float dist; float dist;
@ -787,7 +788,7 @@ void kexLightmapBuilder::LightGrid(const int gridid)
int gx = (int)gridBlock.x; int gx = (int)gridBlock.x;
int gy = (int)gridBlock.y; int gy = (int)gridBlock.y;
kexTrace trace; kexTrace trace;
mapSubSector_t *ss; MapSubsectorEx *ss;
// convert grid id to xyz coordinates // convert grid id to xyz coordinates
mod = gridid; mod = gridid;
@ -858,7 +859,7 @@ void kexLightmapBuilder::LightGrid(const int gridid)
// kexLightmapBuilder::CreateLightmaps // kexLightmapBuilder::CreateLightmaps
// //
void kexLightmapBuilder::CreateLightmaps(kexDoomMap &doomMap) void kexLightmapBuilder::CreateLightmaps(FLevel &doomMap)
{ {
map = &doomMap; map = &doomMap;
@ -916,7 +917,7 @@ void kexLightmapBuilder::CreateLightGrid()
// allocate data // allocate data
gridMap = (gridMap_t*)Mem_Calloc(sizeof(gridMap_t) * count, hb_static); gridMap = (gridMap_t*)Mem_Calloc(sizeof(gridMap_t) * count, hb_static);
gridSectors = (mapSubSector_t**)Mem_Calloc(sizeof(mapSubSector_t*) * gridSectors = (MapSubsectorEx**)Mem_Calloc(sizeof(MapSubsectorEx*) *
(int)(gridBlock.x * gridBlock.y), hb_static); (int)(gridBlock.x * gridBlock.y), hb_static);
// process all grid cells // process all grid cells

View file

@ -43,7 +43,7 @@ public:
void BuildSurfaceParams(surface_t *surface); void BuildSurfaceParams(surface_t *surface);
void TraceSurface(surface_t *surface); void TraceSurface(surface_t *surface);
void CreateLightGrid(); void CreateLightGrid();
void CreateLightmaps(kexDoomMap &doomMap); void CreateLightmaps(FLevel &doomMap);
void LightSurface(const int surfid); void LightSurface(const int surfid);
void LightGrid(const int gridid); void LightGrid(const int gridid);
void WriteTexturesToTGA(); void WriteTexturesToTGA();
@ -62,7 +62,7 @@ private:
bool MakeRoomForBlock(const int width, const int height, int *x, int *y, int *num); bool MakeRoomForBlock(const int width, const int height, int *x, int *y, int *num);
kexBBox GetBoundsFromSurface(const surface_t *surface); kexBBox GetBoundsFromSurface(const surface_t *surface);
kexVec3 LightTexelSample(kexTrace &trace, const kexVec3 &origin, surface_t *surface); kexVec3 LightTexelSample(kexTrace &trace, const kexVec3 &origin, surface_t *surface);
kexVec3 LightCellSample(const int gridid, kexTrace &trace, const kexVec3 &origin, const mapSubSector_t *sub); kexVec3 LightCellSample(const int gridid, kexTrace &trace, const kexVec3 &origin, const MapSubsectorEx *sub);
bool EmitFromCeiling(kexTrace &trace, const surface_t *surface, const kexVec3 &origin, const kexVec3 &normal, float *dist); bool EmitFromCeiling(kexTrace &trace, const surface_t *surface, const kexVec3 &origin, const kexVec3 &normal, float *dist);
void ExportTexelsToObjFile(FILE *f, const kexVec3 &org, int indices); void ExportTexelsToObjFile(FILE *f, const kexVec3 &org, int indices);
void WriteBlock(FILE *f, const int i, const kexVec3 &org, int indices, kexBBox &box); void WriteBlock(FILE *f, const int i, const kexVec3 &org, int indices, kexBBox &box);
@ -74,7 +74,7 @@ private:
kexVec3 color; kexVec3 color;
}; };
kexDoomMap *map; FLevel *map;
kexArray<byte*> textures; kexArray<byte*> textures;
int **allocBlocks; int **allocBlocks;
int numTextures; int numTextures;
@ -82,7 +82,7 @@ private:
int tracedTexels; int tracedTexels;
int numLightGrids; int numLightGrids;
gridMap_t *gridMap; gridMap_t *gridMap;
mapSubSector_t **gridSectors; MapSubsectorEx **gridSectors;
kexBBox worldGrid; kexBBox worldGrid;
kexBBox gridBound; kexBBox gridBound;
kexVec3 gridBlock; kexVec3 gridBlock;

View file

@ -29,21 +29,8 @@
#include "surfaces.h" #include "surfaces.h"
struct surfaceLightDef
{
int tag;
float outerCone;
float innerCone;
float falloff;
float distance;
float intensity;
bool bIgnoreFloor;
bool bIgnoreCeiling;
bool bNoCenterPoint;
kexVec3 rgb;
};
struct FLevel; struct FLevel;
struct surfaceLightDef;
class kexTrace; class kexTrace;
class kexLightSurface class kexLightSurface

File diff suppressed because it is too large Load diff

View file

@ -29,306 +29,5 @@
#include "framework/zdray.h" #include "framework/zdray.h"
#include "level/level.h" #include "level/level.h"
typedef FLevel kexDoomMap;
typedef MapSubsectorEx mapSubSector_t;
typedef MapSegGLEx glSeg_t;
typedef IntSideDef mapSideDef_t;
typedef IntSector mapSector_t;
enum mapFlags_t
{
ML_BLOCKING = 1, // Solid, is an obstacle.
ML_BLOCKMONSTERS = 2, // Blocks monsters only.
ML_TWOSIDED = 4, // Backside will not be present at all if not two sided.
ML_TRANSPARENT1 = 2048, // 25% or 75% transcluency?
ML_TRANSPARENT2 = 4096 // 25% or 75% transcluency?
};
#define NO_SIDE_INDEX -1
#define NO_LINE_INDEX 0xFFFF
#define NF_SUBSECTOR 0x8000
struct lightDef_t
{
int doomednum;
float height;
float radius;
float intensity;
float falloff;
bool bCeiling;
kexVec3 rgb;
};
struct mapDef_t
{
int map;
int sunIgnoreTag;
kexVec3 sunDir;
kexVec3 sunColor;
};
struct thingLight_t
{
IntThing *mapThing;
kexVec2 origin;
kexVec3 rgb;
float intensity;
float falloff;
float height;
float radius;
bool bCeiling;
mapSector_t *sector;
mapSubSector_t *ssect;
};
#include "surfaces.h" #include "surfaces.h"
#include "lightSurface.h" #include "lightSurface.h"
#if 0
#include "wad.h"
#include "surfaces.h"
#include "lightSurface.h"
#define NO_SIDE_INDEX -1
#define NO_LINE_INDEX 0xFFFF
#define NF_SUBSECTOR 0x8000
enum
{
BOXTOP,
BOXBOTTOM,
BOXLEFT,
BOXRIGHT
};
enum mapFlags_t
{
ML_BLOCKING = 1, // Solid, is an obstacle.
ML_BLOCKMONSTERS = 2, // Blocks monsters only.
ML_TWOSIDED = 4, // Backside will not be present at all if not two sided.
ML_TRANSPARENT1 = 2048, // 25% or 75% transcluency?
ML_TRANSPARENT2 = 4096 // 25% or 75% transcluency?
};
struct mapVertex_t
{
short x;
short y;
};
struct mapSideDef_t
{
short textureoffset;
short rowoffset;
char toptexture[8];
char bottomtexture[8];
char midtexture[8];
short sector;
};
struct mapLineDef_t
{
short v1;
short v2;
short flags;
short special;
short tag;
short sidenum[2]; // sidenum[1] will be -1 if one sided
};
struct mapSector_t
{
short floorheight;
short ceilingheight;
char floorpic[8];
char ceilingpic[8];
short lightlevel;
short special;
short tag;
};
struct mapNode_t
{
// Partition line from (x,y) to x+dx,y+dy)
short x;
short y;
short dx;
short dy;
// Bounding box for each child,
// clip against view frustum.
short bbox[2][4];
// If NF_SUBSECTOR its a subsector,
// else it's a node of another subtree.
word children[2];
};
struct mapSeg_t
{
word v1;
word v2;
short angle;
word linedef;
short side;
short offset;
};
struct mapSubSector_t
{
word numsegs;
word firstseg;
};
struct mapThing_t
{
short x;
short y;
short angle;
short type;
short options;
};
struct glVert_t
{
int x;
int y;
};
struct glSeg_t
{
word v1;
word v2;
word linedef;
int16_t side;
word partner;
};
struct vertex_t
{
float x;
float y;
};
struct leaf_t
{
vertex_t *vertex;
glSeg_t *seg;
};
struct lightDef_t
{
int doomednum;
float height;
float radius;
float intensity;
float falloff;
bool bCeiling;
kexVec3 rgb;
};
struct mapDef_t
{
int map;
int sunIgnoreTag;
kexVec3 sunDir;
kexVec3 sunColor;
};
struct thingLight_t
{
mapThing_t *mapThing;
kexVec2 origin;
kexVec3 rgb;
float intensity;
float falloff;
float height;
float radius;
bool bCeiling;
mapSector_t *sector;
mapSubSector_t *ssect;
};
class kexDoomMap
{
public:
kexDoomMap();
~kexDoomMap();
void BuildMapFromWad(kexWadFile &wadFile);
mapSideDef_t *GetSideDef(const glSeg_t *seg);
mapSector_t *GetFrontSector(const glSeg_t *seg);
mapSector_t *GetBackSector(const glSeg_t *seg);
mapSector_t *GetSectorFromSubSector(const mapSubSector_t *sub);
mapSubSector_t *PointInSubSector(const int x, const int y);
bool PointInsideSubSector(const float x, const float y, const mapSubSector_t *sub);
bool LineIntersectSubSector(const kexVec3 &start, const kexVec3 &end, const mapSubSector_t *sub, kexVec2 &out);
vertex_t *GetSegVertex(int index);
bool CheckPVS(mapSubSector_t *s1, mapSubSector_t *s2);
void ParseConfigFile(const char *file);
void CreateLights();
void CleanupThingLights();
const kexVec3 &GetSunColor() const;
const kexVec3 &GetSunDirection() const;
mapThing_t *mapThings;
mapLineDef_t *mapLines;
mapVertex_t *mapVerts;
mapSideDef_t *mapSides;
mapSector_t *mapSectors;
glSeg_t *mapSegs;
mapSubSector_t *mapSSects;
mapNode_t *nodes;
leaf_t *leafs;
vertex_t *vertexes;
byte *mapPVS;
bool *bSkySectors;
bool *bSSectsVisibleToSky;
int numThings;
int numLines;
int numVerts;
int numSides;
int numSectors;
int numSegs;
int numSSects;
int numNodes;
int numLeafs;
int numVertexes;
int *segLeafLookup;
int *ssLeafLookup;
int *ssLeafCount;
kexBBox *ssLeafBounds;
kexBBox *nodeBounds;
surface_t **segSurfaces[3];
surface_t **leafSurfaces[2];
kexArray<thingLight_t*> thingLights;
kexArray<kexLightSurface*> lightSurfaces;
private:
void BuildLeafs();
void BuildNodeBounds();
void CheckSkySectors();
void BuildVertexes(kexWadFile &wadFile);
void BuildPVS();
kexArray<lightDef_t> lightDefs;
kexArray<surfaceLightDef> surfaceLightDefs;
kexArray<mapDef_t> mapDefs;
mapDef_t *mapDef;
static const kexVec3 defaultSunColor;
static const kexVec3 defaultSunDirection;
};
#endif

View file

@ -42,16 +42,14 @@ kexArray<surface_t*> surfaces;
// Surface_AllocateFromSeg // Surface_AllocateFromSeg
// //
static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg) static void Surface_AllocateFromSeg(FLevel &doomMap, MapSegGLEx *seg)
{ {
mapSideDef_t *side; IntSideDef *side;
surface_t *surf; surface_t *surf;
float top, bTop; float top, bTop;
float bottom, bBottom; float bottom, bBottom;
mapSector_t *front; IntSector *front;
mapSector_t *back; IntSector *back;
vertex_t *v1;
vertex_t *v2;
if(seg->linedef == NO_LINE_INDEX) if(seg->linedef == NO_LINE_INDEX)
{ {
@ -65,8 +63,8 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
top = front->data.ceilingheight; top = front->data.ceilingheight;
bottom = front->data.floorheight; bottom = front->data.floorheight;
v1 = doomMap.GetSegVertex(seg->v1); FloatVertex v1 = doomMap.GetSegVertex(seg->v1);
v2 = doomMap.GetSegVertex(seg->v2); FloatVertex v2 = doomMap.GetSegVertex(seg->v2);
if(back) if(back)
{ {
@ -87,10 +85,10 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
surf->numVerts = 4; surf->numVerts = 4;
surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * 4, hb_static); surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * 4, hb_static);
surf->verts[0].x = surf->verts[2].x = v1->x; surf->verts[0].x = surf->verts[2].x = v1.x;
surf->verts[0].y = surf->verts[2].y = v1->y; surf->verts[0].y = surf->verts[2].y = v1.y;
surf->verts[1].x = surf->verts[3].x = v2->x; surf->verts[1].x = surf->verts[3].x = v2.x;
surf->verts[1].y = surf->verts[3].y = v2->y; surf->verts[1].y = surf->verts[3].y = v2.y;
surf->verts[0].z = surf->verts[1].z = bottom; surf->verts[0].z = surf->verts[1].z = bottom;
surf->verts[2].z = surf->verts[3].z = bBottom; surf->verts[2].z = surf->verts[3].z = bBottom;
@ -101,7 +99,7 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]]; surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]];
doomMap.segSurfaces[1][surf->typeIndex] = surf; doomMap.segSurfaces[1][surf->typeIndex] = surf;
surf->data = (glSeg_t*)seg; surf->data = (MapSegGLEx*)seg;
surfaces.Push(surf); surfaces.Push(surf);
} }
@ -130,10 +128,10 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
surf->numVerts = 4; surf->numVerts = 4;
surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * 4, hb_static); surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * 4, hb_static);
surf->verts[0].x = surf->verts[2].x = v1->x; surf->verts[0].x = surf->verts[2].x = v1.x;
surf->verts[0].y = surf->verts[2].y = v1->y; surf->verts[0].y = surf->verts[2].y = v1.y;
surf->verts[1].x = surf->verts[3].x = v2->x; surf->verts[1].x = surf->verts[3].x = v2.x;
surf->verts[1].y = surf->verts[3].y = v2->y; surf->verts[1].y = surf->verts[3].y = v2.y;
surf->verts[0].z = surf->verts[1].z = bTop; surf->verts[0].z = surf->verts[1].z = bTop;
surf->verts[2].z = surf->verts[3].z = top; surf->verts[2].z = surf->verts[3].z = top;
@ -145,7 +143,7 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]]; surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]];
doomMap.segSurfaces[2][surf->typeIndex] = surf; doomMap.segSurfaces[2][surf->typeIndex] = surf;
surf->data = (glSeg_t*)seg; surf->data = (MapSegGLEx*)seg;
surfaces.Push(surf); surfaces.Push(surf);
} }
@ -161,10 +159,10 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
surf->numVerts = 4; surf->numVerts = 4;
surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * 4, hb_static); surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * 4, hb_static);
surf->verts[0].x = surf->verts[2].x = v1->x; surf->verts[0].x = surf->verts[2].x = v1.x;
surf->verts[0].y = surf->verts[2].y = v1->y; surf->verts[0].y = surf->verts[2].y = v1.y;
surf->verts[1].x = surf->verts[3].x = v2->x; surf->verts[1].x = surf->verts[3].x = v2.x;
surf->verts[1].y = surf->verts[3].y = v2->y; surf->verts[1].y = surf->verts[3].y = v2.y;
surf->verts[0].z = surf->verts[1].z = bottom; surf->verts[0].z = surf->verts[1].z = bottom;
surf->verts[2].z = surf->verts[3].z = top; surf->verts[2].z = surf->verts[3].z = top;
@ -175,7 +173,7 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]]; surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]];
doomMap.segSurfaces[0][surf->typeIndex] = surf; doomMap.segSurfaces[0][surf->typeIndex] = surf;
surf->data = (glSeg_t*)seg; surf->data = (MapSegGLEx*)seg;
surfaces.Push(surf); surfaces.Push(surf);
} }
@ -188,11 +186,11 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
// unless slopes are involved.... // unless slopes are involved....
// //
static void Surface_AllocateFromLeaf(kexDoomMap &doomMap) static void Surface_AllocateFromLeaf(FLevel &doomMap)
{ {
surface_t *surf; surface_t *surf;
leaf_t *leaf; leaf_t *leaf;
mapSector_t *sector = NULL; IntSector *sector = NULL;
int i; int i;
int j; int j;
@ -230,8 +228,8 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
{ {
leaf = &doomMap.leafs[doomMap.ssLeafLookup[i] + (surf->numVerts - 1) - j]; leaf = &doomMap.leafs[doomMap.ssLeafLookup[i] + (surf->numVerts - 1) - j];
surf->verts[j].x = leaf->vertex->x; surf->verts[j].x = leaf->vertex.x;
surf->verts[j].y = leaf->vertex->y; surf->verts[j].y = leaf->vertex.y;
surf->verts[j].z = sector->data.floorheight; surf->verts[j].z = sector->data.floorheight;
} }
@ -241,7 +239,7 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
surf->typeIndex = i; surf->typeIndex = i;
doomMap.leafSurfaces[0][i] = surf; doomMap.leafSurfaces[0][i] = surf;
surf->data = (mapSector_t*)sector; surf->data = (IntSector*)sector;
surfaces.Push(surf); surfaces.Push(surf);
@ -260,8 +258,8 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
{ {
leaf = &doomMap.leafs[doomMap.ssLeafLookup[i] + j]; leaf = &doomMap.leafs[doomMap.ssLeafLookup[i] + j];
surf->verts[j].x = leaf->vertex->x; surf->verts[j].x = leaf->vertex.x;
surf->verts[j].y = leaf->vertex->y; surf->verts[j].y = leaf->vertex.y;
surf->verts[j].z = sector->data.ceilingheight; surf->verts[j].z = sector->data.ceilingheight;
} }
@ -271,7 +269,7 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
surf->typeIndex = i; surf->typeIndex = i;
doomMap.leafSurfaces[1][i] = surf; doomMap.leafSurfaces[1][i] = surf;
surf->data = (mapSector_t*)sector; surf->data = (IntSector*)sector;
surfaces.Push(surf); surfaces.Push(surf);
} }
@ -283,7 +281,7 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
// Surface_AllocateFromMap // Surface_AllocateFromMap
// //
void Surface_AllocateFromMap(kexDoomMap &doomMap) void Surface_AllocateFromMap(FLevel &doomMap)
{ {
doomMap.segSurfaces[0] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static); doomMap.segSurfaces[0] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static);
doomMap.segSurfaces[1] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static); doomMap.segSurfaces[1] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static);

View file

@ -56,7 +56,7 @@ kexTrace::~kexTrace()
// kexTrace::Init // kexTrace::Init
// //
void kexTrace::Init(kexDoomMap &doomMap) void kexTrace::Init(FLevel &doomMap)
{ {
map = &doomMap; map = &doomMap;
} }
@ -197,7 +197,7 @@ void kexTrace::TraceSurface(surface_t *surface)
void kexTrace::TraceSubSector(int num) void kexTrace::TraceSubSector(int num)
{ {
mapSubSector_t *sub; MapSubsectorEx *sub;
int i; int i;
int j; int j;

View file

@ -197,7 +197,7 @@ int main(int argc, char **argv)
{ {
kexWadFile wadFile; kexWadFile wadFile;
kexWadFile outWadFile; kexWadFile outWadFile;
kexDoomMap doomMap; FLevel doomMap;
lump_t *lmLump; lump_t *lmLump;
kexArray<int> ignoreLumps; kexArray<int> ignoreLumps;
kexLightmapBuilder builder; kexLightmapBuilder builder;