diff --git a/biomes.lisp b/biomes.lisp index 7894167..a723d8d 100644 --- a/biomes.lisp +++ b/biomes.lisp @@ -63,7 +63,7 @@ (new-biome desert :ground "deep, drifting sand" - :char #\~ :col ':white ;XXX yellow would be better, but shows up brown - :features '((cactus 100) (bolder 200))) + :char #\^ :col ':white ;XXX yellow would be better, but shows up brown + :features '((cactus 100) (boulder 200))) ;;TODO desert diff --git a/biomes.lisp b/biomes.lisp index 7894167..a723d8d 100644 --- a/biomes.lisp +++ b/biomes.lisp @@ -63,7 +63,7 @@ (new-biome desert :ground "deep, drifting sand" - :char #\~ :col ':white ;XXX yellow would be better, but shows up brown - :features '((cactus 100) (bolder 200))) + :char #\^ :col ':white ;XXX yellow would be better, but shows up brown + :features '((cactus 100) (boulder 200))) ;;TODO desert diff --git a/naledi.lisp b/naledi.lisp index 4227b4e..f7319f2 100644 --- a/naledi.lisp +++ b/naledi.lisp @@ -59,11 +59,12 @@ ;;TODO implement missing functions (draw-map mapwin me) (draw-player-panel playerwin) - (draw-place-panel placewin) + (draw-place-panel placewin me) (draw-news-panel newswin)) (defun draw-map (win me) "Draw a portion of the game map in an ncurses window" + ;;FIXME do I have a transpose bug here? (setf (.color-pair win) '(:white :black)) (box win) (setf (.cursor-position win) '(1 1)) @@ -75,6 +76,7 @@ (if (null p) (add-char win #\space) (if (and (= (first (patch-pos p)) (first me)) (= (second (patch-pos p)) (second me))) + ;;FIXME `me' is not drawn (progn (setf (.color-pair win) '(:white :black)) (add-char win #\X)) (if (patch-occupant p) @@ -101,13 +103,17 @@ (add-string win "This is the player panel.") (refresh win)) -(defun draw-place-panel (win) +(defun draw-place-panel (win me) "Draw a panel with information about the player's current location." - ;;TODO - (box win) - (setf (.cursor-position win) '(1 1)) - (add-string win "This is the place panel.") - (refresh win)) + (let* ((p (coord (first me) (second me))) (descr (describe-patch p))) + (clear win) + (box win) + (setf (.cursor-position win) '(1 1)) + (dolist (d descr) + (add-string win d) + (setf (.cursor-position win) + (list (1+ (first (.cursor-position win))) 1))) + (refresh win))) (let ((news '("Press h for help."))) (defun draw-news-panel (win) diff --git a/biomes.lisp b/biomes.lisp index 7894167..a723d8d 100644 --- a/biomes.lisp +++ b/biomes.lisp @@ -63,7 +63,7 @@ (new-biome desert :ground "deep, drifting sand" - :char #\~ :col ':white ;XXX yellow would be better, but shows up brown - :features '((cactus 100) (bolder 200))) + :char #\^ :col ':white ;XXX yellow would be better, but shows up brown + :features '((cactus 100) (boulder 200))) ;;TODO desert diff --git a/naledi.lisp b/naledi.lisp index 4227b4e..f7319f2 100644 --- a/naledi.lisp +++ b/naledi.lisp @@ -59,11 +59,12 @@ ;;TODO implement missing functions (draw-map mapwin me) (draw-player-panel playerwin) - (draw-place-panel placewin) + (draw-place-panel placewin me) (draw-news-panel newswin)) (defun draw-map (win me) "Draw a portion of the game map in an ncurses window" + ;;FIXME do I have a transpose bug here? (setf (.color-pair win) '(:white :black)) (box win) (setf (.cursor-position win) '(1 1)) @@ -75,6 +76,7 @@ (if (null p) (add-char win #\space) (if (and (= (first (patch-pos p)) (first me)) (= (second (patch-pos p)) (second me))) + ;;FIXME `me' is not drawn (progn (setf (.color-pair win) '(:white :black)) (add-char win #\X)) (if (patch-occupant p) @@ -101,13 +103,17 @@ (add-string win "This is the player panel.") (refresh win)) -(defun draw-place-panel (win) +(defun draw-place-panel (win me) "Draw a panel with information about the player's current location." - ;;TODO - (box win) - (setf (.cursor-position win) '(1 1)) - (add-string win "This is the place panel.") - (refresh win)) + (let* ((p (coord (first me) (second me))) (descr (describe-patch p))) + (clear win) + (box win) + (setf (.cursor-position win) '(1 1)) + (dolist (d descr) + (add-string win d) + (setf (.cursor-position win) + (list (1+ (first (.cursor-position win))) 1))) + (refresh win))) (let ((news '("Press h for help."))) (defun draw-news-panel (win) diff --git a/world.lisp b/world.lisp index 087cf5b..51db293 100644 --- a/world.lisp +++ b/world.lisp @@ -109,6 +109,8 @@ ;; TOPOGRAPHY FUNCTIONS +;;XXX Do I still need these? + (defun print-topography (&optional (stream T) (world *world*)) "Print a text representation of the world and each patch's biome" (dolist (row world) @@ -123,6 +125,9 @@ (with-open-file (tf file-name :direction :output) (print-topography tf))) + +;; WORLD CREATION FUNCTIONS + (defun get-patch-feature (patch) "Find a random feature (or none) to occupy this patch." (let ((flist (biome-features (patch-biome patch)))) @@ -173,3 +178,15 @@ (dotimes (s (round (/ (expt size 2) 2000))) (generate-stream (random size) (random size) world)) world)) + +(defun describe-patch (p) + "Return a list of lines describing this patch." + (list (string-upcase (biome-name (patch-biome p))) "" + (format NIL "~A / ~A" (first (patch-pos p)) (second (patch-pos p))) "" + (format NIL "The ground here is ~A." (biome-ground (patch-biome p))) + (when (patch-occupant p) + (format NIL "There is a ~A here." (.name (patch-occupant p)))) + (when (patch-items p) + ;;FIXME we will be dealing with instances here, not names... + (format NIL "The following items are here:~A *~A" #\newline + (string-from-list (patch-items p) (format NIL "~% *"))))))