• R/O
  • SSH

waddle: Commit

Common Lisp library for manipulating Doom and Quake WAD files and PAK files.


Commit MetaInfo

Revision87dd607c039b7d6ef80fc71d1590ea91fc57e8a0 (tree)
Time2019-12-29 10:35:49
AuthorAlexa Jones-Gonzales <alexa@part...>
CommiterAlexa Jones-Gonzales

Log Message

Added FIND-UNUSED-TEXTURES

Change Summary

Incremental Difference

diff -r df2da2c09b22 -r 87dd607c039b src/bsp.lisp
--- a/src/bsp.lisp Sat Dec 28 17:45:53 2019 -0700
+++ b/src/bsp.lisp Sat Dec 28 18:35:49 2019 -0700
@@ -316,3 +316,18 @@
316316
317317 (setf (bsp-model-face-id model) (p36:read-bytes-into-int source 4))
318318 (setf (bsp-model-origin model) (p36:read-bytes-into-int source 4))))
319+
320+(defmethod find-unused-textures ((bsp bsp-file) &rest ignores)
321+ (let ((unused (make-hash-table)))
322+ (loop for tdef across (bsp-entry-data (getf (slot-value bsp 'entries) :miptex))
323+ for tdef-num from 0
324+ do (setf (gethash tdef-num unused) (bsp-mip-texture-name tdef)))
325+
326+ (loop for tinfo across (bsp-entry-data (getf (slot-value bsp 'entries) :texture-info))
327+ do (when (gethash (bsp-surface-texture-id tinfo) unused)
328+ (remhash (bsp-surface-texture-id tinfo) unused)))
329+
330+ (loop for v being the hash-values in unused
331+ when (and (not (find v ignores :test #'string=))
332+ (not (equal (position #\+ v :test #'char=) 0)))
333+ collect v)))
Show on old repository browser