Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
David O'Toole committed Dec 17, 2009
1 parent ee34cef commit d4625cc
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 19 deletions.
1 change: 1 addition & 0 deletions forest/enemy.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
(if [adjacent-to-player world row column]
(progn
(percent-of-time 80
[say self "The undead wolf bites you."]
[say self "The undead wolf bites you."]
[damage [get-player *world*] 4])
(setf <clock> 6
Expand Down
6 changes: 3 additions & 3 deletions forest/forest.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@
[set-location cell i j])))))))))

(define-method drop-ruin forest (row column height width)
;; prevent blocking exit
(setf row (min (- row (* height 2))))
(setf column (min (- column (* width 2))))
;; adjust to prevent blocking exit and blocking player at start
(setf row (max 3 (min (- row (* height 2)))))
(setf column (max 3 (min (- column (* width 2)))))
(let (rectangle openings)
(labels ((collect-point (&rest args)
(prog1 nil (push args rectangle)))
Expand Down
8 changes: 3 additions & 5 deletions forest/forest.org
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
** TODO [#A] using Map points player toward more obvious destination
** TODO [#A] place player in clearing so as to avoid trapping him
** TODO [#A] don't place monastery-gateway on mountain tile
** TODO Change river gatewayt tile!
** TODO [#A] don't spawn player on tree
** TODO [#A] stop spamming with multiple narrator messages (2x)
** TODO [#A] FIX numlock being on breaks shift keybinding
** TODO [#A] treasure on enemies (gold)
** TODO [#A] can't quit on final screen
** TODO [#B] record churchbell, flute, guitar
** TODO [#A] fix bubbles to stay onscreen, Lothaine etc
** TODO [#A] forest exits should be able to be in any column
** TODO [#A] lich incantation distance attackk?
Expand All @@ -14,6 +11,7 @@
** TODO [#A] you hear rushing water to the east, fix not being able to find exits.
** TODO [#B] alpha transparency
** TODO [#B] don't have enemies attack when you dead
** TODO [#C] add emote code to XE2 and cells
** TODO [#B] find in-game notes with same color scheme text as scroll
** TODO [#B] ghouls that pop out of the ground
** TODO [#B] magic missile (sparkly trails.)
Expand Down
39 changes: 39 additions & 0 deletions forest/forest.org_archive
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Archived entries from file /home/dto/xe2/forest/forest.org
* DONE [#A] using Map points player toward more obvious destination
CLOSED: [2009-12-17 Thu 02:11]
:PROPERTIES:
:ARCHIVE_TIME: 2009-12-17 Thu 03:36
:ARCHIVE_FILE: ~/xe2/forest/forest.org
:ARCHIVE_CATEGORY: forest
:ARCHIVE_TODO: DONE
:END:
* DONE [#A] don't place monastery-gateway on mountain tile
CLOSED: [2009-12-17 Thu 02:24]
:PROPERTIES:
:ARCHIVE_TIME: 2009-12-17 Thu 03:36
:ARCHIVE_FILE: ~/xe2/forest/forest.org
:ARCHIVE_CATEGORY: forest
:ARCHIVE_TODO: DONE
:END:
* DONE [#A] stop spamming with multiple narrator messages (2x)
CLOSED: [2009-12-17 Thu 03:36]
:PROPERTIES:
:ARCHIVE_TIME: 2009-12-17 Thu 03:37
:ARCHIVE_FILE: ~/xe2/forest/forest.org
:ARCHIVE_CATEGORY: forest
:ARCHIVE_TODO: DONE
:END:
* DONE [#A] fix can't quit on final screen
CLOSED: [2009-12-17 Thu 02:24]
:PROPERTIES:
:ARCHIVE_TIME: 2009-12-17 Thu 03:37
:ARCHIVE_FILE: ~/xe2/forest/forest.org
:ARCHIVE_CATEGORY: forest
:ARCHIVE_TODO: DONE
:END:





28 changes: 23 additions & 5 deletions forest/monastery.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@
(running :initform t)
(timeout :initform 40))

(define-method emote lothaine (text &optional (timeout 3.0))
(let ((balloon (clone =balloon= :text text :timeout timeout)))
(define-method emote lothaine (text &key (timeout 20) (background-color ".blue"))
(let ((balloon (clone =balloon= :text text :timeout timeout :background-color background-color))
(other-balloon [category-at-p *world* <row> <column> :balloon]))
(when other-balloon
[die other-balloon])
[play-sample self "talk"]
[follow balloon self]
[drop self balloon]))

(define-method run lothaine ()
Expand All @@ -60,7 +64,7 @@
(labels ((act ()
(case state
(0 (when (< [distance-to-player self] 15)
[emote self *greeting-text* 1.0]
[emote self *greeting-text* :timeout 1.0]
(incf state)
(setf timeout 20)))
(1 [emote self *beckon-text*]
Expand Down Expand Up @@ -231,6 +235,14 @@ south. You can hear the monks singing in the distance.")
(tile :initform "bed")
(categories :initform '(:obstacle)))

(define-prototype letter-prompt (:parent xe2:=prompt=)
(default-keybindings :initform '(("Q" (:control) "quit ."))))

(define-prototype letter-textbox (:parent xe2:=textbox=))

(define-method quit letter-textbox ()
(xe2:quit :shutdown))

(defcell letter
(tile :initform "letter")
(categories :initform '(:item)))
Expand All @@ -242,12 +254,18 @@ south. You can hear the monks singing in the distance.")
[take stepper :direction :here :category :item]))

(define-method use letter (user)
(let ((box (clone =textbox=)))
(let ((box (clone =letter-textbox=))
(prompt (clone =letter-prompt=)))
[resize prompt :height 20 :width 100]
[move prompt :x 0 :y 0]
[hide prompt]
[install-keybindings prompt]
[resize-to-scroll box :height 540 :width 800]
[move box :x 0 :y 0]
[set-receiver prompt box]
(let ((text (find-resource-object "letter-text")))
[set-buffer box text])
(install-widgets box)))
(install-widgets prompt box)))

(define-prototype quarters (:parent xe2:=world=)
(height :initform 9)
Expand Down
4 changes: 2 additions & 2 deletions forest/mountain.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
(percent-of-time 10 [drop-cell self (clone =wolf=) i (+ offset (random 4))])
(trace-row #'drop-mountain i (+ offset (random 4) 20) <width>)))
;; drop monastery gateway
(let ((column (+ offset (random 10)))
(let ((column (+ 1 offset (random 10)))
(row (- <height> 2)))
[drop-cell self (clone =monastery-gateway=) row column])))
[replace-cells-at self row column (clone =monastery-gateway=)])))

(define-method drop-trees passage (&optional &key (object =tree=)
distance
Expand Down
21 changes: 19 additions & 2 deletions narration.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ verbosity level.")
"List of action words to use passive voice in narrating.
http://en.wikipedia.org/wiki/Passive_voice"
:initform nil)
(repeat-count :initform 0)
(line-number :initform 0))

(define-method set-verbosity narrator (&optional (value 1))
Expand All @@ -118,8 +119,24 @@ http://en.wikipedia.org/wiki/Passive_voice"
(apply #'format nil control-string args)])

(define-method say narrator (control-string &rest args)
[println self
(apply #'format nil control-string args)])
(let* ((last-line (aref <lines> (- (fill-pointer <lines>) 1)))
(this-line (list (list (apply #'format nil control-string args)))))
(if (equal last-line this-line)
;; it's a repeat. make new line with Nx repeat
(progn (incf <repeat-count>)
(vector-pop <lines>)
(message "Repeating message ~Sx" <repeat-count>)
[println self (apply #'format nil (concatenate 'string
control-string
(format nil " (Repeated ~Sx)" <repeat-count>))
args)])
;; new
(progn
(message "New message ~S" (cons control-string args))
(setf <repeat-count> 0)
[println self (apply #'format nil control-string args)]))))



(define-method narrate-message narrator (sender action receiver args &optional force)
(unless (zerop <verbosity>)
Expand Down
5 changes: 3 additions & 2 deletions widgets.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,9 @@ line."
(setf <lines> (make-array 10 :adjustable t :fill-pointer 0)))

(define-method delete-line formatter (&optional (num-lines 1))
(dotimes (n num-lines)
(vector-pop <lines>)))
(when (>= (length <lines>) num-lines)
(dotimes (n num-lines)
(vector-pop <lines>))))

(define-method delete-all-lines formatter ()
[delete-line self (fill-pointer <lines>)])
Expand Down

0 comments on commit d4625cc

Please sign in to comment.