[corman-sdl-cvs] CVS update: corman-sdl/engine/engine.lisp
Luke J Crook
lcrook at common-lisp.net
Tue Apr 20 09:28:13 UTC 2004
Update of /project/corman-sdl/cvsroot/corman-sdl/engine
In directory common-lisp.net:/tmp/cvs-serv25748/engine
Modified Files:
engine.lisp
Log Message:
Date: Tue Apr 20 05:28:13 2004
Author: lcrook
Index: corman-sdl/engine/engine.lisp
diff -u corman-sdl/engine/engine.lisp:1.4 corman-sdl/engine/engine.lisp:1.5
--- corman-sdl/engine/engine.lisp:1.4 Mon Apr 19 21:07:55 2004
+++ corman-sdl/engine/engine.lisp Tue Apr 20 05:28:13 2004
@@ -104,7 +104,15 @@
-(defvar objects nil)
+(let ((bitplanes nil))
+ (defun bitplanes ()
+ bitplanes)
+ (defun first-bitplane ()
+ (if (null (dl-prev bitplanes))
+ bitplanes
+ (setf bitplanes (dl-prev bitplanes))))
+ (defun set-bitplane (bitplane)
+ (setf bitplanes bitplane)))
(defclass sprite ()
(
@@ -140,11 +148,10 @@
(defun find-bitplane (zorder bitplanes)
(let ((bp bitplanes) (quit nil))
- (sdl:fformat "bp == ~A, zorder == ~A~%" bp zorder)
(loop
(when (equal quit t) (return (values bp 'n)))
(if (> zorder (get-zorder bp)) ; if test > current
- (when (null (dl-next bp))
+ (if (null (dl-next bp))
(setf quit t) ; end of list when next is null
(setf bp (dl-next bp))) ; next node
(if (equal zorder (get-zorder bp))
@@ -153,21 +160,23 @@
(defun return-bitplane (zorder bitplanes)
(when (null bitplanes)
- (setf objects (dl-list (new-bitplane zorder)))
- (setf bitplanes objects))
+ (set-bitplane (dl-list (new-bitplane zorder)))
+ (setf bitplanes (bitplanes)))
(multiple-value-bind (bitplane pos) (find-bitplane zorder bitplanes)
(cond
((equal pos 'c)
(values (dl-data bitplane)))
((equal pos 'p)
- (values (dl-data (dl-insert (new-bitplane zorder) bitplane))))
+ (setf bitplane (dl-insert (new-bitplane zorder) bitplane))
+ (first-bitplane)
+ (values (dl-data bitplane)))
((equal pos 'n)
(values (dl-data (dl-append (new-bitplane zorder) bitplane)))))))
(defun add-object (spr)
(addto-bitplane
- (return-bitplane (sprite-zorder spr) objects)
+ (return-bitplane (sprite-zorder spr) (bitplanes))
spr))
More information about the Corman-sdl-cvs
mailing list