1 /*
2     LumpMod v0.2.1, a command-line utility for working with lumps in wad
3                     files.
4     Copyright (C) 2003 Thunder Palace Entertainment.
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 
20     lump.h: Defines constants, structures, and functions used in lump.c
21 */
22 
23 #ifndef __LUMP_H
24 #define __LUMP_H
25 
26 /* Entries in the wadfile directory are 16 bytes */
27 #define DIRENTRYLEN 16
28 
29 /* Lumps and associated info */
30 struct lump {
31     long len;
32     unsigned char *data;
33     char name[8];
34 };
35 
36 /* Linked list of lumps */
37 struct lumplist {
38     struct lump *cl;        /* actual content of the lump */
39     struct lumplist *next;
40 };
41 
42 /* Structure to contain all wadfile data */
43 struct wadfile {
44     char id[4];             /* IWAD or PWAD */
45     long numlumps;          /* 32-bit integer */
46     struct lumplist *head;  /* points to first entry */
47 };
48 
49 /* Function declarations */
50 struct wadfile *read_wadfile(FILE *);
51 void free_wadfile(struct wadfile *);
52 int write_wadfile(FILE *, struct wadfile *);
53 char *get_lump_name(struct lump *);
54 struct lumplist *find_previous_lump(struct lumplist *, struct lumplist *, char *);
55 void remove_next_lump(struct wadfile *, struct lumplist *);
56 int add_lump(struct wadfile *, struct lumplist *, char *, long, unsigned char *);
57 int rename_lump(struct lump *, char *);
58 struct lumplist *find_last_lump(struct wadfile *);
59 struct lumplist *find_last_lump_between(struct lumplist *, struct lumplist *);
60 struct lumplist *find_next_section_lump(struct lumplist *);
61 
62 #endif
63