2023-06-04 04:04:34 -05:00
|
|
|
|
;;;; Copyright © 2023, Jaidyn Ann <jadedctrl@posteo.at>
|
|
|
|
|
;;;;
|
|
|
|
|
;;;; This program is free software: you can redistribute it and/or
|
|
|
|
|
;;;; modify it under the terms of the GNU General Public License as
|
|
|
|
|
;;;; published by the Free Software Foundation, either version 3 of
|
|
|
|
|
;;;; the License, or (at your option) any later version.
|
|
|
|
|
;;;;
|
|
|
|
|
;;;; This program is distributed in the hope that it will be useful,
|
|
|
|
|
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;;;; GNU General Public License for more details.
|
|
|
|
|
;;;;
|
|
|
|
|
;;;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
2023-06-08 21:57:51 -05:00
|
|
|
|
;;;; FLORA-SEARCH-AURORA
|
|
|
|
|
;;;; A simple TUI-game made for the text-flavoured LibreJam of 2023-06!
|
|
|
|
|
;;;; See: https://jamgaroo.xyz/jams/2
|
2023-05-31 23:04:36 -05:00
|
|
|
|
|
2023-06-07 19:02:11 -05:00
|
|
|
|
(ql:quickload '(alexandria assoc-utils cl-charms cl-tiled str))
|
|
|
|
|
|
2023-06-04 04:04:34 -05:00
|
|
|
|
(load "input.lisp")
|
|
|
|
|
(load "display.lisp")
|
2023-06-04 12:52:18 -05:00
|
|
|
|
(load "ui.lisp")
|
2023-06-17 10:12:23 -05:00
|
|
|
|
(load "overworld.util.lisp")
|
|
|
|
|
(load "overworld.tiled.lisp")
|
2023-06-09 07:07:28 -05:00
|
|
|
|
(load "overworld.lisp")
|
2023-06-19 08:47:45 -05:00
|
|
|
|
(load "dialogue.lisp")
|
2023-05-31 23:04:36 -05:00
|
|
|
|
|
2023-06-04 04:04:34 -05:00
|
|
|
|
(defpackage :flora-search-aurora
|
2023-06-19 14:43:46 -05:00
|
|
|
|
(:nicknames :fsa :✿)
|
2023-06-04 12:52:18 -05:00
|
|
|
|
(:export #:main)
|
|
|
|
|
(:use :cl
|
|
|
|
|
:flora-search-aurora.input :flora-search-aurora.display
|
2023-06-19 08:47:45 -05:00
|
|
|
|
:flora-search-aurora.overworld :flora-search-aurora.dialogue
|
|
|
|
|
:flora-search-aurora.ui))
|
2023-05-31 23:04:36 -05:00
|
|
|
|
|
2023-06-04 04:04:34 -05:00
|
|
|
|
(in-package :flora-search-aurora)
|
2023-06-04 02:33:53 -05:00
|
|
|
|
|
2023-06-17 10:12:23 -05:00
|
|
|
|
(defun literary-girl-dialogue-2 (map)
|
|
|
|
|
(print "OWO"))
|
2023-06-04 02:33:53 -05:00
|
|
|
|
|
2023-06-16 14:28:41 -05:00
|
|
|
|
(defun literary-girl-dialogue (map)
|
2023-06-17 22:47:30 -05:00
|
|
|
|
(lambda (matrix &key (map map)
|
2023-06-19 14:43:46 -05:00
|
|
|
|
(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?"))))
|
2023-06-19 14:56:13 -05:00
|
|
|
|
(🌍:overworld-state-draw matrix map)
|
|
|
|
|
(💬:dialogue-state matrix :map map :dialogue dialogue)))
|
2023-06-16 12:16:44 -05:00
|
|
|
|
|
|
|
|
|
|
2023-06-09 16:14:46 -05:00
|
|
|
|
(defun state-loop
|
|
|
|
|
(states &key (last-matrix (make-screen-matrix)) (matrix (make-screen-matrix)) (state-params nil))
|
|
|
|
|
"Begin the game’s loop, which executes (henceforthly called) state-functions over and over again
|
|
|
|
|
until Hell freezes over and a new king reigns supreme.
|
2023-06-19 08:47:45 -05:00
|
|
|
|
Given a list of state-functions, STATES, it will execute the first function.
|
2023-06-09 16:14:46 -05:00
|
|
|
|
Each state-function must take at least a single parameter, a matrix of characters. A state-function
|
|
|
|
|
should edit this matrix in-place, replacing its elements with characters that will later be printed
|
|
|
|
|
to the terminal.
|
2023-06-19 14:43:46 -05:00
|
|
|
|
What the state-function returns is pretty important, having different repercussions:
|
2023-06-19 08:47:45 -05:00
|
|
|
|
* NIL — The function is removed from STATES, and so the next function in STATES will start
|
|
|
|
|
getting executed instead.
|
|
|
|
|
* NIL; List — The function is popped off STATES and the list is used as the new parameters for
|
|
|
|
|
the next function in STATES.
|
|
|
|
|
* Function — The function is pushed to the front of STATES, and so is executed instead of the
|
|
|
|
|
current function.
|
|
|
|
|
* List — The current function (front of STATES) continues to be executed with the given
|
|
|
|
|
list as a parameters list.
|
2023-06-16 12:16:44 -05:00
|
|
|
|
Make note to add a delay w SLEEP to your state functions, or… well, y’know. Your computer will
|
|
|
|
|
overheat, or something ¯\_(ツ)_/¯"
|
2023-06-09 16:14:46 -05:00
|
|
|
|
(when states
|
2023-06-17 22:47:30 -05:00
|
|
|
|
(multiple-value-bind (state-result new-state-params)
|
|
|
|
|
(apply (car states) (cons matrix state-params)) ;; Run the latest-added update/draw loop
|
2023-06-19 14:56:13 -05:00
|
|
|
|
(✎:print-screen-matrix (✎:matrix-delta last-matrix matrix)) ;; Print its results.
|
2023-06-17 22:47:30 -05:00
|
|
|
|
(force-output)
|
|
|
|
|
(state-loop
|
|
|
|
|
(cond ((functionp state-result)
|
|
|
|
|
(cons state-result states))
|
|
|
|
|
((not state-result)
|
|
|
|
|
(cdr states))
|
|
|
|
|
('t states))
|
|
|
|
|
:last-matrix matrix
|
|
|
|
|
:state-params
|
|
|
|
|
(cond ((not state-result)
|
|
|
|
|
new-state-params)
|
|
|
|
|
((listp state-result)
|
|
|
|
|
state-result))))))
|
2023-06-09 16:14:46 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun make-main-menu-state ()
|
2023-06-16 12:16:44 -05:00
|
|
|
|
"Return a state-function for the game’s main menu, for use with STATE-LOOP."
|
2023-06-09 06:57:16 -05:00
|
|
|
|
(let ((main-menu
|
2023-06-09 16:14:46 -05:00
|
|
|
|
`(((LABEL . "PLAY")
|
|
|
|
|
(SELECTION . 100) (SELECTED . T)
|
2023-06-09 18:22:56 -05:00
|
|
|
|
(FUNCTION . ,#'make-main-overworld-state))
|
2023-06-09 06:57:16 -05:00
|
|
|
|
((LABEL . "SUBMENU")
|
2023-06-09 18:22:56 -05:00
|
|
|
|
(FUNCTION . ,#'make-options-menu-state))
|
|
|
|
|
((LABEL . "QUIT") (RETURN . NIL)))))
|
2023-06-09 06:57:16 -05:00
|
|
|
|
(lambda (matrix)
|
2023-06-19 14:56:13 -05:00
|
|
|
|
(📋:menu-state matrix main-menu))))
|
2023-06-09 06:57:16 -05:00
|
|
|
|
|
|
|
|
|
|
2023-06-09 16:14:46 -05:00
|
|
|
|
(defun make-options-menu-state ()
|
2023-06-16 12:16:44 -05:00
|
|
|
|
"Return a state-function for the options menu, for use with STATE-LOOP."
|
2023-06-09 06:57:16 -05:00
|
|
|
|
(let ((options-menu
|
2023-06-09 16:14:46 -05:00
|
|
|
|
`(((LABEL . "IDK")
|
|
|
|
|
(SELECTION . 100) (SELECTED . T)
|
|
|
|
|
(FUNCTION . ,(lambda () (print "¯\_(ツ)_/¯"))))
|
|
|
|
|
((LABEL . "GO BACK")
|
2023-06-09 18:22:56 -05:00
|
|
|
|
(RETURN . ,NIL)))))
|
2023-06-09 06:57:16 -05:00
|
|
|
|
(lambda (matrix)
|
2023-06-19 14:56:13 -05:00
|
|
|
|
(📋:menu-state matrix options-menu))))
|
2023-06-09 06:57:16 -05:00
|
|
|
|
|
|
|
|
|
|
2023-06-09 16:14:46 -05:00
|
|
|
|
(defun make-main-overworld-state ()
|
2023-06-16 12:16:44 -05:00
|
|
|
|
"Return a state-function for the game’s overworld (the majority of the game), for use
|
|
|
|
|
with STATE-LOOP."
|
2023-06-09 20:14:31 -05:00
|
|
|
|
(lambda (matrix &rest args)
|
2023-06-19 14:56:13 -05:00
|
|
|
|
(apply #'🌍:overworld-state
|
2023-06-09 20:14:31 -05:00
|
|
|
|
(append (list matrix)
|
|
|
|
|
'(:map-path #p"/home/jaidyn/.local/src/games/flora search aurora/res/map.tmx")
|
|
|
|
|
args))))
|
2023-06-09 07:07:28 -05:00
|
|
|
|
|
|
|
|
|
|
2023-06-04 02:33:53 -05:00
|
|
|
|
(defun main ()
|
2023-06-09 16:14:46 -05:00
|
|
|
|
"A pathetic fascimile of a main loop. What does it do? WHAST DOES TI DODOO?"
|
2023-06-09 06:57:16 -05:00
|
|
|
|
(cl-charms:with-curses ()
|
2023-06-19 14:43:46 -05:00
|
|
|
|
(cl-charms:enable-raw-input :interpret-control-characters 't)
|
2023-06-19 14:56:13 -05:00
|
|
|
|
(✎:hide-cursor)
|
|
|
|
|
(✎:clear-screen)
|
2023-06-19 14:43:46 -05:00
|
|
|
|
(state-loop (list (make-main-menu-state)))))
|
2023-06-08 21:57:51 -05:00
|
|
|
|
|
2023-06-04 02:33:53 -05:00
|
|
|
|
|
2023-06-09 16:14:46 -05:00
|
|
|
|
(main) ;; — Knock-knock
|
|
|
|
|
;; — Who’s there?
|
|
|
|
|
;; — Yo momma!
|
|
|
|
|
;; — “Yo momma” who?
|
2023-06-17 22:47:30 -05:00
|
|
|
|
;; — Yo momma’s a sweet lady, and I’d like to take her out for some tea!
|