mirror of
https://github.com/open-goal/jak-project
synced 2026-08-08 18:44:15 -04:00
simplify with-dma-buffer-add-bucket
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
(set! (-> pt w) 1.0)
|
||||
(when (transform-point-qword! (-> s5-0 vector 0) pt)
|
||||
|
||||
(with-dma-buffer-add-bucket ((v1-7 (current-display-frame debug-buf)) (current-display-frame bucket-group) bucket)
|
||||
(with-dma-buffer-add-bucket ((v1-7 (current-display-frame debug-buf)) bucket)
|
||||
|
||||
(with-cnt-vif-block (v1-7)
|
||||
(dma-buffer-add-gif-tag v1-7
|
||||
@@ -147,7 +147,7 @@
|
||||
(when (and (transform-point-qword! (-> s4-0 vector 0) p0)
|
||||
(transform-point-qword! (-> s4-0 vector 1) p1)
|
||||
)
|
||||
(with-dma-buffer-add-bucket ((v1-28 (current-display-frame debug-buf)) (current-display-frame bucket-group) bucket)
|
||||
(with-dma-buffer-add-bucket ((v1-28 (current-display-frame debug-buf)) bucket)
|
||||
(with-cnt-vif-block (v1-28)
|
||||
(dma-buffer-add-gif-tag v1-28 (new 'static 'gif-tag64 :nloop 1 :eop 1 :pre 1 :nreg 4
|
||||
:prim (gif-prim line))
|
||||
@@ -205,7 +205,7 @@
|
||||
(set! (-> s2-0 quad) (the-as uint128 0))
|
||||
(when (transform-point-qword! (the-as vector4w s2-0) location)
|
||||
|
||||
(with-dma-buffer-add-bucket ((s3-0 (current-display-frame debug-buf)) (current-display-frame bucket-group) bucket)
|
||||
(with-dma-buffer-add-bucket ((s3-0 (current-display-frame debug-buf)) bucket)
|
||||
|
||||
(let ((a2-2 (new 'stack 'font-context *font-default-matrix*
|
||||
(+ (+ (-> offset x) -1792) (/ (-> s2-0 x) 16))
|
||||
@@ -268,7 +268,7 @@
|
||||
(transform-point-qword! (-> s5-0 vector 1) p1)
|
||||
(transform-point-qword! (-> s5-0 vector 2) p2)
|
||||
)
|
||||
(with-dma-buffer-add-bucket ((v1-9 (current-display-frame debug-buf)) (current-display-frame bucket-group) bucket)
|
||||
(with-dma-buffer-add-bucket ((v1-9 (current-display-frame debug-buf)) bucket)
|
||||
|
||||
(with-cnt-vif-block (v1-9)
|
||||
(dma-buffer-add-gif-tag v1-9 (new 'static 'gif-tag64 :nloop 1 :eop 1 :pre 1 :nreg 6 :prim (gif-prim tri))
|
||||
@@ -448,7 +448,7 @@
|
||||
(if (not arg0)
|
||||
(return #f)
|
||||
)
|
||||
(with-dma-buffer-add-bucket ((s4-0 (current-display-frame debug-buf)) (current-display-frame bucket-group) arg1)
|
||||
(with-dma-buffer-add-bucket ((s4-0 (current-display-frame debug-buf)) arg1)
|
||||
|
||||
(let ((s2-0 (new 'stack 'vector4w))
|
||||
(v1-7 (new 'stack 'vector4w))
|
||||
@@ -836,7 +836,7 @@
|
||||
(if (not arg0)
|
||||
(return #f)
|
||||
)
|
||||
(with-dma-buffer-add-bucket ((s0-0 (current-display-frame debug-buf)) (current-display-frame bucket-group) arg1)
|
||||
(with-dma-buffer-add-bucket ((s0-0 (current-display-frame debug-buf)) arg1)
|
||||
(draw-sprite2d-xy s0-0 arg2 arg3 255 14 (new 'static 'rgba :a #x40))
|
||||
(draw-sprite2d-xy s0-0 arg2 (+ arg3 2) (the int (* 255.0 arg4)) 10 arg5)
|
||||
)
|
||||
|
||||
@@ -623,7 +623,6 @@
|
||||
(else (font-color dim-gray))
|
||||
))
|
||||
(with-dma-buffer-add-bucket ((s3-0 (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string-adv (-> arg0 name) s3-0 s5-0)
|
||||
(draw-string-adv "..." s3-0 s5-0)
|
||||
@@ -653,7 +652,6 @@
|
||||
)
|
||||
)
|
||||
(with-dma-buffer-add-bucket ((s4-0 (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string (-> arg0 name) s4-0 v1-2)
|
||||
)
|
||||
@@ -683,7 +681,6 @@
|
||||
)
|
||||
)
|
||||
(with-dma-buffer-add-bucket ((s4-0 (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string (-> arg0 name) s4-0 v1-2)
|
||||
)
|
||||
@@ -710,7 +707,6 @@
|
||||
)
|
||||
)
|
||||
(with-dma-buffer-add-bucket ((s1-0 (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string-adv (-> arg0 name) s1-0 s5-0)
|
||||
(draw-string-adv ":" s1-0 s5-0)
|
||||
@@ -784,7 +780,6 @@
|
||||
)
|
||||
)
|
||||
(with-dma-buffer-add-bucket ((s0-0 (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-sprite2d-xy s0-0 arg1 arg2 (-> arg0 pix-width) (-> arg0 pix-height) (static-rgba #x00 #x00 #x00 #x40))
|
||||
)
|
||||
@@ -802,7 +797,6 @@
|
||||
)
|
||||
(set-origin! (-> arg0 context font) s3-1 s2-1)
|
||||
(with-dma-buffer-add-bucket ((sv-16 (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string ">" sv-16 (-> arg0 context font))
|
||||
)
|
||||
|
||||
@@ -423,12 +423,13 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro with-dma-buffer-add-bucket (bindings &rest body)
|
||||
(defmacro with-dma-buffer-add-bucket (bindings &key (bucket-group (current-display-frame bucket-group)) &rest body)
|
||||
"Bind a dma-buffer to a variable and use it on a block to allow adding things to a new bucket.
|
||||
usage: (with-dma-buffer-add-bucket ((buffer-name buffer) bucket bucket-id) &rest body "
|
||||
usage: (with-dma-buffer-add-bucket ((buffer-name buffer) bucket-id) &rest body
|
||||
example: (with-dma-buffer-add-bucket ((buf (current-display-frame debug-buf)) (bucket-id debug-draw1)) ...)"
|
||||
|
||||
`(let (,(car bindings))
|
||||
(with-dma-bucket (,(caar bindings) ,(second bindings) ,(third bindings))
|
||||
`(let ((,(caar bindings) ,(cadar bindings)))
|
||||
(with-dma-bucket (,(caar bindings) ,bucket-group ,(cadr bindings))
|
||||
,@body
|
||||
)
|
||||
)
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
(defun letterbox ()
|
||||
"Draw the letterbox black rectangles"
|
||||
(with-dma-buffer-add-bucket ((dma-buf (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1)) ;; debug-draw1 is one of the last buckets
|
||||
;; draw the two sprites
|
||||
(draw-sprite2d-xy dma-buf 0 0 512 25 (new 'static 'rgba :a #x80))
|
||||
@@ -46,7 +45,6 @@
|
||||
(defun blackout ()
|
||||
"Draw the blackout rectangle, convering the entire screen in darkness."
|
||||
(with-dma-buffer-add-bucket ((dma-buf (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1)) ;; debug-draw1 is one of the last buckets
|
||||
(draw-sprite2d-xy dma-buf 0 0 512 224 (new 'static 'rgba :a #x80))
|
||||
)
|
||||
@@ -854,7 +852,6 @@
|
||||
(current-display-frame debug-buf)
|
||||
(current-display-frame global-buf)
|
||||
))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw0))
|
||||
(show-iop-memory dma-buff)
|
||||
)
|
||||
|
||||
@@ -33,9 +33,7 @@
|
||||
(let ((s1-0 (-> *generic-foreground-sinks* s4-0)))
|
||||
(when s1-0
|
||||
(let ((s3-0 (-> s1-0 bucket)))
|
||||
(with-dma-buffer-add-bucket ((s0-0 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
s3-0)
|
||||
(with-dma-buffer-add-bucket ((s0-0 (current-display-frame global-buf)) s3-0)
|
||||
(if (>= s4-0 7)
|
||||
(generic-init-buf s0-0 1 s5-0)
|
||||
(generic-init-buf s0-0 1 gp-0)
|
||||
|
||||
@@ -820,9 +820,7 @@
|
||||
;; start of our DMA for all the sprite data
|
||||
(let ((dma-mem-begin (current-display-frame global-buf base)))
|
||||
;; draw in global-buf
|
||||
(with-dma-buffer-add-bucket ((dma-buff (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id sprite))
|
||||
(with-dma-buffer-add-bucket ((dma-buff (current-display-frame global-buf)) (bucket-id sprite))
|
||||
|
||||
;; run the distorters
|
||||
(sprite-init-distorter dma-buff (-> disp frames (-> disp on-screen) draw frame1 fbp))
|
||||
|
||||
@@ -801,7 +801,6 @@
|
||||
)
|
||||
(let ((total-upload-size 0))
|
||||
(with-dma-buffer-add-bucket ((dma-buf (current-display-frame global-buf)) ;; the global DMA buffer
|
||||
(current-display-frame bucket-group)
|
||||
bucket-idx)
|
||||
|
||||
;; default to segment 0 only (mode 0)
|
||||
@@ -986,7 +985,6 @@
|
||||
)
|
||||
(let ((total-upload-size 0))
|
||||
(with-dma-buffer-add-bucket ((dma-buf (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
bucket-idx)
|
||||
|
||||
(set! tex-data (-> page segment 0 block-data)) ;; data in RAM
|
||||
@@ -1600,7 +1598,6 @@
|
||||
;; use bucket numbers for the 0th level
|
||||
;; TFRAG
|
||||
(with-dma-buffer-add-bucket ((v1-4 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id tfrag-tex0))
|
||||
|
||||
(dma-buffer-add-cnt-vif2 v1-4 0 (new 'static 'vif-tag :cmd (vif-cmd nop))
|
||||
@@ -1610,7 +1607,6 @@
|
||||
;; the rest are the same
|
||||
;; PRIS
|
||||
(with-dma-buffer-add-bucket ((v1-12 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id pris-tex0))
|
||||
|
||||
(dma-buffer-add-cnt-vif2 v1-12 0 (new 'static 'vif-tag :cmd (vif-cmd nop))
|
||||
@@ -1619,7 +1615,6 @@
|
||||
)
|
||||
;; SHRUB
|
||||
(with-dma-buffer-add-bucket ((v1-20 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id shrub-tex0))
|
||||
|
||||
(dma-buffer-add-cnt-vif2 v1-20 0 (new 'static 'vif-tag :cmd (vif-cmd nop))
|
||||
@@ -1628,7 +1623,6 @@
|
||||
)
|
||||
;; ALPHA
|
||||
(with-dma-buffer-add-bucket ((v1-28 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id alpha-tex0))
|
||||
|
||||
(dma-buffer-add-cnt-vif2 v1-28 0 (new 'static 'vif-tag :cmd (vif-cmd nop))
|
||||
@@ -1639,7 +1633,6 @@
|
||||
(else
|
||||
;; TFRAG
|
||||
(with-dma-buffer-add-bucket ((v1-36 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id tfrag-tex1))
|
||||
|
||||
(dma-buffer-add-cnt-vif2 v1-36 0 (new 'static 'vif-tag :cmd (vif-cmd nop))
|
||||
@@ -1648,7 +1641,6 @@
|
||||
)
|
||||
;; PRIS
|
||||
(with-dma-buffer-add-bucket ((v1-44 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id pris-tex1))
|
||||
|
||||
(dma-buffer-add-cnt-vif2 v1-44 0 (new 'static 'vif-tag :cmd (vif-cmd nop))
|
||||
@@ -1657,7 +1649,6 @@
|
||||
)
|
||||
;; SHRUB
|
||||
(with-dma-buffer-add-bucket ((v1-52 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id shrub-tex1))
|
||||
|
||||
(dma-buffer-add-cnt-vif2 v1-52 0 (new 'static 'vif-tag :cmd (vif-cmd nop))
|
||||
@@ -1666,7 +1657,6 @@
|
||||
)
|
||||
;; ALPHA
|
||||
(with-dma-buffer-add-bucket ((v1-60 (current-display-frame global-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id alpha-tex1))
|
||||
|
||||
(dma-buffer-add-cnt-vif2 v1-60 0 (new 'static 'vif-tag :cmd (vif-cmd nop))
|
||||
|
||||
@@ -65,6 +65,12 @@
|
||||
(defsmacro cdddr (x)
|
||||
`(cdr (cdr (cdr ,x))))
|
||||
|
||||
(defsmacro caadr (x)
|
||||
`(car (car (cdr ,x))))
|
||||
|
||||
(defsmacro cadar (x)
|
||||
`(car (cdr (car ,x))))
|
||||
|
||||
(desfun first (x)
|
||||
(car x))
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@
|
||||
(set-state-time)
|
||||
(until (time-passed? PC_PAD_INPUT_NOTICE_TIME)
|
||||
(with-dma-buffer-add-bucket ((buf (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string-xy (string-format "MAPPED ~D TO ~S!"
|
||||
(pc-pad-input-key-get) (-> *pc-pad-button-names* (1- (-> self input-index))))
|
||||
@@ -138,7 +137,6 @@
|
||||
(set-state-time)
|
||||
(until (time-passed? PC_PAD_INPUT_NOTICE_TIME)
|
||||
(with-dma-buffer-add-bucket ((buf (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string-xy "CANCELED!" buf 256 96 (font-color red-reverse) (font-flags shadow kerning large middle))
|
||||
)
|
||||
@@ -155,7 +153,6 @@
|
||||
(set-state-time)
|
||||
(until (time-passed? PC_PAD_INPUT_NOTICE_TIME)
|
||||
(with-dma-buffer-add-bucket ((buf (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string-xy (string-format "MAPPED ~D TO ~S!"
|
||||
(pc-pad-input-key-get) (-> *pc-pad-button-names* (1- (-> self input-index))))
|
||||
@@ -166,7 +163,6 @@
|
||||
(set-state-time)
|
||||
(until (time-passed? PC_PAD_INPUT_NOTICE_TIME)
|
||||
(with-dma-buffer-add-bucket ((buf (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(draw-string-xy "KEY MAPPING COMPLETE!" buf 256 96 (font-color green) (font-flags shadow kerning large middle))
|
||||
)
|
||||
@@ -181,7 +177,6 @@
|
||||
(set-state-time)
|
||||
(loop
|
||||
(with-dma-buffer-add-bucket ((buf (current-display-frame debug-buf))
|
||||
(current-display-frame bucket-group)
|
||||
(bucket-id debug-draw1))
|
||||
(if (< (mod (time-passed) (seconds 2)) (seconds 1))
|
||||
(draw-string-xy "NOW MAPPING PAD" buf 256 32 (font-color red) (font-flags shadow kerning large middle))
|
||||
|
||||
Reference in New Issue
Block a user