diff options
| author | Richard M. Stallman | 1993-07-13 20:44:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-07-13 20:44:02 +0000 |
| commit | a399c5363f07c16f67eb4a344fac9570b3531b32 (patch) | |
| tree | 7f5869c3cddcdec3ba9e2895895069fc8f2409f5 | |
| parent | 1b6bb250a6f41bd515a45d4437b1892ca88aa203 (diff) | |
| download | emacs-a399c5363f07c16f67eb4a344fac9570b3531b32.tar.gz emacs-a399c5363f07c16f67eb4a344fac9570b3531b32.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/play/dunnet.el | 2446 |
1 files changed, 1229 insertions, 1217 deletions
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 61e879a9cb2..09dc317c9c0 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el | |||
| @@ -25,16 +25,15 @@ | |||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; This game can be run in batch mode. To do this, use: | 27 | ;; This game can be run in batch mode. To do this, use: |
| 28 | ;; emacs -batch -l dunnet.el | 28 | ;; emacs -batch -l dunnet |
| 29 | 29 | ||
| 30 | ;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 30 | ;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 31 | ;;; The log file should be set for your system, and it must | 31 | ;;; The log file should be set for your system, and it must |
| 32 | ;;; be writeable by all. | 32 | ;;; be writeable by all. |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | (setq log-file "/usr/local/dunscore") | 35 | (defvar dun-log-file "/usr/local/dunnet.score" |
| 36 | 36 | "Name of file to store score information for dunnet.") | |
| 37 | |||
| 38 | 37 | ||
| 39 | (if nil | 38 | (if nil |
| 40 | (eval-and-compile (setq byte-compile-warnings nil))) | 39 | (eval-and-compile (setq byte-compile-warnings nil))) |
| @@ -43,16 +42,16 @@ | |||
| 43 | 42 | ||
| 44 | ;;;; Mode definitions for interactive mode | 43 | ;;;; Mode definitions for interactive mode |
| 45 | 44 | ||
| 46 | (defun dungeon-mode () | 45 | (defun dun-mode () |
| 47 | "Major mode for running dungeon" | 46 | "Major mode for running dunnet." |
| 48 | (interactive) | 47 | (interactive) |
| 49 | (text-mode) | 48 | (text-mode) |
| 50 | (use-local-map dungeon-mode-map) | 49 | (use-local-map dungeon-mode-map) |
| 51 | (setq major-mode 'dungeon-mode) | 50 | (setq major-mode 'dungeon-mode) |
| 52 | (setq mode-name "Dungeon")) | 51 | (setq mode-name "Dungeon")) |
| 53 | 52 | ||
| 54 | (defun dungeon-parse (arg) | 53 | (defun dun-parse (arg) |
| 55 | "foo" | 54 | "Function called when return is pressed in interactive mode to parse line." |
| 56 | (interactive "*p") | 55 | (interactive "*p") |
| 57 | (beginning-of-line) | 56 | (beginning-of-line) |
| 58 | (setq beg (+ (point) 1)) | 57 | (setq beg (+ (point) 1)) |
| @@ -62,23 +61,23 @@ | |||
| 62 | (progn | 61 | (progn |
| 63 | (setq line (downcase (buffer-substring beg (point)))) | 62 | (setq line (downcase (buffer-substring beg (point)))) |
| 64 | (princ line) | 63 | (princ line) |
| 65 | (if (eq (parse ignore verblist line) -1) | 64 | (if (eq (dun-vparse dun-ignore dun-verblist line) -1) |
| 66 | (mprinc "I don't understand that.\n"))) | 65 | (dun-mprinc "I don't understand that.\n"))) |
| 67 | (goto-char (point-max)) | 66 | (goto-char (point-max)) |
| 68 | (mprinc "\n")) | 67 | (dun-mprinc "\n")) |
| 69 | (dungeon-messages)) | 68 | (dun-messages)) |
| 70 | 69 | ||
| 71 | (defun dungeon-messages () | 70 | (defun dun-messages () |
| 72 | (if dead | 71 | (if dun-dead |
| 73 | (text-mode) | 72 | (text-mode) |
| 74 | (if (eq dungeon-mode 'dungeon) | 73 | (if (eq dungeon-mode 'dungeon) |
| 75 | (progn | 74 | (progn |
| 76 | (if (not (= room current-room)) | 75 | (if (not (= room dun-current-room)) |
| 77 | (progn | 76 | (progn |
| 78 | (describe-room current-room) | 77 | (dun-describe-room dun-current-room) |
| 79 | (setq room current-room))) | 78 | (setq room dun-current-room))) |
| 80 | (fix-screen) | 79 | (dun-fix-screen) |
| 81 | (mprinc ">"))))) | 80 | (dun-mprinc ">"))))) |
| 82 | 81 | ||
| 83 | 82 | ||
| 84 | ;;;###autoload | 83 | ;;;###autoload |
| @@ -86,10 +85,10 @@ | |||
| 86 | "Switch to *dungeon* buffer and start game." | 85 | "Switch to *dungeon* buffer and start game." |
| 87 | (interactive) | 86 | (interactive) |
| 88 | (switch-to-buffer "*dungeon*") | 87 | (switch-to-buffer "*dungeon*") |
| 89 | (dungeon-mode) | 88 | (dun-mode) |
| 90 | (setq dead nil) | 89 | (setq dun-dead nil) |
| 91 | (setq room 0) | 90 | (setq room 0) |
| 92 | (dungeon-messages)) | 91 | (dun-messages)) |
| 93 | 92 | ||
| 94 | ;;;; | 93 | ;;;; |
| 95 | ;;;; This section contains all of the verbs and commands. | 94 | ;;;; This section contains all of the verbs and commands. |
| @@ -98,526 +97,535 @@ | |||
| 98 | ;;; Give long description of room if haven't been there yet. Otherwise | 97 | ;;; Give long description of room if haven't been there yet. Otherwise |
| 99 | ;;; short. Also give long if we were called with negative room number. | 98 | ;;; short. Also give long if we were called with negative room number. |
| 100 | 99 | ||
| 101 | (defun describe-room (room) | 100 | (defun dun-describe-room (room) |
| 102 | (if (and (not (member (abs room) light-rooms)) | 101 | (if (and (not (member (abs room) dun-light-rooms)) |
| 103 | (not (member obj-lamp inventory))) | 102 | (not (member obj-lamp dun-inventory))) |
| 104 | (mprincl "It is pitch dark. You are likely to be eaten by a grue.") | 103 | (dun-mprincl "It is pitch dark. You are likely to be eaten by a grue.") |
| 105 | (mprincl (cadr (nth (abs room) rooms))) | 104 | (dun-mprincl (cadr (nth (abs room) dun-rooms))) |
| 106 | (if (and (and (or (member room visited) | 105 | (if (and (and (or (member room dun-visited) |
| 107 | (string= mode "superb")) (> room 0)) | 106 | (string= dun-mode "dun-superb")) (> room 0)) |
| 108 | (not (string= mode "long"))) | 107 | (not (string= dun-mode "long"))) |
| 109 | nil | 108 | nil |
| 110 | (mprinc (car (nth (abs room) rooms))) | 109 | (dun-mprinc (car (nth (abs room) dun-rooms))) |
| 111 | (mprinc "\n")) | 110 | (dun-mprinc "\n")) |
| 112 | (if (not (string= mode "long")) | 111 | (if (not (string= dun-mode "long")) |
| 113 | (if (not (member (abs room) visited)) | 112 | (if (not (member (abs room) dun-visited)) |
| 114 | (setq visited (append (list (abs room)) visited)))) | 113 | (setq dun-visited (append (list (abs room)) dun-visited)))) |
| 115 | (dolist (xobjs (nth current-room room-objects)) | 114 | (dolist (xobjs (nth dun-current-room dun-room-objects)) |
| 116 | (if (= xobjs obj-special) | 115 | (if (= xobjs obj-special) |
| 117 | (special-object) | 116 | (dun-special-object) |
| 118 | (if (>= xobjs 0) | 117 | (if (>= xobjs 0) |
| 119 | (mprincl (car (nth xobjs objects))) | 118 | (dun-mprincl (car (nth xobjs dun-objects))) |
| 120 | (if (not (and (= xobjs obj-bus) inbus)) | 119 | (if (not (and (= xobjs obj-bus) dun-inbus)) |
| 121 | (progn | 120 | (progn |
| 122 | (mprincl (car (nth (abs xobjs) perm-objects))))))) | 121 | (dun-mprincl (car (nth (abs xobjs) dun-perm-objects))))))) |
| 123 | (if (and (= xobjs obj-jar) jar) | 122 | (if (and (= xobjs obj-jar) dun-jar) |
| 124 | (progn | 123 | (progn |
| 125 | (mprincl "The jar contains:") | 124 | (dun-mprincl "The jar contains:") |
| 126 | (dolist (x jar) | 125 | (dolist (x dun-jar) |
| 127 | (mprinc " ") | 126 | (dun-mprinc " ") |
| 128 | (mprincl (car (nth x objects))))))) | 127 | (dun-mprincl (car (nth x dun-objects))))))) |
| 129 | (if (and (member obj-bus (nth current-room room-objects)) inbus) | 128 | (if (and (member obj-bus (nth dun-current-room dun-room-objects)) dun-inbus) |
| 130 | (mprincl "You are on the bus.")))) | 129 | (dun-mprincl "You are on the bus.")))) |
| 131 | 130 | ||
| 132 | ;;; There is a special object in the room. This object's description, | 131 | ;;; There is a special object in the room. This object's description, |
| 133 | ;;; or lack thereof, depends on certain conditions. | 132 | ;;; or lack thereof, depends on certain conditions. |
| 134 | 133 | ||
| 135 | (defun special-object () | 134 | (defun dun-special-object () |
| 136 | (if (= current-room computer-room) | 135 | |
| 137 | (if computer | 136 | (if (= dun-current-room computer-room) |
| 138 | (mprincl | 137 | (if dun-computer |
| 138 | (dun-mprincl | ||
| 139 | "The panel lights are flashing in a seemingly organized pattern.") | 139 | "The panel lights are flashing in a seemingly organized pattern.") |
| 140 | (mprincl "The panel lights are steady and motionless."))) | 140 | (dun-mprincl "The panel lights are steady and motionless."))) |
| 141 | 141 | ||
| 142 | (if (and (= current-room red-room) | 142 | (if (and (= dun-current-room red-room) |
| 143 | (not (member obj-towel (nth red-room room-objects)))) | 143 | (not (member obj-towel (nth red-room dun-room-objects)))) |
| 144 | (mprincl "There is a hole in the floor here.")) | 144 | (dun-mprincl "There is a hole in the floor here.")) |
| 145 | 145 | ||
| 146 | (if (and (= current-room marine-life-area) black) | 146 | (if (and (= dun-current-room marine-life-area) dun-black) |
| 147 | (mprincl | 147 | (dun-mprincl |
| 148 | "The room is lit by a black light, causing the fish, and some of | 148 | "The room is lit by a black light, causing the fish, and some of |
| 149 | your objects, to give off an eerie glow.")) | 149 | your objects, to give off an eerie glow.")) |
| 150 | (if (and (= current-room fourth-vermont-intersection) hole) | 150 | (if (and (= dun-current-room fourth-vermont-intersection) dun-hole) |
| 151 | (progn | 151 | (progn |
| 152 | (mprincl"You fall into a hole in the ground.") | 152 | (dun-mprincl"You fall into a hole in the ground.") |
| 153 | (setq current-room vermont-station) | 153 | (setq dun-current-room vermont-station) |
| 154 | (describe-room vermont-station))) | 154 | (dun-describe-room vermont-station))) |
| 155 | 155 | ||
| 156 | (if (> current-room endgame-computer-room) | 156 | (if (> dun-current-room endgame-computer-room) |
| 157 | (progn | 157 | (progn |
| 158 | (if (not correct-answer) | 158 | (if (not dun-correct-answer) |
| 159 | (endgame-question) | 159 | (dun-endgame-question) |
| 160 | (mprincl "Your question is:") | 160 | (dun-mprincl "Your question is:") |
| 161 | (mprincl endgame-question)))) | 161 | (dun-mprincl dun-endgame-question)))) |
| 162 | 162 | ||
| 163 | (if (= current-room sauna) | 163 | (if (= dun-current-room sauna) |
| 164 | (progn | 164 | (progn |
| 165 | (mprincl (nth sauna-level '( | 165 | (dun-mprincl (nth dun-sauna-level '( |
| 166 | "It is normal room temperature in here." | 166 | "It is normal room temperature in here." |
| 167 | "It is luke warm in here." | 167 | "It is luke warm in here." |
| 168 | "It is comfortably hot in here." | 168 | "It is comfortably hot in here." |
| 169 | "It is refreshingly hot in here." | 169 | "It is refreshingly hot in here." |
| 170 | "You are dead now."))) | 170 | "You are dead now."))) |
| 171 | (if (and (= sauna-level 3) | 171 | (if (and (= dun-sauna-level 3) |
| 172 | (or (member obj-rms inventory) | 172 | (or (member obj-rms dun-inventory) |
| 173 | (member obj-rms (nth current-room room-objects)))) | 173 | (member obj-rms (nth dun-current-room dun-room-objects)))) |
| 174 | (progn | 174 | (progn |
| 175 | (mprincl | 175 | (dun-mprincl |
| 176 | "You notice the wax on your statuette beginning to melt, until it completely | 176 | "You notice the wax on your statuette beginning to melt, until it completely |
| 177 | melts off. You are left with a beautiful diamond!") | 177 | melts off. You are left with a beautiful diamond!") |
| 178 | (if (member obj-rms inventory) | 178 | (if (member obj-rms dun-inventory) |
| 179 | (progn | 179 | (progn |
| 180 | (remove-obj-from-inven obj-rms) | 180 | (dun-remove-obj-from-inven obj-rms) |
| 181 | (setq inventory (append inventory (list obj-diamond)))) | 181 | (setq dun-inventory (append dun-inventory |
| 182 | (remove-obj-from-room current-room obj-rms) | 182 | (list obj-diamond)))) |
| 183 | (replace room-objects current-room | 183 | (dun-remove-obj-from-room dun-current-room obj-rms) |
| 184 | (append (nth current-room room-objects) | 184 | (dun-replace dun-room-objects dun-current-room |
| 185 | (append (nth dun-current-room dun-room-objects) | ||
| 185 | (list obj-diamond)))) | 186 | (list obj-diamond)))) |
| 186 | (if (member obj-floppy inventory) | 187 | (if (member obj-floppy dun-inventory) |
| 187 | (progn | 188 | (progn |
| 188 | (mprincl | 189 | (dun-mprincl |
| 189 | "You notice your floppy disk beginning to melt. As you grab for it, the | 190 | "You notice your floppy disk beginning to melt. As you grab for it, the |
| 190 | disk bursts into flames, and disintegrates.") | 191 | disk bursts into flames, and disintegrates.") |
| 191 | (remove-obj-from-inven obj-floppy) | 192 | (dun-remove-obj-from-inven obj-floppy) |
| 192 | (remove-obj-from-room current-room obj-floppy))))))) | 193 | (dun-remove-obj-from-room dun-current-room obj-floppy))))) |
| 193 | ) | 194 | ))) |
| 194 | 195 | ||
| 195 | (defun die (murderer) | 196 | (defun dun-die (murderer) |
| 196 | (mprinc "\n") | 197 | (dun-mprinc "\n") |
| 197 | (if murderer | 198 | (if murderer |
| 198 | (mprincl "You are dead.")) | 199 | (dun-mprincl "You are dead.")) |
| 199 | (do-logfile 'die murderer) | 200 | (dun-do-logfile 'dun-die murderer) |
| 200 | (score nil) | 201 | (dun-score nil) |
| 201 | (setq dead t)) | 202 | (setq dun-dead t)) |
| 202 | 203 | ||
| 203 | (defun quit (args) | 204 | (defun dun-quit (args) |
| 204 | (die nil)) | 205 | (dun-die nil)) |
| 205 | 206 | ||
| 206 | ;;; Print every object in player's inventory. Special case for the jar, | 207 | ;;; Print every object in player's inventory. Special case for the jar, |
| 207 | ;;; as we must also print what is in it. | 208 | ;;; as we must also print what is in it. |
| 208 | 209 | ||
| 209 | (defun inven (args) | 210 | (defun dun-inven (args) |
| 210 | (mprinc "You currently have:") | 211 | (dun-mprinc "You currently have:") |
| 211 | (mprinc "\n") | 212 | (dun-mprinc "\n") |
| 212 | (dolist (curobj inventory) | 213 | (dolist (curobj dun-inventory) |
| 213 | (if curobj | 214 | (if curobj |
| 214 | (progn | 215 | (progn |
| 215 | (mprincl (cadr (nth curobj objects))) | 216 | (dun-mprincl (cadr (nth curobj dun-objects))) |
| 216 | (if (and (= curobj obj-jar) jar) | 217 | (if (and (= curobj obj-jar) dun-jar) |
| 217 | (progn | 218 | (progn |
| 218 | (mprincl "The jar contains:") | 219 | (dun-mprincl "The jar contains:") |
| 219 | (dolist (x jar) | 220 | (dolist (x dun-jar) |
| 220 | (mprinc " ") | 221 | (dun-mprinc " ") |
| 221 | (mprincl (cadr (nth x objects)))))))))) | 222 | (dun-mprincl (cadr (nth x dun-objects)))))))))) |
| 222 | 223 | ||
| 223 | (defun shake (obj) | 224 | (defun dun-shake (obj) |
| 224 | (let (objnum) | 225 | (let (objnum) |
| 225 | (when (setq objnum (objnum-from-args-std obj)) | 226 | (when (setq objnum (dun-objnum-from-args-std obj)) |
| 226 | (if (member objnum inventory) | 227 | (if (member objnum dun-inventory) |
| 227 | (progn | 228 | (progn |
| 228 | ;;; If shaking anything will do anything, put here. | 229 | ;;; If shaking anything will do anything, put here. |
| 229 | (mprinc "Shaking ") | 230 | (dun-mprinc "Shaking ") |
| 230 | (mprinc (downcase (cadr (nth objnum objects)))) | 231 | (dun-mprinc (downcase (cadr (nth objnum dun-objects)))) |
| 231 | (mprinc " seems to have no effect.") | 232 | (dun-mprinc " seems to have no effect.") |
| 232 | (mprinc "\n") | 233 | (dun-mprinc "\n") |
| 233 | ) | 234 | ) |
| 234 | (if (and (not (member objnum (nth current-room room-silents))) | 235 | (if (and (not (member objnum (nth dun-current-room dun-room-silents))) |
| 235 | (not (member objnum (nth current-room room-objects)))) | 236 | (not (member objnum (nth dun-current-room dun-room-objects)))) |
| 236 | (mprincl "I don't see that here.") | 237 | (dun-mprincl "I don't see that here.") |
| 237 | ;;; Shaking trees can be deadly | 238 | ;;; Shaking trees can be deadly |
| 238 | (if (= objnum obj-tree) | 239 | (if (= objnum obj-tree) |
| 239 | (progn | 240 | (progn |
| 240 | (mprinc | 241 | (dun-mprinc |
| 241 | "You begin to shake a tree, and notice a coconut begin to fall from the air. | 242 | "You begin to shake a tree, and notice a coconut begin to fall from the air. |
| 242 | As you try to get your hand up to block it, you feel the impact as it lands | 243 | As you try to get your hand up to block it, you feel the impact as it lands |
| 243 | on your head.") | 244 | on your head.") |
| 244 | (die "a coconut")) | 245 | (dun-die "a coconut")) |
| 245 | (if (= objnum obj-bear) | 246 | (if (= objnum obj-bear) |
| 246 | (progn | 247 | (progn |
| 247 | (mprinc | 248 | (dun-mprinc |
| 248 | "As you go up to the bear, it removes your head and places it on the ground.") | 249 | "As you go up to the bear, it removes your head and places it on the ground.") |
| 249 | (die "a bear")) | 250 | (dun-die "a bear")) |
| 250 | (if (< objnum 0) | 251 | (if (< objnum 0) |
| 251 | (mprincl "You cannot shake that.") | 252 | (dun-mprincl "You cannot shake that.") |
| 252 | (mprincl "You don't have that."))))))))) | 253 | (dun-mprincl "You don't have that."))))))))) |
| 253 | 254 | ||
| 254 | 255 | ||
| 255 | (defun drop (obj) | 256 | (defun dun-drop (obj) |
| 256 | (if inbus | 257 | (if dun-inbus |
| 257 | (mprincl "You can't drop anything while on the bus.") | 258 | (dun-mprincl "You can't drop anything while on the bus.") |
| 258 | (let (objnum ptr) | 259 | (let (objnum ptr) |
| 259 | (when (setq objnum (objnum-from-args-std obj)) | 260 | (when (setq objnum (dun-objnum-from-args-std obj)) |
| 260 | (if (not (setq ptr (member objnum inventory))) | 261 | (if (not (setq ptr (member objnum dun-inventory))) |
| 261 | (mprincl "You don't have that.") | 262 | (dun-mprincl "You don't have that.") |
| 262 | (progn | 263 | (progn |
| 263 | (remove-obj-from-inven objnum) | 264 | (dun-remove-obj-from-inven objnum) |
| 264 | (replace room-objects current-room | 265 | (dun-replace dun-room-objects dun-current-room |
| 265 | (append (nth current-room room-objects) | 266 | (append (nth dun-current-room dun-room-objects) |
| 266 | (list objnum))) | 267 | (list objnum))) |
| 267 | (mprincl "Done.") | 268 | (dun-mprincl "Done.") |
| 268 | (if (member objnum (list obj-food obj-weight obj-jar)) | 269 | (if (member objnum (list obj-food obj-weight obj-jar)) |
| 269 | (drop-check objnum)))))))) | 270 | (dun-drop-check objnum)))))))) |
| 270 | 271 | ||
| 271 | ;;; Dropping certain things causes things to happen. | 272 | ;;; Dropping certain things causes things to happen. |
| 272 | 273 | ||
| 273 | (defun drop-check (objnum) | 274 | (defun dun-drop-check (objnum) |
| 274 | (if (and (= objnum obj-food) (= room bear-hangout) | 275 | (if (and (= objnum obj-food) (= room bear-hangout) |
| 275 | (member obj-bear (nth bear-hangout room-objects))) | 276 | (member obj-bear (nth bear-hangout dun-room-objects))) |
| 276 | (progn | 277 | (progn |
| 277 | (mprincl | 278 | (dun-mprincl |
| 278 | "The bear takes the food and runs away with it. He left something behind.") | 279 | "The bear takes the food and runs away with it. He left something behind.") |
| 279 | (remove-obj-from-room current-room obj-bear) | 280 | (dun-remove-obj-from-room dun-current-room obj-bear) |
| 280 | (remove-obj-from-room current-room obj-food) | 281 | (dun-remove-obj-from-room dun-current-room obj-food) |
| 281 | (replace room-objects current-room | 282 | (dun-replace dun-room-objects dun-current-room |
| 282 | (append (nth current-room room-objects) | 283 | (append (nth dun-current-room dun-room-objects) |
| 283 | (list obj-key))))) | 284 | (list obj-key))))) |
| 284 | 285 | ||
| 285 | (if (and (= objnum obj-jar) (member obj-nitric jar) | 286 | (if (and (= objnum obj-jar) (member obj-nitric dun-jar) |
| 286 | (member obj-glycerine jar)) | 287 | (member obj-glycerine dun-jar)) |
| 287 | (progn | 288 | (progn |
| 288 | (mprincl "As the jar impacts the ground it explodes into many pieces.") | 289 | (dun-mprincl |
| 289 | (setq jar nil) | 290 | "As the jar impacts the ground it explodes into many pieces.") |
| 290 | (remove-obj-from-room current-room obj-jar) | 291 | (setq dun-jar nil) |
| 291 | (if (= current-room fourth-vermont-intersection) | 292 | (dun-remove-obj-from-room dun-current-room obj-jar) |
| 293 | (if (= dun-current-room fourth-vermont-intersection) | ||
| 292 | (progn | 294 | (progn |
| 293 | (setq hole t) | 295 | (setq dun-hole t) |
| 294 | (setq current-room vermont-station) | 296 | (setq dun-current-room vermont-station) |
| 295 | (mprincl | 297 | (dun-mprincl |
| 296 | "The explosion causes a hole to open up in the ground, which you fall | 298 | "The explosion causes a hole to open up in the ground, which you fall |
| 297 | through."))))) | 299 | through."))))) |
| 298 | 300 | ||
| 299 | (if (and (= objnum obj-weight) (= current-room maze-button-room)) | 301 | (if (and (= objnum obj-weight) (= dun-current-room maze-button-room)) |
| 300 | (mprincl "A passageway opens."))) | 302 | (dun-mprincl "A passageway opens."))) |
| 301 | 303 | ||
| 302 | ;;; Give long description of current room, or an object. | 304 | ;;; Give long description of current room, or an object. |
| 303 | 305 | ||
| 304 | (defun examine (obj) | 306 | (defun dun-examine (obj) |
| 305 | (let (objnum) | 307 | (let (objnum) |
| 306 | (setq objnum (objnum-from-args obj)) | 308 | (setq objnum (dun-objnum-from-args obj)) |
| 307 | (if (eq objnum obj-special) | 309 | (if (eq objnum obj-special) |
| 308 | (describe-room (* current-room -1)) | 310 | (dun-describe-room (* dun-current-room -1)) |
| 309 | (if (and (eq objnum obj-computer) | 311 | (if (and (eq objnum obj-computer) |
| 310 | (member obj-pc (nth current-room room-silents))) | 312 | (member obj-pc (nth dun-current-room dun-room-silents))) |
| 311 | (examine '("pc")) | 313 | (dun-examine '("pc")) |
| 312 | (if (eq objnum nil) | 314 | (if (eq objnum nil) |
| 313 | (mprincl "I don't know what that is.") | 315 | (dun-mprincl "I don't know what that is.") |
| 314 | (if (and (not (member objnum (nth current-room room-objects))) | 316 | (if (and (not (member objnum |
| 315 | (not (member objnum (nth current-room room-silents))) | 317 | (nth dun-current-room dun-room-objects))) |
| 316 | (not (member objnum inventory))) | 318 | (not (member objnum |
| 317 | (mprincl "I don't see that here.") | 319 | (nth dun-current-room dun-room-silents))) |
| 320 | (not (member objnum dun-inventory))) | ||
| 321 | (dun-mprincl "I don't see that here.") | ||
| 318 | (if (>= objnum 0) | 322 | (if (>= objnum 0) |
| 319 | (if (and (= objnum obj-bone) | 323 | (if (and (= objnum obj-bone) |
| 320 | (= current-room marine-life-area) black) | 324 | (= dun-current-room marine-life-area) dun-black) |
| 321 | (mprincl | 325 | (dun-mprincl |
| 322 | "In this light you can see some writing on the bone. It says: | 326 | "In this light you can see some writing on the bone. It says: |
| 323 | For an explosive time, go to Fourth St. and Vermont.") | 327 | For an explosive time, go to Fourth St. and Vermont.") |
| 324 | (if (nth objnum physobj-desc) | 328 | (if (nth objnum dun-physobj-desc) |
| 325 | (mprincl (nth objnum physobj-desc)) | 329 | (dun-mprincl (nth objnum dun-physobj-desc)) |
| 326 | (mprincl "I see nothing special about that."))) | 330 | (dun-mprincl "I see nothing special about that."))) |
| 327 | (if (nth (abs objnum) permobj-desc) | 331 | (if (nth (abs objnum) dun-permobj-desc) |
| 328 | (progn | 332 | (progn |
| 329 | (mprincl (nth (abs objnum) permobj-desc))) | 333 | (dun-mprincl (nth (abs objnum) dun-permobj-desc))) |
| 330 | (mprincl "I see nothing special about that."))))))))) | 334 | (dun-mprincl "I see nothing special about that."))))))))) |
| 331 | 335 | ||
| 332 | (defun take (obj) | 336 | (defun dun-take (obj) |
| 333 | (if inbus | 337 | (if dun-inbus |
| 334 | (mprincl "You can't take anything while on the bus.") | 338 | (dun-mprincl "You can't take anything while on the bus.") |
| 335 | (setq obj (firstword obj)) | 339 | (setq obj (dun-firstword obj)) |
| 336 | (if (not obj) | 340 | (if (not obj) |
| 337 | (mprincl "You must supply an object.") | 341 | (dun-mprincl "You must supply an object.") |
| 338 | (if (string= obj "all") | 342 | (if (string= obj "all") |
| 339 | (let (gotsome) | 343 | (let (gotsome) |
| 340 | (setq gotsome nil) | 344 | (setq gotsome nil) |
| 341 | (dolist (x (nth current-room room-objects)) | 345 | (dolist (x (nth dun-current-room dun-room-objects)) |
| 342 | (if (and (>= x 0) (not (= x obj-special))) | 346 | (if (and (>= x 0) (not (= x obj-special))) |
| 343 | (progn | 347 | (progn |
| 344 | (setq gotsome t) | 348 | (setq gotsome t) |
| 345 | (mprinc (cadr (nth x objects))) | 349 | (dun-mprinc (cadr (nth x dun-objects))) |
| 346 | (mprinc ": ") | 350 | (dun-mprinc ": ") |
| 347 | (take-object x)))) | 351 | (dun-take-object x)))) |
| 348 | (if (not gotsome) | 352 | (if (not gotsome) |
| 349 | (mprincl "Nothing to take."))) | 353 | (dun-mprincl "Nothing to take."))) |
| 350 | (let (objnum) | 354 | (let (objnum) |
| 351 | (setq objnum (cdr (assq (intern obj) objnames))) | 355 | (setq objnum (cdr (assq (intern obj) dun-objnames))) |
| 352 | (if (eq objnum nil) | 356 | (if (eq objnum nil) |
| 353 | (progn | 357 | (progn |
| 354 | (mprinc "I don't know what that is.") | 358 | (dun-mprinc "I don't know what that is.") |
| 355 | (mprinc "\n")) | 359 | (dun-mprinc "\n")) |
| 356 | (take-object objnum))))))) | 360 | (dun-take-object objnum))))))) |
| 357 | 361 | ||
| 358 | (defun take-object (objnum) | 362 | (defun dun-take-object (objnum) |
| 359 | (if (and (member objnum jar) (member obj-jar inventory)) | 363 | (if (and (member objnum dun-jar) (member obj-jar dun-inventory)) |
| 360 | (let (newjar) | 364 | (let (newjar) |
| 361 | (mprincl "You remove it from the jar.") | 365 | (dun-mprincl "You remove it from the jar.") |
| 362 | (setq newjar nil) | 366 | (setq newjar nil) |
| 363 | (dolist (x jar) | 367 | (dolist (x dun-jar) |
| 364 | (if (not (= x objnum)) | 368 | (if (not (= x objnum)) |
| 365 | (setq newjar (append newjar (list x))))) | 369 | (setq newjar (append newjar (list x))))) |
| 366 | (setq jar newjar) | 370 | (setq dun-jar newjar) |
| 367 | (setq inventory (append inventory (list objnum)))) | 371 | (setq dun-inventory (append dun-inventory (list objnum)))) |
| 368 | (if (not (member objnum (nth current-room room-objects))) | 372 | (if (not (member objnum (nth dun-current-room dun-room-objects))) |
| 369 | (if (not (member objnum (nth current-room room-silents))) | 373 | (if (not (member objnum (nth dun-current-room dun-room-silents))) |
| 370 | (mprinc "I do not see that here.") | 374 | (dun-mprinc "I do not see that here.") |
| 371 | (try-take objnum)) | 375 | (dun-try-take objnum)) |
| 372 | (if (>= objnum 0) | 376 | (if (>= objnum 0) |
| 373 | (progn | 377 | (progn |
| 374 | (if (and (car inventory) | 378 | (if (and (car dun-inventory) |
| 375 | (> (+ (inven-weight) (nth objnum object-lbs)) 11)) | 379 | (> (+ (dun-inven-weight) (nth objnum dun-object-lbs)) 11)) |
| 376 | (mprinc "Your load would be too heavy.") | 380 | (dun-mprinc "Your load would be too heavy.") |
| 377 | (setq inventory (append inventory (list objnum))) | 381 | (setq dun-inventory (append dun-inventory (list objnum))) |
| 378 | (remove-obj-from-room current-room objnum) | 382 | (dun-remove-obj-from-room dun-current-room objnum) |
| 379 | (mprinc "Taken. ") | 383 | (dun-mprinc "Taken. ") |
| 380 | (if (and (= objnum obj-towel) (= current-room red-room)) | 384 | (if (and (= objnum obj-towel) (= dun-current-room red-room)) |
| 381 | (mprinc "Taking the towel reveals a hole in the floor.")))) | 385 | (dun-mprinc |
| 382 | (try-take objnum))) | 386 | "Taking the towel reveals a hole in the floor.")))) |
| 383 | (mprinc "\n"))) | 387 | (dun-try-take objnum))) |
| 384 | 388 | (dun-mprinc "\n"))) | |
| 385 | (defun inven-weight () | 389 | |
| 390 | (defun dun-inven-weight () | ||
| 386 | (let (total) | 391 | (let (total) |
| 387 | (setq total 0) | 392 | (setq total 0) |
| 388 | (dolist (x jar) | 393 | (dolist (x dun-jar) |
| 389 | (setq total (+ total (nth x object-lbs)))) | 394 | (setq total (+ total (nth x dun-object-lbs)))) |
| 390 | (dolist (x inventory) | 395 | (dolist (x dun-inventory) |
| 391 | (setq total (+ total (nth x object-lbs)))) total)) | 396 | (setq total (+ total (nth x dun-object-lbs)))) total)) |
| 392 | 397 | ||
| 393 | ;;; We try to take an object that is untakable. Print a message | 398 | ;;; We try to take an object that is untakable. Print a message |
| 394 | ;;; depending on what it is. | 399 | ;;; depending on what it is. |
| 395 | 400 | ||
| 396 | (defun try-take (obj) | 401 | (defun dun-try-take (obj) |
| 397 | (mprinc "You cannot take that.")) | 402 | (dun-mprinc "You cannot take that.")) |
| 398 | 403 | ||
| 399 | (defun dig (args) | 404 | (defun dun-dig (args) |
| 400 | (if inbus | 405 | (if dun-inbus |
| 401 | (mprincl "You can't dig while on the bus.") | 406 | (dun-mprincl "You can't dig while on the bus.") |
| 402 | (if (not (member 0 inventory)) | 407 | (if (not (member 0 dun-inventory)) |
| 403 | (mprincl "You have nothing with which to dig.") | 408 | (dun-mprincl "You have nothing with which to dig.") |
| 404 | (if (not (nth current-room diggables)) | 409 | (if (not (nth dun-current-room dun-diggables)) |
| 405 | (mprincl "Digging here reveals nothing.") | 410 | (dun-mprincl "Digging here reveals nothing.") |
| 406 | (mprincl "I think you found something.") | 411 | (dun-mprincl "I think you found something.") |
| 407 | (replace room-objects current-room | 412 | (dun-replace dun-room-objects dun-current-room |
| 408 | (append (nth current-room room-objects) | 413 | (append (nth dun-current-room dun-room-objects) |
| 409 | (nth current-room diggables))) | 414 | (nth dun-current-room dun-diggables))) |
| 410 | (replace diggables current-room nil))))) | 415 | (dun-replace dun-diggables dun-current-room nil))))) |
| 411 | 416 | ||
| 412 | (defun climb (obj) | 417 | (defun dun-climb (obj) |
| 413 | (let (objnum) | 418 | (let (objnum) |
| 414 | (setq objnum (objnum-from-args obj)) | 419 | (setq objnum (dun-objnum-from-args obj)) |
| 415 | (if (and (not (= objnum obj-special)) | 420 | (if (and (not (= objnum obj-special)) |
| 416 | (not (member objnum (nth current-room room-objects))) | 421 | (not (member objnum (nth dun-current-room dun-room-objects))) |
| 417 | (not (member objnum (nth current-room room-silents))) | 422 | (not (member objnum (nth dun-current-room dun-room-silents))) |
| 418 | (not (member objnum inventory))) | 423 | (not (member objnum dun-inventory))) |
| 419 | (mprincl "I don't see that here.") | 424 | (dun-mprincl "I don't see that here.") |
| 420 | (if (and (= objnum obj-special) | 425 | (if (and (= objnum obj-special) |
| 421 | (not (member obj-tree (nth current-room room-silents)))) | 426 | (not (member obj-tree (nth dun-current-room dun-room-silents)))) |
| 422 | (mprincl "There is nothing here to climb.") | 427 | (dun-mprincl "There is nothing here to climb.") |
| 423 | (if (and (not (= objnum obj-tree)) (not (= objnum obj-special))) | 428 | (if (and (not (= objnum obj-tree)) (not (= objnum obj-special))) |
| 424 | (mprincl "You can't climb that.") | 429 | (dun-mprincl "You can't climb that.") |
| 425 | (mprincl | 430 | (dun-mprincl |
| 426 | "You manage to get about two feet up the tree and fall back down. You | 431 | "You manage to get about two feet up the tree and fall back down. You |
| 427 | notice that the tree is very unsteady.")))))) | 432 | notice that the tree is very unsteady.")))))) |
| 428 | 433 | ||
| 429 | (defun eat (obj) | 434 | (defun dun-eat (obj) |
| 430 | (let (objnum) | 435 | (let (objnum) |
| 431 | (when (setq objnum (objnum-from-args-std obj)) | 436 | (when (setq objnum (dun-objnum-from-args-std obj)) |
| 432 | (if (not (member objnum inventory)) | 437 | (if (not (member objnum dun-inventory)) |
| 433 | (mprincl "You don't have that.") | 438 | (dun-mprincl "You don't have that.") |
| 434 | (if (not (= objnum obj-food)) | 439 | (if (not (= objnum obj-food)) |
| 435 | (progn | 440 | (progn |
| 436 | (mprinc "You forcefully shove ") | 441 | (dun-mprinc "You forcefully shove ") |
| 437 | (mprinc (downcase (cadr (nth objnum objects)))) | 442 | (dun-mprinc (downcase (cadr (nth objnum dun-objects)))) |
| 438 | (mprincl " down your throat, and start choking.") | 443 | (dun-mprincl " down your throat, and start choking.") |
| 439 | (die "choking")) | 444 | (dun-die "choking")) |
| 440 | (mprincl "That tasted horrible.") | 445 | (dun-mprincl "That tasted horrible.") |
| 441 | (remove-obj-from-inven obj-food)))))) | 446 | (dun-remove-obj-from-inven obj-food)))))) |
| 442 | 447 | ||
| 443 | (defun dput (args) | 448 | (defun dun-put (args) |
| 444 | (if inbus | 449 | (if dun-inbus |
| 445 | (mprincl "You can't do that while on the bus") | 450 | (dun-mprincl "You can't do that while on the bus") |
| 446 | (let (newargs objnum objnum2 obj) | 451 | (let (newargs objnum objnum2 obj) |
| 447 | (setq newargs (firstwordl args)) | 452 | (setq newargs (dun-firstwordl args)) |
| 448 | (if (not newargs) | 453 | (if (not newargs) |
| 449 | (mprincl "You must supply an object") | 454 | (dun-mprincl "You must supply an object") |
| 450 | (setq obj (intern (car newargs))) | 455 | (setq obj (intern (car newargs))) |
| 451 | (setq objnum (cdr (assq obj objnames))) | 456 | (setq objnum (cdr (assq obj dun-objnames))) |
| 452 | (if (not objnum) | 457 | (if (not objnum) |
| 453 | (mprincl "I don't know what that object is.") | 458 | (dun-mprincl "I don't know what that object is.") |
| 454 | (if (not (member objnum inventory)) | 459 | (if (not (member objnum dun-inventory)) |
| 455 | (mprincl "You don't have that.") | 460 | (dun-mprincl "You don't have that.") |
| 456 | (setq newargs (firstwordl (cdr newargs))) | 461 | (setq newargs (dun-firstwordl (cdr newargs))) |
| 457 | (setq newargs (firstwordl (cdr newargs))) | 462 | (setq newargs (dun-firstwordl (cdr newargs))) |
| 458 | (if (not newargs) | 463 | (if (not newargs) |
| 459 | (mprincl "You must supply an indirect object.") | 464 | (dun-mprincl "You must supply an indirect object.") |
| 460 | (setq objnum2 (cdr (assq (intern (car newargs)) objnames))) | 465 | (setq objnum2 (cdr (assq (intern (car newargs)) dun-objnames))) |
| 461 | (if (and (eq objnum2 obj-computer) (= current-room pc-area)) | 466 | (if (and (eq objnum2 obj-computer) (= dun-current-room pc-area)) |
| 462 | (setq objnum2 obj-pc)) | 467 | (setq objnum2 obj-pc)) |
| 463 | (if (not objnum2) | 468 | (if (not objnum2) |
| 464 | (mprincl "I don't know what that indirect object is.") | 469 | (dun-mprincl "I don't know what that indirect object is.") |
| 465 | (if (and (not (member objnum2 (nth current-room room-objects))) | 470 | (if (and (not (member objnum2 |
| 466 | (not (member objnum2 (nth current-room room-silents))) | 471 | (nth dun-current-room dun-room-objects))) |
| 467 | (not (member objnum2 inventory))) | 472 | (not (member objnum2 |
| 468 | (mprincl "That indirect object is not here.") | 473 | (nth dun-current-room dun-room-silents))) |
| 469 | (put-objs objnum objnum2)))))))))) | 474 | (not (member objnum2 dun-inventory))) |
| 470 | 475 | (dun-mprincl "That indirect object is not here.") | |
| 471 | (defun put-objs (obj1 obj2) | 476 | (dun-put-objs objnum objnum2)))))))))) |
| 472 | (if (and (= obj2 obj-drop) (not nomail)) | 477 | |
| 478 | (defun dun-put-objs (obj1 obj2) | ||
| 479 | (if (and (= obj2 obj-drop) (not dun-nomail)) | ||
| 473 | (setq obj2 obj-chute)) | 480 | (setq obj2 obj-chute)) |
| 474 | 481 | ||
| 475 | (if (= obj2 obj-disposal) (setq obj2 obj-chute)) | 482 | (if (= obj2 obj-disposal) (setq obj2 obj-chute)) |
| 476 | 483 | ||
| 477 | (if (and (= obj1 obj-cpu) (= obj2 obj-computer)) | 484 | (if (and (= obj1 obj-cpu) (= obj2 obj-computer)) |
| 478 | (progn | 485 | (progn |
| 479 | (remove-obj-from-inven obj-cpu) | 486 | (dun-remove-obj-from-inven obj-cpu) |
| 480 | (setq computer t) | 487 | (setq dun-computer t) |
| 481 | (mprincl | 488 | (dun-mprincl |
| 482 | "As you put the CPU board in the computer, it immediately springs to life. | 489 | "As you put the CPU board in the computer, it immediately springs to life. |
| 483 | The lights start flashing, and the fans seem to startup.")) | 490 | The lights start flashing, and the fans seem to startup.")) |
| 484 | (if (and (= obj1 obj-weight) (= obj2 obj-button)) | 491 | (if (and (= obj1 obj-weight) (= obj2 obj-button)) |
| 485 | (drop '("weight")) | 492 | (dun-drop '("weight")) |
| 486 | (if (= obj2 obj-jar) ;; Put something in jar | 493 | (if (= obj2 obj-jar) ;; Put something in jar |
| 487 | (if (not (member obj1 (list obj-paper obj-diamond obj-emerald | 494 | (if (not (member obj1 (list obj-paper obj-diamond obj-emerald |
| 488 | obj-license obj-coins obj-egg | 495 | obj-license obj-coins obj-egg |
| 489 | obj-nitric obj-glycerine))) | 496 | obj-nitric obj-glycerine))) |
| 490 | (mprincl "That will not fit in the jar.") | 497 | (dun-mprincl "That will not fit in the jar.") |
| 491 | (remove-obj-from-inven obj1) | 498 | (dun-remove-obj-from-inven obj1) |
| 492 | (setq jar (append jar (list obj1))) | 499 | (setq dun-jar (append dun-jar (list obj1))) |
| 493 | (mprincl "Done.")) | 500 | (dun-mprincl "Done.")) |
| 494 | (if (= obj2 obj-chute) ;; Put something in chute | 501 | (if (= obj2 obj-chute) ;; Put something in chute |
| 495 | (progn | 502 | (progn |
| 496 | (remove-obj-from-inven obj1) | 503 | (dun-remove-obj-from-inven obj1) |
| 497 | (mprincl | 504 | (dun-mprincl |
| 498 | "You hear it slide down the chute and off into the distance.") | 505 | "You hear it slide down the chute and off into the distance.") |
| 499 | (put-objs-in-treas (list obj1))) | 506 | (dun-put-objs-in-treas (list obj1))) |
| 500 | (if (= obj2 obj-box) ;; Put key in key box | 507 | (if (= obj2 obj-box) ;; Put key in key box |
| 501 | (if (= obj1 obj-key) | 508 | (if (= obj1 obj-key) |
| 502 | (progn | 509 | (progn |
| 503 | (mprincl | 510 | (dun-mprincl |
| 504 | "As you drop the key, the box begins to shake. Finally it explodes | 511 | "As you drop the key, the box begins to shake. Finally it explodes |
| 505 | with a bang. The key seems to have vanished!") | 512 | with a bang. The key seems to have vanished!") |
| 506 | (remove-obj-from-inven obj1) | 513 | (dun-remove-obj-from-inven obj1) |
| 507 | (replace room-objects computer-room (append | 514 | (dun-replace dun-room-objects computer-room (append |
| 508 | (nth computer-room | 515 | (nth computer-room |
| 509 | room-objects) | 516 | dun-room-objects) |
| 510 | (list obj1))) | 517 | (list obj1))) |
| 511 | (remove-obj-from-room current-room obj-box) | 518 | (dun-remove-obj-from-room dun-current-room obj-box) |
| 512 | (setq key-level (1+ key-level))) | 519 | (setq dun-key-level (1+ dun-key-level))) |
| 513 | (mprincl "You can't put that in the key box!")) | 520 | (dun-mprincl "You can't put that in the key box!")) |
| 514 | 521 | ||
| 515 | (if (and (= obj1 obj-floppy) (= obj2 obj-pc)) | 522 | (if (and (= obj1 obj-floppy) (= obj2 obj-pc)) |
| 516 | (progn | 523 | (progn |
| 517 | (setq floppy t) | 524 | (setq dun-floppy t) |
| 518 | (remove-obj-from-inven obj1) | 525 | (dun-remove-obj-from-inven obj1) |
| 519 | (mprincl "Done.")) | 526 | (dun-mprincl "Done.")) |
| 520 | 527 | ||
| 521 | (if (= obj2 obj-urinal) ;; Put object in urinal | 528 | (if (= obj2 obj-urinal) ;; Put object in urinal |
| 522 | (progn | 529 | (progn |
| 523 | (remove-obj-from-inven obj1) | 530 | (dun-remove-obj-from-inven obj1) |
| 524 | (replace room-objects urinal (append | 531 | (dun-replace dun-room-objects urinal (append |
| 525 | (nth urinal room-objects) | 532 | (nth urinal dun-room-objects) |
| 526 | (list obj1))) | 533 | (list obj1))) |
| 527 | (mprincl | 534 | (dun-mprincl |
| 528 | "You hear it plop down in some water below.")) | 535 | "You hear it plop down in some water below.")) |
| 529 | (if (= obj2 obj-mail) | 536 | (if (= obj2 obj-mail) |
| 530 | (mprincl "The mail chute is locked.") | 537 | (dun-mprincl "The mail chute is locked.") |
| 531 | (if (member obj1 inventory) | 538 | (if (member obj1 dun-inventory) |
| 532 | (mprincl | 539 | (dun-mprincl |
| 533 | "I don't know how to combine those objects. Perhaps you should | 540 | "I don't know how to combine those objects. Perhaps you should |
| 534 | just try dropping it.") | 541 | just try dropping it.") |
| 535 | (mprincl"You can't put that there."))))))))))) | 542 | (dun-mprincl"You can't put that there."))))))))))) |
| 536 | 543 | ||
| 537 | (defun type (args) | 544 | (defun dun-type (args) |
| 538 | (if (not (= current-room computer-room)) | 545 | (if (not (= dun-current-room computer-room)) |
| 539 | (mprincl "There is nothing here on which you could type.") | 546 | (dun-mprincl "There is nothing here on which you could type.") |
| 540 | (if (not computer) | 547 | (if (not dun-computer) |
| 541 | (mprincl | 548 | (dun-mprincl |
| 542 | "You type on the keyboard, but your characters do not even echo.") | 549 | "You type on the keyboard, but your characters do not even echo.") |
| 543 | (unix-interface)))) | 550 | (dun-unix-interface)))) |
| 544 | 551 | ||
| 545 | ;;; Various movement directions | 552 | ;;; Various movement directions |
| 546 | 553 | ||
| 547 | (defun n (args) | 554 | (defun dun-n (args) |
| 548 | (move north)) | 555 | (dun-move north)) |
| 549 | 556 | ||
| 550 | (defun s (args) | 557 | (defun dun-s (args) |
| 551 | (move south)) | 558 | (dun-move south)) |
| 552 | 559 | ||
| 553 | (defun e (args) | 560 | (defun dun-e (args) |
| 554 | (move east)) | 561 | (dun-move east)) |
| 555 | 562 | ||
| 556 | (defun w (args) | 563 | (defun dun-w (args) |
| 557 | (move west)) | 564 | (dun-move west)) |
| 558 | 565 | ||
| 559 | (defun ne (args) | 566 | (defun dun-ne (args) |
| 560 | (move northeast)) | 567 | (dun-move northeast)) |
| 561 | 568 | ||
| 562 | (defun se (args) | 569 | (defun dun-se (args) |
| 563 | (move southeast)) | 570 | (dun-move southeast)) |
| 564 | 571 | ||
| 565 | (defun nw (args) | 572 | (defun dun-nw (args) |
| 566 | (move northwest)) | 573 | (dun-move northwest)) |
| 567 | 574 | ||
| 568 | (defun sw (args) | 575 | (defun dun-sw (args) |
| 569 | (move southwest)) | 576 | (dun-move southwest)) |
| 570 | 577 | ||
| 571 | (defun up (args) | 578 | (defun dun-up (args) |
| 572 | (move up)) | 579 | (dun-move up)) |
| 573 | 580 | ||
| 574 | (defun down (args) | 581 | (defun dun-down (args) |
| 575 | (move down)) | 582 | (dun-move down)) |
| 576 | 583 | ||
| 577 | (defun in (args) | 584 | (defun dun-in (args) |
| 578 | (move in)) | 585 | (dun-move in)) |
| 579 | 586 | ||
| 580 | (defun out (args) | 587 | (defun dun-out (args) |
| 581 | (move out)) | 588 | (dun-move out)) |
| 582 | 589 | ||
| 583 | (defun go (args) | 590 | (defun dun-go (args) |
| 584 | (if (or (not (car args)) | 591 | (if (or (not (car args)) |
| 585 | (eq (doverb ignore verblist (car args) (cdr (cdr args))) -1)) | 592 | (eq (dun-doverb dun-ignore dun-verblist (car args) |
| 586 | (mprinc "I don't understand where you want me to go.\n"))) | 593 | (cdr (cdr args))) -1)) |
| 594 | (dun-mprinc "I don't understand where you want me to go.\n"))) | ||
| 587 | 595 | ||
| 588 | ;;; Uses the dungeon-map to figure out where we are going. If the | 596 | ;;; Uses the dungeon-map to figure out where we are going. If the |
| 589 | ;;; requested direction yields 255, we know something special is | 597 | ;;; requested direction yields 255, we know something special is |
| 590 | ;;; supposed to happen, or perhaps you can't go that way unless | 598 | ;;; supposed to happen, or perhaps you can't go that way unless |
| 591 | ;;; certain conditions are met. | 599 | ;;; certain conditions are met. |
| 592 | 600 | ||
| 593 | (defun move (dir) | 601 | (defun dun-move (dir) |
| 594 | (if (and (not (member current-room light-rooms)) | 602 | (if (and (not (member dun-current-room dun-light-rooms)) |
| 595 | (not (member obj-lamp inventory))) | 603 | (not (member obj-lamp dun-inventory))) |
| 596 | (progn | 604 | (progn |
| 597 | (mprinc | 605 | (dun-mprinc |
| 598 | "You trip over a grue and fall into a pit and break every bone in your | 606 | "You trip over a grue and fall into a pit and break every bone in your |
| 599 | body.") | 607 | body.") |
| 600 | (die "a grue")) | 608 | (dun-die "a grue")) |
| 601 | (let (newroom) | 609 | (let (newroom) |
| 602 | (setq newroom (nth dir (nth current-room dungeon-map))) | 610 | (setq newroom (nth dir (nth dun-current-room dungeon-map))) |
| 603 | (if (eq newroom -1) | 611 | (if (eq newroom -1) |
| 604 | (mprinc "You can't go that way.\n") | 612 | (dun-mprinc "You can't go that way.\n") |
| 605 | (if (eq newroom 255) | 613 | (if (eq newroom 255) |
| 606 | (special-move dir) | 614 | (dun-special-move dir) |
| 607 | (setq room -1) | 615 | (setq room -1) |
| 608 | (setq lastdir dir) | 616 | (setq dun-lastdir dir) |
| 609 | (if inbus | 617 | (if dun-inbus |
| 610 | (progn | 618 | (progn |
| 611 | (if (or (< newroom 58) (> newroom 83)) | 619 | (if (or (< newroom 58) (> newroom 83)) |
| 612 | (mprincl "The bus cannot go this way.") | 620 | (dun-mprincl "The bus cannot go this way.") |
| 613 | (mprincl | 621 | (dun-mprincl |
| 614 | "The bus lurches ahead and comes to a screeching halt.") | 622 | "The bus lurches ahead and comes to a screeching halt.") |
| 615 | (remove-obj-from-room current-room obj-bus) | 623 | (dun-remove-obj-from-room dun-current-room obj-bus) |
| 616 | (setq current-room newroom) | 624 | (setq dun-current-room newroom) |
| 617 | (replace room-objects newroom | 625 | (dun-replace dun-room-objects newroom |
| 618 | (append (nth newroom room-objects) | 626 | (append (nth newroom dun-room-objects) |
| 619 | (list obj-bus))))) | 627 | (list obj-bus))))) |
| 620 | (setq current-room newroom))))))) | 628 | (setq dun-current-room newroom))))))) |
| 621 | 629 | ||
| 622 | ;;; Movement in this direction causes something special to happen if the | 630 | ;;; Movement in this direction causes something special to happen if the |
| 623 | ;;; right conditions exist. It may be that you can't go this way unless | 631 | ;;; right conditions exist. It may be that you can't go this way unless |
| @@ -629,241 +637,245 @@ body.") | |||
| 629 | ;;; a problem. Be careful when adding them to consider this, and | 637 | ;;; a problem. Be careful when adding them to consider this, and |
| 630 | ;;; perhaps use else's. | 638 | ;;; perhaps use else's. |
| 631 | 639 | ||
| 632 | (defun special-move (dir) | 640 | (defun dun-special-move (dir) |
| 633 | (if (= current-room building-front) | 641 | (if (= dun-current-room building-front) |
| 634 | (if (not (member obj-key inventory)) | 642 | (if (not (member obj-key dun-inventory)) |
| 635 | (mprincl "You don't have a key that can open this door.") | 643 | (dun-mprincl "You don't have a key that can open this door.") |
| 636 | (setq current-room old-building-hallway)) | 644 | (setq dun-current-room old-building-hallway)) |
| 637 | (if (= current-room north-end-of-cave-passage) | 645 | (if (= dun-current-room north-end-of-cave-passage) |
| 638 | (let (combo) | 646 | (let (combo) |
| 639 | (mprincl | 647 | (dun-mprincl |
| 640 | "You must type a 3 digit combination code to enter this room.") | 648 | "You must type a 3 digit combination code to enter this room.") |
| 641 | (mprinc "Enter it here: ") | 649 | (dun-mprinc "Enter it here: ") |
| 642 | (setq combo (read-line)) | 650 | (setq combo (dun-read-line)) |
| 643 | (if (not batch-mode) | 651 | (if (not dun-batch-mode) |
| 644 | (mprinc "\n")) | 652 | (dun-mprinc "\n")) |
| 645 | (if (string= combo combination) | 653 | (if (string= combo dun-combination) |
| 646 | (setq current-room gamma-computing-center) | 654 | (setq dun-current-room gamma-computing-center) |
| 647 | (mprincl "Sorry, that combination is incorrect.")))) | 655 | (dun-mprincl "Sorry, that combination is incorrect.")))) |
| 648 | 656 | ||
| 649 | (if (= current-room bear-hangout) | 657 | (if (= dun-current-room bear-hangout) |
| 650 | (if (member obj-bear (nth bear-hangout room-objects)) | 658 | (if (member obj-bear (nth bear-hangout dun-room-objects)) |
| 651 | (progn | 659 | (progn |
| 652 | (mprinc | 660 | (dun-mprinc |
| 653 | "The bear is very annoyed that you would be so presumptuous as to try | 661 | "The bear is very annoyed that you would be so presumptuous as to try |
| 654 | and walk right by it. He tells you so by tearing your head off. | 662 | and walk right by it. He tells you so by tearing your head off. |
| 655 | ") | 663 | ") |
| 656 | (die "a bear")) | 664 | (dun-die "a bear")) |
| 657 | (mprincl "You can't go that way."))) | 665 | (dun-mprincl "You can't go that way."))) |
| 658 | 666 | ||
| 659 | (if (= current-room vermont-station) | 667 | (if (= dun-current-room vermont-station) |
| 660 | (progn | 668 | (progn |
| 661 | (mprincl | 669 | (dun-mprincl |
| 662 | "As you board the train it immediately leaves the station. It is a very | 670 | "As you board the train it immediately leaves the station. It is a very |
| 663 | bumpy ride. It is shaking from side to side, and up and down. You | 671 | bumpy ride. It is shaking from side to side, and up and down. You |
| 664 | sit down in one of the chairs in order to be more comfortable.") | 672 | sit down in one of the chairs in order to be more comfortable.") |
| 665 | (mprincl | 673 | (dun-mprincl |
| 666 | "\nFinally the train comes to a sudden stop, and the doors open, and some | 674 | "\nFinally the train comes to a sudden stop, and the doors open, and some |
| 667 | force throws you out. The train speeds away.\n") | 675 | force throws you out. The train speeds away.\n") |
| 668 | (setq current-room museum-station))) | 676 | (setq dun-current-room museum-station))) |
| 669 | 677 | ||
| 670 | (if (= current-room old-building-hallway) | 678 | (if (= dun-current-room old-building-hallway) |
| 671 | (if (and (member obj-key inventory) | 679 | (if (and (member obj-key dun-inventory) |
| 672 | (> key-level 0)) | 680 | (> dun-key-level 0)) |
| 673 | (setq current-room meadow) | 681 | (setq dun-current-room meadow) |
| 674 | (mprincl "You don't have a key that can open this door."))) | 682 | (dun-mprincl "You don't have a key that can open this door."))) |
| 675 | 683 | ||
| 676 | (if (and (= current-room maze-button-room) (= dir northwest)) | 684 | (if (and (= dun-current-room maze-button-room) (= dir northwest)) |
| 677 | (if (member obj-weight (nth maze-button-room room-objects)) | 685 | (if (member obj-weight (nth maze-button-room dun-room-objects)) |
| 678 | (setq current-room 18) | 686 | (setq dun-current-room 18) |
| 679 | (mprincl "You can't go that way."))) | 687 | (dun-mprincl "You can't go that way."))) |
| 680 | 688 | ||
| 681 | (if (and (= current-room maze-button-room) (= dir up)) | 689 | (if (and (= dun-current-room maze-button-room) (= dir up)) |
| 682 | (if (member obj-weight (nth maze-button-room room-objects)) | 690 | (if (member obj-weight (nth maze-button-room dun-room-objects)) |
| 683 | (mprincl "You can't go that way.") | 691 | (dun-mprincl "You can't go that way.") |
| 684 | (setq current-room weight-room))) | 692 | (setq dun-current-room weight-room))) |
| 685 | 693 | ||
| 686 | (if (= current-room classroom) | 694 | (if (= dun-current-room classroom) |
| 687 | (mprincl "The door is locked.")) | 695 | (dun-mprincl "The door is locked.")) |
| 688 | 696 | ||
| 689 | (if (or (= current-room lakefront-north) (= current-room lakefront-south)) | 697 | (if (or (= dun-current-room lakefront-north) |
| 690 | (swim nil)) | 698 | (= dun-current-room lakefront-south)) |
| 691 | 699 | (dun-swim nil)) | |
| 692 | (if (= current-room reception-area) | 700 | |
| 693 | (if (not (= sauna-level 3)) | 701 | (if (= dun-current-room reception-area) |
| 694 | (setq current-room health-club-front) | 702 | (if (not (= dun-sauna-level 3)) |
| 695 | (mprincl | 703 | (setq dun-current-room health-club-front) |
| 704 | (dun-mprincl | ||
| 696 | "As you exit the building, you notice some flames coming out of one of the | 705 | "As you exit the building, you notice some flames coming out of one of the |
| 697 | windows. Suddenly, the building explodes in a huge ball of fire. The flames | 706 | windows. Suddenly, the building explodes in a huge ball of fire. The flames |
| 698 | engulf you, and you burn to death.") | 707 | engulf you, and you burn to death.") |
| 699 | (die "burning"))) | 708 | (dun-die "burning"))) |
| 700 | 709 | ||
| 701 | (if (= current-room red-room) | 710 | (if (= dun-current-room red-room) |
| 702 | (if (not (member obj-towel (nth red-room room-objects))) | 711 | (if (not (member obj-towel (nth red-room dun-room-objects))) |
| 703 | (setq current-room long-n-s-hallway) | 712 | (setq dun-current-room long-n-s-hallway) |
| 704 | (mprincl "You can't go that way."))) | 713 | (dun-mprincl "You can't go that way."))) |
| 705 | 714 | ||
| 706 | (if (and (> dir down) (> current-room gamma-computing-center) | 715 | (if (and (> dir down) (> dun-current-room gamma-computing-center) |
| 707 | (< current-room museum-lobby)) | 716 | (< dun-current-room museum-lobby)) |
| 708 | (if (not (member obj-bus (nth current-room room-objects))) | 717 | (if (not (member obj-bus (nth dun-current-room dun-room-objects))) |
| 709 | (mprincl "You can't go that way.") | 718 | (dun-mprincl "You can't go that way.") |
| 710 | (if (= dir in) | 719 | (if (= dir in) |
| 711 | (if (member obj-license inventory) | 720 | (if (member obj-license dun-inventory) |
| 712 | (progn | 721 | (progn |
| 713 | (mprincl "You board the bus and get in the driver's seat.") | 722 | (dun-mprincl |
| 714 | (setq nomail t) | 723 | "You board the bus and get in the driver's seat.") |
| 715 | (setq inbus t)) | 724 | (setq dun-nomail t) |
| 716 | (mprincl "You are not licensed for this type of vehicle.")) | 725 | (setq dun-inbus t)) |
| 717 | (mprincl "You hop off the bus.") | 726 | (dun-mprincl "You are not licensed for this type of vehicle.")) |
| 718 | (setq inbus nil))) | 727 | (dun-mprincl "You hop off the bus.") |
| 719 | (if (= current-room fifth-oaktree-intersection) | 728 | (setq dun-inbus nil))) |
| 720 | (if (not inbus) | 729 | (if (= dun-current-room fifth-oaktree-intersection) |
| 730 | (if (not dun-inbus) | ||
| 721 | (progn | 731 | (progn |
| 722 | (mprincl "You fall down the cliff and land on your head.") | 732 | (dun-mprincl "You fall down the cliff and land on your head.") |
| 723 | (die "a cliff")) | 733 | (dun-die "a cliff")) |
| 724 | (mprincl | 734 | (dun-mprincl |
| 725 | "The bus flies off the cliff, and plunges to the bottom, where it explodes.") | 735 | "The bus flies off the cliff, and plunges to the bottom, where it explodes.") |
| 726 | (die "a bus accident"))) | 736 | (dun-die "a bus accident"))) |
| 727 | (if (= current-room main-maple-intersection) | 737 | (if (= dun-current-room main-maple-intersection) |
| 728 | (progn | 738 | (progn |
| 729 | (if (not inbus) | 739 | (if (not dun-inbus) |
| 730 | (mprincl "The gate will not open.") | 740 | (dun-mprincl "The gate will not open.") |
| 731 | (mprincl | 741 | (dun-mprincl |
| 732 | "As the bus approaches, the gate opens and you drive through.") | 742 | "As the bus approaches, the gate opens and you drive through.") |
| 733 | (remove-obj-from-room main-maple-intersection obj-bus) | 743 | (dun-remove-obj-from-room main-maple-intersection obj-bus) |
| 734 | (replace room-objects museum-entrance | 744 | (dun-replace dun-room-objects museum-entrance |
| 735 | (append (nth museum-entrance room-objects) | 745 | (append (nth museum-entrance dun-room-objects) |
| 736 | (list obj-bus))) | 746 | (list obj-bus))) |
| 737 | (setq current-room museum-entrance))))) | 747 | (setq dun-current-room museum-entrance))))) |
| 738 | (if (= current-room cave-entrance) | 748 | (if (= dun-current-room cave-entrance) |
| 739 | (progn | 749 | (progn |
| 740 | (mprincl | 750 | (dun-mprincl |
| 741 | "As you enter the room you hear a rumbling noise. You look back to see | 751 | "As you enter the room you hear a rumbling noise. You look back to see |
| 742 | huge rocks sliding down from the ceiling, and blocking your way out.\n") | 752 | huge rocks sliding down from the ceiling, and blocking your way out.\n") |
| 743 | (setq current-room misty-room))))) | 753 | (setq dun-current-room misty-room))))) |
| 744 | 754 | ||
| 745 | (defun long (args) | 755 | (defun dun-long (args) |
| 746 | (setq mode "long")) | 756 | (setq dun-mode "long")) |
| 747 | 757 | ||
| 748 | (defun turn (obj) | 758 | (defun dun-turn (obj) |
| 749 | (let (objnum direction) | 759 | (let (objnum direction) |
| 750 | (when (setq objnum (objnum-from-args-std obj)) | 760 | (when (setq objnum (dun-objnum-from-args-std obj)) |
| 751 | (if (not (or (member objnum (nth current-room room-objects)) | 761 | (if (not (or (member objnum (nth dun-current-room dun-room-objects)) |
| 752 | (member objnum (nth current-room room-silents)))) | 762 | (member objnum (nth dun-current-room dun-room-silents)))) |
| 753 | (mprincl "I don't see that here.") | 763 | (dun-mprincl "I don't see that here.") |
| 754 | (if (not (= objnum obj-dial)) | 764 | (if (not (= objnum obj-dial)) |
| 755 | (mprincl "You can't turn that.") | 765 | (dun-mprincl "You can't turn that.") |
| 756 | (setq direction (firstword (cdr obj))) | 766 | (setq direction (dun-firstword (cdr obj))) |
| 757 | (if (or (not direction) | 767 | (if (or (not direction) |
| 758 | (not (or (string= direction "clockwise") | 768 | (not (or (string= direction "clockwise") |
| 759 | (string= direction "counterclockwise")))) | 769 | (string= direction "counterclockwise")))) |
| 760 | (mprincl "You must indicate clockwise or counterclockwise.") | 770 | (dun-mprincl "You must indicate clockwise or counterclockwise.") |
| 761 | (if (string= direction "clockwise") | 771 | (if (string= direction "clockwise") |
| 762 | (setq sauna-level (+ sauna-level 1)) | 772 | (setq dun-sauna-level (+ dun-sauna-level 1)) |
| 763 | (setq sauna-level (- sauna-level 1))) | 773 | (setq dun-sauna-level (- dun-sauna-level 1))) |
| 764 | 774 | ||
| 765 | (if (< sauna-level 0) | 775 | (if (< dun-sauna-level 0) |
| 766 | (progn | 776 | (progn |
| 767 | (mprincl | 777 | (dun-mprincl |
| 768 | "The dial will not turn further in that direction.") | 778 | "The dial will not turn further in that direction.") |
| 769 | (setq sauna-level 0)) | 779 | (setq dun-sauna-level 0)) |
| 770 | (sauna-heat)))))))) | 780 | (dun-sauna-heat)))))))) |
| 771 | 781 | ||
| 772 | (defun sauna-heat () | 782 | (defun dun-sauna-heat () |
| 773 | (if (= sauna-level 0) | 783 | (if (= dun-sauna-level 0) |
| 774 | (mprincl "The termperature has returned to normal room termperature.")) | 784 | (dun-mprincl |
| 775 | (if (= sauna-level 1) | 785 | "The termperature has returned to normal room termperature.")) |
| 776 | (mprincl "It is now luke warm in here. You begin to sweat.")) | 786 | (if (= dun-sauna-level 1) |
| 777 | (if (= sauna-level 2) | 787 | (dun-mprincl "It is now luke warm in here. You begin to sweat.")) |
| 778 | (mprincl "It is pretty hot in here. It is still very comfortable.")) | 788 | (if (= dun-sauna-level 2) |
| 779 | (if (= sauna-level 3) | 789 | (dun-mprincl "It is pretty hot in here. It is still very comfortable.")) |
| 790 | (if (= dun-sauna-level 3) | ||
| 780 | (progn | 791 | (progn |
| 781 | (mprincl | 792 | (dun-mprincl |
| 782 | "It is now very hot. There is something very refreshing about this.") | 793 | "It is now very hot. There is something very refreshing about this.") |
| 783 | (if (or (member obj-rms inventory) | 794 | (if (or (member obj-rms dun-inventory) |
| 784 | (member obj-rms (nth current-room room-objects))) | 795 | (member obj-rms (nth dun-current-room dun-room-objects))) |
| 785 | (progn | 796 | (progn |
| 786 | (mprincl | 797 | (dun-mprincl |
| 787 | "You notice the wax on your statuette beginning to melt, until it completely | 798 | "You notice the wax on your statuette beginning to melt, until it completely |
| 788 | melts off. You are left with a beautiful diamond!") | 799 | melts off. You are left with a beautiful diamond!") |
| 789 | (if (member obj-rms inventory) | 800 | (if (member obj-rms dun-inventory) |
| 790 | (progn | 801 | (progn |
| 791 | (remove-obj-from-inven obj-rms) | 802 | (dun-remove-obj-from-inven obj-rms) |
| 792 | (setq inventory (append inventory (list obj-diamond)))) | 803 | (setq dun-inventory (append dun-inventory |
| 793 | (remove-obj-from-room current-room obj-rms) | 804 | (list obj-diamond)))) |
| 794 | (replace room-objects current-room | 805 | (dun-remove-obj-from-room dun-current-room obj-rms) |
| 795 | (append (nth current-room room-objects) | 806 | (dun-replace dun-room-objects dun-current-room |
| 807 | (append (nth dun-current-room dun-room-objects) | ||
| 796 | (list obj-diamond)))))) | 808 | (list obj-diamond)))))) |
| 797 | (if (or (member obj-floppy inventory) | 809 | (if (or (member obj-floppy dun-inventory) |
| 798 | (member obj-floppy (nth current-room room-objects))) | 810 | (member obj-floppy (nth dun-current-room dun-room-objects))) |
| 799 | (progn | 811 | (progn |
| 800 | (mprincl | 812 | (dun-mprincl |
| 801 | "You notice your floppy disk beginning to melt. As you grab for it, the | 813 | "You notice your floppy disk beginning to melt. As you grab for it, the |
| 802 | disk bursts into flames, and disintegrates.") | 814 | disk bursts into flames, and disintegrates.") |
| 803 | (if (member obj-floppy inventory) | 815 | (if (member obj-floppy dun-inventory) |
| 804 | (remove-obj-from-inven obj-floppy) | 816 | (dun-remove-obj-from-inven obj-floppy) |
| 805 | (remove-obj-from-room current-room obj-floppy)))))) | 817 | (dun-remove-obj-from-room dun-current-room obj-floppy)))))) |
| 806 | 818 | ||
| 807 | (if (= sauna-level 4) | 819 | (if (= dun-sauna-level 4) |
| 808 | (progn | 820 | (progn |
| 809 | (mprincl | 821 | (dun-mprincl |
| 810 | "As the dial clicks into place, you immediately burst into flames.") | 822 | "As the dial clicks into place, you immediately burst into flames.") |
| 811 | (die "burning")))) | 823 | (dun-die "burning")))) |
| 812 | 824 | ||
| 813 | (defun press (obj) | 825 | (defun dun-press (obj) |
| 814 | (let (objnum) | 826 | (let (objnum) |
| 815 | (when (setq objnum (objnum-from-args-std obj)) | 827 | (when (setq objnum (dun-objnum-from-args-std obj)) |
| 816 | (if (not (or (member objnum (nth current-room room-objects)) | 828 | (if (not (or (member objnum (nth dun-current-room dun-room-objects)) |
| 817 | (member objnum (nth current-room room-silents)))) | 829 | (member objnum (nth dun-current-room dun-room-silents)))) |
| 818 | (mprincl "I don't see that here.") | 830 | (dun-mprincl "I don't see that here.") |
| 819 | (if (not (member objnum (list obj-button obj-switch))) | 831 | (if (not (member objnum (list obj-button obj-switch))) |
| 820 | (progn | 832 | (progn |
| 821 | (mprinc "You can't ") | 833 | (dun-mprinc "You can't ") |
| 822 | (mprinc (car line-list)) | 834 | (dun-mprinc (car line-list)) |
| 823 | (mprincl " that.")) | 835 | (dun-mprincl " that.")) |
| 824 | (if (= objnum obj-button) | 836 | (if (= objnum obj-button) |
| 825 | (mprincl | 837 | (dun-mprincl |
| 826 | "As you press the button, you notice a passageway open up, but | 838 | "As you press the button, you notice a passageway open up, but |
| 827 | as you release it, the passageway closes.")) | 839 | as you release it, the passageway closes.")) |
| 828 | (if (= objnum obj-switch) | 840 | (if (= objnum obj-switch) |
| 829 | (if black | 841 | (if dun-black |
| 830 | (progn | 842 | (progn |
| 831 | (mprincl "The button is now in the off position.") | 843 | (dun-mprincl "The button is now in the off position.") |
| 832 | (setq black nil)) | 844 | (setq dun-black nil)) |
| 833 | (mprincl "The button is now in the on position.") | 845 | (dun-mprincl "The button is now in the on position.") |
| 834 | (setq black t)))))))) | 846 | (setq dun-black t)))))))) |
| 835 | 847 | ||
| 836 | (defun swim (args) | 848 | (defun dun-swim (args) |
| 837 | (if (not (member current-room (list lakefront-north lakefront-south))) | 849 | (if (not (member dun-current-room (list lakefront-north lakefront-south))) |
| 838 | (mprincl "I see no water!") | 850 | (dun-mprincl "I see no water!") |
| 839 | (if (not (member obj-life inventory)) | 851 | (if (not (member obj-life dun-inventory)) |
| 840 | (progn | 852 | (progn |
| 841 | (mprincl | 853 | (dun-mprincl |
| 842 | "You dive in the water, and at first notice it is quite cold. You then | 854 | "You dive in the water, and at first notice it is quite cold. You then |
| 843 | start to get used to it as you realize that you never really learned how | 855 | start to get used to it as you realize that you never really learned how |
| 844 | to swim.") | 856 | to swim.") |
| 845 | (die "drowning")) | 857 | (dun-die "drowning")) |
| 846 | (if (= current-room lakefront-north) | 858 | (if (= dun-current-room lakefront-north) |
| 847 | (setq current-room lakefront-south) | 859 | (setq dun-current-room lakefront-south) |
| 848 | (setq current-room lakefront-north))))) | 860 | (setq dun-current-room lakefront-north))))) |
| 849 | 861 | ||
| 850 | 862 | ||
| 851 | (defun score (args) | 863 | (defun dun-score (args) |
| 852 | (if (not endgame) | 864 | (if (not dun-endgame) |
| 853 | (let (total) | 865 | (let (total) |
| 854 | (setq total (reg-score)) | 866 | (setq total (dun-reg-score)) |
| 855 | (mprinc "You have scored ") | 867 | (dun-mprinc "You have scored ") |
| 856 | (mprinc total) | 868 | (dun-mprinc total) |
| 857 | (mprincl " out of a possible 90 points.") total) | 869 | (dun-mprincl " out of a possible 90 points.") total) |
| 858 | (mprinc "You have scored ") | 870 | (dun-mprinc "You have scored ") |
| 859 | (mprinc (endgame-score)) | 871 | (dun-mprinc (dun-endgame-score)) |
| 860 | (mprincl " endgame points out of a possible 110.") | 872 | (dun-mprincl " endgame points out of a possible 110.") |
| 861 | (if (= (endgame-score) 110) | 873 | (if (= (dun-endgame-score) 110) |
| 862 | (mprincl | 874 | (dun-mprincl |
| 863 | "\n\nCongratulations. You have won. The wizard password is 'moby'")))) | 875 | "\n\nCongratulations. You have won. The wizard password is 'moby'")))) |
| 864 | 876 | ||
| 865 | (defun help (args) | 877 | (defun dun-help (args) |
| 866 | (mprincl | 878 | (dun-mprincl |
| 867 | "Welcome to dunnet (2.0), by Ron Schnell (ronnie@media.mit.edu). | 879 | "Welcome to dunnet (2.0), by Ron Schnell (ronnie@media.mit.edu). |
| 868 | Here is some useful information (read carefully because there are one | 880 | Here is some useful information (read carefully because there are one |
| 869 | or more clues in here): | 881 | or more clues in here): |
| @@ -896,34 +908,35 @@ or more clues in here): | |||
| 896 | you probably won't be able to get back up the way you came, if at all. | 908 | you probably won't be able to get back up the way you came, if at all. |
| 897 | 909 | ||
| 898 | - To run this game in batch mode (no emacs window), use: | 910 | - To run this game in batch mode (no emacs window), use: |
| 899 | emacs -batch -l dunnet.el | 911 | emacs -batch -l dunnet |
| 900 | 912 | ||
| 901 | If you have questions or comments, please contact ronnie@media.mit.edu.")) | 913 | If you have questions or comments, please contact ronnie@media.mit.edu.")) |
| 902 | 914 | ||
| 903 | (defun flush (args) | 915 | (defun dun-flush (args) |
| 904 | (if (not (= current-room bathroom)) | 916 | (if (not (= dun-current-room bathroom)) |
| 905 | (mprincl "I see nothing to flush.") | 917 | (dun-mprincl "I see nothing to flush.") |
| 906 | (mprincl "Whoooosh!!") | 918 | (dun-mprincl "Whoooosh!!") |
| 907 | (put-objs-in-treas (nth urinal room-objects)) | 919 | (dun-put-objs-in-treas (nth urinal dun-room-objects)) |
| 908 | (replace room-objects urinal nil))) | 920 | (dun-replace dun-room-objects urinal nil))) |
| 909 | 921 | ||
| 910 | (defun piss (args) | 922 | (defun dun-piss (args) |
| 911 | (if (not (= current-room bathroom)) | 923 | (if (not (= dun-current-room bathroom)) |
| 912 | (mprincl "You can't do that here, don't even bother trying.") | 924 | (dun-mprincl "You can't do that here, don't even bother trying.") |
| 913 | (if (not gottago) | 925 | (if (not dun-gottago) |
| 914 | (mprincl "I'm afraid you don't have to go now.") | 926 | (dun-mprincl "I'm afraid you don't have to go now.") |
| 915 | (mprincl "That was refreshing.") | 927 | (dun-mprincl "That was refreshing.") |
| 916 | (setq gottago nil) | 928 | (setq dun-gottago nil) |
| 917 | (replace room-objects urinal (append (nth urinal room-objects) | 929 | (dun-replace dun-room-objects urinal (append |
| 918 | (list obj-URINE)))))) | 930 | (nth urinal dun-room-objects) |
| 919 | 931 | (list obj-URINE)))))) | |
| 920 | 932 | ||
| 921 | (defun dsleep (args) | 933 | |
| 922 | (if (not (= current-room bedroom)) | 934 | (defun dun-sleep (args) |
| 923 | (mprincl | 935 | (if (not (= dun-current-room bedroom)) |
| 936 | (dun-mprincl | ||
| 924 | "You try to go to sleep while standing up here, but can't seem to do it.") | 937 | "You try to go to sleep while standing up here, but can't seem to do it.") |
| 925 | (setq gottago t) | 938 | (setq dun-gottago t) |
| 926 | (mprincl | 939 | (dun-mprincl |
| 927 | "As soon as you start to doze off you begin dreaming. You see images of | 940 | "As soon as you start to doze off you begin dreaming. You see images of |
| 928 | workers digging caves, slaving in the humid heat. Then you see yourself | 941 | workers digging caves, slaving in the humid heat. Then you see yourself |
| 929 | as one of these workers. While no one is looking, you leave the group | 942 | as one of these workers. While no one is looking, you leave the group |
| @@ -932,130 +945,130 @@ shaped piece of stone in the center. You see yourself digging a hole in | |||
| 932 | the ground, then putting some kind of treasure in it, and filling the hole | 945 | the ground, then putting some kind of treasure in it, and filling the hole |
| 933 | with dirt again. After this, you immediately wake up."))) | 946 | with dirt again. After this, you immediately wake up."))) |
| 934 | 947 | ||
| 935 | (defun break (obj) | 948 | (defun dun-break (obj) |
| 936 | (let (objnum) | 949 | (let (objnum) |
| 937 | (if (not (member obj-axe inventory)) | 950 | (if (not (member obj-axe dun-inventory)) |
| 938 | (mprincl "You have nothing you can use to break things.") | 951 | (dun-mprincl "You have nothing you can use to break things.") |
| 939 | (when (setq objnum (objnum-from-args-std obj)) | 952 | (when (setq objnum (dun-objnum-from-args-std obj)) |
| 940 | (if (member objnum inventory) | 953 | (if (member objnum dun-inventory) |
| 941 | (progn | 954 | (progn |
| 942 | (mprincl | 955 | (dun-mprincl |
| 943 | "You take the object in your hands and swing the axe. Unfortunately, you miss | 956 | "You take the object in your hands and swing the axe. Unfortunately, you miss |
| 944 | the object and slice off your hand. You bleed to death.") | 957 | the object and slice off your hand. You bleed to death.") |
| 945 | (die "an axe")) | 958 | (dun-die "an axe")) |
| 946 | (if (not (or (member objnum (nth current-room room-objects)) | 959 | (if (not (or (member objnum (nth dun-current-room dun-room-objects)) |
| 947 | (member objnum (nth current-room room-silents)))) | 960 | (member objnum |
| 948 | (mprincl "I don't see that here.") | 961 | (nth dun-current-room dun-room-silents)))) |
| 962 | (dun-mprincl "I don't see that here.") | ||
| 949 | (if (= objnum obj-cable) | 963 | (if (= objnum obj-cable) |
| 950 | (progn | 964 | (progn |
| 951 | (mprincl | 965 | (dun-mprincl |
| 952 | "As you break the ethernet cable, everything starts to blur. You collapse | 966 | "As you break the ethernet cable, everything starts to blur. You collapse |
| 953 | for a moment, then straighten yourself up. | 967 | for a moment, then straighten yourself up. |
| 954 | ") | 968 | ") |
| 955 | (replace room-objects gamma-computing-center | 969 | (dun-replace dun-room-objects gamma-computing-center |
| 956 | (append (nth gamma-computing-center room-objects) | 970 | (append |
| 957 | inventory)) | 971 | (nth gamma-computing-center dun-room-objects) |
| 958 | (if (member obj-key inventory) | 972 | dun-inventory)) |
| 973 | (if (member obj-key dun-inventory) | ||
| 959 | (progn | 974 | (progn |
| 960 | (setq inventory (list obj-key)) | 975 | (setq dun-inventory (list obj-key)) |
| 961 | (remove-obj-from-room gamma-computing-center obj-key)) | 976 | (dun-remove-obj-from-room |
| 962 | (setq inventory nil)) | 977 | gamma-computing-center obj-key)) |
| 963 | (setq current-room computer-room) | 978 | (setq dun-inventory nil)) |
| 964 | (setq ethernet nil) | 979 | (setq dun-current-room computer-room) |
| 965 | (mprincl "Connection closed.") | 980 | (setq dun-ethernet nil) |
| 966 | (unix-interface)) | 981 | (dun-mprincl "Connection closed.") |
| 982 | (dun-unix-interface)) | ||
| 967 | (if (< objnum 0) | 983 | (if (< objnum 0) |
| 968 | (progn | 984 | (progn |
| 969 | (mprincl "Your axe shatters into a million pieces.") | 985 | (dun-mprincl "Your axe shatters into a million pieces.") |
| 970 | (remove-obj-from-inven obj-axe)) | 986 | (dun-remove-obj-from-inven obj-axe)) |
| 971 | (mprincl "Your axe breaks it into a million pieces.") | 987 | (dun-mprincl "Your axe breaks it into a million pieces.") |
| 972 | (remove-obj-from-room current-room objnum))))))))) | 988 | (dun-remove-obj-from-room dun-current-room objnum))))))))) |
| 973 | 989 | ||
| 974 | (defun drive (args) | 990 | (defun dun-drive (args) |
| 975 | (if (not inbus) | 991 | (if (not dun-inbus) |
| 976 | (mprincl "You cannot drive when you aren't in a vehicle.") | 992 | (dun-mprincl "You cannot drive when you aren't in a vehicle.") |
| 977 | (mprincl "To drive while you are in the bus, just give a direction."))) | 993 | (dun-mprincl "To drive while you are in the bus, just give a direction."))) |
| 978 | 994 | ||
| 979 | (defun superb (args) | 995 | (defun dun-superb (args) |
| 980 | (setq mode 'superb)) | 996 | (setq dun-mode 'dun-superb)) |
| 981 | 997 | ||
| 982 | (defun reg-score () | 998 | (defun dun-reg-score () |
| 983 | (let (total) | 999 | (let (total) |
| 984 | (setq total 0) | 1000 | (setq total 0) |
| 985 | (dolist (x (nth treasure-room room-objects)) | 1001 | (dolist (x (nth treasure-room dun-room-objects)) |
| 986 | (setq total (+ total (nth x object-pts)))) | 1002 | (setq total (+ total (nth x dun-object-pts)))) |
| 987 | (if (member obj-URINE (nth treasure-room room-objects)) | 1003 | (if (member obj-URINE (nth treasure-room dun-room-objects)) |
| 988 | (setq total 0)) total)) | 1004 | (setq total 0)) total)) |
| 989 | 1005 | ||
| 990 | (defun endgame-score () | 1006 | (defun dun-endgame-score () |
| 991 | (let (total) | 1007 | (let (total) |
| 992 | (setq total 0) | 1008 | (setq total 0) |
| 993 | (dolist (x (nth endgame-treasure-room room-objects)) | 1009 | (dolist (x (nth endgame-treasure-room dun-room-objects)) |
| 994 | (setq total (+ total (nth x object-pts)))) total)) | 1010 | (setq total (+ total (nth x dun-object-pts)))) total)) |
| 995 | 1011 | ||
| 996 | (defun answer (args) | 1012 | (defun dun-answer (args) |
| 997 | (if (not correct-answer) | 1013 | (if (not dun-correct-answer) |
| 998 | (mprincl "I don't believe anyone asked you anything.") | 1014 | (dun-mprincl "I don't believe anyone asked you anything.") |
| 999 | (setq args (car args)) | 1015 | (setq args (car args)) |
| 1000 | (if (not args) | 1016 | (if (not args) |
| 1001 | (mprincl "You must give the answer on the same line.") | 1017 | (dun-mprincl "You must give the answer on the same line.") |
| 1002 | (if (members args correct-answer) | 1018 | (if (dun-members args dun-correct-answer) |
| 1003 | (progn | 1019 | (progn |
| 1004 | (mprincl "Correct.") | 1020 | (dun-mprincl "Correct.") |
| 1005 | (if (= lastdir 0) | 1021 | (if (= dun-lastdir 0) |
| 1006 | (setq current-room (1+ current-room)) | 1022 | (setq dun-current-room (1+ dun-current-room)) |
| 1007 | (setq current-room (- current-room 1))) | 1023 | (setq dun-current-room (- dun-current-room 1))) |
| 1008 | (setq correct-answer nil)) | 1024 | (setq dun-correct-answer nil)) |
| 1009 | (mprincl "That answer is incorrect."))))) | 1025 | (dun-mprincl "That answer is incorrect."))))) |
| 1010 | 1026 | ||
| 1011 | (defun endgame-question () | 1027 | (defun dun-endgame-question () |
| 1012 | (if (not endgame-questions) | 1028 | (if (not dun-endgame-questions) |
| 1013 | (progn | 1029 | (progn |
| 1014 | (mprincl "Your question is:") | 1030 | (dun-mprincl "Your question is:") |
| 1015 | (mprincl "No more questions, just do 'answer foo'.") | 1031 | (dun-mprincl "No more questions, just do 'answer foo'.") |
| 1016 | (setq correct-answer '("foo"))) | 1032 | (setq dun-correct-answer '("foo"))) |
| 1017 | (let (which i newques) | 1033 | (let (which i newques) |
| 1018 | (setq i 0) | 1034 | (setq i 0) |
| 1019 | (setq newques nil) | 1035 | (setq newques nil) |
| 1020 | (setq which (% (abs (random)) (length endgame-questions))) | 1036 | (setq which (% (abs (random)) (length dun-endgame-questions))) |
| 1021 | (mprincl "Your question is:") | 1037 | (dun-mprincl "Your question is:") |
| 1022 | (mprincl (setq endgame-question (car (nth which endgame-questions)))) | 1038 | (dun-mprincl (setq dun-endgame-question (car |
| 1023 | (setq correct-answer (cdr (nth which endgame-questions))) | 1039 | (nth which |
| 1040 | dun-endgame-questions)))) | ||
| 1041 | (setq dun-correct-answer (cdr (nth which dun-endgame-questions))) | ||
| 1024 | (while (< i which) | 1042 | (while (< i which) |
| 1025 | (setq newques (append newques (list (nth i endgame-questions)))) | 1043 | (setq newques (append newques (list (nth i dun-endgame-questions)))) |
| 1026 | (setq i (1+ i))) | 1044 | (setq i (1+ i))) |
| 1027 | (setq i (1+ which)) | 1045 | (setq i (1+ which)) |
| 1028 | (while (< i (length endgame-questions)) | 1046 | (while (< i (length dun-endgame-questions)) |
| 1029 | (setq newques (append newques (list (nth i endgame-questions)))) | 1047 | (setq newques (append newques (list (nth i dun-endgame-questions)))) |
| 1030 | (setq i (1+ i))) | 1048 | (setq i (1+ i))) |
| 1031 | (setq endgame-questions newques)))) | 1049 | (setq dun-endgame-questions newques)))) |
| 1032 | 1050 | ||
| 1033 | (defun dun-power (args) | 1051 | (defun dun-power (args) |
| 1034 | (if (not (= current-room pc-area)) | 1052 | (if (not (= dun-current-room pc-area)) |
| 1035 | (mprincl "That operation is not applicable here.") | 1053 | (dun-mprincl "That operation is not applicable here.") |
| 1036 | (if (not floppy) | 1054 | (if (not dun-floppy) |
| 1037 | (dos-no-disk) | 1055 | (dun-dos-no-disk) |
| 1038 | (dos-interface)))) | 1056 | (dun-dos-interface)))) |
| 1039 | |||
| 1040 | (defun touka (args) | ||
| 1041 | (setq current-room computer-room) | ||
| 1042 | (setq logged-in t) | ||
| 1043 | (setq computer t)) | ||
| 1044 | 1057 | ||
| 1045 | (defun dun-feed (args) | 1058 | (defun dun-feed (args) |
| 1046 | (let (objnum) | 1059 | (let (objnum) |
| 1047 | (when (setq objnum (objnum-from-args-std args)) | 1060 | (when (setq objnum (dun-objnum-from-args-std args)) |
| 1048 | (if (and (= objnum obj-bear) | 1061 | (if (and (= objnum obj-bear) |
| 1049 | (member obj-bear (nth current-room room-objects))) | 1062 | (member obj-bear (nth dun-current-room dun-room-objects))) |
| 1050 | (progn | 1063 | (progn |
| 1051 | (if (not (member obj-food inventory)) | 1064 | (if (not (member obj-food dun-inventory)) |
| 1052 | (mprincl "You have nothing with which to feed it.") | 1065 | (dun-mprincl "You have nothing with which to feed it.") |
| 1053 | (drop '("food")))) | 1066 | (dun-drop '("food")))) |
| 1054 | (if (not (or (member objnum (nth current-room room-objects)) | 1067 | (if (not (or (member objnum (nth dun-current-room dun-room-objects)) |
| 1055 | (member objnum inventory) | 1068 | (member objnum dun-inventory) |
| 1056 | (member objnum (nth current-room room-silents)))) | 1069 | (member objnum (nth dun-current-room dun-room-silents)))) |
| 1057 | (mprincl "I don't see that here.") | 1070 | (dun-mprincl "I don't see that here.") |
| 1058 | (mprincl "You cannot feed that.")))))) | 1071 | (dun-mprincl "You cannot feed that.")))))) |
| 1059 | 1072 | ||
| 1060 | 1073 | ||
| 1061 | ;;;; | 1074 | ;;;; |
| @@ -1067,20 +1080,20 @@ for a moment, then straighten yourself up. | |||
| 1067 | ;;; Function which takes a verb and a list of other words. Calls proper | 1080 | ;;; Function which takes a verb and a list of other words. Calls proper |
| 1068 | ;;; function associated with the verb, and passes along the other words. | 1081 | ;;; function associated with the verb, and passes along the other words. |
| 1069 | 1082 | ||
| 1070 | (defun doverb (ignore verblist verb rest) | 1083 | (defun dun-doverb (dun-ignore dun-verblist verb rest) |
| 1071 | (if (not verb) | 1084 | (if (not verb) |
| 1072 | nil | 1085 | nil |
| 1073 | (if (member (intern verb) ignore) | 1086 | (if (member (intern verb) dun-ignore) |
| 1074 | (if (not (car rest)) -1 | 1087 | (if (not (car rest)) -1 |
| 1075 | (doverb ignore verblist (car rest) (cdr rest))) | 1088 | (dun-doverb dun-ignore dun-verblist (car rest) (cdr rest))) |
| 1076 | (if (not (cdr (assq (intern verb) verblist))) -1 | 1089 | (if (not (cdr (assq (intern verb) dun-verblist))) -1 |
| 1077 | (setq numcmds (1+ numcmds)) | 1090 | (setq dun-numcmds (1+ dun-numcmds)) |
| 1078 | (eval (list (cdr (assq (intern verb) verblist)) (quote rest))))))) | 1091 | (eval (list (cdr (assq (intern verb) dun-verblist)) (quote rest))))))) |
| 1079 | 1092 | ||
| 1080 | 1093 | ||
| 1081 | ;;; Function to take a string and change it into a list of lowercase words. | 1094 | ;;; Function to take a string and change it into a list of lowercase words. |
| 1082 | 1095 | ||
| 1083 | (defun listify-string (strin) | 1096 | (defun dun-listify-string (strin) |
| 1084 | (let (pos ret-list end-pos) | 1097 | (let (pos ret-list end-pos) |
| 1085 | (setq pos 0) | 1098 | (setq pos 0) |
| 1086 | (setq ret-list nil) | 1099 | (setq ret-list nil) |
| @@ -1092,7 +1105,7 @@ for a moment, then straighten yourself up. | |||
| 1092 | (substring strin pos end-pos)))))) | 1105 | (substring strin pos end-pos)))))) |
| 1093 | (setq pos (+ end-pos 1))) ret-list)) | 1106 | (setq pos (+ end-pos 1))) ret-list)) |
| 1094 | 1107 | ||
| 1095 | (defun listify-string2 (strin) | 1108 | (defun dun-listify-string2 (strin) |
| 1096 | (let (pos ret-list end-pos) | 1109 | (let (pos ret-list end-pos) |
| 1097 | (setq pos 0) | 1110 | (setq pos 0) |
| 1098 | (setq ret-list nil) | 1111 | (setq ret-list nil) |
| @@ -1104,56 +1117,56 @@ for a moment, then straighten yourself up. | |||
| 1104 | (substring strin pos end-pos)))))) | 1117 | (substring strin pos end-pos)))))) |
| 1105 | (setq pos (+ end-pos 1))) ret-list)) | 1118 | (setq pos (+ end-pos 1))) ret-list)) |
| 1106 | 1119 | ||
| 1107 | (defun replace (list n number) | 1120 | (defun dun-replace (list n number) |
| 1108 | (rplaca (nthcdr n list) number)) | 1121 | (rplaca (nthcdr n list) number)) |
| 1109 | 1122 | ||
| 1110 | 1123 | ||
| 1111 | ;;; Get the first non-ignored word from a list. | 1124 | ;;; Get the first non-ignored word from a list. |
| 1112 | 1125 | ||
| 1113 | (defun firstword (list) | 1126 | (defun dun-firstword (list) |
| 1114 | (if (not (car list)) | 1127 | (if (not (car list)) |
| 1115 | nil | 1128 | nil |
| 1116 | (while (and list (member (intern (car list)) ignore)) | 1129 | (while (and list (member (intern (car list)) dun-ignore)) |
| 1117 | (setq list (cdr list))) | 1130 | (setq list (cdr list))) |
| 1118 | (car list))) | 1131 | (car list))) |
| 1119 | 1132 | ||
| 1120 | (defun firstwordl (list) | 1133 | (defun dun-firstwordl (list) |
| 1121 | (if (not (car list)) | 1134 | (if (not (car list)) |
| 1122 | nil | 1135 | nil |
| 1123 | (while (and list (member (intern (car list)) ignore)) | 1136 | (while (and list (member (intern (car list)) dun-ignore)) |
| 1124 | (setq list (cdr list))) | 1137 | (setq list (cdr list))) |
| 1125 | list)) | 1138 | list)) |
| 1126 | 1139 | ||
| 1127 | ;;; parse a line passed in as a string Call the proper verb with the | 1140 | ;;; parse a line passed in as a string Call the proper verb with the |
| 1128 | ;;; rest of the line passed in as a list. | 1141 | ;;; rest of the line passed in as a list. |
| 1129 | 1142 | ||
| 1130 | (defun parse (ignore verblist line) | 1143 | (defun dun-vparse (dun-ignore dun-verblist line) |
| 1131 | (mprinc "\n") | 1144 | (dun-mprinc "\n") |
| 1132 | (setq line-list (listify-string (concat line " "))) | 1145 | (setq line-list (dun-listify-string (concat line " "))) |
| 1133 | (doverb ignore verblist (car line-list) (cdr line-list))) | 1146 | (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list))) |
| 1134 | 1147 | ||
| 1135 | (defun parse2 (ignore verblist line) | 1148 | (defun dun-parse2 (dun-ignore dun-verblist line) |
| 1136 | (mprinc "\n") | 1149 | (dun-mprinc "\n") |
| 1137 | (setq line-list (listify-string2 (concat line " "))) | 1150 | (setq line-list (dun-listify-string2 (concat line " "))) |
| 1138 | (doverb ignore verblist (car line-list) (cdr line-list))) | 1151 | (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list))) |
| 1139 | 1152 | ||
| 1140 | ;;; Read a line, in window mode | 1153 | ;;; Read a line, in window mode |
| 1141 | 1154 | ||
| 1142 | (defun read-line () | 1155 | (defun dun-read-line () |
| 1143 | (let (line) | 1156 | (let (line) |
| 1144 | (setq line (read-string "")) | 1157 | (setq line (read-string "")) |
| 1145 | (mprinc line) line)) | 1158 | (dun-mprinc line) line)) |
| 1146 | 1159 | ||
| 1147 | ;;; Insert something into the window buffer | 1160 | ;;; Insert something into the window buffer |
| 1148 | 1161 | ||
| 1149 | (defun minsert (string) | 1162 | (defun dun-minsert (string) |
| 1150 | (if (stringp string) | 1163 | (if (stringp string) |
| 1151 | (insert string) | 1164 | (insert string) |
| 1152 | (insert (prin1-to-string string)))) | 1165 | (insert (prin1-to-string string)))) |
| 1153 | 1166 | ||
| 1154 | ;;; Print something out, in window mode | 1167 | ;;; Print something out, in window mode |
| 1155 | 1168 | ||
| 1156 | (defun mprinc (string) | 1169 | (defun dun-mprinc (string) |
| 1157 | (if (stringp string) | 1170 | (if (stringp string) |
| 1158 | (insert string) | 1171 | (insert string) |
| 1159 | (insert (prin1-to-string string)))) | 1172 | (insert (prin1-to-string string)))) |
| @@ -1161,7 +1174,7 @@ for a moment, then straighten yourself up. | |||
| 1161 | ;;; In window mode, keep screen from jumping by keeping last line at | 1174 | ;;; In window mode, keep screen from jumping by keeping last line at |
| 1162 | ;;; the bottom of the screen. | 1175 | ;;; the bottom of the screen. |
| 1163 | 1176 | ||
| 1164 | (defun fix-screen () | 1177 | (defun dun-fix-screen () |
| 1165 | (interactive) | 1178 | (interactive) |
| 1166 | (forward-line (- 0 (- (window-height) 2 ))) | 1179 | (forward-line (- 0 (- (window-height) 2 ))) |
| 1167 | (set-window-start (selected-window) (point)) | 1180 | (set-window-start (selected-window) (point)) |
| @@ -1169,65 +1182,65 @@ for a moment, then straighten yourself up. | |||
| 1169 | 1182 | ||
| 1170 | ;;; Insert something into the buffer, followed by newline. | 1183 | ;;; Insert something into the buffer, followed by newline. |
| 1171 | 1184 | ||
| 1172 | (defun minsertl (string) | 1185 | (defun dun-minsertl (string) |
| 1173 | (minsert string) | 1186 | (dun-minsert string) |
| 1174 | (minsert "\n")) | 1187 | (dun-minsert "\n")) |
| 1175 | 1188 | ||
| 1176 | ;;; Print something, followed by a newline. | 1189 | ;;; Print something, followed by a newline. |
| 1177 | 1190 | ||
| 1178 | (defun mprincl (string) | 1191 | (defun dun-mprincl (string) |
| 1179 | (mprinc string) | 1192 | (dun-mprinc string) |
| 1180 | (mprinc "\n")) | 1193 | (dun-mprinc "\n")) |
| 1181 | 1194 | ||
| 1182 | ;;; Function which will get an object number given the list of | 1195 | ;;; Function which will get an object number given the list of |
| 1183 | ;;; words in the command, except for the verb. | 1196 | ;;; words in the command, except for the verb. |
| 1184 | 1197 | ||
| 1185 | (defun objnum-from-args (obj) | 1198 | (defun dun-objnum-from-args (obj) |
| 1186 | (let (objnum) | 1199 | (let (objnum) |
| 1187 | (setq obj (firstword obj)) | 1200 | (setq obj (dun-firstword obj)) |
| 1188 | (if (not obj) | 1201 | (if (not obj) |
| 1189 | obj-special | 1202 | obj-special |
| 1190 | (setq objnum (cdr (assq (intern obj) objnames)))))) | 1203 | (setq objnum (cdr (assq (intern obj) dun-objnames)))))) |
| 1191 | 1204 | ||
| 1192 | (defun objnum-from-args-std (obj) | 1205 | (defun dun-objnum-from-args-std (obj) |
| 1193 | (let (result) | 1206 | (let (result) |
| 1194 | (if (eq (setq result (objnum-from-args obj)) obj-special) | 1207 | (if (eq (setq result (dun-objnum-from-args obj)) obj-special) |
| 1195 | (mprincl "You must supply an object.")) | 1208 | (dun-mprincl "You must supply an object.")) |
| 1196 | (if (eq result nil) | 1209 | (if (eq result nil) |
| 1197 | (mprincl "I don't know what that is.")) | 1210 | (dun-mprincl "I don't know what that is.")) |
| 1198 | (if (eq result obj-special) | 1211 | (if (eq result obj-special) |
| 1199 | nil | 1212 | nil |
| 1200 | result))) | 1213 | result))) |
| 1201 | 1214 | ||
| 1202 | ;;; Take a short room description, and change spaces and slashes to dashes. | 1215 | ;;; Take a short room description, and change spaces and slashes to dashes. |
| 1203 | 1216 | ||
| 1204 | (defun space-to-hyphen (string) | 1217 | (defun dun-space-to-hyphen (string) |
| 1205 | (let (space) | 1218 | (let (space) |
| 1206 | (if (setq space (string-match "[ /]" string)) | 1219 | (if (setq space (string-match "[ /]" string)) |
| 1207 | (progn | 1220 | (progn |
| 1208 | (setq string (concat (substring string 0 space) "-" | 1221 | (setq string (concat (substring string 0 space) "-" |
| 1209 | (substring string (1+ space)))) | 1222 | (substring string (1+ space)))) |
| 1210 | (space-to-hyphen string)) | 1223 | (dun-space-to-hyphen string)) |
| 1211 | string))) | 1224 | string))) |
| 1212 | 1225 | ||
| 1213 | ;;; Given a unix style pathname, build a list of path components (recursive) | 1226 | ;;; Given a unix style pathname, build a list of path components (recursive) |
| 1214 | 1227 | ||
| 1215 | (defun get-path (dirstring startlist) | 1228 | (defun dun-get-path (dirstring startlist) |
| 1216 | (let (slash pos) | 1229 | (let (slash pos) |
| 1217 | (if (= (length dirstring) 0) | 1230 | (if (= (length dirstring) 0) |
| 1218 | startlist | 1231 | startlist |
| 1219 | (if (string= (substring dirstring 0 1) "/") | 1232 | (if (string= (substring dirstring 0 1) "/") |
| 1220 | (get-path (substring dirstring 1) (append startlist (list "/"))) | 1233 | (dun-get-path (substring dirstring 1) (append startlist (list "/"))) |
| 1221 | (if (not (setq slash (string-match "/" dirstring))) | 1234 | (if (not (setq slash (string-match "/" dirstring))) |
| 1222 | (append startlist (list dirstring)) | 1235 | (append startlist (list dirstring)) |
| 1223 | (get-path (substring dirstring (1+ slash)) | 1236 | (dun-get-path (substring dirstring (1+ slash)) |
| 1224 | (append startlist | 1237 | (append startlist |
| 1225 | (list (substring dirstring 0 slash))))))))) | 1238 | (list (substring dirstring 0 slash))))))))) |
| 1226 | 1239 | ||
| 1227 | 1240 | ||
| 1228 | ;;; Is a string a member of a string list? | 1241 | ;;; Is a string a member of a string list? |
| 1229 | 1242 | ||
| 1230 | (defun members (string string-list) | 1243 | (defun dun-members (string string-list) |
| 1231 | (let (found) | 1244 | (let (found) |
| 1232 | (setq found nil) | 1245 | (setq found nil) |
| 1233 | (dolist (x string-list) | 1246 | (dolist (x string-list) |
| @@ -1237,17 +1250,17 @@ for a moment, then straighten yourself up. | |||
| 1237 | ;;; Function to put objects in the treasure room. Also prints current | 1250 | ;;; Function to put objects in the treasure room. Also prints current |
| 1238 | ;;; score to let user know he has scored. | 1251 | ;;; score to let user know he has scored. |
| 1239 | 1252 | ||
| 1240 | (defun put-objs-in-treas (objlist) | 1253 | (defun dun-put-objs-in-treas (objlist) |
| 1241 | (let (oscore newscore) | 1254 | (let (oscore newscore) |
| 1242 | (setq oscore (reg-score)) | 1255 | (setq oscore (dun-reg-score)) |
| 1243 | (replace room-objects 0 (append (nth 0 room-objects) objlist)) | 1256 | (dun-replace dun-room-objects 0 (append (nth 0 dun-room-objects) objlist)) |
| 1244 | (setq newscore (reg-score)) | 1257 | (setq newscore (dun-reg-score)) |
| 1245 | (if (not (= oscore newscore)) | 1258 | (if (not (= oscore newscore)) |
| 1246 | (score nil)))) | 1259 | (dun-score nil)))) |
| 1247 | 1260 | ||
| 1248 | ;;; Load an encrypted file, and eval it. | 1261 | ;;; Load an encrypted file, and eval it. |
| 1249 | 1262 | ||
| 1250 | (defun load-d (filename) | 1263 | (defun dun-load-d (filename) |
| 1251 | (let (old-buffer result) | 1264 | (let (old-buffer result) |
| 1252 | (setq result t) | 1265 | (setq result t) |
| 1253 | (setq old-buffer (current-buffer)) | 1266 | (setq old-buffer (current-buffer)) |
| @@ -1265,59 +1278,36 @@ for a moment, then straighten yourself up. | |||
| 1265 | (switch-to-buffer old-buffer)) | 1278 | (switch-to-buffer old-buffer)) |
| 1266 | result)) | 1279 | result)) |
| 1267 | 1280 | ||
| 1268 | ;;; Rotate the globals file, and save it for later loading. | ||
| 1269 | |||
| 1270 | (defun compile-globals () | ||
| 1271 | (let | ||
| 1272 | (switch-to-buffer (get-buffer-create "*compd*")) | ||
| 1273 | (erase-buffer) | ||
| 1274 | (insert-file-contents "dun-globals.el") | ||
| 1275 | (dun-rot13) | ||
| 1276 | (goto-char (point-min)) | ||
| 1277 | (write-region 1 (point-max) "dun-globals.dat") | ||
| 1278 | (kill-buffer (current-buffer)))) | ||
| 1279 | |||
| 1280 | ;;; Functions to remove an object either from a room, or from inventory. | 1281 | ;;; Functions to remove an object either from a room, or from inventory. |
| 1281 | 1282 | ||
| 1282 | (defun remove-obj-from-room (room objnum) | 1283 | (defun dun-remove-obj-from-room (room objnum) |
| 1283 | (let (newroom) | 1284 | (let (newroom) |
| 1284 | (setq newroom nil) | 1285 | (setq newroom nil) |
| 1285 | (dolist (x (nth room room-objects)) | 1286 | (dolist (x (nth room dun-room-objects)) |
| 1286 | (if (not (= x objnum)) | 1287 | (if (not (= x objnum)) |
| 1287 | (setq newroom (append newroom (list x))))) | 1288 | (setq newroom (append newroom (list x))))) |
| 1288 | (rplaca (nthcdr room room-objects) newroom))) | 1289 | (rplaca (nthcdr room dun-room-objects) newroom))) |
| 1289 | 1290 | ||
| 1290 | (defun remove-obj-from-inven (objnum) | 1291 | (defun dun-remove-obj-from-inven (objnum) |
| 1291 | (let (new-inven) | 1292 | (let (new-inven) |
| 1292 | (setq new-inven nil) | 1293 | (setq new-inven nil) |
| 1293 | (dolist (x inventory) | 1294 | (dolist (x dun-inventory) |
| 1294 | (if (not (= x objnum)) | 1295 | (if (not (= x objnum)) |
| 1295 | (setq new-inven (append new-inven (list x))))) | 1296 | (setq new-inven (append new-inven (list x))))) |
| 1296 | (setq inventory new-inven))) | 1297 | (setq dun-inventory new-inven))) |
| 1297 | 1298 | ||
| 1298 | ;;; Find the global data file. | ||
| 1299 | |||
| 1300 | (defun get-glob-dat () | ||
| 1301 | (let (result) | ||
| 1302 | (setq result nil) | ||
| 1303 | (dolist (x load-path) | ||
| 1304 | (if (file-exists-p (concat x "/dun-globals.dat")) | ||
| 1305 | (setq result (concat x "/dun-globals.dat")))) | ||
| 1306 | result)) | ||
| 1307 | |||
| 1308 | ;;; rotate current buffer 13 characters | ||
| 1309 | 1299 | ||
| 1310 | (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper) | 1300 | (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper) |
| 1311 | (setq translate-table (make-vector 256 0)) | 1301 | (setq dun-translate-table (make-vector 256 0)) |
| 1312 | (while (< i 256) | 1302 | (while (< i 256) |
| 1313 | (aset translate-table i i) | 1303 | (aset dun-translate-table i i) |
| 1314 | (setq i (1+ i))) | 1304 | (setq i (1+ i))) |
| 1315 | (setq lower (concat lower lower)) | 1305 | (setq lower (concat lower lower)) |
| 1316 | (setq upper (upcase lower)) | 1306 | (setq upper (upcase lower)) |
| 1317 | (setq i 0) | 1307 | (setq i 0) |
| 1318 | (while (< i 26) | 1308 | (while (< i 26) |
| 1319 | (aset translate-table (+ ?a i) (aref lower (+ i 13))) | 1309 | (aset dun-translate-table (+ ?a i) (aref lower (+ i 13))) |
| 1320 | (aset translate-table (+ ?A i) (aref upper (+ i 13))) | 1310 | (aset dun-translate-table (+ ?A i) (aref upper (+ i 13))) |
| 1321 | (setq i (1+ i)))) | 1311 | (setq i (1+ i)))) |
| 1322 | 1312 | ||
| 1323 | (defun dun-rot13 () | 1313 | (defun dun-rot13 () |
| @@ -1325,7 +1315,7 @@ for a moment, then straighten yourself up. | |||
| 1325 | (setq str (buffer-substring (point-min) (point-max))) | 1315 | (setq str (buffer-substring (point-min) (point-max))) |
| 1326 | (setq len (length str)) | 1316 | (setq len (length str)) |
| 1327 | (while (< i len) | 1317 | (while (< i len) |
| 1328 | (aset str i (aref translate-table (aref str i))) | 1318 | (aset str i (aref dun-translate-table (aref str i))) |
| 1329 | (setq i (1+ i))) | 1319 | (setq i (1+ i))) |
| 1330 | (erase-buffer) | 1320 | (erase-buffer) |
| 1331 | (insert str))) | 1321 | (insert str))) |
| @@ -1337,13 +1327,13 @@ for a moment, then straighten yourself up. | |||
| 1337 | ;;;; All globals which can change must be saved from 'save-game. Add | 1327 | ;;;; All globals which can change must be saved from 'save-game. Add |
| 1338 | ;;;; all new globals to bottom of file. | 1328 | ;;;; all new globals to bottom of file. |
| 1339 | 1329 | ||
| 1340 | (setq visited '(27)) | 1330 | (setq dun-visited '(27)) |
| 1341 | (setq current-room 1) | 1331 | (setq dun-current-room 1) |
| 1342 | (setq exitf nil) | 1332 | (setq dun-exitf nil) |
| 1343 | (setq badcd nil) | 1333 | (setq dun-badcd nil) |
| 1344 | (defvar dungeon-mode-map nil) | 1334 | (defvar dungeon-mode-map nil) |
| 1345 | (setq dungeon-mode-map (make-sparse-keymap)) | 1335 | (setq dungeon-mode-map (make-sparse-keymap)) |
| 1346 | (define-key dungeon-mode-map "\r" 'dungeon-parse) | 1336 | (define-key dungeon-mode-map "\r" 'dun-parse) |
| 1347 | (defvar dungeon-batch-map (make-keymap)) | 1337 | (defvar dungeon-batch-map (make-keymap)) |
| 1348 | (if (string= (substring emacs-version 0 2) "18") | 1338 | (if (string= (substring emacs-version 0 2) "18") |
| 1349 | (let (n) | 1339 | (let (n) |
| @@ -1356,43 +1346,47 @@ for a moment, then straighten yourself up. | |||
| 1356 | (aset (car (cdr dungeon-batch-map)) n 'dungeon-nil)))) | 1346 | (aset (car (cdr dungeon-batch-map)) n 'dungeon-nil)))) |
| 1357 | (define-key dungeon-batch-map "\r" 'exit-minibuffer) | 1347 | (define-key dungeon-batch-map "\r" 'exit-minibuffer) |
| 1358 | (define-key dungeon-batch-map "\n" 'exit-minibuffer) | 1348 | (define-key dungeon-batch-map "\n" 'exit-minibuffer) |
| 1359 | (setq computer nil) | 1349 | (setq dun-computer nil) |
| 1360 | (setq floppy nil) | 1350 | (setq dun-floppy nil) |
| 1361 | (setq door1 'locked) | 1351 | (setq dun-key-level 0) |
| 1362 | (setq key-level 0) | 1352 | (setq dun-hole nil) |
| 1363 | (setq hole nil) | 1353 | (setq dun-correct-answer nil) |
| 1364 | (setq correct-answer nil) | 1354 | (setq dun-lastdir 0) |
| 1365 | (setq lastdir 0) | 1355 | (setq dun-numsaves 0) |
| 1366 | (setq numsaves 0) | 1356 | (setq dun-jar nil) |
| 1367 | (setq jar nil) | 1357 | (setq dun-dead nil) |
| 1368 | (setq numcmds 0) | 1358 | (setq room 0) |
| 1369 | (setq wizard nil) | 1359 | (setq dun-numcmds 0) |
| 1370 | (setq endgame-question nil) | 1360 | (setq dun-wizard nil) |
| 1371 | (setq logged-in nil) | 1361 | (setq dun-endgame-question nil) |
| 1362 | (setq dun-logged-in nil) | ||
| 1372 | (setq dungeon-mode 'dungeon) | 1363 | (setq dungeon-mode 'dungeon) |
| 1373 | (setq unix-verbs '((ls . ls) (ftp . ftp) (echo . echo) (exit . uexit) | 1364 | (setq dun-unix-verbs '((ls . dun-ls) (ftp . dun-ftp) (echo . dun-echo) |
| 1374 | (cd . dunnet-cd) (pwd . dunnet-pwd) (rlogin . rlogin) | 1365 | (exit . dun-uexit) (cd . dun-cd) (pwd . dun-pwd) |
| 1375 | (uncompress . uncompress) (cat . cat) (zippy . zippy))) | 1366 | (rlogin . dun-rlogin) (uncompress . dun-uncompress) |
| 1367 | (cat . dun-cat) (zippy . dun-zippy))) | ||
| 1376 | 1368 | ||
| 1377 | (setq dos-verbs '((dir . dos-dir) (type . dos-type) (exit . dos-exit) | 1369 | (setq dun-dos-verbs '((dir . dun-dos-dir) (type . dun-dos-type) |
| 1378 | (command . dos-spawn) (b: . dos-invd) (c: . dos-invd) | 1370 | (exit . dun-dos-exit) (command . dun-dos-spawn) |
| 1379 | (a: . dos-nil))) | 1371 | (b: . dun-dos-invd) (c: . dun-dos-invd) |
| 1372 | (a: . dun-dos-nil))) | ||
| 1380 | 1373 | ||
| 1381 | 1374 | ||
| 1382 | (setq batch-mode nil) | 1375 | (setq dun-batch-mode nil) |
| 1383 | 1376 | ||
| 1384 | (setq cdpath "/usr/toukmond") | 1377 | (setq dun-cdpath "/usr/toukmond") |
| 1385 | (setq cdroom -10) | 1378 | (setq dun-cdroom -10) |
| 1386 | (setq uncompressed nil) | 1379 | (setq dun-uncompressed nil) |
| 1387 | (setq ethernet t) | 1380 | (setq dun-ethernet t) |
| 1388 | (setq restricted '(room-objects dungeon-map rooms room-silents combination)) | 1381 | (setq dun-restricted |
| 1389 | (setq path "/usr/toukmond") | 1382 | '(dun-room-objects dungeon-map dun-rooms |
| 1390 | (setq ftptype 'ascii) | 1383 | dun-room-silents dun-combination)) |
| 1391 | (setq endgame nil) | 1384 | (setq dun-ftptype 'ascii) |
| 1392 | (setq gottago t) | 1385 | (setq dun-endgame nil) |
| 1393 | (setq black nil) | 1386 | (setq dun-gottago t) |
| 1387 | (setq dun-black nil) | ||
| 1394 | 1388 | ||
| 1395 | (setq rooms '( | 1389 | (setq dun-rooms '( |
| 1396 | ( | 1390 | ( |
| 1397 | "You are in the treasure room. A door leads out to the north." | 1391 | "You are in the treasure room. A door leads out to the north." |
| 1398 | "Treasure room" | 1392 | "Treasure room" |
| @@ -1901,36 +1895,44 @@ A hole leads north." | |||
| 1901 | ) | 1895 | ) |
| 1902 | )) | 1896 | )) |
| 1903 | 1897 | ||
| 1904 | (setq light-rooms '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 24 25 26 27 28 58 59 | 1898 | (setq dun-light-rooms '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 24 25 26 27 28 58 59 |
| 1905 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1899 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
| 1906 | 77 78 79 80 81 82 83)) | 1900 | 77 78 79 80 81 82 83)) |
| 1907 | 1901 | ||
| 1908 | (setq verblist '((die . die) (ne . ne) (north . n) (south . s) (east . e) | 1902 | (setq dun-verblist '((die . dun-die) (ne . dun-ne) (north . dun-n) |
| 1909 | (west . w) (u . up) (d . down) (i . inven) | 1903 | (south . dun-s) (east . dun-e) (west . dun-w) |
| 1910 | (inventory . inven) (look . examine) (n . n) (s . s) (e . e) | 1904 | (u . dun-up) (d . dun-down) (i . dun-inven) |
| 1911 | (w . w) (se . se) (nw . nw) (sw . sw) (up . up) | 1905 | (inventory . dun-inven) (look . dun-examine) (n . dun-n) |
| 1912 | (down . down) (in . in) (out . out) (go . go) (drop . drop) | 1906 | (s . dun-s) (e . dun-e) (w . dun-w) (se . dun-se) |
| 1913 | (southeast . se) (southwest . sw) (northeast . ne) | 1907 | (nw . dun-nw) (sw . dun-sw) (up . dun-up) |
| 1914 | (northwest . nw) (save . save-game) (restore . restore) | 1908 | (down . dun-down) (in . dun-in) (out . dun-out) |
| 1915 | (long . long) (dig . dig) (shake . shake) (wave . shake) | 1909 | (go . dun-go) (drop . dun-drop) (southeast . dun-se) |
| 1916 | (examine . examine) (describe . examine) (climb . climb) | 1910 | (southwest . dun-sw) (northeast . dun-ne) |
| 1917 | (eat . eat) (put . dput) (type . type) (insert . dput) | 1911 | (northwest . dun-nw) (save . dun-save-game) |
| 1918 | (score . score) (help . help) (quit . quit) (read . examine) | 1912 | (restore . dun-restore) (long . dun-long) (dig . dun-dig) |
| 1919 | (verbose . long) (urinate . piss) (piss . piss) | 1913 | (shake . dun-shake) (wave . dun-shake) |
| 1920 | (flush . flush) (sleep . dsleep) (lie . dsleep) (x . examine) | 1914 | (examine . dun-examine) (describe . dun-examine) |
| 1921 | (break . break) (drive . drive) (board . in) (enter . in) | 1915 | (climb . dun-climb) (eat . dun-eat) (put . dun-put) |
| 1922 | (turn . turn) (press . press) (push . press) (swim . swim) | 1916 | (type . dun-type) (insert . dun-put) |
| 1923 | (on . in) (off . out) (chop . break) (switch . press) | 1917 | (score . dun-score) (help . dun-help) (quit . dun-quit) |
| 1924 | (cut . break) (exit . out) (leave . out) (reset . dun-power) | 1918 | (read . dun-examine) (verbose . dun-long) |
| 1925 | (flick . press) (superb . superb) (answer . answer) | 1919 | (urinate . dun-piss) (piss . dun-piss) |
| 1926 | (throw . drop) (l . examine) (take . take) (get . take) | 1920 | (flush . dun-flush) (sleep . dun-sleep) (lie . dun-sleep) |
| 1927 | (feed . dun-feed))) | 1921 | (x . dun-examine) (break . dun-break) (drive . dun-drive) |
| 1928 | 1922 | (board . dun-in) (enter . dun-in) (turn . dun-turn) | |
| 1929 | (setq inbus nil) | 1923 | (press . dun-press) (push . dun-press) (swim . dun-swim) |
| 1930 | (setq nomail nil) | 1924 | (on . dun-in) (off . dun-out) (chop . dun-break) |
| 1931 | (setq ignore '(the to at)) | 1925 | (switch . dun-press) (cut . dun-break) (exit . dun-out) |
| 1932 | (setq mode 'moby) | 1926 | (leave . dun-out) (reset . dun-power) (flick . dun-press) |
| 1933 | (setq sauna-level 0) | 1927 | (superb . dun-superb) (answer . dun-answer) |
| 1928 | (throw . dun-drop) (l . dun-examine) (take . dun-take) | ||
| 1929 | (get . dun-take) (feed . dun-feed))) | ||
| 1930 | |||
| 1931 | (setq dun-inbus nil) | ||
| 1932 | (setq dun-nomail nil) | ||
| 1933 | (setq dun-ignore '(the to at)) | ||
| 1934 | (setq dun-mode 'moby) | ||
| 1935 | (setq dun-sauna-level 0) | ||
| 1934 | 1936 | ||
| 1935 | (defconst north 0) | 1937 | (defconst north 0) |
| 1936 | (defconst south 1) | 1938 | (defconst south 1) |
| @@ -2058,7 +2060,7 @@ A hole leads north." | |||
| 2058 | 2060 | ||
| 2059 | 2061 | ||
| 2060 | ;;; How the user references *all* objects, permanent and regular. | 2062 | ;;; How the user references *all* objects, permanent and regular. |
| 2061 | (setq objnames '( | 2063 | (setq dun-objnames '( |
| 2062 | (shovel . 0) | 2064 | (shovel . 0) |
| 2063 | (lamp . 1) | 2065 | (lamp . 1) |
| 2064 | (cpu . 2) (board . 2) (card . 2) | 2066 | (cpu . 2) (board . 2) (card . 2) |
| @@ -2119,7 +2121,7 @@ A hole leads north." | |||
| 2119 | (pc . -29) (drive . -29) | 2121 | (pc . -29) (drive . -29) |
| 2120 | )) | 2122 | )) |
| 2121 | 2123 | ||
| 2122 | (dolist (x objnames) | 2124 | (dolist (x dun-objnames) |
| 2123 | (let (name) | 2125 | (let (name) |
| 2124 | (setq name (concat "obj-" (prin1-to-string (car x)))) | 2126 | (setq name (concat "obj-" (prin1-to-string (car x)))) |
| 2125 | (eval (list 'defconst (intern name) (cdr x))))) | 2127 | (eval (list 'defconst (intern name) (cdr x))))) |
| @@ -2131,9 +2133,9 @@ A hole leads north." | |||
| 2131 | ;;; Objects that cannot be taken but might move and are | 2133 | ;;; Objects that cannot be taken but might move and are |
| 2132 | ;;; described during room description are negative. | 2134 | ;;; described during room description are negative. |
| 2133 | ;;; Stuff that is described and might change are 255, and are | 2135 | ;;; Stuff that is described and might change are 255, and are |
| 2134 | ;;; handled specially by 'describe-room. | 2136 | ;;; handled specially by 'dun-describe-room. |
| 2135 | 2137 | ||
| 2136 | (setq room-objects (list nil | 2138 | (setq dun-room-objects (list nil |
| 2137 | 2139 | ||
| 2138 | (list obj-shovel) ;; treasure-room | 2140 | (list obj-shovel) ;; treasure-room |
| 2139 | (list obj-boulder) ;; dead-end | 2141 | (list obj-boulder) ;; dead-end |
| @@ -2190,7 +2192,7 @@ nil)) | |||
| 2190 | ;;; These are objects in a room that are only described in the | 2192 | ;;; These are objects in a room that are only described in the |
| 2191 | ;;; room description. They are permanent. | 2193 | ;;; room description. They are permanent. |
| 2192 | 2194 | ||
| 2193 | (setq room-silents (list nil | 2195 | (setq dun-room-silents (list nil |
| 2194 | (list obj-tree) ;; dead-end | 2196 | (list obj-tree) ;; dead-end |
| 2195 | (list obj-tree) ;; e-w-dirt-road | 2197 | (list obj-tree) ;; e-w-dirt-road |
| 2196 | nil nil nil nil nil nil | 2198 | nil nil nil nil nil nil |
| @@ -2231,12 +2233,12 @@ nil)) | |||
| 2231 | (list obj-pc) ;; pc-area | 2233 | (list obj-pc) ;; pc-area |
| 2232 | nil nil nil nil nil nil | 2234 | nil nil nil nil nil nil |
| 2233 | )) | 2235 | )) |
| 2234 | (setq inventory '(1)) | 2236 | (setq dun-inventory '(1)) |
| 2235 | 2237 | ||
| 2236 | ;;; Descriptions of objects, as they appear in the room description, and | 2238 | ;;; Descriptions of objects, as they appear in the room description, and |
| 2237 | ;;; the inventory. | 2239 | ;;; the inventory. |
| 2238 | 2240 | ||
| 2239 | (setq objects '( | 2241 | (setq dun-objects '( |
| 2240 | ("There is a shovel here." "A shovel") ;0 | 2242 | ("There is a shovel here." "A shovel") ;0 |
| 2241 | ("There is a lamp nearby." "A lamp") ;1 | 2243 | ("There is a lamp nearby." "A lamp") ;1 |
| 2242 | ("There is a CPU card here." "A computer board") ;2 | 2244 | ("There is a CPU card here." "A computer board") ;2 |
| @@ -2271,12 +2273,14 @@ nil)) | |||
| 2271 | 2273 | ||
| 2272 | ;;; Weight of objects | 2274 | ;;; Weight of objects |
| 2273 | 2275 | ||
| 2274 | (setq object-lbs '(2 1 1 1 1 0 2 2 10 3 1 1 1 0 1 1 0 1 1 1 1 0 0 2 2 1 0 0)) | 2276 | (setq dun-object-lbs |
| 2275 | (setq object-pts '(0 0 0 0 0 0 0 10 0 0 10 10 10 0 0 10 0 10 10 0 0 0 0 10 10 10 10 0)) | 2277 | '(2 1 1 1 1 0 2 2 10 3 1 1 1 0 1 1 0 1 1 1 1 0 0 2 2 1 0 0)) |
| 2278 | (setq dun-object-pts | ||
| 2279 | '(0 0 0 0 0 0 0 10 0 0 10 10 10 0 0 10 0 10 10 0 0 0 0 10 10 10 10 0)) | ||
| 2276 | 2280 | ||
| 2277 | 2281 | ||
| 2278 | ;;; Unix representation of objects. | 2282 | ;;; Unix representation of objects. |
| 2279 | (setq objfiles '( | 2283 | (setq dun-objfiles '( |
| 2280 | "shovel.o" "lamp.o" "cpu.o" "food.o" "key.o" "paper.o" | 2284 | "shovel.o" "lamp.o" "cpu.o" "food.o" "key.o" "paper.o" |
| 2281 | "rms.o" "diamond.o" "weight.o" "preserver.o" "bracelet.o" | 2285 | "rms.o" "diamond.o" "weight.o" "preserver.o" "bracelet.o" |
| 2282 | "gold.o" "platinum.o" "towel.o" "axe.o" "silver.o" "license.o" | 2286 | "gold.o" "platinum.o" "towel.o" "axe.o" "silver.o" "license.o" |
| @@ -2285,9 +2289,9 @@ nil)) | |||
| 2285 | )) | 2289 | )) |
| 2286 | 2290 | ||
| 2287 | ;;; These are the descriptions for the negative numbered objects from | 2291 | ;;; These are the descriptions for the negative numbered objects from |
| 2288 | ;;; room-objects | 2292 | ;;; dun-room-objects |
| 2289 | 2293 | ||
| 2290 | (setq perm-objects '( | 2294 | (setq dun-perm-objects '( |
| 2291 | nil | 2295 | nil |
| 2292 | ("There is a large boulder here.") | 2296 | ("There is a large boulder here.") |
| 2293 | nil | 2297 | nil |
| @@ -2318,7 +2322,7 @@ nil)) | |||
| 2318 | ;;; These are the descriptions the user gets when regular objects are | 2322 | ;;; These are the descriptions the user gets when regular objects are |
| 2319 | ;;; examined. | 2323 | ;;; examined. |
| 2320 | 2324 | ||
| 2321 | (setq physobj-desc '( | 2325 | (setq dun-physobj-desc '( |
| 2322 | "It is a normal shovel with a price tag attached that says $19.99." | 2326 | "It is a normal shovel with a price tag attached that says $19.99." |
| 2323 | "The lamp is hand-crafted by Geppetto." | 2327 | "The lamp is hand-crafted by Geppetto." |
| 2324 | "The CPU board has a VAX chip on it. It seems to have | 2328 | "The CPU board has a VAX chip on it. It seems to have |
| @@ -2353,7 +2357,7 @@ nil | |||
| 2353 | ;;; These are the descriptions the user gets when non-regular objects | 2357 | ;;; These are the descriptions the user gets when non-regular objects |
| 2354 | ;;; are examined. | 2358 | ;;; are examined. |
| 2355 | 2359 | ||
| 2356 | (setq permobj-desc '( | 2360 | (setq dun-permobj-desc '( |
| 2357 | nil | 2361 | nil |
| 2358 | "It is just a boulder. It cannot be moved." | 2362 | "It is just a boulder. It cannot be moved." |
| 2359 | "They are palm trees with a bountiful supply of coconuts in them." | 2363 | "They are palm trees with a bountiful supply of coconuts in them." |
| @@ -2401,20 +2405,23 @@ nil | |||
| 2401 | ) | 2405 | ) |
| 2402 | ) | 2406 | ) |
| 2403 | 2407 | ||
| 2404 | (setq diggables (list nil nil nil (list obj-cpu) nil nil nil nil nil nil nil | 2408 | (setq dun-diggables |
| 2409 | (list nil nil nil (list obj-cpu) nil nil nil nil nil nil nil | ||
| 2405 | nil nil nil nil nil nil nil nil nil nil ;11-20 | 2410 | nil nil nil nil nil nil nil nil nil nil ;11-20 |
| 2406 | nil nil nil nil nil nil nil nil nil nil ;21-30 | 2411 | nil nil nil nil nil nil nil nil nil nil ;21-30 |
| 2407 | nil nil nil nil nil nil nil nil nil nil ;31-40 | 2412 | nil nil nil nil nil nil nil nil nil nil ;31-40 |
| 2408 | nil (list obj-platinum) nil nil nil nil nil nil nil nil)) | 2413 | nil (list obj-platinum) nil nil nil nil nil nil nil nil)) |
| 2409 | 2414 | ||
| 2410 | (setq scroll-step 2) | 2415 | (setq scroll-step 2) |
| 2411 | (setq room-shorts nil) | ||
| 2412 | (dolist (x rooms) | ||
| 2413 | (setq room-shorts | ||
| 2414 | (append room-shorts (list (downcase (space-to-hyphen | ||
| 2415 | (cadr x))))))) | ||
| 2416 | 2416 | ||
| 2417 | (setq endgame-questions '( | 2417 | (setq dun-room-shorts nil) |
| 2418 | (dolist (x dun-rooms) | ||
| 2419 | (setq dun-room-shorts | ||
| 2420 | (append dun-room-shorts (list (downcase | ||
| 2421 | (dun-space-to-hyphen | ||
| 2422 | (cadr x))))))) | ||
| 2423 | |||
| 2424 | (setq dun-endgame-questions '( | ||
| 2418 | ( | 2425 | ( |
| 2419 | "What is your password on the machine called 'pokey'?" "robert") | 2426 | "What is your password on the machine called 'pokey'?" "robert") |
| 2420 | ( | 2427 | ( |
| @@ -2458,7 +2465,7 @@ treasures for points?" "4" "four") | |||
| 2458 | 2465 | ||
| 2459 | (let (a) | 2466 | (let (a) |
| 2460 | (setq a 0) | 2467 | (setq a 0) |
| 2461 | (dolist (x room-shorts) | 2468 | (dolist (x dun-room-shorts) |
| 2462 | (eval (list 'defconst (intern x) a)) | 2469 | (eval (list 'defconst (intern x) a)) |
| 2463 | (setq a (+ a 1)))) | 2470 | (setq a (+ a 1)))) |
| 2464 | 2471 | ||
| @@ -2468,7 +2475,7 @@ treasures for points?" "4" "four") | |||
| 2468 | ;;;; This section defines the UNIX emulation functions for dunnet. | 2475 | ;;;; This section defines the UNIX emulation functions for dunnet. |
| 2469 | ;;;; | 2476 | ;;;; |
| 2470 | 2477 | ||
| 2471 | (defun unix-parse (args) | 2478 | (defun dun-unix-parse (args) |
| 2472 | (interactive "*p") | 2479 | (interactive "*p") |
| 2473 | (beginning-of-line) | 2480 | (beginning-of-line) |
| 2474 | (let (beg esign) | 2481 | (let (beg esign) |
| @@ -2479,31 +2486,31 @@ treasures for points?" "4" "four") | |||
| 2479 | (progn | 2486 | (progn |
| 2480 | (setq line (downcase (buffer-substring beg (point)))) | 2487 | (setq line (downcase (buffer-substring beg (point)))) |
| 2481 | (princ line) | 2488 | (princ line) |
| 2482 | (if (eq (parse2 nil unix-verbs line) -1) | 2489 | (if (eq (dun-parse2 nil dun-unix-verbs line) -1) |
| 2483 | (progn | 2490 | (progn |
| 2484 | (if (setq esign (string-match "=" line)) | 2491 | (if (setq esign (string-match "=" line)) |
| 2485 | (doassign line esign) | 2492 | (dun-doassign line esign) |
| 2486 | (mprinc (car line-list)) | 2493 | (dun-mprinc (car line-list)) |
| 2487 | (mprincl ": not found."))))) | 2494 | (dun-mprincl ": not found."))))) |
| 2488 | (goto-char (point-max)) | 2495 | (goto-char (point-max)) |
| 2489 | (mprinc "\n")) | 2496 | (dun-mprinc "\n")) |
| 2490 | (if (eq dungeon-mode 'unix) | 2497 | (if (eq dungeon-mode 'unix) |
| 2491 | (progn | 2498 | (progn |
| 2492 | (fix-screen) | 2499 | (dun-fix-screen) |
| 2493 | (mprinc "$ "))))) | 2500 | (dun-mprinc "$ "))))) |
| 2494 | 2501 | ||
| 2495 | (defun doassign (line esign) | 2502 | (defun dun-doassign (line esign) |
| 2496 | (if (not wizard) | 2503 | (if (not dun-wizard) |
| 2497 | (let (passwd) | 2504 | (let (passwd) |
| 2498 | (mprinc "Enter wizard password: ") | 2505 | (dun-mprinc "Enter wizard password: ") |
| 2499 | (setq passwd (read-line)) | 2506 | (setq passwd (dun-read-line)) |
| 2500 | (if (not batch-mode) | 2507 | (if (not dun-batch-mode) |
| 2501 | (mprinc "\n")) | 2508 | (dun-mprinc "\n")) |
| 2502 | (if (string= passwd "moby") | 2509 | (if (string= passwd "moby") |
| 2503 | (progn | 2510 | (progn |
| 2504 | (setq wizard t) | 2511 | (setq dun-wizard t) |
| 2505 | (doassign line esign)) | 2512 | (dun-doassign line esign)) |
| 2506 | (mprincl "Incorrect."))) | 2513 | (dun-mprincl "Incorrect."))) |
| 2507 | 2514 | ||
| 2508 | (let (varname epoint afterq i value) | 2515 | (let (varname epoint afterq i value) |
| 2509 | (setq varname (substring line 0 esign)) | 2516 | (setq varname (substring line 0 esign)) |
| @@ -2524,9 +2531,9 @@ treasures for points?" "4" "four") | |||
| 2524 | (setq i (string-match ")" (substring line epoint)))) | 2531 | (setq i (string-match ")" (substring line epoint)))) |
| 2525 | (setq epoint (+ epoint i 1)))) | 2532 | (setq epoint (+ epoint i 1)))) |
| 2526 | (setq value (substring line (1+ esign) epoint)) | 2533 | (setq value (substring line (1+ esign) epoint)) |
| 2527 | (dungeon-eval varname value)))) | 2534 | (dun-eval varname value)))) |
| 2528 | 2535 | ||
| 2529 | (defun dungeon-eval (varname value) | 2536 | (defun dun-eval (varname value) |
| 2530 | (let (eval-error) | 2537 | (let (eval-error) |
| 2531 | (switch-to-buffer (get-buffer-create "*dungeon-eval*")) | 2538 | (switch-to-buffer (get-buffer-create "*dungeon-eval*")) |
| 2532 | (erase-buffer) | 2539 | (erase-buffer) |
| @@ -2542,36 +2549,34 @@ treasures for points?" "4" "four") | |||
| 2542 | (kill-buffer (current-buffer)) | 2549 | (kill-buffer (current-buffer)) |
| 2543 | (switch-to-buffer "*dungeon*") | 2550 | (switch-to-buffer "*dungeon*") |
| 2544 | (if eval-error | 2551 | (if eval-error |
| 2545 | (mprincl "Invalid syntax.")))) | 2552 | (dun-mprincl "Invalid syntax.")))) |
| 2546 | 2553 | ||
| 2547 | 2554 | ||
| 2548 | (defun unix-interface () | 2555 | (defun dun-unix-interface () |
| 2549 | (login) | 2556 | (dun-login) |
| 2550 | (if logged-in | 2557 | (if dun-logged-in |
| 2551 | (progn | 2558 | (progn |
| 2552 | (setq dungeon-mode 'unix) | 2559 | (setq dungeon-mode 'unix) |
| 2553 | (define-key dungeon-mode-map "\r" 'unix-parse) | 2560 | (define-key dungeon-mode-map "\r" 'dun-unix-parse) |
| 2554 | (mprinc "$ ")))) | 2561 | (dun-mprinc "$ ")))) |
| 2555 | 2562 | ||
| 2556 | 2563 | (defun dun-login () | |
| 2557 | |||
| 2558 | (defun login () | ||
| 2559 | (let (tries username password) | 2564 | (let (tries username password) |
| 2560 | (setq tries 4) | 2565 | (setq tries 4) |
| 2561 | (while (and (not logged-in) (> (setq tries (- tries 1)) 0)) | 2566 | (while (and (not dun-logged-in) (> (setq tries (- tries 1)) 0)) |
| 2562 | (mprinc "\n\nUNIX System V, Release 2.2 (pokey)\n\nlogin: ") | 2567 | (dun-mprinc "\n\nUNIX System V, Release 2.2 (pokey)\n\nlogin: ") |
| 2563 | (setq username (read-line)) | 2568 | (setq username (dun-read-line)) |
| 2564 | (if (not batch-mode) | 2569 | (if (not dun-batch-mode) |
| 2565 | (mprinc "\n")) | 2570 | (dun-mprinc "\n")) |
| 2566 | (mprinc "password: ") | 2571 | (dun-mprinc "password: ") |
| 2567 | (setq password (read-line)) | 2572 | (setq password (dun-read-line)) |
| 2568 | (if (not batch-mode) | 2573 | (if (not dun-batch-mode) |
| 2569 | (mprinc "\n")) | 2574 | (dun-mprinc "\n")) |
| 2570 | (if (or (not (string= username "toukmond")) | 2575 | (if (or (not (string= username "toukmond")) |
| 2571 | (not (string= password "robert"))) | 2576 | (not (string= password "robert"))) |
| 2572 | (mprincl "login incorrect") | 2577 | (dun-mprincl "login incorrect") |
| 2573 | (setq logged-in t) | 2578 | (setq dun-logged-in t) |
| 2574 | (mprincl " | 2579 | (dun-mprincl " |
| 2575 | Welcome to Unix\n | 2580 | Welcome to Unix\n |
| 2576 | Please clean up your directories. The filesystem is getting full. | 2581 | Please clean up your directories. The filesystem is getting full. |
| 2577 | Our tcp/ip link to gamma is a little flakey, but seems to work. | 2582 | Our tcp/ip link to gamma is a little flakey, but seems to work. |
| @@ -2581,79 +2586,79 @@ directory, and deletes them after they are sent! Be careful. | |||
| 2581 | Note: Restricted bourne shell in use.\n"))) | 2586 | Note: Restricted bourne shell in use.\n"))) |
| 2582 | (setq dungeon-mode 'dungeon))) | 2587 | (setq dungeon-mode 'dungeon))) |
| 2583 | 2588 | ||
| 2584 | (defun ls (args) | 2589 | (defun dun-ls (args) |
| 2585 | (if (car args) | 2590 | (if (car args) |
| 2586 | (let (ocdpath ocdroom) | 2591 | (let (ocdpath ocdroom) |
| 2587 | (setq ocdpath cdpath) | 2592 | (setq ocdpath dun-cdpath) |
| 2588 | (setq ocdroom cdroom) | 2593 | (setq ocdroom dun-cdroom) |
| 2589 | (if (not (eq (dunnet-cd args) -2)) | 2594 | (if (not (eq (dun-cd args) -2)) |
| 2590 | (ls nil)) | 2595 | (dun-ls nil)) |
| 2591 | (setq cdpath ocdpath) | 2596 | (setq dun-cdpath ocdpath) |
| 2592 | (setq cdroom ocdroom)) | 2597 | (setq dun-cdroom ocdroom)) |
| 2593 | (if (= cdroom -10) | 2598 | (if (= dun-cdroom -10) |
| 2594 | (ls-inven)) | 2599 | (dun-ls-inven)) |
| 2595 | (if (= cdroom -2) | 2600 | (if (= dun-cdroom -2) |
| 2596 | (ls-rooms)) | 2601 | (dun-ls-rooms)) |
| 2597 | (if (= cdroom -3) | 2602 | (if (= dun-cdroom -3) |
| 2598 | (ls-root)) | 2603 | (dun-ls-root)) |
| 2599 | (if (= cdroom -4) | 2604 | (if (= dun-cdroom -4) |
| 2600 | (ls-usr)) | 2605 | (dun-ls-usr)) |
| 2601 | (if (> cdroom 0) | 2606 | (if (> dun-cdroom 0) |
| 2602 | (ls-room)))) | 2607 | (dun-ls-room)))) |
| 2603 | 2608 | ||
| 2604 | (defun ls-root () | 2609 | (defun dun-ls-root () |
| 2605 | (mprincl "total 4 | 2610 | (dun-mprincl "total 4 |
| 2606 | drwxr-xr-x 3 root staff 512 Jan 1 1970 . | 2611 | drwxr-xr-x 3 root staff 512 Jan 1 1970 . |
| 2607 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 .. | 2612 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 .. |
| 2608 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 usr | 2613 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 usr |
| 2609 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 rooms")) | 2614 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 rooms")) |
| 2610 | 2615 | ||
| 2611 | (defun ls-usr () | 2616 | (defun dun-ls-usr () |
| 2612 | (mprincl "total 4 | 2617 | (dun-mprincl "total 4 |
| 2613 | drwxr-xr-x 3 root staff 512 Jan 1 1970 . | 2618 | drwxr-xr-x 3 root staff 512 Jan 1 1970 . |
| 2614 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 .. | 2619 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 .. |
| 2615 | drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 toukmond")) | 2620 | drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 toukmond")) |
| 2616 | 2621 | ||
| 2617 | (defun ls-rooms () | 2622 | (defun dun-ls-rooms () |
| 2618 | (mprincl "total 16 | 2623 | (dun-mprincl "total 16 |
| 2619 | drwxr-xr-x 3 root staff 512 Jan 1 1970 . | 2624 | drwxr-xr-x 3 root staff 512 Jan 1 1970 . |
| 2620 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | 2625 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") |
| 2621 | (dolist (x visited) | 2626 | (dolist (x dun-visited) |
| 2622 | (mprinc | 2627 | (dun-mprinc |
| 2623 | "drwxr-xr-x 3 root staff 512 Jan 1 1970 ") | 2628 | "drwxr-xr-x 3 root staff 512 Jan 1 1970 ") |
| 2624 | (mprincl (nth x room-shorts)))) | 2629 | (dun-mprincl (nth x dun-room-shorts)))) |
| 2625 | 2630 | ||
| 2626 | (defun ls-room () | 2631 | (defun dun-ls-room () |
| 2627 | (mprincl "total 4 | 2632 | (dun-mprincl "total 4 |
| 2628 | drwxr-xr-x 3 root staff 512 Jan 1 1970 . | 2633 | drwxr-xr-x 3 root staff 512 Jan 1 1970 . |
| 2629 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 .. | 2634 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 .. |
| 2630 | -rwxr-xr-x 3 root staff 2048 Jan 1 1970 description") | 2635 | -rwxr-xr-x 3 root staff 2048 Jan 1 1970 description") |
| 2631 | (dolist (x (nth cdroom room-objects)) | 2636 | (dolist (x (nth dun-cdroom dun-room-objects)) |
| 2632 | (if (and (>= x 0) (not (= x 255))) | 2637 | (if (and (>= x 0) (not (= x 255))) |
| 2633 | (progn | 2638 | (progn |
| 2634 | (mprinc "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ") | 2639 | (dun-mprinc "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ") |
| 2635 | (mprincl (nth x objfiles)))))) | 2640 | (dun-mprincl (nth x dun-objfiles)))))) |
| 2636 | 2641 | ||
| 2637 | (defun ls-inven () | 2642 | (defun dun-ls-inven () |
| 2638 | (mprinc "total 467 | 2643 | (dun-mprinc "total 467 |
| 2639 | drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 . | 2644 | drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 . |
| 2640 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | 2645 | drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") |
| 2641 | (dolist (x unix-verbs) | 2646 | (dolist (x dun-unix-verbs) |
| 2642 | (if (not (eq (car x) 'IMPOSSIBLE)) | 2647 | (if (not (eq (car x) 'IMPOSSIBLE)) |
| 2643 | (progn | 2648 | (progn |
| 2644 | (mprinc" | 2649 | (dun-mprinc" |
| 2645 | -rwxr-xr-x 1 toukmond restricted 10423 Jan 1 1970 ") | 2650 | -rwxr-xr-x 1 toukmond restricted 10423 Jan 1 1970 ") |
| 2646 | (mprinc (car x))))) | 2651 | (dun-mprinc (car x))))) |
| 2647 | (mprinc "\n") | 2652 | (dun-mprinc "\n") |
| 2648 | (if (not uncompressed) | 2653 | (if (not dun-uncompressed) |
| 2649 | (mprincl | 2654 | (dun-mprincl |
| 2650 | "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 paper.o.Z")) | 2655 | "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 paper.o.Z")) |
| 2651 | (dolist (x inventory) | 2656 | (dolist (x dun-inventory) |
| 2652 | (mprinc | 2657 | (dun-mprinc |
| 2653 | "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ") | 2658 | "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ") |
| 2654 | (mprincl (nth x objfiles)))) | 2659 | (dun-mprincl (nth x dun-objfiles)))) |
| 2655 | 2660 | ||
| 2656 | (defun echo (args) | 2661 | (defun dun-echo (args) |
| 2657 | (let (nomore var) | 2662 | (let (nomore var) |
| 2658 | (setq nomore nil) | 2663 | (setq nomore nil) |
| 2659 | (dolist (x args) | 2664 | (dolist (x args) |
| @@ -2661,105 +2666,107 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | |||
| 2661 | (progn | 2666 | (progn |
| 2662 | (if (not (string= (substring x 0 1) "$")) | 2667 | (if (not (string= (substring x 0 1) "$")) |
| 2663 | (progn | 2668 | (progn |
| 2664 | (mprinc x) | 2669 | (dun-mprinc x) |
| 2665 | (mprinc " ")) | 2670 | (dun-mprinc " ")) |
| 2666 | (setq var (intern (substring x 1))) | 2671 | (setq var (intern (substring x 1))) |
| 2667 | (if (not (boundp var)) | 2672 | (if (not (boundp var)) |
| 2668 | (mprinc " ") | 2673 | (dun-mprinc " ") |
| 2669 | (if (member var restricted) | 2674 | (if (member var dun-restricted) |
| 2670 | (progn | 2675 | (progn |
| 2671 | (mprinc var) | 2676 | (dun-mprinc var) |
| 2672 | (mprinc ": Permission denied") | 2677 | (dun-mprinc ": Permission denied") |
| 2673 | (setq nomore t)) | 2678 | (setq nomore t)) |
| 2674 | (eval (list 'mprinc var)) | 2679 | (eval (list 'dun-mprinc var)) |
| 2675 | (mprinc " "))))))) | 2680 | (dun-mprinc " "))))))) |
| 2676 | (mprinc "\n"))) | 2681 | (dun-mprinc "\n"))) |
| 2677 | 2682 | ||
| 2678 | 2683 | ||
| 2679 | (defun ftp (args) | 2684 | (defun dun-ftp (args) |
| 2680 | (let (host username passwd ident newlist) | 2685 | (let (host username passwd ident newlist) |
| 2681 | (if (not (car args)) | 2686 | (if (not (car args)) |
| 2682 | (mprincl "ftp: hostname required on command line.") | 2687 | (dun-mprincl "ftp: hostname required on command line.") |
| 2683 | (setq host (intern (car args))) | 2688 | (setq host (intern (car args))) |
| 2684 | (if (not (member host '(gamma endgame))) | 2689 | (if (not (member host '(gamma dun-endgame))) |
| 2685 | (mprincl "ftp: Unknown host.") | 2690 | (dun-mprincl "ftp: Unknown host.") |
| 2686 | (if (eq host 'endgame) | 2691 | (if (eq host 'dun-endgame) |
| 2687 | (mprincl "ftp: connection to endgame not allowed") | 2692 | (dun-mprincl "ftp: connection to endgame not allowed") |
| 2688 | (if (not ethernet) | 2693 | (if (not dun-ethernet) |
| 2689 | (mprincl "ftp: host not responding.") | 2694 | (dun-mprincl "ftp: host not responding.") |
| 2690 | (mprincl "Connected to gamma. FTP ver 0.9 00:00:00 01/01/70") | 2695 | (dun-mprincl "Connected to gamma. FTP ver 0.9 00:00:00 01/01/70") |
| 2691 | (mprinc "Username: ") | 2696 | (dun-mprinc "Username: ") |
| 2692 | (setq username (read-line)) | 2697 | (setq username (dun-read-line)) |
| 2693 | (if (string= username "toukmond") | 2698 | (if (string= username "toukmond") |
| 2694 | (if batch-mode | 2699 | (if dun-batch-mode |
| 2695 | (mprincl "toukmond ftp access not allowed.") | 2700 | (dun-mprincl "toukmond ftp access not allowed.") |
| 2696 | (mprincl "\ntoukmond ftp access not allowed.")) | 2701 | (dun-mprincl "\ntoukmond ftp access not allowed.")) |
| 2697 | (if (string= username "anonymous") | 2702 | (if (string= username "anonymous") |
| 2698 | (if batch-mode | 2703 | (if dun-batch-mode |
| 2699 | (mprincl | 2704 | (dun-mprincl |
| 2700 | "Guest login okay, send your user ident as password.") | 2705 | "Guest login okay, send your user ident as password.") |
| 2701 | (mprincl | 2706 | (dun-mprincl |
| 2702 | "\nGuest login okay, send your user ident as password.")) | 2707 | "\nGuest login okay, send your user ident as password.")) |
| 2703 | (if batch-mode | 2708 | (if dun-batch-mode |
| 2704 | (mprinc "Password required for ") | 2709 | (dun-mprinc "Password required for ") |
| 2705 | (mprinc "\nPassword required for ")) | 2710 | (dun-mprinc "\nPassword required for ")) |
| 2706 | (mprincl username)) | 2711 | (dun-mprincl username)) |
| 2707 | (mprinc "Password: ") | 2712 | (dun-mprinc "Password: ") |
| 2708 | (setq ident (read-line)) | 2713 | (setq ident (dun-read-line)) |
| 2709 | (if (not (string= username "anonymous")) | 2714 | (if (not (string= username "anonymous")) |
| 2710 | (if batch-mode | 2715 | (if dun-batch-mode |
| 2711 | (mprincl "Login failed.") | 2716 | (dun-mprincl "Login failed.") |
| 2712 | (mprincl "\nLogin failed.")) | 2717 | (dun-mprincl "\nLogin failed.")) |
| 2713 | (if batch-mode | 2718 | (if dun-batch-mode |
| 2714 | (mprincl "Guest login okay, user access restrictions apply.") | 2719 | (dun-mprincl |
| 2715 | (mprincl "\nGuest login okay, user access restrictions apply.")) | 2720 | "Guest login okay, user access restrictions apply.") |
| 2716 | (ftp-commands) | 2721 | (dun-mprincl |
| 2722 | "\nGuest login okay, user access restrictions apply.")) | ||
| 2723 | (dun-ftp-commands) | ||
| 2717 | (setq newlist | 2724 | (setq newlist |
| 2718 | '("What password did you use during anonymous ftp to gamma?")) | 2725 | '("What password did you use during anonymous ftp to gamma?")) |
| 2719 | (setq newlist (append newlist (list ident))) | 2726 | (setq newlist (append newlist (list ident))) |
| 2720 | (rplaca (nthcdr 1 endgame-questions) newlist))))))))) | 2727 | (rplaca (nthcdr 1 dun-endgame-questions) newlist))))))))) |
| 2721 | 2728 | ||
| 2722 | (defun ftp-commands () | 2729 | (defun dun-ftp-commands () |
| 2723 | (setq exitf nil) | 2730 | (setq dun-exitf nil) |
| 2724 | (let (line) | 2731 | (let (line) |
| 2725 | (while (not exitf) | 2732 | (while (not dun-exitf) |
| 2726 | (mprinc "ftp> ") | 2733 | (dun-mprinc "ftp> ") |
| 2727 | (setq line (read-line)) | 2734 | (setq line (dun-read-line)) |
| 2728 | (if | 2735 | (if |
| 2729 | (eq | 2736 | (eq |
| 2730 | (parse2 nil | 2737 | (dun-parse2 nil |
| 2731 | '((type . ftptype) (binary . bin) (bin . bin) (send . send) | 2738 | '((type . dun-ftptype) (binary . dun-bin) (bin . dun-bin) |
| 2732 | (put . send) (quit . ftpquit) (help . ftphelp) | 2739 | (send . dun-send) (put . dun-send) (quit . dun-ftpquit) |
| 2733 | (ascii . fascii) | 2740 | (help . dun-ftphelp)(ascii . dun-fascii) |
| 2734 | ) line) | 2741 | ) line) |
| 2735 | -1) | 2742 | -1) |
| 2736 | (mprincl "No such command. Try help."))) | 2743 | (dun-mprincl "No such command. Try help."))) |
| 2737 | (setq ftptype 'ascii))) | 2744 | (setq dun-ftptype 'ascii))) |
| 2738 | 2745 | ||
| 2739 | (defun ftptype (args) | 2746 | (defun dun-ftptype (args) |
| 2740 | (if (not (car args)) | 2747 | (if (not (car args)) |
| 2741 | (mprincl "Usage: type [binary | ascii]") | 2748 | (dun-mprincl "Usage: type [binary | ascii]") |
| 2742 | (setq args (intern (car args))) | 2749 | (setq args (intern (car args))) |
| 2743 | (if (eq args 'binary) | 2750 | (if (eq args 'binary) |
| 2744 | (bin nil) | 2751 | (dun-bin nil) |
| 2745 | (if (eq args 'ascii) | 2752 | (if (eq args 'ascii) |
| 2746 | (fascii 'nil) | 2753 | (dun-fascii 'nil) |
| 2747 | (mprincl "Unknown type."))))) | 2754 | (dun-mprincl "Unknown type."))))) |
| 2748 | 2755 | ||
| 2749 | (defun bin (args) | 2756 | (defun dun-bin (args) |
| 2750 | (mprincl "Type set to binary.") | 2757 | (dun-mprincl "Type set to binary.") |
| 2751 | (setq ftptype 'binary)) | 2758 | (setq dun-ftptype 'binary)) |
| 2752 | 2759 | ||
| 2753 | (defun fascii (args) | 2760 | (defun dun-fascii (args) |
| 2754 | (mprincl "Type set to ascii.") | 2761 | (dun-mprincl "Type set to ascii.") |
| 2755 | (setq ftptype 'ascii)) | 2762 | (setq dun-ftptype 'ascii)) |
| 2756 | 2763 | ||
| 2757 | (defun ftpquit (args) | 2764 | (defun dun-ftpquit (args) |
| 2758 | (setq exitf t)) | 2765 | (setq dun-exitf t)) |
| 2759 | 2766 | ||
| 2760 | (defun send (args) | 2767 | (defun dun-send (args) |
| 2761 | (if (not (car args)) | 2768 | (if (not (car args)) |
| 2762 | (mprincl "Usage: send <filename>") | 2769 | (dun-mprincl "Usage: send <filename>") |
| 2763 | (setq args (car args)) | 2770 | (setq args (car args)) |
| 2764 | (let (counter foo) | 2771 | (let (counter foo) |
| 2765 | (setq foo nil) | 2772 | (setq foo nil) |
| @@ -2768,107 +2775,110 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | |||
| 2768 | ;;; User can send commands! Stupid user. | 2775 | ;;; User can send commands! Stupid user. |
| 2769 | 2776 | ||
| 2770 | 2777 | ||
| 2771 | (if (assq (intern args) unix-verbs) | 2778 | (if (assq (intern args) dun-unix-verbs) |
| 2772 | (progn | 2779 | (progn |
| 2773 | (rplaca (assq (intern args) unix-verbs) 'IMPOSSIBLE) | 2780 | (rplaca (assq (intern args) dun-unix-verbs) 'IMPOSSIBLE) |
| 2774 | (mprinc "Sending ") | 2781 | (dun-mprinc "Sending ") |
| 2775 | (mprinc ftptype) | 2782 | (dun-mprinc dun-ftptype) |
| 2776 | (mprinc " file for ") | 2783 | (dun-mprinc " file for ") |
| 2777 | (mprincl args) | 2784 | (dun-mprincl args) |
| 2778 | (mprincl "Transfer complete.")) | 2785 | (dun-mprincl "Transfer complete.")) |
| 2779 | 2786 | ||
| 2780 | (dolist (x objfiles) | 2787 | (dolist (x dun-objfiles) |
| 2781 | (if (string= args x) | 2788 | (if (string= args x) |
| 2782 | (progn | 2789 | (progn |
| 2783 | (if (not (member counter inventory)) | 2790 | (if (not (member counter dun-inventory)) |
| 2784 | (progn | 2791 | (progn |
| 2785 | (mprincl "No such file.") | 2792 | (dun-mprincl "No such file.") |
| 2786 | (setq foo t)) | 2793 | (setq foo t)) |
| 2787 | (mprinc "Sending ") | 2794 | (dun-mprinc "Sending ") |
| 2788 | (mprinc ftptype) | 2795 | (dun-mprinc dun-ftptype) |
| 2789 | (mprinc " file for ") | 2796 | (dun-mprinc " file for ") |
| 2790 | (mprinc (downcase (cadr (nth counter objects)))) | 2797 | (dun-mprinc (downcase (cadr (nth counter dun-objects)))) |
| 2791 | (mprincl ", (0 bytes)") | 2798 | (dun-mprincl ", (0 bytes)") |
| 2792 | (if (not (eq ftptype 'binary)) | 2799 | (if (not (eq dun-ftptype 'binary)) |
| 2793 | (progn | 2800 | (progn |
| 2794 | (if (not (member obj-protoplasm | 2801 | (if (not (member obj-protoplasm |
| 2795 | (nth receiving-room room-objects))) | 2802 | (nth receiving-room |
| 2796 | (replace room-objects receiving-room | 2803 | dun-room-objects))) |
| 2797 | (append (nth receiving-room room-objects) | 2804 | (dun-replace dun-room-objects receiving-room |
| 2805 | (append (nth receiving-room | ||
| 2806 | dun-room-objects) | ||
| 2798 | (list obj-protoplasm)))) | 2807 | (list obj-protoplasm)))) |
| 2799 | (remove-obj-from-inven counter)) | 2808 | (dun-remove-obj-from-inven counter)) |
| 2800 | (remove-obj-from-inven counter) | 2809 | (dun-remove-obj-from-inven counter) |
| 2801 | (replace room-objects receiving-room | 2810 | (dun-replace dun-room-objects receiving-room |
| 2802 | (append (nth receiving-room room-objects) | 2811 | (append (nth receiving-room dun-room-objects) |
| 2803 | (list counter)))) | 2812 | (list counter)))) |
| 2804 | (setq foo t) | 2813 | (setq foo t) |
| 2805 | (mprincl "Transfer complete.")))) | 2814 | (dun-mprincl "Transfer complete.")))) |
| 2806 | (setq counter (+ 1 counter))) | 2815 | (setq counter (+ 1 counter))) |
| 2807 | (if (not foo) | 2816 | (if (not foo) |
| 2808 | (mprincl "No such file.")))))) | 2817 | (dun-mprincl "No such file.")))))) |
| 2809 | 2818 | ||
| 2810 | (defun ftphelp (args) | 2819 | (defun dun-ftphelp (args) |
| 2811 | (mprincl | 2820 | (dun-mprincl |
| 2812 | "Possible commands are:\nsend quit type ascii binary help")) | 2821 | "Possible commands are:\nsend quit type ascii binary help")) |
| 2813 | 2822 | ||
| 2814 | (defun uexit (args) | 2823 | (defun dun-uexit (args) |
| 2815 | (setq dungeon-mode 'dungeon) | 2824 | (setq dungeon-mode 'dungeon) |
| 2816 | (mprincl "\nYou step back from the console.") | 2825 | (dun-mprincl "\nYou step back from the console.") |
| 2817 | (define-key dungeon-mode-map "\r" 'dungeon-parse) | 2826 | (define-key dungeon-mode-map "\r" 'dun-parse) |
| 2818 | (if (not batch-mode) | 2827 | (if (not dun-batch-mode) |
| 2819 | (dungeon-messages))) | 2828 | (dun-messages))) |
| 2820 | 2829 | ||
| 2821 | (defun dunnet-pwd (args) | 2830 | (defun dun-pwd (args) |
| 2822 | (mprincl cdpath)) | 2831 | (dun-mprincl dun-cdpath)) |
| 2823 | 2832 | ||
| 2824 | (defun uncompress (args) | 2833 | (defun dun-uncompress (args) |
| 2825 | (if (not (car args)) | 2834 | (if (not (car args)) |
| 2826 | (mprincl "Usage: uncompress <filename>") | 2835 | (dun-mprincl "Usage: uncompress <filename>") |
| 2827 | (setq args (car args)) | 2836 | (setq args (car args)) |
| 2828 | (if (or uncompressed | 2837 | (if (or dun-uncompressed |
| 2829 | (and (not (string= args "paper.o")) | 2838 | (and (not (string= args "paper.o")) |
| 2830 | (not (string= args "paper.o.z")))) | 2839 | (not (string= args "paper.o.z")))) |
| 2831 | (mprincl "Uncompress command failed.") | 2840 | (dun-mprincl "Uncompress command failed.") |
| 2832 | (setq uncompressed t) | 2841 | (setq dun-uncompressed t) |
| 2833 | (setq inventory (append inventory (list obj-paper)))))) | 2842 | (setq dun-inventory (append dun-inventory (list obj-paper)))))) |
| 2834 | 2843 | ||
| 2835 | (defun rlogin (args) | 2844 | (defun dun-rlogin (args) |
| 2836 | (let (passwd) | 2845 | (let (passwd) |
| 2837 | (if (not (car args)) | 2846 | (if (not (car args)) |
| 2838 | (mprincl "Usage: rlogin <hostname>") | 2847 | (dun-mprincl "Usage: rlogin <hostname>") |
| 2839 | (setq args (car args)) | 2848 | (setq args (car args)) |
| 2840 | (if (string= args "endgame") | 2849 | (if (string= args "endgame") |
| 2841 | (rlogin-endgame) | 2850 | (dun-rlogin-endgame) |
| 2842 | (if (not (string= args "gamma")) | 2851 | (if (not (string= args "gamma")) |
| 2843 | (mprincl "No such host.") | 2852 | (dun-mprincl "No such host.") |
| 2844 | (if (not ethernet) | 2853 | (if (not dun-ethernet) |
| 2845 | (mprincl "Host not responding.") | 2854 | (dun-mprincl "Host not responding.") |
| 2846 | (mprinc "Password: ") | 2855 | (dun-mprinc "Password: ") |
| 2847 | (setq passwd (read-line)) | 2856 | (setq passwd (dun-read-line)) |
| 2848 | (if (not (string= passwd "worms")) | 2857 | (if (not (string= passwd "worms")) |
| 2849 | (mprincl "\nlogin incorrect") | 2858 | (dun-mprincl "\nlogin incorrect") |
| 2850 | (mprinc | 2859 | (dun-mprinc |
| 2851 | "\nYou begin to feel strange for a moment, and you lose your items." | 2860 | "\nYou begin to feel strange for a moment, and you lose your items." |
| 2852 | ) | 2861 | ) |
| 2853 | (replace room-objects computer-room | 2862 | (dun-replace dun-room-objects computer-room |
| 2854 | (append (nth computer-room room-objects) inventory)) | 2863 | (append (nth computer-room dun-room-objects) |
| 2855 | (setq inventory nil) | 2864 | dun-inventory)) |
| 2856 | (setq current-room receiving-room) | 2865 | (setq dun-inventory nil) |
| 2857 | (uexit nil)))))))) | 2866 | (setq dun-current-room receiving-room) |
| 2867 | (dun-uexit nil)))))))) | ||
| 2858 | 2868 | ||
| 2859 | (defun dunnet-cd (args) | 2869 | (defun dun-cd (args) |
| 2860 | (let (tcdpath tcdroom path-elemants room-check) | 2870 | (let (tcdpath tcdroom path-elemants room-check) |
| 2861 | (if (not (car args)) | 2871 | (if (not (car args)) |
| 2862 | (mprincl "Usage: cd <path>") | 2872 | (dun-mprincl "Usage: cd <path>") |
| 2863 | (setq tcdpath cdpath) | 2873 | (setq tcdpath dun-cdpath) |
| 2864 | (setq tcdroom cdroom) | 2874 | (setq tcdroom dun-cdroom) |
| 2865 | (setq badcd nil) | 2875 | (setq dun-badcd nil) |
| 2866 | (condition-case nil | 2876 | (condition-case nil |
| 2867 | (setq path-elements (get-path (car args) nil)) | 2877 | (setq path-elements (dun-get-path (car args) nil)) |
| 2868 | (error (mprincl "Invalid path.") | 2878 | (error (dun-mprincl "Invalid path.") |
| 2869 | (setq badcd t))) | 2879 | (setq dun-badcd t))) |
| 2870 | (dolist (pe path-elements) | 2880 | (dolist (pe path-elements) |
| 2871 | (unless badcd | 2881 | (unless dun-badcd |
| 2872 | (if (not (string= pe ".")) | 2882 | (if (not (string= pe ".")) |
| 2873 | (if (string= pe "..") | 2883 | (if (string= pe "..") |
| 2874 | (progn | 2884 | (progn |
| @@ -2896,11 +2906,11 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | |||
| 2896 | (progn | 2906 | (progn |
| 2897 | (setq tcdpath "/usr/toukmond") | 2907 | (setq tcdpath "/usr/toukmond") |
| 2898 | (setq tcdroom -10)) | 2908 | (setq tcdroom -10)) |
| 2899 | (nosuchdir)) | 2909 | (dun-nosuchdir)) |
| 2900 | (if (= tcdroom -10) | 2910 | (if (= tcdroom -10) |
| 2901 | (nosuchdir) | 2911 | (dun-nosuchdir) |
| 2902 | (if (> tcdroom 0) | 2912 | (if (> tcdroom 0) |
| 2903 | (nosuchdir) | 2913 | (dun-nosuchdir) |
| 2904 | (if (= tcdroom -3) | 2914 | (if (= tcdroom -3) |
| 2905 | (progn | 2915 | (progn |
| 2906 | (if (string= pe "rooms") | 2916 | (if (string= pe "rooms") |
| @@ -2911,77 +2921,82 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | |||
| 2911 | (progn | 2921 | (progn |
| 2912 | (setq tcdpath "/usr") | 2922 | (setq tcdpath "/usr") |
| 2913 | (setq tcdroom -4)) | 2923 | (setq tcdroom -4)) |
| 2914 | (nosuchdir)))) | 2924 | (dun-nosuchdir)))) |
| 2915 | (if (= tcdroom -2) | 2925 | (if (= tcdroom -2) |
| 2916 | (progn | 2926 | (progn |
| 2917 | (dolist (x visited) | 2927 | (dolist (x dun-visited) |
| 2918 | (setq room-check | 2928 | (setq room-check |
| 2919 | (nth x room-shorts)) | 2929 | (nth x |
| 2930 | dun-room-shorts)) | ||
| 2920 | (if (string= room-check pe) | 2931 | (if (string= room-check pe) |
| 2921 | (progn | 2932 | (progn |
| 2922 | (setq tcdpath | 2933 | (setq tcdpath |
| 2923 | (concat "/rooms/" room-check)) | 2934 | (concat "/rooms/" room-check)) |
| 2924 | (setq tcdroom x)))) | 2935 | (setq tcdroom x)))) |
| 2925 | (if (= tcdroom -2) | 2936 | (if (= tcdroom -2) |
| 2926 | (nosuchdir))))))))))))) | 2937 | (dun-nosuchdir))))))))))))) |
| 2927 | (if (not badcd) | 2938 | (if (not dun-badcd) |
| 2928 | (progn | 2939 | (progn |
| 2929 | (setq cdpath tcdpath) | 2940 | (setq dun-cdpath tcdpath) |
| 2930 | (setq cdroom tcdroom) | 2941 | (setq dun-cdroom tcdroom) |
| 2931 | 0) | 2942 | 0) |
| 2932 | -2)))) | 2943 | -2)))) |
| 2933 | 2944 | ||
| 2934 | (defun nosuchdir () | 2945 | (defun dun-nosuchdir () |
| 2935 | (mprincl "No such directory.") | 2946 | (dun-mprincl "No such directory.") |
| 2936 | (setq badcd t)) | 2947 | (setq dun-badcd t)) |
| 2937 | 2948 | ||
| 2938 | (defun cat (args) | 2949 | (defun dun-cat (args) |
| 2939 | (let (doto checklist) | 2950 | (let (doto checklist) |
| 2940 | (if (not (setq args (car args))) | 2951 | (if (not (setq args (car args))) |
| 2941 | (mprincl "Usage: cat <ascii-file-name>") | 2952 | (dun-mprincl "Usage: cat <ascii-file-name>") |
| 2942 | (if (string-match "/" args) | 2953 | (if (string-match "/" args) |
| 2943 | (mprincl "cat: only files in current directory allowed.") | 2954 | (dun-mprincl "cat: only files in current directory allowed.") |
| 2944 | (if (and (> cdroom 0) (string= args "description")) | 2955 | (if (and (> dun-cdroom 0) (string= args "description")) |
| 2945 | (mprincl (car (nth cdroom rooms))) | 2956 | (dun-mprincl (car (nth dun-cdroom dun-rooms))) |
| 2946 | (if (setq doto (string-match "\\.o" args)) | 2957 | (if (setq doto (string-match "\\.o" args)) |
| 2947 | (progn | 2958 | (progn |
| 2948 | (if (= cdroom -10) | 2959 | (if (= dun-cdroom -10) |
| 2949 | (setq checklist inventory) | 2960 | (setq checklist dun-inventory) |
| 2950 | (setq checklist (nth cdroom room-objects))) | 2961 | (setq checklist (nth dun-cdroom dun-room-objects))) |
| 2951 | (if (not (member (cdr | 2962 | (if (not (member (cdr |
| 2952 | (assq (intern | 2963 | (assq (intern |
| 2953 | (substring args 0 doto)) objnames)) | 2964 | (substring args 0 doto)) |
| 2965 | dun-objnames)) | ||
| 2954 | checklist)) | 2966 | checklist)) |
| 2955 | (mprincl "File not found.") | 2967 | (dun-mprincl "File not found.") |
| 2956 | (mprincl "Ascii files only."))) | 2968 | (dun-mprincl "Ascii files only."))) |
| 2957 | (if (assq (intern args) unix-verbs) | 2969 | (if (assq (intern args) dun-unix-verbs) |
| 2958 | (mprincl "Ascii files only.") | 2970 | (dun-mprincl "Ascii files only.") |
| 2959 | (mprincl "File not found.")))))))) | 2971 | (dun-mprincl "File not found.")))))))) |
| 2960 | 2972 | ||
| 2961 | (defun zippy (args) | 2973 | (defun dun-zippy (args) |
| 2962 | (mprincl (yow))) | 2974 | (dun-mprincl (yow))) |
| 2963 | 2975 | ||
| 2964 | (defun rlogin-endgame () | 2976 | (defun dun-rlogin-endgame () |
| 2965 | (if (not (= (score nil) 90)) | 2977 | (if (not (= (dun-score nil) 90)) |
| 2966 | (mprincl "You have not achieved enough points to connect to endgame.") | 2978 | (dun-mprincl |
| 2967 | (mprincl"\nWelcome to the endgame. You are a truly noble adventurer.") | 2979 | "You have not achieved enough points to connect to endgame.") |
| 2968 | (setq current-room treasure-room) | 2980 | (dun-mprincl"\nWelcome to the endgame. You are a truly noble adventurer.") |
| 2969 | (setq endgame t) | 2981 | (setq dun-current-room treasure-room) |
| 2970 | (replace room-objects endgame-treasure-room (list obj-bill)) | 2982 | (setq dun-endgame t) |
| 2971 | (uexit nil))) | 2983 | (dun-replace dun-room-objects endgame-treasure-room (list obj-bill)) |
| 2984 | (dun-uexit nil))) | ||
| 2972 | 2985 | ||
| 2973 | 2986 | ||
| 2974 | (random t) | 2987 | (random t) |
| 2975 | (setq tloc (+ 60 (% (abs (random)) 18))) | 2988 | (setq tloc (+ 60 (% (abs (random)) 18))) |
| 2976 | (replace room-objects tloc (append (nth tloc room-objects) (list 18))) | 2989 | (dun-replace dun-room-objects tloc |
| 2990 | (append (nth tloc dun-room-objects) (list 18))) | ||
| 2991 | |||
| 2977 | (setq tcomb (+ 100 (% (abs (random)) 899))) | 2992 | (setq tcomb (+ 100 (% (abs (random)) 899))) |
| 2978 | (setq combination (prin1-to-string tcomb)) | 2993 | (setq dun-combination (prin1-to-string tcomb)) |
| 2979 | 2994 | ||
| 2980 | ;;;; | 2995 | ;;;; |
| 2981 | ;;;; This section defines the DOS emulation functions for dunnet | 2996 | ;;;; This section defines the DOS emulation functions for dunnet |
| 2982 | ;;;; | 2997 | ;;;; |
| 2983 | 2998 | ||
| 2984 | (defun dos-parse (args) | 2999 | (defun dun-dos-parse (args) |
| 2985 | (interactive "*p") | 3000 | (interactive "*p") |
| 2986 | (beginning-of-line) | 3001 | (beginning-of-line) |
| 2987 | (let (beg) | 3002 | (let (beg) |
| @@ -2991,42 +3006,42 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | |||
| 2991 | (let (line) | 3006 | (let (line) |
| 2992 | (setq line (downcase (buffer-substring beg (point)))) | 3007 | (setq line (downcase (buffer-substring beg (point)))) |
| 2993 | (princ line) | 3008 | (princ line) |
| 2994 | (if (eq (parse2 nil dos-verbs line) -1) | 3009 | (if (eq (dun-parse2 nil dun-dos-verbs line) -1) |
| 2995 | (progn | 3010 | (progn |
| 2996 | (sleep-for 1) | 3011 | (sleep-for 1) |
| 2997 | (mprincl "Bad command or file name")))) | 3012 | (dun-mprincl "Bad command or file name")))) |
| 2998 | (goto-char (point-max)) | 3013 | (goto-char (point-max)) |
| 2999 | (mprinc "\n")) | 3014 | (dun-mprinc "\n")) |
| 3000 | (if (eq dungeon-mode 'dos) | 3015 | (if (eq dungeon-mode 'dos) |
| 3001 | (progn | 3016 | (progn |
| 3002 | (fix-screen) | 3017 | (dun-fix-screen) |
| 3003 | (dos-prompt))))) | 3018 | (dun-dos-prompt))))) |
| 3004 | 3019 | ||
| 3005 | (defun dos-interface () | 3020 | (defun dun-dos-interface () |
| 3006 | (dos-boot-msg) | 3021 | (dun-dos-boot-msg) |
| 3007 | (setq dungeon-mode 'dos) | 3022 | (setq dungeon-mode 'dos) |
| 3008 | (define-key dungeon-mode-map "\r" 'dos-parse) | 3023 | (define-key dungeon-mode-map "\r" 'dun-dos-parse) |
| 3009 | (dos-prompt)) | 3024 | (dun-dos-prompt)) |
| 3010 | 3025 | ||
| 3011 | (defun dos-type (args) | 3026 | (defun dun-dos-type (args) |
| 3012 | (sleep-for 2) | 3027 | (sleep-for 2) |
| 3013 | (if (setq args (car args)) | 3028 | (if (setq args (car args)) |
| 3014 | (if (string= args "foo.txt") | 3029 | (if (string= args "foo.txt") |
| 3015 | (dos-show-combination) | 3030 | (dun-dos-show-combination) |
| 3016 | (if (string= args "command.com") | 3031 | (if (string= args "command.com") |
| 3017 | (mprincl "Cannot type binary files") | 3032 | (dun-mprincl "Cannot type binary files") |
| 3018 | (mprinc "File not found - ") | 3033 | (dun-mprinc "File not found - ") |
| 3019 | (mprincl (upcase args)))) | 3034 | (dun-mprincl (upcase args)))) |
| 3020 | (mprincl "Must supply file name"))) | 3035 | (dun-mprincl "Must supply file name"))) |
| 3021 | 3036 | ||
| 3022 | (defun dos-invd (args) | 3037 | (defun dun-dos-invd (args) |
| 3023 | (sleep-for 1) | 3038 | (sleep-for 1) |
| 3024 | (mprincl "Invalid drive specification")) | 3039 | (dun-mprincl "Invalid drive specification")) |
| 3025 | 3040 | ||
| 3026 | (defun dos-dir (args) | 3041 | (defun dun-dos-dir (args) |
| 3027 | (sleep-for 1) | 3042 | (sleep-for 1) |
| 3028 | (if (or (not (setq args (car args))) (string= args "\\")) | 3043 | (if (or (not (setq args (car args))) (string= args "\\")) |
| 3029 | (mprincl " | 3044 | (dun-mprincl " |
| 3030 | Volume in drive A is FOO | 3045 | Volume in drive A is FOO |
| 3031 | Volume Serial Number is 1A16-08C9 | 3046 | Volume Serial Number is 1A16-08C9 |
| 3032 | Directory of A:\\ | 3047 | Directory of A:\\ |
| @@ -3036,7 +3051,7 @@ FOO TXT 40 01-20-93 1:01a | |||
| 3036 | 2 file(s) 47845 bytes | 3051 | 2 file(s) 47845 bytes |
| 3037 | 1065280 bytes free | 3052 | 1065280 bytes free |
| 3038 | ") | 3053 | ") |
| 3039 | (mprincl " | 3054 | (dun-mprincl " |
| 3040 | Volume in drive A is FOO | 3055 | Volume in drive A is FOO |
| 3041 | Volume Serial Number is 1A16-08C9 | 3056 | Volume Serial Number is 1A16-08C9 |
| 3042 | Directory of A:\\ | 3057 | Directory of A:\\ |
| @@ -3044,97 +3059,95 @@ FOO TXT 40 01-20-93 1:01a | |||
| 3044 | File not found"))) | 3059 | File not found"))) |
| 3045 | 3060 | ||
| 3046 | 3061 | ||
| 3047 | (defun dos-prompt () | 3062 | (defun dun-dos-prompt () |
| 3048 | (mprinc "A> ")) | 3063 | (dun-mprinc "A> ")) |
| 3049 | 3064 | ||
| 3050 | (defun dos-boot-msg () | 3065 | (defun dun-dos-boot-msg () |
| 3051 | (sleep-for 3) | 3066 | (sleep-for 3) |
| 3052 | (mprinc "Current time is ") | 3067 | (dun-mprinc "Current time is ") |
| 3053 | (mprincl (substring (current-time-string) 12 20)) | 3068 | (dun-mprincl (substring (current-time-string) 12 20)) |
| 3054 | (mprinc "Enter new time: ") | 3069 | (dun-mprinc "Enter new time: ") |
| 3055 | (read-line) | 3070 | (dun-read-line) |
| 3056 | (if (not batch-mode) | 3071 | (if (not dun-batch-mode) |
| 3057 | (mprinc "\n"))) | 3072 | (dun-mprinc "\n"))) |
| 3058 | 3073 | ||
| 3059 | (defun dos-spawn (args) | 3074 | (defun dun-dos-spawn (args) |
| 3060 | (sleep-for 1) | 3075 | (sleep-for 1) |
| 3061 | (mprincl "Cannot spawn subshell")) | 3076 | (dun-mprincl "Cannot spawn subshell")) |
| 3062 | 3077 | ||
| 3063 | (defun dos-exit (args) | 3078 | (defun dun-dos-exit (args) |
| 3064 | (setq dungeon-mode 'dungeon) | 3079 | (setq dungeon-mode 'dungeon) |
| 3065 | (mprincl "\nYou power down the machine and step back.") | 3080 | (dun-mprincl "\nYou power down the machine and step back.") |
| 3066 | (define-key dungeon-mode-map "\r" 'dungeon-parse) | 3081 | (define-key dungeon-mode-map "\r" 'dun-parse) |
| 3067 | (if (not batch-mode) | 3082 | (if (not dun-batch-mode) |
| 3068 | (dungeon-messages))) | 3083 | (dun-messages))) |
| 3069 | 3084 | ||
| 3070 | (defun dos-no-disk () | 3085 | (defun dun-dos-no-disk () |
| 3071 | (sleep-for 3) | 3086 | (sleep-for 3) |
| 3072 | (mprincl "Boot sector not found")) | 3087 | (dun-mprincl "Boot sector not found")) |
| 3073 | 3088 | ||
| 3074 | 3089 | ||
| 3075 | (defun dos-show-combination () | 3090 | (defun dun-dos-show-combination () |
| 3076 | (sleep-for 2) | 3091 | (sleep-for 2) |
| 3077 | (mprinc "\nThe combination is ") | 3092 | (dun-mprinc "\nThe combination is ") |
| 3078 | (mprinc combination) | 3093 | (dun-mprinc dun-combination) |
| 3079 | (mprinc ".\n")) | 3094 | (dun-mprinc ".\n")) |
| 3080 | 3095 | ||
| 3081 | (defun dos-nil (args)) | 3096 | (defun dun-dos-nil (args)) |
| 3082 | 3097 | ||
| 3083 | 3098 | ||
| 3084 | ;;;; | 3099 | ;;;; |
| 3085 | ;;;; This section defines the save and restore game functions for dunnet. | 3100 | ;;;; This section defines the save and restore game functions for dunnet. |
| 3086 | ;;;; | 3101 | ;;;; |
| 3087 | 3102 | ||
| 3088 | (defun save-game (filename) | 3103 | (defun dun-save-game (filename) |
| 3089 | (if (not (setq filename (car filename))) | 3104 | (if (not (setq filename (car filename))) |
| 3090 | (mprincl "You must supply a filename for the save.") | 3105 | (dun-mprincl "You must supply a filename for the save.") |
| 3091 | (if (file-exists-p filename) | 3106 | (if (file-exists-p filename) |
| 3092 | (delete-file filename)) | 3107 | (delete-file filename)) |
| 3093 | (setq numsaves (1+ numsaves)) | 3108 | (setq dun-numsaves (1+ dun-numsaves)) |
| 3094 | (make-save-buffer) | 3109 | (dun-make-save-buffer) |
| 3095 | (save-val "current-room") | 3110 | (dun-save-val "dun-current-room") |
| 3096 | (save-val "computer") | 3111 | (dun-save-val "dun-computer") |
| 3097 | (save-val "door1") | 3112 | (dun-save-val "dun-combination") |
| 3098 | (save-val "combination") | 3113 | (dun-save-val "dun-visited") |
| 3099 | (save-val "visited") | 3114 | (dun-save-val "dun-diggables") |
| 3100 | (save-val "diggables") | 3115 | (dun-save-val "dun-key-level") |
| 3101 | (save-val "key-level") | 3116 | (dun-save-val "dun-floppy") |
| 3102 | (save-val "floppy") | 3117 | (dun-save-val "dun-numsaves") |
| 3103 | (save-val "numsaves") | 3118 | (dun-save-val "dun-numcmds") |
| 3104 | (save-val "numcmds") | 3119 | (dun-save-val "dun-logged-in") |
| 3105 | (save-val "logged-in") | 3120 | (dun-save-val "dungeon-mode") |
| 3106 | (save-val "dungeon-mode") | 3121 | (dun-save-val "dun-jar") |
| 3107 | (save-val "jar") | 3122 | (dun-save-val "dun-lastdir") |
| 3108 | (save-val "lastdir") | 3123 | (dun-save-val "dun-black") |
| 3109 | (save-val "black") | 3124 | (dun-save-val "dun-nomail") |
| 3110 | (save-val "nomail") | 3125 | (dun-save-val "dun-unix-verbs") |
| 3111 | (save-val "unix-verbs") | 3126 | (dun-save-val "dun-hole") |
| 3112 | (save-val "hole") | 3127 | (dun-save-val "dun-uncompressed") |
| 3113 | (save-val "uncompressed") | 3128 | (dun-save-val "dun-ethernet") |
| 3114 | (save-val "ethernet") | 3129 | (dun-save-val "dun-sauna-level") |
| 3115 | (save-val "sauna-level") | 3130 | (dun-save-val "dun-room-objects") |
| 3116 | (save-val "room-objects") | 3131 | (dun-save-val "dun-room-silents") |
| 3117 | (save-val "room-silents") | 3132 | (dun-save-val "dun-inventory") |
| 3118 | (save-val "inventory") | 3133 | (dun-save-val "dun-endgame-question") |
| 3119 | (save-val "endgame-question") | 3134 | (dun-save-val "dun-endgame") |
| 3120 | (save-val "endgame") | 3135 | (dun-save-val "dun-cdroom") |
| 3121 | (save-val "endgame-questions") | 3136 | (dun-save-val "dun-cdpath") |
| 3122 | (save-val "cdroom") | 3137 | (dun-save-val "dun-correct-answer") |
| 3123 | (save-val "cdpath") | 3138 | (dun-save-val "dun-inbus") |
| 3124 | (save-val "correct-answer") | 3139 | (if (dun-compile-save-out filename) |
| 3125 | (save-val "inbus") | 3140 | (dun-mprincl "Error saving to file.") |
| 3126 | (if (compile-save-out filename) | 3141 | (dun-do-logfile 'save nil) |
| 3127 | (mprincl "Error saving to file.") | ||
| 3128 | (do-logfile 'save nil) | ||
| 3129 | (switch-to-buffer "*dungeon*") | 3142 | (switch-to-buffer "*dungeon*") |
| 3130 | (princ "") | 3143 | (princ "") |
| 3131 | (mprincl "Done.")))) | 3144 | (dun-mprincl "Done.")))) |
| 3132 | 3145 | ||
| 3133 | (defun make-save-buffer () | 3146 | (defun dun-make-save-buffer () |
| 3134 | (switch-to-buffer (get-buffer-create "*save-dungeon*")) | 3147 | (switch-to-buffer (get-buffer-create "*save-dungeon*")) |
| 3135 | (erase-buffer)) | 3148 | (erase-buffer)) |
| 3136 | 3149 | ||
| 3137 | (defun compile-save-out (filename) | 3150 | (defun dun-compile-save-out (filename) |
| 3138 | (let (ferror) | 3151 | (let (ferror) |
| 3139 | (setq ferror nil) | 3152 | (setq ferror nil) |
| 3140 | (condition-case nil | 3153 | (condition-case nil |
| @@ -3150,69 +3163,69 @@ File not found"))) | |||
| 3150 | ferror)) | 3163 | ferror)) |
| 3151 | 3164 | ||
| 3152 | 3165 | ||
| 3153 | (defun save-val (varname) | 3166 | (defun dun-save-val (varname) |
| 3154 | (let (value) | 3167 | (let (value) |
| 3155 | (setq varname (intern varname)) | 3168 | (setq varname (intern varname)) |
| 3156 | (setq value (eval varname)) | 3169 | (setq value (eval varname)) |
| 3157 | (minsert "(setq ") | 3170 | (dun-minsert "(setq ") |
| 3158 | (minsert varname) | 3171 | (dun-minsert varname) |
| 3159 | (minsert " ") | 3172 | (dun-minsert " ") |
| 3160 | (if (or (listp value) | 3173 | (if (or (listp value) |
| 3161 | (symbolp value)) | 3174 | (symbolp value)) |
| 3162 | (minsert "'")) | 3175 | (dun-minsert "'")) |
| 3163 | (if (stringp value) | 3176 | (if (stringp value) |
| 3164 | (minsert "\"")) | 3177 | (dun-minsert "\"")) |
| 3165 | (minsert value) | 3178 | (dun-minsert value) |
| 3166 | (if (stringp value) | 3179 | (if (stringp value) |
| 3167 | (minsert "\"")) | 3180 | (dun-minsert "\"")) |
| 3168 | (minsertl ")"))) | 3181 | (dun-minsertl ")"))) |
| 3169 | 3182 | ||
| 3170 | 3183 | ||
| 3171 | (defun restore (args) | 3184 | (defun dun-restore (args) |
| 3172 | (let (file) | 3185 | (let (file) |
| 3173 | (if (not (setq file (car args))) | 3186 | (if (not (setq file (car args))) |
| 3174 | (mprincl "You must supply a filename.") | 3187 | (dun-mprincl "You must supply a filename.") |
| 3175 | (if (not (load-d file)) | 3188 | (if (not (dun-load-d file)) |
| 3176 | (mprincl "Could not load restore file.") | 3189 | (dun-mprincl "Could not load restore file.") |
| 3177 | (mprincl "Done.") | 3190 | (dun-mprincl "Done.") |
| 3178 | (setq room 0))))) | 3191 | (setq room 0))))) |
| 3179 | 3192 | ||
| 3180 | 3193 | ||
| 3181 | (defun do-logfile (type how) | 3194 | (defun dun-do-logfile (type how) |
| 3182 | (let (ferror newscore) | 3195 | (let (ferror newscore) |
| 3183 | (setq ferror nil) | 3196 | (setq ferror nil) |
| 3184 | (switch-to-buffer (get-buffer-create "*score*")) | 3197 | (switch-to-buffer (get-buffer-create "*score*")) |
| 3185 | (erase-buffer) | 3198 | (erase-buffer) |
| 3186 | (condition-case nil | 3199 | (condition-case nil |
| 3187 | (insert-file-contents log-file) | 3200 | (insert-file-contents dun-log-file) |
| 3188 | (error (setq ferror t))) | 3201 | (error (setq ferror t))) |
| 3189 | (unless ferror | 3202 | (unless ferror |
| 3190 | (goto-char (point-max)) | 3203 | (goto-char (point-max)) |
| 3191 | (minsert (current-time-string)) | 3204 | (dun-minsert (current-time-string)) |
| 3192 | (minsert " ") | 3205 | (dun-minsert " ") |
| 3193 | (minsert (user-login-name)) | 3206 | (dun-minsert (user-login-name)) |
| 3194 | (minsert " ") | 3207 | (dun-minsert " ") |
| 3195 | (if (eq type 'save) | 3208 | (if (eq type 'save) |
| 3196 | (minsert "saved ") | 3209 | (dun-minsert "saved ") |
| 3197 | (if (= (endgame-score) 110) | 3210 | (if (= (dun-endgame-score) 110) |
| 3198 | (minsert "won ") | 3211 | (dun-minsert "won ") |
| 3199 | (if (not how) | 3212 | (if (not how) |
| 3200 | (minsert "quit ") | 3213 | (dun-minsert "quit ") |
| 3201 | (minsert "killed by ") | 3214 | (dun-minsert "killed by ") |
| 3202 | (minsert how) | 3215 | (dun-minsert how) |
| 3203 | (minsert " ")))) | 3216 | (dun-minsert " ")))) |
| 3204 | (minsert "at ") | 3217 | (dun-minsert "at ") |
| 3205 | (minsert (cadr (nth (abs room) rooms))) | 3218 | (dun-minsert (cadr (nth (abs room) dun-rooms))) |
| 3206 | (minsert ". score: ") | 3219 | (dun-minsert ". score: ") |
| 3207 | (if (> (endgame-score) 0) | 3220 | (if (> (dun-endgame-score) 0) |
| 3208 | (minsert (setq newscore (+ 90 (endgame-score)))) | 3221 | (dun-minsert (setq newscore (+ 90 (dun-endgame-score)))) |
| 3209 | (minsert (setq newscore (reg-score)))) | 3222 | (dun-minsert (setq newscore (dun-reg-score)))) |
| 3210 | (minsert " saves: ") | 3223 | (dun-minsert " saves: ") |
| 3211 | (minsert numsaves) | 3224 | (dun-minsert dun-numsaves) |
| 3212 | (minsert " commands: ") | 3225 | (dun-minsert " commands: ") |
| 3213 | (minsert numcmds) | 3226 | (dun-minsert dun-numcmds) |
| 3214 | (minsert "\n") | 3227 | (dun-minsert "\n") |
| 3215 | (write-region 1 (point-max) log-file nil 1)) | 3228 | (write-region 1 (point-max) dun-log-file nil 1)) |
| 3216 | (kill-buffer (current-buffer)))) | 3229 | (kill-buffer (current-buffer)))) |
| 3217 | 3230 | ||
| 3218 | 3231 | ||
| @@ -3221,13 +3234,13 @@ File not found"))) | |||
| 3221 | ;;;; be run in batch mode. | 3234 | ;;;; be run in batch mode. |
| 3222 | 3235 | ||
| 3223 | 3236 | ||
| 3224 | (defun batch-mprinc (arg) | 3237 | (defun dun-batch-mprinc (arg) |
| 3225 | (if (stringp arg) | 3238 | (if (stringp arg) |
| 3226 | (send-string-to-terminal arg) | 3239 | (send-string-to-terminal arg) |
| 3227 | (send-string-to-terminal (prin1-to-string arg)))) | 3240 | (send-string-to-terminal (prin1-to-string arg)))) |
| 3228 | 3241 | ||
| 3229 | 3242 | ||
| 3230 | (defun batch-mprincl (arg) | 3243 | (defun dun-batch-mprincl (arg) |
| 3231 | (if (stringp arg) | 3244 | (if (stringp arg) |
| 3232 | (progn | 3245 | (progn |
| 3233 | (send-string-to-terminal arg) | 3246 | (send-string-to-terminal arg) |
| @@ -3235,82 +3248,81 @@ File not found"))) | |||
| 3235 | (send-string-to-terminal (prin1-to-string arg)) | 3248 | (send-string-to-terminal (prin1-to-string arg)) |
| 3236 | (send-string-to-terminal "\n"))) | 3249 | (send-string-to-terminal "\n"))) |
| 3237 | 3250 | ||
| 3238 | (defun batch-parse (ignore verblist line) | 3251 | (defun dun-batch-parse (dun-ignore dun-verblist line) |
| 3239 | (setq line-list (listify-string (concat line " "))) | 3252 | (setq line-list (dun-listify-string (concat line " "))) |
| 3240 | (doverb ignore verblist (car line-list) (cdr line-list))) | 3253 | (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list))) |
| 3241 | 3254 | ||
| 3242 | (defun batch-parse2 (ignore verblist line) | 3255 | (defun dun-batch-parse2 (dun-ignore dun-verblist line) |
| 3243 | (setq line-list (listify-string2 (concat line " "))) | 3256 | (setq line-list (dun-listify-string2 (concat line " "))) |
| 3244 | (doverb ignore verblist (car line-list) (cdr line-list))) | 3257 | (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list))) |
| 3245 | 3258 | ||
| 3246 | (defun batch-read-line () | 3259 | (defun dun-batch-read-line () |
| 3247 | (read-from-minibuffer "" nil dungeon-batch-map)) | 3260 | (read-from-minibuffer "" nil dungeon-batch-map)) |
| 3248 | 3261 | ||
| 3249 | 3262 | ||
| 3250 | (defun dungeon-batch-loop () | 3263 | (defun dun-batch-loop () |
| 3251 | (setq dead nil) | 3264 | (setq dun-dead nil) |
| 3252 | (setq room 0) | 3265 | (setq room 0) |
| 3253 | (while (not dead) | 3266 | (while (not dun-dead) |
| 3254 | (if (eq dungeon-mode 'dungeon) | 3267 | (if (eq dungeon-mode 'dungeon) |
| 3255 | (progn | 3268 | (progn |
| 3256 | (if (not (= room current-room)) | 3269 | (if (not (= room dun-current-room)) |
| 3257 | (progn | 3270 | (progn |
| 3258 | (describe-room current-room) | 3271 | (dun-describe-room dun-current-room) |
| 3259 | (setq room current-room))) | 3272 | (setq room dun-current-room))) |
| 3260 | (mprinc ">") | 3273 | (dun-mprinc ">") |
| 3261 | (setq line (downcase (read-line))) | 3274 | (setq line (downcase (dun-read-line))) |
| 3262 | (if (eq (parse ignore verblist line) -1) | 3275 | (if (eq (dun-vparse dun-ignore dun-verblist line) -1) |
| 3263 | (mprinc "I don't understand that.\n")))))) | 3276 | (dun-mprinc "I don't understand that.\n")))))) |
| 3264 | 3277 | ||
| 3265 | (defun batch-dos-interface () | 3278 | (defun dun-batch-dos-interface () |
| 3266 | (dos-boot-msg) | 3279 | (dun-dos-boot-msg) |
| 3267 | (setq dungeon-mode 'dos) | 3280 | (setq dungeon-mode 'dos) |
| 3268 | (while (eq dungeon-mode 'dos) | 3281 | (while (eq dungeon-mode 'dos) |
| 3269 | (dos-prompt) | 3282 | (dun-dos-prompt) |
| 3270 | (setq line (downcase (read-line))) | 3283 | (setq line (downcase (dun-read-line))) |
| 3271 | (if (eq (parse2 nil dos-verbs line) -1) | 3284 | (if (eq (dun-parse2 nil dun-dos-verbs line) -1) |
| 3272 | (progn | 3285 | (progn |
| 3273 | (sleep-for 1) | 3286 | (sleep-for 1) |
| 3274 | (mprincl "Bad command or file name")))) | 3287 | (dun-mprincl "Bad command or file name")))) |
| 3275 | (goto-char (point-max)) | 3288 | (goto-char (point-max)) |
| 3276 | (mprinc "\n")) | 3289 | (dun-mprinc "\n")) |
| 3277 | 3290 | ||
| 3278 | (defun batch-unix-interface () | 3291 | (defun dun-batch-unix-interface () |
| 3279 | (login) | 3292 | (dun-login) |
| 3280 | (if logged-in | 3293 | (if dun-logged-in |
| 3281 | (progn | 3294 | (progn |
| 3282 | (setq dungeon-mode 'unix) | 3295 | (setq dungeon-mode 'unix) |
| 3283 | (while (eq dungeon-mode 'unix) | 3296 | (while (eq dungeon-mode 'unix) |
| 3284 | (mprinc "$ ") | 3297 | (dun-mprinc "$ ") |
| 3285 | (setq line (downcase (read-line))) | 3298 | (setq line (downcase (dun-read-line))) |
| 3286 | (if (eq (parse2 nil unix-verbs line) -1) | 3299 | (if (eq (dun-parse2 nil dun-unix-verbs line) -1) |
| 3287 | (let (esign) | 3300 | (let (esign) |
| 3288 | (if (setq esign (string-match "=" line)) | 3301 | (if (setq esign (string-match "=" line)) |
| 3289 | (doassign line esign) | 3302 | (dun-doassign line esign) |
| 3290 | (mprinc (car line-list)) | 3303 | (dun-mprinc (car line-list)) |
| 3291 | (mprincl ": not found."))))) | 3304 | (dun-mprincl ": not found."))))) |
| 3292 | (goto-char (point-max)) | 3305 | (goto-char (point-max)) |
| 3293 | (mprinc "\n")))) | 3306 | (dun-mprinc "\n")))) |
| 3294 | 3307 | ||
| 3295 | (defun dungeon-nil (arg) | 3308 | (defun dungeon-nil (arg) |
| 3296 | "noop" | 3309 | "noop" |
| 3297 | (interactive "*p")) | 3310 | (interactive "*p")) |
| 3298 | 3311 | ||
| 3299 | (defun batch-dungeon () | 3312 | (defun dun-batch-dungeon () |
| 3300 | (load "dun-batch") | 3313 | (load "dun-batch") |
| 3301 | (setq visited '(27)) | 3314 | (setq dun-visited '(27)) |
| 3302 | (mprinc "\n") | 3315 | (dun-mprinc "\n") |
| 3303 | (dungeon-batch-loop)) | 3316 | (dun-batch-loop)) |
| 3304 | 3317 | ||
| 3305 | (unless (not noninteractive) | 3318 | (unless (not noninteractive) |
| 3306 | (fset 'mprinc 'batch-mprinc) | 3319 | (fset 'dun-mprinc 'dun-batch-mprinc) |
| 3307 | (fset 'mprincl 'batch-mprincl) | 3320 | (fset 'dun-mprincl 'dun-batch-mprincl) |
| 3308 | (fset 'parse 'batch-parse) | 3321 | (fset 'dun-vparse 'dun-batch-parse) |
| 3309 | (fset 'parse2 'batch-parse2) | 3322 | (fset 'dun-parse2 'dun-batch-parse2) |
| 3310 | (fset 'read-line 'batch-read-line) | 3323 | (fset 'dun-read-line 'dun-batch-read-line) |
| 3311 | (fset 'dos-interface 'batch-dos-interface) | 3324 | (fset 'dun-dos-interface 'dun-batch-dos-interface) |
| 3312 | (fset 'unix-interface 'batch-unix-interface) | 3325 | (fset 'dun-unix-interface 'dun-batch-unix-interface) |
| 3313 | (mprinc "\n") | 3326 | (dun-mprinc "\n") |
| 3314 | (setq batch-mode t) | 3327 | (setq dun-batch-mode t) |
| 3315 | (dungeon-batch-loop)) | 3328 | (dun-batch-loop)) |
| 3316 | |||