1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 03_wad_level_lumps.dpatch by Darren Salt <linux@youmustbejoking.demon.co.uk>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Don't assume a particular order for map data lumps.
6
## DP: (Fixes handling of a wad provided by Jon Dowland.)
9
--- glbsp-2.20.orig/wad.c
12
static void DetermineLevelNames(void)
18
for (L=wad.dir_head; L; L=L->next)
20
+ // check that the current lump's name doesn't match any level lump name.
22
+ for (j=0; j<NUM_LEVEL_LUMPS; ++j)
23
+ if (strcmp(L->name, level_lumps[j]) == 0)
25
+ if (j < NUM_LEVEL_LUMPS)
28
// check if the next four lumps after the current lump match the
29
- // level-lump names.
30
+ // level-lump names (order doesn't matter, but repeated names do)
33
for (i=0, N=L->next; (i < 4) && N; i++, N=N->next)
34
- if (strcmp(N->name, level_lumps[i]) != 0)
36
+ for (j=0; j<NUM_LEVEL_LUMPS; ++j)
37
+ if ((~matched & 1<<j) && strcmp(N->name, level_lumps[j]) == 0)
42
+ if (j == NUM_LEVEL_LUMPS)