Skip to content

Commit

Permalink
Wad Map Converter: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jul 23, 2012
1 parent 6366ab3 commit 1fec202
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 178 deletions.
55 changes: 7 additions & 48 deletions doomsday/plugins/wadmapconverter/include/map.h
Expand Up @@ -21,53 +21,19 @@
#ifndef __WADMAPCONVERTER_MAP_H__
#define __WADMAPCONVERTER_MAP_H__

#include <stdio.h>
#include <cassert>
#include "doomsday.h"
#include "dd_types.h"

// Line sides.
#define RIGHT 0
#define LEFT 1

typedef enum lumptype_e {
ML_INVALID = -1,
FIRST_LUMP_TYPE,
ML_LABEL = FIRST_LUMP_TYPE, // A separator, name, ExMx or MAPxx
ML_THINGS, // Monsters, items..
ML_LINEDEFS, // LineDefs, from editing
ML_SIDEDEFS, // SideDefs, from editing
ML_VERTEXES, // Vertices, edited and BSP splits generated
ML_SEGS, // LineSegs, from LineDefs split by BSP
ML_SSECTORS, // Subsectors, list of LineSegs
ML_NODES, // BSP nodes
ML_SECTORS, // Sectors, from editing
ML_REJECT, // LUT, sector-sector visibility
ML_BLOCKMAP, // LUT, motion clipping, walls/grid element
ML_BEHAVIOR, // ACS Scripts (compiled).
ML_SCRIPTS, // ACS Scripts (source).
ML_LIGHTS, // Surface color tints.
ML_MACROS, // DOOM64 format, macro scripts.
ML_LEAFS, // DOOM64 format, segs (close subsectors).
ML_GLVERT, // GL vertexes
ML_GLSEGS, // GL segs
ML_GLSSECT, // GL subsectors
ML_GLNODES, // GL nodes
ML_GLPVS, // GL PVS dataset
NUM_LUMP_TYPES
} lumptype_t;

typedef struct maplumpinfo_s {
lumpnum_t lumpNum;
lumptype_t lumpType;
size_t length;
} maplumpinfo_t;
#include "maplumpinfo.h"

typedef struct materialref_s {
char name[9];
materialid_t id; // Doomsday's unique identifier for this.
} materialref_t;

// Line sides.
#define RIGHT 0
#define LEFT 1

typedef struct mside_s {
int16_t offset[2];
const materialref_t* topMaterial;
Expand Down Expand Up @@ -156,13 +122,6 @@ typedef struct mlight_s {
byte xx[3];
} surfacetint_t;

typedef enum {
MF_UNKNOWN = -1,
MF_DOOM = 0,
MF_HEXEN,
MF_DOOM64
} mapformatid_t;

typedef struct map_s {
uint numVertexes;
uint numSectors;
Expand Down Expand Up @@ -193,9 +152,9 @@ typedef struct map_s {

extern map_t* DENG_PLUGIN_GLOBAL(map);

int IsSupportedFormat(maplumpinfo_t* lumpInfos[NUM_LUMP_TYPES]);
int IsSupportedFormat(MapLumpInfo* lumpInfos[NUM_MAPLUMP_TYPES]);

int LoadMap(maplumpinfo_t* lumpInfos[NUM_LUMP_TYPES]);
int LoadMap(MapLumpInfo* lumpInfos[NUM_MAPLUMP_TYPES]);
void AnalyzeMap(void);
int TransferMap(void);

Expand Down
68 changes: 38 additions & 30 deletions doomsday/plugins/wadmapconverter/include/maplumpinfo.h
Expand Up @@ -24,37 +24,45 @@
#include "doomsday.h"
#include "dd_types.h"

typedef enum lumptype_e {
ML_INVALID = -1,
FIRST_LUMP_TYPE,
ML_LABEL = FIRST_LUMP_TYPE, // A separator, name, ExMx or MAPxx
ML_THINGS, // Monsters, items..
ML_LINEDEFS, // LineDefs, from editing
ML_SIDEDEFS, // SideDefs, from editing
ML_VERTEXES, // Vertices, edited and BSP splits generated
ML_SEGS, // LineSegs, from LineDefs split by BSP
ML_SSECTORS, // Subsectors, list of LineSegs
ML_NODES, // BSP nodes
ML_SECTORS, // Sectors, from editing
ML_REJECT, // LUT, sector-sector visibility
ML_BLOCKMAP, // LUT, motion clipping, walls/grid element
ML_BEHAVIOR, // ACS Scripts (compiled).
ML_SCRIPTS, // ACS Scripts (source).
ML_LIGHTS, // Surface color tints.
ML_MACROS, // DOOM64 format, macro scripts.
ML_LEAFS, // DOOM64 format, segs (close subsectors).
ML_GLVERT, // GL vertexes
ML_GLSEGS, // GL segs
ML_GLSSECT, // GL subsectors
ML_GLNODES, // GL nodes
ML_GLPVS, // GL PVS dataset
NUM_LUMP_TYPES
} lumptype_t;
typedef enum maplumptype_e {
ML_INVALID = -1,
FIRST_MAPLUMP_TYPE = 0,
ML_THINGS = FIRST_MAPLUMP_TYPE, ///< Monsters, items..
ML_LINEDEFS, ///< LineDefs, from editing
ML_SIDEDEFS, ///< SideDefs, from editing
ML_VERTEXES, ///< Vertices, edited and BSP splits generated
ML_SEGS, ///< LineSegs, from LineDefs split by BSP
ML_SSECTORS, ///< Subsectors, list of LineSegs
ML_NODES, ///< BSP nodes
ML_SECTORS, ///< Sectors, from editing
ML_REJECT, ///< LUT, sector-sector visibility
ML_BLOCKMAP, ///< LUT, motion clipping, walls/grid element
ML_BEHAVIOR, ///< ACS Scripts (compiled).
ML_SCRIPTS, ///< ACS Scripts (source).
ML_LIGHTS, ///< Surface color tints.
ML_MACROS, ///< DOOM64 format, macro scripts.
ML_LEAFS, ///< DOOM64 format, segs (close subsectors).
ML_GLVERT, ///< GL vertexes
ML_GLSEGS, ///< GL segs
ML_GLSSECT, ///< GL subsectors
ML_GLNODES, ///< GL nodes
ML_GLPVS, ///< GL PVS dataset
NUM_MAPLUMP_TYPES
} MapLumpType;

/// POD structure for defining extended metadata for map data lumps.
typedef struct maplumpinfo_s {
lumpnum_t lumpNum;
lumptype_t lumpType;
size_t length;
} maplumpinfo_t;
lumpnum_t lump; ///< Absolute lump number for the associated data.
MapLumpType type; ///< Recognised lump data type.
size_t length; ///< Length of the lump data in bytes.

struct maplumpinfo_s* Init(lumpnum_t lumpNum, MapLumpType lumpType, size_t lumpLength)
{
lump = lumpNum;
type = lumpType;
length = lumpLength;
return this;
}
} MapLumpInfo;

#endif /* __WADMAPCONVERTER_MAPLUMPINFO_H__ */
17 changes: 17 additions & 0 deletions doomsday/plugins/wadmapconverter/include/wadmapconverter.h
Expand Up @@ -34,6 +34,8 @@
#include <cassert>
#include <iostream>
#include <string.h>
#include "doomsday.h"
#include "dd_plugin.h"

#ifdef WIN32
# define stricmp _stricmp
Expand All @@ -46,4 +48,19 @@
# define WADMAPCONVERTER_TRACE(args)
#endif

typedef enum {
MF_UNKNOWN = -1,
MF_DOOM = 0,
MF_HEXEN,
MF_DOOM64,
NUM_MAPFORMATS
} mapformatid_t;

#define VALID_MAPFORMATID(v) ((v) >= MF_DOOM && (v) < NUM_MAPFORMATS)

extern int DENG_PLUGIN_GLOBAL(verbose);

#define VERBOSE(code) { if(DENG_PLUGIN_GLOBAL(verbose) >= 1) { code; } }
#define VERBOSE2(code) { if(DENG_PLUGIN_GLOBAL(verbose) >= 2) { code; } }

#endif /* end of include guard: __WADMAPCONVERTER_H__ */

0 comments on commit 1fec202

Please sign in to comment.