From 6467d9bec3137a1d1f5b345e114f71df95846065 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:56:13 -0500 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20over-:use=20packages=20(hee-hee?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dialogue.lisp | 15 +++++++-------- flora-search-aurora.lisp | 16 ++++++++-------- input.lisp | 10 +++++++--- overworld.lisp | 8 +++----- ui.lisp | 6 +++--- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/dialogue.lisp b/dialogue.lisp index 85aa7ca..c02888f 100644 --- a/dialogue.lisp +++ b/dialogue.lisp @@ -19,10 +19,9 @@ (defpackage :flora-search-aurora.dialogue (:nicknames :fsa.dia :dialogue :πŸ’¬) - (:use :cl - :flora-search-aurora.overworld :flora-search-aurora.ui :flora-search-aurora.input) + (:use :cl) (:export #:dialogue-state - #:start-dialogue #:face #:say #:mumble)) + #:start-dialogue #:face #:say #:mumble)) (in-package :flora-search-aurora.dialogue) @@ -61,7 +60,7 @@ (defun pressed-enter-p () "Whether or not the enter/return key has been pressed recently." (and (listen) - (eq (getf (normalize-char-plist (read-char-plist)) :char) + (eq (getf (⌨:normalize-char-plist (⌨:read-char-plist)) :char) #\return))) @@ -71,8 +70,8 @@ If FACE is a string, used that. If FACE is 'TALKING-FACE, then use their talking-face (if they have one). If FACE is 'NORMAL-FACE, then use their normal-face (if they’ve got one). If FACE is NIL… guess what that does. :^)" - (let ((talking-face (getf-entity-data map speaker :talking-face)) - (normal-face (getf-entity-data map speaker :normal-face))) + (let ((talking-face (🌍:getf-entity-data map speaker :talking-face)) + (normal-face (🌍:getf-entity-data map speaker :normal-face))) (cond ((and (eq face 'talking-face) talking-face) talking-face) @@ -90,7 +89,7 @@ talking-face or the face given by the dialogue." (new-face (appropriate-face map speaker (getf dialogue :face)))) ;; Replace the face, when appropriate. (when new-face - (setf (getf-entity-data map speaker :face) new-face)))) + (setf (🌍:getf-entity-data map speaker :face) new-face)))) (defun progress-line-delivery (dialogue) @@ -133,7 +132,7 @@ Helper function for DIALOGUE-STATE." (progress (getf (car dialogue-list) :progress))) (when text (✎:show-cursor) - (render-string-partially matrix text 0 0 :char-count progress)))) + (πŸ“‹:render-string-partially matrix text 0 0 :char-count progress)))) diff --git a/flora-search-aurora.lisp b/flora-search-aurora.lisp index 3166ce5..7ba7a6b 100644 --- a/flora-search-aurora.lisp +++ b/flora-search-aurora.lisp @@ -45,8 +45,8 @@ (dialogue (πŸ’¬:start-dialogue (πŸ’¬:say "literary-girl" "Blah blah, testing. A multi-lined one. For real! jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj akls djlaks jdlaksj dlakjsd") (πŸ’¬:say "player" "ktp ktp jes jes?")))) - (overworld-state-draw matrix map) - (dialogue-state matrix :map map :dialogue dialogue))) + (🌍:overworld-state-draw matrix map) + (πŸ’¬:dialogue-state matrix :map map :dialogue dialogue))) (defun state-loop @@ -71,7 +71,7 @@ overheat, or something Β―\_(ツ)_/Β―" (when states (multiple-value-bind (state-result new-state-params) (apply (car states) (cons matrix state-params)) ;; Run the latest-added update/draw loop - (print-screen-matrix (matrix-delta last-matrix matrix)) ;; Print its results. + (✎:print-screen-matrix (✎:matrix-delta last-matrix matrix)) ;; Print its results. (force-output) (state-loop (cond ((functionp state-result) @@ -97,7 +97,7 @@ overheat, or something Β―\_(ツ)_/Β―" (FUNCTION . ,#'make-options-menu-state)) ((LABEL . "QUIT") (RETURN . NIL))))) (lambda (matrix) - (menu-state matrix main-menu)))) + (πŸ“‹:menu-state matrix main-menu)))) (defun make-options-menu-state () @@ -109,14 +109,14 @@ overheat, or something Β―\_(ツ)_/Β―" ((LABEL . "GO BACK") (RETURN . ,NIL))))) (lambda (matrix) - (menu-state matrix options-menu)))) + (πŸ“‹:menu-state matrix options-menu)))) (defun make-main-overworld-state () "Return a state-function for the game’s overworld (the majority of the game), for use with STATE-LOOP." (lambda (matrix &rest args) - (apply #'overworld-state + (apply #'🌍:overworld-state (append (list matrix) '(:map-path #p"/home/jaidyn/.local/src/games/flora search aurora/res/map.tmx") args)))) @@ -126,8 +126,8 @@ with STATE-LOOP." "A pathetic fascimile of a main loop. What does it do? WHAST DOES TI DODOO?" (cl-charms:with-curses () (cl-charms:enable-raw-input :interpret-control-characters 't) - (hide-cursor) - (clear-screen) + (✎:hide-cursor) + (✎:clear-screen) (state-loop (list (make-main-menu-state))))) diff --git a/input.lisp b/input.lisp index 2e2a741..b3144da 100644 --- a/input.lisp +++ b/input.lisp @@ -18,7 +18,9 @@ (defpackage :flora-search-aurora.input (:use :cl) - (:export #:read-char-plist #:normalize-char-plist + (:nicknames :fsa.i :input :⌨) + (:export #:read-char-plist #:normalize-char-plist #:plist-char-p + :control :meta :shift +qwerty-layout+ +dvorak-layout+)) (in-package :flora-search-aurora.input) @@ -93,8 +95,10 @@ characters, like left arrow-key (escaped D) into ← (β€œLEFTWARDS ARROW”)." (getf char-plist :char)))) -;;; ~ Utilities ~ - + +;;; β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” +;;; Misc. utils +;;; β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” (defun parallel-list-item (item-a list-a list-b &key (test #'eql)) "Given two parallel lists and an item contained in the first list, return its corresponding item in the other list, by index." diff --git a/overworld.lisp b/overworld.lisp index 4a070ec..ef9262f 100644 --- a/overworld.lisp +++ b/overworld.lisp @@ -18,12 +18,10 @@ ;;;; the primary gameplay, the RPG-ish-ish bits). (defpackage :flora-search-aurora.overworld - (:nicknames :fsa.o :overworld) + (:nicknames :fsa.o :overworld :🌍) (:use :cl - :flora-search-aurora.input :flora-search-aurora.display :flora-search-aurora.ui :flora-search-aurora.overworld.tiled :flora-search-aurora.overworld.util) (:export #:overworld-state #:overworld-state-draw - #:dialogue-state #:getf-entity #:getf-entity-data :player)) @@ -117,7 +115,7 @@ Returns parameters to be used in the next invocation of OVERWORLD-STATE." (defun process-overworld-input (map) "Get and process any keyboard input, modifying the map or entities as necessary." (if (listen) - (let* ((input (normalize-char-plist (read-char-plist)))) + (let* ((input (⌨:normalize-char-plist (⌨:read-char-plist)))) (cond ;; Interacting with nearby characters/entities ((plist= input '(:modifier nil :char #\return)) @@ -222,7 +220,7 @@ alist containing a character (:CHAR) and :X & :Y coordinates." (x (if (eq direction 'right) (- (getf screen-coords :x) (floor (/ width 2)) 0) (- (getf screen-coords :x) (floor (/ width 2)) 0)))) - (render-line matrix face (+ x 1) y) + (πŸ“‹:render-line matrix face (+ x 1) y) (ignore-errors (setf (aref matrix y x) #\|)) (ignore-errors (setf (aref matrix y (+ width x -1)) #\|)))) diff --git a/ui.lisp b/ui.lisp index 4d712c5..87240a2 100644 --- a/ui.lisp +++ b/ui.lisp @@ -18,8 +18,8 @@ ;;;; Let's get to it, we're on a deadline! (defpackage :flora-search-aurora.ui - (:nicknames :fsa.u :ui) - (:use :cl :flora-search-aurora.display :flora-search-aurora.input :assoc-utils) + (:nicknames :fsa.u :ui :πŸ“‹) + (:use :cl :assoc-utils) (:export #:menu-state #:render-line #:render-string #:render-string-partially :label :selection :selected)) @@ -185,7 +185,7 @@ That is, 0 for non-selected items and 100 for selected items." (defun process-menu-input (menu-alist) "Get and process any keyboard input, modifying the menu alist as necessary." (if (listen) - (let* ((input (normalize-char-plist (read-char-plist))) + (let* ((input (⌨:normalize-char-plist (⌨:read-char-plist))) (selected-item (nth (selected-menu-item-position menu-alist) menu-alist)) (func (cdr (assoc 'function selected-item)))