@@ -1558,6 +1558,7 @@ func loadMotif(def string) (*Motif, error) {
15581558 var iniFile * ini.File
15591559 var userIniFile * ini.File
15601560 var defaultOnlyIni * ini.File
1561+ var motifText string
15611562
15621563 if err := LoadFile (& def , []string {def , "" , "data/" }, "" , func (filename string ) error {
15631564 def = filename
@@ -1568,10 +1569,11 @@ func loadMotif(def string) (*Motif, error) {
15681569 return fmt .Errorf ("Failed to discover external mod system.def files: %w" , err )
15691570 }
15701571
1571- inputBytes , err := LoadText (filename )
1572+ inputText , err := LoadText (filename )
15721573 if err != nil {
15731574 return fmt .Errorf ("Failed to load text from %s: %w" , filename , err )
15741575 }
1576+ motifText = NormalizeNewlines (inputText )
15751577
15761578 var modsConcat strings.Builder
15771579 for _ , p := range modSystemDefs {
@@ -1588,7 +1590,7 @@ func loadMotif(def string) (*Motif, error) {
15881590
15891591 // Preprocess and load INI sources from memory.
15901592 // Motif file overrides mods
1591- baseTxt := NormalizeNewlines ( string ( inputBytes ))
1593+ baseTxt := motifText
15921594 modsTxt := modsConcat .String ()
15931595 var combined string
15941596 if modsTxt != "" {
@@ -1599,22 +1601,22 @@ func loadMotif(def string) (*Motif, error) {
15991601 } else {
16001602 combined = baseTxt
16011603 }
1602- normalizedInput := [] byte ( preprocessINIContent (combined ) )
1603- normalizedDefault := [] byte ( preprocessINIContent (NormalizeNewlines (string (defaultMotif ) )))
1604+ normalizedInput := preprocessINIContent (combined )
1605+ normalizedDefault := preprocessINIContent (NormalizeNewlines (string (defaultMotif )))
16041606
16051607 // Defaults-only baseline
1606- defaultOnlyIni , err = ini . LoadSources ( baseOptions , normalizedDefault )
1608+ defaultOnlyIni , err = LoadINIText ( normalizedDefault , baseOptions )
16071609 if err != nil {
16081610 return fmt .Errorf ("Failed to load defaults-only INI from memory: %w" , err )
16091611 }
16101612
16111613 // merged starts as defaults, then overlay user (first-wins for duplicates in user)
1612- iniFile , err = ini . LoadSources ( baseOptions , normalizedDefault )
1614+ iniFile , err = LoadINIText ( normalizedDefault , baseOptions )
16131615 if err != nil {
16141616 return fmt .Errorf ("Failed to load merged baseline INI from memory: %w" , err )
16151617 }
16161618
1617- userIniFile , err = ini . LoadSources ( userOptions , normalizedInput )
1619+ userIniFile , err = LoadINIText ( normalizedInput , userOptions )
16181620 if err != nil {
16191621 return fmt .Errorf ("Failed to load user INI source from memory: %w" , err )
16201622 }
@@ -1834,11 +1836,7 @@ func loadMotif(def string) (*Motif, error) {
18341836 m .loadFiles ()
18351837 sys .keepAlive ()
18361838
1837- str , err := LoadText (def )
1838- if err != nil {
1839- return nil , err
1840- }
1841- lines , i := SplitAndTrim (str , "\n " ), 0
1839+ lines , i := SplitAndTrim (motifText , "\n " ), 0
18421840 m .AnimTable = ReadAnimationTable (m .Def , m .Sff , & m .Sff .palList , lines , & i , true )
18431841 i = 0
18441842
@@ -3362,10 +3360,15 @@ func (me *MotifMenu) init(m *Motif) {
33623360 }
33633361 openPressed := sys .esc || sys .uiRawInput (pm .Menu .Cancel .Key , - 1 )
33643362
3365- if sys .escExit () || ( sys . netplay () && openPressed ) {
3366- if sys . netplay () {
3363+ if ! sys .sel . gameParams . PauseMenu {
3364+ if openPressed {
33673365 sys .esc = true
3366+ sys .endMatch = true
33683367 }
3368+ return
3369+ }
3370+
3371+ if sys .escExit () {
33693372 sys .endMatch = true
33703373 return
33713374 }
@@ -4823,7 +4826,7 @@ func (di *MotifDialogue) step(m *Motif) {
48234826 }
48244827
48254828 // If line is fully rendered, handle auto-switch after SwitchTime
4826- if di .lineFullyRendered {
4829+ if di .lineFullyRendered && di . wait <= 0 {
48274830 di .switchCounter ++
48284831 if di .switchCounter >= int (m .DialogueInfo .SwitchTime ) {
48294832 di .advanceLine (m )
0 commit comments