- migrated SW to RMAPINFO as well.

Also removed the 'definecutscene' code from the .def parser as this was never meant to be more than a temporary solution.
This commit is contained in:
Christoph Oelckers 2021-05-02 17:35:25 +02:00
parent 4b064b9f34
commit dfd47ea33a
16 changed files with 164 additions and 246 deletions

View file

@ -361,8 +361,6 @@ static int32_t defsparser(scriptfile *script)
{ "shadefactor", T_SHADEFACTOR },
{ "newgamechoices", T_NEWGAMECHOICES },
{ "rffdefineid", T_RFFDEFINEID }, // dummy
{ "map", T_MAP },
{ "definecutscene", T_DEFINECUTSCENE },
};
script->SetNoOctals(true);
@ -379,9 +377,6 @@ static int32_t defsparser(scriptfile *script)
auto pos = scriptfile_getposition(script);
switch (tokn)
{
case T_DEFINECUTSCENE:
parseDefineCutscene(*script, pos);
break;
case T_ERROR:
pos.Message(MSG_ERROR, "Unknown error");
break;

View file

@ -629,6 +629,13 @@ MapFlagHandlers[] =
{ "ex_altsound", MITYPE_SETFLAGG,LEVEL_EX_ALTSOUND, 0, GAMEFLAG_PSEXHUMED },
{ "ex_countdown", MITYPE_SETFLAGG,LEVEL_EX_COUNTDOWN, 0, GAMEFLAG_PSEXHUMED },
{ "ex_multi", MITYPE_SETFLAGG,LEVEL_EX_MULTI, 0, GAMEFLAG_PSEXHUMED },
{ "sw_bossmeter_serpent", MITYPE_SETFLAGG,LEVEL_SW_BOSSMETER_SERPENT, 0, GAMEFLAG_SW },
{ "sw_bossmeter_sumo", MITYPE_SETFLAGG,LEVEL_SW_BOSSMETER_SUMO, 0, GAMEFLAG_SW },
{ "sw_bossmeter_zilla", MITYPE_SETFLAGG,LEVEL_SW_BOSSMETER_ZILLA, 0, GAMEFLAG_SW },
{ "sw_deathexit_serpent", MITYPE_SETFLAGG,LEVEL_SW_DEATHEXIT_SERPENT, 0, GAMEFLAG_SW },
{ "sw_deathexit_sumo", MITYPE_SETFLAGG,LEVEL_SW_DEATHEXIT_SUMO, 0, GAMEFLAG_SW },
{ "sw_deathexit_zilla", MITYPE_SETFLAGG,LEVEL_SW_DEATHEXIT_ZILLA, 0, GAMEFLAG_SW },
{ "sw_spawnmines", MITYPE_SETFLAGG,LEVEL_SW_SPAWNMINES, 0, GAMEFLAG_SW },
{ NULL, MITYPE_IGNORE, 0, 0}
};
@ -1178,15 +1185,18 @@ void G_ParseMapInfo ()
// first parse the internal one which sets up the needed basics and patches the legacy definitions of each game.
FMapInfoParser parse;
MapRecord defaultinfo;
int baselump = fileSystem.GetNumForFullName("engine/rmapinfo.txt");
if (fileSystem.GetFileContainer(baselump) > 0)
{
I_FatalError("File %s is overriding core lump %s.",
fileSystem.GetResourceFileName(fileSystem.GetFileContainer(baselump)), "engine/rmapinfo.txt");
}
parse.ParseMapInfo(baselump, gamedefaults, defaultinfo);
// Parse any extra MAPINFOs.
// Parse internal RMAPINFOs.
while ((lump = fileSystem.FindLumpFullName("engine/rmapinfo.txt", &lastlump, false)) != -1)
{
if (fileSystem.GetFileContainer(lump) > 0) break; // only load from raze.pk3
FMapInfoParser parse;
MapRecord defaultinfo;
parse.ParseMapInfo(lump, gamedefaults, defaultinfo);
}
// Parse any extra RMAPINFOs.
while ((lump = fileSystem.FindLump ("RMAPINFO", &lastlump, false)) != -1)
{
FMapInfoParser parse;

View file

@ -42,6 +42,15 @@ enum EMapGameFlags
LEVEL_EX_ALTSOUND = 16,
LEVEL_EX_MULTI = 32,
LEVEL_SW_SPAWNMINES = 64,
LEVEL_SW_BOSSMETER_SERPENT = 128,
LEVEL_SW_BOSSMETER_SUMO = 256,
LEVEL_SW_BOSSMETER_ZILLA = 512,
LEVEL_SW_DEATHEXIT_SERPENT = 1024,
LEVEL_SW_DEATHEXIT_SUMO = 2048,
LEVEL_SW_DEATHEXIT_ZILLA = 4096,
};
// These get filled in by the map definition parsers of the front ends.

