@@ -2008,6 +2008,14 @@ bool ACS_CF_SectorDamage(ACS_CF_ARGS)
20082008 return false ;
20092009}
20102010
2011+ // Gets line frontsector, or polyobject sector otherwise
2012+ inline static sector_t &ACS_getLineSector (const line_t &line)
2013+ {
2014+ return !P_LevelIsVanillaHexen () && line.intflags & MLI_DYNASEGLINE ?
2015+ *R_PointInSubsector (line.soundorg .x , line.soundorg .y )->sector :
2016+ *line.frontsector ;
2017+ }
2018+
20112019//
20122020// ACS_CF_SectorSound
20132021//
@@ -2023,13 +2031,7 @@ bool ACS_CF_SectorSound(ACS_CF_ARGS)
20232031 // if script started from a line, use the frontsector's sound origin
20242032 const line_t *const line = info->line ;
20252033 if (line)
2026- {
2027- sector_t *const sector = !P_LevelIsVanillaHexen () && line->intflags & MLI_DYNASEGLINE ?
2028- R_PointInSubsector (line->soundorg .x , line->soundorg .y )->sector :
2029- line->frontsector ;
2030-
2031- src = &(sector->soundorg );
2032- }
2034+ src = &ACS_getLineSector (*line).soundorg ;
20332035 else
20342036 src = nullptr ;
20352037
@@ -2739,8 +2741,8 @@ bool ACS_CF_SoundSequence(ACS_CF_ARGS)
27392741 const char *snd = thread->scopeMap ->getString (argV[0 ])->str ;
27402742 sector_t *sec;
27412743
2742- if (info->line && (sec = info-> line -> frontsector ) )
2743- S_StartSectorSequenceName (sec , snd, SEQ_ORIGIN_SECTOR_F );
2744+ if (info->line )
2745+ S_StartSectorSequenceName (& ACS_getLineSector (*info-> line ) , snd, SEQ_ORIGIN_SECTOR_F );
27442746 else
27452747 S_StartSequenceName (nullptr , snd, SEQ_ORIGIN_OTHER , -1 );
27462748
0 commit comments