Tweak mouseover display to (partially) work during filtering

This commit is contained in:
2024-11-03 20:52:00 +00:00
parent feec061aa6
commit adca54c1ef
10 changed files with 361 additions and 349 deletions
+1 -17
View File
@@ -142,22 +142,6 @@ updateDisplaySections w cfig =
else id
cr = you w
-- filtpair i itms filtdescription mstr =
-- ( (i, filtsis)
-- , (i + 1, itms')
-- )
-- where
-- filtsis = fromMaybe mempty $ do
-- str <- mstr
-- return $
-- IM.singleton
-- 0
-- (SelectionInfo [filtdescription ++ "FILTER: " ++ str, numfiltitems] 2 True white 0)
-- itms' = fromMaybe itms $ do
-- str <- mstr
-- return $ IM.filter (plainRegex str) itms
-- numfiltitems = " " ++ show (length itms - length itms') ++ " FILTERED"
filterSectionsPair ::
String -> -- string at the end of the input
(String -> SelectionItem a -> Bool) ->
@@ -176,7 +160,7 @@ filterSectionsPair endstr filtfn itms filtdescription mfilt =
IM.singleton
0
$ SelectionInfo
[filtdescription ++ " FILTER:" ++ str ++ endstr, numfiltitems]
[filtdescription ++ " FILTER/" ++ str ++ endstr, numfiltitems]
2
True
white
+2 -2
View File
@@ -105,10 +105,10 @@ getRootItemBounds i inv = do
drawDIMouseOver :: World -> Picture
drawDIMouseOver w = fromMaybe mempty $ do
(_, i) <- w ^? hud . hudElement . subInventory . nsMouseOver . _Just
(j, i) <- w ^? hud . hudElement . subInventory . nsMouseOver . _Just
sss <- w ^? hud . hudElement . diSections
let idp = invDisplayParams w
return . color (withAlpha 0.2 white) $ selSecDrawCursorAt 15 idp curs sss (0, i)
return . color (withAlpha 0.2 white) $ selSecDrawCursorAt 15 idp curs sss (j, i)
where
curs = BackdropCursor
+2 -1
View File
@@ -203,7 +203,8 @@ inverseSelSecYint yint sss = do
then inverseSelSecYint (yint - l) othersss
else do
let ls = L.postscan (L.premap _siHeight L.sum) (_ssItems ss)
j <- L.fold (L.findIndex (\x -> x - _ssOffset ss > yint)) ls
--j <- L.fold (L.findIndex (\x -> x - _ssOffset ss > yint)) ls
(j,_) <- L.fold (L.find (\(_,x) -> x - _ssOffset ss > yint)) $ IM.toList ls
return (i, j)
inverseSelSecYintXPosCheck ::
+201 -181
View File
@@ -1,4 +1,4 @@
-- generated at 2022-07-14 22:58:49.919236742 UTC
-- generated at 2024-11-03 10:36:18.238246608 UTC
module Dodge.SoundLogic.ExternallyGeneratedSounds where
import Sound.Data
soundToVol :: SoundID -> Float
@@ -40,70 +40,74 @@ soundToVol v = case _getSoundID v of
34 -> 1000
35 -> 1000
36 -> 40
37 -> 2000
38 -> 100
39 -> 50
40 -> 2000
41 -> 50
42 -> 1000
43 -> 8000
44 -> 2000
37 -> 400
38 -> 2000
39 -> 100
40 -> 50
41 -> 2000
42 -> 50
43 -> 1000
44 -> 8000
45 -> 2000
46 -> 1000
47 -> 2000
48 -> 100
49 -> 40
46 -> 2000
47 -> 1000
48 -> 2000
49 -> 100
50 -> 40
51 -> 2000
52 -> 100
53 -> 500
54 -> 40
55 -> 300
51 -> 40
52 -> 2000
53 -> 100
54 -> 500
55 -> 40
56 -> 300
57 -> 2000
58 -> 1000
57 -> 300
58 -> 2000
59 -> 1000
60 -> 1000
61 -> 1000
62 -> 1000
63 -> 40
64 -> 50
65 -> 1000
66 -> 500
63 -> 1000
64 -> 40
65 -> 50
66 -> 1000
67 -> 500
68 -> 100
69 -> 1000
70 -> 20
71 -> 500
72 -> 300
73 -> 200
74 -> 500
75 -> 1000
68 -> 500
69 -> 100
70 -> 1000
71 -> 20
72 -> 500
73 -> 300
74 -> 200
75 -> 500
76 -> 1000
77 -> 500
78 -> 100
79 -> 1000
80 -> 2000
81 -> 2000
82 -> 500
77 -> 200
78 -> 1000
79 -> 2000
80 -> 500
81 -> 100
82 -> 1000
83 -> 2000
84 -> 100
85 -> 300
86 -> 1000
87 -> 200
88 -> 100
84 -> 2000
85 -> 500
86 -> 2000
87 -> 100
88 -> 300
89 -> 1000
90 -> 2000
91 -> 1000
92 -> 100
93 -> 200
94 -> 500
90 -> 200
91 -> 100
92 -> 1000
93 -> 2000
94 -> 1000
95 -> 100
96 -> 2000
97 -> 2000
98 -> 2000
99 -> 100
100 -> 200
96 -> 200
97 -> 500
98 -> 100
99 -> 2000
100 -> 2000
101 -> 2000
102 -> 200
103 -> 100
104 -> 200
_ -> 50
soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of
@@ -144,70 +148,74 @@ soundToOnomato v = case _getSoundID v of
34 -> "TRWNG"
35 -> "CRASH"
36 -> "TAPTIP"
37 -> "CHUGUGUG"
38 -> "SKWLL"
39 -> "HSSS"
40 -> "BOOM"
41 -> "HSS"
42 -> "TAKH"
43 -> "RINGGG"
44 -> "CRH"
45 -> "UGGAUGGA"
46 -> "CRUMPLE"
47 -> "CREUH"
48 -> "SMACK"
49 -> "CLICK"
50 -> "TIPTOP"
51 -> "CRUH"
52 -> "CHNKCHNKCHUNK"
53 -> "CLKCLK"
54 -> "TIPTAP"
55 -> "TNKTNKTNK"
56 -> "CHPCHPCHP"
57 -> "SCREE"
58 -> "DHDHL"
59 -> "BRAP"
60 -> "CRSK"
61 -> "CRNKL"
62 -> "TRNKL"
63 -> "TAPP"
64 -> "SHUHP"
65 -> "CRUMBL"
66 -> "DEDEDUM"
67 -> "TAK"
68 -> "SPLRT"
69 -> "CRISH"
70 -> "SWSH"
71 -> "BIPBIPBIP"
72 -> "BEP"
73 -> "CRSKRL"
74 -> "KRTNKL"
75 -> "CRSNK"
76 -> "TTRKL"
77 -> "DUDURAH"
78 -> "KKSQWL"
79 -> "CRMPL"
80 -> "CHUGUGUG"
81 -> "BANG"
82 -> "DEDA"
83 -> "WHSSH"
84 -> "HNH"
85 -> "BWAH"
86 -> "CRUNK"
87 -> "SQWLTCH"
88 -> "DRR"
89 -> "TRNKL"
90 -> "BRAP"
91 -> "BLPCHCH"
92 -> "SKLE"
93 -> "ZMM"
94 -> "WRRR"
95 -> "FWUMP"
96 -> "BRAHCHCH"
97 -> "BRPBRPBRP"
98 -> "WE-OH"
99 -> "FHP"
100 -> "QWLPH"
37 -> "CRNKCRNKCRNK"
38 -> "CHUGUGUG"
39 -> "SKWLL"
40 -> "HSSS"
41 -> "BOOM"
42 -> "HSS"
43 -> "TAKH"
44 -> "RINGGG"
45 -> "CRH"
46 -> "UGGAUGGA"
47 -> "CRUMPLE"
48 -> "CREUH"
49 -> "SMACK"
50 -> "CLICK"
51 -> "TIPTOP"
52 -> "CRUH"
53 -> "CHNKCHNKCHUNK"
54 -> "CLKCLK"
55 -> "TIPTAP"
56 -> "TNKTNKTNK"
57 -> "CHPCHPCHP"
58 -> "SCREE"
59 -> "DHDHL"
60 -> "BRAP"
61 -> "CRSK"
62 -> "CRNKL"
63 -> "TRNKL"
64 -> "TAPP"
65 -> "SHUHP"
66 -> "CRUMBL"
67 -> "DEDEDUM"
68 -> "TAK"
69 -> "SPLRT"
70 -> "CRISH"
71 -> "SWSH"
72 -> "BIPBIPBIP"
73 -> "BEP"
74 -> "CRSKRL"
75 -> "KRTNKL"
76 -> "CRSNK"
77 -> "SHTCK"
78 -> "TTRKL"
79 -> "UGGAUGGA"
80 -> "DUDURAH"
81 -> "KKSQWL"
82 -> "CRMPL"
83 -> "CHUGUGUG"
84 -> "BANG"
85 -> "DEDA"
86 -> "WHSSH"
87 -> "HNH"
88 -> "BWAH"
89 -> "CRUNK"
90 -> "SQWLTCH"
91 -> "DRR"
92 -> "TRNKL"
93 -> "BRAP"
94 -> "BLPCHCH"
95 -> "SKLE"
96 -> "ZMM"
97 -> "WRRR"
98 -> "FWUMP"
99 -> "BRAHCHCH"
100 -> "BRPBRPBRP"
101 -> "WE-OH"
102 -> "THCK"
103 -> "FHP"
104 -> "QWLPH"
_ -> error "unitialised sound"
soundPathList :: [String]
soundPathList =
@@ -248,6 +256,7 @@ soundPathList =
, "metal7.TRWNG.1000.wav"
, "stone1.CRASH.1000.wav"
, "twoStep1.TAPTIP.40.wav"
, "wrench1.CRNKCRNKCRNK.400.wav"
, "seagullChatter.CHUGUGUG.2000.wav"
, "blood4.SKWLL.100.wav"
, "foamSprayLoop.HSSS.50.wav"
@@ -287,7 +296,9 @@ soundPathList =
, "gut6.CRSKRL.200.wav"
, "smallGlass2.KRTNKL.500.wav"
, "glassShat1.CRSNK.1000.wav"
, "disconnectItem.SHTCK.200.wav"
, "metal5.TTRKL.1000.wav"
, "seagullBarkTransformed.UGGAUGGA.2000.wav"
, "eject.DUDURAH.500.wav"
, "blood3.KKSQWL.100.wav"
, "stone2.CRMPL.1000.wav"
@@ -310,6 +321,7 @@ soundPathList =
, "shotgun.BRAHCHCH.2000.wav"
, "mini.BRPBRPBRP.2000.wav"
, "seagullWhistle.WE-OH.2000.wav"
, "connectItem.THCK.200.wav"
, "whiteNoiseFadeIn.FHP.100.wav"
, "gut1.QWLPH.200.wav"
]
@@ -387,131 +399,139 @@ stone1S :: SoundID
stone1S = SoundID 35
twoStep1S :: SoundID
twoStep1S = SoundID 36
wrench1S :: SoundID
wrench1S = SoundID 37
seagullChatterS :: SoundID
seagullChatterS = SoundID 37
seagullChatterS = SoundID 38
blood4S :: SoundID
blood4S = SoundID 38
blood4S = SoundID 39
foamSprayLoopS :: SoundID
foamSprayLoopS = SoundID 39
foamSprayLoopS = SoundID 40
explosionS :: SoundID
explosionS = SoundID 40
explosionS = SoundID 41
foamSprayFadeOutS :: SoundID
foamSprayFadeOutS = SoundID 41
foamSprayFadeOutS = SoundID 42
tap2S :: SoundID
tap2S = SoundID 42
tap2S = SoundID 43
tinitusS :: SoundID
tinitusS = SoundID 43
tinitusS = SoundID 44
seagullCry1S :: SoundID
seagullCry1S = SoundID 44
seagullCry1S = SoundID 45
seagullBarkS :: SoundID
seagullBarkS = SoundID 45
seagullBarkS = SoundID 46
stone3S :: SoundID
stone3S = SoundID 46
stone3S = SoundID 47
seagullCry2S :: SoundID
seagullCry2S = SoundID 47
seagullCry2S = SoundID 48
hit1S :: SoundID
hit1S = SoundID 48
hit1S = SoundID 49
click1S :: SoundID
click1S = SoundID 49
click1S = SoundID 50
twoStepSlowS :: SoundID
twoStepSlowS = SoundID 50
twoStepSlowS = SoundID 51
seagullCryS :: SoundID
seagullCryS = SoundID 51
seagullCryS = SoundID 52
crankSlowS :: SoundID
crankSlowS = SoundID 52
crankSlowS = SoundID 53
primeS :: SoundID
primeS = SoundID 53
primeS = SoundID 54
twoStepS :: SoundID
twoStepS = SoundID 54
twoStepS = SoundID 55
reloadS :: SoundID
reloadS = SoundID 55
reloadS = SoundID 56
reload1S :: SoundID
reload1S = SoundID 56
reload1S = SoundID 57
tone440sawtoothS :: SoundID
tone440sawtoothS = SoundID 57
tone440sawtoothS = SoundID 58
metal3S :: SoundID
metal3S = SoundID 58
metal3S = SoundID 59
tap3S :: SoundID
tap3S = SoundID 59
tap3S = SoundID 60
glassShat4S :: SoundID
glassShat4S = SoundID 60
glassShat4S = SoundID 61
glassShat2S :: SoundID
glassShat2S = SoundID 61
glassShat2S = SoundID 62
metal1S :: SoundID
metal1S = SoundID 62
metal1S = SoundID 63
foot3S :: SoundID
foot3S = SoundID 63
foot3S = SoundID 64
pickUpS :: SoundID
pickUpS = SoundID 64
pickUpS = SoundID 65
stone5S :: SoundID
stone5S = SoundID 65
stone5S = SoundID 66
dededumS :: SoundID
dededumS = SoundID 66
dededumS = SoundID 67
tap1S :: SoundID
tap1S = SoundID 67
tap1S = SoundID 68
blood1S :: SoundID
blood1S = SoundID 68
blood1S = SoundID 69
metal4S :: SoundID
metal4S = SoundID 69
metal4S = SoundID 70
knifeS :: SoundID
knifeS = SoundID 70
knifeS = SoundID 71
computerBeepingS :: SoundID
computerBeepingS = SoundID 71
computerBeepingS = SoundID 72
tone440S :: SoundID
tone440S = SoundID 72
tone440S = SoundID 73
gut6S :: SoundID
gut6S = SoundID 73
gut6S = SoundID 74
smallGlass2S :: SoundID
smallGlass2S = SoundID 74
smallGlass2S = SoundID 75
glassShat1S :: SoundID
glassShat1S = SoundID 75
glassShat1S = SoundID 76
disconnectItemS :: SoundID
disconnectItemS = SoundID 77
metal5S :: SoundID
metal5S = SoundID 76
metal5S = SoundID 78
seagullBarkTransformedS :: SoundID
seagullBarkTransformedS = SoundID 79
ejectS :: SoundID
ejectS = SoundID 77
ejectS = SoundID 80
blood3S :: SoundID
blood3S = SoundID 78
blood3S = SoundID 81
stone2S :: SoundID
stone2S = SoundID 79
stone2S = SoundID 82
seagullChatter1S :: SoundID
seagullChatter1S = SoundID 80
seagullChatter1S = SoundID 83
bangS :: SoundID
bangS = SoundID 81
bangS = SoundID 84
dedaS :: SoundID
dedaS = SoundID 82
dedaS = SoundID 85
missileLaunchS :: SoundID
missileLaunchS = SoundID 83
missileLaunchS = SoundID 86
gruntS :: SoundID
gruntS = SoundID 84
gruntS = SoundID 87
sineRaisePitchOneSecS :: SoundID
sineRaisePitchOneSecS = SoundID 85
sineRaisePitchOneSecS = SoundID 88
metal2S :: SoundID
metal2S = SoundID 86
metal2S = SoundID 89
gut5S :: SoundID
gut5S = SoundID 87
gut5S = SoundID 90
slideDoorS :: SoundID
slideDoorS = SoundID 88
slideDoorS = SoundID 91
metal6S :: SoundID
metal6S = SoundID 89
metal6S = SoundID 92
autoGunS :: SoundID
autoGunS = SoundID 90
autoGunS = SoundID 93
oldMachineBootS :: SoundID
oldMachineBootS = SoundID 91
oldMachineBootS = SoundID 94
blood6S :: SoundID
blood6S = SoundID 92
blood6S = SoundID 95
buzzS :: SoundID
buzzS = SoundID 93
buzzS = SoundID 96
fireLoudS :: SoundID
fireLoudS = SoundID 94
fireLoudS = SoundID 97
tap4S :: SoundID
tap4S = SoundID 95
tap4S = SoundID 98
shotgunS :: SoundID
shotgunS = SoundID 96
shotgunS = SoundID 99
miniS :: SoundID
miniS = SoundID 97
miniS = SoundID 100
seagullWhistleS :: SoundID
seagullWhistleS = SoundID 98
seagullWhistleS = SoundID 101
connectItemS :: SoundID
connectItemS = SoundID 102
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 99
whiteNoiseFadeInS = SoundID 103
gut1S :: SoundID
gut1S = SoundID 100
gut1S = SoundID 104
+3 -1
View File
@@ -23,7 +23,9 @@ import qualified IntMapHelp as IM
testStringInit :: Universe -> [String]
testStringInit u = [show $ u ^? uvWorld . hud . hudElement . diSelection . _Just
, show $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crManipulation . manObject
, show . fmap (fmap _siPictures) $ u ^? uvWorld . hud . hudElement . diSections . ix (-1) . ssItems
, show $ u ^? uvWorld . hud . hudElement . subInventory . nsMouseOver . _Just
, show $ fmap fst $ IM.lookupMin =<< (u ^? uvWorld . hud . hudElement . diSections . ix 0 . ssItems)
-- , show . fmap (fmap _siPictures) $ u ^? uvWorld . hud . hudElement . diSections . ix (-1) . ssItems
]
-- <> [[toEnum (i+j * 32) | i <- [0..31]] | j <- [0..7]]
-- <> map show (IM.elems (L.postscan (L.premap _siHeight L.sum)
+3 -2
View File
@@ -2,6 +2,7 @@ module Dodge.Update.Input.InGame (
updateUseInputInGame,
) where
import Dodge.SoundLogic
import Control.Applicative
import qualified Data.IntMap.Strict as IM
import Data.List (sort)
@@ -310,8 +311,6 @@ toggleTweakInv w = case w ^? hud . hudElement . subInventory of
where
thepointer = hud . hudElement . subInventory
-- mi = 0 <$ (yourSelectedItem w >>= (^? itTweaks . tweakParams . ix 0))
tryCombine ::
IM.IntMap (SelectionSection CombinableItem) ->
Maybe (Int, Int) ->
@@ -320,9 +319,11 @@ tryCombine ::
tryCombine sss msel w = fromMaybe w $ do
(i, j) <- msel
CombinableItem is it _ <- sss ^? ix i . ssItems . ix j . siPayload
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
return $
snd (createItemYou it (foldr (destroyInvItem 0) w (sort is)))
& cWorld . lWorld . creatures . ix 0 . crHammerPosition .~ HammerDown
& soundStart InventorySound p wrench1S Nothing
maybeExitCombine :: Universe -> Universe
maybeExitCombine u