- added a callback to menu items for when a new menu gets created.

- added a StartSlideshow ACS and ZScript command and extended the functionality to specify the slideshow's name when starting it.

This is for triggering any kind of intermission definition in the middle of a level - keep in mind that this may not be set up to loop!
This commit is contained in:
Christoph Oelckers 2017-03-14 10:41:13 +01:00
parent fbcf1b2c45
commit 6db355a947
8 changed files with 37 additions and 3 deletions

View file

@ -147,6 +147,7 @@ CVAR(Int, nametagcolor, CR_GOLD, CVAR_ARCHIVE)
gameaction_t gameaction; gameaction_t gameaction;
gamestate_t gamestate = GS_STARTUP; gamestate_t gamestate = GS_STARTUP;
FName SelectedSlideshow; // what to start when ga_slideshow
int paused; int paused;
bool pauseext; bool pauseext;
@ -1119,7 +1120,7 @@ void G_Ticker ()
G_DoCompleted (); G_DoCompleted ();
break; break;
case ga_slideshow: case ga_slideshow:
if (gamestate == GS_LEVEL) F_StartIntermission(level.info->slideshow, FSTATE_InLevel); if (gamestate == GS_LEVEL) F_StartIntermission(SelectedSlideshow, FSTATE_InLevel);
break; break;
case ga_worlddone: case ga_worlddone:
G_DoWorldDone (); G_DoWorldDone ();
@ -2983,6 +2984,20 @@ bool G_CheckDemoStatus (void)
return false; return false;
} }
void G_StartSlideshow(FName whichone)
{
gameaction = ga_slideshow;
SelectedSlideshow = whichone == NAME_None ? level.info->slideshow : whichone;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, StartSlideshow)
{
PARAM_PROLOGUE;
PARAM_NAME_DEF(whichone);
G_StartSlideshow(whichone);
return 0;
}
DEFINE_GLOBAL(players) DEFINE_GLOBAL(players)
DEFINE_GLOBAL(playeringame) DEFINE_GLOBAL(playeringame)
DEFINE_GLOBAL(PlayerClasses) DEFINE_GLOBAL(PlayerClasses)

View file

@ -64,6 +64,7 @@ void G_Ticker (void);
bool G_Responder (event_t* ev); bool G_Responder (event_t* ev);
void G_ScreenShot (char *filename); void G_ScreenShot (char *filename);
void G_StartSlideshow(FName whichone);
FString G_BuildSaveName (const char *prefix, int slot); FString G_BuildSaveName (const char *prefix, int slot);

View file

@ -62,6 +62,7 @@
#include "r_sky.h" #include "r_sky.h"
#include "gstrings.h" #include "gstrings.h"
#include "gi.h" #include "gi.h"
#include "g_game.h"
#include "sc_man.h" #include "sc_man.h"
#include "c_bind.h" #include "c_bind.h"
#include "info.h" #include "info.h"
@ -4961,6 +4962,7 @@ enum EACSFunctions
ACSF_Round, ACSF_Round,
ACSF_Ceil, ACSF_Ceil,
ACSF_ScriptCall, ACSF_ScriptCall,
ACSF_StartSlideshow,
// OpenGL stuff // OpenGL stuff
@ -6808,6 +6810,10 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_ScriptCall: case ACSF_ScriptCall:
return ScriptCall(argCount, args); return ScriptCall(argCount, args);
case ACSF_StartSlideshow:
G_StartSlideshow(FName(FBehavior::StaticLookupString(args[0])));
break;
default: default:
break; break;
} }

View file

@ -491,7 +491,7 @@ struct LevelLocals native
native int GetUDMFInt(int type, int index, Name key); native int GetUDMFInt(int type, int index, Name key);
native double GetUDMFFloat(int type, int index, Name key); native double GetUDMFFloat(int type, int index, Name key);
native bool ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0); native bool ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0);
native static void StartSlideshow(Name whichone = 'none');
} }
struct StringTable native struct StringTable native

View file

@ -74,6 +74,11 @@ class ListMenu : Menu
} }
} }
} }
// notify all items that the menu was just created.
for(int i=0;i<mDesc.mItems.Size(); i++)
{
mDesc.mItems[i].OnMenuCreated();
}
} }
//============================================================================= //=============================================================================

View file

@ -40,6 +40,7 @@ class MenuItemBase : Object native ui version("2.4")
double GetY() { return mYpos; } double GetY() { return mYpos; }
double GetX() { return mXpos; } double GetX() { return mXpos; }
void SetX(double x) { mXpos = x; } void SetX(double x) { mXpos = x; }
void OnMenuCreated() {}
} }
// this is only used to parse font color ranges in MENUDEF // this is only used to parse font color ranges in MENUDEF

View file

@ -107,6 +107,12 @@ class OptionMenu : Menu
DontDim = desc.mDontDim; DontDim = desc.mDontDim;
if (mDesc != NULL && mDesc.mSelectedItem == -1) mDesc.mSelectedItem = FirstSelectable(); if (mDesc != NULL && mDesc.mSelectedItem == -1) mDesc.mSelectedItem = FirstSelectable();
mDesc.CalcIndent(); mDesc.CalcIndent();
// notify all items that the menu was just created.
for(int i=0;i<mDesc.mItems.Size(); i++)
{
mDesc.mItems[i].OnMenuCreated();
}
} }

View file

@ -807,7 +807,7 @@ class SlideshowStarter : DummyStrifeItem
{ {
override bool TryPickup (in out Actor toucher) override bool TryPickup (in out Actor toucher)
{ {
gameaction = ga_slideshow; Level.StartSlideshow();
if (level.levelnum == 10) if (level.levelnum == 10)
{ {
toucher.GiveInventoryType ("QuestItem17"); toucher.GiveInventoryType ("QuestItem17");