From 81b6d5fe086fa6016e879177272d58894c90a339 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 10 Sep 2022 18:03:17 -0400 Subject: [PATCH] d/jak2: finish `find-nearest` | `trajectory` | `editable-h` and most of `editable` and `editable-player` (#1847) Also made a first-pass of their SQL schema in preparation for getting that working. --- .gitignore | 4 + decompiler/config/jak2/all-types.gc | 491 ++- .../jak2/anonymous_function_types.jsonc | 12 +- decompiler/config/jak2/hacks.jsonc | 13 +- decompiler/config/jak2/label_types.jsonc | 12 + decompiler/config/jak2/stack_structures.jsonc | 66 + decompiler/config/jak2/type_casts.jsonc | 103 + goal_src/jak1/dgos/engine.gd | 2 +- goal_src/jak1/dgos/game.gd | 2 +- .../jak1/engine/collide/collide-planes.gc | 7 - .../jak1/engine/gfx/ocean/ocean-frames.gc | 4 + .../jak1/engine/gfx/ocean/ocean-tables.gc | 4 + .../engine/gfx/ocean/ocean-trans-tables.gc | 4 + goal_src/jak1/game.gp | 2 +- goal_src/jak2/dgos/engine.gd | 4 +- goal_src/jak2/engine/camera/cam-debug.gc | 421 +-- goal_src/jak2/engine/camera/cam-states.gc | 405 +-- .../jak2/engine/collide/collide-cache-h.gc | 6 +- goal_src/jak2/engine/collide/collide-h.gc | 81 +- .../jak2/engine/collide/collide-planes.gc | 9 - .../jak2/engine/collide/find-nearest-h.gc | 26 + goal_src/jak2/engine/collide/find-nearest.gc | 417 +++ goal_src/jak2/engine/debug/debug-h.gc | 46 +- goal_src/jak2/engine/debug/editable-h.gc | 743 ++++ goal_src/jak2/engine/debug/editable-player.gc | 2581 ++++++++++++++ goal_src/jak2/engine/debug/editable.gc | 1746 ++++++++++ goal_src/jak2/engine/draw/drawable-h.gc | 2 +- goal_src/jak2/engine/game/main-h.gc | 2 + goal_src/jak2/engine/gfx/lights-h.gc | 8 + .../jak2/engine/gfx/ocean/ocean-tables.gc | 2 + .../engine/gfx/ocean/ocean-trans-tables.gc | 2 + goal_src/jak2/engine/level/level-h.gc | 4 + goal_src/jak2/engine/nav/nav-control-h.gc | 16 +- goal_src/jak2/engine/physics/trajectory-h.gc | 35 +- goal_src/jak2/engine/physics/trajectory.gc | 535 +++ .../jak2/engine/spatial-hash/actor-hash-h.gc | 3 + goal_src/jak2/engine/target/board/board-h.gc | 2 +- goal_src/jak2/engine/target/logic-target.gc | 75 +- goal_src/jak2/engine/util/script-h.gc | 4 + goal_src/jak2/game.gp | 2 +- goal_src/jak2/kernel/gkernel-h.gc | 4 +- goal_src/jak2/tools/editable-schema.sql | 204 ++ scripts/gsrc/code_retention/code_retention.py | 2 +- scripts/gsrc/update-from-decomp.py | 1 + .../jak2/engine/camera/cam-debug_REF.gc | 232 +- .../jak2/engine/camera/cam-states_REF.gc | 400 +-- .../engine/collide/collide-cache-h_REF.gc | 6 +- .../jak2/engine/collide/collide-h_REF.gc | 2 +- .../jak2/engine/collide/find-nearest_REF.gc | 579 ++++ .../reference/jak2/engine/debug/debug_REF.gc | 217 +- .../jak2/engine/debug/editable-h_REF.gc | 1203 +++++++ .../jak2/engine/debug/editable-player_REF.gc | 2978 +++++++++++++++++ .../jak2/engine/debug/editable_REF.gc | 2838 ++++++++++++++++ .../jak2/engine/nav/nav-control-h_REF.gc | 8 +- .../jak2/engine/physics/trajectory-h_REF.gc | 20 +- .../jak2/engine/physics/trajectory_REF.gc | 569 ++++ .../jak2/engine/target/board/board-h_REF.gc | 2 +- .../jak2/engine/target/logic-target_REF.gc | 14 +- test/offline/config/jak2/config.jsonc | 16 + 59 files changed, 15967 insertions(+), 1231 deletions(-) delete mode 100644 goal_src/jak1/engine/collide/collide-planes.gc delete mode 100644 goal_src/jak2/engine/collide/collide-planes.gc create mode 100644 goal_src/jak2/tools/editable-schema.sql create mode 100644 test/decompiler/reference/jak2/engine/collide/find-nearest_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/debug/editable-h_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/debug/editable_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc diff --git a/.gitignore b/.gitignore index 18641cbe36..5214e0f9bc 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,7 @@ svnrev.h ci-artifacts/ out/build/ __pycache__/ + +# sqlite stuff +*.db +*.db-journal diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 15341e87e1..a10bbcd3e5 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -98,8 +98,10 @@ (define-extern kset-language (function language-enum int)) (define-extern reset-graph (function int int int int none)) -(define-extern loading-level kheap) +(declare-type sql-result basic) +(define-extern sql-query (function string sql-result)) +(define-extern loading-level kheap) (defenum kmalloc-flags @@ -158,7 +160,8 @@ ;; children of inline-array-class should define their own data which overlays this one. (_data uint8 :score -50 :dynamic :offset 16) ) - (:methods (new (symbol type int) _type_ 0)) + (:methods + (new (symbol type int) _type_ 0)) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 @@ -15417,6 +15420,7 @@ ) ) +(declare-type collide-query structure) (deftype impact-control (structure) ((process (pointer process-drawable) :offset-assert 0) (radius float :offset-assert 4) @@ -15433,7 +15437,7 @@ (new (symbol type process-drawable int float collide-spec) _type_ 0) (initialize (_type_ process-drawable int float collide-spec) impact-control :behavior process 9) (update-from-cspace (_type_) none 10) - (impact-control-method-11 (_type_) none 11) + (impact-control-method-11 (_type_ collide-query process pat-surface) float 11) ) ) @@ -15445,8 +15449,8 @@ (:methods (new (symbol type vector vector) _type_ 0) (initialize (_type_ vector vector) point-tracker 9) - (point-tracker-method-10 () none 10) - (point-tracker-method-11 () none 11) + (point-tracker-method-10 (_type_ vector vector vector float) vector 10) + (point-tracker-method-11 (_type_ vector vector vector float) vector 11) ) ) @@ -15458,8 +15462,8 @@ :size-assert #x30 :flag-assert #xe00000030 (:methods - (combo-tracker-method-12 () none 12) - (combo-tracker-method-13 () none 13) + (combo-tracker-method-12 (_type_ vector vector process time-frame) combo-tracker 12) + (combo-tracker-method-13 (_type_ handle vector float vector float) none 13) ) ) @@ -15498,11 +15502,11 @@ :size-assert #x40 :flag-assert #xe00000040 (:methods - (cubic-curve-method-9 () none 9) - (cubic-curve-method-10 () none 10) - (cubic-curve-method-11 () none 11) - (cubic-curve-method-12 () none 12) - (cubic-curve-method-13 () none 13) + (cubic-curve-method-9 (_type_ vector vector vector vector) none 9) + (cubic-curve-method-10 (_type_ vector float) vector 10) + (cubic-curve-method-11 (_type_ vector float) vector 11) + (cubic-curve-method-12 (_type_ vector float) vector 12) + (debug-draw-curve (_type_) none 13) ) ) @@ -16906,13 +16910,13 @@ :flag-assert #x1a00008670 (:methods (collide-cache-method-9 () none 9) ;; (debug-draw (_type_) none 9) - (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) - (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) ;; (fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol 11) + (fill-and-probe-using-line-sphere (_type_ collide-query) float 10) + (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) (collide-cache-method-12 (_type_ collide-query) none 12) ;; (fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float 12) - (collide-cache-method-13 () none 13) ;; (fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none 13) - (fill-using-spheres (_type_ collide-query) none 14) ;; (fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable pat-surface) none 14) - (collide-cache-method-15 () none 15) ;; (fill-using-spheres (_type_ collide-using-spheres-params) none 15) - (collide-cache-method-16 (_type_) float 16) ;; (fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none 16) + (fill-using-line-sphere (_type_ collide-query) none 13) ;; (fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none 13) + (fill-using-spheres (_type_ collide-query) none 14) + (collide-cache-method-15 () none 15) + (collide-cache-method-16 (_type_ collide-query) float 16) ;; (fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none 16) (probe-using-spheres (_type_ collide-query) symbol 17) ;; (initialize (_type_) none 17) (collide-cache-method-18 () none 18) ;; (probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float 18) (collide-cache-method-19 () none 19) ;; (probe-using-spheres (_type_ collide-using-spheres-params) symbol 19) @@ -16977,7 +16981,7 @@ (best-my-prim basic :offset 120) (move-vec vector :inline :offset 224) (best-u float :offset 112 :score -1) - (action-mask uint32 :offset-assert 352) + (action-mask collide-action :offset-assert 352) (local-box4w bounding-box4w :inline :offset-assert 368) (search-box bounding-box4w :inline :offset-assert 400) (search-vector vector4w :inline :offset-assert 432) @@ -20901,7 +20905,7 @@ ;; (new (symbol type collide-shape int float) _type_ 0) (nav-control-method-9 () none 9) ;; (debug-draw (_type_) none 9) (nav-control-method-10 () none 10) ;; (point-in-bounds? (_type_ vector) symbol 10) - (nav-control-method-11 () none 11) ;; (dummy-11 (_type_ vector) vector 11) + (nav-control-method-11 (_type_ vector) vector 11) ;; (dummy-11 (_type_ vector) vector 11) (nav-control-method-12 () none 12) ;; (TODO-RENAME-12 (_type_ nav-gap-info) symbol 12) (nav-control-method-13 () none 13) ;; (dummy-13 (_type_ vector vector) vector 13) (nav-control-method-14 () none 14) ;; (set-current-poly! (_type_ nav-poly) none 14) @@ -20910,7 +20914,7 @@ (nav-control-method-17 () none 17) ;; (project-onto-nav-mesh (_type_ vector vector) vector 17) (nav-control-method-18 () none 18) ;; (find-poly (_type_ vector) nav-poly 18) (nav-control-method-19 () none 19) ;; (dummy-19 (_type_ vector collide-shape-moving vector float) none 19) - (nav-control-method-20 () none 20) ;; (project-point-into-tri-3d (_type_ nav-poly vector vector) vector 20) + (nav-control-method-20 (_type_ vector vector vector int symbol symbol) none 20) ;; (project-point-into-tri-3d (_type_ nav-poly vector vector) vector 20) (nav-control-method-21 () none 21) ;; (TODO-RENAME-21 (_type_ vector) nav-poly 21) (nav-control-method-22 () none 22) ;; (TODO-RENAME-22 (_type_ vector float) symbol 22) (nav-control-method-23 () none 23) ;; (dummy-23 (_type_ vector check-vector-collision-with-nav-spheres-info) float 23) @@ -21309,7 +21313,7 @@ (define-extern sound-set-reverb (function int float float uint int)) (define-extern sound-set-ear-trans (function vector vector vector float int)) (define-extern sound-play-by-name (function sound-name sound-id int int int sound-group symbol sound-id)) -(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id)) +(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id)) ;; NOTE - the `vector` can also be #t (define-extern sound-pause (function sound-id int)) (define-extern sound-stop (function sound-id int)) (define-extern sound-continue (function sound-id int)) @@ -21882,7 +21886,7 @@ ;; (define-extern render-boundary-quad function) ;; (function lbvtx dma-buffer none) ;; (define-extern render-boundary-tri function) ;; (function lbvtx dma-buffer none) ;; (define-extern add-debug-bound-internal function) -;; (define-extern add-debug-bound function) +(define-extern add-debug-bound (function int transform int rgba rgba int none)) (define-extern cpu-delay (function int none)) (define-extern qword-read-time (function (array uint128) int int)) (define-extern bugfix? (function symbol)) @@ -23041,8 +23045,8 @@ ;; trajectory ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern traj2d-calc-initial-speed-using-tilt function) -;; (define-extern traj3d-calc-initial-velocity-using-tilt function) +(define-extern traj2d-calc-initial-speed-using-tilt (function traj2d-params symbol)) +(define-extern traj3d-calc-initial-velocity-using-tilt (function traj3d-params symbol)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sparticle-launcher ;; @@ -24948,7 +24952,7 @@ ) |# -;; (define-extern *actor-hash* object) +(define-extern *actor-hash* spatial-hash) ;; (define-extern *actor-hash-buckets* object) (define-extern update-actor-hash (function none)) @@ -25942,8 +25946,8 @@ (define-extern key-assoc (function none)) (define-extern *script-form* int) ;; (define-extern level-from-heap function) -(define-extern *syntax-context* int) -(define-extern *script-context* int) +(define-extern *syntax-context* script-context) +(define-extern *script-context* script-context) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-obs ;; @@ -26848,19 +26852,50 @@ ;; find-nearest ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++find-nearest:search-info-flag +(defenum search-info-flag + :type uint32 + :bitfield #t + (crate 0) + (enemy 1) + (on-screen 2) + (prefer-dist 3) + (prefer-angle 4) + (prefer-xz 5) + (cull-angle 6) + (cull-xz 7) + (back-point 8) + (combo 9) + (probe 10) + (probe-camera 11) + (check-track 12) + (prefer-center 13) + ) +;; ---find-nearest:search-info-flag + (deftype search-info (structure) - () + ( + (point vector :inline :offset-assert 0) + (best-point vector :inline :offset-assert 16) + (match-handle handle :offset-assert 32) + (match basic :offset-assert 40) + (best float :offset-assert 44) + (radius float :offset-assert 48) + (rating search-info-flag :offset-assert 52) + (require search-info-flag :offset-assert 56) + (mask search-info-flag :offset-assert 60) + (rot-base vector :inline :offset-assert 64) + (ack-point vector :inline :offset-assert 80) + (rot-range float :offset-assert 96) + ) :method-count-assert 9 :size-assert #x64 :flag-assert #x900000064 - ;; Failed to read fields. ) -|# -;; (define-extern *search-info* object) ;; search-info -;; (define-extern find-nearest-attackable function) ;; (function vector float uint uint vector float projectile) -;; (define-extern find-nearest-focusable function) +(define-extern *search-info* search-info) +(define-extern find-nearest-attackable (function vector float uint uint vector vector float basic)) +(define-extern find-nearest-focusable (function (array collide-shape) vector float search-info-flag search-info-flag vector vector float basic)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; task-arrow ;; @@ -29256,245 +29291,367 @@ ;; editable-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++editable-h:editable-command +(defenum editable-command + :type uint32 + :bitfield #f + (none 0) + (exit 1) + (kill 2) + (select-one 3) + (select-toggle 4) + (select-all 5) + (select-none 6) + (select-region 7) + (select-face 8) + (select-prim 9) + (select-current-owner 10) + (select-current-region 11) + (select-current-face 12) + (select-current-prim 13) + (pick-target 14) + (pick-loc 15) + (pick-yes-no 16) + (cancel 17) + (drag-move-xy 18) + (drag-move-xz 19) + (drag-move-x 20) + (drag-move-y 21) + (drag-move-z 22) + (drag-resize 23) + (camera-tumble 24) + (camera-xy 25) + (camera-xz 26) + (insert-sphere 27) + (insert-point 28) + (insert-sample 29) + (insert-sample-camera 30) + (insert-light 31) + (insert-entity 32) + (insert-face 33) + (insert-plane 34) + (insert-box 35) + (delete 36) + (copy 37) + (resize 38) + (snap-to-ground 39) + (snap-xz 40) + (snap-y 41) + (flip-side 42) + (region-set 43) + (region-new 44) + (edit-plane-set 45) + (edit-plane-clear 46) + (delete-region 47) + (copy-region 48) + (region-add 49) + (save 50) + (load 51) + (update-game 52) + (print-region-info 53) + (refresh-filter 54) + (rotate-level 55) + (translate-y-level 56) + ) +;; ---editable-h:editable-command + +;; +++editable-h:editable-filter +(defenum editable-filter + :type uint32 + :bitfield #t + (none 0) + (unknown 1) + (sound 2) + (part 3) + (user-setting 4) + (cam-setting 5) + (load 6) + (water-command 7) + (camera 8) + (target 9) + (water 10) + (data 11) + (city_vis 12) + (sample 13) + (light 14) + (entity 15) + (selected 16) + ) +;; ---editable-h:editable-filter + (deftype editable-region (basic) - ((changed basic :offset-assert 4) - (locked basic :offset-assert 8) + ((changed symbol :offset-assert 4) + (locked symbol :offset-assert 8) (id uint64 :offset-assert 16) - (filter uint32 :offset-assert 24) - (tree basic :offset-assert 28) - (level basic :offset-assert 32) - (on-enter basic :offset-assert 36) - (on-inside basic :offset-assert 40) - (on-exit basic :offset-assert 44) + (filter editable-filter :offset-assert 24) + (tree string :offset-assert 28) + (level string :offset-assert 32) + (on-enter string :offset-assert 36) + (on-inside string :offset-assert 40) + (on-exit string :offset-assert 44) ) :method-count-assert 13 :size-assert #x30 :flag-assert #xd00000030 - ;; field on-enter uses ~A with a signed load field on-inside uses ~A with a signed load field on-exit uses ~A with a signed load (:methods + (new (symbol type) _type_ 0) ;; added to avoid re-definition errors (even though nothing was being re-defined) (editable-region-method-9 () none 9) - (editable-region-method-10 () none 10) - (editable-region-method-11 () none 11) - (editable-region-method-12 () none 12) + (editable-region-method-10 (_type_ int) symbol 10) + (editable-region-method-11 (_type_ vector int) none 11) + (editable-region-method-12 (_type_) editable-filter 12) ) ) -|# -#| +;; +++editable-h:editable-flag +(defenum editable-flag + :type uint32 + :bitfield #t + (selected) + (no-save) + (orient) + (x) + (y) + (z) + (no-plane-snap) + (no-update) + (mark) + (top-set) + (bot-set) + (changed) + ) +;; ---editable-h:editable-flag + +(declare-type editable-array basic) (deftype editable (basic) - () + ( + (flags editable-flag :offset-assert 4) + (name string :offset-assert 8) + (id uint32 :offset-assert 12) + (region editable-region :offset-assert 16) ;; or symbol? + (owner pair :offset-assert 20) ;; command-list? + ) :method-count-assert 30 :size-assert #x18 :flag-assert #x1e00000018 - ;; Failed to read fields. (:methods - (editable-method-9 () none 9) - (editable-method-10 () none 10) - (editable-method-11 () none 11) - (editable-method-12 () none 12) - (editable-method-13 () none 13) - (editable-method-14 () none 14) - (editable-method-15 () none 15) - (editable-method-16 () none 16) - (editable-method-17 () none 17) - (editable-method-18 () none 18) - (editable-method-19 () none 19) - (editable-method-20 () none 20) - (editable-method-21 () none 21) - (editable-method-22 () none 22) - (editable-method-23 () none 23) - (editable-method-24 () none 24) - (editable-method-25 () none 25) - (editable-method-26 () none 26) - (editable-method-27 () none 27) - (editable-method-28 () none 28) - (editable-method-29 () none 29) + (get-color + "Returns the [[rgba]] that corresponds to the type of [[editable]] TODO - document the colors" + (_type_ int) rgba 9) + (editable-method-10 (_type_) none 10) + (editable-method-11 (_type_ vector) symbol 11) + (select-editable! (_type_ symbol) none 12) + (edit-get-distance "Returns the distance from the camera to the [[editable]], or -1.0" (_type_ vector) float 13) + (edit-get-trans "Returns the `trans` [[vector]] or [[*null-vector*]]" (_type_) vector 14) + (editable-method-15 (_type_ vector int) none 15) + (edit-coord! (_type_ vector editable-flag) none 16) + (editable-method-17 (_type_ vector) none 17) + (editable-method-18 (_type_ vector matrix) none 18) + (editable-method-19 (_type_ vector) none 19) + (editable-method-20 (_type_ vector vector vector vector) none 20) + (editable-method-21 (_type_ editable-region) none 21) + (editable-method-22 (_type_ editable-array int int) symbol 22) + (editable-method-23 (_type_) symbol 23) + (editable-method-24 (_type_) none 24) + (editable-method-25 (_type_ editable-array) none 25) + (editable-method-26 (_type_ editable editable-array) none 26) + (editable-method-27 (_type_ editable-array) editable 27) + (editable-method-28 (_type_ editable-filter) none 28) + (editable-method-29 (_type_ editable-filter) symbol 29) ) ) -|# -#| +(declare-type editable-player process-drawable) +(declare-type editable-plane editable) (deftype editable-array (basic) - () + ( + (allocated-length int32 :offset-assert 4) + (length int32 :offset-assert 8) + (region editable-region :offset-assert 12) + (backup-region editable-region :offset-assert 16) + (region-lock? symbol :offset-assert 20) + (move-lock? symbol :offset-assert 24) + (move-speed float :offset-assert 28) + (selection (array editable) :offset-assert 32) + (filter editable-filter 2 :offset-assert 36) + (target editable :offset-assert 44) + (target-mode uint32 :offset-assert 48) ;; enum? + (target-command basic :offset-assert 52) ;; editable-command? + (target-message string :offset-assert 56) + (edit-plane editable-plane :offset-assert 60) + (edit-plane-center vector :inline :offset-assert 64) + (edit-plane-normal vector :inline :offset-assert 80) + (level-offset vector :inline :offset-assert 96) + (level-info-id uint32 :offset-assert 112) + (level uint32 :offset-assert 116) ;; symbol? + (edit-param0 float :offset-assert 120) + (data editable :dynamic :offset-assert 124) + ) :method-count-assert 18 :size-assert #x7c :flag-assert #x120000007c - ;; Failed to read fields. (:methods - (editable-array-method-9 () none 9) - (editable-array-method-10 () none 10) - (editable-array-method-11 () none 11) - (editable-array-method-12 () none 12) - (editable-array-method-13 () none 13) - (editable-array-method-14 () none 14) - (editable-array-method-15 () none 15) - (editable-array-method-16 () none 16) - (editable-array-method-17 () none 17) + (new (symbol type int) _type_ 0) + (editable-array-method-9 (_type_ editable-command editable-array) symbol :behavior editable-player 9) + (editable-array-method-10 (_type_ vector int) editable 10) + (editable-array-method-11 (_type_) int 11) + (editable-array-method-12 (_type_ editable-array) none 12) + (editable-array-method-13 (_type_ uint basic string) none 13) + (editable-array-method-14 (_type_ (function symbol) symbol) none 14) + (editable-array-method-15 (_type_ editable) none 15) + (editable-array-method-16 (_type_) none 16) + (editable-array-method-17 (_type_ vector vector) vector 17) ) ) -|# -#| (deftype editable-point (editable) - () + ( + (radius float :offset-assert 24) + (trans vector :inline :offset-assert 32) + ) :method-count-assert 30 :size-assert #x30 :flag-assert #x1e00000030 - ;; Failed to read fields. (:methods - ) + (new (symbol type vector editable-region) _type_ 0)) ) -|# -#| (deftype editable-sphere (editable-point) () :method-count-assert 30 :size-assert #x30 :flag-assert #x1e00000030 - ;; Failed to read fields. (:methods - ) - ) -|# + (new (symbol type vector float editable-region) _type_ 0))) -#| (deftype editable-sample (editable-point) () :method-count-assert 30 :size-assert #x30 - :flag-assert #x1e00000030 - ;; Failed to read fields. - (:methods - ) - ) -|# + :flag-assert #x1e00000030) -#| (deftype editable-light (editable-sphere) - () + ( + (direction vector :inline :offset-assert 48) + (color vector :inline :offset-assert 64) + (decay-start float :offset-assert 80) + (ambient-point-ratio float :offset-assert 84) + (brightness float :offset-assert 88) + ) :method-count-assert 30 :size-assert #x5c :flag-assert #x1e0000005c - ;; Failed to read fields. (:methods - ) - ) -|# + (new (symbol type vector float editable-region) _type_ 0))) -#| (deftype editable-entity (editable-point) () :method-count-assert 30 :size-assert #x30 - :flag-assert #x1e00000030 - ;; Failed to read fields. - (:methods - ) - ) -|# + :flag-assert #x1e00000030) -#| (deftype editable-face (editable) - () + ( + (length int32 :offset-assert 24) + (normal vector :inline :offset-assert 32) + (center vector :inline :offset-assert 48) + (vertex editable-point 6 :offset-assert 64) + ) :method-count-assert 32 :size-assert #x58 :flag-assert #x2000000058 - ;; Failed to read fields. (:methods - (editable-face-method-30 () none 30) - (editable-face-method-31 () none 31) + (new (symbol type editable-region) _type_ 0) + (editable-face-method-30 (_type_ (inline-array vector)) int 30) + (editable-face-method-31 (_type_ vector) vector 31) ) ) -|# -#| (deftype editable-plane (editable) - () + ( + (length int32 :offset-assert 24) + (radius float :offset-assert 28) + (vertex editable-point 2 :offset-assert 32) + ) :method-count-assert 32 :size-assert #x28 :flag-assert #x2000000028 - ;; Failed to read fields. (:methods - (editable-plane-method-30 () none 30) - (editable-plane-method-31 () none 31) + (new (symbol type editable-region) _type_ 0) + (editable-plane-method-30 (_type_ matrix) int 30) + (editable-plane-method-31 (_type_ vector) vector 31) ) ) -|# (deftype editable-player (process-drawable) - ((current basic :offset-assert 200) - (select-command uint32 :offset-assert 204) - (move-command uint32 :offset-assert 208) - (extra-command uint32 :offset-assert 212) + ((current editable-array :offset-assert 200) + (select-command function :offset-assert 204) + (move-command function :offset-assert 208) + (extra-command function :offset-assert 212) (left-handed basic :offset-assert 216) (light-names basic :offset-assert 220) - (external-cam-mode basic :offset-assert 224) - (command object 6 :offset-assert 228) + (external-cam-mode symbol :offset-assert 224) + (command function 6 :offset-assert 228) (close-menu-time time-frame :offset-assert 256) ) :method-count-assert 22 :size-assert #x108 :flag-assert #x1600900108 (:methods - (editable-player-method-20 () none 20) - (editable-player-method-21 () none 21) + (idle () _type_ :state 20) + (editable-player-method-21 (_type_) none 21) ) ) -#| (deftype editable-work (basic) ((num-found int16 :offset-assert 4) (last-found int16 :offset-assert 6) (last-x float :offset-assert 8) (last-y float :offset-assert 12) - (found UNKNOWN 256 :offset-assert 16) - (dists UNKNOWN 256 :offset-assert 1040) + (found editable 256 :offset-assert 16) ;; a guess + (dists uint32 256 :offset-assert 1040) ) :method-count-assert 9 :size-assert #x810 :flag-assert #x900000810 ) -|# -;; (define-extern *editable-temp-id* object) -;; (define-extern editable-command->string function) -;; (define-extern editable-filter->string function) -;; (define-extern *editable-work* object) -(define-extern *editable* symbol) +(define-extern *editable-temp-id* int) +(define-extern editable-command->string (function editable-command string)) ;; TODO - find a caller +(define-extern editable-filter->string (function editable-filter basic string)) ;; TODO - find a caller +(define-extern *editable-work* editable-work) +(define-extern *editable* (pointer editable-player)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; editable ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern update-light-sphere-from-editable-light function) -;; (define-extern *editable-sample-region* object) -;; (define-extern *editable-light-region* object) -;; (define-extern *editable-entity-region* object) +(define-extern update-light-sphere-from-editable-light (function editable-light none)) +(define-extern *editable-sample-region* editable-region) +(define-extern *editable-light-region* editable-region) +(define-extern *editable-entity-region* editable-region) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; editable-player ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cleanup-selection function) -;; (define-extern insert-box function) -;; (define-extern execute-select function) -;; (define-extern execute-mouse-move function) -;; (define-extern execute-move function) -(define-extern editable-player-init (function symbol none)) ;; TODO - return type not confirmed +(define-extern cleanup-selection (function editable-array none)) +(define-extern insert-box (function editable-array vector none)) +(define-extern execute-select (function editable-array editable-command editable-array symbol)) +(define-extern execute-mouse-move (function editable-array editable-command editable-array symbol)) +(define-extern execute-move (function editable-array editable-command editable-array symbol)) +(define-extern editable-player-init (function symbol none :behavior editable-player)) ;; TODO - return type not confirmed (define-extern *editable-menu-context* debug-menu-context) -;; (define-extern editable-menu-command function) -;; (define-extern editable-menu-command-no-close function) -;; (define-extern dm-region-tree-pick-func function) -;; (define-extern dm-editable-flag-pick-func function) -;; (define-extern dm-editable-filter0-pick-func function) -;; (define-extern dm-editable-filter1-pick-func function) -;; (define-extern dm-editable-light-float-func function) -;; (define-extern dm-cam-externalize2 function) -;; (define-extern dm-editable-boolean-toggle-pick-func function) -;; (define-extern editable-menu-context-make-menus function) -;; (define-extern insert-sample-camera function) +(define-extern editable-menu-command (function int none)) +(define-extern editable-menu-command-no-close (function int none)) ;; TODO - whats the int +(define-extern dm-region-tree-pick-func (function symbol debug-menu-msg symbol)) +(define-extern dm-editable-flag-pick-func (function editable-flag debug-menu-msg symbol)) +(define-extern dm-editable-filter0-pick-func (function editable-filter debug-menu-msg symbol)) +(define-extern dm-editable-filter1-pick-func (function editable-filter debug-menu-msg symbol)) +(define-extern dm-editable-light-float-func (function object debug-menu-msg float symbol object)) +(define-extern dm-cam-externalize2 (function symbol debug-menu-msg symbol)) +(define-extern dm-editable-boolean-toggle-pick-func (function int debug-menu-msg none)) +(define-extern editable-menu-context-make-menus (function debug-menu-context none)) +(define-extern insert-sample-camera (function symbol none)) ;; (define-extern *debug-hook* object) ;; (function none) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index e6b6bb1ec3..2045b794c6 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -226,5 +226,15 @@ [200, "(function debug-menu debug-menu symbol)"], [201, "(function debug-menu debug-menu symbol)"] ], - "airlock": [[13, "(function pair :behavior com-airlock)"]] + "airlock": [[13, "(function pair :behavior com-airlock)"]], + "find-nearest": [[2, "(function process-drawable object)"]], + "editable": [[76, "(function string int)"]], + "editable-player": [ + [0, "(function none)"], + [3, "(function int float float float)"], + [4, "(function int float float symbol)"], + [24, "(function editable symbol symbol)"], + [25, "(function editable symbol symbol)"], + [28, "(function editable symbol)"] + ] } diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 439450f2c7..a6a2823ce5 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -140,7 +140,7 @@ "(anon-function 2 scene)", "progress-trans", "(method 10 bigmap)", - "(method 9 editable-region)", + "(method 9 editable-region)", // condition branch assert hit "(method 57 enemy)", "(anon-function 10 meet-brutter)", "(method 154 vehicle-racer)", @@ -157,9 +157,9 @@ "(anon-function 4 gun-states)", "(anon-function 28 grenadier)", "(anon-function 24 grenadier)", - // no longer bug or asm, not done yet - "particle-adgif-callback" + "particle-adgif-callback", + "editable-menu-context-make-menus" // label guesser can't handle pairs ], // these functions use pairs and the decompiler @@ -197,7 +197,12 @@ "debug-menu-make-task-menu", "(method 19 gui-control)", // airlock - "(method 24 com-airlock)" + "(method 24 com-airlock)", + "(method 19 gui-control)", + "(method 28 editable)", + "execute-select", + "(method 29 editable)", + "(method 25 editable)" ], // If format is used with the wrong number of arguments, diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index d393e47e50..8680c8f5be 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -153,5 +153,17 @@ ["L419", "(pointer uint64)", 1], ["L420", "(pointer uint64)", 1], ["L421", "(pointer uint64)", 1] + ], + "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], + ["L480", "vector"], + ["L479", "vector"], + ["L474", "vector"] ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 5f58549eec..3db8e724e5 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -670,6 +670,72 @@ "target-move-dist": [ [16, "vector"] ], + "(trans close com-airlock)": [[16, "script-context"]], + "traj3d-calc-initial-velocity-using-tilt": [[16, "traj2d-params"]], + "(method 9 cubic-curve)": [[16, "trajectory"]], + "(method 10 cubic-curve)": [[16, "trajectory"]], + "(method 11 cubic-curve)": [[16, "trajectory"]], + "(method 12 cubic-curve)": [[16, "trajectory"]], + "(method 13 cubic-curve)": [[16, "trajectory"]], + "(method 13 combo-tracker)": [ + [16, "event-message-block"], + [112, ["array", "collide-shape", 32]] + ], + "(anon-function 2 find-nearest)": [[128, "collide-query"]], + "find-nearest-focusable": [[160, "collide-query"]], + "(method 11 impact-control)": [ + [16, "touching-shapes-entry"], + [48, "event-message-block"] + ], + "(method 16 collide-cache)": [[16, "collide-cache-tri"]], + "(method 20 editable)": [ + [16, "vector"], + [32, "vector"] + ], + "(method 31 editable-face)": [[16, "matrix"]], + "(method 13 editable-face)": [ + [64, ["inline-array", "vector", 6]], + [160, "vector"], + [48, "vector"], + [32, "vector"], + [16, "vector"] + ], + "(method 30 editable-plane)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + "(method 13 editable-plane)": [[128, "transform"]], + "execute-select": [[16, "vector"]], + "(method 9 editable-array)": [[16, "vector"]], + "execute-mouse-move": [ + // TODO - needed or hang occurs + [80, "vector"], + [96, "vector"], + [112, "vector"], + [64, "vector"], + [48, "vector"], + [32, "vector"], + [16, "vector"] + ], + "(method 12 editable-array)": [ + [96, "vector"], + [160, "vector"] + ], + "insert-box": [ + [16, "vector"], + [32, "transform"] + ], + "(method 11 editable-region)": [[16, "vector2h"]], + "(method 29 editable-face)": [ + [16, ["inline-array", "vector", 6]], + [304, "matrix"], + [112, ["inline-array", "vector", 6]], + [240, ["array", "editable-point", 6]] + ], + "(method 10 editable-face)": [[16, ["inline-array", "vector", 6]]], + "(method 11 editable)": [[16, "collide-query"]], + "(method 10 editable-plane)": [[16, "matrix"]], // placeholder "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index fc477e80af..d163e877a2 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -1806,6 +1806,109 @@ "target-update-ik": [ [288, "f30", "float"] ], + "(anon-function 2 find-nearest)": [ + [28, "s3", "collide-shape"], + [55, "s2", "process-focusable"], + [[59, 63], "s2", "process-focusable"], + [66, "s3", "collide-shape"] + ], + "find-nearest-focusable": [ + [50, "s3", "process-focusable"], + [66, "s3", "process-focusable"], + [[298, 303], "s3", "process-focusable"] + ], + "(method 11 impact-control)": [[55, "s2", "collide-shape-prim"]], + "(method 16 collide-cache)": [ + [47, "a0", "collide-shape-prim-sphere"], + [17, "s4", "collide-cache-prim"], + [23, "s4", "collide-cache-prim"], + [27, "s4", "collide-cache-prim"], + [46, "s4", "collide-cache-prim"], + [65, "s4", "(inline-array collide-cache-prim)"] + ], + "(method 28 editable)": [[[4, 8], "a0", "editable"]], + "execute-select": [ + [[425, 429], "a0", "editable"], + [512, "v1", "editable"], + [[463, 467], "a0", "editable"], + [605, "v1", "editable"], + [[556, 560], "a0", "editable"] + ], + "(method 12 editable-array)": [ + [877, "a1", "editable-point"], + [713, "s1", "editable-point"] + ], + "insert-box": [ + [279, "a0", "editable"], + [288, "a0", "editable"], + [297, "a0", "editable"], + [306, "a0", "editable"], + [330, "a0", "editable"], + [339, "a0", "editable"], + [348, "a0", "editable"], + [357, "a0", "editable"], + [388, "a0", "editable"], + [397, "a0", "editable"], + [406, "a0", "editable"], + [415, "a0", "editable"], + [439, "a0", "editable"], + [448, "a0", "editable"], + [457, "a0", "editable"], + [466, "a0", "editable"], + [497, "a0", "editable"], + [506, "a0", "editable"], + [515, "a0", "editable"], + [524, "a0", "editable"], + [555, "a0", "editable"], + [564, "a0", "editable"], + [573, "a0", "editable"], + [582, "a0", "editable"], + [611, "a0", "editable"] + ], + + "(event idle editable-player)": [ + [351, "s4", "editable-light"], + [409, "s4", "editable-light"], + [312, "v1", "float"], + [314, "v1", "float"], + [316, "v1", "float"], + [382, "v1", "float"], + [384, "v1", "float"], + [386, "v1", "float"], + [388, "v1", "float"], + [437, "v1", "float"], + [468, "a0", "editable-light"] + ], + "(method 29 editable)": [[[4, 8], "a0", "editable"]], + "(method 28 editable-point)": [ + [88, "t9", "(function editable-point editable-command none)"] + ], + "(method 27 editable-plane)": [ + [9, "t9", "(function editable-plane editable-array editable)"], + [39, "gp", "editable-plane"], + [15, "v1", "editable-plane"], + [31, "v1", "editable-plane"] + ], + "(method 25 editable-face)": [ + [25, "t9", "(function editable-face editable-array none)"] + ], + "(method 25 editable-plane)": [ + [25, "t9", "(function editable-plane editable-array none)"] + ], + "(method 29 editable-face)": [ + [318, "a0", "(array editable-point)"], + [234, "a1", "editable-point"] + ], + "(method 27 editable-face)": [ + [9, "t9", "(function editable-face editable-array editable)"], + [39, "gp", "editable-face"], + [[16, 20], "a0", "editable-face"], + [31, "v1", "editable-face"] + ], + "(method 25 editable-light)": [ + [9, "t9", "(function editable-light editable-array none)"] + ], + "(method 25 editable)": [[[12, 17], "a0", "editable"]], // placeholder "placeholder-do-not-add-below": [] } diff --git a/goal_src/jak1/dgos/engine.gd b/goal_src/jak1/dgos/engine.gd index ee6cd1b5c9..3494134f89 100644 --- a/goal_src/jak1/dgos/engine.gd +++ b/goal_src/jak1/dgos/engine.gd @@ -223,7 +223,7 @@ ("collide-shape.o" "collide-shape") ("collide-shape-rider.o" "collide-shape-rider") ("collide.o" "collide") - ("collide-planes.o" "collide-planes") + ;; ("collide-planes.o" "collide-planes") ("merc-death.o" "merc-death") ("water-h.o" "water-h") ("camera.o" "camera") diff --git a/goal_src/jak1/dgos/game.gd b/goal_src/jak1/dgos/game.gd index c561df6c96..5535d06a9b 100644 --- a/goal_src/jak1/dgos/game.gd +++ b/goal_src/jak1/dgos/game.gd @@ -219,7 +219,7 @@ ("collide-shape.o" "collide-shape") ("collide-shape-rider.o" "collide-shape-rider") ("collide.o" "collide") - ("collide-planes.o" "collide-planes") + ;; ("collide-planes.o" "collide-planes") ("merc-death.o" "merc-death") ("water-h.o" "water-h") ("camera.o" "camera") diff --git a/goal_src/jak1/engine/collide/collide-planes.gc b/goal_src/jak1/engine/collide/collide-planes.gc deleted file mode 100644 index d33aef2042..0000000000 --- a/goal_src/jak1/engine/collide/collide-planes.gc +++ /dev/null @@ -1,7 +0,0 @@ -;;-*-Lisp-*- -(in-package goal) - -;; name: collide-planes.gc -;; name in dgo: collide-planes -;; dgos: GAME, ENGINE - diff --git a/goal_src/jak1/engine/gfx/ocean/ocean-frames.gc b/goal_src/jak1/engine/gfx/ocean/ocean-frames.gc index 9642950be3..d829e1897b 100644 --- a/goal_src/jak1/engine/gfx/ocean/ocean-frames.gc +++ b/goal_src/jak1/engine/gfx/ocean/ocean-frames.gc @@ -5,6 +5,10 @@ ;; name in dgo: ocean-frames ;; dgos: GAME, ENGINE +;; og:ignore-from-loc + +;; DECOMP BEGINS + (define *ocean-wave-frames* (new 'static 'array uint32 16384 #x130af9fc diff --git a/goal_src/jak1/engine/gfx/ocean/ocean-tables.gc b/goal_src/jak1/engine/gfx/ocean/ocean-tables.gc index e26cec6ee5..fa7cc511bc 100644 --- a/goal_src/jak1/engine/gfx/ocean/ocean-tables.gc +++ b/goal_src/jak1/engine/gfx/ocean/ocean-tables.gc @@ -13,6 +13,10 @@ ;; - sunken ;; levels like beach/jungle/misty will use village1's ocean map. +;; og:ignore-from-loc + +;; DECOMP BEGINS + (define *ocean-spheres-village1* (new 'static 'ocean-spheres :spheres diff --git a/goal_src/jak1/engine/gfx/ocean/ocean-trans-tables.gc b/goal_src/jak1/engine/gfx/ocean/ocean-trans-tables.gc index bcc28f530c..a6c0f05405 100644 --- a/goal_src/jak1/engine/gfx/ocean/ocean-trans-tables.gc +++ b/goal_src/jak1/engine/gfx/ocean/ocean-trans-tables.gc @@ -1,6 +1,10 @@ ;;-*-Lisp-*- (in-package goal) +;; og:ignore-from-loc + +;; DECOMP BEGINS + ;; definition for symbol *ocean-left-table*, type (pointer float) (define *ocean-left-table* (new 'static 'array float 28 0.0 diff --git a/goal_src/jak1/game.gp b/goal_src/jak1/game.gp index 1cddc35af3..9e08736160 100644 --- a/goal_src/jak1/game.gp +++ b/goal_src/jak1/game.gp @@ -1894,7 +1894,7 @@ "collide/collide-shape.gc" "collide/collide-shape-rider.gc" "collide/collide.gc" - "collide/collide-planes.gc" +;; "collide/collide-planes.gc" "gfx/merc/merc-death.gc" "common-obs/water-h.gc" "camera/camera.gc" diff --git a/goal_src/jak2/dgos/engine.gd b/goal_src/jak2/dgos/engine.gd index b63aaea6b7..f6f6814181 100644 --- a/goal_src/jak2/dgos/engine.gd +++ b/goal_src/jak2/dgos/engine.gd @@ -253,7 +253,7 @@ ("collide-shape.o" "collide-shape") ("collide-shape-rider.o" "collide-shape-rider") ("collide.o" "collide") - ("collide-planes.o" "collide-planes") + ;; ("collide-planes.o" "collide-planes") ("spatial-hash.o" "spatial-hash") ("actor-hash.o" "actor-hash") ("merc-death.o" "merc-death") @@ -368,4 +368,4 @@ ("nav-graph-editor.o" "nav-graph-editor") ("sampler.o" "sampler") ("default-menu.o" "default-menu") - ) \ No newline at end of file + ) diff --git a/goal_src/jak2/engine/camera/cam-debug.gc b/goal_src/jak2/engine/camera/cam-debug.gc index eca98b1162..0b0c16e286 100644 --- a/goal_src/jak2/engine/camera/cam-debug.gc +++ b/goal_src/jak2/engine/camera/cam-debug.gc @@ -18,37 +18,29 @@ ;; this file is debug only (declare-file (debug)) (when *debug-segment* -;; failed to figure out what this is: (when (or (not *camera-old-cpu*) (zero? *camera-old-cpu*)) (set! *camera-old-cpu* 0) 0 ) -;; failed to figure out what this is: (when (or (not *camera-old-vu*) (zero? *camera-old-vu*)) (set! *camera-old-vu* 0) 0 ) -;; failed to figure out what this is: (when (or (not *camera-old-tfrag-bytes*) (zero? *camera-old-tfrag-bytes*)) (set! *camera-old-tfrag-bytes* 0) 0 ) -;; definition (perm) for symbol *camera-old-level*, type string (define-perm *camera-old-level* string (new 'global 'string 128 (the-as string #f))) -;; definition (perm) for symbol *camera-old-stat-string-tfrag*, type string (define-perm *camera-old-stat-string-tfrag* string (new 'global 'string 128 (the-as string #f))) -;; definition (perm) for symbol *camera-old-stat-string-tfrag-near*, type string (define-perm *camera-old-stat-string-tfrag-near* string (new 'global 'string 128 (the-as string #f))) -;; definition (perm) for symbol *camera-old-stat-string-total*, type string (define-perm *camera-old-stat-string-total* string (new 'global 'string 128 (the-as string #f))) -;; definition of type cam-dbg-scratch (deftype cam-dbg-scratch (structure) ((linevec4w vector4w 2 :inline :offset-assert 0) (color vector4w :inline :offset-assert 32) @@ -72,35 +64,8 @@ :flag-assert #x9000001d0 ) -;; definition for method 3 of type cam-dbg-scratch -(defmethod inspect cam-dbg-scratch ((obj cam-dbg-scratch)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (format #t "[~8x] ~A~%" obj 'cam-dbg-scratch) - (format #t "~1Tlinevec4w: ~`vector`P~%" (-> obj linevec4w)) - (format #t "~1Tcolor: ~`vector`P~%" (-> obj color)) - (format #t "~1Tplotvec: ~`vector`P~%" (-> obj plotvec)) - (format #t "~1Tlinevec: ~`vector`P~%" (-> obj linevec)) - (format #t "~1Trel-vec: ~`vector`P~%" (-> obj rel-vec)) - (format #t "~1Tsphere-v-start: ~`vector`P~%" (-> obj sphere-v-start)) - (format #t "~1Tsphere-v-end: ~`vector`P~%" (-> obj sphere-v-end)) - (format #t "~1Tsphere-v-down: ~`vector`P~%" (-> obj sphere-v-down)) - (format #t "~1Tsphere-vec: ~`vector`P~%" (-> obj sphere-vec)) - (format #t "~1Tcrossvec: ~`vector`P~%" (-> obj crossvec)) - (format #t "~1Tbboxvec: ~`vector`P~%" (-> obj bboxvec)) - (format #t "~1Tfov-vv: ~`vector`P~%" (-> obj fov-vv)) - (format #t "~1Tfov-src: ~`vector`P~%" (-> obj fov-src)) - (format #t "~1Tfov-dest: ~`vector`P~%" (-> obj fov-dest)) - (format #t "~1Tfov-vert: ~`vector`P~%" (-> obj fov-vert)) - (format #t "~1Tfov-horz: ~`vector`P~%" (-> obj fov-horz)) - (label cfg-4) - obj - ) -;; definition for function cam-slave-options->string -;; INFO: Return type mismatch object vs string. +;; WARN: Return type mismatch object vs string. (defun cam-slave-options->string ((arg0 cam-slave-options) (arg1 object)) (if (= (logand arg0 (cam-slave-options SAME_SIDE)) (cam-slave-options SAME_SIDE)) (format arg1 "SAME_SIDE ") @@ -179,8 +144,7 @@ (the-as string arg1) ) -;; definition for function cam-index-options->string -;; INFO: Return type mismatch object vs string. +;; WARN: Return type mismatch object vs string. (defun cam-index-options->string ((arg0 cam-index-options) (arg1 object)) (if (= (logand arg0 (cam-index-options SPHERICAL)) (cam-index-options SPHERICAL)) (format arg1 "RADIAL ") @@ -191,7 +155,6 @@ (the-as string arg1) ) -;; definition for function slave-los-state->string (defun slave-los-state->string ((arg0 slave-los-state)) (case arg0 (((slave-los-state between)) @@ -212,8 +175,6 @@ ) ) -;; definition for function cam-line-dma -;; INFO: Used lq/sq (defun cam-line-dma () (let* ((v1-5 (-> *display* frames (-> *display* on-screen) debug-buf)) (a2-0 (-> v1-5 base)) @@ -292,7 +253,6 @@ ) ) -;; definition for function camera-line2d (defun camera-line2d ((arg0 vector4w) (arg1 vector4w)) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 x) (* (+ (-> arg0 x) 1792) 16)) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 y) @@ -309,9 +269,7 @@ (cam-line-dma) ) -;; definition for function camera-plot-float-func -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun camera-plot-float-func ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 (function float float)) (arg5 vector4w)) (let ((f30-0 (- arg1 arg0)) (f24-0 (- arg3 arg2)) @@ -412,9 +370,7 @@ (none) ) -;; definition for function camera-line-setup -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun camera-line-setup ((arg0 vector4w)) (let ((v1-0 (-> arg0 quad))) (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-0) @@ -424,9 +380,7 @@ (none) ) -;; definition for function camera-line-draw -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. ;; WARN: Function camera-line-draw has a return type of none, but the expression builder found a return statement. (defun camera-line-draw ((arg0 vector) (arg1 vector)) (set! (-> (the-as (pointer uint128) (+ 80 (the-as int (the-as cam-dbg-scratch #x70000000))))) (-> arg0 quad)) @@ -454,8 +408,7 @@ (none) ) -;; definition for function camera-line -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun camera-line ((arg0 vector) (arg1 vector) (arg2 vector4w)) (camera-line-setup arg2) (camera-line-draw arg0 arg1) @@ -463,14 +416,12 @@ (none) ) -;; definition for function camera-line-rel (defun camera-line-rel ((arg0 vector) (arg1 vector) (arg2 vector4w)) (vector+! (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg0 arg1) (camera-line arg0 (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg2) (none) ) -;; definition for function camera-line-rel-len (defun camera-line-rel-len ((arg0 vector) (arg1 vector) (arg2 float) (arg3 vector4w)) (vector-normalize-copy! (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg1 arg2) (vector+! @@ -482,8 +433,7 @@ (none) ) -;; definition for function camera-sphere -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun camera-sphere ((arg0 vector) (arg1 float) (arg2 vector4w)) (camera-line-setup arg2) (dotimes (s4-0 10) @@ -533,7 +483,6 @@ (none) ) -;; definition for function camera-cross (defun camera-cross ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector4w) (arg4 meters)) (vector-normalize-copy! (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg0 arg4) (vector+! @@ -596,9 +545,7 @@ (none) ) -;; definition for function camera-bounding-box-draw -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun camera-bounding-box-draw ((arg0 bounding-box) (arg1 basic) (arg2 rgba)) (camera-line-setup (new 'static 'vector4w :x #x7f :y #x7f :z #x7f :w #x80)) (set! (-> (the-as (pointer uint128) (+ 240 (the-as int (the-as cam-dbg-scratch #x70000000))))) @@ -659,7 +606,6 @@ (none) ) -;; definition of type cam-debug-tri (deftype cam-debug-tri (structure) ((vertex vector 3 :inline :offset-assert 0) (intersect vector :inline :offset-assert 48) @@ -670,34 +616,16 @@ :flag-assert #x900000044 ) -;; definition for method 3 of type cam-debug-tri -(defmethod inspect cam-debug-tri ((obj cam-debug-tri)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (format #t "[~8x] ~A~%" obj 'cam-debug-tri) - (format #t "~1Tvertex[3] @ #x~X~%" (-> obj vertex)) - (format #t "~1Tintersect: #~%" (-> obj intersect)) - (format #t "~1Tcolor: #~%" (-> obj color)) - (label cfg-4) - obj - ) -;; definition for symbol *cam-debug-los-tri-current*, type int (define *cam-debug-los-tri-current* 0) -;; definition for symbol *cam-debug-los-tri*, type (inline-array cam-debug-tri) (define *cam-debug-los-tri* (the-as (inline-array cam-debug-tri) (malloc 'debug #x8fc0))) -;; definition for symbol *cam-debug-coll-tri-current*, type int (define *cam-debug-coll-tri-current* 0) -;; definition for symbol *cam-debug-coll-tri*, type (inline-array cam-debug-tri) (define *cam-debug-coll-tri* (the-as (inline-array cam-debug-tri) (malloc 'debug #x8fc0))) -;; definition for function cam-debug-reset-coll-tri -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun cam-debug-reset-coll-tri () (set! *cam-debug-los-tri-current* 0) (set! *cam-debug-coll-tri-current* 0) @@ -705,9 +633,7 @@ (none) ) -;; definition for function cam-debug-add-los-tri -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun cam-debug-add-los-tri ((arg0 (inline-array collide-cache-tri)) (arg1 vector) (arg2 vector)) (cond ((>= *cam-debug-los-tri-current* 460) @@ -730,9 +656,7 @@ (none) ) -;; definition for function cam-debug-add-coll-tri -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun cam-debug-add-coll-tri ((arg0 cam-debug-tri) (arg1 vector) (arg2 cam-debug-tri)) (cond ((>= *cam-debug-coll-tri-current* 460) @@ -755,8 +679,6 @@ (none) ) -;; definition for function cam-debug-draw-tris -;; INFO: Used lq/sq (defun cam-debug-draw-tris () (camera-line-setup (new 'stack 'vector4w)) (when *display-cam-los-marks* @@ -814,7 +736,6 @@ ) ) -;; definition for function camera-fov-draw (defun camera-fov-draw ((arg0 int) (arg1 int) (arg2 vector) (arg3 float) (arg4 float) (arg5 vector4w)) (rlet ((acc :class vf) (vf0 :class vf) @@ -903,9 +824,7 @@ ) ) -;; definition for function camera-fov-frame -;; INFO: Used lq/sq -;; INFO: Return type mismatch none vs symbol. +;; WARN: Return type mismatch none vs symbol. (defun camera-fov-frame ((arg0 matrix) (arg1 vector) (arg2 float) (arg3 float) (arg4 float) (arg5 vector4w)) (vector-float*! (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) @@ -1011,8 +930,7 @@ ) ) -;; definition for method 11 of type tracking-spline -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defmethod debug-point-info tracking-spline ((obj tracking-spline) (arg0 int)) (if (= arg0 (-> obj used-point)) (format 0 "u") @@ -1041,8 +959,7 @@ (none) ) -;; definition for method 12 of type tracking-spline -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defmethod debug-all-points tracking-spline ((obj tracking-spline)) (let ((s5-0 (-> obj used-point))) (while (!= s5-0 -134250495) @@ -1055,8 +972,7 @@ (none) ) -;; definition for method 23 of type tracking-spline -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defmethod debug-draw-spline tracking-spline ((obj tracking-spline)) (let ((s5-0 (-> obj used-point))) (let ((s4-0 (-> obj point (-> obj used-point) next))) @@ -1114,7 +1030,6 @@ (none) ) -;; definition for function debug-euler (defun debug-euler ((arg0 cam-dbg-scratch)) (let ((s4-0 (new 'stack-no-clear 'euler-angles)) (gp-0 (new 'stack-no-clear 'matrix)) @@ -1202,7 +1117,6 @@ ) ) -;; definition for function bike-cam-limit (defun bike-cam-limit ((arg0 float)) (let* ((f0-1 (* 10012.444 arg0)) (f30-0 (fmax 0.0 f0-1)) @@ -1214,9 +1128,7 @@ ) ) -;; definition for function camera-slave-debug -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun camera-slave-debug ((arg0 camera-slave)) (rlet ((acc :class vf) (vf0 :class vf) @@ -1563,9 +1475,7 @@ ) ) -;; definition for function master-draw-coordinates -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun master-draw-coordinates ((arg0 vector)) (let ((s5-0 (new-stack-vector0)) (gp-0 (new-stack-vector0)) @@ -1631,7 +1541,6 @@ (none) ) -;; definition of type cam-collision-record (deftype cam-collision-record (structure) ((pos vector :inline :offset-assert 0) (vel vector :inline :offset-assert 16) @@ -1654,33 +1563,7 @@ :flag-assert #x9000000a8 ) -;; definition for method 3 of type cam-collision-record -(defmethod inspect cam-collision-record ((obj cam-collision-record)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (format #t "[~8x] ~A~%" obj 'cam-collision-record) - (format #t "~1Tpos: #~%" (-> obj pos)) - (format #t "~1Tvel: #~%" (-> obj vel)) - (format #t "~1Tdesired-pos: #~%" (-> obj desired-pos)) - (format #t "~1Tcam-tpos-cur: #~%" (-> obj cam-tpos-cur)) - (format #t "~1Tcam-tpos-old: #~%" (-> obj cam-tpos-old)) - (format #t "~1Tview-flat: #~%" (-> obj view-flat)) - (format #t "~1Tstring-min-val: #~%" (-> obj string-min-val)) - (format #t "~1Tstring-max-val: #~%" (-> obj string-max-val)) - (format #t "~1Tview-off: #~%" (-> obj view-off)) - (format #t "~1Tmin-z-override: ~f~%" (-> obj min-z-override)) - (format #t "~1Tstring-push-z: ~f~%" (-> obj string-push-z)) - (format #t "~1Tview-off-param: ~f~%" (-> obj view-off-param)) - (format #t "~1Tframe: ~D~%" (-> obj frame)) - (format #t "~1Titeration: ~D~%" (-> obj iteration)) - (format #t "~1Tmove-type: ~A~%" (-> obj move-type)) - (label cfg-4) - obj - ) -;; definition of type cam-collision-record-array (deftype cam-collision-record-array (inline-array-class) ((data cam-collision-record :dynamic :offset-assert 16) ) @@ -1689,38 +1572,18 @@ :flag-assert #x900000010 ) -;; definition for method 3 of type cam-collision-record-array -(defmethod inspect cam-collision-record-array ((obj cam-collision-record-array)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (format #t "[~8x] ~A~%" obj (-> obj type)) - (format #t "~1Tlength: ~D~%" (-> obj length)) - (format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length)) - (format #t "~1Tdata[0] @ #x~X~%" (-> obj data)) - (label cfg-4) - obj - ) -;; failed to figure out what this is: (set! (-> cam-collision-record-array heap-base) (the-as uint 176)) -;; definition for symbol *cam-collision-record-first*, type int (define *cam-collision-record-first* 0) -;; definition for symbol *cam-collision-record-last*, type int (define *cam-collision-record-last* 0) -;; definition for symbol *cam-collision-record-show*, type int (define *cam-collision-record-show* 0) -;; definition for symbol *cam-collision-record*, type cam-collision-record-array (define *cam-collision-record* (new 'debug 'cam-collision-record-array 600)) -;; definition for function cam-collision-record-save -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun cam-collision-record-save ((arg0 vector) (arg1 vector) (arg2 int) (arg3 symbol) (arg4 camera-slave)) (with-pp (when *record-cam-collide-history* @@ -1759,8 +1622,7 @@ ) ) -;; definition for function cam-collision-record-step -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun cam-collision-record-step ((arg0 int)) (set! *cam-collision-record-show* (+ *cam-collision-record-show* arg0)) (while (>= *cam-collision-record-show* 600) @@ -1773,15 +1635,8 @@ (none) ) -;; definition for function cam-collision-record-draw -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. -;; ERROR: Function may read a register that is not set: t0 -;; ERROR: Function may read a register that is not set: t1 -;; ERROR: Function may read a register that is not set: t2 -;; ERROR: Function may read a register that is not set: t3 +;; WARN: Return type mismatch int vs none. (defun cam-collision-record-draw () - (local-vars (t0-0 none) (t1-0 none) (t2-0 none) (t3-0 none)) (cond ((cpad-pressed? 0 down) (cam-collision-record-step 1) @@ -1821,128 +1676,115 @@ (set! (-> gp-0 y) 127) (set! (-> gp-0 z) 127) (set! (-> gp-0 w) 128) - (let ((t9-7 camera-line-rel-len) - (a0-12 (-> (the-as cam-collision-record s5-0) pos)) - (a1-3 (-> (the-as cam-collision-record s5-0) vel)) - (a2-1 (fmax 81.92 (vector-length (-> (the-as cam-collision-record s5-0) vel)))) - (a3-0 s4-0) + (camera-line-rel-len + (-> (the-as cam-collision-record s5-0) pos) + (-> (the-as cam-collision-record s5-0) vel) + (fmax 81.92 (vector-length (-> (the-as cam-collision-record s5-0) vel))) + s4-0 + ) + (let ((s3-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s3-0 start-pos quad) (-> (the-as cam-collision-record s5-0) pos quad)) + (set! (-> s3-0 move-dist quad) (-> (the-as cam-collision-record s5-0) vel quad)) + (let ((v1-47 s3-0)) + (set! (-> v1-47 radius) (-> *CAMERA-bank* collide-move-rad)) + (set! (-> v1-47 collide-with) (collide-spec backgnd)) + (set! (-> v1-47 ignore-process0) #f) + (set! (-> v1-47 ignore-process1) #f) + (set! (-> v1-47 ignore-pat) (new 'static 'pat-surface :nocamera #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-47 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* s3-0)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (format + *stdcon* + "frame ~D iteration ~D travel ~f~%" + (-> (the-as cam-collision-record s5-0) frame) + (-> (the-as cam-collision-record s5-0) iteration) + f30-0 ) - (t9-7 a0-12 a1-3 a2-1 a3-0) - (let ((s3-0 (new 'stack-no-clear 'collide-query))) - (set! (-> s3-0 start-pos quad) (-> (the-as cam-collision-record s5-0) pos quad)) - (set! (-> s3-0 move-dist quad) (-> (the-as cam-collision-record s5-0) vel quad)) - (let ((v1-47 s3-0)) - (set! (-> v1-47 radius) (-> *CAMERA-bank* collide-move-rad)) - (set! (-> v1-47 collide-with) (collide-spec backgnd)) - (set! (-> v1-47 ignore-process0) #f) - (set! (-> v1-47 ignore-process1) #f) - (set! (-> v1-47 ignore-pat) (new 'static 'pat-surface :nocamera #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-47 action-mask) (the-as uint 1)) + (format + *stdcon* + "mzo ~M psz ~M vop ~f~%" + (-> (the-as cam-collision-record s5-0) min-z-override) + (-> (the-as cam-collision-record s5-0) string-push-z) + (-> (the-as cam-collision-record s5-0) view-off-param) ) - (let ((f30-0 - (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector s3-0) - (the-as vector a2-1) - (the-as float a3-0) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - ) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (format - *stdcon* - "frame ~D iteration ~D travel ~f~%" - (-> (the-as cam-collision-record s5-0) frame) - (-> (the-as cam-collision-record s5-0) iteration) - f30-0 - ) - (format - *stdcon* - "mzo ~M psz ~M vop ~f~%" - (-> (the-as cam-collision-record s5-0) min-z-override) - (-> (the-as cam-collision-record s5-0) string-push-z) - (-> (the-as cam-collision-record s5-0) view-off-param) - ) - (format - *stdcon* - "pos ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) pos x) - (-> (the-as cam-collision-record s5-0) pos y) - (-> (the-as cam-collision-record s5-0) pos z) - ) - (format - *stdcon* - "vel ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) vel x) - (-> (the-as cam-collision-record s5-0) vel y) - (-> (the-as cam-collision-record s5-0) vel z) - ) - (format - *stdcon* - "des ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) desired-pos x) - (-> (the-as cam-collision-record s5-0) desired-pos y) - (-> (the-as cam-collision-record s5-0) desired-pos z) - ) - (format - *stdcon* - "flt ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) view-flat x) - (-> (the-as cam-collision-record s5-0) view-flat y) - (-> (the-as cam-collision-record s5-0) view-flat z) - ) - (format - *stdcon* - "cur ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) cam-tpos-cur x) - (-> (the-as cam-collision-record s5-0) cam-tpos-cur y) - (-> (the-as cam-collision-record s5-0) cam-tpos-cur z) - ) - (format - *stdcon* - "old ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) cam-tpos-old x) - (-> (the-as cam-collision-record s5-0) cam-tpos-old y) - (-> (the-as cam-collision-record s5-0) cam-tpos-old z) - ) - (format - *stdcon* - "smn ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) string-min-val x) - (-> (the-as cam-collision-record s5-0) string-min-val y) - (-> (the-as cam-collision-record s5-0) string-min-val z) - ) - (format - *stdcon* - "smx ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) string-max-val x) - (-> (the-as cam-collision-record s5-0) string-max-val y) - (-> (the-as cam-collision-record s5-0) string-max-val z) - ) - (format - *stdcon* - "vof ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) view-off x) - (-> (the-as cam-collision-record s5-0) view-off y) - (-> (the-as cam-collision-record s5-0) view-off z) - ) - (when (>= f30-0 0.0) - (camera-line (the-as vector (-> s3-0 best-other-tri)) (-> s3-0 best-other-tri vertex 1) s4-0) - (camera-line (-> s3-0 best-other-tri vertex 1) (-> s3-0 best-other-tri vertex 2) s4-0) - (camera-line (-> s3-0 best-other-tri vertex 2) (the-as vector (-> s3-0 best-other-tri)) s4-0) - (vector-! s2-0 (the-as vector (+ (the-as int s5-0) 0)) (-> s3-0 best-other-tri intersect)) - (vector-normalize! s2-0 1.0) - (camera-line-rel-len (-> s3-0 best-other-tri intersect) s2-0 (-> *CAMERA-bank* collide-move-rad) gp-0) - (camera-line-rel-len - (-> s3-0 best-other-tri intersect) - (-> s3-0 best-other-tri normal) - (-> *CAMERA-bank* collide-move-rad) - gp-0 - ) + (format + *stdcon* + "pos ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) pos x) + (-> (the-as cam-collision-record s5-0) pos y) + (-> (the-as cam-collision-record s5-0) pos z) + ) + (format + *stdcon* + "vel ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) vel x) + (-> (the-as cam-collision-record s5-0) vel y) + (-> (the-as cam-collision-record s5-0) vel z) + ) + (format + *stdcon* + "des ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) desired-pos x) + (-> (the-as cam-collision-record s5-0) desired-pos y) + (-> (the-as cam-collision-record s5-0) desired-pos z) + ) + (format + *stdcon* + "flt ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) view-flat x) + (-> (the-as cam-collision-record s5-0) view-flat y) + (-> (the-as cam-collision-record s5-0) view-flat z) + ) + (format + *stdcon* + "cur ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) cam-tpos-cur x) + (-> (the-as cam-collision-record s5-0) cam-tpos-cur y) + (-> (the-as cam-collision-record s5-0) cam-tpos-cur z) + ) + (format + *stdcon* + "old ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) cam-tpos-old x) + (-> (the-as cam-collision-record s5-0) cam-tpos-old y) + (-> (the-as cam-collision-record s5-0) cam-tpos-old z) + ) + (format + *stdcon* + "smn ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) string-min-val x) + (-> (the-as cam-collision-record s5-0) string-min-val y) + (-> (the-as cam-collision-record s5-0) string-min-val z) + ) + (format + *stdcon* + "smx ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) string-max-val x) + (-> (the-as cam-collision-record s5-0) string-max-val y) + (-> (the-as cam-collision-record s5-0) string-max-val z) + ) + (format + *stdcon* + "vof ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) view-off x) + (-> (the-as cam-collision-record s5-0) view-off y) + (-> (the-as cam-collision-record s5-0) view-off z) + ) + (when (>= f30-0 0.0) + (camera-line (the-as vector (-> s3-0 best-other-tri)) (-> s3-0 best-other-tri vertex 1) s4-0) + (camera-line (-> s3-0 best-other-tri vertex 1) (-> s3-0 best-other-tri vertex 2) s4-0) + (camera-line (-> s3-0 best-other-tri vertex 2) (the-as vector (-> s3-0 best-other-tri)) s4-0) + (vector-! s2-0 (the-as vector (+ (the-as int s5-0) 0)) (-> s3-0 best-other-tri intersect)) + (vector-normalize! s2-0 1.0) + (camera-line-rel-len (-> s3-0 best-other-tri intersect) s2-0 (-> *CAMERA-bank* collide-move-rad) gp-0) + (camera-line-rel-len + (-> s3-0 best-other-tri intersect) + (-> s3-0 best-other-tri normal) + (-> *CAMERA-bank* collide-move-rad) + gp-0 ) ) ) @@ -1952,8 +1794,7 @@ (none) ) -;; definition for function camera-master-debug -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun camera-master-debug ((arg0 camera-master)) (rlet ((acc :class vf) (vf0 :class vf) @@ -2068,8 +1909,6 @@ ) ) -;; definition for function debug-set-camera-pos-rot! -;; INFO: Used lq/sq (defun debug-set-camera-pos-rot! ((arg0 vector) (arg1 matrix)) (when (and *camera* *camera-combiner*) (set! (-> *camera-combiner* trans quad) (-> arg0 quad)) @@ -2091,9 +1930,7 @@ arg0 ) -;; definition (debug) for function cam-restore -;; INFO: Used lq/sq -;; INFO: Return type mismatch int vs none. +;; WARN: Return type mismatch int vs none. (defun-debug cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) diff --git a/goal_src/jak2/engine/camera/cam-states.gc b/goal_src/jak2/engine/camera/cam-states.gc index 6c9aa8a8e7..388763e2e0 100644 --- a/goal_src/jak2/engine/camera/cam-states.gc +++ b/goal_src/jak2/engine/camera/cam-states.gc @@ -889,6 +889,7 @@ ;; ERROR: function has no type analysis. Cannot decompile. ;; ERROR: failed type prop at 56: Called a function, but we do not know its type +;; WARN: Return type mismatch none vs float. (defstate cam-lookat (camera-slave) @@ -930,13 +931,8 @@ (define *CAM_STRING-bank* (new 'static 'cam-string-bank :los-coll-rad (meters 1) :los-coll-rad2 (meters 0.5))) -;; ERROR: Function may read a register that is not set: t0 -;; ERROR: Function may read a register that is not set: t1 -;; ERROR: Function may read a register that is not set: t2 -;; ERROR: Function may read a register that is not set: t3 ;; WARN: new jak 2 until loop case, check carefully (defun cam-string-find-position-rel! ((arg0 vector)) - (local-vars (t0-0 none) (t1-0 none) (t2-0 none) (t3-0 none)) (let ((s5-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'collide-query)) @@ -949,7 +945,7 @@ (set! (-> s1-0 ignore-process0) #f) (set! (-> s1-0 ignore-process1) #f) (set! (-> s1-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) - (set! (-> s1-0 action-mask) (the-as uint 1)) + (set! (-> s1-0 action-mask) (collide-action solid)) ) (vector-flatten! s5-0 (-> *camera-combiner* inv-camera-rot vector 2) (-> *camera* local-down)) (if (= (vector-normalize-ret-len! s5-0 (- (+ 1024.0 (-> *CAMERA-bank* default-string-min-z)))) 0.0) @@ -958,30 +954,12 @@ (vector--float*! s5-0 s5-0 (-> *camera* local-down) (-> *CAMERA-bank* default-string-min-y)) (set! (-> arg0 quad) (-> s5-0 quad)) (until #f - (let ((t9-4 vector--float*!) - (a0-7 s4-0) - (a1-4 arg0) - (a2-2 (-> *camera* local-down)) - (a3-1 (-> *camera* settings target-height)) - ) - (t9-4 a0-7 a1-4 a2-2 a3-1) - (set! (-> s3-0 start-pos quad) (-> *camera* tpos-curr-adj quad)) - (set! (-> s3-0 move-dist quad) (-> arg0 quad)) - (if (< (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector s3-0) - a2-2 - (the-as float a3-1) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - 0.0 - ) - (return #t) - ) - ) + (vector--float*! s4-0 arg0 (-> *camera* local-down) (-> *camera* settings target-height)) + (set! (-> s3-0 start-pos quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> s3-0 move-dist quad) (-> arg0 quad)) + (if (< (fill-and-probe-using-line-sphere *collide-cache* s3-0) 0.0) + (return #t) + ) (set! f30-0 (cond ((>= -32768.0 f30-0) (format #t "cam-string didn't find a spot~%") @@ -1004,6 +982,7 @@ #f ) +;; WARN: Return type mismatch uint vs cam-slave-options. (defbehavior cam-string-set-position-rel! camera-slave ((arg0 vector)) (vector-flatten! (-> self view-flat) arg0 (-> *camera* local-down)) (set! (-> self min-z-override) (vector-length (-> self view-flat))) @@ -1021,6 +1000,7 @@ 409.6 ) +;; WARN: Return type mismatch int vs none. (defun-debug cam-draw-collide-cache ((arg0 collide-cache)) (let ((gp-0 (the-as object (-> arg0 tris)))) (countdown (s5-0 (-> arg0 num-tris)) @@ -1069,6 +1049,7 @@ ) +;; WARN: Return type mismatch int vs none. (defun dist-info-init ((arg0 collide-los-dist-info)) (set! (-> arg0 min-par) 1.0) (set! (-> arg0 max-par) 0.0) @@ -1081,6 +1062,7 @@ (>= (-> arg0 max-par) (-> arg0 min-par)) ) +;; WARN: Return type mismatch int vs none. (defun dist-info-append ((arg0 collide-los-dist-info) (arg1 vector)) (cond ((dist-info-valid? arg0) @@ -1297,9 +1279,9 @@ (set! (-> v1-4 ignore-process0) #f) (set! (-> v1-4 ignore-process1) #f) (set! (-> v1-4 ignore-pat) arg2) - (set! (-> v1-4 action-mask) (the-as uint 1)) + (set! (-> v1-4 action-mask) (collide-action solid)) ) - ((method-of-object s4-0 collide-cache-method-13)) + (fill-using-line-sphere s4-0 s5-0) (let* ((f0-2 (vector-length (-> s5-0 move-dist))) (f28-0 (cond @@ -1483,6 +1465,7 @@ ) ) +;; WARN: Return type mismatch int vs symbol. ;; ERROR: Unsupported inline assembly instruction kind - [mula.s f2, f5] ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f3, f6] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f2, f4, f7] @@ -1567,24 +1550,21 @@ ) ;; ERROR: failed type prop at 785: Could not figure out load: (set! v1 (l.wu (+ v1 124))) +;; WARN: Return type mismatch symbol vs vector. ;; ERROR: Unsupported inline assembly instruction kind - [sllv a0, v1, r0] ;; ERROR: Unsupported inline assembly instruction kind - [sllv a0, v1, r0] -;; ERROR: Function may read a register that is not set: t0 -;; ERROR: Function may read a register that is not set: t1 -;; ERROR: Function may read a register that is not set: t2 -;; ERROR: Function may read a register that is not set: t3 +;; WARN: Return type mismatch int vs none. (defbehavior cam-string-find-hidden camera-slave () - (local-vars (t0-0 none) (t1-0 none) (t2-0 none) (t3-0 none)) - (let* ((s5-0 (new 'stack-no-clear 'collide-query)) - (gp-0 (new 'stack-no-clear 'vector)) - (t9-0 vector--float*!) - (a0-0 (-> s5-0 move-dist)) - (a1-0 (-> *camera* tpos-curr-adj)) - (a2-0 (-> *camera* local-down)) - (a3-0 (-> *camera* settings target-height)) - ) - (t9-0 a0-0 a1-0 a2-0 a3-0) + (let ((s5-0 (new 'stack-no-clear 'collide-query)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (vector--float*! + (-> s5-0 move-dist) + (-> *camera* tpos-curr-adj) + (-> *camera* local-down) + (-> *camera* settings target-height) + ) (vector-! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> self string-trans)) (set! (-> s5-0 start-pos quad) (-> self string-trans quad)) (let ((s4-0 s5-0)) @@ -1593,21 +1573,10 @@ (set! (-> s4-0 ignore-process0) #f) (set! (-> s4-0 ignore-process1) #f) (set! (-> s4-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) - (set! (-> s4-0 action-mask) (the-as uint 1)) + (set! (-> s4-0 action-mask) (collide-action solid)) ) (cond - ((< (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector s5-0) - a2-0 - (the-as float a3-0) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - 0.0 - ) + ((< (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) (set! (-> self time-dist-too-far) (the-as uint 0)) 0 ) @@ -1629,13 +1598,7 @@ (none) ) -;; ERROR: Function may read a register that is not set: a3 -;; ERROR: Function may read a register that is not set: t0 -;; ERROR: Function may read a register that is not set: t1 -;; ERROR: Function may read a register that is not set: t2 -;; ERROR: Function may read a register that is not set: t3 (defbehavior cam-string-move camera-slave () - (local-vars (a3-0 object) (t0-0 object) (t1-0 float) (t2-0 none) (t3-0 none)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1671,180 +1634,134 @@ (.svf (&-> v1-7 quad) vf4) ) (vector-normalize! s5-0 1.0) - (let ((t9-2 vector-normalize-copy!) - (a0-7 s4-0) - (a1-7 (-> self view-flat)) - (a2-2 (the-as object 1.0)) - ) - (t9-2 a0-7 a1-7 (the-as float a2-2)) - (vector-cross! gp-0 s4-0 s5-0) - (cond - ((and (< (vector-length (-> self velocity)) (-> *CAMERA-bank* min-detectable-velocity)) - (< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity)) - ) - (set! (-> self string-vel-dir) (the-as uint 0)) - 0 - ) - ((< (cos 5461.3335) (vector-dot (-> *camera* local-down) s5-0)) - (set! (-> self string-vel-dir) (the-as uint 4)) - ) - ((< (vector-dot (-> *camera* local-down) s5-0) (- (cos 5461.3335))) - (set! (-> self string-vel-dir) (the-as uint 3)) - ) - ((< (cos 5461.3335) (vector-dot s4-0 s5-0)) - (set! (-> self string-vel-dir) (the-as uint 6)) - ) - ((< (vector-dot s4-0 s5-0) (- (cos 5461.3335))) - (set! (-> self string-vel-dir) (the-as uint 5)) - ) - ((< (vector-dot (-> *camera* local-down) gp-0) 0.0) - (set! (-> self string-vel-dir) (the-as uint 1)) - ) - (else - (set! (-> self string-vel-dir) (the-as uint 2)) - ) + (vector-normalize-copy! s4-0 (-> self view-flat) 1.0) + (vector-cross! gp-0 s4-0 s5-0) + (cond + ((and (< (vector-length (-> self velocity)) (-> *CAMERA-bank* min-detectable-velocity)) + (< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity)) + ) + (set! (-> self string-vel-dir) (the-as uint 0)) + 0 + ) + ((< (cos 5461.3335) (vector-dot (-> *camera* local-down) s5-0)) + (set! (-> self string-vel-dir) (the-as uint 4)) + ) + ((< (vector-dot (-> *camera* local-down) s5-0) (- (cos 5461.3335))) + (set! (-> self string-vel-dir) (the-as uint 3)) + ) + ((< (cos 5461.3335) (vector-dot s4-0 s5-0)) + (set! (-> self string-vel-dir) (the-as uint 6)) + ) + ((< (vector-dot s4-0 s5-0) (- (cos 5461.3335))) + (set! (-> self string-vel-dir) (the-as uint 5)) + ) + ((< (vector-dot (-> *camera* local-down) gp-0) 0.0) + (set! (-> self string-vel-dir) (the-as uint 1)) + ) + (else + (set! (-> self string-vel-dir) (the-as uint 2)) ) - (let ((s5-1 (new 'stack-no-clear 'collide-query))) - 0.0 - (let ((f30-2 1.0) - (s4-1 (-> s5-1 move-dist)) - (gp-1 0) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'collide-query))) + 0.0 + (let ((f30-2 1.0) + (s4-1 (-> s5-1 move-dist)) + (gp-1 0) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (when *debug-segment* + (if (>= (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) + (cam-collision-record-save (-> self string-trans) (-> self velocity) -1 'no-hit self) ) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (when *debug-segment* - (when (>= (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) - (let ((t9-7 cam-collision-record-save) - (a0-16 (-> self string-trans)) - (a1-10 (-> self velocity)) - ) - (set! a2-2 -1) - (set! a3-0 'no-hit) - (set! t0-0 self) - (t9-7 a0-16 a1-10 (the-as int a2-2) (the-as symbol a3-0) (the-as camera-slave t0-0)) - ) - ) + ) + (while (and (< 0.01 f30-2) + (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (< gp-1 4)) + ) + (vector-float*! s4-1 (-> self velocity) f30-2) + (if *debug-segment* + (cam-collision-record-save (-> self string-trans) s4-1 gp-1 'normal self) ) - (while (and (< 0.01 f30-2) - (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (< gp-1 4)) - ) - (vector-float*! s4-1 (-> self velocity) f30-2) - (when *debug-segment* - (let ((t9-8 cam-collision-record-save) - (a0-18 (-> self string-trans)) - (a1-11 s4-1) - ) - (set! a2-2 gp-1) - (set! a3-0 'normal) - (set! t0-0 self) - (t9-8 a0-18 a1-11 (the-as int a2-2) (the-as symbol a3-0) (the-as camera-slave t0-0)) - ) - ) - (let ((f28-0 - (cond - ((logtest? (-> self options) 32) - (set! (-> s5-1 start-pos quad) (-> self string-trans quad)) - (let ((s2-0 s5-1)) - (set! (-> s2-0 radius) (-> *CAMERA-bank* collide-move-rad)) - (set! (-> s2-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) - (set! (-> s2-0 ignore-process0) #f) - (set! (-> s2-0 ignore-process1) #f) - (set! (-> s2-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) - (set! (-> s2-0 action-mask) (the-as uint 1)) - ) - (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector s5-1) - (the-as vector a2-2) - (the-as float a3-0) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - ) - (else - -100000000.0 - ) - ) + (let ((f28-0 + (cond + ((logtest? (-> self options) 32) + (set! (-> s5-1 start-pos quad) (-> self string-trans quad)) + (let ((s2-0 s5-1)) + (set! (-> s2-0 radius) (-> *CAMERA-bank* collide-move-rad)) + (set! (-> s2-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (set! (-> s2-0 ignore-process0) #f) + (set! (-> s2-0 ignore-process1) #f) + (set! (-> s2-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) + (set! (-> s2-0 action-mask) (collide-action solid)) + ) + (fill-and-probe-using-line-sphere *collide-cache* s5-1) + ) + (else + -100000000.0 ) ) - (when *display-cam-los-debug* - (let ((t9-11 format) - (a0-23 *stdcon*) - (a1-14 "vp ~f vr ~f r ~f ta ~f~%") - ) - (set! a2-2 (vector-length s4-1)) - (set! a3-0 f30-2) - (set! t0-0 (/ (vector-length s4-1) f30-2)) - (set! t1-0 f28-0) - (t9-11 a0-23 a1-14 (the-as float a2-2) (the-as float a3-0) (the-as float t0-0) t1-0) - ) ) - (cond - ((>= f28-0 0.0) - (let* ((f1-10 (fmax 0.01 (/ 40.96 (vector-length s4-1)))) - (f0-22 (fmax 0.0 (- f28-0 f1-10))) - (v1-71 (-> self string-trans)) - ) - (let ((a0-24 (-> self string-trans))) - (.lvf vf2 (&-> s4-1 quad)) - (.lvf vf1 (&-> a0-24 quad)) - ) - (let ((a0-25 f0-22)) - (.mov vf3 a0-25) - ) - (.add.x.vf vf4 vf0 vf0 :mask #b1000) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) - (.svf (&-> v1-71 quad) vf4) - ) - (vector-! s3-1 (-> self string-trans) (-> s5-1 best-other-tri intersect)) - (vector-normalize! s3-1 1.0) - (let ((t9-13 vector-flatten!) - (a0-28 (-> self velocity)) - (a1-19 (-> self velocity)) - ) - (set! a2-2 s3-1) - (t9-13 a0-28 a1-19 (the-as vector a2-2)) - ) - (set! f30-2 (- f30-2 (* f30-2 f28-0))) - (+! gp-1 1) + ) + (if *display-cam-los-debug* + (format *stdcon* "vp ~f vr ~f r ~f ta ~f~%" (vector-length s4-1) f30-2 (/ (vector-length s4-1) f30-2) f28-0) + ) + (cond + ((>= f28-0 0.0) + (let* ((f1-10 (fmax 0.01 (/ 40.96 (vector-length s4-1)))) + (f0-22 (fmax 0.0 (- f28-0 f1-10))) + (v1-71 (-> self string-trans)) + ) + (let ((a0-24 (-> self string-trans))) + (.lvf vf2 (&-> s4-1 quad)) + (.lvf vf1 (&-> a0-24 quad)) ) - (else - (vector+! (-> self string-trans) (-> self string-trans) s4-1) - (set! f30-2 0.0) - ) - ) + (let ((a0-25 f0-22)) + (.mov vf3 a0-25) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> v1-71 quad) vf4) + ) + (vector-! s3-1 (-> self string-trans) (-> s5-1 best-other-tri intersect)) + (vector-normalize! s3-1 1.0) + (vector-flatten! (-> self velocity) (-> self velocity) s3-1) + (set! f30-2 (- f30-2 (* f30-2 f28-0))) + (+! gp-1 1) + ) + (else + (vector+! (-> self string-trans) (-> self string-trans) s4-1) + (set! f30-2 0.0) ) ) ) - (cond - ((zero? gp-1) - (set! (-> self options) (logand -1025 (-> self options))) - (if *display-cam-los-debug* - (format *stdcon* "not blocked~%") - ) + ) + ) + (cond + ((zero? gp-1) + (set! (-> self options) (logand -1025 (-> self options))) + (if *display-cam-los-debug* + (format *stdcon* "not blocked~%") ) - (else - (logior! (-> self options) 1024) - (if *display-cam-los-debug* - (format *stdcon* "blocked ~D ~f~%" gp-1 f30-2) - ) - (let ((gp-2 (new-stack-vector0)) - (f30-3 (vector-length (-> self view-flat))) - ) - (vector-! gp-2 (-> self string-trans) (-> *camera* tpos-curr-adj)) - (vector-flatten! gp-2 gp-2 (-> *camera* local-down)) - (let ((f28-1 (vector-length gp-2))) - (cond - ((< f28-1 f30-3) - (vector-normalize-copy! (-> self view-flat) gp-2 f28-1) - (set! (-> self min-z-override) f28-1) - ) - (else - (vector-normalize-copy! (-> self view-flat) gp-2 f30-3) - ) - ) + ) + (else + (logior! (-> self options) 1024) + (if *display-cam-los-debug* + (format *stdcon* "blocked ~D ~f~%" gp-1 f30-2) + ) + (let ((gp-2 (new-stack-vector0)) + (f30-3 (vector-length (-> self view-flat))) + ) + (vector-! gp-2 (-> self string-trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! gp-2 gp-2 (-> *camera* local-down)) + (let ((f28-1 (vector-length gp-2))) + (cond + ((< f28-1 f30-3) + (vector-normalize-copy! (-> self view-flat) gp-2 f28-1) + (set! (-> self min-z-override) f28-1) + ) + (else + (vector-normalize-copy! (-> self view-flat) gp-2 f30-3) ) ) ) @@ -1863,6 +1780,7 @@ ) ;; ERROR: failed type prop at 11: Called a function, but we do not know its type +;; WARN: Return type mismatch none vs vector. (defbehavior set-string-params camera-slave () (when (not (or (-> self string-val-locked) (logtest? #x40000 (-> self options)))) @@ -2002,7 +1920,6 @@ ) ) :enter (behavior () - (local-vars (t0-0 none) (t1-0 none) (t2-0 none) (t3-0 none)) (when (not (-> self enter-has-run)) (if (-> self cam-entity) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) @@ -2089,14 +2006,13 @@ (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) (set! (-> self string-trans quad) (-> self desired-pos quad)) (vector-reset! (-> self velocity)) - (let* ((gp-2 (new 'stack-no-clear 'collide-query)) - (t9-13 vector--float*!) - (a0-20 (-> gp-2 start-pos)) - (a1-17 (-> *camera* tpos-curr-adj)) - (a2-9 (-> *camera* local-down)) - (a3-1 (-> *camera* settings target-height)) - ) - (t9-13 a0-20 a1-17 a2-9 a3-1) + (let ((gp-2 (new 'stack-no-clear 'collide-query))) + (vector--float*! + (-> gp-2 start-pos) + (-> *camera* tpos-curr-adj) + (-> *camera* local-down) + (-> *camera* settings target-height) + ) (vector-! (-> gp-2 move-dist) (-> self string-trans) (-> gp-2 start-pos)) (let ((s5-0 gp-2)) (set! (-> s5-0 radius) (-> *CAMERA-bank* collide-move-rad)) @@ -2104,20 +2020,9 @@ (set! (-> s5-0 ignore-process0) #f) (set! (-> s5-0 ignore-process1) #f) (set! (-> s5-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) - (set! (-> s5-0 action-mask) (the-as uint 1)) + (set! (-> s5-0 action-mask) (collide-action solid)) ) - (let ((f0-31 (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector gp-2) - a2-9 - (the-as float a3-1) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - ) - ) + (let ((f0-31 (fill-and-probe-using-line-sphere *collide-cache* gp-2))) (when (and (< 0.0 f0-31) (< f0-31 1.0)) (vector-float*! (-> gp-2 move-dist) (-> gp-2 move-dist) f0-31) (vector-flatten! (-> self view-flat) (-> gp-2 move-dist) (-> *camera* local-down)) diff --git a/goal_src/jak2/engine/collide/collide-cache-h.gc b/goal_src/jak2/engine/collide/collide-cache-h.gc index 9f11493799..3628dd903c 100644 --- a/goal_src/jak2/engine/collide/collide-cache-h.gc +++ b/goal_src/jak2/engine/collide/collide-cache-h.gc @@ -91,13 +91,13 @@ :flag-assert #x1a00008670 (:methods (collide-cache-method-9 () none 9) - (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) + (fill-and-probe-using-line-sphere (_type_ collide-query) float 10) (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) (collide-cache-method-12 (_type_ collide-query) none 12) - (collide-cache-method-13 () none 13) + (fill-using-line-sphere (_type_ collide-query) none 13) (fill-using-spheres (_type_ collide-query) none 14) (collide-cache-method-15 () none 15) - (collide-cache-method-16 (_type_) float 16) + (collide-cache-method-16 (_type_ collide-query) float 16) (probe-using-spheres (_type_ collide-query) symbol 17) (collide-cache-method-18 () none 18) (collide-cache-method-19 () none 19) diff --git a/goal_src/jak2/engine/collide/collide-h.gc b/goal_src/jak2/engine/collide/collide-h.gc index 495895f142..4835be4011 100644 --- a/goal_src/jak2/engine/collide/collide-h.gc +++ b/goal_src/jak2/engine/collide/collide-h.gc @@ -8,47 +8,54 @@ ;; 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-pat pat-surface :offset-assert 96) - (collide-with collide-spec :offset-assert 100) - (overlay-params uint32 3 :offset 112) - (bbox bounding-box :inline :offset-assert 128) - (bbox4w bounding-box4w :inline :offset-assert 160) - (bsphere sphere :inline :offset-assert 192) - (start-pos vector :inline :offset-assert 208) - (move-dist vector :inline :offset-assert 224) - (rlength vector :inline :offset-assert 240) - (exit-planes plane 2 :offset-assert 256) - (radius float :offset 268) - (inv-mat matrix :inline :offset 288) - (spheres (inline-array sphere) :offset 112) - (num-spheres uint32 :offset 116) - (solid-only symbol :offset 120) - (best-dist float :offset 112) - (best-other-prim basic :offset 116) - (best-my-prim basic :offset 120) - (move-vec vector :inline :offset 224) - (best-u float :offset 112) - (action-mask uint32 :offset-assert 352) - (local-box4w bounding-box4w :inline :offset-assert 368) - (search-box bounding-box4w :inline :offset-assert 400) - (search-vector vector4w :inline :offset-assert 432) - (instance-mat matrix :inline :offset-assert 448) - (instance-ptr basic :offset-assert 512) - (x-addr uint32 :offset-assert 516) - (x-step uint32 :offset-assert 520) - (y-addr uint32 :offset-assert 524) - (y-step uint32 :offset-assert 528) - (z-addr uint32 :offset-assert 532) - (z-step uint32 :offset-assert 536) + ((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-pat pat-surface :offset-assert 96) + (collide-with collide-spec :offset-assert 100) + (overlay-params uint32 3 :offset 112) + (bbox bounding-box :inline :offset-assert 128) + (bbox4w bounding-box4w :inline :offset-assert 160) + (bsphere sphere :inline :offset-assert 192) + (start-pos vector :inline :offset-assert 208) + (move-dist vector :inline :offset-assert 224) + (rlength vector :inline :offset-assert 240) + (exit-planes plane 2 :offset-assert 256) + (radius float :offset 268) + (inv-mat matrix :inline :offset 288) + (spheres (inline-array sphere) :offset 112) + (num-spheres uint32 :offset 116) + (solid-only symbol :offset 120) + (best-dist float :offset 112) + (best-other-prim basic :offset 116) + (best-my-prim basic :offset 120) + (move-vec vector :inline :offset 224) + (best-u float :offset 112) + (action-mask collide-action :offset-assert 352) + (local-box4w bounding-box4w :inline :offset-assert 368) + (search-box bounding-box4w :inline :offset-assert 400) + (search-vector vector4w :inline :offset-assert 432) + (instance-mat matrix :inline :offset-assert 448) + (instance-ptr basic :offset-assert 512) + (x-addr uint32 :offset-assert 516) + (x-step uint32 :offset-assert 520) + (y-addr uint32 :offset-assert 524) + (y-step uint32 :offset-assert 528) + (z-addr uint32 :offset-assert 532) + (z-step uint32 :offset-assert 536) ) :method-count-assert 9 :size-assert #x21c :flag-assert #x90000021c ) + (define *collide-test-flag* #f) + +0 + + + + diff --git a/goal_src/jak2/engine/collide/collide-planes.gc b/goal_src/jak2/engine/collide/collide-planes.gc deleted file mode 100644 index fb2c235c3d..0000000000 --- a/goal_src/jak2/engine/collide/collide-planes.gc +++ /dev/null @@ -1,9 +0,0 @@ -;;-*-Lisp-*- -(in-package goal) - -;; name: collide-planes.gc -;; name in dgo: collide-planes -;; dgos: ENGINE, GAME - -;; DECOMP BEGINS - diff --git a/goal_src/jak2/engine/collide/find-nearest-h.gc b/goal_src/jak2/engine/collide/find-nearest-h.gc index d40b21bfdc..1b257bf2fe 100644 --- a/goal_src/jak2/engine/collide/find-nearest-h.gc +++ b/goal_src/jak2/engine/collide/find-nearest-h.gc @@ -5,5 +5,31 @@ ;; name in dgo: find-nearest-h ;; dgos: ENGINE, GAME +;; +++find-nearest:search-info-flag +(defenum search-info-flag + :type uint32 + :bitfield #t + (crate 0) + (enemy 1) + (on-screen 2) + (prefer-dist 3) + (prefer-angle 4) + (prefer-xz 5) + (cull-angle 6) + (cull-xz 7) + (back-point 8) + (combo 9) + (probe 10) + (probe-camera 11) + (check-track 12) + (prefer-center 13) + ) +;; ---find-nearest:search-info-flag + +(declare-type search-info structure) +(define-extern *search-info* search-info) +(define-extern find-nearest-attackable (function vector float uint uint vector vector float basic)) +(define-extern find-nearest-focusable (function (array collide-shape) vector float search-info-flag search-info-flag vector vector float basic)) + ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/collide/find-nearest.gc b/goal_src/jak2/engine/collide/find-nearest.gc index 622c164cb2..43c45ee4c0 100644 --- a/goal_src/jak2/engine/collide/find-nearest.gc +++ b/goal_src/jak2/engine/collide/find-nearest.gc @@ -7,3 +7,420 @@ ;; DECOMP BEGINS +(deftype search-info (structure) + ((point vector :inline :offset-assert 0) + (best-point vector :inline :offset-assert 16) + (match-handle handle :offset-assert 32) + (match basic :offset-assert 40) + (best float :offset-assert 44) + (radius float :offset-assert 48) + (rating search-info-flag :offset-assert 52) + (require search-info-flag :offset-assert 56) + (mask search-info-flag :offset-assert 60) + (rot-base vector :inline :offset-assert 64) + (ack-point vector :inline :offset-assert 80) + (rot-range float :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x64 + :flag-assert #x900000064 + ) + + +(define *search-info* (new 'global 'search-info)) + +(defun find-nearest-attackable ((arg0 vector) (arg1 float) (arg2 uint) (arg3 uint) (arg4 vector) (arg5 vector) (arg6 float)) + (let ((gp-0 *search-info*)) + (set! (-> gp-0 match) #f) + (set! (-> gp-0 point quad) (-> arg0 quad)) + (set! (-> gp-0 radius) arg1) + (set! (-> gp-0 best) 1000000000000000000000.0) + (set! (-> gp-0 rating) (search-info-flag)) + (set! (-> gp-0 require) (the-as search-info-flag arg3)) + (set! (-> gp-0 mask) (the-as search-info-flag arg2)) + (set! (-> gp-0 rot-base quad) (-> arg4 quad)) + (if arg5 + (set! (-> gp-0 ack-point quad) (-> arg5 quad)) + (set! (-> gp-0 ack-point quad) (-> gp-0 rot-base quad)) + ) + (set! (-> gp-0 rot-range) (if (= arg6 65536.0) + -2.0 + arg6 + ) + ) + (iterate-process-tree + *entity-pool* + (lambda ((arg0 process-drawable)) + (with-pp + (when (and (logtest? (process-mask crate enemy collectable guard) (-> arg0 mask)) + (zero? (logand (process-mask no-track) (-> arg0 mask))) + ) + (let* ((gp-0 *search-info*) + (s4-0 arg0) + (s5-0 (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + (when s5-0 + (let* ((s4-1 (-> s5-0 root)) + (s3-0 (if (type? s4-1 collide-shape) + s4-1 + ) + ) + ) + (when s3-0 + (let* ((s4-2 (the-as structure (-> (the-as collide-shape s3-0) root-prim prim-core))) + (f30-0 (- (vector-vector-distance (-> gp-0 point) (the-as vector s4-2)) + (-> (the-as collide-prim-core s4-2) world-sphere w) + ) + ) + ) + (let* ((s1-0 s5-0) + (s2-0 (if (type? s1-0 process-focusable) + s1-0 + ) + ) + ) + (if (and (type? s2-0 process-focusable) + s2-0 + s2-0 + (zero? (logand (-> (the-as process-focusable s2-0) focus-status) (focus-status disable dead))) + ) + (set! s4-2 (get-trans (the-as process-focusable s2-0) 3)) + ) + ) + (when (nonzero? (-> (the-as collide-shape s3-0) root-prim prim-core collide-as)) + (let ((s3-1 0)) + 0.0 + (let* ((s2-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (the-as vector s4-2) (-> gp-0 point)) 1.0)) + (f28-0 (cond + ((logtest? (-> gp-0 mask) (search-info-flag prefer-xz)) + (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle s2-1))) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) + (- -9999.0 (vector-dot s2-1 (-> gp-0 rot-base))) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-center)) + (* f30-0 (fmax 0.01 (- 1.0 (vector-dot s2-1 (-> gp-0 rot-base))))) + ) + (else + f30-0 + ) + ) + ) + ) + (cond + ((logtest? (-> gp-0 mask) (search-info-flag cull-angle)) + (if (< (vector-dot s2-1 (-> gp-0 rot-base)) (cos (-> gp-0 rot-range))) + (return (the-as object #f)) + ) + ) + ((logtest? (-> gp-0 mask) (search-info-flag cull-xz)) + (if (< (-> gp-0 rot-range) (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle s2-1)))) + (return (the-as object #f)) + ) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag back-point)) + (if (< (vector-dot + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (the-as vector s4-2) (-> gp-0 ack-point)) 1.0) + (-> gp-0 rot-base) + ) + 0.0 + ) + (return (the-as object #f)) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag combo)) + (if (not (send-event s5-0 'combo)) + (return (the-as object #f)) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag check-track)) + (if (not (send-event s5-0 'track #f)) + (return (the-as object #f)) + ) + ) + (if (logtest? (process-mask enemy guard) (-> s5-0 mask)) + (set! s3-1 (logior s3-1 2)) + ) + (if (logtest? (process-mask crate) (-> s5-0 mask)) + (set! s3-1 (logior s3-1 1)) + ) + (if (and (nonzero? (-> s5-0 draw)) (logtest? (-> s5-0 draw status) (draw-control-status on-screen))) + (set! s3-1 (logior s3-1 4)) + ) + (let ((s3-2 (logand (the-as search-info-flag s3-1) (-> gp-0 mask)))) + (when (and (>= s3-2 (the-as int (-> gp-0 rating))) + (or (zero? (-> gp-0 require)) (logtest? (the-as search-info-flag s3-2) (-> gp-0 require))) + (< f28-0 (-> gp-0 best)) + (< f30-0 (-> gp-0 radius)) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag probe)) + (let ((a1-17 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-17 start-pos quad) (-> gp-0 ack-point quad)) + (vector-! (-> a1-17 move-dist) (the-as vector s4-2) (-> gp-0 ack-point)) + (let ((v1-92 a1-17)) + (set! (-> v1-92 radius) 1228.8) + (set! (-> v1-92 collide-with) (collide-spec backgnd)) + (set! (-> v1-92 ignore-process0) pp) + (set! (-> v1-92 ignore-process1) #f) + (set! (-> v1-92 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-92 action-mask) (collide-action solid)) + ) + (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* a1-17))) + (if (and (>= f0-16 0.0) (< f0-16 1.0)) + (return (the-as object #f)) + ) + ) + ) + ) + (set! (-> gp-0 match) s5-0) + (set! (-> gp-0 best) f28-0) + (set! (-> gp-0 rating) (the-as search-info-flag s3-2)) + s3-2 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + *null-kernel-context* + ) + (-> gp-0 match) + ) + ) + +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 752 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 752 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 752 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 752 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +(defun find-nearest-focusable ((arg0 (array collide-shape)) + (arg1 vector) + (arg2 float) + (arg3 search-info-flag) + (arg4 search-info-flag) + (arg5 vector) + (arg6 vector) + (arg7 float) + ) + (local-vars + (sv-704 (function float float float)) + (sv-720 float) + (sv-736 (function float float float)) + (sv-752 float) + ) + (with-pp + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 *search-info*)) + (set! (-> gp-0 match) #f) + (set! (-> gp-0 point quad) (-> arg1 quad)) + (set! (-> gp-0 radius) arg2) + (set! (-> gp-0 best) 1000000000000000000000.0) + (set! (-> gp-0 rating) (search-info-flag)) + (set! (-> gp-0 require) arg4) + (set! (-> gp-0 mask) arg3) + (set! (-> gp-0 rot-base quad) (-> arg5 quad)) + (if arg6 + (set! (-> gp-0 ack-point quad) (-> arg6 quad)) + (set! (-> gp-0 ack-point quad) (-> gp-0 rot-base quad)) + ) + (set! arg7 (cond + ((= arg7 65536.0) + -2.0 + ) + (else + (empty) + arg7 + ) + ) + ) + (set! (-> gp-0 rot-range) arg7) + (let ((s4-0 (-> arg0 length))) + (while (begin (label cfg-89) (nonzero? s4-0)) + (+! s4-0 -1) + (let* ((s1-0 (-> arg0 s4-0)) + (s2-0 (-> s1-0 process)) + (s3-0 (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + (when (and (and s3-0 (zero? (logand (-> (the-as process-focusable s3-0) focus-status) (focus-status disable dead)))) + (and (logtest? (process-mask crate enemy collectable guard) (-> s3-0 mask)) + (zero? (logand (process-mask no-track) (-> s3-0 mask))) + ) + ) + (let* ((s2-1 (get-trans (the-as process-focusable s3-0) 3)) + (f30-0 (- (vector-vector-distance (-> gp-0 point) s2-1) (-> s2-1 w))) + ) + (when (nonzero? (-> s1-0 root-prim prim-core collide-as)) + (let ((s1-1 0)) + 0.0 + (let* ((s0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) 1.0)) + (f28-0 (cond + ((logtest? (-> gp-0 mask) (search-info-flag prefer-xz)) + (set! sv-704 deg-diff) + (set! sv-720 (vector-y-angle (-> gp-0 rot-base))) + (let ((a1-7 (vector-y-angle s0-0))) + (fabs (sv-704 sv-720 a1-7)) + ) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) + (- -9999.0 (vector-dot s0-0 (-> gp-0 rot-base))) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-center)) + (* f30-0 (fmax 0.01 (- 1.0 (vector-dot s0-0 (-> gp-0 rot-base))))) + ) + (else + f30-0 + ) + ) + ) + ) + (cond + ((logtest? (-> gp-0 mask) (search-info-flag cull-angle)) + (cond + ((< (-> gp-0 rot-range) 14563.556) + (let ((f26-0 (vector-dot (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) (-> gp-0 rot-base))) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (let ((v1-45 (-> gp-0 point)) + (a0-23 (-> gp-0 rot-base)) + (f0-13 f26-0) + ) + (.lvf vf2 (&-> a0-23 quad)) + (.lvf vf1 (&-> v1-45 quad)) + (let ((v1-46 f0-13)) + (.mov vf3 v1-46) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> s0-1 quad) vf4) + (if (< (* f26-0 (tan (-> gp-0 rot-range))) (- (vector-vector-distance s0-1 s2-1) (-> s2-1 w))) + (goto cfg-89) + ) + ) + ) + (else + (if (< (vector-dot s0-0 (-> gp-0 rot-base)) (cos (-> gp-0 rot-range))) + (return (the-as basic #f)) + ) + ) + ) + ) + ((logtest? (-> gp-0 mask) (search-info-flag cull-xz)) + (let ((f26-3 (-> gp-0 rot-range))) + (set! sv-736 deg-diff) + (set! sv-752 (vector-y-angle (-> gp-0 rot-base))) + (let ((a1-10 (vector-y-angle s0-0))) + (if (< f26-3 (fabs (sv-736 sv-752 a1-10))) + (goto cfg-89) + ) + ) + ) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag back-point)) + (if (< (vector-dot + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 ack-point)) 1.0) + (-> gp-0 rot-base) + ) + 0.0 + ) + (goto cfg-89) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag combo)) + (if (not (send-event s3-0 'combo)) + (goto cfg-89) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag check-track)) + (if (not (send-event s3-0 'track #f)) + (goto cfg-89) + ) + ) + (if (logtest? (process-mask enemy guard) (-> s3-0 mask)) + (set! s1-1 (logior s1-1 2)) + ) + (if (logtest? (process-mask crate) (-> s3-0 mask)) + (set! s1-1 (logior s1-1 1)) + ) + (if (and (nonzero? (-> (the-as process-focusable s3-0) draw)) + (logtest? (-> (the-as process-focusable s3-0) draw status) (draw-control-status on-screen)) + ) + (set! s1-1 (logior s1-1 4)) + ) + (let ((s1-2 (logand (the-as search-info-flag s1-1) (-> gp-0 mask)))) + (when (and (>= s1-2 (the-as int (-> gp-0 rating))) + (or (zero? (-> gp-0 require)) (logtest? (the-as search-info-flag s1-2) (-> gp-0 require))) + (< f28-0 (-> gp-0 best)) + (< f30-0 (-> gp-0 radius)) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag probe)) + (let ((a1-15 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-15 start-pos quad) (-> gp-0 ack-point quad)) + (vector-! (-> a1-15 move-dist) s2-1 (-> gp-0 ack-point)) + (let ((v1-113 a1-15)) + (set! (-> v1-113 radius) 1228.8) + (set! (-> v1-113 collide-with) (collide-spec backgnd)) + (set! (-> v1-113 ignore-process0) pp) + (set! (-> v1-113 ignore-process1) #f) + (set! (-> v1-113 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> v1-113 action-mask) (collide-action solid)) + ) + (let ((f0-29 (fill-and-probe-using-line-sphere *collide-cache* a1-15))) + (if (and (>= f0-29 0.0) (< f0-29 1.0)) + (goto cfg-89) + ) + ) + ) + ) + (set! (-> gp-0 match) s3-0) + (set! (-> gp-0 best) f28-0) + (set! (-> gp-0 rating) (the-as search-info-flag s1-2)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (-> gp-0 match) + ) + ) + ) + ) + + + + diff --git a/goal_src/jak2/engine/debug/debug-h.gc b/goal_src/jak2/engine/debug/debug-h.gc index 32b8f29520..1b09037fb7 100644 --- a/goal_src/jak2/engine/debug/debug-h.gc +++ b/goal_src/jak2/engine/debug/debug-h.gc @@ -10,14 +10,54 @@ ;; NOTE - for cam-debug (define-extern transform-float-point (function vector vector4w vector4w)) (define-extern add-debug-line (function symbol bucket-id vector vector rgba symbol rgba symbol)) -;; NOTE - for sparticle-launcher -(define-extern add-debug-sphere (function symbol bucket-id vector meters rgba symbol)) - +;; NOTE - for editable +(define-extern add-debug-x (function symbol bucket-id vector rgba symbol)) +(define-extern add-debug-vector (function symbol bucket-id vector vector meters rgba symbol)) +(define-extern add-debug-bound (function int transform int rgba rgba int none)) (define-extern add-debug-line2d (function symbol bucket-id vector vector vector symbol)) (define-extern add-debug-text-3d (function symbol bucket-id string vector font-color vector2h symbol)) (define-extern add-debug-text-sphere (function symbol bucket-id vector meters string rgba symbol)) +;; NOTE - for debug +(define-extern add-debug-sphere (function symbol bucket-id vector meters rgba symbol)) + +(defenum debug-menu-msg + :type int32 + (activate 1) + (deactivate 2) + (update 3) + (press 4) + ) + +(defenum debug-menu-dest + :type int32 + (activation 0) + (root 1) + (open-menus 2) + (current-selection 3)) + +;; NOTE - for editable-player +(declare-type debug-menu basic) +(deftype debug-menu-context (basic) + ((is-active symbol :offset-assert 4) ;; guessed by decompiler + (sel-length int32 :offset-assert 8) + (sel-menu debug-menu 8 :offset-assert 12) ;; guessed by decompiler + (root-menu debug-menu :offset-assert 44) ;; guessed by decompiler + (joypad-func (function basic none) :offset-assert 48) ;; guessed by decompiler + (joypad-item basic :offset-assert 52) + (font font-context :offset-assert 56) ;; guessed by decompiler + (is-hidden symbol :offset-assert 60) ;; guessed by decompiler + (joypad-number int32 :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x44 + :flag-assert #x900000044 + ) +(define-extern debug-menu-context-send-msg (function debug-menu-context debug-menu-msg debug-menu-dest debug-menu-context)) +(define-extern debug-menus-handler (function debug-menu-context debug-menu-context)) + + ;; DECOMP BEGINS (deftype pos-history (structure) diff --git a/goal_src/jak2/engine/debug/editable-h.gc b/goal_src/jak2/engine/debug/editable-h.gc index 11b6300325..edefd4b3d4 100644 --- a/goal_src/jak2/engine/debug/editable-h.gc +++ b/goal_src/jak2/engine/debug/editable-h.gc @@ -5,5 +5,748 @@ ;; name in dgo: editable-h ;; dgos: ENGINE, GAME +;; +++editable-filter +(defenum editable-filter + :type uint32 + :bitfield #t + (none 0) + (unknown 1) + (sound 2) + (part 3) + (user-setting 4) + (cam-setting 5) + (load 6) + (water-command 7) + (camera 8) + (target 9) + (water 10) + (data 11) + (city_vis 12) + (sample 13) + (light 14) + (entity 15) + (selected 16) + ) +;; ---editable-filter + +;; +++editable-flag +(defenum editable-flag + :type uint32 + :bitfield #t + (selected) + (no-save) + (orient) + (x) + (y) + (z) + (no-plane-snap) + (no-update) + (mark) + (top-set) + (bot-set) + (changed) + ) +;; ---editable-flag + +;; +++editable-command +(defenum editable-command + :type uint32 + :bitfield #f + (none 0) + (exit 1) + (kill 2) + (select-one 3) + (select-toggle 4) + (select-all 5) + (select-none 6) + (select-region 7) + (select-face 8) + (select-prim 9) + (select-current-owner 10) + (select-current-region 11) + (select-current-face 12) + (select-current-prim 13) + (pick-target 14) + (pick-loc 15) + (pick-yes-no 16) + (cancel 17) + (drag-move-xy 18) + (drag-move-xz 19) + (drag-move-x 20) + (drag-move-y 21) + (drag-move-z 22) + (drag-resize 23) + (camera-tumble 24) + (camera-xy 25) + (camera-xz 26) + (insert-sphere 27) + (insert-point 28) + (insert-sample 29) + (insert-sample-camera 30) + (insert-light 31) + (insert-entity 32) + (insert-face 33) + (insert-plane 34) + (insert-box 35) + (delete 36) + (copy 37) + (resize 38) + (snap-to-ground 39) + (snap-xz 40) + (snap-y 41) + (flip-side 42) + (region-set 43) + (region-new 44) + (edit-plane-set 45) + (edit-plane-clear 46) + (delete-region 47) + (copy-region 48) + (region-add 49) + (save 50) + (load 51) + (update-game 52) + (print-region-info 53) + (refresh-filter 54) + (rotate-level 55) + (translate-y-level 56) + ) +;; ---editable-command + +(declare-type editable-array basic) +(declare-type editable-plane editable) + +(declare-type editable-region basic) +(define-extern *editable-sample-region* editable-region) +(define-extern *editable-light-region* editable-region) +(define-extern *editable-entity-region* editable-region) + +(define-extern *editable-menu-context* debug-menu-context) + ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +(define *editable-temp-id* 0) + +(defun editable-command->string ((arg0 editable-command)) + (case arg0 + (((editable-command insert-entity)) + "insert-entity" + ) + (((editable-command print-region-info)) + "print-region-info" + ) + (((editable-command resize)) + "resize" + ) + (((editable-command insert-face)) + "insert-face" + ) + (((editable-command select-one)) + "select-one" + ) + (((editable-command update-game)) + "update-game" + ) + (((editable-command region-set)) + "region-set" + ) + (((editable-command select-all)) + "select-all" + ) + (((editable-command region-add)) + "region-add" + ) + (((editable-command flip-side)) + "flip-side" + ) + (((editable-command drag-resize)) + "drag-resize" + ) + (((editable-command select-current-prim)) + "select-current-prim" + ) + (((editable-command edit-plane-set)) + "edit-plane-set" + ) + (((editable-command edit-plane-clear)) + "edit-plane-clear" + ) + (((editable-command kill)) + "kill" + ) + (((editable-command delete-region)) + "delete-region" + ) + (((editable-command select-region)) + "select-region" + ) + (((editable-command camera-tumble)) + "camera-tumble" + ) + (((editable-command select-current-face)) + "select-current-face" + ) + (((editable-command snap-xz)) + "snap-xz" + ) + (((editable-command insert-sample)) + "insert-sample" + ) + (((editable-command camera-xy)) + "camera-xy" + ) + (((editable-command pick-loc)) + "pick-loc" + ) + (((editable-command select-face)) + "select-face" + ) + (((editable-command rotate-level)) + "rotate-level" + ) + (((editable-command pick-yes-no)) + "pick-yes-no" + ) + (((editable-command translate-y-level)) + "translate-y-level" + ) + (((editable-command save)) + "save" + ) + (((editable-command copy-region)) + "copy-region" + ) + (((editable-command cancel)) + "cancel" + ) + (((editable-command insert-light)) + "insert-light" + ) + (((editable-command drag-move-z)) + "drag-move-z" + ) + (((editable-command exit)) + "exit" + ) + (((editable-command drag-move-y)) + "drag-move-y" + ) + (((editable-command drag-move-xy)) + "drag-move-xy" + ) + (((editable-command select-prim)) + "select-prim" + ) + (((editable-command none)) + "none" + ) + (((editable-command delete)) + "delete" + ) + (((editable-command drag-move-x)) + "drag-move-x" + ) + (((editable-command insert-plane)) + "insert-plane" + ) + (((editable-command insert-sphere)) + "insert-sphere" + ) + (((editable-command insert-point)) + "insert-point" + ) + (((editable-command select-current-region)) + "select-current-region" + ) + (((editable-command camera-xz)) + "camera-xz" + ) + (((editable-command region-new)) + "region-new" + ) + (((editable-command drag-move-xz)) + "drag-move-xz" + ) + (((editable-command load)) + "load" + ) + (((editable-command insert-box)) + "insert-box" + ) + (((editable-command snap-to-ground)) + "snap-to-ground" + ) + (((editable-command select-none)) + "select-none" + ) + (((editable-command select-toggle)) + "select-toggle" + ) + (((editable-command insert-sample-camera)) + "insert-sample-camera" + ) + (((editable-command pick-target)) + "pick-target" + ) + (((editable-command select-current-owner)) + "select-current-owner" + ) + (((editable-command refresh-filter)) + "refresh-filter" + ) + (((editable-command copy)) + "copy" + ) + (((editable-command snap-y)) + "snap-y" + ) + (else + "*unknown*" + ) + ) + ) + +;; WARN: Return type mismatch basic vs string. +(defun editable-filter->string ((arg0 editable-filter) (arg1 basic)) + (if (= (logand arg0 (editable-filter target)) (editable-filter target)) + (format arg1 "target ") + ) + (if (= (logand arg0 (editable-filter city_vis)) (editable-filter city_vis)) + (format arg1 "city_vis ") + ) + (if (= (logand arg0 (editable-filter water-command)) (editable-filter water-command)) + (format arg1 "water-command ") + ) + (if (= (logand arg0 (editable-filter user-setting)) (editable-filter user-setting)) + (format arg1 "user-setting ") + ) + (if (= (logand arg0 (editable-filter sample)) (editable-filter sample)) + (format arg1 "sample ") + ) + (if (= (logand arg0 (editable-filter light)) (editable-filter light)) + (format arg1 "light ") + ) + (if (= (logand arg0 (editable-filter part)) (editable-filter part)) + (format arg1 "part ") + ) + (if (= (logand arg0 (editable-filter unknown)) (editable-filter unknown)) + (format arg1 "unknown ") + ) + (if (= (logand arg0 (editable-filter entity)) (editable-filter entity)) + (format arg1 "entity ") + ) + (if (= (logand arg0 (editable-filter data)) (editable-filter data)) + (format arg1 "data ") + ) + (if (= (logand arg0 (editable-filter water)) (editable-filter water)) + (format arg1 "water ") + ) + (if (= (logand arg0 (editable-filter cam-setting)) (editable-filter cam-setting)) + (format arg1 "cam-setting ") + ) + (if (= (logand (editable-filter selected) arg0) (editable-filter selected)) + (format arg1 "selected ") + ) + (if (= (logand arg0 (editable-filter none)) (editable-filter none)) + (format arg1 "none ") + ) + (if (= (logand arg0 (editable-filter camera)) (editable-filter camera)) + (format arg1 "camera ") + ) + (if (= (logand arg0 (editable-filter load)) (editable-filter load)) + (format arg1 "load ") + ) + (if (= (logand arg0 (editable-filter sound)) (editable-filter sound)) + (format arg1 "sound ") + ) + (the-as string arg1) + ) + +(deftype editable-region (basic) + ((changed symbol :offset-assert 4) + (locked symbol :offset-assert 8) + (id uint64 :offset-assert 16) + (filter editable-filter :offset-assert 24) + (tree string :offset-assert 28) + (level string :offset-assert 32) + (on-enter string :offset-assert 36) + (on-inside string :offset-assert 40) + (on-exit string :offset-assert 44) + ) + :method-count-assert 13 + :size-assert #x30 + :flag-assert #xd00000030 + (:methods + (new (symbol type) _type_ 0) + (editable-region-method-9 () none 9) + (editable-region-method-10 (_type_ int) symbol 10) + (editable-region-method-11 (_type_ vector int) none 11) + (editable-region-method-12 (_type_) editable-filter 12) + ) + ) + + +(deftype editable (basic) + ((flags editable-flag :offset-assert 4) + (name string :offset-assert 8) + (id uint32 :offset-assert 12) + (region editable-region :offset-assert 16) + (owner pair :offset-assert 20) + ) + :method-count-assert 30 + :size-assert #x18 + :flag-assert #x1e00000018 + (:methods + (get-color (_type_ int) rgba 9) + (editable-method-10 (_type_) none 10) + (editable-method-11 (_type_ vector) symbol 11) + (select-editable! (_type_ symbol) none 12) + (edit-get-distance (_type_ vector) float 13) + (edit-get-trans (_type_) vector 14) + (editable-method-15 (_type_ vector int) none 15) + (edit-coord! (_type_ vector editable-flag) none 16) + (editable-method-17 (_type_ vector) none 17) + (editable-method-18 (_type_ vector matrix) none 18) + (editable-method-19 (_type_ vector) none 19) + (editable-method-20 (_type_ vector vector vector vector) none 20) + (editable-method-21 (_type_ editable-region) none 21) + (editable-method-22 (_type_ editable-array int int) symbol 22) + (editable-method-23 (_type_) symbol 23) + (editable-method-24 (_type_) none 24) + (editable-method-25 (_type_ editable-array) none 25) + (editable-method-26 (_type_ editable editable-array) none 26) + (editable-method-27 (_type_ editable-array) editable 27) + (editable-method-28 (_type_ editable-filter) none 28) + (editable-method-29 (_type_ editable-filter) symbol 29) + ) + ) + + +(deftype editable-array (basic) + ((allocated-length int32 :offset-assert 4) + (length int32 :offset-assert 8) + (region editable-region :offset-assert 12) + (backup-region editable-region :offset-assert 16) + (region-lock? symbol :offset-assert 20) + (move-lock? symbol :offset-assert 24) + (move-speed float :offset-assert 28) + (selection (array editable) :offset-assert 32) + (filter editable-filter 2 :offset-assert 36) + (target editable :offset-assert 44) + (target-mode uint32 :offset-assert 48) + (target-command basic :offset-assert 52) + (target-message string :offset-assert 56) + (edit-plane editable-plane :offset-assert 60) + (edit-plane-center vector :inline :offset-assert 64) + (edit-plane-normal vector :inline :offset-assert 80) + (level-offset vector :inline :offset-assert 96) + (level-info-id uint32 :offset-assert 112) + (level uint32 :offset-assert 116) + (edit-param0 float :offset-assert 120) + (data editable :dynamic :offset-assert 124) + ) + :method-count-assert 18 + :size-assert #x7c + :flag-assert #x120000007c + (:methods + (new (symbol type int) _type_ 0) + (editable-array-method-9 (_type_ editable-command editable-array) symbol :behavior editable-player 9) + (editable-array-method-10 (_type_ vector int) editable 10) + (editable-array-method-11 (_type_) int 11) + (editable-array-method-12 (_type_ editable-array) none 12) + (editable-array-method-13 (_type_ uint basic string) none 13) + (editable-array-method-14 (_type_ (function symbol) symbol) none 14) + (editable-array-method-15 (_type_ editable) none 15) + (editable-array-method-16 (_type_) none 16) + (editable-array-method-17 (_type_ vector vector) vector 17) + ) + ) + + +(defmethod new editable-array ((allocation symbol) (type-to-make type) (arg0 int)) + (let ((s5-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* arg0 4)))))) + (set! (-> s5-0 allocated-length) arg0) + (set! (-> s5-0 length) 0) + (set! (-> s5-0 region) #f) + (set! (-> s5-0 backup-region) #f) + (set! (-> s5-0 region-lock?) #f) + (set! (-> s5-0 move-lock?) #f) + (set! (-> s5-0 target) #f) + (set! (-> s5-0 target-command) (the-as basic 0)) + (set! (-> s5-0 target-message) #f) + (set! (-> s5-0 selection) + (the-as (array editable) ((method-of-type array new) allocation array editable arg0)) + ) + (set! (-> s5-0 edit-plane) #f) + (set! (-> s5-0 filter 0) (editable-filter + none + unknown + sound + part + user-setting + cam-setting + load + water-command + city_vis + sample + light + entity + ) + ) + (set! (-> s5-0 filter 1) (editable-filter camera target water data city_vis sample light entity selected)) + (dotimes (v1-5 arg0) + (set! (-> s5-0 data v1-5) #f) + (set! (-> s5-0 selection v1-5) #f) + ) + s5-0 + ) + ) + +(deftype editable-point (editable) + ((radius float :offset-assert 24) + (trans vector :inline :offset-assert 32) + ) + :method-count-assert 30 + :size-assert #x30 + :flag-assert #x1e00000030 + (:methods + (new (symbol type vector editable-region) _type_ 0) + ) + ) + + +(defmethod new editable-point ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 editable-region)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 region) #f) + (set! (-> gp-0 name) "undefined") + (editable-method-21 gp-0 (cond + (arg1 + (empty) + arg1 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> gp-0 trans quad) (-> arg0 quad)) + (set! (-> gp-0 radius) 2048.0) + (set! (-> gp-0 owner) '()) + gp-0 + ) + ) + +(deftype editable-sphere (editable-point) + () + :method-count-assert 30 + :size-assert #x30 + :flag-assert #x1e00000030 + (:methods + (new (symbol type vector float editable-region) _type_ 0) + ) + ) + + +(defmethod new editable-sphere ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region)) + (let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s5-0 region) #f) + (set! (-> s5-0 name) "undefined") + (editable-method-21 s5-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> s5-0 trans quad) (-> arg0 quad)) + (set! (-> s5-0 radius) arg1) + (set! (-> s5-0 owner) '()) + s5-0 + ) + ) + +(deftype editable-sample (editable-point) + () + :method-count-assert 30 + :size-assert #x30 + :flag-assert #x1e00000030 + ) + + +(deftype editable-light (editable-sphere) + ((direction vector :inline :offset-assert 48) + (color vector :inline :offset-assert 64) + (decay-start float :offset-assert 80) + (ambient-point-ratio float :offset-assert 84) + (brightness float :offset-assert 88) + ) + :method-count-assert 30 + :size-assert #x5c + :flag-assert #x1e0000005c + (:methods + (new (symbol type vector float editable-region) _type_ 0) + ) + ) + + +(defmethod new editable-light ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 region) #f) + (editable-method-21 gp-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> gp-0 trans quad) (-> arg0 quad)) + (set! (-> gp-0 radius) arg1) + (set! (-> gp-0 owner) '()) + (let ((s5-1 (new 'debug 'string 32 (the-as string #f)))) + (format s5-1 "undefined-~d" *editable-temp-id*) + (set! (-> gp-0 name) s5-1) + ) + (set! *editable-temp-id* (+ *editable-temp-id* 1)) + (set! (-> gp-0 decay-start) 0.5) + (set! (-> gp-0 ambient-point-ratio) 1.0) + (set! (-> gp-0 brightness) 1.0) + (set-vector! (-> gp-0 color) 1.0 1.0 1.0 -1.0) + (set-vector! (-> gp-0 direction) 0.0 0.0 0.0 0.0) + gp-0 + ) + ) + +(deftype editable-entity (editable-point) + () + :method-count-assert 30 + :size-assert #x30 + :flag-assert #x1e00000030 + ) + + +(deftype editable-face (editable) + ((length int32 :offset-assert 24) + (normal vector :inline :offset-assert 32) + (center vector :inline :offset-assert 48) + (vertex editable-point 6 :offset-assert 64) + ) + :method-count-assert 32 + :size-assert #x58 + :flag-assert #x2000000058 + (:methods + (new (symbol type editable-region) _type_ 0) + (editable-face-method-30 (_type_ (inline-array vector)) int 30) + (editable-face-method-31 (_type_ vector) vector 31) + ) + ) + + +(defmethod new editable-face ((allocation symbol) (type-to-make type) (arg0 editable-region)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 region) #f) + (set! (-> gp-0 name) "undefined") + (editable-method-21 gp-0 (cond + (arg0 + (empty) + arg0 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> gp-0 owner) '()) + gp-0 + ) + ) + +(deftype editable-plane (editable) + ((length int32 :offset-assert 24) + (radius float :offset-assert 28) + (vertex editable-point 2 :offset-assert 32) + ) + :method-count-assert 32 + :size-assert #x28 + :flag-assert #x2000000028 + (:methods + (new (symbol type editable-region) _type_ 0) + (editable-plane-method-30 (_type_ matrix) int 30) + (editable-plane-method-31 (_type_ vector) vector 31) + ) + ) + + +(defmethod new editable-plane ((allocation symbol) (type-to-make type) (arg0 editable-region)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 region) #f) + (set! (-> gp-0 name) "undefined") + (editable-method-21 gp-0 (cond + (arg0 + (empty) + arg0 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> gp-0 owner) '()) + (set! (-> gp-0 radius) 20480.0) + gp-0 + ) + ) + +(deftype editable-player (process-drawable) + ((current editable-array :offset-assert 200) + (select-command function :offset-assert 204) + (move-command function :offset-assert 208) + (extra-command function :offset-assert 212) + (left-handed basic :offset-assert 216) + (light-names basic :offset-assert 220) + (external-cam-mode symbol :offset-assert 224) + (command function 6 :offset-assert 228) + (close-menu-time time-frame :offset-assert 256) + ) + :heap-base #x90 + :method-count-assert 22 + :size-assert #x108 + :flag-assert #x1600900108 + (:methods + (idle () _type_ :state 20) + (editable-player-method-21 (_type_) none 21) + ) + ) + + +(deftype editable-work (basic) + ((num-found int16 :offset-assert 4) + (last-found int16 :offset-assert 6) + (last-x float :offset-assert 8) + (last-y float :offset-assert 12) + (found editable 256 :offset-assert 16) + (dists uint32 256 :offset-assert 1040) + ) + :method-count-assert 9 + :size-assert #x810 + :flag-assert #x900000810 + ) + + +(define *editable-work* (new 'global 'editable-work)) + +(define *editable* (the-as (pointer editable-player) #f)) + +0 + +) + + + diff --git a/goal_src/jak2/engine/debug/editable-player.gc b/goal_src/jak2/engine/debug/editable-player.gc index 0c5683bc1c..21a76c72ff 100644 --- a/goal_src/jak2/engine/debug/editable-player.gc +++ b/goal_src/jak2/engine/debug/editable-player.gc @@ -5,5 +5,2586 @@ ;; name in dgo: editable-player ;; dgos: ENGINE, GAME +;; og:ignore-form:insert-box +;; og:ignore-form:dm-editable-light-float-func +;; og:ignore-form:dm-editable-boolean-toggle-pick-func + +(define-extern insert-box (function editable-array vector none)) +(define-extern editable-menu-context-make-menus (function debug-menu-context none)) + ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; WARN: Return type mismatch int vs none. +(defun cleanup-selection ((arg0 editable-array)) + (let* ((v1-0 (-> arg0 length)) + (a0-1 0) + (a1-2 (-> arg0 data a0-1)) + ) + (while (< a0-1 v1-0) + (if a1-2 + (logclear! (-> a1-2 flags) (editable-flag mark)) + ) + (+! a0-1 1) + (set! a1-2 (-> arg0 data a0-1)) + ) + ) + (let* ((s5-0 (-> arg0 length)) + (s4-0 0) + (a0-2 (-> arg0 data s4-0)) + ) + (while (< s4-0 s5-0) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (editable-method-29 a0-2 (editable-filter)) + ) + (+! s4-0 1) + (set! a0-2 (-> arg0 data s4-0)) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +;; WARN: Function insert-box has a return type of none, but the expression builder found a return statement. + +(defun execute-select ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) + (case arg1 + (((editable-command select-none)) + (let* ((s5-1 (-> arg0 length)) + (s4-0 0) + (a0-2 (-> arg0 data s4-0)) + ) + (while (< s4-0 s5-1) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (select-editable! a0-2 #f) + ) + (+! s4-0 1) + (set! a0-2 (-> arg0 data s4-0)) + ) + ) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) #f) + ) + ) + (((editable-command select-all)) + (let* ((s5-2 (-> arg0 length)) + (s4-1 0) + (a0-4 (-> arg0 data s4-1)) + ) + (while (< s4-1 s5-2) + (if (and a0-4 (or (and (logtest? (-> a0-4 region filter) (-> arg0 filter 0)) + (logtest? (-> a0-4 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> a0-4 flags) (editable-flag selected)) + ) + ) + (select-editable! a0-4 #t) + ) + (+! s4-1 1) + (set! a0-4 (-> arg0 data s4-1)) + ) + ) + ) + (((editable-command select-one)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-7 arg0) + (t9-4 (method-of-object a0-7 editable-array-method-10)) + (a1-12 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-12 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-12 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-12 z) 0.0) + (set! (-> a1-12 w) 1.0) + (let ((s4-3 (t9-4 a0-7 a1-12 0))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (when s4-3 + (select-editable! s4-3 #t) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s4-3 region)) + ) + ) + ) + ) + ) + (((editable-command select-toggle)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-12 arg0) + (t9-9 (method-of-object a0-12 editable-array-method-10)) + (a1-16 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-16 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-16 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-16 z) 0.0) + (set! (-> a1-16 w) 1.0) + (let ((s5-3 (t9-9 a0-12 a1-16 1))) + (when s5-3 + (select-editable! s5-3 'toggle) + (if (and (logtest? (-> s5-3 flags) (editable-flag selected)) (not (-> arg0 region-lock?))) + (set! (-> arg0 region) (-> s5-3 region)) + ) + ) + ) + ) + ) + (((editable-command select-region)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-16 arg0) + (t9-13 (method-of-object a0-16 editable-array-method-10)) + (a1-19 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-19 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-19 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-19 z) 0.0) + (set! (-> a1-19 w) 1.0) + (let ((s4-6 (t9-13 a0-16 a1-19 0))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (when s4-6 + (select-editable! s4-6 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s4-6 region)) + (editable-array-method-9 arg0 (editable-command select-current-region) arg2) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + ) + (((editable-command select-face)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-22 arg0) + (t9-19 (method-of-object a0-22 editable-array-method-10)) + (a1-24 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-24 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-24 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-24 z) 0.0) + (set! (-> a1-24 w) 1.0) + (let ((s4-8 (t9-19 a0-22 a1-24 0))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (when s4-8 + (select-editable! s4-8 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s4-8 region)) + (editable-array-method-9 arg0 (editable-command select-current-face) arg2) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + ) + (((editable-command select-prim)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-28 arg0) + (t9-25 (method-of-object a0-28 editable-array-method-10)) + (a1-29 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-29 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-29 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-29 z) 0.0) + (set! (-> a1-29 w) 1.0) + (let ((s4-10 (t9-25 a0-28 a1-29 0))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (when s4-10 + (select-editable! s4-10 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s4-10 region)) + (editable-array-method-9 arg0 (editable-command select-current-prim) arg2) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + ) + (((editable-command select-current-region)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (when (-> arg0 region) + (let ((s4-12 (-> arg0 region))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (set! (-> arg0 region) s4-12) + ) + (let* ((s5-4 (-> arg0 length)) + (s4-13 0) + (a0-35 (-> arg0 data s4-13)) + ) + (while (< s4-13 s5-4) + (when (and a0-35 (or (and (logtest? (-> a0-35 region filter) (-> arg0 filter 0)) + (logtest? (-> a0-35 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> a0-35 flags) (editable-flag selected)) + ) + ) + (if (= (-> arg0 region) (-> a0-35 region)) + (select-editable! a0-35 #t) + ) + ) + (+! s4-13 1) + (set! a0-35 (-> arg0 data s4-13)) + ) + ) + ) + ) + (((editable-command select-current-owner)) + (let* ((s5-5 (-> arg0 length)) + (s4-14 0) + (v1-121 (-> arg0 data s4-14)) + ) + (while (< s4-14 s5-5) + (when (and v1-121 (logtest? (-> v1-121 flags) (editable-flag selected))) + (let* ((s3-6 (-> v1-121 owner)) (a0-40 (car s3-6))) (while (not (null? s3-6)) + (select-editable! (the-as editable a0-40) #t) + (set! s3-6 (cdr s3-6)) + (set! a0-40 (car s3-6)) + ) + ) + ) + (+! s4-14 1) + (set! v1-121 (-> arg0 data s4-14)) + ) + ) + ) + (((editable-command select-current-face)) + (let* ((s5-6 (-> arg0 length)) + (s4-15 0) + (v1-134 (-> arg0 data s4-15)) + ) + (while (< s4-15 s5-6) + (when (and v1-134 (logtest? (-> v1-134 flags) (editable-flag selected))) + (let* ((s3-7 (-> v1-134 owner)) (a0-45 (car s3-7))) (while (not (null? s3-7)) + (select-editable! (the-as editable a0-45) #t) + (set! s3-7 (cdr s3-7)) + (set! a0-45 (car s3-7)) + ) + ) + ) + (+! s4-15 1) + (set! v1-134 (-> arg0 data s4-15)) + ) + ) + (let* ((s5-7 (-> arg0 length)) + (s4-16 0) + (s3-8 (-> arg0 data s4-16)) + ) + (while (< s4-16 s5-7) + (when (and s3-8 + (or (and (logtest? (-> s3-8 region filter) (-> arg0 filter 0)) + (logtest? (-> s3-8 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> s3-8 flags) (editable-flag selected)) + ) + ) + (let* ((s2-0 (-> s3-8 owner)) + (v1-155 (car s2-0)) + ) + (while (not (null? s2-0)) + (if (logtest? (-> (the-as editable v1-155) flags) (editable-flag selected)) + (select-editable! s3-8 #t) + ) + (set! s2-0 (cdr s2-0)) + (set! v1-155 (car s2-0)) + ) + ) + ) + (+! s4-16 1) + (set! s3-8 (-> arg0 data s4-16)) + ) + ) + ) + (((editable-command select-current-prim)) + (countdown (s5-8 10) + (let* ((s4-17 (-> arg0 length)) + (s3-9 0) + (v1-169 (-> arg0 data s3-9)) + ) + (while (< s3-9 s4-17) + (when (and v1-169 (logtest? (-> v1-169 flags) (editable-flag selected))) + (let* ((s2-1 (-> v1-169 owner)) (a0-58 (car s2-1))) (while (not (null? s2-1)) + (select-editable! (the-as editable a0-58) #t) + (set! s2-1 (cdr s2-1)) + (set! a0-58 (car s2-1)) + ) + ) + ) + (+! s3-9 1) + (set! v1-169 (-> arg0 data s3-9)) + ) + ) + (let* ((s4-18 (-> arg0 length)) + (s3-10 0) + (s2-2 (-> arg0 data s3-10)) + ) + (while (< s3-10 s4-18) + (when (and s2-2 + (or (and (logtest? (-> s2-2 region filter) (-> arg0 filter 0)) + (logtest? (-> s2-2 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> s2-2 flags) (editable-flag selected)) + ) + ) + (let* ((s1-0 (-> s2-2 owner)) + (v1-190 (car s1-0)) + ) + (while (not (null? s1-0)) + (if (logtest? (-> (the-as editable v1-190) flags) (editable-flag selected)) + (select-editable! s2-2 #t) + ) + (set! s1-0 (cdr s1-0)) + (set! v1-190 (car s1-0)) + ) + ) + ) + (+! s3-10 1) + (set! s2-2 (-> arg0 data s3-10)) + ) + ) + ) + ) + (((editable-command cancel)) + (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) + ) + (((editable-command pick-target)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-71 arg0) + (t9-41 (method-of-object a0-71 editable-array-method-10)) + (a1-58 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-58 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-58 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-58 z) 0.0) + (set! (-> a1-58 w) 1.0) + (let ((v1-208 (t9-41 a0-71 a1-58 0))) + (when v1-208 + (set! (-> arg0 target) v1-208) + (editable-array-method-9 arg0 (the-as editable-command (-> arg0 target-command)) arg2) + ) + ) + ) + (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) + ) + (((editable-command pick-loc) (editable-command pick-yes-no)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (editable-array-method-9 arg0 (the-as editable-command (-> arg0 target-command)) arg2) + (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) + ) + (((editable-command edit-plane-clear)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (set! (-> arg0 edit-plane) #f) + (editable-array-method-16 arg0) + ) + (((editable-command edit-plane-set)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (cond + ((-> arg0 target) + (let ((s5-11 (-> arg0 target))) + (set! (-> arg0 edit-plane) (the-as editable-plane (if (type? s5-11 editable-plane) + s5-11 + ) + ) + ) + ) + (editable-array-method-16 arg0) + ) + (else + (editable-array-method-14 + arg0 + (the-as (function symbol) (lambda ((arg0 editable)) (type? arg0 editable-plane))) + #f + ) + (cond + ((>= (-> arg0 selection length) 1) + (set! (-> arg0 edit-plane) (the-as editable-plane (-> arg0 selection 0))) + (editable-array-method-16 arg0) + ) + (else + (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 45) "pick the plane to edit-from") + ) + ) + ) + ) + ) + (((editable-command print-region-info)) + (let ((s5-12 (-> arg0 region))) + (when s5-12 + (format #t "~%~%region-~D~%~%" (-> s5-12 id)) + (let ((a2-35 (-> s5-12 on-enter))) + (if a2-35 + (format #t "(on-enter ~S)~%" a2-35) + ) + ) + (let ((a2-36 (-> s5-12 on-inside))) + (if a2-36 + (format #t "(on-inside ~S)~%" a2-36) + ) + ) + (let ((a2-37 (-> s5-12 on-exit))) + (if a2-37 + (format #t "(on-exit ~S)~%" a2-37) + ) + ) + (format #t "~%~%") + ) + ) + (format #t "~%selected:~%") + (let* ((s5-13 (-> arg0 length)) + (s4-23 0) + (a2-38 (-> arg0 data s4-23)) + ) + (while (< s4-23 s5-13) + (if (and a2-38 (logtest? (-> a2-38 flags) (editable-flag selected))) + (format #t "~A~%" a2-38) + ) + (+! s4-23 1) + (set! a2-38 (-> arg0 data s4-23)) + ) + ) + (format #t "~%~%") + ) + (else + (return #f) + ) + ) + #t + ) + +(defun execute-mouse-move ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) + (local-vars (f0-6 float) (f0-18 float) (f0-29 float)) + (case arg1 + (((editable-command camera-tumble)) + (set-setting! 'mouse-input 'abs #t 0) + (let ((s5-0 (new-stack-vector0)) + (f30-0 0.0) + ) + (let* ((s4-0 (-> arg0 length)) + (s3-0 0) + (a0-3 (-> arg0 data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and a0-3 (logtest? (-> a0-3 flags) (editable-flag selected))) + (vector+! s5-0 s5-0 (edit-get-trans a0-3)) + (set! f30-0 (+ 1.0 f30-0)) + ) + (+! s3-0 1) + (set! a0-3 (-> arg0 data s3-0)) + ) + ) + (cond + ((= f30-0 0.0) + (remove-setting! 'mouse-tumble-point) + ) + (else + (vector-float/! s5-0 s5-0 f30-0) + (set-setting! 'mouse-tumble-point 'abs s5-0 0) + ) + ) + ) + ) + (((editable-command camera-xy)) + (set-setting! 'mouse-input 'abs #t 0) + ) + (((editable-command camera-xz)) + (set-setting! 'mouse-input 'abs #t 0) + ) + (((editable-command drag-move-x)) + (let ((v1-25 (-> arg2 level-offset)) + (a0-12 (-> arg2 edit-plane-normal)) + (s5-1 (new-stack-vector0)) + (s4-1 (-> *math-camera* trans)) + ) + 0.0 + (let* ((f0-4 (- (-> v1-25 x) (-> a0-12 x))) + (f1-2 (- (-> v1-25 y) (-> a0-12 y))) + (f30-1 (if (< (fabs f1-2) (fabs f0-4)) + f0-4 + f1-2 + ) + ) + ) + (if (< (-> *math-camera* camera-rot vector 0 x) 0.0) + (set! f30-1 (- f30-1)) + ) + (let* ((s3-1 (-> arg0 length)) + (s2-1 0) + (s1-2 (-> arg0 data s2-1)) + ) + (while (< s2-1 s3-1) + (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) + (set! f0-6 (cond + ((-> arg0 move-lock?) + (-> arg0 move-speed) + ) + (else + (vector-! s5-1 (edit-get-trans s1-2) s4-1) + (let ((f0-9 (* 0.00390625 f30-1 (vector-length s5-1)))) + (set! f0-6 (fmax -40960.0 (fmin 40960.0 f0-9))) + ) + (set! (-> arg0 move-speed) f0-6) + (set! (-> arg0 move-lock?) #t) + f0-6 + ) + ) + ) + (set-vector! s5-1 f0-6 0.0 0.0 0.0) + (editable-method-15 s1-2 s5-1 56) + ) + (+! s2-1 1) + (set! s1-2 (-> arg0 data s2-1)) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + (((editable-command drag-move-y)) + (let ((v1-54 (-> arg2 level-offset)) + (a0-20 (-> arg2 edit-plane-normal)) + (s5-2 (new-stack-vector0)) + (s4-2 (-> *math-camera* trans)) + ) + 0.0 + (let* ((f0-16 (- (-> v1-54 x) (-> a0-20 x))) + (f1-8 (- (-> v1-54 y) (-> a0-20 y))) + (f30-2 (if (< (fabs f1-8) (fabs f0-16)) + f0-16 + f1-8 + ) + ) + ) + (if (< (-> *math-camera* camera-rot vector 1 y) 0.0) + (set! f30-2 (- f30-2)) + ) + (let* ((s3-2 (-> arg0 length)) + (s2-2 0) + (s1-3 (-> arg0 data s2-2)) + ) + (while (< s2-2 s3-2) + (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) + (set! f0-18 (cond + ((-> arg0 move-lock?) + (-> arg0 move-speed) + ) + (else + (vector-! s5-2 (edit-get-trans s1-3) s4-2) + (let ((f0-21 (* 0.00390625 f30-2 (vector-length s5-2)))) + (set! f0-18 (fmax -40960.0 (fmin 40960.0 f0-21))) + ) + (set! (-> arg0 move-speed) f0-18) + (set! (-> arg0 move-lock?) #t) + f0-18 + ) + ) + ) + (set-vector! s5-2 0.0 f0-18 0.0 0.0) + (editable-method-15 s1-3 s5-2 56) + ) + (+! s2-2 1) + (set! s1-3 (-> arg0 data s2-2)) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + (((editable-command drag-move-z)) + (let ((v1-83 (-> arg2 level-offset)) + (a0-28 (-> arg2 edit-plane-normal)) + (s5-3 (new-stack-vector0)) + (s4-3 (-> *math-camera* trans)) + ) + 0.0 + (let* ((f0-27 (- (-> v1-83 x) (-> a0-28 x))) + (f1-15 (- (-> v1-83 y) (-> a0-28 y))) + (f30-3 (if (< (fabs f1-15) (fabs f0-27)) + f0-27 + f1-15 + ) + ) + ) + (if (>= (-> *math-camera* camera-rot vector 0 z) 0.0) + (set! f30-3 (- f30-3)) + ) + (let* ((s3-3 (-> arg0 length)) + (s2-3 0) + (s1-4 (-> arg0 data s2-3)) + ) + (while (< s2-3 s3-3) + (when (and s1-4 (logtest? (-> s1-4 flags) (editable-flag selected))) + (set! f0-29 (cond + ((-> arg0 move-lock?) + (-> arg0 move-speed) + ) + (else + (vector-! s5-3 (edit-get-trans s1-4) s4-3) + (let ((f0-32 (* 0.00390625 f30-3 (vector-length s5-3)))) + (set! (-> arg0 move-speed) f0-32) + (set! f0-29 (fmax -40960.0 (fmin 40960.0 f0-32))) + ) + (set! (-> arg0 move-lock?) #t) + f0-29 + ) + ) + ) + (set-vector! s5-3 0.0 0.0 f0-29 0.0) + (editable-method-15 s1-4 s5-3 56) + ) + (+! s2-3 1) + (set! s1-4 (-> arg0 data s2-3)) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + (((editable-command drag-move-xz)) + (let ((s5-4 (-> arg2 level-offset)) + (s4-4 (-> arg2 edit-plane-normal)) + (s3-4 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-4 x) 0.0) + (set! (-> s3-4 y) 1.0) + (set! (-> s3-4 z) 0.0) + (set! (-> s3-4 w) 1.0) + (let* ((s2-4 (new-stack-vector0)) + (s1-5 (-> arg0 length)) + (s0-6 0) + (a0-36 (-> arg0 data s0-6)) + ) + (while (< s0-6 s1-5) + (when (and a0-36 (logtest? (-> a0-36 flags) (editable-flag selected))) + (if (= (-> s2-4 w) 0.0) + (editable-method-20 a0-36 s5-4 s4-4 s3-4 s2-4) + (editable-method-15 a0-36 s2-4 56) + ) + ) + (+! s0-6 1) + (set! a0-36 (-> arg0 data s0-6)) + ) + ) + ) + (cleanup-selection arg0) + ) + (((editable-command drag-move-xy)) + (let ((s5-5 (-> arg2 level-offset)) + (s4-5 (-> arg2 edit-plane-normal)) + (s3-5 (-> *math-camera* inv-camera-rot vector 2)) + (s2-5 (new-stack-vector0)) + ) + (set! (-> s3-5 y) 0.0) + (vector-normalize! s3-5 1.0) + (let* ((s1-6 (-> arg0 length)) + (s0-7 0) + (a0-40 (-> arg0 data s0-7)) + ) + (while (< s0-7 s1-6) + (when (and a0-40 (logtest? (-> a0-40 flags) (editable-flag selected))) + (if (= (-> s2-5 w) 0.0) + (editable-method-20 a0-40 s5-5 s4-5 s3-5 s2-5) + (editable-method-15 a0-40 s2-5 56) + ) + ) + (+! s0-7 1) + (set! a0-40 (-> arg0 data s0-7)) + ) + ) + ) + (cleanup-selection arg0) + ) + (else + (return #f) + ) + ) + #t + ) + +(defun execute-move ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) + (case arg1 + (((editable-command drag-resize)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 x) (* 100.0 (- (-> arg2 edit-plane-normal x) (-> arg2 level-offset x)))) + (set! (-> s4-0 y) 0.0) + (set! (-> s4-0 z) 0.0) + (set! (-> s4-0 w) 1.0) + (let* ((s5-1 (-> arg0 length)) + (s3-0 0) + (a0-2 (-> arg0 data s3-0)) + ) + (while (< s3-0 s5-1) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (editable-method-17 a0-2 s4-0) + ) + (+! s3-0 1) + (set! a0-2 (-> arg0 data s3-0)) + ) + ) + ) + ) + (((editable-command refresh-filter)) + (let* ((s5-2 (-> arg0 length)) + (s4-1 0) + (s3-1 (-> arg0 data s4-1)) + ) + (while (< s4-1 s5-2) + (if (and s3-1 (-> s3-1 region)) + (set! (-> s3-1 region filter) (editable-region-method-12 (-> s3-1 region))) + ) + (+! s4-1 1) + (set! s3-1 (-> arg0 data s4-1)) + ) + ) + ) + (((editable-command resize)) + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 x) 0.0) + (set! (-> s5-3 y) (* 4096.0 (-> arg0 edit-param0))) + (set! (-> s5-3 z) 0.0) + (set! (-> s5-3 w) 1.0) + (let* ((s4-2 (-> arg0 length)) + (s3-2 0) + (a0-7 (-> arg0 data s3-2)) + ) + (while (< s3-2 s4-2) + (if (and a0-7 (logtest? (-> a0-7 flags) (editable-flag selected))) + (editable-method-17 a0-7 s5-3) + ) + (+! s3-2 1) + (set! a0-7 (-> arg0 data s3-2)) + ) + ) + ) + ) + (((editable-command insert-sphere)) + (let ((s4-3 (editable-array-method-11 arg0))) + (when (>= s4-3 0) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-3 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-4 (new 'debug 'editable-sphere a2-3 2048.0 (-> arg0 region))) + ) + (set! (-> arg0 data s4-3) s3-4) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-4 #t) + ) + ) + ) + ) + (((editable-command insert-point)) + (let ((s4-4 (editable-array-method-11 arg0))) + (when (>= s4-4 0) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-7 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-6 (new 'debug 'editable-point a2-7 (-> arg0 region))) + ) + (set! (-> arg0 data s4-4) s3-6) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-6 #t) + ) + ) + ) + ) + (((editable-command insert-sample)) + (let ((s4-5 (editable-array-method-11 arg0))) + (when (>= s4-5 0) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-11 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-8 (new 'debug 'editable-sample a2-11 *editable-sample-region*)) + ) + (set! (-> arg0 data s4-5) s3-8) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-8 #t) + ) + ) + ) + ) + (((editable-command insert-sample-camera)) + (let ((s4-6 (editable-array-method-11 arg0))) + (when (>= s4-6 0) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let ((s3-11 (new 'debug 'editable-sample (math-camera-pos) *editable-sample-region*))) + (set! (-> arg0 data s4-6) s3-11) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-11 #t) + ) + ) + ) + ) + (((editable-command insert-light)) + (let ((s4-7 (editable-array-method-11 arg0))) + (when (>= s4-7 0) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-18 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-13 (new 'debug 'editable-light a2-18 2048.0 *editable-light-region*)) + ) + (set! (-> arg0 data s4-7) s3-13) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-13 #t) + (editable-method-23 s3-13) + ) + (update-light-hash *light-hash*) + ) + ) + ) + (((editable-command insert-entity)) + (let ((s4-8 (editable-array-method-11 arg0))) + (when (>= s4-8 0) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-22 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-15 (new 'debug 'editable-entity a2-22 *editable-entity-region*)) + ) + (set! (-> arg0 data s4-8) s3-15) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-15 #t) + ) + ) + ) + ) + (((editable-command insert-box)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((a1-42 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal)))) + (insert-box arg0 a1-42) + ) + ) + (((editable-command insert-face)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((s4-11 (editable-array-method-11 arg0))) + 0 + (editable-array-method-14 + arg0 + (the-as + (function symbol) + (lambda ((arg0 editable) (arg1 symbol)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) + ) + (the-as symbol (-> arg0 region)) + ) + (let ((s5-5 (-> arg0 selection length))) + (cond + ((= s5-5 1) + (cond + ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) + (set! (-> arg0 selection 1) (-> arg0 target)) + (+! (-> arg0 selection length) 1) + (+! s5-5 1) + ) + (else + (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 33) "pick the point to complete the face") + (return #f) + ) + ) + ) + ((and (>= s5-5 2) (>= 6 s5-5)) + ) + (else + (format + 0 + "ERROR: face can only be inserted if there are 2-6 points selected in the current region, got ~D.~%" + s5-5 + ) + (return #f) + ) + ) + (when (>= s4-11 0) + (let ((s3-17 (new 'debug 'editable-face (-> arg0 region)))) + (set! (-> arg0 data s4-11) s3-17) + (dotimes (s4-12 s5-5) + (set! (-> s3-17 vertex s4-12) (the-as editable-point (-> arg0 selection s4-12))) + (set! (-> arg0 selection s4-12 owner) (cons s3-17 (-> arg0 selection s4-12 owner))) + ) + (set! (-> s3-17 length) s5-5) + (select-editable! s3-17 #t) + (editable-method-28 s3-17 (editable-filter load)) + (editable-method-29 s3-17 (editable-filter load)) + ) + ) + ) + ) + ) + (((editable-command insert-plane)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let ((s3-18 (editable-array-method-11 arg0))) + 0 + (editable-array-method-14 + arg0 + (the-as + (function symbol) + (lambda ((arg0 editable) (arg1 symbol)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) + ) + (the-as symbol (-> arg0 region)) + ) + (let ((s5-7 (-> arg0 selection length))) + (cond + ((= s5-7 1) + (cond + ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) + (set! (-> arg0 selection 1) (-> arg0 target)) + (+! (-> arg0 selection length) 1) + (+! s5-7 1) + ) + (else + (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 34) "pick the point to complete the plane") + (return #f) + ) + ) + ) + ((= s5-7 2) + ) + (else + (format + 0 + "ERROR: plane can only be inserted if there are 2 points selected in the current region, got ~D.~%" + s5-7 + ) + (return #f) + ) + ) + (when (>= s3-18 0) + (let ((s4-14 (new 'debug 'editable-plane (-> arg0 region)))) + (set! (-> arg0 data s3-18) s4-14) + (dotimes (s3-19 s5-7) + (set! (-> s4-14 vertex s3-19) (the-as editable-point (-> arg0 selection s3-19))) + (set! (-> arg0 selection s3-19 owner) (cons s4-14 (-> arg0 selection s3-19 owner))) + ) + (set! (-> s4-14 length) s5-7) + (select-editable! s4-14 #t) + (editable-method-28 s4-14 (editable-filter load)) + (editable-method-29 s4-14 (editable-filter load)) + ) + ) + ) + ) + ) + (else + (return #f) + ) + ) + #t + ) + +(defmethod editable-array-method-9 editable-array ((obj editable-array) (arg0 editable-command) (arg1 editable-array)) + (if (execute-select obj arg0 arg1) + (return #f) + ) + (if (execute-move obj arg0 arg1) + (return #f) + ) + (if (execute-mouse-move obj arg0 arg1) + (return #f) + ) + (cond + ((= arg0 (editable-command copy)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (set! (-> obj selection length) 0) + (let* ((s4-2 (-> obj length)) + (s3-1 0) + (s2-0 (-> obj data s3-1)) + ) + (while (< s3-1 s4-2) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (editable-method-27 s2-0 obj) + (when (= (-> s2-0 type) editable-light) + (editable-method-23 s2-0) + (update-light-hash *light-hash*) + ) + ) + (+! s3-1 1) + (set! s2-0 (-> obj data s3-1)) + ) + ) + (editable-array-method-9 obj (editable-command select-none) arg1) + (let ((s5-1 (the-as editable-region #f))) + (dotimes (s4-3 (-> obj selection length)) + (let ((a0-13 (-> obj selection s4-3))) + (when (and a0-13 (logtest? s4-3 1)) + (set! s5-1 (-> a0-13 region)) + (select-editable! a0-13 #t) + ) + ) + ) + (if (not (-> obj region-lock?)) + (set! (-> obj region) s5-1) + ) + ) + ) + ((= arg0 (editable-command copy-region)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (when (and (-> obj region) (not (-> obj region locked))) + (editable-array-method-9 obj (editable-command select-current-region) arg1) + (let ((v1-52 (copy (-> obj region) 'debug))) + (set! (-> v1-52 id) (the-as uint 0)) + (set! (-> v1-52 changed) #t) + (set! (-> obj region) v1-52) + ) + (editable-array-method-9 obj (editable-command copy) arg1) + ) + ) + ((= arg0 (editable-command delete)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((s5-3 (-> obj length)) + (s4-6 0) + (s3-3 (-> obj data s4-6)) + ) + (while (< s4-6 s5-3) + (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) + (editable-array-method-15 obj s3-3) + (when (= (-> s3-3 type) editable-light) + (editable-method-23 s3-3) + (update-light-hash *light-hash*) + ) + ) + (+! s4-6 1) + (set! s3-3 (-> obj data s4-6)) + ) + ) + (if (not (-> obj region-lock?)) + (set! (-> obj region) #f) + ) + ) + ((= arg0 (editable-command delete-region)) + (when (-> obj region) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (when (!= (-> obj region) *editable-light-region*) + (editable-array-method-9 obj (editable-command select-current-region) arg1) + (editable-array-method-9 obj (editable-command delete) arg1) + (set! (-> obj region) #f) + ) + ) + ) + ((= arg0 (editable-command snap-to-ground)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((s5-5 (new 'stack-no-clear 'vector)) + (s4-9 (-> obj length)) + (s3-5 0) + (s2-1 (-> obj data s3-5)) + ) + (while (< s3-5 s4-9) + (when (and s2-1 (logtest? (-> s2-1 flags) (editable-flag selected))) + (if (editable-method-11 s2-1 s5-5) + (editable-method-19 s2-1 s5-5) + ) + ) + (+! s3-5 1) + (set! s2-1 (-> obj data s3-5)) + ) + ) + ) + ((= arg0 (editable-command snap-y)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (cond + ((-> obj target) + (let* ((s5-7 (edit-get-trans (-> obj target))) + (s4-11 (-> obj length)) + (s3-6 0) + (a0-37 (-> obj data s3-6)) + ) + (while (< s3-6 s4-11) + (if (and a0-37 (logtest? (-> a0-37 flags) (editable-flag selected))) + (edit-coord! a0-37 s5-7 (editable-flag y no-plane-snap)) + ) + (+! s3-6 1) + (set! a0-37 (-> obj data s3-6)) + ) + ) + ) + (else + (editable-array-method-13 obj (the-as uint 14) (the-as basic 41) "pick the editable to use the y from") + ) + ) + ) + ((= arg0 (editable-command snap-xz)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (cond + ((-> obj target) + (let* ((s5-9 (edit-get-trans (-> obj target))) + (s4-13 (-> obj length)) + (s3-7 0) + (a0-41 (-> obj data s3-7)) + ) + (while (< s3-7 s4-13) + (if (and a0-41 (logtest? (-> a0-41 flags) (editable-flag selected))) + (edit-coord! a0-41 s5-9 (editable-flag x z no-plane-snap)) + ) + (+! s3-7 1) + (set! a0-41 (-> obj data s3-7)) + ) + ) + ) + (else + (editable-array-method-13 obj (the-as uint 14) (the-as basic 40) "pick the editable to use the xz from") + ) + ) + ) + ((= arg0 (editable-command region-set)) + (when (and (-> obj region) (not (-> obj region locked))) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((s5-11 (-> obj length)) + (s4-15 0) + (a0-44 (-> obj data s4-15)) + ) + (while (< s4-15 s5-11) + (if (and a0-44 (logtest? (-> a0-44 flags) (editable-flag selected))) + (editable-method-21 a0-44 (-> obj region)) + ) + (+! s4-15 1) + (set! a0-44 (-> obj data s4-15)) + ) + ) + ) + ) + ((= arg0 (editable-command region-add)) + (when (and (-> obj region) (not (-> obj region locked))) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (if (-> obj target) + (editable-method-21 (-> obj target) (-> obj region)) + (editable-array-method-13 obj (the-as uint 14) (the-as basic 49) "pick the editable to add to current region") + ) + ) + ) + ((= arg0 (editable-command region-new)) + (let ((v1-175 (new 'debug 'editable-region))) + (if (and (-> obj region) (not (-> obj region locked))) + (set! (-> v1-175 tree) (-> obj region tree)) + ) + (set! (-> obj region) v1-175) + ) + (editable-array-method-9 obj (editable-command region-set) arg1) + ) + ((= arg0 (editable-command flip-side)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((s5-14 (-> obj length)) + (s4-18 0) + (a0-58 (-> obj data s4-18)) + ) + (while (< s4-18 s5-14) + (if (and a0-58 (logtest? (-> a0-58 flags) (editable-flag selected))) + (editable-method-24 a0-58) + ) + (+! s4-18 1) + (set! a0-58 (-> obj data s4-18)) + ) + ) + ) + ((= arg0 (editable-command rotate-level)) + (let* ((f0-1 (* 182.04445 (-> obj edit-param0))) + (s5-15 (matrix-rotate-y! (new 'stack-no-clear 'matrix) f0-1)) + (s4-19 (-> obj length)) + (s3-8 0) + (a0-60 (-> obj data s3-8)) + ) + (while (< s3-8 s4-19) + (if (and a0-60 region (= (-> a0-60 region level) (-> obj level))) + (editable-method-18 a0-60 (-> obj level-offset) s5-15) + ) + (+! s3-8 1) + (set! a0-60 (-> obj data s3-8)) + ) + ) + ) + ((= arg0 (editable-command translate-y-level)) + (let ((s5-16 (new 'stack-no-clear 'vector))) + (set! (-> s5-16 x) 0.0) + (set! (-> s5-16 y) (* 4096.0 (-> obj edit-param0))) + (set! (-> s5-16 z) 0.0) + (set! (-> s5-16 w) 1.0) + (let* ((s4-20 (-> obj length)) + (s3-9 0) + (a0-61 (-> obj data s3-9)) + ) + (while (< s3-9 s4-20) + (if (and a0-61 region (= (-> a0-61 region level) (-> obj level))) + (editable-method-15 a0-61 s5-16 56) + ) + (+! s3-9 1) + (set! a0-61 (-> obj data s3-9)) + ) + ) + ) + ) + ((= arg0 (editable-command save)) + (let* ((s5-17 (-> obj length)) + (s4-21 0) + (v1-231 (-> obj data s4-21)) + ) + (while (< s4-21 s5-17) + (when (and v1-231 (-> v1-231 region)) + (let ((t9-53 (method-of-object (-> v1-231 region) editable-region-method-9))) + 0 + 0 + (t9-53) + ) + ) + (+! s4-21 1) + (set! v1-231 (-> obj data s4-21)) + ) + ) + (let ((t9-54 (method-of-object *editable-sample-region* editable-region-method-9))) + 0 + 0 + (t9-54) + ) + (let ((t9-55 (method-of-object *editable-light-region* editable-region-method-9))) + 0 + 0 + (t9-55) + ) + (let ((t9-56 (method-of-object *editable-entity-region* editable-region-method-9))) + 0 + 0 + (t9-56) + ) + ) + ((= arg0 (editable-command load)) + (editable-array-method-9 obj (editable-command select-none) arg1) + (dotimes (v1-248 (-> obj length)) + (set! (-> obj data v1-248) #f) + ) + (set! (-> obj length) 0) + (let* ((s5-18 obj) + (s4-22 (method-of-object s5-18 editable-array-method-12)) + (v1-253 (level-get-target-inside *level*)) + ) + (s4-22 s5-18 (the-as editable-array (if v1-253 + (-> v1-253 info dbname) + #f + ) + ) + ) + ) + (editable-array-method-9 obj (editable-command update-game) (the-as editable-array #f)) + ) + ((= arg0 (editable-command update-game)) + (let ((t9-61 reset-light-hash)) + *light-hash* + (t9-61) + ) + (let* ((s5-19 (-> obj length)) (s4-23 0) (a0-76 (-> obj data s4-23))) (while (< s4-23 s5-19) + (if a0-76 + (editable-method-23 a0-76) + ) + (+! s4-23 1) + (set! a0-76 (-> obj data s4-23)) + ) + ) + (update-light-hash *light-hash*) + ) + ((or (= arg0 (editable-command exit)) (= arg0 (editable-command kill))) + (deactivate self) + ) + ) + #f + ) + +(defmethod deactivate editable-player ((obj editable-player)) + (dotimes (v1-0 (-> *level* length)) + (let ((a1-3 (-> *level* level v1-0))) + (if (= (-> a1-3 status) 'active) + (set! (-> a1-3 light-hash) (-> a1-3 bsp light-hash)) + ) + ) + ) + (set! *editable* (the-as (pointer editable-player) #f)) + (set! *external-cam-mode* (-> obj external-cam-mode)) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; WARN: Return type mismatch process-drawable vs editable-player. +(defmethod relocate editable-player ((obj editable-player) (arg0 int)) + (let ((v1-0 *kernel-context*)) + (set! (-> v1-0 relocating-process) obj) + (set! (-> v1-0 relocating-min) (the-as int (&-> obj type))) + (set! (-> v1-0 relocating-max) + (the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj))) + ) + (set! (-> v1-0 relocating-offset) arg0) + ) + (let ((v1-2 (-> obj current))) + (if (and (>= (the-as int v1-2) (-> *kernel-context* relocating-min)) + (< (the-as int v1-2) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj current) arg0) + ) + ) + (the-as editable-player ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-player-method-21 editable-player ((obj editable-player)) + (set! *display-region-marks* #f) + (let* ((s5-0 (-> obj current length)) + (s4-0 0) + (a0-2 (-> obj current data s4-0)) + ) + (while (< s4-0 s5-0) + (if (and a0-2 (or (and (logtest? (-> a0-2 region filter) (-> obj current filter 0)) + (logtest? (-> a0-2 region filter) (-> obj current filter 1)) + ) + (logtest? (-> a0-2 flags) (editable-flag selected)) + ) + ) + (editable-method-10 a0-2) + ) + (+! s4-0 1) + (set! a0-2 (-> obj current data s4-0)) + ) + ) + (when #t + (format *stdcon* "~0K") + (format *stdcon* "~16S~16S~16S~%" "Left button" "Middle button" "Right button") + (format + *stdcon* + "~16S~16S~16S~%" + (editable-command->string + (the-as + editable-command + (if (and (nonzero? (-> obj command 1)) (or (zero? (-> obj command 0)) (logtest? (-> *mouse* button0-abs 0) 1))) + (-> obj command 1) + (-> obj command 0) + ) + ) + ) + (editable-command->string + (the-as + editable-command + (if (and (nonzero? (-> obj command 5)) (or (zero? (-> obj command 4)) (logtest? (-> *mouse* button0-abs 0) 4))) + (-> obj command 5) + (-> obj command 4) + ) + ) + ) + (editable-command->string + (the-as + editable-command + (if (and (nonzero? (-> obj command 3)) (or (zero? (-> obj command 2)) (logtest? (-> *mouse* button0-abs 0) 2))) + (-> obj command 3) + (-> obj command 2) + ) + ) + ) + ) + (let* ((s5-2 (-> obj current length)) + (s4-2 0) + (v1-35 (-> obj current data s4-2)) + ) + (while (< s4-2 s5-2) + (when (and v1-35 (logtest? (-> v1-35 flags) (editable-flag selected))) + (let ((s3-1 (-> v1-35 name))) + (if (not (string-prefix= "undefined" s3-1)) + (format *stdcon* "~s~%" s3-1) + ) + ) + ) + (+! s4-2 1) + (set! v1-35 (-> obj current data s4-2)) + ) + ) + (when (!= *master-mode* 'menu) + (let ((a2-5 (-> obj current target-message))) + (if a2-5 + (format *stdcon* "~%~3L~S~0L~%" a2-5) + ) + ) + (when (cpad-hold? 1 triangle) + (let* ((s5-3 (-> obj current length)) + (s4-3 0) + (a0-29 (-> obj current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and a0-29 + (or (and (logtest? (-> a0-29 region filter) (-> obj current filter 0)) + (logtest? (-> a0-29 region filter) (-> obj current filter 1)) + ) + (logtest? (-> a0-29 flags) (editable-flag selected)) + ) + ) + (if (and (-> a0-29 region) (!= (-> a0-29 type) editable-point)) + (editable-region-method-11 (-> a0-29 region) (edit-get-trans a0-29) (if (cpad-hold? 1 circle) + 1 + 0 + ) + ) + ) + ) + (+! s4-3 1) + (set! a0-29 (-> obj current data s4-3)) + ) + ) + (format *stdcon* "~%") + (cond + ((-> obj current region) + (let ((s5-4 (-> obj current region))) + (format + *stdcon* + "~%region: region-~D ~S ~S~S~%" + (-> s5-4 id) + (-> s5-4 level) + (-> s5-4 tree) + (if (-> s5-4 changed) + " (modified)" + "" + ) + ) + (format *stdcon* " (on-enter ~S)~%" (-> s5-4 on-enter)) + (format *stdcon* " (on-inside ~S)~%" (-> s5-4 on-inside)) + (format *stdcon* " (on-exit ~S)~%" (-> s5-4 on-exit)) + ) + ) + (else + (format *stdcon* "no region~%") + ) + ) + (when (-> obj current edit-plane) + (let ((a2-13 (-> obj current edit-plane))) + (format *stdcon* "~%edit-plane: ~A~%" a2-13) + ) + ) + (format *stdcon* "~%selected:~%") + (let* ((s5-5 (-> obj current length)) + (s4-4 0) + (a2-14 (-> obj current data s4-4)) + ) + (while (< s4-4 s5-5) + (if (and a2-14 (logtest? (-> a2-14 flags) (editable-flag selected))) + (format *stdcon* " ~A~%" a2-14) + ) + (+! s4-4 1) + (set! a2-14 (-> obj current data s4-4)) + ) + ) + ) + ) + (format *stdcon* "~1K~%") + ) + 0 + (none) + ) + +(defstate idle (editable-player) + :virtual #t + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 none)) + (let ((v1-0 arg2)) + (the-as + object + (cond + ((= v1-0 'execute) + (let ((a2-1 (-> arg3 param 0))) + (case a2-1 + ((28 27 35 29 31 32) + (editable-array-method-13 + (-> self current) + (the-as uint 15) + (the-as basic a2-1) + "click on the point to insert at (up target, down camera)" + ) + ) + ((51 1 47 36 55 56) + (if (not (-> self left-handed)) + (editable-array-method-13 + (-> self current) + (the-as uint 16) + (the-as basic a2-1) + "press x to confirm, square to cancel" + ) + (editable-array-method-13 + (-> self current) + (the-as uint 16) + (the-as basic a2-1) + "press down to confirm, left to cancel" + ) + ) + ) + (else + (editable-array-method-9 (-> self current) (the-as editable-command a2-1) (the-as editable-array *mouse*)) + ) + ) + ) + ) + ((= v1-0 'exit) + (deactivate self) + ) + ((= v1-0 'menu) + (set! v0-0 (the-as none (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0))))) + (set! (-> self close-menu-time) (the-as time-frame v0-0)) + v0-0 + ) + ((or (= v1-0 'on-enter) (= v1-0 'on-exit) (= v1-0 'on-inside)) + (let ((s4-0 (-> self current region))) + (when s4-0 + (let ((gp-1 (-> arg3 param 0))) + (set! (-> *syntax-context* got-error?) #f) + (eval! *syntax-context* (the-as structure gp-1)) + (when (not (-> *syntax-context* got-error?)) + (set! (-> s4-0 changed) #t) + (cond + ((= arg2 'on-enter) + (set! (-> s4-0 on-enter) (the-as string gp-1)) + ) + ((= arg2 'on-inside) + (set! (-> s4-0 on-inside) (the-as string gp-1)) + ) + ((= arg2 'on-exit) + (set! (-> s4-0 on-exit) (the-as string gp-1)) + ) + ) + ) + ) + (set! v0-0 (the-as none (editable-region-method-12 s4-0))) + (set! (-> s4-0 filter) (the-as editable-filter v0-0)) + v0-0 + ) + ) + ) + ((= v1-0 'select) + (let ((gp-2 (-> arg3 param 0))) + (editable-array-method-9 (-> self current) (editable-command select-none) (the-as editable-array #f)) + (let* ((s5-1 (-> self current length)) + (s4-1 0) + (a0-36 (-> self current data s4-1)) + ) + (while (< s4-1 s5-1) + (when (and a0-36 (or (and (logtest? (-> a0-36 region filter) (-> self current filter 0)) + (logtest? (-> a0-36 region filter) (-> self current filter 1)) + ) + (logtest? (-> a0-36 flags) (editable-flag selected)) + ) + ) + (when (and (-> a0-36 region) (= gp-2 (-> a0-36 region id))) + (set! (-> self current region) (-> a0-36 region)) + (select-editable! a0-36 #t) + ) + ) + (+! s4-1 1) + (set! a0-36 (-> self current data s4-1)) + ) + ) + ) + #f + ) + ((= v1-0 'name) + (let* ((s5-2 (-> self current length)) + (s4-2 0) + (s3-0 (-> self current data s4-2)) + ) + (while (< s4-2 s5-2) + (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) + (let ((v1-60 (if (type? s3-0 editable) + s3-0 + ) + ) + ) + (when v1-60 + (set! (-> v1-60 name) (the-as string (-> arg3 param 0))) + (logior! (-> v1-60 flags) (editable-flag changed)) + (let ((v1-61 (-> v1-60 region))) + (if v1-61 + (set! (-> v1-61 changed) #t) + ) + ) + ) + ) + ) + (+! s4-2 1) + (set! s3-0 (-> self current data s4-2)) + ) + ) + #f + ) + ((= v1-0 'level) + (let ((gp-3 (lookup-level-info (the-as symbol (-> arg3 param 0))))) + (when (-> gp-3 dbname) + (let* ((s5-3 (-> self current length)) + (s4-3 0) + (s3-1 (-> self current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) + (let ((v1-73 (if (type? s3-1 editable) + s3-1 + ) + ) + ) + (when (and v1-73 (-> v1-73 region)) + (set! (-> v1-73 region level) (the-as string (-> gp-3 dbname))) + (set! (-> v1-73 region changed) #t) + ) + ) + ) + (+! s4-3 1) + (set! s3-1 (-> self current data s4-3)) + ) + ) + #f + ) + ) + ) + ((= v1-0 'get-level) + (-> self current level) + ) + ((= v1-0 'direction) + (let* ((f30-0 (the-as float (-> arg3 param 0))) + (f28-0 (the-as float (-> arg3 param 1))) + (f26-0 (the-as float (-> arg3 param 2))) + (f24-0 (if (and (zero? (-> arg3 param 0)) (zero? (-> arg3 param 1)) (zero? (-> arg3 param 2))) + 0.0 + 1.0 + ) + ) + (gp-4 (-> self current length)) + (s5-4 0) + (s4-4 (-> self current data s5-4)) + ) + (while (< s5-4 gp-4) + (when (and s4-4 (logtest? (-> s4-4 flags) (editable-flag selected))) + (let ((s3-2 (if (type? s4-4 editable-light) + (the-as editable-light s4-4) + ) + ) + ) + (when s3-2 + (set-vector! (-> s3-2 direction) f30-0 f28-0 f26-0 f24-0) + (vector-normalize! (-> s3-2 direction) 1.0) + (logior! (-> s3-2 flags) (editable-flag changed)) + (let ((a0-73 (-> s3-2 region))) + (if a0-73 + (set! (-> a0-73 changed) #t) + ) + ) + ) + ) + ) + (+! s5-4 1) + (set! s4-4 (-> self current data s5-4)) + ) + ) + #f + ) + ((= v1-0 'color) + (let* ((f30-1 (the-as float (-> arg3 param 0))) + (f28-1 (the-as float (-> arg3 param 1))) + (f26-1 (the-as float (-> arg3 param 2))) + (f24-1 (the-as float (-> arg3 param 3))) + (gp-5 (-> self current length)) + (s5-5 0) + (s4-5 (-> self current data s5-5)) + ) + (while (< s5-5 gp-5) + (when (and s4-5 (logtest? (-> s4-5 flags) (editable-flag selected))) + (let ((v1-114 (if (type? s4-5 editable-light) + (the-as editable-light s4-5) + ) + ) + ) + (when v1-114 + (set-vector! (-> v1-114 color) f30-1 f28-1 f26-1 f24-1) + (logior! (-> v1-114 flags) (editable-flag changed)) + (let ((v1-115 (-> v1-114 region))) + (if v1-115 + (set! (-> v1-115 changed) #t) + ) + ) + ) + ) + ) + (+! s5-5 1) + (set! s4-5 (-> self current data s5-5)) + ) + ) + #f + ) + ((= v1-0 'param) + (let ((s5-6 (-> arg3 param 0)) + (f30-2 (the-as float (-> arg3 param 1))) + ) + (when (and (>= (the-as int s5-6) 0) (>= 2 (the-as int s5-6))) + (let* ((gp-6 (-> self current length)) + (s4-6 0) + (s3-3 (-> self current data s4-6)) + ) + (while (< s4-6 gp-6) + (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) + (let ((v1-129 (if (type? s3-3 editable-light) + s3-3 + ) + ) + ) + (when v1-129 + (set! (-> (the-as editable-light (+ (* s5-6 4) (the-as uint v1-129))) decay-start) f30-2) + (logior! (-> v1-129 flags) (editable-flag changed)) + (let ((v1-130 (-> v1-129 region))) + (if v1-130 + (set! (-> v1-130 changed) #t) + ) + ) + ) + ) + ) + (+! s4-6 1) + (set! s3-3 (-> self current data s4-6)) + ) + ) + #f + ) + ) + ) + ) + ) + ) + ) + :trans (behavior () + (let ((gp-0 (-> self current))) + (set! (-> gp-0 move-lock?) #f) + (when (cpad-pressed? 1 start) + (when (!= *master-mode* 'menu) + (set-master-mode 'menu) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons start)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons start)) + ) + ) + (when (or (and (= *master-mode* 'menu) + (> (-> self close-menu-time) 0) + (>= (-> self clock frame-counter) (-> self close-menu-time)) + ) + (cpad-pressed? 1 start) + ) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (set-master-mode 'game) + (set! (-> self close-menu-time) 0) + 0 + ) + (debug-menus-handler *editable-menu-context*) + (set-setting! 'cpad1-skip-buttons 'abs #t 0) + (set-setting! 'mouse-input 'abs #f 0) + (when (!= *master-mode* 'menu) + (cond + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 left) (not (-> self left-handed))) (and (cpad-hold? 1 square) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 48)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 47)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 49)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 right) (not (-> self left-handed))) (and (cpad-hold? 1 circle) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 52)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 36)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 37)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 6)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 53)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 42)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 down) (not (-> self left-handed))) (and (cpad-hold? 1 x) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 29)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 30)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 32)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (set! (-> self command 0) (the-as function 0)) + (set! (-> self command 1) (the-as function 24)) + (set! (-> self command 2) (the-as function 0)) + (set! (-> self command 3) (the-as function 26)) + (set! (-> self command 4) (the-as function 0)) + (set! (-> self command 5) (the-as function 25)) + ) + ((and (cpad-hold? 1 up) + (cpad-hold? 1 left) + (or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 3)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 9)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 8)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((or (and (cpad-hold? 1 left) (not (-> self left-handed))) (and (cpad-hold? 1 square) (-> self left-handed))) + (set! (-> self command 0) (the-as function 0)) + (set! (-> self command 1) (the-as function 20)) + (set! (-> self command 2) (the-as function 0)) + (set! (-> self command 3) (the-as function 22)) + (set! (-> self command 4) (the-as function 0)) + (set! (-> self command 5) (the-as function 21)) + ) + ((or (and (cpad-hold? 1 right) (not (-> self left-handed))) (and (cpad-hold? 1 circle) (-> self left-handed))) + (set! (-> self command 0) (the-as function 31)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 27)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 28)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) + (set! (-> self command 0) (the-as function 3)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 4)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 7)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((or (and (cpad-hold? 1 down) (not (-> self left-handed))) (and (cpad-hold? 1 x) (-> self left-handed))) + (set! (-> self command 0) (the-as function 33)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 35)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 34)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + (else + (set! (-> self command 0) (the-as function 0)) + (set! (-> self command 1) (the-as function 18)) + (set! (-> self command 2) (the-as function 0)) + (set! (-> self command 3) (the-as function 23)) + (set! (-> self command 4) (the-as function 0)) + (set! (-> self command 5) (the-as function 19)) + ) + ) + (case (-> self current target-mode) + ((14 15) + (set! (-> self command 0) (the-as function (-> self current target-mode))) + ) + ((16) + (when (!= *master-mode* 'menu) + (cond + ((not (-> self left-handed)) + (cond + ((cpad-hold? 1 x) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons x)) + (editable-array-method-9 + gp-0 + (the-as editable-command (-> self current target-mode)) + (the-as editable-array *mouse*) + ) + ) + ((cpad-pressed? 1 square) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons square)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons square)) + (editable-array-method-9 gp-0 (editable-command cancel) (the-as editable-array *mouse*)) + ) + ) + ) + (else + (cond + ((cpad-hold? 1 down) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons down)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons down)) + (editable-array-method-9 + gp-0 + (the-as editable-command (-> self current target-mode)) + (the-as editable-array *mouse*) + ) + ) + ((cpad-pressed? 1 left) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons left)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons left)) + (editable-array-method-9 gp-0 (editable-command cancel) (the-as editable-array *mouse*)) + ) + ) + ) + ) + ) + ) + ) + (if (logtest? (-> *mouse* button0-rel 0) 1) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 0)) (the-as editable-array *mouse*)) + ) + (if (logtest? (-> *mouse* button0-abs 0) 1) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 1)) (the-as editable-array *mouse*)) + ) + (if (logtest? (-> *mouse* button0-rel 0) 2) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 2)) (the-as editable-array *mouse*)) + ) + (if (logtest? (-> *mouse* button0-abs 0) 2) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 3)) (the-as editable-array *mouse*)) + ) + (when (logtest? (-> *mouse* button0-rel 0) 4) + (let ((a2-11 (-> self command 4))) + (case a2-11 + ((36) + (if (not (-> self left-handed)) + (editable-array-method-13 gp-0 (the-as uint 16) a2-11 "press x to confirm, square to cancel") + (editable-array-method-13 gp-0 (the-as uint 16) a2-11 "press down to confirm, left to cancel") + ) + ) + (else + (editable-array-method-9 gp-0 (the-as editable-command a2-11) (the-as editable-array *mouse*)) + ) + ) + ) + ) + (if (logtest? (-> *mouse* button0-abs 0) 4) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 5)) (the-as editable-array *mouse*)) + ) + ) + ) + (none) + ) + :code (behavior () + (until #f + (suspend) + ) + #f + (none) + ) + :post (behavior () + (editable-player-method-21 self) + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior editable-player-init editable-player ((arg0 symbol)) + (set! *editable-temp-id* 0) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + (set! *display-actor-marks* #f) + (logclear! (-> self mask) (process-mask freeze pause menu)) + (set! (-> self clock) (-> *display* real-clock)) + (set! (-> self current) (new 'debug 'editable-array 4096)) + (add-setting! 'mouse #t 0 0) + (add-setting! 'cursor #t 0 0) + (set! (-> self select-command) (the-as function 3)) + (set! (-> self move-command) (the-as function 18)) + (set! (-> self extra-command) (the-as function 23)) + (set! (-> self left-handed) #f) + (set! (-> self light-names) #f) + (set! (-> self command 0) (-> self select-command)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 0)) + (set! (-> self command 3) (-> self extra-command)) + (set! (-> self command 4) (the-as function 0)) + (set! (-> self command 5) (-> self move-command)) + (let* ((s5-0 (-> self current)) + (s4-0 (method-of-object s5-0 editable-array-method-12)) + (s3-0 (if arg0 + (lookup-level-info arg0) + ) + ) + (gp-1 (level-get-target-inside *level*)) + (a1-5 (cond + (s3-0 + (let ((gp-2 (level-get *level* (-> s3-0 dbname)))) + (when gp-2 + (format 0 "setting level~d ~s to *light-hash*~%" (-> gp-2 index) (-> gp-2 name)) + (set! (-> gp-2 light-hash) *light-hash*) + ) + ) + (-> s3-0 dbname) + ) + (gp-1 + (let ((s3-1 (level-get *level* (-> gp-1 info dbname)))) + (when s3-1 + (format 0 "setting level~d ~s to *light-hash*~%" (-> s3-1 index) (-> s3-1 name)) + (set! (-> s3-1 light-hash) *light-hash*) + ) + ) + (-> gp-1 info dbname) + ) + ) + ) + ) + (s4-0 s5-0 (the-as editable-array a1-5)) + ) + (set! *editable* (the-as (pointer editable-player) (process->ppointer self))) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (set! (-> self external-cam-mode) *external-cam-mode*) + (set! *external-cam-mode* 'pad-1) + (editable-array-method-9 (-> self current) (editable-command update-game) (the-as editable-array #f)) + (go-virtual idle) + (none) + ) + +(define *editable-menu-context* (new 'debug 'debug-menu-context)) + +(set! (-> *editable-menu-context* joypad-number) 1) + +;; WARN: Return type mismatch object vs none. +(defun editable-menu-command ((arg0 int)) + (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) + (send-event (ppointer->process *editable*) 'menu 90) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defun editable-menu-command-no-close ((arg0 int)) + (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) + (none) + ) + +;; WARN: Return type mismatch object vs symbol. +(defun dm-region-tree-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (when (and *editable* (-> *editable* 0 current region)) + (let ((s5-0 (-> *editable* 0 current region))) + (set! (-> s5-0 tree) (the-as string arg0)) + (set! (-> s5-0 changed) #t) + (set! (-> s5-0 filter) (editable-region-method-12 s5-0)) + ) + ) + ) + (the-as + symbol + (and *editable* (-> *editable* 0 current region) (= arg0 (-> *editable* 0 current region tree))) + ) + ) + +(defun dm-editable-flag-pick-func ((arg0 editable-flag) (arg1 debug-menu-msg)) + (when *editable* + (let ((gp-0 (/ (the-as int arg0) 8))) + (editable-array-method-14 (-> *editable* 0 current) true-func #f) + (when (= arg1 (debug-menu-msg press)) + (let* ((v1-10 (-> *editable* 0 current length)) + (a0-2 0) + (a1-4 (-> *editable* 0 current data a0-2)) + ) + (while (< a0-2 v1-10) + (if (and a1-4 (logtest? (-> a1-4 flags) (editable-flag selected))) + (logxor! (-> a1-4 flags) (the-as uint gp-0)) + ) + (+! a0-2 1) + (set! a1-4 (-> *editable* 0 current data a0-2)) + ) + ) + ) + (and (>= (-> *editable* 0 current selection length) 1) + (logtest? (-> *editable* 0 current selection 0 flags) gp-0) + ) + ) + ) + ) + +(defun dm-editable-filter0-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) + (when *editable* + (let ((v1-1 (/ (the-as int arg0) 8))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *editable* 0 current filter 0) (the-as uint v1-1)) + ) + (logtest? (-> *editable* 0 current filter 0) v1-1) + ) + ) + ) + +(defun dm-editable-filter1-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) + (when *editable* + (let ((v1-1 (/ (the-as int arg0) 8))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *editable* 0 current filter 1) (the-as uint v1-1)) + ) + (logtest? (-> *editable* 0 current filter 1) v1-1) + ) + ) + ) + +;; ERROR: failed type prop at 36: add failed: editable uint + +;; WARN: Return type mismatch symbol vs object. + +(defun dm-cam-externalize2 ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (cond + ((= arg0 'reset) + (if (!= *external-cam-mode* 'locked) + (external-cam-reset!) + ) + ) + ((= arg0 'allow-z) + (set! *external-cam-options* (logxor *external-cam-options* (external-cam-option allow-z))) + ) + ((= *external-cam-mode* arg0) + (set! *external-cam-mode* #f) + ) + (else + (if (not *external-cam-mode*) + (external-cam-reset!) + ) + (set! *external-cam-mode* arg0) + ) + ) + ) + (if (= arg0 'allow-z) + (logtest? *external-cam-options* (external-cam-option allow-z)) + (= *external-cam-mode* arg0) + ) + ) + +;; ERROR: failed type prop at 5: add failed: editable-player int + + +;; ERROR: function was not converted to expressions. Cannot decompile. + +(editable-menu-context-make-menus *editable-menu-context*) + +;; WARN: Return type mismatch int vs none. +;; WARN: Function insert-sample-camera has a return type of none, but the expression builder found a return statement. +(defun insert-sample-camera ((arg0 symbol)) + (cond + (level + (let ((s5-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" + arg0 + ) + (let ((s5-1 (s5-0 *temp-string*))) + (cond + ((and (= (-> s5-1 error) 'select) (= (-> s5-1 len) 4)) + (let ((f26-0 (* 4096.0 (string->float (the-as string (-> s5-1 data 0))))) + (f28-0 (* 4096.0 (string->float (the-as string (-> s5-1 data 1))))) + (f30-3 (* 4096.0 (string->float (the-as string (-> s5-1 data 2))))) + (s5-2 (string->int (the-as string (-> s5-1 data 3)))) + (s3-0 (math-camera-pos)) + (s4-1 (clear *temp-string*)) + ) + (format + s4-1 + "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" + s5-2 + (* 0.00024414062 (- (-> s3-0 x) f26-0)) + (* 0.00024414062 (- (-> s3-0 y) f28-0)) + (* 0.00024414062 (- (-> s3-0 z) f30-3)) + ) + (let ((a2-2 (sql-query s4-1))) + (cond + ((= (-> a2-2 error) 'modify) + (format + (clear s4-1) + "update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D" + s5-2 + ) + (let ((a2-4 (sql-query s4-1))) + (when (!= (-> a2-4 error) 'modify) + (format 0 "ERROR: sql: modify error ~A~%" a2-4) + (return #f) + ) + ) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (format #t "EDITABLE: saved camera sample point for level ~A~%" arg0) + ) + (else + (format 0 "ERROR: sql: insert error ~A~%" a2-2) + ) + ) + ) + ) + ) + (else + (format 0 "ERROR: sql: select error ~A~%" s5-1) + ) + ) + ) + ) + ) + (else + (format 0 "ERROR: EDITABLE: no current level~%") + ) + ) + 0 + (none) + ) + +(define *debug-hook* (cons + (lambda () + (when (and *debug-segment* *manual-sample-point*) + (when (cpad-pressed? 1 select) + (cond + (*editable* + ) + ((not *artist-fix-visible*) + (insert-sample-camera (-> (level-get-target-inside *level*) info dbname)) + ) + (else + (dotimes (gp-1 (-> *level* length)) + (let ((v1-14 (-> *level* level gp-1))) + (when (= (-> v1-14 status) 'active) + (if (zero? (logand *fix-visible-level-mask* (ash 1 (-> v1-14 index)))) + (insert-sample-camera (-> v1-14 name)) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + *debug-hook* + ) + ) + +) + + + diff --git a/goal_src/jak2/engine/debug/editable.gc b/goal_src/jak2/engine/debug/editable.gc index d78569e5f6..3e557ad9e2 100644 --- a/goal_src/jak2/engine/debug/editable.gc +++ b/goal_src/jak2/engine/debug/editable.gc @@ -5,5 +5,1751 @@ ;; name in dgo: editable ;; dgos: ENGINE, GAME +;; og:ignore-form:editable-face-method-27 +;; og:ignore-form:editable-face-method-29 +;; og:ignore-form:editable-plane-method-27 +;; og:ignore-form:editable-array-method-12 +;; og:ignore-form:defmethod edit-get-distance editable-face +;; og:ignore-form:defmethod edit-get-distance editable-plane + ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +(defmethod new editable-region ((allocation symbol) (type-to-make type)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 changed) #t) + (set! (-> gp-0 locked) #f) + (let ((v1-4 (level-get-target-inside *level*))) + (set! (-> gp-0 level) (the-as string (if v1-4 + (-> v1-4 info dbname) + ) + ) + ) + ) + (set! (-> gp-0 tree) (the-as string 'camera)) + (set! (-> gp-0 on-enter) #f) + (set! (-> gp-0 on-exit) #f) + (set! (-> gp-0 on-inside) #f) + (set! (-> gp-0 filter) (editable-region-method-12 gp-0)) + gp-0 + ) + ) + +(defmethod print editable-region ((obj editable-region)) + (format #t "#<~A region-~D ~A ~A @ #x~X>" (-> obj type) (-> obj id) (-> obj level) (-> obj tree) obj) + obj + ) + +(defmethod editable-region-method-10 editable-region ((obj editable-region) (arg0 int)) + (local-vars (sv-16 string) (sv-32 string)) + (when (nonzero? (-> obj id)) + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "delete from region_sphere where region_id=~D" (-> obj id)) + (let ((a2-1 (sql-query s5-0))) + (when (!= (-> a2-1 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 obj) + (return #t) + ) + ) + (clear s5-0) + (format s5-0 "select region_face_id from region_face where region_id=~D" (-> obj id)) + (let ((s3-0 (sql-query s5-0))) + (when (!= (-> s3-0 error) 'select) + (format 0 "ERROR: sql: face select error ~A for ~A~%" s3-0 obj) + (return #t) + ) + (when (> (-> s3-0 len) 0) + (clear s5-0) + (format s5-0 "delete from region_point where region_face_id in (") + (dotimes (s2-0 (-> s3-0 len)) + (cond + ((zero? s2-0) + (let ((s1-0 format) + (s0-0 s5-0) + ) + (set! sv-16 "~D") + (let ((a2-4 (string->int (the-as string (-> s3-0 data s2-0))))) + (s1-0 s0-0 sv-16 a2-4) + ) + ) + ) + (else + (let ((s1-1 format) + (s0-1 s5-0) + ) + (set! sv-32 ",~D") + (let ((a2-5 (string->int (the-as string (-> s3-0 data s2-0))))) + (s1-1 s0-1 sv-32 a2-5) + ) + ) + ) + ) + ) + (format s5-0 ")") + (let ((a2-6 (sql-query s5-0))) + (when (!= (-> a2-6 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-6 obj) + (return #t) + ) + ) + ) + ) + (clear s5-0) + (format s5-0 "delete from region_face where region_id=~D" (-> obj id)) + (let ((a2-8 (sql-query s5-0))) + (when (!= (-> a2-8 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-8 obj) + (return #t) + ) + ) + (when (zero? arg0) + (clear s5-0) + (format s5-0 "delete from region where region_id=~D" (-> obj id)) + (let ((a2-10 (sql-query s5-0))) + (when (!= (-> a2-10 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-10 obj) + (return #t) + ) + ) + ) + ) + ) + #f + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; WARN: Return type mismatch int vs none. +(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 bucket-318) arg0 (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0))) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 318) + ) + (format (clear *temp-string*) "region-~D~%" (-> obj id)) + (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* arg0 (font-color one) sv-32) + ) + (set! (-> sv-32 y) (the-as int (+ (-> sv-32 y) 8))) + (when (>= arg1 1) + (let ((s4-1 (-> obj on-enter))) + (when s4-1 + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 318) + ) + (format (clear *temp-string*) "(on-enter ~S)" s4-1) + (s3-1 s2-1 (the-as bucket-id s1-1) *temp-string* arg0 (font-color one) sv-32) + ) + (set! (-> sv-32 y) (the-as int (+ (-> sv-32 y) 8))) + ) + ) + (let ((s4-2 (-> obj on-inside))) + (when s4-2 + (let ((s3-2 add-debug-text-3d) + (s2-2 #t) + (s1-2 318) + ) + (format (clear *temp-string*) "(on-inside ~S)" s4-2) + (s3-2 s2-2 (the-as bucket-id s1-2) *temp-string* arg0 (font-color one) sv-32) + ) + (set! (-> sv-32 y) (the-as int (+ (-> sv-32 y) 8))) + ) + ) + (let ((s5-1 (-> obj on-exit))) + (when s5-1 + (let ((s4-3 add-debug-text-3d) + (s3-3 #t) + (s2-3 318) + ) + (format (clear *temp-string*) "(on-exit ~S)" s5-1) + (s4-3 s3-3 (the-as bucket-id s2-3) *temp-string* arg0 (font-color one) sv-32) + ) + (set! (-> sv-32 y) (the-as int (+ (-> sv-32 y) 8))) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs editable-filter. +(defmethod editable-region-method-12 editable-region ((obj editable-region)) + (let* ((s5-0 0) + (s4-0 (lambda ((arg0 string)) (let ((gp-0 0)) + (when (not (type? arg0 string)) + (format (clear *temp-string*) "~A" arg0) + (set! arg0 *temp-string*) + ) + (if (>= (string-position "(sound-play" arg0) 0) + (set! gp-0 (logior gp-0 4)) + ) + (if (>= (string-position "(part-tracker" arg0) 0) + (set! gp-0 (logior gp-0 8)) + ) + (if (>= (string-position "(want-" arg0) 0) + (set! gp-0 (logior gp-0 64)) + ) + (if (>= (string-position "(setting-" arg0) 0) + (set! gp-0 (logior gp-0 16)) + ) + (if (>= (string-position "(water" arg0) 0) + (set! gp-0 (logior gp-0 128)) + ) + gp-0 + ) + ) + ) + (v0-3 + (logior (logior (logior s5-0 (s4-0 (-> obj on-inside))) (s4-0 (-> obj on-enter))) (s4-0 (-> obj on-exit))) + ) + ) + (when (zero? v0-3) + (if (and (not (-> obj on-inside)) (not (-> obj on-enter)) (not (-> obj on-exit))) + (set! v0-3 1) + (set! v0-3 2) + ) + ) + (case (-> obj tree) + (('target) + (set! v0-3 (logior v0-3 512)) + ) + (('camera) + (set! v0-3 (logior v0-3 256)) + ) + (('data) + (set! v0-3 (logior v0-3 2048)) + ) + (('water) + (set! v0-3 (logior v0-3 1024)) + ) + (('city_vis) + (set! v0-3 4096) + ) + (('sample) + (set! v0-3 8192) + ) + (('light) + (set! v0-3 #x4000) + ) + (('entity) + (set! v0-3 #x8000) + ) + ) + (the-as editable-filter v0-3) + ) + ) + +(defmethod editable-method-23 editable ((obj editable)) + #t + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-28 editable ((obj editable) (arg0 editable-filter)) + (let* ((s5-0 (-> obj owner)) (a0-1 (car s5-0))) (while (not (null? s5-0)) + (editable-method-28 (the-as editable a0-1) arg0) + (set! s5-0 (cdr s5-0)) + (set! a0-1 (car s5-0)) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs symbol. +(defmethod editable-method-29 editable ((obj editable) (arg0 editable-filter)) + (let* ((s5-0 (-> obj owner)) (a0-1 (car s5-0))) (while (not (null? s5-0)) + (editable-method-29 (the-as editable a0-1) arg0) + (set! s5-0 (cdr s5-0)) + (set! a0-1 (car s5-0)) + ) + ) + (the-as symbol 0) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-21 editable ((obj editable) (arg0 editable-region)) + (when (not (and (-> obj region) (-> obj region locked))) + (if arg0 + (set! (-> arg0 changed) #t) + ) + (if (-> obj region) + (set! (-> obj region changed) #t) + ) + (logior! (-> obj flags) (editable-flag changed)) + (set! (-> obj region) arg0) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs rgba. +(defmethod get-color editable ((obj editable) (arg0 int)) + "Returns the [[rgba]] that corresponds to the type of [[editable]] TODO - document the colors" + (the-as rgba (cond + ((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)) + ) + ((logtest? (-> obj flags) (editable-flag no-save)) + (shl #x80ff 16) + ) + ((= (-> obj type) editable-point) + (the-as int (-> (new 'static 'array uint64 1 #x800080ff) 0)) + ) + ((= (-> obj type) editable-sample) + (the-as int (-> (new 'static 'array uint64 1 #x80ff8000) 0)) + ) + ((= (-> obj type) editable-light) + (the-as int (-> (new 'static 'array uint64 1 #x80ff0080) 0)) + ) + ((= (-> obj type) editable-entity) + (the-as int (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + ) + (else + (the-as int (-> (new 'static 'array uint64 1 #x800000ff) 0)) + ) + ) + ) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-10 editable ((obj editable)) + (when (logtest? (-> obj flags) (editable-flag selected)) + (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 bucket-318) s5-0 (the-as rgba (-> (new 'static 'array uint64 1 #x80ffffff) 0))) + ) + ) + (add-debug-x + #t + (bucket-id bucket-318) + (edit-get-trans obj) + (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod select-editable! editable ((obj editable) (arg0 symbol)) + (case arg0 + (('toggle) + (logxor! (-> obj flags) (editable-flag selected)) + ) + ((#f) + (logclear! (-> obj flags) (editable-flag selected)) + ) + (else + (logior! (-> obj flags) (editable-flag selected)) + ) + ) + 0 + (none) + ) + +(defmethod edit-get-distance editable ((obj editable) (arg0 vector)) + "Returns the distance from the camera to the [[editable]], or -1.0" + -1.0 + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-20 editable ((obj editable) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (local-vars (sv-48 vector) (sv-52 vector)) + (set! sv-48 (new 'stack-no-clear 'vector)) + (set! sv-52 (new 'stack-no-clear 'vector)) + (let ((s4-0 (edit-get-trans obj))) + (reverse-transform-point! sv-48 s4-0 arg2 arg0) + (reverse-transform-point! sv-52 s4-0 arg2 arg1) + (vector-! arg3 sv-52 sv-48) + (vector-! (new 'stack-no-clear 'vector) s4-0 (-> *math-camera* trans)) + ) + (if (< 20480.0 (vector-length arg3)) + (vector-normalize! arg3 20480.0) + ) + (editable-method-15 obj arg3 56) + 0 + (none) + ) + +(defmethod editable-method-11 editable ((obj editable) (arg0 vector)) + (with-pp + (let ((s5-0 (new 'stack 'collide-query))) + (set! (-> s5-0 start-pos quad) (-> (edit-get-trans obj) quad)) + (set-vector! (-> s5-0 move-dist) 0.0 -204800.0 0.0 1.0) + (let ((v1-5 s5-0)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) + (collide-spec backgnd crate obstacle hit-by-player-list hit-by-others-list collectable pusher) + ) + (set! (-> v1-5 ignore-process0) pp) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) + (set! (-> arg0 quad) (-> s5-0 best-other-tri intersect quad)) + #t + ) + ) + ) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-24 editable ((obj editable)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 editable ((obj editable) (arg0 vector)) + 0 + (none) + ) + +(defmethod editable-method-22 editable ((obj editable) (arg0 editable-array) (arg1 int) (arg2 int)) + #t + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-15 editable ((obj editable) (arg0 vector) (arg1 int)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod edit-coord! editable ((obj editable) (arg0 vector) (arg1 editable-flag)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-18 editable ((obj editable) (arg0 vector) (arg1 matrix)) + 0 + (none) + ) + +(defmethod edit-get-trans editable ((obj editable)) + "Returns the `trans` [[vector]] or [[*null-vector*]]" + *null-vector* + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-19 editable ((obj editable) (arg0 vector)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-26 editable ((obj editable) (arg0 editable) (arg1 editable-array)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-25 editable ((obj editable) (arg0 editable-array)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (let* ((s4-0 (-> obj owner)) (a0-3 (car s4-0))) (while (not (null? s4-0)) + (editable-method-26 (the-as editable a0-3) obj arg0) + (set! s4-0 (cdr s4-0)) + (set! a0-3 (car s4-0)) + ) + ) + 0 + (none) + ) + +(defmethod editable-method-27 editable ((obj editable) (arg0 editable-array)) + (local-vars (s4-0 editable)) + (let ((v1-0 0)) + (while (< v1-0 (-> arg0 selection length)) + (when (= obj (-> arg0 selection v1-0)) + (set! s4-0 (-> arg0 selection (+ v1-0 1))) + (goto cfg-10) + ) + (+! v1-0 2) + ) + ) + (let ((s3-0 (editable-array-method-11 arg0))) + (set! s4-0 (when (>= s3-0 0) + (set! s4-0 (copy obj 'debug)) + (let ((v1-9 (-> arg0 region))) + (if v1-9 + (set! (-> s4-0 region) v1-9) + ) + ) + (set! (-> s4-0 region changed) #t) + (logior! (-> obj flags) (editable-flag changed)) + (set! (-> s4-0 id) (the-as uint 0)) + (set! (-> s4-0 owner) '()) + (select-editable! s4-0 #f) + (let ((s2-0 (new 'debug 'string 32 (the-as string #f)))) + (format s2-0 "undefined-~d" *editable-temp-id*) + (set! (-> s4-0 name) s2-0) + ) + (set! *editable-temp-id* (+ *editable-temp-id* 1)) + (set! (-> arg0 data s3-0) s4-0) + (set! (-> arg0 selection (-> arg0 selection length)) obj) + (set! (-> arg0 selection (+ (-> arg0 selection length) 1)) s4-0) + (+! (-> arg0 selection length) 2) + s4-0 + ) + ) + ) + (label cfg-10) + s4-0 + ) + +(defmethod print editable-point ((obj editable-point)) + (format + #t + "#<~A~S~m ~m ~m :r ~m" + (-> obj type) + (if (logtest? (-> obj flags) (editable-flag changed)) + " (m)" + "" + ) + (-> obj trans x) + (-> obj trans y) + (-> obj trans z) + (-> obj radius) + ) + (format #t " @ #x~X>" obj) + obj + ) + +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 28 editable-point) has a return type of none, but the expression builder found a return statement. +(defmethod editable-method-28 editable-point ((obj editable-point) (arg0 editable-filter)) + (if (logtest? arg0 (editable-filter water-command)) + (return #f) + ) + (let ((s4-0 (-> *editable* 0 current))) + (cond + ((logtest? (-> obj flags) (editable-flag top-set)) + (let* ((s3-0 (-> s4-0 length)) + (s2-0 0) + (a0-1 (-> s4-0 data s2-0)) + ) + (while (< s2-0 s3-0) + (if (and a0-1 (= (-> a0-1 region) (-> obj region)) (logtest? (-> a0-1 flags) (editable-flag top-set))) + (edit-coord! a0-1 (-> obj trans) (editable-flag y no-update)) + ) + (+! s2-0 1) + (set! a0-1 (-> s4-0 data s2-0)) + ) + ) + ) + ((logtest? (-> obj flags) (editable-flag bot-set)) + (let* ((s3-1 (-> s4-0 length)) + (s2-1 0) + (a0-2 (-> s4-0 data s2-1)) + ) + (while (< s2-1 s3-1) + (if (and a0-2 (= (-> a0-2 region) (-> obj region)) (logtest? (-> a0-2 flags) (editable-flag bot-set))) + (edit-coord! a0-2 (-> obj trans) (editable-flag y no-update)) + ) + (+! s2-1 1) + (set! a0-2 (-> s4-0 data s2-1)) + ) + ) + ) + ) + ) + ((the-as (function editable-point editable-command none) (find-parent-method editable-point 28)) + obj + (the-as editable-command arg0) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-15 editable-point ((obj editable-point) (arg0 vector) (arg1 int)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (vector+! (-> obj trans) (-> obj trans) arg0) + (editable-method-28 obj (the-as editable-filter arg1)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod edit-coord! editable-point ((obj editable-point) (arg0 vector) (arg1 editable-flag)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (if (logtest? arg1 (editable-flag x)) + (set! (-> obj trans x) (-> arg0 x)) + ) + (if (logtest? arg1 (editable-flag y)) + (set! (-> obj trans y) (-> arg0 y)) + ) + (if (logtest? arg1 (editable-flag z)) + (set! (-> obj trans z) (-> arg0 z)) + ) + (editable-method-28 obj (the-as editable-filter arg1)) + 0 + (none) + ) + +(defmethod edit-get-trans editable-point ((obj editable-point)) + "Returns the `trans` [[vector]] or [[*null-vector*]]" + (-> obj trans) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-18 editable-point ((obj editable-point) (arg0 vector) (arg1 matrix)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> obj trans) arg0))) + (vector-matrix*! s4-1 s4-1 arg1) + (vector+! (-> obj trans) s4-1 arg0) + ) + 0 + (none) + ) + +(defmethod editable-method-10 editable-point ((obj editable-point)) + (let* ((s5-0 vector-vector-distance) + (a0-1 (math-camera-pos)) + (a1-0 (-> obj trans)) + (f0-1 (- (s5-0 a0-1 a1-0) (-> obj radius))) + (s2-0 (cond + ((logtest? (-> obj flags) (editable-flag selected)) + 6 + ) + ((>= f0-1 983040.0) + 3 + ) + ((>= f0-1 491520.0) + 4 + ) + ((>= f0-1 245760.0) + 5 + ) + (else + 6 + ) + ) + ) + ) + (add-debug-sphere-from-table + (bucket-id bucket-324) + (-> obj trans) + (-> obj radius) + (get-color obj (the-as int a1-0)) + s2-0 + ) + ) + ((method-of-type editable editable-method-10) obj) + (none) + ) + +(defmethod edit-get-distance editable-point ((obj editable-point) (arg0 vector)) + "Returns the distance from the camera to the [[editable]], or -1.0" + (let ((a0-1 (new 'stack-no-clear 'sphere)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 quad) (-> obj trans quad)) + (set! (-> a0-1 w) (-> obj radius)) + (when (sphere-in-view-frustum? a0-1) + (reverse-transform-point! s5-0 (-> obj trans) (-> *math-camera* inv-camera-rot vector 2) arg0) + (let ((f0-1 (vector-vector-distance (edit-get-trans obj) s5-0))) + (if (>= (-> obj radius) f0-1) + (return f0-1) + ) + ) + ) + ) + -1.0 + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-19 editable-point ((obj editable-point) (arg0 vector)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans)))) + (vector-normalize! s4-1 (-> obj radius)) + (vector-! (-> obj trans) arg0 s4-1) + ) + (editable-method-28 obj (editable-filter load)) + 0 + (none) + ) + +(defmethod editable-method-22 editable-point ((obj editable-point) (arg0 editable-array) (arg1 int) (arg2 int)) + (case arg1 + ((2) + (let ((s3-0 (clear *temp-string*))) + (format + s3-0 + "insert into region_point set region_face_id=LAST_INSERT_ID(),idx=~D,x=~f,y=~f,z=~f" + arg2 + (- (-> obj trans x) (-> arg0 level-offset x)) + (- (-> obj trans y) (-> arg0 level-offset y)) + (- (-> obj trans z) (-> arg0 level-offset z)) + ) + (let ((a0-5 (sql-query s3-0))) + (when (= (-> a0-5 error) 'modify) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 editable-sphere ((obj editable-sphere) (arg0 vector)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> obj radius) (-> arg0 x)) + (set! (-> obj radius) (-> arg0 y)) + ) + (if (< (-> obj radius) 0.0) + (set! (-> obj radius) 0.0) + ) + (editable-method-28 obj (editable-filter load)) + 0 + (none) + ) + +(defmethod editable-method-22 editable-sphere ((obj editable-sphere) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((gp-0 (clear *temp-string*))) + (format + gp-0 + "insert into region_sphere set region_id=~D,x=~f,y=~f,z=~f,r=~f" + (-> obj region id) + (- (-> obj trans x) (-> arg0 level-offset x)) + (- (-> obj trans y) (-> arg0 level-offset y)) + (- (-> obj trans z) (-> arg0 level-offset z)) + (-> obj radius) + ) + (= (-> (sql-query gp-0) error) 'modify) + ) + ) + +(defmethod editable-method-22 editable-sample ((obj editable-sample) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s5-0 (clear *temp-string*))) + (format + s5-0 + "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" + (-> arg0 level-info-id) + (* 0.00024414062 (- (-> obj trans x) (-> arg0 level-offset x))) + (* 0.00024414062 (- (-> obj trans y) (-> arg0 level-offset y))) + (* 0.00024414062 (- (-> obj trans z) (-> arg0 level-offset z))) + ) + (let ((a0-4 (sql-query s5-0))) + (when (= (-> a0-4 error) 'modify) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + ) + ) + ) + +(defmethod print editable-light ((obj editable-light)) + (format + #t + "#<~A~S ~S ~m ~m ~m" + (-> obj type) + (if (logtest? (-> obj flags) (editable-flag changed)) + " (m)" + "" + ) + (-> obj name) + (-> obj trans x) + (-> obj trans y) + (-> obj trans z) + ) + (format #t " :r ~m @ #x~X>" (-> obj radius) obj) + obj + ) + +(defmethod editable-method-23 editable-light ((obj editable-light)) + (let ((v1-0 *light-hash*)) + (let* ((a2-0 (-> v1-0 num-lights)) + (a1-1 (-> v1-0 light-sphere-array a2-0)) + ) + (set! (-> a1-1 name) (-> obj name)) + (set! (-> a1-1 decay-start) (-> obj decay-start)) + (set! (-> a1-1 ambient-point-ratio) (-> obj ambient-point-ratio)) + (set! (-> a1-1 brightness) (-> obj brightness)) + (set! (-> a1-1 bsphere quad) (-> obj trans quad)) + (set! (-> a1-1 bsphere w) (-> obj radius)) + (set! (-> a1-1 direction quad) (-> obj direction quad)) + (set! (-> a1-1 color quad) (-> obj color quad)) + (set! (-> a1-1 palette-index) (the int (-> obj color w))) + ) + (+! (-> v1-0 num-lights) 1) + ) + #t + ) + +;; WARN: Return type mismatch int vs none. +(defun update-light-sphere-from-editable-light ((arg0 editable-light)) + (let ((v1-0 (lookup-light-sphere-by-name (-> arg0 name) *light-hash*))) + (when v1-0 + (set! (-> v1-0 name) (-> arg0 name)) + (set! (-> v1-0 decay-start) (-> arg0 decay-start)) + (set! (-> v1-0 ambient-point-ratio) (-> arg0 ambient-point-ratio)) + (set! (-> v1-0 brightness) (-> arg0 brightness)) + (set! (-> v1-0 bsphere quad) (-> arg0 trans quad)) + (set! (-> v1-0 bsphere w) (-> arg0 radius)) + (set! (-> v1-0 direction quad) (-> arg0 direction quad)) + (set! (-> v1-0 color quad) (-> arg0 color quad)) + (set! (-> v1-0 palette-index) (the int (-> arg0 color w))) + ) + ) + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 editable-light ((obj editable-light) (arg0 vector)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> obj radius) (-> arg0 x)) + (set! (-> obj radius) (-> arg0 y)) + ) + (if (< (-> obj radius) 0.0) + (set! (-> obj radius) 0.0) + ) + (update-light-sphere-from-editable-light obj) + (editable-method-28 obj (editable-filter load)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-15 editable-light ((obj editable-light) (arg0 vector) (arg1 int)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (vector+! (-> obj trans) (-> obj trans) arg0) + (update-light-sphere-from-editable-light obj) + (editable-method-28 obj (the-as editable-filter arg1)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 25 editable-light) has a return type of none, but the expression builder found a return statement. +(defmethod editable-method-25 editable-light ((obj editable-light) (arg0 editable-array)) + ((the-as (function editable-light editable-array none) (find-parent-method editable-light 25)) obj arg0) + (when (nonzero? (-> obj id)) + (let ((s5-1 (clear *temp-string*))) + (format s5-1 "delete from light where light_id=~D" (-> obj id)) + (let ((a2-1 (sql-query s5-1))) + (when (!= (-> a2-1 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 obj) + (return 0) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod editable-method-22 editable-light ((obj editable-light) (arg0 editable-array) (arg1 int) (arg2 int)) + (cond + ((logtest? (-> obj flags) (editable-flag changed)) + (let ((s5-0 (clear *temp-string*))) + (when (zero? (-> obj id)) + (format s5-0 "insert into light set level_name='~S'" (-> obj region level)) + (let ((s3-0 (sql-query s5-0))) + (when (= (-> s3-0 error) 'modify) + (let ((v1-7 (sql-query "select LAST_INSERT_ID()"))) + (when (= (-> v1-7 error) 'select) + (set! (-> obj id) (the-as uint (string->int (the-as string (-> v1-7 data 0))))) + (goto cfg-8) + ) + ) + ) + (format 0 "ERROR: sql: id insert error ~A for ~A~%" s3-0 obj) + ) + (return #f) + (label cfg-8) + (let ((s3-1 (new 'debug 'string 32 (the-as string #f)))) + (format s3-1 "light-~d" (-> obj id)) + (set! (-> obj name) s3-1) + ) + ) + (format (clear s5-0) "update light set level_name='~S', name='~S'" (-> obj region level) (-> obj name)) + (format + s5-0 + ", pos_x=~f, pos_y=~f, pos_z=~f, r=~f" + (* 0.00024414062 (- (-> obj trans x) (-> arg0 level-offset x))) + (* 0.00024414062 (- (-> obj trans y) (-> arg0 level-offset y))) + (* 0.00024414062 (- (-> obj trans z) (-> arg0 level-offset z))) + (* 0.00024414062 (-> obj radius)) + ) + (if (= (-> obj direction w) 0.0) + (format s5-0 ", dir_x=0.0, dir_y=0.0, dir_z=0.0") + (format s5-0 ", dir_x=~f, dir_y=~f, dir_z=~f" (-> obj direction x) (-> obj direction y) (-> obj direction z)) + ) + (format + s5-0 + ", color0_r=~f, color0_g=~f, color0_b=~f, color0_a=~f" + (-> obj color x) + (-> obj color y) + (-> obj color z) + (-> obj color w) + ) + (format + s5-0 + ", decay_start=~f, ambient_point_ratio=~f, brightness=~f" + (-> obj decay-start) + (-> obj ambient-point-ratio) + (-> obj brightness) + ) + (format s5-0 " where light_id=~D" (-> obj id)) + (let ((a0-21 (sql-query s5-0))) + (when (= (-> a0-21 error) 'modify) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +(defmethod editable-method-10 editable-light ((obj editable-light)) + (if (!= (-> obj direction w) 0.0) + (add-debug-vector + #t + (bucket-id bucket-318) + (edit-get-trans obj) + (-> obj direction) + (* -1.2 (-> obj radius)) + (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + ) + ) + (when (-> *editable* 0 light-names) + (let ((s5-1 add-debug-text-3d) + (s4-1 #t) + (s3-1 318) + ) + (format (clear *temp-string*) "~S~%" (-> obj name)) + (s5-1 s4-1 (the-as bucket-id s3-1) *temp-string* (-> obj trans) (font-color one) (the-as vector2h #f)) + ) + ) + ((method-of-type editable-sphere editable-method-10) obj) + (none) + ) + +;; WARN: Return type mismatch object vs vector. +(defmethod edit-get-trans editable-face ((obj editable-face)) + "Returns the `trans` [[vector]] or [[*null-vector*]]" + "The center of the obj." + (the-as vector (cond + ((>= (-> obj length) 3) + (let ((s5-0 (new 'static 'vector))) + (set! (-> s5-0 quad) (the-as uint128 0)) + (vector+! s5-0 s5-0 (edit-get-trans (-> obj vertex 0))) + (vector+! s5-0 s5-0 (edit-get-trans (-> obj vertex 1))) + (vector+! s5-0 s5-0 (edit-get-trans (-> obj vertex 2))) + (vector-float*! s5-0 s5-0 0.33333334) + ) + ) + ((>= (-> obj length) 2) + (let ((s5-1 (new 'static 'vector))) + (set! (-> s5-1 quad) (the-as uint128 0)) + (vector+! s5-1 s5-1 (edit-get-trans (-> obj vertex 0))) + (vector+! s5-1 s5-1 (edit-get-trans (-> obj vertex 1))) + (vector-float*! s5-1 s5-1 0.5) + ) + ) + (else + *null-vector* + ) + ) + ) + ) + +(defmethod editable-method-22 editable-face ((obj editable-face) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (clear *temp-string*))) + (format s4-0 "insert into region_face set kind='face',region_id=~D" (-> obj region id)) + (if (logtest? (-> obj flags) (editable-flag orient)) + (format s4-0 ",flags='orient'") + ) + (let ((a0-5 (sql-query s4-0))) + (if (!= (-> a0-5 error) 'modify) + (return #f) + ) + ) + ) + (dotimes (s4-1 (-> obj length)) + (editable-method-22 (-> obj vertex s4-1) arg0 2 s4-1) + ) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + +(defmethod editable-method-25 editable-face ((obj editable-face) (arg0 editable-array)) + (dotimes (s4-0 (-> obj length)) + (let ((s3-0 (-> obj vertex s4-0))) + (set! (-> s3-0 owner) (delete! obj (-> s3-0 owner))) + ) + ) + ((the-as (function editable-face editable-array none) (find-parent-method editable-face 25)) obj arg0) + (none) + ) + +(defmethod editable-method-26 editable-face ((obj editable-face) (arg0 editable) (arg1 editable-array)) + (-> obj length) + (countdown (v1-1 (-> obj length)) + (when (= (-> obj vertex v1-1) arg0) + (let ((a0-5 v1-1) + (a1-2 (+ (-> obj length) -2)) + ) + (while (>= a1-2 a0-5) + (set! (-> obj vertex a0-5) (-> obj vertex (+ a0-5 1))) + (+! a0-5 1) + ) + ) + (+! (-> obj length) -1) + ) + ) + (if (< (-> obj length) 3) + (editable-array-method-15 arg1 obj) + ) + ((method-of-type editable editable-method-26) obj arg0 arg1) + (none) + ) + +(defmethod editable-method-27 editable-face ((obj editable-face) (arg0 editable-array)) + (let ((gp-1 + ((the-as (function editable-face editable-array editable) (find-parent-method editable-face 27)) obj arg0) + ) + ) + (dotimes (s4-0 (-> (the-as editable-face gp-1) length)) + (let ((v1-3 (editable-method-27 (the-as editable-face (l.wu (+ (* s4-0 4) (the-as int gp-1) 60))) arg0)) + (a0-5 (+ (* s4-0 4) (the-as int gp-1))) + ) + (s.w! (+ a0-5 60) v1-3) + ) + (let ((v0-3 (cons gp-1 (-> (the-as editable-face (+ (* s4-0 4) (the-as int gp-1))) vertex 0 owner))) + (v1-10 (l.wu (+ (* s4-0 4) (the-as int gp-1) 60))) + ) + (s.w! (+ v1-10 16) v0-3) + ) + ) + gp-1 + ) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-24 editable-face ((obj editable-face)) + (logxor! (-> obj flags) (editable-flag orient)) + (editable-face-method-31 obj (-> obj normal)) + (logior! (-> obj flags) (editable-flag changed)) + (set! (-> obj region changed) #t) + 0 + (none) + ) + +(defmethod editable-face-method-30 editable-face ((obj editable-face) (arg0 (inline-array vector))) + (let ((v1-0 (-> obj length))) + (cond + ((or (zero? v1-0) (= v1-0 1)) + 0 + ) + ((= v1-0 2) + (let ((s4-0 (edit-get-trans (-> obj vertex 0))) + (v1-3 (edit-get-trans (-> obj vertex 1))) + ) + (set! (-> arg0 0 quad) (-> s4-0 quad)) + (set! (-> arg0 1 quad) (-> s4-0 quad)) + (set! (-> arg0 1 y) (-> v1-3 y)) + (set! (-> arg0 2 quad) (-> v1-3 quad)) + (set! (-> arg0 2 y) (-> s4-0 y)) + (set! (-> arg0 3 quad) (-> v1-3 quad)) + ) + 4 + ) + (else + (dotimes (s4-1 (-> obj length)) + (set! (-> arg0 s4-1 quad) (-> (edit-get-trans (-> obj vertex s4-1)) quad)) + ) + (-> obj length) + ) + ) + ) + ) + +(defmethod editable-face-method-31 editable-face ((obj editable-face) (arg0 vector)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (dotimes (v1-0 6) + (set! (-> s4-0 vector v1-0 quad) (the-as uint128 0)) + ) + (if (>= (editable-face-method-30 obj (the-as (inline-array vector) s4-0)) 3) + (normal-of-plane arg0 (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1) (-> s4-0 vector 2)) + ) + ) + (if (logtest? (-> obj flags) (editable-flag orient)) + (vector-negate! arg0 arg0) + ) + arg0 + ) + +(defmethod editable-method-10 editable-face ((obj editable-face)) + (local-vars (sv-112 int)) + (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-0 6) + (set! (-> gp-0 v1-0 quad) (the-as uint128 0)) + ) + (set! sv-112 (editable-face-method-30 obj gp-0)) + (when (>= sv-112 3) + (let ((s1-0 (editable-face-method-31 obj (new 'stack-no-clear 'vector)))) + (add-debug-vector + #t + (bucket-id bucket-318) + (edit-get-trans obj) + s1-0 + (the-as meters #x46000000) + (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + ) + ) + (when (logtest? (-> obj flags) (editable-flag selected)) + (dotimes (s4-1 sv-112) + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 318) + ) + (format (clear *temp-string*) "~D" s4-1) + (s3-1 + s2-1 + (the-as bucket-id s1-1) + *temp-string* + (-> gp-0 s4-1) + (the-as font-color (if (logtest? (-> obj flags) (editable-flag orient)) + 5 + 1 + ) + ) + (the-as vector2h #f) + ) + ) + ) + ) + (add-debug-bound + 324 + (the-as transform gp-0) + sv-112 + (the-as rgba (if (logtest? (-> obj flags) (editable-flag orient)) + (-> (new 'static 'array uint64 1 #x800000ff) 0) + (-> (new 'static 'array uint64 1 #x8000ffff) 0) + ) + ) + (the-as rgba (if (zero? (logand (-> obj flags) (editable-flag orient))) + (-> (new 'static 'array uint64 1 #x800000ff) 0) + (-> (new 'static 'array uint64 1 #x8000ffff) 0) + ) + ) + (if (logtest? (-> obj flags) (editable-flag selected)) + 1 + 0 + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod edit-get-trans editable-plane ((obj editable-plane)) + "Returns the `trans` [[vector]] or [[*null-vector*]]" + (if (>= (-> obj length) 1) + (edit-get-trans (-> obj vertex 0)) + *null-vector* + ) + ) + +(defmethod editable-method-22 editable-plane ((obj editable-plane) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (clear *temp-string*))) + (format + s4-0 + "insert into region_face set kind='plane',region_id=~D,radius=~f" + (-> obj region id) + (-> obj radius) + ) + (let ((a0-4 (sql-query s4-0))) + (if (!= (-> a0-4 error) 'modify) + (return #f) + ) + ) + ) + (dotimes (s4-1 (-> obj length)) + (editable-method-22 (-> obj vertex s4-1) arg0 2 s4-1) + ) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + +(defmethod editable-method-25 editable-plane ((obj editable-plane) (arg0 editable-array)) + (dotimes (s4-0 (-> obj length)) + (let ((s3-0 (-> obj vertex s4-0))) + (set! (-> s3-0 owner) (delete! obj (-> s3-0 owner))) + ) + ) + ((the-as (function editable-plane editable-array none) (find-parent-method editable-plane 25)) obj arg0) + (none) + ) + +(defmethod editable-method-26 editable-plane ((obj editable-plane) (arg0 editable) (arg1 editable-array)) + (editable-array-method-15 arg1 obj) + ((method-of-type editable editable-method-26) obj arg0 arg1) + (none) + ) + +(defmethod editable-method-27 editable-plane ((obj editable-plane) (arg0 editable-array)) + (let ((gp-1 + ((the-as (function editable-plane editable-array editable) (find-parent-method editable-plane 27)) obj arg0) + ) + ) + (dotimes (s4-0 (-> (the-as editable-plane gp-1) length)) + (let ((v1-3 (editable-method-27 (-> (the-as editable-plane (+ (* s4-0 4) (the-as int gp-1))) vertex 0) arg0)) + (a0-5 (+ (* s4-0 4) (the-as int gp-1))) + ) + (s.w! (+ a0-5 28) v1-3) + ) + (let ((v0-3 (cons gp-1 (-> (the-as editable-plane (+ (* s4-0 4) (the-as int gp-1))) vertex 0 owner))) + (v1-10 (l.wu (+ (* s4-0 4) (the-as int gp-1) 28))) + ) + (s.w! (+ v1-10 16) v0-3) + ) + ) + gp-1 + ) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-24 editable-plane ((obj editable-plane)) + (let ((s5-1 + (vector-! (new 'stack-no-clear 'vector) (edit-get-trans (-> obj vertex 1)) (edit-get-trans (-> obj vertex 0))) + ) + ) + (edit-coord! (-> obj vertex 1) (vector-! s5-1 (edit-get-trans (-> obj vertex 0)) s5-1) (editable-flag x y z)) + ) + (set! (-> obj region changed) #t) + (logior! (-> obj flags) (editable-flag changed)) + 0 + (none) + ) + +(defmethod editable-plane-method-30 editable-plane ((obj editable-plane) (arg0 matrix)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (case (-> obj length) + ((2) + (let* ((v1-2 (editable-plane-method-31 obj (new 'stack-no-clear 'vector))) + (s5-1 (vector-cross! + (new 'stack-no-clear 'vector) + v1-2 + (if (< 0.7 (fabs (vector-dot v1-2 (new 'static 'vector :z 1.0 :w 1.0)))) + (new 'static 'vector :x 1.0 :w 1.0) + (new 'static 'vector :z 1.0 :w 1.0) + ) + ) + ) + (s4-1 (vector-cross! (new 'stack-no-clear 'vector) s5-1 v1-2)) + (f30-0 (-> obj radius)) + ) + (let ((v1-4 (edit-get-trans (-> obj vertex 0)))) + (let ((a0-6 (-> arg0 vector))) + (let ((a1-6 v1-4) + (a2-1 s5-1) + (f0-1 f30-0) + ) + (.lvf vf2 (&-> a2-1 quad)) + (.lvf vf1 (&-> a1-6 quad)) + (let ((a1-7 f0-1)) + (.mov vf3 a1-7) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-6 0 quad) vf4) + ) + (let ((a0-7 (-> arg0 vector))) + (let ((a1-8 (-> arg0 vector)) + (a2-2 s4-1) + (f0-2 (- f30-0)) + ) + (.lvf vf2 (&-> a2-2 quad)) + (.lvf vf1 (&-> a1-8 0 quad)) + (let ((a1-9 f0-2)) + (.mov vf3 a1-9) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-7 0 quad) vf4) + ) + (let ((a0-8 (-> arg0 vector 1))) + (let ((a1-10 v1-4) + (a2-3 s5-1) + (f0-3 (- f30-0)) + ) + (.lvf vf2 (&-> a2-3 quad)) + (.lvf vf1 (&-> a1-10 quad)) + (let ((a1-11 f0-3)) + (.mov vf3 a1-11) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-8 quad) vf4) + ) + (let ((a0-9 (-> arg0 vector 1))) + (let ((a1-12 (-> arg0 vector 1)) + (a2-4 s4-1) + (f0-4 (- f30-0)) + ) + (.lvf vf2 (&-> a2-4 quad)) + (.lvf vf1 (&-> a1-12 quad)) + (let ((a1-13 f0-4)) + (.mov vf3 a1-13) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-9 quad) vf4) + ) + (let ((a0-10 (-> arg0 vector 2))) + (let ((a1-14 v1-4) + (a2-5 s5-1) + (f0-5 f30-0) + ) + (.lvf vf2 (&-> a2-5 quad)) + (.lvf vf1 (&-> a1-14 quad)) + (let ((a1-15 f0-5)) + (.mov vf3 a1-15) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-10 quad) vf4) + ) + (let ((a0-11 (-> arg0 vector 2))) + (let ((a1-16 (-> arg0 vector 2)) + (a2-6 s4-1) + (f0-6 f30-0) + ) + (.lvf vf2 (&-> a2-6 quad)) + (.lvf vf1 (&-> a1-16 quad)) + (let ((a1-17 f0-6)) + (.mov vf3 a1-17) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-11 quad) vf4) + ) + (let ((a0-12 (-> arg0 trans))) + (let ((f0-7 (- f30-0))) + (.lvf vf2 (&-> s5-1 quad)) + (.lvf vf1 (&-> v1-4 quad)) + (let ((v1-5 f0-7)) + (.mov vf3 v1-5) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-12 quad) vf4) + ) + ) + (let ((v1-6 (-> arg0 trans))) + (let ((a0-13 (-> arg0 trans))) + (.lvf vf2 (&-> s4-1 quad)) + (.lvf vf1 (&-> a0-13 quad)) + ) + (let ((a0-14 f30-0)) + (.mov vf3 a0-14) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> v1-6 quad) vf4) + ) + ) + 4 + ) + (else + 0 + ) + ) + ) + ) + +(defmethod editable-plane-method-31 editable-plane ((obj editable-plane) (arg0 vector)) + (case (-> obj length) + ((2) + (let ((s3-0 (-> obj vertex 0)) + (a0-1 (-> obj vertex 1)) + ) + (vector-! arg0 (edit-get-trans a0-1) (edit-get-trans s3-0)) + ) + (vector-normalize! arg0 1.0) + ) + ) + arg0 + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-10 editable-plane ((obj editable-plane)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (dotimes (v1-0 4) + (set! (-> gp-0 vector v1-0 quad) (the-as uint128 0)) + ) + (let ((s4-0 (editable-plane-method-30 obj gp-0))) + (when (>= s4-0 3) + (add-debug-line + #t + (bucket-id bucket-318) + (edit-get-trans (-> obj vertex 0)) + (edit-get-trans (-> obj vertex 1)) + (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + #f + (the-as rgba -1) + ) + (add-debug-bound + 324 + (the-as transform gp-0) + s4-0 + (the-as rgba (if (logtest? (-> obj flags) (editable-flag orient)) + (-> (new 'static 'array uint64 1 #x800000ff) 0) + (-> (new 'static 'array uint64 1 #x8000ffff) 0) + ) + ) + (the-as rgba (if (zero? (logand (-> obj flags) (editable-flag orient))) + (-> (new 'static 'array uint64 1 #x800000ff) 0) + (-> (new 'static 'array uint64 1 #x8000ffff) 0) + ) + ) + (if (logtest? (-> obj flags) (editable-flag selected)) + 1 + 0 + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 editable-plane ((obj editable-plane) (arg0 vector)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> obj radius) (-> arg0 x)) + (set! (-> obj radius) (-> arg0 y)) + ) + (if (< (-> obj radius) 0.0) + (set! (-> obj radius) 0.0) + ) + (editable-method-28 obj (editable-filter load)) + 0 + (none) + ) + +;; WARN: Return type mismatch (array editable) vs editable-array. +(defmethod relocate editable-array ((obj editable-array) (arg0 int)) + (the-as editable-array (when (nonzero? (-> obj selection)) + (let ((v0-0 (&+ (-> obj selection) arg0))) + (set! (-> obj selection) v0-0) + v0-0 + ) + ) + ) + ) + +(defmethod length editable-array ((obj editable-array)) + (-> obj length) + ) + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of editable-array ((obj editable-array)) + (the-as int (+ (-> obj type size) (* (-> obj allocated-length) 4))) + ) + +(defmethod editable-array-method-11 editable-array ((obj editable-array)) + (dotimes (v1-0 (-> obj length)) + (if (not (-> obj data v1-0)) + (return v1-0) + ) + ) + (when (< (-> obj length) (-> obj allocated-length)) + (+! (-> obj length) 1) + (return (+ (-> obj length) -1)) + ) + -1 + ) + +(defmethod editable-array-method-10 editable-array ((obj editable-array) (arg0 vector) (arg1 int)) + (when (or (!= (-> arg0 x) (-> *editable-work* last-x)) (!= (-> arg0 y) (-> *editable-work* last-y))) + (set! (-> *editable-work* last-found) 0) + (set! (-> *editable-work* last-x) (-> arg0 x)) + (set! (-> *editable-work* last-y) (-> arg0 y)) + ) + 4095996000.0 + (let ((s5-0 (the-as editable #f))) + (set! (-> *editable-work* num-found) 0) + (let* ((s2-0 (-> obj length)) + (s1-0 0) + (s0-0 (-> obj data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (or (and (logtest? (-> s0-0 region filter) (-> obj filter 0)) + (logtest? (-> s0-0 region filter) (-> obj filter 1)) + ) + (logtest? (-> s0-0 flags) (editable-flag selected)) + ) + ) + (let ((f0-5 (edit-get-distance s0-0 arg0))) + (when (>= f0-5 0.0) + (set! (-> *editable-work* found (-> *editable-work* num-found)) s0-0) + (set! (-> *editable-work* dists (-> *editable-work* num-found)) (the-as uint f0-5)) + (if (< (-> *editable-work* num-found) 255) + (+! (-> *editable-work* num-found) 1) + ) + ) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> obj data s1-0)) + ) + ) + (countdown (v1-43 (-> *editable-work* num-found)) + (when (> v1-43 0) + (countdown (a0-12 v1-43) + (when (< (the-as float (-> *editable-work* dists v1-43)) (the-as float (-> *editable-work* dists a0-12))) + (let ((a1-10 (-> *editable-work* found v1-43)) + (f0-7 (-> *editable-work* dists v1-43)) + ) + (set! (-> *editable-work* found v1-43) (-> *editable-work* found a0-12)) + (set! (-> *editable-work* dists v1-43) (-> *editable-work* dists a0-12)) + (set! (-> *editable-work* found a0-12) a1-10) + (set! (-> *editable-work* dists a0-12) f0-7) + ) + ) + ) + ) + ) + (when (nonzero? (-> *editable-work* num-found)) + (when (>= (-> *editable-work* last-found) (-> *editable-work* num-found)) + (set! (-> *editable-work* last-found) 0) + 0 + ) + (set! s5-0 (cond + ((zero? arg1) + (set! s5-0 (-> *editable-work* found (-> *editable-work* last-found))) + (+! (-> *editable-work* last-found) 1) + s5-0 + ) + (else + (-> *editable-work* found 0) + ) + ) + ) + ) + s5-0 + ) + ) + +;; WARN: Return type mismatch (array editable) vs none. +(defmethod editable-array-method-14 editable-array ((obj editable-array) (arg0 (function symbol)) (arg1 symbol)) + (let ((gp-0 (-> obj selection))) + (set! (-> gp-0 length) 0) + (let* ((s2-0 (-> obj length)) + (s1-0 0) + (s0-0 (-> obj data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (logtest? (-> s0-0 flags) (editable-flag selected))) + (when (arg0) + (set! (-> gp-0 (-> gp-0 length)) s0-0) + (+! (-> gp-0 length) 1) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> obj data s1-0)) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-15 editable-array ((obj editable-array) (arg0 editable)) + (let ((gp-0 (-> arg0 region))) + (when gp-0 + (editable-method-25 arg0 obj) + (let* ((v1-3 (-> obj length)) (a0-2 0) (a1-4 (-> obj data a0-2))) (while (< a0-2 v1-3) + (if (and a1-4 (= arg0 a1-4)) + (set! (-> obj data a0-2) #f) + ) + (+! a0-2 1) + (set! a1-4 (-> obj data a0-2)) + ) + ) + (let* ((v1-6 (-> obj length)) + (a0-3 0) + (a1-14 (-> obj data a0-3)) + ) + (while (< a0-3 v1-6) + (if (and a1-14 (= (-> a1-14 region) gp-0) (!= a1-14 arg0)) + (goto cfg-21) + ) + (+! a0-3 1) + (set! a1-14 (-> obj data a0-3)) + ) + ) + (editable-region-method-10 gp-0 0) + ) + ) + (label cfg-21) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-13 editable-array ((obj editable-array) (arg0 uint) (arg1 basic) (arg2 string)) + (set! (-> obj target) #f) + (set! (-> obj target-mode) arg0) + (set! (-> obj target-command) arg1) + (set! (-> obj target-message) arg2) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-16 editable-array ((obj editable-array)) + (cond + ((-> obj edit-plane) + (editable-plane-method-31 (-> obj edit-plane) (-> obj edit-plane-normal)) + (set! (-> obj edit-plane-center quad) (-> (edit-get-trans (-> obj edit-plane vertex 0)) quad)) + ) + (else + (vector-negate! (-> obj edit-plane-normal) (-> *math-camera* inv-camera-rot vector 2)) + (let ((v1-9 (vector-float*! (-> obj edit-plane-center) (-> *math-camera* inv-camera-rot vector 2) 24576.0))) + (vector+! (the-as vector v1-9) (the-as vector v1-9) (-> *math-camera* trans)) + ) + ) + ) + 0 + (none) + ) + +(defmethod editable-array-method-17 editable-array ((obj editable-array) (arg0 vector) (arg1 vector)) + (cond + ((and (cpad-hold? 0 up) *target*) + (set! (-> arg0 quad) (-> (get-trans *target* 0) quad)) + ) + ((and (cpad-hold? 0 down) *camera*) + (set! (-> arg0 quad) (-> (math-camera-pos) quad)) + ) + (else + (editable-array-method-16 obj) + (reverse-transform-point! arg0 (-> obj edit-plane-center) (-> obj edit-plane-normal) arg1) + ) + ) + arg0 + ) + +(when (zero? *editable-sample-region*) + (let ((v1-4 (new 'debug 'editable-region))) + (set! (-> v1-4 locked) #t) + (set! (-> v1-4 changed) #f) + (set! (-> v1-4 tree) (the-as string 'sample)) + (set! (-> v1-4 filter) (editable-filter sample)) + (set! *editable-sample-region* v1-4) + ) + (let ((v1-6 (new 'debug 'editable-region))) + (set! (-> v1-6 locked) #t) + (set! (-> v1-6 changed) #f) + (set! (-> v1-6 tree) (the-as string 'light)) + (set! (-> v1-6 filter) (editable-filter light)) + (set! *editable-light-region* v1-6) + ) + (let ((v0-84 (new 'debug 'editable-region))) + (set! (-> v0-84 locked) #t) + (set! (-> v0-84 changed) #f) + (set! (-> v0-84 tree) (the-as string 'entity)) + (set! (-> v0-84 filter) (editable-filter entity)) + (set! *editable-entity-region* v0-84) + ) + ) + +) + + + + diff --git a/goal_src/jak2/engine/draw/drawable-h.gc b/goal_src/jak2/engine/draw/drawable-h.gc index 459485a3b0..5cff162ea0 100644 --- a/goal_src/jak2/engine/draw/drawable-h.gc +++ b/goal_src/jak2/engine/draw/drawable-h.gc @@ -6,7 +6,7 @@ ;; dgos: ENGINE, GAME (declare-type region-prim-list structure) -;; NOTE - for sparticle-launcher +;; NOTE - for sparticle-launcher and editable (define-extern sphere-in-view-frustum? (function sphere symbol)) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/game/main-h.gc b/goal_src/jak2/engine/game/main-h.gc index 7edbcd52cf..168dcc235b 100644 --- a/goal_src/jak2/engine/game/main-h.gc +++ b/goal_src/jak2/engine/game/main-h.gc @@ -311,5 +311,7 @@ ) (define-extern movie? (function symbol)) +(define-extern paused? (function symbol)) +(define-extern set-master-mode (function symbol none)) (define-extern on (function symbol process)) diff --git a/goal_src/jak2/engine/gfx/lights-h.gc b/goal_src/jak2/engine/gfx/lights-h.gc index bc82efdd27..be74fbeba8 100644 --- a/goal_src/jak2/engine/gfx/lights-h.gc +++ b/goal_src/jak2/engine/gfx/lights-h.gc @@ -8,6 +8,14 @@ ;; It seems like some of these are unused. ;; The commonly used lights are vu-lights and light-group. +;; NOTE - for editable +(declare-type light-sphere structure) +(declare-type light-hash basic) +(define-extern lookup-light-sphere-by-name (function string light-hash light-sphere)) +;; NOTE - for editable-player +(define-extern update-light-hash (function light-hash none)) +(define-extern reset-light-hash (function none)) + ;; DECOMP BEGINS ;; this type represents the lights that can be sent to the VU for merc (and maybe generic?) rendering. diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-tables.gc b/goal_src/jak2/engine/gfx/ocean/ocean-tables.gc index 5cda5a1f86..eefd2ecce6 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-tables.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-tables.gc @@ -5,6 +5,8 @@ ;; name in dgo: ocean-tables ;; dgos: ENGINE, GAME +;; og:ignore-from-loc + ;; DECOMP BEGINS (define *ocean-spheres-city* diff --git a/goal_src/jak2/engine/gfx/ocean/ocean-trans-tables.gc b/goal_src/jak2/engine/gfx/ocean/ocean-trans-tables.gc index be5e6dda85..4e57da9839 100644 --- a/goal_src/jak2/engine/gfx/ocean/ocean-trans-tables.gc +++ b/goal_src/jak2/engine/gfx/ocean/ocean-trans-tables.gc @@ -5,6 +5,8 @@ ;; name in dgo: ocean-trans-tables ;; dgos: ENGINE, GAME +;; og:ignore-from-loc + ;; DECOMP BEGINS ;; definition for symbol *ocean-left-table*, type (pointer float) diff --git a/goal_src/jak2/engine/level/level-h.gc b/goal_src/jak2/engine/level/level-h.gc index 1e501a59ba..2ac5224a31 100644 --- a/goal_src/jak2/engine/level/level-h.gc +++ b/goal_src/jak2/engine/level/level-h.gc @@ -97,6 +97,10 @@ (declare-type game-text-id uint32) +;; NOTE - for editable-player +(declare-type level-load-info basic) +(define-extern lookup-level-info (function symbol level-load-info)) + ;; DECOMP BEGINS (deftype level-vis-info (basic) diff --git a/goal_src/jak2/engine/nav/nav-control-h.gc b/goal_src/jak2/engine/nav/nav-control-h.gc index 6c718a0914..07ee2a1041 100644 --- a/goal_src/jak2/engine/nav/nav-control-h.gc +++ b/goal_src/jak2/engine/nav/nav-control-h.gc @@ -52,6 +52,7 @@ :flag-assert #x900000030 ) + (deftype nav-gap-info (structure) ((dest vector :inline :offset-assert 0) (poly nav-poly :offset-assert 16) @@ -61,6 +62,7 @@ :flag-assert #x900000014 ) + (deftype nav-avoid-spheres-params (structure) ((current-pos vector :inline :offset-assert 0) (travel vector :inline :offset-assert 16) @@ -74,6 +76,7 @@ :flag-assert #x900000058 ) + (deftype nav-callback-info (structure) ((callback-count int32 :offset-assert 0) (callback-array uint32 10 :offset-assert 4) @@ -83,6 +86,7 @@ :flag-assert #x90000002c ) + (deftype nav-state (structure) ((flags nav-state-flag :offset-assert 0) (nav basic :offset-assert 4) @@ -159,6 +163,7 @@ ) ) + (deftype nav-control (structure) ((flags nav-control-flag :offset-assert 0) (callback-info nav-callback-info :offset-assert 4) @@ -189,7 +194,7 @@ (:methods (nav-control-method-9 () none 9) (nav-control-method-10 () none 10) - (nav-control-method-11 () none 11) + (nav-control-method-11 (_type_ vector) vector 11) (nav-control-method-12 () none 12) (nav-control-method-13 () none 13) (nav-control-method-14 () none 14) @@ -198,7 +203,7 @@ (nav-control-method-17 () none 17) (nav-control-method-18 () none 18) (nav-control-method-19 () none 19) - (nav-control-method-20 () none 20) + (nav-control-method-20 (_type_ vector vector vector int symbol symbol) none 20) (nav-control-method-21 () none 21) (nav-control-method-22 () none 22) (nav-control-method-23 () none 23) @@ -227,3 +232,10 @@ (nav-control-method-46 () none 46) ) ) + + +0 + + + + diff --git a/goal_src/jak2/engine/physics/trajectory-h.gc b/goal_src/jak2/engine/physics/trajectory-h.gc index e2d5aea5f2..785f4c8bb1 100644 --- a/goal_src/jak2/engine/physics/trajectory-h.gc +++ b/goal_src/jak2/engine/physics/trajectory-h.gc @@ -5,6 +5,8 @@ ;; name in dgo: trajectory-h ;; dgos: ENGINE, GAME +(declare-type collide-query structure) + ;; DECOMP BEGINS (deftype trajectory (structure) @@ -29,6 +31,7 @@ ) ) + (deftype impact-control (structure) ((process (pointer process-drawable) :offset-assert 0) (radius float :offset-assert 4) @@ -45,10 +48,11 @@ (new (symbol type process-drawable int float collide-spec) _type_ 0) (initialize (_type_ process-drawable int float collide-spec) impact-control :behavior process 9) (update-from-cspace (_type_) none 10) - (impact-control-method-11 (_type_) none 11) + (impact-control-method-11 (_type_ collide-query process pat-surface) float 11) ) ) + (defmethod new impact-control ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 collide-spec)) (let ((t9-0 (method-of-type structure new)) (v1-1 type-to-make) @@ -73,11 +77,12 @@ (:methods (new (symbol type vector vector) _type_ 0) (initialize (_type_ vector vector) point-tracker 9) - (point-tracker-method-10 () none 10) - (point-tracker-method-11 () none 11) + (point-tracker-method-10 (_type_ vector vector vector float) vector 10) + (point-tracker-method-11 (_type_ vector vector vector float) vector 11) ) ) + (defmethod new point-tracker ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 vector)) (let ((t9-0 (method-of-type structure new)) (v1-1 type-to-make) @@ -95,11 +100,12 @@ :size-assert #x30 :flag-assert #xe00000030 (:methods - (combo-tracker-method-12 () none 12) - (combo-tracker-method-13 () none 13) + (combo-tracker-method-12 (_type_ vector vector process time-frame) combo-tracker 12) + (combo-tracker-method-13 (_type_ handle vector float vector float) none 13) ) ) + (deftype traj2d-params (structure) ((x float :offset-assert 0) (y float :offset-assert 4) @@ -113,6 +119,7 @@ :flag-assert #x900000018 ) + (deftype traj3d-params (structure) ((gravity float :offset-assert 0) (initial-tilt float :offset-assert 4) @@ -128,6 +135,7 @@ :flag-assert #x900000050 ) + (deftype cubic-curve (structure) ((mat matrix :inline :offset-assert 0) ) @@ -135,10 +143,17 @@ :size-assert #x40 :flag-assert #xe00000040 (:methods - (cubic-curve-method-9 () none 9) - (cubic-curve-method-10 () none 10) - (cubic-curve-method-11 () none 11) - (cubic-curve-method-12 () none 12) - (cubic-curve-method-13 () none 13) + (cubic-curve-method-9 (_type_ vector vector vector vector) none 9) + (cubic-curve-method-10 (_type_ vector float) vector 10) + (cubic-curve-method-11 (_type_ vector float) vector 11) + (cubic-curve-method-12 (_type_ vector float) vector 12) + (debug-draw-curve (_type_) none 13) ) ) + + +0 + + + + diff --git a/goal_src/jak2/engine/physics/trajectory.gc b/goal_src/jak2/engine/physics/trajectory.gc index 1ba7f3768e..4bc878da55 100644 --- a/goal_src/jak2/engine/physics/trajectory.gc +++ b/goal_src/jak2/engine/physics/trajectory.gc @@ -7,3 +7,538 @@ ;; DECOMP BEGINS +(defmethod compute-trans-at-time trajectory ((obj trajectory) (arg0 float) (arg1 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 arg1)) + (let ((a3-0 (-> obj initial-position)) + (t0-0 (-> obj initial-velocity)) + (f0-0 arg0) + ) + (.lvf vf2 (&-> t0-0 quad)) + (.lvf vf1 (&-> a3-0 quad)) + (let ((a3-1 f0-0)) + (.mov vf3 a3-1) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> v1-0 quad) vf4) + ) + (+! (-> arg1 y) (* 0.5 arg0 arg0 (-> obj gravity))) + arg1 + ) + ) + +(defmethod compute-transv-at-time trajectory ((obj trajectory) (arg0 float) (arg1 vector)) + (set! (-> arg1 quad) (-> obj initial-velocity quad)) + (+! (-> arg1 y) (* arg0 (-> obj gravity))) + arg1 + ) + +(defmethod compute-time-until-apex trajectory ((obj trajectory)) + (/ (- (-> obj initial-velocity y)) (-> obj gravity)) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod setup-from-to-duration! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (set! (-> obj initial-position quad) (-> arg0 quad)) + (set! (-> obj gravity) arg3) + (set! (-> obj time) arg2) + (let ((f0-3 (/ (vector-vector-xz-distance arg1 arg0) arg2))) + (vector-! (-> obj initial-velocity) arg1 arg0) + (vector-xz-normalize! (-> obj initial-velocity) f0-3) + ) + (set! (-> obj initial-velocity y) (- (/ (- (-> arg1 y) (-> arg0 y)) arg2) (* 0.5 arg2 (-> obj gravity)))) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod setup-from-to-xz-vel! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (let ((f0-1 (/ (vector-vector-xz-distance arg1 arg0) arg2))) + (setup-from-to-duration! obj arg0 arg1 f0-1 arg3) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod setup-from-to-y-vel! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (let* ((f0-0 arg2) + (f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3))) + (f0-3 900.0) + ) + (when (>= f1-3 0.0) + (let ((f0-4 (sqrtf f1-3))) + (set! f0-3 (fmax (/ (- (- arg2) f0-4) arg3) (/ (+ (- arg2) f0-4) arg3))) + ) + ) + (setup-from-to-duration! obj arg0 arg1 f0-3 arg3) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod setup-from-to-height! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (let* ((f0-1 (+ arg2 (fmax (-> arg0 y) (-> arg1 y)))) + (f1-4 (* 2.0 (- (-> arg0 y) f0-1) arg3)) + (f0-4 4096.0) + ) + (if (< 0.0 f1-4) + (set! f0-4 (sqrtf f1-4)) + ) + (setup-from-to-y-vel! obj arg0 arg1 f0-4 arg3) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 16 trajectory) has a return type of none, but the expression builder found a return statement. +(defmethod setup-from-to-duration-and-height! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (let ((f0-1 (- (-> arg1 y) (-> arg0 y)))) + (cond + ((= f0-1 0.0) + (let ((t9-0 (method-of-type trajectory setup-from-to-duration!)) + (v1-2 arg2) + (f0-3 (* -8.0 arg3)) + (f1-3 arg2) + ) + (t9-0 obj arg0 arg1 v1-2 (/ f0-3 (* f1-3 f1-3))) + ) + (return 0) + ) + ((and (< 0.0 f0-1) (< 0.0 arg3) (< arg3 f0-1)) + (set! arg3 f0-1) + ) + ((and (< f0-1 0.0) (< arg3 0.0) (< f0-1 arg3)) + (set! arg3 f0-1) + ) + ) + (let* ((f1-14 (/ (- arg3 f0-1) arg3)) + (f0-6 -2.0) + (f1-18 (/ (- 1.0 f1-14) (- arg2 (* arg2 (sqrtf f1-14))))) + (f0-8 (* f0-6 (* f1-18 f1-18) arg3)) + ) + (setup-from-to-duration! obj arg0 arg1 arg2 f0-8) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw trajectory ((obj trajectory)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 10) + ) + (set! (-> s4-0 quad) (-> obj initial-position quad)) + (dotimes (s2-0 s3-0) + (set! (-> s5-0 quad) (-> s4-0 quad)) + (let ((f0-1 (* (-> obj time) (/ (+ 1.0 (the float s2-0)) (the float s3-0))))) + (compute-trans-at-time obj f0-1 s4-0) + ) + (add-debug-line #t (bucket-id bucket-318) s5-0 s4-0 (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1)) + ) + ) + 0 + (none) + ) + +(defmethod initialize impact-control ((obj impact-control) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 collide-spec)) + (set! (-> obj start-time) (-> self clock frame-counter)) + (set! (-> obj process) (the-as (pointer process-drawable) (process->ppointer arg0))) + (set! (-> obj joint) arg1) + (set! (-> obj radius) arg2) + (set! (-> obj collide-with) (logclear arg3 (collide-spec water))) + (set! (-> obj trans 0 quad) (the-as uint128 0)) + (set! (-> obj trans 1 quad) (the-as uint128 0)) + obj + ) + +;; WARN: Return type mismatch int vs none. +(defmethod update-from-cspace impact-control ((obj impact-control)) + (when (>= (-> obj joint) 0) + (set! (-> obj trans 1 quad) (-> obj trans 0 quad)) + (vector<-cspace! (the-as vector (-> obj trans)) (-> obj process 0 node-list data (-> obj joint))) + (vector-! (-> obj dir) (the-as vector (-> obj trans)) (-> obj trans 1)) + ) + 0 + (none) + ) + +(defmethod impact-control-method-11 impact-control ((obj impact-control) (arg0 collide-query) (arg1 process) (arg2 pat-surface)) + (set! (-> arg0 start-pos quad) (-> obj trans 1 quad)) + (set! (-> arg0 move-dist quad) (-> obj dir quad)) + (let ((v1-2 (ppointer->process (-> obj process))) + (a0-6 arg0) + ) + (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-process1) #f) + (set! (-> a0-6 ignore-pat) arg2) + (set! (-> a0-6 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* arg0))) + (when (and arg1 (>= f30-0 0.0) (>= 0.0 (vector-dot (-> arg0 best-other-tri normal) (-> obj dir)))) + (let* ((s3-0 (new 'stack-no-clear 'touching-shapes-entry)) + (s2-0 (-> arg0 best-other-tri collide-ptr)) + (v1-12 (if (type? s2-0 collide-shape-prim) + (the-as collide-shape-prim s2-0) + ) + ) + ) + (set! (-> s3-0 cshape1) #f) + (set! (-> s3-0 cshape2) (if v1-12 + (-> v1-12 cshape) + ) + ) + (set! (-> s3-0 resolve-u) (the int f30-0)) + (set! (-> s3-0 head) #f) + (send-event + arg1 + 'impact-control + :from (if v1-12 + (-> v1-12 cshape process) + arg1 + ) + #f + s3-0 + obj + arg0 + ) + ) + ) + f30-0 + ) + ) + +(defmethod initialize point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector)) + (set! (-> obj trans 0 quad) (-> arg0 quad)) + (set! (-> obj trans 1 quad) (-> arg1 quad)) + obj + ) + +(defmethod point-tracker-method-10 point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (cond + ((>= 0.0 arg3) + (set! (-> arg0 quad) (-> arg1 quad)) + ) + ((>= arg3 1.0) + (set! (-> arg0 quad) (-> arg2 quad)) + ) + (else + (let ((a1-1 arg0)) + (let ((v1-3 arg2) + (a0-6 (vector-! (new 'stack-no-clear 'vector) arg1 arg2)) + (f0-3 (- 1.0 arg3)) + ) + (.lvf vf2 (&-> a0-6 quad)) + (.lvf vf1 (&-> v1-3 quad)) + (let ((v1-4 f0-3)) + (.mov vf3 v1-4) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a1-1 quad) vf4) + (vector-lerp! arg0 a1-1 arg2 arg3) + ) + ) + ) + arg0 + ) + ) + +(defmethod point-tracker-method-11 point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) + (with-pp + (let ((v1-1 (point-tracker-method-10 obj (new 'stack-no-clear 'vector) arg1 arg2 arg3))) + (vector-! arg0 v1-1 arg1) + ) + (vector-float*! arg0 arg0 (-> pp clock frames-per-second)) + arg0 + ) + ) + +;; WARN: Return type mismatch basic vs none. +(defmethod combo-tracker-method-13 combo-tracker ((obj combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float)) + (cond + ((send-event (handle->process arg0) 'combo) + (let ((gp-1 (handle->process arg0))) + (if (type? gp-1 process-focusable) + (empty) + ) + ) + ) + (else + (let ((s1-0 (new 'stack-no-clear 'sphere)) + (s2-1 ((method-of-type array new) + (the-as symbol (new 'stack-no-clear 'array 'collide-shape 32)) + array + collide-shape + 32 + ) + ) + ) + (sphere<-vector+r! s1-0 arg1 arg2) + (let ((t9-4 (method-of-object *actor-hash* spatial-hash-method-36))) + (-> s2-1 data) + (-> s2-1 allocated-length) + (set! (-> s2-1 length) (the-as int (t9-4))) + ) + (let ((gp-2 (find-nearest-focusable + (the-as (array collide-shape) s2-1) + arg1 + arg2 + (the-as search-info-flag (if (= arg4 65536.0) + 515 + 595 + ) + ) + (search-info-flag) + arg3 + (the-as vector #f) + arg4 + ) + ) + ) + (if (type? gp-2 process-focusable) + (empty) + ) + ) + ) + ) + ) + (none) + ) + +(defmethod combo-tracker-method-12 combo-tracker ((obj combo-tracker) (arg0 vector) (arg1 vector) (arg2 process) (arg3 time-frame)) + (initialize obj arg0 arg1) + (set! (-> obj target) (process->handle arg2)) + (set! (-> obj move-start-time) arg3) + obj + ) + +(defmethod point-tracker-method-11 combo-tracker ((obj combo-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((v1-1 (point-tracker-method-10 obj (new 'stack-no-clear 'vector) arg1 arg2 arg3))) + (vector-! arg0 v1-1 arg1) + ) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'nav-control) + (let* ((s3-0 (send-event-function (handle->process (-> obj target)) a1-4)) + (s4-1 (if (type? s3-0 nav-control) + s3-0 + ) + ) + ) + (when s4-1 + (let ((a2-3 ((method-of-type nav-control nav-control-method-11) (the-as nav-control s4-1) arg1))) + (if a2-3 + ((method-of-type nav-control nav-control-method-20) (the-as nav-control s4-1) arg1 a2-3 arg0 #x45000000 #f #f) + (set! (-> arg0 quad) (the-as uint128 0)) + ) + ) + ) + ) + ) + (let ((v1-12 arg0)) + (.lvf vf1 (&-> arg0 quad)) + (let ((f0-0 (-> pp clock frames-per-second))) + (.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-12 quad) vf1) + ) + arg0 + ) + ) + ) + +(defun traj2d-calc-initial-speed-using-tilt ((arg0 traj2d-params)) + (let ((f0-4 (* (- (* (-> arg0 x) (tan (-> arg0 initial-tilt))) (-> arg0 y)) (/ 2.0 (-> arg0 gravity))))) + (cond + ((< 0.0 f0-4) + (set! (-> arg0 time) (sqrtf f0-4)) + (set! (-> arg0 initial-speed) (/ (-> arg0 x) (* (-> arg0 time) (cos (-> arg0 initial-tilt))))) + #t + ) + (else + (set! (-> arg0 time) 0.0) + (set! (-> arg0 initial-speed) 0.0) + #f + ) + ) + ) + ) + +(defun traj3d-calc-initial-velocity-using-tilt ((arg0 traj3d-params)) + (vector-! (-> arg0 diff) (-> arg0 dest) (-> arg0 src)) + (let ((s5-0 (new 'stack-no-clear 'traj2d-params))) + (let ((v1-1 (-> arg0 diff))) + (set! (-> s5-0 x) (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) + ) + (set! (-> s5-0 y) (-> arg0 diff y)) + (set! (-> s5-0 gravity) (-> arg0 gravity)) + (set! (-> s5-0 initial-tilt) (-> arg0 initial-tilt)) + (cond + ((traj2d-calc-initial-speed-using-tilt s5-0) + (set! (-> arg0 time) (-> s5-0 time)) + (let* ((f26-0 (atan (-> arg0 diff x) (-> arg0 diff z))) + (f30-0 (-> arg0 initial-tilt)) + (f24-0 (cos f30-0)) + (f28-0 (-> s5-0 initial-speed)) + ) + (set! (-> arg0 initial-speed) f28-0) + (set! (-> arg0 initial-velocity x) (* f28-0 f24-0 (sin f26-0))) + (set! (-> arg0 initial-velocity z) (* f28-0 f24-0 (cos f26-0))) + (set! (-> arg0 initial-velocity y) (* f28-0 (sin f30-0))) + ) + (set! (-> arg0 initial-velocity w) 1.0) + #t + ) + (else + (set! (-> arg0 time) 0.0) + (set! (-> arg0 initial-speed) 0.0) + (vector-reset! (-> arg0 initial-velocity)) + #f + ) + ) + ) + ) + +;; WARN: Return type mismatch int vs none. +(defmethod cubic-curve-method-9 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (set! (-> obj mat vector 0 quad) (-> arg0 quad)) + (set! (-> obj mat vector 1 quad) (-> arg1 quad)) + (let ((v1-2 (new 'stack-no-clear 'trajectory))) + (vector-! (-> v1-2 initial-velocity) arg2 arg0) + (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) 3.0) + (let ((t1-7 (-> v1-2 initial-position))) + (let ((a1-3 (-> v1-2 initial-position))) + (let ((a3-2 arg1)) + (let ((t2-1 -2.0)) + (.mov vf7 t2-1) + ) + (.lvf vf5 (&-> a3-2 quad)) + ) + (.lvf vf4 (&-> a1-3 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 (&-> t1-7 quad) vf6) + ) + (vector-! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) + (set! (-> obj mat vector 2 quad) (-> v1-2 initial-position quad)) + (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) -2.0) + (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1) + (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) + (set! (-> obj mat trans quad) (-> v1-2 initial-position quad)) + ) + (dotimes (v1-5 4) + (set! (-> obj mat vector v1-5 w) 0.0) + ) + 0 + (none) + ) + ) + +(defmethod cubic-curve-method-10 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) + (let ((v1-0 (new 'stack-no-clear 'trajectory))) + (let ((f0-1 (* arg1 arg1))) + (set-vector! (-> v1-0 initial-position) 1.0 arg1 f0-1 (* f0-1 arg1)) + ) + (vector-matrix*! arg0 (-> v1-0 initial-position) (-> obj mat)) + ) + (set! (-> arg0 w) 1.0) + arg0 + ) + +(defmethod cubic-curve-method-11 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) + (let ((v1-0 (new 'stack-no-clear 'trajectory))) + (set-vector! (-> v1-0 initial-position) 0.0 1.0 (* 2.0 arg1) (* 3.0 arg1 arg1)) + (vector-matrix*! arg0 (-> v1-0 initial-position) (-> obj mat)) + ) + (set! (-> arg0 w) 1.0) + arg0 + ) + +(defmethod cubic-curve-method-12 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) + (let ((v1-0 (new 'stack-no-clear 'trajectory))) + (set-vector! (-> v1-0 initial-position) 0.0 0.0 2.0 (* 6.0 arg1)) + (vector-matrix*! arg0 (-> v1-0 initial-position) (-> obj mat)) + ) + (set! (-> arg0 w) 1.0) + arg0 + ) + +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw-curve cubic-curve ((obj cubic-curve)) + (let ((s5-0 (new 'stack-no-clear 'trajectory)) + (s4-0 10) + ) + (cubic-curve-method-10 obj (-> s5-0 initial-velocity) 0.0) + (add-debug-x #t (bucket-id bucket-318) (-> s5-0 initial-velocity) *color-red*) + (dotimes (s3-0 s4-0) + (set! (-> s5-0 initial-position quad) (-> s5-0 initial-velocity quad)) + (let ((f0-2 (/ (+ 1.0 (the float s3-0)) (the float s4-0)))) + (cubic-curve-method-10 obj (-> s5-0 initial-velocity) f0-2) + ) + (add-debug-x #t (bucket-id bucket-318) (-> s5-0 initial-velocity) *color-red*) + (add-debug-line + #t + (bucket-id bucket-318) + (-> s5-0 initial-position) + (-> s5-0 initial-velocity) + *color-red* + #f + (the-as rgba -1) + ) + ) + ) + 0 + (none) + ) + + + + 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 a09a3eb5b9..d08c524cda 100644 --- a/goal_src/jak2/engine/spatial-hash/actor-hash-h.gc +++ b/goal_src/jak2/engine/spatial-hash/actor-hash-h.gc @@ -5,6 +5,9 @@ ;; name in dgo: actor-hash-h ;; dgos: ENGINE, GAME +;; NOTE - for trajectory +(define-extern *actor-hash* spatial-hash) + ;; DECOMP BEGINS (define *actor-list* (malloc 'global 1024)) diff --git a/goal_src/jak2/engine/target/board/board-h.gc b/goal_src/jak2/engine/target/board/board-h.gc index 8bbb04883e..eb7cf9025b 100644 --- a/goal_src/jak2/engine/target/board/board-h.gc +++ b/goal_src/jak2/engine/target/board/board-h.gc @@ -254,7 +254,7 @@ (set! (-> v1-55 ignore-process1) #f) (set! (-> v1-55 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) (set! (-> v1-55 solid-only) #t) - (set! (-> v1-55 action-mask) (the-as uint 1)) + (set! (-> v1-55 action-mask) (collide-action solid)) ) ) (and (if (fill-and-probe-using-spheres *collide-cache* gp-0) diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index 7437875af8..72eedec056 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -94,6 +94,7 @@ (build-conversions (-> self control transv)) ) +;; WARN: Return type mismatch cshape-moving-flags vs none. (defbehavior reverse-conversions target ((arg0 vector)) (let ((v1-1 (-> self control unknown-vector00))) (set! (-> self control unknown-float05) (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) @@ -141,6 +142,8 @@ (none) ) +;; ERROR: function was not converted to expressions. Cannot decompile. + (defun-debug target-print-stats ((arg0 target) (arg1 symbol)) (local-vars (sv-64 int) @@ -586,6 +589,7 @@ arg0 ) +;; WARN: Return type mismatch vector vs none. (defun vector<-pad-in-matrix! ((arg0 vector) (arg1 cpad-info) (arg2 matrix)) (let ((gp-0 (new 'stack-no-clear 'vector)) (t9-0 matrix-local->world) @@ -677,11 +681,11 @@ ) ) ) - (if (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame21)) (seconds 0.1)) - (set! (-> self control unknown-time-frame22) (-> self clock frame-counter)) + (if (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame22)) (seconds 0.1)) + (set! (-> self control unknown-time-frame23) (-> self clock frame-counter)) ) - (set! (-> self control unknown-time-frame21) (-> self clock frame-counter)) - (when (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame22)) (seconds 0.5)) + (set! (-> self control unknown-time-frame22) (-> self clock frame-counter)) + (when (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame23)) (seconds 0.5)) (let ((gp-0 (new 'stack-no-clear 'collide-query))) (let ((v1-34 (-> gp-0 bbox)) (a0-13 (-> self control trans)) @@ -717,10 +721,10 @@ (set! (-> v1-48 ignore-process0) #f) (set! (-> v1-48 ignore-process1) #f) (set! (-> v1-48 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-48 action-mask) (the-as uint 1)) + (set! (-> v1-48 action-mask) (collide-action solid)) ) (cond - ((and (>= (collide-cache-method-16 *collide-cache*) 0.0) + ((and (>= (collide-cache-method-16 *collide-cache* gp-0) 0.0) (< 0.8 (vector-dot (-> gp-0 best-other-tri normal) (-> self control unknown-vector25))) ) ) @@ -735,6 +739,7 @@ ) ) +;; WARN: Return type mismatch int vs none. (defbehavior target-log-trans target () (let ((v1-1 (-> self control unknown-word00))) (set! (-> self control unknown-time-frame-array00 v1-1) (-> self clock frame-counter)) @@ -1295,7 +1300,6 @@ ) (defun leg-ik-callback ((arg0 joint-mod-ik) (arg1 object) (arg2 object) (arg3 vector)) - "Callback for a target's leg IK joints." (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1393,8 +1397,8 @@ ) ) +;; WARN: Return type mismatch int vs none. (defbehavior target-update-ik target () - "Update a target's IK joints." (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1517,9 +1521,9 @@ (set! (-> v1-66 ignore-process0) #f) (set! (-> v1-66 ignore-process1) #f) (set! (-> v1-66 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-66 action-mask) (the-as uint 1)) + (set! (-> v1-66 action-mask) (collide-action solid)) ) - (let ((f30-0 (collide-cache-method-16 *collide-cache*))) + (let ((f30-0 (collide-cache-method-16 *collide-cache* gp-0))) (cond ((and (>= f30-0 0.0) (< 0.5 (-> gp-0 best-other-tri normal y))) (set! (-> s4-0 quad) (-> gp-0 best-other-tri normal quad)) @@ -1566,6 +1570,7 @@ ) ) +;; WARN: Return type mismatch int vs none. (defbehavior pre-collide-setup target () (if (>= (-> self clock frame-counter) (-> self control unknown-time-frame04)) (vector-normalize! @@ -1600,6 +1605,7 @@ (none) ) +;; WARN: Return type mismatch int vs none. (defbehavior level-setup target () (let ((gp-0 (-> self current-level))) (set! (-> self current-level) (level-get-target-inside *level*)) @@ -1616,19 +1622,20 @@ (none) ) +;; WARN: Return type mismatch int vs none. (defbehavior flag-setup target () (cond ((= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) (if (zero? (-> self control unknown-dword07)) (set! (-> self control unknown-dword07) - (the-as int (- (-> self clock frame-counter) (-> self control unknown-time-frame18))) + (the-as int (- (-> self clock frame-counter) (-> self control unknown-time-frame19))) ) ) - (set! (-> self control unknown-time-frame18) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame19) (-> self clock frame-counter)) (quaternion-copy! (-> self control unknown-quaternion04) (-> self control dir-targ)) ) (else - (set! (-> self control unknown-time-frame19) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame20) (-> self clock frame-counter)) (set! (-> self control unknown-dword07) 0) 0 ) @@ -1744,7 +1751,7 @@ ) ) (send-event *camera* 'reset-follow) - (set! (-> self control unknown-dword05) (the-as uint (-> self clock frame-counter))) + (set! (-> self control unknown-time-frame12) (-> self clock frame-counter)) (cond ((logtest? (focus-status mech indax) (-> self focus-status)) (if (not (and (-> self next-state) @@ -1894,24 +1901,25 @@ (none) ) +;; WARN: Return type mismatch int vs none. (defbehavior post-flag-setup target () (if (logtest? (-> self control status) (cshape-moving-flags t-wall t-act)) (set! (-> self control unknown-time-frame07) (-> self clock frame-counter)) ) (when (logtest? (-> self state-flags) (state-flags tinvul1)) - (if (< (logand (- (-> self clock frame-counter) (-> self control unknown-time-frame12)) 3) 1) + (if (< (logand (- (-> self clock frame-counter) (-> self control unknown-time-frame13)) 3) 1) (logior! (-> self draw status) (draw-control-status no-draw-bounds)) (logclear! (-> self draw status) (draw-control-status no-draw-bounds)) ) - (if (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame12)) - (-> self control unknown-time-frame13) + (if (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame13)) + (-> self control unknown-time-frame14) ) (target-timed-invulnerable-off self 1) ) ) (when (logtest? (state-flags tinvul2) (-> self state-flags)) - (if (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame14)) - (-> self control unknown-time-frame15) + (if (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame15)) + (-> self control unknown-time-frame16) ) (target-timed-invulnerable-off self 2) ) @@ -2431,6 +2439,7 @@ ) ) +;; WARN: Return type mismatch int vs none. (defbehavior target-calc-camera-pos target () (let ((s5-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) @@ -2467,7 +2476,7 @@ ) (vector<-cspace! gp-0 (-> self node-list data 6)) (cond - ((>= (+ (-> self clock frame-counter) (seconds -2)) (-> self control unknown-time-frame16)) + ((>= (+ (-> self clock frame-counter) (seconds -2)) (-> self control unknown-time-frame17)) (set! (-> self control unknown-vector15 quad) (-> s5-0 quad)) ) ((not (and (logtest? (-> self water flags) (water-flags under-water)) @@ -2478,7 +2487,7 @@ (-> self control unknown-vector15) gp-0 s5-0 - (* 0.0016666667 (the float (- (-> self clock frame-counter) (-> self control unknown-time-frame16)))) + (* 0.0016666667 (the float (- (-> self clock frame-counter) (-> self control unknown-time-frame17)))) ) ) (else @@ -2490,7 +2499,7 @@ 0.0 (fmin 1.0 - (* 0.0011111111 (the float (- (-> self clock frame-counter) (-> self control unknown-time-frame17)))) + (* 0.0011111111 (the float (- (-> self clock frame-counter) (-> self control unknown-time-frame18)))) ) ) ) @@ -2521,6 +2530,7 @@ (none) ) +;; WARN: Return type mismatch int vs none. (defbehavior joint-points target () (let ((f0-1 (* 0.00078125 (the float (-> self neck loock-at-count))))) (if (!= f0-1 0.0) @@ -2617,6 +2627,7 @@ (none) ) +;; WARN: Return type mismatch int vs none. (defbehavior do-target-gspot target () (cond ((and (logtest? (-> self control status) (cshape-moving-flags on-surface)) @@ -2734,7 +2745,7 @@ (set! (-> a2-3 ignore-process1) #f) (set! (-> a2-3 ignore-pat) (-> v1-52 pat-ignore-mask)) ) - (set! (-> a2-3 action-mask) (the-as uint 1)) + (set! (-> a2-3 action-mask) (collide-action solid)) (collide-shape-method-32 (-> self control) (-> self control transv) (the-as uint a2-3) #x45800000) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) @@ -2867,7 +2878,7 @@ (set! (-> a2-0 ignore-process1) #f) (set! (-> a2-0 ignore-pat) (-> v1-30 pat-ignore-mask)) ) - (set! (-> a2-0 action-mask) (the-as uint 1)) + (set! (-> a2-0 action-mask) (collide-action solid)) (collide-shape-method-32 (-> self control) (-> self control transv) (the-as uint a2-0) #x45800000) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) @@ -2994,7 +3005,7 @@ (set! (-> a2-0 ignore-process1) #f) (set! (-> a2-0 ignore-pat) (-> v1-29 pat-ignore-mask)) ) - (set! (-> a2-0 action-mask) (the-as uint 1)) + (set! (-> a2-0 action-mask) (collide-action solid)) (collide-shape-method-32 (-> self control) (-> self control transv) (the-as uint a2-0) #x45800000) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) @@ -3219,8 +3230,8 @@ self ) +;; WARN: Return type mismatch int vs none. (defmethod init-target target ((obj target) (arg0 continue-point) (arg1 symbol)) - "Initialize a target's properties." (local-vars (s1-0 int) (s2-0 int) (s3-0 int) (s4-0 int) (sv-16 collide-shape-prim-group)) (set! (-> obj tobot?) arg1) (set! (-> obj tobot-recorder) #f) @@ -3459,6 +3470,7 @@ (none) ) +;; WARN: Return type mismatch object vs none. (defbehavior target-init target ((arg0 continue-point)) (init-target self arg0 #f) (set! (-> self event-hook) (-> target-continue event)) @@ -3467,6 +3479,7 @@ (none) ) +;; WARN: Return type mismatch object vs none. (defbehavior tobot-init target ((arg0 symbol)) (init-target self (the-as continue-point #f) 'tobot) (set! (-> self name) "tobot") @@ -3487,7 +3500,6 @@ (none) ) -;; definition for function stop (defun stop ((arg0 symbol)) (when *target* (kill-by-name "target" *active-pool*) @@ -3497,9 +3509,7 @@ 0 ) -;; definition for function start (defun start ((arg0 symbol) (arg1 continue-point)) - "Kill the target process, set the game mode to the specified mode." (let ((v1-0 arg0)) (set! (-> *level* play?) (if (= v1-0 'play) #t @@ -3529,6 +3539,7 @@ *target* ) +;; WARN: Return type mismatch (pointer process) vs target. (defun tobot-start ((arg0 symbol)) (the-as target (process-spawn target @@ -3544,4 +3555,8 @@ (defun tobot-stop () (kill-by-name "tobot" *active-pool*) 0 - ) \ No newline at end of file + ) + + + + diff --git a/goal_src/jak2/engine/util/script-h.gc b/goal_src/jak2/engine/util/script-h.gc index fc3bff83ec..11c7a89305 100644 --- a/goal_src/jak2/engine/util/script-h.gc +++ b/goal_src/jak2/engine/util/script-h.gc @@ -7,6 +7,10 @@ (define-extern *load-state* load-state) +;; NOTE - for editable-player +(declare-type script-context structure) +(define-extern *syntax-context* script-context) +(define-extern *script-context* script-context) ;; DECOMP BEGINS diff --git a/goal_src/jak2/game.gp b/goal_src/jak2/game.gp index b37816d9e8..dbb2d28357 100644 --- a/goal_src/jak2/game.gp +++ b/goal_src/jak2/game.gp @@ -468,7 +468,7 @@ "collide/collide-shape.gc" "collide/collide-shape-rider.gc" "collide/collide.gc" -"collide/collide-planes.gc" +;; "collide/collide-planes.gc" "spatial-hash/spatial-hash.gc" "spatial-hash/actor-hash.gc" "gfx/merc/merc-death.gc" diff --git a/goal_src/jak2/kernel/gkernel-h.gc b/goal_src/jak2/kernel/gkernel-h.gc index e5ba7da23c..16938eecbe 100644 --- a/goal_src/jak2/kernel/gkernel-h.gc +++ b/goal_src/jak2/kernel/gkernel-h.gc @@ -583,6 +583,8 @@ ) ) +(define-extern sql-query (function string sql-result)) + (defmethod new sql-result ((allocation symbol) (type-to-make type) (arg0 uint)) "Allocate a new sql-result with enough room for arg0 entries in data." (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* arg0 4)))))) @@ -719,4 +721,4 @@ (defmacro scratchpad-object (type &key (offset 0)) "Access an object on the scratchpad." `(the-as ,type (&+ *fake-scratchpad-data* ,offset)) - ) \ No newline at end of file + ) diff --git a/goal_src/jak2/tools/editable-schema.sql b/goal_src/jak2/tools/editable-schema.sql new file mode 100644 index 0000000000..3ef75bf160 --- /dev/null +++ b/goal_src/jak2/tools/editable-schema.sql @@ -0,0 +1,204 @@ +-- They stored floats in SQL as strings, or atleast parse them as such, likely to get around the lack of IEEE support on the PS2 +-- `string->float` is used to convert results +-- Interestingly, ints are handled the same way with `string->int` +-- This means the kernel implementation is very simple and just returns an array of strings essentially + +-- They also use implicit joins :( + +-- All Queries / Partial Queries: +-- select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S' +-- select light_id,name,pos_x,pos_y,pos_z,r,dir_x,dir_y,dir_z,color0_r,color0_g,color0_b,color0_a,decay_start,ambient_point_ratio,brightness from light where level_name='~S' +-- select x,y,z from sample_point where level_info_id='~D' and source='manual' +-- select region_sphere.region_id,x,y,z,r from region,region_sphere where level_name='~S' and region.region_id=region_sphere.region_id +-- select region_face.region_face_id,idx,x,y,z from region,region_face,region_point where level_name='~S' and region.region_id=region_face.region_id and region_face.region_face_id=region_point.region_face_id +-- select region_face.region_id,region_face_id,kind,flags,radius from region,region_face where level_name='~S' and region.region_id=region_face.region_id +-- select region_id,level_name,tree,on_enter,on_exit,on_inside from region where level_name='~S' +-- select region_face_id from region_face where region_id=~D +-- select nav_edge_id,nav_node_id,nav_graph_id from nav_visible_nodes limit ~D,~D +-- select nav_edge_id,nav_node_id_1,nav_node_id_2,directionality,speed_limit,density,traffic_edge_flag,nav_clock_mask,nav_clock_type,width,minimap_edge_flag,nav_graph_id from nav_edge limit ~D,~D +-- select nav_node_id,x,y,z,level_name,angle,radius,nav_node_flag,nav_mesh_id,nav_graph_id from nav_node +-- select LAST_INSERT_ID() +-- select nav_graph_id from nav_graph where name='~S' +-- select nav_graph_id from nav_graph where name='~S' +-- insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual' +-- insert into region_face set kind='plane',region_id=~D,radius=~f +-- insert into region_face set kind='face',region_id=~D +-- insert into light set level_name='~S' +-- insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual' +-- insert into region_sphere set region_id=~D,x=~f,y=~f,z=~f,r=~f +-- insert into region_point set region_face_id=LAST_INSERT_ID(),idx=~D,x=~f,y=~f,z=~f +-- insert into region set level_name='~S',tree='~S' +-- insert nav_visible_nodes set +-- insert nav_edge set +-- insert nav_node set +-- insert into race_path set +-- update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D +-- update light set level_name='~S', name='~S' +-- update region set level_name='~S',tree='~S' +-- update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D +-- update nav_visible_nodes set +-- update nav_edge set +-- update nav_node set +-- delete from light where light_id=~D +-- delete from sample_point where level_info_id=~D and source='manual' +-- delete from region where region_id=~D +-- delete from region_face where region_id=~D +-- delete from region_point where region_face_id in ( +-- delete from region_sphere where region_id=~D +-- delete from nav_visible_nodes where +-- delete from nav_edge where +-- delete from nav_node where +-- delete from race_path where race='~s' and path=~d~% + +-- TODO - some of the above are partial and the following DDL queries don't take into account the extra info the full code +-- in context might provide. Re-evaluate when that code is fully and nicely decompiled + +-- NOTE this is SQLite3, NOT MySQL + +CREATE TABLE IF NOT EXISTS "level_info" ( + "level_info_id" INTEGER, + "name" TEXT, + "translate_x" REAL, + "translate_y" REAL, + "translate_z" REAL, + "last_update" TEXT, + "sample_point_update" TEXT, + PRIMARY KEY("level_info_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "light" ( + "light_id" INTEGER, + "name" TEXT, + "level_name" TEXT, + "pos_x" REAL, + "pos_y" REAL, + "pos_z" REAL, + "r" REAL, + "dir_x" REAL, + "dir_y" REAL, + "dir_z" REAL, + "color0_r" REAL, + "color0_g" REAL, + "color0_b" REAL, + "color0_a" REAL, + "decay_start" REAL, + "ambient_point_ratio" REAL, + "brightness" REAL, + PRIMARY KEY("light_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "nav_edge" ( + "nav_edge_id" INTEGER NOT NULL, + "nav_graph_id" INTEGER NOT NULL, + "nav_node_id_1" INTEGER, + "nav_node_id_2" INTEGER, + "directionality" TEXT, + "speed_limit" NUMERIC, + "density" NUMERIC, + "traffic_edge_flag" NUMERIC, + "nav_clock_mask" NUMERIC, + "nav_clock_type" TEXT, + "width" NUMERIC, + "minimap_edge_flag" NUMERIC, + FOREIGN KEY("nav_node_id_2") REFERENCES "nav_node"("nav_node_id"), + FOREIGN KEY("nav_graph_id") REFERENCES "nav_graph"("nav_graph_id"), + FOREIGN KEY("nav_node_id_1") REFERENCES "nav_node"("nav_node_id"), + PRIMARY KEY("nav_edge_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "nav_graph" ( + "nav_graph_id" INTEGER, + "name" TEXT, + PRIMARY KEY("nav_graph_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "nav_mesh" ( + "nav_mesh_id" INTEGER, + PRIMARY KEY("nav_mesh_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "nav_node" ( + "nav_node_id" INTEGER NOT NULL, + "nav_graph_id" INTEGER NOT NULL, + "nav_mesh_id" INTEGER NOT NULL, + "x" REAL, + "y" REAL, + "z" REAL, + "level_name" TEXT, + "angle" REAL, + "radius" REAL, + "nav_node_flag" NUMERIC, + FOREIGN KEY("nav_mesh_id") REFERENCES "nav_mesh"("nav_mesh_id"), + FOREIGN KEY("nav_graph_id") REFERENCES "nav_graph"("nav_graph_id"), + PRIMARY KEY("nav_node_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "nav_visible_nodes" ( + "nav_node_id" INTEGER NOT NULL, + "nav_graph_id" INTEGER NOT NULL, + "nav_edge_id" INTEGER NOT NULL, + FOREIGN KEY("nav_edge_id") REFERENCES "nav_mesh"("nav_mesh_id"), + FOREIGN KEY("nav_graph_id") REFERENCES "nav_graph"("nav_graph_id"), + PRIMARY KEY("nav_node_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "race_path" ( + "race_path_id" INTEGER, + "race" TEXT, + "path" INTEGER, + PRIMARY KEY("race_path_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "region" ( + "region_id" INTEGER NOT NULL, + "level_name" TEXT, + "flags" NUMERIC, + "tree" TEXT, + "on_enter" TEXT, + "on_exit" TEXT, + "on_inside" TEXT, + PRIMARY KEY("region_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "region_face" ( + "region_face_id" INTEGER NOT NULL, + "region_id" INTEGER NOT NULL, + "idx" INTEGER, + "kind" TEXT, + "radius" REAL, + FOREIGN KEY("region_id") REFERENCES "region"("region_id"), + PRIMARY KEY("region_face_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "region_point" ( + "region_point_id" INTEGER, + "region_face_id" INTEGER NOT NULL, + "idx" INTEGER, + "x" REAL, + "y" REAL, + "z" REAL, + FOREIGN KEY("region_face_id") REFERENCES "region_face"("region_face_id"), + PRIMARY KEY("region_point_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "region_sphere" ( + "region_sphere_id" INTEGER, + "region_id" INTEGER, + "x" REAL, + "y" REAL, + "z" REAL, + "r" REAL, + FOREIGN KEY("region_id") REFERENCES "region"("region_id"), + PRIMARY KEY("region_sphere_id" AUTOINCREMENT) +); + +CREATE TABLE IF NOT EXISTS "sample_point" ( + "sample_point_id" INTEGER, + "level_info_id" INTEGER NOT NULL, + "source" TEXT, + "x" REAL, + "y" REAL, + "z" REAL, + FOREIGN KEY("level_info_id") REFERENCES "level_info"("level_info_id"), + PRIMARY KEY("sample_point_id" AUTOINCREMENT) +); diff --git a/scripts/gsrc/code_retention/code_retention.py b/scripts/gsrc/code_retention/code_retention.py index a2c2a44293..cac82b1c76 100644 --- a/scripts/gsrc/code_retention/code_retention.py +++ b/scripts/gsrc/code_retention/code_retention.py @@ -114,7 +114,7 @@ def lookahead_for_code(lines, index): # returns form, or none def is_line_start_of_form(line): - if line.lstrip().startswith(";"): + if line.lstrip().startswith(";") or "(when *debug-segment*" in line: return None matches = re.search(r"\(\s*([^\s.]*)\s+", line) if matches is not None: diff --git a/scripts/gsrc/update-from-decomp.py b/scripts/gsrc/update-from-decomp.py index 3b10d1b8ac..c40c9b92e3 100644 --- a/scripts/gsrc/update-from-decomp.py +++ b/scripts/gsrc/update-from-decomp.py @@ -111,6 +111,7 @@ def should_ignore_line(line): return True return False +# TODO - ignore brackets inside strings! decomp_file_path = "./decompiler_out/{}/{}_disasm.gc".format(args.game, args.file) with open(decomp_file_path) as f: diff --git a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc index 108eca152f..69f826f5e8 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc @@ -1761,12 +1761,7 @@ ;; definition for function cam-collision-record-draw ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -;; WARN: Function may read a register that is not set: t0 -;; WARN: Function may read a register that is not set: t1 -;; WARN: Function may read a register that is not set: t2 -;; WARN: Function may read a register that is not set: t3 (defun cam-collision-record-draw () - (local-vars (t0-0 none) (t1-0 none) (t2-0 none) (t3-0 none)) (cond ((cpad-pressed? 0 down) (cam-collision-record-step 1) @@ -1806,128 +1801,115 @@ (set! (-> gp-0 y) 127) (set! (-> gp-0 z) 127) (set! (-> gp-0 w) 128) - (let ((t9-7 camera-line-rel-len) - (a0-12 (-> (the-as cam-collision-record s5-0) pos)) - (a1-3 (-> (the-as cam-collision-record s5-0) vel)) - (a2-1 (fmax 81.92 (vector-length (-> (the-as cam-collision-record s5-0) vel)))) - (a3-0 s4-0) + (camera-line-rel-len + (-> (the-as cam-collision-record s5-0) pos) + (-> (the-as cam-collision-record s5-0) vel) + (fmax 81.92 (vector-length (-> (the-as cam-collision-record s5-0) vel))) + s4-0 + ) + (let ((s3-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s3-0 start-pos quad) (-> (the-as cam-collision-record s5-0) pos quad)) + (set! (-> s3-0 move-dist quad) (-> (the-as cam-collision-record s5-0) vel quad)) + (let ((v1-47 s3-0)) + (set! (-> v1-47 radius) (-> *CAMERA-bank* collide-move-rad)) + (set! (-> v1-47 collide-with) (collide-spec backgnd)) + (set! (-> v1-47 ignore-process0) #f) + (set! (-> v1-47 ignore-process1) #f) + (set! (-> v1-47 ignore-pat) (new 'static 'pat-surface :nocamera #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-47 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* s3-0)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (format + *stdcon* + "frame ~D iteration ~D travel ~f~%" + (-> (the-as cam-collision-record s5-0) frame) + (-> (the-as cam-collision-record s5-0) iteration) + f30-0 ) - (t9-7 a0-12 a1-3 a2-1 a3-0) - (let ((s3-0 (new 'stack-no-clear 'collide-query))) - (set! (-> s3-0 start-pos quad) (-> (the-as cam-collision-record s5-0) pos quad)) - (set! (-> s3-0 move-dist quad) (-> (the-as cam-collision-record s5-0) vel quad)) - (let ((v1-47 s3-0)) - (set! (-> v1-47 radius) (-> *CAMERA-bank* collide-move-rad)) - (set! (-> v1-47 collide-with) (collide-spec backgnd)) - (set! (-> v1-47 ignore-process0) #f) - (set! (-> v1-47 ignore-process1) #f) - (set! (-> v1-47 ignore-pat) (new 'static 'pat-surface :nocamera #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-47 action-mask) (the-as uint 1)) + (format + *stdcon* + "mzo ~M psz ~M vop ~f~%" + (-> (the-as cam-collision-record s5-0) min-z-override) + (-> (the-as cam-collision-record s5-0) string-push-z) + (-> (the-as cam-collision-record s5-0) view-off-param) ) - (let ((f30-0 - (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector s3-0) - (the-as vector a2-1) - (the-as float a3-0) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - ) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (format - *stdcon* - "frame ~D iteration ~D travel ~f~%" - (-> (the-as cam-collision-record s5-0) frame) - (-> (the-as cam-collision-record s5-0) iteration) - f30-0 - ) - (format - *stdcon* - "mzo ~M psz ~M vop ~f~%" - (-> (the-as cam-collision-record s5-0) min-z-override) - (-> (the-as cam-collision-record s5-0) string-push-z) - (-> (the-as cam-collision-record s5-0) view-off-param) - ) - (format - *stdcon* - "pos ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) pos x) - (-> (the-as cam-collision-record s5-0) pos y) - (-> (the-as cam-collision-record s5-0) pos z) - ) - (format - *stdcon* - "vel ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) vel x) - (-> (the-as cam-collision-record s5-0) vel y) - (-> (the-as cam-collision-record s5-0) vel z) - ) - (format - *stdcon* - "des ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) desired-pos x) - (-> (the-as cam-collision-record s5-0) desired-pos y) - (-> (the-as cam-collision-record s5-0) desired-pos z) - ) - (format - *stdcon* - "flt ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) view-flat x) - (-> (the-as cam-collision-record s5-0) view-flat y) - (-> (the-as cam-collision-record s5-0) view-flat z) - ) - (format - *stdcon* - "cur ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) cam-tpos-cur x) - (-> (the-as cam-collision-record s5-0) cam-tpos-cur y) - (-> (the-as cam-collision-record s5-0) cam-tpos-cur z) - ) - (format - *stdcon* - "old ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) cam-tpos-old x) - (-> (the-as cam-collision-record s5-0) cam-tpos-old y) - (-> (the-as cam-collision-record s5-0) cam-tpos-old z) - ) - (format - *stdcon* - "smn ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) string-min-val x) - (-> (the-as cam-collision-record s5-0) string-min-val y) - (-> (the-as cam-collision-record s5-0) string-min-val z) - ) - (format - *stdcon* - "smx ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) string-max-val x) - (-> (the-as cam-collision-record s5-0) string-max-val y) - (-> (the-as cam-collision-record s5-0) string-max-val z) - ) - (format - *stdcon* - "vof ~M ~M ~M~%" - (-> (the-as cam-collision-record s5-0) view-off x) - (-> (the-as cam-collision-record s5-0) view-off y) - (-> (the-as cam-collision-record s5-0) view-off z) - ) - (when (>= f30-0 0.0) - (camera-line (the-as vector (-> s3-0 best-other-tri)) (-> s3-0 best-other-tri vertex 1) s4-0) - (camera-line (-> s3-0 best-other-tri vertex 1) (-> s3-0 best-other-tri vertex 2) s4-0) - (camera-line (-> s3-0 best-other-tri vertex 2) (the-as vector (-> s3-0 best-other-tri)) s4-0) - (vector-! s2-0 (the-as vector (+ (the-as int s5-0) 0)) (-> s3-0 best-other-tri intersect)) - (vector-normalize! s2-0 1.0) - (camera-line-rel-len (-> s3-0 best-other-tri intersect) s2-0 (-> *CAMERA-bank* collide-move-rad) gp-0) - (camera-line-rel-len - (-> s3-0 best-other-tri intersect) - (-> s3-0 best-other-tri normal) - (-> *CAMERA-bank* collide-move-rad) - gp-0 - ) + (format + *stdcon* + "pos ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) pos x) + (-> (the-as cam-collision-record s5-0) pos y) + (-> (the-as cam-collision-record s5-0) pos z) + ) + (format + *stdcon* + "vel ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) vel x) + (-> (the-as cam-collision-record s5-0) vel y) + (-> (the-as cam-collision-record s5-0) vel z) + ) + (format + *stdcon* + "des ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) desired-pos x) + (-> (the-as cam-collision-record s5-0) desired-pos y) + (-> (the-as cam-collision-record s5-0) desired-pos z) + ) + (format + *stdcon* + "flt ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) view-flat x) + (-> (the-as cam-collision-record s5-0) view-flat y) + (-> (the-as cam-collision-record s5-0) view-flat z) + ) + (format + *stdcon* + "cur ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) cam-tpos-cur x) + (-> (the-as cam-collision-record s5-0) cam-tpos-cur y) + (-> (the-as cam-collision-record s5-0) cam-tpos-cur z) + ) + (format + *stdcon* + "old ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) cam-tpos-old x) + (-> (the-as cam-collision-record s5-0) cam-tpos-old y) + (-> (the-as cam-collision-record s5-0) cam-tpos-old z) + ) + (format + *stdcon* + "smn ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) string-min-val x) + (-> (the-as cam-collision-record s5-0) string-min-val y) + (-> (the-as cam-collision-record s5-0) string-min-val z) + ) + (format + *stdcon* + "smx ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) string-max-val x) + (-> (the-as cam-collision-record s5-0) string-max-val y) + (-> (the-as cam-collision-record s5-0) string-max-val z) + ) + (format + *stdcon* + "vof ~M ~M ~M~%" + (-> (the-as cam-collision-record s5-0) view-off x) + (-> (the-as cam-collision-record s5-0) view-off y) + (-> (the-as cam-collision-record s5-0) view-off z) + ) + (when (>= f30-0 0.0) + (camera-line (the-as vector (-> s3-0 best-other-tri)) (-> s3-0 best-other-tri vertex 1) s4-0) + (camera-line (-> s3-0 best-other-tri vertex 1) (-> s3-0 best-other-tri vertex 2) s4-0) + (camera-line (-> s3-0 best-other-tri vertex 2) (the-as vector (-> s3-0 best-other-tri)) s4-0) + (vector-! s2-0 (the-as vector (+ (the-as int s5-0) 0)) (-> s3-0 best-other-tri intersect)) + (vector-normalize! s2-0 1.0) + (camera-line-rel-len (-> s3-0 best-other-tri intersect) s2-0 (-> *CAMERA-bank* collide-move-rad) gp-0) + (camera-line-rel-len + (-> s3-0 best-other-tri intersect) + (-> s3-0 best-other-tri normal) + (-> *CAMERA-bank* collide-move-rad) + gp-0 ) ) ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc index 2f8dcc89a1..17fe8edff5 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc @@ -1253,13 +1253,8 @@ ;; definition for function cam-string-find-position-rel! ;; INFO: Used lq/sq -;; WARN: Function may read a register that is not set: t0 -;; WARN: Function may read a register that is not set: t1 -;; WARN: Function may read a register that is not set: t2 -;; WARN: Function may read a register that is not set: t3 ;; WARN: new jak 2 until loop case, check carefully (defun cam-string-find-position-rel! ((arg0 vector)) - (local-vars (t0-0 none) (t1-0 none) (t2-0 none) (t3-0 none)) (let ((s5-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'collide-query)) @@ -1272,7 +1267,7 @@ (set! (-> s1-0 ignore-process0) #f) (set! (-> s1-0 ignore-process1) #f) (set! (-> s1-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) - (set! (-> s1-0 action-mask) (the-as uint 1)) + (set! (-> s1-0 action-mask) (collide-action solid)) ) (vector-flatten! s5-0 (-> *camera-combiner* inv-camera-rot vector 2) (-> *camera* local-down)) (if (= (vector-normalize-ret-len! s5-0 (- (+ 1024.0 (-> *CAMERA-bank* default-string-min-z)))) 0.0) @@ -1281,30 +1276,12 @@ (vector--float*! s5-0 s5-0 (-> *camera* local-down) (-> *CAMERA-bank* default-string-min-y)) (set! (-> arg0 quad) (-> s5-0 quad)) (until #f - (let ((t9-4 vector--float*!) - (a0-7 s4-0) - (a1-4 arg0) - (a2-2 (-> *camera* local-down)) - (a3-1 (-> *camera* settings target-height)) - ) - (t9-4 a0-7 a1-4 a2-2 a3-1) - (set! (-> s3-0 start-pos quad) (-> *camera* tpos-curr-adj quad)) - (set! (-> s3-0 move-dist quad) (-> arg0 quad)) - (if (< (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector s3-0) - a2-2 - (the-as float a3-1) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - 0.0 - ) - (return #t) - ) - ) + (vector--float*! s4-0 arg0 (-> *camera* local-down) (-> *camera* settings target-height)) + (set! (-> s3-0 start-pos quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> s3-0 move-dist quad) (-> arg0 quad)) + (if (< (fill-and-probe-using-line-sphere *collide-cache* s3-0) 0.0) + (return #t) + ) (set! f30-0 (cond ((>= -32768.0 f30-0) (format #t "cam-string didn't find a spot~%") @@ -1686,9 +1663,9 @@ (set! (-> v1-4 ignore-process0) #f) (set! (-> v1-4 ignore-process1) #f) (set! (-> v1-4 ignore-pat) arg2) - (set! (-> v1-4 action-mask) (the-as uint 1)) + (set! (-> v1-4 action-mask) (collide-action solid)) ) - ((method-of-object s4-0 collide-cache-method-13)) + (fill-using-line-sphere s4-0 s5-0) (let* ((f0-2 (vector-length (-> s5-0 move-dist))) (f28-0 (cond @@ -1912,9 +1889,9 @@ (set! (-> v1-5 ignore-process0) #f) (set! (-> v1-5 ignore-process1) #f) (set! (-> v1-5 ignore-pat) sv-768) - (set! (-> v1-5 action-mask) (the-as uint 1)) + (set! (-> v1-5 action-mask) (collide-action solid)) ) - ((method-of-object s0-0 collide-cache-method-13)) + (fill-using-line-sphere s0-0 s1-0) (let ((s1-1 (the-as object (-> s0-0 tris))) (f28-0 (/ 2048.0 f26-0)) (f26-1 (/ (+ -8192.0 f26-0) f26-0)) @@ -4233,21 +4210,16 @@ ;; definition for function cam-string-find-hidden ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -;; WARN: Function may read a register that is not set: t0 -;; WARN: Function may read a register that is not set: t1 -;; WARN: Function may read a register that is not set: t2 -;; WARN: Function may read a register that is not set: t3 (defbehavior cam-string-find-hidden camera-slave () - (local-vars (t0-0 none) (t1-0 none) (t2-0 none) (t3-0 none)) - (let* ((s5-0 (new 'stack-no-clear 'collide-query)) - (gp-0 (new 'stack-no-clear 'vector)) - (t9-0 vector--float*!) - (a0-0 (-> s5-0 move-dist)) - (a1-0 (-> *camera* tpos-curr-adj)) - (a2-0 (-> *camera* local-down)) - (a3-0 (-> *camera* settings target-height)) - ) - (t9-0 a0-0 a1-0 a2-0 a3-0) + (let ((s5-0 (new 'stack-no-clear 'collide-query)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (vector--float*! + (-> s5-0 move-dist) + (-> *camera* tpos-curr-adj) + (-> *camera* local-down) + (-> *camera* settings target-height) + ) (vector-! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> self string-trans)) (set! (-> s5-0 start-pos quad) (-> self string-trans quad)) (let ((s4-0 s5-0)) @@ -4256,21 +4228,10 @@ (set! (-> s4-0 ignore-process0) #f) (set! (-> s4-0 ignore-process1) #f) (set! (-> s4-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) - (set! (-> s4-0 action-mask) (the-as uint 1)) + (set! (-> s4-0 action-mask) (collide-action solid)) ) (cond - ((< (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector s5-0) - a2-0 - (the-as float a3-0) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - 0.0 - ) + ((< (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) (set! (-> self time-dist-too-far) (the-as uint 0)) 0 ) @@ -4294,13 +4255,7 @@ ;; definition for function cam-string-move ;; INFO: Used lq/sq -;; WARN: Function may read a register that is not set: a3 -;; WARN: Function may read a register that is not set: t0 -;; WARN: Function may read a register that is not set: t1 -;; WARN: Function may read a register that is not set: t2 -;; WARN: Function may read a register that is not set: t3 (defbehavior cam-string-move camera-slave () - (local-vars (a3-0 object) (t0-0 object) (t1-0 float) (t2-0 none) (t3-0 none)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -4336,180 +4291,134 @@ (.svf (&-> v1-7 quad) vf4) ) (vector-normalize! s5-0 1.0) - (let ((t9-2 vector-normalize-copy!) - (a0-7 s4-0) - (a1-7 (-> self view-flat)) - (a2-2 (the-as object 1.0)) - ) - (t9-2 a0-7 a1-7 (the-as float a2-2)) - (vector-cross! gp-0 s4-0 s5-0) - (cond - ((and (< (vector-length (-> self velocity)) (-> *CAMERA-bank* min-detectable-velocity)) - (< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity)) - ) - (set! (-> self string-vel-dir) (the-as uint 0)) - 0 - ) - ((< (cos 5461.3335) (vector-dot (-> *camera* local-down) s5-0)) - (set! (-> self string-vel-dir) (the-as uint 4)) - ) - ((< (vector-dot (-> *camera* local-down) s5-0) (- (cos 5461.3335))) - (set! (-> self string-vel-dir) (the-as uint 3)) - ) - ((< (cos 5461.3335) (vector-dot s4-0 s5-0)) - (set! (-> self string-vel-dir) (the-as uint 6)) - ) - ((< (vector-dot s4-0 s5-0) (- (cos 5461.3335))) - (set! (-> self string-vel-dir) (the-as uint 5)) - ) - ((< (vector-dot (-> *camera* local-down) gp-0) 0.0) - (set! (-> self string-vel-dir) (the-as uint 1)) - ) - (else - (set! (-> self string-vel-dir) (the-as uint 2)) - ) + (vector-normalize-copy! s4-0 (-> self view-flat) 1.0) + (vector-cross! gp-0 s4-0 s5-0) + (cond + ((and (< (vector-length (-> self velocity)) (-> *CAMERA-bank* min-detectable-velocity)) + (< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity)) + ) + (set! (-> self string-vel-dir) (the-as uint 0)) + 0 + ) + ((< (cos 5461.3335) (vector-dot (-> *camera* local-down) s5-0)) + (set! (-> self string-vel-dir) (the-as uint 4)) + ) + ((< (vector-dot (-> *camera* local-down) s5-0) (- (cos 5461.3335))) + (set! (-> self string-vel-dir) (the-as uint 3)) + ) + ((< (cos 5461.3335) (vector-dot s4-0 s5-0)) + (set! (-> self string-vel-dir) (the-as uint 6)) + ) + ((< (vector-dot s4-0 s5-0) (- (cos 5461.3335))) + (set! (-> self string-vel-dir) (the-as uint 5)) + ) + ((< (vector-dot (-> *camera* local-down) gp-0) 0.0) + (set! (-> self string-vel-dir) (the-as uint 1)) + ) + (else + (set! (-> self string-vel-dir) (the-as uint 2)) ) - (let ((s5-1 (new 'stack-no-clear 'collide-query))) - 0.0 - (let ((f30-2 1.0) - (s4-1 (-> s5-1 move-dist)) - (gp-1 0) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'collide-query))) + 0.0 + (let ((f30-2 1.0) + (s4-1 (-> s5-1 move-dist)) + (gp-1 0) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (when *debug-segment* + (if (>= (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) + (cam-collision-record-save (-> self string-trans) (-> self velocity) -1 'no-hit self) ) - (let ((s3-1 (new 'stack-no-clear 'vector))) - (when *debug-segment* - (when (>= (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) - (let ((t9-7 cam-collision-record-save) - (a0-16 (-> self string-trans)) - (a1-10 (-> self velocity)) - ) - (set! a2-2 -1) - (set! a3-0 'no-hit) - (set! t0-0 self) - (t9-7 a0-16 a1-10 (the-as int a2-2) (the-as symbol a3-0) (the-as camera-slave t0-0)) - ) - ) + ) + (while (and (< 0.01 f30-2) + (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (< gp-1 4)) + ) + (vector-float*! s4-1 (-> self velocity) f30-2) + (if *debug-segment* + (cam-collision-record-save (-> self string-trans) s4-1 gp-1 'normal self) ) - (while (and (< 0.01 f30-2) - (and (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) (< gp-1 4)) - ) - (vector-float*! s4-1 (-> self velocity) f30-2) - (when *debug-segment* - (let ((t9-8 cam-collision-record-save) - (a0-18 (-> self string-trans)) - (a1-11 s4-1) - ) - (set! a2-2 gp-1) - (set! a3-0 'normal) - (set! t0-0 self) - (t9-8 a0-18 a1-11 (the-as int a2-2) (the-as symbol a3-0) (the-as camera-slave t0-0)) - ) - ) - (let ((f28-0 - (cond - ((logtest? (-> self options) 32) - (set! (-> s5-1 start-pos quad) (-> self string-trans quad)) - (let ((s2-0 s5-1)) - (set! (-> s2-0 radius) (-> *CAMERA-bank* collide-move-rad)) - (set! (-> s2-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) - (set! (-> s2-0 ignore-process0) #f) - (set! (-> s2-0 ignore-process1) #f) - (set! (-> s2-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) - (set! (-> s2-0 action-mask) (the-as uint 1)) - ) - (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector s5-1) - (the-as vector a2-2) - (the-as float a3-0) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - ) - (else - -100000000.0 - ) - ) + (let ((f28-0 + (cond + ((logtest? (-> self options) 32) + (set! (-> s5-1 start-pos quad) (-> self string-trans quad)) + (let ((s2-0 s5-1)) + (set! (-> s2-0 radius) (-> *CAMERA-bank* collide-move-rad)) + (set! (-> s2-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (set! (-> s2-0 ignore-process0) #f) + (set! (-> s2-0 ignore-process1) #f) + (set! (-> s2-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) + (set! (-> s2-0 action-mask) (collide-action solid)) + ) + (fill-and-probe-using-line-sphere *collide-cache* s5-1) + ) + (else + -100000000.0 ) ) - (when *display-cam-los-debug* - (let ((t9-11 format) - (a0-23 *stdcon*) - (a1-14 "vp ~f vr ~f r ~f ta ~f~%") - ) - (set! a2-2 (vector-length s4-1)) - (set! a3-0 f30-2) - (set! t0-0 (/ (vector-length s4-1) f30-2)) - (set! t1-0 f28-0) - (t9-11 a0-23 a1-14 (the-as float a2-2) (the-as float a3-0) (the-as float t0-0) t1-0) - ) ) - (cond - ((>= f28-0 0.0) - (let* ((f1-10 (fmax 0.01 (/ 40.96 (vector-length s4-1)))) - (f0-22 (fmax 0.0 (- f28-0 f1-10))) - (v1-71 (-> self string-trans)) - ) - (let ((a0-24 (-> self string-trans))) - (.lvf vf2 (&-> s4-1 quad)) - (.lvf vf1 (&-> a0-24 quad)) - ) - (let ((a0-25 f0-22)) - (.mov vf3 a0-25) - ) - (.add.x.vf vf4 vf0 vf0 :mask #b1000) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) - (.svf (&-> v1-71 quad) vf4) - ) - (vector-! s3-1 (-> self string-trans) (-> s5-1 best-other-tri intersect)) - (vector-normalize! s3-1 1.0) - (let ((t9-13 vector-flatten!) - (a0-28 (-> self velocity)) - (a1-19 (-> self velocity)) - ) - (set! a2-2 s3-1) - (t9-13 a0-28 a1-19 (the-as vector a2-2)) - ) - (set! f30-2 (- f30-2 (* f30-2 f28-0))) - (+! gp-1 1) + ) + (if *display-cam-los-debug* + (format *stdcon* "vp ~f vr ~f r ~f ta ~f~%" (vector-length s4-1) f30-2 (/ (vector-length s4-1) f30-2) f28-0) + ) + (cond + ((>= f28-0 0.0) + (let* ((f1-10 (fmax 0.01 (/ 40.96 (vector-length s4-1)))) + (f0-22 (fmax 0.0 (- f28-0 f1-10))) + (v1-71 (-> self string-trans)) + ) + (let ((a0-24 (-> self string-trans))) + (.lvf vf2 (&-> s4-1 quad)) + (.lvf vf1 (&-> a0-24 quad)) ) - (else - (vector+! (-> self string-trans) (-> self string-trans) s4-1) - (set! f30-2 0.0) - ) - ) + (let ((a0-25 f0-22)) + (.mov vf3 a0-25) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> v1-71 quad) vf4) + ) + (vector-! s3-1 (-> self string-trans) (-> s5-1 best-other-tri intersect)) + (vector-normalize! s3-1 1.0) + (vector-flatten! (-> self velocity) (-> self velocity) s3-1) + (set! f30-2 (- f30-2 (* f30-2 f28-0))) + (+! gp-1 1) + ) + (else + (vector+! (-> self string-trans) (-> self string-trans) s4-1) + (set! f30-2 0.0) ) ) ) - (cond - ((zero? gp-1) - (set! (-> self options) (logand -1025 (-> self options))) - (if *display-cam-los-debug* - (format *stdcon* "not blocked~%") - ) + ) + ) + (cond + ((zero? gp-1) + (set! (-> self options) (logand -1025 (-> self options))) + (if *display-cam-los-debug* + (format *stdcon* "not blocked~%") ) - (else - (logior! (-> self options) 1024) - (if *display-cam-los-debug* - (format *stdcon* "blocked ~D ~f~%" gp-1 f30-2) - ) - (let ((gp-2 (new-stack-vector0)) - (f30-3 (vector-length (-> self view-flat))) - ) - (vector-! gp-2 (-> self string-trans) (-> *camera* tpos-curr-adj)) - (vector-flatten! gp-2 gp-2 (-> *camera* local-down)) - (let ((f28-1 (vector-length gp-2))) - (cond - ((< f28-1 f30-3) - (vector-normalize-copy! (-> self view-flat) gp-2 f28-1) - (set! (-> self min-z-override) f28-1) - ) - (else - (vector-normalize-copy! (-> self view-flat) gp-2 f30-3) - ) - ) + ) + (else + (logior! (-> self options) 1024) + (if *display-cam-los-debug* + (format *stdcon* "blocked ~D ~f~%" gp-1 f30-2) + ) + (let ((gp-2 (new-stack-vector0)) + (f30-3 (vector-length (-> self view-flat))) + ) + (vector-! gp-2 (-> self string-trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! gp-2 gp-2 (-> *camera* local-down)) + (let ((f28-1 (vector-length gp-2))) + (cond + ((< f28-1 f30-3) + (vector-normalize-copy! (-> self view-flat) gp-2 f28-1) + (set! (-> self min-z-override) f28-1) + ) + (else + (vector-normalize-copy! (-> self view-flat) gp-2 f30-3) ) ) ) @@ -5153,7 +5062,6 @@ ) ) :enter (behavior () - (local-vars (t0-0 none) (t1-0 none) (t2-0 none) (t3-0 none)) (when (not (-> self enter-has-run)) (if (-> self cam-entity) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) @@ -5240,14 +5148,13 @@ (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) (set! (-> self string-trans quad) (-> self desired-pos quad)) (vector-reset! (-> self velocity)) - (let* ((gp-2 (new 'stack-no-clear 'collide-query)) - (t9-13 vector--float*!) - (a0-20 (-> gp-2 start-pos)) - (a1-17 (-> *camera* tpos-curr-adj)) - (a2-9 (-> *camera* local-down)) - (a3-1 (-> *camera* settings target-height)) - ) - (t9-13 a0-20 a1-17 a2-9 a3-1) + (let ((gp-2 (new 'stack-no-clear 'collide-query))) + (vector--float*! + (-> gp-2 start-pos) + (-> *camera* tpos-curr-adj) + (-> *camera* local-down) + (-> *camera* settings target-height) + ) (vector-! (-> gp-2 move-dist) (-> self string-trans) (-> gp-2 start-pos)) (let ((s5-0 gp-2)) (set! (-> s5-0 radius) (-> *CAMERA-bank* collide-move-rad)) @@ -5255,20 +5162,9 @@ (set! (-> s5-0 ignore-process0) #f) (set! (-> s5-0 ignore-process1) #f) (set! (-> s5-0 ignore-pat) (the-as pat-surface (camera-master-method-16 *camera* #f))) - (set! (-> s5-0 action-mask) (the-as uint 1)) + (set! (-> s5-0 action-mask) (collide-action solid)) ) - (let ((f0-31 (fill-and-probe-using-line-sphere - *collide-cache* - (the-as vector gp-2) - a2-9 - (the-as float a3-1) - (the-as collide-spec t0-0) - (the-as process t1-0) - (the-as collide-tri-result t2-0) - (the-as pat-surface t3-0) - ) - ) - ) + (let ((f0-31 (fill-and-probe-using-line-sphere *collide-cache* gp-2))) (when (and (< 0.0 f0-31) (< f0-31 1.0)) (vector-float*! (-> gp-2 move-dist) (-> gp-2 move-dist) f0-31) (vector-flatten! (-> self view-flat) (-> gp-2 move-dist) (-> *camera* local-down)) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc index 156ca623ef..aad3b8ec11 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-cache-h_REF.gc @@ -153,13 +153,13 @@ :flag-assert #x1a00008670 (:methods (collide-cache-method-9 () none 9) - (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) + (fill-and-probe-using-line-sphere (_type_ collide-query) float 10) (fill-and-probe-using-spheres (_type_ collide-query) symbol 11) (collide-cache-method-12 (_type_ collide-query) none 12) - (collide-cache-method-13 () none 13) + (fill-using-line-sphere (_type_ collide-query) none 13) (fill-using-spheres (_type_ collide-query) none 14) (collide-cache-method-15 () none 15) - (collide-cache-method-16 (_type_) float 16) + (collide-cache-method-16 (_type_ collide-query) float 16) (probe-using-spheres (_type_ collide-query) symbol 17) (collide-cache-method-18 () none 18) (collide-cache-method-19 () none 19) 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 96ae8cf5f0..32b65f6fe2 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc @@ -28,7 +28,7 @@ (best-my-prim basic :offset 120) (move-vec vector :inline :offset 224) (best-u float :offset 112) - (action-mask uint32 :offset-assert 352) + (action-mask collide-action :offset-assert 352) (local-box4w bounding-box4w :inline :offset-assert 368) (search-box bounding-box4w :inline :offset-assert 400) (search-vector vector4w :inline :offset-assert 432) diff --git a/test/decompiler/reference/jak2/engine/collide/find-nearest_REF.gc b/test/decompiler/reference/jak2/engine/collide/find-nearest_REF.gc new file mode 100644 index 0000000000..0875f0cf8c --- /dev/null +++ b/test/decompiler/reference/jak2/engine/collide/find-nearest_REF.gc @@ -0,0 +1,579 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type search-info +(deftype search-info (structure) + ((point vector :inline :offset-assert 0) + (best-point vector :inline :offset-assert 16) + (match-handle handle :offset-assert 32) + (match basic :offset-assert 40) + (best float :offset-assert 44) + (radius float :offset-assert 48) + (rating search-info-flag :offset-assert 52) + (require search-info-flag :offset-assert 56) + (mask search-info-flag :offset-assert 60) + (rot-base vector :inline :offset-assert 64) + (ack-point vector :inline :offset-assert 80) + (rot-range float :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x64 + :flag-assert #x900000064 + ) + +;; definition for method 3 of type search-info +(defmethod inspect search-info ((obj search-info)) + (when (not obj) + (set! obj obj) + (goto cfg-88) + ) + (format #t "[~8x] ~A~%" obj 'search-info) + (format #t "~1Tpoint: ~`vector`P~%" (-> obj point)) + (format #t "~1Tbest-point: ~`vector`P~%" (-> obj best-point)) + (format #t "~1Tmatch-handle: ~D~%" (-> obj match-handle)) + (format #t "~1Tmatch: ~A~%" (-> obj match)) + (format #t "~1Tbest: ~f~%" (-> obj best)) + (format #t "~1Tradius: ~f~%" (-> obj radius)) + (format #t "~1Trating: #x~X : (search-info-flag " (-> obj rating)) + (let ((s5-0 (-> obj rating))) + (if (= (logand s5-0 (search-info-flag prefer-xz)) (search-info-flag prefer-xz)) + (format #t "prefer-xz ") + ) + (if (= (logand s5-0 (search-info-flag prefer-center)) (search-info-flag prefer-center)) + (format #t "prefer-center ") + ) + (if (= (logand s5-0 (search-info-flag cull-xz)) (search-info-flag cull-xz)) + (format #t "cull-xz ") + ) + (if (= (logand s5-0 (search-info-flag check-track)) (search-info-flag check-track)) + (format #t "check-track ") + ) + (if (= (logand s5-0 (search-info-flag enemy)) (search-info-flag enemy)) + (format #t "enemy ") + ) + (if (= (logand s5-0 (search-info-flag combo)) (search-info-flag combo)) + (format #t "combo ") + ) + (if (= (logand s5-0 (search-info-flag probe-camera)) (search-info-flag probe-camera)) + (format #t "probe-camera ") + ) + (if (= (logand s5-0 (search-info-flag prefer-dist)) (search-info-flag prefer-dist)) + (format #t "prefer-dist ") + ) + (if (= (logand s5-0 (search-info-flag prefer-angle)) (search-info-flag prefer-angle)) + (format #t "prefer-angle ") + ) + (if (= (logand s5-0 (search-info-flag on-screen)) (search-info-flag on-screen)) + (format #t "on-screen ") + ) + (if (= (logand s5-0 (search-info-flag probe)) (search-info-flag probe)) + (format #t "probe ") + ) + (if (= (logand s5-0 (search-info-flag cull-angle)) (search-info-flag cull-angle)) + (format #t "cull-angle ") + ) + (if (= (logand s5-0 (search-info-flag crate)) (search-info-flag crate)) + (format #t "crate ") + ) + (if (= (logand s5-0 (search-info-flag back-point)) (search-info-flag back-point)) + (format #t "back-point ") + ) + ) + (format #t ")~%") + (format #t "~1Trequire: #x~X : (search-info-flag " (-> obj require)) + (let ((s5-1 (-> obj require))) + (if (= (logand s5-1 (search-info-flag prefer-xz)) (search-info-flag prefer-xz)) + (format #t "prefer-xz ") + ) + (if (= (logand s5-1 (search-info-flag prefer-center)) (search-info-flag prefer-center)) + (format #t "prefer-center ") + ) + (if (= (logand s5-1 (search-info-flag cull-xz)) (search-info-flag cull-xz)) + (format #t "cull-xz ") + ) + (if (= (logand s5-1 (search-info-flag check-track)) (search-info-flag check-track)) + (format #t "check-track ") + ) + (if (= (logand s5-1 (search-info-flag enemy)) (search-info-flag enemy)) + (format #t "enemy ") + ) + (if (= (logand s5-1 (search-info-flag combo)) (search-info-flag combo)) + (format #t "combo ") + ) + (if (= (logand s5-1 (search-info-flag probe-camera)) (search-info-flag probe-camera)) + (format #t "probe-camera ") + ) + (if (= (logand s5-1 (search-info-flag prefer-dist)) (search-info-flag prefer-dist)) + (format #t "prefer-dist ") + ) + (if (= (logand s5-1 (search-info-flag prefer-angle)) (search-info-flag prefer-angle)) + (format #t "prefer-angle ") + ) + (if (= (logand s5-1 (search-info-flag on-screen)) (search-info-flag on-screen)) + (format #t "on-screen ") + ) + (if (= (logand s5-1 (search-info-flag probe)) (search-info-flag probe)) + (format #t "probe ") + ) + (if (= (logand s5-1 (search-info-flag cull-angle)) (search-info-flag cull-angle)) + (format #t "cull-angle ") + ) + (if (= (logand s5-1 (search-info-flag crate)) (search-info-flag crate)) + (format #t "crate ") + ) + (if (= (logand s5-1 (search-info-flag back-point)) (search-info-flag back-point)) + (format #t "back-point ") + ) + ) + (format #t ")~%") + (format #t "~1Tmask: #x~X : (search-info-flag " (-> obj mask)) + (let ((s5-2 (-> obj mask))) + (if (= (logand s5-2 (search-info-flag prefer-xz)) (search-info-flag prefer-xz)) + (format #t "prefer-xz ") + ) + (if (= (logand s5-2 (search-info-flag prefer-center)) (search-info-flag prefer-center)) + (format #t "prefer-center ") + ) + (if (= (logand s5-2 (search-info-flag cull-xz)) (search-info-flag cull-xz)) + (format #t "cull-xz ") + ) + (if (= (logand s5-2 (search-info-flag check-track)) (search-info-flag check-track)) + (format #t "check-track ") + ) + (if (= (logand s5-2 (search-info-flag enemy)) (search-info-flag enemy)) + (format #t "enemy ") + ) + (if (= (logand s5-2 (search-info-flag combo)) (search-info-flag combo)) + (format #t "combo ") + ) + (if (= (logand s5-2 (search-info-flag probe-camera)) (search-info-flag probe-camera)) + (format #t "probe-camera ") + ) + (if (= (logand s5-2 (search-info-flag prefer-dist)) (search-info-flag prefer-dist)) + (format #t "prefer-dist ") + ) + (if (= (logand s5-2 (search-info-flag prefer-angle)) (search-info-flag prefer-angle)) + (format #t "prefer-angle ") + ) + (if (= (logand s5-2 (search-info-flag on-screen)) (search-info-flag on-screen)) + (format #t "on-screen ") + ) + (if (= (logand s5-2 (search-info-flag probe)) (search-info-flag probe)) + (format #t "probe ") + ) + (if (= (logand s5-2 (search-info-flag cull-angle)) (search-info-flag cull-angle)) + (format #t "cull-angle ") + ) + (if (= (logand s5-2 (search-info-flag crate)) (search-info-flag crate)) + (format #t "crate ") + ) + (if (= (logand s5-2 (search-info-flag back-point)) (search-info-flag back-point)) + (format #t "back-point ") + ) + ) + (format #t ")~%") + (format #t "~1Trot-base: ~`vector`P~%" (-> obj rot-base)) + (format #t "~1Tback-point: ~`vector`P~%" (-> obj ack-point)) + (format #t "~1Trot-range: ~f~%" (-> obj rot-range)) + (label cfg-88) + obj + ) + +;; definition for symbol *search-info*, type search-info +(define *search-info* (new 'global 'search-info)) + +;; definition for function find-nearest-attackable +;; INFO: Used lq/sq +(defun find-nearest-attackable ((arg0 vector) (arg1 float) (arg2 uint) (arg3 uint) (arg4 vector) (arg5 vector) (arg6 float)) + (let ((gp-0 *search-info*)) + (set! (-> gp-0 match) #f) + (set! (-> gp-0 point quad) (-> arg0 quad)) + (set! (-> gp-0 radius) arg1) + (set! (-> gp-0 best) 1000000000000000000000.0) + (set! (-> gp-0 rating) (search-info-flag)) + (set! (-> gp-0 require) (the-as search-info-flag arg3)) + (set! (-> gp-0 mask) (the-as search-info-flag arg2)) + (set! (-> gp-0 rot-base quad) (-> arg4 quad)) + (if arg5 + (set! (-> gp-0 ack-point quad) (-> arg5 quad)) + (set! (-> gp-0 ack-point quad) (-> gp-0 rot-base quad)) + ) + (set! (-> gp-0 rot-range) (if (= arg6 65536.0) + -2.0 + arg6 + ) + ) + (iterate-process-tree + *entity-pool* + (lambda ((arg0 process-drawable)) + (with-pp + (when (and (logtest? (process-mask crate enemy collectable guard) (-> arg0 mask)) + (zero? (logand (process-mask no-track) (-> arg0 mask))) + ) + (let* ((gp-0 *search-info*) + (s4-0 arg0) + (s5-0 (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + (when s5-0 + (let* ((s4-1 (-> s5-0 root)) + (s3-0 (if (type? s4-1 collide-shape) + s4-1 + ) + ) + ) + (when s3-0 + (let* ((s4-2 (the-as structure (-> (the-as collide-shape s3-0) root-prim prim-core))) + (f30-0 (- (vector-vector-distance (-> gp-0 point) (the-as vector s4-2)) + (-> (the-as collide-prim-core s4-2) world-sphere w) + ) + ) + ) + (let* ((s1-0 s5-0) + (s2-0 (if (type? s1-0 process-focusable) + s1-0 + ) + ) + ) + (if (and (type? s2-0 process-focusable) + s2-0 + s2-0 + (zero? (logand (-> (the-as process-focusable s2-0) focus-status) (focus-status disable dead))) + ) + (set! s4-2 (get-trans (the-as process-focusable s2-0) 3)) + ) + ) + (when (nonzero? (-> (the-as collide-shape s3-0) root-prim prim-core collide-as)) + (let ((s3-1 0)) + 0.0 + (let* ((s2-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (the-as vector s4-2) (-> gp-0 point)) 1.0)) + (f28-0 (cond + ((logtest? (-> gp-0 mask) (search-info-flag prefer-xz)) + (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle s2-1))) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) + (- -9999.0 (vector-dot s2-1 (-> gp-0 rot-base))) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-center)) + (* f30-0 (fmax 0.01 (- 1.0 (vector-dot s2-1 (-> gp-0 rot-base))))) + ) + (else + f30-0 + ) + ) + ) + ) + (cond + ((logtest? (-> gp-0 mask) (search-info-flag cull-angle)) + (if (< (vector-dot s2-1 (-> gp-0 rot-base)) (cos (-> gp-0 rot-range))) + (return (the-as object #f)) + ) + ) + ((logtest? (-> gp-0 mask) (search-info-flag cull-xz)) + (if (< (-> gp-0 rot-range) (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle s2-1)))) + (return (the-as object #f)) + ) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag back-point)) + (if (< (vector-dot + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (the-as vector s4-2) (-> gp-0 ack-point)) 1.0) + (-> gp-0 rot-base) + ) + 0.0 + ) + (return (the-as object #f)) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag combo)) + (if (not (send-event s5-0 'combo)) + (return (the-as object #f)) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag check-track)) + (if (not (send-event s5-0 'track #f)) + (return (the-as object #f)) + ) + ) + (if (logtest? (process-mask enemy guard) (-> s5-0 mask)) + (set! s3-1 (logior s3-1 2)) + ) + (if (logtest? (process-mask crate) (-> s5-0 mask)) + (set! s3-1 (logior s3-1 1)) + ) + (if (and (nonzero? (-> s5-0 draw)) (logtest? (-> s5-0 draw status) (draw-control-status on-screen))) + (set! s3-1 (logior s3-1 4)) + ) + (let ((s3-2 (logand (the-as search-info-flag s3-1) (-> gp-0 mask)))) + (when (and (>= s3-2 (the-as int (-> gp-0 rating))) + (or (zero? (-> gp-0 require)) (logtest? (the-as search-info-flag s3-2) (-> gp-0 require))) + (< f28-0 (-> gp-0 best)) + (< f30-0 (-> gp-0 radius)) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag probe)) + (let ((a1-17 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-17 start-pos quad) (-> gp-0 ack-point quad)) + (vector-! (-> a1-17 move-dist) (the-as vector s4-2) (-> gp-0 ack-point)) + (let ((v1-92 a1-17)) + (set! (-> v1-92 radius) 1228.8) + (set! (-> v1-92 collide-with) (collide-spec backgnd)) + (set! (-> v1-92 ignore-process0) pp) + (set! (-> v1-92 ignore-process1) #f) + (set! (-> v1-92 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-92 action-mask) (collide-action solid)) + ) + (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* a1-17))) + (if (and (>= f0-16 0.0) (< f0-16 1.0)) + (return (the-as object #f)) + ) + ) + ) + ) + (set! (-> gp-0 match) s5-0) + (set! (-> gp-0 best) f28-0) + (set! (-> gp-0 rating) (the-as search-info-flag s3-2)) + s3-2 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + *null-kernel-context* + ) + (-> gp-0 match) + ) + ) + +;; definition for function find-nearest-focusable +;; INFO: Used lq/sq +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 752 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 752 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 752 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 752 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 720 mismatch: defined as size 4, got size 16 +(defun find-nearest-focusable ((arg0 (array collide-shape)) + (arg1 vector) + (arg2 float) + (arg3 search-info-flag) + (arg4 search-info-flag) + (arg5 vector) + (arg6 vector) + (arg7 float) + ) + (local-vars + (sv-704 (function float float float)) + (sv-720 float) + (sv-736 (function float float float)) + (sv-752 float) + ) + (with-pp + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 *search-info*)) + (set! (-> gp-0 match) #f) + (set! (-> gp-0 point quad) (-> arg1 quad)) + (set! (-> gp-0 radius) arg2) + (set! (-> gp-0 best) 1000000000000000000000.0) + (set! (-> gp-0 rating) (search-info-flag)) + (set! (-> gp-0 require) arg4) + (set! (-> gp-0 mask) arg3) + (set! (-> gp-0 rot-base quad) (-> arg5 quad)) + (if arg6 + (set! (-> gp-0 ack-point quad) (-> arg6 quad)) + (set! (-> gp-0 ack-point quad) (-> gp-0 rot-base quad)) + ) + (set! arg7 (cond + ((= arg7 65536.0) + -2.0 + ) + (else + (empty) + arg7 + ) + ) + ) + (set! (-> gp-0 rot-range) arg7) + (let ((s4-0 (-> arg0 length))) + (while (begin (label cfg-89) (nonzero? s4-0)) + (+! s4-0 -1) + (let* ((s1-0 (-> arg0 s4-0)) + (s2-0 (-> s1-0 process)) + (s3-0 (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + (when (and (and s3-0 (zero? (logand (-> (the-as process-focusable s3-0) focus-status) (focus-status disable dead)))) + (and (logtest? (process-mask crate enemy collectable guard) (-> s3-0 mask)) + (zero? (logand (process-mask no-track) (-> s3-0 mask))) + ) + ) + (let* ((s2-1 (get-trans (the-as process-focusable s3-0) 3)) + (f30-0 (- (vector-vector-distance (-> gp-0 point) s2-1) (-> s2-1 w))) + ) + (when (nonzero? (-> s1-0 root-prim prim-core collide-as)) + (let ((s1-1 0)) + 0.0 + (let* ((s0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) 1.0)) + (f28-0 (cond + ((logtest? (-> gp-0 mask) (search-info-flag prefer-xz)) + (set! sv-704 deg-diff) + (set! sv-720 (vector-y-angle (-> gp-0 rot-base))) + (let ((a1-7 (vector-y-angle s0-0))) + (fabs (sv-704 sv-720 a1-7)) + ) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) + (- -9999.0 (vector-dot s0-0 (-> gp-0 rot-base))) + ) + ((logtest? (-> gp-0 mask) (search-info-flag prefer-center)) + (* f30-0 (fmax 0.01 (- 1.0 (vector-dot s0-0 (-> gp-0 rot-base))))) + ) + (else + f30-0 + ) + ) + ) + ) + (cond + ((logtest? (-> gp-0 mask) (search-info-flag cull-angle)) + (cond + ((< (-> gp-0 rot-range) 14563.556) + (let ((f26-0 (vector-dot (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) (-> gp-0 rot-base))) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (let ((v1-45 (-> gp-0 point)) + (a0-23 (-> gp-0 rot-base)) + (f0-13 f26-0) + ) + (.lvf vf2 (&-> a0-23 quad)) + (.lvf vf1 (&-> v1-45 quad)) + (let ((v1-46 f0-13)) + (.mov vf3 v1-46) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> s0-1 quad) vf4) + (if (< (* f26-0 (tan (-> gp-0 rot-range))) (- (vector-vector-distance s0-1 s2-1) (-> s2-1 w))) + (goto cfg-89) + ) + ) + ) + (else + (if (< (vector-dot s0-0 (-> gp-0 rot-base)) (cos (-> gp-0 rot-range))) + (return (the-as basic #f)) + ) + ) + ) + ) + ((logtest? (-> gp-0 mask) (search-info-flag cull-xz)) + (let ((f26-3 (-> gp-0 rot-range))) + (set! sv-736 deg-diff) + (set! sv-752 (vector-y-angle (-> gp-0 rot-base))) + (let ((a1-10 (vector-y-angle s0-0))) + (if (< f26-3 (fabs (sv-736 sv-752 a1-10))) + (goto cfg-89) + ) + ) + ) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag back-point)) + (if (< (vector-dot + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 ack-point)) 1.0) + (-> gp-0 rot-base) + ) + 0.0 + ) + (goto cfg-89) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag combo)) + (if (not (send-event s3-0 'combo)) + (goto cfg-89) + ) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag check-track)) + (if (not (send-event s3-0 'track #f)) + (goto cfg-89) + ) + ) + (if (logtest? (process-mask enemy guard) (-> s3-0 mask)) + (set! s1-1 (logior s1-1 2)) + ) + (if (logtest? (process-mask crate) (-> s3-0 mask)) + (set! s1-1 (logior s1-1 1)) + ) + (if (and (nonzero? (-> (the-as process-focusable s3-0) draw)) + (logtest? (-> (the-as process-focusable s3-0) draw status) (draw-control-status on-screen)) + ) + (set! s1-1 (logior s1-1 4)) + ) + (let ((s1-2 (logand (the-as search-info-flag s1-1) (-> gp-0 mask)))) + (when (and (>= s1-2 (the-as int (-> gp-0 rating))) + (or (zero? (-> gp-0 require)) (logtest? (the-as search-info-flag s1-2) (-> gp-0 require))) + (< f28-0 (-> gp-0 best)) + (< f30-0 (-> gp-0 radius)) + ) + (when (logtest? (-> gp-0 mask) (search-info-flag probe)) + (let ((a1-15 (new 'stack-no-clear 'collide-query))) + (set! (-> a1-15 start-pos quad) (-> gp-0 ack-point quad)) + (vector-! (-> a1-15 move-dist) s2-1 (-> gp-0 ack-point)) + (let ((v1-113 a1-15)) + (set! (-> v1-113 radius) 1228.8) + (set! (-> v1-113 collide-with) (collide-spec backgnd)) + (set! (-> v1-113 ignore-process0) pp) + (set! (-> v1-113 ignore-process1) #f) + (set! (-> v1-113 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> v1-113 action-mask) (collide-action solid)) + ) + (let ((f0-29 (fill-and-probe-using-line-sphere *collide-cache* a1-15))) + (if (and (>= f0-29 0.0) (< f0-29 1.0)) + (goto cfg-89) + ) + ) + ) + ) + (set! (-> gp-0 match) s3-0) + (set! (-> gp-0 best) f28-0) + (set! (-> gp-0 rating) (the-as search-info-flag s1-2)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (-> gp-0 match) + ) + ) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/debug/debug_REF.gc b/test/decompiler/reference/jak2/engine/debug/debug_REF.gc index 5a82888714..a07c45ea7e 100644 --- a/test/decompiler/reference/jak2/engine/debug/debug_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/debug_REF.gc @@ -1969,7 +1969,222 @@ ;; ERROR: function has no type analysis. Cannot decompile. ;; definition (debug) for function add-debug-bound -;; ERROR: function has no type analysis. Cannot decompile. +;; INFO: Used lq/sq +;; ERROR: failed type prop at 82: Called a function, but we do not know its type +;; WARN: Return type mismatch int vs none. +(defun-debug add-debug-bound ((a0-0 int) (a1-0 transform) (a2-0 int) (a3-0 rgba) (t0-0 rgba) (t1-0 int)) + (local-vars + (v0-0 int) + (v0-1 none) + (v0-2 none) + (v0-3 none) + (v0-4 none) + (v0-5 none) + (v1-2 int) + (v1-4 display) + (v1-5 clock) + (v1-6 uint) + (v1-7 uint) + (v1-8 int) + (v1-9 int) + (v1-10 int) + (v1-11 display) + (v1-12 int) + (v1-13 int) + (v1-14 int) + (v1-15 display-frame) + (v1-16 dma-buffer) + (v1-17 dma-buffer) + (v1-18 dma-buffer) + (v1-19 pointer) + (v1-20 pointer) + (v1-21 pointer) + (v1-22 none) + (v1-23 none) + (v1-24 none) + (v1-25 none) + (v1-26 none) + (v1-27 none) + (v1-28 none) + (v1-29 none) + (v1-30 none) + (v1-31 none) + (v1-32 none) + (v1-33 none) + (v1-34 none) + (v1-35 none) + (a0-1 int) + (a0-2 display) + (a0-3 pointer) + (a0-4 pointer) + (a0-5 pointer) + (a0-6 pointer) + (a0-7 pointer) + (a0-8 pointer) + (a0-9 int) + (a0-12 none) + (a0-13 none) + (a0-14 none) + (a0-15 none) + (a0-16 none) + (a0-17 none) + (a0-18 none) + (a0-19 none) + (a0-20 none) + (a0-21 none) + (a1-1 int) + (a1-2 int) + (a1-3 uint) + (a1-4 uint) + (a1-5 uint) + (a1-6 int) + (a1-7 int) + (a1-8 int) + (a1-9 int) + (a1-10 int) + (a1-11 int) + (a1-12 dma-buffer) + (a1-14 none) + (a1-15 none) + (a1-16 none) + (a3-2 none) + (t1-1 int) + (s4-0 dma-buffer) + (s5-0 pointer) + (t9-0 (function texture-id dma-buffer none)) + (t9-1 function) + (t9-2 none) + (t9-3 none) + (sv-16 pointer) + (sv-32 int) + ) + (if (begin (set! sv-32 t1-0) (<.si a2-0 3)) + (return (set! v0-0 0)) + ) + (when (begin (set! v1-2 sv-32) (set! a0-1 1) (= v1-2 a0-1)) + (cond + ((begin + (set! v1-4 *display*) + (set! v1-5 (-> v1-4 real-frame-clock)) + (set! v1-6 (-> v1-5 integral-frame-counter)) + (set! v1-7 (logand v1-6 4)) + (nonzero? v1-7) + ) + (set! v1-8 1) + (set! sv-32 v1-8) + ) + (else + (set! v1-9 0) + (set! sv-32 v1-9) + ) + ) + (set! v1-10 sv-32) + ) + (set! v1-11 *display*) + (set! v1-12 (-> v1-11 on-screen)) + (set! v1-13 (sll v1-12 2)) + (set! a0-2 *display*) + (set! v1-14 (+ v1-13 a0-2)) + (set! v1-15 (dynamic-array-field-access v1-14 frames PLACEHOLDER)) + (set! s4-0 (-> v1-15 global-buf)) + (set! s5-0 (-> s4-0 base)) + (set! v1-16 s4-0) + (set! a0-3 (-> v1-16 base)) + (set! a1-1 #x10000004) + (set! (the-as (pointer int64) (-> (the-as (pointer int64) a0-3))) a1-1) + (s.w! (+ a0-3 8) 0) + (set! a1-2 #x50000004) + (s.w! (+ a0-3 12) a1-2) + (set! a0-4 (+ a0-3 16)) + (set! (-> v1-16 base) a0-4) + (set! v1-17 s4-0) + (set! a0-5 (-> v1-17 base)) + (set! a1-3 (the-as uint #x3000000000008001)) + (set! a1-4 (pcypld 0 a1-3)) + (set! (the-as (pointer uint64) (-> (the-as (pointer uint64) a0-5))) a1-4) + (set! a1-5 (the-as uint #xeeeeeeeeeeeeeeee)) + (s.d! (+ a0-5 8) a1-5) + (set! a0-6 (+ a0-5 16)) + (set! (-> v1-17 base) a0-6) + (set! v1-18 s4-0) + (set! a0-7 (-> v1-18 base)) + (set! a1-6 #x1000130) + (set! (the-as (pointer int64) (-> (the-as (pointer int64) a0-7))) a1-6) + (set! a1-7 78) + (s.d! (+ a0-7 8) a1-7) + (set! a1-8 #x5026b) + (s.d! (+ a0-7 16) a1-8) + (set! a1-9 71) + (s.d! (+ a0-7 24) a1-9) + (set! a1-10 68) + (s.d! (+ a0-7 32) a1-10) + (set! a1-11 66) + (s.d! (+ a0-7 40) a1-11) + (set! a0-8 (+ a0-7 48)) + (set! (-> v1-18 base) a0-8) + (set! v1-19 (-> s4-0 base)) + (set! sv-16 v1-19) + (set! v1-20 (-> s4-0 base)) + (set! v1-21 (+ v1-20 16)) + (set! (-> s4-0 base) v1-21) + (set! t9-0 add-boundary-shader) + (set! a0-9 #x70c00300) + (set! a1-12 s4-0) + (call! a0-9 a1-12) + (set! t9-1 add-debug-bound-internal) + (set! a0-10 s4-0) + (set! a1-13 a1-0) + (set! a2-1 a2-0) + (set! a3-1 a3-0) + (set! t0-1 t0-0) + (set! t1-1 sv-32) + (call!) + (set! t9-2 (the-as none close-sky-buffer)) + (set! a0-11 (the-as none s4-0)) + (call!) + (set! v1-22 (the-as none -16)) + (set! a0-12 (the-as none sv-16)) + (set! v1-23 (the-as none (- v1-22 a0-12))) + (set! a0-13 (the-as none (-> s4-0 base))) + (set! v1-24 (the-as none (+ v1-23 a0-13))) + (set! v1-25 (the-as none (sra v1-24 4))) + (set! a0-14 (the-as none #x10000000)) + (set! a1-14 (the-as none (sll v1-25 48))) + (set! a1-15 (the-as none (srl a1-14 48))) + (set! a0-15 (the-as none (logior a0-14 a1-15))) + (set! a1-16 (the-as none sv-16)) + (s.d! a1-16 a0-15) + (set! a0-16 (the-as none sv-16)) + (s.w! (+ a0-16 8) 0) + (set! a0-17 (the-as none #x50000000)) + (set! v1-26 (the-as none (sll v1-25 48))) + (set! v1-27 (the-as none (srl v1-26 48))) + (set! a0-18 (the-as none (logior a0-17 v1-27))) + (set! v1-28 (the-as none sv-16)) + (s.w! (+ v1-28 12) a0-18) + (set! a3-2 (the-as none (-> s4-0 base))) + (set! v1-29 (the-as none (-> s4-0 base))) + (set! a0-19 (the-as none #x20000000)) + (s.d! v1-29 a0-19) + (s.w! (+ v1-29 8) 0) + (s.w! (+ v1-29 12) 0) + (set! v1-30 (the-as none (+ v1-29 16))) + (set! (-> s4-0 base) (the-as pointer v1-30)) + (set! t9-3 (the-as none dma-bucket-insert-tag)) + (set! v1-31 (the-as none *display*)) + (set! v1-32 (the-as none (l.w v1-31))) + (set! v1-33 (the-as none (sll v1-32 2))) + (set! a0-20 (the-as none *display*)) + (set! v1-34 (the-as none (+ v1-33 a0-20))) + (set! v1-35 (the-as none (l.wu (+ v1-34 8)))) + (set! a0-21 (the-as none (l.wu (+ v1-35 40)))) + (set! a1-17 (the-as none a0-0)) + (set! a2-2 (the-as none s5-0)) + (call!) + (set! v1-36 (the-as none v0-4)) + (set! v0-5 (the-as none 0)) + (ret-none) + ) ;; definition (debug) for function cpu-delay ;; ERROR: function was not converted to expressions. Cannot decompile. diff --git a/test/decompiler/reference/jak2/engine/debug/editable-h_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable-h_REF.gc new file mode 100644 index 0000000000..d7328c19ff --- /dev/null +++ b/test/decompiler/reference/jak2/engine/debug/editable-h_REF.gc @@ -0,0 +1,1203 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition for symbol *editable-temp-id*, type int +(define *editable-temp-id* 0) + +;; definition for function editable-command->string +(defun editable-command->string ((arg0 editable-command)) + (case arg0 + (((editable-command insert-entity)) + "insert-entity" + ) + (((editable-command print-region-info)) + "print-region-info" + ) + (((editable-command resize)) + "resize" + ) + (((editable-command insert-face)) + "insert-face" + ) + (((editable-command select-one)) + "select-one" + ) + (((editable-command update-game)) + "update-game" + ) + (((editable-command region-set)) + "region-set" + ) + (((editable-command select-all)) + "select-all" + ) + (((editable-command region-add)) + "region-add" + ) + (((editable-command flip-side)) + "flip-side" + ) + (((editable-command drag-resize)) + "drag-resize" + ) + (((editable-command select-current-prim)) + "select-current-prim" + ) + (((editable-command edit-plane-set)) + "edit-plane-set" + ) + (((editable-command edit-plane-clear)) + "edit-plane-clear" + ) + (((editable-command kill)) + "kill" + ) + (((editable-command delete-region)) + "delete-region" + ) + (((editable-command select-region)) + "select-region" + ) + (((editable-command camera-tumble)) + "camera-tumble" + ) + (((editable-command select-current-face)) + "select-current-face" + ) + (((editable-command snap-xz)) + "snap-xz" + ) + (((editable-command insert-sample)) + "insert-sample" + ) + (((editable-command camera-xy)) + "camera-xy" + ) + (((editable-command pick-loc)) + "pick-loc" + ) + (((editable-command select-face)) + "select-face" + ) + (((editable-command rotate-level)) + "rotate-level" + ) + (((editable-command pick-yes-no)) + "pick-yes-no" + ) + (((editable-command translate-y-level)) + "translate-y-level" + ) + (((editable-command save)) + "save" + ) + (((editable-command copy-region)) + "copy-region" + ) + (((editable-command cancel)) + "cancel" + ) + (((editable-command insert-light)) + "insert-light" + ) + (((editable-command drag-move-z)) + "drag-move-z" + ) + (((editable-command exit)) + "exit" + ) + (((editable-command drag-move-y)) + "drag-move-y" + ) + (((editable-command drag-move-xy)) + "drag-move-xy" + ) + (((editable-command select-prim)) + "select-prim" + ) + (((editable-command none)) + "none" + ) + (((editable-command delete)) + "delete" + ) + (((editable-command drag-move-x)) + "drag-move-x" + ) + (((editable-command insert-plane)) + "insert-plane" + ) + (((editable-command insert-sphere)) + "insert-sphere" + ) + (((editable-command insert-point)) + "insert-point" + ) + (((editable-command select-current-region)) + "select-current-region" + ) + (((editable-command camera-xz)) + "camera-xz" + ) + (((editable-command region-new)) + "region-new" + ) + (((editable-command drag-move-xz)) + "drag-move-xz" + ) + (((editable-command load)) + "load" + ) + (((editable-command insert-box)) + "insert-box" + ) + (((editable-command snap-to-ground)) + "snap-to-ground" + ) + (((editable-command select-none)) + "select-none" + ) + (((editable-command select-toggle)) + "select-toggle" + ) + (((editable-command insert-sample-camera)) + "insert-sample-camera" + ) + (((editable-command pick-target)) + "pick-target" + ) + (((editable-command select-current-owner)) + "select-current-owner" + ) + (((editable-command refresh-filter)) + "refresh-filter" + ) + (((editable-command copy)) + "copy" + ) + (((editable-command snap-y)) + "snap-y" + ) + (else + "*unknown*" + ) + ) + ) + +;; definition for function editable-filter->string +;; WARN: Return type mismatch basic vs string. +(defun editable-filter->string ((arg0 editable-filter) (arg1 basic)) + (if (= (logand arg0 (editable-filter target)) (editable-filter target)) + (format arg1 "target ") + ) + (if (= (logand arg0 (editable-filter city_vis)) (editable-filter city_vis)) + (format arg1 "city_vis ") + ) + (if (= (logand arg0 (editable-filter water-command)) (editable-filter water-command)) + (format arg1 "water-command ") + ) + (if (= (logand arg0 (editable-filter user-setting)) (editable-filter user-setting)) + (format arg1 "user-setting ") + ) + (if (= (logand arg0 (editable-filter sample)) (editable-filter sample)) + (format arg1 "sample ") + ) + (if (= (logand arg0 (editable-filter light)) (editable-filter light)) + (format arg1 "light ") + ) + (if (= (logand arg0 (editable-filter part)) (editable-filter part)) + (format arg1 "part ") + ) + (if (= (logand arg0 (editable-filter unknown)) (editable-filter unknown)) + (format arg1 "unknown ") + ) + (if (= (logand arg0 (editable-filter entity)) (editable-filter entity)) + (format arg1 "entity ") + ) + (if (= (logand arg0 (editable-filter data)) (editable-filter data)) + (format arg1 "data ") + ) + (if (= (logand arg0 (editable-filter water)) (editable-filter water)) + (format arg1 "water ") + ) + (if (= (logand arg0 (editable-filter cam-setting)) (editable-filter cam-setting)) + (format arg1 "cam-setting ") + ) + (if (= (logand (editable-filter selected) arg0) (editable-filter selected)) + (format arg1 "selected ") + ) + (if (= (logand arg0 (editable-filter none)) (editable-filter none)) + (format arg1 "none ") + ) + (if (= (logand arg0 (editable-filter camera)) (editable-filter camera)) + (format arg1 "camera ") + ) + (if (= (logand arg0 (editable-filter load)) (editable-filter load)) + (format arg1 "load ") + ) + (if (= (logand arg0 (editable-filter sound)) (editable-filter sound)) + (format arg1 "sound ") + ) + (the-as string arg1) + ) + +;; definition of type editable-region +(deftype editable-region (basic) + ((changed symbol :offset-assert 4) + (locked symbol :offset-assert 8) + (id uint64 :offset-assert 16) + (filter editable-filter :offset-assert 24) + (tree string :offset-assert 28) + (level string :offset-assert 32) + (on-enter string :offset-assert 36) + (on-inside string :offset-assert 40) + (on-exit string :offset-assert 44) + ) + :method-count-assert 13 + :size-assert #x30 + :flag-assert #xd00000030 + (:methods + (new (symbol type) _type_ 0) + (editable-region-method-9 () none 9) + (editable-region-method-10 (_type_ int) symbol 10) + (editable-region-method-11 (_type_ vector int) none 11) + (editable-region-method-12 (_type_) editable-filter 12) + ) + ) + +;; definition for method 3 of type editable-region +(defmethod inspect editable-region ((obj editable-region)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tchanged: ~A~%" (-> obj changed)) + (format #t "~1Tlocked: ~A~%" (-> obj locked)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tfilter: ~D~%" (-> obj filter)) + (format #t "~1Ttree: ~A~%" (-> obj tree)) + (format #t "~1Tlevel: ~A~%" (-> obj level)) + (format #t "~1Ton-enter: ~A~%" (-> obj on-enter)) + (format #t "~1Ton-inside: ~A~%" (-> obj on-inside)) + (format #t "~1Ton-exit: ~A~%" (-> obj on-exit)) + (label cfg-4) + obj + ) + +;; definition of type editable +(deftype editable (basic) + ((flags editable-flag :offset-assert 4) + (name string :offset-assert 8) + (id uint32 :offset-assert 12) + (region editable-region :offset-assert 16) + (owner pair :offset-assert 20) + ) + :method-count-assert 30 + :size-assert #x18 + :flag-assert #x1e00000018 + (:methods + (get-color (_type_ int) rgba 9) + (editable-method-10 (_type_) none 10) + (editable-method-11 (_type_ vector) symbol 11) + (select-editable! (_type_ symbol) none 12) + (edit-get-distance (_type_ vector) float 13) + (edit-get-trans (_type_) vector 14) + (editable-method-15 (_type_ vector int) none 15) + (edit-coord! (_type_ vector editable-flag) none 16) + (editable-method-17 (_type_ vector) none 17) + (editable-method-18 (_type_ vector matrix) none 18) + (editable-method-19 (_type_ vector) none 19) + (editable-method-20 (_type_ vector vector vector vector) none 20) + (editable-method-21 (_type_ editable-region) none 21) + (editable-method-22 (_type_ editable-array int int) symbol 22) + (editable-method-23 (_type_) symbol 23) + (editable-method-24 (_type_) none 24) + (editable-method-25 (_type_ editable-array) none 25) + (editable-method-26 (_type_ editable editable-array) none 26) + (editable-method-27 (_type_ editable-array) editable 27) + (editable-method-28 (_type_ editable-filter) none 28) + (editable-method-29 (_type_ editable-filter) symbol 29) + ) + ) + +;; definition for method 3 of type editable +(defmethod inspect editable ((obj editable)) + (when (not obj) + (set! obj obj) + (goto cfg-28) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tflags: #x~X : (editable-flag " (-> obj flags)) + (let ((s5-0 (-> obj flags))) + (if (= (logand s5-0 (editable-flag no-save)) (editable-flag no-save)) + (format #t "no-save ") + ) + (if (= (logand s5-0 (editable-flag top-set)) (editable-flag top-set)) + (format #t "top-set ") + ) + (if (= (logand s5-0 (editable-flag orient)) (editable-flag orient)) + (format #t "orient ") + ) + (if (= (logand s5-0 (editable-flag z)) (editable-flag z)) + (format #t "z ") + ) + (if (= (logand s5-0 (editable-flag y)) (editable-flag y)) + (format #t "y ") + ) + (if (= (logand s5-0 (editable-flag x)) (editable-flag x)) + (format #t "x ") + ) + (if (= (logand s5-0 (editable-flag changed)) (editable-flag changed)) + (format #t "changed ") + ) + (if (= (logand s5-0 (editable-flag no-plane-snap)) (editable-flag no-plane-snap)) + (format #t "no-plane-snap ") + ) + (if (= (logand s5-0 (editable-flag mark)) (editable-flag mark)) + (format #t "mark ") + ) + (if (= (logand s5-0 (editable-flag bot-set)) (editable-flag bot-set)) + (format #t "bot-set ") + ) + (if (= (logand s5-0 (editable-flag selected)) (editable-flag selected)) + (format #t "selected ") + ) + (if (= (logand s5-0 (editable-flag no-update)) (editable-flag no-update)) + (format #t "no-update ") + ) + ) + (format #t ")~%") + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Towner: ~A~%" (-> obj owner)) + (label cfg-28) + obj + ) + +;; definition of type editable-array +(deftype editable-array (basic) + ((allocated-length int32 :offset-assert 4) + (length int32 :offset-assert 8) + (region editable-region :offset-assert 12) + (backup-region editable-region :offset-assert 16) + (region-lock? symbol :offset-assert 20) + (move-lock? symbol :offset-assert 24) + (move-speed float :offset-assert 28) + (selection (array editable) :offset-assert 32) + (filter editable-filter 2 :offset-assert 36) + (target editable :offset-assert 44) + (target-mode uint32 :offset-assert 48) + (target-command basic :offset-assert 52) + (target-message string :offset-assert 56) + (edit-plane editable-plane :offset-assert 60) + (edit-plane-center vector :inline :offset-assert 64) + (edit-plane-normal vector :inline :offset-assert 80) + (level-offset vector :inline :offset-assert 96) + (level-info-id uint32 :offset-assert 112) + (level uint32 :offset-assert 116) + (edit-param0 float :offset-assert 120) + (data editable :dynamic :offset-assert 124) + ) + :method-count-assert 18 + :size-assert #x7c + :flag-assert #x120000007c + (:methods + (new (symbol type int) _type_ 0) + (editable-array-method-9 (_type_ editable-command editable-array) symbol :behavior editable-player 9) + (editable-array-method-10 (_type_ vector int) editable 10) + (editable-array-method-11 (_type_) int 11) + (editable-array-method-12 (_type_ editable-array) none 12) + (editable-array-method-13 (_type_ uint basic string) none 13) + (editable-array-method-14 (_type_ (function symbol) symbol) none 14) + (editable-array-method-15 (_type_ editable) none 15) + (editable-array-method-16 (_type_) none 16) + (editable-array-method-17 (_type_ vector vector) vector 17) + ) + ) + +;; definition for method 3 of type editable-array +(defmethod inspect editable-array ((obj editable-array)) + (when (not obj) + (set! obj obj) + (goto cfg-7) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~1Tlength: ~D~%" (-> obj length)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Tbackup-region: ~A~%" (-> obj backup-region)) + (format #t "~1Tregion-lock?: ~A~%" (-> obj region-lock?)) + (format #t "~1Tmove-lock?: ~A~%" (-> obj move-lock?)) + (format #t "~1Tmove-speed: ~f~%" (-> obj move-speed)) + (format #t "~1Tselection: ~`basic`P~%" (-> obj selection)) + (format #t "~1Tfilter[2] @ #x~X~%" (-> obj filter)) + (format #t "~1Ttarget: ~A~%" (-> obj target)) + (format #t "~1Ttarget-mode: ~D~%" (-> obj target-mode)) + (format #t "~1Ttarget-command: ~D~%" (-> obj target-command)) + (format #t "~1Ttarget-message: ~A~%" (-> obj target-message)) + (format #t "~1Tedit-plane: ~A~%" (-> obj edit-plane)) + (format #t "~1Tedit-plane-center: ~`vector`P~%" (-> obj edit-plane-center)) + (format #t "~1Tedit-plane-normal: ~`vector`P~%" (-> obj edit-plane-normal)) + (format #t "~1Tlevel-offset: ~`vector`P~%" (-> obj level-offset)) + (format #t "~1Tlevel-info-id: ~D~%" (-> obj level-info-id)) + (format #t "~1Tlevel: ~A~%" (-> obj level)) + (format #t "~1Tedit-param0: ~f~%" (-> obj edit-param0)) + (format #t "~1Tdata[0] @ #x~X~%" (-> obj data)) + (dotimes (s5-0 (-> obj length)) + (format #t "~T [~D]~1Tdata: ~A~%" s5-0 (-> obj data s5-0)) + ) + (label cfg-7) + obj + ) + +;; definition for method 0 of type editable-array +(defmethod new editable-array ((allocation symbol) (type-to-make type) (arg0 int)) + (let ((s5-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* arg0 4)))))) + (set! (-> s5-0 allocated-length) arg0) + (set! (-> s5-0 length) 0) + (set! (-> s5-0 region) #f) + (set! (-> s5-0 backup-region) #f) + (set! (-> s5-0 region-lock?) #f) + (set! (-> s5-0 move-lock?) #f) + (set! (-> s5-0 target) #f) + (set! (-> s5-0 target-command) (the-as basic 0)) + (set! (-> s5-0 target-message) #f) + (set! (-> s5-0 selection) + (the-as (array editable) ((method-of-type array new) allocation array editable arg0)) + ) + (set! (-> s5-0 edit-plane) #f) + (set! (-> s5-0 filter 0) (editable-filter + none + unknown + sound + part + user-setting + cam-setting + load + water-command + city_vis + sample + light + entity + ) + ) + (set! (-> s5-0 filter 1) (editable-filter camera target water data city_vis sample light entity selected)) + (dotimes (v1-5 arg0) + (set! (-> s5-0 data v1-5) #f) + (set! (-> s5-0 selection v1-5) #f) + ) + s5-0 + ) + ) + +;; definition of type editable-point +(deftype editable-point (editable) + ((radius float :offset-assert 24) + (trans vector :inline :offset-assert 32) + ) + :method-count-assert 30 + :size-assert #x30 + :flag-assert #x1e00000030 + (:methods + (new (symbol type vector editable-region) _type_ 0) + ) + ) + +;; definition for method 3 of type editable-point +(defmethod inspect editable-point ((obj editable-point)) + (when (not obj) + (set! obj obj) + (goto cfg-28) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tflags: #x~X : (editable-flag " (-> obj flags)) + (let ((s5-0 (-> obj flags))) + (if (= (logand s5-0 (editable-flag no-save)) (editable-flag no-save)) + (format #t "no-save ") + ) + (if (= (logand s5-0 (editable-flag top-set)) (editable-flag top-set)) + (format #t "top-set ") + ) + (if (= (logand s5-0 (editable-flag orient)) (editable-flag orient)) + (format #t "orient ") + ) + (if (= (logand s5-0 (editable-flag z)) (editable-flag z)) + (format #t "z ") + ) + (if (= (logand s5-0 (editable-flag y)) (editable-flag y)) + (format #t "y ") + ) + (if (= (logand s5-0 (editable-flag x)) (editable-flag x)) + (format #t "x ") + ) + (if (= (logand s5-0 (editable-flag changed)) (editable-flag changed)) + (format #t "changed ") + ) + (if (= (logand s5-0 (editable-flag no-plane-snap)) (editable-flag no-plane-snap)) + (format #t "no-plane-snap ") + ) + (if (= (logand s5-0 (editable-flag mark)) (editable-flag mark)) + (format #t "mark ") + ) + (if (= (logand s5-0 (editable-flag bot-set)) (editable-flag bot-set)) + (format #t "bot-set ") + ) + (if (= (logand s5-0 (editable-flag selected)) (editable-flag selected)) + (format #t "selected ") + ) + (if (= (logand s5-0 (editable-flag no-update)) (editable-flag no-update)) + (format #t "no-update ") + ) + ) + (format #t ")~%") + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Towner: ~A~%" (-> obj owner)) + (format #t "~1Tradius: (meters ~m)~%" (-> obj radius)) + (format #t "~1Ttrans: ~`vector`P~%" (-> obj trans)) + (label cfg-28) + obj + ) + +;; definition for method 0 of type editable-point +;; INFO: Used lq/sq +(defmethod new editable-point ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 editable-region)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 region) #f) + (set! (-> gp-0 name) "undefined") + (editable-method-21 gp-0 (cond + (arg1 + (empty) + arg1 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> gp-0 trans quad) (-> arg0 quad)) + (set! (-> gp-0 radius) 2048.0) + (set! (-> gp-0 owner) '()) + gp-0 + ) + ) + +;; definition of type editable-sphere +(deftype editable-sphere (editable-point) + () + :method-count-assert 30 + :size-assert #x30 + :flag-assert #x1e00000030 + (:methods + (new (symbol type vector float editable-region) _type_ 0) + ) + ) + +;; definition for method 3 of type editable-sphere +(defmethod inspect editable-sphere ((obj editable-sphere)) + (when (not obj) + (set! obj obj) + (goto cfg-28) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tflags: #x~X : (editable-flag " (-> obj flags)) + (let ((s5-0 (-> obj flags))) + (if (= (logand s5-0 (editable-flag no-save)) (editable-flag no-save)) + (format #t "no-save ") + ) + (if (= (logand s5-0 (editable-flag top-set)) (editable-flag top-set)) + (format #t "top-set ") + ) + (if (= (logand s5-0 (editable-flag orient)) (editable-flag orient)) + (format #t "orient ") + ) + (if (= (logand s5-0 (editable-flag z)) (editable-flag z)) + (format #t "z ") + ) + (if (= (logand s5-0 (editable-flag y)) (editable-flag y)) + (format #t "y ") + ) + (if (= (logand s5-0 (editable-flag x)) (editable-flag x)) + (format #t "x ") + ) + (if (= (logand s5-0 (editable-flag changed)) (editable-flag changed)) + (format #t "changed ") + ) + (if (= (logand s5-0 (editable-flag no-plane-snap)) (editable-flag no-plane-snap)) + (format #t "no-plane-snap ") + ) + (if (= (logand s5-0 (editable-flag mark)) (editable-flag mark)) + (format #t "mark ") + ) + (if (= (logand s5-0 (editable-flag bot-set)) (editable-flag bot-set)) + (format #t "bot-set ") + ) + (if (= (logand s5-0 (editable-flag selected)) (editable-flag selected)) + (format #t "selected ") + ) + (if (= (logand s5-0 (editable-flag no-update)) (editable-flag no-update)) + (format #t "no-update ") + ) + ) + (format #t ")~%") + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Towner: ~A~%" (-> obj owner)) + (format #t "~1Tradius: (meters ~m)~%" (-> obj radius)) + (format #t "~1Ttrans: ~`vector`P~%" (-> obj trans)) + (label cfg-28) + obj + ) + +;; definition for method 0 of type editable-sphere +;; INFO: Used lq/sq +(defmethod new editable-sphere ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region)) + (let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> s5-0 region) #f) + (set! (-> s5-0 name) "undefined") + (editable-method-21 s5-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> s5-0 trans quad) (-> arg0 quad)) + (set! (-> s5-0 radius) arg1) + (set! (-> s5-0 owner) '()) + s5-0 + ) + ) + +;; definition of type editable-sample +(deftype editable-sample (editable-point) + () + :method-count-assert 30 + :size-assert #x30 + :flag-assert #x1e00000030 + ) + +;; definition for method 3 of type editable-sample +(defmethod inspect editable-sample ((obj editable-sample)) + (when (not obj) + (set! obj obj) + (goto cfg-28) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tflags: #x~X : (editable-flag " (-> obj flags)) + (let ((s5-0 (-> obj flags))) + (if (= (logand s5-0 (editable-flag no-save)) (editable-flag no-save)) + (format #t "no-save ") + ) + (if (= (logand s5-0 (editable-flag top-set)) (editable-flag top-set)) + (format #t "top-set ") + ) + (if (= (logand s5-0 (editable-flag orient)) (editable-flag orient)) + (format #t "orient ") + ) + (if (= (logand s5-0 (editable-flag z)) (editable-flag z)) + (format #t "z ") + ) + (if (= (logand s5-0 (editable-flag y)) (editable-flag y)) + (format #t "y ") + ) + (if (= (logand s5-0 (editable-flag x)) (editable-flag x)) + (format #t "x ") + ) + (if (= (logand s5-0 (editable-flag changed)) (editable-flag changed)) + (format #t "changed ") + ) + (if (= (logand s5-0 (editable-flag no-plane-snap)) (editable-flag no-plane-snap)) + (format #t "no-plane-snap ") + ) + (if (= (logand s5-0 (editable-flag mark)) (editable-flag mark)) + (format #t "mark ") + ) + (if (= (logand s5-0 (editable-flag bot-set)) (editable-flag bot-set)) + (format #t "bot-set ") + ) + (if (= (logand s5-0 (editable-flag selected)) (editable-flag selected)) + (format #t "selected ") + ) + (if (= (logand s5-0 (editable-flag no-update)) (editable-flag no-update)) + (format #t "no-update ") + ) + ) + (format #t ")~%") + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Towner: ~A~%" (-> obj owner)) + (format #t "~1Tradius: (meters ~m)~%" (-> obj radius)) + (format #t "~1Ttrans: ~`vector`P~%" (-> obj trans)) + (label cfg-28) + obj + ) + +;; definition of type editable-light +(deftype editable-light (editable-sphere) + ((direction vector :inline :offset-assert 48) + (color vector :inline :offset-assert 64) + (decay-start float :offset-assert 80) + (ambient-point-ratio float :offset-assert 84) + (brightness float :offset-assert 88) + ) + :method-count-assert 30 + :size-assert #x5c + :flag-assert #x1e0000005c + (:methods + (new (symbol type vector float editable-region) _type_ 0) + ) + ) + +;; definition for method 3 of type editable-light +(defmethod inspect editable-light ((obj editable-light)) + (when (not obj) + (set! obj obj) + (goto cfg-28) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tflags: #x~X : (editable-flag " (-> obj flags)) + (let ((s5-0 (-> obj flags))) + (if (= (logand s5-0 (editable-flag no-save)) (editable-flag no-save)) + (format #t "no-save ") + ) + (if (= (logand s5-0 (editable-flag top-set)) (editable-flag top-set)) + (format #t "top-set ") + ) + (if (= (logand s5-0 (editable-flag orient)) (editable-flag orient)) + (format #t "orient ") + ) + (if (= (logand s5-0 (editable-flag z)) (editable-flag z)) + (format #t "z ") + ) + (if (= (logand s5-0 (editable-flag y)) (editable-flag y)) + (format #t "y ") + ) + (if (= (logand s5-0 (editable-flag x)) (editable-flag x)) + (format #t "x ") + ) + (if (= (logand s5-0 (editable-flag changed)) (editable-flag changed)) + (format #t "changed ") + ) + (if (= (logand s5-0 (editable-flag no-plane-snap)) (editable-flag no-plane-snap)) + (format #t "no-plane-snap ") + ) + (if (= (logand s5-0 (editable-flag mark)) (editable-flag mark)) + (format #t "mark ") + ) + (if (= (logand s5-0 (editable-flag bot-set)) (editable-flag bot-set)) + (format #t "bot-set ") + ) + (if (= (logand s5-0 (editable-flag selected)) (editable-flag selected)) + (format #t "selected ") + ) + (if (= (logand s5-0 (editable-flag no-update)) (editable-flag no-update)) + (format #t "no-update ") + ) + ) + (format #t ")~%") + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Towner: ~A~%" (-> obj owner)) + (format #t "~1Tradius: (meters ~m)~%" (-> obj radius)) + (format #t "~1Ttrans: ~`vector`P~%" (-> obj trans)) + (format #t "~1Tdirection: ~`vector`P~%" (-> obj direction)) + (format #t "~1Tcolor: ~`vector`P~%" (-> obj color)) + (format #t "~1Tdecay-start: ~f~%" (-> obj decay-start)) + (format #t "~1Tambient-point-ratio: ~f~%" (-> obj ambient-point-ratio)) + (format #t "~1Tbrightness: ~f~%" (-> obj brightness)) + (label cfg-28) + obj + ) + +;; definition for method 0 of type editable-light +;; INFO: Used lq/sq +(defmethod new editable-light ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 region) #f) + (editable-method-21 gp-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> gp-0 trans quad) (-> arg0 quad)) + (set! (-> gp-0 radius) arg1) + (set! (-> gp-0 owner) '()) + (let ((s5-1 (new 'debug 'string 32 (the-as string #f)))) + (format s5-1 "undefined-~d" *editable-temp-id*) + (set! (-> gp-0 name) s5-1) + ) + (set! *editable-temp-id* (+ *editable-temp-id* 1)) + (set! (-> gp-0 decay-start) 0.5) + (set! (-> gp-0 ambient-point-ratio) 1.0) + (set! (-> gp-0 brightness) 1.0) + (set-vector! (-> gp-0 color) 1.0 1.0 1.0 -1.0) + (set-vector! (-> gp-0 direction) 0.0 0.0 0.0 0.0) + gp-0 + ) + ) + +;; definition of type editable-entity +(deftype editable-entity (editable-point) + () + :method-count-assert 30 + :size-assert #x30 + :flag-assert #x1e00000030 + ) + +;; definition for method 3 of type editable-entity +(defmethod inspect editable-entity ((obj editable-entity)) + (when (not obj) + (set! obj obj) + (goto cfg-28) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tflags: #x~X : (editable-flag " (-> obj flags)) + (let ((s5-0 (-> obj flags))) + (if (= (logand s5-0 (editable-flag no-save)) (editable-flag no-save)) + (format #t "no-save ") + ) + (if (= (logand s5-0 (editable-flag top-set)) (editable-flag top-set)) + (format #t "top-set ") + ) + (if (= (logand s5-0 (editable-flag orient)) (editable-flag orient)) + (format #t "orient ") + ) + (if (= (logand s5-0 (editable-flag z)) (editable-flag z)) + (format #t "z ") + ) + (if (= (logand s5-0 (editable-flag y)) (editable-flag y)) + (format #t "y ") + ) + (if (= (logand s5-0 (editable-flag x)) (editable-flag x)) + (format #t "x ") + ) + (if (= (logand s5-0 (editable-flag changed)) (editable-flag changed)) + (format #t "changed ") + ) + (if (= (logand s5-0 (editable-flag no-plane-snap)) (editable-flag no-plane-snap)) + (format #t "no-plane-snap ") + ) + (if (= (logand s5-0 (editable-flag mark)) (editable-flag mark)) + (format #t "mark ") + ) + (if (= (logand s5-0 (editable-flag bot-set)) (editable-flag bot-set)) + (format #t "bot-set ") + ) + (if (= (logand s5-0 (editable-flag selected)) (editable-flag selected)) + (format #t "selected ") + ) + (if (= (logand s5-0 (editable-flag no-update)) (editable-flag no-update)) + (format #t "no-update ") + ) + ) + (format #t ")~%") + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Towner: ~A~%" (-> obj owner)) + (format #t "~1Tradius: (meters ~m)~%" (-> obj radius)) + (format #t "~1Ttrans: ~`vector`P~%" (-> obj trans)) + (label cfg-28) + obj + ) + +;; definition of type editable-face +(deftype editable-face (editable) + ((length int32 :offset-assert 24) + (normal vector :inline :offset-assert 32) + (center vector :inline :offset-assert 48) + (vertex editable-point 6 :offset-assert 64) + ) + :method-count-assert 32 + :size-assert #x58 + :flag-assert #x2000000058 + (:methods + (new (symbol type editable-region) _type_ 0) + (editable-face-method-30 (_type_ (inline-array vector)) int 30) + (editable-face-method-31 (_type_ vector) vector 31) + ) + ) + +;; definition for method 3 of type editable-face +(defmethod inspect editable-face ((obj editable-face)) + (when (not obj) + (set! obj obj) + (goto cfg-31) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tflags: #x~X : (editable-flag " (-> obj flags)) + (let ((s5-0 (-> obj flags))) + (if (= (logand s5-0 (editable-flag no-save)) (editable-flag no-save)) + (format #t "no-save ") + ) + (if (= (logand s5-0 (editable-flag top-set)) (editable-flag top-set)) + (format #t "top-set ") + ) + (if (= (logand s5-0 (editable-flag orient)) (editable-flag orient)) + (format #t "orient ") + ) + (if (= (logand s5-0 (editable-flag z)) (editable-flag z)) + (format #t "z ") + ) + (if (= (logand s5-0 (editable-flag y)) (editable-flag y)) + (format #t "y ") + ) + (if (= (logand s5-0 (editable-flag x)) (editable-flag x)) + (format #t "x ") + ) + (if (= (logand s5-0 (editable-flag changed)) (editable-flag changed)) + (format #t "changed ") + ) + (if (= (logand s5-0 (editable-flag no-plane-snap)) (editable-flag no-plane-snap)) + (format #t "no-plane-snap ") + ) + (if (= (logand s5-0 (editable-flag mark)) (editable-flag mark)) + (format #t "mark ") + ) + (if (= (logand s5-0 (editable-flag bot-set)) (editable-flag bot-set)) + (format #t "bot-set ") + ) + (if (= (logand s5-0 (editable-flag selected)) (editable-flag selected)) + (format #t "selected ") + ) + (if (= (logand s5-0 (editable-flag no-update)) (editable-flag no-update)) + (format #t "no-update ") + ) + ) + (format #t ")~%") + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Towner: ~A~%" (-> obj owner)) + (format #t "~1Tlength: ~D~%" (-> obj length)) + (format #t "~1Tnormal: ~`vector`P~%" (-> obj normal)) + (format #t "~1Tcenter: ~`vector`P~%" (-> obj center)) + (format #t "~1Tvertex[6] @ #x~X~%" (-> obj vertex)) + (dotimes (s5-1 (-> obj length)) + (format #t "~T [~D]~1Tvertex: ~A~%" s5-1 (-> obj vertex s5-1)) + ) + (label cfg-31) + obj + ) + +;; definition for method 0 of type editable-face +(defmethod new editable-face ((allocation symbol) (type-to-make type) (arg0 editable-region)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 region) #f) + (set! (-> gp-0 name) "undefined") + (editable-method-21 gp-0 (cond + (arg0 + (empty) + arg0 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> gp-0 owner) '()) + gp-0 + ) + ) + +;; definition of type editable-plane +(deftype editable-plane (editable) + ((length int32 :offset-assert 24) + (radius float :offset-assert 28) + (vertex editable-point 2 :offset-assert 32) + ) + :method-count-assert 32 + :size-assert #x28 + :flag-assert #x2000000028 + (:methods + (new (symbol type editable-region) _type_ 0) + (editable-plane-method-30 (_type_ matrix) int 30) + (editable-plane-method-31 (_type_ vector) vector 31) + ) + ) + +;; definition for method 3 of type editable-plane +(defmethod inspect editable-plane ((obj editable-plane)) + (when (not obj) + (set! obj obj) + (goto cfg-31) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tflags: #x~X : (editable-flag " (-> obj flags)) + (let ((s5-0 (-> obj flags))) + (if (= (logand s5-0 (editable-flag no-save)) (editable-flag no-save)) + (format #t "no-save ") + ) + (if (= (logand s5-0 (editable-flag top-set)) (editable-flag top-set)) + (format #t "top-set ") + ) + (if (= (logand s5-0 (editable-flag orient)) (editable-flag orient)) + (format #t "orient ") + ) + (if (= (logand s5-0 (editable-flag z)) (editable-flag z)) + (format #t "z ") + ) + (if (= (logand s5-0 (editable-flag y)) (editable-flag y)) + (format #t "y ") + ) + (if (= (logand s5-0 (editable-flag x)) (editable-flag x)) + (format #t "x ") + ) + (if (= (logand s5-0 (editable-flag changed)) (editable-flag changed)) + (format #t "changed ") + ) + (if (= (logand s5-0 (editable-flag no-plane-snap)) (editable-flag no-plane-snap)) + (format #t "no-plane-snap ") + ) + (if (= (logand s5-0 (editable-flag mark)) (editable-flag mark)) + (format #t "mark ") + ) + (if (= (logand s5-0 (editable-flag bot-set)) (editable-flag bot-set)) + (format #t "bot-set ") + ) + (if (= (logand s5-0 (editable-flag selected)) (editable-flag selected)) + (format #t "selected ") + ) + (if (= (logand s5-0 (editable-flag no-update)) (editable-flag no-update)) + (format #t "no-update ") + ) + ) + (format #t ")~%") + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tid: ~D~%" (-> obj id)) + (format #t "~1Tregion: ~A~%" (-> obj region)) + (format #t "~1Towner: ~A~%" (-> obj owner)) + (format #t "~1Tlength: ~D~%" (-> obj length)) + (format #t "~1Tradius: (meters ~m)~%" (-> obj radius)) + (format #t "~1Tvertex[2] @ #x~X~%" (-> obj vertex)) + (dotimes (s5-1 (-> obj length)) + (format #t "~T [~D]~1Tvertex: ~A~%" s5-1 (-> obj vertex s5-1)) + ) + (label cfg-31) + obj + ) + +;; definition for method 0 of type editable-plane +(defmethod new editable-plane ((allocation symbol) (type-to-make type) (arg0 editable-region)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 region) #f) + (set! (-> gp-0 name) "undefined") + (editable-method-21 gp-0 (cond + (arg0 + (empty) + arg0 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) + (set! (-> gp-0 owner) '()) + (set! (-> gp-0 radius) 20480.0) + gp-0 + ) + ) + +;; definition of type editable-player +(deftype editable-player (process-drawable) + ((current editable-array :offset-assert 200) + (select-command function :offset-assert 204) + (move-command function :offset-assert 208) + (extra-command function :offset-assert 212) + (left-handed basic :offset-assert 216) + (light-names basic :offset-assert 220) + (external-cam-mode symbol :offset-assert 224) + (command function 6 :offset-assert 228) + (close-menu-time time-frame :offset-assert 256) + ) + :heap-base #x90 + :method-count-assert 22 + :size-assert #x108 + :flag-assert #x1600900108 + (:methods + (idle () _type_ :state 20) + (editable-player-method-21 (_type_) none 21) + ) + ) + +;; definition for method 3 of type editable-player +(defmethod inspect editable-player ((obj editable-player)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tcurrent: ~A~%" (-> obj current)) + (format #t "~2Tselect-command: ~D~%" (-> obj select-command)) + (format #t "~2Tmove-command: ~D~%" (-> obj move-command)) + (format #t "~2Textra-command: ~D~%" (-> obj extra-command)) + (format #t "~2Tleft-handed: ~A~%" (-> obj left-handed)) + (format #t "~2Tlight-names: ~A~%" (-> obj light-names)) + (format #t "~2Texternal-cam-mode: ~A~%" (-> obj external-cam-mode)) + (format #t "~2Tcommand[6] @ #x~X~%" (-> obj command)) + (format #t "~2Tclose-menu-time: ~D~%" (-> obj close-menu-time)) + (label cfg-4) + obj + ) + +;; definition of type editable-work +(deftype editable-work (basic) + ((num-found int16 :offset-assert 4) + (last-found int16 :offset-assert 6) + (last-x float :offset-assert 8) + (last-y float :offset-assert 12) + (found editable 256 :offset-assert 16) + (dists uint32 256 :offset-assert 1040) + ) + :method-count-assert 9 + :size-assert #x810 + :flag-assert #x900000810 + ) + +;; definition for method 3 of type editable-work +(defmethod inspect editable-work ((obj editable-work)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tnum-found: ~D~%" (-> obj num-found)) + (format #t "~1Tlast-found: ~D~%" (-> obj last-found)) + (format #t "~1Tlast-x: ~f~%" (-> obj last-x)) + (format #t "~1Tlast-y: ~f~%" (-> obj last-y)) + (format #t "~1Tfound[256] @ #x~X~%" (-> obj found)) + (format #t "~1Tdists[256] @ #x~X~%" (-> obj dists)) + (label cfg-4) + obj + ) + +;; definition for symbol *editable-work*, type editable-work +(define *editable-work* (new 'global 'editable-work)) + +;; definition for symbol *editable*, type (pointer editable-player) +(define *editable* (the-as (pointer editable-player) #f)) + +;; failed to figure out what this is: +0 + +) diff --git a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc new file mode 100644 index 0000000000..6ed7bef172 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc @@ -0,0 +1,2978 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition for function cleanup-selection +;; WARN: Return type mismatch int vs none. +(defun cleanup-selection ((arg0 editable-array)) + (let* ((v1-0 (-> arg0 length)) + (a0-1 0) + (a1-2 (-> arg0 data a0-1)) + ) + (while (< a0-1 v1-0) + (if a1-2 + (logclear! (-> a1-2 flags) (editable-flag mark)) + ) + (+! a0-1 1) + (set! a1-2 (-> arg0 data a0-1)) + ) + ) + (let* ((s5-0 (-> arg0 length)) + (s4-0 0) + (a0-2 (-> arg0 data s4-0)) + ) + (while (< s4-0 s5-0) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (editable-method-29 a0-2 (editable-filter)) + ) + (+! s4-0 1) + (set! a0-2 (-> arg0 data s4-0)) + ) + ) + 0 + (none) + ) + +;; definition for function insert-box +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: Function insert-box has a return type of none, but the expression builder found a return statement. +(defun insert-box ((arg0 editable-array) (arg1 vector)) + (if (not (-> arg0 region)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((f30-0 (* 4096.0 (-> arg0 edit-param0))) + (s3-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'transform)) + ) + (let ((s4-0 (-> arg0 region))) + (if (= f30-0 0.0) + (set! f30-0 40960.0) + ) + (dotimes (s1-0 8) + (set! (-> s5-0 trans data s1-0) (the-as float (editable-array-method-11 arg0))) + (let ((v1-10 #t) + (a0-9 (+ (* (-> s5-0 trans data s1-0) 4) (the-as int arg0))) + ) + (s.w! (+ a0-9 120) v1-10) + ) + ) + (dotimes (v1-13 8) + (when (< (the-as int (-> s5-0 trans data v1-13)) 0) + (dotimes (v1-14 8) + (let ((a0-18 (+ (* (-> s5-0 trans data v1-14) 4) (the-as int arg0)))) + (s.w! (+ a0-18 120) #f) + ) + ) + (return #f) + ) + ) + (set! (-> s3-0 quad) (-> arg1 quad)) + (set! (-> s3-0 y) (- (-> s3-0 y) f30-0)) + (set! (-> s3-0 x) (- (-> s3-0 x) f30-0)) + (set! (-> s3-0 z) (- (-> s3-0 z) f30-0)) + (let ((v1-21 (new 'debug 'editable-point s3-0 s4-0)) + (a0-24 (+ (* (-> s5-0 trans x) 4) (the-as int arg0))) + ) + (s.w! (+ a0-24 120) v1-21) + ) + (set! (-> s3-0 quad) (-> arg1 quad)) + (set! (-> s3-0 y) (- (-> s3-0 y) f30-0)) + (+! (-> s3-0 x) f30-0) + (set! (-> s3-0 z) (- (-> s3-0 z) f30-0)) + (let ((v1-24 (new 'debug 'editable-point s3-0 s4-0)) + (a0-30 (+ (* (-> s5-0 trans y) 4) (the-as int arg0))) + ) + (s.w! (+ a0-30 120) v1-24) + ) + (set! (-> s3-0 quad) (-> arg1 quad)) + (set! (-> s3-0 y) (- (-> s3-0 y) f30-0)) + (set! (-> s3-0 x) (- (-> s3-0 x) f30-0)) + (+! (-> s3-0 z) f30-0) + (let ((v1-27 (new 'debug 'editable-point s3-0 s4-0)) + (a0-36 (+ (* (-> s5-0 trans z) 4) (the-as int arg0))) + ) + (s.w! (+ a0-36 120) v1-27) + ) + (set! (-> s3-0 quad) (-> arg1 quad)) + (set! (-> s3-0 y) (- (-> s3-0 y) f30-0)) + (+! (-> s3-0 x) f30-0) + (+! (-> s3-0 z) f30-0) + (let ((v1-30 (new 'debug 'editable-point s3-0 s4-0)) + (a0-42 (+ (* (-> s5-0 trans w) 4) (the-as int arg0))) + ) + (s.w! (+ a0-42 120) v1-30) + ) + (set! (-> s3-0 quad) (-> arg1 quad)) + (+! (-> s3-0 y) f30-0) + (set! (-> s3-0 x) (- (-> s3-0 x) f30-0)) + (set! (-> s3-0 z) (- (-> s3-0 z) f30-0)) + (let ((v1-33 (new 'debug 'editable-point s3-0 s4-0)) + (a0-48 (+ (* (-> s5-0 rot x) 4) (the-as int arg0))) + ) + (s.w! (+ a0-48 120) v1-33) + ) + (set! (-> s3-0 quad) (-> arg1 quad)) + (+! (-> s3-0 y) f30-0) + (+! (-> s3-0 x) f30-0) + (set! (-> s3-0 z) (- (-> s3-0 z) f30-0)) + (let ((v1-36 (new 'debug 'editable-point s3-0 s4-0)) + (a0-54 (+ (* (-> s5-0 rot y) 4) (the-as int arg0))) + ) + (s.w! (+ a0-54 120) v1-36) + ) + (set! (-> s3-0 quad) (-> arg1 quad)) + (+! (-> s3-0 y) f30-0) + (set! (-> s3-0 x) (- (-> s3-0 x) f30-0)) + (+! (-> s3-0 z) f30-0) + (let ((v1-39 (new 'debug 'editable-point s3-0 s4-0)) + (a0-60 (+ (* (-> s5-0 rot z) 4) (the-as int arg0))) + ) + (s.w! (+ a0-60 120) v1-39) + ) + (set! (-> s3-0 quad) (-> arg1 quad)) + (+! (-> s3-0 y) f30-0) + (+! (-> s3-0 x) f30-0) + (+! (-> s3-0 z) f30-0) + (let ((v1-42 (new 'debug 'editable-point s3-0 s4-0)) + (a0-65 (+ (* (-> s5-0 rot w) 4) (the-as int arg0))) + ) + (s.w! (+ a0-65 120) v1-42) + ) + (editable-array-method-9 arg0 (editable-command select-none) (the-as editable-array #f)) + (select-editable! (l.wu (+ (* (-> s5-0 trans x) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 trans y) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 trans z) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 trans w) 4) (the-as int arg0) 120)) #t) + (set! (-> arg0 region) s4-0) + (editable-array-method-9 arg0 (editable-command insert-face) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command select-none) (the-as editable-array #f)) + (select-editable! (l.wu (+ (* (-> s5-0 rot x) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot y) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot z) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot w) 4) (the-as int arg0) 120)) #t) + (set! (-> arg0 region) s4-0) + (editable-array-method-9 arg0 (editable-command insert-face) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command flip-side) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command select-none) (the-as editable-array #f)) + (select-editable! (l.wu (+ (* (-> s5-0 trans x) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 trans z) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot x) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot z) 4) (the-as int arg0) 120)) #t) + (set! (-> arg0 region) s4-0) + (editable-array-method-9 arg0 (editable-command insert-face) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command select-none) (the-as editable-array #f)) + (select-editable! (l.wu (+ (* (-> s5-0 trans y) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 trans w) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot y) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot w) 4) (the-as int arg0) 120)) #t) + (set! (-> arg0 region) s4-0) + (editable-array-method-9 arg0 (editable-command insert-face) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command flip-side) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command select-none) (the-as editable-array #f)) + (select-editable! (l.wu (+ (* (-> s5-0 trans x) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 trans y) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot x) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot y) 4) (the-as int arg0) 120)) #t) + (set! (-> arg0 region) s4-0) + (editable-array-method-9 arg0 (editable-command insert-face) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command flip-side) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command select-none) (the-as editable-array #f)) + (select-editable! (l.wu (+ (* (-> s5-0 trans z) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 trans w) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot z) 4) (the-as int arg0) 120)) #t) + (select-editable! (l.wu (+ (* (-> s5-0 rot w) 4) (the-as int arg0) 120)) #t) + (set! (-> arg0 region) s4-0) + (editable-array-method-9 arg0 (editable-command insert-face) (the-as editable-array #f)) + (editable-array-method-9 arg0 (editable-command select-none) (the-as editable-array #f)) + (set! (-> arg0 region) s4-0) + ) + (dotimes (s4-1 8) + (select-editable! (l.wu (+ (* (-> s5-0 trans data s4-1) 4) (the-as int arg0) 120)) #t) + ) + ) + (editable-array-method-9 arg0 (editable-command select-current-owner) (the-as editable-array #f)) + 0 + (none) + ) + +;; definition for function execute-select +(defun execute-select ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) + (case arg1 + (((editable-command select-none)) + (let* ((s5-1 (-> arg0 length)) + (s4-0 0) + (a0-2 (-> arg0 data s4-0)) + ) + (while (< s4-0 s5-1) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (select-editable! a0-2 #f) + ) + (+! s4-0 1) + (set! a0-2 (-> arg0 data s4-0)) + ) + ) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) #f) + ) + ) + (((editable-command select-all)) + (let* ((s5-2 (-> arg0 length)) + (s4-1 0) + (a0-4 (-> arg0 data s4-1)) + ) + (while (< s4-1 s5-2) + (if (and a0-4 (or (and (logtest? (-> a0-4 region filter) (-> arg0 filter 0)) + (logtest? (-> a0-4 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> a0-4 flags) (editable-flag selected)) + ) + ) + (select-editable! a0-4 #t) + ) + (+! s4-1 1) + (set! a0-4 (-> arg0 data s4-1)) + ) + ) + ) + (((editable-command select-one)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-7 arg0) + (t9-4 (method-of-object a0-7 editable-array-method-10)) + (a1-12 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-12 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-12 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-12 z) 0.0) + (set! (-> a1-12 w) 1.0) + (let ((s4-3 (t9-4 a0-7 a1-12 0))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (when s4-3 + (select-editable! s4-3 #t) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s4-3 region)) + ) + ) + ) + ) + ) + (((editable-command select-toggle)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-12 arg0) + (t9-9 (method-of-object a0-12 editable-array-method-10)) + (a1-16 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-16 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-16 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-16 z) 0.0) + (set! (-> a1-16 w) 1.0) + (let ((s5-3 (t9-9 a0-12 a1-16 1))) + (when s5-3 + (select-editable! s5-3 'toggle) + (if (and (logtest? (-> s5-3 flags) (editable-flag selected)) (not (-> arg0 region-lock?))) + (set! (-> arg0 region) (-> s5-3 region)) + ) + ) + ) + ) + ) + (((editable-command select-region)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-16 arg0) + (t9-13 (method-of-object a0-16 editable-array-method-10)) + (a1-19 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-19 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-19 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-19 z) 0.0) + (set! (-> a1-19 w) 1.0) + (let ((s4-6 (t9-13 a0-16 a1-19 0))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (when s4-6 + (select-editable! s4-6 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s4-6 region)) + (editable-array-method-9 arg0 (editable-command select-current-region) arg2) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + ) + (((editable-command select-face)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-22 arg0) + (t9-19 (method-of-object a0-22 editable-array-method-10)) + (a1-24 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-24 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-24 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-24 z) 0.0) + (set! (-> a1-24 w) 1.0) + (let ((s4-8 (t9-19 a0-22 a1-24 0))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (when s4-8 + (select-editable! s4-8 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s4-8 region)) + (editable-array-method-9 arg0 (editable-command select-current-face) arg2) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + ) + (((editable-command select-prim)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-28 arg0) + (t9-25 (method-of-object a0-28 editable-array-method-10)) + (a1-29 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-29 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-29 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-29 z) 0.0) + (set! (-> a1-29 w) 1.0) + (let ((s4-10 (t9-25 a0-28 a1-29 0))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (when s4-10 + (select-editable! s4-10 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s4-10 region)) + (editable-array-method-9 arg0 (editable-command select-current-prim) arg2) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + ) + (((editable-command select-current-region)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (when (-> arg0 region) + (let ((s4-12 (-> arg0 region))) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (set! (-> arg0 region) s4-12) + ) + (let* ((s5-4 (-> arg0 length)) + (s4-13 0) + (a0-35 (-> arg0 data s4-13)) + ) + (while (< s4-13 s5-4) + (when (and a0-35 (or (and (logtest? (-> a0-35 region filter) (-> arg0 filter 0)) + (logtest? (-> a0-35 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> a0-35 flags) (editable-flag selected)) + ) + ) + (if (= (-> arg0 region) (-> a0-35 region)) + (select-editable! a0-35 #t) + ) + ) + (+! s4-13 1) + (set! a0-35 (-> arg0 data s4-13)) + ) + ) + ) + ) + (((editable-command select-current-owner)) + (let* ((s5-5 (-> arg0 length)) + (s4-14 0) + (v1-121 (-> arg0 data s4-14)) + ) + (while (< s4-14 s5-5) + (when (and v1-121 (logtest? (-> v1-121 flags) (editable-flag selected))) + (let* ((s3-6 (-> v1-121 owner)) + (a0-40 (car s3-6)) + ) + (while (not (null? s3-6)) + (select-editable! (the-as editable a0-40) #t) + (set! s3-6 (cdr s3-6)) + (set! a0-40 (car s3-6)) + ) + ) + ) + (+! s4-14 1) + (set! v1-121 (-> arg0 data s4-14)) + ) + ) + ) + (((editable-command select-current-face)) + (let* ((s5-6 (-> arg0 length)) + (s4-15 0) + (v1-134 (-> arg0 data s4-15)) + ) + (while (< s4-15 s5-6) + (when (and v1-134 (logtest? (-> v1-134 flags) (editable-flag selected))) + (let* ((s3-7 (-> v1-134 owner)) + (a0-45 (car s3-7)) + ) + (while (not (null? s3-7)) + (select-editable! (the-as editable a0-45) #t) + (set! s3-7 (cdr s3-7)) + (set! a0-45 (car s3-7)) + ) + ) + ) + (+! s4-15 1) + (set! v1-134 (-> arg0 data s4-15)) + ) + ) + (let* ((s5-7 (-> arg0 length)) + (s4-16 0) + (s3-8 (-> arg0 data s4-16)) + ) + (while (< s4-16 s5-7) + (when (and s3-8 (or (and (logtest? (-> s3-8 region filter) (-> arg0 filter 0)) + (logtest? (-> s3-8 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> s3-8 flags) (editable-flag selected)) + ) + ) + (let* ((s2-0 (-> s3-8 owner)) + (v1-155 (car s2-0)) + ) + (while (not (null? s2-0)) + (if (logtest? (-> (the-as editable v1-155) flags) (editable-flag selected)) + (select-editable! s3-8 #t) + ) + (set! s2-0 (cdr s2-0)) + (set! v1-155 (car s2-0)) + ) + ) + ) + (+! s4-16 1) + (set! s3-8 (-> arg0 data s4-16)) + ) + ) + ) + (((editable-command select-current-prim)) + (countdown (s5-8 10) + (let* ((s4-17 (-> arg0 length)) + (s3-9 0) + (v1-169 (-> arg0 data s3-9)) + ) + (while (< s3-9 s4-17) + (when (and v1-169 (logtest? (-> v1-169 flags) (editable-flag selected))) + (let* ((s2-1 (-> v1-169 owner)) + (a0-58 (car s2-1)) + ) + (while (not (null? s2-1)) + (select-editable! (the-as editable a0-58) #t) + (set! s2-1 (cdr s2-1)) + (set! a0-58 (car s2-1)) + ) + ) + ) + (+! s3-9 1) + (set! v1-169 (-> arg0 data s3-9)) + ) + ) + (let* ((s4-18 (-> arg0 length)) + (s3-10 0) + (s2-2 (-> arg0 data s3-10)) + ) + (while (< s3-10 s4-18) + (when (and s2-2 (or (and (logtest? (-> s2-2 region filter) (-> arg0 filter 0)) + (logtest? (-> s2-2 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> s2-2 flags) (editable-flag selected)) + ) + ) + (let* ((s1-0 (-> s2-2 owner)) + (v1-190 (car s1-0)) + ) + (while (not (null? s1-0)) + (if (logtest? (-> (the-as editable v1-190) flags) (editable-flag selected)) + (select-editable! s2-2 #t) + ) + (set! s1-0 (cdr s1-0)) + (set! v1-190 (car s1-0)) + ) + ) + ) + (+! s3-10 1) + (set! s2-2 (-> arg0 data s3-10)) + ) + ) + ) + ) + (((editable-command cancel)) + (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) + ) + (((editable-command pick-target)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a0-71 arg0) + (t9-41 (method-of-object a0-71 editable-array-method-10)) + (a1-58 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-58 x) (-> arg2 edit-plane-normal x)) + (set! (-> a1-58 y) (-> arg2 edit-plane-normal y)) + (set! (-> a1-58 z) 0.0) + (set! (-> a1-58 w) 1.0) + (let ((v1-208 (t9-41 a0-71 a1-58 0))) + (when v1-208 + (set! (-> arg0 target) v1-208) + (editable-array-method-9 arg0 (the-as editable-command (-> arg0 target-command)) arg2) + ) + ) + ) + (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) + ) + (((editable-command pick-loc) (editable-command pick-yes-no)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (editable-array-method-9 arg0 (the-as editable-command (-> arg0 target-command)) arg2) + (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) + ) + (((editable-command edit-plane-clear)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (set! (-> arg0 edit-plane) #f) + (editable-array-method-16 arg0) + ) + (((editable-command edit-plane-set)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (cond + ((-> arg0 target) + (let ((s5-11 (-> arg0 target))) + (set! (-> arg0 edit-plane) (the-as editable-plane (if (type? s5-11 editable-plane) + s5-11 + ) + ) + ) + ) + (editable-array-method-16 arg0) + ) + (else + (editable-array-method-14 + arg0 + (the-as (function symbol) (lambda ((arg0 editable)) (type? arg0 editable-plane))) + #f + ) + (cond + ((>= (-> arg0 selection length) 1) + (set! (-> arg0 edit-plane) (the-as editable-plane (-> arg0 selection 0))) + (editable-array-method-16 arg0) + ) + (else + (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 45) "pick the plane to edit-from") + ) + ) + ) + ) + ) + (((editable-command print-region-info)) + (let ((s5-12 (-> arg0 region))) + (when s5-12 + (format #t "~%~%region-~D~%~%" (-> s5-12 id)) + (let ((a2-35 (-> s5-12 on-enter))) + (if a2-35 + (format #t "(on-enter ~S)~%" a2-35) + ) + ) + (let ((a2-36 (-> s5-12 on-inside))) + (if a2-36 + (format #t "(on-inside ~S)~%" a2-36) + ) + ) + (let ((a2-37 (-> s5-12 on-exit))) + (if a2-37 + (format #t "(on-exit ~S)~%" a2-37) + ) + ) + (format #t "~%~%") + ) + ) + (format #t "~%selected:~%") + (let* ((s5-13 (-> arg0 length)) + (s4-23 0) + (a2-38 (-> arg0 data s4-23)) + ) + (while (< s4-23 s5-13) + (if (and a2-38 (logtest? (-> a2-38 flags) (editable-flag selected))) + (format #t "~A~%" a2-38) + ) + (+! s4-23 1) + (set! a2-38 (-> arg0 data s4-23)) + ) + ) + (format #t "~%~%") + ) + (else + (return #f) + ) + ) + #t + ) + +;; definition for function execute-mouse-move +;; INFO: Used lq/sq +(defun execute-mouse-move ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) + (local-vars (f0-6 float) (f0-18 float) (f0-29 float)) + (case arg1 + (((editable-command camera-tumble)) + (set-setting! 'mouse-input 'abs #t 0) + (let ((s5-0 (new-stack-vector0)) + (f30-0 0.0) + ) + (let* ((s4-0 (-> arg0 length)) + (s3-0 0) + (a0-3 (-> arg0 data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and a0-3 (logtest? (-> a0-3 flags) (editable-flag selected))) + (vector+! s5-0 s5-0 (edit-get-trans a0-3)) + (set! f30-0 (+ 1.0 f30-0)) + ) + (+! s3-0 1) + (set! a0-3 (-> arg0 data s3-0)) + ) + ) + (cond + ((= f30-0 0.0) + (remove-setting! 'mouse-tumble-point) + ) + (else + (vector-float/! s5-0 s5-0 f30-0) + (set-setting! 'mouse-tumble-point 'abs s5-0 0) + ) + ) + ) + ) + (((editable-command camera-xy)) + (set-setting! 'mouse-input 'abs #t 0) + ) + (((editable-command camera-xz)) + (set-setting! 'mouse-input 'abs #t 0) + ) + (((editable-command drag-move-x)) + (let ((v1-25 (-> arg2 level-offset)) + (a0-12 (-> arg2 edit-plane-normal)) + (s5-1 (new-stack-vector0)) + (s4-1 (-> *math-camera* trans)) + ) + 0.0 + (let* ((f0-4 (- (-> v1-25 x) (-> a0-12 x))) + (f1-2 (- (-> v1-25 y) (-> a0-12 y))) + (f30-1 (if (< (fabs f1-2) (fabs f0-4)) + f0-4 + f1-2 + ) + ) + ) + (if (< (-> *math-camera* camera-rot vector 0 x) 0.0) + (set! f30-1 (- f30-1)) + ) + (let* ((s3-1 (-> arg0 length)) + (s2-1 0) + (s1-2 (-> arg0 data s2-1)) + ) + (while (< s2-1 s3-1) + (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) + (set! f0-6 (cond + ((-> arg0 move-lock?) + (-> arg0 move-speed) + ) + (else + (vector-! s5-1 (edit-get-trans s1-2) s4-1) + (let ((f0-9 (* 0.00390625 f30-1 (vector-length s5-1)))) + (set! f0-6 (fmax -40960.0 (fmin 40960.0 f0-9))) + ) + (set! (-> arg0 move-speed) f0-6) + (set! (-> arg0 move-lock?) #t) + f0-6 + ) + ) + ) + (set-vector! s5-1 f0-6 0.0 0.0 0.0) + (editable-method-15 s1-2 s5-1 56) + ) + (+! s2-1 1) + (set! s1-2 (-> arg0 data s2-1)) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + (((editable-command drag-move-y)) + (let ((v1-54 (-> arg2 level-offset)) + (a0-20 (-> arg2 edit-plane-normal)) + (s5-2 (new-stack-vector0)) + (s4-2 (-> *math-camera* trans)) + ) + 0.0 + (let* ((f0-16 (- (-> v1-54 x) (-> a0-20 x))) + (f1-8 (- (-> v1-54 y) (-> a0-20 y))) + (f30-2 (if (< (fabs f1-8) (fabs f0-16)) + f0-16 + f1-8 + ) + ) + ) + (if (< (-> *math-camera* camera-rot vector 1 y) 0.0) + (set! f30-2 (- f30-2)) + ) + (let* ((s3-2 (-> arg0 length)) + (s2-2 0) + (s1-3 (-> arg0 data s2-2)) + ) + (while (< s2-2 s3-2) + (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) + (set! f0-18 (cond + ((-> arg0 move-lock?) + (-> arg0 move-speed) + ) + (else + (vector-! s5-2 (edit-get-trans s1-3) s4-2) + (let ((f0-21 (* 0.00390625 f30-2 (vector-length s5-2)))) + (set! f0-18 (fmax -40960.0 (fmin 40960.0 f0-21))) + ) + (set! (-> arg0 move-speed) f0-18) + (set! (-> arg0 move-lock?) #t) + f0-18 + ) + ) + ) + (set-vector! s5-2 0.0 f0-18 0.0 0.0) + (editable-method-15 s1-3 s5-2 56) + ) + (+! s2-2 1) + (set! s1-3 (-> arg0 data s2-2)) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + (((editable-command drag-move-z)) + (let ((v1-83 (-> arg2 level-offset)) + (a0-28 (-> arg2 edit-plane-normal)) + (s5-3 (new-stack-vector0)) + (s4-3 (-> *math-camera* trans)) + ) + 0.0 + (let* ((f0-27 (- (-> v1-83 x) (-> a0-28 x))) + (f1-15 (- (-> v1-83 y) (-> a0-28 y))) + (f30-3 (if (< (fabs f1-15) (fabs f0-27)) + f0-27 + f1-15 + ) + ) + ) + (if (>= (-> *math-camera* camera-rot vector 0 z) 0.0) + (set! f30-3 (- f30-3)) + ) + (let* ((s3-3 (-> arg0 length)) + (s2-3 0) + (s1-4 (-> arg0 data s2-3)) + ) + (while (< s2-3 s3-3) + (when (and s1-4 (logtest? (-> s1-4 flags) (editable-flag selected))) + (set! f0-29 (cond + ((-> arg0 move-lock?) + (-> arg0 move-speed) + ) + (else + (vector-! s5-3 (edit-get-trans s1-4) s4-3) + (let ((f0-32 (* 0.00390625 f30-3 (vector-length s5-3)))) + (set! (-> arg0 move-speed) f0-32) + (set! f0-29 (fmax -40960.0 (fmin 40960.0 f0-32))) + ) + (set! (-> arg0 move-lock?) #t) + f0-29 + ) + ) + ) + (set-vector! s5-3 0.0 0.0 f0-29 0.0) + (editable-method-15 s1-4 s5-3 56) + ) + (+! s2-3 1) + (set! s1-4 (-> arg0 data s2-3)) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + (((editable-command drag-move-xz)) + (let ((s5-4 (-> arg2 level-offset)) + (s4-4 (-> arg2 edit-plane-normal)) + (s3-4 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-4 x) 0.0) + (set! (-> s3-4 y) 1.0) + (set! (-> s3-4 z) 0.0) + (set! (-> s3-4 w) 1.0) + (let* ((s2-4 (new-stack-vector0)) + (s1-5 (-> arg0 length)) + (s0-6 0) + (a0-36 (-> arg0 data s0-6)) + ) + (while (< s0-6 s1-5) + (when (and a0-36 (logtest? (-> a0-36 flags) (editable-flag selected))) + (if (= (-> s2-4 w) 0.0) + (editable-method-20 a0-36 s5-4 s4-4 s3-4 s2-4) + (editable-method-15 a0-36 s2-4 56) + ) + ) + (+! s0-6 1) + (set! a0-36 (-> arg0 data s0-6)) + ) + ) + ) + (cleanup-selection arg0) + ) + (((editable-command drag-move-xy)) + (let ((s5-5 (-> arg2 level-offset)) + (s4-5 (-> arg2 edit-plane-normal)) + (s3-5 (-> *math-camera* inv-camera-rot vector 2)) + (s2-5 (new-stack-vector0)) + ) + (set! (-> s3-5 y) 0.0) + (vector-normalize! s3-5 1.0) + (let* ((s1-6 (-> arg0 length)) + (s0-7 0) + (a0-40 (-> arg0 data s0-7)) + ) + (while (< s0-7 s1-6) + (when (and a0-40 (logtest? (-> a0-40 flags) (editable-flag selected))) + (if (= (-> s2-5 w) 0.0) + (editable-method-20 a0-40 s5-5 s4-5 s3-5 s2-5) + (editable-method-15 a0-40 s2-5 56) + ) + ) + (+! s0-7 1) + (set! a0-40 (-> arg0 data s0-7)) + ) + ) + ) + (cleanup-selection arg0) + ) + (else + (return #f) + ) + ) + #t + ) + +;; definition for function execute-move +(defun execute-move ((arg0 editable-array) (arg1 editable-command) (arg2 editable-array)) + (case arg1 + (((editable-command drag-resize)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 x) (* 100.0 (- (-> arg2 edit-plane-normal x) (-> arg2 level-offset x)))) + (set! (-> s4-0 y) 0.0) + (set! (-> s4-0 z) 0.0) + (set! (-> s4-0 w) 1.0) + (let* ((s5-1 (-> arg0 length)) + (s3-0 0) + (a0-2 (-> arg0 data s3-0)) + ) + (while (< s3-0 s5-1) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (editable-method-17 a0-2 s4-0) + ) + (+! s3-0 1) + (set! a0-2 (-> arg0 data s3-0)) + ) + ) + ) + ) + (((editable-command refresh-filter)) + (let* ((s5-2 (-> arg0 length)) + (s4-1 0) + (s3-1 (-> arg0 data s4-1)) + ) + (while (< s4-1 s5-2) + (if (and s3-1 (-> s3-1 region)) + (set! (-> s3-1 region filter) (editable-region-method-12 (-> s3-1 region))) + ) + (+! s4-1 1) + (set! s3-1 (-> arg0 data s4-1)) + ) + ) + ) + (((editable-command resize)) + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 x) 0.0) + (set! (-> s5-3 y) (* 4096.0 (-> arg0 edit-param0))) + (set! (-> s5-3 z) 0.0) + (set! (-> s5-3 w) 1.0) + (let* ((s4-2 (-> arg0 length)) + (s3-2 0) + (a0-7 (-> arg0 data s3-2)) + ) + (while (< s3-2 s4-2) + (if (and a0-7 (logtest? (-> a0-7 flags) (editable-flag selected))) + (editable-method-17 a0-7 s5-3) + ) + (+! s3-2 1) + (set! a0-7 (-> arg0 data s3-2)) + ) + ) + ) + ) + (((editable-command insert-sphere)) + (let ((s4-3 (editable-array-method-11 arg0))) + (when (>= s4-3 0) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-3 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-4 (new 'debug 'editable-sphere a2-3 2048.0 (-> arg0 region))) + ) + (set! (-> arg0 data s4-3) s3-4) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-4 #t) + ) + ) + ) + ) + (((editable-command insert-point)) + (let ((s4-4 (editable-array-method-11 arg0))) + (when (>= s4-4 0) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-7 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-6 (new 'debug 'editable-point a2-7 (-> arg0 region))) + ) + (set! (-> arg0 data s4-4) s3-6) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-6 #t) + ) + ) + ) + ) + (((editable-command insert-sample)) + (let ((s4-5 (editable-array-method-11 arg0))) + (when (>= s4-5 0) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-11 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-8 (new 'debug 'editable-sample a2-11 *editable-sample-region*)) + ) + (set! (-> arg0 data s4-5) s3-8) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-8 #t) + ) + ) + ) + ) + (((editable-command insert-sample-camera)) + (let ((s4-6 (editable-array-method-11 arg0))) + (when (>= s4-6 0) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let ((s3-11 (new 'debug 'editable-sample (math-camera-pos) *editable-sample-region*))) + (set! (-> arg0 data s4-6) s3-11) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-11 #t) + ) + ) + ) + ) + (((editable-command insert-light)) + (let ((s4-7 (editable-array-method-11 arg0))) + (when (>= s4-7 0) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-18 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-13 (new 'debug 'editable-light a2-18 2048.0 *editable-light-region*)) + ) + (set! (-> arg0 data s4-7) s3-13) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-13 #t) + (editable-method-23 s3-13) + ) + (update-light-hash *light-hash*) + ) + ) + ) + (((editable-command insert-entity)) + (let ((s4-8 (editable-array-method-11 arg0))) + (when (>= s4-8 0) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((a2-22 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) + (s3-15 (new 'debug 'editable-entity a2-22 *editable-entity-region*)) + ) + (set! (-> arg0 data s4-8) s3-15) + (editable-array-method-9 arg0 (editable-command select-none) arg2) + (select-editable! s3-15 #t) + ) + ) + ) + ) + (((editable-command insert-box)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((a1-42 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal)))) + (insert-box arg0 a1-42) + ) + ) + (((editable-command insert-face)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((s4-11 (editable-array-method-11 arg0))) + 0 + (editable-array-method-14 + arg0 + (the-as + (function symbol) + (lambda ((arg0 editable) (arg1 symbol)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) + ) + (the-as symbol (-> arg0 region)) + ) + (let ((s5-5 (-> arg0 selection length))) + (cond + ((= s5-5 1) + (cond + ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) + (set! (-> arg0 selection 1) (-> arg0 target)) + (+! (-> arg0 selection length) 1) + (+! s5-5 1) + ) + (else + (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 33) "pick the point to complete the face") + (return #f) + ) + ) + ) + ((and (>= s5-5 2) (>= 6 s5-5)) + ) + (else + (format + 0 + "ERROR: face can only be inserted if there are 2-6 points selected in the current region, got ~D.~%" + s5-5 + ) + (return #f) + ) + ) + (when (>= s4-11 0) + (let ((s3-17 (new 'debug 'editable-face (-> arg0 region)))) + (set! (-> arg0 data s4-11) s3-17) + (dotimes (s4-12 s5-5) + (set! (-> s3-17 vertex s4-12) (the-as editable-point (-> arg0 selection s4-12))) + (set! (-> arg0 selection s4-12 owner) (cons s3-17 (-> arg0 selection s4-12 owner))) + ) + (set! (-> s3-17 length) s5-5) + (select-editable! s3-17 #t) + (editable-method-28 s3-17 (editable-filter load)) + (editable-method-29 s3-17 (editable-filter load)) + ) + ) + ) + ) + ) + (((editable-command insert-plane)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let ((s3-18 (editable-array-method-11 arg0))) + 0 + (editable-array-method-14 + arg0 + (the-as + (function symbol) + (lambda ((arg0 editable) (arg1 symbol)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) + ) + (the-as symbol (-> arg0 region)) + ) + (let ((s5-7 (-> arg0 selection length))) + (cond + ((= s5-7 1) + (cond + ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) + (set! (-> arg0 selection 1) (-> arg0 target)) + (+! (-> arg0 selection length) 1) + (+! s5-7 1) + ) + (else + (editable-array-method-13 arg0 (the-as uint 14) (the-as basic 34) "pick the point to complete the plane") + (return #f) + ) + ) + ) + ((= s5-7 2) + ) + (else + (format + 0 + "ERROR: plane can only be inserted if there are 2 points selected in the current region, got ~D.~%" + s5-7 + ) + (return #f) + ) + ) + (when (>= s3-18 0) + (let ((s4-14 (new 'debug 'editable-plane (-> arg0 region)))) + (set! (-> arg0 data s3-18) s4-14) + (dotimes (s3-19 s5-7) + (set! (-> s4-14 vertex s3-19) (the-as editable-point (-> arg0 selection s3-19))) + (set! (-> arg0 selection s3-19 owner) (cons s4-14 (-> arg0 selection s3-19 owner))) + ) + (set! (-> s4-14 length) s5-7) + (select-editable! s4-14 #t) + (editable-method-28 s4-14 (editable-filter load)) + (editable-method-29 s4-14 (editable-filter load)) + ) + ) + ) + ) + ) + (else + (return #f) + ) + ) + #t + ) + +;; definition for method 9 of type editable-array +(defmethod editable-array-method-9 editable-array ((obj editable-array) (arg0 editable-command) (arg1 editable-array)) + (if (execute-select obj arg0 arg1) + (return #f) + ) + (if (execute-move obj arg0 arg1) + (return #f) + ) + (if (execute-mouse-move obj arg0 arg1) + (return #f) + ) + (cond + ((= arg0 (editable-command copy)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (set! (-> obj selection length) 0) + (let* ((s4-2 (-> obj length)) + (s3-1 0) + (s2-0 (-> obj data s3-1)) + ) + (while (< s3-1 s4-2) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (editable-method-27 s2-0 obj) + (when (= (-> s2-0 type) editable-light) + (editable-method-23 s2-0) + (update-light-hash *light-hash*) + ) + ) + (+! s3-1 1) + (set! s2-0 (-> obj data s3-1)) + ) + ) + (editable-array-method-9 obj (editable-command select-none) arg1) + (let ((s5-1 (the-as editable-region #f))) + (dotimes (s4-3 (-> obj selection length)) + (let ((a0-13 (-> obj selection s4-3))) + (when (and a0-13 (logtest? s4-3 1)) + (set! s5-1 (-> a0-13 region)) + (select-editable! a0-13 #t) + ) + ) + ) + (if (not (-> obj region-lock?)) + (set! (-> obj region) s5-1) + ) + ) + ) + ((= arg0 (editable-command copy-region)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (when (and (-> obj region) (not (-> obj region locked))) + (editable-array-method-9 obj (editable-command select-current-region) arg1) + (let ((v1-52 (copy (-> obj region) 'debug))) + (set! (-> v1-52 id) (the-as uint 0)) + (set! (-> v1-52 changed) #t) + (set! (-> obj region) v1-52) + ) + (editable-array-method-9 obj (editable-command copy) arg1) + ) + ) + ((= arg0 (editable-command delete)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((s5-3 (-> obj length)) + (s4-6 0) + (s3-3 (-> obj data s4-6)) + ) + (while (< s4-6 s5-3) + (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) + (editable-array-method-15 obj s3-3) + (when (= (-> s3-3 type) editable-light) + (editable-method-23 s3-3) + (update-light-hash *light-hash*) + ) + ) + (+! s4-6 1) + (set! s3-3 (-> obj data s4-6)) + ) + ) + (if (not (-> obj region-lock?)) + (set! (-> obj region) #f) + ) + ) + ((= arg0 (editable-command delete-region)) + (when (-> obj region) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (when (!= (-> obj region) *editable-light-region*) + (editable-array-method-9 obj (editable-command select-current-region) arg1) + (editable-array-method-9 obj (editable-command delete) arg1) + (set! (-> obj region) #f) + ) + ) + ) + ((= arg0 (editable-command snap-to-ground)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((s5-5 (new 'stack-no-clear 'vector)) + (s4-9 (-> obj length)) + (s3-5 0) + (s2-1 (-> obj data s3-5)) + ) + (while (< s3-5 s4-9) + (when (and s2-1 (logtest? (-> s2-1 flags) (editable-flag selected))) + (if (editable-method-11 s2-1 s5-5) + (editable-method-19 s2-1 s5-5) + ) + ) + (+! s3-5 1) + (set! s2-1 (-> obj data s3-5)) + ) + ) + ) + ((= arg0 (editable-command snap-y)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (cond + ((-> obj target) + (let* ((s5-7 (edit-get-trans (-> obj target))) + (s4-11 (-> obj length)) + (s3-6 0) + (a0-37 (-> obj data s3-6)) + ) + (while (< s3-6 s4-11) + (if (and a0-37 (logtest? (-> a0-37 flags) (editable-flag selected))) + (edit-coord! a0-37 s5-7 (editable-flag y no-plane-snap)) + ) + (+! s3-6 1) + (set! a0-37 (-> obj data s3-6)) + ) + ) + ) + (else + (editable-array-method-13 obj (the-as uint 14) (the-as basic 41) "pick the editable to use the y from") + ) + ) + ) + ((= arg0 (editable-command snap-xz)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (cond + ((-> obj target) + (let* ((s5-9 (edit-get-trans (-> obj target))) + (s4-13 (-> obj length)) + (s3-7 0) + (a0-41 (-> obj data s3-7)) + ) + (while (< s3-7 s4-13) + (if (and a0-41 (logtest? (-> a0-41 flags) (editable-flag selected))) + (edit-coord! a0-41 s5-9 (editable-flag x z no-plane-snap)) + ) + (+! s3-7 1) + (set! a0-41 (-> obj data s3-7)) + ) + ) + ) + (else + (editable-array-method-13 obj (the-as uint 14) (the-as basic 40) "pick the editable to use the xz from") + ) + ) + ) + ((= arg0 (editable-command region-set)) + (when (and (-> obj region) (not (-> obj region locked))) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((s5-11 (-> obj length)) + (s4-15 0) + (a0-44 (-> obj data s4-15)) + ) + (while (< s4-15 s5-11) + (if (and a0-44 (logtest? (-> a0-44 flags) (editable-flag selected))) + (editable-method-21 a0-44 (-> obj region)) + ) + (+! s4-15 1) + (set! a0-44 (-> obj data s4-15)) + ) + ) + ) + ) + ((= arg0 (editable-command region-add)) + (when (and (-> obj region) (not (-> obj region locked))) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (if (-> obj target) + (editable-method-21 (-> obj target) (-> obj region)) + (editable-array-method-13 obj (the-as uint 14) (the-as basic 49) "pick the editable to add to current region") + ) + ) + ) + ((= arg0 (editable-command region-new)) + (let ((v1-175 (new 'debug 'editable-region))) + (if (and (-> obj region) (not (-> obj region locked))) + (set! (-> v1-175 tree) (-> obj region tree)) + ) + (set! (-> obj region) v1-175) + ) + (editable-array-method-9 obj (editable-command region-set) arg1) + ) + ((= arg0 (editable-command flip-side)) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (let* ((s5-14 (-> obj length)) + (s4-18 0) + (a0-58 (-> obj data s4-18)) + ) + (while (< s4-18 s5-14) + (if (and a0-58 (logtest? (-> a0-58 flags) (editable-flag selected))) + (editable-method-24 a0-58) + ) + (+! s4-18 1) + (set! a0-58 (-> obj data s4-18)) + ) + ) + ) + ((= arg0 (editable-command rotate-level)) + (let* ((f0-1 (* 182.04445 (-> obj edit-param0))) + (s5-15 (matrix-rotate-y! (new 'stack-no-clear 'matrix) f0-1)) + (s4-19 (-> obj length)) + (s3-8 0) + (a0-60 (-> obj data s3-8)) + ) + (while (< s3-8 s4-19) + (if (and a0-60 region (= (-> a0-60 region level) (-> obj level))) + (editable-method-18 a0-60 (-> obj level-offset) s5-15) + ) + (+! s3-8 1) + (set! a0-60 (-> obj data s3-8)) + ) + ) + ) + ((= arg0 (editable-command translate-y-level)) + (let ((s5-16 (new 'stack-no-clear 'vector))) + (set! (-> s5-16 x) 0.0) + (set! (-> s5-16 y) (* 4096.0 (-> obj edit-param0))) + (set! (-> s5-16 z) 0.0) + (set! (-> s5-16 w) 1.0) + (let* ((s4-20 (-> obj length)) + (s3-9 0) + (a0-61 (-> obj data s3-9)) + ) + (while (< s3-9 s4-20) + (if (and a0-61 region (= (-> a0-61 region level) (-> obj level))) + (editable-method-15 a0-61 s5-16 56) + ) + (+! s3-9 1) + (set! a0-61 (-> obj data s3-9)) + ) + ) + ) + ) + ((= arg0 (editable-command save)) + (let* ((s5-17 (-> obj length)) + (s4-21 0) + (v1-231 (-> obj data s4-21)) + ) + (while (< s4-21 s5-17) + (when (and v1-231 (-> v1-231 region)) + (let ((t9-53 (method-of-object (-> v1-231 region) editable-region-method-9))) + 0 + 0 + (t9-53) + ) + ) + (+! s4-21 1) + (set! v1-231 (-> obj data s4-21)) + ) + ) + (let ((t9-54 (method-of-object *editable-sample-region* editable-region-method-9))) + 0 + 0 + (t9-54) + ) + (let ((t9-55 (method-of-object *editable-light-region* editable-region-method-9))) + 0 + 0 + (t9-55) + ) + (let ((t9-56 (method-of-object *editable-entity-region* editable-region-method-9))) + 0 + 0 + (t9-56) + ) + ) + ((= arg0 (editable-command load)) + (editable-array-method-9 obj (editable-command select-none) arg1) + (dotimes (v1-248 (-> obj length)) + (set! (-> obj data v1-248) #f) + ) + (set! (-> obj length) 0) + (let* ((s5-18 obj) + (s4-22 (method-of-object s5-18 editable-array-method-12)) + (v1-253 (level-get-target-inside *level*)) + ) + (s4-22 s5-18 (the-as editable-array (if v1-253 + (-> v1-253 info dbname) + #f + ) + ) + ) + ) + (editable-array-method-9 obj (editable-command update-game) (the-as editable-array #f)) + ) + ((= arg0 (editable-command update-game)) + (let ((t9-61 reset-light-hash)) + *light-hash* + (t9-61) + ) + (let* ((s5-19 (-> obj length)) + (s4-23 0) + (a0-76 (-> obj data s4-23)) + ) + (while (< s4-23 s5-19) + (if a0-76 + (editable-method-23 a0-76) + ) + (+! s4-23 1) + (set! a0-76 (-> obj data s4-23)) + ) + ) + (update-light-hash *light-hash*) + ) + ((or (= arg0 (editable-command exit)) (= arg0 (editable-command kill))) + (deactivate self) + ) + ) + #f + ) + +;; definition for method 10 of type editable-player +(defmethod deactivate editable-player ((obj editable-player)) + (dotimes (v1-0 (-> *level* length)) + (let ((a1-3 (-> *level* level v1-0))) + (if (= (-> a1-3 status) 'active) + (set! (-> a1-3 light-hash) (-> a1-3 bsp light-hash)) + ) + ) + ) + (set! *editable* (the-as (pointer editable-player) #f)) + (set! *external-cam-mode* (-> obj external-cam-mode)) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; definition for method 7 of type editable-player +;; WARN: Return type mismatch process-drawable vs editable-player. +(defmethod relocate editable-player ((obj editable-player) (arg0 int)) + (let ((v1-0 *kernel-context*)) + (set! (-> v1-0 relocating-process) obj) + (set! (-> v1-0 relocating-min) (the-as int (&-> obj type))) + (set! (-> v1-0 relocating-max) + (the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj))) + ) + (set! (-> v1-0 relocating-offset) arg0) + ) + (let ((v1-2 (-> obj current))) + (if (and (>= (the-as int v1-2) (-> *kernel-context* relocating-min)) + (< (the-as int v1-2) (-> *kernel-context* relocating-max)) + ) + (&+! (-> obj current) arg0) + ) + ) + (the-as editable-player ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; definition for method 21 of type editable-player +;; WARN: Return type mismatch int vs none. +(defmethod editable-player-method-21 editable-player ((obj editable-player)) + (set! *display-region-marks* #f) + (let* ((s5-0 (-> obj current length)) + (s4-0 0) + (a0-2 (-> obj current data s4-0)) + ) + (while (< s4-0 s5-0) + (if (and a0-2 (or (and (logtest? (-> a0-2 region filter) (-> obj current filter 0)) + (logtest? (-> a0-2 region filter) (-> obj current filter 1)) + ) + (logtest? (-> a0-2 flags) (editable-flag selected)) + ) + ) + (editable-method-10 a0-2) + ) + (+! s4-0 1) + (set! a0-2 (-> obj current data s4-0)) + ) + ) + (when #t + (format *stdcon* "~0K") + (format *stdcon* "~16S~16S~16S~%" "Left button" "Middle button" "Right button") + (format + *stdcon* + "~16S~16S~16S~%" + (editable-command->string + (if (and (nonzero? (-> obj command 1)) (or (zero? (-> obj command 0)) (logtest? (-> *mouse* button0-abs 0) 1))) + (the-as editable-command (-> obj command 1)) + (the-as editable-command (-> obj command 0)) + ) + ) + (editable-command->string + (if (and (nonzero? (-> obj command 5)) (or (zero? (-> obj command 4)) (logtest? (-> *mouse* button0-abs 0) 4))) + (the-as editable-command (-> obj command 5)) + (the-as editable-command (-> obj command 4)) + ) + ) + (editable-command->string + (if (and (nonzero? (-> obj command 3)) (or (zero? (-> obj command 2)) (logtest? (-> *mouse* button0-abs 0) 2))) + (the-as editable-command (-> obj command 3)) + (the-as editable-command (-> obj command 2)) + ) + ) + ) + (let* ((s5-2 (-> obj current length)) + (s4-2 0) + (v1-35 (-> obj current data s4-2)) + ) + (while (< s4-2 s5-2) + (when (and v1-35 (logtest? (-> v1-35 flags) (editable-flag selected))) + (let ((s3-1 (-> v1-35 name))) + (if (not (string-prefix= "undefined" s3-1)) + (format *stdcon* "~s~%" s3-1) + ) + ) + ) + (+! s4-2 1) + (set! v1-35 (-> obj current data s4-2)) + ) + ) + (when (!= *master-mode* 'menu) + (let ((a2-5 (-> obj current target-message))) + (if a2-5 + (format *stdcon* "~%~3L~S~0L~%" a2-5) + ) + ) + (when (cpad-hold? 1 triangle) + (let* ((s5-3 (-> obj current length)) + (s4-3 0) + (a0-29 (-> obj current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and a0-29 (or (and (logtest? (-> a0-29 region filter) (-> obj current filter 0)) + (logtest? (-> a0-29 region filter) (-> obj current filter 1)) + ) + (logtest? (-> a0-29 flags) (editable-flag selected)) + ) + ) + (if (and (-> a0-29 region) (!= (-> a0-29 type) editable-point)) + (editable-region-method-11 (-> a0-29 region) (edit-get-trans a0-29) (if (cpad-hold? 1 circle) + 1 + 0 + ) + ) + ) + ) + (+! s4-3 1) + (set! a0-29 (-> obj current data s4-3)) + ) + ) + (format *stdcon* "~%") + (cond + ((-> obj current region) + (let ((s5-4 (-> obj current region))) + (format + *stdcon* + "~%region: region-~D ~S ~S~S~%" + (-> s5-4 id) + (-> s5-4 level) + (-> s5-4 tree) + (if (-> s5-4 changed) + " (modified)" + "" + ) + ) + (format *stdcon* " (on-enter ~S)~%" (-> s5-4 on-enter)) + (format *stdcon* " (on-inside ~S)~%" (-> s5-4 on-inside)) + (format *stdcon* " (on-exit ~S)~%" (-> s5-4 on-exit)) + ) + ) + (else + (format *stdcon* "no region~%") + ) + ) + (when (-> obj current edit-plane) + (let ((a2-13 (-> obj current edit-plane))) + (format *stdcon* "~%edit-plane: ~A~%" a2-13) + ) + ) + (format *stdcon* "~%selected:~%") + (let* ((s5-5 (-> obj current length)) + (s4-4 0) + (a2-14 (-> obj current data s4-4)) + ) + (while (< s4-4 s5-5) + (if (and a2-14 (logtest? (-> a2-14 flags) (editable-flag selected))) + (format *stdcon* " ~A~%" a2-14) + ) + (+! s4-4 1) + (set! a2-14 (-> obj current data s4-4)) + ) + ) + ) + ) + (format *stdcon* "~1K~%") + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate idle (editable-player) + :virtual #t + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 none)) + (let ((v1-0 arg2)) + (the-as + object + (cond + ((= v1-0 'execute) + (let ((a2-1 (-> arg3 param 0))) + (case a2-1 + ((28 27 35 29 31 32) + (editable-array-method-13 + (-> self current) + (the-as uint 15) + (the-as basic a2-1) + "click on the point to insert at (up target, down camera)" + ) + ) + ((51 1 47 36 55 56) + (if (not (-> self left-handed)) + (editable-array-method-13 + (-> self current) + (the-as uint 16) + (the-as basic a2-1) + "press x to confirm, square to cancel" + ) + (editable-array-method-13 + (-> self current) + (the-as uint 16) + (the-as basic a2-1) + "press down to confirm, left to cancel" + ) + ) + ) + (else + (editable-array-method-9 (-> self current) (the-as editable-command a2-1) (the-as editable-array *mouse*)) + ) + ) + ) + ) + ((= v1-0 'exit) + (deactivate self) + ) + ((= v1-0 'menu) + (set! v0-0 (the-as none (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0))))) + (set! (-> self close-menu-time) (the-as time-frame v0-0)) + v0-0 + ) + ((or (= v1-0 'on-enter) (= v1-0 'on-exit) (= v1-0 'on-inside)) + (let ((s4-0 (-> self current region))) + (when s4-0 + (let ((gp-1 (-> arg3 param 0))) + (set! (-> *syntax-context* got-error?) #f) + (eval! *syntax-context* (the-as structure gp-1)) + (when (not (-> *syntax-context* got-error?)) + (set! (-> s4-0 changed) #t) + (cond + ((= arg2 'on-enter) + (set! (-> s4-0 on-enter) (the-as string gp-1)) + ) + ((= arg2 'on-inside) + (set! (-> s4-0 on-inside) (the-as string gp-1)) + ) + ((= arg2 'on-exit) + (set! (-> s4-0 on-exit) (the-as string gp-1)) + ) + ) + ) + ) + (set! v0-0 (the-as none (editable-region-method-12 s4-0))) + (set! (-> s4-0 filter) (the-as editable-filter v0-0)) + v0-0 + ) + ) + ) + ((= v1-0 'select) + (let ((gp-2 (-> arg3 param 0))) + (editable-array-method-9 (-> self current) (editable-command select-none) (the-as editable-array #f)) + (let* ((s5-1 (-> self current length)) + (s4-1 0) + (a0-36 (-> self current data s4-1)) + ) + (while (< s4-1 s5-1) + (when (and a0-36 (or (and (logtest? (-> a0-36 region filter) (-> self current filter 0)) + (logtest? (-> a0-36 region filter) (-> self current filter 1)) + ) + (logtest? (-> a0-36 flags) (editable-flag selected)) + ) + ) + (when (and (-> a0-36 region) (= gp-2 (-> a0-36 region id))) + (set! (-> self current region) (-> a0-36 region)) + (select-editable! a0-36 #t) + ) + ) + (+! s4-1 1) + (set! a0-36 (-> self current data s4-1)) + ) + ) + ) + #f + ) + ((= v1-0 'name) + (let* ((s5-2 (-> self current length)) + (s4-2 0) + (s3-0 (-> self current data s4-2)) + ) + (while (< s4-2 s5-2) + (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) + (let ((v1-60 (if (type? s3-0 editable) + s3-0 + ) + ) + ) + (when v1-60 + (set! (-> v1-60 name) (the-as string (-> arg3 param 0))) + (logior! (-> v1-60 flags) (editable-flag changed)) + (let ((v1-61 (-> v1-60 region))) + (if v1-61 + (set! (-> v1-61 changed) #t) + ) + ) + ) + ) + ) + (+! s4-2 1) + (set! s3-0 (-> self current data s4-2)) + ) + ) + #f + ) + ((= v1-0 'level) + (let ((gp-3 (lookup-level-info (the-as symbol (-> arg3 param 0))))) + (when (-> gp-3 dbname) + (let* ((s5-3 (-> self current length)) + (s4-3 0) + (s3-1 (-> self current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) + (let ((v1-73 (if (type? s3-1 editable) + s3-1 + ) + ) + ) + (when (and v1-73 (-> v1-73 region)) + (set! (-> v1-73 region level) (the-as string (-> gp-3 dbname))) + (set! (-> v1-73 region changed) #t) + ) + ) + ) + (+! s4-3 1) + (set! s3-1 (-> self current data s4-3)) + ) + ) + #f + ) + ) + ) + ((= v1-0 'get-level) + (-> self current level) + ) + ((= v1-0 'direction) + (let* ((f30-0 (the-as float (-> arg3 param 0))) + (f28-0 (the-as float (-> arg3 param 1))) + (f26-0 (the-as float (-> arg3 param 2))) + (f24-0 (if (and (zero? (-> arg3 param 0)) (zero? (-> arg3 param 1)) (zero? (-> arg3 param 2))) + 0.0 + 1.0 + ) + ) + (gp-4 (-> self current length)) + (s5-4 0) + (s4-4 (-> self current data s5-4)) + ) + (while (< s5-4 gp-4) + (when (and s4-4 (logtest? (-> s4-4 flags) (editable-flag selected))) + (let ((s3-2 (if (type? s4-4 editable-light) + (the-as editable-light s4-4) + ) + ) + ) + (when s3-2 + (set-vector! (-> s3-2 direction) f30-0 f28-0 f26-0 f24-0) + (vector-normalize! (-> s3-2 direction) 1.0) + (logior! (-> s3-2 flags) (editable-flag changed)) + (let ((a0-73 (-> s3-2 region))) + (if a0-73 + (set! (-> a0-73 changed) #t) + ) + ) + ) + ) + ) + (+! s5-4 1) + (set! s4-4 (-> self current data s5-4)) + ) + ) + #f + ) + ((= v1-0 'color) + (let* ((f30-1 (the-as float (-> arg3 param 0))) + (f28-1 (the-as float (-> arg3 param 1))) + (f26-1 (the-as float (-> arg3 param 2))) + (f24-1 (the-as float (-> arg3 param 3))) + (gp-5 (-> self current length)) + (s5-5 0) + (s4-5 (-> self current data s5-5)) + ) + (while (< s5-5 gp-5) + (when (and s4-5 (logtest? (-> s4-5 flags) (editable-flag selected))) + (let ((v1-114 (if (type? s4-5 editable-light) + (the-as editable-light s4-5) + ) + ) + ) + (when v1-114 + (set-vector! (-> v1-114 color) f30-1 f28-1 f26-1 f24-1) + (logior! (-> v1-114 flags) (editable-flag changed)) + (let ((v1-115 (-> v1-114 region))) + (if v1-115 + (set! (-> v1-115 changed) #t) + ) + ) + ) + ) + ) + (+! s5-5 1) + (set! s4-5 (-> self current data s5-5)) + ) + ) + #f + ) + ((= v1-0 'param) + (let ((s5-6 (-> arg3 param 0)) + (f30-2 (the-as float (-> arg3 param 1))) + ) + (when (and (>= (the-as int s5-6) 0) (>= 2 (the-as int s5-6))) + (let* ((gp-6 (-> self current length)) + (s4-6 0) + (s3-3 (-> self current data s4-6)) + ) + (while (< s4-6 gp-6) + (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) + (let ((v1-129 (if (type? s3-3 editable-light) + s3-3 + ) + ) + ) + (when v1-129 + (set! (-> (the-as editable-light (+ (* s5-6 4) (the-as uint v1-129))) decay-start) f30-2) + (logior! (-> v1-129 flags) (editable-flag changed)) + (let ((v1-130 (-> v1-129 region))) + (if v1-130 + (set! (-> v1-130 changed) #t) + ) + ) + ) + ) + ) + (+! s4-6 1) + (set! s3-3 (-> self current data s4-6)) + ) + ) + #f + ) + ) + ) + ) + ) + ) + ) + :trans (behavior () + (let ((gp-0 (-> self current))) + (set! (-> gp-0 move-lock?) #f) + (when (cpad-pressed? 1 start) + (when (!= *master-mode* 'menu) + (set-master-mode 'menu) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons start)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons start)) + ) + ) + (when (or (and (= *master-mode* 'menu) + (> (-> self close-menu-time) 0) + (>= (-> self clock frame-counter) (-> self close-menu-time)) + ) + (cpad-pressed? 1 start) + ) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (set-master-mode 'game) + (set! (-> self close-menu-time) 0) + 0 + ) + (debug-menus-handler *editable-menu-context*) + (set-setting! 'cpad1-skip-buttons 'abs #t 0) + (set-setting! 'mouse-input 'abs #f 0) + (when (!= *master-mode* 'menu) + (cond + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 left) (not (-> self left-handed))) (and (cpad-hold? 1 square) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 48)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 47)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 49)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 right) (not (-> self left-handed))) (and (cpad-hold? 1 circle) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 52)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 36)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 37)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 6)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 53)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 42)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 down) (not (-> self left-handed))) (and (cpad-hold? 1 x) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 29)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 30)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 32)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (set! (-> self command 0) (the-as function 0)) + (set! (-> self command 1) (the-as function 24)) + (set! (-> self command 2) (the-as function 0)) + (set! (-> self command 3) (the-as function 26)) + (set! (-> self command 4) (the-as function 0)) + (set! (-> self command 5) (the-as function 25)) + ) + ((and (cpad-hold? 1 up) + (cpad-hold? 1 left) + (or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) + ) + (set! (-> self command 0) (the-as function 3)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 9)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 8)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((or (and (cpad-hold? 1 left) (not (-> self left-handed))) (and (cpad-hold? 1 square) (-> self left-handed))) + (set! (-> self command 0) (the-as function 0)) + (set! (-> self command 1) (the-as function 20)) + (set! (-> self command 2) (the-as function 0)) + (set! (-> self command 3) (the-as function 22)) + (set! (-> self command 4) (the-as function 0)) + (set! (-> self command 5) (the-as function 21)) + ) + ((or (and (cpad-hold? 1 right) (not (-> self left-handed))) (and (cpad-hold? 1 circle) (-> self left-handed))) + (set! (-> self command 0) (the-as function 31)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 27)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 28)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((or (and (cpad-hold? 1 up) (not (-> self left-handed))) (and (cpad-hold? 1 triangle) (-> self left-handed))) + (set! (-> self command 0) (the-as function 3)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 4)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 7)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + ((or (and (cpad-hold? 1 down) (not (-> self left-handed))) (and (cpad-hold? 1 x) (-> self left-handed))) + (set! (-> self command 0) (the-as function 33)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 35)) + (set! (-> self command 3) (the-as function 0)) + (set! (-> self command 4) (the-as function 34)) + (set! (-> self command 5) (the-as function 0)) + 0 + ) + (else + (set! (-> self command 0) (the-as function 0)) + (set! (-> self command 1) (the-as function 18)) + (set! (-> self command 2) (the-as function 0)) + (set! (-> self command 3) (the-as function 23)) + (set! (-> self command 4) (the-as function 0)) + (set! (-> self command 5) (the-as function 19)) + ) + ) + (case (-> self current target-mode) + ((14 15) + (set! (-> self command 0) (the-as function (-> self current target-mode))) + ) + ((16) + (when (!= *master-mode* 'menu) + (cond + ((not (-> self left-handed)) + (cond + ((cpad-hold? 1 x) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons x)) + (editable-array-method-9 + gp-0 + (the-as editable-command (-> self current target-mode)) + (the-as editable-array *mouse*) + ) + ) + ((cpad-pressed? 1 square) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons square)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons square)) + (editable-array-method-9 gp-0 (editable-command cancel) (the-as editable-array *mouse*)) + ) + ) + ) + (else + (cond + ((cpad-hold? 1 down) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons down)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons down)) + (editable-array-method-9 + gp-0 + (the-as editable-command (-> self current target-mode)) + (the-as editable-array *mouse*) + ) + ) + ((cpad-pressed? 1 left) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons left)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons left)) + (editable-array-method-9 gp-0 (editable-command cancel) (the-as editable-array *mouse*)) + ) + ) + ) + ) + ) + ) + ) + (if (logtest? (-> *mouse* button0-rel 0) 1) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 0)) (the-as editable-array *mouse*)) + ) + (if (logtest? (-> *mouse* button0-abs 0) 1) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 1)) (the-as editable-array *mouse*)) + ) + (if (logtest? (-> *mouse* button0-rel 0) 2) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 2)) (the-as editable-array *mouse*)) + ) + (if (logtest? (-> *mouse* button0-abs 0) 2) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 3)) (the-as editable-array *mouse*)) + ) + (when (logtest? (-> *mouse* button0-rel 0) 4) + (let ((a2-11 (-> self command 4))) + (case a2-11 + ((36) + (if (not (-> self left-handed)) + (editable-array-method-13 gp-0 (the-as uint 16) a2-11 "press x to confirm, square to cancel") + (editable-array-method-13 gp-0 (the-as uint 16) a2-11 "press down to confirm, left to cancel") + ) + ) + (else + (editable-array-method-9 gp-0 (the-as editable-command a2-11) (the-as editable-array *mouse*)) + ) + ) + ) + ) + (if (logtest? (-> *mouse* button0-abs 0) 4) + (editable-array-method-9 gp-0 (the-as editable-command (-> self command 5)) (the-as editable-array *mouse*)) + ) + ) + ) + (none) + ) + :code (behavior () + (until #f + (suspend) + ) + #f + (none) + ) + :post (behavior () + (editable-player-method-21 self) + (none) + ) + ) + +;; definition for function editable-player-init +;; WARN: Return type mismatch object vs none. +(defbehavior editable-player-init editable-player ((arg0 symbol)) + (set! *editable-temp-id* 0) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + (set! *display-actor-marks* #f) + (logclear! (-> self mask) (process-mask freeze pause menu)) + (set! (-> self clock) (-> *display* real-clock)) + (set! (-> self current) (new 'debug 'editable-array 4096)) + (add-setting! 'mouse #t 0 0) + (add-setting! 'cursor #t 0 0) + (set! (-> self select-command) (the-as function 3)) + (set! (-> self move-command) (the-as function 18)) + (set! (-> self extra-command) (the-as function 23)) + (set! (-> self left-handed) #f) + (set! (-> self light-names) #f) + (set! (-> self command 0) (-> self select-command)) + (set! (-> self command 1) (the-as function 0)) + (set! (-> self command 2) (the-as function 0)) + (set! (-> self command 3) (-> self extra-command)) + (set! (-> self command 4) (the-as function 0)) + (set! (-> self command 5) (-> self move-command)) + (let* ((s5-0 (-> self current)) + (s4-0 (method-of-object s5-0 editable-array-method-12)) + (s3-0 (if arg0 + (lookup-level-info arg0) + ) + ) + (gp-1 (level-get-target-inside *level*)) + (a1-5 (cond + (s3-0 + (let ((gp-2 (level-get *level* (-> s3-0 dbname)))) + (when gp-2 + (format 0 "setting level~d ~s to *light-hash*~%" (-> gp-2 index) (-> gp-2 name)) + (set! (-> gp-2 light-hash) *light-hash*) + ) + ) + (-> s3-0 dbname) + ) + (gp-1 + (let ((s3-1 (level-get *level* (-> gp-1 info dbname)))) + (when s3-1 + (format 0 "setting level~d ~s to *light-hash*~%" (-> s3-1 index) (-> s3-1 name)) + (set! (-> s3-1 light-hash) *light-hash*) + ) + ) + (-> gp-1 info dbname) + ) + ) + ) + ) + (s4-0 s5-0 (the-as editable-array a1-5)) + ) + (set! *editable* (the-as (pointer editable-player) (process->ppointer self))) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (set! (-> self external-cam-mode) *external-cam-mode*) + (set! *external-cam-mode* 'pad-1) + (editable-array-method-9 (-> self current) (editable-command update-game) (the-as editable-array #f)) + (go-virtual idle) + (none) + ) + +;; definition for symbol *editable-menu-context*, type debug-menu-context +(define *editable-menu-context* (new 'debug 'debug-menu-context)) + +;; failed to figure out what this is: +(set! (-> *editable-menu-context* joypad-number) 1) + +;; definition for function editable-menu-command +;; WARN: Return type mismatch object vs none. +(defun editable-menu-command ((arg0 int)) + (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) + (send-event (ppointer->process *editable*) 'menu 90) + (none) + ) + +;; definition for function editable-menu-command-no-close +;; WARN: Return type mismatch object vs none. +(defun editable-menu-command-no-close ((arg0 int)) + (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) + (none) + ) + +;; definition for function dm-region-tree-pick-func +;; WARN: Return type mismatch object vs symbol. +(defun dm-region-tree-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (when (and *editable* (-> *editable* 0 current region)) + (let ((s5-0 (-> *editable* 0 current region))) + (set! (-> s5-0 tree) (the-as string arg0)) + (set! (-> s5-0 changed) #t) + (set! (-> s5-0 filter) (editable-region-method-12 s5-0)) + ) + ) + ) + (the-as + symbol + (and *editable* (-> *editable* 0 current region) (= arg0 (-> *editable* 0 current region tree))) + ) + ) + +;; definition for function dm-editable-flag-pick-func +(defun dm-editable-flag-pick-func ((arg0 editable-flag) (arg1 debug-menu-msg)) + (when *editable* + (let ((gp-0 (/ (the-as int arg0) 8))) + (editable-array-method-14 (-> *editable* 0 current) true-func #f) + (when (= arg1 (debug-menu-msg press)) + (let* ((v1-10 (-> *editable* 0 current length)) + (a0-2 0) + (a1-4 (-> *editable* 0 current data a0-2)) + ) + (while (< a0-2 v1-10) + (if (and a1-4 (logtest? (-> a1-4 flags) (editable-flag selected))) + (logxor! (-> a1-4 flags) (the-as uint gp-0)) + ) + (+! a0-2 1) + (set! a1-4 (-> *editable* 0 current data a0-2)) + ) + ) + ) + (and (>= (-> *editable* 0 current selection length) 1) + (logtest? (-> *editable* 0 current selection 0 flags) gp-0) + ) + ) + ) + ) + +;; definition for function dm-editable-filter0-pick-func +(defun dm-editable-filter0-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) + (when *editable* + (let ((v1-1 (/ (the-as int arg0) 8))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *editable* 0 current filter 0) (the-as uint v1-1)) + ) + (logtest? (-> *editable* 0 current filter 0) v1-1) + ) + ) + ) + +;; definition for function dm-editable-filter1-pick-func +(defun dm-editable-filter1-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) + (when *editable* + (let ((v1-1 (/ (the-as int arg0) 8))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *editable* 0 current filter 1) (the-as uint v1-1)) + ) + (logtest? (-> *editable* 0 current filter 1) v1-1) + ) + ) + ) + +;; definition for function dm-editable-light-float-func +;; ERROR: failed type prop at 36: add failed: editable uint + +;; WARN: Return type mismatch symbol vs object. +(defun dm-editable-light-float-func ((a0-0 object) (a1-0 debug-menu-msg) (a2-0 float) (a3-0 symbol)) + (local-vars + (v0-0 symbol) + (v0-1 symbol) + (v0-2 none) + (v0-3 none) + (v1-0 (pointer editable-player)) + (v1-1 int) + (v1-2 (pointer editable-player)) + (v1-3 editable-player) + (v1-4 editable-array) + (v1-5 int) + (v1-6 int) + (v1-7 symbol) + (v1-8 symbol) + (v1-11 uint) + (v1-12 none) + (v1-13 none) + (v1-14 none) + (v1-15 none) + (v1-17 none) + (v1-18 none) + (v1-19 none) + (v1-21 none) + (v1-22 none) + (v1-23 none) + (v1-24 none) + (v1-25 none) + (v1-26 none) + (v1-27 none) + (v1-29 none) + (v1-30 none) + (v1-31 none) + (v1-32 none) + (v1-33 none) + (a0-1 (pointer editable-player)) + (a0-2 editable-player) + (a0-3 editable-array) + (a0-4 editable-flag) + (a0-5 editable-flag) + (a0-6 editable) + (a0-7 editable) + (a0-8 none) + (a0-9 none) + (a0-10 none) + (a0-11 none) + (a0-12 none) + (a0-13 none) + (a0-14 none) + (a0-15 none) + (a0-18 none) + (a0-20 none) + (a0-21 none) + (a0-22 none) + (a1-1 type) + (a1-3 none) + (a1-4 none) + (s2-0 editable) + (s3-0 int) + (s3-1 none) + (s4-0 int) + (s4-1 none) + (s5-1 none) + (t9-0 (function object type symbol)) + (t9-1 none) + (t9-2 none) + (f0-0 float) + (f30-0 none) + ) + (cond + ((begin (set! v1-0 *editable*) (not v1-0)) + (set! v0-0 a3-0) + ) + ((begin (set! v1-1 4) (= a1-0 v1-1)) + (set! v1-2 *editable*) + (set! v1-3 (-> v1-2 0)) + (set! v1-4 (-> v1-3 current)) + (set! s4-0 (-> v1-4 length)) + (set! s3-0 0) + (set! v1-5 (sll s3-0 2)) + (set! a0-1 *editable*) + (set! a0-2 (-> a0-1 0)) + (set! a0-3 (-> a0-2 current)) + (set! v1-6 (+ v1-5 a0-3)) + (set! s2-0 (dynamic-array-field-access v1-6 data PLACEHOLDER)) + (while (<.si s3-0 s4-0) + (when (begin + (and s2-0 + (begin (set! v1-8 #t) (set! a0-4 (-> s2-0 flags)) (set! a0-5 (logand a0-4 1)) (cmove-#f-zero v1-7 a0-5 v1-8)) + ) + v1-7 + ) + (when (begin + (if (begin (set! t9-0 type?) (set! a0-6 s2-0) (set! a1-1 editable-light) (set! v0-1 (call! a0-6 a1-1)) v0-1) + (set! a0-7 s2-0) + ) + a0-7 + ) + (when (begin + (set! f0-0 (gpr->fpr a2-0)) + (set! v1-11 (sra a0-0 3)) + (set! v1-12 (the-as none (+ a0-7 v1-11))) + (s.f! v1-12 f0-0) + (set! v1-13 (the-as none (-> a0-7 flags))) + (set! v1-14 (the-as none (logior v1-13 2048))) + (set! (-> a0-7 flags) (the-as editable-flag v1-14)) + (set! v1-15 (the-as none (-> a0-7 region))) + v1-15 + ) + (set! a1-3 (the-as none #t)) + (s.w! v1-15 a1-3) + ) + (set! t9-1 (the-as none update-light-sphere-from-editable-light)) + (call!) + (set! v1-16 (the-as none v0-2)) + ) + ) + (set! s3-0 (the-as int (+ s3-0 1))) + (set! v1-17 (the-as none (sll s3-0 2))) + (set! a0-8 (the-as none *editable*)) + (set! a0-9 (the-as none (l.wu a0-8))) + (set! a0-10 (the-as none (l.wu (+ a0-9 196)))) + (set! v1-18 (the-as none (+ v1-17 a0-10))) + (set! v1-19 (the-as none (l.wu (+ v1-18 120)))) + (set! s2-0 (the-as editable v1-19)) + ) + (set! v0-0 #f) + ) + (else + (set! f30-0 (the-as none (gpr->fpr a3-0))) + (set! v1-21 (the-as none *editable*)) + (set! v1-22 (the-as none (l.wu v1-21))) + (set! v1-23 (the-as none (l.wu (+ v1-22 196)))) + (set! s5-1 (the-as none (l.w (+ v1-23 4)))) + (set! s4-1 (the-as none 0)) + (set! v1-24 (the-as none (sll s4-1 2))) + (set! a0-11 (the-as none *editable*)) + (set! a0-12 (the-as none (l.wu a0-11))) + (set! a0-13 (the-as none (l.wu (+ a0-12 196)))) + (set! v1-25 (the-as none (+ v1-24 a0-13))) + (set! s3-1 (the-as none (l.wu (+ v1-25 120)))) + (while (<.si s4-1 s5-1) + (when (begin + (and s3-1 (begin + (set! v1-27 (the-as none #t)) + (set! a0-14 (the-as none (l.wu s3-1))) + (set! a0-15 (the-as none (logand a0-14 1))) + (cmove-#f-zero v1-26 a0-15 v1-27) + ) + ) + v1-26 + ) + (when (begin + (if (begin + (set! t9-2 (the-as none type?)) + (set! a0-16 (the-as none s3-1)) + (set! a1-4 (the-as none editable-light)) + (set! v0-3 (the-as none (call!))) + v0-3 + ) + (set! v1-29 (the-as none s3-1)) + ) + v1-29 + ) + (set! a0-18 (the-as none (sra a0-0 3))) + (set! v1-30 (the-as none (+ v1-29 a0-18))) + (set! f30-0 (the-as none (l.f v1-30))) + (set! a0-19 (the-as none (fpr->gpr f30-0))) + ) + ) + (set! s4-1 (the-as none (+ s4-1 1))) + (set! v1-31 (the-as none (sll s4-1 2))) + (set! a0-20 (the-as none *editable*)) + (set! a0-21 (the-as none (l.wu a0-20))) + (set! a0-22 (the-as none (l.wu (+ a0-21 196)))) + (set! v1-32 (the-as none (+ v1-31 a0-22))) + (set! v1-33 (the-as none (l.wu (+ v1-32 120)))) + (set! s3-1 (the-as none v1-33)) + ) + (set! v0-0 (the-as symbol (fpr->gpr f30-0))) + ) + ) + (ret-value v0-0) + ) + +;; definition for function dm-cam-externalize2 +(defun dm-cam-externalize2 ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (cond + ((= arg0 'reset) + (if (!= *external-cam-mode* 'locked) + (external-cam-reset!) + ) + ) + ((= arg0 'allow-z) + (set! *external-cam-options* (logxor *external-cam-options* (external-cam-option allow-z))) + ) + ((= *external-cam-mode* arg0) + (set! *external-cam-mode* #f) + ) + (else + (if (not *external-cam-mode*) + (external-cam-reset!) + ) + (set! *external-cam-mode* arg0) + ) + ) + ) + (if (= arg0 'allow-z) + (logtest? *external-cam-options* (external-cam-option allow-z)) + (= *external-cam-mode* arg0) + ) + ) + +;; definition for function dm-editable-boolean-toggle-pick-func +;; ERROR: failed type prop at 5: add failed: editable-player int + +(defun dm-editable-boolean-toggle-pick-func ((a0-0 int) (a1-0 debug-menu-msg)) + (local-vars + (v0-0 none) + (v1-0 (pointer editable-player)) + (v1-1 (pointer editable-player)) + (v1-2 editable-player) + (v1-3 none) + (a0-1 int) + (a0-2 none) + (a0-4 none) + (a0-5 none) + ) + (cond + ((begin (set! v1-0 *editable*) v1-0) + (when (begin + (set! v1-1 *editable*) + (set! v1-2 (-> v1-1 0)) + (set! a0-1 (sra a0-0 3)) + (set! v1-3 (the-as none (+ v1-2 a0-1))) + (set! a0-2 (the-as none 4)) + (= a1-0 a0-2) + ) + (set! a0-4 (the-as none (l.wu v1-3))) + (set! a0-5 (the-as none (not a0-4))) + (s.w! v1-3 a0-5) + ) + (set! v0-0 (the-as none (l.wu v1-3))) + ) + (else + ) + ) + (ret-none) + ) + +;; definition for function editable-menu-context-make-menus +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; failed to figure out what this is: +(editable-menu-context-make-menus *editable-menu-context*) + +;; definition for function insert-sample-camera +;; WARN: Return type mismatch int vs none. +;; WARN: Function insert-sample-camera has a return type of none, but the expression builder found a return statement. +(defun insert-sample-camera ((arg0 symbol)) + (cond + (level + (let ((s5-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" + arg0 + ) + (let ((s5-1 (s5-0 *temp-string*))) + (cond + ((and (= (-> s5-1 error) 'select) (= (-> s5-1 len) 4)) + (let ((f26-0 (* 4096.0 (string->float (the-as string (-> s5-1 data 0))))) + (f28-0 (* 4096.0 (string->float (the-as string (-> s5-1 data 1))))) + (f30-3 (* 4096.0 (string->float (the-as string (-> s5-1 data 2))))) + (s5-2 (string->int (the-as string (-> s5-1 data 3)))) + (s3-0 (math-camera-pos)) + (s4-1 (clear *temp-string*)) + ) + (format + s4-1 + "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" + s5-2 + (* 0.00024414062 (- (-> s3-0 x) f26-0)) + (* 0.00024414062 (- (-> s3-0 y) f28-0)) + (* 0.00024414062 (- (-> s3-0 z) f30-3)) + ) + (let ((a2-2 (sql-query s4-1))) + (cond + ((= (-> a2-2 error) 'modify) + (format + (clear s4-1) + "update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D" + s5-2 + ) + (let ((a2-4 (sql-query s4-1))) + (when (!= (-> a2-4 error) 'modify) + (format 0 "ERROR: sql: modify error ~A~%" a2-4) + (return #f) + ) + ) + (sound-play-by-spec + (new 'static 'sound-spec + :mask (sound-mask fo-curve) + :num 1.0 + :group (sound-group sfx) + :sound-name (static-sound-name "beep") + :volume #x400 + :fo-curve 1 + ) + (new-sound-id) + (the-as vector #t) + ) + (format #t "EDITABLE: saved camera sample point for level ~A~%" arg0) + ) + (else + (format 0 "ERROR: sql: insert error ~A~%" a2-2) + ) + ) + ) + ) + ) + (else + (format 0 "ERROR: sql: select error ~A~%" s5-1) + ) + ) + ) + ) + ) + (else + (format 0 "ERROR: EDITABLE: no current level~%") + ) + ) + 0 + (none) + ) + +;; definition for symbol *debug-hook*, type pair +(define *debug-hook* (cons + (lambda () + (when (and *debug-segment* *manual-sample-point*) + (when (cpad-pressed? 1 select) + (cond + (*editable* + ) + ((not *artist-fix-visible*) + (insert-sample-camera (-> (level-get-target-inside *level*) info dbname)) + ) + (else + (dotimes (gp-1 (-> *level* length)) + (let ((v1-14 (-> *level* level gp-1))) + (when (= (-> v1-14 status) 'active) + (if (zero? (logand *fix-visible-level-mask* (ash 1 (-> v1-14 index)))) + (insert-sample-camera (-> v1-14 name)) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + *debug-hook* + ) + ) + +) diff --git a/test/decompiler/reference/jak2/engine/debug/editable_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable_REF.gc new file mode 100644 index 0000000000..e08d8769cb --- /dev/null +++ b/test/decompiler/reference/jak2/engine/debug/editable_REF.gc @@ -0,0 +1,2838 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition for method 0 of type editable-region +(defmethod new editable-region ((allocation symbol) (type-to-make type)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 changed) #t) + (set! (-> gp-0 locked) #f) + (let ((v1-4 (level-get-target-inside *level*))) + (set! (-> gp-0 level) (the-as string (if v1-4 + (-> v1-4 info dbname) + ) + ) + ) + ) + (set! (-> gp-0 tree) (the-as string 'camera)) + (set! (-> gp-0 on-enter) #f) + (set! (-> gp-0 on-exit) #f) + (set! (-> gp-0 on-inside) #f) + (set! (-> gp-0 filter) (editable-region-method-12 gp-0)) + gp-0 + ) + ) + +;; definition for method 2 of type editable-region +(defmethod print editable-region ((obj editable-region)) + (format #t "#<~A region-~D ~A ~A @ #x~X>" (-> obj type) (-> obj id) (-> obj level) (-> obj tree) obj) + obj + ) + +;; definition for method 10 of type editable-region +;; INFO: Used lq/sq +(defmethod editable-region-method-10 editable-region ((obj editable-region) (arg0 int)) + (local-vars (sv-16 string) (sv-32 string)) + (when (nonzero? (-> obj id)) + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "delete from region_sphere where region_id=~D" (-> obj id)) + (let ((a2-1 (sql-query s5-0))) + (when (!= (-> a2-1 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 obj) + (return #t) + ) + ) + (clear s5-0) + (format s5-0 "select region_face_id from region_face where region_id=~D" (-> obj id)) + (let ((s3-0 (sql-query s5-0))) + (when (!= (-> s3-0 error) 'select) + (format 0 "ERROR: sql: face select error ~A for ~A~%" s3-0 obj) + (return #t) + ) + (when (> (-> s3-0 len) 0) + (clear s5-0) + (format s5-0 "delete from region_point where region_face_id in (") + (dotimes (s2-0 (-> s3-0 len)) + (cond + ((zero? s2-0) + (let ((s1-0 format) + (s0-0 s5-0) + ) + (set! sv-16 "~D") + (let ((a2-4 (string->int (the-as string (-> s3-0 data s2-0))))) + (s1-0 s0-0 sv-16 a2-4) + ) + ) + ) + (else + (let ((s1-1 format) + (s0-1 s5-0) + ) + (set! sv-32 ",~D") + (let ((a2-5 (string->int (the-as string (-> s3-0 data s2-0))))) + (s1-1 s0-1 sv-32 a2-5) + ) + ) + ) + ) + ) + (format s5-0 ")") + (let ((a2-6 (sql-query s5-0))) + (when (!= (-> a2-6 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-6 obj) + (return #t) + ) + ) + ) + ) + (clear s5-0) + (format s5-0 "delete from region_face where region_id=~D" (-> obj id)) + (let ((a2-8 (sql-query s5-0))) + (when (!= (-> a2-8 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-8 obj) + (return #t) + ) + ) + (when (zero? arg0) + (clear s5-0) + (format s5-0 "delete from region where region_id=~D" (-> obj id)) + (let ((a2-10 (sql-query s5-0))) + (when (!= (-> a2-10 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-10 obj) + (return #t) + ) + ) + ) + ) + ) + #f + ) + +;; definition for method 9 of type editable-region +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for method 11 of type editable-region +;; WARN: Return type mismatch int vs none. +(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 bucket-318) arg0 (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0))) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 318) + ) + (format (clear *temp-string*) "region-~D~%" (-> obj id)) + (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* arg0 (font-color one) sv-32) + ) + (set! (-> sv-32 y) (the-as int (+ (-> sv-32 y) 8))) + (when (>= arg1 1) + (let ((s4-1 (-> obj on-enter))) + (when s4-1 + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 318) + ) + (format (clear *temp-string*) "(on-enter ~S)" s4-1) + (s3-1 s2-1 (the-as bucket-id s1-1) *temp-string* arg0 (font-color one) sv-32) + ) + (set! (-> sv-32 y) (the-as int (+ (-> sv-32 y) 8))) + ) + ) + (let ((s4-2 (-> obj on-inside))) + (when s4-2 + (let ((s3-2 add-debug-text-3d) + (s2-2 #t) + (s1-2 318) + ) + (format (clear *temp-string*) "(on-inside ~S)" s4-2) + (s3-2 s2-2 (the-as bucket-id s1-2) *temp-string* arg0 (font-color one) sv-32) + ) + (set! (-> sv-32 y) (the-as int (+ (-> sv-32 y) 8))) + ) + ) + (let ((s5-1 (-> obj on-exit))) + (when s5-1 + (let ((s4-3 add-debug-text-3d) + (s3-3 #t) + (s2-3 318) + ) + (format (clear *temp-string*) "(on-exit ~S)" s5-1) + (s4-3 s3-3 (the-as bucket-id s2-3) *temp-string* arg0 (font-color one) sv-32) + ) + (set! (-> sv-32 y) (the-as int (+ (-> sv-32 y) 8))) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type editable-region +;; WARN: Return type mismatch int vs editable-filter. +(defmethod editable-region-method-12 editable-region ((obj editable-region)) + (let* ((s5-0 0) + (s4-0 (lambda ((arg0 string)) (let ((gp-0 0)) + (when (not (type? arg0 string)) + (format (clear *temp-string*) "~A" arg0) + (set! arg0 *temp-string*) + ) + (if (>= (string-position "(sound-play" arg0) 0) + (set! gp-0 (logior gp-0 4)) + ) + (if (>= (string-position "(part-tracker" arg0) 0) + (set! gp-0 (logior gp-0 8)) + ) + (if (>= (string-position "(want-" arg0) 0) + (set! gp-0 (logior gp-0 64)) + ) + (if (>= (string-position "(setting-" arg0) 0) + (set! gp-0 (logior gp-0 16)) + ) + (if (>= (string-position "(water" arg0) 0) + (set! gp-0 (logior gp-0 128)) + ) + gp-0 + ) + ) + ) + (v0-3 + (logior (logior (logior s5-0 (s4-0 (-> obj on-inside))) (s4-0 (-> obj on-enter))) (s4-0 (-> obj on-exit))) + ) + ) + (when (zero? v0-3) + (if (and (not (-> obj on-inside)) (not (-> obj on-enter)) (not (-> obj on-exit))) + (set! v0-3 1) + (set! v0-3 2) + ) + ) + (case (-> obj tree) + (('target) + (set! v0-3 (logior v0-3 512)) + ) + (('camera) + (set! v0-3 (logior v0-3 256)) + ) + (('data) + (set! v0-3 (logior v0-3 2048)) + ) + (('water) + (set! v0-3 (logior v0-3 1024)) + ) + (('city_vis) + (set! v0-3 4096) + ) + (('sample) + (set! v0-3 8192) + ) + (('light) + (set! v0-3 #x4000) + ) + (('entity) + (set! v0-3 #x8000) + ) + ) + (the-as editable-filter v0-3) + ) + ) + +;; definition for method 23 of type editable +(defmethod editable-method-23 editable ((obj editable)) + #t + ) + +;; definition for method 28 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-28 editable ((obj editable) (arg0 editable-filter)) + (let* ((s5-0 (-> obj owner)) + (a0-1 (car s5-0)) + ) + (while (not (null? s5-0)) + (editable-method-28 (the-as editable a0-1) arg0) + (set! s5-0 (cdr s5-0)) + (set! a0-1 (car s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 29 of type editable +;; WARN: Return type mismatch int vs symbol. +(defmethod editable-method-29 editable ((obj editable) (arg0 editable-filter)) + (let* ((s5-0 (-> obj owner)) + (a0-1 (car s5-0)) + ) + (while (not (null? s5-0)) + (editable-method-29 (the-as editable a0-1) arg0) + (set! s5-0 (cdr s5-0)) + (set! a0-1 (car s5-0)) + ) + ) + (the-as symbol 0) + ) + +;; definition for method 21 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-21 editable ((obj editable) (arg0 editable-region)) + (when (not (and (-> obj region) (-> obj region locked))) + (if arg0 + (set! (-> arg0 changed) #t) + ) + (if (-> obj region) + (set! (-> obj region changed) #t) + ) + (logior! (-> obj flags) (editable-flag changed)) + (set! (-> obj region) arg0) + ) + 0 + (none) + ) + +;; definition for method 9 of type editable +;; WARN: Return type mismatch int vs rgba. +(defmethod get-color editable ((obj editable) (arg0 int)) + "Returns the [[rgba]] that corresponds to the type of [[editable]] TODO - document the colors" + (the-as rgba (cond + ((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)) + ) + ((logtest? (-> obj flags) (editable-flag no-save)) + (shl #x80ff 16) + ) + ((= (-> obj type) editable-point) + (the-as int (-> (new 'static 'array uint64 1 #x800080ff) 0)) + ) + ((= (-> obj type) editable-sample) + (the-as int (-> (new 'static 'array uint64 1 #x80ff8000) 0)) + ) + ((= (-> obj type) editable-light) + (the-as int (-> (new 'static 'array uint64 1 #x80ff0080) 0)) + ) + ((= (-> obj type) editable-entity) + (the-as int (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + ) + (else + (the-as int (-> (new 'static 'array uint64 1 #x800000ff) 0)) + ) + ) + ) + ) + +;; definition for method 10 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-10 editable ((obj editable)) + (when (logtest? (-> obj flags) (editable-flag selected)) + (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 bucket-318) s5-0 (the-as rgba (-> (new 'static 'array uint64 1 #x80ffffff) 0))) + ) + ) + (add-debug-x + #t + (bucket-id bucket-318) + (edit-get-trans obj) + (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod select-editable! editable ((obj editable) (arg0 symbol)) + (case arg0 + (('toggle) + (logxor! (-> obj flags) (editable-flag selected)) + ) + ((#f) + (logclear! (-> obj flags) (editable-flag selected)) + ) + (else + (logior! (-> obj flags) (editable-flag selected)) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type editable +(defmethod edit-get-distance editable ((obj editable) (arg0 vector)) + "Returns the distance from the camera to the [[editable]], or -1.0" + -1.0 + ) + +;; definition for method 20 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-20 editable ((obj editable) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (local-vars (sv-48 vector) (sv-52 vector)) + (set! sv-48 (new 'stack-no-clear 'vector)) + (set! sv-52 (new 'stack-no-clear 'vector)) + (let ((s4-0 (edit-get-trans obj))) + (reverse-transform-point! sv-48 s4-0 arg2 arg0) + (reverse-transform-point! sv-52 s4-0 arg2 arg1) + (vector-! arg3 sv-52 sv-48) + (vector-! (new 'stack-no-clear 'vector) s4-0 (-> *math-camera* trans)) + ) + (if (< 20480.0 (vector-length arg3)) + (vector-normalize! arg3 20480.0) + ) + (editable-method-15 obj arg3 56) + 0 + (none) + ) + +;; definition for method 11 of type editable +;; INFO: Used lq/sq +(defmethod editable-method-11 editable ((obj editable) (arg0 vector)) + (with-pp + (let ((s5-0 (new 'stack 'collide-query))) + (set! (-> s5-0 start-pos quad) (-> (edit-get-trans obj) quad)) + (set-vector! (-> s5-0 move-dist) 0.0 -204800.0 0.0 1.0) + (let ((v1-5 s5-0)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) + (collide-spec backgnd crate obstacle hit-by-player-list hit-by-others-list collectable pusher) + ) + (set! (-> v1-5 ignore-process0) pp) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) + (set! (-> arg0 quad) (-> s5-0 best-other-tri intersect quad)) + #t + ) + ) + ) + ) + +;; definition for method 24 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-24 editable ((obj editable)) + 0 + (none) + ) + +;; definition for method 17 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 editable ((obj editable) (arg0 vector)) + 0 + (none) + ) + +;; definition for method 22 of type editable +(defmethod editable-method-22 editable ((obj editable) (arg0 editable-array) (arg1 int) (arg2 int)) + #t + ) + +;; definition for method 15 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-15 editable ((obj editable) (arg0 vector) (arg1 int)) + 0 + (none) + ) + +;; definition for method 16 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod edit-coord! editable ((obj editable) (arg0 vector) (arg1 editable-flag)) + 0 + (none) + ) + +;; definition for method 18 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-18 editable ((obj editable) (arg0 vector) (arg1 matrix)) + 0 + (none) + ) + +;; definition for method 14 of type editable +(defmethod edit-get-trans editable ((obj editable)) + "Returns the `trans` [[vector]] or [[*null-vector*]]" + *null-vector* + ) + +;; definition for method 19 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-19 editable ((obj editable) (arg0 vector)) + 0 + (none) + ) + +;; definition for method 26 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-26 editable ((obj editable) (arg0 editable) (arg1 editable-array)) + 0 + (none) + ) + +;; definition for method 25 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-25 editable ((obj editable) (arg0 editable-array)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (let* ((s4-0 (-> obj owner)) + (a0-3 (car s4-0)) + ) + (while (not (null? s4-0)) + (editable-method-26 (the-as editable a0-3) obj arg0) + (set! s4-0 (cdr s4-0)) + (set! a0-3 (car s4-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 27 of type editable +(defmethod editable-method-27 editable ((obj editable) (arg0 editable-array)) + (local-vars (s4-0 editable)) + (let ((v1-0 0)) + (while (< v1-0 (-> arg0 selection length)) + (when (= obj (-> arg0 selection v1-0)) + (set! s4-0 (-> arg0 selection (+ v1-0 1))) + (goto cfg-10) + ) + (+! v1-0 2) + ) + ) + (let ((s3-0 (editable-array-method-11 arg0))) + (set! s4-0 (when (>= s3-0 0) + (set! s4-0 (copy obj 'debug)) + (let ((v1-9 (-> arg0 region))) + (if v1-9 + (set! (-> s4-0 region) v1-9) + ) + ) + (set! (-> s4-0 region changed) #t) + (logior! (-> obj flags) (editable-flag changed)) + (set! (-> s4-0 id) (the-as uint 0)) + (set! (-> s4-0 owner) '()) + (select-editable! s4-0 #f) + (let ((s2-0 (new 'debug 'string 32 (the-as string #f)))) + (format s2-0 "undefined-~d" *editable-temp-id*) + (set! (-> s4-0 name) s2-0) + ) + (set! *editable-temp-id* (+ *editable-temp-id* 1)) + (set! (-> arg0 data s3-0) s4-0) + (set! (-> arg0 selection (-> arg0 selection length)) obj) + (set! (-> arg0 selection (+ (-> arg0 selection length) 1)) s4-0) + (+! (-> arg0 selection length) 2) + s4-0 + ) + ) + ) + (label cfg-10) + s4-0 + ) + +;; definition for method 2 of type editable-point +(defmethod print editable-point ((obj editable-point)) + (format + #t + "#<~A~S~m ~m ~m :r ~m" + (-> obj type) + (if (logtest? (-> obj flags) (editable-flag changed)) + " (m)" + "" + ) + (-> obj trans x) + (-> obj trans y) + (-> obj trans z) + (-> obj radius) + ) + (format #t " @ #x~X>" obj) + obj + ) + +;; definition for method 28 of type editable-point +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 28 editable-point) has a return type of none, but the expression builder found a return statement. +(defmethod editable-method-28 editable-point ((obj editable-point) (arg0 editable-filter)) + (if (logtest? arg0 (editable-filter water-command)) + (return #f) + ) + (let ((s4-0 (-> *editable* 0 current))) + (cond + ((logtest? (-> obj flags) (editable-flag top-set)) + (let* ((s3-0 (-> s4-0 length)) + (s2-0 0) + (a0-1 (-> s4-0 data s2-0)) + ) + (while (< s2-0 s3-0) + (if (and a0-1 (= (-> a0-1 region) (-> obj region)) (logtest? (-> a0-1 flags) (editable-flag top-set))) + (edit-coord! a0-1 (-> obj trans) (editable-flag y no-update)) + ) + (+! s2-0 1) + (set! a0-1 (-> s4-0 data s2-0)) + ) + ) + ) + ((logtest? (-> obj flags) (editable-flag bot-set)) + (let* ((s3-1 (-> s4-0 length)) + (s2-1 0) + (a0-2 (-> s4-0 data s2-1)) + ) + (while (< s2-1 s3-1) + (if (and a0-2 (= (-> a0-2 region) (-> obj region)) (logtest? (-> a0-2 flags) (editable-flag bot-set))) + (edit-coord! a0-2 (-> obj trans) (editable-flag y no-update)) + ) + (+! s2-1 1) + (set! a0-2 (-> s4-0 data s2-1)) + ) + ) + ) + ) + ) + ((the-as (function editable-point editable-command none) (find-parent-method editable-point 28)) + obj + (the-as editable-command arg0) + ) + 0 + (none) + ) + +;; definition for method 15 of type editable-point +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-15 editable-point ((obj editable-point) (arg0 vector) (arg1 int)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (vector+! (-> obj trans) (-> obj trans) arg0) + (editable-method-28 obj (the-as editable-filter arg1)) + 0 + (none) + ) + +;; definition for method 16 of type editable-point +;; WARN: Return type mismatch int vs none. +(defmethod edit-coord! editable-point ((obj editable-point) (arg0 vector) (arg1 editable-flag)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (if (logtest? arg1 (editable-flag x)) + (set! (-> obj trans x) (-> arg0 x)) + ) + (if (logtest? arg1 (editable-flag y)) + (set! (-> obj trans y) (-> arg0 y)) + ) + (if (logtest? arg1 (editable-flag z)) + (set! (-> obj trans z) (-> arg0 z)) + ) + (editable-method-28 obj (the-as editable-filter arg1)) + 0 + (none) + ) + +;; definition for method 14 of type editable-point +(defmethod edit-get-trans editable-point ((obj editable-point)) + "Returns the `trans` [[vector]] or [[*null-vector*]]" + (-> obj trans) + ) + +;; definition for method 18 of type editable-point +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-18 editable-point ((obj editable-point) (arg0 vector) (arg1 matrix)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> obj trans) arg0))) + (vector-matrix*! s4-1 s4-1 arg1) + (vector+! (-> obj trans) s4-1 arg0) + ) + 0 + (none) + ) + +;; definition for method 10 of type editable-point +(defmethod editable-method-10 editable-point ((obj editable-point)) + (let* ((s5-0 vector-vector-distance) + (a0-1 (math-camera-pos)) + (a1-0 (-> obj trans)) + (f0-1 (- (s5-0 a0-1 a1-0) (-> obj radius))) + (s2-0 (cond + ((logtest? (-> obj flags) (editable-flag selected)) + 6 + ) + ((>= f0-1 983040.0) + 3 + ) + ((>= f0-1 491520.0) + 4 + ) + ((>= f0-1 245760.0) + 5 + ) + (else + 6 + ) + ) + ) + ) + (add-debug-sphere-from-table + (bucket-id bucket-324) + (-> obj trans) + (-> obj radius) + (get-color obj (the-as int a1-0)) + s2-0 + ) + ) + ((method-of-type editable editable-method-10) obj) + (none) + ) + +;; definition for method 13 of type editable-point +;; INFO: Used lq/sq +(defmethod edit-get-distance editable-point ((obj editable-point) (arg0 vector)) + "Returns the distance from the camera to the [[editable]], or -1.0" + (let ((a0-1 (new 'stack-no-clear 'sphere)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 quad) (-> obj trans quad)) + (set! (-> a0-1 w) (-> obj radius)) + (when (sphere-in-view-frustum? a0-1) + (reverse-transform-point! s5-0 (-> obj trans) (-> *math-camera* inv-camera-rot vector 2) arg0) + (let ((f0-1 (vector-vector-distance (edit-get-trans obj) s5-0))) + (if (>= (-> obj radius) f0-1) + (return f0-1) + ) + ) + ) + ) + -1.0 + ) + +;; definition for method 19 of type editable-point +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-19 editable-point ((obj editable-point) (arg0 vector)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans)))) + (vector-normalize! s4-1 (-> obj radius)) + (vector-! (-> obj trans) arg0 s4-1) + ) + (editable-method-28 obj (editable-filter load)) + 0 + (none) + ) + +;; definition for method 22 of type editable-point +(defmethod editable-method-22 editable-point ((obj editable-point) (arg0 editable-array) (arg1 int) (arg2 int)) + (case arg1 + ((2) + (let ((s3-0 (clear *temp-string*))) + (format + s3-0 + "insert into region_point set region_face_id=LAST_INSERT_ID(),idx=~D,x=~f,y=~f,z=~f" + arg2 + (- (-> obj trans x) (-> arg0 level-offset x)) + (- (-> obj trans y) (-> arg0 level-offset y)) + (- (-> obj trans z) (-> arg0 level-offset z)) + ) + (let ((a0-5 (sql-query s3-0))) + (when (= (-> a0-5 error) 'modify) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +;; definition for method 17 of type editable-sphere +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 editable-sphere ((obj editable-sphere) (arg0 vector)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> obj radius) (-> arg0 x)) + (set! (-> obj radius) (-> arg0 y)) + ) + (if (< (-> obj radius) 0.0) + (set! (-> obj radius) 0.0) + ) + (editable-method-28 obj (editable-filter load)) + 0 + (none) + ) + +;; definition for method 22 of type editable-sphere +(defmethod editable-method-22 editable-sphere ((obj editable-sphere) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((gp-0 (clear *temp-string*))) + (format + gp-0 + "insert into region_sphere set region_id=~D,x=~f,y=~f,z=~f,r=~f" + (-> obj region id) + (- (-> obj trans x) (-> arg0 level-offset x)) + (- (-> obj trans y) (-> arg0 level-offset y)) + (- (-> obj trans z) (-> arg0 level-offset z)) + (-> obj radius) + ) + (= (-> (sql-query gp-0) error) 'modify) + ) + ) + +;; definition for method 22 of type editable-sample +(defmethod editable-method-22 editable-sample ((obj editable-sample) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s5-0 (clear *temp-string*))) + (format + s5-0 + "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" + (-> arg0 level-info-id) + (* 0.00024414062 (- (-> obj trans x) (-> arg0 level-offset x))) + (* 0.00024414062 (- (-> obj trans y) (-> arg0 level-offset y))) + (* 0.00024414062 (- (-> obj trans z) (-> arg0 level-offset z))) + ) + (let ((a0-4 (sql-query s5-0))) + (when (= (-> a0-4 error) 'modify) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + ) + ) + ) + +;; definition for method 2 of type editable-light +(defmethod print editable-light ((obj editable-light)) + (format + #t + "#<~A~S ~S ~m ~m ~m" + (-> obj type) + (if (logtest? (-> obj flags) (editable-flag changed)) + " (m)" + "" + ) + (-> obj name) + (-> obj trans x) + (-> obj trans y) + (-> obj trans z) + ) + (format #t " :r ~m @ #x~X>" (-> obj radius) obj) + obj + ) + +;; definition for method 23 of type editable-light +;; INFO: Used lq/sq +(defmethod editable-method-23 editable-light ((obj editable-light)) + (let ((v1-0 *light-hash*)) + (let* ((a2-0 (-> v1-0 num-lights)) + (a1-1 (-> v1-0 light-sphere-array a2-0)) + ) + (set! (-> a1-1 name) (-> obj name)) + (set! (-> a1-1 decay-start) (-> obj decay-start)) + (set! (-> a1-1 ambient-point-ratio) (-> obj ambient-point-ratio)) + (set! (-> a1-1 brightness) (-> obj brightness)) + (set! (-> a1-1 bsphere quad) (-> obj trans quad)) + (set! (-> a1-1 bsphere w) (-> obj radius)) + (set! (-> a1-1 direction quad) (-> obj direction quad)) + (set! (-> a1-1 color quad) (-> obj color quad)) + (set! (-> a1-1 palette-index) (the int (-> obj color w))) + ) + (+! (-> v1-0 num-lights) 1) + ) + #t + ) + +;; definition for function update-light-sphere-from-editable-light +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun update-light-sphere-from-editable-light ((arg0 editable-light)) + (let ((v1-0 (lookup-light-sphere-by-name (-> arg0 name) *light-hash*))) + (when v1-0 + (set! (-> v1-0 name) (-> arg0 name)) + (set! (-> v1-0 decay-start) (-> arg0 decay-start)) + (set! (-> v1-0 ambient-point-ratio) (-> arg0 ambient-point-ratio)) + (set! (-> v1-0 brightness) (-> arg0 brightness)) + (set! (-> v1-0 bsphere quad) (-> arg0 trans quad)) + (set! (-> v1-0 bsphere w) (-> arg0 radius)) + (set! (-> v1-0 direction quad) (-> arg0 direction quad)) + (set! (-> v1-0 color quad) (-> arg0 color quad)) + (set! (-> v1-0 palette-index) (the int (-> arg0 color w))) + ) + ) + (none) + ) + +;; definition for method 17 of type editable-light +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 editable-light ((obj editable-light) (arg0 vector)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> obj radius) (-> arg0 x)) + (set! (-> obj radius) (-> arg0 y)) + ) + (if (< (-> obj radius) 0.0) + (set! (-> obj radius) 0.0) + ) + (update-light-sphere-from-editable-light obj) + (editable-method-28 obj (editable-filter load)) + 0 + (none) + ) + +;; definition for method 15 of type editable-light +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-15 editable-light ((obj editable-light) (arg0 vector) (arg1 int)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (vector+! (-> obj trans) (-> obj trans) arg0) + (update-light-sphere-from-editable-light obj) + (editable-method-28 obj (the-as editable-filter arg1)) + 0 + (none) + ) + +;; definition for method 25 of type editable-light +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 25 editable-light) has a return type of none, but the expression builder found a return statement. +(defmethod editable-method-25 editable-light ((obj editable-light) (arg0 editable-array)) + ((the-as (function editable-light editable-array none) (find-parent-method editable-light 25)) obj arg0) + (when (nonzero? (-> obj id)) + (let ((s5-1 (clear *temp-string*))) + (format s5-1 "delete from light where light_id=~D" (-> obj id)) + (let ((a2-1 (sql-query s5-1))) + (when (!= (-> a2-1 error) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 obj) + (return 0) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 22 of type editable-light +(defmethod editable-method-22 editable-light ((obj editable-light) (arg0 editable-array) (arg1 int) (arg2 int)) + (cond + ((logtest? (-> obj flags) (editable-flag changed)) + (let ((s5-0 (clear *temp-string*))) + (when (zero? (-> obj id)) + (format s5-0 "insert into light set level_name='~S'" (-> obj region level)) + (let ((s3-0 (sql-query s5-0))) + (when (= (-> s3-0 error) 'modify) + (let ((v1-7 (sql-query "select LAST_INSERT_ID()"))) + (when (= (-> v1-7 error) 'select) + (set! (-> obj id) (the-as uint (string->int (the-as string (-> v1-7 data 0))))) + (goto cfg-8) + ) + ) + ) + (format 0 "ERROR: sql: id insert error ~A for ~A~%" s3-0 obj) + ) + (return #f) + (label cfg-8) + (let ((s3-1 (new 'debug 'string 32 (the-as string #f)))) + (format s3-1 "light-~d" (-> obj id)) + (set! (-> obj name) s3-1) + ) + ) + (format (clear s5-0) "update light set level_name='~S', name='~S'" (-> obj region level) (-> obj name)) + (format + s5-0 + ", pos_x=~f, pos_y=~f, pos_z=~f, r=~f" + (* 0.00024414062 (- (-> obj trans x) (-> arg0 level-offset x))) + (* 0.00024414062 (- (-> obj trans y) (-> arg0 level-offset y))) + (* 0.00024414062 (- (-> obj trans z) (-> arg0 level-offset z))) + (* 0.00024414062 (-> obj radius)) + ) + (if (= (-> obj direction w) 0.0) + (format s5-0 ", dir_x=0.0, dir_y=0.0, dir_z=0.0") + (format s5-0 ", dir_x=~f, dir_y=~f, dir_z=~f" (-> obj direction x) (-> obj direction y) (-> obj direction z)) + ) + (format + s5-0 + ", color0_r=~f, color0_g=~f, color0_b=~f, color0_a=~f" + (-> obj color x) + (-> obj color y) + (-> obj color z) + (-> obj color w) + ) + (format + s5-0 + ", decay_start=~f, ambient_point_ratio=~f, brightness=~f" + (-> obj decay-start) + (-> obj ambient-point-ratio) + (-> obj brightness) + ) + (format s5-0 " where light_id=~D" (-> obj id)) + (let ((a0-21 (sql-query s5-0))) + (when (= (-> a0-21 error) 'modify) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +;; definition for method 10 of type editable-light +(defmethod editable-method-10 editable-light ((obj editable-light)) + (if (!= (-> obj direction w) 0.0) + (add-debug-vector + #t + (bucket-id bucket-318) + (edit-get-trans obj) + (-> obj direction) + (* -1.2 (-> obj radius)) + (the-as rgba (-> (new 'static 'array uint64 1 #x80ff00ff) 0)) + ) + ) + (when (-> *editable* 0 light-names) + (let ((s5-1 add-debug-text-3d) + (s4-1 #t) + (s3-1 318) + ) + (format (clear *temp-string*) "~S~%" (-> obj name)) + (s5-1 s4-1 (the-as bucket-id s3-1) *temp-string* (-> obj trans) (font-color one) (the-as vector2h #f)) + ) + ) + ((method-of-type editable-sphere editable-method-10) obj) + (none) + ) + +;; definition for method 14 of type editable-face +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs vector. +(defmethod edit-get-trans editable-face ((obj editable-face)) + "Returns the `trans` [[vector]] or [[*null-vector*]]" + "The center of the obj." + (the-as vector (cond + ((>= (-> obj length) 3) + (let ((s5-0 (new 'static 'vector))) + (set! (-> s5-0 quad) (the-as uint128 0)) + (vector+! s5-0 s5-0 (edit-get-trans (-> obj vertex 0))) + (vector+! s5-0 s5-0 (edit-get-trans (-> obj vertex 1))) + (vector+! s5-0 s5-0 (edit-get-trans (-> obj vertex 2))) + (vector-float*! s5-0 s5-0 0.33333334) + ) + ) + ((>= (-> obj length) 2) + (let ((s5-1 (new 'static 'vector))) + (set! (-> s5-1 quad) (the-as uint128 0)) + (vector+! s5-1 s5-1 (edit-get-trans (-> obj vertex 0))) + (vector+! s5-1 s5-1 (edit-get-trans (-> obj vertex 1))) + (vector-float*! s5-1 s5-1 0.5) + ) + ) + (else + *null-vector* + ) + ) + ) + ) + +;; definition for method 22 of type editable-face +(defmethod editable-method-22 editable-face ((obj editable-face) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (clear *temp-string*))) + (format s4-0 "insert into region_face set kind='face',region_id=~D" (-> obj region id)) + (if (logtest? (-> obj flags) (editable-flag orient)) + (format s4-0 ",flags='orient'") + ) + (let ((a0-5 (sql-query s4-0))) + (if (!= (-> a0-5 error) 'modify) + (return #f) + ) + ) + ) + (dotimes (s4-1 (-> obj length)) + (editable-method-22 (-> obj vertex s4-1) arg0 2 s4-1) + ) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + +;; definition for method 25 of type editable-face +(defmethod editable-method-25 editable-face ((obj editable-face) (arg0 editable-array)) + (dotimes (s4-0 (-> obj length)) + (let ((s3-0 (-> obj vertex s4-0))) + (set! (-> s3-0 owner) (delete! obj (-> s3-0 owner))) + ) + ) + ((the-as (function editable-face editable-array none) (find-parent-method editable-face 25)) obj arg0) + (none) + ) + +;; definition for method 26 of type editable-face +(defmethod editable-method-26 editable-face ((obj editable-face) (arg0 editable) (arg1 editable-array)) + (-> obj length) + (countdown (v1-1 (-> obj length)) + (when (= (-> obj vertex v1-1) arg0) + (let ((a0-5 v1-1) + (a1-2 (+ (-> obj length) -2)) + ) + (while (>= a1-2 a0-5) + (set! (-> obj vertex a0-5) (-> obj vertex (+ a0-5 1))) + (+! a0-5 1) + ) + ) + (+! (-> obj length) -1) + ) + ) + (if (< (-> obj length) 3) + (editable-array-method-15 arg1 obj) + ) + ((method-of-type editable editable-method-26) obj arg0 arg1) + (none) + ) + +;; definition for method 27 of type editable-face +(defmethod editable-method-27 editable-face ((obj editable-face) (arg0 editable-array)) + (let ((gp-1 + ((the-as (function editable-face editable-array editable) (find-parent-method editable-face 27)) obj arg0) + ) + ) + (dotimes (s4-0 (-> (the-as editable-face gp-1) length)) + (let ((v1-3 (editable-method-27 (the-as editable-face (l.wu (+ (* s4-0 4) (the-as int gp-1) 60))) arg0)) + (a0-5 (+ (* s4-0 4) (the-as int gp-1))) + ) + (s.w! (+ a0-5 60) v1-3) + ) + (let ((v0-3 (cons gp-1 (-> (the-as editable-face (+ (* s4-0 4) (the-as int gp-1))) vertex 0 owner))) + (v1-10 (l.wu (+ (* s4-0 4) (the-as int gp-1) 60))) + ) + (s.w! (+ v1-10 16) v0-3) + ) + ) + gp-1 + ) + ) + +;; definition for method 24 of type editable-face +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-24 editable-face ((obj editable-face)) + (logxor! (-> obj flags) (editable-flag orient)) + (editable-face-method-31 obj (-> obj normal)) + (logior! (-> obj flags) (editable-flag changed)) + (set! (-> obj region changed) #t) + 0 + (none) + ) + +;; definition for method 30 of type editable-face +;; INFO: Used lq/sq +(defmethod editable-face-method-30 editable-face ((obj editable-face) (arg0 (inline-array vector))) + (let ((v1-0 (-> obj length))) + (cond + ((or (zero? v1-0) (= v1-0 1)) + 0 + ) + ((= v1-0 2) + (let ((s4-0 (edit-get-trans (-> obj vertex 0))) + (v1-3 (edit-get-trans (-> obj vertex 1))) + ) + (set! (-> arg0 0 quad) (-> s4-0 quad)) + (set! (-> arg0 1 quad) (-> s4-0 quad)) + (set! (-> arg0 1 y) (-> v1-3 y)) + (set! (-> arg0 2 quad) (-> v1-3 quad)) + (set! (-> arg0 2 y) (-> s4-0 y)) + (set! (-> arg0 3 quad) (-> v1-3 quad)) + ) + 4 + ) + (else + (dotimes (s4-1 (-> obj length)) + (set! (-> arg0 s4-1 quad) (-> (edit-get-trans (-> obj vertex s4-1)) quad)) + ) + (-> obj length) + ) + ) + ) + ) + +;; definition for method 31 of type editable-face +;; INFO: Used lq/sq +(defmethod editable-face-method-31 editable-face ((obj editable-face) (arg0 vector)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (dotimes (v1-0 6) + (set! (-> s4-0 vector v1-0 quad) (the-as uint128 0)) + ) + (if (>= (editable-face-method-30 obj (the-as (inline-array vector) s4-0)) 3) + (normal-of-plane arg0 (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1) (-> s4-0 vector 2)) + ) + ) + (if (logtest? (-> obj flags) (editable-flag orient)) + (vector-negate! arg0 arg0) + ) + arg0 + ) + +;; definition for method 13 of type editable-face +;; INFO: Used lq/sq +;; ERROR: failed type prop at 57: add failed: object + +;; WARN: Return type mismatch number vs float. +(defmethod edit-get-distance editable-face ((a0-0 editable-face) (a1-0 vector)) + (local-vars + (v0-0 vector) + (v0-1 vector) + (v0-2 symbol) + (v0-3 none) + (v0-4 int) + (v0-5 vector) + (v0-6 symbol) + (v0-7 symbol) + (v0-8 vector) + (v0-9 float) + (v0-10 number) + (v1-0 type) + (v1-1 type) + (v1-2 vector) + (v1-3 uint128) + (v1-5 int) + (v1-8 type) + (v1-9 symbol) + (v1-12 int) + (a0-1 editable-face) + (a0-2 editable-point) + (a0-3 vector) + (a0-4 vector) + (a0-5 int) + (a0-6 vector) + (a0-7 editable-face) + (a0-8 vector) + (a0-9 vector) + (a0-10 vector) + (a0-11 vector) + (a1-1 vector) + (a1-2 vector) + (a1-3 vector) + (a1-4 (inline-array vector)) + (a1-5 vector) + (a1-6 vector) + (a1-7 vector) + (a1-8 vector) + (a2-0 vector) + (a2-1 vector) + (a2-2 vector) + (a3-0 vector) + (a3-1 vector) + (a3-2 vector) + (t0-0 vector) + (t0-1 vector) + (s1-0 vector) + (s1-1 vector) + (s2-0 vector) + (s2-1 int) + (s3-1 object) + (s4-1 int) + (s5-0 vector) + (s5-1 (function vector vector float)) + (t9-0 (function editable-face vector vector)) + (t9-1 (function editable-point vector)) + (t9-2 (function vector vector symbol)) + (t9-3 (function vector vector vector vector none)) + (t9-4 (function editable-face (inline-array vector) int)) + (t9-5 (function vector vector vector)) + (t9-6 (function vector vector vector vector vector symbol)) + (t9-7 (function vector vector vector vector vector symbol)) + (t9-8 (function vector)) + (t9-9 (function vector vector float)) + (gp-0 vector) + (f0-0 float) + (f1-0 float) + ) + "Returns the distance from the camera to the [[editable]], or -1.0" + (when (begin + (set! gp-0 (new 'stack-no-clear 'vector)) + (set! a0-1 a0-0) + (set! v1-0 (-> a0-1 type)) + (set! t9-0 (method-of-type v1-0 editable-face-method-31)) + (set! a1-1 (new 'stack-no-clear 'vector)) + (set! v0-0 (call! a0-1 a1-1)) + (set! s5-0 v0-0) + (set! s2-0 (new 'stack-no-clear 'vector)) + (set! s1-0 s2-0) + (set! a0-2 (-> a0-0 vertex 0)) + (set! v1-1 (-> a0-2 type)) + (set! t9-1 (method-of-type v1-1 edit-get-trans)) + (set! v0-1 (call! a0-2)) + (set! v1-2 v0-1) + (set! v1-3 (-> v1-2 quad)) + (set! (-> s1-0 quad) v1-3) + (set! t9-2 transform-point-vector!) + (set! a0-3 gp-0) + (set! a1-2 s2-0) + (call! a0-3 a1-2) + (set! f0-0 0.0) + (set! f1-0 (-> gp-0 z)) + (<.s f0-0 f1-0) + ) + (set! t9-3 reverse-transform-point!) + (set! a0-4 gp-0) + (set! a2-0 s5-0) + (set! a1-3 s2-0) + (set! a3-0 a1-0) + (call! a0-4 a1-3 a2-0 a3-0) + (set! s3-1 (new 'stack-no-clear 'inline-array 'vector 6)) + (set! v1-5 0) + (while (<.si v1-5 6) + (set! a0-5 (sll v1-5 4)) + (set! a0-6 (+ s3-1 a0-5)) + (set! (-> a0-6 quad) (the-as uint128 0)) + (set! v1-5 (+ v1-5 1)) + ) + (set! v1-8 (-> a0-0 type)) + (set! t9-4 (method-of-type v1-8 editable-face-method-30)) + (set! a1-4 s3-1) + (set! a0-7 a0-0) + (set! v0-4 (call! a0-7 a1-4)) + (set! s4-1 v0-4) + (set! s2-1 0) + (set! t9-5 vector-negate!) + (set! a0-8 (new 'stack-no-clear 'vector)) + (set! a1-5 s5-0) + (set! v0-5 (call! a0-8 a1-5)) + (set! s1-1 v0-5) + (while (begin (set! v1-12 (+ s2-1 2)) (<.si v1-12 s4-1)) + (if (begin + (or (begin + (set! t9-6 point-in-triangle-cross) + (set! a0-9 gp-0) + (set! a1-6 s5-0) + (set! a2-1 (+ s3-1 0)) + (set! a3-1 (+ s3-1 16)) + (set! t0-0 (+ s3-1 32)) + (set! v0-6 (call! a0-9 a1-6 a2-1 a3-1 t0-0)) + v0-6 + ) + (begin + (set! t9-7 point-in-triangle-cross) + (set! a0-10 gp-0) + (set! a1-7 s1-1) + (set! a2-2 (-> s3-1 0)) + (set! a3-2 (-> s3-1 1)) + (set! t0-1 (-> s3-1 2)) + (set! v0-7 (call! a0-10 a1-7 a2-2 a3-2 t0-1)) + (set! v1-9 v0-7) + ) + ) + v1-9 + ) + (return (begin + (set! s5-1 vector-vector-distance) + (set! t9-8 camera-pos) + (set! v0-8 (call!)) + (set! a0-11 v0-8) + (set! t9-9 s5-1) + (set! a1-8 gp-0) + (set! v0-9 (call! a0-11 a1-8)) + (set! v0-10 v0-9) + ) + ) + ) + (set! s2-1 (+ s2-1 1)) + (set! s3-1 (-> s3-1 1)) + ) + ) + (set! v0-10 -1082130432) + (ret-value v0-10) + ) + +;; definition for method 29 of type editable-face +;; INFO: Used lq/sq +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 376 signed mismatch +;; WARN: Stack slot offset 400 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Return type mismatch int vs symbol. +(defmethod editable-method-29 editable-face ((obj editable-face) (arg0 editable-filter)) + (local-vars + (sv-208 (inline-array vector)) + (sv-216 int) + (sv-288 array) + (sv-292 int) + (sv-296 int) + (sv-368 matrix) + (sv-372 uint) + (sv-376 number) + (sv-380 symbol) + (sv-400 float) + ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (if (or (logtest? arg0 (editable-filter water-command)) (logtest? (-> obj flags) (editable-flag mark))) + (return (the-as symbol #f)) + ) + (logior! (-> obj flags) (editable-flag mark)) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-7 6) + (set! (-> s5-0 v1-7 quad) (the-as uint128 0)) + ) + (let ((s4-0 (editable-face-method-30 obj s5-0))) + (when (and (>= s4-0 4) (>= (-> obj length) 3)) + (let ((v1-14 0)) + (dotimes (a0-7 s4-0) + (if (logtest? (-> obj vertex a0-7 flags) (editable-flag selected)) + (+! v1-14 1) + ) + ) + (cond + ((= v1-14 s4-0) + (set! arg0 (logior arg0 (editable-filter load))) + ) + ((= v1-14 2) + (let ((v1-15 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (a0-12 6) + (set! (-> v1-15 a0-12 quad) (the-as uint128 0)) + ) + (set! sv-208 v1-15) + ) + (set! sv-216 0) + (dotimes (s2-2 s4-0) + (when (zero? (logand (-> obj vertex s2-2 flags) (editable-flag selected))) + (set! (-> sv-208 sv-216 quad) (-> (edit-get-trans (-> obj vertex s2-2)) quad)) + (set! sv-216 (+ sv-216 1)) + ) + ) + (dotimes (s2-3 s4-0) + (when (logtest? (-> obj vertex s2-3 flags) (editable-flag selected)) + (set! (-> sv-208 sv-216 quad) (-> (edit-get-trans (-> obj vertex s2-3)) quad)) + (set! sv-216 (+ sv-216 1)) + ) + ) + (normal-of-plane (-> obj normal) (-> sv-208 0) (-> sv-208 1) (-> sv-208 2)) + (set! (-> obj center quad) (-> (edit-get-trans obj) quad)) + ) + ) + ) + (when (zero? (logand arg0 (editable-filter load))) + (when (= (-> obj normal w) 0.0) + (editable-face-method-31 obj (-> obj normal)) + (set! (-> obj center quad) (-> (edit-get-trans obj) quad)) + ) + (let ((s3-2 0) + (s2-5 (-> obj normal)) + (s1-2 (-> obj center)) + ) + (while (< s3-2 s4-0) + (when (logtest? (-> obj vertex s3-2 flags) (editable-flag selected)) + (let* ((a1-14 (vector-! (new 'stack-no-clear 'vector) (-> s5-0 s3-2) s1-2)) + (f0-2 (vector-dot a1-14 s2-5)) + (a0-27 (-> obj vertex s3-2)) + (t9-7 (method-of-object a0-27 edit-coord!)) + ) + (let ((v1-76 (-> s5-0 s3-2)) + (a2-1 s2-5) + (f0-3 (- f0-2)) + ) + (.lvf vf2 (&-> a2-1 quad)) + (.lvf vf1 (&-> v1-76 quad)) + (let ((v1-77 f0-3)) + (.mov vf3 v1-77) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a1-14 quad) vf4) + (t9-7 a0-27 a1-14 (editable-flag x y z no-plane-snap)) + ) + ) + (+! s3-2 1) + ) + ) + ) + (set! sv-288 + ((method-of-type array new) + (the-as symbol (new 'stack-no-clear 'array 'editable-point 6)) + array + editable-point + 6 + ) + ) + (set! sv-292 (+ (-> obj length) -1)) + (set! sv-296 1) + (editable-face-method-31 obj (-> obj normal)) + (dotimes (v1-86 sv-292) + (set! (-> (the-as editable-point (+ (* v1-86 4) (the-as int sv-288))) region) + (the-as editable-region (-> obj vertex (+ v1-86 1))) + ) + ) + (set! sv-368 (new-stack-matrix0)) + (set! sv-372 (the-as uint #f)) + (set! sv-376 0.0) + (set! sv-380 #t) + (vector-normalize! + (vector-! (-> sv-368 vector 2) (edit-get-trans obj) (edit-get-trans (-> obj vertex 0))) + 1.0 + ) + (vector-normalize! (editable-face-method-31 obj (-> sv-368 vector 1)) 1.0) + (vector-normalize! + (vector-cross! (the-as vector (-> sv-368 vector)) (-> sv-368 vector 2) (-> sv-368 vector 1)) + 1.0 + ) + (set! (-> sv-368 trans quad) (-> (edit-get-trans (-> obj vertex 0)) quad)) + (set! (-> sv-368 trans w) 1.0) + (matrix-4x4-inverse! sv-368 sv-368) + (while (< sv-296 (-> obj length)) + (set! sv-372 (the-as uint #f)) + (dotimes (s5-4 sv-292) + (when (l.wu (+ (* s5-4 4) (the-as int sv-288) 12)) + (let* ((a1-26 (edit-get-trans (-> (the-as (array editable-point) sv-288) s5-4))) + (a0-48 (vector-matrix*! (new 'stack-no-clear 'vector) a1-26 sv-368)) + ) + (set! sv-400 (vector-y-angle a0-48)) + ) + (cond + (sv-380 + (when (or (not sv-372) (< (the-as float (gpr->fpr sv-376)) sv-400)) + (set! sv-372 (l.wu (+ (* s5-4 4) (the-as int sv-288) 12))) + (set! sv-376 sv-400) + ) + ) + (else + (when (or (not sv-372) (< sv-400 (the-as float (gpr->fpr sv-376)))) + (set! sv-372 (l.wu (+ (* s5-4 4) (the-as int sv-288) 12))) + (set! sv-376 sv-400) + ) + ) + ) + ) + ) + (set! (-> obj vertex sv-296) (the-as editable-point sv-372)) + (dotimes (v1-138 sv-292) + (when (= sv-372 (l.wu (+ (* v1-138 4) (the-as int sv-288) 12))) + (let ((a0-59 (+ (* v1-138 4) (the-as int sv-288)))) + (s.w! (+ a0-59 12) #f) + ) + ) + ) + (set! sv-296 (+ sv-296 1)) + (set! sv-380 (not sv-380)) + ) + (if (< (vector-dot (-> obj normal) (editable-face-method-31 obj (new 'stack-no-clear 'vector))) 0.0) + (logxor! (-> obj flags) (editable-flag orient)) + ) + ) + ) + ) + (editable-face-method-31 obj (-> obj normal)) + (set! (-> obj center quad) (-> (edit-get-trans obj) quad)) + (the-as symbol 0) + ) + ) + +;; definition for method 10 of type editable-face +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-10 editable-face ((obj editable-face)) + (local-vars (sv-112 int)) + (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-0 6) + (set! (-> gp-0 v1-0 quad) (the-as uint128 0)) + ) + (set! sv-112 (editable-face-method-30 obj gp-0)) + (when (>= sv-112 3) + (let ((s1-0 (editable-face-method-31 obj (new 'stack-no-clear 'vector)))) + (add-debug-vector + #t + (bucket-id bucket-318) + (edit-get-trans obj) + s1-0 + (the-as meters #x46000000) + (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + ) + ) + (when (logtest? (-> obj flags) (editable-flag selected)) + (dotimes (s4-1 sv-112) + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 318) + ) + (format (clear *temp-string*) "~D" s4-1) + (s3-1 + s2-1 + (the-as bucket-id s1-1) + *temp-string* + (-> gp-0 s4-1) + (if (logtest? (-> obj flags) (editable-flag orient)) + (font-color fc-5) + (font-color one) + ) + (the-as vector2h #f) + ) + ) + ) + ) + (add-debug-bound + 324 + (the-as transform 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)) + ) + (if (zero? (logand (-> 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)) + ) + (if (logtest? (-> obj flags) (editable-flag selected)) + 1 + 0 + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type editable-plane +(defmethod edit-get-trans editable-plane ((obj editable-plane)) + "Returns the `trans` [[vector]] or [[*null-vector*]]" + (if (>= (-> obj length) 1) + (edit-get-trans (-> obj vertex 0)) + *null-vector* + ) + ) + +;; definition for method 22 of type editable-plane +(defmethod editable-method-22 editable-plane ((obj editable-plane) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (clear *temp-string*))) + (format + s4-0 + "insert into region_face set kind='plane',region_id=~D,radius=~f" + (-> obj region id) + (-> obj radius) + ) + (let ((a0-4 (sql-query s4-0))) + (if (!= (-> a0-4 error) 'modify) + (return #f) + ) + ) + ) + (dotimes (s4-1 (-> obj length)) + (editable-method-22 (-> obj vertex s4-1) arg0 2 s4-1) + ) + (logclear! (-> obj flags) (editable-flag changed)) + #t + ) + +;; definition for method 25 of type editable-plane +(defmethod editable-method-25 editable-plane ((obj editable-plane) (arg0 editable-array)) + (dotimes (s4-0 (-> obj length)) + (let ((s3-0 (-> obj vertex s4-0))) + (set! (-> s3-0 owner) (delete! obj (-> s3-0 owner))) + ) + ) + ((the-as (function editable-plane editable-array none) (find-parent-method editable-plane 25)) obj arg0) + (none) + ) + +;; definition for method 26 of type editable-plane +(defmethod editable-method-26 editable-plane ((obj editable-plane) (arg0 editable) (arg1 editable-array)) + (editable-array-method-15 arg1 obj) + ((method-of-type editable editable-method-26) obj arg0 arg1) + (none) + ) + +;; definition for method 27 of type editable-plane +(defmethod editable-method-27 editable-plane ((obj editable-plane) (arg0 editable-array)) + (let ((gp-1 + ((the-as (function editable-plane editable-array editable) (find-parent-method editable-plane 27)) obj arg0) + ) + ) + (dotimes (s4-0 (-> (the-as editable-plane gp-1) length)) + (let ((v1-3 (editable-method-27 (-> (the-as editable-plane (+ (* s4-0 4) (the-as int gp-1))) vertex 0) arg0)) + (a0-5 (+ (* s4-0 4) (the-as int gp-1))) + ) + (s.w! (+ a0-5 28) v1-3) + ) + (let ((v0-3 (cons gp-1 (-> (the-as editable-plane (+ (* s4-0 4) (the-as int gp-1))) vertex 0 owner))) + (v1-10 (l.wu (+ (* s4-0 4) (the-as int gp-1) 28))) + ) + (s.w! (+ v1-10 16) v0-3) + ) + ) + gp-1 + ) + ) + +;; definition for method 24 of type editable-plane +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-24 editable-plane ((obj editable-plane)) + (let ((s5-1 + (vector-! (new 'stack-no-clear 'vector) (edit-get-trans (-> obj vertex 1)) (edit-get-trans (-> obj vertex 0))) + ) + ) + (edit-coord! (-> obj vertex 1) (vector-! s5-1 (edit-get-trans (-> obj vertex 0)) s5-1) (editable-flag x y z)) + ) + (set! (-> obj region changed) #t) + (logior! (-> obj flags) (editable-flag changed)) + 0 + (none) + ) + +;; definition for method 30 of type editable-plane +(defmethod editable-plane-method-30 editable-plane ((obj editable-plane) (arg0 matrix)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (case (-> obj length) + ((2) + (let* ((v1-2 (editable-plane-method-31 obj (new 'stack-no-clear 'vector))) + (s5-1 (vector-cross! + (new 'stack-no-clear 'vector) + v1-2 + (if (< 0.7 (fabs (vector-dot v1-2 (new 'static 'vector :z 1.0 :w 1.0)))) + (new 'static 'vector :x 1.0 :w 1.0) + (new 'static 'vector :z 1.0 :w 1.0) + ) + ) + ) + (s4-1 (vector-cross! (new 'stack-no-clear 'vector) s5-1 v1-2)) + (f30-0 (-> obj radius)) + ) + (let ((v1-4 (edit-get-trans (-> obj vertex 0)))) + (let ((a0-6 (-> arg0 vector))) + (let ((a1-6 v1-4) + (a2-1 s5-1) + (f0-1 f30-0) + ) + (.lvf vf2 (&-> a2-1 quad)) + (.lvf vf1 (&-> a1-6 quad)) + (let ((a1-7 f0-1)) + (.mov vf3 a1-7) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-6 0 quad) vf4) + ) + (let ((a0-7 (-> arg0 vector))) + (let ((a1-8 (-> arg0 vector)) + (a2-2 s4-1) + (f0-2 (- f30-0)) + ) + (.lvf vf2 (&-> a2-2 quad)) + (.lvf vf1 (&-> a1-8 0 quad)) + (let ((a1-9 f0-2)) + (.mov vf3 a1-9) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-7 0 quad) vf4) + ) + (let ((a0-8 (-> arg0 vector 1))) + (let ((a1-10 v1-4) + (a2-3 s5-1) + (f0-3 (- f30-0)) + ) + (.lvf vf2 (&-> a2-3 quad)) + (.lvf vf1 (&-> a1-10 quad)) + (let ((a1-11 f0-3)) + (.mov vf3 a1-11) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-8 quad) vf4) + ) + (let ((a0-9 (-> arg0 vector 1))) + (let ((a1-12 (-> arg0 vector 1)) + (a2-4 s4-1) + (f0-4 (- f30-0)) + ) + (.lvf vf2 (&-> a2-4 quad)) + (.lvf vf1 (&-> a1-12 quad)) + (let ((a1-13 f0-4)) + (.mov vf3 a1-13) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-9 quad) vf4) + ) + (let ((a0-10 (-> arg0 vector 2))) + (let ((a1-14 v1-4) + (a2-5 s5-1) + (f0-5 f30-0) + ) + (.lvf vf2 (&-> a2-5 quad)) + (.lvf vf1 (&-> a1-14 quad)) + (let ((a1-15 f0-5)) + (.mov vf3 a1-15) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-10 quad) vf4) + ) + (let ((a0-11 (-> arg0 vector 2))) + (let ((a1-16 (-> arg0 vector 2)) + (a2-6 s4-1) + (f0-6 f30-0) + ) + (.lvf vf2 (&-> a2-6 quad)) + (.lvf vf1 (&-> a1-16 quad)) + (let ((a1-17 f0-6)) + (.mov vf3 a1-17) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-11 quad) vf4) + ) + (let ((a0-12 (-> arg0 trans))) + (let ((f0-7 (- f30-0))) + (.lvf vf2 (&-> s5-1 quad)) + (.lvf vf1 (&-> v1-4 quad)) + (let ((v1-5 f0-7)) + (.mov vf3 v1-5) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a0-12 quad) vf4) + ) + ) + (let ((v1-6 (-> arg0 trans))) + (let ((a0-13 (-> arg0 trans))) + (.lvf vf2 (&-> s4-1 quad)) + (.lvf vf1 (&-> a0-13 quad)) + ) + (let ((a0-14 f30-0)) + (.mov vf3 a0-14) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> v1-6 quad) vf4) + ) + ) + 4 + ) + (else + 0 + ) + ) + ) + ) + +;; definition for method 31 of type editable-plane +(defmethod editable-plane-method-31 editable-plane ((obj editable-plane) (arg0 vector)) + (case (-> obj length) + ((2) + (let ((s3-0 (-> obj vertex 0)) + (a0-1 (-> obj vertex 1)) + ) + (vector-! arg0 (edit-get-trans a0-1) (edit-get-trans s3-0)) + ) + (vector-normalize! arg0 1.0) + ) + ) + arg0 + ) + +;; definition for method 13 of type editable-plane +;; INFO: Used lq/sq +;; ERROR: failed type prop at 64: add failed: structure + +(defmethod edit-get-distance editable-plane ((a0-0 editable-plane) (a1-0 vector)) + (local-vars + (v0-0 vector) + (v0-1 vector) + (v0-2 symbol) + (v0-3 vector) + (v0-4 none) + (v0-5 int) + (v0-6 vector) + (v0-7 symbol) + (v0-8 symbol) + (v0-9 vector) + (v0-10 float) + (v0-11 float) + (v1-0 type) + (v1-1 type) + (v1-2 vector) + (v1-3 uint128) + (v1-5 type) + (v1-6 int) + (v1-9 type) + (v1-10 symbol) + (v1-13 int) + (a0-1 editable-plane) + (a0-2 editable-point) + (a0-3 vector) + (a0-4 editable-point) + (a0-5 vector) + (a0-6 int) + (a0-7 int) + (a0-8 editable-plane) + (a0-9 transform) + (a0-10 vector) + (a0-11 none) + (a0-12 vector) + (a1-1 vector) + (a1-2 vector) + (a1-3 vector) + (a1-4 matrix) + (a1-5 vector) + (a1-6 vector) + (a1-7 vector) + (a1-8 none) + (a2-0 vector) + (a2-1 structure) + (a2-2 (inline-array vector)) + (a3-0 vector) + (a3-1 vector) + (a3-2 vector) + (t0-0 vector) + (t0-1 vector) + (s1-0 vector) + (s1-1 vector) + (s1-2 vector) + (s2-0 vector) + (s2-1 (function vector vector vector vector none)) + (s2-2 int) + (s3-1 structure) + (s4-1 int) + (s5-0 vector) + (s5-1 (function vector vector float)) + (t9-0 (function editable-plane vector vector)) + (t9-1 (function editable-point vector)) + (t9-2 (function vector vector symbol)) + (t9-3 (function editable-point vector)) + (t9-4 (function vector vector vector vector none)) + (t9-5 (function editable-plane matrix int)) + (t9-6 (function vector vector vector)) + (t9-7 (function vector vector vector vector vector symbol)) + (t9-8 (function vector vector vector vector vector symbol)) + (t9-9 (function vector)) + (t9-10 (function vector vector float)) + (gp-0 vector) + (f0-0 float) + (f1-0 float) + ) + "Returns the distance from the camera to the [[editable]], or -1.0" + (when (begin + (set! gp-0 (new 'stack-no-clear 'vector)) + (set! a0-1 a0-0) + (set! v1-0 (-> a0-1 type)) + (set! t9-0 (method-of-type v1-0 editable-plane-method-31)) + (set! a1-1 (new 'stack-no-clear 'vector)) + (set! v0-0 (call! a0-1 a1-1)) + (set! s5-0 v0-0) + (set! s1-0 (new 'stack-no-clear 'vector)) + (set! s2-0 s1-0) + (set! a0-2 (-> a0-0 vertex 0)) + (set! v1-1 (-> a0-2 type)) + (set! t9-1 (method-of-type v1-1 edit-get-trans)) + (set! v0-1 (call! a0-2)) + (set! v1-2 v0-1) + (set! v1-3 (-> v1-2 quad)) + (set! (-> s2-0 quad) v1-3) + (set! t9-2 transform-point-vector!) + (set! a0-3 gp-0) + (set! a1-2 s1-0) + (call! a0-3 a1-2) + (set! f0-0 0.0) + (set! f1-0 (-> gp-0 z)) + (<.s f0-0 f1-0) + ) + (set! s2-1 reverse-transform-point!) + (set! s1-1 gp-0) + (set! a0-4 (-> a0-0 vertex 0)) + (set! v1-5 (-> a0-4 type)) + (set! t9-3 (method-of-type v1-5 edit-get-trans)) + (set! v0-3 (call! a0-4)) + (set! a1-3 v0-3) + (set! a2-0 s5-0) + (set! t9-4 s2-1) + (set! a0-5 s1-1) + (set! a3-0 a1-0) + (call! a0-5 a1-3 a2-0 a3-0) + (set! s3-1 (new 'stack-no-clear 'matrix)) + (set! v1-6 0) + (while (<.si v1-6 4) + (set! a0-6 (sll v1-6 4)) + (set! a0-7 (+ s3-1 a0-6)) + (set! (dynamic-array-field-access a0-7 vector PLACEHOLDER quad) 0) + (set! v1-6 (+ v1-6 1)) + ) + (set! v1-9 (-> a0-0 type)) + (set! t9-5 (method-of-type v1-9 editable-plane-method-30)) + (set! a1-4 s3-1) + (set! a0-8 a0-0) + (set! v0-5 (call! a0-8 a1-4)) + (set! s4-1 v0-5) + (set! s2-2 0) + (set! t9-6 vector-negate!) + (set! a0-9 (new 'stack-no-clear 'transform)) + (set! a1-5 s5-0) + (set! v0-6 (call! a0-9 a1-5)) + (set! s1-2 v0-6) + (while (begin (set! v1-13 (+ s2-2 2)) (<.si v1-13 s4-1)) + (if (begin + (or (begin + (set! t9-7 point-in-triangle-cross) + (set! a0-10 gp-0) + (set! a1-6 s5-0) + (set! a2-1 (+ s3-1 0)) + (set! a3-1 (+ s3-1 16)) + (set! t0-0 (+ s3-1 32)) + (set! v0-7 (call! a0-10 a1-6 a2-1 a3-1 t0-0)) + v0-7 + ) + (begin + (set! t9-8 point-in-triangle-cross) + (set! a0-11 (the-as none gp-0)) + (set! a1-7 s1-2) + (set! a2-2 (-> s3-1 vector)) + (set! a3-2 (-> s3-1 vector 1)) + (set! t0-1 (-> s3-1 vector 2)) + (set! v0-8 (call! a0-11 a1-7 a2-2 a3-2 t0-1)) + (set! v1-10 v0-8) + ) + ) + v1-10 + ) + (return (begin + (set! s5-1 vector-vector-distance) + (set! t9-9 camera-pos) + (set! v0-9 (call!)) + (set! a0-12 v0-9) + (set! t9-10 s5-1) + (set! a1-8 (the-as none gp-0)) + (set! v0-10 (call! a0-12 a1-8)) + (set! v0-11 v0-10) + ) + ) + ) + (set! s2-2 (+ s2-2 1)) + (set! s3-1 (-> s3-1 vector 1)) + ) + ) + (set! v0-11 -1.0) + (ret-value v0-11) + ) + +;; definition for method 10 of type editable-plane +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-10 editable-plane ((obj editable-plane)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (dotimes (v1-0 4) + (set! (-> gp-0 vector v1-0 quad) (the-as uint128 0)) + ) + (let ((s4-0 (editable-plane-method-30 obj gp-0))) + (when (>= s4-0 3) + (add-debug-line + #t + (bucket-id bucket-318) + (edit-get-trans (-> obj vertex 0)) + (edit-get-trans (-> obj vertex 1)) + (the-as rgba (-> (new 'static 'array uint64 1 #x8000ffff) 0)) + #f + (the-as rgba -1) + ) + (add-debug-bound + 324 + (the-as transform 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)) + ) + (if (zero? (logand (-> 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)) + ) + (if (logtest? (-> obj flags) (editable-flag selected)) + 1 + 0 + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 17 of type editable-plane +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 editable-plane ((obj editable-plane) (arg0 vector)) + (let ((v1-0 (-> obj region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> obj flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> obj radius) (-> arg0 x)) + (set! (-> obj radius) (-> arg0 y)) + ) + (if (< (-> obj radius) 0.0) + (set! (-> obj radius) 0.0) + ) + (editable-method-28 obj (editable-filter load)) + 0 + (none) + ) + +;; definition for method 7 of type editable-array +;; WARN: Return type mismatch (array editable) vs editable-array. +(defmethod relocate editable-array ((obj editable-array) (arg0 int)) + (the-as editable-array (when (nonzero? (-> obj selection)) + (let ((v0-0 (&+ (-> obj selection) arg0))) + (set! (-> obj selection) v0-0) + v0-0 + ) + ) + ) + ) + +;; definition for method 4 of type editable-array +(defmethod length editable-array ((obj editable-array)) + (-> obj length) + ) + +;; definition for method 5 of type editable-array +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of editable-array ((obj editable-array)) + (the-as int (+ (-> obj type size) (* (-> obj allocated-length) 4))) + ) + +;; definition for method 11 of type editable-array +(defmethod editable-array-method-11 editable-array ((obj editable-array)) + (dotimes (v1-0 (-> obj length)) + (if (not (-> obj data v1-0)) + (return v1-0) + ) + ) + (when (< (-> obj length) (-> obj allocated-length)) + (+! (-> obj length) 1) + (return (+ (-> obj length) -1)) + ) + -1 + ) + +;; definition for method 10 of type editable-array +(defmethod editable-array-method-10 editable-array ((obj editable-array) (arg0 vector) (arg1 int)) + (when (or (!= (-> arg0 x) (-> *editable-work* last-x)) (!= (-> arg0 y) (-> *editable-work* last-y))) + (set! (-> *editable-work* last-found) 0) + (set! (-> *editable-work* last-x) (-> arg0 x)) + (set! (-> *editable-work* last-y) (-> arg0 y)) + ) + 4095996000.0 + (let ((s5-0 (the-as editable #f))) + (set! (-> *editable-work* num-found) 0) + (let* ((s2-0 (-> obj length)) + (s1-0 0) + (s0-0 (-> obj data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (or (and (logtest? (-> s0-0 region filter) (-> obj filter 0)) + (logtest? (-> s0-0 region filter) (-> obj filter 1)) + ) + (logtest? (-> s0-0 flags) (editable-flag selected)) + ) + ) + (let ((f0-5 (edit-get-distance s0-0 arg0))) + (when (>= f0-5 0.0) + (set! (-> *editable-work* found (-> *editable-work* num-found)) s0-0) + (set! (-> *editable-work* dists (-> *editable-work* num-found)) (the-as uint f0-5)) + (if (< (-> *editable-work* num-found) 255) + (+! (-> *editable-work* num-found) 1) + ) + ) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> obj data s1-0)) + ) + ) + (countdown (v1-43 (-> *editable-work* num-found)) + (when (> v1-43 0) + (countdown (a0-12 v1-43) + (when (< (the-as float (-> *editable-work* dists v1-43)) (the-as float (-> *editable-work* dists a0-12))) + (let ((a1-10 (-> *editable-work* found v1-43)) + (f0-7 (-> *editable-work* dists v1-43)) + ) + (set! (-> *editable-work* found v1-43) (-> *editable-work* found a0-12)) + (set! (-> *editable-work* dists v1-43) (-> *editable-work* dists a0-12)) + (set! (-> *editable-work* found a0-12) a1-10) + (set! (-> *editable-work* dists a0-12) f0-7) + ) + ) + ) + ) + ) + (when (nonzero? (-> *editable-work* num-found)) + (when (>= (-> *editable-work* last-found) (-> *editable-work* num-found)) + (set! (-> *editable-work* last-found) 0) + 0 + ) + (set! s5-0 (cond + ((zero? arg1) + (set! s5-0 (-> *editable-work* found (-> *editable-work* last-found))) + (+! (-> *editable-work* last-found) 1) + s5-0 + ) + (else + (-> *editable-work* found 0) + ) + ) + ) + ) + s5-0 + ) + ) + +;; definition for method 14 of type editable-array +;; WARN: Return type mismatch (array editable) vs none. +(defmethod editable-array-method-14 editable-array ((obj editable-array) (arg0 (function symbol)) (arg1 symbol)) + (let ((gp-0 (-> obj selection))) + (set! (-> gp-0 length) 0) + (let* ((s2-0 (-> obj length)) + (s1-0 0) + (s0-0 (-> obj data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (logtest? (-> s0-0 flags) (editable-flag selected))) + (when (arg0) + (set! (-> gp-0 (-> gp-0 length)) s0-0) + (+! (-> gp-0 length) 1) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> obj data s1-0)) + ) + ) + ) + (none) + ) + +;; definition for method 15 of type editable-array +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-15 editable-array ((obj editable-array) (arg0 editable)) + (let ((gp-0 (-> arg0 region))) + (when gp-0 + (editable-method-25 arg0 obj) + (let* ((v1-3 (-> obj length)) + (a0-2 0) + (a1-4 (-> obj data a0-2)) + ) + (while (< a0-2 v1-3) + (if (and a1-4 (= arg0 a1-4)) + (set! (-> obj data a0-2) #f) + ) + (+! a0-2 1) + (set! a1-4 (-> obj data a0-2)) + ) + ) + (let* ((v1-6 (-> obj length)) + (a0-3 0) + (a1-14 (-> obj data a0-3)) + ) + (while (< a0-3 v1-6) + (if (and a1-14 (= (-> a1-14 region) gp-0) (!= a1-14 arg0)) + (goto cfg-21) + ) + (+! a0-3 1) + (set! a1-14 (-> obj data a0-3)) + ) + ) + (editable-region-method-10 gp-0 0) + ) + ) + (label cfg-21) + 0 + (none) + ) + +;; definition for method 12 of type editable-array +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Stack slot offset 40 signed mismatch +;; WARN: Stack slot offset 44 signed mismatch +;; WARN: Return type mismatch symbol vs none. +;; WARN: Function (method 12 editable-array) has a return type of none, but the expression builder found a return statement. +(defmethod editable-array-method-12 editable-array ((obj editable-array) (arg0 editable-array)) + (local-vars + (sv-16 sql-result) + (sv-20 sql-result) + (sv-24 sql-result) + (sv-28 sql-result) + (sv-32 sql-result) + (sv-36 editable-region) + (sv-40 number) + (sv-44 number) + (sv-64 int) + (sv-72 int) + (sv-80 editable-plane) + (sv-84 symbol) + (sv-112 vector) + (sv-120 int) + (sv-128 editable-point) + (sv-136 int) + (sv-144 int) + (sv-152 editable-face) + (sv-156 symbol) + (sv-176 vector) + (sv-180 editable) + (sv-184 int) + (sv-192 int) + (sv-200 editable-point) + (sv-208 int) + (sv-216 sql-result) + (sv-240 sql-result) + ) + (format #t "sql: load from level ~A~%" arg0) + (set! (-> *editable-sample-region* level) (the-as string arg0)) + (set! (-> *editable-light-region* level) (the-as string arg0)) + (set! (-> *editable-entity-region* level) (the-as string arg0)) + (vector-reset! (-> obj level-offset)) + (set! (-> obj level-info-id) (the-as uint -1)) + (set! (-> obj level) (the-as uint arg0)) + (let ((s4-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" + arg0 + ) + (set! sv-16 (s4-0 *temp-string*)) + ) + (when (and (= (-> sv-16 error) 'select) (>= (-> sv-16 len) 3)) + (set-vector! + (-> obj level-offset) + (* 4096.0 (string->float (the-as string (-> sv-16 data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 data 2)))) + 1.0 + ) + (set! (-> obj level-info-id) (the-as uint (string->int (the-as string (-> sv-16 data 3))))) + ) + (let ((s4-2 sql-query)) + (format + (clear *temp-string*) + "select region_id,level_name,tree,on_enter,on_exit,on_inside from region where level_name='~S'" + arg0 + ) + (set! sv-20 (s4-2 *temp-string*)) + ) + (if (!= (-> sv-20 error) 'select) + (return #f) + ) + (format #t "sql: read region ~D~%" (/ (-> sv-20 len) 6)) + (let ((s4-3 sql-query)) + (format + (clear *temp-string*) + "select region_face.region_id,region_face_id,kind,flags,radius from region,region_face where level_name='~S' and region.region_id=region_face.region_id" + arg0 + ) + (set! sv-24 (s4-3 *temp-string*)) + ) + (if (!= (-> sv-24 error) 'select) + (return #f) + ) + (format #t "sql: read face ~D~%" (/ (-> sv-24 len) 5)) + (let ((s4-4 sql-query)) + (format + (clear *temp-string*) + "select region_face.region_face_id,idx,x,y,z from region,region_face,region_point where level_name='~S' and region.region_id=region_face.region_id and region_face.region_face_id=region_point.region_face_id" + arg0 + ) + (set! sv-28 (s4-4 *temp-string*)) + ) + (if (!= (-> sv-28 error) 'select) + (return #f) + ) + (format #t "sql: read point ~D~%" (/ (-> sv-28 len) 5)) + (let ((s4-5 sql-query)) + (format + (clear *temp-string*) + "select region_sphere.region_id,x,y,z,r from region,region_sphere where level_name='~S' and region.region_id=region_sphere.region_id" + arg0 + ) + (set! sv-32 (s4-5 *temp-string*)) + ) + (if (!= (-> sv-32 error) 'select) + (return #f) + ) + (format #t "sql: read sphere ~D~%" (/ (-> sv-32 len) 5)) + (let ((s5-1 0)) + (while (< s5-1 (-> sv-20 len)) + (set! sv-36 (new 'debug 'editable-region)) + (set! sv-40 4095996000.0) + (set! sv-44 -4095996000.0) + (set! (-> sv-36 id) (the-as uint (string->int (the-as string (-> sv-20 data s5-1))))) + (set! (-> sv-36 level) (the-as string (string->symbol (the-as string (-> sv-20 data (+ s5-1 1)))))) + (set! (-> sv-36 tree) (the-as string (string->symbol (the-as string (-> sv-20 data (+ s5-1 2)))))) + (set! (-> sv-36 on-enter) (the-as string (if (string= (the-as string (-> sv-20 data (+ s5-1 3))) "") + #f + (-> sv-20 data (+ s5-1 3)) + ) + ) + ) + (set! (-> sv-36 on-exit) (the-as string (if (string= (the-as string (-> sv-20 data (+ s5-1 4))) "") + #f + (-> sv-20 data (+ s5-1 4)) + ) + ) + ) + (set! (-> sv-36 on-inside) (the-as string (if (string= (the-as string (-> sv-20 data (+ s5-1 5))) "") + #f + (-> sv-20 data (+ s5-1 5)) + ) + ) + ) + (let* ((v1-75 (-> obj length)) + (a0-54 0) + (a1-17 (-> obj data a0-54)) + ) + (while (< a0-54 v1-75) + (if (and a1-17 (-> a1-17 region) (= (-> a1-17 region id) (-> sv-36 id))) + (set! (-> obj data a0-54) #f) + ) + (+! a0-54 1) + (set! a1-17 (-> obj data a0-54)) + ) + ) + (let ((s4-6 0)) + (while (< s4-6 (-> sv-32 len)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-32 data s4-6)))) + (let ((s3-5 (editable-array-method-11 obj))) + (when (>= s3-5 0) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 x) (string->float (the-as string (-> sv-32 data (+ s4-6 1))))) + (set! (-> s2-1 y) (string->float (the-as string (-> sv-32 data (+ s4-6 2))))) + (set! (-> s2-1 z) (string->float (the-as string (-> sv-32 data (+ s4-6 3))))) + (set! (-> s2-1 w) 1.0) + (vector+! s2-1 s2-1 (-> obj level-offset)) + (let ((s2-2 (new 'debug 'editable-sphere s2-1 2048.0 sv-36))) + (set! (-> s2-2 radius) (string->float (the-as string (-> sv-32 data (+ s4-6 4))))) + (set! (-> obj data s3-5) s2-2) + ) + ) + ) + ) + ) + (+! s4-6 5) + ) + ) + (set! sv-64 0) + (while (< sv-64 (-> sv-24 len)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-24 data sv-64)))) + (cond + ((string= (the-as string (-> sv-24 data (+ sv-64 2))) "plane") + (set! sv-72 (editable-array-method-11 obj)) + (set! sv-80 (new 'debug 'editable-plane sv-36)) + (set! sv-84 (-> sv-24 data (+ sv-64 1))) + (when (>= sv-72 0) + (set! (-> obj data sv-72) sv-80) + (set! (-> sv-80 radius) (string->float (the-as string (-> sv-24 data (+ sv-64 4))))) + (countdown (s4-7 (/ (-> sv-28 len) 5)) + (when (string= (the-as string (l.wu (+ (* 20 s4-7) (the-as int sv-28) 12))) (the-as string sv-84)) + (let ((s3-6 (new 'stack-no-clear 'vector))) + (set! (-> s3-6 x) (string->float (the-as string (-> sv-28 data (+ (* 5 s4-7) 2))))) + (set! (-> s3-6 y) (string->float (the-as string (-> sv-28 data (+ (* 5 s4-7) 3))))) + (set! (-> s3-6 z) (string->float (the-as string (-> sv-28 data (+ (* 5 s4-7) 4))))) + (set! (-> s3-6 w) 1.0) + (set! sv-112 s3-6) + ) + (vector+! sv-112 sv-112 (-> obj level-offset)) + (set! sv-120 (editable-array-method-11 obj)) + (when (>= sv-120 0) + (set! sv-128 (new 'debug 'editable-point sv-112 sv-36)) + (set! sv-136 (string->int (the-as string (-> sv-28 data (+ (* 5 s4-7) 1))))) + (set! (-> obj data sv-120) sv-128) + (set! (-> sv-80 vertex sv-136) sv-128) + (set! (-> sv-80 length) (max (-> sv-80 length) (+ sv-136 1))) + (set! (-> sv-128 owner) (cons sv-80 (-> sv-128 owner))) + ) + ) + ) + (editable-method-28 sv-80 (editable-filter load)) + (editable-method-29 sv-80 (editable-filter load)) + ) + ) + ((string= (the-as string (-> sv-24 data (+ sv-64 2))) "face") + (set! sv-144 (editable-array-method-11 obj)) + (set! sv-152 (new 'debug 'editable-face sv-36)) + (set! sv-156 (-> sv-24 data (+ sv-64 1))) + (when (>= sv-144 0) + (set! (-> obj data sv-144) sv-152) + (if (string= (the-as string (-> sv-24 data (+ sv-64 3))) "orient") + (logior! (-> sv-152 flags) (editable-flag orient)) + ) + (let ((s4-8 (/ (-> sv-28 len) 5))) + (while (begin (label cfg-78) (nonzero? s4-8)) + (+! s4-8 -1) + (when (string= (the-as string (l.wu (+ (* 20 s4-8) (the-as int sv-28) 12))) (the-as string sv-156)) + (let ((s3-7 (new 'stack-no-clear 'vector))) + (set! (-> s3-7 x) (string->float (the-as string (-> sv-28 data (+ (* 5 s4-8) 2))))) + (set! (-> s3-7 y) (string->float (the-as string (-> sv-28 data (+ (* 5 s4-8) 3))))) + (set! (-> s3-7 z) (string->float (the-as string (-> sv-28 data (+ (* 5 s4-8) 4))))) + (set! (-> s3-7 w) 1.0) + (set! sv-176 s3-7) + ) + (vector+! sv-176 sv-176 (-> obj level-offset)) + (let* ((s3-8 (-> obj length)) + (s2-3 0) + (s1-0 (-> obj data s2-3)) + ) + (while (< s2-3 s3-8) + (when (and s1-0 (= (-> s1-0 region) sv-36) (type? s1-0 editable-point)) + (when (vector= (-> (the-as editable-point s1-0) trans) sv-176) + (set! sv-180 s1-0) + (set! sv-184 (string->int (the-as string (-> sv-28 data (+ (* 5 s4-8) 1))))) + (set! (-> sv-152 vertex sv-184) (the-as editable-point sv-180)) + (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-184 1))) + (set! (-> sv-180 owner) (cons sv-152 (-> sv-180 owner))) + (goto cfg-78) + ) + ) + (+! s2-3 1) + (set! s1-0 (-> obj data s2-3)) + ) + ) + (if (< (-> sv-176 y) (the-as float (gpr->fpr sv-40))) + (set! sv-40 (-> sv-176 y)) + ) + (if (< (the-as float (gpr->fpr sv-44)) (-> sv-176 y)) + (set! sv-44 (-> sv-176 y)) + ) + (set! sv-192 (editable-array-method-11 obj)) + (when (>= sv-192 0) + (set! sv-200 (new 'debug 'editable-point sv-176 sv-36)) + (set! sv-208 (string->int (the-as string (-> sv-28 data (+ (* 5 s4-8) 1))))) + (set! (-> obj data sv-192) sv-200) + (set! (-> sv-152 vertex sv-208) sv-200) + (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-208 1))) + (set! (-> sv-200 owner) (cons sv-152 (-> sv-200 owner))) + ) + ) + ) + ) + (editable-method-28 sv-152 (editable-filter load)) + (editable-method-29 sv-152 (editable-filter load)) + ) + ) + ) + ) + (set! sv-64 (+ sv-64 5)) + ) + (let* ((v1-293 (-> obj length)) + (a0-158 0) + (a1-57 (-> obj data a0-158)) + ) + (while (< a0-158 v1-293) + (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) + (let ((a2-29 (-> (the-as editable-point a1-57) trans))) + (if (= (-> a2-29 y) (the-as float (gpr->fpr sv-40))) + (logior! (-> a1-57 flags) (editable-flag bot-set)) + ) + (if (= (-> a2-29 y) (the-as float (gpr->fpr sv-44))) + (logior! (-> a1-57 flags) (editable-flag top-set)) + ) + ) + ) + (+! a0-158 1) + (set! a1-57 (-> obj data a0-158)) + ) + ) + (set! (-> sv-36 changed) #f) + (+! s5-1 6) + ) + ) + (let ((s5-2 sql-query)) + (format + (clear *temp-string*) + "select x,y,z from sample_point where level_info_id='~D' and source='manual'" + (-> obj level-info-id) + ) + (set! sv-216 (s5-2 *temp-string*)) + ) + (if (!= (-> sv-216 error) 'select) + (return #f) + ) + (let ((s5-3 0)) + (while (< s5-3 (-> sv-216 len)) + (let ((s4-10 (editable-array-method-11 obj))) + (when (>= s4-10 0) + (let ((s3-9 (new 'stack-no-clear 'vector))) + (set! (-> s3-9 x) (* 4096.0 (string->float (the-as string (-> sv-216 data s5-3))))) + (set! (-> s3-9 y) (* 4096.0 (string->float (the-as string (-> sv-216 data (+ s5-3 1)))))) + (set! (-> s3-9 z) (* 4096.0 (string->float (the-as string (-> sv-216 data (+ s5-3 2)))))) + (set! (-> s3-9 w) 1.0) + (vector+! s3-9 s3-9 (-> obj level-offset)) + (set! (-> obj data s4-10) (new 'debug 'editable-sample s3-9 *editable-sample-region*)) + ) + ) + ) + (+! s5-3 3) + ) + ) + (set! (-> *editable-sample-region* changed) #f) + (let ((s5-4 sql-query)) + (format + (clear *temp-string*) + "select light_id,name,pos_x,pos_y,pos_z,r,dir_x,dir_y,dir_z,color0_r,color0_g,color0_b,color0_a,decay_start,ambient_point_ratio,brightness from light where level_name='~S'" + (-> obj level) + ) + (set! sv-240 (s5-4 *temp-string*)) + ) + (format #t "sql: read light ~D~%" (/ (-> sv-240 len) 16)) + (if (!= (-> sv-240 error) 'select) + (return #f) + ) + (let ((s5-5 0)) + (while (< s5-5 (-> sv-240 len)) + (let ((s3-10 (editable-array-method-11 obj))) + (when (>= s3-10 0) + (let ((s4-12 (new 'stack-no-clear 'vector))) + (set! (-> s4-12 x) (* 4096.0 (string->float (the-as string (-> sv-240 data (+ s5-5 2)))))) + (set! (-> s4-12 y) (* 4096.0 (string->float (the-as string (-> sv-240 data (+ s5-5 3)))))) + (set! (-> s4-12 z) (* 4096.0 (string->float (the-as string (-> sv-240 data (+ s5-5 4)))))) + (set! (-> s4-12 w) 1.0) + (vector+! s4-12 s4-12 (-> obj level-offset)) + (let ((s4-13 (new 'debug 'editable-light s4-12 2048.0 *editable-light-region*))) + (set! (-> obj data s3-10) s4-13) + (set! (-> s4-13 id) (the-as uint (string->int (the-as string (-> sv-240 data s5-5))))) + (set! (-> s4-13 name) (the-as string (-> sv-240 data (+ s5-5 1)))) + (set! (-> s4-13 radius) (* 4096.0 (string->float (the-as string (-> sv-240 data (+ s5-5 5)))))) + (set-vector! + (-> s4-13 direction) + (string->float (the-as string (-> sv-240 data (+ s5-5 6)))) + (string->float (the-as string (-> sv-240 data (+ s5-5 7)))) + (string->float (the-as string (-> sv-240 data (+ s5-5 8)))) + 1.0 + ) + (if (and (= (-> s4-13 direction x) 0.0) (= (-> s4-13 direction y) 0.0) (= (-> s4-13 direction z) 0.0)) + (set! (-> s4-13 direction w) 0.0) + ) + (set-vector! + (-> s4-13 color) + (string->float (the-as string (-> sv-240 data (+ s5-5 9)))) + (string->float (the-as string (-> sv-240 data (+ s5-5 10)))) + (string->float (the-as string (-> sv-240 data (+ s5-5 11)))) + (string->float (the-as string (-> sv-240 data (+ s5-5 12)))) + ) + (set! (-> s4-13 decay-start) (string->float (the-as string (-> sv-240 data (+ s5-5 13))))) + (set! (-> s4-13 ambient-point-ratio) (string->float (the-as string (-> sv-240 data (+ s5-5 14))))) + (set! (-> s4-13 brightness) (string->float (the-as string (-> sv-240 data (+ s5-5 15))))) + ) + ) + ) + ) + (+! s5-5 16) + ) + ) + (set! (-> *editable-light-region* changed) #f) + (editable-array-method-9 obj (editable-command refresh-filter) (the-as editable-array #f)) + #t + (none) + ) + +;; definition for method 13 of type editable-array +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-13 editable-array ((obj editable-array) (arg0 uint) (arg1 basic) (arg2 string)) + (set! (-> obj target) #f) + (set! (-> obj target-mode) arg0) + (set! (-> obj target-command) arg1) + (set! (-> obj target-message) arg2) + 0 + (none) + ) + +;; definition for method 16 of type editable-array +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-16 editable-array ((obj editable-array)) + (cond + ((-> obj edit-plane) + (editable-plane-method-31 (-> obj edit-plane) (-> obj edit-plane-normal)) + (set! (-> obj edit-plane-center quad) (-> (edit-get-trans (-> obj edit-plane vertex 0)) quad)) + ) + (else + (vector-negate! (-> obj edit-plane-normal) (-> *math-camera* inv-camera-rot vector 2)) + (let ((v1-9 (vector-float*! (-> obj edit-plane-center) (-> *math-camera* inv-camera-rot vector 2) 24576.0))) + (vector+! (the-as vector v1-9) (the-as vector v1-9) (-> *math-camera* trans)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 17 of type editable-array +;; INFO: Used lq/sq +(defmethod editable-array-method-17 editable-array ((obj editable-array) (arg0 vector) (arg1 vector)) + (cond + ((and (cpad-hold? 0 up) *target*) + (set! (-> arg0 quad) (-> (get-trans *target* 0) quad)) + ) + ((and (cpad-hold? 0 down) *camera*) + (set! (-> arg0 quad) (-> (math-camera-pos) quad)) + ) + (else + (editable-array-method-16 obj) + (reverse-transform-point! arg0 (-> obj edit-plane-center) (-> obj edit-plane-normal) arg1) + ) + ) + arg0 + ) + +;; failed to figure out what this is: +(when (zero? *editable-sample-region*) + (let ((v1-4 (new 'debug 'editable-region))) + (set! (-> v1-4 locked) #t) + (set! (-> v1-4 changed) #f) + (set! (-> v1-4 tree) (the-as string 'sample)) + (set! (-> v1-4 filter) (editable-filter sample)) + (set! *editable-sample-region* v1-4) + ) + (let ((v1-6 (new 'debug 'editable-region))) + (set! (-> v1-6 locked) #t) + (set! (-> v1-6 changed) #f) + (set! (-> v1-6 tree) (the-as string 'light)) + (set! (-> v1-6 filter) (editable-filter light)) + (set! *editable-light-region* v1-6) + ) + (let ((v0-84 (new 'debug 'editable-region))) + (set! (-> v0-84 locked) #t) + (set! (-> v0-84 changed) #f) + (set! (-> v0-84 tree) (the-as string 'entity)) + (set! (-> v0-84 filter) (editable-filter entity)) + (set! *editable-entity-region* v0-84) + ) + ) + +) diff --git a/test/decompiler/reference/jak2/engine/nav/nav-control-h_REF.gc b/test/decompiler/reference/jak2/engine/nav/nav-control-h_REF.gc index ad0fd3035c..0c57915d4e 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-control-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-control-h_REF.gc @@ -291,7 +291,7 @@ (:methods (nav-control-method-9 () none 9) (nav-control-method-10 () none 10) - (nav-control-method-11 () none 11) + (nav-control-method-11 (_type_ vector) vector 11) (nav-control-method-12 () none 12) (nav-control-method-13 () none 13) (nav-control-method-14 () none 14) @@ -300,7 +300,7 @@ (nav-control-method-17 () none 17) (nav-control-method-18 () none 18) (nav-control-method-19 () none 19) - (nav-control-method-20 () none 20) + (nav-control-method-20 (_type_ vector vector vector int symbol symbol) none 20) (nav-control-method-21 () none 21) (nav-control-method-22 () none 22) (nav-control-method-23 () none 23) @@ -399,7 +399,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak2/engine/physics/trajectory-h_REF.gc b/test/decompiler/reference/jak2/engine/physics/trajectory-h_REF.gc index d762274516..0deb829dca 100644 --- a/test/decompiler/reference/jak2/engine/physics/trajectory-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/trajectory-h_REF.gc @@ -56,7 +56,7 @@ (new (symbol type process-drawable int float collide-spec) _type_ 0) (initialize (_type_ process-drawable int float collide-spec) impact-control :behavior process 9) (update-from-cspace (_type_) none 10) - (impact-control-method-11 (_type_) none 11) + (impact-control-method-11 (_type_ collide-query process pat-surface) float 11) ) ) @@ -107,8 +107,8 @@ (:methods (new (symbol type vector vector) _type_ 0) (initialize (_type_ vector vector) point-tracker 9) - (point-tracker-method-10 () none 10) - (point-tracker-method-11 () none 11) + (point-tracker-method-10 (_type_ vector vector vector float) vector 10) + (point-tracker-method-11 (_type_ vector vector vector float) vector 11) ) ) @@ -146,8 +146,8 @@ :size-assert #x30 :flag-assert #xe00000030 (:methods - (combo-tracker-method-12 () none 12) - (combo-tracker-method-13 () none 13) + (combo-tracker-method-12 (_type_ vector vector process time-frame) combo-tracker 12) + (combo-tracker-method-13 (_type_ handle vector float vector float) none 13) ) ) @@ -242,11 +242,11 @@ :size-assert #x40 :flag-assert #xe00000040 (:methods - (cubic-curve-method-9 () none 9) - (cubic-curve-method-10 () none 10) - (cubic-curve-method-11 () none 11) - (cubic-curve-method-12 () none 12) - (cubic-curve-method-13 () none 13) + (cubic-curve-method-9 (_type_ vector vector vector vector) none 9) + (cubic-curve-method-10 (_type_ vector float) vector 10) + (cubic-curve-method-11 (_type_ vector float) vector 11) + (cubic-curve-method-12 (_type_ vector float) vector 12) + (debug-draw-curve (_type_) none 13) ) ) diff --git a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc new file mode 100644 index 0000000000..1630d3d41f --- /dev/null +++ b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc @@ -0,0 +1,569 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type trajectory +(defmethod compute-trans-at-time trajectory ((obj trajectory) (arg0 float) (arg1 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 arg1)) + (let ((a3-0 (-> obj initial-position)) + (t0-0 (-> obj initial-velocity)) + (f0-0 arg0) + ) + (.lvf vf2 (&-> t0-0 quad)) + (.lvf vf1 (&-> a3-0 quad)) + (let ((a3-1 f0-0)) + (.mov vf3 a3-1) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> v1-0 quad) vf4) + ) + (+! (-> arg1 y) (* 0.5 arg0 arg0 (-> obj gravity))) + arg1 + ) + ) + +;; definition for method 10 of type trajectory +;; INFO: Used lq/sq +(defmethod compute-transv-at-time trajectory ((obj trajectory) (arg0 float) (arg1 vector)) + (set! (-> arg1 quad) (-> obj initial-velocity quad)) + (+! (-> arg1 y) (* arg0 (-> obj gravity))) + arg1 + ) + +;; definition for method 11 of type trajectory +(defmethod compute-time-until-apex trajectory ((obj trajectory)) + (/ (- (-> obj initial-velocity y)) (-> obj gravity)) + ) + +;; definition for method 12 of type trajectory +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod setup-from-to-duration! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (set! (-> obj initial-position quad) (-> arg0 quad)) + (set! (-> obj gravity) arg3) + (set! (-> obj time) arg2) + (let ((f0-3 (/ (vector-vector-xz-distance arg1 arg0) arg2))) + (vector-! (-> obj initial-velocity) arg1 arg0) + (vector-xz-normalize! (-> obj initial-velocity) f0-3) + ) + (set! (-> obj initial-velocity y) (- (/ (- (-> arg1 y) (-> arg0 y)) arg2) (* 0.5 arg2 (-> obj gravity)))) + 0 + (none) + ) + +;; definition for method 13 of type trajectory +;; WARN: Return type mismatch int vs none. +(defmethod setup-from-to-xz-vel! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (let ((f0-1 (/ (vector-vector-xz-distance arg1 arg0) arg2))) + (setup-from-to-duration! obj arg0 arg1 f0-1 arg3) + ) + 0 + (none) + ) + +;; definition for method 14 of type trajectory +;; WARN: Return type mismatch int vs none. +(defmethod setup-from-to-y-vel! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (let* ((f0-0 arg2) + (f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3))) + (f0-3 900.0) + ) + (when (>= f1-3 0.0) + (let ((f0-4 (sqrtf f1-3))) + (set! f0-3 (fmax (/ (- (- arg2) f0-4) arg3) (/ (+ (- arg2) f0-4) arg3))) + ) + ) + (setup-from-to-duration! obj arg0 arg1 f0-3 arg3) + ) + 0 + (none) + ) + +;; definition for method 15 of type trajectory +;; WARN: Return type mismatch int vs none. +(defmethod setup-from-to-height! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (let* ((f0-1 (+ arg2 (fmax (-> arg0 y) (-> arg1 y)))) + (f1-4 (* 2.0 (- (-> arg0 y) f0-1) arg3)) + (f0-4 4096.0) + ) + (if (< 0.0 f1-4) + (set! f0-4 (sqrtf f1-4)) + ) + (setup-from-to-y-vel! obj arg0 arg1 f0-4 arg3) + ) + 0 + (none) + ) + +;; definition for method 16 of type trajectory +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 16 trajectory) has a return type of none, but the expression builder found a return statement. +(defmethod setup-from-to-duration-and-height! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) + (let ((f0-1 (- (-> arg1 y) (-> arg0 y)))) + (cond + ((= f0-1 0.0) + (let ((t9-0 (method-of-type trajectory setup-from-to-duration!)) + (v1-2 arg2) + (f0-3 (* -8.0 arg3)) + (f1-3 arg2) + ) + (t9-0 obj arg0 arg1 v1-2 (/ f0-3 (* f1-3 f1-3))) + ) + (return 0) + ) + ((and (< 0.0 f0-1) (< 0.0 arg3) (< arg3 f0-1)) + (set! arg3 f0-1) + ) + ((and (< f0-1 0.0) (< arg3 0.0) (< f0-1 arg3)) + (set! arg3 f0-1) + ) + ) + (let* ((f1-14 (/ (- arg3 f0-1) arg3)) + (f0-6 -2.0) + (f1-18 (/ (- 1.0 f1-14) (- arg2 (* arg2 (sqrtf f1-14))))) + (f0-8 (* f0-6 (* f1-18 f1-18) arg3)) + ) + (setup-from-to-duration! obj arg0 arg1 arg2 f0-8) + ) + ) + 0 + (none) + ) + +;; definition for method 17 of type trajectory +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw trajectory ((obj trajectory)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 10) + ) + (set! (-> s4-0 quad) (-> obj initial-position quad)) + (dotimes (s2-0 s3-0) + (set! (-> s5-0 quad) (-> s4-0 quad)) + (let ((f0-1 (* (-> obj time) (/ (+ 1.0 (the float s2-0)) (the float s3-0))))) + (compute-trans-at-time obj f0-1 s4-0) + ) + (add-debug-line #t (bucket-id bucket-318) s5-0 s4-0 (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1)) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type impact-control +;; INFO: Used lq/sq +(defmethod initialize impact-control ((obj impact-control) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 collide-spec)) + (set! (-> obj start-time) (-> self clock frame-counter)) + (set! (-> obj process) (the-as (pointer process-drawable) (process->ppointer arg0))) + (set! (-> obj joint) arg1) + (set! (-> obj radius) arg2) + (set! (-> obj collide-with) (logclear arg3 (collide-spec water))) + (set! (-> obj trans 0 quad) (the-as uint128 0)) + (set! (-> obj trans 1 quad) (the-as uint128 0)) + obj + ) + +;; definition for method 10 of type impact-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod update-from-cspace impact-control ((obj impact-control)) + (when (>= (-> obj joint) 0) + (set! (-> obj trans 1 quad) (-> obj trans 0 quad)) + (vector<-cspace! (the-as vector (-> obj trans)) (-> obj process 0 node-list data (-> obj joint))) + (vector-! (-> obj dir) (the-as vector (-> obj trans)) (-> obj trans 1)) + ) + 0 + (none) + ) + +;; definition for method 11 of type impact-control +;; INFO: Used lq/sq +(defmethod impact-control-method-11 impact-control ((obj impact-control) (arg0 collide-query) (arg1 process) (arg2 pat-surface)) + (set! (-> arg0 start-pos quad) (-> obj trans 1 quad)) + (set! (-> arg0 move-dist quad) (-> obj dir quad)) + (let ((v1-2 (ppointer->process (-> obj process))) + (a0-6 arg0) + ) + (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-process1) #f) + (set! (-> a0-6 ignore-pat) arg2) + (set! (-> a0-6 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* arg0))) + (when (and arg1 (>= f30-0 0.0) (>= 0.0 (vector-dot (-> arg0 best-other-tri normal) (-> obj dir)))) + (let* ((s3-0 (new 'stack-no-clear 'touching-shapes-entry)) + (s2-0 (-> arg0 best-other-tri collide-ptr)) + (v1-12 (if (type? s2-0 collide-shape-prim) + (the-as collide-shape-prim s2-0) + ) + ) + ) + (set! (-> s3-0 cshape1) #f) + (set! (-> s3-0 cshape2) (if v1-12 + (-> v1-12 cshape) + ) + ) + (set! (-> s3-0 resolve-u) (the int f30-0)) + (set! (-> s3-0 head) #f) + (send-event + arg1 + 'impact-control + :from (if v1-12 + (-> v1-12 cshape process) + arg1 + ) + #f + s3-0 + obj + arg0 + ) + ) + ) + f30-0 + ) + ) + +;; definition for method 9 of type point-tracker +;; INFO: Used lq/sq +(defmethod initialize point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector)) + (set! (-> obj trans 0 quad) (-> arg0 quad)) + (set! (-> obj trans 1 quad) (-> arg1 quad)) + obj + ) + +;; definition for method 10 of type point-tracker +;; INFO: Used lq/sq +(defmethod point-tracker-method-10 point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (cond + ((>= 0.0 arg3) + (set! (-> arg0 quad) (-> arg1 quad)) + ) + ((>= arg3 1.0) + (set! (-> arg0 quad) (-> arg2 quad)) + ) + (else + (let ((a1-1 arg0)) + (let ((v1-3 arg2) + (a0-6 (vector-! (new 'stack-no-clear 'vector) arg1 arg2)) + (f0-3 (- 1.0 arg3)) + ) + (.lvf vf2 (&-> a0-6 quad)) + (.lvf vf1 (&-> v1-3 quad)) + (let ((v1-4 f0-3)) + (.mov vf3 v1-4) + ) + ) + (.add.x.vf vf4 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf vf4 vf1 vf0 acc :mask #b111) + (.svf (&-> a1-1 quad) vf4) + (vector-lerp! arg0 a1-1 arg2 arg3) + ) + ) + ) + arg0 + ) + ) + +;; definition for method 11 of type point-tracker +(defmethod point-tracker-method-11 point-tracker ((obj point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) + (with-pp + (let ((v1-1 (point-tracker-method-10 obj (new 'stack-no-clear 'vector) arg1 arg2 arg3))) + (vector-! arg0 v1-1 arg1) + ) + (vector-float*! arg0 arg0 (-> pp clock frames-per-second)) + arg0 + ) + ) + +;; definition for method 13 of type combo-tracker +;; WARN: Return type mismatch basic vs none. +(defmethod combo-tracker-method-13 combo-tracker ((obj combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float)) + (cond + ((send-event (handle->process arg0) 'combo) + (let ((gp-1 (handle->process arg0))) + (if (type? gp-1 process-focusable) + (empty) + ) + ) + ) + (else + (let ((s1-0 (new 'stack-no-clear 'sphere)) + (s2-1 ((method-of-type array new) + (the-as symbol (new 'stack-no-clear 'array 'collide-shape 32)) + array + collide-shape + 32 + ) + ) + ) + (sphere<-vector+r! s1-0 arg1 arg2) + (let ((t9-4 (method-of-object *actor-hash* spatial-hash-method-36))) + (-> s2-1 data) + (-> s2-1 allocated-length) + (set! (-> s2-1 length) (the-as int (t9-4))) + ) + (let ((gp-2 (find-nearest-focusable + (the-as (array collide-shape) s2-1) + arg1 + arg2 + (if (= arg4 65536.0) + (search-info-flag crate enemy combo) + (search-info-flag crate enemy prefer-angle cull-angle combo) + ) + (search-info-flag) + arg3 + (the-as vector #f) + arg4 + ) + ) + ) + (if (type? gp-2 process-focusable) + (empty) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 12 of type combo-tracker +(defmethod combo-tracker-method-12 combo-tracker ((obj combo-tracker) (arg0 vector) (arg1 vector) (arg2 process) (arg3 time-frame)) + (initialize obj arg0 arg1) + (set! (-> obj target) (process->handle arg2)) + (set! (-> obj move-start-time) arg3) + obj + ) + +;; definition for method 11 of type combo-tracker +;; INFO: Used lq/sq +(defmethod point-tracker-method-11 combo-tracker ((obj combo-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) + (local-vars (at-0 int)) + (with-pp + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((v1-1 (point-tracker-method-10 obj (new 'stack-no-clear 'vector) arg1 arg2 arg3))) + (vector-! arg0 v1-1 arg1) + ) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'nav-control) + (let* ((s3-0 (send-event-function (handle->process (-> obj target)) a1-4)) + (s4-1 (if (type? s3-0 nav-control) + s3-0 + ) + ) + ) + (when s4-1 + (let ((a2-3 ((method-of-type nav-control nav-control-method-11) (the-as nav-control s4-1) arg1))) + (if a2-3 + ((method-of-type nav-control nav-control-method-20) (the-as nav-control s4-1) arg1 a2-3 arg0 #x45000000 #f #f) + (set! (-> arg0 quad) (the-as uint128 0)) + ) + ) + ) + ) + ) + (let ((v1-12 arg0)) + (.lvf vf1 (&-> arg0 quad)) + (let ((f0-0 (-> pp clock frames-per-second))) + (.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-12 quad) vf1) + ) + arg0 + ) + ) + ) + +;; definition for function traj2d-calc-initial-speed-using-tilt +(defun traj2d-calc-initial-speed-using-tilt ((arg0 traj2d-params)) + (let ((f0-4 (* (- (* (-> arg0 x) (tan (-> arg0 initial-tilt))) (-> arg0 y)) (/ 2.0 (-> arg0 gravity))))) + (cond + ((< 0.0 f0-4) + (set! (-> arg0 time) (sqrtf f0-4)) + (set! (-> arg0 initial-speed) (/ (-> arg0 x) (* (-> arg0 time) (cos (-> arg0 initial-tilt))))) + #t + ) + (else + (set! (-> arg0 time) 0.0) + (set! (-> arg0 initial-speed) 0.0) + #f + ) + ) + ) + ) + +;; definition for function traj3d-calc-initial-velocity-using-tilt +(defun traj3d-calc-initial-velocity-using-tilt ((arg0 traj3d-params)) + (vector-! (-> arg0 diff) (-> arg0 dest) (-> arg0 src)) + (let ((s5-0 (new 'stack-no-clear 'traj2d-params))) + (let ((v1-1 (-> arg0 diff))) + (set! (-> s5-0 x) (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) + ) + (set! (-> s5-0 y) (-> arg0 diff y)) + (set! (-> s5-0 gravity) (-> arg0 gravity)) + (set! (-> s5-0 initial-tilt) (-> arg0 initial-tilt)) + (cond + ((traj2d-calc-initial-speed-using-tilt s5-0) + (set! (-> arg0 time) (-> s5-0 time)) + (let* ((f26-0 (atan (-> arg0 diff x) (-> arg0 diff z))) + (f30-0 (-> arg0 initial-tilt)) + (f24-0 (cos f30-0)) + (f28-0 (-> s5-0 initial-speed)) + ) + (set! (-> arg0 initial-speed) f28-0) + (set! (-> arg0 initial-velocity x) (* f28-0 f24-0 (sin f26-0))) + (set! (-> arg0 initial-velocity z) (* f28-0 f24-0 (cos f26-0))) + (set! (-> arg0 initial-velocity y) (* f28-0 (sin f30-0))) + ) + (set! (-> arg0 initial-velocity w) 1.0) + #t + ) + (else + (set! (-> arg0 time) 0.0) + (set! (-> arg0 initial-speed) 0.0) + (vector-reset! (-> arg0 initial-velocity)) + #f + ) + ) + ) + ) + +;; definition for method 9 of type cubic-curve +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod cubic-curve-method-9 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (set! (-> obj mat vector 0 quad) (-> arg0 quad)) + (set! (-> obj mat vector 1 quad) (-> arg1 quad)) + (let ((v1-2 (new 'stack-no-clear 'trajectory))) + (vector-! (-> v1-2 initial-velocity) arg2 arg0) + (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) 3.0) + (let ((t1-7 (-> v1-2 initial-position))) + (let ((a1-3 (-> v1-2 initial-position))) + (let ((a3-2 arg1)) + (let ((t2-1 -2.0)) + (.mov vf7 t2-1) + ) + (.lvf vf5 (&-> a3-2 quad)) + ) + (.lvf vf4 (&-> a1-3 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 (&-> t1-7 quad) vf6) + ) + (vector-! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) + (set! (-> obj mat vector 2 quad) (-> v1-2 initial-position quad)) + (vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) -2.0) + (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1) + (vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3) + (set! (-> obj mat trans quad) (-> v1-2 initial-position quad)) + ) + (dotimes (v1-5 4) + (set! (-> obj mat vector v1-5 w) 0.0) + ) + 0 + (none) + ) + ) + +;; definition for method 10 of type cubic-curve +(defmethod cubic-curve-method-10 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) + (let ((v1-0 (new 'stack-no-clear 'trajectory))) + (let ((f0-1 (* arg1 arg1))) + (set-vector! (-> v1-0 initial-position) 1.0 arg1 f0-1 (* f0-1 arg1)) + ) + (vector-matrix*! arg0 (-> v1-0 initial-position) (-> obj mat)) + ) + (set! (-> arg0 w) 1.0) + arg0 + ) + +;; definition for method 11 of type cubic-curve +(defmethod cubic-curve-method-11 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) + (let ((v1-0 (new 'stack-no-clear 'trajectory))) + (set-vector! (-> v1-0 initial-position) 0.0 1.0 (* 2.0 arg1) (* 3.0 arg1 arg1)) + (vector-matrix*! arg0 (-> v1-0 initial-position) (-> obj mat)) + ) + (set! (-> arg0 w) 1.0) + arg0 + ) + +;; definition for method 12 of type cubic-curve +(defmethod cubic-curve-method-12 cubic-curve ((obj cubic-curve) (arg0 vector) (arg1 float)) + (let ((v1-0 (new 'stack-no-clear 'trajectory))) + (set-vector! (-> v1-0 initial-position) 0.0 0.0 2.0 (* 6.0 arg1)) + (vector-matrix*! arg0 (-> v1-0 initial-position) (-> obj mat)) + ) + (set! (-> arg0 w) 1.0) + arg0 + ) + +;; definition for method 13 of type cubic-curve +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw-curve cubic-curve ((obj cubic-curve)) + (let ((s5-0 (new 'stack-no-clear 'trajectory)) + (s4-0 10) + ) + (cubic-curve-method-10 obj (-> s5-0 initial-velocity) 0.0) + (add-debug-x #t (bucket-id bucket-318) (-> s5-0 initial-velocity) *color-red*) + (dotimes (s3-0 s4-0) + (set! (-> s5-0 initial-position quad) (-> s5-0 initial-velocity quad)) + (let ((f0-2 (/ (+ 1.0 (the float s3-0)) (the float s4-0)))) + (cubic-curve-method-10 obj (-> s5-0 initial-velocity) f0-2) + ) + (add-debug-x #t (bucket-id bucket-318) (-> s5-0 initial-velocity) *color-red*) + (add-debug-line + #t + (bucket-id bucket-318) + (-> s5-0 initial-position) + (-> s5-0 initial-velocity) + *color-red* + #f + (the-as rgba -1) + ) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc index 32715aa982..b3b849f85b 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-h_REF.gc @@ -442,7 +442,7 @@ (set! (-> v1-55 ignore-process1) #f) (set! (-> v1-55 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) (set! (-> v1-55 solid-only) #t) - (set! (-> v1-55 action-mask) (the-as uint 1)) + (set! (-> v1-55 action-mask) (collide-action solid)) ) ) (and (if (fill-and-probe-using-spheres *collide-cache* gp-0) 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 5cc6ebf81c..abd510d7aa 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -715,10 +715,10 @@ (set! (-> v1-48 ignore-process0) #f) (set! (-> v1-48 ignore-process1) #f) (set! (-> v1-48 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-48 action-mask) (the-as uint 1)) + (set! (-> v1-48 action-mask) (collide-action solid)) ) (cond - ((and (>= (collide-cache-method-16 *collide-cache*) 0.0) + ((and (>= (collide-cache-method-16 *collide-cache* gp-0) 0.0) (< 0.8 (vector-dot (-> gp-0 best-other-tri normal) (-> self control unknown-vector25))) ) ) @@ -1536,9 +1536,9 @@ (set! (-> v1-66 ignore-process0) #f) (set! (-> v1-66 ignore-process1) #f) (set! (-> v1-66 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-66 action-mask) (the-as uint 1)) + (set! (-> v1-66 action-mask) (collide-action solid)) ) - (let ((f30-0 (collide-cache-method-16 *collide-cache*))) + (let ((f30-0 (collide-cache-method-16 *collide-cache* gp-0))) (cond ((and (>= f30-0 0.0) (< 0.5 (-> gp-0 best-other-tri normal y))) (set! (-> s4-0 quad) (-> gp-0 best-other-tri normal quad)) @@ -2782,7 +2782,7 @@ (set! (-> a2-3 ignore-process1) #f) (set! (-> a2-3 ignore-pat) (-> v1-52 pat-ignore-mask)) ) - (set! (-> a2-3 action-mask) (the-as uint 1)) + (set! (-> a2-3 action-mask) (collide-action solid)) (collide-shape-method-32 (-> self control) (-> self control transv) (the-as uint a2-3) #x45800000) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) @@ -2918,7 +2918,7 @@ (set! (-> a2-0 ignore-process1) #f) (set! (-> a2-0 ignore-pat) (-> v1-30 pat-ignore-mask)) ) - (set! (-> a2-0 action-mask) (the-as uint 1)) + (set! (-> a2-0 action-mask) (collide-action solid)) (collide-shape-method-32 (-> self control) (-> self control transv) (the-as uint a2-0) #x45800000) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) @@ -3047,7 +3047,7 @@ (set! (-> a2-0 ignore-process1) #f) (set! (-> a2-0 ignore-pat) (-> v1-29 pat-ignore-mask)) ) - (set! (-> a2-0 action-mask) (the-as uint 1)) + (set! (-> a2-0 action-mask) (collide-action solid)) (collide-shape-method-32 (-> self control) (-> self control transv) (the-as uint a2-0) #x45800000) ) (if (and (logtest? (-> self control root-prim prim-core action) (collide-action check-edge)) diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index f8eabe3331..5041c619e5 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -109,6 +109,22 @@ "sparticle-motion-blur", // clipping "birth-func-texture-group", "(method 10 sparticle-launcher)", // very strange handling of ambiguous type + + // editable - remainder + "(method 27 editable-face)", + "(method 27 editable-plane)", + "(method 13 editable-face)", + "(method 13 editable-plane)", + "(method 29 editable-face)", + "(method 12 editable-array)", + "insert-box", + "dm-editable-light-float-func", + "dm-editable-boolean-toggle-pick-func", + + // debug + "add-debug-bound-internal", + "add-debug-bound", + // gun-util "draw-beam", "(method 9 gun-info)", // mood