diff --git a/flora-search-aurora.asd b/flora-search-aurora.asd index dbe2951..13d391a 100644 --- a/flora-search-aurora.asd +++ b/flora-search-aurora.asd @@ -1,5 +1,5 @@ (defsystem "flora-search-aurora" - :depends-on ("alexandria" "assoc-utils" "cl-charms" "str") + :depends-on ("alexandria" "assoc-utils" "cl-charms" "metacopy" "str") :build-operation "program-op" :build-pathname "flora-search-aurora" :entry-point "flora-search-aurora:main" diff --git a/flora-search-aurora.lisp b/flora-search-aurora.lisp index 5aa3af7..285d2af 100644 --- a/flora-search-aurora.lisp +++ b/flora-search-aurora.lisp @@ -191,6 +191,7 @@ run the :USE function of the nearest entity, if it has any." ;;; ——————————————————————————————————— ;;; The Outside World™ ;;; ——————————————————————————————————— + (defun factory-window-interact (&optional map interactee-id) (make-dialogue-state map @@ -428,7 +429,7 @@ run the :USE function of the nearest entity, if it has any." ;;; ——————————————————————————————————— ;;; School prologue: Childhood friend ;;; ——————————————————————————————————— -(defparameter *flashback-school* +(defun flashback-school () (list :title '(:eo "ANTAŬLUDO I" :en "PROLOGUE I") :subtitle '(:eo "Antaŭ kvar jaroj..." :en "Four years ago...") @@ -720,7 +721,7 @@ avoid triggering this." ;;; ——————————————————————————————————— ;;; Casino prologue: Bad gambler! ;;; ——————————————————————————————————— -(defparameter *flashback-casino* +(defun flashback-casino () (list :title '(:eo "ANTAŬLUDO II" :en "PROLOGUE II") :subtitle '(:eo "Antaŭ du jaroj..." :en "Two years ago...") @@ -873,8 +874,8 @@ avoid triggering this." ;;; ——————————————————————————————————— ;;; Flashbacks, generally ;;; ——————————————————————————————————— -(defparameter *flashbacks* - (list *flashback-casino* *flashback-school*)) +(defun flashbacks () + (list (flashback-casino) (flashback-school))) (defparameter *numerology-excerpts* @@ -903,10 +904,23 @@ avoid triggering this." (list :drop 1 :parameters (list :map (merge-maps map *outdoors-map*)))))) + ;;; ——————————————————————————————————— ;;; Main-menu data ;;; ——————————————————————————————————— +(defun start-game-function () + "Returns a nameless function for use as a state function. +Initializes the current instance of the game, and such." + ;; We’ve gotta make fresh copies of the maps, in case the user’s restarted the game. + ;; metacopy, I love you <3 <3 <3 + (defparameter *outdoors-map* (🌍:plist->map (metacopy:copy-thing *outdoors-map-plist*))) + (defparameter *casino-map* (🌍:plist->map (metacopy:copy-thing *casino-map-plist*))) + (defparameter *flashback-casino-map* (🌍:plist->map (metacopy:copy-thing *flashback-casino-map-plist*))) + (defparameter *flashback-school-map* (🌍:plist->map (metacopy:copy-thing *flashback-school-map-plist*))) + (make-flashback-function (alexandria:random-elt (flashbacks)))) + + (defun submenu () `((:en "IDK" :selection 100 :selected t) @@ -917,7 +931,7 @@ avoid triggering this." (defun main-menu () `((:en "PLAY" :eo "EKLUDI" :selection 100 :selected t - :function ,(make-flashback-function (alexandria:random-elt *flashbacks*))) + :function ,(start-game-function)) (:en "SUBMENU" :eo "SUBMENUO" :row 1 :function ,(📋:make-menu-function (submenu))) (:en "TERURE" :eo "BADLY" :row 1) diff --git a/overworld.util.lisp b/overworld.util.lisp index e6d65f0..b0ddfed 100644 --- a/overworld.util.lisp +++ b/overworld.util.lisp @@ -83,8 +83,8 @@ map hash-table, as used by the game." hash)) -(defun save-map-to-file (path map &optional (package ":FLORA-SEARCH-AURORA") (variable "*map*")) +(defun save-map-to-file (path map &optional (package ":FLORA-SEARCH-AURORA") (variable "*map-plist*")) "Given a map, generate source-code that corresponds to it." (with-open-file (file-stream path :direction :output :if-exists :supersede) - (format file-stream "(in-package ~A)~%(defparameter ~A~% (🌍.…:plist->map~% (QUOTE ~S)))" + (format file-stream "(in-package ~A)~%(defvar ~A ~% (QUOTE ~S))" package variable (map->plist map)))) diff --git a/res/maps/tmx→lisp.lisp b/res/maps/tmx→lisp.lisp index c14ee71..6197d59 100644 --- a/res/maps/tmx→lisp.lisp +++ b/res/maps/tmx→lisp.lisp @@ -15,7 +15,7 @@ (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))) + (format nil "*~A-map-plist*" map-name))) '("casino" "outdoors" "flashback-casino" "flashback-school")) (quit)