mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-31 04:50:48 +00:00
- Fixed: Starting in a sector with a musinfo thing would not trigger the thing.
SVN r3313 (trunk)
This commit is contained in:
parent
e6e15be7e0
commit
66f86add05
3 changed files with 49 additions and 12 deletions
|
@ -665,6 +665,7 @@ void G_DoCompleted (void)
|
|||
else
|
||||
{
|
||||
|
||||
|
||||
level_info_t *nextinfo = FindLevelInfo (nextlevel);
|
||||
wminfo.next = nextinfo->mapname;
|
||||
wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->pname, FTexture::TEX_MiscPatch)];
|
||||
|
@ -1366,6 +1367,11 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
|
|||
<< level.maptime
|
||||
<< i;
|
||||
|
||||
if (SaveVersion >= 3313)
|
||||
{
|
||||
arc << level.nextmusic;
|
||||
}
|
||||
|
||||
// Hub transitions must keep the current total time
|
||||
if (!hubLoad)
|
||||
level.totaltime = i;
|
||||
|
|
|
@ -401,6 +401,7 @@ struct FLevelLocals
|
|||
int musicorder;
|
||||
int cdtrack;
|
||||
unsigned int cdid;
|
||||
int nextmusic; // For MUSINFO purposes
|
||||
char skypic1[9];
|
||||
char skypic2[9];
|
||||
|
||||
|
|
|
@ -293,6 +293,7 @@ float S_GetMusicVolume (const char *music)
|
|||
}
|
||||
|
||||
//==========================================================================
|
||||
|
||||
//
|
||||
// S_HashSounds
|
||||
//
|
||||
|
@ -2248,6 +2249,8 @@ class AMusicChanger : public ASectorAction
|
|||
DECLARE_CLASS (AMusicChanger, ASectorAction)
|
||||
public:
|
||||
virtual bool TriggerAction (AActor *triggerer, int activationType);
|
||||
virtual void Tick();
|
||||
virtual void PostBeginPlay();
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(AMusicChanger)
|
||||
|
@ -2256,19 +2259,46 @@ bool AMusicChanger::TriggerAction (AActor *triggerer, int activationType)
|
|||
{
|
||||
if (activationType & SECSPAC_Enter)
|
||||
{
|
||||
if (args[0] != 0)
|
||||
{
|
||||
FName *music = level.info->MusicMap.CheckKey(args[0]);
|
||||
|
||||
if (music != NULL)
|
||||
{
|
||||
S_ChangeMusic(music->GetChars(), args[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S_ChangeMusic("*");
|
||||
if (args[0] == 0 || level.info->MusicMap.CheckKey(args[0]))
|
||||
{
|
||||
level.nextmusic = args[0];
|
||||
reactiontime = 30;
|
||||
}
|
||||
}
|
||||
return Super::TriggerAction (triggerer, activationType);
|
||||
}
|
||||
|
||||
void AMusicChanger::Tick()
|
||||
{
|
||||
Super::Tick();
|
||||
if (reactiontime > -1 && --reactiontime == 0)
|
||||
{
|
||||
// Is it our music that's queued for being played?
|
||||
if (level.nextmusic == args[0])
|
||||
{
|
||||
if (args[0] != 0)
|
||||
{
|
||||
FName *music = level.info->MusicMap.CheckKey(args[0]);
|
||||
|
||||
if (music != NULL)
|
||||
{
|
||||
S_ChangeMusic(music->GetChars(), args[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S_ChangeMusic("*");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AMusicChanger::PostBeginPlay()
|
||||
{
|
||||
// The music changer should consider itself activated if the player
|
||||
// spawns in its sector as well as if it enters the sector during a P_TryMove.
|
||||
if (players[consoleplayer].mo && players[consoleplayer].mo->Sector == this->Sector)
|
||||
{
|
||||
TriggerAction(players[consoleplayer].mo, SECSPAC_Enter);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue