Refactor, add bullet modules and weapon effect modifiers
This commit is contained in:
+43
-15
@@ -35,10 +35,11 @@ drawInventory w = case _inventoryMode w of
|
||||
++ displayInv 0 w
|
||||
TweakInventory ->
|
||||
mCurs it w
|
||||
++ [cursorAt 120 col 5 iPos w]
|
||||
++ [cursorAt 120 col 5 0 iPos w
|
||||
,cursorsZ w iPos it
|
||||
]
|
||||
++ displayInv 0 w
|
||||
++ displayMidList w (ammoTweakStrings it) "TWEAK"
|
||||
++ mCurs it w
|
||||
CombineInventory -> displayInv 0 w ++ invHead w "COMBINE"
|
||||
InspectInventory -> displayInv 0 w ++ invHead w "INSPECT"
|
||||
where
|
||||
@@ -47,22 +48,47 @@ drawInventory w = case _inventoryMode w of
|
||||
it = yourItem w
|
||||
col = itCol it
|
||||
|
||||
cursorsZ :: World -> Int -> Item -> Picture
|
||||
cursorsZ w ipos it = case it ^? wpAmmo . amParamSel of
|
||||
Nothing -> winScale w $ zDraw sp (155- hw, hh - 77.5)
|
||||
Just jpos -> winScale w $ zDraw sp (155 - hw, hh - (20 * fromIntegral jpos + 77.5))
|
||||
where
|
||||
hh = halfHeight w
|
||||
hw = halfWidth w
|
||||
sp = (125 - hw, hh - (20 * fromIntegral ipos + 17.5))
|
||||
|
||||
topInvCursor :: Color -> Int -> World -> [Picture]
|
||||
topInvCursor col iPos w
|
||||
| ButtonRight `S.member` _mouseButtons w =
|
||||
[cursorAt 100 col 5 iPos w
|
||||
,openCursorAt 20 col 105 iPos w]
|
||||
| otherwise = [ openCursorAt 120 col 5 iPos w ]
|
||||
[cursorAt 100 col 5 0 iPos w
|
||||
,openCursorAt 20 col 105 0 iPos w]
|
||||
| otherwise = [ openCursorAt 120 col 5 0 iPos w ]
|
||||
|
||||
ammoTweakStrings :: Item -> [String]
|
||||
ammoTweakStrings it = case it ^? wpAmmo . amPjMove of
|
||||
ammoTweakStrings it = case it ^? wpAmmo . amPjParams of
|
||||
Just l -> map pjTweakString l
|
||||
_ -> ["NOT TWEAKABLE"]
|
||||
|
||||
mCurs :: Item -> World -> [Picture]
|
||||
mCurs it w = case it ^? wpAmmo . amParamSel of
|
||||
Nothing -> []
|
||||
Just i -> [openCursorAt 120 white 200 i w]
|
||||
Just i
|
||||
| ButtonRight `S.member` _mouseButtons w ->
|
||||
[cursorAt x white y 60 i w
|
||||
,openCursorAt 20 white (x+y) 60 i w
|
||||
]
|
||||
| otherwise -> [openCursorAt 140 white 155 60 i w]
|
||||
where
|
||||
x = 117.5
|
||||
y = 155
|
||||
|
||||
zDraw :: Point2 -> Point2 -> Picture
|
||||
zDraw (x,y) (a,b) = line
|
||||
[(x,y)
|
||||
,(0.5 * (x+a), y)
|
||||
,(0.5 * (x+a), b)
|
||||
,(a, b)
|
||||
]
|
||||
|
||||
pjTweakString :: PjParam -> String
|
||||
pjTweakString pj = _pjDisplayParam pj $ _pjIntParam pj
|
||||
@@ -70,11 +96,11 @@ pjTweakString pj = _pjDisplayParam pj $ _pjIntParam pj
|
||||
displayMidList :: World -> [String] -> String -> [Picture]
|
||||
displayMidList w strs s =
|
||||
invHead w s
|
||||
++ renderListAt (200,0) (map (,white) strs) w
|
||||
++ renderListAt (150,-60) (map (,white) strs) w
|
||||
|
||||
invHead :: World -> String -> [Picture]
|
||||
invHead w s = [winScale w . translate (-150) (150-halfHeight w)
|
||||
. dShadCol white . scale 0.5 0.5 $ text s
|
||||
invHead w s = [winScale w . translate (-130) (halfHeight w - 40)
|
||||
. dShadCol white . scale 0.4 0.4 $ text s
|
||||
]
|
||||
|
||||
displayListTopLeft :: [(String,Color)] -> World -> [Picture]
|
||||
@@ -200,17 +226,18 @@ dShadCol c p = pictures
|
||||
]
|
||||
|
||||
drawListCursor :: Color -> Int -> World -> Picture
|
||||
drawListCursor c = openCursorAt 120 c 5
|
||||
drawListCursor c = openCursorAt 120 c 5 0
|
||||
|
||||
openCursorAt
|
||||
:: Float -- ^ Width
|
||||
-> Color
|
||||
-> Float -- ^ x offset
|
||||
-> Float -- ^ y offset
|
||||
-> Int -- ^ y offset (discrete)
|
||||
-> World
|
||||
-> Picture
|
||||
openCursorAt wth col xoff yint w = winScale w
|
||||
. translate (xoff-halfWidth w) (halfHeight w - (20* fromIntegral yint) - 20)
|
||||
openCursorAt wth col xoff yoff yint w = winScale w
|
||||
. translate (xoff-halfWidth w) (halfHeight w - (20* fromIntegral yint + yoff) - 20)
|
||||
$ lineCol
|
||||
[(( wth,12.5) ,withAlpha 0 col)
|
||||
,(( 0,12.5) ,col)
|
||||
@@ -221,11 +248,12 @@ cursorAt
|
||||
:: Float -- ^ Width
|
||||
-> Color
|
||||
-> Float -- ^ x offset
|
||||
-> Float -- ^ y offset
|
||||
-> Int -- ^ y offset (discrete)
|
||||
-> World
|
||||
-> Picture
|
||||
cursorAt wth col xoff yint w = winScale w
|
||||
. translate (xoff-halfWidth w) (halfHeight w - (20* fromIntegral yint) - 20)
|
||||
cursorAt wth col xoff yoff yint w = winScale w
|
||||
. translate (xoff-halfWidth w) (halfHeight w - (20* fromIntegral yint + yoff) - 20)
|
||||
. color col
|
||||
$ line
|
||||
[( wth,12.5)
|
||||
|
||||
Reference in New Issue
Block a user