View file

@ -45,107 +45,3 @@ void parseAnimTileRange(FScanner& sc, FScriptPosition& pos)
processSetAnim("animtilerange", pos, set);
}
//===========================================================================
//
//
//
//===========================================================================
static void parseCutscene(FScanner& sc, CutsceneDef& cdef)
{
FScanner::SavedPos eblockend;
if (sc.StartBraces(&eblockend)) return;
FString sound;
while (!sc.FoundEndBrace(eblockend))
{
sc.MustGetString();
if (sc.Compare("video")) { sc.GetString(cdef.video); cdef.function = ""; }
else if (sc.Compare("function")) { sc.GetString(cdef.function); cdef.video = ""; }
else if (sc.Compare("sound")) sc.GetString(sound);
else if (sc.Compare("fps")) sc.GetNumber(cdef.framespersec);
else if (sc.Compare("transitiononly")) cdef.transitiononly = true;
else if (sc.Compare("clear")) { cdef.function = "none"; cdef.video = ""; } // this means 'play nothing', not 'not defined'.
}
if (sound.IsNotEmpty())
{
cdef.sound = soundEngine->FindSound(sound);
if (cdef.sound == 0)
{
int lump = fileSystem.FindFile(sound);
if (lump < 0) return;
cdef.sound = FSoundID(soundEngine->AddSoundLump(sound, lump, 0));
}
}
}
void parseDefineCutscene(FScanner& sc, FScriptPosition& pos)
{
int scenenum = -1;
if (!sc.GetString()) return;
if (sc.Compare("intro"))
{
parseCutscene(sc, globalCutscenes.Intro);
}
else if (sc.Compare("mapintro")) // sets the global default for a map entry handler.
{
parseCutscene(sc, globalCutscenes.DefaultMapIntro);
}
else if (sc.Compare("mapoutro")) // sets the global default for a map exit handler.
{
parseCutscene(sc, globalCutscenes.DefaultMapOutro);
}
else if (sc.Compare("sharewareend")) // sets screens to be shown after the shareware version ends.
{
parseCutscene(sc, globalCutscenes.SharewareEnd);
}
else if (sc.Compare("loading")) // sets the loading screen when entering a level.
{
parseCutscene(sc, globalCutscenes.LoadingScreen);
}
else if (sc.Compare({ "episode", "volume", "cluster" }))
{
FScanner::SavedPos eblockend;
sc.MustGetNumber();
if (sc.Number < 1)
{
sc.ScriptError("episode number %d out of range. Must be positive", sc.Number);
return;
}
int vol = sc.Number;
if (sc.StartBraces(&eblockend)) return;
while (!sc.FoundEndBrace(eblockend))
{
sc.MustGetString();
auto volume = MustFindCluster(vol);
if (sc.Compare("intro")) parseCutscene(sc, volume->intro);
else if (sc.Compare("outro")) parseCutscene(sc, volume->outro);
else if (sc.Compare("flags")) sc.GetNumber(volume->flags);
}
}
else if (sc.Compare("map"))
{
FScanner::SavedPos eblockend;
sc.MustGetString();
auto maprec = FindMapByName(sc.String);
if (!maprec)
{
sc.ScriptError("%s: map not found", sc.String);
return;
}
if (sc.StartBraces(&eblockend)) return;
while (!sc.FoundEndBrace(eblockend))
{
sc.MustGetString();
if (sc.Compare("intro")) parseCutscene(sc, maprec->intro);
else if (sc.Compare("outro")) parseCutscene(sc, maprec->outro);
}
}
else if (sc.Compare("summary")) sc.GetString(globalCutscenes.SummaryScreen);
else if (sc.Compare("mpsummary")) sc.GetString(globalCutscenes.MPSummaryScreen);
}

View file

@ -274,9 +274,8 @@ void InitLevelGlobals(void)
gNet.TimeLimitClock = gNet.TimeLimit;
serpwasseen = false;
sumowasseen = false;
zillawasseen = false;
for (auto& b : bosswasseen) b = false;
memset(BossSpriteNum,-1,sizeof(BossSpriteNum));
}

View file

@ -2237,9 +2237,7 @@ extern short wait_active_check_offset;
//extern short Zombies;
extern int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust;
extern bool left_foot;
extern bool serpwasseen;
extern bool sumowasseen;
extern bool zillawasseen;
extern bool bosswasseen[3];
extern short BossSpriteNum[3];
extern int ChopTics;
extern short Bunny_Count;

