Cleanup
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
All good (617 modules, at 18:44:37)
|
All good (617 modules, at 19:05:46)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ data ItemBaseType
|
|||||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data AttachType
|
data AttachType
|
||||||
= SCROLLATTACH ScrollAttachType
|
= ZOOMSCOPE
|
||||||
| TARGETATTACH {_ibtAttachTarget :: TargetType}
|
| TARGETATTACH {_ibtAttachTarget :: TargetType}
|
||||||
| BULLETSYNTHESIZER
|
| BULLETSYNTHESIZER
|
||||||
| ROCKETHOMER
|
| ROCKETHOMER
|
||||||
@@ -104,10 +104,6 @@ data AttachType
|
|||||||
-- | BULTRAJECTORYATTACH
|
-- | BULTRAJECTORYATTACH
|
||||||
deriving (Eq, Ord, Show, Read)
|
deriving (Eq, Ord, Show, Read)
|
||||||
|
|
||||||
data ScrollAttachType
|
|
||||||
= ZOOMSCOPE
|
|
||||||
deriving (Eq, Ord, Show, Read)
|
|
||||||
|
|
||||||
data AmmoMagType
|
data AmmoMagType
|
||||||
= REVOLVEMAG
|
= REVOLVEMAG
|
||||||
| TINMAG
|
| TINMAG
|
||||||
@@ -250,7 +246,6 @@ deriveJSON defaultOptions ''Stack
|
|||||||
deriveJSON defaultOptions ''CraftType
|
deriveJSON defaultOptions ''CraftType
|
||||||
deriveJSON defaultOptions ''ConsumableItemType
|
deriveJSON defaultOptions ''ConsumableItemType
|
||||||
deriveJSON defaultOptions ''AmmoMagType
|
deriveJSON defaultOptions ''AmmoMagType
|
||||||
deriveJSON defaultOptions ''ScrollAttachType
|
|
||||||
deriveJSON defaultOptions ''AttachType
|
deriveJSON defaultOptions ''AttachType
|
||||||
deriveJSON defaultOptions ''Detector
|
deriveJSON defaultOptions ''Detector
|
||||||
deriveJSON defaultOptions ''EquipItemType
|
deriveJSON defaultOptions ''EquipItemType
|
||||||
|
|||||||
+1
-10
@@ -115,22 +115,13 @@ applySidePush maxSide cr w = w
|
|||||||
(pushAmount, g) = randomR (- maxSide, maxSide) $ _randGen w
|
(pushAmount, g) = randomR (- maxSide, maxSide) $ _randGen w
|
||||||
|
|
||||||
applyTorqueCME :: Item -> Creature -> World -> World
|
applyTorqueCME :: Item -> Creature -> World -> World
|
||||||
applyTorqueCME itm cr w
|
applyTorqueCME itm cr w = w
|
||||||
| cid == 0 = w
|
|
||||||
& wCam . camRot +~ rot
|
|
||||||
-- & rotateScope
|
|
||||||
& randGen .~ g
|
|
||||||
| otherwise = w
|
|
||||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||||
torque = fromMaybe 0 $ itm ^? itUse . heldParams . torqueAfter
|
torque = fromMaybe 0 $ itm ^? itUse . heldParams . torqueAfter
|
||||||
-- rotateScope = fromMaybe id $ do
|
|
||||||
-- i <- yourScopeInvID w
|
|
||||||
-- return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
|
||||||
|
|
||||||
|
|
||||||
-- (Muzzle,Int,Int) = (muzzle, amountloaded, id of mag taken from)
|
-- (Muzzle,Int,Int) = (muzzle, amountloaded, id of mag taken from)
|
||||||
loadMuzzle :: LabelDoubleTree ComposeLinkType Item
|
loadMuzzle :: LabelDoubleTree ComposeLinkType Item
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ itemFromAmmoMag at = case at of
|
|||||||
|
|
||||||
itemFromAttachType :: AttachType -> Item
|
itemFromAttachType :: AttachType -> Item
|
||||||
itemFromAttachType at = case at of
|
itemFromAttachType at = case at of
|
||||||
SCROLLATTACH ZOOMSCOPE -> zoomScope
|
ZOOMSCOPE -> zoomScope
|
||||||
TARGETATTACH tt -> targetingScope tt
|
TARGETATTACH tt -> targetingScope tt
|
||||||
BULLETSYNTHESIZER -> bulletSynthesizer
|
BULLETSYNTHESIZER -> bulletSynthesizer
|
||||||
ROCKETREMOTESCREEN -> rocketRemoteScreen
|
ROCKETREMOTESCREEN -> rocketRemoteScreen
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ itemBaseName it = case _iyBase $ _itType it of
|
|||||||
|
|
||||||
showAttachItem :: AttachType -> String
|
showAttachItem :: AttachType -> String
|
||||||
showAttachItem t = case t of
|
showAttachItem t = case t of
|
||||||
SCROLLATTACH x -> show x
|
ZOOMSCOPE -> "ZOOMSCOPE"
|
||||||
TARGETATTACH x -> show x
|
TARGETATTACH x -> show x
|
||||||
BULLETSYNTHESIZER -> "BSYNTH"
|
BULLETSYNTHESIZER -> "BSYNTH"
|
||||||
ROCKETREMOTESCREEN -> "REMOTE SCREEN"
|
ROCKETREMOTESCREEN -> "REMOTE SCREEN"
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ baseComposedItem ibt itm = case ibt of
|
|||||||
AMMOMAG _ -> ammoComposedItem itm
|
AMMOMAG _ -> ammoComposedItem itm
|
||||||
ATTACH BULLETSYNTHESIZER -> (AmmoModifierCI BulletAmmo, [], [])
|
ATTACH BULLETSYNTHESIZER -> (AmmoModifierCI BulletAmmo, [], [])
|
||||||
ATTACH (TARGETATTACH{}) -> (WeaponTargetingCI, [], [])
|
ATTACH (TARGETATTACH{}) -> (WeaponTargetingCI, [], [])
|
||||||
ATTACH (SCROLLATTACH ZOOMSCOPE) -> (WeaponScopeCI, [], [])
|
ATTACH ZOOMSCOPE -> (WeaponScopeCI, [], [])
|
||||||
ATTACH ROCKETHOMER -> (AmmoModifierCI ProjectileAmmo, [], [])
|
ATTACH ROCKETHOMER -> (AmmoModifierCI ProjectileAmmo, [], [])
|
||||||
ATTACH ROCKETREMOTESCREEN -> (AmmoModifierCI ProjectileAmmo, [], [])
|
ATTACH ROCKETREMOTESCREEN -> (AmmoModifierCI ProjectileAmmo, [], [])
|
||||||
_ -> (UncomposableCI, [], [])
|
_ -> (UncomposableCI, [], [])
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import Dodge.Default.Item
|
|||||||
zoomScope :: Item
|
zoomScope :: Item
|
||||||
zoomScope =
|
zoomScope =
|
||||||
defaultHeldItem
|
defaultHeldItem
|
||||||
& itType . iyBase .~ ATTACH (SCROLLATTACH ZOOMSCOPE)
|
& itType . iyBase .~ ATTACH ZOOMSCOPE
|
||||||
-- & itUse .~ AttachUse (ScrollAttachParams (ZoomScrollParams{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}))
|
-- & itUse .~ AttachUse (ScrollAttachParams (ZoomScrollParams{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}))
|
||||||
& itScope .~ OpticScope{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}
|
& itScope .~ OpticScope{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}
|
||||||
|
|
||||||
|
|||||||
+10
-12
@@ -72,34 +72,31 @@ updateInGameCamera :: Configuration -> World -> World
|
|||||||
updateInGameCamera cfig w =
|
updateInGameCamera cfig w =
|
||||||
w
|
w
|
||||||
& updateBounds cfig
|
& updateBounds cfig
|
||||||
& over wCam (setViewDistance cfig)
|
|
||||||
& wCam %~ moveZoomCamera cfig (w ^. input) (you w)
|
& wCam %~ moveZoomCamera cfig (w ^. input) (you w)
|
||||||
& updateScopeZoom
|
& updateScopeZoom
|
||||||
& rotateCamera cfig
|
& rotateCamera cfig
|
||||||
|
& over wCam (setViewDistance cfig) -- I think this should be updated after the zoom?
|
||||||
|
|
||||||
moveZoomCamera :: Configuration -> Input -> Creature -> Camera -> Camera
|
moveZoomCamera :: Configuration -> Input -> Creature -> Camera -> Camera
|
||||||
moveZoomCamera cfig theinput cr campos =
|
moveZoomCamera cfig theinput cr campos =
|
||||||
campos
|
campos
|
||||||
& camCenter .~ newcen
|
& camCenter .~ _crPos cr +.+ offset
|
||||||
& camViewFrom .~ newvf
|
& camViewFrom .~ _crPos cr +.+ vfoffset
|
||||||
& camZoom .~ newzoom
|
& camZoom .~ newzoom
|
||||||
& camDefaultZoom .~ newDefaultZoom
|
& camDefaultZoom .~ newDefaultZoom
|
||||||
& camItemZoom .~ newItemZoom
|
& camItemZoom .~ newItemZoom
|
||||||
where
|
where
|
||||||
newvf = _crPos cr +.+ fromMaybe (V2 0 0) vfoffset
|
vfoffset = fromMaybe 0 $ do
|
||||||
vfoffset = do
|
|
||||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
(cr ^? crInv . ix i . itScope . remotePos)
|
(cr ^? crInv . ix i . itScope . remotePos)
|
||||||
camrot = campos ^. camRot
|
docamrot = rotateV (campos ^. camRot)
|
||||||
newcen = _crPos cr +.+ offset
|
|
||||||
offset = fromMaybe noscopeoffset $ do
|
offset = fromMaybe noscopeoffset $ do
|
||||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
(fmap (rotateV camrot) (cr ^? crInv . ix i . itScope . opticPos))
|
(fmap docamrot (cr ^? crInv . ix i . itScope . opticPos))
|
||||||
<|> (cr ^? crInv . ix i . itScope . remotePos)
|
<|> (cr ^? crInv . ix i . itScope . remotePos)
|
||||||
noscopeoffset =
|
noscopeoffset = docamrot $
|
||||||
rotateV (campos ^. camRot) $
|
|
||||||
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
||||||
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
||||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
@@ -137,13 +134,12 @@ updateScopeZoom w = fromMaybe w $ do
|
|||||||
updateScopeZoom' :: Int -> World -> World
|
updateScopeZoom' :: Int -> World -> World
|
||||||
updateScopeZoom' i w
|
updateScopeZoom' i w
|
||||||
| SDL.ButtonRight `M.member` _mouseButtons (_input w) =
|
| SDL.ButtonRight `M.member` _mouseButtons (_input w) =
|
||||||
w & wppointer %~ doScopeZoom (w ^. input . smoothScrollAmount) mp
|
w & wppointer %~ doScopeZoom (w ^. input . smoothScrollAmount) (w ^. input . mousePos)
|
||||||
| otherwise = w & wppointer %~ resetscope
|
| otherwise = w & wppointer %~ resetscope
|
||||||
where
|
where
|
||||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itScope
|
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itScope
|
||||||
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
||||||
resetscope otherAtt = otherAtt
|
resetscope otherAtt = otherAtt
|
||||||
mp = _mousePos (_input w)
|
|
||||||
|
|
||||||
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
||||||
doScopeZoom scrollamount mp sc = case scrollamount of
|
doScopeZoom scrollamount mp sc = case scrollamount of
|
||||||
@@ -249,6 +245,8 @@ findBoundDists cfig w
|
|||||||
hw = halfWidth cfig
|
hw = halfWidth cfig
|
||||||
hh = halfHeight cfig
|
hh = halfHeight cfig
|
||||||
|
|
||||||
|
-- this probably doesn't need to be updated every frame,
|
||||||
|
-- though I'm not sure how often it should be updated
|
||||||
updateBounds :: Configuration -> World -> World
|
updateBounds :: Configuration -> World -> World
|
||||||
updateBounds cfig w = case (w ^. cWorld . cClock) `mod` 5 of
|
updateBounds cfig w = case (w ^. cWorld . cClock) `mod` 5 of
|
||||||
0 -> w
|
0 -> w
|
||||||
|
|||||||
Reference in New Issue
Block a user