remove UMAPDEF (#2093)

This commit is contained in:
Roman Fomin 2024-12-17 16:50:28 +07:00 committed by GitHub
parent f07688a73d
commit 3f41e8f14d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 35 additions and 457 deletions

View File

@ -165,7 +165,6 @@ jobs:
--inconclusive \
--inline-suppr \
--std=c99 \
--suppress="memleak:${{ github.workspace }}/src/u_scanner.c" \
--project="${{ github.workspace }}/build/compile_commands.json" \
-i"${{ github.workspace }}/third-party" \
-D__GNUC__

View File

@ -199,18 +199,18 @@ set(BASE_SOURCES
all-all/sprites/pls2e0.png
all-all/sprites/tnt1a0.png
betalevl.wad/umapdef.lmp
betalevl.wad/umapinfo.lmp
chex.wad/brghtmps.lmp
chex.wad/dehacked.lmp
chex.wad/umapdef.lmp
chex.wad/umapinfo.lmp
chex2.wad/brghtmps.lmp
doom-all/brghtmps.lmp
e1m4b.wad/umapdef.lmp
e1m8b.wad/umapdef.lmp
e1m4b.wad/umapinfo.lmp
e1m8b.wad/umapinfo.lmp
extras.wad/sbardef.lmp
@ -219,16 +219,10 @@ set(BASE_SOURCES
id1.wad/sbardef.lmp
masterlevels.wad/umapdef.lmp
nerve.wad/umapdef.lmp
rekkr.wad/dehacked.lmp
rekkrsa.wad/dehacked.lmp
rekkrsl.wad/dehacked.lmp
sigil_v1_21.wad/umapdef.lmp
tnt.wad/brghtmps.lmp)
add_custom_command(OUTPUT "${BASE_PK3_PATH}"

View File

@ -1,162 +0,0 @@
map MAP01
{
levelname = "Attack"
levelpic = "CWILV00"
}
map MAP02
{
levelname = "Canyon"
levelpic = "CWILV01"
}
map MAP03
{
levelname = "The Catwalk"
levelpic = "CWILV02"
}
map MAP04
{
levelname = "The Combine"
levelpic = "CWILV03"
}
map MAP05
{
levelname = "The Fistula"
levelpic = "CWILV04"
}
map MAP06
{
levelname = "The Garrison"
levelpic = "CWILV05"
intertext = clear
}
map MAP07
{
levelname = "Titan Manor"
levelpic = "CWILV06"
}
map MAP08
{
levelname = "Paradox"
levelpic = "CWILV07"
}
map MAP09
{
levelname = "Subspace"
levelpic = "CWILV08"
}
map MAP10
{
levelname = "Subterra"
levelpic = "CWILV09"
}
map MAP11
{
levelname = "Trapped On Titan"
levelpic = "CWILV10"
intertext = clear
}
map MAP12
{
levelname = "Virgil's Lead"
levelpic = "CWILV11"
}
map MAP13
{
levelname = "Minos' Judgement"
levelpic = "CWILV12"
}
map MAP14
{
levelname = "Bloodsea Keep"
levelpic = "CWILV13"
bossaction = Fatso, 23, 666
bossaction = Arachnotron, 30, 667
}
map MAP15
{
levelname = "Mephisto's Maosoleum"
levelpic = "CWILV14"
bossaction = Fatso, 23, 666
bossaction = Arachnotron, 30, 667
}
map MAP16
{
levelname = "Nessus"
levelpic = "CWILV15"
bossaction = Fatso, 23, 666
bossaction = Arachnotron, 30, 667
}
map MAP17
{
levelname = "Geryon"
levelpic = "CWILV16"
}
map MAP18
{
levelname = "Vesperas"
levelpic = "CWILV17"
}
map MAP19
{
levelname = "Black Tower"
levelpic = "CWILV18"
}
map MAP20
{
levelname = "The Express Elevator To Hell"
levelpic = "CWILV19"
nextsecret = "MAP21"
intertextsecret = clear
endcast = true
intertext = "CONGRATULATIONS YOU HAVE FINISHED... ",
"",
"MOST OF THE MASTER LEVELS",
"",
"You have ventured through the most",
"twisted levels that hell had to",
"offer and you have survived. ",
"",
"But alas the demons laugh at you",
"since you have shown cowardice and didn't",
"reach the most hideous level",
"they had made for you."
}
map MAP21
{
levelname = "Bad Dream"
levelpic = "CWILV20"
endcast = true
intertext = "CONGRATULATIONS YOU HAVE FINISHED... ",
"",
"ALL THE MASTER LEVELS",
"",
"You have ventured through all the",
"twisted levels that hell had to",
"offer and you have survived. ",
"",
"The Flames of rage flow through",
"your veins, you are ready",
"for more - but you don't know where",
"to find more when the demons hide",
"like cowards when they see you."
}

View File

@ -1,111 +0,0 @@
map MAP01
{
levelname = "The Earth Base"
label = "Level 1"
levelpic = "CWILV00"
music = "D_MESSAG"
skytexture = "SKY1"
partime = 75
}
map MAP02
{
levelname = "The Pain Labs"
label = "Level 2"
levelpic = "CWILV01"
music = "D_DDTBLU"
skytexture = "SKY1"
partime = 105
}
map MAP03
{
levelname = "Canyon of the Dead"
label = "Level 3"
levelpic = "CWILV02"
music = "D_DOOM"
skytexture = "SKY1"
partime = 120
}
map MAP04
{
levelname = "Hell Mountain"
label = "Level 4"
levelpic = "CWILV03"
music = "D_SHAWN"
nextsecret = "map09"
skytexture = "SKY3"
partime = 105
}
map MAP05
{
levelname = "Vivisection"
label = "Level 5"
levelpic = "CWILV04"
music = "D_IN_CIT"
skytexture = "SKY3"
partime = 210
}
map MAP06
{
levelname = "Inferno of Blood"
label = "Level 6"
levelpic = "CWILV05"
music = "D_THE_DA"
skytexture = "SKY3"
partime = 105
intertext = clear
}
map MAP07
{
levelname = "Baron's Banquet"
label = "Level 7"
levelpic = "CWILV06"
music = "D_IN_CIT"
skytexture = "SKY3"
partime = 165
}
map MAP08
{
levelname = "Tomb of Malevolence"
label = "Level 8"
levelpic = "CWILV07"
music = "D_SHAWN"
skytexture = "SKY3"
partime = 105
endcast = true
intertext = "TROUBLE WAS BREWING AGAIN IN YOUR FAVORITE",
"VACATION SPOT... HELL. SOME CYBERDEMON",
"PUNK THOUGHT HE COULD TURN HELL INTO A",
"PERSONAL AMUSEMENT PARK, AND MAKE EARTH",
"THE TICKET BOOTH.",
"",
"WELL THAT HALF-ROBOT FREAK SHOW DIDN'T",
"KNOW WHO WAS COMING TO THE FAIR. THERE'S",
"NOTHING LIKE A SHOOTING GALLERY FULL OF",
"HELLSPAWN TO GET THE BLOOD PUMPING...",
"",
"NOW THE WALLS OF THE DEMON'S LABYRINTH",
"ECHO WITH THE SOUND OF HIS METALLIC LIMBS",
"HITTING THE FLOOR. HIS DEATH MOAN GURGLES",
"OUT THROUGH THE MESS YOU LEFT OF HIS FACE.",
"",
"THIS RIDE IS CLOSED."
interbackdrop = "SLIME16"
}
map MAP09
{
levelname = "March of the Demons"
label = "Level 9"
levelpic = "CWILV08"
music = "D_DDTBLU"
next = "map05"
skytexture = "SKY1"
partime = 135
}

View File

@ -1,4 +0,0 @@
map E5M8
{
bossaction = clear
}

View File

@ -2365,8 +2365,6 @@ void D_DoomMain(void)
I_Error("\nThis is not the registered version.");
}
W_ProcessInWads("UMAPDEF", U_ParseMapDefInfo, PROCESS_PWAD);
//!
// @category mod
//

View File

@ -3851,23 +3851,16 @@ void G_SetFastParms(int fast_pending)
mapentry_t *G_LookupMapinfo(int episode, int map)
{
char lumpname[9];
strcpy(lumpname, MapName(episode, map));
char lumpname[9] = {0};
M_StringCopy(lumpname, MapName(episode, map), sizeof(lumpname));
mapentry_t *entry;
array_foreach(entry, umapinfo)
{
if (!strcasecmp(lumpname, entry->mapname))
return entry;
}
array_foreach(entry, umapdef)
{
if (!strcasecmp(lumpname, entry->mapname))
return entry;
}
return NULL;
}

View File

@ -27,6 +27,9 @@
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
#ifndef M_SCANNER_H
#define M_SCANNER_H
#include "doomtype.h"
typedef struct scanner_s scanner_t;
@ -69,3 +72,5 @@ void SC_Rewind(scanner_t *s); // Only can rewind one step.
void SC_GetNextTokenLumpName(scanner_t *s);
void SC_Error(scanner_t *s, const char *msg, ...) PRINTF_ATTR(2, 3);
#endif

View File

@ -646,7 +646,7 @@ void ST_ResetTitle(void)
announce_string[0] = '\0';
if (hud_map_announce && leveltime == 0)
{
if (gamemapinfo && U_CheckField(gamemapinfo->author))
if (gamemapinfo && gamemapinfo->author)
{
M_snprintf(announce_string, sizeof(announce_string), "%s by %s",
string, gamemapinfo->author);

View File

@ -177,12 +177,17 @@ static const char *const actor_names[] =
"Deh_Actor_249", // Extra thing 99
};
static void FreeMap(mapentry_t *mape)
static void ReplaceString(char **to, const char *from)
{
if (mape->mapname)
if (*to != NULL)
{
free(mape->mapname);
free(*to);
}
*to = M_StringDuplicate(from);
}
static void FreeMapEntry(mapentry_t *mape)
{
if (mape->levelname)
{
free(mape->levelname);
@ -203,114 +208,13 @@ static void FreeMap(mapentry_t *mape)
{
free(mape->author);
}
array_free(mape->bossactions);
memset(mape, 0, sizeof(*mape));
}
static void ReplaceString(char **pptr, const char *newstring)
{
if (*pptr != NULL)
{
free(*pptr);
}
*pptr = M_StringDuplicate(newstring);
}
static void UpdateMapEntry(mapentry_t *mape, mapentry_t *newe)
{
if (newe->mapname)
{
ReplaceString(&mape->mapname, newe->mapname);
}
if (newe->levelname)
{
ReplaceString(&mape->levelname, newe->levelname);
}
if (newe->label)
{
ReplaceString(&mape->label, newe->label);
}
if (newe->author)
{
ReplaceString(&mape->author, newe->author);
}
if (newe->intertext)
{
ReplaceString(&mape->intertext, newe->intertext);
}
if (newe->intertextsecret)
{
ReplaceString(&mape->intertextsecret, newe->intertextsecret);
}
if (newe->levelpic[0])
{
strcpy(mape->levelpic, newe->levelpic);
}
if (newe->nextmap[0])
{
strcpy(mape->nextmap, newe->nextmap);
}
if (newe->nextsecret[0])
{
strcpy(mape->nextsecret, newe->nextsecret);
}
if (newe->music[0])
{
strcpy(mape->music, newe->music);
}
if (newe->skytexture[0])
{
strcpy(mape->skytexture, newe->skytexture);
}
if (newe->endpic[0])
{
strcpy(mape->endpic, newe->endpic);
}
if (newe->exitpic[0])
{
strcpy(mape->exitpic, newe->exitpic);
}
if (newe->enterpic[0])
{
strcpy(mape->enterpic, newe->enterpic);
}
if (newe->exitanim[0])
{
strcpy(mape->exitanim, newe->exitanim);
}
if (newe->enteranim[0])
{
strcpy(mape->enteranim, newe->enteranim);
}
if (newe->interbackdrop[0])
{
strcpy(mape->interbackdrop, newe->interbackdrop);
}
if (newe->intermusic[0])
{
strcpy(mape->intermusic, newe->intermusic);
}
if (newe->partime)
{
mape->partime = newe->partime;
}
if (newe->nointermission)
{
mape->nointermission = newe->nointermission;
}
if (array_size(newe->bossactions))
{
if (mape->bossactions)
{
array_free(mape->bossactions);
}
mape->bossactions = newe->bossactions;
}
}
// -----------------------------------------------
// Parses a set of string and concatenates them
// Returns a pointer to the string (must be freed)
// -----------------------------------------------
static char *ParseMultiString(scanner_t *s)
{
char *build = NULL;
@ -571,15 +475,15 @@ static void ParseStandardProperty(scanner_t *s, mapentry_t *mape)
}
else
{
int i, special, tag;
for (i = 0; arrlen(actor_names); i++)
int type, special, tag;
for (type = 0; arrlen(actor_names); ++type)
{
if (!strcasecmp(SC_GetString(s), actor_names[i]))
if (!strcasecmp(SC_GetString(s), actor_names[type]))
{
break;
}
}
if (i == arrlen(actor_names))
if (type == arrlen(actor_names))
{
SC_Error(s, "bossaction: unknown thing type '%s'",
SC_GetString(s));
@ -594,7 +498,7 @@ static void ParseStandardProperty(scanner_t *s, mapentry_t *mape)
if (tag != 0 || special == 11 || special == 51 || special == 52
|| special == 124)
{
bossaction_t bossaction = {i, special, tag};
bossaction_t bossaction = {type, special, tag};
array_push(mape->bossactions, bossaction);
}
}
@ -634,38 +538,6 @@ static void ParseMapEntry(scanner_t *s, mapentry_t *entry)
}
}
// -----------------------------------------------
//
// Parses a complete UMAPINFO lump
//
// -----------------------------------------------
static void SetDefaults(mapentry_t *entry, const char *mapname)
{
mapentry_t *default_entry;
array_foreach(default_entry, umapdef)
{
if (!strcmp(mapname, default_entry->mapname))
{
UpdateMapEntry(entry, default_entry);
break;
}
}
}
void U_ParseMapDefInfo(int lumpnum)
{
scanner_t *s = SC_Open("UMAPDEF", W_CacheLumpNum(lumpnum, PU_CACHE),
W_LumpLength(lumpnum));
while (SC_TokensLeft(s))
{
mapentry_t parsed = {0};
ParseMapEntry(s, &parsed);
array_push(umapdef, parsed);
}
SC_Close(s);
}
void U_ParseMapInfo(int lumpnum)
{
scanner_t *s = SC_Open("UMAPINFO", W_CacheLumpNum(lumpnum, PU_CACHE),
@ -713,24 +585,20 @@ void U_ParseMapInfo(int lumpnum)
}
// Does this entry already exist? If yes, replace it.
mapentry_t *entry;
array_foreach(entry, umapinfo)
int i;
for (i = 0; i < array_size(umapinfo); ++i)
{
if (!strcmp(parsed.mapname, entry->mapname))
if (!strcmp(parsed.mapname, umapinfo[i].mapname))
{
FreeMap(entry);
SetDefaults(entry, parsed.mapname);
UpdateMapEntry(entry, &parsed);
FreeMapEntry(&umapinfo[i]);
umapinfo[i] = parsed;
break;
}
}
// Not found so create a new one.
if (entry == array_end(umapinfo))
if (i == array_size(umapinfo))
{
mapentry_t new = {0};
SetDefaults(&new, parsed.mapname);
UpdateMapEntry(&new, &parsed);
array_push(umapinfo, new);
array_push(umapinfo, parsed);
}
}

View File

@ -56,7 +56,7 @@ typedef struct mapentry_s
boolean nobossactions;
} mapentry_t;
extern mapentry_t *umapinfo, *umapdef;
extern mapentry_t *umapinfo;
extern boolean EpiCustom;
@ -64,8 +64,6 @@ mapentry_t *G_LookupMapinfo(int episode, int map);
boolean U_CheckField(char *str);
void U_ParseMapDefInfo(int lumpnum);
void U_ParseMapInfo(int lumpnum);
boolean U_IsSecretMap(int episode, int map);