diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml index ccb2d38bd3..ec4d6187b8 100644 --- a/.github/workflows/linting.yaml +++ b/.github/workflows/linting.yaml @@ -17,9 +17,14 @@ jobs: - name: Checkout Repository uses: actions/checkout@v3 + # wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + # sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main' + # sudo apt install clang-format-15 + # --clang-format-executable $(which clang-format-15) - name: Get Package Dependencies run: | - sudo apt install clang-format clang-tidy + sudo apt update + sudo apt install clang-format clang-format -version - name: Check Clang-Formatting diff --git a/Taskfile.yml b/Taskfile.yml index 19e8932519..4e21371c15 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -120,7 +120,7 @@ tasks: - '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}}' offline-tests-fast: cmds: - - '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}} --dump_current_output --num_threads 10' + - '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}} --dump_current_output --num_threads 32' offline-test-file: cmds: - '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}} --file {{.FILE}}' @@ -128,7 +128,7 @@ tasks: update-ref-tests: cmds: - cmd: python ./scripts/tasks/delete-file-or-folder.py --path failures - - task: offline-tests-fast + - cmd: '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}} --dump_current_output --num_threads 32' ignore_error: true - python ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/ --game {{.GAME}} - task: offline-tests-fast @@ -141,4 +141,4 @@ tasks: - task: offline-test-file type-test: cmds: - - cmd: '{{.GOALCTEST_BIN_RELEASE_DIR}}/goalc-test --gtest_brief=0 --gtest_filter="*Jak2TypeConsistency*"' + - cmd: '{{.GOALCTEST_BIN_RELEASE_DIR}}/goalc-test --gtest_brief=0 --gtest_break_on_failure --gtest_filter="*Jak2TypeConsistency*"' diff --git a/decompiler/IR2/OpenGoalMapping.cpp b/decompiler/IR2/OpenGoalMapping.cpp index 12be7fc2de..5b5bbe8284 100644 --- a/decompiler/IR2/OpenGoalMapping.cpp +++ b/decompiler/IR2/OpenGoalMapping.cpp @@ -11,13 +11,13 @@ typedef OpenGOALAsm::InstructionModifiers MOD; const std::map MIPS_ASM_TO_OPEN_GOAL_FUNCS = { // ----- EE ------- // Instructions that are nopped - // {InstructionKind::MTC0, - // {".nop", {MOD::SKIP_IT}}}, // they only use this for performance counters / Count / - // Debug - // {InstructionKind::MTPC, {".nop", {MOD::SKIP_IT}}}, - // {InstructionKind::MFPC, {".nop", {MOD::SKIP_IT}}}, - // {InstructionKind::SYNCP, {".nop", {MOD::SKIP_IT}}}, - // {InstructionKind::SYNCL, {".nop", {MOD::SKIP_IT}}}, + // they only use this for performance counters / Count / Debug + // These depend on a `fake-asm` macro being defined + {InstructionKind::MTC0, {".mtc0", {}}}, + {InstructionKind::MTPC, {".mtpc", {}}}, + {InstructionKind::MFPC, {".mfpc", {}}}, + {InstructionKind::SYNCP, {".sync.p", {}}}, + {InstructionKind::SYNCL, {".sync.l", {}}}, // Shifts and such {InstructionKind::PSLLW, {".pw.sll", {}}}, diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index ed301fbb0b..9b7ee80330 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -7354,7 +7354,7 @@ :size-assert #xd0 :flag-assert #xb000000d0 (:methods - (minimap-trail-method-9 () none 9) + (minimap-trail-method-9 (_type_ vector vector) float 9) (minimap-trail-method-10 () none 10) ) ) @@ -7407,7 +7407,7 @@ :flag-assert #x1c00000648 (:methods (minimap-method-9 () none 9) - (minimap-method-10 () none 10) + (minimap-method-10 (_type_ connection-minimap minimap-trail) minimap-trail 10) (minimap-method-11 () none 11) (minimap-method-12 (_type_ process uint int vector int) connection-minimap 12) (minimap-method-13 () none 13) @@ -14393,7 +14393,7 @@ ;; Failed to read fields. (:methods (new (symbol type process pickup-type float) _type_ 0) - (fact-info-method-9 () none 9) ;; (drop-pickup (_type_ symbol process-tree fact-info int) (pointer process) 9) + (drop-pickup (_type_ symbol process-tree fact-info int) (pointer process) 9) ;; (drop-pickup (_type_ symbol process-tree fact-info int) (pointer process) 9) (reset! (_type_ symbol) none 10) (pickup-collectable! (_type_ pickup-type float handle) float 11) ) @@ -14716,7 +14716,7 @@ (initialize-skeleton (_type_ skeleton-group pair) none 14) (initialize-skeleton-by-name (_type_ string) draw-control 15) (apply-alignment (_type_ align-opts transformq vector) object 16) - (process-drawable-method-17 () none 17) ;; (do-joint-math! (_type_) none 17) + (process-drawable-method-17 (_type_) none 17) ;; (do-joint-math! (_type_) none 17) (process-drawable-method-18 () none 18) ;; (cleanup-for-death (_type_) none 18) (process-drawable-method-19 () none 19) ;; (evaluate-joint-control (_type_) none 19) ) @@ -16123,7 +16123,7 @@ (collide-shape-method-34 () none 34) ;; (find-prim-by-id (_type_ uint) collide-shape-prim 34) (collide-shape-method-35 () none 35) ;; (detect-riders! (_type_) symbol 35) (collide-shape-method-36 () none 36) ;; (build-bounding-box-for-shape (_type_ bounding-box float collide-kind) symbol 36) - (collide-shape-method-37 () none 37) ;; (integrate-and-collide! (_type_ vector) none 37) + (collide-shape-method-37 (_type_ vector) none 37) ;; (integrate-and-collide! (_type_ vector) none 37) (collide-shape-method-38 () none 38) ;; (find-collision-meshes (_type_) symbol 38) (collide-shape-method-39 () none 39) ;; (on-platform (_type_ collide-shape collide-overlap-result) symbol 39) (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) ;; (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) @@ -16133,8 +16133,8 @@ (collide-shape-method-44 () none 44) ;; (pull-riders! (_type_) symbol 44) (collide-shape-method-45 () none 45) ;; (do-push-aways! (_type_) symbol 45) (collide-shape-method-46 (_type_) none 46) ;; (set-root-prim! (_type_ collide-shape-prim) collide-shape-prim 46) - (collide-shape-method-47 () none 47) ;; (update-transforms! (_type_) symbol 47) - (collide-shape-method-48 () none 48) ;; (clear-collide-with-as (_type_) none 48) + (set-collide-with! (_type_ collide-spec) none 47) ;; (update-transforms! (_type_) symbol 47) + (set-collide-as! (_type_ collide-spec) none 48) ;; (clear-collide-with-as (_type_) none 48) (collide-shape-method-49 (_type_ int int int) none 49) ;; (restore-collide-with-as (_type_) none 49) (collide-shape-method-50 (_type_ process object float float float) none 50) ;; (backup-collide-with-as (_type_) none 50) (collide-shape-method-51 () none 51) ;; (set-root-prim-collide-with! (_type_ collide-kind) none 51) @@ -16259,10 +16259,10 @@ (collide-shape-moving-method-59 () none 59) ;; (integrate-for-enemy-with-move-to-ground! (_type_ vector collide-kind float symbol symbol symbol) none 59) (collide-shape-moving-method-60 () none 60) ;; (move-to-ground (_type_ float float symbol collide-kind) symbol 60) (collide-shape-moving-method-61 () none 61) ;; (move-to-ground-point! (_type_ vector vector vector) none 61) - (collide-shape-moving-method-62 (_type_) none 62) ;; (compute-acc-due-to-gravity (_type_ vector float) vector 62) + (compute-acc-due-to-gravity (_type_ vector float) vector 62) ;; (compute-acc-due-to-gravity (_type_ vector float) vector 62) (collide-shape-moving-method-63 () none 63) ;; (step-collison! (_type_ vector vector float) float 63) (collide-shape-moving-method-64 () none 64) ;; (move-to-tri! (_type_ collide-tri-result vector) none 64) - (collide-shape-moving-method-65 () none 65) + (collide-shape-moving-method-65 (_type_ vector float float float) symbol 65) (collide-shape-moving-method-66 () none 66) (collide-shape-moving-method-67 () none 67) ) @@ -16359,9 +16359,9 @@ ) (deftype lightning-tracker (process) - ((root basic :offset-assert 128) + ((root trsqv :offset-assert 128) (lightning lightning-spec :offset-assert 132) - (callback basic :offset-assert 136) + (callback (function lightning-tracker none) :offset-assert 136) (duration uint64 :offset-assert 144) (start-time time-frame :offset-assert 152) (offset0 vector :inline :offset-assert 160) @@ -17146,7 +17146,7 @@ ) (deftype process-focusable (process-drawable) - ((root-override collide-shape :offset 128 :score 100) + ((root-override collide-shape :offset 128 :score 100) ;; TODO - potentiall collide-shape-moving? (focus-status focus-status :offset-assert 200) ) :method-count-assert 27 @@ -17528,13 +17528,25 @@ ;; projectile-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +++projectile-h:projectile-options (defenum projectile-options :type uint64 :bitfield #t + (lose-altitude 0) + (proj-options-2 1) + (proj-options-3 3) + (proj-options-4 4) + (account-for-target-velocity 13) + (deal-damage 14) + (proj-options-8000 15) + (respect-invinc-time 16) + (ignore-impact 17) ) +;; ---projectile-h:projectile-options (deftype projectile (process-drawable) - ((starting-pos vector :inline :offset-assert 208) + ((root-override collide-shape-moving :offset 128 :score 999) + (starting-pos vector :inline :offset-assert 208) (starting-dir vector :inline :offset-assert 224) (target-pos vector :inline :offset-assert 240) (base-target-pos vector :inline :offset-assert 256) @@ -17547,8 +17559,8 @@ (owner-handle handle :offset-assert 328) (ignore-handle handle :offset-assert 336) (update-velocity (function projectile none) :offset-assert 344) ;; guessed by decompiler - (move basic :offset-assert 348) - (pick-target basic :offset-assert 352) + (move (function projectile none) :offset-assert 348) + (pick-target (function projectile none) :offset-assert 352) (max-speed float :offset-assert 356) (old-dist float 16 :offset-assert 360) ;; guessed by decompiler (old-dist-count int32 :offset-assert 424) @@ -17567,31 +17579,59 @@ :size-assert #x1d8 :flag-assert #x28016001d8 (:methods - (projectile-method-20 () none 20) ;; (projectile-die () _type_ :state 20) - (projectile-method-21 () none 21) ;; (projectile-dissipate () _type_ :state 21) - (projectile-method-22 () none 22) ;; (projectile-impact () _type_ :state 22) - (projectile-method-23 () none 23) ;; (projectile-moving () _type_ :state 23) - (projectile-method-24 () none 24) ;; (dummy-24 (_type_) none 24) - (projectile-method-25 () none 25) ;; (dummy-25 (_type_) none 25) - (projectile-method-26 () none 26) ;; (dummy-26 (_type_) none 26) - (projectile-method-27 () none 27) ;; (dummy-27 (_type_) none 27) - (projectile-method-28 () none 28) ;; (dummy-28 (_type_) none 28) - (projectile-method-29 () none 29) - (projectile-method-30 () none 30) - (projectile-method-31 (_type_) none 31) - (projectile-method-32 () none 32) - (projectile-method-33 () none 33) - (projectile-method-34 () none 34) - (projectile-method-35 () none 35) - (projectile-method-36 () none 36) - (projectile-method-37 () none 37) - (projectile-method-38 () none 38) - (projectile-method-39 () none 39) + (die () _type_ :state 20) + (dissipate () _type_ :state 21) + (impact () _type_ :state 22) + (moving () _type_ :state 23) + (draw-laser-sight + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + (_type_) none 24) + (spawn-impact-particles + "Spawns associated particles with the projectile if applicable" + (_type_) none 25) + (spawn-shell-particles "TODO - confirm" (_type_) none 26) + (unknown-particles "TODO - confirm" (_type_) none 27) + (play-impact-sound (_type_ projectile-options) sound-id 28) + (stop-sound! + "Stops the current `sound-id` if set, re-init the `sound-id` after being stopped" + (_type_) none 29) + (init-collision! + "Init the [[projectile]]'s [[collide-shape]]" + (_type_) none 30) + (init-proj-settings! + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (_type_) none 31) + (go-moving! (_type_) none 32) + (go-sitting! (_type_) none 33) + (kill-projectile! + "Transition to the [[projectile::impact]] state, always return [[#t]]" + (_type_) symbol 34) + (event-handler! + "Multiplex the projectile's event processing, called by [[projectile-event-handler]]" + (_type_ process int symbol event-message-block) object 35) + (handle-proj-hit! + "When a projectile hits something, first deal damage via [[projectile::37]] + and increment the projectiles hit count. + + If we've met or exceeded the projectiles maximum allowed hits, switch to the [[projectile::impact]] state" + (_type_ process event-message-block) object 36) + (deal-damage! + "Constructs an [[attack-info]] according to the projectile's `options`" + (_type_ process event-message-block) symbol 37) + (made-impact? + "TODO - queries the collision cache, return true/false" + (_type_) symbol 38) + (play-impact-sound! + "Plays impact sound + :virtual" + (_type_) sound-id :behavior projectile 39) ) ) (deftype projectile-init-by-other-params (structure) - ((ent basic :offset-assert 0) + ((ent entity :offset-assert 0) (charge float :offset-assert 4) (attack-id uint32 :offset-assert 8) (options projectile-options :offset-assert 16) @@ -17608,6 +17648,7 @@ ) (deftype projectile-bounce (projectile) + "This seems to be the scrapped peacemaker gun implementation - the bouncing dark eco grenade launcher" ((played-bounce-time time-frame :offset-assert 472) (tumble-quat quaternion :inline :offset-assert 480) ) @@ -17615,8 +17656,8 @@ :size-assert #x1f0 :flag-assert #x2a017001f0 (:methods - (projectile-bounce-method-40 () none 40) - (projectile-bounce-method-41 () none 41) + (sitting () _type_ :state 40) + (noop "Does nothing" (_type_) none 41) ) ) @@ -18090,7 +18131,6 @@ ) (declare-type collide-query structure) - (deftype collide-cache (basic) ((num-tris int32 :offset-assert 4) (num-prims int32 :offset-assert 8) @@ -18156,9 +18196,9 @@ (deftype collide-query (structure) ((best-other-tri collide-tri-result :inline :offset-assert 0) (best-my-tri collide-tri-result :inline :offset 0) - (ignore-processes process 2 :offset-assert 88) - (ignore-process0 process :offset 88) - (ignore-process1 process :offset 92) + (ignore-processes process-tree 2 :offset-assert 88) + (ignore-process0 process-tree :offset 88) + (ignore-process1 process-tree :offset 92) (ignore-pat pat-surface :offset-assert 96) (collide-with collide-spec :offset-assert 100) (overlay-params uint32 3 :offset 112) ;; ? @@ -18197,6 +18237,12 @@ :flag-assert #x90000021c ) +(deftype collide-query-with-vec (structure) + "A custom type added because of weirdness discovered in task-arrow::23" + ((cquery collide-query :inline) + (vec vector :inline)) + ) + (define-extern *collide-test-flag* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -21960,8 +22006,6 @@ :flag-assert #x9000000a0 ) -(define-extern nav-mesh type) ;; remove once we have this. - (defenum nav-mesh-flag :type uint8 :bitfield #t @@ -22294,8 +22338,8 @@ ) (deftype grid-hash-box (structure) - ((min uint8 3 :offset-assert 0) - (max uint8 3 :offset-assert 3) + ((min int8 3 :offset-assert 0) + (max int8 3 :offset-assert 3) ) :pack-me :method-count-assert 9 @@ -22303,45 +22347,49 @@ :flag-assert #x900000006 ) +(declare-type grid-hash-work basic) (deftype grid-hash (basic) - ((work basic :offset-assert 4) + ((work grid-hash-work :offset-assert 4) (search-box grid-hash-box :inline :offset-assert 8) (bucket-size int16 :offset-assert 14) - (axis-scale uint32 3 :offset-assert 16) - (dimension-array uint8 3 :offset-assert 28) + (axis-scale uint32 3 :offset-assert 16) + (dimension-array int8 3 :offset-assert 28) (vertical-cell-count int8 :offset-assert 31) - (bucket-array uint32 :offset-assert 32) - (box-min uint32 3 :offset-assert 36) - (box-max uint32 3 :offset-assert 48) + (bucket-array (pointer grid-hash-word) :offset-assert 32) + (box-min float 3 :offset-assert 36) + (box-max float 3 :offset-assert 48) (object-count int16 :offset-assert 60) (bucket-count int16 :offset-assert 62) (min-cell-size float :offset-assert 64) (bucket-memory-size int32 :offset-assert 68) - (mem-bucket-array uint32 :offset-assert 72) - (spr-bucket-array uint32 :offset-assert 76) - (debug-draw basic :offset-assert 80) - (use-scratch-ram basic :offset-assert 84) + (mem-bucket-array (pointer grid-hash-word) :offset-assert 72) + (spr-bucket-array (pointer grid-hash-word) :offset-assert 76) + (debug-draw symbol :offset-assert 80) + (use-scratch-ram symbol :offset-assert 84) ) :method-count-assert 25 :size-assert #x58 :flag-assert #x1900000058 (:methods - (grid-hash-method-9 () none 9) - (grid-hash-method-10 () none 10) - (grid-hash-method-11 () none 11) - (grid-hash-method-12 () none 12) - (grid-hash-method-13 () none 13) - (grid-hash-method-14 () none 14) - (grid-hash-method-15 () none 15) - (grid-hash-method-16 () none 16) - (grid-hash-method-17 () none 17) - (grid-hash-method-18 () none 18) - (grid-hash-method-19 () none 19) - (grid-hash-method-20 () none 20) - (grid-hash-method-21 () none 21) - (grid-hash-method-22 () none 22) - (grid-hash-method-23 () none 23) - (grid-hash-method-24 () none 24) + (new (symbol type process int) _type_ 0) + (grid-hash-method-9 (_type_ int (array float) int) none 9) + (grid-hash-method-10 (_type_) none 10) + (grid-hash-method-11 (_type_) none 11) + (grid-hash-method-12 (_type_) none 12) + (grid-hash-method-13 (_type_) none 13) + (draw-grid "Draws the grid-hash" (_type_ rgba) none 14) + (dump-grid-info + "Prints out info about the grid-hash, also draws via [[grid-hash::draw-grid]] if `debug-draw` is `#t`" + (_type_) none 15) + (grid-hash-method-16 (_type_ grid-hash-box grid-hash-box) none 16) + (grid-hash-method-17 (_type_) none 17) + (grid-hash-method-18 (_type_ grid-hash-box int) none 18) + (grid-hash-method-19 (_type_ grid-hash-box int) none 19) + (grid-hash-method-20 (_type_ grid-hash-box (pointer uint8)) none 20) + (grid-hash-method-21 (_type_ float int int) none 21) + (grid-hash-method-22 (_type_ grid-hash-box sphere) none 22) + (grid-hash-method-23 (_type_ grid-hash-box vector vector float) none 23) + (update-grid (_type_) none 24) ) ) @@ -22369,15 +22417,15 @@ :size-assert #x68 :flag-assert #x2200000068 (:methods - (sphere-hash-method-25 () none 25) - (sphere-hash-method-26 () none 26) - (sphere-hash-method-27 () none 27) - (sphere-hash-method-28 () none 28) - (sphere-hash-method-29 () none 29) + (clear-objects! (_type_) none 25) + (sphere-hash-method-26 (_type_ vector) none 26) + (sphere-hash-method-27 (_type_) none 27) + (sphere-hash-method-28 (_type_) none 28) + (sphere-hash-method-29 (_type_ find-nav-sphere-ids-params int int int) none 29) (sphere-hash-method-30 (_type_ find-nav-sphere-ids-params) none 30) - (sphere-hash-method-31 () none 31) - (sphere-hash-method-32 () none 32) - (sphere-hash-method-33 () none 33) + (sphere-hash-method-31 (_type_ vector int int) none 31) + (sphere-hash-method-32 (_type_ vector vector float int) symbol 32) + (sphere-hash-method-33 (_type_ object int) none 33) ) ) @@ -22390,21 +22438,21 @@ ) (deftype spatial-hash (sphere-hash) - ((object-array uint32 :offset-assert 104) - (mem-object-array uint32 :offset-assert 108) - (spr-object-array uint32 :offset-assert 112) + ((object-array (pointer hash-object-info) :offset-assert 104) + (mem-object-array (pointer hash-object-info) :offset-assert 108) + (spr-object-array (pointer hash-object-info) :offset-assert 112) ) :method-count-assert 41 :size-assert #x74 :flag-assert #x2900000074 (:methods - (spatial-hash-method-34 () none 34) - (spatial-hash-method-35 () none 35) + (spatial-hash-method-34 (_type_ vector hash-object-info) int 34) + (spatial-hash-method-35 (_type_) none 35) (spatial-hash-method-36 (_type_ sphere (pointer collide-shape) int) int 36) - (spatial-hash-method-37 () none 37) - (spatial-hash-method-38 () none 38) - (spatial-hash-method-39 () none 39) - (spatial-hash-method-40 () none 40) + (spatial-hash-method-37 (_type_) none 37) + (spatial-hash-method-38 (_type_) none 38) + (spatial-hash-method-39 (_type_ object hash-object-info) none 39) + (spatial-hash-method-40 (_type_) none 40) ) ) @@ -22413,7 +22461,7 @@ ;; actor-hash-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define-extern *actor-list* (pointer collide-shape)) ;; some array of something. +(define-extern *actor-list* (pointer collide-shape)) (define-extern *actor-list-length* int) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -26208,13 +26256,13 @@ ;; (define-extern find-ground-point function) ;; (function control-info vector float float vector) ;; (define-extern target-attack-up function) ;; (function target symbol symbol none) (define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none)) -(define-extern cshape-reaction-update-state (function collide-shape-moving collide-query vector none)) +(define-extern cshape-reaction-update-state (function control-info collide-query vector none)) (define-extern cshape-reaction-default (function control-info collide-query vector vector cshape-moving-flags)) -;; (define-extern cshape-reaction-just-move function) +(define-extern cshape-reaction-just-move (function control-info collide-query vector cshape-moving-flags)) (define-extern collide-shape-draw-debug-marks (function none)) -;; (define-extern *col-timer* object) ;; stopwatch -;; (define-extern *frame-timer* object) ;; stopwatch -;; (define-extern *col-timer-enable* object) ;; symbol +(define-extern *col-timer* stopwatch) +(define-extern *frame-timer* stopwatch) +(define-extern *col-timer-enable* symbol) ;; (define-extern debug-report-col-stats function) ;; (function int) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -26241,10 +26289,9 @@ ;; spatial-hash ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype grid-hash-work (basic) - ((result-words UNKNOWN 32 :offset-assert 16) - (result-bits UNKNOWN 32 :offset-assert 16) + ((result-words uint8 32 :offset 16) ;; what is their definition of word... + (result-bits uint8 32 :offset 16) (object-id int32 :offset-assert 48) (temp-box-min vector :inline :offset-assert 64) (temp-box-max vector :inline :offset-assert 80) @@ -26259,15 +26306,12 @@ :size-assert #x78 :flag-assert #x900000078 ) -|# -;; TODO remove this after spatial-hash PR merges -(declare-type grid-hash-work basic) (define-extern *grid-hash-work* grid-hash-work) -;; (define-extern validate-bucket-bits function) -;; (define-extern draw-grid function) -;; (define-extern draw-sphere-box function) -;; (define-extern draw-line-sphere function) +(define-extern validate-bucket-bits (function grid-hash (pointer grid-hash-word) symbol)) +(define-extern draw-grid (function vector vector (pointer int8) rgba none)) +(define-extern draw-sphere-box (function sphere none)) +(define-extern draw-line-sphere (function vector vector float rgba none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; actor-hash ;; @@ -26284,7 +26328,7 @@ (deftype actor-hash-bucket (structure) ((length int16 :offset-assert 0) (max-length int16 :offset-assert 2) - (data (pointer uint32) :offset-assert 4) ;;an array of....something TODO + (data (pointer uint32) :offset-assert 4) ;; an array of....something TODO ) :allow-misaligned :method-count-assert 10 @@ -27213,7 +27257,7 @@ (define-extern ja-eval (function int :behavior process-drawable)) (define-extern ja-blend-eval (function int :behavior process-drawable)) (define-extern ja-post (function none :behavior process-drawable)) -(define-extern sleep-code (function symbol)) +(define-extern sleep-code (function symbol :behavior process-drawable)) ;; (define-extern transform-and-sleep function) ;; (define-extern transform-and-sleep-code function) (define-extern transform-post (function int :behavior process-drawable)) @@ -27439,9 +27483,10 @@ ;; carry-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +++carry-h:carry-mode (defenum carry-mode - :bitfield #t :type uint8 + :bitfield #t (carry 0) (mech-carry 1) (mech-drag 2) @@ -27451,43 +27496,47 @@ (cm6) (cm7) ) +;; ---carry-h:carry-mode (deftype carry-info (basic) - ((process (pointer process-drawable) :offset-assert 4) - (pickup-time time-frame :offset-assert 8) - (other-value float :offset-assert 16) - (other handle :offset-assert 24) - (point vector :inline :offset-assert 32) - (normal vector :inline :offset-assert 48) - (max-angle degrees :offset-assert 64) - (max-distance meters :offset-assert 68) - (max-pull meters :offset-assert 72) - (min-pull meters :offset-assert 76) - (grab-trans-blend float :offset-assert 80) - (carry-radius meters :offset-assert 84) - (backup-radius meters :offset-assert 88) - (joint int8 :offset-assert 92) - (mode carry-mode :offset-assert 93) - (face-dir int8 :offset-assert 94) - (local-point vector :inline :offset-assert 96) - (local-normal vector :inline :offset-assert 112) - (grab-quat vector :inline :offset-assert 128) - (grab-trans vector :inline :offset-assert 144) - (hold-trans vector :inline :offset-assert 160) + ((process (pointer target) :offset-assert 4) + (pickup-time time-frame :offset-assert 8) + (other-value float :offset-assert 16) + (other handle :offset-assert 24) + (point vector :inline :offset-assert 32) + (normal vector :inline :offset-assert 48) + (max-angle degrees :offset-assert 64) + (max-distance meters :offset-assert 68) + (max-pull meters :offset-assert 72) + (min-pull meters :offset-assert 76) + (grab-trans-blend float :offset-assert 80) + (carry-radius meters :offset-assert 84) + (backup-radius meters :offset-assert 88) + (joint int8 :offset-assert 92) + (mode carry-mode :offset-assert 93) + (face-dir int8 :offset-assert 94) + (local-point vector :inline :offset-assert 96) + (local-normal vector :inline :offset-assert 112) + (grab-quat quaternion :inline :offset-assert 128) + (grab-trans vector :inline :offset-assert 144) + (hold-trans vector :inline :offset-assert 160) ) :method-count-assert 17 :size-assert #xb0 :flag-assert #x11000000b0 (:methods (new (symbol type process-drawable int vector vector float) _type_ 0) - (carry-info-method-9 (_type_) int 9) - (carry-info-method-10 () none 10) - (carry-info-method-11 () none 11) - (carry-info-method-12 (_type_) none 12) - (carry-info-method-13 (_type_) none 13) - (carry-info-method-14 () none 14) - (carry-info-method-15 (_type_) none 15) - (carry-info-method-16 () none 16) + (carry-info-method-9 (_type_) none 9) + (distance-from-destination + "Returns the distance from the current `point` and the provided [[carry-info]]'s `point`. + Returns `-1.0` if it exceeds the maximum allowed" + (_type_ carry-info) float 10) + (drag! (_type_ carry-info) none 11) + (drop-impl! (_type_ carry-info) none 12) + (carry-info-method-13 (_type_) symbol :behavior process-drawable 13) + (carry! (_type_ carry-info vector vector) none 14) + (drop! (_type_ carry-info) none 15) + (translate! (_type_) symbol :behavior process-drawable 16) ) ) @@ -28309,9 +28358,19 @@ ;; task-arrow ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++task-arrow:task-arrow-flags +(defenum task-arrow-flags + :type uint32 + :bitfield #t + (task-arrow-flag-00 0) + (task-arrow-flag-01 1) + (task-arrow-flag-02 2) + (task-arrow-flag-03 3) + ) +;; ---task-arrow:task-arrow-flags + (deftype task-arrow-params (structure) - ((flags uint32 :offset-assert 0) + ((flags task-arrow-flags :offset-assert 0) (map-icon uint16 :offset-assert 4) (pos vector :inline :offset-assert 16) (quat quaternion :inline :offset-assert 32) @@ -28320,23 +28379,21 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype task-arrow (process-drawable) - ((pos vector :inline :offset-assert 204) - (theta float :offset-assert 220) - (phi float :offset-assert 224) - (dist float :offset-assert 228) - (smoothed-dist float :offset-assert 232) - (max-dist float :offset-assert 236) - (flags uint32 :offset-assert 240) - (map-icon uint16 :offset-assert 244) - (minimap connection-minimap :offset-assert 248) - (hud-dist uint64 :offset-assert 252) - (base-quat quaternion :inline :offset-assert 268) - (rod-of-god-scale float :offset-assert 284) - (moving basic :offset-assert 288) + ((pos vector :inline :offset-assert 208) + (theta float :offset-assert 224) + (phi float :offset-assert 228) + (dist float :offset-assert 232) + (smoothed-dist float :offset-assert 236) + (max-dist float :offset-assert 240) + (flags task-arrow-flags :offset-assert 244) + (map-icon uint16 :offset-assert 248) + (minimap connection-minimap :offset-assert 252) + (hud-dist handle :offset-assert 256) + (base-quat quaternion :inline :offset-assert 272) + (rod-of-god-scale float :offset-assert 288) + (moving symbol :offset-assert 292) ) :method-count-assert 25 :size-assert #x128 @@ -28345,30 +28402,31 @@ (idle () _type_ :state 20) (die () _type_ :state 21) (leave () _type_ :state 22) - (task-arrow-method-23 () none 23) - (task-arrow-method-24 () none 24) + (task-arrow-method-23 "Some weird debugging code left here, but checks for collisions on the arrow" (_type_ vector) none 23) + (draw-arrow (_type_) none :behavior task-arrow 24) ) ) -|# -;; (define-extern task-arrow-init-by-other function) -;; (define-extern task-arrow-spawn function) +(define-extern task-arrow-init-by-other (function task-arrow-params task-arrow :behavior task-arrow)) +(define-extern task-arrow-spawn (function task-arrow-params task-arrow process)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; projectile ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cshape-reaction-projectile function) -;; (define-extern projectile-event-handler function) -;; (define-extern projectile-move-fill-all-dirs function) -;; (define-extern projectile-move-fill-line-sphere function) -;; (define-extern projectile-update-velocity-add-gravity function) -;; (define-extern projectile-update-velocity-space-wars function) ;; (function projectile none) -(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile)) ;; (function entity-actor vector vector uint handle none :behavior projectile) -;; (define-extern projectile-bounce-update-velocity function) -;; (define-extern projectile-bounce-falling-post function) -;; (define-extern projectile-bounce-move function) -;; (define-extern projectile-bounce-reaction function) +(define-extern cshape-reaction-projectile + "A projectile's collision reaction -- if the projectile hits a material with [[pat-material::stopproj]] set, kill the projectile" + (function control-info collide-query vector vector cshape-moving-flags)) +(define-extern projectile-event-handler (function process int symbol event-message-block projectile :behavior projectile)) +(define-extern projectile-move-fill-all-dirs (function projectile none)) +(define-extern projectile-move-fill-line-sphere (function projectile none)) +(define-extern projectile-update-velocity-add-gravity (function projectile none)) +(define-extern projectile-update-velocity-space-wars (function projectile none)) +(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile :behavior projectile)) +(define-extern projectile-bounce-update-velocity (function projectile-bounce none :behavior projectile)) +(define-extern projectile-bounce-falling-post (function projectile-bounce none :behavior projectile-bounce)) +(define-extern projectile-bounce-move (function projectile-bounce none)) +(define-extern projectile-bounce-reaction (function control-info collide-query vector vector cshape-moving-flags)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-handler ;; @@ -28662,11 +28720,10 @@ ;; gun-blue-shot ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gun-blue-shot (projectile) - ((init-pos vector :inline :offset-assert 476) - (init-dir vector :inline :offset-assert 492) - (collide-normal vector :inline :offset-assert 508) + ((init-pos vector :inline :offset-assert 480) + (init-dir vector :inline :offset-assert 496) + (collide-normal vector :inline :offset-assert 512) ) :method-count-assert 40 :size-assert #x210 @@ -28674,11 +28731,10 @@ (:methods ) ) -|# -(define-extern target-gun-fire-blue (function none :behavior target)) -;; (define-extern gun-blue-shot-move function) -;; (define-extern cshape-reaction-blue-shot function) +(define-extern target-gun-fire-blue (function (pointer process) :behavior target)) +(define-extern gun-blue-shot-move (function gun-blue-shot none)) +(define-extern cshape-reaction-blue-shot (function control-info collide-query vector vector cshape-moving-flags)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-yellow-shot ;; @@ -28696,24 +28752,24 @@ ) ) -(define-extern target-gun-fire-yellow (function none :behavior target)) -;; (define-extern someone-fire-yellow function) -;; (define-extern gun-yellow-shot-move function) +(define-extern target-gun-fire-yellow (function (pointer process) :behavior target)) +(define-extern someone-fire-yellow (function process-drawable vector vector (pointer process))) +(define-extern gun-yellow-shot-move (function gun-yellow-shot none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-red-shot ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gun-red-shot (process-drawable) - ((probe-count int32 :offset-assert 196) - (probe-mask uint32 :offset-assert 200) - (actor-count int32 :offset-assert 204) - (attack-id uint32 :offset-assert 208) - (start-pos vector :inline :offset-assert 220) - (start-dir vector :inline :offset-assert 236) - (start-rot vector :inline :offset-assert 252) - (probe-dir UNKNOWN 19 :offset-assert 268) + ((root-override collide-shape-moving :offset 128 :score 999) + (probe-count int32 :offset-assert 200) + (probe-mask uint32 :offset-assert 204) + (actor-count int32 :offset-assert 208) + (attack-id uint32 :offset-assert 212) + (start-pos vector :inline :offset-assert 224) + (start-dir vector :inline :offset-assert 240) + (start-rot vector :inline :offset-assert 256) + (probe-dir vector 19 :inline :offset-assert 272) ) :method-count-assert 30 :size-assert #x240 @@ -28722,39 +28778,39 @@ (blocked () _type_ :state 20) (debug-idle () _type_ :state 21) (idle () _type_ :state 22) - (gun-red-shot-method-23 () none 23) - (gun-red-shot-method-24 () none 24) - (gun-red-shot-method-25 () none 25) - (gun-red-shot-method-26 () none 26) - (gun-red-shot-method-27 () none 27) - (gun-red-shot-method-28 () none 28) - (gun-red-shot-method-29 () none 29) + (init-probes! + "Create all 19 probe vectors" + (_type_ collide-shape) none 23) + (gun-red-shot-method-24 (_type_) symbol 24) + (noop "Does nothing" (_type_) none 25) + (gun-red-shot-method-26 (_type_) none 26) + (gun-red-shot-method-27 (_type_) none 27) + (gun-red-shot-method-28 (_type_ vector) sound-id 28) + (fire! (_type_ process-drawable int) object :behavior gun-red-shot 29) ) ) -|# -(define-extern target-gun-fire-red (function none :behavior target)) -;; (define-extern gun-red-shot-event-handler function) -;; (define-extern gun-red-shot-init-by-other function) +(define-extern target-gun-fire-red (function (pointer gun-red-shot) :behavior target)) +(define-extern gun-red-shot-event-handler (function process-drawable int symbol event-message-block object :behavior gun-red-shot)) +(define-extern gun-red-shot-init-by-other (function vector vector gun-red-shot :behavior gun-red-shot)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-dark-shot ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gun-dark-shot (projectile) - ((blast-radius float :offset-assert 468) - (core-position vector :inline :offset-assert 476) - (core-velocity vector :inline :offset-assert 492) - (spin-vector vector :inline :offset-assert 508) - (track-target uint64 :offset-assert 524) - (size-t float :offset-assert 532) - (result-array UNKNOWN 16 :offset-assert 540) - (charge-sound uint32 :offset-assert 668) - (fire-sound uint32 :offset-assert 672) - (trail-sound uint32 :offset-assert 676) - (explode-sound uint32 :offset-assert 680) - (start-pilot? basic :offset-assert 684) + ((blast-radius float :offset-assert 472) + (core-position vector :inline :offset-assert 480) + (core-velocity vector :inline :offset-assert 496) + (spin-vector vector :inline :offset-assert 512) + (track-target uint64 :offset-assert 528) + (size-t float :offset-assert 536) + (result-array uint64 16 :offset-assert 544) + (charge-sound uint32 :offset-assert 672) + (fire-sound uint32 :offset-assert 676) + (trail-sound uint32 :offset-assert 680) + (explode-sound uint32 :offset-assert 684) + (start-pilot? basic :offset-assert 688) ) :method-count-assert 42 :size-assert #x2b4 @@ -28764,11 +28820,10 @@ (fizzle () _type_ :state 41) ) ) -|# -(define-extern target-gun-fire-dark (function none :behavior target)) -;; (define-extern process-drawable-shock-effect-bullseye function) -;; (define-extern gun-dark-shot-init-fizzle function) +(define-extern target-gun-fire-dark (function (pointer process) :behavior target)) +(define-extern process-drawable-shock-effect-bullseye (function process-focusable process-focusable matrix int sparticle-launcher sparticle-launcher sparticle-launcher none)) +(define-extern gun-dark-shot-init-fizzle (function vector none :behavior gun-dark-shot)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-states ;; @@ -29923,7 +29978,8 @@ ) (deftype crate (process-focusable) - ((smush smush-control :inline :offset-assert 208) + ((root-override2 collide-shape-moving :offset 128 :score 1000) + (smush smush-control :inline :offset-assert 208) (base vector :inline :offset-assert 240) (look symbol :offset-assert 256) ;; guessed by decompiler (defense symbol :offset-assert 260) ;; guessed by decompiler @@ -29964,7 +30020,7 @@ ) (define-extern *CRATE-bank* crate-bank) -(define-extern crate-post (function int :behavior crate)) +(define-extern crate-post (function none :behavior crate)) (define-extern crate-standard-event-handler (function process int symbol event-message-block object :behavior crate)) (define-extern crate-init-by-other (function entity vector symbol fact-info-crate none :behavior crate)) diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index c6d37eae6e..cab8de2319 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -362,8 +362,8 @@ 116, // goto L99 117, // goto L91 120 - ] - // "(method 67 collide-shape-moving)": [1, 7, 9, 10, 11, 12] - TODO + ], + "update-actor-hash": [0, 2, 4] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 0c332a2343..c71b1810f0 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -79,17 +79,17 @@ ], "mood-funcs": [ ["L231", "vector"], - ["L358", "(pointer uint64)", 1], - ["L361", "(pointer uint64)", 1], - ["L359", "(pointer uint64)", 1], - ["L365", "(pointer uint64)", 1], - ["L360", "(pointer uint64)", 1], - ["L366", "(pointer uint64)", 1], - ["L363", "(pointer uint64)", 1], - ["L368", "(pointer uint64)", 1], - ["L364", "(pointer uint64)", 1], - ["L367", "(pointer uint64)", 1], - ["L362", "(pointer uint64)", 1] + ["L358", "uint64", true], + ["L361", "uint64", true], + ["L359", "uint64", true], + ["L365", "uint64", true], + ["L360", "uint64", true], + ["L366", "uint64", true], + ["L363", "uint64", true], + ["L368", "uint64", true], + ["L364", "uint64", true], + ["L367", "uint64", true], + ["L362", "uint64", true] ], "font-data": [ ["L1", "(inline-array vector)", 250], @@ -114,61 +114,59 @@ ["L21", "(inline-array sky-vertex)", 144] ], "default-menu": [ - ["L6314", "(pointer uint64)", 1], - ["L6313", "(pointer uint64)", 1], - ["L6312", "(pointer uint64)", 1], - ["L6311", "(pointer uint64)", 1], - ["L6310", "(pointer uint64)", 1], - ["L6309", "(pointer uint64)", 1] + ["L6314", "uint64", true], + ["L6313", "uint64", true], + ["L6312", "uint64", true], + ["L6311", "uint64", true], + ["L6310", "uint64", true], + ["L6309", "uint64", true] ], "cam-states": [ - ["L772", "(pointer uint64)", 1], - ["L773", "(pointer uint64)", 1], - ["L774", "(pointer uint64)", 1], - ["L775", "(pointer uint64)", 1] + ["L772", "uint64", true], + ["L773", "uint64", true], + ["L774", "uint64", true], + ["L775", "uint64", true] ], "collide-cache": [["L171", "vector"]], "emerc-vu1": [["L1", "vu-function"]], "mood-funcs2": [ - ["L496", "(pointer uint64)", 1], - ["L497", "(pointer uint64)", 1], - ["L498", "(pointer uint64)", 1], - ["L499", "(pointer uint64)", 1], - ["L500", "(pointer uint64)", 1], - ["L501", "(pointer uint64)", 1], - ["L502", "(pointer uint64)", 1], - ["L503", "(pointer uint64)", 1], - ["L504", "(pointer uint64)", 1], - ["L505", "(pointer uint64)", 1], - ["L506", "(pointer uint64)", 1], - ["L507", "(pointer uint64)", 1], - ["L508", "(pointer uint64)", 1], - ["L509", "(pointer uint64)", 1], - ["L510", "(pointer uint64)", 1], - ["L312", "(pointer uint64)", 1], + ["L496", "uint64", true], + ["L497", "uint64", true], + ["L498", "uint64", true], + ["L499", "uint64", true], + ["L500", "uint64", true], + ["L501", "uint64", true], + ["L502", "uint64", true], + ["L503", "uint64", true], + ["L504", "uint64", true], + ["L505", "uint64", true], + ["L506", "uint64", true], + ["L507", "uint64", true], + ["L508", "uint64", true], + ["L509", "uint64", true], + ["L510", "uint64", true], + ["L312", "uint64", true], ["L307", "vector"] ], "logic-target": [ - ["L407", "(pointer float)", 1], - ["L408", "(pointer float)", 1], ["L409", "attack-info"], ["L414", "(pointer time-frame)", 1], - ["L415", "(pointer uint64)", 1], - ["L416", "(pointer uint64)", 1], - ["L417", "(pointer uint64)", 1], - ["L418", "(pointer uint64)", 1], - ["L419", "(pointer uint64)", 1], - ["L420", "(pointer uint64)", 1], - ["L421", "(pointer uint64)", 1] + ["L415", "uint64", true], + ["L416", "uint64", true], + ["L417", "uint64", true], + ["L418", "uint64", true], + ["L419", "uint64", true], + ["L420", "uint64", true], + ["L421", "uint64", true] ], "editable": [ - ["L545", "(pointer uint64)", 1], - ["L544", "(pointer uint64)", 1], - ["L550", "(pointer uint64)", 1], - ["L546", "(pointer uint64)", 1], - ["L547", "(pointer uint64)", 1], - ["L549", "(pointer uint64)", 1], - ["L548", "(pointer uint64)", 1], + ["L545", "uint64", true], + ["L544", "uint64", true], + ["L550", "uint64", true], + ["L546", "uint64", true], + ["L547", "uint64", true], + ["L549", "uint64", true], + ["L548", "uint64", true], ["L480", "vector"], ["L479", "vector"], ["L474", "vector"] @@ -182,16 +180,15 @@ ["L797", "vector4w"], ["L799", "vector4w"], ["L801", "vector4w"], - ["L888", "(pointer uint64)", 1], - ["L891", "(pointer uint64)", 1], - ["L892", "(pointer uint64)", 1], - ["L893", "(pointer uint64)", 1], - ["L894", "(pointer uint64)", 1], - ["L895", "(pointer uint64)", 1], - ["L896", "(pointer uint64)", 1], - ["L897", "(pointer uint64)", 1] + ["L888", "uint64", true], + ["L891", "uint64", true], + ["L892", "uint64", true], + ["L893", "uint64", true], + ["L894", "uint64", true], + ["L895", "uint64", true], + ["L896", "uint64", true], + ["L897", "uint64", true] ], - "nav-mesh": [["L347", "(inline-array vector)", 2]], // far label crap "game-info": [ ["L406", "uint64", true], @@ -439,5 +436,7 @@ ["L123", "uint64", true] ], "fma-sphere": [["L43", "attack-info"]], - "process-taskable": [["L105", "attack-info"]] + "process-taskable": [["L105", "attack-info"]], + "nav-mesh": [["L347", "(inline-array vector)", 2]], + "gun-red-shot": [["L78", "attack-info"]] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 9b439439fb..bfc199dba3 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -360,9 +360,7 @@ "cam-string-find-hidden": [[16, "collide-query"]], "cam-string-move": [[80, "collide-query"]], "(enter cam-string)": [[32, "collide-query"]], - "cam-stick-code": [ - [64, "collide-query"] - ], + "cam-stick-code": [[64, "collide-query"]], "(trans cam-stick)": [ [16, "matrix"], [80, "vector"], @@ -427,10 +425,7 @@ [640, "vector"], [656, "vector"] ], - "target-gun-fire-yellow": [ - [16, "matrix"], - [112, "event-message-block"] - ], + "target-gun-fire-yellow": [[16, "projectile-init-by-other-params"]], "(method 14 collide-cache)": [[16, "bounding-box"]], "sp-adjust-launch": [[16, "matrix"]], "sp-launch-particles-death": [[16, "matrix"]], @@ -1010,5 +1005,57 @@ [48, "vector"], [64, "vector"] ], - "add-a-bunch": [[16, "vector"]] + "add-a-bunch": [[16, "vector"]], + "(method 23 grid-hash)": [ + [16, "grid-hash-box"], + [32, "grid-hash-box"], + [48, "vector"], + [64, "vector"] + ], + "(method 14 grid-hash)": [ + [16, "vector"], + [32, "vector"] + ], + "(method 15 sphere-hash)": [[16, "vector"]], + "draw-grid": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + "(method 32 sphere-hash)": [[32, "vector"]], + "(method 37 spatial-hash)": [[48, "vector"]], + "(method 10 carry-info)": [[16, "vector"]], + "(method 12 carry-info)": [[16, "vector"]], + "(method 13 carry-info)": [ + [16, "event-message-block"], + [144, "matrix"] + ], + "(method 16 carry-info)": [[16, "event-message-block"]], + "(method 23 task-arrow)": [[16, "collide-query-with-vec"]], + "(method 38 projectile)": [[16, "collide-query"]], + "projectile-move-fill-all-dirs": [[16, "collide-query"]], + "projectile-move-fill-line-sphere": [[16, "collide-query"]], + "projectile-update-velocity-add-gravity": [[16, "vector"]], + "projectile-bounce-falling-post": [[16, "collide-query"]], + "cshape-reaction-update-state": [ + [16, "vector"], + [32, "vector"] + ], + "cshape-reaction-default": [ + [16, "vector"], + [32, "vector"] + ], + "(method 26 gun-blue-shot)": [[32, "vector"]], + "(method 38 gun-blue-shot)": [[16, "collide-query"]], + "someone-fire-yellow": [[16, "projectile-init-by-other-params"]], + "(method 25 gun-yellow-shot)": [[32, "vector"]], + "(method 38 gun-yellow-shot)": [[16, "collide-query"]], + "target-gun-fire-red": [ + // TODO needed to prevent infinite loop + [16, "vector"] + ], + "(method 26 gun-red-shot)": [[16, "vector"]], + "(method 28 gun-red-shot)": [[16, "collide-query"]], + "(method 24 gun-red-shot)": [[16, "collide-query"]], + "target-gun-fire-dark": [[16, "collide-query"]] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 51887ff8e4..0cc49604c9 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -3133,10 +3133,6 @@ [13, "a0", "fact-info-crate"], [55, "v0", "float"] ], - "(method 0 carry-info)": [ - [44, "v1", "collide-shape-moving"], - [47, "v1", "collide-shape-moving"] - ], "crate-standard-event-handler": [ [14, "v1", "attack-info"], [15, "v1", "attack-info"], @@ -3412,50 +3408,14 @@ ], "(code notice-blue crate)": [ [19, "v1", "process-drawable"], - [21, "gp", "collide-shape-moving"], - [28, "a0", "collide-shape-moving"], [30, "v1", "collide-shape-moving"] ], - "(post fall crate)": [ - [4, "a0", "collide-shape-moving"], - [15, "v1", "collide-shape-moving"], - [26, "v1", "collide-shape-moving"], - [[34, 53], "gp", "collide-shape-moving"] - ], - "(trans fall crate)": [ - [1, "v1", "collide-shape-moving"], - [6, "v1", "float"], - [8, "v1", "collide-shape-moving"], - [24, "v1", "collide-shape-moving"], - [32, "v1", "collide-shape-moving"], - [34, "a0", "collide-shape-moving"], - [37, "a0", "collide-shape-moving"] - ], - "(enter fall crate)": [ - [35, "v0", "carry-info"], - [42, "v1", "collide-shape-moving"], - [46, "v1", "collide-shape-moving"], - [50, "a0", "collide-shape-moving"], - [54, "v1", "collide-shape-moving"] - ], - "(post carry crate)": [[[13, 16], "a0", "collide-shape-moving"]], + "(trans fall crate)": [[6, "v1", "float"]], "(event carry crate)": [[15, "a0", "vector"]], - "(code idle crate)": [[[2, 5], "a0", "collide-shape-moving"]], - "(code hide crate)": [ - [27, "v1", "collide-shape-moving"], - [95, "v1", "collide-shape-moving"], - [97, "a0", "collide-shape-moving"], - [100, "a0", "collide-shape-moving"] - ], - "(code special-contents-die crate)": [[42, "v1", "collide-shape-moving"]], "target-send-attack": [ ["_stack_", 96, "symbol"], [16, "s4", "process-focusable"] ], - "(method 36 crate)": [ - [6, "a0", "collide-shape-moving"], - [27, "a0", "collide-shape-moving"] - ], "camera-rotate-to-vector": [[63, "v1", "float"]], "target-gun-find-track": [ [182, "v0", "process-focusable"], @@ -3717,5 +3677,91 @@ "(method 9 los-control)": [ [54, "s1", "process-focusable"], [35, "s1", "process-focusable"] - ] + ], + "(method 18 grid-hash)": [ + [42, "a0", "(pointer grid-hash-word)"], + [44, "t4", "(pointer grid-hash-word)"], + [46, "t6", "(pointer grid-hash-word)"] + ], + "(method 19 grid-hash)": [[46, "t6", "(pointer uint8)"]], + "(method 15 sphere-hash)": [[5, "v0", "(function grid-hash none)"]], + "(method 32 sphere-hash)": [[107, "v1", "float"]], + "(method 0 carry-info)": [[42, "s5", "collide-shape"]], + "(method 13 carry-info)": [ + [14, "v1", "handle"], + [22, "v0", "carry-info"], + [11, "v1", "handle"] + ], + "(method 12 carry-info)": [ + [27, "s4", "collide-shape"], + [46, "a0", "process-drawable"], + [47, "v1", "collide-shape"], + [52, "a1", "process-drawable"], + [53, "a0", "collide-shape"], + [59, "a1", "process-drawable"], + [60, "a0", "collide-shape"] + ], + "(method 11 carry-info)": [ + [43, "s4", "collide-shape"], + [211, "a0", "process-drawable"], + [212, "v1", "collide-shape"], + [218, "a2", "process-drawable"], + [225, "a1", "process-drawable"], + [231, "a0", "process-drawable"], + [232, "v1", "collide-shape"], + [10, "v1", "handle"], + [20, "v1", "handle"], + [219, "a1", "collide-shape"], + [226, "a0", "collide-shape"] + ], + "(method 14 carry-info)": [ + [45, "s2", "collide-shape"], + [158, "a0", "process-drawable"], + [159, "v1", "collide-shape"], + [165, "a2", "process-drawable"], + [172, "a1", "process-drawable"], + [178, "a0", "process-drawable"], + [179, "v1", "collide-shape"], + [12, "v1", "handle"], + [22, "v1", "handle"], + [166, "a1", "collide-shape"], + [173, "a0", "collide-shape"], + [151, "a0", "process-drawable"], + [152, "v1", "collide-shape"], + [158, "a2", "process-drawable"], + [165, "a1", "process-drawable"], + [171, "a0", "process-drawable"], + [172, "v1", "collide-shape"], + [159, "a1", "collide-shape"], + [166, "a0", "collide-shape"] + ], + "(method 16 carry-info)": [[22, "v0", "carry-info"]], + "(event idle task-arrow)": [[6, "a0", "vector"]], + "projectile-init-by-other": [[113, "v1", "process-drawable"]], + "(method 35 projectile)": [[5, "a1", "projectile"]], + "target-gun-fire-blue": [[71, "a0", "projectile"]], + "(method 24 gun-blue-shot)": [[15, "s5", "projectile"]], + "target-gun-fire-yellow": [[28, "a0", "projectile"]], + "target-gun-fire-red": [ + [150, "v1", "process-drawable"], + [194, "v1", "process-drawable"], + [197, "v1", "process-drawable"], + [200, "v1", "process-drawable"] + ], + "(method 26 gun-red-shot)": [ + [43, "a0", "connection"], + [44, "a0", "collide-shape"], + [92, "a0", "connection"], + [93, "a0", "collide-shape"] + ], + "gun-red-shot-init-by-other": [[89, "v1", "process-drawable"]], + "(method 23 gun-red-shot)": [[10, "s4", "process-focusable"]], + "target-gun-fire-dark": [[30, "a0", "projectile"]], + "process-drawable-shock-effect-bullseye": [[88, "a0", "lightning-tracker"]], + "projectile-update-velocity-space-wars": [ + [59, "a0", "process-drawable"], + [60, "a0", "collide-shape"] + ], + "cshape-reaction-blue-shot": [[15, "v1", "gun-blue-shot"]], + "(enter fall crate)": [[[35, 40], "a0", "carry-info"]] } diff --git a/game/graphics/opengl_renderer/background/Tie3.cpp b/game/graphics/opengl_renderer/background/Tie3.cpp index e8a8b10446..301d676821 100644 --- a/game/graphics/opengl_renderer/background/Tie3.cpp +++ b/game/graphics/opengl_renderer/background/Tie3.cpp @@ -221,19 +221,19 @@ void do_wind_math(u16 wind_idx, // vmula.xyzw acc, vf16, vf1 # acc = vf16 // vmsubax.xyzw acc, vf18, vf19 # acc = vf16 - vf18 * wind_const.x // vmsuby.xyzw vf16, vf17, vf19 - //# vf16 -= (vf18 * wind_const.x) + (vf17 * wind_const.y) + // # vf16 -= (vf18 * wind_const.x) + (vf17 * wind_const.y) vf16.x() -= cx * vf18_x + cy * vf17_x; vf16.z() -= cx * vf18_z + cy * vf17_z; // vmulaz.xyzw acc, vf16, vf19 # acc = vf16 * wind_const.z // vmadd.xyzw vf18, vf1, vf18 - //# vf18 += vf16 * wind_const.z + // # vf18 += vf16 * wind_const.z math::Vector4f vf18(vf18_x, 0.f, vf18_z, 0.f); vf18 += vf16 * cz; // vmulaz.xyzw acc, vf18, vf19 # acc = vf18 * wind_const.z // vmadd.xyzw vf17, vf17, vf1 - //# vf17 += vf18 * wind_const.z + // # vf17 += vf18 * wind_const.z math::Vector4f vf17(vf17_x, 0.f, vf17_z, 0.f); vf17 += vf18 * cz; diff --git a/goal_src/jak2/engine/collide/collide-h.gc b/goal_src/jak2/engine/collide/collide-h.gc index beff12f9fc..ec154f740d 100644 --- a/goal_src/jak2/engine/collide/collide-h.gc +++ b/goal_src/jak2/engine/collide/collide-h.gc @@ -5,14 +5,16 @@ ;; name in dgo: collide-h ;; dgos: ENGINE, GAME +(declare-type collide-query-with-vec structure) + ;; DECOMP BEGINS (deftype collide-query (structure) ((best-other-tri collide-tri-result :inline :offset-assert 0) (best-my-tri collide-tri-result :inline :offset 0) - (ignore-processes process 2 :offset-assert 88) - (ignore-process0 process :offset 88) - (ignore-process1 process :offset 92) + (ignore-processes process-tree 2 :offset-assert 88) + (ignore-process0 process-tree :offset 88) + (ignore-process1 process-tree :offset 92) (ignore-pat pat-surface :offset-assert 96) (collide-with collide-spec :offset-assert 100) (overlay-params uint32 3 :offset 112) diff --git a/goal_src/jak2/engine/collide/collide-shape-h.gc b/goal_src/jak2/engine/collide/collide-shape-h.gc index aec9d38a81..69de6067b0 100644 --- a/goal_src/jak2/engine/collide/collide-shape-h.gc +++ b/goal_src/jak2/engine/collide/collide-shape-h.gc @@ -7,10 +7,10 @@ (declare-type collide-shape trsqv) (declare-type collide-shape-moving collide-shape) +(declare-type control-info collide-shape-moving) (declare-type touching-list structure) (declare-type collide-query structure) (declare-type water-info structure) -(declare-type control-info basic) (defenum penetrate :bitfield #t @@ -250,7 +250,10 @@ ) ;; ---nav-flags +;; NOTE - for projectile (define-extern cshape-reaction-default (function control-info collide-query vector vector cshape-moving-flags)) +(define-extern cshape-reaction-update-state (function control-info collide-query vector none)) +(define-extern cshape-reaction-just-move (function control-info collide-query vector cshape-moving-flags)) ;; DECOMP BEGINS @@ -467,7 +470,7 @@ (collide-shape-method-34 () none 34) (collide-shape-method-35 () none 35) (collide-shape-method-36 () none 36) - (collide-shape-method-37 () none 37) + (collide-shape-method-37 (_type_ vector) none 37) (collide-shape-method-38 () none 38) (collide-shape-method-39 () none 39) (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) @@ -477,8 +480,8 @@ (collide-shape-method-44 () none 44) (collide-shape-method-45 () none 45) (collide-shape-method-46 (_type_) none 46) - (collide-shape-method-47 () none 47) - (collide-shape-method-48 () none 48) + (set-collide-with! (_type_ collide-spec) none 47) + (set-collide-as! (_type_ collide-spec) none 48) (collide-shape-method-49 (_type_ int int int) none 49) (collide-shape-method-50 (_type_ process object float float float) none 50) (collide-shape-method-51 () none 51) @@ -529,10 +532,10 @@ (collide-shape-moving-method-59 () none 59) (collide-shape-moving-method-60 () none 60) (collide-shape-moving-method-61 () none 61) - (collide-shape-moving-method-62 (_type_) none 62) + (compute-acc-due-to-gravity (_type_ vector float) vector 62) (collide-shape-moving-method-63 () none 63) (collide-shape-moving-method-64 () none 64) - (collide-shape-moving-method-65 () none 65) + (collide-shape-moving-method-65 (_type_ vector float float float) symbol 65) (collide-shape-moving-method-66 () none 66) (collide-shape-moving-method-67 () none 67) ) diff --git a/goal_src/jak2/engine/collide/collide.gc b/goal_src/jak2/engine/collide/collide.gc index f241cc8612..e9aa816436 100644 --- a/goal_src/jak2/engine/collide/collide.gc +++ b/goal_src/jak2/engine/collide/collide.gc @@ -5,5 +5,11 @@ ;; name in dgo: collide ;; dgos: ENGINE, GAME +(deftype collide-query-with-vec (structure) + "A custom type added because of weirdness discovered in task-arrow::23" + ((cquery collide-query :inline) + (vec vector :inline)) + ) + ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/common_objs/crates.gc b/goal_src/jak2/engine/common_objs/crates.gc index 3d4156cf08..b3f255221d 100644 --- a/goal_src/jak2/engine/common_objs/crates.gc +++ b/goal_src/jak2/engine/common_objs/crates.gc @@ -27,19 +27,21 @@ :flag-assert #x900000010 ) + (define *CRATE-bank* (new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 6963.2 :DARKECO_EXPLODE_RADIUS 16384.0) ) (deftype crate (process-focusable) - ((smush smush-control :inline :offset-assert 208) - (base vector :inline :offset-assert 240) - (look symbol :offset-assert 256) - (defense symbol :offset-assert 260) - (incoming-attack-id uint32 :offset-assert 264) - (target handle :offset-assert 272) - (child-count int32 :offset-assert 280) - (victory-anim spool-anim :offset-assert 284) + ((root-override2 collide-shape-moving :offset 128) + (smush smush-control :inline :offset-assert 208) + (base vector :inline :offset-assert 240) + (look symbol :offset-assert 256) + (defense symbol :offset-assert 260) + (incoming-attack-id uint32 :offset-assert 264) + (target handle :offset-assert 272) + (child-count int32 :offset-assert 280) + (victory-anim spool-anim :offset-assert 284) ) :heap-base #xa0 :method-count-assert 41 @@ -63,6 +65,7 @@ ) ) + (method-set! crate 12 (method-of-type process run-logic?)) (defbehavior crate-post crate () @@ -70,6 +73,7 @@ (smush-update! self) (rider-post) (carry-info-method-9 (-> self carry)) + (none) ) (defpart 565 @@ -479,7 +483,7 @@ (go-virtual die #f (the-as int s5-0)) ) (else - (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root trans y) (-> self base y))) + (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root-override2 trans y) (-> self base y))) (if (not (and (demo?) (= (-> *setting-control* user-current language) (language-enum japanese)))) (talker-spawn-func (-> *talker-speech* 313) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -508,7 +512,7 @@ (go-virtual die #f (the-as int s5-0)) ) (else - (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root trans y) (-> self base y))) + (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root-override2 trans y) (-> self base y))) (talker-spawn-func (-> *talker-speech* 318) *entity-pool* (target-pos 0) (the-as region #f)) (set! (-> self incoming-attack-id) s4-0) (if (not (!= (-> self smush amp) 0.0)) @@ -584,7 +588,7 @@ ) ) (('bonk) - (when (= (-> self root trans y) (-> self base y)) + (when (= (-> self root-override2 trans y) (-> self base y)) (activate! (-> self smush) -0.1 75 150 1.0 1.0 (-> self clock)) (go-virtual bounce-on) ) @@ -604,7 +608,7 @@ (or (= v1-131 'notice-blue) (= v1-131 'die)) ) ) - (!= (-> self root trans y) (-> self base y)) + (!= (-> self root-override2 trans y) (-> self base y)) ) ) (go-virtual notice-blue (process->handle arg0)) @@ -612,7 +616,7 @@ ) (('fall) (when (not (and (-> self next-state) (= (-> self next-state name) 'fall))) - (set! (-> self root transv quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (set! (-> self root-override2 transv quad) (-> (the-as vector (-> arg3 param 0)) quad)) (go-virtual fall) ) ) @@ -624,10 +628,10 @@ :code (behavior () (process-entity-status! self (entity-perm-status dead) #f) (process-entity-status! self (entity-perm-status subtask-complete) #f) - (vector+! (-> self draw origin) (-> self root trans) (-> self draw bounds)) + (vector+! (-> self draw origin) (-> self root-override2 trans) (-> self draw bounds)) (set! (-> self draw origin w) (-> self draw bounds w)) (logior! (-> self draw status) (draw-control-status no-draw)) - (let ((v1-9 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (let ((v1-9 (-> self root-override2 root-prim))) (set! (-> v1-9 prim-core collide-as) (collide-spec)) (set! (-> v1-9 prim-core collide-with) (collide-spec)) ) @@ -635,19 +639,20 @@ (ja-post) (while (or (crate-method-40 self) (and (sphere-in-view-frustum? (the-as sphere (-> self draw origin))) - (< (vector-vector-distance (camera-pos) (-> self root trans)) 327680.0) + (< (vector-vector-distance (camera-pos) (-> self root-override2 trans)) 327680.0) ) - (and *target* (and (>= 40960.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) - (zero? (logand (focus-status teleporting) (-> *target* focus-status))) - ) + (and *target* + (and (>= 40960.0 (vector-vector-distance (-> self root-override2 trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) ) ) (suspend) ) (logclear! (-> self draw status) (draw-control-status no-draw)) - (let ((v1-29 (-> (the-as collide-shape-moving (-> self root)) root-prim))) - (set! (-> v1-29 prim-core collide-as) (-> (the-as collide-shape-moving (-> self root)) backup-collide-as)) - (set! (-> v1-29 prim-core collide-with) (-> (the-as collide-shape-moving (-> self root)) backup-collide-with)) + (let ((v1-29 (-> self root-override2 root-prim))) + (set! (-> v1-29 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-29 prim-core collide-with) (-> self root-override2 backup-collide-with)) ) (go-virtual idle) (none) @@ -659,7 +664,7 @@ :event crate-standard-event-handler :code (behavior () (suspend) - (collide-shape-method-46 (the-as collide-shape-moving (-> self root))) + (collide-shape-method-46 (-> self root-override2)) (carry-info-method-9 (-> self carry)) (logior! (-> self mask) (process-mask sleep)) (until #f @@ -679,7 +684,7 @@ (-> self carry) ) (('drop) - (set! (-> self root transv quad) (-> (the-as vector (-> event param 1)) quad)) + (set! (-> self root-override2 transv quad) (-> (the-as vector (-> event param 1)) quad)) (go-virtual fall) ) ) @@ -689,7 +694,7 @@ (ja-post) (carry-info-method-9 (-> self carry)) (carry-info-method-13 (-> self carry)) - (collide-shape-method-46 (the-as collide-shape-moving (-> self root))) + (collide-shape-method-46 (-> self root-override2)) (none) ) ) @@ -710,41 +715,32 @@ ) ) :enter (behavior () - (when (handle->process (-> self carry other)) - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) (process->ppointer self)) - (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) 'carry-info) - (let* ((a0-9 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-1))) - (t9-1 (method-of-object a0-9 carry-info-method-12)) - ) + (if (handle->process (-> self carry other)) + (drop-impl! + (the-as carry-info (send-event (handle->process (-> self carry other)) 'carry-info)) (-> self carry) - (t9-1 a0-9) ) ) - ) - (set! (-> (the-as collide-shape-moving (-> self root)) status) (cshape-moving-flags)) - (set! (-> (the-as collide-shape-moving (-> self root)) root-prim local-sphere w) (-> self carry carry-radius)) - (set! (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core collide-with) + (set! (-> self root-override2 status) (cshape-moving-flags)) + (set! (-> self root-override2 root-prim local-sphere w) (-> self carry carry-radius)) + (set! (-> self root-override2 root-prim prim-core collide-with) (logior (collide-spec backgnd crate obstacle hit-by-others-list pusher) - (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core collide-with) + (-> self root-override2 root-prim prim-core collide-with) ) ) (none) ) :trans (behavior () - (when (and (logtest? (-> (the-as collide-shape-moving (-> self root)) status) (cshape-moving-flags on-surface)) - (< 0.8 (-> (the-as collide-shape-moving (-> self root)) surface-angle)) + (when (and (logtest? (-> self root-override2 status) (cshape-moving-flags on-surface)) + (< 0.8 (-> self root-override2 surface-angle)) ) - (vector-reset! (-> self root transv)) - (when (= (vector-length (-> self root transv)) 0.0) - (set! (-> (the-as collide-shape-moving (-> self root)) root-prim local-sphere w) - (-> self carry backup-radius) - ) - (set! (-> self base quad) (-> self root trans quad)) - (let ((v1-16 (-> (the-as collide-shape-moving (-> self root)) root-prim))) - (set! (-> v1-16 prim-core collide-as) (-> (the-as collide-shape-moving (-> self root)) backup-collide-as)) - (set! (-> v1-16 prim-core collide-with) (-> (the-as collide-shape-moving (-> self root)) backup-collide-with)) + (vector-reset! (-> self root-override2 transv)) + (when (= (vector-length (-> self root-override2 transv)) 0.0) + (set! (-> self root-override2 root-prim local-sphere w) (-> self carry backup-radius)) + (set! (-> self base quad) (-> self root-override2 trans quad)) + (let ((v1-16 (-> self root-override2 root-prim))) + (set! (-> v1-16 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-16 prim-core collide-with) (-> self root-override2 backup-collide-with)) ) (go-virtual idle) ) @@ -753,34 +749,24 @@ ) :code (the-as (function none :behavior crate) sleep-code) :post (behavior () - (let* ((gp-0 vector-v++!) - (s5-0 (-> self root transv)) - (a0-0 (-> self root)) - (t9-0 (method-of-object (the-as collide-shape-moving a0-0) collide-shape-moving-method-62)) - ) - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - 0 - (gp-0 s5-0 (the-as vector (t9-0 (the-as collide-shape-moving a0-0)))) + (vector-v++! + (-> self root-override2 transv) + (compute-acc-due-to-gravity (-> self root-override2) (new-stack-vector0) 0.0) ) - (if (< (-> (the-as collide-shape-moving (-> self root)) dynam gravity-max) (vector-length (-> self root transv))) - (vector-normalize! (-> self root transv) (-> (the-as collide-shape-moving (-> self root)) dynam gravity-max)) + (if (< (-> self root-override2 dynam gravity-max) (vector-length (-> self root-override2 transv))) + (vector-normalize! (-> self root-override2 transv) (-> self root-override2 dynam gravity-max)) ) - (let ((gp-1 (-> self root))) + (let ((gp-1 (-> self root-override2))) (let ((a2-1 (new 'stack-no-clear 'collide-query))) - (set! (-> (the-as collide-shape-moving gp-1) root-prim type) collide-shape-prim-sphere) + (set! (-> gp-1 root-prim type) collide-shape-prim-sphere) (set! (-> a2-1 collide-with) (collide-spec backgnd crate obstacle pusher)) (set! (-> a2-1 ignore-process0) self) (set! (-> a2-1 ignore-process1) #f) - (set! (-> a2-1 ignore-pat) (-> (the-as collide-shape-moving gp-1) pat-ignore-mask)) + (set! (-> a2-1 ignore-pat) (-> gp-1 pat-ignore-mask)) (set! (-> a2-1 action-mask) (collide-action solid)) - (collide-shape-method-32 - (the-as collide-shape-moving gp-1) - (-> (the-as collide-shape-moving gp-1) transv) - a2-1 - (meters 0) - ) + (collide-shape-method-32 gp-1 (-> gp-1 transv) a2-1 (meters 0)) ) - (set! (-> (the-as collide-shape-moving gp-1) root-prim type) collide-shape-prim-mesh) + (set! (-> gp-1 root-prim type) collide-shape-prim-mesh) ) (crate-post) (none) @@ -797,7 +783,7 @@ (go-virtual idle) (none) ) - :post (the-as (function none :behavior crate) crate-post) + :post crate-post ) (defstate notice-blue (crate) @@ -828,13 +814,13 @@ ) (when v1-3 (let* ((gp-1 (-> (the-as process-drawable v1-3) root)) - (v1-4 (if (type? (the-as collide-shape-moving gp-1) collide-shape) + (v1-4 (if (type? gp-1 collide-shape) gp-1 ) ) ) (when v1-4 - (let* ((gp-2 (-> (the-as collide-shape-moving (-> self root)) root-prim prim-core)) + (let* ((gp-2 (-> self root-override2 root-prim prim-core)) (a1-3 (-> (the-as collide-shape-moving v1-4) root-prim prim-core)) (f30-0 (vector-vector-distance (the-as vector gp-2) (the-as vector a1-3))) ) @@ -877,7 +863,7 @@ #f (none) ) - :post (the-as (function none :behavior crate) crate-post) + :post crate-post ) (defstate die (crate) @@ -911,7 +897,7 @@ ) :code (behavior ((arg0 symbol) (arg1 int)) (logior! (-> self focus-status) (focus-status dead)) - (let ((v1-3 (-> (the-as collide-shape (-> self root)) root-prim))) + (let ((v1-3 (-> (the-as collide-shape (-> self root-override2)) root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) ) @@ -952,13 +938,16 @@ ) (case (-> self defense) (('darkeco) - (let ((f0-0 (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root trans) (target-pos 0)) 8192.0 40960.0))) + (let ((f0-0 + (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root-override2 trans) (target-pos 0)) 8192.0 40960.0) + ) + ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 f0-0)) (seconds 0.3)) ) (process-spawn touch-tracker :init touch-tracker-init - (-> self root trans) + (-> self root-override2 trans) (-> *CRATE-bank* DARKECO_EXPLODE_RADIUS) 30 :to self @@ -982,7 +971,7 @@ (t2-4 #f) (t3-0 *launch-matrix*) ) - (set! (-> t3-0 trans quad) (-> self root trans quad)) + (set! (-> t3-0 trans quad) (-> self root-override2 trans quad)) ((the-as (function object object object object object object object object none) t9-18) a0-34 a1-21 @@ -1014,7 +1003,7 @@ (t2-5 #f) (t3-1 *launch-matrix*) ) - (set! (-> t3-1 trans quad) (-> self root trans quad)) + (set! (-> t3-1 trans quad) (-> self root-override2 trans quad)) ((the-as (function object object object object object object object object none) t9-21) a0-39 a1-27 @@ -1046,7 +1035,7 @@ (t2-6 #f) (t3-2 *launch-matrix*) ) - (set! (-> t3-2 trans quad) (-> self root trans quad)) + (set! (-> t3-2 trans quad) (-> self root-override2 trans quad)) ((the-as (function object object object object object object object object none) t9-24) a0-42 a1-32 @@ -1082,11 +1071,7 @@ ) ) ) - (let ((t9-29 (method-of-object (-> self fact) fact-info-method-9))) - #t - *entity-pool* - (t9-29) - ) + (drop-pickup (-> self fact) #t *entity-pool* (the-as fact-info #f) arg1) (process-entity-status! self (entity-perm-status dead) #t) (process-entity-status! self (entity-perm-status subtask-complete) #t) (let ((gp-1 (-> self clock frame-counter))) @@ -1157,18 +1142,13 @@ ) ) ) - (let ((v1-20 (-> (the-as collide-shape-moving (-> self root)) root-prim))) + (let ((v1-20 (-> self root-override2 root-prim))) (set! (-> v1-20 prim-core collide-as) (collide-spec)) (set! (-> v1-20 prim-core collide-with) (collide-spec)) ) 0 (logior! (-> self draw status) (draw-control-status no-draw)) - (let ((t9-0 (method-of-object (-> self fact) fact-info-method-9))) - #t - self - 0 - (t9-0) - ) + (drop-pickup (-> self fact) #t self (the-as fact-info #f) 0) (set! (-> self child-count) (+ (process-count self) -1)) (process-entity-status! self (entity-perm-status bit-4) #t) (when (-> self entity) @@ -1190,7 +1170,7 @@ (defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol) (arg3 fact-info-crate)) (crate-init! self (the-as entity-actor arg0)) - (set! (-> self root trans quad) (-> arg1 quad)) + (set! (-> self root-override2 trans quad) (-> arg1 quad)) (set! (-> self look) arg2) (set! (-> self defense) arg2) (skel-init! self) @@ -1210,6 +1190,7 @@ (none) ) +;; WARN: Return type mismatch crate vs none. (defmethod crate-init! crate ((obj crate) (arg0 entity-actor)) "Initialize the [[crate]] with the specified [[entity-actor]]." (stack-size-set! (-> obj main-thread) 128) @@ -1254,7 +1235,7 @@ knocked ) ) - (set! (-> obj root) s4-0) + (set! (-> obj root-override2) s4-0) ) (set! (-> obj fact) (new 'process 'fact-info-crate obj (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) @@ -1298,11 +1279,12 @@ (none) ) +;; WARN: Return type mismatch crate vs none. (defmethod skel-init! crate ((obj crate)) "Initialize the [[crate]]'s skeleton and other parameters based on the crate type." (case (-> obj look) (('iron) - (set! (-> (the-as collide-shape-moving (-> obj root)) penetrated-by) + (set! (-> obj root-override2 penetrated-by) (penetrate flop uppercut tube vehicle flut-attack board dark-skin explode) ) (initialize-skeleton @@ -1312,9 +1294,7 @@ ) ) (('steel) - (set! (-> (the-as collide-shape-moving (-> obj root)) penetrated-by) - (penetrate tube vehicle flut-attack board dark-skin explode) - ) + (set! (-> obj root-override2 penetrated-by) (penetrate tube vehicle flut-attack board dark-skin explode)) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) @@ -1350,12 +1330,13 @@ ) ) ) - (set! (-> obj base quad) (-> obj root trans quad)) + (set! (-> obj base quad) (-> obj root-override2 trans quad)) (crate-post) (nav-mesh-connect-from-ent (the-as entity-nav-mesh obj)) (none) ) +;; WARN: Return type mismatch crate vs none. (defmethod params-set! crate ((obj crate) (arg0 symbol) (arg1 symbol)) "Set [[crate]] params based on the arguments." (if arg0 @@ -1390,14 +1371,15 @@ (defmethod smush-update! crate ((obj crate)) (let ((f0-0 (update! (-> obj smush)))) - (set! (-> obj root scale x) (+ 1.0 (* -0.5 f0-0))) - (set! (-> obj root scale y) (+ 1.0 f0-0)) - (set! (-> obj root scale z) (+ 1.0 (* -0.5 f0-0))) + (set! (-> obj root-override2 scale x) (+ 1.0 (* -0.5 f0-0))) + (set! (-> obj root-override2 scale y) (+ 1.0 f0-0)) + (set! (-> obj root-override2 scale z) (+ 1.0 (* -0.5 f0-0))) ) 0 (none) ) +;; WARN: disable def twice: 57. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod crate-method-40 crate ((obj crate)) (cond ((and (> (-> (the-as fact-info-crate (-> obj fact)) suck-count) 0) @@ -1438,19 +1420,8 @@ :flag-assert #x2900b00124 ) -(defmethod inspect pickup-spawner ((obj pickup-spawner)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type crate inspect))) - (t9-0 obj) - ) - (format #t "~2Tblocker: ~A~%" (-> obj blocker)) - (label cfg-4) - obj - ) +;; WARN: Return type mismatch pickup-spawner vs none. (defmethod crate-init! pickup-spawner ((obj pickup-spawner) (arg0 entity-actor)) "Initialize the [[crate]] with the specified [[entity-actor]]." (let ((t9-0 (method-of-type crate crate-init!))) diff --git a/goal_src/jak2/engine/common_objs/generic-obs-h.gc b/goal_src/jak2/engine/common_objs/generic-obs-h.gc index 10ca4db1ab..1d5f08118b 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs-h.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs-h.gc @@ -12,6 +12,13 @@ (declare-type sparticle-launch-group basic) +;; NOTE - for gun-blue-shot +(declare-type part-tracker process) +(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker)) + +;; NOTE - for gun-red-shot +(declare-type manipy process-drawable) +(define-extern manipy-init (function vector entity-actor skeleton-group vector none :behavior manipy)) (define-extern lightning-tracker-init (function lightning-spec time-frame symbol process-drawable vector vector none)) (define-extern birth-pickup-at-point (function vector pickup-type float symbol process-tree fact-info (pointer process) :behavior process)) @@ -50,6 +57,7 @@ ) ) + (deftype part-spawner (process) ((root trsqv :offset-assert 128) (part sparticle-launch-control :offset-assert 132) @@ -69,6 +77,7 @@ ) ) + (deftype part-tracker (process) ((root trsqv :offset-assert 128) (mat matrix :inline :offset-assert 144) @@ -96,23 +105,24 @@ ) ) + (deftype lightning-tracker (process) - ((root basic :offset-assert 128) - (lightning lightning-spec :offset-assert 132) - (callback basic :offset-assert 136) - (duration uint64 :offset-assert 144) - (start-time time-frame :offset-assert 152) - (offset0 vector :inline :offset-assert 160) - (offset1 vector :inline :offset-assert 176) - (target0 uint64 :offset-assert 192) - (target1 uint64 :offset-assert 200) - (target-joint0 int32 :offset-assert 208) - (target-joint1 int32 :offset-assert 212) - (sound uint32 :offset-assert 216) - (userdata uint64 :offset-assert 224) - (user-time time-frame 2 :offset-assert 232) - (user-vector vector :inline :offset-assert 256) - (user-handle handle 2 :offset 288) + ((root trsqv :offset-assert 128) + (lightning lightning-spec :offset-assert 132) + (callback (function lightning-tracker none) :offset-assert 136) + (duration uint64 :offset-assert 144) + (start-time time-frame :offset-assert 152) + (offset0 vector :inline :offset-assert 160) + (offset1 vector :inline :offset-assert 176) + (target0 uint64 :offset-assert 192) + (target1 uint64 :offset-assert 200) + (target-joint0 int32 :offset-assert 208) + (target-joint1 int32 :offset-assert 212) + (sound uint32 :offset-assert 216) + (userdata uint64 :offset-assert 224) + (user-time time-frame 2 :offset-assert 232) + (user-vector vector :inline :offset-assert 256) + (user-handle handle 2 :offset 288) ) :heap-base #xb0 :method-count-assert 17 @@ -125,6 +135,7 @@ ) ) + (deftype touch-tracker (process-drawable) ((duration time-frame :offset-assert 200) (target handle :offset-assert 208) @@ -142,6 +153,7 @@ ) ) + (deftype swingpole (process-drawable) ((edge-length meters :offset-assert 200) (path-pos float :offset-assert 204) @@ -161,6 +173,7 @@ ) ) + (deftype gui-query (structure) ((x-position int32 :offset-assert 0) (y-position int32 :offset-assert 4) @@ -179,6 +192,7 @@ ) ) + (deftype othercam (process) ((hand handle :offset-assert 128) (old-global-mask process-mask :offset-assert 136) @@ -199,6 +213,7 @@ :flag-assert #xe006000d8 ) + (deftype explosion (process-drawable) ((start-time time-frame :offset-assert 200) (duration uint32 :offset-assert 208) @@ -216,6 +231,7 @@ ) ) + (deftype explosion-init-params (structure) ((spawn-point vector :inline :offset-assert 0) (spawn-quat quaternion :inline :offset-assert 16) @@ -229,6 +245,7 @@ :flag-assert #x900000038 ) + (deftype process-hidden (process) () :method-count-assert 15 @@ -238,4 +255,3 @@ (process-hidden-method-14 () none 14) ) ) - diff --git a/goal_src/jak2/engine/common_objs/projectile-h.gc b/goal_src/jak2/engine/common_objs/projectile-h.gc index a0d9045b49..0cc94b4177 100644 --- a/goal_src/jak2/engine/common_objs/projectile-h.gc +++ b/goal_src/jak2/engine/common_objs/projectile-h.gc @@ -5,19 +5,31 @@ ;; name in dgo: projectile-h ;; dgos: ENGINE, GAME +;; +++projectile-options (defenum projectile-options :type uint64 :bitfield #t + (lose-altitude 0) + (proj-options-2 1) + (proj-options-3 3) + (proj-options-4 4) + (account-for-target-velocity 13) + (deal-damage 14) + (proj-options-8000 15) + (respect-invinc-time 16) + (ignore-impact 17) ) +;; ---projectile-options -(declare-type projectile-init-by-other-params structure) (declare-type projectile process-drawable) -(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile)) +(declare-type projectile-init-by-other-params structure) +(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile :behavior projectile)) ;; DECOMP BEGINS (deftype projectile (process-drawable) - ((starting-pos vector :inline :offset-assert 208) + ((root-override collide-shape-moving :offset 128) + (starting-pos vector :inline :offset-assert 208) (starting-dir vector :inline :offset-assert 224) (target-pos vector :inline :offset-assert 240) (base-target-pos vector :inline :offset-assert 256) @@ -30,8 +42,8 @@ (owner-handle handle :offset-assert 328) (ignore-handle handle :offset-assert 336) (update-velocity (function projectile none) :offset-assert 344) - (move basic :offset-assert 348) - (pick-target basic :offset-assert 352) + (move (function projectile none) :offset-assert 348) + (pick-target (function projectile none) :offset-assert 352) (max-speed float :offset-assert 356) (old-dist float 16 :offset-assert 360) (old-dist-count int32 :offset-assert 424) @@ -51,32 +63,32 @@ :size-assert #x1d8 :flag-assert #x28016001d8 (:methods - (projectile-method-20 () none 20) - (projectile-method-21 () none 21) - (projectile-method-22 () none 22) - (projectile-method-23 () none 23) - (projectile-method-24 () none 24) - (projectile-method-25 () none 25) - (projectile-method-26 () none 26) - (projectile-method-27 () none 27) - (projectile-method-28 () none 28) - (projectile-method-29 () none 29) - (projectile-method-30 () none 30) - (projectile-method-31 (_type_) none 31) - (projectile-method-32 () none 32) - (projectile-method-33 () none 33) - (projectile-method-34 () none 34) - (projectile-method-35 () none 35) - (projectile-method-36 () none 36) - (projectile-method-37 () none 37) - (projectile-method-38 () none 38) - (projectile-method-39 () none 39) + (die () _type_ :state 20) + (dissipate () _type_ :state 21) + (impact () _type_ :state 22) + (moving () _type_ :state 23) + (draw-laser-sight (_type_) none 24) + (spawn-impact-particles (_type_) none 25) + (spawn-shell-particles (_type_) none 26) + (unknown-particles (_type_) none 27) + (play-impact-sound (_type_ projectile-options) sound-id 28) + (stop-sound! (_type_) none 29) + (init-collision! (_type_) none 30) + (init-proj-settings! (_type_) none 31) + (go-moving! (_type_) none 32) + (go-sitting! (_type_) none 33) + (kill-projectile! (_type_) symbol 34) + (event-handler! (_type_ process int symbol event-message-block) object 35) + (handle-proj-hit! (_type_ process event-message-block) object 36) + (deal-damage! (_type_ process event-message-block) symbol 37) + (made-impact? (_type_) symbol 38) + (play-impact-sound! (_type_) sound-id :behavior projectile 39) ) ) (deftype projectile-init-by-other-params (structure) - ((ent basic :offset-assert 0) + ((ent entity :offset-assert 0) (charge float :offset-assert 4) (attack-id uint32 :offset-assert 8) (options projectile-options :offset-assert 16) @@ -106,6 +118,7 @@ ) (deftype projectile-bounce (projectile) + "This seems to be the scrapped peacemaker gun implementation - the bouncing dark eco grenade launcher" ((played-bounce-time time-frame :offset-assert 472) (tumble-quat quaternion :inline :offset-assert 480) ) @@ -114,7 +127,14 @@ :size-assert #x1f0 :flag-assert #x2a017001f0 (:methods - (projectile-bounce-method-40 () none 40) - (projectile-bounce-method-41 () none 41) + (sitting () _type_ :state 40) + (noop (_type_) none 41) ) ) + + +0 + + + + diff --git a/goal_src/jak2/engine/common_objs/projectile.gc b/goal_src/jak2/engine/common_objs/projectile.gc index fba9b86923..e8532f40a9 100644 --- a/goal_src/jak2/engine/common_objs/projectile.gc +++ b/goal_src/jak2/engine/common_objs/projectile.gc @@ -7,3 +7,674 @@ ;; DECOMP BEGINS +(defun cshape-reaction-projectile ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + "A projectile's collision reaction -- if the projectile hits a material with [[pat-material::stopproj]] set, kill the projectile" + (let ((s5-0 (cshape-reaction-default arg0 arg1 arg2 arg3))) + (case (-> arg1 best-other-tri pat material) + (((pat-material stopproj)) + (send-event (-> arg0 process) 'die) + ) + ) + s5-0 + ) + ) + +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound! projectile ((obj projectile)) + "Plays impact sound + :virtual" + (the-as sound-id 0) + ) + +(defmethod event-handler! projectile ((obj projectile) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Multiplex the projectile's event processing, called by [[projectile-event-handler]]" + (case arg2 + (('track) + (let ((v0-0 (the-as object (process->handle (the-as process (-> arg3 param 0)))))) + (set! (-> obj last-target) (the-as handle v0-0)) + v0-0 + ) + ) + (('touched 'touch) + (handle-proj-hit! obj arg0 arg3) + ) + (('die) + (kill-projectile! obj) + ) + ) + ) + +;; WARN: Return type mismatch object vs projectile. +(defbehavior projectile-event-handler projectile ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (the-as projectile (event-handler! self arg0 arg1 arg2 arg3)) + ) + +;; WARN: Return type mismatch object vs symbol. +(defmethod deal-damage! projectile ((obj projectile) (arg0 process) (arg1 event-message-block)) + "Constructs an [[attack-info]] according to the projectile's `options`" + (let ((v1-1 (new 'stack 'attack-info))) + (let ((a0-2 v1-1)) + (set! (-> a0-2 mode) (-> obj attack-mode)) + (set! (-> a0-2 id) (-> obj attack-id)) + (set! (-> a0-2 mask) (attack-info-mask mode id)) + ) + (when (!= (-> obj owner-handle) #f) + (set! (-> v1-1 attacker) (-> obj owner-handle)) + (logior! (-> v1-1 mask) (attack-info-mask attacker)) + ) + (when (logtest? (-> obj options) (projectile-options account-for-target-velocity)) + (set! (-> v1-1 attacker-velocity quad) (-> obj pre-move-transv quad)) + (set! (-> v1-1 mask) (logior (attack-info-mask attacker-velocity) (-> v1-1 mask))) + ) + (when (logtest? (-> obj options) (projectile-options deal-damage)) + (set! (-> v1-1 damage) (-> obj damage)) + (set! (-> v1-1 mask) (logior (attack-info-mask damage) (-> v1-1 mask))) + ) + (when (logtest? (projectile-options respect-invinc-time) (-> obj options)) + (set! (-> v1-1 invinc-time) (-> obj invinc-time)) + (logior! (-> v1-1 mask) (attack-info-mask invinc-time)) + ) + (the-as symbol (send-event + arg0 + (if (logtest? (projectile-options ignore-impact) (-> obj options)) + 'attack-invinc + 'attack + ) + arg1 + v1-1 + ) + ) + ) + ) + +(defmethod handle-proj-hit! projectile ((obj projectile) (arg0 process) (arg1 event-message-block)) + "When a projectile hits something, first deal damage via [[projectile::37]] + and increment the projectiles hit count. + + If we've met or exceeded the projectiles maximum allowed hits, switch to the [[projectile::impact]] state" + (when (-> obj attack-mode) + (let ((a2-1 (-> arg1 param 0))) + (when (deal-damage! obj arg0 (the-as event-message-block a2-1)) + (let ((v1-3 (-> obj notify-handle))) + (send-event (handle->process v1-3) 'notify 'attack arg0) + ) + (+! (-> obj hits) 1) + (if (and (>= (-> obj hits) (-> obj max-hits)) + (not (and (-> obj next-state) (= (-> obj next-state name) 'impact))) + ) + (go (method-of-object obj impact)) + ) + ) + ) + ) + ) + +(defmethod kill-projectile! projectile ((obj projectile)) + "Transition to the [[projectile::impact]] state, always return [[#t]]" + (if (not (and (-> obj next-state) (= (-> obj next-state name) 'impact))) + (go (method-of-object obj impact)) + ) + #t + ) + +(defmethod draw-laser-sight projectile ((obj projectile)) + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + 0 + (none) + ) + +(defmethod spawn-impact-particles projectile ((obj projectile)) + "Spawns associated particles with the projectile if applicable" + (if (nonzero? (-> obj part)) + (spawn (-> obj part) (-> obj root-override trans)) + ) + 0 + (none) + ) + +(defmethod spawn-shell-particles projectile ((obj projectile)) + "TODO - confirm" + 0 + (none) + ) + +(defmethod unknown-particles projectile ((obj projectile)) + "TODO - confirm" + 0 + (none) + ) + +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound projectile ((obj projectile) (arg0 projectile-options)) + (the-as sound-id 0) + ) + +(defmethod stop-sound! projectile ((obj projectile)) + "Stops the current `sound-id` if set, re-init the `sound-id` after being stopped" + (when (nonzero? (-> obj sound-id)) + (sound-stop (-> obj sound-id)) + (set! (-> obj sound-id) (new 'static 'sound-id)) + 0 + ) + 0 + (none) + ) + +(defmethod made-impact? projectile ((obj projectile)) + "TODO - queries the collision cache, return true/false" + (let ((v1-0 (-> obj root-override))) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a1-0 ignore-process0) obj) + (set! (-> a1-0 ignore-process1) (handle->process (-> obj ignore-handle))) + (set! (-> a1-0 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a1-0 action-mask) (collide-action solid)) + ) + (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) + ) + ) + +(defun projectile-move-fill-all-dirs ((arg0 projectile)) + (let ((v1-0 (-> arg0 root-override)) + (a2-0 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> a2-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a2-0 ignore-process0) arg0) + (set! (-> a2-0 ignore-process1) (handle->process (-> arg0 ignore-handle))) + (set! (-> a2-0 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a2-0 action-mask) (collide-action solid)) + (collide-shape-method-32 v1-0 (-> v1-0 transv) a2-0 (meters 0)) + ) + 0 + (none) + ) + +(defun projectile-move-fill-line-sphere ((arg0 projectile)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (-> arg0 root-override))) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (let ((a2-0 (-> gp-0 root-prim))) + (set! (-> a1-0 start-pos quad) (-> gp-0 trans quad)) + (let ((v1-1 (-> a1-0 move-dist))) + (.lvf vf1 (&-> (-> gp-0 transv) quad)) + (let ((f0-0 (-> pp clock seconds-per-frame))) + (.mov at-0 f0-0) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-1 quad) vf1) + ) + (let ((v1-2 a1-0)) + (set! (-> v1-2 radius) (-> a2-0 prim-core world-sphere w)) + (set! (-> v1-2 collide-with) (-> a2-0 prim-core collide-with)) + (set! (-> v1-2 ignore-process0) arg0) + (set! (-> v1-2 ignore-process1) (handle->process (-> arg0 ignore-handle))) + (set! (-> v1-2 ignore-pat) (-> gp-0 pat-ignore-mask)) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + ) + (fill-using-line-sphere *collide-cache* a1-0) + ) + (collide-shape-method-37 gp-0 (-> gp-0 transv)) + ) + 0 + (none) + ) + ) + ) + +(defun projectile-update-velocity-add-gravity ((arg0 projectile)) + (vector-v++! + (-> arg0 root-override transv) + (compute-acc-due-to-gravity (-> arg0 root-override) (new-stack-vector0) 1.0) + ) + 0 + (none) + ) + +(defun projectile-update-velocity-space-wars ((arg0 projectile)) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> arg0 target-pos) (-> arg0 root-override trans)))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) + (f30-0 (vector-length (-> arg0 root-override transv))) + ) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (vector-flatten! s5-1 s5-1 (-> arg0 root-override local-normal)) + ) + (vector-normalize-copy! s4-0 s5-1 1.0) + (if (and (or (not (handle->process (-> arg0 last-target))) + (zero? (-> (the-as collide-shape (-> (the-as process-drawable (handle->process (-> arg0 last-target))) root)) + root-prim + prim-core + collide-as + ) + ) + ) + (< (vector-dot s4-0 s3-0) 0.0) + ) + (go (method-of-object arg0 dissipate)) + ) + (vector-deg-slerp (-> arg0 root-override transv) s3-0 s4-0 (-> arg0 tween)) + (vector-normalize! (-> arg0 root-override transv) f30-0) + ) + (vector+! (-> arg0 root-override transv) (-> arg0 root-override transv) s5-1) + ) + (vector-v++! + (-> arg0 root-override transv) + (compute-acc-due-to-gravity (-> arg0 root-override) (new-stack-vector0) 0.0) + ) + (if (< (-> arg0 max-speed) (vector-length (-> arg0 root-override transv))) + (vector-normalize! (-> arg0 root-override transv) (-> arg0 max-speed)) + ) + (if (logtest? (-> arg0 options) (projectile-options lose-altitude)) + (set! (-> arg0 root-override transv y) -40960.0) + ) + 0 + (none) + ) + +(defstate moving (projectile) + :virtual #t + :event projectile-event-handler + :exit (behavior () + (stop-sound! self) + (none) + ) + :trans (behavior () + (if (>= (- (-> self clock frame-counter) (-> self spawn-time)) (-> self timeout)) + (go-virtual dissipate) + ) + (let ((t9-1 (-> self pick-target))) + (if t9-1 + (t9-1 self) + ) + ) + (let ((t9-2 (-> self update-velocity))) + (if t9-2 + (t9-2 self) + ) + ) + (when (logtest? (-> self options) (projectile-options proj-options-2)) + (seek! (-> self tween) 1.0 (* 0.5 (-> self clock seconds-per-frame))) + (let ((f0-4 (vector-vector-distance (-> self root-override trans) (-> self target-pos)))) + (cond + ((< f0-4 20480.0) + (seek! (-> self tween) 1.0 (* 3.0 (-> self clock seconds-per-frame))) + ) + ((< f0-4 40960.0) + (seek! (-> self tween) 1.0 (-> self clock seconds-per-frame)) + ) + ) + ) + ) + (let ((gp-0 (-> self root-override))) + (set! (-> self pre-move-transv quad) (-> gp-0 transv quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> gp-0 trans quad)) + ((-> self move) self) + (play-impact-sound! self) + (set! (-> self old-dist (-> self old-dist-count)) (* 0.0625 (vector-vector-distance s5-0 (-> gp-0 trans)))) + ) + ) + (set! (-> self old-dist-count) (logand (+ (-> self old-dist-count) 1) 15)) + (let ((f0-14 0.0)) + (countdown (v1-38 16) + (+! f0-14 (-> self old-dist v1-38)) + ) + (if (or (and (logtest? (-> self options) (projectile-options proj-options-4)) + (and (logtest? (-> self root-override status) (cshape-moving-flags t-wall)) (< f0-14 2048.0)) + ) + (< f0-14 (-> self stop-speed)) + ) + (go-sitting! self) + ) + ) + (none) + ) + :code (behavior () + (until #f + (spawn-impact-particles self) + (play-impact-sound self (projectile-options lose-altitude proj-options-2)) + (suspend) + ) + #f + (none) + ) + ) + +(defstate impact (projectile) + :virtual #t + :event projectile-event-handler + :enter (behavior () + (spawn-shell-particles self) + (play-impact-sound self (projectile-options lose-altitude)) + (none) + ) + :code (behavior () + (suspend) + (go-virtual die) + (none) + ) + ) + +(defstate dissipate (projectile) + :virtual #t + :event projectile-event-handler + :enter (behavior () + (unknown-particles self) + (play-impact-sound self (projectile-options proj-options-2)) + (none) + ) + :code (behavior () + (suspend) + (go-virtual die) + (none) + ) + ) + +(defstate die (projectile) + :virtual #t + :code (behavior () + (let ((v1-0 (-> self notify-handle))) + (send-event (handle->process v1-0) 'notify 'die) + ) + (process-drawable-method-17 self) + (none) + ) + ) + +(defmethod init-proj-settings! projectile ((obj projectile)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + 0 + (none) + ) + +(defmethod init-collision! projectile ((obj projectile)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-projectile) + (set! (-> s5-0 no-reaction) nothing) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-6 prim-core collide-with) + (collide-spec backgnd crate civilian enemy obstacle vehicle-sphere hit-by-others-list pusher) + ) + (set! (-> v1-6 prim-core action) (collide-action solid)) + (set-vector! (-> v1-6 local-sphere) 0.0 5324.8 0.0 5324.8) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + 0 + (none) + ) + +(defmethod go-moving! projectile ((obj projectile)) + (go (method-of-object obj moving)) + 0 + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod go-sitting! projectile ((obj projectile)) + (if (not (and (-> obj next-state) (= (-> obj next-state name) 'impact))) + (go (method-of-object obj impact)) + ) + (none) + ) + +(defmethod deactivate projectile ((obj projectile)) + (stop-sound! obj) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; WARN: Return type mismatch int vs projectile. +(defbehavior projectile-init-by-other projectile ((arg0 projectile-init-by-other-params)) + (stack-size-set! (-> self main-thread) 512) + (logclear! (-> self mask) (process-mask actor-pause)) + (process-entity-set! self (the-as entity-actor (-> arg0 ent))) + (set! (-> self charge-level) (-> arg0 charge)) + (set! (-> self options) (-> arg0 options)) + (set! (-> self notify-handle) (-> arg0 notify-handle)) + (set! (-> self owner-handle) (-> arg0 owner-handle)) + (set! (-> self ignore-handle) (-> arg0 ignore-handle)) + (set! (-> self attack-id) (-> arg0 attack-id)) + (set! (-> self attack-mode) #f) + (set! (-> self max-speed) 40960.0) + (set! (-> self tween) 1.0) + (set! (-> self last-target) (the-as handle #f)) + (set! (-> self timeout) (the-as time-frame (-> arg0 timeout))) + (set! (-> self max-hits) 1) + (set! (-> self spawn-time) (-> self clock frame-counter)) + (set! (-> self update-velocity) #f) + (set! (-> self move) projectile-move-fill-line-sphere) + (set! (-> self pick-target) #f) + (set! (-> self stop-speed) 204.8) + (set! (-> self damage) 1.0) + (countdown (v1-18 16) + (set! (-> self old-dist v1-18) 4095996000.0) + ) + (logior! (-> self options) (projectile-options proj-options-4)) + (init-collision! self) + (let ((s5-0 (-> self root-override))) + (when (type? s5-0 collide-shape-moving) + (set! (-> self root-override dynam gravity y) 1228800.0) + (set! (-> self root-override dynam gravity-length) 1228800.0) + (set! (-> self root-override dynam gravity-max) 1228800.0) + ) + (set! (-> self mask) (logior (process-mask projectile) (-> self mask))) + (logclear! (-> self mask) (process-mask enemy)) + (set! (-> s5-0 trans quad) (-> arg0 pos quad)) + (set! (-> self starting-pos quad) (-> arg0 pos quad)) + (quaternion-copy! (-> s5-0 quat) (-> (the-as process-drawable (-> self parent 0)) root quat)) + (vector-identity! (-> s5-0 scale)) + (set! (-> s5-0 transv quad) (-> arg0 vel quad)) + (set! (-> self pre-move-transv quad) (-> arg0 vel quad)) + (vector-normalize-copy! (-> self starting-dir) (-> arg0 vel) 1.0) + (vector+float*! (-> self base-target-pos) (-> s5-0 trans) (-> self starting-dir) 2048000.0) + ) + (set! (-> self target-pos quad) (-> self base-target-pos quad)) + (set! (-> self event-hook) projectile-event-handler) + (init-proj-settings! self) + (collide-shape-method-46 (-> self root-override)) + (draw-laser-sight self) + (play-impact-sound self (projectile-options)) + (when (logtest? (-> self options) (projectile-options proj-options-8000)) + (if (made-impact? self) + (go-virtual impact) + ) + ) + (go-moving! self) + (the-as projectile 0) + ) + +(defbehavior projectile-bounce-update-velocity projectile ((arg0 projectile-bounce)) + (set! (-> arg0 root-override transv y) + (- (-> arg0 root-override transv y) (* 184320.0 (-> self clock seconds-per-frame))) + ) + 0 + (none) + ) + +(defbehavior projectile-bounce-falling-post projectile-bounce ((arg0 projectile-bounce)) + (let ((gp-0 (-> self root-override)) + (s4-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (projectile-bounce-update-velocity self) + (set! (-> s5-0 quad) (-> gp-0 trans quad)) + (vector-v++! s5-0 (-> gp-0 transv)) + (when (collide-shape-moving-method-55 + gp-0 + s4-0 + (collide-spec backgnd crate obstacle hit-by-others-list pusher) + 4096.0 + 81920.0 + 1024.0 + ) + (let ((f0-1 (+ (-> gp-0 gspot-pos y) (-> self root-override root-prim local-sphere w)))) + (when (>= f0-1 (-> s5-0 y)) + (set! (-> s5-0 y) f0-1) + (vector-reset! (-> gp-0 transv)) + ) + ) + ) + (collide-shape-method-29 gp-0 s5-0) + ) + (transform-post) + 0 + (none) + ) + +(defstate sitting (projectile-bounce) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior projectile-bounce) + projectile-event-handler + ) + :trans (behavior () + (noop self) + (if (>= (- (-> self clock frame-counter) (-> self spawn-time)) (-> self timeout)) + (go-virtual impact) + ) + (none) + ) + :code (the-as (function none :behavior projectile-bounce) sleep-code) + :post (the-as (function none :behavior projectile-bounce) projectile-bounce-falling-post) + ) + +(defmethod noop projectile-bounce ((obj projectile-bounce)) + "Does nothing" + 0 + (none) + ) + +(defstate dissipate (projectile-bounce) + :virtual #t + :enter (behavior () + (go-virtual impact) + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod go-sitting! projectile-bounce ((obj projectile-bounce)) + (go (method-of-object obj sitting)) + (none) + ) + +(defmethod spawn-impact-particles projectile-bounce ((obj projectile-bounce)) + "Spawns associated particles with the projectile if applicable" + (ja-post) + 0 + (none) + ) + +(defun projectile-bounce-move ((arg0 projectile-bounce)) + (seek-toward-heading-vec! (-> arg0 root-override) (-> arg0 root-override transv) 131072.0 (seconds 0.1)) + (quaternion*! (-> arg0 root-override quat) (-> arg0 root-override quat) (-> arg0 tumble-quat)) + (projectile-move-fill-all-dirs arg0) + (none) + ) + +(defun projectile-bounce-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (cshape-reaction-update-state arg0 arg1 arg3) + (let ((f30-0 (vector-dot arg3 (-> arg0 surface-normal))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! s2-0 (-> arg0 surface-normal) (* f30-0 (rand-vu-float-range 1.6 2.2))) + (vector-! arg2 arg3 s2-0) + ) + (-> arg0 status) + ) + +(defmethod play-impact-sound! projectile-bounce ((obj projectile-bounce)) + "Plays impact sound + :virtual" + (let* ((a2-0 (-> obj root-override)) + (v1-0 (-> a2-0 status)) + ) + (if (logtest? v1-0 (cshape-moving-flags t-surface)) + (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.6) + ) + (when (and (logtest? v1-0 (cshape-moving-flags csmf11)) + (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + ) + (set! (-> obj played-bounce-time) (-> self clock frame-counter)) + (sound-play "dark-shot-bounc") + ) + ) + ) + +(defmethod init-collision! projectile-bounce ((obj projectile-bounce)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) projectile-bounce-reaction) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate jak-dark-shot)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 819.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set-collide-with! + (-> obj root-override) + (collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set-collide-as! (-> obj root-override) (collide-spec projectile)) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (none) + ) + +(defmethod init-proj-settings! projectile-bounce ((obj projectile-bounce)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj max-speed) 450560.0) + (set! (-> obj timeout) (seconds 1.6)) + (set! (-> obj update-velocity) projectile-bounce-update-velocity) + (set! (-> obj move) projectile-bounce-move) + (set! (-> obj root-override dynam gravity y) 184320.0) + (set! (-> obj root-override dynam gravity-length) 184320.0) + (set! (-> obj root-override dynam gravity-max) 184320.0) + (let ((f0-4 1092.2667)) + (quaternion-axis-angle! (-> obj tumble-quat) 1.0 0.0 0.0 f0-4) + ) + 0 + (none) + ) diff --git a/goal_src/jak2/engine/common_objs/water.gc b/goal_src/jak2/engine/common_objs/water.gc index 3dcbe07dd2..9e7e8bcbf3 100644 --- a/goal_src/jak2/engine/common_objs/water.gc +++ b/goal_src/jak2/engine/common_objs/water.gc @@ -27,6 +27,7 @@ (none) ) +;; WARN: Return type mismatch symbol vs none. (defun check-water-level-drop-and-die ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) (sp-kill-particle arg0 arg1) @@ -42,6 +43,7 @@ (none) ) +;; WARN: Return type mismatch symbol vs none. (defun check-water-level-above-and-die ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) (if (or (>= (-> arg2 y) (-> arg1 user-float)) (and *target* (>= (-> arg2 y) (-> *target* water height)))) (sp-kill-particle arg0 arg1) @@ -1018,8 +1020,8 @@ ) (let ((a1-42 (vector-! (new 'stack-no-clear 'vector) v1-260 (-> (the-as control-info s3-3) trans)))) (vector-float*! a1-42 a1-42 (-> pp clock frames-per-second)) + (collide-shape-method-37 s3-3 a1-42) ) - ((method-of-object s3-3 collide-shape-method-37)) (set! (-> (the-as control-info s3-3) status) (logior (-> s3-3 status) (cshape-moving-flags on-surface on-ground t-surface on-water)) ) diff --git a/goal_src/jak2/engine/entity/entity-h.gc b/goal_src/jak2/engine/entity/entity-h.gc index 4e3db83699..6273ac1fed 100644 --- a/goal_src/jak2/engine/entity/entity-h.gc +++ b/goal_src/jak2/engine/entity/entity-h.gc @@ -39,8 +39,9 @@ (define-extern debug-actor (function string none)) (define-extern reset-actors (function symbol none)) +;; NOTE - for projectile +(define-extern process-entity-set! (function process entity-actor entity-actor)) (define-extern process-by-ename (function string process)) - (define-extern entity-birth-no-kill (function entity process)) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/game/fact-h.gc b/goal_src/jak2/engine/game/fact-h.gc index 8bb918b3f5..bfa1e2447f 100644 --- a/goal_src/jak2/engine/game/fact-h.gc +++ b/goal_src/jak2/engine/game/fact-h.gc @@ -213,7 +213,7 @@ :flag-assert #xc00000028 (:methods (new (symbol type process pickup-type float) _type_ 0) - (fact-info-method-9 () none 9) + (drop-pickup (_type_ symbol process-tree fact-info int) (pointer process) 9) (reset! (_type_ symbol) none 10) (pickup-collectable! (_type_ pickup-type float handle) float 11) ) diff --git a/goal_src/jak2/engine/game/game-h.gc b/goal_src/jak2/engine/game/game-h.gc index 4f786cb2be..06f8b45888 100644 --- a/goal_src/jak2/engine/game/game-h.gc +++ b/goal_src/jak2/engine/game/game-h.gc @@ -114,7 +114,7 @@ (initialize-skeleton (_type_ skeleton-group pair) none 14) (initialize-skeleton-by-name (_type_ string) draw-control 15) (apply-alignment (_type_ align-opts transformq vector) object 16) - (process-drawable-method-17 () none 17) + (process-drawable-method-17 (_type_) none 17) (process-drawable-method-18 () none 18) (process-drawable-method-19 () none 19) ) diff --git a/goal_src/jak2/engine/game/task/task-arrow.gc b/goal_src/jak2/engine/game/task/task-arrow.gc index b093c61908..01be98b6ec 100644 --- a/goal_src/jak2/engine/game/task/task-arrow.gc +++ b/goal_src/jak2/engine/game/task/task-arrow.gc @@ -5,5 +5,315 @@ ;; name in dgo: task-arrow ;; dgos: ENGINE, GAME +;; +++task-arrow-flags +(defenum task-arrow-flags + :type uint32 + :bitfield #t + (task-arrow-flag-00 0) + (task-arrow-flag-01 1) + (task-arrow-flag-02 2) + (task-arrow-flag-03 3) + ) +;; ---task-arrow-flags + ;; DECOMP BEGINS +(defskelgroup skel-task-arrow ctywide-arrow 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :texture-level 6 + ) + +(deftype task-arrow-params (structure) + ((flags task-arrow-flags :offset-assert 0) + (map-icon uint16 :offset-assert 4) + (pos vector :inline :offset-assert 16) + (quat quaternion :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + + +(deftype task-arrow (process-drawable) + ((pos vector :inline :offset-assert 208) + (theta float :offset-assert 224) + (phi float :offset-assert 228) + (dist float :offset-assert 232) + (smoothed-dist float :offset-assert 236) + (max-dist float :offset-assert 240) + (flags task-arrow-flags :offset-assert 244) + (map-icon uint16 :offset-assert 248) + (minimap connection-minimap :offset-assert 252) + (hud-dist handle :offset-assert 256) + (base-quat quaternion :inline :offset-assert 272) + (rod-of-god-scale float :offset-assert 288) + (moving symbol :offset-assert 292) + ) + :heap-base #xb0 + :method-count-assert 25 + :size-assert #x128 + :flag-assert #x1900b00128 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + (leave () _type_ :state 22) + (task-arrow-method-23 (_type_ vector) none 23) + (draw-arrow (_type_) none :behavior task-arrow 24) + ) + ) + + +(defmethod deactivate task-arrow ((obj task-arrow)) + (send-event (handle->process (-> obj hud-dist)) 'hide-and-die) + ((method-of-type process-drawable deactivate) obj) + 0 + (none) + ) + +(defmethod task-arrow-method-23 task-arrow ((obj task-arrow) (arg0 vector)) + "Some weird debugging code left here, but checks for collisions on the arrow" + (let ((s5-0 (new 'stack-no-clear 'collide-query-with-vec))) + (set! (-> s5-0 vec quad) (-> arg0 quad)) + (set! (-> s5-0 cquery start-pos quad) (-> s5-0 vec quad)) + (set! (-> s5-0 cquery start-pos y) (+ 20480.0 (-> s5-0 cquery start-pos y))) + (set-vector! (-> s5-0 cquery move-dist) 0.0 -81920.0 0.0 1.0) + (let ((v1-4 (-> s5-0 cquery))) + (set! (-> v1-4 radius) 1024.0) + (set! (-> v1-4 collide-with) (collide-spec backgnd)) + (set! (-> v1-4 ignore-process0) #f) + (set! (-> v1-4 ignore-process1) #f) + (set! (-> v1-4 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-4 action-mask) (collide-action solid)) + ) + (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* (-> s5-0 cquery)))) + (if (>= f0-7 0.0) + (vector+float*! (-> s5-0 vec) (-> s5-0 cquery start-pos) (-> s5-0 cquery move-dist) f0-7) + ) + ) + (set! (-> arg0 quad) (-> s5-0 vec quad)) + ) + 0 + (none) + ) + +(defmethod draw-arrow task-arrow ((obj task-arrow)) + (cond + ((logtest? (-> obj flags) (task-arrow-flags task-arrow-flag-00)) + (if (and (not (handle->process (-> obj hud-dist))) *target*) + (set! (-> obj hud-dist) (ppointer->handle (process-spawn hud-progress :init hud-init-by-other :to *target*))) + ) + (let ((s5-1 (minimap-method-10 *minimap* (-> obj minimap) (the-as minimap-trail #f)))) + (if (and s5-1 (nonzero? (-> s5-1 last-updated))) + (set! (-> obj dist) (minimap-trail-method-9 s5-1 (target-pos 0) (-> obj pos))) + ) + ) + (if (= (-> obj max-dist) 0.0) + (set! (-> obj max-dist) (-> obj dist)) + ) + (let ((f0-4 (- (-> obj dist) (-> obj smoothed-dist)))) + (if (< (fabs f0-4) 40960.0) + (+! (-> obj smoothed-dist) (* 10.0 (-> self clock seconds-per-frame) f0-4)) + (set! (-> obj smoothed-dist) (-> obj dist)) + ) + ) + (let ((f1-5 (/ (-> obj smoothed-dist) (-> obj max-dist)))) + (set! (-> *game-info* distance) (- 1.0 (fmax 0.0 (fmin 1.0 f1-5)))) + ) + ) + (else + (let ((a0-16 (handle->process (-> obj hud-dist)))) + (when a0-16 + (send-event a0-16 'hide-and-die) + (set! (-> obj hud-dist) (the-as handle #f)) + ) + ) + ) + ) + (cond + ((-> obj moving) + (set! (-> obj rod-of-god-scale) (- (-> obj rod-of-god-scale) (* 8.0 (-> self clock seconds-per-frame)))) + (when (< (-> obj rod-of-god-scale) 0.0) + (set! (-> obj rod-of-god-scale) 0.0) + (set! (-> obj moving) #f) + (let ((f0-15 81920.0)) + (cond + ((< (* f0-15 f0-15) (vector-vector-xz-distance-squared (-> obj pos) (-> obj root trans))) + (kill-callback (-> *minimap* engine) (-> obj minimap)) + (set! (-> obj root trans quad) (-> obj pos quad)) + (set! (-> obj minimap) + (minimap-method-12 *minimap* obj (-> obj map-icon) (the-as int #f) (the-as vector #t) 0) + ) + ) + (else + (set! (-> obj root trans quad) (-> obj pos quad)) + ) + ) + ) + ) + ) + (else + (set! (-> obj pos quad) (-> obj root trans quad)) + (+! (-> obj rod-of-god-scale) (* 8.0 (-> self clock seconds-per-frame))) + (if (< 1.0 (-> obj rod-of-god-scale)) + (set! (-> obj rod-of-god-scale) 1.0) + ) + ) + ) + (cond + ((not (logtest? (-> obj flags) (task-arrow-flags task-arrow-flag-02))) + (set! (-> *part-id-table* 267 init-specs 4 initial-valuef) (* 24576.0 (-> obj rod-of-god-scale))) + (set! (-> *part-id-table* 270 init-specs 3 initial-valuef) (* 65536.0 (-> obj rod-of-god-scale))) + (set! (-> *part-id-table* 268 init-specs 9 initial-valuef) (* 20.0 (-> obj rod-of-god-scale))) + (spawn (-> obj part) (-> obj root trans)) + ) + (else + (+! (-> obj theta) (* 32768.0 (-> self clock seconds-per-frame))) + (+! (-> obj phi) (* 9102.223 (-> self clock seconds-per-frame))) + (set! (-> obj root trans quad) (-> obj pos quad)) + (set! (-> obj root trans y) (+ 28672.0 (* 4096.0 (cos (-> obj theta))) (-> obj pos y))) + ) + ) + (when (logtest? (-> obj flags) (task-arrow-flags task-arrow-flag-01)) + (quaternion-axis-angle! (-> obj root quat) 0.0 1.0 0.0 (-> obj phi)) + (quaternion-normalize! (quaternion*! (-> obj root quat) (-> obj base-quat) (-> obj root quat))) + ) + (ja-post) + 0 + (none) + ) + +(defstate idle (task-arrow) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (v0-2 object)) + (case event-type + (('set-position) + (let ((a0-3 (the-as object (-> event param 0)))) + (set! (-> self pos quad) (-> (the-as vector a0-3) quad)) + ) + (if (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-03)) + (task-arrow-method-23 self (-> self pos)) + ) + (let ((f0-0 4096.0)) + (when (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> self pos) (-> self root trans))) + (set! v0-2 #t) + (set! (-> self moving) (the-as symbol v0-2)) + v0-2 + ) + ) + ) + (('leave) + (if (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-02)) + (go-virtual die) + (go-virtual leave) + ) + ) + (('modify-flags) + (let ((v1-16 (-> event param 0)) + (a1-3 (-> event param 1)) + ) + (set! v0-2 (logior (logclear (-> self flags) a1-3) v1-16)) + ) + (set! (-> self flags) (the-as task-arrow-flags v0-2)) + v0-2 + ) + (('map-icon) + (kill-callback (-> *minimap* engine) (-> self minimap)) + (let ((a2-1 (-> event param 0))) + (set! (-> self map-icon) a2-1) + (set! v0-2 (minimap-method-12 *minimap* self a2-1 (the-as int #f) (the-as vector #t) 0)) + ) + (set! (-> self minimap) (the-as connection-minimap v0-2)) + v0-2 + ) + (('die) + (go-virtual die) + ) + ) + ) + :code (the-as (function none :behavior task-arrow) sleep-code) + :post (behavior () + (draw-arrow self) + (none) + ) + ) + +(defstate leave (task-arrow) + :virtual #t + :code (behavior () + (set! (-> self moving) #t) + (while (-> self moving) + (suspend) + ) + (process-drawable-method-17 self) + (none) + ) + :post (behavior () + (draw-arrow self) + (none) + ) + ) + +(defstate die (task-arrow) + :virtual #t + :code (behavior () + (process-drawable-method-17 self) + (none) + ) + ) + +;; WARN: Return type mismatch object vs task-arrow. +(defbehavior task-arrow-init-by-other task-arrow ((arg0 task-arrow-params)) + (set! (-> self flags) (-> arg0 flags)) + (set! (-> self map-icon) (-> arg0 map-icon)) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self pos quad) (-> arg0 pos quad)) + (if (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-03)) + (task-arrow-method-23 self (-> self pos)) + ) + (set! (-> self root trans quad) (-> self pos quad)) + (quaternion-copy! (-> self root quat) (-> arg0 quat)) + (quaternion-copy! (-> self base-quat) (-> arg0 quat)) + (set-vector! (-> self root scale) 1.0 1.0 1.0 1.0) + (set! (-> self hud-dist) (the-as handle #f)) + (set! (-> self max-dist) 0.0) + (set! (-> self theta) 0.0) + (set! (-> self phi) 0.0) + (set! (-> self minimap) + (minimap-method-12 *minimap* self (-> arg0 map-icon) (the-as int #f) (the-as vector #t) 0) + ) + (cond + ((not (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-02))) + (set! (-> self part) (create-launch-control (-> *part-group-id-table* 78) self)) + ) + (else + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-task-arrow" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self draw lod-set lod 0 dist) 1228800.0) + (set-vector! (-> self draw color-mult) 0.5 0.5 0.0 1.0) + (set-vector! (-> self draw color-emissive) 0.5 0.5 0.0 1.0) + ) + ) + (set! (-> self rod-of-god-scale) 0.0) + (set! (-> self moving) #f) + (logclear! (-> self mask) (process-mask actor-pause movie)) + (process-entity-status! self (entity-perm-status no-kill) #t) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (the-as task-arrow (go-virtual idle)) + ) + +(defun task-arrow-spawn ((arg0 task-arrow-params) (arg1 task-arrow)) + (let ((gp-0 (the-as process #f))) + (let ((v1-1 (process-spawn task-arrow arg0 :to arg1))) + (if v1-1 + (set! gp-0 (-> v1-1 0)) + ) + ) + gp-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 d26cff86b8..fe4367bd5e 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc @@ -54,6 +54,9 @@ (define-extern kill-all-particles-with-key (function sparticle-launch-control none)) (define-extern sp-kill-particle (function sparticle-system sparticle-cpuinfo symbol)) +;; NOTE - for gun-blue-shot +(define-extern draw-beam (function sparticle-launcher vector vector symbol symbol none)) + ;; DECOMP BEGINS (define *sp-60-hz* #t) diff --git a/goal_src/jak2/engine/physics/trajectory.gc b/goal_src/jak2/engine/physics/trajectory.gc index 1029cc9d34..add62fb7c1 100644 --- a/goal_src/jak2/engine/physics/trajectory.gc +++ b/goal_src/jak2/engine/physics/trajectory.gc @@ -162,7 +162,7 @@ ) (set! (-> a0-6 radius) (-> obj radius)) (set! (-> a0-6 collide-with) (-> obj collide-with)) - (set! (-> a0-6 ignore-process0) (the-as process v1-2)) + (set! (-> a0-6 ignore-process0) v1-2) (set! (-> a0-6 ignore-process1) #f) (set! (-> a0-6 ignore-pat) arg2) (set! (-> a0-6 action-mask) (collide-action solid)) diff --git a/goal_src/jak2/engine/process-drawable/process-drawable-h.gc b/goal_src/jak2/engine/process-drawable/process-drawable-h.gc index c6e4a96437..adc256a5c3 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable-h.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable-h.gc @@ -25,7 +25,9 @@ ;; NOTE - for base-plat (define-extern rider-post (function none :behavior process-drawable)) ;; NOTE - for fma-sphere -(define-extern sleep-code (function symbol)) +(define-extern sleep-code (function symbol :behavior process-drawable)) + +(define-extern ja-post (function none :behavior process-drawable)) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/sound/gsound-h.gc b/goal_src/jak2/engine/sound/gsound-h.gc index a06009e713..e35027639e 100644 --- a/goal_src/jak2/engine/sound/gsound-h.gc +++ b/goal_src/jak2/engine/sound/gsound-h.gc @@ -130,6 +130,12 @@ ) ) +(defmacro sound-play (name &key (id (new-sound-id)) + &key (vol 100.0) &key (pitch 0) &key (bend 0) + &key (group sfx) + &key (position #t)) + `(sound-play-by-name (static-sound-name ,name) ,id (the int (* (/ 1024.0 100.0) ,vol)) (the int (* 1524.0 ,pitch)) ,bend (sound-group ,group) ,position)) + (defmacro sound-vol (vol) "convert to sound volume units" (if (number? vol) @@ -164,6 +170,17 @@ )) ) +(declare-type sound-name uint128) +(define-extern string->sound-name (function string sound-name)) +(define-extern get-sound-buffer-entry (function pointer)) +(define-extern sound-set-ear-trans (function vector vector vector float int)) +(define-extern ear-trans (function int vector)) + +;; ghost function +(define-extern *debug-effect-control* symbol) +(declare-type sound-spec basic) +(define-extern effect-param->sound-spec (function sound-spec (pointer float) int sound-spec)) + ;; DECOMP BEGINS (deftype sound-stream-name (structure) @@ -175,6 +192,7 @@ :flag-assert #x900000030 ) + (deftype sound-id (uint32) () :method-count-assert 10 @@ -210,6 +228,7 @@ :flag-assert #x900000004 ) + (deftype sound-play-params (structure) ((mask uint16 :offset-assert 0) (pitch-mod int16 :offset-assert 2) @@ -230,6 +249,7 @@ :flag-assert #x900000020 ) + (deftype sound-rpc-bank-cmd (sound-rpc-cmd) ((bank-name sound-name :offset-assert 16) ) @@ -238,6 +258,7 @@ :flag-assert #x900000020 ) + (deftype sound-rpc-test-cmd (sound-rpc-cmd) ((ee-addr pointer :offset-assert 4) (param0 uint16 :offset-assert 8) @@ -247,6 +268,7 @@ :flag-assert #x90000000a ) + (deftype sound-rpc-sound-cmd (sound-rpc-cmd) ((id sound-id :offset-assert 4) ) @@ -255,6 +277,7 @@ :flag-assert #x900000008 ) + (deftype sound-rpc-group-cmd (sound-rpc-cmd) ((group sound-group :offset-assert 4) ) @@ -263,6 +286,7 @@ :flag-assert #x900000005 ) + (deftype sound-rpc-load-bank (sound-rpc-bank-cmd) ((ee-addr pointer :offset-assert 32) ) @@ -271,6 +295,7 @@ :flag-assert #x900000024 ) + (deftype sound-rpc-load-music (sound-rpc-bank-cmd) () :method-count-assert 9 @@ -278,6 +303,7 @@ :flag-assert #x900000020 ) + (deftype sound-rpc-unload-bank (sound-rpc-bank-cmd) () :method-count-assert 9 @@ -285,6 +311,7 @@ :flag-assert #x900000020 ) + (deftype sound-rpc-play (sound-rpc-sound-cmd) ((name sound-name :offset-assert 16) (params sound-play-params :inline :offset-assert 32) @@ -294,6 +321,7 @@ :flag-assert #x900000040 ) + (deftype sound-rpc-pause-sound (sound-rpc-sound-cmd) () :method-count-assert 9 @@ -301,6 +329,7 @@ :flag-assert #x900000008 ) + (deftype sound-rpc-stop-sound (sound-rpc-sound-cmd) () :method-count-assert 9 @@ -308,6 +337,7 @@ :flag-assert #x900000008 ) + (deftype sound-rpc-continue-sound (sound-rpc-sound-cmd) () :method-count-assert 9 @@ -315,6 +345,7 @@ :flag-assert #x900000008 ) + (deftype sound-rpc-set-param (sound-rpc-sound-cmd) ((params sound-play-params :inline :offset-assert 8) (auto-time int32 :offset-assert 40) @@ -325,6 +356,7 @@ :flag-assert #x900000030 ) + (deftype sound-rpc-set-master-volume (sound-rpc-group-cmd) ((volume int32 :offset-assert 8) ) @@ -333,6 +365,7 @@ :flag-assert #x90000000c ) + (deftype sound-rpc-pause-group (sound-rpc-group-cmd) () :method-count-assert 9 @@ -340,6 +373,7 @@ :flag-assert #x900000005 ) + (deftype sound-rpc-stop-group (sound-rpc-group-cmd) () :method-count-assert 9 @@ -347,6 +381,7 @@ :flag-assert #x900000005 ) + (deftype sound-rpc-continue-group (sound-rpc-group-cmd) () :method-count-assert 9 @@ -354,6 +389,7 @@ :flag-assert #x900000005 ) + (deftype sound-rpc-get-irx-version (sound-rpc-cmd) ((major uint32 :offset-assert 4) (minor uint32 :offset-assert 8) @@ -364,6 +400,7 @@ :flag-assert #x900000010 ) + (deftype sound-rpc-set-language (sound-rpc-cmd) ((lang uint32 :offset-assert 4) ) @@ -372,6 +409,7 @@ :flag-assert #x900000008 ) + (deftype sound-rpc-set-stereo-mode (sound-rpc-cmd) ((mode int32 :offset-assert 4) ) @@ -380,6 +418,7 @@ :flag-assert #x900000008 ) + (deftype sound-rpc-set-reverb (sound-rpc-cmd) ((core uint8 :offset-assert 4) (reverb int32 :offset-assert 8) @@ -391,6 +430,7 @@ :flag-assert #x900000014 ) + (deftype sound-rpc-set-ear-trans (sound-rpc-cmd) ((ear-trans1 int32 3 :offset-assert 4) (ear-trans0 int32 3 :offset-assert 16) @@ -402,6 +442,7 @@ :flag-assert #x90000002c ) + (deftype sound-rpc-set-flava (sound-rpc-cmd) ((flava uint8 :offset-assert 4) (excitement uint8 :offset-assert 5) @@ -411,6 +452,7 @@ :flag-assert #x900000006 ) + (deftype sound-rpc-set-midi-reg (sound-rpc-cmd) ((reg int32 :offset-assert 4) (value int16 :offset-assert 8) @@ -420,6 +462,7 @@ :flag-assert #x90000000a ) + (deftype sound-rpc-shutdown (sound-rpc-cmd) () :method-count-assert 9 @@ -427,6 +470,7 @@ :flag-assert #x900000004 ) + (deftype sound-rpc-set-fps (sound-rpc-cmd) ((fps uint8 :offset-assert 4) ) @@ -435,6 +479,7 @@ :flag-assert #x900000005 ) + (deftype sound-rpc-list-sounds (sound-rpc-cmd) () :method-count-assert 9 @@ -442,6 +487,7 @@ :flag-assert #x900000004 ) + (deftype sound-rpc-unload-music (sound-rpc-cmd) () :method-count-assert 9 @@ -449,6 +495,7 @@ :flag-assert #x900000004 ) + (deftype sound-rpc-union (structure) ((data uint32 20 :offset-assert 0) (load-bank sound-rpc-load-bank :offset 0) @@ -478,6 +525,7 @@ :flag-assert #x900000050 ) + (deftype sound-spec (basic) ((mask sound-mask :offset-assert 4) (num float :offset-assert 8) @@ -501,6 +549,8 @@ :size-assert #x4c :flag-assert #x90000004c ) + + (define *current-sound-id* (the-as sound-id #x10000)) (deftype ambient-sound (basic) @@ -535,15 +585,3 @@ (stop! (_type_) int 15) ) ) - - - -;; DECOMP ENDS -(define-extern string->sound-name (function string sound-name)) -(define-extern get-sound-buffer-entry (function pointer)) -(define-extern sound-set-ear-trans (function vector vector vector float int)) -(define-extern ear-trans (function int vector)) - -;; ghost function -(define-extern *debug-effect-control* symbol) -(define-extern effect-param->sound-spec (function sound-spec (pointer float) int sound-spec)) diff --git a/goal_src/jak2/engine/spatial-hash/actor-hash-h.gc b/goal_src/jak2/engine/spatial-hash/actor-hash-h.gc index a1a5462728..079be4cf2f 100644 --- a/goal_src/jak2/engine/spatial-hash/actor-hash-h.gc +++ b/goal_src/jak2/engine/spatial-hash/actor-hash-h.gc @@ -9,6 +9,8 @@ (define-extern *actor-hash* spatial-hash) (define-extern update-actor-hash (function none)) +(define-extern *actor-hash* spatial-hash) + ;; DECOMP BEGINS (define *actor-list* (the-as (pointer collide-shape) (malloc 'global 1024))) diff --git a/goal_src/jak2/engine/spatial-hash/spatial-hash-h.gc b/goal_src/jak2/engine/spatial-hash/spatial-hash-h.gc index 94e70623c7..ea975ec1f7 100644 --- a/goal_src/jak2/engine/spatial-hash/spatial-hash-h.gc +++ b/goal_src/jak2/engine/spatial-hash/spatial-hash-h.gc @@ -5,6 +5,8 @@ ;; name in dgo: spatial-hash-h ;; dgos: ENGINE, GAME +(declare-type grid-hash-work basic) + ;; DECOMP BEGINS (deftype grid-hash-word (uint8) @@ -15,8 +17,8 @@ ) (deftype grid-hash-box (structure) - ((min uint8 3 :offset-assert 0) - (max uint8 3 :offset-assert 3) + ((min int8 3 :offset-assert 0) + (max int8 3 :offset-assert 3) ) :pack-me :method-count-assert 9 @@ -26,44 +28,45 @@ (deftype grid-hash (basic) - ((work basic :offset-assert 4) - (search-box grid-hash-box :inline :offset-assert 8) - (bucket-size int16 :offset-assert 14) - (axis-scale uint32 3 :offset-assert 16) - (dimension-array uint8 3 :offset-assert 28) - (vertical-cell-count int8 :offset-assert 31) - (bucket-array uint32 :offset-assert 32) - (box-min uint32 3 :offset-assert 36) - (box-max uint32 3 :offset-assert 48) - (object-count int16 :offset-assert 60) - (bucket-count int16 :offset-assert 62) - (min-cell-size float :offset-assert 64) - (bucket-memory-size int32 :offset-assert 68) - (mem-bucket-array uint32 :offset-assert 72) - (spr-bucket-array uint32 :offset-assert 76) - (debug-draw basic :offset-assert 80) - (use-scratch-ram basic :offset-assert 84) + ((work grid-hash-work :offset-assert 4) + (search-box grid-hash-box :inline :offset-assert 8) + (bucket-size int16 :offset-assert 14) + (axis-scale uint32 3 :offset-assert 16) + (dimension-array int8 3 :offset-assert 28) + (vertical-cell-count int8 :offset-assert 31) + (bucket-array (pointer grid-hash-word) :offset-assert 32) + (box-min float 3 :offset-assert 36) + (box-max float 3 :offset-assert 48) + (object-count int16 :offset-assert 60) + (bucket-count int16 :offset-assert 62) + (min-cell-size float :offset-assert 64) + (bucket-memory-size int32 :offset-assert 68) + (mem-bucket-array (pointer grid-hash-word) :offset-assert 72) + (spr-bucket-array (pointer grid-hash-word) :offset-assert 76) + (debug-draw symbol :offset-assert 80) + (use-scratch-ram symbol :offset-assert 84) ) :method-count-assert 25 :size-assert #x58 :flag-assert #x1900000058 (:methods - (grid-hash-method-9 () none 9) - (grid-hash-method-10 () none 10) - (grid-hash-method-11 () none 11) - (grid-hash-method-12 () none 12) - (grid-hash-method-13 () none 13) - (grid-hash-method-14 () none 14) - (grid-hash-method-15 () none 15) - (grid-hash-method-16 () none 16) - (grid-hash-method-17 () none 17) - (grid-hash-method-18 () none 18) - (grid-hash-method-19 () none 19) - (grid-hash-method-20 () none 20) - (grid-hash-method-21 () none 21) - (grid-hash-method-22 () none 22) - (grid-hash-method-23 () none 23) - (grid-hash-method-24 () none 24) + (new (symbol type process int) _type_ 0) + (grid-hash-method-9 (_type_ int (array float) int) none 9) + (grid-hash-method-10 (_type_) none 10) + (grid-hash-method-11 (_type_) none 11) + (grid-hash-method-12 (_type_) none 12) + (grid-hash-method-13 (_type_) none 13) + (draw-grid (_type_ rgba) none 14) + (dump-grid-info (_type_) none 15) + (grid-hash-method-16 (_type_ grid-hash-box grid-hash-box) none 16) + (grid-hash-method-17 (_type_) none 17) + (grid-hash-method-18 (_type_ grid-hash-box int) none 18) + (grid-hash-method-19 (_type_ grid-hash-box int) none 19) + (grid-hash-method-20 (_type_ grid-hash-box (pointer uint8)) none 20) + (grid-hash-method-21 (_type_ float int int) none 21) + (grid-hash-method-22 (_type_ grid-hash-box sphere) none 22) + (grid-hash-method-23 (_type_ grid-hash-box vector vector float) none 23) + (update-grid (_type_) none 24) ) ) @@ -93,15 +96,15 @@ :size-assert #x68 :flag-assert #x2200000068 (:methods - (sphere-hash-method-25 () none 25) - (sphere-hash-method-26 () none 26) - (sphere-hash-method-27 () none 27) - (sphere-hash-method-28 () none 28) - (sphere-hash-method-29 () none 29) + (clear-objects! (_type_) none 25) + (sphere-hash-method-26 (_type_ vector) none 26) + (sphere-hash-method-27 (_type_) none 27) + (sphere-hash-method-28 (_type_) none 28) + (sphere-hash-method-29 (_type_ find-nav-sphere-ids-params int int int) none 29) (sphere-hash-method-30 (_type_ find-nav-sphere-ids-params) none 30) - (sphere-hash-method-31 () none 31) - (sphere-hash-method-32 () none 32) - (sphere-hash-method-33 () none 33) + (sphere-hash-method-31 (_type_ vector int int) none 31) + (sphere-hash-method-32 (_type_ vector vector float int) symbol 32) + (sphere-hash-method-33 (_type_ object int) none 33) ) ) @@ -116,20 +119,20 @@ (deftype spatial-hash (sphere-hash) - ((object-array uint32 :offset-assert 104) - (mem-object-array uint32 :offset-assert 108) - (spr-object-array uint32 :offset-assert 112) + ((object-array (pointer hash-object-info) :offset-assert 104) + (mem-object-array (pointer hash-object-info) :offset-assert 108) + (spr-object-array (pointer hash-object-info) :offset-assert 112) ) :method-count-assert 41 :size-assert #x74 :flag-assert #x2900000074 (:methods - (spatial-hash-method-34 () none 34) - (spatial-hash-method-35 () none 35) + (spatial-hash-method-34 (_type_ vector hash-object-info) int 34) + (spatial-hash-method-35 (_type_) none 35) (spatial-hash-method-36 (_type_ sphere (pointer collide-shape) int) int 36) - (spatial-hash-method-37 () none 37) - (spatial-hash-method-38 () none 38) - (spatial-hash-method-39 () none 39) - (spatial-hash-method-40 () none 40) + (spatial-hash-method-37 (_type_) none 37) + (spatial-hash-method-38 (_type_) none 38) + (spatial-hash-method-39 (_type_ object hash-object-info) none 39) + (spatial-hash-method-40 (_type_) none 40) ) ) diff --git a/goal_src/jak2/engine/target/board/board-util.gc b/goal_src/jak2/engine/target/board/board-util.gc index e93d44d1e8..24af57b104 100644 --- a/goal_src/jak2/engine/target/board/board-util.gc +++ b/goal_src/jak2/engine/target/board/board-util.gc @@ -9,7 +9,6 @@ (define-extern ja-channel-set! (function int int :behavior process-drawable)) (define-extern ja-channel-push! (function int time-frame int :behavior process-drawable)) (define-extern ja-done? (function int symbol :behavior process-drawable)) -(define-extern sleep-code (function symbol)) (define-extern *target-shadow-control* shadow-control) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/target/gun/gun-blue-shot.gc b/goal_src/jak2/engine/target/gun/gun-blue-shot.gc index 68f4114ac7..b017e5081a 100644 --- a/goal_src/jak2/engine/target/gun/gun-blue-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-blue-shot.gc @@ -6,4 +6,3 @@ ;; dgos: ENGINE, GAME ;; DECOMP BEGINS - diff --git a/goal_src/jak2/engine/target/gun/gun-h.gc b/goal_src/jak2/engine/target/gun/gun-h.gc index 7db083af49..6b868621c9 100644 --- a/goal_src/jak2/engine/target/gun/gun-h.gc +++ b/goal_src/jak2/engine/target/gun/gun-h.gc @@ -9,6 +9,10 @@ (define-extern can-exit-duck? (function target symbol)) (define-extern target-collide-set! (function symbol float int :behavior target)) +(declare-type gun-blue-shot projectile) +(declare-type gun-yellow-shot projectile) +(declare-type gun-red-shot process-drawable) + ;; DECOMP BEGINS (deftype gun (process-drawable) diff --git a/goal_src/jak2/engine/target/gun/gun-red-shot.gc b/goal_src/jak2/engine/target/gun/gun-red-shot.gc index 046ebb16c5..ed9b666f4f 100644 --- a/goal_src/jak2/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-red-shot.gc @@ -5,5 +5,7 @@ ;; name in dgo: gun-red-shot ;; dgos: ENGINE, GAME -;; DECOMP BEGINS +(declare-type gun-red-shot process-drawable) +(define-extern gun-red-shot-init-by-other (function vector vector gun-red-shot :behavior gun-red-shot)) +;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc b/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc index eb45c6e5b5..a8d6662508 100644 --- a/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc +++ b/goal_src/jak2/engine/target/gun/gun-yellow-shot.gc @@ -6,4 +6,3 @@ ;; dgos: ENGINE, GAME ;; DECOMP BEGINS - diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index 7a40f05a0e..d008f668cc 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -821,7 +821,7 @@ gp-1 (meters 0.2) "target" - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) ) ) @@ -1055,7 +1055,7 @@ gp-1 (meters 0.2) "ltransv" - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ff00) 0)) + (new 'static 'rgba :g #xff :a #x80) ) (set! (-> gp-1 quad) (-> self control unknwon-vector27 quad)) (vector-float*! gp-1 gp-1 0.5) @@ -1066,7 +1066,7 @@ gp-1 (meters 0.2) "btransv" - (the-as rgba (-> (new 'static 'array uint64 1 #x80ffffff) 0)) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) ) ) ) @@ -1075,12 +1075,7 @@ (let ((s5-0 (new-stack-vector0)) (gp-0 (new-stack-vector0)) ) - (let* ((a0-0 (-> self control)) - (t9-0 (method-of-object a0-0 collide-shape-moving-method-62)) - ) - (-> self control unknown-surface01 slip-factor) - (t9-0 a0-0) - ) + (compute-acc-due-to-gravity (-> self control) s5-0 (-> self control unknown-surface01 slip-factor)) (vector-matrix*! gp-0 s5-0 (-> self control unknown-matrix00)) (vector-v++! (-> self control unknown-vector00) gp-0) ) @@ -1221,7 +1216,7 @@ (-> self control trans) gp-0 (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -1229,7 +1224,7 @@ (-> self control trans) s5-0 (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x800080ff) 0)) + (new 'static 'rgba :r #xff :g #x80 :a #x80) ) ) (add-debug-vector @@ -1238,7 +1233,7 @@ (-> self control trans) (-> self control unknown-matrix01 vector 2) (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) (rotate-toward-orientation! (-> self control) @@ -2011,7 +2006,7 @@ (-> self control trans) (-> self control local-normal) (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) + (new 'static 'rgba :r #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -2019,7 +2014,7 @@ (-> self control trans) (-> self control unknown-dynamics00 gravity-normal) (meters 2.5) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) + (new 'static 'rgba :r #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -2027,7 +2022,7 @@ (-> self control trans) (-> self control dynam gravity-normal) (meters 3) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -2035,7 +2030,7 @@ (-> self control trans) (-> self control unknown-vector02) (meters 3) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -2043,7 +2038,7 @@ (-> self control trans) (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control unknown-quaternion00)) (meters 3) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) + (new 'static 'rgba :r #xff :a #x80) ) ) @@ -2302,29 +2297,17 @@ (-> (the-as swingpole s2-0) root trans) (-> (the-as swingpole s2-0) dir) (meters 3) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) (add-debug-sphere #t (bucket-id debug2) (-> self control unknown-vector30) (meters 0.2) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) - ) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - s4-1 - (meters 0.2) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ff00) 0)) - ) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - s3-1 - (meters 0.2) - (the-as rgba (-> (new 'static 'array uint64 1 #x8040ff00) 0)) + (new 'static 'rgba :r #xff :a #x80) ) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) s4-1 (meters 0.2) (new 'static 'rgba :g #xff :a #x80)) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) s3-1 (meters 0.2) (new 'static 'rgba :g #xff :b #x40 :a #x80)) (add-debug-sphere #t (bucket-id debug-no-zbuf1) s5-0 (meters 0.2) (new 'static 'rgba :b #xff :a #x80)) ) ) @@ -3295,15 +3278,7 @@ (set! (-> obj draw shadow-ctrl) *target-shadow-control*) (set! (-> obj shadow-backup) (-> obj draw shadow)) (set! (-> obj carry) - (new - 'process - 'carry-info - obj - 41 - (the-as vector (new 'static 'array float 1 0.0)) - (the-as vector (new 'static 'array float 1 0.0)) - 12743.111 - ) + (new 'process 'carry-info obj 41 (new 'static 'vector :w 1.0) (new 'static 'vector :z 1.0 :w 1.0) 12743.111) ) (set! (-> obj control unknown-vector29 x) (the-as float (-> obj node-list data 45))) (set! (-> obj control unknown-vector29 y) (the-as float (-> obj node-list data 55))) diff --git a/goal_src/jak2/engine/target/mech_suit/carry-h.gc b/goal_src/jak2/engine/target/mech_suit/carry-h.gc index f802531e02..69b8227d60 100644 --- a/goal_src/jak2/engine/target/mech_suit/carry-h.gc +++ b/goal_src/jak2/engine/target/mech_suit/carry-h.gc @@ -5,9 +5,10 @@ ;; name in dgo: carry-h ;; dgos: ENGINE, GAME +;; +++carry-mode (defenum carry-mode - :bitfield #t :type uint8 + :bitfield #t (carry 0) (mech-carry 1) (mech-drag 2) @@ -17,44 +18,570 @@ (cm6) (cm7) ) +;; ---carry-mode ;; DECOMP BEGINS (deftype carry-info (basic) - ((process (pointer process-drawable) :offset-assert 4) - (pickup-time time-frame :offset-assert 8) - (other-value float :offset-assert 16) - (other handle :offset-assert 24) - (point vector :inline :offset-assert 32) - (normal vector :inline :offset-assert 48) - (max-angle degrees :offset-assert 64) - (max-distance meters :offset-assert 68) - (max-pull meters :offset-assert 72) - (min-pull meters :offset-assert 76) - (grab-trans-blend float :offset-assert 80) - (carry-radius meters :offset-assert 84) - (backup-radius meters :offset-assert 88) - (joint int8 :offset-assert 92) - (mode carry-mode :offset-assert 93) - (face-dir int8 :offset-assert 94) - (local-point vector :inline :offset-assert 96) - (local-normal vector :inline :offset-assert 112) - (grab-quat vector :inline :offset-assert 128) - (grab-trans vector :inline :offset-assert 144) - (hold-trans vector :inline :offset-assert 160) + ((process (pointer target) :offset-assert 4) + (pickup-time time-frame :offset-assert 8) + (other-value float :offset-assert 16) + (other handle :offset-assert 24) + (point vector :inline :offset-assert 32) + (normal vector :inline :offset-assert 48) + (max-angle degrees :offset-assert 64) + (max-distance meters :offset-assert 68) + (max-pull meters :offset-assert 72) + (min-pull meters :offset-assert 76) + (grab-trans-blend float :offset-assert 80) + (carry-radius meters :offset-assert 84) + (backup-radius meters :offset-assert 88) + (joint int8 :offset-assert 92) + (mode carry-mode :offset-assert 93) + (face-dir int8 :offset-assert 94) + (local-point vector :inline :offset-assert 96) + (local-normal vector :inline :offset-assert 112) + (grab-quat quaternion :inline :offset-assert 128) + (grab-trans vector :inline :offset-assert 144) + (hold-trans vector :inline :offset-assert 160) ) :method-count-assert 17 :size-assert #xb0 :flag-assert #x11000000b0 (:methods (new (symbol type process-drawable int vector vector float) _type_ 0) - (carry-info-method-9 (_type_) int 9) - (carry-info-method-10 () none 10) - (carry-info-method-11 () none 11) - (carry-info-method-12 (_type_) none 12) - (carry-info-method-13 (_type_) none 13) - (carry-info-method-14 () none 14) - (carry-info-method-15 (_type_) none 15) - (carry-info-method-16 () none 16) + (carry-info-method-9 (_type_) none 9) + (distance-from-destination (_type_ carry-info) float 10) + (drag! (_type_ carry-info) none 11) + (drop-impl! (_type_ carry-info) none 12) + (carry-info-method-13 (_type_) symbol :behavior process-drawable 13) + (carry! (_type_ carry-info vector vector) none 14) + (drop! (_type_ carry-info) none 15) + (translate! (_type_) symbol :behavior process-drawable 16) ) - ) \ No newline at end of file + ) + + +(defmethod new carry-info ((allocation symbol) + (type-to-make type) + (arg0 process-drawable) + (arg1 int) + (arg2 vector) + (arg3 vector) + (arg4 float) + ) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 mode) (carry-mode carry)) + (set! (-> gp-0 process) (the-as (pointer target) (process->ppointer arg0))) + (set! (-> gp-0 other) (the-as handle #f)) + (set! (-> gp-0 joint) arg1) + (set! arg4 (cond + ((= arg4 0.0) + 131072.0 + ) + (else + (empty) + arg4 + ) + ) + ) + (set! (-> gp-0 max-angle) arg4) + (set! (-> gp-0 max-distance) 8192.0) + (set! (-> gp-0 local-point quad) (-> arg2 quad)) + (set! (-> gp-0 local-normal quad) (-> arg3 quad)) + (let* ((s5-1 (-> arg0 root)) + (v1-7 (if (type? s5-1 collide-shape) + (the-as collide-shape s5-1) + ) + ) + ) + (when v1-7 + (set! (-> gp-0 backup-radius) (-> v1-7 root-prim local-sphere w)) + (set! (-> gp-0 carry-radius) (-> v1-7 root-prim local-sphere w)) + ) + ) + gp-0 + ) + ) + +(defmethod carry-info-method-9 carry-info ((obj carry-info)) + (let ((s5-0 (-> obj process 0 node-list data (-> obj joint) bone transform))) + (vector-rotate*! (-> obj normal) (-> obj local-normal) s5-0) + (vector-matrix*! (-> obj point) (-> obj local-point) s5-0) + ) + 0 + (none) + ) + +(defmethod distance-from-destination carry-info ((obj carry-info) (arg0 carry-info)) + "Returns the distance from the current `point` and the provided [[carry-info]]'s `point`. + Returns `-1.0` if it exceeds the maximum allowed" + (let* ((f28-0 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) (-> arg0 point) (-> obj point)))) + (f30-0 (fabs (deg-diff f28-0 (vector-y-angle (-> obj normal))))) + (f28-1 (fabs (deg-diff (+ 32768.0 f28-0) (vector-y-angle (-> arg0 normal))))) + (f26-0 (vector-vector-distance (-> obj point) (-> arg0 point))) + ) + (cond + ((or (< (-> obj max-distance) f26-0) + (< (-> arg0 max-distance) f26-0) + (< (-> obj max-angle) f30-0) + (or (< (-> arg0 max-angle) f28-1) (zero? (logand (-> obj mode) (-> arg0 mode)))) + ) + (if (< (-> obj max-distance) f26-0) + (format + #t + " ~A ~A failed for this distance ~M ~M~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + f26-0 + (-> obj max-distance) + ) + ) + (if (< (-> arg0 max-distance) f26-0) + (format + #t + " ~A ~A failed for other distance ~M ~M~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + f26-0 + (-> arg0 max-distance) + ) + ) + (if (< (-> obj max-angle) f30-0) + (format + #t + " ~A ~A failed for this angle ~R ~R~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + f30-0 + (-> obj max-angle) + ) + ) + (if (< (-> arg0 max-angle) f28-1) + (format + #t + " ~A ~A failed for other angle ~R ~R~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + f28-1 + (-> arg0 max-angle) + ) + ) + (if (not (logtest? (-> obj mode) (-> arg0 mode))) + (format + #t + " ~A ~A failed for mode ~X ~X~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + (-> obj mode) + (-> arg0 mode) + ) + ) + -1.0 + ) + (else + (+ f26-0 (* 409.6 (- 32768.0 f30-0))) + ) + ) + ) + ) + +(defmethod drag! carry-info ((obj carry-info) (arg0 carry-info)) + (let ((v1-0 (-> arg0 process))) + (set! (-> obj other) (the-as handle (logior (if v1-0 + (new 'static 'handle :pid (-> v1-0 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-0) + ) + ) + ) + ) + (let ((v1-3 (-> obj process))) + (set! (-> arg0 other) (the-as handle (logior (if v1-3 + (new 'static 'handle :pid (-> v1-3 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-3) + ) + ) + ) + ) + (set! (-> obj pickup-time) (-> obj process 0 clock frame-counter)) + (set! (-> arg0 pickup-time) (-> arg0 process 0 clock frame-counter)) + (set! (-> arg0 grab-trans-blend) 1.0) + (let* ((s4-0 (the-as collide-shape (-> arg0 process 0 control))) + (v1-17 (if (type? (the-as control-info s4-0) collide-shape) + s4-0 + ) + ) + ) + (if v1-17 + (set! (-> v1-17 root-prim local-sphere w) (-> arg0 carry-radius)) + ) + ) + (quaternion-copy! (-> arg0 grab-quat) (-> arg0 process 0 control quat)) + (quaternion-rotate-y! (-> arg0 grab-quat) (-> arg0 grab-quat) (- (vector-y-angle (-> obj normal)))) + (let* ((f30-0 (quaternion-y-angle (-> arg0 grab-quat))) + (f0-8 (the float (the int (* 0.000061035156 (+ 73728.0 (the float (sar (shl (the int f30-0) 48) 48))))))) + (f28-0 (the float (sar (shl (the int (* 16384.0 f0-8)) 48) 48))) + ) + (quaternion-rotate-y! (-> arg0 grab-quat) (-> arg0 grab-quat) (deg-diff f30-0 f28-0)) + (let ((s3-2 + (matrix-4x4-inverse! + (new 'stack-no-clear 'matrix) + (-> arg0 process 0 node-list data (-> arg0 joint) bone transform) + ) + ) + (s4-3 (vector-negate! (new 'stack-no-clear 'vector) (-> obj normal))) + ) + (set! (-> s4-3 y) 0.0) + (vector-xz-normalize! s4-3 (-> arg0 max-pull)) + (vector+! s4-3 s4-3 (-> arg0 point)) + (vector-! s4-3 s4-3 (-> arg0 process 0 control trans)) + (vector-rotate-y! s4-3 s4-3 (- (deg-diff f30-0 f28-0))) + (vector+! s4-3 s4-3 (-> arg0 process 0 control trans)) + (vector-matrix*! s4-3 s4-3 s3-2) + (set! (-> arg0 grab-trans quad) (-> s4-3 quad)) + ) + ) + (set! (-> arg0 hold-trans x) + (+ (fmax (fmin (- (-> arg0 grab-trans x) (-> arg0 local-point x)) (-> arg0 min-pull)) (- (-> arg0 min-pull))) + (-> arg0 local-point x) + ) + ) + (set! (-> arg0 hold-trans z) + (+ (fmax (fmin (- (-> arg0 grab-trans z) (-> arg0 local-point z)) (-> arg0 min-pull)) (- (-> arg0 min-pull))) + (-> arg0 local-point z) + ) + ) + (change-parent (ppointer->process (-> arg0 process)) (ppointer->process (-> obj process))) + (let* ((v1-46 (-> arg0 process)) + (v1-49 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-46 + (the-as process-drawable (-> v1-46 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (let ((a0-30 (-> v1-49 prim-core collide-as)) + (a1-25 (-> arg0 process)) + ) + (set! (-> (the-as collide-shape (-> (the-as process-drawable (if a1-25 + (the-as process-drawable (-> a1-25 0 self)) + ) + ) + root + ) + ) + backup-collide-as + ) + a0-30 + ) + ) + (let ((v1-50 (-> v1-49 prim-core collide-with)) + (a0-31 (-> arg0 process)) + ) + (set! (-> (the-as collide-shape (-> (the-as process-drawable (if a0-31 + (the-as process-drawable (-> a0-31 0 self)) + ) + ) + root + ) + ) + backup-collide-with + ) + v1-50 + ) + ) + ) + (let* ((v1-51 (-> arg0 process)) + (v1-54 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-51 + (the-as process-drawable (-> v1-51 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (set! (-> v1-54 prim-core collide-as) (collide-spec)) + (set! (-> v1-54 prim-core collide-with) (collide-spec)) + ) + 0 + 0 + (none) + ) + +(defmethod drop-impl! carry-info ((obj carry-info) (arg0 carry-info)) + (let ((a1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> arg0 process 0 control quat)))) + (set! (-> a1-2 y) 0.0) + (set-heading-vec-clear-roll-pitch! (-> arg0 process 0 control) a1-2) + ) + (let* ((s4-0 (the-as collide-shape (-> arg0 process 0 control))) + (v1-9 (if (type? (the-as control-info s4-0) collide-shape) + s4-0 + ) + ) + ) + (if v1-9 + (set! (-> v1-9 root-prim local-sphere w) (-> arg0 backup-radius)) + ) + ) + (set! (-> obj other) (the-as handle #f)) + (set! (-> arg0 other) (the-as handle #f)) + (change-parent (ppointer->process (-> arg0 process)) *entity-pool*) + (let* ((v1-13 (-> arg0 process)) + (v1-16 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-13 + (the-as process-drawable (-> v1-13 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (let ((a0-8 (-> arg0 process))) + (set! (-> v1-16 prim-core collide-as) + (-> (the-as collide-shape (-> (the-as process-drawable (if a0-8 + (the-as process-drawable (-> a0-8 0 self)) + ) + ) + root + ) + ) + backup-collide-as + ) + ) + ) + (let ((a0-12 (-> arg0 process))) + (set! (-> v1-16 prim-core collide-with) + (-> (the-as collide-shape (-> (the-as process-drawable (if a0-12 + (the-as process-drawable (-> a0-12 0 self)) + ) + ) + root + ) + ) + backup-collide-with + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod carry-info-method-13 carry-info ((obj carry-info)) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'carry-info) + (let* ((s4-0 (the-as carry-info (send-event-function (handle->process (-> obj other)) a1-0))) + (s2-0 (-> obj process 0 node-list data (-> obj joint) bone transform)) + (v1-10 + (vector-matrix*! + (new 'stack-no-clear 'vector) + (vector-lerp! (new 'stack-no-clear 'vector) (-> obj hold-trans) (-> obj grab-trans) (-> obj grab-trans-blend)) + s2-0 + ) + ) + (s3-2 (vector-! (new 'stack-no-clear 'vector) v1-10 (-> obj process 0 control trans))) + ) + (when s4-0 + (let ((s5-1 (new 'stack-no-clear 'matrix))) + (let* ((a2-3 (-> s4-0 process 0 node-list data (-> s4-0 joint) bone transform)) + (v1-16 (-> a2-3 vector 0 quad)) + (a0-16 (-> a2-3 vector 1 quad)) + (a1-3 (-> a2-3 vector 2 quad)) + (a2-4 (-> a2-3 trans quad)) + ) + (set! (-> s5-1 vector 0 quad) v1-16) + (set! (-> s5-1 vector 1 quad) a0-16) + (set! (-> s5-1 vector 2 quad) a1-3) + (set! (-> s5-1 trans quad) a2-4) + ) + (vector-normalize! (the-as vector (-> s5-1 vector)) 1.0) + (vector-normalize! (-> s5-1 vector 1) 1.0) + (vector-normalize! (-> s5-1 vector 2) 1.0) + (vector-reset! (-> s5-1 trans)) + (let* ((a1-8 (quaternion-normalize! (matrix->quaternion (new 'stack-no-clear 'quaternion) s5-1))) + (s5-3 (quaternion-normalize! (quaternion*! a1-8 a1-8 (-> obj grab-quat)))) + (v1-19 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 point) s3-2)) + (f30-0 (* 0.033333335 (the float (- (-> self clock frame-counter) (-> obj pickup-time))))) + ) + (cond + ((>= (- (-> self clock frame-counter) (-> obj pickup-time)) (seconds 1)) + (set! (-> obj process 0 control trans quad) (-> v1-19 quad)) + (quaternion-copy! (-> obj process 0 control quat) s5-3) + ) + (else + (vector-lerp! + (-> obj process 0 control trans) + (-> obj process 0 control trans) + v1-19 + (fmin 1.0 (* f30-0 (-> self clock time-adjust-ratio))) + ) + (quaternion-slerp! + (-> obj process 0 control quat) + (-> obj process 0 control quat) + s5-3 + (fmin 1.0 (* f30-0 (-> self clock time-adjust-ratio))) + ) + ) + ) + ) + ) + #t + ) + ) + ) + ) + +;; WARN: Return type mismatch vector vs none. +(defmethod carry! carry-info ((obj carry-info) (arg0 carry-info) (arg1 vector) (arg2 vector)) + (let ((v1-0 (-> arg0 process))) + (set! (-> obj other) (the-as handle (logior (if v1-0 + (new 'static 'handle :pid (-> v1-0 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-0) + ) + ) + ) + ) + (let ((v1-3 (-> obj process))) + (set! (-> arg0 other) (the-as handle (logior (if v1-3 + (new 'static 'handle :pid (-> v1-3 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-3) + ) + ) + ) + ) + (set! (-> obj pickup-time) (-> obj process 0 clock frame-counter)) + (set! (-> arg0 pickup-time) (-> arg0 process 0 clock frame-counter)) + (set! (-> arg0 grab-trans-blend) 1.0) + (let* ((s2-0 (the-as collide-shape (-> arg0 process 0 control))) + (v1-17 (if (type? (the-as control-info s2-0) collide-shape) + s2-0 + ) + ) + ) + (if v1-17 + (set! (-> v1-17 root-prim local-sphere w) (-> arg0 carry-radius)) + ) + ) + (quaternion-copy! (-> arg0 grab-quat) (-> arg0 process 0 control quat)) + (set! (-> arg0 grab-trans quad) (-> arg0 process 0 control trans quad)) + (set! (-> arg0 hold-trans quad) (-> obj process 0 control trans quad)) + (let ((s2-2 (vector-! (new 'stack-no-clear 'vector) (-> obj point) (-> arg0 point)))) + (vector-xz-normalize! s2-2 (-> arg0 max-pull)) + (vector+! s2-2 s2-2 (-> arg0 point)) + (let ((f30-0 (y-angle (-> arg0 process 0 control)))) + (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s2-2 (-> obj process 0 control trans))) + (let* ((f0-5 (the float (-> obj face-dir))) + (f28-0 (the float (sar (shl (the int (* 16384.0 f0-5)) 48) 48))) + ) + (set-vector! arg2 (sin (+ f30-0 f28-0)) 0.0 (cos (+ f30-0 f28-0)) 1.0) + ) + ) + ) + (vector+float*! arg1 (-> arg0 point) arg2 (- (-> arg0 carry-radius))) + (change-parent (ppointer->process (-> arg0 process)) (ppointer->process (-> obj process))) + (let* ((v1-46 (-> arg0 process)) + (v1-49 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-46 + (the-as process-drawable (-> v1-46 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (let ((a0-32 (-> v1-49 prim-core collide-as)) + (a1-7 (-> arg0 process)) + ) + (set! (-> (the-as collide-shape (-> (the-as process-drawable (if a1-7 + (the-as process-drawable (-> a1-7 0 self)) + ) + ) + root + ) + ) + backup-collide-as + ) + a0-32 + ) + ) + (let ((v1-50 (-> v1-49 prim-core collide-with)) + (a0-33 (-> arg0 process)) + ) + (set! (-> (the-as collide-shape (-> (the-as process-drawable (if a0-33 + (the-as process-drawable (-> a0-33 0 self)) + ) + ) + root + ) + ) + backup-collide-with + ) + v1-50 + ) + ) + ) + (let* ((v1-51 (-> arg0 process)) + (v1-54 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-51 + (the-as process-drawable (-> v1-51 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (set! (-> v1-54 prim-core collide-as) (collide-spec)) + (set! (-> v1-54 prim-core collide-with) (collide-spec)) + ) + 0 + (none) + ) + +(defmethod translate! carry-info ((obj carry-info)) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'carry-info) + (let ((a0-6 (the-as carry-info (send-event-function (handle->process (-> obj other)) a1-0)))) + (when a0-6 + (let ((v1-6 (vector-! (new 'stack-no-clear 'vector) (-> obj grab-trans) (-> obj hold-trans)))) + (vector+! (-> obj process 0 control trans) (-> a0-6 process 0 control trans) v1-6) + ) + #t + ) + ) + ) + ) + +(defmethod drop! carry-info ((obj carry-info) (arg0 carry-info)) + (drop-impl! obj arg0) + (none) + ) diff --git a/goal_src/jak2/engine/target/target-h.gc b/goal_src/jak2/engine/target/target-h.gc index b5acff5ea5..83b70f9469 100644 --- a/goal_src/jak2/engine/target/target-h.gc +++ b/goal_src/jak2/engine/target/target-h.gc @@ -124,16 +124,20 @@ (define-extern target-falling-anim-trans (function none :behavior target)) (define-extern ja-blend-eval (function int :behavior process-drawable)) -;; target-gun +;; target-gun - TODO move to `gun-h` perhaps? (define-extern target-look-around (state target)) (define-extern target-gun-end-mode (function symbol symbol :behavior target)) (define-extern target-gun-marking-menu (function target none)) (define-extern gun-init (function none :behavior gun)) +(declare-type gun-red-shot process-drawable) (define-extern target-gun-type-set! (function int none :behavior target)) -(define-extern target-gun-fire-blue (function none :behavior target)) -(define-extern target-gun-fire-yellow (function none :behavior target)) -(define-extern target-gun-fire-red (function none :behavior target)) -(define-extern target-gun-fire-dark (function none :behavior target)) +(define-extern target-gun-fire-blue (function (pointer process) :behavior target)) +(define-extern target-gun-fire-yellow (function (pointer process) :behavior target)) +(define-extern target-gun-fire-red (function (pointer gun-red-shot) :behavior target)) +(define-extern target-gun-fire-dark (function (pointer process) :behavior target)) + +(define-extern target-pos (function int vector)) +(define-extern stop (function symbol int)) ;; DECOMP BEGINS @@ -213,6 +217,7 @@ ) ) + (define-perm *target* target #f) (deftype sidekick (process-drawable) @@ -231,10 +236,8 @@ :flag-assert #x1400b00124 ) + (define-perm *sidekick* sidekick #f) ; what is this. ;(new 'static 'boxed-array :type type pilot-info mech-info turret-info indax-info tube-info) - -(define-extern target-pos (function int vector)) -(define-extern stop (function symbol int)) diff --git a/goal_src/jak2/engine/ui/minimap-h.gc b/goal_src/jak2/engine/ui/minimap-h.gc index cef6d9daf1..d9f490ad76 100644 --- a/goal_src/jak2/engine/ui/minimap-h.gc +++ b/goal_src/jak2/engine/ui/minimap-h.gc @@ -100,9 +100,12 @@ (ruins-hut 68) (forest-samos 69) (metalhead 70) - ) +(declare-type process-drawable process) +(declare-type minimap structure) +(define-extern *minimap* minimap) + ;; DECOMP BEGINS (deftype minimap-class-node (structure) @@ -161,7 +164,7 @@ :size-assert #xd0 :flag-assert #xb000000d0 (:methods - (minimap-trail-method-9 () none 9) + (minimap-trail-method-9 (_type_ vector vector) float 9) (minimap-trail-method-10 () none 10) ) ) @@ -214,7 +217,7 @@ :flag-assert #x1c00000648 (:methods (minimap-method-9 () none 9) - (minimap-method-10 () none 10) + (minimap-method-10 (_type_ connection-minimap minimap-trail) minimap-trail 10) (minimap-method-11 () none 11) (minimap-method-12 (_type_ process uint int vector int) connection-minimap 12) (minimap-method-13 () none 13) @@ -234,7 +237,3 @@ (minimap-method-27 () none 27) ) ) - - -(define-extern *minimap* minimap) - diff --git a/test/decompiler/reference/jak1/engine/anim/bones-h_REF.gc b/test/decompiler/reference/jak1/engine/anim/bones-h_REF.gc index 7044beac49..45e2128964 100644 --- a/test/decompiler/reference/jak1/engine/anim/bones-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/bones-h_REF.gc @@ -146,11 +146,8 @@ ) ;; definition for function invalidate-cache-line -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin a0, 0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin a0, 1] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun invalidate-cache-line ((arg0 pointer)) (.sync.l) (.cache dxwbin arg0 0) diff --git a/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc b/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc index 6c4df23bec..aec00289dd 100644 --- a/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc +++ b/test/decompiler/reference/jak1/engine/collide/collide-probe_REF.gc @@ -215,7 +215,6 @@ ;; definition for function collide-upload-vu0 ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun collide-upload-vu0 () (let ((gp-0 *vu0-dma-list*)) (let ((v1-0 gp-0)) diff --git a/test/decompiler/reference/jak1/engine/debug/stats-h_REF.gc b/test/decompiler/reference/jak1/engine/debug/stats-h_REF.gc index 257518755a..c58baf10a5 100644 --- a/test/decompiler/reference/jak1/engine/debug/stats-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/debug/stats-h_REF.gc @@ -116,25 +116,15 @@ ;; definition for method 11 of type perf-stat ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, v1] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defmethod reset! perf-stat ((obj perf-stat)) (let ((v1-0 (-> obj ctrl))) (+! (-> obj count) 1) (b! (zero? v1-0) cfg-2 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf v1-0) @@ -148,15 +138,10 @@ ;; definition for method 12 of type perf-stat ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc v1, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc v1, pcr1] (defmethod read! perf-stat ((obj perf-stat)) (local-vars (v1-1 int) (v1-3 int)) (b! (zero? (-> obj ctrl)) cfg-2 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc v1-1 pcr0) diff --git a/test/decompiler/reference/jak1/engine/dma/dma_REF.gc b/test/decompiler/reference/jak1/engine/dma/dma_REF.gc index fe79ad1697..404b8df267 100644 --- a/test/decompiler/reference/jak1/engine/dma/dma_REF.gc +++ b/test/decompiler/reference/jak1/engine/dma/dma_REF.gc @@ -26,9 +26,6 @@ ;; definition for function dma-send ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun dma-send ((arg0 dma-bank) (arg1 uint) (arg2 uint)) (dma-sync (the-as pointer arg0) 0 0) (flush-cache 0) @@ -49,9 +46,6 @@ ;; definition for function dma-send-chain ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun dma-send-chain ((arg0 dma-bank-source) (arg1 uint)) (dma-sync (the-as pointer arg0) 0 0) (flush-cache 0) @@ -72,9 +66,6 @@ ;; definition for function dma-send-chain-no-tte ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun dma-send-chain-no-tte ((arg0 dma-bank-source) (arg1 uint)) (dma-sync (the-as pointer arg0) 0 0) (flush-cache 0) @@ -95,9 +86,6 @@ ;; definition for function dma-send-chain-no-flush ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun dma-send-chain-no-flush ((arg0 dma-bank-source) (arg1 uint)) (dma-sync (the-as pointer arg0) 0 0) (.sync.l) @@ -117,9 +105,6 @@ ;; definition for function dma-send-to-spr ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun dma-send-to-spr ((sadr uint) (madr uint) (qwc uint) (sync symbol)) (let ((s5-0 (the-as dma-bank-spr #x1000d400))) (dma-sync (the-as pointer s5-0) 0 0) @@ -141,9 +126,6 @@ ;; definition for function dma-send-to-spr-no-flush ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun dma-send-to-spr-no-flush ((sadr uint) (madr uint) (qwc uint) (sync symbol)) (let ((s5-0 (the-as dma-bank-spr #x1000d400))) (dma-sync (the-as pointer s5-0) 0 0) @@ -164,9 +146,6 @@ ;; definition for function dma-send-from-spr ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun dma-send-from-spr ((madr uint) (sadr uint) (qwc uint) (sync symbol)) (let ((s5-0 (the-as dma-bank-spr #x1000d000))) (dma-sync (the-as pointer s5-0) 0 0) @@ -188,9 +167,6 @@ ;; definition for function dma-send-from-spr-no-flush ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun dma-send-from-spr-no-flush ((madr uint) (sadr uint) (qwc uint) (sync symbol)) (let ((s5-0 (the-as dma-bank-spr #x1000d000))) (dma-sync (the-as pointer s5-0) 0 0) @@ -314,11 +290,6 @@ ;; definition for function ultimate-memcpy ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun ultimate-memcpy ((dst pointer) (src pointer) (size-bytes uint)) (let ((spr-to-bank (the-as dma-bank-spr #x1000d400)) (spr-from-bank (the-as dma-bank-spr #x1000d000)) diff --git a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc index 80351f87b5..8d3781d1c0 100644 --- a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc +++ b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc @@ -1,11 +1,5 @@ -;;-*-Lisp-*- (in-package goal) -;; definition for function sphere-cull -;; ERROR: Bad vector register dependency: vf16 -;; ERROR: Bad vector register dependency: vf17 -;; ERROR: Bad vector register dependency: vf18 -;; ERROR: Bad vector register dependency: vf19 (defun sphere-cull ((arg0 vector)) (local-vars (v1-0 uint128) (v1-1 uint128) (v1-2 uint128)) (rlet ((acc :class vf) @@ -31,11 +25,6 @@ ) ) -;; definition for function guard-band-cull -;; ERROR: Bad vector register dependency: vf20 -;; ERROR: Bad vector register dependency: vf21 -;; ERROR: Bad vector register dependency: vf22 -;; ERROR: Bad vector register dependency: vf23 (defun guard-band-cull ((arg0 vector)) (local-vars (v1-0 uint128) (v1-1 uint128) (v1-2 uint128)) (rlet ((acc :class vf) @@ -61,7 +50,6 @@ ) ) -;; definition for function sphere-in-view-frustum? (defun sphere-in-view-frustum? ((arg0 sphere)) (local-vars (v1-1 uint128) (v1-2 uint128) (v1-3 uint128)) (rlet ((acc :class vf) @@ -93,7 +81,6 @@ ) ) -;; definition for function line-in-view-frustum? (defun line-in-view-frustum? ((arg0 vector) (arg1 vector)) (local-vars (v1-1 uint128) (v1-2 uint128) (v1-3 uint128) (a0-1 uint128) (a0-2 uint128) (a0-3 uint128)) (rlet ((acc :class vf) @@ -132,10 +119,6 @@ ) ) -;; definition for function vis-cull -;; ERROR: Type Propagation failed: Failed type prop at op 3 ((set! v1 (l.b (+ v1 #x38b0)))): Could not get type of load: (set! v1 (l.b (+ v1 #x38b0))). -;; ERROR: Type analysis failed -;; ERROR: Unsupported inline assembly instruction kind - [addiu a0, a0, 56] (defun vis-cull ((a0-0 int)) (local-vars (v0-0 none) (v1-0 int) (v1-1 int) (v1-2 none) (v1-3 none) (a0-1 none) (a0-2 none) (a1-0 int)) (set! v1-0 #x70000000) @@ -149,8 +132,6 @@ (ret-value v0-0) ) -;; definition for function error-sphere -;; INFO: Return type mismatch int vs none. (defun error-sphere ((arg0 drawable-error) (arg1 string)) (when *artist-error-spheres* (when (vis-cull (-> arg0 id)) @@ -177,82 +158,60 @@ (none) ) -;; definition for method 9 of type drawable (defmethod login drawable ((obj drawable)) obj ) -;; definition for method 10 of type drawable -;; INFO: Return type mismatch int vs none. (defmethod draw drawable ((obj drawable) (arg0 drawable) (arg1 display-frame)) 0 (none) ) -;; definition for method 11 of type drawable -;; INFO: Return type mismatch int vs none. (defmethod collide-with-box drawable ((obj drawable) (arg0 int) (arg1 collide-list)) 0 (none) ) -;; definition for method 12 of type drawable -;; INFO: Return type mismatch int vs none. (defmethod collide-y-probe drawable ((obj drawable) (arg0 int) (arg1 collide-list)) 0 (none) ) -;; definition for method 13 of type drawable -;; INFO: Return type mismatch int vs none. (defmethod collide-ray drawable ((obj drawable) (arg0 int) (arg1 collide-list)) 0 (none) ) -;; definition for method 17 of type drawable -;; INFO: Return type mismatch int vs none. (defmethod collect-ambients drawable ((obj drawable) (arg0 sphere) (arg1 int) (arg2 ambient-list)) 0 (none) ) -;; definition for method 14 of type drawable -;; INFO: Return type mismatch int vs none. (defmethod collect-stats drawable ((obj drawable)) 0 (none) ) -;; definition for method 15 of type drawable -;; INFO: Return type mismatch int vs none. (defmethod debug-draw drawable ((obj drawable) (arg0 drawable) (arg1 display-frame)) 0 (none) ) -;; definition for method 10 of type drawable-error -;; INFO: Return type mismatch drawable-error vs none. (defmethod draw drawable-error ((obj drawable-error) (arg0 drawable-error) (arg1 display-frame)) (error-sphere arg0 (-> arg0 name)) (none) ) -;; definition for method 16 of type drawable (defmethod unpack-vis drawable ((obj drawable) (arg0 (pointer int8)) (arg1 (pointer int8))) arg1 ) -;; definition for symbol *edit-instance*, type string (define *edit-instance* (the-as string #f)) -;; this part is debug only (when *debug-segment* -;; definition for symbol *instance-mem-usage*, type memory-usage-block (define *instance-mem-usage* (new 'debug 'memory-usage-block)) ) -;; definition (debug) for function find-instance-by-name (defun-debug find-instance-by-name ((arg0 string)) (dotimes (s5-0 (-> *level* length)) (let ((v1-3 (-> *level* level s5-0))) @@ -289,7 +248,6 @@ (the-as prototype-bucket #f) ) -;; definition (debug) for function find-instance-by-index (defun-debug find-instance-by-index ((arg0 type) (arg1 int) (arg2 bsp-header)) (dotimes (v1-0 (-> *level* length)) (let ((a3-3 (-> *level* level v1-0))) @@ -326,7 +284,6 @@ (the-as prototype-bucket #f) ) -;; definition (debug) for function prototype-bucket-type (defun-debug prototype-bucket-type ((arg0 prototype-bucket)) (case (-> arg0 geometry 1 type) ((prototype-shrubbery shrubbery) @@ -338,7 +295,6 @@ ) ) -;; definition (debug) for function prototype-bucket-recalc-fields (defun-debug prototype-bucket-recalc-fields ((arg0 prototype-bucket)) (case (prototype-bucket-type arg0) ((instance-shrubbery) @@ -355,12 +311,6 @@ arg0 ) -;; definition (debug) for function draw-instance-info -;; INFO: Used lq/sq -;; INFO: Return type mismatch object vs none. -;; WARN: Failed load: (set! a2-12 (l.hu (+ a2-11 68))) at op 283 -;; WARN: Failed load: (set! a2-15 (l.hu (+ a2-14 70))) at op 289 -;; WARN: Failed load: (set! a2-18 (l.hu (+ a2-17 60))) at op 295 (defun-debug draw-instance-info ((arg0 string)) (local-vars (sv-16 uint) @@ -549,9 +499,6 @@ (none) ) -;; definition for function dma-add-process-drawable -;; INFO: Return type mismatch int vs none. -;; WARN: Function dma-add-process-drawable has a return type of none, but the expression builder found a return statement. (defun dma-add-process-drawable ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer)) (local-vars (v1-37 float) (sv-16 process-drawable)) (rlet ((acc :class vf) @@ -826,33 +773,22 @@ ) ) -;; definition for symbol *hud-lights*, type vu-lights (define *hud-lights* (new 'global 'vu-lights)) -;; failed to figure out what this is: (set-vector! (-> *hud-lights* direction 0) 1.0 0.0 0.0 1.0) -;; failed to figure out what this is: (set-vector! (-> *hud-lights* direction 1) 0.0 1.0 0.0 1.0) -;; failed to figure out what this is: (set-vector! (-> *hud-lights* direction 2) 0.0 0.0 1.0 1.0) -;; failed to figure out what this is: (set-vector! (-> *hud-lights* color 0) 0.0 0.0 0.0 1.0) -;; failed to figure out what this is: (set-vector! (-> *hud-lights* color 1) 0.0 0.0 0.0 1.0) -;; failed to figure out what this is: (set-vector! (-> *hud-lights* color 2) 0.5 0.5 0.5 1.0) -;; failed to figure out what this is: (set-vector! (-> *hud-lights* ambient) 0.5 0.5 0.5 1.0) -;; definition for function dma-add-process-drawable-hud -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. (defun dma-add-process-drawable-hud ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer)) (logclear! (-> arg1 status) (draw-status was-drawn)) (when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update))) @@ -875,20 +811,11 @@ (none) ) -;; definition for function add-process-drawable -;; INFO: Return type mismatch symbol vs none. (defun add-process-drawable ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer)) ((-> arg1 dma-add-func) arg0 arg1 arg2 arg3) (none) ) -;; definition for function foreground-engine-execute -;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin v1, 0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin v1, 1] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun foreground-engine-execute ((arg0 engine) (arg1 display-frame) (arg2 int) (arg3 int)) (let ((s4-0 (-> *display* frames (-> *display* on-screen) frame global-buf base))) (if *debug-segment* @@ -961,7 +888,6 @@ (none) ) -;; definition (debug) for function main-debug-hook (defun-debug main-debug-hook () (when (not (or (= *master-mode* 'menu) (= *master-mode* 'progress))) (execute-connections *debug-engine* #f) @@ -970,33 +896,12 @@ (none) ) -;; definition for symbol *debug-hook*, type (function none) (define *debug-hook* main-debug-hook) -;; definition for symbol *add-sphere*, type symbol (define *add-sphere* #f) -;; definition for symbol *generic-effect-mode*, type int (define *generic-effect-mode* 0) -;; definition for function real-main-draw-hook -;; INFO: Return type mismatch int vs none. -;; WARN: Failed store: (s.d! (+ (the-as (pointer gs-reg) a0-47) 8) a1-28) at op 332 -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun real-main-draw-hook () (local-vars (a0-74 int) (a0-76 int)) (when *slow-frame-rate* @@ -1238,11 +1143,11 @@ ) (+! (-> v1-178 count) 1) (b! (zero? a0-72) cfg-77 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-72) @@ -1254,7 +1159,7 @@ (finish-background) (let ((v1-181 (-> *perf-stats* data 3))) (b! (zero? (-> v1-181 ctrl)) cfg-79 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-74 pcr0) @@ -1341,17 +1246,13 @@ (none) ) -;; definition for function main-draw-hook (defun main-draw-hook () (real-main-draw-hook) (none) ) -;; definition for symbol *draw-hook*, type (function none) (define *draw-hook* main-draw-hook) -;; definition for function debug-init-buffer -;; INFO: Return type mismatch symbol vs none. (defun debug-init-buffer ((arg0 bucket-id) (arg1 gs-zbuf) (arg2 gs-test)) (let* ((t0-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) (v1-3 (-> t0-0 base)) @@ -1398,11 +1299,8 @@ (none) ) -;; definition for symbol *screen-shot*, type symbol (define *screen-shot* #f) -;; definition for function display-frame-start -;; INFO: Return type mismatch display vs none. (defun display-frame-start ((disp display) (new-frame-idx int) (odd-even int)) (set! (-> (the-as vif-bank #x10003c00) err me0) 1) (let ((time-ratio @@ -1493,7 +1391,6 @@ (none) ) -;; definition for function display-frame-finish (defun display-frame-finish ((disp display)) (let* ((this-frame (-> disp frames (-> disp on-screen) frame)) (this-calc-buf (-> this-frame calc-buf)) @@ -1569,7 +1466,6 @@ disp ) -;; definition for function determine-pause-mode (defun determine-pause-mode () (when (and *debug-pause* (= *master-mode* 'pause)) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons start r2)) @@ -1599,10 +1495,8 @@ 0 ) -;; definition for symbol *surrogate-dma-buffer*, type dma-buffer (define *surrogate-dma-buffer* (the-as dma-buffer #f)) -;; definition for function display-sync (defun display-sync ((disp display)) (sync-path 0 0) (set! (-> disp frames (-> disp on-screen) frame run-time) @@ -1653,16 +1547,12 @@ (none) ) -;; definition for function swap-display (defun swap-display ((arg0 display)) (display-frame-finish arg0) (display-sync arg0) (none) ) -;; definition (debug) for function marks-cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch symbol vs none. (defun-debug marks-cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) @@ -1702,9 +1592,6 @@ (none) ) -;; definition (debug) for function eddie-cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch vector vs none. (defun-debug eddie-cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) @@ -1734,9 +1621,6 @@ (none) ) -;; definition (debug) for function gregs-jungle-cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch string vs none. (defun-debug gregs-jungle-cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) @@ -1775,9 +1659,6 @@ (none) ) -;; definition (debug) for function gregs-village1-cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch string vs none. (defun-debug gregs-village1-cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) @@ -1816,9 +1697,6 @@ (none) ) -;; definition (debug) for function gregs-texture-cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch string vs none. (defun-debug gregs-texture-cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) @@ -1857,9 +1735,6 @@ (none) ) -;; definition (debug) for function gregs-texture2-cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch string vs none. (defun-debug gregs-texture2-cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) @@ -1898,9 +1773,6 @@ (none) ) -;; definition (debug) for function cave-cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch vector vs none. (defun-debug cave-cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) @@ -1930,9 +1802,6 @@ (none) ) -;; definition (debug) for function paals-cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch vector vs none. (defun-debug paals-cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) diff --git a/test/decompiler/reference/jak1/engine/draw/process-drawable_REF.gc b/test/decompiler/reference/jak1/engine/draw/process-drawable_REF.gc index 82dcaa9d70..8aedfbe179 100644 --- a/test/decompiler/reference/jak1/engine/draw/process-drawable_REF.gc +++ b/test/decompiler/reference/jak1/engine/draw/process-drawable_REF.gc @@ -233,11 +233,8 @@ ) ;; definition for function fill-skeleton-cache -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin a2, 0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin a2, 1] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun fill-skeleton-cache ((arg0 process-drawable)) (let ((v1-0 (-> arg0 node-list)) (a0-2 (-> arg0 draw skeleton)) diff --git a/test/decompiler/reference/jak1/engine/entity/entity_REF.gc b/test/decompiler/reference/jak1/engine/entity/entity_REF.gc index efc56ee33d..6e36dae8d2 100644 --- a/test/decompiler/reference/jak1/engine/entity/entity_REF.gc +++ b/test/decompiler/reference/jak1/engine/entity/entity_REF.gc @@ -1870,8 +1870,6 @@ ;; definition (debug) for function entity-speed-test ;; INFO: Return type mismatch entity vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Count, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 s4, Count] (defun-debug entity-speed-test ((arg0 string)) (local-vars (s4-0 int)) @@ -1881,7 +1879,7 @@ (reset-actors 'debug) 0 (disable-irq) - (.mtc0 Count r0) + (.mtc0 Count 0) (.sync.p) (birth! gp-0) (.mfc0 s4-0 Count) diff --git a/test/decompiler/reference/jak1/engine/game/main_REF.gc b/test/decompiler/reference/jak1/engine/game/main_REF.gc index 842ebd79a0..f54547f7f0 100644 --- a/test/decompiler/reference/jak1/engine/game/main_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/main_REF.gc @@ -1,15 +1,10 @@ -;;-*-Lisp-*- (in-package goal) -;; definition for function set-letterbox-frames -;; INFO: Return type mismatch time-frame vs none. (defun set-letterbox-frames ((arg0 time-frame)) (set! (-> *game-info* letterbox-time) (+ (-> *display* base-frame-counter) arg0)) (none) ) -;; definition for function letterbox -;; INFO: Return type mismatch pointer vs none. (defun letterbox () (let* ((dma-buf (-> *display* frames (-> *display* on-screen) frame global-buf)) (gp-0 (-> dma-buf base)) @@ -34,8 +29,6 @@ (none) ) -;; definition for function set-blackout-frames -;; INFO: Return type mismatch time-frame vs none. (defun set-blackout-frames ((arg0 time-frame)) (if (zero? arg0) (set! (-> *game-info* blackout-time) (-> *display* base-frame-counter)) @@ -46,8 +39,6 @@ (none) ) -;; definition for function blackout -;; INFO: Return type mismatch pointer vs none. (defun blackout () (let* ((dma-buf (-> *display* frames (-> *display* on-screen) frame global-buf)) (sprite-dma-data (-> dma-buf base)) @@ -71,8 +62,6 @@ (none) ) -;; definition for function paused? -;; INFO: Return type mismatch object vs symbol. (defun paused? () (the-as symbol @@ -82,13 +71,10 @@ ) ) -;; definition for function movie? (defun movie? () (logtest? (-> *kernel-context* prevent-from-run) (process-mask movie)) ) -;; definition for function set-master-mode -;; INFO: Return type mismatch int vs none. (defun set-master-mode ((new-mode symbol)) (set! *master-mode* new-mode) (if *debug-segment* @@ -130,10 +116,8 @@ (none) ) -;; definition for symbol *last-master-mode*, type symbol (define *last-master-mode* 'game) -;; definition for function toggle-pause (defun toggle-pause () (case *master-mode* (('game) @@ -244,13 +228,10 @@ 0 ) -;; definition for symbol *screen-filter*, type screen-filter (define *screen-filter* (new 'static 'screen-filter :draw? #f :color (new 'static 'rgba :g #x20 :b #x40 :a #x50)) ) -;; definition for method 9 of type screen-filter -;; INFO: Return type mismatch pointer vs none. (defmethod draw screen-filter ((obj screen-filter)) (let* ((buf (-> *display* frames (-> *display* on-screen) frame global-buf)) (gp-0 (-> buf base)) @@ -274,16 +255,12 @@ (none) ) -;; definition for symbol *cheat-temp*, type (pointer int32) (define *cheat-temp* (the-as (pointer int32) (malloc 'global 16))) -;; definition for symbol *master-exit*, type symbol (define *master-exit* #f) -;; definition for symbol *progress-cheat*, type symbol (define *progress-cheat* #f) -;; definition for function main-cheats (defun main-cheats () (when (and (cpad-hold? 0 l3) (or *cheat-mode* (= *kernel-boot-message* 'play))) (when (nonzero? (-> *cpad-list* cpads 0 button0-rel 0)) @@ -933,38 +910,6 @@ 0 ) -;; definition for function display-loop -;; WARN: Failed store: (s.w! (+ v1-28 16) 0) at op 124 -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defbehavior display-loop process () (local-vars (a0-54 int) (a0-56 int) (a0-73 int) (a0-75 int)) (stack-size-set! (-> self main-thread) 512) @@ -1096,7 +1041,7 @@ ) (let ((v1-112 (-> *perf-stats* data))) (b! (zero? (-> v1-112 0 ctrl)) cfg-46 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-54 pcr0) @@ -1122,11 +1067,11 @@ ) (+! (-> v1-123 0 count) 1) (b! (zero? a0-60) cfg-51 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-60) @@ -1155,7 +1100,7 @@ ) (let ((v1-152 (-> *perf-stats* data))) (b! (zero? (-> v1-152 0 ctrl)) cfg-68 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-73 pcr0) @@ -1330,11 +1275,11 @@ ) (+! (-> v1-228 0 count) 1) (b! (zero? a0-112) cfg-98 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-112) @@ -1362,7 +1307,6 @@ 0 ) -;; definition for function on (defun on ((arg0 symbol)) (when (not *dproc*) (when (not arg0) @@ -1407,7 +1351,6 @@ ) ) -;; definition for function off (defun off () (stop 'debug) (dotimes (gp-0 (-> *level* length)) diff --git a/test/decompiler/reference/jak1/engine/gfx/capture_REF.gc b/test/decompiler/reference/jak1/engine/gfx/capture_REF.gc index 5e6c4df3e1..554ae14116 100644 --- a/test/decompiler/reference/jak1/engine/gfx/capture_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/capture_REF.gc @@ -45,7 +45,6 @@ ;; definition for function gs-set-default-store-image ;; INFO: Used lq/sq -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun gs-set-default-store-image ((packet gs-store-image-packet) (src-fbp int) (src-w int) diff --git a/test/decompiler/reference/jak1/engine/gfx/generic/generic-merc_REF.gc b/test/decompiler/reference/jak1/engine/gfx/generic/generic-merc_REF.gc index a661c47228..d2f93cb593 100644 --- a/test/decompiler/reference/jak1/engine/gfx/generic/generic-merc_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/generic/generic-merc_REF.gc @@ -1,10 +1,7 @@ -;;-*-Lisp-*- (in-package goal) -;; definition for symbol mercneric-vu0-block, type vu-function (define mercneric-vu0-block (new 'static 'vu-function :length #xbe :origin #x118 :qlength 95)) -;; definition of type invinitdata (deftype invinitdata (structure) ((count uint8 :offset-assert 0) (init-data uint8 :offset-assert 1) @@ -16,7 +13,6 @@ :flag-assert #x900000004 ) -;; definition for method 3 of type invinitdata (defmethod inspect invinitdata ((obj invinitdata)) (format #t "[~8x] ~A~%" obj 'invinitdata) (format #t "~Tcount: ~D~%" (-> obj count)) @@ -25,7 +21,6 @@ obj ) -;; definition for symbol *inv-init-table*, type (inline-array invinitdata) (define *inv-init-table* (new 'static 'inline-array invinitdata 8 (new 'static 'invinitdata :count #x48 :init-addr #x1) (new 'static 'invinitdata :count #x43 :init-data #xc :init-addr #x11) @@ -38,29 +33,13 @@ ) ) -;; definition for function generic-merc-init-asm -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function mercneric-matrix-asm -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function mercneric-shader-asm -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function mercneric-bittable-asm -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function mercneric-convert -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function high-speed-reject -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function generic-merc-execute-asm -;; ERROR: function was not converted to expressions. Cannot decompile. -;; definition for function generic-merc-add-to-cue -;; INFO: Return type mismatch merc-globals vs none. (defun generic-merc-add-to-cue ((arg0 generic-dma-foreground-sink)) (set! (-> *merc-globals* sink) arg0) (+! (-> *merc-global-array* count) 1) @@ -68,29 +47,6 @@ (none) ) -;; definition for function generic-merc-execute-all -;; INFO: Return type mismatch profile-frame vs none. -;; WARN: Failed store: (s.w! (the-as int a0-19) a1-7) at op 109 -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin v1, 0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin v1, 1] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun generic-merc-execute-all ((arg0 dma-buffer)) (local-vars (a0-26 int) (a0-28 int)) (when (nonzero? (-> *merc-global-array* count)) @@ -107,11 +63,11 @@ ) (+! (-> v1-15 count) 1) (b! (zero? a0-8) cfg-5 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-8) @@ -196,7 +152,7 @@ ) (let ((v1-51 (-> *perf-stats* data 1))) (b! (zero? (-> v1-51 ctrl)) cfg-14 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-26 pcr0) diff --git a/test/decompiler/reference/jak1/engine/gfx/tfrag/subdivide_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tfrag/subdivide_REF.gc index d18c59bd0d..88572c0d63 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tfrag/subdivide_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tfrag/subdivide_REF.gc @@ -279,16 +279,6 @@ ;; definition (debug) for function start-perf-stat-collection ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defun-debug start-perf-stat-collection () (let ((frame-idx (+ (-> *perf-stats* data 0 frame-number) 1))) (set! (-> *perf-stats* data 0 frame-number) frame-idx) @@ -368,11 +358,11 @@ ) (+! (-> v1-31 0 count) 1) (b! (zero? a0-76) cfg-28 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-76) @@ -387,16 +377,11 @@ ;; definition (debug) for function end-perf-stat-collection ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun-debug end-perf-stat-collection () (local-vars (a0-1 int) (a0-3 int)) (let ((v1-1 (-> *perf-stats* data))) (b! (zero? (-> v1-1 0 ctrl)) cfg-2 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-1 pcr0) diff --git a/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc index 99006ecb18..ebdd11082d 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tfrag/tfrag-methods_REF.gc @@ -28,36 +28,6 @@ ;; definition for function draw-drawable-tree-tfrag ;; INFO: Return type mismatch drawable-tree-tfrag vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag)) (local-vars (a0-20 int) (a0-22 int) (a0-38 int) (a0-40 int) (sv-16 (pointer uint8))) (when (logtest? *vu1-enable-user* (vu1-renderer-mask tfrag)) @@ -107,11 +77,11 @@ ) (+! (-> v1-28 count) 1) (b! (zero? a0-17) cfg-8 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-17) @@ -123,7 +93,7 @@ (draw-inline-array-tfrag sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-0) (let ((v1-31 (-> *perf-stats* data 5))) (b! (zero? (-> v1-31 ctrl)) cfg-10 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-20 pcr0) @@ -179,11 +149,11 @@ ) (+! (-> v1-52 count) 1) (b! (zero? a0-35) cfg-15 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-35) @@ -195,7 +165,7 @@ (draw-inline-array-tfrag-near sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-1) (let ((v1-55 (-> *perf-stats* data 6))) (b! (zero? (-> v1-55 ctrl)) cfg-17 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-38 pcr0) @@ -250,36 +220,6 @@ ;; definition for function draw-drawable-tree-trans-tfrag ;; INFO: Return type mismatch drawable-tree-trans-tfrag vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun draw-drawable-tree-trans-tfrag ((arg0 drawable-tree-trans-tfrag)) (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) @@ -329,11 +269,11 @@ ) (+! (-> v1-24 count) 1) (b! (zero? a0-14) cfg-8 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-14) @@ -351,7 +291,7 @@ ) (let ((v1-32 (-> *perf-stats* data 5))) (b! (zero? (-> v1-32 ctrl)) cfg-10 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-18 pcr0) @@ -402,11 +342,11 @@ ) (+! (-> v1-48 count) 1) (b! (zero? a0-32) cfg-15 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-32) @@ -418,7 +358,7 @@ (draw-inline-array-tfrag-near sv-16 s5-1 s4-1 s2-1) (let ((v1-51 (-> *perf-stats* data 6))) (b! (zero? (-> v1-51 ctrl)) cfg-17 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-35 pcr0) @@ -461,36 +401,6 @@ ;; definition for function draw-drawable-tree-dirt-tfrag ;; INFO: Return type mismatch drawable-tree-dirt-tfrag vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun draw-drawable-tree-dirt-tfrag ((arg0 drawable-tree-dirt-tfrag)) (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) @@ -529,11 +439,11 @@ ) (+! (-> v1-24 count) 1) (b! (zero? a0-14) cfg-8 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-14) @@ -551,7 +461,7 @@ ) (let ((v1-32 (-> *perf-stats* data 5))) (b! (zero? (-> v1-32 ctrl)) cfg-10 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-18 pcr0) @@ -595,11 +505,11 @@ ) (+! (-> v1-48 count) 1) (b! (zero? a0-32) cfg-15 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-32) @@ -611,7 +521,7 @@ (draw-inline-array-tfrag-near sv-16 s5-1 s4-1 s2-1) (let ((v1-51 (-> *perf-stats* data 6))) (b! (zero? (-> v1-51 ctrl)) cfg-17 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-35 pcr0) @@ -654,36 +564,6 @@ ;; definition for function draw-drawable-tree-ice-tfrag ;; INFO: Return type mismatch drawable-tree-ice-tfrag vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun draw-drawable-tree-ice-tfrag ((arg0 drawable-tree-ice-tfrag)) (local-vars (a0-18 int) (a0-20 int) (a0-35 int) (a0-37 int) (sv-16 (pointer uint8))) (when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag)) @@ -726,11 +606,11 @@ ) (+! (-> v1-24 count) 1) (b! (zero? a0-14) cfg-8 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-14) @@ -748,7 +628,7 @@ ) (let ((v1-32 (-> *perf-stats* data 5))) (b! (zero? (-> v1-32 ctrl)) cfg-10 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-18 pcr0) @@ -792,11 +672,11 @@ ) (+! (-> v1-48 count) 1) (b! (zero? a0-32) cfg-15 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-32) @@ -808,7 +688,7 @@ (draw-inline-array-tfrag-near sv-16 s5-1 s4-1 s2-1) (let ((v1-51 (-> *perf-stats* data 6))) (b! (zero? (-> v1-51 ctrl)) cfg-17 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-35 pcr0) diff --git a/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc b/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc index b2e89bd0bd..3d1ef15bd5 100644 --- a/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/tie/tie-methods_REF.gc @@ -247,66 +247,6 @@ ;; definition for function draw-drawable-tree-instance-tie ;; INFO: Used lq/sq ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun draw-drawable-tree-instance-tie ((arg0 drawable-tree-instance-tie) (arg1 level)) (local-vars (a0-31 int) @@ -375,11 +315,11 @@ ) (+! (-> v1-32 count) 1) (b! (zero? a0-28) cfg-12 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-28) @@ -395,7 +335,7 @@ ) (let ((v1-35 (-> *perf-stats* data 9))) (b! (zero? (-> v1-35 ctrl)) cfg-14 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-31 pcr0) @@ -438,11 +378,11 @@ ) (+! (-> v1-60 count) 1) (b! (zero? a0-43) cfg-20 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-43) @@ -454,7 +394,7 @@ (draw-inline-array-prototype-tie-generic-asm s3-1 s5-1 s4-1) (let ((v1-63 (-> *perf-stats* data 10))) (b! (zero? (-> v1-63 ctrl)) cfg-22 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-46 pcr0) @@ -497,11 +437,11 @@ ) (+! (-> v1-85 count) 1) (b! (zero? a0-59) cfg-28 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-59) @@ -513,7 +453,7 @@ (draw-inline-array-prototype-tie-asm s1-1 s5-1 s4-1) (let ((v1-88 (-> *perf-stats* data 11))) (b! (zero? (-> v1-88 ctrl)) cfg-30 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-62 pcr0) @@ -573,11 +513,11 @@ ) (+! (-> v1-114 count) 1) (b! (zero? a0-79) cfg-39 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-79) @@ -589,7 +529,7 @@ (draw-inline-array-prototype-tie-near-asm s1-2 s5-1 s4-1) (let ((v1-117 (-> *perf-stats* data 12))) (b! (zero? (-> v1-117 ctrl)) cfg-41 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-82 pcr0) diff --git a/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc b/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc index 5df251fab8..ccabc29003 100644 --- a/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc +++ b/test/decompiler/reference/jak1/engine/nav/navigate_REF.gc @@ -3175,27 +3175,17 @@ ;; definition for function start-collect-nav ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defun start-collect-nav () (let* ((v1-1 (-> *perf-stats* data 14)) (a0-0 (-> v1-1 ctrl)) ) (+! (-> v1-1 count) 1) (b! (zero? a0-0) cfg-2 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-0) @@ -3210,16 +3200,11 @@ ;; definition for function end-collect-nav ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun end-collect-nav () (local-vars (a0-1 int) (a0-3 int)) (let ((v1-1 (-> *perf-stats* data 14))) (b! (zero? (-> v1-1 ctrl)) cfg-2 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-1 pcr0) diff --git a/test/decompiler/reference/jak1/engine/ps2/timer_REF.gc b/test/decompiler/reference/jak1/engine/ps2/timer_REF.gc index 48c7420a47..95a36277b2 100644 --- a/test/decompiler/reference/jak1/engine/ps2/timer_REF.gc +++ b/test/decompiler/reference/jak1/engine/ps2/timer_REF.gc @@ -3,8 +3,6 @@ ;; definition for function timer-reset ;; INFO: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun timer-reset ((arg0 timer-bank)) (.sync.l) (set! (-> arg0 count) (the-as uint 0)) @@ -14,8 +12,6 @@ ) ;; definition for function timer-count -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun timer-count ((arg0 timer-bank)) (.sync.l) (let ((v0-0 (-> arg0 count))) @@ -27,8 +23,6 @@ ;; definition for function disable-irq ;; INFO: Return type mismatch int vs none. ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v0, Status] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Status, v0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defun disable-irq () (local-vars (v0-0 int)) (let ((v1-0 (the-as uint #xfffffffe))) @@ -45,8 +39,6 @@ ;; definition for function enable-irq ;; INFO: Return type mismatch int vs none. ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v0, Status] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Status, v0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defun enable-irq () (local-vars (v0-0 int)) (.mfc0 v0-0 Status) diff --git a/test/decompiler/reference/jak1/kernel/gcommon_REF.gc b/test/decompiler/reference/jak1/kernel/gcommon_REF.gc index a0b3d9b4d1..4c775144fd 100644 --- a/test/decompiler/reference/jak1/kernel/gcommon_REF.gc +++ b/test/decompiler/reference/jak1/kernel/gcommon_REF.gc @@ -883,7 +883,6 @@ ) ;; definition for function breakpoint-range-set! -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Debug, a0] ;; ERROR: Unsupported inline assembly instruction kind - [mtdab a1] ;; ERROR: Unsupported inline assembly instruction kind - [mtdabm a2] (defun breakpoint-range-set! ((arg0 uint) (arg1 uint) (arg2 uint)) diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index a16a12c554..6c8c142080 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -347,6 +347,13 @@ ) ) +(defmacro sound-play (name &key (id (new-sound-id)) + &key (vol 100.0) &key (pitch 0) &key (bend 0) + &key (group sfx) + &key (position #t)) + `(sound-play-by-name (static-sound-name ,name) ,id (the int (* (/ 1024.0 100.0) ,vol)) (the int (* 1524.0 ,pitch)) ,bend (sound-group ,group) ,position) + ) + (defmacro vftoi4.xyzw (dst src) "convert to 28.4 integer. This does the multiply while the number is still a float. This will have issues for very large floats, but it seems like this diff --git a/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc index fd35fdb186..6dc1a4c112 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc @@ -1064,10 +1064,7 @@ res-tag (make-u128 (logior (shl (shl #x8001 16) 32) (shr (shl (the-as int vector) 32) 32)) - (the-as - res-tag - (logior (shl (-> (new 'static 'array uint64 1 #xce6e6b28) 0) 32) (shr (shl (the-as int arg0) 32) 32)) - ) + (the-as res-tag (logior (shl (the-as uint #xce6e6b28) 32) (shr (shl (the-as int arg0) 32) 32))) ) ) (the-as pointer (new 'static 'vector4w)) @@ -1096,7 +1093,7 @@ res-tag (make-u128 (the-as res-tag (logior (shl (shl #x8001 16) 32) (shr (shl (the-as int quaternion) 32) 32))) - (logior (shl (-> (new 'static 'array uint64 1 #xce6e6b28) 0) 32) (shr (shl (the-as int arg1) 32) 32)) + (logior (shl (the-as uint #xce6e6b28) 32) (shr (shl (the-as int arg1) 32) 32)) ) ) (the-as pointer (quaternion-identity! (new 'static 'quaternion))) @@ -2519,13 +2516,11 @@ (let ((f0-2 (+ f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 f0-0)))) (add-32bit-data! (-> self cam-entity) - (the-as - res-tag - (make-u128 - (the-as res-tag (logior (shl #x10000 32) (shr (shl (the-as int float) 32) 32))) - (logior (shl (-> (new 'static 'array uint64 1 #xce6e6b28) 0) 32) (shr (shl (the-as int arg0) 32) 32)) - ) - ) + (the-as res-tag (make-u128 + (the-as res-tag (logior (shl #x10000 32) (shr (shl (the-as int float) 32) 32))) + (logior (shl (the-as uint #xce6e6b28) 32) (shr (shl (the-as int arg0) 32) 32)) + ) + ) f0-2 ) ) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc index a27e50ac98..0805fb3dcf 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc @@ -5,9 +5,9 @@ (deftype collide-query (structure) ((best-other-tri collide-tri-result :inline :offset-assert 0) (best-my-tri collide-tri-result :inline :offset 0) - (ignore-processes process 2 :offset-assert 88) - (ignore-process0 process :offset 88) - (ignore-process1 process :offset 92) + (ignore-processes process-tree 2 :offset-assert 88) + (ignore-process0 process-tree :offset 88) + (ignore-process1 process-tree :offset 92) (ignore-pat pat-surface :offset-assert 96) (collide-with collide-spec :offset-assert 100) (overlay-params uint32 3 :offset 112) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc index 6477c9992c..d23fec6988 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc @@ -1315,7 +1315,7 @@ (collide-shape-method-34 () none 34) (collide-shape-method-35 () none 35) (collide-shape-method-36 () none 36) - (collide-shape-method-37 () none 37) + (collide-shape-method-37 (_type_ vector) none 37) (collide-shape-method-38 () none 38) (collide-shape-method-39 () none 39) (find-overlapping-shapes (_type_ overlaps-others-params) symbol 40) @@ -1325,8 +1325,8 @@ (collide-shape-method-44 () none 44) (collide-shape-method-45 () none 45) (collide-shape-method-46 (_type_) none 46) - (collide-shape-method-47 () none 47) - (collide-shape-method-48 () none 48) + (set-collide-with! (_type_ collide-spec) none 47) + (set-collide-as! (_type_ collide-spec) none 48) (collide-shape-method-49 (_type_ int int int) none 49) (collide-shape-method-50 (_type_ process object float float float) none 50) (collide-shape-method-51 () none 51) @@ -1621,10 +1621,10 @@ (collide-shape-moving-method-59 () none 59) (collide-shape-moving-method-60 () none 60) (collide-shape-moving-method-61 () none 61) - (collide-shape-moving-method-62 (_type_) none 62) + (compute-acc-due-to-gravity (_type_ vector float) vector 62) (collide-shape-moving-method-63 () none 63) (collide-shape-moving-method-64 () none 64) - (collide-shape-moving-method-65 () none 65) + (collide-shape-moving-method-65 (_type_ vector float float float) symbol 65) (collide-shape-moving-method-66 () none 66) (collide-shape-moving-method-67 () none 67) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc index d59e6be92f..e58e12c2b3 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc @@ -1,14 +1,11 @@ -;;-*-Lisp-*- (in-package goal) -;; failed to figure out what this is: (defskelgroup skel-crate-krimson crate 0 3 ((1 (meters 20)) (2 (meters 999999))) :bounds (static-spherem 0 1 0 1.6) :texture-level 6 ) -;; definition of type crate-bank (deftype crate-bank (basic) ((COLLIDE_YOFF float :offset-assert 4) (COLLIDE_RADIUS float :offset-assert 8) @@ -19,7 +16,6 @@ :flag-assert #x900000010 ) -;; definition for method 3 of type crate-bank (defmethod inspect crate-bank ((obj crate-bank)) (when (not obj) (set! obj obj) @@ -33,21 +29,20 @@ obj ) -;; definition for symbol *CRATE-bank*, type crate-bank (define *CRATE-bank* (new 'static 'crate-bank :COLLIDE_YOFF 4096.0 :COLLIDE_RADIUS 6963.2 :DARKECO_EXPLODE_RADIUS 16384.0) ) -;; definition of type crate (deftype crate (process-focusable) - ((smush smush-control :inline :offset-assert 208) - (base vector :inline :offset-assert 240) - (look symbol :offset-assert 256) - (defense symbol :offset-assert 260) - (incoming-attack-id uint32 :offset-assert 264) - (target handle :offset-assert 272) - (child-count int32 :offset-assert 280) - (victory-anim spool-anim :offset-assert 284) + ((root-override2 collide-shape-moving :offset 128) + (smush smush-control :inline :offset-assert 208) + (base vector :inline :offset-assert 240) + (look symbol :offset-assert 256) + (defense symbol :offset-assert 260) + (incoming-attack-id uint32 :offset-assert 264) + (target handle :offset-assert 272) + (child-count int32 :offset-assert 280) + (victory-anim spool-anim :offset-assert 284) ) :heap-base #xa0 :method-count-assert 41 @@ -71,7 +66,6 @@ ) ) -;; definition for method 3 of type crate (defmethod inspect crate ((obj crate)) (when (not obj) (set! obj obj) @@ -92,18 +86,16 @@ obj ) -;; failed to figure out what this is: (method-set! crate 12 (method-of-type process run-logic?)) -;; definition for function crate-post (defbehavior crate-post crate () (rider-trans) (smush-update! self) (rider-post) (carry-info-method-9 (-> self carry)) + (none) ) -;; failed to figure out what this is: (defpart 565 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) (sp-flt spt-num 16.0) @@ -127,12 +119,10 @@ ) ) -;; failed to figure out what this is: (defpart 566 :init-specs ((sp-flt spt-fade-a -1.0666667)) ) -;; failed to figure out what this is: (defpart 567 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x92 :page #xc)) (sp-flt spt-num 4.0) @@ -157,12 +147,10 @@ ) ) -;; failed to figure out what this is: (defpart 568 :init-specs ((sp-flt spt-fade-a -2.1333334)) ) -;; failed to figure out what this is: (defpart 569 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) (sp-flt spt-num 1.0) @@ -179,7 +167,6 @@ ) ) -;; failed to figure out what this is: (defpart 570 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc :page #xc)) (sp-flt spt-num 5.0) @@ -208,7 +195,6 @@ ) ) -;; failed to figure out what this is: (defpart 571 :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334)) (sp-copy-from-other spt-scalevel-y -4) @@ -216,7 +202,6 @@ ) ) -;; failed to figure out what this is: (defpart 572 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #xc)) (sp-flt spt-num 4.5) @@ -245,7 +230,6 @@ ) ) -;; failed to figure out what this is: (defpartgroup group-crate-explode :id 124 :duration (seconds 0.017) @@ -259,7 +243,6 @@ ) ) -;; failed to figure out what this is: (defpartgroup group-crate-steel-explode :id 125 :duration (seconds 0.017) @@ -268,7 +251,6 @@ :parts ((sp-item 565) (sp-item 567) (sp-item 569) (sp-item 572) (sp-item 572) (sp-item 572)) ) -;; failed to figure out what this is: (defpartgroup group-dark-eco-box-explosion :id 126 :duration (seconds 2) @@ -315,7 +297,6 @@ ) ) -;; failed to figure out what this is: (defpart 156 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 6.0) @@ -340,12 +321,10 @@ ) ) -;; failed to figure out what this is: (defpart 575 :init-specs ((sp-flt spt-fade-r 0.0) (sp-flt spt-fade-g 0.0) (sp-flt spt-fade-b 0.0) (sp-flt spt-fade-a -1.4222223)) ) -;; failed to figure out what this is: (defpart 574 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 3.0) @@ -363,7 +342,6 @@ ) ) -;; failed to figure out what this is: (defpart 155 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) (sp-flt spt-num 1.0) @@ -379,7 +357,6 @@ ) ) -;; failed to figure out what this is: (defpart 157 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) (sp-flt spt-num 4.0) @@ -404,7 +381,6 @@ ) ) -;; failed to figure out what this is: (defpart 154 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) (sp-flt spt-num 16.0) @@ -422,7 +398,6 @@ ) ) -;; failed to figure out what this is: (defpart 152 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 1.0) @@ -447,7 +422,6 @@ ) ) -;; failed to figure out what this is: (defpart 153 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) (sp-flt spt-num 1.0) @@ -468,7 +442,6 @@ ) ) -;; failed to figure out what this is: (defpart 573 :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #xc)) (sp-rnd-flt spt-num 8.0 16.0 1.0) @@ -497,7 +470,6 @@ ) ) -;; failed to figure out what this is: (defpart 576 :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334)) (sp-copy-from-other spt-scalevel-y -4) @@ -505,8 +477,6 @@ ) ) -;; definition for function crate-standard-event-handler -;; INFO: Used lq/sq (defbehavior crate-standard-event-handler crate ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (case arg2 (('track) @@ -533,7 +503,7 @@ (go-virtual die #f (the-as int s5-0)) ) (else - (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root-override trans y) (-> self base y))) + (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root-override2 trans y) (-> self base y))) (if (not (and (demo?) (= (-> *setting-control* user-current language) (language-enum japanese)))) (talker-spawn-func (-> *talker-speech* 313) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -562,7 +532,7 @@ (go-virtual die #f (the-as int s5-0)) ) (else - (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root-override trans y) (-> self base y))) + (when (and (!= s4-0 (-> self incoming-attack-id)) (= (-> self root-override2 trans y) (-> self base y))) (talker-spawn-func (-> *talker-speech* 318) *entity-pool* (target-pos 0) (the-as region #f)) (set! (-> self incoming-attack-id) s4-0) (if (not (!= (-> self smush amp) 0.0)) @@ -638,7 +608,7 @@ ) ) (('bonk) - (when (= (-> self root-override trans y) (-> self base y)) + (when (= (-> self root-override2 trans y) (-> self base y)) (activate! (-> self smush) -0.1 75 150 1.0 1.0 (-> self clock)) (go-virtual bounce-on) ) @@ -658,7 +628,7 @@ (or (= v1-131 'notice-blue) (= v1-131 'die)) ) ) - (!= (-> self root-override trans y) (-> self base y)) + (!= (-> self root-override2 trans y) (-> self base y)) ) ) (go-virtual notice-blue (process->handle arg0)) @@ -666,23 +636,22 @@ ) (('fall) (when (not (and (-> self next-state) (= (-> self next-state name) 'fall))) - (set! (-> self root-override transv quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (set! (-> self root-override2 transv quad) (-> (the-as vector (-> arg3 param 0)) quad)) (go-virtual fall) ) ) ) ) -;; failed to figure out what this is: (defstate hide (crate) :virtual #t :code (behavior () (process-entity-status! self (entity-perm-status dead) #f) (process-entity-status! self (entity-perm-status subtask-complete) #f) - (vector+! (-> self draw origin) (-> self root-override trans) (-> self draw bounds)) + (vector+! (-> self draw origin) (-> self root-override2 trans) (-> self draw bounds)) (set! (-> self draw origin w) (-> self draw bounds w)) (logior! (-> self draw status) (draw-control-status no-draw)) - (let ((v1-9 (-> (the-as collide-shape-moving (-> self root-override)) root-prim))) + (let ((v1-9 (-> self root-override2 root-prim))) (set! (-> v1-9 prim-core collide-as) (collide-spec)) (set! (-> v1-9 prim-core collide-with) (collide-spec)) ) @@ -690,10 +659,10 @@ (ja-post) (while (or (crate-method-40 self) (and (sphere-in-view-frustum? (the-as sphere (-> self draw origin))) - (< (vector-vector-distance (camera-pos) (-> self root-override trans)) 327680.0) + (< (vector-vector-distance (camera-pos) (-> self root-override2 trans)) 327680.0) ) (and *target* - (and (>= 40960.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) + (and (>= 40960.0 (vector-vector-distance (-> self root-override2 trans) (-> *target* control trans))) (zero? (logand (focus-status teleporting) (-> *target* focus-status))) ) ) @@ -701,26 +670,21 @@ (suspend) ) (logclear! (-> self draw status) (draw-control-status no-draw)) - (let ((v1-29 (-> (the-as collide-shape-moving (-> self root-override)) root-prim))) - (set! (-> v1-29 prim-core collide-as) - (-> (the-as collide-shape-moving (-> self root-override)) backup-collide-as) - ) - (set! (-> v1-29 prim-core collide-with) - (-> (the-as collide-shape-moving (-> self root-override)) backup-collide-with) - ) + (let ((v1-29 (-> self root-override2 root-prim))) + (set! (-> v1-29 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-29 prim-core collide-with) (-> self root-override2 backup-collide-with)) ) (go-virtual idle) (none) ) ) -;; failed to figure out what this is: (defstate idle (crate) :virtual #t :event crate-standard-event-handler :code (behavior () (suspend) - (collide-shape-method-46 (the-as collide-shape-moving (-> self root-override))) + (collide-shape-method-46 (-> self root-override2)) (carry-info-method-9 (-> self carry)) (logior! (-> self mask) (process-mask sleep)) (until #f @@ -732,7 +696,6 @@ :post (the-as (function none :behavior crate) ja-post) ) -;; failed to figure out what this is: (defstate carry (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -741,7 +704,7 @@ (-> self carry) ) (('drop) - (set! (-> self root-override transv quad) (-> (the-as vector (-> event param 1)) quad)) + (set! (-> self root-override2 transv quad) (-> (the-as vector (-> event param 1)) quad)) (go-virtual fall) ) ) @@ -751,12 +714,11 @@ (ja-post) (carry-info-method-9 (-> self carry)) (carry-info-method-13 (-> self carry)) - (collide-shape-method-46 (the-as collide-shape-moving (-> self root-override))) + (collide-shape-method-46 (-> self root-override2)) (none) ) ) -;; failed to figure out what this is: (defstate fall (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -773,47 +735,32 @@ ) ) :enter (behavior () - (when (handle->process (-> self carry other)) - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) (process->ppointer self)) - (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) 'carry-info) - (let* ((a0-9 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-1))) - (t9-1 (method-of-object a0-9 carry-info-method-12)) - ) + (if (handle->process (-> self carry other)) + (drop-impl! + (the-as carry-info (send-event (handle->process (-> self carry other)) 'carry-info)) (-> self carry) - (t9-1 a0-9) ) ) - ) - (set! (-> (the-as collide-shape-moving (-> self root-override)) status) (cshape-moving-flags)) - (set! (-> (the-as collide-shape-moving (-> self root-override)) root-prim local-sphere w) - (-> self carry carry-radius) - ) - (set! (-> (the-as collide-shape-moving (-> self root-override)) root-prim prim-core collide-with) + (set! (-> self root-override2 status) (cshape-moving-flags)) + (set! (-> self root-override2 root-prim local-sphere w) (-> self carry carry-radius)) + (set! (-> self root-override2 root-prim prim-core collide-with) (logior (collide-spec backgnd crate obstacle hit-by-others-list pusher) - (-> (the-as collide-shape-moving (-> self root-override)) root-prim prim-core collide-with) + (-> self root-override2 root-prim prim-core collide-with) ) ) (none) ) :trans (behavior () - (when (and (logtest? (-> (the-as collide-shape-moving (-> self root-override)) status) (cshape-moving-flags on-surface)) - (< 0.8 (-> (the-as collide-shape-moving (-> self root-override)) surface-angle)) + (when (and (logtest? (-> self root-override2 status) (cshape-moving-flags on-surface)) + (< 0.8 (-> self root-override2 surface-angle)) ) - (vector-reset! (-> self root-override transv)) - (when (= (vector-length (-> self root-override transv)) 0.0) - (set! (-> (the-as collide-shape-moving (-> self root-override)) root-prim local-sphere w) - (-> self carry backup-radius) - ) - (set! (-> self base quad) (-> self root-override trans quad)) - (let ((v1-16 (-> (the-as collide-shape-moving (-> self root-override)) root-prim))) - (set! (-> v1-16 prim-core collide-as) - (-> (the-as collide-shape-moving (-> self root-override)) backup-collide-as) - ) - (set! (-> v1-16 prim-core collide-with) - (-> (the-as collide-shape-moving (-> self root-override)) backup-collide-with) - ) + (vector-reset! (-> self root-override2 transv)) + (when (= (vector-length (-> self root-override2 transv)) 0.0) + (set! (-> self root-override2 root-prim local-sphere w) (-> self carry backup-radius)) + (set! (-> self base quad) (-> self root-override2 trans quad)) + (let ((v1-16 (-> self root-override2 root-prim))) + (set! (-> v1-16 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-16 prim-core collide-with) (-> self root-override2 backup-collide-with)) ) (go-virtual idle) ) @@ -822,46 +769,30 @@ ) :code (the-as (function none :behavior crate) sleep-code) :post (behavior () - (let* ((gp-0 vector-v++!) - (s5-0 (-> self root-override transv)) - (a0-0 (-> self root-override)) - (t9-0 (method-of-object (the-as collide-shape-moving a0-0) collide-shape-moving-method-62)) - ) - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - 0 - (gp-0 s5-0 (the-as vector (t9-0 (the-as collide-shape-moving a0-0)))) + (vector-v++! + (-> self root-override2 transv) + (compute-acc-due-to-gravity (-> self root-override2) (new-stack-vector0) 0.0) ) - (if (< (-> (the-as collide-shape-moving (-> self root-override)) dynam gravity-max) - (vector-length (-> self root-override transv)) - ) - (vector-normalize! - (-> self root-override transv) - (-> (the-as collide-shape-moving (-> self root-override)) dynam gravity-max) - ) + (if (< (-> self root-override2 dynam gravity-max) (vector-length (-> self root-override2 transv))) + (vector-normalize! (-> self root-override2 transv) (-> self root-override2 dynam gravity-max)) ) - (let ((gp-1 (-> self root-override))) + (let ((gp-1 (-> self root-override2))) (let ((a2-1 (new 'stack-no-clear 'collide-query))) - (set! (-> (the-as collide-shape-moving gp-1) root-prim type) collide-shape-prim-sphere) + (set! (-> gp-1 root-prim type) collide-shape-prim-sphere) (set! (-> a2-1 collide-with) (collide-spec backgnd crate obstacle pusher)) (set! (-> a2-1 ignore-process0) self) (set! (-> a2-1 ignore-process1) #f) - (set! (-> a2-1 ignore-pat) (-> (the-as collide-shape-moving gp-1) pat-ignore-mask)) + (set! (-> a2-1 ignore-pat) (-> gp-1 pat-ignore-mask)) (set! (-> a2-1 action-mask) (collide-action solid)) - (collide-shape-method-32 - (the-as collide-shape-moving gp-1) - (-> (the-as collide-shape-moving gp-1) transv) - a2-1 - (meters 0) - ) + (collide-shape-method-32 gp-1 (-> gp-1 transv) a2-1 (meters 0)) ) - (set! (-> (the-as collide-shape-moving gp-1) root-prim type) collide-shape-prim-mesh) + (set! (-> gp-1 root-prim type) collide-shape-prim-mesh) ) (crate-post) (none) ) ) -;; failed to figure out what this is: (defstate bounce-on (crate) :virtual #t :event crate-standard-event-handler @@ -872,10 +803,9 @@ (go-virtual idle) (none) ) - :post (the-as (function none :behavior crate) crate-post) + :post crate-post ) -;; failed to figure out what this is: (defstate notice-blue (crate) :virtual #t :event crate-standard-event-handler @@ -904,13 +834,13 @@ ) (when v1-3 (let* ((gp-1 (-> (the-as process-drawable v1-3) root)) - (v1-4 (if (type? (the-as collide-shape-moving gp-1) collide-shape) + (v1-4 (if (type? gp-1 collide-shape) gp-1 ) ) ) (when v1-4 - (let* ((gp-2 (-> (the-as collide-shape-moving (-> self root-override)) root-prim prim-core)) + (let* ((gp-2 (-> self root-override2 root-prim prim-core)) (a1-3 (-> (the-as collide-shape-moving v1-4) root-prim prim-core)) (f30-0 (vector-vector-distance (the-as vector gp-2) (the-as vector a1-3))) ) @@ -953,10 +883,9 @@ #f (none) ) - :post (the-as (function none :behavior crate) crate-post) + :post crate-post ) -;; failed to figure out what this is: (defstate die (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -988,7 +917,7 @@ ) :code (behavior ((arg0 symbol) (arg1 int)) (logior! (-> self focus-status) (focus-status dead)) - (let ((v1-3 (-> (the-as collide-shape (-> self root-override)) root-prim))) + (let ((v1-3 (-> (the-as collide-shape (-> self root-override2)) root-prim))) (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) ) @@ -1030,7 +959,7 @@ (case (-> self defense) (('darkeco) (let ((f0-0 - (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root-override trans) (target-pos 0)) 8192.0 40960.0) + (lerp-scale 1.0 0.0 (vector-vector-distance (-> self root-override2 trans) (target-pos 0)) 8192.0 40960.0) ) ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 f0-0)) (seconds 0.3)) @@ -1038,7 +967,7 @@ (process-spawn touch-tracker :init touch-tracker-init - (-> self root-override trans) + (-> self root-override2 trans) (-> *CRATE-bank* DARKECO_EXPLODE_RADIUS) 30 :to self @@ -1062,7 +991,7 @@ (t2-4 #f) (t3-0 *launch-matrix*) ) - (set! (-> t3-0 trans quad) (-> self root-override trans quad)) + (set! (-> t3-0 trans quad) (-> self root-override2 trans quad)) ((the-as (function object object object object object object object object none) t9-18) a0-34 a1-21 @@ -1094,7 +1023,7 @@ (t2-5 #f) (t3-1 *launch-matrix*) ) - (set! (-> t3-1 trans quad) (-> self root-override trans quad)) + (set! (-> t3-1 trans quad) (-> self root-override2 trans quad)) ((the-as (function object object object object object object object object none) t9-21) a0-39 a1-27 @@ -1126,7 +1055,7 @@ (t2-6 #f) (t3-2 *launch-matrix*) ) - (set! (-> t3-2 trans quad) (-> self root-override trans quad)) + (set! (-> t3-2 trans quad) (-> self root-override2 trans quad)) ((the-as (function object object object object object object object object none) t9-24) a0-42 a1-32 @@ -1162,11 +1091,7 @@ ) ) ) - (let ((t9-29 (method-of-object (-> self fact) fact-info-method-9))) - #t - *entity-pool* - (t9-29) - ) + (drop-pickup (-> self fact) #t *entity-pool* (the-as fact-info #f) arg1) (process-entity-status! self (entity-perm-status dead) #t) (process-entity-status! self (entity-perm-status subtask-complete) #t) (let ((gp-1 (-> self clock frame-counter))) @@ -1186,7 +1111,6 @@ ) ) -;; failed to figure out what this is: (defstate special-contents-die (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -1238,18 +1162,13 @@ ) ) ) - (let ((v1-20 (-> (the-as collide-shape-moving (-> self root-override)) root-prim))) + (let ((v1-20 (-> self root-override2 root-prim))) (set! (-> v1-20 prim-core collide-as) (collide-spec)) (set! (-> v1-20 prim-core collide-with) (collide-spec)) ) 0 (logior! (-> self draw status) (draw-control-status no-draw)) - (let ((t9-0 (method-of-object (-> self fact) fact-info-method-9))) - #t - self - 0 - (t9-0) - ) + (drop-pickup (-> self fact) #t self (the-as fact-info #f) 0) (set! (-> self child-count) (+ (process-count self) -1)) (process-entity-status! self (entity-perm-status bit-4) #t) (when (-> self entity) @@ -1269,11 +1188,9 @@ ) ) -;; definition for function crate-init-by-other -;; INFO: Used lq/sq (defbehavior crate-init-by-other crate ((arg0 entity) (arg1 vector) (arg2 symbol) (arg3 fact-info-crate)) (crate-init! self (the-as entity-actor arg0)) - (set! (-> self root-override trans quad) (-> arg1 quad)) + (set! (-> self root-override2 trans quad) (-> arg1 quad)) (set! (-> self look) arg2) (set! (-> self defense) arg2) (skel-init! self) @@ -1286,7 +1203,6 @@ (none) ) -;; definition for method 11 of type crate (defmethod init-from-entity! crate ((obj crate) (arg0 entity-actor)) (crate-init! obj arg0) (skel-init! obj) @@ -1294,8 +1210,6 @@ (none) ) -;; definition for method 35 of type crate -;; WARN: Return type mismatch crate vs none. (defmethod crate-init! crate ((obj crate) (arg0 entity-actor)) "Initialize the [[crate]] with the specified [[entity-actor]]." (stack-size-set! (-> obj main-thread) 128) @@ -1340,7 +1254,7 @@ knocked ) ) - (set! (-> obj root-override) s4-0) + (set! (-> obj root-override2) s4-0) ) (set! (-> obj fact) (new 'process 'fact-info-crate obj (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) @@ -1384,14 +1298,11 @@ (none) ) -;; definition for method 36 of type crate -;; INFO: Used lq/sq -;; WARN: Return type mismatch crate vs none. (defmethod skel-init! crate ((obj crate)) "Initialize the [[crate]]'s skeleton and other parameters based on the crate type." (case (-> obj look) (('iron) - (set! (-> (the-as collide-shape-moving (-> obj root-override)) penetrated-by) + (set! (-> obj root-override2 penetrated-by) (penetrate flop uppercut tube vehicle flut-attack board dark-skin explode) ) (initialize-skeleton @@ -1401,9 +1312,7 @@ ) ) (('steel) - (set! (-> (the-as collide-shape-moving (-> obj root-override)) penetrated-by) - (penetrate tube vehicle flut-attack board dark-skin explode) - ) + (set! (-> obj root-override2 penetrated-by) (penetrate tube vehicle flut-attack board dark-skin explode)) (initialize-skeleton obj (the-as skeleton-group (art-group-get-by-name *level* "skel-crate-krimson" (the-as (pointer uint32) #f))) @@ -1439,14 +1348,12 @@ ) ) ) - (set! (-> obj base quad) (-> obj root-override trans quad)) + (set! (-> obj base quad) (-> obj root-override2 trans quad)) (crate-post) (nav-mesh-connect-from-ent (the-as entity-nav-mesh obj)) (none) ) -;; definition for method 37 of type crate -;; WARN: Return type mismatch crate vs none. (defmethod params-set! crate ((obj crate) (arg0 symbol) (arg1 symbol)) "Set [[crate]] params based on the arguments." (if arg0 @@ -1458,8 +1365,6 @@ (none) ) -;; definition for method 38 of type crate -;; WARN: Return type mismatch int vs none. (defmethod crate-method-38 crate ((obj crate)) (when (-> obj entity) (if (>= (-> obj entity extra perm user-int8 0) 1) @@ -1481,20 +1386,16 @@ (none) ) -;; definition for method 39 of type crate -;; WARN: Return type mismatch int vs none. (defmethod smush-update! crate ((obj crate)) (let ((f0-0 (update! (-> obj smush)))) - (set! (-> obj root-override scale x) (+ 1.0 (* -0.5 f0-0))) - (set! (-> obj root-override scale y) (+ 1.0 f0-0)) - (set! (-> obj root-override scale z) (+ 1.0 (* -0.5 f0-0))) + (set! (-> obj root-override2 scale x) (+ 1.0 (* -0.5 f0-0))) + (set! (-> obj root-override2 scale y) (+ 1.0 f0-0)) + (set! (-> obj root-override2 scale z) (+ 1.0 (* -0.5 f0-0))) ) 0 (none) ) -;; definition for method 40 of type crate -;; WARN: disable def twice: 57. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod crate-method-40 crate ((obj crate)) (cond ((and (> (-> (the-as fact-info-crate (-> obj fact)) suck-count) 0) @@ -1526,7 +1427,6 @@ ) ) -;; definition of type pickup-spawner (deftype pickup-spawner (crate) ((blocker entity-actor :offset-assert 288) ) @@ -1536,7 +1436,6 @@ :flag-assert #x2900b00124 ) -;; definition for method 3 of type pickup-spawner (defmethod inspect pickup-spawner ((obj pickup-spawner)) (when (not obj) (set! obj obj) @@ -1550,8 +1449,6 @@ obj ) -;; definition for method 35 of type pickup-spawner -;; WARN: Return type mismatch pickup-spawner vs none. (defmethod crate-init! pickup-spawner ((obj pickup-spawner) (arg0 entity-actor)) "Initialize the [[crate]] with the specified [[entity-actor]]." (let ((t9-0 (method-of-type crate crate-init!))) @@ -1565,15 +1462,12 @@ (none) ) -;; definition for method 38 of type pickup-spawner -;; WARN: Return type mismatch int vs none. (defmethod crate-method-38 pickup-spawner ((obj pickup-spawner)) (go (method-of-object obj idle)) 0 (none) ) -;; failed to figure out what this is: (defstate idle (pickup-spawner) :virtual #t :code (behavior () diff --git a/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc index 78a5e73e1c..6227120baa 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc @@ -166,22 +166,22 @@ ;; definition of type lightning-tracker (deftype lightning-tracker (process) - ((root basic :offset-assert 128) - (lightning lightning-spec :offset-assert 132) - (callback basic :offset-assert 136) - (duration uint64 :offset-assert 144) - (start-time time-frame :offset-assert 152) - (offset0 vector :inline :offset-assert 160) - (offset1 vector :inline :offset-assert 176) - (target0 uint64 :offset-assert 192) - (target1 uint64 :offset-assert 200) - (target-joint0 int32 :offset-assert 208) - (target-joint1 int32 :offset-assert 212) - (sound uint32 :offset-assert 216) - (userdata uint64 :offset-assert 224) - (user-time time-frame 2 :offset-assert 232) - (user-vector vector :inline :offset-assert 256) - (user-handle handle 2 :offset 288) + ((root trsqv :offset-assert 128) + (lightning lightning-spec :offset-assert 132) + (callback (function lightning-tracker none) :offset-assert 136) + (duration uint64 :offset-assert 144) + (start-time time-frame :offset-assert 152) + (offset0 vector :inline :offset-assert 160) + (offset1 vector :inline :offset-assert 176) + (target0 uint64 :offset-assert 192) + (target1 uint64 :offset-assert 200) + (target-joint0 int32 :offset-assert 208) + (target-joint1 int32 :offset-assert 212) + (sound uint32 :offset-assert 216) + (userdata uint64 :offset-assert 224) + (user-time time-frame 2 :offset-assert 232) + (user-vector vector :inline :offset-assert 256) + (user-handle handle 2 :offset 288) ) :heap-base #xb0 :method-count-assert 17 diff --git a/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc index baeeb3f172..26f63dd59e 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/projectile-h_REF.gc @@ -3,7 +3,8 @@ ;; definition of type projectile (deftype projectile (process-drawable) - ((starting-pos vector :inline :offset-assert 208) + ((root-override collide-shape-moving :offset 128) + (starting-pos vector :inline :offset-assert 208) (starting-dir vector :inline :offset-assert 224) (target-pos vector :inline :offset-assert 240) (base-target-pos vector :inline :offset-assert 256) @@ -16,8 +17,8 @@ (owner-handle handle :offset-assert 328) (ignore-handle handle :offset-assert 336) (update-velocity (function projectile none) :offset-assert 344) - (move basic :offset-assert 348) - (pick-target basic :offset-assert 352) + (move (function projectile none) :offset-assert 348) + (pick-target (function projectile none) :offset-assert 352) (max-speed float :offset-assert 356) (old-dist float 16 :offset-assert 360) (old-dist-count int32 :offset-assert 424) @@ -37,26 +38,26 @@ :size-assert #x1d8 :flag-assert #x28016001d8 (:methods - (projectile-method-20 () none 20) - (projectile-method-21 () none 21) - (projectile-method-22 () none 22) - (projectile-method-23 () none 23) - (projectile-method-24 () none 24) - (projectile-method-25 () none 25) - (projectile-method-26 () none 26) - (projectile-method-27 () none 27) - (projectile-method-28 () none 28) - (projectile-method-29 () none 29) - (projectile-method-30 () none 30) - (projectile-method-31 (_type_) none 31) - (projectile-method-32 () none 32) - (projectile-method-33 () none 33) - (projectile-method-34 () none 34) - (projectile-method-35 () none 35) - (projectile-method-36 () none 36) - (projectile-method-37 () none 37) - (projectile-method-38 () none 38) - (projectile-method-39 () none 39) + (die () _type_ :state 20) + (dissipate () _type_ :state 21) + (impact () _type_ :state 22) + (moving () _type_ :state 23) + (draw-laser-sight (_type_) none 24) + (spawn-impact-particles (_type_) none 25) + (spawn-shell-particles (_type_) none 26) + (unknown-particles (_type_) none 27) + (play-impact-sound (_type_ projectile-options) sound-id 28) + (stop-sound! (_type_) none 29) + (init-collision! (_type_) none 30) + (init-proj-settings! (_type_) none 31) + (go-moving! (_type_) none 32) + (go-sitting! (_type_) none 33) + (kill-projectile! (_type_) symbol 34) + (event-handler! (_type_ process int symbol event-message-block) object 35) + (handle-proj-hit! (_type_ process event-message-block) object 36) + (deal-damage! (_type_ process event-message-block) symbol 37) + (made-impact? (_type_) symbol 38) + (play-impact-sound! (_type_) sound-id :behavior projectile 39) ) ) @@ -103,7 +104,7 @@ ;; definition of type projectile-init-by-other-params (deftype projectile-init-by-other-params (structure) - ((ent basic :offset-assert 0) + ((ent entity :offset-assert 0) (charge float :offset-assert 4) (attack-id uint32 :offset-assert 8) (options projectile-options :offset-assert 16) @@ -155,6 +156,7 @@ ;; definition of type projectile-bounce (deftype projectile-bounce (projectile) + "This seems to be the scrapped peacemaker gun implementation - the bouncing dark eco grenade launcher" ((played-bounce-time time-frame :offset-assert 472) (tumble-quat quaternion :inline :offset-assert 480) ) @@ -163,8 +165,8 @@ :size-assert #x1f0 :flag-assert #x2a017001f0 (:methods - (projectile-bounce-method-40 () none 40) - (projectile-bounce-method-41 () none 41) + (sitting () _type_ :state 40) + (noop (_type_) none 41) ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc new file mode 100644 index 0000000000..9188da989f --- /dev/null +++ b/test/decompiler/reference/jak2/engine/common_objs/projectile_REF.gc @@ -0,0 +1,738 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function cshape-reaction-projectile +(defun cshape-reaction-projectile ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + "A projectile's collision reaction -- if the projectile hits a material with [[pat-material::stopproj]] set, kill the projectile" + (let ((s5-0 (cshape-reaction-default arg0 arg1 arg2 arg3))) + (case (-> arg1 best-other-tri pat material) + (((pat-material stopproj)) + (send-event (-> arg0 process) 'die) + ) + ) + s5-0 + ) + ) + +;; definition for method 39 of type projectile +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound! projectile ((obj projectile)) + "Plays impact sound + :virtual" + (the-as sound-id 0) + ) + +;; definition for method 35 of type projectile +(defmethod event-handler! projectile ((obj projectile) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Multiplex the projectile's event processing, called by [[projectile-event-handler]]" + (case arg2 + (('track) + (let ((v0-0 (the-as object (process->handle (the-as process (-> arg3 param 0)))))) + (set! (-> obj last-target) (the-as handle v0-0)) + v0-0 + ) + ) + (('touched 'touch) + (handle-proj-hit! obj arg0 arg3) + ) + (('die) + (kill-projectile! obj) + ) + ) + ) + +;; definition for function projectile-event-handler +;; WARN: Return type mismatch object vs projectile. +(defbehavior projectile-event-handler projectile ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (the-as projectile (event-handler! self arg0 arg1 arg2 arg3)) + ) + +;; definition for method 37 of type projectile +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs symbol. +(defmethod deal-damage! projectile ((obj projectile) (arg0 process) (arg1 event-message-block)) + "Constructs an [[attack-info]] according to the projectile's `options`" + (let ((v1-1 (new 'stack 'attack-info))) + (let ((a0-2 v1-1)) + (set! (-> a0-2 mode) (-> obj attack-mode)) + (set! (-> a0-2 id) (-> obj attack-id)) + (set! (-> a0-2 mask) (attack-info-mask mode id)) + ) + (when (!= (-> obj owner-handle) #f) + (set! (-> v1-1 attacker) (-> obj owner-handle)) + (logior! (-> v1-1 mask) (attack-info-mask attacker)) + ) + (when (logtest? (-> obj options) (projectile-options account-for-target-velocity)) + (set! (-> v1-1 attacker-velocity quad) (-> obj pre-move-transv quad)) + (set! (-> v1-1 mask) (logior (attack-info-mask attacker-velocity) (-> v1-1 mask))) + ) + (when (logtest? (-> obj options) (projectile-options deal-damage)) + (set! (-> v1-1 damage) (-> obj damage)) + (set! (-> v1-1 mask) (logior (attack-info-mask damage) (-> v1-1 mask))) + ) + (when (logtest? (projectile-options respect-invinc-time) (-> obj options)) + (set! (-> v1-1 invinc-time) (-> obj invinc-time)) + (logior! (-> v1-1 mask) (attack-info-mask invinc-time)) + ) + (the-as symbol (send-event + arg0 + (if (logtest? (projectile-options ignore-impact) (-> obj options)) + 'attack-invinc + 'attack + ) + arg1 + v1-1 + ) + ) + ) + ) + +;; definition for method 36 of type projectile +(defmethod handle-proj-hit! projectile ((obj projectile) (arg0 process) (arg1 event-message-block)) + "When a projectile hits something, first deal damage via [[projectile::37]] + and increment the projectiles hit count. + + If we've met or exceeded the projectiles maximum allowed hits, switch to the [[projectile::impact]] state" + (when (-> obj attack-mode) + (let ((a2-1 (-> arg1 param 0))) + (when (deal-damage! obj arg0 (the-as event-message-block a2-1)) + (let ((v1-3 (-> obj notify-handle))) + (send-event (handle->process v1-3) 'notify 'attack arg0) + ) + (+! (-> obj hits) 1) + (if (and (>= (-> obj hits) (-> obj max-hits)) + (not (and (-> obj next-state) (= (-> obj next-state name) 'impact))) + ) + (go (method-of-object obj impact)) + ) + ) + ) + ) + ) + +;; definition for method 34 of type projectile +(defmethod kill-projectile! projectile ((obj projectile)) + "Transition to the [[projectile::impact]] state, always return [[#t]]" + (if (not (and (-> obj next-state) (= (-> obj next-state name) 'impact))) + (go (method-of-object obj impact)) + ) + #t + ) + +;; definition for method 24 of type projectile +;; WARN: Return type mismatch int vs none. +(defmethod draw-laser-sight projectile ((obj projectile)) + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + 0 + (none) + ) + +;; definition for method 25 of type projectile +;; WARN: Return type mismatch int vs none. +(defmethod spawn-impact-particles projectile ((obj projectile)) + "Spawns associated particles with the projectile if applicable" + (if (nonzero? (-> obj part)) + (spawn (-> obj part) (-> obj root-override trans)) + ) + 0 + (none) + ) + +;; definition for method 26 of type projectile +;; WARN: Return type mismatch int vs none. +(defmethod spawn-shell-particles projectile ((obj projectile)) + "TODO - confirm" + 0 + (none) + ) + +;; definition for method 27 of type projectile +;; WARN: Return type mismatch int vs none. +(defmethod unknown-particles projectile ((obj projectile)) + "TODO - confirm" + 0 + (none) + ) + +;; definition for method 28 of type projectile +;; WARN: Return type mismatch int vs sound-id. +(defmethod play-impact-sound projectile ((obj projectile) (arg0 projectile-options)) + (the-as sound-id 0) + ) + +;; definition for method 29 of type projectile +;; WARN: Return type mismatch int vs none. +(defmethod stop-sound! projectile ((obj projectile)) + "Stops the current `sound-id` if set, re-init the `sound-id` after being stopped" + (when (nonzero? (-> obj sound-id)) + (sound-stop (-> obj sound-id)) + (set! (-> obj sound-id) (new 'static 'sound-id)) + 0 + ) + 0 + (none) + ) + +;; definition for method 38 of type projectile +(defmethod made-impact? projectile ((obj projectile)) + "TODO - queries the collision cache, return true/false" + (let ((v1-0 (-> obj root-override))) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a1-0 ignore-process0) obj) + (set! (-> a1-0 ignore-process1) (handle->process (-> obj ignore-handle))) + (set! (-> a1-0 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a1-0 action-mask) (collide-action solid)) + ) + (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) + ) + ) + +;; definition for function projectile-move-fill-all-dirs +;; WARN: Return type mismatch int vs none. +(defun projectile-move-fill-all-dirs ((arg0 projectile)) + (let ((v1-0 (-> arg0 root-override)) + (a2-0 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> a2-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a2-0 ignore-process0) arg0) + (set! (-> a2-0 ignore-process1) (handle->process (-> arg0 ignore-handle))) + (set! (-> a2-0 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a2-0 action-mask) (collide-action solid)) + (collide-shape-method-32 v1-0 (-> v1-0 transv) a2-0 (meters 0)) + ) + 0 + (none) + ) + +;; definition for function projectile-move-fill-line-sphere +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun projectile-move-fill-line-sphere ((arg0 projectile)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (-> arg0 root-override))) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (let ((a2-0 (-> gp-0 root-prim))) + (set! (-> a1-0 start-pos quad) (-> gp-0 trans quad)) + (let ((v1-1 (-> a1-0 move-dist))) + (.lvf vf1 (&-> (-> gp-0 transv) quad)) + (let ((f0-0 (-> pp clock seconds-per-frame))) + (.mov at-0 f0-0) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-1 quad) vf1) + ) + (let ((v1-2 a1-0)) + (set! (-> v1-2 radius) (-> a2-0 prim-core world-sphere w)) + (set! (-> v1-2 collide-with) (-> a2-0 prim-core collide-with)) + (set! (-> v1-2 ignore-process0) arg0) + (set! (-> v1-2 ignore-process1) (handle->process (-> arg0 ignore-handle))) + (set! (-> v1-2 ignore-pat) (-> gp-0 pat-ignore-mask)) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + ) + (fill-using-line-sphere *collide-cache* a1-0) + ) + (collide-shape-method-37 gp-0 (-> gp-0 transv)) + ) + 0 + (none) + ) + ) + ) + +;; definition for function projectile-update-velocity-add-gravity +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun projectile-update-velocity-add-gravity ((arg0 projectile)) + (vector-v++! + (-> arg0 root-override transv) + (compute-acc-due-to-gravity (-> arg0 root-override) (new-stack-vector0) 1.0) + ) + 0 + (none) + ) + +;; definition for function projectile-update-velocity-space-wars +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun projectile-update-velocity-space-wars ((arg0 projectile)) + (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> arg0 target-pos) (-> arg0 root-override trans)))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 root-override transv) 1.0)) + (f30-0 (vector-length (-> arg0 root-override transv))) + ) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (vector-flatten! s5-1 s5-1 (-> arg0 root-override local-normal)) + ) + (vector-normalize-copy! s4-0 s5-1 1.0) + (if (and (or (not (handle->process (-> arg0 last-target))) + (zero? (-> (the-as collide-shape (-> (the-as process-drawable (handle->process (-> arg0 last-target))) root)) + root-prim + prim-core + collide-as + ) + ) + ) + (< (vector-dot s4-0 s3-0) 0.0) + ) + (go (method-of-object arg0 dissipate)) + ) + (vector-deg-slerp (-> arg0 root-override transv) s3-0 s4-0 (-> arg0 tween)) + (vector-normalize! (-> arg0 root-override transv) f30-0) + ) + (vector+! (-> arg0 root-override transv) (-> arg0 root-override transv) s5-1) + ) + (vector-v++! + (-> arg0 root-override transv) + (compute-acc-due-to-gravity (-> arg0 root-override) (new-stack-vector0) 0.0) + ) + (if (< (-> arg0 max-speed) (vector-length (-> arg0 root-override transv))) + (vector-normalize! (-> arg0 root-override transv) (-> arg0 max-speed)) + ) + (if (logtest? (-> arg0 options) (projectile-options lose-altitude)) + (set! (-> arg0 root-override transv y) -40960.0) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate moving (projectile) + :virtual #t + :event projectile-event-handler + :exit (behavior () + (stop-sound! self) + (none) + ) + :trans (behavior () + (if (>= (- (-> self clock frame-counter) (-> self spawn-time)) (-> self timeout)) + (go-virtual dissipate) + ) + (let ((t9-1 (-> self pick-target))) + (if t9-1 + (t9-1 self) + ) + ) + (let ((t9-2 (-> self update-velocity))) + (if t9-2 + (t9-2 self) + ) + ) + (when (logtest? (-> self options) (projectile-options proj-options-2)) + (seek! (-> self tween) 1.0 (* 0.5 (-> self clock seconds-per-frame))) + (let ((f0-4 (vector-vector-distance (-> self root-override trans) (-> self target-pos)))) + (cond + ((< f0-4 20480.0) + (seek! (-> self tween) 1.0 (* 3.0 (-> self clock seconds-per-frame))) + ) + ((< f0-4 40960.0) + (seek! (-> self tween) 1.0 (-> self clock seconds-per-frame)) + ) + ) + ) + ) + (let ((gp-0 (-> self root-override))) + (set! (-> self pre-move-transv quad) (-> gp-0 transv quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> gp-0 trans quad)) + ((-> self move) self) + (play-impact-sound! self) + (set! (-> self old-dist (-> self old-dist-count)) (* 0.0625 (vector-vector-distance s5-0 (-> gp-0 trans)))) + ) + ) + (set! (-> self old-dist-count) (logand (+ (-> self old-dist-count) 1) 15)) + (let ((f0-14 0.0)) + (countdown (v1-38 16) + (+! f0-14 (-> self old-dist v1-38)) + ) + (if (or (and (logtest? (-> self options) (projectile-options proj-options-4)) + (and (logtest? (-> self root-override status) (cshape-moving-flags t-wall)) (< f0-14 2048.0)) + ) + (< f0-14 (-> self stop-speed)) + ) + (go-sitting! self) + ) + ) + (none) + ) + :code (behavior () + (until #f + (spawn-impact-particles self) + (play-impact-sound self (projectile-options lose-altitude proj-options-2)) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate impact (projectile) + :virtual #t + :event projectile-event-handler + :enter (behavior () + (spawn-shell-particles self) + (play-impact-sound self (projectile-options lose-altitude)) + (none) + ) + :code (behavior () + (suspend) + (go-virtual die) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate dissipate (projectile) + :virtual #t + :event projectile-event-handler + :enter (behavior () + (unknown-particles self) + (play-impact-sound self (projectile-options proj-options-2)) + (none) + ) + :code (behavior () + (suspend) + (go-virtual die) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate die (projectile) + :virtual #t + :code (behavior () + (let ((v1-0 (-> self notify-handle))) + (send-event (handle->process v1-0) 'notify 'die) + ) + (process-drawable-method-17 self) + (none) + ) + ) + +;; definition for method 31 of type projectile +;; WARN: Return type mismatch int vs none. +(defmethod init-proj-settings! projectile ((obj projectile)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + 0 + (none) + ) + +;; definition for method 30 of type projectile +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! projectile ((obj projectile)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-projectile) + (set! (-> s5-0 no-reaction) nothing) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-6 prim-core collide-with) + (collide-spec backgnd crate civilian enemy obstacle vehicle-sphere hit-by-others-list pusher) + ) + (set! (-> v1-6 prim-core action) (collide-action solid)) + (set-vector! (-> v1-6 local-sphere) 0.0 5324.8 0.0 5324.8) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + 0 + (none) + ) + +;; definition for method 32 of type projectile +;; WARN: Return type mismatch int vs none. +(defmethod go-moving! projectile ((obj projectile)) + (go (method-of-object obj moving)) + 0 + (none) + ) + +;; definition for method 33 of type projectile +;; WARN: Return type mismatch object vs none. +(defmethod go-sitting! projectile ((obj projectile)) + (if (not (and (-> obj next-state) (= (-> obj next-state name) 'impact))) + (go (method-of-object obj impact)) + ) + (none) + ) + +;; definition for method 10 of type projectile +(defmethod deactivate projectile ((obj projectile)) + (stop-sound! obj) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; definition for function projectile-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs projectile. +(defbehavior projectile-init-by-other projectile ((arg0 projectile-init-by-other-params)) + (stack-size-set! (-> self main-thread) 512) + (logclear! (-> self mask) (process-mask actor-pause)) + (process-entity-set! self (the-as entity-actor (-> arg0 ent))) + (set! (-> self charge-level) (-> arg0 charge)) + (set! (-> self options) (-> arg0 options)) + (set! (-> self notify-handle) (-> arg0 notify-handle)) + (set! (-> self owner-handle) (-> arg0 owner-handle)) + (set! (-> self ignore-handle) (-> arg0 ignore-handle)) + (set! (-> self attack-id) (-> arg0 attack-id)) + (set! (-> self attack-mode) #f) + (set! (-> self max-speed) 40960.0) + (set! (-> self tween) 1.0) + (set! (-> self last-target) (the-as handle #f)) + (set! (-> self timeout) (the-as time-frame (-> arg0 timeout))) + (set! (-> self max-hits) 1) + (set! (-> self spawn-time) (-> self clock frame-counter)) + (set! (-> self update-velocity) #f) + (set! (-> self move) projectile-move-fill-line-sphere) + (set! (-> self pick-target) #f) + (set! (-> self stop-speed) 204.8) + (set! (-> self damage) 1.0) + (countdown (v1-18 16) + (set! (-> self old-dist v1-18) 4095996000.0) + ) + (logior! (-> self options) (projectile-options proj-options-4)) + (init-collision! self) + (let ((s5-0 (-> self root-override))) + (when (type? s5-0 collide-shape-moving) + (set! (-> self root-override dynam gravity y) 1228800.0) + (set! (-> self root-override dynam gravity-length) 1228800.0) + (set! (-> self root-override dynam gravity-max) 1228800.0) + ) + (set! (-> self mask) (logior (process-mask projectile) (-> self mask))) + (logclear! (-> self mask) (process-mask enemy)) + (set! (-> s5-0 trans quad) (-> arg0 pos quad)) + (set! (-> self starting-pos quad) (-> arg0 pos quad)) + (quaternion-copy! (-> s5-0 quat) (-> (the-as process-drawable (-> self parent 0)) root quat)) + (vector-identity! (-> s5-0 scale)) + (set! (-> s5-0 transv quad) (-> arg0 vel quad)) + (set! (-> self pre-move-transv quad) (-> arg0 vel quad)) + (vector-normalize-copy! (-> self starting-dir) (-> arg0 vel) 1.0) + (vector+float*! (-> self base-target-pos) (-> s5-0 trans) (-> self starting-dir) 2048000.0) + ) + (set! (-> self target-pos quad) (-> self base-target-pos quad)) + (set! (-> self event-hook) projectile-event-handler) + (init-proj-settings! self) + (collide-shape-method-46 (-> self root-override)) + (draw-laser-sight self) + (play-impact-sound self (projectile-options)) + (when (logtest? (-> self options) (projectile-options proj-options-8000)) + (if (made-impact? self) + (go-virtual impact) + ) + ) + (go-moving! self) + (the-as projectile 0) + ) + +;; definition for function projectile-bounce-update-velocity +;; WARN: Return type mismatch int vs none. +(defbehavior projectile-bounce-update-velocity projectile ((arg0 projectile-bounce)) + (set! (-> arg0 root-override transv y) + (- (-> arg0 root-override transv y) (* 184320.0 (-> self clock seconds-per-frame))) + ) + 0 + (none) + ) + +;; definition for function projectile-bounce-falling-post +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior projectile-bounce-falling-post projectile-bounce ((arg0 projectile-bounce)) + (let ((gp-0 (-> self root-override)) + (s4-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (projectile-bounce-update-velocity self) + (set! (-> s5-0 quad) (-> gp-0 trans quad)) + (vector-v++! s5-0 (-> gp-0 transv)) + (when (collide-shape-moving-method-55 + gp-0 + s4-0 + (collide-spec backgnd crate obstacle hit-by-others-list pusher) + 4096.0 + 81920.0 + 1024.0 + ) + (let ((f0-1 (+ (-> gp-0 gspot-pos y) (-> self root-override root-prim local-sphere w)))) + (when (>= f0-1 (-> s5-0 y)) + (set! (-> s5-0 y) f0-1) + (vector-reset! (-> gp-0 transv)) + ) + ) + ) + (collide-shape-method-29 gp-0 s5-0) + ) + (transform-post) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate sitting (projectile-bounce) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior projectile-bounce) + projectile-event-handler + ) + :trans (behavior () + (noop self) + (if (>= (- (-> self clock frame-counter) (-> self spawn-time)) (-> self timeout)) + (go-virtual impact) + ) + (none) + ) + :code (the-as (function none :behavior projectile-bounce) sleep-code) + :post (the-as (function none :behavior projectile-bounce) projectile-bounce-falling-post) + ) + +;; definition for method 41 of type projectile-bounce +;; WARN: Return type mismatch int vs none. +(defmethod noop projectile-bounce ((obj projectile-bounce)) + "Does nothing" + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate dissipate (projectile-bounce) + :virtual #t + :enter (behavior () + (go-virtual impact) + (none) + ) + ) + +;; definition for method 33 of type projectile-bounce +;; WARN: Return type mismatch object vs none. +(defmethod go-sitting! projectile-bounce ((obj projectile-bounce)) + (go (method-of-object obj sitting)) + (none) + ) + +;; definition for method 25 of type projectile-bounce +;; WARN: Return type mismatch int vs none. +(defmethod spawn-impact-particles projectile-bounce ((obj projectile-bounce)) + "Spawns associated particles with the projectile if applicable" + (ja-post) + 0 + (none) + ) + +;; definition for function projectile-bounce-move +(defun projectile-bounce-move ((arg0 projectile-bounce)) + (seek-toward-heading-vec! (-> arg0 root-override) (-> arg0 root-override transv) 131072.0 (seconds 0.1)) + (quaternion*! (-> arg0 root-override quat) (-> arg0 root-override quat) (-> arg0 tumble-quat)) + (projectile-move-fill-all-dirs arg0) + (none) + ) + +;; definition for function projectile-bounce-reaction +(defun projectile-bounce-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (cshape-reaction-update-state arg0 arg1 arg3) + (let ((f30-0 (vector-dot arg3 (-> arg0 surface-normal))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! s2-0 (-> arg0 surface-normal) (* f30-0 (rand-vu-float-range 1.6 2.2))) + (vector-! arg2 arg3 s2-0) + ) + (-> arg0 status) + ) + +;; definition for method 39 of type projectile-bounce +(defmethod play-impact-sound! projectile-bounce ((obj projectile-bounce)) + "Plays impact sound + :virtual" + (let* ((a2-0 (-> obj root-override)) + (v1-0 (-> a2-0 status)) + ) + (if (logtest? v1-0 (cshape-moving-flags t-surface)) + (vector-float*! (-> a2-0 transv) (-> a2-0 transv) 0.6) + ) + (when (and (logtest? v1-0 (cshape-moving-flags csmf11)) + (>= (- (-> self clock frame-counter) (-> obj played-bounce-time)) (seconds 0.3)) + ) + (set! (-> obj played-bounce-time) (-> self clock frame-counter)) + (sound-play "dark-shot-bounc") + ) + ) + ) + +;; definition for method 30 of type projectile-bounce +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! projectile-bounce ((obj projectile-bounce)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) projectile-bounce-reaction) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate jak-dark-shot)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 819.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set-collide-with! + (-> obj root-override) + (collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set-collide-as! (-> obj root-override) (collide-spec projectile)) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + (none) + ) + +;; definition for method 31 of type projectile-bounce +;; WARN: Return type mismatch int vs none. +(defmethod init-proj-settings! projectile-bounce ((obj projectile-bounce)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj max-speed) 450560.0) + (set! (-> obj timeout) (seconds 1.6)) + (set! (-> obj update-velocity) projectile-bounce-update-velocity) + (set! (-> obj move) projectile-bounce-move) + (set! (-> obj root-override dynam gravity y) 184320.0) + (set! (-> obj root-override dynam gravity-length) 184320.0) + (set! (-> obj root-override dynam gravity-max) 184320.0) + (let ((f0-4 1092.2667)) + (quaternion-axis-angle! (-> obj tumble-quat) 1.0 0.0 0.0 f0-4) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc index 32844b7904..605bf2a0eb 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc @@ -1065,8 +1065,8 @@ ) (let ((a1-42 (vector-! (new 'stack-no-clear 'vector) v1-260 (-> (the-as control-info s3-3) trans)))) (vector-float*! a1-42 a1-42 (-> pp clock frames-per-second)) + (collide-shape-method-37 s3-3 a1-42) ) - ((method-of-object s3-3 collide-shape-method-37)) (set! (-> (the-as control-info s3-3) status) (logior (-> s3-3 status) (cshape-moving-flags on-surface on-ground t-surface on-water)) ) diff --git a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc index 5dd841eeb8..beac38f1f2 100644 --- a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc @@ -856,7 +856,7 @@ ;; definition for function dm-vu1-user-all-pick-func (defun dm-vu1-user-all-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) - (let ((v1-1 (-> (new 'static 'array uint64 1 #x5fffffff8) 0))) + (let ((v1-1 (the-as uint #x5fffffff8))) (if (= arg1 (debug-menu-msg press)) (set! (-> *display* vu1-enable-user-menu) (the-as vu1-renderer-mask v1-1)) ) @@ -1746,11 +1746,7 @@ (when (= arg1 (debug-menu-msg press)) (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) (while (nonzero? (the-as int a1-8)) - (set! (-> (the-as adgif-shader a1-8) tex1) - (logior (logand (-> (the-as adgif-shader a1-8) tex1) (-> (new 'static 'array uint64 1 #xfffff000ffffffff) 0)) - (shr (shl (the-as int arg2) 52) 20) - ) - ) + (set! (-> (the-as adgif-shader a1-8) tex1 k) (the-as int arg2)) (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) ) ) @@ -1948,11 +1944,7 @@ (when (= arg1 (debug-menu-msg press)) (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) (while (nonzero? (the-as int a1-8)) - (set! (-> (the-as adgif-shader a1-8) tex0) - (logior (logand (-> (the-as adgif-shader a1-8) tex0) (-> (new 'static 'array uint64 1 #xffffffe7ffffffff) 0)) - (shr (shl (the-as int arg2) 62) 27) - ) - ) + (set! (-> (the-as adgif-shader a1-8) tex0 tfx) (the-as int arg2)) (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) ) ) @@ -2150,11 +2142,7 @@ (when (= arg1 (debug-menu-msg press)) (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) (while (nonzero? (the-as int a1-8)) - (set! (-> (the-as adgif-shader a1-8) tex0) - (logior (logand (-> (the-as adgif-shader a1-8) tex0) (-> (new 'static 'array uint64 1 #xfffffffc3fffffff) 0)) - (shr (shl (the-as int arg2) 60) 30) - ) - ) + (set! (-> (the-as adgif-shader a1-8) tex0 th) (the-as int arg2)) (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) ) ) @@ -2450,11 +2438,7 @@ (when (= arg1 (debug-menu-msg press)) (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) (while (nonzero? (the-as int a1-8)) - (set! (-> (the-as adgif-shader a1-8) clamp) - (logior (logand (-> (the-as adgif-shader a1-8) clamp) (-> (new 'static 'array uint64 1 #xfffffffc00ffffff) 0)) - (shr (shl (the-as int arg2) 54) 30) - ) - ) + (set! (-> (the-as adgif-shader a1-8) clamp minv) (the-as int arg2)) (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) ) ) @@ -2505,11 +2489,7 @@ (when (= arg1 (debug-menu-msg press)) (let ((a1-8 (the-as object (* (the-as adgif-shader (-> a0-3 next (-> v1-1 index) shader)) 16)))) (while (nonzero? (the-as int a1-8)) - (set! (-> (the-as adgif-shader a1-8) clamp) - (logior (logand (-> (the-as adgif-shader a1-8) clamp) (-> (new 'static 'array uint64 1 #xfffff003ffffffff) 0)) - (shr (shl (the-as int arg2) 54) 20) - ) - ) + (set! (-> (the-as adgif-shader a1-8) clamp maxv) (the-as int arg2)) (set! a1-8 (* (-> (the-as adgif-shader a1-8) next shader) 16)) ) ) diff --git a/test/decompiler/reference/jak2/engine/debug/editable_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable_REF.gc index 089f7c1273..f32ec8babd 100644 --- a/test/decompiler/reference/jak2/engine/debug/editable_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/editable_REF.gc @@ -118,7 +118,7 @@ (defmethod editable-region-method-11 editable-region ((obj editable-region) (arg0 vector) (arg1 int)) (local-vars (sv-32 vector2h)) (set! sv-32 (new 'stack 'vector2h)) - (add-debug-x #t (bucket-id debug-no-zbuf1) arg0 (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0))) + (add-debug-x #t (bucket-id debug-no-zbuf1) arg0 (new 'static 'rgba :r #xff :g #xff :a #x80)) (let ((s3-0 add-debug-text-3d) (s2-0 #t) (s1-0 318) @@ -298,25 +298,25 @@ ((and (logtest? (-> obj flags) (editable-flag selected)) (< (mod (-> *display* real-clock frame-counter) 60) 30) ) - (the-as int (-> (new 'static 'array uint64 1 #x80ffffff) 0)) + (the-as int (the-as uint #x80ffffff)) ) ((logtest? (-> obj flags) (editable-flag no-save)) (shl #x80ff 16) ) ((= (-> obj type) editable-point) - (the-as int (-> (new 'static 'array uint64 1 #x800080ff) 0)) + (the-as int (the-as uint #x800080ff)) ) ((= (-> obj type) editable-sample) - (the-as int (-> (new 'static 'array uint64 1 #x80ff8000) 0)) + (the-as int (the-as uint #x80ff8000)) ) ((= (-> obj type) editable-light) - (the-as int (-> (new 'static 'array uint64 1 #x80ff0080) 0)) + (the-as int (the-as uint #x80ff0080)) ) ((= (-> obj type) editable-entity) - (the-as int (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (the-as int (the-as uint #x80ff00ff)) ) (else - (the-as int (-> (new 'static 'array uint64 1 #x800000ff) 0)) + (the-as int (the-as uint #x800000ff)) ) ) ) @@ -329,15 +329,10 @@ (let ((s5-0 (new 'stack-no-clear 'vector))) (when (editable-method-11 obj s5-0) (set! (-> s5-0 y) (-> s5-0 y)) - (add-debug-x #t (bucket-id debug-no-zbuf1) s5-0 (the-as rgba (-> (new 'static 'array uint64 1 #x80ffffff) 0))) + (add-debug-x #t (bucket-id debug-no-zbuf1) s5-0 (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) ) ) - (add-debug-x - #t - (bucket-id debug-no-zbuf1) - (edit-get-trans obj) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) - ) + (add-debug-x #t (bucket-id debug-no-zbuf1) (edit-get-trans obj) (new 'static 'rgba :r #xff :g #xff :a #x80)) ) 0 (none) @@ -1018,7 +1013,7 @@ (edit-get-trans obj) (-> obj direction) (* -1.2 (-> obj radius)) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) ) (when (-> *editable* 0 light-names) @@ -1395,7 +1390,7 @@ (edit-get-trans obj) s1-0 (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) ) (when (logtest? (-> obj flags) (editable-flag selected)) @@ -1424,12 +1419,12 @@ gp-0 sv-112 (if (logtest? (-> obj flags) (editable-flag orient)) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :a #x80) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) (if (not (logtest? (-> obj flags) (editable-flag orient))) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :a #x80) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) (if (logtest? (-> obj flags) (editable-flag selected)) 1 @@ -1780,7 +1775,7 @@ (bucket-id debug-no-zbuf1) (edit-get-trans (-> obj vertex 0)) (edit-get-trans (-> obj vertex 1)) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :g #xff :a #x80) #f (the-as rgba -1) ) @@ -1789,12 +1784,12 @@ (the-as (inline-array vector) gp-0) s4-0 (if (logtest? (-> obj flags) (editable-flag orient)) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :a #x80) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) (if (not (logtest? (-> obj flags) (editable-flag orient))) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :a #x80) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) (if (logtest? (-> obj flags) (editable-flag selected)) 1 diff --git a/test/decompiler/reference/jak2/engine/debug/stats-h_REF.gc b/test/decompiler/reference/jak2/engine/debug/stats-h_REF.gc index d9d238e18f..fc76128f19 100644 --- a/test/decompiler/reference/jak2/engine/debug/stats-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/stats-h_REF.gc @@ -300,25 +300,15 @@ ;; definition for method 11 of type perf-stat ;; WARN: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, v1] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defmethod reset! perf-stat ((obj perf-stat)) (let ((v1-0 (-> obj ctrl))) (+! (-> obj count) 1) (b! (zero? v1-0) cfg-2 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf v1-0) @@ -332,15 +322,10 @@ ;; definition for method 12 of type perf-stat ;; WARN: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc v1, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc v1, pcr1] (defmethod read! perf-stat ((obj perf-stat)) (local-vars (v1-1 int) (v1-3 int)) (b! (zero? (-> obj ctrl)) cfg-2 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc v1-1 pcr0) diff --git a/test/decompiler/reference/jak2/engine/entity/entity_REF.gc b/test/decompiler/reference/jak2/engine/entity/entity_REF.gc index 4a8c20555c..2b8476efa4 100644 --- a/test/decompiler/reference/jak2/engine/entity/entity_REF.gc +++ b/test/decompiler/reference/jak2/engine/entity/entity_REF.gc @@ -2627,8 +2627,6 @@ ) ;; definition (debug) for function entity-speed-test -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Count, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 s4, Count] (defun-debug entity-speed-test ((arg0 string)) (local-vars (s4-0 int)) @@ -2638,7 +2636,7 @@ (reset-actors 'debug) 0 (disable-irq) - (.mtc0 Count r0) + (.mtc0 Count 0) (.sync.p) (birth! gp-0) (.mfc0 s4-0 Count) diff --git a/test/decompiler/reference/jak2/engine/game/fact-h_REF.gc b/test/decompiler/reference/jak2/engine/game/fact-h_REF.gc index 473e9abea4..acc80b3148 100644 --- a/test/decompiler/reference/jak2/engine/game/fact-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/fact-h_REF.gc @@ -1,7 +1,5 @@ -;;-*-Lisp-*- (in-package goal) -;; definition of type fact-bank (deftype fact-bank (basic) ((eco-level-max float :offset-assert 4) (eco-single-inc float :offset-assert 8) @@ -43,7 +41,6 @@ :flag-assert #x9000000a0 ) -;; definition for method 3 of type fact-bank (defmethod inspect fact-bank ((obj fact-bank)) (when (not obj) (set! obj obj) @@ -88,7 +85,6 @@ obj ) -;; definition for symbol *FACT-bank*, type fact-bank (define *FACT-bank* (new 'static 'fact-bank :eco-level-max 2.0 :eco-single-inc 1.0 @@ -125,7 +121,6 @@ ) ) -;; definition for function pickup-type->string (defun pickup-type->string ((arg0 pickup-type)) (case arg0 (((pickup-type eco-pill-dark)) @@ -236,7 +231,6 @@ ) ) -;; definition of type fact-info (deftype fact-info (basic) ((process process :offset-assert 4) (pickup-type pickup-type :offset-assert 8) @@ -250,13 +244,12 @@ :flag-assert #xc00000028 (:methods (new (symbol type process pickup-type float) _type_ 0) - (fact-info-method-9 () none 9) + (drop-pickup (_type_ symbol process-tree fact-info int) (pointer process) 9) (reset! (_type_ symbol) none 10) (pickup-collectable! (_type_ pickup-type float handle) float 11) ) ) -;; definition for method 3 of type fact-info (defmethod inspect fact-info ((obj fact-info)) (when (not obj) (set! obj obj) @@ -474,7 +467,6 @@ obj ) -;; definition of type fact-info-target (deftype fact-info-target (fact-info) ((eco-type int32 :offset-assert 40) (eco-level float :offset-assert 44) @@ -520,7 +512,6 @@ ) ) -;; definition for method 3 of type fact-info-target (defmethod inspect fact-info-target ((obj fact-info-target)) (when (not obj) (set! obj obj) @@ -772,7 +763,6 @@ obj ) -;; definition of type fact-info-enemy (deftype fact-info-enemy (fact-info) ((speed float :offset-assert 40) (idle-distance meters :offset-assert 44) @@ -796,7 +786,6 @@ ) ) -;; definition for method 3 of type fact-info-enemy (defmethod inspect fact-info-enemy ((obj fact-info-enemy)) (when (not obj) (set! obj obj) @@ -1107,7 +1096,6 @@ obj ) -;; definition of type fact-info-crate (deftype fact-info-crate (fact-info) ((suck-count int32 :offset-assert 40) ) @@ -1119,7 +1107,6 @@ ) ) -;; definition for method 3 of type fact-info-crate (defmethod inspect fact-info-crate ((obj fact-info-crate)) (when (not obj) (set! obj obj) @@ -1338,9 +1325,6 @@ obj ) -;; definition for method 0 of type fact-info -;; INFO: Used lq/sq -;; WARN: Return type mismatch object vs fact-info. (defmethod new fact-info ((allocation symbol) (type-to-make type) (arg0 process) (arg1 pickup-type) (arg2 float)) (local-vars (sv-16 fact-info) (sv-20 res-lump) (sv-24 task-mask)) (set! sv-16 (object-new allocation type-to-make (the-as int (-> type-to-make size)))) @@ -1389,12 +1373,10 @@ (the-as fact-info sv-16) ) -;; definition for method 11 of type fact-info (defmethod pickup-collectable! fact-info ((obj fact-info) (arg0 pickup-type) (arg1 float) (arg2 handle)) 0.0 ) -;; definition of type fact-info-enemy-defaults (deftype fact-info-enemy-defaults (basic) ((idle-distance meters :offset-assert 4) ) @@ -1403,7 +1385,6 @@ :flag-assert #x900000008 ) -;; definition for method 3 of type fact-info-enemy-defaults (defmethod inspect fact-info-enemy-defaults ((obj fact-info-enemy-defaults)) (when (not obj) (set! obj obj) @@ -1415,11 +1396,8 @@ obj ) -;; definition for symbol *fact-info-enemy-defaults*, type fact-info-enemy-defaults (define *fact-info-enemy-defaults* (new 'static 'fact-info-enemy-defaults :idle-distance (meters 80))) -;; definition for method 0 of type fact-info-enemy -;; INFO: Used lq/sq (defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (arg0 process) @@ -1477,8 +1455,6 @@ ) ) -;; definition for method 12 of type fact-info-enemy -;; WARN: Return type mismatch int vs none. (defmethod clear-mask-bits fact-info-enemy ((obj fact-info-enemy) (arg0 int)) (let ((v1-0 (lognot arg0))) (dotimes (a1-1 (-> obj trig-mask-count)) @@ -1489,7 +1465,6 @@ (none) ) -;; definition for method 0 of type fact-info-crate (defmethod new fact-info-crate ((allocation symbol) (type-to-make type) (arg0 process) (arg1 pickup-type) (arg2 float)) (let ((gp-0 (the-as fact-info-crate ((method-of-type fact-info new) allocation type-to-make arg0 arg1 arg2)))) (let ((a0-1 (the-as res-lump (-> gp-0 process entity)))) @@ -1499,7 +1474,6 @@ ) ) -;; definition for method 0 of type fact-info-target (defmethod new fact-info-target ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 pickup-type) (arg2 float)) (let ((gp-0 (the-as fact-info-target ((method-of-type fact-info new) allocation type-to-make arg0 arg1 arg2)))) (set! (-> gp-0 eco-source) (the-as handle #f)) diff --git a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc index 8a49f47459..48ce51c8c8 100644 --- a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc @@ -29,7 +29,7 @@ (initialize-skeleton (_type_ skeleton-group pair) none 14) (initialize-skeleton-by-name (_type_ string) draw-control 15) (apply-alignment (_type_ align-opts transformq vector) object 16) - (process-drawable-method-17 () none 17) + (process-drawable-method-17 (_type_) none 17) (process-drawable-method-18 () none 18) (process-drawable-method-19 () none 19) ) diff --git a/test/decompiler/reference/jak2/engine/game/task/task-arrow_REF.gc b/test/decompiler/reference/jak2/engine/game/task/task-arrow_REF.gc new file mode 100644 index 0000000000..7ad3538305 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/game/task/task-arrow_REF.gc @@ -0,0 +1,337 @@ +(in-package goal) + +(defskelgroup skel-task-arrow ctywide-arrow 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :texture-level 6 + ) + +(deftype task-arrow-params (structure) + ((flags task-arrow-flags :offset-assert 0) + (map-icon uint16 :offset-assert 4) + (pos vector :inline :offset-assert 16) + (quat quaternion :inline :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x30 + :flag-assert #x900000030 + ) + +(defmethod inspect task-arrow-params ((obj task-arrow-params)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'task-arrow-params) + (format #t "~1Tflags: ~D~%" (-> obj flags)) + (format #t "~1Tmap-icon: ~D~%" (-> obj map-icon)) + (format #t "~1Tpos: #~%" (-> obj pos)) + (format #t "~1Tquat: #~%" (-> obj quat)) + (label cfg-4) + obj + ) + +(deftype task-arrow (process-drawable) + ((pos vector :inline :offset-assert 208) + (theta float :offset-assert 224) + (phi float :offset-assert 228) + (dist float :offset-assert 232) + (smoothed-dist float :offset-assert 236) + (max-dist float :offset-assert 240) + (flags task-arrow-flags :offset-assert 244) + (map-icon uint16 :offset-assert 248) + (minimap connection-minimap :offset-assert 252) + (hud-dist handle :offset-assert 256) + (base-quat quaternion :inline :offset-assert 272) + (rod-of-god-scale float :offset-assert 288) + (moving symbol :offset-assert 292) + ) + :heap-base #xb0 + :method-count-assert 25 + :size-assert #x128 + :flag-assert #x1900b00128 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + (leave () _type_ :state 22) + (task-arrow-method-23 (_type_ vector) none 23) + (draw-arrow (_type_) none :behavior task-arrow 24) + ) + ) + +(defmethod inspect task-arrow ((obj task-arrow)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tpos: #~%" (-> obj pos)) + (format #t "~2Ttheta: ~f~%" (-> obj theta)) + (format #t "~2Tphi: ~f~%" (-> obj phi)) + (format #t "~2Tdist: ~f~%" (-> obj dist)) + (format #t "~2Tsmoothed-dist: ~f~%" (-> obj smoothed-dist)) + (format #t "~2Tmax-dist: ~f~%" (-> obj max-dist)) + (format #t "~2Tflags: ~D~%" (-> obj flags)) + (format #t "~2Tmap-icon: ~D~%" (-> obj map-icon)) + (format #t "~2Tminimap: #~%" (-> obj minimap)) + (format #t "~2Thud-dist: ~D~%" (-> obj hud-dist)) + (format #t "~2Tbase-quat: #~%" (-> obj base-quat)) + (format #t "~2Trod-of-god-scale: ~f~%" (-> obj rod-of-god-scale)) + (format #t "~2Tmoving: ~A~%" (-> obj moving)) + (label cfg-4) + obj + ) + +(defmethod deactivate task-arrow ((obj task-arrow)) + (send-event (handle->process (-> obj hud-dist)) 'hide-and-die) + ((method-of-type process-drawable deactivate) obj) + 0 + (none) + ) + +(defmethod task-arrow-method-23 task-arrow ((obj task-arrow) (arg0 vector)) + "Some weird debugging code left here, but checks for collisions on the arrow" + (let ((s5-0 (new 'stack-no-clear 'collide-query-with-vec))) + (set! (-> s5-0 vec quad) (-> arg0 quad)) + (set! (-> s5-0 cquery start-pos quad) (-> s5-0 vec quad)) + (set! (-> s5-0 cquery start-pos y) (+ 20480.0 (-> s5-0 cquery start-pos y))) + (set-vector! (-> s5-0 cquery move-dist) 0.0 -81920.0 0.0 1.0) + (let ((v1-4 (-> s5-0 cquery))) + (set! (-> v1-4 radius) 1024.0) + (set! (-> v1-4 collide-with) (collide-spec backgnd)) + (set! (-> v1-4 ignore-process0) #f) + (set! (-> v1-4 ignore-process1) #f) + (set! (-> v1-4 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-4 action-mask) (collide-action solid)) + ) + (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* (-> s5-0 cquery)))) + (if (>= f0-7 0.0) + (vector+float*! (-> s5-0 vec) (-> s5-0 cquery start-pos) (-> s5-0 cquery move-dist) f0-7) + ) + ) + (set! (-> arg0 quad) (-> s5-0 vec quad)) + ) + 0 + (none) + ) + +(defmethod draw-arrow task-arrow ((obj task-arrow)) + (cond + ((logtest? (-> obj flags) (task-arrow-flags task-arrow-flag-00)) + (if (and (not (handle->process (-> obj hud-dist))) *target*) + (set! (-> obj hud-dist) (ppointer->handle (process-spawn hud-progress :init hud-init-by-other :to *target*))) + ) + (let ((s5-1 (minimap-method-10 *minimap* (-> obj minimap) (the-as minimap-trail #f)))) + (if (and s5-1 (nonzero? (-> s5-1 last-updated))) + (set! (-> obj dist) (minimap-trail-method-9 s5-1 (target-pos 0) (-> obj pos))) + ) + ) + (if (= (-> obj max-dist) 0.0) + (set! (-> obj max-dist) (-> obj dist)) + ) + (let ((f0-4 (- (-> obj dist) (-> obj smoothed-dist)))) + (if (< (fabs f0-4) 40960.0) + (+! (-> obj smoothed-dist) (* 10.0 (-> self clock seconds-per-frame) f0-4)) + (set! (-> obj smoothed-dist) (-> obj dist)) + ) + ) + (let ((f1-5 (/ (-> obj smoothed-dist) (-> obj max-dist)))) + (set! (-> *game-info* distance) (- 1.0 (fmax 0.0 (fmin 1.0 f1-5)))) + ) + ) + (else + (let ((a0-16 (handle->process (-> obj hud-dist)))) + (when a0-16 + (send-event a0-16 'hide-and-die) + (set! (-> obj hud-dist) (the-as handle #f)) + ) + ) + ) + ) + (cond + ((-> obj moving) + (set! (-> obj rod-of-god-scale) (- (-> obj rod-of-god-scale) (* 8.0 (-> self clock seconds-per-frame)))) + (when (< (-> obj rod-of-god-scale) 0.0) + (set! (-> obj rod-of-god-scale) 0.0) + (set! (-> obj moving) #f) + (let ((f0-15 81920.0)) + (cond + ((< (* f0-15 f0-15) (vector-vector-xz-distance-squared (-> obj pos) (-> obj root trans))) + (kill-callback (-> *minimap* engine) (-> obj minimap)) + (set! (-> obj root trans quad) (-> obj pos quad)) + (set! (-> obj minimap) + (minimap-method-12 *minimap* obj (-> obj map-icon) (the-as int #f) (the-as vector #t) 0) + ) + ) + (else + (set! (-> obj root trans quad) (-> obj pos quad)) + ) + ) + ) + ) + ) + (else + (set! (-> obj pos quad) (-> obj root trans quad)) + (+! (-> obj rod-of-god-scale) (* 8.0 (-> self clock seconds-per-frame))) + (if (< 1.0 (-> obj rod-of-god-scale)) + (set! (-> obj rod-of-god-scale) 1.0) + ) + ) + ) + (cond + ((not (logtest? (-> obj flags) (task-arrow-flags task-arrow-flag-02))) + (set! (-> *part-id-table* 267 init-specs 4 initial-valuef) (* 24576.0 (-> obj rod-of-god-scale))) + (set! (-> *part-id-table* 270 init-specs 3 initial-valuef) (* 65536.0 (-> obj rod-of-god-scale))) + (set! (-> *part-id-table* 268 init-specs 9 initial-valuef) (* 20.0 (-> obj rod-of-god-scale))) + (spawn (-> obj part) (-> obj root trans)) + ) + (else + (+! (-> obj theta) (* 32768.0 (-> self clock seconds-per-frame))) + (+! (-> obj phi) (* 9102.223 (-> self clock seconds-per-frame))) + (set! (-> obj root trans quad) (-> obj pos quad)) + (set! (-> obj root trans y) (+ 28672.0 (* 4096.0 (cos (-> obj theta))) (-> obj pos y))) + ) + ) + (when (logtest? (-> obj flags) (task-arrow-flags task-arrow-flag-01)) + (quaternion-axis-angle! (-> obj root quat) 0.0 1.0 0.0 (-> obj phi)) + (quaternion-normalize! (quaternion*! (-> obj root quat) (-> obj base-quat) (-> obj root quat))) + ) + (ja-post) + 0 + (none) + ) + +(defstate idle (task-arrow) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (v0-2 object)) + (case event-type + (('set-position) + (let ((a0-3 (the-as object (-> event param 0)))) + (set! (-> self pos quad) (-> (the-as vector a0-3) quad)) + ) + (if (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-03)) + (task-arrow-method-23 self (-> self pos)) + ) + (let ((f0-0 4096.0)) + (when (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> self pos) (-> self root trans))) + (set! v0-2 #t) + (set! (-> self moving) (the-as symbol v0-2)) + v0-2 + ) + ) + ) + (('leave) + (if (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-02)) + (go-virtual die) + (go-virtual leave) + ) + ) + (('modify-flags) + (let ((v1-16 (-> event param 0)) + (a1-3 (-> event param 1)) + ) + (set! v0-2 (logior (logclear (-> self flags) a1-3) v1-16)) + ) + (set! (-> self flags) (the-as task-arrow-flags v0-2)) + v0-2 + ) + (('map-icon) + (kill-callback (-> *minimap* engine) (-> self minimap)) + (let ((a2-1 (-> event param 0))) + (set! (-> self map-icon) a2-1) + (set! v0-2 (minimap-method-12 *minimap* self a2-1 (the-as int #f) (the-as vector #t) 0)) + ) + (set! (-> self minimap) (the-as connection-minimap v0-2)) + v0-2 + ) + (('die) + (go-virtual die) + ) + ) + ) + :code (the-as (function none :behavior task-arrow) sleep-code) + :post (behavior () + (draw-arrow self) + (none) + ) + ) + +(defstate leave (task-arrow) + :virtual #t + :code (behavior () + (set! (-> self moving) #t) + (while (-> self moving) + (suspend) + ) + (process-drawable-method-17 self) + (none) + ) + :post (behavior () + (draw-arrow self) + (none) + ) + ) + +(defstate die (task-arrow) + :virtual #t + :code (behavior () + (process-drawable-method-17 self) + (none) + ) + ) + +(defbehavior task-arrow-init-by-other task-arrow ((arg0 task-arrow-params)) + (set! (-> self flags) (-> arg0 flags)) + (set! (-> self map-icon) (-> arg0 map-icon)) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self pos quad) (-> arg0 pos quad)) + (if (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-03)) + (task-arrow-method-23 self (-> self pos)) + ) + (set! (-> self root trans quad) (-> self pos quad)) + (quaternion-copy! (-> self root quat) (-> arg0 quat)) + (quaternion-copy! (-> self base-quat) (-> arg0 quat)) + (set-vector! (-> self root scale) 1.0 1.0 1.0 1.0) + (set! (-> self hud-dist) (the-as handle #f)) + (set! (-> self max-dist) 0.0) + (set! (-> self theta) 0.0) + (set! (-> self phi) 0.0) + (set! (-> self minimap) + (minimap-method-12 *minimap* self (-> arg0 map-icon) (the-as int #f) (the-as vector #t) 0) + ) + (cond + ((not (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-02))) + (set! (-> self part) (create-launch-control (-> *part-group-id-table* 78) self)) + ) + (else + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-task-arrow" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self draw lod-set lod 0 dist) 1228800.0) + (set-vector! (-> self draw color-mult) 0.5 0.5 0.0 1.0) + (set-vector! (-> self draw color-emissive) 0.5 0.5 0.0 1.0) + ) + ) + (set! (-> self rod-of-god-scale) 0.0) + (set! (-> self moving) #f) + (logclear! (-> self mask) (process-mask actor-pause movie)) + (process-entity-status! self (entity-perm-status no-kill) #t) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (the-as task-arrow (go-virtual idle)) + ) + +(defun task-arrow-spawn ((arg0 task-arrow-params) (arg1 task-arrow)) + (let ((gp-0 (the-as process #f))) + (let ((v1-1 (process-spawn task-arrow arg0 :to arg1))) + (if v1-1 + (set! gp-0 (-> v1-1 0)) + ) + ) + gp-0 + ) + ) diff --git a/test/decompiler/reference/jak2/engine/gfx/foreground/bones-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/foreground/bones-h_REF.gc index 099413c2a9..e0688620e6 100644 --- a/test/decompiler/reference/jak2/engine/gfx/foreground/bones-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/foreground/bones-h_REF.gc @@ -208,7 +208,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/gfx/foreground/foreground-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/foreground/foreground-h_REF.gc index 640fe23d54..d3f5b2a25c 100644 --- a/test/decompiler/reference/jak2/engine/gfx/foreground/foreground-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/foreground/foreground-h_REF.gc @@ -205,11 +205,8 @@ ) ;; definition for function invalidate-cache-line -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin a0, 0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] ;; ERROR: Unsupported inline assembly instruction kind - [cache dxwbin a0, 1] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun invalidate-cache-line ((arg0 pointer)) (.sync.l) (.cache dxwbin arg0 0) diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/mood-funcs2_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/mood-funcs2_REF.gc index ade305ad90..a3e4d698f3 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/mood-funcs2_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/mood-funcs2_REF.gc @@ -1007,7 +1007,7 @@ ) (shr (shl (the int (* 16.0 f0-7)) 56) 40) ) - (-> (new 'static 'array uint64 1 #xffffffff00ffffff) 0) + (the-as uint #xffffffff00ffffff) ) (shl #x8000 16) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc b/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc index 905357eb7a..0a7dc269c3 100644 --- a/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc @@ -1000,36 +1000,6 @@ ;; definition for function draw-drawable-tree-instance-shrub ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a2] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr0, r0] -;; ERROR: Unsupported inline assembly instruction kind - [mtpc pcr1, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, a0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Perf, r0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr0] -;; ERROR: Unsupported inline assembly instruction kind - [mfpc a0, pcr1] (defun draw-drawable-tree-instance-shrub ((tree drawable-tree-instance-shrub) (level level)) (local-vars (a0-4 int) (a0-6 int) (a0-11 int) (a0-13 int)) (set! (-> *instance-shrub-work* texture-dists) (the-as uint (-> level bsp shrub-closest))) @@ -1063,11 +1033,11 @@ ) (+! (-> a1-16 count) 1) (b! (zero? a2-6) cfg-7 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a2-6) @@ -1084,7 +1054,7 @@ ) (let ((v1-26 (-> *perf-stats* data 44))) (b! (zero? (-> v1-26 ctrl)) cfg-9 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-4 pcr0) @@ -1099,11 +1069,11 @@ ) (+! (-> v1-29 count) 1) (b! (zero? a0-8) cfg-11 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) - (.mtpc pcr0 r0) - (.mtpc pcr1 r0) + (.mtpc pcr0 0) + (.mtpc pcr1 0) (.sync.l) (.sync.p) (.mtc0 Perf a0-8) @@ -1115,7 +1085,7 @@ (draw-prototype-inline-array-shrub proto-array-len proto-array-data) (let ((v1-32 (-> *perf-stats* data 45))) (b! (zero? (-> v1-32 ctrl)) cfg-13 :delay (nop!)) - (.mtc0 Perf r0) + (.mtc0 Perf 0) (.sync.l) (.sync.p) (.mfpc a0-11 pcr0) diff --git a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc index e2bd9309d6..be594bf6fc 100644 --- a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc @@ -181,7 +181,7 @@ ) (set! (-> a0-6 radius) (-> obj radius)) (set! (-> a0-6 collide-with) (-> obj collide-with)) - (set! (-> a0-6 ignore-process0) (the-as process v1-2)) + (set! (-> a0-6 ignore-process0) v1-2) (set! (-> a0-6 ignore-process1) #f) (set! (-> a0-6 ignore-pat) arg2) (set! (-> a0-6 action-mask) (collide-action solid)) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc index 7e439f9a96..0572e07db7 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc @@ -2,7 +2,3 @@ (in-package goal) ;; ERROR: top level function was not converted to expressions. Cannot decompile. - - - - diff --git a/test/decompiler/reference/jak2/engine/ps2/timer_REF.gc b/test/decompiler/reference/jak2/engine/ps2/timer_REF.gc index ef2666cfe4..cfe9d19ba1 100644 --- a/test/decompiler/reference/jak2/engine/ps2/timer_REF.gc +++ b/test/decompiler/reference/jak2/engine/ps2/timer_REF.gc @@ -2,8 +2,6 @@ (in-package goal) ;; definition for function timer-count -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun timer-count ((arg0 timer-bank)) (.sync.l) (let ((v0-0 (-> arg0 count))) @@ -15,8 +13,6 @@ ;; definition for function disable-irq ;; WARN: Return type mismatch int vs none. ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v0, Status] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Status, v0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defun disable-irq () (local-vars (v0-0 int)) (let ((v1-0 (the-as uint #xfffffffe))) @@ -33,8 +29,6 @@ ;; definition for function enable-irq ;; WARN: Return type mismatch int vs none. ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v0, Status] -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Status, v0] -;; ERROR: Unsupported inline assembly instruction kind - [sync.p] (defun enable-irq () (local-vars (v0-0 int)) (.mfc0 v0-0 Status) diff --git a/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash-h_REF.gc b/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash-h_REF.gc index 6ad801527b..40ceb8194b 100644 --- a/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash-h_REF.gc @@ -11,8 +11,8 @@ ;; definition of type grid-hash-box (deftype grid-hash-box (structure) - ((min uint8 3 :offset-assert 0) - (max uint8 3 :offset-assert 3) + ((min int8 3 :offset-assert 0) + (max int8 3 :offset-assert 3) ) :pack-me :method-count-assert 9 @@ -35,44 +35,45 @@ ;; definition of type grid-hash (deftype grid-hash (basic) - ((work basic :offset-assert 4) - (search-box grid-hash-box :inline :offset-assert 8) - (bucket-size int16 :offset-assert 14) - (axis-scale uint32 3 :offset-assert 16) - (dimension-array uint8 3 :offset-assert 28) - (vertical-cell-count int8 :offset-assert 31) - (bucket-array uint32 :offset-assert 32) - (box-min uint32 3 :offset-assert 36) - (box-max uint32 3 :offset-assert 48) - (object-count int16 :offset-assert 60) - (bucket-count int16 :offset-assert 62) - (min-cell-size float :offset-assert 64) - (bucket-memory-size int32 :offset-assert 68) - (mem-bucket-array uint32 :offset-assert 72) - (spr-bucket-array uint32 :offset-assert 76) - (debug-draw basic :offset-assert 80) - (use-scratch-ram basic :offset-assert 84) + ((work grid-hash-work :offset-assert 4) + (search-box grid-hash-box :inline :offset-assert 8) + (bucket-size int16 :offset-assert 14) + (axis-scale uint32 3 :offset-assert 16) + (dimension-array int8 3 :offset-assert 28) + (vertical-cell-count int8 :offset-assert 31) + (bucket-array (pointer grid-hash-word) :offset-assert 32) + (box-min float 3 :offset-assert 36) + (box-max float 3 :offset-assert 48) + (object-count int16 :offset-assert 60) + (bucket-count int16 :offset-assert 62) + (min-cell-size float :offset-assert 64) + (bucket-memory-size int32 :offset-assert 68) + (mem-bucket-array (pointer grid-hash-word) :offset-assert 72) + (spr-bucket-array (pointer grid-hash-word) :offset-assert 76) + (debug-draw symbol :offset-assert 80) + (use-scratch-ram symbol :offset-assert 84) ) :method-count-assert 25 :size-assert #x58 :flag-assert #x1900000058 (:methods - (grid-hash-method-9 () none 9) - (grid-hash-method-10 () none 10) - (grid-hash-method-11 () none 11) - (grid-hash-method-12 () none 12) - (grid-hash-method-13 () none 13) - (grid-hash-method-14 () none 14) - (grid-hash-method-15 () none 15) - (grid-hash-method-16 () none 16) - (grid-hash-method-17 () none 17) - (grid-hash-method-18 () none 18) - (grid-hash-method-19 () none 19) - (grid-hash-method-20 () none 20) - (grid-hash-method-21 () none 21) - (grid-hash-method-22 () none 22) - (grid-hash-method-23 () none 23) - (grid-hash-method-24 () none 24) + (new (symbol type process int) _type_ 0) + (grid-hash-method-9 (_type_ int (array float) int) none 9) + (grid-hash-method-10 (_type_) none 10) + (grid-hash-method-11 (_type_) none 11) + (grid-hash-method-12 (_type_) none 12) + (grid-hash-method-13 (_type_) none 13) + (draw-grid (_type_ rgba) none 14) + (dump-grid-info (_type_) none 15) + (grid-hash-method-16 (_type_ grid-hash-box grid-hash-box) none 16) + (grid-hash-method-17 (_type_) none 17) + (grid-hash-method-18 (_type_ grid-hash-box int) none 18) + (grid-hash-method-19 (_type_ grid-hash-box int) none 19) + (grid-hash-method-20 (_type_ grid-hash-box (pointer uint8)) none 20) + (grid-hash-method-21 (_type_ float int int) none 21) + (grid-hash-method-22 (_type_ grid-hash-box sphere) none 22) + (grid-hash-method-23 (_type_ grid-hash-box vector vector float) none 23) + (update-grid (_type_) none 24) ) ) @@ -147,15 +148,15 @@ :size-assert #x68 :flag-assert #x2200000068 (:methods - (sphere-hash-method-25 () none 25) - (sphere-hash-method-26 () none 26) - (sphere-hash-method-27 () none 27) - (sphere-hash-method-28 () none 28) - (sphere-hash-method-29 () none 29) + (clear-objects! (_type_) none 25) + (sphere-hash-method-26 (_type_ vector) none 26) + (sphere-hash-method-27 (_type_) none 27) + (sphere-hash-method-28 (_type_) none 28) + (sphere-hash-method-29 (_type_ find-nav-sphere-ids-params int int int) none 29) (sphere-hash-method-30 (_type_ find-nav-sphere-ids-params) none 30) - (sphere-hash-method-31 () none 31) - (sphere-hash-method-32 () none 32) - (sphere-hash-method-33 () none 33) + (sphere-hash-method-31 (_type_ vector int int) none 31) + (sphere-hash-method-32 (_type_ vector vector float int) symbol 32) + (sphere-hash-method-33 (_type_ object int) none 33) ) ) @@ -215,21 +216,21 @@ ;; definition of type spatial-hash (deftype spatial-hash (sphere-hash) - ((object-array uint32 :offset-assert 104) - (mem-object-array uint32 :offset-assert 108) - (spr-object-array uint32 :offset-assert 112) + ((object-array (pointer hash-object-info) :offset-assert 104) + (mem-object-array (pointer hash-object-info) :offset-assert 108) + (spr-object-array (pointer hash-object-info) :offset-assert 112) ) :method-count-assert 41 :size-assert #x74 :flag-assert #x2900000074 (:methods - (spatial-hash-method-34 () none 34) - (spatial-hash-method-35 () none 35) + (spatial-hash-method-34 (_type_ vector hash-object-info) int 34) + (spatial-hash-method-35 (_type_) none 35) (spatial-hash-method-36 (_type_ sphere (pointer collide-shape) int) int 36) - (spatial-hash-method-37 () none 37) - (spatial-hash-method-38 () none 38) - (spatial-hash-method-39 () none 39) - (spatial-hash-method-40 () none 40) + (spatial-hash-method-37 (_type_) none 37) + (spatial-hash-method-38 (_type_) none 38) + (spatial-hash-method-39 (_type_ object hash-object-info) none 39) + (spatial-hash-method-40 (_type_) none 40) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc new file mode 100644 index 0000000000..a31534a280 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-blue-shot_REF.gc @@ -0,0 +1,364 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function target-gun-fire-blue +;; INFO: Used lq/sq +(defbehavior target-gun-fire-blue target () + (let ((gp-0 (-> self gun)) + (s4-0 (-> self gun fire-dir-out)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (new 'stack-no-clear 'quaternion))) + (quaternion-vector-angle! s3-0 s4-0 (* 182.04445 (rand-vu-float-range 0.0 360.0))) + (vector-rotate-y! s5-0 s4-0 (* 182.04445 (rand-vu-float-range 0.0 1.1))) + (vector-orient-by-quat! s5-0 s5-0 s3-0) + ) + (let ((s4-1 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> s4-1 ent) (-> self entity)) + (set! (-> s4-1 charge) 1.0) + (set! (-> s4-1 options) (projectile-options account-for-target-velocity deal-damage proj-options-8000)) + (set! (-> s4-1 pos quad) (-> gp-0 fire-point quad)) + (set! (-> s4-1 vel quad) (-> s5-0 quad)) + (set! (-> s4-1 notify-handle) (the-as handle #f)) + (set! (-> s4-1 owner-handle) (the-as handle #f)) + (set! (-> s4-1 ignore-handle) (process->handle (the-as process (send-event self 'get-vehicle)))) + (let* ((v1-13 *game-info*) + (a0-15 (+ (-> v1-13 attack-id) 1)) + ) + (set! (-> v1-13 attack-id) a0-15) + (set! (-> s4-1 attack-id) a0-15) + ) + (set! (-> s4-1 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (spawn-projectile gun-blue-shot s4-1 (ppointer->process (-> gp-0 gun)) *default-dead-pool*) + ) + ) + ) + +;; definition of type gun-blue-shot +(deftype gun-blue-shot (projectile) + ((init-pos vector :inline :offset-assert 480) + (init-dir vector :inline :offset-assert 496) + (collide-normal vector :inline :offset-assert 512) + ) + :heap-base #x190 + :method-count-assert 40 + :size-assert #x210 + :flag-assert #x2801900210 + ) + +;; definition for method 3 of type gun-blue-shot +(defmethod inspect gun-blue-shot ((obj gun-blue-shot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 obj) + ) + (format #t "~2Tinit-pos: #~%" (-> obj init-pos)) + (format #t "~2Tinit-dir: #~%" (-> obj init-dir)) + (format #t "~2Tcollide-normal: #~%" (-> obj collide-normal)) + (label cfg-4) + obj + ) + +;; definition for method 24 of type gun-blue-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod draw-laser-sight gun-blue-shot ((obj gun-blue-shot)) + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + (let* ((s5-0 (ppointer->process (-> obj parent))) + (s4-0 (-> *part-id-table* 196)) + (s3-0 (get-field-spec-by-id s4-0 (sp-field-id spt-omega))) + (s5-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as projectile s5-0) node-list data 16))) + ) + (when s3-0 + (let ((s1-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj starting-dir) 1.0)) + (s2-0 (new 'stack-no-clear 'collide-query)) + ) + (vector-rotate-y! s1-0 s1-0 16384.0) + (vector+float*! s1-0 s5-1 s1-0 -8806.4) + (set! (-> s2-0 start-pos quad) (-> s1-0 quad)) + (vector-float*! (-> s2-0 move-dist) (-> obj root-override dynam gravity-normal) -81920.0) + (let ((v1-11 s2-0)) + (set! (-> v1-11 radius) 1228.8) + (set! (-> v1-11 collide-with) (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list)) + (set! (-> v1-11 ignore-process0) obj) + (set! (-> v1-11 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> v1-11 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-11 action-mask) (collide-action solid)) + ) + (if (>= (fill-and-probe-using-line-sphere *collide-cache* s2-0) 0.0) + (set! (-> s3-0 initial-valuef) + (fmin (+ 1638.4 (-> s2-0 best-other-tri intersect y)) (+ -1228.8 (-> obj starting-pos y))) + ) + (set! (-> s3-0 initial-valuef) (+ -81920.0 (-> obj starting-pos y))) + ) + ) + ) + (let ((s4-1 (get-field-spec-by-id s4-0 (sp-field-id spt-rotate-y)))) + (if s4-1 + (set! (-> s4-1 initial-valuef) (y-angle (-> obj root-override))) + ) + ) + (let ((t9-7 sp-launch-particles-var) + (a0-19 *sp-particle-system-2d*) + (a1-9 (-> *part-id-table* 196)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s5-1 quad)) + (t9-7 a0-19 a1-9 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((s4-2 (get-field-spec-by-id (-> *part-id-table* 195) (sp-field-id spt-rotate-y)))) + (if s4-2 + (set! (-> s4-2 initial-valuef) (y-angle (-> obj root-override))) + ) + ) + (let ((t9-10 sp-launch-particles-var) + (a0-22 *sp-particle-system-2d*) + (a1-11 (-> *part-id-table* 195)) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> s5-1 quad)) + (t9-10 a0-22 a1-11 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + 0 + (none) + ) + +;; definition for method 26 of type gun-blue-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-shell-particles gun-blue-shot ((obj gun-blue-shot)) + "TODO - confirm" + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s3-1 (vector-! (new 'stack-no-clear 'vector) (-> obj root-override trans) (-> obj init-pos)))) + (draw-beam (-> *part-id-table* 191) (-> obj init-pos) s3-1 #t #t) + (draw-beam (-> *part-id-table* 194) (-> obj init-pos) (-> obj starting-dir) #f #t) + (let ((s5-0 (-> *part-id-table* 206)) + (s4-0 (-> *part-id-table* 205)) + ) + (new 'stack-no-clear 'vector) + (let ((s2-0 (vector-reflect! (new 'stack-no-clear 'vector) s3-1 (-> obj collide-normal)))) + (vector-normalize! s2-0 1.0) + (get-field-spec-by-id s5-0 (sp-field-id spt-conerot-x)) + (get-field-spec-by-id s5-0 (sp-field-id spt-conerot-y)) + (get-field-spec-by-id s5-0 (sp-field-id spt-conerot-z)) + (let ((a1-7 (new 'stack-no-clear 'matrix)) + (s1-0 (new 'stack-no-clear 'vector)) + (s3-2 (new 'stack-no-clear 'vector)) + ) + (vector-cross! (the-as vector (-> a1-7 vector)) *y-vector* s2-0) + (vector-cross! (-> a1-7 vector 1) s2-0 (the-as vector (-> a1-7 vector))) + (set! (-> a1-7 vector 2 quad) (-> s2-0 quad)) + (matrix->eul (the-as euler-angles s1-0) a1-7 21) + (vector-negate! s3-2 s1-0) + (let ((a0-14 s3-2)) + (let ((v1-16 s3-2)) + (let ((a1-10 -3640.889)) + (.mov vf6 a1-10) + ) + (.lvf vf4 (&-> v1-16 quad)) + ) + (.add.x.vf vf5 vf0 vf0 :mask #b1000) + (.add.x.vf vf5 vf4 vf6 :mask #b111) + (.svf (&-> a0-14 quad) vf5) + ) + (sparticle-set-conerot s5-0 s3-2) + (sparticle-set-conerot s4-0 s3-2) + ) + ) + ) + ) + (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-1 + (let ((t9-12 (method-of-type part-tracker activate))) + (t9-12 + (the-as part-tracker s5-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-13 run-function-in-process) + (a0-19 s5-1) + (a1-15 part-tracker-init) + (a2-12 (-> *part-group-id-table* 68)) + (a3-3 0) + (t0-2 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> obj root-override trans quad)) + ((the-as (function object object object object object object object object none) t9-13) + a0-19 + a1-15 + a2-12 + a3-3 + t0-2 + t1-0 + t2-0 + t3-0 + ) + ) + (-> s5-1 ppointer) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 27 of type gun-blue-shot +;; WARN: Return type mismatch int vs none. +(defmethod unknown-particles gun-blue-shot ((obj gun-blue-shot)) + "TODO - confirm" + (draw-beam (-> *part-id-table* 191) (-> obj init-pos) (-> obj init-dir) #f #t) + (draw-beam (-> *part-id-table* 194) (-> obj init-pos) (-> obj starting-dir) #f #t) + 0 + (none) + ) + +;; definition for method 28 of type gun-blue-shot +(defmethod play-impact-sound gun-blue-shot ((obj gun-blue-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "blue-shot-fire") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "blue-shot-hit") + ) + ) + ) + ) + +;; definition for method 38 of type gun-blue-shot +(defmethod made-impact? gun-blue-shot ((obj gun-blue-shot)) + "TODO - queries the collision cache, return true/false" + (let ((v1-0 (-> obj root-override))) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a1-0 ignore-process0) obj) + (set! (-> a1-0 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> a1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> a1-0 action-mask) (collide-action solid)) + ) + (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -12288.0 12697.6 -2048.0) + ) + ) + +;; definition for function gun-blue-shot-move +;; WARN: Return type mismatch int vs none. +(defun gun-blue-shot-move ((arg0 gun-blue-shot)) + (projectile-move-fill-line-sphere arg0) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-surface)) + (go (method-of-object arg0 impact)) + ) + 0 + (none) + ) + +;; definition for function cshape-reaction-blue-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs cshape-moving-flags. +(defun cshape-reaction-blue-shot ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (vector-reset! arg2) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-dist) (the-as float (-> arg1 spheres))) + (move-by-vector! arg0 a1-1) + ) + (set! (-> (the-as gun-blue-shot (-> arg0 process)) collide-normal quad) (-> arg1 best-other-tri normal quad)) + (let ((v0-1 4)) + (logior! (-> arg0 status) v0-1) + (the-as cshape-moving-flags v0-1) + ) + ) + +;; definition for method 30 of type gun-blue-shot +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! gun-blue-shot ((obj gun-blue-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-blue-shot) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate jak-blue-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 1228.8) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-13 prim-core collide-with) (collide-spec backgnd obstacle pusher)) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec bot crate civilian enemy vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4096.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + 0 + (none) + ) + +;; definition for method 31 of type gun-blue-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init-proj-settings! gun-blue-shot ((obj gun-blue-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (with-pp + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 204 (seconds 0.1)) + (set! (-> obj init-pos quad) (-> obj root-override trans quad)) + (set! (-> obj init-dir quad) (-> obj starting-dir quad)) + (vector-normalize-copy! + (-> obj root-override transv) + (-> obj init-dir) + (* 327680.0 (-> pp clock frames-per-second)) + ) + (set! (-> obj attack-mode) 'eco-blue) + (set! (-> obj max-speed) (* 327680.0 (-> pp clock frames-per-second))) + (set! (-> obj timeout) 1) + (set! (-> obj move) gun-blue-shot-move) + (vector-reset! (-> obj collide-normal)) + (set! (-> obj damage) (if (logtest? (game-feature gun-upgrade-damage) (-> *game-info* features)) + 4.0 + 2.0 + ) + ) + 0 + (none) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc new file mode 100644 index 0000000000..811266fad5 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc @@ -0,0 +1,638 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type gun-red-shot +(deftype gun-red-shot (process-drawable) + ((root-override collide-shape-moving :offset 128) + (probe-count int32 :offset-assert 200) + (probe-mask uint32 :offset-assert 204) + (actor-count int32 :offset-assert 208) + (attack-id uint32 :offset-assert 212) + (start-pos vector :inline :offset-assert 224) + (start-dir vector :inline :offset-assert 240) + (start-rot vector :inline :offset-assert 256) + (probe-dir vector 19 :inline :offset-assert 272) + ) + :heap-base #x1c0 + :method-count-assert 30 + :size-assert #x240 + :flag-assert #x1e01c00240 + (:methods + (blocked () _type_ :state 20) + (debug-idle () _type_ :state 21) + (idle () _type_ :state 22) + (init-probes! (_type_ collide-shape) none 23) + (gun-red-shot-method-24 (_type_) symbol 24) + (noop (_type_) none 25) + (gun-red-shot-method-26 (_type_) none 26) + (gun-red-shot-method-27 (_type_) none 27) + (gun-red-shot-method-28 (_type_ vector) sound-id 28) + (fire! (_type_ process-drawable int) object :behavior gun-red-shot 29) + ) + ) + +;; definition for method 3 of type gun-red-shot +(defmethod inspect gun-red-shot ((obj gun-red-shot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tprobe-count: ~D~%" (-> obj probe-count)) + (format #t "~2Tprobe-mask: ~D~%" (-> obj probe-mask)) + (format #t "~2Tactor-count: ~D~%" (-> obj actor-count)) + (format #t "~2Tattack-id: ~D~%" (-> obj attack-id)) + (format #t "~2Tstart-pos: #~%" (-> obj start-pos)) + (format #t "~2Tstart-dir: #~%" (-> obj start-dir)) + (format #t "~2Tstart-rot: #~%" (-> obj start-rot)) + (format #t "~2Tprobe-dir[19] @ #x~X~%" (-> obj probe-dir)) + (label cfg-4) + obj + ) + +;; definition for function target-gun-fire-red +;; INFO: Used lq/sq +;; WARN: Return type mismatch (pointer process) vs (pointer gun-red-shot). +(defbehavior target-gun-fire-red target () + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (-> self gun))) + (let ((s5-0 (-> *part-id-table* 190))) + (get-field-spec-by-id s5-0 (sp-field-id spt-omega)) + (let ((s5-1 (get-field-spec-by-id s5-0 (sp-field-id spt-rotate-y)))) + (if s5-1 + (set! (-> s5-1 initial-valuef) (y-angle (-> self control))) + ) + ) + ) + (let ((t9-3 sp-launch-particles-var) + (a0-3 *sp-particle-system-2d*) + (a1-2 (-> *part-id-table* 190)) + (a2-0 *launch-matrix*) + ) + (set! (-> a2-0 trans quad) (-> gp-0 fire-point quad)) + (t9-3 a0-3 a1-2 a2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (let ((v1-10 (-> gp-0 fire-point))) + (let ((a0-4 (-> gp-0 fire-dir-out))) + (let ((a1-4 24576.0)) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> a0-4 quad)) + ) + (.lvf vf4 (&-> v1-10 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s5-2 quad) vf6) + (set! (-> s5-2 w) 24576.0) + (when (and (sphere-in-view-frustum? (the-as sphere s5-2)) + (< 24576.0 (vector-vector-distance s5-2 (math-camera-pos))) + ) + (let* ((s4-1 (get-process *default-dead-pool* manipy #x4000)) + (s5-3 + (when s4-1 + (let ((t9-8 (method-of-type manipy activate))) + (t9-8 (the-as manipy s4-1) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + ) + (let ((s5-4 run-function-in-process) + (s3-0 s4-1) + (s2-0 manipy-init) + (s1-0 (-> gp-0 fire-point)) + (s0-0 (-> self entity)) + (t0-1 (art-group-get-by-name *level* "skel-gun-red-cone" (the-as (pointer uint32) #f))) + (t1-1 #f) + ) + 0 + ((the-as (function object object object object object object none) s5-4) s3-0 s2-0 s1-0 s0-0 t0-1 t1-1) + ) + (-> s4-1 ppointer) + ) + ) + ) + (when s5-3 + (send-event (ppointer->process s5-3) 'anim-mode 'play1) + (send-event (ppointer->process s5-3) 'anim "idle") + (forward-up->quaternion + (-> (the-as process-drawable (-> s5-3 0)) root quat) + (-> gp-0 fire-dir-out) + *up-vector* + ) + (let ((f30-1 (vector-dot + (-> gp-0 fire-dir-out) + (vector-! (new 'stack-no-clear 'vector) (-> gp-0 fire-point) (math-camera-pos)) + ) + ) + (f0-5 (vector-vector-xz-distance (-> gp-0 fire-point) (math-camera-pos))) + ) + (when (and (< f30-1 0.0) (< f0-5 32768.0)) + (set! (-> (the-as process-drawable (-> s5-3 0)) root scale z) + (lerp-scale 0.2 1.0 (fabs f0-5) 20480.0 32768.0) + ) + (set! (-> (the-as process-drawable (-> s5-3 0)) root scale x) + (-> (the-as process-drawable (-> s5-3 0)) root scale z) + ) + ) + ) + ) + ) + ) + ) + (process-spawn gun-red-shot (-> gp-0 fire-point) (-> gp-0 fire-dir-out) :to (ppointer->process (-> gp-0 gun))) + ) + ) + ) + +;; definition for function gun-red-shot-event-handler +(defbehavior gun-red-shot-event-handler gun-red-shot ((arg0 process-drawable) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (fire! self arg0 (the-as int (-> arg3 param 0))) + ) + ) + ) + +;; definition for method 29 of type gun-red-shot +;; INFO: Used lq/sq +(defmethod fire! gun-red-shot ((obj gun-red-shot) (arg0 process-drawable) (arg1 int)) + (let* ((s5-0 arg0) + (v1-0 (if (type? s5-0 process-drawable) + s5-0 + ) + ) + ) + (when v1-0 + (let* ((s5-2 (vector-! (new 'stack-no-clear 'vector) (-> v1-0 root trans) (-> obj start-pos))) + (f30-0 (* (if (< (vector-length s5-2) 24576.0) + 3.0 + 2.0 + ) + (if (logtest? (game-feature gun-upgrade-damage) (-> *game-info* features)) + 2.0 + 1.0 + ) + ) + ) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (rot-zxy-from-vector! s2-0 s5-2) + (let ((f28-0 (deg- (-> s2-0 x) (-> obj start-rot x))) + (f0-6 (deg- (-> s2-0 y) (-> obj start-rot y))) + ) + (when (or (< 2730.6667 (fabs f28-0)) (< 8192.0 (fabs f0-6))) + (let ((f1-5 (fmax -2730.6667 (fmin 2730.6667 f28-0))) + (f0-8 (fmax -8192.0 (fmin 8192.0 f0-6))) + ) + (set! (-> s2-0 x) (+ (-> obj start-rot x) f1-5)) + (set! (-> s2-0 y) (+ (-> obj start-rot y) f0-8)) + ) + (set-vector! s5-2 0.0 0.0 1.0 1.0) + (vector-rotate-around-x! s5-2 s5-2 (-> s2-0 x)) + (vector-rotate-around-y! s5-2 s5-2 (-> s2-0 y)) + ) + ) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer self)) + (set! (-> a1-7 num-params) 2) + (set! (-> a1-7 message) 'attack) + (set! (-> a1-7 param 0) (the-as uint arg1)) + (let ((v1-24 (new 'static 'attack-info :mask (attack-info-mask mode id attacker-velocity damage)))) + (set! (-> v1-24 id) (-> obj attack-id)) + (set! (-> v1-24 mode) 'eco-red) + (set! (-> v1-24 attacker-velocity quad) (-> s5-2 quad)) + (set! (-> v1-24 damage) f30-0) + (set! (-> a1-7 param 1) (the-as uint v1-24)) + ) + (send-event-function arg0 a1-7) + ) + ) + ) + ) + ) + +;; definition for method 25 of type gun-red-shot +;; WARN: Return type mismatch int vs none. +(defmethod noop gun-red-shot ((obj gun-red-shot)) + "Does nothing" + 0 + (none) + ) + +;; definition for method 23 of type gun-red-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init-probes! gun-red-shot ((obj gun-red-shot) (arg0 collide-shape)) + "Create all 19 probe vectors" + (let ((s5-0 (-> obj probe-count))) + (when (< s5-0 19) + (let* ((s4-0 (-> arg0 process)) + (a0-2 (if (type? s4-0 process-focusable) + (the-as process-focusable s4-0) + ) + ) + (s4-1 (new 'stack-no-clear 'vector)) + ) + (if a0-2 + (set! (-> s4-1 quad) (-> (get-trans a0-2 3) quad)) + (set! (-> s4-1 quad) (-> arg0 root-prim prim-core world-sphere quad)) + ) + (vector-! s4-1 s4-1 (-> obj start-pos)) + (vector-normalize! s4-1 1.0) + (let ((s3-2 (new 'stack-no-clear 'vector))) + (rot-zxy-from-vector! s3-2 s4-1) + (let ((f30-0 (deg- (-> s3-2 x) (-> obj start-rot x))) + (f0-4 (deg- (-> s3-2 y) (-> obj start-rot y))) + ) + (when (or (< 2730.6667 (fabs f30-0)) (< 8192.0 (fabs f0-4))) + (let ((f1-3 (fmax -2730.6667 (fmin 2730.6667 f30-0))) + (f0-6 (fmax -8192.0 (fmin 8192.0 f0-4))) + ) + (set! (-> s3-2 x) (+ (-> obj start-rot x) f1-3)) + (set! (-> s3-2 y) (+ (-> obj start-rot y) f0-6)) + ) + (set-vector! s4-1 0.0 0.0 1.0 1.0) + (vector-rotate-around-x! s4-1 s4-1 (-> s3-2 x)) + (vector-rotate-around-y! s4-1 s4-1 (-> s3-2 y)) + ) + ) + ) + (set! (-> obj probe-dir s5-0 quad) (-> s4-1 quad)) + ) + (set! (-> obj probe-count) (+ s5-0 1)) + ) + ) + (none) + ) + +;; definition for method 26 of type gun-red-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod gun-red-shot-method-26 gun-red-shot ((obj gun-red-shot)) + (local-vars (a2-5 float) (a2-12 float)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> obj start-dir quad)) + (vector-float*! s5-0 s5-0 43417.6) + (vector+! s5-0 s5-0 (-> obj start-pos)) + (set! (-> s5-0 w) 43827.2) + (let ((s4-0 (-> obj root-override root-prim prim-core collide-with))) + (set! *actor-list-length* 0) + (if (logtest? s4-0 (collide-spec hit-by-others-list)) + (set! *actor-list-length* (spatial-hash-method-36 *actor-hash* (the-as sphere s5-0) *actor-list* 256)) + ) + (when (logtest? s4-0 (collide-spec player-list)) + (let ((a0-6 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-18 (-> a0-6 next0))) + (while (!= a0-6 (-> *collide-player-list* alive-list-end)) + (let* ((a0-7 (-> (the-as connection a0-6) param1)) + (a1-4 (-> (the-as collide-shape a0-7) root-prim)) + ) + (when (logtest? s4-0 (-> a1-4 prim-core collide-as)) + (let ((a1-5 (-> a1-4 prim-core))) + (let ((a2-4 a1-5) + (a3-1 s5-0) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-2 a2-5) + (f1-1 (+ (-> a1-5 world-sphere w) (-> s5-0 w))) + ) + (when (< f0-2 (* f1-1 f1-1)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-7)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-6 v1-18) + *collide-player-list* + (set! v1-18 (-> v1-18 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-spec hit-by-player-list)) + (let ((a0-9 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-26 (-> a0-9 next0))) + (while (!= a0-9 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-10 (-> (the-as connection a0-9) param1)) + (a1-16 (-> (the-as collide-shape a0-10) root-prim)) + ) + (when (logtest? s4-0 (-> a1-16 prim-core collide-as)) + (let ((a1-17 (-> a1-16 prim-core))) + (let ((a2-11 a1-17) + (a3-2 s5-0) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-3 a2-12) + (f1-5 (+ (-> a1-17 world-sphere w) (-> s5-0 w))) + ) + (when (< f0-3 (* f1-5 f1-5)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-10)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-9 v1-26) + *collide-hit-by-player-list* + (set! v1-26 (-> v1-26 next0)) + ) + ) + ) + ) + (dotimes (s5-1 *actor-list-length*) + (let ((a1-28 (-> *actor-list* s5-1))) + (if (logtest? s4-0 (-> a1-28 root-prim prim-core collide-as)) + (init-probes! obj a1-28) + ) + ) + ) + ) + ) + (set! (-> obj actor-count) (-> obj probe-count)) + 0 + (none) + ) + ) + +;; definition for method 27 of type gun-red-shot +;; WARN: Return type mismatch int vs none. +(defmethod gun-red-shot-method-27 gun-red-shot ((obj gun-red-shot)) + (gun-red-shot-method-26 obj) + (let ((s5-0 (-> obj probe-count))) + (while (< s5-0 19) + (let ((f28-0 (rand-vu-float-range -2730.6667 2730.6667)) + (f30-0 (rand-vu-float-range -8192.0 8192.0)) + (s4-0 (-> obj probe-dir s5-0)) + ) + (set-vector! s4-0 0.0 0.0 1.0 1.0) + (vector-rotate-around-x! s4-0 s4-0 (+ (-> obj start-rot x) f28-0)) + (vector-rotate-around-y! s4-0 s4-0 (+ (-> obj start-rot y) f30-0)) + ) + (+! s5-0 1) + ) + (set! (-> obj probe-count) s5-0) + ) + 0 + (none) + ) + +;; definition for method 28 of type gun-red-shot +;; INFO: Used lq/sq +(defmethod gun-red-shot-method-28 gun-red-shot ((obj gun-red-shot) (arg0 vector)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (-> obj root-override))) + (let ((v1-0 (new 'stack-no-clear 'collide-query))) + (set! (-> gp-0 trans quad) (-> obj start-pos quad)) + (vector-float*! (-> gp-0 transv) arg0 61440.0) + (let ((a1-1 v1-0)) + (set! (-> a1-1 radius) (-> gp-0 root-prim local-sphere w)) + (set! (-> a1-1 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> a1-1 ignore-process0) obj) + (set! (-> a1-1 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> a1-1 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> a1-1 action-mask) (collide-action solid)) + ) + (set! (-> v1-0 start-pos quad) (-> gp-0 trans quad)) + (set! (-> v1-0 move-dist quad) (-> gp-0 transv quad)) + (fill-using-line-sphere *collide-cache* v1-0) + ) + (let ((v1-2 (-> gp-0 transv))) + (.lvf vf1 (&-> (-> gp-0 transv) quad)) + (let ((f0-2 (-> pp clock frames-per-second))) + (.mov at-0 f0-2) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-2 quad) vf1) + ) + (collide-shape-method-37 gp-0 (-> gp-0 transv)) + (if (logtest? (-> gp-0 status) (cshape-moving-flags t-surface t-wall)) + (sound-play "red-shot-hit") + ) + ) + ) + ) + ) + +;; definition for method 24 of type gun-red-shot +(defmethod gun-red-shot-method-24 gun-red-shot ((obj gun-red-shot)) + (let ((v1-0 (-> obj root-override))) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-0 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a1-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a1-0 ignore-process0) obj) + (set! (-> a1-0 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> a1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> a1-0 action-mask) (collide-action solid)) + ) + (if (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0) + #t + ) + ) + ) + +;; failed to figure out what this is: +(defstate debug-idle (gun-red-shot) + :virtual #t + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 3)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (dotimes (s5-0 (-> self probe-count)) + (vector-float*! gp-0 (-> self probe-dir s5-0) 61440.0) + (vector+! gp-0 gp-0 (-> self start-pos)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + gp-0 + (meters 0.5) + (if (< s5-0 (-> self actor-count)) + (new 'static 'rgba :r #xff :a #x80) + (new 'static 'rgba :r #xff :g #xff :a #x60) + ) + ) + ) + ) + (add-debug-vector + #t + (bucket-id debug2) + (-> self start-pos) + (-> self start-dir) + (meters 6) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate blocked (gun-red-shot) + :virtual #t + :event gun-red-shot-event-handler + :code (behavior () + (suspend) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (gun-red-shot) + :virtual #t + :event gun-red-shot-event-handler + :code (behavior () + (let ((gp-0 0)) + (countdown (s5-0 3) + (countdown (s4-0 7) + (when (< gp-0 19) + (gun-red-shot-method-28 self (-> self probe-dir gp-0)) + (+! gp-0 1) + ) + ) + (suspend) + ) + ) + (none) + ) + ) + +;; definition for function gun-red-shot-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs gun-red-shot. +(defbehavior gun-red-shot-init-by-other gun-red-shot ((arg0 vector) (arg1 vector)) + (set! (-> self start-pos quad) (-> arg0 quad)) + (set! (-> self start-dir quad) (-> arg1 quad)) + (rot-zxy-from-vector! (-> self start-rot) arg1) + (let* ((v1-2 *game-info*) + (a0-7 (+ (-> v1-2 attack-id) 1)) + ) + (set! (-> v1-2 attack-id) a0-7) + (set! (-> self attack-id) a0-7) + ) + (let ((s5-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate jak-red-shot)) + (let ((v1-10 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-10 prim-core collide-with) + (collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set-vector! (-> v1-10 local-sphere) 0.0 0.0 0.0 819.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-10) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> self root-override) s5-0) + ) + (let ((s5-1 (-> self root-override))) + (set! (-> s5-1 trans quad) (-> arg0 quad)) + (quaternion-copy! (-> s5-1 quat) (-> (the-as process-drawable (-> self parent 0)) root quat)) + (vector-identity! (-> s5-1 scale)) + ) + (collide-shape-method-46 (-> self root-override)) + (set! (-> self event-hook) gun-red-shot-event-handler) + (set! (-> self mask) (logior (process-mask projectile) (-> self mask))) + (logclear! (-> self mask) (process-mask enemy)) + (gun-red-shot-method-27 self) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 204 (seconds 0.1)) + (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-1 + (let ((t9-10 (method-of-type part-tracker activate))) + (t9-10 + (the-as part-tracker gp-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-11 run-function-in-process) + (a0-27 gp-1) + (a1-9 part-tracker-init) + (a2-7 (-> *part-group-id-table* 66)) + (a3-4 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> self start-pos quad)) + ((the-as (function object object object object object object object object none) t9-11) + a0-27 + a1-9 + a2-7 + a3-4 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> gp-1 ppointer) + ) + ) + (draw-beam (-> *part-id-table* 187) (-> self start-pos) (-> self start-dir) #f #t) + (sound-play "red-shot-fire") + (vector-float*! (-> self root-override transv) (-> self start-dir) 61440.0) + (the-as gun-red-shot (if (gun-red-shot-method-24 self) + (go-virtual blocked) + (go-virtual idle) + ) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc new file mode 100644 index 0000000000..320d101fb5 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc @@ -0,0 +1,423 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function target-gun-fire-yellow +;; INFO: Used lq/sq +(defbehavior target-gun-fire-yellow target () + (let ((s5-0 (-> self gun)) + (gp-0 (new 'stack-no-clear 'projectile-init-by-other-params)) + ) + (set! (-> gp-0 ent) (-> self entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options account-for-target-velocity deal-damage proj-options-8000)) + (set! (-> gp-0 pos quad) (-> s5-0 fire-point quad)) + (set! (-> gp-0 notify-handle) (the-as handle #f)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 ignore-handle) (process->handle (the-as process (send-event self 'get-vehicle)))) + (let* ((v1-9 *game-info*) + (a0-9 (+ (-> v1-9 attack-id) 1)) + ) + (set! (-> v1-9 attack-id) a0-9) + (set! (-> gp-0 attack-id) a0-9) + ) + (set! (-> gp-0 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (vector-float*! (-> gp-0 vel) (-> s5-0 fire-dir-out) 819200.0) + (spawn-projectile gun-yellow-shot gp-0 (ppointer->process (-> s5-0 gun)) *default-dead-pool*) + ) + ) + +;; definition for function someone-fire-yellow +;; INFO: Used lq/sq +(defun someone-fire-yellow ((arg0 process-drawable) (arg1 vector) (arg2 vector)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options account-for-target-velocity proj-options-8000)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (set! (-> gp-0 notify-handle) (the-as handle #f)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((v1-7 *game-info*) + (a0-8 (+ (-> v1-7 attack-id) 1)) + ) + (set! (-> v1-7 attack-id) a0-8) + (set! (-> gp-0 attack-id) a0-8) + ) + (set! (-> gp-0 timeout) (new 'static 'handle :process #x4b0 :u64 #x4b0)) + (vector-normalize-copy! (-> gp-0 vel) arg2 819200.0) + (spawn-projectile gun-yellow-shot gp-0 arg0 *default-dead-pool*) + ) + ) + +;; definition of type gun-yellow-shot +(deftype gun-yellow-shot (projectile) + ((hit-actor? symbol :offset-assert 472) + (tail-pos vector :inline :offset-assert 480) + (hit-pos vector :inline :offset-assert 496) + ) + :heap-base #x180 + :method-count-assert 40 + :size-assert #x200 + :flag-assert #x2801800200 + ) + +;; definition for method 3 of type gun-yellow-shot +(defmethod inspect gun-yellow-shot ((obj gun-yellow-shot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 obj) + ) + (format #t "~2Thit-actor?: ~A~%" (-> obj hit-actor?)) + (format #t "~2Ttail-pos: #~%" (-> obj tail-pos)) + (format #t "~2Thit-pos: #~%" (-> obj hit-pos)) + (label cfg-4) + obj + ) + +;; definition for method 24 of type gun-yellow-shot +;; WARN: Return type mismatch int vs none. +(defmethod draw-laser-sight gun-yellow-shot ((obj gun-yellow-shot)) + "TODO - confirm If applicable, draw the laser sight particles + :virtual" + (draw-beam (-> *part-id-table* 227) (-> obj tail-pos) (-> obj starting-dir) #f #t) + 0 + (none) + ) + +;; definition for method 25 of type gun-yellow-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-impact-particles gun-yellow-shot ((obj gun-yellow-shot)) + "Spawns associated particles with the projectile if applicable" + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((s4-0 (-> obj root-override trans)) + (a1-0 (-> obj tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) s4-0 a1-0)) + (f30-0 (vector-length s5-1)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> gp-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 223 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 223 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 223) a1-0 s5-1 #f #t) + (set! (-> *part-id-table* 223 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (let ((t9-2 sp-launch-particles-var) + (a0-5 *sp-particle-system-2d*) + (a1-2 (-> *part-id-table* 224)) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> gp-0 quad)) + (t9-2 a0-5 a1-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((s3-0 (new 'stack-no-clear 'matrix)) + (f28-1 (* 0.000015258789 f30-0)) + (f30-1 (-> *part-id-table* 226 init-specs 3 initial-valuef)) + ) + (forward-up->inv-matrix s3-0 s5-1 *up-vector*) + (set! (-> s3-0 trans quad) (-> s4-0 quad)) + (set! (-> *part-id-table* 226 init-specs 3 initial-valuef) (* f28-1 f30-1)) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 226) + s3-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! (-> *part-id-table* 226 init-specs 3 initial-valuef) f30-1) + ) + (let ((f0-6 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) + (when (< 0.0 f0-6) + (let ((f0-7 (* f0-6 f0-6)) + (f30-2 (-> *part-id-table* 225 init-specs 8 initial-valuef)) + (f28-2 (-> *part-id-table* 225 init-specs 8 random-rangef)) + ) + (set! (-> *part-id-table* 225 init-specs 8 initial-valuef) (* f30-2 f0-7)) + (set! (-> *part-id-table* 225 init-specs 8 random-rangef) (* f28-2 f0-7)) + (let ((t9-6 sp-launch-particles-var) + (a0-9 *sp-particle-system-2d*) + (a1-5 (-> *part-id-table* 225)) + (a2-6 *launch-matrix*) + ) + (set! (-> a2-6 trans quad) (-> gp-0 quad)) + (t9-6 a0-9 a1-5 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (set! (-> *part-id-table* 225 init-specs 8 initial-valuef) f30-2) + (set! (-> *part-id-table* 225 init-specs 8 random-rangef) f28-2) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 37 of type gun-yellow-shot +(defmethod deal-damage! gun-yellow-shot ((obj gun-yellow-shot) (arg0 process) (arg1 event-message-block)) + "Constructs an [[attack-info]] according to the projectile's `options`" + (let ((t9-0 (method-of-type projectile deal-damage!))) + (when (t9-0 obj arg0 arg1) + (set! (-> obj hit-actor?) #t) + #t + ) + ) + ) + +;; definition for method 26 of type gun-yellow-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod spawn-shell-particles gun-yellow-shot ((obj gun-yellow-shot)) + "TODO - confirm" + (cond + ((-> obj hit-actor?) + (let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 + (the-as part-tracker s5-0) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-2 run-function-in-process) + (a0-3 s5-0) + (a1-2 part-tracker-init) + (a2-4 (-> *part-group-id-table* 74)) + (a3-1 0) + (t0-0 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) (-> obj root-override trans quad)) + ((the-as (function object object object object object object object object none) t9-2) + a0-3 + a1-2 + a2-4 + a3-1 + t0-0 + t1-0 + t2-0 + t3-0 + ) + ) + (-> s5-0 ppointer) + ) + ) + ) + (else + (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s5-1 + (let ((t9-4 (method-of-type part-tracker activate))) + (t9-4 + (the-as part-tracker s5-1) + *entity-pool* + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((t9-5 run-function-in-process) + (a0-6 s5-1) + (a1-5 part-tracker-init) + (a2-9 (-> *part-group-id-table* 73)) + (a3-3 0) + (t0-1 #f) + (t1-1 #f) + (t2-1 #f) + (t3-1 *launch-matrix*) + ) + (set! (-> t3-1 trans quad) (-> obj root-override trans quad)) + ((the-as (function object object object object object object object object none) t9-5) + a0-6 + a1-5 + a2-9 + a3-3 + t0-1 + t1-1 + t2-1 + t3-1 + ) + ) + (-> s5-1 ppointer) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type gun-yellow-shot +(defmethod play-impact-sound gun-yellow-shot ((obj gun-yellow-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "yellow-shot-fir") + ) + ((= v1-0 (projectile-options lose-altitude)) + (sound-play "yellow-gun-burn") + ) + ((= v1-0 (projectile-options proj-options-2)) + (sound-play "yellow-shot-fiz") + ) + (else + (sound-play "yellow-shot-std" :id (-> obj sound-id) :position (-> obj root-override trans)) + ) + ) + ) + ) + +;; definition for method 38 of type gun-yellow-shot +(defmethod made-impact? gun-yellow-shot ((obj gun-yellow-shot)) + "TODO - queries the collision cache, return true/false" + (let ((v1-0 (-> obj root-override))) + (let ((a0-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a0-1 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a0-1 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a0-1 ignore-process0) obj) + (set! (-> a0-1 ignore-process1) (ppointer->process (-> obj parent))) + (set! (-> a0-1 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a0-1 action-mask) (collide-action solid)) + ) + (when (collide-shape-moving-method-65 v1-0 (-> v1-0 transv) -10240.0 12697.6 -4096.0) + (if (logtest? (-> obj root-override status) (cshape-moving-flags t-act)) + (set! (-> obj hit-actor?) #t) + ) + #t + ) + ) + ) + +;; definition for function gun-yellow-shot-move +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun gun-yellow-shot-move ((arg0 gun-yellow-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root-override))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 65536.0 f0-0) + (vector-normalize! s4-0 65536.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (when (logtest? (-> s5-0 status) (cshape-moving-flags t-surface)) + (if (logtest? (-> arg0 root-override status) (cshape-moving-flags t-act)) + (set! (-> arg0 hit-actor?) #t) + ) + (let ((v1-14 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> arg0 tail-pos) (-> s5-0 trans)) 2048.0)) + (a1-5 (-> arg0 hit-pos)) + ) + (set! (-> a1-5 quad) (-> s5-0 trans quad)) + (vector+! a1-5 a1-5 v1-14) + (collide-shape-method-29 (-> arg0 root-override) a1-5) + ) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +;; definition for method 30 of type gun-yellow-shot +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! gun-yellow-shot ((obj gun-yellow-shot)) + "Init the [[projectile]]'s [[collide-shape]]" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector cshape-moving-flags) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) nothing) + (set! (-> s5-0 penetrate-using) (penetrate jak-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 4096.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1) + ) + 0 + (none) + ) + +;; definition for method 31 of type gun-yellow-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init-proj-settings! gun-yellow-shot ((obj gun-yellow-shot)) + "Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc + :virtual" + (set! (-> obj hit-actor?) #f) + (set! (-> obj tail-pos quad) (-> obj root-override trans quad)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 204 (seconds 0.1)) + (set! (-> obj attack-mode) 'eco-yellow) + (set! (-> obj max-speed) 819200.0) + (set! (-> obj move) gun-yellow-shot-move) + (set! (-> obj timeout) (seconds 0.5)) + (set! (-> obj sound-id) (new-sound-id)) + (set! (-> obj damage) (if (logtest? (game-feature gun-upgrade-damage) (-> *game-info* features)) + 4.0 + 2.0 + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc index 111c22669e..f52af174c9 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -822,7 +822,7 @@ gp-1 (meters 0.2) "target" - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) ) ) @@ -1061,7 +1061,7 @@ gp-1 (meters 0.2) "ltransv" - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ff00) 0)) + (new 'static 'rgba :g #xff :a #x80) ) (set! (-> gp-1 quad) (-> self control unknwon-vector27 quad)) (vector-float*! gp-1 gp-1 0.5) @@ -1072,7 +1072,7 @@ gp-1 (meters 0.2) "btransv" - (the-as rgba (-> (new 'static 'array uint64 1 #x80ffffff) 0)) + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) ) ) ) @@ -1083,12 +1083,7 @@ (let ((s5-0 (new-stack-vector0)) (gp-0 (new-stack-vector0)) ) - (let* ((a0-0 (-> self control)) - (t9-0 (method-of-object a0-0 collide-shape-moving-method-62)) - ) - (-> self control unknown-surface01 slip-factor) - (t9-0 a0-0) - ) + (compute-acc-due-to-gravity (-> self control) s5-0 (-> self control unknown-surface01 slip-factor)) (vector-matrix*! gp-0 s5-0 (-> self control unknown-matrix00)) (vector-v++! (-> self control unknown-vector00) gp-0) ) @@ -1233,7 +1228,7 @@ (-> self control trans) gp-0 (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + (new 'static 'rgba :r #xff :g #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -1241,7 +1236,7 @@ (-> self control trans) s5-0 (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x800080ff) 0)) + (new 'static 'rgba :r #xff :g #x80 :a #x80) ) ) (add-debug-vector @@ -1250,7 +1245,7 @@ (-> self control trans) (-> self control unknown-matrix01 vector 2) (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) (rotate-toward-orientation! (-> self control) @@ -2040,7 +2035,7 @@ (-> self control trans) (-> self control local-normal) (meters 2) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) + (new 'static 'rgba :r #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -2048,7 +2043,7 @@ (-> self control trans) (-> self control unknown-dynamics00 gravity-normal) (meters 2.5) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) + (new 'static 'rgba :r #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -2056,7 +2051,7 @@ (-> self control trans) (-> self control dynam gravity-normal) (meters 3) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -2064,7 +2059,7 @@ (-> self control trans) (-> self control unknown-vector02) (meters 3) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) (add-debug-vector *display-target-marks* @@ -2072,7 +2067,7 @@ (-> self control trans) (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control unknown-quaternion00)) (meters 3) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) + (new 'static 'rgba :r #xff :a #x80) ) ) @@ -2337,29 +2332,17 @@ (-> (the-as swingpole s2-0) root trans) (-> (the-as swingpole s2-0) dir) (meters 3) - (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + (new 'static 'rgba :r #xff :b #xff :a #x80) ) (add-debug-sphere #t (bucket-id debug2) (-> self control unknown-vector30) (meters 0.2) - (the-as rgba (-> (new 'static 'array uint64 1 #x800000ff) 0)) - ) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - s4-1 - (meters 0.2) - (the-as rgba (-> (new 'static 'array uint64 1 #x8000ff00) 0)) - ) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - s3-1 - (meters 0.2) - (the-as rgba (-> (new 'static 'array uint64 1 #x8040ff00) 0)) + (new 'static 'rgba :r #xff :a #x80) ) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) s4-1 (meters 0.2) (new 'static 'rgba :g #xff :a #x80)) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) s3-1 (meters 0.2) (new 'static 'rgba :g #xff :b #x40 :a #x80)) (add-debug-sphere #t (bucket-id debug-no-zbuf1) s5-0 (meters 0.2) (new 'static 'rgba :b #xff :a #x80)) ) ) @@ -3354,15 +3337,7 @@ (set! (-> obj draw shadow-ctrl) *target-shadow-control*) (set! (-> obj shadow-backup) (-> obj draw shadow)) (set! (-> obj carry) - (new - 'process - 'carry-info - obj - 41 - (the-as vector (new 'static 'array float 1 0.0)) - (the-as vector (new 'static 'array float 1 0.0)) - 12743.111 - ) + (new 'process 'carry-info obj 41 (new 'static 'vector :w 1.0) (new 'static 'vector :z 1.0 :w 1.0) 12743.111) ) (set! (-> obj control unknown-vector29 x) (the-as float (-> obj node-list data 45))) (set! (-> obj control unknown-vector29 y) (the-as float (-> obj node-list data 55))) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/carry-h_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/carry-h_REF.gc new file mode 100644 index 0000000000..860304a624 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/carry-h_REF.gc @@ -0,0 +1,626 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type carry-info +(deftype carry-info (basic) + ((process (pointer target) :offset-assert 4) + (pickup-time time-frame :offset-assert 8) + (other-value float :offset-assert 16) + (other handle :offset-assert 24) + (point vector :inline :offset-assert 32) + (normal vector :inline :offset-assert 48) + (max-angle degrees :offset-assert 64) + (max-distance meters :offset-assert 68) + (max-pull meters :offset-assert 72) + (min-pull meters :offset-assert 76) + (grab-trans-blend float :offset-assert 80) + (carry-radius meters :offset-assert 84) + (backup-radius meters :offset-assert 88) + (joint int8 :offset-assert 92) + (mode carry-mode :offset-assert 93) + (face-dir int8 :offset-assert 94) + (local-point vector :inline :offset-assert 96) + (local-normal vector :inline :offset-assert 112) + (grab-quat quaternion :inline :offset-assert 128) + (grab-trans vector :inline :offset-assert 144) + (hold-trans vector :inline :offset-assert 160) + ) + :method-count-assert 17 + :size-assert #xb0 + :flag-assert #x11000000b0 + (:methods + (new (symbol type process-drawable int vector vector float) _type_ 0) + (carry-info-method-9 (_type_) none 9) + (distance-from-destination (_type_ carry-info) float 10) + (drag! (_type_ carry-info) none 11) + (drop-impl! (_type_ carry-info) none 12) + (carry-info-method-13 (_type_) symbol :behavior process-drawable 13) + (carry! (_type_ carry-info vector vector) none 14) + (drop! (_type_ carry-info) none 15) + (translate! (_type_) symbol :behavior process-drawable 16) + ) + ) + +;; definition for method 3 of type carry-info +(defmethod inspect carry-info ((obj carry-info)) + (when (not obj) + (set! obj obj) + (goto cfg-10) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tprocess: #x~X~%" (-> obj process)) + (format #t "~1Tpickup-time: ~D~%" (-> obj pickup-time)) + (format #t "~1Tother-value: ~f~%" (-> obj other-value)) + (format #t "~1Tother: ~D~%" (-> obj other)) + (format #t "~1Tpoint: ~`vector`P~%" (-> obj point)) + (format #t "~1Tnormal: ~`vector`P~%" (-> obj normal)) + (format #t "~1Tmax-angle: (deg ~r)~%" (-> obj max-angle)) + (format #t "~1Tmax-distance: (meters ~m)~%" (-> obj max-distance)) + (format #t "~1Tmax-pull: (meters ~m)~%" (-> obj max-pull)) + (format #t "~1Tmin-pull: (meters ~m)~%" (-> obj min-pull)) + (format #t "~1Tgrab-trans-blend: ~f~%" (-> obj grab-trans-blend)) + (format #t "~1Tcarry-radius: (meters ~m)~%" (-> obj carry-radius)) + (format #t "~1Tbackup-radius: (meters ~m)~%" (-> obj backup-radius)) + (format #t "~1Tjoint: ~D~%" (-> obj joint)) + (format #t "~1Tmode: #x~X : (carry-mode " (-> obj mode)) + (let ((s5-0 (-> obj mode))) + (if (= (logand s5-0 (carry-mode mech-carry)) (carry-mode mech-carry)) + (format #t "mech-carry ") + ) + (if (= (logand s5-0 (carry-mode mech-drag)) (carry-mode mech-drag)) + (format #t "mech-drag ") + ) + (if (= (logand s5-0 (carry-mode carry)) (carry-mode carry)) + (format #t "carry ") + ) + ) + (format #t ")~%") + (format #t "~1Tface-dir: ~D~%" (-> obj face-dir)) + (format #t "~1Tlocal-point: ~`vector`P~%" (-> obj local-point)) + (format #t "~1Tlocal-normal: ~`vector`P~%" (-> obj local-normal)) + (format #t "~1Tgrab-quat: ~`vector`P~%" (-> obj grab-quat)) + (format #t "~1Tgrab-trans: ~`vector`P~%" (-> obj grab-trans)) + (format #t "~1Thold-trans: ~`vector`P~%" (-> obj hold-trans)) + (label cfg-10) + obj + ) + +;; definition for method 0 of type carry-info +;; INFO: Used lq/sq +(defmethod new carry-info ((allocation symbol) + (type-to-make type) + (arg0 process-drawable) + (arg1 int) + (arg2 vector) + (arg3 vector) + (arg4 float) + ) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 mode) (carry-mode carry)) + (set! (-> gp-0 process) (the-as (pointer target) (process->ppointer arg0))) + (set! (-> gp-0 other) (the-as handle #f)) + (set! (-> gp-0 joint) arg1) + (set! arg4 (cond + ((= arg4 0.0) + 131072.0 + ) + (else + (empty) + arg4 + ) + ) + ) + (set! (-> gp-0 max-angle) arg4) + (set! (-> gp-0 max-distance) 8192.0) + (set! (-> gp-0 local-point quad) (-> arg2 quad)) + (set! (-> gp-0 local-normal quad) (-> arg3 quad)) + (let* ((s5-1 (-> arg0 root)) + (v1-7 (if (type? s5-1 collide-shape) + (the-as collide-shape s5-1) + ) + ) + ) + (when v1-7 + (set! (-> gp-0 backup-radius) (-> v1-7 root-prim local-sphere w)) + (set! (-> gp-0 carry-radius) (-> v1-7 root-prim local-sphere w)) + ) + ) + gp-0 + ) + ) + +;; definition for method 9 of type carry-info +;; WARN: Return type mismatch int vs none. +(defmethod carry-info-method-9 carry-info ((obj carry-info)) + (let ((s5-0 (-> obj process 0 node-list data (-> obj joint) bone transform))) + (vector-rotate*! (-> obj normal) (-> obj local-normal) s5-0) + (vector-matrix*! (-> obj point) (-> obj local-point) s5-0) + ) + 0 + (none) + ) + +;; definition for method 10 of type carry-info +(defmethod distance-from-destination carry-info ((obj carry-info) (arg0 carry-info)) + "Returns the distance from the current `point` and the provided [[carry-info]]'s `point`. + Returns `-1.0` if it exceeds the maximum allowed" + (let* ((f28-0 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) (-> arg0 point) (-> obj point)))) + (f30-0 (fabs (deg-diff f28-0 (vector-y-angle (-> obj normal))))) + (f28-1 (fabs (deg-diff (+ 32768.0 f28-0) (vector-y-angle (-> arg0 normal))))) + (f26-0 (vector-vector-distance (-> obj point) (-> arg0 point))) + ) + (cond + ((or (< (-> obj max-distance) f26-0) + (< (-> arg0 max-distance) f26-0) + (< (-> obj max-angle) f30-0) + (or (< (-> arg0 max-angle) f28-1) (zero? (logand (-> obj mode) (-> arg0 mode)))) + ) + (if (< (-> obj max-distance) f26-0) + (format + #t + " ~A ~A failed for this distance ~M ~M~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + f26-0 + (-> obj max-distance) + ) + ) + (if (< (-> arg0 max-distance) f26-0) + (format + #t + " ~A ~A failed for other distance ~M ~M~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + f26-0 + (-> arg0 max-distance) + ) + ) + (if (< (-> obj max-angle) f30-0) + (format + #t + " ~A ~A failed for this angle ~R ~R~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + f30-0 + (-> obj max-angle) + ) + ) + (if (< (-> arg0 max-angle) f28-1) + (format + #t + " ~A ~A failed for other angle ~R ~R~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + f28-1 + (-> arg0 max-angle) + ) + ) + (if (not (logtest? (-> obj mode) (-> arg0 mode))) + (format + #t + " ~A ~A failed for mode ~X ~X~%" + (-> obj process 0 name) + (-> arg0 process 0 name) + (-> obj mode) + (-> arg0 mode) + ) + ) + -1.0 + ) + (else + (+ f26-0 (* 409.6 (- 32768.0 f30-0))) + ) + ) + ) + ) + +;; definition for method 11 of type carry-info +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod drag! carry-info ((obj carry-info) (arg0 carry-info)) + (let ((v1-0 (-> arg0 process))) + (set! (-> obj other) (the-as handle (logior (if v1-0 + (new 'static 'handle :pid (-> v1-0 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-0) + ) + ) + ) + ) + (let ((v1-3 (-> obj process))) + (set! (-> arg0 other) (the-as handle (logior (if v1-3 + (new 'static 'handle :pid (-> v1-3 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-3) + ) + ) + ) + ) + (set! (-> obj pickup-time) (-> obj process 0 clock frame-counter)) + (set! (-> arg0 pickup-time) (-> arg0 process 0 clock frame-counter)) + (set! (-> arg0 grab-trans-blend) 1.0) + (let* ((s4-0 (the-as collide-shape (-> arg0 process 0 control))) + (v1-17 (if (type? (the-as control-info s4-0) collide-shape) + s4-0 + ) + ) + ) + (if v1-17 + (set! (-> v1-17 root-prim local-sphere w) (-> arg0 carry-radius)) + ) + ) + (quaternion-copy! (-> arg0 grab-quat) (-> arg0 process 0 control quat)) + (quaternion-rotate-y! (-> arg0 grab-quat) (-> arg0 grab-quat) (- (vector-y-angle (-> obj normal)))) + (let* ((f30-0 (quaternion-y-angle (-> arg0 grab-quat))) + (f0-8 (the float (the int (* 0.000061035156 (+ 73728.0 (the float (sar (shl (the int f30-0) 48) 48))))))) + (f28-0 (the float (sar (shl (the int (* 16384.0 f0-8)) 48) 48))) + ) + (quaternion-rotate-y! (-> arg0 grab-quat) (-> arg0 grab-quat) (deg-diff f30-0 f28-0)) + (let ((s3-2 + (matrix-4x4-inverse! + (new 'stack-no-clear 'matrix) + (-> arg0 process 0 node-list data (-> arg0 joint) bone transform) + ) + ) + (s4-3 (vector-negate! (new 'stack-no-clear 'vector) (-> obj normal))) + ) + (set! (-> s4-3 y) 0.0) + (vector-xz-normalize! s4-3 (-> arg0 max-pull)) + (vector+! s4-3 s4-3 (-> arg0 point)) + (vector-! s4-3 s4-3 (-> arg0 process 0 control trans)) + (vector-rotate-y! s4-3 s4-3 (- (deg-diff f30-0 f28-0))) + (vector+! s4-3 s4-3 (-> arg0 process 0 control trans)) + (vector-matrix*! s4-3 s4-3 s3-2) + (set! (-> arg0 grab-trans quad) (-> s4-3 quad)) + ) + ) + (set! (-> arg0 hold-trans x) + (+ (fmax (fmin (- (-> arg0 grab-trans x) (-> arg0 local-point x)) (-> arg0 min-pull)) (- (-> arg0 min-pull))) + (-> arg0 local-point x) + ) + ) + (set! (-> arg0 hold-trans z) + (+ (fmax (fmin (- (-> arg0 grab-trans z) (-> arg0 local-point z)) (-> arg0 min-pull)) (- (-> arg0 min-pull))) + (-> arg0 local-point z) + ) + ) + (change-parent (ppointer->process (-> arg0 process)) (ppointer->process (-> obj process))) + (let* ((v1-46 (-> arg0 process)) + (v1-49 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-46 + (the-as process-drawable (-> v1-46 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (let ((a0-30 (-> v1-49 prim-core collide-as)) + (a1-25 (-> arg0 process)) + ) + (set! (-> (the-as collide-shape (-> (the-as process-drawable (if a1-25 + (the-as process-drawable (-> a1-25 0 self)) + ) + ) + root + ) + ) + backup-collide-as + ) + a0-30 + ) + ) + (let ((v1-50 (-> v1-49 prim-core collide-with)) + (a0-31 (-> arg0 process)) + ) + (set! (-> (the-as collide-shape (-> (the-as process-drawable (if a0-31 + (the-as process-drawable (-> a0-31 0 self)) + ) + ) + root + ) + ) + backup-collide-with + ) + v1-50 + ) + ) + ) + (let* ((v1-51 (-> arg0 process)) + (v1-54 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-51 + (the-as process-drawable (-> v1-51 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (set! (-> v1-54 prim-core collide-as) (collide-spec)) + (set! (-> v1-54 prim-core collide-with) (collide-spec)) + ) + 0 + 0 + (none) + ) + +;; definition for method 12 of type carry-info +;; WARN: Return type mismatch int vs none. +(defmethod drop-impl! carry-info ((obj carry-info) (arg0 carry-info)) + (let ((a1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> arg0 process 0 control quat)))) + (set! (-> a1-2 y) 0.0) + (set-heading-vec-clear-roll-pitch! (-> arg0 process 0 control) a1-2) + ) + (let* ((s4-0 (the-as collide-shape (-> arg0 process 0 control))) + (v1-9 (if (type? (the-as control-info s4-0) collide-shape) + s4-0 + ) + ) + ) + (if v1-9 + (set! (-> v1-9 root-prim local-sphere w) (-> arg0 backup-radius)) + ) + ) + (set! (-> obj other) (the-as handle #f)) + (set! (-> arg0 other) (the-as handle #f)) + (change-parent (ppointer->process (-> arg0 process)) *entity-pool*) + (let* ((v1-13 (-> arg0 process)) + (v1-16 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-13 + (the-as process-drawable (-> v1-13 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (let ((a0-8 (-> arg0 process))) + (set! (-> v1-16 prim-core collide-as) + (-> (the-as collide-shape (-> (the-as process-drawable (if a0-8 + (the-as process-drawable (-> a0-8 0 self)) + ) + ) + root + ) + ) + backup-collide-as + ) + ) + ) + (let ((a0-12 (-> arg0 process))) + (set! (-> v1-16 prim-core collide-with) + (-> (the-as collide-shape (-> (the-as process-drawable (if a0-12 + (the-as process-drawable (-> a0-12 0 self)) + ) + ) + root + ) + ) + backup-collide-with + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type carry-info +;; INFO: Used lq/sq +(defmethod carry-info-method-13 carry-info ((obj carry-info)) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'carry-info) + (let* ((s4-0 (the-as carry-info (send-event-function (handle->process (-> obj other)) a1-0))) + (s2-0 (-> obj process 0 node-list data (-> obj joint) bone transform)) + (v1-10 + (vector-matrix*! + (new 'stack-no-clear 'vector) + (vector-lerp! (new 'stack-no-clear 'vector) (-> obj hold-trans) (-> obj grab-trans) (-> obj grab-trans-blend)) + s2-0 + ) + ) + (s3-2 (vector-! (new 'stack-no-clear 'vector) v1-10 (-> obj process 0 control trans))) + ) + (when s4-0 + (let ((s5-1 (new 'stack-no-clear 'matrix))) + (let* ((a2-3 (-> s4-0 process 0 node-list data (-> s4-0 joint) bone transform)) + (v1-16 (-> a2-3 vector 0 quad)) + (a0-16 (-> a2-3 vector 1 quad)) + (a1-3 (-> a2-3 vector 2 quad)) + (a2-4 (-> a2-3 trans quad)) + ) + (set! (-> s5-1 vector 0 quad) v1-16) + (set! (-> s5-1 vector 1 quad) a0-16) + (set! (-> s5-1 vector 2 quad) a1-3) + (set! (-> s5-1 trans quad) a2-4) + ) + (vector-normalize! (the-as vector (-> s5-1 vector)) 1.0) + (vector-normalize! (-> s5-1 vector 1) 1.0) + (vector-normalize! (-> s5-1 vector 2) 1.0) + (vector-reset! (-> s5-1 trans)) + (let* ((a1-8 (quaternion-normalize! (matrix->quaternion (new 'stack-no-clear 'quaternion) s5-1))) + (s5-3 (quaternion-normalize! (quaternion*! a1-8 a1-8 (-> obj grab-quat)))) + (v1-19 (vector-! (new 'stack-no-clear 'vector) (-> s4-0 point) s3-2)) + (f30-0 (* 0.033333335 (the float (- (-> self clock frame-counter) (-> obj pickup-time))))) + ) + (cond + ((>= (- (-> self clock frame-counter) (-> obj pickup-time)) (seconds 1)) + (set! (-> obj process 0 control trans quad) (-> v1-19 quad)) + (quaternion-copy! (-> obj process 0 control quat) s5-3) + ) + (else + (vector-lerp! + (-> obj process 0 control trans) + (-> obj process 0 control trans) + v1-19 + (fmin 1.0 (* f30-0 (-> self clock time-adjust-ratio))) + ) + (quaternion-slerp! + (-> obj process 0 control quat) + (-> obj process 0 control quat) + s5-3 + (fmin 1.0 (* f30-0 (-> self clock time-adjust-ratio))) + ) + ) + ) + ) + ) + #t + ) + ) + ) + ) + +;; definition for method 14 of type carry-info +;; INFO: Used lq/sq +;; WARN: Return type mismatch vector vs none. +(defmethod carry! carry-info ((obj carry-info) (arg0 carry-info) (arg1 vector) (arg2 vector)) + (let ((v1-0 (-> arg0 process))) + (set! (-> obj other) (the-as handle (logior (if v1-0 + (new 'static 'handle :pid (-> v1-0 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-0) + ) + ) + ) + ) + (let ((v1-3 (-> obj process))) + (set! (-> arg0 other) (the-as handle (logior (if v1-3 + (new 'static 'handle :pid (-> v1-3 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-3) + ) + ) + ) + ) + (set! (-> obj pickup-time) (-> obj process 0 clock frame-counter)) + (set! (-> arg0 pickup-time) (-> arg0 process 0 clock frame-counter)) + (set! (-> arg0 grab-trans-blend) 1.0) + (let* ((s2-0 (the-as collide-shape (-> arg0 process 0 control))) + (v1-17 (if (type? (the-as control-info s2-0) collide-shape) + s2-0 + ) + ) + ) + (if v1-17 + (set! (-> v1-17 root-prim local-sphere w) (-> arg0 carry-radius)) + ) + ) + (quaternion-copy! (-> arg0 grab-quat) (-> arg0 process 0 control quat)) + (set! (-> arg0 grab-trans quad) (-> arg0 process 0 control trans quad)) + (set! (-> arg0 hold-trans quad) (-> obj process 0 control trans quad)) + (let ((s2-2 (vector-! (new 'stack-no-clear 'vector) (-> obj point) (-> arg0 point)))) + (vector-xz-normalize! s2-2 (-> arg0 max-pull)) + (vector+! s2-2 s2-2 (-> arg0 point)) + (let ((f30-0 (y-angle (-> arg0 process 0 control)))) + (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s2-2 (-> obj process 0 control trans))) + (let* ((f0-5 (the float (-> obj face-dir))) + (f28-0 (the float (sar (shl (the int (* 16384.0 f0-5)) 48) 48))) + ) + (set-vector! arg2 (sin (+ f30-0 f28-0)) 0.0 (cos (+ f30-0 f28-0)) 1.0) + ) + ) + ) + (vector+float*! arg1 (-> arg0 point) arg2 (- (-> arg0 carry-radius))) + (change-parent (ppointer->process (-> arg0 process)) (ppointer->process (-> obj process))) + (let* ((v1-46 (-> arg0 process)) + (v1-49 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-46 + (the-as process-drawable (-> v1-46 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (let ((a0-32 (-> v1-49 prim-core collide-as)) + (a1-7 (-> arg0 process)) + ) + (set! (-> (the-as collide-shape (-> (the-as process-drawable (if a1-7 + (the-as process-drawable (-> a1-7 0 self)) + ) + ) + root + ) + ) + backup-collide-as + ) + a0-32 + ) + ) + (let ((v1-50 (-> v1-49 prim-core collide-with)) + (a0-33 (-> arg0 process)) + ) + (set! (-> (the-as collide-shape (-> (the-as process-drawable (if a0-33 + (the-as process-drawable (-> a0-33 0 self)) + ) + ) + root + ) + ) + backup-collide-with + ) + v1-50 + ) + ) + ) + (let* ((v1-51 (-> arg0 process)) + (v1-54 + (-> (the-as collide-shape (-> (the-as process-drawable (if v1-51 + (the-as process-drawable (-> v1-51 0 self)) + ) + ) + root + ) + ) + root-prim + ) + ) + ) + (set! (-> v1-54 prim-core collide-as) (collide-spec)) + (set! (-> v1-54 prim-core collide-with) (collide-spec)) + ) + 0 + (none) + ) + +;; definition for method 16 of type carry-info +(defmethod translate! carry-info ((obj carry-info)) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'carry-info) + (let ((a0-6 (the-as carry-info (send-event-function (handle->process (-> obj other)) a1-0)))) + (when a0-6 + (let ((v1-6 (vector-! (new 'stack-no-clear 'vector) (-> obj grab-trans) (-> obj hold-trans)))) + (vector+! (-> obj process 0 control trans) (-> a0-6 process 0 control trans) v1-6) + ) + #t + ) + ) + ) + ) + +;; definition for method 15 of type carry-info +(defmethod drop! carry-info ((obj carry-info) (arg0 carry-info)) + (drop-impl! obj arg0) + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/ui/minimap-h_REF.gc b/test/decompiler/reference/jak2/engine/ui/minimap-h_REF.gc index 026fbfc1db..49e4b9291d 100644 --- a/test/decompiler/reference/jak2/engine/ui/minimap-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/minimap-h_REF.gc @@ -463,7 +463,7 @@ :size-assert #xd0 :flag-assert #xb000000d0 (:methods - (minimap-trail-method-9 () none 9) + (minimap-trail-method-9 (_type_ vector vector) float 9) (minimap-trail-method-10 () none 10) ) ) @@ -551,7 +551,7 @@ :flag-assert #x1c00000648 (:methods (minimap-method-9 () none 9) - (minimap-method-10 () none 10) + (minimap-method-10 (_type_ connection-minimap minimap-trail) minimap-trail 10) (minimap-method-11 () none 11) (minimap-method-12 (_type_ process uint int vector int) connection-minimap 12) (minimap-method-13 () none 13) diff --git a/test/decompiler/reference/jak2/engine/util/capture_REF.gc b/test/decompiler/reference/jak2/engine/util/capture_REF.gc index 232dad9813..98e6e739c1 100644 --- a/test/decompiler/reference/jak2/engine/util/capture_REF.gc +++ b/test/decompiler/reference/jak2/engine/util/capture_REF.gc @@ -6,7 +6,6 @@ (when *debug-segment* ;; definition for function gs-set-default-store-image ;; INFO: Used lq/sq -;; ERROR: Unsupported inline assembly instruction kind - [sync.l] (defun gs-set-default-store-image ((arg0 gs-store-image-packet) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 int) (arg6 int) (arg7 int)) (set! (-> arg0 vifcode 0) (new 'static 'vif-tag)) (set! (-> arg0 vifcode 1) (new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd mskpath3))) diff --git a/test/decompiler/reference/jak2/kernel/gcommon_REF.gc b/test/decompiler/reference/jak2/kernel/gcommon_REF.gc index ed511ec7e9..1ae7fc0f31 100644 --- a/test/decompiler/reference/jak2/kernel/gcommon_REF.gc +++ b/test/decompiler/reference/jak2/kernel/gcommon_REF.gc @@ -955,7 +955,6 @@ ) ;; definition for function breakpoint-range-set! -;; ERROR: Unsupported inline assembly instruction kind - [mtc0 Debug, a0] ;; ERROR: Unsupported inline assembly instruction kind - [mtdab a1] ;; ERROR: Unsupported inline assembly instruction kind - [mtdabm a2] (defun breakpoint-range-set! ((arg0 uint) (arg1 uint) (arg2 uint)) diff --git a/test/decompiler/test_FormExpressionBuild2.cpp b/test/decompiler/test_FormExpressionBuild2.cpp index fb36820eea..845d8719f3 100644 --- a/test/decompiler/test_FormExpressionBuild2.cpp +++ b/test/decompiler/test_FormExpressionBuild2.cpp @@ -664,7 +664,7 @@ TEST_F(FormRegressionTestJak1, DmaSyncCrash) { test_with_expr(func, type, expected); } -TEST_F(FormRegressionTestJak1, DmaSend) { +TEST_F(FormRegressionTestJak1, DmaSendDraft) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -64\n" diff --git a/test/game/test_newpad.cpp b/test/game/test_newpad.cpp index 7c2c750085..386e3d53ed 100644 --- a/test/game/test_newpad.cpp +++ b/test/game/test_newpad.cpp @@ -5,7 +5,7 @@ #include "game/graphics/pipelines/opengl.h" #include "game/system/newpad.h" #include "gtest/gtest.h" -//#include "gmock/gmock.h" +// #include "gmock/gmock.h" class PeripheralTest : public ::testing::Test { public: