Add intermission state, for scene transitions
This commit is contained in:
parent
d32b484342
commit
60c438ade6
|
@ -18,23 +18,6 @@
|
|||
|
||||
(in-package :flora-search-aurora.dialogue)
|
||||
|
||||
|
||||
;;; ———————————————————————————————————
|
||||
;;; Misc. utilities
|
||||
;;; ———————————————————————————————————
|
||||
(defun pressed-enter-p ()
|
||||
"Whether or not the enter/return key has been pressed recently.
|
||||
Man, today’s a good day. Well, it wasn’t great, too be honest. Kind of bad,
|
||||
I slightly humiliated myself a tiny bit. But wow, I’m having such nice tea!
|
||||
Programming with nice tea! What a nice day this is. If you happen to be
|
||||
reading this, I hope your day is going well too!
|
||||
If not, have some tea on me: I’m paying. =w="
|
||||
(and (listen)
|
||||
(let ((input (getf (⌨:read-gamefied-char-plist) :semantic)))
|
||||
(or (eq input '⌨:🆗)
|
||||
(eq input '⌨:❎)))))
|
||||
|
||||
|
||||
|
||||
;;; ———————————————————————————————————
|
||||
;;; Dialogue-generation helpers
|
||||
|
@ -200,7 +183,7 @@ Returns the state for use with STATE-LOOP, pay attention!"
|
|||
;; Progress to the next line of dialogue as appropriate.
|
||||
(let* ((dialogue (car dialogue-list))
|
||||
(text (getf dialogue :text))
|
||||
(did-press-enter-p (pressed-enter-p))
|
||||
(did-press-enter-p (⌨:pressed-enter-p))
|
||||
(did-finish-printing-p (finished-printing-p dialogue))
|
||||
(did-finish-moving-p (progress-movement map dialogue)))
|
||||
;; Only show the cursor when rendering text!
|
||||
|
|
13
input.lisp
13
input.lisp
|
@ -145,3 +145,16 @@ corresponding item in the other list, by index."
|
|||
(let ((index (position item-a list-a :test test)))
|
||||
(if index
|
||||
(nth index list-b))))
|
||||
|
||||
|
||||
(defun pressed-enter-p ()
|
||||
"Whether or not the enter/return key has been pressed recently.
|
||||
Man, today’s a good day. Well, it wasn’t great, too be honest. Kind of bad,
|
||||
I slightly humiliated myself a tiny bit. But wow, I’m having such nice tea!
|
||||
Programming with nice tea! What a nice day this is. If you happen to be
|
||||
reading this, I hope your day is going well too!
|
||||
If not, have some tea on me: I’m paying. =w="
|
||||
(and (listen)
|
||||
(let ((input (getf (⌨:read-gamefied-char-plist) :semantic)))
|
||||
(or (eq input '⌨:🆗)
|
||||
(eq input '⌨:❎)))))
|
||||
|
|
|
@ -18,11 +18,75 @@
|
|||
|
||||
(in-package :flora-search-aurora.intermission)
|
||||
|
||||
|
||||
(defun render-clock-base (matrix coords)
|
||||
(✎:render-string-verbatim matrix *clock-base* coords))
|
||||
|
||||
;;; ———————————————————————————————————
|
||||
;;; Intermission loop logic
|
||||
;;; ———————————————————————————————————
|
||||
(defun intermission-state-update (title subtitle side-text progress return)
|
||||
"The input-taking/logic-handling component of the inventory state-function.
|
||||
Part of INVENTORY-STATE."
|
||||
(if (and (⌨:pressed-enter-p) (eq progress 72))
|
||||
return
|
||||
(list :parameters
|
||||
(list :title title
|
||||
:subtitle subtitle
|
||||
:side-text side-text
|
||||
:return return
|
||||
:progress (…:at-most 72 (+ progress .5))))))
|
||||
|
||||
|
||||
|
||||
;;; ———————————————————————————————————
|
||||
;;; Intermission loop drawing
|
||||
;;; ———————————————————————————————————
|
||||
(defun render-centered-line (matrix string &key (y 0))
|
||||
"Given a STRING and a Y-position, render it to the MATRIX centered horizontally."
|
||||
(display:render-line
|
||||
matrix
|
||||
string
|
||||
(list :y y
|
||||
:x (floor (/ (- (second (array-dimensions matrix))
|
||||
(length string))
|
||||
2)))))
|
||||
|
||||
;;(defun render-clock-face (matrix x y &optional (hour 0) (minute 5))
|
||||
;; ())
|
||||
|
||||
(defun intermission-state-draw (matrix title subtitle side-text progress)
|
||||
"The drawing component of the inventory state-function.
|
||||
Part of INVENTORY-STATE."
|
||||
(let* ((title (…:getf-lang title))
|
||||
(title-border (subseq (make-string (length title) :initial-element #\=)
|
||||
0 (…:at-most (length title) (floor progress)))))
|
||||
;; Render the title
|
||||
(render-centered-line matrix title :y 1)
|
||||
;; Render the borders surrounding the title
|
||||
(render-centered-line matrix title-border :y 0)
|
||||
(render-centered-line matrix title-border :y 2))
|
||||
;; Now the sub-title…
|
||||
(render-centered-line matrix (…:getf-lang subtitle) :y 4)
|
||||
;; And the side-text…!
|
||||
(display:render-string matrix (…:getf-lang side-text) '(:x 55 :y 10) :width 14)
|
||||
;; A little touch; a simple animation-ish line down the middle.
|
||||
(display:render-line
|
||||
matrix
|
||||
(subseq (make-string (second (array-dimensions matrix))
|
||||
:initial-element #\~)
|
||||
0 (floor progress))
|
||||
'(:x 0 :y 9)))
|
||||
|
||||
|
||||
|
||||
;;; ———————————————————————————————————
|
||||
;;; Intermission loop
|
||||
;;; ———————————————————————————————————
|
||||
(defun intermission-state (matrix &key title subtitle side-text progress return)
|
||||
"A state-function for use with STATE-LOOP."
|
||||
(sleep .02)
|
||||
(intermission-state-draw matrix title subtitle side-text progress)
|
||||
(intermission-state-update title subtitle side-text progress return))
|
||||
|
||||
|
||||
(defun make-intermission-state (title subtitle side-text return)
|
||||
"Return a state-function for intermission, for use with STATE-LOOP."
|
||||
(lambda (matrix &key (title title) (subtitle subtitle) (side-text side-text) (return return) (progress 0))
|
||||
(funcall #'intermission-state
|
||||
matrix :title title :subtitle subtitle :side-text side-text :progress progress :return return)))
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
(:export #:read-char-plist #:read-gamefied-char-plist
|
||||
#:normalize-char-plist #:gameify-char-plist
|
||||
#:plist-char-p
|
||||
#:pressed-enter-p
|
||||
:control :meta :shift
|
||||
+qwerty-layout+ +dvorak-layout+
|
||||
+arrows-game-layout+ +wasd-game-layout+ +ijkl-game-layout+
|
||||
|
@ -66,7 +67,8 @@
|
|||
(defpackage :flora-search-aurora.intermission
|
||||
(:nicknames :fsa.int :intermission :🎭)
|
||||
(:use :cl)
|
||||
(:export :*standard-font* :*small-font*))
|
||||
(:export
|
||||
:make-intermission-state))
|
||||
|
||||
(defpackage :flora-search-aurora.overworld.util
|
||||
(:nicknames :fsa.o.u :overworld.util :🌍.…)
|
||||
|
|
Ŝarĝante…
Reference in New Issue