- migrated RR's cutscene definitions.

Also turned several level-specific init options into map flags or map parameters.
This commit is contained in:
Christoph Oelckers 2021-05-02 13:12:24 +02:00
parent 15f9861633
commit 6f4e380728
10 changed files with 166 additions and 64 deletions

View file

@ -550,6 +550,12 @@ DEFINE_MAP_OPTION(rr_startsound, false)
info->rr_startsound = parse.sc.Number;
}
DEFINE_MAP_OPTION(rr_mamaspawn, false)
{
parse.ParseAssign();
parse.sc.MustGetNumber();
info->rr_mamaspawn = parse.sc.Number;
}
//==========================================================================
//
@ -583,6 +589,7 @@ MapFlagHandlers[] =
{ "secretexitoverride", MITYPE_SETFLAG, LEVEL_SECRETEXITOVERRIDE, 0, -1 },
{ "clearinventory", MITYPE_SETFLAG, LEVEL_CLEARINVENTORY, 0, -1 },
{ "clearweapons", MITYPE_SETFLAG, LEVEL_CLEARWEAPONS, 0, -1 },
{ "forcenoeog", MITYPE_SETFLAG, LEVEL_FORCENOEOG, 0, -1 },
{ "rrra_hulkspawn", MITYPE_SETFLAGG,LEVEL_RR_HULKSPAWN, 0, GAMEFLAG_RRRA },
{ "rr_clearmoonshine", MITYPE_SETFLAGG,LEVEL_RR_CLEARMOONSHINE, 0, GAMEFLAG_RR },
@ -884,7 +891,6 @@ void FMapInfoParser::ParseEpisodeInfo ()
void FMapInfoParser::ParseCutsceneInfo()
{
unsigned int i;
FString map;
FString pic;
FString name;
@ -923,7 +929,7 @@ void FMapInfoParser::ParseCutsceneInfo()
else if (!ParseCloseBrace())
{
// Unknown
sc.ScriptMessage("Unknown property '%s' found in episode definition\n", sc.String);
sc.ScriptMessage("Unknown property '%s' found in cutscene definition\n", sc.String);
SkipToNext();
}
else
@ -943,7 +949,6 @@ void FMapInfoParser::ParseCutsceneInfo()
void FMapInfoParser::ParseGameInfo()
{
unsigned int i;
FString map;
FString pic;
FString name;
@ -974,7 +979,7 @@ void FMapInfoParser::ParseGameInfo()
else if (!ParseCloseBrace())
{
// Unknown
sc.ScriptMessage("Unknown property '%s' found in episode definition\n", sc.String);
sc.ScriptMessage("Unknown property '%s' found in gameinfo definition\n", sc.String);
SkipToNext();
}
else

View file

@ -150,6 +150,7 @@ struct MapRecord
// game specific stuff
int rr_startsound = 0;
int rr_mamaspawn = 5;
const char* LabelName() const
{

View file

@ -39,7 +39,9 @@
#include "hw_material.h"
#include "gamestruct.h"
#include "gamecontrol.h"
#include "texturemanager.h"
#include "glbackend/gl_models.h"
#include "mapinfo.h"
BEGIN_BLD_NS
extern short voxelIndex[MAXTILES];
@ -128,6 +130,19 @@ void precacheMarkedTiles()
int dapalnum = pair->Key >> 32;
doprecache(dapicnum, dapalnum);
}
// Cache everything the map explicitly declares.
TMap<FString, bool> cachetexmap;
for (auto& tex : currentLevel->PrecacheTextures) cachetexmap.Insert(tex, true);
decltype(cachetexmap)::Iterator it2(cachetexmap);
decltype(cachetexmap)::Pair* pair2;
while (it2.NextPair(pair2))
{
auto tex = TexMan.FindGameTexture(pair2->Key, ETextureType::Any);
if (tex) PrecacheTex(tex, 0);
}
cachemap.Clear();
}

View file

@ -2,5 +2,6 @@
void PrecacheHardwareTextures(int nTile);
void markTileForPrecache(int tilenum, int palnum);
void markTextureForPrecache(const char* texname);
void markVoxelForPrecache(int voxnum);
void precacheMarkedTiles();

View file

@ -1464,26 +1464,8 @@ int doincrements_r(struct player_struct* p)
{
if (!wupass)
{
short snd;
int snd = currentLevel->rr_startsound ? currentLevel->rr_startsound : 391;
wupass = 1;
switch (currentLevel->levelNumber)
{
default: snd = 391; break;
case makelevelnum(0, 0): snd = isRRRA() ? 63 : 391; break;
case makelevelnum(0, 1): snd = 64; break;
case makelevelnum(0, 2): snd = 77; break;
case makelevelnum(0, 3): snd = 80; break;
case makelevelnum(0, 4): snd = 102; break;
case makelevelnum(0, 5): snd = 103; break;
case makelevelnum(0, 6): snd = 104; break;
case makelevelnum(1, 0): snd = 105; break;
case makelevelnum(1, 1): snd = 176; break;
case makelevelnum(1, 2): snd = 177; break;
case makelevelnum(1, 3): snd = 198; break;
case makelevelnum(1, 4): snd = 230; break;
case makelevelnum(1, 5): snd = 255; break;
case makelevelnum(1, 6): snd = 283; break;
}
S_PlayActorSound(snd, pact);
}
else if (PlayClock > 1024)

View file

@ -36,6 +36,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "automap.h"
#include "dukeactor.h"
#include "interpolate.h"
#include "precache.h"
BEGIN_DUKE_NS
@ -1003,7 +1004,10 @@ bool setnextmap(bool checksecretexit)
{
if (ud.secretlevel > 0)
{
map = FindMapByIndex(currentLevel->cluster, ud.secretlevel);
// allow overriding the secret exit destination to make episode compilation easier with maps containing secret exits.
if (currentLevel->flags & LEVEL_SECRETEXITOVERRIDE) map = FindNextSecretMap(currentLevel);
if (!map) map = FindMapByIndex(currentLevel->cluster, ud.secretlevel);
if (map)
{
from_bonus = FindNextMap(currentLevel);

View file

@ -366,37 +366,6 @@ static void cachegoodsprites(void)
for (i = SMALLSMOKE; i < (SMALLSMOKE + 4); i++)
tloadtile(i);
if (isRRRA() && currentLevel->levelNumber == makelevelnum(0, 4))
{
tloadtile(RRTILE2577);
}
if (!isRRRA() && currentLevel->levelNumber == makelevelnum(1, 2))
{
tloadtile(RRTILE3190);
tloadtile(RRTILE3191);
tloadtile(RRTILE3192);
tloadtile(RRTILE3144);
tloadtile(RRTILE3139);
tloadtile(RRTILE3132);
tloadtile(RRTILE3120);
tloadtile(RRTILE3121);
tloadtile(RRTILE3122);
tloadtile(RRTILE3123);
tloadtile(RRTILE3124);
}
if (lastlevel)
{
i = isRRRA() ? UFO1_RRRA : UFO1_RR;
tloadtile(i);
i = UFO2;
tloadtile(i);
i = UFO3;
tloadtile(i);
i = UFO4;
tloadtile(i);
i = UFO5;
tloadtile(i);
}
}
//---------------------------------------------------------------------------

View file

@ -0,0 +1,124 @@
// Cutscene definitions for RR
cluster 1
{
outro
{
function = RRCutscenes.BuildE1End
}
}
cluster 2
{
outro
{
function = RRCutscenes.BuildE2End
}
}
map { 1, 1 }
{
interbackground = "BONUSPIC01"
rr_startsound = 391 // fixme: allow symbolic names
}
map { 1, 2 }
{
interbackground = "BONUSPIC02"
rr_startsound = 64
}
map { 1, 3 }
{
interbackground = "BONUSPIC03"
rr_startsound = 77
}
map { 1, 4 }
{
interbackground = "BONUSPIC04"
rr_startsound = 80
}
map { 1, 5 }
{
interbackground = "BONUSPIC05"
rr_startsound = 102
}
map { 1, 6 }
{
interbackground = "BONUSPIC06"
rr_startsound = 103
}
map { 1, 7 }
{
interbackground = "BONUSPIC07"
rr_startsound = 104
}
map { 2, 1 }
{
interbackground = "BONUSPIC08"
rr_startsound = 105
}
map { 2, 2 }
{
interbackground = "BONUSPIC09"
rr_startsound = 176
clearweapons
}
map { 2, 3 }
{
interbackground = "BONUSPIC10"
rr_startsound = 177
PrecacheTextures = "#03190","#03191","#03192","#03144","#03139","#03132","#03120","#03121","#03122","#03123","#03124"
}
map { 2, 4 }
{
interbackground = "BONUSPIC11"
rr_startsound = 198
}
map { 2, 5 }
{
interbackground = "BONUSPIC12"
rr_startsound = 230
}
map { 2, 6 }
{
interbackground = "BONUSPIC13"
rr_startsound = 255
}
map { 2, 7 }
{
interbackground = "BONUSPIC14"
rr_startsound = 283
PrecacheTextures = "UFO1", "UFO2", "UFO3", "UFO4", "UFO5"
}
map { 2, 8 }
{
interbackground = "BONUSPIC14"
rr_startsound = 391
}
cutscenes
{
loadscreen
{
function = DukeCutscenes.BuildLoading // identical with Duke's
}
}
gameinfo
{
summaryscreen = RRCutscenes.BuildSPSummary
mpsummaryscreen = DukeCutscenes.BuildMPSummary // identical with Duke's
}

View file

@ -1,5 +1,5 @@
// Cutscene definitions for RR
/*
definecutscene intro
{
function RRCutscenes.BuildIntro
@ -34,3 +34,4 @@ definecutscene loading
definecutscene summary RRCutscenes.BuildSPSummary
definecutscene mpsummary DukeCutscenes.BuildMPSummary // identical with Duke's
*/

View file

@ -822,16 +822,16 @@ class RRLevelSummaryScreen : SummaryScreenBase
{
Super.Init(dofadeout? (fadein | fadeout) : fadein);
SetParameters(m, s);
String s;
if (level.flags & MapRecord.USERMAP)
s = "BONUSPIC01";
else if (!Raze.isRRRA())
s = String.Format("BONUSPIC%02d", 1 + clamp((level.levelNumber / 1000) * 7 + (level.levelNumber % 1000), 0, 13));
else
s = String.Format("LEVELMAP%02d", 1 + clamp((level.levelNumber / 1000) * 7 + (level.levelNumber % 1000), 0, 13));
String basetex = level.InterBackground;
if (basetex.length() == 0)
{
let cluster = level.GetCluster();
if (cluster != null) basetex = cluster.InterBackground;
}
if (basetex.length() == 0) basetex = "BONUSPIC01";
lastmapname = level.DisplayName();
texBg = TexMan.CheckForTexture(s);
texBg = TexMan.CheckForTexture(basetex);
return self;
}