summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scenes/game.scm19
1 files changed, 11 insertions, 8 deletions
diff --git a/scenes/game.scm b/scenes/game.scm
index ad49505..f6fb5f6 100644
--- a/scenes/game.scm
+++ b/scenes/game.scm
@@ -442,10 +442,6 @@ you. I'm sure we will meet again sooner than you expect."
(unless (speaking? who)
(let ((bubble (child-ref (parent (parent player)) 'text-bubble))
(messages (accepted-messages who)))
- (for-each (lambda (node)
- (when (string-prefix? "dialog" (symbol->string (name node)))
- (detach node)))
- (children bubble))
(for-each (lambda (message i)
(match message
((message text)
@@ -464,6 +460,7 @@ you. I'm sure we will meet again sooner than you expect."
#:position (vec2 16.0 (- 40 (* 16.0 i))))))))
messages
(iota (length messages))))))
+ (clear-messages bubble)
(define-method (talk (player <player>) (who <character>) message)
(let ((bubble (child-ref (parent (parent player)) 'text-bubble)))
@@ -476,16 +473,14 @@ you. I'm sure we will meet again sooner than you expect."
(match (assoc-ref (conversations who) message)
((text next)
(set! (speaking? who) #t)
- (for-each (lambda (node)
- (when (string-prefix? "dialog" (symbol->string (name node)))
- (detach node)))
- (children bubble))
;; TODO: split text
(attach bubble (make <label>
#:name 'dialog
#:font game-font
#:text text
#:position (vec2 16.0 40)))
+ ;; Clear any shown messages.
+ (clear-messages bubble)
(set! (accepted-messages who) next))
;; This should never happen, because there should always be a
;; conversation matching a message.
@@ -496,6 +491,14 @@ you. I'm sure we will meet again sooner than you expect."
(set! (visible? (child-ref (parent (parent player)) 'text-bubble)) #f)
(set! (talking? player) #f)))
+(define (clear-messages bubble)
+ "Remove all dialog labels and markers from the text bubble."
+ (for-each (lambda (node)
+ (when (string-prefix? "dialog" (symbol->string (name node)))
+ (detach node)))
+ (children bubble)))
+
+
(define-method (draw (stats <stats>) alpha)
(let* ((pos (position stats))
(x (vec2-x pos))