mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- 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:
parent
fbcf1b2c45
commit
6db355a947
8 changed files with 37 additions and 3 deletions
|
@ -147,6 +147,7 @@ CVAR(Int, nametagcolor, CR_GOLD, CVAR_ARCHIVE)
|
|||
|
||||
gameaction_t gameaction;
|
||||
gamestate_t gamestate = GS_STARTUP;
|
||||
FName SelectedSlideshow; // what to start when ga_slideshow
|
||||
|
||||
int paused;
|
||||
bool pauseext;
|
||||
|
@ -1119,7 +1120,7 @@ void G_Ticker ()
|
|||
G_DoCompleted ();
|
||||
break;
|
||||
case ga_slideshow:
|
||||
if (gamestate == GS_LEVEL) F_StartIntermission(level.info->slideshow, FSTATE_InLevel);
|
||||
if (gamestate == GS_LEVEL) F_StartIntermission(SelectedSlideshow, FSTATE_InLevel);
|
||||
break;
|
||||
case ga_worlddone:
|
||||
G_DoWorldDone ();
|
||||
|
@ -2983,6 +2984,20 @@ bool G_CheckDemoStatus (void)
|
|||
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(playeringame)
|
||||
DEFINE_GLOBAL(PlayerClasses)
|
||||
|
|
|
@ -64,6 +64,7 @@ void G_Ticker (void);
|
|||
bool G_Responder (event_t* ev);
|
||||
|
||||
void G_ScreenShot (char *filename);
|
||||
void G_StartSlideshow(FName whichone);
|
||||
|
||||
FString G_BuildSaveName (const char *prefix, int slot);
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include "r_sky.h"
|
||||
#include "gstrings.h"
|
||||
#include "gi.h"
|
||||
#include "g_game.h"
|
||||
#include "sc_man.h"
|
||||
#include "c_bind.h"
|
||||
#include "info.h"
|
||||
|
@ -4961,6 +4962,7 @@ enum EACSFunctions
|
|||
ACSF_Round,
|
||||
ACSF_Ceil,
|
||||
ACSF_ScriptCall,
|
||||
ACSF_StartSlideshow,
|
||||
|
||||
|
||||
// OpenGL stuff
|
||||
|
@ -6808,6 +6810,10 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
case ACSF_ScriptCall:
|
||||
return ScriptCall(argCount, args);
|
||||
|
||||
case ACSF_StartSlideshow:
|
||||
G_StartSlideshow(FName(FBehavior::StaticLookupString(args[0])));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -491,7 +491,7 @@ struct LevelLocals native
|
|||
native int GetUDMFInt(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 static void StartSlideshow(Name whichone = 'none');
|
||||
}
|
||||
|
||||
struct StringTable native
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -40,6 +40,7 @@ class MenuItemBase : Object native ui version("2.4")
|
|||
double GetY() { return mYpos; }
|
||||
double GetX() { return mXpos; }
|
||||
void SetX(double x) { mXpos = x; }
|
||||
void OnMenuCreated() {}
|
||||
}
|
||||
|
||||
// this is only used to parse font color ranges in MENUDEF
|
||||
|
|
|
@ -107,6 +107,12 @@ class OptionMenu : Menu
|
|||
DontDim = desc.mDontDim;
|
||||
if (mDesc != NULL && mDesc.mSelectedItem == -1) mDesc.mSelectedItem = FirstSelectable();
|
||||
mDesc.CalcIndent();
|
||||
|
||||
// notify all items that the menu was just created.
|
||||
for(int i=0;i<mDesc.mItems.Size(); i++)
|
||||
{
|
||||
mDesc.mItems[i].OnMenuCreated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -807,7 +807,7 @@ class SlideshowStarter : DummyStrifeItem
|
|||
{
|
||||
override bool TryPickup (in out Actor toucher)
|
||||
{
|
||||
gameaction = ga_slideshow;
|
||||
Level.StartSlideshow();
|
||||
if (level.levelnum == 10)
|
||||
{
|
||||
toucher.GiveInventoryType ("QuestItem17");
|
||||
|
|
Loading…
Reference in a new issue