[decomp] make use of the generated load boundary data (#984)

* make use of the generated load boundary data

* reverse load boundaries
This commit is contained in:
ManDude 2021-12-01 00:14:43 +00:00 committed by GitHub
parent 59d071eccb
commit 6a38597cbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 5274 additions and 8295 deletions

View file

@ -18110,7 +18110,7 @@
(define-extern copy-load-boundary! (function load-boundary load-boundary none)) (define-extern copy-load-boundary! (function load-boundary load-boundary none))
(define-extern lb-add-plane (function load-boundary)) (define-extern lb-add-plane (function load-boundary))
(define-extern lb-add (function load-boundary)) (define-extern lb-add (function load-boundary))
(define-extern save-boundary-cmd (function load-boundary-crossing-command string file-stream none)) (define-extern save-boundary-cmd (function load-boundary-crossing-command string object none))
(define-extern replace-load-boundary (function load-boundary load-boundary none)) (define-extern replace-load-boundary (function load-boundary load-boundary none))
(define-extern format-boundary-cmd (function load-boundary-crossing-command none)) (define-extern format-boundary-cmd (function load-boundary-crossing-command none))
(define-extern boundary-set-color (function lbvtx load-boundary-crossing-command none)) (define-extern boundary-set-color (function lbvtx load-boundary-crossing-command none))

View file

@ -1857,6 +1857,10 @@
["L304", "vector"] ["L304", "vector"]
], ],
"load-boundary-data": [
["L2", "(array array)"]
],
// please do not add things after this entry! git is dumb. // please do not add things after this entry! git is dumb.
"object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": []
} }

File diff suppressed because it is too large Load diff

View file

@ -504,6 +504,28 @@
;; the load-boundary-data.gc file can be re-generated after editing load boundaries. ;; the load-boundary-data.gc file can be re-generated after editing load boundaries.
(defmacro static-lb-list (&rest lbs)
`(new 'static 'boxed-array :type array :length ,(length lbs) :allocated-length ,(length lbs)
,@(reverse lbs)
)
)
(defmacro static-load-boundary (&key flags
&key top &key bot
&key points
&key (fwd (invalid #f #f))
&key (bwd (invalid #f #f)))
`(new 'static 'boxed-array :type object :length 4 :allocated-length 4
(the binteger (load-boundary-flags ,@flags))
(new 'static 'boxed-array :type float :length ,(+ 2 (length points)) :allocated-length ,(+ 2 (length points))
,top ,bot
,@points
)
'((the binteger (load-boundary-cmd ,(first fwd))) ,(second fwd) ,(third fwd))
'((the binteger (load-boundary-cmd ,(first bwd))) ,(second bwd) ,(third bwd))
)
)
(defun-debug format-boundary-cmd ((arg0 load-boundary-crossing-command)) (defun-debug format-boundary-cmd ((arg0 load-boundary-crossing-command))
(case (-> arg0 cmd) (case (-> arg0 cmd)
(((load-boundary-cmd load)) (((load-boundary-cmd load))
@ -883,7 +905,7 @@
(none) (none)
) )
(defun-debug save-boundary-cmd ((arg0 load-boundary-crossing-command) (arg1 string) (arg2 file-stream)) (defun-debug save-boundary-cmd ((arg0 load-boundary-crossing-command) (arg1 string) (arg2 object))
(case (-> arg0 cmd) (case (-> arg0 cmd)
(((load-boundary-cmd load)) (((load-boundary-cmd load))
(format arg2 " :~S (load ~A ~A)~%" arg1 (-> arg0 lev0) (-> arg0 lev1)) (format arg2 " :~S (load ~A ~A)~%" arg1 (-> arg0 lev0) (-> arg0 lev1))

View file

@ -332,6 +332,28 @@
,@body) ,@body)
) )
(defmacro doarray (bindings &rest body)
"iterate over an array. usage: (doarray (<array entry name> <array>) <code>)"
(with-gensyms (len i)
(let ((val (first bindings))
(arr (second bindings)))
`(let* ((,len (-> ,arr length))
(,i 0)
(,val (-> ,arr ,i)))
(while (< ,i ,len)
,@body
(1+! ,i)
(set! ,val (-> ,arr ,i))
)
)
)
)
)
;; Backup some values, and restore after executing body. ;; Backup some values, and restore after executing body.
;; Non-dynamic (nonlocal jumps out of body will skip restore) ;; Non-dynamic (nonlocal jumps out of body will skip restore)
;; NOTE : GOAL protected defs in a FIFO manner (this is FILO/LIFO), this should be fixed at some point ;; NOTE : GOAL protected defs in a FIFO manner (this is FILO/LIFO), this should be fixed at some point
@ -752,14 +774,14 @@
(with-gensyms (val str) (with-gensyms (val str)
`(let ((,val ,input) `(let ((,val ,input)
(,str ,stream)) (,str ,stream))
,@(apply (lambda (x) ,@(apply (lambda (x)
`(if (logtesta? ,val (,enum ,(car x))) `(if (logtesta? ,val (,enum ,(car x)))
(format ,str ,(fmt #f "{} " (car x))) (format ,str ,(fmt #f "{} " (car x)))
) )
) (reverse (get-enum-vals enum))) ) (reverse (get-enum-vals enum)))
) )
) )
) )

File diff suppressed because it is too large Load diff

View file

@ -999,7 +999,7 @@
;; INFO: Return type mismatch int vs none. ;; INFO: Return type mismatch int vs none.
(defun-debug (defun-debug
save-boundary-cmd save-boundary-cmd
((arg0 load-boundary-crossing-command) (arg1 string) (arg2 file-stream)) ((arg0 load-boundary-crossing-command) (arg1 string) (arg2 object))
(case (-> arg0 cmd) (case (-> arg0 cmd)
(((load-boundary-cmd load)) (((load-boundary-cmd load))
(format arg2 " :~S (load ~A ~A)~%" arg1 (-> arg0 lev0) (-> arg0 lev1)) (format arg2 " :~S (load ~A ~A)~%" arg1 (-> arg0 lev0) (-> arg0 lev1))
@ -2554,7 +2554,3 @@
;; definition (perm) for symbol *load-state*, type load-state ;; definition (perm) for symbol *load-state*, type load-state
(define-perm *load-state* load-state (new 'global 'load-state)) (define-perm *load-state* load-state (new 'global 'load-state))