]> git.jsancho.org Git - gacela.git/commitdiff
(no commit message)
authorjsancho <devnull@localhost>
Wed, 15 Jun 2011 16:57:44 +0000 (16:57 +0000)
committerjsancho <devnull@localhost>
Wed, 15 Jun 2011 16:57:44 +0000 (16:57 +0000)
src/gacela_mobs.scm

index 555ce0f185add81cf7b76d0a967271e1e536337c..6b9d6997f42e402576435c6aaaf5f494d6639aa6 100755 (executable)
        (lambda-mob ,attr ,@look))))
 
 (define-macro (lambda-mob attr . look)
-  (let ((look-code (map (lambda (x) (if (string? x) `(draw-texture ,x) x)) look)))
-    `(let ((attr ',attr))
-       (lambda (option)
-        (case option
-          ((#:render)
-           (glPushMatrix)
-           ,@look-code
+  (define (process-look look)
+    (cond ((null? look) (values '() '()))
+         (else
+          (let ((line (car look)))
+            (receive (lines images) (process-look (cdr look))
+                     (cond ((string? line)
+                            (cons `(draw-texture ,line) lines)
+                            (cons line images))
+                           (else
+                            (cons line lines)))
+                     (values lines images))))))
+
+  (receive (look-lines look-images) (process-look look)
+          `(let ((attr ',attr))
+             (lambda (option)
+               (case option
+                 ((#:render)
+                  (glPushMatrix)
+                  ,@look-lines
 ;          ,@(map (lambda (x) (if (string? x) `(draw-texture ,x) x)) look)
-           (glPopMatrix)))))))
+                  (glPopMatrix)))))))