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
|
w
|
||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
& crpoint . crInvEquipped . at invid ?~ newp
|
||||||
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||||
& onequip itm cr
|
& onequip itm cr
|
||||||
& crpoint %~ assignNewHotkey invid
|
& crpoint %~ assignNewHotkey invid
|
||||||
MoveEquipment{_allocNewPos = newp, _allocOldPos = oldp} ->
|
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 newp ?~ invid
|
||||||
& crpoint . crEquipment . at oldp .~ Nothing
|
& crpoint . crEquipment . at oldp .~ Nothing
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
& crpoint . crInvEquipped . at invid ?~ newp
|
||||||
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||||
SwapEquipment{_allocNewPos = newp, _allocOldPos = oldp, _allocSwapID = sid} ->
|
SwapEquipment{_allocNewPos = newp, _allocOldPos = oldp, _allocSwapID = sid} ->
|
||||||
w
|
w
|
||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
& crpoint . crEquipment . at oldp ?~ sid
|
& crpoint . crEquipment . at oldp ?~ sid
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
& crpoint . crInvEquipped . at invid ?~ newp
|
||||||
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||||
& crpoint . crInvEquipped . at sid ?~ oldp
|
& crpoint . crInvEquipped . at sid ?~ oldp
|
||||||
|
& crpoint . crInv . ix sid . itLocation . ilEquipPosition ?~ oldp
|
||||||
ReplaceEquipment{_allocNewPos = newp, _allocRemoveID = rid} ->
|
ReplaceEquipment{_allocNewPos = newp, _allocRemoveID = rid} ->
|
||||||
w
|
w
|
||||||
& crpoint . crEquipment . at newp ?~ invid
|
& crpoint . crEquipment . at newp ?~ invid
|
||||||
& crpoint . crInvEquipped . at invid ?~ newp
|
& crpoint . crInvEquipped . at invid ?~ newp
|
||||||
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
|
||||||
& crpoint . crInvEquipped . at rid .~ Nothing
|
& crpoint . crInvEquipped . at rid .~ Nothing
|
||||||
|
& crpoint . crInv . ix rid . itLocation . ilEquipPosition .~ Nothing
|
||||||
& onremove (itmat rid) cr
|
& onremove (itmat rid) cr
|
||||||
& onequip itm cr
|
& onequip itm cr
|
||||||
& crpoint %~ removeHotkey rid
|
& crpoint %~ removeHotkey rid
|
||||||
@@ -77,6 +83,7 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
|||||||
w
|
w
|
||||||
& crpoint . crEquipment . at oldp .~ Nothing
|
& crpoint . crEquipment . at oldp .~ Nothing
|
||||||
& crpoint . crInvEquipped . at invid .~ Nothing
|
& crpoint . crInvEquipped . at invid .~ Nothing
|
||||||
|
& crpoint . crInv . ix invid . itLocation . ilEquipPosition .~ Nothing
|
||||||
& onremove itm cr
|
& onremove itm cr
|
||||||
& crpoint %~ removeHotkey invid
|
& crpoint %~ removeHotkey invid
|
||||||
where
|
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
|
module Dodge.Equipment.Text (eqPosText) where
|
||||||
where
|
|
||||||
|
|
||||||
import Dodge.Data.Equipment.Misc
|
import Dodge.Data.Equipment.Misc
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ import Dodge.Base
|
|||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
import Dodge.Data.Config
|
import Dodge.Data.Config
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.Equipment
|
--import Dodge.Equipment
|
||||||
import Dodge.InputFocus
|
import Dodge.InputFocus
|
||||||
import Dodge.SmoothScroll
|
import Dodge.SmoothScroll
|
||||||
import Dodge.Viewpoints
|
import Dodge.Viewpoints
|
||||||
import Dodge.WASD
|
import Dodge.WASD
|
||||||
import Dodge.Zoning.Wall
|
import Dodge.Zoning.Wall
|
||||||
import Geometry
|
import Geometry
|
||||||
import qualified IntMapHelp as IM
|
--import qualified IntMapHelp as IM
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import SDL (MouseButton (..))
|
import SDL (MouseButton (..))
|
||||||
import qualified SDL
|
import qualified SDL
|
||||||
@@ -115,13 +115,19 @@ moveZoomCamera cfig theinput cr w campos =
|
|||||||
wallZoom = min4 (campos ^. camBoundDist)
|
wallZoom = min4 (campos ^. camBoundDist)
|
||||||
min4 (a, b, c, d) = minimum [hh / maxd a, hh / maxd (- b), hw / maxd c, hw / maxd (- d)]
|
min4 (a, b, c, d) = minimum [hh / maxd a, hh / maxd (- b), hw / maxd c, hw / maxd (- d)]
|
||||||
maxd = max distFromEqmnt
|
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
|
hw = halfWidth cfig
|
||||||
hh = halfHeight cfig
|
hh = halfHeight cfig
|
||||||
-- these speeds are inverted, larger means slower
|
-- these speeds are inverted, larger means slower
|
||||||
zoomInSpeed = 25
|
zoomInSpeed = 25
|
||||||
zoomOutSpeed = 15
|
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
|
-- note that your _crInvLock does not apply to this TODO check that this is what
|
||||||
-- is wanted
|
-- is wanted
|
||||||
updateScopeZoom :: World -> World
|
updateScopeZoom :: World -> World
|
||||||
|
|||||||
Reference in New Issue
Block a user