From 9137ef04f6c7b3195accfa6c2b0db6c592c9fad7 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 7 Aug 2010 04:32:18 +0000 Subject: [PATCH] - Added "SoundSequence" UDMF sector property. This is the name of the sound sequence to play for the sector. Note that this contrasts with sound sequence things in that it takes a name and not a number. Also, placing a sound sequence thing in a sector will override this property. SVN r2492 (trunk) --- src/namedef.h | 1 + src/p_buildmap.cpp | 1 + src/p_ceiling.cpp | 4 ++++ src/p_doors.cpp | 6 +++++- src/p_floor.cpp | 4 ++++ src/p_pillar.cpp | 8 ++++++++ src/p_plats.cpp | 8 ++++++++ src/p_saveg.cpp | 9 +++++++++ src/p_setup.cpp | 1 + src/p_udmf.cpp | 7 ++++++- src/r_defs.h | 1 + 11 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/namedef.h b/src/namedef.h index 4ee1e7c0f..94e0c97bd 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -417,6 +417,7 @@ xx(Gravity) xx(Lightcolor) xx(Fadecolor) xx(Desaturation) +xx(SoundSequence) xx(Silent) xx(Nofallingdamage) xx(Dropactors) diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 86d7575ad..afc6d5277 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -432,6 +432,7 @@ static void LoadSectors (sectortype *bsec) sec->lightlevel = (sec->GetPlaneLight(sector_t::floor) + sec->GetPlaneLight(sector_t::ceiling)) / 2; sec->seqType = -1; + sec->SeqName = NAME_None; sec->nextsec = -1; sec->prevsec = -1; sec->gravity = 1.f; diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 4dd072a06..c9aec4f37 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -65,6 +65,10 @@ void DCeiling::PlayCeilingSound () { SN_StartSequence (m_Sector, CHAN_CEILING, m_Sector->seqType, SEQ_PLATFORM, 0, false); } + else if (m_Sector->SeqName != NAME_None) + { + SN_StartSequence (m_Sector, CHAN_CEILING, m_Sector->SeqName, 0); + } else { if (m_Silent == 2) diff --git a/src/p_doors.cpp b/src/p_doors.cpp index ccfd61c5d..e82adbe4c 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -237,6 +237,10 @@ void DDoor::DoorSound (bool raise) const { SN_StartSequence (m_Sector, CHAN_CEILING, m_Sector->seqType, SEQ_DOOR, choice); } + else if (m_Sector->SeqName != NAME_None) + { + SN_StartSequence (m_Sector, CHAN_CEILING, m_Sector->SeqName, choice); + } else { const char *snd; @@ -424,7 +428,7 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, // Otherwise, just let the current one continue. // FIXME: This should be check if the sound sequence has separate up/down // paths, not if it was manually set. - if (sec->seqType == -1 || SN_CheckSequence(sec, CHAN_CEILING) == NULL) + if ((sec->seqType < 0 && sec->SeqName == NAME_None) || SN_CheckSequence(sec, CHAN_CEILING) == NULL) { door->DoorSound (false); } diff --git a/src/p_floor.cpp b/src/p_floor.cpp index fa3a01e09..3fff563f8 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -44,6 +44,10 @@ static void StartFloorSound (sector_t *sec) { SN_StartSequence (sec, CHAN_FLOOR, sec->seqType, SEQ_PLATFORM, 0); } + else if (sec->SeqName != NAME_None) + { + SN_StartSequence (sec, CHAN_FLOOR, sec->SeqName, 0); + } else { SN_StartSequence (sec, CHAN_FLOOR, "Floor", 0); diff --git a/src/p_pillar.cpp b/src/p_pillar.cpp index 1d2d5ba81..4faed647f 100644 --- a/src/p_pillar.cpp +++ b/src/p_pillar.cpp @@ -190,9 +190,17 @@ DPillar::DPillar (sector_t *sector, EPillar type, fixed_t speed, } if (sector->seqType >= 0) + { SN_StartSequence (sector, CHAN_FLOOR, sector->seqType, SEQ_PLATFORM, 0); + } + else if (sector->SeqName != NAME_None) + { + SN_StartSequence (sector, CHAN_FLOOR, sector->SeqName, 0); + } else + { SN_StartSequence (sector, CHAN_FLOOR, "Floor", 0); + } } bool EV_DoPillar (DPillar::EPillar type, int tag, fixed_t speed, fixed_t height, diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 87d9e6737..9e57f4baf 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -57,9 +57,17 @@ void DPlat::Serialize (FArchive &arc) void DPlat::PlayPlatSound (const char *sound) { if (m_Sector->seqType >= 0) + { SN_StartSequence (m_Sector, CHAN_FLOOR, m_Sector->seqType, SEQ_PLATFORM, 0); + } + else if (m_Sector->SeqName != NAME_None) + { + SN_StartSequence (m_Sector, CHAN_FLOOR, m_Sector->SeqName, 0); + } else + { SN_StartSequence (m_Sector, CHAN_FLOOR, sound, 0); + } } // diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 783517764..1ee18eeb2 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -348,6 +348,15 @@ void P_SerializeWorld (FArchive &arc) << sec->interpolations[2] << sec->interpolations[3]; + if (SaveVersion < 2492) + { + sec->SeqName = NAME_None; + } + else + { + arc << sec->SeqName; + } + sec->e->Serialize(arc); if (arc.IsStoring ()) { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 4df7a367e..a324a393a 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1407,6 +1407,7 @@ void P_LoadSectors (MapData * map) ss->thinglist = NULL; ss->touching_thinglist = NULL; // phares 3/14/98 ss->seqType = defSeqType; + ss->SeqName = NAME_None; ss->nextsec = -1; //jff 2/26/98 add fields to support locking out ss->prevsec = -1; // stair retriggering until build completes diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 6cbfccbef..c057c253c 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1024,7 +1024,7 @@ struct UDMFParser sec->SetYScale(sector_t::ceiling, FRACUNIT); sec->thinglist = NULL; sec->touching_thinglist = NULL; // phares 3/14/98 - sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL)? 0:-1; + sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1; sec->nextsec = -1; //jff 2/26/98 add fields to support locking out sec->prevsec = -1; // stair retriggering until build completes sec->heightsec = NULL; // sector used to get floor and ceiling height @@ -1175,6 +1175,11 @@ struct UDMFParser Flag(sec->Flags, SECF_FLOORDROP, key); continue; + case NAME_SoundSequence: + sec->SeqName = CheckString(key); + sec->seqType = -1; + continue; + default: break; } diff --git a/src/r_defs.h b/src/r_defs.h index 8e0d779d2..3c8ab46d7 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -640,6 +640,7 @@ struct sector_t int sky; short seqType; // this sector's sound sequence + FNameNoInit SeqName; // Sound sequence name. Setting seqType non-negative will override this. fixed_t soundorg[2]; // origin for any sounds played by the sector int validcount; // if == validcount, already checked