From 4cb20a815b8e763ecc30e882e3ec695452e2b835 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 29 Oct 2008 20:57:47 +0000 Subject: Add packed structure attribute for structures read from disk. Subversion-branch: /branches/raven-branch Subversion-revision: 1365 --- src/heretic/doomdata.h | 36 +++++++++++++++++++++++------------- src/hexen/p_acs.c | 2 +- src/hexen/xddefs.h | 20 ++++++++++---------- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/heretic/doomdata.h b/src/heretic/doomdata.h index b55daae4..b5abbe8b 100644 --- a/src/heretic/doomdata.h +++ b/src/heretic/doomdata.h @@ -40,15 +40,25 @@ // lump order in a map wad enum -{ ML_LABEL, ML_THINGS, ML_LINEDEFS, ML_SIDEDEFS, ML_VERTEXES, ML_SEGS, - ML_SSECTORS, ML_NODES, ML_SECTORS, ML_REJECT, ML_BLOCKMAP +{ + ML_LABEL, + ML_THINGS, + ML_LINEDEFS, + ML_SIDEDEFS, + ML_VERTEXES, + ML_SEGS, + ML_SSECTORS, + ML_NODES, + ML_SECTORS, + ML_REJECT, + ML_BLOCKMAP }; typedef struct { short x, y; -} mapvertex_t; +} PACKEDATTR mapvertex_t; typedef struct { @@ -56,7 +66,7 @@ typedef struct short rowoffset; char toptexture[8], bottomtexture[8], midtexture[8]; short sector; // on viewer's side -} mapsidedef_t; +} PACKEDATTR mapsidedef_t; typedef struct { @@ -64,7 +74,7 @@ typedef struct short flags; short special, tag; short sidenum[2]; // sidenum[1] will be -1 if one sided -} maplinedef_t; +} PACKEDATTR maplinedef_t; #define ML_BLOCKING 1 #define ML_BLOCKMONSTERS 2 @@ -91,13 +101,13 @@ typedef struct char floorpic[8], ceilingpic[8]; short lightlevel; short special, tag; -} mapsector_t; +} PACKEDATTR mapsector_t; typedef struct { short numsegs; short firstseg; // segs are stored sequentially -} mapsubsector_t; +} PACKEDATTR mapsubsector_t; typedef struct { @@ -105,7 +115,7 @@ typedef struct short angle; short linedef, side; short offset; -} mapseg_t; +} PACKEDATTR mapseg_t; #define NF_SUBSECTOR 0x8000 typedef struct @@ -113,7 +123,7 @@ typedef struct short x, y, dx, dy; // partition line short bbox[2][4]; // bounding box for each child unsigned short children[2]; // if NF_SUBSECTOR its a subsector -} mapnode_t; +} PACKEDATTR mapnode_t; typedef struct { @@ -121,7 +131,7 @@ typedef struct short angle; short type; short options; -} mapthing_t; +} PACKEDATTR mapthing_t; #define MTF_EASY 1 #define MTF_NORMAL 2 @@ -143,7 +153,7 @@ typedef struct short patch; short stepdir; short colormap; -} mappatch_t; +} PACKEDATTR mappatch_t; typedef struct { @@ -151,10 +161,10 @@ typedef struct boolean masked; short width; short height; - void **columndirectory; // OBSOLETE + int obsolete; short patchcount; mappatch_t patches[1]; -} maptexture_t; +} PACKEDATTR maptexture_t; /* diff --git a/src/hexen/p_acs.c b/src/hexen/p_acs.c index 7c59b236..b5e938d1 100644 --- a/src/hexen/p_acs.c +++ b/src/hexen/p_acs.c @@ -54,7 +54,7 @@ typedef struct int marker; int infoOffset; int code; -} acsHeader_t; +} PACKEDATTR acsHeader_t; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- diff --git a/src/hexen/xddefs.h b/src/hexen/xddefs.h index 29605433..f62ac4d4 100644 --- a/src/hexen/xddefs.h +++ b/src/hexen/xddefs.h @@ -55,7 +55,7 @@ typedef struct { short x; short y; -} mapvertex_t; +} PACKEDATTR mapvertex_t; typedef struct { @@ -65,7 +65,7 @@ typedef struct char bottomtexture[8]; char midtexture[8]; short sector; // on viewer's side -} mapsidedef_t; +} PACKEDATTR mapsidedef_t; typedef struct { @@ -79,7 +79,7 @@ typedef struct byte arg4; byte arg5; short sidenum[2]; // sidenum[1] will be -1 if one sided -} maplinedef_t; +} PACKEDATTR maplinedef_t; #define ML_BLOCKING 0x0001 #define ML_BLOCKMONSTERS 0x0002 @@ -112,13 +112,13 @@ typedef struct short lightlevel; short special; short tag; -} mapsector_t; +} PACKEDATTR mapsector_t; typedef struct { short numsegs; short firstseg; // segs are stored sequentially -} mapsubsector_t; +} PACKEDATTR mapsubsector_t; typedef struct { @@ -128,7 +128,7 @@ typedef struct short linedef; short side; short offset; -} mapseg_t; +} PACKEDATTR mapseg_t; #define NF_SUBSECTOR 0x8000 typedef struct @@ -136,7 +136,7 @@ typedef struct short x, y, dx, dy; // partition line short bbox[2][4]; // bounding box for each child unsigned short children[2]; // if NF_SUBSECTOR its a subsector -} mapnode_t; +} PACKEDATTR mapnode_t; typedef struct { @@ -153,7 +153,7 @@ typedef struct byte arg3; byte arg4; byte arg5; -} mapthing_t; +} PACKEDATTR mapthing_t; #define MTF_EASY 1 #define MTF_NORMAL 2 @@ -180,7 +180,7 @@ typedef struct short patch; short stepdir; short colormap; -} mappatch_t; +} PACKEDATTR mappatch_t; typedef struct { @@ -191,7 +191,7 @@ typedef struct void **columndirectory; // OBSOLETE short patchcount; mappatch_t patches[1]; -} maptexture_t; +} PACKEDATTR maptexture_t; //-------------------------------------------------------------------------- // -- cgit v1.2.3