// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman // Ken Silverman's official web site: "http://www.advsys.net/ken" // See the included license file "BUILDLIC.TXT" for license info. //These changes are from version 5 to version 6 //Remember that this is backwards from what this program does! // //Added wall[].pal, sprite[].pal //Added sprite[].clipdist //Expanded sprite[].cstat to a short //Added sprite[].xoffset, sprite[].yoffset //Removed wall[].nextsector2, wall[].nextwall2 //Renamed wall[].nextsector1 to just wall[].nextsector //Renamed wall[].nextwall1 to just wall[].nextwall //Scrapped numextras and extratype structure - Don't confuse this with // sector[].extra, wall[].extra, sprite[].extra which ARE in map version 6. #include #include #include #include #include #define NEWMAPVERSION 5 #define MAXMENUFILES 1024 #define MAXSECTORS 1024 #define MAXWALLS 4096 #define MAXSPRITES 4096 #define MAXSTATUS 1024 #define MAXTILES 4096 static char menuname[MAXMENUFILES][32]; static long menunamecnt; #pragma pack(push,1); static struct newsectortype { short unsigned int wallptr, wallnum; short ceilingpicnum, floorpicnum; short ceilingheinum, floorheinum; long ceilingz, floorz; signed char ceilingshade, floorshade; char ceilingxpanning, floorxpanning; char ceilingypanning, floorypanning; char ceilingstat, floorstat; char ceilingpal, floorpal; char visibility; short lotag, hitag; short extra; }; static struct newwalltype { long x, y; short point2; short picnum, overpicnum; signed char shade; short cstat; unsigned char xrepeat, yrepeat, xpanning, ypanning; short nextsector1, nextwall1; short nextsector2, nextwall2; short lotag, hitag; short extra; }; static struct newspritetype { long x, y, z; char cstat; signed char shade; unsigned char xrepeat, yrepeat; short picnum, ang, xvel, yvel, zvel, owner; short sectnum, statnum; short lotag, hitag; short extra; }; static struct sectortype { unsigned short wallptr, wallnum; short ceilingpicnum, floorpicnum; short ceilingheinum, floorheinum; long ceilingz, floorz; signed char ceilingshade, floorshade; char ceilingxpanning, floorxpanning; char ceilingypanning, floorypanning; char ceilingstat, floorstat; char ceilingpal, floorpal; char visibility; short lotag, hitag, extra; }; static struct walltype { long x, y; short point2, nextsector, nextwall; short picnum, overpicnum; signed char shade; char pal; short cstat; unsigned char xrepeat, yrepeat, xpanning, ypanning; short lotag, hitag, extra; }; static struct spritetype { long x, y, z; short cstat; signed char shade; char pal, clipdist; unsigned char xrepeat, yrepeat; signed char xoffset, yoffset; short picnum, ang, xvel, yvel, zvel, owner; short sectnum, statnum; short lotag, hitag, extra; }; #pragma pack(pop); //************************************************************************** static struct sectortype sector[MAXSECTORS]; static struct walltype wall[MAXWALLS]; static struct spritetype sprite[MAXSPRITES]; static struct newsectortype newsector[MAXSECTORS]; static struct newwalltype newwall[MAXWALLS]; static struct newspritetype newsprite[MAXSPRITES]; static long posx, posy, posz, mapversion; static short ang, cursectnum, numsectors, numwalls, numsprites; main(int argc, char **argv) { long i; if (argc != 2) { printf("BACKMAP%ld [filespec] by Ken Silverman\n",NEWMAPVERSION); printf("This BACKMAP%ld.EXE converts map version %ld to map version %ld\n",NEWMAPVERSION,NEWMAPVERSION+1,NEWMAPVERSION); exit(0); } menunamecnt = 0; getfilenames(argv[1]); sortfilenames(); if (menunamecnt == 0) { printf("BACKMAP%ld [filespec] by Ken Silverman\n",NEWMAPVERSION); printf("This BACKMAP%ld.EXE converts map version %ld to map version %ld\n",NEWMAPVERSION,NEWMAPVERSION+1,NEWMAPVERSION); printf("File not found\n"); exit(0); } printf("Converting map version %ld to map version %ld\n",NEWMAPVERSION+1,NEWMAPVERSION); for(i=0;i 0)) if ((fileinfo.name[0] != '.') || (fileinfo.name[1] != 0)) { if (menunamecnt < MAXMENUFILES) { strcpy(menuname[menunamecnt],fileinfo.name); menuname[menunamecnt][16] = type; menunamecnt++; } //else // printmessage("Too many files! (max=MAXMENUFILES)"); } } while (_dos_findnext(&fileinfo) == 0); return(0); } sortfilenames() { char sortbuffer[32]; long i, j, k, m; for(i=1;i