Make concrete world read/showable
This commit is contained in:
+3
-3
@@ -291,8 +291,8 @@ data CWorld = CWorld
|
||||
, _worldBounds :: Bounds
|
||||
, _gameRooms :: [GameRoom] -- consider using an IntMap
|
||||
, _roomClipping :: [ConvexPoly]
|
||||
, _maybeWorld :: Maybe' World
|
||||
, _rewindWorlds :: [World]
|
||||
, _maybeWorld :: Maybe' CWorld
|
||||
, _rewindWorlds :: [CWorld]
|
||||
, _timeFlow :: TimeFlowStatus
|
||||
, _worldClock :: Int
|
||||
, _hammers :: M.Map WorldHammer HammerPosition
|
||||
@@ -305,7 +305,7 @@ data CWorld = CWorld
|
||||
, _lSelect :: Point2
|
||||
, _rSelect :: Point2
|
||||
}
|
||||
--deriving (Eq,Show,Read)
|
||||
deriving (Eq,Show,Read)
|
||||
data TimeFlowStatus
|
||||
= RewindingNow
|
||||
| RewindingLastFrame
|
||||
|
||||
@@ -29,7 +29,7 @@ onOffEff f g it
|
||||
|
||||
rewindEffect :: Item -> Creature -> World -> World
|
||||
rewindEffect itm cr w
|
||||
| Just invid == _crLeftInvSel cr = w & cWorld . rewindWorlds %~ (take maxcharge . (w' : ))
|
||||
| Just invid == _crLeftInvSel cr = w & cWorld . rewindWorlds %~ (take maxcharge . (cw : ))
|
||||
& ptrWpCharge .~ length (_rewindWorlds (_cWorld w))
|
||||
| otherwise = w & cWorld . rewindWorlds .~ []
|
||||
& ptrWpCharge .~ 0
|
||||
@@ -37,8 +37,9 @@ rewindEffect itm cr w
|
||||
invid = _ipInvID $ _itPos itm
|
||||
ptrWpCharge = cWorld . creatures . ix (_crID cr) . crInv . ix invid . itConsumption . wpCharge
|
||||
maxcharge = _wpMaxCharge . _itConsumption $ itm
|
||||
w' = w & cWorld . rewindWorlds .~ []
|
||||
& cWorld . timeFlow .~ NormalTimeFlow
|
||||
cw = _cWorld w
|
||||
& rewindWorlds .~ []
|
||||
& timeFlow .~ NormalTimeFlow
|
||||
|
||||
resetAttachmentEffect :: Item -> Creature -> World -> World
|
||||
resetAttachmentEffect itm cr w
|
||||
|
||||
+3
-3
@@ -21,13 +21,13 @@ useRewindGun _ _ w = case _rewindWorlds (_cWorld w) of
|
||||
(w':ws) -> rewindusing w' ws
|
||||
_ -> w
|
||||
where
|
||||
rewindusing :: CWorld -> [CWorld] -> World
|
||||
rewindusing w' ws = w
|
||||
& cWorld . maybeWorld .~ Just' ( w'
|
||||
-- & creatures . ix (_crID cr) .~ cr
|
||||
& upbuts
|
||||
& cWorld . rewindWorlds .~ ws
|
||||
& rewindWorlds .~ ws
|
||||
)
|
||||
upbuts = (cWorld . keys .~ _keys (_cWorld w)) . (cWorld . mouseButtons .~ _mouseButtons (_cWorld w))
|
||||
upbuts = (keys .~ _keys (_cWorld w)) . (mouseButtons .~ _mouseButtons (_cWorld w))
|
||||
|
||||
-- be careful changing this around; potential problems include updating the
|
||||
-- creature but using the old crInvSel value
|
||||
|
||||
+2
-2
@@ -199,8 +199,8 @@ setOldPos cr = cr
|
||||
|
||||
doRewind :: World -> World
|
||||
doRewind w = case _maybeWorld (_cWorld w) of
|
||||
Just' w' -> w' & cWorld . timeFlow .~ RewindingLastFrame
|
||||
Nothing' -> w & cWorld . timeFlow .~ NormalTimeFlow
|
||||
Just' cw -> w & cWorld .~ (cw & timeFlow .~ RewindingLastFrame)
|
||||
Nothing' -> w & cWorld . timeFlow .~ NormalTimeFlow
|
||||
|
||||
zoneCreatures :: World -> World
|
||||
zoneCreatures w = w
|
||||
|
||||
+2
-1
@@ -4,8 +4,9 @@ module FoldlHelp
|
||||
, module Control.Foldl
|
||||
) where
|
||||
import Control.Foldl
|
||||
import MaybeHelp
|
||||
|
||||
data Maybe' a = Just' !a | Nothing'
|
||||
--data Maybe' a = Just' !a | Nothing'
|
||||
data Pair a b = !a :!: !b
|
||||
|
||||
minimumOn :: Ord b => (a -> b) -> Fold a (Maybe a)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ module MaybeHelp where
|
||||
import Control.Lens
|
||||
|
||||
data Maybe' a = Just' {__Just' :: a} | Nothing'
|
||||
deriving (Eq,Ord,Show)
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
|
||||
fromJust' :: Maybe' a -> a
|
||||
fromJust' mx = case mx of
|
||||
|
||||
Reference in New Issue
Block a user