allow optionally skipping initial wipe in in-game intermissions

This commit is contained in:
Ricardo Luís Vaz Silva 2025-01-25 19:50:54 -03:00
parent 206c2291d9
commit 33bae944f7
9 changed files with 26 additions and 24 deletions

View file

@ -3121,10 +3121,10 @@ bool G_CheckDemoStatus (void)
return false;
}
void G_StartSlideshow(FLevelLocals *Level, FName whichone)
void G_StartSlideshow(FLevelLocals *Level, FName whichone, int state)
{
auto SelectedSlideshow = whichone == NAME_None ? Level->info->slideshow : whichone;
auto slide = F_StartIntermission(SelectedSlideshow);
auto slide = F_StartIntermission(SelectedSlideshow, state);
RunIntermission(nullptr, nullptr, slide, nullptr, [](bool)
{
primaryLevel->SetMusic();
@ -3139,7 +3139,7 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, StartSlideshow)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_NAME(whichone);
G_StartSlideshow(self, whichone);
G_StartSlideshow(self, whichone, FSTATE_InLevel);
return 0;
}

View file

@ -80,8 +80,16 @@ bool G_CheckDemoStatus (void);
void G_Ticker (void);
bool G_Responder (event_t* ev);
enum
{
FSTATE_EndingGame = 0,
FSTATE_ChangingLevel = 1,
FSTATE_InLevel = 2,
FSTATE_InLevelNoWipe = 3
};
void G_ScreenShot (const char* filename);
void G_StartSlideshow(FLevelLocals *Level, FName whichone);
void G_StartSlideshow(FLevelLocals *Level, FName whichone, int state);
class FSerializer;
bool G_CheckSaveGameWads (FSerializer &arc, bool printwarn);

View file

@ -1066,13 +1066,13 @@ void DIntermissionController::OnDestroy ()
//
//==========================================================================
DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, bool ending)
DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, int state, bool deleteme, bool ending)
{
ScaleOverrider s(twod);
S_StopAllChannels ();
gameaction = ga_nothing;
gamestate = GS_FINALE;
//if (state == FSTATE_InLevel) wipegamestate = GS_FINALE; // don't wipe when within a level.
if (state == FSTATE_InLevelNoWipe) wipegamestate = GS_FINALE; // don't wipe when within a level.
auto CurrentIntermission = Create<DIntermissionController>(desc, deleteme, ending);
// If the intermission finishes straight away then cancel the wipe.
@ -1093,7 +1093,7 @@ DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, bool
//
//==========================================================================
DIntermissionController* F_StartIntermission(FName seq)
DIntermissionController* F_StartIntermission(FName seq, int state)
{
FIntermissionDescriptor **pdesc = IntermissionDescriptors.CheckKey(seq);
if (pdesc == nullptr || (*pdesc)->mActions.Size() == 0)
@ -1110,7 +1110,7 @@ DIntermissionController* F_StartIntermission(FName seq)
return nullptr;
}
return F_StartIntermission(desc, false);
return F_StartIntermission(desc, state, false);
}
}

View file

@ -307,13 +307,6 @@ public:
virtual void Drawer ();
};
enum
{
FSTATE_EndingGame = 0,
FSTATE_ChangingLevel = 1,
FSTATE_InLevel = 2
};
class DIntermissionController : public DObject
{
DECLARE_CLASS (DIntermissionController, DObject)
@ -337,13 +330,13 @@ public:
void OnDestroy() override;
bool NextPage();
friend DIntermissionController* F_StartIntermission(FIntermissionDescriptor *, bool, uint8_t);
friend DIntermissionController* F_StartIntermission(FIntermissionDescriptor *, int, bool, bool);
};
// Interface for main loop
DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, bool ending = false);
DIntermissionController* F_StartIntermission(FName desc);
DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, int state, bool deleteme, bool ending = false);
DIntermissionController* F_StartIntermission(FName desc, int state);
// Create an intermission from old cluster data
DIntermissionController* F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int cdid, const char *flat,

View file

@ -947,14 +947,14 @@ DIntermissionController* F_StartFinale (const char *music, int musicorder, int c
desc->mActions.Push(wiper);
}
return F_StartIntermission(desc, true, ending && endsequence != NAME_None);
return F_StartIntermission(desc, FSTATE_EndingGame, true, ending && endsequence != NAME_None);
}
else if (ending)
{
FIntermissionDescriptor **pdesc = IntermissionDescriptors.CheckKey(endsequence);
if (pdesc != NULL)
{
return F_StartIntermission(*pdesc, false, ending);
return F_StartIntermission(*pdesc, FSTATE_EndingGame, false, ending);
}
}
return nullptr;

View file

@ -550,7 +550,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
}
if (reply->GiveType->IsDescendantOf("SlideshowStarter"))
G_StartSlideshow(primaryLevel, NAME_None);
G_StartSlideshow(primaryLevel, NAME_None, FSTATE_InLevel);
}
else
{

View file

@ -6747,7 +6747,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_StartSlideshow:
MIN_ARG_COUNT(1);
G_StartSlideshow(Level, FName(Level->Behaviors.LookupString(args[0])));
G_StartSlideshow(Level, FName(Level->Behaviors.LookupString(args[0])), FSTATE_InLevel);
break;
case ACSF_GetSectorHealth:

View file

@ -1743,7 +1743,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_NAME(seq);
PARAM_INT(state);
G_StartSlideshow(self, seq);
G_StartSlideshow(self, seq, state);
return 0;
}

View file

@ -1265,7 +1265,8 @@ enum IntermissionSequenceType
{
FSTATE_EndingGame = 0,
FSTATE_ChangingLevel = 1,
FSTATE_InLevel = 2
FSTATE_InLevel = 2,
FSTATE_InLevelNoWipe = 3
};
enum Bobbing