Continue work on refactoring equipment position
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -51,6 +51,7 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||
w
|
||||
& crpoint . crEquipment . at newp ?~ invid
|
||||
& crpoint . crInvEquipped . at invid ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||
& onequip itm cr
|
||||
& crpoint %~ assignNewHotkey invid
|
||||
MoveEquipment{_allocNewPos = newp, _allocOldPos = oldp} ->
|
||||
@@ -58,17 +59,22 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||
& crpoint . crEquipment . at newp ?~ invid
|
||||
& crpoint . crEquipment . at oldp .~ Nothing
|
||||
& crpoint . crInvEquipped . at invid ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||
SwapEquipment{_allocNewPos = newp, _allocOldPos = oldp, _allocSwapID = sid} ->
|
||||
w
|
||||
& crpoint . crEquipment . at newp ?~ invid
|
||||
& crpoint . crEquipment . at oldp ?~ sid
|
||||
& crpoint . crInvEquipped . at invid ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||
& crpoint . crInvEquipped . at sid ?~ oldp
|
||||
& crpoint . crInv . ix sid . itLocation . ilEquipPosition ?~ oldp
|
||||
ReplaceEquipment{_allocNewPos = newp, _allocRemoveID = rid} ->
|
||||
w
|
||||
& crpoint . crEquipment . at newp ?~ invid
|
||||
& crpoint . crInvEquipped . at invid ?~ newp
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||
& crpoint . crInvEquipped . at rid .~ Nothing
|
||||
& crpoint . crInv . ix rid . itLocation . ilEquipPosition .~ Nothing
|
||||
& onremove (itmat rid) cr
|
||||
& onequip itm cr
|
||||
& crpoint %~ removeHotkey rid
|
||||
@@ -77,6 +83,7 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||
w
|
||||
& crpoint . crEquipment . at oldp .~ Nothing
|
||||
& crpoint . crInvEquipped . at invid .~ Nothing
|
||||
& crpoint . crInv . ix invid . itLocation . ilEquipPosition .~ Nothing
|
||||
& onremove itm cr
|
||||
& crpoint %~ removeHotkey invid
|
||||
where
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
module Dodge.Equipment where
|
||||
|
||||
import Data.IntMap.Merge.Strict
|
||||
import Dodge.Data.Creature
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
getCrEquipment :: Creature -> IM.IntMap Item
|
||||
getCrEquipment cr =
|
||||
merge
|
||||
dropMissing
|
||||
dropMissing
|
||||
(zipWithMatched $ \_ _ -> id)
|
||||
(_crInvEquipped cr)
|
||||
(_crInv cr)
|
||||
@@ -1,5 +1,4 @@
|
||||
module Dodge.Equipment.Text
|
||||
where
|
||||
module Dodge.Equipment.Text (eqPosText) where
|
||||
|
||||
import Dodge.Data.Equipment.Misc
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ import Dodge.Base
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Data.Config
|
||||
import Dodge.Data.World
|
||||
import Dodge.Equipment
|
||||
--import Dodge.Equipment
|
||||
import Dodge.InputFocus
|
||||
import Dodge.SmoothScroll
|
||||
import Dodge.Viewpoints
|
||||
import Dodge.WASD
|
||||
import Dodge.Zoning.Wall
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
--import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
import SDL (MouseButton (..))
|
||||
import qualified SDL
|
||||
@@ -115,13 +115,19 @@ moveZoomCamera cfig theinput cr w campos =
|
||||
wallZoom = min4 (campos ^. camBoundDist)
|
||||
min4 (a, b, c, d) = minimum [hh / maxd a, hh / maxd (- b), hw / maxd c, hw / maxd (- d)]
|
||||
maxd = max distFromEqmnt
|
||||
distFromEqmnt = foldl' max 1 $ IM.mapMaybe (_eeViewDist . _uequipEffect . _itUse) $ getCrEquipment cr
|
||||
distFromEqmnt = viewDistanceFromItems cr
|
||||
--distFromEqmnt = foldl' max 1 $ IM.mapMaybe (_eeViewDist . _uequipEffect . _itUse) $ getCrEquipment cr
|
||||
hw = halfWidth cfig
|
||||
hh = halfHeight cfig
|
||||
-- these speeds are inverted, larger means slower
|
||||
zoomInSpeed = 25
|
||||
zoomOutSpeed = 15
|
||||
|
||||
-- for example, this should be 400 or so when you have an unsafe blink gun
|
||||
-- capable of firing, should be expanded when you have a radar of some sort, etc
|
||||
viewDistanceFromItems :: Creature -> Float
|
||||
viewDistanceFromItems _ = 1
|
||||
|
||||
-- note that your _crInvLock does not apply to this TODO check that this is what
|
||||
-- is wanted
|
||||
updateScopeZoom :: World -> World
|
||||
|
||||
Reference in New Issue
Block a user