#include #include #include #include #include "db.h" #include "engine.h" #include "error.h" #include /*********************************************************************** * ImportBuildMap() * **********************************************************************/ int ImportBuildMap( char *filename, long *daposx, long *daposy, long *daposz, short *daang, short *dacursectnum ) { int fil; short int i, numsprites; long mapversion; if ((fil = open(filename,O_BINARY|O_RDWR,S_IREAD)) == -1) { mapversion = 6L; return -1; } read(fil,&mapversion,4); if (mapversion != 6L) return -1; *gMapName = '\0'; *gMapAuthor = '\0'; gSkyCount = 1; pskyoff[0] = 0; dbInit(); // calls initspritelists() too! memset(show2dsprite, 0, sizeof(show2dsprite)); memset(show2dwall, 0, sizeof(show2dwall)); read(fil,daposx,4); read(fil,daposy,4); read(fil,daposz,4); read(fil,daang,2); read(fil,dacursectnum,2); read(fil,&numsectors,2); read(fil,sector,sizeof(SECTOR)*numsectors); read(fil,&numwalls,2); read(fil,wall,sizeof(WALL)*numwalls); read(fil,&numsprites,2); read(fil,sprite,sizeof(SPRITE)*numsprites); for( i=0; i 0 ) { nXSector = sector[nSector].extra; dassert(nXSector < kMaxXSectors); } else { nXSector = GetXSector(nSector); dassert(nXSector < kMaxXSectors); } // fill the extra here... } } #endif