From d26477917370a1fe2289dcec7fbda17d2abca04d Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 31 Aug 2022 19:22:47 -0400 Subject: [PATCH] d/jak2: finish `glist` | `glist-h` | `camera` | `cam-interface` | `cam-states-dbg` | `cam-combiner` | `cam-debug` | `cam-start` (#1829) * d/jak2: finish `glist` and `glist-h` partially done `time-of-day` * d/jak2: finish `camera` and `cam-interface` * d/jak2: partially finish `cam-master` `cam-states`, and `cam-update` finish `cam-states-dbg` `cam-combiner` `cam-debug` and `cam-start` * tests: update ref tests * scripts: add scripts to automatically update gsrc files * d/jak2: update gsrc --- Taskfile.yml | 8 +- decompiler/config/jak2/all-types.gc | 725 ++- decompiler/config/jak2/hacks.jsonc | 7 +- decompiler/config/jak2/label_types.jsonc | 6 + decompiler/config/jak2/stack_structures.jsonc | 120 +- decompiler/config/jak2/type_casts.jsonc | 377 +- decompiler/config/jak2/var_names.jsonc | 12 + decompiler/config/jak2_ntsc_v1.jsonc | 2 +- goal_src/jak2/engine/anim/joint-mod-h.gc | 19 +- goal_src/jak2/engine/anim/mspace-h.gc | 22 +- goal_src/jak2/engine/camera/cam-combiner.gc | 472 ++ goal_src/jak2/engine/camera/cam-debug-h.gc | 7 + goal_src/jak2/engine/camera/cam-debug.gc | 2132 +++++++ goal_src/jak2/engine/camera/cam-interface.gc | 113 + goal_src/jak2/engine/camera/cam-start.gc | 44 + goal_src/jak2/engine/camera/cam-states-dbg.gc | 484 ++ goal_src/jak2/engine/camera/cam-states.gc | 2217 +++++++ goal_src/jak2/engine/camera/cam-update-h.gc | 2 + goal_src/jak2/engine/camera/cam-update.gc | 492 ++ goal_src/jak2/engine/camera/camera-defs-h.gc | 21 + goal_src/jak2/engine/camera/camera-h.gc | 101 +- goal_src/jak2/engine/camera/camera.gc | 1987 ++++++ .../jak2/engine/collide/collide-cache-h.gc | 9 +- goal_src/jak2/engine/data/art-h.gc | 42 +- goal_src/jak2/engine/debug/debug-h.gc | 6 + goal_src/jak2/engine/entity/entity-h.gc | 3 + goal_src/jak2/engine/game/main-h.gc | 1 + goal_src/jak2/engine/geometry/cylinder.gc | 6 +- .../jak2/engine/gfx/mood/time-of-day-h.gc | 15 +- goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc | 5 + .../sprite/particles/sparticle-launcher-h.gc | 12 + goal_src/jak2/engine/gfx/texture/texture-h.gc | 4 + goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc | 4 + goal_src/jak2/engine/gfx/tie/tie-h.gc | 4 + goal_src/jak2/engine/level/bsp-h.gc | 5 +- goal_src/jak2/engine/level/level-h.gc | 538 +- .../process-drawable/process-focusable.gc | 21 +- goal_src/jak2/engine/util/glist-h.gc | 138 + goal_src/jak2/engine/util/glist.gc | 210 + scripts/gsrc/update-gsrc-via-refs.py | 40 + scripts/tasks/clean-decomp.py | 14 + .../reference/jak2/decompiler-macros.gc | 76 +- .../jak2/engine/anim/joint-mod-h_REF.gc | 8 +- .../reference/jak2/engine/anim/joint_REF.gc | 6 +- .../jak2/engine/camera/cam-combiner_REF.gc | 477 ++ .../jak2/engine/camera/cam-debug_REF.gc | 2124 +++++++ .../jak2/engine/camera/cam-interface_REF.gc | 125 + .../jak2/engine/camera/cam-start_REF.gc | 51 + .../jak2/engine/camera/cam-states-dbg_REF.gc | 532 ++ .../jak2/engine/camera/cam-states_REF.gc | 5575 +++++++++++++++++ .../jak2/engine/camera/cam-update_REF.gc | 1339 ++++ .../jak2/engine/camera/camera-h_REF.gc | 72 +- .../jak2/engine/camera/camera_REF.gc | 2086 ++++++ .../engine/collide/collide-cache-h_REF.gc | 6 +- .../jak2/engine/debug/default-menu_REF.gc | 66 +- .../jak2/engine/geometry/cylinder_REF.gc | 4 - .../jak2/engine/geometry/geometry_REF.gc | 85 +- .../jak2/engine/gfx/math-camera_REF.gc | 46 +- .../jak2/engine/gfx/mood/time-of-day-h_REF.gc | 4 +- .../engine/gfx/sprite/sprite-distort_REF.gc | 10 +- .../jak2/engine/gfx/sprite/sprite_REF.gc | 10 +- .../reference/jak2/engine/level/bsp-h_REF.gc | 5 +- .../jak2/engine/level/level-h_REF.gc | 144 +- .../jak2/engine/math/matrix-h_REF.gc | 6 +- .../reference/jak2/engine/math/matrix_REF.gc | 680 +- .../jak2/engine/math/quaternion_REF.gc | 78 +- .../jak2/engine/math/transform_REF.gc | 4 - .../jak2/engine/math/transformq_REF.gc | 10 +- .../process-drawable/process-focusable_REF.gc | 4 +- .../reference/jak2/engine/ui/text_REF.gc | 55 +- .../reference/jak2/engine/util/glist-h_REF.gc | 141 + .../reference/jak2/engine/util/glist_REF.gc | 210 + test/offline/config/jak2/config.jsonc | 35 +- 73 files changed, 22953 insertions(+), 1568 deletions(-) create mode 100644 scripts/gsrc/update-gsrc-via-refs.py create mode 100644 scripts/tasks/clean-decomp.py create mode 100644 test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/camera/cam-interface_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/camera/cam-start_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/camera/cam-update_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/camera/camera_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/util/glist-h_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/util/glist_REF.gc diff --git a/Taskfile.yml b/Taskfile.yml index b6d9644a43..68cd1eb159 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -88,9 +88,11 @@ tasks: - "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler \"./decompiler/config/{{.DECOMP_CONFIG}}\" \"./iso_data\" \"./decompiler_out\" --config-override '{\"allowed_objects\": [\"{{.FILE}}\"]}'" decomp-clean: cmds: - - rm ./decompiler_out/**/*.asm - - rm ./decompiler_out/**/*disasm.gc - update-gsrc: # TODO - make this use git to update all files changed in _REF + - python ./scripts/tasks/clean-decomp.py --game "{{.GAME}}" + update-gsrc: + cmds: + - python ./scripts/gsrc/update-gsrc-via-refs.py --game "{{.GAME}}" --decompiler "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler" --decompiler_config {{.DECOMP_CONFIG}} + update-gsrc-file: cmds: - task: decomp-file - python ./scripts/gsrc/update-from-decomp.py --game "{{.GAME}}" --file {{.FILE}} diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index e874b0140e..8c1a1c2172 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -1390,7 +1390,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype matrix (structure) - ((data float 16 :offset-assert 0) + ((data float 16 :offset-assert 0 :score -1) (vector vector 4 :inline :offset 0) (quad uint128 4 :offset 0) (trans vector :inline :offset 48) @@ -5712,7 +5712,7 @@ (meta-inside? symbol :offset-assert 408) (force-inside? symbol :offset-assert 412) (mood-context mood-context :inline :offset-assert 416) - (mood-func basic :offset-assert 2384) + (mood-func (function mood-context float int none) :offset-assert 2384) (mood-init (function mood-context none) :offset-assert 2388) (vis-bits pointer :offset-assert 2392) (all-visible? symbol :offset-assert 2396) @@ -7129,6 +7129,7 @@ ) ) +;; TODO - a duplicate...but in camera-slave it seems to only be 32 bits....? (defenum cam-slave-options :type uint64 :bitfield #t @@ -7155,8 +7156,7 @@ (RAPID_TRACKING) (EASE_SPLINE_IDX) (VERTICAL_FOLLOW_MATCHES_CAMERA) - (HAVE_BUTT_HANDLE) - ) + (HAVE_BUTT_HANDLE)) (defenum cam-master-options :type uint64 @@ -7186,7 +7186,7 @@ (gun-max-height meters) (gun-min-height meters) (string-local-down vector :inline) - (slave-options cam-slave-options) + (slave-options cam-slave-options :offset-assert 112) (matrix-blend-max-angle degrees :offset-assert 120) (matrix-blend-max-partial float) (string-spline-max-move meters) @@ -7732,7 +7732,8 @@ (define-extern *col-rend* col-rend) (define-extern debug-actor? (function object symbol)) -(define-extern *time-of-day* (pointer process)) +(declare-type time-of-day-proc process) +(define-extern *time-of-day* (pointer time-of-day-proc)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mspace-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -9723,8 +9724,8 @@ :size-assert #x110 :flag-assert #xb00000110 (:methods - (palette-fade-controls-method-9 () none 9) ;; (reset! (_type_) symbol 9) - (palette-fade-controls-method-10 () none 10) ;; (set-fade! (_type_ int float float vector) object 10) + (reset! (_type_) none 9) + (set-fade! (_type_ int float float vector) object 10) ) ) @@ -14371,7 +14372,7 @@ ) (deftype try-to-look-at-info (basic) - ((who uint64 :offset-assert 8) ;; handle + ((who handle :offset-assert 8) ;; handle (horz float :offset-assert 16) (vert float :offset-assert 20) ) @@ -15741,7 +15742,7 @@ (get-transv (_type_) vector 22) (process-focusable-method-23 (_type_) none 23) (process-focusable-method-24 (_type_) none 24) - (process-focusable-method-25 (_type_) none 25) + (process-focusable-method-25 (_type_) int 25) (process-focusable-method-26 (_type_) none 26) ) ) @@ -16478,12 +16479,14 @@ (cameras (array entity-camera) :offset-assert 116) (nodes (inline-array bsp-node) :offset 120) (level level :offset-assert 124) - ; (current-leaf-idx uint16 :offset-assert 128) + (current-leaf-idx uint16 :offset-assert 128) (unk-data-2 uint16 9 :offset 130) ; (boxes box8s-array :offset-assert 148) ; (current-bsp-back-flags uint32 :offset-assert 152) - (unk-byte uint8 :offset 152) + (unk-byte1 uint8 :offset 152) + (unk-byte2 uint8 :offset 153) + (unk-half-word uint16 :offset-assert 154) (ambients symbol :offset-assert 156) ;; now just #t? (unk-data-4 float :offset 160) (unk-data-5 float :offset-assert 164) @@ -16498,6 +16501,7 @@ ;; 200 is some array ;; 204 is maybe that array's length ;; 216 is a vector array + ;; (vec-array (pointer vector) :offset 216) ; TODO see - `update-visible` hits assertion (region-tree drawable-tree-region-prim :offset 252) @@ -16621,7 +16625,7 @@ :flag-assert #x1a00008670 (:methods (collide-cache-method-9 () none 9) ;; (debug-draw (_type_) none 9) - (collide-cache-method-10 () none 10) ;; (fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result pat-surface) float 10) + (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) (collide-cache-method-11 () none 11) ;; (fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol 11) (collide-cache-method-12 () 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) @@ -18568,8 +18572,8 @@ :size-assert #x30 :flag-assert #xb00000030 (:methods - (cam-index-method-9 () none 9) ;; (dummy-9 (_type_ symbol entity vector curve) symbol 9) - (cam-index-method-10 () none 10) ;; (dummy-10 (_type_ vector) float 10) + (cam-index-method-9 (_type_ symbol entity vector curve) symbol 9) + (cam-index-method-10 (_type_ vector) float 10) ) ) @@ -18614,21 +18618,21 @@ :size-assert #x664 :flag-assert #x1800000664 (:methods - (tracking-spline-method-9 () none 9) ;; (TODO-RENAME-9 (_type_) none 9) - (tracking-spline-method-10 () none 10) ;; (TODO-RENAME-10 (_type_ vector) none 10) - (tracking-spline-method-11 () none 11) ;; (print-nth-point (_type_ int) none 11) - (tracking-spline-method-12 () none 12) ;; (TODO-RENAME-12 (_type_) none 12) - (tracking-spline-method-13 () none 13) ;; (TODO-RENAME-13 (_type_ int) none 13) - (tracking-spline-method-14 () none 14) ;; (TODO-RENAME-14 (_type_ tracking-spline-sampler) none 14) - (tracking-spline-method-15 () none 15) ;; (TODO-RENAME-15 (_type_) none 15) - (tracking-spline-method-16 () none 16) ;; (TODO-RENAME-16 (_type_ float) none 16) - (tracking-spline-method-17 () none 17) ;; (TODO-RENAME-17 (_type_ vector float float symbol) int 17) - (tracking-spline-method-18 () none 18) ;; (TODO-RENAME-18 (_type_ float vector tracking-spline-sampler) vector 18) - (tracking-spline-method-19 () none 19) ;; (TODO-RENAME-19 (_type_ float vector tracking-spline-sampler) vector 19) - (tracking-spline-method-20 () none 20) ;; (TODO-RENAME-20 (_type_ vector int) none 20) - (tracking-spline-method-21 () none 21) ;; (TODO-RENAME-21 (_type_ vector float float) vector 21) - (tracking-spline-method-22 () none 22) ;; (TODO-RENAME-22 (_type_ float) none 22) - (tracking-spline-method-23 () none 23) ;; (TODO-RENAME-23 (_type_) none 23) + (tracking-spline-method-9 (_type_) none 9) + (tracking-spline-method-10 (_type_ vector) none 10) + (debug-point-info (_type_ int) none 11) + (debug-all-points (_type_) none 12) + (tracking-spline-method-13 (_type_ int) none 13) + (tracking-spline-method-14 (_type_ tracking-spline-sampler) none 14) + (tracking-spline-method-15 (_type_) none 15) + (tracking-spline-method-16 (_type_ float) none 16) + (tracking-spline-method-17 (_type_ vector float float symbol) int 17) + (tracking-spline-method-18 (_type_ float vector tracking-spline-sampler) vector 18) + (tracking-spline-method-19 (_type_ float vector tracking-spline-sampler) vector 19) + (tracking-spline-method-20 (_type_ vector int) none 20) + (tracking-spline-method-21 (_type_ vector float float float) vector 21) + (tracking-spline-method-22 (_type_ float) none 22) + (debug-draw-spline (_type_) none 23) ) ) @@ -18689,8 +18693,8 @@ ) (deftype camera-combiner (process) - ((trans vector :inline :offset-assert 128) - (inv-camera-rot matrix :inline :offset-assert 144) + ((trans vector :inline :offset-assert 128 :score 999) + (inv-camera-rot matrix :inline :offset-assert 144 :score 999) (fov float :offset-assert 208) (interp-val float :offset-assert 212) (interp-step float :offset-assert 216) @@ -18708,23 +18712,16 @@ :flag-assert #xe01b0022c ) -(defenum camera-slave-options - :type uint32 - :bitfield #t - (butt-cam) - (same-side) - (move-spherical) - (allow-z-rot) - (pitch-for-jump) - (collide) - (find-hidden-target) - (drag) - (line-of-sight) - (no-rotate) - (sticky-angle)) +;; +++camera-h:camera-blend-to-type +(defenum camera-blend-to-type + :type uint64 + (unknown-0 0) + (unknown-1 1) + (unknown-2 2)) +;; ---camera-h:camera-blend-to-type (deftype camera-slave (process) - ((trans vector :inline :offset-assert 128) + ((trans vector :inline :offset-assert 128 :score 999) (fov float :offset-assert 144) (fov0 float :offset-assert 148) (fov1 float :offset-assert 152) @@ -18743,7 +18740,7 @@ (circular-follow vector :inline :offset-assert 2256) (max-angle-offset float :offset-assert 2272) (max-angle-curr float :offset-assert 2276) - (options camera-slave-options :offset-assert 2280) + (options uint32 :offset-assert 2280) ;; TODO - this is likely a cam-slave-options but the size is wrong? (cam-entity entity :offset-assert 2284) ;; guessed by decompiler (butt-timer uint64 :offset-assert 2288) (butt-seek basic :offset-assert 2296) @@ -18770,7 +18767,7 @@ (spline-follow-dist float :offset-assert 2596) (enter-has-run symbol :offset-assert 2600) ;; guessed by decompiler (blend-from-type uint64 :offset-assert 2608) - (blend-to-type uint64 :offset-assert 2616) + (blend-to-type camera-blend-to-type :offset-assert 2616) (have-phony-joystick basic :offset-assert 2624) (phony-joystick-x float :offset-assert 2628) (phony-joystick-y float :offset-assert 2632) @@ -18783,13 +18780,33 @@ :method-count-assert 14 :size-assert #xa94 :flag-assert #xe0a200a94 - ) + (:states + cam-really-fixed + cam-fixed + cam-fixed-read-entity + cam-pov + cam-pov180 + cam-pov-track + cam-standoff + cam-standoff-read-entity + cam-eye + cam-spline + cam-decel + cam-endlessfall + cam-circular + cam-lookat + cam-string + cam-stick + cam-bike + cam-robotboss ;; TODO - state docstrings "A holdout from jak 1?" + cam-point-watch + cam-free-floating)) (deftype camera-master (process) ((master-options uint32 :offset-assert 128) (settings cam-setting-data :offset-assert 132) (slave (pointer camera-slave) :offset-assert 136) ;; guessed by decompiler - (decel uint32 :offset-assert 140) + (decel (pointer camera-slave) :offset-assert 140) ;; a total guess that is probably wrong! (slave-options uint32 :offset-assert 144) (view-off-param-save float :offset-assert 148) (changer uint32 :offset-assert 152) @@ -18830,9 +18847,9 @@ :size-assert #x924 :flag-assert #x1108b00924 (:methods - (camera-master-method-14 () none 14) - (camera-master-method-15 () none 15) - (camera-master-method-16 () none 16) + (camera-master-method-14 (_type_ vector) vector 14) + (camera-master-method-15 (_type_ vector) vector 15) + (camera-master-method-16 (_type_ symbol) none 16) ) ) @@ -21032,7 +21049,7 @@ ;; (define-extern ray-plane-intersect function) ;; (function vector vector vector vector vector vector vector float) ;; (define-extern ray-triangle-intersect function) ;; (function vector vector float matrix vector vector float) ;; (define-extern collide-do-primitives function) ;; (function float) -;; (define-extern moving-sphere-triangle-intersect function) ;; (function vector vector float collide-cache-tri vector vector float) +(define-extern moving-sphere-triangle-intersect (function vector vector float collide-cache-tri vector vector float)) ;; ;; (define-extern moving-sphere-sphere-intersect function) ;; (function vector vector vector vector float) ;; (define-extern moving-sphere-moving-sphere-intersect function) ;; (function vector vector vector vector vector float) @@ -21092,7 +21109,7 @@ ;; (define-extern real-joint-mod-gun-look-at-handler function) ;; (define-extern joint-mod-gun-look-at-handler function) ;; (define-extern joint-mod-foot-rot-handler function) -;; (define-extern last-try-to-look-at-data object) ;; try-to-look-at-info +(define-extern last-try-to-look-at-data try-to-look-at-info) ;; (define-extern joint-mod-look-at-handler function) ;; (function cspace transformq none) ;; (define-extern joint-mod-polar-look-at-guts function) ;; (define-extern joint-mod-polar-look-at-handler function) @@ -21153,7 +21170,7 @@ ;; (define-extern mem-usage-bsp-tree function) ;; (function bsp-header bsp-node memory-usage-block int none) ;; (define-extern *test-shrub* object) ;; int -;; (define-extern bsp-camera-asm function) ;; (function bsp-header vector none) +(define-extern bsp-camera-asm (function bsp-header vector none)) ;; (define-extern print-collide-stats (function none)) ;; (define-extern level-remap-texture function) ;; (function texture-id texture-id) (define-extern build-masks (function bsp-header none)) @@ -21522,14 +21539,14 @@ ) |# -;; (define-extern transform-float-point function) ;; (function vector vector4w vector4w) +(define-extern transform-float-point (function vector vector4w vector4w)) ;; (define-extern add-debug-point function) ;; (function symbol bucket-id vector symbol) ;; (define-extern debug-line-clip? function) ;; (define-extern internal-draw-debug-line function) ;; (function bucket-id vector vector rgba symbol rgba pointer) ;; (define-extern internal-draw-debug-text-3d function) ;; (function bucket-id string vector font-color vector2h pointer) ;; (define-extern add-debug-outline-triangle function) ;; (function symbol bucket-id vector vector vector rgba symbol) ;; (define-extern add-debug-triangle-normal function) ;; (function symbol bucket-id vector vector vector rgba symbol) -;; (define-extern add-debug-flat-triangle function) ;; (function symbol bucket-id vector vector vector rgba symbol) +(define-extern add-debug-flat-triangle (function symbol bucket-id vector vector vector rgba symbol)) ;; ;; (define-extern *debug-lines* object) ;; (inline-array debug-line) ;; (define-extern *debug-lines-trk* object) ;; debug-tracking-thang ;; (define-extern *debug-text-3ds* object) ;; (inline-array debug-text-3d) @@ -22260,7 +22277,7 @@ ;; (define-extern cloud-texture-anim-layer-func function) ;; (define-extern cloud-texture-anim-func function) ;; (define-extern fog-texture-anim-init function) -;; (define-extern *fog-texture-work* object) +(define-extern *fog-texture-work* fog-texture-work) ;; (define-extern real-fog-texture-anim-func function) ;; (define-extern fog-texture-anim-func function) @@ -22269,8 +22286,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern *sky-texture-anim-array* texture-anim-array) -;; (define-extern set-fog-height! function) -;; (define-extern set-cloud-minmax! function) +(define-extern set-fog-height! (function float none)) +(define-extern set-cloud-minmax! (function float float none)) (define-extern *darkjak-texture-anim-array* texture-anim-array) ;; (define-extern set-darkjak-texture-morph! function) (define-extern *skull-gem-texture-anim-array* texture-anim-array) @@ -22378,7 +22395,7 @@ ;; (define-extern mem-usage-shrub-walk function) ;; (function draw-node int memory-usage-block int draw-node) ;; (define-extern shrub-vu1-block object) ;; vu-function ;; (define-extern shrub-num-tris function) ;; (function shrubbery uint) -;; (define-extern shrub-make-perspective-matrix function) ;; (function matrix matrix) +(define-extern shrub-make-perspective-matrix (function matrix matrix)) ;; ;; (define-extern shrub-init-view-data function) ;; (function shrub-view-data symbol) ;; (define-extern shrub-upload-view-data function) ;; (function dma-buffer symbol) ;; (define-extern shrub-time function) ;; (function int int int int int int) @@ -22398,7 +22415,7 @@ ;; shrub-work ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *instance-shrub-work* object) ;; instance-shrub-work +(define-extern *instance-shrub-work* instance-shrub-work) ;; ;; (define-extern upload-generic-shrub function) ;; (function dma-buffer generic-shrub-fragment int int dma-buffer) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -22461,7 +22478,7 @@ ;; tfrag-work ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *tfrag-work* object) ;; tfrag-work +(define-extern *tfrag-work* tfrag-work) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; tie ;; @@ -22663,7 +22680,7 @@ ;; tie-work ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *instance-tie-work* object) ;; instance-tie-work +(define-extern *instance-tie-work* instance-tie-work) ;; ;; (define-extern *prototype-tie-work* object) ;; prototype-tie-work ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -22817,7 +22834,7 @@ |# (define-extern *part-id-table* (array sparticle-launcher)) -;; (define-extern *part-group-id-table* object) ;; (array sparticle-launch-group) +(define-extern *part-group-id-table* (array sparticle-launch-group)) ;; ;; (define-extern *sp-temp* object) ;; (define-extern lookup-part-group-by-name function) ;; (function string basic) ;; (define-extern lookup-part-group-pointer-by-name function) ;; (function string (pointer sparticle-launch-group)) @@ -24158,36 +24175,36 @@ ;; weather-part ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern group-rain-screend-drop object) ;; sparticle-launch-group -;; (define-extern update-snow function) ;; (function target none) +(define-extern group-rain-screend-drop sparticle-launch-group) ;; +(define-extern update-snow (function target none)) ;; (define-extern birth-func-omega-normal-orient function) ;; (define-extern birth-func-rain function) ;; (define-extern check-drop-level-rain function) ;; (function sparticle-system sparticle-cpuinfo vector none) ;; (define-extern check-drop-level-rain2 function) ;; (define-extern check-drop-level-splash function) -;; (define-extern update-rain function) ;; (function target none) -;; (define-extern cam-master-effect function) ;; (function none :behavior camera-master) +(define-extern update-rain (function target none)) +(define-extern cam-master-effect (function none :behavior camera-master)) ;; ;; (define-extern sparticle-track-sun function) ;; (function int sparticle-cpuinfo matrix none) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; time-of-day ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern time-of-day-effect object) ;; (function none) -;; (define-extern time-of-day-update function) ;; (function none :behavior time-of-day-proc) -;; (define-extern update-counters function) -;; (define-extern time-of-day-tick state) ;; (state time-of-day-proc) -;; (define-extern init-time-of-day function) ;; (function none :behavior time-of-day-proc) -;; (define-extern start-time-of-day function) ;; (function none) +(define-extern time-of-day-effect (function none)) +(define-extern time-of-day-update (function none :behavior time-of-day-proc)) +(define-extern update-counters (function float :behavior time-of-day-proc)) +(define-extern time-of-day-tick (state time-of-day-proc)) +(define-extern init-time-of-day (function object :behavior time-of-day-proc)) ;; +(define-extern start-time-of-day (function (pointer process))) (define-extern time-of-day-setup (function symbol symbol)) ;; (define-extern time-of-day-interp-colors function) ;; (function (pointer rgba) uint mood-context none) ;; (define-extern time-of-day-interp-colors-scratch function) ;; (function (pointer rgba) time-of-day-palette mood-context none) -(define-extern init-time-of-day-context (function time-of-day-context none)) +(define-extern init-time-of-day-context (function time-of-day-context symbol)) (define-extern set-filter-color! (function float float int none)) -;; (define-extern tod-madd! function) -;; (define-extern update-environment-colors function) -(define-extern update-time-of-day (function time-of-day-context none)) -;; (define-extern calc-fade-from-fog function) +(define-extern tod-madd! (function vector vector vector float)) +(define-extern update-environment-colors (function time-of-day-context vector)) +;; (define-extern update-time-of-day (function time-of-day-context none)) +(define-extern calc-fade-from-fog (function vector float)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sky-data ;; @@ -24915,51 +24932,64 @@ ;; camera ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *cam-res-string* object) ;; string -;; (define-extern cam-slave-get-vector-with-offset function) ;; (function entity-actor vector symbol symbol) -;; (define-extern cam-slave-get-flags function) ;; (function entity symbol uint128) -;; (define-extern cam-slave-get-float function) ;; (function entity symbol float float) -;; (define-extern cam-slave-get-fov function) ;; (function entity float) -;; (define-extern cam-slave-get-intro-step function) ;; (function entity float) -;; (define-extern cam-slave-get-interp-time function) ;; (function entity float) -;; (define-extern cam-slave-get-rot function) ;; (function entity-actor matrix matrix) -;; (define-extern cam-state-from-entity function) ;; (function entity state) -;; (define-extern parameter-ease-none function) ;; (function object object) -;; (define-extern parameter-ease-clamp function) ;; (function float float) -;; (define-extern parameter-ease-lerp-clamp function) ;; (function float float) -;; (define-extern parameter-ease-sqrt-clamp function) ;; (function float float) -;; (define-extern fourth-power function) ;; (function float float) -;; (define-extern third-power function) ;; (function float float) -;; (define-extern parameter-ease-sqr-clamp function) ;; (function float float) -;; (define-extern parameter-ease-cube-clamp function) -;; (define-extern parameter-ease-sin-clamp function) ;; (function float float) -;; (define-extern cam-slave-init-vars function) ;; (function none :behavior camera-slave) -;; (define-extern cam-slave-go function) ;; (function state none) -;; (define-extern cam-slave-init function) ;; (function state entity none :behavior camera-slave) -;; (define-extern cam-standard-event-handler function) ;; (function process int symbol event-message-block object :behavior camera-slave) -;; (define-extern cam-curve-pos function) ;; (function vector vector curve symbol vector :behavior camera-slave) -;; (define-extern cam-curve-setup function) ;; (function vector none :behavior camera-slave) -;; (define-extern cam-calc-follow! function) ;; (function cam-rotation-tracker vector symbol vector) -;; (define-extern mat-remove-z-rot function) ;; (function matrix vector matrix) -;; (define-extern slave-matrix-blend-2 function) ;; (function matrix float vector matrix matrix) -;; (define-extern vector-into-frustum-nosmooth! function) ;; (function matrix vector float vector) -;; (define-extern slave-set-rotation! function) ;; (function cam-rotation-tracker vector float float symbol none) -;; (define-extern v-slrp2! function) ;; (function vector vector vector float vector float vector) -;; (define-extern v-slrp3! function) ;; (function vector vector vector vector float vector) +(define-extern *cam-res-string* string) +(define-extern cam-slave-get-vector-with-offset (function entity-actor vector symbol symbol)) +(define-extern cam-slave-get-flags (function entity symbol uint)) ;; TODO - probably a `cam-slaves-options` but the wrong size! +(define-extern cam-slave-get-float (function entity symbol float float)) +(define-extern cam-slave-get-fov (function entity float)) +(define-extern cam-slave-get-intro-step (function entity float)) +(define-extern cam-slave-get-interp-time (function entity float)) +(define-extern cam-slave-get-rot (function entity-actor matrix matrix)) +(define-extern cam-state-from-entity (function entity (state camera-slave))) +(define-extern parameter-ease-none (function object object)) +(define-extern parameter-ease-clamp (function float float)) +(define-extern parameter-ease-lerp-clamp (function float float)) +(define-extern parameter-ease-sqrt-clamp (function float float)) +(define-extern fourth-power (function float float)) +(define-extern third-power (function float float)) +(define-extern parameter-ease-sqr-clamp (function float float)) +(define-extern parameter-ease-cube-clamp (function float float)) +(define-extern parameter-ease-sin-clamp (function float float)) +(define-extern cam-slave-init-vars (function none :behavior camera-slave)) +(define-extern cam-slave-go (function (state camera-slave) none :behavior camera-slave)) +(define-extern cam-slave-init (function (state camera-slave) entity none :behavior camera-slave)) +(define-extern cam-standard-event-handler (function process int symbol event-message-block none :behavior camera-slave)) +(define-extern cam-curve-pos (function vector vector curve symbol vector :behavior camera-slave)) +(define-extern cam-curve-setup (function vector none :behavior camera-slave)) +(define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector)) +(define-extern mat-remove-z-rot (function matrix vector matrix)) +(define-extern slave-matrix-blend-2 (function matrix float vector matrix matrix)) +(define-extern vector-into-frustum-nosmooth! (function matrix vector float vector)) +(define-extern slave-set-rotation! (function cam-rotation-tracker vector float float symbol none)) +(define-extern v-slrp2! (function vector vector vector float vector float vector)) +(define-extern v-slrp3! (function vector vector vector vector float vector)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-interface ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define-extern position-in-front-of-camera! (function vector float float vector)) -;; (define-extern position-in-front-of-screen! function) -;; (define-extern matrix-local->world function) ;; (function symbol symbol matrix) -;; (define-extern matrix-world->local function) ;; (function matrix) -;; (define-extern *camera-dummy-vector* object) ;; vector -(define-extern camera-pos (function vector)) -(define-extern math-camera-pos (function vector)) -;; (define-extern camera-matrix function) -;; (define-extern math-camera-matrix function) +(define-extern position-in-front-of-camera! (function vector float float vector)) +(define-extern position-in-front-of-screen! (function vector float vector vector)) +(define-extern matrix-local->world + "Returns [[*math-camera*]]'s `inv-camera-rot-smooth` if `smooth?` is true, else return `inv-camera-rot`" + (function symbol matrix)) +(define-extern matrix-world->local + "Returns [[*math-camera*]]'s `camera-rot`" + (function matrix)) +(define-extern *camera-dummy-vector* vector) +(define-extern camera-pos + "Returns the `trans` vector from whatever is first determined to exist: + - [[*camera-combiner*]] + - [[*math-camera*]] + - else, [[*camera-dummy-vector*]]" + (function vector)) +(define-extern math-camera-pos "Returns [[*math-camera*]]'s `trans`" (function vector)) +(define-extern camera-matrix + "If [[*camera-combiner*]] exists, return it's `inv-camera-rot`. Else, return [[*math-camera*]]'s" + (function matrix)) +(define-extern math-camera-matrix + "Returns [[*math-camera*]]'s `inv-camera-rot`" + (function matrix)) (define-extern camera-angle (function float)) (define-extern camera-teleport-to-entity (function entity-actor none :behavior process)) @@ -24967,193 +24997,151 @@ ;; cam-master ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern reset-follow function) ;; (function flocam-eyeat :behavior camera-master) -;; (define-extern reset-target-tracking function) ;; (function symbol :behavior camera-master) -;; (define-extern master-track-target function) ;; (function symbol :behavior camera-master) -;; (define-extern setup-slave-for-hopefull function) ;; (function camera-slave none) -;; (define-extern master-is-hopeful-better? function) ;; (function camera-slave camera-slave symbol :behavior camera-master) -;; (define-extern master-choose-entity function) +(define-extern reset-follow (function float :behavior camera-master)) +(define-extern reset-target-tracking (function symbol :behavior camera-master)) +(define-extern master-track-target (function symbol :behavior camera-master)) +(define-extern setup-slave-for-hopefull (function camera-slave none)) +(define-extern master-is-hopeful-better? (function camera-slave camera-slave symbol :behavior camera-master)) +(define-extern master-choose-entity (function cam-setting-data symbol :behavior camera-master)) (define-extern cam-master-set-entity (function cam-setting-data none)) (define-extern cam-master-activate-slave (function symbol none)) -;; (define-extern cam-master-active state) ;; (state camera-master) -;; (define-extern cam-master-init function) ;; (function none :behavior camera-master) +(define-extern cam-master-active (state camera-master)) +(define-extern cam-master-init (function none :behavior camera-master)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-states ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| -(deftype cam-eye-bank (UNKNOWN) - ((rot-speed float :offset-assert 4) - (max-degrees float :offset-assert 8) - (max-fov float :offset-assert 12) - (min-fov float :offset-assert 16) +(deftype cam-eye-bank (basic) + ((rot-speed float :offset-assert 4) + (max-degrees float :offset-assert 8) + (max-fov float :offset-assert 12) + (min-fov float :offset-assert 16) ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 ) -|# -#| -(deftype cam-string-bank (UNKNOWN) - ((los-coll-rad meters :offset-assert 4) - (los-coll-rad2 meters :offset-assert 8) - ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 +(deftype cam-string-bank (basic) + ((los-coll-rad meters :offset-assert 4) + (los-coll-rad2 meters :offset-assert 8)) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c ) -|# -#| -(deftype los-dist (UNKNOWN) - ((par-dist float :offset-assert 0) - (lat-dist float :offset-assert 4) - (vert-dist float :offset-assert 8) - ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ) -|# +(deftype los-dist (structure) + ((par-dist float :offset-assert 0) + (lat-dist float :offset-assert 4) + (vert-dist float :offset-assert 8)) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c) -#| -(deftype collide-los-dist-info (UNKNOWN) +(deftype collide-los-dist-info (structure) ((min-par float :offset-assert 0) (max-par float :offset-assert 4) (min-lat float :offset-assert 8) (max-lat float :offset-assert 12) - (min-vp float :offset-assert 16) - (max-vp float :offset-assert 20) - (min-vn float :offset-assert 24) - (max-vn float :offset-assert 28) - (count int32 :offset-assert 32) - ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + (min-vp float :offset-assert 16) + (max-vp float :offset-assert 20) + (min-vn float :offset-assert 24) + (max-vn float :offset-assert 28) + (count int32 :offset-assert 32)) + :method-count-assert 9 + :size-assert #x24 + :flag-assert #x900000024 ) -|# -#| -(deftype collide-los-result (UNKNOWN) - ((lateral vector :inline :offset-assert 0) - (cw collide-los-dist-info :inline :offset-assert 16) - (ccw collide-los-dist-info :inline :offset-assert 64) - (straddle collide-los-dist-info :inline :offset-assert 112) - (lateral-valid symbol :offset-assert 148) ;; guessed by decompiler - ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 +(deftype collide-los-result (structure) + ((lateral vector :inline :offset-assert 0) + (cw collide-los-dist-info :inline :offset-assert 16) + (ccw collide-los-dist-info :inline :offset-assert 64) + (straddle collide-los-dist-info :inline :offset-assert 112) + (lateral-valid symbol :offset-assert 148)) + :method-count-assert 9 + :size-assert #x98 + :flag-assert #x900000098 ) -|# -#| -(deftype cam-stick-bank (UNKNOWN) - ((max-z meters :offset-assert 4) - (min-z meters :offset-assert 8) - (max-y meters :offset-assert 12) - (min-y meters :offset-assert 16) - ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 +(deftype cam-stick-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16)) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 ) -|# -#| -(deftype cam-bike-bank (UNKNOWN) - ((min-z meters :offset-assert 4) - (max-z meters :offset-assert 8) - (min-y meters :offset-assert 12) - (max-y meters :offset-assert 16) - ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 +(deftype cam-bike-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16)) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 ) -|# -;; (define-extern cam-really-fixed state) -(define-extern cam-fixed (state camera-slave)) -;; (define-extern cam-fixed-read-entity state) ;; (state camera-slave) -(define-extern cam-pov (state camera-slave)) -(define-extern cam-pov180 (state camera-slave)) -(define-extern cam-pov-track (state camera-slave)) -;; (define-extern cam-standoff-calc-trans function) ;; (function vector :behavior camera-slave) -(define-extern cam-standoff (state camera-slave)) -;; (define-extern cam-standoff-read-entity state) ;; (state camera-slave) -;; (define-extern *CAM_EYE-bank* cam-eye-bank) ;; cam-eye-bank -(define-extern cam-eye (state camera-slave)) -(define-extern cam-spline (state camera-slave)) -(define-extern cam-decel (state camera-slave)) -(define-extern cam-endlessfall (state camera-slave)) -;; (define-extern cam-circular-position-into-max-angle function) ;; (function vector vector float vector :behavior camera-slave) -;; (define-extern cam-circular-position function) ;; (function symbol vector :behavior camera-slave) -;; (define-extern cam-circular-code function) ;; (function float :behavior camera-slave) -(define-extern cam-circular (state camera-slave)) -(define-extern cam-lookat (state camera-slave)) -;; (define-extern *CAM_STRING-bank* cam-string-bank) ;; cam-string-bank -;; (define-extern cam-string-find-position-rel! function) ;; (function vector symbol) -;; (define-extern cam-string-set-position-rel! function) ;; (function vector int :behavior camera-slave) -;; (define-extern string-push-help function) ;; (function float) -;; (define-extern cam-draw-collide-cache function) ;; (function collide-cache none) -;; (define-extern dist-info-init function) ;; (function collide-los-dist-info none) -;; (define-extern dist-info-valid? function) ;; (function collide-los-dist-info symbol) -;; (define-extern dist-info-append function) ;; (function collide-los-dist-info vector none) -;; (define-extern dist-info-print function) ;; (function collide-los-dist-info string object) -;; (define-extern los-cw-ccw function) ;; (function (inline-array collide-cache-tri) vector vector float clip-travel-vector-to-mesh-return-info vector float symbol) -;; (define-extern cam-los-spline-collide function) ;; (function vector vector pat-surface float) -;; (define-extern cam-los-setup-lateral function) ;; (function clip-travel-vector-to-mesh-return-info vector vector symbol :behavior camera-slave) -;; (define-extern cam-los-collide function) ;; (function vector vector clip-travel-vector-to-mesh-return-info pat-surface symbol :behavior camera-slave) -;; (define-extern cam-string-follow function) ;; (function object :behavior camera-slave) -;; (define-extern cam-string-line-of-sight function) ;; (function vector :behavior camera-slave) -;; (define-extern cam-dist-analog-input function) ;; (function int float float) -;; (define-extern cam-string-joystick function) ;; (function vector :behavior camera-slave) -;; (define-extern cam-string-find-hidden function) ;; (function none :behavior camera-slave) -;; (define-extern cam-string-move function) ;; (function object :behavior camera-slave) -;; (define-extern cam-string-code function) ;; (function vector :behavior camera-slave) -;; (define-extern set-string-params function) -(define-extern cam-string (state camera-slave)) -;; (define-extern *CAM_STICK-bank* cam-stick-bank) ;; cam-stick-bank -;; (define-extern cam-stick-code function) ;; (function none :behavior camera-slave) -(define-extern cam-stick (state camera-slave)) -;; (define-extern *CAM_BIKE-bank* cam-bike-bank) ;; cam-bike-bank -;; (define-extern cam-calc-bike-follow! function) ;; (function cam-rotation-tracker vector symbol vector :behavior camera-slave) -;; (define-extern cam-bike-code function) ;; (function none :behavior camera-slave) -(define-extern cam-bike (state camera-slave)) -(define-extern cam-robotboss "A holdout from jak 1?" (state camera-slave)) +(define-extern cam-standoff-calc-trans (function vector :behavior camera-slave)) +(define-extern *CAM_EYE-bank* cam-eye-bank) +(define-extern cam-circular-position-into-max-angle (function vector vector float vector :behavior camera-slave)) +;; (define-extern cam-circular-position (function symbol vector :behavior camera-slave)) ;; TODO - hang +(define-extern cam-circular-code (function float :behavior camera-slave)) +(define-extern *CAM_STRING-bank* cam-string-bank) ;; cam-string-bank +(define-extern cam-string-find-position-rel! (function vector symbol)) ;; +(define-extern cam-string-set-position-rel! (function vector cam-slave-options :behavior camera-slave)) +(define-extern string-push-help (function float)) ;; +(define-extern cam-draw-collide-cache (function collide-cache none)) ;; +(define-extern dist-info-init (function collide-los-dist-info none)) ;; +(define-extern dist-info-valid? (function collide-los-dist-info symbol)) ;; +(define-extern dist-info-append (function collide-los-dist-info vector none)) ;; +(define-extern dist-info-print (function collide-los-dist-info string object)) ;; +(define-extern los-cw-ccw (function (inline-array collide-cache-tri) vector vector float collide-los-result vector float symbol)) ;; +(define-extern cam-los-spline-collide (function vector vector pat-surface float)) ;; +(define-extern cam-los-setup-lateral (function collide-los-result vector vector symbol :behavior camera-slave)) ;; +(define-extern cam-los-collide (function vector vector collide-los-result pat-surface symbol :behavior camera-slave)) ;; +(define-extern cam-string-follow (function object :behavior camera-slave)) ;; +;; (define-extern cam-string-line-of-sight (function vector :behavior camera-slave)) ;; TODO - hang +(define-extern cam-dist-analog-input (function int float float)) ;; +(define-extern cam-string-joystick (function vector :behavior camera-slave)) ;; +(define-extern cam-string-find-hidden (function none :behavior camera-slave)) ;; +(define-extern cam-string-move (function object :behavior camera-slave)) ;; +(define-extern cam-string-code (function vector :behavior camera-slave)) ;; +(define-extern set-string-params (function vector :behavior camera-slave)) +(define-extern *CAM_STICK-bank* cam-stick-bank) ;; cam-stick-bank +;; (define-extern cam-stick-code (function none :behavior camera-slave)) ;; TODO - hang +(define-extern *CAM_BIKE-bank* cam-bike-bank) ;; cam-bike-bank +(define-extern cam-calc-bike-follow! (function cam-rotation-tracker vector symbol vector :behavior camera-slave)) ;; +;; (define-extern cam-bike-code (function none :behavior camera-slave)) ;; TODO - hang + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-states-dbg ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype cam-point-watch-bank (basic) ((speed float :offset-assert 4) - (rot-speed deg :offset-assert 8) ;; degrees + (rot-speed degrees :offset-assert 8) ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype cam-free-bank (basic) ((speed float :offset-assert 4) - (rot-speed deg :offset-assert 8) ;; degrees + (rot-speed degrees :offset-assert 8) ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype camera-free-floating-move-info (structure) ((rv vector :inline :offset-assert 0) (tv vector :inline :offset-assert 16) @@ -25164,41 +25152,38 @@ :size-assert #x70 :flag-assert #x900000070 ) -|# -;; (define-extern *CAM_POINT_WATCH-bank* cam-point-watch-bank) ;; cam-point-watch-bank -(define-extern cam-point-watch (state camera-slave)) -;; (define-extern *CAM_FREE-bank* cam-free-bank) ;; cam-free-bank -;; (define-extern cam-mouse-input function) -;; (define-extern cam-free-floating-input function) ;; (function vector vector symbol int vector) -;; (define-extern cam-free-floating-move function) ;; (function matrix vector vector int vector) -(define-extern cam-free-floating (state camera-slave)) +(define-extern *CAM_POINT_WATCH-bank* cam-point-watch-bank) +(define-extern *CAM_FREE-bank* cam-free-bank) +(define-extern cam-mouse-input (function vector vector float)) +(define-extern cam-free-floating-input (function vector vector symbol int vector)) +(define-extern cam-free-floating-move (function matrix vector vector int vector)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-combiner ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cam-helper-temp function) -;; (define-extern cam-combiner-active state) ;; (state camera-combiner) -;; (define-extern cam-combiner-init function) ;; (function none :behavior camera-combiner) +(define-extern cam-helper-temp (function (pointer camera-slave) (pointer camera-slave) float matrix :behavior camera-combiner)) +(define-extern cam-combiner-active (state camera-combiner)) +(define-extern cam-combiner-init (function none :behavior camera-combiner)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-update ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern plane-from-points function) ;; (function (inline-array plane) vector vector vector int none) -;; (define-extern set-point function) ;; (function vector float float float none) -;; (define-extern update-view-planes function) ;; (function math-camera (inline-array plane) float none) -;; (define-extern *update-leaf-when-outside-bsp* object) ;; symbol -;; (define-extern update-visible function) ;; (function math-camera symbol) -;; (define-extern *save-camera-inv-rot* object) ;; matrix -;; (define-extern move-camera-from-pad function) ;; (function math-camera math-camera) +(define-extern plane-from-points (function (inline-array plane) vector vector vector int float)) ;; +(define-extern set-point (function vector float float float float)) ;; +(define-extern update-view-planes (function math-camera (inline-array plane) float matrix float)) ;; +(define-extern *update-leaf-when-outside-bsp* symbol) ;; +(define-extern update-visible (function math-camera symbol)) ;; +(define-extern *save-camera-inv-rot* matrix) ;; +(define-extern move-camera-from-pad (function math-camera math-camera)) ;; (define-extern external-cam-reset! (function none)) -;; (define-extern *start-timer* object) ;; int -;; (define-extern *timer-value* object) ;; int -;; (define-extern *start-pos* object) ;; vector +(define-extern *start-timer* int) ;; +(define-extern *timer-value* int) ;; +(define-extern *start-pos* vector) ;; (define-extern update-camera (function symbol)) ;; -;; (define-extern move-level-by-name function) +(define-extern move-level-by-name (function symbol float float float vector)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; vol-h ;; @@ -25492,20 +25477,19 @@ ;; cam-debug ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype cam-dbg-scratch (structure) - ((linevec4w vector :inline :offset-assert 0) ;; vector4w 2 :inline - (color vector :inline :offset-assert 32) - (plotvec vector :inline :offset-assert 48) ;; vector4w 2 :inline - (linevec vector :inline :offset-assert 80) ;; vector4w 2 :inline + ((linevec4w vector4w 2 :inline :offset-assert 0) ;; vector4w 2 :inline + (color vector4w :inline :offset-assert 32) + (plotvec vector4w 2 :inline :offset-assert 48) ;; vector4w 2 :inline + (linevec vector4w 2 :inline :offset-assert 80) ;; vector4w 2 :inline (rel-vec vector :inline :offset-assert 112) (sphere-v-start vector :inline :offset-assert 128) (sphere-v-end vector :inline :offset-assert 144) (sphere-v-down vector :inline :offset-assert 160) (sphere-vec vector :inline :offset-assert 176) - (crossvec vector :inline :offset-assert 192) - (bboxvec vector :inline :offset-assert 240) - (fov-vv vector :inline :offset-assert 336) + (crossvec vector 3 :inline :offset-assert 192) + (bboxvec vector 6 :inline :offset-assert 240) + (fov-vv vector 4 :inline :offset-assert 336) (fov-src vector :inline :offset-assert 400) (fov-dest vector :inline :offset-assert 416) (fov-vert vector :inline :offset-assert 432) @@ -25515,11 +25499,9 @@ :size-assert #x1d0 :flag-assert #x9000001d0 ) -|# -#| (deftype cam-debug-tri (structure) - ((vertex vector 3 :offset-assert 0) ;; guessed by decompiler + ((vertex vector 3 :inline :offset-assert 0) ;; guessed by decompiler (intersect vector :inline :offset-assert 48) (color vector4w :offset-assert 64) ) @@ -25527,9 +25509,7 @@ :size-assert #x44 :flag-assert #x900000044 ) -|# -#| (deftype cam-collision-record (structure) ((pos vector :inline :offset-assert 0) (vel vector :inline :offset-assert 16) @@ -25551,72 +25531,67 @@ :size-assert #xa8 :flag-assert #x9000000a8 ) -|# -#| (deftype cam-collision-record-array (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data cam-collision-record :dynamic :offset-assert 16) ;; guessed by decompiler + ((data cam-collision-record :dynamic :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -;; (define-extern *camera-old-cpu* object) ;; int -;; (define-extern *camera-old-vu* object) ;; int -;; (define-extern *camera-old-tfrag-bytes* object) ;; int -;; (define-extern *camera-old-level* object) ;; string -;; (define-extern *camera-old-stat-string-tfrag* object) ;; string -;; (define-extern *camera-old-stat-string-tfrag-near* object) ;; string -;; (define-extern *camera-old-stat-string-total* object) ;; string +(define-extern *camera-old-cpu* int) +(define-extern *camera-old-vu* int) +(define-extern *camera-old-tfrag-bytes* int) +(define-extern *camera-old-level* string) +(define-extern *camera-old-stat-string-tfrag* string) +(define-extern *camera-old-stat-string-tfrag-near* string) +(define-extern *camera-old-stat-string-total* string) (define-extern cam-slave-options->string (function cam-slave-options object string)) (define-extern cam-index-options->string (function cam-index-options object string)) (define-extern slave-los-state->string (function slave-los-state string)) -;; (define-extern cam-line-dma function) ;; (function pointer) -;; (define-extern camera-line2d function) ;; (function vector4w vector4w pointer) -;; (define-extern camera-plot-float-func function) ;; (function float float float float (function float float) vector4w none) -;; (define-extern camera-line-setup function) ;; (function vector4w none) -;; (define-extern camera-line-draw function) ;; (function vector vector symbol) +(define-extern cam-line-dma (function pointer)) ;; +(define-extern camera-line2d (function vector4w vector4w pointer)) ;; +(define-extern camera-plot-float-func (function float float float float (function float float) vector4w none)) ;; +(define-extern camera-line-setup (function vector4w none)) ;; +(define-extern camera-line-draw (function vector vector none)) ;; (define-extern camera-line (function vector vector vector4w none)) -;; (define-extern camera-line-rel function) ;; (function vector vector vector4w none) -;; (define-extern camera-line-rel-len function) ;; (function vector vector float vector4w none) -;; (define-extern camera-sphere function) ;; (function vector float vector none) -;; (define-extern camera-cross function) ;; (function vector vector vector vector4w meters basic) -;; (define-extern camera-bounding-box-draw function) ;; (function bounding-box basic rgba none) -;; (define-extern *cam-debug-los-tri-current* object) ;; int -;; (define-extern *cam-debug-los-tri* object) ;; (inline-array cam-debug-tri) -;; (define-extern *cam-debug-coll-tri-current* object) ;; int -;; (define-extern *cam-debug-coll-tri* object) ;; (inline-array cam-debug-tri) -;; (define-extern cam-debug-reset-coll-tri function) ;; (function none) -;; (define-extern cam-debug-add-los-tri function) ;; (function (inline-array collide-cache-tri) vector vector none) -;; (define-extern cam-debug-add-coll-tri function) ;; (function cam-debug-tri vector cam-debug-tri none) -;; (define-extern cam-debug-draw-tris function) ;; (function symbol) -;; (define-extern camera-fov-draw function) ;; (function int int vector float float vector4w symbol) -;; (define-extern camera-fov-frame function) ;; (function matrix vector float float float vector4w none) -;; (define-extern debug-euler function) ;; (function cam-dbg-scratch object) -;; (define-extern bike-cam-limit function) ;; (function float float) -;; (define-extern camera-slave-debug function) ;; (function camera-slave none) -;; (define-extern master-draw-coordinates function) ;; (function vector none) -;; (define-extern *cam-collision-record-first* object) ;; int -;; (define-extern *cam-collision-record-last* object) ;; int -;; (define-extern *cam-collision-record-show* object) ;; int -;; (define-extern *cam-collision-record* object) ;; cam-collision-record-array -;; (define-extern cam-collision-record-save function) ;; (function vector vector int symbol camera-slave none) -;; (define-extern cam-collision-record-step function) ;; (function int none) -;; (define-extern cam-collision-record-draw function) ;; (function none) -;; (define-extern camera-master-debug function) ;; (function camera-master none) -;; (define-extern debug-set-camera-pos-rot! function) ;; (function vector matrix vector) -;; (define-extern cam-restore function) +(define-extern camera-line-rel (function vector vector vector4w none)) ;; +(define-extern camera-line-rel-len (function vector vector float vector4w none)) +(define-extern camera-sphere (function vector float vector4w none)) ;; +(define-extern camera-cross (function vector vector vector vector4w meters none)) ;; +(define-extern camera-bounding-box-draw (function bounding-box basic rgba none)) ;; +(define-extern *cam-debug-los-tri-current* int) ;; int +(define-extern *cam-debug-los-tri* (inline-array cam-debug-tri)) ;; +(define-extern *cam-debug-coll-tri-current* int) ;; int +(define-extern *cam-debug-coll-tri* (inline-array cam-debug-tri)) ;; (inline-array cam-debug-tri) +(define-extern cam-debug-reset-coll-tri (function none)) ;; +(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none)) ;; +(define-extern cam-debug-add-coll-tri (function cam-debug-tri vector cam-debug-tri none)) ;; +(define-extern cam-debug-draw-tris (function symbol)) ;; +(define-extern camera-fov-draw (function int int vector float float vector4w none)) ;; +(define-extern camera-fov-frame (function matrix vector float float float vector4w symbol)) ;; +(define-extern debug-euler (function cam-dbg-scratch object)) ;; +(define-extern bike-cam-limit (function float float)) ;; +(define-extern camera-slave-debug (function camera-slave none)) +(define-extern master-draw-coordinates (function vector none)) ;; +(define-extern *cam-collision-record-first* int) ;; int +(define-extern *cam-collision-record-last* int) ;; int +(define-extern *cam-collision-record-show* int) ;; int +(define-extern *cam-collision-record* cam-collision-record-array) ;; +(define-extern cam-collision-record-save (function vector vector int symbol camera-slave none)) ;; +(define-extern cam-collision-record-step (function int none)) ;; +(define-extern cam-collision-record-draw (function none)) ;; +(define-extern camera-master-debug (function camera-master none)) ;; +(define-extern debug-set-camera-pos-rot! (function vector matrix vector)) ;; +(define-extern cam-restore (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-start ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cam-stop function) ;; (function none) -;; (define-extern cam-start function) ;; (function symbol none) +(define-extern cam-stop (function symbol)) +(define-extern cam-start (function symbol none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; process-drawable ;; @@ -27677,7 +27652,7 @@ ;; (define-extern process-drawable-scale-from-entity! function) ;; (define-extern process-drawable-from-entity! function) ;; (function process-drawable entity-actor none) (define-extern reset-actors (function symbol none)) -;; (define-extern reset-cameras function) ;; (function none) +(define-extern reset-cameras (function none)) ;; (define-extern entity-birth-no-kill function) ;; (function entity none) ;; (define-extern entity-task-complete-on function) ;; (function entity none) ;; (define-extern entity-task-complete-off function) ;; (function entity none) @@ -28695,7 +28670,6 @@ :flag-assert #x900000008 ) -#| (deftype glst-named-node (glst-node) ((privname string :offset-assert 8) ;; guessed by decompiler ) @@ -28703,7 +28677,6 @@ :size-assert #xc :flag-assert #x90000000c ) -|# (deftype glst-list (structure) ((head glst-node :offset-assert 0) @@ -28716,33 +28689,41 @@ :flag-assert #x900000010 ) -;; (define-extern glst-next function) ;; (function glst-node glst-node) -;; (define-extern glst-prev function) ;; (function glst-node glst-node) -;; (define-extern glst-head function) ;; (function glst-list glst-node) -;; (define-extern glst-tail function) ;; (function glst-list glst-node) -;; (define-extern glst-end-of-list? function) ;; (function glst-node symbol) -;; (define-extern glst-start-of-list? function) ;; (function glst-node symbol) -;; (define-extern glst-empty? function) ;; (function glst-list symbol) -;; (define-extern glst-node-name function) ;; (function glst-named-node string) -;; (define-extern glst-set-name! function) ;; (function glst-named-node string string) +(define-extern glst-next (function glst-node glst-node)) +(define-extern glst-prev (function glst-node glst-node)) +(define-extern glst-head (function glst-list glst-node)) +(define-extern glst-tail (function glst-list glst-node)) +(define-extern glst-end-of-list? (function glst-node symbol)) +(define-extern glst-start-of-list? (function glst-node symbol)) +(define-extern glst-empty? (function glst-list symbol)) +(define-extern glst-node-name "Returns the `privname` of the provided [[glst-named-node]]" (function glst-named-node string)) +(define-extern glst-set-name! "Sets the `privname` of the provided [[glst-named-node]]" (function glst-named-node string string)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; glist ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern glst-num-elements function) ;; (function glst-list int) -;; (define-extern glst-remove function) ;; (function glst-list glst-node glst-node) -;; (define-extern glst-remove-tail function) ;; (function glst-list glst-node) -;; (define-extern glst-remove-head function) ;; (function glst-list glst-node) -;; (define-extern glst-insert-before function) ;; (function glst-list glst-node glst-node glst-node) -;; (define-extern glst-insert-after function) ;; (function glst-list glst-node glst-node glst-node) -;; (define-extern glst-add-tail function) ;; (function glst-list glst-node glst-node) -;; (define-extern glst-add-head function) ;; (function glst-list glst-node glst-node) -;; (define-extern glst-init-list! function) ;; (function glst-list glst-list) -;; (define-extern glst-find-node-by-name function) ;; (function glst-list string glst-node) -;; (define-extern glst-get-node-by-index function) ;; (function glst-list int glst-node) -;; (define-extern glst-length-of-longest-name function) ;; (function glst-list int) -;; (define-extern glst-get-node-index function) ;; (function glst-list glst-node int) +(define-extern glst-num-elements "Returns `numelem` from the provided [[glst-list]]" (function glst-list int)) +(define-extern glst-remove "Removes the provided [[glst-node]] from the list and returns it back" (function glst-list glst-node glst-node)) +(define-extern glst-remove-tail + "Removes the tail of the [[glst-list]], returns #f if the list is empty, otherwise returns the [[glst-node]] that was removed" + (function glst-list glst-node)) +(define-extern glst-remove-head + "Removes the head of the [[glst-list]], returns #f if the list is empty, otherwise returns the [[glst-node]] that was removed" + (function glst-list glst-node)) +(define-extern glst-insert-before "Inserts `new` before `curr`, returns the newly inserted [[glst-node]]" (function glst-list glst-node glst-node glst-node)) +(define-extern glst-insert-after "Inserts `new` after `curr`, returns the newly inserted [[glst-node]]" (function glst-list glst-node glst-node glst-node)) +(define-extern glst-add-tail "Adds the provided [[glst-node]] to the end of the [[glst-list]]" (function glst-list glst-node glst-node)) +(define-extern glst-add-head "Adds the provided [[glst-node]] to the beginning of the [[glst-list]]" (function glst-list glst-node glst-node)) +(define-extern glst-init-list! "Clears the provided [[glst-list]]" (function glst-list glst-list)) +(define-extern glst-find-node-by-name + "Returns the [[glst-named-node]] by examining it's `privname`, returns #f if nothing is found" + (function glst-list string glst-node)) +(define-extern glst-get-node-by-index + "Returns the [[glst-node]] by index, returns #f if nothing is found" + (function glst-list int glst-node)) +(define-extern glst-length-of-longest-name "Returns the length of the longest `privname`" (function glst-list int)) +(define-extern glst-get-node-index "Given a [[glst-node]] return it's position in the [[glst-list]]" (function glst-list glst-node int)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; anim-tester ;; @@ -29583,7 +29564,7 @@ (define-extern dm-cam-mode-func (function (state camera-slave) debug-menu-msg object)) (define-extern dm-cam-mode-default (function object debug-menu-msg symbol)) (define-extern dm-cam-settings-default (function object debug-menu-msg symbol)) -(define-extern dm-cam-settings-func (function camera-slave-options debug-menu-msg symbol)) +(define-extern dm-cam-settings-func (function cam-slave-options debug-menu-msg symbol)) (define-extern dm-cam-settings-func-int (function int debug-menu-msg int int int)) (define-extern dm-cam-externalize (function symbol debug-menu-msg symbol)) ;; (define-extern dm-cam-setting-float (function float debug-menu-msg symbol)) ;; TODO - causes decomp hang diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 7f3bb00219..81fe5a3c2c 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -37,7 +37,6 @@ // checking boxed type is different now - these make the cfg stuff sad "name=", "(method 21 game-info)", - "(anon-function 2 cam-combiner)", "cspace-inspect-tree", "command-get-process", "command-get-trans", @@ -60,8 +59,6 @@ "(method 77 rapid-gunner)", // until loop without nop: "(method 9 sparticle-launcher)", - "(method 18 tracking-spline)", - "cam-string-find-position-rel!", "cam-layout-entity-volume-info-create", "process-drawable-shock-skel-effect", "target-history-print", @@ -133,7 +130,7 @@ "update-mood-copy-ctywide", "update-mood-copy-stadium", "update-mood-drillb", - "reset-target-tracking", + // "reset-target-tracking", "(anon-function 1 target)", "find-nearest-entity", "target-land-effect", @@ -226,7 +223,7 @@ "real-main-draw-hook": [114, 115, 116, 118], - "sprite-draw-distorters": [4,5], + "sprite-draw-distorters": [4, 5], "(method 12 perf-stat)": [0], "(method 11 perf-stat)": [0] diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index be30b0a352..977f739e80 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -102,5 +102,11 @@ ["L6311", "(pointer uint64)", 1], ["L6310", "(pointer uint64)", 1], ["L6309", "(pointer uint64)", 1] + ], + "cam-states": [ + ["L772", "(pointer uint64)", 1], + ["L773", "(pointer uint64)", 1], + ["L774", "(pointer uint64)", 1], + ["L775", "(pointer uint64)", 1] ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 5adc63fe56..ae30831e69 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -162,37 +162,145 @@ [32, ["array", "symbol", 4]] ], "matrix<-parented-transformq!": [[16, "vector"]], - "(method 9 cylinder)": [ [48, "cylinder-verts"], [432, "cylinder-verts"], [816, "matrix"], [880, "matrix"] ], - "(method 9 cylinder-flat)": [ [48, "cylinder-flat-verts"], [208, "cylinder-flat-verts"], [368, "matrix"], [432, "vector"] ], - "matrix-3x3-triple-transpose-product": [[16, ["inline-array", "matrix", 3]]], - "(method 14 rigid-body)": [[16, "quaternion"]], "(method 19 rigid-body)": [ [16, "vector"], [32, "vector"] ], "(method 22 rigid-body)": [[16, "vector"]], - "want-to-board?": [ [16, "vector"], [560, "matrix"], [608, "vector"] ], - "(method 10 cam-setting-data)": [[16, "event-message-block"]], + "(method 18 tracking-spline)": [ + [16, "tracking-spline-sampler"], + [32, "tracking-spline-sampler"] + ], + "(method 20 tracking-spline)": [ + [16, "vector"], // hang without! + [32, "vector"] + ], + "cam-calc-follow!": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"] + ], + "slave-set-rotation!": [ + [96, "vector"], + [112, "matrix"], + [176, "vector"] + ], + "v-slrp2!": [ + [32, "vector"], + [64, "matrix"] + ], + "v-slrp3!": [[32, "vector"]], + "cam-state-from-entity": [[16, "curve"]], // decompiler guessed 'symbol' instead! + "camera-teleport-to-entity": [[16, "transformq"]], + "(event cam-master-active)": [ + [16, "event-message-block"], + [96, "vector"], + [112, "vector"], + [16, "event-message-block"] + ], + "master-choose-entity": [[16, "event-message-block"]], + "(code cam-pov180)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"] + ], + "(code cam-pov-track)": [ + [16, "vector"], + [32, "matrix"] + ], + "(code cam-eye)": [ + [16, "vector"], + [32, "matrix"], + [112, "vector"] + ], + "los-cw-ccw": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"], + [112, "vector"] + ], + "cam-los-spline-collide": [ + [16, "collide-query"], + [560, "vector"], + [576, "vector"] + ], + "cam-los-collide": [ + [16, "collide-query"], + [592, "vector"], + [608, "vector"] + ], + "cam-string-joystick": [ + [32, "vector"], + [48, "matrix"], + [128, "matrix"], + [192, "vector"], + [208, "vector"], + [224, "matrix"] + ], + "cam-string-find-position-rel!": [[48, "collide-query"]], + "cam-string-find-hidden": [[16, "collide-query"]], + "cam-string-move": [[80, "collide-query"]], + "(enter cam-string)": [[32, "collide-query"]], + "cam-stick-code": [ + [608, "vector"], + [64, "collide-query"] + ], + "(trans cam-stick)": [ + [16, "matrix"], + [80, "vector"], + [96, "vector"], + [112, "vector"] + ], + "(code cam-spline)": [[16, "curve"]], + "(code cam-point-watch)": [ + [16, "vector"], + [32, "vector"] + ], + "cam-free-floating-move": [[16, "camera-free-floating-move-info"]], + "cam-helper-temp": [ + [16, "matrix"], + [64, "vector"], + [80, "matrix"] + ], + "update-view-planes": [ + [208, "vector"], + [224, "vector"], + [16, "view-frustum"] + ], + "camera-slave-debug": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"], + [128, "curve"] + ], + "cam-collision-record-draw": [ + [48, "collide-query"], + [16, "vector4w"], + [32, "vector4w"] + ], + "cam-debug-draw-tris": [[16, "vector4w"]], // placeholder "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index a1dcb9cb72..4f43548b45 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -572,6 +572,11 @@ [3, "v1", "target"], [14, "a0", "target"] ], + "(method 10 history)": [[[8, 10], "a1", "history-elt"]], + "(method 10 history-iterator)": [[[20, 35], "a2", "history-elt"]], + "command-get-time": [[119, "gp", "(pointer float)"]], + "command-get-param": [[122, "gp", "(pointer float)"]], + "command-get-entity": [[10, "gp", "process"]], // sprite "sprite-add-matrix-data": [ [[5, 15], "a2", "dma-packet"], @@ -581,9 +586,7 @@ [[98, 113], "a1", "vector"], [[119, 133], "a1", "vector"] ], - "sprite-add-frame-data": [ - [[8, 16], "a0", "dma-packet"] - ], + "sprite-add-frame-data": [[[8, 16], "a0", "dma-packet"]], "sprite-add-2d-chunk": [ [[12, 20], "a0", "dma-packet"], [[45, 52], "a0", "dma-packet"], @@ -651,11 +654,6 @@ [[285, 289], "a1", "vector4w"], [[293, 298], "v1", "dma-packet"] ], - "(method 10 history)": [[[8, 10], "a1", "history-elt"]], - "(method 10 history-iterator)": [[[20, 35], "a2", "history-elt"]], - "command-get-time": [[119, "gp", "(pointer float)"]], - "command-get-param": [[122, "gp", "(pointer float)"]], - "command-get-entity": [[10, "gp", "process"]], "print-game-text": [ [225, "v1", "float"], [241, "v1", "float"] @@ -695,24 +693,16 @@ [[454, 467], "a0", "handle"], [[455, 462], "v1", "handle"] ], - "(method 9 art)": [ - [9, "v1", "pointer"] - ], - "(method 12 art-group)":[ - [12, "a0", "art-joint-anim"] - ], + "(method 9 art)": [[9, "v1", "pointer"]], + "(method 12 art-group)": [[12, "a0", "art-joint-anim"]], "(method 9 art-mesh-geo)": [ [20, "s4", "(pointer int16)"], [[14, 19], "a0", "drawable"], [10, "v1", "(pointer art)"], [14, "v1", "(pointer art)"] ], - "(method 9 art-joint-anim)": [ - [9, "v1", "pointer"] - ], - "joint-control-copy!": [ - [8, "a0", "uint"] - ], + "(method 9 art-joint-anim)": [[9, "v1", "pointer"]], + "joint-control-copy!": [[8, "a0", "uint"]], "joint-control-remap!": [ [127, "t9", "(function joint-control joint-control-channel int object)"], [181, "t9", "(function joint-control joint-control-channel int object)"], @@ -726,30 +716,25 @@ [195, "v1", "terrain-context"], [65, "a3", "(pointer float)"], [67, "a3", "(pointer float)"], - [[18, 24], "a2", "(inline-array vector)"], [24, "a3", "(pointer float)"], [[59, 65], "a2", "(inline-array vector)"], [[112, 118], "a2", "(inline-array vector)"], [17, "a2", "int"] ], - "(method 2 art-joint-anim-manager-slot)": [ [21, "s2", "uint"], [21, "v1", "uint"] ], - "create-interpolated2-joint-animation-frame": [ [[48, 125], "v1", "joint-anim-frame"] ], - "(method 12 art-joint-anim-manager)": [ [15, "a0", "pointer"], [15, "v1", "pointer"], [21, "a0", "pointer"], [21, "v1", "pointer"] ], - "(method 11 art-joint-anim-manager)": [ [54, "v1", "uint"], [54, "s2", "uint"], @@ -759,12 +744,10 @@ [87, "a1", "uint"], [94, "a2", "uint"] ], - "joint-anim-inspect-elt": [ [[4, 15], "gp", "joint-anim-matrix"], [[17, 30], "gp", "joint-anim-transformq"] ], - "matrix-from-control!": [ [22, "v1", "pointer"], [35, "v1", "pointer"], @@ -773,7 +756,6 @@ [72, "v1", "pointer"], [82, "v1", "pointer"], [85, "v1", "pointer"], - // [58, "v1", "matrix"], [[43, 49], "v1", "matrix"] ], @@ -915,6 +897,345 @@ [34, "v1", "texture-id"], [[42, 44], "v1", "adgif-shader"] ], + "glst-find-node-by-name": [ + [6, "s5", "glst-named-node"], + [7, "v1", "glst-named-node"] + ], + "glst-length-of-longest-name": [ + [5, "s5", "glst-named-node"], + [6, "v1", "glst-named-node"] + ], + "(event time-of-day-tick)": [[10, "v1", "float"]], + "cam-slave-get-vector-with-offset": [[[52, 61], "s3", "vector"]], + "cam-slave-get-interp-time": [[43, "f0", "float"]], + "cam-standard-event-handler": [ + [13, "gp", "(state camera-slave)"], + [19, "gp", "(state camera-slave)"], + [22, "gp", "(state camera-slave)"] + ], + "cam-calc-follow!": [ + [101, "f0", "float"], + [104, "f0", "float"] // needed because the decompiler sees an int going into an FP register and assumes it's an int instead! + ], + "(event cam-master-active)": [ + [80, "gp", "matrix"], + [170, "s5", "vector"], + [275, "v1", "process"], + [330, "a0", "camera-slave"], + [448, "v1", "camera-slave"], + [512, "v1", "camera-slave"], + [542, "v1", "camera-slave"], + [611, "a0", "vector"], + [786, "v1", "float"], + [789, "v1", "float"] + ], + "master-track-target": [ + [53, "gp", "process-focusable"], + [100, "gp", "process-focusable"], + [121, "gp", "process-focusable"], + [132, "gp", "process-focusable"] + ], + "reset-target-tracking": [ + [14, "gp", "process-focusable"], + [40, "gp", "process-focusable"], + [51, "gp", "process-focusable"], + [65, "gp", "process-focusable"], + [86, "gp", "process-focusable"] + ], + "reset-follow": [[[12, 18], "a0", "process-focusable"]], + "(code cam-pov)": [ + [15, "a1", "pov-camera"], + [24, "a0", "pov-camera"] + ], + "(code cam-pov180)": [ + [15, "a1", "pov-camera"], + [23, "v1", "pov-camera"], + [45, "v1", "pov-camera"], + [58, "v1", "pov-camera"], + [80, "a1", "pov-camera"], + [122, "v1", "vector"] + ], + "(code cam-pov-track)": [ + [19, "a1", "pov-camera"], + [30, "a0", "pov-camera"] + ], + "cam-los-spline-collide": [ + [70, "s3", "(inline-array collide-cache-tri)"], + [88, "s3", "(inline-array collide-cache-tri)"] + ], + "cam-los-collide": [ + [92, "s1", "(inline-array collide-cache-tri)"], + [205, "s1", "(inline-array collide-cache-tri)"], + [135, "s1", "(inline-array collide-cache-tri)"], + [175, "s1", "(inline-array collide-cache-tri)"] + ], + "cam-dist-analog-input": [[32, "f0", "float"]], + "(event cam-string)": [ + [11, "v1", "vector"], + [[44, 72], "s5", "vector"], + [[80, 108], "gp", "vector"], + [141, "a0", "vector"], + [145, "a0", "vector"], + [174, "v1", "vector"], + [184, "v1", "float"], + [28, "v1", "float"], + [31, "v1", "float"] + ], + "cam-draw-collide-cache": [ + [[8, 13], "gp", "(inline-array collide-cache-tri)"] + ], + "(event cam-combiner-active)": [ + [[103, 126], "gp", "camera-slave"], + [[189, 235], "gp", "camera-slave"] + ], + "cam-collision-record-draw": [[[45, 240], "s5", "cam-collision-record"]], + "camera-fov-frame": [ + [87, "a0", "vector4w"], + [128, "a0", "vector4w"], + [169, "a0", "vector4w"], + [7, "a0", "cam-dbg-scratch"], + [18, "a0", "cam-dbg-scratch"], + [29, "a0", "cam-dbg-scratch"], + [33, "a2", "cam-dbg-scratch"], + [36, "a3", "cam-dbg-scratch"], + [39, "t0", "cam-dbg-scratch"], + [45, "a0", "cam-dbg-scratch"], + [50, "a0", "cam-dbg-scratch"], + [54, "a2", "cam-dbg-scratch"], + [57, "a3", "cam-dbg-scratch"], + [60, "t0", "cam-dbg-scratch"], + [66, "a0", "cam-dbg-scratch"], + [72, "a0", "cam-dbg-scratch"], + [75, "a1", "cam-dbg-scratch"], + [83, "a0", "cam-dbg-scratch"], + [86, "a1", "cam-dbg-scratch"], + [91, "a0", "cam-dbg-scratch"], + [95, "a2", "cam-dbg-scratch"], + [101, "t0", "cam-dbg-scratch"], + [98, "a3", "cam-dbg-scratch"], + [107, "a0", "cam-dbg-scratch"], + [113, "a0", "cam-dbg-scratch"], + [116, "a1", "cam-dbg-scratch"], + [124, "a0", "cam-dbg-scratch"], + [127, "a1", "cam-dbg-scratch"], + [132, "a0", "cam-dbg-scratch"], + [136, "a2", "cam-dbg-scratch"], + [139, "a3", "cam-dbg-scratch"], + [142, "t0", "cam-dbg-scratch"], + [148, "a0", "cam-dbg-scratch"], + [154, "a0", "cam-dbg-scratch"], + [157, "a1", "cam-dbg-scratch"], + [165, "a0", "cam-dbg-scratch"], + [168, "a1", "cam-dbg-scratch"], + [173, "a0", "cam-dbg-scratch"], + [177, "a2", "cam-dbg-scratch"], + [180, "a3", "cam-dbg-scratch"], + [183, "t0", "cam-dbg-scratch"], + [189, "a0", "cam-dbg-scratch"], + [195, "a0", "cam-dbg-scratch"], + [198, "a1", "cam-dbg-scratch"] + ], + "camera-sphere": [ + [[43, 49], "v1", "cam-dbg-scratch"], + [64, "v1", "cam-dbg-scratch"], + [80, "v1", "cam-dbg-scratch"], + [94, "v1", "cam-dbg-scratch"], + [109, "v1", "cam-dbg-scratch"], + [124, "v1", "cam-dbg-scratch"], + [138, "v1", "cam-dbg-scratch"], + [152, "v1", "cam-dbg-scratch"], + [156, "a0", "cam-dbg-scratch"], + [159, "a1", "cam-dbg-scratch"], + [164, "a0", "cam-dbg-scratch"], + [167, "a1", "cam-dbg-scratch"] + ], + "camera-line-draw": [ + [36, "a0", "cam-dbg-scratch"], + [44, "a0", "cam-dbg-scratch"], + [2, "a2", "cam-dbg-scratch"], + [7, "a0", "cam-dbg-scratch"], + [14, "v1", "cam-dbg-scratch"], + [18, "v1", "cam-dbg-scratch"], + [22, "a0", "cam-dbg-scratch"], + [24, "v1", "cam-dbg-scratch"], + [29, "a0", "cam-dbg-scratch"], + [32, "a1", "cam-dbg-scratch"], + [36, "a0", "cam-dbg-scratch"], + [44, "a0", "cam-dbg-scratch"] + ], + "camera-plot-float-func": [ + [56, "v1", "cam-dbg-scratch"], + [64, "a0", "cam-dbg-scratch"], + [68, "a0", "cam-dbg-scratch"], + [105, "v1", "cam-dbg-scratch"], + [242, "v1", "cam-dbg-scratch"], + [21, "a0", "cam-dbg-scratch"], + [24, "a0", "cam-dbg-scratch"], + [27, "a0", "cam-dbg-scratch"], + [30, "a0", "cam-dbg-scratch"], + [51, "a0", "cam-dbg-scratch"], + [54, "a0", "cam-dbg-scratch"], + [56, "v1", "cam-dbg-scratch"], + [58, "a0", "cam-dbg-scratch"], + [64, "a0", "cam-dbg-scratch"], + [87, "a0", "cam-dbg-scratch"], + [97, "a0", "cam-dbg-scratch"], + [103, "a0", "cam-dbg-scratch"], + [105, "v1", "cam-dbg-scratch"], + [107, "a0", "cam-dbg-scratch"], + [111, "a0", "cam-dbg-scratch"], + [114, "a1", "cam-dbg-scratch"], + [119, "a0", "cam-dbg-scratch"], + [122, "a0", "cam-dbg-scratch"], + [128, "a0", "cam-dbg-scratch"], + [131, "a0", "cam-dbg-scratch"], + [135, "a0", "cam-dbg-scratch"], + [138, "a1", "cam-dbg-scratch"], + [142, "a0", "cam-dbg-scratch"], + [148, "a0", "cam-dbg-scratch"], + [154, "a0", "cam-dbg-scratch"], + [160, "a0", "cam-dbg-scratch"], + [164, "a0", "cam-dbg-scratch"], + [167, "a1", "cam-dbg-scratch"], + [171, "a0", "cam-dbg-scratch"], + [174, "a0", "cam-dbg-scratch"], + [177, "a0", "cam-dbg-scratch"], + [183, "a0", "cam-dbg-scratch"], + [187, "a0", "cam-dbg-scratch"], + [190, "a1", "cam-dbg-scratch"], + [197, "a0", "cam-dbg-scratch"], + [200, "a0", "cam-dbg-scratch"], + [206, "a0", "cam-dbg-scratch"], + [212, "a0", "cam-dbg-scratch"], + [216, "a0", "cam-dbg-scratch"], + [219, "a1", "cam-dbg-scratch"], + [223, "a0", "cam-dbg-scratch"], + [226, "a0", "cam-dbg-scratch"], + [238, "a0", "cam-dbg-scratch"], + [242, "v1", "cam-dbg-scratch"], + [244, "a0", "cam-dbg-scratch"], + [247, "a0", "cam-dbg-scratch"], + [266, "a0", "cam-dbg-scratch"], + [270, "a0", "cam-dbg-scratch"], + [273, "a1", "cam-dbg-scratch"] + ], + "cam-line-dma": [ + [32, "t0", "vector"], + [36, "t0", "vector"], + [45, "t0", "vector"], + [50, "t0", "vector"], + [[12, 16], "a3", "dma-packet"], + [[22, 25], "a3", "gs-gif-tag"], + [[33, 38], "a3", "(pointer uint128)"], + [[46, 52], "a1", "(pointer uint128)"], + [[60, 65], "a0", "dma-packet"], + [[65, 74], "a0", "(pointer uint64)"], + [[77, 80], "a0", "dma-packet"] + ], + "camera-line2d": [ + [4, "a2", "cam-dbg-scratch"], + [6, "a0", "cam-dbg-scratch"], + [10, "a0", "cam-dbg-scratch"], + [13, "a0", "cam-dbg-scratch"], + [14, "a1", "cam-dbg-scratch"], + [18, "a0", "cam-dbg-scratch"], + [20, "a1", "cam-dbg-scratch"], + [24, "a0", "cam-dbg-scratch"], + [27, "a0", "cam-dbg-scratch"] + ], + "camera-line-setup": [[2, "a0", "cam-dbg-scratch"]], + "camera-line-rel-len": [ + [9, "a0", "cam-dbg-scratch"], + [5, "a0", "cam-dbg-scratch"], + [12, "a1", "cam-dbg-scratch"], + [18, "a0", "cam-dbg-scratch"] + ], + "camera-line-rel": [ + [2, "a3", "cam-dbg-scratch"], + [8, "a1", "cam-dbg-scratch"] + ], + "camera-bounding-box-draw": [ + [6, "a0", "cam-dbg-scratch"], + [15, "a0", "cam-dbg-scratch"], + [21, "v1", "cam-dbg-scratch"], + [24, "a0", "cam-dbg-scratch"], + [30, "v1", "cam-dbg-scratch"], + [33, "a0", "cam-dbg-scratch"], + [39, "v1", "cam-dbg-scratch"], + [42, "a0", "cam-dbg-scratch"], + [48, "v1", "cam-dbg-scratch"], + [51, "a0", "cam-dbg-scratch"], + [57, "v1", "cam-dbg-scratch"], + [62, "a1", "cam-dbg-scratch"], + [68, "a1", "cam-dbg-scratch"], + [74, "a1", "cam-dbg-scratch"], + [80, "a1", "cam-dbg-scratch"], + [86, "a1", "cam-dbg-scratch"], + [92, "a1", "cam-dbg-scratch"], + [97, "a0", "cam-dbg-scratch"], + [100, "a1", "cam-dbg-scratch"], + [105, "a0", "cam-dbg-scratch"], + [108, "a1", "cam-dbg-scratch"], + [113, "a0", "cam-dbg-scratch"], + [116, "a1", "cam-dbg-scratch"], + [121, "a0", "cam-dbg-scratch"], + [124, "a1", "cam-dbg-scratch"], + [129, "a0", "cam-dbg-scratch"], + [132, "a1", "cam-dbg-scratch"], + [137, "a0", "cam-dbg-scratch"], + [140, "a1", "cam-dbg-scratch"], + [12, "v1", "cam-dbg-scratch"] + ], + "camera-cross": [ + [8, "a0", "cam-dbg-scratch"], + [14, "a0", "cam-dbg-scratch"], + [18, "a2", "cam-dbg-scratch"], + [22, "a0", "cam-dbg-scratch"], + [26, "a2", "cam-dbg-scratch"], + [31, "a0", "cam-dbg-scratch"], + [34, "a1", "cam-dbg-scratch"], + [39, "a0", "cam-dbg-scratch"], + [42, "a1", "cam-dbg-scratch"], + [47, "a0", "cam-dbg-scratch"], + [52, "a0", "cam-dbg-scratch"], + [52, "a0", "cam-dbg-scratch"], + [56, "a2", "cam-dbg-scratch"], + [60, "a0", "cam-dbg-scratch"], + [64, "a2", "cam-dbg-scratch"], + [69, "a0", "cam-dbg-scratch"], + [72, "a1", "cam-dbg-scratch"], + [77, "a0", "cam-dbg-scratch"], + [80, "a1", "cam-dbg-scratch"], + [85, "a0", "cam-dbg-scratch"], + [90, "a0", "cam-dbg-scratch"], + [94, "a2", "cam-dbg-scratch"], + [98, "a0", "cam-dbg-scratch"], + [101, "a1", "cam-dbg-scratch"], + [106, "a0", "cam-dbg-scratch"], + [109, "a1", "cam-dbg-scratch"] + ], + "cam-debug-draw-tris": [ + [20, "a0", "cam-dbg-scratch"], + [88, "a0", "cam-dbg-scratch"] + ], + "camera-fov-draw": [ + [16, "t2", "cam-dbg-scratch"], + [30, "a3", "cam-dbg-scratch"], + [43, "a0", "cam-dbg-scratch"], + [60, "a0", "cam-dbg-scratch"], + [63, "a1", "cam-dbg-scratch"], + [68, "a0", "cam-dbg-scratch"], + [71, "a1", "cam-dbg-scratch"], + [76, "a0", "cam-dbg-scratch"], + [79, "a1", "cam-dbg-scratch"], + [2, "t2", "cam-dbg-scratch"], + [13, "v1", "(pointer vector)"], + [27, "v1", "(pointer vector)"], + [40, "v1", "(pointer vector)"], + [53, "v1", "(pointer vector)"] + ], + "cam-collision-record-save": [[[8, 56], "v1", "cam-collision-record"]], + "(trans cam-stick)": [[157, "a0", "vector"]], // placeholder "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index edebde3feb..b9956bb0b1 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -293,5 +293,17 @@ "vars": { "a0-147": ["a0-147", "process-focusable"] } + }, + + "glst-insert-before": { + "args": ["list", "curr", "new"] + }, + + "glst-insert-after": { + "args": ["list", "curr", "new"] + }, + + "matrix-local->world": { + "args": ["smooth?"] } } diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index d80f54495b..0f56c255b9 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -7,7 +7,7 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. - "allowed_objects": ["mood-tables"], + "allowed_objects": [], "banned_objects": ["effect-control"], //////////////////////////// diff --git a/goal_src/jak2/engine/anim/joint-mod-h.gc b/goal_src/jak2/engine/anim/joint-mod-h.gc index b92e6b76ba..d414ee66aa 100644 --- a/goal_src/jak2/engine/anim/joint-mod-h.gc +++ b/goal_src/jak2/engine/anim/joint-mod-h.gc @@ -25,6 +25,10 @@ ) ;; ---track-mode +;; NOTE - for cam-debug +(declare-type try-to-look-at-info basic) +(define-extern last-try-to-look-at-data try-to-look-at-info) + ;; DECOMP BEGINS (deftype joint-mod (basic) @@ -82,7 +86,7 @@ (deftype try-to-look-at-info (basic) - ((who uint64 :offset-assert 8) + ((who handle :offset-assert 8) (horz float :offset-assert 16) (vert float :offset-assert 20) ) @@ -488,9 +492,9 @@ (matrix*! s2-0 s0-0 (-> arg0 parent bone transform)) (set-vector! s1-0 - (vector-length (the-as vector (-> s2-0 data))) - (vector-length (the-as vector (&-> s2-0 data 4))) - (vector-length (the-as vector (&-> s2-0 data 8))) + (vector-length (the-as vector (-> s2-0 vector))) + (vector-length (-> s2-0 vector 1)) + (vector-length (-> s2-0 vector 2)) 1.0 ) (let ((v1-19 (-> gp-0 blend-transform scale))) @@ -605,3 +609,10 @@ (joint-mod-ik-method-10 () none 10) ) ) + + +0 + + + + diff --git a/goal_src/jak2/engine/anim/mspace-h.gc b/goal_src/jak2/engine/anim/mspace-h.gc index fe074a5dec..023d0bf1d1 100644 --- a/goal_src/jak2/engine/anim/mspace-h.gc +++ b/goal_src/jak2/engine/anim/mspace-h.gc @@ -5,7 +5,14 @@ ;; name in dgo: mspace-h ;; dgos: ENGINE, GAME +(declare-type cspace structure) +(define-extern cspace<-parented-transformq-joint! (function cspace transformq none)) +(define-extern cspace<-transformq! (function cspace transformq matrix)) +(define-extern matrix<-transformq! (function matrix transformq matrix)) +(define-extern matrix<-parented-transformq! (function matrix transformq vector matrix)) + ;; DECOMP BEGINS + (deftype joint (basic) ((name basic :offset-assert 4) (number int32 :offset-assert 8) @@ -17,6 +24,7 @@ :flag-assert #x900000050 ) + (deftype bone-cache (structure) ((bone-matrix uint32 :offset-assert 0) (parent-matrix uint32 :offset-assert 4) @@ -28,6 +36,7 @@ :flag-assert #x900000010 ) + (deftype bone (structure) ((transform matrix :inline :offset-assert 0) (position vector :inline :offset 48) @@ -38,6 +47,7 @@ :flag-assert #x900000050 ) + (deftype skeleton (inline-array-class) ((bones bone :inline :dynamic :offset-assert 16) ) @@ -45,6 +55,8 @@ :size-assert #x10 :flag-assert #x900000010 ) + + (set! (-> skeleton heap-base) (the-as uint 80)) (deftype cspace (structure) @@ -66,6 +78,7 @@ ) ) + (deftype cspace-array (inline-array-class) ((data cspace :inline :dynamic :offset-assert 16) ) @@ -73,6 +86,8 @@ :size-assert #x10 :flag-assert #x900000010 ) + + (set! (-> cspace-array heap-base) (the-as uint 32)) (defmethod print cspace ((obj cspace)) @@ -87,10 +102,3 @@ ) obj ) - -;; DECOMP ENDS - -(define-extern cspace<-parented-transformq-joint! (function cspace transformq none)) -(define-extern cspace<-transformq! (function cspace transformq matrix)) -(define-extern matrix<-transformq! (function matrix transformq matrix)) -(define-extern matrix<-parented-transformq! (function matrix transformq vector matrix)) \ No newline at end of file diff --git a/goal_src/jak2/engine/camera/cam-combiner.gc b/goal_src/jak2/engine/camera/cam-combiner.gc index 2881104d5d..88b9457a0f 100644 --- a/goal_src/jak2/engine/camera/cam-combiner.gc +++ b/goal_src/jak2/engine/camera/cam-combiner.gc @@ -7,3 +7,475 @@ ;; DECOMP BEGINS +(defbehavior cam-helper-temp camera-combiner ((arg0 (pointer camera-slave)) (arg1 (pointer camera-slave)) (arg2 float)) + (local-vars (sv-144 cam-rotation-tracker)) + (set! sv-144 (-> arg0 0 tracking)) + (let ((s1-0 (-> arg0 0 trans)) + (gp-0 (-> arg1 0 tracking)) + (s0-0 (-> arg1 0 trans)) + ) + (cond + ((= (-> self tracking-status) 3) + (cam-calc-follow! (-> self tracking) s1-0 #t) + (slave-set-rotation! (-> self tracking) s1-0 (the-as float (-> self tracking-options)) (-> self fov) #t) + (set! sv-144 (-> self tracking)) + (set! s1-0 (-> self trans)) + ) + ((= (-> self tracking-status) 2) + (cam-calc-follow! (-> self tracking) s0-0 #t) + (slave-set-rotation! (-> self tracking) s0-0 (the-as float (-> self tracking-options)) (-> self fov) #t) + (set! gp-0 (-> self tracking)) + (set! s0-0 (-> self trans)) + ) + ) + (let ((s2-0 (new 'stack-no-clear 'matrix))) + (dotimes (v1-14 3) + (set! (-> s2-0 vector v1-14 quad) (the-as uint128 0)) + ) + 0.0 + 0.0 + 0.0 + (let ((s4-0 (new-stack-vector0))) + 0.0 + (let ((s3-0 (new-stack-matrix0))) + (vector-! + (the-as vector (-> s2-0 vector)) + (the-as vector (-> sv-144 inv-mat)) + (the-as vector (-> gp-0 inv-mat)) + ) + (vector-! (-> s2-0 vector 1) (-> sv-144 inv-mat vector 1) (-> gp-0 inv-mat vector 1)) + (vector-! (-> s2-0 vector 2) (-> sv-144 inv-mat vector 2) (-> gp-0 inv-mat vector 2)) + (let ((f0-6 (vector-length (the-as vector (-> s2-0 vector)))) + (f1-0 (vector-length (-> s2-0 vector 1))) + (f2-0 (vector-length (-> s2-0 vector 2))) + ) + (cond + ((and (< f0-6 f1-0) (< f0-6 f2-0)) + (vector-cross! s4-0 (-> s2-0 vector 1) (-> s2-0 vector 2)) + ) + ((and (< f1-0 f0-6) (< f1-0 f2-0)) + (vector-cross! s4-0 (the-as vector (-> s2-0 vector)) (-> s2-0 vector 2)) + ) + (else + (vector-cross! s4-0 (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1)) + ) + ) + ) + (vector-normalize! s4-0 1.0) + (let ((f0-9 (fabs (vector-dot (the-as vector (-> sv-144 inv-mat)) s4-0))) + (f1-3 (fabs (vector-dot (-> sv-144 inv-mat vector 1) s4-0))) + (f2-3 (fabs (vector-dot (-> sv-144 inv-mat vector 2) s4-0))) + ) + (cond + ((and (< f0-9 f1-3) (< f0-9 f2-3)) + (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> sv-144 inv-mat)) s4-0) + (vector-flatten! (-> s2-0 vector 1) (the-as vector (-> gp-0 inv-mat)) s4-0) + ) + ((< f1-3 f2-3) + (vector-flatten! (the-as vector (-> s2-0 vector)) (-> sv-144 inv-mat vector 1) s4-0) + (vector-flatten! (-> s2-0 vector 1) (-> gp-0 inv-mat vector 1) s4-0) + ) + (else + (vector-flatten! (the-as vector (-> s2-0 vector)) (-> sv-144 inv-mat vector 2) s4-0) + (vector-flatten! (-> s2-0 vector 1) (-> gp-0 inv-mat vector 2) s4-0) + ) + ) + ) + (vector-normalize! (the-as vector (-> s2-0 vector)) 1.0) + (vector-normalize! (-> s2-0 vector 1) 1.0) + (vector-cross! (-> s2-0 vector 2) (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1)) + (if (< (vector-dot (-> s2-0 vector 2) s4-0) 0.0) + (vector-negate! s4-0 s4-0) + ) + (let ((f30-0 (acos (vector-dot (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1))))) + (cond + ((logtest? (-> *camera* master-options) 2) + (set! (-> *camera* master-options) (logand -7 (-> *camera* master-options))) + (when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) 1)) + (vector-! (the-as vector (-> s2-0 vector)) (-> *camera* tpos-curr) s1-0) + (vector-! (-> s2-0 vector 1) s0-0 s1-0) + (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> s2-0 vector)) (-> *camera* local-down)) + (vector-flatten! (-> s2-0 vector 1) (-> s2-0 vector 1) (-> *camera* local-down)) + (when (and (< 4096.0 (vector-normalize-ret-len! (the-as vector (-> s2-0 vector)) 1.0)) + (< 4096.0 (vector-normalize-ret-len! (-> s2-0 vector 1) 1.0)) + ) + (vector-cross! (-> s2-0 vector 2) (-> s2-0 vector 1) (the-as vector (-> s2-0 vector))) + (when (< (vector-dot (-> s2-0 vector 2) s4-0) -0.01) + ) + ) + ) + ) + ((and (< 16384.0 f30-0) (< (vector-dot (-> self flip-control-axis) s4-0) 0.0)) + (logxor! (-> *camera* master-options) 4) + ) + ) + (set! (-> self flip-control-axis quad) (-> s4-0 quad)) + (when (logtest? (-> *camera* master-options) 4) + (set! f30-0 (- 65536.0 f30-0)) + (vector-negate! s4-0 s4-0) + ) + (let ((f30-1 (* f30-0 (- 1.0 arg2)))) + (matrix-axis-sin-cos! s3-0 s4-0 (sin f30-1) (cos f30-1)) + ) + ) + (matrix*! (-> self inv-camera-rot) (the-as matrix gp-0) s3-0) + ) + ) + ) + ) + ) + +(defstate cam-combiner-active (camera-combiner) + :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 'fast-rot) + (set! v0-0 (the-as none #t)) + (set! (-> self fast-rot) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'set-interpolation) + (let ((f0-1 (the float (-> arg3 param 0)))) + (cond + ((>= 0.0 f0-1) + (let ((f0-2 1.0)) + (set! (-> self interp-val) f0-2) + f0-2 + ) + ) + (else + (set! (-> self interp-val) 0.0) + (let ((f0-3 (/ 5.0 f0-1))) + (set! (-> self interp-step) f0-3) + f0-3 + ) + ) + ) + ) + ) + ((= v1-0 'teleport) + (when (nonzero? (-> self tracking-status)) + (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self tracking-options)) + (-> self fov) + #f + ) + ) + ) + ((= v1-0 'stop-tracking) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + ((= v1-0 'start-tracking) + (cond + ((< arg1 1) + (let ((t9-3 format) + (a0-14 0) + (a1-4 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") + ) + (let ((v1-8 (-> arg3 param 0))) + (rtype-of v1-8) + ) + (t9-3 a0-14 a1-4) + ) + ) + ((not (type? (-> arg3 param 0) camera-slave)) + (let ((t9-5 format) + (a0-16 0) + (a1-6 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") + (v1-11 (-> arg3 param 0)) + ) + (t9-5 a0-16 a1-6 (rtype-of v1-11)) + ) + ) + ((zero? (-> self tracking-status)) + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-1 (the-as camera-slave (-> arg3 param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-1 options))) + (set! (-> self tracking no-follow) (-> gp-1 tracking no-follow)) + (copy-to (-> self tracking tilt-adjust) (-> gp-1 tracking tilt-adjust)) + (copy-to (-> self tracking underwater-blend) (-> gp-1 tracking underwater-blend)) + (copy-to (-> self tracking point-of-interest-blend) (-> gp-1 tracking point-of-interest-blend)) + (let ((gp-2 (-> gp-1 trans))) + (cam-calc-follow! (-> self tracking) gp-2 #f) + (slave-set-rotation! (-> self tracking) gp-2 (the-as float (-> self tracking-options)) (-> self fov) #f) + ) + ) + ) + ) + ) + ((= v1-0 'copy-tracking) + (cond + ((< arg1 1) + (let ((t9-11 format) + (a0-23 0) + (a1-12 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") + ) + (let ((v1-23 (-> arg3 param 0))) + (rtype-of v1-23) + ) + (t9-11 a0-23 a1-12) + ) + ) + ((not (type? (-> arg3 param 0) camera-slave)) + (let ((t9-13 format) + (a0-25 0) + (a1-14 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") + (v1-25 (-> arg3 param 0)) + ) + (t9-13 a0-25 a1-14 (rtype-of v1-25)) + ) + ) + ((nonzero? (-> self tracking-status)) + #f + ) + (else + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-3 (the-as camera-slave (-> arg3 param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-3 options))) + (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) + (copy-to (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) + (copy-to (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) + (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) + (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) + (let* ((a2-23 (-> self tracking)) + (a3-7 (-> gp-3 tracking)) + (v1-37 (-> a3-7 inv-mat vector 0 quad)) + (a0-32 (-> a3-7 inv-mat vector 1 quad)) + (a1-17 (-> a3-7 inv-mat vector 2 quad)) + (a3-8 (-> a3-7 inv-mat trans quad)) + ) + (set! (-> a2-23 inv-mat vector 0 quad) v1-37) + (set! (-> a2-23 inv-mat vector 1 quad) a0-32) + (set! (-> a2-23 inv-mat vector 2 quad) a1-17) + (set! (-> a2-23 inv-mat trans quad) a3-8) + ) + (copy-to (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) + (set! (-> self tracking looking-at quad) (-> gp-3 tracking looking-at quad)) + (set! v0-0 (the-as none (-> self tracking looking-interesting))) + (set! (-> (the-as vector v0-0) quad) (-> gp-3 tracking looking-interesting quad)) + ) + v0-0 + ) + ) + ) + ) + ) + ) + ) + :code (behavior () + (until #f + (when *debug-segment* + (let ((gp-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-7 'camera) + (s5-0 *profile-camera-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s4-0 (-> gp-0 data (-> gp-0 count)))) + (let ((s3-0 (-> gp-0 base-time))) + (set! (-> s4-0 name) v1-7) + (set! (-> s4-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-0)))) + ) + (set! (-> s4-0 depth) (the-as uint (-> gp-0 depth))) + (set! (-> s4-0 color) s5-0) + (set! (-> gp-0 segment (-> gp-0 depth)) s4-0) + ) + (+! (-> gp-0 count) 1) + (+! (-> gp-0 depth) 1) + (set! (-> gp-0 max-depth) (max (-> gp-0 max-depth) (-> gp-0 depth))) + ) + ) + 0 + ) + (when (and (zero? (logand (-> *camera* master-options) 1)) (!= (-> self tracking-status) 0)) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + (when *camera* + (let ((s5-1 (-> *camera* slave)) + (s4-1 (-> *camera* decel)) + (f30-0 (parameter-ease-sin-clamp (-> self interp-val))) + (gp-1 (new-stack-vector0)) + ) + (set! (-> gp-1 quad) (-> self trans quad)) + (when s5-1 + (cond + ((< (-> self interp-val) 1.0) + (vector-lerp-clamp! (-> self trans) (-> s4-1 0 trans) (-> s5-1 0 trans) f30-0) + (set! (-> self fov) (lerp-clamp (-> s4-1 0 fov) (-> s5-1 0 fov) f30-0)) + (set! (-> self dist-from-src) (vector-vector-distance (-> self trans) (-> s4-1 0 trans))) + (set! (-> self dist-from-dest) (vector-vector-distance (-> self trans) (-> s5-1 0 trans))) + (cond + ((= (-> self tracking-status) 1) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self tracking-options)) + (-> self fov) + (not (-> self fast-rot)) + ) + (let* ((a2-4 (-> self inv-camera-rot)) + (a3-2 (-> self tracking)) + (v1-42 (-> a3-2 inv-mat vector 0 quad)) + (a0-18 (-> a3-2 inv-mat vector 1 quad)) + (a1-8 (-> a3-2 inv-mat vector 2 quad)) + (a3-3 (-> a3-2 inv-mat trans quad)) + ) + (set! (-> a2-4 vector 0 quad) v1-42) + (set! (-> a2-4 vector 1 quad) a0-18) + (set! (-> a2-4 vector 2 quad) a1-8) + (set! (-> a2-4 trans quad) a3-3) + ) + ) + (else + (cam-helper-temp s4-1 s5-1 f30-0) + ) + ) + (cond + ((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value))) + ) + ((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t))) + ) + ((paused?) + ) + (else + (+! (-> self interp-val) (* (-> self interp-step) (-> self clock time-adjust-ratio))) + ) + ) + ) + (else + (set! (-> self dist-from-src) 409600.0) + (set! (-> self dist-from-dest) 0.0) + (set! (-> self trans quad) (-> s5-1 0 trans quad)) + (set! (-> self fov) (-> s5-1 0 fov)) + (cond + ((= (-> self tracking-status) 2) + (set! (-> self tracking-status) (the-as uint 1)) + ) + ((= (-> self tracking-status) 3) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + ) + (cond + ((= (-> self tracking-status) 1) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self tracking-options)) + (-> self fov) + (not (-> self fast-rot)) + ) + (let* ((v1-71 (-> self inv-camera-rot)) + (a3-5 (-> self tracking)) + (a0-25 (-> a3-5 inv-mat vector 0 quad)) + (a1-12 (-> a3-5 inv-mat vector 1 quad)) + (a2-8 (-> a3-5 inv-mat vector 2 quad)) + (a3-6 (-> a3-5 inv-mat trans quad)) + ) + (set! (-> v1-71 vector 0 quad) a0-25) + (set! (-> v1-71 vector 1 quad) a1-12) + (set! (-> v1-71 vector 2 quad) a2-8) + (set! (-> v1-71 trans quad) a3-6) + ) + ) + (else + (let* ((v1-72 (-> self inv-camera-rot)) + (a3-7 (-> s5-1 0 tracking)) + (a0-27 (-> a3-7 inv-mat vector 0 quad)) + (a1-13 (-> a3-7 inv-mat vector 1 quad)) + (a2-9 (-> a3-7 inv-mat vector 2 quad)) + (a3-8 (-> a3-7 inv-mat trans quad)) + ) + (set! (-> v1-72 vector 0 quad) a0-27) + (set! (-> v1-72 vector 1 quad) a1-13) + (set! (-> v1-72 vector 2 quad) a2-9) + (set! (-> v1-72 trans quad) a3-8) + ) + ) + ) + ) + ) + ) + (vector-! (-> self velocity) (-> self trans) gp-1) + ) + ) + (when *debug-segment* + (let ((gp-2 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-85 (+ (-> gp-2 depth) -1)) + (s5-2 (-> gp-2 segment v1-85)) + (s4-2 (-> gp-2 base-time)) + ) + (when (>= v1-85 0) + (set! (-> s5-2 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-2)))) + (+! (-> gp-2 depth) -1) + ) + ) + ) + ) + 0 + ) + (set! (-> self fast-rot) #f) + (suspend) + ) + #f + (none) + ) + ) + +(defbehavior cam-combiner-init camera-combiner () + (stack-size-set! (-> self main-thread) 512) + (vector-reset! (-> self trans)) + (matrix-identity! (-> self inv-camera-rot)) + (cond + (*math-camera* + (set! (-> self fov) (-> *math-camera* fov)) + (set! (-> self trans quad) (-> *math-camera* trans quad)) + (let* ((v1-6 (-> self inv-camera-rot)) + (a3-0 (-> *math-camera* inv-camera-rot)) + (a0-6 (-> a3-0 vector 0 quad)) + (a1-1 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-6 vector 0 quad) a0-6) + (set! (-> v1-6 vector 1 quad) a1-1) + (set! (-> v1-6 vector 2 quad) a2-0) + (set! (-> v1-6 trans quad) a3-1) + ) + ) + (else + (set! (-> self fov) 11650.845) + ) + ) + (set! (-> self interp-val) 1.0) + (set! (-> self interp-step) 0.125) + (set! (-> self tracking-status) (the-as uint 0)) + (set! (-> self fast-rot) #f) + (init (-> self tracking tilt-adjust) (-> *CAMERA-bank* default-tilt-adjust) 9.102222 91.022224 0.25) + (init + (-> self tracking follow-height-extra) + (-> *setting-control* cam-current extra-follow-height) + 81.92 + 819.2 + 0.5 + ) + (vector-reset! (-> self velocity)) + (go cam-combiner-active) + 0 + (none) + ) + + + + diff --git a/goal_src/jak2/engine/camera/cam-debug-h.gc b/goal_src/jak2/engine/camera/cam-debug-h.gc index f603f12a45..3246d360ff 100644 --- a/goal_src/jak2/engine/camera/cam-debug-h.gc +++ b/goal_src/jak2/engine/camera/cam-debug-h.gc @@ -11,6 +11,13 @@ ;; NOTE - for settings (define-extern cam-free-floating (state camera-slave)) +;; NOTE - for camera +(define-extern camera-line-rel-len (function vector vector float vector4w none)) +(define-extern camera-slave-debug (function camera-slave none)) + +;; NOTE - for cam-states +(define-extern cam-collision-record-save (function vector vector int symbol camera-slave none)) + ;; DECOMP BEGINS (declare-file (debug)) diff --git a/goal_src/jak2/engine/camera/cam-debug.gc b/goal_src/jak2/engine/camera/cam-debug.gc index 0d8619ca68..7bd519a926 100644 --- a/goal_src/jak2/engine/camera/cam-debug.gc +++ b/goal_src/jak2/engine/camera/cam-debug.gc @@ -5,5 +5,2137 @@ ;; name in dgo: cam-debug ;; dgos: ENGINE, GAME +(define-extern *camera-old-cpu* int) +(define-extern *camera-old-vu* int) +(define-extern *camera-old-tfrag-bytes* int) +(define-extern *camera-old-level* string) +(define-extern *camera-old-stat-string-tfrag* string) +(define-extern *camera-old-stat-string-tfrag-near* string) +(define-extern *camera-old-stat-string-total* string) + ;; DECOMP BEGINS +;; 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) + (plotvec vector4w 2 :inline :offset-assert 48) + (linevec vector4w 2 :inline :offset-assert 80) + (rel-vec vector :inline :offset-assert 112) + (sphere-v-start vector :inline :offset-assert 128) + (sphere-v-end vector :inline :offset-assert 144) + (sphere-v-down vector :inline :offset-assert 160) + (sphere-vec vector :inline :offset-assert 176) + (crossvec vector 3 :inline :offset-assert 192) + (bboxvec vector 6 :inline :offset-assert 240) + (fov-vv vector 4 :inline :offset-assert 336) + (fov-src vector :inline :offset-assert 400) + (fov-dest vector :inline :offset-assert 416) + (fov-vert vector :inline :offset-assert 432) + (fov-horz vector :inline :offset-assert 448) + ) + :method-count-assert 9 + :size-assert #x1d0 + :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. +(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 ") + ) + (if (= (logand (cam-slave-options GUN_CAM) arg0) (cam-slave-options GUN_CAM)) + (format arg1 "GUN_CAM ") + ) + (if (= (logand arg0 (cam-slave-options STICKY_ANGLE)) (cam-slave-options STICKY_ANGLE)) + (format arg1 "STICKY_ANGLE ") + ) + (if (= (logand arg0 (cam-slave-options FIND_HIDDEN_TARGET)) (cam-slave-options FIND_HIDDEN_TARGET)) + (format arg1 "FIND_HIDDEN_TARGET ") + ) + (if (= (logand (cam-slave-options RAPID_TRACKING) arg0) (cam-slave-options RAPID_TRACKING)) + (format arg1 "RAPID_TRACKING ") + ) + (if (= (logand arg0 (cam-slave-options SHRINK_MAX_ANGLE)) (cam-slave-options SHRINK_MAX_ANGLE)) + (format arg1 "SHRINK_MAX_ANGLE ") + ) + (if (= (logand arg0 (cam-slave-options JUMP_PITCHES)) (cam-slave-options JUMP_PITCHES)) + (format arg1 "JUMP_PITCHES ") + ) + (if (= (logand arg0 (cam-slave-options LINE_OF_SIGHT)) (cam-slave-options LINE_OF_SIGHT)) + (format arg1 "LINE_OF_SIGHT ") + ) + (if (= (logand arg0 (cam-slave-options PLAYER_MOVING_CAMERA)) (cam-slave-options PLAYER_MOVING_CAMERA)) + (format arg1 "PLAYER_MOVING_CAMERA ") + ) + (if (= (logand (cam-slave-options ALLOW_SHIFT_BUTTONS) arg0) (cam-slave-options ALLOW_SHIFT_BUTTONS)) + (format arg1 "ALLOW_SHIFT_BUTTONS ") + ) + (if (= (logand arg0 (cam-slave-options NO_ROTATE)) (cam-slave-options NO_ROTATE)) + (format arg1 "NO_ROTATE ") + ) + (if (= (logand (cam-slave-options WIDE_FOV) arg0) (cam-slave-options WIDE_FOV)) + (format arg1 "WIDE_FOV ") + ) + (if (= (logand arg0 (cam-slave-options MOVE_SPHERICAL)) (cam-slave-options MOVE_SPHERICAL)) + (format arg1 "MOVE_SPHERICAL ") + ) + (if (= (logand arg0 (cam-slave-options DRAG)) (cam-slave-options DRAG)) + (format arg1 "DRAG ") + ) + (if (= (logand arg0 (cam-slave-options MOVEMENT_BLOCKED)) (cam-slave-options MOVEMENT_BLOCKED)) + (format arg1 "MOVEMENT_BLOCKED ") + ) + (if (= (logand (cam-slave-options BLOCK_RIGHT_STICK) arg0) (cam-slave-options BLOCK_RIGHT_STICK)) + (format arg1 "BLOCK_RIGHT_STICK ") + ) + (if (= (logand arg0 (cam-slave-options COLLIDE)) (cam-slave-options COLLIDE)) + (format arg1 "COLLIDE ") + ) + (if (= (logand arg0 (cam-slave-options ALLOW_Z_ROT)) (cam-slave-options ALLOW_Z_ROT)) + (format arg1 "ALLOW_Z_ROT ") + ) + (if (= (logand arg0 (cam-slave-options BIKE_MODE)) (cam-slave-options BIKE_MODE)) + (format arg1 "BIKE_MODE ") + ) + (if (= (logand (cam-slave-options EASE_SPLINE_IDX) arg0) (cam-slave-options EASE_SPLINE_IDX)) + (format arg1 "EASE_SPLINE_IDX ") + ) + (if (= (logand arg0 (cam-slave-options GOTO_GOOD_POINT)) (cam-slave-options GOTO_GOOD_POINT)) + (format arg1 "GOTO_GOOD_POINT ") + ) + (if (= (logand arg0 (cam-slave-options BUTT_CAM)) (cam-slave-options BUTT_CAM)) + (format arg1 "BUTT_CAM ") + ) + (if (= (logand (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) arg0) + (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) + ) + (format arg1 "VERTICAL_FOLLOW_MATCHES_CAMERA ") + ) + (if (= (logand (cam-slave-options HAVE_BUTT_HANDLE) arg0) (cam-slave-options HAVE_BUTT_HANDLE)) + (format arg1 "HAVE_BUTT_HANDLE ") + ) + (the-as string arg1) + ) + +;; definition for function cam-index-options->string +;; INFO: 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 ") + ) + (if (= (logand arg0 (cam-index-options RADIAL)) (cam-index-options RADIAL)) + (format arg1 "SPHERICAL ") + ) + (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)) + "between" + ) + (((slave-los-state none)) + "none" + ) + (((slave-los-state cw)) + "cw" + ) + (((slave-los-state ccw)) + "ccw" + ) + (else + "*unknown*" + ) + ) + ) + +;; 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)) + ) + (let ((a0-1 (the-as object (-> v1-5 base)))) + (let* ((a1-0 v1-5) + (a3-0 (the-as object (-> a1-0 base))) + ) + (set! (-> (the-as dma-packet a3-0) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a3-0) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a3-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a1-0 base) (&+ (the-as pointer a3-0) 16)) + ) + (let* ((a1-1 v1-5) + (a3-2 (the-as object (-> a1-1 base))) + ) + (set! (-> (the-as gs-gif-tag a3-2) tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) + :nreg #x4 + ) + ) + (set! (-> (the-as gs-gif-tag a3-2) regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id xyzf2) + :regs2 (gif-reg-id rgbaq) + :regs3 (gif-reg-id xyzf2) + ) + ) + (set! (-> a1-1 base) (&+ (the-as pointer a3-2) 16)) + ) + (let* ((a1-2 v1-5) + (a3-4 (-> a1-2 base)) + ) + (set! (-> (the-as (pointer uint128) a3-4) 0) (-> (the-as vector (+ 32 #x70000000)) quad)) + (set! (-> (the-as (pointer uint128) a3-4) 1) (-> (the-as vector (+ #x70000000 0)) quad)) + (set! (-> a1-2 base) (&+ a3-4 32)) + ) + (let* ((a3-6 v1-5) + (a1-3 (-> a3-6 base)) + ) + (set! (-> (the-as (pointer uint128) a1-3) 0) (-> (the-as vector (+ 32 #x70000000)) quad)) + (set! (-> (the-as (pointer uint128) a1-3) 1) (-> (the-as vector (+ 16 #x70000000)) quad)) + (set! (-> a3-6 base) (&+ a1-3 32)) + ) + (let ((a3-10 (/ (the-as int (+ (- -16 (the-as int a0-1)) (the-as int (-> v1-5 base)))) 16))) + (cond + ((nonzero? a3-10) + (logior! (-> (the-as dma-packet a0-1) dma) (shr (shl a3-10 48) 48)) + (logior! (-> (the-as (pointer uint64) a0-1) 1) (shl (shr (shl a3-10 48) 48) 32)) + ) + (else + (set! (-> v1-5 base) (the-as (pointer uint64) a0-1)) + ) + ) + ) + ) + (let ((a3-16 (-> v1-5 base))) + (let ((a0-2 (the-as object (-> v1-5 base)))) + (set! (-> (the-as dma-packet a0-2) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet a0-2) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-2) vif1) (new 'static 'vif-tag)) + (set! (-> v1-5 base) (&+ (the-as pointer a0-2) 16)) + ) + (dma-bucket-insert-tag + (the-as (inline-array dma-bucket) (-> *display* frames (-> *display* on-screen) bucket-group)) + (bucket-id bucket-318) + a2-0 + (the-as (pointer dma-tag) a3-16) + ) + ) + ) + ) + +;; 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) + (* (- 2256 (-> (the-as cam-dbg-scratch arg0) linevec4w 0 y)) 16) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 z) #x7fffff) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 1 x) + (* (+ (-> (the-as cam-dbg-scratch arg1) linevec4w 0 x) 1792) 16) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 1 y) + (* (- 2256 (-> (the-as cam-dbg-scratch arg1) linevec4w 0 y)) 16) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 1 z) #x7fffff) + (cam-line-dma) + ) + +;; definition for function camera-plot-float-func +;; INFO: Used lq/sq +;; INFO: 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)) + ) + 0.0 + 0.0 + (let ((f28-0 (/ 200.0 f24-0)) + (f26-0 (/ 400.0 f30-0)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) color x) 128) + (set! (-> (the-as cam-dbg-scratch #x70000000) color y) 128) + (set! (-> (the-as cam-dbg-scratch #x70000000) color z) 128) + (set! (-> (the-as cam-dbg-scratch #x70000000) color w) 128) + (when (and (< arg0 0.0) (< 0.0 arg1)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) + (+ (the int (* f26-0 f30-0 (/ (- arg0) f30-0))) 20) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) + (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 #x70000000)) + ) + ) + (when (and (< arg2 0.0) (< 0.0 arg3)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) + (+ (the int (* f28-0 f24-0 (/ (- arg2) f24-0))) 20) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) + (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) + ) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) 20) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) (+ (the int (* f28-0 f24-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (let ((v1-64 (-> arg5 quad))) + (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-64) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 (- (arg4 arg0) arg2))) 20)) + (let ((s3-1 1)) + (while (>= (the int (* f26-0 f30-0)) s3-1) + (let ((v1-69 (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 quad))) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 quad) v1-69) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ s3-1 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) + (+ (the int (* f28-0 (- (arg4 (+ arg0 (* f30-0 (/ (the float s3-1) (* f26-0 f30-0))))) arg2))) 20) + ) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (+! s3-1 1) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function camera-line-setup +;; INFO: Used lq/sq +;; INFO: 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) + ) + (init-for-transform *identity-matrix*) + 0 + (none) + ) + +;; definition for function camera-line-draw +;; INFO: Used lq/sq +;; INFO: 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)) + (set! (-> (the-as (pointer uint128) (+ 96 (the-as int (the-as cam-dbg-scratch #x70000000))))) (-> arg1 quad)) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec 0 w) (the-as int 1.0)) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec 1 w) (the-as int 1.0)) + (transform-float-point + (the-as vector (+ 80 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (-> (the-as cam-dbg-scratch #x70000000) linevec4w)) + ) + (transform-float-point + (the-as vector (+ 96 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 16 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (cond + ((< (the-as uint #xe00000) (the-as uint (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 z))) + (return #f) + ) + ((< (the-as uint #xe00000) (the-as uint (-> (the-as cam-dbg-scratch #x70000000) linevec4w 1 z))) + (return #f) + ) + ) + (cam-line-dma) + 0 + (none) + ) + +;; definition for function camera-line +;; INFO: Return type mismatch int vs none. +(defun camera-line ((arg0 vector) (arg1 vector) (arg2 vector4w)) + (camera-line-setup arg2) + (camera-line-draw arg0 arg1) + 0 + (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+! + (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg0 + ) + (camera-line arg0 (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg3) + (none) + ) + +;; definition for function camera-sphere +;; INFO: Return type mismatch int vs none. +(defun camera-sphere ((arg0 vector) (arg1 float) (arg2 vector4w)) + (camera-line-setup arg2) + (dotimes (s4-0 10) + (let ((f30-1 (* arg1 (sin (* 3276.8 (the float s4-0))))) + (f28-1 (* arg1 (sin (* 3276.8 (the float (+ s4-0 1)))))) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-start y) + (+ (-> arg0 y) (* (cos (* 3276.8 (the float s4-0))) arg1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-end y) + (-> (the-as cam-dbg-scratch #x70000000) sphere-v-start y) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-down y) + (+ (-> arg0 y) (* (cos (* 3276.8 (the float (+ s4-0 1)))) arg1)) + ) + (dotimes (s3-0 10) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-start x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float s3-0))) f30-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-start z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float s3-0))) f30-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-end x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float (+ s3-0 1)))) f30-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-end z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float (+ s3-0 1)))) f30-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-down x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float s3-0))) f28-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-down z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float s3-0))) f28-1)) + ) + (camera-line-draw + (the-as vector (+ 128 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 144 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 128 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 160 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + ) + ) + 0 + (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+! + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (vector-! + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg3 + ) + (vector-cross! + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg1 + ) + (vector-normalize! (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg4) + (vector+! + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (vector-! + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg3 + ) + (vector-cross! + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg0 + ) + (vector-normalize! (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg4) + (vector+! + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (vector-! + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg3 + ) + (none) + ) + +;; definition for function camera-bounding-box-draw +;; INFO: Used lq/sq +;; INFO: 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))))) + (-> arg0 min quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 0 x) (-> arg0 max x)) + (set! (-> (the-as (pointer uint128) (+ 256 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 min quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 1 y) (-> arg0 max y)) + (set! (-> (the-as (pointer uint128) (+ 272 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 min quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 2 z) (-> arg0 max z)) + (set! (-> (the-as (pointer uint128) (+ 288 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 max quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 3 x) (-> arg0 min x)) + (set! (-> (the-as (pointer uint128) (+ 304 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 max quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 4 y) (-> arg0 min y)) + (set! (-> (the-as (pointer uint128) (+ 320 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 max quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 5 z) (-> arg0 min z)) + (camera-line-draw (-> arg0 min) (the-as vector (+ 240 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 min) (the-as vector (+ 256 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 min) (the-as vector (+ 272 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 max) (the-as vector (+ 288 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 max) (the-as vector (+ 304 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 max) (the-as vector (+ 320 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw + (the-as vector (+ 240 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 304 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 304 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 272 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 272 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 288 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 288 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 256 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 256 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 320 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 320 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 240 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + 0 + (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) + (color vector4w :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x44 + :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. +(defun cam-debug-reset-coll-tri () + (set! *cam-debug-los-tri-current* 0) + (set! *cam-debug-coll-tri-current* 0) + 0 + (none) + ) + +;; definition for function cam-debug-add-los-tri +;; INFO: Used lq/sq +;; INFO: 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) + ) + (else + (let ((v1-3 (-> *cam-debug-los-tri* *cam-debug-los-tri-current*))) + (set! (-> v1-3 vertex 0 quad) (-> arg0 0 vertex 0 quad)) + (set! (-> v1-3 vertex 1 quad) (-> arg0 0 vertex 1 quad)) + (set! (-> v1-3 vertex 2 quad) (-> arg0 0 vertex 2 quad)) + (set! (-> v1-3 intersect quad) (-> arg1 quad)) + (set! (-> v1-3 color) (the-as vector4w arg2)) + ) + (set! *cam-debug-los-tri-current* (+ *cam-debug-los-tri-current* 1)) + (if (= *cam-debug-los-tri-current* 460) + (format 0 "ERROR : cam-debug-add-los-tri overflow~%") + ) + ) + ) + 0 + (none) + ) + +;; definition for function cam-debug-add-coll-tri +;; INFO: Used lq/sq +;; INFO: 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) + ) + (else + (let ((v1-3 (-> *cam-debug-coll-tri* *cam-debug-coll-tri-current*))) + (set! (-> v1-3 vertex 0 quad) (-> arg0 vertex 0 quad)) + (set! (-> v1-3 vertex 1 quad) (-> arg0 vertex 1 quad)) + (set! (-> v1-3 vertex 2 quad) (-> arg0 vertex 2 quad)) + (set! (-> v1-3 intersect quad) (-> arg1 quad)) + (set! (-> v1-3 color) (the-as vector4w arg2)) + ) + (set! *cam-debug-coll-tri-current* (+ *cam-debug-coll-tri-current* 1)) + (if (>= *cam-debug-coll-tri-current* 460) + (format 0 "ERROR : cam-debug-add-coll-tri overflow~%") + ) + ) + ) + 0 + (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* + (dotimes (gp-1 *cam-debug-los-tri-current*) + (let ((v1-7 (-> *cam-debug-los-tri* gp-1 color quad))) + (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-7) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 1)) (* 80 gp-1))) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 1)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 2)) (* 80 gp-1))) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 2)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0)) (* 80 gp-1))) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (-> *cam-debug-los-tri* gp-1 intersect) + (-> *cam-debug-los-tri* gp-1 color) + (the-as meters #x44800000) + ) + ) + ) + (when *display-cam-coll-marks* + (dotimes (gp-2 *cam-debug-coll-tri-current*) + (let ((v1-34 (-> *cam-debug-coll-tri* gp-2 color quad))) + (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-34) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 1)) (* 80 gp-2))) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 1)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 2)) (* 80 gp-2))) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 2)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0)) (* 80 gp-2))) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (-> *cam-debug-coll-tri* gp-2 intersect) + (-> *cam-debug-coll-tri* gp-2 color) + (the-as meters #x44800000) + ) + ) + #f + ) + ) + +;; 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) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((v1-1 (the-as object (+ 336 (the-as int (the-as cam-dbg-scratch #x70000000)))))) + (let ((t2-1 arg2) + (t3-0 arg1) + (f0-0 arg3) + ) + (.lvf vf2 t3-0) + (.lvf vf1 (&-> t2-1 quad)) + (let ((t2-2 f0-0)) + (.mov vf3 t2-2) + ) + ) + (.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 (the-as (pointer uint128) (&-> (the-as (pointer vector) v1-1) 0)) vf4) + ) + (let ((v1-3 (the-as object (+ 352 (the-as int (the-as cam-dbg-scratch #x70000000)))))) + (let ((t2-4 arg2) + (t3-1 arg0) + (f0-1 arg3) + ) + (.lvf vf2 t3-1) + (.lvf vf1 (&-> t2-4 quad)) + (let ((a3-1 f0-1)) + (.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 (the-as (pointer uint128) (&-> (the-as (pointer vector) v1-3) 0)) vf4) + ) + (let ((v1-5 (the-as object (+ 368 (the-as int (the-as cam-dbg-scratch #x70000000)))))) + (let ((a3-3 arg2) + (f0-2 arg4) + ) + (.lvf vf2 arg0) + (.lvf vf1 (&-> a3-3 quad)) + (let ((a0-1 f0-2)) + (.mov vf3 a0-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 (the-as (pointer uint128) (&-> (the-as (pointer vector) v1-5) 0)) vf4) + ) + (let ((v1-7 (the-as object (+ 384 (the-as int (the-as cam-dbg-scratch #x70000000)))))) + (let ((a0-3 arg2) + (f0-3 arg4) + ) + (.lvf vf2 arg1) + (.lvf vf1 (&-> a0-3 quad)) + (let ((a0-4 f0-3)) + (.mov vf3 a0-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 (the-as (pointer uint128) (&-> (the-as (pointer vector) v1-7) 0)) vf4) + ) + (camera-line-setup arg5) + (camera-line-draw + (the-as vector (+ 336 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 352 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 352 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 368 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 368 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 384 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (none) + ) + ) + +;; definition for function camera-fov-frame +;; INFO: Used lq/sq +;; INFO: 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)))) + (-> arg0 vector 1) + (* arg3 (tan arg2)) + ) + (vector-float*! + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (-> arg0 vector)) + (* arg4 (tan arg2)) + ) + (vector+! + (the-as vector (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector+! + (the-as vector (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (vector+! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector-! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (camera-fov-draw + (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))) + (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000))) + arg1 + 4096.0 + 20480.0 + arg5 + ) + (set! (-> (the-as (pointer uint128) (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> (the-as vector4w (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) quad) + ) + (vector-! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector+! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (camera-fov-draw + (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))) + (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000))) + arg1 + 4096.0 + 20480.0 + arg5 + ) + (set! (-> (the-as (pointer uint128) (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> (the-as vector4w (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) quad) + ) + (vector-! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector-! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (camera-fov-draw + (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))) + (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000))) + arg1 + 4096.0 + 20480.0 + arg5 + ) + (set! (-> (the-as (pointer uint128) (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> (the-as vector4w (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) quad) + ) + (vector+! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector+! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (the-as symbol (camera-fov-draw + (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))) + (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000))) + arg1 + 4096.0 + 20480.0 + arg5 + ) + ) + ) + +;; definition for method 11 of type tracking-spline +;; INFO: 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") + (format 0 " ") + ) + (if (= arg0 (-> obj next-to-last-point)) + (format 0 "n") + (format 0 " ") + ) + (if (= arg0 (-> obj end-point)) + (format 0 "e") + (format 0 " ") + ) + (if (= arg0 -134250495) + (format 0 " ~D~%" arg0) + (format + 0 + " ~D ~M ~M ~M~%" + arg0 + (-> obj point arg0 position x) + (-> obj point arg0 position y) + (-> obj point arg0 position z) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type tracking-spline +;; INFO: 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) + (debug-point-info obj s5-0) + (set! s5-0 (-> obj point s5-0 next)) + ) + (debug-point-info obj s5-0) + ) + 0 + (none) + ) + +;; definition for method 23 of type tracking-spline +;; INFO: 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))) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (when (!= s4-0 -134250495) + (tracking-spline-method-19 obj 0.0 s3-0 (the-as tracking-spline-sampler #f)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s3-0 + (new 'static 'vector4w :x #xff :w #x80) + (the-as meters #x44800000) + ) + (tracking-spline-method-19 obj (-> obj sample-len) s3-0 (the-as tracking-spline-sampler #f)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s3-0 + (new 'static 'vector4w :x #xff :w #x80) + (the-as meters #x44800000) + ) + ) + ) + (while (!= s4-0 -134250495) + (camera-line + (the-as vector (-> obj point s5-0)) + (the-as vector (-> obj point s4-0)) + (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) + ) + (set! s5-0 s4-0) + (set! s4-0 (-> obj point s4-0 next)) + ) + ) + (if (!= s5-0 -134250495) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (the-as vector (-> obj point s5-0)) + (new 'static 'vector4w :x #xff :w #x80) + (the-as meters #x44800000) + ) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (camera-line + (-> obj debug-out-position) + (-> obj debug-old-position) + (new 'static 'vector4w :x #xff :y #xff :w #x80) + ) + (vector-! s5-1 (-> obj debug-out-position) (-> obj debug-old-position)) + (tracking-spline-method-20 obj s5-1 (-> obj debug-last-point)) + (camera-line-rel (-> obj debug-old-position) s5-1 (new 'static 'vector4w :x #xff :z #xff :w #x80)) + ) + 0 + (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)) + ) + (matrix->eul s4-0 (the-as matrix (&-> arg0 crossvec 0 w)) 21) + (format *stdcon* "euler angles x ~R y ~R z ~R~%" (-> s4-0 x) (-> s4-0 y) (-> s4-0 z)) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 0 w) + (-> arg0 crossvec 1 x) + (-> arg0 crossvec 1 y) + (-> arg0 crossvec 1 z) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 1 w) + (-> arg0 crossvec 2 x) + (-> arg0 crossvec 2 y) + (-> arg0 crossvec 2 z) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 2 w) + (-> arg0 bboxvec 0 x) + (-> arg0 bboxvec 0 y) + (-> arg0 bboxvec 0 z) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 bboxvec 0 w) + (-> arg0 bboxvec 1 x) + (-> arg0 bboxvec 1 y) + (-> arg0 bboxvec 1 z) + ) + (eul->matrix gp-0 s4-0) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> gp-0 vector 0 x) + (-> gp-0 vector 0 y) + (-> gp-0 vector 0 z) + (-> gp-0 vector 0 w) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> gp-0 vector 1 x) + (-> gp-0 vector 1 y) + (-> gp-0 vector 1 z) + (-> gp-0 vector 1 w) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> gp-0 vector 2 x) + (-> gp-0 vector 2 y) + (-> gp-0 vector 2 z) + (-> gp-0 vector 2 w) + ) + (format *stdcon* "~f ~f ~f ~f~%" (-> gp-0 trans x) (-> gp-0 trans y) (-> gp-0 trans z) (-> gp-0 trans w)) + (if (or (< 0.001 (fabs (- (-> arg0 crossvec 0 w) (-> gp-0 vector 0 x)))) + (< 0.001 (fabs (- (-> arg0 crossvec 1 x) (-> gp-0 vector 0 y)))) + (< 0.001 (fabs (- (-> arg0 crossvec 1 y) (-> gp-0 vector 0 z)))) + (< 0.001 (fabs (- (-> arg0 crossvec 1 z) (-> gp-0 vector 0 w)))) + (< 0.001 (fabs (- (-> arg0 crossvec 1 w) (-> gp-0 vector 1 x)))) + (< 0.001 (fabs (- (-> arg0 crossvec 2 x) (-> gp-0 vector 1 y)))) + (< 0.001 (fabs (- (-> arg0 crossvec 2 y) (-> gp-0 vector 1 z)))) + (< 0.001 (fabs (- (-> arg0 crossvec 2 z) (-> gp-0 vector 1 w)))) + (< 0.001 (fabs (- (-> arg0 crossvec 2 w) (-> gp-0 vector 2 x)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 x) (-> gp-0 vector 2 y)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 y) (-> gp-0 vector 2 z)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 z) (-> gp-0 vector 2 w)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 w) (-> gp-0 trans x)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 1 x) (-> gp-0 trans y)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 1 y) (-> gp-0 trans z)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 1 z) (-> gp-0 trans w)))) + ) + (format *stdcon* "different~%") + (format *stdcon* "same~%") + ) + ) + ) + +;; 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)) + ) + (if (< f30-0 8192.0) + (* (/ 1.0 (- 1.0 (cos 21845.334))) (+ (- (cos 21845.334)) (cos (* 2.6666667 (- 8192.0 f30-0))))) + 1.0 + ) + ) + ) + +;; definition for function camera-slave-debug +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun camera-slave-debug ((arg0 camera-slave)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (when *display-camera-marks* + (if (-> *setting-control* cam-current use-point-of-interest) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (-> *setting-control* cam-current point-of-interest) + (new 'static 'vector4w :x #x80 :z #x80 :w #x80) + (the-as meters #x44800000) + ) + ) + (let ((f30-0 (* 0.5 (-> *camera-combiner* fov)))) + (camera-fov-frame + (-> *camera-combiner* inv-camera-rot) + (camera-pos) + f30-0 + 0.75 + 1.0 + (new 'static 'vector4w :z #xff :w #x80) + ) + ) + (cond + ((= (-> arg0 blend-to-type) (camera-blend-to-type unknown-2)) + (let ((f0-2 (* 0.5 (-> arg0 fov)))) + (camera-fov-frame + (the-as matrix (-> *camera-combiner* tracking)) + (-> arg0 trans) + f0-2 + 0.75 + 1.0 + (new 'static 'vector4w :y #xff :w #x80) + ) + ) + ) + (else + (let ((f0-4 (* 0.5 (-> arg0 fov)))) + (camera-fov-frame + (the-as matrix (-> arg0 tracking)) + (-> arg0 trans) + f0-4 + 0.75 + 1.0 + (new 'static 'vector4w :y #xff :w #x80) + ) + ) + ) + ) + (debug-draw-spline (-> arg0 position-spline)) + (let ((s5-1 (new-stack-vector0))) + (let ((s4-1 (new-stack-vector0))) + (new-stack-matrix0) + (cond + ((and (-> arg0 next-state) + (let ((v1-23 (-> arg0 next-state name))) + (or (= v1-23 'cam-fixed) (= v1-23 'cam-eye) (= v1-23 'cam-point-watch) (= v1-23 'cam-free-floating)) + ) + ) + (let ((v1-24 s5-1)) + (let ((a0-11 (-> arg0 trans)) + (a1-8 (-> *camera* local-down)) + (f0-5 4096.0) + ) + (.lvf vf2 (&-> a1-8 quad)) + (.lvf vf1 (&-> a0-11 quad)) + (let ((a0-12 f0-5)) + (.mov vf3 a0-12) + ) + ) + (.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-24 quad) vf4) + ) + (camera-line (-> arg0 trans) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + ) + ((= (-> arg0 blend-to-type) (camera-blend-to-type unknown-2)) + (camera-line + (-> *camera-combiner* tracking follow-pt) + (-> arg0 trans) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + (let ((v1-28 s5-1)) + (let ((a0-17 (-> *camera-combiner* tracking follow-pt)) + (a1-12 (-> *camera* local-down)) + (f0-6 4096.0) + ) + (.lvf vf2 (&-> a1-12 quad)) + (.lvf vf1 (&-> a0-17 quad)) + (let ((a0-18 f0-6)) + (.mov vf3 a0-18) + ) + ) + (.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-28 quad) vf4) + ) + (camera-line + (-> *camera-combiner* tracking follow-pt) + s5-1 + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + ) + (else + (camera-line + (-> arg0 tracking follow-pt) + (-> arg0 trans) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + (let ((v1-31 s5-1)) + (let ((a0-21 (-> arg0 tracking follow-pt)) + (a1-16 (-> *camera* local-down)) + (f0-7 4096.0) + ) + (.lvf vf2 (&-> a1-16 quad)) + (.lvf vf1 (&-> a0-21 quad)) + (let ((a0-22 f0-7)) + (.mov vf3 a0-22) + ) + ) + (.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-31 quad) vf4) + ) + (camera-line (-> arg0 tracking follow-pt) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + ) + ) + (set! (-> s4-1 quad) (-> arg0 trans quad)) + (cond + ((= (-> arg0 blend-to-type) (camera-blend-to-type unknown-2)) + (let ((v1-35 s5-1)) + (let ((a0-27 s4-1) + (a1-19 (-> *camera-combiner* tracking)) + (f0-8 2048.0) + ) + (.lvf vf2 (&-> a1-19 inv-mat vector 0 quad)) + (.lvf vf1 (&-> a0-27 quad)) + (let ((a0-28 f0-8)) + (.mov vf3 a0-28) + ) + ) + (.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-35 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :x #xff :w #x80)) + (let ((v1-36 s5-1)) + (let ((a0-30 s4-1) + (a1-22 (&-> *camera-combiner* stack 176)) + (f0-9 2048.0) + ) + (.lvf vf2 a1-22) + (.lvf vf1 (&-> a0-30 quad)) + (let ((a0-31 f0-9)) + (.mov vf3 a0-31) + ) + ) + (.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-36 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :y #xff :w #x80)) + (let ((v1-37 s5-1)) + (let ((a0-33 s4-1) + (a1-25 (&-> *camera-combiner* stack 192)) + (f0-10 2048.0) + ) + (.lvf vf2 a1-25) + (.lvf vf1 (&-> a0-33 quad)) + (let ((a0-34 f0-10)) + (.mov vf3 a0-34) + ) + ) + (.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-37 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80)) + ) + (else + (let ((v1-39 s5-1)) + (let ((a0-36 s4-1) + (a1-27 (-> arg0 tracking)) + (f0-11 2048.0) + ) + (.lvf vf2 (&-> a1-27 inv-mat vector 0 quad)) + (.lvf vf1 (&-> a0-36 quad)) + (let ((a0-37 f0-11)) + (.mov vf3 a0-37) + ) + ) + (.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-39 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :x #xff :w #x80)) + (let ((v1-40 s5-1)) + (let ((a0-39 s4-1) + (a1-29 (&-> arg0 stack 96)) + (f0-12 2048.0) + ) + (.lvf vf2 a1-29) + (.lvf vf1 (&-> a0-39 quad)) + (let ((a0-40 f0-12)) + (.mov vf3 a0-40) + ) + ) + (.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-40 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :y #xff :w #x80)) + (let ((v1-41 s5-1)) + (let ((a0-42 s4-1) + (a1-31 (&-> arg0 stack 112)) + (f0-13 2048.0) + ) + (.lvf vf2 a1-31) + (.lvf vf1 (&-> a0-42 quad)) + (let ((a0-43 f0-13)) + (.mov vf3 a0-43) + ) + ) + (.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-41 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80)) + ) + ) + ) + (vector--float*! + s5-1 + (-> *camera* tpos-curr) + (-> *camera* local-down) + (-> *setting-control* cam-current foot-offset) + ) + (camera-sphere s5-1 512.0 (new 'static 'vector4w :y #xff :w #x80)) + (vector--float*! + s5-1 + (-> *camera* tpos-curr) + (-> *camera* local-down) + (-> *setting-control* cam-current head-offset) + ) + (camera-sphere s5-1 512.0 (new 'static 'vector4w :y #xff :w #x80)) + ) + (cond + ((and (-> arg0 next-state) (= (-> arg0 next-state name) 'cam-string)) + (camera-sphere (-> arg0 desired-pos) 512.0 (new 'static 'vector4w :z #xff :w #x80)) + (camera-line-rel (-> *camera* tpos-curr-adj) (-> arg0 view-flat) (new 'static 'vector4w :z #xff :w #x80)) + (camera-line + (-> arg0 string-trans) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> arg0 los-tgt-spline-pt)))) + (new 'static 'vector4w :y #xff :w #x80) + ) + (camera-line + (-> arg0 los-last-pos) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> arg0 los-tgt-spline-pt)))) + (new 'static 'vector4w :x #xff :w #x80) + ) + ) + ((and (-> arg0 next-state) (= (-> arg0 next-state name) 'cam-circular)) + (let ((a1-45 (new-stack-vector0))) + (let ((v1-66 a1-45)) + (let ((a0-55 (-> arg0 pivot-pt)) + (a2-35 (-> *camera* local-down)) + (f0-16 4096.0) + ) + (.lvf vf2 (&-> a2-35 quad)) + (.lvf vf1 (&-> a0-55 quad)) + (let ((a0-56 f0-16)) + (.mov vf3 a0-56) + ) + ) + (.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-66 quad) vf4) + ) + (camera-line (-> arg0 pivot-pt) a1-45 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + ) + (camera-line (-> arg0 pivot-pt) (-> arg0 trans) (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + ) + ((and (-> arg0 next-state) (= (-> arg0 next-state name) 'cam-spline)) + (let ((s5-2 (new 'stack 'curve)) + (s4-2 (res-lump-struct (-> arg0 cam-entity) 'spline-offset structure)) + ) + (if (not s4-2) + (set! s4-2 (new-stack-vector0)) + ) + (when (get-curve-data! (-> arg0 cam-entity) s5-2 'campath 'campath-k -1000000000.0) + (let ((s3-0 (new-stack-vector0)) + (s2-0 (new-stack-vector0)) + (gp-1 (res-lump-data (-> arg0 cam-entity) 'campoints pointer :time 1.0)) + ) + (curve-get-pos! s2-0 0.0 s5-2) + (vector+! s2-0 s2-0 (the-as vector s4-2)) + (dotimes (s1-0 8) + (set! (-> s3-0 quad) (-> s2-0 quad)) + (curve-get-pos! s2-0 (* 0.125 (the float (+ s1-0 1))) s5-2) + (vector+! s2-0 s2-0 (the-as vector s4-2)) + (camera-line s3-0 s2-0 (new 'static 'vector4w :x #xff :y #xff :w #x80)) + ) + (dotimes (s1-1 (-> s5-2 num-cverts)) + (vector+! s3-0 (-> s5-2 cverts s1-1) (the-as vector s4-2)) + (vector+! s2-0 (-> s5-2 cverts (mod (+ s1-1 1) (-> s5-2 num-cverts))) (the-as vector s4-2)) + (camera-line s3-0 s2-0 (new 'static 'vector4w :y #xff :z #xff :w #x80)) + ) + (if gp-1 + (camera-line + (the-as vector (&+ gp-1 0)) + (the-as vector (&+ gp-1 16)) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + (camera-line + (-> s5-2 cverts 0) + (-> s5-2 cverts (+ (-> s5-2 num-cverts) -1)) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for function master-draw-coordinates +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun master-draw-coordinates ((arg0 vector)) + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (let ((a0-1 (new-stack-matrix0))) + (set-vector! s5-0 0.0 8192.0 0.0 1.0) + (matrix-rotate-yxz! a0-1 s5-0) + ) + (vector+! + gp-0 + (-> *camera-combiner* trans) + (vector-normalize-copy! gp-0 (-> *camera-combiner* inv-camera-rot vector 2) 24576.0) + ) + (let ((a1-4 s5-0) + (v1-4 gp-0) + (a0-3 s5-0) + ) + (set! (-> a0-3 x) 4096.0) + (set! (-> a0-3 y) 0.0) + (set! (-> a0-3 z) 0.0) + (set! (-> a0-3 w) 1.0) + (vector+! a1-4 v1-4 a0-3) + ) + (add-debug-line #t (bucket-id bucket-318) gp-0 s5-0 (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1)) + (let ((a1-7 s5-0) + (v1-5 gp-0) + (a0-5 s5-0) + ) + (set! (-> a0-5 x) 0.0) + (set! (-> a0-5 y) 4096.0) + (set! (-> a0-5 z) 0.0) + (set! (-> a0-5 w) 1.0) + (vector+! a1-7 v1-5 a0-5) + ) + (add-debug-line #t (bucket-id bucket-318) gp-0 s5-0 (new 'static 'rgba :g #xff :a #x80) #f (the-as rgba -1)) + (let ((a1-10 s5-0) + (v1-6 gp-0) + (a0-7 s5-0) + ) + (set! (-> a0-7 x) 0.0) + (set! (-> a0-7 y) 0.0) + (set! (-> a0-7 z) 4096.0) + (set! (-> a0-7 w) 1.0) + (vector+! a1-10 v1-6 a0-7) + ) + (add-debug-line #t (bucket-id bucket-318) gp-0 s5-0 (new 'static 'rgba :b #xff :a #x80) #f (the-as rgba -1)) + (when arg0 + (set! (-> s5-0 quad) (-> arg0 quad)) + (vector-normalize! s5-0 4096.0) + (vector+! s5-0 gp-0 s5-0) + (add-debug-line + #t + (bucket-id bucket-318) + gp-0 + s5-0 + (new 'static 'rgba :r #x7f :g #x7f :a #x80) + #f + (the-as rgba -1) + ) + ) + ) + 0 + (none) + ) + +;; definition of type cam-collision-record +(deftype cam-collision-record (structure) + ((pos vector :inline :offset-assert 0) + (vel vector :inline :offset-assert 16) + (desired-pos vector :inline :offset-assert 32) + (cam-tpos-cur vector :inline :offset-assert 48) + (cam-tpos-old vector :inline :offset-assert 64) + (view-flat vector :inline :offset-assert 80) + (string-min-val vector :inline :offset-assert 96) + (string-max-val vector :inline :offset-assert 112) + (view-off vector :inline :offset-assert 128) + (min-z-override float :offset-assert 144) + (string-push-z float :offset-assert 148) + (view-off-param float :offset-assert 152) + (frame int32 :offset-assert 156) + (iteration int32 :offset-assert 160) + (move-type symbol :offset-assert 164) + ) + :method-count-assert 9 + :size-assert #xa8 + :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) + ) + :method-count-assert 9 + :size-assert #x10 + :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. +(defun cam-collision-record-save ((arg0 vector) (arg1 vector) (arg2 int) (arg3 symbol) (arg4 camera-slave)) + (with-pp + (when *record-cam-collide-history* + (let ((v1-5 (the-as + cam-collision-record + (+ (+ (* 176 *cam-collision-record-last*) 12) (the-as int *cam-collision-record*)) + ) + ) + ) + (set! (-> v1-5 pos quad) (-> arg0 quad)) + (set! (-> v1-5 vel quad) (-> arg1 quad)) + (set! (-> v1-5 view-flat quad) (-> arg4 view-flat quad)) + (set! (-> v1-5 desired-pos quad) (-> arg4 desired-pos quad)) + (set! (-> v1-5 cam-tpos-cur quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> v1-5 cam-tpos-old quad) (-> *camera* tpos-old-adj quad)) + (set! (-> v1-5 string-min-val quad) (-> arg4 string-min-val quad)) + (set! (-> v1-5 string-max-val quad) (-> arg4 string-max-val quad)) + (set! (-> v1-5 view-off quad) (-> arg4 view-off quad)) + (set! (-> v1-5 frame) (the-as int (-> pp clock frame-counter))) + (set! (-> v1-5 iteration) arg2) + (set! (-> v1-5 move-type) arg3) + (set! (-> v1-5 min-z-override) (-> arg4 min-z-override)) + (set! (-> v1-5 string-push-z) (-> *camera* string-push-z)) + (set! (-> v1-5 view-off-param) (-> arg4 view-off-param)) + ) + (set! *cam-collision-record-show* *cam-collision-record-last*) + (set! *cam-collision-record-last* (+ *cam-collision-record-last* 1)) + (set! *cam-collision-record-last* (mod *cam-collision-record-last* 600)) + (when (= *cam-collision-record-last* *cam-collision-record-first*) + (set! *cam-collision-record-first* (+ *cam-collision-record-first* 1)) + (set! *cam-collision-record-first* (mod *cam-collision-record-first* 600)) + ) + ) + 0 + (none) + ) + ) + +;; definition for function cam-collision-record-step +;; INFO: 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) + (set! *cam-collision-record-show* (+ *cam-collision-record-show* -600)) + ) + (while (< *cam-collision-record-show* 0) + (set! *cam-collision-record-show* (+ *cam-collision-record-show* 600)) + ) + 0 + (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 +(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) + ) + ((cpad-hold? 0 right) + (cam-collision-record-step 1) + ) + ((cpad-pressed? 0 up) + (cam-collision-record-step -1) + ) + ((cpad-hold? 0 left) + (cam-collision-record-step -1) + ) + ) + (let ((s5-0 (the-as object (+ (+ (* 176 *cam-collision-record-show*) 12) (the-as int *cam-collision-record*)))) + (s4-0 (new 'stack 'vector4w)) + (gp-0 (new 'stack 'vector4w)) + ) + (format *stdcon* "move-type ~A~%" (-> (the-as cam-collision-record s5-0) move-type)) + (cond + ((= (-> (the-as cam-collision-record s5-0) move-type) 'normal) + (set! (-> s4-0 x) 255) + (set! (-> s4-0 y) 255) + ) + ((= (-> (the-as cam-collision-record s5-0) move-type) 'jump) + (set! (-> s4-0 x) 255) + ) + ((= (-> (the-as cam-collision-record s5-0) move-type) 'no-hit) + (set! (-> s4-0 y) 255) + ) + (else + (set! (-> s4-0 z) 255) + ) + ) + (set! (-> s4-0 w) 128) + (set! (-> gp-0 x) 127) + (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) + ) + (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)) + ) + (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 + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function camera-master-debug +;; INFO: Return type mismatch int vs none. +(defun camera-master-debug ((arg0 camera-master)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (when *display-cam-other* + (let ((f0-1 (* 0.5 (-> *camera-other-fov* data)))) + (camera-fov-frame + *camera-other-matrix* + *camera-other-trans* + f0-1 + 0.75 + 1.0 + (new 'static 'vector4w :x #xff :w #x80) + ) + ) + (camera-line *camera-other-trans* *camera-other-root* (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 *camera-other-trans*) + ) + (let ((v1-5 s4-0)) + (let ((a0-3 s5-0) + (a1-3 (-> *camera-other-matrix* vector)) + (f0-2 2048.0) + ) + (.lvf vf2 (&-> a1-3 0 quad)) + (.lvf vf1 (&-> a0-3 quad)) + (let ((a0-4 f0-2)) + (.mov vf3 a0-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 (&-> v1-5 quad) vf4) + ) + (camera-line s5-0 s4-0 (new 'static 'vector4w :x #xff :w #x80)) + (let ((v1-6 s4-0)) + (let ((a0-6 s5-0) + (a1-6 (-> *camera-other-matrix* vector 1)) + (f0-3 2048.0) + ) + (.lvf vf2 (&-> a1-6 quad)) + (.lvf vf1 (&-> a0-6 quad)) + (let ((a0-7 f0-3)) + (.mov vf3 a0-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 (&-> v1-6 quad) vf4) + ) + (camera-line s5-0 s4-0 (new 'static 'vector4w :y #xff :w #x80)) + (let ((v1-7 s4-0)) + (let ((a0-9 s5-0) + (a1-9 (-> *camera-other-matrix* vector 2)) + (f0-4 2048.0) + ) + (.lvf vf2 (&-> a1-9 quad)) + (.lvf vf1 (&-> a0-9 quad)) + (let ((a0-10 f0-4)) + (.mov vf3 a0-10) + ) + ) + (.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-7 quad) vf4) + ) + (camera-line s5-0 s4-0 (new 'static 'vector4w :z #xff :w #x80)) + ) + ) + (when *display-camera-last-attacker* + (format *stdcon* "last attacker '") + (let ((v1-13 (handle->process (-> last-try-to-look-at-data who)))) + (if v1-13 + (format *stdcon* "~S" (-> v1-13 name)) + ) + ) + (format *stdcon* "'~%") + ) + (when *display-camera-old-stats* + (format + *stdcon* + "old ~S cpu ~D old vu ~D (go to menu before comparing)~%" + *camera-old-level* + *camera-old-cpu* + *camera-old-vu* + ) + (format *stdcon* "old tfrag-mem ~D~%" (sar *camera-old-tfrag-bytes* 10)) + (format *stdcon* "~S~%" *camera-old-stat-string-tfrag-near*) + (format *stdcon* "~S~%" *camera-old-stat-string-tfrag*) + (format *stdcon* "~S~%" *camera-old-stat-string-total*) + ) + (if *display-cam-collide-history* + (cam-collision-record-draw) + ) + (if *display-cam-master-marks* + (debug-draw-spline (-> arg0 target-spline)) + ) + (if *display-xyz-axes* + (master-draw-coordinates (the-as vector #f)) + ) + (cam-debug-draw-tris) + 0 + (none) + ) + ) + +;; 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)) + (let* ((v1-6 (-> *camera-combiner* inv-camera-rot)) + (a3-0 arg1) + (a0-3 (-> a3-0 vector 0 quad)) + (a1-1 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-6 vector 0 quad) a0-3) + (set! (-> v1-6 vector 1 quad) a1-1) + (set! (-> v1-6 vector 2 quad) a2-0) + (set! (-> v1-6 trans quad) a3-1) + ) + (set-setting-by-param *setting-control* 'mode-name 'cam-fixed 0 0) + (cam-master-activate-slave #t) + ) + arg0 + ) + +;; definition (debug) for function cam-restore +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun-debug cam-restore () + (let ((a0-0 (new-stack-vector0)) + (a1-0 (new-stack-matrix0)) + ) + (set! (-> a0-0 x) 1538892.5) + (set! (-> a0-0 y) -274716.78) + (set! (-> a0-0 z) -8318042.5) + (set! (-> a0-0 w) 1.0) + (set! (-> a1-0 vector 0 x) 0.4915) + (set! (-> a1-0 vector 0 y) 0.0) + (set! (-> a1-0 vector 0 z) -0.8708) + (set! (-> a1-0 vector 0 w) 0.0) + (set! (-> a1-0 vector 1 x) 0.7179) + (set! (-> a1-0 vector 1 y) 0.5659) + (set! (-> a1-0 vector 1 z) 0.4052) + (set! (-> a1-0 vector 1 w) 0.0) + (set! (-> a1-0 vector 2 x) 0.4928) + (set! (-> a1-0 vector 2 y) -0.8244) + (set! (-> a1-0 vector 2 z) 0.2782) + (set! (-> a1-0 vector 2 w) 0.0) + (set! (-> a1-0 trans x) 0.0) + (set! (-> a1-0 trans y) 0.0) + (set! (-> a1-0 trans z) 0.0) + (set! (-> a1-0 trans w) 1.0) + (debug-set-camera-pos-rot! a0-0 a1-0) + ) + (send-event *camera* 'set-fov #x46360b61) + (clear *camera-old-level*) + (format *camera-old-level* "dig3a") + (set! *camera-old-cpu* 4815) + (set! *camera-old-vu* 6110) + (set! *camera-old-tfrag-bytes* #xa0130) + (clear *camera-old-stat-string-tfrag*) + (clear *camera-old-stat-string-tfrag-near*) + (clear *camera-old-stat-string-total*) + (set! *display-camera-old-stats* #t) + (set! (-> *tfrag-work* min-fragment) (the-as uint 318)) + (set! (-> *tfrag-work* max-fragment) (the-as uint 319)) + (none) + ) + +) + + + diff --git a/goal_src/jak2/engine/camera/cam-interface.gc b/goal_src/jak2/engine/camera/cam-interface.gc index 8ee3b33f2c..12b64ddeaa 100644 --- a/goal_src/jak2/engine/camera/cam-interface.gc +++ b/goal_src/jak2/engine/camera/cam-interface.gc @@ -7,3 +7,116 @@ ;; DECOMP BEGINS +(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (vector-float*! arg0 (-> *math-camera* inv-camera-rot vector 2) arg1) + (let ((v1-2 arg0)) + (let ((a1-1 arg0) + (a3-3 (-> *math-camera* inv-camera-rot vector 1)) + (f0-1 arg2) + ) + (.lvf vf2 (&-> a3-3 quad)) + (.lvf vf1 (&-> a1-1 quad)) + (let ((a1-2 f0-1)) + (.mov vf3 a1-2) + ) + ) + (.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-2 quad) vf4) + ) + (vector+! arg0 arg0 (-> *math-camera* trans)) + arg0 + ) + ) + +(defun position-in-front-of-screen! ((arg0 vector) (arg1 float) (arg2 vector)) + (let ((a2-1 (vector-negate! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot vector 2))) + (a1-3 (vector-float*! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot vector 2) arg1)) + ) + (vector+! (the-as vector a1-3) (the-as vector a1-3) (-> *math-camera* trans)) + (reverse-transform-point! arg0 (the-as vector a1-3) a2-1 arg2) + ) + arg0 + ) + +(defun matrix-local->world ((smooth? symbol)) + "Returns [[*math-camera*]]'s `inv-camera-rot-smooth` if `smooth?` is true, else return `inv-camera-rot`" + (if smooth? + (-> *math-camera* inv-camera-rot-smooth) + (-> *math-camera* inv-camera-rot) + ) + ) + +(defun matrix-world->local () + "Returns [[*math-camera*]]'s `camera-rot`" + (-> *math-camera* camera-rot) + ) + +(define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector))) + +(defun camera-pos () + "Returns the `trans` vector from whatever is first determined to exist: + - [[*camera-combiner*]] + - [[*math-camera*]] + - else, [[*camera-dummy-vector*]]" + (cond + (*camera-combiner* + (-> *camera-combiner* trans) + ) + (*math-camera* + (-> *math-camera* trans) + ) + (else + *camera-dummy-vector* + ) + ) + ) + +(defun math-camera-pos () + "Returns [[*math-camera*]]'s `trans`" + (-> *math-camera* trans) + ) + +(defun camera-matrix () + "If [[*camera-combiner*]] exists, return it's `inv-camera-rot`. Else, return [[*math-camera*]]'s" + (if *camera-combiner* + (-> *camera-combiner* inv-camera-rot) + (-> *math-camera* inv-camera-rot) + ) + ) + +(defun math-camera-matrix () + "Returns [[*math-camera*]]'s `inv-camera-rot`" + (-> *math-camera* inv-camera-rot) + ) + +(defun camera-angle () + (let ((f0-0 (-> *math-camera* camera-rot vector 0 x)) + (f1-0 (-> *math-camera* camera-rot vector 0 z)) + ) + (atan f1-0 f0-0) + ) + ) + +(defbehavior camera-teleport-to-entity process ((arg0 entity-actor)) + (let ((gp-0 (new 'stack 'transformq))) + (set! (-> gp-0 trans quad) (-> arg0 extra trans quad)) + (quaternion-copy! (-> gp-0 quat) (-> arg0 quat)) + (vector-identity! (-> gp-0 scale)) + (send-event *camera* 'teleport-to-transformq gp-0) + ) + (none) + ) + + + + diff --git a/goal_src/jak2/engine/camera/cam-start.gc b/goal_src/jak2/engine/camera/cam-start.gc index 64a87b98ef..cd96fb4ed7 100644 --- a/goal_src/jak2/engine/camera/cam-start.gc +++ b/goal_src/jak2/engine/camera/cam-start.gc @@ -7,3 +7,47 @@ ;; DECOMP BEGINS +(defun cam-stop () + (kill-by-name "camera-master" *active-pool*) + (kill-by-name "camera-slave" *active-pool*) + (kill-by-name "camera-combiner" *active-pool*) + (set! *camera* #f) + (set! *camera-combiner* #f) + #f + ) + +(defun cam-start ((arg0 symbol)) + (cam-stop) + (set! *camera-combiner* + (the-as camera-combiner (ppointer->process (process-spawn + camera-combiner + :init cam-combiner-init + :name (symbol->string (-> camera-combiner symbol)) + :from *camera-dead-pool* + :to *camera-pool* + ) + ) + ) + ) + (set! *camera* (the-as camera-master (ppointer->process (process-spawn + camera-master + :init cam-master-init + :name (symbol->string (-> camera-master symbol)) + :from *camera-master-dead-pool* + :to *camera-pool* + ) + ) + ) + ) + (if arg0 + (reset-cameras) + ) + 0 + (none) + ) + +(cam-start #f) + + + + diff --git a/goal_src/jak2/engine/camera/cam-states-dbg.gc b/goal_src/jak2/engine/camera/cam-states-dbg.gc index 631af465b9..31c16049a0 100644 --- a/goal_src/jak2/engine/camera/cam-states-dbg.gc +++ b/goal_src/jak2/engine/camera/cam-states-dbg.gc @@ -7,3 +7,487 @@ ;; DECOMP BEGINS +(deftype cam-point-watch-bank (basic) + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(define *CAM_POINT_WATCH-bank* (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6))) + +(defstate cam-point-watch (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self pivot-rad) 40960.0) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + ) + (none) + ) + :code (behavior () + (until #f + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 -1.0)) + (f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 -1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 -1.0)) + (f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 -1.0)) + ) + (cond + ((cpad-hold? (-> *CAMERA-bank* joypad) r2) + (set! (-> s5-0 y) (- (-> s5-0 y) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) + (set! (-> s5-0 x) (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) + (+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) + ) + (else + (set! (-> s5-0 y) (- (-> s5-0 y) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) + (set! (-> s5-0 x) (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) + (+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) + ) + ) + ) + (let ((s4-0 (new-stack-vector0))) + (let ((s3-0 (new-stack-matrix0))) + (matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x))) + (vector-matrix*! s4-0 (the-as vector (&-> self stack 112)) s3-0) + (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) + (vector-matrix*! s4-0 s4-0 s3-0) + ) + (forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down)) + ) + (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) + (if (< (-> self pivot-rad) 4096.0) + (set! (-> self pivot-rad) 4096.0) + ) + (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) + (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))) + ) + ) + (suspend) + 0 + ) + #f + (none) + ) + ) + +(deftype cam-free-bank (basic) + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(define *CAM_FREE-bank* (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6))) + +(defun cam-mouse-input ((arg0 vector) (arg1 vector)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 (the-as vector (-> *mouse* pos)) (-> *mouse* pos 1)) + (cond + ((logtest? (-> *mouse* button0-abs 0) 1) + (let ((a0-7 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! a0-7 (-> *math-camera* trans) (-> *setting-control* cam-current mouse-tumble-point)) + (let ((f30-0 (vector-length a0-7))) + (cond + (#f + (let* ((f28-0 (* 0.01 f30-0 (-> v1-0 x))) + (f26-0 (* 0.01 f30-0 (-> v1-0 y))) + (f0-5 f28-0) + (f0-7 (* f0-5 f0-5)) + (f1-2 f26-0) + (f0-8 (+ f0-7 (* f1-2 f1-2))) + (f1-5 f30-0) + (f22-0 (- (sqrtf (+ f0-8 (* f1-5 f1-5))) f30-0)) + (f24-0 (atan f26-0 f30-0)) + (f0-12 (atan (- f28-0) f30-0)) + ) + (+! (-> arg1 x) f28-0) + (+! (-> arg1 y) f26-0) + (+! (-> arg1 z) f22-0) + (+! (-> arg0 x) f24-0) + (let ((f0-13 (+ (-> arg0 y) f0-12))) + (set! (-> arg0 y) f0-13) + f0-13 + ) + ) + ) + (else + (+! (-> arg0 y) (* (- (-> v1-0 x)) (-> *CAM_FREE-bank* rot-speed))) + (let ((f0-17 (+ (-> arg0 x) (* (-> v1-0 y) (-> *CAM_FREE-bank* rot-speed))))) + (set! (-> arg0 x) f0-17) + f0-17 + ) + ) + ) + ) + ) + ) + ((logtest? (-> *mouse* button0-abs 0) 2) + (+! (-> arg1 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) + (let ((f0-21 (+ (-> arg1 z) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))))) + (set! (-> arg1 z) f0-21) + f0-21 + ) + ) + ((logtest? (-> *mouse* button0-abs 0) 4) + (+! (-> arg1 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) + (let ((f0-25 (+ (-> arg1 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))))) + (set! (-> arg1 y) f0-25) + f0-25 + ) + ) + ) + ) + ) + +(defun cam-free-floating-input ((arg0 vector) (arg1 vector) (arg2 symbol) (arg3 int)) + (with-pp + (the-as + vector + (when *camera* + (if (-> *setting-control* cam-current mouse-input) + (cam-mouse-input arg0 arg1) + ) + (let ((s3-0 (and (-> *setting-control* cam-current cpad1-skip-buttons) (= arg3 1)))) + (when (not s3-0) + (when (and (!= *master-mode* 'menu) (not *cam-layout*)) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 x) + (set! (-> arg0 x) + (- (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 6)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 triangle) + (+! (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 4)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 square) + (+! (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 7)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 circle) + (set! (-> arg0 y) + (- (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 5)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + ) + (when arg2 + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 l2) + (+! (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 10)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 r2) + (set! (-> arg0 z) + (- (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 11)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + ) + (when (nonzero? arg3) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 left) + (+! (-> arg1 x) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 1)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 right) + (set! (-> arg1 x) + (- (-> arg1 x) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 0)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 up) + (+! (-> arg1 z) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 2)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 down) + (set! (-> arg1 z) + (- (-> arg1 z) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 3)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + ) + ) + (cond + ((logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)) + ) + ((cpad-hold? arg3 r2) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 r1) + (+! (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 9)) + 0.0 + 32.0 + 230.0 + (* 0.2 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 l1) + (set! (-> arg1 y) + (- (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 8)) + 0.0 + 32.0 + 230.0 + (* 0.2 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + ) + ) + (else + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 r1) + (+! (-> arg1 y) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 l1) + (set! (-> arg1 y) + (- (-> arg1 y) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + ) + ) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f28-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 leftx)) 128.0 48.0 110.0 -1.0)) + (f30-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 lefty)) 128.0 48.0 110.0 -1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) + (f0-60 (analog-input (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) + ) + (cond + ((and (not s3-0) (cpad-hold? arg3 r2)) + (cond + ((cpad-hold? arg3 l2) + (set! (-> arg0 y) (- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) + (set! (-> arg0 x) (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f0-60)))) + ) + (else + (set! (-> arg0 y) (- (-> arg0 y) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed)))) + (set! (-> arg0 x) (- (-> arg0 x) (* (- f0-60) (-> *CAM_FREE-bank* rot-speed)))) + ) + ) + (+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14)) + ) + ((and (not s3-0) (cpad-hold? arg3 l2)) + (+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed))) + (+! (-> arg1 y) (* f0-60 (-> *CAM_FREE-bank* speed))) + (+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed))) + ) + (else + (set! (-> arg0 y) (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) + (set! (-> arg0 x) (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f0-60)))) + (+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14)) + ) + ) + ) + ) + ) + (vector-float*! arg0 arg0 (-> pp clock time-adjust-ratio)) + (vector-float*! arg1 arg1 (-> pp clock time-adjust-ratio)) + ) + ) + ) + ) + +(deftype camera-free-floating-move-info (structure) + ((rv vector :inline :offset-assert 0) + (tv vector :inline :offset-assert 16) + (up vector :inline :offset-assert 32) + (tm matrix :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + + +(defun cam-free-floating-move ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int)) + (if (logtest? (-> *cpad-list* cpads arg3 valid) 128) + (return (the-as vector #f)) + ) + (if (= *master-mode* 'menu) + (return (the-as vector #f)) + ) + (let ((s3-0 (new 'stack 'camera-free-floating-move-info))) + (cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3) + (cond + (arg2 + (matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y)) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (cond + ((< (vector-dot (-> arg0 vector 1) arg2) 0.0) + (forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2) + ) + (else + (vector-negate! (-> s3-0 up) arg2) + (forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up)) + ) + ) + ) + (else + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + ) + ) + (matrix-axis-angle! (-> s3-0 tm) (the-as vector (-> arg0 vector)) (- (-> s3-0 rv x))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0) + (vector+! arg1 arg1 (-> s3-0 tv)) + ) + ) + +(defstate cam-free-floating (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + (send-event *camera-combiner* 'stop-tracking) + ) + (none) + ) + :code (behavior () + (until #f + (let ((a2-0 (-> *camera* local-down))) + (if (logtest? (-> self options) 8) + (set! a2-0 (the-as vector #f)) + ) + (cam-free-floating-move + (the-as matrix (-> self tracking)) + (-> self trans) + a2-0 + (the-as int (-> *CAMERA-bank* joypad)) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + + + + diff --git a/goal_src/jak2/engine/camera/cam-states.gc b/goal_src/jak2/engine/camera/cam-states.gc index 58c7ecea1b..c20f0301df 100644 --- a/goal_src/jak2/engine/camera/cam-states.gc +++ b/goal_src/jak2/engine/camera/cam-states.gc @@ -5,5 +5,2222 @@ ;; name in dgo: cam-states ;; dgos: ENGINE, GAME +;; TODO: +;; og:ignore-form:cam-circular-code +;; og:ignore-form:cam-circular +;; og:ignore-form:cam-bike-code +;; og:ignore-form:cam-stick-code +;; og:ignore-form:cam-string-code +(define-extern cam-string-code (function vector :behavior camera-slave)) +;; og:ignore-form:cam-string-line-of-sight +;; og:ignore-form:cam-string-joystick +;; og:ignore-form:cam-circular-code +;; og:ignore-form:cam-circular-position +;; og:ignore-form:cam-los-collide +;; og:ignore-form:cam-stick +;; og:ignore-form:cam-bike + ;; DECOMP BEGINS +(defstate cam-really-fixed (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (none) + ) + :code (behavior () + (until #f + (suspend) + ) + #f + (none) + ) + ) + +(defstate cam-fixed (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) + (when (!= (-> gp-0 w) 0.0) + (vector-normalize! gp-0 1.0) + (forward-down->inv-matrix (the-as matrix (-> self tracking)) gp-0 (-> *camera* local-down)) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defstate cam-fixed-read-entity (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self trans) 'trans) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (cam-curve-setup (-> self trans)) + ((-> cam-fixed enter)) + ) + (else + (format #t "ERROR : cam-fixed-read-entity enter without entity~%") + ) + ) + (go cam-fixed) + (none) + ) + :code (behavior () + (until #f + (format *stdcon* "ERROR : stayed in cam-fixed-read-entity~%") + (suspend) + ) + #f + (none) + ) + ) + +(defstate cam-pov (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + ) + (none) + ) + :trans (behavior () + (when (not (handle->process (-> *camera* settings pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (vector<-cspace! (-> self trans) (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + ) + ) + (let* ((v1-6 (-> self tracking)) + (a3-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + transform + ) + ) + (a0-9 (-> a3-0 vector 0 quad)) + (a1-11 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-6 inv-mat vector 0 quad) a0-9) + (set! (-> v1-6 inv-mat vector 1 quad) a1-11) + (set! (-> v1-6 inv-mat vector 2 quad) a2-0) + (set! (-> v1-6 inv-mat trans quad) a3-1) + ) + (vector-reset! (-> self tracking inv-mat trans)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-matrix*! gp-0 (-> *camera* settings pov-offset) (the-as matrix (-> self tracking))) + (vector+! (-> self trans) (-> self trans) gp-0) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defstate cam-pov180 (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + ) + (none) + ) + :trans (behavior () + (when (not (handle->process (-> *camera* settings pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 #t) + ) + (vector<-cspace! gp-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + ) + ) + (let ((v1-13 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + transform + ) + ) + ) + (vector-normalize-copy! s5-0 (-> v1-13 vector 2) 1.0) + ) + (until #f + (when (not (paused?)) + (let ((s0-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + transform + ) + ) + (s1-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + scale + ) + ) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector<-cspace! + s2-0 + (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + ) + ) + (vector-normalize-copy! s3-0 (-> s0-0 vector 2) 1.0) + (set! s4-0 + (cond + ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos 3640.889) (vector-dot s5-0 s3-0))) + (set! (-> self trans quad) (-> s2-0 quad)) + (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) + (set! (-> (the-as vector (&-> self stack 96)) quad) (-> s0-0 vector 1 quad)) + (vector-negate! (the-as vector (&-> self stack 112)) (-> s0-0 vector 2)) + (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) 1.0))) + (vector-float*! (the-as vector (-> self tracking)) (the-as vector (-> self tracking)) (/ 1.0 (-> s1-0 x))) + (vector-reset! (-> self tracking inv-mat trans)) + (if s4-0 + (set! s4-0 #f) + ) + s4-0 + ) + (else + #t + ) + ) + ) + (set! (-> gp-0 quad) (-> s2-0 quad)) + ) + (set! (-> s5-0 quad) (-> s3-0 quad)) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + +(defstate cam-pov-track (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + (none) + ) + :trans (behavior () + (if (or (not (handle->process (-> *camera* settings pov-handle))) (zero? (logand (-> *camera* master-options) 1))) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (set! (-> self fov) (-> *camera* settings fov)) + (vector<-cspace! (-> self trans) (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + ) + ) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((a2-0 (new 'stack-no-clear 'matrix))) + (let* ((v1-8 a2-0) + (t0-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + transform + ) + ) + (a0-9 (-> t0-0 vector 0 quad)) + (a1-11 (-> t0-0 vector 1 quad)) + (a3-0 (-> t0-0 vector 2 quad)) + (t0-1 (-> t0-0 trans quad)) + ) + (set! (-> v1-8 vector 0 quad) a0-9) + (set! (-> v1-8 vector 1 quad) a1-11) + (set! (-> v1-8 vector 2 quad) a3-0) + (set! (-> v1-8 trans quad) t0-1) + ) + (vector-reset! (-> a2-0 trans)) + (vector-matrix*! gp-0 (-> *camera* settings pov-offset) a2-0) + ) + (vector+! (-> self trans) (-> self trans) gp-0) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defbehavior cam-standoff-calc-trans camera-slave () + (if (-> self tracking no-follow) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (vector+! (-> self trans) (-> self tracking follow-pt) (-> self pivot-pt)) + ) + ) + +(defstate cam-standoff (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'set-standoff-dist) + (vector-normalize! (-> self pivot-pt) (the-as float (-> arg3 param 0))) + (cam-standoff-calc-trans) + ) + ((= v1-0 'set-standoff-height) + (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) + (vector--float*! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + (the-as float (-> arg3 param 0)) + ) + (cam-standoff-calc-trans) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (vector-! (-> self pivot-pt) (-> self trans) (-> *camera* tpos-curr-adj)) + (cond + ((logtest? (-> self options) #x4000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (else + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + ) + ) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (cam-standoff-calc-trans) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defstate cam-standoff-read-entity (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + ) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) s5-0 'align) + (vector-! (-> self pivot-pt) gp-0 s5-0) + ) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) + (if (logtest? (-> self options) #x4000) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (set! (-> self tracking tilt-adjust target) + (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) + ) + ) + ((-> cam-standoff enter)) + ) + (else + (format #t "ERROR : cam-standoff-read-entity enter without entity~%") + ) + ) + (go cam-standoff) + (none) + ) + :code (behavior () + (until #f + (format *stdcon* "ERROR : stayed in cam-standoff-read-entity~%") + (suspend) + ) + #f + (none) + ) + ) + +(deftype cam-eye-bank (basic) + ((rot-speed float :offset-assert 4) + (max-degrees float :offset-assert 8) + (max-fov float :offset-assert 12) + (min-fov float :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + + +(define *CAM_EYE-bank* + (new 'static 'cam-eye-bank :rot-speed 364.0889 :max-degrees 12743.111 :max-fov 11650.845 :min-fov 6189.511) + ) + +(defstate cam-eye (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (let ((v1-3 + (vector-float*! (new-stack-vector0) (-> *camera* local-down) (+ 1024.0 (-> *camera* settings target-height))) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) (the-as vector v1-3)) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (set! (-> self fov) 11650.845) + (none) + ) + :exit (behavior () + (if (and *target* + (logtest? (-> *camera* master-options) 1) + (logtest? (-> *target* focus-status) (focus-status fs8)) + ) + (send-event *target* 'end-mode) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (go cam-free-floating) + ) + (none) + ) + :code (behavior () + (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 (-> self clock frame-counter))) + (until #f + (when (not (paused?)) + (let ((s4-0 (vector-reset! (new-stack-vector0))) + (s5-0 (new-stack-matrix0)) + ) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f30-0 (analog-input + (the-as int (+ (-> *cpad-list* cpads 0 rightx) -256 (-> *cpad-list* cpads 0 leftx))) + 0.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f0-0 (analog-input + (the-as int (+ (-> *cpad-list* cpads 0 righty) -256 (-> *cpad-list* cpads 0 lefty))) + 0.0 + 48.0 + 110.0 + -1.0 + ) + ) + ) + (set! (-> s4-0 y) (- (-> s4-0 y) (* (- f30-0) (-> *CAM_EYE-bank* rot-speed)))) + (set! (-> s4-0 x) (- (-> s4-0 x) (* (- f0-0) (-> *CAM_EYE-bank* rot-speed)))) + ) + ) + (cond + ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 x)) + (set! (-> s4-0 x) (-> *CAM_EYE-bank* rot-speed)) + ) + ((< (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + (set! (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + ) + ) + (cond + ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 y)) + (set! (-> s4-0 y) (-> *CAM_EYE-bank* rot-speed)) + ) + ((< (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + (set! (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + ) + ) + (cond + ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) + (set! gp-0 (-> self clock frame-counter)) + ) + (else + (let ((v1-39 (min 10 (max 1 (- (-> self clock frame-counter) gp-0))))) + (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-39))) + ) + ) + ) + (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) + (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + (when (zero? (logand (-> self options) 8)) + (if (< (vector-dot (the-as vector (&-> self stack 96)) (-> *camera* local-down)) 0.0) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + (the-as vector (&-> self stack 112)) + (-> *camera* local-down) + ) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + (the-as vector (&-> self stack 112)) + (vector-negate! (new-stack-vector0) (-> *camera* local-down)) + ) + ) + ) + (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) + (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + ) + (when (zero? (logand (-> self options) 8)) + (let ((f30-1 (vector-dot (-> *camera* local-down) (the-as vector (&-> self stack 112))))) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (when (< (sin (-> *CAM_EYE-bank* max-degrees)) (fabs f30-1)) + (vector--float*! + (the-as vector (&-> self stack 112)) + (the-as vector (&-> self stack 112)) + (-> *camera* local-down) + f30-1 + ) + (vector-normalize! (the-as vector (&-> self stack 112)) (cos (-> *CAM_EYE-bank* max-degrees))) + (cond + ((< f30-1 0.0) + (vector--float*! + (the-as vector (&-> self stack 112)) + (the-as vector (&-> self stack 112)) + (-> *camera* local-down) + (sin (-> *CAM_EYE-bank* max-degrees)) + ) + ) + (else + (let ((s5-3 (&-> self stack 112))) + (let ((s4-3 (&-> self stack 112)) + (s3-2 (-> *camera* local-down)) + (f0-30 (sin (-> *CAM_EYE-bank* max-degrees))) + ) + (.lvf vf2 (&-> s3-2 quad)) + (.lvf vf1 s4-3) + (let ((v1-67 f0-30)) + (.mov vf3 v1-67) + ) + ) + (.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 (the-as (pointer uint128) (&-> s5-3 0)) vf4) + ) + ) + ) + (vector-cross! + (the-as vector (&-> self stack 96)) + (the-as vector (&-> self stack 112)) + (the-as vector (-> self tracking)) + ) + (set! (-> self tracking inv-mat vector 1 w) 0.0) + ) + ) + ) + ) + (let ((v1-71 + (vector-float*! (new-stack-vector0) (-> *camera* local-down) (+ 1024.0 (-> *camera* settings target-height))) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) (the-as vector v1-71)) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + ) + +(defstate cam-spline (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0))) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) + (if (logtest? (-> self options) #x4000) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (set! (-> self tracking tilt-adjust target) + (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) + ) + ) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) + (cam-curve-setup gp-0) + ) + (vector-negate! (-> self saved-pt) (-> self spline-offset)) + (let ((a0-8 (res-lump-struct (-> self cam-entity) 'spline-offset structure))) + (if a0-8 + (vector+! (-> self spline-offset) (-> self spline-offset) (the-as vector a0-8)) + ) + ) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (set! (-> self spline-follow-dist) (cam-slave-get-float (-> self cam-entity) 'spline-follow-dist 0.0)) + (cond + ((< 0.0 (-> self spline-follow-dist)) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + ) + (curve-get-pos! s5-1 0.0 (-> self spline-curve)) + (curve-get-pos! gp-1 1.0 (-> self spline-curve)) + (if (< (vector-vector-distance-squared s5-1 (-> self tracking follow-pt)) + (vector-vector-distance-squared gp-1 (-> self tracking follow-pt)) + ) + (set! (-> self spline-follow-dist) (- (-> self spline-follow-dist))) + ) + ) + (set! (-> self spline-tt) (curve-closest-point + (-> self spline-curve) + (-> self tracking follow-pt) + 0.5 + -4096.0 + 10 + (-> self spline-follow-dist) + ) + ) + ) + (else + (set! (-> self spline-follow-dist) 0.0) + ) + ) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + (cond + ((logtest? (-> self options) #x4000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (else + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + ) + ) + (else + (format #t "ERROR : cam-spline enter without entity~%") + ) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (new 'stack 'curve) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defstate cam-decel (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (when (!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! s5-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve)) + (+! (-> *camera* outro-t) (* (-> *camera* outro-t-step) (-> self clock time-adjust-ratio))) + (curve-get-pos! gp-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve)) + (vector-! gp-0 gp-0 s5-0) + (cond + ((or (and (< (-> *camera* outro-t-step) 0.0) (>= (-> *camera* outro-exit-value) (-> *camera* outro-t))) + (and (< 0.0 (-> *camera* outro-t-step)) (>= (-> *camera* outro-t) (-> *camera* outro-exit-value))) + ) + (set! (-> *camera* outro-t) (-> *camera* outro-exit-value)) + (set! (-> *camera* outro-t-step) 0.0) + (vector+! (-> self velocity) (-> self velocity) gp-0) + (send-event *camera* 'outro-done) + ) + (else + (vector+! (-> self trans) (-> self trans) gp-0) + ) + ) + ) + ) + (vector-float*! (-> self velocity) (-> self velocity) 0.9) + (vector+! (-> self trans) (-> self trans) (-> self velocity)) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defstate cam-endlessfall (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'cam-vector-seeker)) + (f30-0 (-> self velocity y)) + ) + (let ((a1-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-0 quad) (-> self trans quad)) + (set! (-> a1-0 y) 0.0) + (set! (-> s5-0 quad) (-> self velocity quad)) + (set! (-> s5-0 y) 0.0) + (init gp-0 a1-0 81.92 (fmax 819.2 (vector-length s5-0)) 0.75) + (set! (-> gp-0 vel quad) (-> s5-0 quad)) + ) + (until #f + (when (not (paused?)) + (set! (-> gp-0 target x) (-> (target-pos 0) x)) + (set! (-> gp-0 target z) (-> (target-pos 0) z)) + (update! gp-0 (the-as vector #f)) + (when (< 819.2 (-> gp-0 max-vel)) + (set! (-> gp-0 max-vel) (* 0.9 (-> gp-0 max-vel))) + (if (< (-> gp-0 max-vel) 819.2) + (set! (-> gp-0 max-vel) 819.2) + ) + ) + (set! f30-0 (* 0.9 f30-0)) + (+! (-> self trans y) f30-0) + (set! (-> self trans x) (-> gp-0 value x)) + (set! (-> self trans z) (-> gp-0 value z)) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + + +;; ERROR: function has no type analysis. Cannot decompile. + +;; ERROR: failed type prop at 56: Called a function, but we do not know its type + + +(defstate cam-lookat (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (suspend) + ) + #f + (none) + ) + ) + +(deftype cam-string-bank (basic) + ((los-coll-rad meters :offset-assert 4) + (los-coll-rad2 meters :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(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)) + (f30-0 0.0) + (s2-0 (new 'stack-no-clear 'matrix)) + ) + (let ((s1-0 s3-0)) + (set! (-> s1-0 radius) 409.6) + (set! (-> s1-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + (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) + (set! (-> s5-0 z) (+ 1024.0 (-> *CAMERA-bank* default-string-min-z))) + ) + (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) + ) + ) + (set! f30-0 (cond + ((>= -32768.0 f30-0) + (format #t "cam-string didn't find a spot~%") + (set! (-> arg0 quad) (-> s5-0 quad)) + (return #f) + f30-0 + ) + ((< 0.0 f30-0) + (- f30-0) + ) + (else + (- 5461.3335 f30-0) + ) + ) + ) + (matrix-axis-angle! s2-0 (-> *camera* local-down) f30-0) + (vector-matrix*! arg0 s5-0 s2-0) + ) + ) + #f + ) + +(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))) + (vector+! (-> self desired-pos) arg0 (-> *camera* tpos-curr-adj)) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (tracking-spline-method-10 (-> self position-spline) (-> self desired-pos)) + (vector-reset! (-> self velocity)) + (let ((v0-2 (logand -4097 (-> self options)))) + (set! (-> self options) v0-2) + (the-as cam-slave-options v0-2) + ) + ) + +(defun string-push-help () + 409.6 + ) + +(defun-debug cam-draw-collide-cache ((arg0 collide-cache)) + (let ((gp-0 (the-as object (-> arg0 tris)))) + (countdown (s5-0 (-> arg0 num-tris)) + (let ((t1-0 #x40000080)) + (add-debug-flat-triangle + #t + (bucket-id bucket-318) + (the-as vector (-> (the-as (inline-array collide-cache-tri) gp-0) 0)) + (-> (the-as (inline-array collide-cache-tri) gp-0) 0 vertex 1) + (-> (the-as (inline-array collide-cache-tri) gp-0) 0 vertex 2) + (the-as rgba t1-0) + ) + ) + (set! gp-0 (-> (the-as (inline-array collide-cache-tri) gp-0) 1)) + ) + ) + 0 + (none) + ) + +(deftype los-dist (structure) + ((par-dist float :offset-assert 0) + (lat-dist float :offset-assert 4) + (vert-dist float :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(deftype collide-los-dist-info (structure) + ((min-par float :offset-assert 0) + (max-par float :offset-assert 4) + (min-lat float :offset-assert 8) + (max-lat float :offset-assert 12) + (min-vp float :offset-assert 16) + (max-vp float :offset-assert 20) + (min-vn float :offset-assert 24) + (max-vn float :offset-assert 28) + (count int32 :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x24 + :flag-assert #x900000024 + ) + + +(defun dist-info-init ((arg0 collide-los-dist-info)) + (set! (-> arg0 min-par) 1.0) + (set! (-> arg0 max-par) 0.0) + (set! (-> arg0 count) 0) + 0 + (none) + ) + +(defun dist-info-valid? ((arg0 collide-los-dist-info)) + (>= (-> arg0 max-par) (-> arg0 min-par)) + ) + +(defun dist-info-append ((arg0 collide-los-dist-info) (arg1 vector)) + (cond + ((dist-info-valid? arg0) + (if (< (-> arg1 x) (-> arg0 min-par)) + (set! (-> arg0 min-par) (-> arg1 x)) + ) + (if (< (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + ) + (if (< (-> arg1 y) (-> arg0 min-lat)) + (set! (-> arg0 min-lat) (-> arg1 y)) + ) + (if (< (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + ) + (cond + ((< (-> arg1 y) 0.0) + (if (< (-> arg1 z) (-> arg0 min-vn)) + (set! (-> arg0 min-vn) (-> arg1 z)) + ) + (if (< (-> arg0 max-vn) (-> arg1 z)) + (set! (-> arg0 max-vn) (-> arg1 z)) + ) + ) + (else + (if (< (-> arg1 z) (-> arg0 min-vp)) + (set! (-> arg0 min-vp) (-> arg1 z)) + ) + (if (< (-> arg0 max-vp) (-> arg1 z)) + (set! (-> arg0 max-vp) (-> arg1 z)) + ) + ) + ) + ) + (else + (set! (-> arg0 min-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 min-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 min-vp) 0.0) + (set! (-> arg0 max-vp) 0.0) + (set! (-> arg0 min-vn) 0.0) + (set! (-> arg0 max-vn) 0.0) + (cond + ((< (-> arg1 y) 0.0) + (set! (-> arg0 min-vn) (-> arg1 z)) + (set! (-> arg0 max-vn) (-> arg1 z)) + ) + (else + (set! (-> arg0 min-vp) (-> arg1 z)) + (set! (-> arg0 max-vp) (-> arg1 z)) + ) + ) + ) + ) + (+! (-> arg0 count) 1) + (none) + ) + +(defun dist-info-print ((arg0 collide-los-dist-info) (arg1 string)) + (cond + ((dist-info-valid? arg0) + (format + *stdcon* + "~S ~2,D mn ~,,2M mx ~,,2M mnl ~,,2M mxl ~,,2M~%" + arg1 + (-> arg0 count) + (-> arg0 min-par) + (-> arg0 max-par) + (-> arg0 min-lat) + (-> arg0 max-lat) + ) + (format + *stdcon* + " mnvp ~,,2M mxvp ~,,2M mnvn ~,,2M mxvn ~,,2M~%" + (-> arg0 min-vp) + (-> arg0 max-vp) + (-> arg0 min-vn) + (-> arg0 max-vn) + ) + ) + (else + (format *stdcon* "~S invalid~%" arg1) + ) + ) + ) + +(deftype collide-los-result (structure) + ((lateral vector :inline :offset-assert 0) + (cw collide-los-dist-info :inline :offset-assert 16) + (ccw collide-los-dist-info :inline :offset-assert 64) + (straddle collide-los-dist-info :inline :offset-assert 112) + (lateral-valid symbol :offset-assert 148) + ) + :method-count-assert 9 + :size-assert #x98 + :flag-assert #x900000098 + ) + + +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +(defun los-cw-ccw ((arg0 (inline-array collide-cache-tri)) + (arg1 vector) + (arg2 vector) + (arg3 float) + (arg4 collide-los-result) + (arg5 vector) + (arg6 float) + ) + (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) + (with-pp + (set! sv-128 arg3) + (let ((gp-0 arg4)) + (set! sv-144 arg5) + (let ((s4-0 arg6)) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((f30-0 0.0) + (s0-0 #f) + ) + (set! sv-208 0) + (while (< sv-208 4) + (cond + ((= sv-208 3) + (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 432))) + (set! (-> s5-0 vector sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) + (vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 432))) + ) + ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 432))) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (set! sv-208 (+ sv-208 1)) + ) + (cond + ((and s0-0 (!= s4-0 -859915232)) + (dotimes (s4-1 4) + (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) + ) + #f + ) + ((< (-> s5-0 trans y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) + (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) + ) + ) + #f + ) + ) + ) + ) + ) + ) + ) + ) + +(defun cam-los-spline-collide ((arg0 vector) (arg1 vector) (arg2 pat-surface)) + (let ((s5-0 (new 'stack-no-clear 'collide-query)) + (s4-0 *collide-cache*) + (f30-0 2.0) + ) + 0.0 + (set! (-> s5-0 start-pos quad) (-> arg0 quad)) + (vector-! (-> s5-0 move-dist) arg1 arg0) + (let ((v1-4 s5-0)) + (set! (-> v1-4 radius) (-> *CAM_STRING-bank* los-coll-rad2)) + (set! (-> v1-4 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + ((method-of-object s4-0 collide-cache-method-13)) + (let* ((f0-2 (vector-length (-> s5-0 move-dist))) + (f28-0 + (cond + ((< f0-2 (-> *CAMERA-bank* min-detectable-velocity)) + 0.0 + ) + (else + (let* ((f0-3 (/ (* 3.0 (- (-> *CAM_STRING-bank* los-coll-rad2) (-> *CAMERA-bank* collide-move-rad))) f0-2)) + (f0-4 (- 1.0 f0-3)) + ) + (fmin 1.0 (fmax 0.0 f0-4)) + ) + ) + ) + ) + (s3-0 (the-as object (-> s4-0 tris))) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (countdown (s4-1 (-> s4-0 num-tris)) + (let ((f0-7 (moving-sphere-triangle-intersect + arg0 + (-> s5-0 move-dist) + (-> *CAM_STRING-bank* los-coll-rad2) + (-> (the-as (inline-array collide-cache-tri) s3-0) 0) + s2-0 + s1-0 + ) + ) + ) + (cond + ((or (< f0-7 0.0) (< f28-0 f0-7)) + ) + ((< f0-7 f30-0) + (set! f30-0 f0-7) + ) + ) + ) + (set! s3-0 (-> (the-as (inline-array collide-cache-tri) s3-0) 1)) + ) + ) + (if (= f30-0 #x40000000) + (set! f30-0 -1.0) + ) + f30-0 + ) + ) + +(defbehavior cam-los-setup-lateral camera-slave ((arg0 collide-los-result) (arg1 vector) (arg2 vector)) + (cond + ((dist-info-valid? (-> arg0 straddle)) + (let ((f30-0 (-> arg0 straddle min-lat)) + (f28-0 (-> arg0 straddle max-lat)) + ) + (if (dist-info-valid? (-> arg0 cw)) + (set! f28-0 (fmax f28-0 (-> arg0 cw max-lat))) + ) + (if (dist-info-valid? (-> arg0 ccw)) + (set! f30-0 (fmin f30-0 (- (-> arg0 ccw max-lat)))) + ) + (cond + ((= (-> self los-state) (slave-los-state ccw)) + (if *display-cam-los-debug* + (format *stdcon* "straddle stick ccw~%") + ) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((= (-> self los-state) (slave-los-state cw)) + (if *display-cam-los-debug* + (format *stdcon* "straddle stick cw~%") + ) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and (or (< 0.01 (-> arg0 straddle max-vp)) (and (dist-info-valid? (-> arg0 ccw)) (< 0.01 (-> arg0 ccw max-vp)))) + (or (< (-> arg0 straddle min-vp) -0.01) (and (dist-info-valid? (-> arg0 ccw)) (< (-> arg0 ccw min-vp) -0.01))) + (and (dist-info-valid? (-> arg0 cw)) (or (< (-> arg0 cw max-vp) 0.01) (< -0.01 (-> arg0 cw min-vp)))) + ) + (when (not (dist-info-valid? (-> arg0 ccw))) + ) + (if (not (dist-info-valid? (-> arg0 cw))) + (format #t "s diag ccw invalid cw~%") + ) + (if *display-cam-los-debug* + (format *stdcon* "straddle diagonal ccw~%") + ) + (set! (-> self los-state) (slave-los-state ccw)) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and (or (< 0.01 (-> arg0 straddle max-vn)) (and (dist-info-valid? (-> arg0 cw)) (< 0.01 (-> arg0 cw max-vp)))) + (or (< (-> arg0 straddle min-vn) -0.01) (and (dist-info-valid? (-> arg0 cw)) (< (-> arg0 cw min-vp) -0.01))) + (and (dist-info-valid? (-> arg0 ccw)) (or (< (-> arg0 ccw max-vp) 0.01) (< -0.01 (-> arg0 ccw min-vp)))) + ) + (if (not (dist-info-valid? (-> arg0 ccw))) + (format #t "s diag cw invalid ccw~%") + ) + (when (not (dist-info-valid? (-> arg0 cw))) + ) + (if *display-cam-los-debug* + (format *stdcon* "straddle diagonal cw~%") + ) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((< f28-0 (- f30-0)) + (if *display-cam-los-debug* + (format *stdcon* "straddle ccw~%") + ) + (set! (-> self los-state) (slave-los-state ccw)) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + (else + (if *display-cam-los-debug* + (format *stdcon* "straddle cw~%") + ) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ) + ) + ) + ((and (dist-info-valid? (-> arg0 cw)) + (dist-info-valid? (-> arg0 ccw)) + (< 0.01 (-> arg0 ccw max-vp)) + (< (-> arg0 ccw min-vp) -0.01) + (or (< (-> arg0 cw max-vp) 0.01) (< -0.01 (-> arg0 cw min-vp))) + ) + (if *display-cam-los-debug* + (format *stdcon* "diagonal ccw~%") + ) + (set! (-> self los-state) (slave-los-state ccw)) + (vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 ccw min-lat))) + ) + ((and (dist-info-valid? (-> arg0 cw)) + (dist-info-valid? (-> arg0 ccw)) + (< 0.01 (-> arg0 cw max-vp)) + (< (-> arg0 cw min-vp) -0.01) + (or (< (-> arg0 ccw max-vp) 0.01) (< -0.01 (-> arg0 ccw min-vp))) + ) + (if *display-cam-los-debug* + (format *stdcon* "diagonal cw~%") + ) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- (-> arg0 cw min-lat) (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and (dist-info-valid? (-> arg0 cw)) (dist-info-valid? (-> arg0 ccw))) + (set! (-> self los-state) (slave-los-state between)) + (vector-normalize! arg1 0.0001) + ) + ((dist-info-valid? (-> arg0 cw)) + (if *display-cam-los-debug* + (format *stdcon* "regular cw~%") + ) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- (-> arg0 cw min-lat) (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((dist-info-valid? (-> arg0 ccw)) + (if *display-cam-los-debug* + (format *stdcon* "regular ccw~%") + ) + (set! (-> self los-state) (slave-los-state ccw)) + (vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 ccw min-lat))) + ) + (else + (set! (-> self los-state) (slave-los-state none)) + (vector-reset! arg1) + ) + ) + (cond + ((= (vector-length arg1) 0.0) + (set! (-> arg0 lateral-valid) #f) + #f + ) + (else + (vector-! (-> arg0 lateral) arg1 arg2) + (vector-normalize! (-> arg0 lateral) 1.0) + (let ((v0-44 #t)) + (set! (-> arg0 lateral-valid) v0-44) + v0-44 + ) + ) + ) + ) + +;; 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] + +(defbehavior cam-string-follow camera-slave () + (let ((f30-0 (vector-length (-> self view-flat)))) + (cond + ((logtest? (-> self options) #x8000) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-cross! s5-0 (-> self view-flat) (-> *camera* local-down)) + (vector-normalize! s5-0 1.0) + (vector-! gp-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-flatten! gp-0 gp-0 s5-0) + ) + (if (< (vector-dot gp-0 (-> self view-flat)) 0.0) + (vector-! (-> self view-flat) (-> self view-flat) gp-0) + ) + ) + ) + (else + (let ((v1-10 (new 'stack-no-clear 'vector))) + (vector-! v1-10 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-! (-> self view-flat) (-> self view-flat) v1-10) + ) + ) + ) + (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) + (let* ((f28-0 (vector-length (-> self view-flat))) + (f0-3 (fmin (-> *camera* string-push-z) (-> self view-off z))) + (f26-0 (-> self view-off z)) + (f0-4 (fmin f0-3 (-> self min-z-override))) + ) + (when (logtest? (cam-slave-options WIDE_FOV) (-> *camera* settings slave-options)) + (let ((v1-18 (new-stack-vector0))) + 0.0 + (vector-! v1-18 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (let ((f0-6 (vector-length v1-18))) + (set! f0-4 (lerp-clamp 28672.0 32768.0 (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f0-6))))) + ) + ) + (set! f26-0 f0-4) + ) + (set! (-> self fov) (-> *camera* settings fov)) + (cond + ((< f28-0 f0-4) + (vector-normalize! (-> self view-flat) f0-4) + ) + ((and (< f30-0 f28-0) + (or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw))) + ) + (vector-normalize! (-> self view-flat) f30-0) + ) + ((< f26-0 f28-0) + (vector-normalize! (-> self view-flat) f26-0) + (set! (-> self min-z-override) f26-0) + f26-0 + ) + (else + (set! (-> self min-z-override) f28-0) + f28-0 + ) + ) + ) + ) + ) + +;; ERROR: function has no type analysis. Cannot decompile. + +(defun cam-dist-analog-input ((arg0 int) (arg1 float)) + (let ((f0-0 (the-as number 0.0))) + (cond + ((< arg0 28) + (set! f0-0 (- (fmin arg1 (* 0.083333336 (- 28.0 (the float arg0)) arg1)))) + ) + ((< 160 arg0) + (set! f0-0 (fmin arg1 (* 0.0125 (+ -160.0 (the float arg0)) arg1))) + ) + ) + (the-as float f0-0) + ) + ) + +;; ERROR: failed type prop at 785: Could not figure out load: (set! v1 (l.wu (+ v1 124))) +;; 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 +(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) + (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)) + (set! (-> s4-0 radius) 409.6) + (set! (-> s4-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + (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 + ) + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + ((< (-> self time-dist-too-far) (the-as uint 600)) + (+! (-> self time-dist-too-far) 1) + ) + ((cam-string-find-position-rel! gp-0) + (cam-string-set-position-rel! gp-0) + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + (else + (format 0 "camera position search failed~%") + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + ) + ) + (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) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans)) + (if *display-cam-los-debug* + (format *stdcon* "vel ~M~%" (vector-length (-> self velocity))) + ) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (let ((v1-7 s5-0)) + (let ((a0-4 (-> self velocity)) + (a1-5 s3-0) + (f0-0 0.5) + ) + (.lvf vf2 (&-> a1-5 quad)) + (.lvf vf1 (&-> a0-4 quad)) + (let ((a0-5 f0-0)) + (.mov vf3 a0-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 (&-> 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)) + ) + ) + (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* + (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) + (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 + ) + ) + ) + ) + (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) + ) + (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~%") + ) + ) + (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) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (when *display-cam-los-debug* + (let ((v1-103 (new-stack-vector0))) + (vector-! v1-103 (-> self desired-pos) (-> self string-trans)) + (format *stdcon* "vel ~M~%" (vector-length v1-103)) + ) + ) + ) + ) + +;; ERROR: failed type prop at 11: Called a function, but we do not know its type + +(defbehavior set-string-params camera-slave () + (when (not (or (-> self string-val-locked) (logtest? #x40000 (-> self options)))) + (set! (-> self string-min-val quad) (-> *camera* string-min value quad)) + (let ((v0-0 (-> self string-max-val))) + (set! (-> v0-0 quad) (-> *camera* string-max value quad)) + v0-0 + ) + ) + ) + +(defstate cam-string (camera-slave) + :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 'get-behind) + (set! (-> self butt-timer) (the-as uint (+ (-> self clock frame-counter) (seconds 0.25)))) + (set! (-> self butt-seek) (the-as basic #t)) + (set! v0-0 (the-as none (-> self butt-vector))) + (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> arg3 param 0)) quad)) + v0-0 + ) + ((= v1-0 'teleport) + (let ((gp-0 (new-stack-vector0))) + (cam-string-find-position-rel! gp-0) + (cam-string-set-position-rel! gp-0) + ) + ) + ((= v1-0 'joystick) + (set! (-> self phony-joystick-x) (the-as float (-> arg3 param 0))) + (set! (-> self phony-joystick-y) (the-as float (-> arg3 param 1))) + (set! v0-0 (the-as none #t)) + (set! (-> self have-phony-joystick) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'tween-dist) + (cond + ((-> arg3 param 0) + (set! (-> self string-val-locked) (the-as basic #t)) + (let ((s5-0 (the-as object (-> arg3 param 0))) + (gp-1 (the-as object (-> arg3 param 1))) + ) + (if (!= (-> (the-as vector s5-0) y) 4095996000.0) + (seek! + (-> self string-min-val y) + (-> (the-as vector s5-0) y) + (* (-> (the-as vector s5-0) w) (-> self clock seconds-per-frame)) + ) + ) + (if (!= (-> (the-as vector s5-0) z) 4095996000.0) + (seek! + (-> self string-min-val z) + (-> (the-as vector s5-0) z) + (* (-> (the-as vector s5-0) w) (-> self clock seconds-per-frame)) + ) + ) + (if (!= (-> (the-as vector gp-1) y) 4095996000.0) + (seek! + (-> self string-max-val y) + (-> (the-as vector gp-1) y) + (* (-> (the-as vector gp-1) w) (-> self clock seconds-per-frame)) + ) + ) + (if (!= (-> (the-as vector gp-1) z) 4095996000.0) + (seek! + (-> self string-max-val z) + (-> (the-as vector gp-1) z) + (* (-> (the-as vector gp-1) w) (-> self clock seconds-per-frame)) + ) + ) + ) + (set! (-> self string-max-val x) (fmax (-> self string-max-val x) (-> self string-min-val x))) + (set! (-> self string-max-val y) (fmax (-> self string-max-val y) (-> self string-min-val y))) + (let ((f0-31 (fmax (-> self string-max-val z) (-> self string-min-val z)))) + (set! (-> self string-max-val z) f0-31) + f0-31 + ) + ) + (else + (set! (-> self string-val-locked) #f) + #f + ) + ) + ) + ((= v1-0 'set-dist) + (cond + ((-> arg3 param 0) + (set! (-> self string-val-locked) (the-as basic #t)) + (set! (-> self string-min-val quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (set! (-> self string-max-val quad) (-> (the-as vector (-> arg3 param 1)) quad)) + (set! (-> self string-max-val x) (fmax (-> self string-max-val x) (-> self string-min-val x))) + (set! (-> self string-max-val y) (fmax (-> self string-max-val y) (-> self string-min-val y))) + (let ((f0-37 (fmax (-> self string-max-val z) (-> self string-min-val z)))) + (set! (-> self string-max-val z) f0-37) + f0-37 + ) + ) + (else + (set! (-> self string-val-locked) #f) + #f + ) + ) + ) + ((= v1-0 'relative-position) + (cond + ((-> arg3 param 0) + (set! (-> self string-val-locked) (the-as basic #t)) + (set! (-> self string-relative) (the-as basic #t)) + (set! v0-0 (the-as none (-> self relative-position))) + (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> arg3 param 0)) quad)) + v0-0 + ) + (else + (set! (-> self string-val-locked) #f) + (set! (-> self string-relative) #f) + #f + ) + ) + ) + ((= v1-0 'set-max-angle-offset) + (let ((f0-38 (the-as float (-> arg3 param 0)))) + (set! (-> self max-angle-offset) f0-38) + f0-38 + ) + ) + ((= v1-0 'blocked-side?) + (-> self los-state) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :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)) + ) + (vector-reset! (-> self joystick-saved-view-off)) + (set-string-params) + (set! (-> self string-vel-dir) (the-as uint 0)) + (set! (-> self fov) 11650.845) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (set! (-> self min-z-override) (-> self string-max-val z)) + (if (!= (-> *camera* outro-t-step) 0.0) + (set! (-> self min-z-override) (-> self string-min-val z)) + ) + (let ((gp-1 (new-stack-vector0))) + 0.0 + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (let ((f0-7 (-> self string-min-val y)) + (f1-1 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-7 f1-1 (-> self view-off-param))) + ) + (set! (-> self view-off z) + (lerp (-> self string-min-val z) (-> self string-max-val z) (-> self view-off-param)) + ) + (let ((f30-0 + (cond + ((!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! gp-1 (-> *camera* outro-exit-value) (-> *camera* outro-curve)) + (vector-! gp-1 gp-1 (-> *camera* tpos-curr-adj)) + (vector-flatten! (-> self view-flat) gp-1 (-> *camera* local-down)) + (vector-length (-> self view-flat)) + ) + ((-> *camera* settings string-use-startup-vector) + (vector-flatten! (-> self view-flat) (-> *camera* settings string-startup-vector) (-> *camera* local-down)) + (vector-length (-> self view-flat)) + ) + (else + (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (-> self view-off z) + ) + ) + ) + ) + (let ((f1-4 (fmin (-> *camera* string-push-z) (-> self min-z-override))) + (f0-17 (-> self view-off z)) + ) + (cond + ((< f30-0 f1-4) + (set! f30-0 f1-4) + ) + ((< f0-17 f30-0) + (set! f30-0 f0-17) + ) + ) + ) + (vector-normalize! (-> self view-flat) f30-0) + (let ((f30-1 (/ (- f30-0 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))))) + (if (< 1.0 f30-1) + (set! f30-1 1.0) + ) + (if (< f30-1 0.0) + (set! f30-1 0.0) + ) + (let ((f0-22 (-> self string-min-val y)) + (f1-7 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-22 f1-7 f30-1)) + ) + (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) f30-1)) + ) + ) + ) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* settings target-height) (-> self view-off y)) + ) + (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) + (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)) + (set! (-> s5-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + (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) + ) + ) + ) + (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)) + (let ((f0-32 (vector-length (-> self view-flat)))) + (cond + ((< f0-32 8192.0) + (let ((gp-3 (new-stack-vector0))) + (cam-string-find-position-rel! gp-3) + (cam-string-set-position-rel! gp-3) + ) + ) + (else + (if (< f0-32 (-> self min-z-override)) + (set! (-> self min-z-override) f0-32) + ) + (let ((f30-2 (/ (- f0-32 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))))) + (if (< 1.0 f30-2) + (set! f30-2 1.0) + ) + (if (< f30-2 0.0) + (set! f30-2 0.0) + ) + (let ((f0-36 (-> self string-min-val y)) + (f1-16 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-36 f1-16 f30-2)) + ) + (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) f30-2)) + ) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* settings target-height) (-> self view-off y)) + ) + (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + ) + ) + ) + ) + ) + ) + (set! (-> self trans quad) (-> self string-trans quad)) + (set! (-> self los-last-pos quad) (-> self string-trans quad)) + (tracking-spline-method-10 (-> self position-spline) (-> self string-trans)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (set-string-params) + (cam-string-code) + (tracking-spline-method-9 (-> self position-spline)) + (set! (-> self have-phony-joystick) #f) + ) + (suspend) + ) + #f + (none) + ) + ) + + + +(define *CAM_STICK-bank* + (new 'static 'cam-stick-bank :max-z (meters 30) :min-z (meters 5) :max-y (meters 15) :min-y (meters 2)) + ) + +;; ERROR: function has no type analysis. Cannot decompile. + + + + +(define *CAM_BIKE-bank* + (new 'static 'cam-bike-bank :max-z (meters 6) :min-z (meters 10) :max-y (meters 3) :min-y (meters 5)) + ) + +(defbehavior cam-calc-bike-follow! camera-slave ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) + (vector-float*! (-> arg0 follow-off) (the-as vector (&-> *camera* stack 320)) 155648.0) + (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ 12288.0 (-> *camera* settings target-height)) + ) + (-> arg0 follow-pt) + ) + +;; ERROR: function has no type analysis. Cannot decompile. + + + + + diff --git a/goal_src/jak2/engine/camera/cam-update-h.gc b/goal_src/jak2/engine/camera/cam-update-h.gc index f7785ac26d..12859aeda4 100644 --- a/goal_src/jak2/engine/camera/cam-update-h.gc +++ b/goal_src/jak2/engine/camera/cam-update-h.gc @@ -10,6 +10,8 @@ (allow-z 0) ) +;; NOTE - for cam-update +(define-extern update-visible (function math-camera symbol)) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/camera/cam-update.gc b/goal_src/jak2/engine/camera/cam-update.gc index 84bf45a82a..5887cd6426 100644 --- a/goal_src/jak2/engine/camera/cam-update.gc +++ b/goal_src/jak2/engine/camera/cam-update.gc @@ -5,5 +5,497 @@ ;; name in dgo: cam-update ;; dgos: ENGINE, GAME +;; TODO +;; og:ignore-form:update-visible + ;; DECOMP BEGINS +(defun plane-from-points ((arg0 (inline-array plane)) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 int)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-cross! s4-0 arg1 arg2) + (vector-normalize! s4-0 1.0) + (set! (-> s4-0 w) (vector-dot s4-0 arg3)) + (set! (-> (&-> arg0 0 data arg4) 0) (-> s4-0 x)) + (set! (-> (&-> arg0 0 data arg4) 4) (-> s4-0 y)) + (set! (-> (&-> arg0 0 data arg4) 8) (-> s4-0 z)) + (let ((f0-5 (-> s4-0 w))) + (set! (-> (&-> arg0 0 data arg4) 12) f0-5) + f0-5 + ) + ) + ) + +(defun set-point ((arg0 vector) (arg1 float) (arg2 float) (arg3 float)) + (set! (-> arg0 x) arg1) + (set! (-> arg0 y) arg2) + (set! (-> arg0 z) arg3) + (let ((f0-3 1.0)) + (set! (-> arg0 w) f0-3) + f0-3 + ) + ) + +(defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float) (arg3 matrix)) + (local-vars (sv-240 vector)) + (when (not *artist-fix-frustum*) + (let ((s5-0 (new 'stack 'view-frustum))) + (let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d))) + (f26-0 (* arg2 (-> arg0 y-ratio) (-> arg0 d))) + (f28-0 (* arg2 (-> arg0 x-ratio) (-> arg0 f))) + (f24-0 (* arg2 (-> arg0 y-ratio) (-> arg0 f))) + ) + (set-point (-> s5-0 hither-top-left) (- f30-0) f26-0 (-> arg0 d)) + (set-point (-> s5-0 hither-top-right) f30-0 f26-0 (-> arg0 d)) + (set-point (-> s5-0 hither-bottom-left) (- f30-0) (- f26-0) (-> arg0 d)) + (set-point (-> s5-0 hither-bottom-right) f30-0 (- f26-0) (-> arg0 d)) + (set-point (-> s5-0 yon-top-left) (- f28-0) f24-0 (-> arg0 f)) + (set-point (-> s5-0 yon-top-right) f28-0 f24-0 (-> arg0 f)) + (set-point (-> s5-0 yon-bottom-left) (- f28-0) (- f24-0) (-> arg0 f)) + (set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f)) + ) + (vector-matrix*! (-> s5-0 hither-top-left) (-> s5-0 hither-top-left) arg3) + (vector-matrix*! (-> s5-0 hither-top-right) (-> s5-0 hither-top-right) arg3) + (vector-matrix*! (-> s5-0 hither-bottom-left) (-> s5-0 hither-bottom-left) arg3) + (vector-matrix*! (-> s5-0 hither-bottom-right) (-> s5-0 hither-bottom-right) arg3) + (vector-matrix*! (-> s5-0 yon-top-left) (-> s5-0 yon-top-left) arg3) + (vector-matrix*! (-> s5-0 yon-top-right) (-> s5-0 yon-top-right) arg3) + (vector-matrix*! (-> s5-0 yon-bottom-left) (-> s5-0 yon-bottom-left) arg3) + (vector-matrix*! (-> s5-0 yon-bottom-right) (-> s5-0 yon-bottom-right) arg3) + (when (= arg2 1.0) + (vector-! (the-as vector (-> *fog-texture-work* corner)) (-> s5-0 yon-top-left) (-> arg3 trans)) + (vector-! (-> *fog-texture-work* corner 1) (-> s5-0 yon-top-right) (-> arg3 trans)) + (vector-! (-> *fog-texture-work* corner 2) (-> s5-0 yon-bottom-left) (-> arg3 trans)) + (vector-! (-> *fog-texture-work* corner 3) (-> s5-0 yon-bottom-right) (-> arg3 trans)) + ) + (let ((s2-1 (new-stack-vector0)) + (s3-1 (new-stack-vector0)) + (s1-0 (new-stack-vector0)) + (s0-0 (new-stack-vector0)) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (set! (-> sv-240 quad) (the-as uint128 0)) + (let ((v1-15 (-> arg3 trans quad))) + (set! (-> sv-240 quad) v1-15) + ) + (vector-! s2-1 (-> s5-0 yon-top-left) sv-240) + (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) + (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) + (vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240) + (plane-from-points arg1 s2-1 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-1 sv-240 2) + (let ((t9-20 plane-from-points) + (t0-3 3) + ) + (t9-20 arg1 s1-0 s0-0 sv-240 t0-3) + ) + ) + ) + ) + ) + +(define *update-leaf-when-outside-bsp* #t) + +;; ERROR: failed type prop at 290: Could not figure out load: (set! v1 (l.w s3)) + +(define *save-camera-inv-rot* (new 'global 'matrix)) + +(matrix-identity! *save-camera-inv-rot*) + +(defun move-camera-from-pad ((arg0 math-camera)) + (let ((v1-0 *external-cam-mode*) + (s5-0 0) + ) + (cond + ((= v1-0 'locked) + (set! v1-0 #f) + ) + ((= v1-0 'pad-1) + (set! s5-0 1) + ) + ((not *camera-combiner*) + (set! v1-0 'pad-0) + ) + ) + (when v1-0 + (let ((a2-1 + (vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0)) + ) + ) + (if (= (vector-length a2-1) 0.0) + (set! (-> a2-1 y) -1.0) + ) + (if (logtest? *external-cam-options* (external-cam-option allow-z)) + (set! a2-1 (the-as vector #f)) + ) + (cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) a2-1 s5-0) + ) + ) + ) + (let* ((a2-2 (-> *math-camera* inv-camera-rot)) + (a3-1 *save-camera-inv-rot*) + (v1-14 (-> a3-1 vector 0 quad)) + (a0-13 (-> a3-1 vector 1 quad)) + (a1-2 (-> a3-1 vector 2 quad)) + (a3-2 (-> a3-1 trans quad)) + ) + (set! (-> a2-2 vector 0 quad) v1-14) + (set! (-> a2-2 vector 1 quad) a0-13) + (set! (-> a2-2 vector 2 quad) a1-2) + (set! (-> a2-2 trans quad) a3-2) + ) + arg0 + ) + +(defun external-cam-reset! () + (when (not (movie?)) + (vector-reset! (-> *math-camera* trans)) + (matrix-identity! (-> *math-camera* inv-camera-rot)) + (when *camera-combiner* + (let* ((v1-7 (-> *math-camera* inv-camera-rot)) + (a3-0 (-> *camera-combiner* inv-camera-rot)) + (a0-2 (-> a3-0 vector 0 quad)) + (a1-0 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-7 vector 0 quad) a0-2) + (set! (-> v1-7 vector 1 quad) a1-0) + (set! (-> v1-7 vector 2 quad) a2-0) + (set! (-> v1-7 trans quad) a3-1) + ) + (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad)) + ) + ) + 0 + (none) + ) + +(define *start-timer* (the-as int #f)) + +(define *timer-value* 0) + +(define *start-pos* (new 'global 'vector)) + +(defun update-camera () + (with-pp + (let ((gp-0 *math-camera*)) + (let* ((a2-0 (-> gp-0 prev-inv-camera-rot)) + (a3-0 (-> gp-0 inv-camera-rot)) + (v1-0 (-> a3-0 vector 0 quad)) + (a0-0 (-> a3-0 vector 1 quad)) + (a1-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> a2-0 vector 0 quad) v1-0) + (set! (-> a2-0 vector 1 quad) a0-0) + (set! (-> a2-0 vector 2 quad) a1-0) + (set! (-> a2-0 trans quad) a3-1) + ) + (set! (-> gp-0 prev-trans quad) (-> gp-0 trans quad)) + (when *start-timer* + (when (= *timer-value* 180) + (format + #t + "Player pos = ~F ~F ~F~%" + (-> *target* control trans x) + (-> *target* control trans y) + (-> *target* control trans z) + ) + (set! (-> *start-pos* quad) (-> *target* control trans quad)) + ) + (when (= *timer-value* 480) + (format + #t + "Player pos = ~F ~F ~F~%" + (-> *target* control trans x) + (-> *target* control trans y) + (-> *target* control trans z) + ) + (format + #t + "Dist = ~F~%" + (* 0.00024414062 (vector-vector-xz-distance (-> *target* control trans) *start-pos*)) + ) + (set! *start-timer* (the-as int #f)) + ) + (if (< 179 *timer-value*) + (format *stdcon* "~%~%Time = ~D~%" *timer-value*) + ) + (set! *timer-value* (+ *timer-value* 1)) + ) + (when (not *start-timer*) + (set! *timer-value* 0) + 0 + ) + (let ((f0-9 (if (-> *blit-displays-work* menu-mode) + 11650.845 + (-> gp-0 fov) + ) + ) + ) + (update-math-camera + gp-0 + (-> *setting-control* user-current video-mode) + (-> *setting-control* user-current aspect-ratio) + f0-9 + ) + ) + (cond + ((or (= *master-mode* 'pause) (or (= *master-mode* 'freeze) (= *master-mode* 'progress) *progress-process*)) + ) + ((>= *camera-look-through-other* 2) + (set! *camera-look-through-other* 1) + ) + ((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu)) + (set! *camera-look-through-other* 0) + 0 + ) + ) + 0.0 + (let ((s5-1 (-> pp clock))) + (set! (-> pp clock) (-> *display* camera-clock)) + (update! *camera-smush-control*) + (let ((f0-11 (get-no-update *camera-smush-control*))) + f0-11 + (set! (-> pp clock) s5-1) + (cond + (*external-cam-mode* + (move-camera-from-pad gp-0) + ) + ((nonzero? *camera-look-through-other*) + (set! (-> gp-0 fov) (-> *camera-other-fov* data)) + (set! (-> gp-0 trans quad) (-> *camera-other-trans* quad)) + (+! (-> gp-0 trans y) f0-11) + (let* ((a2-6 (-> gp-0 inv-camera-rot)) + (a3-5 *camera-other-matrix*) + (v1-68 (-> a3-5 vector 0 quad)) + (a0-29 (-> a3-5 vector 1 quad)) + (a1-7 (-> a3-5 vector 2 quad)) + (a3-6 (-> a3-5 trans quad)) + ) + (set! (-> a2-6 vector 0 quad) v1-68) + (set! (-> a2-6 vector 1 quad) a0-29) + (set! (-> a2-6 vector 2 quad) a1-7) + (set! (-> a2-6 trans quad) a3-6) + ) + (let* ((v1-69 *save-camera-inv-rot*) + (a3-7 *camera-other-matrix*) + (a0-30 (-> a3-7 vector 0 quad)) + (a1-8 (-> a3-7 vector 1 quad)) + (a2-7 (-> a3-7 vector 2 quad)) + (a3-8 (-> a3-7 trans quad)) + ) + (set! (-> v1-69 vector 0 quad) a0-30) + (set! (-> v1-69 vector 1 quad) a1-8) + (set! (-> v1-69 vector 2 quad) a2-7) + (set! (-> v1-69 trans quad) a3-8) + ) + ) + ((and *camera-combiner* (not *external-cam-mode*)) + (set! (-> gp-0 fov) (-> *camera-combiner* fov)) + (set! (-> gp-0 trans quad) (-> *camera-combiner* trans quad)) + (+! (-> gp-0 trans y) f0-11) + (let* ((v1-76 (-> gp-0 inv-camera-rot)) + (a3-9 (-> *camera-combiner* inv-camera-rot)) + (a0-35 (-> a3-9 vector 0 quad)) + (a1-9 (-> a3-9 vector 1 quad)) + (a2-8 (-> a3-9 vector 2 quad)) + (a3-10 (-> a3-9 trans quad)) + ) + (set! (-> v1-76 vector 0 quad) a0-35) + (set! (-> v1-76 vector 1 quad) a1-9) + (set! (-> v1-76 vector 2 quad) a2-8) + (set! (-> v1-76 trans quad) a3-10) + ) + (let* ((v1-77 *save-camera-inv-rot*) + (a3-11 (-> *camera-combiner* inv-camera-rot)) + (a0-37 (-> a3-11 vector 0 quad)) + (a1-10 (-> a3-11 vector 1 quad)) + (a2-9 (-> a3-11 vector 2 quad)) + (a3-12 (-> a3-11 trans quad)) + ) + (set! (-> v1-77 vector 0 quad) a0-37) + (set! (-> v1-77 vector 1 quad) a1-10) + (set! (-> v1-77 vector 2 quad) a2-9) + (set! (-> v1-77 trans quad) a3-12) + ) + ) + (*camera* + (move-camera-from-pad gp-0) + ) + ) + ) + ) + (matrix-transpose! (-> gp-0 camera-rot) (-> gp-0 inv-camera-rot)) + (cond + (*camera-no-mip-correction* + (set! (-> gp-0 fov-correction-factor) 1.0) + ) + (else + (let ((f0-16 (fmin 11650.845 (-> gp-0 fov)))) + (set! (-> gp-0 fov-correction-factor) (* 0.00008583069 f0-16)) + ) + ) + ) + (if (< 0.0 (-> gp-0 smooth-t)) + (set! (-> gp-0 smooth-t) (- (-> gp-0 smooth-t) (-> gp-0 smooth-step))) + ) + (cond + ((< 0.0 (-> gp-0 smooth-t)) + (let ((s5-2 (new-stack-quaternion0))) + (matrix->quaternion s5-2 (-> gp-0 inv-camera-rot)) + (quaternion-slerp! s5-2 s5-2 (-> gp-0 inv-camera-rot-smooth-from) (-> gp-0 smooth-t)) + (quaternion->matrix (-> gp-0 inv-camera-rot-smooth) s5-2) + ) + ) + (else + (let* ((a2-11 (-> gp-0 inv-camera-rot-smooth)) + (a3-14 (-> gp-0 inv-camera-rot)) + (v1-90 (-> a3-14 vector 0 quad)) + (a0-43 (-> a3-14 vector 1 quad)) + (a1-15 (-> a3-14 vector 2 quad)) + (a3-15 (-> a3-14 trans quad)) + ) + (set! (-> a2-11 vector 0 quad) v1-90) + (set! (-> a2-11 vector 1 quad) a0-43) + (set! (-> a2-11 vector 2 quad) a1-15) + (set! (-> a2-11 trans quad) a3-15) + ) + ) + ) + (when (and (!= *master-mode* 'menu) *display-camera-info*) + (format *stdcon* "cam pos ~M ~M ~M~%" (-> gp-0 trans x) (-> gp-0 trans y) (-> gp-0 trans z)) + (let ((v1-95 (-> *setting-control* cam-current))) + (format + *stdcon* + "string info min-l ~M max-l ~M min-h ~M max-h ~M~%" + (-> v1-95 string-min-length) + (-> v1-95 string-max-length) + (-> v1-95 string-min-height) + (-> v1-95 string-max-height) + ) + ) + ) + (when (zero? (-> gp-0 reset)) + (let* ((a2-14 (-> gp-0 prev-camera-temp)) + (a3-18 (-> gp-0 camera-temp)) + (v1-99 (-> a3-18 vector 0 quad)) + (a0-48 (-> a3-18 vector 1 quad)) + (a1-18 (-> a3-18 vector 2 quad)) + (a3-19 (-> a3-18 trans quad)) + ) + (set! (-> a2-14 vector 0 quad) v1-99) + (set! (-> a2-14 vector 1 quad) a0-48) + (set! (-> a2-14 vector 2 quad) a1-18) + (set! (-> a2-14 trans quad) a3-19) + ) + ) + (let ((s3-1 (-> gp-0 camera-temp)) + (s2-0 (-> gp-0 camera-rot)) + (s5-3 (-> gp-0 inv-camera-rot)) + (s4-1 (-> gp-0 trans)) + ) + (let ((s1-0 (new-stack-vector0))) + (set! (-> s1-0 x) (- (-> s4-1 x))) + (set! (-> s1-0 y) (- (-> s4-1 y))) + (set! (-> s1-0 z) (- (-> s4-1 z))) + (set! (-> s1-0 w) 1.0) + (vector-matrix*! s1-0 s1-0 s2-0) + (set! (-> s2-0 trans quad) (-> s1-0 quad)) + ) + (matrix*! s3-1 s2-0 (-> gp-0 perspective)) + (set! (-> s5-3 trans quad) (-> s4-1 quad)) + ) + (when (nonzero? (-> gp-0 reset)) + (let* ((a2-17 (-> gp-0 prev-camera-temp)) + (a3-20 (-> gp-0 camera-temp)) + (v1-105 (-> a3-20 vector 0 quad)) + (a0-51 (-> a3-20 vector 1 quad)) + (a1-21 (-> a3-20 vector 2 quad)) + (a3-21 (-> a3-20 trans quad)) + ) + (set! (-> a2-17 vector 0 quad) v1-105) + (set! (-> a2-17 vector 1 quad) a0-51) + (set! (-> a2-17 vector 2 quad) a1-21) + (set! (-> a2-17 trans quad) a3-21) + ) + (set! (-> gp-0 reset) 0) + 0 + ) + (let ((f1-10 (-> gp-0 fog-min)) + (f0-37 (-> gp-0 fog-max)) + ) + (let ((f2-0 (-> gp-0 d))) + (set! (-> *instance-tie-work* hmge-d x) f1-10) + (set! (-> *instance-tie-work* hmge-d y) f0-37) + (set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0)) + (set! (-> *instance-tie-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w))) + (let ((v1-112 (-> gp-0 hvdf-off quad))) + (set! (-> *instance-tie-work* hvdf-offset quad) v1-112) + ) + (set! (-> *instance-shrub-work* hmge-d x) f1-10) + (set! (-> *instance-shrub-work* hmge-d y) f0-37) + (set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0)) + (set! (-> *instance-shrub-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w))) + (set! (-> *instance-shrub-work* billboard-const x) (/ (-> gp-0 x-pix) (* f2-0 (-> gp-0 x-ratio)))) + (set! (-> *instance-shrub-work* billboard-const y) (/ (-> gp-0 y-pix) (* f2-0 (-> gp-0 y-ratio)))) + ) + (set! (-> *instance-shrub-work* billboard-const z) f1-10) + (set! (-> *instance-shrub-work* billboard-const w) f0-37) + ) + (set! (-> *instance-shrub-work* constants w) (the-as float (-> gp-0 vis-gifs 0 fog0))) + (let ((a0-53 (-> gp-0 hvdf-off quad))) + (set! (-> *instance-shrub-work* hvdf-offset quad) a0-53) + ) + (update-view-planes gp-0 (-> gp-0 plane) 1.0 (-> gp-0 inv-camera-rot)) + (update-view-planes gp-0 (-> gp-0 guard-plane) 4.0 (-> gp-0 inv-camera-rot)) + (let ((t9-20 shrub-make-perspective-matrix) + (a0-56 (-> gp-0 shrub-mat)) + ) + (-> gp-0 camera-temp) + (t9-20 a0-56) + ) + (update-visible gp-0) + (when (-> *time-of-day-context* use-camera-other) + (let ((s5-4 (-> gp-0 camera-rot)) + (s4-2 (-> gp-0 camera-rot-other)) + (s3-2 (-> gp-0 inv-camera-rot-other)) + ) + (let ((s2-1 (-> gp-0 camera-temp-other))) + (quaternion->matrix s4-2 (-> gp-0 quat-other)) + (set! (-> s4-2 trans quad) (-> gp-0 trans-other quad)) + (set! (-> s4-2 trans w) 1.0) + (matrix*! s4-2 s4-2 s5-4) + (matrix-inverse-of-rot-trans! s3-2 s4-2) + (matrix*! s2-1 s4-2 (-> gp-0 perspective)) + ) + (update-view-planes gp-0 (-> gp-0 plane-other) 1.0 s3-2) + (update-view-planes gp-0 (-> gp-0 guard-plane-other) 4.0 s3-2) + ) + (shrub-make-perspective-matrix (-> gp-0 shrub-mat-other)) + ) + ) + #f + ) + ) + +(defun-debug move-level-by-name ((arg0 symbol) (arg1 float) (arg2 float) (arg3 float)) + (let ((v1-1 (level-get *level* arg0))) + (when v1-1 + (set! (-> v1-1 info use-camera-other) #t) + (let ((v0-1 (-> *math-camera* trans-other))) + (set! (-> v0-1 x) (* 4096.0 arg1)) + (set! (-> v0-1 y) (* 4096.0 arg2)) + (set! (-> v0-1 z) (* 4096.0 arg3)) + (set! (-> v0-1 w) 1.0) + v0-1 + ) + ) + ) + ) + + + + diff --git a/goal_src/jak2/engine/camera/camera-defs-h.gc b/goal_src/jak2/engine/camera/camera-defs-h.gc index 2dd206ad07..26792c2b7f 100644 --- a/goal_src/jak2/engine/camera/camera-defs-h.gc +++ b/goal_src/jak2/engine/camera/camera-defs-h.gc @@ -5,6 +5,27 @@ ;; name in dgo: camera-defs-h ;; dgos: ENGINE, GAME +;; NOTE - for cam-states +(deftype cam-stick-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16)) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +(deftype cam-bike-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16)) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + ;; DECOMP BEGINS (deftype camera-bank (basic) diff --git a/goal_src/jak2/engine/camera/camera-h.gc b/goal_src/jak2/engine/camera/camera-h.gc index feb2502a60..93c01383ff 100644 --- a/goal_src/jak2/engine/camera/camera-h.gc +++ b/goal_src/jak2/engine/camera/camera-h.gc @@ -35,6 +35,14 @@ (no-rotate) (sticky-angle)) +;; +++camera-blend-to-type +(defenum camera-blend-to-type + :type uint64 + (unknown-0 0) + (unknown-1 1) + (unknown-2 2)) +;; ---camera-h:camera-blend-to-type + ;; NOTE - for settings (declare-type camera-slave process) (define-extern cam-master-set-entity (function cam-setting-data none)) @@ -42,6 +50,15 @@ (define-extern cam-endlessfall (state camera-slave)) (define-extern cam-master-activate-slave (function symbol none)) +;; NOTE - for camera +(declare-type cam-rotation-tracker structure) +(define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector)) +(define-extern slave-set-rotation! (function cam-rotation-tracker vector float float symbol none)) + +;; NOTE - for cam-start +(declare-type camera-master process) +(define-extern cam-master-init (function none :behavior camera-master)) + ;; DECOMP BEGINS (deftype cam-index (structure) @@ -52,11 +69,12 @@ :size-assert #x30 :flag-assert #xb00000030 (:methods - (cam-index-method-9 () none 9) - (cam-index-method-10 () none 10) + (cam-index-method-9 (_type_ symbol entity vector curve) symbol 9) + (cam-index-method-10 (_type_ vector) float 10) ) ) + (deftype tracking-point (structure) ((position vector :inline :offset-assert 0) (direction vector :inline :offset-assert 16) @@ -69,6 +87,7 @@ :flag-assert #x90000002c ) + (deftype tracking-spline-sampler (structure) ((cur-pt int32 :offset-assert 0) (partial-pt float :offset-assert 4) @@ -78,6 +97,7 @@ :flag-assert #x900000008 ) + (deftype tracking-spline (structure) ((point tracking-point 32 :inline :offset-assert 0) (summed-len float :offset-assert 1536) @@ -98,24 +118,25 @@ :size-assert #x664 :flag-assert #x1800000664 (:methods - (tracking-spline-method-9 () none 9) - (tracking-spline-method-10 () none 10) - (tracking-spline-method-11 () none 11) - (tracking-spline-method-12 () none 12) - (tracking-spline-method-13 () none 13) - (tracking-spline-method-14 () none 14) - (tracking-spline-method-15 () none 15) - (tracking-spline-method-16 () none 16) - (tracking-spline-method-17 () none 17) - (tracking-spline-method-18 () none 18) - (tracking-spline-method-19 () none 19) - (tracking-spline-method-20 () none 20) - (tracking-spline-method-21 () none 21) - (tracking-spline-method-22 () none 22) - (tracking-spline-method-23 () none 23) + (tracking-spline-method-9 (_type_) none 9) + (tracking-spline-method-10 (_type_ vector) none 10) + (debug-point-info (_type_ int) none 11) + (debug-all-points (_type_) none 12) + (tracking-spline-method-13 (_type_ int) none 13) + (tracking-spline-method-14 (_type_ tracking-spline-sampler) none 14) + (tracking-spline-method-15 (_type_) none 15) + (tracking-spline-method-16 (_type_ float) none 16) + (tracking-spline-method-17 (_type_ vector float float symbol) int 17) + (tracking-spline-method-18 (_type_ float vector tracking-spline-sampler) vector 18) + (tracking-spline-method-19 (_type_ float vector tracking-spline-sampler) vector 19) + (tracking-spline-method-20 (_type_ vector int) none 20) + (tracking-spline-method-21 (_type_ vector float float float) vector 21) + (tracking-spline-method-22 (_type_ float) none 22) + (debug-draw-spline (_type_) none 23) ) ) + (deftype cam-float-seeker (structure) ((target float :offset-assert 0) (value float :offset-assert 4) @@ -136,6 +157,7 @@ ) ) + (defmethod init cam-float-seeker ((obj cam-float-seeker) (arg0 float) (arg1 float) (arg2 float) (arg3 float)) (set! (-> obj target) arg0) (set! (-> obj value) arg0) @@ -207,6 +229,7 @@ ) ) + (defmethod init cam-vector-seeker ((obj cam-vector-seeker) (arg0 vector) (arg1 float) (arg2 float) (arg3 float)) (cond (arg0 @@ -277,6 +300,7 @@ :flag-assert #x900000108 ) + (deftype camera-combiner (process) ((trans vector :inline :offset-assert 128) (inv-camera-rot matrix :inline :offset-assert 144) @@ -298,6 +322,7 @@ :flag-assert #xe01b0022c ) + (deftype camera-slave (process) ((trans vector :inline :offset-assert 128) (fov float :offset-assert 144) @@ -318,7 +343,7 @@ (circular-follow vector :inline :offset-assert 2256) (max-angle-offset float :offset-assert 2272) (max-angle-curr float :offset-assert 2276) - (options camera-slave-options :offset-assert 2280) + (options uint32 :offset-assert 2280) (cam-entity entity :offset-assert 2284) (butt-timer uint64 :offset-assert 2288) (butt-seek basic :offset-assert 2296) @@ -345,7 +370,7 @@ (spline-follow-dist float :offset-assert 2596) (enter-has-run symbol :offset-assert 2600) (blend-from-type uint64 :offset-assert 2608) - (blend-to-type uint64 :offset-assert 2616) + (blend-to-type camera-blend-to-type :offset-assert 2616) (have-phony-joystick basic :offset-assert 2624) (phony-joystick-x float :offset-assert 2628) (phony-joystick-y float :offset-assert 2632) @@ -359,13 +384,34 @@ :method-count-assert 14 :size-assert #xa94 :flag-assert #xe0a200a94 - ) + (:states + cam-really-fixed + cam-fixed + cam-fixed-read-entity + cam-pov + cam-pov180 + cam-pov-track + cam-standoff + cam-standoff-read-entity + cam-eye + cam-spline + cam-decel + cam-endlessfall + cam-circular + cam-lookat + cam-string + cam-stick + cam-bike + cam-robotboss ;; TODO - state docstrings "A holdout from jak 1?" + cam-point-watch + cam-free-floating)) + (deftype camera-master (process) ((master-options uint32 :offset-assert 128) (settings cam-setting-data :offset-assert 132) (slave (pointer camera-slave) :offset-assert 136) - (decel uint32 :offset-assert 140) + (decel (pointer camera-slave) :offset-assert 140) (slave-options uint32 :offset-assert 144) (view-off-param-save float :offset-assert 148) (changer uint32 :offset-assert 152) @@ -407,8 +453,15 @@ :size-assert #x924 :flag-assert #x1108b00924 (:methods - (camera-master-method-14 () none 14) - (camera-master-method-15 () none 15) - (camera-master-method-16 () none 16) + (camera-master-method-14 (_type_ vector) vector 14) + (camera-master-method-15 (_type_ vector) vector 15) + (camera-master-method-16 (_type_ symbol) none 16) ) ) + + +0 + + + + diff --git a/goal_src/jak2/engine/camera/camera.gc b/goal_src/jak2/engine/camera/camera.gc index 2b8702b185..129d443df3 100644 --- a/goal_src/jak2/engine/camera/camera.gc +++ b/goal_src/jak2/engine/camera/camera.gc @@ -7,3 +7,1990 @@ ;; DECOMP BEGINS +(define *cam-res-string* (new 'global 'string 64 (the-as string #f))) + +(defun cam-slave-get-vector-with-offset ((arg0 entity-actor) (arg1 vector) (arg2 symbol)) + (local-vars (s3-0 structure)) + (cond + ((= arg2 'trans) + (set! s3-0 (-> arg0 trans)) + ) + ((= arg2 'rot) + (set! s3-0 (-> arg0 quat)) + ) + (else + (set! s3-0 (res-lump-struct arg0 arg2 structure)) + ) + ) + (let ((s2-0 (method-of-type res-lump get-property-struct))) + (format (clear *res-key-string*) "~S~S" arg2 '-offset) + (let ((a0-6 (s2-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + ((and s3-0 a0-6) + (vector+! arg1 (the-as vector s3-0) (the-as vector a0-6)) + #t + ) + ((the-as vector s3-0) + (set! (-> arg1 quad) (-> (the-as vector s3-0) quad)) + #t + ) + (else + #f + ) + ) + ) + ) + ) + +(defun cam-slave-get-flags ((arg0 entity) (arg1 symbol)) + (let ((s5-0 (res-lump-value arg0 arg1 uint128 :time -1000000000.0)) + (s3-0 (method-of-type res-lump get-property-value)) + (s2-0 arg0) + ) + (format (clear *res-key-string*) "~S~S" arg1 '-on) + (let ((s3-1 (s3-0 + s2-0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s2-1 (method-of-type res-lump get-property-value)) + ) + (format (clear *res-key-string*) "~S~S" arg1 '-off) + (let ((v1-3 (s2-1 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (the-as uint (logclear (logior s5-0 s3-1) v1-3)) + ) + ) + ) + ) + +(defun cam-slave-get-float ((arg0 entity) (arg1 symbol) (arg2 float)) + (let ((f30-0 (res-lump-float arg0 arg1 :default arg2)) + (s4-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" arg1 '-offset) + (+ f30-0 (s4-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + +(defun cam-slave-get-fov ((arg0 entity)) + (let ((f30-0 (res-lump-float arg0 'fov)) + (s5-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'fov '-offset) + (let ((f0-0 (s5-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if (= f30-0 0.0) + (+ 11650.845 f0-0) + (+ f30-0 f0-0) + ) + ) + ) + ) + +(defun cam-slave-get-intro-step ((arg0 entity)) + (let ((f30-0 (res-lump-float arg0 'intro-time)) + (s5-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'intro-time '-offset) + (let ((f0-1 (+ f30-0 (s5-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + (if (>= 0.0 f0-1) + 0.004166667 + (/ 0.016666668 f0-1) + ) + ) + ) + ) + +(defun cam-slave-get-interp-time ((arg0 entity)) + (let ((f30-0 (res-lump-float arg0 'interpTime)) + (s5-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'interpTime '-offset) + (let ((f0-1 (the-as number (+ f30-0 (s5-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + ) + (if (>= 0.001 (the-as float f0-1)) + (set! f0-1 0.0) + ) + (the-as float f0-1) + ) + ) + ) + +(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 matrix)) + (let ((s4-0 (method-of-type res-lump get-property-struct)) + (s3-0 arg0) + ) + (format (clear *res-key-string*) "~S~S" 'rot '-offset) + (let ((a1-3 (s4-0 + s3-0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + (a1-3 + (let ((s4-1 (new 'stack-no-clear 'quaternion))) + (quaternion*! s4-1 (the-as quaternion a1-3) (-> arg0 quat)) + (quaternion-normalize! s4-1) + (quaternion->matrix arg1 s4-1) + ) + ) + (else + (quaternion->matrix arg1 (-> arg0 quat)) + ) + ) + ) + ) + arg1 + ) + +(defun cam-state-from-entity ((arg0 entity)) + (let ((s5-0 (new 'stack 'curve))) + (cond + ((not arg0) + (the-as (state camera-slave) #f) + ) + ((res-lump-struct arg0 'pivot structure) + cam-circular + ) + ((res-lump-struct arg0 'align structure) + cam-standoff-read-entity + ) + ((get-curve-data! arg0 s5-0 'campath 'campath-k -1000000000.0) + cam-spline + ) + ((< 0.0 (cam-slave-get-float arg0 'stringMaxLength 0.0)) + cam-string + ) + (else + cam-fixed-read-entity + ) + ) + ) + ) + +(defun parameter-ease-none ((arg0 object)) + arg0 + ) + +(defun parameter-ease-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + (set! arg0 1.0) + ) + ((>= 0.0 arg0) + (set! arg0 0.0) + ) + ) + arg0 + ) + +(defun parameter-ease-lerp-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + ((>= 0.25 arg0) + (* 0.5 arg0) + ) + ((>= arg0 0.75) + (- 1.0 (* 0.5 (- 1.0 arg0))) + ) + (else + (+ 0.125 (* 1.5 (+ -0.25 arg0))) + ) + ) + ) + +(defun parameter-ease-sqrt-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + ((>= 0.5 arg0) + (* 0.5 (- 1.0 (sqrtf (- 1.0 (* 2.0 arg0))))) + ) + (else + (* 0.5 (+ 1.0 (sqrtf (+ -1.0 (* 2.0 arg0))))) + ) + ) + ) + +(defun fourth-power ((arg0 float)) + (let ((f0-2 (* arg0 arg0))) + (* f0-2 f0-2) + ) + ) + +(defun third-power ((arg0 float)) + (* arg0 arg0 arg0) + ) + +(defun parameter-ease-sqr-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + ((>= 0.5 arg0) + (let ((f0-3 0.5) + (f1-4 (* 2.0 arg0)) + ) + (* f0-3 (* f1-4 f1-4)) + ) + ) + (else + (let ((f0-5 1.0) + (f1-7 0.5) + (f2-2 (* 2.0 (- 1.0 arg0))) + ) + (- f0-5 (* f1-7 (* f2-2 f2-2))) + ) + ) + ) + ) + +(defun parameter-ease-cube-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + ((>= 0.5 arg0) + (* 0.5 (third-power (* 2.0 arg0))) + ) + (else + (- 1.0 (* 0.5 (third-power (* 2.0 (- 1.0 arg0))))) + ) + ) + ) + +(defun parameter-ease-sin-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + (else + (+ 0.5 (* 0.5 (sin (* 182.04445 (+ -90.0 (* 180.0 arg0)))))) + ) + ) + ) + +(defmethod cam-index-method-9 cam-index ((obj cam-index) (arg0 symbol) (arg1 entity) (arg2 vector) (arg3 curve)) + (local-vars (sv-32 (function _varargs_ object))) + (format (clear *cam-res-string*) "~S-flags" arg0) + (set! (-> obj flags) (the-as cam-index-options (cam-slave-get-flags arg1 (string->symbol *cam-res-string*)))) + (let ((s3-2 (res-lump-data arg1 arg0 pointer)) + (s0-1 (method-of-type res-lump get-property-struct)) + ) + (set! sv-32 format) + (let ((a0-7 (clear *res-key-string*)) + (a1-4 "~S~S") + (a3-2 '-offset) + ) + (sv-32 a0-7 a1-4 arg0 a3-2) + ) + (let ((v0-8 (s0-1 + arg1 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + (s3-2 + (cond + (v0-8 + (vector+! (the-as vector (-> obj vec)) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) + (vector+! (-> obj vec 1) (the-as vector (&+ s3-2 16)) (the-as vector v0-8)) + ) + (else + (set! (-> obj vec 0 quad) (-> (the-as (pointer uint128) (&+ s3-2 0)))) + (set! (-> obj vec 1 quad) (-> (the-as (pointer uint128) (&+ s3-2 16)))) + ) + ) + ) + (arg3 + (set! (-> obj vec 0 quad) (-> arg3 cverts 0 quad)) + (set! (-> obj vec 1 quad) (-> arg3 cverts (+ (-> arg3 num-cverts) -1) quad)) + ) + (else + (return #f) + ) + ) + ) + ) + (let ((v1-11 (new-stack-vector0))) + 0.0 + (cond + ((logtest? (-> obj flags) (cam-index-options SPHERICAL)) + (vector-! v1-11 (-> obj vec 1) arg2) + (set! (-> obj vec 1 w) (vector-length v1-11)) + (vector-! v1-11 (the-as vector (-> obj vec)) arg2) + (set! (-> obj vec 1 x) (vector-length v1-11)) + (set! (-> obj vec 1 w) (- (-> obj vec 1 w) (-> obj vec 1 x))) + (set! (-> obj vec 0 quad) (-> arg2 quad)) + ) + ((logtest? (-> obj flags) (cam-index-options RADIAL)) + (vector-! v1-11 (-> obj vec 1) arg2) + (set! (-> obj vec 1 w) (vector-length v1-11)) + (vector-! v1-11 (the-as vector (-> obj vec)) arg2) + (set! (-> obj vec 1 x) (vector-length v1-11)) + (set! (-> obj vec 1 w) (- (-> obj vec 1 w) (-> obj vec 1 x))) + (set! (-> obj vec 0 quad) (-> arg2 quad)) + ) + (else + (vector-! (-> obj vec 1) (-> obj vec 1) (the-as vector (-> obj vec))) + (set! (-> obj vec 1 w) (vector-normalize-ret-len! (-> obj vec 1) 1.0)) + ) + ) + ) + #t + ) + +(defmethod cam-index-method-10 cam-index ((obj cam-index) (arg0 vector)) + (let ((s5-0 (new-stack-vector0))) + 0.0 + (vector-! s5-0 arg0 (the-as vector (-> obj vec))) + (cond + ((logtest? (-> obj flags) (cam-index-options SPHERICAL)) + (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) + (/ (- (vector-length s5-0) (-> obj vec 1 x)) (-> obj vec 1 w)) + ) + ((logtest? (-> obj flags) (cam-index-options RADIAL)) + (/ (- (vector-length s5-0) (-> obj vec 1 x)) (-> obj vec 1 w)) + ) + (else + (/ (vector-dot s5-0 (-> obj vec 1)) (-> obj vec 1 w)) + ) + ) + ) + ) + +(defmethod tracking-spline-method-10 tracking-spline ((obj tracking-spline) (arg0 vector)) + (set! (-> obj point 0 position quad) (-> arg0 quad)) + (set! (-> obj point 0 next) -134250495) + (set! (-> obj summed-len) 0.0) + (set! (-> obj free-point) 1) + (set! (-> obj used-point) 0) + (set! (-> obj partial-point) 0.0) + (set! (-> obj end-point) 0) + (set! (-> obj next-to-last-point) -134250495) + (set! (-> obj max-move) 0.0) + (set! (-> obj sample-len) 0.0) + (set! (-> obj used-count) 1) + (set! (-> obj old-position quad) (-> arg0 quad)) + (let ((v1-6 1)) + (while (!= v1-6 31) + (set! (-> obj point v1-6 next) (+ v1-6 1)) + (+! v1-6 1) + ) + (set! (-> obj point v1-6 next) -134250495) + ) + 0 + (none) + ) + +(defmethod tracking-spline-method-13 tracking-spline ((obj tracking-spline) (arg0 int)) + (let ((v1-3 (-> obj point arg0 next))) + (cond + ((= v1-3 -134250495) + ) + ((= (-> obj point v1-3 next) -134250495) + ) + (else + (set! (-> obj point arg0 next) (-> obj point v1-3 next)) + (set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point v1-3 tp-length))) + (set! (-> obj point v1-3 next) (-> obj free-point)) + (set! (-> obj free-point) v1-3) + (+! (-> obj point v1-3 incarnation) 1) + (let ((v1-11 (-> obj point arg0 next))) + (set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point arg0 tp-length))) + (vector-! + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 arg0))) + (the-as vector (-> obj point v1-11)) + (the-as vector (-> obj point arg0)) + ) + ) + (set! (-> obj point arg0 tp-length) + (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 arg0))) 1.0) + ) + (+! (-> obj summed-len) (-> obj point arg0 tp-length)) + (+! (-> obj used-count) -1) + ) + ) + ) + 0 + (none) + ) + +(defmethod tracking-spline-method-14 tracking-spline ((obj tracking-spline) (arg0 tracking-spline-sampler)) + (let ((v1-0 (-> obj used-point))) + (set! (-> obj partial-point) (-> arg0 partial-pt)) + (when (= (-> obj next-to-last-point) v1-0) + (set! (-> obj summed-len) (-> obj point v1-0 tp-length)) + (if (= (-> arg0 cur-pt) (-> obj end-point)) + (set! (-> obj partial-point) 0.99999) + ) + ) + (when (!= (-> arg0 cur-pt) v1-0) + (while (and (!= (-> obj point v1-0 next) (-> arg0 cur-pt)) (!= (-> obj point v1-0 next) (-> obj next-to-last-point))) + (set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point v1-0 tp-length))) + (+! (-> obj point v1-0 incarnation) 1) + (+! (-> obj used-count) -1) + (set! v1-0 (-> obj point v1-0 next)) + ) + (set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point v1-0 tp-length))) + (+! (-> obj point v1-0 incarnation) 1) + (+! (-> obj used-count) -1) + (set! (-> obj point v1-0 next) (-> obj free-point)) + (set! (-> obj free-point) (-> obj used-point)) + (set! (-> obj used-point) (-> arg0 cur-pt)) + (cond + ((= (-> arg0 cur-pt) (-> obj end-point)) + (set! (-> obj partial-point) 0.0) + (set! (-> obj summed-len) 0.0) + ) + ((= (-> arg0 cur-pt) (-> obj next-to-last-point)) + (set! (-> obj summed-len) (-> obj point (-> obj next-to-last-point) tp-length)) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod tracking-spline-method-15 tracking-spline ((obj tracking-spline)) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 cur-pt) (-> obj used-point)) + (set! (-> s5-0 partial-pt) (-> obj partial-point)) + (tracking-spline-method-19 obj (-> obj sample-len) a2-0 s5-0) + ) + (if (or (= (-> s5-0 cur-pt) (-> obj end-point)) + (= (-> s5-0 cur-pt) (-> obj next-to-last-point)) + (= (-> obj point (-> s5-0 cur-pt) next) (-> obj next-to-last-point)) + ) + (set! (-> s5-0 cur-pt) (-> obj used-point)) + ) + (let ((v1-15 (-> obj point (-> s5-0 cur-pt) next))) + (when (!= v1-15 -134250495) + (let ((a0-14 (-> obj point v1-15 next)) + (a1-1 v1-15) + (f0-2 -2.0) + ) + 0.0 + (while (not (or (= a0-14 -134250495) (= a0-14 (-> obj end-point)))) + (let ((f1-2 (vector-dot + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 v1-15))) + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 a0-14))) + ) + ) + ) + (when (>= f1-2 f0-2) + (set! f0-2 f1-2) + (set! a1-1 v1-15) + ) + ) + (set! v1-15 a0-14) + (set! a0-14 (-> obj point v1-15 next)) + ) + (if (< -2.0 f0-2) + (tracking-spline-method-13 obj a1-1) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod tracking-spline-method-16 tracking-spline ((obj tracking-spline) (arg0 float)) + (let ((s4-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 cur-pt) (-> obj used-point)) + (set! (-> s4-0 partial-pt) (-> obj partial-point)) + (tracking-spline-method-19 obj (-> obj sample-len) a2-0 s4-0) + ) + (let ((s4-1 (-> obj point (-> s4-0 cur-pt) next))) + (when (!= s4-1 -134250495) + (let ((v1-11 (-> obj point s4-1 next))) + (while (not (or (= v1-11 -134250495) + (= (-> obj point v1-11 next) -134250495) + (= (-> obj point v1-11 next) (-> obj end-point)) + (= (-> obj point v1-11 next) (-> obj next-to-last-point)) + ) + ) + (if (< (* (-> obj point s4-1 tp-length) + (+ 1.0 (vector-dot + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 s4-1))) + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 v1-11))) + ) + ) + ) + arg0 + ) + (tracking-spline-method-13 obj s4-1) + (set! s4-1 v1-11) + ) + (set! v1-11 (-> obj point s4-1 next)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod tracking-spline-method-17 tracking-spline ((obj tracking-spline) (arg0 vector) (arg1 float) (arg2 float) (arg3 symbol)) + (let ((s3-0 (-> obj free-point)) + (s2-0 (-> obj end-point)) + ) + (vector-! + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 s2-0))) + arg0 + (the-as vector (-> obj point s2-0)) + ) + (set! (-> obj point s2-0 tp-length) + (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 s2-0))) 1.0) + ) + (if (< (-> obj point s2-0 tp-length) arg1) + (return 0) + ) + (when (and arg3 (= s3-0 -134250495)) + (tracking-spline-method-15 obj) + (set! s3-0 (-> obj free-point)) + ) + (cond + ((= s3-0 -134250495) + (format 0 "ERROR : pos spline overflow~%") + ) + (else + (+! (-> obj summed-len) (-> obj point s2-0 tp-length)) + (set! (-> obj free-point) (-> obj point s3-0 next)) + (set! (-> obj point s2-0 next) s3-0) + (set! (-> obj end-point) s3-0) + (set! (-> obj next-to-last-point) s2-0) + (set! (-> obj point s3-0 next) -134250495) + (set! (-> obj point s3-0 position quad) (-> arg0 quad)) + (+! (-> obj used-count) 1) + (if (< 0.0 arg2) + (tracking-spline-method-16 obj arg2) + ) + ) + ) + ) + 0 + ) + +;; WARN: new jak 2 until loop case, check carefully +(defmethod tracking-spline-method-18 tracking-spline ((obj tracking-spline) (arg0 float) (arg1 vector) (arg2 tracking-spline-sampler)) + (local-vars (f0-4 float)) + (when (not arg2) + (set! arg2 (new 'stack-no-clear 'tracking-spline-sampler)) + (set! (-> arg2 cur-pt) (-> obj used-point)) + (set! (-> arg2 partial-pt) (-> obj partial-point)) + ) + 0.0 + (until #f + (cond + ((= (-> arg2 cur-pt) (-> obj end-point)) + (set! (-> arg2 partial-pt) 0.0) + (vector+! arg1 arg1 (the-as vector (-> obj point (-> arg2 cur-pt)))) + (return arg1) + ) + ((begin (set! f0-4 (+ (-> arg2 partial-pt) (/ arg0 (-> obj point (-> arg2 cur-pt) tp-length)))) (< f0-4 1.0)) + (set! (-> arg2 partial-pt) f0-4) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-5 (-> obj point (-> arg2 cur-pt) next))) + (vector-lerp! + (the-as vector s5-0) + (the-as vector (-> obj point (-> arg2 cur-pt))) + (the-as vector (-> obj point a2-5)) + f0-4 + ) + ) + (vector+! arg1 arg1 (the-as vector s5-0)) + ) + (return arg1) + ) + (else + (let ((f0-7 (* (- 1.0 (-> arg2 partial-pt)) (-> obj point (-> arg2 cur-pt) tp-length)))) + (set! arg0 (- arg0 f0-7)) + ) + (set! (-> arg2 partial-pt) 0.0) + (set! (-> arg2 cur-pt) (-> obj point (-> arg2 cur-pt) next)) + ) + ) + ) + #f + (the-as vector #f) + ) + +(defmethod tracking-spline-method-19 tracking-spline ((obj tracking-spline) (arg0 float) (arg1 vector) (arg2 tracking-spline-sampler)) + (vector-reset! arg1) + (tracking-spline-method-18 obj arg0 arg1 arg2) + arg1 + ) + +(defmethod tracking-spline-method-20 tracking-spline ((obj tracking-spline) (arg0 vector) (arg1 int)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (vector-! + s3-0 + (the-as vector (-> obj point (-> obj used-point))) + (the-as vector (-> obj point (-> obj end-point))) + ) + (let* ((f0-0 (vector-length s3-0)) + (f1-1 (* 0.33333334 (- 1.5 (* 0.00024414062 f0-0)))) + ) + 0.0 + (let* ((f1-2 (fmax 0.0 f1-1)) + (f30-0 (+ 0.3 f1-2)) + (f0-1 (cond + ((< (-> *CAMERA-bank* min-detectable-velocity) (-> obj summed-len)) + (vector-float*! s3-0 s3-0 (/ 1.0 f0-0)) + (/ f0-0 (-> obj summed-len)) + ) + (else + (vector-reset! s3-0) + 0.0 + ) + ) + ) + (f0-2 (+ -0.2 f0-1)) + (f0-3 (* 2.0 f0-2)) + (f28-0 (fmin 1.0 (fmax 0.05 f0-3))) + (v1-18 (-> obj used-point)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (while (and (!= v1-18 (-> obj end-point)) (!= v1-18 (-> obj next-to-last-point)) (!= v1-18 arg1)) + (let ((s1-0 (-> obj point v1-18 next))) + (vector-! + s2-0 + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 s1-0))) + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 v1-18))) + ) + (let* ((f0-5 (vector-normalize-ret-len! s2-0 1.0)) + (f0-6 (* 0.5 f0-5)) + (f26-0 (* (fmin 1.0 f0-6) f30-0 (vector-dot arg0 s2-0))) + ) + (let ((f1-14 (vector-dot s2-0 s3-0))) + (cond + ((>= 0.0 f1-14) + ) + (else + (set! f26-0 (* f26-0 (fmax 0.0 (- 0.75 (fabs (* f28-0 f1-14)))))) + ) + ) + ) + (cond + ((< f26-0 0.0) + (if (and *debug-segment* *display-camera-marks*) + (camera-line-rel-len + (the-as vector (-> obj point s1-0)) + s2-0 + (* -40.96 f26-0) + (new 'static 'vector4w :x #xff :y #xff :w #x80) + ) + ) + (vector--float*! arg0 arg0 s2-0 f26-0) + ) + ((and *debug-segment* *display-camera-marks*) + (camera-line-rel-len + (the-as vector (-> obj point s1-0)) + s2-0 + (* 40.96 f26-0) + (new 'static 'vector4w :x #x80 :y #x80 :w #x80) + ) + ) + ) + ) + (set! v1-18 s1-0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod tracking-spline-method-21 tracking-spline ((obj tracking-spline) (arg0 vector) (arg1 float) (arg2 float) (arg3 float)) + (with-pp + (let ((v1-0 (-> obj used-point)) + (f0-0 (-> obj partial-point)) + ) + (let ((f1-0 (-> obj summed-len))) + 0.0 + 0.0 + (let* ((f2-5 (* (- f1-0 (* f0-0 (-> obj point v1-0 tp-length))) arg3)) + (f2-8 (* (fmin arg1 (- f2-5 (-> obj max-move))) (-> pp clock time-adjust-ratio))) + ) + (set! (-> obj max-move) (fmin arg2 (+ (-> obj max-move) f2-8))) + ) + ) + (set! (-> obj max-move) (fmax 0.4096 (-> obj max-move))) + (let ((f1-8 (-> obj summed-len))) + 0.0 + (let* ((f1-9 (- f1-8 (* f0-0 (-> obj point v1-0 tp-length)))) + (f1-11 (fmin 204.8 (- f1-9 (-> obj sample-len)))) + ) + (set! (-> obj sample-len) (fmin 16384.0 (+ (-> obj sample-len) f1-11))) + ) + ) + (let ((s4-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (set! (-> s4-0 cur-pt) v1-0) + (set! (-> s4-0 partial-pt) f0-0) + (tracking-spline-method-19 obj (* (-> obj max-move) (-> pp clock time-adjust-ratio)) arg0 s4-0) + (tracking-spline-method-14 obj s4-0) + (dotimes (s3-0 63) + (tracking-spline-method-18 obj (* 0.015625 (-> obj sample-len)) arg0 s4-0) + ) + (vector-float*! arg0 arg0 0.015625) + (let ((a2-3 (-> s4-0 cur-pt))) + (set! (-> obj debug-last-point) a2-3) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> obj debug-old-position quad) (-> obj old-position quad)) + (set! (-> obj debug-out-position quad) (-> arg0 quad)) + (vector-! s4-1 arg0 (-> obj old-position)) + (tracking-spline-method-20 obj s4-1 a2-3) + (vector+! arg0 (-> obj old-position) s4-1) + ) + ) + ) + ) + (set! (-> obj old-position quad) (-> arg0 quad)) + arg0 + ) + ) + +(defmethod tracking-spline-method-22 tracking-spline ((obj tracking-spline) (arg0 float)) + (when (< arg0 (-> obj summed-len)) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 cur-pt) (-> obj used-point)) + (set! (-> s5-0 partial-pt) 0.0) + (tracking-spline-method-19 obj (- (-> obj summed-len) arg0) a2-0 s5-0) + ) + (tracking-spline-method-14 obj s5-0) + ) + ) + 0 + (none) + ) + +(defmethod tracking-spline-method-9 tracking-spline ((obj tracking-spline)) + (let ((v1-0 (-> obj used-point)) + (s4-0 0) + (s5-0 0) + ) + (while (!= v1-0 -134250495) + (set! s5-0 (logior s5-0 (ash 1 v1-0))) + (+! s4-0 1) + (set! v1-0 (-> obj point v1-0 next)) + ) + (when (!= s4-0 (-> obj used-count)) + (if *debug-segment* + (format 0 "ERROR: tracking spline used count ~D actual ~D~%" (-> obj used-count) s4-0) + ) + (set! (-> obj used-count) s4-0) + ) + (let ((v1-9 (-> obj free-point)) + (a3-1 0) + ) + (while (!= v1-9 -134250495) + (+! a3-1 1) + (set! v1-9 (-> obj point v1-9 next)) + ) + (when (!= a3-1 (- 32 (-> obj used-count))) + (if *debug-segment* + (format 0 "ERROR: tracking spline free count ~D actual ~D~%" (- 32 (-> obj used-count)) a3-1) + ) + (set! (-> obj free-point) -134250495) + (dotimes (v1-21 32) + (when (zero? (logand s5-0 1)) + (set! (-> obj point v1-21 next) (-> obj free-point)) + (set! (-> obj free-point) v1-21) + ) + (set! s5-0 (shr s5-0 1)) + ) + ) + ) + ) + 0 + (none) + ) + +(defbehavior cam-slave-init-vars camera-slave () + (cond + (*camera* + (set! (-> self options) (-> *camera* slave-options)) + ) + (else + (set! (-> self options) (the-as uint 0)) + 0 + ) + ) + (cond + (*camera-combiner* + (set! (-> self trans quad) (-> *camera-combiner* trans quad)) + (let* ((v1-7 (-> self tracking)) + (a3-0 (-> *camera-combiner* inv-camera-rot)) + (a0-1 (-> a3-0 vector 0 quad)) + (a1-0 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-7 inv-mat vector 0 quad) a0-1) + (set! (-> v1-7 inv-mat vector 1 quad) a1-0) + (set! (-> v1-7 inv-mat vector 2 quad) a2-0) + (set! (-> v1-7 inv-mat trans quad) a3-1) + ) + (when *camera-init-mat* + (let* ((a2-1 (-> self tracking)) + (a3-2 *camera-init-mat*) + (v1-10 (-> a3-2 vector 0 quad)) + (a0-2 (-> a3-2 vector 1 quad)) + (a1-1 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 trans quad)) + ) + (set! (-> a2-1 inv-mat vector 0 quad) v1-10) + (set! (-> a2-1 inv-mat vector 1 quad) a0-2) + (set! (-> a2-1 inv-mat vector 2 quad) a1-1) + (set! (-> a2-1 inv-mat trans quad) a3-3) + ) + ) + (set! (-> self fov) (-> *camera-combiner* fov)) + (set! (-> self velocity quad) (-> *camera-combiner* velocity quad)) + ) + (else + (vector-reset! (-> self trans)) + (matrix-identity! (the-as matrix (-> self tracking))) + (set! (-> self fov) 11650.845) + (vector-reset! (-> self velocity)) + ) + ) + (set! (-> self time-dist-too-far) (the-as uint 0)) + (set! (-> self intro-t) 1.0) + (set! (-> self intro-t-step) 0.0) + (set! (-> self spline-exists) #f) + (set! (-> self los-state) (slave-los-state none)) + (set! (-> self enter-has-run) #f) + (set! (-> self cam-entity) #f) + (set! (-> self tracking no-follow) #f) + (init (-> self tracking tilt-adjust) (-> *CAMERA-bank* default-tilt-adjust) 9.102222 91.022224 0.25) + (init + (-> self tracking follow-height-extra) + (-> *setting-control* cam-current extra-follow-height) + 81.92 + 819.2 + 0.5 + ) + (set! (-> self tracking follow-blend) 1.0) + (set! (-> self have-phony-joystick) #f) + (set! (-> self string-val-locked) #f) + (set! (-> self string-relative) #f) + (set! (-> self butt-timer) (the-as uint 0)) + (set! (-> self butt-seek) #f) + (init (-> self tracking point-of-interest-blend) 0.0 0.005 0.02 0.125) + (init (-> self tracking underwater-blend) 0.0 0.007 0.03 0.125) + (tracking-spline-method-10 (-> self position-spline) (-> self trans)) + (none) + ) + +(defbehavior cam-slave-go camera-slave ((arg0 (state camera-slave))) + (cam-slave-init-vars) + (go arg0) + 0 + (none) + ) + +(defbehavior cam-slave-init camera-slave ((arg0 (state camera-slave)) (arg1 entity)) + (stack-size-set! (-> self main-thread) 512) + (if (and (nonzero? camera-slave-debug) *debug-segment*) + (add-connection *debug-engine* self camera-slave-debug self #f #f) + ) + (cam-slave-init-vars) + (set! (-> self cam-entity) arg1) + (let ((t9-3 (-> arg0 enter))) + (if t9-3 + (t9-3) + ) + ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> arg0 event)) + (go arg0) + 0 + (none) + ) + +(defbehavior cam-standard-event-handler camera-slave ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('go) + (format 0 "ERROR : slave cameras no longer support the 'go' event~%") + ) + (('change-state) + (let ((gp-0 (the-as object (-> arg3 param 0)))) + (cam-slave-init-vars) + (let ((t9-2 (-> (the-as (state camera-slave) gp-0) enter))) + (if t9-2 + (t9-2) + ) + ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> (the-as (state camera-slave) gp-0) event)) + (go (the-as (state camera-slave) gp-0)) + ) + ) + (('teleport) + (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + ) + ) + (none) + ) + +(defbehavior cam-curve-pos camera-slave ((arg0 vector) (arg1 vector) (arg2 curve) (arg3 symbol)) + (let ((s5-0 (new-stack-vector0))) + 0.0 + (let ((s2-0 (new-stack-vector0))) + (if arg1 + (set! (-> arg1 w) 0.0) + ) + (when (< (-> self intro-t) 1.0) + (+! (-> self intro-t) (* (-> self intro-t-step) (-> self clock time-adjust-ratio))) + (if (< 1.0 (-> self intro-t)) + (set! (-> self intro-t) 1.0) + ) + (curve-get-pos! s5-0 (parameter-ease-sin-clamp (-> self intro-t)) (-> self intro-curve)) + (vector+! s5-0 s5-0 (-> self intro-offset)) + (vector+! arg0 arg0 s5-0) + (cond + ((not arg1) + ) + ((< (-> self intro-t) 0.5) + (curve-get-pos! s2-0 (+ 0.0001 (parameter-ease-sin-clamp (-> self intro-t))) (-> self intro-curve)) + (vector+! s2-0 s2-0 (-> self intro-offset)) + (vector-! arg1 s2-0 s5-0) + (set! (-> arg1 w) 1.0) + ) + (else + (curve-get-pos! s2-0 (+ -0.0001 (parameter-ease-sin-clamp (-> self intro-t))) (-> self intro-curve)) + (vector+! s2-0 s2-0 (-> self intro-offset)) + (vector-! arg1 s5-0 s2-0) + (set! (-> arg1 w) 1.0) + ) + ) + ) + ) + (cond + ((not (-> self spline-exists)) + ) + ((= (-> self spline-follow-dist) 0.0) + (let ((f0-18 (if arg3 + (cam-index-method-10 (-> self index) (-> self tracking follow-pt)) + (cam-index-method-10 (-> self index) (-> *camera* tpos-curr-adj)) + ) + ) + ) + (if (logtest? #x200000 (-> self options)) + (set! f0-18 (parameter-ease-sin-clamp f0-18)) + ) + (curve-get-pos! s5-0 f0-18 (-> self spline-curve)) + ) + (vector+! s5-0 s5-0 (-> self spline-offset)) + (vector+! arg0 arg0 s5-0) + ) + (else + (let ((s3-1 (new 'stack-no-clear 'vector))) + (curve-length (-> self spline-curve)) + (if arg3 + (set! (-> s3-1 quad) (-> self tracking follow-pt quad)) + (set! (-> s3-1 quad) (-> *camera* tpos-curr-adj quad)) + ) + (set! (-> self spline-tt) + (curve-closest-point (-> self spline-curve) s3-1 (-> self spline-tt) 1024.0 10 (-> self spline-follow-dist)) + ) + ) + (curve-get-pos! s5-0 (-> self spline-tt) (-> self spline-curve)) + (vector+! s5-0 s5-0 (-> self spline-offset)) + (vector+! arg0 arg0 s5-0) + ) + ) + ) + arg0 + ) + +(defbehavior cam-curve-setup camera-slave ((arg0 vector)) + (when (get-curve-data! (-> self cam-entity) (-> self spline-curve) 'campath 'campath-k -1000000000.0) + (curve-get-pos! (-> self spline-offset) 0.0 (-> self spline-curve)) + (vector-negate! (-> self spline-offset) (-> self spline-offset)) + (cam-index-method-9 (-> self index) 'campoints (-> self cam-entity) arg0 (-> self spline-curve)) + (set! (-> self spline-exists) (the-as basic #t)) + ) + (cond + ((get-curve-data! (-> self cam-entity) (-> self intro-curve) 'intro 'intro-k -1000000000.0) + (curve-get-pos! (-> self intro-offset) 1.0 (-> self intro-curve)) + (vector-negate! (-> self intro-offset) (-> self intro-offset)) + (set! (-> self intro-t) 0.0) + (set! (-> self intro-t-step) (cam-slave-get-intro-step (-> self cam-entity))) + (set! (-> self outro-exit-value) (cam-slave-get-float (-> self cam-entity) 'intro-exitValue 0.0)) + (if (= (-> self outro-exit-value) 0.0) + (set! (-> self outro-exit-value) 0.5) + ) + ) + (else + (set! (-> self intro-t) 1.0) + (set! (-> self intro-t-step) 0.0) + ) + ) + (if (-> *camera* settings no-intro) + (set! (-> self intro-t) 1.0) + ) + 0 + (none) + ) + +;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +(defun cam-calc-follow! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) + (local-vars (sv-128 (function float float float float)) (sv-144 float) (sv-160 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) + (cond + (arg2 + (update! (-> arg0 tilt-adjust) 0.0) + (update! (-> arg0 point-of-interest-blend) 0.0) + (update! (-> arg0 underwater-blend) 0.0) + ) + (else + (set! (-> arg0 old-cam-trans quad) (-> arg1 quad)) + (jump-to-target! (-> arg0 tilt-adjust) 0.0) + (jump-to-target! (-> arg0 point-of-interest-blend) 0.0) + (jump-to-target! (-> arg0 underwater-blend) 0.0) + ) + ) + (set! (-> arg0 follow-height-extra target) (-> *camera* settings extra-follow-height)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> arg0 follow-pt quad)) + (cond + ((logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) + (let ((s1-0 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (f30-0 (vector-vector-distance (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-flatten! s1-0 (the-as vector (&-> *camera* stack 320)) (-> *camera* local-down)) + (vector-normalize! s1-0 1.0) + (vector-! s0-0 (-> *camera* tpos-curr-adj) arg1) + (vector-flatten! s0-0 s0-0 (-> *camera* local-down)) + (vector-normalize! s0-0 1.0) + (vector-float*! s2-0 (the-as vector (&-> *camera* stack 320)) 32768.0) + (set! sv-128 lerp-clamp) + (set! sv-144 (the-as float 0.7)) + (set! sv-160 (the-as float 0.4)) + (let* ((a2-3 (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0)))) + (f30-1 (sv-128 sv-144 sv-160 a2-3)) + (f0-7 (acos (vector-dot s0-0 s1-0))) + (f28-0 (fmax 1820.4445 f0-7)) + ) + (if (< f28-0 8192.0) + (vector-float*! + s2-0 + s2-0 + (+ f30-1 + (* (/ (- 1.0 f30-1) (- 1.0 (cos 32768.0))) (+ (- (cos 32768.0)) (cos (* 5.142857 (- 8192.0 f28-0))))) + ) + ) + ) + ) + (cond + ((< (-> *camera* ease-t) 1.0) + ) + ((< (-> arg0 follow-blend) 1.0) + (let* ((f0-21 (-> arg0 follow-blend)) + (f0-22 (* f0-21 f0-21)) + (f0-23 (* f0-22 f0-22)) + ) + (vector-! s2-0 s2-0 (-> arg0 follow-off)) + (vector-float*! s2-0 s2-0 f0-23) + ) + (+! (-> arg0 follow-blend) (* 0.016666668 (-> pp clock time-adjust-ratio))) + (vector+! (-> arg0 follow-off) (-> arg0 follow-off) s2-0) + ) + (else + (set! (-> arg0 follow-off quad) (-> s2-0 quad)) + ) + ) + ) + (cond + (arg2 + (if (logtest? (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) (-> *camera* settings slave-options)) + (set! (-> arg0 follow-height-extra vel) 0.0) + (update! (-> arg0 follow-height-extra) 0.0) + ) + ) + (else + (jump-to-target! (-> arg0 follow-height-extra) 0.0) + ) + ) + (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ (-> arg0 follow-height-extra value) (-> *camera* settings target-height)) + ) + ) + (else + 0.0 + (let ((s2-1 (new-stack-vector0))) + (set! (-> arg0 follow-blend) 0.0) + (cond + ((-> arg0 no-follow) + (vector-reset! s2-1) + ) + (else + (vector-! s2-1 (-> *camera* tpos-curr-adj) arg1) + (vector-normalize! s2-1 1.0) + (let* ((f0-32 (vector-dot (the-as vector (&-> *camera* stack 256)) s2-1)) + (f30-2 (cond + ((< f0-32 0.0) + 1.0 + ) + (else + (let* ((f0-33 (* f0-32 f0-32)) (f0-34 (- 1.0 f0-33))) (* f0-34 (* f0-34 f0-34))) + ) + ) + ) + ) + (vector-! s2-1 arg1 (-> *camera* tpos-curr-adj)) + (vector-flatten! s2-1 s2-1 (-> *camera* local-down)) + (let* ((f1-15 (* 0.000022194603 (+ -20480.0 (vector-length s2-1)))) + (f0-37 (fmax 0.0 (fmin 1.0 f1-15))) + ) + (vector-float*! s2-1 (the-as vector (&-> *camera* stack 256)) (* (lerp 2048.0 8192.0 f0-37) f30-2)) + ) + ) + ) + ) + (cond + (arg2 + (vector-seek-3d-smooth! (-> arg0 follow-off) s2-1 (* 20480.0 (-> pp clock seconds-per-frame)) 0.05) + (if (logtest? (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) (-> *camera* settings slave-options)) + (set! (-> arg0 follow-height-extra vel) 0.0) + (update! (-> arg0 follow-height-extra) 0.0) + ) + ) + (else + (set! (-> arg0 follow-off quad) (-> s2-1 quad)) + (jump-to-target! (-> arg0 follow-height-extra) 0.0) + ) + ) + ) + (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ (-> arg0 follow-height-extra value) (-> *camera* settings target-height)) + ) + ) + ) + (when (and arg2 (logtest? (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) (-> *camera* settings slave-options))) + (let ((f0-46 + (vector-dot (-> *camera* local-down) (vector-! (new 'stack-no-clear 'vector) arg1 (-> arg0 old-cam-trans))) + ) + (f1-20 + (vector-dot (-> *camera* local-down) (vector-! (new 'stack-no-clear 'vector) (-> arg0 follow-pt) s4-0)) + ) + ) + (vector--float*! (-> arg0 follow-pt) (-> arg0 follow-pt) (-> *camera* local-down) (- f1-20 f0-46)) + ) + (let ((v1-107 (-> arg0 follow-off))) + (let ((a0-64 (-> arg0 follow-pt)) + (a1-39 (-> *camera* local-down)) + (f0-49 (+ (-> arg0 follow-height-extra value) (-> *camera* settings target-height))) + ) + (.lvf vf2 (&-> a1-39 quad)) + (.lvf vf1 (&-> a0-64 quad)) + (let ((a0-65 f0-49)) + (.mov vf3 a0-65) + ) + ) + (.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-107 quad) vf4) + ) + (vector-! (-> arg0 follow-off) (-> arg0 follow-off) (-> *camera* tpos-curr-adj)) + ) + ) + (set! (-> arg0 old-cam-trans quad) (-> arg1 quad)) + (-> arg0 follow-pt) + ) + ) + ) + +(defun mat-remove-z-rot ((arg0 matrix) (arg1 vector)) + (let ((s4-0 (new-stack-vector0))) + 0.0 + 0.0 + (let ((s5-0 (new-stack-matrix0))) + (vector-negate! s4-0 arg1) + (vector-flatten! s4-0 s4-0 (-> arg0 vector 2)) + (vector-normalize! s4-0 1.0) + (let ((f0-3 (vector-dot (-> arg0 vector 1) s4-0))) + (when (< f0-3 0.99999) + (vector-cross! s4-0 (-> arg0 vector 1) s4-0) + (let ((f1-1 (vector-length s4-0))) + (if (< 0.0 (vector-dot s4-0 (-> arg0 vector 2))) + (set! f1-1 (- f1-1)) + ) + (matrix-axis-sin-cos! s5-0 (-> arg0 vector 2) f1-1 f0-3) + ) + (matrix*! arg0 arg0 s5-0) + ) + ) + ) + ) + arg0 + ) + +(defun slave-matrix-blend-2 ((arg0 matrix) (arg1 float) (arg2 vector) (arg3 matrix)) + (with-pp + (let ((s1-0 (new-stack-vector0)) + (s4-0 (new-stack-quaternion0)) + ) + (let ((s2-0 (new-stack-quaternion0)) + (gp-0 (new-stack-quaternion0)) + ) + 0.0 + (let* ((f0-1 (cond + ((logtest? (the-as int arg1) 4) + (vector-length arg2) + ) + (else + (vector-flatten! s1-0 arg2 (-> *camera* local-down)) + (vector-length s1-0) + ) + ) + ) + (f0-3 (* 0.00048828125 (+ -1024.0 f0-1))) + ) + (cond + ((< f0-3 0.0) + (set! f0-3 0.0) + ) + ((< 1.0 f0-3) + (set! f0-3 1.0) + ) + ) + (let ((f30-0 (* f0-3 (* (-> *setting-control* cam-current matrix-blend-max-angle) (-> pp clock time-adjust-ratio)))) + ) + (matrix->quaternion s4-0 arg0) + (matrix->quaternion s2-0 arg3) + (quaternion-conjugate! gp-0 s4-0) + (quaternion*! gp-0 gp-0 s2-0) + (quaternion-normalize! gp-0) + (if (< (-> gp-0 w) 0.0) + (quaternion-negate! gp-0 gp-0) + ) + (let ((f28-0 (acos (-> gp-0 w)))) + (if (< (* f28-0 (-> *setting-control* cam-current matrix-blend-max-partial) (-> pp clock time-adjust-ratio)) + f30-0 + ) + (set! f30-0 + (* f28-0 (-> *setting-control* cam-current matrix-blend-max-partial) (-> pp clock time-adjust-ratio)) + ) + ) + (cond + ((< (-> gp-0 w) 0.9999999) + (quaternion-float*! gp-0 gp-0 (/ (sin f30-0) (sin f28-0))) + (set! (-> gp-0 w) (cos f30-0)) + ) + (else + (quaternion-identity! gp-0) + ) + ) + ) + ) + ) + (quaternion*! s4-0 s4-0 gp-0) + ) + (quaternion-normalize! s4-0) + (quaternion->matrix arg0 s4-0) + ) + ) + ) + +(defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float)) + (local-vars (sv-112 (inline-array vector)) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new-stack-matrix0))) + (let ((s3-0 (new-stack-vector0)) + (s2-0 (new-stack-vector0)) + ) + 0.0 + 0.0 + (let ((f30-0 1.0) + (s4-0 #t) + ) + 0.0 + (vector-! s3-0 (-> *camera* tpos-curr) arg1) + (let ((f26-0 (vector-length s3-0))) + (vector-flatten! s3-0 s3-0 (-> arg0 vector 1)) + (vector-normalize! s3-0 1.0) + (let ((f28-0 (vector-dot s3-0 (the-as vector (-> arg0 vector))))) + (set! sv-128 s2-0) + (set! sv-112 (-> arg0 vector)) + (let ((f0-7 (* 0.8 (tan (* 0.5 arg2))))) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-11 f0-7)) + (.mov vf2 v1-11) + ) + ) + (.add.x.vf vf1 vf0 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> sv-128 quad) vf1) + (vector+! s2-0 s2-0 (-> arg0 vector 2)) + (vector-normalize! s2-0 f26-0) + (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) 6144.0) + (vector-normalize! s2-0 1.0) + (let ((f0-9 (fmax 0.0 (vector-dot s2-0 (the-as vector (-> arg0 vector)))))) + (when (< f0-9 (fabs f28-0)) + (if (< f28-0 0.0) + (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) (* 2.0 f0-9)) + ) + (matrix-from-two-vectors! s5-0 s2-0 s3-0) + (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) + (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) (-> arg0 vector 2)) + ) + ) + ) + ) + (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) + (vector-! s3-0 s3-0 arg1) + (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* settings foot-offset)) + (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (vector-normalize! s3-0 1.0) + (let ((f28-1 (vector-dot s3-0 (-> arg0 vector 1)))) + (set! sv-160 s2-0) + (set! sv-144 (-> arg0 vector 1)) + (let ((f0-16 (* 0.525 (tan (* 0.5 arg2))))) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-32 f0-16)) + (.mov vf2 v1-32) + ) + ) + (.add.x.vf vf1 vf0 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> sv-160 quad) vf1) + (vector+! s2-0 s2-0 (-> arg0 vector 2)) + (vector-normalize! s2-0 1.0) + (let ((f0-18 (vector-dot s2-0 (-> arg0 vector 1)))) + (when (and (< f28-1 0.0) (< f0-18 (- f28-1))) + (vector--float*! s2-0 s2-0 (-> arg0 vector 1) (* 2.0 f0-18)) + (set! f30-0 (vector-dot s2-0 s3-0)) + ) + ) + ) + (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) + (vector-! s3-0 s3-0 arg1) + (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* settings head-offset)) + (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (vector-normalize! s3-0 1.0) + (let ((f28-2 (vector-dot s3-0 (-> arg0 vector 1)))) + (let ((s0-1 s2-0)) + (set! sv-176 (-> arg0 vector 1)) + (let ((f0-26 (* 0.525 (tan (* 0.5 arg2))))) + (vector-float*! s0-1 sv-176 f0-26) + ) + ) + (vector+! s2-0 s2-0 (-> arg0 vector 2)) + (vector-normalize! s2-0 1.0) + (let ((f0-28 (vector-dot s2-0 (-> arg0 vector 1)))) + (cond + ((and (< 0.0 f28-2) (< f0-28 f28-2)) + (set! f30-0 (vector-dot s2-0 s3-0)) + (set! s4-0 #f) + ) + ((< f30-0 0.0) + (let ((f0-33 (- (vector-dot s2-0 s3-0)))) + (if (< f0-33 f30-0) + (set! f30-0 f0-33) + ) + ) + ) + ) + ) + ) + (let ((f0-35 (if s4-0 + (- (acos f30-0)) + (acos f30-0) + ) + ) + ) + (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-35) + ) + ) + ) + (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) + ) + (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (the-as vector (-> arg0 vector))) + ) + ) + +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +(defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 float) (arg3 float) (arg4 symbol)) + (local-vars + (f0-9 float) + (sv-208 vector) + (sv-224 vector) + (sv-240 matrix) + (sv-256 (function matrix vector float vector)) + (sv-272 matrix) + (sv-288 vector) + ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (if (-> *camera* settings use-look-at-point) + (set! (-> arg0 follow-pt quad) (-> *camera* settings look-at-point quad)) + ) + (let ((s0-0 (new-stack-vector0)) + (s1-0 (new-stack-matrix0)) + ) + (let ((f30-0 (-> arg0 tilt-adjust value))) + (cond + ((< 0.0001 (-> arg0 point-of-interest-blend value)) + (set! sv-208 (new 'stack-no-clear 'vector)) + 0.0 + (vector-! s0-0 (-> arg0 follow-pt) arg1) + (let ((f28-0 (vector-length s0-0))) + (vector-! sv-208 (-> *camera* settings point-of-interest) arg1) + (vector-normalize! sv-208 (* f28-0 (-> arg0 point-of-interest-blend value))) + (let ((v1-12 s0-0)) + (let ((a0-10 s0-0)) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> a0-10 quad)) + ) + (.lvf vf5 (&-> sv-208 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> v1-12 quad) vf6) + ) + (vector-normalize! s0-0 f28-0) + ) + (vector-! (-> arg0 looking-interesting) (-> *camera* settings point-of-interest) (-> arg0 follow-pt)) + (let ((v1-15 (-> arg0 looking-interesting))) + (let ((a0-16 (-> arg0 follow-pt)) + (a1-7 (-> arg0 looking-interesting)) + (f0-4 (-> arg0 point-of-interest-blend value)) + ) + (.lvf vf2 (&-> a1-7 quad)) + (.lvf vf1 (&-> a0-16 quad)) + (let ((a0-17 f0-4)) + (.mov vf3 a0-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 (&-> v1-15 quad) vf4) + ) + ) + (else + (vector-! s0-0 (-> arg0 follow-pt) arg1) + (set! (-> arg0 looking-interesting quad) (-> arg1 quad)) + ) + ) + (vector+! (-> arg0 looking-at) s0-0 arg1) + (forward-down->inv-matrix s1-0 s0-0 (-> *camera* local-down)) + (when (!= f30-0 0.0) + 0.0 + 0.0 + (set! sv-240 (new 'stack-no-clear 'matrix)) + (set! sv-224 (new 'stack-no-clear 'vector)) + (vector-normalize-copy! sv-224 s0-0 1.0) + ;; NOTE - manually fixed - #1819 + (let* ((v1-24 (-> *camera* local-down))) + (set! f0-9 (vector-dot v1-24 sv-224))) + (let* ((f28-1 f0-9) + (f0-11 (acos (fabs f28-1))) + ) + (cond + ((< 0.0 f30-0) + (set! f30-0 (if (< 0.0 f28-1) + (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-11))) + (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11)))) + ) + ) + ) + ((< f30-0 0.0) + (set! f30-0 (if (< 0.0 f28-1) + (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11))))) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-11)))) + ) + ) + ) + ) + ) + (matrix-rotate-x! sv-240 f30-0) + (let ((t9-6 matrix*!) + (a0-29 s1-0) + (a2-3 s1-0) + ) + (t9-6 a0-29 sv-240 a2-3) + ) + ) + ) + (when (not (-> *camera* settings use-look-at-point)) + (if (and (= (-> *camera* under-water) 2) + *target* + (not (and (-> *target* next-state) (= (-> *target* next-state name) 'target-swim-up))) + ) + (set! (-> arg0 underwater-blend target) 1.0) + (set! (-> arg0 underwater-blend target) 0.0) + ) + ) + (set! sv-256 vector-into-frustum-nosmooth!) + (set! sv-272 s1-0) + (set! sv-288 arg1) + (let ((a2-5 (lerp-clamp arg3 (* 0.25 arg3) (-> arg0 underwater-blend value)))) + (sv-256 sv-272 sv-288 a2-5) + ) + (cond + (arg4 + (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s0-0 s1-0) + ) + (else + (let* ((v1-59 (-> arg0 inv-mat)) + (a3-2 s1-0) + (a0-35 (-> a3-2 vector 0 quad)) + (a1-19 (-> a3-2 vector 1 quad)) + (a2-7 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 trans quad)) + ) + (set! (-> v1-59 vector 0 quad) a0-35) + (set! (-> v1-59 vector 1 quad) a1-19) + (set! (-> v1-59 vector 2 quad) a2-7) + (set! (-> v1-59 trans quad) a3-3) + ) + ) + ) + ) + (mat-remove-z-rot (-> arg0 inv-mat) (-> *camera* local-down)) + (cond + ((not (-> *camera* settings use-point-of-interest)) + (set! (-> arg0 point-of-interest-blend target) 0.0) + ) + (else + (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) (-> *camera* settings point-of-interest) arg1))) + 0.0 + (vector-flatten! s4-2 s4-2 (-> arg0 inv-mat vector 1)) + (vector-normalize! s4-2 1.0) + (let ((f30-1 (vector-dot s4-2 (-> arg0 inv-mat vector 2)))) + (cond + ((< (cos 12743.111) f30-1) + (set! (-> arg0 point-of-interest-blend target) 1.0) + ) + ((and (< 0.0 (-> arg0 point-of-interest-blend target)) (< (cos 8192.0) f30-1)) + (set! (-> arg0 point-of-interest-blend target) 1.0) + ) + (else + (set! (-> arg0 point-of-interest-blend target) 0.0) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +(defun v-slrp2! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector) (arg5 float)) + (local-vars + (f0-10 float) + (f28-0 float) + (f30-0 float) + (sv-144 float) + (sv-160 vector) + (sv-176 matrix) + (sv-192 vector) + ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (set! sv-144 arg5) + (let ((s0-0 (new-stack-vector0))) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! (-> sv-160 quad) (the-as uint128 0)) + 1.0 + 1.0 + (let ((s3-0 (new-stack-vector0))) + 0.0 + 1.0 + (set! sv-176 (new 'stack-no-clear 'matrix)) + (set! (-> sv-176 vector 0 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 1 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) + (set! (-> sv-176 trans quad) (the-as uint128 0)) + (cond + ((< 1.0 arg3) + (set! arg3 1.0) + ) + ((< arg3 0.0) + (set! arg3 0.0) + ) + ) + (cond + (arg4 + (vector-flatten! s0-0 arg1 arg4) + (vector-flatten! sv-160 arg2 arg4) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) + (let ((f26-0 (vector-dot arg4 s3-0))) + (vector-normalize-copy! s3-0 arg4 1.0) + (if (< f26-0 0.0) + (vector-negate! s3-0 s3-0) + ) + ) + ) + (else + (set! (-> s0-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) + ) + ) + (let ((t9-10 acos)) + ;; NOTE - manually fixed - #1819 + (let* ((v1-22 (-> *camera* local-down))) + (set! f0-10 (vector-dot v1-22 sv-160))) + (let* ((f1-3 (t9-10 f0-10)) + (f0-12 (* arg3 f1-3)) + ) + (when (< sv-144 f0-12) + (set! f0-12 sv-144) + (set! arg3 (/ sv-144 f1-3)) + ) + (let* ((f0-13 (cos f0-12)) + (t9-12 matrix-axis-sin-cos!) + (a0-20 sv-176) + (a1-13 s3-0) + (f1-5 1.0) + (f2-3 f0-13) + ) + (t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13) + ) + ) + ) + (vector-matrix*! arg0 s0-0 sv-176) + (let ((s0-1 vector-normalize!)) + (set! sv-192 arg0) + (let ((a1-16 (lerp f30-0 f28-0 arg3))) + (s0-1 sv-192 a1-16) + ) + ) + (when arg4 + (let ((v1-33 arg0)) + (let ((a0-24 arg0) + (a1-17 s3-0) + (f0-15 (vector-dot arg1 s3-0)) + ) + (.lvf vf2 (&-> a1-17 quad)) + (.lvf vf1 (&-> a0-24 quad)) + (let ((a0-25 f0-15)) + (.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-33 quad) vf4) + ) + (let ((v1-34 arg0)) + (let ((a0-26 arg0) + (a1-18 s3-0) + (f0-17 (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) + ) + (.lvf vf2 (&-> a1-18 quad)) + (.lvf vf1 (&-> a0-26 quad)) + (let ((a0-27 f0-17)) + (.mov vf3 a0-27) + ) + ) + (.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-34 quad) vf4) + ) + ) + ) + ) + arg0 + ) + ) + +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +(defun v-slrp3! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float)) + (local-vars (f0-7 float) (f26-0 float) (f28-0 float) (sv-144 float) (sv-160 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (set! sv-144 arg4) + (let ((s1-0 (new-stack-vector0))) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! (-> sv-160 quad) (the-as uint128 0)) + 0.0 + 0.0 + (let ((s3-0 (new-stack-vector0)) + (f30-0 1.0) + ) + 0.0 + (let ((s0-0 (new-stack-matrix0))) + (cond + (arg3 + (vector-flatten! s1-0 arg1 arg3) + (vector-flatten! sv-160 arg2 arg3) + (set! f28-0 (vector-normalize-ret-len! s1-0 1.0)) + (set! f26-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s1-0) 1.0) + (let ((f24-0 (vector-dot arg3 s3-0))) + (vector-normalize-copy! s3-0 arg3 1.0) + (if (< f24-0 0.0) + (vector-negate! s3-0 s3-0) + ) + ) + ) + (else + (set! (-> s1-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f28-0 (vector-normalize-ret-len! s1-0 1.0)) + (set! f26-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) + ) + ) + (let ((t9-10 acos)) + ;; NOTE - manually fixed - #1819 + (let* ((v1-10 (-> *camera* local-down))) + (set! f0-7 (vector-dot v1-10 sv-160))) + (let ((f0-8 (t9-10 f0-7))) + (when (< sv-144 f0-8) + (set! f30-0 (/ sv-144 f0-8)) + (set! f0-8 sv-144) + ) + (let* ((f0-9 (cos f0-8)) + (t9-12 matrix-axis-sin-cos!) + (a0-20 s0-0) + (a1-13 s3-0) + (f1-3 1.0) + (f2-1 f0-9) + ) + (t9-12 a0-20 a1-13 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-9) + ) + ) + ) + (vector-matrix*! arg0 s1-0 s0-0) + ) + (vector-normalize! arg0 (lerp f28-0 f26-0 f30-0)) + (when arg3 + (let ((v1-21 arg0)) + (let ((a0-24 arg0) + (a1-17 s3-0) + (f0-11 (vector-dot arg1 s3-0)) + ) + (.lvf vf2 (&-> a1-17 quad)) + (.lvf vf1 (&-> a0-24 quad)) + (let ((a0-25 f0-11)) + (.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-21 quad) vf4) + ) + (let ((v1-22 arg0)) + (let ((a0-26 arg0) + (a1-18 s3-0) + (f0-14 (* f30-0 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) + ) + (.lvf vf2 (&-> a1-18 quad)) + (.lvf vf1 (&-> a0-26 quad)) + (let ((a0-27 f0-14)) + (.mov vf3 a0-27) + ) + ) + (.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-22 quad) vf4) + ) + ) + ) + ) + arg0 + ) + ) + + + + diff --git a/goal_src/jak2/engine/collide/collide-cache-h.gc b/goal_src/jak2/engine/collide/collide-cache-h.gc index 64358df878..0586c049c8 100644 --- a/goal_src/jak2/engine/collide/collide-cache-h.gc +++ b/goal_src/jak2/engine/collide/collide-cache-h.gc @@ -16,6 +16,7 @@ :flag-assert #x900000030 ) + (deftype collide-puss-work (structure) ((closest-pt vector :inline :offset-assert 0) (tri-normal vector :inline :offset-assert 16) @@ -32,6 +33,7 @@ ) ) + (deftype collide-cache-tri (structure) ((vertex vector 3 :inline :offset-assert 0) (extra-quad uint8 16 :offset-assert 48) @@ -46,6 +48,7 @@ :flag-assert #x900000040 ) + (deftype collide-cache-prim (structure) ((prim-core collide-prim-core :inline :offset-assert 0) (extra-quad uint8 16 :offset-assert 32) @@ -68,6 +71,7 @@ ) ) + (deftype collide-cache (basic) ((num-tris int32 :offset-assert 4) (num-prims int32 :offset-assert 8) @@ -85,7 +89,7 @@ :flag-assert #x1a00008670 (:methods (collide-cache-method-9 () none 9) - (collide-cache-method-10 () none 10) + (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) (collide-cache-method-11 () none 11) (collide-cache-method-12 () none 12) (collide-cache-method-13 () none 13) @@ -104,6 +108,7 @@ ) ) + (deftype collide-list-item (structure) ((mesh collide-frag-mesh :offset-assert 0) (inst basic :offset-assert 4) @@ -114,6 +119,7 @@ :flag-assert #x900000008 ) + (deftype collide-list (structure) ((num-items int32 :offset-assert 0) (items collide-list-item 256 :inline :offset 16) @@ -123,6 +129,7 @@ :flag-assert #x900000810 ) + (kmemopen global "collide-cache") (define-perm *collide-cache* collide-cache (new 'global 'collide-cache)) diff --git a/goal_src/jak2/engine/data/art-h.gc b/goal_src/jak2/engine/data/art-h.gc index b3f6108ea9..b0bf3bfb45 100644 --- a/goal_src/jak2/engine/data/art-h.gc +++ b/goal_src/jak2/engine/data/art-h.gc @@ -59,6 +59,7 @@ :flag-assert #x90000000c ) + (deftype joint-anim-matrix (joint-anim) ((data matrix :inline :dynamic :offset 16) ) @@ -75,6 +76,7 @@ :flag-assert #x900000010 ) + (deftype joint-anim-drawable (joint-anim) ((data drawable :dynamic :offset-assert 12) ) @@ -83,6 +85,7 @@ :flag-assert #x90000000c ) + (deftype joint-anim-frame (structure) ((matrices matrix 2 :inline :offset-assert 0) (data transformq :inline :dynamic :offset-assert 128) @@ -95,6 +98,7 @@ ) ) + (defmethod new joint-anim-frame ((allocation symbol) (type-to-make type) (arg0 int)) (let ((v1-1 (max 0 (+ arg0 -2)))) (the-as @@ -114,6 +118,7 @@ :flag-assert #x900000040 ) + (deftype joint-anim-compressed-fixed (structure) ((hdr joint-anim-compressed-hdr :inline :offset-assert 0) (offset-64 uint32 :offset-assert 64) @@ -127,6 +132,7 @@ :flag-assert #x9000008a0 ) + (deftype joint-anim-compressed-frame (structure) ((offset-64 uint32 :offset-assert 0) (offset-32 uint32 :offset-assert 4) @@ -139,6 +145,7 @@ :flag-assert #x900000860 ) + (deftype joint-anim-compressed-control (structure) ((num-frames uint16 :offset-assert 0) (flags uint16 :offset-assert 2) @@ -152,6 +159,7 @@ :flag-assert #x900000010 ) + (deftype art (basic) ((name string :offset 8) (length int32 :offset-assert 12) @@ -168,6 +176,7 @@ ) ) + (deftype art-element (art) ((pad uint8 12 :offset-assert 20) ) @@ -176,6 +185,7 @@ :flag-assert #xd00000020 ) + (deftype art-mesh-anim (art-element) ((data basic :dynamic :offset-assert 32) ) @@ -199,6 +209,7 @@ :flag-assert #xd00000030 ) + (deftype art-group (art) ((info file-info :offset 4) (data art-element :dynamic :offset 32) @@ -230,15 +241,16 @@ ) (deftype art-joint-anim-manager-slot (structure) - ((anim art-joint-anim :offset-assert 0) - (comp-data uint32 :offset-assert 4) - (time-stamp uint64 :offset-assert 8) + ((anim art-joint-anim :offset-assert 0) + (comp-data uint32 :offset-assert 4) + (time-stamp uint64 :offset-assert 8) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) + (deftype art-joint-anim-manager (basic) ((kheap kheap :inline :offset-assert 16) (free-index int32 :offset-assert 32) @@ -257,19 +269,6 @@ ) ) -(defmethod inspect art-joint-anim-manager ((obj art-joint-anim-manager)) - (when (not obj) - (return obj) - ) - (format #t "[~8x] ~A~%" obj (-> obj type)) - (format #t "~1Theap: #~%" (-> obj kheap)) - (format #t "~1Tfree-index: ~D~%" (-> obj free-index)) - (format #t "~1Tslot[64] @ #x~X~%" (-> obj slot)) - (dotimes (s5-0 64) - (format #t "~T [~D]~1Tslot: ~`art-joint-anim-manager-slot`P~%" s5-0 (-> obj slot s5-0)) - ) - obj - ) (defmethod new art-joint-anim-manager ((allocation symbol) (type-to-make type) (arg0 int)) (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) @@ -314,6 +313,7 @@ ) ) + (deftype lod-group (structure) ((geo merc-ctrl :offset-assert 0) (dist meters :offset-assert 4) @@ -324,6 +324,7 @@ :flag-assert #x900000008 ) + (deftype lod-set (structure) ((lod lod-group 6 :inline :offset-assert 0) (max-lod int8 :offset-assert 48) @@ -336,6 +337,7 @@ ) ) + (deftype draw-control (basic) ((process process :offset-assert 4) (status draw-control-status :offset-assert 8) @@ -391,7 +393,13 @@ ) ) + (defmethod get-skeleton-origin draw-control ((obj draw-control)) - (-> obj skeleton bones 0 transform trans) + (-> obj skeleton bones 0 transform vector 3) ) +0 + + + + diff --git a/goal_src/jak2/engine/debug/debug-h.gc b/goal_src/jak2/engine/debug/debug-h.gc index 64fb986ddb..88f88b434b 100644 --- a/goal_src/jak2/engine/debug/debug-h.gc +++ b/goal_src/jak2/engine/debug/debug-h.gc @@ -5,6 +5,12 @@ ;; name in dgo: debug-h ;; dgos: ENGINE, GAME +;; NOTE - for cam-states +(define-extern add-debug-flat-triangle (function symbol bucket-id vector vector vector rgba symbol)) +;; 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)) + ;; DECOMP BEGINS (deftype pos-history (structure) diff --git a/goal_src/jak2/engine/entity/entity-h.gc b/goal_src/jak2/engine/entity/entity-h.gc index 7ba1182d01..6d0b15c9cc 100644 --- a/goal_src/jak2/engine/entity/entity-h.gc +++ b/goal_src/jak2/engine/entity/entity-h.gc @@ -23,6 +23,9 @@ (declare-type race-mesh basic) +;; NOTE - for cam-start +(define-extern reset-cameras (function none)) + ;; DECOMP BEGINS (define *generate-actor-vis* #f) diff --git a/goal_src/jak2/engine/game/main-h.gc b/goal_src/jak2/engine/game/main-h.gc index 1d969607cc..3cef796710 100644 --- a/goal_src/jak2/engine/game/main-h.gc +++ b/goal_src/jak2/engine/game/main-h.gc @@ -311,3 +311,4 @@ ) (define-extern movie? (function symbol)) +(define-extern paused? (function symbol)) diff --git a/goal_src/jak2/engine/geometry/cylinder.gc b/goal_src/jak2/engine/geometry/cylinder.gc index 4c6af26adf..d879c397a9 100644 --- a/goal_src/jak2/engine/geometry/cylinder.gc +++ b/goal_src/jak2/engine/geometry/cylinder.gc @@ -63,6 +63,7 @@ :flag-assert #x900000180 ) + (defmethod debug-draw cylinder ((obj cylinder) (arg0 vector4w)) (local-vars (sv-896 matrix) @@ -105,7 +106,7 @@ (matrix-axis-angle! s3-0 (-> obj axis) 4096.0) (set! sv-896 (new 'stack-no-clear 'matrix)) (vector-matrix*! (the-as vector sv-896) (-> obj origin) s3-0) - (let ((v1-6 (-> s3-0 trans))) + (let ((v1-6 (-> s3-0 vector 3))) (.lvf vf4 (&-> (-> obj origin) quad)) (.lvf vf5 (&-> sv-896 vector 0 quad)) (.mov.vf vf6 vf0 :mask #b1000) @@ -289,6 +290,7 @@ :flag-assert #x9000000a0 ) + (defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector4w)) (local-vars (sv-448 vector)) (rlet ((acc :class vf) @@ -317,7 +319,7 @@ (matrix-axis-angle! s3-0 (-> obj axis) 4096.0) (set! sv-448 (new 'stack-no-clear 'vector)) (vector-matrix*! sv-448 (-> obj origin) s3-0) - (let ((v1-6 (-> s3-0 trans))) + (let ((v1-6 (-> s3-0 vector 3))) (.lvf vf4 (&-> (-> obj origin) quad)) (.lvf vf5 (&-> sv-448 quad)) (.mov.vf vf6 vf0 :mask #b1000) diff --git a/goal_src/jak2/engine/gfx/mood/time-of-day-h.gc b/goal_src/jak2/engine/gfx/mood/time-of-day-h.gc index c950d2695e..d96c7ad170 100644 --- a/goal_src/jak2/engine/gfx/mood/time-of-day-h.gc +++ b/goal_src/jak2/engine/gfx/mood/time-of-day-h.gc @@ -36,6 +36,7 @@ :flag-assert #x900000018 ) + (deftype palette-fade-controls (basic) ((control palette-fade-control 8 :inline :offset-assert 16) ) @@ -43,11 +44,12 @@ :size-assert #x110 :flag-assert #xb00000110 (:methods - (palette-fade-controls-method-9 () none 9) - (palette-fade-controls-method-10 () none 10) + (reset! (_type_) none 9) + (set-fade! (_type_ int float float vector) object 10) ) ) + (define-perm *palette-fade-controls* palette-fade-controls (new 'global 'palette-fade-controls)) (deftype time-of-day-proc (process) @@ -74,6 +76,7 @@ :flag-assert #xe005000d0 ) + (deftype time-of-day-palette (basic) ((width int32 :offset-assert 4) (height int32 :offset-assert 8) @@ -85,6 +88,7 @@ :flag-assert #x900000014 ) + (deftype time-of-day-context (basic) ((interp float 6 :offset-assert 4) (current-fog mood-fog :inline :offset-assert 32) @@ -117,6 +121,7 @@ :flag-assert #x900000834 ) + (deftype time-of-day-dma (structure) ((outa uint32 256 :offset-assert 0) (outb uint32 256 :offset-assert 1024) @@ -128,5 +133,11 @@ :flag-assert #x900001000 ) + (define *time-of-day-context* (new 'static 'time-of-day-context)) +0 + + + + diff --git a/goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc b/goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc index 5fa4c6726e..fc6fae8fa6 100644 --- a/goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc +++ b/goal_src/jak2/engine/gfx/shrub/shrubbery-h.gc @@ -5,6 +5,11 @@ ;; name in dgo: shrubbery-h ;; dgos: ENGINE, GAME +;; NOTE - for cam-update +(declare-type instance-shrub-work structure) +(define-extern *instance-shrub-work* instance-shrub-work) +(define-extern shrub-make-perspective-matrix (function matrix matrix)) + ;; DECOMP BEGINS (deftype billboard (drawable) diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc index fb14b722cf..3649aca84e 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc @@ -149,6 +149,7 @@ :flag-assert #x90000001c ) + (deftype sp-field-init-spec (structure) ((field sp-field-id :offset-assert 0) (flags sp-flag :offset-assert 2) @@ -170,6 +171,7 @@ :flag-assert #x900000010 ) + (deftype sparticle-launcher (basic) ((birthaccum float :offset-assert 4) (soundaccum float :offset-assert 8) @@ -184,6 +186,7 @@ ) ) + (deftype sparticle-group-item (structure) ((launcher uint32 :offset-assert 0) (fade-after meters :offset-assert 4) @@ -200,6 +203,7 @@ :flag-assert #x90000001c ) + (deftype sparticle-launch-state (structure) ((group-item sparticle-group-item :offset-assert 0) (flags sp-launch-state-flags :offset-assert 4) @@ -222,6 +226,7 @@ :flag-assert #x900000024 ) + (deftype sparticle-launch-group (basic) ((length int16 :offset-assert 4) (duration uint16 :offset-assert 6) @@ -245,6 +250,7 @@ ) ) + (define *launch-matrix* (matrix-identity! (new 'global 'matrix))) (deftype sparticle-launch-control (inline-array-class) @@ -275,5 +281,11 @@ ) ) + (set! (-> sparticle-launch-control heap-base) (the-as uint 48)) +0 + + + + diff --git a/goal_src/jak2/engine/gfx/texture/texture-h.gc b/goal_src/jak2/engine/gfx/texture/texture-h.gc index fa753dce73..5935bb677c 100644 --- a/goal_src/jak2/engine/gfx/texture/texture-h.gc +++ b/goal_src/jak2/engine/gfx/texture/texture-h.gc @@ -13,6 +13,10 @@ (declare-type texture-pool basic) (define-extern *texture-pool* texture-pool) +;; NOTE - for cam-update +(declare-type fog-texture-work structure) +(define-extern *fog-texture-work* fog-texture-work) + ;; DECOMP BEGINS (deftype texture-id (uint32) diff --git a/goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc b/goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc index a2e973abda..aae599f154 100644 --- a/goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc +++ b/goal_src/jak2/engine/gfx/tfrag/tfrag-h.gc @@ -5,6 +5,10 @@ ;; name in dgo: tfrag-h ;; dgos: ENGINE, GAME +;; NOTE - for cam-debug +(declare-type tfrag-work structure) +(define-extern *tfrag-work* tfrag-work) + ;; DECOMP BEGINS (deftype tfragment-stats (structure) diff --git a/goal_src/jak2/engine/gfx/tie/tie-h.gc b/goal_src/jak2/engine/gfx/tie/tie-h.gc index 3bbc7f8da6..12e513accc 100644 --- a/goal_src/jak2/engine/gfx/tie/tie-h.gc +++ b/goal_src/jak2/engine/gfx/tie/tie-h.gc @@ -5,6 +5,10 @@ ;; name in dgo: tie-h ;; dgos: ENGINE, GAME +;; NOTE - for cam-update +(declare-type instance-tie-work structure) +(define-extern *instance-tie-work* instance-tie-work) + ;; DECOMP BEGINS (deftype tie-fragment-debug (structure) diff --git a/goal_src/jak2/engine/level/bsp-h.gc b/goal_src/jak2/engine/level/bsp-h.gc index d107bf2acd..cdc820e8f7 100644 --- a/goal_src/jak2/engine/level/bsp-h.gc +++ b/goal_src/jak2/engine/level/bsp-h.gc @@ -46,8 +46,11 @@ (cameras (array entity-camera) :offset-assert 116) (nodes (inline-array bsp-node) :offset 120) (level level :offset-assert 124) + (current-leaf-idx uint16 :offset-assert 128) (unk-data-2 uint16 9 :offset 130) - (unk-byte uint8 :offset 152) + (unk-byte1 uint8 :offset 152) + (unk-byte2 uint8 :offset 153) + (unk-half-word uint16 :offset-assert 154) (ambients symbol :offset-assert 156) (unk-data-4 float :offset 160) (unk-data-5 float :offset-assert 164) diff --git a/goal_src/jak2/engine/level/level-h.gc b/goal_src/jak2/engine/level/level-h.gc index 54df9e1a38..f5357d346e 100644 --- a/goal_src/jak2/engine/level/level-h.gc +++ b/goal_src/jak2/engine/level/level-h.gc @@ -114,6 +114,7 @@ :flag-assert #x900000034 ) + (defmethod asize-of level-vis-info ((obj level-vis-info)) (the-as int (+ (-> level-vis-info size) (-> obj dictionary-length))) ) @@ -130,14 +131,14 @@ (other-name-1 symbol :offset 24) (packages pair :offset-assert 32) (memory-mode uint32 :offset-assert 36) - (music-bank symbol :offset-assert 40) - (ambient-sounds symbol :offset-assert 44) + (music-bank symbol :offset-assert 40) + (ambient-sounds symbol :offset-assert 44) (sound-reverb float :offset-assert 48) (mood-func symbol :offset-assert 52) (mood-init symbol :offset-assert 56) - (ocean symbol :offset-assert 60) - (sky symbol :offset-assert 64) - (use-camera-other symbol :offset-assert 68) + (ocean symbol :offset-assert 60) + (sky symbol :offset-assert 64) + (use-camera-other symbol :offset-assert 68) (part-engine-max int32 :offset-assert 72) (city-map-bits uint64 :offset-assert 80) (continues pair :offset-assert 88) @@ -149,8 +150,8 @@ (buzzer int32 :offset-assert 120) (buttom-height meters :offset-assert 124) (run-packages pair :offset-assert 128) - (prev-level symbol :offset-assert 132) - (next-level symbol :offset-assert 136) + (prev-level symbol :offset-assert 132) + (next-level symbol :offset-assert 136) (wait-for-load symbol :offset-assert 140) (login-func symbol :offset-assert 144) (activate-func symbol :offset-assert 148) @@ -158,7 +159,7 @@ (kill-func symbol :offset-assert 156) (borrow-size uint16 2 :offset-assert 160) (borrow-level symbol 2 :offset-assert 164) - (borrow-display? symbol 2 :offset-assert 172) + (borrow-display? symbol 2 :offset-assert 172) (base-task-mask task-mask :offset-assert 180) (texture-anim symbol 10 :offset-assert 184) (texture-anim-tfrag symbol :offset 184) @@ -189,6 +190,7 @@ :flag-assert #x900000120 ) + (deftype login-state (basic) ((state int32 :offset-assert 4) (pos uint32 :offset-assert 8) @@ -200,79 +202,80 @@ :flag-assert #x900000050 ) + (deftype level (basic) - ((name symbol :offset-assert 4) - (load-name basic :offset-assert 8) - (nickname basic :offset-assert 12) - (index int32 :offset-assert 16) - (status symbol :offset-assert 20) - (borrow-level basic 2 :offset-assert 24) - (borrow-from-level basic :offset-assert 32) - (heap kheap :inline :offset-assert 48) - (borrow-heap kheap 2 :inline :offset-assert 64) - (bsp bsp-header :offset-assert 96) - (art-group load-dir-art-group :offset-assert 100) - (info level-load-info :offset-assert 104) - (texture-page texture-page 18 :offset-assert 108) - (loaded-texture-page texture-page 16 :offset-assert 180) - (loaded-texture-page-count int32 :offset-assert 244) - (entity entity-links-array :offset-assert 248) - (closest-object float :offset-assert 252) - (closest-object-array float 18 :offset 252) - (upload-size int32 18 :offset 324) - (inside-boxes symbol :offset-assert 396) - (display? symbol :offset-assert 400) - (render? symbol :offset-assert 404) - (meta-inside? symbol :offset-assert 408) - (force-inside? symbol :offset-assert 412) - (mood-context mood-context :inline :offset-assert 416) - (mood-func basic :offset-assert 2384) - (mood-init (function mood-context none) :offset-assert 2388) - (vis-bits pointer :offset-assert 2392) - (all-visible? symbol :offset-assert 2396) - (force-all-visible? symbol :offset-assert 2400) - (linking basic :offset-assert 2404) - (vis-info level-vis-info 8 :offset-assert 2408) - (vis-self-index int32 :offset-assert 2440) - (vis-adj-index int32 :offset-assert 2444) - (vis-buffer uint8 2048 :offset-assert 2448) - (mem-usage-block memory-usage-block :offset-assert 4496) - (mem-usage int32 :offset-assert 4500) - (code-memory-start pointer :offset-assert 4504) - (code-memory-end pointer :offset-assert 4508) - (load-start-time time-frame :offset-assert 4512) - (load-stop-time time-frame :offset-assert 4520) - (load-buffer uint32 2 :offset-assert 4528) - (load-buffer-size uint32 :offset-assert 4536) - (load-buffer-last uint32 :offset-assert 4540) - (load-buffer-mode load-buffer-mode :offset-assert 4544) - (display-start-time time-frame :offset-assert 4552) - (memory-mask uint32 :offset-assert 4560) - (task-mask task-mask :offset-assert 4564) - (tfrag-gs-test uint64 :offset-assert 4568) - (texture-dirty-masks texture-mask 10 :inline :offset-assert 4576) - (texture-mask texture-mask 18 :inline :offset-assert 4736) - (sky-mask texture-mask :inline :offset-assert 5024) - (tfrag-masks basic :offset-assert 5040) - (tfrag-dists pointer :offset-assert 5044) - (shrub-masks basic :offset-assert 5048) - (shrub-dists pointer :offset-assert 5052) - (alpha-masks basic :offset-assert 5056) - (alpha-dists pointer :offset-assert 5060) - (water-masks basic :offset-assert 5064) - (water-dists pointer :offset-assert 5068) - (tfrag-last-calls int32 6 :offset-assert 5072) - (texture-anim-array texture-anim-array 10 :offset-assert 5096) - (light-hash basic :offset-assert 5136) - (draw-priority float :offset-assert 5140) - (draw-index int32 :offset-assert 5144) - (part-engine basic :offset-assert 5148) - (user-object basic 4 :offset-assert 5152) - (loaded-text-info-count int32 :offset-assert 5168) - (loaded-text-info game-text-info 8 :offset-assert 5172) - (level-type basic :offset-assert 5204) - (load-order int64 :offset-assert 5208) - (pad int8 12 :offset-assert 5216) + ((name symbol :offset-assert 4) + (load-name basic :offset-assert 8) + (nickname basic :offset-assert 12) + (index int32 :offset-assert 16) + (status symbol :offset-assert 20) + (borrow-level basic 2 :offset-assert 24) + (borrow-from-level basic :offset-assert 32) + (heap kheap :inline :offset-assert 48) + (borrow-heap kheap 2 :inline :offset-assert 64) + (bsp bsp-header :offset-assert 96) + (art-group load-dir-art-group :offset-assert 100) + (info level-load-info :offset-assert 104) + (texture-page texture-page 18 :offset-assert 108) + (loaded-texture-page texture-page 16 :offset-assert 180) + (loaded-texture-page-count int32 :offset-assert 244) + (entity entity-links-array :offset-assert 248) + (closest-object float :offset-assert 252) + (closest-object-array float 18 :offset 252) + (upload-size int32 18 :offset 324) + (inside-boxes symbol :offset-assert 396) + (display? symbol :offset-assert 400) + (render? symbol :offset-assert 404) + (meta-inside? symbol :offset-assert 408) + (force-inside? symbol :offset-assert 412) + (mood-context mood-context :inline :offset-assert 416) + (mood-func (function mood-context float int none) :offset-assert 2384) + (mood-init (function mood-context none) :offset-assert 2388) + (vis-bits pointer :offset-assert 2392) + (all-visible? symbol :offset-assert 2396) + (force-all-visible? symbol :offset-assert 2400) + (linking basic :offset-assert 2404) + (vis-info level-vis-info 8 :offset-assert 2408) + (vis-self-index int32 :offset-assert 2440) + (vis-adj-index int32 :offset-assert 2444) + (vis-buffer uint8 2048 :offset-assert 2448) + (mem-usage-block memory-usage-block :offset-assert 4496) + (mem-usage int32 :offset-assert 4500) + (code-memory-start pointer :offset-assert 4504) + (code-memory-end pointer :offset-assert 4508) + (load-start-time time-frame :offset-assert 4512) + (load-stop-time time-frame :offset-assert 4520) + (load-buffer uint32 2 :offset-assert 4528) + (load-buffer-size uint32 :offset-assert 4536) + (load-buffer-last uint32 :offset-assert 4540) + (load-buffer-mode load-buffer-mode :offset-assert 4544) + (display-start-time time-frame :offset-assert 4552) + (memory-mask uint32 :offset-assert 4560) + (task-mask task-mask :offset-assert 4564) + (tfrag-gs-test uint64 :offset-assert 4568) + (texture-dirty-masks texture-mask 10 :inline :offset-assert 4576) + (texture-mask texture-mask 18 :inline :offset-assert 4736) + (sky-mask texture-mask :inline :offset-assert 5024) + (tfrag-masks basic :offset-assert 5040) + (tfrag-dists pointer :offset-assert 5044) + (shrub-masks basic :offset-assert 5048) + (shrub-dists pointer :offset-assert 5052) + (alpha-masks basic :offset-assert 5056) + (alpha-dists pointer :offset-assert 5060) + (water-masks basic :offset-assert 5064) + (water-dists pointer :offset-assert 5068) + (tfrag-last-calls int32 6 :offset-assert 5072) + (texture-anim-array texture-anim-array 10 :offset-assert 5096) + (light-hash basic :offset-assert 5136) + (draw-priority float :offset-assert 5140) + (draw-index int32 :offset-assert 5144) + (part-engine basic :offset-assert 5148) + (user-object basic 4 :offset-assert 5152) + (loaded-text-info-count int32 :offset-assert 5168) + (loaded-text-info game-text-info 8 :offset-assert 5172) + (level-type basic :offset-assert 5204) + (load-order int64 :offset-assert 5208) + (pad int8 12 :offset-assert 5216) ) :method-count-assert 30 :size-assert #x146c @@ -302,149 +305,6 @@ ) ) -(defmethod inspect level ((obj level)) - (when (not obj) - (return obj) - ) - (format #t "[~8x] ~A~%" obj (-> obj type)) - (format #t "~1Tname: ~A~%" (-> obj name)) - (format #t "~1Tload-name: ~A~%" (-> obj load-name)) - (format #t "~1Tnickname: ~A~%" (-> obj nickname)) - (format #t "~1Tindex: ~D~%" (-> obj index)) - (format #t "~1Tstatus: ~A~%" (-> obj status)) - (format #t "~1Tborrow-level[2] @ #x~X~%" (-> obj borrow-level)) - (dotimes (s5-0 2) - (format #t "~T [~D]~1Tborrow-level: ~A~%" s5-0 (-> obj borrow-level s5-0)) - ) - (format #t "~1Tborrow-from-level: ~A~%" (-> obj borrow-from-level)) - (format #t "~1Theap: #~%" (-> obj heap)) - (format #t "~1Tborrow-heap[2] @ #x~X~%" (-> obj borrow-heap)) - (format #t "~1Tbsp: ~A~%" (-> obj bsp)) - (format #t "~1Tart-group: ~A~%" (-> obj art-group)) - (format #t "~1Tinfo: ~A~%" (-> obj info)) - (format #t "~1Ttexture-page[18] @ #x~X~%" (-> obj texture-page)) - (format #t "~1Tloaded-texture-page[16] @ #x~X~%" (-> obj loaded-texture-page)) - (format #t "~1Tloaded-texture-page-count: ~D~%" (-> obj loaded-texture-page-count)) - (format #t "~1Tentity: ~A~%" (-> obj entity)) - (format #t "~1Tclosest-object: (meters ~m)~%" (&-> obj closest-object)) - (format #t "~1Tupload-size[18] @ #x~X~%" (-> obj upload-size)) - (format #t "~1Tinside-boxes?: ~A~%" (-> obj inside-boxes)) - (format #t "~1Tdisplay?: ~A~%" (-> obj display?)) - (format #t "~1Trender?: ~A~%" (-> obj render?)) - (format #t "~1Tmeta-inside?: ~A~%" (-> obj meta-inside?)) - (format #t "~1Tforce-inside?: ~A~%" (-> obj force-inside?)) - (format #t "~1Tmood-context: #~%" (-> obj mood-context)) - (format #t "~1Tmood-func: ~A~%" (-> obj mood-func)) - (format #t "~1Tmood-init: ~A~%" (-> obj mood-init)) - (format #t "~1Tvis-bits: #x~X~%" (-> obj vis-bits)) - (format #t "~1Tall-visible?: ~A~%" (-> obj all-visible?)) - (format #t "~1Tforce-all-visible?: ~A~%" (-> obj force-all-visible?)) - (format #t "~1Tlinking: ~A~%" (-> obj linking)) - (format #t "~1Tvis-info[8] @ #x~X~%" (-> obj vis-info)) - (format #t "~1Tvis-self-index: ~D~%" (-> obj vis-self-index)) - (format #t "~1Tvis-adj-index: ~D~%" (-> obj vis-adj-index)) - (format #t "~1Tvis-buffer[2048] @ #x~X~%" (-> obj vis-buffer)) - (format #t "~1Tmem-usage-block: ~A~%" (-> obj mem-usage-block)) - (format #t "~1Tmem-usage: ~D~%" (-> obj mem-usage)) - (format #t "~1Tcode-memory-start: #x~X~%" (-> obj code-memory-start)) - (format #t "~1Tcode-memory-end: #x~X~%" (-> obj code-memory-end)) - (format #t "~1Tload-start-time: ~D~%" (-> obj load-start-time)) - (format #t "~1Tload-stop-time: ~D~%" (-> obj load-stop-time)) - (format #t "~1Tload-buffer[2] @ #x~X~%" (-> obj load-buffer)) - (format #t "~1Tload-buffer-size: ~D~%" (-> obj load-buffer-size)) - (format #t "~1Tload-buffer-last: ~A~%" (-> obj load-buffer-last)) - (format #t "~1Tload-buffer-mode: ~D~%" (-> obj load-buffer-mode)) - (format #t "~1Tdisplay-start-time: ~D~%" (-> obj display-start-time)) - (format #t "~1Tmemory-mask: #b~B~%" (-> obj memory-mask)) - (format #t "~1Ttask-mask: #x~X : (task-mask " (-> obj task-mask)) - (let ((s5-1 (-> obj task-mask))) - (if (= (logand s5-1 (task-mask task0)) (task-mask task0)) - (format #t "task0 ") - ) - (if (= (logand s5-1 (task-mask task2)) (task-mask task2)) - (format #t "task2 ") - ) - (if (= (logand s5-1 (task-mask task4)) (task-mask task4)) - (format #t "task4 ") - ) - (if (= (logand s5-1 (task-mask task6)) (task-mask task6)) - (format #t "task6 ") - ) - (if (= (logand s5-1 (task-mask ctywide)) (task-mask ctywide)) - (format #t "ctywide ") - ) - (if (= (logand s5-1 (task-mask never)) (task-mask never)) - (format #t "never ") - ) - (if (= (logand (task-mask movie1) s5-1) (task-mask movie1)) - (format #t "movie1 ") - ) - (if (= (logand s5-1 (task-mask dummy1)) (task-mask dummy1)) - (format #t "dummy1 ") - ) - (if (= (logand s5-1 (task-mask primary0)) (task-mask primary0)) - (format #t "primary0 ") - ) - (if (= (logand s5-1 (task-mask task1)) (task-mask task1)) - (format #t "task1 ") - ) - (if (= (logand s5-1 (task-mask task3)) (task-mask task3)) - (format #t "task3 ") - ) - (if (= (logand s5-1 (task-mask task5)) (task-mask task5)) - (format #t "task5 ") - ) - (if (= (logand s5-1 (task-mask task7)) (task-mask task7)) - (format #t "task7 ") - ) - (if (= (logand (task-mask movie2) s5-1) (task-mask movie2)) - (format #t "movie2 ") - ) - (if (= (logand s5-1 (task-mask dummy2)) (task-mask dummy2)) - (format #t "dummy2 ") - ) - (if (= (logand s5-1 (task-mask done)) (task-mask done)) - (format #t "done ") - ) - (if (= (logand s5-1 (task-mask special)) (task-mask special)) - (format #t "special ") - ) - (if (= (logand (task-mask movie0) s5-1) (task-mask movie0)) - (format #t "movie0 ") - ) - (if (= (logand s5-1 (task-mask dummy0)) (task-mask dummy0)) - (format #t "dummy0 ") - ) - ) - (format #t ")~%") - (format #t "~1Ttfrag-gs-test: ~D~%" (-> obj tfrag-gs-test)) - (format #t "~1Ttexture-dirty-masks[10] @ #x~X~%" (-> obj texture-dirty-masks)) - (format #t "~1Ttexture-mask[18] @ #x~X~%" (-> obj texture-mask)) - (format #t "~1Tsky-mask: #~%" (-> obj sky-mask)) - (format #t "~1Ttfrag-masks: ~A~%" (-> obj tfrag-masks)) - (format #t "~1Ttfrag-dists: #x~X~%" (-> obj tfrag-dists)) - (format #t "~1Tshrub-masks: ~A~%" (-> obj shrub-masks)) - (format #t "~1Tshrub-dists: #x~X~%" (-> obj shrub-dists)) - (format #t "~1Talpha-masks: ~A~%" (-> obj alpha-masks)) - (format #t "~1Talpha-dists: #x~X~%" (-> obj alpha-dists)) - (format #t "~1Twater-masks: ~A~%" (-> obj water-masks)) - (format #t "~1Twater-dists: #x~X~%" (-> obj water-dists)) - (format #t "~1Ttfrag-last-calls[6] @ #x~X~%" (-> obj tfrag-last-calls)) - (format #t "~1Ttexture-anim-array[10] @ #x~X~%" (-> obj texture-anim-array)) - (format #t "~1Tlight-hash: ~A~%" (-> obj light-hash)) - (format #t "~1Tdraw-priority: ~f~%" (-> obj draw-priority)) - (format #t "~1Tdraw-index: ~D~%" (-> obj draw-index)) - (format #t "~1Tpart-engine: ~A~%" (-> obj part-engine)) - (format #t "~1Tuser-object[4] @ #x~X~%" (-> obj user-object)) - (dotimes (s5-2 4) - (format #t "~T [~D]~1Tuser-object: ~A~%" s5-2 (-> obj user-object s5-2)) - ) - (format #t "~1Tloaded-text-info-count: ~D~%" (-> obj loaded-text-info-count)) - (format #t "~1Tloaded-text-info[8] @ #x~X~%" (-> obj loaded-text-info)) - (format #t "~1Tlevel-type: ~A~%" (-> obj level-type)) - (format #t "~1Tload-order: ~D~%" (-> obj load-order)) - obj - ) (deftype level-group (basic) ((length int32 :offset-assert 4) @@ -512,155 +372,105 @@ ) ) -(defmethod inspect level-group ((obj level-group)) - (when (not obj) - (return obj) - ) - (format #t "[~8x] ~A~%" obj (-> obj type)) - (format #t "~1Tlength: ~D~%" (-> obj length)) - (format #t "~1Tentity-link: ~`entity-links`P~%" (-> obj entity-link)) - (format #t "~1Tborder?: ~A~%" (-> obj border?)) - (format #t "~1Tvis?: ~A~%" (-> obj vis?)) - (format #t "~1Twant-level: ~A~%" (-> obj want-level)) - (format #t "~1Treceiving-level: ~A~%" (-> obj receiving-level)) - (format #t "~1Tload-commands: ~A~%" (-> obj load-commands)) - (format #t "~1Tplay?: ~A~%" (-> obj play?)) - (format #t "~1Ttarget-pos[2] @ #x~X~%" (-> obj target-pos)) - (dotimes (s5-0 2) - (format #t "~T [~D]~1Ttarget-pos: ~`vector`P~%" s5-0 (-> obj target-pos s5-0)) - ) - (format #t "~1Tcamera-pos[2] @ #x~X~%" (-> obj camera-pos)) - (dotimes (s5-1 2) - (format #t "~T [~D]~1Tcamera-pos: ~`vector`P~%" s5-1 (-> obj camera-pos s5-1)) - ) - (format #t "~1Theap: #~%" (-> obj heap)) - (format #t "~1Tsound-bank[4] @ #x~X~%" (-> obj sound-bank)) - (format #t "~1Tdisk-load-timing?: ~A~%" (-> obj disk-load-timing?)) - (format #t "~1Tload-level: ~A~%" (-> obj load-level)) - (format #t "~1Tload-size: ~D~%" (-> obj load-size)) - (format #t "~1Tload-time: ~f~%" (-> obj load-time)) - (format #t "~1Tload-login-time: ~f~%" (-> obj load-login-time)) - (format #t "~1Tdraw-level-count: ~D~%" (-> obj draw-level-count)) - (format #t "~1Tdraw-level[7] @ #x~X~%" (-> obj draw-level)) - (dotimes (s5-2 (-> obj draw-level-count)) - (format #t "~T [~D]~1Tdraw-level: ~`object`P~%" s5-2 (-> obj draw-level s5-2)) - ) - (format #t "~1Tdraw-index-map[7] @ #x~X~%" (-> obj draw-index-map)) - (format #t "~1Tload-order: ~D~%" (-> obj load-order)) - (format #t "~1Tlevel[7] @ #x~X~%" (-> obj level)) - (format #t "~1Tdata[7] @ #x~X~%" (-> obj level)) - (format #t "~1Tlevel0: ~`level`P~%" (-> obj level)) - (format #t "~1Tlevel1: ~`level`P~%" (-> obj level1)) - (format #t "~1Tlevel2: ~`level`P~%" (-> obj level2)) - (format #t "~1Tlevel3: ~`level`P~%" (-> obj level3)) - (format #t "~1Tlevel4: ~`level`P~%" (-> obj level4)) - (format #t "~1Tlevel5: ~`level`P~%" (-> obj level5)) - (format #t "~1Tlevel-default: ~`level`P~%" (-> obj default-level)) - obj - ) (when (zero? *level*) - (set! *level* - (new 'static 'level-group - :length 6 - :log-in-level-bsp #f - :loading-level #f - :entity-link #f - :border? #f - :vis? #f - :want-level #f - :load-commands '() - :play? #f - :sound-bank (new 'static 'array basic 4 #f #f #f #f) - :disk-load-timing? #f - :level (new 'static 'inline-array level 7 - (new 'static 'level - :name #f - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 1 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 2 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 3 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 4 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name #f - :index 5 - :status 'inactive - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :inside-boxes #f - :force-inside? #f - :linking #f - :level-type #f - ) - (new 'static 'level - :name 'default - :index 6 - :status 'reserved - :borrow-level (new 'static 'array basic 2 #f #f) - :borrow-from-level #f - :bsp #f - :inside-boxes #f - :display? #f - :force-inside? #f - :linking #f - :level-type #f - ) - ) - ) + (set! *level* (new 'static 'level-group + :length 6 + :log-in-level-bsp #f + :loading-level #f + :entity-link #f + :border? #f + :vis? #f + :want-level #f + :load-commands '() + :play? #f + :sound-bank (new 'static 'array basic 4 #f #f #f #f) + :disk-load-timing? #f + :level0 (new 'static 'level + :name #f + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level1 (new 'static 'level + :name #f + :index 1 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level2 (new 'static 'level + :name #f + :index 2 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level3 (new 'static 'level + :name #f + :index 3 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level4 (new 'static 'level + :name #f + :index 4 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :level5 (new 'static 'level + :name #f + :index 5 + :status 'inactive + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :inside-boxes #f + :force-inside? #f + :linking #f + :level-type #f + ) + :default-level (new 'static 'level + :name 'default + :index 6 + :status 'reserved + :borrow-level (new 'static 'array basic 2 #f #f) + :borrow-from-level #f + :bsp #f + :inside-boxes #f + :display? #f + :force-inside? #f + :linking #f + :level-type #f + ) + ) ) (set! *draw-index* 0) (set! *level-index* 0) 0 ) -;; failed to figure out what this is: 0 diff --git a/goal_src/jak2/engine/process-drawable/process-focusable.gc b/goal_src/jak2/engine/process-drawable/process-focusable.gc index 2c741bda52..819f09ec23 100644 --- a/goal_src/jak2/engine/process-drawable/process-focusable.gc +++ b/goal_src/jak2/engine/process-drawable/process-focusable.gc @@ -57,23 +57,11 @@ (get-transv (_type_) vector 22) (process-focusable-method-23 (_type_) none 23) (process-focusable-method-24 (_type_) none 24) - (process-focusable-method-25 (_type_) none 25) + (process-focusable-method-25 (_type_) int 25) (process-focusable-method-26 (_type_) none 26) ) ) -(defmethod inspect process-focusable ((obj process-focusable)) - (when (not obj) - (set! obj obj) - (goto cfg-4) - ) - (let ((t9-0 (method-of-type process-drawable inspect))) - (t9-0 obj) - ) - (format #t "~2Tfocus-status: ~D~%" (-> obj focus-status)) - (label cfg-4) - obj - ) (defmethod get-trans process-focusable ((obj process-focusable) (arg0 int)) (let ((gp-0 (-> obj root))) @@ -120,5 +108,10 @@ (defmethod process-focusable-method-25 process-focusable ((obj process-focusable)) 0 - (none) ) + +0 + + + + diff --git a/goal_src/jak2/engine/util/glist-h.gc b/goal_src/jak2/engine/util/glist-h.gc index 3a1a9a7d4a..d40c0e2a1e 100644 --- a/goal_src/jak2/engine/util/glist-h.gc +++ b/goal_src/jak2/engine/util/glist-h.gc @@ -7,3 +7,141 @@ ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition of type glst-node +(deftype glst-node (structure) + ((next glst-node :offset-assert 0) + (prev glst-node :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type glst-node +(defmethod inspect glst-node ((obj glst-node)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'glst-node) + (format #t "~1Tnext: #~%" (-> obj next)) + (format #t "~1Tprev: #~%" (-> obj prev)) + (label cfg-4) + obj + ) + +;; definition of type glst-named-node +(deftype glst-named-node (glst-node) + ((privname string :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type glst-named-node +(defmethod inspect glst-named-node ((obj glst-named-node)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'glst-named-node) + (format #t "~1Tnext: #~%" (-> obj next)) + (format #t "~1Tprev: #~%" (-> obj prev)) + (format #t "~1Tprivname: ~A~%" (-> obj privname)) + (label cfg-4) + obj + ) + +;; definition of type glst-list +(deftype glst-list (structure) + ((head glst-node :offset-assert 0) + (tail glst-node :offset-assert 4) + (tailpred glst-node :offset-assert 8) + (numelem int32 :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type glst-list +(defmethod inspect glst-list ((obj glst-list)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'glst-list) + (format #t "~1Thead: #~%" (-> obj head)) + (format #t "~1Ttail: #~%" (-> obj tail)) + (format #t "~1Ttailpred: #~%" (-> obj tailpred)) + (format #t "~1Tnumelem: ~D~%" (-> obj numelem)) + (label cfg-4) + obj + ) + +;; definition for function glst-next +(defun glst-next ((arg0 glst-node)) + "return the next node in the list" + (-> arg0 next) + ) + +;; definition for function glst-prev +(defun glst-prev ((arg0 glst-node)) + "return the previous node in the list" + (-> arg0 prev) + ) + +;; definition for function glst-head +(defun glst-head ((arg0 glst-list)) + "return the start of the list" + (-> arg0 head) + ) + +;; definition for function glst-tail +(defun glst-tail ((arg0 glst-list)) + "return the tail of the list" + (-> arg0 tailpred) + ) + +;; definition for function glst-end-of-list? +(defun glst-end-of-list? ((arg0 glst-node)) + "is this node the end of the list. #t = end" + (not (-> arg0 next)) + ) + +;; definition for function glst-start-of-list? +(defun glst-start-of-list? ((arg0 glst-node)) + "is this node the start of the list. #t = start" + (not (-> arg0 prev)) + ) + +;; definition for function glst-empty? +(defun glst-empty? ((arg0 glst-list)) + "is the list empty, #t = empty" + (= (-> arg0 tailpred) arg0) + ) + +;; definition for function glst-node-name +(defun glst-node-name ((arg0 glst-named-node)) + "Returns the `privname` of the provided [[glst-named-node]]" + (-> arg0 privname) + ) + +;; definition for function glst-set-name! +(defun glst-set-name! ((arg0 glst-named-node) (arg1 string)) + "Sets the `privname` of the provided [[glst-named-node]]" + (set! (-> arg0 privname) arg1) + arg1 + ) + +;; failed to figure out what this is: +0 + +) + + + diff --git a/goal_src/jak2/engine/util/glist.gc b/goal_src/jak2/engine/util/glist.gc index 5d614d7d98..7b7743cae3 100644 --- a/goal_src/jak2/engine/util/glist.gc +++ b/goal_src/jak2/engine/util/glist.gc @@ -7,3 +7,213 @@ ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition for function glst-num-elements +(defun glst-num-elements ((arg0 glst-list)) + "Returns `numelem` from the provided [[glst-list]]" + (-> arg0 numelem) + ) + +;; definition for function glst-remove +(defun glst-remove ((arg0 glst-list) (arg1 glst-node)) + "Removes the provided [[glst-node]] from the list and returns it back" + (let ((v1-0 arg1)) + "return the previous node in the list" + (let ((v1-1 (-> v1-0 prev)) + (a2-1 arg1) + ) + "return the next node in the list" + (let ((a2-2 (-> a2-1 next))) + (set! (-> v1-1 next) a2-2) + (set! (-> a2-2 prev) v1-1) + ) + ) + ) + (+! (-> arg0 numelem) -1) + arg1 + ) + +;; definition for function glst-remove-tail +(defun glst-remove-tail ((arg0 glst-list)) + "Removes the tail of the [[glst-list]], returns #f if the list is empty, otherwise returns the [[glst-node]] that was removed" + (let ((v1-0 arg0)) + "return the tail of the list" + (let* ((a1-1 (-> v1-0 tailpred)) + (v1-1 a1-1) + ) + "is this node the start of the list. #t = start" + (if (not (not (-> v1-1 prev))) + (glst-remove arg0 a1-1) + (the-as glst-node #f) + ) + ) + ) + ) + +;; definition for function glst-remove-head +(defun glst-remove-head ((arg0 glst-list)) + "Removes the head of the [[glst-list]], returns #f if the list is empty, otherwise returns the [[glst-node]] that was removed" + (let ((v1-0 arg0)) + "return the start of the list" + (let* ((a1-1 (-> v1-0 head)) + (v1-1 a1-1) + ) + "is this node the end of the list. #t = end" + (if (not (not (-> v1-1 next))) + (glst-remove arg0 a1-1) + (the-as glst-node #f) + ) + ) + ) + ) + +;; definition for function glst-insert-before +(defun glst-insert-before ((list glst-list) (curr glst-node) (new glst-node)) + "Inserts `new` before `curr`, returns the newly inserted [[glst-node]]" + (let ((v1-0 curr)) + "return the previous node in the list" + (let ((v1-1 (-> v1-0 prev))) + (set! (-> new prev) v1-1) + (set! (-> new next) curr) + (set! (-> v1-1 next) new) + ) + ) + (set! (-> curr prev) new) + (+! (-> list numelem) 1) + new + ) + +;; definition for function glst-insert-after +(defun glst-insert-after ((list glst-list) (curr glst-node) (new glst-node)) + "Inserts `new` after `curr`, returns the newly inserted [[glst-node]]" + (let ((v1-0 curr)) + "return the next node in the list" + (let ((v1-1 (-> v1-0 next))) + (set! (-> new prev) curr) + (set! (-> new next) v1-1) + (set! (-> v1-1 prev) new) + ) + ) + (set! (-> curr next) new) + (+! (-> list numelem) 1) + new + ) + +;; definition for function glst-add-tail +(defun glst-add-tail ((arg0 glst-list) (arg1 glst-node)) + "Adds the provided [[glst-node]] to the end of the [[glst-list]]" + (glst-insert-before arg0 (the-as glst-node (&-> arg0 tail)) arg1) + arg1 + ) + +;; definition for function glst-add-head +(defun glst-add-head ((arg0 glst-list) (arg1 glst-node)) + "Adds the provided [[glst-node]] to the beginning of the [[glst-list]]" + (glst-insert-after arg0 (the-as glst-node arg0) arg1) + arg1 + ) + +;; definition for function glst-init-list! +(defun glst-init-list! ((arg0 glst-list)) + "Clears the provided [[glst-list]]" + (set! (-> arg0 head) (the-as glst-node (&-> arg0 tail))) + (set! (-> arg0 tail) #f) + (set! (-> arg0 tailpred) (the-as glst-node (&-> arg0 head))) + (set! (-> arg0 numelem) 0) + arg0 + ) + +;; definition for function glst-find-node-by-name +(defun glst-find-node-by-name ((arg0 glst-list) (arg1 string)) + "Returns the [[glst-named-node]] by examining it's `privname`, returns #f if nothing is found" + (let ((v1-0 arg0)) + "return the start of the list" + (let ((s5-0 (-> v1-0 head))) + (while (let ((v1-6 s5-0)) + "is this node the end of the list. #t = end" + (not (not (-> v1-6 next))) + ) + (if (name= (-> (the-as glst-named-node s5-0) privname) arg1) + (return s5-0) + ) + "return the next node in the list" + (set! s5-0 (-> s5-0 next)) + ) + ) + ) + (the-as glst-node #f) + ) + +;; definition for function glst-get-node-by-index +(defun glst-get-node-by-index ((arg0 glst-list) (arg1 int)) + "Returns the [[glst-node]] by index, returns #f if nothing is found" + (when (and (< arg1 (glst-num-elements arg0)) (>= arg1 0)) + "return the start of the list" + (let ((v1-3 (-> arg0 head))) + (dotimes (a0-3 arg1) + (nop!) + (nop!) + (nop!) + (nop!) + "return the next node in the list" + (set! v1-3 (-> v1-3 next)) + ) + (return v1-3) + ) + ) + (the-as glst-node #f) + ) + +;; definition for function glst-length-of-longest-name +(defun glst-length-of-longest-name ((arg0 glst-list)) + "Returns the length of the longest `privname`" + (let ((gp-0 0)) + (let ((v1-0 arg0)) + "return the start of the list" + (let ((s5-0 (-> v1-0 head))) + (while (let ((v1-6 s5-0)) + "is this node the end of the list. #t = end" + (not (not (-> v1-6 next))) + ) + (let ((v1-3 (length (-> (the-as glst-named-node s5-0) privname)))) + (if (< gp-0 v1-3) + (set! gp-0 v1-3) + ) + ) + "return the next node in the list" + (set! s5-0 (-> s5-0 next)) + ) + ) + ) + gp-0 + ) + ) + +;; definition for function glst-get-node-index +(defun glst-get-node-index ((arg0 glst-list) (arg1 glst-node)) + "Given a [[glst-node]] return it's position in the [[glst-list]]" + (let ((v1-0 0)) + "return the start of the list" + (let ((a0-1 (-> arg0 head))) + (while (let ((a2-3 a0-1)) + "is this node the end of the list. #t = end" + (not (not (-> a2-3 next))) + ) + (if (= a0-1 arg1) + (return v1-0) + ) + (+! v1-0 1) + "return the next node in the list" + (set! a0-1 (-> a0-1 next)) + ) + ) + ) + -1 + ) + +) + + + diff --git a/scripts/gsrc/update-gsrc-via-refs.py b/scripts/gsrc/update-gsrc-via-refs.py new file mode 100644 index 0000000000..e9597ea843 --- /dev/null +++ b/scripts/gsrc/update-gsrc-via-refs.py @@ -0,0 +1,40 @@ +# Updates files in gsrc if they are modified in the reference test folder +# Uses git +# TODO - get new untracked files as well +import subprocess +from git import Repo + +repo = Repo("./") + +import argparse +import os + +parser = argparse.ArgumentParser("update-gsrc-via-refs") +parser.add_argument("--game", help="The name of the game", type=str) +parser.add_argument("--decompiler", help="The path to the decompiler", type=str) +parser.add_argument("--decompiler_config", help="The decomp config", type=str) +args = parser.parse_args() + +for item in repo.index.diff(None): + path = item.b_rawpath.decode("utf-8") + if args.game in path and "_REF" in path: + file_name = os.path.basename(path).replace("_REF.gc", "") + print("Decompiling - {}".format(file_name)) + # Decompile file + subprocess.run( + [ + args.decompiler, + "./decompiler/config/{}".format(args.decompiler_config), + "./iso_data", + "./decompiler_out", + "--config-override", + '{{"allowed_objects": ["{}"]}}'.format(file_name), + ] + ) + print("Updating - {}".format(file_name)) + # Update gsrc + os.system( + "python ./scripts/gsrc/update-from-decomp.py --game {} --file {}".format( + args.game, file_name + ) + ) diff --git a/scripts/tasks/clean-decomp.py b/scripts/tasks/clean-decomp.py new file mode 100644 index 0000000000..4173064953 --- /dev/null +++ b/scripts/tasks/clean-decomp.py @@ -0,0 +1,14 @@ +import argparse +parser = argparse.ArgumentParser() +parser.add_argument("--game") +args = parser.parse_args() +import os +import glob + +def delete_extension(ext): + fileList = glob.glob('./decompiler_out/{}/*.{}'.format(args.game, ext)) + for filePath in fileList: + os.remove(filePath) + +delete_extension("gc") +delete_extension("asm") diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index da960e42d1..8d8375314b 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -168,6 +168,21 @@ ) ) +(defmacro process-spawn (proc-type &key (init #f) &key (from *default-dead-pool*) &key (to *default-pool*) &key (name #f) &key (stack-size #x4000) &key (stack *scratch-memory-top*) &rest args) + "Start a new process and run an init function on it. + Returns a pointer to the new process, or #f (or is it 0?) if something goes wrong." + + (with-gensyms (new-proc) + `(let ((,new-proc (the-as ,proc-type (get-process ,from ,proc-type ,stack-size)))) + (when ,new-proc + ((method-of-type ,proc-type activate) ,new-proc ,to ,(if name name `(quote ,proc-type)) ,stack) + (run-now-in-process ,new-proc ,(if init init (string->symbol (fmt #f "{}-init-by-other" proc-type))) ,@args) + (the (pointer ,proc-type) (-> ,new-proc ppointer)) + ) + ) + ) + ) + (defmacro b! (pred destination &key (delay '()) &key (likely-delay '())) "Branch!" @@ -727,59 +742,6 @@ (argf 0.0) (setting (cadr s))) (cond - ; ((or (eq? setting 'border-mode) - ; (eq? setting 'allow-look-around) - ; (eq? setting 'ocean-off) - ; (eq? setting 'music) - ; (eq? setting 'vibration) - ; (eq? setting 'auto-save) - ; (eq? setting 'allow-pause) - ; (eq? setting 'allow-progress) - ; (eq? setting 'play-hints) - ; (eq? setting 'movie) - ; (eq? setting 'talking) - ; (eq? setting 'spooling) - ; (eq? setting 'hint) - ; (eq? setting 'ambient) - ; ) - ; (set! argb (car args)) - ; ) - ; ((or (eq? setting 'bg-r) - ; (eq? setting 'bg-g) - ; (eq? setting 'bg-b) - ; (eq? setting 'bg-a) - ; (eq? setting 'bg-a-speed) - ; (eq? setting 'bg-a-force) - ; ) - ; (set! argf (car args)) - ; ) - ; ((or (eq? setting 'language) - ; ) - ; (set! argi (car args)) - ; ) - ; ((or (eq? setting 'sound-flava) - ; ) - ; (set! argi (car args)) - ; (set! argf (cadr args)) - ; ) - ; ((or (eq? setting 'process-mask) - ; (eq? setting 'common-page) - ; ) - ; (set! argb (car args)) - ; (set! argi (cadr args)) - ; ) - ; ((or (eq? setting 'sfx-volume) - ; (eq? setting 'music-volume) - ; (eq? setting 'ambient-volume) - ; (eq? setting 'dialog-volume) - ; (eq? setting 'sfx-volume-movie) - ; (eq? setting 'music-volume-movie) - ; (eq? setting 'ambient-volume-movie) - ; (eq? setting 'dialog-volume-hint) - ; ) - ; (set! argb (car args)) - ; (set! argf (cadr args)) - ; ) (#t (set! argb (car args)) (set! argf (cadr args)) @@ -790,11 +752,17 @@ ) ) +(defmacro add-setting! (s &rest args) + `(setting-control-func! add-setting ,s ,@args) + ) (defmacro set-setting! (s &rest args) `(setting-control-func! set-setting ,s ,@args) ) +(defmacro remove-setting! (s) + `(remove-setting *setting-control* (with-pp pp) ,s) + ) (defmacro get-art-by-name (obj name type) "Helper macro for casting the result of get-art-by-name-method. Generated by decompiler." `(the-as ,type (get-art-by-name-method ,obj ,name ,type)) - ) \ No newline at end of file + ) diff --git a/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc index cf26692ae0..b88ab2012b 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-mod-h_REF.gc @@ -129,7 +129,7 @@ ;; definition of type try-to-look-at-info (deftype try-to-look-at-info (basic) - ((who uint64 :offset-assert 8) + ((who handle :offset-assert 8) (horz float :offset-assert 16) (vert float :offset-assert 20) ) @@ -682,9 +682,9 @@ (matrix*! s2-0 s0-0 (-> arg0 parent bone transform)) (set-vector! s1-0 - (vector-length (the-as vector (-> s2-0 data))) - (vector-length (the-as vector (&-> s2-0 data 4))) - (vector-length (the-as vector (&-> s2-0 data 8))) + (vector-length (the-as vector (-> s2-0 vector))) + (vector-length (-> s2-0 vector 1)) + (vector-length (-> s2-0 vector 2)) 1.0 ) (let ((v1-19 (-> gp-0 blend-transform scale))) diff --git a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc index 1fceae64dc..9f1646ed81 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc @@ -1192,9 +1192,9 @@ (set! (-> gp-0 vector 2 quad) a1-1) (set! (-> gp-0 trans quad) a2-1) ) - (vector-normalize! (the-as vector (-> gp-0 data)) 1.0) - (vector-normalize! (the-as vector (&-> gp-0 data 4)) 1.0) - (vector-normalize! (the-as vector (&-> gp-0 data 8)) 1.0) + (vector-normalize! (the-as vector (-> gp-0 vector)) 1.0) + (vector-normalize! (-> gp-0 vector 1) 1.0) + (vector-normalize! (-> gp-0 vector 2) 1.0) gp-0 ) ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc new file mode 100644 index 0000000000..e40028b98a --- /dev/null +++ b/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc @@ -0,0 +1,477 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function cam-helper-temp +;; INFO: Used lq/sq +(defbehavior cam-helper-temp camera-combiner ((arg0 (pointer camera-slave)) (arg1 (pointer camera-slave)) (arg2 float)) + (local-vars (sv-144 cam-rotation-tracker)) + (set! sv-144 (-> arg0 0 tracking)) + (let ((s1-0 (-> arg0 0 trans)) + (gp-0 (-> arg1 0 tracking)) + (s0-0 (-> arg1 0 trans)) + ) + (cond + ((= (-> self tracking-status) 3) + (cam-calc-follow! (-> self tracking) s1-0 #t) + (slave-set-rotation! (-> self tracking) s1-0 (the-as float (-> self tracking-options)) (-> self fov) #t) + (set! sv-144 (-> self tracking)) + (set! s1-0 (-> self trans)) + ) + ((= (-> self tracking-status) 2) + (cam-calc-follow! (-> self tracking) s0-0 #t) + (slave-set-rotation! (-> self tracking) s0-0 (the-as float (-> self tracking-options)) (-> self fov) #t) + (set! gp-0 (-> self tracking)) + (set! s0-0 (-> self trans)) + ) + ) + (let ((s2-0 (new 'stack-no-clear 'matrix))) + (dotimes (v1-14 3) + (set! (-> s2-0 vector v1-14 quad) (the-as uint128 0)) + ) + 0.0 + 0.0 + 0.0 + (let ((s4-0 (new-stack-vector0))) + 0.0 + (let ((s3-0 (new-stack-matrix0))) + (vector-! + (the-as vector (-> s2-0 vector)) + (the-as vector (-> sv-144 inv-mat)) + (the-as vector (-> gp-0 inv-mat)) + ) + (vector-! (-> s2-0 vector 1) (-> sv-144 inv-mat vector 1) (-> gp-0 inv-mat vector 1)) + (vector-! (-> s2-0 vector 2) (-> sv-144 inv-mat vector 2) (-> gp-0 inv-mat vector 2)) + (let ((f0-6 (vector-length (the-as vector (-> s2-0 vector)))) + (f1-0 (vector-length (-> s2-0 vector 1))) + (f2-0 (vector-length (-> s2-0 vector 2))) + ) + (cond + ((and (< f0-6 f1-0) (< f0-6 f2-0)) + (vector-cross! s4-0 (-> s2-0 vector 1) (-> s2-0 vector 2)) + ) + ((and (< f1-0 f0-6) (< f1-0 f2-0)) + (vector-cross! s4-0 (the-as vector (-> s2-0 vector)) (-> s2-0 vector 2)) + ) + (else + (vector-cross! s4-0 (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1)) + ) + ) + ) + (vector-normalize! s4-0 1.0) + (let ((f0-9 (fabs (vector-dot (the-as vector (-> sv-144 inv-mat)) s4-0))) + (f1-3 (fabs (vector-dot (-> sv-144 inv-mat vector 1) s4-0))) + (f2-3 (fabs (vector-dot (-> sv-144 inv-mat vector 2) s4-0))) + ) + (cond + ((and (< f0-9 f1-3) (< f0-9 f2-3)) + (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> sv-144 inv-mat)) s4-0) + (vector-flatten! (-> s2-0 vector 1) (the-as vector (-> gp-0 inv-mat)) s4-0) + ) + ((< f1-3 f2-3) + (vector-flatten! (the-as vector (-> s2-0 vector)) (-> sv-144 inv-mat vector 1) s4-0) + (vector-flatten! (-> s2-0 vector 1) (-> gp-0 inv-mat vector 1) s4-0) + ) + (else + (vector-flatten! (the-as vector (-> s2-0 vector)) (-> sv-144 inv-mat vector 2) s4-0) + (vector-flatten! (-> s2-0 vector 1) (-> gp-0 inv-mat vector 2) s4-0) + ) + ) + ) + (vector-normalize! (the-as vector (-> s2-0 vector)) 1.0) + (vector-normalize! (-> s2-0 vector 1) 1.0) + (vector-cross! (-> s2-0 vector 2) (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1)) + (if (< (vector-dot (-> s2-0 vector 2) s4-0) 0.0) + (vector-negate! s4-0 s4-0) + ) + (let ((f30-0 (acos (vector-dot (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1))))) + (cond + ((logtest? (-> *camera* master-options) 2) + (set! (-> *camera* master-options) (logand -7 (-> *camera* master-options))) + (when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) 1)) + (vector-! (the-as vector (-> s2-0 vector)) (-> *camera* tpos-curr) s1-0) + (vector-! (-> s2-0 vector 1) s0-0 s1-0) + (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> s2-0 vector)) (-> *camera* local-down)) + (vector-flatten! (-> s2-0 vector 1) (-> s2-0 vector 1) (-> *camera* local-down)) + (when (and (< 4096.0 (vector-normalize-ret-len! (the-as vector (-> s2-0 vector)) 1.0)) + (< 4096.0 (vector-normalize-ret-len! (-> s2-0 vector 1) 1.0)) + ) + (vector-cross! (-> s2-0 vector 2) (-> s2-0 vector 1) (the-as vector (-> s2-0 vector))) + (when (< (vector-dot (-> s2-0 vector 2) s4-0) -0.01) + ) + ) + ) + ) + ((and (< 16384.0 f30-0) (< (vector-dot (-> self flip-control-axis) s4-0) 0.0)) + (logxor! (-> *camera* master-options) 4) + ) + ) + (set! (-> self flip-control-axis quad) (-> s4-0 quad)) + (when (logtest? (-> *camera* master-options) 4) + (set! f30-0 (- 65536.0 f30-0)) + (vector-negate! s4-0 s4-0) + ) + (let ((f30-1 (* f30-0 (- 1.0 arg2)))) + (matrix-axis-sin-cos! s3-0 s4-0 (sin f30-1) (cos f30-1)) + ) + ) + (matrix*! (-> self inv-camera-rot) (the-as matrix gp-0) s3-0) + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate cam-combiner-active (camera-combiner) + :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 'fast-rot) + (set! v0-0 (the-as none #t)) + (set! (-> self fast-rot) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'set-interpolation) + (let ((f0-1 (the float (-> arg3 param 0)))) + (cond + ((>= 0.0 f0-1) + (let ((f0-2 1.0)) + (set! (-> self interp-val) f0-2) + f0-2 + ) + ) + (else + (set! (-> self interp-val) 0.0) + (let ((f0-3 (/ 5.0 f0-1))) + (set! (-> self interp-step) f0-3) + f0-3 + ) + ) + ) + ) + ) + ((= v1-0 'teleport) + (when (nonzero? (-> self tracking-status)) + (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self tracking-options)) + (-> self fov) + #f + ) + ) + ) + ((= v1-0 'stop-tracking) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + ((= v1-0 'start-tracking) + (cond + ((< arg1 1) + (let ((t9-3 format) + (a0-14 0) + (a1-4 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") + ) + (let ((v1-8 (-> arg3 param 0))) + (rtype-of v1-8) + ) + (t9-3 a0-14 a1-4) + ) + ) + ((not (type? (-> arg3 param 0) camera-slave)) + (let ((t9-5 format) + (a0-16 0) + (a1-6 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") + (v1-11 (-> arg3 param 0)) + ) + (t9-5 a0-16 a1-6 (rtype-of v1-11)) + ) + ) + ((zero? (-> self tracking-status)) + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-1 (the-as camera-slave (-> arg3 param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-1 options))) + (set! (-> self tracking no-follow) (-> gp-1 tracking no-follow)) + (copy-to (-> self tracking tilt-adjust) (-> gp-1 tracking tilt-adjust)) + (copy-to (-> self tracking underwater-blend) (-> gp-1 tracking underwater-blend)) + (copy-to (-> self tracking point-of-interest-blend) (-> gp-1 tracking point-of-interest-blend)) + (let ((gp-2 (-> gp-1 trans))) + (cam-calc-follow! (-> self tracking) gp-2 #f) + (slave-set-rotation! (-> self tracking) gp-2 (the-as float (-> self tracking-options)) (-> self fov) #f) + ) + ) + ) + ) + ) + ((= v1-0 'copy-tracking) + (cond + ((< arg1 1) + (let ((t9-11 format) + (a0-23 0) + (a1-12 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") + ) + (let ((v1-23 (-> arg3 param 0))) + (rtype-of v1-23) + ) + (t9-11 a0-23 a1-12) + ) + ) + ((not (type? (-> arg3 param 0) camera-slave)) + (let ((t9-13 format) + (a0-25 0) + (a1-14 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") + (v1-25 (-> arg3 param 0)) + ) + (t9-13 a0-25 a1-14 (rtype-of v1-25)) + ) + ) + ((nonzero? (-> self tracking-status)) + #f + ) + (else + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-3 (the-as camera-slave (-> arg3 param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-3 options))) + (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) + (copy-to (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) + (copy-to (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) + (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) + (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) + (let* ((a2-23 (-> self tracking)) + (a3-7 (-> gp-3 tracking)) + (v1-37 (-> a3-7 inv-mat vector 0 quad)) + (a0-32 (-> a3-7 inv-mat vector 1 quad)) + (a1-17 (-> a3-7 inv-mat vector 2 quad)) + (a3-8 (-> a3-7 inv-mat trans quad)) + ) + (set! (-> a2-23 inv-mat vector 0 quad) v1-37) + (set! (-> a2-23 inv-mat vector 1 quad) a0-32) + (set! (-> a2-23 inv-mat vector 2 quad) a1-17) + (set! (-> a2-23 inv-mat trans quad) a3-8) + ) + (copy-to (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) + (set! (-> self tracking looking-at quad) (-> gp-3 tracking looking-at quad)) + (set! v0-0 (the-as none (-> self tracking looking-interesting))) + (set! (-> (the-as vector v0-0) quad) (-> gp-3 tracking looking-interesting quad)) + ) + v0-0 + ) + ) + ) + ) + ) + ) + ) + :code (behavior () + (until #f + (when *debug-segment* + (let ((gp-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-7 'camera) + (s5-0 *profile-camera-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s4-0 (-> gp-0 data (-> gp-0 count)))) + (let ((s3-0 (-> gp-0 base-time))) + (set! (-> s4-0 name) v1-7) + (set! (-> s4-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s3-0)))) + ) + (set! (-> s4-0 depth) (the-as uint (-> gp-0 depth))) + (set! (-> s4-0 color) s5-0) + (set! (-> gp-0 segment (-> gp-0 depth)) s4-0) + ) + (+! (-> gp-0 count) 1) + (+! (-> gp-0 depth) 1) + (set! (-> gp-0 max-depth) (max (-> gp-0 max-depth) (-> gp-0 depth))) + ) + ) + 0 + ) + (when (and (zero? (logand (-> *camera* master-options) 1)) (!= (-> self tracking-status) 0)) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + (when *camera* + (let ((s5-1 (-> *camera* slave)) + (s4-1 (-> *camera* decel)) + (f30-0 (parameter-ease-sin-clamp (-> self interp-val))) + (gp-1 (new-stack-vector0)) + ) + (set! (-> gp-1 quad) (-> self trans quad)) + (when s5-1 + (cond + ((< (-> self interp-val) 1.0) + (vector-lerp-clamp! (-> self trans) (-> s4-1 0 trans) (-> s5-1 0 trans) f30-0) + (set! (-> self fov) (lerp-clamp (-> s4-1 0 fov) (-> s5-1 0 fov) f30-0)) + (set! (-> self dist-from-src) (vector-vector-distance (-> self trans) (-> s4-1 0 trans))) + (set! (-> self dist-from-dest) (vector-vector-distance (-> self trans) (-> s5-1 0 trans))) + (cond + ((= (-> self tracking-status) 1) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self tracking-options)) + (-> self fov) + (not (-> self fast-rot)) + ) + (let* ((a2-4 (-> self inv-camera-rot)) + (a3-2 (-> self tracking)) + (v1-42 (-> a3-2 inv-mat vector 0 quad)) + (a0-18 (-> a3-2 inv-mat vector 1 quad)) + (a1-8 (-> a3-2 inv-mat vector 2 quad)) + (a3-3 (-> a3-2 inv-mat trans quad)) + ) + (set! (-> a2-4 vector 0 quad) v1-42) + (set! (-> a2-4 vector 1 quad) a0-18) + (set! (-> a2-4 vector 2 quad) a1-8) + (set! (-> a2-4 trans quad) a3-3) + ) + ) + (else + (cam-helper-temp s4-1 s5-1 f30-0) + ) + ) + (cond + ((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value))) + ) + ((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t))) + ) + ((paused?) + ) + (else + (+! (-> self interp-val) (* (-> self interp-step) (-> self clock time-adjust-ratio))) + ) + ) + ) + (else + (set! (-> self dist-from-src) 409600.0) + (set! (-> self dist-from-dest) 0.0) + (set! (-> self trans quad) (-> s5-1 0 trans quad)) + (set! (-> self fov) (-> s5-1 0 fov)) + (cond + ((= (-> self tracking-status) 2) + (set! (-> self tracking-status) (the-as uint 1)) + ) + ((= (-> self tracking-status) 3) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + ) + (cond + ((= (-> self tracking-status) 1) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self tracking-options)) + (-> self fov) + (not (-> self fast-rot)) + ) + (let* ((v1-71 (-> self inv-camera-rot)) + (a3-5 (-> self tracking)) + (a0-25 (-> a3-5 inv-mat vector 0 quad)) + (a1-12 (-> a3-5 inv-mat vector 1 quad)) + (a2-8 (-> a3-5 inv-mat vector 2 quad)) + (a3-6 (-> a3-5 inv-mat trans quad)) + ) + (set! (-> v1-71 vector 0 quad) a0-25) + (set! (-> v1-71 vector 1 quad) a1-12) + (set! (-> v1-71 vector 2 quad) a2-8) + (set! (-> v1-71 trans quad) a3-6) + ) + ) + (else + (let* ((v1-72 (-> self inv-camera-rot)) + (a3-7 (-> s5-1 0 tracking)) + (a0-27 (-> a3-7 inv-mat vector 0 quad)) + (a1-13 (-> a3-7 inv-mat vector 1 quad)) + (a2-9 (-> a3-7 inv-mat vector 2 quad)) + (a3-8 (-> a3-7 inv-mat trans quad)) + ) + (set! (-> v1-72 vector 0 quad) a0-27) + (set! (-> v1-72 vector 1 quad) a1-13) + (set! (-> v1-72 vector 2 quad) a2-9) + (set! (-> v1-72 trans quad) a3-8) + ) + ) + ) + ) + ) + ) + (vector-! (-> self velocity) (-> self trans) gp-1) + ) + ) + (when *debug-segment* + (let ((gp-2 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-85 (+ (-> gp-2 depth) -1)) + (s5-2 (-> gp-2 segment v1-85)) + (s4-2 (-> gp-2 base-time)) + ) + (when (>= v1-85 0) + (set! (-> s5-2 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-2)))) + (+! (-> gp-2 depth) -1) + ) + ) + ) + ) + 0 + ) + (set! (-> self fast-rot) #f) + (suspend) + ) + #f + (none) + ) + ) + +;; definition for function cam-combiner-init +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defbehavior cam-combiner-init camera-combiner () + (stack-size-set! (-> self main-thread) 512) + (vector-reset! (-> self trans)) + (matrix-identity! (-> self inv-camera-rot)) + (cond + (*math-camera* + (set! (-> self fov) (-> *math-camera* fov)) + (set! (-> self trans quad) (-> *math-camera* trans quad)) + (let* ((v1-6 (-> self inv-camera-rot)) + (a3-0 (-> *math-camera* inv-camera-rot)) + (a0-6 (-> a3-0 vector 0 quad)) + (a1-1 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-6 vector 0 quad) a0-6) + (set! (-> v1-6 vector 1 quad) a1-1) + (set! (-> v1-6 vector 2 quad) a2-0) + (set! (-> v1-6 trans quad) a3-1) + ) + ) + (else + (set! (-> self fov) 11650.845) + ) + ) + (set! (-> self interp-val) 1.0) + (set! (-> self interp-step) 0.125) + (set! (-> self tracking-status) (the-as uint 0)) + (set! (-> self fast-rot) #f) + (init (-> self tracking tilt-adjust) (-> *CAMERA-bank* default-tilt-adjust) 9.102222 91.022224 0.25) + (init + (-> self tracking follow-height-extra) + (-> *setting-control* cam-current extra-follow-height) + 81.92 + 819.2 + 0.5 + ) + (vector-reset! (-> self velocity)) + (go cam-combiner-active) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc new file mode 100644 index 0000000000..cbfab9c621 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc @@ -0,0 +1,2124 @@ +;;-*-Lisp-*- +(in-package goal) + +;; 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) + (plotvec vector4w 2 :inline :offset-assert 48) + (linevec vector4w 2 :inline :offset-assert 80) + (rel-vec vector :inline :offset-assert 112) + (sphere-v-start vector :inline :offset-assert 128) + (sphere-v-end vector :inline :offset-assert 144) + (sphere-v-down vector :inline :offset-assert 160) + (sphere-vec vector :inline :offset-assert 176) + (crossvec vector 3 :inline :offset-assert 192) + (bboxvec vector 6 :inline :offset-assert 240) + (fov-vv vector 4 :inline :offset-assert 336) + (fov-src vector :inline :offset-assert 400) + (fov-dest vector :inline :offset-assert 416) + (fov-vert vector :inline :offset-assert 432) + (fov-horz vector :inline :offset-assert 448) + ) + :method-count-assert 9 + :size-assert #x1d0 + :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. +(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 ") + ) + (if (= (logand (cam-slave-options GUN_CAM) arg0) (cam-slave-options GUN_CAM)) + (format arg1 "GUN_CAM ") + ) + (if (= (logand arg0 (cam-slave-options STICKY_ANGLE)) (cam-slave-options STICKY_ANGLE)) + (format arg1 "STICKY_ANGLE ") + ) + (if (= (logand arg0 (cam-slave-options FIND_HIDDEN_TARGET)) (cam-slave-options FIND_HIDDEN_TARGET)) + (format arg1 "FIND_HIDDEN_TARGET ") + ) + (if (= (logand (cam-slave-options RAPID_TRACKING) arg0) (cam-slave-options RAPID_TRACKING)) + (format arg1 "RAPID_TRACKING ") + ) + (if (= (logand arg0 (cam-slave-options SHRINK_MAX_ANGLE)) (cam-slave-options SHRINK_MAX_ANGLE)) + (format arg1 "SHRINK_MAX_ANGLE ") + ) + (if (= (logand arg0 (cam-slave-options JUMP_PITCHES)) (cam-slave-options JUMP_PITCHES)) + (format arg1 "JUMP_PITCHES ") + ) + (if (= (logand arg0 (cam-slave-options LINE_OF_SIGHT)) (cam-slave-options LINE_OF_SIGHT)) + (format arg1 "LINE_OF_SIGHT ") + ) + (if (= (logand arg0 (cam-slave-options PLAYER_MOVING_CAMERA)) (cam-slave-options PLAYER_MOVING_CAMERA)) + (format arg1 "PLAYER_MOVING_CAMERA ") + ) + (if (= (logand (cam-slave-options ALLOW_SHIFT_BUTTONS) arg0) (cam-slave-options ALLOW_SHIFT_BUTTONS)) + (format arg1 "ALLOW_SHIFT_BUTTONS ") + ) + (if (= (logand arg0 (cam-slave-options NO_ROTATE)) (cam-slave-options NO_ROTATE)) + (format arg1 "NO_ROTATE ") + ) + (if (= (logand (cam-slave-options WIDE_FOV) arg0) (cam-slave-options WIDE_FOV)) + (format arg1 "WIDE_FOV ") + ) + (if (= (logand arg0 (cam-slave-options MOVE_SPHERICAL)) (cam-slave-options MOVE_SPHERICAL)) + (format arg1 "MOVE_SPHERICAL ") + ) + (if (= (logand arg0 (cam-slave-options DRAG)) (cam-slave-options DRAG)) + (format arg1 "DRAG ") + ) + (if (= (logand arg0 (cam-slave-options MOVEMENT_BLOCKED)) (cam-slave-options MOVEMENT_BLOCKED)) + (format arg1 "MOVEMENT_BLOCKED ") + ) + (if (= (logand (cam-slave-options BLOCK_RIGHT_STICK) arg0) (cam-slave-options BLOCK_RIGHT_STICK)) + (format arg1 "BLOCK_RIGHT_STICK ") + ) + (if (= (logand arg0 (cam-slave-options COLLIDE)) (cam-slave-options COLLIDE)) + (format arg1 "COLLIDE ") + ) + (if (= (logand arg0 (cam-slave-options ALLOW_Z_ROT)) (cam-slave-options ALLOW_Z_ROT)) + (format arg1 "ALLOW_Z_ROT ") + ) + (if (= (logand arg0 (cam-slave-options BIKE_MODE)) (cam-slave-options BIKE_MODE)) + (format arg1 "BIKE_MODE ") + ) + (if (= (logand (cam-slave-options EASE_SPLINE_IDX) arg0) (cam-slave-options EASE_SPLINE_IDX)) + (format arg1 "EASE_SPLINE_IDX ") + ) + (if (= (logand arg0 (cam-slave-options GOTO_GOOD_POINT)) (cam-slave-options GOTO_GOOD_POINT)) + (format arg1 "GOTO_GOOD_POINT ") + ) + (if (= (logand arg0 (cam-slave-options BUTT_CAM)) (cam-slave-options BUTT_CAM)) + (format arg1 "BUTT_CAM ") + ) + (if (= (logand (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) arg0) + (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) + ) + (format arg1 "VERTICAL_FOLLOW_MATCHES_CAMERA ") + ) + (if (= (logand (cam-slave-options HAVE_BUTT_HANDLE) arg0) (cam-slave-options HAVE_BUTT_HANDLE)) + (format arg1 "HAVE_BUTT_HANDLE ") + ) + (the-as string arg1) + ) + +;; definition for function cam-index-options->string +;; INFO: 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 ") + ) + (if (= (logand arg0 (cam-index-options RADIAL)) (cam-index-options RADIAL)) + (format arg1 "SPHERICAL ") + ) + (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)) + "between" + ) + (((slave-los-state none)) + "none" + ) + (((slave-los-state cw)) + "cw" + ) + (((slave-los-state ccw)) + "ccw" + ) + (else + "*unknown*" + ) + ) + ) + +;; 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)) + ) + (let ((a0-1 (the-as object (-> v1-5 base)))) + (let* ((a1-0 v1-5) + (a3-0 (the-as object (-> a1-0 base))) + ) + (set! (-> (the-as dma-packet a3-0) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a3-0) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a3-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) + (set! (-> a1-0 base) (&+ (the-as pointer a3-0) 16)) + ) + (let* ((a1-1 v1-5) + (a3-2 (the-as object (-> a1-1 base))) + ) + (set! (-> (the-as gs-gif-tag a3-2) tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) + :nreg #x4 + ) + ) + (set! (-> (the-as gs-gif-tag a3-2) regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id rgbaq) + :regs1 (gif-reg-id xyzf2) + :regs2 (gif-reg-id rgbaq) + :regs3 (gif-reg-id xyzf2) + ) + ) + (set! (-> a1-1 base) (&+ (the-as pointer a3-2) 16)) + ) + (let* ((a1-2 v1-5) + (a3-4 (-> a1-2 base)) + ) + (set! (-> (the-as (pointer uint128) a3-4) 0) (-> (the-as vector (+ 32 #x70000000)) quad)) + (set! (-> (the-as (pointer uint128) a3-4) 1) (-> (the-as vector (+ #x70000000 0)) quad)) + (set! (-> a1-2 base) (&+ a3-4 32)) + ) + (let* ((a3-6 v1-5) + (a1-3 (-> a3-6 base)) + ) + (set! (-> (the-as (pointer uint128) a1-3) 0) (-> (the-as vector (+ 32 #x70000000)) quad)) + (set! (-> (the-as (pointer uint128) a1-3) 1) (-> (the-as vector (+ 16 #x70000000)) quad)) + (set! (-> a3-6 base) (&+ a1-3 32)) + ) + (let ((a3-10 (/ (the-as int (+ (- -16 (the-as int a0-1)) (the-as int (-> v1-5 base)))) 16))) + (cond + ((nonzero? a3-10) + (logior! (-> (the-as dma-packet a0-1) dma) (shr (shl a3-10 48) 48)) + (logior! (-> (the-as (pointer uint64) a0-1) 1) (shl (shr (shl a3-10 48) 48) 32)) + ) + (else + (set! (-> v1-5 base) (the-as (pointer uint64) a0-1)) + ) + ) + ) + ) + (let ((a3-16 (-> v1-5 base))) + (let ((a0-2 (the-as object (-> v1-5 base)))) + (set! (-> (the-as dma-packet a0-2) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet a0-2) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-2) vif1) (new 'static 'vif-tag)) + (set! (-> v1-5 base) (&+ (the-as pointer a0-2) 16)) + ) + (dma-bucket-insert-tag + (the-as (inline-array dma-bucket) (-> *display* frames (-> *display* on-screen) bucket-group)) + (bucket-id bucket-318) + a2-0 + (the-as (pointer dma-tag) a3-16) + ) + ) + ) + ) + +;; 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) + (* (- 2256 (-> (the-as cam-dbg-scratch arg0) linevec4w 0 y)) 16) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 z) #x7fffff) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 1 x) + (* (+ (-> (the-as cam-dbg-scratch arg1) linevec4w 0 x) 1792) 16) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 1 y) + (* (- 2256 (-> (the-as cam-dbg-scratch arg1) linevec4w 0 y)) 16) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 1 z) #x7fffff) + (cam-line-dma) + ) + +;; definition for function camera-plot-float-func +;; INFO: Used lq/sq +;; INFO: 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)) + ) + 0.0 + 0.0 + (let ((f28-0 (/ 200.0 f24-0)) + (f26-0 (/ 400.0 f30-0)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) color x) 128) + (set! (-> (the-as cam-dbg-scratch #x70000000) color y) 128) + (set! (-> (the-as cam-dbg-scratch #x70000000) color z) 128) + (set! (-> (the-as cam-dbg-scratch #x70000000) color w) 128) + (when (and (< arg0 0.0) (< 0.0 arg1)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) + (+ (the int (* f26-0 f30-0 (/ (- arg0) f30-0))) 20) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) + (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 #x70000000)) + ) + ) + (when (and (< arg2 0.0) (< 0.0 arg3)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) + (+ (the int (* f28-0 f24-0 (/ (- arg2) f24-0))) 20) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) + (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) + ) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) 20) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) (+ (the int (* f28-0 f24-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 y) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ (the int (* f26-0 f30-0)) 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 f24-0)) 20)) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (let ((v1-64 (-> arg5 quad))) + (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-64) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) 20) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) (+ (the int (* f28-0 (- (arg4 arg0) arg2))) 20)) + (let ((s3-1 1)) + (while (>= (the int (* f26-0 f30-0)) s3-1) + (let ((v1-69 (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 quad))) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 0 quad) v1-69) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 x) (+ s3-1 20)) + (set! (-> (the-as cam-dbg-scratch #x70000000) plotvec 1 y) + (+ (the int (* f28-0 (- (arg4 (+ arg0 (* f30-0 (/ (the float s3-1) (* f26-0 f30-0))))) arg2))) 20) + ) + (camera-line2d + (the-as vector4w (+ 48 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 64 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (+! s3-1 1) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function camera-line-setup +;; INFO: Used lq/sq +;; INFO: 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) + ) + (init-for-transform *identity-matrix*) + 0 + (none) + ) + +;; definition for function camera-line-draw +;; INFO: Used lq/sq +;; INFO: 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)) + (set! (-> (the-as (pointer uint128) (+ 96 (the-as int (the-as cam-dbg-scratch #x70000000))))) (-> arg1 quad)) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec 0 w) (the-as int 1.0)) + (set! (-> (the-as cam-dbg-scratch #x70000000) linevec 1 w) (the-as int 1.0)) + (transform-float-point + (the-as vector (+ 80 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (-> (the-as cam-dbg-scratch #x70000000) linevec4w)) + ) + (transform-float-point + (the-as vector (+ 96 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector4w (+ 16 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (cond + ((< (the-as uint #xe00000) (the-as uint (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 z))) + (return #f) + ) + ((< (the-as uint #xe00000) (the-as uint (-> (the-as cam-dbg-scratch #x70000000) linevec4w 1 z))) + (return #f) + ) + ) + (cam-line-dma) + 0 + (none) + ) + +;; definition for function camera-line +;; INFO: Return type mismatch int vs none. +(defun camera-line ((arg0 vector) (arg1 vector) (arg2 vector4w)) + (camera-line-setup arg2) + (camera-line-draw arg0 arg1) + 0 + (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+! + (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg0 + ) + (camera-line arg0 (the-as vector (+ 112 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg3) + (none) + ) + +;; definition for function camera-sphere +;; INFO: Return type mismatch int vs none. +(defun camera-sphere ((arg0 vector) (arg1 float) (arg2 vector4w)) + (camera-line-setup arg2) + (dotimes (s4-0 10) + (let ((f30-1 (* arg1 (sin (* 3276.8 (the float s4-0))))) + (f28-1 (* arg1 (sin (* 3276.8 (the float (+ s4-0 1)))))) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-start y) + (+ (-> arg0 y) (* (cos (* 3276.8 (the float s4-0))) arg1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-end y) + (-> (the-as cam-dbg-scratch #x70000000) sphere-v-start y) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-down y) + (+ (-> arg0 y) (* (cos (* 3276.8 (the float (+ s4-0 1)))) arg1)) + ) + (dotimes (s3-0 10) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-start x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float s3-0))) f30-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-start z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float s3-0))) f30-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-end x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float (+ s3-0 1)))) f30-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-end z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float (+ s3-0 1)))) f30-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-down x) + (+ (-> arg0 x) (* (cos (* 6553.6 (the float s3-0))) f28-1)) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) sphere-v-down z) + (+ (-> arg0 z) (* (sin (* 6553.6 (the float s3-0))) f28-1)) + ) + (camera-line-draw + (the-as vector (+ 128 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 144 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 128 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 160 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + ) + ) + 0 + (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+! + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (vector-! + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg3 + ) + (vector-cross! + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg1 + ) + (vector-normalize! (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg4) + (vector+! + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (vector-! + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg3 + ) + (vector-cross! + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg0 + ) + (vector-normalize! (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) arg4) + (vector+! + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (vector-! + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg2 + (the-as vector (+ 192 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line + (the-as vector (+ 208 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 224 (the-as int (the-as cam-dbg-scratch #x70000000)))) + arg3 + ) + (none) + ) + +;; definition for function camera-bounding-box-draw +;; INFO: Used lq/sq +;; INFO: 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))))) + (-> arg0 min quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 0 x) (-> arg0 max x)) + (set! (-> (the-as (pointer uint128) (+ 256 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 min quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 1 y) (-> arg0 max y)) + (set! (-> (the-as (pointer uint128) (+ 272 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 min quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 2 z) (-> arg0 max z)) + (set! (-> (the-as (pointer uint128) (+ 288 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 max quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 3 x) (-> arg0 min x)) + (set! (-> (the-as (pointer uint128) (+ 304 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 max quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 4 y) (-> arg0 min y)) + (set! (-> (the-as (pointer uint128) (+ 320 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> arg0 max quad) + ) + (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 5 z) (-> arg0 min z)) + (camera-line-draw (-> arg0 min) (the-as vector (+ 240 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 min) (the-as vector (+ 256 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 min) (the-as vector (+ 272 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 max) (the-as vector (+ 288 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 max) (the-as vector (+ 304 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw (-> arg0 max) (the-as vector (+ 320 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (camera-line-draw + (the-as vector (+ 240 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 304 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 304 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 272 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 272 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 288 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 288 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 256 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 256 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 320 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 320 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 240 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + 0 + (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) + (color vector4w :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x44 + :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. +(defun cam-debug-reset-coll-tri () + (set! *cam-debug-los-tri-current* 0) + (set! *cam-debug-coll-tri-current* 0) + 0 + (none) + ) + +;; definition for function cam-debug-add-los-tri +;; INFO: Used lq/sq +;; INFO: 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) + ) + (else + (let ((v1-3 (-> *cam-debug-los-tri* *cam-debug-los-tri-current*))) + (set! (-> v1-3 vertex 0 quad) (-> arg0 0 vertex 0 quad)) + (set! (-> v1-3 vertex 1 quad) (-> arg0 0 vertex 1 quad)) + (set! (-> v1-3 vertex 2 quad) (-> arg0 0 vertex 2 quad)) + (set! (-> v1-3 intersect quad) (-> arg1 quad)) + (set! (-> v1-3 color) (the-as vector4w arg2)) + ) + (set! *cam-debug-los-tri-current* (+ *cam-debug-los-tri-current* 1)) + (if (= *cam-debug-los-tri-current* 460) + (format 0 "ERROR : cam-debug-add-los-tri overflow~%") + ) + ) + ) + 0 + (none) + ) + +;; definition for function cam-debug-add-coll-tri +;; INFO: Used lq/sq +;; INFO: 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) + ) + (else + (let ((v1-3 (-> *cam-debug-coll-tri* *cam-debug-coll-tri-current*))) + (set! (-> v1-3 vertex 0 quad) (-> arg0 vertex 0 quad)) + (set! (-> v1-3 vertex 1 quad) (-> arg0 vertex 1 quad)) + (set! (-> v1-3 vertex 2 quad) (-> arg0 vertex 2 quad)) + (set! (-> v1-3 intersect quad) (-> arg1 quad)) + (set! (-> v1-3 color) (the-as vector4w arg2)) + ) + (set! *cam-debug-coll-tri-current* (+ *cam-debug-coll-tri-current* 1)) + (if (>= *cam-debug-coll-tri-current* 460) + (format 0 "ERROR : cam-debug-add-coll-tri overflow~%") + ) + ) + ) + 0 + (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* + (dotimes (gp-1 *cam-debug-los-tri-current*) + (let ((v1-7 (-> *cam-debug-los-tri* gp-1 color quad))) + (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-7) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 1)) (* 80 gp-1))) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 1)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 2)) (* 80 gp-1))) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0 vertex 2)) (* 80 gp-1))) + (the-as vector (+ (the-as uint (-> *cam-debug-los-tri* 0)) (* 80 gp-1))) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (-> *cam-debug-los-tri* gp-1 intersect) + (-> *cam-debug-los-tri* gp-1 color) + (the-as meters #x44800000) + ) + ) + ) + (when *display-cam-coll-marks* + (dotimes (gp-2 *cam-debug-coll-tri-current*) + (let ((v1-34 (-> *cam-debug-coll-tri* gp-2 color quad))) + (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-34) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 1)) (* 80 gp-2))) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 1)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 2)) (* 80 gp-2))) + ) + (camera-line-draw + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0 vertex 2)) (* 80 gp-2))) + (the-as vector (+ (the-as uint (-> *cam-debug-coll-tri* 0)) (* 80 gp-2))) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (-> *cam-debug-coll-tri* gp-2 intersect) + (-> *cam-debug-coll-tri* gp-2 color) + (the-as meters #x44800000) + ) + ) + #f + ) + ) + +;; 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) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (let ((v1-1 (the-as object (+ 336 (the-as int (the-as cam-dbg-scratch #x70000000)))))) + (let ((t2-1 arg2) + (t3-0 arg1) + (f0-0 arg3) + ) + (.lvf vf2 t3-0) + (.lvf vf1 (&-> t2-1 quad)) + (let ((t2-2 f0-0)) + (.mov vf3 t2-2) + ) + ) + (.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 (the-as (pointer uint128) (&-> (the-as (pointer vector) v1-1) 0)) vf4) + ) + (let ((v1-3 (the-as object (+ 352 (the-as int (the-as cam-dbg-scratch #x70000000)))))) + (let ((t2-4 arg2) + (t3-1 arg0) + (f0-1 arg3) + ) + (.lvf vf2 t3-1) + (.lvf vf1 (&-> t2-4 quad)) + (let ((a3-1 f0-1)) + (.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 (the-as (pointer uint128) (&-> (the-as (pointer vector) v1-3) 0)) vf4) + ) + (let ((v1-5 (the-as object (+ 368 (the-as int (the-as cam-dbg-scratch #x70000000)))))) + (let ((a3-3 arg2) + (f0-2 arg4) + ) + (.lvf vf2 arg0) + (.lvf vf1 (&-> a3-3 quad)) + (let ((a0-1 f0-2)) + (.mov vf3 a0-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 (the-as (pointer uint128) (&-> (the-as (pointer vector) v1-5) 0)) vf4) + ) + (let ((v1-7 (the-as object (+ 384 (the-as int (the-as cam-dbg-scratch #x70000000)))))) + (let ((a0-3 arg2) + (f0-3 arg4) + ) + (.lvf vf2 arg1) + (.lvf vf1 (&-> a0-3 quad)) + (let ((a0-4 f0-3)) + (.mov vf3 a0-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 (the-as (pointer uint128) (&-> (the-as (pointer vector) v1-7) 0)) vf4) + ) + (camera-line-setup arg5) + (camera-line-draw + (the-as vector (+ 336 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 352 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 352 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 368 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (camera-line-draw + (the-as vector (+ 368 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 384 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + (none) + ) + ) + +;; definition for function camera-fov-frame +;; INFO: Used lq/sq +;; INFO: 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)))) + (-> arg0 vector 1) + (* arg3 (tan arg2)) + ) + (vector-float*! + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (-> arg0 vector)) + (* arg4 (tan arg2)) + ) + (vector+! + (the-as vector (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector+! + (the-as vector (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (vector+! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector-! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (camera-fov-draw + (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))) + (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000))) + arg1 + 4096.0 + 20480.0 + arg5 + ) + (set! (-> (the-as (pointer uint128) (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> (the-as vector4w (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) quad) + ) + (vector-! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector+! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (camera-fov-draw + (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))) + (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000))) + arg1 + 4096.0 + 20480.0 + arg5 + ) + (set! (-> (the-as (pointer uint128) (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> (the-as vector4w (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) quad) + ) + (vector-! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector-! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (camera-fov-draw + (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))) + (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000))) + arg1 + 4096.0 + 20480.0 + arg5 + ) + (set! (-> (the-as (pointer uint128) (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))))) + (-> (the-as vector4w (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) quad) + ) + (vector+! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (-> arg0 vector 2) + (vector+! + (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 432 (the-as int (the-as cam-dbg-scratch #x70000000)))) + (the-as vector (+ 448 (the-as int (the-as cam-dbg-scratch #x70000000)))) + ) + ) + (vector-normalize! (the-as vector (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000)))) 1.0) + (the-as symbol (camera-fov-draw + (+ 400 (the-as int (the-as cam-dbg-scratch #x70000000))) + (+ 416 (the-as int (the-as cam-dbg-scratch #x70000000))) + arg1 + 4096.0 + 20480.0 + arg5 + ) + ) + ) + +;; definition for method 11 of type tracking-spline +;; INFO: 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") + (format 0 " ") + ) + (if (= arg0 (-> obj next-to-last-point)) + (format 0 "n") + (format 0 " ") + ) + (if (= arg0 (-> obj end-point)) + (format 0 "e") + (format 0 " ") + ) + (if (= arg0 -134250495) + (format 0 " ~D~%" arg0) + (format + 0 + " ~D ~M ~M ~M~%" + arg0 + (-> obj point arg0 position x) + (-> obj point arg0 position y) + (-> obj point arg0 position z) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type tracking-spline +;; INFO: 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) + (debug-point-info obj s5-0) + (set! s5-0 (-> obj point s5-0 next)) + ) + (debug-point-info obj s5-0) + ) + 0 + (none) + ) + +;; definition for method 23 of type tracking-spline +;; INFO: 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))) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (when (!= s4-0 -134250495) + (tracking-spline-method-19 obj 0.0 s3-0 (the-as tracking-spline-sampler #f)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s3-0 + (new 'static 'vector4w :x #xff :w #x80) + (the-as meters #x44800000) + ) + (tracking-spline-method-19 obj (-> obj sample-len) s3-0 (the-as tracking-spline-sampler #f)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s3-0 + (new 'static 'vector4w :x #xff :w #x80) + (the-as meters #x44800000) + ) + ) + ) + (while (!= s4-0 -134250495) + (camera-line + (the-as vector (-> obj point s5-0)) + (the-as vector (-> obj point s4-0)) + (new 'static 'vector4w :x #x80 :y #x80 :z #x80 :w #x80) + ) + (set! s5-0 s4-0) + (set! s4-0 (-> obj point s4-0 next)) + ) + ) + (if (!= s5-0 -134250495) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (the-as vector (-> obj point s5-0)) + (new 'static 'vector4w :x #xff :w #x80) + (the-as meters #x44800000) + ) + ) + ) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (camera-line + (-> obj debug-out-position) + (-> obj debug-old-position) + (new 'static 'vector4w :x #xff :y #xff :w #x80) + ) + (vector-! s5-1 (-> obj debug-out-position) (-> obj debug-old-position)) + (tracking-spline-method-20 obj s5-1 (-> obj debug-last-point)) + (camera-line-rel (-> obj debug-old-position) s5-1 (new 'static 'vector4w :x #xff :z #xff :w #x80)) + ) + 0 + (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)) + ) + (matrix->eul s4-0 (the-as matrix (&-> arg0 crossvec 0 w)) 21) + (format *stdcon* "euler angles x ~R y ~R z ~R~%" (-> s4-0 x) (-> s4-0 y) (-> s4-0 z)) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 0 w) + (-> arg0 crossvec 1 x) + (-> arg0 crossvec 1 y) + (-> arg0 crossvec 1 z) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 1 w) + (-> arg0 crossvec 2 x) + (-> arg0 crossvec 2 y) + (-> arg0 crossvec 2 z) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 crossvec 2 w) + (-> arg0 bboxvec 0 x) + (-> arg0 bboxvec 0 y) + (-> arg0 bboxvec 0 z) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> arg0 bboxvec 0 w) + (-> arg0 bboxvec 1 x) + (-> arg0 bboxvec 1 y) + (-> arg0 bboxvec 1 z) + ) + (eul->matrix gp-0 s4-0) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> gp-0 vector 0 x) + (-> gp-0 vector 0 y) + (-> gp-0 vector 0 z) + (-> gp-0 vector 0 w) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> gp-0 vector 1 x) + (-> gp-0 vector 1 y) + (-> gp-0 vector 1 z) + (-> gp-0 vector 1 w) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (-> gp-0 vector 2 x) + (-> gp-0 vector 2 y) + (-> gp-0 vector 2 z) + (-> gp-0 vector 2 w) + ) + (format *stdcon* "~f ~f ~f ~f~%" (-> gp-0 trans x) (-> gp-0 trans y) (-> gp-0 trans z) (-> gp-0 trans w)) + (if (or (< 0.001 (fabs (- (-> arg0 crossvec 0 w) (-> gp-0 vector 0 x)))) + (< 0.001 (fabs (- (-> arg0 crossvec 1 x) (-> gp-0 vector 0 y)))) + (< 0.001 (fabs (- (-> arg0 crossvec 1 y) (-> gp-0 vector 0 z)))) + (< 0.001 (fabs (- (-> arg0 crossvec 1 z) (-> gp-0 vector 0 w)))) + (< 0.001 (fabs (- (-> arg0 crossvec 1 w) (-> gp-0 vector 1 x)))) + (< 0.001 (fabs (- (-> arg0 crossvec 2 x) (-> gp-0 vector 1 y)))) + (< 0.001 (fabs (- (-> arg0 crossvec 2 y) (-> gp-0 vector 1 z)))) + (< 0.001 (fabs (- (-> arg0 crossvec 2 z) (-> gp-0 vector 1 w)))) + (< 0.001 (fabs (- (-> arg0 crossvec 2 w) (-> gp-0 vector 2 x)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 x) (-> gp-0 vector 2 y)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 y) (-> gp-0 vector 2 z)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 z) (-> gp-0 vector 2 w)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 0 w) (-> gp-0 trans x)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 1 x) (-> gp-0 trans y)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 1 y) (-> gp-0 trans z)))) + (< 0.001 (fabs (- (-> arg0 bboxvec 1 z) (-> gp-0 trans w)))) + ) + (format *stdcon* "different~%") + (format *stdcon* "same~%") + ) + ) + ) + +;; 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)) + ) + (if (< f30-0 8192.0) + (* (/ 1.0 (- 1.0 (cos 21845.334))) (+ (- (cos 21845.334)) (cos (* 2.6666667 (- 8192.0 f30-0))))) + 1.0 + ) + ) + ) + +;; definition for function camera-slave-debug +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun camera-slave-debug ((arg0 camera-slave)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (when *display-camera-marks* + (if (-> *setting-control* cam-current use-point-of-interest) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + (-> *setting-control* cam-current point-of-interest) + (new 'static 'vector4w :x #x80 :z #x80 :w #x80) + (the-as meters #x44800000) + ) + ) + (let ((f30-0 (* 0.5 (-> *camera-combiner* fov)))) + (camera-fov-frame + (-> *camera-combiner* inv-camera-rot) + (camera-pos) + f30-0 + 0.75 + 1.0 + (new 'static 'vector4w :z #xff :w #x80) + ) + ) + (cond + ((= (-> arg0 blend-to-type) (camera-blend-to-type unknown-2)) + (let ((f0-2 (* 0.5 (-> arg0 fov)))) + (camera-fov-frame + (the-as matrix (-> *camera-combiner* tracking)) + (-> arg0 trans) + f0-2 + 0.75 + 1.0 + (new 'static 'vector4w :y #xff :w #x80) + ) + ) + ) + (else + (let ((f0-4 (* 0.5 (-> arg0 fov)))) + (camera-fov-frame + (the-as matrix (-> arg0 tracking)) + (-> arg0 trans) + f0-4 + 0.75 + 1.0 + (new 'static 'vector4w :y #xff :w #x80) + ) + ) + ) + ) + (debug-draw-spline (-> arg0 position-spline)) + (let ((s5-1 (new-stack-vector0))) + (let ((s4-1 (new-stack-vector0))) + (new-stack-matrix0) + (cond + ((and (-> arg0 next-state) + (let ((v1-23 (-> arg0 next-state name))) + (or (= v1-23 'cam-fixed) (= v1-23 'cam-eye) (= v1-23 'cam-point-watch) (= v1-23 'cam-free-floating)) + ) + ) + (let ((v1-24 s5-1)) + (let ((a0-11 (-> arg0 trans)) + (a1-8 (-> *camera* local-down)) + (f0-5 4096.0) + ) + (.lvf vf2 (&-> a1-8 quad)) + (.lvf vf1 (&-> a0-11 quad)) + (let ((a0-12 f0-5)) + (.mov vf3 a0-12) + ) + ) + (.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-24 quad) vf4) + ) + (camera-line (-> arg0 trans) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + ) + ((= (-> arg0 blend-to-type) (camera-blend-to-type unknown-2)) + (camera-line + (-> *camera-combiner* tracking follow-pt) + (-> arg0 trans) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + (let ((v1-28 s5-1)) + (let ((a0-17 (-> *camera-combiner* tracking follow-pt)) + (a1-12 (-> *camera* local-down)) + (f0-6 4096.0) + ) + (.lvf vf2 (&-> a1-12 quad)) + (.lvf vf1 (&-> a0-17 quad)) + (let ((a0-18 f0-6)) + (.mov vf3 a0-18) + ) + ) + (.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-28 quad) vf4) + ) + (camera-line + (-> *camera-combiner* tracking follow-pt) + s5-1 + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + ) + (else + (camera-line + (-> arg0 tracking follow-pt) + (-> arg0 trans) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + (let ((v1-31 s5-1)) + (let ((a0-21 (-> arg0 tracking follow-pt)) + (a1-16 (-> *camera* local-down)) + (f0-7 4096.0) + ) + (.lvf vf2 (&-> a1-16 quad)) + (.lvf vf1 (&-> a0-21 quad)) + (let ((a0-22 f0-7)) + (.mov vf3 a0-22) + ) + ) + (.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-31 quad) vf4) + ) + (camera-line (-> arg0 tracking follow-pt) s5-1 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + ) + ) + (set! (-> s4-1 quad) (-> arg0 trans quad)) + (cond + ((= (-> arg0 blend-to-type) (camera-blend-to-type unknown-2)) + (let ((v1-35 s5-1)) + (let ((a0-27 s4-1) + (a1-19 (-> *camera-combiner* tracking)) + (f0-8 2048.0) + ) + (.lvf vf2 (&-> a1-19 inv-mat vector 0 quad)) + (.lvf vf1 (&-> a0-27 quad)) + (let ((a0-28 f0-8)) + (.mov vf3 a0-28) + ) + ) + (.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-35 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :x #xff :w #x80)) + (let ((v1-36 s5-1)) + (let ((a0-30 s4-1) + (a1-22 (&-> *camera-combiner* stack 176)) + (f0-9 2048.0) + ) + (.lvf vf2 a1-22) + (.lvf vf1 (&-> a0-30 quad)) + (let ((a0-31 f0-9)) + (.mov vf3 a0-31) + ) + ) + (.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-36 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :y #xff :w #x80)) + (let ((v1-37 s5-1)) + (let ((a0-33 s4-1) + (a1-25 (&-> *camera-combiner* stack 192)) + (f0-10 2048.0) + ) + (.lvf vf2 a1-25) + (.lvf vf1 (&-> a0-33 quad)) + (let ((a0-34 f0-10)) + (.mov vf3 a0-34) + ) + ) + (.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-37 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80)) + ) + (else + (let ((v1-39 s5-1)) + (let ((a0-36 s4-1) + (a1-27 (-> arg0 tracking)) + (f0-11 2048.0) + ) + (.lvf vf2 (&-> a1-27 inv-mat vector 0 quad)) + (.lvf vf1 (&-> a0-36 quad)) + (let ((a0-37 f0-11)) + (.mov vf3 a0-37) + ) + ) + (.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-39 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :x #xff :w #x80)) + (let ((v1-40 s5-1)) + (let ((a0-39 s4-1) + (a1-29 (&-> arg0 stack 96)) + (f0-12 2048.0) + ) + (.lvf vf2 a1-29) + (.lvf vf1 (&-> a0-39 quad)) + (let ((a0-40 f0-12)) + (.mov vf3 a0-40) + ) + ) + (.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-40 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :y #xff :w #x80)) + (let ((v1-41 s5-1)) + (let ((a0-42 s4-1) + (a1-31 (&-> arg0 stack 112)) + (f0-13 2048.0) + ) + (.lvf vf2 a1-31) + (.lvf vf1 (&-> a0-42 quad)) + (let ((a0-43 f0-13)) + (.mov vf3 a0-43) + ) + ) + (.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-41 quad) vf4) + ) + (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80)) + ) + ) + ) + (vector--float*! + s5-1 + (-> *camera* tpos-curr) + (-> *camera* local-down) + (-> *setting-control* cam-current foot-offset) + ) + (camera-sphere s5-1 512.0 (new 'static 'vector4w :y #xff :w #x80)) + (vector--float*! + s5-1 + (-> *camera* tpos-curr) + (-> *camera* local-down) + (-> *setting-control* cam-current head-offset) + ) + (camera-sphere s5-1 512.0 (new 'static 'vector4w :y #xff :w #x80)) + ) + (cond + ((and (-> arg0 next-state) (= (-> arg0 next-state name) 'cam-string)) + (camera-sphere (-> arg0 desired-pos) 512.0 (new 'static 'vector4w :z #xff :w #x80)) + (camera-line-rel (-> *camera* tpos-curr-adj) (-> arg0 view-flat) (new 'static 'vector4w :z #xff :w #x80)) + (camera-line + (-> arg0 string-trans) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> arg0 los-tgt-spline-pt)))) + (new 'static 'vector4w :y #xff :w #x80) + ) + (camera-line + (-> arg0 los-last-pos) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> arg0 los-tgt-spline-pt)))) + (new 'static 'vector4w :x #xff :w #x80) + ) + ) + ((and (-> arg0 next-state) (= (-> arg0 next-state name) 'cam-circular)) + (let ((a1-45 (new-stack-vector0))) + (let ((v1-66 a1-45)) + (let ((a0-55 (-> arg0 pivot-pt)) + (a2-35 (-> *camera* local-down)) + (f0-16 4096.0) + ) + (.lvf vf2 (&-> a2-35 quad)) + (.lvf vf1 (&-> a0-55 quad)) + (let ((a0-56 f0-16)) + (.mov vf3 a0-56) + ) + ) + (.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-66 quad) vf4) + ) + (camera-line (-> arg0 pivot-pt) a1-45 (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + ) + (camera-line (-> arg0 pivot-pt) (-> arg0 trans) (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + ) + ((and (-> arg0 next-state) (= (-> arg0 next-state name) 'cam-spline)) + (let ((s5-2 (new 'stack 'curve)) + (s4-2 (res-lump-struct (-> arg0 cam-entity) 'spline-offset structure)) + ) + (if (not s4-2) + (set! s4-2 (new-stack-vector0)) + ) + (when (get-curve-data! (-> arg0 cam-entity) s5-2 'campath 'campath-k -1000000000.0) + (let ((s3-0 (new-stack-vector0)) + (s2-0 (new-stack-vector0)) + (gp-1 (res-lump-data (-> arg0 cam-entity) 'campoints pointer :time 1.0)) + ) + (curve-get-pos! s2-0 0.0 s5-2) + (vector+! s2-0 s2-0 (the-as vector s4-2)) + (dotimes (s1-0 8) + (set! (-> s3-0 quad) (-> s2-0 quad)) + (curve-get-pos! s2-0 (* 0.125 (the float (+ s1-0 1))) s5-2) + (vector+! s2-0 s2-0 (the-as vector s4-2)) + (camera-line s3-0 s2-0 (new 'static 'vector4w :x #xff :y #xff :w #x80)) + ) + (dotimes (s1-1 (-> s5-2 num-cverts)) + (vector+! s3-0 (-> s5-2 cverts s1-1) (the-as vector s4-2)) + (vector+! s2-0 (-> s5-2 cverts (mod (+ s1-1 1) (-> s5-2 num-cverts))) (the-as vector s4-2)) + (camera-line s3-0 s2-0 (new 'static 'vector4w :y #xff :z #xff :w #x80)) + ) + (if gp-1 + (camera-line + (the-as vector (&+ gp-1 0)) + (the-as vector (&+ gp-1 16)) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + (camera-line + (-> s5-2 cverts 0) + (-> s5-2 cverts (+ (-> s5-2 num-cverts) -1)) + (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for function master-draw-coordinates +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun master-draw-coordinates ((arg0 vector)) + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (let ((a0-1 (new-stack-matrix0))) + (set-vector! s5-0 0.0 8192.0 0.0 1.0) + (matrix-rotate-yxz! a0-1 s5-0) + ) + (vector+! + gp-0 + (-> *camera-combiner* trans) + (vector-normalize-copy! gp-0 (-> *camera-combiner* inv-camera-rot vector 2) 24576.0) + ) + (let ((a1-4 s5-0) + (v1-4 gp-0) + (a0-3 s5-0) + ) + (set! (-> a0-3 x) 4096.0) + (set! (-> a0-3 y) 0.0) + (set! (-> a0-3 z) 0.0) + (set! (-> a0-3 w) 1.0) + (vector+! a1-4 v1-4 a0-3) + ) + (add-debug-line #t (bucket-id bucket-318) gp-0 s5-0 (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1)) + (let ((a1-7 s5-0) + (v1-5 gp-0) + (a0-5 s5-0) + ) + (set! (-> a0-5 x) 0.0) + (set! (-> a0-5 y) 4096.0) + (set! (-> a0-5 z) 0.0) + (set! (-> a0-5 w) 1.0) + (vector+! a1-7 v1-5 a0-5) + ) + (add-debug-line #t (bucket-id bucket-318) gp-0 s5-0 (new 'static 'rgba :g #xff :a #x80) #f (the-as rgba -1)) + (let ((a1-10 s5-0) + (v1-6 gp-0) + (a0-7 s5-0) + ) + (set! (-> a0-7 x) 0.0) + (set! (-> a0-7 y) 0.0) + (set! (-> a0-7 z) 4096.0) + (set! (-> a0-7 w) 1.0) + (vector+! a1-10 v1-6 a0-7) + ) + (add-debug-line #t (bucket-id bucket-318) gp-0 s5-0 (new 'static 'rgba :b #xff :a #x80) #f (the-as rgba -1)) + (when arg0 + (set! (-> s5-0 quad) (-> arg0 quad)) + (vector-normalize! s5-0 4096.0) + (vector+! s5-0 gp-0 s5-0) + (add-debug-line + #t + (bucket-id bucket-318) + gp-0 + s5-0 + (new 'static 'rgba :r #x7f :g #x7f :a #x80) + #f + (the-as rgba -1) + ) + ) + ) + 0 + (none) + ) + +;; definition of type cam-collision-record +(deftype cam-collision-record (structure) + ((pos vector :inline :offset-assert 0) + (vel vector :inline :offset-assert 16) + (desired-pos vector :inline :offset-assert 32) + (cam-tpos-cur vector :inline :offset-assert 48) + (cam-tpos-old vector :inline :offset-assert 64) + (view-flat vector :inline :offset-assert 80) + (string-min-val vector :inline :offset-assert 96) + (string-max-val vector :inline :offset-assert 112) + (view-off vector :inline :offset-assert 128) + (min-z-override float :offset-assert 144) + (string-push-z float :offset-assert 148) + (view-off-param float :offset-assert 152) + (frame int32 :offset-assert 156) + (iteration int32 :offset-assert 160) + (move-type symbol :offset-assert 164) + ) + :method-count-assert 9 + :size-assert #xa8 + :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) + ) + :method-count-assert 9 + :size-assert #x10 + :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. +(defun cam-collision-record-save ((arg0 vector) (arg1 vector) (arg2 int) (arg3 symbol) (arg4 camera-slave)) + (with-pp + (when *record-cam-collide-history* + (let ((v1-5 (the-as + cam-collision-record + (+ (+ (* 176 *cam-collision-record-last*) 12) (the-as int *cam-collision-record*)) + ) + ) + ) + (set! (-> v1-5 pos quad) (-> arg0 quad)) + (set! (-> v1-5 vel quad) (-> arg1 quad)) + (set! (-> v1-5 view-flat quad) (-> arg4 view-flat quad)) + (set! (-> v1-5 desired-pos quad) (-> arg4 desired-pos quad)) + (set! (-> v1-5 cam-tpos-cur quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> v1-5 cam-tpos-old quad) (-> *camera* tpos-old-adj quad)) + (set! (-> v1-5 string-min-val quad) (-> arg4 string-min-val quad)) + (set! (-> v1-5 string-max-val quad) (-> arg4 string-max-val quad)) + (set! (-> v1-5 view-off quad) (-> arg4 view-off quad)) + (set! (-> v1-5 frame) (the-as int (-> pp clock frame-counter))) + (set! (-> v1-5 iteration) arg2) + (set! (-> v1-5 move-type) arg3) + (set! (-> v1-5 min-z-override) (-> arg4 min-z-override)) + (set! (-> v1-5 string-push-z) (-> *camera* string-push-z)) + (set! (-> v1-5 view-off-param) (-> arg4 view-off-param)) + ) + (set! *cam-collision-record-show* *cam-collision-record-last*) + (set! *cam-collision-record-last* (+ *cam-collision-record-last* 1)) + (set! *cam-collision-record-last* (mod *cam-collision-record-last* 600)) + (when (= *cam-collision-record-last* *cam-collision-record-first*) + (set! *cam-collision-record-first* (+ *cam-collision-record-first* 1)) + (set! *cam-collision-record-first* (mod *cam-collision-record-first* 600)) + ) + ) + 0 + (none) + ) + ) + +;; definition for function cam-collision-record-step +;; INFO: 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) + (set! *cam-collision-record-show* (+ *cam-collision-record-show* -600)) + ) + (while (< *cam-collision-record-show* 0) + (set! *cam-collision-record-show* (+ *cam-collision-record-show* 600)) + ) + 0 + (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 +(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) + ) + ((cpad-hold? 0 right) + (cam-collision-record-step 1) + ) + ((cpad-pressed? 0 up) + (cam-collision-record-step -1) + ) + ((cpad-hold? 0 left) + (cam-collision-record-step -1) + ) + ) + (let ((s5-0 (the-as object (+ (+ (* 176 *cam-collision-record-show*) 12) (the-as int *cam-collision-record*)))) + (s4-0 (new 'stack 'vector4w)) + (gp-0 (new 'stack 'vector4w)) + ) + (format *stdcon* "move-type ~A~%" (-> (the-as cam-collision-record s5-0) move-type)) + (cond + ((= (-> (the-as cam-collision-record s5-0) move-type) 'normal) + (set! (-> s4-0 x) 255) + (set! (-> s4-0 y) 255) + ) + ((= (-> (the-as cam-collision-record s5-0) move-type) 'jump) + (set! (-> s4-0 x) 255) + ) + ((= (-> (the-as cam-collision-record s5-0) move-type) 'no-hit) + (set! (-> s4-0 y) 255) + ) + (else + (set! (-> s4-0 z) 255) + ) + ) + (set! (-> s4-0 w) 128) + (set! (-> gp-0 x) 127) + (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) + ) + (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)) + ) + (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 + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function camera-master-debug +;; INFO: Return type mismatch int vs none. +(defun camera-master-debug ((arg0 camera-master)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (when *display-cam-other* + (let ((f0-1 (* 0.5 (-> *camera-other-fov* data)))) + (camera-fov-frame + *camera-other-matrix* + *camera-other-trans* + f0-1 + 0.75 + 1.0 + (new 'static 'vector4w :x #xff :w #x80) + ) + ) + (camera-line *camera-other-trans* *camera-other-root* (new 'static 'vector4w :x #xff :y #xff :z #xff :w #x80)) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 *camera-other-trans*) + ) + (let ((v1-5 s4-0)) + (let ((a0-3 s5-0) + (a1-3 (-> *camera-other-matrix* vector)) + (f0-2 2048.0) + ) + (.lvf vf2 (&-> a1-3 0 quad)) + (.lvf vf1 (&-> a0-3 quad)) + (let ((a0-4 f0-2)) + (.mov vf3 a0-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 (&-> v1-5 quad) vf4) + ) + (camera-line s5-0 s4-0 (new 'static 'vector4w :x #xff :w #x80)) + (let ((v1-6 s4-0)) + (let ((a0-6 s5-0) + (a1-6 (-> *camera-other-matrix* vector 1)) + (f0-3 2048.0) + ) + (.lvf vf2 (&-> a1-6 quad)) + (.lvf vf1 (&-> a0-6 quad)) + (let ((a0-7 f0-3)) + (.mov vf3 a0-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 (&-> v1-6 quad) vf4) + ) + (camera-line s5-0 s4-0 (new 'static 'vector4w :y #xff :w #x80)) + (let ((v1-7 s4-0)) + (let ((a0-9 s5-0) + (a1-9 (-> *camera-other-matrix* vector 2)) + (f0-4 2048.0) + ) + (.lvf vf2 (&-> a1-9 quad)) + (.lvf vf1 (&-> a0-9 quad)) + (let ((a0-10 f0-4)) + (.mov vf3 a0-10) + ) + ) + (.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-7 quad) vf4) + ) + (camera-line s5-0 s4-0 (new 'static 'vector4w :z #xff :w #x80)) + ) + ) + (when *display-camera-last-attacker* + (format *stdcon* "last attacker '") + (let ((v1-13 (handle->process (-> last-try-to-look-at-data who)))) + (if v1-13 + (format *stdcon* "~S" (-> v1-13 name)) + ) + ) + (format *stdcon* "'~%") + ) + (when *display-camera-old-stats* + (format + *stdcon* + "old ~S cpu ~D old vu ~D (go to menu before comparing)~%" + *camera-old-level* + *camera-old-cpu* + *camera-old-vu* + ) + (format *stdcon* "old tfrag-mem ~D~%" (sar *camera-old-tfrag-bytes* 10)) + (format *stdcon* "~S~%" *camera-old-stat-string-tfrag-near*) + (format *stdcon* "~S~%" *camera-old-stat-string-tfrag*) + (format *stdcon* "~S~%" *camera-old-stat-string-total*) + ) + (if *display-cam-collide-history* + (cam-collision-record-draw) + ) + (if *display-cam-master-marks* + (debug-draw-spline (-> arg0 target-spline)) + ) + (if *display-xyz-axes* + (master-draw-coordinates (the-as vector #f)) + ) + (cam-debug-draw-tris) + 0 + (none) + ) + ) + +;; 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)) + (let* ((v1-6 (-> *camera-combiner* inv-camera-rot)) + (a3-0 arg1) + (a0-3 (-> a3-0 vector 0 quad)) + (a1-1 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-6 vector 0 quad) a0-3) + (set! (-> v1-6 vector 1 quad) a1-1) + (set! (-> v1-6 vector 2 quad) a2-0) + (set! (-> v1-6 trans quad) a3-1) + ) + (set-setting-by-param *setting-control* 'mode-name 'cam-fixed 0 0) + (cam-master-activate-slave #t) + ) + arg0 + ) + +;; definition (debug) for function cam-restore +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun-debug cam-restore () + (let ((a0-0 (new-stack-vector0)) + (a1-0 (new-stack-matrix0)) + ) + (set! (-> a0-0 x) 1538892.5) + (set! (-> a0-0 y) -274716.78) + (set! (-> a0-0 z) -8318042.5) + (set! (-> a0-0 w) 1.0) + (set! (-> a1-0 vector 0 x) 0.4915) + (set! (-> a1-0 vector 0 y) 0.0) + (set! (-> a1-0 vector 0 z) -0.8708) + (set! (-> a1-0 vector 0 w) 0.0) + (set! (-> a1-0 vector 1 x) 0.7179) + (set! (-> a1-0 vector 1 y) 0.5659) + (set! (-> a1-0 vector 1 z) 0.4052) + (set! (-> a1-0 vector 1 w) 0.0) + (set! (-> a1-0 vector 2 x) 0.4928) + (set! (-> a1-0 vector 2 y) -0.8244) + (set! (-> a1-0 vector 2 z) 0.2782) + (set! (-> a1-0 vector 2 w) 0.0) + (set! (-> a1-0 trans x) 0.0) + (set! (-> a1-0 trans y) 0.0) + (set! (-> a1-0 trans z) 0.0) + (set! (-> a1-0 trans w) 1.0) + (debug-set-camera-pos-rot! a0-0 a1-0) + ) + (send-event *camera* 'set-fov #x46360b61) + (clear *camera-old-level*) + (format *camera-old-level* "dig3a") + (set! *camera-old-cpu* 4815) + (set! *camera-old-vu* 6110) + (set! *camera-old-tfrag-bytes* #xa0130) + (clear *camera-old-stat-string-tfrag*) + (clear *camera-old-stat-string-tfrag-near*) + (clear *camera-old-stat-string-total*) + (set! *display-camera-old-stats* #t) + (set! (-> *tfrag-work* min-fragment) (the-as uint 318)) + (set! (-> *tfrag-work* max-fragment) (the-as uint 319)) + (none) + ) + +) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-interface_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-interface_REF.gc new file mode 100644 index 0000000000..ec5c1580ba --- /dev/null +++ b/test/decompiler/reference/jak2/engine/camera/cam-interface_REF.gc @@ -0,0 +1,125 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function position-in-front-of-camera! +(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (vector-float*! arg0 (-> *math-camera* inv-camera-rot vector 2) arg1) + (let ((v1-2 arg0)) + (let ((a1-1 arg0) + (a3-3 (-> *math-camera* inv-camera-rot vector 1)) + (f0-1 arg2) + ) + (.lvf vf2 (&-> a3-3 quad)) + (.lvf vf1 (&-> a1-1 quad)) + (let ((a1-2 f0-1)) + (.mov vf3 a1-2) + ) + ) + (.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-2 quad) vf4) + ) + (vector+! arg0 arg0 (-> *math-camera* trans)) + arg0 + ) + ) + +;; definition for function position-in-front-of-screen! +(defun position-in-front-of-screen! ((arg0 vector) (arg1 float) (arg2 vector)) + (let ((a2-1 (vector-negate! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot vector 2))) + (a1-3 (vector-float*! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot vector 2) arg1)) + ) + (vector+! (the-as vector a1-3) (the-as vector a1-3) (-> *math-camera* trans)) + (reverse-transform-point! arg0 (the-as vector a1-3) a2-1 arg2) + ) + arg0 + ) + +;; definition for function matrix-local->world +(defun matrix-local->world ((smooth? symbol)) + "Returns [[*math-camera*]]'s `inv-camera-rot-smooth` if `smooth?` is true, else return `inv-camera-rot`" + (if smooth? + (-> *math-camera* inv-camera-rot-smooth) + (-> *math-camera* inv-camera-rot) + ) + ) + +;; definition for function matrix-world->local +(defun matrix-world->local () + "Returns [[*math-camera*]]'s `camera-rot`" + (-> *math-camera* camera-rot) + ) + +;; definition (perm) for symbol *camera-dummy-vector*, type vector +(define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector))) + +;; definition for function camera-pos +(defun camera-pos () + "Returns the `trans` vector from whatever is first determined to exist: + - [[*camera-combiner*]] + - [[*math-camera*]] + - else, [[*camera-dummy-vector*]]" + (cond + (*camera-combiner* + (-> *camera-combiner* trans) + ) + (*math-camera* + (-> *math-camera* trans) + ) + (else + *camera-dummy-vector* + ) + ) + ) + +;; definition for function math-camera-pos +(defun math-camera-pos () + "Returns [[*math-camera*]]'s `trans`" + (-> *math-camera* trans) + ) + +;; definition for function camera-matrix +(defun camera-matrix () + "If [[*camera-combiner*]] exists, return it's `inv-camera-rot`. Else, return [[*math-camera*]]'s" + (if *camera-combiner* + (-> *camera-combiner* inv-camera-rot) + (-> *math-camera* inv-camera-rot) + ) + ) + +;; definition for function math-camera-matrix +(defun math-camera-matrix () + "Returns [[*math-camera*]]'s `inv-camera-rot`" + (-> *math-camera* inv-camera-rot) + ) + +;; definition for function camera-angle +(defun camera-angle () + (let ((f0-0 (-> *math-camera* camera-rot vector 0 x)) + (f1-0 (-> *math-camera* camera-rot vector 0 z)) + ) + (atan f1-0 f0-0) + ) + ) + +;; definition for function camera-teleport-to-entity +;; INFO: Used lq/sq +;; INFO: Return type mismatch object vs none. +(defbehavior camera-teleport-to-entity process ((arg0 entity-actor)) + (let ((gp-0 (new 'stack 'transformq))) + (set! (-> gp-0 trans quad) (-> arg0 extra trans quad)) + (quaternion-copy! (-> gp-0 quat) (-> arg0 quat)) + (vector-identity! (-> gp-0 scale)) + (send-event *camera* 'teleport-to-transformq gp-0) + ) + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-start_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-start_REF.gc new file mode 100644 index 0000000000..bc7282a68f --- /dev/null +++ b/test/decompiler/reference/jak2/engine/camera/cam-start_REF.gc @@ -0,0 +1,51 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function cam-stop +(defun cam-stop () + (kill-by-name "camera-master" *active-pool*) + (kill-by-name "camera-slave" *active-pool*) + (kill-by-name "camera-combiner" *active-pool*) + (set! *camera* #f) + (set! *camera-combiner* #f) + #f + ) + +;; definition for function cam-start +;; INFO: Return type mismatch int vs none. +(defun cam-start ((arg0 symbol)) + (cam-stop) + (set! *camera-combiner* + (the-as camera-combiner (ppointer->process (process-spawn + camera-combiner + :init cam-combiner-init + :name (symbol->string (-> camera-combiner symbol)) + :from *camera-dead-pool* + :to *camera-pool* + ) + ) + ) + ) + (set! *camera* (the-as camera-master (ppointer->process (process-spawn + camera-master + :init cam-master-init + :name (symbol->string (-> camera-master symbol)) + :from *camera-master-dead-pool* + :to *camera-pool* + ) + ) + ) + ) + (if arg0 + (reset-cameras) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(cam-start #f) + + + + diff --git a/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc new file mode 100644 index 0000000000..1aab0e6f3c --- /dev/null +++ b/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc @@ -0,0 +1,532 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type cam-point-watch-bank +(deftype cam-point-watch-bank (basic) + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type cam-point-watch-bank +(defmethod inspect cam-point-watch-bank ((obj cam-point-watch-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tspeed: ~f~%" (-> obj speed)) + (format #t "~1Trot-speed: (deg ~r)~%" (-> obj rot-speed)) + (label cfg-4) + obj + ) + +;; definition for symbol *CAM_POINT_WATCH-bank*, type cam-point-watch-bank +(define *CAM_POINT_WATCH-bank* (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6))) + +;; failed to figure out what this is: +(defstate cam-point-watch (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self pivot-rad) 40960.0) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + ) + (none) + ) + :code (behavior () + (until #f + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 -1.0)) + (f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 -1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 -1.0)) + (f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 -1.0)) + ) + (cond + ((cpad-hold? (-> *CAMERA-bank* joypad) r2) + (set! (-> s5-0 y) (- (-> s5-0 y) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) + (set! (-> s5-0 x) (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) + (+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) + ) + (else + (set! (-> s5-0 y) (- (-> s5-0 y) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) + (set! (-> s5-0 x) (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) + (+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) + ) + ) + ) + (let ((s4-0 (new-stack-vector0))) + (let ((s3-0 (new-stack-matrix0))) + (matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x))) + (vector-matrix*! s4-0 (the-as vector (&-> self stack 112)) s3-0) + (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) + (vector-matrix*! s4-0 s4-0 s3-0) + ) + (forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down)) + ) + (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) + (if (< (-> self pivot-rad) 4096.0) + (set! (-> self pivot-rad) 4096.0) + ) + (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) + (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))) + ) + ) + (suspend) + 0 + ) + #f + (none) + ) + ) + +;; definition of type cam-free-bank +(deftype cam-free-bank (basic) + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type cam-free-bank +(defmethod inspect cam-free-bank ((obj cam-free-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tspeed: ~f~%" (-> obj speed)) + (format #t "~1Trot-speed: (deg ~r)~%" (-> obj rot-speed)) + (label cfg-4) + obj + ) + +;; definition for symbol *CAM_FREE-bank*, type cam-free-bank +(define *CAM_FREE-bank* (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6))) + +;; definition for function cam-mouse-input +(defun cam-mouse-input ((arg0 vector) (arg1 vector)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 (the-as vector (-> *mouse* pos)) (-> *mouse* pos 1)) + (cond + ((logtest? (-> *mouse* button0-abs 0) 1) + (let ((a0-7 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! a0-7 (-> *math-camera* trans) (-> *setting-control* cam-current mouse-tumble-point)) + (let ((f30-0 (vector-length a0-7))) + (cond + (#f + (let* ((f28-0 (* 0.01 f30-0 (-> v1-0 x))) + (f26-0 (* 0.01 f30-0 (-> v1-0 y))) + (f0-5 f28-0) + (f0-7 (* f0-5 f0-5)) + (f1-2 f26-0) + (f0-8 (+ f0-7 (* f1-2 f1-2))) + (f1-5 f30-0) + (f22-0 (- (sqrtf (+ f0-8 (* f1-5 f1-5))) f30-0)) + (f24-0 (atan f26-0 f30-0)) + (f0-12 (atan (- f28-0) f30-0)) + ) + (+! (-> arg1 x) f28-0) + (+! (-> arg1 y) f26-0) + (+! (-> arg1 z) f22-0) + (+! (-> arg0 x) f24-0) + (let ((f0-13 (+ (-> arg0 y) f0-12))) + (set! (-> arg0 y) f0-13) + f0-13 + ) + ) + ) + (else + (+! (-> arg0 y) (* (- (-> v1-0 x)) (-> *CAM_FREE-bank* rot-speed))) + (let ((f0-17 (+ (-> arg0 x) (* (-> v1-0 y) (-> *CAM_FREE-bank* rot-speed))))) + (set! (-> arg0 x) f0-17) + f0-17 + ) + ) + ) + ) + ) + ) + ((logtest? (-> *mouse* button0-abs 0) 2) + (+! (-> arg1 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) + (let ((f0-21 (+ (-> arg1 z) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))))) + (set! (-> arg1 z) f0-21) + f0-21 + ) + ) + ((logtest? (-> *mouse* button0-abs 0) 4) + (+! (-> arg1 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) + (let ((f0-25 (+ (-> arg1 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))))) + (set! (-> arg1 y) f0-25) + f0-25 + ) + ) + ) + ) + ) + +;; definition for function cam-free-floating-input +;; INFO: Return type mismatch uint vs vector. +(defun cam-free-floating-input ((arg0 vector) (arg1 vector) (arg2 symbol) (arg3 int)) + (with-pp + (the-as + vector + (when *camera* + (if (-> *setting-control* cam-current mouse-input) + (cam-mouse-input arg0 arg1) + ) + (let ((s3-0 (and (-> *setting-control* cam-current cpad1-skip-buttons) (= arg3 1)))) + (when (not s3-0) + (when (and (!= *master-mode* 'menu) (not *cam-layout*)) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 x) + (set! (-> arg0 x) + (- (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 6)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 triangle) + (+! (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 4)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 square) + (+! (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 7)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 circle) + (set! (-> arg0 y) + (- (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 5)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + ) + (when arg2 + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 l2) + (+! (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 10)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 r2) + (set! (-> arg0 z) + (- (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 11)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + ) + (when (nonzero? arg3) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 left) + (+! (-> arg1 x) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 1)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 right) + (set! (-> arg1 x) + (- (-> arg1 x) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 0)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 up) + (+! (-> arg1 z) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 2)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 down) + (set! (-> arg1 z) + (- (-> arg1 z) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 3)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + ) + ) + (cond + ((logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)) + ) + ((cpad-hold? arg3 r2) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 r1) + (+! (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 9)) + 0.0 + 32.0 + 230.0 + (* 0.2 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 l1) + (set! (-> arg1 y) + (- (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 8)) + 0.0 + 32.0 + 230.0 + (* 0.2 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + ) + ) + (else + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 r1) + (+! (-> arg1 y) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) + (if (cpad-hold? arg3 l1) + (set! (-> arg1 y) + (- (-> arg1 y) + (+ (-> *CAM_FREE-bank* speed) + (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + ) + ) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f28-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 leftx)) 128.0 48.0 110.0 -1.0)) + (f30-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 lefty)) 128.0 48.0 110.0 -1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) + (f0-60 (analog-input (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) + ) + (cond + ((and (not s3-0) (cpad-hold? arg3 r2)) + (cond + ((cpad-hold? arg3 l2) + (set! (-> arg0 y) (- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) + (set! (-> arg0 x) (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f0-60)))) + ) + (else + (set! (-> arg0 y) (- (-> arg0 y) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed)))) + (set! (-> arg0 x) (- (-> arg0 x) (* (- f0-60) (-> *CAM_FREE-bank* rot-speed)))) + ) + ) + (+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14)) + ) + ((and (not s3-0) (cpad-hold? arg3 l2)) + (+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed))) + (+! (-> arg1 y) (* f0-60 (-> *CAM_FREE-bank* speed))) + (+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed))) + ) + (else + (set! (-> arg0 y) (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) + (set! (-> arg0 x) (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f0-60)))) + (+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14)) + ) + ) + ) + ) + ) + (vector-float*! arg0 arg0 (-> pp clock time-adjust-ratio)) + (vector-float*! arg1 arg1 (-> pp clock time-adjust-ratio)) + ) + ) + ) + ) + +;; definition of type camera-free-floating-move-info +(deftype camera-free-floating-move-info (structure) + ((rv vector :inline :offset-assert 0) + (tv vector :inline :offset-assert 16) + (up vector :inline :offset-assert 32) + (tm matrix :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + +;; definition for method 3 of type camera-free-floating-move-info +(defmethod inspect camera-free-floating-move-info ((obj camera-free-floating-move-info)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'camera-free-floating-move-info) + (format #t "~1Trv: #~%" (-> obj rv)) + (format #t "~1Ttv: #~%" (-> obj tv)) + (format #t "~1Tup: #~%" (-> obj up)) + (format #t "~1Ttm: #~%" (-> obj tm)) + (label cfg-4) + obj + ) + +;; definition for function cam-free-floating-move +(defun cam-free-floating-move ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int)) + (if (logtest? (-> *cpad-list* cpads arg3 valid) 128) + (return (the-as vector #f)) + ) + (if (= *master-mode* 'menu) + (return (the-as vector #f)) + ) + (let ((s3-0 (new 'stack 'camera-free-floating-move-info))) + (cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3) + (cond + (arg2 + (matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y)) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (cond + ((< (vector-dot (-> arg0 vector 1) arg2) 0.0) + (forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2) + ) + (else + (vector-negate! (-> s3-0 up) arg2) + (forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up)) + ) + ) + ) + (else + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + ) + ) + (matrix-axis-angle! (-> s3-0 tm) (the-as vector (-> arg0 vector)) (- (-> s3-0 rv x))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0) + (vector+! arg1 arg1 (-> s3-0 tv)) + ) + ) + +;; failed to figure out what this is: +(defstate cam-free-floating (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + (send-event *camera-combiner* 'stop-tracking) + ) + (none) + ) + :code (behavior () + (until #f + (let ((a2-0 (-> *camera* local-down))) + (if (logtest? (-> self options) 8) + (set! a2-0 (the-as vector #f)) + ) + (cam-free-floating-move + (the-as matrix (-> self tracking)) + (-> self trans) + a2-0 + (the-as int (-> *CAMERA-bank* joypad)) + ) + ) + (suspend) + ) + #f + (none) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc new file mode 100644 index 0000000000..8f785d3f5c --- /dev/null +++ b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc @@ -0,0 +1,5575 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate cam-really-fixed (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (none) + ) + :code (behavior () + (until #f + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-fixed (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) + (when (!= (-> gp-0 w) 0.0) + (vector-normalize! gp-0 1.0) + (forward-down->inv-matrix (the-as matrix (-> self tracking)) gp-0 (-> *camera* local-down)) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-fixed-read-entity (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self trans) 'trans) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (cam-curve-setup (-> self trans)) + ((-> cam-fixed enter)) + ) + (else + (format #t "ERROR : cam-fixed-read-entity enter without entity~%") + ) + ) + (go cam-fixed) + (none) + ) + :code (behavior () + (until #f + (format *stdcon* "ERROR : stayed in cam-fixed-read-entity~%") + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-pov (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + ) + (none) + ) + :trans (behavior () + (when (not (handle->process (-> *camera* settings pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (vector<-cspace! (-> self trans) (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + ) + ) + (let* ((v1-6 (-> self tracking)) + (a3-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + transform + ) + ) + (a0-9 (-> a3-0 vector 0 quad)) + (a1-11 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-6 inv-mat vector 0 quad) a0-9) + (set! (-> v1-6 inv-mat vector 1 quad) a1-11) + (set! (-> v1-6 inv-mat vector 2 quad) a2-0) + (set! (-> v1-6 inv-mat trans quad) a3-1) + ) + (vector-reset! (-> self tracking inv-mat trans)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-matrix*! gp-0 (-> *camera* settings pov-offset) (the-as matrix (-> self tracking))) + (vector+! (-> self trans) (-> self trans) gp-0) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-pov180 (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + ) + (none) + ) + :trans (behavior () + (when (not (handle->process (-> *camera* settings pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 #t) + ) + (vector<-cspace! gp-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + ) + ) + (let ((v1-13 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + transform + ) + ) + ) + (vector-normalize-copy! s5-0 (-> v1-13 vector 2) 1.0) + ) + (until #f + (when (not (paused?)) + (let ((s0-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + transform + ) + ) + (s1-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + scale + ) + ) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector<-cspace! + s2-0 + (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + ) + ) + (vector-normalize-copy! s3-0 (-> s0-0 vector 2) 1.0) + (set! s4-0 + (cond + ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos 3640.889) (vector-dot s5-0 s3-0))) + (set! (-> self trans quad) (-> s2-0 quad)) + (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) + (set! (-> (the-as vector (&-> self stack 96)) quad) (-> s0-0 vector 1 quad)) + (vector-negate! (the-as vector (&-> self stack 112)) (-> s0-0 vector 2)) + (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) 1.0))) + (vector-float*! (the-as vector (-> self tracking)) (the-as vector (-> self tracking)) (/ 1.0 (-> s1-0 x))) + (vector-reset! (-> self tracking inv-mat trans)) + (if s4-0 + (set! s4-0 #f) + ) + s4-0 + ) + (else + #t + ) + ) + ) + (set! (-> gp-0 quad) (-> s2-0 quad)) + ) + (set! (-> s5-0 quad) (-> s3-0 quad)) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-pov-track (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + (none) + ) + :trans (behavior () + (if (or (not (handle->process (-> *camera* settings pov-handle))) (zero? (logand (-> *camera* master-options) 1))) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (set! (-> self fov) (-> *camera* settings fov)) + (vector<-cspace! (-> self trans) (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + ) + ) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((a2-0 (new 'stack-no-clear 'matrix))) + (let* ((v1-8 a2-0) + (t0-0 (-> (the-as pov-camera (-> *camera* settings pov-handle process 0)) + node-list + data + (-> *camera* settings pov-bone) + bone + transform + ) + ) + (a0-9 (-> t0-0 vector 0 quad)) + (a1-11 (-> t0-0 vector 1 quad)) + (a3-0 (-> t0-0 vector 2 quad)) + (t0-1 (-> t0-0 trans quad)) + ) + (set! (-> v1-8 vector 0 quad) a0-9) + (set! (-> v1-8 vector 1 quad) a1-11) + (set! (-> v1-8 vector 2 quad) a3-0) + (set! (-> v1-8 trans quad) t0-1) + ) + (vector-reset! (-> a2-0 trans)) + (vector-matrix*! gp-0 (-> *camera* settings pov-offset) a2-0) + ) + (vector+! (-> self trans) (-> self trans) gp-0) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; definition for function cam-standoff-calc-trans +(defbehavior cam-standoff-calc-trans camera-slave () + (if (-> self tracking no-follow) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (vector+! (-> self trans) (-> self tracking follow-pt) (-> self pivot-pt)) + ) + ) + +;; failed to figure out what this is: +(defstate cam-standoff (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'set-standoff-dist) + (vector-normalize! (-> self pivot-pt) (the-as float (-> arg3 param 0))) + (cam-standoff-calc-trans) + ) + ((= v1-0 'set-standoff-height) + (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) + (vector--float*! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + (the-as float (-> arg3 param 0)) + ) + (cam-standoff-calc-trans) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (vector-! (-> self pivot-pt) (-> self trans) (-> *camera* tpos-curr-adj)) + (cond + ((logtest? (-> self options) #x4000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (else + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + ) + ) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (cam-standoff-calc-trans) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-standoff-read-entity (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + ) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) s5-0 'align) + (vector-! (-> self pivot-pt) gp-0 s5-0) + ) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) + (if (logtest? (-> self options) #x4000) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (set! (-> self tracking tilt-adjust target) + (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) + ) + ) + ((-> cam-standoff enter)) + ) + (else + (format #t "ERROR : cam-standoff-read-entity enter without entity~%") + ) + ) + (go cam-standoff) + (none) + ) + :code (behavior () + (until #f + (format *stdcon* "ERROR : stayed in cam-standoff-read-entity~%") + (suspend) + ) + #f + (none) + ) + ) + +;; definition of type cam-eye-bank +(deftype cam-eye-bank (basic) + ((rot-speed float :offset-assert 4) + (max-degrees float :offset-assert 8) + (max-fov float :offset-assert 12) + (min-fov float :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type cam-eye-bank +(defmethod inspect cam-eye-bank ((obj cam-eye-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Trot-speed: ~f~%" (-> obj rot-speed)) + (format #t "~1Tmax-degrees: ~f~%" (-> obj max-degrees)) + (format #t "~1Tmax-fov: ~f~%" (-> obj max-fov)) + (format #t "~1Tmin-fov: ~f~%" (-> obj min-fov)) + (label cfg-4) + obj + ) + +;; definition for symbol *CAM_EYE-bank*, type cam-eye-bank +(define *CAM_EYE-bank* + (new 'static 'cam-eye-bank :rot-speed 364.0889 :max-degrees 12743.111 :max-fov 11650.845 :min-fov 6189.511) + ) + +;; failed to figure out what this is: +(defstate cam-eye (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (let ((v1-3 + (vector-float*! (new-stack-vector0) (-> *camera* local-down) (+ 1024.0 (-> *camera* settings target-height))) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) (the-as vector v1-3)) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (set! (-> self fov) 11650.845) + (none) + ) + :exit (behavior () + (if (and *target* + (logtest? (-> *camera* master-options) 1) + (logtest? (-> *target* focus-status) (focus-status fs8)) + ) + (send-event *target* 'end-mode) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (go cam-free-floating) + ) + (none) + ) + :code (behavior () + (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 (-> self clock frame-counter))) + (until #f + (when (not (paused?)) + (let ((s4-0 (vector-reset! (new-stack-vector0))) + (s5-0 (new-stack-matrix0)) + ) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f30-0 (analog-input + (the-as int (+ (-> *cpad-list* cpads 0 rightx) -256 (-> *cpad-list* cpads 0 leftx))) + 0.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f0-0 (analog-input + (the-as int (+ (-> *cpad-list* cpads 0 righty) -256 (-> *cpad-list* cpads 0 lefty))) + 0.0 + 48.0 + 110.0 + -1.0 + ) + ) + ) + (set! (-> s4-0 y) (- (-> s4-0 y) (* (- f30-0) (-> *CAM_EYE-bank* rot-speed)))) + (set! (-> s4-0 x) (- (-> s4-0 x) (* (- f0-0) (-> *CAM_EYE-bank* rot-speed)))) + ) + ) + (cond + ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 x)) + (set! (-> s4-0 x) (-> *CAM_EYE-bank* rot-speed)) + ) + ((< (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + (set! (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + ) + ) + (cond + ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 y)) + (set! (-> s4-0 y) (-> *CAM_EYE-bank* rot-speed)) + ) + ((< (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + (set! (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + ) + ) + (cond + ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) + (set! gp-0 (-> self clock frame-counter)) + ) + (else + (let ((v1-39 (min 10 (max 1 (- (-> self clock frame-counter) gp-0))))) + (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-39))) + ) + ) + ) + (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) + (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + (when (zero? (logand (-> self options) 8)) + (if (< (vector-dot (the-as vector (&-> self stack 96)) (-> *camera* local-down)) 0.0) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + (the-as vector (&-> self stack 112)) + (-> *camera* local-down) + ) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + (the-as vector (&-> self stack 112)) + (vector-negate! (new-stack-vector0) (-> *camera* local-down)) + ) + ) + ) + (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) + (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) + ) + (when (zero? (logand (-> self options) 8)) + (let ((f30-1 (vector-dot (-> *camera* local-down) (the-as vector (&-> self stack 112))))) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (when (< (sin (-> *CAM_EYE-bank* max-degrees)) (fabs f30-1)) + (vector--float*! + (the-as vector (&-> self stack 112)) + (the-as vector (&-> self stack 112)) + (-> *camera* local-down) + f30-1 + ) + (vector-normalize! (the-as vector (&-> self stack 112)) (cos (-> *CAM_EYE-bank* max-degrees))) + (cond + ((< f30-1 0.0) + (vector--float*! + (the-as vector (&-> self stack 112)) + (the-as vector (&-> self stack 112)) + (-> *camera* local-down) + (sin (-> *CAM_EYE-bank* max-degrees)) + ) + ) + (else + (let ((s5-3 (&-> self stack 112))) + (let ((s4-3 (&-> self stack 112)) + (s3-2 (-> *camera* local-down)) + (f0-30 (sin (-> *CAM_EYE-bank* max-degrees))) + ) + (.lvf vf2 (&-> s3-2 quad)) + (.lvf vf1 s4-3) + (let ((v1-67 f0-30)) + (.mov vf3 v1-67) + ) + ) + (.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 (the-as (pointer uint128) (&-> s5-3 0)) vf4) + ) + ) + ) + (vector-cross! + (the-as vector (&-> self stack 96)) + (the-as vector (&-> self stack 112)) + (the-as vector (-> self tracking)) + ) + (set! (-> self tracking inv-mat vector 1 w) 0.0) + ) + ) + ) + ) + (let ((v1-71 + (vector-float*! (new-stack-vector0) (-> *camera* local-down) (+ 1024.0 (-> *camera* settings target-height))) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) (the-as vector v1-71)) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + ) + +;; failed to figure out what this is: +(defstate cam-spline (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0))) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) + (if (logtest? (-> self options) #x4000) + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) + (set! (-> self tracking tilt-adjust target) + (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) + ) + ) + (cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans) + (cam-curve-setup gp-0) + ) + (vector-negate! (-> self saved-pt) (-> self spline-offset)) + (let ((a0-8 (res-lump-struct (-> self cam-entity) 'spline-offset structure))) + (if a0-8 + (vector+! (-> self spline-offset) (-> self spline-offset) (the-as vector a0-8)) + ) + ) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (set! (-> self spline-follow-dist) (cam-slave-get-float (-> self cam-entity) 'spline-follow-dist 0.0)) + (cond + ((< 0.0 (-> self spline-follow-dist)) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + ) + (curve-get-pos! s5-1 0.0 (-> self spline-curve)) + (curve-get-pos! gp-1 1.0 (-> self spline-curve)) + (if (< (vector-vector-distance-squared s5-1 (-> self tracking follow-pt)) + (vector-vector-distance-squared gp-1 (-> self tracking follow-pt)) + ) + (set! (-> self spline-follow-dist) (- (-> self spline-follow-dist))) + ) + ) + (set! (-> self spline-tt) (curve-closest-point + (-> self spline-curve) + (-> self tracking follow-pt) + 0.5 + -4096.0 + 10 + (-> self spline-follow-dist) + ) + ) + ) + (else + (set! (-> self spline-follow-dist) 0.0) + ) + ) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + (cond + ((logtest? (-> self options) #x4000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (else + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + ) + ) + (else + (format #t "ERROR : cam-spline enter without entity~%") + ) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (new 'stack 'curve) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-decel (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (when (!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! s5-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve)) + (+! (-> *camera* outro-t) (* (-> *camera* outro-t-step) (-> self clock time-adjust-ratio))) + (curve-get-pos! gp-0 (parameter-ease-sin-clamp (-> *camera* outro-t)) (-> *camera* outro-curve)) + (vector-! gp-0 gp-0 s5-0) + (cond + ((or (and (< (-> *camera* outro-t-step) 0.0) (>= (-> *camera* outro-exit-value) (-> *camera* outro-t))) + (and (< 0.0 (-> *camera* outro-t-step)) (>= (-> *camera* outro-t) (-> *camera* outro-exit-value))) + ) + (set! (-> *camera* outro-t) (-> *camera* outro-exit-value)) + (set! (-> *camera* outro-t-step) 0.0) + (vector+! (-> self velocity) (-> self velocity) gp-0) + (send-event *camera* 'outro-done) + ) + (else + (vector+! (-> self trans) (-> self trans) gp-0) + ) + ) + ) + ) + (vector-float*! (-> self velocity) (-> self velocity) 0.9) + (vector+! (-> self trans) (-> self trans) (-> self velocity)) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-endlessfall (camera-slave) + :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'teleport) + #f + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'cam-vector-seeker)) + (f30-0 (-> self velocity y)) + ) + (let ((a1-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-0 quad) (-> self trans quad)) + (set! (-> a1-0 y) 0.0) + (set! (-> s5-0 quad) (-> self velocity quad)) + (set! (-> s5-0 y) 0.0) + (init gp-0 a1-0 81.92 (fmax 819.2 (vector-length s5-0)) 0.75) + (set! (-> gp-0 vel quad) (-> s5-0 quad)) + ) + (until #f + (when (not (paused?)) + (set! (-> gp-0 target x) (-> (target-pos 0) x)) + (set! (-> gp-0 target z) (-> (target-pos 0) z)) + (update! gp-0 (the-as vector #f)) + (when (< 819.2 (-> gp-0 max-vel)) + (set! (-> gp-0 max-vel) (* 0.9 (-> gp-0 max-vel))) + (if (< (-> gp-0 max-vel) 819.2) + (set! (-> gp-0 max-vel) 819.2) + ) + ) + (set! f30-0 (* 0.9 f30-0)) + (+! (-> self trans y) f30-0) + (set! (-> self trans x) (-> gp-0 value x)) + (set! (-> self trans z) (-> gp-0 value z)) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + +;; definition for function cam-circular-position-into-max-angle +;; INFO: Used lq/sq +(defbehavior cam-circular-position-into-max-angle camera-slave ((arg0 vector) (arg1 vector) (arg2 float)) + (let* ((f30-0 (vector-normalize-ret-len! arg0 1.0)) + (f26-0 (vector-normalize-ret-len! arg1 1.0)) + (f0-1 (vector-dot arg0 arg1)) + (f28-0 (acos f0-1)) + (s4-0 (new 'stack-no-clear 'matrix)) + ) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f24-0 (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + 128.0 + 32.0 + 110.0 + (* 8192.0 (-> self clock seconds-per-frame)) + ) + ) + (f1-2 (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + 128.0 + 32.0 + 110.0 + (* 8192.0 (-> self clock seconds-per-frame)) + ) + ) + (s2-0 (new-stack-matrix0)) + ) + (let ((v1-15 (new 'stack-no-clear 'vector))) + 0.0 + (when (< (-> self max-angle-offset) 1820.4445) + (set! f24-0 0.0) + (set! f1-2 0.0) + ) + (if (< (-> self pivot-rad) f30-0) + (set! f24-0 (- f24-0)) + ) + (vector-cross! v1-15 arg1 arg0) + (let ((f0-10 (vector-dot v1-15 (-> *camera* local-down)))) + (if (< f1-2 0.0) + (set! f1-2 (fmax f1-2 (* -0.15 f28-0))) + ) + (if (< f0-10 0.0) + (set! f1-2 (- f1-2)) + ) + (let* ((f1-3 (+ f24-0 f1-2)) + (f1-5 + (fmin (* 8192.0 (-> self clock seconds-per-frame)) (fmax (* -8192.0 (-> self clock seconds-per-frame)) f1-3)) + ) + ) + (cond + ((and (< 0.0 f1-5) (< 0.0 f0-10) (< (-> self max-angle-curr) f28-0)) + (set! f1-5 0.0) + ) + ((and (< 0.0 f1-5) (< 0.0 f0-10)) + (set! f1-5 (fmin f1-5 (* 0.15 (- (-> self max-angle-curr) f28-0)))) + ) + ((and (< f1-5 0.0) (< f0-10 0.0) (< (-> self max-angle-curr) f28-0)) + (set! f1-5 0.0) + ) + ((and (< f1-5 0.0) (< f0-10 0.0)) + (set! f1-5 (fmax f1-5 (* 0.15 (- f28-0 (-> self max-angle-curr))))) + ) + ) + (matrix-axis-angle! s2-0 (-> *camera* local-down) f1-5) + ) + ) + ) + (vector-matrix*! arg1 arg1 s2-0) + ) + (let ((f0-16 (vector-dot arg0 arg1))) + (set! f28-0 (acos f0-16)) + ) + ) + (cond + ((< (-> self max-angle-curr) f28-0) + (matrix-from-two-vectors-max-angle! + s4-0 + arg1 + arg0 + (* (fmin 1.0 (* arg2 (-> self clock time-adjust-ratio))) (- f28-0 (-> self max-angle-curr))) + ) + (vector-matrix*! arg0 arg1 s4-0) + ) + ((and (logtest? (-> self options) 2) + (or (and (>= f26-0 (+ -8192.0 f30-0)) (>= f30-0 (+ -8192.0 (-> self pivot-rad)))) + (and (>= (+ 8192.0 f30-0) f26-0) (>= (+ 8192.0 (-> self pivot-rad)) f30-0)) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (vector-cross! s2-1 arg1 arg0) + (vector-normalize! s2-1 1.0) + (matrix-axis-angle! + s4-0 + s2-1 + (* (fmin 1.0 (* arg2 (-> self clock time-adjust-ratio))) (- (-> self max-angle-curr) f28-0)) + ) + ) + (vector-matrix*! arg0 arg1 s4-0) + ) + (else + (set! (-> arg0 quad) (-> arg1 quad)) + (if (logtest? (-> self options) 2048) + (set! (-> self max-angle-curr) f28-0) + ) + ) + ) + ) + (vector-normalize! arg0 (-> self pivot-rad)) + ) + +;; definition for function cam-circular-position +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function cam-circular-code +;; INFO: Used lq/sq +;; ERROR: failed type prop at 56: Called a function, but we do not know its type +;; INFO: Return type mismatch none vs float. +(defbehavior cam-circular-code camera-slave () + (local-vars + (v0-0 vector) + (v0-1 vector) + (v0-2 none) + (v0-3 none) + (v0-4 none) + (v0-5 none) + (v0-6 none) + (v0-7 none) + (v1-0 vector) + (v1-1 none) + (v1-2 vector) + (v1-3 vector) + (v1-4 uint) + (v1-5 uint) + (v1-6 int) + (v1-7 clock) + (v1-9 none) + (v1-10 none) + (v1-11 none) + (v1-13 vector) + (v1-14 none) + (v1-15 none) + (a0-0 vector) + (a0-1 uint128) + (a0-2 vector) + (a0-3 camera-master) + (a0-4 vector) + (a0-5 vector) + (a0-6 vector) + (a0-7 none) + (a0-8 vector) + (a0-9 symbol) + (a0-10 none) + (a1-0 symbol) + (a1-1 vector) + (a1-2 vector) + (a1-3 vector) + (a1-4 vector) + (a1-5 none) + (a1-6 vector) + (a1-7 vector) + (a1-8 none) + (a2-0 symbol) + (a2-1 none) + (a3-0 symbol) + (a3-1 symbol) + (a3-2 none) + (t0-0 float) + (s3-0 none) + (t9-0 (function vector vector curve symbol vector :behavior camera-slave)) + (t9-1 (function vector vector vector vector float vector)) + (t9-2 none) + (t9-3 function) + (t9-4 none) + (t9-5 none) + (t9-6 none) + (gp-0 none) + (f0-0 float) + (f0-1 float) + (f0-2 none) + (f0-3 none) + (f0-4 none) + (f0-5 none) + (f0-6 none) + (f0-7 none) + (f1-0 float) + (f1-1 none) + (f1-2 none) + ) + (when (begin + (cond + ((begin + (set! v1-0 (-> s6-0 pivot-pt)) + (set! a0-0 (-> s6-0 saved-pt)) + (set! a0-1 (-> a0-0 quad)) + (set! (-> v1-0 quad) a0-1) + (set! t9-0 cam-curve-pos) + (set! a0-2 (-> s6-0 pivot-pt)) + (set! a1-0 #f) + (set! a2-0 #f) + (set! a3-0 #f) + (call! a0-2 a1-0 a2-0 a3-0) + (set! a2-1 (the-as none (new 'stack-no-clear 'vector))) + (s.q! a2-1 0) + (set! v1-1 (the-as none a2-1)) + (set! a0-3 *camera*) + (set! a0-4 (-> a0-3 tpos-curr-adj)) + (set! a1-1 (-> s6-0 pivot-pt)) + (set! v1-2 (vector-!2 v1-1 a0-4 a1-1)) + (set! a1-2 (-> s6-0 circular-follow)) + (set! v1-3 (-> s6-0 circular-follow)) + (set! a0-5 (-> s6-0 pivot-pt)) + (set! a1-3 (vector-!2 a1-2 v1-3 a0-5)) + (set! v1-4 (-> s6-0 options)) + (set! v1-5 (logand v1-4 4)) + (nonzero? v1-5) + ) + (set! t9-1 v-slrp3!) + (set! a0-6 (-> s6-0 circular-follow)) + (set! a1-4 (-> s6-0 circular-follow)) + (set! a3-1 #f) + (set! v1-6 #x43360b61) + (set! f0-0 (the-as float (gpr->fpr v1-6))) + (set! v1-7 (-> s6-0 clock)) + (set! f1-0 (-> v1-7 time-adjust-ratio)) + (set! f0-1 (*.s f0-0 f1-0)) + (set! t0-0 (fpr->gpr f0-1)) + (call! a0-6 a1-4 a2-1 a3-1 t0-0) + (set! v1-8 v0-1) + ) + (else + (set! t9-2 (the-as none v-slrp3!)) + (set! a0-7 (the-as none (-> s6-0 circular-follow))) + (set! a1-5 (the-as none (-> s6-0 circular-follow))) + (set! v1-9 (the-as none *camera*)) + (set! a3-2 (the-as none (+ v1-9 284))) + (set! v1-10 (the-as none #x43360b61)) + (set! f0-2 (the-as none (gpr->fpr v1-10))) + (set! v1-11 (the-as none (-> s6-0 clock))) + (set! f1-1 (the-as none (l.f (+ v1-11 84)))) + (set! f0-3 (the-as none (*.s f0-2 f1-1))) + (set! t0-1 (the-as none (fpr->gpr f0-3))) + (call!) + (set! v1-12 (the-as none v0-2)) + ) + ) + (set! a1-6 (-> s6-0 circular-follow)) + (set! v1-13 (-> s6-0 circular-follow)) + (set! a0-8 (-> s6-0 pivot-pt)) + (set! a1-7 (vector+!2 a1-6 v1-13 a0-8)) + (set! t9-3 cam-circular-position) + (set! a0-9 #t) + (call!) + (set! f0-4 (the-as none (-> s6-0 fov1))) + (set! f1-2 (the-as none 0)) + (!=.s f0-4 f1-2) + ) + (set! gp-0 (the-as none lerp-clamp)) + (set! f0-5 (the-as none (l.f (+ s6-0 144)))) + (set! s5-0 (the-as none (fpr->gpr f0-5))) + (set! f0-6 (the-as none (l.f (+ s6-0 148)))) + (set! s4-0 (the-as none (fpr->gpr f0-6))) + (set! s3-0 (the-as none parameter-ease-sin-clamp)) + (set! a0-10 (the-as none (+ s6-0 156))) + (set! v1-14 (the-as none cam-index)) + (set! t9-4 (the-as none (l.wu (+ v1-14 56)))) + (set! v1-15 (the-as none *camera*)) + (set! a1-8 (the-as none (+ v1-15 524))) + (call!) + (set! a0-11 (the-as none v0-5)) + (set! t9-5 (the-as none s3-0)) + (call!) + (set! a2-2 (the-as none v0-6)) + (set! t9-6 (the-as none gp-0)) + (set! a0-12 (the-as none s5-0)) + (set! a1-9 (the-as none s4-0)) + (set! v0-7 (the-as none (call!))) + (set! f0-7 (the-as none (gpr->fpr v0-7))) + (s.f! (+ s6-0 140) f0-7) + (set! v0-4 (the-as none (fpr->gpr f0-7))) + ) + (ret-value v0-4) + ) + +;; failed to figure out what this is: +(defstate cam-circular (camera-slave) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (if (not (paused?)) + (cam-circular-code) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-lookat (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (suspend) + ) + #f + (none) + ) + ) + +;; definition of type cam-string-bank +(deftype cam-string-bank (basic) + ((los-coll-rad meters :offset-assert 4) + (los-coll-rad2 meters :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type cam-string-bank +(defmethod inspect cam-string-bank ((obj cam-string-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tlos-coll-rad: (meters ~m)~%" (-> obj los-coll-rad)) + (format #t "~1Tlos-coll-rad2: (meters ~m)~%" (-> obj los-coll-rad2)) + (label cfg-4) + obj + ) + +;; definition for symbol *CAM_STRING-bank*, type cam-string-bank +(define *CAM_STRING-bank* (new 'static 'cam-string-bank :los-coll-rad (meters 1) :los-coll-rad2 (meters 0.5))) + +;; definition for function cam-string-find-position-rel! +;; INFO: Used lq/sq +;; 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)) + (f30-0 0.0) + (s2-0 (new 'stack-no-clear 'matrix)) + ) + (let ((s1-0 s3-0)) + (set! (-> s1-0 radius) 409.6) + (set! (-> s1-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + (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) + (set! (-> s5-0 z) (+ 1024.0 (-> *CAMERA-bank* default-string-min-z))) + ) + (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) + ) + ) + (set! f30-0 (cond + ((>= -32768.0 f30-0) + (format #t "cam-string didn't find a spot~%") + (set! (-> arg0 quad) (-> s5-0 quad)) + (return #f) + f30-0 + ) + ((< 0.0 f30-0) + (- f30-0) + ) + (else + (- 5461.3335 f30-0) + ) + ) + ) + (matrix-axis-angle! s2-0 (-> *camera* local-down) f30-0) + (vector-matrix*! arg0 s5-0 s2-0) + ) + ) + #f + ) + +;; definition for function cam-string-set-position-rel! +;; INFO: Used lq/sq +;; INFO: 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))) + (vector+! (-> self desired-pos) arg0 (-> *camera* tpos-curr-adj)) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (tracking-spline-method-10 (-> self position-spline) (-> self desired-pos)) + (vector-reset! (-> self velocity)) + (let ((v0-2 (logand -4097 (-> self options)))) + (set! (-> self options) v0-2) + (the-as cam-slave-options v0-2) + ) + ) + +;; definition for function string-push-help +(defun string-push-help () + 409.6 + ) + +;; definition (debug) for function cam-draw-collide-cache +;; INFO: 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)) + (let ((t1-0 #x40000080)) + (add-debug-flat-triangle + #t + (bucket-id bucket-318) + (the-as vector (-> (the-as (inline-array collide-cache-tri) gp-0) 0)) + (-> (the-as (inline-array collide-cache-tri) gp-0) 0 vertex 1) + (-> (the-as (inline-array collide-cache-tri) gp-0) 0 vertex 2) + (the-as rgba t1-0) + ) + ) + (set! gp-0 (-> (the-as (inline-array collide-cache-tri) gp-0) 1)) + ) + ) + 0 + (none) + ) + +;; definition of type los-dist +(deftype los-dist (structure) + ((par-dist float :offset-assert 0) + (lat-dist float :offset-assert 4) + (vert-dist float :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type los-dist +(defmethod inspect los-dist ((obj los-dist)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'los-dist) + (format #t "~1Tpar-dist: ~f~%" (-> obj par-dist)) + (format #t "~1Tlat-dist: ~f~%" (-> obj lat-dist)) + (format #t "~1Tvert-dist: ~f~%" (-> obj vert-dist)) + (label cfg-4) + obj + ) + +;; definition of type collide-los-dist-info +(deftype collide-los-dist-info (structure) + ((min-par float :offset-assert 0) + (max-par float :offset-assert 4) + (min-lat float :offset-assert 8) + (max-lat float :offset-assert 12) + (min-vp float :offset-assert 16) + (max-vp float :offset-assert 20) + (min-vn float :offset-assert 24) + (max-vn float :offset-assert 28) + (count int32 :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x24 + :flag-assert #x900000024 + ) + +;; definition for method 3 of type collide-los-dist-info +(defmethod inspect collide-los-dist-info ((obj collide-los-dist-info)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'collide-los-dist-info) + (format #t "~1Tmin-par: ~f~%" (-> obj min-par)) + (format #t "~1Tmax-par: ~f~%" (-> obj max-par)) + (format #t "~1Tmin-lat: ~f~%" (-> obj min-lat)) + (format #t "~1Tmax-lat: ~f~%" (-> obj max-lat)) + (format #t "~1Tmin-vp: ~f~%" (-> obj min-vp)) + (format #t "~1Tmax-vp: ~f~%" (-> obj max-vp)) + (format #t "~1Tmin-vn: ~f~%" (-> obj min-vn)) + (format #t "~1Tmax-vn: ~f~%" (-> obj max-vn)) + (format #t "~1Tcount: ~D~%" (-> obj count)) + (label cfg-4) + obj + ) + +;; definition for function dist-info-init +;; INFO: 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) + (set! (-> arg0 count) 0) + 0 + (none) + ) + +;; definition for function dist-info-valid? +(defun dist-info-valid? ((arg0 collide-los-dist-info)) + (>= (-> arg0 max-par) (-> arg0 min-par)) + ) + +;; definition for function dist-info-append +;; INFO: Return type mismatch int vs none. +(defun dist-info-append ((arg0 collide-los-dist-info) (arg1 vector)) + (cond + ((dist-info-valid? arg0) + (if (< (-> arg1 x) (-> arg0 min-par)) + (set! (-> arg0 min-par) (-> arg1 x)) + ) + (if (< (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + ) + (if (< (-> arg1 y) (-> arg0 min-lat)) + (set! (-> arg0 min-lat) (-> arg1 y)) + ) + (if (< (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + ) + (cond + ((< (-> arg1 y) 0.0) + (if (< (-> arg1 z) (-> arg0 min-vn)) + (set! (-> arg0 min-vn) (-> arg1 z)) + ) + (if (< (-> arg0 max-vn) (-> arg1 z)) + (set! (-> arg0 max-vn) (-> arg1 z)) + ) + ) + (else + (if (< (-> arg1 z) (-> arg0 min-vp)) + (set! (-> arg0 min-vp) (-> arg1 z)) + ) + (if (< (-> arg0 max-vp) (-> arg1 z)) + (set! (-> arg0 max-vp) (-> arg1 z)) + ) + ) + ) + ) + (else + (set! (-> arg0 min-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 min-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 min-vp) 0.0) + (set! (-> arg0 max-vp) 0.0) + (set! (-> arg0 min-vn) 0.0) + (set! (-> arg0 max-vn) 0.0) + (cond + ((< (-> arg1 y) 0.0) + (set! (-> arg0 min-vn) (-> arg1 z)) + (set! (-> arg0 max-vn) (-> arg1 z)) + ) + (else + (set! (-> arg0 min-vp) (-> arg1 z)) + (set! (-> arg0 max-vp) (-> arg1 z)) + ) + ) + ) + ) + (+! (-> arg0 count) 1) + (none) + ) + +;; definition for function dist-info-print +(defun dist-info-print ((arg0 collide-los-dist-info) (arg1 string)) + (cond + ((dist-info-valid? arg0) + (format + *stdcon* + "~S ~2,D mn ~,,2M mx ~,,2M mnl ~,,2M mxl ~,,2M~%" + arg1 + (-> arg0 count) + (-> arg0 min-par) + (-> arg0 max-par) + (-> arg0 min-lat) + (-> arg0 max-lat) + ) + (format + *stdcon* + " mnvp ~,,2M mxvp ~,,2M mnvn ~,,2M mxvn ~,,2M~%" + (-> arg0 min-vp) + (-> arg0 max-vp) + (-> arg0 min-vn) + (-> arg0 max-vn) + ) + ) + (else + (format *stdcon* "~S invalid~%" arg1) + ) + ) + ) + +;; definition of type collide-los-result +(deftype collide-los-result (structure) + ((lateral vector :inline :offset-assert 0) + (cw collide-los-dist-info :inline :offset-assert 16) + (ccw collide-los-dist-info :inline :offset-assert 64) + (straddle collide-los-dist-info :inline :offset-assert 112) + (lateral-valid symbol :offset-assert 148) + ) + :method-count-assert 9 + :size-assert #x98 + :flag-assert #x900000098 + ) + +;; definition for method 3 of type collide-los-result +(defmethod inspect collide-los-result ((obj collide-los-result)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'collide-los-result) + (format #t "~1Tlateral: ~`vector`P~%" (-> obj lateral)) + (format #t "~1Tcw: #~%" (-> obj cw)) + (format #t "~1Tccw: #~%" (-> obj ccw)) + (format #t "~1Tstraddle: #~%" (-> obj straddle)) + (format #t "~1Tlateral-valid: ~A~%" (-> obj lateral-valid)) + (label cfg-4) + obj + ) + +;; definition for function los-cw-ccw +;; INFO: Used lq/sq +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +(defun los-cw-ccw ((arg0 (inline-array collide-cache-tri)) + (arg1 vector) + (arg2 vector) + (arg3 float) + (arg4 collide-los-result) + (arg5 vector) + (arg6 float) + ) + (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) + (with-pp + (set! sv-128 arg3) + (let ((gp-0 arg4)) + (set! sv-144 arg5) + (let ((s4-0 arg6)) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((f30-0 0.0) + (s0-0 #f) + ) + (set! sv-208 0) + (while (< sv-208 4) + (cond + ((= sv-208 3) + (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 432))) + (set! (-> s5-0 vector sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) + (vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 432))) + ) + ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 432))) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (set! sv-208 (+ sv-208 1)) + ) + (cond + ((and s0-0 (!= s4-0 -859915232)) + (dotimes (s4-1 4) + (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) + ) + #f + ) + ((< (-> s5-0 trans y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) + (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) + ) + ) + #f + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function cam-los-spline-collide +;; INFO: Used lq/sq +(defun cam-los-spline-collide ((arg0 vector) (arg1 vector) (arg2 pat-surface)) + (let ((s5-0 (new 'stack-no-clear 'collide-query)) + (s4-0 *collide-cache*) + (f30-0 2.0) + ) + 0.0 + (set! (-> s5-0 start-pos quad) (-> arg0 quad)) + (vector-! (-> s5-0 move-dist) arg1 arg0) + (let ((v1-4 s5-0)) + (set! (-> v1-4 radius) (-> *CAM_STRING-bank* los-coll-rad2)) + (set! (-> v1-4 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + ((method-of-object s4-0 collide-cache-method-13)) + (let* ((f0-2 (vector-length (-> s5-0 move-dist))) + (f28-0 + (cond + ((< f0-2 (-> *CAMERA-bank* min-detectable-velocity)) + 0.0 + ) + (else + (let* ((f0-3 (/ (* 3.0 (- (-> *CAM_STRING-bank* los-coll-rad2) (-> *CAMERA-bank* collide-move-rad))) f0-2)) + (f0-4 (- 1.0 f0-3)) + ) + (fmin 1.0 (fmax 0.0 f0-4)) + ) + ) + ) + ) + (s3-0 (the-as object (-> s4-0 tris))) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (countdown (s4-1 (-> s4-0 num-tris)) + (let ((f0-7 (moving-sphere-triangle-intersect + arg0 + (-> s5-0 move-dist) + (-> *CAM_STRING-bank* los-coll-rad2) + (-> (the-as (inline-array collide-cache-tri) s3-0) 0) + s2-0 + s1-0 + ) + ) + ) + (cond + ((or (< f0-7 0.0) (< f28-0 f0-7)) + ) + ((< f0-7 f30-0) + (set! f30-0 f0-7) + ) + ) + ) + (set! s3-0 (-> (the-as (inline-array collide-cache-tri) s3-0) 1)) + ) + ) + (if (= f30-0 #x40000000) + (set! f30-0 -1.0) + ) + f30-0 + ) + ) + +;; definition for function cam-los-setup-lateral +(defbehavior cam-los-setup-lateral camera-slave ((arg0 collide-los-result) (arg1 vector) (arg2 vector)) + (cond + ((dist-info-valid? (-> arg0 straddle)) + (let ((f30-0 (-> arg0 straddle min-lat)) + (f28-0 (-> arg0 straddle max-lat)) + ) + (if (dist-info-valid? (-> arg0 cw)) + (set! f28-0 (fmax f28-0 (-> arg0 cw max-lat))) + ) + (if (dist-info-valid? (-> arg0 ccw)) + (set! f30-0 (fmin f30-0 (- (-> arg0 ccw max-lat)))) + ) + (cond + ((= (-> self los-state) (slave-los-state ccw)) + (if *display-cam-los-debug* + (format *stdcon* "straddle stick ccw~%") + ) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((= (-> self los-state) (slave-los-state cw)) + (if *display-cam-los-debug* + (format *stdcon* "straddle stick cw~%") + ) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and (or (< 0.01 (-> arg0 straddle max-vp)) (and (dist-info-valid? (-> arg0 ccw)) (< 0.01 (-> arg0 ccw max-vp)))) + (or (< (-> arg0 straddle min-vp) -0.01) (and (dist-info-valid? (-> arg0 ccw)) (< (-> arg0 ccw min-vp) -0.01))) + (and (dist-info-valid? (-> arg0 cw)) (or (< (-> arg0 cw max-vp) 0.01) (< -0.01 (-> arg0 cw min-vp)))) + ) + (when (not (dist-info-valid? (-> arg0 ccw))) + ) + (if (not (dist-info-valid? (-> arg0 cw))) + (format #t "s diag ccw invalid cw~%") + ) + (if *display-cam-los-debug* + (format *stdcon* "straddle diagonal ccw~%") + ) + (set! (-> self los-state) (slave-los-state ccw)) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and (or (< 0.01 (-> arg0 straddle max-vn)) (and (dist-info-valid? (-> arg0 cw)) (< 0.01 (-> arg0 cw max-vp)))) + (or (< (-> arg0 straddle min-vn) -0.01) (and (dist-info-valid? (-> arg0 cw)) (< (-> arg0 cw min-vp) -0.01))) + (and (dist-info-valid? (-> arg0 ccw)) (or (< (-> arg0 ccw max-vp) 0.01) (< -0.01 (-> arg0 ccw min-vp)))) + ) + (if (not (dist-info-valid? (-> arg0 ccw))) + (format #t "s diag cw invalid ccw~%") + ) + (when (not (dist-info-valid? (-> arg0 cw))) + ) + (if *display-cam-los-debug* + (format *stdcon* "straddle diagonal cw~%") + ) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((< f28-0 (- f30-0)) + (if *display-cam-los-debug* + (format *stdcon* "straddle ccw~%") + ) + (set! (-> self los-state) (slave-los-state ccw)) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + (else + (if *display-cam-los-debug* + (format *stdcon* "straddle cw~%") + ) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ) + ) + ) + ((and (dist-info-valid? (-> arg0 cw)) + (dist-info-valid? (-> arg0 ccw)) + (< 0.01 (-> arg0 ccw max-vp)) + (< (-> arg0 ccw min-vp) -0.01) + (or (< (-> arg0 cw max-vp) 0.01) (< -0.01 (-> arg0 cw min-vp))) + ) + (if *display-cam-los-debug* + (format *stdcon* "diagonal ccw~%") + ) + (set! (-> self los-state) (slave-los-state ccw)) + (vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 ccw min-lat))) + ) + ((and (dist-info-valid? (-> arg0 cw)) + (dist-info-valid? (-> arg0 ccw)) + (< 0.01 (-> arg0 cw max-vp)) + (< (-> arg0 cw min-vp) -0.01) + (or (< (-> arg0 ccw max-vp) 0.01) (< -0.01 (-> arg0 ccw min-vp))) + ) + (if *display-cam-los-debug* + (format *stdcon* "diagonal cw~%") + ) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- (-> arg0 cw min-lat) (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and (dist-info-valid? (-> arg0 cw)) (dist-info-valid? (-> arg0 ccw))) + (set! (-> self los-state) (slave-los-state between)) + (vector-normalize! arg1 0.0001) + ) + ((dist-info-valid? (-> arg0 cw)) + (if *display-cam-los-debug* + (format *stdcon* "regular cw~%") + ) + (set! (-> self los-state) (slave-los-state cw)) + (vector-normalize! arg1 (- (-> arg0 cw min-lat) (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((dist-info-valid? (-> arg0 ccw)) + (if *display-cam-los-debug* + (format *stdcon* "regular ccw~%") + ) + (set! (-> self los-state) (slave-los-state ccw)) + (vector-normalize! arg1 (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 ccw min-lat))) + ) + (else + (set! (-> self los-state) (slave-los-state none)) + (vector-reset! arg1) + ) + ) + (cond + ((= (vector-length arg1) 0.0) + (set! (-> arg0 lateral-valid) #f) + #f + ) + (else + (vector-! (-> arg0 lateral) arg1 arg2) + (vector-normalize! (-> arg0 lateral) 1.0) + (let ((v0-44 #t)) + (set! (-> arg0 lateral-valid) v0-44) + v0-44 + ) + ) + ) + ) + +;; definition for function cam-los-collide +;; INFO: Used lq/sq +;; INFO: 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] +(defbehavior cam-los-collide camera-slave ((arg0 vector) (arg1 vector) (arg2 collide-los-result) (arg3 pat-surface)) + (local-vars + (s1-3 int) + (s2-2 int) + (f2-1 float) + (sv-768 pat-surface) + (sv-784 vector) + (sv-800 vector) + (sv-816 int) + (sv-832 vector) + ) + (set! sv-768 arg3) + (dist-info-init (-> arg2 cw)) + (dist-info-init (-> arg2 ccw)) + (dist-info-init (-> arg2 straddle)) + (let ((s1-0 (new 'stack-no-clear 'collide-query)) + (s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize-copy! s2-0 arg1 1.0) + (vector-flatten! s4-0 arg1 (-> *camera* local-down)) + (let ((s0-0 *collide-cache*) + (f26-0 (vector-length arg1)) + (f30-0 (vector-normalize-ret-len! s4-0 1.0)) + ) + (set! (-> s1-0 start-pos quad) (-> arg0 quad)) + (set! (-> s1-0 move-dist quad) (-> arg1 quad)) + (let ((v1-5 s1-0)) + (set! (-> v1-5 radius) (-> *CAM_STRING-bank* los-coll-rad)) + (set! (-> v1-5 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + ((method-of-object s0-0 collide-cache-method-13)) + (let ((s1-1 (the-as object (-> s0-0 tris))) + (f28-0 (/ 2048.0 f26-0)) + (f26-1 (/ (+ -8192.0 f26-0) f26-0)) + ) + (if (< f26-1 0.0) + (set! f26-1 0.0) + ) + (if (< 1.0 f28-0) + (set! f28-0 1.0) + ) + (countdown (s0-1 (-> s0-0 num-tris)) + (set! sv-800 (new 'stack-no-clear 'vector)) + (set! sv-784 (new 'stack-no-clear 'vector)) + (let ((f0-7 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) + sv-800 + sv-784 + ) + ) + ) + (cond + ((or (< f0-7 0.0) (< 1.0 f0-7)) + ) + ((let ((f1-2 0.0)) + (let* ((v1-23 arg1) + (f2-0 (-> v1-23 x)) + (f3-0 (-> v1-23 y)) + (f4-0 (-> v1-23 z)) + (f5-0 (-> sv-784 x)) + (f6-0 (-> sv-784 y)) + (f7-0 (-> sv-784 z)) + ) + (.mula.s f2-0 f5-0) + (.madda.s f3-0 f6-0) + (.madd.s f2-1 f4-0 f7-0) + ) + (< f1-2 f2-1) + ) + (when (< f28-0 f0-7) + (let* ((t1-1 (new 'stack-no-clear 'vector)) + (t0-1 (new 'stack-no-clear 'vector)) + (f24-0 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) + t0-1 + t1-1 + ) + ) + ) + (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-0) + (when *debug-segment* + (cond + ((= f24-0 -859915232) + (let ((t9-10 cam-debug-add-los-tri) + (a0-20 s1-1) + (a2-6 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) + ) + (t9-10 (the-as (inline-array collide-cache-tri) a0-20) sv-800 a2-6) + ) + ) + (else + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)) + ) + ) + ) + ) + ) + ) + ) + ((< f0-7 f26-1) + (let* ((t1-3 (new 'stack-no-clear 'vector)) + (t0-3 (new 'stack-no-clear 'vector)) + (f24-1 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) + t0-3 + t1-3 + ) + ) + ) + (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-1) + (when *debug-segment* + (if (= f24-1 -859915232) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80)) + ) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80)) + ) + ) + ) + ) + ) + ) + ) + (set! s1-1 (-> (the-as (inline-array collide-cache-tri) s1-1) 1)) + ) + ) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'vector))) + 0.0 + (vector-cross! s4-1 arg1 (-> *camera* local-down)) + (cond + ((!= (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (when *display-cam-los-debug* + (format *stdcon* "emergency point jump~%") + (format 0 "emergency point jump~%") + ) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline used-point)) + (set! (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (logior! (-> self options) 4096) + (set! (-> self good-point quad) + (-> *camera* target-spline point (-> *camera* target-spline used-point) position quad) + ) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *debug-segment* + (let ((a1-22 (new 'stack-no-clear 'vector))) + (vector-! a1-22 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-22 -3 'jump self) + ) + ) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (set! (-> self string-trans quad) (-> self good-point quad)) + (vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) + (vector-reset! (-> self velocity)) + (let ((f0-11 (vector-length (-> self view-flat)))) + (if (< f0-11 (-> self min-z-override)) + (set! (-> self min-z-override) f0-11) + ) + ) + ) + (else + (let ((f30-1 + (cam-los-spline-collide + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> *camera* target-spline end-point)))) + arg0 + (the-as pat-surface (camera-master-method-16 *camera* #t)) + ) + ) + ) + (cond + ((< f30-1 0.0) + (if *display-cam-los-debug* + (format *stdcon* "good ~f~%" f30-1) + ) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (set! (-> self los-last-pos quad) (-> arg0 quad)) + ) + ((begin + (if *display-cam-los-debug* + (format + *stdcon* + "looking vel ~M u ~f pt ~D" + (vector-length (-> self velocity)) + f30-1 + (-> self los-tgt-spline-pt) + ) + ) + (set! s2-2 (-> self los-tgt-spline-pt)) + (set! s1-3 -134250495) + (while (and (!= s2-2 -134250495) (begin + (let ((s0-3 cam-los-spline-collide)) + (set! sv-816 (+ (the-as uint (-> *camera* target-spline)) (* 48 s2-2))) + (set! sv-832 arg0) + (let ((a2-21 (camera-master-method-16 *camera* #t))) + (set! f30-1 (s0-3 (the-as vector sv-816) sv-832 (the-as pat-surface a2-21))) + ) + ) + (< f30-1 0.0) + ) + ) + (set! s1-3 s2-2) + (set! s2-2 (-> *camera* target-spline point s2-2 next)) + ) + (and (= s2-2 (-> *camera* target-spline used-point)) + (!= (-> *camera* target-spline point s2-2 next) -134250495) + ) + ) + (when *display-cam-los-debug* + (format 0 "looking at used point~%") + (format *stdcon* " at used point~%") + ) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline point s2-2 next)) + (set! (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (logior! (-> self options) 4096) + (set! (-> self good-point quad) (-> *camera* target-spline point s2-2 position quad)) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *debug-segment* + (let ((a1-40 (new 'stack-no-clear 'vector))) + (vector-! a1-40 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-40 -3 'jump self) + ) + ) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (set! (-> self string-trans quad) (-> self good-point quad)) + (vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) + (vector-reset! (-> self velocity)) + (let ((f0-14 (vector-length (-> self view-flat)))) + (if (< f0-14 (-> self min-z-override)) + (set! (-> self min-z-override) f0-14) + ) + ) + ) + ((!= s1-3 -134250495) + (if *display-cam-los-debug* + (format *stdcon* " ok~%") + ) + (set! (-> self los-tgt-spline-pt) s1-3) + (set! (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (set! (-> self los-last-pos quad) (-> arg0 quad)) + ) + (else + (if *display-cam-los-debug* + (format *stdcon* "~%failed u ~f cur ~D seen ~D tgt-pt ~D~%" f30-1 s2-2 s1-3 (-> self los-tgt-spline-pt)) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! + s3-1 + (-> self los-last-pos) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt)))) + ) + (let ((f28-1 (vector-length s3-1))) + (if (= f28-1 0.0) + (set! f28-1 0.4096) + ) + (let ((f30-2 (cond + ((and (= (-> self string-vel-dir) 6) + (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length (-> self velocity))) + ) + (fmin 1.0 (+ 0.001 f30-1)) + ) + ((= (-> self string-vel-dir) 6) + (fmin 0.9999 f30-1) + ) + (else + (fmax 0.001 (+ -0.001 f30-1)) + ) + ) + ) + ) + (let ((s2-3 (new 'stack-no-clear 'vector))) + (vector-! + s2-3 + (-> *camera* tpos-curr-adj) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt)))) + ) + (vector-flatten! s2-3 s2-3 (-> *camera* local-down)) + (cond + ((and (< (fabs (- (-> self desired-pos y) (-> self trans y))) 8192.0) + (< f28-1 (+ 1024.0 (-> self string-min-val z))) + (< (vector-length s2-3) 8192.0) + ) + (set! f30-2 0.0) + ) + ((< f28-1 (+ 1024.0 (-> self string-min-val z))) + ) + ((< (* f28-1 f30-2) (-> self string-min-val z)) + (set! f30-2 (/ (-> self string-min-val z) f28-1)) + ) + ) + ) + (when (< 0.0 f30-2) + (vector-! s3-1 (-> *camera* tpos-curr) (-> *camera* tpos-old)) + (vector-! + (-> self good-point) + (-> self los-last-pos) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt)))) + ) + (vector-float*! (-> self good-point) (-> self good-point) f30-2) + (vector+! + (-> self good-point) + (-> self good-point) + (the-as vector (+ (the-as uint (-> *camera* target-spline)) (* 48 (-> self los-tgt-spline-pt)))) + ) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *display-cam-los-debug* + (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) + (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) + ) + (logior! (-> self options) 4096) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (if *display-cam-los-debug* + (format + *stdcon* + "los-last ~M ~M ~M~%" + (-> self los-last-pos x) + (-> self los-last-pos y) + (-> self los-last-pos z) + ) + ) + (cam-los-setup-lateral arg2 s4-1 arg1) + ) + (cond + ((zero? (logand (-> self options) 1024)) + ) + ((= (-> self string-vel-dir) 5) + ) + ((and (= (-> self string-vel-dir) 2) (= (-> self los-state) (slave-los-state cw))) + ) + ((and (= (-> self string-vel-dir) 1) (= (-> self los-state) (slave-los-state ccw))) + ) + ) + (when *display-cam-los-debug* + (format *stdcon* "state ~S" (slave-los-state->string (-> self los-state))) + (cond + ((zero? (-> self string-vel-dir)) + (format *stdcon* " vzero") + ) + ((= (-> self string-vel-dir) 2) + (format *stdcon* " vcw") + ) + ((= (-> self string-vel-dir) 1) + (format *stdcon* " vccw") + ) + ((= (-> self string-vel-dir) 3) + (format *stdcon* " up") + ) + ((= (-> self string-vel-dir) 4) + (format *stdcon* " down") + ) + ((= (-> self string-vel-dir) 6) + (format *stdcon* " long") + ) + ((= (-> self string-vel-dir) 5) + (format *stdcon* " short") + ) + ) + (format *stdcon* "~%") + ) + (when *display-cam-los-info* + (dist-info-print (-> arg2 cw) "cw ") + (dist-info-print (-> arg2 ccw) "ccw ") + (dist-info-print (-> arg2 straddle) "strdl") + ) + (the-as symbol 0) + ) + +;; definition for function cam-string-follow +;; INFO: Used lq/sq +(defbehavior cam-string-follow camera-slave () + (let ((f30-0 (vector-length (-> self view-flat)))) + (cond + ((logtest? (-> self options) #x8000) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-cross! s5-0 (-> self view-flat) (-> *camera* local-down)) + (vector-normalize! s5-0 1.0) + (vector-! gp-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-flatten! gp-0 gp-0 s5-0) + ) + (if (< (vector-dot gp-0 (-> self view-flat)) 0.0) + (vector-! (-> self view-flat) (-> self view-flat) gp-0) + ) + ) + ) + (else + (let ((v1-10 (new 'stack-no-clear 'vector))) + (vector-! v1-10 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-! (-> self view-flat) (-> self view-flat) v1-10) + ) + ) + ) + (vector-flatten! (-> self view-flat) (-> self view-flat) (-> *camera* local-down)) + (let* ((f28-0 (vector-length (-> self view-flat))) + (f0-3 (fmin (-> *camera* string-push-z) (-> self view-off z))) + (f26-0 (-> self view-off z)) + (f0-4 (fmin f0-3 (-> self min-z-override))) + ) + (when (logtest? (cam-slave-options WIDE_FOV) (-> *camera* settings slave-options)) + (let ((v1-18 (new-stack-vector0))) + 0.0 + (vector-! v1-18 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (let ((f0-6 (vector-length v1-18))) + (set! f0-4 (lerp-clamp 28672.0 32768.0 (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f0-6))))) + ) + ) + (set! f26-0 f0-4) + ) + (set! (-> self fov) (-> *camera* settings fov)) + (cond + ((< f28-0 f0-4) + (vector-normalize! (-> self view-flat) f0-4) + ) + ((and (< f30-0 f28-0) + (or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw))) + ) + (vector-normalize! (-> self view-flat) f30-0) + ) + ((< f26-0 f28-0) + (vector-normalize! (-> self view-flat) f26-0) + (set! (-> self min-z-override) f26-0) + f26-0 + ) + (else + (set! (-> self min-z-override) f28-0) + f28-0 + ) + ) + ) + ) + ) + +;; definition for function cam-string-line-of-sight +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function cam-dist-analog-input +(defun cam-dist-analog-input ((arg0 int) (arg1 float)) + (let ((f0-0 (the-as number 0.0))) + (cond + ((< arg0 28) + (set! f0-0 (- (fmin arg1 (* 0.083333336 (- 28.0 (the float arg0)) arg1)))) + ) + ((< 160 arg0) + (set! f0-0 (fmin arg1 (* 0.0125 (+ -160.0 (the float arg0)) arg1))) + ) + ) + (the-as float f0-0) + ) + ) + +;; definition for function cam-string-joystick +;; INFO: Used lq/sq +;; ERROR: failed type prop at 785: Could not figure out load: (set! v1 (l.wu (+ v1 124))) +;; INFO: 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] +(defbehavior cam-string-joystick camera-slave () + (local-vars + (v0-0 vector) + (v0-1 float) + (v0-2 vector) + (v0-3 float) + (v0-4 float) + (v0-5 vector) + (v0-6 symbol) + (v0-7 float) + (v0-8 float) + (v0-9 none) + (v0-10 none) + (v0-11 none) + (v0-12 none) + (v0-13 none) + (v0-14 float) + (v0-15 float) + (v0-16 float) + (v0-17 none) + (v0-18 vector) + (v0-19 none) + (v0-20 symbol) + (v0-21 vector) + (v0-22 none) + (v0-23 none) + (v0-24 none) + (v0-25 none) + (v0-26 none) + (v0-27 none) + (v0-28 none) + (v0-29 none) + (v0-30 none) + (v0-31 none) + (v0-32 none) + (v0-33 vector) + (v0-34 vector) + (v0-35 vector) + (v0-36 float) + (v0-37 matrix) + (v0-38 vector) + (v1-0 int) + (v1-1 uint) + (v1-2 basic) + (v1-4 int) + (v1-5 matrix) + (v1-6 camera-master) + (v1-7 vector) + (v1-8 float) + (v1-9 none) + (v1-10 float) + (v1-11 vector) + (v1-12 float) + (v1-13 int) + (v1-15 int) + (v1-17 camera-master) + (v1-18 vector) + (v1-19 float) + (v1-20 float) + (v1-23 cpad-list) + (v1-24 cpad-info) + (v1-25 vector) + (v1-26 float) + (v1-27 int) + (v1-28 uint) + (v1-31 basic) + (v1-33 int) + (v1-35 camera-master) + (v1-36 symbol) + (v1-37 symbol) + (v1-38 clock) + (v1-39 time-frame) + (v1-40 time-frame) + (v1-42 int) + (v1-44 int) + (v1-45 uint) + (v1-47 cpad-list) + (v1-48 cpad-info) + (v1-49 uint) + (v1-50 symbol) + (v1-51 int) + (v1-52 symbol) + (v1-53 cpad-list) + (v1-54 cpad-info) + (v1-55 uint) + (v1-56 int) + (v1-60 uint) + (v1-61 uint) + (v1-62 int) + (v1-64 vector) + (v1-65 float) + (v1-66 int) + (v1-67 int) + (v1-71 none) + (v1-72 float) + (v1-73 camera-master) + (v1-74 cam-setting-data) + (v1-75 camera-master) + (v1-76 cam-setting-data) + (v1-78 camera-master) + (v1-79 cam-setting-data) + (v1-80 cam-slave-options) + (v1-81 cam-slave-options) + (v1-84 none) + (v1-85 none) + (v1-86 none) + (v1-87 none) + (v1-90 none) + (v1-91 none) + (v1-94 none) + (v1-95 none) + (v1-96 none) + (v1-99 none) + (v1-100 none) + (v1-101 none) + (v1-102 none) + (v1-103 none) + (v1-106 none) + (v1-107 none) + (v1-108 none) + (v1-110 none) + (v1-111 none) + (v1-112 none) + (v1-113 none) + (v1-114 none) + (v1-115 none) + (v1-117 none) + (v1-118 none) + (v1-119 none) + (v1-121 none) + (v1-122 none) + (v1-123 none) + (v1-124 none) + (v1-125 none) + (v1-126 none) + (v1-128 none) + (v1-129 none) + (v1-131 none) + (v1-132 none) + (v1-133 none) + (v1-134 none) + (v1-135 none) + (v1-136 none) + (v1-137 none) + (v1-138 none) + (v1-139 none) + (v1-140 none) + (v1-141 none) + (v1-143 none) + (v1-144 none) + (v1-146 none) + (v1-147 none) + (v1-149 none) + (v1-151 none) + (v1-154 none) + (v1-157 none) + (v1-159 int) + (v1-160 uint) + (v1-164 camera-master) + (v1-165 symbol) + (v1-168 camera-master) + (v1-169 cam-setting-data) + (v1-170 cam-master-options) + (v1-171 cam-master-options) + (v1-173 cpad-list) + (v1-174 cpad-info) + (v1-175 int) + (v1-176 clock) + (v1-177 int) + (v1-178 uint) + (v1-179 int) + (v1-180 int) + (v1-181 uint) + (v1-184 setting-control) + (v1-185 symbol) + (v1-188 basic) + (v1-190 int) + (v1-191 clock) + (v1-193 int) + (v1-194 uint) + (v1-196 camera-master) + (v1-197 cam-setting-data) + (v1-198 cam-master-options) + (v1-199 cam-master-options) + (v1-201 camera-bank) + (v1-202 uint) + (v1-203 uint) + (v1-204 int) + (v1-205 cpad-info) + (v1-206 pad-buttons) + (v1-207 pad-buttons) + (v1-209 int) + (v1-210 clock) + (v1-211 camera-bank) + (v1-212 uint) + (v1-213 uint) + (v1-214 int) + (v1-215 cpad-info) + (v1-216 int) + (v1-217 clock) + (v1-219 camera-master) + (v1-220 cam-setting-data) + (v1-221 cam-master-options) + (v1-222 cam-master-options) + (v1-224 camera-bank) + (v1-225 uint) + (v1-226 uint) + (v1-227 int) + (v1-228 cpad-info) + (v1-229 pad-buttons) + (v1-230 pad-buttons) + (v1-232 int) + (v1-233 clock) + (v1-234 camera-bank) + (v1-235 uint) + (v1-236 uint) + (v1-237 int) + (v1-238 cpad-info) + (v1-239 int) + (v1-240 clock) + (v1-242 slave-los-state) + (v1-243 slave-los-state) + (v1-244 symbol) + (v1-246 vector) + (v1-247 float) + (v1-248 int) + (v1-249 int) + (v1-250 clock) + (v1-252 none) + (v1-253 none) + (v1-254 none) + (v1-256 none) + (v1-257 none) + (v1-258 none) + (v1-259 none) + (v1-260 none) + (v1-262 uint) + (v1-263 uint) + (v1-264 camera-master) + (v1-265 int) + (v1-266 uint) + (v1-268 type) + (v1-270 int) + (v1-271 uint) + (v1-272 uint) + (v1-273 uint) + (v1-274 process) + (v1-275 camera-master) + (v1-276 cam-setting-data) + (v1-277 handle) + (v1-278 int) + (v1-280 camera-master) + (v1-281 cam-setting-data) + (v1-282 handle) + (v1-283 process) + (v1-284 int) + (v1-285 none) + (v1-286 none) + (v1-287 none) + (v1-288 none) + (v1-289 none) + (v1-291 none) + (v1-292 none) + (v1-293 none) + (v1-294 none) + (v1-296 none) + (v1-297 none) + (v1-299 none) + (v1-300 none) + (v1-301 none) + (v1-302 none) + (v1-303 none) + (v1-305 none) + (v1-307 none) + (v1-308 none) + (v1-310 none) + (v1-311 none) + (v1-312 camera-master) + (v1-313 cam-setting-data) + (v1-314 cam-slave-options) + (v1-315 cam-slave-options) + (v1-317 camera-master) + (v1-318 camera-master) + (v1-319 vector) + (v1-320 symbol) + (v1-321 symbol) + (v1-322 int) + (v1-324 int) + (v1-325 int) + (v1-327 none) + (v1-328 none) + (v1-329 none) + (v1-330 none) + (v1-332 none) + (v1-333 none) + (v1-335 none) + (v1-336 none) + (v1-338 none) + (v1-339 none) + (a0-0 uint) + (a0-1 none) + (a0-2 none) + (a0-3 float) + (a0-4 vector) + (a0-5 vector) + (a0-6 float) + (a0-7 float) + (a0-8 vector) + (a0-9 uint) + (a0-10 uint) + (a0-11 camera-master) + (a0-12 time-frame) + (a0-13 uint) + (a0-14 symbol) + (a0-15 cpad-list) + (a0-16 cpad-info) + (a0-17 uint) + (a0-18 float) + (a0-19 vector) + (a0-20 camera-master) + (a0-21 vector) + (a0-22 none) + (a0-23 none) + (a0-24 none) + (a0-25 none) + (a0-26 none) + (a0-31 uint) + (a0-33 uint) + (a0-34 uint) + (a0-35 uint) + (a0-36 cpad-list) + (a0-37 cpad-list) + (a0-38 uint) + (a0-39 cpad-list) + (a0-40 cpad-list) + (a0-41 uint) + (a0-42 symbol) + (a0-43 none) + (a0-44 matrix) + (a0-45 vector) + (a0-46 uint) + (a0-47 setting-control) + (a0-48 uint) + (a0-49 int) + (a0-50 (pointer process)) + (a0-51 process) + (a0-52 process) + (a0-53 vector) + (a0-54 int) + (a0-55 (pointer process)) + (a0-56 process) + (a0-58 int) + (a0-59 uint) + (a0-60 matrix) + (a0-61 none) + (a0-64 none) + (a0-68 none) + (a0-69 none) + (a0-70 none) + (a0-71 none) + (a0-72 none) + (a0-74 none) + (a0-75 none) + (a0-76 vector) + (a0-77 vector) + (a0-78 vector) + (a0-79 vector) + (a0-80 float) + (a0-81 matrix) + (a0-82 vector) + (a0-83 none) + (a0-84 none) + (a0-85 none) + (a0-86 none) + (a1-0 vector) + (a1-1 vector) + (a1-2 float) + (a1-3 float) + (a1-4 float) + (a1-5 float) + (a1-6 float) + (a1-7 none) + (a1-8 vector) + (a1-14 int) + (a1-15 float) + (a1-16 float) + (a1-17 vector) + (a1-18 vector) + (a1-19 symbol) + (a1-20 int) + (a1-21 type) + (a1-22 vector) + (a1-23 int) + (a1-24 uint) + (a1-25 none) + (a1-26 none) + (a1-27 none) + (a1-29 none) + (a1-30 none) + (a1-31 none) + (a1-32 none) + (a1-34 none) + (a1-35 vector) + (a1-36 (pointer uint8)) + (a1-37 float) + (a1-38 vector) + (a1-39 vector) + (a2-0 vector) + (a2-1 none) + (a2-2 float) + (a2-3 float) + (a2-4 float) + (a2-5 camera-master) + (a2-6 vector) + (a2-10 int) + (a2-11 float) + (a2-12 float) + (a2-13 float) + (a2-14 matrix) + (a2-15 symbol) + (a2-16 float) + (a2-19 none) + (a2-20 none) + (a2-21 none) + (a2-22 none) + (a2-25 float) + (a2-26 vector) + (a2-27 vector) + (a2-28 matrix) + (a3-0 float) + (a3-1 int) + (a3-2 float) + (a3-3 float) + (a3-4 none) + (a3-5 float) + (t0-0 uint) + (t0-1 float) + (t0-2 float) + (t0-3 float) + (s3-0 process) + (s3-1 none) + (s4-0 matrix) + (s5-0 none) + (s5-1 none) + (s5-2 none) + (s5-3 vector) + (t9-0 (function vector vector vector vector)) + (t9-1 (function float float)) + (t9-2 (function vector vector vector float vector)) + (t9-3 (function float float float float)) + (t9-4 (function float float float float)) + (t9-5 (function vector float vector)) + (t9-6 (function int float float)) + (t9-7 (function float float float float)) + (t9-8 none) + (t9-9 none) + (t9-10 none) + (t9-11 none) + (t9-12 none) + (t9-13 (function int float float float float float)) + (t9-14 (function int float float float float float)) + (t9-15 (function int float float float float float)) + (t9-16 (function matrix vector float none)) + (t9-17 (function vector vector matrix vector)) + (t9-18 (function setting-control engine-pers object none)) + (t9-19 (function object type symbol)) + (t9-20 (function vector vector float vector)) + (t9-21 (function matrix quaternion matrix)) + (t9-22 none) + (t9-23 none) + (t9-24 none) + (t9-25 none) + (t9-26 none) + (t9-27 none) + (t9-28 none) + (t9-29 none) + (t9-30 none) + (t9-31 none) + (t9-32 (function vector vector float vector)) + (t9-33 (function vector vector vector vector)) + (t9-34 (function vector float vector)) + (t9-35 (function float float)) + (t9-36 (function matrix vector vector float matrix)) + (t9-37 (function vector vector matrix vector)) + (gp-0 vector) + (gp-1 none) + (gp-2 none) + (gp-3 vector) + (sp-0 none) + (f0-0 int) + (f0-1 float) + (f0-2 float) + (f0-3 float) + (f0-4 float) + (f0-5 float) + (f0-6 float) + (f0-7 float) + (f0-8 float) + (f0-9 float) + (f0-10 float) + (f0-11 float) + (f0-12 float) + (f0-13 float) + (f0-14 float) + (f0-15 float) + (f0-16 float) + (f0-17 float) + (f0-18 float) + (f0-19 float) + (f0-20 float) + (f0-21 float) + (f0-22 float) + (f0-23 float) + (f0-24 float) + (f0-25 float) + (f0-26 float) + (f0-27 float) + (f0-28 float) + (f0-29 float) + (f0-30 float) + (f0-31 float) + (f0-32 float) + (f0-33 float) + (f0-34 float) + (f0-35 float) + (f0-36 float) + (f0-37 none) + (f0-38 none) + (f0-39 none) + (f0-40 none) + (f0-41 none) + (f0-42 none) + (f0-43 none) + (f0-44 none) + (f0-45 none) + (f0-46 none) + (f0-47 none) + (f0-48 none) + (f0-49 none) + (f0-50 none) + (f0-51 none) + (f0-52 none) + (f0-53 none) + (f0-54 none) + (f0-55 none) + (f0-56 none) + (f0-57 none) + (f0-58 none) + (f0-59 none) + (f0-60 none) + (f0-61 none) + (f0-62 none) + (f0-63 none) + (f0-64 none) + (f0-65 float) + (f0-66 float) + (f0-67 float) + (f0-68 float) + (f0-69 float) + (f0-70 float) + (f0-71 float) + (f0-72 float) + (f0-73 float) + (f0-74 float) + (f0-75 float) + (f0-76 float) + (f0-77 float) + (f0-78 float) + (f0-79 float) + (f0-80 float) + (f0-81 float) + (f0-82 float) + (f0-83 float) + (f0-84 float) + (f0-85 float) + (f0-86 none) + (f0-87 none) + (f0-88 none) + (f0-89 none) + (f0-90 none) + (f0-91 none) + (f0-92 float) + (f0-93 none) + (f0-94 none) + (f0-95 none) + (f0-96 float) + (f0-97 float) + (f0-98 float) + (f0-99 float) + (f0-100 float) + (f0-101 none) + (f0-102 none) + (f1-0 float) + (f1-1 float) + (f1-2 float) + (f1-3 float) + (f1-4 float) + (f1-5 float) + (f1-6 float) + (f1-7 float) + (f1-8 float) + (f1-9 float) + (f1-10 float) + (f1-11 float) + (f1-12 float) + (f1-13 float) + (f1-14 float) + (f1-15 float) + (f1-16 meters) + (f1-17 meters) + (f1-18 none) + (f1-19 none) + (f1-20 none) + (f1-21 none) + (f1-22 none) + (f1-23 none) + (f1-24 none) + (f1-25 none) + (f1-26 none) + (f1-27 none) + (f1-28 none) + (f1-29 none) + (f1-30 none) + (f1-31 none) + (f1-32 none) + (f1-33 none) + (f1-34 none) + (f1-35 none) + (f1-36 none) + (f1-37 none) + (f1-38 none) + (f1-39 none) + (f1-40 none) + (f1-41 none) + (f1-42 none) + (f1-43 none) + (f1-44 none) + (f1-45 none) + (f1-46 none) + (f1-47 none) + (f1-48 none) + (f1-49 none) + (f1-50 none) + (f1-51 none) + (f1-52 none) + (f1-53 none) + (f1-54 none) + (f1-55 none) + (f1-56 none) + (f1-57 none) + (f1-58 none) + (f1-59 none) + (f1-60 none) + (f1-61 none) + (f1-62 none) + (f1-63 none) + (f1-64 none) + (f1-65 none) + (f1-66 none) + (f1-67 float) + (f1-68 int) + (f1-69 float) + (f1-70 float) + (f1-71 float) + (f1-72 float) + (f1-73 float) + (f1-74 float) + (f1-75 float) + (f1-76 float) + (f1-77 float) + (f1-78 float) + (f1-79 none) + (f1-80 none) + (f1-81 none) + (f1-82 none) + (f1-83 none) + (f1-84 none) + (f1-85 none) + (f1-86 float) + (f1-87 float) + (f1-88 float) + (f1-89 none) + (f1-90 none) + (f1-91 none) + (f1-92 none) + (f1-93 none) + (f1-94 none) + (f2-0 float) + (f2-1 float) + (f2-2 float) + (f2-3 float) + (f2-4 float) + (f2-5 float) + (f2-6 float) + (f2-7 none) + (f2-8 none) + (f2-9 none) + (f2-10 none) + (f2-11 none) + (f2-12 none) + (f2-13 none) + (f2-14 none) + (f2-15 none) + (f2-16 none) + (f2-17 none) + (f2-18 none) + (f2-19 none) + (f2-20 none) + (f2-21 none) + (f2-22 none) + (f2-23 none) + (f2-24 none) + (f2-25 none) + (f2-26 float) + (f2-27 float) + (f2-28 none) + (f2-29 none) + (f2-30 float) + (f2-31 none) + (f2-32 none) + (f2-33 none) + (f3-0 none) + (f3-1 none) + (f3-2 none) + (f3-3 none) + (f3-4 float) + (f3-5 none) + (f3-6 float) + (f3-7 none) + (f26-0 float) + (f28-0 number) + (f28-1 float) + (f28-2 float) + (f30-0 float) + (f30-1 float) + (f30-2 number) + ) + (if (begin + (set! v1-0 -257) + (set! a0-0 (-> s6-0 options)) + (set! v1-1 (logand v1-0 a0-0)) + (set! (-> s6-0 options) v1-1) + (set! v1-2 (-> s6-0 string-relative)) + v1-2 + ) + (return (begin + (when (begin + (set! s5-0 (the-as none (new 'stack-no-clear 'vector))) + (set! gp-0 (new 'stack-no-clear 'vector)) + (set! f0-0 0) + (set! v1-4 #x3f000000) + (set! f30-0 (the-as float (gpr->fpr v1-4))) + (set! v1-5 (new 'stack-no-clear 'matrix)) + (set! t9-0 vector-flatten!) + (set! a0-1 (the-as none s5-0)) + (set! a1-0 (-> s6-0 relative-position)) + (set! v1-6 *camera*) + (set! a2-0 (-> v1-6 local-down)) + (call! a0-1 a1-0 a2-0) + (set! t9-1 acos) + (set! a0-2 (the-as none s5-0)) + (set! v1-7 (-> s6-0 view-flat)) + (set! f0-1 (vec3dot a0-2 v1-7)) + (set! v1-8 (fpr->gpr f0-1)) + (set! f0-2 (gpr->fpr v1-8)) + (set! v1-9 (the-as none s5-0)) + (set! v1-10 (veclength v1-9)) + (set! f1-0 (gpr->fpr v1-10)) + (set! v1-11 (-> s6-0 view-flat)) + (set! v1-12 (veclength v1-11)) + (set! f2-0 (gpr->fpr v1-12)) + (set! f1-1 (*.s f1-0 f2-0)) + (set! f0-3 (/.s f0-2 f1-1)) + (set! a0-3 (fpr->gpr f0-3)) + (set! v0-1 (call! a0-3)) + (set! f0-4 (gpr->fpr v0-1)) + (set! v1-13 #x44b60b61) + (set! f1-2 (the-as float (gpr->fpr v1-13))) + (set! f2-1 (*.s f30-0 f0-4)) + (<.s f1-2 f2-1) + ) + (set! v1-15 #x44b60b61) + (set! f1-3 (the-as float (gpr->fpr v1-15))) + (set! f30-0 (/.s f1-3 f0-4)) + (set! v1-16 (fpr->gpr f30-0)) + ) + (set! t9-2 vector-deg-slerp) + (set! a0-4 (-> s6-0 view-flat)) + (set! a1-1 (-> s6-0 view-flat)) + (set! a2-1 (the-as none s5-0)) + (set! a3-0 (fpr->gpr f30-0)) + (call! a0-4 a1-1 a2-1 a3-0) + (set! a0-5 (-> s6-0 relative-position)) + (set! v1-17 *camera*) + (set! v1-18 (-> v1-17 local-down)) + (set! f0-5 (vec3dot a0-5 v1-18)) + (set! v1-19 (fpr->gpr f0-5)) + (set! f0-6 (gpr->fpr v1-19)) + (set! f0-7 (neg.s f0-6)) + (set! (-> gp-0 y) f0-7) + (set! v1-20 (veclength s5-0)) + (set! f0-8 (gpr->fpr v1-20)) + (set! (-> gp-0 z) f0-8) + (set! t9-3 lerp) + (set! f0-9 (-> s6-0 view-off y)) + (set! a0-6 (fpr->gpr f0-9)) + (set! f0-10 (-> gp-0 y)) + (set! a1-2 (fpr->gpr f0-10)) + (set! a2-2 (fpr->gpr f30-0)) + (set! v0-3 (call! a0-6 a1-2 a2-2)) + (set! f0-11 (gpr->fpr v0-3)) + (set! (-> s6-0 view-off y) f0-11) + (set! t9-4 lerp) + (set! f0-12 (-> s6-0 view-off z)) + (set! a0-7 (fpr->gpr f0-12)) + (set! f0-13 (-> gp-0 z)) + (set! a1-3 (fpr->gpr f0-13)) + (set! a2-3 (fpr->gpr f30-0)) + (set! v0-4 (call! a0-7 a1-3 a2-3)) + (set! f0-14 (gpr->fpr v0-4)) + (set! (-> s6-0 view-off z) f0-14) + (set! t9-5 vector-normalize!) + (set! a0-8 (-> s6-0 view-flat)) + (set! f0-15 (-> s6-0 view-off z)) + (set! a1-4 (fpr->gpr f0-15)) + (call! a0-8 a1-4) + (set! v1-21 v0-5) + (set! f0-16 (-> s6-0 view-off y)) + (set! (-> s6-0 string-min-val y) f0-16) + (set! f0-17 (-> s6-0 view-off z)) + (set! (-> s6-0 string-min-val z) f0-17) + (set! f0-18 (-> s6-0 view-off y)) + (set! (-> s6-0 string-max-val y) f0-18) + (set! f0-19 (-> s6-0 view-off z)) + (set! (-> s6-0 string-max-val z) f0-19) + (set! v0-6 #f) + ) + ) + ) + (when (begin + (when (begin + (when (begin + (when (begin + (set! t9-6 cam-dist-analog-input) + (set! v1-23 *cpad-list*) + (set! v1-24 (-> v1-23 cpads 0)) + (set! a0-9 (-> v1-24 righty)) + (set! a1-5 (the-as float #x3d4ccccd)) + (set! v0-7 (call! a0-9 a1-5)) + (set! f28-0 (gpr->fpr v0-7)) + (set! v1-25 (-> s6-0 view-flat)) + (set! v1-26 (veclength v1-25)) + (set! f0-20 (gpr->fpr v1-26)) + (set! f1-4 (-> s6-0 string-min-val z)) + (set! f0-21 (-.s f0-20 f1-4)) + (set! f1-5 (-> s6-0 string-max-val z)) + (set! f2-2 (-> s6-0 string-min-val z)) + (set! f1-6 (-.s f1-5 f2-2)) + (set! f0-22 (/.s f0-21 f1-6)) + (set! f30-1 (-> s6-0 view-off-param)) + (set! v1-27 #x10000) + (set! a0-10 (-> s6-0 options)) + (set! v1-28 (logand v1-27 a0-10)) + (nonzero? v1-28) + ) + (set! f28-0 0) + (set! v1-30 (fpr->gpr f28-0)) + ) + (set! v1-31 (-> s6-0 have-phony-joystick)) + v1-31 + ) + (set! v1-33 #x3d4ccccd) + (set! f1-7 (the-as float (gpr->fpr v1-33))) + (set! f2-3 (-> s6-0 phony-joystick-y)) + (set! f28-0 (*.s f1-7 f2-3)) + (set! v1-34 (fpr->gpr f28-0)) + ) + (when (begin + (and (begin (set! v1-35 *camera*) (set! v1-36 (-> v1-35 being-attacked)) v1-36) + (begin + (set! v1-38 (-> s6-0 clock)) + (set! v1-39 (-> v1-38 frame-counter)) + (set! a0-11 *camera*) + (set! a0-12 (-> a0-11 attack-start)) + (set! v1-40 (- v1-39 a0-12)) + (set! v1-37 (<.si v1-40 75)) + ) + ) + v1-37 + ) + (set! v1-42 #x3d4ccccd) + (set! f28-0 (gpr->fpr v1-42)) + (set! v1-43 (fpr->gpr f28-0)) + ) + (set! v1-44 #x40000) + (set! a0-13 (-> s6-0 options)) + (set! v1-45 (logand v1-44 a0-13)) + (nonzero? v1-45) + ) + (when (begin + (and (begin + (or (begin + (set! v1-47 *cpad-list*) + (set! v1-48 (-> v1-47 cpads 0)) + (set! v1-49 (-> v1-48 rightx)) + (set! a0-14 (<.ui v1-49 64)) + a0-14 + ) + (begin + (set! v1-51 192) + (set! a0-15 *cpad-list*) + (set! a0-16 (-> a0-15 cpads 0)) + (set! a0-17 (-> a0-16 rightx)) + (set! v1-50 (<.ui v1-51 a0-17)) + ) + ) + v1-50 + ) + (begin + (set! v1-53 *cpad-list*) + (set! v1-54 (-> v1-53 cpads 0)) + (set! v1-55 (-> v1-54 righty)) + (set! v1-56 (the-as int (+ v1-55 -128))) + (set! v1-56 (abs v1-56)) + (set! v1-52 (<.ui v1-56 64)) + ) + ) + v1-52 + ) + (set! f28-0 0) + (set! v1-58 (fpr->gpr f28-0)) + ) + ) + (cond + ((begin + (when (begin + (when (begin (set! f1-8 (the-as float 0)) (!=.s f28-0 f1-8)) + (set! v1-60 (-> s6-0 options)) + (set! v1-61 (logior v1-60 256)) + (set! (-> s6-0 options) v1-61) + ) + (set! v1-62 #x3f800000) + (set! f1-9 (the-as float (gpr->fpr v1-62))) + (set! f26-0 (min.s f1-9 f0-22)) + (set! f0-23 f26-0) + (set! f1-10 (the-as float 0)) + (<.s f26-0 f1-10) + ) + (set! f0-24 (-> s6-0 string-min-val z)) + (set! v1-64 (-> s6-0 view-flat)) + (set! v1-65 (veclength v1-64)) + (set! f1-11 (gpr->fpr v1-65)) + (set! f0-25 (-.s f0-24 f1-11)) + (set! v1-66 #x3f000000) + (set! f1-12 (the-as float (gpr->fpr v1-66))) + (set! f2-4 (-> s6-0 string-min-val z)) + (set! f1-13 (*.s f1-12 f2-4)) + (set! f0-26 (/.s f0-25 f1-13)) + (set! v1-67 #x3f400000) + (set! f1-14 (the-as float (gpr->fpr v1-67))) + (set! f0-23 (min.s f1-14 f0-26)) + (set! v1-68 (fpr->gpr f0-23)) + ) + (when (begin + (set! f1-15 (-> s6-0 string-min-val y)) + (set! f2-5 (-> s6-0 string-max-val y)) + (set! t9-7 lerp) + (set! a0-18 (fpr->gpr f1-15)) + (set! a1-6 (fpr->gpr f2-5)) + (set! a2-4 (fpr->gpr f0-23)) + (set! v0-8 (call! a0-18 a1-6 a2-4)) + (set! f0-27 (gpr->fpr v0-8)) + (set! (-> s6-0 view-off y) f0-27) + (set! v1-69 (fpr->gpr f0-27)) + (set! f0-28 (the-as float 0)) + (<.s f26-0 f0-28) + ) + (set! v1-71 (the-as none (new 'stack-no-clear 'vector))) + (set! a1-7 (the-as none v1-71)) + (set! a0-19 (-> s6-0 string-trans)) + (set! a2-5 *camera*) + (set! a2-6 (-> a2-5 tpos-curr-adj)) + (set! a1-8 (vector-!2 a1-7 a0-19 a2-6)) + (set! a0-20 *camera*) + (set! a0-21 (-> a0-20 local-down)) + (set! f0-29 (vec3dot v1-71 a0-21)) + (set! v1-72 (fpr->gpr f0-29)) + (set! f0-30 (gpr->fpr v1-72)) + (set! f0-31 (neg.s f0-30)) + (set! v1-73 *camera*) + (set! v1-74 (-> v1-73 settings)) + (set! f1-16 (-> v1-74 target-height)) + (set! f0-32 (-.s f0-31 f1-16)) + (set! v1-75 *camera*) + (set! v1-76 (-> v1-75 settings)) + (set! f1-17 (-> v1-76 string-cliff-height)) + (set! f2-6 (-> s6-0 view-off y)) + (set! f0-33 (max.s f0-32 f2-6)) + (set! f0-34 (min.s f1-17 f0-33)) + (set! (-> s6-0 view-off y) f0-34) + (set! v1-77 (fpr->gpr f0-34)) + ) + (set! f0-35 (the-as float 0)) + (set! f0-36 (max.s f0-35 f26-0)) + (set! v1-78 *camera*) + (set! v1-79 (-> v1-78 settings)) + (set! v1-80 (-> v1-79 slave-options)) + (set! v1-81 (logand v1-80 8192)) + (nonzero? v1-81) + ) + ) + ((begin + (set! v1-84 (the-as none *camera*)) + (set! v1-85 (the-as none (l.wu (+ v1-84 128)))) + (set! v1-86 (the-as none (l.d (+ v1-85 224)))) + (set! v1-87 (the-as none (logand v1-86 32))) + (nonzero? v1-87) + ) + ) + ((begin + (and (begin (set! f1-18 (the-as none 0)) (set! v1-90 (the-as none (>=.s f1-18 f28-0))) v1-90) + (begin (set! f1-19 (the-as none 0)) (set! v1-91 (the-as none (>=.s f1-19 f0-36)))) + ) + v1-91 + ) + ) + ((begin + (and (begin (set! f1-20 (the-as none 0)) (set! v1-94 (the-as none (>=.s f28-0 f1-20))) v1-94) + (begin + (set! v1-96 (the-as none #x3f800000)) + (set! f1-21 (the-as none (gpr->fpr v1-96))) + (set! v1-95 (the-as none (>=.s f0-36 f1-21))) + ) + ) + v1-95 + ) + ) + ((begin + (set! f1-22 (the-as none 0)) + (set! v1-99 (the-as none (<.s f1-22 f28-0))) + (and v1-99 (or (begin + (set! v1-101 (the-as none (l.wu (+ s6-0 2352)))) + (set! v1-102 (the-as none (+ v1-101 -2))) + (set! a0-22 (the-as none (zero? v1-102))) + a0-22 + ) + (begin + (set! v1-103 (the-as none (l.wu (+ s6-0 2352)))) + (set! a0-23 (the-as none (+ v1-103 -1))) + (set! v1-100 (the-as none (zero? a0-23))) + ) + ) + ) + v1-100 + ) + ) + ((begin + (and (begin + (set! v1-106 (the-as none #x40000)) + (set! a0-24 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-107 (the-as none (logand v1-106 a0-24))) + (nonzero? v1-107) + ) + (begin (set! f1-23 (the-as none 0)) (set! v1-108 (the-as none (<.s f1-23 f28-0)))) + ) + v1-108 + ) + (set! v1-110 (the-as none *camera*)) + (set! v1-111 (the-as none (l.wu (+ v1-110 128)))) + (set! f0-37 (the-as none (l.f (+ v1-111 80)))) + (set! f1-24 (the-as none (l.f (+ s6-0 2640)))) + (set! v1-112 (the-as none #x46c00000)) + (set! f2-7 (the-as none (gpr->fpr v1-112))) + (set! f2-8 (the-as none (*.s f2-7 f28-0))) + (set! f1-25 (the-as none (-.s f1-24 f2-8))) + (set! f0-38 (the-as none (max.s f0-37 f1-25))) + (s.f! (+ s6-0 2640) f0-38) + (set! v1-113 (the-as none #x46800000)) + (set! f0-39 (the-as none (gpr->fpr v1-113))) + (set! f1-26 (the-as none (l.f (+ s6-0 2640)))) + (set! f0-40 (the-as none (+.s f0-39 f1-26))) + (set! v1-114 (the-as none #x46000000)) + (set! f1-27 (the-as none (gpr->fpr v1-114))) + (set! f2-9 (the-as none (l.f (+ s6-0 2640)))) + (set! f1-28 (the-as none (+.s f1-27 f2-9))) + (set! f2-10 (the-as none (l.f (+ s6-0 2656)))) + (set! v1-115 (the-as none #x46c00000)) + (set! f3-0 (the-as none (gpr->fpr v1-115))) + (set! f3-1 (the-as none (*.s f3-0 f28-0))) + (set! f2-11 (the-as none (-.s f2-10 f3-1))) + (set! f1-29 (the-as none (max.s f1-28 f2-11))) + (set! f0-41 (the-as none (min.s f0-40 f1-29))) + (s.f! (+ s6-0 2656) f0-41) + (set! v1-116 (the-as none (fpr->gpr f0-41))) + ) + ((begin + (and (begin + (set! v1-117 (the-as none #x40000)) + (set! a0-25 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-118 (the-as none (logand v1-117 a0-25))) + (nonzero? v1-118) + ) + (begin (set! f1-30 (the-as none 0)) (set! v1-119 (the-as none (<.s f28-0 f1-30)))) + ) + v1-119 + ) + (set! v1-121 (the-as none *camera*)) + (set! v1-122 (the-as none (l.wu (+ v1-121 128)))) + (set! f0-42 (the-as none (l.f (+ v1-122 76)))) + (set! f1-31 (the-as none (l.f (+ s6-0 2656)))) + (set! v1-123 (the-as none #x46c00000)) + (set! f2-12 (the-as none (gpr->fpr v1-123))) + (set! f2-13 (the-as none (*.s f2-12 f28-0))) + (set! f1-32 (the-as none (-.s f1-31 f2-13))) + (set! f0-43 (the-as none (min.s f0-42 f1-32))) + (s.f! (+ s6-0 2656) f0-43) + (set! v1-124 (the-as none -973078528)) + (set! f0-44 (the-as none (gpr->fpr v1-124))) + (set! f1-33 (the-as none (l.f (+ s6-0 2656)))) + (set! f0-45 (the-as none (+.s f0-44 f1-33))) + (set! v1-125 (the-as none -964689920)) + (set! f1-34 (the-as none (gpr->fpr v1-125))) + (set! f2-14 (the-as none (l.f (+ s6-0 2656)))) + (set! f1-35 (the-as none (+.s f1-34 f2-14))) + (set! f2-15 (the-as none (l.f (+ s6-0 2640)))) + (set! v1-126 (the-as none #x46c00000)) + (set! f3-2 (the-as none (gpr->fpr v1-126))) + (set! f3-3 (the-as none (*.s f3-2 f28-0))) + (set! f2-16 (the-as none (-.s f2-15 f3-3))) + (set! f1-36 (the-as none (max.s f1-35 f2-16))) + (set! f0-46 (the-as none (min.s f0-45 f1-36))) + (s.f! (+ s6-0 2640) f0-46) + (set! v1-127 (the-as none (fpr->gpr f0-46))) + ) + ((begin + (set! v1-128 (the-as none #x40000)) + (set! a0-26 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-129 (the-as none (logand v1-128 a0-26))) + (nonzero? v1-129) + ) + (set! v1-131 (the-as none #x46000000)) + (set! f0-47 (the-as none (gpr->fpr v1-131))) + (set! v1-132 (the-as none *camera*)) + (set! v1-133 (the-as none (l.wu (+ v1-132 128)))) + (set! f1-37 (the-as none (l.f (+ v1-133 80)))) + (set! f0-48 (the-as none (+.s f0-47 f1-37))) + (set! v1-134 (the-as none *camera*)) + (set! v1-135 (the-as none (l.wu (+ v1-134 128)))) + (set! f1-38 (the-as none (l.f (+ v1-135 76)))) + (set! f2-17 (the-as none (l.f (+ s6-0 2656)))) + (set! f1-39 (the-as none (min.s f1-38 f2-17))) + (set! f0-49 (the-as none (max.s f0-48 f1-39))) + (s.f! (+ s6-0 2656) f0-49) + (set! v1-136 (the-as none *camera*)) + (set! v1-137 (the-as none (l.wu (+ v1-136 128)))) + (set! f0-50 (the-as none (l.f (+ v1-137 80)))) + (set! v1-138 (the-as none -973078528)) + (set! f1-40 (the-as none (gpr->fpr v1-138))) + (set! v1-139 (the-as none *camera*)) + (set! v1-140 (the-as none (l.wu (+ v1-139 128)))) + (set! f2-18 (the-as none (l.f (+ v1-140 76)))) + (set! f1-41 (the-as none (+.s f1-40 f2-18))) + (set! f2-19 (the-as none (l.f (+ s6-0 2640)))) + (set! f1-42 (the-as none (min.s f1-41 f2-19))) + (set! f0-51 (the-as none (max.s f0-50 f1-42))) + (s.f! (+ s6-0 2640) f0-51) + (set! v1-141 (the-as none -964689920)) + (set! f0-52 (the-as none (gpr->fpr v1-141))) + (set! f1-43 (the-as none (l.f (+ s6-0 2656)))) + (set! f0-53 (the-as none (+.s f0-52 f1-43))) + (set! f1-44 (the-as none (l.f (+ s6-0 2640)))) + (set! f0-54 (the-as none (max.s f0-53 f1-44))) + (s.f! (+ s6-0 2640) f0-54) + (set! v1-142 (the-as none (fpr->gpr f0-54))) + ) + ((begin + (set! v1-143 (the-as none #x3d4ccccd)) + (set! f1-45 (the-as none (gpr->fpr v1-143))) + (set! v1-144 (the-as none #x3f800000)) + (set! f2-20 (the-as none (gpr->fpr v1-144))) + (set! f2-21 (the-as none (-.s f2-20 f0-36))) + (set! f1-46 (the-as none (*.s f1-45 f2-21))) + (<.s f1-46 f28-0) + ) + (set! v1-146 (the-as none #x3d4ccccd)) + (set! f1-47 (the-as none (gpr->fpr v1-146))) + (set! v1-147 (the-as none #x3f800000)) + (set! f2-22 (the-as none (gpr->fpr v1-147))) + (set! f2-23 (the-as none (-.s f2-22 f0-36))) + (set! f1-48 (the-as none (*.s f1-47 f2-23))) + (set! f0-55 (the-as none (+.s f0-36 f1-48))) + (set! f1-49 (the-as none (l.f (+ s6-0 468)))) + (set! f1-50 (the-as none (max.s f1-49 f0-55))) + (s.f! (+ s6-0 468) f1-50) + (set! gp-1 (the-as none vector-normalize!)) + (set! s5-1 (the-as none (+ s6-0 524))) + (set! t9-8 (the-as none lerp)) + (set! f1-51 (the-as none (l.f (+ s6-0 2644)))) + (set! a0-27 (the-as none (fpr->gpr f1-51))) + (set! f1-52 (the-as none (l.f (+ s6-0 2660)))) + (set! a1-9 (the-as none (fpr->gpr f1-52))) + (set! a2-7 (the-as none (fpr->gpr f0-55))) + (call!) + (set! a1-10 (the-as none v0-9)) + (set! t9-9 (the-as none gp-1)) + (set! a0-28 (the-as none s5-1)) + (call!) + (set! v1-148 (the-as none v0-10)) + ) + ((begin + (set! v1-149 (the-as none #x3d4ccccd)) + (set! f1-53 (the-as none (gpr->fpr v1-149))) + (set! f2-24 (the-as none (neg.s f0-36))) + (set! f1-54 (the-as none (*.s f1-53 f2-24))) + (<.s f28-0 f1-54) + ) + (set! v1-151 (the-as none #x3d4ccccd)) + (set! f1-55 (the-as none (gpr->fpr v1-151))) + (set! f2-25 (the-as none (neg.s f0-36))) + (set! f1-56 (the-as none (*.s f1-55 f2-25))) + (set! f0-56 (the-as none (+.s f0-36 f1-56))) + (s.f! (+ s6-0 468) f0-56) + (set! v1-152 (the-as none (fpr->gpr f0-56))) + ) + ((begin (set! f1-57 (the-as none 0)) (<.s f1-57 f28-0)) + (set! v1-154 (the-as none (l.wu (+ s6-0 8)))) + (set! f1-58 (the-as none (l.f (+ v1-154 84)))) + (set! f1-59 (the-as none (*.s f28-0 f1-58))) + (set! f0-57 (the-as none (+.s f0-36 f1-59))) + (set! f1-60 (the-as none (l.f (+ s6-0 468)))) + (set! f1-61 (the-as none (max.s f1-60 f0-57))) + (s.f! (+ s6-0 468) f1-61) + (set! gp-2 (the-as none vector-normalize!)) + (set! s5-2 (the-as none (+ s6-0 524))) + (set! t9-10 (the-as none lerp)) + (set! f1-62 (the-as none (l.f (+ s6-0 2644)))) + (set! a0-29 (the-as none (fpr->gpr f1-62))) + (set! f1-63 (the-as none (l.f (+ s6-0 2660)))) + (set! a1-11 (the-as none (fpr->gpr f1-63))) + (set! a2-8 (the-as none (fpr->gpr f0-57))) + (call!) + (set! a1-12 (the-as none v0-11)) + (set! t9-11 (the-as none gp-2)) + (set! a0-30 (the-as none s5-2)) + (call!) + (set! v1-155 (the-as none v0-12)) + ) + ((begin (set! f1-64 (the-as none 0)) (<.s f28-0 f1-64)) + (set! v1-157 (the-as none (l.wu (+ s6-0 8)))) + (set! f1-65 (the-as none (l.f (+ v1-157 84)))) + (set! f1-66 (the-as none (*.s f28-0 f1-65))) + (set! f0-58 (the-as none (+.s f0-36 f1-66))) + (s.f! (+ s6-0 468) f0-58) + (set! v1-158 (the-as none (fpr->gpr f0-58))) + ) + ) + (when (begin + (cond + ((begin + (set! v1-159 #x40000) + (set! a0-31 (-> s6-0 options)) + (set! v1-160 (logand v1-159 a0-31)) + (nonzero? v1-160) + ) + ) + ((begin (set! f0-59 (the-as none 0)) (=.s f28-0 f0-59)) + (set! f0-60 (the-as none (l.f (+ s6-0 2660)))) + (s.f! (+ s6-0 484) f0-60) + (set! v1-162 (the-as none (fpr->gpr f0-60))) + ) + (else + (set! t9-12 (the-as none lerp)) + (set! f0-61 (the-as none (l.f (+ s6-0 2644)))) + (set! a0-32 (the-as none (fpr->gpr f0-61))) + (set! f0-62 (the-as none (l.f (+ s6-0 2660)))) + (set! a1-13 (the-as none (fpr->gpr f0-62))) + (set! f0-63 (the-as none (l.f (+ s6-0 468)))) + (set! a2-9 (the-as none (fpr->gpr f0-63))) + (set! v0-13 (the-as none (call!))) + (set! f0-64 (the-as none (gpr->fpr v0-13))) + (s.f! (+ s6-0 484) f0-64) + (set! v1-163 (the-as none (fpr->gpr f0-64))) + ) + ) + (set! v1-164 *camera*) + (set! v1-165 (-> v1-164 being-attacked)) + v1-165 + ) + (set! (-> s6-0 view-off-param) f30-1) + (set! v1-167 (fpr->gpr f30-1)) + ) + (set! v1-168 *camera*) + (set! v1-169 (-> v1-168 settings)) + (set! v1-170 (-> v1-169 master-options)) + (set! v1-171 (logand v1-170 32)) + (zero? v1-171) + ) + (when (begin + (when (begin + (when (begin + (when (begin + (if (begin + (set! t9-13 analog-input) + (set! v1-173 *cpad-list*) + (set! v1-174 (-> v1-173 cpads 0)) + (set! a0-33 (-> v1-174 rightx)) + (set! a1-14 #x43000000) + (set! a2-10 #x42000000) + (set! a3-1 #x42dc0000) + (set! v1-175 #x43360b61) + (set! f0-65 (the-as float (gpr->fpr v1-175))) + (set! v1-176 (-> s6-0 clock)) + (set! f1-67 (-> v1-176 seconds-per-frame)) + (set! f0-66 (*.s f0-65 f1-67)) + (set! v1-177 #x40000) + (set! t0-0 (-> s6-0 options)) + (set! v1-178 (logand v1-177 t0-0)) + (nonzero? v1-178) + ) + (set! v1-179 #x42f00000) + (set! v1-179 (the-as int #x42f00000)) + ) + (set! f1-68 (gpr->fpr v1-179)) + (set! f0-67 (*.s f0-66 f1-68)) + (set! t0-1 (fpr->gpr f0-67)) + (set! v0-14 (call! a0-33 a1-14 a2-10 a3-1 t0-1)) + (set! f30-2 (gpr->fpr v0-14)) + (set! s4-0 (new 'stack-no-clear 'matrix)) + (set! (-> s4-0 vector 0 quad) (the-as uint128 0)) + (set! (-> s4-0 vector 1 quad) (the-as uint128 0)) + (set! (-> s4-0 vector 2 quad) (the-as uint128 0)) + (set! (-> s4-0 trans quad) (the-as uint128 0)) + (set! gp-3 (new 'stack-no-clear 'vector)) + (set! (-> gp-3 quad) (the-as uint128 0)) + (set! s5-3 (new 'stack-no-clear 'vector)) + (set! (-> s5-3 quad) (the-as uint128 0)) + (set! v1-180 #x10000) + (set! a0-34 (-> s6-0 options)) + (set! v1-181 (logand v1-180 a0-34)) + (nonzero? v1-181) + ) + (set! f30-2 0) + (set! v1-183 (fpr->gpr f30-2)) + ) + (when (begin (set! v1-184 *setting-control*) (set! v1-185 (-> v1-184 user-default unknowng-symbol-00)) v1-185) + (set! f30-2 (neg.s f30-2)) + (set! v1-187 (fpr->gpr f30-2)) + ) + (set! v1-188 (-> s6-0 have-phony-joystick)) + v1-188 + ) + (set! v1-190 #x46aaaaab) + (set! f0-68 (the-as float (gpr->fpr v1-190))) + (set! f1-69 (-> s6-0 phony-joystick-x)) + (set! f0-69 (*.s f0-68 f1-69)) + (set! v1-191 (-> s6-0 clock)) + (set! f1-70 (-> v1-191 seconds-per-frame)) + (set! f30-2 (*.s f0-69 f1-70)) + (set! v1-192 (fpr->gpr f30-2)) + ) + (set! v1-193 #x20000) + (set! a0-35 (-> s6-0 options)) + (set! v1-194 (logand v1-193 a0-35)) + (nonzero? v1-194) + ) + (when (begin + (when (begin + (set! v1-196 *camera*) + (set! v1-197 (-> v1-196 settings)) + (set! v1-198 (-> v1-197 master-options)) + (set! v1-199 (logand v1-198 64)) + (nonzero? v1-199) + ) + (when (begin + (set! v1-201 *CAMERA-bank*) + (set! v1-202 (-> v1-201 joypad)) + (set! v1-203 (sll v1-202 2)) + (set! a0-36 *cpad-list*) + (set! v1-204 (+ v1-203 a0-36)) + (set! v1-205 (dynamic-array-field-access v1-204 cpads PLACEHOLDER)) + (set! v1-206 (-> v1-205 button0-abs 0)) + (set! v1-207 (logand v1-206 2048)) + (nonzero? v1-207) + ) + (set! v1-209 #x462aaaab) + (set! f0-70 (the-as float (gpr->fpr v1-209))) + (set! v1-210 (-> s6-0 clock)) + (set! f1-71 (-> v1-210 seconds-per-frame)) + (set! f28-1 (*.s f0-70 f1-71)) + (set! t9-14 analog-input) + (set! v1-211 *CAMERA-bank*) + (set! v1-212 (-> v1-211 joypad)) + (set! v1-213 (sll v1-212 2)) + (set! a0-37 *cpad-list*) + (set! v1-214 (+ v1-213 a0-37)) + (set! v1-215 (dynamic-array-field-access v1-214 cpads PLACEHOLDER)) + (set! a0-38 (-> v1-215 abutton 9)) + (set! a1-15 (the-as float 0)) + (set! a2-11 (the-as float #x42000000)) + (set! a3-2 (the-as float #x43660000)) + (set! v1-216 #x46aaaaab) + (set! f0-71 (the-as float (gpr->fpr v1-216))) + (set! v1-217 (-> s6-0 clock)) + (set! f1-72 (-> v1-217 seconds-per-frame)) + (set! f0-72 (*.s f0-71 f1-72)) + (set! t0-2 (fpr->gpr f0-72)) + (set! v0-15 (call! a0-38 a1-15 a2-11 a3-2 t0-2)) + (set! f0-73 (gpr->fpr v0-15)) + (set! f0-74 (+.s f28-1 f0-73)) + (set! f30-2 (+.s f30-2 f0-74)) + (set! v1-218 (fpr->gpr f30-2)) + ) + ) + (set! v1-219 *camera*) + (set! v1-220 (-> v1-219 settings)) + (set! v1-221 (-> v1-220 master-options)) + (set! v1-222 (logand v1-221 64)) + (nonzero? v1-222) + ) + (when (begin + (set! v1-224 *CAMERA-bank*) + (set! v1-225 (-> v1-224 joypad)) + (set! v1-226 (sll v1-225 2)) + (set! a0-39 *cpad-list*) + (set! v1-227 (+ v1-226 a0-39)) + (set! v1-228 (dynamic-array-field-access v1-227 cpads PLACEHOLDER)) + (set! v1-229 (-> v1-228 button0-abs 0)) + (set! v1-230 (logand v1-229 1024)) + (nonzero? v1-230) + ) + (set! v1-232 #x462aaaab) + (set! f0-75 (the-as float (gpr->fpr v1-232))) + (set! v1-233 (-> s6-0 clock)) + (set! f1-73 (-> v1-233 seconds-per-frame)) + (set! f28-2 (*.s f0-75 f1-73)) + (set! t9-15 analog-input) + (set! v1-234 *CAMERA-bank*) + (set! v1-235 (-> v1-234 joypad)) + (set! v1-236 (sll v1-235 2)) + (set! a0-40 *cpad-list*) + (set! v1-237 (+ v1-236 a0-40)) + (set! v1-238 (dynamic-array-field-access v1-237 cpads PLACEHOLDER)) + (set! a0-41 (-> v1-238 abutton 8)) + (set! a1-16 (the-as float 0)) + (set! a2-12 (the-as float #x42000000)) + (set! a3-3 (the-as float #x43660000)) + (set! v1-239 #x46aaaaab) + (set! f0-76 (the-as float (gpr->fpr v1-239))) + (set! v1-240 (-> s6-0 clock)) + (set! f1-74 (-> v1-240 seconds-per-frame)) + (set! f0-77 (*.s f0-76 f1-74)) + (set! t0-3 (fpr->gpr f0-77)) + (set! v0-16 (call! a0-41 a1-16 a2-12 a3-3 t0-3)) + (set! f0-78 (gpr->fpr v0-16)) + (set! f0-79 (+.s f28-2 f0-78)) + (set! f30-2 (-.s f30-2 f0-79)) + (set! v1-241 (fpr->gpr f30-2)) + ) + ) + ) + (cond + ((begin + (cond + ((begin + (and (begin (set! v1-242 (-> s6-0 los-state)) (set! v1-243 (+ v1-242 -2)) (set! a0-42 (zero? v1-243)) a0-42) + (begin (set! f0-80 (the-as float 0)) (set! v1-244 (<.s f0-80 f30-2))) + ) + v1-244 + ) + (set! f0-81 (-> s6-0 string-min-val z)) + (set! f1-75 (-> s6-0 string-max-val z)) + (set! v1-246 (-> s6-0 view-flat)) + (set! v1-247 (veclength v1-246)) + (set! f2-26 (gpr->fpr v1-247)) + (set! f1-76 (min.s f1-75 f2-26)) + (set! f0-82 (max.s f0-81 f1-76)) + (set! v1-248 #x46aaaaab) + (set! f1-77 (the-as float (gpr->fpr v1-248))) + (set! v1-249 #x3dcccccd) + (set! f2-27 (the-as float (gpr->fpr v1-249))) + (set! f3-4 (-> s6-0 string-min-val z)) + (set! f0-83 (/.s f3-4 f0-82)) + (set! f0-84 (+.s f2-27 f0-83)) + (set! f0-85 (*.s f1-77 f0-84)) + (set! v1-250 (-> s6-0 clock)) + (set! f1-78 (-> v1-250 seconds-per-frame)) + (set! f30-2 (*.s f0-85 f1-78)) + (set! v1-251 (fpr->gpr f30-2)) + ) + ((begin + (and (begin + (set! v1-252 (the-as none (-> s6-0 los-state))) + (set! v1-253 (the-as none (+ v1-252 -1))) + (set! a0-43 (the-as none (zero? v1-253))) + a0-43 + ) + (begin (set! f0-86 (the-as none 0)) (set! v1-254 (the-as none (<.s f30-2 f0-86)))) + ) + v1-254 + ) + (set! f0-87 (the-as none (l.f (+ s6-0 2644)))) + (set! f1-79 (the-as none (l.f (+ s6-0 2660)))) + (set! v1-256 (the-as none (+ s6-0 524))) + (set! v1-257 (the-as none (veclength v1-256))) + (set! f2-28 (the-as none (gpr->fpr v1-257))) + (set! f1-80 (the-as none (min.s f1-79 f2-28))) + (set! f0-88 (the-as none (max.s f0-87 f1-80))) + (set! v1-258 (the-as none -961893717)) + (set! f1-81 (the-as none (gpr->fpr v1-258))) + (set! v1-259 (the-as none #x3dcccccd)) + (set! f2-29 (the-as none (gpr->fpr v1-259))) + (set! f3-5 (the-as none (l.f (+ s6-0 2644)))) + (set! f0-89 (the-as none (/.s f3-5 f0-88))) + (set! f0-90 (the-as none (+.s f2-29 f0-89))) + (set! f0-91 (the-as none (*.s f1-81 f0-90))) + (set! v1-260 (the-as none (l.wu (+ s6-0 8)))) + (set! f1-82 (the-as none (l.f (+ v1-260 76)))) + (set! f30-2 (the-as number (*.s f0-91 f1-82))) + (set! v1-261 (the-as none (fpr->gpr f30-2))) + ) + ) + (set! f0-92 (the-as float 0)) + (!=.s f30-2 f0-92) + ) + (when (begin + (set! v1-262 (-> s6-0 options)) + (set! v1-263 (logior v1-262 256)) + (set! (-> s6-0 options) v1-263) + (set! t9-16 matrix-axis-angle!) + (set! a0-44 s4-0) + (set! v1-264 *camera*) + (set! a1-17 (-> v1-264 local-down)) + (set! a2-13 (fpr->gpr f30-2)) + (call! a0-44 a1-17 a2-13) + (set! t9-17 vector-matrix*!) + (set! a0-45 (-> s6-0 view-flat)) + (set! a1-18 (-> s6-0 view-flat)) + (set! a2-14 s4-0) + (call! a0-45 a1-18 a2-14) + (set! (-> s6-0 butt-timer) (the-as uint 0)) + (set! (-> s6-0 butt-seek) #f) + (set! v1-265 #x800000) + (set! a0-46 (-> s6-0 options)) + (set! v1-266 (logand v1-265 a0-46)) + (nonzero? v1-266) + ) + (set! a0-47 *setting-control*) + (set! v1-268 (-> a0-47 type)) + (set! t9-18 (method-of-type v1-268 kill-persister)) + (set! a1-19 'butt-handle) + (set! a2-15 'butt-handle) + (call! a0-47 a1-19 a2-15) + (set! v1-269 v0-19) + (set! v1-270 -8388609) + (set! a0-48 (-> s6-0 options)) + (set! v1-271 (logand v1-270 a0-48)) + (set! (-> s6-0 options) v1-271) + ) + ) + ((begin + (or (begin (set! v1-272 (-> s6-0 options)) (set! v1-273 (logand v1-272 1)) (nonzero? v1-273)) + (if (begin + (and (begin + (set! v1-275 *camera*) + (set! v1-276 (-> v1-275 settings)) + (set! v1-277 (-> v1-276 butt-handle)) + (set! a0-49 (subu-s7 v1-277)) + (nonzero? a0-49) + ) + (begin + (if (begin + (.sllv a0-50 v1-277 r0) + (set! a0-51 (-> a0-50 0)) + (set! a1-20 (-> a0-51 pid)) + (set! v1-278 (sra v1-277 32)) + (= v1-278 a1-20) + ) + (set! s3-0 a0-51) + ) + (set! v1-279 s3-0) + ) + ) + (set! t9-19 type?) + (set! a0-52 s3-0) + (set! a1-21 process-drawable) + (set! v0-20 (call! a0-52 a1-21)) + v0-20 + ) + (set! v1-274 s3-0) + ) + ) + v1-274 + ) + (when (begin + (and (begin + (and (begin + (set! t9-20 vector-normalize-copy!) + (set! a0-53 gp-3) + (set! a1-22 (-> s6-0 view-flat)) + (set! a2-16 (the-as float #x3f800000)) + (call! a0-53 a1-22 a2-16) + (set! v1-280 *camera*) + (set! v1-281 (-> v1-280 settings)) + (set! v1-282 (-> v1-281 butt-handle)) + (set! a0-54 (subu-s7 v1-282)) + (nonzero? a0-54) + ) + (begin + (if (begin + (.sllv a0-55 v1-282 r0) + (set! a0-56 (-> a0-55 0)) + (set! a1-23 (-> a0-56 pid)) + (set! v1-284 (sra v1-282 32)) + (= v1-284 a1-23) + ) + (set! v1-283 a0-56) + ) + (set! a0-57 v1-283) + ) + ) + (cond + (v1-283 + (set! a0-58 #x800000) + (set! a1-24 (-> s6-0 options)) + (set! a0-59 (logior a0-58 a1-24)) + (set! (-> s6-0 options) a0-59) + (set! t9-21 quaternion->matrix) + (set! a0-60 (new 'stack-no-clear 'matrix)) + (set! v1-285 (the-as none (l.wu (+ v1-283 124)))) + (set! a1-25 (the-as none (+ v1-285 28))) + (set! v0-22 (the-as none (call!))) + (set! s3-1 (the-as none v0-22)) + (set! t9-22 (the-as none matrix-axis-angle!)) + (set! a0-61 (the-as none (+ sp-0 288))) + (set! a1-26 (the-as none (+ s3-1 16))) + (set! v1-286 (the-as none #x47000000)) + (set! f0-93 (the-as none (gpr->fpr v1-286))) + (set! v1-287 (the-as none *camera*)) + (set! v1-288 (the-as none (l.wu (+ v1-287 128)))) + (set! f1-83 (the-as none (l.f (+ v1-288 344)))) + (set! f0-94 (the-as none (+.s f0-93 f1-83))) + (set! a2-17 (the-as none (fpr->gpr f0-94))) + (call!) + (set! a2-18 (the-as none v0-23)) + (set! t9-23 (the-as none vector-matrix*!)) + (set! a0-62 (the-as none s5-3)) + (set! a1-27 (the-as none (+ s3-1 32))) + (call!) + (set! t9-24 (the-as none vector-flatten!)) + (set! a0-63 (the-as none s5-3)) + (set! a1-28 (the-as none s5-3)) + (set! v1-289 (the-as none *camera*)) + (set! a2-19 (the-as none (+ v1-289 284))) + (call!) + (set! v1-290 (the-as none v0-25)) + ) + ((begin + (set! v1-291 (the-as none (-> s6-0 clock))) + (set! v1-292 (the-as none (l.d (+ v1-291 20)))) + (set! a0-64 (the-as none (-> s6-0 butt-timer))) + (set! v1-293 (the-as none (- v1-292 a0-64))) + (<0.si v1-293) + ) + (set! t9-25 (the-as none vector-flatten!)) + (set! a0-65 (the-as none s5-3)) + (set! a1-29 (the-as none (+ s6-0 2300))) + (set! v1-294 (the-as none *camera*)) + (set! a2-20 (the-as none (+ v1-294 284))) + (call!) + (set! v1-295 (the-as none v0-26)) + ) + (else + (set! t9-26 (the-as none vector-flatten!)) + (set! a0-66 (the-as none s5-3)) + (set! v1-296 (the-as none *camera*)) + (set! a1-30 (the-as none (+ v1-296 380))) + (set! v1-297 (the-as none *camera*)) + (set! a2-21 (the-as none (+ v1-297 284))) + (call!) + (set! v1-298 (the-as none v0-27)) + ) + ) + (set! t9-27 (the-as none vector-normalize!)) + (set! a0-67 (the-as none s5-3)) + (set! a1-31 (the-as none -1082130432)) + (call!) + (set! v1-299 (the-as none #x800000)) + (set! a0-68 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-300 (the-as none (logand v1-299 a0-68))) + (nonzero? v1-300) + ) + (begin + (set! t9-28 (the-as none cos)) + (set! a0-69 (the-as none #x44638e39)) + (set! v0-29 (the-as none (call!))) + (set! f0-95 (the-as none (gpr->fpr v0-29))) + (set! a0-70 (the-as none gp-3)) + (set! v1-302 (the-as none s5-3)) + (set! f1-84 (the-as none (vec3dot a0-70 v1-302))) + (set! v1-303 (the-as none (fpr->gpr f1-84))) + (set! f1-85 (the-as none (gpr->fpr v1-303))) + (set! v1-301 (the-as none (<.s f0-95 f1-85))) + ) + ) + v1-301 + ) + (set! a0-71 (the-as none *setting-control*)) + (set! v1-305 (the-as none (l.wu (+ a0-71 -4)))) + (set! t9-29 (the-as none (l.wu (+ v1-305 68)))) + (set! a1-32 (the-as none 'butt-handle)) + (set! a2-22 (the-as none 'butt-handle)) + (call!) + (set! v1-306 (the-as none v0-30)) + (set! v1-307 (the-as none -8388609)) + (set! a0-72 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-308 (the-as none (logand v1-307 a0-72))) + (s.w! (+ s6-0 2276) v1-308) + ) + (set! t9-30 (the-as none matrix-from-two-vectors-max-angle!)) + (set! a0-73 (the-as none s4-0)) + (set! a1-33 (the-as none gp-3)) + (set! a2-23 (the-as none s5-3)) + (set! a3-4 (the-as none #x44088889)) + (call!) + (set! t9-31 (the-as none vector-matrix*!)) + (set! a0-74 (the-as none (+ s6-0 524))) + (set! a1-34 (the-as none (+ s6-0 524))) + (set! a2-24 (the-as none s4-0)) + (call!) + (set! v1-309 (the-as none v0-32)) + ) + (else + (set! v1-310 (the-as none -8388609)) + (set! a0-75 (the-as none (-> s6-0 options))) + (set! v1-311 (the-as none (logand v1-310 a0-75))) + (set! (-> s6-0 options) (the-as uint v1-311)) + ) + ) + (set! v1-312 *camera*) + (set! v1-313 (-> v1-312 settings)) + (set! v1-314 (-> v1-313 slave-options)) + (set! v1-315 (logand v1-314 8192)) + (nonzero? v1-315) + ) + (when (begin + (and (begin + (set! t9-32 vector-normalize-copy!) + (set! a0-76 gp-3) + (set! a1-35 (-> s6-0 view-flat)) + (set! a2-25 (the-as float #x3f800000)) + (call! a0-76 a1-35 a2-25) + (set! t9-33 vector-flatten!) + (set! a0-77 s5-3) + (set! v1-317 *camera*) + (set! a1-36 (&-> v1-317 stack 256)) + (set! v1-318 *camera*) + (set! a2-26 (-> v1-318 local-down)) + (call! a0-77 a1-36 a2-26) + (set! t9-34 vector-normalize!) + (set! a0-78 s5-3) + (set! a1-37 (the-as float -1082130432)) + (call! a0-78 a1-37) + (set! t9-35 acos) + (set! a0-79 s5-3) + (set! v1-319 gp-3) + (set! f0-96 (vec3dot a0-79 v1-319)) + (set! a0-80 (fpr->gpr f0-96)) + (set! v0-36 (call! a0-80)) + (set! f0-97 (gpr->fpr v0-36)) + (set! f1-86 (-> s6-0 max-angle-offset)) + (set! v1-320 (<.s f1-86 f0-97)) + v1-320 + ) + (begin (set! v1-322 #x46fe93e9) (set! f1-87 (the-as float (gpr->fpr v1-322))) (set! v1-321 (<.s f0-97 f1-87))) + ) + v1-321 + ) + (set! t9-36 matrix-from-two-vectors-max-angle!) + (set! a0-81 s4-0) + (set! v1-324 #x44088889) + (set! f1-88 (the-as float (gpr->fpr v1-324))) + (set! v1-325 #x3f000000) + (set! f2-30 (the-as float (gpr->fpr v1-325))) + (set! f3-6 (-> s6-0 max-angle-offset)) + (set! f0-98 (-.s f0-97 f3-6)) + (set! f0-99 (*.s f2-30 f0-98)) + (set! f0-100 (min.s f1-88 f0-99)) + (set! a3-5 (fpr->gpr f0-100)) + (set! a1-38 gp-3) + (set! a2-27 s5-3) + (call! a0-81 a1-38 a2-27 a3-5) + (set! t9-37 vector-matrix*!) + (set! a0-82 (-> s6-0 view-flat)) + (set! a1-39 (-> s6-0 view-flat)) + (set! a2-28 s4-0) + (call! a0-82 a1-39 a2-28) + (set! v1-326 v0-38) + ) + ) + ) + (when (begin + (set! v1-327 (the-as none #x80000)) + (set! a0-83 (the-as none *camera*)) + (set! a0-84 (the-as none (l.wu (+ a0-83 128)))) + (set! a0-85 (the-as none (l.d (+ a0-84 112)))) + (set! v1-328 (the-as none (logand v1-327 a0-85))) + (zero? v1-328) + ) + (when (begin + (when (begin + (set! v1-329 (the-as none (+ s6-0 524))) + (set! v1-330 (the-as none (veclength v1-329))) + (set! f0-101 (the-as none (gpr->fpr v1-330))) + (set! f1-89 (the-as none (l.f (+ s6-0 484)))) + (<.s f1-89 f0-101) + ) + (set! v1-332 (the-as none (+ s6-0 524))) + (set! a0-86 (the-as none (+ s6-0 524))) + (set! f0-102 (the-as none (/.s f1-89 f0-101))) + (set! v1-333 (the-as none (vector-float*!2 v1-332 a0-86 f0-102))) + (s.f! (+ s6-0 508) f1-89) + (set! f0-101 (the-as none f1-89)) + (set! v1-334 (the-as none (fpr->gpr f0-101))) + ) + (set! f1-90 (the-as none (l.f (+ s6-0 500)))) + (set! v1-335 (the-as none (<.s f1-90 f0-101))) + (and v1-335 (begin + (set! f1-91 (the-as none (l.f (+ s6-0 480)))) + (set! f2-31 (the-as none (l.f (+ s6-0 496)))) + (set! v1-336 (the-as none (<.s f1-91 f2-31))) + ) + ) + v1-336 + ) + (set! v1-338 (the-as none *camera*)) + (set! v1-339 (the-as none (l.wu (+ v1-338 128)))) + (set! f1-92 (the-as none (l.f (+ v1-339 68)))) + (set! f2-32 (the-as none (l.f (+ s6-0 2640)))) + (set! f3-7 (the-as none (l.f (+ s6-0 496)))) + (set! f2-33 (the-as none (max.s f2-32 f3-7))) + (set! f1-93 (the-as none (min.s f1-92 f2-33))) + (s.f! (+ s6-0 480) f1-93) + (set! v1-340 (the-as none (fpr->gpr f1-93))) + ) + (set! f1-94 (the-as none (l.f (+ s6-0 480)))) + (s.f! (+ s6-0 496) f1-94) + (s.f! (+ s6-0 500) f0-101) + (set! v0-6 (the-as symbol (fpr->gpr f0-101))) + ) + (ret-value v0-6) + ) + +;; definition for function cam-string-find-hidden +;; 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 +(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) + (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)) + (set! (-> s4-0 radius) 409.6) + (set! (-> s4-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + (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 + ) + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + ((< (-> self time-dist-too-far) (the-as uint 600)) + (+! (-> self time-dist-too-far) 1) + ) + ((cam-string-find-position-rel! gp-0) + (cam-string-set-position-rel! gp-0) + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + (else + (format 0 "camera position search failed~%") + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + ) + ) + (none) + ) + +;; definition for function cam-string-move +;; INFO: Used lq/sq +;; 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) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans)) + (if *display-cam-los-debug* + (format *stdcon* "vel ~M~%" (vector-length (-> self velocity))) + ) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (let ((v1-7 s5-0)) + (let ((a0-4 (-> self velocity)) + (a1-5 s3-0) + (f0-0 0.5) + ) + (.lvf vf2 (&-> a1-5 quad)) + (.lvf vf1 (&-> a0-4 quad)) + (let ((a0-5 f0-0)) + (.mov vf3 a0-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 (&-> 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)) + ) + ) + (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* + (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) + (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 + ) + ) + ) + ) + (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) + ) + (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~%") + ) + ) + (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) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (when *display-cam-los-debug* + (let ((v1-103 (new-stack-vector0))) + (vector-! v1-103 (-> self desired-pos) (-> self string-trans)) + (format *stdcon* "vel ~M~%" (vector-length v1-103)) + ) + ) + ) + ) + +;; definition for function cam-string-code +;; INFO: Used lq/sq +;; ERROR: failed type prop at 11: Called a function, but we do not know its type +;; INFO: Return type mismatch none vs vector. +(defbehavior cam-string-code camera-slave () + (local-vars + (v0-0 none) + (v0-1 object) + (v0-2 none) + (v0-3 none) + (v0-4 none) + (v0-5 none) + (v0-6 none) + (v0-7 none) + (v0-8 none) + (v0-9 none) + (v0-10 none) + (v0-11 none) + (v0-12 none) + (v0-13 none) + (v0-14 none) + (v0-15 none) + (v0-16 none) + (v0-17 none) + (v0-18 none) + (v0-19 none) + (v0-20 none) + (v1-0 symbol) + (v1-3 uint) + (v1-4 uint) + (v1-9 none) + (v1-10 none) + (v1-11 none) + (v1-12 none) + (v1-13 none) + (v1-14 none) + (v1-15 none) + (v1-17 none) + (v1-18 none) + (v1-21 none) + (v1-22 none) + (v1-23 none) + (v1-25 none) + (v1-27 none) + (v1-28 none) + (v1-29 none) + (v1-30 none) + (v1-31 none) + (v1-32 none) + (v1-33 none) + (v1-37 none) + (v1-39 none) + (v1-40 none) + (v1-41 none) + (v1-42 none) + (v1-43 none) + (v1-45 none) + (v1-46 none) + (v1-48 none) + (v1-49 none) + (v1-51 none) + (v1-54 none) + (v1-55 none) + (v1-56 none) + (v1-58 none) + (v1-59 none) + (v1-60 none) + (v1-61 none) + (v1-62 none) + (v1-63 none) + (v1-64 none) + (v1-66 none) + (v1-67 none) + (v1-68 none) + (v1-69 none) + (v1-70 none) + (v1-72 none) + (v1-73 none) + (v1-74 none) + (v1-75 none) + (v1-76 none) + (v1-77 none) + (v1-78 none) + (v1-80 none) + (v1-81 none) + (v1-82 none) + (v1-83 none) + (v1-84 none) + (v1-88 none) + (a0-1 none) + (a0-2 none) + (a0-3 none) + (a0-4 none) + (a0-5 none) + (a0-6 none) + (a0-7 none) + (a0-8 none) + (a0-9 none) + (a0-10 none) + (a0-11 none) + (a0-12 none) + (a0-13 none) + (a0-14 none) + (a0-15 none) + (a0-16 none) + (a0-17 none) + (a0-18 none) + (a0-19 none) + (a0-20 none) + (a0-21 none) + (a0-22 none) + (a0-23 none) + (a0-24 none) + (a0-25 none) + (a0-26 none) + (a1-0 none) + (a1-1 none) + (a1-2 none) + (a1-3 none) + (a1-4 none) + (a1-5 none) + (a1-7 none) + (a1-8 none) + (a1-9 none) + (a1-10 none) + (a1-11 none) + (a1-12 none) + (a1-13 none) + (a2-0 none) + (a2-1 none) + (a2-2 none) + (a2-3 none) + (a2-4 none) + (a2-5 none) + (a2-6 none) + (a2-7 none) + (a2-8 none) + (a2-9 none) + (a3-1 none) + (a3-2 none) + (a3-3 none) + (a3-4 none) + (a3-5 none) + (a3-6 none) + (t0-0 none) + (t0-1 none) + (t0-2 none) + (t0-3 none) + (t0-4 none) + (t0-5 none) + (t0-6 none) + (t0-7 none) + (t9-0 (function none)) + (t9-1 (function object :behavior camera-slave)) + (t9-2 function) + (t9-3 none) + (t9-4 none) + (t9-5 none) + (t9-6 none) + (t9-7 none) + (t9-8 none) + (t9-9 none) + (t9-10 none) + (t9-11 none) + (t9-12 none) + (t9-13 none) + (t9-14 none) + (t9-15 none) + (t9-16 none) + (t9-17 none) + (t9-18 none) + (t9-19 none) + (t9-20 none) + (gp-0 none) + (gp-1 none) + (gp-2 none) + (sp-0 none) + (f0-0 none) + (f0-1 none) + (f0-2 none) + (f0-3 none) + (f0-4 none) + (f0-5 none) + (f0-6 none) + (f0-7 none) + (f0-8 none) + (f0-9 none) + (f0-10 none) + (f0-11 none) + (f0-12 none) + (f0-13 none) + (f0-14 none) + (f0-15 none) + (f1-0 none) + (f1-1 none) + (f1-2 none) + (f1-3 none) + (f1-4 none) + (f30-0 none) + ) + (cond + ((begin + (when (begin + (when (begin + (when (begin (set! v1-0 *debug-segment*) v1-0) + (set! t9-0 cam-debug-reset-coll-tri) + (call!) + (set! v1-2 v0-0) + ) + (set! t9-1 cam-string-follow) + (call!) + (set! v1-3 (-> s6-0 options)) + (set! v1-4 (logand v1-3 512)) + (nonzero? v1-4) + ) + (set! t9-2 cam-string-line-of-sight) + (call!) + (set! v1-6 (the-as none v0-2)) + ) + (when (begin (set! t9-3 (the-as none paused?)) (set! v0-3 (the-as none (call!))) (not v0-3)) + (set! t9-4 (the-as none cam-string-joystick)) + (call!) + (set! v1-8 (the-as none v0-4)) + ) + (set! gp-0 (the-as none (+ sp-0 16))) + (s.q! gp-0 0) + (set! t9-5 (the-as none vector--float*!)) + (set! a0-0 (the-as none gp-0)) + (set! a1-0 (the-as none (+ s6-0 524))) + (set! v1-9 (the-as none *camera*)) + (set! a2-0 (the-as none (+ v1-9 284))) + (set! v1-10 (the-as none *camera*)) + (set! v1-11 (the-as none (l.wu (+ v1-10 128)))) + (set! f0-0 (the-as none (l.f (+ v1-11 196)))) + (set! f1-0 (the-as none (l.f (+ s6-0 480)))) + (set! f0-1 (the-as none (+.s f0-0 f1-0))) + (set! a3-0 (the-as none (fpr->gpr f0-1))) + (call!) + (set! v1-12 (the-as none (+ s6-0 2332))) + (set! a0-1 (the-as none *camera*)) + (set! a0-2 (the-as none (+ a0-1 524))) + (set! v1-13 (the-as none (vector+!2 v1-12 a0-2 gp-0))) + (set! f0-2 (the-as none (l.f (+ s6-0 2336)))) + (set! v1-14 (the-as none *camera*)) + (set! v1-15 (the-as none (l.wu (+ v1-14 128)))) + (set! f1-1 (the-as none (l.f (+ v1-15 72)))) + (set! f0-3 (the-as none (min.s f0-2 f1-1))) + (s.f! (+ s6-0 2336) f0-3) + (set! v1-16 (the-as none (fpr->gpr f0-3))) + (set! v1-17 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-18 (the-as none (logand v1-17 64))) + (nonzero? v1-18) + ) + (set! t9-6 (the-as none cam-string-find-hidden)) + (call!) + (set! v1-20 (the-as none v0-6)) + ) + (set! v1-21 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-22 (the-as none (logand v1-21 4096))) + (nonzero? v1-22) + ) + (when (begin + (when (begin (set! v1-23 (the-as none *debug-segment*)) v1-23) + (set! a1-1 (the-as none (+ sp-0 32))) + (set! a2-1 (the-as none a1-1)) + (set! v1-25 (the-as none (+ s6-0 2364))) + (set! a0-3 (the-as none (+ s6-0 556))) + (set! a2-2 (the-as none (vector-!2 a2-1 v1-25 a0-3))) + (set! t9-7 (the-as none cam-collision-record-save)) + (set! a0-4 (the-as none (+ s6-0 556))) + (set! a2-3 (the-as none -2)) + (set! a3-1 (the-as none 'jump)) + (set! t0-0 (the-as none s6-0)) + (call!) + (set! v1-26 (the-as none v0-7)) + ) + (set! v1-27 (the-as none -4097)) + (set! a0-5 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-28 (the-as none (logand v1-27 a0-5))) + (s.w! (+ s6-0 2276) v1-28) + (set! v1-29 (the-as none (+ s6-0 2332))) + (set! a0-6 (the-as none (+ s6-0 2364))) + (set! a0-7 (the-as none (l.q a0-6))) + (s.q! v1-29 a0-7) + (set! t9-8 (the-as none cam-string-move)) + (call!) + (set! a0-8 (the-as none (+ s6-0 524))) + (set! v1-30 (the-as none (+ s6-0 556))) + (set! a1-2 (the-as none *camera*)) + (set! a1-3 (the-as none (+ a1-2 524))) + (set! a0-9 (the-as none (vector-!2 a0-8 v1-30 a1-3))) + (set! t9-9 (the-as none vector-flatten!)) + (set! a0-10 (the-as none (+ s6-0 524))) + (set! a1-4 (the-as none (+ s6-0 524))) + (set! v1-31 (the-as none *camera*)) + (set! a2-4 (the-as none (+ v1-31 284))) + (call!) + (set! v1-32 (the-as none (+ s6-0 524))) + (set! v1-33 (the-as none (veclength v1-32))) + (set! f0-4 (the-as none (gpr->fpr v1-33))) + (set! f1-2 (the-as none (l.f (+ s6-0 508)))) + (<.s f0-4 f1-2) + ) + (s.f! (+ s6-0 508) f0-4) + (set! v1-35 (the-as none (fpr->gpr f0-4))) + ) + ) + (else + (set! t9-10 (the-as none cam-string-move)) + (call!) + (set! v1-36 (the-as none v0-10)) + ) + ) + (set! a0-11 (the-as none (+ s6-0 572))) + (set! v1-37 (the-as none tracking-spline)) + (set! t9-11 (the-as none (l.wu (+ v1-37 84)))) + (set! a1-5 (the-as none (+ s6-0 556))) + (set! a2-5 (the-as none #x3d27c5ac)) + (set! a3-2 (the-as none #x45800000)) + (set! t0-1 (the-as none #t)) + (call!) + (set! v1-38 (the-as none v0-11)) + (set! v1-39 (the-as none (l.wu (+ s6-0 8)))) + (set! f30-0 (the-as none (l.f (+ v1-39 8)))) + (set! gp-1 (the-as none 2)) + (set! v1-40 (the-as none #x3f000000)) + (set! f0-5 (the-as none (gpr->fpr v1-40))) + (set! v1-41 (the-as none (l.wu (+ s6-0 8)))) + (set! f1-3 (the-as none (l.f (+ v1-41 84)))) + (set! f0-6 (the-as none (+.s f0-5 f1-3))) + (set! f0-7 (the-as none (f2i f0-6))) + (set! v1-42 (the-as none (fpr->gpr f0-7))) + (set! gp-2 (the-as none (max.si gp-1 v1-42))) + (set! a0-12 (the-as none (l.wu (+ s6-0 8)))) + (set! v1-43 (the-as none (l.wu (+ a0-12 -4)))) + (set! t9-12 (the-as none (l.wu (+ v1-43 52)))) + (set! f0-8 (the-as none (gpr->fpr gp-2))) + (set! f0-9 (the-as none (i2f f0-8))) + (set! f0-10 (the-as none (/.s f30-0 f0-9))) + (set! a1-6 (the-as none (fpr->gpr f0-10))) + (call!) + (set! v1-44 (the-as none v0-12)) + (while (nonzero? gp-2) + (cond + ((begin (set! gp-2 (the-as none (+ gp-2 -1))) (set! v1-45 (the-as none (l.wu (+ s6-0 2292)))) v1-45) + (if (begin + (if (begin + (set! a0-13 (the-as none (+ s6-0 572))) + (set! v1-46 (the-as none tracking-spline)) + (set! t9-13 (the-as none (l.wu (+ v1-46 100)))) + (set! a1-7 (the-as none (+ s6-0 124))) + (set! a2-6 (the-as none #x4323d70a)) + (set! a3-3 (the-as none #x46000000)) + (set! t0-2 (the-as none #x3dcccccd)) + (call!) + (set! v1-47 (the-as none v0-13)) + (set! a1-8 (the-as none (+ sp-0 48))) + (set! v1-48 (the-as none s6-0)) + v1-48 + ) + (set! a0-14 (the-as none (l.wu (+ v1-48 24)))) + ) + (s.w! (+ a1-8 8) a0-14) + (s.w! (+ a1-8 68) 0) + (set! v1-49 (the-as none 'fast-rot)) + (s.w! (+ a1-8 64) v1-49) + (set! t9-14 (the-as none send-event-function)) + (set! a0-15 (the-as none *camera-combiner*)) + (call!) + (set! v1-50 (the-as none v0-14)) + (set! f0-11 (the-as none (l.f (+ s6-0 2108)))) + (set! v1-51 (the-as none #x45800000)) + (set! f1-4 (the-as none (gpr->fpr v1-51))) + (<.s f0-11 f1-4) + ) + (s.w! (+ s6-0 2292) #f) + ) + ) + (else + (cond + ((begin + (set! v1-54 (the-as none #x100000)) + (set! a0-16 (the-as none *camera*)) + (set! a0-17 (the-as none (l.wu (+ a0-16 128)))) + (set! a0-18 (the-as none (l.d (+ a0-17 112)))) + (set! v1-55 (the-as none (logand v1-54 a0-18))) + (nonzero? v1-55) + ) + (set! a0-19 (the-as none (+ s6-0 572))) + (set! v1-56 (the-as none tracking-spline)) + (set! t9-15 (the-as none (l.wu (+ v1-56 100)))) + (set! a1-9 (the-as none (+ s6-0 124))) + (set! a2-7 (the-as none #x45800000)) + (set! a3-4 (the-as none #x47200000)) + (set! t0-3 (the-as none #x3dcccccd)) + (call!) + (set! v1-57 (the-as none v0-15)) + ) + (else + (and (begin + (set! v1-58 (the-as none *camera*)) + (set! v1-59 (the-as none (l.wu (+ v1-58 128)))) + (set! v1-60 (the-as none (l.d (+ v1-59 112)))) + (set! v1-61 (the-as none (logand v1-60 8192))) + (nonzero? v1-61) + ) + (begin + (set! v1-63 (the-as none #t)) + (set! a0-20 (the-as none (l.wu (+ s6-0 2276)))) + (set! a0-21 (the-as none (logand a0-20 256))) + (cmove-#f-zero v1-62 a0-21 v1-63) + ) + ) + (cond + (v1-62 + (set! a0-22 (the-as none (+ s6-0 572))) + (set! v1-64 (the-as none tracking-spline)) + (set! t9-16 (the-as none (l.wu (+ v1-64 100)))) + (set! a1-10 (the-as none (+ s6-0 124))) + (set! a2-8 (the-as none #x42cccccd)) + (set! a3-5 (the-as none #x45800000)) + (set! t0-4 (the-as none #x3dcccccd)) + (call!) + (set! v1-65 (the-as none v0-16)) + ) + ((begin + (set! v1-66 (the-as none *camera*)) + (set! v1-67 (the-as none (l.wu (+ v1-66 128)))) + (set! v1-68 (the-as none (l.d (+ v1-67 112)))) + (set! v1-69 (the-as none (logand v1-68 8192))) + (nonzero? v1-69) + ) + (set! a0-23 (the-as none (+ s6-0 572))) + (set! v1-70 (the-as none tracking-spline)) + (set! t9-17 (the-as none (l.wu (+ v1-70 100)))) + (set! a1-11 (the-as none (+ s6-0 124))) + (set! a2-9 (the-as none #x4223d70a)) + (set! a3-6 (the-as none #x45800000)) + (set! t0-5 (the-as none #x3dcccccd)) + (call!) + (set! v1-71 (the-as none v0-17)) + ) + ((begin + (set! v1-72 (the-as none (l.wu (+ s6-0 2276)))) + (set! v1-73 (the-as none (logand v1-72 256))) + (nonzero? v1-73) + ) + (set! a0-24 (the-as none (+ s6-0 572))) + (set! v1-74 (the-as none tracking-spline)) + (set! t9-18 (the-as none (l.wu (+ v1-74 100)))) + (set! a1-12 (the-as none (+ s6-0 124))) + (set! v1-75 (the-as none *camera*)) + (set! v1-76 (the-as none (l.wu (+ v1-75 128)))) + (set! f0-12 (the-as none (l.f (+ v1-76 140)))) + (set! a2-10 (the-as none (fpr->gpr f0-12))) + (set! v1-77 (the-as none *camera*)) + (set! v1-78 (the-as none (l.wu (+ v1-77 128)))) + (set! f0-13 (the-as none (l.f (+ v1-78 136)))) + (set! a3-7 (the-as none (fpr->gpr f0-13))) + (set! t0-6 (the-as none #x3dcccccd)) + (call!) + (set! v1-79 (the-as none v0-18)) + ) + (else + (set! a0-25 (the-as none (+ s6-0 572))) + (set! v1-80 (the-as none tracking-spline)) + (set! t9-19 (the-as none (l.wu (+ v1-80 100)))) + (set! a1-13 (the-as none (+ s6-0 124))) + (set! v1-81 (the-as none *camera*)) + (set! v1-82 (the-as none (l.wu (+ v1-81 128)))) + (set! f0-14 (the-as none (l.f (+ v1-82 132)))) + (set! a2-11 (the-as none (fpr->gpr f0-14))) + (set! v1-83 (the-as none *camera*)) + (set! v1-84 (the-as none (l.wu (+ v1-83 128)))) + (set! f0-15 (the-as none (l.f (+ v1-84 128)))) + (set! a3-8 (the-as none (fpr->gpr f0-15))) + (set! t0-7 (the-as none #x3dcccccd)) + (call!) + (set! v1-85 (the-as none v0-19)) + ) + ) + ) + ) + ) + ) + ) + (set! a0-26 (the-as none (l.wu (+ s6-0 8)))) + (set! v1-88 (the-as none (l.wu (+ a0-26 -4)))) + (set! t9-20 (the-as none (l.wu (+ v1-88 52)))) + (set! a1-14 (the-as none (fpr->gpr f30-0))) + (set! v0-20 (the-as none (call!))) + (ret-value v0-20) + ) + +;; definition for function set-string-params +;; INFO: Used lq/sq +(defbehavior set-string-params camera-slave () + (when (not (or (-> self string-val-locked) (logtest? #x40000 (-> self options)))) + (set! (-> self string-min-val quad) (-> *camera* string-min value quad)) + (let ((v0-0 (-> self string-max-val))) + (set! (-> v0-0 quad) (-> *camera* string-max value quad)) + v0-0 + ) + ) + ) + +;; failed to figure out what this is: +(defstate cam-string (camera-slave) + :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 'get-behind) + (set! (-> self butt-timer) (the-as uint (+ (-> self clock frame-counter) (seconds 0.25)))) + (set! (-> self butt-seek) (the-as basic #t)) + (set! v0-0 (the-as none (-> self butt-vector))) + (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> arg3 param 0)) quad)) + v0-0 + ) + ((= v1-0 'teleport) + (let ((gp-0 (new-stack-vector0))) + (cam-string-find-position-rel! gp-0) + (cam-string-set-position-rel! gp-0) + ) + ) + ((= v1-0 'joystick) + (set! (-> self phony-joystick-x) (the-as float (-> arg3 param 0))) + (set! (-> self phony-joystick-y) (the-as float (-> arg3 param 1))) + (set! v0-0 (the-as none #t)) + (set! (-> self have-phony-joystick) (the-as basic v0-0)) + v0-0 + ) + ((= v1-0 'tween-dist) + (cond + ((-> arg3 param 0) + (set! (-> self string-val-locked) (the-as basic #t)) + (let ((s5-0 (the-as object (-> arg3 param 0))) + (gp-1 (the-as object (-> arg3 param 1))) + ) + (if (!= (-> (the-as vector s5-0) y) 4095996000.0) + (seek! + (-> self string-min-val y) + (-> (the-as vector s5-0) y) + (* (-> (the-as vector s5-0) w) (-> self clock seconds-per-frame)) + ) + ) + (if (!= (-> (the-as vector s5-0) z) 4095996000.0) + (seek! + (-> self string-min-val z) + (-> (the-as vector s5-0) z) + (* (-> (the-as vector s5-0) w) (-> self clock seconds-per-frame)) + ) + ) + (if (!= (-> (the-as vector gp-1) y) 4095996000.0) + (seek! + (-> self string-max-val y) + (-> (the-as vector gp-1) y) + (* (-> (the-as vector gp-1) w) (-> self clock seconds-per-frame)) + ) + ) + (if (!= (-> (the-as vector gp-1) z) 4095996000.0) + (seek! + (-> self string-max-val z) + (-> (the-as vector gp-1) z) + (* (-> (the-as vector gp-1) w) (-> self clock seconds-per-frame)) + ) + ) + ) + (set! (-> self string-max-val x) (fmax (-> self string-max-val x) (-> self string-min-val x))) + (set! (-> self string-max-val y) (fmax (-> self string-max-val y) (-> self string-min-val y))) + (let ((f0-31 (fmax (-> self string-max-val z) (-> self string-min-val z)))) + (set! (-> self string-max-val z) f0-31) + f0-31 + ) + ) + (else + (set! (-> self string-val-locked) #f) + #f + ) + ) + ) + ((= v1-0 'set-dist) + (cond + ((-> arg3 param 0) + (set! (-> self string-val-locked) (the-as basic #t)) + (set! (-> self string-min-val quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (set! (-> self string-max-val quad) (-> (the-as vector (-> arg3 param 1)) quad)) + (set! (-> self string-max-val x) (fmax (-> self string-max-val x) (-> self string-min-val x))) + (set! (-> self string-max-val y) (fmax (-> self string-max-val y) (-> self string-min-val y))) + (let ((f0-37 (fmax (-> self string-max-val z) (-> self string-min-val z)))) + (set! (-> self string-max-val z) f0-37) + f0-37 + ) + ) + (else + (set! (-> self string-val-locked) #f) + #f + ) + ) + ) + ((= v1-0 'relative-position) + (cond + ((-> arg3 param 0) + (set! (-> self string-val-locked) (the-as basic #t)) + (set! (-> self string-relative) (the-as basic #t)) + (set! v0-0 (the-as none (-> self relative-position))) + (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> arg3 param 0)) quad)) + v0-0 + ) + (else + (set! (-> self string-val-locked) #f) + (set! (-> self string-relative) #f) + #f + ) + ) + ) + ((= v1-0 'set-max-angle-offset) + (let ((f0-38 (the-as float (-> arg3 param 0)))) + (set! (-> self max-angle-offset) f0-38) + f0-38 + ) + ) + ((= v1-0 'blocked-side?) + (-> self los-state) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :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)) + ) + (vector-reset! (-> self joystick-saved-view-off)) + (set-string-params) + (set! (-> self string-vel-dir) (the-as uint 0)) + (set! (-> self fov) 11650.845) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (set! (-> self min-z-override) (-> self string-max-val z)) + (if (!= (-> *camera* outro-t-step) 0.0) + (set! (-> self min-z-override) (-> self string-min-val z)) + ) + (let ((gp-1 (new-stack-vector0))) + 0.0 + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (let ((f0-7 (-> self string-min-val y)) + (f1-1 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-7 f1-1 (-> self view-off-param))) + ) + (set! (-> self view-off z) + (lerp (-> self string-min-val z) (-> self string-max-val z) (-> self view-off-param)) + ) + (let ((f30-0 + (cond + ((!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! gp-1 (-> *camera* outro-exit-value) (-> *camera* outro-curve)) + (vector-! gp-1 gp-1 (-> *camera* tpos-curr-adj)) + (vector-flatten! (-> self view-flat) gp-1 (-> *camera* local-down)) + (vector-length (-> self view-flat)) + ) + ((-> *camera* settings string-use-startup-vector) + (vector-flatten! (-> self view-flat) (-> *camera* settings string-startup-vector) (-> *camera* local-down)) + (vector-length (-> self view-flat)) + ) + (else + (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (-> self view-off z) + ) + ) + ) + ) + (let ((f1-4 (fmin (-> *camera* string-push-z) (-> self min-z-override))) + (f0-17 (-> self view-off z)) + ) + (cond + ((< f30-0 f1-4) + (set! f30-0 f1-4) + ) + ((< f0-17 f30-0) + (set! f30-0 f0-17) + ) + ) + ) + (vector-normalize! (-> self view-flat) f30-0) + (let ((f30-1 (/ (- f30-0 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))))) + (if (< 1.0 f30-1) + (set! f30-1 1.0) + ) + (if (< f30-1 0.0) + (set! f30-1 0.0) + ) + (let ((f0-22 (-> self string-min-val y)) + (f1-7 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-22 f1-7 f30-1)) + ) + (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) f30-1)) + ) + ) + ) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* settings target-height) (-> self view-off y)) + ) + (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) + (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)) + (set! (-> s5-0 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (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)) + ) + (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) + ) + ) + ) + (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)) + (let ((f0-32 (vector-length (-> self view-flat)))) + (cond + ((< f0-32 8192.0) + (let ((gp-3 (new-stack-vector0))) + (cam-string-find-position-rel! gp-3) + (cam-string-set-position-rel! gp-3) + ) + ) + (else + (if (< f0-32 (-> self min-z-override)) + (set! (-> self min-z-override) f0-32) + ) + (let ((f30-2 (/ (- f0-32 (-> self string-min-val z)) (- (-> self string-max-val z) (-> self string-min-val z))))) + (if (< 1.0 f30-2) + (set! f30-2 1.0) + ) + (if (< f30-2 0.0) + (set! f30-2 0.0) + ) + (let ((f0-36 (-> self string-min-val y)) + (f1-16 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-36 f1-16 f30-2)) + ) + (set! (-> self view-off z) (lerp (-> self string-min-val z) (-> self string-max-val z) f30-2)) + ) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* settings target-height) (-> self view-off y)) + ) + (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + ) + ) + ) + ) + ) + ) + (set! (-> self trans quad) (-> self string-trans quad)) + (set! (-> self los-last-pos quad) (-> self string-trans quad)) + (tracking-spline-method-10 (-> self position-spline) (-> self string-trans)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (until #f + (when (not (paused?)) + (set-string-params) + (cam-string-code) + (tracking-spline-method-9 (-> self position-spline)) + (set! (-> self have-phony-joystick) #f) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; definition of type cam-stick-bank +(deftype cam-stick-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type cam-stick-bank +(defmethod inspect cam-stick-bank ((obj cam-stick-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tmax-z: (meters ~m)~%" (-> obj max-z)) + (format #t "~1Tmin-z: (meters ~m)~%" (-> obj min-z)) + (format #t "~1Tmax-y: (meters ~m)~%" (-> obj max-y)) + (format #t "~1Tmin-y: (meters ~m)~%" (-> obj min-y)) + (label cfg-4) + obj + ) + +;; definition for symbol *CAM_STICK-bank*, type cam-stick-bank +(define *CAM_STICK-bank* + (new 'static 'cam-stick-bank :max-z (meters 30) :min-z (meters 5) :max-y (meters 15) :min-y (meters 2)) + ) + +;; definition for function cam-stick-code +;; ERROR: function has no type analysis. Cannot decompile. + +;; failed to figure out what this is: +(defstate cam-stick (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (set! (-> self view-off y) + (lerp (-> *CAM_STICK-bank* min-y) (-> *CAM_STICK-bank* max-y) (-> self view-off-param)) + ) + (set! (-> self view-off z) + (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param)) + ) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) + (vector+! (-> self desired-pos) (-> self desired-pos) (-> self tracking follow-pt)) + (set! (-> self trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + ) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (when (not (paused?)) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05))) + (cond + ((< (* 0.05 (- 1.0 (-> self view-off-param))) f0-0) + (+! (-> self view-off-param) (* 0.05 (- 1.0 (-> self view-off-param)))) + ) + ((< f0-0 (* 0.05 (- (-> self view-off-param)))) + (+! (-> self view-off-param) (* 0.05 (- (-> self view-off-param)))) + ) + (else + (+! (-> self view-off-param) f0-0) + ) + ) + ) + ) + (set! (-> self view-off y) + (lerp (-> *CAM_STICK-bank* min-y) (-> *CAM_STICK-bank* max-y) (-> self view-off-param)) + ) + (set! (-> self view-off z) + (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param)) + ) + (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((f0-16 (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + 128.0 + 32.0 + 110.0 + (* 21845.334 (-> self clock seconds-per-frame)) + ) + ) + (gp-0 (new-stack-matrix0)) + (s3-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + (s4-0 (new-stack-vector0)) + ) + (cond + ((!= f0-16 0.0) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-16) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + ((logtest? (-> self options) 1) + (set-vector! s5-0 0.0 0.0 1.0 1.0) + (vector-normalize-copy! s5-0 (-> self view-flat) 1.0) + (set! (-> s3-0 quad) (-> (the-as vector (&-> *camera* stack 256)) quad)) + (vector-flatten! s3-0 s3-0 (-> *camera* local-down)) + (vector-negate! s3-0 s3-0) + (set! (-> s4-0 quad) (-> s5-0 quad)) + (vector-normalize-copy! s4-0 s3-0 1.0) + (matrix-from-two-vectors-max-angle-partial! + gp-0 + s5-0 + s4-0 + (* 10922.667 (-> self clock seconds-per-frame)) + 0.05 + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + ) + ) + ) + ) + (none) + ) + ) + +;; definition of type cam-bike-bank +(deftype cam-bike-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type cam-bike-bank +(defmethod inspect cam-bike-bank ((obj cam-bike-bank)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tmin-z: (meters ~m)~%" (-> obj max-z)) + (format #t "~1Tmax-z: (meters ~m)~%" (-> obj min-z)) + (format #t "~1Tmin-y: (meters ~m)~%" (-> obj max-y)) + (format #t "~1Tmax-y: (meters ~m)~%" (-> obj min-y)) + (label cfg-4) + obj + ) + +;; definition for symbol *CAM_BIKE-bank*, type cam-bike-bank +(define *CAM_BIKE-bank* + (new 'static 'cam-bike-bank :max-z (meters 6) :min-z (meters 10) :max-y (meters 3) :min-y (meters 5)) + ) + +;; definition for function cam-calc-bike-follow! +(defbehavior cam-calc-bike-follow! camera-slave ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) + (vector-float*! (-> arg0 follow-off) (the-as vector (&-> *camera* stack 320)) 155648.0) + (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ 12288.0 (-> *camera* settings target-height)) + ) + (-> arg0 follow-pt) + ) + +;; definition for function cam-bike-code +;; ERROR: function has no type analysis. Cannot decompile. + +;; failed to figure out what this is: +(defstate cam-bike (camera-slave) + :event (the-as + (function process int symbol event-message-block object :behavior camera-slave) + cam-standard-event-handler + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (set-setting! 'head-offset 'abs #x46800000 0) + (set-setting! 'foot-offset 'abs #x45800000 0) + (set! (-> self view-off x) 0.0) + (set! (-> self view-off y) (-> *CAM_BIKE-bank* max-y)) + (set! (-> self view-off z) (-> *CAM_BIKE-bank* max-z)) + (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) + (vector+! (-> self desired-pos) (-> self desired-pos) (-> *camera* tpos-curr-adj)) + (set! (-> self trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) + (cam-calc-bike-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + ) + (none) + ) + :exit (behavior () + (remove-setting! 'head-offset) + (remove-setting! 'foot-offset) + (none) + ) + :trans (behavior () + (if (zero? (logand (-> *camera* master-options) 1)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-update_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-update_REF.gc new file mode 100644 index 0000000000..4e6f73156e --- /dev/null +++ b/test/decompiler/reference/jak2/engine/camera/cam-update_REF.gc @@ -0,0 +1,1339 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function plane-from-points +(defun plane-from-points ((arg0 (inline-array plane)) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 int)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-cross! s4-0 arg1 arg2) + (vector-normalize! s4-0 1.0) + (set! (-> s4-0 w) (vector-dot s4-0 arg3)) + (set! (-> (&-> arg0 0 data arg4) 0) (-> s4-0 x)) + (set! (-> (&-> arg0 0 data arg4) 4) (-> s4-0 y)) + (set! (-> (&-> arg0 0 data arg4) 8) (-> s4-0 z)) + (let ((f0-5 (-> s4-0 w))) + (set! (-> (&-> arg0 0 data arg4) 12) f0-5) + f0-5 + ) + ) + ) + +;; definition for function set-point +(defun set-point ((arg0 vector) (arg1 float) (arg2 float) (arg3 float)) + (set! (-> arg0 x) arg1) + (set! (-> arg0 y) arg2) + (set! (-> arg0 z) arg3) + (let ((f0-3 1.0)) + (set! (-> arg0 w) f0-3) + f0-3 + ) + ) + +;; definition for function update-view-planes +;; INFO: Used lq/sq +(defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float) (arg3 matrix)) + (local-vars (sv-240 vector)) + (when (not *artist-fix-frustum*) + (let ((s5-0 (new 'stack 'view-frustum))) + (let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d))) + (f26-0 (* arg2 (-> arg0 y-ratio) (-> arg0 d))) + (f28-0 (* arg2 (-> arg0 x-ratio) (-> arg0 f))) + (f24-0 (* arg2 (-> arg0 y-ratio) (-> arg0 f))) + ) + (set-point (-> s5-0 hither-top-left) (- f30-0) f26-0 (-> arg0 d)) + (set-point (-> s5-0 hither-top-right) f30-0 f26-0 (-> arg0 d)) + (set-point (-> s5-0 hither-bottom-left) (- f30-0) (- f26-0) (-> arg0 d)) + (set-point (-> s5-0 hither-bottom-right) f30-0 (- f26-0) (-> arg0 d)) + (set-point (-> s5-0 yon-top-left) (- f28-0) f24-0 (-> arg0 f)) + (set-point (-> s5-0 yon-top-right) f28-0 f24-0 (-> arg0 f)) + (set-point (-> s5-0 yon-bottom-left) (- f28-0) (- f24-0) (-> arg0 f)) + (set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f)) + ) + (vector-matrix*! (-> s5-0 hither-top-left) (-> s5-0 hither-top-left) arg3) + (vector-matrix*! (-> s5-0 hither-top-right) (-> s5-0 hither-top-right) arg3) + (vector-matrix*! (-> s5-0 hither-bottom-left) (-> s5-0 hither-bottom-left) arg3) + (vector-matrix*! (-> s5-0 hither-bottom-right) (-> s5-0 hither-bottom-right) arg3) + (vector-matrix*! (-> s5-0 yon-top-left) (-> s5-0 yon-top-left) arg3) + (vector-matrix*! (-> s5-0 yon-top-right) (-> s5-0 yon-top-right) arg3) + (vector-matrix*! (-> s5-0 yon-bottom-left) (-> s5-0 yon-bottom-left) arg3) + (vector-matrix*! (-> s5-0 yon-bottom-right) (-> s5-0 yon-bottom-right) arg3) + (when (= arg2 1.0) + (vector-! (the-as vector (-> *fog-texture-work* corner)) (-> s5-0 yon-top-left) (-> arg3 trans)) + (vector-! (-> *fog-texture-work* corner 1) (-> s5-0 yon-top-right) (-> arg3 trans)) + (vector-! (-> *fog-texture-work* corner 2) (-> s5-0 yon-bottom-left) (-> arg3 trans)) + (vector-! (-> *fog-texture-work* corner 3) (-> s5-0 yon-bottom-right) (-> arg3 trans)) + ) + (let ((s2-1 (new-stack-vector0)) + (s3-1 (new-stack-vector0)) + (s1-0 (new-stack-vector0)) + (s0-0 (new-stack-vector0)) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (set! (-> sv-240 quad) (the-as uint128 0)) + (let ((v1-15 (-> arg3 trans quad))) + (set! (-> sv-240 quad) v1-15) + ) + (vector-! s2-1 (-> s5-0 yon-top-left) sv-240) + (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) + (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) + (vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240) + (plane-from-points arg1 s2-1 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-1 sv-240 2) + (let ((t9-20 plane-from-points) + (t0-3 3) + ) + (t9-20 arg1 s1-0 s0-0 sv-240 t0-3) + ) + ) + ) + ) + ) + +;; definition for symbol *update-leaf-when-outside-bsp*, type symbol +(define *update-leaf-when-outside-bsp* #t) + +;; definition for function update-visible +;; INFO: Used lq/sq +;; ERROR: failed type prop at 290: Could not figure out load: (set! v1 (l.w s3)) +(defun update-visible ((a0-0 math-camera)) + (local-vars + (v0-0 none) + (v0-1 none) + (v0-2 none) + (v0-3 none) + (v0-4 none) + (v0-5 object) + (v0-6 none) + (v0-7 none) + (v0-8 none) + (v0-9 symbol) + (v1-0 symbol) + (v1-2 int) + (v1-3 int) + (v1-4 int) + (v1-5 level) + (v1-6 level-group) + (v1-7 int) + (v1-10 int) + (v1-11 int) + (v1-12 int) + (v1-13 symbol) + (v1-15 bsp-header) + (v1-16 int) + (v1-17 int) + (v1-18 symbol) + (v1-19 symbol) + (v1-20 symbol) + (v1-21 symbol) + (v1-22 symbol) + (v1-23 symbol) + (v1-24 level-vis-info) + (v1-25 bsp-header) + (v1-26 symbol) + (v1-28 symbol) + (v1-29 int) + (v1-30 int) + (v1-31 int) + (v1-32 symbol) + (v1-33 symbol) + (v1-34 symbol) + (v1-37 type) + (v1-38 none) + (v1-40 int) + (v1-44 symbol) + (v1-45 symbol) + (v1-46 level-group) + (v1-48 bsp-header) + (v1-50 bsp-header) + (v1-52 level-group) + (v1-53 int) + (v1-56 symbol) + (v1-57 symbol) + (v1-58 symbol) + (v1-60 int) + (v1-61 int) + (v1-62 int) + (v1-63 int) + (v1-64 int) + (v1-65 int) + (v1-66 symbol) + (v1-68 symbol) + (v1-69 symbol) + (v1-70 symbol) + (v1-71 symbol) + (v1-72 int) + (v1-73 int) + (v1-74 bsp-header) + (v1-75 bsp-header) + (v1-76 bsp-header) + (v1-77 uint) + (v1-78 bsp-header) + (v1-79 uint) + (v1-81 none) + (v1-82 symbol) + (v1-83 symbol) + (v1-84 symbol) + (v1-86 bsp-header) + (v1-87 bsp-header) + (v1-88 bsp-header) + (v1-89 uint) + (v1-91 none) + (v1-92 none) + (v1-93 none) + (v1-94 none) + (v1-95 none) + (v1-96 none) + (v1-97 none) + (v1-98 none) + (v1-99 none) + (v1-102 none) + (v1-103 none) + (v1-105 none) + (v1-106 none) + (v1-107 none) + (v1-108 none) + (v1-109 none) + (v1-111 none) + (v1-112 none) + (v1-115 level-group) + (v1-116 int) + (a0-1 level-group) + (a0-2 symbol) + (a0-4 bsp-header) + (a0-5 (inline-array bsp-node)) + (a0-6 symbol) + (a0-7 symbol) + (a0-9 bsp-header) + (a0-11 level-group) + (a0-12 symbol) + (a0-13 pointer) + (a0-14 symbol) + (a0-15 basic) + (a0-17 int) + (a0-18 int) + (a0-19 int) + (a0-20 uint) + (a0-23 symbol) + (a0-24 level) + (a0-25 int) + (a0-26 int) + (a0-27 level-vis-info) + (a0-28 symbol) + (a0-29 symbol) + (a0-30 pointer) + (a0-31 pointer) + (a0-32 cpad-list) + (a0-33 cpad-info) + (a0-34 pad-buttons) + (a0-35 pad-buttons) + (a0-36 level-group) + (a0-37 symbol) + (a0-38 int) + (a0-39 int) + (a0-40 string) + (a0-41 int) + (a0-42 int) + (a0-43 none) + (a0-45 none) + (a0-47 none) + (a0-49 none) + (a0-50 none) + (a0-51 none) + (a0-52 none) + (a0-53 none) + (a0-54 none) + (a0-55 none) + (a0-56 none) + (a0-57 none) + (a0-58 none) + (a0-59 none) + (a0-60 none) + (a0-61 none) + (a0-62 none) + (a0-63 none) + (a0-64 none) + (a0-65 none) + (a0-66 none) + (a0-67 none) + (a0-68 none) + (a0-69 none) + (a0-70 none) + (a0-71 none) + (a0-72 none) + (a0-73 none) + (a0-74 none) + (a0-75 none) + (a0-76 none) + (a0-77 none) + (a0-78 none) + (a0-79 none) + (a0-80 none) + (a0-81 none) + (a0-82 none) + (a0-83 none) + (a1-0 symbol) + (a1-1 vector) + (a1-2 (pointer uint16)) + (a1-3 vis-info-flag) + (a1-4 bsp-header) + (a1-5 uint) + (a1-9 int) + (a1-10 (pointer uint16)) + (a1-11 (pointer uint16)) + (a1-12 int) + (a1-13 int) + (a1-14 string) + (a1-15 int) + (a1-16 int) + (a1-17 none) + (a1-18 none) + (a1-19 none) + (a1-20 none) + (a1-21 none) + (a1-22 none) + (a1-23 none) + (a1-24 none) + (a1-25 none) + (a1-26 none) + (a1-27 none) + (a1-28 none) + (a1-29 none) + (a1-30 none) + (a1-31 none) + (a1-32 none) + (a1-33 none) + (a1-34 none) + (a1-35 none) + (a1-36 none) + (a1-37 none) + (a1-38 none) + (a1-39 none) + (a1-40 none) + (a1-41 none) + (a2-0 int) + (a2-1 uint) + (a2-2 int) + (a2-4 symbol) + (a2-5 int) + (a2-7 none) + (a2-8 none) + (a2-9 none) + (a3-0 uint) + (a3-1 int) + (a3-2 int) + (a3-3 int) + (a3-4 none) + (a3-5 none) + (a3-6 none) + (t0-0 int) + (t0-2 uint) + (t0-3 none) + (t0-4 none) + (t0-5 none) + (t1-0 uint) + (t2-0 string) + (t3-0 string) + (s2-0 int) + (s3-0 uint) + (s4-0 level-vis-info) + (s4-1 uint) + (s5-0 int) + (s5-1 level) + (s5-2 level) + (t9-0 (function bsp-header vector none)) + (t9-1 (function pointer pointer int none)) + (t9-2 (function none)) + (t9-3 (function pointer pointer int none)) + (t9-4 (function pointer pointer int none)) + (t9-5 (function _varargs_ object)) + (t9-6 none) + (t9-7 none) + (t9-8 none) + (gp-1 int) + (gp-2 int) + (sp-0 none) + (f0-0 none) + (f0-1 none) + (f0-2 none) + (f0-3 none) + (f0-4 none) + (f0-5 none) + (f0-6 none) + (f0-7 none) + (f0-8 none) + (f0-9 none) + (f0-10 none) + (f0-11 none) + (f0-12 none) + (f0-13 none) + (f0-14 none) + (f0-15 none) + (f0-16 none) + (f0-17 none) + (f0-18 none) + (f0-19 none) + (f0-20 none) + (f0-21 none) + (f0-22 none) + (f0-23 none) + (f0-24 none) + (f0-25 none) + (f1-0 none) + (f1-1 none) + (f1-2 none) + (f1-3 none) + (f1-4 none) + (f1-5 none) + (f1-6 none) + (f1-7 none) + (f1-8 none) + (f1-9 none) + (f1-10 none) + (f1-11 none) + (f1-12 none) + (f1-13 none) + (f1-14 none) + (f1-15 none) + (f1-16 none) + (f1-17 none) + (f1-18 none) + (f1-19 none) + (f1-20 none) + (f1-21 none) + (f1-22 none) + (f1-23 none) + (f1-24 none) + (f1-25 none) + (f1-26 none) + (f1-27 none) + (f1-28 none) + (f1-29 none) + (f1-30 none) + (f1-31 none) + (f1-32 none) + (f1-33 none) + (f1-34 none) + (f1-35 none) + (f1-36 none) + (f1-37 none) + (f1-38 none) + (f1-39 none) + (f1-40 none) + (f1-41 none) + (f1-42 none) + (f1-43 none) + (f1-44 none) + (f1-45 none) + (f1-46 none) + (f1-47 none) + ) + (when (begin (set! v1-0 *artist-fix-visible*) (not v1-0)) + (set! s5-0 0) + (while (begin (set! v1-6 *level*) (set! v1-7 (-> v1-6 length)) (<.si s5-0 v1-7)) + (when (begin + (set! v1-2 5232) + (set! v1-3 (*.si v1-2 s5-0)) + (set! v1-4 (+ v1-3 256)) + (set! a0-1 *level*) + (set! v1-5 (+ v1-4 a0-1)) + (set! a0-2 'active) + (set! a1-0 (-> v1-5 status)) + (= a1-0 a0-2) + ) + (when (begin + (and (begin (set! a0-4 (-> v1-5 bsp)) (set! a0-5 (-> a0-4 nodes)) (nonzero? a0-5)) + (or (begin (set! a0-7 *update-leaf-when-outside-bsp*) a0-7) (set! a0-6 (-> v1-5 inside-boxes))) + ) + a0-6 + ) + (set! t9-0 bsp-camera-asm) + (set! a0-9 (-> v1-5 bsp)) + (set! a1-1 (-> a0-0 trans)) + (call! a0-9 a1-1) + (set! a0-10 v0-0) + ) + ) + (set! s5-0 (+ s5-0 1)) + ) + (set! gp-1 0) + (while (begin (set! v1-52 *level*) (set! v1-53 (-> v1-52 length)) (<.si gp-1 v1-53)) + (when (begin + (set! v1-10 5232) + (set! v1-11 (*.si v1-10 gp-1)) + (set! v1-12 (+ v1-11 256)) + (set! a0-11 *level*) + (set! s5-1 (+ v1-12 a0-11)) + (set! v1-13 'active) + (set! a0-12 (-> s5-1 status)) + (= a0-12 v1-13) + ) + (cond + ((begin + (or (begin + (if (begin + (set! v1-15 (-> s5-1 bsp)) + (set! v1-16 (-> v1-15 visible-list-length)) + (set! v1-17 (+ v1-16 15)) + (set! a2-0 (sra v1-17 4)) + (set! v1-18 (-> s5-1 all-visible?)) + v1-18 + ) + (set! v1-19 (-> s5-1 all-visible?)) + (set! v1-19 #t) + ) + (set! (-> s5-1 all-visible?) v1-19) + (set! v1-20 (-> s5-1 force-all-visible?)) + (not v1-20) + ) + (set! v1-21 (-> s5-1 inside-boxes)) + ) + v1-21 + ) + (cond + ((begin + (or (begin (set! v1-22 *artist-all-visible*) v1-22) + (begin (set! v1-24 (-> s5-1 vis-info 0)) (set! v1-23 (not v1-24))) + ) + v1-23 + ) + (when (begin + (set! t9-1 quad-copy!) + (set! a0-13 (-> s5-1 vis-bits)) + (set! v1-25 (-> s5-1 bsp)) + (set! a1-2 (-> v1-25 all-visible-list)) + (call! a0-13 a1-2 a2-0) + (set! v1-26 'loading) + (set! a0-14 (-> s5-1 all-visible?)) + (= a0-14 v1-26) + ) + (set! v1-28 #t) + (set! (-> s5-1 all-visible?) v1-28) + ) + ) + ((begin + (when (begin + (and (begin + (set! v1-29 (-> s5-1 vis-self-index)) + (set! v1-30 (sll v1-29 2)) + (set! v1-31 (+ v1-30 s5-1)) + (set! s4-0 (dynamic-array-field-access v1-31 vis-info PLACEHOLDER)) + (set! v1-32 #f) + s4-0 + ) + (set! a0-15 (-> s4-0 from-bsp)) + ) + a0-15 + ) + (when (begin + (set! v1-33 #t) + (set! a0-17 #x8000) + (set! a0-18 (sll a0-17 16)) + (set! a1-3 (-> s4-0 flags)) + (set! a0-19 (logand a0-18 a1-3)) + (cmove-#f-zero v1-32 a0-19 v1-33) + (set! a0-20 (-> s4-0 length)) + (set! a1-4 (-> s4-0 from-bsp)) + (set! a1-5 (-> a1-4 current-leaf-idx)) + (<.ui a0-20 a1-5) + ) + (set! v1-32 #f) + (set! a0-22 v1-32) + ) + ) + v1-32 + ) + (when (begin + (if (begin (set! v1-34 'loading) (set! a0-23 (-> s5-1 all-visible?)) (!= a0-23 v1-34)) + (set! (-> s5-1 all-visible?) #f) + ) + (set! a0-24 s5-1) + (set! v1-37 (-> a0-24 type)) + (set! t9-2 (method-of-type v1-37 level-method-16)) + (set! a1-6 s4-0) + (set! a2-1 (-> s4-0 ramdisk)) + (set! a3-0 (-> s4-0 string-block)) + (set! v0-2 (call!)) + (set! v1-38 v0-2) + v1-38 + ) + (set! v1-40 8) + (while (nonzero? v1-40) + (when (begin + (set! v1-40 (+ v1-40 -1)) + (set! a0-25 (sll v1-40 2)) + (set! a0-26 (+ a0-25 s5-1)) + (set! a0-27 (dynamic-array-field-access a0-26 vis-info PLACEHOLDER)) + a0-27 + ) + (when (!= a0-27 s4-0) + (set! a1-9 -1) + (set! (-> a0-27 current-vis-string) (the-as uint a1-9)) + ) + ) + ) + (set! (-> s5-1 all-visible?) #f) + ) + ) + (else + (and (begin (set! v1-44 (-> s5-1 all-visible?)) (set! a0-28 'loading) (set! a0-29 (= v1-44 a0-28)) a0-29) + (begin (set! v1-46 *level*) (set! v1-45 (-> v1-46 play?))) + ) + (cond + (v1-45 + ) + (else + (set! t9-3 quad-copy!) + (set! a0-30 (-> s5-1 vis-bits)) + (set! v1-48 (-> s5-1 bsp)) + (set! a1-10 (-> v1-48 all-visible-list)) + (call! a0-30 a1-10 a2-0) + (set! v1-49 v0-3) + ) + ) + ) + ) + ) + (else + (set! t9-4 quad-copy!) + (set! a0-31 (-> s5-1 vis-bits)) + (set! v1-50 (-> s5-1 bsp)) + (set! a1-11 (-> v1-50 all-visible-list)) + (call! a0-31 a1-11 a2-0) + (set! v1-51 v0-4) + ) + ) + ) + (set! gp-1 (+ gp-1 1)) + ) + ) + (when (begin + (and (begin (set! v1-56 *artist-fix-visible*) v1-56) (begin + (set! v1-58 #t) + (set! a0-32 *cpad-list*) + (set! a0-33 (-> a0-32 cpads 0)) + (set! a0-34 (-> a0-33 button0-rel 0)) + (set! a0-35 (logand a0-34 512)) + (cmove-#f-zero v1-57 a0-35 v1-58) + ) + ) + v1-57 + ) + (set! v1-60 *fix-visible-level-mask*) + (set! v1-61 (+ v1-60 1)) + (set! v1-62 (logand v1-61 63)) + (set! *fix-visible-level-mask* v1-62) + ) + (set! gp-2 0) + (while (begin (set! v1-115 *level*) (set! v1-116 (-> v1-115 length)) (<.si gp-2 v1-116)) + (when (begin + (set! v1-63 5232) + (set! v1-64 (*.si v1-63 gp-2)) + (set! v1-65 (+ v1-64 256)) + (set! a0-36 *level*) + (set! s5-2 (+ v1-65 a0-36)) + (set! v1-66 'active) + (set! a0-37 (-> s5-2 status)) + (= a0-37 v1-66) + ) + (when (begin + (cond + ((begin (or (begin (set! v1-68 *artist-fix-visible*) v1-68) (set! v1-69 *stats-bsp*)) v1-69) + (set! v1-70 #t) + (set! a0-38 *fix-visible-level-mask*) + (set! a1-12 1) + (set! a2-2 (-> s5-2 index)) + (set! a1-13 (ash.si a1-12 a2-2)) + (set! a0-39 (logand a0-38 a1-13)) + (cmove-#f-nonzero v1-71 a0-39 v1-70) + (set! (-> s5-2 render?) v1-71) + (set! t9-5 format) + (set! a0-40 *stdcon*) + (set! a1-14 L105) + (set! a2-4 (-> s5-2 name)) + (set! v1-72 *fix-visible-level-mask*) + (set! a3-1 1) + (set! t0-0 (-> s5-2 index)) + (set! a3-2 (ash.si a3-1 t0-0)) + (if (begin (set! v1-73 (logand v1-72 a3-2)) (zero? v1-73)) + (set! a3-3 88) + (set! a3-3 (the-as int 32)) + ) + (if (begin + (set! v1-74 (-> s5-2 bsp)) + (set! t0-2 (-> v1-74 current-leaf-idx)) + (set! v1-75 (-> s5-2 bsp)) + (set! t1-0 (-> v1-75 unk-half-word)) + (set! v1-76 (-> s5-2 bsp)) + (set! v1-77 (-> v1-76 unk-byte2)) + (zero? v1-77) + ) + (set! t2-0 L104) + (set! t2-0 (the-as string L103)) + ) + (if (begin (set! v1-78 (-> s5-2 bsp)) (set! v1-79 (-> v1-78 unk-byte1)) (nonzero? v1-79)) + (set! t3-0 L102) + (set! t3-0 (the-as string L101)) + ) + (call! a0-40 a1-14 a2-4 a3-3 t0-2 t1-0 t2-0 t3-0) + (set! v1-80 v0-5) + ) + (else + (set! v1-81 (the-as none #t)) + (set! (-> s5-2 render?) (the-as symbol v1-81)) + ) + ) + (and (begin (set! v1-82 *artist-fix-visible*) v1-82) (begin + (set! v1-84 #t) + (set! a0-41 *fix-visible-level-mask*) + (set! a1-15 1) + (set! a2-5 (-> s5-2 index)) + (set! a1-16 (ash.si a1-15 a2-5)) + (set! a0-42 (logand a0-41 a1-16)) + (cmove-#f-nonzero v1-83 a0-42 v1-84) + ) + ) + v1-83 + ) + (when (begin + (set! v1-86 (-> s5-2 bsp)) + (set! s4-1 (-> v1-86 current-leaf-idx)) + (set! v1-87 (-> s5-2 bsp)) + (set! s3-0 (-> v1-87 unk-data-8 9)) + (set! v1-88 (-> s5-2 bsp)) + (set! v1-89 (-> v1-88 unk-data-8 17)) + (nonzero? s3-0) + ) + (set! s2-0 0) + (while (begin (set! v1-99 (the-as none (l.w s3-0))) (<.si s2-0 v1-99)) + (when (begin + (set! v1-91 (the-as none (sll s2-0 4))) + (set! v1-92 (the-as none (+ s3-0 v1-91))) + (set! f0-0 (the-as none (l.f (+ v1-92 24)))) + (set! f0-1 (the-as none (f2i f0-0))) + (set! v1-93 (the-as none (fpr->gpr f0-1))) + (set! a0-43 (the-as none v1-93)) + (set! a0-43 (the-as none (abs a0-43))) + (= a0-43 s4-1) + ) + (cond + ((>=0.si v1-93) + (set! t9-6 (the-as none add-debug-sphere)) + (set! a0-45 (the-as none #t)) + (set! a1-17 (the-as none 324)) + (set! v1-94 (the-as none (sll s2-0 4))) + (set! v1-95 (the-as none (+ v1-94 12))) + (set! a2-7 (the-as none (+ v1-95 s3-0))) + (set! a3-4 (the-as none #x45800000)) + (set! v1-96 (the-as none #x80ff)) + (set! t0-3 (the-as none (sll v1-96 16))) + (call!) + (set! a0-46 (the-as none v0-6)) + ) + (else + (set! t9-7 (the-as none add-debug-sphere)) + (set! a0-47 (the-as none #t)) + (set! a1-18 (the-as none 324)) + (set! v1-97 (the-as none (sll s2-0 4))) + (set! v1-98 (the-as none (+ v1-97 12))) + (set! a2-8 (the-as none (+ v1-98 s3-0))) + (set! a3-5 (the-as none #x45800000)) + (set! t0-4 (the-as none (the-as uint #x800000ff))) + (call!) + (set! a0-48 (the-as none v0-7)) + ) + ) + ) + (set! s2-0 (the-as int (+ s2-0 1))) + ) + ) + (when (begin + (set! v1-102 (the-as none (-> s5-2 bsp))) + (set! v1-103 (the-as none (l.wu (+ v1-102 116)))) + (nonzero? v1-103) + ) + (cond + ((begin + (set! v1-105 (the-as none (l.wu (+ s5-2 92)))) + (set! v1-106 (the-as none (l.wu (+ v1-105 116)))) + (set! a0-49 (the-as none 20)) + (set! a1-19 (the-as none (l.wu (+ s5-2 92)))) + (set! a1-20 (the-as none (l.hu (+ a1-19 150)))) + (set! a0-50 (the-as none (*.ui a0-49 a1-20))) + (set! v1-107 (the-as none (+ v1-106 a0-50))) + (set! a2-9 (the-as none (+ sp-0 16))) + (set! a0-51 (the-as none (l.wu (+ s5-2 92)))) + (set! a0-52 (the-as none (+ a0-51 300))) + (set! a0-53 (the-as none (l.q a0-52))) + (s.q! a2-9 a0-53) + (set! a3-6 (the-as none (+ sp-0 32))) + (set! a0-54 (the-as none (l.wu (+ s5-2 92)))) + (set! a0-55 (the-as none (+ a0-54 300))) + (set! a0-56 (the-as none (l.q a0-55))) + (s.q! a3-6 a0-56) + (set! a0-57 (the-as none (l.wu (+ s5-2 92)))) + (set! a0-58 (the-as none (l.bu (+ a0-57 149)))) + (zero? a0-58) + ) + (set! f0-2 (the-as none (l.f a2-9))) + (set! a0-59 (the-as none (l.b (+ v1-107 4)))) + (set! a1-21 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-0 (the-as none (l.f (+ a1-21 284)))) + (set! f1-1 (the-as none (f2i f1-0))) + (set! a1-22 (the-as none (fpr->gpr f1-1))) + (set! a0-60 (the-as none (*.si a0-59 a1-22))) + (set! f1-2 (the-as none (gpr->fpr a0-60))) + (set! f1-3 (the-as none (i2f f1-2))) + (set! f0-3 (the-as none (+.s f0-2 f1-3))) + (s.f! a2-9 f0-3) + (set! f0-4 (the-as none (l.f (+ a2-9 4)))) + (set! a0-61 (the-as none (l.b (+ v1-107 5)))) + (set! a1-23 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-4 (the-as none (l.f (+ a1-23 288)))) + (set! f1-5 (the-as none (f2i f1-4))) + (set! a1-24 (the-as none (fpr->gpr f1-5))) + (set! a0-62 (the-as none (*.si a0-61 a1-24))) + (set! f1-6 (the-as none (gpr->fpr a0-62))) + (set! f1-7 (the-as none (i2f f1-6))) + (set! f0-5 (the-as none (+.s f0-4 f1-7))) + (s.f! (+ a2-9 4) f0-5) + (set! f0-6 (the-as none (l.f (+ a2-9 8)))) + (set! a0-63 (the-as none (l.b (+ v1-107 6)))) + (set! a1-25 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-8 (the-as none (l.f (+ a1-25 292)))) + (set! f1-9 (the-as none (f2i f1-8))) + (set! a1-26 (the-as none (fpr->gpr f1-9))) + (set! a0-64 (the-as none (*.si a0-63 a1-26))) + (set! f1-10 (the-as none (gpr->fpr a0-64))) + (set! f1-11 (the-as none (i2f f1-10))) + (set! f0-7 (the-as none (+.s f0-6 f1-11))) + (s.f! (+ a2-9 8) f0-7) + (set! f0-8 (the-as none (l.f a3-6))) + (set! a0-65 (the-as none (l.b (+ v1-107 8)))) + (set! a1-27 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-12 (the-as none (l.f (+ a1-27 284)))) + (set! f1-13 (the-as none (f2i f1-12))) + (set! a1-28 (the-as none (fpr->gpr f1-13))) + (set! a0-66 (the-as none (*.si a0-65 a1-28))) + (set! f1-14 (the-as none (gpr->fpr a0-66))) + (set! f1-15 (the-as none (i2f f1-14))) + (set! f0-9 (the-as none (+.s f0-8 f1-15))) + (s.f! a3-6 f0-9) + (set! f0-10 (the-as none (l.f (+ a3-6 4)))) + (set! a0-67 (the-as none (l.b (+ v1-107 9)))) + (set! a1-29 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-16 (the-as none (l.f (+ a1-29 288)))) + (set! f1-17 (the-as none (f2i f1-16))) + (set! a1-30 (the-as none (fpr->gpr f1-17))) + (set! a0-68 (the-as none (*.si a0-67 a1-30))) + (set! f1-18 (the-as none (gpr->fpr a0-68))) + (set! f1-19 (the-as none (i2f f1-18))) + (set! f0-11 (the-as none (+.s f0-10 f1-19))) + (s.f! (+ a3-6 4) f0-11) + (set! f0-12 (the-as none (l.f (+ a3-6 8)))) + (set! v1-108 (the-as none (l.b (+ v1-107 10)))) + (set! a0-69 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-20 (the-as none (l.f (+ a0-69 292)))) + (set! f1-21 (the-as none (f2i f1-20))) + (set! a0-70 (the-as none (fpr->gpr f1-21))) + (set! v1-109 (the-as none (*.si v1-108 a0-70))) + (set! f1-22 (the-as none (gpr->fpr v1-109))) + (set! f1-23 (the-as none (i2f f1-22))) + (set! f0-13 (the-as none (+.s f0-12 f1-23))) + (s.f! (+ a3-6 8) f0-13) + (set! v1-110 (the-as none (fpr->gpr f0-13))) + ) + (else + (set! f0-14 (the-as none (l.f a2-9))) + (set! a0-71 (the-as none (l.b (+ v1-107 12)))) + (set! a1-31 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-24 (the-as none (l.f (+ a1-31 284)))) + (set! f1-25 (the-as none (f2i f1-24))) + (set! a1-32 (the-as none (fpr->gpr f1-25))) + (set! a0-72 (the-as none (*.si a0-71 a1-32))) + (set! f1-26 (the-as none (gpr->fpr a0-72))) + (set! f1-27 (the-as none (i2f f1-26))) + (set! f0-15 (the-as none (+.s f0-14 f1-27))) + (s.f! a2-9 f0-15) + (set! f0-16 (the-as none (l.f (+ a2-9 4)))) + (set! a0-73 (the-as none (l.b (+ v1-107 13)))) + (set! a1-33 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-28 (the-as none (l.f (+ a1-33 288)))) + (set! f1-29 (the-as none (f2i f1-28))) + (set! a1-34 (the-as none (fpr->gpr f1-29))) + (set! a0-74 (the-as none (*.si a0-73 a1-34))) + (set! f1-30 (the-as none (gpr->fpr a0-74))) + (set! f1-31 (the-as none (i2f f1-30))) + (set! f0-17 (the-as none (+.s f0-16 f1-31))) + (s.f! (+ a2-9 4) f0-17) + (set! f0-18 (the-as none (l.f (+ a2-9 8)))) + (set! a0-75 (the-as none (l.b (+ v1-107 14)))) + (set! a1-35 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-32 (the-as none (l.f (+ a1-35 292)))) + (set! f1-33 (the-as none (f2i f1-32))) + (set! a1-36 (the-as none (fpr->gpr f1-33))) + (set! a0-76 (the-as none (*.si a0-75 a1-36))) + (set! f1-34 (the-as none (gpr->fpr a0-76))) + (set! f1-35 (the-as none (i2f f1-34))) + (set! f0-19 (the-as none (+.s f0-18 f1-35))) + (s.f! (+ a2-9 8) f0-19) + (set! f0-20 (the-as none (l.f a3-6))) + (set! a0-77 (the-as none (l.b (+ v1-107 16)))) + (set! a1-37 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-36 (the-as none (l.f (+ a1-37 284)))) + (set! f1-37 (the-as none (f2i f1-36))) + (set! a1-38 (the-as none (fpr->gpr f1-37))) + (set! a0-78 (the-as none (*.si a0-77 a1-38))) + (set! f1-38 (the-as none (gpr->fpr a0-78))) + (set! f1-39 (the-as none (i2f f1-38))) + (set! f0-21 (the-as none (+.s f0-20 f1-39))) + (s.f! a3-6 f0-21) + (set! f0-22 (the-as none (l.f (+ a3-6 4)))) + (set! a0-79 (the-as none (l.b (+ v1-107 17)))) + (set! a1-39 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-40 (the-as none (l.f (+ a1-39 288)))) + (set! f1-41 (the-as none (f2i f1-40))) + (set! a1-40 (the-as none (fpr->gpr f1-41))) + (set! a0-80 (the-as none (*.si a0-79 a1-40))) + (set! f1-42 (the-as none (gpr->fpr a0-80))) + (set! f1-43 (the-as none (i2f f1-42))) + (set! f0-23 (the-as none (+.s f0-22 f1-43))) + (s.f! (+ a3-6 4) f0-23) + (set! f0-24 (the-as none (l.f (+ a3-6 8)))) + (set! v1-111 (the-as none (l.b (+ v1-107 18)))) + (set! a0-81 (the-as none (l.wu (+ s5-2 92)))) + (set! f1-44 (the-as none (l.f (+ a0-81 292)))) + (set! f1-45 (the-as none (f2i f1-44))) + (set! a0-82 (the-as none (fpr->gpr f1-45))) + (set! v1-112 (the-as none (*.si v1-111 a0-82))) + (set! f1-46 (the-as none (gpr->fpr v1-112))) + (set! f1-47 (the-as none (i2f f1-46))) + (set! f0-25 (the-as none (+.s f0-24 f1-47))) + (s.f! (+ a3-6 8) f0-25) + (set! v1-113 (the-as none (fpr->gpr f0-25))) + ) + ) + (set! t9-8 (the-as none add-debug-box)) + (set! a0-83 (the-as none #t)) + (set! a1-41 (the-as none 324)) + (set! t0-5 (the-as none (the-as uint #x80ffff00))) + (call!) + (set! v1-114 (the-as none v0-8)) + ) + ) + ) + (set! gp-2 (the-as int (+ gp-2 1))) + ) + (set! v0-9 #f) + (ret-value v0-9) + ) + +;; definition for symbol *save-camera-inv-rot*, type matrix +(define *save-camera-inv-rot* (new 'global 'matrix)) + +;; failed to figure out what this is: +(matrix-identity! *save-camera-inv-rot*) + +;; definition for function move-camera-from-pad +;; INFO: Used lq/sq +(defun move-camera-from-pad ((arg0 math-camera)) + (let ((v1-0 *external-cam-mode*) + (s5-0 0) + ) + (cond + ((= v1-0 'locked) + (set! v1-0 #f) + ) + ((= v1-0 'pad-1) + (set! s5-0 1) + ) + ((not *camera-combiner*) + (set! v1-0 'pad-0) + ) + ) + (when v1-0 + (let ((a2-1 + (vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0)) + ) + ) + (if (= (vector-length a2-1) 0.0) + (set! (-> a2-1 y) -1.0) + ) + (if (logtest? *external-cam-options* (external-cam-option allow-z)) + (set! a2-1 (the-as vector #f)) + ) + (cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) a2-1 s5-0) + ) + ) + ) + (let* ((a2-2 (-> *math-camera* inv-camera-rot)) + (a3-1 *save-camera-inv-rot*) + (v1-14 (-> a3-1 vector 0 quad)) + (a0-13 (-> a3-1 vector 1 quad)) + (a1-2 (-> a3-1 vector 2 quad)) + (a3-2 (-> a3-1 trans quad)) + ) + (set! (-> a2-2 vector 0 quad) v1-14) + (set! (-> a2-2 vector 1 quad) a0-13) + (set! (-> a2-2 vector 2 quad) a1-2) + (set! (-> a2-2 trans quad) a3-2) + ) + arg0 + ) + +;; definition for function external-cam-reset! +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defun external-cam-reset! () + (when (not (movie?)) + (vector-reset! (-> *math-camera* trans)) + (matrix-identity! (-> *math-camera* inv-camera-rot)) + (when *camera-combiner* + (let* ((v1-7 (-> *math-camera* inv-camera-rot)) + (a3-0 (-> *camera-combiner* inv-camera-rot)) + (a0-2 (-> a3-0 vector 0 quad)) + (a1-0 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-7 vector 0 quad) a0-2) + (set! (-> v1-7 vector 1 quad) a1-0) + (set! (-> v1-7 vector 2 quad) a2-0) + (set! (-> v1-7 trans quad) a3-1) + ) + (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad)) + ) + ) + 0 + (none) + ) + +;; definition for symbol *start-timer*, type int +(define *start-timer* (the-as int #f)) + +;; definition for symbol *timer-value*, type int +(define *timer-value* 0) + +;; definition for symbol *start-pos*, type vector +(define *start-pos* (new 'global 'vector)) + +;; definition for function update-camera +;; INFO: Used lq/sq +(defun update-camera () + (with-pp + (let ((gp-0 *math-camera*)) + (let* ((a2-0 (-> gp-0 prev-inv-camera-rot)) + (a3-0 (-> gp-0 inv-camera-rot)) + (v1-0 (-> a3-0 vector 0 quad)) + (a0-0 (-> a3-0 vector 1 quad)) + (a1-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> a2-0 vector 0 quad) v1-0) + (set! (-> a2-0 vector 1 quad) a0-0) + (set! (-> a2-0 vector 2 quad) a1-0) + (set! (-> a2-0 trans quad) a3-1) + ) + (set! (-> gp-0 prev-trans quad) (-> gp-0 trans quad)) + (when *start-timer* + (when (= *timer-value* 180) + (format + #t + "Player pos = ~F ~F ~F~%" + (-> *target* control trans x) + (-> *target* control trans y) + (-> *target* control trans z) + ) + (set! (-> *start-pos* quad) (-> *target* control trans quad)) + ) + (when (= *timer-value* 480) + (format + #t + "Player pos = ~F ~F ~F~%" + (-> *target* control trans x) + (-> *target* control trans y) + (-> *target* control trans z) + ) + (format + #t + "Dist = ~F~%" + (* 0.00024414062 (vector-vector-xz-distance (-> *target* control trans) *start-pos*)) + ) + (set! *start-timer* (the-as int #f)) + ) + (if (< 179 *timer-value*) + (format *stdcon* "~%~%Time = ~D~%" *timer-value*) + ) + (set! *timer-value* (+ *timer-value* 1)) + ) + (when (not *start-timer*) + (set! *timer-value* 0) + 0 + ) + (let ((f0-9 (if (-> *blit-displays-work* menu-mode) + 11650.845 + (-> gp-0 fov) + ) + ) + ) + (update-math-camera + gp-0 + (-> *setting-control* user-current video-mode) + (-> *setting-control* user-current aspect-ratio) + f0-9 + ) + ) + (cond + ((or (= *master-mode* 'pause) (or (= *master-mode* 'freeze) (= *master-mode* 'progress) *progress-process*)) + ) + ((>= *camera-look-through-other* 2) + (set! *camera-look-through-other* 1) + ) + ((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu)) + (set! *camera-look-through-other* 0) + 0 + ) + ) + 0.0 + (let ((s5-1 (-> pp clock))) + (set! (-> pp clock) (-> *display* camera-clock)) + (update! *camera-smush-control*) + (let ((f0-11 (get-no-update *camera-smush-control*))) + f0-11 + (set! (-> pp clock) s5-1) + (cond + (*external-cam-mode* + (move-camera-from-pad gp-0) + ) + ((nonzero? *camera-look-through-other*) + (set! (-> gp-0 fov) (-> *camera-other-fov* data)) + (set! (-> gp-0 trans quad) (-> *camera-other-trans* quad)) + (+! (-> gp-0 trans y) f0-11) + (let* ((a2-6 (-> gp-0 inv-camera-rot)) + (a3-5 *camera-other-matrix*) + (v1-68 (-> a3-5 vector 0 quad)) + (a0-29 (-> a3-5 vector 1 quad)) + (a1-7 (-> a3-5 vector 2 quad)) + (a3-6 (-> a3-5 trans quad)) + ) + (set! (-> a2-6 vector 0 quad) v1-68) + (set! (-> a2-6 vector 1 quad) a0-29) + (set! (-> a2-6 vector 2 quad) a1-7) + (set! (-> a2-6 trans quad) a3-6) + ) + (let* ((v1-69 *save-camera-inv-rot*) + (a3-7 *camera-other-matrix*) + (a0-30 (-> a3-7 vector 0 quad)) + (a1-8 (-> a3-7 vector 1 quad)) + (a2-7 (-> a3-7 vector 2 quad)) + (a3-8 (-> a3-7 trans quad)) + ) + (set! (-> v1-69 vector 0 quad) a0-30) + (set! (-> v1-69 vector 1 quad) a1-8) + (set! (-> v1-69 vector 2 quad) a2-7) + (set! (-> v1-69 trans quad) a3-8) + ) + ) + ((and *camera-combiner* (not *external-cam-mode*)) + (set! (-> gp-0 fov) (-> *camera-combiner* fov)) + (set! (-> gp-0 trans quad) (-> *camera-combiner* trans quad)) + (+! (-> gp-0 trans y) f0-11) + (let* ((v1-76 (-> gp-0 inv-camera-rot)) + (a3-9 (-> *camera-combiner* inv-camera-rot)) + (a0-35 (-> a3-9 vector 0 quad)) + (a1-9 (-> a3-9 vector 1 quad)) + (a2-8 (-> a3-9 vector 2 quad)) + (a3-10 (-> a3-9 trans quad)) + ) + (set! (-> v1-76 vector 0 quad) a0-35) + (set! (-> v1-76 vector 1 quad) a1-9) + (set! (-> v1-76 vector 2 quad) a2-8) + (set! (-> v1-76 trans quad) a3-10) + ) + (let* ((v1-77 *save-camera-inv-rot*) + (a3-11 (-> *camera-combiner* inv-camera-rot)) + (a0-37 (-> a3-11 vector 0 quad)) + (a1-10 (-> a3-11 vector 1 quad)) + (a2-9 (-> a3-11 vector 2 quad)) + (a3-12 (-> a3-11 trans quad)) + ) + (set! (-> v1-77 vector 0 quad) a0-37) + (set! (-> v1-77 vector 1 quad) a1-10) + (set! (-> v1-77 vector 2 quad) a2-9) + (set! (-> v1-77 trans quad) a3-12) + ) + ) + (*camera* + (move-camera-from-pad gp-0) + ) + ) + ) + ) + (matrix-transpose! (-> gp-0 camera-rot) (-> gp-0 inv-camera-rot)) + (cond + (*camera-no-mip-correction* + (set! (-> gp-0 fov-correction-factor) 1.0) + ) + (else + (let ((f0-16 (fmin 11650.845 (-> gp-0 fov)))) + (set! (-> gp-0 fov-correction-factor) (* 0.00008583069 f0-16)) + ) + ) + ) + (if (< 0.0 (-> gp-0 smooth-t)) + (set! (-> gp-0 smooth-t) (- (-> gp-0 smooth-t) (-> gp-0 smooth-step))) + ) + (cond + ((< 0.0 (-> gp-0 smooth-t)) + (let ((s5-2 (new-stack-quaternion0))) + (matrix->quaternion s5-2 (-> gp-0 inv-camera-rot)) + (quaternion-slerp! s5-2 s5-2 (-> gp-0 inv-camera-rot-smooth-from) (-> gp-0 smooth-t)) + (quaternion->matrix (-> gp-0 inv-camera-rot-smooth) s5-2) + ) + ) + (else + (let* ((a2-11 (-> gp-0 inv-camera-rot-smooth)) + (a3-14 (-> gp-0 inv-camera-rot)) + (v1-90 (-> a3-14 vector 0 quad)) + (a0-43 (-> a3-14 vector 1 quad)) + (a1-15 (-> a3-14 vector 2 quad)) + (a3-15 (-> a3-14 trans quad)) + ) + (set! (-> a2-11 vector 0 quad) v1-90) + (set! (-> a2-11 vector 1 quad) a0-43) + (set! (-> a2-11 vector 2 quad) a1-15) + (set! (-> a2-11 trans quad) a3-15) + ) + ) + ) + (when (and (!= *master-mode* 'menu) *display-camera-info*) + (format *stdcon* "cam pos ~M ~M ~M~%" (-> gp-0 trans x) (-> gp-0 trans y) (-> gp-0 trans z)) + (let ((v1-95 (-> *setting-control* cam-current))) + (format + *stdcon* + "string info min-l ~M max-l ~M min-h ~M max-h ~M~%" + (-> v1-95 string-min-length) + (-> v1-95 string-max-length) + (-> v1-95 string-min-height) + (-> v1-95 string-max-height) + ) + ) + ) + (when (zero? (-> gp-0 reset)) + (let* ((a2-14 (-> gp-0 prev-camera-temp)) + (a3-18 (-> gp-0 camera-temp)) + (v1-99 (-> a3-18 vector 0 quad)) + (a0-48 (-> a3-18 vector 1 quad)) + (a1-18 (-> a3-18 vector 2 quad)) + (a3-19 (-> a3-18 trans quad)) + ) + (set! (-> a2-14 vector 0 quad) v1-99) + (set! (-> a2-14 vector 1 quad) a0-48) + (set! (-> a2-14 vector 2 quad) a1-18) + (set! (-> a2-14 trans quad) a3-19) + ) + ) + (let ((s3-1 (-> gp-0 camera-temp)) + (s2-0 (-> gp-0 camera-rot)) + (s5-3 (-> gp-0 inv-camera-rot)) + (s4-1 (-> gp-0 trans)) + ) + (let ((s1-0 (new-stack-vector0))) + (set! (-> s1-0 x) (- (-> s4-1 x))) + (set! (-> s1-0 y) (- (-> s4-1 y))) + (set! (-> s1-0 z) (- (-> s4-1 z))) + (set! (-> s1-0 w) 1.0) + (vector-matrix*! s1-0 s1-0 s2-0) + (set! (-> s2-0 trans quad) (-> s1-0 quad)) + ) + (matrix*! s3-1 s2-0 (-> gp-0 perspective)) + (set! (-> s5-3 trans quad) (-> s4-1 quad)) + ) + (when (nonzero? (-> gp-0 reset)) + (let* ((a2-17 (-> gp-0 prev-camera-temp)) + (a3-20 (-> gp-0 camera-temp)) + (v1-105 (-> a3-20 vector 0 quad)) + (a0-51 (-> a3-20 vector 1 quad)) + (a1-21 (-> a3-20 vector 2 quad)) + (a3-21 (-> a3-20 trans quad)) + ) + (set! (-> a2-17 vector 0 quad) v1-105) + (set! (-> a2-17 vector 1 quad) a0-51) + (set! (-> a2-17 vector 2 quad) a1-21) + (set! (-> a2-17 trans quad) a3-21) + ) + (set! (-> gp-0 reset) 0) + 0 + ) + (let ((f1-10 (-> gp-0 fog-min)) + (f0-37 (-> gp-0 fog-max)) + ) + (let ((f2-0 (-> gp-0 d))) + (set! (-> *instance-tie-work* hmge-d x) f1-10) + (set! (-> *instance-tie-work* hmge-d y) f0-37) + (set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0)) + (set! (-> *instance-tie-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w))) + (let ((v1-112 (-> gp-0 hvdf-off quad))) + (set! (-> *instance-tie-work* hvdf-offset quad) v1-112) + ) + (set! (-> *instance-shrub-work* hmge-d x) f1-10) + (set! (-> *instance-shrub-work* hmge-d y) f0-37) + (set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0)) + (set! (-> *instance-shrub-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w))) + (set! (-> *instance-shrub-work* billboard-const x) (/ (-> gp-0 x-pix) (* f2-0 (-> gp-0 x-ratio)))) + (set! (-> *instance-shrub-work* billboard-const y) (/ (-> gp-0 y-pix) (* f2-0 (-> gp-0 y-ratio)))) + ) + (set! (-> *instance-shrub-work* billboard-const z) f1-10) + (set! (-> *instance-shrub-work* billboard-const w) f0-37) + ) + (set! (-> *instance-shrub-work* constants w) (the-as float (-> gp-0 vis-gifs 0 fog0))) + (let ((a0-53 (-> gp-0 hvdf-off quad))) + (set! (-> *instance-shrub-work* hvdf-offset quad) a0-53) + ) + (update-view-planes gp-0 (-> gp-0 plane) 1.0 (-> gp-0 inv-camera-rot)) + (update-view-planes gp-0 (-> gp-0 guard-plane) 4.0 (-> gp-0 inv-camera-rot)) + (let ((t9-20 shrub-make-perspective-matrix) + (a0-56 (-> gp-0 shrub-mat)) + ) + (-> gp-0 camera-temp) + (t9-20 a0-56) + ) + (update-visible gp-0) + (when (-> *time-of-day-context* use-camera-other) + (let ((s5-4 (-> gp-0 camera-rot)) + (s4-2 (-> gp-0 camera-rot-other)) + (s3-2 (-> gp-0 inv-camera-rot-other)) + ) + (let ((s2-1 (-> gp-0 camera-temp-other))) + (quaternion->matrix s4-2 (-> gp-0 quat-other)) + (set! (-> s4-2 trans quad) (-> gp-0 trans-other quad)) + (set! (-> s4-2 trans w) 1.0) + (matrix*! s4-2 s4-2 s5-4) + (matrix-inverse-of-rot-trans! s3-2 s4-2) + (matrix*! s2-1 s4-2 (-> gp-0 perspective)) + ) + (update-view-planes gp-0 (-> gp-0 plane-other) 1.0 s3-2) + (update-view-planes gp-0 (-> gp-0 guard-plane-other) 4.0 s3-2) + ) + (shrub-make-perspective-matrix (-> gp-0 shrub-mat-other)) + ) + ) + #f + ) + ) + +;; definition (debug) for function move-level-by-name +(defun-debug move-level-by-name ((arg0 symbol) (arg1 float) (arg2 float) (arg3 float)) + (let ((v1-1 (level-get *level* arg0))) + (when v1-1 + (set! (-> v1-1 info use-camera-other) #t) + (let ((v0-1 (-> *math-camera* trans-other))) + (set! (-> v0-1 x) (* 4096.0 arg1)) + (set! (-> v0-1 y) (* 4096.0 arg2)) + (set! (-> v0-1 z) (* 4096.0 arg3)) + (set! (-> v0-1 w) 1.0) + v0-1 + ) + ) + ) + ) diff --git a/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc b/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc index 9f2be346e6..df48bbd12f 100644 --- a/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc @@ -10,8 +10,8 @@ :size-assert #x30 :flag-assert #xb00000030 (:methods - (cam-index-method-9 () none 9) - (cam-index-method-10 () none 10) + (cam-index-method-9 (_type_ symbol entity vector curve) symbol 9) + (cam-index-method-10 (_type_ vector) float 10) ) ) @@ -101,21 +101,21 @@ :size-assert #x664 :flag-assert #x1800000664 (:methods - (tracking-spline-method-9 () none 9) - (tracking-spline-method-10 () none 10) - (tracking-spline-method-11 () none 11) - (tracking-spline-method-12 () none 12) - (tracking-spline-method-13 () none 13) - (tracking-spline-method-14 () none 14) - (tracking-spline-method-15 () none 15) - (tracking-spline-method-16 () none 16) - (tracking-spline-method-17 () none 17) - (tracking-spline-method-18 () none 18) - (tracking-spline-method-19 () none 19) - (tracking-spline-method-20 () none 20) - (tracking-spline-method-21 () none 21) - (tracking-spline-method-22 () none 22) - (tracking-spline-method-23 () none 23) + (tracking-spline-method-9 (_type_) none 9) + (tracking-spline-method-10 (_type_ vector) none 10) + (debug-point-info (_type_ int) none 11) + (debug-all-points (_type_) none 12) + (tracking-spline-method-13 (_type_ int) none 13) + (tracking-spline-method-14 (_type_ tracking-spline-sampler) none 14) + (tracking-spline-method-15 (_type_) none 15) + (tracking-spline-method-16 (_type_ float) none 16) + (tracking-spline-method-17 (_type_ vector float float symbol) int 17) + (tracking-spline-method-18 (_type_ float vector tracking-spline-sampler) vector 18) + (tracking-spline-method-19 (_type_ float vector tracking-spline-sampler) vector 19) + (tracking-spline-method-20 (_type_ vector int) none 20) + (tracking-spline-method-21 (_type_ vector float float float) vector 21) + (tracking-spline-method-22 (_type_ float) none 22) + (debug-draw-spline (_type_) none 23) ) ) @@ -408,7 +408,7 @@ (let ((t9-0 (method-of-type process inspect))) (t9-0 obj) ) - (format #t "~2Ttrans: ~`vector`P~%" (-> obj stack)) + (format #t "~2Ttrans: ~`vector`P~%" (-> obj trans)) (format #t "~2Tinv-camera-rot: ~`matrix`P~%" (-> obj inv-camera-rot)) (format #t "~2Tfov: ~f~%" (-> obj fov)) (format #t "~2Tinterp-val: ~f~%" (-> obj interp-val)) @@ -446,7 +446,7 @@ (circular-follow vector :inline :offset-assert 2256) (max-angle-offset float :offset-assert 2272) (max-angle-curr float :offset-assert 2276) - (options camera-slave-options :offset-assert 2280) + (options uint32 :offset-assert 2280) (cam-entity entity :offset-assert 2284) (butt-timer uint64 :offset-assert 2288) (butt-seek basic :offset-assert 2296) @@ -473,7 +473,7 @@ (spline-follow-dist float :offset-assert 2596) (enter-has-run symbol :offset-assert 2600) (blend-from-type uint64 :offset-assert 2608) - (blend-to-type uint64 :offset-assert 2616) + (blend-to-type camera-blend-to-type :offset-assert 2616) (have-phony-joystick basic :offset-assert 2624) (phony-joystick-x float :offset-assert 2628) (phony-joystick-y float :offset-assert 2632) @@ -487,6 +487,28 @@ :method-count-assert 14 :size-assert #xa94 :flag-assert #xe0a200a94 + (:states + cam-bike + cam-circular + cam-decel + cam-endlessfall + cam-eye + cam-fixed + cam-fixed-read-entity + cam-free-floating + cam-lookat + cam-point-watch + cam-pov + cam-pov-track + cam-pov180 + cam-really-fixed + cam-robotboss + cam-spline + cam-standoff + cam-standoff-read-entity + cam-stick + cam-string + ) ) ;; definition for method 3 of type camera-slave @@ -498,7 +520,7 @@ (let ((t9-0 (method-of-type process inspect))) (t9-0 obj) ) - (format #t "~2Ttrans: ~`vector`P~%" (-> obj stack)) + (format #t "~2Ttrans: ~`vector`P~%" (-> obj trans)) (format #t "~2Tfov: ~f~%" (-> obj fov)) (format #t "~2Tfov0: ~f~%" (-> obj fov0)) (format #t "~2Tfov1: ~f~%" (-> obj fov1)) @@ -562,7 +584,7 @@ ((master-options uint32 :offset-assert 128) (settings cam-setting-data :offset-assert 132) (slave (pointer camera-slave) :offset-assert 136) - (decel uint32 :offset-assert 140) + (decel (pointer camera-slave) :offset-assert 140) (slave-options uint32 :offset-assert 144) (view-off-param-save float :offset-assert 148) (changer uint32 :offset-assert 152) @@ -604,9 +626,9 @@ :size-assert #x924 :flag-assert #x1108b00924 (:methods - (camera-master-method-14 () none 14) - (camera-master-method-15 () none 15) - (camera-master-method-16 () none 16) + (camera-master-method-14 (_type_ vector) vector 14) + (camera-master-method-15 (_type_ vector) vector 15) + (camera-master-method-16 (_type_ symbol) none 16) ) ) diff --git a/test/decompiler/reference/jak2/engine/camera/camera_REF.gc b/test/decompiler/reference/jak2/engine/camera/camera_REF.gc new file mode 100644 index 0000000000..b287c4ac39 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/camera/camera_REF.gc @@ -0,0 +1,2086 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *cam-res-string*, type string +(define *cam-res-string* (new 'global 'string 64 (the-as string #f))) + +;; definition for function cam-slave-get-vector-with-offset +;; INFO: Used lq/sq +(defun cam-slave-get-vector-with-offset ((arg0 entity-actor) (arg1 vector) (arg2 symbol)) + (local-vars (s3-0 structure)) + (cond + ((= arg2 'trans) + (set! s3-0 (-> arg0 trans)) + ) + ((= arg2 'rot) + (set! s3-0 (-> arg0 quat)) + ) + (else + (set! s3-0 (res-lump-struct arg0 arg2 structure)) + ) + ) + (let ((s2-0 (method-of-type res-lump get-property-struct))) + (format (clear *res-key-string*) "~S~S" arg2 '-offset) + (let ((a0-6 (s2-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + ((and s3-0 a0-6) + (vector+! arg1 (the-as vector s3-0) (the-as vector a0-6)) + #t + ) + ((the-as vector s3-0) + (set! (-> arg1 quad) (-> (the-as vector s3-0) quad)) + #t + ) + (else + #f + ) + ) + ) + ) + ) + +;; definition for function cam-slave-get-flags +;; INFO: Return type mismatch uint128 vs uint. +(defun cam-slave-get-flags ((arg0 entity) (arg1 symbol)) + (let ((s5-0 (res-lump-value arg0 arg1 uint128 :time -1000000000.0)) + (s3-0 (method-of-type res-lump get-property-value)) + (s2-0 arg0) + ) + (format (clear *res-key-string*) "~S~S" arg1 '-on) + (let ((s3-1 (s3-0 + s2-0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s2-1 (method-of-type res-lump get-property-value)) + ) + (format (clear *res-key-string*) "~S~S" arg1 '-off) + (let ((v1-3 (s2-1 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (the-as uint (logclear (logior s5-0 s3-1) v1-3)) + ) + ) + ) + ) + +;; definition for function cam-slave-get-float +(defun cam-slave-get-float ((arg0 entity) (arg1 symbol) (arg2 float)) + (let ((f30-0 (res-lump-float arg0 arg1 :default arg2)) + (s4-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" arg1 '-offset) + (+ f30-0 (s4-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + +;; definition for function cam-slave-get-fov +(defun cam-slave-get-fov ((arg0 entity)) + (let ((f30-0 (res-lump-float arg0 'fov)) + (s5-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'fov '-offset) + (let ((f0-0 (s5-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if (= f30-0 0.0) + (+ 11650.845 f0-0) + (+ f30-0 f0-0) + ) + ) + ) + ) + +;; definition for function cam-slave-get-intro-step +(defun cam-slave-get-intro-step ((arg0 entity)) + (let ((f30-0 (res-lump-float arg0 'intro-time)) + (s5-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'intro-time '-offset) + (let ((f0-1 (+ f30-0 (s5-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + (if (>= 0.0 f0-1) + 0.004166667 + (/ 0.016666668 f0-1) + ) + ) + ) + ) + +;; definition for function cam-slave-get-interp-time +(defun cam-slave-get-interp-time ((arg0 entity)) + (let ((f30-0 (res-lump-float arg0 'interpTime)) + (s5-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'interpTime '-offset) + (let ((f0-1 (the-as number (+ f30-0 (s5-0 + arg0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + ) + (if (>= 0.001 (the-as float f0-1)) + (set! f0-1 0.0) + ) + (the-as float f0-1) + ) + ) + ) + +;; definition for function cam-slave-get-rot +(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 matrix)) + (let ((s4-0 (method-of-type res-lump get-property-struct)) + (s3-0 arg0) + ) + (format (clear *res-key-string*) "~S~S" 'rot '-offset) + (let ((a1-3 (s4-0 + s3-0 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + (a1-3 + (let ((s4-1 (new 'stack-no-clear 'quaternion))) + (quaternion*! s4-1 (the-as quaternion a1-3) (-> arg0 quat)) + (quaternion-normalize! s4-1) + (quaternion->matrix arg1 s4-1) + ) + ) + (else + (quaternion->matrix arg1 (-> arg0 quat)) + ) + ) + ) + ) + arg1 + ) + +;; definition for function cam-state-from-entity +(defun cam-state-from-entity ((arg0 entity)) + (let ((s5-0 (new 'stack 'curve))) + (cond + ((not arg0) + (the-as (state camera-slave) #f) + ) + ((res-lump-struct arg0 'pivot structure) + cam-circular + ) + ((res-lump-struct arg0 'align structure) + cam-standoff-read-entity + ) + ((get-curve-data! arg0 s5-0 'campath 'campath-k -1000000000.0) + cam-spline + ) + ((< 0.0 (cam-slave-get-float arg0 'stringMaxLength 0.0)) + cam-string + ) + (else + cam-fixed-read-entity + ) + ) + ) + ) + +;; definition for function parameter-ease-none +(defun parameter-ease-none ((arg0 object)) + arg0 + ) + +;; definition for function parameter-ease-clamp +(defun parameter-ease-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + (set! arg0 1.0) + ) + ((>= 0.0 arg0) + (set! arg0 0.0) + ) + ) + arg0 + ) + +;; definition for function parameter-ease-lerp-clamp +(defun parameter-ease-lerp-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + ((>= 0.25 arg0) + (* 0.5 arg0) + ) + ((>= arg0 0.75) + (- 1.0 (* 0.5 (- 1.0 arg0))) + ) + (else + (+ 0.125 (* 1.5 (+ -0.25 arg0))) + ) + ) + ) + +;; definition for function parameter-ease-sqrt-clamp +(defun parameter-ease-sqrt-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + ((>= 0.5 arg0) + (* 0.5 (- 1.0 (sqrtf (- 1.0 (* 2.0 arg0))))) + ) + (else + (* 0.5 (+ 1.0 (sqrtf (+ -1.0 (* 2.0 arg0))))) + ) + ) + ) + +;; definition for function fourth-power +(defun fourth-power ((arg0 float)) + (let ((f0-2 (* arg0 arg0))) + (* f0-2 f0-2) + ) + ) + +;; definition for function third-power +(defun third-power ((arg0 float)) + (* arg0 arg0 arg0) + ) + +;; definition for function parameter-ease-sqr-clamp +(defun parameter-ease-sqr-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + ((>= 0.5 arg0) + (let ((f0-3 0.5) + (f1-4 (* 2.0 arg0)) + ) + (* f0-3 (* f1-4 f1-4)) + ) + ) + (else + (let ((f0-5 1.0) + (f1-7 0.5) + (f2-2 (* 2.0 (- 1.0 arg0))) + ) + (- f0-5 (* f1-7 (* f2-2 f2-2))) + ) + ) + ) + ) + +;; definition for function parameter-ease-cube-clamp +(defun parameter-ease-cube-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + ((>= 0.5 arg0) + (* 0.5 (third-power (* 2.0 arg0))) + ) + (else + (- 1.0 (* 0.5 (third-power (* 2.0 (- 1.0 arg0))))) + ) + ) + ) + +;; definition for function parameter-ease-sin-clamp +(defun parameter-ease-sin-clamp ((arg0 float)) + (cond + ((>= arg0 1.0) + 1.0 + ) + ((>= 0.0 arg0) + 0.0 + ) + (else + (+ 0.5 (* 0.5 (sin (* 182.04445 (+ -90.0 (* 180.0 arg0)))))) + ) + ) + ) + +;; definition for method 9 of type cam-index +;; INFO: Used lq/sq +(defmethod cam-index-method-9 cam-index ((obj cam-index) (arg0 symbol) (arg1 entity) (arg2 vector) (arg3 curve)) + (local-vars (sv-32 (function _varargs_ object))) + (format (clear *cam-res-string*) "~S-flags" arg0) + (set! (-> obj flags) (the-as cam-index-options (cam-slave-get-flags arg1 (string->symbol *cam-res-string*)))) + (let ((s3-2 (res-lump-data arg1 arg0 pointer)) + (s0-1 (method-of-type res-lump get-property-struct)) + ) + (set! sv-32 format) + (let ((a0-7 (clear *res-key-string*)) + (a1-4 "~S~S") + (a3-2 '-offset) + ) + (sv-32 a0-7 a1-4 arg0 a3-2) + ) + (let ((v0-8 (s0-1 + arg1 + (string->symbol *res-key-string*) + 'interp + -1000000000.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + (s3-2 + (cond + (v0-8 + (vector+! (the-as vector (-> obj vec)) (the-as vector (&+ s3-2 0)) (the-as vector v0-8)) + (vector+! (-> obj vec 1) (the-as vector (&+ s3-2 16)) (the-as vector v0-8)) + ) + (else + (set! (-> obj vec 0 quad) (-> (the-as (pointer uint128) (&+ s3-2 0)))) + (set! (-> obj vec 1 quad) (-> (the-as (pointer uint128) (&+ s3-2 16)))) + ) + ) + ) + (arg3 + (set! (-> obj vec 0 quad) (-> arg3 cverts 0 quad)) + (set! (-> obj vec 1 quad) (-> arg3 cverts (+ (-> arg3 num-cverts) -1) quad)) + ) + (else + (return #f) + ) + ) + ) + ) + (let ((v1-11 (new-stack-vector0))) + 0.0 + (cond + ((logtest? (-> obj flags) (cam-index-options SPHERICAL)) + (vector-! v1-11 (-> obj vec 1) arg2) + (set! (-> obj vec 1 w) (vector-length v1-11)) + (vector-! v1-11 (the-as vector (-> obj vec)) arg2) + (set! (-> obj vec 1 x) (vector-length v1-11)) + (set! (-> obj vec 1 w) (- (-> obj vec 1 w) (-> obj vec 1 x))) + (set! (-> obj vec 0 quad) (-> arg2 quad)) + ) + ((logtest? (-> obj flags) (cam-index-options RADIAL)) + (vector-! v1-11 (-> obj vec 1) arg2) + (set! (-> obj vec 1 w) (vector-length v1-11)) + (vector-! v1-11 (the-as vector (-> obj vec)) arg2) + (set! (-> obj vec 1 x) (vector-length v1-11)) + (set! (-> obj vec 1 w) (- (-> obj vec 1 w) (-> obj vec 1 x))) + (set! (-> obj vec 0 quad) (-> arg2 quad)) + ) + (else + (vector-! (-> obj vec 1) (-> obj vec 1) (the-as vector (-> obj vec))) + (set! (-> obj vec 1 w) (vector-normalize-ret-len! (-> obj vec 1) 1.0)) + ) + ) + ) + #t + ) + +;; definition for method 10 of type cam-index +;; INFO: Used lq/sq +(defmethod cam-index-method-10 cam-index ((obj cam-index) (arg0 vector)) + (let ((s5-0 (new-stack-vector0))) + 0.0 + (vector-! s5-0 arg0 (the-as vector (-> obj vec))) + (cond + ((logtest? (-> obj flags) (cam-index-options SPHERICAL)) + (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) + (/ (- (vector-length s5-0) (-> obj vec 1 x)) (-> obj vec 1 w)) + ) + ((logtest? (-> obj flags) (cam-index-options RADIAL)) + (/ (- (vector-length s5-0) (-> obj vec 1 x)) (-> obj vec 1 w)) + ) + (else + (/ (vector-dot s5-0 (-> obj vec 1)) (-> obj vec 1 w)) + ) + ) + ) + ) + +;; definition for method 10 of type tracking-spline +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +(defmethod tracking-spline-method-10 tracking-spline ((obj tracking-spline) (arg0 vector)) + (set! (-> obj point 0 position quad) (-> arg0 quad)) + (set! (-> obj point 0 next) -134250495) + (set! (-> obj summed-len) 0.0) + (set! (-> obj free-point) 1) + (set! (-> obj used-point) 0) + (set! (-> obj partial-point) 0.0) + (set! (-> obj end-point) 0) + (set! (-> obj next-to-last-point) -134250495) + (set! (-> obj max-move) 0.0) + (set! (-> obj sample-len) 0.0) + (set! (-> obj used-count) 1) + (set! (-> obj old-position quad) (-> arg0 quad)) + (let ((v1-6 1)) + (while (!= v1-6 31) + (set! (-> obj point v1-6 next) (+ v1-6 1)) + (+! v1-6 1) + ) + (set! (-> obj point v1-6 next) -134250495) + ) + 0 + (none) + ) + +;; definition for method 13 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod tracking-spline-method-13 tracking-spline ((obj tracking-spline) (arg0 int)) + (let ((v1-3 (-> obj point arg0 next))) + (cond + ((= v1-3 -134250495) + ) + ((= (-> obj point v1-3 next) -134250495) + ) + (else + (set! (-> obj point arg0 next) (-> obj point v1-3 next)) + (set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point v1-3 tp-length))) + (set! (-> obj point v1-3 next) (-> obj free-point)) + (set! (-> obj free-point) v1-3) + (+! (-> obj point v1-3 incarnation) 1) + (let ((v1-11 (-> obj point arg0 next))) + (set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point arg0 tp-length))) + (vector-! + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 arg0))) + (the-as vector (-> obj point v1-11)) + (the-as vector (-> obj point arg0)) + ) + ) + (set! (-> obj point arg0 tp-length) + (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 arg0))) 1.0) + ) + (+! (-> obj summed-len) (-> obj point arg0 tp-length)) + (+! (-> obj used-count) -1) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod tracking-spline-method-14 tracking-spline ((obj tracking-spline) (arg0 tracking-spline-sampler)) + (let ((v1-0 (-> obj used-point))) + (set! (-> obj partial-point) (-> arg0 partial-pt)) + (when (= (-> obj next-to-last-point) v1-0) + (set! (-> obj summed-len) (-> obj point v1-0 tp-length)) + (if (= (-> arg0 cur-pt) (-> obj end-point)) + (set! (-> obj partial-point) 0.99999) + ) + ) + (when (!= (-> arg0 cur-pt) v1-0) + (while (and (!= (-> obj point v1-0 next) (-> arg0 cur-pt)) (!= (-> obj point v1-0 next) (-> obj next-to-last-point))) + (set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point v1-0 tp-length))) + (+! (-> obj point v1-0 incarnation) 1) + (+! (-> obj used-count) -1) + (set! v1-0 (-> obj point v1-0 next)) + ) + (set! (-> obj summed-len) (- (-> obj summed-len) (-> obj point v1-0 tp-length))) + (+! (-> obj point v1-0 incarnation) 1) + (+! (-> obj used-count) -1) + (set! (-> obj point v1-0 next) (-> obj free-point)) + (set! (-> obj free-point) (-> obj used-point)) + (set! (-> obj used-point) (-> arg0 cur-pt)) + (cond + ((= (-> arg0 cur-pt) (-> obj end-point)) + (set! (-> obj partial-point) 0.0) + (set! (-> obj summed-len) 0.0) + ) + ((= (-> arg0 cur-pt) (-> obj next-to-last-point)) + (set! (-> obj summed-len) (-> obj point (-> obj next-to-last-point) tp-length)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 15 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod tracking-spline-method-15 tracking-spline ((obj tracking-spline)) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 cur-pt) (-> obj used-point)) + (set! (-> s5-0 partial-pt) (-> obj partial-point)) + (tracking-spline-method-19 obj (-> obj sample-len) a2-0 s5-0) + ) + (if (or (= (-> s5-0 cur-pt) (-> obj end-point)) + (= (-> s5-0 cur-pt) (-> obj next-to-last-point)) + (= (-> obj point (-> s5-0 cur-pt) next) (-> obj next-to-last-point)) + ) + (set! (-> s5-0 cur-pt) (-> obj used-point)) + ) + (let ((v1-15 (-> obj point (-> s5-0 cur-pt) next))) + (when (!= v1-15 -134250495) + (let ((a0-14 (-> obj point v1-15 next)) + (a1-1 v1-15) + (f0-2 -2.0) + ) + 0.0 + (while (not (or (= a0-14 -134250495) (= a0-14 (-> obj end-point)))) + (let ((f1-2 (vector-dot + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 v1-15))) + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 a0-14))) + ) + ) + ) + (when (>= f1-2 f0-2) + (set! f0-2 f1-2) + (set! a1-1 v1-15) + ) + ) + (set! v1-15 a0-14) + (set! a0-14 (-> obj point v1-15 next)) + ) + (if (< -2.0 f0-2) + (tracking-spline-method-13 obj a1-1) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 16 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod tracking-spline-method-16 tracking-spline ((obj tracking-spline) (arg0 float)) + (let ((s4-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 cur-pt) (-> obj used-point)) + (set! (-> s4-0 partial-pt) (-> obj partial-point)) + (tracking-spline-method-19 obj (-> obj sample-len) a2-0 s4-0) + ) + (let ((s4-1 (-> obj point (-> s4-0 cur-pt) next))) + (when (!= s4-1 -134250495) + (let ((v1-11 (-> obj point s4-1 next))) + (while (not (or (= v1-11 -134250495) + (= (-> obj point v1-11 next) -134250495) + (= (-> obj point v1-11 next) (-> obj end-point)) + (= (-> obj point v1-11 next) (-> obj next-to-last-point)) + ) + ) + (if (< (* (-> obj point s4-1 tp-length) + (+ 1.0 (vector-dot + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 s4-1))) + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 v1-11))) + ) + ) + ) + arg0 + ) + (tracking-spline-method-13 obj s4-1) + (set! s4-1 v1-11) + ) + (set! v1-11 (-> obj point s4-1 next)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 17 of type tracking-spline +;; INFO: Used lq/sq +(defmethod tracking-spline-method-17 tracking-spline ((obj tracking-spline) (arg0 vector) (arg1 float) (arg2 float) (arg3 symbol)) + (let ((s3-0 (-> obj free-point)) + (s2-0 (-> obj end-point)) + ) + (vector-! + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 s2-0))) + arg0 + (the-as vector (-> obj point s2-0)) + ) + (set! (-> obj point s2-0 tp-length) + (vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 s2-0))) 1.0) + ) + (if (< (-> obj point s2-0 tp-length) arg1) + (return 0) + ) + (when (and arg3 (= s3-0 -134250495)) + (tracking-spline-method-15 obj) + (set! s3-0 (-> obj free-point)) + ) + (cond + ((= s3-0 -134250495) + (format 0 "ERROR : pos spline overflow~%") + ) + (else + (+! (-> obj summed-len) (-> obj point s2-0 tp-length)) + (set! (-> obj free-point) (-> obj point s3-0 next)) + (set! (-> obj point s2-0 next) s3-0) + (set! (-> obj end-point) s3-0) + (set! (-> obj next-to-last-point) s2-0) + (set! (-> obj point s3-0 next) -134250495) + (set! (-> obj point s3-0 position quad) (-> arg0 quad)) + (+! (-> obj used-count) 1) + (if (< 0.0 arg2) + (tracking-spline-method-16 obj arg2) + ) + ) + ) + ) + 0 + ) + +;; definition for method 18 of type tracking-spline +;; WARN: new jak 2 until loop case, check carefully +(defmethod tracking-spline-method-18 tracking-spline ((obj tracking-spline) (arg0 float) (arg1 vector) (arg2 tracking-spline-sampler)) + (local-vars (f0-4 float)) + (when (not arg2) + (set! arg2 (new 'stack-no-clear 'tracking-spline-sampler)) + (set! (-> arg2 cur-pt) (-> obj used-point)) + (set! (-> arg2 partial-pt) (-> obj partial-point)) + ) + 0.0 + (until #f + (cond + ((= (-> arg2 cur-pt) (-> obj end-point)) + (set! (-> arg2 partial-pt) 0.0) + (vector+! arg1 arg1 (the-as vector (-> obj point (-> arg2 cur-pt)))) + (return arg1) + ) + ((begin (set! f0-4 (+ (-> arg2 partial-pt) (/ arg0 (-> obj point (-> arg2 cur-pt) tp-length)))) (< f0-4 1.0)) + (set! (-> arg2 partial-pt) f0-4) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-5 (-> obj point (-> arg2 cur-pt) next))) + (vector-lerp! + (the-as vector s5-0) + (the-as vector (-> obj point (-> arg2 cur-pt))) + (the-as vector (-> obj point a2-5)) + f0-4 + ) + ) + (vector+! arg1 arg1 (the-as vector s5-0)) + ) + (return arg1) + ) + (else + (let ((f0-7 (* (- 1.0 (-> arg2 partial-pt)) (-> obj point (-> arg2 cur-pt) tp-length)))) + (set! arg0 (- arg0 f0-7)) + ) + (set! (-> arg2 partial-pt) 0.0) + (set! (-> arg2 cur-pt) (-> obj point (-> arg2 cur-pt) next)) + ) + ) + ) + #f + (the-as vector #f) + ) + +;; definition for method 19 of type tracking-spline +(defmethod tracking-spline-method-19 tracking-spline ((obj tracking-spline) (arg0 float) (arg1 vector) (arg2 tracking-spline-sampler)) + (vector-reset! arg1) + (tracking-spline-method-18 obj arg0 arg1 arg2) + arg1 + ) + +;; definition for method 20 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod tracking-spline-method-20 tracking-spline ((obj tracking-spline) (arg0 vector) (arg1 int)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (vector-! + s3-0 + (the-as vector (-> obj point (-> obj used-point))) + (the-as vector (-> obj point (-> obj end-point))) + ) + (let* ((f0-0 (vector-length s3-0)) + (f1-1 (* 0.33333334 (- 1.5 (* 0.00024414062 f0-0)))) + ) + 0.0 + (let* ((f1-2 (fmax 0.0 f1-1)) + (f30-0 (+ 0.3 f1-2)) + (f0-1 (cond + ((< (-> *CAMERA-bank* min-detectable-velocity) (-> obj summed-len)) + (vector-float*! s3-0 s3-0 (/ 1.0 f0-0)) + (/ f0-0 (-> obj summed-len)) + ) + (else + (vector-reset! s3-0) + 0.0 + ) + ) + ) + (f0-2 (+ -0.2 f0-1)) + (f0-3 (* 2.0 f0-2)) + (f28-0 (fmin 1.0 (fmax 0.05 f0-3))) + (v1-18 (-> obj used-point)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (while (and (!= v1-18 (-> obj end-point)) (!= v1-18 (-> obj next-to-last-point)) (!= v1-18 arg1)) + (let ((s1-0 (-> obj point v1-18 next))) + (vector-! + s2-0 + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 s1-0))) + (the-as vector (+ (the-as uint (-> obj point 0 direction)) (* 48 v1-18))) + ) + (let* ((f0-5 (vector-normalize-ret-len! s2-0 1.0)) + (f0-6 (* 0.5 f0-5)) + (f26-0 (* (fmin 1.0 f0-6) f30-0 (vector-dot arg0 s2-0))) + ) + (let ((f1-14 (vector-dot s2-0 s3-0))) + (cond + ((>= 0.0 f1-14) + ) + (else + (set! f26-0 (* f26-0 (fmax 0.0 (- 0.75 (fabs (* f28-0 f1-14)))))) + ) + ) + ) + (cond + ((< f26-0 0.0) + (if (and *debug-segment* *display-camera-marks*) + (camera-line-rel-len + (the-as vector (-> obj point s1-0)) + s2-0 + (* -40.96 f26-0) + (new 'static 'vector4w :x #xff :y #xff :w #x80) + ) + ) + (vector--float*! arg0 arg0 s2-0 f26-0) + ) + ((and *debug-segment* *display-camera-marks*) + (camera-line-rel-len + (the-as vector (-> obj point s1-0)) + s2-0 + (* 40.96 f26-0) + (new 'static 'vector4w :x #x80 :y #x80 :w #x80) + ) + ) + ) + ) + (set! v1-18 s1-0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 21 of type tracking-spline +;; INFO: Used lq/sq +(defmethod tracking-spline-method-21 tracking-spline ((obj tracking-spline) (arg0 vector) (arg1 float) (arg2 float) (arg3 float)) + (with-pp + (let ((v1-0 (-> obj used-point)) + (f0-0 (-> obj partial-point)) + ) + (let ((f1-0 (-> obj summed-len))) + 0.0 + 0.0 + (let* ((f2-5 (* (- f1-0 (* f0-0 (-> obj point v1-0 tp-length))) arg3)) + (f2-8 (* (fmin arg1 (- f2-5 (-> obj max-move))) (-> pp clock time-adjust-ratio))) + ) + (set! (-> obj max-move) (fmin arg2 (+ (-> obj max-move) f2-8))) + ) + ) + (set! (-> obj max-move) (fmax 0.4096 (-> obj max-move))) + (let ((f1-8 (-> obj summed-len))) + 0.0 + (let* ((f1-9 (- f1-8 (* f0-0 (-> obj point v1-0 tp-length)))) + (f1-11 (fmin 204.8 (- f1-9 (-> obj sample-len)))) + ) + (set! (-> obj sample-len) (fmin 16384.0 (+ (-> obj sample-len) f1-11))) + ) + ) + (let ((s4-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (set! (-> s4-0 cur-pt) v1-0) + (set! (-> s4-0 partial-pt) f0-0) + (tracking-spline-method-19 obj (* (-> obj max-move) (-> pp clock time-adjust-ratio)) arg0 s4-0) + (tracking-spline-method-14 obj s4-0) + (dotimes (s3-0 63) + (tracking-spline-method-18 obj (* 0.015625 (-> obj sample-len)) arg0 s4-0) + ) + (vector-float*! arg0 arg0 0.015625) + (let ((a2-3 (-> s4-0 cur-pt))) + (set! (-> obj debug-last-point) a2-3) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> obj debug-old-position quad) (-> obj old-position quad)) + (set! (-> obj debug-out-position quad) (-> arg0 quad)) + (vector-! s4-1 arg0 (-> obj old-position)) + (tracking-spline-method-20 obj s4-1 a2-3) + (vector+! arg0 (-> obj old-position) s4-1) + ) + ) + ) + ) + (set! (-> obj old-position quad) (-> arg0 quad)) + arg0 + ) + ) + +;; definition for method 22 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod tracking-spline-method-22 tracking-spline ((obj tracking-spline) (arg0 float)) + (when (< arg0 (-> obj summed-len)) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 cur-pt) (-> obj used-point)) + (set! (-> s5-0 partial-pt) 0.0) + (tracking-spline-method-19 obj (- (-> obj summed-len) arg0) a2-0 s5-0) + ) + (tracking-spline-method-14 obj s5-0) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod tracking-spline-method-9 tracking-spline ((obj tracking-spline)) + (let ((v1-0 (-> obj used-point)) + (s4-0 0) + (s5-0 0) + ) + (while (!= v1-0 -134250495) + (set! s5-0 (logior s5-0 (ash 1 v1-0))) + (+! s4-0 1) + (set! v1-0 (-> obj point v1-0 next)) + ) + (when (!= s4-0 (-> obj used-count)) + (if *debug-segment* + (format 0 "ERROR: tracking spline used count ~D actual ~D~%" (-> obj used-count) s4-0) + ) + (set! (-> obj used-count) s4-0) + ) + (let ((v1-9 (-> obj free-point)) + (a3-1 0) + ) + (while (!= v1-9 -134250495) + (+! a3-1 1) + (set! v1-9 (-> obj point v1-9 next)) + ) + (when (!= a3-1 (- 32 (-> obj used-count))) + (if *debug-segment* + (format 0 "ERROR: tracking spline free count ~D actual ~D~%" (- 32 (-> obj used-count)) a3-1) + ) + (set! (-> obj free-point) -134250495) + (dotimes (v1-21 32) + (when (zero? (logand s5-0 1)) + (set! (-> obj point v1-21 next) (-> obj free-point)) + (set! (-> obj free-point) v1-21) + ) + (set! s5-0 (shr s5-0 1)) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function cam-slave-init-vars +;; INFO: Used lq/sq +(defbehavior cam-slave-init-vars camera-slave () + (cond + (*camera* + (set! (-> self options) (-> *camera* slave-options)) + ) + (else + (set! (-> self options) (the-as uint 0)) + 0 + ) + ) + (cond + (*camera-combiner* + (set! (-> self trans quad) (-> *camera-combiner* trans quad)) + (let* ((v1-7 (-> self tracking)) + (a3-0 (-> *camera-combiner* inv-camera-rot)) + (a0-1 (-> a3-0 vector 0 quad)) + (a1-0 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-7 inv-mat vector 0 quad) a0-1) + (set! (-> v1-7 inv-mat vector 1 quad) a1-0) + (set! (-> v1-7 inv-mat vector 2 quad) a2-0) + (set! (-> v1-7 inv-mat trans quad) a3-1) + ) + (when *camera-init-mat* + (let* ((a2-1 (-> self tracking)) + (a3-2 *camera-init-mat*) + (v1-10 (-> a3-2 vector 0 quad)) + (a0-2 (-> a3-2 vector 1 quad)) + (a1-1 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 trans quad)) + ) + (set! (-> a2-1 inv-mat vector 0 quad) v1-10) + (set! (-> a2-1 inv-mat vector 1 quad) a0-2) + (set! (-> a2-1 inv-mat vector 2 quad) a1-1) + (set! (-> a2-1 inv-mat trans quad) a3-3) + ) + ) + (set! (-> self fov) (-> *camera-combiner* fov)) + (set! (-> self velocity quad) (-> *camera-combiner* velocity quad)) + ) + (else + (vector-reset! (-> self trans)) + (matrix-identity! (the-as matrix (-> self tracking))) + (set! (-> self fov) 11650.845) + (vector-reset! (-> self velocity)) + ) + ) + (set! (-> self time-dist-too-far) (the-as uint 0)) + (set! (-> self intro-t) 1.0) + (set! (-> self intro-t-step) 0.0) + (set! (-> self spline-exists) #f) + (set! (-> self los-state) (slave-los-state none)) + (set! (-> self enter-has-run) #f) + (set! (-> self cam-entity) #f) + (set! (-> self tracking no-follow) #f) + (init (-> self tracking tilt-adjust) (-> *CAMERA-bank* default-tilt-adjust) 9.102222 91.022224 0.25) + (init + (-> self tracking follow-height-extra) + (-> *setting-control* cam-current extra-follow-height) + 81.92 + 819.2 + 0.5 + ) + (set! (-> self tracking follow-blend) 1.0) + (set! (-> self have-phony-joystick) #f) + (set! (-> self string-val-locked) #f) + (set! (-> self string-relative) #f) + (set! (-> self butt-timer) (the-as uint 0)) + (set! (-> self butt-seek) #f) + (init (-> self tracking point-of-interest-blend) 0.0 0.005 0.02 0.125) + (init (-> self tracking underwater-blend) 0.0 0.007 0.03 0.125) + (tracking-spline-method-10 (-> self position-spline) (-> self trans)) + (none) + ) + +;; definition for function cam-slave-go +;; INFO: Return type mismatch int vs none. +(defbehavior cam-slave-go camera-slave ((arg0 (state camera-slave))) + (cam-slave-init-vars) + (go arg0) + 0 + (none) + ) + +;; definition for function cam-slave-init +;; INFO: Return type mismatch int vs none. +(defbehavior cam-slave-init camera-slave ((arg0 (state camera-slave)) (arg1 entity)) + (stack-size-set! (-> self main-thread) 512) + (if (and (nonzero? camera-slave-debug) *debug-segment*) + (add-connection *debug-engine* self camera-slave-debug self #f #f) + ) + (cam-slave-init-vars) + (set! (-> self cam-entity) arg1) + (let ((t9-3 (-> arg0 enter))) + (if t9-3 + (t9-3) + ) + ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> arg0 event)) + (go arg0) + 0 + (none) + ) + +;; definition for function cam-standard-event-handler +(defbehavior cam-standard-event-handler camera-slave ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('go) + (format 0 "ERROR : slave cameras no longer support the 'go' event~%") + ) + (('change-state) + (let ((gp-0 (the-as object (-> arg3 param 0)))) + (cam-slave-init-vars) + (let ((t9-2 (-> (the-as (state camera-slave) gp-0) enter))) + (if t9-2 + (t9-2) + ) + ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> (the-as (state camera-slave) gp-0) event)) + (go (the-as (state camera-slave) gp-0)) + ) + ) + (('teleport) + (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + ) + ) + (none) + ) + +;; definition for function cam-curve-pos +;; INFO: Used lq/sq +(defbehavior cam-curve-pos camera-slave ((arg0 vector) (arg1 vector) (arg2 curve) (arg3 symbol)) + (let ((s5-0 (new-stack-vector0))) + 0.0 + (let ((s2-0 (new-stack-vector0))) + (if arg1 + (set! (-> arg1 w) 0.0) + ) + (when (< (-> self intro-t) 1.0) + (+! (-> self intro-t) (* (-> self intro-t-step) (-> self clock time-adjust-ratio))) + (if (< 1.0 (-> self intro-t)) + (set! (-> self intro-t) 1.0) + ) + (curve-get-pos! s5-0 (parameter-ease-sin-clamp (-> self intro-t)) (-> self intro-curve)) + (vector+! s5-0 s5-0 (-> self intro-offset)) + (vector+! arg0 arg0 s5-0) + (cond + ((not arg1) + ) + ((< (-> self intro-t) 0.5) + (curve-get-pos! s2-0 (+ 0.0001 (parameter-ease-sin-clamp (-> self intro-t))) (-> self intro-curve)) + (vector+! s2-0 s2-0 (-> self intro-offset)) + (vector-! arg1 s2-0 s5-0) + (set! (-> arg1 w) 1.0) + ) + (else + (curve-get-pos! s2-0 (+ -0.0001 (parameter-ease-sin-clamp (-> self intro-t))) (-> self intro-curve)) + (vector+! s2-0 s2-0 (-> self intro-offset)) + (vector-! arg1 s5-0 s2-0) + (set! (-> arg1 w) 1.0) + ) + ) + ) + ) + (cond + ((not (-> self spline-exists)) + ) + ((= (-> self spline-follow-dist) 0.0) + (let ((f0-18 (if arg3 + (cam-index-method-10 (-> self index) (-> self tracking follow-pt)) + (cam-index-method-10 (-> self index) (-> *camera* tpos-curr-adj)) + ) + ) + ) + (if (logtest? #x200000 (-> self options)) + (set! f0-18 (parameter-ease-sin-clamp f0-18)) + ) + (curve-get-pos! s5-0 f0-18 (-> self spline-curve)) + ) + (vector+! s5-0 s5-0 (-> self spline-offset)) + (vector+! arg0 arg0 s5-0) + ) + (else + (let ((s3-1 (new 'stack-no-clear 'vector))) + (curve-length (-> self spline-curve)) + (if arg3 + (set! (-> s3-1 quad) (-> self tracking follow-pt quad)) + (set! (-> s3-1 quad) (-> *camera* tpos-curr-adj quad)) + ) + (set! (-> self spline-tt) + (curve-closest-point (-> self spline-curve) s3-1 (-> self spline-tt) 1024.0 10 (-> self spline-follow-dist)) + ) + ) + (curve-get-pos! s5-0 (-> self spline-tt) (-> self spline-curve)) + (vector+! s5-0 s5-0 (-> self spline-offset)) + (vector+! arg0 arg0 s5-0) + ) + ) + ) + arg0 + ) + +;; definition for function cam-curve-setup +;; INFO: Return type mismatch int vs none. +(defbehavior cam-curve-setup camera-slave ((arg0 vector)) + (when (get-curve-data! (-> self cam-entity) (-> self spline-curve) 'campath 'campath-k -1000000000.0) + (curve-get-pos! (-> self spline-offset) 0.0 (-> self spline-curve)) + (vector-negate! (-> self spline-offset) (-> self spline-offset)) + (cam-index-method-9 (-> self index) 'campoints (-> self cam-entity) arg0 (-> self spline-curve)) + (set! (-> self spline-exists) (the-as basic #t)) + ) + (cond + ((get-curve-data! (-> self cam-entity) (-> self intro-curve) 'intro 'intro-k -1000000000.0) + (curve-get-pos! (-> self intro-offset) 1.0 (-> self intro-curve)) + (vector-negate! (-> self intro-offset) (-> self intro-offset)) + (set! (-> self intro-t) 0.0) + (set! (-> self intro-t-step) (cam-slave-get-intro-step (-> self cam-entity))) + (set! (-> self outro-exit-value) (cam-slave-get-float (-> self cam-entity) 'intro-exitValue 0.0)) + (if (= (-> self outro-exit-value) 0.0) + (set! (-> self outro-exit-value) 0.5) + ) + ) + (else + (set! (-> self intro-t) 1.0) + (set! (-> self intro-t-step) 0.0) + ) + ) + (if (-> *camera* settings no-intro) + (set! (-> self intro-t) 1.0) + ) + 0 + (none) + ) + +;; definition for function cam-calc-follow! +;; INFO: Used lq/sq +;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 +(defun cam-calc-follow! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) + (local-vars (sv-128 (function float float float float)) (sv-144 float) (sv-160 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) + (cond + (arg2 + (update! (-> arg0 tilt-adjust) 0.0) + (update! (-> arg0 point-of-interest-blend) 0.0) + (update! (-> arg0 underwater-blend) 0.0) + ) + (else + (set! (-> arg0 old-cam-trans quad) (-> arg1 quad)) + (jump-to-target! (-> arg0 tilt-adjust) 0.0) + (jump-to-target! (-> arg0 point-of-interest-blend) 0.0) + (jump-to-target! (-> arg0 underwater-blend) 0.0) + ) + ) + (set! (-> arg0 follow-height-extra target) (-> *camera* settings extra-follow-height)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> arg0 follow-pt quad)) + (cond + ((logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) + (let ((s1-0 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (f30-0 (vector-vector-distance (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-flatten! s1-0 (the-as vector (&-> *camera* stack 320)) (-> *camera* local-down)) + (vector-normalize! s1-0 1.0) + (vector-! s0-0 (-> *camera* tpos-curr-adj) arg1) + (vector-flatten! s0-0 s0-0 (-> *camera* local-down)) + (vector-normalize! s0-0 1.0) + (vector-float*! s2-0 (the-as vector (&-> *camera* stack 320)) 32768.0) + (set! sv-128 lerp-clamp) + (set! sv-144 (the-as float 0.7)) + (set! sv-160 (the-as float 0.4)) + (let* ((a2-3 (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0)))) + (f30-1 (sv-128 sv-144 sv-160 a2-3)) + (f0-7 (acos (vector-dot s0-0 s1-0))) + (f28-0 (fmax 1820.4445 f0-7)) + ) + (if (< f28-0 8192.0) + (vector-float*! + s2-0 + s2-0 + (+ f30-1 + (* (/ (- 1.0 f30-1) (- 1.0 (cos 32768.0))) (+ (- (cos 32768.0)) (cos (* 5.142857 (- 8192.0 f28-0))))) + ) + ) + ) + ) + (cond + ((< (-> *camera* ease-t) 1.0) + ) + ((< (-> arg0 follow-blend) 1.0) + (let* ((f0-21 (-> arg0 follow-blend)) + (f0-22 (* f0-21 f0-21)) + (f0-23 (* f0-22 f0-22)) + ) + (vector-! s2-0 s2-0 (-> arg0 follow-off)) + (vector-float*! s2-0 s2-0 f0-23) + ) + (+! (-> arg0 follow-blend) (* 0.016666668 (-> pp clock time-adjust-ratio))) + (vector+! (-> arg0 follow-off) (-> arg0 follow-off) s2-0) + ) + (else + (set! (-> arg0 follow-off quad) (-> s2-0 quad)) + ) + ) + ) + (cond + (arg2 + (if (logtest? (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) (-> *camera* settings slave-options)) + (set! (-> arg0 follow-height-extra vel) 0.0) + (update! (-> arg0 follow-height-extra) 0.0) + ) + ) + (else + (jump-to-target! (-> arg0 follow-height-extra) 0.0) + ) + ) + (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ (-> arg0 follow-height-extra value) (-> *camera* settings target-height)) + ) + ) + (else + 0.0 + (let ((s2-1 (new-stack-vector0))) + (set! (-> arg0 follow-blend) 0.0) + (cond + ((-> arg0 no-follow) + (vector-reset! s2-1) + ) + (else + (vector-! s2-1 (-> *camera* tpos-curr-adj) arg1) + (vector-normalize! s2-1 1.0) + (let* ((f0-32 (vector-dot (the-as vector (&-> *camera* stack 256)) s2-1)) + (f30-2 (cond + ((< f0-32 0.0) + 1.0 + ) + (else + (let* ((f0-33 (* f0-32 f0-32)) (f0-34 (- 1.0 f0-33))) (* f0-34 (* f0-34 f0-34))) + ) + ) + ) + ) + (vector-! s2-1 arg1 (-> *camera* tpos-curr-adj)) + (vector-flatten! s2-1 s2-1 (-> *camera* local-down)) + (let* ((f1-15 (* 0.000022194603 (+ -20480.0 (vector-length s2-1)))) + (f0-37 (fmax 0.0 (fmin 1.0 f1-15))) + ) + (vector-float*! s2-1 (the-as vector (&-> *camera* stack 256)) (* (lerp 2048.0 8192.0 f0-37) f30-2)) + ) + ) + ) + ) + (cond + (arg2 + (vector-seek-3d-smooth! (-> arg0 follow-off) s2-1 (* 20480.0 (-> pp clock seconds-per-frame)) 0.05) + (if (logtest? (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) (-> *camera* settings slave-options)) + (set! (-> arg0 follow-height-extra vel) 0.0) + (update! (-> arg0 follow-height-extra) 0.0) + ) + ) + (else + (set! (-> arg0 follow-off quad) (-> s2-1 quad)) + (jump-to-target! (-> arg0 follow-height-extra) 0.0) + ) + ) + ) + (vector+! (-> arg0 follow-pt) (-> *camera* tpos-curr-adj) (-> arg0 follow-off)) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ (-> arg0 follow-height-extra value) (-> *camera* settings target-height)) + ) + ) + ) + (when (and arg2 (logtest? (cam-slave-options VERTICAL_FOLLOW_MATCHES_CAMERA) (-> *camera* settings slave-options))) + (let ((f0-46 + (vector-dot (-> *camera* local-down) (vector-! (new 'stack-no-clear 'vector) arg1 (-> arg0 old-cam-trans))) + ) + (f1-20 + (vector-dot (-> *camera* local-down) (vector-! (new 'stack-no-clear 'vector) (-> arg0 follow-pt) s4-0)) + ) + ) + (vector--float*! (-> arg0 follow-pt) (-> arg0 follow-pt) (-> *camera* local-down) (- f1-20 f0-46)) + ) + (let ((v1-107 (-> arg0 follow-off))) + (let ((a0-64 (-> arg0 follow-pt)) + (a1-39 (-> *camera* local-down)) + (f0-49 (+ (-> arg0 follow-height-extra value) (-> *camera* settings target-height))) + ) + (.lvf vf2 (&-> a1-39 quad)) + (.lvf vf1 (&-> a0-64 quad)) + (let ((a0-65 f0-49)) + (.mov vf3 a0-65) + ) + ) + (.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-107 quad) vf4) + ) + (vector-! (-> arg0 follow-off) (-> arg0 follow-off) (-> *camera* tpos-curr-adj)) + ) + ) + (set! (-> arg0 old-cam-trans quad) (-> arg1 quad)) + (-> arg0 follow-pt) + ) + ) + ) + +;; definition for function mat-remove-z-rot +;; INFO: Used lq/sq +(defun mat-remove-z-rot ((arg0 matrix) (arg1 vector)) + (let ((s4-0 (new-stack-vector0))) + 0.0 + 0.0 + (let ((s5-0 (new-stack-matrix0))) + (vector-negate! s4-0 arg1) + (vector-flatten! s4-0 s4-0 (-> arg0 vector 2)) + (vector-normalize! s4-0 1.0) + (let ((f0-3 (vector-dot (-> arg0 vector 1) s4-0))) + (when (< f0-3 0.99999) + (vector-cross! s4-0 (-> arg0 vector 1) s4-0) + (let ((f1-1 (vector-length s4-0))) + (if (< 0.0 (vector-dot s4-0 (-> arg0 vector 2))) + (set! f1-1 (- f1-1)) + ) + (matrix-axis-sin-cos! s5-0 (-> arg0 vector 2) f1-1 f0-3) + ) + (matrix*! arg0 arg0 s5-0) + ) + ) + ) + ) + arg0 + ) + +;; definition for function slave-matrix-blend-2 +;; INFO: Used lq/sq +(defun slave-matrix-blend-2 ((arg0 matrix) (arg1 float) (arg2 vector) (arg3 matrix)) + (with-pp + (let ((s1-0 (new-stack-vector0)) + (s4-0 (new-stack-quaternion0)) + ) + (let ((s2-0 (new-stack-quaternion0)) + (gp-0 (new-stack-quaternion0)) + ) + 0.0 + (let* ((f0-1 (cond + ((logtest? (the-as int arg1) 4) + (vector-length arg2) + ) + (else + (vector-flatten! s1-0 arg2 (-> *camera* local-down)) + (vector-length s1-0) + ) + ) + ) + (f0-3 (* 0.00048828125 (+ -1024.0 f0-1))) + ) + (cond + ((< f0-3 0.0) + (set! f0-3 0.0) + ) + ((< 1.0 f0-3) + (set! f0-3 1.0) + ) + ) + (let ((f30-0 (* f0-3 (* (-> *setting-control* cam-current matrix-blend-max-angle) (-> pp clock time-adjust-ratio)))) + ) + (matrix->quaternion s4-0 arg0) + (matrix->quaternion s2-0 arg3) + (quaternion-conjugate! gp-0 s4-0) + (quaternion*! gp-0 gp-0 s2-0) + (quaternion-normalize! gp-0) + (if (< (-> gp-0 w) 0.0) + (quaternion-negate! gp-0 gp-0) + ) + (let ((f28-0 (acos (-> gp-0 w)))) + (if (< (* f28-0 (-> *setting-control* cam-current matrix-blend-max-partial) (-> pp clock time-adjust-ratio)) + f30-0 + ) + (set! f30-0 + (* f28-0 (-> *setting-control* cam-current matrix-blend-max-partial) (-> pp clock time-adjust-ratio)) + ) + ) + (cond + ((< (-> gp-0 w) 0.9999999) + (quaternion-float*! gp-0 gp-0 (/ (sin f30-0) (sin f28-0))) + (set! (-> gp-0 w) (cos f30-0)) + ) + (else + (quaternion-identity! gp-0) + ) + ) + ) + ) + ) + (quaternion*! s4-0 s4-0 gp-0) + ) + (quaternion-normalize! s4-0) + (quaternion->matrix arg0 s4-0) + ) + ) + ) + +;; definition for function vector-into-frustum-nosmooth! +;; INFO: Used lq/sq +(defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float)) + (local-vars (sv-112 (inline-array vector)) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new-stack-matrix0))) + (let ((s3-0 (new-stack-vector0)) + (s2-0 (new-stack-vector0)) + ) + 0.0 + 0.0 + (let ((f30-0 1.0) + (s4-0 #t) + ) + 0.0 + (vector-! s3-0 (-> *camera* tpos-curr) arg1) + (let ((f26-0 (vector-length s3-0))) + (vector-flatten! s3-0 s3-0 (-> arg0 vector 1)) + (vector-normalize! s3-0 1.0) + (let ((f28-0 (vector-dot s3-0 (the-as vector (-> arg0 vector))))) + (set! sv-128 s2-0) + (set! sv-112 (-> arg0 vector)) + (let ((f0-7 (* 0.8 (tan (* 0.5 arg2))))) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-11 f0-7)) + (.mov vf2 v1-11) + ) + ) + (.add.x.vf vf1 vf0 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> sv-128 quad) vf1) + (vector+! s2-0 s2-0 (-> arg0 vector 2)) + (vector-normalize! s2-0 f26-0) + (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) 6144.0) + (vector-normalize! s2-0 1.0) + (let ((f0-9 (fmax 0.0 (vector-dot s2-0 (the-as vector (-> arg0 vector)))))) + (when (< f0-9 (fabs f28-0)) + (if (< f28-0 0.0) + (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) (* 2.0 f0-9)) + ) + (matrix-from-two-vectors! s5-0 s2-0 s3-0) + (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) + (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) (-> arg0 vector 2)) + ) + ) + ) + ) + (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) + (vector-! s3-0 s3-0 arg1) + (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* settings foot-offset)) + (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (vector-normalize! s3-0 1.0) + (let ((f28-1 (vector-dot s3-0 (-> arg0 vector 1)))) + (set! sv-160 s2-0) + (set! sv-144 (-> arg0 vector 1)) + (let ((f0-16 (* 0.525 (tan (* 0.5 arg2))))) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-32 f0-16)) + (.mov vf2 v1-32) + ) + ) + (.add.x.vf vf1 vf0 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> sv-160 quad) vf1) + (vector+! s2-0 s2-0 (-> arg0 vector 2)) + (vector-normalize! s2-0 1.0) + (let ((f0-18 (vector-dot s2-0 (-> arg0 vector 1)))) + (when (and (< f28-1 0.0) (< f0-18 (- f28-1))) + (vector--float*! s2-0 s2-0 (-> arg0 vector 1) (* 2.0 f0-18)) + (set! f30-0 (vector-dot s2-0 s3-0)) + ) + ) + ) + (vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off)) + (vector-! s3-0 s3-0 arg1) + (vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* settings head-offset)) + (vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector))) + (vector-normalize! s3-0 1.0) + (let ((f28-2 (vector-dot s3-0 (-> arg0 vector 1)))) + (let ((s0-1 s2-0)) + (set! sv-176 (-> arg0 vector 1)) + (let ((f0-26 (* 0.525 (tan (* 0.5 arg2))))) + (vector-float*! s0-1 sv-176 f0-26) + ) + ) + (vector+! s2-0 s2-0 (-> arg0 vector 2)) + (vector-normalize! s2-0 1.0) + (let ((f0-28 (vector-dot s2-0 (-> arg0 vector 1)))) + (cond + ((and (< 0.0 f28-2) (< f0-28 f28-2)) + (set! f30-0 (vector-dot s2-0 s3-0)) + (set! s4-0 #f) + ) + ((< f30-0 0.0) + (let ((f0-33 (- (vector-dot s2-0 s3-0)))) + (if (< f0-33 f30-0) + (set! f30-0 f0-33) + ) + ) + ) + ) + ) + ) + (let ((f0-35 (if s4-0 + (- (acos f30-0)) + (acos f30-0) + ) + ) + ) + (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-35) + ) + ) + ) + (vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0) + ) + (vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (the-as vector (-> arg0 vector))) + ) + ) + +;; definition for function slave-set-rotation! +;; INFO: Used lq/sq +;; INFO: Return type mismatch int vs none. +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +(defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 float) (arg3 float) (arg4 symbol)) + (local-vars + (f0-9 float) + (sv-208 vector) + (sv-224 vector) + (sv-240 matrix) + (sv-256 (function matrix vector float vector)) + (sv-272 matrix) + (sv-288 vector) + ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (if (-> *camera* settings use-look-at-point) + (set! (-> arg0 follow-pt quad) (-> *camera* settings look-at-point quad)) + ) + (let ((s0-0 (new-stack-vector0)) + (s1-0 (new-stack-matrix0)) + ) + (let ((f30-0 (-> arg0 tilt-adjust value))) + (cond + ((< 0.0001 (-> arg0 point-of-interest-blend value)) + (set! sv-208 (new 'stack-no-clear 'vector)) + 0.0 + (vector-! s0-0 (-> arg0 follow-pt) arg1) + (let ((f28-0 (vector-length s0-0))) + (vector-! sv-208 (-> *camera* settings point-of-interest) arg1) + (vector-normalize! sv-208 (* f28-0 (-> arg0 point-of-interest-blend value))) + (let ((v1-12 s0-0)) + (let ((a0-10 s0-0)) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> a0-10 quad)) + ) + (.lvf vf5 (&-> sv-208 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> v1-12 quad) vf6) + ) + (vector-normalize! s0-0 f28-0) + ) + (vector-! (-> arg0 looking-interesting) (-> *camera* settings point-of-interest) (-> arg0 follow-pt)) + (let ((v1-15 (-> arg0 looking-interesting))) + (let ((a0-16 (-> arg0 follow-pt)) + (a1-7 (-> arg0 looking-interesting)) + (f0-4 (-> arg0 point-of-interest-blend value)) + ) + (.lvf vf2 (&-> a1-7 quad)) + (.lvf vf1 (&-> a0-16 quad)) + (let ((a0-17 f0-4)) + (.mov vf3 a0-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 (&-> v1-15 quad) vf4) + ) + ) + (else + (vector-! s0-0 (-> arg0 follow-pt) arg1) + (set! (-> arg0 looking-interesting quad) (-> arg1 quad)) + ) + ) + (vector+! (-> arg0 looking-at) s0-0 arg1) + (forward-down->inv-matrix s1-0 s0-0 (-> *camera* local-down)) + (when (!= f30-0 0.0) + 0.0 + 0.0 + (set! sv-240 (new 'stack-no-clear 'matrix)) + (set! sv-224 (new 'stack-no-clear 'vector)) + (vector-normalize-copy! sv-224 s0-0 1.0) + (let* ((v1-24 (-> *camera* local-down)) + (f0-8 (-> sv-224 x)) + (f1-1 (-> sv-224 y)) + (f2-0 (-> sv-224 z)) + (f3-0 (-> v1-24 x)) + (f4-0 (-> v1-24 y)) + (f5-0 (-> v1-24 z)) + ) + (.mula.s f0-8 f3-0) + (.madda.s f1-1 f4-0) + (.madd.s f0-9 f2-0 f5-0) + ) + (let* ((f28-1 f0-9) + (f0-11 (acos (fabs f28-1))) + ) + (cond + ((< 0.0 f30-0) + (set! f30-0 (if (< 0.0 f28-1) + (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-11))) + (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11)))) + ) + ) + ) + ((< f30-0 0.0) + (set! f30-0 (if (< 0.0 f28-1) + (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11))))) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-11)))) + ) + ) + ) + ) + ) + (matrix-rotate-x! sv-240 f30-0) + (let ((t9-6 matrix*!) + (a0-29 s1-0) + (a2-3 s1-0) + ) + (t9-6 a0-29 sv-240 a2-3) + ) + ) + ) + (when (not (-> *camera* settings use-look-at-point)) + (if (and (= (-> *camera* under-water) 2) + *target* + (not (and (-> *target* next-state) (= (-> *target* next-state name) 'target-swim-up))) + ) + (set! (-> arg0 underwater-blend target) 1.0) + (set! (-> arg0 underwater-blend target) 0.0) + ) + ) + (set! sv-256 vector-into-frustum-nosmooth!) + (set! sv-272 s1-0) + (set! sv-288 arg1) + (let ((a2-5 (lerp-clamp arg3 (* 0.25 arg3) (-> arg0 underwater-blend value)))) + (sv-256 sv-272 sv-288 a2-5) + ) + (cond + (arg4 + (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s0-0 s1-0) + ) + (else + (let* ((v1-59 (-> arg0 inv-mat)) + (a3-2 s1-0) + (a0-35 (-> a3-2 vector 0 quad)) + (a1-19 (-> a3-2 vector 1 quad)) + (a2-7 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 trans quad)) + ) + (set! (-> v1-59 vector 0 quad) a0-35) + (set! (-> v1-59 vector 1 quad) a1-19) + (set! (-> v1-59 vector 2 quad) a2-7) + (set! (-> v1-59 trans quad) a3-3) + ) + ) + ) + ) + (mat-remove-z-rot (-> arg0 inv-mat) (-> *camera* local-down)) + (cond + ((not (-> *camera* settings use-point-of-interest)) + (set! (-> arg0 point-of-interest-blend target) 0.0) + ) + (else + (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) (-> *camera* settings point-of-interest) arg1))) + 0.0 + (vector-flatten! s4-2 s4-2 (-> arg0 inv-mat vector 1)) + (vector-normalize! s4-2 1.0) + (let ((f30-1 (vector-dot s4-2 (-> arg0 inv-mat vector 2)))) + (cond + ((< (cos 12743.111) f30-1) + (set! (-> arg0 point-of-interest-blend target) 1.0) + ) + ((and (< 0.0 (-> arg0 point-of-interest-blend target)) (< (cos 8192.0) f30-1)) + (set! (-> arg0 point-of-interest-blend target) 1.0) + ) + (else + (set! (-> arg0 point-of-interest-blend target) 0.0) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for function v-slrp2! +;; INFO: Used lq/sq +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +(defun v-slrp2! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector) (arg5 float)) + (local-vars + (f0-10 float) + (f28-0 float) + (f30-0 float) + (sv-144 float) + (sv-160 vector) + (sv-176 matrix) + (sv-192 vector) + ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (set! sv-144 arg5) + (let ((s0-0 (new-stack-vector0))) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! (-> sv-160 quad) (the-as uint128 0)) + 1.0 + 1.0 + (let ((s3-0 (new-stack-vector0))) + 0.0 + 1.0 + (set! sv-176 (new 'stack-no-clear 'matrix)) + (set! (-> sv-176 vector 0 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 1 quad) (the-as uint128 0)) + (set! (-> sv-176 vector 2 quad) (the-as uint128 0)) + (set! (-> sv-176 trans quad) (the-as uint128 0)) + (cond + ((< 1.0 arg3) + (set! arg3 1.0) + ) + ((< arg3 0.0) + (set! arg3 0.0) + ) + ) + (cond + (arg4 + (vector-flatten! s0-0 arg1 arg4) + (vector-flatten! sv-160 arg2 arg4) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) + (let ((f26-0 (vector-dot arg4 s3-0))) + (vector-normalize-copy! s3-0 arg4 1.0) + (if (< f26-0 0.0) + (vector-negate! s3-0 s3-0) + ) + ) + ) + (else + (set! (-> s0-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) + ) + ) + (let ((t9-10 acos)) + (let* ((v1-22 s0-0) + (f0-9 (-> v1-22 x)) + (f1-2 (-> v1-22 y)) + (f2-0 (-> v1-22 z)) + (f3-0 (-> sv-160 x)) + (f4-0 (-> sv-160 y)) + (f5-0 (-> sv-160 z)) + ) + (.mula.s f0-9 f3-0) + (.madda.s f1-2 f4-0) + (.madd.s f0-10 f2-0 f5-0) + ) + (let* ((f1-3 (t9-10 f0-10)) + (f0-12 (* arg3 f1-3)) + ) + (when (< sv-144 f0-12) + (set! f0-12 sv-144) + (set! arg3 (/ sv-144 f1-3)) + ) + (let* ((f0-13 (cos f0-12)) + (t9-12 matrix-axis-sin-cos!) + (a0-20 sv-176) + (a1-13 s3-0) + (f1-5 1.0) + (f2-3 f0-13) + ) + (t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13) + ) + ) + ) + (vector-matrix*! arg0 s0-0 sv-176) + (let ((s0-1 vector-normalize!)) + (set! sv-192 arg0) + (let ((a1-16 (lerp f30-0 f28-0 arg3))) + (s0-1 sv-192 a1-16) + ) + ) + (when arg4 + (let ((v1-33 arg0)) + (let ((a0-24 arg0) + (a1-17 s3-0) + (f0-15 (vector-dot arg1 s3-0)) + ) + (.lvf vf2 (&-> a1-17 quad)) + (.lvf vf1 (&-> a0-24 quad)) + (let ((a0-25 f0-15)) + (.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-33 quad) vf4) + ) + (let ((v1-34 arg0)) + (let ((a0-26 arg0) + (a1-18 s3-0) + (f0-17 (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) + ) + (.lvf vf2 (&-> a1-18 quad)) + (.lvf vf1 (&-> a0-26 quad)) + (let ((a0-27 f0-17)) + (.mov vf3 a0-27) + ) + ) + (.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-34 quad) vf4) + ) + ) + ) + ) + arg0 + ) + ) + +;; definition for function v-slrp3! +;; INFO: Used lq/sq +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +(defun v-slrp3! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float)) + (local-vars (f0-7 float) (f26-0 float) (f28-0 float) (sv-144 float) (sv-160 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + ) + (init-vf0-vector) + (set! sv-144 arg4) + (let ((s1-0 (new-stack-vector0))) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! (-> sv-160 quad) (the-as uint128 0)) + 0.0 + 0.0 + (let ((s3-0 (new-stack-vector0)) + (f30-0 1.0) + ) + 0.0 + (let ((s0-0 (new-stack-matrix0))) + (cond + (arg3 + (vector-flatten! s1-0 arg1 arg3) + (vector-flatten! sv-160 arg2 arg3) + (set! f28-0 (vector-normalize-ret-len! s1-0 1.0)) + (set! f26-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s1-0) 1.0) + (let ((f24-0 (vector-dot arg3 s3-0))) + (vector-normalize-copy! s3-0 arg3 1.0) + (if (< f24-0 0.0) + (vector-negate! s3-0 s3-0) + ) + ) + ) + (else + (set! (-> s1-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f28-0 (vector-normalize-ret-len! s1-0 1.0)) + (set! f26-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) + ) + ) + (let ((t9-10 acos)) + (let* ((v1-10 s1-0) + (f0-6 (-> v1-10 x)) + (f1-0 (-> v1-10 y)) + (f2-0 (-> v1-10 z)) + (f3-0 (-> sv-160 x)) + (f4-0 (-> sv-160 y)) + (f5-0 (-> sv-160 z)) + ) + (.mula.s f0-6 f3-0) + (.madda.s f1-0 f4-0) + (.madd.s f0-7 f2-0 f5-0) + ) + (let ((f0-8 (t9-10 f0-7))) + (when (< sv-144 f0-8) + (set! f30-0 (/ sv-144 f0-8)) + (set! f0-8 sv-144) + ) + (let* ((f0-9 (cos f0-8)) + (t9-12 matrix-axis-sin-cos!) + (a0-20 s0-0) + (a1-13 s3-0) + (f1-3 1.0) + (f2-1 f0-9) + ) + (t9-12 a0-20 a1-13 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-9) + ) + ) + ) + (vector-matrix*! arg0 s1-0 s0-0) + ) + (vector-normalize! arg0 (lerp f28-0 f26-0 f30-0)) + (when arg3 + (let ((v1-21 arg0)) + (let ((a0-24 arg0) + (a1-17 s3-0) + (f0-11 (vector-dot arg1 s3-0)) + ) + (.lvf vf2 (&-> a1-17 quad)) + (.lvf vf1 (&-> a0-24 quad)) + (let ((a0-25 f0-11)) + (.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-21 quad) vf4) + ) + (let ((v1-22 arg0)) + (let ((a0-26 arg0) + (a1-18 s3-0) + (f0-14 (* f30-0 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) + ) + (.lvf vf2 (&-> a1-18 quad)) + (.lvf vf1 (&-> a0-26 quad)) + (let ((a0-27 f0-14)) + (.mov vf3 a0-27) + ) + ) + (.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-22 quad) vf4) + ) + ) + ) + ) + arg0 + ) + ) 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 69879690f5..3a50e611a9 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,7 +153,7 @@ :flag-assert #x1a00008670 (:methods (collide-cache-method-9 () none 9) - (collide-cache-method-10 () none 10) + (fill-and-probe-using-line-sphere (_type_ vector vector float collide-spec process collide-tri-result pat-surface) float 10) (collide-cache-method-11 () none 11) (collide-cache-method-12 () none 12) (collide-cache-method-13 () none 13) @@ -251,7 +251,3 @@ ;; failed to figure out what this is: (kmemclose) - - - - diff --git a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc index 1659d4c4a8..17adbad7fa 100644 --- a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc @@ -41,40 +41,40 @@ ) ;; definition for function dm-cam-settings-func -(defun dm-cam-settings-func ((arg0 camera-slave-options) (arg1 debug-menu-msg)) +(defun dm-cam-settings-func ((arg0 cam-slave-options) (arg1 debug-menu-msg)) (when (and (= arg1 (debug-menu-msg press)) *camera*) (cond ((zero? arg0) (send-event *camera* 'toggle-slave-option 1) ) - ((= arg0 (camera-slave-options butt-cam)) + ((= arg0 (cam-slave-options BUTT_CAM)) (send-event *camera* 'toggle-slave-option 2) ) - ((= arg0 (camera-slave-options same-side)) + ((= arg0 (cam-slave-options SAME_SIDE)) (send-event *camera* 'toggle-slave-option 4) ) - ((= arg0 (camera-slave-options butt-cam same-side)) + ((= arg0 (cam-slave-options BUTT_CAM SAME_SIDE)) (send-event *camera* 'toggle-slave-option 128) ) - ((= arg0 (camera-slave-options move-spherical)) + ((= arg0 (cam-slave-options MOVE_SPHERICAL)) (send-event *camera* 'toggle-slave-option 8) ) - ((= arg0 (camera-slave-options same-side move-spherical)) + ((= arg0 (cam-slave-options SAME_SIDE MOVE_SPHERICAL)) (set-setting-by-param *setting-control* 'slave-options 'clear 0 16) ) - ((= arg0 (camera-slave-options butt-cam same-side move-spherical)) + ((= arg0 (cam-slave-options BUTT_CAM SAME_SIDE MOVE_SPHERICAL)) (send-event *camera* 'toggle-slave-option 64) ) - ((= arg0 (camera-slave-options allow-z-rot)) + ((= arg0 (cam-slave-options ALLOW_Z_ROT)) (send-event *camera* 'toggle-slave-option 32) ) - ((= arg0 (camera-slave-options butt-cam allow-z-rot)) + ((= arg0 (cam-slave-options BUTT_CAM ALLOW_Z_ROT)) (send-event *camera* 'toggle-slave-option 512) ) - ((= arg0 (camera-slave-options same-side allow-z-rot)) + ((= arg0 (cam-slave-options SAME_SIDE ALLOW_Z_ROT)) (send-event *camera* 'toggle-slave-option #x4000) ) - ((= arg0 (camera-slave-options butt-cam same-side allow-z-rot)) + ((= arg0 (cam-slave-options BUTT_CAM SAME_SIDE ALLOW_Z_ROT)) (send-event *camera* 'toggle-slave-option #x8000) ) ) @@ -85,34 +85,34 @@ ((zero? arg0) (logtest? (-> *camera* slave-options) 1) ) - ((= arg0 (camera-slave-options butt-cam)) + ((= arg0 (cam-slave-options BUTT_CAM)) (logtest? (-> *camera* slave-options) 2) ) - ((= arg0 (camera-slave-options same-side)) + ((= arg0 (cam-slave-options SAME_SIDE)) (logtest? (-> *camera* slave-options) 4) ) - ((= arg0 (camera-slave-options butt-cam same-side)) + ((= arg0 (cam-slave-options BUTT_CAM SAME_SIDE)) (logtest? (-> *camera* slave-options) 128) ) - ((= arg0 (camera-slave-options move-spherical)) + ((= arg0 (cam-slave-options MOVE_SPHERICAL)) (logtest? (-> *camera* slave-options) 8) ) - ((= arg0 (camera-slave-options same-side move-spherical)) + ((= arg0 (cam-slave-options SAME_SIDE MOVE_SPHERICAL)) (not (setting-control-method-14 *setting-control* 'slave-options)) ) - ((= arg0 (camera-slave-options butt-cam same-side move-spherical)) + ((= arg0 (cam-slave-options BUTT_CAM SAME_SIDE MOVE_SPHERICAL)) (logtest? (-> *camera* slave-options) 64) ) - ((= arg0 (camera-slave-options allow-z-rot)) + ((= arg0 (cam-slave-options ALLOW_Z_ROT)) (logtest? (-> *camera* slave-options) 32) ) - ((= arg0 (camera-slave-options butt-cam allow-z-rot)) + ((= arg0 (cam-slave-options BUTT_CAM ALLOW_Z_ROT)) (logtest? (-> *camera* slave-options) 512) ) - ((= arg0 (camera-slave-options same-side allow-z-rot)) + ((= arg0 (cam-slave-options SAME_SIDE ALLOW_Z_ROT)) (logtest? (-> *camera* slave-options) #x4000) ) - ((= arg0 (camera-slave-options butt-cam same-side allow-z-rot)) + ((= arg0 (cam-slave-options BUTT_CAM SAME_SIDE ALLOW_Z_ROT)) (logtest? (-> *camera* slave-options) #x8000) ) (else @@ -1253,18 +1253,18 @@ (format #t " (set! (-> pos y) ~12F)~%" (-> *math-camera* trans y)) (format #t " (set! (-> pos z) ~12F)~%" (-> *math-camera* trans z)) (format #t " (set! (-> pos w) 1.0)~%") - (format #t " (set! (-> rot data 0) ~12F)~%" (-> *math-camera* inv-camera-rot data 0)) - (format #t " (set! (-> rot data 1) ~12F)~%" (-> *math-camera* inv-camera-rot data 1)) - (format #t " (set! (-> rot data 2) ~12F)~%" (-> *math-camera* inv-camera-rot data 2)) - (format #t " (set! (-> rot data 3) ~12F)~%" (-> *math-camera* inv-camera-rot data 3)) - (format #t " (set! (-> rot data 4) ~12F)~%" (-> *math-camera* inv-camera-rot data 4)) - (format #t " (set! (-> rot data 5) ~12F)~%" (-> *math-camera* inv-camera-rot data 5)) - (format #t " (set! (-> rot data 6) ~12F)~%" (-> *math-camera* inv-camera-rot data 6)) - (format #t " (set! (-> rot data 7) ~12F)~%" (-> *math-camera* inv-camera-rot data 7)) - (format #t " (set! (-> rot data 8) ~12F)~%" (-> *math-camera* inv-camera-rot data 8)) - (format #t " (set! (-> rot data 9) ~12F)~%" (-> *math-camera* inv-camera-rot data 9)) - (format #t " (set! (-> rot data 10) ~12F)~%" (-> *math-camera* inv-camera-rot data 10)) - (format #t " (set! (-> rot data 11) ~12F)~%" (-> *math-camera* inv-camera-rot data 11)) + (format #t " (set! (-> rot data 0) ~12F)~%" (-> *math-camera* inv-camera-rot vector 0 x)) + (format #t " (set! (-> rot data 1) ~12F)~%" (-> *math-camera* inv-camera-rot vector 0 y)) + (format #t " (set! (-> rot data 2) ~12F)~%" (-> *math-camera* inv-camera-rot vector 0 z)) + (format #t " (set! (-> rot data 3) ~12F)~%" (-> *math-camera* inv-camera-rot vector 0 w)) + (format #t " (set! (-> rot data 4) ~12F)~%" (-> *math-camera* inv-camera-rot vector 1 x)) + (format #t " (set! (-> rot data 5) ~12F)~%" (-> *math-camera* inv-camera-rot vector 1 y)) + (format #t " (set! (-> rot data 6) ~12F)~%" (-> *math-camera* inv-camera-rot vector 1 z)) + (format #t " (set! (-> rot data 7) ~12F)~%" (-> *math-camera* inv-camera-rot vector 1 w)) + (format #t " (set! (-> rot data 8) ~12F)~%" (-> *math-camera* inv-camera-rot vector 2 x)) + (format #t " (set! (-> rot data 9) ~12F)~%" (-> *math-camera* inv-camera-rot vector 2 y)) + (format #t " (set! (-> rot data 10) ~12F)~%" (-> *math-camera* inv-camera-rot vector 2 z)) + (format #t " (set! (-> rot data 11) ~12F)~%" (-> *math-camera* inv-camera-rot vector 2 w)) (format #t " (set! (-> rot data 12) ~12F)~%" 0) (format #t " (set! (-> rot data 13) ~12F)~%" 0) (format #t " (set! (-> rot data 14) ~12F)~%" 0) diff --git a/test/decompiler/reference/jak2/engine/geometry/cylinder_REF.gc b/test/decompiler/reference/jak2/engine/geometry/cylinder_REF.gc index bf131e0a09..89887772f1 100644 --- a/test/decompiler/reference/jak2/engine/geometry/cylinder_REF.gc +++ b/test/decompiler/reference/jak2/engine/geometry/cylinder_REF.gc @@ -409,7 +409,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc b/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc index c515b8d5ae..f43f3d383a 100644 --- a/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc +++ b/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc @@ -352,15 +352,15 @@ ;; definition for function forward-down->inv-matrix ;; INFO: Used lq/sq (defun forward-down->inv-matrix ((arg0 matrix) (arg1 vector) (arg2 vector)) - (vector-normalize-copy! (the-as vector (&-> arg0 data 8)) arg1 1.0) - (vector-cross! (the-as vector (-> arg0 data)) (the-as vector (&-> arg0 data 8)) arg2) - (vector-normalize! (the-as vector (-> arg0 data)) 1.0) - (vector-cross! (the-as vector (&-> arg0 data 4)) arg1 (the-as vector (-> arg0 data))) - (vector-normalize! (the-as vector (&-> arg0 data 4)) 1.0) + (vector-normalize-copy! (-> arg0 vector 2) arg1 1.0) + (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 2) arg2) + (vector-normalize! (the-as vector (-> arg0 vector)) 1.0) + (vector-cross! (-> arg0 vector 1) arg1 (the-as vector (-> arg0 vector))) + (vector-normalize! (-> arg0 vector 1) 1.0) (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 data 3) 0.0) - (set! (-> arg0 data 7) 0.0) - (set! (-> arg0 data 11) 0.0) + (set! (-> arg0 vector 0 w) 0.0) + (set! (-> arg0 vector 1 w) 0.0) + (set! (-> arg0 vector 2 w) 0.0) (set! (-> arg0 trans w) 1.0) arg0 ) @@ -368,20 +368,16 @@ ;; definition for function forward-down-nopitch->inv-matrix ;; INFO: Used lq/sq (defun forward-down-nopitch->inv-matrix ((arg0 matrix) (arg1 vector) (arg2 vector)) - (vector-normalize-copy! (the-as vector (&-> arg0 data 4)) arg2 1.0) - (vector-negate! (the-as vector (&-> arg0 data 4)) (the-as vector (&-> arg0 data 4))) - (vector-cross! (the-as vector (-> arg0 data)) (the-as vector (&-> arg0 data 4)) arg1) - (vector-normalize! (the-as vector (-> arg0 data)) 1.0) - (vector-cross! - (the-as vector (&-> arg0 data 8)) - (the-as vector (-> arg0 data)) - (the-as vector (&-> arg0 data 4)) - ) - (vector-normalize! (the-as vector (&-> arg0 data 8)) 1.0) + (vector-normalize-copy! (-> arg0 vector 1) arg2 1.0) + (vector-negate! (-> arg0 vector 1) (-> arg0 vector 1)) + (vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) arg1) + (vector-normalize! (the-as vector (-> arg0 vector)) 1.0) + (vector-cross! (-> arg0 vector 2) (the-as vector (-> arg0 vector)) (-> arg0 vector 1)) + (vector-normalize! (-> arg0 vector 2) 1.0) (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 data 3) 0.0) - (set! (-> arg0 data 7) 0.0) - (set! (-> arg0 data 11) 0.0) + (set! (-> arg0 vector 0 w) 0.0) + (set! (-> arg0 vector 1 w) 0.0) + (set! (-> arg0 vector 2 w) 0.0) (set! (-> arg0 trans w) 1.0) arg0 ) @@ -634,16 +630,16 @@ 0.0 (let ((s5-0 (new-stack-matrix0))) (vector-negate! s4-0 (the-as vector arg1)) - (vector-flatten! s4-0 s4-0 (the-as vector (&-> arg0 data 8))) + (vector-flatten! s4-0 s4-0 (-> arg0 vector 2)) (vector-normalize! s4-0 1.0) - (let ((f30-0 (vector-dot (the-as vector (&-> arg0 data 4)) s4-0))) + (let ((f30-0 (vector-dot (-> arg0 vector 1) s4-0))) (when (< f30-0 0.99999) - (vector-cross! s4-0 (the-as vector (&-> arg0 data 4)) s4-0) + (vector-cross! s4-0 (-> arg0 vector 1) s4-0) (let ((f0-4 (vector-length s4-0))) - (if (< 0.0 (vector-dot s4-0 (the-as vector (&-> arg0 data 8)))) + (if (< 0.0 (vector-dot s4-0 (-> arg0 vector 2))) (set! f0-4 (- f0-4)) ) - (matrix-axis-sin-cos! s5-0 (the-as vector (&-> arg0 data 8)) f0-4 f30-0) + (matrix-axis-sin-cos! s5-0 (-> arg0 vector 2) f0-4 f30-0) ) (matrix*! arg0 arg0 s5-0) ) @@ -689,12 +685,7 @@ (quaternion->matrix s5-0 arg1) (quaternion->matrix s4-0 arg2) (let ((s2-1 (new-stack-quaternion0))) - (quaternion-from-two-vectors-max-angle! - s2-1 - (the-as vector (&-> s5-0 data 8)) - (the-as vector (&-> s4-0 data 8)) - arg4 - ) + (quaternion-from-two-vectors-max-angle! s2-1 (-> s5-0 vector 2) (-> s4-0 vector 2) arg4) (quaternion-normalize! (quaternion*! arg0 arg0 s2-1)) ) ) @@ -911,53 +902,41 @@ (nop!) (label cfg-3) (b! (nonzero? v1-4) cfg-6 :delay (set! v1-5 (+ v1-4 -1))) - (vector-segment-distance-point! arg1 (the-as vector (-> arg2 data)) (the-as vector (&-> arg2 data 4)) arg0) + (vector-segment-distance-point! arg1 (the-as vector (-> arg2 vector)) (-> arg2 vector 1) arg0) (goto cfg-24) (label cfg-6) (b! (nonzero? v1-5) cfg-9 :delay (set! v1-6 (+ v1-5 -1))) - (vector-segment-distance-point! arg1 (the-as vector (&-> arg2 data 4)) (the-as vector (&-> arg2 data 8)) arg0) + (vector-segment-distance-point! arg1 (-> arg2 vector 1) (-> arg2 vector 2) arg0) (goto cfg-24) (label cfg-9) (b! (nonzero? v1-6) cfg-14 :delay (set! v1-7 (+ v1-6 -1))) - (let ((f30-0 - (vector-segment-distance-point! arg1 (the-as vector (&-> arg2 data 4)) (the-as vector (-> arg2 data)) arg0) - ) + (let ((f30-0 (vector-segment-distance-point! arg1 (-> arg2 vector 1) (the-as vector (-> arg2 vector)) arg0)) (s3-0 (new 'stack-no-clear 'vector)) ) - (if (< (vector-segment-distance-point! arg1 (the-as vector (&-> arg2 data 4)) (the-as vector (&-> arg2 data 8)) s3-0) - f30-0 - ) + (if (< (vector-segment-distance-point! arg1 (-> arg2 vector 1) (-> arg2 vector 2) s3-0) f30-0) (set! (-> arg0 quad) (-> s3-0 quad)) ) ) (goto cfg-24) (label cfg-14) (b! (nonzero? v1-7) cfg-17 :delay (set! v1-10 (+ v1-7 -1))) - (vector-segment-distance-point! arg1 (the-as vector (&-> arg2 data 8)) (the-as vector (-> arg2 data)) arg0) + (vector-segment-distance-point! arg1 (-> arg2 vector 2) (the-as vector (-> arg2 vector)) arg0) (goto cfg-24) (label cfg-17) (b! (nonzero? v1-10) cfg-22 :delay (nop!)) - (let ((f30-1 - (vector-segment-distance-point! arg1 (the-as vector (-> arg2 data)) (the-as vector (&-> arg2 data 4)) arg0) - ) + (let ((f30-1 (vector-segment-distance-point! arg1 (the-as vector (-> arg2 vector)) (-> arg2 vector 1) arg0)) (s3-1 (new 'stack-no-clear 'vector)) ) - (if (< (vector-segment-distance-point! arg1 (the-as vector (-> arg2 data)) (the-as vector (&-> arg2 data 8)) s3-1) - f30-1 - ) + (if (< (vector-segment-distance-point! arg1 (the-as vector (-> arg2 vector)) (-> arg2 vector 2) s3-1) f30-1) (set! (-> arg0 quad) (-> s3-1 quad)) ) ) (goto cfg-24) (label cfg-22) - (let ((f30-2 - (vector-segment-distance-point! arg1 (the-as vector (&-> arg2 data 8)) (the-as vector (-> arg2 data)) arg0) - ) + (let ((f30-2 (vector-segment-distance-point! arg1 (-> arg2 vector 2) (the-as vector (-> arg2 vector)) arg0)) (s3-2 (new 'stack-no-clear 'vector)) ) - (if (< (vector-segment-distance-point! arg1 (the-as vector (&-> arg2 data 8)) (the-as vector (&-> arg2 data 4)) s3-2) - f30-2 - ) + (if (< (vector-segment-distance-point! arg1 (-> arg2 vector 2) (-> arg2 vector 1) s3-2) f30-2) (set! (-> arg0 quad) (-> s3-2 quad)) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc b/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc index 0a01f8911d..3241bb1aa2 100644 --- a/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc @@ -111,10 +111,10 @@ (let ((f4-34 (/ f1-21 (* (-> arg0 d) (- (-> arg0 f) (-> arg0 d))))) (f3-30 (-> arg0 fov-correction-factor)) ) - (set! (-> arg0 perspective data 0) (* f3-30 (- (/ (-> arg0 x-pix) (* (-> arg0 x-ratio) (-> arg0 d)))))) - (set! (-> arg0 perspective data 5) (* f3-30 (- (/ (-> arg0 y-pix) (* (-> arg0 y-ratio) (-> arg0 d)))))) - (set! (-> arg0 perspective data 10) (* f3-30 (+ (-> arg0 f) (-> arg0 d)) f4-34)) - (set! (-> arg0 perspective data 11) (* (/ f3-30 (-> arg0 d)) f30-0)) + (set! (-> arg0 perspective vector 0 x) (* f3-30 (- (/ (-> arg0 x-pix) (* (-> arg0 x-ratio) (-> arg0 d)))))) + (set! (-> arg0 perspective vector 1 y) (* f3-30 (- (/ (-> arg0 y-pix) (* (-> arg0 y-ratio) (-> arg0 d)))))) + (set! (-> arg0 perspective vector 2 z) (* f3-30 (+ (-> arg0 f) (-> arg0 d)) f4-34)) + (set! (-> arg0 perspective vector 2 w) (* (/ f3-30 (-> arg0 d)) f30-0)) (set! (-> arg0 perspective trans z) (* -2.0 f4-34 (-> arg0 f) (-> arg0 d) f3-30)) ) (let ((f24-0 2048.0) @@ -162,28 +162,18 @@ (set! (-> arg0 isometric trans z) (- 16777215.0 f22-0)) ) (set! (-> arg0 isometric trans w) f30-0) - (let ((f1-28 (-> arg0 perspective data 0)) - (f2-19 (-> arg0 perspective data 5)) - (f0-48 (* -1.9996 (-> arg0 perspective data 0))) + (let ((f1-28 (-> arg0 perspective vector 0 x)) + (f2-19 (-> arg0 perspective vector 1 y)) + (f0-48 (* -1.9996 (-> arg0 perspective vector 0 x))) ) (let ((v1-39 (-> arg0 sprite-2d))) - (set! (-> v1-39 data 0) f0-48) - (set! (-> v1-39 data 1) 0.0) - (set! (-> v1-39 data 2) 0.0) - (set! (-> v1-39 data 3) 0.0) - ) - (let ((v1-40 (&-> arg0 sprite-2d data 4))) - (set! (-> v1-40 0) 0.0) - (set! (-> v1-40 1) (- (* (/ f2-19 f1-28) f0-48))) - (set! (-> v1-40 2) 0.0) - (set! (-> v1-40 3) 0.0) - ) - (let ((v1-41 (&-> arg0 sprite-2d data 8))) - (set! (-> v1-41 0) 0.0) - (set! (-> v1-41 1) 0.0) - (set! (-> v1-41 2) (- f0-48)) - (set! (-> v1-41 3) 0.0) + (set! (-> v1-39 vector 0 x) f0-48) + (set! (-> v1-39 vector 0 y) 0.0) + (set! (-> v1-39 vector 0 z) 0.0) + (set! (-> v1-39 vector 0 w) 0.0) ) + (set-vector! (-> arg0 sprite-2d vector 1) 0.0 (- (* (/ f2-19 f1-28) f0-48)) 0.0 0.0) + (set-vector! (-> arg0 sprite-2d vector 2) 0.0 0.0 (- f0-48) 0.0) (set-vector! (-> arg0 sprite-2d trans) 0.0 0.0 (* 500000000.0 f0-48) (* 60.0 f0-48 (-> arg0 pfog0))) ) (set! (-> arg0 sprite-2d-hvdf quad) (-> arg0 hvdf-off quad)) @@ -258,9 +248,9 @@ (matrix-identity! (-> gp-0 inv-camera-rot-other)) (matrix-identity! (-> gp-0 camera-rot-other)) (matrix-identity! (-> gp-0 camera-temp-other)) - (set! (-> gp-0 isometric data 0) 1.0) - (set! (-> gp-0 isometric data 5) 0.5) - (set! (-> gp-0 isometric data 10) -1.0) + (set! (-> gp-0 isometric vector 0 x) 1.0) + (set! (-> gp-0 isometric vector 1 y) 0.5) + (set! (-> gp-0 isometric vector 2 z) -1.0) (set! (-> gp-0 reset) 1) (set! (-> gp-0 smooth-step) 0.0) (set! (-> gp-0 smooth-t) 0.0) @@ -491,8 +481,8 @@ (defun reverse-transform-point! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) (let* ((v1-1 (-> *math-camera* perspective)) (s2-0 (-> *math-camera* camera-rot)) - (f30-0 (* (/ (-> v1-1 data 11) (-> v1-1 data 0)) (-> *math-camera* hmge-scale w))) - (f28-0 (* (/ (-> v1-1 data 11) (-> v1-1 data 5)) (-> *math-camera* hmge-scale w))) + (f30-0 (* (/ (-> v1-1 vector 2 w) (-> v1-1 vector 0 x)) (-> *math-camera* hmge-scale w))) + (f28-0 (* (/ (-> v1-1 vector 2 w) (-> v1-1 vector 1 y)) (-> *math-camera* hmge-scale w))) (s4-0 (vector-rotate*! (new 'stack-no-clear 'vector) arg2 s2-0)) (v1-3 (vector-matrix*! (new 'stack-no-clear 'vector) arg1 s2-0)) (f0-8 (/ (+ (* (-> s4-0 x) (-> v1-3 x)) (* (-> s4-0 y) (-> v1-3 y)) (* (-> s4-0 z) (-> v1-3 z))) diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day-h_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day-h_REF.gc index 81c76fbc80..414ca9c808 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day-h_REF.gc @@ -34,8 +34,8 @@ :size-assert #x110 :flag-assert #xb00000110 (:methods - (palette-fade-controls-method-9 () none 9) - (palette-fade-controls-method-10 () none 10) + (reset! (_type_) none 9) + (set-fade! (_type_ int float float vector) object 10) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc index c95d0aa999..d32fae5db0 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc @@ -48,8 +48,8 @@ (let ((entry-idx 0) (ientry-idx 0) (turns 3) - (cam-aspx (- (-> *math-camera* perspective data 0))) - (cam-aspy (- (-> *math-camera* perspective data 5))) + (cam-aspx (- (-> *math-camera* perspective vector 0 x))) + (cam-aspy (- (-> *math-camera* perspective vector 1 y))) ) (when (or (!= cam-aspx (-> tbls aspx)) (!= cam-aspy (-> tbls aspy))) (set! (-> tbls aspx) cam-aspx) @@ -290,7 +290,7 @@ (set! (-> sprite flag-rot-sy x) (the-as float #xb)) ) (set! (-> (the-as (pointer int32) dma-st-flag) 3) (the-as int (-> sprite flag-rot-sy x))) - (let* ((f1-4 (- (-> *math-camera* perspective data 5))) + (let* ((f1-4 (- (-> *math-camera* perspective vector 1 y))) (f2-2 (-> (the-as vector dma-st-flag) y)) (f4-0 (+ f2-2 (* (-> (the-as vector dma-color) x) f1-4))) (f3-0 256.0) @@ -436,7 +436,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc index 57d9270655..b1784e3748 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc @@ -416,9 +416,9 @@ (set! (-> data sincos-67 w) -0.0013636408) (set! (-> data sincos-89 w) 0.000020170546) (set! (-> data basis-x quad) (the-as uint128 0)) - (set! (-> data basis-x x) (- (-> *math-camera* perspective data 0))) + (set! (-> data basis-x x) (- (-> *math-camera* perspective vector 0 x))) (set! (-> data basis-y quad) (the-as uint128 0)) - (set! (-> data basis-y y) (- (-> *math-camera* perspective data 5))) + (set! (-> data basis-y y) (- (-> *math-camera* perspective vector 1 y))) (set! (-> data min-scale) (sqrtf (* (/ 1.0 (-> data basis-x x)) (/ 1.0 (-> data basis-y y))))) (set! (-> data inv-area) (/ 1.0 (* (-> data min-scale) (-> data min-scale)))) (set-vector! (-> data cdata 0) -0.5 -0.5 0.0 0.0) @@ -584,9 +584,9 @@ (set! (-> a1-10 base) (&+ (the-as pointer pkt2) 16)) ) (let ((mtx2 (the-as matrix (-> dma-buff base))) - (f1-0 (-> *math-camera* perspective data 0)) - (f2-0 (-> *math-camera* perspective data 5)) - (f0-1 (* -1.9996 (-> *math-camera* perspective data 0))) + (f1-0 (-> *math-camera* perspective vector 0 x)) + (f2-0 (-> *math-camera* perspective vector 1 y)) + (f0-1 (* -1.9996 (-> *math-camera* perspective vector 0 x))) ) (set-vector! (the-as vector (&+ (the-as pointer mtx2) 0)) f0-1 0.0 0.0 0.0) (set-vector! (the-as vector (&+ (the-as pointer mtx2) 16)) 0.0 (- (* (/ f2-0 f1-0) f0-1)) 0.0 0.0) diff --git a/test/decompiler/reference/jak2/engine/level/bsp-h_REF.gc b/test/decompiler/reference/jak2/engine/level/bsp-h_REF.gc index b3102cfea0..f6e41046f2 100644 --- a/test/decompiler/reference/jak2/engine/level/bsp-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/bsp-h_REF.gc @@ -49,8 +49,11 @@ (cameras (array entity-camera) :offset-assert 116) (nodes (inline-array bsp-node) :offset 120) (level level :offset-assert 124) + (current-leaf-idx uint16 :offset-assert 128) (unk-data-2 uint16 9 :offset 130) - (unk-byte uint8 :offset 152) + (unk-byte1 uint8 :offset 152) + (unk-byte2 uint8 :offset 153) + (unk-half-word uint16 :offset-assert 154) (ambients symbol :offset-assert 156) (unk-data-4 float :offset 160) (unk-data-5 float :offset-assert 164) diff --git a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc index 84a26730ff..785cd66888 100644 --- a/test/decompiler/reference/jak2/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/level-h_REF.gc @@ -394,78 +394,78 @@ ;; definition of type level (deftype level (basic) - ((name symbol :offset-assert 4) - (load-name basic :offset-assert 8) - (nickname basic :offset-assert 12) - (index int32 :offset-assert 16) - (status symbol :offset-assert 20) - (borrow-level basic 2 :offset-assert 24) - (borrow-from-level basic :offset-assert 32) - (heap kheap :inline :offset-assert 48) - (borrow-heap kheap 2 :inline :offset-assert 64) - (bsp bsp-header :offset-assert 96) - (art-group load-dir-art-group :offset-assert 100) - (info level-load-info :offset-assert 104) - (texture-page texture-page 18 :offset-assert 108) - (loaded-texture-page texture-page 16 :offset-assert 180) - (loaded-texture-page-count int32 :offset-assert 244) - (entity entity-links-array :offset-assert 248) - (closest-object float :offset-assert 252) - (closest-object-array float 18 :offset 252) - (upload-size int32 18 :offset 324) - (inside-boxes symbol :offset-assert 396) - (display? symbol :offset-assert 400) - (render? symbol :offset-assert 404) - (meta-inside? symbol :offset-assert 408) - (force-inside? symbol :offset-assert 412) - (mood-context mood-context :inline :offset-assert 416) - (mood-func basic :offset-assert 2384) - (mood-init (function mood-context none) :offset-assert 2388) - (vis-bits pointer :offset-assert 2392) - (all-visible? symbol :offset-assert 2396) - (force-all-visible? symbol :offset-assert 2400) - (linking basic :offset-assert 2404) - (vis-info level-vis-info 8 :offset-assert 2408) - (vis-self-index int32 :offset-assert 2440) - (vis-adj-index int32 :offset-assert 2444) - (vis-buffer uint8 2048 :offset-assert 2448) - (mem-usage-block memory-usage-block :offset-assert 4496) - (mem-usage int32 :offset-assert 4500) - (code-memory-start pointer :offset-assert 4504) - (code-memory-end pointer :offset-assert 4508) - (load-start-time time-frame :offset-assert 4512) - (load-stop-time time-frame :offset-assert 4520) - (load-buffer uint32 2 :offset-assert 4528) - (load-buffer-size uint32 :offset-assert 4536) - (load-buffer-last uint32 :offset-assert 4540) - (load-buffer-mode load-buffer-mode :offset-assert 4544) - (display-start-time time-frame :offset-assert 4552) - (memory-mask uint32 :offset-assert 4560) - (task-mask task-mask :offset-assert 4564) - (tfrag-gs-test uint64 :offset-assert 4568) - (texture-dirty-masks texture-mask 10 :inline :offset-assert 4576) - (texture-mask texture-mask 18 :inline :offset-assert 4736) - (sky-mask texture-mask :inline :offset-assert 5024) - (tfrag-masks basic :offset-assert 5040) - (tfrag-dists pointer :offset-assert 5044) - (shrub-masks basic :offset-assert 5048) - (shrub-dists pointer :offset-assert 5052) - (alpha-masks basic :offset-assert 5056) - (alpha-dists pointer :offset-assert 5060) - (water-masks basic :offset-assert 5064) - (water-dists pointer :offset-assert 5068) - (tfrag-last-calls int32 6 :offset-assert 5072) - (texture-anim-array texture-anim-array 10 :offset-assert 5096) - (light-hash basic :offset-assert 5136) - (draw-priority float :offset-assert 5140) - (draw-index int32 :offset-assert 5144) - (part-engine basic :offset-assert 5148) - (user-object basic 4 :offset-assert 5152) - (loaded-text-info-count int32 :offset-assert 5168) - (loaded-text-info game-text-info 8 :offset-assert 5172) - (level-type basic :offset-assert 5204) - (load-order int64 :offset-assert 5208) - (pad int8 12 :offset-assert 5216) + ((name symbol :offset-assert 4) + (load-name basic :offset-assert 8) + (nickname basic :offset-assert 12) + (index int32 :offset-assert 16) + (status symbol :offset-assert 20) + (borrow-level basic 2 :offset-assert 24) + (borrow-from-level basic :offset-assert 32) + (heap kheap :inline :offset-assert 48) + (borrow-heap kheap 2 :inline :offset-assert 64) + (bsp bsp-header :offset-assert 96) + (art-group load-dir-art-group :offset-assert 100) + (info level-load-info :offset-assert 104) + (texture-page texture-page 18 :offset-assert 108) + (loaded-texture-page texture-page 16 :offset-assert 180) + (loaded-texture-page-count int32 :offset-assert 244) + (entity entity-links-array :offset-assert 248) + (closest-object float :offset-assert 252) + (closest-object-array float 18 :offset 252) + (upload-size int32 18 :offset 324) + (inside-boxes symbol :offset-assert 396) + (display? symbol :offset-assert 400) + (render? symbol :offset-assert 404) + (meta-inside? symbol :offset-assert 408) + (force-inside? symbol :offset-assert 412) + (mood-context mood-context :inline :offset-assert 416) + (mood-func (function mood-context float int none) :offset-assert 2384) + (mood-init (function mood-context none) :offset-assert 2388) + (vis-bits pointer :offset-assert 2392) + (all-visible? symbol :offset-assert 2396) + (force-all-visible? symbol :offset-assert 2400) + (linking basic :offset-assert 2404) + (vis-info level-vis-info 8 :offset-assert 2408) + (vis-self-index int32 :offset-assert 2440) + (vis-adj-index int32 :offset-assert 2444) + (vis-buffer uint8 2048 :offset-assert 2448) + (mem-usage-block memory-usage-block :offset-assert 4496) + (mem-usage int32 :offset-assert 4500) + (code-memory-start pointer :offset-assert 4504) + (code-memory-end pointer :offset-assert 4508) + (load-start-time time-frame :offset-assert 4512) + (load-stop-time time-frame :offset-assert 4520) + (load-buffer uint32 2 :offset-assert 4528) + (load-buffer-size uint32 :offset-assert 4536) + (load-buffer-last uint32 :offset-assert 4540) + (load-buffer-mode load-buffer-mode :offset-assert 4544) + (display-start-time time-frame :offset-assert 4552) + (memory-mask uint32 :offset-assert 4560) + (task-mask task-mask :offset-assert 4564) + (tfrag-gs-test uint64 :offset-assert 4568) + (texture-dirty-masks texture-mask 10 :inline :offset-assert 4576) + (texture-mask texture-mask 18 :inline :offset-assert 4736) + (sky-mask texture-mask :inline :offset-assert 5024) + (tfrag-masks basic :offset-assert 5040) + (tfrag-dists pointer :offset-assert 5044) + (shrub-masks basic :offset-assert 5048) + (shrub-dists pointer :offset-assert 5052) + (alpha-masks basic :offset-assert 5056) + (alpha-dists pointer :offset-assert 5060) + (water-masks basic :offset-assert 5064) + (water-dists pointer :offset-assert 5068) + (tfrag-last-calls int32 6 :offset-assert 5072) + (texture-anim-array texture-anim-array 10 :offset-assert 5096) + (light-hash basic :offset-assert 5136) + (draw-priority float :offset-assert 5140) + (draw-index int32 :offset-assert 5144) + (part-engine basic :offset-assert 5148) + (user-object basic 4 :offset-assert 5152) + (loaded-text-info-count int32 :offset-assert 5168) + (loaded-text-info game-text-info 8 :offset-assert 5172) + (level-type basic :offset-assert 5204) + (load-order int64 :offset-assert 5208) + (pad int8 12 :offset-assert 5216) ) :method-count-assert 30 :size-assert #x146c diff --git a/test/decompiler/reference/jak2/engine/math/matrix-h_REF.gc b/test/decompiler/reference/jak2/engine/math/matrix-h_REF.gc index ddffd63bad..883784d50b 100644 --- a/test/decompiler/reference/jak2/engine/math/matrix-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/matrix-h_REF.gc @@ -24,9 +24,9 @@ (goto cfg-4) ) (format #t "[~8x] ~A~%" obj 'matrix) - (format #t "~1Tdata[16] @ #x~X~%" (-> obj data)) - (format #t "~1Tvector[4] @ #x~X~%" (-> obj data)) - (format #t "~1Tquad[4] @ #x~X~%" (-> obj data)) + (format #t "~1Tdata[16] @ #x~X~%" (-> obj vector)) + (format #t "~1Tvector[4] @ #x~X~%" (-> obj vector)) + (format #t "~1Tquad[4] @ #x~X~%" (-> obj vector)) (format #t "~1Ttrans: #~%" (-> obj trans)) (label cfg-4) obj diff --git a/test/decompiler/reference/jak2/engine/math/matrix_REF.gc b/test/decompiler/reference/jak2/engine/math/matrix_REF.gc index 1bafcce7be..831213a973 100644 --- a/test/decompiler/reference/jak2/engine/math/matrix_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/matrix_REF.gc @@ -5,9 +5,30 @@ ;; INFO: this function exists in multiple non-identical object files (defmethod inspect matrix ((obj matrix)) (format #t "[~8x] matrix~%" obj) - (format #t "~T[~F] [~F] [~F] [~F]~%" (-> obj data 0) (-> obj data 1) (-> obj data 2) (-> obj data 3)) - (format #t "~T[~F] [~F] [~F] [~F]~%" (-> obj data 4) (-> obj data 5) (-> obj data 6) (-> obj data 7)) - (format #t "~T[~F] [~F] [~F] [~F]~%" (-> obj data 8) (-> obj data 9) (-> obj data 10) (-> obj data 11)) + (format + #t + "~T[~F] [~F] [~F] [~F]~%" + (-> obj vector 0 x) + (-> obj vector 0 y) + (-> obj vector 0 z) + (-> obj vector 0 w) + ) + (format + #t + "~T[~F] [~F] [~F] [~F]~%" + (-> obj vector 1 x) + (-> obj vector 1 y) + (-> obj vector 1 z) + (-> obj vector 1 w) + ) + (format + #t + "~T[~F] [~F] [~F] [~F]~%" + (-> obj vector 2 x) + (-> obj vector 2 y) + (-> obj vector 2 z) + (-> obj vector 2 w) + ) (format #t "~T[~F] [~F] [~F] [~F]~%" (-> obj trans x) (-> obj trans y) (-> obj trans z) (-> obj trans w)) obj ) @@ -31,9 +52,9 @@ (set! (-> arg0 trans quad) (the-as uint128 0)) (let ((f0-0 1.0)) (set! (-> arg0 trans w) f0-0) - (set! (-> arg0 data 10) f0-0) - (set! (-> arg0 data 5) f0-0) - (set! (-> arg0 data 0) f0-0) + (set! (-> arg0 vector 2 z) f0-0) + (set! (-> arg0 vector 1 y) f0-0) + (set! (-> arg0 vector 0 x) f0-0) ) arg0 ) @@ -42,11 +63,14 @@ (define *identity-matrix* (matrix-identity! (new 'global 'matrix))) ;; definition for symbol *hermite-matrix*, type matrix -(define *hermite-matrix* - (new 'static 'matrix - :data (new 'static 'array float 16 2.0 -2.0 1.0 1.0 -3.0 3.0 -2.0 -1.0 0.0 0.0 1.0 0.0 1.0 0.0 0.0 0.0) - ) - ) +(define *hermite-matrix* (new 'static 'matrix :vector (new 'static 'inline-array vector 4 + (new 'static 'vector :x 2.0 :y -2.0 :z 1.0 :w 1.0) + (new 'static 'vector :x -3.0 :y 3.0 :z -2.0 :w -1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :x 1.0) + ) + ) + ) ;; definition for function matrix+! (defun matrix+! ((arg0 matrix) (arg1 matrix) (arg2 matrix)) @@ -469,9 +493,9 @@ (set! (-> arg0 vector 1 quad) (the-as uint128 0)) (set! (-> arg0 vector 2 quad) (the-as uint128 0)) (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 data 0) (-> arg1 x)) - (set! (-> arg0 data 5) (-> arg1 y)) - (set! (-> arg0 data 10) (-> arg1 z)) + (set! (-> arg0 vector 0 x) (-> arg1 x)) + (set! (-> arg0 vector 1 y) (-> arg1 y)) + (set! (-> arg0 vector 2 z) (-> arg1 z)) (set! (-> arg0 trans w) 1.0) arg0 ) @@ -508,9 +532,9 @@ (set! (-> arg0 vector 1 quad) (the-as uint128 0)) (set! (-> arg0 vector 2 quad) (the-as uint128 0)) (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 data 0) (/ 1.0 (-> arg1 x))) - (set! (-> arg0 data 5) (/ 1.0 (-> arg1 y))) - (set! (-> arg0 data 10) (/ 1.0 (-> arg1 z))) + (set! (-> arg0 vector 0 x) (/ 1.0 (-> arg1 x))) + (set! (-> arg0 vector 1 y) (/ 1.0 (-> arg1 y))) + (set! (-> arg0 vector 2 z) (/ 1.0 (-> arg1 z))) (set! (-> arg0 trans w) 1.0) arg0 ) @@ -550,11 +574,11 @@ (set! (-> arg0 vector 1 quad) (the-as uint128 0)) (set! (-> arg0 vector 2 quad) (the-as uint128 0)) (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 data 0) 1.0) - (set! (-> arg0 data 5) f0-0) - (set! (-> arg0 data 6) f30-0) - (set! (-> arg0 data 9) (- f30-0)) - (set! (-> arg0 data 10) f0-0) + (set! (-> arg0 vector 0 x) 1.0) + (set! (-> arg0 vector 1 y) f0-0) + (set! (-> arg0 vector 1 z) f30-0) + (set! (-> arg0 vector 2 y) (- f30-0)) + (set! (-> arg0 vector 2 z) f0-0) ) (set! (-> arg0 trans w) 1.0) arg0 @@ -570,11 +594,11 @@ (set! (-> arg0 vector 1 quad) (the-as uint128 0)) (set! (-> arg0 vector 2 quad) (the-as uint128 0)) (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 data 0) f0-0) - (set! (-> arg0 data 2) (- f30-0)) - (set! (-> arg0 data 5) 1.0) - (set! (-> arg0 data 8) f30-0) - (set! (-> arg0 data 10) f0-0) + (set! (-> arg0 vector 0 x) f0-0) + (set! (-> arg0 vector 0 z) (- f30-0)) + (set! (-> arg0 vector 1 y) 1.0) + (set! (-> arg0 vector 2 x) f30-0) + (set! (-> arg0 vector 2 z) f0-0) ) (set! (-> arg0 trans w) 1.0) arg0 @@ -590,12 +614,12 @@ (set! (-> arg0 vector 1 quad) (the-as uint128 0)) (set! (-> arg0 vector 2 quad) (the-as uint128 0)) (set! (-> arg0 trans quad) (the-as uint128 0)) - (set! (-> arg0 data 0) f0-0) - (set! (-> arg0 data 1) f30-0) - (set! (-> arg0 data 4) (- f30-0)) - (set! (-> arg0 data 5) f0-0) + (set! (-> arg0 vector 0 x) f0-0) + (set! (-> arg0 vector 0 y) f30-0) + (set! (-> arg0 vector 1 x) (- f30-0)) + (set! (-> arg0 vector 1 y) f0-0) ) - (set! (-> arg0 data 10) 1.0) + (set! (-> arg0 vector 2 z) 1.0) (set! (-> arg0 trans w) 1.0) arg0 ) @@ -644,25 +668,25 @@ (f1-0 (-> s5-0 y)) ) (let ((f4-0 (-> s5-0 z))) - (set! (-> arg0 data 0) (* f1-0 f4-0)) - (set! (-> arg0 data 1) (* f1-0 f3-0)) - (set! (-> arg0 data 2) (- f5-0)) - (set! (-> arg0 data 3) 0.0) + (set! (-> arg0 vector 0 x) (* f1-0 f4-0)) + (set! (-> arg0 vector 0 y) (* f1-0 f3-0)) + (set! (-> arg0 vector 0 z) (- f5-0)) + (set! (-> arg0 vector 0 w) 0.0) (let ((f6-4 (* f2-0 f5-0)) (f5-1 (* f0-0 f5-0)) ) - (set! (-> arg0 data 4) (- (* f6-4 f4-0) (* f0-0 f3-0))) - (set! (-> arg0 data 5) (+ (* f6-4 f3-0) (* f0-0 f4-0))) - (set! (-> arg0 data 6) (* f2-0 f1-0)) - (set! (-> arg0 data 7) 0.0) - (set! (-> arg0 data 8) (+ (* f2-0 f3-0) (* f5-1 f4-0))) - (set! (-> arg0 data 9) (- (* f5-1 f3-0) (* f2-0 f4-0))) + (set! (-> arg0 vector 1 x) (- (* f6-4 f4-0) (* f0-0 f3-0))) + (set! (-> arg0 vector 1 y) (+ (* f6-4 f3-0) (* f0-0 f4-0))) + (set! (-> arg0 vector 1 z) (* f2-0 f1-0)) + (set! (-> arg0 vector 1 w) 0.0) + (set! (-> arg0 vector 2 x) (+ (* f2-0 f3-0) (* f5-1 f4-0))) + (set! (-> arg0 vector 2 y) (- (* f5-1 f3-0) (* f2-0 f4-0))) ) ) - (set! (-> arg0 data 10) (* f0-0 f1-0)) + (set! (-> arg0 vector 2 z) (* f0-0 f1-0)) ) ) - (set! (-> arg0 data 11) 0.0) + (set! (-> arg0 vector 2 w) 0.0) (.svf (&-> arg0 trans quad) vf0) arg0 ) @@ -728,20 +752,20 @@ (f3-0 (-> s4-0 z)) (f4-0 (-> s5-0 z)) ) - (set! (-> arg0 data 0) (- (* f1-1 f3-0) (* f0-5 f2-0 f4-0))) - (set! (-> arg0 data 1) (* f0-5 f5-0)) - (set! (-> arg0 data 2) (- (+ (* f1-1 f4-0) (* f0-5 f2-0 f3-0)))) - (set! (-> arg0 data 3) 0.0) - (set! (-> arg0 data 4) (* f5-0 f4-0)) - (set! (-> arg0 data 5) f2-0) - (set! (-> arg0 data 6) (* f5-0 f3-0)) - (set! (-> arg0 data 7) 0.0) - (set! (-> arg0 data 8) (+ (* f0-5 f3-0) (* f1-1 f2-0 f4-0))) - (set! (-> arg0 data 9) (- (* f1-1 f5-0))) - (set! (-> arg0 data 10) (- (* f1-1 f2-0 f3-0) (* f0-5 f4-0))) + (set! (-> arg0 vector 0 x) (- (* f1-1 f3-0) (* f0-5 f2-0 f4-0))) + (set! (-> arg0 vector 0 y) (* f0-5 f5-0)) + (set! (-> arg0 vector 0 z) (- (+ (* f1-1 f4-0) (* f0-5 f2-0 f3-0)))) + (set! (-> arg0 vector 0 w) 0.0) + (set! (-> arg0 vector 1 x) (* f5-0 f4-0)) + (set! (-> arg0 vector 1 y) f2-0) + (set! (-> arg0 vector 1 z) (* f5-0 f3-0)) + (set! (-> arg0 vector 1 w) 0.0) + (set! (-> arg0 vector 2 x) (+ (* f0-5 f3-0) (* f1-1 f2-0 f4-0))) + (set! (-> arg0 vector 2 y) (- (* f1-1 f5-0))) + (set! (-> arg0 vector 2 z) (- (* f1-1 f2-0 f3-0) (* f0-5 f4-0))) ) ) - (set! (-> arg0 data 11) 0.0) + (set! (-> arg0 vector 2 w) 0.0) (set! (-> arg0 trans x) 0.0) (set! (-> arg0 trans y) 0.0) (set! (-> arg0 trans z) 0.0) @@ -1061,15 +1085,15 @@ ;; definition for function matrix-3x3-determinant (defun matrix-3x3-determinant ((arg0 matrix)) - (let ((f8-0 (-> arg0 data 0)) - (f1-0 (-> arg0 data 1)) - (f4-0 (-> arg0 data 2)) - (f2-0 (-> arg0 data 4)) - (f5-0 (-> arg0 data 5)) - (f9-0 (-> arg0 data 6)) - (f3-0 (-> arg0 data 8)) - (f6-0 (-> arg0 data 9)) - (f0-0 (-> arg0 data 10)) + (let ((f8-0 (-> arg0 vector 0 x)) + (f1-0 (-> arg0 vector 0 y)) + (f4-0 (-> arg0 vector 0 z)) + (f2-0 (-> arg0 vector 1 x)) + (f5-0 (-> arg0 vector 1 y)) + (f9-0 (-> arg0 vector 1 z)) + (f3-0 (-> arg0 vector 2 x)) + (f6-0 (-> arg0 vector 2 y)) + (f0-0 (-> arg0 vector 2 z)) ) (- (+ (* f8-0 f5-0 f0-0) (* f1-0 f9-0 f3-0) (* f4-0 f2-0 f6-0)) (+ (* f8-0 f9-0 f6-0) (* f4-0 f5-0 f3-0) (* f1-0 f2-0 f0-0)) @@ -1102,32 +1126,32 @@ ;; definition for function matrix-3x3-inverse! (defun matrix-3x3-inverse! ((arg0 matrix) (arg1 matrix)) (let ((f0-0 (matrix-3x3-determinant arg1))) - (set! (-> arg0 data 0) - (/ (- (* (-> arg1 data 5) (-> arg1 data 10)) (* (-> arg1 data 6) (-> arg1 data 9))) f0-0) + (set! (-> arg0 vector 0 x) + (/ (- (* (-> arg1 vector 1 y) (-> arg1 vector 2 z)) (* (-> arg1 vector 1 z) (-> arg1 vector 2 y))) f0-0) ) - (set! (-> arg0 data 4) - (/ (- (* (-> arg1 data 6) (-> arg1 data 8)) (* (-> arg1 data 4) (-> arg1 data 10))) f0-0) + (set! (-> arg0 vector 1 x) + (/ (- (* (-> arg1 vector 1 z) (-> arg1 vector 2 x)) (* (-> arg1 vector 1 x) (-> arg1 vector 2 z))) f0-0) ) - (set! (-> arg0 data 8) - (/ (- (* (-> arg1 data 4) (-> arg1 data 9)) (* (-> arg1 data 5) (-> arg1 data 8))) f0-0) + (set! (-> arg0 vector 2 x) + (/ (- (* (-> arg1 vector 1 x) (-> arg1 vector 2 y)) (* (-> arg1 vector 1 y) (-> arg1 vector 2 x))) f0-0) ) - (set! (-> arg0 data 1) - (/ (- (* (-> arg1 data 9) (-> arg1 data 2)) (* (-> arg1 data 10) (-> arg1 data 1))) f0-0) + (set! (-> arg0 vector 0 y) + (/ (- (* (-> arg1 vector 2 y) (-> arg1 vector 0 z)) (* (-> arg1 vector 2 z) (-> arg1 vector 0 y))) f0-0) ) - (set! (-> arg0 data 5) - (/ (- (* (-> arg1 data 10) (-> arg1 data 0)) (* (-> arg1 data 8) (-> arg1 data 2))) f0-0) + (set! (-> arg0 vector 1 y) + (/ (- (* (-> arg1 vector 2 z) (-> arg1 vector 0 x)) (* (-> arg1 vector 2 x) (-> arg1 vector 0 z))) f0-0) ) - (set! (-> arg0 data 9) - (/ (- (* (-> arg1 data 8) (-> arg1 data 1)) (* (-> arg1 data 9) (-> arg1 data 0))) f0-0) + (set! (-> arg0 vector 2 y) + (/ (- (* (-> arg1 vector 2 x) (-> arg1 vector 0 y)) (* (-> arg1 vector 2 y) (-> arg1 vector 0 x))) f0-0) ) - (set! (-> arg0 data 2) - (/ (- (* (-> arg1 data 1) (-> arg1 data 6)) (* (-> arg1 data 2) (-> arg1 data 5))) f0-0) + (set! (-> arg0 vector 0 z) + (/ (- (* (-> arg1 vector 0 y) (-> arg1 vector 1 z)) (* (-> arg1 vector 0 z) (-> arg1 vector 1 y))) f0-0) ) - (set! (-> arg0 data 6) - (/ (- (* (-> arg1 data 2) (-> arg1 data 4)) (* (-> arg1 data 0) (-> arg1 data 6))) f0-0) + (set! (-> arg0 vector 1 z) + (/ (- (* (-> arg1 vector 0 z) (-> arg1 vector 1 x)) (* (-> arg1 vector 0 x) (-> arg1 vector 1 z))) f0-0) ) - (set! (-> arg0 data 10) - (/ (- (* (-> arg1 data 0) (-> arg1 data 5)) (* (-> arg1 data 1) (-> arg1 data 4))) f0-0) + (set! (-> arg0 vector 2 z) + (/ (- (* (-> arg1 vector 0 x) (-> arg1 vector 1 y)) (* (-> arg1 vector 0 y) (-> arg1 vector 1 x))) f0-0) ) ) arg0 @@ -1136,32 +1160,32 @@ ;; definition for function matrix-3x3-inverse-transpose! (defun matrix-3x3-inverse-transpose! ((arg0 matrix) (arg1 matrix)) (let ((f0-0 (matrix-3x3-determinant arg1))) - (set! (-> arg0 data 0) - (/ (- (* (-> arg1 data 5) (-> arg1 data 10)) (* (-> arg1 data 6) (-> arg1 data 9))) f0-0) + (set! (-> arg0 vector 0 x) + (/ (- (* (-> arg1 vector 1 y) (-> arg1 vector 2 z)) (* (-> arg1 vector 1 z) (-> arg1 vector 2 y))) f0-0) ) - (set! (-> arg0 data 1) - (/ (- (* (-> arg1 data 6) (-> arg1 data 8)) (* (-> arg1 data 4) (-> arg1 data 10))) f0-0) + (set! (-> arg0 vector 0 y) + (/ (- (* (-> arg1 vector 1 z) (-> arg1 vector 2 x)) (* (-> arg1 vector 1 x) (-> arg1 vector 2 z))) f0-0) ) - (set! (-> arg0 data 2) - (/ (- (* (-> arg1 data 4) (-> arg1 data 9)) (* (-> arg1 data 5) (-> arg1 data 8))) f0-0) + (set! (-> arg0 vector 0 z) + (/ (- (* (-> arg1 vector 1 x) (-> arg1 vector 2 y)) (* (-> arg1 vector 1 y) (-> arg1 vector 2 x))) f0-0) ) - (set! (-> arg0 data 4) - (/ (- (* (-> arg1 data 9) (-> arg1 data 2)) (* (-> arg1 data 10) (-> arg1 data 1))) f0-0) + (set! (-> arg0 vector 1 x) + (/ (- (* (-> arg1 vector 2 y) (-> arg1 vector 0 z)) (* (-> arg1 vector 2 z) (-> arg1 vector 0 y))) f0-0) ) - (set! (-> arg0 data 5) - (/ (- (* (-> arg1 data 10) (-> arg1 data 0)) (* (-> arg1 data 8) (-> arg1 data 2))) f0-0) + (set! (-> arg0 vector 1 y) + (/ (- (* (-> arg1 vector 2 z) (-> arg1 vector 0 x)) (* (-> arg1 vector 2 x) (-> arg1 vector 0 z))) f0-0) ) - (set! (-> arg0 data 6) - (/ (- (* (-> arg1 data 8) (-> arg1 data 1)) (* (-> arg1 data 9) (-> arg1 data 0))) f0-0) + (set! (-> arg0 vector 1 z) + (/ (- (* (-> arg1 vector 2 x) (-> arg1 vector 0 y)) (* (-> arg1 vector 2 y) (-> arg1 vector 0 x))) f0-0) ) - (set! (-> arg0 data 8) - (/ (- (* (-> arg1 data 1) (-> arg1 data 6)) (* (-> arg1 data 2) (-> arg1 data 5))) f0-0) + (set! (-> arg0 vector 2 x) + (/ (- (* (-> arg1 vector 0 y) (-> arg1 vector 1 z)) (* (-> arg1 vector 0 z) (-> arg1 vector 1 y))) f0-0) ) - (set! (-> arg0 data 9) - (/ (- (* (-> arg1 data 2) (-> arg1 data 4)) (* (-> arg1 data 0) (-> arg1 data 6))) f0-0) + (set! (-> arg0 vector 2 y) + (/ (- (* (-> arg1 vector 0 z) (-> arg1 vector 1 x)) (* (-> arg1 vector 0 x) (-> arg1 vector 1 z))) f0-0) ) - (set! (-> arg0 data 10) - (/ (- (* (-> arg1 data 0) (-> arg1 data 5)) (* (-> arg1 data 1) (-> arg1 data 4))) f0-0) + (set! (-> arg0 vector 2 z) + (/ (- (* (-> arg1 vector 0 x) (-> arg1 vector 1 y)) (* (-> arg1 vector 0 y) (-> arg1 vector 1 x))) f0-0) ) ) arg0 @@ -1233,9 +1257,9 @@ (vf16 :class vf) ) (init-vf0-vector) - (let ((f2-0 (-> arg1 data 0)) - (f0-0 (-> arg1 data 1)) - (f1-0 (-> arg1 data 2)) + (let ((f2-0 (-> arg1 vector 0 x)) + (f0-0 (-> arg1 vector 0 y)) + (f1-0 (-> arg1 vector 0 z)) (v1-0 #x3f800000) ) (.lvf vf10 (&-> arg1 vector 0 quad)) @@ -1277,18 +1301,18 @@ ;; definition for function matrix-4x4-determinant (defun matrix-4x4-determinant ((arg0 matrix)) - (let ((f15-0 (-> arg0 data 0)) - (f14-0 (-> arg0 data 1)) - (f10-0 (-> arg0 data 2)) - (f2-0 (-> arg0 data 3)) - (f9-0 (-> arg0 data 4)) - (f6-0 (-> arg0 data 5)) - (f3-0 (-> arg0 data 6)) - (f11-0 (-> arg0 data 7)) - (f5-0 (-> arg0 data 8)) - (f1-0 (-> arg0 data 9)) - (f8-0 (-> arg0 data 10)) - (f13-0 (-> arg0 data 11)) + (let ((f15-0 (-> arg0 vector 0 x)) + (f14-0 (-> arg0 vector 0 y)) + (f10-0 (-> arg0 vector 0 z)) + (f2-0 (-> arg0 vector 0 w)) + (f9-0 (-> arg0 vector 1 x)) + (f6-0 (-> arg0 vector 1 y)) + (f3-0 (-> arg0 vector 1 z)) + (f11-0 (-> arg0 vector 1 w)) + (f5-0 (-> arg0 vector 2 x)) + (f1-0 (-> arg0 vector 2 y)) + (f8-0 (-> arg0 vector 2 z)) + (f13-0 (-> arg0 vector 2 w)) (f0-0 (-> arg0 trans x)) (f7-0 (-> arg0 trans y)) (f4-0 (-> arg0 trans z)) @@ -1327,225 +1351,225 @@ ;; definition for function matrix-4x4-inverse-transpose! (defun matrix-4x4-inverse-transpose! ((arg0 matrix) (arg1 matrix)) (let ((f0-0 (matrix-4x4-determinant arg1))) - (let ((f9-0 (-> arg1 data 5)) - (f2-0 (-> arg1 data 6)) - (f5-0 (-> arg1 data 7)) - (f3-0 (-> arg1 data 9)) - (f6-0 (-> arg1 data 10)) - (f10-0 (-> arg1 data 11)) + (let ((f9-0 (-> arg1 vector 1 y)) + (f2-0 (-> arg1 vector 1 z)) + (f5-0 (-> arg1 vector 1 w)) + (f3-0 (-> arg1 vector 2 y)) + (f6-0 (-> arg1 vector 2 z)) + (f10-0 (-> arg1 vector 2 w)) (f4-0 (-> arg1 trans y)) (f7-0 (-> arg1 trans z)) (f1-0 (-> arg1 trans w)) ) - (set! (-> arg0 data 0) (/ (- (+ (* f9-0 f6-0 f1-0) (* f2-0 f10-0 f4-0) (* f5-0 f3-0 f7-0)) - (+ (* f9-0 f10-0 f7-0) (* f5-0 f6-0 f4-0) (* f2-0 f3-0 f1-0)) - ) - f0-0 - ) + (set! (-> arg0 vector 0 x) (/ (- (+ (* f9-0 f6-0 f1-0) (* f2-0 f10-0 f4-0) (* f5-0 f3-0 f7-0)) + (+ (* f9-0 f10-0 f7-0) (* f5-0 f6-0 f4-0) (* f2-0 f3-0 f1-0)) + ) + f0-0 + ) ) ) - (let ((f9-2 (-> arg1 data 4)) - (f2-2 (-> arg1 data 6)) - (f5-2 (-> arg1 data 7)) - (f3-1 (-> arg1 data 8)) - (f6-1 (-> arg1 data 10)) - (f10-1 (-> arg1 data 11)) + (let ((f9-2 (-> arg1 vector 1 x)) + (f2-2 (-> arg1 vector 1 z)) + (f5-2 (-> arg1 vector 1 w)) + (f3-1 (-> arg1 vector 2 x)) + (f6-1 (-> arg1 vector 2 z)) + (f10-1 (-> arg1 vector 2 w)) (f4-3 (-> arg1 trans x)) (f7-2 (-> arg1 trans z)) (f1-6 (-> arg1 trans w)) ) - (set! (-> arg0 data 1) (- (/ (- (+ (* f9-2 f6-1 f1-6) (* f2-2 f10-1 f4-3) (* f5-2 f3-1 f7-2)) - (+ (* f9-2 f10-1 f7-2) (* f5-2 f6-1 f4-3) (* f2-2 f3-1 f1-6)) - ) - f0-0 - ) - ) + (set! (-> arg0 vector 0 y) (- (/ (- (+ (* f9-2 f6-1 f1-6) (* f2-2 f10-1 f4-3) (* f5-2 f3-1 f7-2)) + (+ (* f9-2 f10-1 f7-2) (* f5-2 f6-1 f4-3) (* f2-2 f3-1 f1-6)) + ) + f0-0 + ) + ) ) ) - (let ((f9-4 (-> arg1 data 4)) - (f2-4 (-> arg1 data 5)) - (f5-4 (-> arg1 data 7)) - (f3-2 (-> arg1 data 8)) - (f6-2 (-> arg1 data 9)) - (f10-2 (-> arg1 data 11)) + (let ((f9-4 (-> arg1 vector 1 x)) + (f2-4 (-> arg1 vector 1 y)) + (f5-4 (-> arg1 vector 1 w)) + (f3-2 (-> arg1 vector 2 x)) + (f6-2 (-> arg1 vector 2 y)) + (f10-2 (-> arg1 vector 2 w)) (f4-6 (-> arg1 trans x)) (f7-4 (-> arg1 trans y)) (f1-13 (-> arg1 trans w)) ) - (set! (-> arg0 data 2) (/ (- (+ (* f9-4 f6-2 f1-13) (* f2-4 f10-2 f4-6) (* f5-4 f3-2 f7-4)) - (+ (* f9-4 f10-2 f7-4) (* f5-4 f6-2 f4-6) (* f2-4 f3-2 f1-13)) - ) - f0-0 - ) + (set! (-> arg0 vector 0 z) (/ (- (+ (* f9-4 f6-2 f1-13) (* f2-4 f10-2 f4-6) (* f5-4 f3-2 f7-4)) + (+ (* f9-4 f10-2 f7-4) (* f5-4 f6-2 f4-6) (* f2-4 f3-2 f1-13)) + ) + f0-0 + ) ) ) - (let ((f9-6 (-> arg1 data 4)) - (f2-6 (-> arg1 data 5)) - (f5-6 (-> arg1 data 6)) - (f3-3 (-> arg1 data 8)) - (f6-3 (-> arg1 data 9)) - (f10-3 (-> arg1 data 10)) + (let ((f9-6 (-> arg1 vector 1 x)) + (f2-6 (-> arg1 vector 1 y)) + (f5-6 (-> arg1 vector 1 z)) + (f3-3 (-> arg1 vector 2 x)) + (f6-3 (-> arg1 vector 2 y)) + (f10-3 (-> arg1 vector 2 z)) (f4-9 (-> arg1 trans x)) (f7-6 (-> arg1 trans y)) (f1-19 (-> arg1 trans z)) ) - (set! (-> arg0 data 3) (- (/ (- (+ (* f9-6 f6-3 f1-19) (* f2-6 f10-3 f4-9) (* f5-6 f3-3 f7-6)) - (+ (* f9-6 f10-3 f7-6) (* f5-6 f6-3 f4-9) (* f2-6 f3-3 f1-19)) - ) - f0-0 - ) - ) + (set! (-> arg0 vector 0 w) (- (/ (- (+ (* f9-6 f6-3 f1-19) (* f2-6 f10-3 f4-9) (* f5-6 f3-3 f7-6)) + (+ (* f9-6 f10-3 f7-6) (* f5-6 f6-3 f4-9) (* f2-6 f3-3 f1-19)) + ) + f0-0 + ) + ) ) ) - (let ((f9-8 (-> arg1 data 1)) - (f2-8 (-> arg1 data 2)) - (f5-8 (-> arg1 data 3)) - (f3-4 (-> arg1 data 9)) - (f6-4 (-> arg1 data 10)) - (f10-4 (-> arg1 data 11)) + (let ((f9-8 (-> arg1 vector 0 y)) + (f2-8 (-> arg1 vector 0 z)) + (f5-8 (-> arg1 vector 0 w)) + (f3-4 (-> arg1 vector 2 y)) + (f6-4 (-> arg1 vector 2 z)) + (f10-4 (-> arg1 vector 2 w)) (f4-12 (-> arg1 trans y)) (f7-8 (-> arg1 trans z)) (f1-26 (-> arg1 trans w)) ) - (set! (-> arg0 data 4) (- (/ (- (+ (* f9-8 f6-4 f1-26) (* f2-8 f10-4 f4-12) (* f5-8 f3-4 f7-8)) - (+ (* f9-8 f10-4 f7-8) (* f5-8 f6-4 f4-12) (* f2-8 f3-4 f1-26)) - ) - f0-0 - ) - ) + (set! (-> arg0 vector 1 x) (- (/ (- (+ (* f9-8 f6-4 f1-26) (* f2-8 f10-4 f4-12) (* f5-8 f3-4 f7-8)) + (+ (* f9-8 f10-4 f7-8) (* f5-8 f6-4 f4-12) (* f2-8 f3-4 f1-26)) + ) + f0-0 + ) + ) ) ) - (let ((f9-10 (-> arg1 data 0)) - (f2-10 (-> arg1 data 2)) - (f5-10 (-> arg1 data 3)) - (f3-5 (-> arg1 data 8)) - (f6-5 (-> arg1 data 10)) - (f10-5 (-> arg1 data 11)) + (let ((f9-10 (-> arg1 vector 0 x)) + (f2-10 (-> arg1 vector 0 z)) + (f5-10 (-> arg1 vector 0 w)) + (f3-5 (-> arg1 vector 2 x)) + (f6-5 (-> arg1 vector 2 z)) + (f10-5 (-> arg1 vector 2 w)) (f4-15 (-> arg1 trans x)) (f7-10 (-> arg1 trans z)) (f1-33 (-> arg1 trans w)) ) - (set! (-> arg0 data 5) (/ (- (+ (* f9-10 f6-5 f1-33) (* f2-10 f10-5 f4-15) (* f5-10 f3-5 f7-10)) - (+ (* f9-10 f10-5 f7-10) (* f5-10 f6-5 f4-15) (* f2-10 f3-5 f1-33)) - ) - f0-0 - ) + (set! (-> arg0 vector 1 y) (/ (- (+ (* f9-10 f6-5 f1-33) (* f2-10 f10-5 f4-15) (* f5-10 f3-5 f7-10)) + (+ (* f9-10 f10-5 f7-10) (* f5-10 f6-5 f4-15) (* f2-10 f3-5 f1-33)) + ) + f0-0 + ) ) ) - (let ((f9-12 (-> arg1 data 0)) - (f2-12 (-> arg1 data 1)) - (f5-12 (-> arg1 data 3)) - (f3-6 (-> arg1 data 8)) - (f6-6 (-> arg1 data 9)) - (f10-6 (-> arg1 data 11)) + (let ((f9-12 (-> arg1 vector 0 x)) + (f2-12 (-> arg1 vector 0 y)) + (f5-12 (-> arg1 vector 0 w)) + (f3-6 (-> arg1 vector 2 x)) + (f6-6 (-> arg1 vector 2 y)) + (f10-6 (-> arg1 vector 2 w)) (f4-18 (-> arg1 trans x)) (f7-12 (-> arg1 trans y)) (f1-39 (-> arg1 trans w)) ) - (set! (-> arg0 data 6) (- (/ (- (+ (* f9-12 f6-6 f1-39) (* f2-12 f10-6 f4-18) (* f5-12 f3-6 f7-12)) - (+ (* f9-12 f10-6 f7-12) (* f5-12 f6-6 f4-18) (* f2-12 f3-6 f1-39)) - ) - f0-0 - ) - ) + (set! (-> arg0 vector 1 z) (- (/ (- (+ (* f9-12 f6-6 f1-39) (* f2-12 f10-6 f4-18) (* f5-12 f3-6 f7-12)) + (+ (* f9-12 f10-6 f7-12) (* f5-12 f6-6 f4-18) (* f2-12 f3-6 f1-39)) + ) + f0-0 + ) + ) ) ) - (let ((f9-14 (-> arg1 data 0)) - (f2-14 (-> arg1 data 1)) - (f5-14 (-> arg1 data 2)) - (f3-7 (-> arg1 data 8)) - (f6-7 (-> arg1 data 9)) - (f10-7 (-> arg1 data 10)) + (let ((f9-14 (-> arg1 vector 0 x)) + (f2-14 (-> arg1 vector 0 y)) + (f5-14 (-> arg1 vector 0 z)) + (f3-7 (-> arg1 vector 2 x)) + (f6-7 (-> arg1 vector 2 y)) + (f10-7 (-> arg1 vector 2 z)) (f4-21 (-> arg1 trans x)) (f7-14 (-> arg1 trans y)) (f1-46 (-> arg1 trans z)) ) - (set! (-> arg0 data 7) (/ (- (+ (* f9-14 f6-7 f1-46) (* f2-14 f10-7 f4-21) (* f5-14 f3-7 f7-14)) - (+ (* f9-14 f10-7 f7-14) (* f5-14 f6-7 f4-21) (* f2-14 f3-7 f1-46)) - ) - f0-0 - ) + (set! (-> arg0 vector 1 w) (/ (- (+ (* f9-14 f6-7 f1-46) (* f2-14 f10-7 f4-21) (* f5-14 f3-7 f7-14)) + (+ (* f9-14 f10-7 f7-14) (* f5-14 f6-7 f4-21) (* f2-14 f3-7 f1-46)) + ) + f0-0 + ) ) ) - (let ((f9-16 (-> arg1 data 1)) - (f2-16 (-> arg1 data 2)) - (f5-16 (-> arg1 data 3)) - (f3-8 (-> arg1 data 5)) - (f6-8 (-> arg1 data 6)) - (f10-8 (-> arg1 data 7)) + (let ((f9-16 (-> arg1 vector 0 y)) + (f2-16 (-> arg1 vector 0 z)) + (f5-16 (-> arg1 vector 0 w)) + (f3-8 (-> arg1 vector 1 y)) + (f6-8 (-> arg1 vector 1 z)) + (f10-8 (-> arg1 vector 1 w)) (f4-24 (-> arg1 trans y)) (f7-16 (-> arg1 trans z)) (f1-52 (-> arg1 trans w)) ) - (set! (-> arg0 data 8) (/ (- (+ (* f9-16 f6-8 f1-52) (* f2-16 f10-8 f4-24) (* f5-16 f3-8 f7-16)) - (+ (* f9-16 f10-8 f7-16) (* f5-16 f6-8 f4-24) (* f2-16 f3-8 f1-52)) - ) - f0-0 - ) + (set! (-> arg0 vector 2 x) (/ (- (+ (* f9-16 f6-8 f1-52) (* f2-16 f10-8 f4-24) (* f5-16 f3-8 f7-16)) + (+ (* f9-16 f10-8 f7-16) (* f5-16 f6-8 f4-24) (* f2-16 f3-8 f1-52)) + ) + f0-0 + ) ) ) - (let ((f9-18 (-> arg1 data 0)) - (f2-18 (-> arg1 data 2)) - (f5-18 (-> arg1 data 3)) - (f3-9 (-> arg1 data 4)) - (f6-9 (-> arg1 data 6)) - (f10-9 (-> arg1 data 7)) + (let ((f9-18 (-> arg1 vector 0 x)) + (f2-18 (-> arg1 vector 0 z)) + (f5-18 (-> arg1 vector 0 w)) + (f3-9 (-> arg1 vector 1 x)) + (f6-9 (-> arg1 vector 1 z)) + (f10-9 (-> arg1 vector 1 w)) (f4-27 (-> arg1 trans x)) (f7-18 (-> arg1 trans z)) (f1-58 (-> arg1 trans w)) ) - (set! (-> arg0 data 9) (- (/ (- (+ (* f9-18 f6-9 f1-58) (* f2-18 f10-9 f4-27) (* f5-18 f3-9 f7-18)) - (+ (* f9-18 f10-9 f7-18) (* f5-18 f6-9 f4-27) (* f2-18 f3-9 f1-58)) - ) - f0-0 - ) - ) + (set! (-> arg0 vector 2 y) (- (/ (- (+ (* f9-18 f6-9 f1-58) (* f2-18 f10-9 f4-27) (* f5-18 f3-9 f7-18)) + (+ (* f9-18 f10-9 f7-18) (* f5-18 f6-9 f4-27) (* f2-18 f3-9 f1-58)) + ) + f0-0 + ) + ) ) ) - (let ((f9-20 (-> arg1 data 0)) - (f2-20 (-> arg1 data 1)) - (f5-20 (-> arg1 data 3)) - (f3-10 (-> arg1 data 4)) - (f6-10 (-> arg1 data 5)) - (f10-10 (-> arg1 data 7)) + (let ((f9-20 (-> arg1 vector 0 x)) + (f2-20 (-> arg1 vector 0 y)) + (f5-20 (-> arg1 vector 0 w)) + (f3-10 (-> arg1 vector 1 x)) + (f6-10 (-> arg1 vector 1 y)) + (f10-10 (-> arg1 vector 1 w)) (f4-30 (-> arg1 trans x)) (f7-20 (-> arg1 trans y)) (f1-65 (-> arg1 trans w)) ) - (set! (-> arg0 data 10) (/ (- (+ (* f9-20 f6-10 f1-65) (* f2-20 f10-10 f4-30) (* f5-20 f3-10 f7-20)) - (+ (* f9-20 f10-10 f7-20) (* f5-20 f6-10 f4-30) (* f2-20 f3-10 f1-65)) + (set! (-> arg0 vector 2 z) (/ (- (+ (* f9-20 f6-10 f1-65) (* f2-20 f10-10 f4-30) (* f5-20 f3-10 f7-20)) + (+ (* f9-20 f10-10 f7-20) (* f5-20 f6-10 f4-30) (* f2-20 f3-10 f1-65)) + ) + f0-0 ) - f0-0 - ) ) ) - (let ((f9-22 (-> arg1 data 0)) - (f2-22 (-> arg1 data 1)) - (f5-22 (-> arg1 data 2)) - (f3-11 (-> arg1 data 4)) - (f6-11 (-> arg1 data 5)) - (f10-11 (-> arg1 data 6)) + (let ((f9-22 (-> arg1 vector 0 x)) + (f2-22 (-> arg1 vector 0 y)) + (f5-22 (-> arg1 vector 0 z)) + (f3-11 (-> arg1 vector 1 x)) + (f6-11 (-> arg1 vector 1 y)) + (f10-11 (-> arg1 vector 1 z)) (f4-33 (-> arg1 trans x)) (f7-22 (-> arg1 trans y)) (f1-71 (-> arg1 trans z)) ) - (set! (-> arg0 data 11) (- (/ (- (+ (* f9-22 f6-11 f1-71) (* f2-22 f10-11 f4-33) (* f5-22 f3-11 f7-22)) - (+ (* f9-22 f10-11 f7-22) (* f5-22 f6-11 f4-33) (* f2-22 f3-11 f1-71)) + (set! (-> arg0 vector 2 w) (- (/ (- (+ (* f9-22 f6-11 f1-71) (* f2-22 f10-11 f4-33) (* f5-22 f3-11 f7-22)) + (+ (* f9-22 f10-11 f7-22) (* f5-22 f6-11 f4-33) (* f2-22 f3-11 f1-71)) + ) + f0-0 ) - f0-0 ) - ) ) ) - (let ((f9-24 (-> arg1 data 1)) - (f2-24 (-> arg1 data 2)) - (f5-24 (-> arg1 data 3)) - (f3-12 (-> arg1 data 5)) - (f6-12 (-> arg1 data 6)) - (f10-12 (-> arg1 data 7)) - (f4-36 (-> arg1 data 9)) - (f7-24 (-> arg1 data 10)) - (f1-78 (-> arg1 data 11)) + (let ((f9-24 (-> arg1 vector 0 y)) + (f2-24 (-> arg1 vector 0 z)) + (f5-24 (-> arg1 vector 0 w)) + (f3-12 (-> arg1 vector 1 y)) + (f6-12 (-> arg1 vector 1 z)) + (f10-12 (-> arg1 vector 1 w)) + (f4-36 (-> arg1 vector 2 y)) + (f7-24 (-> arg1 vector 2 z)) + (f1-78 (-> arg1 vector 2 w)) ) (set! (-> arg0 trans x) (- (/ (- (+ (* f9-24 f6-12 f1-78) (* f2-24 f10-12 f4-36) (* f5-24 f3-12 f7-24)) (+ (* f9-24 f10-12 f7-24) (* f5-24 f6-12 f4-36) (* f2-24 f3-12 f1-78)) @@ -1555,15 +1579,15 @@ ) ) ) - (let ((f9-26 (-> arg1 data 0)) - (f2-26 (-> arg1 data 2)) - (f5-26 (-> arg1 data 3)) - (f3-13 (-> arg1 data 4)) - (f6-13 (-> arg1 data 6)) - (f10-13 (-> arg1 data 7)) - (f4-39 (-> arg1 data 8)) - (f7-26 (-> arg1 data 10)) - (f1-85 (-> arg1 data 11)) + (let ((f9-26 (-> arg1 vector 0 x)) + (f2-26 (-> arg1 vector 0 z)) + (f5-26 (-> arg1 vector 0 w)) + (f3-13 (-> arg1 vector 1 x)) + (f6-13 (-> arg1 vector 1 z)) + (f10-13 (-> arg1 vector 1 w)) + (f4-39 (-> arg1 vector 2 x)) + (f7-26 (-> arg1 vector 2 z)) + (f1-85 (-> arg1 vector 2 w)) ) (set! (-> arg0 trans y) (/ (- (+ (* f9-26 f6-13 f1-85) (* f2-26 f10-13 f4-39) (* f5-26 f3-13 f7-26)) (+ (* f9-26 f10-13 f7-26) (* f5-26 f6-13 f4-39) (* f2-26 f3-13 f1-85)) @@ -1572,15 +1596,15 @@ ) ) ) - (let ((f9-28 (-> arg1 data 0)) - (f2-28 (-> arg1 data 1)) - (f5-28 (-> arg1 data 3)) - (f3-14 (-> arg1 data 4)) - (f6-14 (-> arg1 data 5)) - (f10-14 (-> arg1 data 7)) - (f4-42 (-> arg1 data 8)) - (f7-28 (-> arg1 data 9)) - (f1-91 (-> arg1 data 11)) + (let ((f9-28 (-> arg1 vector 0 x)) + (f2-28 (-> arg1 vector 0 y)) + (f5-28 (-> arg1 vector 0 w)) + (f3-14 (-> arg1 vector 1 x)) + (f6-14 (-> arg1 vector 1 y)) + (f10-14 (-> arg1 vector 1 w)) + (f4-42 (-> arg1 vector 2 x)) + (f7-28 (-> arg1 vector 2 y)) + (f1-91 (-> arg1 vector 2 w)) ) (set! (-> arg0 trans z) (- (/ (- (+ (* f9-28 f6-14 f1-91) (* f2-28 f10-14 f4-42) (* f5-28 f3-14 f7-28)) (+ (* f9-28 f10-14 f7-28) (* f5-28 f6-14 f4-42) (* f2-28 f3-14 f1-91)) @@ -1590,15 +1614,15 @@ ) ) ) - (let ((f8-60 (-> arg1 data 0)) - (f1-98 (-> arg1 data 1)) - (f5-30 (-> arg1 data 2)) - (f2-30 (-> arg1 data 4)) - (f6-15 (-> arg1 data 5)) - (f9-30 (-> arg1 data 6)) - (f4-45 (-> arg1 data 8)) - (f7-30 (-> arg1 data 9)) - (f3-15 (-> arg1 data 10)) + (let ((f8-60 (-> arg1 vector 0 x)) + (f1-98 (-> arg1 vector 0 y)) + (f5-30 (-> arg1 vector 0 z)) + (f2-30 (-> arg1 vector 1 x)) + (f6-15 (-> arg1 vector 1 y)) + (f9-30 (-> arg1 vector 1 z)) + (f4-45 (-> arg1 vector 2 x)) + (f7-30 (-> arg1 vector 2 y)) + (f3-15 (-> arg1 vector 2 z)) ) (set! (-> arg0 trans w) (/ (- (+ (* f8-60 f6-15 f3-15) (* f1-98 f9-30 f4-45) (* f5-30 f2-30 f7-30)) (+ (* f8-60 f9-30 f7-30) (* f5-30 f6-15 f4-45) (* f1-98 f2-30 f3-15)) @@ -1613,8 +1637,8 @@ ;; definition for function matrix-y-angle (defun matrix-y-angle ((arg0 matrix)) - (let ((v1-0 (&-> arg0 data 8))) - (atan (-> v1-0 0) (-> v1-0 2)) + (let ((v1-0 (-> arg0 vector 2))) + (atan (-> v1-0 x) (-> v1-0 z)) ) ) @@ -1646,18 +1670,18 @@ ;; definition for function matrix->scale (defun matrix->scale ((arg0 matrix) (arg1 vector)) - (set! (-> arg1 x) (vector-length (the-as vector (-> arg0 data)))) - (set! (-> arg1 y) (vector-length (the-as vector (&-> arg0 data 4)))) - (set! (-> arg1 z) (vector-length (the-as vector (&-> arg0 data 8)))) + (set! (-> arg1 x) (vector-length (the-as vector (-> arg0 vector)))) + (set! (-> arg1 y) (vector-length (-> arg0 vector 1))) + (set! (-> arg1 z) (vector-length (-> arg0 vector 2))) (set! (-> arg1 w) 1.0) arg1 ) ;; definition for function matrix<-scale (defun matrix<-scale ((arg0 matrix) (arg1 vector)) - (vector-normalize! (the-as vector (-> arg0 data)) (-> arg1 x)) - (vector-normalize! (the-as vector (&-> arg0 data 4)) (-> arg1 y)) - (vector-normalize! (the-as vector (&-> arg0 data 8)) (-> arg1 z)) + (vector-normalize! (the-as vector (-> arg0 vector)) (-> arg1 x)) + (vector-normalize! (-> arg0 vector 1) (-> arg1 y)) + (vector-normalize! (-> arg0 vector 2) (-> arg1 z)) arg0 ) @@ -1677,9 +1701,9 @@ (set! (-> s5-0 trans quad) a2-1) ) (vector-reset! (-> s5-0 trans)) - (vector-normalize! (the-as vector (-> s5-0 data)) 1.0) - (vector-normalize! (the-as vector (&-> s5-0 data 4)) 1.0) - (vector-normalize! (the-as vector (&-> s5-0 data 8)) 1.0) + (vector-normalize! (the-as vector (-> s5-0 vector)) 1.0) + (vector-normalize! (-> s5-0 vector 1) 1.0) + (vector-normalize! (-> s5-0 vector 2) 1.0) (matrix->quaternion arg1 s5-0) ) ) @@ -1689,13 +1713,13 @@ (let ((s5-0 (matrix->scale arg0 (new 'stack-no-clear 'vector))) (s4-1 (quaternion->matrix (new 'stack-no-clear 'matrix) arg1)) ) - (vector-normalize-copy! (the-as vector (-> arg0 data)) (the-as vector (-> s4-1 data)) (-> s5-0 x)) - (vector-normalize-copy! (the-as vector (&-> arg0 data 4)) (the-as vector (&-> s4-1 data 4)) (-> s5-0 y)) - (vector-normalize-copy! (the-as vector (&-> arg0 data 8)) (the-as vector (&-> s4-1 data 8)) (-> s5-0 z)) + (vector-normalize-copy! (the-as vector (-> arg0 vector)) (the-as vector (-> s4-1 vector)) (-> s5-0 x)) + (vector-normalize-copy! (-> arg0 vector 1) (-> s4-1 vector 1) (-> s5-0 y)) + (vector-normalize-copy! (-> arg0 vector 2) (-> s4-1 vector 2) (-> s5-0 z)) ) - (set! (-> arg0 data 3) 0.0) - (set! (-> arg0 data 7) 0.0) - (set! (-> arg0 data 11) 0.0) + (set! (-> arg0 vector 0 w) 0.0) + (set! (-> arg0 vector 1 w) 0.0) + (set! (-> arg0 vector 2 w) 0.0) arg0 ) @@ -1727,26 +1751,18 @@ (set! (-> s4-0 vector 2 quad) a1-1) (set! (-> s4-0 trans quad) a2-1) ) - (vector-normalize! (the-as vector (-> s4-0 data)) 1.0) - (vector-normalize! (the-as vector (&-> s4-0 data 4)) 1.0) - (vector-normalize! (the-as vector (&-> s4-0 data 8)) 1.0) - (vector-cross! - (the-as vector (&-> s4-0 data 8)) - (the-as vector (-> s4-0 data)) - (the-as vector (&-> s4-0 data 4)) - ) - (vector-cross! - (the-as vector (&-> s4-0 data 4)) - (the-as vector (&-> s4-0 data 8)) - (the-as vector (-> s4-0 data)) - ) + (vector-normalize! (the-as vector (-> s4-0 vector)) 1.0) + (vector-normalize! (-> s4-0 vector 1) 1.0) + (vector-normalize! (-> s4-0 vector 2) 1.0) + (vector-cross! (-> s4-0 vector 2) (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1)) + (vector-cross! (-> s4-0 vector 1) (-> s4-0 vector 2) (the-as vector (-> s4-0 vector))) (matrix->quaternion (-> arg0 quat) s4-0) ) (set-vector! (-> arg0 scale) - (vector-length (the-as vector (-> arg1 data))) - (vector-length (the-as vector (&-> arg1 data 4))) - (vector-length (the-as vector (&-> arg1 data 8))) + (vector-length (the-as vector (-> arg1 vector))) + (vector-length (-> arg1 vector 1)) + (vector-length (-> arg1 vector 2)) 1.0 ) arg0 @@ -1778,18 +1794,18 @@ (f12-6 (- f5-0 (+ (* f6-0 f8-1) (* f5-0 f4-2) (* f2-0 f10-2)))) (f2-1 (- f2-0 (+ (* f6-0 f9-2) (* f5-0 f10-2) (* f2-0 f7-2)))) ) - (set! (-> arg0 data 0) f3-2) - (set! (-> arg0 data 1) f8-1) - (set! (-> arg0 data 2) f9-2) - (set! (-> arg0 data 3) f1-0) - (set! (-> arg0 data 4) f8-1) - (set! (-> arg0 data 5) f4-2) - (set! (-> arg0 data 6) f10-2) - (set! (-> arg0 data 7) f1-0) - (set! (-> arg0 data 8) f9-2) - (set! (-> arg0 data 9) f10-2) - (set! (-> arg0 data 10) f7-2) - (set! (-> arg0 data 11) f1-0) + (set! (-> arg0 vector 0 x) f3-2) + (set! (-> arg0 vector 0 y) f8-1) + (set! (-> arg0 vector 0 z) f9-2) + (set! (-> arg0 vector 0 w) f1-0) + (set! (-> arg0 vector 1 x) f8-1) + (set! (-> arg0 vector 1 y) f4-2) + (set! (-> arg0 vector 1 z) f10-2) + (set! (-> arg0 vector 1 w) f1-0) + (set! (-> arg0 vector 2 x) f9-2) + (set! (-> arg0 vector 2 y) f10-2) + (set! (-> arg0 vector 2 z) f7-2) + (set! (-> arg0 vector 2 w) f1-0) (set! (-> arg0 trans x) f11-4) (set! (-> arg0 trans y) f12-6) (set! (-> arg0 trans z) f2-1) diff --git a/test/decompiler/reference/jak2/engine/math/quaternion_REF.gc b/test/decompiler/reference/jak2/engine/math/quaternion_REF.gc index 8100b5b2a5..c67eed4b61 100644 --- a/test/decompiler/reference/jak2/engine/math/quaternion_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/quaternion_REF.gc @@ -63,9 +63,9 @@ ;; INFO: Used lq/sq (defun quaternion-look-at! ((arg0 quaternion) (arg1 vector) (arg2 vector)) (let ((s5-0 (new 'stack-no-clear 'matrix))) - (vector-cross! (the-as vector (-> s5-0 data)) arg2 arg1) - (vector-cross! (the-as vector (&-> s5-0 data 4)) arg1 (the-as vector (-> s5-0 data))) - (set! (-> (the-as vector (&-> s5-0 data 8)) quad) (-> arg1 quad)) + (vector-cross! (the-as vector (-> s5-0 vector)) arg2 arg1) + (vector-cross! (-> s5-0 vector 1) arg1 (the-as vector (-> s5-0 vector))) + (set! (-> (the-as vector (-> s5-0 vector 2)) quad) (-> arg1 quad)) (quaternion-normalize! (matrix->quaternion arg0 s5-0)) ) ) @@ -348,18 +348,18 @@ (f1-0 (-> arg1 z)) (f0-0 (-> arg1 w)) ) - (set! (-> arg0 data 0) f0-0) - (set! (-> arg0 data 1) f1-0) - (set! (-> arg0 data 2) (- f2-0)) - (set! (-> arg0 data 3) f3-0) - (set! (-> arg0 data 4) (- f1-0)) - (set! (-> arg0 data 5) f0-0) - (set! (-> arg0 data 6) f3-0) - (set! (-> arg0 data 7) f2-0) - (set! (-> arg0 data 8) f2-0) - (set! (-> arg0 data 9) (- f3-0)) - (set! (-> arg0 data 10) f0-0) - (set! (-> arg0 data 11) f1-0) + (set! (-> arg0 vector 0 x) f0-0) + (set! (-> arg0 vector 0 y) f1-0) + (set! (-> arg0 vector 0 z) (- f2-0)) + (set! (-> arg0 vector 0 w) f3-0) + (set! (-> arg0 vector 1 x) (- f1-0)) + (set! (-> arg0 vector 1 y) f0-0) + (set! (-> arg0 vector 1 z) f3-0) + (set! (-> arg0 vector 1 w) f2-0) + (set! (-> arg0 vector 2 x) f2-0) + (set! (-> arg0 vector 2 y) (- f3-0)) + (set! (-> arg0 vector 2 z) f0-0) + (set! (-> arg0 vector 2 w) f1-0) (set! (-> arg0 trans x) (- f3-0)) (set! (-> arg0 trans y) (- f2-0)) (set! (-> arg0 trans z) (- f1-0)) @@ -375,18 +375,18 @@ (f0-0 (-> arg1 z)) ) (let ((f3-0 (-> arg1 w))) - (set! (-> arg0 data 0) f2-0) - (set! (-> arg0 data 1) f3-0) - (set! (-> arg0 data 2) (- f0-0)) - (set! (-> arg0 data 3) f1-0) - (set! (-> arg0 data 4) f1-0) - (set! (-> arg0 data 5) f0-0) - (set! (-> arg0 data 6) f3-0) - (set! (-> arg0 data 7) (- f3-0)) - (set! (-> arg0 data 8) f0-0) - (set! (-> arg0 data 9) (- f1-0)) - (set! (-> arg0 data 10) f2-0) - (set! (-> arg0 data 11) f3-0) + (set! (-> arg0 vector 0 x) f2-0) + (set! (-> arg0 vector 0 y) f3-0) + (set! (-> arg0 vector 0 z) (- f0-0)) + (set! (-> arg0 vector 0 w) f1-0) + (set! (-> arg0 vector 1 x) f1-0) + (set! (-> arg0 vector 1 y) f0-0) + (set! (-> arg0 vector 1 z) f3-0) + (set! (-> arg0 vector 1 w) (- f3-0)) + (set! (-> arg0 vector 2 x) f0-0) + (set! (-> arg0 vector 2 y) (- f1-0)) + (set! (-> arg0 vector 2 z) f2-0) + (set! (-> arg0 vector 2 w) f3-0) (set! (-> arg0 trans x) f3-0) ) (set! (-> arg0 trans y) (- f2-0)) @@ -443,15 +443,15 @@ ;; definition for function matrix->quaternion (defun matrix->quaternion ((arg0 quaternion) (arg1 matrix)) - (let ((f0-2 (+ (-> arg1 data 0) (-> arg1 data 5) (-> arg1 data 10)))) + (let ((f0-2 (+ (-> arg1 vector 0 x) (-> arg1 vector 1 y) (-> arg1 vector 2 z)))) (cond ((< 0.0 f0-2) (let ((f0-4 (sqrtf (+ 1.0 f0-2)))) (set! (-> arg0 w) (* 0.5 f0-4)) (let ((f0-5 (/ 0.5 f0-4))) - (set! (-> arg0 x) (* f0-5 (- (-> arg1 data 6) (-> arg1 data 9)))) - (set! (-> arg0 y) (* f0-5 (- (-> arg1 data 8) (-> arg1 data 2)))) - (set! (-> arg0 z) (* f0-5 (- (-> arg1 data 1) (-> arg1 data 4)))) + (set! (-> arg0 x) (* f0-5 (- (-> arg1 vector 1 z) (-> arg1 vector 2 y)))) + (set! (-> arg0 y) (* f0-5 (- (-> arg1 vector 2 x) (-> arg1 vector 0 z)))) + (set! (-> arg0 z) (* f0-5 (- (-> arg1 vector 0 y) (-> arg1 vector 1 x)))) ) ) ) @@ -460,12 +460,12 @@ (a3-0 1) (v1-4 2) ) - (when (< (-> arg1 data 0) (-> arg1 data 5)) + (when (< (-> arg1 vector 0 x) (-> arg1 vector 1 y)) (set! a2-0 1) (set! a3-0 2) (set! v1-4 0) ) - (when (< (-> (the-as (pointer float) (+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1)))) (-> arg1 data 10)) + (when (< (-> (the-as (pointer float) (+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1)))) (-> arg1 vector 2 z)) (set! a2-0 2) (set! a3-0 0) (set! v1-4 1) @@ -528,9 +528,9 @@ (vf7 :class vf) ) (let ((v1-0 (new-stack-matrix0))) - (let* ((f0-1 (vector-dot (the-as vector (-> arg1 data)) (the-as vector (-> arg1 data)))) - (f1-1 (vector-dot (the-as vector (&-> arg1 data 4)) (the-as vector (&-> arg1 data 4)))) - (f2-1 (vector-dot (the-as vector (&-> arg1 data 8)) (the-as vector (&-> arg1 data 8)))) + (let* ((f0-1 (vector-dot (the-as vector (-> arg1 vector)) (the-as vector (-> arg1 vector)))) + (f1-1 (vector-dot (-> arg1 vector 1) (-> arg1 vector 1))) + (f2-1 (vector-dot (-> arg1 vector 2) (-> arg1 vector 2))) (f0-3 (/ 1.0 (sqrtf f0-1))) (f1-3 (/ 1.0 (sqrtf f1-1))) (f2-3 (/ 1.0 (sqrtf f2-1))) @@ -797,7 +797,7 @@ (defun vector-x-quaternion! ((arg0 vector) (arg1 quaternion)) (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 data)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector)) 0)) ) arg0 ) @@ -807,7 +807,7 @@ (defun vector-y-quaternion! ((arg0 vector) (arg1 quaternion)) (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (&-> s5-0 data 4)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector 1)) 0)) ) arg0 ) @@ -817,7 +817,7 @@ (defun vector-z-quaternion! ((arg0 vector) (arg1 quaternion)) (let ((s5-0 (new-stack-matrix0))) (quaternion->matrix s5-0 arg1) - (set! (-> arg0 quad) (-> (the-as (pointer uint128) (&-> s5-0 data 8)) 0)) + (set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector 2)) 0)) ) arg0 ) diff --git a/test/decompiler/reference/jak2/engine/math/transform_REF.gc b/test/decompiler/reference/jak2/engine/math/transform_REF.gc index b11fd3565e..239167cd3b 100644 --- a/test/decompiler/reference/jak2/engine/math/transform_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/transform_REF.gc @@ -64,7 +64,3 @@ (defun trs-matrix-calc! ((arg0 trs) (arg1 matrix)) (transform-matrix-calc! (the-as transform (-> arg0 trans)) arg1) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/math/transformq_REF.gc b/test/decompiler/reference/jak2/engine/math/transformq_REF.gc index aad9715f56..abfd62f9da 100644 --- a/test/decompiler/reference/jak2/engine/math/transformq_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/transformq_REF.gc @@ -126,9 +126,9 @@ (s1-0 (-> *standard-dynamics* gravity-normal)) (s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) s5-0)) ) - (let ((s4-0 (&-> s3-0 data 8))) - (vector-normalize! (vector-flatten! (the-as vector (&-> s3-0 data 4)) s1-0 (the-as vector s4-0)) 1.0) - (vector-cross! (the-as vector (-> s3-0 data)) (the-as vector (&-> s3-0 data 4)) (the-as vector s4-0)) + (let ((s4-0 (-> s3-0 vector 2))) + (vector-normalize! (vector-flatten! (-> s3-0 vector 1) s1-0 s4-0) 1.0) + (vector-cross! (the-as vector (-> s3-0 vector)) (-> s3-0 vector 1) s4-0) ) (let ((a1-5 (matrix-rotate-z! (new 'stack-no-clear 'matrix) arg0))) (matrix*! s3-0 a1-5 s3-0) @@ -462,7 +462,3 @@ arg0 ) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-focusable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-focusable_REF.gc index 3796b7e77f..ae11425ed4 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-focusable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-focusable_REF.gc @@ -15,7 +15,7 @@ (get-transv (_type_) vector 22) (process-focusable-method-23 (_type_) none 23) (process-focusable-method-24 (_type_) none 24) - (process-focusable-method-25 (_type_) none 25) + (process-focusable-method-25 (_type_) int 25) (process-focusable-method-26 (_type_) none 26) ) ) @@ -88,10 +88,8 @@ ) ;; definition for method 25 of type process-focusable -;; INFO: Return type mismatch int vs none. (defmethod process-focusable-method-25 process-focusable ((obj process-focusable)) 0 - (none) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak2/engine/ui/text_REF.gc b/test/decompiler/reference/jak2/engine/ui/text_REF.gc index 952295918a..97fd796dbf 100644 --- a/test/decompiler/reference/jak2/engine/ui/text_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/text_REF.gc @@ -280,23 +280,26 @@ (let ((s5-0 (new 'static 'vector4w)) (gp-0 (new 'static 'matrix)) ) - (let ((v1-2 (-> gp-0 data))) - (set! (-> v1-2 0) (the-as float (the int (+ -256.0 (-> arg0 origin x))))) - (set! (-> v1-2 1) (the-as float (the int (+ -208.0 (-> arg0 origin y))))) - (set! (-> v1-2 2) 0.0) - (set! (-> v1-2 3) (the-as float #x1)) + (set-vector! + (-> gp-0 vector 0) + (the-as float (the int (+ -256.0 (-> arg0 origin x)))) + (the-as float (the int (+ -208.0 (-> arg0 origin y)))) + 0.0 + (the-as float #x1) ) - (let ((v1-3 (&-> gp-0 data 4))) - (set! (-> v1-3 0) (the-as float (the int (+ -256.0 (-> arg0 width) (-> arg0 origin x))))) - (set! (-> v1-3 1) (the-as float (the int (+ -208.0 (-> arg0 origin y))))) - (set! (-> v1-3 2) 0.0) - (set! (-> v1-3 3) (the-as float #x1)) + (set-vector! + (-> gp-0 vector 1) + (the-as float (the int (+ -256.0 (-> arg0 width) (-> arg0 origin x)))) + (the-as float (the int (+ -208.0 (-> arg0 origin y)))) + 0.0 + (the-as float #x1) ) - (let ((v1-4 (&-> gp-0 data 8))) - (set! (-> v1-4 0) (the-as float (the int (+ -256.0 (-> arg0 width) (-> arg0 origin x))))) - (set! (-> v1-4 1) (the-as float (the int (+ -208.0 (-> arg0 height) (-> arg0 origin y))))) - (set! (-> v1-4 2) 0.0) - (set! (-> v1-4 3) (the-as float #x1)) + (set-vector! + (-> gp-0 vector 2) + (the-as float (the int (+ -256.0 (-> arg0 width) (-> arg0 origin x)))) + (the-as float (the int (+ -208.0 (-> arg0 height) (-> arg0 origin y)))) + 0.0 + (the-as float #x1) ) (set-vector! (-> gp-0 trans) @@ -309,29 +312,17 @@ (add-debug-line2d #t (bucket-id bucket-318) - (the-as vector (-> gp-0 data)) - (the-as vector (&-> gp-0 data 4)) - (the-as vector s5-0) - ) - (add-debug-line2d - #t - (bucket-id bucket-318) - (the-as vector (&-> gp-0 data 4)) - (the-as vector (&-> gp-0 data 8)) - (the-as vector s5-0) - ) - (add-debug-line2d - #t - (bucket-id bucket-318) - (the-as vector (&-> gp-0 data 8)) - (-> gp-0 trans) + (the-as vector (-> gp-0 vector)) + (-> gp-0 vector 1) (the-as vector s5-0) ) + (add-debug-line2d #t (bucket-id bucket-318) (-> gp-0 vector 1) (-> gp-0 vector 2) (the-as vector s5-0)) + (add-debug-line2d #t (bucket-id bucket-318) (-> gp-0 vector 2) (-> gp-0 trans) (the-as vector s5-0)) (add-debug-line2d #t (bucket-id bucket-318) (-> gp-0 trans) - (the-as vector (-> gp-0 data)) + (the-as vector (-> gp-0 vector)) (the-as vector s5-0) ) ) diff --git a/test/decompiler/reference/jak2/engine/util/glist-h_REF.gc b/test/decompiler/reference/jak2/engine/util/glist-h_REF.gc new file mode 100644 index 0000000000..45fe8d297a --- /dev/null +++ b/test/decompiler/reference/jak2/engine/util/glist-h_REF.gc @@ -0,0 +1,141 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition of type glst-node +(deftype glst-node (structure) + ((next glst-node :offset-assert 0) + (prev glst-node :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type glst-node +(defmethod inspect glst-node ((obj glst-node)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'glst-node) + (format #t "~1Tnext: #~%" (-> obj next)) + (format #t "~1Tprev: #~%" (-> obj prev)) + (label cfg-4) + obj + ) + +;; definition of type glst-named-node +(deftype glst-named-node (glst-node) + ((privname string :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type glst-named-node +(defmethod inspect glst-named-node ((obj glst-named-node)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'glst-named-node) + (format #t "~1Tnext: #~%" (-> obj next)) + (format #t "~1Tprev: #~%" (-> obj prev)) + (format #t "~1Tprivname: ~A~%" (-> obj privname)) + (label cfg-4) + obj + ) + +;; definition of type glst-list +(deftype glst-list (structure) + ((head glst-node :offset-assert 0) + (tail glst-node :offset-assert 4) + (tailpred glst-node :offset-assert 8) + (numelem int32 :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type glst-list +(defmethod inspect glst-list ((obj glst-list)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'glst-list) + (format #t "~1Thead: #~%" (-> obj head)) + (format #t "~1Ttail: #~%" (-> obj tail)) + (format #t "~1Ttailpred: #~%" (-> obj tailpred)) + (format #t "~1Tnumelem: ~D~%" (-> obj numelem)) + (label cfg-4) + obj + ) + +;; definition for function glst-next +(defun glst-next ((arg0 glst-node)) + "return the next node in the list" + (-> arg0 next) + ) + +;; definition for function glst-prev +(defun glst-prev ((arg0 glst-node)) + "return the previous node in the list" + (-> arg0 prev) + ) + +;; definition for function glst-head +(defun glst-head ((arg0 glst-list)) + "return the start of the list" + (-> arg0 head) + ) + +;; definition for function glst-tail +(defun glst-tail ((arg0 glst-list)) + "return the tail of the list" + (-> arg0 tailpred) + ) + +;; definition for function glst-end-of-list? +(defun glst-end-of-list? ((arg0 glst-node)) + "is this node the end of the list. #t = end" + (not (-> arg0 next)) + ) + +;; definition for function glst-start-of-list? +(defun glst-start-of-list? ((arg0 glst-node)) + "is this node the start of the list. #t = start" + (not (-> arg0 prev)) + ) + +;; definition for function glst-empty? +(defun glst-empty? ((arg0 glst-list)) + "is the list empty, #t = empty" + (= (-> arg0 tailpred) arg0) + ) + +;; definition for function glst-node-name +(defun glst-node-name ((arg0 glst-named-node)) + "Returns the `privname` of the provided [[glst-named-node]]" + (-> arg0 privname) + ) + +;; definition for function glst-set-name! +(defun glst-set-name! ((arg0 glst-named-node) (arg1 string)) + "Sets the `privname` of the provided [[glst-named-node]]" + (set! (-> arg0 privname) arg1) + arg1 + ) + +;; failed to figure out what this is: +0 + +) + + + diff --git a/test/decompiler/reference/jak2/engine/util/glist_REF.gc b/test/decompiler/reference/jak2/engine/util/glist_REF.gc new file mode 100644 index 0000000000..b2952ca9a7 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/util/glist_REF.gc @@ -0,0 +1,210 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition for function glst-num-elements +(defun glst-num-elements ((arg0 glst-list)) + "Returns `numelem` from the provided [[glst-list]]" + (-> arg0 numelem) + ) + +;; definition for function glst-remove +(defun glst-remove ((arg0 glst-list) (arg1 glst-node)) + "Removes the provided [[glst-node]] from the list and returns it back" + (let ((v1-0 arg1)) + "return the previous node in the list" + (let ((v1-1 (-> v1-0 prev)) + (a2-1 arg1) + ) + "return the next node in the list" + (let ((a2-2 (-> a2-1 next))) + (set! (-> v1-1 next) a2-2) + (set! (-> a2-2 prev) v1-1) + ) + ) + ) + (+! (-> arg0 numelem) -1) + arg1 + ) + +;; definition for function glst-remove-tail +(defun glst-remove-tail ((arg0 glst-list)) + "Removes the tail of the [[glst-list]], returns #f if the list is empty, otherwise returns the [[glst-node]] that was removed" + (let ((v1-0 arg0)) + "return the tail of the list" + (let* ((a1-1 (-> v1-0 tailpred)) + (v1-1 a1-1) + ) + "is this node the start of the list. #t = start" + (if (not (not (-> v1-1 prev))) + (glst-remove arg0 a1-1) + (the-as glst-node #f) + ) + ) + ) + ) + +;; definition for function glst-remove-head +(defun glst-remove-head ((arg0 glst-list)) + "Removes the head of the [[glst-list]], returns #f if the list is empty, otherwise returns the [[glst-node]] that was removed" + (let ((v1-0 arg0)) + "return the start of the list" + (let* ((a1-1 (-> v1-0 head)) + (v1-1 a1-1) + ) + "is this node the end of the list. #t = end" + (if (not (not (-> v1-1 next))) + (glst-remove arg0 a1-1) + (the-as glst-node #f) + ) + ) + ) + ) + +;; definition for function glst-insert-before +(defun glst-insert-before ((list glst-list) (curr glst-node) (new glst-node)) + "Inserts `new` before `curr`, returns the newly inserted [[glst-node]]" + (let ((v1-0 curr)) + "return the previous node in the list" + (let ((v1-1 (-> v1-0 prev))) + (set! (-> new prev) v1-1) + (set! (-> new next) curr) + (set! (-> v1-1 next) new) + ) + ) + (set! (-> curr prev) new) + (+! (-> list numelem) 1) + new + ) + +;; definition for function glst-insert-after +(defun glst-insert-after ((list glst-list) (curr glst-node) (new glst-node)) + "Inserts `new` after `curr`, returns the newly inserted [[glst-node]]" + (let ((v1-0 curr)) + "return the next node in the list" + (let ((v1-1 (-> v1-0 next))) + (set! (-> new prev) curr) + (set! (-> new next) v1-1) + (set! (-> v1-1 prev) new) + ) + ) + (set! (-> curr next) new) + (+! (-> list numelem) 1) + new + ) + +;; definition for function glst-add-tail +(defun glst-add-tail ((arg0 glst-list) (arg1 glst-node)) + "Adds the provided [[glst-node]] to the end of the [[glst-list]]" + (glst-insert-before arg0 (the-as glst-node (&-> arg0 tail)) arg1) + arg1 + ) + +;; definition for function glst-add-head +(defun glst-add-head ((arg0 glst-list) (arg1 glst-node)) + "Adds the provided [[glst-node]] to the beginning of the [[glst-list]]" + (glst-insert-after arg0 (the-as glst-node arg0) arg1) + arg1 + ) + +;; definition for function glst-init-list! +(defun glst-init-list! ((arg0 glst-list)) + "Clears the provided [[glst-list]]" + (set! (-> arg0 head) (the-as glst-node (&-> arg0 tail))) + (set! (-> arg0 tail) #f) + (set! (-> arg0 tailpred) (the-as glst-node (&-> arg0 head))) + (set! (-> arg0 numelem) 0) + arg0 + ) + +;; definition for function glst-find-node-by-name +(defun glst-find-node-by-name ((arg0 glst-list) (arg1 string)) + "Returns the [[glst-named-node]] by examining it's `privname`, returns #f if nothing is found" + (let ((v1-0 arg0)) + "return the start of the list" + (let ((s5-0 (-> v1-0 head))) + (while (let ((v1-6 s5-0)) + "is this node the end of the list. #t = end" + (not (not (-> v1-6 next))) + ) + (if (name= (-> (the-as glst-named-node s5-0) privname) arg1) + (return s5-0) + ) + "return the next node in the list" + (set! s5-0 (-> s5-0 next)) + ) + ) + ) + (the-as glst-node #f) + ) + +;; definition for function glst-get-node-by-index +(defun glst-get-node-by-index ((arg0 glst-list) (arg1 int)) + "Returns the [[glst-node]] by index, returns #f if nothing is found" + (when (and (< arg1 (glst-num-elements arg0)) (>= arg1 0)) + "return the start of the list" + (let ((v1-3 (-> arg0 head))) + (dotimes (a0-3 arg1) + (nop!) + (nop!) + (nop!) + (nop!) + "return the next node in the list" + (set! v1-3 (-> v1-3 next)) + ) + (return v1-3) + ) + ) + (the-as glst-node #f) + ) + +;; definition for function glst-length-of-longest-name +(defun glst-length-of-longest-name ((arg0 glst-list)) + "Returns the length of the longest `privname`" + (let ((gp-0 0)) + (let ((v1-0 arg0)) + "return the start of the list" + (let ((s5-0 (-> v1-0 head))) + (while (let ((v1-6 s5-0)) + "is this node the end of the list. #t = end" + (not (not (-> v1-6 next))) + ) + (let ((v1-3 (length (-> (the-as glst-named-node s5-0) privname)))) + (if (< gp-0 v1-3) + (set! gp-0 v1-3) + ) + ) + "return the next node in the list" + (set! s5-0 (-> s5-0 next)) + ) + ) + ) + gp-0 + ) + ) + +;; definition for function glst-get-node-index +(defun glst-get-node-index ((arg0 glst-list) (arg1 glst-node)) + "Given a [[glst-node]] return it's position in the [[glst-list]]" + (let ((v1-0 0)) + "return the start of the list" + (let ((a0-1 (-> arg0 head))) + (while (let ((a2-3 a0-1)) + "is this node the end of the list. #t = end" + (not (not (-> a2-3 next))) + ) + (if (= a0-1 arg1) + (return v1-0) + ) + (+! v1-0 1) + "return the next node in the list" + (set! a0-1 (-> a0-1 next)) + ) + ) + ) + -1 + ) + +) diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 7cb435f207..7bb9f6366e 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -64,9 +64,42 @@ "dm-scene-load-pick-func", "popup-menu-context-make-default-menus", "debug-menu-context-make-default-menus", + // camera + // - vector-dot issue + "slave-set-rotation!", + "v-slrp2!", + "v-slrp3!", + // cam-master + // - focus understanding / decomp crashes + "reset-target-tracking", + "(method 16 camera-master)", + "master-track-target", + // cam-states + // - mostly decompiler crashes/hangs + "cam-bike-code", + "cam-stick-code", + "cam-string-code", + "cam-string-line-of-sight", + "cam-string-joystick", // whats butt-handle! + "cam-circular-code", + "cam-circular-position", + "cam-los-collide", // vector-dot with stack + // cam-update + "update-visible", // assertion crash when filling out bsp-header // placeholder "i-hopefully-will-never-exist-dont-add-anything-after-me-please" ], - "skip_compile_states": {} + "skip_compile_states": { + "cam-bike": [ + "code" // hang + ], + "cam-stick": [ + "code" + ], + "cam-circular": [ + "enter", + "event" + ] + } }