branch: elpa/pacmacs
commit e0856fc8819e312e4ec29a472604f49eebfffeb4
Author: rexim <[email protected]>
Commit: rexim <[email protected]>
Refactor wall tiles functions (#131):
- Rename create-wall-block to create-wall-tile
- Introduce wall-tile-at function
---
pacmacs-image.el | 12 ++++++------
pacmacs.el | 15 +++++++++------
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/pacmacs-image.el b/pacmacs-image.el
index 7a0749054d..8e444c8d11 100644
--- a/pacmacs-image.el
+++ b/pacmacs-image.el
@@ -80,13 +80,13 @@
(if bit 1 0))))
result))
-(defun pacmacs--create-wall-block (width
- height color
+(defun pacmacs--create-wall-tile (width
+ height color
- bottom right
- top left
- left-upper right-upper
- left-bottom right-bottom)
+ bottom right
+ top left
+ left-upper right-upper
+ left-bottom right-bottom)
(let ((cache-index
(pacmacs--bit-list-to-integer
(list bottom right top left
diff --git a/pacmacs.el b/pacmacs.el
index bf73ce8517..4075f944d5 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -510,6 +510,14 @@
(-sort #'string-lessp)
(apply #'vector)))
+(defun pacmacs--wall-tile-at (row column)
+ (apply #'pacmacs--create-wall-tile
+ 40 40 "#5555ff"
+ (-map (-lambda ((row . column))
+ (not (pacmacs--wall-at-p row column)))
+ (append (pacmacs--possible-side-ways row column)
+ (pacmacs--possible-diagonal-ways row column)))))
+
(defun pacmacs--load-map (map-name)
(let* ((lines (split-string (->> map-name
(format "./maps/%s.txt")
@@ -551,12 +559,7 @@
wall
(plist-put wall :current-animation
(pacmacs-make-anim (list (pacmacs-make-frame '(0 0 40 40)
100))
- (apply #'pacmacs--create-wall-block
- 40 40 "#5555ff"
- (-map (-lambda ((row . column))
- (not (pacmacs--wall-at-p
row column)))
- (append
(pacmacs--possible-side-ways row column)
-
(pacmacs--possible-diagonal-ways row column))))))))))
+ (pacmacs--wall-tile-at row column)))))))
(provide 'pacmacs)