Continue work on bullet drawing
This commit is contained in:
+1
-1
@@ -106,7 +106,7 @@ makeFragBullets p w = w & cWorld . lWorld . instantBullets .++~ bus
|
|||||||
bus = zipWith f (take 10 as) (take 10 ss)
|
bus = zipWith f (take 10 as) (take 10 ss)
|
||||||
as = randomRs (0, 2 * pi) $ _randGen w
|
as = randomRs (0, 2 * pi) $ _randGen w
|
||||||
ss = randomRs (5, 15) $ _randGen w
|
ss = randomRs (5, 15) $ _randGen w
|
||||||
f a s = defaultBullet & buVel .~ s *.* (unitVectorAtAngle a)
|
f a s = defaultBullet & buVel .~ s *.* unitVectorAtAngle a
|
||||||
& buDrag .~ 0.8
|
& buDrag .~ 0.8
|
||||||
& buPos .~ p
|
& buPos .~ p
|
||||||
& buOldPos .~ p
|
& buOldPos .~ p
|
||||||
|
|||||||
@@ -240,20 +240,48 @@ makeSingleClipAt p it = case it ^? itUse . heldConsumption . laLoaded of
|
|||||||
makeTinClipAt :: Float -> Point3 -> Item -> Shape
|
makeTinClipAt :: Float -> Point3 -> Item -> Shape
|
||||||
makeTinClipAt r p it =
|
makeTinClipAt r p it =
|
||||||
translateSH p . overPosSH (rotate3z r) $
|
translateSH p . overPosSH (rotate3z r) $
|
||||||
(upperPrismPoly 1 $
|
colorSH midcol (upperPrismPoly 1 (
|
||||||
reverse $
|
reverse $
|
||||||
rectNSWE 0 (- y) (-2) 2) <> tips
|
rectNSWE 0 (- y) (-2) 2)) <> tips <> tails
|
||||||
where
|
where
|
||||||
|
midcol = maybe black bulletEffectColor
|
||||||
|
(it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
|
||||||
y = fromIntegral y' * 0.3
|
y = fromIntegral y' * 0.3
|
||||||
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laLoaded
|
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laLoaded
|
||||||
tips = fromMaybe mempty $ do
|
tips = fromMaybe mempty $ do
|
||||||
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn . spawnEBT
|
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
|
||||||
return $ colorSH (bulletPayloadColor ebt) $ upperPrismPoly 1.1 $
|
return $ colorSH (bulletPayloadColor ebt) $ upperPrismPoly 1.1 $
|
||||||
reverse $
|
reverse $
|
||||||
rectNSWE 0 (- y) (-2) (-1)
|
rectNSWE 0 (- y) (-2) (-1)
|
||||||
|
tails = fromMaybe mempty $ do
|
||||||
|
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory
|
||||||
|
return $ colorSH (bulletTrajColor ebt) $ upperPrismPoly 1.1 $
|
||||||
|
reverse $
|
||||||
|
rectNSWE 0 (- y) 1 2
|
||||||
|
|
||||||
bulletPayloadColor :: EnergyBallType -> Color
|
bulletEffectColor :: BulletEffect -> Color
|
||||||
bulletPayloadColor ebt = case ebt of
|
bulletEffectColor x = case x of
|
||||||
|
DestroyBullet -> black
|
||||||
|
BounceBullet -> mixColors 0.5 0.5 black yellow
|
||||||
|
PenetrateBullet -> mixColors 0.5 0.5 black blue
|
||||||
|
|
||||||
|
bulletTrajColor :: BulletTrajectory -> Color
|
||||||
|
bulletTrajColor x = case x of
|
||||||
|
BasicBulletTrajectory -> black
|
||||||
|
BezierTrajectory {} -> chartreuse
|
||||||
|
FlechetteTrajectory {} -> white
|
||||||
|
MagnetTrajectory {} -> yellow
|
||||||
|
|
||||||
|
bulletPayloadColor :: BulletSpawn -> Color
|
||||||
|
bulletPayloadColor x = case x of
|
||||||
|
BulBall y -> energyBallColor y
|
||||||
|
BulSpark -> black
|
||||||
|
BulFlak -> chartreuse
|
||||||
|
BulFrag -> magenta
|
||||||
|
BulGas -> green
|
||||||
|
|
||||||
|
energyBallColor :: EnergyBallType -> Color
|
||||||
|
energyBallColor ebt = case ebt of
|
||||||
IncBall -> orange
|
IncBall -> orange
|
||||||
TeslaBall -> cyan
|
TeslaBall -> cyan
|
||||||
ConcBall -> white
|
ConcBall -> white
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ itemInfo itm = itmBaseInfo itm ++ " " ++ itmUsageInfo itm
|
|||||||
++ itmModuleInfo (itm ^. itType . iyModules)
|
++ itmModuleInfo (itm ^. itType . iyModules)
|
||||||
|
|
||||||
itmSpaceInfo :: Item -> String
|
itmSpaceInfo :: Item -> String
|
||||||
itmSpaceInfo itm = case (ceiling $ _itInvSize itm) of
|
itmSpaceInfo itm = case ceiling $ _itInvSize itm of
|
||||||
1 -> " It takes up one inventory slot. "
|
1 -> " It takes up one inventory slot. "
|
||||||
x -> " It takes up " ++ showInt x ++ " inventory slots. "
|
x -> " It takes up " ++ showInt x ++ " inventory slots. "
|
||||||
|
|
||||||
@@ -251,8 +251,8 @@ itmModuleInfo m
|
|||||||
|
|
||||||
makeCommaList :: [String] -> String
|
makeCommaList :: [String] -> String
|
||||||
makeCommaList [] = ""
|
makeCommaList [] = ""
|
||||||
makeCommaList (x:[]) = x ++ "."
|
makeCommaList [x] = x ++ "."
|
||||||
makeCommaList (x:y:[]) = x ++ " and " ++ y ++ "."
|
makeCommaList [x,y] = x ++ " and " ++ y ++ "."
|
||||||
makeCommaList (x:xs) = x ++ ", " ++ makeCommaList xs
|
makeCommaList (x:xs) = x ++ ", " ++ makeCommaList xs
|
||||||
|
|
||||||
moduleInfo :: ModuleSlot -> String
|
moduleInfo :: ModuleSlot -> String
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ drawExamineInventory cfig mtweaki w =
|
|||||||
|
|
||||||
closeObjectInfo :: Int -> Either FloorItem Button -> String
|
closeObjectInfo :: Int -> Either FloorItem Button -> String
|
||||||
closeObjectInfo n x = case x of
|
closeObjectInfo n x = case x of
|
||||||
Left (FlIt {_flIt = itm}) -> itemInfo itm ++ " It is on the floor" ++ floorItemPickupInfo n itm
|
Left FlIt{_flIt = itm} -> itemInfo itm ++ " It is on the floor" ++ floorItemPickupInfo n itm
|
||||||
Right _ -> "Some sort of switch or button."
|
Right _ -> "Some sort of switch or button."
|
||||||
|
|
||||||
floorItemPickupInfo :: Int -> Item -> String
|
floorItemPickupInfo :: Int -> Item -> String
|
||||||
|
|||||||
Reference in New Issue
Block a user