diff --git a/flora-search-aurora.asd b/flora-search-aurora.asd index 1bc0448..28c197a 100644 --- a/flora-search-aurora.asd +++ b/flora-search-aurora.asd @@ -7,6 +7,7 @@ (:file "display") (:file "input") (:file "ui") + (:file "inventory") (:file "overworld.util") (:file "overworld") (:file "dialogue") diff --git a/inventory.lisp b/inventory.lisp new file mode 100644 index 0000000..66cc70a --- /dev/null +++ b/inventory.lisp @@ -0,0 +1,65 @@ + +;;;; Copyright Β© 2023, Jaidyn Ann +;;;; +;;;; This program is free software: you can redistribute it and/or +;;;; modify it under the terms of the GNU General Public License as +;;;; published by the Free Software Foundation, either version 3 of +;;;; the License, or (at your option) any later version. +;;;; +;;;; This program is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with this program. If not, see . + +;;;; FLORA-SEARCH-AURORA.INVENTORY +;;;; The menu for inventory selection/management. + +(defpackage :flora-search-aurora.inventory + (:nicknames :fsa.inv :inventory :πŸŽ’) + (:use :cl) + (:export #:inventory-state #:make-inventory-state)) + +(in-package :flora-search-aurora.inventory) + + +;;; β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” +;;; Inventory loop logic +;;; β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” +(defun inventory-state-update (map) + (if (and (listen) + (let ((input (getf (⌨:read-gamefied-char-plist) :semantic))) + (or (eq input '⌨:πŸ†—) + (eq input '⌨:❎)))) + (values nil + (list :map map)) + 't)) + + + +;;; β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” +;;; Inventory loop drawing +;;; β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” +(defun inventory-state-draw (matrix items) + (πŸ“‹:render-string matrix (format nil "~A" items) '(:x 0 :y 0))) + + + +;;; β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” +;;; Inventory loop +;;; β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” +(defun inventory-state (matrix &key map) + "A state-function for use with STATE-LOOP." + (sleep .02) + (inventory-state-draw matrix (gethash :items map)) + (inventory-state-update map)) + + +(defun make-inventory-state (map) + "Return a state-function for inventory-listing, for use with STATE-LOOP." + (lambda (matrix &key (map map)) + (apply #'πŸŽ’:inventory-state + (list matrix :map map)))) + diff --git a/overworld.lisp b/overworld.lisp index b4a1e61..44ea661 100644 --- a/overworld.lisp +++ b/overworld.lisp @@ -224,12 +224,12 @@ Returns parameters to be used in the next invocation of OVERWORLD-STATE." (if interaction (apply (string->symbol interaction) (list map interactee-id)) (list :map map)))) - ;; The pause-menu… -;; ((plist = input '(:modifier nil :char #\Esc))) + ('⌨:❎ + (πŸŽ’:make-inventory-state map)) ;; Simple up-down-left-right movements ('⌨:β†’ (move-player map :Ξ”x 1)) - ('⌨:β†’ + ('⌨:← (move-player map :Ξ”x -1)) ('⌨:↑ (move-player map :Ξ”y -1))