mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Added support for Risen3D/PrBoom+'s MUSINFO lump.
SVN r2366 (trunk)
This commit is contained in:
parent
2aa7cdc5a8
commit
4d86ebddf9
6 changed files with 97 additions and 3 deletions
|
@ -239,6 +239,7 @@ struct FOptionalMapinfoDataPtr
|
|||
};
|
||||
|
||||
typedef TMap<FName, FOptionalMapinfoDataPtr> FOptData;
|
||||
typedef TMap<int, FName> FMusicMap;
|
||||
|
||||
struct level_info_t
|
||||
{
|
||||
|
@ -298,6 +299,7 @@ struct level_info_t
|
|||
float teamdamage;
|
||||
|
||||
FOptData optdata;
|
||||
FMusicMap MusicMap;
|
||||
|
||||
TArray<FSpecialAction> specialactions;
|
||||
|
||||
|
|
|
@ -4290,6 +4290,11 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
|
|||
mthing->args[0] = mthing->type - 14000;
|
||||
mthing->type = 14065;
|
||||
}
|
||||
else if (mthing->type >= 14101 && mthing->type <= 14164)
|
||||
{
|
||||
mthing->args[0] = mthing->type - 14100;
|
||||
mthing->type = 14165;
|
||||
}
|
||||
// find which type to spawn
|
||||
i = DoomEdMap.FindType (mthing->type);
|
||||
|
||||
|
|
|
@ -2111,3 +2111,82 @@ void AAmbientSound::Deactivate (AActor *activator)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_ParseMusInfo
|
||||
// Parses MUSINFO lump.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_ParseMusInfo()
|
||||
{
|
||||
int lastlump = 0, lump;
|
||||
|
||||
while ((lump = Wads.FindLump ("MUSINFO", &lastlump)) != -1)
|
||||
{
|
||||
FScanner sc(lump);
|
||||
|
||||
while (sc.GetString())
|
||||
{
|
||||
level_info_t *map = FindLevelInfo(sc.String);
|
||||
|
||||
if (map == NULL)
|
||||
{
|
||||
// Don't abort for invalid maps
|
||||
sc.ScriptMessage("Unknown map '%s'", sc.String);
|
||||
}
|
||||
while (sc.CheckNumber())
|
||||
{
|
||||
int index = sc.Number;
|
||||
sc.MustGetString();
|
||||
if (index > 0)
|
||||
{
|
||||
FName music = sc.String;
|
||||
if (map != NULL)
|
||||
{
|
||||
map->MusicMap[index] = music;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Music changer. Uses the sector action class to do its job
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
class AMusicChanger : public ASectorAction
|
||||
{
|
||||
DECLARE_CLASS (AMusicChanger, ASectorAction)
|
||||
public:
|
||||
virtual bool TriggerAction (AActor *triggerer, int activationType);
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(AMusicChanger)
|
||||
|
||||
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("*");
|
||||
}
|
||||
}
|
||||
return Super::TriggerAction (triggerer, activationType);
|
||||
}
|
||||
|
|
|
@ -323,6 +323,7 @@ void S_InitData ()
|
|||
LastLocalSndInfo = LastLocalSndSeq = "";
|
||||
S_ParseSndInfo ();
|
||||
S_ParseSndSeq (-1);
|
||||
S_ParseMusInfo();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -353,6 +353,7 @@ void S_ShrinkPlayerSoundLists ();
|
|||
void S_UnloadSound (sfxinfo_t *sfx);
|
||||
sfxinfo_t *S_LoadSound(sfxinfo_t *sfx);
|
||||
unsigned int S_GetMSLength(FSoundID sound);
|
||||
void S_ParseMusInfo();
|
||||
|
||||
// [RH] Prints sound debug info to the screen.
|
||||
// Modelled after Hexen's noise cheat.
|
||||
|
@ -373,9 +374,9 @@ enum EMidiDevice
|
|||
{
|
||||
MDEV_DEFAULT = -1,
|
||||
MDEV_MMAPI = 0,
|
||||
MDEV_TIMIDITY = 1,
|
||||
MDEV_OPL = 2,
|
||||
MDEV_FMOD = 3,
|
||||
MDEV_OPL = 1,
|
||||
MDEV_FMOD = 2,
|
||||
MDEV_TIMIDITY = 3,
|
||||
};
|
||||
|
||||
typedef TMap<FName, int> MidiDeviceMap;
|
||||
|
|
|
@ -73,3 +73,9 @@ ACTOR SecActHitFakeFloor : SectorAction 9989 native
|
|||
{
|
||||
}
|
||||
|
||||
// Music changer ----------------------------------
|
||||
|
||||
ACTOR MusicChanger : SectorAction 14165 native
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue