diff --git a/dialogue.lisp b/dialogue.lisp index f440f54..c4c780c 100644 --- a/dialogue.lisp +++ b/dialogue.lisp @@ -96,7 +96,7 @@ If not, have some tea on me: I’m paying. =w=" (defun dialogue-speaker (dialogue) "Get the DIALOGUE-speaker’s corresponding identifying symbol. Because they’re stored in strings. So we gotta, like, unstringify. Ya dig?" - (intern (string-upcase (getf dialogue :speaker)))) + (getf dialogue :speaker)) @@ -124,7 +124,7 @@ If FACE is NIL… guess what that does. :^)" (defun update-speaking-face (map dialogue) "Given a line (plist) of DIALOGUE, change speaker’s face to either their talking-face or the face given by the DIALOGUE." - (let* ((speaker (intern (string-upcase (getf dialogue :speaker)))) + (let* ((speaker (getf dialogue :speaker)) (new-face (appropriate-face map speaker (getf dialogue :face)))) ;; Replace the face, when appropriate. (when new-face @@ -134,7 +134,7 @@ talking-face or the face given by the DIALOGUE." (defun update-entity-data (map dialogue) "Given a plist of DIALOGUE, update an arbitrary bit of data in the speaker's data, using :SET and :TO of the DIALOGUE." - (let* ((speaker (intern (string-upcase (getf dialogue :speaker)))) + (let* ((speaker (getf dialogue :speaker)) (key (getf dialogue :set)) (data (getf dialogue :to))) (when (and key data) @@ -295,7 +295,7 @@ The data returned is a list of the box’es top-left coordinate, max-column, and max-row; for use with RENDER-STRING. Like so: ((:x X :y Y) MAX-COLUMN MAX-ROW)" (let* ((speaker-id (dialogue-speaker dialogue)) - (playerp (eq speaker-id '🌍:player)) + (playerp (eq speaker-id 'player)) ;;'✿:player)) (leftp (not (🌍:getf-entity-data map speaker-id :facing-right))) (text (getf dialogue :text)) (coords (🌍:world-coords->screen-coords (🌍:getf-entity-data map speaker-id :coords)))) diff --git a/flora-search-aurora.asd b/flora-search-aurora.asd new file mode 100644 index 0000000..9d08274 --- /dev/null +++ b/flora-search-aurora.asd @@ -0,0 +1,16 @@ +(defsystem "flora-search-aurora" + :depends-on ("alexandria" "assoc-utils" "cl-charms" "cl-tiled" "str") + :build-operation "program-op" + :build-pathname "flora-search-aurora" + :entry-point "flora-search-aurora:main" + :components ((:file "util") + (:file "display") + (:file "input") + (:file "ui") + (:file "overworld.util") + (:file "overworld") + (:file "dialogue") + (:file "engine") + (:file "flora-search-aurora") + (:file "res/maps/casino.tmx") + (:file "res/maps/outdoors.tmx"))) diff --git a/flora-search-aurora.lisp b/flora-search-aurora.lisp index 3a3f63e..851396c 100644 --- a/flora-search-aurora.lisp +++ b/flora-search-aurora.lisp @@ -17,17 +17,6 @@ ;;;; A simple TUI-game made for the text-flavoured LibreJam of 2023-06! ;;;; See: https://jamgaroo.xyz/jams/2 -(ql:quickload '(alexandria anaphora assoc-utils cl-charms cl-tiled str)) - -(load "util.lisp") -(load "input.lisp") -(load "display.lisp") -(load "ui.lisp") -(load "overworld.util.lisp") -(load "overworld.lisp") -(load "dialogue.lisp") -(load "engine.lisp") - (defpackage :flora-search-aurora (:nicknames :fsa :✿) (:export #:main) @@ -42,8 +31,6 @@ (defvar *outdoors-map* nil) - - ;;; ——————————————————————————————————— ;;; Trans-map entity interactions @@ -68,11 +55,11 @@ of a new item. The attributes set for the entity item should be: REACTION-TALKING All are optional, save ID." (start-dialogue - (face 'player (or (getf item-plist :reaction-face) "^_^") - (or (getf item-plist :reaction-talking) "^o^")) + (face 'player (or (getf item-plist :reaction-face) "^_^") + (or (getf item-plist :reaction-talking) "^o^")) (mumble 'player :en (format nil "(Hey, it's a ~A! ~A!)" - (or (getf item-plist :name-en) (getf item-plist :id)) - (or (getf item-plist :adjective-en) "Nice")) + (or (getf item-plist :name-en) (getf item-plist :id)) + (or (getf item-plist :adjective-en) "Nice")) :eo (format nil "(Ho, jen ~A! ~A!)" (or (getf item-plist :name-eo) (getf item-plist :id)) (or (getf item-plist :adjective-eo) "Interese"))) @@ -97,7 +84,7 @@ Should be the `interact` function for takeable items." ;;; ——————————————————————————————————— ;;; The Outside World™ ;;; ——————————————————————————————————— -(load "res/maps/outdoors.tmx.lisp") +;;(load "res/maps/outdoors.tmx.lisp") (defun casino-entrance-trigger (&optional map) (list :map (🌍:merge-maps map *casino-map*))) @@ -109,60 +96,60 @@ Should be the `interact` function for takeable items." ;;; ——————————————————————————————————— (defun childhood-friend-greetings (map) (…:incf-0 (getf-act map :sasha-greetings)) - (let ((sasha "childhood-friend")) + (let ((sasha 'childhood-friend)) (case (getf-act map :sasha-greetings) (0 (💬:start-dialogue - (💬:mumble sasha :en "...") - (💬:say "player" :eo "Kielas apud la mar'?" - :en "How's the view?") - (💬:face "player" "<.<" "o<") - (face "player" "=w=" "=u=") - (mumble "player" :eo "Eee.. pardonu." - :en "Well... sorry."))) + (face 'player ":w:" ":o:") + (say 'player :eo "Nu... Vi staris tie ĉi senmove dum la pastintaj tri tagoj..." + :en "So... You've stood around here for three days already, you've hardly moved...") + (say sasha :eo "Pŝ! Do?! Mi simple havas multajn pripensindaĵojn! Mi tiom multe okupiĝas!" + :en "Pff! So what?! My mind's just busy! I've got a lot going on right now!" + :face "vov") + (say sasha :eo "Ne ŝajnigu vin supera al mi, dum vi mem senespere sencelas!!" + :en "Don't act all haughty when you're such an aimless loser yourself!!" + :face ">o<") + (face 'player "=w=" "=u=") + (mumble 'player :eo "Eee.. pardonu." + :en "Well... sorry."))) (3 (start-dialogue - (say "player" :eo "Nu, vere, mia celo sufiĉe klaras al mi. Jam baldaŭ redungiĝos." - :en "I'm not too aimless, actually. I've got good job prospects, right about now." - :face "symbol interaction) (list map interactee-id)) (list :map map)))) ;; The pause-menu… ;; ((plist = input '(:modifier nil :char #\Esc))) @@ -248,7 +248,7 @@ Returns parameters to be used in the next invocation of OVERWORLD-STATE." (let* ((coords (getf-entity-data map 'player :coords)) (trigger (trigger-at-coords map (list :x (getf coords :x) :y (getf coords :y))))) (if (and trigger (getf trigger :function)) - (apply (intern (string-upcase (getf trigger :function))) + (apply (string->symbol (getf trigger :function)) (list map)) (list :map map)))) diff --git a/overworld.tiled.lisp b/overworld.tiled.lisp index 3752b2d..51ceb1b 100644 --- a/overworld.tiled.lisp +++ b/overworld.tiled.lisp @@ -65,7 +65,7 @@ character-scale world coordinates in plist form." (when (not (tiled-rectangle-p tiled-obj)) (let ((properties (cl-tiled:properties tiled-obj))) (append - (list (intern (string-upcase (gethash "id" properties)))) + (list (string->symbol (gethash "id" properties))) (loop for key being the hash-keys in properties for val being the hash-values in properties collect (intern (string-upcase key) "KEYWORD") diff --git a/overworld.util.lisp b/overworld.util.lisp index 8e3ee69..e776cc9 100644 --- a/overworld.util.lisp +++ b/overworld.util.lisp @@ -23,19 +23,32 @@ #:world-coords->screen-coords #:world-coords-chunk #:map->plist #:plist->map + #:string->symbol #:save-map-to-file)) (in-package :flora-search-aurora.overworld.util) (defun coords->symbol (x y) - (intern (format nil "~A,~A" x y))) + (intern (format nil "~A,~A" x y) "KEYWORD")) (defun symbol->coords (coords-symbol) (str:split #\, (symbol-name coords-symbol))) +(defun string->symbol (string) + "Given a STRING with an optionally defined package (e.g., “package:symbol”), +return it as an appopriate symbol." + (let* ((split (str:split ":" (string-upcase string))) + (package (when (eq (length split) 2) + (car split))) + (symbol (or (cadr split) (car split)))) + (if package + (intern symbol package) + (intern symbol)))) + + (defun world-coords->screen-coords (world-coords &key (chunk-width 72) (chunk-height 20)) "Given a set of “world” coordinates, determine where this spot would be on the screen. The world is split into screen-sized “chunks” to this end. diff --git a/res/gen-maps.lisp b/res/gen-maps.lisp deleted file mode 100644 index 3b05f71..0000000 --- a/res/gen-maps.lisp +++ /dev/null @@ -1,17 +0,0 @@ -(ql:quickload '(alexandria cl-tiled assoc-utils str uiop)) -(load "util.lisp") -(load "overworld.util.lisp") -(load "overworld.tiled.lisp") - -(defun local-path (subpath) - (format nil "~A~A" (uiop:getcwd) subpath)) - - -(mapcar - (lambda (map-name) - (🌍.…::save-map-to-file - (local-path (format nil "res/maps/~A.tmx.lisp" map-name)) - (overworld.tiled:load-map (local-path (format nil "res/maps/~A.tmx" map-name))) - ":FLORA-SEARCH-AURORA" - (format nil "*~A-map*" map-name))) - '("casino" "outdoors")) diff --git a/res/maps/casino.tmx b/res/maps/casino.tmx index f0fd16d..dedb1e3 100644 --- a/res/maps/casino.tmx +++ b/res/maps/casino.tmx @@ -146,7 +146,7 @@ - + @@ -155,8 +155,8 @@ - - + + @@ -165,8 +165,8 @@ - - + + @@ -175,8 +175,8 @@ - - + + @@ -185,8 +185,8 @@ - - + + @@ -195,15 +195,15 @@ - - + + - + @@ -212,8 +212,8 @@ - - + + diff --git a/res/font.png b/res/maps/font.png similarity index 100% rename from res/font.png rename to res/maps/font.png diff --git a/res/maps/outdoors.tmx b/res/maps/outdoors.tmx index 07713b7..3f147fb 100644 --- a/res/maps/outdoors.tmx +++ b/res/maps/outdoors.tmx @@ -250,7 +250,7 @@ - + @@ -258,7 +258,7 @@ - + diff --git a/res/maps/tmx→lisp.lisp b/res/maps/tmx→lisp.lisp index 3b05f71..87df154 100644 --- a/res/maps/tmx→lisp.lisp +++ b/res/maps/tmx→lisp.lisp @@ -3,6 +3,12 @@ (load "overworld.util.lisp") (load "overworld.tiled.lisp") +(defpackage :flora-search-aurora + (:nicknames :fsa :✿) + (:export #:main) + (:use :cl)) + + (defun local-path (subpath) (format nil "~A~A" (uiop:getcwd) subpath)) diff --git a/run.lisp b/run.lisp new file mode 100644 index 0000000..1720c4d --- /dev/null +++ b/run.lisp @@ -0,0 +1,3 @@ +(ql:quickload :flora-search-aurora) +(load "res/maps/casino.tmx.lisp") +(flora-search-aurora:main)