Refactor inventory management, add tweak, combine and inspect modes
This commit is contained in:
@@ -16,7 +16,7 @@ import Dodge.LightSources
|
||||
import Dodge.LevelGen
|
||||
import Dodge.Creature.Inanimate
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Dodge.Event.Test
|
||||
--import Dodge.Event.Test
|
||||
import Dodge.Event.Menu
|
||||
|
||||
import SDL
|
||||
@@ -51,14 +51,22 @@ handlePressedKeyInGame scode w
|
||||
| scode == dropItemKey (_keyConfig w) = Just $ youDropItem w
|
||||
| scode == toggleMapKey (_keyConfig w) = Just $ toggleMap w
|
||||
| scode == reloadKey (_keyConfig w) = Just $ fromMaybe w $ startReloadingWeapon (you w) w
|
||||
| scode == testEventKey (_keyConfig w) = Just $ testEvent w
|
||||
-- | scode == testEventKey (_keyConfig w) = Just $ testEvent w
|
||||
| scode == spaceActionKey (_keyConfig w) = Just $ spaceAction w
|
||||
| scode == rotateCameraPlusKey (_keyConfig w) = Just $ w & cameraRot +~ 0.01
|
||||
| scode == rotateCameraMinusKey (_keyConfig w) = Just $ w & cameraRot -~ 0.01
|
||||
| scode == ScancodeF5 = Just $ dropLight w
|
||||
| scode == ScancodeF6 = Just $ dropLight' w
|
||||
| scode == ScancodeT = Just $ w & inventoryMode %~ toggleInv TweakInventory
|
||||
| scode == ScancodeC = Just $ w & inventoryMode %~ toggleInv CombineInventory
|
||||
| scode == ScancodeI = Just $ w & inventoryMode %~ toggleInv InspectInventory
|
||||
handlePressedKeyInGame _ w = Just w
|
||||
|
||||
toggleInv :: InventoryMode -> InventoryMode -> InventoryMode
|
||||
toggleInv x y
|
||||
| x == y = TopInventory
|
||||
| otherwise = x
|
||||
|
||||
|
||||
inTerminal :: World -> Bool
|
||||
inTerminal w = case _menuLayers w of
|
||||
|
||||
Reference in New Issue
Block a user