make the broken ID24 levelnums work somehow so that Legacy of Rust's intermissions play.

This commit is contained in:
Christoph Oelckers 2024-10-01 16:38:14 +02:00
parent e88d912892
commit 59b567689a
4 changed files with 17 additions and 6 deletions

View file

@ -2401,9 +2401,13 @@ static void SetLevelNum (level_info_t *info, int num)
for (unsigned int i = 0; i < wadlevelinfos.Size(); ++i)
{
if (wadlevelinfos[i].levelnum == num)
{
wadlevelinfos[i].levelnum = 0;
wadlevelinfos[i].broken_id24_levelnum = 0;
}
}
info->levelnum = num;
info->broken_id24_levelnum = num; // at least make it work - somehow.
}
//==========================================================================

View file

@ -324,6 +324,7 @@ struct FExitText
struct level_info_t
{
int levelnum;
int broken_id24_levelnum;
FString MapName;
FString NextMap;

View file

@ -58,6 +58,7 @@ struct UMapEntry
char intermusic[9] = "";
int partime = 0;
int nointermission = 0;
int id24_levelnum = 0; // note that this one's semantics are massively screwed up. Only to be used for ID24-style intermissions.
};
static TArray<UMapEntry> Maps;
@ -124,7 +125,7 @@ static int ParseLumpName(FScanner &scanner, char *buffer)
//
// -----------------------------------------------
static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape)
static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape, int *id24_levelnum)
{
// find the next line with content.
// this line is no property.
@ -254,6 +255,7 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape)
epi.mEpisodeMap = mape->MapName;
epi.mPicName = split[0];
epi.mNoSkill = false;
mape->id24_levelnum = *id24_levelnum = 1;
unsigned i;
for (i = 0; i < AllEpisodes.Size(); i++)
@ -324,15 +326,16 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape)
//
// -----------------------------------------------
static int ParseMapEntry(FScanner &scanner, UMapEntry *val)
static int ParseMapEntry(FScanner &scanner, UMapEntry *val, int *id24_levelnum)
{
scanner.MustGetToken(TK_Identifier);
val->MapName = scanner.String;
val->id24_levelnum = ++(*id24_levelnum);
scanner.MustGetToken('{');
while(!scanner.CheckToken('}'))
{
ParseStandardProperty(scanner, val);
ParseStandardProperty(scanner, val, id24_levelnum);
}
return 1;
}
@ -348,12 +351,13 @@ int ParseUMapInfo(int lumpnum)
FScanner scanner(lumpnum);
unsigned int i;
int id24_levelnum = 1;
while (scanner.GetToken())
{
scanner.TokenMustBe(TK_Map);
UMapEntry parsed;
ParseMapEntry(scanner, &parsed);
ParseMapEntry(scanner, &parsed, &id24_levelnum);
// Endpic overrides level exits.
if (parsed.endpic[0])
@ -455,6 +459,8 @@ void CommitUMapinfo(level_info_t *defaultinfo)
if (map.exitpic[0]) levelinfo->ExitPic = map.exitpic;
if (map.enteranim[0]) levelinfo->EnterAnim = map.enteranim;
if (map.exitanim[0]) levelinfo->ExitAnim = map.exitanim;
levelinfo->broken_id24_levelnum = map.id24_levelnum;
Printf("%s: id24 levelnum = %d\n", map.MapName, map.id24_levelnum);
/* UMAPINFO's intermusic is for the text screen, not the summary.
if (map.intermusic[0])
{

View file

@ -302,7 +302,7 @@ private:
auto* li = FindLevelInfo(state != StatCount ? wbs->next.GetChars() : wbs->current.GetChars());
if (!li)
return false;
if (li->levelnum != condition.param)
if (li->broken_id24_levelnum != condition.param)
return false;
break;
}
@ -311,7 +311,7 @@ private:
auto* li = FindLevelInfo(state != StatCount ? wbs->next.GetChars() : wbs->current.GetChars());
if (!li)
return false;
if (li->levelnum <= condition.param)
if (li->broken_id24_levelnum <= condition.param)
return false;
break;
}