View file

@ -7042,9 +7042,7 @@ void MultiPlayLimits(void)
gNet.TimeLimitClock = gNet.TimeLimit;
MapRecord *next = nullptr;
// do not increment if level is 23 thru 28 (should be done smarter.)
if (currentLevel->levelNumber <= 22)
next = FindNextMap(currentLevel);
next = FindNextMap(currentLevel);
ChangeLevel(next, -1);
}
}

View file

@ -78,9 +78,7 @@ extern int FinishAnim;
extern int GameVersion;
//extern short Zombies;
extern bool serpwasseen;
extern bool sumowasseen;
extern bool zillawasseen;
extern bool bosswasseen[3];
extern short BossSpriteNum[3];
#define ANIM_SAVE 1
@ -1269,9 +1267,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("GodMode", GodMode)
("FinishTimer", FinishTimer)
("FinishAnim", FinishAnim)
("serpwasseen", serpwasseen)
("sumowasseen", sumowasseen)
("zillawasseen", zillawasseen)
.Array("bosswasseen", bosswasseen, 3)
.Array("BossSpriteNum", BossSpriteNum, 3);
arc.Array("tracks", Track, countof(Track))
;

View file

@ -1080,10 +1080,8 @@ ActorTestSpawn(SPRITEp sp)
sp->picnum == SAILORGIRL_R0) && (g_gameType & GAMEFLAG_ADDON)) return true;
// spawn Bouncing Betty (mine) in TD map 09 Warehouse
#if 0 // needs to be done smarter.
if (sp->picnum == 817 && swGetAddon() == 2 && currentLevel->levelNumber == 9)
if (sp->picnum == 817 && (currentLevel->flags & LEVEL_SW_SPAWNMINES))
return true;
#endif
return false;
}

View file

