Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

all heroes on level now displayed; player in reverse video

  • Loading branch information...
commit 96a3f1e51ee451c35997760d71d085f1dbc1e8b6 1 parent 081101a
@Mikolaj Mikolaj authored
Showing with 11 additions and 8 deletions.
  1. +3 −2 src/Display2.hs
  2. +8 −6 src/Monster.hs
View
5 src/Display2.hs
@@ -161,15 +161,16 @@ displayLevel session per
else \ vis rea -> id
(n,over) = stringByLocation (sy+1) overlay -- n is the number of overlay screens
gold = maybe 0 (icount . fst) $ findItem (\ i -> iletter i == Just '$') (mitems player)
+ hs = levelHeroList state
disp n msg =
display ((0,0),sz) session
(\ loc -> let tile = nlmap `lAt` loc
sml = ((smap ! loc) - time) `div` 100
vis = S.member loc visible
rea = S.member loc reachable
- (rv,ra) = case L.find (\ m -> loc == mloc m) (player:ms) of
+ (rv,ra) = case L.find (\ m -> loc == mloc m) (hs ++ ms) of
_ | sTer > 0 -> viewTerrain sTer False (tterrain tile)
- Just m | sOmn || vis -> viewMonster (mtype m)
+ Just m | sOmn || vis -> viewMonster (mtype m) (mtype m == mtype player)
_ | sSml && sml >= 0 -> viewSmell sml
| otherwise -> viewTile vis tile assocs
vision = lVision vis rea
View
14 src/Monster.hs
@@ -172,9 +172,11 @@ insertMonster = insertMonster' 0
| otherwise = let (n', ms') = insertMonster' (n + 1) m ms
in (n', m' : ms')
-viewMonster :: MonsterType -> (Char, Attr -> Attr)
-viewMonster (Hero n) = (if n < 1 || n > 9 then '@' else head (show n),
- setBG white . setFG black)
-viewMonster Eye = ('e', setFG red)
-viewMonster FastEye = ('e', setFG blue)
-viewMonster Nose = ('n', setFG green)
+viewMonster :: MonsterType -> Bool -> (Char, Attr -> Attr)
+viewMonster (Hero n) r = (if n < 1 || n > 9 then '@' else head (show n),
+ if r
+ then setBG white . setFG black
+ else setBG black . setFG white)
+viewMonster Eye _ = ('e', setFG red)
+viewMonster FastEye _ = ('e', setFG blue)
+viewMonster Nose _ = ('n', setFG green)
Please sign in to comment.
Something went wrong with that request. Please try again.