;; ;;;;;;;;;;;;;;;; miscellaneous functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defsubst gamegrid-characterp (arg)
- (if (fboundp 'characterp)
- (characterp arg)
- (integerp arg)))
-
(defsubst gamegrid-event-x (event)
- (if (fboundp 'event-x)
- (event-x event)
- (car (posn-col-row (event-end event)))))
+ (car (posn-col-row (event-end event))))
(defsubst gamegrid-event-y (event)
- (if (fboundp 'event-y)
- (event-y event)
- (cdr (posn-col-row (event-end event)))))
+ (cdr (posn-col-row (event-end event))))
;; ;;;;;;;;;;;;; display functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun gamegrid-make-glyph (data-spec-list color-spec-list)
(let ((data (gamegrid-match-spec-list data-spec-list))
(color (gamegrid-match-spec-list color-spec-list)))
- (cond ((gamegrid-characterp data)
+ (cond ((characterp data)
(vector data))
((eq data 'colorize)
(gamegrid-colorize-glyph color))
(t
'emacs-tty)))
-(defun gamegrid-set-display-table ()
- (if (featurep 'xemacs)
- (add-spec-to-specifier current-display-table
- gamegrid-display-table
- (current-buffer)
- nil
- 'remove-locale)
- (setq buffer-display-table gamegrid-display-table)))
-
(declare-function image-size "image.c" (spec &optional pixels frame))
(defun gamegrid-setup-default-font ()
(aset gamegrid-face-table c face)
(aset gamegrid-display-table c glyph)))
(gamegrid-setup-default-font)
- (gamegrid-set-display-table)
+ (setq buffer-display-table gamegrid-display-table)
(setq cursor-type nil))
(defun gamegrid-start-timer (period func)
(setq gamegrid-timer
- (if (featurep 'xemacs)
- (start-itimer "Gamegrid"
- func
- period
- period
- nil
- t
- (current-buffer))
- (run-with-timer period
- period
- func
- (current-buffer)))))
+ (run-with-timer period period func (current-buffer))))
(defun gamegrid-set-timer (delay)
(if gamegrid-timer
- (if (fboundp 'set-itimer-restart)
- (set-itimer-restart gamegrid-timer delay)
- (timer-set-time gamegrid-timer
- (list (aref gamegrid-timer 1)
- (aref gamegrid-timer 2)
- (aref gamegrid-timer 3))
- delay))))
+ (timer-set-time gamegrid-timer
+ (list (aref gamegrid-timer 1)
+ (aref gamegrid-timer 2)
+ (aref gamegrid-timer 3))
+ delay)))
(defun gamegrid-kill-timer ()
(if gamegrid-timer
- (if (featurep 'xemacs)
- (delete-itimer gamegrid-timer)
- (cancel-timer gamegrid-timer)))
+ (cancel-timer gamegrid-timer))
(setq gamegrid-timer nil))
;; ;;;;;;;;;;;;;;; high score functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(errbuf (generate-new-buffer " *update-game-score loss*"))
(marker-string (concat
(user-full-name)
- " <"
- (cond ((fboundp 'user-mail-address)
- (user-mail-address))
- ((boundp 'user-mail-address)
- user-mail-address)
- (t ""))
- "> "
+ " <" user-mail-address "> "
(current-time-string))))
;; This can be called from a timer, so enable local quits.
(with-local-quit
score
(current-time-string)
(user-full-name)
- (cond ((fboundp 'user-mail-address)
- (user-mail-address))
- ((boundp 'user-mail-address)
- user-mail-address)
- (t ""))))
+ user-mail-address))
(sort-fields 1 (point-min) (point-max))
(reverse-region (point-min) (point-max))
(goto-char (point-min))