From 4c28794d23b7d8d67c7b1d4444e4f433536cc4e8 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sun, 5 Jun 2022 18:51:19 -0400 Subject: [PATCH] [decomp] clean up first 50 files (#1422) --- decompiler/config/all-types.gc | 150 ++++---- goal_src/engine/anim/aligner.gc | 2 +- goal_src/engine/camera/math-camera-h.gc | 8 +- goal_src/engine/camera/math-camera.gc | 52 ++- goal_src/engine/debug/anim-tester.gc | 2 +- goal_src/engine/dma/dma-bucket.gc | 2 +- goal_src/engine/dma/dma-disasm.gc | 2 +- goal_src/engine/dma/dma-h.gc | 131 +++---- goal_src/engine/dma/dma.gc | 4 +- goal_src/engine/geometry/bounding-box.gc | 2 +- goal_src/engine/geometry/geometry.gc | 2 +- goal_src/engine/gfx/background.gc | 83 ++--- goal_src/engine/gfx/eye.gc | 16 +- goal_src/engine/gfx/generic/generic.gc | 18 +- goal_src/engine/gfx/hw/display-h.gc | 2 +- goal_src/engine/gfx/hw/gs.gc | 8 +- goal_src/engine/gfx/hw/vu1-user-h.gc | 6 +- goal_src/engine/gfx/merc/merc.gc | 52 +-- goal_src/engine/gfx/ocean/ocean.gc | 2 +- goal_src/engine/gfx/texture-h.gc | 16 +- goal_src/engine/gfx/texture.gc | 50 +-- goal_src/engine/level/level-h.gc | 346 +++++++++--------- goal_src/engine/load/file-io.gc | 6 +- goal_src/engine/load/loader-h.gc | 16 +- goal_src/engine/load/loader.gc | 28 +- goal_src/engine/math/math.gc | 12 +- goal_src/engine/math/matrix.gc | 100 ++--- goal_src/engine/math/quaternion.gc | 2 +- goal_src/engine/math/transform-h.gc | 1 - goal_src/engine/math/transformq-h.gc | 10 +- goal_src/engine/math/trigonometry.gc | 50 +-- goal_src/engine/math/vector-h.gc | 14 +- goal_src/engine/math/vector.gc | 14 +- goal_src/engine/ps2/pad.gc | 6 +- goal_src/engine/ps2/timer-h.gc | 2 +- goal_src/engine/ps2/vif-h.gc | 2 +- goal_src/engine/ps2/vu1-macros.gc | 3 +- goal_src/engine/sound/gsound-h.gc | 4 +- .../reference/engine/anim/aligner_REF.gc | 2 +- .../reference/engine/debug/anim-tester_REF.gc | 2 +- .../reference/engine/gfx/background_REF.gc | 2 +- .../reference/engine/gfx/eye_REF.gc | 6 +- .../engine/gfx/generic/generic_REF.gc | 32 +- .../reference/engine/gfx/merc/merc_REF.gc | 12 +- .../reference/engine/gfx/texture-h_REF.gc | 8 +- .../reference/engine/gfx/texture_REF.gc | 2 +- .../reference/engine/level/level-h_REF.gc | 299 +++++++-------- .../reference/engine/load/loader-h_REF.gc | 12 +- .../reference/engine/load/loader_REF.gc | 2 +- .../reference/engine/math/transformq-h_REF.gc | 2 +- .../reference/engine/sound/gsound-h_REF.gc | 2 +- 51 files changed, 831 insertions(+), 778 deletions(-) diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index cb7744a8a6..573567737b 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -478,87 +478,89 @@ :type int32 :bitfield #f - (bucket-0 0) ;; ? - (bucket-1 1) ;; ? - (bucket-2 2) ;; ? + ;; 0 + ;; 1 + ;; 2 (sky-draw 3) ;; actual sky and cloud framebuffer draws (ocean-mid-and-far 4) ;; actual ocean framebuffer draws for mid/transition/far - (tfrag-tex0 5) ;; tfrag texture upload, level 0 - (tfrag-0 6) ;; tfrag draw, level 0 - (tfrag-near-0 7) ;; tfrag near draw, level 0 - (tie-near-0 8) ;; tie near draw, level 0 - (tie-0 9) ;; tie draw, level 0 - (merc-tfrag-tex0 10) ;; merc, with tfrag textures, level 0 - (gmerc-tfrag-tex 11) ;; generic merc, with tfrag textures, level 0 + (tfrag-tex0 5) ;; tfrag texture upload, level 0 + (tfrag-0 6) ;; tfrag draw, level 0 + (tfrag-near-0 7) ;; tfrag near draw, level 0 + (tie-near-0 8) ;; tie near draw, level 0 + (tie-0 9) ;; tie draw, level 0 + (merc-tfrag-tex0 10) ;; merc, with tfrag textures, level 0 + (generic-tfrag-tex0 11) ;; generic merc, with tfrag textures, level 0 - (tfrag-tex1 12) ;; tfrag texture upload, level 1 - (tfrag-1 13) ;; tfrag draw, level 1 - (tfrag-near-1 14) ;; tfrag near draw, level 1 - (tie-near-1 15) ;; tie near draw, level 1 - (tie-1 16) ;; tie draw, level 1 - (merc-tfrag-tex1 17) ;; merc, with tfrag textures, level 1 - (gmerc-tfrag-tex1 18) ;; generic merc, with tfrag textures, level 1 - (shrub-tex0 19) - (shrub0 20) + (tfrag-tex1 12) ;; tfrag texture upload, level 1 + (tfrag-1 13) ;; tfrag draw, level 1 + (tfrag-near-1 14) ;; tfrag near draw, level 1 + (tie-near-1 15) ;; tie near draw, level 1 + (tie-1 16) ;; tie draw, level 1 + (merc-tfrag-tex1 17) ;; merc, with tfrag textures, level 1 + (generic-tfrag-tex1 18) ;; generic merc, with tfrag textures, level 1 - (shrub-tex1 25) - (shrub1 26) + (shrub-tex0 19) + (shrub0 20) + ;; 21 (likely shrub near) + (shrub-billboard0 22) + (shrub-trans0 23) + (shrub-generic0 24) - (generic-foreground 30) ;; ? - (alpha-tex0 31) - (tfrag-trans-0 32) ;; also sky blend + (shrub-tex1 25) + (shrub1 26) + ;; 27 (likely shrub near) + (shrub-billboard1 28) + (shrub-trans1 29) + (shrub-generic1 30) + + (alpha-tex0 31) + (tfrag-trans-0 32) ;; also sky blend (tfrag-trans-near-0 33) - (tfrag-dirt-0 34) - (tfrag-dirt-near-0 35) - (tfrag-ice-0 36) - (tfrag-ice-near-0 37) + (tfrag-dirt-0 34) + (tfrag-dirt-near-0 35) + (tfrag-ice-0 36) + (tfrag-ice-near-0 37) - (alpha-tex1 38) - (tfrag-trans-1 39) ;; also sky blend + (alpha-tex1 38) + (tfrag-trans-1 39) ;; also sky blend (tfrag-trans-near-1 40) - (tfrag-dirt-1 41) - (tfrag-dirt-near-1 42) - (tfrag-ice-1 43) - (tfrag-ice-near-1 44) + (tfrag-dirt-1 41) + (tfrag-dirt-near-1 42) + (tfrag-ice-1 43) + (tfrag-ice-near-1 44) - (bucket-45 45) - (bucket-46 46) + (merc-alpha-tex 45) + (generic-alpha-tex 46) (shadow 47) - (pris-tex0 48) - (bucket-49 49) - (bucket-50 50) - ;; merc0 49 - ;; generic0 50 - (pris-tex1 51) - (bucket-52 52) - (bucket-53 53) - (merc-eyes 54) ;; eye::update-eyes - ;; merc1 52 - ;; generic1 53 + (pris-tex0 48) + (merc-pris0 49) + (generic-pris0 50) + + (pris-tex1 51) + (merc-pris1 52) + (generic-pris1 53) + + (eyes 54) + + (merc-pris-common 55) + (generic-pris-common 56) - (bucket-55 55) - (bucket-56 56) (water-tex0 57) - (bucket-58 58) - (bucket-59 59) - ;; merc0 58 (+ default) - ;; generic0 59 (+ default) + (merc-water0 58) + (generic-water0 59) (water-tex1 60) - (bucket-61 61) - (bucket-62 62) - (bucket-63 63) ; ocean - ;; merc1 61 - ;; generic1 62 + (merc-water1 61) + (generic-water1 62) + + (ocean-near 63) ; ocean (depth-cue 64) - (pre-sprite-textures 65) ;; common + (common-page-tex 65) (sprite 66) - ;; debug spheres? 67 (debug 67) - ;; debug text 68 (debug-no-zbuf 68) ;; extra buckets for pc port @@ -2657,7 +2659,7 @@ (global-y-angle-to-point (_type_ vector) float 23) (relative-y-angle-to-point (_type_ vector) float 24) (roll-relative-to-gravity (_type_) float 25) - (TODO-RENAME-26 (_type_ int vector float) trsqv 26) + (set-and-limit-velocity (_type_ int vector float) trsqv 26) (get-quaternion (_type_) quaternion 27) ) ) @@ -2969,7 +2971,7 @@ (deftype sound-id (uint32) () (:methods - (dummy-9 () none 9) + (unused-9 () none 9) ) :flag-assert #xa00000004 ) @@ -4974,13 +4976,13 @@ (declare-type art-group basic) ;; custom fields (deftype load-dir (basic) - ((unknown basic :offset-assert 4) + ((lev level :offset-assert 4) (string-array (array string) :offset-assert 8) ;; these are the names (data-array (array basic) :score -50 :offset-assert 12) ;; this is the file data. ) :flag-assert #xb00000010 (:methods - (new (symbol type int basic) _type_ 0) + (new (symbol type int level) _type_ 0) ;; these methods dont exist for this type (load-to-heap-by-name (_type_ string symbol kheap int) art-group 9) (set-loaded-art (_type_ art-group) art-group 10) @@ -4993,7 +4995,7 @@ ) :flag-assert #xb00000010 (:methods - (new (symbol type int basic) _type_ 0) + (new (symbol type int level) _type_ 0) ) ) @@ -5131,9 +5133,9 @@ (add-tex-to-dma! (_type_ level int) none 14) ;; very mysterious arg types. (allocate-vram-words! (_type_ int) int 15) (allocate-segment! (_type_ texture-pool-segment int) texture-pool-segment 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) + (unused-17 () none 17) + (unused-18 () none 18) + (unused-19 () none 19) (unload! (_type_ texture-page) int 20) (upload-one-common! (_type_ level) symbol 21) (lookup-boot-common-id (_type_ int) int 22) @@ -5192,7 +5194,7 @@ (relocate (_type_ kheap (pointer uint8)) none :replace 7) (remove-from-heap (_type_ kheap) _type_ 9) (get-leftover-block-count (_type_ int int) int 10) - (dummy-11 () none 11) + (unused-11 () none 11) (relocate-dests! (_type_ int int) none 12) (add-to-dma-buffer (_type_ dma-buffer int) int 13) (upload-now! (_type_ int) none 14) @@ -5401,7 +5403,11 @@ (texture-page texture-page 9 :offset-assert 60) (loaded-texture-page texture-page 16 :offset-assert 96) (loaded-texture-page-count int32 :offset-assert 160) - (foreground-sink-group dma-foreground-sink-group 3 :inline :offset-assert 176) ;; inline basic + (tfrag-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 176) + (pris-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 208) + (water-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 240) + + (foreground-sink-group dma-foreground-sink-group 3 :inline :offset 176) ;; inline basic (foreground-draw-engine engine 3 :offset-assert 272) (entity entity-links-array :offset-assert 284) (ambient entity-ambient-data-array :offset-assert 288) @@ -5446,7 +5452,7 @@ (load-begin (_type_) _type_ 18) (login-begin (_type_) _type_ 19) (vis-load (_type_) uint 20) - (dummy-21 (_type_) none 21) + (unused-21 (_type_) none 21) (birth (_type_) _type_ 22) (level-status-set! (_type_ symbol) _type_ 23) (load-required-packages (_type_) _type_ 24) diff --git a/goal_src/engine/anim/aligner.gc b/goal_src/engine/anim/aligner.gc index e642709674..ba8b7ba817 100644 --- a/goal_src/engine/anim/aligner.gc +++ b/goal_src/engine/anim/aligner.gc @@ -149,7 +149,7 @@ (-> obj process root) ) -(defmethod TODO-RENAME-26 trsqv ((obj trsqv) (arg0 int) (arg1 vector) (arg2 float)) +(defmethod set-and-limit-velocity trsqv ((obj trsqv) (arg0 int) (arg1 vector) (arg2 float)) (let ((gp-0 (-> obj transv))) (when (logtest? arg0 4) (set! (-> gp-0 x) (-> arg1 x)) diff --git a/goal_src/engine/camera/math-camera-h.gc b/goal_src/engine/camera/math-camera-h.gc index 1aa3b6719f..73809008ac 100644 --- a/goal_src/engine/camera/math-camera-h.gc +++ b/goal_src/engine/camera/math-camera-h.gc @@ -5,11 +5,9 @@ ;; name in dgo: math-camera-h ;; dgos: GAME, ENGINE - -;; The math-camera is a global that contains camera projection and culling matrices. -;; Note that it doesn't take into account the position/rotation of the game camera, but -;; just computes the projection matrix/culling stuff and the camera stuff will have to -;; rotate and translate it as needed. +;; The "math-camera" is responsible for computing the projection matrix used in the renderer +;; from the position of the in-game camera. It also computes some other common camera info. +;; See cam-update.gc for how the game camera updates the math-camera. ;; It also contains some GIF stuff, but these seem to be wrong/unused. ;; Some of the code here may be extremely old and unused, but this does compute the camera projection diff --git a/goal_src/engine/camera/math-camera.gc b/goal_src/engine/camera/math-camera.gc index 19226ad012..b7728d28be 100644 --- a/goal_src/engine/camera/math-camera.gc +++ b/goal_src/engine/camera/math-camera.gc @@ -5,8 +5,34 @@ ;; name in dgo: math-camera ;; dgos: GAME, ENGINE -;; The fog-corrector stores a fog-end fog-start value that is somehow -;; corrected for the field of view. + +;;;;;;;;;;;;;;;;;;;;;; +;; math camera basics +;;;;;;;;;;;;;;;;;;;;;; + +;; the math camera computes the perspective matrix, hvdf offset, and hmge scale. + +;; multiplying a point by the perspective matrix, doing the persepctive divide, then adding hvdf offset gives you: +;; H : horizontal position (in GS coordinates) +;; V : vertical position (in GS coordinates) +;; D : depth (as a 24-bit integer for the z buffer) +;; F : fog + +;; Multiplying by hmge then checking the clipping flags can be used to see if a point is outside the view frustum. + +;; The "camera-temp" matrix is the perspective matrix multplied by the camera tranformation and is used +;; renderers that want a single matrix. + +;;;;;;;;;;;;;;;;;;; +;; fog correction +;;;;;;;;;;;;;;;;;;; + +;; The math-camera matrices are used to compute fogging values, which are a per-vertex uint8 that +;; tells the GS how "foggy" the color should be. This should be proportional to how far away the vertex +;; is. There is a scaling factor applied so the fog intensity isn't affected by the field of view angle. + +;; The fog-corrector stores a fog-end fog-start value that is corrected for the field of view. +;; the actual correction factor is computed in cam-update.gc (deftype fog-corrector (structure) ((fog-end float :offset-assert 0) (fog-start float :offset-assert 4) @@ -23,8 +49,6 @@ (none) ) -;; create the single global fog corrector -;; it appears to be unused. (define *math-camera-fog-correction* (new 'global 'fog-corrector)) (define-extern sprite-distorter-generate-tables (function none)) @@ -139,7 +163,7 @@ (max-depth 16760631.0) ;; almost 2^24. ) (let ((f0-21 16777115.0))) ;; unused. this is actually float closest to 2^24 - + ;; next, compute the fog slope d(8bit_integer_fog_value)/d(game_world_distance). ;; the final fog values we want are an 8-bit integer. ;; note that this is the fog at the near plane too. @@ -157,7 +181,7 @@ (let ((half-depth-buffer-slope (/ depth-buffer-half-range (* (-> math-cam d) (- (-> math-cam f) (-> math-cam d))))) (cam-fov-mult (-> math-cam fov-correction-factor)) ) - + ;; finally, build the actual matrix. ;; x/y are just the usual scaling (set! (-> math-cam perspective vector 0 x) (* cam-fov-mult (- (/ (-> math-cam x-pix) (* (-> math-cam x-ratio) (-> math-cam d)))))) @@ -166,7 +190,7 @@ (set! (-> math-cam perspective vector 2 z) (* cam-fov-mult (+ (-> math-cam f) (-> math-cam d)) half-depth-buffer-slope)) ;; depth to fog (set! (-> math-cam perspective vector 2 w) (* (/ cam-fov-mult (-> math-cam d)) fog-slope)) - + (set! (-> math-cam perspective vector 3 z) (* -2.0 half-depth-buffer-slope (-> math-cam f) (-> math-cam d) cam-fov-mult)) ) @@ -211,7 +235,7 @@ ;; #x4b002032 -> #x4b002031 (set! (-> math-cam isometric vector 3 z) (the-as float (- (the-as int (-> math-cam isometric vector 3 z)) 1))) ) - + ) (set! (-> math-cam isometric vector 3 w) fog-slope) @@ -327,7 +351,9 @@ ) (defun move-target-from-pad ((trans transform) (pad-idx int)) - "Unused function to adjust trans based on inputs from the pad." + "Unused function to adjust trans based on inputs from the pad. + This function must be extremely old because it takes a non-quaternion transform, + and all target stuff uses quaternions." ;; local-trans is the translation in the camera frame. (let ((local-trans (new-stack-vector0))) @@ -474,7 +500,7 @@ (init-vf0-vector) (let ((v1-0 0)) ) - + ;; this camera matrix has both the projection and camera translation/rotation (.lvf vf24 (&-> *math-camera* camera-temp vector 0 quad)) (.lvf vf25 (&-> *math-camera* camera-temp vector 1 quad)) @@ -489,21 +515,21 @@ ;; input point (.lvf vf28 (&-> arg1 quad)) - + ;; matrix multiply, result in vf28 (.mul.x.vf acc vf24 vf28) (.add.mul.y.vf acc vf25 vf28 acc) (.add.mul.z.vf acc vf26 vf28 acc) (.add.mul.w.vf vf28 vf27 vf0 acc) - + (.add.w.vf vf23 vf0 vf0) ;; set w = 1.0 ;; apply hmge scaling. the result of this multiply sets clipping flags appropriately (.mul.vf vf31 vf28 vf29) ;; scale. ;;(TODO.VCLIP vf31 vf31) (let ((clip (vu-clip vf31 0))) ;; clip! - + ;; perspective divide (.div.vf Q vf0 vf31 :fsf #b11 :ftf #b11) (.wait.vf) diff --git a/goal_src/engine/debug/anim-tester.gc b/goal_src/engine/debug/anim-tester.gc index f078d9fc82..332ff86ad5 100644 --- a/goal_src/engine/debug/anim-tester.gc +++ b/goal_src/engine/debug/anim-tester.gc @@ -769,7 +769,7 @@ (set! (-> self draw art-group) (-> v1-1 obj-art-group)) (set! (-> self draw cur-lod) -1) (set! (-> self draw jgeo) a0-15) - (set! (-> self draw sink-group) (-> *level* level-default foreground-sink-group 1)) + (set! (-> self draw sink-group) (-> *level* level-default pris-tex-foreground-sink-group)) (set! (-> self draw lod-set lod 0 geo) a1-4) ) (set! (-> self draw lod-set lod 0 dist) 4095996000.0) diff --git a/goal_src/engine/dma/dma-bucket.gc b/goal_src/engine/dma/dma-bucket.gc index 3e51532885..da04622044 100644 --- a/goal_src/engine/dma/dma-bucket.gc +++ b/goal_src/engine/dma/dma-bucket.gc @@ -34,7 +34,7 @@ "Add count buckets. Each bucket is initialized as empty and won't transfer anything." (let* ((initial-bucket (the-as dma-bucket (-> dma-buf base))) (current-bucket initial-bucket)) - + ;;(let ((current-bucket (the-as dma-bucket (-> dma-buf base)))) (dotimes (i count) ;; set the DMA tag to next, with a qwc of zero. diff --git a/goal_src/engine/dma/dma-disasm.gc b/goal_src/engine/dma/dma-disasm.gc index 1b5d06e2ad..81d3bb1655 100644 --- a/goal_src/engine/dma/dma-disasm.gc +++ b/goal_src/engine/dma/dma-disasm.gc @@ -56,7 +56,7 @@ (new 'static 'vif-disasm-element :mask #x6f :tag #x6e :val #x4 :print #x7 :string1 "unpack-v4-8") (new 'static 'vif-disasm-element :mask #x6f :tag #x6f :val #x2 :print #x7 :string1 "unpack-v4-5") (new 'static 'vif-disasm-element :print #x8))) - + (defun disasm-vif-details ((stream symbol) (data (pointer uint8)) (kind vif-cmd) (count int)) diff --git a/goal_src/engine/dma/dma-h.gc b/goal_src/engine/dma/dma-h.gc index 0af37dbbbb..bb6a0782b6 100644 --- a/goal_src/engine/dma/dma-h.gc +++ b/goal_src/engine/dma/dma-h.gc @@ -206,98 +206,99 @@ ;; DMA data is divided into buckets. -;; At the end of a frame, the buckets are all connected together and sent. -;; the buckets are organized by renderer. +;; At the end of a frame, the buckets are all connected together in order and sent. +;; The order of these buckets should match the C++ buckets.h file, and determines the +;; order that textures are uploaded and things are drawn. + +;; there is typically a texture upload bucket followed by renderer-specific draw buckets. (defconstant BUCKET_COUNT (#if PC_PORT 70 69)) (defenum bucket-id :type int32 :bitfield #f - (bucket-0 0) ;; ? - (bucket-1 1) ;; ? - (bucket-2 2) ;; ? + ;; 0 + ;; 1 + ;; 2 (sky-draw 3) ;; actual sky and cloud framebuffer draws (ocean-mid-and-far 4) ;; actual ocean framebuffer draws for mid/transition/far - (tfrag-tex0 5) ;; tfrag texture upload, level 0 - (tfrag-0 6) ;; tfrag draw, level 0 - (tfrag-near-0 7) ;; tfrag near draw, level 0 - (tie-near-0 8) ;; tie near draw, level 0 - (tie-0 9) ;; tie draw, level 0 - (merc-tfrag-tex0 10) ;; merc, with tfrag textures, level 0 - (gmerc-tfrag-tex 11) ;; generic merc, with tfrag textures, level 0 + (tfrag-tex0 5) ;; tfrag texture upload, level 0 + (tfrag-0 6) ;; tfrag draw, level 0 + (tfrag-near-0 7) ;; tfrag near draw, level 0 + (tie-near-0 8) ;; tie near draw, level 0 + (tie-0 9) ;; tie draw, level 0 + (merc-tfrag-tex0 10) ;; merc, with tfrag textures, level 0 + (generic-tfrag-tex0 11) ;; generic merc, with tfrag textures, level 0 - (tfrag-tex1 12) ;; tfrag texture upload, level 1 - (tfrag-1 13) ;; tfrag draw, level 1 - (tfrag-near-1 14) ;; tfrag near draw, level 1 - (tie-near-1 15) ;; tie near draw, level 1 - (tie-1 16) ;; tie draw, level 1 - (merc-tfrag-tex1 17) ;; merc, with tfrag textures, level 1 - (gmerc-tfrag-tex1 18) ;; generic merc, with tfrag textures, level 1 - (shrub-tex0 19) - (shrub0 20) + (tfrag-tex1 12) ;; tfrag texture upload, level 1 + (tfrag-1 13) ;; tfrag draw, level 1 + (tfrag-near-1 14) ;; tfrag near draw, level 1 + (tie-near-1 15) ;; tie near draw, level 1 + (tie-1 16) ;; tie draw, level 1 + (merc-tfrag-tex1 17) ;; merc, with tfrag textures, level 1 + (generic-tfrag-tex1 18) ;; generic merc, with tfrag textures, level 1 + (shrub-tex0 19) + (shrub0 20) + ;; 21 (likely shrub near) + (shrub-billboard0 22) + (shrub-trans0 23) + (shrub-generic0 24) ;; note: all shrub seems to go in shrub-generic1 - (shrub-tex1 25) - (shrub1 26) + (shrub-tex1 25) + (shrub1 26) + ;; 27 (likely shrub near) + (shrub-billboard1 28) + (shrub-trans1 29) + (shrub-generic1 30) - - (generic-foreground 30) ;; ? - (alpha-tex0 31) - (tfrag-trans-0 32) ;; also sky blend + (alpha-tex0 31) + (tfrag-trans-0 32) ;; also sky blend (tfrag-trans-near-0 33) - (tfrag-dirt-0 34) - (tfrag-dirt-near-0 35) - (tfrag-ice-0 36) - (tfrag-ice-near-0 37) + (tfrag-dirt-0 34) + (tfrag-dirt-near-0 35) + (tfrag-ice-0 36) + (tfrag-ice-near-0 37) - (alpha-tex1 38) - (tfrag-trans-1 39) ;; also sky blend + (alpha-tex1 38) + (tfrag-trans-1 39) ;; also sky blend (tfrag-trans-near-1 40) - (tfrag-dirt-1 41) - (tfrag-dirt-near-1 42) - (tfrag-ice-1 43) - (tfrag-ice-near-1 44) + (tfrag-dirt-1 41) + (tfrag-dirt-near-1 42) + (tfrag-ice-1 43) + (tfrag-ice-near-1 44) - - (bucket-45 45) ;; merc - (bucket-46 46) + (merc-alpha-tex 45) + (generic-alpha-tex 46) (shadow 47) - (pris-tex0 48) - (bucket-49 49) ;; merc - (bucket-50 50) - ;; merc0 49 - ;; generic0 50 + (pris-tex0 48) + (merc-pris0 49) + (generic-pris0 50) - (pris-tex1 51) - (bucket-52 52) ;; merc - (bucket-53 53) - (merc-eyes 54) ;; eye::update-eyes - ;; merc1 52 - ;; generic1 53 + (pris-tex1 51) + (merc-pris1 52) + (generic-pris1 53) + + (eyes 54) + + (merc-pris-common 55) + (generic-pris-common 56) - (bucket-55 55) ;; merc - (bucket-56 56) (water-tex0 57) - (bucket-58 58) ;; merc - (bucket-59 59) - ;; merc0 58 (+ default) - ;; generic0 59 (+ default) + (merc-water0 58) + (generic-water0 59) (water-tex1 60) - (bucket-61 61) ;; merc - (bucket-62 62) - (bucket-63 63) ; ocean - ;; merc1 61 - ;; generic1 62 + (merc-water1 61) + (generic-water1 62) + + (ocean-near 63) ; ocean (depth-cue 64) - (pre-sprite-textures 65) ;; common + (common-page-tex 65) (sprite 66) - ;; debug spheres? 67 (debug 67) - ;; debug text 68 (debug-no-zbuf 68) ;; extra buckets for pc port diff --git a/goal_src/engine/dma/dma.gc b/goal_src/engine/dma/dma.gc index ac0fbea082..6a122eb69a 100644 --- a/goal_src/engine/dma/dma.gc +++ b/goal_src/engine/dma/dma.gc @@ -133,7 +133,7 @@ ) (defun dma-send-chain-no-flush ((arg0 dma-bank-source) (arg1 uint)) - "Send DMA chain! But don't flush the cache, so be careful here. TTE enable." + "Send DMA chain! But don't flush the cache, so be careful here. TTE enable." (local-vars (v0-1 int)) (dma-sync (the-as pointer arg0) 0 0) (.sync.l) @@ -226,7 +226,7 @@ (#when PC_PORT (return 0) ) - + (set! (-> (the-as vif-bank #x10003800) err me0) 1) (set! (-> (the-as vif-bank #x10003c00) err me0) 1) (none) diff --git a/goal_src/engine/geometry/bounding-box.gc b/goal_src/engine/geometry/bounding-box.gc index fd2ca6cbe7..5a54f4aef0 100644 --- a/goal_src/engine/geometry/bounding-box.gc +++ b/goal_src/engine/geometry/bounding-box.gc @@ -201,7 +201,7 @@ ) ) ) - + (.svf (-> obj min) current-min) (.svf (-> obj max) current-max) ) diff --git a/goal_src/engine/geometry/geometry.gc b/goal_src/engine/geometry/geometry.gc index 85bff478e1..70325702c9 100644 --- a/goal_src/engine/geometry/geometry.gc +++ b/goal_src/engine/geometry/geometry.gc @@ -1105,7 +1105,7 @@ ;; loop setup (label cfg-4) - (let ((a1-1 arg1) ;; current + (let ((a1-1 arg1) ;; current (a0-1 (+ arg0 1)) ;; next ) diff --git a/goal_src/engine/gfx/background.gc b/goal_src/engine/gfx/background.gc index ad33f123b2..e6637e4b5c 100644 --- a/goal_src/engine/gfx/background.gc +++ b/goal_src/engine/gfx/background.gc @@ -13,15 +13,15 @@ (defun background-upload-vu0 () "Set up VU0 for background." - + ;; We set up VU0 with some code and data. ;; It looks like the intended use is to be able to do something like ;; vcallms , and then some point stored in a vf register will be transformed. - ;; But I honestly - + ;; But I honestly + ;; would upload to vu0 program memory ;; (upload-vu-program background-vu0-block (&-> *background-work* wait-to-vu0)) - + ;; set up math-camera registers: (let ((at-0 *math-camera*)) (with-vf (vf16 vf17 vf18 vf19 vf20 vf21 vf22 vf23 vf24 vf25 vf26 vf27 vf28 vf29 vf30 vf31) @@ -44,9 +44,9 @@ (.lvf vf31 (&-> at-0 camera-temp vector 3 quad)) ) ) - + ;; here there would be a loop that waits for VIF0 DMA to be complete. - + ;; now a vcallms 0. TODO: this will store all of the above data. But camera-rot premultiplies all values by z's. ;; It's used in shrubbery (at least). ;; I suspect it will be easier to modify specific renderers than to try to implement this in a general way. @@ -86,7 +86,7 @@ ;;(spad-vis (the-as (pointer uint128) (+ #x38b0 #x70000000))) (spad-vis (scratchpad-ptr uint128 :offset VISIBLE_LIST_SCRATCHPAD)) ) - + (b! (not *artist-flip-visible*) cfg-5 :delay (nop!)) (nop!) (nop!) @@ -158,8 +158,8 @@ (&+! (-> dma-buf base) (* 16 1)) ) ) - - + + (let ((a3-3 (-> dma-buf base))) (let ((v1-38 (the-as object (-> dma-buf base)))) (set! (-> (the-as dma-packet v1-38) dma) (new 'static 'dma-tag :id (dma-tag-id next))) @@ -171,12 +171,12 @@ (bucket-id tfrag-0) - + dma-start (the-as (pointer dma-tag) a3-3) ) ) - + ) ) ) @@ -185,20 +185,20 @@ "Complete the background drawing. This function should run after the background engine has executed. " - + ;; set up common VU0 stuff for background. (background-upload-vu0) - + (#when PC_PORT (add-pc-port-background-data (-> *display* frames (-> *display* on-screen) frame global-buf) ) ) - + ;;;;;;;;;;;;;;;; ;; shrubbery ;;;;;;;;;;;;;;;; - + (set! (-> *instance-shrub-work* paused) (paused?)) (when (nonzero? (-> *background-work* shrub-tree-count)) @@ -238,8 +238,8 @@ ) ) - - + + (let ((gp-1 (the-as level #f))) (when (or (nonzero? (-> *background-work* tfrag-tree-count)) (nonzero? (-> *background-work* trans-tfrag-tree-count)) @@ -271,11 +271,11 @@ (.lvf vf31 (&-> v1-48 camera-temp vector 3 quad)) ) ) - + ;; TFRAG (let* ((v1-52 (max (-> *background-work* tfrag-tree-count) (-> *background-work* trans-tfrag-tree-count))) (s4-1 (the-as time-of-day-palette #f)) - (s5-2 (max (max v1-52 + (s5-2 (max (max v1-52 (-> *background-work* lowres-tfrag-tree-count)) (-> *background-work* lowres-trans-tfrag-tree-count) ) @@ -290,7 +290,7 @@ ) ;; loop over all tfrag trees (dotimes (s3-0 s5-2) - + ;;;;;;;;;;;;;; Normal TFRAG (let ((s2-0 (-> *background-work* tfrag-trees s3-0))) (when s2-0 @@ -310,7 +310,7 @@ ) ;; set the level. (set! (-> (scratchpad-object terrain-context) bsp lev-index) (-> s1-0 index)) - + (set! (-> *tfrag-work* min-dist z) 4095996000.0) ;; draw! (draw-drawable-tree-tfrag s2-0 s1-0) @@ -321,7 +321,7 @@ ) ) ) - + ;;;;;;;;;;;;;; Trans TFRAG (let ((s2-1 (-> *background-work* trans-tfrag-trees s3-0))) (when s2-1 @@ -337,7 +337,7 @@ ) ) (set! (-> (scratchpad-object terrain-context) bsp lev-index) (-> s1-1 index)) - + (set! (-> *tfrag-work* min-dist z) 4095996000.0) (draw-drawable-tree-trans-tfrag s2-1 s1-1) ) @@ -346,8 +346,8 @@ ) ) ) - - + + ;;;;;;;;;;;;;; DIRT TFRAG (let ((s2-2 (-> *background-work* dirt-tfrag-trees s3-0))) (when s2-2 @@ -363,7 +363,7 @@ ) ) (set! (-> (scratchpad-object terrain-context) bsp lev-index) (-> s1-2 index)) - + (set! (-> *tfrag-work* min-dist z) 4095996000.0) (draw-drawable-tree-dirt-tfrag s2-2 s1-2) ) @@ -374,8 +374,8 @@ ) ) ) - - + + ;;;;;;;;;;;;;; ICE TFRAG (let ((s2-3 (-> *background-work* ice-tfrag-trees s3-0))) (when s2-3 @@ -391,7 +391,7 @@ ) ) (set! (-> (scratchpad-object terrain-context) bsp lev-index) (-> s1-3 index)) - + (set! (-> *tfrag-work* min-dist z) 4095996000.0) (draw-drawable-tree-ice-tfrag s2-3 s1-3) ) @@ -402,9 +402,9 @@ ) ) ) - - - + + + ;;;;;;;;;;;;;; LOWRES TFRAG (let ((s2-4 (-> *background-work* lowres-tfrag-trees s3-0))) (when s2-4 @@ -420,13 +420,13 @@ ) ) (set! (-> (scratchpad-object terrain-context) bsp lev-index) (-> s1-4 index)) - + ;;(format 0 "draw ~A~%" s2-4) (draw-drawable-tree-tfrag s2-4 s1-4) ) ) ) - + ;;;;;;;;;;;;;; LOWRES TRANS TFRAG (let ((s2-5 (-> *background-work* lowres-trans-tfrag-trees s3-0))) (when s2-5 @@ -442,7 +442,7 @@ ) ) (set! (-> (scratchpad-object terrain-context) bsp lev-index) (-> s1-5 index)) - + (set! (-> *tfrag-work* min-dist z) 4095996000.0) (draw-drawable-tree-trans-tfrag s2-5 s1-5) ) @@ -463,8 +463,8 @@ ) ) ) - - + + ;;;;;;;;;; TIE (TFRAG Instance Engine) ;; common setup @@ -480,7 +480,7 @@ (new 'static 'rgba :r #x40 :b #x40 :a #x80) ) ) - + ;;;;;;;;;; Normal TIE (dotimes (s5-3 (-> *background-work* tie-tree-count)) (let ((s4-2 (-> *background-work* tie-levels s5-3))) @@ -507,11 +507,12 @@ (new 'static 'rgba :r #x80 :g #x20 :b #x60 :a #x80) ) ) - + ;; TIE Generic (dotimes (gp-2 (-> *background-work* tie-tree-count)) (when (nonzero? (-> *background-work* tie-generic gp-2)) - (let* ((s5-4 (-> *background-work* tie-levels gp-2 foreground-sink-group 0 generic-sink)) + ;; send to the generic foreground with tfrag textures bucket for this level + (let* ((s5-4 (-> *background-work* tie-levels gp-2 tfrag-tex-foreground-sink-group generic-sink)) (s3-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) (s4-3 (-> s3-1 base)) ) @@ -534,7 +535,7 @@ ) ) ) - + ) 0 (none) diff --git a/goal_src/engine/gfx/eye.gc b/goal_src/engine/gfx/eye.gc index e5f39fe7d7..f87038c67e 100644 --- a/goal_src/engine/gfx/eye.gc +++ b/goal_src/engine/gfx/eye.gc @@ -7,7 +7,7 @@ ;; DECOMP BEGINS -(define *eye-work* +(define *eye-work* (new 'static 'eye-work :sprite-tmpl (new 'static 'dma-gif-packet @@ -717,7 +717,7 @@ ) ) ) - + ;; Setup GS for level 1 eyes (let* ((s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) (gp-1 (-> s5-1 base)) @@ -780,7 +780,7 @@ ) ) ) - + ;; Setup GS for common eyes (let* ((s5-2 (-> *display* frames (-> *display* on-screen) frame global-buf)) (gp-2 (-> s5-2 base)) @@ -837,16 +837,16 @@ ) (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id merc-eyes) + (bucket-id eyes) gp-2 (the-as (pointer dma-tag) a3-5) ) ) ) - + ;; rendering of eyes. (dotimes (gp-3 11) - + ;; grab the eye and the process (let* ((s5-3 (-> *eye-control-array* data gp-3)) (v1-40 (handle->process (-> s5-3 process))) @@ -919,7 +919,7 @@ ) (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id merc-eyes) + (bucket-id eyes) s4-1 (the-as (pointer dma-tag) a3-7) ) @@ -1105,7 +1105,7 @@ ) (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id merc-eyes) + (bucket-id eyes) gp-6 (the-as (pointer dma-tag) a3-10) ) diff --git a/goal_src/engine/gfx/generic/generic.gc b/goal_src/engine/gfx/generic/generic.gc index b174041586..3304ea7f39 100644 --- a/goal_src/engine/gfx/generic/generic.gc +++ b/goal_src/engine/gfx/generic/generic.gc @@ -8,15 +8,15 @@ (define *generic-foreground-sinks* (new 'static 'boxed-array :type generic-dma-foreground-sink :length 0 :allocated-length 9)) -(set! (-> *generic-foreground-sinks* 0) (-> *level* level0 foreground-sink-group 0 generic-sink)) -(set! (-> *generic-foreground-sinks* 1) (-> *level* level0 foreground-sink-group 1 generic-sink)) -(set! (-> *generic-foreground-sinks* 2) (-> *level* level1 foreground-sink-group 0 generic-sink)) -(set! (-> *generic-foreground-sinks* 3) (-> *level* level1 foreground-sink-group 1 generic-sink)) -(set! (-> *generic-foreground-sinks* 4) (-> *level* level-default foreground-sink-group 0 generic-sink)) -(set! (-> *generic-foreground-sinks* 5) (-> *level* level-default foreground-sink-group 1 generic-sink)) -(set! (-> *generic-foreground-sinks* 6) (new 'static 'generic-dma-foreground-sink :bucket (bucket-id generic-foreground))) -(set! (-> *generic-foreground-sinks* 7) (-> *level* level0 foreground-sink-group 2 generic-sink)) -(set! (-> *generic-foreground-sinks* 8) (-> *level* level1 foreground-sink-group 2 generic-sink)) +(set! (-> *generic-foreground-sinks* 0) (-> *level* level0 tfrag-tex-foreground-sink-group generic-sink)) +(set! (-> *generic-foreground-sinks* 1) (-> *level* level0 pris-tex-foreground-sink-group generic-sink)) +(set! (-> *generic-foreground-sinks* 2) (-> *level* level1 tfrag-tex-foreground-sink-group generic-sink)) +(set! (-> *generic-foreground-sinks* 3) (-> *level* level1 pris-tex-foreground-sink-group generic-sink)) +(set! (-> *generic-foreground-sinks* 4) (-> *level* level-default tfrag-tex-foreground-sink-group generic-sink)) +(set! (-> *generic-foreground-sinks* 5) (-> *level* level-default pris-tex-foreground-sink-group generic-sink)) +(set! (-> *generic-foreground-sinks* 6) (new 'static 'generic-dma-foreground-sink :bucket (bucket-id shrub-generic1))) +(set! (-> *generic-foreground-sinks* 7) (-> *level* level0 water-tex-foreground-sink-group generic-sink)) +(set! (-> *generic-foreground-sinks* 8) (-> *level* level1 water-tex-foreground-sink-group generic-sink)) (defun generic-dma-foreground-sink-init ((arg0 generic-dma-foreground-sink)) (set! (-> arg0 state gifbuf-adr) (the-as uint 837)) diff --git a/goal_src/engine/gfx/hw/display-h.gc b/goal_src/engine/gfx/hw/display-h.gc index 89734b4563..deaff89224 100644 --- a/goal_src/engine/gfx/hw/display-h.gc +++ b/goal_src/engine/gfx/hw/display-h.gc @@ -110,7 +110,7 @@ (draw draw-env :offset-assert 12) (frame display-frame :offset-assert 16) ) - + :allow-misaligned :method-count-assert 9 :size-assert #x14 diff --git a/goal_src/engine/gfx/hw/gs.gc b/goal_src/engine/gfx/hw/gs.gc index e09afc33f7..c2e3a02655 100644 --- a/goal_src/engine/gfx/hw/gs.gc +++ b/goal_src/engine/gfx/hw/gs.gc @@ -704,7 +704,7 @@ ;; we unfortunately kind of need this (defmacro gif-tag->static-array (tag regs) "Allocates a new static array of two uint64's making up the gif-tag and the tag registers" - + `(new 'static 'array uint64 2 ,tag ,regs) ) @@ -714,7 +714,7 @@ (defmacro gs-reg-list (&rest reg-ids) "Generate a giftag register descriptor list from reg-ids." - + (let ((reg-count (length reg-ids))) (when (> (length reg-ids) 16) (ferror "too many regs passed to gs-reg-list") @@ -722,14 +722,14 @@ (let ((list-to-splice '()) (cur-lst reg-ids) (i -1)) - + ;; this is questionable. (while (and (not (null? cur-lst)) (< i 15)) (push! list-to-splice (cons 'gif-reg-id (cons (car cur-lst) '()))) (push! list-to-splice (string->symbol-format ":regs{}" (inc! i))) (pop! cur-lst) ) - + `(new 'static 'gif-tag-regs ,@list-to-splice ) diff --git a/goal_src/engine/gfx/hw/vu1-user-h.gc b/goal_src/engine/gfx/hw/vu1-user-h.gc index b3a9c8e283..f67ab3467f 100644 --- a/goal_src/engine/gfx/hw/vu1-user-h.gc +++ b/goal_src/engine/gfx/hw/vu1-user-h.gc @@ -61,9 +61,9 @@ ;; a dma "sink" is somewhere where a renderer can put stuff. (deftype dma-foreground-sink (basic) ((bucket bucket-id :offset-assert 4) ;; the DMA bucket - (foreground-texture-page int8 :offset-assert 8) ;; the tpage we need (in the level) - (foreground-texture-level int8 :offset-assert 9) ;; the level we belong to - (foreground-output-bucket int8 :offset-assert 10) ;; ? + (foreground-texture-page int8 :offset-assert 8) ;; the tpage we need (in the level) + (foreground-texture-level int8 :offset-assert 9) ;; the level we belong to + (foreground-output-bucket int8 :offset-assert 10) ;; ? ) :method-count-assert 9 :size-assert #xb diff --git a/goal_src/engine/gfx/merc/merc.gc b/goal_src/engine/gfx/merc/merc.gc index 746f37ae67..4bb726cd16 100644 --- a/goal_src/engine/gfx/merc/merc.gc +++ b/goal_src/engine/gfx/merc/merc.gc @@ -114,7 +114,7 @@ (defmethod login-adgifs merc-effect ((obj merc-effect)) "Login everything for this merc-effect." - + ;; login adgifs, if we have them. (let ((data (-> obj extra-info))) (when (nonzero? data) @@ -136,7 +136,7 @@ ) ) ) - + ;; login fragment geometry and control. ctrls don't need logins (let ((ctrl (-> obj frag-ctrl)) (geo (-> obj frag-geo)) @@ -170,12 +170,12 @@ (defmethod mem-usage merc-ctrl ((obj merc-ctrl) (arg0 memory-usage-block) (arg1 int)) "Compute memory usage stats for a merc-ctrl" - + ;; do extra (if (-> obj extra) (mem-usage (-> obj extra) arg0 arg1) ) - + ;; do merc ctrls in each effect: (let ((ctrl-mem (+ 32 80 (* (-> obj header effect-count) 32)))) (dotimes (effect-idx (the-as int (-> obj header effect-count))) @@ -198,7 +198,7 @@ (+! (-> arg0 data 75 used) ctrl-mem) (+! (-> arg0 data 75 total) (logand -16 (+ ctrl-mem 15))) ) - + ;; do effect blend shapes (let ((effect-mem 0)) (dotimes (effect-idx2 (the-as int (-> obj header effect-count))) @@ -227,7 +227,7 @@ (+! (-> arg0 data 77 total) (logand -16 (+ effect-mem 15))) ) ) - + ;; do eyes. (when (nonzero? (-> obj header eye-ctrl)) (let ((a0-28 (-> obj header eye-ctrl))) @@ -245,20 +245,20 @@ (defmethod login merc-ctrl ((obj merc-ctrl)) "Log in a merc-ctrl." - + ;; so we can find it (set! *merc-ctrl-header* (-> obj header)) - + ;; clear masks. logging in will set these for textures we need. (dotimes (v1-1 3) (set! (-> *merc-ctrl-header* masks v1-1) (the-as uint 0)) ) - + ;; login the effects (dotimes (effect-idx (the-as int (-> obj header effect-count))) (login-adgifs (-> obj effect effect-idx)) ) - + ;; some weird hack to swap two effects. (let ((idx-with-bit1 -1) (a1-1 (-> obj header effect-count)) @@ -282,7 +282,7 @@ ) ) ) - + ;; login eye. (cond ((zero? (logand -65536 (the-as int (-> obj header eye-ctrl)))) @@ -352,7 +352,7 @@ (defun-debug merc-stats () "Iterate through all merc-ctrls and print." - + (dotimes (gp-0 3) ;; levels (let ((s5-0 (-> *level* level gp-0 art-group))) (when (nonzero? s5-0) @@ -457,10 +457,10 @@ (set! (-> (the-as (pointer vif-tag) gp-0) 4) (new 'static 'vif-tag :imm #x1ba :cmd (vif-cmd base))) (set! (-> (the-as (pointer vif-tag) gp-0) 5) (new 'static 'vif-tag :imm #xfe46 :cmd (vif-cmd offset))) (set! (-> (the-as (pointer vif-tag) gp-0) 6) (new 'static 'vif-tag)) - + ;; upload VU low memory (set! (-> (the-as (pointer vif-tag) gp-0) 7) (new 'static 'vif-tag :num #x8 :cmd (vif-cmd unpack-v4-32))) - + ;; template: (let ((s5-0 (the-as merc-vu1-low-mem (&+ (the-as dma-gif-packet gp-0) 32)))) (set! (-> s5-0 tri-strip-gif tag) @@ -481,11 +481,11 @@ (set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303e4000 32)) 32) ) - + (set! (-> s5-0 ad-gif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1)) (set! (-> s5-0 ad-gif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d))) (set! (-> s5-0 hvdf-offset quad) (-> *math-camera* hvdf-off quad)) - + (quad-copy! (-> s5-0 perspective) (the-as pointer (-> *math-camera* perspective)) 4) (set-vector! (-> s5-0 fog) @@ -508,12 +508,12 @@ (defun merc-vu1-init-buffer ((dma-bucket bucket-id) (test gs-test) (arg2 int)) "Setup merc DMA buffer." - + ;; This function works differently from most and splices to the beginning of the bucket, as ;; drawing has already put stuff in buckets. ;; The advantage of this is that we can check if nothing was drawn, then skip this. ;; NOTE: This runs as part of display-frame-finish, so after previous DMA is synced. - + ;; grab out bucket directly. (let ((bucket (-> *display* frames (-> *display* on-screen) frame bucket-group dma-bucket))) ;; only if we draw anything. @@ -569,7 +569,7 @@ (set! (-> (the-as (pointer gs-reg64) a0-10) 1) (gs-reg64 test-1)) (set! (-> v1-10 base) (&+ a0-10 16)) ) - + ;; terminate as normal (let ((v1-11 (the-as object (-> dma-buf base)))) (set! (-> (the-as dma-packet v1-11) dma) @@ -579,7 +579,7 @@ (set! (-> (the-as dma-packet v1-11) vif1) (new 'static 'vif-tag)) (set! (-> dma-buf base) (&+ (the-as pointer v1-11) 16)) ) - + ;; but splice the existing chain. (set! (-> bucket next) (the-as uint draw-data-start)) ) @@ -604,7 +604,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-49) + (bucket-id merc-pris0) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -626,7 +626,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-52) + (bucket-id merc-pris1) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -637,7 +637,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-45) + (bucket-id merc-alpha-tex) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -648,7 +648,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-55) + (bucket-id merc-pris-common) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -659,7 +659,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-58) + (bucket-id merc-water0) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -671,7 +671,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-61) + (bucket-id merc-water1) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) diff --git a/goal_src/engine/gfx/ocean/ocean.gc b/goal_src/engine/gfx/ocean/ocean.gc index 6fab96f5d3..8c06b24b51 100644 --- a/goal_src/engine/gfx/ocean/ocean.gc +++ b/goal_src/engine/gfx/ocean/ocean.gc @@ -683,7 +683,7 @@ ) (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id bucket-63) + (bucket-id ocean-near) gp-2 (the-as (pointer dma-tag) a3-1) ) diff --git a/goal_src/engine/gfx/texture-h.gc b/goal_src/engine/gfx/texture-h.gc index 70057ad3bb..1e6a635079 100644 --- a/goal_src/engine/gfx/texture-h.gc +++ b/goal_src/engine/gfx/texture-h.gc @@ -72,7 +72,7 @@ ;; the location of the color look-up table for font texture (vram word idx) (font-palette int32 :offset-assert 16) - + ;; these were reordered ;; we have 4 segments, but only the near and common are used. (segment-near texture-pool-segment :inline :offset-assert 20) @@ -99,9 +99,9 @@ (add-tex-to-dma! (_type_ level int) none 14) (allocate-vram-words! (_type_ int) int 15) (allocate-segment! (_type_ texture-pool-segment int) texture-pool-segment 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) + (unused-17 () none 17) + (unused-18 () none 18) + (unused-19 () none 19) (unload! (_type_ texture-page) int 20) (upload-one-common! (_type_ level) symbol 21) (lookup-boot-common-id (_type_ int) int 22) @@ -171,7 +171,7 @@ (size uint32 :offset-assert 24) ;; VRAM words (segment texture-page-segment 3 :inline :offset-assert 28) (pad uint32 16 :offset-assert 64) - + ;; array of texture descriptions. (data texture :dynamic :offset-assert 128) ) @@ -182,7 +182,7 @@ (relocate (_type_ kheap (pointer uint8)) none :replace 7) (remove-from-heap (_type_ kheap) _type_ 9) (get-leftover-block-count (_type_ int int) int 10) - (dummy-11 () none 11) + (unused-11 () none 11) (relocate-dests! (_type_ int int) none 12) (add-to-dma-buffer (_type_ dma-buffer int) int 13) (upload-now! (_type_ int) none 14) @@ -284,7 +284,7 @@ :type uint32 :bitfield #t ;; note that we start at bit 8 because [0-7] are in use. - + (needs-log-in 8) ;; set if we should attempt to log in, cleared on log-in (bit-9 9) ;; cleared on log-in ) @@ -344,7 +344,7 @@ ;; Fixed VRAM ;;;;;;;;;;;;;;;;;;;;;;;; -;; These are pre-allocated and always in VRAM. +;; These are pre-allocated and always in VRAM. (define *sky-base-vram-word* 0) (define *sky-base-block* 0) diff --git a/goal_src/engine/gfx/texture.gc b/goal_src/engine/gfx/texture.gc index 7d04d4a7ce..0914bf6347 100644 --- a/goal_src/engine/gfx/texture.gc +++ b/goal_src/engine/gfx/texture.gc @@ -161,7 +161,7 @@ (defun texture-bpp ((arg0 gs-psm)) "Get the number of bits per pixel for the given texture format" - (case arg0 + (case arg0 (((gs-psm mt8)) 8 ) @@ -337,7 +337,7 @@ ) (defun gs-page-width ((arg0 gs-psm)) - (case arg0 + (case arg0 (((gs-psm ct32) (gs-psm ct24) (gs-psm ct16) (gs-psm ct16s)) 64 ) @@ -352,7 +352,7 @@ ) (defun gs-page-height ((arg0 gs-psm)) - (case arg0 + (case arg0 (((gs-psm ct32) (gs-psm ct24)) 32 ) @@ -373,7 +373,7 @@ ) (defun gs-block-width ((arg0 gs-psm)) - (case arg0 + (case arg0 (((gs-psm ct32) (gs-psm ct24)) 8 ) @@ -391,7 +391,7 @@ ) (defun gs-block-height ((arg0 gs-psm)) - (case arg0 + (case arg0 (((gs-psm ct32) (gs-psm ct24) (gs-psm ct16) (gs-psm ct16s)) 8 ) @@ -716,7 +716,7 @@ (tex-dbg " boot allocator got known common-page ~D~%" tex-id) ;; let the common allocator deal with it. (texture-page-common-allocate pool page heap tpage-id) - + ;; textures that: ;; - are in the common page (uploaded before use, shared VRAM) ;; - are in common memory (not level-specific) @@ -799,8 +799,8 @@ (first-chunk-idx-to-upload int) (tex-id uint) ) - - + + (let ((total-upload-size 0)) (with-dma-buffer-add-bucket ((dma-buf (-> (current-frame) global-buf)) ;; the global DMA buffer bucket-idx) @@ -869,7 +869,7 @@ (shl chunks-to-upload-count 5) ) ) - + (+! total-upload-size chunks-to-upload-count) ;; reset (set! chunks-to-upload-count 0) @@ -883,7 +883,7 @@ ) ) ) - + ;; if we finished with a run of "needs upload", set up the upload. (when (nonzero? chunks-to-upload-count) (#when (not PC_PORT) @@ -905,7 +905,7 @@ (texflush 1) ;; texflush ) ) - + ;; in PC PORT we just skip all that stuff and just send a pointer to the texture page and the mode. (#when PC_PORT (dma-buffer-add-cnt-vif2 dma-buf 1 (new 'static 'vif-tag :cmd (vif-cmd pc-port)) (the-as vif-tag 3)) @@ -926,7 +926,7 @@ ;; this is clearly copy-pasta from upload-vram-pages, and there are some weird leftovers. (let ((v1-0 (-> page segment 0 block-data))) ) - + (let ((dest-block (shr (-> page segment 0 dest) 12)) ;; where we're loading to (sz (-> page segment 0 size)) (modified-chunk-count 0) @@ -1071,7 +1071,7 @@ (dma-buffer-add-uint64 dma-buf page) (dma-buffer-add-uint64 dma-buf -1) ) - + ) (shl total-upload-size 14) ) @@ -1132,7 +1132,7 @@ ;; and we've already used some time in the upload-now!, so we will delay the actual ;; copy until the next frame. ;; The level loader know about this, and all we have to do is set up *texture-reloate-later* - + (let ((page-seg-2-size (logand -4096 (the-as int (+ (-> page segment 2 size) 4095))))) (cond ((< (the-as uint NEAR_PRIVATE_WORDS) page-seg-2-size) @@ -1212,7 +1212,7 @@ (upload-now! page 2) ;; and remember it in the cache. (update-vram-pages pool (-> pool segment-near) page 2) - + (cond ((< (the-as uint NEAR_PRIVATE_WORDS) seg2-size) ;; we use the shared part. Kick out only the non-shared texture. @@ -1383,7 +1383,7 @@ (dotimes (page-idx 9) (set! (-> level texture-page page-idx) #f) ) - + (if (>= max-page-kind 0) ;; tfrag. ;; login with near allocator. (let ((tfrag-dir-entry (texture-page-login @@ -1401,7 +1401,7 @@ ) ) ) - + (if (>= max-page-kind 1) ;; pris. ;; login with common. (let ((pris-dir-entry (texture-page-login (-> id-array 1) texture-page-common-allocate loading-level))) @@ -1449,7 +1449,7 @@ (defmethod add-tex-to-dma! texture-pool ((obj texture-pool) (level level) (tex-page-kind int)) "For the given tpage-kind, upload as needed for the level" (when (= tex-page-kind (tpage-kind tfrag)) ;; TFRAG (0) - ;; get the texture page, bucket to add to, and an effective distance from the closest thing. + ;; get the texture page, bucket to add to, and an effective distance from the closest thing. (let ((tfrag-page (-> level texture-page 0)) (tfrag-bucket (if (zero? (-> level index)) (bucket-id tfrag-tex0) (bucket-id tfrag-tex1))) ;; not really sure how this is calculated, but it's a distance. @@ -1501,7 +1501,7 @@ ) ) ) - + (if (= tex-page-kind (tpage-kind pris)) ;; PRIS (1) (let ((pris-page (-> level texture-page 1))) (if (and pris-page (nonzero? pris-page)) @@ -1515,7 +1515,7 @@ ) ) ) - + (if (= tex-page-kind (tpage-kind shrub)) ;; SHRUB (2) (let ((shrub-page (-> level texture-page 2)) (shrub-closest (-> level closest-object 2)) ;; I guess this is the shrub closest. @@ -1545,7 +1545,7 @@ ) ) ) - + (if (= tex-page-kind (tpage-kind alpha)) ;; ALPHA (3) (let ((alpha-page (-> level texture-page 3)) (alpha-closest (-> level closest-object 3)) @@ -1580,7 +1580,7 @@ ) ) ) - + (if (= tex-page-kind (tpage-kind water)) ;; WATER (4) (let ((water-page (-> level texture-page 4))) (if (and water-page (nonzero? water-page)) @@ -1604,7 +1604,7 @@ (and (nonzero? a2-0) (logtest? (-> obj common-page-mask) (ash 1 v1-0))) ;; in the mask. ) ;; upload it! - (upload-vram-pages obj (-> obj segment-common) a2-0 -2 (bucket-id pre-sprite-textures)) + (upload-vram-pages obj (-> obj segment-common) a2-0 -2 (bucket-id common-page-tex)) (return #f) ) ) @@ -1910,7 +1910,7 @@ ) ;; if we have the font texture after log-in, then set our heap marker to before it. - ;; resetting the heap to here would kick + ;; resetting the heap to here would kick (if (and main-font-tx (-> main-font-tx page)) (set! heap-before-font-tex (the-as int (-> main-font-tx page segment 0 dest)) @@ -2196,7 +2196,7 @@ ) (defun texture-page-login ((id texture-id) (alloc-func (function texture-pool texture-page kheap int texture-page)) (heap kheap)) - "Return the tpage-dir entry for the given texture. + "Return the tpage-dir entry for the given texture. Load if from the debug network if its not loaded. Return #f if it doesn't work" ;; make sure its a valid entry diff --git a/goal_src/engine/level/level-h.gc b/goal_src/engine/level/level-h.gc index 6abbf035bf..834bcca88b 100644 --- a/goal_src/engine/level/level-h.gc +++ b/goal_src/engine/level/level-h.gc @@ -55,7 +55,7 @@ ;; compressed visibility string for a given bsp leaf. ;; Each level may have multiple level-vis-infos. -;; One level-vis-info (the first) is always for the +;; One level-vis-info (the first) is always for the ;; actual level (stored in .VIS file), and there is typically one for each neighboring level. ;; The final level-vis-info (7) should always be empty (set to 0 in the bsp-header) @@ -112,13 +112,13 @@ (priority int32 :offset-assert 64) ;; either 100 or 200 (load-commands pair :offset-assert 68) ;; ?? (alt-load-commands pair :offset-assert 72) ;; ?? - (bsp-mask uint64 :offset-assert 80) ;; ?? + (bsp-mask uint64 :offset-assert 80) ;; ?? unused (bsphere sphere :offset-assert 88) ;; boundings sphere of level? (buzzer int32 :offset-assert 92) ;; which task is the scout fly? (bottom-height meters :offset-assert 96) (run-packages pair :offset-assert 100) ;; possibly unused? - (prev-level basic :offset-assert 104) - (next-level basic :offset-assert 108) + (prev-level basic :offset-assert 104) ;; unused + (next-level basic :offset-assert 108) ;; unused (wait-for-load symbol :offset-assert 112) ) :method-count-assert 9 @@ -140,51 +140,67 @@ ) ;; The actual "level". This manages loading and running a game level. +;; These are allocated by the engine and aren't in static level data. (deftype level (basic) - ((name symbol :offset-assert 4) - (load-name symbol :offset-assert 8) - (nickname symbol :offset-assert 12) - (index int32 :offset-assert 16) - (status symbol :offset-assert 20) - (other level :offset-assert 24) ;; the other level object - (heap kheap :inline :offset-assert 32) ;; level's ~10 MB heap - (bsp bsp-header :offset-assert 48) ;; the main level object in the DGO - (art-group load-dir-art-group :offset-assert 52) ;; the art (foreground models/anims) for the level - (info level-load-info :offset-assert 56) - (texture-page texture-page 9 :offset-assert 60) - (loaded-texture-page texture-page 16 :offset-assert 96) - (loaded-texture-page-count int32 :offset-assert 160) - ; (foreground-sink-group-0 dma-foreground-sink-group :inline :offset-assert 176) - ; (foreground-sink-group-1 dma-foreground-sink-group :inline :offset-assert 208) - ; (foreground-sink-group-2 dma-foreground-sink-group :inline :offset-assert 240) - ; (array-pad uint8 12) - (foreground-sink-group dma-foreground-sink-group 3 :inline :offset-assert 176) ;; inline basic + ((name symbol :offset-assert 4) + (load-name symbol :offset-assert 8) + (nickname symbol :offset-assert 12) + (index int32 :offset-assert 16) + (status symbol :offset-assert 20) + (other level :offset-assert 24) ;; the other level object + (heap kheap :inline :offset-assert 32) ;; level's ~10 MB heap + (bsp bsp-header :offset-assert 48) ;; the main level object in the DGO + (art-group load-dir-art-group :offset-assert 52) ;; the art (foreground models/anims) for the level + (info level-load-info :offset-assert 56) ;; the load-info for this level, + (texture-page texture-page 9 :offset-assert 60) ;; logged-in texture pages (tfrag, pris, shrub, alpha, water) + (loaded-texture-page texture-page 16 :offset-assert 96) ;; texture pages that are loaded (and will need unloading) + (loaded-texture-page-count int32 :offset-assert 160) + + ;; dma "sinks" for foreground level things to render to (plus water and generic tie) + (tfrag-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 176) + (pris-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 208) + (water-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 240) + (foreground-sink-group dma-foreground-sink-group 3 :inline :offset 176) ;; overlay of previous 3. + + ;; engines for each of the three sinks (foreground-draw-engine engine 3 :offset-assert 272) + + ;; linked entities/ambients (entity entity-links-array :offset-assert 284) - (ambient entity-ambient-data-array :offset-assert 288) + (ambient entity-ambient-data-array :offset-assert 288) + + ;; closest objects, used for texture upload decisions. indexed by tpage (only first 5 used) (closest-object float 9 :offset-assert 292) + + ;; texture upload size, bytes. indexed by tpage (only first 5 used) (upload-size int32 9 :offset-assert 328) - (level-distance meters :offset-assert 364) - (inside-sphere? symbol :offset-assert 368) - (inside-boxes? symbol :offset-assert 372) - (display? symbol :offset-assert 376) - (meta-inside? symbol :offset-assert 380) - (mood mood-context :offset-assert 384) - (mood-func (function mood-context float int none) :offset-assert 388) - (vis-bits pointer :offset-assert 392) - (all-visible? symbol :offset-assert 396) - (force-all-visible? symbol :offset-assert 400) - (linking basic :offset-assert 404) - (vis-info level-vis-info 8 :offset-assert 408) ;; note: #f when doesn't exist. - (vis-self-index int32 :offset-assert 440) - (vis-adj-index int32 :offset-assert 444) - (vis-buffer uint8 2048 :offset-assert 448) - (mem-usage-block memory-usage-block :offset-assert 2496) - (mem-usage int32 :offset-assert 2500) - (code-memory-start pointer :offset-assert 2504) - (code-memory-end pointer :offset-assert 2508) - (texture-mask uint32 9 :offset-assert 2512) - (force-inside? symbol :offset-assert 2548) + + ;; info about jak/camera position, relative to the level + (level-distance meters :offset-assert 364) ;; camera distance from level bsphere origin + (inside-sphere? symbol :offset-assert 368) ;; camera inside bsphere? + (inside-boxes? symbol :offset-assert 372) ;; inside the level box list? + (display? symbol :offset-assert 376) ;; level being displayed? + (meta-inside? symbol :offset-assert 380) ;; inside, but stays true until you go inside another level. + + ;; mood + (mood mood-context :offset-assert 384) ;; current state + (mood-func (function mood-context float int none) :offset-assert 388) ;; function to call to update mood + + ;; vis + (vis-bits pointer :offset-assert 392) ;; visibility string buffer + (all-visible? symbol :offset-assert 396) ;; set if visibility system has no info + (force-all-visible? symbol :offset-assert 400) ;; set to disable visibiltiy system and display all + (linking basic :offset-assert 404) ;; is linking in progress? + (vis-info level-vis-info 8 :offset-assert 408) ;; note: #f when doesn't exist. + (vis-self-index int32 :offset-assert 440) ;; vis-info index for this level + (vis-adj-index int32 :offset-assert 444) ;; vis-info index for the other level + (vis-buffer uint8 2048 :offset-assert 448) ;; buffer for vis decompression + (mem-usage-block memory-usage-block :offset-assert 2496) ;; level data memory usage stats + (mem-usage int32 :offset-assert 2500) ;; total use + (code-memory-start pointer :offset-assert 2504) ;; address of start of code + (code-memory-end pointer :offset-assert 2508) ;; address of end of code + (texture-mask uint32 9 :offset-assert 2512) ;; mask of textures we need, per tpage. + (force-inside? symbol :offset-assert 2548) ;; fake being inside? (pad uint8 56) ) :method-count-assert 29 @@ -203,7 +219,7 @@ (load-begin (_type_) _type_ 18) (login-begin (_type_) _type_ 19) (vis-load (_type_) uint 20) - (dummy-21 (_type_) none 21) + (unused-21 (_type_) none 21) (birth (_type_) _type_ 22) (level-status-set! (_type_ symbol) _type_ 23) (load-required-packages (_type_) _type_ 24) @@ -217,7 +233,7 @@ ;; Main *level* object. ;; There are actually three levels. level0 and level1 correspond to the actual buffered levels -;; The level-default seems to be a fake level that can possibly be used by renderers that +;; The level-default is to be a fake level that can possibly be used by renderers that ;; don't belong to any level, for example to render Jak. (deftype level-group (basic) ((length int32 :offset-assert 4) @@ -270,6 +286,7 @@ (defun-extern level-update-after-load level login-state level) ;; Initialize the level structure. This assigns DMA buckets to each level. +;; there are 3 foreground sinks per texture bucket: merc, generic, and an unused one. ;; TODO: figure out exactly which buckets are used for what. (define-extern *level* level-group) (if (zero? *level*) @@ -287,39 +304,38 @@ (new 'static 'level :name #f :status 'inactive - :foreground-sink-group - (new 'static 'inline-array dma-foreground-sink-group 3 - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink :bucket 10) - (new 'static 'generic-dma-foreground-sink - :bucket 11 :foreground-output-bucket 1 - ) - ) + :tfrag-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + ;; merc + tfrag texture + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-tfrag-tex0)) + ;; generic + tfrag texture + (new 'static 'generic-dma-foreground-sink :bucket (bucket-id generic-tfrag-tex0) :foreground-output-bucket 1) ) - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket 49 - :foreground-texture-page 1 - ) - (new 'static 'generic-dma-foreground-sink - :bucket 50 :foreground-texture-page 1 - :foreground-output-bucket 1) - ) + ) + :pris-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-pris0) :foreground-texture-page 1) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-pris0) + :foreground-texture-page 1 + :foreground-output-bucket 1 + ) ) - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket 58 - :foreground-texture-page 2 - ) - (new 'static 'generic-dma-foreground-sink - :bucket 59 - :foreground-texture-page 2 - :foreground-output-bucket 1 - ) - ) + ) + :water-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-water0) :foreground-texture-page 2) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-water0) + :foreground-texture-page 2 + :foreground-output-bucket 1 + ) ) ) :inside-sphere? #f @@ -331,53 +347,48 @@ :name #f :index 1 :status 'inactive - :foreground-sink-group - (new 'static 'inline-array dma-foreground-sink-group 3 - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket 17 - :foreground-texture-level 1 - ) - (new 'static 'generic-dma-foreground-sink - :bucket 18 - :foreground-texture-level 1 - :foreground-output-bucket 1 - ) - ) - ) - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket 52 - :foreground-texture-page 1 - :foreground-texture-level 1 - ) - (new 'static 'generic-dma-foreground-sink - :bucket 53 - :foreground-texture-page 1 - :foreground-texture-level 1 - :foreground-output-bucket 1 - ) - - ) - ) - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket 61 - :foreground-texture-page 2 - :foreground-texture-level 1 - ) - (new 'static 'generic-dma-foreground-sink - :bucket 62 - :foreground-texture-page 2 - :foreground-texture-level 1 - :foreground-output-bucket 1 - ) - ) + :tfrag-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-tfrag-tex1) :foreground-texture-level 1) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-tfrag-tex1) + :foreground-texture-level 1 + :foreground-output-bucket 1 + ) ) ) + :pris-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink + :bucket (bucket-id merc-pris1) + :foreground-texture-page 1 + :foreground-texture-level 1 + ) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-pris1) + :foreground-texture-page 1 + :foreground-texture-level 1 + :foreground-output-bucket 1 + ) + ) + ) + :water-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink + :bucket (bucket-id merc-water1) + :foreground-texture-page 2 + :foreground-texture-level 1 + ) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-water1) + :foreground-texture-page 2 + :foreground-texture-level 1 + :foreground-output-bucket 1 + ) + ) + ) :inside-sphere? #f :inside-boxes? #f :force-inside? #f @@ -387,53 +398,51 @@ :name 'default :index 2 :status 'reserved - :foreground-sink-group - (new 'static 'inline-array dma-foreground-sink-group 3 - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket 45 - :foreground-texture-level 2 - ) - (new 'static 'generic-dma-foreground-sink - :bucket 46 - :foreground-texture-level 2 - :foreground-output-bucket 1 - ) - ) - ) - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket 55 - :foreground-texture-page 1 - :foreground-texture-level 2 - ) - (new 'static 'generic-dma-foreground-sink - :bucket 56 - :foreground-texture-page 1 - :foreground-texture-level 2 - :foreground-output-bucket 1 - ) - ) - ) - (new 'static 'dma-foreground-sink-group - :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket 58 - :foreground-texture-page 2 - :foreground-texture-level 2 - ) - (new 'static 'generic-dma-foreground-sink - :bucket 59 - :foreground-texture-page 2 - :foreground-texture-level 2 - :foreground-output-bucket 1 - ) - - ) + :tfrag-tex-foreground-sink-group + ;; the tfrag texture sink group for the common level uses alpha + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-alpha-tex) :foreground-texture-level 2) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-alpha-tex) + :foreground-texture-level 2 + :foreground-output-bucket 1 + ) ) ) + :pris-tex-foreground-sink-group + ;; pris uses the separate pris common area + (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink + :bucket (bucket-id merc-pris-common) + :foreground-texture-page 1 + :foreground-texture-level 2 + ) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-pris-common) + :foreground-texture-page 1 + :foreground-texture-level 2 + :foreground-output-bucket 1 + ) + ) + ) + :water-tex-foreground-sink-group + ;; water just goes to level 0's buckets + (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink + :bucket (bucket-id merc-water0) + :foreground-texture-page 2 + :foreground-texture-level 2 + ) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-water0) + :foreground-texture-page 2 + :foreground-texture-level 2 + :foreground-output-bucket 1 + ) + ) + ) :inside-sphere? #f :inside-boxes? #f :force-inside? #f @@ -442,5 +451,8 @@ ) ) + + + (define-extern *level-load-list* pair) (define-extern lookup-level-info (function symbol level-load-info)) \ No newline at end of file diff --git a/goal_src/engine/load/file-io.gc b/goal_src/engine/load/file-io.gc index 38692b708a..eba11c84d5 100644 --- a/goal_src/engine/load/file-io.gc +++ b/goal_src/engine/load/file-io.gc @@ -85,9 +85,9 @@ (defmethod print file-info ((obj file-info)) "Print information about a file" - (format #t "#<~A ~A :version ~D.~D @ #x~X>" + (format #t "#<~A ~A :version ~D.~D @ #x~X>" (-> obj type) (-> obj file-name) (-> obj major-version) (-> obj minor-version) obj) - obj + obj ) ;; allocate a temporary string @@ -181,7 +181,7 @@ (let* ((expected-version (cond ((zero? version-override) - (case kind + (case kind (((file-kind tpage) (file-kind dir-tpage)) 7 ) diff --git a/goal_src/engine/load/loader-h.gc b/goal_src/engine/load/loader-h.gc index 8f1ee82643..1a148292d1 100644 --- a/goal_src/engine/load/loader-h.gc +++ b/goal_src/engine/load/loader-h.gc @@ -16,10 +16,10 @@ ;; A load-dir is a collection of references to loaded art. -;; This type didn't have an inspect method, so these field names are made up. +;; This type didn't have a nomral inspect method, so these field names are made up. (declare-type art-group basic) (deftype load-dir (basic) - ((unknown basic :offset-assert 4) + ((lev level :offset-assert 4) (string-array (array string) :offset-assert 8) ;; these are the names (data-array (array basic) :offset-assert 12) ;; this is the file data. ) @@ -27,7 +27,7 @@ :size-assert #x10 :flag-assert #xb00000010 (:methods - (new (symbol type int basic) _type_ 0) + (new (symbol type int level) _type_ 0) (load-to-heap-by-name (_type_ string symbol kheap int) art-group 9) (set-loaded-art (_type_ art-group) art-group 10) ) @@ -41,15 +41,15 @@ :size-assert #x10 :flag-assert #xb00000010 (:methods - (new (symbol type int basic) _type_ 0) + (new (symbol type int level) _type_ 0) ) ) -(defmethod new load-dir ((allocation symbol) (type-to-make type) (length int) (unk basic)) +(defmethod new load-dir ((allocation symbol) (type-to-make type) (length int) (lev level)) "Allocate a new load-dir with room for length entries" (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> obj unknown) unk) + (set! (-> obj lev) lev) ;; create the name array (set! (-> obj string-array) (the-as (array string) @@ -67,10 +67,10 @@ ) ) -(defmethod new load-dir-art-group ((allocation symbol) (type-to-make type) (length int) (unk basic)) +(defmethod new load-dir-art-group ((allocation symbol) (type-to-make type) (length int) (lev level)) "Allocate a new load-dir with room for length art-groups" ;; call parent ctor. - (let ((obj ((method-of-type load-dir new) allocation type-to-make length unk))) + (let ((obj ((method-of-type load-dir new) allocation type-to-make length lev))) ;; override the content type (set! (-> obj data-array content-type) art-group) ;; and cast to child. diff --git a/goal_src/engine/load/loader.gc b/goal_src/engine/load/loader.gc index 1c1fe2c813..452c22785d 100644 --- a/goal_src/engine/load/loader.gc +++ b/goal_src/engine/load/loader.gc @@ -9,7 +9,7 @@ (defmethod inspect load-dir ((obj load-dir)) "Print all the stuff in a load-dir" (format #t "[~8x] ~A~%" obj (-> obj type)) - (format #t "~Tlevel: ~A~%" (-> obj unknown)) + (format #t "~Tlevel: ~A~%" (-> obj lev)) (format #t "~Tallocated-length: ~D~%" (-> obj string-array allocated-length)) (format #t "~Tlength: ~D~%" (-> obj string-array length)) (dotimes (i (-> obj string-array length)) @@ -62,7 +62,7 @@ "Load the art with the given name to the heap and return the art. Won't load a thing if it's already loaded, unless you set do-reload. This is intended for debug only." - + ;; see if we already have it. (let ((s5-0 (-> obj string-array))) (dotimes (s3-0 (-> s5-0 length)) @@ -78,7 +78,7 @@ (return (-> obj art-group-array s3-0)) ) ) - + ;; nope, we don't have it,add it to the list. (let ((v0-2 (art-group-load-check art-name heap version))) (when v0-2 @@ -381,7 +381,7 @@ ) (else ;; we have officially chosen to load this file - + (set! (-> obj load-file) (-> obj pending-load-file)) (set! (-> obj load-file-part) (-> obj pending-load-file-part)) (set! (-> obj load-file-owner) (-> obj pending-load-file-owner)) @@ -389,13 +389,13 @@ ) ) ) - - + + (label cfg-18) (cond ((-> obj load-file) ;; something is being worked on - (case (-> obj status) + (case (-> obj status) (('active 'reserved) ;; file is loaded and usable (or reserved) ) @@ -440,7 +440,7 @@ ) (('loading) ;; loading... - (case (str-load-status (&-> obj len)) + (case (str-load-status (&-> obj len)) (('error) ;; something went wrong. oh well. (set! (-> obj status) 'error) @@ -500,7 +500,7 @@ ) (else ;; we want to get rid of the file! - (case (-> obj status) + (case (-> obj status) (('initialize) ;; this was done earlier ) @@ -571,17 +571,17 @@ -0.5) ) ) - + ;; frame-lock will get set to #t if something is assigned to this buffer in this update. (dotimes (v1-5 2) - (set! (-> obj buffer v1-5 frame-lock) #f) + (set! (-> obj buffer v1-5 frame-lock) #f) ) - + ;; buffers assigned from this call to update (dotimes (v1-8 3) (set! (-> obj rec v1-8 buf2) #f) ) - + ;; update existing buffers from their recs (dotimes (s4-0 2) (let ((s3-0 (-> obj rec s4-0))) @@ -831,7 +831,7 @@ (set! (-> obj rec 2 owner) (the-as handle #f)) ) ) - + ;; if it's top 3 priority, push this spool-anim to the rec list (cond ((< priority (-> obj rec 0 priority)) diff --git a/goal_src/engine/math/math.gc b/goal_src/engine/math/math.gc index 5c23886234..d50f4d0e00 100644 --- a/goal_src/engine/math/math.gc +++ b/goal_src/engine/math/math.gc @@ -91,7 +91,7 @@ (- x diff) ) ) - ) + ) ) (defun lerp ((minimum float) (maximum float) (amount float)) @@ -99,7 +99,7 @@ (+ minimum (* amount (- maximum minimum))) ) -(defun lerp-scale ((min-out float) (max-out float) +(defun lerp-scale ((min-out float) (max-out float) (in float) (min-in float) (max-in float)) "Interpolate from [min-in, max-in] to [min-out, max-out]. If the output is out of range, it will be clamped. @@ -192,7 +192,7 @@ ;; (.vsqrty Q vf1) ;; (.vaddq.x vf2 vf0 Q) ;; you're not allowed to do this! ;; (.vrxorw vf2) - + ;; and advance ;; (.vrnext.xyzw vf1) (let ((x (logand 1 (shr current-random 4))) @@ -203,7 +203,7 @@ (set! *_vu-reg-R_* (logior #x3f800000 (logand current-random #x7fffff))) ) ) - + ;; (.vsubw.xyzw vf1 vf1 vf0) ;; (.qmfc2.i v0 vf1) (- (the-as float *_vu-reg-R_*) 1.0) @@ -235,7 +235,7 @@ (defun rand-vu-int-range ((first int) (second int)) "Get an integer the given range. Inclusive of both? It looks like they actually did this right??" - + (local-vars (float-in-range float)) ;; increment the larger of the range, so it is inclusive @@ -244,7 +244,7 @@ (set! second (+ second 1)) (set! first (+ first 1)) ) - + ;; get a float in the range (set! float-in-range (rand-vu-float-range (the float first) (the float second)) diff --git a/goal_src/engine/math/matrix.gc b/goal_src/engine/math/matrix.gc index 058a419467..f0908102a5 100644 --- a/goal_src/engine/math/matrix.gc +++ b/goal_src/engine/math/matrix.gc @@ -498,7 +498,7 @@ (.xor.vf vf18 vf18 vf18) (.xor.vf vf23 vf23 vf23) (.xor.vf vf19 vf19 vf19) - + (init-vf0-vector) (.lvf vf23 (&-> src vector 0 quad)) (.lvf vf24 (&-> src vector 1 quad)) @@ -899,22 +899,22 @@ ;; this a0 constant has ffff in the upper 16 bits to mask out w, later on. ;; dsll32 a0, a0, 16 (set! a0 (shl a0 48)) ;; a0 = ffff'0000'0000'0000 - + ;;mfc1 a1, f1 ;;qmtc2.i vf6, a1 (.mov vf6 c) ;; will set vf6.x to cosine. - + ;;pceqw a1, v1, r0 ;; compare for equality with zero. ;; this will set 32-bits for each component. - (.pceqw a1 v1 r0) - + (.pceqw a1 v1 r0) + ;; so we pack: [upper64, w0?16, z0?16, y0?16, x0?16] (.ppach a1 r0 a1) - + ;;qmtc2.i vf1, v1 (.mov vf1 v1) ;; should be quad move! - + ;;or v1, a1, a0 ;; make it seem like w is zero. If x,y,z = 0, but w != 0, we want ;; it to act like zero. @@ -922,14 +922,14 @@ ;;mfc1 a0, f0 ;;qmtc2.i vf5, a0 (.mov vf5 s) - + ;;daddiu v1, v1, 1 ;; if all is zero, this will overflow and give us 0. (+! xyz-zero 1) - + ;;vsubx.w vf5, vf0, vf6 (.sub.x.vf vf5 vf0 vf6 :mask #b1000) - + ;;beq v1, r0, L15 ;;vaddx.y vf5, vf0, vf6 (.add.x.vf vf5 vf0 vf6 :mask #b0010) @@ -944,58 +944,58 @@ (.xor.vf vf2 vf2 vf2) (.xor.vf vf3 vf3 vf3) (.xor.vf vf4 vf4 vf4) - + ;;vmulx.xyz vf11, vf1, vf5 (.mul.x.vf vf11 vf1 vf5 :mask #b0111) - + ;;vaddy.x vf7, vf0, vf5 (.add.y.vf vf7 vf0 vf5 :mask #b0001) - + ;;vaddy.y vf8, vf0, vf5 (.add.y.vf vf8 vf0 vf5 :mask #b0010) - + ;;vaddy.z vf9, vf0, vf5 (.add.y.vf vf9 vf0 vf5 :mask #b0100) - + ;;vmulw.xyz vf10, vf1, vf5 (.mul.w.vf vf10 vf1 vf5 :mask #b0111) - + ;;vsubz.y vf7, vf0, vf11 (.sub.z.vf vf7 vf0 vf11 :mask #b0010) - + ;;vaddy.z vf7, vf0, vf11 (.add.y.vf vf7 vf0 vf11 :mask #b0100) - + ;;vaddz.x vf8, vf0, vf11 (.add.z.vf vf8 vf0 vf11 :mask #b0001) - + ;;vsubx.z vf8, vf0, vf11 (.sub.x.vf vf8 vf0 vf11 :mask #b0100) - + ;;vmulx.xyz vf2, vf10, vf1 (.mul.x.vf vf2 vf10 vf1 :mask #b0111) - + ;;vmuly.xyz vf3, vf10, vf1 (.mul.y.vf vf3 vf10 vf1 :mask #b0111) - + ;;vmulz.xyz vf4, vf10, vf1 (.mul.z.vf vf4 vf10 vf1 :mask #b0111) - + ;;vsuby.x vf9, vf0, vf11 (.sub.y.vf vf9 vf0 vf11 :mask #b0001) - + ;;vaddx.y vf9, vf0, vf11 (.add.x.vf vf9 vf0 vf11 :mask #b0010) - + ;;vadd.xyz vf2, vf2, vf7 (.add.vf vf2 vf2 vf7 :mask #b0111) - + ;;vadd.xyz vf3, vf3, vf8 (.add.vf vf3 vf3 vf8 :mask #b0111) - + ;;vadd.xyz vf4, vf4, vf9 (.add.vf vf4 vf4 vf9 :mask #b0111) - + ;;sqc2 vf2, 0(v0) ;;sqc2 vf3, 16(v0) ;;sqc2 vf0, 48(v0) @@ -1676,72 +1676,72 @@ (v1 :type int) ) (init-vf0-vector) - + ;; blez a3, L3 (when-goto (<= count 0) end) - + ;; lqc2 vf1, 0(a0) (.lvf vf1 (-> obj vector 0)) ;; lqc2 vf2, 16(a0) (.lvf vf2 (-> obj vector 1)) - + ;; lqc2 vf3, 32(a0) (.lvf vf3 (-> obj vector 2)) - + ;; lqc2 vf4, 48(a0) (.lvf vf4 (-> obj vector 3)) - + ;; lqc2 vf5, 0(a2) (.lvf vf5 (-> src 0)) - + ;; lqc2 vf6, 16(a2) (.lvf vf6 (-> src 1)) - + (label loop-top) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;vmulaw.xyzw acc, vf4, vf0 (.mul.w.vf acc vf4 vf0) - + ;; lqc2 vf7, 32(a2) (.lvf vf7 (-> src 2)) - + ;;vmaddax.xyzw acc, vf1, vf5 (.add.mul.x.vf acc vf1 vf5 acc) - + ;;lqc2 vf8, 48(a2) (.lvf vf8 (-> src 3)) - + ;;vmadday.xyzw acc, vf2, vf5 (.add.mul.y.vf acc vf2 vf5 acc) - + ;;daddiu a2, a2, 64 ;;(&+! src 64) (set! src (the (inline-array vector) (+ 64 (the int src)))) - + ;;vmaddz.xyz vf5, vf3, vf5 (.add.mul.z.vf vf5 vf3 vf5 acc :mask #b0111) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - + ;;daddiu v1, a3, -1 (set! v1 (- count 1)) - + ;;vmulaw.xyzw acc, vf4, vf0 (.mul.w.vf acc vf4 vf0) - + ;;vmaddax.xyzw acc, vf1, vf6 (.add.mul.x.vf acc vf1 vf6 acc) - + ;; vmadday.xyzw acc, vf2, vf6 (.add.mul.y.vf acc vf2 vf6 acc) - + ;; vmaddz.xyz vf6, vf3, vf6 (.add.mul.z.vf vf6 vf3 vf6 acc :mask #b0111) - + ;;sqc2 vf5, 0(a1) (.svf (-> dst 0) vf5) - + ;;beq v1, r0, L3 ;;vmulaw.xyzw acc, vf4, vf0 (.mul.w.vf acc vf4 vf0) @@ -1760,7 +1760,7 @@ (.add.mul.z.vf vf7 vf3 vf7 acc :mask #b0111) ;;sqc2 vf6, 16(a1) (.svf (-> dst 1) vf6) - + ;;beq v1, r0, L3 ;;vmulaw.xyzw acc, vf4, vf0 (.mul.w.vf acc vf4 vf0) @@ -1779,7 +1779,7 @@ (.add.mul.z.vf vf8 vf3 vf8 acc :mask #b0111) ;;sqc2 vf7, 32(a1) (.svf (-> dst 2) vf7) - + ;;beq v1, r0, L3 ;;daddiu a1, a1, 64 ;;(&!+ dst 64) diff --git a/goal_src/engine/math/quaternion.gc b/goal_src/engine/math/quaternion.gc index f4eecf81b5..b178405049 100644 --- a/goal_src/engine/math/quaternion.gc +++ b/goal_src/engine/math/quaternion.gc @@ -347,7 +347,7 @@ ) (defun quaternion-right-mult-matrix! ((arg0 matrix) (arg1 quaternion)) - "Place quaternion coefficients into a matrix. + "Place quaternion coefficients into a matrix. You can convert a quaternion to a matrix by taking the product of this right-mult and left-mult matrix, but this method is not used. Instead, quaternion->matrix is a more efficient implementation." diff --git a/goal_src/engine/math/transform-h.gc b/goal_src/engine/math/transform-h.gc index 13fd0b4e0b..01fc49be3c 100644 --- a/goal_src/engine/math/transform-h.gc +++ b/goal_src/engine/math/transform-h.gc @@ -18,7 +18,6 @@ :flag-assert #x900000030 ) - ;; Like transform, but it's a basic. ;; some in-game objects have trs as their parent type to represent their location in the game world. (deftype trs (basic) diff --git a/goal_src/engine/math/transformq-h.gc b/goal_src/engine/math/transformq-h.gc index c418b470fd..2c4c49d0b5 100644 --- a/goal_src/engine/math/transformq-h.gc +++ b/goal_src/engine/math/transformq-h.gc @@ -38,11 +38,11 @@ (transv vector :inline :offset-assert 64) ;; velocity (meters/second) (rotv vector :inline :offset-assert 80) ;; angular velocity (deg/second) (scalev vector :inline :offset-assert 96) ;; scale velocity (unused?) - + ;; there's a hacky ~first-order orientation yaw control with hysteresis ;; it makes the yaw change smoothly and attempts to cancel out oscillations from the collision system (dir-targ quaternion :inline :offset-assert 112) ;; direction target - (angle-change-time time-frame :offset-assert 128) ;; the time when we change rotation directions + (angle-change-time time-frame :offset-assert 128) ;; the time when we change rotation directions (old-y-angle-diff float :offset-assert 136) ;; the amount we moved last time ) :method-count-assert 28 @@ -66,8 +66,8 @@ (global-y-angle-to-point (_type_ vector) float 23) (relative-y-angle-to-point (_type_ vector) float 24) (roll-relative-to-gravity (_type_) float 25) - (TODO-RENAME-26 (_type_ int vector float) trsqv 26) - + (set-and-limit-velocity (_type_ int vector float) trsqv 26) + ;; note: child classes can override this method to use a different quaternion ;; to represent the "current" orientation for the above methods. (get-quaternion (_type_) quaternion 27) @@ -75,7 +75,7 @@ ) (defmethod global-y-angle-to-point trsqv ((obj trsqv) (arg0 vector)) - "Get the angle in the xy plane from the position of this trsqv to the point arg0." + "Get the angle in the xz plane from the position of this trsqv to the point arg0." (vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans))) ) diff --git a/goal_src/engine/math/trigonometry.gc b/goal_src/engine/math/trigonometry.gc index 22fc7325cf..dc29cd8497 100644 --- a/goal_src/engine/math/trigonometry.gc +++ b/goal_src/engine/math/trigonometry.gc @@ -264,7 +264,7 @@ ;;(.madda.s f2-0 f8-0) (set! acc (+ acc (* f2-0 f8-0))) ;;(.madda.s f4-0 f9-0) - (set! acc (+ acc (* f4-0 f9-0))) + (set! acc (+ acc (* f4-0 f9-0))) ;;(.madda.s f5-0 f10-0) (set! acc (+ acc (* f5-0 f10-0))) ;;(.madd.s f12-0 f6-0 f11-0) @@ -280,7 +280,7 @@ ) ) -;; +;; (define *sin-poly-vec2* (new 'static 'vector :x (the-as float #x3f7fffde) :y 0.0 @@ -369,7 +369,7 @@ ;;(.mula.s f7-0 f7-0) (set! acc (* f7-0 f7-0)) ;;(.madda.s f8-0 f1-0) - (set! acc (+ acc (* f8-0 f1-0))) + (set! acc (+ acc (* f8-0 f1-0))) ;;(.madda.s f9-0 f3-0) (set! acc (+ acc (* f9-0 f3-0))) ;;(.madda.s f10-0 f4-0) @@ -394,7 +394,7 @@ Radians, with no wrapping. Uses taylor series with 4 coefficients." (rlet ((vf0 :class vf) ;; 0,0,0,1 (vf1 :class vf) ;; src - (vf2 :class vf) ;; + (vf2 :class vf) ;; (vf3 :class vf) ;; src^2's (vf4 :class vf) (vf5 :class vf) @@ -701,7 +701,7 @@ (.mov temp (the-as float #x3f000000)) ;; 0.5 ;;(.vmulx.xyzw vf1 vf1 vf2) (.mul.x.vf vf1 vf1 temp) - + ;;(.vftoi0.xyzw vf1 vf1) (.ftoi.vf vf1 vf1) ;;(.qmtc2.i vf2 v1-0) @@ -775,7 +775,7 @@ (f18 :class fpr :type float) (acc :class fpr :type float) ) - + ;;mtc1 f20, a1 (set! f20 arg1) ;;mtc1 f21, a0 @@ -828,22 +828,22 @@ (set! acc (+ f1 f19)) ;;madda.s f3, f12 (set! acc (+ acc (* f3 f12))) - + ;;madda.s f5, f13 (set! acc (+ acc (* f5 f13))) - + ;;madda.s f6, f14 (set! acc (+ acc (* f6 f14))) - + ;;madda.s f7, f15 (set! acc (+ acc (* f7 f15))) - + ;;madda.s f8, f16 (set! acc (+ acc (* f8 f16))) - + ;;madda.s f9, f17 (set! acc (+ acc (* f9 f17))) - + ;;madd.s f19, f10, f18 ;;mfc1 v0, f19 (+ acc (* f10 f18)) @@ -981,9 +981,9 @@ ) ;; magic numbers for exp. -(define exp-slead +(define exp-slead (new 'static 'array float 32 - (the-as float #x3f800000) + (the-as float #x3f800000) (the-as float #x3f82cd80) (the-as float #x3f85aac0) (the-as float #x3f889800) @@ -1020,7 +1020,7 @@ (define exp-strail (new 'static 'array float 32 - (the-as float #x0) + (the-as float #x0) (the-as float #x35531585) (the-as float #x34d9f312) (the-as float #x35e8092e) @@ -1090,36 +1090,36 @@ (set! f1 (the-as float #x435c6bba)) ;;(b! (>=.s f1 f0) L44 (nop!)) (when-goto (>= f1 f0) L44) - + (set! f0 0.0) (set! f1 arg) ;;(b! (>=.s f0 f1) L42 (nop!)) (when-goto (>= f0 f1) L42) - + (set! v0 (the-as float #x7f7fffff)) ;;(b! #t L43 (nop!)) (goto L43) - + (label L42) (set! v0 (the-as float #x0)) - + (label L43) ;;(b! #t L49 (nop!)) (goto L49) - + (label L44) (set! f1 (the-as float #x33000000)) ;;(b! (>=.s f0 f1) L45 (nop!)) (when-goto (>= f0 f1) L45) - + (set! f0 (the-as float #x3f800000)) (set! f1 arg) (set! f0 (+ f0 f1)) (set! v0 f0) ;;(b! #t L49 (nop!)) (goto L49) - + (label L45) (set! f16 (the-as float #x4238aa3b)) (set! f12 (the-as float #x3cb17200)) @@ -1138,7 +1138,7 @@ ;;(bl! (<0.si t0) L46 (no-delay!)) ;;(set! t0 (- t0)) (set! t0 (abs t0)) - + ;;(label L46) ;;(b! (>=.si a3 t0) L47 (nop!)) (when-goto (>= a3 t0) L47) @@ -1155,7 +1155,7 @@ ;;(b! #t L48 (set! f2 (-.s f17 f18))) (set! f2 (- f17 f18)) (goto L48) - + (label L47) ;;(set! f17 (gpr->fpr a2)) ;;(set! f17 (i2f f17)) @@ -1163,7 +1163,7 @@ (set! f17 (* f17 f12)) (set! f0 arg) (set! f2 (- f0 f17)) - + (label L48) (set! a0-2 (- a2)) ;;(set! f17 (gpr->fpr a0)) diff --git a/goal_src/engine/math/vector-h.gc b/goal_src/engine/math/vector-h.gc index d8aef8d0d1..3e503c7f51 100644 --- a/goal_src/engine/math/vector-h.gc +++ b/goal_src/engine/math/vector-h.gc @@ -57,7 +57,7 @@ ) (defmethod asize-of bit-array ((obj bit-array)) - "Get the size in memory. + "Get the size in memory. It is wrong and says its one byte longer, which is safe." (the-as int (+ (-> obj type size) @@ -624,27 +624,27 @@ (.lvf vf1 a) ;; (.lqc2 vf2 0 arg1) (.lvf vf2 b) - + ;; (.vmul.xyzw vf1 vf1 vf2) ;; set vf1 to element-wise products (.mul.vf vf1 vf1 vf2) - + ;; (.vaddw.x vf3 vf0 vf0) ;; set vf3x to 1 (.xor.vf vf3 vf3 vf3) (.add.w.vf vf3 vf0 vf0 :mask #b1) - + ;; (.vmulax.x acc vf3 vf1) ;; acc.x is now (xa * xb) (.mul.x.vf acc vf3 vf1 :mask #b1) - + ;; (.vmadday.x acc vf3 vf1) ;; acc += thing (.add.mul.y.vf acc vf3 vf1 acc :mask #b1) - + ;; (.vmaddaz.x acc vf3 vf1) (.add.mul.z.vf acc vf3 vf1 acc :mask #b1) - + ;; (.vmaddw.x vf1 vf3 vf1) (.add.mul.w.vf vf1 vf3 vf1 acc :mask #b1) ;; (.qmfc2.i v0-0 vf1) diff --git a/goal_src/engine/math/vector.gc b/goal_src/engine/math/vector.gc index 474ab0c8b5..82ae6ddb0d 100644 --- a/goal_src/engine/math/vector.gc +++ b/goal_src/engine/math/vector.gc @@ -99,7 +99,7 @@ ) (defun vector/! ((arg0 vector) (arg1 vector) (arg2 vector)) - "Set arg0 = arg1 / arg2. The w component will be set to 1. + "Set arg0 = arg1 / arg2. The w component will be set to 1. The implementation is kind of crazy." (rlet ((Q :class vf) (vf0 :class vf) @@ -119,7 +119,7 @@ ;; use FPU to divide x while VU0 is dividing y. (let ((v1-0 (/ (-> arg1 data 0) (-> arg2 data 0)))) (.wait.vf) - + (.mul.vf vf6 vf4 Q :mask #b10) (.nop.vf) (.nop.vf) @@ -274,7 +274,7 @@ (defun vector= ((arg0 vector) (arg1 vector)) "Are the two vectors equal? Does not compare the w component. The implementation is cool." - + ;; (label L91) ;; (set! v0-0 #t) ;; (set! v1-0 #xffff) @@ -299,12 +299,12 @@ (set! v1-1 (+ v1-1 1)) (zero? v1-1) ) - + ;; (b! (zero? v1-3) L92 (nop!)) ;; (set! v0-0 #f) ;; (label L92) ;; (ret-value v0-0) - + ) (defun vector-delta ((arg0 vector) (arg1 vector)) @@ -383,7 +383,7 @@ (+! (-> vec data 2) z-step) ) (else - ;; not in range. + ;; not in range. (let ((f2-6 (/ max-step step-len))) (+! (-> vec data 0) (* f2-6 x-step)) (+! (-> vec data 2) (* f2-6 z-step)) @@ -797,7 +797,7 @@ ) f0-0 ) - + ; (local-vars (v1-1 float)) ; (rlet ((acc :class vf) ; (Q :class vf) diff --git a/goal_src/engine/ps2/pad.gc b/goal_src/engine/ps2/pad.gc index 0390b5fecc..22586f6f30 100644 --- a/goal_src/engine/ps2/pad.gc +++ b/goal_src/engine/ps2/pad.gc @@ -63,7 +63,7 @@ ;; DUALSHOCK 2 data ;; status = 0x70 | (data length / 2) (abutton uint8 12 :offset-assert 12) ;; pressure sensitivity information - + ;; pad buffer needs to be 32 bytes large. (dummy uint8 12 :offset-assert 24) ) @@ -417,10 +417,10 @@ (if (cpad-pressed? ,pad-idx ,x) ,(if (< i (- (length buttons) 1)) `(1+! ,cheat-var) - + `(begin ,@body (set! ,cheat-var 0)) ) - + (set! ,cheat-var 0) ) ) diff --git a/goal_src/engine/ps2/timer-h.gc b/goal_src/engine/ps2/timer-h.gc index e264d4011d..40606dfd72 100644 --- a/goal_src/engine/ps2/timer-h.gc +++ b/goal_src/engine/ps2/timer-h.gc @@ -120,7 +120,7 @@ ;; needs PS2 TIMER porting (#unless PC_PORT (timer-init (the-as timer-bank TIMER1_BANK) (new 'static 'timer-mode :clks (timer-clock-selection busclk/16) :cue 1)) - ) + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Profiler diff --git a/goal_src/engine/ps2/vif-h.gc b/goal_src/engine/ps2/vif-h.gc index bcb4885316..b810a62c76 100644 --- a/goal_src/engine/ps2/vif-h.gc +++ b/goal_src/engine/ps2/vif-h.gc @@ -25,7 +25,7 @@ (er1 uint8 :offset 13 :size 1) (fqc uint8 :offset 24 :size 4) ) - + :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 diff --git a/goal_src/engine/ps2/vu1-macros.gc b/goal_src/engine/ps2/vu1-macros.gc index 51633b016f..ed3f79f119 100644 --- a/goal_src/engine/ps2/vu1-macros.gc +++ b/goal_src/engine/ps2/vu1-macros.gc @@ -147,7 +147,8 @@ ;; In the original game, init-for-transform stashed a bunch of stuff in registers, to be used by other functions. ;; In OpenGOAL, this seems risky so we're going to back up this manually. -;; This does mean this file now has code, but it's not a big deal: +;; This does mean this file now has code, but it's not a big deal. +;; This seems like it is very old GOAL code and is really only used for debug and a few weird leftovers. (deftype transform-regs (structure) ;; Eventually we might want to actually name some of these fields to be more comprehensible? (;; vf0 not included! diff --git a/goal_src/engine/sound/gsound-h.gc b/goal_src/engine/sound/gsound-h.gc index 724a8e5781..4735ba578a 100644 --- a/goal_src/engine/sound/gsound-h.gc +++ b/goal_src/engine/sound/gsound-h.gc @@ -13,7 +13,7 @@ (deftype sound-id (uint32) () (:methods - (dummy-9 () none 9) + (unused-9 () none 9) ;; unused ) :flag-assert #xa00000004 ) @@ -162,6 +162,7 @@ :flag-assert #x900000004 ) +;; playback parameters sent to the IOP. (deftype sound-play-parms (structure) ((mask sound-mask :offset-assert 0) (pitch-mod int16 :offset-assert 2) @@ -430,6 +431,7 @@ :flag-assert #x900000050 ) +;; GOAL-side sound specification. (deftype sound-spec (basic) ((mask sound-mask :offset-assert 4) (num float :offset-assert 8) diff --git a/test/decompiler/reference/engine/anim/aligner_REF.gc b/test/decompiler/reference/engine/anim/aligner_REF.gc index ce487a0ac5..1506ebadb8 100644 --- a/test/decompiler/reference/engine/anim/aligner_REF.gc +++ b/test/decompiler/reference/engine/anim/aligner_REF.gc @@ -146,7 +146,7 @@ ) ;; definition for method 26 of type trsqv -(defmethod TODO-RENAME-26 trsqv ((obj trsqv) (arg0 int) (arg1 vector) (arg2 float)) +(defmethod set-and-limit-velocity trsqv ((obj trsqv) (arg0 int) (arg1 vector) (arg2 float)) (let ((gp-0 (-> obj transv))) (when (logtest? arg0 4) (set! (-> gp-0 x) (-> arg1 x)) diff --git a/test/decompiler/reference/engine/debug/anim-tester_REF.gc b/test/decompiler/reference/engine/debug/anim-tester_REF.gc index 140b9278ed..d64335e660 100644 --- a/test/decompiler/reference/engine/debug/anim-tester_REF.gc +++ b/test/decompiler/reference/engine/debug/anim-tester_REF.gc @@ -1005,7 +1005,7 @@ (set! (-> self draw art-group) (-> v1-1 obj-art-group)) (set! (-> self draw cur-lod) -1) (set! (-> self draw jgeo) a0-15) - (set! (-> self draw sink-group) (-> *level* level-default foreground-sink-group 1)) + (set! (-> self draw sink-group) (-> *level* level-default pris-tex-foreground-sink-group)) (set! (-> self draw lod-set lod 0 geo) a1-4) ) (set! (-> self draw lod-set lod 0 dist) 4095996000.0) diff --git a/test/decompiler/reference/engine/gfx/background_REF.gc b/test/decompiler/reference/engine/gfx/background_REF.gc index 44f60467a4..96b6e291d2 100644 --- a/test/decompiler/reference/engine/gfx/background_REF.gc +++ b/test/decompiler/reference/engine/gfx/background_REF.gc @@ -365,7 +365,7 @@ ) (dotimes (gp-2 (-> *background-work* tie-tree-count)) (when (nonzero? (-> *background-work* tie-generic gp-2)) - (let* ((s5-4 (-> *background-work* tie-levels gp-2 foreground-sink-group 0 generic-sink)) + (let* ((s5-4 (-> *background-work* tie-levels gp-2 tfrag-tex-foreground-sink-group generic-sink)) (s3-1 (-> *display* frames (-> *display* on-screen) frame global-buf)) (s4-3 (-> s3-1 base)) ) diff --git a/test/decompiler/reference/engine/gfx/eye_REF.gc b/test/decompiler/reference/engine/gfx/eye_REF.gc index b15f804b68..556759b420 100644 --- a/test/decompiler/reference/engine/gfx/eye_REF.gc +++ b/test/decompiler/reference/engine/gfx/eye_REF.gc @@ -812,7 +812,7 @@ ) (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id merc-eyes) + (bucket-id eyes) gp-2 (the-as (pointer dma-tag) a3-5) ) @@ -886,7 +886,7 @@ ) (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id merc-eyes) + (bucket-id eyes) s4-1 (the-as (pointer dma-tag) a3-7) ) @@ -1072,7 +1072,7 @@ ) (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id merc-eyes) + (bucket-id eyes) gp-6 (the-as (pointer dma-tag) a3-10) ) diff --git a/test/decompiler/reference/engine/gfx/generic/generic_REF.gc b/test/decompiler/reference/engine/gfx/generic/generic_REF.gc index 9f40c3c7cd..1d11e3d7a9 100644 --- a/test/decompiler/reference/engine/gfx/generic/generic_REF.gc +++ b/test/decompiler/reference/engine/gfx/generic/generic_REF.gc @@ -9,33 +9,37 @@ ) ;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 0) (-> *level* level0 foreground-sink-group 0 generic-sink)) +(set! (-> *generic-foreground-sinks* 0) (-> *level* level0 tfrag-tex-foreground-sink-group generic-sink)) ;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 1) (-> *level* level0 foreground-sink-group 1 generic-sink)) +(set! (-> *generic-foreground-sinks* 1) (-> *level* level0 pris-tex-foreground-sink-group generic-sink)) ;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 2) (-> *level* level1 foreground-sink-group 0 generic-sink)) +(set! (-> *generic-foreground-sinks* 2) (-> *level* level1 tfrag-tex-foreground-sink-group generic-sink)) ;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 3) (-> *level* level1 foreground-sink-group 1 generic-sink)) +(set! (-> *generic-foreground-sinks* 3) (-> *level* level1 pris-tex-foreground-sink-group generic-sink)) ;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 4) (-> *level* level-default foreground-sink-group 0 generic-sink)) - -;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 5) (-> *level* level-default foreground-sink-group 1 generic-sink)) - -;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 6) - (new 'static 'generic-dma-foreground-sink :bucket (bucket-id generic-foreground)) +(set! (-> *generic-foreground-sinks* 4) + (-> *level* level-default tfrag-tex-foreground-sink-group generic-sink) ) ;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 7) (-> *level* level0 foreground-sink-group 2 generic-sink)) +(set! (-> *generic-foreground-sinks* 5) + (-> *level* level-default pris-tex-foreground-sink-group generic-sink) + ) ;; failed to figure out what this is: -(set! (-> *generic-foreground-sinks* 8) (-> *level* level1 foreground-sink-group 2 generic-sink)) +(set! (-> *generic-foreground-sinks* 6) + (new 'static 'generic-dma-foreground-sink :bucket (bucket-id shrub-generic1)) + ) + +;; failed to figure out what this is: +(set! (-> *generic-foreground-sinks* 7) (-> *level* level0 water-tex-foreground-sink-group generic-sink)) + +;; failed to figure out what this is: +(set! (-> *generic-foreground-sinks* 8) (-> *level* level1 water-tex-foreground-sink-group generic-sink)) ;; definition for function generic-dma-foreground-sink-init ;; INFO: Return type mismatch int vs none. diff --git a/test/decompiler/reference/engine/gfx/merc/merc_REF.gc b/test/decompiler/reference/engine/gfx/merc/merc_REF.gc index f30138fb9d..0585ac09c9 100644 --- a/test/decompiler/reference/engine/gfx/merc/merc_REF.gc +++ b/test/decompiler/reference/engine/gfx/merc/merc_REF.gc @@ -504,7 +504,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-49) + (bucket-id merc-pris0) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -526,7 +526,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-52) + (bucket-id merc-pris1) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -537,7 +537,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-45) + (bucket-id merc-alpha-tex) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -548,7 +548,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-55) + (bucket-id merc-pris-common) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -559,7 +559,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-58) + (bucket-id merc-water0) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) @@ -571,7 +571,7 @@ 0 ) (merc-vu1-init-buffer - (bucket-id bucket-61) + (bucket-id merc-water1) (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) diff --git a/test/decompiler/reference/engine/gfx/texture-h_REF.gc b/test/decompiler/reference/engine/gfx/texture-h_REF.gc index 560c642ad6..38e9757701 100644 --- a/test/decompiler/reference/engine/gfx/texture-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/texture-h_REF.gc @@ -70,9 +70,9 @@ (add-tex-to-dma! (_type_ level int) none 14) (allocate-vram-words! (_type_ int) int 15) (allocate-segment! (_type_ texture-pool-segment int) texture-pool-segment 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) + (unused-17 () none 17) + (unused-18 () none 18) + (unused-19 () none 19) (unload! (_type_ texture-page) int 20) (upload-one-common! (_type_ level) symbol 21) (lookup-boot-common-id (_type_ int) int 22) @@ -187,7 +187,7 @@ (relocate (_type_ kheap (pointer uint8)) none :replace 7) (remove-from-heap (_type_ kheap) _type_ 9) (get-leftover-block-count (_type_ int int) int 10) - (dummy-11 () none 11) + (unused-11 () none 11) (relocate-dests! (_type_ int int) none 12) (add-to-dma-buffer (_type_ dma-buffer int) int 13) (upload-now! (_type_ int) none 14) diff --git a/test/decompiler/reference/engine/gfx/texture_REF.gc b/test/decompiler/reference/engine/gfx/texture_REF.gc index a885914237..f12f4d9086 100644 --- a/test/decompiler/reference/engine/gfx/texture_REF.gc +++ b/test/decompiler/reference/engine/gfx/texture_REF.gc @@ -1603,7 +1603,7 @@ (dotimes (v1-0 32) (let ((a2-0 (-> obj common-page v1-0))) (when (and (nonzero? a2-0) (logtest? (-> obj common-page-mask) (ash 1 v1-0))) - (upload-vram-pages obj (-> obj segment-common) a2-0 -2 (bucket-id pre-sprite-textures)) + (upload-vram-pages obj (-> obj segment-common) a2-0 -2 (bucket-id common-page-tex)) (return #f) ) ) diff --git a/test/decompiler/reference/engine/level/level-h_REF.gc b/test/decompiler/reference/engine/level/level-h_REF.gc index 0ebb88c06a..762a240e5b 100644 --- a/test/decompiler/reference/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/engine/level/level-h_REF.gc @@ -139,47 +139,50 @@ ;; definition of type level (deftype level (basic) - ((name symbol :offset-assert 4) - (load-name symbol :offset-assert 8) - (nickname symbol :offset-assert 12) - (index int32 :offset-assert 16) - (status symbol :offset-assert 20) - (other level :offset-assert 24) - (heap kheap :inline :offset-assert 32) - (bsp bsp-header :offset-assert 48) - (art-group load-dir-art-group :offset-assert 52) - (info level-load-info :offset-assert 56) - (texture-page texture-page 9 :offset-assert 60) - (loaded-texture-page texture-page 16 :offset-assert 96) - (loaded-texture-page-count int32 :offset-assert 160) - (foreground-sink-group dma-foreground-sink-group 3 :inline :offset-assert 176) - (foreground-draw-engine engine 3 :offset-assert 272) - (entity entity-links-array :offset-assert 284) - (ambient entity-ambient-data-array :offset-assert 288) - (closest-object float 9 :offset-assert 292) - (upload-size int32 9 :offset-assert 328) - (level-distance meters :offset-assert 364) - (inside-sphere? symbol :offset-assert 368) - (inside-boxes? symbol :offset-assert 372) - (display? symbol :offset-assert 376) - (meta-inside? symbol :offset-assert 380) - (mood mood-context :offset-assert 384) - (mood-func (function mood-context float int none) :offset-assert 388) - (vis-bits pointer :offset-assert 392) - (all-visible? symbol :offset-assert 396) - (force-all-visible? symbol :offset-assert 400) - (linking basic :offset-assert 404) - (vis-info level-vis-info 8 :offset-assert 408) - (vis-self-index int32 :offset-assert 440) - (vis-adj-index int32 :offset-assert 444) - (vis-buffer uint8 2048 :offset-assert 448) - (mem-usage-block memory-usage-block :offset-assert 2496) - (mem-usage int32 :offset-assert 2500) - (code-memory-start pointer :offset-assert 2504) - (code-memory-end pointer :offset-assert 2508) - (texture-mask uint32 9 :offset-assert 2512) - (force-inside? symbol :offset-assert 2548) - (pad uint8 56 :offset-assert 2552) + ((name symbol :offset-assert 4) + (load-name symbol :offset-assert 8) + (nickname symbol :offset-assert 12) + (index int32 :offset-assert 16) + (status symbol :offset-assert 20) + (other level :offset-assert 24) + (heap kheap :inline :offset-assert 32) + (bsp bsp-header :offset-assert 48) + (art-group load-dir-art-group :offset-assert 52) + (info level-load-info :offset-assert 56) + (texture-page texture-page 9 :offset-assert 60) + (loaded-texture-page texture-page 16 :offset-assert 96) + (loaded-texture-page-count int32 :offset-assert 160) + (tfrag-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 176) + (pris-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 208) + (water-tex-foreground-sink-group dma-foreground-sink-group :inline :offset-assert 240) + (foreground-sink-group dma-foreground-sink-group 3 :inline :offset 176) + (foreground-draw-engine engine 3 :offset-assert 272) + (entity entity-links-array :offset-assert 284) + (ambient entity-ambient-data-array :offset-assert 288) + (closest-object float 9 :offset-assert 292) + (upload-size int32 9 :offset-assert 328) + (level-distance meters :offset-assert 364) + (inside-sphere? symbol :offset-assert 368) + (inside-boxes? symbol :offset-assert 372) + (display? symbol :offset-assert 376) + (meta-inside? symbol :offset-assert 380) + (mood mood-context :offset-assert 384) + (mood-func (function mood-context float int none) :offset-assert 388) + (vis-bits pointer :offset-assert 392) + (all-visible? symbol :offset-assert 396) + (force-all-visible? symbol :offset-assert 400) + (linking basic :offset-assert 404) + (vis-info level-vis-info 8 :offset-assert 408) + (vis-self-index int32 :offset-assert 440) + (vis-adj-index int32 :offset-assert 444) + (vis-buffer uint8 2048 :offset-assert 448) + (mem-usage-block memory-usage-block :offset-assert 2496) + (mem-usage int32 :offset-assert 2500) + (code-memory-start pointer :offset-assert 2504) + (code-memory-end pointer :offset-assert 2508) + (texture-mask uint32 9 :offset-assert 2512) + (force-inside? symbol :offset-assert 2548) + (pad uint8 56 :offset-assert 2552) ) :method-count-assert 29 :size-assert #xa30 @@ -197,7 +200,7 @@ (load-begin (_type_) _type_ 18) (login-begin (_type_) _type_ 19) (vis-load (_type_) uint 20) - (dummy-21 (_type_) none 21) + (unused-21 (_type_) none 21) (birth (_type_) _type_ 22) (level-status-set! (_type_ symbol) _type_ 23) (load-required-packages (_type_) _type_ 24) @@ -224,7 +227,7 @@ (format #t "~Ttexture-page[9] @ #x~X~%" (-> obj texture-page)) (format #t "~Tloaded-texture-page[16] @ #x~X~%" (-> obj loaded-texture-page)) (format #t "~Tloaded-texture-page-count: ~D~%" (-> obj loaded-texture-page-count)) - (format #t "~Tforeground-sink-group[3] @ #x~X~%" (-> obj foreground-sink-group)) + (format #t "~Tforeground-sink-group[3] @ #x~X~%" (-> obj tfrag-tex-foreground-sink-group)) (format #t "~Tforeground-draw-engine[3] @ #x~X~%" (-> obj foreground-draw-engine)) (format #t "~Tentity: ~A~%" (-> obj entity)) (format #t "~Tambient: ~A~%" (-> obj ambient)) @@ -334,35 +337,35 @@ (new 'static 'level :name #f :status 'inactive - :foreground-sink-group - (new 'static 'inline-array dma-foreground-sink-group 3 - (new 'static 'dma-foreground-sink-group - :sink - (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink :bucket (bucket-id merc-tfrag-tex0)) - (new 'static 'generic-dma-foreground-sink :bucket (bucket-id gmerc-tfrag-tex) :foreground-output-bucket 1) + :tfrag-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-tfrag-tex0)) + (new 'static 'generic-dma-foreground-sink :bucket (bucket-id generic-tfrag-tex0) :foreground-output-bucket 1) + ) + ) + :pris-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-pris0) :foreground-texture-page 1) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-pris0) + :foreground-texture-page 1 + :foreground-output-bucket 1 ) ) - (new 'static 'dma-foreground-sink-group - :sink - (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink :bucket (bucket-id bucket-49) :foreground-texture-page 1) - (new 'static 'generic-dma-foreground-sink - :bucket (bucket-id bucket-50) - :foreground-texture-page 1 - :foreground-output-bucket 1 - ) - ) - ) - (new 'static 'dma-foreground-sink-group - :sink - (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink :bucket (bucket-id bucket-58) :foreground-texture-page 2) - (new 'static 'generic-dma-foreground-sink - :bucket (bucket-id bucket-59) - :foreground-texture-page 2 - :foreground-output-bucket 1 - ) + ) + :water-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-water0) :foreground-texture-page 2) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-water0) + :foreground-texture-page 2 + :foreground-output-bucket 1 ) ) ) @@ -375,48 +378,48 @@ :name #f :index 1 :status 'inactive - :foreground-sink-group - (new 'static 'inline-array dma-foreground-sink-group 3 - (new 'static 'dma-foreground-sink-group - :sink - (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink :bucket (bucket-id merc-tfrag-tex1) :foreground-texture-level 1) - (new 'static 'generic-dma-foreground-sink - :bucket (bucket-id gmerc-tfrag-tex1) - :foreground-texture-level 1 - :foreground-output-bucket 1 - ) + :tfrag-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-tfrag-tex1) :foreground-texture-level 1) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-tfrag-tex1) + :foreground-texture-level 1 + :foreground-output-bucket 1 ) ) - (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket (bucket-id bucket-52) - :foreground-texture-page 1 - :foreground-texture-level 1 - ) - (new 'static 'generic-dma-foreground-sink - :bucket (bucket-id bucket-53) - :foreground-texture-page 1 - :foreground-texture-level 1 - :foreground-output-bucket 1 - ) - ) - ) - (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket (bucket-id bucket-61) - :foreground-texture-page 2 - :foreground-texture-level 1 - ) - (new 'static 'generic-dma-foreground-sink - :bucket (bucket-id bucket-62) - :foreground-texture-page 2 - :foreground-texture-level 1 - :foreground-output-bucket 1 - ) - ) - ) ) + :pris-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink + :bucket (bucket-id merc-pris1) + :foreground-texture-page 1 + :foreground-texture-level 1 + ) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-pris1) + :foreground-texture-page 1 + :foreground-texture-level 1 + :foreground-output-bucket 1 + ) + ) + ) + :water-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink + :bucket (bucket-id merc-water1) + :foreground-texture-page 2 + :foreground-texture-level 1 + ) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-water1) + :foreground-texture-page 2 + :foreground-texture-level 1 + :foreground-output-bucket 1 + ) + ) + ) :inside-sphere? #f :inside-boxes? #f :force-inside? #f @@ -426,48 +429,48 @@ :name 'default :index 2 :status 'reserved - :foreground-sink-group - (new 'static 'inline-array dma-foreground-sink-group 3 - (new 'static 'dma-foreground-sink-group - :sink - (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink :bucket (bucket-id bucket-45) :foreground-texture-level 2) - (new 'static 'generic-dma-foreground-sink - :bucket (bucket-id bucket-46) - :foreground-texture-level 2 - :foreground-output-bucket 1 - ) + :tfrag-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group + :sink + (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink :bucket (bucket-id merc-alpha-tex) :foreground-texture-level 2) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-alpha-tex) + :foreground-texture-level 2 + :foreground-output-bucket 1 ) ) - (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket (bucket-id bucket-55) - :foreground-texture-page 1 - :foreground-texture-level 2 - ) - (new 'static 'generic-dma-foreground-sink - :bucket (bucket-id bucket-56) - :foreground-texture-page 1 - :foreground-texture-level 2 - :foreground-output-bucket 1 - ) - ) - ) - (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 - (new 'static 'dma-foreground-sink - :bucket (bucket-id bucket-58) - :foreground-texture-page 2 - :foreground-texture-level 2 - ) - (new 'static 'generic-dma-foreground-sink - :bucket (bucket-id bucket-59) - :foreground-texture-page 2 - :foreground-texture-level 2 - :foreground-output-bucket 1 - ) - ) - ) ) + :pris-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink + :bucket (bucket-id merc-pris-common) + :foreground-texture-page 1 + :foreground-texture-level 2 + ) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-pris-common) + :foreground-texture-page 1 + :foreground-texture-level 2 + :foreground-output-bucket 1 + ) + ) + ) + :water-tex-foreground-sink-group + (new 'static 'dma-foreground-sink-group :sink (new 'static 'array dma-foreground-sink 3 + (new 'static 'dma-foreground-sink + :bucket (bucket-id merc-water0) + :foreground-texture-page 2 + :foreground-texture-level 2 + ) + (new 'static 'generic-dma-foreground-sink + :bucket (bucket-id generic-water0) + :foreground-texture-page 2 + :foreground-texture-level 2 + :foreground-output-bucket 1 + ) + ) + ) :inside-sphere? #f :inside-boxes? #f :force-inside? #f diff --git a/test/decompiler/reference/engine/load/loader-h_REF.gc b/test/decompiler/reference/engine/load/loader-h_REF.gc index 662456e752..83e9f74916 100644 --- a/test/decompiler/reference/engine/load/loader-h_REF.gc +++ b/test/decompiler/reference/engine/load/loader-h_REF.gc @@ -3,7 +3,7 @@ ;; definition of type load-dir (deftype load-dir (basic) - ((unknown basic :offset-assert 4) + ((lev level :offset-assert 4) (string-array (array string) :offset-assert 8) (data-array (array basic) :offset-assert 12) ) @@ -11,7 +11,7 @@ :size-assert #x10 :flag-assert #xb00000010 (:methods - (new (symbol type int basic) _type_ 0) + (new (symbol type int level) _type_ 0) (load-to-heap-by-name (_type_ string symbol kheap int) art-group 9) (set-loaded-art (_type_ art-group) art-group 10) ) @@ -25,14 +25,14 @@ :size-assert #x10 :flag-assert #xb00000010 (:methods - (new (symbol type int basic) _type_ 0) + (new (symbol type int level) _type_ 0) ) ) ;; definition for method 0 of type load-dir -(defmethod new load-dir ((allocation symbol) (type-to-make type) (length int) (unk basic)) +(defmethod new load-dir ((allocation symbol) (type-to-make type) (length int) (unk level)) (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> obj unknown) unk) + (set! (-> obj lev) unk) (set! (-> obj string-array) (the-as (array string) ((method-of-type array new) allocation array string length)) ) @@ -45,7 +45,7 @@ ;; definition for method 0 of type load-dir-art-group ;; INFO: Return type mismatch load-dir vs load-dir-art-group. -(defmethod new load-dir-art-group ((allocation symbol) (type-to-make type) (length int) (unk basic)) +(defmethod new load-dir-art-group ((allocation symbol) (type-to-make type) (length int) (unk level)) (let ((obj ((method-of-type load-dir new) allocation type-to-make length unk))) (set! (-> obj data-array content-type) art-group) (the-as load-dir-art-group obj) diff --git a/test/decompiler/reference/engine/load/loader_REF.gc b/test/decompiler/reference/engine/load/loader_REF.gc index 5c1f9425ce..c12c753e40 100644 --- a/test/decompiler/reference/engine/load/loader_REF.gc +++ b/test/decompiler/reference/engine/load/loader_REF.gc @@ -6,7 +6,7 @@ (defmethod inspect load-dir ((obj load-dir)) (local-vars (sv-16 basic)) (format #t "[~8x] ~A~%" obj (-> obj type)) - (format #t "~Tlevel: ~A~%" (-> obj unknown)) + (format #t "~Tlevel: ~A~%" (-> obj lev)) (format #t "~Tallocated-length: ~D~%" (-> obj string-array allocated-length)) (format #t "~Tlength: ~D~%" (-> obj string-array length)) (dotimes (s5-0 (-> obj string-array length)) diff --git a/test/decompiler/reference/engine/math/transformq-h_REF.gc b/test/decompiler/reference/engine/math/transformq-h_REF.gc index 546d8a71d0..dd6cc1c3e1 100644 --- a/test/decompiler/reference/engine/math/transformq-h_REF.gc +++ b/test/decompiler/reference/engine/math/transformq-h_REF.gc @@ -71,7 +71,7 @@ (global-y-angle-to-point (_type_ vector) float 23) (relative-y-angle-to-point (_type_ vector) float 24) (roll-relative-to-gravity (_type_) float 25) - (TODO-RENAME-26 (_type_ int vector float) trsqv 26) + (set-and-limit-velocity (_type_ int vector float) trsqv 26) (get-quaternion (_type_) quaternion 27) ) ) diff --git a/test/decompiler/reference/engine/sound/gsound-h_REF.gc b/test/decompiler/reference/engine/sound/gsound-h_REF.gc index ee1ebffb14..7a26b9494a 100644 --- a/test/decompiler/reference/engine/sound/gsound-h_REF.gc +++ b/test/decompiler/reference/engine/sound/gsound-h_REF.gc @@ -8,7 +8,7 @@ :size-assert #x4 :flag-assert #xa00000004 (:methods - (dummy-9 () none 9) + (unused-9 () none 9) ) )