Don’t over-:use packages (hee-hee)

This commit is contained in:
Jaidyn Ann 2023-06-19 14:56:13 -05:00
parent b8faba4c6a
commit 6467d9bec3
5 changed files with 28 additions and 27 deletions

View File

@ -19,8 +19,7 @@
(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))
@ -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 theyve 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))))

View File

@ -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 games 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)))))

View File

@ -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."

View File

@ -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))
#\|))))

View File

@ -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)))