Add concept of GameRoom, check viewing distance based on rooms

This commit is contained in:
2021-09-02 23:24:29 +01:00
parent 9d2f42dbc9
commit c69af7a5f4
30 changed files with 295 additions and 151 deletions
+3 -2
View File
@@ -48,10 +48,11 @@ autoGun = defaultAutoGun
, _itFloorPict = onLayer FlItLayer autoGunPic
, _itAimingSpeed = 0.4
, _itAimingRange = 1
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
, _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
, _itEquipPict = pictureWeaponOnAim autoGunPic
, _itEffect = wpRecock
, _itAttachment = Just $ ItCharMode $ Seq.fromList "MS"
, _itAttachment = ItCharMode $ Seq.fromList "MS"
, _itScroll = scrollCharMode
, _itInvDisplay = basicWeaponDisplay
, _wpAmmo = basicBullet
+2 -1
View File
@@ -8,6 +8,7 @@ import Dodge.Item.Draw
import Dodge.Item.Weapon.Targeting
import Dodge.Item.Weapon.TriggerType
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Attachment.Data
import Dodge.Default
import Dodge.Particle.Bullet.Spawn
import Dodge.Particle.Bullet.HitEffect
@@ -35,7 +36,7 @@ bezierGun = defaultGun
]
, _itFloorPict = onLayer FlItLayer bezierGunPic
, _itEquipPict = pictureWeaponOnAim bezierGunPic
, _itAttachment = Nothing
, _itAttachment = NoItAttachment
, _itScroll = removeItTarget 0
, _itHammer = HammerUp
, _itEffect = rbSetTarget
+3 -3
View File
@@ -41,14 +41,14 @@ boostSelfL x cr invid w = case boostPoint x cr w of
cpos = _crPos cr
r = _crRad cr
pid = fromMaybe (IM.newKey $ _projectiles w)
(cr ^? crInv . ix invid . itAttachment . _Just . itInt)
(cr ^? crInv . ix invid . itAttachment . itInt)
crEff p ammoEff = addBoostShockwave pid p (r *.* normalizeV (p -.- cpos)) w
& creatures . ix cid %~
(crPos .~ p)
. (crInv . ix invid %~
ammoEff
. (itEffect . itEffectCounter .~ 1)
. (itAttachment ?~ ItInt pid)
. (itAttachment .~ ItInt pid)
)
boostSelf
@@ -120,7 +120,7 @@ resetAttachmentID :: ItEffect
resetAttachmentID = ItInvEffect f 0
where
f iteff cr invid w
| _itEffectCounter iteff < 0 = w & pointToIt . itAttachment .~ Nothing
| _itEffectCounter iteff < 0 = w & pointToIt . itAttachment .~ NoItAttachment
| otherwise = w & pointToIt . itEffect . itEffectCounter -~ 1
where
pointToIt = creatures . ix (_crID cr) . crInv . ix invid
+2 -2
View File
@@ -9,7 +9,7 @@ import Dodge.Base
import Dodge.Item.Data
import Dodge.Item.Weapon.Decoration
import Dodge.Item.Weapon.UseEffect
--import Dodge.Item.Attachment.Data
import Dodge.Item.Attachment.Data
import Dodge.WorldEvent.Flash
import Dodge.WorldEvent.ThingsHit
import Dodge.Picture.Layer
@@ -49,7 +49,7 @@ bezierRecock = ItInvEffect
f _ cr i = creatures . ix (_crID cr) . crInv %~ IM.adjust fOnIt i
fOnIt it = case _itHammer it of
HammerDown -> it & itHammer .~ HammerUp
_ -> it & itAttachment .~ Nothing
_ -> it & itAttachment .~ NoItAttachment
{- |
Creates a laser scope and recocks the weapon.
-}
+1 -2
View File
@@ -15,7 +15,6 @@ import Picture
import Geometry
import Control.Lens
import Data.Maybe (fromJust)
import qualified Data.IntMap.Strict as IM
--import System.Random
@@ -90,7 +89,7 @@ throwGrenade explosion cr w = setWp $ removePict $ over projectiles addG w
dir = argV v
setWp :: World -> World
setWp w' = w' & creatures . ix n . crInv . ix j . itEffect .~ throwArmReset 20
fuseTime = _itFuseTime $ fromJust $ _itAttachment $ _crInv cr IM.! j
fuseTime = _itFuseTime $ _itAttachment $ _crInv cr IM.! j
throwArmReset :: Int -> ItEffect
throwArmReset x = ItInvEffect {_itInvEffect = f ,_itEffectCounter = x }
+1 -1
View File
@@ -13,7 +13,7 @@ import Control.Lens
--import Control.Monad
{- | Displays the item name, ammo if loaded, and any selected '_itCharMode'. -}
basicWeaponDisplay :: Item -> String
basicWeaponDisplay it = case it ^? itAttachment . _Just of
basicWeaponDisplay it = case it ^? itAttachment of
Just ItCharMode {_itCharMode = (c :<| _)} -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded) ++ [' ',c]
Just ItMode {_itMode = i} -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded) ++ show i
_ -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded)
+1 -1
View File
@@ -31,7 +31,7 @@ aLaser cr w = over particles (makeLaserAt phaseV pos dir : )
pos = _crPos cr +.+ ((_crRad cr +3) *.* unitVectorAtAngle dir)
dir = _crDir cr
phaseV = charToPhaseV
$ fromMaybe '/' $ Seq.lookup 0 =<< cr ^? crInv . ix j . itAttachment . _Just . itCharMode
$ fromMaybe '/' $ Seq.lookup 0 =<< cr ^? crInv . ix j . itAttachment . itCharMode
j = _crInvSel cr
charToPhaseV :: Fractional p => Char -> p
+3 -3
View File
@@ -272,12 +272,12 @@ withTempLight time rad col eff item cr = eff item cr
. over tempLightSources (theTLS :)
where
theTLS = defaultTLS
{ _tlsPos = V3 x y 20
{ _tlsPos = V3 x y 10
, _tlsRad=rad
, _tlsIntensity = col
, _tlsTime = time
}
V2 x y = _crPos cr +.+ 5 *.* unitVectorAtAngle (_crDir cr)
V2 x y = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
withMuzFlareI :: ChainEffect
withMuzFlareI f it cr w = tempLightForAt 3 pos2 -- . muzzleFlashAt pos2
@@ -346,7 +346,7 @@ torqueAfterI torque feff item cr w
cid = _crID cr
(rot, g) = randomR (-torque,torque) $ _randGen w
rotateScope = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
. itAttachment . _Just . scopePos %~ rotateV rot
. itAttachment . scopePos %~ rotateV rot
spreadNumI :: ChainEffect
spreadNumI eff item cr w = foldr f w dirs
where