[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 9c69162781 247/472: Rough implementation of XPM wa
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 9c69162781 247/472: Rough implementation of XPM wall generation (#141) |
Date: |
Thu, 6 Jan 2022 21:59:28 -0500 (EST) |
branch: elpa/pacmacs
commit 9c69162781dd0338551608c912728deb70e2832e
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Rough implementation of XPM wall generation (#141)
---
tools/generate-wall-tiles.el | 95 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
diff --git a/tools/generate-wall-tiles.el b/tools/generate-wall-tiles.el
new file mode 100644
index 0000000000..68a514821d
--- /dev/null
+++ b/tools/generate-wall-tiles.el
@@ -0,0 +1,95 @@
+(defun pacmacs--put-bits-dot (bits row column weight)
+ (dotimes (i weight)
+ (dotimes (j weight)
+ (aset (aref bits (+ i row)) (+ j column) t))))
+
+(defun pacmacs--put-vertical-bar (bits column height weight)
+ (dotimes (w weight)
+ (dotimes (i height)
+ (aset (aref bits i) (+ column w) t))))
+
+(defun pacmacs--put-horizontal-bar (bits row width weight)
+ (dotimes (w weight)
+ (dotimes (i width)
+ (aset (aref bits (+ row w)) i t))))
+
+(defun pacmacs--bit-list-to-integer (bit-list)
+ (let ((result 0))
+ (dolist (bit bit-list)
+ (setq result (logior (lsh result 1)
+ (if bit 1 0))))
+ result))
+
+(defun pacmacs--integer-to-bit-list (x)
+ (let ((result nil))
+ (dotimes (i 8)
+ (ignore i)
+ (setq result (cons (logand x 1) result))
+ (setq x (lsh x -1)))
+ result))
+
+(defun pacmacs--normalize-wall-bits (wall-bits)
+ (-let (((bottom right top left
+ left-upper right-upper
+ left-bottom right-bottom)
+ wall-bits))
+ (list bottom right top left
+ (if (and left-upper
+ (not left)
+ (not top)) 0 1)
+ (if (and right-upper
+ (not right)
+ (not top)) 0 1)
+ (if (and left-bottom
+ (not left)
+ (not bottom)) 0 1)
+ (if (and right-bottom
+ (not right)
+ (not bottom)) 0 1))))
+
+(defun pacmacs--generate-xpm (wall-block)
+ )
+
+(defun pacmacs--create-wall-tile (width height weight
+ bottom right
+ top left
+ left-upper right-upper
+ left-bottom right-bottom)
+ (let ((wall-block (make-vector width nil)))
+ (dotimes (i width)
+ (aset wall-block i (make-vector height nil)))
+
+ (when left-upper
+ (pacmacs--put-bits-dot wall-block 0 0 weight))
+
+ (when right-upper
+ (pacmacs--put-bits-dot wall-block 0 (- width weight) weight))
+
+ (when left-bottom
+ (pacmacs--put-bits-dot wall-block (- height weight) 0 weight))
+
+ (when right-bottom
+ (pacmacs--put-bits-dot wall-block (- height weight) (- width weight)
weight))
+
+ (when left
+ (pacmacs--put-vertical-bar wall-block 0 height weight))
+
+ (when right
+ (pacmacs--put-vertical-bar wall-block (- width weight) height weight))
+
+ (when top
+ (pacmacs--put-horizontal-bar wall-block 0 width weight))
+
+ (when bottom
+ (pacmacs--put-horizontal-bar wall-block (- height weight) width weight))
+
+ wall-block))
+
+(pp
+ (->> (number-sequence 0 255)
+ (-map #'pacmacs--integer-to-bit-list)
+ (-map #'pacmacs--normalize-wall-bits)
+ (-group-by #'identity)
+ (-map #'car)
+ (-map (-partial #'-map (-compose #'not #'zerop)))
+ (-map (-partial #'apply #'pacmacs--create-wall-tile 40 40 3))))
- [nongnu] elpa/pacmacs 1186dcdaa1 197/472: Double dash pacmacs-render-state function (#126), (continued)
- [nongnu] elpa/pacmacs 1186dcdaa1 197/472: Double dash pacmacs-render-state function (#126), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 57b0e8566b 204/472: Get pacmacs-quit back, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 531386d7f1 208/472: Merge pull request #128 from rexim/readme-fix, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 775a2d3ec5 211/472: Convert recorder module to a tool (#115), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a0d9c1bbbc 212/472: Reverse test case before saving (#115), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d5bdd0b20a 025/472: Slightly refactored pacman-anim:, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 16b0d6583a 153/472: Get rid of the hardcoded level list. Close #109, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 68f6dc9a93 167/472: Update MELPA repo link, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs fe837b20fa 184/472: Implement victory animation for ghosts. Close #89, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 09ad044887 232/472: Better color for walls (#131), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9c69162781 247/472: Rough implementation of XPM wall generation (#141),
ELPA Syncer <=
- [nongnu] elpa/pacmacs 4a94a72dd4 250/472: Remove generate-wall-tiles script tool (#141), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs eab5b98b05 254/472: Add average-tick-time function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4bd94d2058 255/472: Merge branch 'master' into big-pills-81, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b97248f316 258/472: Put regular and big pills to same list (#81), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 2473e65744 268/472: Remove dead left overs of #141, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 22355a4954 276/472: Add Terrified Ghost animation. Close #83, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 97973dd305 288/472: Rough implementaion of escaping for TGs (#153), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 3758d601d3 304/472: Fix blinking terrified ghost animation, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 27c7ba7bbb 314/472: Update README about minimal version of Emacs (#165), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d6b63ef5b9 317/472: Merge pull request #166 from codingteam/drop-emacs-24.3-165, ELPA Syncer, 2022/01/06