Freshly copy maps at start, for “death” support
That is, whenever the game is restarted, the maps are freshly-copied, thanks to our dear deep-copier METACOPY.
This commit is contained in:
parent
3c7157320b
commit
8e9e279d9e
|
@ -1,5 +1,5 @@
|
||||||
(defsystem "flora-search-aurora"
|
(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-operation "program-op"
|
||||||
:build-pathname "flora-search-aurora"
|
:build-pathname "flora-search-aurora"
|
||||||
:entry-point "flora-search-aurora:main"
|
:entry-point "flora-search-aurora:main"
|
||||||
|
|
|
@ -191,6 +191,7 @@ run the :USE function of the nearest entity, if it has any."
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
;;; The Outside World™
|
;;; The Outside World™
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
|
|
||||||
(defun factory-window-interact (&optional map interactee-id)
|
(defun factory-window-interact (&optional map interactee-id)
|
||||||
(make-dialogue-state
|
(make-dialogue-state
|
||||||
map
|
map
|
||||||
|
@ -428,7 +429,7 @@ run the :USE function of the nearest entity, if it has any."
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
;;; School prologue: Childhood friend
|
;;; School prologue: Childhood friend
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
(defparameter *flashback-school*
|
(defun flashback-school ()
|
||||||
(list
|
(list
|
||||||
:title '(:eo "ANTAŬLUDO I" :en "PROLOGUE I")
|
:title '(:eo "ANTAŬLUDO I" :en "PROLOGUE I")
|
||||||
:subtitle '(:eo "Antaŭ kvar jaroj..." :en "Four years ago...")
|
:subtitle '(:eo "Antaŭ kvar jaroj..." :en "Four years ago...")
|
||||||
|
@ -720,7 +721,7 @@ avoid triggering this."
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
;;; Casino prologue: Bad gambler!
|
;;; Casino prologue: Bad gambler!
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
(defparameter *flashback-casino*
|
(defun flashback-casino ()
|
||||||
(list
|
(list
|
||||||
:title '(:eo "ANTAŬLUDO II" :en "PROLOGUE II")
|
:title '(:eo "ANTAŬLUDO II" :en "PROLOGUE II")
|
||||||
:subtitle '(:eo "Antaŭ du jaroj..." :en "Two years ago...")
|
:subtitle '(:eo "Antaŭ du jaroj..." :en "Two years ago...")
|
||||||
|
@ -873,8 +874,8 @@ avoid triggering this."
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
;;; Flashbacks, generally
|
;;; Flashbacks, generally
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
(defparameter *flashbacks*
|
(defun flashbacks ()
|
||||||
(list *flashback-casino* *flashback-school*))
|
(list (flashback-casino) (flashback-school)))
|
||||||
|
|
||||||
|
|
||||||
(defparameter *numerology-excerpts*
|
(defparameter *numerology-excerpts*
|
||||||
|
@ -903,10 +904,23 @@ avoid triggering this."
|
||||||
(list :drop 1 :parameters (list :map (merge-maps map *outdoors-map*))))))
|
(list :drop 1 :parameters (list :map (merge-maps map *outdoors-map*))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; ———————————————————————————————————
|
;;; ———————————————————————————————————
|
||||||
;;; Main-menu data
|
;;; 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 ()
|
(defun submenu ()
|
||||||
`((:en "IDK"
|
`((:en "IDK"
|
||||||
:selection 100 :selected t)
|
:selection 100 :selected t)
|
||||||
|
@ -917,7 +931,7 @@ avoid triggering this."
|
||||||
(defun main-menu ()
|
(defun main-menu ()
|
||||||
`((:en "PLAY" :eo "EKLUDI"
|
`((:en "PLAY" :eo "EKLUDI"
|
||||||
:selection 100 :selected t
|
:selection 100 :selected t
|
||||||
:function ,(make-flashback-function (alexandria:random-elt *flashbacks*)))
|
:function ,(start-game-function))
|
||||||
(:en "SUBMENU" :eo "SUBMENUO" :row 1
|
(:en "SUBMENU" :eo "SUBMENUO" :row 1
|
||||||
:function ,(📋:make-menu-function (submenu)))
|
:function ,(📋:make-menu-function (submenu)))
|
||||||
(:en "TERURE" :eo "BADLY" :row 1)
|
(:en "TERURE" :eo "BADLY" :row 1)
|
||||||
|
|
|
@ -83,8 +83,8 @@ map hash-table, as used by the game."
|
||||||
hash))
|
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."
|
"Given a map, generate source-code that corresponds to it."
|
||||||
(with-open-file (file-stream path :direction :output :if-exists :supersede)
|
(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))))
|
package variable (map->plist map))))
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
(local-path (format nil "res/maps/~A.tmx.lisp" map-name))
|
(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)))
|
(overworld.tiled:load-map (local-path (format nil "res/maps/~A.tmx" map-name)))
|
||||||
":FLORA-SEARCH-AURORA"
|
":FLORA-SEARCH-AURORA"
|
||||||
(format nil "*~A-map*" map-name)))
|
(format nil "*~A-map-plist*" map-name)))
|
||||||
'("casino" "outdoors" "flashback-casino" "flashback-school"))
|
'("casino" "outdoors" "flashback-casino" "flashback-school"))
|
||||||
|
|
||||||
(quit)
|
(quit)
|
||||||
|
|
Ŝarĝante…
Reference in New Issue