124 keys2 = Set.fromList ["AMMO", "SCHEME", "SCRIPT", "THEME"] |
124 keys2 = Set.fromList ["AMMO", "SCHEME", "SCRIPT", "THEME"] |
125 sane = Set.null (keys1 Set.\\ Map.keysSet mParams) |
125 sane = Set.null (keys1 Set.\\ Map.keysSet mParams) |
126 && Set.null (keys2 Set.\\ Map.keysSet prms) |
126 && Set.null (keys2 Set.\\ Map.keysSet prms) |
127 && (not . null . drop 41 $ scheme) |
127 && (not . null . drop 41 $ scheme) |
128 && (not . null . tail $ prms Map.! "AMMO") |
128 && (not . null . tail $ prms Map.! "AMMO") |
129 && ((B.length . head $ prms Map.! "AMMO") > 200) |
129 && ((B.length . head . tail $ prms Map.! "AMMO") > 200) |
130 mapGenTypes = ["+rnd+", "+maze+", "+drawn+", "+perlin+"] |
130 mapGenTypes = ["+rnd+", "+maze+", "+drawn+", "+perlin+"] |
131 scriptName = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms |
131 scriptName = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms |
132 maybeScript = let s = scriptName in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]] |
132 maybeScript = let s = scriptName in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", spaces2Underlining s, ".lua"]] |
133 maybeMap = let m = mParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]] |
133 maybeMap = let m = mParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]] |
134 scheme = tail $ prms Map.! "SCHEME" |
134 scheme = tail $ prms Map.! "SCHEME" |
135 mapgen = mParams Map.! "MAPGEN" |
135 mapgen = mParams Map.! "MAPGEN" |
136 mazeSizeMsg = eml ["e$maze_size ", mParams Map.! "MAZE_SIZE"] |
136 mazeSizeMsg = eml ["e$maze_size ", mParams Map.! "MAZE_SIZE"] |
137 mapgenSpecific = case mapgen of |
137 mapgenSpecific = case mapgen of |
164 $ hedgehogs t |
164 $ hedgehogs t |
165 ) |
165 ) |
166 infRopes = ammoStr `B.index` 7 == '9' |
166 infRopes = ammoStr `B.index` 7 == '9' |
167 vamp = gameFlags .&. 0x00000200 /= 0 |
167 vamp = gameFlags .&. 0x00000200 /= 0 |
168 infattacks = gameFlags .&. 0x00100000 /= 0 |
168 infattacks = gameFlags .&. 0x00100000 /= 0 |
|
169 spaces2Underlining = B.map (\c -> if c == ' ' then '_' else c) |
169 |
170 |
170 drawnMapData :: B.ByteString -> [B.ByteString] |
171 drawnMapData :: B.ByteString -> [B.ByteString] |
171 drawnMapData = |
172 drawnMapData = |
172 L.map (\m -> eml ["edraw ", BW.pack m]) |
173 L.map (\m -> eml ["edraw ", BW.pack m]) |
173 . L.unfoldr by200 |
174 . L.unfoldr by200 |
193 , ("e$casefreq", 1) |
194 , ("e$casefreq", 1) |
194 , ("e$minestime", 1000) |
195 , ("e$minestime", 1000) |
195 , ("e$minesnum", 1) |
196 , ("e$minesnum", 1) |
196 , ("e$minedudpct", 1) |
197 , ("e$minedudpct", 1) |
197 , ("e$explosives", 1) |
198 , ("e$explosives", 1) |
|
199 , ("e$airmines", 1) |
198 , ("e$healthprob", 1) |
200 , ("e$healthprob", 1) |
199 , ("e$hcaseamount", 1) |
201 , ("e$hcaseamount", 1) |
200 , ("e$waterrise", 1) |
202 , ("e$waterrise", 1) |
201 , ("e$healthdec", 1) |
203 , ("e$healthdec", 1) |
202 , ("e$ropepct", 1) |
204 , ("e$ropepct", 1) |