Add battery shape/picture
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
All good (601 modules, at 20:39:35)
|
All good (601 modules, at 00:25:15)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -79,6 +79,10 @@ normalizeColor (V4 r g b a) = V4 (f r) (f g) (f b) (f a)
|
|||||||
where
|
where
|
||||||
f = min 1 . max 0
|
f = min 1 . max 0
|
||||||
|
|
||||||
|
mixColorsFrac :: Color -> Color -> Float -> Color
|
||||||
|
{-# INLINE mixColorsFrac #-}
|
||||||
|
mixColorsFrac c1 c2 x = mixColors x (1-x) c1 c2
|
||||||
|
|
||||||
mixColors :: Float -> Float -> Color -> Color -> Color
|
mixColors :: Float -> Float -> Color -> Color -> Color
|
||||||
{-# INLINE mixColors #-}
|
{-# INLINE mixColors #-}
|
||||||
mixColors rata ratb (V4 r0 g0 b0 a0) (V4 r2 g2 b2 a2) =
|
mixColors rata ratb (V4 r0 g0 b0 a0) (V4 r2 g2 b2 a2) =
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module Dodge.Creature.State (
|
module Dodge.Creature.State (
|
||||||
stateUpdate,
|
crUpdate,
|
||||||
doDamage,
|
doDamage,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@@ -57,8 +57,8 @@ foldCr xs cr w = foldl' f w xs
|
|||||||
at what point invSideEffects is applied wrt to when the creature moves
|
at what point invSideEffects is applied wrt to when the creature moves
|
||||||
may affect whether the shield moves correctly
|
may affect whether the shield moves correctly
|
||||||
-}
|
-}
|
||||||
stateUpdate :: (Creature -> World -> World) -> Creature -> World -> World
|
crUpdate :: (Creature -> World -> World) -> Creature -> World -> World
|
||||||
stateUpdate f =
|
crUpdate f =
|
||||||
foldCr
|
foldCr
|
||||||
[ doDamage -- these two
|
[ doDamage -- these two
|
||||||
, checkDeath -- must be in this order 24/7/22
|
, checkDeath -- must be in this order 24/7/22
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ import Data.Aeson.TH
|
|||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
|
|
||||||
data Scope
|
data Scope
|
||||||
= NoScope
|
= OpticScope
|
||||||
| OpticScope
|
|
||||||
{ -- | a camera offset
|
{ -- | a camera offset
|
||||||
_opticPos :: Point2 -- this should be relative to the camera rotation
|
_opticPos :: Point2 -- this should be relative to the camera rotation
|
||||||
-- this means that when the camera rotates when firing etc,
|
-- this means that when the camera rotates when firing etc,
|
||||||
|
|||||||
@@ -64,9 +64,7 @@ data ItemUse
|
|||||||
, _tgID :: Maybe Int
|
, _tgID :: Maybe Int
|
||||||
, _tgActive :: Bool
|
, _tgActive :: Bool
|
||||||
}
|
}
|
||||||
| UseBulletMod
|
| UseBulletMod { _ubMod :: BulletMod }
|
||||||
{ _ubMod :: BulletMod
|
|
||||||
}
|
|
||||||
deriving (Eq, Show, Read)
|
deriving (Eq, Show, Read)
|
||||||
|
|
||||||
data TriggerType = AutoTrigger | HammerTrigger
|
data TriggerType = AutoTrigger | HammerTrigger
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
cr
|
cr
|
||||||
YourAI -> stateUpdate yourControl cr
|
YourAI -> crUpdate yourControl cr
|
||||||
InanimateAI -> id
|
InanimateAI -> id
|
||||||
where
|
where
|
||||||
drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
|
||||||
@@ -184,7 +184,7 @@ humanoidAIList ::
|
|||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
humanoidAIList
|
humanoidAIList
|
||||||
= stateUpdate . impulsiveAIBefore . chainCreatureUpdates
|
= crUpdate . impulsiveAIBefore . chainCreatureUpdates
|
||||||
|
|
||||||
-- bit of a hack to get new random generators after each creature's update
|
-- bit of a hack to get new random generators after each creature's update
|
||||||
defaultImpulsive ::
|
defaultImpulsive ::
|
||||||
@@ -193,7 +193,7 @@ defaultImpulsive ::
|
|||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
defaultImpulsive
|
defaultImpulsive
|
||||||
= fmap (fmap updateRandGen) . stateUpdate . impulsiveAIBefore . chainCreatureUpdates
|
= fmap (fmap updateRandGen) . crUpdate . impulsiveAIBefore . chainCreatureUpdates
|
||||||
where
|
where
|
||||||
updateRandGen w =
|
updateRandGen w =
|
||||||
let (_, g) = randomR (0, 1 :: Int) (_randGen w)
|
let (_, g) = randomR (0, 1 :: Int) (_randGen w)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
module Dodge.Item.Display (
|
module Dodge.Item.Display (
|
||||||
itemDisplay,
|
itemDisplay,
|
||||||
itemString,
|
|
||||||
itemBaseName,
|
itemBaseName,
|
||||||
|
itemString,
|
||||||
basicItemDisplay,
|
basicItemDisplay,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@@ -33,7 +33,6 @@ basicItemDisplay itm =
|
|||||||
itemBaseName itm :
|
itemBaseName itm :
|
||||||
--catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
|
--catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
|
||||||
catMaybes [maybeWarmupStatus itm]
|
catMaybes [maybeWarmupStatus itm]
|
||||||
-- ++ moduleStrings itm
|
|
||||||
++ repeat "*"
|
++ repeat "*"
|
||||||
|
|
||||||
itemString :: Item -> String
|
itemString :: Item -> String
|
||||||
@@ -100,7 +99,6 @@ itemNumberDisplay cr itm = case iu of
|
|||||||
UseAttach {} -> []
|
UseAttach {} -> []
|
||||||
UseAmmoMag {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
|
UseAmmoMag {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
|
||||||
UseScope OpticScope {_opticZoom = x} -> [shortShow x]
|
UseScope OpticScope {_opticZoom = x} -> [shortShow x]
|
||||||
UseScope {} -> []
|
|
||||||
UseTargeting {_tgPos = mp} -> [maybe "" shortShow mp]
|
UseTargeting {_tgPos = mp} -> [maybe "" shortShow mp]
|
||||||
-- this could be cleaner here...
|
-- this could be cleaner here...
|
||||||
UseBulletMod {} -> mempty
|
UseBulletMod {} -> mempty
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
module Dodge.Item.Draw (
|
module Dodge.Item.Draw (
|
||||||
twoFlatHRot,
|
|
||||||
itemSPic,
|
itemSPic,
|
||||||
itemEquipPict,
|
itemEquipPict,
|
||||||
heldItemOffset,
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Dodge.Data.ComposedItem
|
import Dodge.Data.ComposedItem
|
||||||
|
|||||||
@@ -44,19 +44,19 @@ itemSPic it = case it ^. itType of
|
|||||||
|
|
||||||
ammoMagSPic :: Item -> AmmoMagType -> SPic
|
ammoMagSPic :: Item -> AmmoMagType -> SPic
|
||||||
ammoMagSPic it = \case
|
ammoMagSPic it = \case
|
||||||
TINMAG -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1)
|
TINMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- y) (-1) 1)
|
||||||
DRUMMAG -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1)
|
DRUMMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- y) (-1) 1)
|
||||||
CHEMFUELPOUCH -> noPic $ colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5)
|
CHEMFUELPOUCH -> noPic $ colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5)
|
||||||
-- , setLayer MidLayer . color black $ translate3 (V3 0 0 4) $ circleSolid (5 * am)
|
BATTERY -> colorSH blue (upperBox Tiny Superfluous 1 (rectNSWE 0 (-2) (-2) 2))
|
||||||
|
:!: setLayer BloomNoZWrite (setDepth 2 . color (mixColorsFrac green red am) $ circleSolid 2)
|
||||||
_ -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1)
|
_ -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1)
|
||||||
where
|
where
|
||||||
y = fromIntegral y' * 0.3
|
y = fromIntegral y' * 0.3
|
||||||
y' = fromMaybe 0 $ it ^? itUse . amagLoadStatus . iaLoaded
|
y' = fromMaybe 0 $ it ^? itUse . amagLoadStatus . iaLoaded
|
||||||
|
am = fractionLoadedAmmo (it ^?! itUse . amagLoadStatus)
|
||||||
|
|
||||||
-- am = fractionLoadedAmmo (it ^?! itUse . amagLoadStatus)
|
fractionLoadedAmmo :: ReloadStatus -> Float
|
||||||
|
fractionLoadedAmmo rs = fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs)
|
||||||
--fractionLoadedAmmo :: ReloadStatus -> Float
|
|
||||||
--fractionLoadedAmmo rs = fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs)
|
|
||||||
--
|
--
|
||||||
--fractionLoadedAmmo2 :: ReloadStatus -> Float
|
--fractionLoadedAmmo2 :: ReloadStatus -> Float
|
||||||
--fractionLoadedAmmo2 rs =
|
--fractionLoadedAmmo2 rs =
|
||||||
|
|||||||
@@ -23,38 +23,30 @@ transToHandle itm = fromMaybe id $ do
|
|||||||
V2 x y <- itm ^? itUse . heldAim . aimHandlePos
|
V2 x y <- itm ^? itUse . heldAim . aimHandlePos
|
||||||
return (-.-.- V3 x y 0)
|
return (-.-.- V3 x y 0)
|
||||||
|
|
||||||
-- there is a lot of duplication going on here, and also need to check
|
|
||||||
-- rotations
|
|
||||||
heldItemRelativeOrient :: Item -> Creature -> (Point3, Q.Quaternion Float) -> (Point3, Q.Quaternion Float)
|
heldItemRelativeOrient :: Item -> Creature -> (Point3, Q.Quaternion Float) -> (Point3, Q.Quaternion Float)
|
||||||
heldItemRelativeOrient itm cr (p,q)
|
heldItemRelativeOrient itm cr (p,q)
|
||||||
| _posture (_crStance cr) == Aiming =
|
| _posture (_crStance cr) == Aiming =
|
||||||
(p +.+.+ aimingWeaponZeroPos cr itm `v2z` shoulderHeight, Q.qID * q)
|
(p + aimingWeaponZeroPos cr itm `v2z` shoulderHeight, Q.qID * q)
|
||||||
| isTwoHandFlat =
|
| isTwoHandFlat =
|
||||||
( (+.+.+ V3 (_crRad cr) 0 handD)
|
( V3 (_crRad cr) 0 handD
|
||||||
. rotate3 (twoFlatHRot cr)
|
+ rotate3 (twoFlatHRot cr) (transToHandle itm p)
|
||||||
$ transToHandle itm p
|
|
||||||
, (Q.axisAngle (V3 0 0 1) (twoFlatHRot cr)) * q
|
, (Q.axisAngle (V3 0 0 1) (twoFlatHRot cr)) * q
|
||||||
)
|
)
|
||||||
| isOneHand =
|
| isOneHand =
|
||||||
( (+.+.+ V3 0 0 handD)
|
( V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) handD
|
||||||
. (+.+.+ V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) 0)
|
+ transToHandle itm p
|
||||||
. (+.+.+ V3 (-2) 0 0)
|
|
||||||
$ transToHandle itm p
|
|
||||||
, Q.qID * q
|
, Q.qID * q
|
||||||
)
|
)
|
||||||
| otherwise =
|
| otherwise =
|
||||||
( (+.+.+ V3 0 0 handD)
|
( V3 (_crRad cr) 0 handD
|
||||||
. (+.+.+ V3 (_crRad cr) 0 0)
|
+ rotate3 (strideRot cr + 1.2) (V3 (-8) 0 0 + transToHandle itm p)
|
||||||
. rotate3 (strideRot cr + 1.2)
|
|
||||||
. (+.+.+ V3 (-8) 0 0)
|
|
||||||
$ transToHandle itm p
|
|
||||||
, (Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2)) * q
|
, (Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2)) * q
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
handD = 15
|
handD = 15
|
||||||
handPos = case cr ^? crStance . carriage of
|
handPos = case cr ^? crStance . carriage of
|
||||||
Just (Walking x LeftForward) -> f x * 50
|
Just (Walking x LeftForward) -> f x * 50 -2
|
||||||
_ -> 0
|
_ -> 0 - 2
|
||||||
isOneHand =
|
isOneHand =
|
||||||
itm ^? itUseAimStance == Just OneHand
|
itm ^? itUseAimStance == Just OneHand
|
||||||
|| isNothing (itm ^? itUseAimStance)
|
|| isNothing (itm ^? itUseAimStance)
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ updateScopeZoom' i w
|
|||||||
where
|
where
|
||||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itUse . uScope
|
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itUse . uScope
|
||||||
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
||||||
resetscope otherAtt = otherAtt
|
|
||||||
|
|
||||||
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
||||||
doScopeZoom scrollamount mp sc = case scrollamount of
|
doScopeZoom scrollamount mp sc = case scrollamount of
|
||||||
@@ -169,11 +168,11 @@ zoomOutLongGun sc = fromMaybe sc $ do
|
|||||||
sc & opticPos %~ (\p -> p +.+ (zoomSpeed - 1) / curzoom *.* p)
|
sc & opticPos %~ (\p -> p +.+ (zoomSpeed - 1) / curzoom *.* p)
|
||||||
& opticZoom *~ zoomSpeed
|
& opticZoom *~ zoomSpeed
|
||||||
|
|
||||||
ifConfigWallRotate :: Configuration -> World -> World
|
ifConfigWallRotate :: Configuration -> M.Map MouseButton Int -> World -> World
|
||||||
ifConfigWallRotate cfig w
|
ifConfigWallRotate cfig mbs
|
||||||
| _gameplay_rotate_to_wall cfig && not (SDL.ButtonRight `M.member` _mouseButtons (_input w)) =
|
| _gameplay_rotate_to_wall cfig && not (SDL.ButtonRight `M.member` mbs) =
|
||||||
rotateToOverlappingWall w
|
rotateToOverlappingWall
|
||||||
| otherwise = w
|
| otherwise = id
|
||||||
|
|
||||||
rotateToOverlappingWall :: World -> World
|
rotateToOverlappingWall :: World -> World
|
||||||
rotateToOverlappingWall w =
|
rotateToOverlappingWall w =
|
||||||
@@ -205,13 +204,11 @@ rotateCamera cfig w
|
|||||||
| keydown SDL.ScancodeQ && keydown SDL.ScancodeE = w
|
| keydown SDL.ScancodeQ && keydown SDL.ScancodeE = w
|
||||||
| keydown SDL.ScancodeQ = rotateCameraBy 0.025 w
|
| keydown SDL.ScancodeQ = rotateCameraBy 0.025 w
|
||||||
| keydown SDL.ScancodeE = rotateCameraBy (-0.025) w
|
| keydown SDL.ScancodeE = rotateCameraBy (-0.025) w
|
||||||
| otherwise = ifConfigWallRotate cfig w
|
| otherwise = ifConfigWallRotate cfig (w ^. input . mouseButtons) w
|
||||||
where
|
where
|
||||||
keydown scode = scode `M.member` _pressedKeys (_input w) && not (inInputFocus w)
|
keydown scode = scode `M.member` _pressedKeys (_input w) && not (inInputFocus w)
|
||||||
|
|
||||||
zoomFromItem ::
|
zoomFromItem :: ItZoom -> Float
|
||||||
ItZoom ->
|
|
||||||
Float
|
|
||||||
zoomFromItem ItZoom{_izMax = zMax, _izMin = zMin, _izFac = zFac} =
|
zoomFromItem ItZoom{_izMax = zMax, _izMin = zMin, _izFac = zFac} =
|
||||||
min zMax $ max zMin zFac
|
min zMax $ max zMin zFac
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ import qualified Control.Foldl as L
|
|||||||
-- | Draw an anticlockwise rectangle based on maximal N E S W values.
|
-- | Draw an anticlockwise rectangle based on maximal N E S W values.
|
||||||
rectNESW :: Float -> Float -> Float -> Float -> [Point2]
|
rectNESW :: Float -> Float -> Float -> Float -> [Point2]
|
||||||
rectNESW !a !b !c !d = [V2 b a,V2 b c,V2 d c,V2 d a]
|
rectNESW !a !b !c !d = [V2 b a,V2 b c,V2 d c,V2 d a]
|
||||||
-- | Draw a clockwise rectangle based on maximal N S E W values.
|
|
||||||
--rectNSEW :: Float -> Float -> Float -> Float -> [Point2]
|
|
||||||
--rectNSEW !n !s !e !w = rectNESW n e s w
|
|
||||||
-- | Draw an anticlockwise rectangle based on maximal N S W E values.
|
-- | Draw an anticlockwise rectangle based on maximal N S W E values.
|
||||||
rectNSWE :: Float -> Float -> Float -> Float -> [Point2]
|
rectNSWE :: Float -> Float -> Float -> Float -> [Point2]
|
||||||
rectNSWE !n !s !w !e = [V2 w n, V2 w s, V2 e s, V2 e n]
|
rectNSWE !n !s !w !e = [V2 w n, V2 w s, V2 e s, V2 e n]
|
||||||
|
|||||||
Reference in New Issue
Block a user