mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
Fix the interaction between the definitions of the NEW_MAP_FORMAT structs and the structure trackers.
git-svn-id: https://svn.eduke32.com/eduke32@5999 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d67b3edd06
commit
93edc7a241
3 changed files with 64 additions and 61 deletions
|
@ -300,45 +300,32 @@ enum {
|
|||
SPR_ALIGN_MASK = 32+16,
|
||||
};
|
||||
|
||||
#if !defined NEW_MAP_FORMAT
|
||||
#include "buildtypes.h"
|
||||
#define UNTRACKED_STRUCTS
|
||||
#undef buildtypes_h__
|
||||
#include "buildtypes.h"
|
||||
#undef UNTRACKED_STRUCTS
|
||||
|
||||
#if !defined NEW_MAP_FORMAT
|
||||
typedef sectortypev7 sectortype;
|
||||
typedef usectortypev7 usectortype;
|
||||
|
||||
typedef walltypev7 walltype;
|
||||
typedef uwalltypev7 uwalltype;
|
||||
#else
|
||||
typedef sectortypevx sectortype;
|
||||
typedef usectortypevx usectortype;
|
||||
|
||||
typedef walltypevx walltype;
|
||||
typedef uwalltypevx uwalltype;
|
||||
#endif
|
||||
|
||||
#ifdef NEW_MAP_FORMAT
|
||||
//////////////////// Lunatic new-generation map format ////////////////////
|
||||
|
||||
#include "buildtypes.h"
|
||||
|
||||
// 44 bytes
|
||||
typedef struct
|
||||
{
|
||||
Tracker(Sector, int16_t) wallptr, wallnum;
|
||||
|
||||
Tracker(Sector, int16_t) ceilingpicnum, ceilingheinum, ceilingbunch;
|
||||
Tracker(Sector, uint16_t) ceilingstat;
|
||||
Tracker(Sector, int32_t) ceilingz;
|
||||
Tracker(Sector, int8_t) ceilingshade;
|
||||
Tracker(Sector, uint8_t) ceilingpal, /*CM_FLOORZ:*/ ceilingxpanning, ceilingypanning;
|
||||
|
||||
Tracker(Sector, int16_t) floorpicnum, floorheinum, floorbunch;
|
||||
Tracker(Sector, uint16_t) floorstat;
|
||||
Tracker(Sector, int32_t) floorz;
|
||||
Tracker(Sector, int8_t) floorshade;
|
||||
Tracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning;
|
||||
|
||||
Tracker(Sector, uint8_t) /*CM_CEILINGZ:*/ visibility, fogpal;
|
||||
Tracker(Sector, uint16_t) lotag, hitag;
|
||||
Tracker(Sector, int16_t) extra;
|
||||
} sectortypevx;
|
||||
|
||||
# define SECTORVX_SZ1 offsetof(sectortypevx, ceilingpicnum)
|
||||
# define SECTORVX_SZ4 sizeof(sectortypevx)-offsetof(sectortypevx, visibility)
|
||||
|
||||
static inline void copy_v7_from_vx_sector(sectortypev7 *v7sec, const sectortypevx *vxsec)
|
||||
static inline void copy_v7_from_vx_sector(usectortypev7 *v7sec, const sectortypevx *vxsec)
|
||||
{
|
||||
/* [wallptr..wallnum] */
|
||||
Bmemcpy(v7sec, vxsec, SECTORVX_SZ1);
|
||||
|
@ -375,7 +362,7 @@ static inline void copy_v7_from_vx_sector(sectortypev7 *v7sec, const sectortypev
|
|||
static inline void inplace_vx_from_v7_sector(sectortypevx *vxsec)
|
||||
{
|
||||
const sectortypev7 *v7sec = (sectortypev7 *)vxsec;
|
||||
sectortypev7 bakv7sec;
|
||||
usectortypev7 bakv7sec;
|
||||
|
||||
// Can't do this in-place since the members were rearranged.
|
||||
Bmemcpy(&bakv7sec, v7sec, sizeof(sectortypev7));
|
||||
|
@ -434,24 +421,9 @@ static inline void inplace_vx_tweak_sector(sectortypevx *vxsec, int32_t yaxp)
|
|||
# undef SECTORVX_SZ1
|
||||
# undef SECTORVX_SZ4
|
||||
|
||||
// 38 bytes
|
||||
typedef struct
|
||||
{
|
||||
Tracker(Wall, int32_t) x, y;
|
||||
Tracker(Wall, int16_t) point2, nextwall, nextsector;
|
||||
Tracker(Wall, int16_t) upwall, dnwall;
|
||||
Tracker(Wall, uint16_t) cstat;
|
||||
Tracker(Wall, int16_t) picnum, overpicnum;
|
||||
Tracker(Wall, int8_t) shade;
|
||||
Tracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning;
|
||||
Tracker(Wall, uint16_t) lotag, hitag;
|
||||
Tracker(Wall, int16_t) extra;
|
||||
Tracker(Wall, uint8_t) blend, filler_;
|
||||
} walltypevx;
|
||||
|
||||
# define WALLVX_SZ2 offsetof(walltypevx, blend)-offsetof(walltypevx, cstat)
|
||||
|
||||
static inline void copy_v7_from_vx_wall(walltypev7 *v7wal, const walltypevx *vxwal)
|
||||
static inline void copy_v7_from_vx_wall(uwalltypev7 *v7wal, const walltypevx *vxwal)
|
||||
{
|
||||
/* [x..nextsector] */
|
||||
Bmemcpy(v7wal, vxwal, offsetof(walltypevx, upwall));
|
||||
|
@ -497,18 +469,6 @@ static inline void inplace_vx_tweak_wall(walltypevx *vxwal, int32_t yaxp)
|
|||
|
||||
# undef WALLVX_SZ2
|
||||
|
||||
// NOTE: spritetype is currently the same for V7/8/9 and VX in-memory map formats.
|
||||
|
||||
typedef sectortypevx sectortype;
|
||||
typedef walltypevx walltype;
|
||||
|
||||
typedef sectortype usectortype;
|
||||
typedef walltype uwalltype;
|
||||
typedef spritetype uspritetype;
|
||||
//////////////////// END Lunatic new-generation map format ////////////////
|
||||
#else
|
||||
typedef sectortypev7 sectortype;
|
||||
typedef walltypev7 walltype;
|
||||
#endif
|
||||
|
||||
#include "clip.h"
|
||||
|
|
|
@ -120,6 +120,49 @@ typedef struct
|
|||
|
||||
//////////////////// END Version 7 map format ////////////////
|
||||
|
||||
//////////////////// Lunatic new-generation map format ////////////////////
|
||||
|
||||
// 44 bytes
|
||||
typedef struct
|
||||
{
|
||||
StructTracker(Sector, int16_t) wallptr, wallnum;
|
||||
|
||||
StructTracker(Sector, int16_t) ceilingpicnum, ceilingheinum, ceilingbunch;
|
||||
StructTracker(Sector, uint16_t) ceilingstat;
|
||||
StructTracker(Sector, int32_t) ceilingz;
|
||||
StructTracker(Sector, int8_t) ceilingshade;
|
||||
StructTracker(Sector, uint8_t) ceilingpal, /*CM_FLOORZ:*/ ceilingxpanning, ceilingypanning;
|
||||
|
||||
StructTracker(Sector, int16_t) floorpicnum, floorheinum, floorbunch;
|
||||
StructTracker(Sector, uint16_t) floorstat;
|
||||
StructTracker(Sector, int32_t) floorz;
|
||||
StructTracker(Sector, int8_t) floorshade;
|
||||
StructTracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning;
|
||||
|
||||
StructTracker(Sector, uint8_t) /*CM_CEILINGZ:*/ visibility, fogpal;
|
||||
StructTracker(Sector, uint16_t) lotag, hitag;
|
||||
StructTracker(Sector, int16_t) extra;
|
||||
} StructName(sectortypevx);
|
||||
|
||||
// 38 bytes
|
||||
typedef struct
|
||||
{
|
||||
StructTracker(Wall, int32_t) x, y;
|
||||
StructTracker(Wall, int16_t) point2, nextwall, nextsector;
|
||||
StructTracker(Wall, int16_t) upwall, dnwall;
|
||||
StructTracker(Wall, uint16_t) cstat;
|
||||
StructTracker(Wall, int16_t) picnum, overpicnum;
|
||||
StructTracker(Wall, int8_t) shade;
|
||||
StructTracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning;
|
||||
StructTracker(Wall, uint16_t) lotag, hitag;
|
||||
StructTracker(Wall, int16_t) extra;
|
||||
StructTracker(Wall, uint8_t) blend, filler_;
|
||||
} StructName(walltypevx);
|
||||
|
||||
// NOTE: spritetype is currently the same for V7/8/9 and VX in-memory map formats.
|
||||
|
||||
//////////////////// END Lunatic new-generation map format ////////////////
|
||||
|
||||
#undef StructTracker
|
||||
#undef StructName
|
||||
|
||||
|
|
|
@ -9595,8 +9595,8 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
|
|||
|
||||
while (1) // if, really
|
||||
{
|
||||
sectortypev7 *const tsect = (sectortypev7 *)Xmalloc(sizeof(sectortypev7) * numsectors);
|
||||
walltypev7 *twall;
|
||||
usectortypev7 *const tsect = (usectortypev7 *)Xmalloc(sizeof(usectortypev7) * numsectors);
|
||||
uwalltypev7 *twall;
|
||||
|
||||
#ifdef NEW_MAP_FORMAT
|
||||
for (i=0; i<numsectors; i++)
|
||||
|
@ -9607,7 +9607,7 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
|
|||
|
||||
for (i=0; i<numsectors; i++)
|
||||
{
|
||||
sectortypev7 *const sec = &tsect[i];
|
||||
usectortypev7 *const sec = &tsect[i];
|
||||
|
||||
sec->wallptr = B_LITTLE16(sec->wallptr);
|
||||
sec->wallnum = B_LITTLE16(sec->wallnum);
|
||||
|
@ -9641,7 +9641,7 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
|
|||
ts = B_LITTLE16(numwalls);
|
||||
Bwrite(fil,&ts,2);
|
||||
|
||||
twall = (walltypev7 *)Xmalloc(sizeof(walltypev7) * numwalls);
|
||||
twall = (uwalltypev7 *)Xmalloc(sizeof(uwalltypev7) * numwalls);
|
||||
|
||||
#ifdef NEW_MAP_FORMAT
|
||||
for (i=0; i<numwalls; i++)
|
||||
|
@ -9652,7 +9652,7 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
|
|||
|
||||
for (i=0; i<numwalls; i++)
|
||||
{
|
||||
walltypev7 *const wal = &twall[i];
|
||||
uwalltypev7 *const wal = &twall[i];
|
||||
|
||||
wal->x = B_LITTLE32(wal->x);
|
||||
wal->y = B_LITTLE32(wal->y);
|
||||
|
|
Loading…
Reference in a new issue