1 #ifndef buildtypes_h__ 2 #define buildtypes_h__ 3 4 #undef WALLTYPE 5 #undef SECTORTYPE 6 #undef SPRITETYPE 7 8 #ifdef UNTRACKED_STRUCTS__ 9 10 #define StructTracker(tracker, type) type 11 #define StructName(name) u ## name 12 13 #else 14 15 #define StructTracker Tracker 16 #define StructName(name) name 17 18 #endif 19 20 //ceilingstat/floorstat: 21 // bit 0: 1 = parallaxing, 0 = not "P" 22 // bit 1: 1 = groudraw, 0 = not 23 // bit 2: 1 = swap x&y, 0 = not "F" 24 // bit 3: 1 = double smooshiness "E" 25 // bit 4: 1 = x-flip "F" 26 // bit 5: 1 = y-flip "F" 27 // bit 6: 1 = Align texture to first wall of sector "R" 28 // bits 8-7: "T" 29 // 00 = normal floors 30 // 01 = masked floors 31 // 10 = transluscent masked floors 32 // 11 = reverse transluscent masked floors 33 // bit 9: 1 = blocking ceiling/floor 34 // bit 10: 1 = YAX'ed ceiling/floor 35 // bit 11: 1 = hitscan-sensitive ceiling/floor 36 // bits 12-15: reserved 37 38 //////////////////// Version 7 map format //////////////////// 39 40 //40 bytes 41 typedef struct 42 { 43 StructTracker(Sector, int16_t) wallptr, wallnum; 44 StructTracker(Sector, int32_t) ceilingz, floorz; 45 StructTracker(Sector, uint16_t) ceilingstat, floorstat; 46 StructTracker(Sector, int16_t) ceilingpicnum, ceilingheinum; 47 StructTracker(Sector, int8_t) ceilingshade; 48 StructTracker(Sector, uint8_t) ceilingpal, /*CM_FLOORZ:*/ ceilingxpanning, ceilingypanning; 49 StructTracker(Sector, int16_t) floorpicnum, floorheinum; 50 StructTracker(Sector, int8_t) floorshade; 51 StructTracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning; 52 StructTracker(Sector, uint8_t) /*CM_CEILINGZ:*/ visibility, fogpal; 53 union { 54 StructTracker(Sector, int16_t) lotag, type; 55 }; 56 StructTracker(Sector, int16_t) hitag; 57 StructTracker(Sector, int16_t) extra; 58 } StructName(sectortypev7); 59 60 //cstat: 61 // bit 0: 1 = Blocking wall (use with clipmove, getzrange) "B" 62 // bit 1: 1 = bottoms of invisible walls swapped, 0 = not "2" 63 // bit 2: 1 = align picture on bottom (for doors), 0 = top "O" 64 // bit 3: 1 = x-flipped, 0 = normal "F" 65 // bit 4: 1 = masking wall, 0 = not "M" 66 // bit 5: 1 = 1-way wall, 0 = not "1" 67 // bit 6: 1 = Blocking wall (use with hitscan / cliptype 1) "H" 68 // bit 7: 1 = Transluscence, 0 = not "T" 69 // bit 8: 1 = y-flipped, 0 = normal "F" 70 // bit 9: 1 = Transluscence reversing, 0 = normal "T" 71 // bits 10 and 11: reserved (in use by YAX) 72 // bits 12-15: reserved (14: temp use by editor) 73 74 //32 bytes 75 typedef struct 76 { 77 union { 78 struct 79 { 80 StructTracker(Wall, int32_t) x, y; 81 }; 82 vec2_t pos; 83 }; 84 StructTracker(Wall, int16_t) point2, nextwall, nextsector; 85 StructTracker(Wall, uint16_t) cstat; 86 StructTracker(Wall, int16_t) picnum, overpicnum; 87 StructTracker(Wall, int8_t) shade; 88 StructTracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning; 89 union { 90 StructTracker(Wall, int16_t) lotag, type; 91 }; 92 StructTracker(Wall, int16_t) hitag; 93 StructTracker(Wall, int16_t) extra; 94 } StructName(walltypev7); 95 96 //cstat: 97 // bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B" 98 // bit 1: 1 = transluscence, 0 = normal "T" 99 // bit 2: 1 = x-flipped, 0 = normal "F" 100 // bit 3: 1 = y-flipped, 0 = normal "F" 101 // bits 5-4: 00 = FACE sprite (default) "R" 102 // 01 = WALL sprite (like masked walls) 103 // 10 = FLOOR sprite (parallel to ceilings&floors) 104 // bit 6: 1 = 1-sided sprite, 0 = normal "1" 105 // bit 7: 1 = Real centered centering, 0 = foot center "C" 106 // bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1) "H" 107 // bit 9: 1 = Transluscence reversing, 0 = normal "T" 108 // bit 10: reserved (in use by a renderer hack, see CSTAT_SPRITE_MDHACK) 109 // bit 11: 1 = determine shade based only on its own shade member (see CON's spritenoshade command), i.e. 110 // don't take over shade from parallaxed ceiling/nonparallaxed floor 111 // (NOTE: implemented on the game side) 112 // bit 12: reserved 113 // bit 13: 1 = does not cast shadow 114 // bit 14: 1 = invisible but casts shadow 115 // bit 15: 1 = Invisible sprite, 0 = not invisible 116 #ifndef buildtypes_h__enums 117 enum 118 { 119 CSTAT_SPRITE_BLOCK = 1u, 120 CSTAT_SPRITE_TRANSLUCENT = 1u<<1u, 121 CSTAT_SPRITE_XFLIP = 1u<<2u, 122 CSTAT_SPRITE_YFLIP = 1u<<3u, 123 CSTAT_SPRITE_ALIGNMENT = 1u<<4u | 1u<<5u, // (cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_xxxxxx can be used to check sprite alignment 124 CSTAT_SPRITE_ONE_SIDED = 1u<<6u, 125 CSTAT_SPRITE_YCENTER = 1u<<7u, 126 CSTAT_SPRITE_BLOCK_HITSCAN = 1u<<8u, 127 CSTAT_SPRITE_TRANSLUCENT_INVERT = 1u<<9u, 128 129 CSTAT_SPRITE_RESERVED1 = 1u<<10u, // used by Duke 3D (Polymost) 130 CSTAT_SPRITE_RESERVED2 = 1u<<11u, // used by Duke 3D (EDuke32 game code extension) 131 CSTAT_SPRITE_RESERVED3 = 1u<<12u, // used by Shadow Warrior, Blood 132 CSTAT_SPRITE_RESERVED4 = 1u<<13u, // used by Duke 3D (Polymer), Shadow Warrior, Blood 133 CSTAT_SPRITE_RESERVED5 = 1u<<14u, // used by Duke 3D (Polymer), Shadow Warrior, Blood 134 135 CSTAT_SPRITE_INVISIBLE = 1u<<15u, 136 }; 137 enum 138 { 139 CSTAT_SPRITE_ALIGNMENT_FACING = 0, 140 CSTAT_SPRITE_ALIGNMENT_WALL = 1u<<4u, 141 CSTAT_SPRITE_ALIGNMENT_FLOOR = 1u<<5u, 142 CSTAT_SPRITE_ALIGNMENT_SLAB = 1u<<4u | 1u<<5u, 143 CSTAT_SPRITE_ALIGNMENT_SLOPE = 1u<<4u | 1u<<5u, 144 145 CSTAT_SPRITE_ALIGNMENT_MASK = 1u<<4u | 1u<<5u, 146 }; 147 148 enum 149 { 150 CSTAT_WALL_BLOCK = 1u, 151 CSTAT_WALL_BOTTOM_SWAP = 1u<<1u, 152 CSTAT_WALL_ALIGN_BOTTOM = 1u<<2u, 153 CSTAT_WALL_XFLIP = 1u<<3u, 154 CSTAT_WALL_MASKED = 1u<<4u, 155 CSTAT_WALL_1WAY = 1u<<5u, 156 CSTAT_WALL_BLOCK_HITSCAN = 1u<<6u, 157 CSTAT_WALL_TRANSLUCENT = 1u<<7u, 158 CSTAT_WALL_YFLIP = 1u<<8u, 159 CSTAT_WALL_TRANS_FLIP = 1u<<9u, 160 161 CSTAT_WALL_YAX_UPWALL = 1u<<10u, // EDuke32 extension 162 CSTAT_WALL_YAX_DOWNWALL = 1u<<11u, // EDuke32 extension 163 CSTAT_WALL_ROTATE_90 = 1u<<12u, // EDuke32 extension 164 165 CSTAT_WALL_RESERVED1 = 1u<<13u, 166 CSTAT_WALL_RESERVED2 = 1u<<14u, // used by Shadow Warrior, Blood 167 CSTAT_WALL_RESERVED3 = 1u<<15u, // used by Shadow Warrior, Blood 168 }; 169 #endif 170 171 //44 bytes 172 typedef struct 173 { 174 union { 175 struct 176 { 177 StructTracker(Sprite, int32_t) x, y, z; 178 }; 179 vec3_t pos; 180 }; 181 StructTracker(Sprite, uint16_t) cstat; 182 StructTracker(Sprite, int16_t) picnum; 183 StructTracker(Sprite, int8_t) shade; 184 StructTracker(Sprite, uint8_t) pal, clipdist, blend; 185 StructTracker(Sprite, uint8_t) xrepeat, yrepeat; 186 StructTracker(Sprite, int8_t) xoffset, yoffset; 187 StructTracker(Sprite, int16_t) sectnum, statnum; 188 StructTracker(Sprite, int16_t) ang, owner; 189 union { 190 struct 191 { 192 union { 193 StructTracker(Sprite, int16_t) xvel, index; 194 }; 195 StructTracker(Sprite, int16_t) yvel; 196 union { 197 StructTracker(Sprite, int16_t) zvel, inittype; 198 }; 199 }; 200 vec3_16_t vel; 201 }; 202 union { 203 StructTracker(Sprite, int16_t) lotag, type; 204 }; 205 union { 206 StructTracker(Sprite, int16_t) hitag, flags; 207 }; 208 StructTracker(Sprite, int16_t) extra; 209 } StructName(spritetypev7); 210 211 #ifndef buildtypes_h__enums 212 //44 bytes 213 // TODO: Remove unused fields from the end of this struct. (TSPRITE_SIZE) 214 typedef struct 215 { 216 union { 217 struct 218 { 219 int32_t x, y, z; 220 }; 221 vec3_t pos; 222 }; 223 uint16_t cstat; 224 int16_t picnum; 225 int8_t shade; 226 uint8_t pal, clipdist, blend; 227 uint8_t xrepeat, yrepeat; 228 int8_t xoffset, yoffset; 229 int16_t sectnum, statnum; 230 int16_t ang, owner; 231 union { 232 struct 233 { 234 union { 235 int16_t xvel, index; 236 }; 237 int16_t yvel; 238 union { 239 int16_t zvel, inittype; 240 }; 241 }; 242 vec3_16_t vel; 243 }; 244 union { 245 int16_t lotag, type; 246 }; 247 union { 248 int16_t hitag, flags; 249 }; 250 int16_t extra; 251 } tspritetype; 252 #endif 253 254 //////////////////// END Version 7 map format //////////////// 255 256 //////////////////// Lunatic new-generation map format //////////////////// 257 #if defined NEW_MAP_FORMAT 258 // 44 bytes 259 typedef struct 260 { 261 StructTracker(Sector, int16_t) wallptr, wallnum; 262 263 StructTracker(Sector, int16_t) ceilingpicnum, ceilingheinum, ceilingbunch; 264 StructTracker(Sector, uint16_t) ceilingstat; 265 StructTracker(Sector, int32_t) ceilingz; 266 StructTracker(Sector, int8_t) ceilingshade; 267 StructTracker(Sector, uint8_t) ceilingpal, /*CM_FLOORZ:*/ ceilingxpanning, ceilingypanning; 268 269 StructTracker(Sector, int16_t) floorpicnum, floorheinum, floorbunch; 270 StructTracker(Sector, uint16_t) floorstat; 271 StructTracker(Sector, int32_t) floorz; 272 StructTracker(Sector, int8_t) floorshade; 273 StructTracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning; 274 275 StructTracker(Sector, uint8_t) /*CM_CEILINGZ:*/ visibility, fogpal; 276 StructTracker(Sector, int16_t) lotag, hitag; 277 StructTracker(Sector, int16_t) extra; 278 } StructName(sectortypevx); 279 280 // 38 bytes 281 typedef struct 282 { 283 union { 284 struct 285 { 286 StructTracker(Wall, int32_t) x, y; 287 }; 288 vec2_t pos; 289 }; 290 StructTracker(Wall, int16_t) point2, nextwall, nextsector; 291 StructTracker(Wall, int16_t) upwall, dnwall; 292 StructTracker(Wall, uint16_t) cstat; 293 StructTracker(Wall, int16_t) picnum, overpicnum; 294 StructTracker(Wall, int8_t) shade; 295 StructTracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning; 296 StructTracker(Wall, int16_t) lotag, hitag; 297 StructTracker(Wall, int16_t) extra; 298 StructTracker(Wall, uint8_t) blend, filler_; 299 } StructName(walltypevx); 300 #endif 301 // NOTE: spritetype is currently the same for V7/8/9 and VX in-memory map formats. 302 303 //////////////////// END Lunatic new-generation map format //////////////// 304 305 #undef StructTracker 306 #undef StructName 307 308 #ifndef buildtypes_h__enums 309 #define buildtypes_h__enums 310 #endif 311 312 #endif // buildtypes_h__ 313