From 80d0137dbaee07041dbe024ba3f4a55c5aeac7e0 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Mon, 5 Sep 2022 18:03:46 -0400 Subject: [PATCH] d/jak2: finish the majority of `sparticle` and `sparticle-launcher` (#1840) * sparticle-launcher * d/jak2: large amount of `sparticle-launcher` done * d/jak2: finish the majority of `sparticle` * decomp: improve format code ignoring * d/jak2: make bits unique in `sp-cpuinfo-flag` * d/jak1: revert config change --- .vscode/launch.json | 2 +- decompiler/config/jak2/all-types.gc | 302 +- decompiler/config/jak2/hacks.jsonc | 1 - decompiler/config/jak2/label_types.jsonc | 8 +- decompiler/config/jak2/stack_structures.jsonc | 28 +- decompiler/config/jak2/type_casts.jsonc | 63 +- decompiler/util/DecompilerTypeSystem.cpp | 35 +- .../jak2/engine/camera/cam-interface-h.gc | 5 + goal_src/jak2/engine/camera/camera-h.gc | 55 +- goal_src/jak2/engine/debug/debug-h.gc | 2 + goal_src/jak2/engine/draw/drawable-h.gc | 3 + goal_src/jak2/engine/gfx/ocean/ocean-h.gc | 618 ++-- .../gfx/sprite/particles/sparticle-h.gc | 42 +- .../sprite/particles/sparticle-launcher-h.gc | 30 +- .../sprite/particles/sparticle-launcher.gc | 1205 +++++++ .../engine/gfx/sprite/particles/sparticle.gc | 656 ++++ goal_src/jak2/engine/gfx/texture/texture-h.gc | 7 + goal_src/jak2/engine/level/level-h.gc | 37 +- goal_src/jak2/engine/load/loader-h.gc | 1 + .../code_retention/all_types_retention.py | 6 +- scripts/gsrc/update-gsrc-via-refs.py | 47 +- .../jak2/engine/gfx/ocean/ocean-h_REF.gc | 2 +- .../gfx/sprite/particles/sparticle-h_REF.gc | 12 +- .../particles/sparticle-launcher-h_REF.gc | 23 +- .../particles/sparticle-launcher_REF.gc | 3145 +++++++++++++++++ .../gfx/sprite/particles/sparticle_REF.gc | 812 +++++ .../jak2/engine/level/level-h_REF.gc | 36 +- test/offline/config/jak2/config.jsonc | 14 + 28 files changed, 6522 insertions(+), 675 deletions(-) create mode 100644 test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle_REF.gc diff --git a/.vscode/launch.json b/.vscode/launch.json index 197e1c8c32..7240682575 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,7 @@ "program": "${workspaceFolder}/scripts/gsrc/update-from-decomp.py", "console": "integratedTerminal", "cwd": "${workspaceFolder}", - "args": ["--game", "jak2", "--file", "sky-data"] + "args": ["--game", "jak2", "--file", "sparticle-h"] }, ] } diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index d744269502..db47a1927f 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -27,7 +27,7 @@ (define-extern global kheap) (define-extern kheap type) - +(define-extern #t symbol) ;; some types we need. (declare-type sparticle-launch-group basic) @@ -5687,14 +5687,15 @@ ) (declare-type game-text-id uint32) +(declare-type engine basic) (deftype level (basic) ((name symbol :offset-assert 4) - (load-name basic :offset-assert 8) - (nickname basic :offset-assert 12) + (load-name string :offset-assert 8) + (nickname string :offset-assert 12) (index int32 :offset-assert 16) (status symbol :offset-assert 20) - (borrow-level basic 2 :offset-assert 24) - (borrow-from-level basic :offset-assert 32) + (borrow-level level 2 :offset-assert 24) + (borrow-from-level level :offset-assert 32) (heap kheap :inline :offset-assert 48) (borrow-heap kheap 2 :inline :offset-assert 64) (bsp bsp-header :offset-assert 96) @@ -5741,24 +5742,24 @@ (texture-dirty-masks texture-mask 10 :inline :offset-assert 4576) (texture-mask texture-mask 18 :inline :offset-assert 4736) (sky-mask texture-mask :inline :offset-assert 5024) - (tfrag-masks basic :offset-assert 5040) + (tfrag-masks texture-masks-array :offset-assert 5040) (tfrag-dists pointer :offset-assert 5044) - (shrub-masks basic :offset-assert 5048) + (shrub-masks texture-masks-array :offset-assert 5048) (shrub-dists pointer :offset-assert 5052) - (alpha-masks basic :offset-assert 5056) + (alpha-masks texture-masks-array :offset-assert 5056) (alpha-dists pointer :offset-assert 5060) - (water-masks basic :offset-assert 5064) + (water-masks texture-masks-array :offset-assert 5064) (water-dists pointer :offset-assert 5068) (tfrag-last-calls int32 6 :offset-assert 5072) (texture-anim-array texture-anim-array 10 :offset-assert 5096) - (light-hash basic :offset-assert 5136) + (light-hash light-hash :offset-assert 5136) (draw-priority float :offset-assert 5140) (draw-index int32 :offset-assert 5144) - (part-engine basic :offset-assert 5148) + (part-engine engine :offset-assert 5148) (user-object basic 4 :offset-assert 5152) (loaded-text-info-count int32 :offset-assert 5168) (loaded-text-info game-text-info 8 :offset-assert 5172) - (level-type basic :offset-assert 5204) + (level-type type :offset-assert 5204) (load-order int64 :offset-assert 5208) ;; ?? @@ -7429,14 +7430,14 @@ (define-extern relocate-later (function symbol)) ;; (define-extern texture-page-login function) ;; (function texture-id (function texture-pool texture-page kheap int texture-page) kheap texture-page-dir-entry) (define-extern lookup-texture-by-id (function texture-id texture)) -;; (define-extern lookup-texture-by-id-fast function) +(define-extern lookup-texture-by-id-fast (function texture-id texture)) ;; (define-extern lookup-texture-by-name function) -;; (define-extern lookup-texture-id-by-name function) +(define-extern lookup-texture-id-by-name (function string symbol texture-id)) ;; (define-extern lookup-level-texture-by-name function) (define-extern *shader-list* pair) (define-extern *edit-shader* texture-id) ;; (define-extern link-texture-by-id function) ;; (function texture-id adgif-shader texture-page-dir-entry) -;; (define-extern adgif-shader<-texture! function) ;; (function adgif-shader texture adgif-shader) +(define-extern adgif-shader<-texture! (function adgif-shader texture adgif-shader)) ;; (define-extern adgif-shader-update! (function adgif-shader texture none)) ;; (define-extern adgif-shader<-texture-with-update! function) ;; (function adgif-shader texture adgif-shader) ;; (define-extern hack-texture function) @@ -7444,7 +7445,7 @@ (define-extern adgif-shader-login-no-remap (function adgif-shader texture)) ;; (define-extern adgif-shader-login-fast function) ;; (function adgif-shader texture) ;; (define-extern adgif-shader-login-no-remap-fast function) ;; (function adgif-shader texture) -;; (define-extern adgif-shader<-texture-simple! function) ;; (function adgif-shader texture adgif-shader) +(define-extern adgif-shader<-texture-simple! (function adgif-shader texture adgif-shader)) ;; (define-extern set-dirty-mask! "First arg is the level name off the [[*level*]]'s `default-level`" (function string int int int none)) @@ -9576,7 +9577,7 @@ :size-assert #x206c :flag-assert #x5c0000206c (:methods - (ocean-method-11 () none 11) + (ocean-method-11 (_type_ (inline-array vector) symbol) float 11) (ocean-method-12 () none 12) (ocean-method-13 () none 13) (ocean-method-14 () none 14) @@ -18277,14 +18278,20 @@ (bit2 2) ) +;; +++sparticle-launcher-h:sp-group-flag (defenum sp-group-flag :bitfield #t :type uint16 (use-local-clock 0) (always-draw 1) (screen-space 2) - (unknown-bit-01 3) ;; beach-part + (unk-3 3) ;; beach-part + (unk-4 4) + (unk-5 5) + (unk-6 6) + (unk-7 7) ) +;; ---sparticle-launcher-h:sp-group-flag (deftype sparticle-birthinfo (structure) @@ -18334,8 +18341,10 @@ :size-assert #x10 :flag-assert #xb00000010 (:methods - (sparticle-launcher-method-9 (_type_ int) uint 9) - (sparticle-launcher-method-10 (_type_) none 10) + (get-field-spec-by-id + "Returns the [[sp-field-init-spec]] that has the matching [[sp-field-id]]" + (_type_ sp-field-id) sp-field-init-spec 9) + (sparticle-launcher-method-10 (_type_ string) none 10) ) ) @@ -18398,13 +18407,13 @@ :size-assert #x40 :flag-assert #xa00000040 (:methods - (sparticle-launch-group-method-9 () none 9) ;; (create-launch-control (_type_ process) sparticle-launch-control 9) + (create-launch-control (_type_ process) sparticle-launch-control 9) ;; ) ) (deftype sparticle-launch-control (inline-array-class) ((group sparticle-launch-group :offset-assert 16) ;; guessed by decompiler - (proc process :offset-assert 20) ;; guessed by decompiler + (proc process-drawable :offset-assert 20) ;; guessed by decompiler (local-clock int32 :offset-assert 24) (fade float :offset-assert 28) (matrix int8 :offset-assert 32) ;; int32 @@ -18420,13 +18429,13 @@ :size-assert #x70 :flag-assert #x1000000070 (:methods - (sparticle-launch-control-method-9 () none 9) ;; (initialize (_type_ sparticle-launch-group process) none 9) - (sparticle-launch-control-method-10 () none 10) ;; (is-visible? (_type_ vector) symbol 10) - (sparticle-launch-control-method-11 () none 11) ;; (spawn (_type_ vector) object 11) - (sparticle-launch-control-method-12 () none 12) ;; (kill-and-free-particles (_type_) none 12) - (sparticle-launch-control-method-13 () none 13) ;; (kill-particles (_type_) none 13) - (sparticle-launch-control-method-14 () none 14) - (sparticle-launch-control-method-15 () none 15) + (initialize (_type_ sparticle-launch-group process) none 9) ;; + (sparticle-launch-control-method-10 (_type_ vector) symbol 10) ;; (is-visible? (_type_ vector) symbol 10) + (sparticle-launch-control-method-11 (_type_ vector) none 11) ;; TODO - CFG ;; (spawn (_type_ vector) object 11) + (sparticle-launch-control-method-12 (_type_ matrix) none 12) + (sparticle-launch-control-method-13 (_type_ cspace) none 13) + (kill-and-free-particles (_type_) none 14) + (kill-particles (_type_) none 15) ) ) @@ -18436,30 +18445,34 @@ ;; sparticle-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +++sparticle-h:sp-cpuinfo-flag (defenum sp-cpuinfo-flag :bitfield #t :type uint32 - (bit0 0) - (bit1 1) - (bit2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst - (bit3 3) - (bit4 4) + (sp-cpuinfo-flag-0 0) + (sp-cpuinfo-flag-1 1) + (sp-cpuinfo-flag-2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst + (sp-cpuinfo-flag-3 3) + (sp-cpuinfo-flag-4 4) + (sp-cpuinfo-flag-5 5) (ready-to-launch 6) ;; maybe just just death? (distort 7) ;; distort sprite (aux-list 8) ;; prevents relaunch, adds to aux - (bit9 9) + (sp-cpuinfo-flag-9 9) (level0 10) (level1 11) - (bit12 12) ;; required to relaunch - (bit13 13) - (bit14 14) + (sp-cpuinfo-flag-12 12) ;; required to relaunch + (sp-cpuinfo-flag-13 13) + (sp-cpuinfo-flag-14 14) (glow 15) ;; glow sprite (use-global-acc 16) (launch-along-z 17) (left-multiply-quat 18) (right-multiply-quat 19) (set-conerot 20) + (sp-cpuinfo-flag-21 21) ) +;; ---sparticle-h:sp-cpuinfo-flag (declare-type sparticle-system basic) (deftype sparticle-cpuinfo (structure) @@ -18467,18 +18480,18 @@ (adgif adgif-shader :offset-assert 4) (radius float :offset-assert 8) (omega float :offset-assert 12) - (vel-sxvel vector :inline :offset-assert 16) + (vel-sxvel vector :inline :offset-assert 16) ;; these are used interchangably as vector3s' as well (rot-syvel vector :inline :offset-assert 32) (fade rgbaf :inline :offset-assert 48) (acc vector :inline :offset-assert 64) (rotvel3d quaternion :inline :offset-assert 80) - (vel vector3s :inline :offset 16) - (accel vector3s :inline :offset 64) + (vel vector :inline :offset 16) + (accel vector :inline :offset 64) (scalevelx float :offset 28) (scalevely float :offset 44) (friction float :offset-assert 96) (timer int32 :offset-assert 100) - (flags sp-cpuinfo-flag :offset-assert 104) ;; guessed by decompiler + (flags sp-cpuinfo-flag :offset-assert 104) ;; NOTE - loaded with lw and lwu? (user-int32 int32 :offset-assert 108) (user-uint32 uint32 :offset 108) (user-float float :offset 108 :score 1) @@ -18492,7 +18505,8 @@ (valid uint8 :offset-assert 128) ;; symbol (clock-index uint8 :offset-assert 129) (user1-int16 uint16 :offset-assert 130) - (key sparticle-launch-control :offset-assert 132) ;; guessed by decompiler + (key sparticle-launch-control :offset-assert 132) + (key-alt sparticle-launch-state :offset 132) (binding sparticle-launch-state :offset-assert 136) (data uint32 1 :offset 12) ;; guessed by decompiler (datab uint8 4 :offset 12) @@ -18506,7 +18520,7 @@ ) (deftype sparticle-launchinfo (structure) - ((launchrot vector :inline :offset-assert 0) + ((launchrot vector :inline :offset-assert 0) ; NOTE - both used as a vector3s and a normal vector (conerot vector :inline :offset-assert 16) (rotate-x float :offset-assert 32) (rotate-y float :offset-assert 36) @@ -18539,6 +18553,8 @@ :method-count-assert 9 :size-assert #x34 :flag-assert #x900000034 + (:methods + (new (symbol type int int symbol pointer (inline-array adgif-shader)) _type_ 0)) ) (define-extern *sp-60-hz* symbol) @@ -18589,13 +18605,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +++camera-h:cam-index-options (defenum cam-index-options :type uint32 :bitfield #t (RADIAL) (SPHERICAL) ) +;; ---camera-h:cam-index-options +;; +++camera-h:slave-los-state (defenum slave-los-state :type uint32 (none 0) @@ -18603,6 +18622,7 @@ (ccw 2) (between 3) ) +;; ---camera-h:slave-los-state (deftype cam-index (structure) ((flags cam-index-options :offset-assert 0) ;; guessed by decompiler @@ -22813,7 +22833,6 @@ ) |# -#| (deftype sp-queued-launch-particles (structure) ((sp-system sparticle-system :offset-assert 0) ;; guessed by decompiler (sp-launcher sparticle-launcher :offset-assert 4) ;; guessed by decompiler @@ -22823,34 +22842,28 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype sp-launch-queue (basic) ((in-use int32 :offset-assert 4) - (queue sp-queued-launch-particles 256 :offset-assert 16) ;; guessed by decompiler + (queue sp-queued-launch-particles 256 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x2010 :flag-assert #x900002010 ) -|# -#| (deftype particle-adgif-cache (basic) ((used int32 :offset-assert 4) (last uint16 :offset-assert 8) (lastgif adgif-shader :offset-assert 12) (tidhash uint16 80 :offset-assert 16) ;; guessed by decompiler - (spadgif adgif-shader 80 :offset-assert 176) ;; guessed by decompiler + (spadgif adgif-shader 80 :inline :offset-assert 176) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x19b0 :flag-assert #x9000019b0 ) -|# -#| (deftype sp-launch-stack (structure) ((ra basic :offset-assert 0) (dummy0 basic :offset-assert 4) @@ -22874,105 +22887,110 @@ :flag-assert #x900000130 ;; field ra uses ~A with a signed load field dummy0 uses ~A with a signed load field dummy1 uses ~A with a signed load field b-spfic uses ~A with a signed load field l-spfic uses ~A with a signed load ) -|# (define-extern *part-id-table* (array sparticle-launcher)) (define-extern *part-group-id-table* (array sparticle-launch-group)) ;; -;; (define-extern *sp-temp* object) -;; (define-extern lookup-part-group-by-name function) ;; (function string basic) -;; (define-extern lookup-part-group-pointer-by-name function) ;; (function string (pointer sparticle-launch-group)) -(define-extern part-group-pointer? (function pointer symbol)) -;; (define-extern unlink-part-group-by-heap function) ;; (function kheap int) -;; (define-extern sp-init-fields! function) ;; (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object) -;; (define-extern *sp-launcher-lock* object) ;; symbol -;; (define-extern *sp-launch-queue* object) ;; sp-launch-queue -;; (define-extern *sp-launcher-enable* object) ;; symbol -;; (define-extern particle-setup-adgif function) ;; (function adgif-shader texture-id none) -;; (define-extern *particle-adgif-cache* object) ;; particle-adgif-cache -;; (define-extern particle-adgif-cache-flush function) -;; (define-extern particle-adgif function) ;; (function adgif-shader texture-id none) -;; (define-extern particle-adgif-callback function) -;; (define-extern sp-queue-launch function) ;; (function sparticle-system sparticle-launcher vector int) -;; (define-extern sp-adjust-launch function) ;; (function sparticle-launchinfo sparticle-cpuinfo (inline-array sp-field-init-spec) none) -;; (define-extern sp-euler-convert function) ;; (function sparticle-launchinfo sparticle-cpuinfo none) -;; (define-extern sp-rotate-system function) ;; (function sparticle-launchinfo sparticle-cpuinfo transformq none) -(define-extern sp-launch-particles-var (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none)) -;; (define-extern *death-adgif* object) ;; adgif-shader -;; (define-extern sp-launch-particles-death function) ;; (function sparticle-system sparticle-launcher vector none) -;; (define-extern sp-clear-queue function) ;; (function none) -;; (define-extern sp-relaunch-setup-fields function) ;; (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none) -;; (define-extern sp-relaunch-particle-2d function) ;; (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none) -;; (define-extern sp-relaunch-particle-3d function) ;; (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none) -(define-extern execute-part-engine (function none)) -;; (define-extern sparticle-track-root function) ;; (function object sparticle-cpuinfo vector none) -;; (define-extern sparticle-track-root-prim function) ;; (function object sparticle-cpuinfo vector none) -;; (define-extern sparticle-track-joint function) -;; (define-extern sparticle-turn-to-vel function) -;; (define-extern birth-func-copy-rot-color function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none) -;; (define-extern *global-toggle* object) ;; int -;; (define-extern birth-func-copy2-rot-color function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none) -;; (define-extern birth-func-copy-omega-to-z function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none) -;; (define-extern birth-func-random-next-time function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none) -;; (define-extern sparticle-respawn-heights function) -;; (define-extern sparticle-respawn-timer function) -;; (define-extern sparticle-texture-animate function) -;; (define-extern sparticle-texture-day-night function) -;; (define-extern sparticle-mode-animate function) -;; (define-extern sparticle-motion-blur function) -;; (define-extern sparticle-motion-blur-old function) -;; (define-extern sparticle-set-conerot function) -;; (define-extern sparticle-next-on-mode-1 function) -;; (define-extern check-ground-bounce function) -;; (define-extern check-drop-group-center function) -;; (define-extern birth-func-y->userdata function) ;; (function sparticle-system sparticle-cpuinfo matrix none) -;; (define-extern birth-func-ocean-height function) ;; (function sparticle-system sparticle-cpuinfo matrix none) -;; (define-extern birth-func-camera-orient function) -(define-extern *particle-quat* quaternion) -;; (define-extern birth-func-set-quat function) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) -;; (define-extern *particle-vel* object) -;; (define-extern birth-func-set-vel function) -;; (define-extern birth-func-texture-group function) +(define-extern *sp-temp* int) +(define-extern lookup-part-group-by-name + "Iterate through the [[*part-group-id-table*]] and return the matching [[sparticle-launch-group]], or [[#f]] otherwise" + (function string sparticle-launch-group)) +(define-extern lookup-part-group-pointer-by-name + "Similar to [[lookup-part-group-by-name]] but returns a pointer instead" + (function string (pointer object))) ;; +(define-extern part-group-pointer? + "Verifies if the given pointer, points to a [[sparticle-launch-group]]" + (function pointer symbol)) +(define-extern unlink-part-group-by-heap (function kheap int)) ;; +(define-extern sp-init-fields! (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object)) ;; TODO - mips2c +(define-extern *sp-launcher-lock* symbol) ;; +(define-extern *sp-launch-queue* sp-launch-queue) ;; +(define-extern *sp-launcher-enable* symbol) ;; +;; (define-extern particle-setup-adgif (function adgif-shader texture-id none)) ;; TODO - assertion failure +(define-extern *particle-adgif-cache* particle-adgif-cache) ;; +(define-extern particle-adgif-cache-flush "Clear [[*particle-adgif-cache*]]" (function none)) +(define-extern particle-adgif (function adgif-shader texture-id none)) ;; TODO - particle-adgif atomic ops, MIPS2C +(define-extern particle-adgif-callback (function adgif-shader none)) ;; TODO bad VF dependencies +(define-extern sp-queue-launch (function sparticle-system sparticle-launcher matrix int)) +(define-extern sp-adjust-launch (function sparticle-launchinfo sparticle-cpuinfo (inline-array sp-field-init-spec) matrix symbol none)) ;; +(define-extern sp-euler-convert (function sparticle-launchinfo sparticle-cpuinfo none)) ;; +(define-extern sp-rotate-system (function sparticle-launchinfo sparticle-cpuinfo transformq none)) ;; +(define-extern sp-launch-particles-var (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none)) ;; TODO - mips2c +(define-extern *death-adgif* adgif-shader) ;; +(define-extern sp-launch-particles-death (function sparticle-system sparticle-launcher vector none)) ;; +(define-extern sp-clear-queue (function none)) ;; +(define-extern sp-relaunch-setup-fields (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;; +(define-extern sp-relaunch-particle-2d (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;; +(define-extern sp-relaunch-particle-3d (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) ;; +(define-extern execute-part-engine (function none)) ;; TODO - whats the basic off the connection? +(define-extern sparticle-track-root (function object sparticle-cpuinfo vector none)) ;; +(define-extern sparticle-track-root-prim (function object sparticle-cpuinfo vector none)) ;; +(define-extern sparticle-track-joint (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern sparticle-turn-to-vel (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d none)) +(define-extern birth-func-copy-rot-color (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;; +(define-extern *global-toggle* int) ;; +(define-extern birth-func-copy2-rot-color (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;; +(define-extern birth-func-copy-omega-to-z (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;; +(define-extern birth-func-random-next-time (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none)) ;; +(define-extern sparticle-respawn-heights (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern sparticle-respawn-timer (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern sparticle-texture-animate (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern sparticle-texture-day-night (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern sparticle-mode-animate (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern sparticle-motion-blur (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern sparticle-motion-blur-old "Unused" (function object sparticle-cpuinfo sprite-vec-data-3d object)) +(define-extern sparticle-set-conerot (function sparticle-launcher vector none)) +(define-extern sparticle-next-on-mode-1 (function sparticle-system sparticle-cpuinfo sparticle-launchinfo float)) +(define-extern check-ground-bounce (function sparticle-system sparticle-cpuinfo sparticle-launchinfo float)) +(define-extern check-drop-group-center (function sparticle-system sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern birth-func-y->userdata (function sparticle-system sparticle-cpuinfo matrix none)) ;; +(define-extern birth-func-ocean-height (function sparticle-system sparticle-cpuinfo matrix none)) ;; +(define-extern birth-func-camera-orient (function int sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern *particle-quat* quaternion) ;; +(define-extern birth-func-set-quat (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; +(define-extern *particle-vel* vector) +(define-extern birth-func-set-vel (function object sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern birth-func-texture-group (function int sparticle-cpuinfo sparticle-launchinfo none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sparticle ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern sp-particle-copy! function) ;; (function sparticle-cpuinfo sparticle-cpuinfo none) -(define-extern *sp-particle-system-2d* sparticle-system) -(define-extern *sp-particle-system-3d* sparticle-system) -;; (define-extern sp-get-block-size function) ;; (function sparticle-system int int) -;; (define-extern sp-get-approx-alloc-size function) ;; (function sparticle-system int int) -;; (define-extern sp-free-particle function) ;; (function sparticle-system int sparticle-cpuinfo sprite-vec-data-2d none) -;; (define-extern sp-get-particle function) ;; (function sparticle-system int sparticle-launch-state sparticle-cpuinfo) -;; (define-extern sp-kill-particle function) ;; (function sparticle-system sparticle-cpuinfo none) -;; (define-extern sp-orbiter function) ;; (function sparticle-system sparticle-cpuinfo vector none) -;; (define-extern sp-process-block-2d function) ;; (function sparticle-system int int int int symbol none) -;; (define-extern sp-process-block-3d function) ;; (function sparticle-system int int int int symbol none) -;; (define-extern sp-copy-to-spr function) ;; (function int pointer int none) -;; (define-extern sp-copy-from-spr function) ;; (function int pointer int none) -;; (define-extern memcpy function) ;; function -;; (define-extern sp-process-block function) ;; (function sparticle-system int sprite-array-2d int none) -;; (define-extern sp-process-particle-system function) ;; (function sparticle-system int sprite-array-2d none) -;; (define-extern *particles-flag* object) ;; symbol -;; (define-extern forall-particles-with-key-runner function) ;; (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) sparticle-system none) +(define-extern sp-particle-copy! (function sparticle-cpuinfo sparticle-cpuinfo none)) ;; +(define-extern *sp-particle-system-2d* sparticle-system) ;; +(define-extern *sp-particle-system-3d* sparticle-system) ;; sparticle-system +(define-extern sp-get-block-size (function sparticle-system int int)) ;; +(define-extern sp-get-approx-alloc-size (function sparticle-system int int)) ;; +(define-extern sp-free-particle (function sparticle-system int sparticle-cpuinfo sprite-vec-data-2d none)) ;; +(define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo)) ;; TODO - manually fixed in jak 1? gross +(define-extern sp-kill-particle (function sparticle-system sparticle-cpuinfo symbol)) ;; +(define-extern sp-orbiter (function sparticle-system sparticle-cpuinfo vector none)) ;; +(define-extern sp-process-block-2d (function sparticle-system int int int int symbol none)) ;; TODO - mips2c +(define-extern sp-process-block-3d (function sparticle-system int int int int symbol none)) ;; TODO - mips2c +(define-extern sp-copy-to-spr (function int pointer int none)) ;; TODO - these are all actually uints, but this is needed to get the casts right... +(define-extern sp-copy-from-spr (function int pointer int none)) ;; TODO - these are all actually uints, but this is needed to get the casts right... +(define-extern memcpy function) ;; TODO - was done manually as well? +(define-extern sp-process-block (function sparticle-system int sprite-array-2d int none)) ;; +(define-extern sp-process-particle-system (function sparticle-system int sprite-array-2d none)) ;; +(define-extern *particles-flag* symbol) ;; +(define-extern forall-particles-with-key-runner (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) sparticle-system none)) ;; (define-extern forall-particles-with-key (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) symbol symbol none)) -;; (define-extern sparticle-kill-it function) ;; (function sparticle-system sparticle-cpuinfo none) -;; (define-extern sparticle-kill-it-level0 function) ;; (function sparticle-system sparticle-cpuinfo none) -;; (define-extern sparticle-kill-it-level1 function) ;; (function sparticle-system sparticle-cpuinfo none) -;; (define-extern sparticle-kill-it-level2 function) -;; (define-extern sparticle-kill-it-level3 function) -;; (define-extern sparticle-kill-it-level4 function) -;; (define-extern sparticle-kill-it-level5 function) -;; (define-extern sparticle-60-to-50 function) ;; (function sparticle-system sparticle-cpuinfo pointer none) -;; (define-extern sparticle-50-to-60 function) ;; (function sparticle-system sparticle-cpuinfo pointer none) -;; (define-extern kill-all-particles-with-key function) ;; (function sparticle-launch-control none) -;; (define-extern forall-particles-runner function) ;; (function (function sparticle-system sparticle-cpuinfo pointer none) sparticle-system none) -;; (define-extern forall-particles function) ;; (function function symbol symbol none) +(define-extern sparticle-kill-it (function sparticle-system sparticle-cpuinfo none)) ;; +(define-extern sparticle-kill-it-level0 (function sparticle-system sparticle-cpuinfo none)) ;; (function sparticle-system sparticle-cpuinfo none) +(define-extern sparticle-kill-it-level1 (function sparticle-system sparticle-cpuinfo none)) ;; (function sparticle-system sparticle-cpuinfo none) +(define-extern sparticle-kill-it-level2 (function sparticle-system sparticle-cpuinfo none)) +(define-extern sparticle-kill-it-level3 (function sparticle-system sparticle-cpuinfo none)) +(define-extern sparticle-kill-it-level4 (function sparticle-system sparticle-cpuinfo none)) +(define-extern sparticle-kill-it-level5 (function sparticle-system sparticle-cpuinfo none)) +(define-extern sparticle-60-to-50 (function sparticle-system sparticle-cpuinfo pointer none)) ;; +(define-extern sparticle-50-to-60 (function sparticle-system sparticle-cpuinfo pointer none)) ;; (function sparticle-system sparticle-cpuinfo pointer none) +(define-extern kill-all-particles-with-key (function sparticle-launch-control none)) ;; +(define-extern forall-particles-runner (function (function sparticle-system sparticle-cpuinfo pointer none) sparticle-system none)) ;; +(define-extern forall-particles (function function symbol symbol none)) ;; (define-extern kill-all-particles-in-level (function level int)) -;; (define-extern all-particles-50-to-60 function) ;; (function none) -;; (define-extern all-particles-60-to-50 function) ;; (function none) -;; (define-extern remap-particle function) -;; (define-extern remap-all-particles function) +(define-extern all-particles-50-to-60 (function none)) ;; +(define-extern all-particles-60-to-50 (function none)) ;; (function none) +(define-extern remap-particle (function sparticle-system sparticle-cpuinfo pointer none)) +(define-extern remap-all-particles (function none)) (define-extern process-particles (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; entity-table ;; diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index b15261415f..d9a2614e4b 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -58,7 +58,6 @@ "(method 224 bot)", "(method 77 rapid-gunner)", // until loop without nop: - "(method 9 sparticle-launcher)", "cam-layout-entity-volume-info-create", "process-drawable-shock-skel-effect", "target-history-print", diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index a65fe2a1d5..02beca4b74 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -110,10 +110,6 @@ ["L774", "(pointer uint64)", 1], ["L775", "(pointer uint64)", 1] ], - "collide-cache": [ - ["L171", "vector"] - ], - "emerc-vu1": [ - ["L1", "vu-function"] - ] + "collide-cache": [["L171", "vector"]], + "emerc-vu1": [["L1", "vu-function"]] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index a4d7ed7d57..d383359a69 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -302,7 +302,6 @@ [32, "vector4w"] ], "cam-debug-draw-tris": [[16, "vector4w"]], - "(code die gun)": [ [16, "matrix"], [112, "vector"], @@ -340,12 +339,25 @@ [16, "matrix"], [112, "event-message-block"] ], - - "(method 14 collide-cache)": [ - [16, "bounding-box"] + + "(method 14 collide-cache)": [[16, "bounding-box"]], + "sp-adjust-launch": [[16, "matrix"]], + "sp-launch-particles-death": [[16, "matrix"]], + "sp-relaunch-particle-3d": [[16, "quaternion"]], + "execute-part-engine": [ + [16, "matrix"], + [80, "vector"] + ], + "sparticle-motion-blur-old": [ + [16, "vector"], + [32, "vector4w"], + [48, "vector4w"] + ], + "sp-orbiter": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"] ], - // placeholder - "placeholder-do-not-add-below": [], "joint-mod-ik-callback": [ [16, "matrix"], [80, "matrix"], @@ -402,5 +414,7 @@ [256, "vector"] ], "(method 13 gui-control)": [[16, ["array", "sound-id", 4]]], - "ja-play-spooled-anim": [[96, "event-message-block"]] + "ja-play-spooled-anim": [[96, "event-message-block"]], + // placeholder + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 1b6cc04bca..da2b84c05a 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -654,11 +654,6 @@ [[285, 289], "a1", "vector4w"], [[293, 298], "v1", "dma-packet"] ], - "(method 10 history)": [[[8, 10], "a1", "history-elt"]], - "(method 10 history-iterator)": [[[20, 35], "a2", "history-elt"]], - "command-get-time": [[119, "gp", "(pointer float)"]], - "command-get-param": [[122, "gp", "(pointer float)"]], - "command-get-entity": [[10, "gp", "process"]], "print-game-text": [ [225, "v1", "float"], [241, "v1", "float"] @@ -1278,15 +1273,9 @@ ], "cam-collision-record-save": [[[8, 56], "v1", "cam-collision-record"]], "(trans cam-stick)": [[157, "a0", "vector"]], - "(method 9 darkjak-info)": [ - [71, "v0", "sound-rpc-set-param"] - ], - "(trans idle board)": [ - [4, "a0", "target"] - ], - "(trans hidden board)": [ - [4, "a0", "target"] - ], + "(method 9 darkjak-info)": [[71, "v0", "sound-rpc-set-param"]], + "(trans idle board)": [[4, "a0", "target"]], + "(trans hidden board)": [[4, "a0", "target"]], "(trans use board)": [ [8, "a0", "target"], [22, "a1", "target"] @@ -1300,16 +1289,12 @@ [62, "a0", "target"], [94, "v1", "target"] ], - "(code use board)": [ - [17, "v1", "art-joint-anim"] - ], + "(code use board)": [[17, "v1", "art-joint-anim"]], "(code idle board)": [ [19, "v1", "art-joint-anim"], [37, "v1", "art-joint-anim"] ], - "gun-init": [ - [85, "a1", "target"] - ], + "gun-init": [[85, "a1", "target"]], "gun-post": [ [7, "a0", "target"], [12, "gp", "target"], @@ -1332,12 +1317,8 @@ [148, "gp", "target"], [169, "a0", "target"] ], - "(trans hidden gun)": [ - [4, "a0", "target"] - ], - "(code idle gun)": [ - [16, "v1", "art-joint-anim"] - ], + "(trans hidden gun)": [[4, "a0", "target"]], + "(code idle gun)": [[16, "v1", "art-joint-anim"]], "(trans idle gun)": [ [2, "v1", "target"], [9, "a0", "target"], @@ -1433,8 +1414,30 @@ [46, "a0", "(pointer gs-reg64)"], [[49, 61], "v1", "dma-packet"] ], - // placeholder - "placeholder-do-not-add-below": [], + "sparticle-track-root-prim": [[3, "v1", "collide-shape"]], + "(method 10 sparticle-launcher)": [[41, "gp", "(array float)"]], + "birth-func-texture-group": [[3, "s5", "(pointer int32)"]], + "(method 9 sparticle-launch-control)": [[22, "a2", "process-drawable"]], + "execute-part-engine": [ + [11, "v1", "connection"], + [137, "a3", "vector"] + ], + "(method 2 sparticle-cpuinfo)": [[14, "f0", "float"]], + "sp-kill-particle": [ + [7, "a1", "uint"], + [7, "v1", "uint"] + ], + "sp-orbiter": [[[78, 89], "v1", "sprite-vec-data-2d"]], + "forall-particles-with-key-runner": [ + [32, "s3", "(inline-array sparticle-cpuinfo)"], + [42, "s3", "(inline-array sparticle-cpuinfo)"] + ], + "forall-particles-runner": [ + [[19, 28], "s4", "sparticle-cpuinfo"], + [34, "s4", "pointer"], + [35, "s3", "pointer"] + ], + "sp-process-particle-system": [[14, "a1", "vector"]], "drawable-load": [[[25, 28], "s5", "drawable"]], "art-load": [[[13, 16], "s5", "art"]], "art-group-load-check": [[[43, 53], "s3", "art-group"]], @@ -1474,5 +1477,7 @@ [44, "v1", "gui-connection"], [14, "v1", "gui-connection"] ], - "(method 10 gui-control)": [[[4, 32], "s3", "gui-connection"]] + "(method 10 gui-control)": [[[4, 32], "s3", "gui-connection"]], + // placeholder + "placeholder-do-not-add-below": [] } diff --git a/decompiler/util/DecompilerTypeSystem.cpp b/decompiler/util/DecompilerTypeSystem.cpp index d830dc02f6..374c488f45 100644 --- a/decompiler/util/DecompilerTypeSystem.cpp +++ b/decompiler/util/DecompilerTypeSystem.cpp @@ -420,32 +420,31 @@ int DecompilerTypeSystem::get_format_arg_count(const std::string& str) const { return bad_it->second; } - static const std::vector single_char_ignore_list = {'%', 'T'}; - static const std::vector multi_char_ignore_list = { - "0L", "1L", "3L", "1k", "1K", "2j", "0k", "0K", "30L", "1T", "2T"}; + static const std::vector code_ignore_list = { + "%", "T", "0L", "1L", "3L", "1k", "1K", "2j", + "0k", "0K", "30L", "1T", "2T", "100h", "200h", "350h"}; int arg_count = 0; for (size_t i = 0; i < str.length(); i++) { if (str.at(i) == '~') { i++; // also eat the next character. - // Check for codes that take no args bool code_takes_no_arg = false; - for (char c : single_char_ignore_list) { - if (i < str.length() && str.at(i) == c) { - code_takes_no_arg = true; - break; + for (auto& ignored_code : code_ignore_list) { + int j = i; + bool match = true; + for (const char c : ignored_code) { + if (j > str.length()) { + match = false; + break; + } + if (str.at(j) != c) { + match = false; + break; + } + j++; } - } - - for (auto& code : multi_char_ignore_list) { - if (i + 1 < str.length() && code.length() == 2 && (str.at(i) == code.at(0)) && - str.at(i + 1) == code.at(1)) { - code_takes_no_arg = true; - break; - } - if (i + 2 < str.length() && code.length() == 3 && (str.at(i) == code.at(0)) && - str.at(i + 1) == code.at(1) && str.at(i + 2) == code.at(2)) { + if (match) { code_takes_no_arg = true; break; } diff --git a/goal_src/jak2/engine/camera/cam-interface-h.gc b/goal_src/jak2/engine/camera/cam-interface-h.gc index c7ae89403a..d643e1000e 100644 --- a/goal_src/jak2/engine/camera/cam-interface-h.gc +++ b/goal_src/jak2/engine/camera/cam-interface-h.gc @@ -7,6 +7,11 @@ (define-extern camera-pos (function vector)) +;; NOTE - for sparticle-launcher +(define-extern math-camera-matrix + "Returns [[*math-camera*]]'s `inv-camera-rot`" + (function matrix)) + ;; DECOMP BEGINS (define-perm *camera-init-mat* matrix #f) diff --git a/goal_src/jak2/engine/camera/camera-h.gc b/goal_src/jak2/engine/camera/camera-h.gc index 97d25210e1..cad4804b49 100644 --- a/goal_src/jak2/engine/camera/camera-h.gc +++ b/goal_src/jak2/engine/camera/camera-h.gc @@ -5,13 +5,16 @@ ;; name in dgo: camera-h ;; dgos: ENGINE, GAME +;; +++cam-index-options (defenum cam-index-options :type uint32 :bitfield #t (RADIAL) (SPHERICAL) ) +;; ---cam-index-options +;; +++slave-los-state (defenum slave-los-state :type uint32 (none 0) @@ -19,21 +22,7 @@ (ccw 2) (between 3) ) - -(defenum camera-slave-options - :type uint32 - :bitfield #t - (butt-cam) - (same-side) - (move-spherical) - (allow-z-rot) - (pitch-for-jump) - (collide) - (find-hidden-target) - (drag) - (line-of-sight) - (no-rotate) - (sticky-angle)) +;; ---slave-los-state ;; +++camera-blend-to-type (defenum camera-blend-to-type @@ -41,7 +30,7 @@ (unknown-0 0) (unknown-1 1) (unknown-2 2)) -;; ---camera-h:camera-blend-to-type +;; ---camera-blend-to-type ;; NOTE - for settings (declare-type camera-slave process) @@ -387,26 +376,28 @@ :size-assert #xa94 :flag-assert #xe0a200a94 (:states - cam-really-fixed - cam-fixed - cam-fixed-read-entity - cam-pov - cam-pov180 - cam-pov-track - cam-standoff - cam-standoff-read-entity - cam-eye - cam-spline + cam-bike + cam-circular cam-decel cam-endlessfall - cam-circular + cam-eye + cam-fixed + cam-fixed-read-entity + cam-free-floating cam-lookat - cam-string - cam-stick - cam-bike - cam-robotboss ;; TODO - state docstrings "A holdout from jak 1?" cam-point-watch - cam-free-floating)) + cam-pov + cam-pov-track + cam-pov180 + cam-really-fixed + cam-robotboss + cam-spline + cam-standoff + cam-standoff-read-entity + cam-stick + cam-string + ) + ) (deftype camera-master (process) diff --git a/goal_src/jak2/engine/debug/debug-h.gc b/goal_src/jak2/engine/debug/debug-h.gc index 69df3694ce..854c425cc2 100644 --- a/goal_src/jak2/engine/debug/debug-h.gc +++ b/goal_src/jak2/engine/debug/debug-h.gc @@ -10,6 +10,8 @@ ;; NOTE - for cam-debug (define-extern transform-float-point (function vector vector4w vector4w)) (define-extern add-debug-line (function symbol bucket-id vector vector rgba symbol rgba symbol)) +;; NOTE - for sparticle-launcher +(define-extern add-debug-sphere (function symbol bucket-id vector float rgba symbol)) (define-extern add-debug-line2d (function symbol bucket-id vector vector vector symbol)) diff --git a/goal_src/jak2/engine/draw/drawable-h.gc b/goal_src/jak2/engine/draw/drawable-h.gc index e4cd42c3f6..a698afe7e5 100644 --- a/goal_src/jak2/engine/draw/drawable-h.gc +++ b/goal_src/jak2/engine/draw/drawable-h.gc @@ -5,6 +5,9 @@ ;; name in dgo: drawable-h ;; dgos: ENGINE, GAME +;; NOTE - for sparticle-launcher +(define-extern sphere-in-view-frustum? (function sphere symbol)) + ;; DECOMP BEGINS (deftype drawable (basic) diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-h.gc b/goal_src/jak2/engine/gfx/ocean/ocean-h.gc index fd973a8536..2dd1f806c5 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-h.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-h.gc @@ -19,6 +19,7 @@ :flag-assert #x900000050 ) + (deftype ocean-wave-info (structure) ((frequency float :offset-assert 0) (amplitude float :offset-assert 4) @@ -34,6 +35,7 @@ :flag-assert #x900000020 ) + (deftype ocean-vertex (structure) ((pos vector :inline :offset-assert 0) (stq vector :inline :offset-assert 16) @@ -44,6 +46,7 @@ :flag-assert #x900000030 ) + (deftype ocean-spheres (structure) ((spheres sphere 36 :inline :offset-assert 0) ) @@ -52,6 +55,7 @@ :flag-assert #x900000240 ) + (deftype ocean-colors (structure) ((colors rgba 2548 :offset-assert 0) ) @@ -60,6 +64,7 @@ :flag-assert #x9000027d0 ) + (deftype ocean-colors-float (structure) ((colors vector 2548 :inline :offset-assert 0) ) @@ -68,6 +73,7 @@ :flag-assert #x900009f40 ) + (deftype ocean-mid-mask (structure) ((mask uint8 8 :offset-assert 0) (dword uint64 :offset 0) @@ -78,6 +84,7 @@ :flag-assert #x900000008 ) + (deftype ocean-mid-indices (basic) ((data uint16 36 :offset-assert 4) ) @@ -86,6 +93,7 @@ :flag-assert #x90000004c ) + (deftype ocean-mid-masks (basic) ((data (inline-array ocean-mid-mask) :offset-assert 4) ) @@ -94,6 +102,7 @@ :flag-assert #x900000008 ) + (deftype ocean-trans-mask (structure) ((mask uint8 4 :offset-assert 0) (word int32 :offset 0) @@ -103,6 +112,7 @@ :flag-assert #x900000004 ) + (deftype ocean-trans-index (structure) ((parent int16 :offset-assert 0) (child int16 :offset-assert 2) @@ -113,6 +123,7 @@ :flag-assert #x900000004 ) + (deftype ocean-trans-indices (basic) ((data ocean-trans-index 2304 :inline :offset-assert 4) ) @@ -121,6 +132,7 @@ :flag-assert #x900002404 ) + (deftype ocean-near-index (structure) ((data uint16 16 :offset-assert 0) ) @@ -129,6 +141,7 @@ :flag-assert #x900000020 ) + (deftype ocean-near-indices (basic) ((data (inline-array ocean-near-index) :offset-assert 4) ) @@ -137,6 +150,7 @@ :flag-assert #x900000008 ) + (deftype ocean-near-colors (structure) ((color0 vector :inline :offset-assert 0) (color1 vector :inline :offset-assert 16) @@ -148,6 +162,7 @@ :flag-assert #x900000040 ) + (deftype ocean-trans-strip (structure) ((verts uint128 10 :offset-assert 0) ) @@ -156,6 +171,7 @@ :flag-assert #x9000000a0 ) + (deftype ocean-trans-strip-array (structure) ((data ocean-trans-strip 4 :inline :offset-assert 0) ) @@ -164,6 +180,7 @@ :flag-assert #x900000280 ) + (deftype ocean-wave-data (structure) ((data uint8 1024 :offset-assert 0) ) @@ -172,6 +189,7 @@ :flag-assert #x900000400 ) + (deftype ocean-wave-frames (structure) ((frame ocean-wave-data 64 :inline :offset-assert 0) ) @@ -180,6 +198,7 @@ :flag-assert #x900000000 ) + (deftype ocean-texture-constants (structure) ((giftag gs-gif-tag :inline :offset-assert 0) (buffers vector4w :inline :offset-assert 16) @@ -194,6 +213,7 @@ :flag-assert #x900000070 ) + (deftype ocean-mid-vertex (structure) ((stq vector :inline :offset-assert 0) (col vector :inline :offset-assert 16) @@ -204,6 +224,7 @@ :flag-assert #x900000030 ) + (deftype ocean-mid-constants (structure) ((hmge-scale vector :inline :offset-assert 0) (inv-hmge-scale vector :inline :offset-assert 16) @@ -232,6 +253,7 @@ :flag-assert #x900000240 ) + (deftype ocean-mid-upload (structure) ((rot matrix :inline :offset-assert 0) (matrix matrix :inline :offset-assert 64) @@ -243,6 +265,7 @@ :flag-assert #x900000760 ) + (deftype ocean-mid-upload2 (structure) ((rot matrix :inline :offset-assert 0) (matrix matrix :inline :offset-assert 64) @@ -262,6 +285,7 @@ :flag-assert #x900000230 ) + (deftype ocean-mid-work (structure) ((env0 vector :inline :offset-assert 0) (env1 vector :inline :offset-assert 16) @@ -276,6 +300,7 @@ :flag-assert #x900000160 ) + (deftype ocean-near-constants (structure) ((hmge-scale vector :inline :offset-assert 0) (inv-hmge-scale vector :inline :offset-assert 16) @@ -309,6 +334,7 @@ :flag-assert #x900000250 ) + (deftype ocean-near-upload (structure) ((rot matrix :inline :offset-assert 0) (matrix matrix :inline :offset-assert 64) @@ -322,6 +348,7 @@ :flag-assert #x900000100 ) + (deftype ocean-near-vertex (structure) ((stq vector :inline :offset-assert 0) (clr vector :inline :offset-assert 16) @@ -332,6 +359,7 @@ :flag-assert #x900000030 ) + (deftype ocean-near-work (structure) ((verts-ptr vector :inline :offset-assert 0) (indices uint128 16 :offset-assert 16) @@ -341,6 +369,7 @@ :flag-assert #x900000110 ) + (deftype ocean-height-array (structure) ((data float 1024 :offset-assert 0) ) @@ -349,6 +378,7 @@ :flag-assert #x900001000 ) + (deftype ocean-vert-array (structure) ((data vector 2048 :inline :offset-assert 0) ) @@ -357,6 +387,7 @@ :flag-assert #x900008000 ) + (deftype ocean-map (structure) ((start-corner vector :inline :offset-assert 0) (far-color vector :inline :offset-assert 16) @@ -376,6 +407,7 @@ ) ) + (deftype ocean (ocean-map) ((off basic :offset-assert 56) (near-off basic :offset-assert 60) @@ -476,7 +508,7 @@ :size-assert #x206c :flag-assert #x5c0000206c (:methods - (ocean-method-11 () none 11) + (ocean-method-11 (_type_ (inline-array vector) symbol) float 11) (ocean-method-12 () none 12) (ocean-method-13 () none 13) (ocean-method-14 () none 14) @@ -560,349 +592,255 @@ ) ) + (define *ocean-map* (the-as ocean-map #f)) -(define *ocean* - (new 'static 'ocean - :sprite-tmpl (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) +(define *ocean* (new 'static 'ocean + :sprite-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x508b400000008001 #x53531) + ) + :sprite-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x3023400000008001 #x551) + ) + :sprite-tmpl3 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x53531) + ) + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :line-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x141 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x141 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x5008c00000008040 #x52521) + ) + :sun-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x502b400000008001 #x52521) + ) + :erase-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x3003400000008001 #x551) + ) + :haze-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x45 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x45 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x4026400000008011 #x4141) + ) + :cloud-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x25 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x25 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x602e400000008006 #x421421) + ) + :clut-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x41 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x41 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x800000000008040 #x0) + ) + :constant (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + :haze-verts (new 'static 'inline-array vector4w 32 + (new 'static 'vector4w :x #x400 :y #x5c0 :z #xffffff) + (new 'static 'vector4w :x #x400 :y #x600 :z #xffffff) + (new 'static 'vector4w :x #x4a0 :y #x590 :z #xffffff) + (new 'static 'vector4w :x #x4c0 :y #x5e0 :z #xffffff) + (new 'static 'vector4w :x #x530 :y #x530 :z #xffffff) + (new 'static 'vector4w :x #x560 :y #x560 :z #xffffff) + (new 'static 'vector4w :x #x590 :y #x4a0 :z #xffffff) + (new 'static 'vector4w :x #x5e0 :y #x4c0 :z #xffffff) + (new 'static 'vector4w :x #x5c0 :y #x3f0 :z #xffffff) + (new 'static 'vector4w :x #x600 :y #x3f0 :z #xffffff) + (new 'static 'vector4w :x #x590 :y #x350 :z #xffffff) + (new 'static 'vector4w :x #x5e0 :y #x330 :z #xffffff) + (new 'static 'vector4w :x #x530 :y #x2c0 :z #xffffff) + (new 'static 'vector4w :x #x560 :y #x290 :z #xffffff) + (new 'static 'vector4w :x #x4a0 :y #x260 :z #xffffff) + (new 'static 'vector4w :x #x4c0 :y #x210 :z #xffffff) + (new 'static 'vector4w :x #x3f0 :y #x240 :z #xffffff) + (new 'static 'vector4w :x #x3f0 :y #x1f0 :z #xffffff) + (new 'static 'vector4w :x #x350 :y #x260 :z #xffffff) + (new 'static 'vector4w :x #x330 :y #x210 :z #xffffff) + (new 'static 'vector4w :x #x2c0 :y #x2c0 :z #xffffff) + (new 'static 'vector4w :x #x290 :y #x290 :z #xffffff) + (new 'static 'vector4w :x #x260 :y #x350 :z #xffffff) + (new 'static 'vector4w :x #x210 :y #x330 :z #xffffff) + (new 'static 'vector4w :x #x240 :y #x400 :z #xffffff) + (new 'static 'vector4w :x #x1f0 :y #x400 :z #xffffff) + (new 'static 'vector4w :x #x260 :y #x4a0 :z #xffffff) + (new 'static 'vector4w :x #x210 :y #x4c0 :z #xffffff) + (new 'static 'vector4w :x #x2c0 :y #x530 :z #xffffff) + (new 'static 'vector4w :x #x290 :y #x560 :z #xffffff) + (new 'static 'vector4w :x #x350 :y #x590 :z #xffffff) + (new 'static 'vector4w :x #x330 :y #x5e0 :z #xffffff) + ) + :cloud-verts (new 'static 'inline-array vector4w 36 + (new 'static 'vector4w :x #x290 :y #x290 :z #xffffff) + (new 'static 'vector4w :x #x310 :y #x230 :z #xffffff) + (new 'static 'vector4w :x #x3a0 :y #x200 :z #xffffff) + (new 'static 'vector4w :x #x450 :y #x200 :z #xffffff) + (new 'static 'vector4w :x #x4e0 :y #x230 :z #xffffff) + (new 'static 'vector4w :x #x560 :y #x290 :z #xffffff) + (new 'static 'vector4w :x #x230 :y #x310 :z #xffffff) + (new 'static 'vector4w :x #x300 :y #x300 :z #xffffff) + (new 'static 'vector4w :x #x3a0 :y #x2b0 :z #xffffff) + (new 'static 'vector4w :x #x450 :y #x2b0 :z #xffffff) + (new 'static 'vector4w :x #x4f0 :y #x300 :z #xffffff) + (new 'static 'vector4w :x #x5c0 :y #x310 :z #xffffff) + (new 'static 'vector4w :x #x200 :y #x3a0 :z #xffffff) + (new 'static 'vector4w :x #x2b0 :y #x3a0 :z #xffffff) + (new 'static 'vector4w :x #x380 :y #x380 :z #xffffff) + (new 'static 'vector4w :x #x470 :y #x380 :z #xffffff) + (new 'static 'vector4w :x #x540 :y #x3a0 :z #xffffff) + (new 'static 'vector4w :x #x5f0 :y #x3a0 :z #xffffff) + (new 'static 'vector4w :x #x200 :y #x450 :z #xffffff) + (new 'static 'vector4w :x #x2b0 :y #x450 :z #xffffff) + (new 'static 'vector4w :x #x380 :y #x470 :z #xffffff) + (new 'static 'vector4w :x #x470 :y #x470 :z #xffffff) + (new 'static 'vector4w :x #x540 :y #x450 :z #xffffff) + (new 'static 'vector4w :x #x5f0 :y #x450 :z #xffffff) + (new 'static 'vector4w :x #x230 :y #x4e0 :z #xffffff) + (new 'static 'vector4w :x #x300 :y #x4f0 :z #xffffff) + (new 'static 'vector4w :x #x3a0 :y #x540 :z #xffffff) + (new 'static 'vector4w :x #x450 :y #x540 :z #xffffff) + (new 'static 'vector4w :x #x4f0 :y #x4f0 :z #xffffff) + (new 'static 'vector4w :x #x5c0 :y #x4e0 :z #xffffff) + (new 'static 'vector4w :x #x290 :y #x560 :z #xffffff) + (new 'static 'vector4w :x #x310 :y #x5c0 :z #xffffff) + (new 'static 'vector4w :x #x3a0 :y #x5f0 :z #xffffff) + (new 'static 'vector4w :x #x450 :y #x5f0 :z #xffffff) + (new 'static 'vector4w :x #x4e0 :y #x5c0 :z #xffffff) + (new 'static 'vector4w :x #x560 :y #x560 :z #xffffff) + ) + :cloud-nrms (new 'static 'inline-array vector 36 + (new 'static 'vector :x -0.4999 :y 0.7071 :z -0.5) + (new 'static 'vector :x -0.3209 :y 0.7071 :z -0.63) + (new 'static 'vector :x -0.1105 :y 0.7071 :z -0.6984) + (new 'static 'vector :x 0.1105 :y 0.7071 :z -0.6983) + (new 'static 'vector :x 0.321 :y 0.7071 :z -0.63) + (new 'static 'vector :x 0.5 :y 0.7071 :z -0.4999) + (new 'static 'vector :x -0.63 :y 0.7071 :z -0.321) + (new 'static 'vector :x -0.3921 :y 0.832 :z -0.3922) + (new 'static 'vector :x -0.1434 :y 0.832 :z -0.5358) + (new 'static 'vector :x 0.1435 :y 0.832 :z -0.5357) + (new 'static 'vector :x 0.3922 :y 0.832 :z -0.3921) + (new 'static 'vector :x 0.63 :y 0.7071 :z -0.3209) + (new 'static 'vector :x -0.6983 :y 0.7071 :z -0.1106) + (new 'static 'vector :x -0.5357 :y 0.832 :z -0.1435) + (new 'static 'vector :x -0.334 :y 0.8814 :z -0.334) + (new 'static 'vector :x 0.334 :y 0.8814 :z -0.334) + (new 'static 'vector :x 0.5358 :y 0.832 :z -0.1434) + (new 'static 'vector :x 0.6984 :y 0.7071 :z -0.1105) + (new 'static 'vector :x -0.6984 :y 0.7071 :z 0.1105) + (new 'static 'vector :x -0.5358 :y 0.832 :z 0.1435) + (new 'static 'vector :x -0.334 :y 0.8814 :z 0.334) + (new 'static 'vector :x 0.334 :y 0.8814 :z 0.334) + (new 'static 'vector :x 0.5357 :y 0.832 :z 0.1435) + (new 'static 'vector :x 0.6983 :y 0.7071 :z 0.1105) + (new 'static 'vector :x -0.63 :y 0.7071 :z 0.321) + (new 'static 'vector :x -0.3922 :y 0.832 :z 0.3921) + (new 'static 'vector :x -0.1435 :y 0.832 :z 0.5357) + (new 'static 'vector :x 0.1435 :y 0.832 :z 0.5358) + (new 'static 'vector :x 0.3922 :y 0.832 :z 0.3922) + (new 'static 'vector :x 0.63 :y 0.7071 :z 0.321) + (new 'static 'vector :x -0.5 :y 0.7071 :z 0.4999) + (new 'static 'vector :x -0.321 :y 0.7071 :z 0.63) + (new 'static 'vector :x -0.1106 :y 0.7071 :z 0.6983) + (new 'static 'vector :x 0.1105 :y 0.7071 :z 0.6984) + (new 'static 'vector :x 0.321 :y 0.7071 :z 0.63) + (new 'static 'vector :x 0.4999 :y 0.7071 :z 0.5) + ) + :color80808080 (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) + :color80808040 (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w 64) + :color80808000 (new 'static 'vector4w :x #x80 :y #x80 :z #x80) + :st0000 (new 'static 'vector :z 1.0) + :st0505 (new 'static 'vector :x 0.5 :y 0.5 :z 1.0) + :st1010 (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + :uv44 (new 'static 'vector4w :x 64 :y 64) + :uv88 (new 'static 'vector4w :x #x80 :y #x80) + :uv1010 (new 'static 'vector4w :x #x100 :y #x100) + :uv2020 (new 'static 'vector4w :x #x200 :y #x200) + :uv4040 (new 'static 'vector4w :x #x400 :y #x400) + :uv8080 (new 'static 'vector4w :x #x800 :y #x800) + :xy00 (new 'static 'vector4w :z #xffffff) + :xy88 (new 'static 'vector4w :x #x80 :y #x80 :z #xffffff) + :xy1010 (new 'static 'vector4w :x #x100 :y #x100 :z #xffffff) + :xy2020 (new 'static 'vector4w :x #x200 :y #x200 :z #xffffff) + :xy4040 (new 'static 'vector4w :x #x400 :y #x400 :z #xffffff) + :xy8080 (new 'static 'vector4w :x #x800 :y #x800 :z #xffffff) + :cloud-alpha (new 'static 'array uint8 36 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + #x80 + ) + :tex1 #xeed00080178 + :tex1-near #xeed0008016c + :scales (new 'static 'vector :x -0.00012207031 :y 255.0 :z -0.00012207031 :w 128.0) + :mask-hi (new 'static 'vector4w :x -65536 :y -65536 :z -65536 :w -65536) + :mask-lo (new 'static 'vector4w :x #xffff :y #xffff :z #xffff :w #xffff) + ) ) - :gif0 (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type sprite) :tme #x1 :fst #x1) - :nreg #x5 - ) - :gif1 (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id uv) - :regs2 (gif-reg-id xyz2) - :regs3 (gif-reg-id uv) - :regs4 (gif-reg-id xyz2) - ) - ) - :sprite-tmpl2 (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type sprite) :abe #x1) - :nreg #x3 - ) - :gif1 (new 'static 'gif-tag-regs :regs0 (gif-reg-id rgbaq) :regs1 (gif-reg-id xyz2) :regs2 (gif-reg-id xyz2)) - ) - :sprite-tmpl3 (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type sprite) :tme #x1 :abe #x1 :fst #x1) - :nreg #x5 - ) - :gif1 (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id uv) - :regs2 (gif-reg-id xyz2) - :regs3 (gif-reg-id uv) - :regs4 (gif-reg-id xyz2) - ) - ) - :adgif-tmpl (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 :nloop #x5 :eop #x1 :nreg #x1) - :gif1 (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)) - ) - :line-tmpl (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x141 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x141 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 - :nloop #x40 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type line) :tme #x1) - :nreg #x5 - ) - :gif1 (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id st) - :regs2 (gif-reg-id xyz2) - :regs3 (gif-reg-id st) - :regs4 (gif-reg-id xyz2) - ) - ) - :sun-tmpl (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type sprite) :tme #x1 :abe #x1) - :nreg #x5 - ) - :gif1 (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id st) - :regs2 (gif-reg-id xyz2) - :regs3 (gif-reg-id st) - :regs4 (gif-reg-id xyz2) - ) - ) - :erase-tmpl (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 - :nloop #x1 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type sprite)) - :nreg #x3 - ) - :gif1 (new 'static 'gif-tag-regs :regs0 (gif-reg-id rgbaq) :regs1 (gif-reg-id xyz2) :regs2 (gif-reg-id xyz2)) - ) - :haze-tmpl (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x45 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x45 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 - :nloop #x11 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe #x1) - :nreg #x4 - ) - :gif1 (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id xyzf2) - :regs2 (gif-reg-id rgbaq) - :regs3 (gif-reg-id xyzf2) - ) - ) - :cloud-tmpl (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x25 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x25 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 - :nloop #x6 - :eop #x1 - :pre #x1 - :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1) - :nreg #x6 - ) - :gif1 (new 'static 'gif-tag-regs - :regs0 (gif-reg-id rgbaq) - :regs1 (gif-reg-id st) - :regs2 (gif-reg-id xyzf2) - :regs3 (gif-reg-id rgbaq) - :regs4 (gif-reg-id st) - :regs5 (gif-reg-id xyzf2) - ) - ) - :clut-tmpl (new 'static 'dma-gif-packet - :dma-vif (new 'static 'dma-packet - :dma (new 'static 'dma-tag :qwc #x41 :id (dma-tag-id cnt)) - :vif1 (new 'static 'vif-tag :imm #x41 :cmd (vif-cmd direct) :msk #x1) - ) - :gif0 (new 'static 'gif-tag64 :nloop #x40 :eop #x1 :flg (gif-flag image)) - ) - :constant (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) - :haze-verts (new 'static 'inline-array vector4w 32 - (new 'static 'vector4w :x #x400 :y #x5c0 :z #xffffff) - (new 'static 'vector4w :x #x400 :y #x600 :z #xffffff) - (new 'static 'vector4w :x #x4a0 :y #x590 :z #xffffff) - (new 'static 'vector4w :x #x4c0 :y #x5e0 :z #xffffff) - (new 'static 'vector4w :x #x530 :y #x530 :z #xffffff) - (new 'static 'vector4w :x #x560 :y #x560 :z #xffffff) - (new 'static 'vector4w :x #x590 :y #x4a0 :z #xffffff) - (new 'static 'vector4w :x #x5e0 :y #x4c0 :z #xffffff) - (new 'static 'vector4w :x #x5c0 :y #x3f0 :z #xffffff) - (new 'static 'vector4w :x #x600 :y #x3f0 :z #xffffff) - (new 'static 'vector4w :x #x590 :y #x350 :z #xffffff) - (new 'static 'vector4w :x #x5e0 :y #x330 :z #xffffff) - (new 'static 'vector4w :x #x530 :y #x2c0 :z #xffffff) - (new 'static 'vector4w :x #x560 :y #x290 :z #xffffff) - (new 'static 'vector4w :x #x4a0 :y #x260 :z #xffffff) - (new 'static 'vector4w :x #x4c0 :y #x210 :z #xffffff) - (new 'static 'vector4w :x #x3f0 :y #x240 :z #xffffff) - (new 'static 'vector4w :x #x3f0 :y #x1f0 :z #xffffff) - (new 'static 'vector4w :x #x350 :y #x260 :z #xffffff) - (new 'static 'vector4w :x #x330 :y #x210 :z #xffffff) - (new 'static 'vector4w :x #x2c0 :y #x2c0 :z #xffffff) - (new 'static 'vector4w :x #x290 :y #x290 :z #xffffff) - (new 'static 'vector4w :x #x260 :y #x350 :z #xffffff) - (new 'static 'vector4w :x #x210 :y #x330 :z #xffffff) - (new 'static 'vector4w :x #x240 :y #x400 :z #xffffff) - (new 'static 'vector4w :x #x1f0 :y #x400 :z #xffffff) - (new 'static 'vector4w :x #x260 :y #x4a0 :z #xffffff) - (new 'static 'vector4w :x #x210 :y #x4c0 :z #xffffff) - (new 'static 'vector4w :x #x2c0 :y #x530 :z #xffffff) - (new 'static 'vector4w :x #x290 :y #x560 :z #xffffff) - (new 'static 'vector4w :x #x350 :y #x590 :z #xffffff) - (new 'static 'vector4w :x #x330 :y #x5e0 :z #xffffff) - ) - :cloud-verts (new 'static 'inline-array vector4w 36 - (new 'static 'vector4w :x #x290 :y #x290 :z #xffffff) - (new 'static 'vector4w :x #x310 :y #x230 :z #xffffff) - (new 'static 'vector4w :x #x3a0 :y #x200 :z #xffffff) - (new 'static 'vector4w :x #x450 :y #x200 :z #xffffff) - (new 'static 'vector4w :x #x4e0 :y #x230 :z #xffffff) - (new 'static 'vector4w :x #x560 :y #x290 :z #xffffff) - (new 'static 'vector4w :x #x230 :y #x310 :z #xffffff) - (new 'static 'vector4w :x #x300 :y #x300 :z #xffffff) - (new 'static 'vector4w :x #x3a0 :y #x2b0 :z #xffffff) - (new 'static 'vector4w :x #x450 :y #x2b0 :z #xffffff) - (new 'static 'vector4w :x #x4f0 :y #x300 :z #xffffff) - (new 'static 'vector4w :x #x5c0 :y #x310 :z #xffffff) - (new 'static 'vector4w :x #x200 :y #x3a0 :z #xffffff) - (new 'static 'vector4w :x #x2b0 :y #x3a0 :z #xffffff) - (new 'static 'vector4w :x #x380 :y #x380 :z #xffffff) - (new 'static 'vector4w :x #x470 :y #x380 :z #xffffff) - (new 'static 'vector4w :x #x540 :y #x3a0 :z #xffffff) - (new 'static 'vector4w :x #x5f0 :y #x3a0 :z #xffffff) - (new 'static 'vector4w :x #x200 :y #x450 :z #xffffff) - (new 'static 'vector4w :x #x2b0 :y #x450 :z #xffffff) - (new 'static 'vector4w :x #x380 :y #x470 :z #xffffff) - (new 'static 'vector4w :x #x470 :y #x470 :z #xffffff) - (new 'static 'vector4w :x #x540 :y #x450 :z #xffffff) - (new 'static 'vector4w :x #x5f0 :y #x450 :z #xffffff) - (new 'static 'vector4w :x #x230 :y #x4e0 :z #xffffff) - (new 'static 'vector4w :x #x300 :y #x4f0 :z #xffffff) - (new 'static 'vector4w :x #x3a0 :y #x540 :z #xffffff) - (new 'static 'vector4w :x #x450 :y #x540 :z #xffffff) - (new 'static 'vector4w :x #x4f0 :y #x4f0 :z #xffffff) - (new 'static 'vector4w :x #x5c0 :y #x4e0 :z #xffffff) - (new 'static 'vector4w :x #x290 :y #x560 :z #xffffff) - (new 'static 'vector4w :x #x310 :y #x5c0 :z #xffffff) - (new 'static 'vector4w :x #x3a0 :y #x5f0 :z #xffffff) - (new 'static 'vector4w :x #x450 :y #x5f0 :z #xffffff) - (new 'static 'vector4w :x #x4e0 :y #x5c0 :z #xffffff) - (new 'static 'vector4w :x #x560 :y #x560 :z #xffffff) - ) - :cloud-nrms (new 'static 'inline-array vector 36 - (new 'static 'vector :x -0.4999 :y 0.7071 :z -0.5) - (new 'static 'vector :x -0.3209 :y 0.7071 :z -0.63) - (new 'static 'vector :x -0.1105 :y 0.7071 :z -0.6984) - (new 'static 'vector :x 0.1105 :y 0.7071 :z -0.6983) - (new 'static 'vector :x 0.321 :y 0.7071 :z -0.63) - (new 'static 'vector :x 0.5 :y 0.7071 :z -0.4999) - (new 'static 'vector :x -0.63 :y 0.7071 :z -0.321) - (new 'static 'vector :x -0.3921 :y 0.832 :z -0.3922) - (new 'static 'vector :x -0.1434 :y 0.832 :z -0.5358) - (new 'static 'vector :x 0.1435 :y 0.832 :z -0.5357) - (new 'static 'vector :x 0.3922 :y 0.832 :z -0.3921) - (new 'static 'vector :x 0.63 :y 0.7071 :z -0.3209) - (new 'static 'vector :x -0.6983 :y 0.7071 :z -0.1106) - (new 'static 'vector :x -0.5357 :y 0.832 :z -0.1435) - (new 'static 'vector :x -0.334 :y 0.8814 :z -0.334) - (new 'static 'vector :x 0.334 :y 0.8814 :z -0.334) - (new 'static 'vector :x 0.5358 :y 0.832 :z -0.1434) - (new 'static 'vector :x 0.6984 :y 0.7071 :z -0.1105) - (new 'static 'vector :x -0.6984 :y 0.7071 :z 0.1105) - (new 'static 'vector :x -0.5358 :y 0.832 :z 0.1435) - (new 'static 'vector :x -0.334 :y 0.8814 :z 0.334) - (new 'static 'vector :x 0.334 :y 0.8814 :z 0.334) - (new 'static 'vector :x 0.5357 :y 0.832 :z 0.1435) - (new 'static 'vector :x 0.6983 :y 0.7071 :z 0.1105) - (new 'static 'vector :x -0.63 :y 0.7071 :z 0.321) - (new 'static 'vector :x -0.3922 :y 0.832 :z 0.3921) - (new 'static 'vector :x -0.1435 :y 0.832 :z 0.5357) - (new 'static 'vector :x 0.1435 :y 0.832 :z 0.5358) - (new 'static 'vector :x 0.3922 :y 0.832 :z 0.3922) - (new 'static 'vector :x 0.63 :y 0.7071 :z 0.321) - (new 'static 'vector :x -0.5 :y 0.7071 :z 0.4999) - (new 'static 'vector :x -0.321 :y 0.7071 :z 0.63) - (new 'static 'vector :x -0.1106 :y 0.7071 :z 0.6983) - (new 'static 'vector :x 0.1105 :y 0.7071 :z 0.6984) - (new 'static 'vector :x 0.321 :y 0.7071 :z 0.63) - (new 'static 'vector :x 0.4999 :y 0.7071 :z 0.5) - ) - :color80808080 (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) - :color80808040 (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w 64) - :color80808000 (new 'static 'vector4w :x #x80 :y #x80 :z #x80) - :st0000 (new 'static 'vector :z 1.0) - :st0505 (new 'static 'vector :x 0.5 :y 0.5 :z 1.0) - :st1010 (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) - :uv44 (new 'static 'vector4w :x 64 :y 64) - :uv88 (new 'static 'vector4w :x #x80 :y #x80) - :uv1010 (new 'static 'vector4w :x #x100 :y #x100) - :uv2020 (new 'static 'vector4w :x #x200 :y #x200) - :uv4040 (new 'static 'vector4w :x #x400 :y #x400) - :uv8080 (new 'static 'vector4w :x #x800 :y #x800) - :xy00 (new 'static 'vector4w :z #xffffff) - :xy88 (new 'static 'vector4w :x #x80 :y #x80 :z #xffffff) - :xy1010 (new 'static 'vector4w :x #x100 :y #x100 :z #xffffff) - :xy2020 (new 'static 'vector4w :x #x200 :y #x200 :z #xffffff) - :xy4040 (new 'static 'vector4w :x #x400 :y #x400 :z #xffffff) - :xy8080 (new 'static 'vector4w :x #x800 :y #x800 :z #xffffff) - :cloud-alpha (new 'static 'array uint8 36 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - #x80 - ) - :tex1 #xeed00080178 - :tex1-near #xeed0008016c - :scales (new 'static 'vector :x -0.00012207031 :y 255.0 :z -0.00012207031 :w 128.0) - :mask-hi (new 'static 'vector4w :x -65536 :y -65536 :z -65536 :w -65536) - :mask-lo (new 'static 'vector4w :x #xffff :y #xffff :z #xffff :w #xffff) - ) - ) -;; failed to figure out what this is: 0 diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc index 5e0af7ded2..7f7d1934e4 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc @@ -7,30 +7,34 @@ (declare-type sparticle-system basic) +;; +++sp-cpuinfo-flag (defenum sp-cpuinfo-flag :bitfield #t :type uint32 - (bit0 0) - (bit1 1) - (bit2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst - (bit3 3) - (bit4 4) + (sp-cpuinfo-flag-0 0) + (sp-cpuinfo-flag-1 1) + (sp-cpuinfo-flag-2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst + (sp-cpuinfo-flag-3 3) + (sp-cpuinfo-flag-4 4) + (sp-cpuinfo-flag-5 5) (ready-to-launch 6) ;; maybe just just death? (distort 7) ;; distort sprite (aux-list 8) ;; prevents relaunch, adds to aux - (bit9 9) + (sp-cpuinfo-flag-9 9) (level0 10) (level1 11) - (bit12 12) ;; required to relaunch - (bit13 13) - (bit14 14) + (sp-cpuinfo-flag-12 12) ;; required to relaunch + (sp-cpuinfo-flag-13 13) + (sp-cpuinfo-flag-14 14) (glow 15) ;; glow sprite (use-global-acc 16) (launch-along-z 17) (left-multiply-quat 18) (right-multiply-quat 19) (set-conerot 20) + (sp-cpuinfo-flag-21 21) ) +;; ---sp-cpuinfo-flag ;; NOTE - for relocate (declare-type sparticle-system basic) @@ -38,6 +42,11 @@ (declare-type sparticle-launch-control inline-array-class) (define-extern forall-particles-with-key (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) symbol symbol none)) +;; NOTE - for sparticle-launcher +(define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo)) +(define-extern kill-all-particles-with-key (function sparticle-launch-control none)) +(define-extern sp-kill-particle (function sparticle-system sparticle-cpuinfo symbol)) + ;; DECOMP BEGINS (define *sp-60-hz* #t) @@ -52,8 +61,8 @@ (fade rgbaf :inline :offset-assert 48) (acc vector :inline :offset-assert 64) (rotvel3d quaternion :inline :offset-assert 80) - (vel vector3s :inline :offset 16) - (accel vector3s :inline :offset 64) + (vel vector :inline :offset 16) + (accel vector :inline :offset 64) (scalevelx float :offset 28) (scalevely float :offset 44) (friction float :offset-assert 96) @@ -73,6 +82,7 @@ (clock-index uint8 :offset-assert 129) (user1-int16 uint16 :offset-assert 130) (key sparticle-launch-control :offset-assert 132) + (key-alt sparticle-launch-state :offset 132) (binding sparticle-launch-state :offset-assert 136) (data uint32 1 :offset 12) (datab uint8 4 :offset 12) @@ -84,6 +94,7 @@ :flag-assert #x90000008c ) + (deftype sparticle-launchinfo (structure) ((launchrot vector :inline :offset-assert 0) (conerot vector :inline :offset-assert 16) @@ -104,6 +115,7 @@ :flag-assert #x900000040 ) + (deftype sparticle-system (basic) ((blocks int32 2 :offset-assert 4) (length int32 2 :offset-assert 12) @@ -118,6 +130,14 @@ :method-count-assert 9 :size-assert #x34 :flag-assert #x900000034 + (:methods + (new (symbol type int int symbol pointer (inline-array adgif-shader)) _type_ 0) + ) ) +0 + + + + diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc index 3649aca84e..2c81c626d5 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc @@ -119,14 +119,20 @@ (bit2 2) ) +;; +++sp-group-flag (defenum sp-group-flag :bitfield #t :type uint16 (use-local-clock 0) (always-draw 1) (screen-space 2) - (unknown-bit-01 3) ;; beach-part + (unk-3 3) ;; beach-part + (unk-4 4) + (unk-5 5) + (unk-6 6) + (unk-7 7) ) +;; ---sp-group-flag (declare-type sparticle-cpuinfo structure) @@ -181,8 +187,8 @@ :size-assert #x10 :flag-assert #xb00000010 (:methods - (sparticle-launcher-method-9 (_type_ int) uint 9) - (sparticle-launcher-method-10 (_type_) none 10) + (get-field-spec-by-id (_type_ sp-field-id) sp-field-init-spec 9) + (sparticle-launcher-method-10 (_type_ string) none 10) ) ) @@ -246,7 +252,7 @@ :size-assert #x40 :flag-assert #xa00000040 (:methods - (sparticle-launch-group-method-9 () none 9) + (create-launch-control (_type_ process) sparticle-launch-control 9) ) ) @@ -255,7 +261,7 @@ (deftype sparticle-launch-control (inline-array-class) ((group sparticle-launch-group :offset-assert 16) - (proc process :offset-assert 20) + (proc process-drawable :offset-assert 20) (local-clock int32 :offset-assert 24) (fade float :offset-assert 28) (matrix int8 :offset-assert 32) @@ -271,13 +277,13 @@ :size-assert #x70 :flag-assert #x1000000070 (:methods - (sparticle-launch-control-method-9 () none 9) - (sparticle-launch-control-method-10 () none 10) - (sparticle-launch-control-method-11 () none 11) - (sparticle-launch-control-method-12 () none 12) - (sparticle-launch-control-method-13 () none 13) - (sparticle-launch-control-method-14 () none 14) - (sparticle-launch-control-method-15 () none 15) + (initialize (_type_ sparticle-launch-group process) none 9) + (sparticle-launch-control-method-10 (_type_ vector) symbol 10) + (sparticle-launch-control-method-11 (_type_ vector) none 11) + (sparticle-launch-control-method-12 (_type_ matrix) none 12) + (sparticle-launch-control-method-13 (_type_ cspace) none 13) + (kill-and-free-particles (_type_) none 14) + (kill-particles (_type_) none 15) ) ) diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc index baf5f6baa2..5d21519236 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc @@ -5,5 +5,1210 @@ ;; name in dgo: sparticle-launcher ;; dgos: ENGINE, GAME +;; og:ignore-form:sp-relaunch-particle-3d +;; og:ignore-form:execute-part-engine +;; og:ignore-form:sparticle-respawn-heights +;; og:ignore-form:sparticle-respawn-timer +;; og:ignore-form:sparticle-mode-animate +;; og:ignore-form:sparticle-mode-animate +;; og:ignore-form:sparticle-texture-animate +;; og:ignore-form:sparticle-texture-day-night +;; og:ignore-form:sparticle-motion-blur +;; og:ignore-form:birth-func-texture-group +;; og:ignore-form:sparticle-launcher-method-10 +(define-extern sp-init-fields! (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object)) ;; TODO - mips2c + +(define-extern particle-adgif (function adgif-shader texture-id none)) ;; TODO - particle-adgif atomic ops, MIPS2C +(define-extern particle-adgif-callback (function adgif-shader none)) ;; TODO bad VF dependencies +(define-extern sp-launch-particles-var (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none)) ;; TODO - mips2c + ;; DECOMP BEGINS + +(kmemopen global "part-tables") + +(define *part-id-table* + (the-as (array sparticle-launcher) (new 'global 'boxed-array sparticle-launcher 5760)) + ) + +(define *part-group-id-table* + (the-as (array sparticle-launch-group) (new 'global 'boxed-array sparticle-launch-group 1408)) + ) + +(define *sp-temp* 0) + +(kmemclose) + +(defun lookup-part-group-by-name ((arg0 string)) + "Iterate through the [[*part-group-id-table*]] and return the matching [[sparticle-launch-group]], or [[#f]] otherwise" + (let* ((s5-0 *part-group-id-table*) + (s4-0 (-> s5-0 length)) + ) + (dotimes (s3-0 s4-0) + (let ((s2-0 (-> s5-0 s3-0))) + (if (and (nonzero? s2-0) (string= arg0 (-> s2-0 name))) + (return s2-0) + ) + ) + ) + ) + (the-as sparticle-launch-group #f) + ) + +(defun lookup-part-group-pointer-by-name ((arg0 string)) + "Similar to [[lookup-part-group-by-name]] but returns a pointer instead" + (let* ((s4-0 *part-group-id-table*) + (s3-0 (-> s4-0 length)) + ) + (dotimes (gp-0 s3-0) + (let ((v1-2 (-> s4-0 gp-0))) + (if (and (nonzero? v1-2) (string= arg0 (-> v1-2 name))) + (return (the-as (pointer object) (&+ (-> s4-0 data) (* gp-0 4)))) + ) + ) + ) + ) + (the-as (pointer sparticle-launch-group) #f) + ) + +(defun part-group-pointer? ((arg0 pointer)) + "Verifies if the given pointer, points to a [[sparticle-launch-group]]" + (let ((v1-0 *part-group-id-table*)) + (and (>= (the-as int arg0) (the-as int (-> v1-0 data))) (< (the-as int arg0) (the-as int (&-> v1-0 1408)))) + ) + ) + +(defun unlink-part-group-by-heap ((arg0 kheap)) + (let* ((v1-0 *part-group-id-table*) + (a2-0 (-> v1-0 length)) + (a1-0 (-> arg0 base)) + (a0-1 (-> arg0 top-base)) + ) + (while (nonzero? a2-0) + (+! a2-0 -1) + (let ((a3-2 (-> v1-0 a2-0))) + (when (and (>= (the-as int a3-2) (the-as int a1-0)) (< (the-as int a3-2) (the-as int a0-1))) + (set! (-> v1-0 a2-0) (the-as sparticle-launch-group 0)) + 0 + ) + ) + ) + ) + 0 + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +(deftype sp-queued-launch-particles (structure) + ((sp-system sparticle-system :offset-assert 0) + (sp-launcher sparticle-launcher :offset-assert 4) + (pos vector :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + + +(deftype sp-launch-queue (basic) + ((in-use int32 :offset-assert 4) + (queue sp-queued-launch-particles 256 :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x2010 + :flag-assert #x900002010 + ) + + +(kmemopen global "launcher-queue") + +(define *sp-launcher-lock* #f) + +(define *sp-launch-queue* (new 'global 'sp-launch-queue)) + +(define *sp-launcher-enable* #t) + +(kmemclose) + +;; ERROR: function has no type analysis. Cannot decompile. + +(deftype particle-adgif-cache (basic) + ((used int32 :offset-assert 4) + (last uint16 :offset-assert 8) + (lastgif adgif-shader :offset-assert 12) + (tidhash uint16 80 :offset-assert 16) + (spadgif adgif-shader 80 :inline :offset-assert 176) + ) + :method-count-assert 9 + :size-assert #x19b0 + :flag-assert #x9000019b0 + ) + + +(kmemopen global "part-adgif-cache") + +(define *particle-adgif-cache* (new 'global 'particle-adgif-cache)) + +(set! (-> *particle-adgif-cache* used) 0) + +(kmemclose) + +(defun particle-adgif-cache-flush () + "Clear [[*particle-adgif-cache*]]" + (set! (-> *particle-adgif-cache* used) 0) + (set! (-> *particle-adgif-cache* last) (the-as uint 0)) + 0 + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: function has no type analysis. Cannot decompile. + +(defun sp-queue-launch ((arg0 sparticle-system) (arg1 sparticle-launcher) (arg2 matrix)) + (let ((v1-0 *sp-launch-queue*)) + (when (= (-> v1-0 in-use) 256) + (format 0 "ERROR: sp-launch-particles called during processing, and queue is full~%") + (return 0) + ) + (let ((a3-5 (-> v1-0 queue (-> v1-0 in-use)))) + (set! (-> a3-5 sp-system) arg0) + (set! (-> a3-5 sp-launcher) arg1) + (set! (-> a3-5 pos quad) (-> arg2 trans quad)) + ) + (let ((v0-1 (+ (-> v1-0 in-use) 1))) + (set! (-> v1-0 in-use) v0-1) + v0-1 + ) + ) + ) + +(defun sp-adjust-launch ((arg0 sparticle-launchinfo) + (arg1 sparticle-cpuinfo) + (arg2 (inline-array sp-field-init-spec)) + (arg3 matrix) + (arg4 symbol) + ) + (let ((s2-0 (new 'stack-no-clear 'matrix)) + (s5-0 (new 'stack-no-clear 'matrix)) + ) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (sp-init-fields! (-> s2-0 vector) arg2 (sp-field-id launch-fields-start) (sp-field-id launch-fields-end) #t) + (matrix-rotate-xyz! s5-0 (the-as vector (-> s2-0 vector))) + (vector3s-matrix*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s5-0) + (matrix-rotate-xyz! s5-0 (-> s2-0 vector 1)) + (vector3s-matrix*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s5-0) + (matrix*! s5-0 s5-0 arg3) + (set-vector! s0-0 0.0 (-> s2-0 vector 2 w) 0.0 1.0) + (vector-matrix*! s0-0 s0-0 s5-0) + (+! (-> arg0 launchrot x) (-> s0-0 x)) + (+! (-> arg0 launchrot y) (-> s0-0 y)) + (+! (-> arg0 launchrot z) (-> s0-0 z)) + ) + (when (logtest? (sp-cpuinfo-flag sp-cpuinfo-flag-21) (-> arg1 flags)) + (set! (-> arg0 launchrot w) (* (-> arg0 launchrot w) (vector-length (the-as vector (-> arg3 vector))))) + (set! (-> arg0 conerot w) (* (-> arg0 conerot w) (vector-length (-> arg3 vector 1)))) + ) + (matrix-rotate-xyz! s5-0 (-> s2-0 vector 2)) + (matrix*! s5-0 s5-0 arg3) + (vector3s-rotate*! (the-as vector3s (-> arg0 launchrot)) (the-as vector3s (-> arg0 launchrot)) s5-0) + (vector3s-rotate*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s5-0) + (if (zero? (logand (sp-cpuinfo-flag use-global-acc) (-> arg1 flags))) + (vector3s-rotate*! (the-as vector3s (-> arg1 acc)) (the-as vector3s (-> arg1 acc)) s5-0) + ) + (if (logtest? (sp-cpuinfo-flag set-conerot) (-> arg1 flags)) + (set! (-> arg0 conerot y) (+ 16384.0 (vector-y-angle (-> s5-0 vector 2)))) + ) + (when arg4 + (let ((s4-1 (new 'stack-no-clear 'euler-angles))) + (matrix->eul s4-1 s5-0 13) + (set! (-> arg0 conerot x) (- (-> arg0 conerot x) (-> s4-1 y))) + (set! (-> arg0 conerot y) (- (-> arg0 conerot y) (-> s4-1 z))) + (set! (-> arg0 conerot z) (- (-> arg0 conerot z) (-> s4-1 x))) + ) + ) + ) + 0 + (none) + ) + +(defun sp-euler-convert ((arg0 sparticle-launchinfo) (arg1 sparticle-cpuinfo)) + (local-vars (v1-1 float) (v1-2 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((a1-1 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (set-vector! a1-1 (-> arg0 conerot x) (-> arg0 conerot y) (-> arg0 conerot z) 1.0) + (quaternion-zxy! s5-0 a1-1) + (cond + ((< (-> s5-0 w) 0.0) + (.lvf vf1 (&-> arg0 conerot quad)) + (.lvf vf2 (&-> s5-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg0 conerot quad) vf1) + (.mov v1-1 vf1) + ) + (else + (.lvf vf1 (&-> arg0 conerot quad)) + (.lvf vf2 (&-> s5-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg0 conerot quad) vf1) + (.mov v1-2 vf1) + ) + ) + ) + (cond + (*sp-60-hz* + (set! (-> arg1 rot-syvel x) (* 5.0 (-> arg1 rot-syvel x))) + (set! (-> arg1 rot-syvel y) (* 5.0 (-> arg1 rot-syvel y))) + (set! (-> arg1 rot-syvel z) (* 5.0 (-> arg1 rot-syvel z))) + ) + (else + (set! (-> arg1 rot-syvel x) (* 6.0 (-> arg1 rot-syvel x))) + (set! (-> arg1 rot-syvel y) (* 6.0 (-> arg1 rot-syvel y))) + (set! (-> arg1 rot-syvel z) (* 6.0 (-> arg1 rot-syvel z))) + ) + ) + (quaternion-zxy! (-> arg1 rotvel3d) (-> arg1 rot-syvel)) + 0 + (none) + ) + ) + +(defun sp-rotate-system ((arg0 sparticle-launchinfo) (arg1 sparticle-cpuinfo) (arg2 transformq)) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (let ((a1-1 (new 'stack-no-clear 'quaternion))) + (let* ((v1-0 a1-1) + (a0-1 arg2) + (f0-0 (-> a0-1 quat x)) + (f1-0 (-> a0-1 quat y)) + (f2-0 (-> a0-1 quat z)) + ) + (set! (-> v1-0 x) f0-0) + (set! (-> v1-0 y) f1-0) + (set! (-> v1-0 z) f2-0) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + ) + (quaternion->matrix s5-0 a1-1) + ) + (vector3s-rotate*! (the-as vector3s (-> arg0 launchrot)) (the-as vector3s (-> arg0 launchrot)) s5-0) + (vector3s-rotate*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s5-0) + (if (zero? (logand (sp-cpuinfo-flag use-global-acc) (-> arg1 flags))) + (vector3s-rotate*! (the-as vector3s (-> arg1 acc)) (the-as vector3s (-> arg1 acc)) s5-0) + ) + ) + 0 + (none) + ) + +(deftype sp-launch-stack (structure) + ((ra basic :offset-assert 0) + (dummy0 basic :offset-assert 4) + (dummy1 basic :offset-assert 8) + (b-spfic basic :offset-assert 12) + (r16 uint128 :offset-assert 16) + (r17 uint128 :offset-assert 32) + (r18 uint128 :offset-assert 48) + (pos uint128 :offset-assert 64) + (matrix matrix :inline :offset-assert 80) + (l-spfic basic :offset-assert 144) + (birth-info sparticle-birthinfo :inline :offset-assert 160) + (sprite sprite-vec-data-2d :inline :offset-assert 192) + (r19 uint128 :offset-assert 240) + (r20 uint128 :offset-assert 256) + (r21 uint128 :offset-assert 272) + (r22 uint128 :offset-assert 288) + ) + :method-count-assert 9 + :size-assert #x130 + :flag-assert #x900000130 + ) + + +;; ERROR: function was not converted to expressions. Cannot decompile. + +(define *death-adgif* (the-as adgif-shader #f)) + +;; WARN: Function sp-launch-particles-death has a return type of none, but the expression builder found a return statement. +(defun sp-launch-particles-death ((arg0 sparticle-system) (arg1 sparticle-launcher) (arg2 vector)) + (local-vars (v1-26 float) (v1-28 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf30 :class vf) + (vf31 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (.lvf vf30 (&-> arg2 quad)) + (let ((v1-0 #x437f0000)) + (.mov vf31 v1-0) + ) + (let ((s5-0 (new 'stack-no-clear 'matrix)) + (gp-0 (sp-get-particle arg0 0 (the-as sparticle-launch-state #f))) + ) + (if (not gp-0) + (return 0) + ) + (let* ((a1-2 (-> arg1 init-specs 0)) + (a1-3 + (sp-init-fields! + (-> s5-0 vector) + (the-as (inline-array sp-field-init-spec) a1-2) + (sp-field-id sprite-fields-start) + (sp-field-id sprite-fields-end) + #t + ) + ) + ) + (sp-init-fields! + (&-> gp-0 omega) + (the-as (inline-array sp-field-init-spec) a1-3) + (sp-field-id cpu-fields-start) + (sp-field-id cpu-fields-end) + #t + ) + ) + (set! (-> s5-0 vector 1 y) 0.0) + (set! (-> s5-0 vector 1 z) (the float (sar (shl (the int (-> s5-0 vector 1 z)) 48) 48))) + (.lvf vf4 (&-> s5-0 vector 2 quad)) + (.lvf vf5 (&-> s5-0 vector 0 quad)) + (.min.x.vf vf4 vf4 vf31 :mask #b111) + (.add.vf vf5 vf5 vf30 :mask #b111) + (.svf (&-> s5-0 vector 2 quad) vf4) + (.svf (&-> s5-0 vector 0 quad) vf5) + (when (not *death-adgif*) + (set! *death-adgif* (new 'static 'adgif-shader)) + (particle-adgif *death-adgif* (new 'static 'texture-id :index #xc9 :page #xc)) + (set! (-> *death-adgif* alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) + ) + (let ((v1-14 (-> *death-adgif* quad 0 quad))) + (set! (-> gp-0 adgif quad 0 quad) v1-14) + ) + (let ((v1-16 (-> *death-adgif* quad 1 quad))) + (set! (-> gp-0 adgif quad 1 quad) v1-16) + ) + (let ((v1-18 (-> *death-adgif* quad 2 quad))) + (set! (-> gp-0 adgif quad 2 quad) v1-18) + ) + (let ((v1-20 (-> *death-adgif* quad 3 quad))) + (set! (-> gp-0 adgif quad 3 quad) v1-20) + ) + (let ((v1-22 (-> *death-adgif* quad 4 quad))) + (set! (-> gp-0 adgif quad 4 quad) v1-22) + ) + (set! (-> gp-0 clock-index) (the-as uint 8)) + (.lvf vf4 (&-> (-> *time-of-day-context* current-prt-color) quad)) + (.lvf vf5 (&-> s5-0 vector 2 quad)) + (.lvf vf6 (&-> gp-0 fade quad)) + (.mul.vf vf5 vf5 vf4 :mask #b111) + (.mul.vf vf6 vf6 vf4 :mask #b111) + (.svf (&-> s5-0 vector 2 quad) vf5) + (.svf (&-> gp-0 fade quad) vf6) + (.mov v1-26 vf6) + (set! (-> gp-0 key) (the-as sparticle-launch-control 0)) + (set! (-> gp-0 binding) #f) + (let ((v1-27 (-> gp-0 sprite))) + (.lvf vf1 (&-> s5-0 vector 0 quad)) + (.lvf vf2 (&-> s5-0 vector 1 quad)) + (.lvf vf3 (&-> s5-0 vector 2 quad)) + (.svf (&-> v1-27 x-y-z-sx quad) vf1) + (.svf (&-> v1-27 flag-rot-sy quad) vf2) + (.sub.w.vf vf3 vf0 vf0 :mask #b1000) + (.svf (&-> v1-27 r-g-b-a quad) vf3) + ) + (.mov v1-28 vf3) + (logior! (-> gp-0 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-5)) + (set! (-> gp-0 cache-alpha) (-> s5-0 vector 2 w)) + ) + 0 + (none) + ) + ) + +(defun sp-clear-queue () + (let ((gp-0 *sp-launch-queue*) + (s5-0 *launch-matrix*) + ) + (when (> (-> gp-0 in-use) 0) + (dotimes (s4-0 (-> gp-0 in-use)) + (let ((v1-4 (-> gp-0 queue s4-0))) + (set! (-> s5-0 trans quad) (-> v1-4 pos quad)) + (sp-launch-particles-var + (-> v1-4 sp-system) + (-> v1-4 sp-launcher) + s5-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + (set! (-> gp-0 in-use) 0) + 0 + ) + ) + 0 + (none) + ) + +(defun sp-relaunch-setup-fields ((arg0 object) (arg1 sparticle-launcher) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-3d)) + (let ((a1-1 (-> arg1 init-specs 0)) + (s4-0 (logand (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1))) + ) + (set! (-> arg2 next-launcher) (the-as basic 0)) + (cond + ((and (logtest? (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-12)) + (zero? (logand (-> arg2 flags) (sp-cpuinfo-flag distort))) + (zero? (logand (-> arg2 flags) (sp-cpuinfo-flag glow))) + ) + (let ((f20-0 (-> arg3 r-g-b-a x)) + (f22-0 (-> arg3 r-g-b-a y)) + (f24-0 (-> arg3 r-g-b-a z)) + (f26-0 (-> arg2 fade x)) + (f28-0 (-> arg2 fade y)) + (f30-0 (-> arg2 fade z)) + ) + (set! (-> arg3 r-g-b-a x) 99999.0) + (set! (-> arg3 r-g-b-a y) 99999.0) + (set! (-> arg3 r-g-b-a z) 99999.0) + (set! (-> arg2 fade x) 99999.0) + (set! (-> arg2 fade y) 99999.0) + (set! (-> arg2 fade z) 99999.0) + (let ((a1-2 + (sp-init-fields! + (-> arg3 x-y-z-sx) + (the-as (inline-array sp-field-init-spec) a1-1) + (sp-field-id sprite-fields-start) + (sp-field-id sprite-fields-end) + #f + ) + ) + ) + (sp-init-fields! + (&-> arg2 omega) + (the-as (inline-array sp-field-init-spec) a1-2) + (sp-field-id cpu-fields-start) + (sp-field-id cpu-fields-end) + #f + ) + ) + (logior! (-> arg2 flags) s4-0) + (let ((v1-18 (-> *time-of-day-context* current-prt-color))) + (if (= (-> arg3 r-g-b-a x) 99999.0) + (set! (-> arg3 r-g-b-a x) f20-0) + (set! (-> arg3 r-g-b-a x) (* (-> arg3 r-g-b-a x) (-> v1-18 x))) + ) + (if (= (-> arg3 r-g-b-a y) 99999.0) + (set! (-> arg3 r-g-b-a y) f22-0) + (set! (-> arg3 r-g-b-a y) (* (-> arg3 r-g-b-a y) (-> v1-18 y))) + ) + (if (= (-> arg3 r-g-b-a z) 99999.0) + (set! (-> arg3 r-g-b-a z) f24-0) + (set! (-> arg3 r-g-b-a z) (* (-> arg3 r-g-b-a z) (-> v1-18 z))) + ) + (if (= (-> arg2 fade x) 99999.0) + (set! (-> arg2 fade x) f26-0) + (set! (-> arg2 fade x) (* (-> arg2 fade x) (-> v1-18 x))) + ) + (if (= (-> arg2 fade y) 99999.0) + (set! (-> arg2 fade y) f28-0) + (set! (-> arg2 fade y) (* (-> arg2 fade y) (-> v1-18 y))) + ) + (if (= (-> arg2 fade z) 99999.0) + (set! (-> arg2 fade z) f30-0) + (set! (-> arg2 fade z) (* (-> arg2 fade z) (-> v1-18 z))) + ) + ) + ) + ) + (else + (let ((a1-3 + (sp-init-fields! + (-> arg3 x-y-z-sx) + (the-as (inline-array sp-field-init-spec) a1-1) + (sp-field-id sprite-fields-start) + (sp-field-id sprite-fields-end) + #f + ) + ) + ) + (sp-init-fields! + (&-> arg2 omega) + (the-as (inline-array sp-field-init-spec) a1-3) + (sp-field-id cpu-fields-start) + (sp-field-id cpu-fields-end) + #f + ) + ) + ) + ) + ) + 0 + 0 + (none) + ) + +(defun sp-relaunch-particle-2d ((arg0 object) (arg1 sparticle-launcher) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-3d)) + (sp-relaunch-setup-fields arg0 arg1 arg2 arg3) + (when (logtest? (-> arg2 flags) (sp-cpuinfo-flag distort)) + (set! (-> arg3 r-g-b-a w) 0.0) + (set! (-> arg2 fade w) 0.0) + (logclear! (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-2)) + ) + (when (logtest? (-> arg2 flags) (sp-cpuinfo-flag glow)) + ) + 0 + (none) + ) + +;; ERROR: failed type prop at 32: Could not figure out load: (set! a1 (l.w (+ gp 104))) + +(defmethod initialize sparticle-launch-control ((obj sparticle-launch-control) (arg0 sparticle-launch-group) (arg1 process)) + (with-pp + (let ((s5-0 0)) + (set! (-> obj group) arg0) + (set! (-> obj proc) (the-as process-drawable arg1)) + (set! (-> obj local-clock) 0) + (set! (-> obj fade) 1.0) + (set! (-> obj matrix) 0) + (set! (-> obj last-spawn-frame) (the-as int (+ (-> *display* real-frame-clock integral-frame-counter) -2))) + (set! (-> obj last-spawn-time) 0) + (if (logtest? (-> obj group flags) (sp-group-flag unk-4)) + (quaternion->matrix (-> obj origin) (-> (the-as process-drawable arg1) root quat)) + (matrix-identity! (-> obj origin)) + ) + (when (logtest? (-> arg0 flags) (sp-group-flag unk-6)) + (let ((f0-1 (-> arg0 rotate-x)) + (f1-0 (-> arg0 rotate-y)) + (f2-0 (-> arg0 rotate-z)) + (t9-2 matrix-rotate-xyz!) + (a0-3 (new 'stack-no-clear 'matrix)) + (a1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-2 x) f0-1) + (set! (-> a1-2 y) f1-0) + (set! (-> a1-2 z) f2-0) + (set! (-> a1-2 w) 1.0) + (let ((a1-3 (t9-2 a0-3 a1-2))) + (matrix*! (-> obj origin) a1-3 (-> obj origin)) + ) + ) + ) + (when (logtest? (-> arg0 flags) (sp-group-flag unk-7)) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 x) (-> arg0 scale-x)) + (set! (-> a1-4 y) (-> arg0 scale-y)) + (set! (-> a1-4 z) (-> arg0 scale-z)) + (set! (-> a1-4 w) 1.0) + (set! (-> a1-4 w) 1.0) + (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) + ) + ) + (dotimes (s3-0 (-> arg0 length)) + (let* ((a0-7 (-> arg0 launcher s3-0)) + (a1-6 (-> *part-id-table* (-> a0-7 launcher))) + (v1-29 (-> obj data s5-0)) + ) + (when (nonzero? a1-6) + (set! (-> v1-29 group-item) a0-7) + (cond + ((= (-> a1-6 type) sparticle-launcher) + (set! (-> v1-29 accum) 0.0) + (set! (-> v1-29 spawn-time) (the-as uint (+ (-> pp clock frame-counter) (seconds -100)))) + (set! (-> v1-29 offset) (the-as uint (-> a0-7 offset))) + (set! (-> v1-29 randomize) (the-as uint 0)) + (cond + ((logtest? (-> a0-7 flags) (sp-group-item-flag start-dead)) + (logclear! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) + (set! (-> v1-29 center) #f) + (set! (-> v1-29 sprite3d) #f) + (set! (-> v1-29 sprite) #f) + ) + (else + (logior! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) + (set! (-> v1-29 center) (-> obj origin trans)) + (set! (-> v1-29 sprite3d) #f) + (set! (-> v1-29 sprite) #f) + ) + ) + (+! s5-0 1) + ) + (else + (format 0 "initialize called with non-particle-launcher~%") + ) + ) + ) + ) + ) + (set! (-> obj length) s5-0) + ) + 0 + (none) + ) + ) + +(defmethod create-launch-control sparticle-launch-group ((obj sparticle-launch-group) (arg0 process)) + (let ((gp-0 (the-as object (new 'process 'sparticle-launch-control (-> obj length))))) + (when (zero? (the-as sparticle-launch-control gp-0)) + (go process-drawable-art-error "memory") + (set! gp-0 0) + (goto cfg-4) + ) + (initialize (the-as sparticle-launch-control gp-0) obj arg0) + (label cfg-4) + (the-as sparticle-launch-control gp-0) + ) + ) + +(defmethod kill-and-free-particles sparticle-launch-control ((obj sparticle-launch-control)) + (countdown (v1-0 (-> obj length)) + (let ((a0-4 (-> obj data v1-0))) + (logclear! (-> a0-4 flags) (sp-launch-state-flags particles-active)) + ) + ) + (set! (-> obj local-clock) 0) + (set! (-> obj fade) 1.0) + (kill-all-particles-with-key obj) + (if (> (-> obj matrix) 0) + (sprite-release-user-hvdf (-> obj matrix)) + ) + 0 + (none) + ) + +(defmethod kill-particles sparticle-launch-control ((obj sparticle-launch-control)) + (kill-all-particles-with-key obj) + 0 + (none) + ) + +(defmethod sparticle-launch-control-method-10 sparticle-launch-control ((obj sparticle-launch-control) (arg0 vector)) + (let* ((v1-0 (-> obj group)) + (f0-0 (-> v1-0 bounds w)) + ) + (cond + ((= f0-0 0.0) + #t + ) + ((nonzero? (-> obj matrix)) + #t + ) + (else + (let ((s5-1 (vector+! (new 'stack-no-clear 'vector) arg0 (the-as vector (-> v1-0 bounds))))) + (set! (-> s5-1 w) f0-0) + (when (or *display-sprite-marks* *display-sprite-spheres* (and *display-actor-vis* (= (-> obj proc) *debug-actor*))) + (add-debug-sphere + *display-sprite-spheres* + (bucket-id bucket-324) + s5-1 + (-> s5-1 w) + (new 'static 'rgba :g #xff :a #x80) + ) + (add-debug-matrix *display-sprite-marks* (bucket-id bucket-324) (-> obj origin) 8192.0) + ) + (sphere-in-view-frustum? (the-as sphere s5-1)) + ) + ) + ) + ) + ) + +(defmethod sparticle-launch-control-method-12 sparticle-launch-control ((obj sparticle-launch-control) (arg0 matrix)) + (let* ((a2-0 (-> obj origin)) + (a3-0 arg0) + (v1-0 (-> a3-0 vector 0 quad)) + (a0-1 (-> a3-0 vector 1 quad)) + (a1-1 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> a2-0 vector 0 quad) v1-0) + (set! (-> a2-0 vector 1 quad) a0-1) + (set! (-> a2-0 vector 2 quad) a1-1) + (set! (-> a2-0 trans quad) a3-1) + ) + (let ((s4-0 (-> obj group))) + (when (logtest? (-> s4-0 flags) (sp-group-flag unk-6)) + (let ((f0-0 (-> s4-0 rotate-x)) + (f1-0 (-> s4-0 rotate-y)) + (f2-0 (-> s4-0 rotate-z)) + (t9-0 matrix-rotate-xyz!) + (a0-2 (new 'stack-no-clear 'matrix)) + (a1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-2 x) f0-0) + (set! (-> a1-2 y) f1-0) + (set! (-> a1-2 z) f2-0) + (set! (-> a1-2 w) 1.0) + (let ((a1-3 (t9-0 a0-2 a1-2))) + (matrix*! (-> obj origin) a1-3 (-> obj origin)) + ) + ) + ) + (when (logtest? (-> s4-0 flags) (sp-group-flag unk-7)) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 x) (-> s4-0 scale-x)) + (set! (-> a1-4 y) (-> s4-0 scale-y)) + (set! (-> a1-4 z) (-> s4-0 scale-z)) + (set! (-> a1-4 w) 1.0) + (set! (-> a1-4 w) 1.0) + (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) + ) + ) + ) + (sparticle-launch-control-method-11 obj (-> arg0 trans)) + (none) + ) + +(defmethod sparticle-launch-control-method-13 sparticle-launch-control ((obj sparticle-launch-control) (arg0 cspace)) + (let* ((v1-0 (-> obj origin)) + (a3-0 (-> arg0 bone transform)) + (a0-2 (-> a3-0 vector 0 quad)) + (a1-1 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-0 vector 0 quad) a0-2) + (set! (-> v1-0 vector 1 quad) a1-1) + (set! (-> v1-0 vector 2 quad) a2-0) + (set! (-> v1-0 trans quad) a3-1) + ) + (let ((s4-0 (-> obj group))) + (when (logtest? (-> s4-0 flags) (sp-group-flag unk-6)) + (let ((f0-0 (-> s4-0 rotate-x)) + (f1-0 (-> s4-0 rotate-y)) + (f2-0 (-> s4-0 rotate-z)) + (t9-0 matrix-rotate-xyz!) + (a0-3 (new 'stack-no-clear 'matrix)) + (a1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-2 x) f0-0) + (set! (-> a1-2 y) f1-0) + (set! (-> a1-2 z) f2-0) + (set! (-> a1-2 w) 1.0) + (let ((a1-3 (t9-0 a0-3 a1-2))) + (matrix*! (-> obj origin) a1-3 (-> obj origin)) + ) + ) + ) + (when (logtest? (-> s4-0 flags) (sp-group-flag unk-7)) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 x) (-> s4-0 scale-x)) + (set! (-> a1-4 y) (-> s4-0 scale-y)) + (set! (-> a1-4 z) (-> s4-0 scale-z)) + (set! (-> a1-4 w) 1.0) + (set! (-> a1-4 w) 1.0) + (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) + ) + ) + ) + (sparticle-launch-control-method-11 obj (vector<-cspace! (-> obj origin trans) arg0)) + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: failed type prop at 12: Could not figure out load: (set! a1 (l.wu (+ a0 132))) + +(defun sparticle-track-root ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let ((v1-3 (-> arg1 key proc root trans))) + (set! (-> arg2 x) (-> v1-3 x)) + (set! (-> arg2 y) (-> v1-3 y)) + (set! (-> arg2 z) (-> v1-3 z)) + ) + 0 + (none) + ) + +(defun sparticle-track-root-prim ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let ((v1-4 (-> (the-as collide-shape (-> arg1 key proc root)) root-prim prim-core))) + (set! (-> arg2 x) (-> v1-4 world-sphere x)) + (set! (-> arg2 y) (-> v1-4 world-sphere y)) + (set! (-> arg2 z) (-> v1-4 world-sphere z)) + ) + 0 + (none) + ) + +(defun sparticle-track-joint ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let* ((v1-1 (-> arg1 key proc)) + (a1-1 (the int (-> arg1 user-float))) + (v1-3 (vector<-cspace! (new 'stack-no-clear 'vector) (-> v1-1 node-list data a1-1))) + ) + (set! (-> arg2 x) (-> v1-3 x)) + (set! (-> arg2 y) (-> v1-3 y)) + (set! (-> arg2 z) (-> v1-3 z)) + ) + 0 + (none) + ) + +(defun sparticle-turn-to-vel ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sprite-vec-data-3d)) + (local-vars (v1-1 float) (v1-2 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (new 'stack-no-clear 'quaternion))) + (quaternion-axis-angle! gp-0 0.0 1.0 0.0 (+ 32768.0 (vector-y-angle (-> arg1 vel-sxvel)))) + (cond + ((< (-> gp-0 w) 0.0) + (.lvf vf1 (&-> arg2 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> gp-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 qx-qy-qz-sy quad) vf1) + (.mov v1-1 vf1) + ) + (else + (.lvf vf1 (&-> arg2 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> gp-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 qx-qy-qz-sy quad) vf1) + (.mov v1-2 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +(defun birth-func-copy-rot-color ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (local-vars (v1-5 float) (v1-6 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> arg4 sprite))) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (let* ((v1-0 arg2) + (f0-0 (-> v1-0 qx-qy-qz-sy x)) + (f1-0 (-> v1-0 qx-qy-qz-sy y)) + (f2-0 (-> v1-0 qx-qy-qz-sy z)) + ) + (set! (-> s4-0 x) f0-0) + (set! (-> s4-0 y) f1-0) + (set! (-> s4-0 z) f2-0) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + ) + (quaternion-rotate-y! s4-0 s4-0 (-> s5-0 sprite flag-rot-sy z)) + (let ((v1-4 arg2)) + (cond + ((< (-> s4-0 w) 0.0) + (.lvf vf1 (&-> v1-4 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> s4-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> v1-4 qx-qy-qz-sy quad) vf1) + (.mov v1-5 vf1) + ) + (else + (.lvf vf1 (&-> v1-4 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> s4-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> v1-4 qx-qy-qz-sy quad) vf1) + (.mov v1-6 vf1) + ) + ) + ) + ) + (set! (-> arg2 r-g-b-a x) (-> s5-0 sprite r-g-b-a x)) + (set! (-> arg2 r-g-b-a y) (-> s5-0 sprite r-g-b-a y)) + (set! (-> arg2 r-g-b-a z) (-> s5-0 sprite r-g-b-a z)) + ) + 0 + (none) + ) + ) + +(define *global-toggle* 0) + +(defun birth-func-copy2-rot-color ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (local-vars (v1-18 float) (v1-19 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> arg4 sprite))) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (let* ((v1-0 arg2) + (f0-0 (-> v1-0 qx-qy-qz-sy x)) + (f1-0 (-> v1-0 qx-qy-qz-sy y)) + (f2-0 (-> v1-0 qx-qy-qz-sy z)) + ) + (set! (-> s4-0 x) f0-0) + (set! (-> s4-0 y) f1-0) + (set! (-> s4-0 z) f2-0) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + ) + (let ((a1-1 (new-stack-vector0))) + (set! (-> a1-1 y) (-> s5-0 sprite flag-rot-sy z)) + (set! (-> a1-1 z) (if (logtest? *global-toggle* 1) + (the float (sar (shl (the int (- 16384.0 (-> s5-0 sprite x-y-z-sx w))) 48) 48)) + (the float (sar (shl (the int (+ 16384.0 (-> s5-0 sprite x-y-z-sx w))) 48) 48)) + ) + ) + (quaternion-zxy! s4-0 a1-1) + ) + (let ((v1-17 arg2)) + (cond + ((< (-> s4-0 w) 0.0) + (.lvf vf1 (&-> v1-17 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> s4-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> v1-17 qx-qy-qz-sy quad) vf1) + (.mov v1-18 vf1) + ) + (else + (.lvf vf1 (&-> v1-17 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> s4-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> v1-17 qx-qy-qz-sy quad) vf1) + (.mov v1-19 vf1) + ) + ) + ) + ) + (set! (-> arg2 r-g-b-a x) (-> s5-0 sprite r-g-b-a x)) + (set! (-> arg2 r-g-b-a y) (-> s5-0 sprite r-g-b-a y)) + (set! (-> arg2 r-g-b-a z) (-> s5-0 sprite r-g-b-a z)) + ) + (set! *global-toggle* (+ *global-toggle* 1)) + 0 + (none) + ) + ) + +(defun birth-func-copy-omega-to-z ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (set! (-> arg2 qx-qy-qz-sy z) (+ -16384.0 (-> arg1 omega))) + (set! (-> arg1 next-time) (-> arg4 sprite next-time)) + (set! (-> arg2 x-y-z-sx w) (* 163.85638 (the float (-> arg4 sprite next-time)))) + 0 + (none) + ) + +(defun birth-func-random-next-time ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (set! (-> arg1 next-time) (the-as uint (the int (rand-vu-float-range 0.0 (-> arg1 user-float))))) + 0 + (none) + ) + +;; ERROR: failed type prop at 12: Could not figure out load: (set! v1 (l.w (+ gp 16))) + +;; ERROR: failed type prop at 9: Could not figure out load: (set! v1 (l.w gp)) + +;; ERROR: failed type prop at 2: Could not figure out load: (set! a0 (l.w (+ v1 20))) + +;; ERROR: failed type prop at 21: Could not figure out load: (set! a1 (l.w (+ s2 40))) +;; ERROR: Bad vector register dependency: vf1 +;; ERROR: Bad vector register dependency: vf2 + +;; ERROR: failed type prop at 5: Could not figure out load: (set! a1 (l.w (+ v1 12))) + +;; ERROR: Expression building failed: In sparticle-motion-blur: [OP: 78] - Floating point math attempted on invalid types: uint and float in op (-.s f2-0 f3-0). +;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP] +;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] +;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP] +;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f3, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f3, f4, f4] +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] + + +(defun sparticle-set-conerot ((arg0 sparticle-launcher) (arg1 vector)) + (let ((s5-0 (get-field-spec-by-id arg0 (sp-field-id spt-conerot-x))) + (s4-0 (get-field-spec-by-id arg0 (sp-field-id spt-conerot-y))) + (v1-3 (get-field-spec-by-id arg0 (sp-field-id spt-conerot-z))) + ) + (set! (-> s5-0 initial-valuef) (-> arg1 x)) + (set! (-> s4-0 initial-valuef) (-> arg1 y)) + (set! (-> v1-3 initial-valuef) (-> arg1 z)) + ) + 0 + (none) + ) + +(defun sparticle-next-on-mode-1 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (if (zero? (-> arg1 key state-mode 0)) + (set! (-> arg1 next-time) + (the-as uint (* (max 1 (the-as int (-> *display* clock (-> arg1 clock-index) sparticle-data x))) 2)) + ) + ) + 0.0 + ) + +(defun check-ground-bounce ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (let ((f0-1 (+ (-> arg1 key origin trans y) (-> arg1 user-float)))) + (when (and (< (-> arg2 launchrot y) f0-1) (< (-> arg1 vel-sxvel y) 0.0)) + (set! (-> arg2 launchrot y) f0-1) + (let ((f0-4 (* (-> arg1 vel-sxvel y) (- (rand-vu-float-range 0.6 0.8))))) + (set! (-> arg1 vel-sxvel y) f0-4) + f0-4 + ) + ) + ) + ) + +(defun check-drop-group-center ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (let ((f0-0 (-> arg1 key origin trans y))) + (if (< (-> arg2 launchrot y) f0-0) + (sp-kill-particle arg0 arg1) + ) + ) + (none) + ) + +(defun birth-func-y->userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (+! (-> arg1 user-float) (-> arg2 vector 0 y)) + 0 + (none) + ) + +(defun birth-func-ocean-height ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (set! (-> arg2 vector 0 y) (+ (ocean-method-11 *ocean* (-> arg2 vector) #t) (-> arg1 user-float))) + 0 + (none) + ) + +(defun birth-func-camera-orient ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (local-vars (v1-0 float) (v1-1 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-1 (forward-up-nopitch->quaternion + (new 'stack-no-clear 'quaternion) + (-> (math-camera-matrix) vector 2) + *up-vector* + ) + ) + ) + (quaternion-rotate-x! s5-1 s5-1 16384.0) + (cond + ((< (-> s5-1 w) 0.0) + (.lvf vf1 (&-> arg2 conerot quad)) + (.lvf vf2 (&-> s5-1 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 conerot quad) vf1) + (.mov v1-0 vf1) + ) + (else + (.lvf vf1 (&-> arg2 conerot quad)) + (.lvf vf2 (&-> s5-1 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 conerot quad) vf1) + (.mov v1-1 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +(define *particle-quat* (new 'static 'quaternion :w 1.0)) + +(defun birth-func-set-quat ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (local-vars (a0-2 float) (a0-3 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((a0-1 arg2) + (v1-0 *particle-quat*) + ) + (cond + ((< (-> v1-0 w) 0.0) + (.lvf vf1 (&-> a0-1 conerot quad)) + (.lvf vf2 (&-> v1-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> a0-1 conerot quad) vf1) + (.mov a0-2 vf1) + ) + (else + (.lvf vf1 (&-> a0-1 conerot quad)) + (.lvf vf2 (&-> v1-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> a0-1 conerot quad) vf1) + (.mov a0-3 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +(define *particle-vel* (new 'static 'vector :w 1.0)) + +(defun birth-func-set-vel ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (let ((v1-0 *particle-vel*)) + (set! (-> arg1 vel-sxvel x) (-> v1-0 x)) + (set! (-> arg1 vel-sxvel y) (-> v1-0 y)) + (set! (-> arg1 vel-sxvel z) (-> v1-0 z)) + ) + 0 + (none) + ) + + +;; WARN: new jak 2 until loop case, check carefully +(defmethod get-field-spec-by-id sparticle-launcher ((obj sparticle-launcher) (arg0 sp-field-id)) + "Returns the [[sp-field-init-spec]] that has the matching [[sp-field-id]]" + (let ((v1-0 0)) + (until #f + (let ((a2-2 (-> obj init-specs v1-0 field))) + (cond + ((= a2-2 arg0) + (return (-> obj init-specs v1-0)) + ) + ((or (< (the-as uint arg0) (the-as uint a2-2)) (= a2-2 (sp-field-id spt-end))) + (return (the-as sp-field-init-spec #f)) + ) + (else + (+! v1-0 1) + ) + ) + ) + ) + ) + (the-as sp-field-init-spec #f) + ) + +;; ERROR: failed type prop at 45: Could not figure out load: (set! v1 (l.w (+ gp 12))) + + + + diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle.gc index 0cc43d73b5..7ea652b686 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle.gc @@ -5,5 +5,661 @@ ;; name in dgo: sparticle ;; dgos: ENGINE, GAME +;; og:ignore-form:sp-get-particle + +(define-extern sp-process-block-2d (function sparticle-system int int int int symbol none)) ;; TODO - mips2c +(define-extern sp-process-block-3d (function sparticle-system int int int int symbol none)) ;; TODO - mips2c + ;; DECOMP BEGINS +(defmethod print sparticle-cpuinfo ((obj sparticle-cpuinfo)) + (format #t "~%") + (dotimes (s5-0 16) + (format #t "~D:~F~%" s5-0 (the-as float (-> obj data s5-0))) + ) + (format #t "TIMER:~D~%" (-> obj timer)) + (the-as sparticle-cpuinfo (format #t "FLAGS:~X~%" (-> obj flags))) + ) + +(defun sp-particle-copy! ((arg0 sparticle-cpuinfo) (arg1 sparticle-cpuinfo)) + (let ((v1-1 (-> arg1 sprite x-y-z-sx quad))) + (set! (-> arg0 sprite x-y-z-sx quad) v1-1) + ) + (let ((v1-3 (-> arg1 sprite flag-rot-sy quad))) + (set! (-> arg0 sprite flag-rot-sy quad) v1-3) + ) + (let ((v1-5 (-> arg1 sprite r-g-b-a quad))) + (set! (-> arg0 sprite r-g-b-a quad) v1-5) + ) + (dotimes (v1-6 10) + (set! (-> arg0 adgif prims v1-6) (-> arg1 adgif prims v1-6)) + ) + (set! (-> arg0 vel-sxvel quad) (-> arg1 vel-sxvel quad)) + (set! (-> arg0 rot-syvel quad) (-> arg1 rot-syvel quad)) + (set! (-> arg0 fade quad) (-> arg1 fade quad)) + (set! (-> arg0 acc quad) (-> arg1 acc quad)) + (set! (-> arg0 friction) (-> arg1 friction)) + (set! (-> arg0 timer) (-> arg1 timer)) + (set! (-> arg0 flags) (-> arg1 flags)) + (set! (-> arg0 user-float) (-> arg1 user-float)) + (set! (-> arg0 sp-func) (-> arg1 sp-func)) + (none) + ) + +(defmethod new sparticle-system ((allocation symbol) + (type-to-make type) + (arg0 int) + (arg1 int) + (arg2 symbol) + (arg3 pointer) + (arg4 (inline-array adgif-shader)) + ) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (let* ((v1-3 (/ (+ arg0 63) 64)) + (a0-2 (/ (+ arg1 63) 64)) + (a1-2 (* v1-3 64)) + (a2-2 (* a0-2 64)) + (s2-1 (+ v1-3 a0-2)) + (s5-1 (+ a1-2 a2-2)) + ) + (set! (-> gp-0 blocks 0) v1-3) + (set! (-> gp-0 length 0) a1-2) + (set! (-> gp-0 num-alloc 0) 0) + (set! (-> gp-0 blocks 1) a0-2) + (set! (-> gp-0 length 1) a2-2) + (set! (-> gp-0 num-alloc 1) 0) + (set! (-> gp-0 is-3d) (the-as basic arg2)) + (set! (-> gp-0 alloc-table) (the-as (pointer uint64) (malloc 'global (* s2-1 8)))) + (set! (-> gp-0 cpuinfo-table) (the-as (inline-array sparticle-cpuinfo) (malloc 'global (* 144 s5-1)))) + (set! (-> gp-0 vecdata-table) arg3) + (set! (-> gp-0 adgifdata-table) arg4) + (dotimes (v1-5 s2-1) + (set! (-> gp-0 alloc-table v1-5) (the-as uint -1)) + ) + (dotimes (s4-1 s5-1) + (set! (-> gp-0 cpuinfo-table s4-1 valid) (the-as uint 0)) + (set! (-> gp-0 cpuinfo-table s4-1 sprite) + (the-as sprite-vec-data-2d (&+ (-> gp-0 vecdata-table) (* 48 s4-1))) + ) + (set! (-> gp-0 cpuinfo-table s4-1 adgif) (-> gp-0 adgifdata-table s4-1)) + (adgif-shader<-texture-simple! (-> gp-0 adgifdata-table s4-1) (the-as texture #f)) + (set! (-> gp-0 adgifdata-table s4-1 alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) + ) + ) + gp-0 + ) + ) + +(kmemopen global "part-systems") + +(define *sp-particle-system-2d* + (new 'global 'sparticle-system 1920 128 #f (-> *sprite-array-2d* vec-data) (-> *sprite-array-2d* adgif-data)) + ) + +(define *sp-particle-system-3d* + (new 'global 'sparticle-system 256 0 #t (-> *sprite-array-3d* vec-data) (-> *sprite-array-3d* adgif-data)) + ) + +(kmemclose) + +(defun sp-get-block-size ((arg0 sparticle-system) (arg1 int)) + (let ((v0-0 0)) + (let ((v1-0 0) + (a2-0 (-> arg0 blocks 0)) + ) + (when (= arg1 1) + (set! v1-0 a2-0) + (set! a2-0 (-> arg0 blocks 1)) + ) + (dotimes (a1-3 a2-0) + (if (!= (-> arg0 alloc-table (+ v1-0 a1-3)) -1) + (set! v0-0 (+ a1-3 1)) + ) + ) + ) + v0-0 + ) + ) + +(defun sp-get-approx-alloc-size ((arg0 sparticle-system) (arg1 int)) + (let ((a3-0 arg1) + (v1-0 0) + ) + (let ((a1-1 0) + (a2-0 (-> arg0 blocks 0)) + ) + (when (= a3-0 1) + (set! a1-1 a2-0) + (set! a2-0 (-> arg0 blocks 1)) + ) + (dotimes (a3-3 a2-0) + (if (!= (-> arg0 alloc-table (+ a1-1 a3-3)) -1) + (set! v1-0 (+ a3-3 1)) + ) + ) + ) + (* v1-0 64) + ) + ) + +(defun sp-free-particle ((arg0 sparticle-system) (arg1 int) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-2d)) + (if (and (-> arg2 binding) (nonzero? (-> arg2 binding))) + (logclear! (-> arg2 binding flags) (sp-launch-state-flags launcher-active particles-active)) + ) + (let ((v1-6 (/ arg1 64)) + (t0-4 (logand arg1 63)) + ) + (logior! (-> arg0 alloc-table v1-6) (ash 1 t0-4)) + ) + (if (< arg1 (-> arg0 length 0)) + (+! (-> arg0 num-alloc 0) -1) + (+! (-> arg0 num-alloc 1) -1) + ) + (set! (-> arg2 valid) (the-as uint 0)) + (set! (-> arg3 r-g-b-a w) 0.0) + 0 + (none) + ) + +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t2, t1] + +(defun sp-kill-particle ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (cond + ((>= (the-as int arg1) #x70000000) + (set! (-> arg1 timer) 0) + 0 + ) + (else + (let ((a2-1 (/ (the-as int (- (the-as uint arg1) (the-as uint (the-as uint (-> arg0 cpuinfo-table 0))))) 144))) + (when (or (< a2-1 0) (>= a2-1 (+ (-> arg0 length 0) (-> arg0 length 1)))) + (format 0 "Tried to release particle ~D~%" a2-1) + (return #f) + ) + (sp-free-particle arg0 a2-1 arg1 (-> arg1 sprite)) + ) + ) + ) + #t + ) + +(defun sp-orbiter ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let* ((f2-0 (-> arg1 omega)) + (f0-0 (-> arg1 radius)) + (f3-0 (-> arg1 vel-sxvel x)) + (f30-0 (-> arg1 vel-sxvel y)) + (f1-0 (-> arg1 vel-sxvel z)) + (f4-0 (-> *display* clock (-> arg1 clock-index) sparticle-data y)) + (f26-0 (+ f2-0 (* f3-0 f4-0))) + ) + (set! (-> arg1 omega) f26-0) + (let ((f28-0 (+ f0-0 (* f1-0 f4-0)))) + (set! (-> arg1 radius) f28-0) + (let ((f24-0 (sin f26-0)) + (f26-1 (cos f26-0)) + (f22-0 (sin (* 0.5 f30-0))) + (f0-5 (cos (* 0.5 f30-0))) + (a1-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (new 'stack-no-clear 'matrix))) + (set-vector! a1-1 (* f22-0 f26-1) 0.0 (* f22-0 f24-0) f0-5) + (quaternion*! (-> arg1 rotvel3d) (the-as quaternion a1-1) (-> arg1 rotvel3d)) + (quaternion-normalize! (-> arg1 rotvel3d)) + (set-vector! s4-0 (* f24-0 f28-0) 0.0 (* f26-1 f28-0) 1.0) + (quaternion->matrix s3-0 (-> arg1 rotvel3d)) + (vector-matrix*! s4-0 s4-0 s3-0) + ) + (let ((v1-8 (the-as sprite-vec-data-2d (-> arg1 user-float)))) + (set! (-> arg2 x) (+ (-> s4-0 x) (-> v1-8 x-y-z-sx x))) + (set! (-> arg2 y) (+ (-> s4-0 y) (-> v1-8 x-y-z-sx y))) + (set! (-> arg2 z) (+ (-> s4-0 z) (-> v1-8 x-y-z-sx z))) + ) + ) + ) + ) + 0 + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: function was not converted to expressions. Cannot decompile. + +(defun sp-copy-to-spr ((arg0 int) (arg1 pointer) (arg2 int)) + (let ((a2-1 (/ (+ arg2 15) 16))) + (dma-send-to-spr-no-flush (the-as uint arg0) (the-as uint arg1) (the-as uint a2-1) #t) + ) + 0 + (none) + ) + +(defun sp-copy-from-spr ((arg0 int) (arg1 pointer) (arg2 int)) + (let ((a2-1 (/ (+ arg2 15) 16))) + (dma-send-from-spr-no-flush (the-as uint arg1) (the-as uint arg0) (the-as uint a2-1) #t) + ) + 0 + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +(defun sp-process-block ((arg0 sparticle-system) (arg1 int) (arg2 sprite-array-2d) (arg3 int)) + (local-vars (sv-16 int) (sv-32 int) (sv-48 int) (sv-64 int)) + (let ((s3-0 208) + (s2-0 (* 144 arg3)) + (s5-0 (* 48 arg3)) + ) + (set! sv-32 (* 80 arg3)) + (let ((s1-0 (+ s3-0 s2-0))) + (set! sv-16 (+ s1-0 s5-0)) + (sp-copy-to-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) + (sp-copy-to-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) + (let ((t9-2 sp-copy-to-spr) + (a1-7 (-> arg0 adgifdata-table arg1)) + ) + (t9-2 sv-16 (the-as pointer a1-7) sv-32) + ) + (set! sv-48 (+ #x70000000 s3-0)) + (set! sv-64 (+ #x70000000 s1-0)) + (let ((t1-0 (paused?))) + (cond + ((-> arg0 is-3d) + (let ((t9-4 sp-process-block-3d) + (a0-6 arg0) + (a3-1 arg1) + ) + (t9-4 a0-6 sv-48 sv-64 a3-1 arg3 t1-0) + ) + ) + (else + (sp-process-block-2d arg0 sv-48 sv-64 arg1 arg3 t1-0) + ) + ) + ) + (sp-copy-from-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) + (sp-copy-from-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) + ) + ) + 0 + (none) + ) + +(defun sp-process-particle-system ((arg0 sparticle-system) (arg1 int) (arg2 sprite-array-2d)) + (countdown (v1-0 13) + (let ((a0-4 (-> *display* clock v1-0 sparticle-data quad))) + (set! (-> (the-as vector (+ #x70000000 (* v1-0 16))) quad) a0-4) + ) + ) + (let* ((v1-3 208) + (s1-0 (/ (- #x4000 v1-3) 272)) + (s2-0 0) + (s3-0 (sp-get-approx-alloc-size arg0 arg1)) + ) + (if (= arg1 1) + (set! s2-0 (* (-> arg0 blocks 0) 64)) + ) + (set! (-> arg2 num-valid arg1) s3-0) + (flush-cache 0) + (while (>= s3-0 s1-0) + (sp-process-block arg0 s2-0 arg2 s1-0) + (set! s3-0 (- s3-0 s1-0)) + (+! s2-0 s1-0) + ) + (if (> s3-0 0) + (sp-process-block arg0 s2-0 arg2 s3-0) + ) + ) + 0 + (none) + ) + +(define-perm *particles-flag* symbol #t) + +(defun forall-particles-with-key-runner ((arg0 sparticle-launch-control) + (arg1 (function sparticle-system sparticle-cpuinfo none)) + (arg2 sparticle-system) + ) + (local-vars (sv-16 int)) + (let ((s3-0 (the-as object (-> arg2 cpuinfo-table 0))) + (s2-0 (&+ (-> arg2 vecdata-table) 0)) + (s1-0 (+ (-> arg2 blocks 0) (-> arg2 blocks 1))) + ) + (dotimes (s0-0 s1-0) + (cond + ((!= (-> arg2 alloc-table s0-0) -1) + (set! sv-16 0) + (while (< sv-16 64) + (if (and (nonzero? (-> (the-as sparticle-cpuinfo s3-0) valid)) (= (-> (the-as sparticle-cpuinfo s3-0) key) arg0)) + (arg1 arg2 (the-as sparticle-cpuinfo s3-0)) + ) + (set! s3-0 (-> (the-as (inline-array sparticle-cpuinfo) s3-0) 1)) + (&+! s2-0 48) + (set! sv-16 (+ sv-16 1)) + ) + ) + (else + (set! s3-0 (-> (the-as (inline-array sparticle-cpuinfo) s3-0) 64)) + (&+! s2-0 3072) + ) + ) + ) + ) + 0 + (none) + ) + +(defun forall-particles-with-key ((arg0 sparticle-launch-control) + (arg1 (function sparticle-system sparticle-cpuinfo none)) + (arg2 symbol) + (arg3 symbol) + ) + (if arg2 + (forall-particles-with-key-runner arg0 arg1 *sp-particle-system-2d*) + ) + (if arg3 + (forall-particles-with-key-runner arg0 arg1 *sp-particle-system-3d*) + ) + 0 + (none) + ) + +(defun sparticle-kill-it ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (set! (-> arg1 timer) 0) + (set! (-> arg1 sp-func) (the-as (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none) 0)) + (when (and (-> arg1 binding) (nonzero? (-> arg1 binding))) + (logclear! (-> arg1 binding flags) (sp-launch-state-flags launcher-active particles-active)) + (set! (-> arg1 binding) #f) + ) + 0 + (none) + ) + +(defun sparticle-kill-it-level0 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (zero? (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1))) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +(defun sparticle-kill-it-level1 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) + (sp-cpuinfo-flag sp-cpuinfo-flag-9) + ) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +(defun sparticle-kill-it-level2 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) (sp-cpuinfo-flag level0)) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +(defun sparticle-kill-it-level3 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) + (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0) + ) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +(defun sparticle-kill-it-level4 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) (sp-cpuinfo-flag level1)) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +(defun sparticle-kill-it-level5 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) + (sp-cpuinfo-flag sp-cpuinfo-flag-9 level1) + ) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +(defun sparticle-60-to-50 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 pointer)) + (let ((gp-0 (-> arg1 rotvel3d)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-angle<-quaternion! s5-0 gp-0) + (set! (-> s5-0 w) (* 12516.455 (-> s5-0 w))) + (quaternion-vector-angle! gp-0 s5-0 (-> s5-0 w)) + ) + 0 + (none) + ) + +(defun sparticle-50-to-60 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 pointer)) + (let ((gp-0 (-> arg1 rotvel3d)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-angle<-quaternion! s5-0 gp-0) + (set! (-> s5-0 w) (* 8691.982 (-> s5-0 w))) + (quaternion-vector-angle! gp-0 s5-0 (-> s5-0 w)) + ) + 0 + (none) + ) + +(defun kill-all-particles-with-key ((arg0 sparticle-launch-control)) + (forall-particles-with-key arg0 sparticle-kill-it #t #t) + 0 + (none) + ) + +(defun forall-particles-runner ((arg0 (function sparticle-system sparticle-cpuinfo pointer none)) (arg1 sparticle-system)) + (let ((s4-0 (the-as object (-> arg1 cpuinfo-table 0))) + (s3-0 (&+ (-> arg1 vecdata-table) 0)) + (s2-0 (+ (-> arg1 blocks 0) (-> arg1 blocks 1))) + ) + (dotimes (s1-0 s2-0) + (cond + ((!= (-> arg1 alloc-table s1-0) -1) + (dotimes (s0-0 64) + (if (nonzero? (-> (the-as sparticle-cpuinfo s4-0) valid)) + (arg0 arg1 (the-as sparticle-cpuinfo s4-0) s3-0) + ) + (set! s4-0 (+ (the-as uint s4-0) 144)) + (&+! s3-0 48) + ) + ) + (else + (set! s4-0 (&+ (the-as pointer s4-0) 9216)) + (&+! s3-0 3072) + ) + ) + ) + ) + 0 + (none) + ) + +(defun forall-particles ((arg0 function) (arg1 symbol) (arg2 symbol)) + (if arg1 + (forall-particles-runner + (the-as (function sparticle-system sparticle-cpuinfo pointer none) arg0) + *sp-particle-system-2d* + ) + ) + (if arg2 + (forall-particles-runner + (the-as (function sparticle-system sparticle-cpuinfo pointer none) arg0) + *sp-particle-system-3d* + ) + ) + 0 + (none) + ) + +(defun kill-all-particles-in-level ((arg0 level)) + (let ((t9-0 forall-particles) + (v1-0 (-> arg0 index)) + ) + (t9-0 + (cond + ((zero? v1-0) + sparticle-kill-it-level0 + ) + ((= v1-0 1) + sparticle-kill-it-level1 + ) + ((= v1-0 2) + sparticle-kill-it-level2 + ) + ((= v1-0 3) + sparticle-kill-it-level3 + ) + ((= v1-0 4) + sparticle-kill-it-level4 + ) + (else + sparticle-kill-it-level5 + ) + ) + #t + #t + ) + ) + 0 + ) + +(defun all-particles-50-to-60 () + (forall-particles-runner sparticle-50-to-60 *sp-particle-system-3d*) + (none) + ) + +(defun all-particles-60-to-50 () + (forall-particles-runner sparticle-60-to-50 *sp-particle-system-3d*) + (none) + ) + +(defun remap-particle ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 pointer)) + (let* ((gp-0 (-> arg1 adgif)) + (a0-1 (-> gp-0 texture-id)) + (v1-0 (lookup-texture-by-id-fast a0-1)) + ) + (when v1-0 + (set! (-> gp-0 tex0 tbp0) (-> v1-0 dest 0)) + (set! (-> gp-0 tex0 cbp) (-> v1-0 clutdest)) + (set! (-> gp-0 miptbp1 tbp1) (-> v1-0 dest 1)) + (set! (-> gp-0 miptbp1 tbp2) (-> v1-0 dest 2)) + (set! (-> gp-0 miptbp1 tbp3) (-> v1-0 dest 3)) + ) + ) + (none) + ) + +(defun remap-all-particles () + (forall-particles remap-particle #t #t) + (none) + ) + +;; ERROR: Unsupported inline assembly instruction kind - [mfc0 gp, Count] +;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] +(defun process-particles () + (local-vars (v1-53 int) (gp-0 int)) + (with-pp + (when *particles-flag* + 0 + 0 + (.mfc0 gp-0 Count) + (set! *sp-launcher-lock* #t) + (when *debug-segment* + (let ((s5-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-12 'particles) + (s4-0 *profile-particles-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s3-0 (-> s5-0 data (-> s5-0 count)))) + (let ((s2-0 (-> s5-0 base-time))) + (set! (-> s3-0 name) v1-12) + (set! (-> s3-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s2-0)))) + ) + (set! (-> s3-0 depth) (the-as uint (-> s5-0 depth))) + (set! (-> s3-0 color) s4-0) + (set! (-> s5-0 segment (-> s5-0 depth)) s3-0) + ) + (+! (-> s5-0 count) 1) + (+! (-> s5-0 depth) 1) + (set! (-> s5-0 max-depth) (max (-> s5-0 max-depth) (-> s5-0 depth))) + ) + ) + 0 + ) + (logand (the-as int (-> pp clock sparticle-data x)) 255) + (cond + (*sp-60-hz* + (when (= (-> *setting-control* user-current video-mode) 'pal) + (set! *sp-60-hz* #f) + (all-particles-60-to-50) + ) + ) + (else + (when (= (-> *setting-control* user-current video-mode) 'ntsc) + (set! *sp-60-hz* #t) + (all-particles-50-to-60) + ) + ) + ) + (clear-sprite-aux-list) + (sp-process-particle-system *sp-particle-system-2d* 0 *sprite-array-2d*) + (sp-process-particle-system *sp-particle-system-2d* 1 *sprite-array-2d*) + (sp-process-particle-system *sp-particle-system-3d* 0 (the-as sprite-array-2d *sprite-array-3d*)) + (when *debug-segment* + (let ((s5-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-47 (+ (-> s5-1 depth) -1)) + (s4-1 (-> s5-1 segment v1-47)) + (s3-1 (-> s5-1 base-time)) + ) + (when (>= v1-47 0) + (set! (-> s4-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-1)))) + (+! (-> s5-1 depth) -1) + ) + ) + ) + ) + 0 + ) + (set! *sp-launcher-lock* #f) + (sp-clear-queue) + (.mfc0 v1-53 Count) + (- v1-53 gp-0) + (when *display-sprite-info* + (if (movie?) + (format *stdcon* "~%~%~%") + ) + (format + *stdcon* + "2d: ~4d~100h3d: ~4d~200hwarp/glow: ~3D~350hhud:~3D~%" + (-> *sp-particle-system-2d* num-alloc 0) + (-> *sp-particle-system-3d* num-alloc 0) + (-> *sprite-aux-list* entry) + (-> *sp-particle-system-2d* num-alloc 1) + ) + ) + ) + 0 + (none) + ) + ) + + + + diff --git a/goal_src/jak2/engine/gfx/texture/texture-h.gc b/goal_src/jak2/engine/gfx/texture/texture-h.gc index 5935bb677c..3d944673d7 100644 --- a/goal_src/jak2/engine/gfx/texture/texture-h.gc +++ b/goal_src/jak2/engine/gfx/texture/texture-h.gc @@ -17,6 +17,13 @@ (declare-type fog-texture-work structure) (define-extern *fog-texture-work* fog-texture-work) +;; NOTE - for sparticle +(declare-type adgif-shader structure) +(declare-type texture basic) +(declare-type texture-id uint32) +(define-extern adgif-shader<-texture-simple! (function adgif-shader texture adgif-shader)) +(define-extern lookup-texture-by-id-fast (function texture-id texture)) + ;; DECOMP BEGINS (deftype texture-id (uint32) diff --git a/goal_src/jak2/engine/level/level-h.gc b/goal_src/jak2/engine/level/level-h.gc index d58ec8e940..ab0fc7789a 100644 --- a/goal_src/jak2/engine/level/level-h.gc +++ b/goal_src/jak2/engine/level/level-h.gc @@ -12,6 +12,7 @@ (declare-type level-group basic) (declare-type entity-links-array inline-array-class) (declare-type game-text-info basic) +(declare-type engine basic) (define-extern *level* level-group) (define-extern *draw-index* int) @@ -205,12 +206,12 @@ (deftype level (basic) ((name symbol :offset-assert 4) - (load-name basic :offset-assert 8) - (nickname basic :offset-assert 12) + (load-name string :offset-assert 8) + (nickname string :offset-assert 12) (index int32 :offset-assert 16) (status symbol :offset-assert 20) - (borrow-level basic 2 :offset-assert 24) - (borrow-from-level basic :offset-assert 32) + (borrow-level level 2 :offset-assert 24) + (borrow-from-level level :offset-assert 32) (heap kheap :inline :offset-assert 48) (borrow-heap kheap 2 :inline :offset-assert 64) (bsp bsp-header :offset-assert 96) @@ -256,24 +257,24 @@ (texture-dirty-masks texture-mask 10 :inline :offset-assert 4576) (texture-mask texture-mask 18 :inline :offset-assert 4736) (sky-mask texture-mask :inline :offset-assert 5024) - (tfrag-masks basic :offset-assert 5040) + (tfrag-masks texture-masks-array :offset-assert 5040) (tfrag-dists pointer :offset-assert 5044) - (shrub-masks basic :offset-assert 5048) + (shrub-masks texture-masks-array :offset-assert 5048) (shrub-dists pointer :offset-assert 5052) - (alpha-masks basic :offset-assert 5056) + (alpha-masks texture-masks-array :offset-assert 5056) (alpha-dists pointer :offset-assert 5060) - (water-masks basic :offset-assert 5064) + (water-masks texture-masks-array :offset-assert 5064) (water-dists pointer :offset-assert 5068) (tfrag-last-calls int32 6 :offset-assert 5072) (texture-anim-array texture-anim-array 10 :offset-assert 5096) - (light-hash basic :offset-assert 5136) + (light-hash light-hash :offset-assert 5136) (draw-priority float :offset-assert 5140) (draw-index int32 :offset-assert 5144) - (part-engine basic :offset-assert 5148) + (part-engine engine :offset-assert 5148) (user-object basic 4 :offset-assert 5152) (loaded-text-info-count int32 :offset-assert 5168) (loaded-text-info game-text-info 8 :offset-assert 5172) - (level-type basic :offset-assert 5204) + (level-type type :offset-assert 5204) (load-order int64 :offset-assert 5208) (pad int8 12 :offset-assert 5216) ) @@ -389,7 +390,7 @@ :level0 (new 'static 'level :name #f :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -400,7 +401,7 @@ :name #f :index 1 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -411,7 +412,7 @@ :name #f :index 2 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -422,7 +423,7 @@ :name #f :index 3 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -433,7 +434,7 @@ :name #f :index 4 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -444,7 +445,7 @@ :name #f :index 5 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -455,7 +456,7 @@ :name 'default :index 6 :status 'reserved - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :bsp #f :inside-boxes #f diff --git a/goal_src/jak2/engine/load/loader-h.gc b/goal_src/jak2/engine/load/loader-h.gc index 837766fdb0..e65f058db0 100644 --- a/goal_src/jak2/engine/load/loader-h.gc +++ b/goal_src/jak2/engine/load/loader-h.gc @@ -7,6 +7,7 @@ ;; TODO: document this stuff when doing loader.gc +(declare-type external-art-buffer basic) (define-extern external-art-buffer-init (function external-art-buffer int)) (declare-type art basic) (declare-type art-group art) diff --git a/scripts/gsrc/code_retention/all_types_retention.py b/scripts/gsrc/code_retention/all_types_retention.py index 3b612233ce..dc436bc8bc 100644 --- a/scripts/gsrc/code_retention/all_types_retention.py +++ b/scripts/gsrc/code_retention/all_types_retention.py @@ -87,6 +87,6 @@ def update_all_blocks(game_name, block_dict): else: final_lines.append(line) i = i + 1 - # Update the file contents - with open(path, "w") as f: - f.writelines(final_lines) + # Update the file contents + with open(path, "w") as f: + f.writelines(final_lines) diff --git a/scripts/gsrc/update-gsrc-via-refs.py b/scripts/gsrc/update-gsrc-via-refs.py index e9597ea843..f48cb80c46 100644 --- a/scripts/gsrc/update-gsrc-via-refs.py +++ b/scripts/gsrc/update-gsrc-via-refs.py @@ -15,26 +15,35 @@ parser.add_argument("--decompiler", help="The path to the decompiler", type=str) parser.add_argument("--decompiler_config", help="The decomp config", type=str) args = parser.parse_args() +# Get a list of changed files, as well as new files +file_names = set() for item in repo.index.diff(None): path = item.b_rawpath.decode("utf-8") if args.game in path and "_REF" in path: - file_name = os.path.basename(path).replace("_REF.gc", "") - print("Decompiling - {}".format(file_name)) - # Decompile file - subprocess.run( - [ - args.decompiler, - "./decompiler/config/{}".format(args.decompiler_config), - "./iso_data", - "./decompiler_out", - "--config-override", - '{{"allowed_objects": ["{}"]}}'.format(file_name), - ] - ) - print("Updating - {}".format(file_name)) - # Update gsrc - os.system( - "python ./scripts/gsrc/update-from-decomp.py --game {} --file {}".format( - args.game, file_name - ) + file_names.add(os.path.basename(path).replace("_REF.gc", "")) + +for item in repo.untracked_files: + path = item + if args.game in path and "_REF" in path: + file_names.add(os.path.basename(path).replace("_REF.gc", "")) + +for file_name in file_names: + print("Decompiling - {}".format(file_name)) + # Decompile file + subprocess.run( + [ + args.decompiler, + "./decompiler/config/{}".format(args.decompiler_config), + "./iso_data", + "./decompiler_out", + "--config-override", + '{{"allowed_objects": ["{}"]}}'.format(file_name), + ] + ) + print("Updating - {}".format(file_name)) + # Update gsrc + os.system( + "python ./scripts/gsrc/update-from-decomp.py --game {} --file {}".format( + args.game, file_name ) + ) diff --git a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc index 47379d8826..0acf65574e 100644 --- a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-h_REF.gc @@ -994,7 +994,7 @@ :size-assert #x206c :flag-assert #x5c0000206c (:methods - (ocean-method-11 () none 11) + (ocean-method-11 (_type_ (inline-array vector) symbol) float 11) (ocean-method-12 () none 12) (ocean-method-13 () none 13) (ocean-method-14 () none 14) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-h_REF.gc index c4f5899c3f..dd48d317a2 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-h_REF.gc @@ -15,8 +15,8 @@ (fade rgbaf :inline :offset-assert 48) (acc vector :inline :offset-assert 64) (rotvel3d quaternion :inline :offset-assert 80) - (vel vector3s :inline :offset 16) - (accel vector3s :inline :offset 64) + (vel vector :inline :offset 16) + (accel vector :inline :offset 64) (scalevelx float :offset 28) (scalevely float :offset 44) (friction float :offset-assert 96) @@ -36,6 +36,7 @@ (clock-index uint8 :offset-assert 129) (user1-int16 uint16 :offset-assert 130) (key sparticle-launch-control :offset-assert 132) + (key-alt sparticle-launch-state :offset 132) (binding sparticle-launch-state :offset-assert 136) (data uint32 1 :offset 12) (datab uint8 4 :offset 12) @@ -153,6 +154,9 @@ :method-count-assert 9 :size-assert #x34 :flag-assert #x900000034 + (:methods + (new (symbol type int int symbol pointer (inline-array adgif-shader)) _type_ 0) + ) ) ;; definition for method 3 of type sparticle-system @@ -177,7 +181,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher-h_REF.gc index 102c60e757..f42430d669 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher-h_REF.gc @@ -95,12 +95,13 @@ :size-assert #x10 :flag-assert #xb00000010 (:methods - (sparticle-launcher-method-9 (_type_ int) uint 9) - (sparticle-launcher-method-10 (_type_) none 10) + (get-field-spec-by-id (_type_ sp-field-id) sp-field-init-spec 9) + (sparticle-launcher-method-10 (_type_ string) none 10) ) ) ;; definition for method 3 of type sparticle-launcher +;; INFO: this function exists in multiple non-identical object files (defmethod inspect sparticle-launcher ((obj sparticle-launcher)) (when (not obj) (set! obj obj) @@ -220,7 +221,7 @@ :size-assert #x40 :flag-assert #xa00000040 (:methods - (sparticle-launch-group-method-9 () none 9) + (create-launch-control (_type_ process) sparticle-launch-control 9) ) ) @@ -254,7 +255,7 @@ ;; definition of type sparticle-launch-control (deftype sparticle-launch-control (inline-array-class) ((group sparticle-launch-group :offset-assert 16) - (proc process :offset-assert 20) + (proc process-drawable :offset-assert 20) (local-clock int32 :offset-assert 24) (fade float :offset-assert 28) (matrix int8 :offset-assert 32) @@ -270,13 +271,13 @@ :size-assert #x70 :flag-assert #x1000000070 (:methods - (sparticle-launch-control-method-9 () none 9) - (sparticle-launch-control-method-10 () none 10) - (sparticle-launch-control-method-11 () none 11) - (sparticle-launch-control-method-12 () none 12) - (sparticle-launch-control-method-13 () none 13) - (sparticle-launch-control-method-14 () none 14) - (sparticle-launch-control-method-15 () none 15) + (initialize (_type_ sparticle-launch-group process) none 9) + (sparticle-launch-control-method-10 (_type_ vector) symbol 10) + (sparticle-launch-control-method-11 (_type_ vector) none 11) + (sparticle-launch-control-method-12 (_type_ matrix) none 12) + (sparticle-launch-control-method-13 (_type_ cspace) none 13) + (kill-and-free-particles (_type_) none 14) + (kill-particles (_type_) none 15) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc new file mode 100644 index 0000000000..ade6d5ecec --- /dev/null +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc @@ -0,0 +1,3145 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 3 of type sparticle-launcher +;; INFO: this function exists in multiple non-identical object files +;; INFO: Return type mismatch int vs sparticle-launcher. +(defmethod inspect sparticle-launcher ((obj sparticle-launcher)) + (format #t "~X: sparticle-launcher~%" obj) + (let ((s5-0 0)) + (while (!= (-> obj init-specs s5-0 field) (sp-field-id spt-end)) + (let* ((v1-1 (-> obj init-specs s5-0)) + (t9-1 format) + (a0-3 #t) + (a1-1 "~T~S : ~F / #x~X / ~D~%") + (a2-1 (-> v1-1 field)) + ) + (t9-1 + a0-3 + a1-1 + (cond + ((= a2-1 (sp-field-id spt-rotate-x)) + "spt-rotate-x" + ) + ((= a2-1 (sp-field-id sprite-fields-end)) + "sprite-fields-end" + ) + ((= a2-1 (sp-field-id spt-quat-z)) + "spt-quat-z" + ) + ((= a2-1 (sp-field-id spt-next-launcher)) + "spt-next-launcher" + ) + ((= a2-1 (sp-field-id cpu-fields-start)) + "cpu-fields-start" + ) + ((= a2-1 (sp-field-id spt-rotvel-z)) + "spt-rotvel-z" + ) + ((= a2-1 (sp-field-id launch-fields-end)) + "launch-fields-end" + ) + ((= a2-1 (sp-field-id spt-conerot-w)) + "spt-conerot-w" + ) + ((= a2-1 (sp-field-id spt-fade-a)) + "spt-fade-a" + ) + ((= a2-1 (sp-field-id spt-a)) + "spt-a" + ) + ((= a2-1 (sp-field-id spt-friction)) + "spt-friction" + ) + ((= a2-1 (sp-field-id spt-b)) + "spt-b" + ) + ((= a2-1 (sp-field-id spt-launchrot-x)) + "spt-launchrot-x" + ) + ((= a2-1 (sp-field-id spt-rotate-z)) + "spt-rotate-z" + ) + ((= a2-1 (sp-field-id spt-anim)) + "spt-anim" + ) + ((= a2-1 (sp-field-id spt-fade-g)) + "spt-fade-g" + ) + ((= a2-1 (sp-field-id spt-g)) + "spt-g" + ) + ((= a2-1 (sp-field-id spt-mat-scale-z)) + "spt-mat-scale-z" + ) + ((= a2-1 (sp-field-id spt-scale)) + "spt-scale" + ) + ((= a2-1 (sp-field-id spt-vel-z)) + "spt-vel-z" + ) + ((= a2-1 (sp-field-id spt-dummy)) + "spt-dummy" + ) + ((= a2-1 (sp-field-id spt-accel-z)) + "spt-accel-z" + ) + ((= a2-1 (sp-field-id spt-fade-r)) + "spt-fade-r" + ) + ((= a2-1 (sp-field-id spt-quat-x)) + "spt-quat-x" + ) + ((= a2-1 (sp-field-id spt-rot-y)) + "spt-rot-y" + ) + ((= a2-1 (sp-field-id cpu-fields-end)) + "cpu-fields-end" + ) + ((= a2-1 (sp-field-id spt-accel-y)) + "spt-accel-y" + ) + ((= a2-1 (sp-field-id spt-vel-x)) + "spt-vel-x" + ) + ((= a2-1 (sp-field-id spt-x)) + "spt-x" + ) + ((= a2-1 (sp-field-id spt-omega)) + "spt-omega" + ) + ((= a2-1 (sp-field-id spt-accel-x)) + "spt-accel-x" + ) + ((= a2-1 (sp-field-id spt-y)) + "spt-y" + ) + ((= a2-1 (sp-field-id spt-sound)) + "spt-sound" + ) + ((= a2-1 (sp-field-id spt-z)) + "spt-z" + ) + ((= a2-1 (sp-field-id spt-r)) + "spt-r" + ) + ((= a2-1 (sp-field-id misc-fields-end)) + "misc-fields-end" + ) + ((= a2-1 (sp-field-id spt-birth-func)) + "spt-birth-func" + ) + ((= a2-1 (sp-field-id spt-rotvel-y)) + "spt-rotvel-y" + ) + ((= a2-1 (sp-field-id spt-userdata)) + "spt-userdata" + ) + ((= a2-1 (sp-field-id spt-launchrot-w)) + "spt-launchrot-w" + ) + ((= a2-1 (sp-field-id spt-quad-w)) + "spt-quad-w" + ) + ((= a2-1 (sp-field-id spt-fade-b)) + "spt-fade-b" + ) + ((= a2-1 (sp-field-id spt-anim-speed)) + "spt-anim-speed" + ) + ((= a2-1 (sp-field-id spt-timer)) + "spt-timer" + ) + ((= a2-1 (sp-field-id spt-mat-scale-y)) + "spt-mat-scale-y" + ) + ((= a2-1 (sp-field-id spt-rotate-y)) + "spt-rotate-y" + ) + ((= a2-1 (sp-field-id spt-joint/refpoint)) + "spt-joint/refpoint" + ) + ((= a2-1 (sp-field-id spt-next-time)) + "spt-next-time" + ) + ((= a2-1 (sp-field-id spt-launchrot-z)) + "spt-launchrot-z" + ) + ((= a2-1 (sp-field-id spt-conerot-z)) + "spt-conerot-z" + ) + ((= a2-1 (sp-field-id spt-scale-y)) + "spt-scale-y" + ) + ((= a2-1 (sp-field-id spt-flags)) + "spt-flags" + ) + ((= a2-1 (sp-field-id spt-scale-x)) + "spt-scale-x" + ) + ((= a2-1 (sp-field-id spt-quat-y)) + "spt-quat-y" + ) + ((= a2-1 (sp-field-id spt-scalevel-y)) + "spt-scalevel-y" + ) + ((= a2-1 (sp-field-id spt-mat-scale-x)) + "spt-mat-scale-x" + ) + ((= a2-1 (sp-field-id spt-conerot-y)) + "spt-conerot-y" + ) + ((= a2-1 (sp-field-id launch-fields-start)) + "launch-fields-start" + ) + ((= a2-1 (sp-field-id sprite-fields-start)) + "sprite-fields-start" + ) + ((= a2-1 (sp-field-id spt-vel-y)) + "spt-vel-y" + ) + ((= a2-1 (sp-field-id spt-rot-z)) + "spt-rot-z" + ) + ((= a2-1 (sp-field-id misc-fields-start)) + "misc-fields-start" + ) + ((= a2-1 (sp-field-id spt-rot-x)) + "spt-rot-x" + ) + ((= a2-1 (sp-field-id spt-scalevel)) + "spt-scalevel" + ) + ((= a2-1 (sp-field-id spt-conerot-x)) + "spt-conerot-x" + ) + ((= a2-1 (sp-field-id spt-num)) + "spt-num" + ) + ((= a2-1 (sp-field-id spt-launchrot-y)) + "spt-launchrot-y" + ) + ((= a2-1 (sp-field-id spt-end)) + "spt-end" + ) + ((= a2-1 (sp-field-id spt-texture)) + "spt-texture" + ) + ((= a2-1 (sp-field-id spt-rotvel-x)) + "spt-rotvel-x" + ) + ((= a2-1 (sp-field-id spt-scalevel-x)) + "spt-scalevel-x" + ) + ((= a2-1 (sp-field-id spt-conerot-radius)) + "spt-conerot-radius" + ) + ((= a2-1 (sp-field-id spt-func)) + "spt-func" + ) + (else + "*unknown*" + ) + ) + (-> v1-1 initial-valuef) + (-> v1-1 initial-valuef) + (-> v1-1 initial-valuef) + ) + ) + (+! s5-0 1) + ) + ) + (the-as sparticle-launcher 0) + ) + +;; failed to figure out what this is: +(kmemopen global "part-tables") + +;; definition for symbol *part-id-table*, type (array sparticle-launcher) +(define *part-id-table* + (the-as (array sparticle-launcher) (new 'global 'boxed-array sparticle-launcher 5760)) + ) + +;; definition for symbol *part-group-id-table*, type (array sparticle-launch-group) +(define *part-group-id-table* + (the-as (array sparticle-launch-group) (new 'global 'boxed-array sparticle-launch-group 1408)) + ) + +;; definition for symbol *sp-temp*, type int +(define *sp-temp* 0) + +;; failed to figure out what this is: +(kmemclose) + +;; definition for function lookup-part-group-by-name +(defun lookup-part-group-by-name ((arg0 string)) + "Iterate through the [[*part-group-id-table*]] and return the matching [[sparticle-launch-group]], or [[#f]] otherwise" + (let* ((s5-0 *part-group-id-table*) + (s4-0 (-> s5-0 length)) + ) + (dotimes (s3-0 s4-0) + (let ((s2-0 (-> s5-0 s3-0))) + (if (and (nonzero? s2-0) (string= arg0 (-> s2-0 name))) + (return s2-0) + ) + ) + ) + ) + (the-as sparticle-launch-group #f) + ) + +;; definition for function lookup-part-group-pointer-by-name +;; INFO: Return type mismatch (pointer sparticle-launch-group) vs (pointer object). +(defun lookup-part-group-pointer-by-name ((arg0 string)) + "Similar to [[lookup-part-group-by-name]] but returns a pointer instead" + (let* ((s4-0 *part-group-id-table*) + (s3-0 (-> s4-0 length)) + ) + (dotimes (gp-0 s3-0) + (let ((v1-2 (-> s4-0 gp-0))) + (if (and (nonzero? v1-2) (string= arg0 (-> v1-2 name))) + (return (the-as (pointer object) (&+ (-> s4-0 data) (* gp-0 4)))) + ) + ) + ) + ) + (the-as (pointer sparticle-launch-group) #f) + ) + +;; definition for function part-group-pointer? +(defun part-group-pointer? ((arg0 pointer)) + "Verifies if the given pointer, points to a [[sparticle-launch-group]]" + (let ((v1-0 *part-group-id-table*)) + (and (>= (the-as int arg0) (the-as int (-> v1-0 data))) (< (the-as int arg0) (the-as int (&-> v1-0 1408)))) + ) + ) + +;; definition for function unlink-part-group-by-heap +(defun unlink-part-group-by-heap ((arg0 kheap)) + (let* ((v1-0 *part-group-id-table*) + (a2-0 (-> v1-0 length)) + (a1-0 (-> arg0 base)) + (a0-1 (-> arg0 top-base)) + ) + (while (nonzero? a2-0) + (+! a2-0 -1) + (let ((a3-2 (-> v1-0 a2-0))) + (when (and (>= (the-as int a3-2) (the-as int a1-0)) (< (the-as int a3-2) (the-as int a0-1))) + (set! (-> v1-0 a2-0) (the-as sparticle-launch-group 0)) + 0 + ) + ) + ) + ) + 0 + ) + +;; definition for function sp-init-fields! +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition of type sp-queued-launch-particles +(deftype sp-queued-launch-particles (structure) + ((sp-system sparticle-system :offset-assert 0) + (sp-launcher sparticle-launcher :offset-assert 4) + (pos vector :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type sp-queued-launch-particles +(defmethod inspect sp-queued-launch-particles ((obj sp-queued-launch-particles)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sp-queued-launch-particles) + (format #t "~1Tsp-system: ~A~%" (-> obj sp-system)) + (format #t "~1Tsp-launcher: ~A~%" (-> obj sp-launcher)) + (format #t "~1Tpos: #~%" (-> obj pos)) + (label cfg-4) + obj + ) + +;; definition of type sp-launch-queue +(deftype sp-launch-queue (basic) + ((in-use int32 :offset-assert 4) + (queue sp-queued-launch-particles 256 :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x2010 + :flag-assert #x900002010 + ) + +;; definition for method 3 of type sp-launch-queue +(defmethod inspect sp-launch-queue ((obj sp-launch-queue)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tin-use: ~D~%" (-> obj in-use)) + (format #t "~1Tqueue[256] @ #x~X~%" (-> obj queue)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(kmemopen global "launcher-queue") + +;; definition for symbol *sp-launcher-lock*, type symbol +(define *sp-launcher-lock* #f) + +;; definition for symbol *sp-launch-queue*, type sp-launch-queue +(define *sp-launch-queue* (new 'global 'sp-launch-queue)) + +;; definition for symbol *sp-launcher-enable*, type symbol +(define *sp-launcher-enable* #t) + +;; failed to figure out what this is: +(kmemclose) + +;; definition for function particle-setup-adgif +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition of type particle-adgif-cache +(deftype particle-adgif-cache (basic) + ((used int32 :offset-assert 4) + (last uint16 :offset-assert 8) + (lastgif adgif-shader :offset-assert 12) + (tidhash uint16 80 :offset-assert 16) + (spadgif adgif-shader 80 :inline :offset-assert 176) + ) + :method-count-assert 9 + :size-assert #x19b0 + :flag-assert #x9000019b0 + ) + +;; definition for method 3 of type particle-adgif-cache +(defmethod inspect particle-adgif-cache ((obj particle-adgif-cache)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tused: ~D~%" (-> obj used)) + (format #t "~1Tlast: ~D~%" (-> obj last)) + (format #t "~1Tlastgif: #~%" (-> obj lastgif)) + (format #t "~1Ttidhash[80] @ #x~X~%" (-> obj tidhash)) + (format #t "~1Tspadgif[80] @ #x~X~%" (-> obj spadgif)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(kmemopen global "part-adgif-cache") + +;; definition for symbol *particle-adgif-cache*, type particle-adgif-cache +(define *particle-adgif-cache* (new 'global 'particle-adgif-cache)) + +;; failed to figure out what this is: +(set! (-> *particle-adgif-cache* used) 0) + +;; failed to figure out what this is: +(kmemclose) + +;; definition for function particle-adgif-cache-flush +;; INFO: Return type mismatch int vs none. +(defun particle-adgif-cache-flush () + "Clear [[*particle-adgif-cache*]]" + (set! (-> *particle-adgif-cache* used) 0) + (set! (-> *particle-adgif-cache* last) (the-as uint 0)) + 0 + (none) + ) + +;; definition for function particle-adgif +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function particle-adgif-callback +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function sp-queue-launch +;; INFO: Used lq/sq +(defun sp-queue-launch ((arg0 sparticle-system) (arg1 sparticle-launcher) (arg2 matrix)) + (let ((v1-0 *sp-launch-queue*)) + (when (= (-> v1-0 in-use) 256) + (format 0 "ERROR: sp-launch-particles called during processing, and queue is full~%") + (return 0) + ) + (let ((a3-5 (-> v1-0 queue (-> v1-0 in-use)))) + (set! (-> a3-5 sp-system) arg0) + (set! (-> a3-5 sp-launcher) arg1) + (set! (-> a3-5 pos quad) (-> arg2 trans quad)) + ) + (let ((v0-1 (+ (-> v1-0 in-use) 1))) + (set! (-> v1-0 in-use) v0-1) + v0-1 + ) + ) + ) + +;; definition for function sp-adjust-launch +;; INFO: Return type mismatch int vs none. +(defun sp-adjust-launch ((arg0 sparticle-launchinfo) + (arg1 sparticle-cpuinfo) + (arg2 (inline-array sp-field-init-spec)) + (arg3 matrix) + (arg4 symbol) + ) + (let ((s2-0 (new 'stack-no-clear 'matrix)) + (s5-0 (new 'stack-no-clear 'matrix)) + ) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (sp-init-fields! (-> s2-0 vector) arg2 (sp-field-id launch-fields-start) (sp-field-id launch-fields-end) #t) + (matrix-rotate-xyz! s5-0 (the-as vector (-> s2-0 vector))) + (vector3s-matrix*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s5-0) + (matrix-rotate-xyz! s5-0 (-> s2-0 vector 1)) + (vector3s-matrix*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s5-0) + (matrix*! s5-0 s5-0 arg3) + (set-vector! s0-0 0.0 (-> s2-0 vector 2 w) 0.0 1.0) + (vector-matrix*! s0-0 s0-0 s5-0) + (+! (-> arg0 launchrot x) (-> s0-0 x)) + (+! (-> arg0 launchrot y) (-> s0-0 y)) + (+! (-> arg0 launchrot z) (-> s0-0 z)) + ) + (when (logtest? (sp-cpuinfo-flag sp-cpuinfo-flag-21) (-> arg1 flags)) + (set! (-> arg0 launchrot w) (* (-> arg0 launchrot w) (vector-length (the-as vector (-> arg3 vector))))) + (set! (-> arg0 conerot w) (* (-> arg0 conerot w) (vector-length (-> arg3 vector 1)))) + ) + (matrix-rotate-xyz! s5-0 (-> s2-0 vector 2)) + (matrix*! s5-0 s5-0 arg3) + (vector3s-rotate*! (the-as vector3s (-> arg0 launchrot)) (the-as vector3s (-> arg0 launchrot)) s5-0) + (vector3s-rotate*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s5-0) + (if (zero? (logand (sp-cpuinfo-flag use-global-acc) (-> arg1 flags))) + (vector3s-rotate*! (the-as vector3s (-> arg1 acc)) (the-as vector3s (-> arg1 acc)) s5-0) + ) + (if (logtest? (sp-cpuinfo-flag set-conerot) (-> arg1 flags)) + (set! (-> arg0 conerot y) (+ 16384.0 (vector-y-angle (-> s5-0 vector 2)))) + ) + (when arg4 + (let ((s4-1 (new 'stack-no-clear 'euler-angles))) + (matrix->eul s4-1 s5-0 13) + (set! (-> arg0 conerot x) (- (-> arg0 conerot x) (-> s4-1 y))) + (set! (-> arg0 conerot y) (- (-> arg0 conerot y) (-> s4-1 z))) + (set! (-> arg0 conerot z) (- (-> arg0 conerot z) (-> s4-1 x))) + ) + ) + ) + 0 + (none) + ) + +;; definition for function sp-euler-convert +;; INFO: Return type mismatch int vs none. +(defun sp-euler-convert ((arg0 sparticle-launchinfo) (arg1 sparticle-cpuinfo)) + (local-vars (v1-1 float) (v1-2 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((a1-1 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (set-vector! a1-1 (-> arg0 conerot x) (-> arg0 conerot y) (-> arg0 conerot z) 1.0) + (quaternion-zxy! s5-0 a1-1) + (cond + ((< (-> s5-0 w) 0.0) + (.lvf vf1 (&-> arg0 conerot quad)) + (.lvf vf2 (&-> s5-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg0 conerot quad) vf1) + (.mov v1-1 vf1) + ) + (else + (.lvf vf1 (&-> arg0 conerot quad)) + (.lvf vf2 (&-> s5-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg0 conerot quad) vf1) + (.mov v1-2 vf1) + ) + ) + ) + (cond + (*sp-60-hz* + (set! (-> arg1 rot-syvel x) (* 5.0 (-> arg1 rot-syvel x))) + (set! (-> arg1 rot-syvel y) (* 5.0 (-> arg1 rot-syvel y))) + (set! (-> arg1 rot-syvel z) (* 5.0 (-> arg1 rot-syvel z))) + ) + (else + (set! (-> arg1 rot-syvel x) (* 6.0 (-> arg1 rot-syvel x))) + (set! (-> arg1 rot-syvel y) (* 6.0 (-> arg1 rot-syvel y))) + (set! (-> arg1 rot-syvel z) (* 6.0 (-> arg1 rot-syvel z))) + ) + ) + (quaternion-zxy! (-> arg1 rotvel3d) (-> arg1 rot-syvel)) + 0 + (none) + ) + ) + +;; definition for function sp-rotate-system +;; INFO: Return type mismatch int vs none. +(defun sp-rotate-system ((arg0 sparticle-launchinfo) (arg1 sparticle-cpuinfo) (arg2 transformq)) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (let ((a1-1 (new 'stack-no-clear 'quaternion))) + (let* ((v1-0 a1-1) + (a0-1 arg2) + (f0-0 (-> a0-1 quat x)) + (f1-0 (-> a0-1 quat y)) + (f2-0 (-> a0-1 quat z)) + ) + (set! (-> v1-0 x) f0-0) + (set! (-> v1-0 y) f1-0) + (set! (-> v1-0 z) f2-0) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + ) + (quaternion->matrix s5-0 a1-1) + ) + (vector3s-rotate*! (the-as vector3s (-> arg0 launchrot)) (the-as vector3s (-> arg0 launchrot)) s5-0) + (vector3s-rotate*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s5-0) + (if (zero? (logand (sp-cpuinfo-flag use-global-acc) (-> arg1 flags))) + (vector3s-rotate*! (the-as vector3s (-> arg1 acc)) (the-as vector3s (-> arg1 acc)) s5-0) + ) + ) + 0 + (none) + ) + +;; definition of type sp-launch-stack +(deftype sp-launch-stack (structure) + ((ra basic :offset-assert 0) + (dummy0 basic :offset-assert 4) + (dummy1 basic :offset-assert 8) + (b-spfic basic :offset-assert 12) + (r16 uint128 :offset-assert 16) + (r17 uint128 :offset-assert 32) + (r18 uint128 :offset-assert 48) + (pos uint128 :offset-assert 64) + (matrix matrix :inline :offset-assert 80) + (l-spfic basic :offset-assert 144) + (birth-info sparticle-birthinfo :inline :offset-assert 160) + (sprite sprite-vec-data-2d :inline :offset-assert 192) + (r19 uint128 :offset-assert 240) + (r20 uint128 :offset-assert 256) + (r21 uint128 :offset-assert 272) + (r22 uint128 :offset-assert 288) + ) + :method-count-assert 9 + :size-assert #x130 + :flag-assert #x900000130 + ) + +;; definition for method 3 of type sp-launch-stack +;; INFO: Used lq/sq +(defmethod inspect sp-launch-stack ((obj sp-launch-stack)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'sp-launch-stack) + (format #t "~1Tra: ~A~%" (-> obj ra)) + (format #t "~1Tdummy0: ~A~%" (-> obj dummy0)) + (format #t "~1Tdummy1: ~A~%" (-> obj dummy1)) + (format #t "~1Tb-spfic: ~A~%" (-> obj b-spfic)) + (format #t "~1Tr16: ~D~%" (-> obj r16)) + (format #t "~1Tr17: ~D~%" (-> obj r17)) + (format #t "~1Tr18: ~D~%" (-> obj r18)) + (format #t "~1Tpos: ~D~%" (-> obj pos)) + (format #t "~1Tmatrix: #~%" (-> obj matrix)) + (format #t "~1Tl-spfic: ~A~%" (-> obj l-spfic)) + (format #t "~1Tbirth-info: #~%" (-> obj birth-info)) + (format #t "~1Tsprite: #~%" (-> obj sprite)) + (format #t "~1Tr19: ~D~%" (-> obj r19)) + (format #t "~1Tr20: ~D~%" (-> obj r20)) + (format #t "~1Tr21: ~D~%" (-> obj r21)) + (format #t "~1Tr22: ~D~%" (-> obj r22)) + (label cfg-4) + obj + ) + +;; definition for function sp-launch-particles-var +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for symbol *death-adgif*, type adgif-shader +(define *death-adgif* (the-as adgif-shader #f)) + +;; definition for function sp-launch-particles-death +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +;; WARN: Function sp-launch-particles-death has a return type of none, but the expression builder found a return statement. +(defun sp-launch-particles-death ((arg0 sparticle-system) (arg1 sparticle-launcher) (arg2 vector)) + (local-vars (v1-26 float) (v1-28 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf30 :class vf) + (vf31 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (.lvf vf30 (&-> arg2 quad)) + (let ((v1-0 #x437f0000)) + (.mov vf31 v1-0) + ) + (let ((s5-0 (new 'stack-no-clear 'matrix)) + (gp-0 (sp-get-particle arg0 0 (the-as sparticle-launch-state #f))) + ) + (if (not gp-0) + (return 0) + ) + (let* ((a1-2 (-> arg1 init-specs 0)) + (a1-3 + (sp-init-fields! + (-> s5-0 vector) + (the-as (inline-array sp-field-init-spec) a1-2) + (sp-field-id sprite-fields-start) + (sp-field-id sprite-fields-end) + #t + ) + ) + ) + (sp-init-fields! + (&-> gp-0 omega) + (the-as (inline-array sp-field-init-spec) a1-3) + (sp-field-id cpu-fields-start) + (sp-field-id cpu-fields-end) + #t + ) + ) + (set! (-> s5-0 vector 1 y) 0.0) + (set! (-> s5-0 vector 1 z) (the float (sar (shl (the int (-> s5-0 vector 1 z)) 48) 48))) + (.lvf vf4 (&-> s5-0 vector 2 quad)) + (.lvf vf5 (&-> s5-0 vector 0 quad)) + (.min.x.vf vf4 vf4 vf31 :mask #b111) + (.add.vf vf5 vf5 vf30 :mask #b111) + (.svf (&-> s5-0 vector 2 quad) vf4) + (.svf (&-> s5-0 vector 0 quad) vf5) + (when (not *death-adgif*) + (set! *death-adgif* (new 'static 'adgif-shader)) + (particle-adgif *death-adgif* (new 'static 'texture-id :index #xc9 :page #xc)) + (set! (-> *death-adgif* alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) + ) + (let ((v1-14 (-> *death-adgif* quad 0 quad))) + (set! (-> gp-0 adgif quad 0 quad) v1-14) + ) + (let ((v1-16 (-> *death-adgif* quad 1 quad))) + (set! (-> gp-0 adgif quad 1 quad) v1-16) + ) + (let ((v1-18 (-> *death-adgif* quad 2 quad))) + (set! (-> gp-0 adgif quad 2 quad) v1-18) + ) + (let ((v1-20 (-> *death-adgif* quad 3 quad))) + (set! (-> gp-0 adgif quad 3 quad) v1-20) + ) + (let ((v1-22 (-> *death-adgif* quad 4 quad))) + (set! (-> gp-0 adgif quad 4 quad) v1-22) + ) + (set! (-> gp-0 clock-index) (the-as uint 8)) + (.lvf vf4 (&-> (-> *time-of-day-context* current-prt-color) quad)) + (.lvf vf5 (&-> s5-0 vector 2 quad)) + (.lvf vf6 (&-> gp-0 fade quad)) + (.mul.vf vf5 vf5 vf4 :mask #b111) + (.mul.vf vf6 vf6 vf4 :mask #b111) + (.svf (&-> s5-0 vector 2 quad) vf5) + (.svf (&-> gp-0 fade quad) vf6) + (.mov v1-26 vf6) + (set! (-> gp-0 key) (the-as sparticle-launch-control 0)) + (set! (-> gp-0 binding) #f) + (let ((v1-27 (-> gp-0 sprite))) + (.lvf vf1 (&-> s5-0 vector 0 quad)) + (.lvf vf2 (&-> s5-0 vector 1 quad)) + (.lvf vf3 (&-> s5-0 vector 2 quad)) + (.svf (&-> v1-27 x-y-z-sx quad) vf1) + (.svf (&-> v1-27 flag-rot-sy quad) vf2) + (.sub.w.vf vf3 vf0 vf0 :mask #b1000) + (.svf (&-> v1-27 r-g-b-a quad) vf3) + ) + (.mov v1-28 vf3) + (logior! (-> gp-0 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-5)) + (set! (-> gp-0 cache-alpha) (-> s5-0 vector 2 w)) + ) + 0 + (none) + ) + ) + +;; definition for function sp-clear-queue +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun sp-clear-queue () + (let ((gp-0 *sp-launch-queue*) + (s5-0 *launch-matrix*) + ) + (when (> (-> gp-0 in-use) 0) + (dotimes (s4-0 (-> gp-0 in-use)) + (let ((v1-4 (-> gp-0 queue s4-0))) + (set! (-> s5-0 trans quad) (-> v1-4 pos quad)) + (sp-launch-particles-var + (-> v1-4 sp-system) + (-> v1-4 sp-launcher) + s5-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + (set! (-> gp-0 in-use) 0) + 0 + ) + ) + 0 + (none) + ) + +;; definition for function sp-relaunch-setup-fields +;; INFO: Return type mismatch int vs none. +(defun sp-relaunch-setup-fields ((arg0 object) (arg1 sparticle-launcher) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-3d)) + (let ((a1-1 (-> arg1 init-specs 0)) + (s4-0 (logand (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1))) + ) + (set! (-> arg2 next-launcher) (the-as basic 0)) + (cond + ((and (logtest? (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-12)) + (zero? (logand (-> arg2 flags) (sp-cpuinfo-flag distort))) + (zero? (logand (-> arg2 flags) (sp-cpuinfo-flag glow))) + ) + (let ((f20-0 (-> arg3 r-g-b-a x)) + (f22-0 (-> arg3 r-g-b-a y)) + (f24-0 (-> arg3 r-g-b-a z)) + (f26-0 (-> arg2 fade x)) + (f28-0 (-> arg2 fade y)) + (f30-0 (-> arg2 fade z)) + ) + (set! (-> arg3 r-g-b-a x) 99999.0) + (set! (-> arg3 r-g-b-a y) 99999.0) + (set! (-> arg3 r-g-b-a z) 99999.0) + (set! (-> arg2 fade x) 99999.0) + (set! (-> arg2 fade y) 99999.0) + (set! (-> arg2 fade z) 99999.0) + (let ((a1-2 + (sp-init-fields! + (-> arg3 x-y-z-sx) + (the-as (inline-array sp-field-init-spec) a1-1) + (sp-field-id sprite-fields-start) + (sp-field-id sprite-fields-end) + #f + ) + ) + ) + (sp-init-fields! + (&-> arg2 omega) + (the-as (inline-array sp-field-init-spec) a1-2) + (sp-field-id cpu-fields-start) + (sp-field-id cpu-fields-end) + #f + ) + ) + (logior! (-> arg2 flags) s4-0) + (let ((v1-18 (-> *time-of-day-context* current-prt-color))) + (if (= (-> arg3 r-g-b-a x) 99999.0) + (set! (-> arg3 r-g-b-a x) f20-0) + (set! (-> arg3 r-g-b-a x) (* (-> arg3 r-g-b-a x) (-> v1-18 x))) + ) + (if (= (-> arg3 r-g-b-a y) 99999.0) + (set! (-> arg3 r-g-b-a y) f22-0) + (set! (-> arg3 r-g-b-a y) (* (-> arg3 r-g-b-a y) (-> v1-18 y))) + ) + (if (= (-> arg3 r-g-b-a z) 99999.0) + (set! (-> arg3 r-g-b-a z) f24-0) + (set! (-> arg3 r-g-b-a z) (* (-> arg3 r-g-b-a z) (-> v1-18 z))) + ) + (if (= (-> arg2 fade x) 99999.0) + (set! (-> arg2 fade x) f26-0) + (set! (-> arg2 fade x) (* (-> arg2 fade x) (-> v1-18 x))) + ) + (if (= (-> arg2 fade y) 99999.0) + (set! (-> arg2 fade y) f28-0) + (set! (-> arg2 fade y) (* (-> arg2 fade y) (-> v1-18 y))) + ) + (if (= (-> arg2 fade z) 99999.0) + (set! (-> arg2 fade z) f30-0) + (set! (-> arg2 fade z) (* (-> arg2 fade z) (-> v1-18 z))) + ) + ) + ) + ) + (else + (let ((a1-3 + (sp-init-fields! + (-> arg3 x-y-z-sx) + (the-as (inline-array sp-field-init-spec) a1-1) + (sp-field-id sprite-fields-start) + (sp-field-id sprite-fields-end) + #f + ) + ) + ) + (sp-init-fields! + (&-> arg2 omega) + (the-as (inline-array sp-field-init-spec) a1-3) + (sp-field-id cpu-fields-start) + (sp-field-id cpu-fields-end) + #f + ) + ) + ) + ) + ) + 0 + 0 + (none) + ) + +;; definition for function sp-relaunch-particle-2d +;; INFO: Return type mismatch int vs none. +(defun sp-relaunch-particle-2d ((arg0 object) (arg1 sparticle-launcher) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-3d)) + (sp-relaunch-setup-fields arg0 arg1 arg2 arg3) + (when (logtest? (-> arg2 flags) (sp-cpuinfo-flag distort)) + (set! (-> arg3 r-g-b-a w) 0.0) + (set! (-> arg2 fade w) 0.0) + (logclear! (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-2)) + ) + (when (logtest? (-> arg2 flags) (sp-cpuinfo-flag glow)) + ) + 0 + (none) + ) + +;; definition for function sp-relaunch-particle-3d +;; ERROR: failed type prop at 32: Could not figure out load: (set! a1 (l.w (+ gp 104))) +(defun sp-relaunch-particle-3d ((a0-0 object) (a1-0 sparticle-launcher) (a2-0 sparticle-cpuinfo) (a3-0 sprite-vec-data-3d)) + (local-vars + (v0-0 none) + (v0-1 none) + (v0-2 none) + (v0-3 none) + (v0-4 none) + (v1-0 quaternion) + (v1-1 none) + (v1-2 none) + (v1-3 none) + (v1-4 none) + (v1-5 none) + (v1-6 none) + (v1-9 none) + (v1-10 none) + (v1-11 none) + (v1-12 none) + (v1-13 none) + (v1-14 none) + (v1-16 none) + (v1-17 none) + (v1-18 none) + (a0-1 none) + (a0-2 none) + (a0-4 none) + (a0-6 none) + (a1-1 none) + (a1-2 none) + (a1-3 none) + (a1-4 none) + (a1-6 none) + (a2-1 sprite-vec-data-3d) + (a2-2 int) + (a2-4 sparticle-cpuinfo) + (a2-5 none) + (a3-1 sprite-vec-data-3d) + (s3-0 none) + (s4-0 quaternion) + (t9-0 (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none)) + (t9-1 none) + (t9-2 none) + (t9-3 none) + (sp-0 none) + (f0-0 float) + (f0-1 float) + (f0-2 float) + (f0-3 float) + (f0-4 float) + (f0-5 float) + (f0-6 float) + (f0-7 none) + (f0-8 none) + (f0-9 none) + (f0-10 none) + (f0-11 none) + (f0-12 none) + (f0-13 none) + (f0-14 none) + (f0-15 none) + (f0-16 none) + (f0-17 none) + (f0-18 none) + (f0-19 none) + (f0-20 none) + (f0-21 none) + (f0-22 none) + (f0-23 none) + (f1-0 float) + (f1-1 float) + (f1-2 float) + (f1-3 none) + (f1-4 none) + (f1-5 none) + (f1-6 none) + (f1-7 none) + (f1-8 none) + (f1-9 none) + (f2-0 float) + (f2-1 float) + (f2-2 float) + (f3-0 float) + ) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (when (begin + (set! s4-0 (new 'stack-no-clear 'quaternion)) + (set! v1-0 s4-0) + (set! a2-1 a3-0) + (set! f0-0 (-> a2-1 qx-qy-qz-sy x)) + (set! f1-0 (-> a2-1 qx-qy-qz-sy y)) + (set! f2-0 (-> a2-1 qx-qy-qz-sy z)) + (set! (-> v1-0 x) f0-0) + (set! (-> v1-0 y) f1-0) + (set! (-> v1-0 z) f2-0) + (set! a2-2 #x3f800000) + (set! f3-0 (the-as float (gpr->fpr a2-2))) + (set! f2-1 (*.s f2-0 f2-0)) + (set! f2-2 (-.s f3-0 f2-1)) + (set! f1-1 (*.s f1-0 f1-0)) + (set! f1-2 (-.s f2-2 f1-1)) + (set! f0-1 (*.s f0-0 f0-0)) + (set! f0-2 (-.s f1-2 f0-1)) + (set! f0-3 (sqrt.s f0-2)) + (set! (-> v1-0 w) f0-3) + (set! a2-3 (fpr->gpr f0-3)) + (set! f0-4 (the-as float 0)) + (set! (-> a3-0 qx-qy-qz-sy x) f0-4) + (set! f0-5 (the-as float 0)) + (set! (-> a3-0 qx-qy-qz-sy y) f0-5) + (set! f0-6 (the-as float 0)) + (set! (-> a3-0 qx-qy-qz-sy z) f0-6) + (set! t9-0 sp-relaunch-setup-fields) + (set! a2-4 a2-0) + (set! a3-1 a3-0) + (call! a0-0 a1-0 a2-4 a3-1) + (set! a1-1 (the-as none (l.w (+ a2-0 104)))) + (set! v1-1 (the-as none -2)) + (set! a0-1 (the-as none (-> a3-0 r-g-b-a x))) + (set! a1-2 (the-as none (logand a1-1 #x4000))) + (set! a2-5 (the-as none 1)) + (set! a1-3 (the-as none (sra a1-2 14))) + (set! v1-2 (the-as none (logand a0-1 v1-1))) + (set! v1-3 (the-as none (logior v1-2 a1-3))) + (set! (-> a3-0 r-g-b-a x) (the-as float v1-3)) + (set! a1-4 (the-as none (+ sp-0 32))) + (set! s3-0 (the-as none (+ sp-0 48))) + (set! v1-4 (the-as none a1-4)) + (set! f0-7 (the-as none (-> a3-0 qx-qy-qz-sy x))) + (s.f! v1-4 f0-7) + (set! f0-8 (the-as none (-> a3-0 qx-qy-qz-sy y))) + (s.f! (+ v1-4 4) f0-8) + (set! f0-9 (the-as none (-> a3-0 qx-qy-qz-sy z))) + (s.f! (+ v1-4 8) f0-9) + (set! a0-2 (the-as none #x3f800000)) + (set! f0-10 (the-as none (gpr->fpr a0-2))) + (s.f! (+ v1-4 12) f0-10) + (set! t9-1 (the-as none quaternion-zxy!)) + (set! a0-3 (the-as none s3-0)) + (call!) + (set! v1-5 (the-as none #x40000)) + (set! a0-4 (the-as none (-> a2-0 flags))) + (set! v1-6 (the-as none (logand v1-5 a0-4))) + (nonzero? v1-6) + ) + (set! t9-2 (the-as none quaternion*!)) + (set! a0-5 (the-as none s3-0)) + (set! a2-6 (the-as none s3-0)) + (set! a1-5 (the-as none s4-0)) + (call!) + (set! v1-8 (the-as none v0-2)) + ) + (cond + ((begin (set! f0-11 (the-as none (l.f (+ s3-0 12)))) (set! f1-3 (the-as none 0)) (<.s f0-11 f1-3)) + (.lvf vf1 (+ a3-0 16)) + (.lvf vf2 s3-0) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (s.vf! (+ a3-0 16) vf1) + (.mov v1-9 vf1) + ) + (else + (.lvf vf1 (+ a3-0 16)) + (.lvf vf2 s3-0) + (.add.vf vf1 vf0 vf2 :mask #b111) + (s.vf! (+ a3-0 16) vf1) + (.mov v1-10 vf1) + ) + ) + (cond + ((begin (set! v1-11 (the-as none *sp-60-hz*)) v1-11) + (set! v1-12 (the-as none #x40a00000)) + (set! f0-12 (the-as none (gpr->fpr v1-12))) + (set! f1-4 (the-as none (l.f (+ a2-0 32)))) + (set! f0-13 (the-as none (*.s f0-12 f1-4))) + (s.f! (+ a2-0 32) f0-13) + (set! v1-13 (the-as none #x40a00000)) + (set! f0-14 (the-as none (gpr->fpr v1-13))) + (set! f1-5 (the-as none (l.f (+ a2-0 36)))) + (set! f0-15 (the-as none (*.s f0-14 f1-5))) + (s.f! (+ a2-0 36) f0-15) + (set! v1-14 (the-as none #x40a00000)) + (set! f0-16 (the-as none (gpr->fpr v1-14))) + (set! f1-6 (the-as none (l.f (+ a2-0 40)))) + (set! f0-17 (the-as none (*.s f0-16 f1-6))) + (s.f! (+ a2-0 40) f0-17) + (set! v1-15 (the-as none (fpr->gpr f0-17))) + ) + (else + (set! v1-16 (the-as none #x40c00000)) + (set! f0-18 (the-as none (gpr->fpr v1-16))) + (set! f1-7 (the-as none (l.f (+ a2-0 32)))) + (set! f0-19 (the-as none (*.s f0-18 f1-7))) + (s.f! (+ a2-0 32) f0-19) + (set! v1-17 (the-as none #x40c00000)) + (set! f0-20 (the-as none (gpr->fpr v1-17))) + (set! f1-8 (the-as none (l.f (+ a2-0 36)))) + (set! f0-21 (the-as none (*.s f0-20 f1-8))) + (s.f! (+ a2-0 36) f0-21) + (set! v1-18 (the-as none #x40c00000)) + (set! f0-22 (the-as none (gpr->fpr v1-18))) + (set! f1-9 (the-as none (l.f (+ a2-0 40)))) + (set! f0-23 (the-as none (*.s f0-22 f1-9))) + (s.f! (+ a2-0 40) f0-23) + (set! v1-19 (the-as none (fpr->gpr f0-23))) + ) + ) + (set! t9-3 (the-as none quaternion-zxy!)) + (set! a0-6 (the-as none (+ a2-0 80))) + (set! a1-6 (the-as none (+ a2-0 32))) + (call!) + (set! v1-20 (the-as none v0-3)) + (set! v0-4 (the-as none 0)) + (ret-none) + ) + ) + +;; definition for method 9 of type sparticle-launch-control +;; INFO: Return type mismatch int vs none. +(defmethod initialize sparticle-launch-control ((obj sparticle-launch-control) (arg0 sparticle-launch-group) (arg1 process)) + (with-pp + (let ((s5-0 0)) + (set! (-> obj group) arg0) + (set! (-> obj proc) (the-as process-drawable arg1)) + (set! (-> obj local-clock) 0) + (set! (-> obj fade) 1.0) + (set! (-> obj matrix) 0) + (set! (-> obj last-spawn-frame) (the-as int (+ (-> *display* real-frame-clock integral-frame-counter) -2))) + (set! (-> obj last-spawn-time) 0) + (if (logtest? (-> obj group flags) (sp-group-flag unk-4)) + (quaternion->matrix (-> obj origin) (-> (the-as process-drawable arg1) root quat)) + (matrix-identity! (-> obj origin)) + ) + (when (logtest? (-> arg0 flags) (sp-group-flag unk-6)) + (let ((f0-1 (-> arg0 rotate-x)) + (f1-0 (-> arg0 rotate-y)) + (f2-0 (-> arg0 rotate-z)) + (t9-2 matrix-rotate-xyz!) + (a0-3 (new 'stack-no-clear 'matrix)) + (a1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-2 x) f0-1) + (set! (-> a1-2 y) f1-0) + (set! (-> a1-2 z) f2-0) + (set! (-> a1-2 w) 1.0) + (let ((a1-3 (t9-2 a0-3 a1-2))) + (matrix*! (-> obj origin) a1-3 (-> obj origin)) + ) + ) + ) + (when (logtest? (-> arg0 flags) (sp-group-flag unk-7)) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 x) (-> arg0 scale-x)) + (set! (-> a1-4 y) (-> arg0 scale-y)) + (set! (-> a1-4 z) (-> arg0 scale-z)) + (set! (-> a1-4 w) 1.0) + (set! (-> a1-4 w) 1.0) + (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) + ) + ) + (dotimes (s3-0 (-> arg0 length)) + (let* ((a0-7 (-> arg0 launcher s3-0)) + (a1-6 (-> *part-id-table* (-> a0-7 launcher))) + (v1-29 (-> obj data s5-0)) + ) + (when (nonzero? a1-6) + (set! (-> v1-29 group-item) a0-7) + (cond + ((= (-> a1-6 type) sparticle-launcher) + (set! (-> v1-29 accum) 0.0) + (set! (-> v1-29 spawn-time) (the-as uint (+ (-> pp clock frame-counter) (seconds -100)))) + (set! (-> v1-29 offset) (the-as uint (-> a0-7 offset))) + (set! (-> v1-29 randomize) (the-as uint 0)) + (cond + ((logtest? (-> a0-7 flags) (sp-group-item-flag start-dead)) + (logclear! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) + (set! (-> v1-29 center) #f) + (set! (-> v1-29 sprite3d) #f) + (set! (-> v1-29 sprite) #f) + ) + (else + (logior! (-> v1-29 flags) (sp-launch-state-flags launcher-active)) + (set! (-> v1-29 center) (-> obj origin trans)) + (set! (-> v1-29 sprite3d) #f) + (set! (-> v1-29 sprite) #f) + ) + ) + (+! s5-0 1) + ) + (else + (format 0 "initialize called with non-particle-launcher~%") + ) + ) + ) + ) + ) + (set! (-> obj length) s5-0) + ) + 0 + (none) + ) + ) + +;; definition for method 9 of type sparticle-launch-group +;; INFO: Return type mismatch object vs sparticle-launch-control. +(defmethod create-launch-control sparticle-launch-group ((obj sparticle-launch-group) (arg0 process)) + (let ((gp-0 (the-as object (new 'process 'sparticle-launch-control (-> obj length))))) + (when (zero? (the-as sparticle-launch-control gp-0)) + (go process-drawable-art-error "memory") + (set! gp-0 0) + (goto cfg-4) + ) + (initialize (the-as sparticle-launch-control gp-0) obj arg0) + (label cfg-4) + (the-as sparticle-launch-control gp-0) + ) + ) + +;; definition for method 14 of type sparticle-launch-control +;; INFO: Return type mismatch int vs none. +(defmethod kill-and-free-particles sparticle-launch-control ((obj sparticle-launch-control)) + (countdown (v1-0 (-> obj length)) + (let ((a0-4 (-> obj data v1-0))) + (logclear! (-> a0-4 flags) (sp-launch-state-flags particles-active)) + ) + ) + (set! (-> obj local-clock) 0) + (set! (-> obj fade) 1.0) + (kill-all-particles-with-key obj) + (if (> (-> obj matrix) 0) + (sprite-release-user-hvdf (-> obj matrix)) + ) + 0 + (none) + ) + +;; definition for method 15 of type sparticle-launch-control +;; INFO: Return type mismatch int vs none. +(defmethod kill-particles sparticle-launch-control ((obj sparticle-launch-control)) + (kill-all-particles-with-key obj) + 0 + (none) + ) + +;; definition for method 10 of type sparticle-launch-control +(defmethod sparticle-launch-control-method-10 sparticle-launch-control ((obj sparticle-launch-control) (arg0 vector)) + (let* ((v1-0 (-> obj group)) + (f0-0 (-> v1-0 bounds w)) + ) + (cond + ((= f0-0 0.0) + #t + ) + ((nonzero? (-> obj matrix)) + #t + ) + (else + (let ((s5-1 (vector+! (new 'stack-no-clear 'vector) arg0 (the-as vector (-> v1-0 bounds))))) + (set! (-> s5-1 w) f0-0) + (when (or *display-sprite-marks* *display-sprite-spheres* (and *display-actor-vis* (= (-> obj proc) *debug-actor*))) + (add-debug-sphere + *display-sprite-spheres* + (bucket-id bucket-324) + s5-1 + (-> s5-1 w) + (new 'static 'rgba :g #xff :a #x80) + ) + (add-debug-matrix *display-sprite-marks* (bucket-id bucket-324) (-> obj origin) 8192.0) + ) + (sphere-in-view-frustum? (the-as sphere s5-1)) + ) + ) + ) + ) + ) + +;; definition for method 12 of type sparticle-launch-control +;; INFO: Used lq/sq +(defmethod sparticle-launch-control-method-12 sparticle-launch-control ((obj sparticle-launch-control) (arg0 matrix)) + (let* ((a2-0 (-> obj origin)) + (a3-0 arg0) + (v1-0 (-> a3-0 vector 0 quad)) + (a0-1 (-> a3-0 vector 1 quad)) + (a1-1 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> a2-0 vector 0 quad) v1-0) + (set! (-> a2-0 vector 1 quad) a0-1) + (set! (-> a2-0 vector 2 quad) a1-1) + (set! (-> a2-0 trans quad) a3-1) + ) + (let ((s4-0 (-> obj group))) + (when (logtest? (-> s4-0 flags) (sp-group-flag unk-6)) + (let ((f0-0 (-> s4-0 rotate-x)) + (f1-0 (-> s4-0 rotate-y)) + (f2-0 (-> s4-0 rotate-z)) + (t9-0 matrix-rotate-xyz!) + (a0-2 (new 'stack-no-clear 'matrix)) + (a1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-2 x) f0-0) + (set! (-> a1-2 y) f1-0) + (set! (-> a1-2 z) f2-0) + (set! (-> a1-2 w) 1.0) + (let ((a1-3 (t9-0 a0-2 a1-2))) + (matrix*! (-> obj origin) a1-3 (-> obj origin)) + ) + ) + ) + (when (logtest? (-> s4-0 flags) (sp-group-flag unk-7)) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 x) (-> s4-0 scale-x)) + (set! (-> a1-4 y) (-> s4-0 scale-y)) + (set! (-> a1-4 z) (-> s4-0 scale-z)) + (set! (-> a1-4 w) 1.0) + (set! (-> a1-4 w) 1.0) + (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) + ) + ) + ) + (sparticle-launch-control-method-11 obj (-> arg0 trans)) + (none) + ) + +;; definition for method 13 of type sparticle-launch-control +;; INFO: Used lq/sq +(defmethod sparticle-launch-control-method-13 sparticle-launch-control ((obj sparticle-launch-control) (arg0 cspace)) + (let* ((v1-0 (-> obj origin)) + (a3-0 (-> arg0 bone transform)) + (a0-2 (-> a3-0 vector 0 quad)) + (a1-1 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-0 vector 0 quad) a0-2) + (set! (-> v1-0 vector 1 quad) a1-1) + (set! (-> v1-0 vector 2 quad) a2-0) + (set! (-> v1-0 trans quad) a3-1) + ) + (let ((s4-0 (-> obj group))) + (when (logtest? (-> s4-0 flags) (sp-group-flag unk-6)) + (let ((f0-0 (-> s4-0 rotate-x)) + (f1-0 (-> s4-0 rotate-y)) + (f2-0 (-> s4-0 rotate-z)) + (t9-0 matrix-rotate-xyz!) + (a0-3 (new 'stack-no-clear 'matrix)) + (a1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-2 x) f0-0) + (set! (-> a1-2 y) f1-0) + (set! (-> a1-2 z) f2-0) + (set! (-> a1-2 w) 1.0) + (let ((a1-3 (t9-0 a0-3 a1-2))) + (matrix*! (-> obj origin) a1-3 (-> obj origin)) + ) + ) + ) + (when (logtest? (-> s4-0 flags) (sp-group-flag unk-7)) + (let ((a1-4 (new 'stack-no-clear 'vector))) + (set! (-> a1-4 x) (-> s4-0 scale-x)) + (set! (-> a1-4 y) (-> s4-0 scale-y)) + (set! (-> a1-4 z) (-> s4-0 scale-z)) + (set! (-> a1-4 w) 1.0) + (set! (-> a1-4 w) 1.0) + (scale-matrix! (-> obj origin) a1-4 (-> obj origin)) + ) + ) + ) + (sparticle-launch-control-method-11 obj (vector<-cspace! (-> obj origin trans) arg0)) + (none) + ) + +;; definition for method 11 of type sparticle-launch-control +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function execute-part-engine +;; INFO: Used lq/sq +;; ERROR: failed type prop at 12: Could not figure out load: (set! a1 (l.wu (+ a0 132))) +;; INFO: Return type mismatch int vs none. +(defun execute-part-engine () + (local-vars + (v0-0 none) + (v0-1 none) + (v0-2 none) + (v0-3 vector) + (v0-4 float) + (v0-5 none) + (v0-6 int) + (v1-0 engine) + (v1-1 connectable) + (v1-2 none) + (v1-3 none) + (v1-4 none) + (v1-5 none) + (v1-6 none) + (v1-7 none) + (v1-8 none) + (v1-9 none) + (v1-12 int) + (v1-13 int) + (v1-14 int) + (v1-15 int) + (v1-16 level) + (v1-17 int) + (v1-18 int) + (v1-19 int) + (v1-20 symbol) + (v1-21 int) + (v1-22 symbol) + (v1-23 symbol) + (v1-25 vector) + (v1-28 level-group) + (v1-29 int) + (a0-1 connectable) + (a0-2 int) + (a0-3 none) + (a0-4 none) + (a0-5 none) + (a0-6 none) + (a0-7 none) + (a0-8 none) + (a0-11 none) + (a0-12 engine) + (a0-13 connectable) + (a0-14 (pointer time-of-day-proc)) + (a0-15 time-of-day-proc) + (a0-16 int) + (a0-18 level-group) + (a0-19 symbol) + (a0-22 vector) + (a0-23 connectable) + (a0-24 int) + (a0-25 sparticle-system) + (a1-0 none) + (a1-1 none) + (a1-3 none) + (a1-4 none) + (a1-5 none) + (a1-6 none) + (a1-8 none) + (a1-10 none) + (a1-12 symbol) + (a1-13 (pointer basic)) + (a1-14 connectable) + (a2-0 none) + (a2-1 none) + (a2-2 none) + (a2-5 matrix) + (a3-0 none) + (a3-2 vector) + (a3-3 uint128) + (a3-4 symbol) + (t0-0 none) + (t0-1 none) + (t0-3 symbol) + (t1-0 none) + (t1-1 float) + (s0-0 none) + (s0-1 connection) + (s1-0 connectable) + (s1-1 int) + (s2-0 vector) + (s2-1 engine) + (s3-0 matrix) + (s3-1 int) + (s4-0 (array sparticle-launcher)) + (s4-1 int) + (s5-0 engine) + (s5-1 vector) + (t9-0 none) + (t9-1 none) + (t9-2 none) + (t9-3 (function vector)) + (t9-4 (function vector vector float)) + (t9-5 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (gp-0 sparticle-system) + (f0-0 none) + (f0-1 none) + (f0-2 float) + (f1-0 none) + (f1-1 int) + (sv-96 none) + (sv-104 none) + ) + (set! gp-0 *sp-particle-system-2d*) + (set! s5-0 *part-engine*) + (set! s4-0 *part-id-table*) + (set! s3-0 (new 'stack-no-clear 'matrix)) + (set! s2-0 (new 'stack-no-clear 'vector)) + (set! v1-0 s5-0) + (set! v1-1 (-> v1-0 alive-list next0)) + (set! a0-0 s5-0) + (set! a0-1 v1-1) + (set! s1-0 (-> a0-1 next0)) + (while (begin (set! a0-12 s5-0) (set! a0-13 (-> a0-12 alive-list-end)) (!= v1-1 a0-13)) + (when (begin + (and (begin + (set! a0-2 (-> v1-1 param1)) + (set! a1-0 (the-as none (l.wu (+ a0-2 132)))) + (set! s0-0 (the-as none (l.w (+ v1-1 28)))) + (set! a2-0 (the-as none (l.hu (+ a1-0 4)))) + (set! a2-1 (the-as none (logand a2-0 8))) + (nonzero? a2-1) + ) + (begin + (set! f0-0 (the-as none (l.f (+ a1-0 108)))) + (set! f1-0 (the-as none (l.f (+ s0-0 12)))) + (set! a1-1 (the-as none (<.s f0-0 f1-0))) + ) + ) + a1-1 + ) + (when (begin + (set! a1-3 (the-as none (l.w (+ v1-1 24)))) + (set! a1-4 (the-as none (sll a1-3 2))) + (set! a1-5 (the-as none (+ a1-4 s4-0))) + (set! a1-6 (the-as none (l.wu (+ a1-5 12)))) + (set! sv-96 a1-6) + (set! v1-2 (the-as none (l.wu (+ v1-1 16)))) + (set! sv-104 v1-2) + (set! v1-3 sv-96) + (nonzero? v1-3) + ) + (set! v1-4 sv-104) + (set! v1-5 (the-as none (sll v1-4 5))) + (set! v1-6 (the-as none (+ v1-5 12))) + (set! a0-3 (the-as none (l.wu (+ a0-2 128)))) + (set! a1-8 (the-as none (+ v1-6 a0-3))) + (set! v1-7 (the-as none s3-0)) + (set! a0-4 (the-as none (l.wu (+ a1-8 16)))) + (set! t0-0 (the-as none (+ a0-4 0))) + (set! a0-5 (the-as none (l.q t0-0))) + (set! a2-2 (the-as none (l.q (+ t0-0 16)))) + (set! a3-0 (the-as none (l.q (+ t0-0 32)))) + (set! t0-1 (the-as none (l.q (+ t0-0 48)))) + (s.q! v1-7 a0-5) + (s.q! (+ v1-7 16) a2-2) + (s.q! (+ v1-7 32) a3-0) + (s.q! (+ v1-7 48) t0-1) + (set! t9-0 (the-as none vector<-cspace!)) + (set! a0-6 (the-as none (+ s3-0 48))) + (call!) + (set! v1-8 (the-as none s2-0)) + (set! a0-7 (the-as none (l.q s0-0))) + (s.q! v1-8 a0-7) + (set! v1-9 (the-as none #x3f800000)) + (set! f0-1 (the-as none (gpr->fpr v1-9))) + (s.f! (+ s2-0 12) f0-1) + (set! t9-1 (the-as none vector-matrix*!)) + (set! a0-8 (the-as none (+ s3-0 48))) + (set! a1-9 (the-as none s2-0)) + (set! a2-3 (the-as none s3-0)) + (call!) + (set! t9-2 (the-as none sp-launch-particles-var)) + (set! a0-9 (the-as none gp-0)) + (set! a1-10 sv-96) + (set! a2-4 (the-as none s3-0)) + (set! t1-0 (the-as none #x3f800000)) + (call!) + (set! a1-11 (the-as none v0-2)) + ) + ) + (set! v1-1 (the-as connectable s1-0)) + (set! a0-10 (the-as none s5-0)) + (set! a0-11 (the-as none (l.wu s1-0))) + (set! s1-0 (the-as connectable a0-11)) + ) + (cond + ((begin + (set! t9-3 camera-pos) + (set! v0-3 (call!)) + (set! s5-1 v0-3) + (set! v1-12 1) + (set! a0-14 *time-of-day*) + a0-14 + ) + (set! a0-15 (-> a0-14 0)) + (set! a0-16 (-> a0-15 hours)) + ) + (else + (set! a0-16 0) + ) + ) + (set! s4-1 (ash.si v1-12 a0-16)) + (set! s3-1 0) + (while (begin (set! v1-28 *level*) (set! v1-29 (-> v1-28 length)) (<.si s3-1 v1-29)) + (when (begin + (set! v1-13 5232) + (set! v1-14 (*.si v1-13 s3-1)) + (set! v1-15 (+ v1-14 256)) + (set! a0-18 *level*) + (set! v1-16 (+ v1-15 a0-18)) + (set! a0-19 'active) + (set! a1-12 (-> v1-16 status)) + (= a1-12 a0-19) + ) + (when (begin (set! s2-1 (-> v1-16 part-engine)) s2-1) + (set! s1-1 (-> s2-1 length)) + (while (nonzero? s1-1) + (when (begin + (or (begin + (set! s1-1 (+ s1-1 -1)) + (set! v1-17 (sll s1-1 5)) + (set! v1-18 (+ v1-17 92)) + (set! s0-1 (+ v1-18 s2-1)) + (set! v1-19 (-> s0-1 param3)) + (zero? v1-19) + ) + (begin + (set! t9-4 vector-vector-distance) + (set! a0-22 s5-1) + (set! a1-13 (&-> s0-1 param0)) + (set! v0-4 (call! a0-22 a1-13)) + (set! f0-2 (gpr->fpr v0-4)) + (set! v1-21 (-> s0-1 param3)) + (set! f1-1 (gpr->fpr v1-21)) + (set! v1-20 (<.s f0-2 f1-1)) + ) + ) + (and v1-20 (begin + (set! v1-23 #t) + (set! a0-23 (-> s0-1 prev1)) + (set! a0-24 (logand s4-1 a0-23)) + (cmove-#f-nonzero v1-22 a0-24 v1-23) + ) + ) + v1-22 + ) + (set! a1-14 (-> s0-1 next1)) + (set! t9-5 sp-launch-particles-var) + (set! a0-25 gp-0) + (set! a2-5 *launch-matrix*) + (set! v1-25 (-> a2-5 trans)) + (set! a3-2 (the-as vector (&-> s0-1 param0))) + (set! a3-3 (-> a3-2 quad)) + (set! (-> v1-25 quad) a3-3) + (set! a3-4 #f) + (set! t0-3 #f) + (set! t1-1 (the-as float #x3f800000)) + (call! a0-25 a1-14 a2-5 a3-4 t0-3 t1-1) + (set! v1-26 v0-5) + ) + ) + ) + ) + (set! s3-1 (+ s3-1 1)) + ) + (set! v0-6 0) + (ret-none) + ) + +;; definition for function sparticle-track-root +;; INFO: Return type mismatch int vs none. +(defun sparticle-track-root ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let ((v1-3 (-> arg1 key proc root trans))) + (set! (-> arg2 x) (-> v1-3 x)) + (set! (-> arg2 y) (-> v1-3 y)) + (set! (-> arg2 z) (-> v1-3 z)) + ) + 0 + (none) + ) + +;; definition for function sparticle-track-root-prim +;; INFO: Return type mismatch int vs none. +(defun sparticle-track-root-prim ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let ((v1-4 (-> (the-as collide-shape (-> arg1 key proc root)) root-prim prim-core))) + (set! (-> arg2 x) (-> v1-4 world-sphere x)) + (set! (-> arg2 y) (-> v1-4 world-sphere y)) + (set! (-> arg2 z) (-> v1-4 world-sphere z)) + ) + 0 + (none) + ) + +;; definition for function sparticle-track-joint +;; INFO: Return type mismatch int vs none. +(defun sparticle-track-joint ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let* ((v1-1 (-> arg1 key proc)) + (a1-1 (the int (-> arg1 user-float))) + (v1-3 (vector<-cspace! (new 'stack-no-clear 'vector) (-> v1-1 node-list data a1-1))) + ) + (set! (-> arg2 x) (-> v1-3 x)) + (set! (-> arg2 y) (-> v1-3 y)) + (set! (-> arg2 z) (-> v1-3 z)) + ) + 0 + (none) + ) + +;; definition for function sparticle-turn-to-vel +;; INFO: Return type mismatch int vs none. +(defun sparticle-turn-to-vel ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sprite-vec-data-3d)) + (local-vars (v1-1 float) (v1-2 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (new 'stack-no-clear 'quaternion))) + (quaternion-axis-angle! gp-0 0.0 1.0 0.0 (+ 32768.0 (vector-y-angle (-> arg1 vel-sxvel)))) + (cond + ((< (-> gp-0 w) 0.0) + (.lvf vf1 (&-> arg2 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> gp-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 qx-qy-qz-sy quad) vf1) + (.mov v1-1 vf1) + ) + (else + (.lvf vf1 (&-> arg2 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> gp-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 qx-qy-qz-sy quad) vf1) + (.mov v1-2 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for function birth-func-copy-rot-color +;; INFO: Return type mismatch int vs none. +(defun birth-func-copy-rot-color ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (local-vars (v1-5 float) (v1-6 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> arg4 sprite))) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (let* ((v1-0 arg2) + (f0-0 (-> v1-0 qx-qy-qz-sy x)) + (f1-0 (-> v1-0 qx-qy-qz-sy y)) + (f2-0 (-> v1-0 qx-qy-qz-sy z)) + ) + (set! (-> s4-0 x) f0-0) + (set! (-> s4-0 y) f1-0) + (set! (-> s4-0 z) f2-0) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + ) + (quaternion-rotate-y! s4-0 s4-0 (-> s5-0 sprite flag-rot-sy z)) + (let ((v1-4 arg2)) + (cond + ((< (-> s4-0 w) 0.0) + (.lvf vf1 (&-> v1-4 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> s4-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> v1-4 qx-qy-qz-sy quad) vf1) + (.mov v1-5 vf1) + ) + (else + (.lvf vf1 (&-> v1-4 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> s4-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> v1-4 qx-qy-qz-sy quad) vf1) + (.mov v1-6 vf1) + ) + ) + ) + ) + (set! (-> arg2 r-g-b-a x) (-> s5-0 sprite r-g-b-a x)) + (set! (-> arg2 r-g-b-a y) (-> s5-0 sprite r-g-b-a y)) + (set! (-> arg2 r-g-b-a z) (-> s5-0 sprite r-g-b-a z)) + ) + 0 + (none) + ) + ) + +;; definition for symbol *global-toggle*, type int +(define *global-toggle* 0) + +;; definition for function birth-func-copy2-rot-color +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun birth-func-copy2-rot-color ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (local-vars (v1-18 float) (v1-19 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> arg4 sprite))) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (let* ((v1-0 arg2) + (f0-0 (-> v1-0 qx-qy-qz-sy x)) + (f1-0 (-> v1-0 qx-qy-qz-sy y)) + (f2-0 (-> v1-0 qx-qy-qz-sy z)) + ) + (set! (-> s4-0 x) f0-0) + (set! (-> s4-0 y) f1-0) + (set! (-> s4-0 z) f2-0) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + ) + (let ((a1-1 (new-stack-vector0))) + (set! (-> a1-1 y) (-> s5-0 sprite flag-rot-sy z)) + (set! (-> a1-1 z) (if (logtest? *global-toggle* 1) + (the float (sar (shl (the int (- 16384.0 (-> s5-0 sprite x-y-z-sx w))) 48) 48)) + (the float (sar (shl (the int (+ 16384.0 (-> s5-0 sprite x-y-z-sx w))) 48) 48)) + ) + ) + (quaternion-zxy! s4-0 a1-1) + ) + (let ((v1-17 arg2)) + (cond + ((< (-> s4-0 w) 0.0) + (.lvf vf1 (&-> v1-17 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> s4-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> v1-17 qx-qy-qz-sy quad) vf1) + (.mov v1-18 vf1) + ) + (else + (.lvf vf1 (&-> v1-17 qx-qy-qz-sy quad)) + (.lvf vf2 (&-> s4-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> v1-17 qx-qy-qz-sy quad) vf1) + (.mov v1-19 vf1) + ) + ) + ) + ) + (set! (-> arg2 r-g-b-a x) (-> s5-0 sprite r-g-b-a x)) + (set! (-> arg2 r-g-b-a y) (-> s5-0 sprite r-g-b-a y)) + (set! (-> arg2 r-g-b-a z) (-> s5-0 sprite r-g-b-a z)) + ) + (set! *global-toggle* (+ *global-toggle* 1)) + 0 + (none) + ) + ) + +;; definition for function birth-func-copy-omega-to-z +;; INFO: Return type mismatch int vs none. +(defun birth-func-copy-omega-to-z ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (set! (-> arg2 qx-qy-qz-sy z) (+ -16384.0 (-> arg1 omega))) + (set! (-> arg1 next-time) (-> arg4 sprite next-time)) + (set! (-> arg2 x-y-z-sx w) (* 163.85638 (the float (-> arg4 sprite next-time)))) + 0 + (none) + ) + +;; definition for function birth-func-random-next-time +;; INFO: Return type mismatch int vs none. +(defun birth-func-random-next-time ((arg0 sparticle-system) + (arg1 sparticle-cpuinfo) + (arg2 sprite-vec-data-3d) + (arg3 sparticle-launcher) + (arg4 sparticle-launch-state) + ) + (set! (-> arg1 next-time) (the-as uint (the int (rand-vu-float-range 0.0 (-> arg1 user-float))))) + 0 + (none) + ) + +;; definition for function sparticle-respawn-heights +;; INFO: Used lq/sq +;; ERROR: failed type prop at 12: Could not figure out load: (set! v1 (l.w (+ gp 16))) +(defun sparticle-respawn-heights ((a0-0 sparticle-system) (a1-0 sparticle-cpuinfo) (a2-0 vector)) + (local-vars + (v0-0 none) + (v0-1 none) + (v0-2 none) + (v1-0 none) + (v1-1 symbol) + (v1-2 none) + (v1-3 none) + (v1-4 none) + (v1-5 none) + (v1-7 none) + (v1-8 none) + (v1-10 none) + (v1-11 none) + (v1-12 none) + (v1-13 none) + (v1-14 none) + (v1-15 none) + (v1-16 none) + (v1-17 none) + (a0-1 none) + (a1-2 none) + (a1-3 none) + (a2-1 none) + (a3-0 none) + (a3-1 none) + (t1-0 none) + (s1-0 none) + (s2-0 none) + (s3-0 none) + (s5-1 none) + (t9-0 none) + (t9-1 none) + (gp-0 float) + (sp-0 none) + (f0-0 float) + (f0-1 float) + (f0-2 none) + (f0-3 none) + (f0-4 none) + (f0-5 none) + (f0-6 none) + (f0-7 none) + (f1-0 float) + (f1-1 none) + (f1-2 none) + (f1-3 none) + ) + (when (begin + (and (begin (set! gp-0 (-> a1-0 user-float)) (nonzero? gp-0)) + (or (begin + (and (begin (set! f0-0 (-> a1-0 vel-sxvel y)) (set! f1-0 (the-as float 0)) (set! v1-1 (<.s f0-0 f1-0)) v1-1) + (begin + (set! f0-1 (-> a2-0 y)) + (set! v1-3 (the-as none (l.w (+ gp-0 16)))) + (set! f1-1 (the-as none (gpr->fpr v1-3))) + (set! v1-2 (the-as none (<.s f0-1 f1-1))) + ) + ) + v1-2 + ) + (and (begin + (set! f0-2 (the-as none 0)) + (set! f1-2 (the-as none (l.f (+ a1-0 20)))) + (set! v1-4 (the-as none (<.s f0-2 f1-2))) + v1-4 + ) + (begin + (set! v1-5 (the-as none (l.w (+ gp-0 20)))) + (set! f0-3 (the-as none (gpr->fpr v1-5))) + (set! f1-3 (the-as none (l.f (+ a2-0 4)))) + (set! v1-0 (the-as none (<.s f0-3 f1-3))) + ) + ) + ) + ) + v1-0 + ) + (when (begin + (set! t9-0 (the-as none sp-kill-particle)) + (set! a1-1 (the-as none a1-0)) + (call!) + (set! v1-7 (the-as none (l.w gp-0))) + (set! s3-0 (the-as none (+ v1-7 -1))) + (set! v1-8 (the-as none 2)) + (<.si v1-8 s3-0) + ) + (if (begin (set! s2-0 (the-as none (+ sp-0 16))) (set! v1-10 (the-as none (l.w (+ gp-0 12)))) (zero? v1-10)) + (set! s1-0 (the-as none *sp-particle-system-2d*)) + (set! s1-0 (the-as none *sp-particle-system-3d*)) + ) + (set! v1-11 (the-as none s2-0)) + (set! f0-4 (the-as none (l.f a2-0))) + (s.f! v1-11 f0-4) + (set! f0-5 (the-as none (l.f (+ a1-0 108)))) + (s.f! (+ v1-11 4) f0-5) + (set! f0-6 (the-as none (l.f (+ a2-0 8)))) + (s.f! (+ v1-11 8) f0-6) + (set! a0-1 (the-as none #x3f800000)) + (set! f0-7 (the-as none (gpr->fpr a0-1))) + (s.f! (+ v1-11 12) f0-7) + (set! s5-1 (the-as none 3)) + (while (>=.si s3-0 s5-1) + (set! t9-1 (the-as none sp-launch-particles-var)) + (set! a0-2 (the-as none s1-0)) + (set! v1-12 (the-as none (sll s5-1 2))) + (set! v1-13 (the-as none (+ v1-12 gp-0))) + (set! v1-14 (the-as none (l.w (+ v1-13 12)))) + (set! v1-15 (the-as none (sll v1-14 2))) + (set! a1-2 (the-as none *part-id-table*)) + (set! v1-16 (the-as none (+ v1-15 a1-2))) + (set! a1-3 (the-as none (l.wu (+ v1-16 12)))) + (set! a2-1 (the-as none *launch-matrix*)) + (set! v1-17 (the-as none (+ a2-1 48))) + (set! a3-0 (the-as none s2-0)) + (set! a3-1 (the-as none (l.q a3-0))) + (s.q! v1-17 a3-1) + (set! t1-0 (the-as none #x3f800000)) + (call!) + (set! s5-1 (the-as none (+ s5-1 1))) + ) + ) + ) + (set! v0-2 (the-as none 0)) + (ret-none) + ) + +;; definition for function sparticle-respawn-timer +;; INFO: Used lq/sq +;; ERROR: failed type prop at 9: Could not figure out load: (set! v1 (l.w gp)) +(defun sparticle-respawn-timer ((a0-0 sparticle-system) (a1-0 sparticle-cpuinfo) (a2-0 vector)) + (local-vars + (v0-0 symbol) + (v0-1 none) + (v0-2 none) + (v1-0 int) + (v1-3 none) + (v1-4 none) + (v1-6 none) + (v1-7 none) + (v1-8 none) + (v1-9 none) + (v1-10 none) + (v1-11 none) + (v1-12 none) + (v1-13 none) + (a0-1 none) + (a1-1 sparticle-cpuinfo) + (a1-2 none) + (a1-3 none) + (a2-1 none) + (a3-0 none) + (a3-1 none) + (t1-0 none) + (s2-1 none) + (s3-0 none) + (s4-0 none) + (s5-0 none) + (t9-0 (function sparticle-system sparticle-cpuinfo symbol)) + (t9-1 none) + (gp-0 float) + (sp-0 none) + (f0-0 none) + (f0-1 none) + (f0-2 none) + (f0-3 none) + ) + (when (begin (set! v1-0 (-> a1-0 timer)) (<=0.si v1-0)) + (when (begin (set! gp-0 (-> a1-0 user-float)) (nonzero? gp-0)) + (when (begin + (set! t9-0 sp-kill-particle) + (set! a1-1 a1-0) + (call! a0-0 a1-1) + (set! v1-3 (the-as none (l.w gp-0))) + (set! s5-0 (the-as none (+ v1-3 -1))) + (set! v1-4 (the-as none 2)) + (<.si v1-4 s5-0) + ) + (if (begin (set! s4-0 (the-as none (+ sp-0 16))) (set! v1-6 (the-as none (l.w (+ gp-0 12)))) (zero? v1-6)) + (set! s3-0 (the-as none *sp-particle-system-2d*)) + (set! s3-0 (the-as none *sp-particle-system-3d*)) + ) + (set! v1-7 (the-as none s4-0)) + (set! f0-0 (the-as none (l.f a2-0))) + (s.f! v1-7 f0-0) + (set! f0-1 (the-as none (l.f (+ a1-0 108)))) + (s.f! (+ v1-7 4) f0-1) + (set! f0-2 (the-as none (l.f (+ a2-0 8)))) + (s.f! (+ v1-7 8) f0-2) + (set! a0-1 (the-as none #x3f800000)) + (set! f0-3 (the-as none (gpr->fpr a0-1))) + (s.f! (+ v1-7 12) f0-3) + (set! s2-1 (the-as none 3)) + (while (>=.si s5-0 s2-1) + (set! t9-1 (the-as none sp-launch-particles-var)) + (set! a0-2 (the-as none s3-0)) + (set! v1-8 (the-as none (sll s2-1 2))) + (set! v1-9 (the-as none (+ v1-8 gp-0))) + (set! v1-10 (the-as none (l.w (+ v1-9 12)))) + (set! v1-11 (the-as none (sll v1-10 2))) + (set! a1-2 (the-as none *part-id-table*)) + (set! v1-12 (the-as none (+ v1-11 a1-2))) + (set! a1-3 (the-as none (l.wu (+ v1-12 12)))) + (set! a2-1 (the-as none *launch-matrix*)) + (set! v1-13 (the-as none (+ a2-1 48))) + (set! a3-0 (the-as none s4-0)) + (set! a3-1 (the-as none (l.q a3-0))) + (s.q! v1-13 a3-1) + (set! t1-0 (the-as none #x3f800000)) + (call!) + (set! s2-1 (the-as none (+ s2-1 1))) + ) + ) + ) + ) + (set! v0-2 (the-as none 0)) + (ret-none) + ) + +;; definition for function sparticle-texture-animate +;; ERROR: failed type prop at 2: Could not figure out load: (set! a0 (l.w (+ v1 20))) +(defun sparticle-texture-animate ((a0-0 sparticle-system) (a1-0 sparticle-cpuinfo) (a2-0 vector)) + (local-vars + (v0-0 none) + (v0-1 none) + (v1-0 float) + (v1-1 none) + (v1-2 none) + (v1-3 none) + (v1-4 none) + (a0-2 none) + (a0-4 none) + (a0-5 none) + (a0-6 none) + (a0-7 none) + (a0-8 none) + (a0-9 none) + (a0-11 none) + (a0-13 none) + (a0-14 none) + (a0-15 none) + (a0-17 none) + (a2-1 none) + (a2-2 none) + (a2-3 none) + (a2-4 none) + (a2-5 none) + (a2-6 none) + (a2-7 none) + (a3-0 none) + (a3-1 none) + (a3-2 none) + (a3-3 none) + (a3-4 none) + (a3-5 none) + (a3-6 none) + (a3-7 none) + (t0-0 none) + (t0-1 none) + (t0-2 none) + (t0-3 none) + (t0-4 none) + (t9-0 none) + (t9-1 none) + ) + (when (begin (set! v1-0 (-> a1-0 user-float)) (nonzero? v1-0)) + (cond + ((begin + (when (begin (set! a0-2 (the-as none (l.w (+ v1-0 20)))) (zero? a0-2)) + (set! a0-4 (the-as none (l.w (+ a1-0 100)))) + (s.w! (+ v1-0 20) a0-4) + ) + (cond + ((begin + (set! a0-5 (the-as none (l.w v1-0))) + (set! a0-6 (the-as none (+ a0-5 -3))) + (set! a2-1 (the-as none (l.w (+ v1-0 12)))) + (set! a3-0 (the-as none (l.w (+ v1-0 20)))) + (set! t0-0 (the-as none (l.w (+ a1-0 100)))) + (<0.si t0-0) + ) + (set! a3-1 (the-as none *display*)) + (set! a3-2 (the-as none (l.wu (+ a3-1 44)))) + (set! t0-1 (the-as none (l.d (+ a3-2 20)))) + ) + (else + (set! t0-2 (the-as none (l.w (+ a1-0 100)))) + (set! t0-1 (the-as none (- a3-0 t0-2))) + ) + ) + (set! a3-3 (the-as none (l.w (+ v1-0 16)))) + (zero? a3-3) + ) + (when (begin + (set! a3-4 (the-as none 0)) + (set! a2-2 (the-as none (/.si t0-1 a2-1))) + (set! t0-3 (the-as none (l.hu (+ a1-0 130)))) + (set! a2-3 (the-as none (+ a2-2 t0-3))) + (set! a2-4 (the-as none a2-3)) + (set! a0-7 (the-as none (+ a0-6 -1))) + (set! a2-5 (the-as none (min.si a2-4 a0-7))) + (set! a3-5 (the-as none (max.si a3-4 a2-5))) + (set! a0-8 (the-as none (+ a3-5 3))) + (set! a0-9 (the-as none (sll a0-8 2))) + (set! v1-1 (the-as none (+ a0-9 v1-0))) + (set! v1-2 (the-as none (l.w (+ v1-1 12)))) + (nonzero? v1-2) + ) + (set! t9-0 (the-as none particle-adgif-callback)) + (set! a0-11 (the-as none (l.wu (+ a1-0 4)))) + (set! a1-1 (the-as none v1-2)) + (call!) + (set! a0-12 (the-as none v0-0)) + ) + ) + (else + (when (begin + (set! a3-6 (the-as none 0)) + (set! a2-6 (the-as none (/.si t0-1 a2-1))) + (set! t0-4 (the-as none (l.hu (+ a1-0 130)))) + (set! a2-7 (the-as none (+ a2-6 t0-4))) + (set! a3-7 (the-as none (max.si a3-6 a2-7))) + (set! a0-13 (the-as none (mod.si a3-7 a0-6))) + (set! a0-14 (the-as none (+ a0-13 3))) + (set! a0-15 (the-as none (sll a0-14 2))) + (set! v1-3 (the-as none (+ a0-15 v1-0))) + (set! v1-4 (the-as none (l.w (+ v1-3 12)))) + (nonzero? v1-4) + ) + (set! t9-1 (the-as none particle-adgif-callback)) + (set! a0-17 (the-as none (l.wu (+ a1-0 4)))) + (set! a1-2 (the-as none v1-4)) + (call!) + (set! a0-18 (the-as none v0-1)) + ) + ) + ) + ) + (ret-none) + ) + +;; definition for function sparticle-texture-day-night +;; INFO: Used lq/sq +;; ERROR: failed type prop at 21: Could not figure out load: (set! a1 (l.w (+ s2 40))) +;; ERROR: Bad vector register dependency: vf1 +;; ERROR: Bad vector register dependency: vf2 +(defun sparticle-texture-day-night ((a0-0 sparticle-system) (a1-0 sparticle-cpuinfo) (a2-0 vector)) + (local-vars + (v0-0 float) + (v0-1 none) + (v0-2 none) + (v1-1 (pointer time-of-day-proc)) + (v1-2 time-of-day-proc) + (v1-3 symbol) + (v1-4 int) + (v1-6 none) + (v1-7 none) + (v1-8 uint128) + (v1-9 uint128) + (v1-10 uint128) + (v1-11 none) + (v1-12 uint128) + (v1-13 uint128) + (v1-14 uint128) + (v1-15 none) + (v1-16 none) + (v1-17 none) + (v1-20 none) + (v1-21 none) + (v1-22 uint128) + (v1-23 uint128) + (v1-24 uint128) + (v1-25 none) + (v1-26 uint128) + (v1-27 uint128) + (v1-28 uint128) + (v1-29 none) + (v1-30 none) + (v1-31 none) + (v1-33 none) + (a0-1 symbol) + (a0-2 none) + (a0-4 none) + (a0-5 none) + (a0-6 none) + (a0-7 none) + (a0-8 none) + (a0-10 none) + (a0-11 none) + (a0-12 none) + (a0-13 none) + (a1-1 none) + (a1-2 none) + (t7-0 none) + (t7-1 none) + (t7-2 none) + (t7-3 none) + (t7-4 none) + (t7-5 none) + (s1-0 int) + (s2-0 float) + (s3-0 float) + (s4-0 float) + (t9-0 (function float)) + (t9-1 none) + (t9-2 none) + (f0-0 float) + ) + (rlet ((vf1 :class vf) + (vf2 :class vf) + ) + (when (begin (set! s2-0 (-> a1-0 user-float)) (nonzero? s2-0)) + (cond + ((begin + (or (begin + (cond + ((begin (set! v1-1 *time-of-day*) v1-1) + (set! v1-2 (-> v1-1 0)) + (set! s1-0 (-> v1-2 hours)) + ) + (else + (set! s1-0 (the-as int 0)) + ) + ) + (set! t9-0 rand-vu) + (set! v0-0 (call!)) + (set! f0-0 (gpr->fpr v0-0)) + (.mov s4-0 vf1) + (.mov s3-0 vf2) + (set! a0-1 (<.si s1-0 6)) + a0-1 + ) + (begin (set! v1-4 18) (set! v1-3 (<.si v1-4 s1-0))) + ) + v1-3 + ) + (when (begin (set! a1-1 (the-as none (l.w (+ s2-0 40)))) (nonzero? a1-1)) + (when (begin + (set! v1-6 (the-as none (fpr->gpr f0-0))) + (.mov vf2 v1-6) + (set! v1-7 (the-as none (l.w (+ s2-0 48)))) + (set! v1-8 (the-as uint128 (pcypld 0 v1-7))) + (.pextlb v1-9 0 v1-8) + (.pextlb v1-10 0 v1-9) + (.mov vf1 v1-10) + (.itof.vf vf1 vf1) + (.mul.x.vf vf1 vf1 vf2) + (set! v1-11 (the-as none (l.w (+ s2-0 44)))) + (set! v1-12 (the-as uint128 (pcypld 0 v1-11))) + (.pextlb v1-13 0 v1-12) + (.pextlb v1-14 0 v1-13) + (.mov vf2 v1-14) + (.itof.vf vf2 vf2) + (.add.vf vf1 vf1 vf2) + (set! v1-15 (the-as none (l.w (+ a1-0 104)))) + (set! a0-2 (the-as none (l.w (+ s2-0 52)))) + (nonzero? a0-2) + ) + (set! a0-4 (the-as none *time-of-day-context*)) + (.lvf vf2 (+ a0-4 108)) + (.mul.vf vf1 vf1 vf2) + (.mov a0-5 vf1) + ) + (set! v1-16 (the-as none (logand v1-15 #x4000))) + (.mov t7-0 vf1) + (set! v1-17 (the-as none (sra v1-16 14))) + (set! a0-6 (the-as none -2)) + (set! t7-1 (the-as none (logand t7-0 a0-6))) + (set! t7-2 (the-as none (logior t7-1 v1-17))) + (s.q! (+ a2-0 32) t7-2) + (set! t9-1 (the-as none particle-adgif-callback)) + (set! a0-7 (the-as none (l.wu (+ a1-0 4)))) + (call!) + (set! v1-18 (the-as none v0-1)) + ) + ) + (else + (when (begin (set! a1-2 (the-as none (l.w (+ s2-0 24)))) (nonzero? a1-2)) + (when (begin + (set! v1-20 (the-as none (fpr->gpr f0-0))) + (.mov vf2 v1-20) + (set! v1-21 (the-as none (l.w (+ s2-0 32)))) + (set! v1-22 (the-as uint128 (pcypld 0 v1-21))) + (.pextlb v1-23 0 v1-22) + (.pextlb v1-24 0 v1-23) + (.mov vf1 v1-24) + (.itof.vf vf1 vf1) + (.mul.x.vf vf1 vf1 vf2) + (set! v1-25 (the-as none (l.w (+ s2-0 28)))) + (set! v1-26 (the-as uint128 (pcypld 0 v1-25))) + (.pextlb v1-27 0 v1-26) + (.pextlb v1-28 0 v1-27) + (.mov vf2 v1-28) + (.itof.vf vf2 vf2) + (.add.vf vf1 vf1 vf2) + (set! v1-29 (the-as none (l.w (+ a1-0 104)))) + (set! a0-8 (the-as none (l.w (+ s2-0 36)))) + (nonzero? a0-8) + ) + (set! a0-10 (the-as none *time-of-day-context*)) + (.lvf vf2 (+ a0-10 108)) + (.mul.vf vf1 vf1 vf2) + (.mov a0-11 vf1) + ) + (set! v1-30 (the-as none (logand v1-29 #x4000))) + (.mov t7-3 vf1) + (set! v1-31 (the-as none (sra v1-30 14))) + (set! a0-12 (the-as none -2)) + (set! t7-4 (the-as none (logand t7-3 a0-12))) + (set! t7-5 (the-as none (logior t7-4 v1-31))) + (s.q! (+ a2-0 32) t7-5) + (set! t9-2 (the-as none particle-adgif-callback)) + (set! a0-13 (the-as none (l.wu (+ a1-0 4)))) + (call!) + (set! v1-32 (the-as none v0-2)) + ) + ) + ) + (.mov vf1 s4-0) + (.mov vf2 s3-0) + (.mov v1-33 vf2) + ) + (ret-none) + ) + ) + +;; definition for function sparticle-mode-animate +;; ERROR: failed type prop at 5: Could not figure out load: (set! a1 (l.w (+ v1 12))) +(defun sparticle-mode-animate ((a0-0 sparticle-system) (a1-0 sparticle-cpuinfo) (a2-0 vector)) + (local-vars + (v0-0 none) + (v0-1 none) + (v0-2 none) + (v0-3 none) + (v1-0 float) + (a0-1 sparticle-launch-control) + (a0-2 none) + (a0-3 none) + (a0-4 none) + (a0-5 none) + (a0-6 none) + (a0-7 none) + (a0-8 none) + (a0-9 none) + (a0-10 none) + (a0-11 none) + (a0-12 none) + (a0-13 none) + (a0-14 none) + (a1-1 none) + (a1-2 none) + (a1-3 none) + (a1-4 none) + (a1-5 none) + (a1-6 none) + (a1-7 none) + (a1-8 none) + (a1-10 none) + (a1-11 none) + (a1-12 none) + (a2-3 none) + (a2-4 none) + (a2-5 none) + (a2-6 none) + (a2-7 none) + (a2-8 none) + (a2-9 none) + (a2-10 none) + (a2-11 none) + (a2-12 none) + (a2-13 none) + (a2-14 none) + (a3-0 none) + (a3-1 none) + (a3-2 none) + (s4-0 none) + (t9-0 none) + (t9-1 none) + (t9-2 none) + (f0-0 none) + (f0-1 none) + (f0-2 none) + (f0-3 none) + ) + (when (begin (set! a0-1 (-> a1-0 key)) (set! v1-0 (-> a1-0 user-float)) (nonzero? v1-0)) + (when (begin + (set! a1-1 (the-as none (l.w (+ v1-0 12)))) + (set! a1-2 (the-as none (l.w (+ a1-1 -1)))) + (nonzero? a1-2) + ) + (when (begin + (set! a2-3 (the-as none (l.bu (+ a0-1 29)))) + (set! a2-4 (the-as none (+ a2-3 1))) + (set! a2-5 (the-as none a2-4)) + (set! a3-0 (the-as none (l.w a1-2))) + (set! a3-1 (the-as none (+ a3-0 -1))) + (set! a2-6 (the-as none (min.si a2-5 a3-1))) + (set! a2-7 (the-as none (sll a2-6 2))) + (set! a1-3 (the-as none (+ a2-7 a1-2))) + (set! a1-4 (the-as none (l.wu (+ a1-3 12)))) + (set! a0-2 (the-as none (l.wu (+ a0-1 32)))) + (set! a2-8 (the-as none (l.w (+ a1-4 12)))) + (set! a2-9 (the-as none (sra a2-8 3))) + (set! a0-3 (the-as none (/.ui a0-2 a2-9))) + (set! a2-10 (the-as none (l.w a1-4))) + (set! a2-11 (the-as none (+ a2-10 -1))) + (set! a0-4 (the-as none (mod.si a0-3 a2-11))) + (set! a0-5 (the-as none (+ a0-4 1))) + (set! a0-6 (the-as none (sll a0-5 2))) + (set! a0-7 (the-as none (+ a0-6 a1-4))) + (set! a0-8 (the-as none (l.w (+ a0-7 12)))) + (set! a1-5 (the-as none (l.w (+ v1-0 16)))) + (set! a1-6 (the-as none (sra a1-5 3))) + (set! a2-12 (the-as none (sra a1-6 6))) + (set! a2-13 (the-as none (sll a2-12 3))) + (set! a0-9 (the-as none (+ a0-8 a2-13))) + (set! a2-14 (the-as none (l.d a0-9))) + (set! a0-10 (the-as none #t)) + (set! a3-2 (the-as none 1)) + (set! a1-7 (the-as none (logand a1-6 63))) + (set! a1-8 (the-as none (ash.si a3-2 a1-7))) + (if (begin (set! a1-10 (the-as none (logand a2-14 a1-8))) (cmove-#f-zero a0-11 a1-10 a0-10) a0-11) + (set! s4-0 (the-as none (l.w (+ v1-0 24)))) + (set! s4-0 (the-as none (l.w (+ v1-0 20)))) + ) + (cond + (a0-11 + (set! t9-0 (the-as none rand-vu-float-range)) + (set! a0-12 (the-as none #x42800000)) + (set! a1-11 (the-as none #x43400000)) + (set! v0-0 (the-as none (call!))) + (set! f0-0 (the-as none (gpr->fpr v0-0))) + (s.f! (+ a2-0 32) f0-0) + (set! v1-1 (the-as none (fpr->gpr f0-0))) + ) + (else + (set! t9-1 (the-as none rand-vu-float-range)) + (set! a0-13 (the-as none #x42000000)) + (set! a1-12 (the-as none #x42400000)) + (set! v0-1 (the-as none (call!))) + (set! f0-1 (the-as none (gpr->fpr v0-1))) + (s.f! (+ a2-0 32) f0-1) + (set! v1-2 (the-as none (fpr->gpr f0-1))) + ) + ) + (set! f0-2 (the-as none (l.f (+ a2-0 32)))) + (s.f! (+ a2-0 36) f0-2) + (set! f0-3 (the-as none (l.f (+ a2-0 32)))) + (s.f! (+ a2-0 40) f0-3) + (nonzero? s4-0) + ) + (set! t9-2 (the-as none particle-adgif-callback)) + (set! a0-14 (the-as none (l.wu (+ a1-0 4)))) + (set! a1-13 (the-as none s4-0)) + (call!) + (set! a2-16 (the-as none v0-2)) + ) + ) + ) + (set! v0-3 (the-as none 0)) + (ret-none) + ) + +;; definition for function sparticle-motion-blur +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +;; ERROR: Expression building failed: In sparticle-motion-blur: [OP: 78] - Floating point math attempted on invalid types: uint and float in op (-.s f2-0 f3-0). +;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP] +;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] +;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP] +;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f3, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f3, f4, f4] +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +(defun sparticle-motion-blur ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (local-vars + (v0-0 float) + (v0-1 int) + (v1-0 math-camera) + (v1-1 int) + (v1-2 int) + (v1-3 int) + (v1-4 int) + (v1-5 float) + (a0-1 int) + (a0-2 uint128) + (a0-3 int) + (a0-4 float) + (a0-5 float) + (a0-6 uint) + (a0-7 float) + (a0-8 int) + (a1-1 int) + (a1-2 uint128) + (a1-3 uint128) + (a1-4 uint) + (a1-5 float) + (a1-6 float) + (a1-7 int) + (a2-1 uint128) + (a2-2 uint128) + (a2-3 float) + (s4-0 float) + (s5-0 uint) + (t9-0 (function float float float)) + (f0-0 float) + (f0-1 float) + (f0-2 float) + (f0-3 float) + (f0-4 float) + (f0-5 float) + (f0-6 float) + (f0-7 float) + (f0-8 float) + (f1-0 float) + (f1-1 float) + (f1-2 float) + (f1-3 float) + (f2-0 uint) + (f2-1 float) + (f2-2 float) + (f2-3 float) + (f2-4 float) + (f3-0 float) + (f3-1 float) + (f3-2 float) + (f3-3 float) + (f3-4 int) + (f4-0 float) + (f4-1 uint) + (f4-2 float) + (f5-0 int) + ) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf10 :class vf) + (vf11 :class vf) + (vf12 :class vf) + (vf13 :class vf) + (vf2 :class vf) + (vf24 :class vf) + (vf25 :class vf) + (vf26 :class vf) + (vf27 :class vf) + (vf29 :class vf) + (vf3 :class vf) + (vf30 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + (vf9 :class vf) + ) + (init-vf0-vector) + (set! a0-1 #xffff) + (set! v1-0 *math-camera*) + (set! a1-1 (shl a0-1 48)) + (set! a0-2 (-> arg1 vel-sxvel quad)) + (.lvf vf1 (&-> arg2 quad)) + (.pceqw a2-1 a0-2 0) + (.lvf vf24 (&-> v1-0 camera-temp vector 0 quad)) + (.ppach a2-2 (the-as uint128 0) a2-1) + (.lvf vf25 (&-> v1-0 camera-temp vector 1 quad)) + (set! a1-2 (logior a2-2 a1-1)) + (.lvf vf26 (&-> v1-0 camera-temp vector 2 quad)) + (set! a1-3 (+ a1-2 1)) + (.lvf vf27 (&-> v1-0 camera-temp trans quad)) + ((b! (zero? a1-3) L36 (.qmtc2.i vf4 a0-2)) (.mov vf4 a0-2)) + (set! a0-3 #x42000000) + (.lvf vf30 (&-> v1-0 hvdf-off quad)) + (.lvf vf29 (&-> v1-0 hmge-scale quad)) + (.mul.x.vf acc vf24 vf1) + (.add.mul.y.vf acc vf25 vf1 acc) + (.add.mul.z.vf acc vf26 vf1 acc) + (.add.mul.w.vf vf10 vf27 vf0 acc) + (.mov vf5 a0-3) + (.mul.vf vf12 vf10 vf29) + (.mul.w.vf acc vf1 vf0) + (.add.mul.x.vf vf1 vf4 vf5 acc) + (.div.vf Q vf0 vf12 :fsf #b11 :ftf #b11) + (TODO.VCLIP vf12 vf12) + (.mul.x.vf acc vf24 vf1) + (.add.mul.y.vf acc vf25 vf1 acc) + (.add.mul.z.vf acc vf26 vf1 acc) + (.add.mul.w.vf vf11 vf27 vf0 acc) + (.wait.vf) + (.cfc2.i v1-1 Clipping) + (.mul.vf vf10 vf10 Q :mask #b111) + (.mul.vf vf13 vf11 vf29) + (set! v1-2 (logand v1-1 63)) + ((b! (nonzero? v1-2) L36 (.vadd.xyzw vf10 vf10 vf30)) (.add.vf vf10 vf10 vf30)) + (.div.vf Q vf0 vf13 :fsf #b11 :ftf #b11) + (TODO.VCLIP vf13 vf13) + (.max.x.vf vf10 vf10 vf0 :mask #b1000) + (vftoi4.xyzw vf2 vf10) + (.wait.vf) + (.mul.vf vf11 vf11 Q :mask #b111) + (.cfc2.i v1-3 Clipping) + (.itof.vf vf6 vf2) + (.add.vf vf11 vf11 vf30) + (set! v1-4 (logand v1-3 63)) + ((b! (nonzero? v1-4) L36 (.vdiv Q vf0 .w vf6 .z)) (.div.vf Q vf0 vf6 :fsf #b11 :ftf #b10)) + (.max.x.vf vf11 vf11 vf0 :mask #b1000) + (.add.w.vf vf9 vf0 vf0 :mask #b1) + (vftoi4.xyzw vf3 vf11) + (.itof.vf vf7 vf3) + (.sub.vf vf8 vf7 vf6 :mask #b11) + (.mov s4-0 vf8) + (set! s5-0 (sar (the-as int s4-0) 32)) + (.mul.vf vf9 vf9 Q :mask #b1) + (set! t9-0 atan) + (set! a0-4 s4-0) + (set! a1-4 s5-0) + (set! v0-0 (atan s4-0 (the-as float s5-0))) + (set! a0-5 v0-0) + (set! v1-5 (-> arg1 omega)) + (set! a1-5 -16384.0) + (set! f0-0 -16384.0) + (set! f1-0 a0-5) + (set! f0-1 (+ -16384.0 a0-5)) + (s.f! (+ arg2 24) f0-1) + ((b! (zero? v1-5) L37 (.qmfc2.i a0-6 vf9)) (.mov a0-6 vf9)) + (set! f2-0 (gpr->fpr a0-6)) + (set! a0-7 1.0) + (set! f1-1 0.0) + (set! a1-6 0.000001) + (set! a2-3 0.00000014285715) + (set! f0-2 a0-7) + (set! f3-0 a1-6) + (set! f4-0 a2-3) + (set! f2-1 (-.s f2-0 f3-0)) + (set! f3-1 (-.s f4-0 f3-0)) + (set! f2-2 (/.s f2-1 f3-1)) + (set! f3-2 (gpr->fpr s4-0)) + (set! f4-1 (gpr->fpr s5-0)) + (.mula.s f3-2 f3-2) + (.madd.s f3-3 f4-1 f4-1) + (set! f2-3 (max.s f2-2 f1-1)) + (set! f1-2 (sqrt.s f3-3)) + (set! f2-4 (min.s f2-3 f0-2)) + (set! a0-8 #x40400000) + (set! f0-3 (-.s f0-2 f2-4)) + (set! a1-7 #x3e800000) + (set! f3-4 (gpr->fpr a0-8)) + (set! f5-0 (gpr->fpr a1-7)) + (set! f4-2 (gpr->fpr v1-5)) + (.mula.s f0-3 f3-4) + (.madd.s f0-4 f2-4 f5-0) + (set! f0-5 (*.s f0-4 f1-2)) + (set! f0-6 (*.s f0-5 f4-2)) + ((b! #t L37 (s.f! (+ arg2 12) f0-6)) (set! (-> arg2 w) f0-6)) + (when (begin (label cfg-5) (set! f0-7 (-> arg1 omega)) (set! f1-3 0.0) (!=.s f0-7 f1-3)) + (set! f0-8 0.0) + (set! (-> arg2 w) f0-8) + (set! v1-7 (fpr->gpr f0-8)) + ) + (label cfg-7) + (set! v0-1 0) + (ret-none) + ) + ) + +;; definition (debug) for function sparticle-motion-blur-old +;; INFO: Return type mismatch int vs object. +(defun-debug sparticle-motion-blur-old ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 sprite-vec-data-3d)) + "Unused" + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector4w)) + (s3-0 (new 'stack-no-clear 'vector4w)) + ) + (set! (-> s2-0 x) (-> arg2 x-y-z-sx x)) + (set! (-> s2-0 y) (-> arg2 x-y-z-sx y)) + (set! (-> s2-0 z) (-> arg2 x-y-z-sx z)) + (set! (-> s2-0 w) 1.0) + (when (and (or (!= (-> arg1 vel-sxvel x) 0.0) (!= (-> arg1 vel-sxvel y) 0.0) (!= (-> arg1 vel-sxvel z) 0.0)) + (transform-point-qword! s5-0 s2-0) + ) + (+! (-> s2-0 x) (* 32.0 (-> arg1 vel-sxvel x))) + (+! (-> s2-0 y) (* 32.0 (-> arg1 vel-sxvel y))) + (+! (-> s2-0 z) (* 32.0 (-> arg1 vel-sxvel z))) + (when (transform-point-qword! s3-0 s2-0) + (let* ((f0-14 (the float (+ (-> s5-0 x) -28672))) + (f1-10 (the float (+ (-> s5-0 y) -29440))) + (f2-4 (the float (+ (-> s3-0 x) -28672))) + (f3-1 (the float (+ (-> s3-0 y) -29440))) + (f30-0 (- f2-4 f0-14)) + (f28-0 (- f3-1 f1-10)) + ) + (set! (-> arg2 qx-qy-qz-sy z) (+ -16384.0 (atan f30-0 f28-0))) + (let ((f0-17 (-> arg1 omega))) + (if (!= f0-17 0.0) + (set! (-> arg2 x-y-z-sx w) (* (sqrtf (+ (* f30-0 f30-0) (* f28-0 f28-0))) + f0-17 + (lerp-scale 3.0 0.25 (/ 1.0 (the float (-> s5-0 z))) 0.000001 0.00000014285715) + ) + ) + ) + ) + ) + (return (the-as object #f)) + ) + ) + ) + (if (!= (-> arg1 omega) 0.0) + (set! (-> arg2 x-y-z-sx w) 0.0) + ) + 0 + ) + +;; definition for function sparticle-set-conerot +;; INFO: Return type mismatch int vs none. +(defun sparticle-set-conerot ((arg0 sparticle-launcher) (arg1 vector)) + (let ((s5-0 (get-field-spec-by-id arg0 (sp-field-id spt-conerot-x))) + (s4-0 (get-field-spec-by-id arg0 (sp-field-id spt-conerot-y))) + (v1-3 (get-field-spec-by-id arg0 (sp-field-id spt-conerot-z))) + ) + (set! (-> s5-0 initial-valuef) (-> arg1 x)) + (set! (-> s4-0 initial-valuef) (-> arg1 y)) + (set! (-> v1-3 initial-valuef) (-> arg1 z)) + ) + 0 + (none) + ) + +;; definition for function sparticle-next-on-mode-1 +(defun sparticle-next-on-mode-1 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (if (zero? (-> arg1 key state-mode 0)) + (set! (-> arg1 next-time) + (the-as uint (* (max 1 (the-as int (-> *display* clock (-> arg1 clock-index) sparticle-data x))) 2)) + ) + ) + 0.0 + ) + +;; definition for function check-ground-bounce +(defun check-ground-bounce ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (let ((f0-1 (+ (-> arg1 key origin trans y) (-> arg1 user-float)))) + (when (and (< (-> arg2 launchrot y) f0-1) (< (-> arg1 vel-sxvel y) 0.0)) + (set! (-> arg2 launchrot y) f0-1) + (let ((f0-4 (* (-> arg1 vel-sxvel y) (- (rand-vu-float-range 0.6 0.8))))) + (set! (-> arg1 vel-sxvel y) f0-4) + f0-4 + ) + ) + ) + ) + +;; definition for function check-drop-group-center +;; INFO: Return type mismatch symbol vs none. +(defun check-drop-group-center ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (let ((f0-0 (-> arg1 key origin trans y))) + (if (< (-> arg2 launchrot y) f0-0) + (sp-kill-particle arg0 arg1) + ) + ) + (none) + ) + +;; definition for function birth-func-y->userdata +;; INFO: Return type mismatch int vs none. +(defun birth-func-y->userdata ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (+! (-> arg1 user-float) (-> arg2 vector 0 y)) + 0 + (none) + ) + +;; definition for function birth-func-ocean-height +;; INFO: Return type mismatch int vs none. +(defun birth-func-ocean-height ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (set! (-> arg2 vector 0 y) (+ (ocean-method-11 *ocean* (-> arg2 vector) #t) (-> arg1 user-float))) + 0 + (none) + ) + +;; definition for function birth-func-camera-orient +;; INFO: Return type mismatch int vs none. +(defun birth-func-camera-orient ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (local-vars (v1-0 float) (v1-1 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-1 (forward-up-nopitch->quaternion + (new 'stack-no-clear 'quaternion) + (-> (math-camera-matrix) vector 2) + *up-vector* + ) + ) + ) + (quaternion-rotate-x! s5-1 s5-1 16384.0) + (cond + ((< (-> s5-1 w) 0.0) + (.lvf vf1 (&-> arg2 conerot quad)) + (.lvf vf2 (&-> s5-1 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 conerot quad) vf1) + (.mov v1-0 vf1) + ) + (else + (.lvf vf1 (&-> arg2 conerot quad)) + (.lvf vf2 (&-> s5-1 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> arg2 conerot quad) vf1) + (.mov v1-1 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for symbol *particle-quat*, type quaternion +(define *particle-quat* (new 'static 'quaternion :w 1.0)) + +;; definition for function birth-func-set-quat +;; INFO: Return type mismatch int vs none. +(defun birth-func-set-quat ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (local-vars (a0-2 float) (a0-3 float)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((a0-1 arg2) + (v1-0 *particle-quat*) + ) + (cond + ((< (-> v1-0 w) 0.0) + (.lvf vf1 (&-> a0-1 conerot quad)) + (.lvf vf2 (&-> v1-0 vec quad)) + (.sub.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> a0-1 conerot quad) vf1) + (.mov a0-2 vf1) + ) + (else + (.lvf vf1 (&-> a0-1 conerot quad)) + (.lvf vf2 (&-> v1-0 vec quad)) + (.add.vf vf1 vf0 vf2 :mask #b111) + (.svf (&-> a0-1 conerot quad) vf1) + (.mov a0-3 vf1) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for symbol *particle-vel*, type vector +(define *particle-vel* (new 'static 'vector :w 1.0)) + +;; definition for function birth-func-set-vel +;; INFO: Return type mismatch int vs none. +(defun birth-func-set-vel ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (let ((v1-0 *particle-vel*)) + (set! (-> arg1 vel-sxvel x) (-> v1-0 x)) + (set! (-> arg1 vel-sxvel y) (-> v1-0 y)) + (set! (-> arg1 vel-sxvel z) (-> v1-0 z)) + ) + 0 + (none) + ) + +;; definition for function birth-func-texture-group +;; INFO: Return type mismatch int vs none. +(defun birth-func-texture-group ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) + (let ((s5-0 (the-as object (-> arg1 user-float)))) + (when (nonzero? (the-as float s5-0)) + (let ((a0-1 (+ (-> (the-as (pointer int32) s5-0) 0) -3))) + (if (nonzero? (l.w (+ (* (+ (rand-vu-int-count a0-1) 3) 4) (the-as int s5-0) 12))) + (particle-adgif-callback (-> arg1 adgif)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type sparticle-launcher +;; WARN: new jak 2 until loop case, check carefully +(defmethod get-field-spec-by-id sparticle-launcher ((obj sparticle-launcher) (arg0 sp-field-id)) + "Returns the [[sp-field-init-spec]] that has the matching [[sp-field-id]]" + (let ((v1-0 0)) + (until #f + (let ((a2-2 (-> obj init-specs v1-0 field))) + (cond + ((= a2-2 arg0) + (return (-> obj init-specs v1-0)) + ) + ((or (< (the-as uint arg0) (the-as uint a2-2)) (= a2-2 (sp-field-id spt-end))) + (return (the-as sp-field-init-spec #f)) + ) + (else + (+! v1-0 1) + ) + ) + ) + ) + ) + (the-as sp-field-init-spec #f) + ) + +;; definition for method 10 of type sparticle-launcher +;; ERROR: failed type prop at 45: Could not figure out load: (set! v1 (l.w (+ gp 12))) +(defmethod sparticle-launcher-method-10 sparticle-launcher ((a0-0 sparticle-launcher) (a1-0 string)) + (local-vars + (v0-0 sp-field-init-spec) + (v0-1 texture-id) + (v0-2 sp-field-init-spec) + (v0-3 symbol) + (v0-4 none) + (v0-5 none) + (v1-0 type) + (v1-1 texture-id) + (v1-2 type) + (v1-3 sp-field-init-spec) + (v1-4 int) + (v1-5 int) + (v1-6 symbol) + (v1-7 symbol) + (v1-8 none) + (v1-9 none) + (v1-10 none) + (v1-11 none) + (v1-12 none) + (v1-13 none) + (v1-14 none) + (v1-15 none) + (v1-16 none) + (v1-17 none) + (v1-18 none) + (v1-19 none) + (v1-20 none) + (v1-21 none) + (v1-22 none) + (v1-23 none) + (a0-1 sparticle-launcher) + (a0-2 string) + (a0-5 sparticle-launcher) + (a0-6 symbol) + (a0-7 sp-flag) + (a0-9 symbol) + (a0-10 float) + (a0-11 float) + (a0-12 int) + (a0-14 none) + (a1-1 int) + (a1-2 symbol) + (a1-3 int) + (a1-4 sp-flag) + (a1-5 type) + (s5-0 sp-field-init-spec) + (s5-1 none) + (t9-0 (function sparticle-launcher sp-field-id sp-field-init-spec)) + (t9-1 (function string symbol texture-id)) + (t9-2 (function sparticle-launcher sp-field-id sp-field-init-spec)) + (t9-3 (function object type symbol)) + (t9-4 none) + (gp-1 object) + ) + (when (begin + (when (begin + (set! a0-1 a0-0) + (set! v1-0 (-> a0-1 type)) + (set! t9-0 (method-of-type v1-0 get-field-spec-by-id)) + (set! a1-1 1) + (set! v0-0 (call! a0-1 a1-1)) + (set! s5-0 v0-0) + (set! t9-1 lookup-texture-id-by-name) + (set! a1-2 #f) + (set! a0-2 a1-0) + (set! v0-1 (call! a0-2 a1-2)) + (set! v1-1 v0-1) + s5-0 + ) + (set! (-> s5-0 initial-valuef) (the-as float v1-1)) + (set! a0-4 v1-1) + ) + (and (begin + (set! v1-2 (-> a0-0 type)) + (set! t9-2 (method-of-type v1-2 get-field-spec-by-id)) + (set! a1-3 48) + (set! a0-5 a0-0) + (set! v0-2 (call! a0-5 a1-3)) + (set! v1-3 v0-2) + v1-3 + ) + (begin (set! a0-7 (-> v1-3 flags)) (set! a1-4 (+ a0-7 -4)) (set! a0-6 (zero? a1-4))) + ) + a0-6 + ) + (when (begin + (and (begin + (set! gp-1 (-> v1-3 initial-valuef)) + (set! v1-4 (logand gp-1 7)) + (set! v1-5 (+ v1-4 -4)) + (set! a0-9 (zero? v1-5)) + a0-9 + ) + (begin (set! t9-3 type?) (set! a0-10 gp-1) (set! a1-5 array) (set! v0-3 (call! a0-10 a1-5)) v0-3) + (begin + (set! v1-7 #t) + (set! a0-11 (-> gp-1 1)) + (set! a0-12 (logand a0-11 128)) + (cmove-#f-zero v1-6 a0-12 v1-7) + ) + ) + v1-6 + ) + (set! v1-8 (the-as none (l.w (+ gp-1 12)))) + (set! v1-9 (the-as none (sra v1-8 3))) + (s.w! (+ gp-1 12) v1-9) + (set! v1-10 (the-as none (l.w (+ gp-1 16)))) + (set! v1-11 (the-as none (logand v1-10 8))) + (set! v1-12 (the-as none (sra v1-11 3))) + (s.w! (+ gp-1 16) v1-12) + (set! v1-13 (the-as none (l.w (+ gp-1 20)))) + (set! v1-14 (the-as none (sra v1-13 3))) + (s.w! (+ gp-1 20) v1-14) + (set! v1-15 (the-as none int32)) + (s.w! (+ gp-1 8) v1-15) + (set! s5-1 (the-as none 0)) + (while (begin (set! v1-22 (the-as none (l.w gp-1))) (set! v1-23 (the-as none (+ v1-22 -3))) (<.si s5-1 v1-23)) + (set! t9-4 (the-as none lookup-texture-id-by-name)) + (set! v1-16 (the-as none (+ s5-1 3))) + (set! v1-17 (the-as none (sll v1-16 2))) + (set! v1-18 (the-as none (+ v1-17 gp-1))) + (set! a0-14 (the-as none (l.w (+ v1-18 12)))) + (set! v0-4 (the-as none (call!))) + (set! v1-19 (the-as none (+ s5-1 3))) + (set! v1-20 (the-as none (sll v1-19 2))) + (set! v1-21 (the-as none (+ v1-20 gp-1))) + (s.w! (+ v1-21 12) v0-4) + (set! s5-1 (the-as none (+ s5-1 1))) + ) + ) + ) + (set! v0-5 (the-as none 0)) + (ret-none) + ) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle_REF.gc new file mode 100644 index 0000000000..9ed28e26a9 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle_REF.gc @@ -0,0 +1,812 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 2 of type sparticle-cpuinfo +;; INFO: Return type mismatch object vs sparticle-cpuinfo. +(defmethod print sparticle-cpuinfo ((obj sparticle-cpuinfo)) + (format #t "~%") + (dotimes (s5-0 16) + (format #t "~D:~F~%" s5-0 (the-as float (-> obj data s5-0))) + ) + (format #t "TIMER:~D~%" (-> obj timer)) + (the-as sparticle-cpuinfo (format #t "FLAGS:~X~%" (-> obj flags))) + ) + +;; definition for function sp-particle-copy! +;; INFO: Used lq/sq +;; INFO: Return type mismatch (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none) vs none. +(defun sp-particle-copy! ((arg0 sparticle-cpuinfo) (arg1 sparticle-cpuinfo)) + (let ((v1-1 (-> arg1 sprite x-y-z-sx quad))) + (set! (-> arg0 sprite x-y-z-sx quad) v1-1) + ) + (let ((v1-3 (-> arg1 sprite flag-rot-sy quad))) + (set! (-> arg0 sprite flag-rot-sy quad) v1-3) + ) + (let ((v1-5 (-> arg1 sprite r-g-b-a quad))) + (set! (-> arg0 sprite r-g-b-a quad) v1-5) + ) + (dotimes (v1-6 10) + (set! (-> arg0 adgif prims v1-6) (-> arg1 adgif prims v1-6)) + ) + (set! (-> arg0 vel-sxvel quad) (-> arg1 vel-sxvel quad)) + (set! (-> arg0 rot-syvel quad) (-> arg1 rot-syvel quad)) + (set! (-> arg0 fade quad) (-> arg1 fade quad)) + (set! (-> arg0 acc quad) (-> arg1 acc quad)) + (set! (-> arg0 friction) (-> arg1 friction)) + (set! (-> arg0 timer) (-> arg1 timer)) + (set! (-> arg0 flags) (-> arg1 flags)) + (set! (-> arg0 user-float) (-> arg1 user-float)) + (set! (-> arg0 sp-func) (-> arg1 sp-func)) + (none) + ) + +;; definition for method 0 of type sparticle-system +(defmethod new sparticle-system ((allocation symbol) + (type-to-make type) + (arg0 int) + (arg1 int) + (arg2 symbol) + (arg3 pointer) + (arg4 (inline-array adgif-shader)) + ) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (let* ((v1-3 (/ (+ arg0 63) 64)) + (a0-2 (/ (+ arg1 63) 64)) + (a1-2 (* v1-3 64)) + (a2-2 (* a0-2 64)) + (s2-1 (+ v1-3 a0-2)) + (s5-1 (+ a1-2 a2-2)) + ) + (set! (-> gp-0 blocks 0) v1-3) + (set! (-> gp-0 length 0) a1-2) + (set! (-> gp-0 num-alloc 0) 0) + (set! (-> gp-0 blocks 1) a0-2) + (set! (-> gp-0 length 1) a2-2) + (set! (-> gp-0 num-alloc 1) 0) + (set! (-> gp-0 is-3d) (the-as basic arg2)) + (set! (-> gp-0 alloc-table) (the-as (pointer uint64) (malloc 'global (* s2-1 8)))) + (set! (-> gp-0 cpuinfo-table) (the-as (inline-array sparticle-cpuinfo) (malloc 'global (* 144 s5-1)))) + (set! (-> gp-0 vecdata-table) arg3) + (set! (-> gp-0 adgifdata-table) arg4) + (dotimes (v1-5 s2-1) + (set! (-> gp-0 alloc-table v1-5) (the-as uint -1)) + ) + (dotimes (s4-1 s5-1) + (set! (-> gp-0 cpuinfo-table s4-1 valid) (the-as uint 0)) + (set! (-> gp-0 cpuinfo-table s4-1 sprite) + (the-as sprite-vec-data-2d (&+ (-> gp-0 vecdata-table) (* 48 s4-1))) + ) + (set! (-> gp-0 cpuinfo-table s4-1 adgif) (-> gp-0 adgifdata-table s4-1)) + (adgif-shader<-texture-simple! (-> gp-0 adgifdata-table s4-1) (the-as texture #f)) + (set! (-> gp-0 adgifdata-table s4-1 alpha) (new 'static 'gs-alpha :b #x2 :d #x1)) + ) + ) + gp-0 + ) + ) + +;; failed to figure out what this is: +(kmemopen global "part-systems") + +;; definition for symbol *sp-particle-system-2d*, type sparticle-system +(define *sp-particle-system-2d* + (new 'global 'sparticle-system 1920 128 #f (-> *sprite-array-2d* vec-data) (-> *sprite-array-2d* adgif-data)) + ) + +;; definition for symbol *sp-particle-system-3d*, type sparticle-system +(define *sp-particle-system-3d* + (new 'global 'sparticle-system 256 0 #t (-> *sprite-array-3d* vec-data) (-> *sprite-array-3d* adgif-data)) + ) + +;; failed to figure out what this is: +(kmemclose) + +;; definition for function sp-get-block-size +(defun sp-get-block-size ((arg0 sparticle-system) (arg1 int)) + (let ((v0-0 0)) + (let ((v1-0 0) + (a2-0 (-> arg0 blocks 0)) + ) + (when (= arg1 1) + (set! v1-0 a2-0) + (set! a2-0 (-> arg0 blocks 1)) + ) + (dotimes (a1-3 a2-0) + (if (!= (-> arg0 alloc-table (+ v1-0 a1-3)) -1) + (set! v0-0 (+ a1-3 1)) + ) + ) + ) + v0-0 + ) + ) + +;; definition for function sp-get-approx-alloc-size +(defun sp-get-approx-alloc-size ((arg0 sparticle-system) (arg1 int)) + (let ((a3-0 arg1) + (v1-0 0) + ) + (let ((a1-1 0) + (a2-0 (-> arg0 blocks 0)) + ) + (when (= a3-0 1) + (set! a1-1 a2-0) + (set! a2-0 (-> arg0 blocks 1)) + ) + (dotimes (a3-3 a2-0) + (if (!= (-> arg0 alloc-table (+ a1-1 a3-3)) -1) + (set! v1-0 (+ a3-3 1)) + ) + ) + ) + (* v1-0 64) + ) + ) + +;; definition for function sp-free-particle +;; INFO: Return type mismatch int vs none. +(defun sp-free-particle ((arg0 sparticle-system) (arg1 int) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-2d)) + (if (and (-> arg2 binding) (nonzero? (-> arg2 binding))) + (logclear! (-> arg2 binding flags) (sp-launch-state-flags launcher-active particles-active)) + ) + (let ((v1-6 (/ arg1 64)) + (t0-4 (logand arg1 63)) + ) + (logior! (-> arg0 alloc-table v1-6) (ash 1 t0-4)) + ) + (if (< arg1 (-> arg0 length 0)) + (+! (-> arg0 num-alloc 0) -1) + (+! (-> arg0 num-alloc 1) -1) + ) + (set! (-> arg2 valid) (the-as uint 0)) + (set! (-> arg3 r-g-b-a w) 0.0) + 0 + (none) + ) + +;; definition for function sp-get-particle +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t3, t2] +;; ERROR: Unsupported inline assembly instruction kind - [movz a2, t2, t1] +(defun sp-get-particle ((arg0 sparticle-system) (arg1 int) (arg2 sparticle-launch-state)) + (local-vars + (a2-3 int) + (a2-4 int) + (a2-5 int) + (a2-6 int) + (a2-7 int) + (a2-8 int) + (t1-16 int) + (t1-17 int) + (t1-18 int) + (t1-19 int) + (t1-20 int) + (t3-5 int) + ) + (let ((v1-0 0) + (t0-0 (-> arg0 blocks 0)) + (a3-0 0) + ) + (when (= arg1 1) + (set! v1-0 t0-0) + (set! t0-0 (-> arg0 blocks 1)) + ) + (when arg2 + (set! a3-0 (the-as int (-> arg2 randomize))) + (+! (-> arg2 randomize) 1) + (when (= (-> arg2 randomize) t0-0) + (set! (-> arg2 randomize) (the-as uint 0)) + 0 + ) + ) + (dotimes (a2-1 t0-0) + (when (nonzero? (-> arg0 alloc-table (+ v1-0 a3-0))) + (let ((a2-2 0) + (t1-15 (-> arg0 alloc-table (+ v1-0 a3-0))) + (t0-4 (* (+ v1-0 a3-0) 64)) + ) + 0 + 0 + (let ((t2-4 (shl t1-15 32)) + (t3-0 (+ a2-2 32)) + ) + (move-if-not-zero t1-16 t2-4 t2-4 t1-15) + (.movz a2-3 t3-0 t2-4 a2-2) + ) + (let ((t2-5 (shl t1-16 16)) + (t3-1 (+ a2-3 16)) + ) + (move-if-not-zero t1-17 t2-5 t2-5 t1-16) + (.movz a2-4 t3-1 t2-5 a2-3) + ) + (let ((t2-6 (* t1-17 256)) + (t3-2 (+ a2-4 8)) + ) + (move-if-not-zero t1-18 t2-6 t2-6 t1-17) + (.movz a2-5 t3-2 t2-6 a2-4) + ) + (let ((t2-7 (* t1-18 16)) + (t3-3 (+ a2-5 4)) + ) + (move-if-not-zero t1-19 t2-7 t2-7 t1-18) + (.movz a2-6 t3-3 t2-7 a2-5) + ) + (let ((t2-8 (* t1-19 4)) + (t3-4 (+ a2-6 2)) + ) + (move-if-not-zero t1-20 t2-8 t2-8 t1-19) + (.movz a2-7 t3-4 t2-8 a2-6) + (let ((t1-21 (* t1-20 2)) + (t2-9 (+ a2-7 1)) + ) + (move-if-not-zero t3-5 t1-21 t1-21 t3-4) + (.movz a2-8 t2-9 t1-21 a2-7) + ) + ) + (let ((t0-5 (+ t0-4 a2-8))) + (logxor! (-> arg0 alloc-table (+ v1-0 a3-0)) (the-as uint (ash 1 a2-8))) + (+! (-> arg0 num-alloc arg1) 1) + (let ((v1-9 (-> arg0 cpuinfo-table t0-5))) + (set! (-> v1-9 valid) (the-as uint 1)) + (return v1-9) + ) + ) + ) + ) + (+! a3-0 1) + (if (= a3-0 t0-0) + (set! a3-0 0) + ) + ) + ) + (the-as sparticle-cpuinfo #f) + ) + +;; definition for function sp-kill-particle +(defun sp-kill-particle ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (cond + ((>= (the-as int arg1) #x70000000) + (set! (-> arg1 timer) 0) + 0 + ) + (else + (let ((a2-1 (/ (the-as int (- (the-as uint arg1) (the-as uint (the-as uint (-> arg0 cpuinfo-table 0))))) 144))) + (when (or (< a2-1 0) (>= a2-1 (+ (-> arg0 length 0) (-> arg0 length 1)))) + (format 0 "Tried to release particle ~D~%" a2-1) + (return #f) + ) + (sp-free-particle arg0 a2-1 arg1 (-> arg1 sprite)) + ) + ) + ) + #t + ) + +;; definition for function sp-orbiter +;; INFO: Return type mismatch int vs none. +(defun sp-orbiter ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let* ((f2-0 (-> arg1 omega)) + (f0-0 (-> arg1 radius)) + (f3-0 (-> arg1 vel-sxvel x)) + (f30-0 (-> arg1 vel-sxvel y)) + (f1-0 (-> arg1 vel-sxvel z)) + (f4-0 (-> *display* clock (-> arg1 clock-index) sparticle-data y)) + (f26-0 (+ f2-0 (* f3-0 f4-0))) + ) + (set! (-> arg1 omega) f26-0) + (let ((f28-0 (+ f0-0 (* f1-0 f4-0)))) + (set! (-> arg1 radius) f28-0) + (let ((f24-0 (sin f26-0)) + (f26-1 (cos f26-0)) + (f22-0 (sin (* 0.5 f30-0))) + (f0-5 (cos (* 0.5 f30-0))) + (a1-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (new 'stack-no-clear 'matrix))) + (set-vector! a1-1 (* f22-0 f26-1) 0.0 (* f22-0 f24-0) f0-5) + (quaternion*! (-> arg1 rotvel3d) (the-as quaternion a1-1) (-> arg1 rotvel3d)) + (quaternion-normalize! (-> arg1 rotvel3d)) + (set-vector! s4-0 (* f24-0 f28-0) 0.0 (* f26-1 f28-0) 1.0) + (quaternion->matrix s3-0 (-> arg1 rotvel3d)) + (vector-matrix*! s4-0 s4-0 s3-0) + ) + (let ((v1-8 (the-as sprite-vec-data-2d (-> arg1 user-float)))) + (set! (-> arg2 x) (+ (-> s4-0 x) (-> v1-8 x-y-z-sx x))) + (set! (-> arg2 y) (+ (-> s4-0 y) (-> v1-8 x-y-z-sx y))) + (set! (-> arg2 z) (+ (-> s4-0 z) (-> v1-8 x-y-z-sx z))) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function sp-process-block-2d +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function sp-process-block-3d +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function sp-copy-to-spr +;; INFO: Return type mismatch int vs none. +(defun sp-copy-to-spr ((arg0 int) (arg1 pointer) (arg2 int)) + (let ((a2-1 (/ (+ arg2 15) 16))) + (dma-send-to-spr-no-flush (the-as uint arg0) (the-as uint arg1) (the-as uint a2-1) #t) + ) + 0 + (none) + ) + +;; definition for function sp-copy-from-spr +;; INFO: Return type mismatch int vs none. +(defun sp-copy-from-spr ((arg0 int) (arg1 pointer) (arg2 int)) + (let ((a2-1 (/ (+ arg2 15) 16))) + (dma-send-from-spr-no-flush (the-as uint arg1) (the-as uint arg0) (the-as uint a2-1) #t) + ) + 0 + (none) + ) + +;; definition for function memcpy +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function sp-process-block +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun sp-process-block ((arg0 sparticle-system) (arg1 int) (arg2 sprite-array-2d) (arg3 int)) + (local-vars (sv-16 int) (sv-32 int) (sv-48 int) (sv-64 int)) + (let ((s3-0 208) + (s2-0 (* 144 arg3)) + (s5-0 (* 48 arg3)) + ) + (set! sv-32 (* 80 arg3)) + (let ((s1-0 (+ s3-0 s2-0))) + (set! sv-16 (+ s1-0 s5-0)) + (sp-copy-to-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) + (sp-copy-to-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) + (let ((t9-2 sp-copy-to-spr) + (a1-7 (-> arg0 adgifdata-table arg1)) + ) + (t9-2 sv-16 (the-as pointer a1-7) sv-32) + ) + (set! sv-48 (+ #x70000000 s3-0)) + (set! sv-64 (+ #x70000000 s1-0)) + (let ((t1-0 (paused?))) + (cond + ((-> arg0 is-3d) + (let ((t9-4 sp-process-block-3d) + (a0-6 arg0) + (a3-1 arg1) + ) + (t9-4 a0-6 sv-48 sv-64 a3-1 arg3 t1-0) + ) + ) + (else + (sp-process-block-2d arg0 sv-48 sv-64 arg1 arg3 t1-0) + ) + ) + ) + (sp-copy-from-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) + (sp-copy-from-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) + ) + ) + 0 + (none) + ) + +;; definition for function sp-process-particle-system +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun sp-process-particle-system ((arg0 sparticle-system) (arg1 int) (arg2 sprite-array-2d)) + (countdown (v1-0 13) + (let ((a0-4 (-> *display* clock v1-0 sparticle-data quad))) + (set! (-> (the-as vector (+ #x70000000 (* v1-0 16))) quad) a0-4) + ) + ) + (let* ((v1-3 208) + (s1-0 (/ (- #x4000 v1-3) 272)) + (s2-0 0) + (s3-0 (sp-get-approx-alloc-size arg0 arg1)) + ) + (if (= arg1 1) + (set! s2-0 (* (-> arg0 blocks 0) 64)) + ) + (set! (-> arg2 num-valid arg1) s3-0) + (flush-cache 0) + (while (>= s3-0 s1-0) + (sp-process-block arg0 s2-0 arg2 s1-0) + (set! s3-0 (- s3-0 s1-0)) + (+! s2-0 s1-0) + ) + (if (> s3-0 0) + (sp-process-block arg0 s2-0 arg2 s3-0) + ) + ) + 0 + (none) + ) + +;; definition (perm) for symbol *particles-flag*, type symbol +(define-perm *particles-flag* symbol #t) + +;; definition for function forall-particles-with-key-runner +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun forall-particles-with-key-runner ((arg0 sparticle-launch-control) + (arg1 (function sparticle-system sparticle-cpuinfo none)) + (arg2 sparticle-system) + ) + (local-vars (sv-16 int)) + (let ((s3-0 (the-as object (-> arg2 cpuinfo-table 0))) + (s2-0 (&+ (-> arg2 vecdata-table) 0)) + (s1-0 (+ (-> arg2 blocks 0) (-> arg2 blocks 1))) + ) + (dotimes (s0-0 s1-0) + (cond + ((!= (-> arg2 alloc-table s0-0) -1) + (set! sv-16 0) + (while (< sv-16 64) + (if (and (nonzero? (-> (the-as sparticle-cpuinfo s3-0) valid)) (= (-> (the-as sparticle-cpuinfo s3-0) key) arg0)) + (arg1 arg2 (the-as sparticle-cpuinfo s3-0)) + ) + (set! s3-0 (-> (the-as (inline-array sparticle-cpuinfo) s3-0) 1)) + (&+! s2-0 48) + (set! sv-16 (+ sv-16 1)) + ) + ) + (else + (set! s3-0 (-> (the-as (inline-array sparticle-cpuinfo) s3-0) 64)) + (&+! s2-0 3072) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function forall-particles-with-key +;; INFO: Return type mismatch int vs none. +(defun forall-particles-with-key ((arg0 sparticle-launch-control) + (arg1 (function sparticle-system sparticle-cpuinfo none)) + (arg2 symbol) + (arg3 symbol) + ) + (if arg2 + (forall-particles-with-key-runner arg0 arg1 *sp-particle-system-2d*) + ) + (if arg3 + (forall-particles-with-key-runner arg0 arg1 *sp-particle-system-3d*) + ) + 0 + (none) + ) + +;; definition for function sparticle-kill-it +;; INFO: Return type mismatch int vs none. +(defun sparticle-kill-it ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (set! (-> arg1 timer) 0) + (set! (-> arg1 sp-func) (the-as (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none) 0)) + (when (and (-> arg1 binding) (nonzero? (-> arg1 binding))) + (logclear! (-> arg1 binding flags) (sp-launch-state-flags launcher-active particles-active)) + (set! (-> arg1 binding) #f) + ) + 0 + (none) + ) + +;; definition for function sparticle-kill-it-level0 +;; INFO: Return type mismatch int vs none. +(defun sparticle-kill-it-level0 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (zero? (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1))) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +;; definition for function sparticle-kill-it-level1 +;; INFO: Return type mismatch int vs none. +(defun sparticle-kill-it-level1 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) + (sp-cpuinfo-flag sp-cpuinfo-flag-9) + ) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +;; definition for function sparticle-kill-it-level2 +;; INFO: Return type mismatch int vs none. +(defun sparticle-kill-it-level2 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) (sp-cpuinfo-flag level0)) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +;; definition for function sparticle-kill-it-level3 +;; INFO: Return type mismatch int vs none. +(defun sparticle-kill-it-level3 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) + (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0) + ) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +;; definition for function sparticle-kill-it-level4 +;; INFO: Return type mismatch int vs none. +(defun sparticle-kill-it-level4 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) (sp-cpuinfo-flag level1)) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +;; definition for function sparticle-kill-it-level5 +;; INFO: Return type mismatch int vs none. +(defun sparticle-kill-it-level5 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) + (sp-cpuinfo-flag sp-cpuinfo-flag-9 level1) + ) + (sparticle-kill-it arg0 arg1) + ) + 0 + (none) + ) + +;; definition for function sparticle-60-to-50 +;; INFO: Return type mismatch int vs none. +(defun sparticle-60-to-50 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 pointer)) + (let ((gp-0 (-> arg1 rotvel3d)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-angle<-quaternion! s5-0 gp-0) + (set! (-> s5-0 w) (* 12516.455 (-> s5-0 w))) + (quaternion-vector-angle! gp-0 s5-0 (-> s5-0 w)) + ) + 0 + (none) + ) + +;; definition for function sparticle-50-to-60 +;; INFO: Return type mismatch int vs none. +(defun sparticle-50-to-60 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 pointer)) + (let ((gp-0 (-> arg1 rotvel3d)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-angle<-quaternion! s5-0 gp-0) + (set! (-> s5-0 w) (* 8691.982 (-> s5-0 w))) + (quaternion-vector-angle! gp-0 s5-0 (-> s5-0 w)) + ) + 0 + (none) + ) + +;; definition for function kill-all-particles-with-key +;; INFO: Return type mismatch int vs none. +(defun kill-all-particles-with-key ((arg0 sparticle-launch-control)) + (forall-particles-with-key arg0 sparticle-kill-it #t #t) + 0 + (none) + ) + +;; definition for function forall-particles-runner +;; INFO: Return type mismatch int vs none. +(defun forall-particles-runner ((arg0 (function sparticle-system sparticle-cpuinfo pointer none)) (arg1 sparticle-system)) + (let ((s4-0 (the-as object (-> arg1 cpuinfo-table 0))) + (s3-0 (&+ (-> arg1 vecdata-table) 0)) + (s2-0 (+ (-> arg1 blocks 0) (-> arg1 blocks 1))) + ) + (dotimes (s1-0 s2-0) + (cond + ((!= (-> arg1 alloc-table s1-0) -1) + (dotimes (s0-0 64) + (if (nonzero? (-> (the-as sparticle-cpuinfo s4-0) valid)) + (arg0 arg1 (the-as sparticle-cpuinfo s4-0) s3-0) + ) + (set! s4-0 (+ (the-as uint s4-0) 144)) + (&+! s3-0 48) + ) + ) + (else + (set! s4-0 (&+ (the-as pointer s4-0) 9216)) + (&+! s3-0 3072) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function forall-particles +;; INFO: Return type mismatch int vs none. +(defun forall-particles ((arg0 function) (arg1 symbol) (arg2 symbol)) + (if arg1 + (forall-particles-runner + (the-as (function sparticle-system sparticle-cpuinfo pointer none) arg0) + *sp-particle-system-2d* + ) + ) + (if arg2 + (forall-particles-runner + (the-as (function sparticle-system sparticle-cpuinfo pointer none) arg0) + *sp-particle-system-3d* + ) + ) + 0 + (none) + ) + +;; definition for function kill-all-particles-in-level +(defun kill-all-particles-in-level ((arg0 level)) + (let ((t9-0 forall-particles) + (v1-0 (-> arg0 index)) + ) + (t9-0 + (cond + ((zero? v1-0) + sparticle-kill-it-level0 + ) + ((= v1-0 1) + sparticle-kill-it-level1 + ) + ((= v1-0 2) + sparticle-kill-it-level2 + ) + ((= v1-0 3) + sparticle-kill-it-level3 + ) + ((= v1-0 4) + sparticle-kill-it-level4 + ) + (else + sparticle-kill-it-level5 + ) + ) + #t + #t + ) + ) + 0 + ) + +;; definition for function all-particles-50-to-60 +(defun all-particles-50-to-60 () + (forall-particles-runner sparticle-50-to-60 *sp-particle-system-3d*) + (none) + ) + +;; definition for function all-particles-60-to-50 +(defun all-particles-60-to-50 () + (forall-particles-runner sparticle-60-to-50 *sp-particle-system-3d*) + (none) + ) + +;; definition for function remap-particle +;; INFO: Return type mismatch gs-miptbp vs none. +(defun remap-particle ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 pointer)) + (let* ((gp-0 (-> arg1 adgif)) + (a0-1 (-> gp-0 texture-id)) + (v1-0 (lookup-texture-by-id-fast a0-1)) + ) + (when v1-0 + (set! (-> gp-0 tex0 tbp0) (-> v1-0 dest 0)) + (set! (-> gp-0 tex0 cbp) (-> v1-0 clutdest)) + (set! (-> gp-0 miptbp1 tbp1) (-> v1-0 dest 1)) + (set! (-> gp-0 miptbp1 tbp2) (-> v1-0 dest 2)) + (set! (-> gp-0 miptbp1 tbp3) (-> v1-0 dest 3)) + ) + ) + (none) + ) + +;; definition for function remap-all-particles +(defun remap-all-particles () + (forall-particles remap-particle #t #t) + (none) + ) + +;; definition for function process-particles +;; INFO: Return type mismatch int vs none. +;; ERROR: Unsupported inline assembly instruction kind - [mfc0 gp, Count] +;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] +(defun process-particles () + (local-vars (v1-53 int) (gp-0 int)) + (with-pp + (when *particles-flag* + 0 + 0 + (.mfc0 gp-0 Count) + (set! *sp-launcher-lock* #t) + (when *debug-segment* + (let ((s5-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-12 'particles) + (s4-0 *profile-particles-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s3-0 (-> s5-0 data (-> s5-0 count)))) + (let ((s2-0 (-> s5-0 base-time))) + (set! (-> s3-0 name) v1-12) + (set! (-> s3-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s2-0)))) + ) + (set! (-> s3-0 depth) (the-as uint (-> s5-0 depth))) + (set! (-> s3-0 color) s4-0) + (set! (-> s5-0 segment (-> s5-0 depth)) s3-0) + ) + (+! (-> s5-0 count) 1) + (+! (-> s5-0 depth) 1) + (set! (-> s5-0 max-depth) (max (-> s5-0 max-depth) (-> s5-0 depth))) + ) + ) + 0 + ) + (logand (the-as int (-> pp clock sparticle-data x)) 255) + (cond + (*sp-60-hz* + (when (= (-> *setting-control* user-current video-mode) 'pal) + (set! *sp-60-hz* #f) + (all-particles-60-to-50) + ) + ) + (else + (when (= (-> *setting-control* user-current video-mode) 'ntsc) + (set! *sp-60-hz* #t) + (all-particles-50-to-60) + ) + ) + ) + (clear-sprite-aux-list) + (sp-process-particle-system *sp-particle-system-2d* 0 *sprite-array-2d*) + (sp-process-particle-system *sp-particle-system-2d* 1 *sprite-array-2d*) + (sp-process-particle-system *sp-particle-system-3d* 0 (the-as sprite-array-2d *sprite-array-3d*)) + (when *debug-segment* + (let ((s5-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-47 (+ (-> s5-1 depth) -1)) + (s4-1 (-> s5-1 segment v1-47)) + (s3-1 (-> s5-1 base-time)) + ) + (when (>= v1-47 0) + (set! (-> s4-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-1)))) + (+! (-> s5-1 depth) -1) + ) + ) + ) + ) + 0 + ) + (set! *sp-launcher-lock* #f) + (sp-clear-queue) + (.mfc0 v1-53 Count) + (- v1-53 gp-0) + (when *display-sprite-info* + (if (movie?) + (format *stdcon* "~%~%~%") + ) + (format + *stdcon* + "2d: ~4d~100h3d: ~4d~200hwarp/glow: ~3D~350hhud:~3D~%" + (-> *sp-particle-system-2d* num-alloc 0) + (-> *sp-particle-system-3d* num-alloc 0) + (-> *sprite-aux-list* entry) + (-> *sp-particle-system-2d* num-alloc 1) + ) + ) + ) + 0 + (none) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc index fa72d01cbd..fc6f6bb836 100644 --- a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc @@ -395,12 +395,12 @@ ;; definition of type level (deftype level (basic) ((name symbol :offset-assert 4) - (load-name basic :offset-assert 8) - (nickname basic :offset-assert 12) + (load-name string :offset-assert 8) + (nickname string :offset-assert 12) (index int32 :offset-assert 16) (status symbol :offset-assert 20) - (borrow-level basic 2 :offset-assert 24) - (borrow-from-level basic :offset-assert 32) + (borrow-level level 2 :offset-assert 24) + (borrow-from-level level :offset-assert 32) (heap kheap :inline :offset-assert 48) (borrow-heap kheap 2 :inline :offset-assert 64) (bsp bsp-header :offset-assert 96) @@ -446,24 +446,24 @@ (texture-dirty-masks texture-mask 10 :inline :offset-assert 4576) (texture-mask texture-mask 18 :inline :offset-assert 4736) (sky-mask texture-mask :inline :offset-assert 5024) - (tfrag-masks basic :offset-assert 5040) + (tfrag-masks texture-masks-array :offset-assert 5040) (tfrag-dists pointer :offset-assert 5044) - (shrub-masks basic :offset-assert 5048) + (shrub-masks texture-masks-array :offset-assert 5048) (shrub-dists pointer :offset-assert 5052) - (alpha-masks basic :offset-assert 5056) + (alpha-masks texture-masks-array :offset-assert 5056) (alpha-dists pointer :offset-assert 5060) - (water-masks basic :offset-assert 5064) + (water-masks texture-masks-array :offset-assert 5064) (water-dists pointer :offset-assert 5068) (tfrag-last-calls int32 6 :offset-assert 5072) (texture-anim-array texture-anim-array 10 :offset-assert 5096) - (light-hash basic :offset-assert 5136) + (light-hash light-hash :offset-assert 5136) (draw-priority float :offset-assert 5140) (draw-index int32 :offset-assert 5144) - (part-engine basic :offset-assert 5148) + (part-engine engine :offset-assert 5148) (user-object basic 4 :offset-assert 5152) (loaded-text-info-count int32 :offset-assert 5168) (loaded-text-info game-text-info 8 :offset-assert 5172) - (level-type basic :offset-assert 5204) + (level-type type :offset-assert 5204) (load-order int64 :offset-assert 5208) (pad int8 12 :offset-assert 5216) ) @@ -776,7 +776,7 @@ :level0 (new 'static 'level :name #f :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -787,7 +787,7 @@ :name #f :index 1 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -798,7 +798,7 @@ :name #f :index 2 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -809,7 +809,7 @@ :name #f :index 3 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -820,7 +820,7 @@ :name #f :index 4 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -831,7 +831,7 @@ :name #f :index 5 :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :inside-boxes #f :force-inside? #f @@ -842,7 +842,7 @@ :name 'default :index 6 :status 'reserved - :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-level (new 'static 'array level 2 #f #f) :borrow-from-level #f :bsp #f :inside-boxes #f diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 2dc45e8e94..f81cc95082 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -92,6 +92,20 @@ "cam-los-collide", // vector-dot with stack // cam-update "update-visible", // assertion crash when filling out bsp-header + // sparticle-launcher + // - field loaded as signed and unsigned + "sp-relaunch-particle-3d", + // - annoying arbitrary data usage functions + "execute-part-engine", + "sparticle-respawn-heights", + "sparticle-respawn-timer", + "sparticle-mode-animate", + "sparticle-mode-animate", + "sparticle-texture-animate", + "sparticle-texture-day-night", + "sparticle-motion-blur", // clipping + "birth-func-texture-group", + "(method 10 sparticle-launcher)", // very strange handling of ambiguous type // placeholder // gun-util