Skip to content

Commit

Permalink
add variable *module-package-name*, enter that package after loading …
Browse files Browse the repository at this point in the history
…module
  • Loading branch information
David O'Toole committed Apr 10, 2010
1 parent 4471bb9 commit f6e1887
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 11 deletions.
2 changes: 2 additions & 0 deletions cons/cons-package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
(:export cons-game))

(in-package :cons-game)

(setf xe2:*module-package-name* :cons-game)
2 changes: 1 addition & 1 deletion cons/cons.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

(in-package :cons-game)

(setf xe2:*module-package-name* :cons-game)
(setf xe2:*dt* 20)

;;; Splash screen
Expand Down
12 changes: 11 additions & 1 deletion console.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,14 @@ found."

(defparameter *after-load-module-hook* nil)

(defvar *module-package-name* nil)

(defun module-package-name (&optional (module-name *module*))
(let ((default-name (or *module-package-name* (make-keyword module-name))))
(prog1 default-name
(unless (find-package default-name)
(error "Cannot find package ~S" default-name)))))

(defun load-module (module &key (autoload t))
"Load the module named MODULE. Load any resources marked with a
non-nil :autoload property. This operation also sets the default
Expand All @@ -1293,7 +1301,8 @@ object save directory (by setting the current `*module*'. See also
(when (probe-file object-index-file)
(message "Loading saved objects from ~S" object-index-file)
(index-pak module object-index-file)))
(run-hook '*after-load-module-hook*))
(run-hook '*after-load-module-hook*)
(setf *package* (find-package (module-package-name))))

;;; Playing music and sound effects

Expand Down Expand Up @@ -1568,6 +1577,7 @@ also the file LIBSDL-LICENSE for details.
and its .startup resource is loaded."
(format t "~A" *copyright-text*)
(initialize-resource-table)
(setf *module-package-name* nil)
(setf *initialization-hook* nil)
(setf *play-args* args)
(setf *random-state* (make-random-state t))
Expand Down
8 changes: 4 additions & 4 deletions forest/forest.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"water-3"))

(defcell water
(tile :initform "floor")
(tile :initform "water-1")
(description :initform "These waters of the wasteland are not always fit to drink.")
(categories :initform '(:actor :reflective :water :exclusive)))

Expand Down Expand Up @@ -167,7 +167,7 @@
(defparameter *snow-clock* 8)

(defcell earth
(tile :initform "floor")
(tile :initform "earth-1")
(categories :initform '(:actor :reflective))
(snow-clock :initform *snow-clock*)
(description :initform "The solid earth beneath your feet.")
Expand Down Expand Up @@ -515,8 +515,8 @@

(define-method generate forest (&key (height *forest-height*)
(width *forest-width*)
sequence-number
description
(sequence-number (genseq))
(description "Forest")
(fireflies 100)
(graveyards 15)
(ruins 15)
Expand Down
2 changes: 0 additions & 2 deletions forms.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,6 @@ DIRECTION is one of :up :down :right :left."
(setf <cursor-row> 0)
[scroll self])



;;; A var cell stores a value into a variable, and reads it.

(defparameter *var-cell-style* '(:foreground ".white" :background ".blue"))
Expand Down
1 change: 1 addition & 0 deletions xe2.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
*frequency* *output-chunksize* *output-channels* halt-sample *dt*
*physics-function* =equipment= *default-world-axis-size* generic-keybind
*default-world-z-size* =browser= install-widgets =label= =form=
*module-package-name* module-package-name
=data-cell= =var-cell= =option-cell= =toggle-cell= =event-cell=
=buffer-cell= =comment-cell= install-widget uninstall-widget
=button-cell= =image-cell= *initialization-hook* initialize-engine
Expand Down
13 changes: 11 additions & 2 deletions xiomacs/xiomacs.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,21 @@
("END" nil :move-end-of-line)
("PAGEUP" nil :move-beginning-of-column)
("PAGEDOWN" nil :move-end-of-column)
;; ("K" (:control) :clear-line)
;; ("BACKSPACE" nil :backward-delete-char)
;; ("K" (:control) :clear-line)
;; ("BACKSPACE" nil :backward-delete-char)
("UP" (:control) :apply-right)
("DOWN" (:control) :apply-left)
("LEFT" (:control) :left-pane)
("RIGHT" (:control) :right-pane)
;;
("KP8" nil :move-cursor-up)
("KP2" nil :move-cursor-down)
("KP4" nil :move-cursor-left)
("KP6" nil :move-cursor-right)
("KP8" (:control) :apply-right)
("KP2" (:control) :apply-left)
("KP4" (:control) :left-pane)
("KP6" (:control) :right-pane)
;; ("LEFTBRACKET" nil :apply-left)
;; ("RIGHTBRACKET" nil :apply-right)
("TAB" nil :switch-panes)
Expand Down
7 changes: 6 additions & 1 deletion xiomacs/xiomacs.org
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
** TODO command button runs its text to prompt
** TODO [#B] command button runs its text to prompt
** TODO [#A] pick up and put down, attach object to cursor?
** TODO [#A] move command to move objects w mouse or keyboard.
** TODO [#C] auto moving speech bubbles
** TODO search feature
** TODO generic page browser with preview
** TODO fix text box RETURN keybinding not working
** TODO [#A] *menu* sheet, autogenerated, f5 refresh revisit
** TODO [#A] mark command and mark-row mark-column fields
Expand Down

0 comments on commit f6e1887

Please sign in to comment.