Modify analyser sounds
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Placement.Instance.Terminal
|
||||
, putTerminal'
|
||||
, simpleTermMessage
|
||||
, genTermMessage
|
||||
, topFlushStrings
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.LevelGen.Data
|
||||
@@ -86,27 +87,31 @@ simpleTermMessage :: [String] -> (GenParams -> TerminalParams)
|
||||
simpleTermMessage ss = const $ TerminalParams
|
||||
{_termDisplayedLines = []
|
||||
,_termFutureLines = TerminalLineEffect 0 termsound
|
||||
: map totermline (topflush ++ ss)
|
||||
: map totermline (topFlushStrings ss ++ ss)
|
||||
,_termMaxLines = 7
|
||||
,_termTitle = "TERMINAL"
|
||||
}
|
||||
where
|
||||
topflush = [replicate i ' ' ++ "*" | i <- [0,2 .. maximum (map length ss)]]
|
||||
totermline s = TerminalLineDisplay 0 (const (s,white))
|
||||
termsound subinv w' = soundStart TerminalSound tpos computerBeepingS Nothing w'
|
||||
where
|
||||
tpos = fromMaybe 0 $ w' ^? buttons . ix (_termID subinv) . btPos
|
||||
|
||||
topFlushStrings :: [String] -> [String]
|
||||
topFlushStrings = topFlush . maximum . map length
|
||||
|
||||
topFlush :: Int -> [String]
|
||||
topFlush twidth = [replicate i ' ' ++ "*" | i <- [0, max 1 $ twidth `div` 5 .. twidth]]
|
||||
|
||||
genTermMessage :: (GenParams -> [String]) -> (GenParams -> TerminalParams)
|
||||
genTermMessage f = \gp -> TerminalParams
|
||||
{_termDisplayedLines = []
|
||||
,_termFutureLines = termSoundLine computerBeepingS
|
||||
: map totermline (topflush (f gp) ++ f gp)
|
||||
: map totermline (topFlushStrings (f gp) ++ f gp)
|
||||
,_termMaxLines = 7
|
||||
,_termTitle = "TERMINAL"
|
||||
}
|
||||
where
|
||||
topflush ss = [replicate i ' ' ++ "*" | i <- [0,2 .. maximum (map length ss)]]
|
||||
totermline s = TerminalLineDisplay 0 (const (s,white))
|
||||
|
||||
termSoundLine :: SoundID -> TerminalLine
|
||||
|
||||
Reference in New Issue
Block a user