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)
|
||||
|
||||
data AttachType
|
||||
= SCROLLATTACH ScrollAttachType
|
||||
= ZOOMSCOPE
|
||||
| TARGETATTACH {_ibtAttachTarget :: TargetType}
|
||||
| BULLETSYNTHESIZER
|
||||
| ROCKETHOMER
|
||||
@@ -104,10 +104,6 @@ data AttachType
|
||||
-- | BULTRAJECTORYATTACH
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data ScrollAttachType
|
||||
= ZOOMSCOPE
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data AmmoMagType
|
||||
= REVOLVEMAG
|
||||
| TINMAG
|
||||
@@ -250,7 +246,6 @@ deriveJSON defaultOptions ''Stack
|
||||
deriveJSON defaultOptions ''CraftType
|
||||
deriveJSON defaultOptions ''ConsumableItemType
|
||||
deriveJSON defaultOptions ''AmmoMagType
|
||||
deriveJSON defaultOptions ''ScrollAttachType
|
||||
deriveJSON defaultOptions ''AttachType
|
||||
deriveJSON defaultOptions ''Detector
|
||||
deriveJSON defaultOptions ''EquipItemType
|
||||
|
||||
+1
-10
@@ -115,22 +115,13 @@ applySidePush maxSide cr w = w
|
||||
(pushAmount, g) = randomR (- maxSide, maxSide) $ _randGen w
|
||||
|
||||
applyTorqueCME :: Item -> Creature -> World -> World
|
||||
applyTorqueCME itm cr w
|
||||
| cid == 0 = w
|
||||
& wCam . camRot +~ rot
|
||||
-- & rotateScope
|
||||
& randGen .~ g
|
||||
| otherwise = w
|
||||
applyTorqueCME itm cr w = w
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
& randGen .~ g
|
||||
where
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
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)
|
||||
loadMuzzle :: LabelDoubleTree ComposeLinkType Item
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ itemFromAmmoMag at = case at of
|
||||
|
||||
itemFromAttachType :: AttachType -> Item
|
||||
itemFromAttachType at = case at of
|
||||
SCROLLATTACH ZOOMSCOPE -> zoomScope
|
||||
ZOOMSCOPE -> zoomScope
|
||||
TARGETATTACH tt -> targetingScope tt
|
||||
BULLETSYNTHESIZER -> bulletSynthesizer
|
||||
ROCKETREMOTESCREEN -> rocketRemoteScreen
|
||||
|
||||
@@ -73,7 +73,7 @@ itemBaseName it = case _iyBase $ _itType it of
|
||||
|
||||
showAttachItem :: AttachType -> String
|
||||
showAttachItem t = case t of
|
||||
SCROLLATTACH x -> show x
|
||||
ZOOMSCOPE -> "ZOOMSCOPE"
|
||||
TARGETATTACH x -> show x
|
||||
BULLETSYNTHESIZER -> "BSYNTH"
|
||||
ROCKETREMOTESCREEN -> "REMOTE SCREEN"
|
||||
|
||||
@@ -34,7 +34,7 @@ baseComposedItem ibt itm = case ibt of
|
||||
AMMOMAG _ -> ammoComposedItem itm
|
||||
ATTACH BULLETSYNTHESIZER -> (AmmoModifierCI BulletAmmo, [], [])
|
||||
ATTACH (TARGETATTACH{}) -> (WeaponTargetingCI, [], [])
|
||||
ATTACH (SCROLLATTACH ZOOMSCOPE) -> (WeaponScopeCI, [], [])
|
||||
ATTACH ZOOMSCOPE -> (WeaponScopeCI, [], [])
|
||||
ATTACH ROCKETHOMER -> (AmmoModifierCI ProjectileAmmo, [], [])
|
||||
ATTACH ROCKETREMOTESCREEN -> (AmmoModifierCI ProjectileAmmo, [], [])
|
||||
_ -> (UncomposableCI, [], [])
|
||||
|
||||
@@ -11,7 +11,7 @@ import Dodge.Default.Item
|
||||
zoomScope :: Item
|
||||
zoomScope =
|
||||
defaultHeldItem
|
||||
& itType . iyBase .~ ATTACH (SCROLLATTACH ZOOMSCOPE)
|
||||
& itType . iyBase .~ ATTACH ZOOMSCOPE
|
||||
-- & itUse .~ AttachUse (ScrollAttachParams (ZoomScrollParams{_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 =
|
||||
w
|
||||
& updateBounds cfig
|
||||
& over wCam (setViewDistance cfig)
|
||||
& wCam %~ moveZoomCamera cfig (w ^. input) (you w)
|
||||
& updateScopeZoom
|
||||
& rotateCamera cfig
|
||||
& over wCam (setViewDistance cfig) -- I think this should be updated after the zoom?
|
||||
|
||||
moveZoomCamera :: Configuration -> Input -> Creature -> Camera -> Camera
|
||||
moveZoomCamera cfig theinput cr campos =
|
||||
campos
|
||||
& camCenter .~ newcen
|
||||
& camViewFrom .~ newvf
|
||||
& camCenter .~ _crPos cr +.+ offset
|
||||
& camViewFrom .~ _crPos cr +.+ vfoffset
|
||||
& camZoom .~ newzoom
|
||||
& camDefaultZoom .~ newDefaultZoom
|
||||
& camItemZoom .~ newItemZoom
|
||||
where
|
||||
newvf = _crPos cr +.+ fromMaybe (V2 0 0) vfoffset
|
||||
vfoffset = do
|
||||
vfoffset = fromMaybe 0 $ do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix i . itScope . remotePos)
|
||||
camrot = campos ^. camRot
|
||||
newcen = _crPos cr +.+ offset
|
||||
docamrot = rotateV (campos ^. camRot)
|
||||
offset = fromMaybe noscopeoffset $ do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
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)
|
||||
noscopeoffset =
|
||||
rotateV (campos ^. camRot) $
|
||||
noscopeoffset = docamrot $
|
||||
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
||||
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
@@ -137,13 +134,12 @@ updateScopeZoom w = fromMaybe w $ do
|
||||
updateScopeZoom' :: Int -> World -> World
|
||||
updateScopeZoom' i 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
|
||||
where
|
||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itScope
|
||||
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
||||
resetscope otherAtt = otherAtt
|
||||
mp = _mousePos (_input w)
|
||||
|
||||
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
||||
doScopeZoom scrollamount mp sc = case scrollamount of
|
||||
@@ -249,6 +245,8 @@ findBoundDists cfig w
|
||||
hw = halfWidth 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 cfig w = case (w ^. cWorld . cClock) `mod` 5 of
|
||||
0 -> w
|
||||
|
||||
Reference in New Issue
Block a user