@ -41,9 +41,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
extern uint8_t playTrack;
bool serpwasseen = false;
bool sumowasseen = false;
bool zillawasseen = false;
bool bosswasseen[3];
short BossSpriteNum[3] = {-1,-1,-1};
@ -819,22 +817,19 @@ BossHealthMeter(void)
int y;
extern bool NoMeters;
short health;
bool bosswasseen;
static bool triedplay = false;
if (NoMeters) return;
if (currentLevel->levelNumber != 20 && currentLevel->levelNumber != 4 && currentLevel->levelNumber != 11 && currentLevel->levelNumber != 5) return;
if (!(currentLevel->gameflags & (LEVEL_SW_BOSSMETER_SERPENT | LEVEL_SW_BOSSMETER_SUMO | LEVEL_SW_BOSSMETER_ZILLA))) return;
// Don't draw bar for other players
if (pp != Player+myconnectindex)
return;
// all enemys
if ((currentLevel->levelNumber == 20 && (BossSpriteNum[0] == -1 || BossSpriteNum[1] == -1 || BossSpriteNum[2] == -1)) ||
(currentLevel->levelNumber == 4 && BossSpriteNum[0] == -1) ||
(currentLevel->levelNumber == 5 && BossSpriteNum[0] == -1) ||
(currentLevel->levelNumber == 11 && BossSpriteNum[1] == -1))
if (currentLevel->gameflags & (LEVEL_SW_BOSSMETER_SERPENT|LEVEL_SW_BOSSMETER_SUMO|LEVEL_SW_BOSSMETER_ZILLA) &&
BossSpriteNum[0] <= -1 && BossSpriteNum[1] <= -1 && BossSpriteNum[2] <= -1)
{
StatIterator it(STAT_ENEMY);
while ((i = it.NextIndex()) >= 0)
@ -844,11 +839,11 @@ BossHealthMeter(void)
if ((u->ID == SERP_RUN_R0 || u->ID == SUMO_RUN_R0 || u->ID == ZILLA_RUN_R0) && sp->pal != 16)
{
if (u->ID == SERP_RUN_R0)
if (u->ID == SERP_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_BOSSMETER_SERPENT))
BossSpriteNum[0] = i;
else if (u->ID == SUMO_RUN_R0)
else if (u->ID == SUMO_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_BOSSMETER_SUMO))
BossSpriteNum[1] = i;
else if (u->ID == ZILLA_RUN_R0)
else if (u->ID == ZILLA_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_BOSSMETER_ZILLA))
BossSpriteNum[2] = i;
}
}
@ -857,45 +852,39 @@ BossHealthMeter(void)
if (BossSpriteNum[0] <= -1 && BossSpriteNum[1] <= -1 && BossSpriteNum[2] <= -1)
return;
// Frank, good optimization for other levels, but it broke level 20. :(
// I kept this but had to add a fix.
bosswasseen = serpwasseen || sumowasseen || zillawasseen;
// Only show the meter when you can see the boss
if ((currentLevel->levelNumber == 20 && (!serpwasseen || !sumowasseen || !zillawasseen)) || !bosswasseen)
for (i=0; i<3; i++)
{
for (i=0; i<3; i++)
if (BossSpriteNum[i] >= 0 && !bosswasseen[i])
{
if (BossSpriteNum[i] >= 0)
{
sp = &sprite[BossSpriteNum[i]];
u = User[BossSpriteNum[i]].Data();
sp = &sprite[BossSpriteNum[i]];
u = User[BossSpriteNum[i]].Data();
if (cansee(sp->x, sp->y, SPRITEp_TOS(sp), sp->sectnum, pp->posx, pp->posy, pp->posz - Z(40), pp->cursectnum))
if (cansee(sp->x, sp->y, SPRITEp_TOS(sp), sp->sectnum, pp->posx, pp->posy, pp->posz - Z(40), pp->cursectnum))
{
if (i == 0 && !bosswasseen[0])
{
if (i == 0 && !serpwasseen)
bosswasseen[0] = true;
if (!SW_SHAREWARE)
{
serpwasseen = true;
if (!SW_SHAREWARE)
{
PlaySong(nullptr, ThemeSongs[2], ThemeTrack[2], true);
}
PlaySong(nullptr, ThemeSongs[2], ThemeTrack[2], true);
}
else if (i == 1 && !sumowasseen)
}
else if (i == 1 && !bosswasseen[1])
{
bosswasseen[1] = true;
if (!SW_SHAREWARE)
{
sumowasseen = true;
if (!SW_SHAREWARE)
{
PlaySong(nullptr, ThemeSongs[3], ThemeTrack[3], true);
}
PlaySong(nullptr, ThemeSongs[3], ThemeTrack[3], true);
}
else if (i == 2 && !zillawasseen)
}
else if (i == 2 && !bosswasseen[2])
{
bosswasseen[2] = true;
if (!SW_SHAREWARE)
{
zillawasseen = true;
if (!SW_SHAREWARE)
{
PlaySong(nullptr, ThemeSongs[4], ThemeTrack[4], true);
}
PlaySong(nullptr, ThemeSongs[4], ThemeTrack[4], true);
}
}
}
@ -906,17 +895,17 @@ BossHealthMeter(void)
for (i=0; i<3; i++)
{
if (i == 0 && (!serpwasseen || BossSpriteNum[0] < 0))
if (i == 0 && (!bosswasseen[0] || BossSpriteNum[0] < 0))
continue;
if (i == 1 && (!sumowasseen || BossSpriteNum[1] < 0))
if (i == 1 && (!bosswasseen[1] || BossSpriteNum[1] < 0))
continue;
if (i == 2 && (!zillawasseen || BossSpriteNum[2] < 0))
if (i == 2 && (!bosswasseen[2] || BossSpriteNum[2] < 0))
continue;
sp = &sprite[BossSpriteNum[i]];
u = User[BossSpriteNum[i]].Data();
if (u->ID == SERP_RUN_R0 && serpwasseen)
if (u->ID == SERP_RUN_R0 && bosswasseen[0])
{
if (Skill == 0) health = 1100;
else if (Skill == 1) health = 2200;
@ -924,7 +913,7 @@ BossHealthMeter(void)
health = HEALTH_SERP_GOD;
meterunit = health / 30;
}
else if (u->ID == SUMO_RUN_R0 && sumowasseen)
else if (u->ID == SUMO_RUN_R0 && bosswasseen[1])
{
if (Skill == 0) health = 2000;
else if (Skill == 1) health = 4000;
@ -932,7 +921,7 @@ BossHealthMeter(void)
health = 6000;
meterunit = health / 30;
}
else if (u->ID == ZILLA_RUN_R0 && zillawasseen)
else if (u->ID == ZILLA_RUN_R0 && bosswasseen[2])
{
if (Skill == 0) health = 2000;
else if (Skill == 1) health = 4000;
@ -963,10 +952,10 @@ BossHealthMeter(void)
else
y = 30;
if (currentLevel->levelNumber == 20 && numplayers >= 2)
if ((currentLevel->gameflags & (LEVEL_SW_BOSSMETER_SUMO|LEVEL_SW_BOSSMETER_ZILLA)) == (LEVEL_SW_BOSSMETER_SUMO | LEVEL_SW_BOSSMETER_ZILLA) && numplayers >= 2)
{
if (u->ID == SUMO_RUN_R0 && sumowasseen) y += 10;
else if (u->ID == ZILLA_RUN_R0 && zillawasseen) y += 20;
if (u->ID == SUMO_RUN_R0 && bosswasseen[1]) y += 10;
else if (u->ID == ZILLA_RUN_R0 && bosswasseen[2]) y += 20;
}
if (metertics <= 12 && metertics > 6)

View file

@ -5322,7 +5322,7 @@ ActorHealth(short SpriteNum, short amt)
u->Health += amt;
if (u->ID == SERP_RUN_R0 && sp->pal != 16 && currentLevel->levelNumber == 4)
if (u->ID == SERP_RUN_R0 && sp->pal != 16 && (currentLevel->gameflags & LEVEL_SW_DEATHEXIT_SERPENT))
{
if (u->Health < u->MaxHealth/2)
{
@ -5332,7 +5332,7 @@ ActorHealth(short SpriteNum, short amt)
}
}
if (u->ID == SUMO_RUN_R0 && currentLevel->levelNumber == 11)
if (u->ID == SUMO_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_DEATHEXIT_SUMO))
{
if (u->Health <= 0)
{
@ -5341,7 +5341,7 @@ ActorHealth(short SpriteNum, short amt)
}
}
if (u->ID == ZILLA_RUN_R0 && currentLevel->levelNumber == 20)
if (u->ID == ZILLA_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_DEATHEXIT_ZILLA))
{
if (u->Health <= 0)
//if (u->Health < u->MaxHealth)

View file

@ -59,18 +59,3 @@ tilefromtexture 9277 { file "tiles/9277.png" }
tilefromtexture 9278 { file "tiles/9278.png" }
tilefromtexture 9279 { file "tiles/9279.png" }
tilefromtexture 9280 { file "tiles/9280.png" }
// Cutscene definitions for Blood
definecutscene intro
{
function BloodCutscenes.BuildIntro
}
definecutscene loading
{
function BloodCutscenes.BuildLoading
}
definecutscene summary BloodCutscenes.BuildSPSummary
definecutscene mpsummary BloodCutscenes.BuildMPSummary

View file

@ -0,0 +1,21 @@
// Cutscene definitions for Blood
cutscenes
{
intro
{
function = BloodCutscenes.BuildIntro
}
loadscreen
{
function = BloodCutscenes.BuildLoading
}
}
gameinfo
{
summaryscreen = BloodCutscenes.BuildSPSummary
mpsummaryscreen = BloodCutscenes.BuildMPSummary
}

View file

@ -0,0 +1,5 @@
map { 9 }
{
sw_spawnmines
}

View file

@ -1,44 +0,0 @@
// Cutscene definitions for Duke
definecutscene intro
{
function SWCutscenes.BuildIntro
}
definecutscene map "$woods"
{
outro
{
function SWCutscenes.BuildSerpentAnim
}
}
definecutscene map "$plax1"
{
outro
{
function SWCutscenes.BuildSumoAnim
}
}
definecutscene map "$volcano"
{
outro
{
function SWCutscenes.BuildZillaAnim
}
}
definecutscene sharewareend
{
function SWCutscenes.BuildSybexScreen
}
definecutscene loading
{
function SWCutscenes.BuildLoading
}
definecutscene summary SWCutscenes.BuildSPSummary
definecutscene mpsummary SWCutscenes.BuildMPSummary

View file

@ -0,0 +1,63 @@
// Cutscene definitions for SW
Cutscenes
{
intro
{
function = SWCutscenes.BuildIntro
}
sharewareend
{
function = SWCutscenes.BuildSybexScreen
}
loadscreen
{
function = SWCutscenes.BuildLoading
}
}
map { 4 }
{
outro
{
function = SWCutscenes.BuildSerpentAnim
}
sw_bossmeter_serpent
sw_deathexit_serpent
}
map { 5 }
{
sw_bossmeter_serpent
}
map { 11 }
{
outro
{
function = SWCutscenes.BuildSumoAnim
}
sw_bossmeter_sumo
sw_deathexit_sumo
}
map { 20 }
{
outro
{
function = SWCutscenes.BuildZillaAnim
}
sw_bossmeter_serpent
sw_bossmeter_sumo
sw_bossmeter_zilla
sw_deathexit_zilla
next = "-"
}
gameinfo
{
summaryscreen = SWCutscenes.BuildSPSummary
mpsummaryscreen = SWCutscenes.BuildMPSummary
}