void WriteWad (int wad3) { wadinfo_t header; int ofs; // write the lumpingo ofs = ftell(outwad); SafeWrite (outwad, outinfo, outlumps*sizeof(lumpinfo_t) ); // write the header // a program will be able to tell the ednieness of a wad by the id header.identification[0] = 'W'; header.identification[1] = 'A'; header.identification[2] = 'D'; header.identification[3] = wad3 ? '3' : '2'; header.numlumps = wadlong(outlumps); header.infotableofs = wadlong(ofs); fseek (outwad, 0, SEEK_SET); SafeWrite (outwad, &header, sizeof(header)); fclose (outwad); }
void WriteWad (int wad3) { wadinfo_t header; int ofs; // write the lumpingo ofs = ftell(outwad); SafeWrite (outwad, outinfo, outlumps*sizeof(lumpinfo_t) ); // write the header // a program will be able to tell the ednieness of a wad by the id ID_TO_STRING( WAD_ID, header.identification ); header.numlumps = wadlong(outlumps); header.infotableofs = wadlong(ofs); fseek (outwad, 0, SEEK_SET); SafeWrite (outwad, &header, sizeof(header)); fclose (outwad); }
void AddLump (char *name, void *buffer, int length, int type, int compress) { lumpinfo_t *info; int ofs; info = &outinfo[outlumps]; outlumps++; memset (info,0,sizeof(info)); strcpy (info->name, name); strupr (info->name); ofs = ftell(outwad); info->filepos = wadlong(ofs); info->size = info->disksize = wadlong(length); info->type = type; info->compression = compress; // FIXME: do compression SafeWrite (outwad, buffer, length); }