Stop door z fighting when opened

This commit is contained in:
2021-11-27 00:28:59 +00:00
parent e231b851d9
commit 774808663a
4 changed files with 58 additions and 18 deletions
+45 -4
View File
@@ -213,10 +213,7 @@ data Creature = Creature
, _crMvDir :: Float , _crMvDir :: Float
, _crID :: Int , _crID :: Int
, _crPict :: Creature -> World -> SPic , _crPict :: Creature -> World -> SPic
, _crUpdate , _crUpdate :: Creature -> World -> (Endo World, Maybe Creature)
:: Creature
-> World
-> (Endo World, Maybe Creature)
, _crRad :: Float , _crRad :: Float
, _crMass :: Float , _crMass :: Float
, _crHP :: Int , _crHP :: Int
@@ -292,6 +289,50 @@ data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float,
data ItemPos data ItemPos
= InInv { _itCrId :: Int , _itInvId :: Int } = InInv { _itCrId :: Int , _itInvId :: Int }
| OnFloor { _itFlID :: Int } | OnFloor { _itFlID :: Int }
data Item' = Item'
{ _iName :: String
, _iIdentity :: ItemIdentity
, _iType :: ItemType
, _iID :: Int
, _itPos :: ItemPos
}
data ItemType = TargetItem
{ _tiMaxAmmo :: Int
, _tiLoadedAmmo :: Int
, _tiAmmo :: Ammo
, _tiReloadTime :: Int
, _tiReloadState :: Int
, _tiReloadType :: ReloadType
, _tiMaxWarmUp :: Int
, _tiCurWarmUp :: Int
, _tiMaxCoolDown :: Int
, _tiCurCoolDown :: Int
, _tiUseRate :: Int
, _tiUseTime :: Int
, _tiUse :: Item -> Creature -> World -> World
, _tiUseModifiers :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
, _tiSpread :: Float
, _tiRange :: Float
, _tiHammer :: HammerPosition
, _tiDraw :: Item -> SPic
, _tiAimingSpeed :: Float
, _tiAimingRange :: Float
, _tiZoom :: ItZoom
, _tiAimZoom :: ItZoom
, _tiEquipDraw :: Creature -> Int -> SPic
, _tiScroll :: Float -> Creature -> Item -> Item
, _tiAttachment :: ItAttachment
, _tiEffect :: ItEffect
, _tiInvDisplay :: Item -> String
, _tiInvColor :: Color
, _tiTargeting :: Maybe (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture)
, _tiWorldTrigger :: Maybe (Int -> World -> Bool)
, _tiAimStance :: AimStance
, _tiNumBarrels :: Int
, _tiDimension :: ItemDimension
, _tiCurseStatus :: CurseStatus
}
data Item data Item
= Weapon = Weapon
{ _itName :: String { _itName :: String
+6 -7
View File
@@ -1,19 +1,19 @@
module Dodge.Item.Weapon.Utility where module Dodge.Item.Weapon.Utility where
import Dodge.Data import Dodge.Data
import Dodge.Base --import Dodge.Base
import Dodge.Default import Dodge.Default
import Dodge.Picture.Layer import Dodge.Picture.Layer
import Dodge.Creature.Action import Dodge.Creature.Action
import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.TriggerType
import Dodge.Default.Weapon import Dodge.Default.Weapon
import Sound.Data --import Sound.Data
import Geometry import Geometry
import Picture import Picture
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import Shape import Shape
import ShapePicture import ShapePicture
import qualified Data.Map.Strict as M --import qualified Data.Map.Strict as M
import Control.Lens import Control.Lens
rewindGun :: Item rewindGun :: Item
@@ -27,15 +27,15 @@ rewindGun = defaultGun
, _itLeftClickUse = Just $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr , _itLeftClickUse = Just $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr
} }
rewindEffect :: ItEffect -> Creature -> Int -> World -> World rewindEffect :: ItEffect -> Creature -> Int -> World -> World
rewindEffect iteff cr invid w = w & rewindWorlds %~ (take 100 . (w' : )) rewindEffect _ cr invid w = w & rewindWorlds %~ (take 250 . (w' : ))
& creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ length (_rewindWorlds w) & creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ length (_rewindWorlds w)
where where
w' = w & rewindWorlds .~ [] w' = w & rewindWorlds .~ []
& rewinding .~ True & rewinding .~ True
useRewindGun :: Item -> Creature -> World -> World useRewindGun :: Item -> Creature -> World -> World
useRewindGun it cr w = case _rewindWorlds w of useRewindGun _ _ w = case _rewindWorlds w of
(w':[]) -> rewindusing w' [] [w'] -> rewindusing w' []
(_:w':ws) -> rewindusing w' ws (_:w':ws) -> rewindusing w' ws
_ -> w _ -> w
where where
@@ -44,7 +44,6 @@ useRewindGun it cr w = case _rewindWorlds w of
& upbuts & upbuts
& rewindWorlds .~ ws & rewindWorlds .~ ws
& lClickHammer .~ HammerUp & lClickHammer .~ HammerUp
& worldEvents %~ (. (worldEvents %~ (.(rewinding .~ False)))) -- fucking nesting
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w) upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
shrinkGun :: Item shrinkGun :: Item
+1 -1
View File
@@ -112,7 +112,7 @@ placeSlideDoor isPathable col cond a b speed gw = (drid, gw & gWorld .~ (addWall
} }
pairs = rectanglePairs 9 a b pairs = rectanglePairs 9 a b
shiftedPairs = map (bimap shiftLeft shiftLeft) pairs shiftedPairs = map (bimap shiftLeft shiftLeft) pairs
shiftLeft = (+.+ (a -.- b)) shiftLeft = (+.+ (a -.- b +.+ (normalizeV (b -.- a))) )
wlids = take 4 [IM.newKey $ _walls w ..] wlids = take 4 [IM.newKey $ _walls w ..]
-- old code that may help with pathing -- old code that may help with pathing
--import Dodge.LevelGen.Pathing --import Dodge.LevelGen.Pathing
+4 -4
View File
@@ -67,10 +67,10 @@ room2 = lasCenSensEdge
startRoom :: RandomGen g => Int -> State g (SubCompTree Room) startRoom :: RandomGen g => Int -> State g (SubCompTree Room)
startRoom i = join $ uncurry takeOneWeighted $ unzip startRoom i = join $ uncurry takeOneWeighted $ unzip
[ (,) (0.5::Float) $ chainUses <$> sequence [minigunFakeout,weaponRoom] [ (,) (0.5::Float) $ chainUses <$> sequence [minigunFakeout,weaponRoom]
, (,) 1 $ rezBoxesWp , (,) 1 rezBoxesWp
, (,) 1 $ rezBoxesThenWeaponRoom , (,) 1 rezBoxesThenWeaponRoom
, (,) 1 $ rezBoxThenWeaponRoom , (,) 1 rezBoxThenWeaponRoom
, (,) 1 $ rezBoxesWpCrit , (,) 1 rezBoxesWpCrit
, (,) 1 $ runPastStart i , (,) 1 $ runPastStart i
] ]