mirror of
https://github.com/open-goal/jak-project
synced 2026-05-24 07:11:15 -04:00
637990314b
Closes #736 --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
889 lines
34 KiB
Common Lisp
Vendored
Generated
889 lines
34 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for method 17 of type bigmap
|
|
(defmethod set-pos! ((this bigmap) (arg0 vector))
|
|
(rlet ((vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf2 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(.lvf vf1 (&-> arg0 quad))
|
|
(.lvf vf2 (&-> this offset quad))
|
|
(.add.z.vf.y vf1 vf0 vf1)
|
|
(.sub.vf vf1 vf1 vf2)
|
|
(.mul.w.vf vf1 vf1 vf2)
|
|
(.ftoi.vf vf1 vf1)
|
|
(.svf (&-> this pos quad) vf1)
|
|
0
|
|
)
|
|
)
|
|
|
|
;; definition for method 18 of type bigmap
|
|
;; INFO: Used lq/sq
|
|
(defmethod decompress-current-masks! ((this bigmap))
|
|
(let ((compressed-mask-data (-> this compressed-masks (-> this mask-index))))
|
|
(set! (-> this compressed-masks (-> this mask-index)) (the-as (pointer int8) #f))
|
|
(cond
|
|
(compressed-mask-data
|
|
(let* ((decompressed-data-end (unpack-comp-rle (the-as (pointer int8) (-> this bit-mask data)) compressed-mask-data))
|
|
(decompressed-size (&- decompressed-data-end (the-as uint compressed-mask-data)))
|
|
)
|
|
(let ((bytes-to-shift-back
|
|
(+ (- (the-as int compressed-mask-data)) (-> this compressed-data) (-> this compressed-next-index))
|
|
)
|
|
)
|
|
(dotimes (byte-idx bytes-to-shift-back)
|
|
(set! (-> compressed-mask-data byte-idx)
|
|
(the-as int (-> (the-as (pointer uint8) (&+ decompressed-data-end byte-idx))))
|
|
)
|
|
)
|
|
)
|
|
(dotimes (layer-idx 20)
|
|
(let ((layer-data (-> this compressed-masks layer-idx)))
|
|
(if (and layer-data (>= (the-as int layer-data) (the-as int compressed-mask-data)))
|
|
(set! (-> this compressed-masks layer-idx) (&- layer-data (the-as uint decompressed-size)))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this compressed-next-index) (- (-> this compressed-next-index) (the-as uint decompressed-size)))
|
|
)
|
|
)
|
|
(else
|
|
(let ((data (-> this bit-mask data)))
|
|
(dotimes (qw-idx 416)
|
|
(set! (-> (the-as (pointer int128) (&+ data (* qw-idx 16)))) 0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for method 19 of type bigmap
|
|
(defmethod compress-current-masks! ((this bigmap))
|
|
(let* ((compressed-data-dest (+ (-> this compressed-next-index) 0 (-> this compressed-data)))
|
|
(compressed-data-size
|
|
(pack-comp-rle
|
|
(the-as (pointer uint8) compressed-data-dest)
|
|
(-> this bit-mask data)
|
|
6656
|
|
(the-as int (- #x8000 (the-as int (-> this compressed-next-index))))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this compressed-masks (-> this mask-index)) (the-as (pointer int8) compressed-data-dest))
|
|
(set! (-> this compressed-next-index)
|
|
(the-as uint (+ (-> this compressed-next-index) (the-as uint compressed-data-size)))
|
|
)
|
|
)
|
|
(set! (-> this max-next-index)
|
|
(the-as uint (max (the-as int (-> this max-next-index)) (the-as int (-> this compressed-next-index))))
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for symbol *circle-mask-1x1-meter*, type (array uint32)
|
|
(define *circle-mask-1x1-meter* (new 'static 'boxed-array :type uint32
|
|
#xff000
|
|
#x7ffe00
|
|
#x1ffff80
|
|
#x3ffffc0
|
|
#x7ffffe0
|
|
#xffffff0
|
|
#x1ffffff8
|
|
#x3ffffffc
|
|
#x3ffffffc
|
|
#x7ffffffe
|
|
#x7ffffffe
|
|
#x7ffffffe
|
|
#xffffffff
|
|
#xffffffff
|
|
#xffffffff
|
|
#xffffffff
|
|
#xffffffff
|
|
#xffffffff
|
|
#xffffffff
|
|
#xffffffff
|
|
#x7ffffffe
|
|
#x7ffffffe
|
|
#x7ffffffe
|
|
#x3ffffffc
|
|
#x3ffffffc
|
|
#x1ffffff8
|
|
#xffffff0
|
|
#x7ffffe0
|
|
#x3ffffc0
|
|
#x1ffff80
|
|
#x7ffe00
|
|
#xff000
|
|
)
|
|
)
|
|
|
|
;; definition for symbol *circle-mask-2x2-meters*, type (array uint16)
|
|
(define *circle-mask-2x2-meters* (new 'static 'boxed-array :type uint16
|
|
#x7e0
|
|
#x1ff8
|
|
#x3ffc
|
|
#x7ffe
|
|
#x7ffe
|
|
#xffff
|
|
#xffff
|
|
#xffff
|
|
#xffff
|
|
#xffff
|
|
#xffff
|
|
#x7ffe
|
|
#x7ffe
|
|
#x3ffc
|
|
#x1ff8
|
|
#x7e0
|
|
)
|
|
)
|
|
|
|
;; definition for method 20 of type bigmap
|
|
(defmethod set-enable-from-position! ((this bigmap))
|
|
(let ((v1-4 (-> this layer-mask data (+ (* (-> this pos y) 128) (/ (-> this pos x) 2)))))
|
|
(if (not (logtest? (-> this pos x) 1))
|
|
(set! (-> this layer-mask-enable) (shr v1-4 4))
|
|
(set! (-> this layer-mask-enable) (logand v1-4 15))
|
|
)
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for method 21 of type bigmap
|
|
(defmethod maybe-fill-for-position ((this bigmap) (arg0 int) (arg1 int))
|
|
(local-vars (v1-3 uint))
|
|
(let* ((v1-1 (+ (* arg1 128) (/ arg0 2)))
|
|
(a3-3 (-> this layer-mask data v1-1))
|
|
)
|
|
(if (not (logtest? v1-1 1))
|
|
(set! v1-3 (shr a3-3 4))
|
|
(set! v1-3 (logand a3-3 15))
|
|
)
|
|
)
|
|
(when (= (-> this layer-mask-enable) v1-3)
|
|
(let ((v1-5 (+ (* arg1 32) (/ arg0 8)))
|
|
(a0-1 (-> this bit-mask))
|
|
(a2-2 (logand arg0 7))
|
|
)
|
|
(logior! (-> a0-1 data v1-5) (ash 1 a2-2))
|
|
)
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for symbol *image-mask-table*, type (pointer int64)
|
|
(define *image-mask-table* (new 'static 'array int64 16
|
|
0
|
|
#x8080
|
|
#x80800000
|
|
#x80808080
|
|
#x808000000000
|
|
#x808000008080
|
|
#x808080800000
|
|
#x808080808080
|
|
-9187343239835811840
|
|
-9187343239835778944
|
|
-9187343237679939584
|
|
-9187343237679906688
|
|
-9187201952591642624
|
|
-9187201952591609728
|
|
-9187201950435770368
|
|
-9187201950435737472
|
|
)
|
|
)
|
|
|
|
;; definition for method 23 of type bigmap
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod mask-image-from-bit-mask ((this bigmap))
|
|
(let* ((v1-0 (the-as object (-> this bit-mask)))
|
|
(a1-0 *image-mask-table*)
|
|
(a0-2 (the-as object (-> this bigmap-image art-group)))
|
|
(a0-3 (the-as (pointer int64) (+ (+ #x34000 (-> (the-as (pointer uint32) a0-2) 1) 16) (the-as uint a0-2))))
|
|
)
|
|
(dotimes (a2-3 208)
|
|
(dotimes (a3-1 32)
|
|
(let ((t0-0 (-> (the-as (pointer uint8) v1-0) 0)))
|
|
(when (nonzero? t0-0)
|
|
(let* ((t2-0 (shr t0-0 4))
|
|
(t1-1 (logand t0-0 15))
|
|
(t0-3 (-> a1-0 t2-0))
|
|
)
|
|
(let ((t1-4 (-> a1-0 t1-1)))
|
|
(logior! (-> a0-3 0) t1-4)
|
|
(logior! (-> a0-3 64) t1-4)
|
|
)
|
|
(logior! (-> a0-3 1) t0-3)
|
|
(logior! (-> a0-3 65) t0-3)
|
|
)
|
|
)
|
|
)
|
|
(set! v1-0 (&-> (the-as (pointer uint8) v1-0) 1))
|
|
(set! a0-3 (&-> a0-3 2))
|
|
)
|
|
(set! a0-3 (&-> a0-3 64))
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 22 of type bigmap
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod texture-upload-dma ((this bigmap) (arg0 dma-buffer) (arg1 (pointer uint32)) (arg2 int) (arg3 int) (arg4 int) (arg5 gs-psm))
|
|
(let ((sv-16 arg2))
|
|
(dma-buffer-add-gs-set arg0
|
|
(bitbltbuf (new 'static 'gs-bitbltbuf :dpsm (the-as int arg5) :dbp sv-16 :dbw (/ arg3 64)))
|
|
(trxpos (new 'static 'gs-trxpos))
|
|
(trxreg (new 'static 'gs-trxreg :rrw arg3 :rrh arg4))
|
|
(trxdir (new 'static 'gs-trxdir))
|
|
)
|
|
)
|
|
(dma-buffer-add-ref-texture arg0 arg1 arg3 arg4 arg5)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 26 of type bigmap
|
|
;; INFO: Used lq/sq
|
|
;; WARN: Return type mismatch pointer vs none.
|
|
(defmethod sprite-dma ((this bigmap) (arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int))
|
|
(let ((v1-0 (-> arg0 base)))
|
|
(set! (-> (the-as (pointer uint128) v1-0) 0) (-> this sprite-tmpl dma-vif quad))
|
|
(set! (-> (the-as (pointer uint128) v1-0) 1) (-> this sprite-tmpl quad 1))
|
|
(set! (-> (the-as (pointer uint128) v1-0) 2) (-> this color quad))
|
|
(set-vector! (the-as vector4w (&+ v1-0 48)) 0 0 0 0)
|
|
(set-vector! (the-as vector4w (&+ v1-0 64)) (* arg1 16) (* arg2 16) #xfffff0 0)
|
|
(set-vector! (the-as vector4w (&+ v1-0 80)) 8192 3328 0 0)
|
|
(set-vector! (the-as vector4w (&+ v1-0 96)) (* arg3 16) (* arg4 16) #xfffff0 0)
|
|
)
|
|
(&+! (-> arg0 base) 112)
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 24 of type bigmap
|
|
(defmethod draw-non-city-map ((this bigmap) (arg0 dma-buffer))
|
|
(let ((s4-0 (the-as (pointer uint32) (-> this bigmap-image art-group))))
|
|
(let ((v1-1 (-> s4-0 0))
|
|
(s3-0 (-> s4-0 1))
|
|
)
|
|
(texture-upload-dma this arg0 (+ (+ v1-1 16) (the-as uint s4-0)) 0 16 16 (gs-psm ct32))
|
|
(dma-buffer-add-gs-set arg0 (texflush 1))
|
|
(texture-upload-dma this arg0 (+ (+ s3-0 16) (the-as uint s4-0)) 8 512 208 (gs-psm mt8))
|
|
)
|
|
(dma-buffer-add-gs-set arg0
|
|
(tex0-1 (new 'static 'gs-tex0 :tbp0 #x8 :tbw #x8 :psm #x13 :tw #x9 :th #x9 :cld #x1))
|
|
(tex1-1 (new 'static 'gs-tex1))
|
|
(texflush 1)
|
|
)
|
|
(sprite-dma this arg0 (-> this x0) (-> this y0) (-> this x1) (-> this y2))
|
|
(let ((v1-16 (+ #x1a000 (-> s4-0 1))))
|
|
(texture-upload-dma this arg0 (+ (+ v1-16 16) (the-as uint s4-0)) 8 512 208 (gs-psm mt8))
|
|
)
|
|
(dma-buffer-add-gs-set arg0 (texflush 0))
|
|
(sprite-dma this arg0 (-> this x0) (-> this y2) (-> this x1) (-> this y1))
|
|
(let ((v1-25 (+ (-> s4-0 0) 1024))
|
|
(s3-1 (+ #x34000 (-> s4-0 1)))
|
|
)
|
|
(texture-upload-dma this arg0 (+ (+ v1-25 16) (the-as uint s4-0)) 0 16 16 (gs-psm ct32))
|
|
(texture-upload-dma this arg0 (+ (+ s3-1 16) (the-as uint s4-0)) 8 512 208 (gs-psm mt8))
|
|
)
|
|
(dma-buffer-add-gs-set arg0
|
|
(tex0-1 (new 'static 'gs-tex0 :tbp0 #x8 :tbw #x8 :psm #x13 :tw #x9 :th #x9 :tcc #x1 :cld #x1))
|
|
(tex1-1 (new 'static 'gs-tex1 :mmag #x1 :mmin #x1))
|
|
(texflush 1)
|
|
)
|
|
(sprite-dma this arg0 (-> this x0) (-> this y0) (-> this x1) (-> this y2))
|
|
(let ((v1-37 (+ #x4e000 (-> s4-0 1))))
|
|
(texture-upload-dma this arg0 (+ (+ v1-37 16) (the-as uint s4-0)) 8 512 208 (gs-psm mt8))
|
|
)
|
|
)
|
|
(dma-buffer-add-gs-set arg0 (texflush 1))
|
|
(sprite-dma this arg0 (-> this x0) (-> this y2) (-> this x1) (-> this y1))
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 25 of type bigmap
|
|
(defmethod draw-city-map ((this bigmap) (arg0 dma-buffer))
|
|
(let ((s4-0 (the-as (pointer uint32) (-> this bigmap-image art-group))))
|
|
(texture-upload-dma this arg0 (+ (+ (-> s4-0 0) 16) (the-as uint s4-0)) 0 16 16 (gs-psm ct32))
|
|
(dma-buffer-add-gs-set arg0 (texflush 0))
|
|
(let ((v1-10 (+ (* (the int (-> this scroll y)) 512) (-> s4-0 1))))
|
|
(texture-upload-dma this arg0 (+ (+ v1-10 16) (the-as int s4-0)) 8 512 208 (gs-psm mt8))
|
|
)
|
|
(dma-buffer-add-gs-set arg0
|
|
(tex0-1 (new 'static 'gs-tex0 :tbp0 #x8 :tbw #x8 :psm #x13 :tw #x9 :th #x9 :cld #x1))
|
|
(tex1-1 (new 'static 'gs-tex1))
|
|
(texflush 1)
|
|
)
|
|
(sprite-dma this arg0 (-> this x0) (-> this y0) (-> this x1) (-> this y2))
|
|
(let ((v1-21 (+ (* (+ (the int (-> this scroll y)) 208) 512) (-> s4-0 1))))
|
|
(texture-upload-dma this arg0 (+ (+ v1-21 16) (the-as int s4-0)) 8 512 208 (gs-psm mt8))
|
|
)
|
|
)
|
|
(dma-buffer-add-gs-set arg0 (texflush 1))
|
|
(sprite-dma this arg0 (-> this x0) (-> this y2) (-> this x1) (-> this y1))
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 27 of type bigmap
|
|
;; INFO: Used lq/sq
|
|
(defmethod draw-from-minimap ((this bigmap) (arg0 dma-buffer) (arg1 connection-minimap))
|
|
(rlet ((vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf2 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(cond
|
|
((= (-> arg1 position) #t)
|
|
(let ((v1-4 (as-type (handle->process (-> arg1 handle)) process-drawable)))
|
|
(if (and v1-4 (nonzero? (-> v1-4 root)))
|
|
(set! (-> arg1 last-world-pos quad) (-> v1-4 root trans quad))
|
|
)
|
|
)
|
|
)
|
|
((and (= (logand (the-as int (-> arg1 position)) 7) 4)
|
|
(= (-> (the-as basic (-> arg1 position)) type) entity-actor)
|
|
)
|
|
(let* ((v1-14 (the-as entity-actor (-> arg1 position)))
|
|
(a0-13 (as-type
|
|
(if v1-14
|
|
(-> v1-14 extra process)
|
|
)
|
|
process-drawable
|
|
)
|
|
)
|
|
)
|
|
(if a0-13
|
|
(set! (-> arg1 last-world-pos quad) (-> a0-13 root trans quad))
|
|
(set! (-> arg1 last-world-pos quad) (-> (the-as entity-actor (-> arg1 position)) extra trans quad))
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> arg1 last-world-pos quad) (-> (the-as vector (-> arg1 position)) quad))
|
|
)
|
|
)
|
|
(let ((f0-0 (-> arg1 class scale))
|
|
(a1-5 (-> arg1 class color))
|
|
(a3-0 (new 'stack-no-clear 'vector4w))
|
|
(a2-1 (new-stack-vector0))
|
|
(a0-23 (new-stack-vector0))
|
|
(v1-21 (new-stack-vector0))
|
|
)
|
|
(let ((f1-0 (-> *video-params* relative-x-scale)))
|
|
(-> arg1 class)
|
|
(.lvf vf1 (&-> arg1 last-world-pos quad))
|
|
(.lvf vf2 (&-> this draw-offset quad))
|
|
(.add.z.vf.y vf1 vf0 vf1)
|
|
(.sub.vf vf1 vf1 vf2)
|
|
(.mul.w.vf vf1 vf1 vf2)
|
|
(.ftoi.vf vf1 vf1)
|
|
(.svf (&-> a3-0 quad) vf1)
|
|
(if (logtest? (-> arg1 class flags) (minimap-flag goal))
|
|
(set! (-> arg1 class icon-xy x) (the-as uint (mod (the int (-> this goal-time)) 6)))
|
|
)
|
|
(if (-> *blit-displays-work* horizontal-flip-flag)
|
|
(set! f1-0 (- f1-0))
|
|
)
|
|
(set! (-> a2-1 x) (+ (the float (-> this x0)) (* 2.0 f1-0 (the float (-> a3-0 x)))))
|
|
(set! (-> a2-1 y) (- (the float (+ (* (-> a3-0 y) 2) 1840)) (-> this scroll y)))
|
|
(let ((f1-2 (* 20.0 f1-0 f0-0))
|
|
(f0-1 (* 20.0 f0-0))
|
|
)
|
|
(set! (-> a0-23 x) (the float (the int (- (-> a2-1 x) (/ f1-2 2)))))
|
|
(set! (-> a0-23 y) (the float (the int (- (-> a2-1 y) (/ f0-1 2)))))
|
|
(set! (-> v1-21 x) (+ (-> a0-23 x) f1-2))
|
|
(set! (-> v1-21 y) (+ (-> a0-23 y) f0-1))
|
|
)
|
|
)
|
|
(let* ((t1-2 (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8))
|
|
(t2-0 (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8))
|
|
(a2-8 (+ t1-2 312))
|
|
(a3-11 (+ t2-0 312))
|
|
(t0-15 (-> arg0 base))
|
|
)
|
|
(set! (-> (the-as (pointer uint128) t0-15) 0) (-> this sprite-tmpl dma-vif quad))
|
|
(set! (-> (the-as (pointer uint128) t0-15) 1) (-> this sprite-tmpl quad 1))
|
|
(set-vector!
|
|
(the-as vector4w (&+ t0-15 32))
|
|
(the-as int (-> a1-5 r))
|
|
(the-as int (-> a1-5 g))
|
|
(the-as int (-> a1-5 b))
|
|
128
|
|
)
|
|
(set-vector! (the-as vector4w (&+ t0-15 48)) t1-2 t2-0 0 0)
|
|
(set-vector!
|
|
(the-as vector4w (&+ t0-15 64))
|
|
(the int (* 16.0 (-> a0-23 x)))
|
|
(the int (* 16.0 (-> a0-23 y)))
|
|
#xffffff
|
|
0
|
|
)
|
|
(set-vector! (the-as vector4w (&+ t0-15 80)) a2-8 a3-11 0 0)
|
|
(set-vector!
|
|
(the-as vector4w (&+ t0-15 96))
|
|
(the int (* 16.0 (-> v1-21 x)))
|
|
(the int (* 16.0 (-> v1-21 y)))
|
|
#xffffff
|
|
0
|
|
)
|
|
)
|
|
)
|
|
(&+! (-> arg0 base) 112)
|
|
0
|
|
)
|
|
)
|
|
|
|
;; definition for method 9 of type bigmap
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod initialize ((this bigmap))
|
|
(set! (-> this bigmap-index) (the-as uint 20))
|
|
(set-pending-file (-> this bigmap-image) (the-as string #f) 0 (process->handle *dproc*) 0.0)
|
|
(set! (-> this compressed-next-index) (the-as uint 0))
|
|
(set! (-> this max-next-index) (the-as uint 0))
|
|
(dotimes (v1-5 20)
|
|
(set! (-> this compressed-masks v1-5) (the-as (pointer int8) #f))
|
|
)
|
|
(set! (-> this mask-index) (the-as uint 20))
|
|
(set! (-> this layer-index) (the-as uint 20))
|
|
(set! (-> this layer-mask-enable) (the-as uint 0))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 10 of type bigmap
|
|
;; INFO: Used lq/sq
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod update ((this bigmap))
|
|
(let ((v1-1 (level-get-target-inside *level*)))
|
|
(if v1-1
|
|
(set! (-> this bigmap-index) (the-as uint (-> v1-1 info bigmap-id)))
|
|
)
|
|
)
|
|
(cond
|
|
((-> this drawing-flag)
|
|
(cond
|
|
((= (-> *blit-displays-work* count-down) 1)
|
|
(set-pending-file
|
|
(-> this bigmap-image)
|
|
"world-map"
|
|
(the-as int (-> this load-index))
|
|
(process->handle *dproc*)
|
|
0.0
|
|
)
|
|
(set-pending-file (-> this tpage) "progress-minimap" 0 (process->handle *dproc*) 0.0)
|
|
(set! (-> this loading-flag) #t)
|
|
)
|
|
(else
|
|
(update (-> this bigmap-image))
|
|
(update (-> this tpage))
|
|
(when (and (-> this loading-flag)
|
|
(= (file-status (-> this bigmap-image) "world-map" (the-as int (-> this load-index))) 'active)
|
|
(= (file-status (-> this tpage) "progress-minimap" 0) 'active)
|
|
(not (load-in-progress? *level*))
|
|
)
|
|
(if (!= (-> this bigmap-index) 20)
|
|
(mask-image-from-bit-mask this)
|
|
)
|
|
(let ((s5-0 (-> *level* loading-level))
|
|
(s4-0 (-> *texture-pool* allocate-func))
|
|
(s3-0 (-> *texture-relocate-later* memcpy))
|
|
)
|
|
(set! (-> *texture-pool* allocate-func) texture-page-common-boot-allocate)
|
|
(set! (-> *level* loading-level) #f)
|
|
(set! (-> *texture-relocate-later* memcpy) #f)
|
|
(set! (-> this progress-minimap)
|
|
(the-as
|
|
texture-page
|
|
(link (-> this tpage buf) (-> this tpage load-file data) (-> this tpage len) (-> this tpage heap) 4)
|
|
)
|
|
)
|
|
(set! (-> *level* loading-level) s5-0)
|
|
(set! (-> *texture-pool* allocate-func) s4-0)
|
|
(set! (-> *texture-relocate-later* memcpy) s3-0)
|
|
)
|
|
(set! (-> this loading-flag) #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((!= (-> this bigmap-index) 20)
|
|
(set! (-> this offset quad) (-> *bigmap-info-array* data (-> this mask-index) quad))
|
|
(when (!= (-> this bigmap-index) (-> this mask-index))
|
|
(if (!= (-> this mask-index) 20)
|
|
(compress-current-masks! this)
|
|
)
|
|
(set! (-> this mask-index) (-> this bigmap-index))
|
|
(decompress-current-masks! this)
|
|
)
|
|
(when (!= (-> this bigmap-index) (-> this layer-index))
|
|
(set! (-> this layer-index) (-> this bigmap-index))
|
|
(unpack-comp-rle
|
|
(the-as (pointer int8) (-> this layer-mask data))
|
|
(the-as (pointer int8) (-> this compressed-layers data (-> this layer-index)))
|
|
)
|
|
)
|
|
(set-pos! this (target-pos 0))
|
|
(set-enable-from-position! this)
|
|
(cond
|
|
((-> this recording-flag)
|
|
(when (-> this fill-flag)
|
|
(let ((a1-9 (-> this pos x))
|
|
(a2-5 (-> this pos y))
|
|
)
|
|
(if (and (>= a1-9 0) (< a1-9 256) (>= a2-5 0) (< a2-5 208))
|
|
(maybe-fill-for-position this a1-9 a2-5)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(let* ((f30-0 (square (* 131072.0 (-> this offset w))))
|
|
(s4-2 (the int (* 131072.0 (-> this offset w))))
|
|
(s5-2 (- s4-2))
|
|
)
|
|
(while (>= s4-2 s5-2)
|
|
(let* ((s2-0 (the int (sqrtf (- f30-0 (square (the float s5-2))))))
|
|
(s3-1 (- s2-0))
|
|
)
|
|
(while (>= s2-0 s3-1)
|
|
(let ((a1-10 (+ (-> this pos x) s3-1))
|
|
(a2-6 (+ (-> this pos y) s5-2))
|
|
)
|
|
(if (and (>= a1-10 0) (< a1-10 256) (>= a2-6 0) (< a2-6 208))
|
|
(maybe-fill-for-position this a1-10 a2-6)
|
|
)
|
|
)
|
|
(+! s3-1 1)
|
|
)
|
|
)
|
|
(+! s5-2 1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(set-vector! (-> this offset) -2621440.0 -4456448.0 16384.0 0.000030517578)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 11 of type bigmap
|
|
;; INFO: Used lq/sq
|
|
(defmethod draw ((this bigmap) (arg0 int) (arg1 int) (arg2 int) (arg3 int))
|
|
(when (and (= (file-status (-> this bigmap-image) "world-map" (the-as int (-> this load-index))) 'active)
|
|
(not (-> this loading-flag))
|
|
)
|
|
(let ((f0-0 (-> *video-params* relative-x-scale)))
|
|
(cond
|
|
((-> *blit-displays-work* horizontal-flip-flag)
|
|
(set! (-> this x0) (+ (the int (* (the float (+ arg2 -2048)) f0-0)) 2048))
|
|
(set! (-> this x1) (+ (the int (* (the float (+ arg0 -2048)) f0-0)) 2048))
|
|
)
|
|
(else
|
|
(set! (-> this x0) (+ (the int (* (the float (+ arg0 -2048)) f0-0)) 2048))
|
|
(set! (-> this x1) (+ (the int (* (the float (+ arg2 -2048)) f0-0)) 2048))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this y0) arg1)
|
|
(set! (-> this y1) arg3)
|
|
(set! (-> this y2) (/ (+ arg1 arg3) 2))
|
|
(with-dma-buffer-add-bucket ((s4-1 (-> *display* frames (-> *display* on-screen) global-buf))
|
|
(bucket-id tex-all-map)
|
|
)
|
|
(dma-buffer-add-gs-set s4-1
|
|
(test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
|
|
(alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))
|
|
(clamp-1 (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)))
|
|
)
|
|
(if (= (-> this bigmap-index) 20)
|
|
(draw-city-map this s4-1)
|
|
(draw-non-city-map this s4-1)
|
|
)
|
|
)
|
|
(with-dma-buffer-add-bucket ((s4-2 (-> *display* frames (-> *display* on-screen) global-buf))
|
|
(bucket-id tex-all-map)
|
|
)
|
|
(when (= (-> this y0) 1840)
|
|
(let ((s2-1 (-> s4-2 base))
|
|
(s3-1 (lookup-texture-by-id-fast (new 'static 'texture-id :index #x15 :page #xc93)))
|
|
)
|
|
(when s3-1
|
|
(set! (-> (the-as (pointer uint128) s2-1) 0) (-> this adgif-tmpl dma-vif quad))
|
|
(set! (-> (the-as (pointer uint128) s2-1) 1) (-> this adgif-tmpl quad 1))
|
|
(adgif-shader<-texture-simple! (the-as adgif-shader (&+ s2-1 32)) s3-1)
|
|
(&+! (-> s4-2 base) 112)
|
|
)
|
|
(if (not s3-1)
|
|
(format 0 "ERROR: bigmap: mini-map-icons texture is #f~%")
|
|
)
|
|
)
|
|
(let ((s3-2 (the-as connection-pers (-> *minimap* engine alive-list))))
|
|
(while s3-2
|
|
(let ((a2-3 (the-as connection-minimap s3-2)))
|
|
(when (logtest? (-> a2-3 class flags) (minimap-flag bigmap))
|
|
(cond
|
|
((= (-> this bigmap-index) 20)
|
|
(draw-from-minimap this s4-2 a2-3)
|
|
)
|
|
(else
|
|
(if (not (logtest? (-> a2-3 class flags) (minimap-flag city-only)))
|
|
(draw-from-minimap this s4-2 a2-3)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! s3-2 (-> s3-2 next))
|
|
)
|
|
)
|
|
(let ((s3-3 (new 'stack-no-clear 'vector))
|
|
(f30-0 (-> *video-params* relative-x-scale))
|
|
)
|
|
(vector-z-quaternion! s3-3 (-> *target* control quat))
|
|
(vector-xz-normalize! s3-3 -1.0)
|
|
(set! (-> s3-3 y) 0.0)
|
|
(set! (-> s3-3 w) 0.0)
|
|
(let ((sv-96 (-> s4-2 base))
|
|
(sv-100 (get-texture map-target-marker common))
|
|
(sv-104 (new 'stack-no-clear 'matrix))
|
|
)
|
|
(let ((sv-112 (the int (* 56.0 f30-0))))
|
|
)
|
|
(when sv-100
|
|
(set-pos! this (target-pos 0))
|
|
(if (-> *blit-displays-work* horizontal-flip-flag)
|
|
(set! f30-0 (- f30-0))
|
|
)
|
|
(set-vector! (-> (the-as matrix sv-104) vector 0) (* (-> s3-3 z) f30-0) 0.0 (- (-> s3-3 x)) 0.0)
|
|
(set-vector! (-> (the-as matrix sv-104) vector 1) 0.0 1.0 0.0 0.0)
|
|
(set-vector! (-> (the-as matrix sv-104) vector 2) (* (-> s3-3 x) f30-0) 0.0 (-> s3-3 z) 1.0)
|
|
(set-vector!
|
|
(-> (the-as matrix sv-104) trans)
|
|
(+ (the float (-> this x0)) (* 2.0 f30-0 (the float (-> this pos x))))
|
|
0.0
|
|
(- (the float (+ (* (-> this pos y) 2) 1840)) (-> this scroll y))
|
|
1.0
|
|
)
|
|
(set-vector! (-> this corner 0) 0.0 0.0 -7.0 1.0)
|
|
(set-vector! (-> this corner 1) 7.0 0.0 0.0 1.0)
|
|
(set-vector! (-> this corner 2) -7.0 0.0 0.0 1.0)
|
|
(set-vector! (-> this corner 3) 0.0 0.0 7.0 1.0)
|
|
(vector-matrix*! (-> this corner 0) (-> this corner 0) sv-104)
|
|
(vector-matrix*! (-> this corner 1) (-> this corner 1) sv-104)
|
|
(vector-matrix*! (-> this corner 2) (-> this corner 2) sv-104)
|
|
(vector-matrix*! (-> this corner 3) (-> this corner 3) sv-104)
|
|
(set! (-> (the-as (pointer uint128) sv-96)) (-> this adgif-tmpl dma-vif quad))
|
|
(set! (-> (the-as (pointer uint128) sv-96) 1) (-> this adgif-tmpl quad 1))
|
|
(adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-96 32)) sv-100)
|
|
(set! (-> (the-as (pointer uint128) sv-96) 7) (-> this draw-tmpl dma-vif quad))
|
|
(set! (-> (the-as (pointer uint128) sv-96) 8) (-> this draw-tmpl quad 1))
|
|
(set-vector! (the-as vector4w (&+ sv-96 144)) 0 255 255 128)
|
|
(set-vector! (the-as vector4w (&+ sv-96 160)) 0 0 0 0)
|
|
(set-vector!
|
|
(the-as vector4w (&+ sv-96 176))
|
|
(the int (* 16.0 (-> this corner 0 x)))
|
|
(the int (* 16.0 (-> this corner 0 z)))
|
|
#xffffff
|
|
0
|
|
)
|
|
(set-vector! (the-as vector4w (&+ sv-96 192)) 256 0 0 0)
|
|
(set-vector!
|
|
(the-as vector4w (&+ sv-96 208))
|
|
(the int (* 16.0 (-> this corner 1 x)))
|
|
(the int (* 16.0 (-> this corner 1 z)))
|
|
#xffffff
|
|
0
|
|
)
|
|
(set-vector! (the-as vector4w (&+ sv-96 224)) 0 256 0 0)
|
|
(set-vector!
|
|
(the-as vector4w (&+ sv-96 240))
|
|
(the int (* 16.0 (-> this corner 2 x)))
|
|
(the int (* 16.0 (-> this corner 2 z)))
|
|
#xffffff
|
|
0
|
|
)
|
|
(set-vector! (the-as vector4w (&+ sv-96 256)) 256 256 0 0)
|
|
(set-vector!
|
|
(the-as vector4w (&+ sv-96 272))
|
|
(the int (* 16.0 (-> this corner 3 x)))
|
|
(the int (* 16.0 (-> this corner 3 z)))
|
|
#xffffff
|
|
0
|
|
)
|
|
(&+! (-> s4-2 base) 288)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(+! (-> this goal-time) (* 16.0 (seconds-per-frame)))
|
|
(set-dirty-mask! (-> *level* default-level) 4 #x1a400 0)
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for method 12 of type bigmap
|
|
;; INFO: Used lq/sq
|
|
(defmethod handle-cpad-inputs ((this bigmap))
|
|
(cond
|
|
((= (-> this bigmap-index) 20)
|
|
(let* ((v1-2 (-> *cpad-list* cpads 0))
|
|
(f1-0 (analog-input (the-as int (-> v1-2 lefty)) 128.0 32.0 110.0 4.0))
|
|
)
|
|
(set! (-> this scroll y) (fmax 0.0 (fmin 416.0 (+ (-> this scroll y) f1-0))))
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> this scroll quad) (the-as uint128 0))
|
|
0
|
|
)
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for method 13 of type bigmap
|
|
(defmethod compress-all ((this bigmap))
|
|
(when (!= (-> this mask-index) 20)
|
|
(compress-current-masks! this)
|
|
(set! (-> this mask-index) (the-as uint 20))
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for method 14 of type bigmap
|
|
;; INFO: Used lq/sq
|
|
;; WARN: Return type mismatch symbol vs none.
|
|
(defmethod enable-drawing ((this bigmap))
|
|
(set! (-> this bigmap-index) (the-as uint (-> (level-get-target-inside *level*) info bigmap-id)))
|
|
(cond
|
|
((= (-> this bigmap-index) 20)
|
|
(set-pos! this (target-pos 0))
|
|
(set! (-> this scroll y) (the float (max 0 (+ (* (-> this pos y) 2) -208))))
|
|
(set-vector! (-> this draw-offset) -2621440.0 -4456448.0 16384.0 0.000030517578)
|
|
(cond
|
|
((logtest? (game-feature pass-red) (-> *game-info* features))
|
|
(cond
|
|
((and (logtest? (game-feature pass-green) (-> *game-info* features))
|
|
(logtest? (game-feature pass-yellow) (-> *game-info* features))
|
|
)
|
|
(set! (-> this load-index) (the-as uint 24))
|
|
)
|
|
((logtest? (game-feature pass-green) (-> *game-info* features))
|
|
(set! (-> this load-index) (the-as uint 23))
|
|
)
|
|
((logtest? (game-feature pass-yellow) (-> *game-info* features))
|
|
(set! (-> this load-index) (the-as uint 22))
|
|
)
|
|
(else
|
|
(set! (-> this load-index) (the-as uint 21))
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> this load-index) (the-as uint 20))
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> this scroll y) 0.0)
|
|
(set! (-> this draw-offset quad) (-> *bigmap-info-array* data (-> this bigmap-index) quad))
|
|
(set! (-> this load-index) (-> this bigmap-index))
|
|
)
|
|
)
|
|
(set! (-> this drawing-flag) #t)
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 15 of type bigmap
|
|
(defmethod disable-drawing ((this bigmap))
|
|
(set-pending-file
|
|
(-> this bigmap-image)
|
|
(the-as string #f)
|
|
(the-as int (-> this bigmap-index))
|
|
(process->handle *dproc*)
|
|
0.0
|
|
)
|
|
(set-pending-file (-> this tpage) (the-as string #f) 0 (process->handle *dproc*) 0.0)
|
|
(let ((v1-8 #f))
|
|
(while (not v1-8)
|
|
(update (-> this bigmap-image))
|
|
(update (-> this tpage))
|
|
(set! v1-8 (and (= (-> this bigmap-image status) 'inactive) (= (-> this tpage status) 'inactive)))
|
|
)
|
|
)
|
|
(when (-> this progress-minimap)
|
|
(unload-page *texture-pool* (-> this progress-minimap))
|
|
(set! (-> *level* default-level texture-page 3) (the-as texture-page 0))
|
|
(set! (-> this progress-minimap) #f)
|
|
)
|
|
(set! (-> this drawing-flag) #f)
|
|
(set! (-> this loading-flag) #f)
|
|
0
|
|
)
|
|
|
|
;; definition for symbol *map-save-ptr*, type (pointer uint64)
|
|
(define *map-save-ptr* (the-as (pointer uint64) #f))
|
|
|
|
;; definition for method 16 of type bigmap
|
|
(defmethod dump-to-file ((this bigmap))
|
|
(if (not *map-save-ptr*)
|
|
(set! *map-save-ptr* (the-as (pointer uint64) (malloc 'debug #xd0000)))
|
|
)
|
|
(let ((v1-3 (the-as (pointer uint8) (-> this bit-mask)))
|
|
(a0-2 *map-save-ptr*)
|
|
)
|
|
(dotimes (a1-1 208)
|
|
(dotimes (a2-0 32)
|
|
(let ((a3-0 (-> v1-3 0)))
|
|
(dotimes (t0-0 8)
|
|
(cond
|
|
((not (logtest? a3-0 (ash 1 t0-0)))
|
|
(set! (-> a0-2 0) (the-as uint 0))
|
|
(set! (-> a0-2 256) (the-as uint 0))
|
|
0
|
|
)
|
|
(else
|
|
(set! (-> a0-2 0) (the-as uint #x8080808080808080))
|
|
(set! (-> a0-2 256) (the-as uint #x8080808080808080))
|
|
)
|
|
)
|
|
(set! a0-2 (&-> a0-2 1))
|
|
)
|
|
)
|
|
(set! v1-3 (&-> v1-3 1))
|
|
)
|
|
(set! a0-2 (&-> a0-2 256))
|
|
)
|
|
)
|
|
(level-get-target-inside *level*)
|
|
(let ((gp-1 512)
|
|
(s5-0 416)
|
|
)
|
|
(set! (-> *image-name* data 0) (the-as uint 0))
|
|
(format *image-name* "final/mapsave/tombb-map.raw")
|
|
(format 0 "writing ~s~%" *image-name*)
|
|
(let ((s4-0 (new 'stack 'file-stream *image-name* 'write)))
|
|
(file-stream-write s4-0 *map-save-ptr* (the-as uint (* (* s5-0 gp-1) 4)))
|
|
(file-stream-close s4-0)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(kmemopen global "bigmap")
|
|
|
|
;; definition for symbol *bigmap*, type bigmap
|
|
(define *bigmap* (new 'global 'bigmap))
|
|
|
|
;; failed to figure out what this is:
|
|
(kmemclose)
|