// Merge in a file by name boolean W_MergeFile(char *filename) { int old_numlumps; old_numlumps = numlumps; // Load PWAD if (W_AddFile(filename) == NULL) return false; // IWAD is at the start, PWAD was appended to the end iwad.lumps = lumpinfo; iwad.numlumps = old_numlumps; pwad.lumps = lumpinfo + old_numlumps; pwad.numlumps = numlumps - old_numlumps; // Setup sprite/flat lists SetupLists(); // Generate list of sprites to be replaced by the PWAD GenerateSpriteList(); // Perform the merge DoMerge(); return true; }
void W_NWTDashMerge(char *filename) { wad_file_t *wad_file; int old_numlumps; int i; old_numlumps = numlumps; // Load PWAD wad_file = W_AddFile(filename); if (wad_file == NULL) { return; } // IWAD is at the start, PWAD was appended to the end iwad.lumps = lumpinfo; iwad.numlumps = old_numlumps; pwad.lumps = lumpinfo + old_numlumps; pwad.numlumps = numlumps - old_numlumps; // Setup sprite/flat lists SetupLists(); // Search through the IWAD sprites list. for (i=0; i<iwad_sprites.numlumps; ++i) { if (FindInList(&pwad, iwad_sprites.lumps[i]->name) >= 0) { // Replace this entry with an empty string. This is what // nwt -merge does. M_StringCopy(iwad_sprites.lumps[i]->name, "", 8); } } // Discard PWAD // The PWAD must now be added in again with -file. numlumps = old_numlumps; W_CloseFile(wad_file); }
void W_NWTMergeFile(char *filename, int flags) { int old_numlumps; old_numlumps = numlumps; // Load PWAD if (W_AddFile(filename) == NULL) return; // IWAD is at the start, PWAD was appended to the end iwad.lumps = lumpinfo; iwad.numlumps = old_numlumps; pwad.lumps = lumpinfo + old_numlumps; pwad.numlumps = numlumps - old_numlumps; // Setup sprite/flat lists SetupLists(); // Merge in flats? if (flags & W_NWT_MERGE_FLATS) { W_NWTAddLumps(&iwad_flats); } // Sprites? if (flags & W_NWT_MERGE_SPRITES) { W_NWTAddLumps(&iwad_sprites); } // Discard the PWAD numlumps = old_numlumps; }