diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index b11eb6e6e4..8ff18493f4 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -92,6 +92,7 @@ (define-extern inspect (function object object)) (define-extern mem-print (function (pointer uint32) int symbol)) (define-extern print-tree-bitmask (function int int symbol)) +(define-extern quad-copy! (function pointer pointer int none)) ;; has issues: (define-extern breakpoint-range-set! (function uint uint uint int)) @@ -116,11 +117,6 @@ (define-extern *debug-segment* symbol) (define-extern *trace-list* pair) -;; - Unknowns - -(define-extern quad-copy! (function pointer pointer int none)) - - ;; ---------------------- ;; NO FILE ;; Unknowns / Built-Ins / Non-Original Types @@ -1989,7 +1985,7 @@ ;; - Types (deftype matrix (structure) - ((vector vector 4 :inline :offset 0) + ((vector vector 4 :score 999 :inline :offset 0) (quad uint128 4 :offset 0) (data float 16 :offset 0) ) @@ -4880,7 +4876,7 @@ (bsp-name (_type_) symbol 13) (dummy-14 (_type_ object) memory-usage-block 14) (dummy-15 (_type_ vector) symbol 15) - (dummy-16 (_type_) none 16) + (dummy-16 (_type_ uint uint) none 16) (load-continue (_type_) _type_ 17) (load-begin (_type_) _type_ 18) (login (_type_) _type_ 19) @@ -5037,8 +5033,8 @@ (pfog0 float :offset-assert 832) (pfog1 float :offset-assert 836) (trans vector :inline :offset-assert 848) - (plane uint128 4 :offset-assert 864) - (guard-plane uint128 4 :offset-assert 928) + (plane plane 4 :inline :offset-assert 864) + (guard-plane plane 4 :inline :offset-assert 928) (shrub-mat matrix :inline :offset-assert 992) (fov-correction-factor float :offset-assert 1056) ) @@ -10878,8 +10874,8 @@ (old-status uint64 :offset-assert 280) (prev-status uint64 :offset-assert 288) (reaction-flag uint32 :offset-assert 296) - (reaction basic :offset-assert 300) - (no-reaction basic :offset-assert 304) + (reaction function :offset-assert 300) + (no-reaction function :offset-assert 304) (local-normal vector :inline :offset-assert 320) (surface-normal vector :inline :offset-assert 336) (poly-normal vector :inline :offset-assert 352) @@ -10891,8 +10887,8 @@ (poly-angle float :offset-assert 424) (touch-angle float :offset-assert 428) (coverage float :offset-assert 432) - (dynam basic :offset-assert 436) - (surf basic :offset-assert 440) + (dynam dynamics :offset-assert 436) + (surf surface :offset-assert 440) ) :method-count-assert 65 :size-assert #x1bc @@ -13425,14 +13421,14 @@ (deftype cam-index (structure) ((flags uint32 :offset-assert 0) - (vec uint128 2 :offset-assert 16) + (vec vector 2 :inline :offset 16) ) :method-count-assert 11 :size-assert #x30 :flag-assert #xb00000030 (:methods - (dummy-9 () none 9) - (dummy-10 () none 10) + (dummy-9 (_type_ symbol entity vector curve) symbol 9) + (dummy-10 (_type_ vector) float 10) ; inlined vector-dot issue? ) ) @@ -13458,7 +13454,7 @@ ) (deftype tracking-spline (structure) - ((point tracking-point 32 :inline :offset-assert 0) + ((point tracking-point 32 :inline :offset-assert 0) (summed-len float :offset-assert 1536) (free-point int32 :offset-assert 1540) (used-point int32 :offset-assert 1544) @@ -13477,20 +13473,20 @@ :size-assert #x664 :flag-assert #x1800000664 (:methods - (dummy-9 () none 9) - (dummy-10 () none 10) + (TODO-RENAME-9 (_type_) none 9) + (TODO-RENAME-10 (_type_ vector) none 10) (dummy-11 () none 11) (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) - (dummy-20 () none 20) - (dummy-21 () none 21) - (dummy-22 () none 22) + (TODO-RENAME-13 (_type_ int) none 13) + (TODO-RENAME-14 (_type_ vector) none 14) + (TODO-RENAME-15 (_type_) none 15) + (TODO-RENAME-16 (_type_ float) none 16) + (TODO-RENAME-17 (_type_ vector float float symbol) int 17) ; - return value is actually none but they do a manual `return` + (TODO-RENAME-18 (_type_ float vector tracking-spline-sampler) vector 18) + (TODO-RENAME-19 (_type_ float vector tracking-spline-sampler) vector 19) + (TODO-RENAME-20 (_type_ vector int) none 20) + (TODO-RENAME-21 (_type_ vector float float) vector 21) + (TODO-RENAME-22 (_type_ float) none 22) (dummy-23 () none 23) ) ) @@ -13550,7 +13546,7 @@ ) (deftype camera-combiner (process) - ((trans vector :inline :offset-assert 112) + ((trans vector :score 999 :inline :offset-assert 112) (inv-camera-rot matrix :inline :offset-assert 128) (fov float :offset-assert 192) (interp-val float :offset-assert 196) @@ -13571,13 +13567,14 @@ ) (deftype camera-slave (process) - ((trans vector :inline :offset-assert 112) + ((trans vector :score 999 :inline :offset-assert 112) (fov float :offset-assert 128) (fov0 float :offset-assert 132) (fov1 float :offset-assert 136) (fov-index cam-index :inline :offset-assert 144) (tracking cam-rotation-tracker :inline :offset-assert 192) (view-off-param float :offset-assert 400) + (unknown-symbol symbol :offset 412) ;; from - cam-combiner::lambda2 - I'm convinced `camera-slave` is the only matching process in this case (view-off vector :inline :offset-assert 416) (min-z-override float :offset-assert 432) (view-flat vector :inline :offset-assert 448) @@ -13590,7 +13587,7 @@ (max-angle-offset float :offset-assert 2192) (max-angle-curr float :offset-assert 2196) (options uint32 :offset-assert 2200) - (cam-entity basic :offset-assert 2204) + (cam-entity entity :offset-assert 2204) ; not totally confirmed yet, could be entity-actor (velocity vector :inline :offset-assert 2208) (desired-pos vector :inline :offset-assert 2224) (time-dist-too-far uint32 :offset-assert 2240) @@ -13612,7 +13609,7 @@ (spline-tt float :offset-assert 2480) (spline-follow-dist float :offset-assert 2484) (change-event-from uint32 :offset-assert 2488) - (enter-has-run basic :offset-assert 2492) + (enter-has-run symbol :offset-assert 2492) (blend-from-type uint64 :offset-assert 2496) (blend-to-type uint64 :offset-assert 2504) (have-phony-joystick basic :offset-assert 2512) @@ -13632,11 +13629,11 @@ (deftype camera-master (process) ((master-options uint32 :offset-assert 112) (num-slaves int32 :offset-assert 116) - (slave basic 2 :offset-assert 120) + (slave (pointer camera-slave) 2 :offset-assert 120) (slave-options uint32 :offset-assert 128) (view-off-param-save float :offset-assert 132) (changer uint32 :offset-assert 136) - (cam-entity basic :offset-assert 140) + (cam-entity entity :offset-assert 140) ; not totally confirmed yet (stringMinLength float :offset-assert 144) (stringMaxLength float :offset-assert 148) (stringMinHeight float :offset-assert 152) @@ -14782,7 +14779,6 @@ ;; - Functions -;; TODO - not decompiling correctly due to vector-dot-product again i believe (define-extern ray-arbitrary-circle-intersect (function vector vector vector vector float float)) (define-extern camera-line (function vector vector vector none)) @@ -16998,7 +16994,7 @@ ;; - Unknowns -;;(define-extern group-rain-screend-drop object) ;; unknown type +(define-extern group-rain-screend-drop sparticle-launch-group) ;; not confirmed ;; ---------------------- @@ -17706,47 +17702,46 @@ ;; - Functions -(define-extern vector-into-frustum-nosmooth! function) -(define-extern slave-matrix-blend-2 function) -(define-extern mat-remove-z-rot function) -(define-extern parameter-ease-sin-clamp function) -(define-extern cam-slave-get-intro-step function) -(define-extern cam-slave-get-float function) -(define-extern cam-slave-init-vars function) -(define-extern cam-calc-follow! function) -(define-extern slave-set-rotation! function) -(define-extern camera-slave-debug function) -(define-extern camera-line-rel-len function) -(define-extern cam-slave-get-flags function) -(define-extern cam-slave-get-vector-with-offset function) -(define-extern cam-slave-get-fov function) -(define-extern cam-slave-get-interp-time function) -(define-extern cam-slave-get-rot function) -(define-extern cam-state-from-entity function) -(define-extern parameter-ease-none function) -(define-extern parameter-ease-clamp function) -(define-extern parameter-ease-lerp-clamp function) -(define-extern parameter-ease-sqrt-clamp function) -(define-extern fourth-power function) -(define-extern third-power function) -(define-extern parameter-ease-sqr-clamp function) -(define-extern cam-slave-go function) -(define-extern cam-slave-init function) -(define-extern cam-standard-event-handler function) -(define-extern cam-curve-pos function) -(define-extern cam-curve-setup function) -(define-extern v-slrp2! function) -(define-extern v-slrp3! function) - -;; - Unknowns +(define-extern vector-into-frustum-nosmooth! (function matrix vector float vector)) +(define-extern slave-matrix-blend-2 (function matrix float vector matrix matrix)) +(define-extern mat-remove-z-rot (function matrix vector matrix)) +(define-extern parameter-ease-sin-clamp (function float float)) +(define-extern cam-slave-get-intro-step (function entity float)) +(define-extern cam-slave-get-float (function entity symbol float float)) +(define-extern cam-slave-init-vars (function none :behavior camera-slave)) +(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)) +(define-extern camera-slave-debug (function object object object object object)) ;; passed to engine::method-15 +(define-extern camera-line-rel-len (function tracking-point vector float rgba none)) +(define-extern cam-slave-get-flags (function entity symbol uint128)) +(define-extern cam-slave-get-vector-with-offset (function entity-actor vector symbol symbol)) +(define-extern cam-slave-get-fov (function entity float)) +(define-extern cam-slave-get-interp-time (function entity float)) +(define-extern cam-slave-get-rot (function entity-actor quaternion quaternion)) +(define-extern cam-state-from-entity (function entity state)) +(define-extern parameter-ease-none (function object object)) ;; stubbed and unused +(define-extern parameter-ease-clamp (function float float)) ;; unused +(define-extern parameter-ease-lerp-clamp (function float float)) ;; unused +(define-extern parameter-ease-sqrt-clamp (function float float)) ;; unused +(define-extern fourth-power (function float float)) ;; unused +(define-extern third-power (function float float)) ;; unused +(define-extern parameter-ease-sqr-clamp (function float float)) +(define-extern cam-slave-go (function camera-slave none)) +(define-extern cam-slave-init (function state entity none :behavior camera-slave)) +(define-extern cam-standard-event-handler (function process int symbol event-message-block object :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 v-slrp2! (function vector vector vector float vector float vector)) +(define-extern v-slrp3! (function vector vector vector vector float vector)) -;;(define-extern *cam-res-string* object) ;; unknown type -;;(define-extern cam-circular object) ;; unknown type -;;(define-extern cam-standoff-read-entity object) ;; unknown type -;;(define-extern cam-spline object) ;; unknown type -;;(define-extern *camera-base-mode* object) ;; unknown type -;;(define-extern cam-fixed-read-entity object) ;; unknown type +;; - Symbols +(define-extern *cam-res-string* string) +(define-extern cam-circular state) +(define-extern cam-standoff-read-entity state) +(define-extern cam-spline state) +(define-extern *camera-base-mode* state) +(define-extern cam-fixed-read-entity state) ;; ---------------------- ;; File - cam-interface @@ -17815,20 +17810,21 @@ (define-extern setup-slave-for-hopefull function) (define-extern master-is-hopeful-better? function) (define-extern target-cam-pos function) -(define-extern cam-master-init function) +(define-extern cam-master-init (function none :behavior camera-master)) ;; - Symbols (define-extern cam-free-floating state) +(define-extern cam-master-active state) +(define-extern list-keeper-active state) +(define-extern *CAMERA_MASTER-bank* camera-master-bank) + ;; - Unknowns -;;(define-extern cam-master-active object) ;; unknown type -;;(define-extern list-keeper-active object) ;; unknown type ;;(define-extern cam-fixed object) ;; unknown type ;;(define-extern cam-decel object) ;; unknown type ;;(define-extern cam-eye object) ;; unknown type -;;(define-extern *CAMERA_MASTER-bank* object) ;; unknown type ;; ---------------------- @@ -17933,15 +17929,18 @@ (define-extern cam-circular-code function) (define-extern cam-circular-position function) (define-extern cam-circular-position-into-max-angle function) -(define-extern cam-standoff-calc-trans function) +(define-extern cam-standoff-calc-trans (function cam-rotation-tracker vector symbol none)) ;; not confirmed (define-extern string-push-help function) (define-extern cam-draw-collide-cache function) +;; - Symbols + +(define-extern cam-string state) + ;; - Unknowns ;;(define-extern *CAM_BIKE-bank* object) ;; unknown type ;;(define-extern *CAM_STICK-bank* object) ;; unknown type -;;(define-extern cam-string object) ;; unknown type ;;(define-extern *CAM_STRING-bank* object) ;; unknown type ;;(define-extern *CAM_BILLY-bank* object) ;; unknown type ;;(define-extern *CAM_EYE-bank* object) ;; unknown type @@ -18018,14 +18017,17 @@ ;; - Functions -(define-extern cam-free-floating-move function) -(define-extern cam-free-floating-input function) +(define-extern cam-free-floating-move (function matrix vector vector int vector)) +(define-extern cam-free-floating-input (function vector vector symbol int vector)) + +;; - Symbols + +(define-extern *CAM_FREE-bank* cam-free-bank) ;; - Unknowns ;;(define-extern *camera-orbit-info* object) ;; unknown type ;;(define-extern *CAM_ORBIT-bank* object) ;; unknown type -;;(define-extern *CAM_FREE-bank* object) ;; unknown type ;;(define-extern *CAM_POINT_WATCH-bank* object) ;; unknown type ;;(define-extern cam-point-watch object) ;; unknown type (define-extern cam-orbit state) ;; unknown type @@ -18039,11 +18041,11 @@ ;; - Functions -(define-extern cam-combiner-init function) +(define-extern cam-combiner-init (function none :behavior camera-combiner)) -;; - Unknowns +;; - Symbols -;;(define-extern cam-combiner-active object) ;; unknown type +(define-extern cam-combiner-active state) ;; ---------------------- @@ -18054,20 +18056,20 @@ ;; - Functions -(define-extern move-camera-from-pad function) -(define-extern update-view-planes function) -(define-extern update-visible (function math-camera none)) -(define-extern set-point function) -(define-extern plane-from-points function) -(define-extern update-camera (function none)) +(define-extern move-camera-from-pad (function math-camera math-camera)) +(define-extern update-view-planes (function math-camera (inline-array plane) float float)) +(define-extern update-visible (function math-camera symbol)) ;; second/third arg unused +(define-extern set-point (function vector float float float float)) +(define-extern plane-from-points (function (inline-array plane) vector vector vector int float)) +(define-extern update-camera (function symbol)) -;; - Unknowns +;; - Symbols -;;(define-extern *start-timer* object) ;; unknown type -;;(define-extern *timer-value* object) ;; unknown type -;;(define-extern *start-pos* object) ;; unknown type -;;(define-extern *save-camera-inv-rot* object) ;; unknown type -(define-extern *update-leaf-when-outside-bsp* symbol) +(define-extern *start-timer* int) +(define-extern *timer-value* int) +(define-extern *start-pos* vector) +(define-extern *save-camera-inv-rot* matrix) +(define-extern *update-leaf-when-outside-bsp* symbol) ;; boolean ;; ---------------------- @@ -18263,7 +18265,7 @@ (define-extern v-slrp! function) (define-extern interp-test-deg function) (define-extern camera-line-setup (function vector none)) -(define-extern camera-line-draw function) +(define-extern camera-line-draw (function vector vector rgba none)) (define-extern cam-layout-intersect-dist function) (define-extern clmf-button-test function) (define-extern clmf-bna function) @@ -18441,9 +18443,9 @@ ;; - Functions -(define-extern cam-stop function) -(define-extern reset-cameras function) -(define-extern cam-start function) +(define-extern cam-stop (function state)) +(define-extern reset-cameras (function none)) ;; defined in entity.gc +(define-extern cam-start (function symbol none)) ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc index b3c32631b8..ba08ea0877 100644 --- a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc @@ -579,5 +579,10 @@ [13, "(function none :behavior anim-tester)"] ], + "cam-combiner": [ + [1, "(function none :behavior camera-combiner)"], + [2, "(function basic int basic event-message-block object :behavior camera-combiner)"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index f0ed9657ae..aa6c9396a7 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -1290,6 +1290,59 @@ ["L5", "rgba", true] ], + "camera": [ + ["L257", "(inline-array qword)", true, 1], + ["L258", "(inline-array qword)", true, 1], + ["L271", "float", true], + ["L278", "float", true], + ["L279", "float", true], + ["L285", "float", true], + ["L287", "float", true], + ["L288", "float", true], + ["L291", "float", true], + ["L292", "float", true], + ["L293", "float", true], + ["L297", "float", true], + ["L299", "float", true], + ["L301", "float", true], + ["L302", "float", true], + ["L312", "float", true], + ["L314", "float", true], + ["L315", "float", true], + ["L317", "float", true], + ["L321", "float", true], + ["L323", "float", true] + ], + + "cam-combiner": [ + ["L4", "_lambda_", true], + ["L54", "_lambda_", true], + ["L77", "state", true], + ["L90", "float", true] + ], + + "cam-master": [ + ["L369", "float", true], + ["L370", "float", true], + ["L371", "float", true] + ], + + "cam-update": [ + ["L82", "float", true], + ["L84", "float", true], + ["L88", "rgba", true] + ], + + "cam-states-dbg": [ + ["L90", "float", true], + ["L91", "float", true], + ["L92", "float", true], + ["L93", "float", true], + ["L94", "float", true], + ["L98", "float", true], + ["L99", "float", true] + ], + // please do not add things after this entry! git is dumb. "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 5148c77dbe..4d98ea70da 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -391,11 +391,6 @@ [32, "matrix"] ], - "(method 18 tracking-spline)": [ - [16, "tracking-spline-sampler"], - [32, "tracking-spline-sampler"] - ], - "draw-ocean-transition": [[16, "sphere"]], "dm-cam-mode-func": [[16, "event-message-block"]], @@ -423,6 +418,7 @@ "(method 22 level)": [[16, "event-message-block"]], "(method 9 level)": [[16, "event-message-block"]], "(method 10 load-state)": [[16, "event-message-block"]], + "cam-slave-get-rot": [[16, "quaternion"]], "draw-joint-spheres": [[16, "vector"]], "(method 16 process-drawable)": [ @@ -583,6 +579,146 @@ "instance-tfragment-add-debug-sphere": [ [16, "vector"] ], + + "(method 10 game-save)": [[16, "file-stream"]], + + "cam-state-from-entity": [[16, "curve"]], + + "(method 9 cam-index)": [[16, "vector"]], + + "(method 10 cam-index)": [[16, "vector"]], + + "(method 15 tracking-spline)": [ + [16, "tracking-spline-sampler"], + [32, "tracking-point"] + ], + + "(method 16 tracking-spline)": [ + [16, "tracking-spline-sampler"], + [32, "vector"] + ], + + "(method 18 tracking-spline)": [ + [16, "tracking-spline-sampler"], + [32, "vector"] + ], + + "(method 20 tracking-spline)": [ + [16, "vector"], + [32, "vector"] + ], + + "(method 21 tracking-spline)": [ + [16, "tracking-spline-sampler"], + [32, "vector"] + ], + + "(method 22 tracking-spline)": [ + [16, "tracking-spline-sampler"], + [32, "vector"] + ], + + "cam-slave-init": [[16, "event-message-block"]], + + "cam-curve-pos": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "curve-length": [ + [16, "vector"], + [32, "vector"] + ], + + "curve-closest-point": [ + [16, "vector"], + [32, "vector"] + ], + + "cam-calc-follow!": [ + [16, "event-message-block"], + [96, "vector"], + [112, "vector"], + [128, "vector"], + [144, "vector"] + ], + + "mat-remove-z-rot": [ + [16, "vector"], + [32, "matrix"] + ], + + "slave-matrix-blend-2": [ + [16, "vector"], + [32, "quaternion"], + [48, "quaternion"], + [64, "quaternion"] + ], + + "vector-into-frustum-nosmooth!": [ + [16, "matrix"], + [80, "vector"], + [96, "vector"] + ], + + "slave-set-rotation!": [ + [16, "vector"], + [32, "matrix"], + [96, "vector"], + [112, "matrix"], // guess + [176, "vector"] // guess + ], + + "v-slrp2!": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "matrix"], + [128, "vector"] + ], + + "v-slrp3!": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "matrix"], + [128, "vector"] + ], + + "(anon-function 1 cam-combiner)": [ + [16, "vector"], + [32, "matrix"], + [80, "vector"], + [96, "matrix"] + ], + + "cam-master-init": [ + [16, "vector"], + [32, "vector"] + ], + + "plane-from-points": [[16, "vector"]], + + "update-view-planes": [ + [16, "view-frustum"], + [144, "vector"], + [160, "vector"], + [176, "vector"], + [192, "vector"], + [208, "vector"], + [224, "vector"] + ], + + "move-camera-from-pad": [[16, "vector"]], + + "cam-free-floating-move": [[16, "camera-free-floating-move-info"]], + + "update-camera": [ + [16, "vector"], + [32, "quaternion"], + [48, "vector"] + ], "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 47c8233ad8..c9466f56a5 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -595,8 +595,6 @@ [[11, 18], "v0", "collide-shape-prim-group"] ], - "camera-teleport-to-entity": [[9, "a0", "transform"]], - "entity-actor-count": [["_stack_", 16, "res-tag"]], "entity-actor-lookup": [ @@ -635,8 +633,6 @@ "num-func-chan": [[8, "v1", "joint-control-channel"]], - "cspace-by-name-no-fail": [[[0, 100], "v0", "cspace"]], - "shrubbery-login-post-texture": [ //[[13, 41], "a3", "qword"], // [[13, 41], "a2", "qword"] @@ -893,7 +889,6 @@ [[115, 154], "s3", "continue-point"] ], "(method 20 level)": [[[43, 45], "s3", "ramdisk-rpc-fill"]], - //"bg": [[[25, 52], "a0", "string"]], "(anon-function 29 process-drawable)": [ [[0, 99999], "s6", "process-drawable"] @@ -1101,7 +1096,6 @@ ], "(method 13 art-group)": [[16, "s3", "art-joint-anim"]], "(method 14 art-group)": [[16, "s3", "art-joint-anim"]], - "(method 9 external-art-control)": [ [171, "s4", "external-art-buffer"], [172, "s4", "external-art-buffer"], @@ -1586,6 +1580,72 @@ [154, "v1", "vector"], [[172, 189], "a1", "dma-packet"] ], + + "cam-standard-event-handler": [ + [[0, 999], "s6", "camera-slave"], + [[16, 30], "s5", "state"], + [41, "a0", "vector"], + [[5, 8], "t9", "(function object)"], + [[19, 22], "t9", "(function object)"], + [[30, 32], "t9", "(function object)"] + ], + + "cam-curve-pos": [[[0, 224], "s6", "camera-slave"]], + + "cam-combiner-init": [ + [[0, 999], "s6", "camera-combiner"], + [[28, 33], "t9", "(function object)"] + ], + + "(anon-function 1 cam-combiner)": [ + [[0, 999], "s6", "camera-combiner"] + ], + + "(anon-function 2 cam-combiner)": [ + [10, "a0", "vector"], + [[0, 20], "s6", "camera-slave"], + [[20, 231], "s6", "camera-combiner"], + [[99, 127], "gp", "camera-slave"], + [[187, 231], "gp", "camera-slave"] + ], + + "cam-start": [ + [[18, 22], "t9", "(function process object function)"], + [[38, 42], "t9", "(function process object function)"] + ], + + "cam-master-init": [ + [[0, 999], "s6", "camera-master"], + [[111, 115], "t9", "(function cpu-thread function)"], + [[139, 145], "t9", "(function cpu-thread function object object)"], + [[163, 167], "t9", "(function object)"] + ], + + "cam-curve-setup": [[[0, 82], "s6", "camera-slave"]], + + "(method 15 tracking-spline)": [ + [[57, 59], "a2", "vector"], + [[57, 59], "a3", "vector"] + ], + + "(method 16 tracking-spline)": [ + [[40, 42], "a0", "vector"], + [[40, 42], "a1", "vector"] + ], + + "cam-slave-init-vars": [ + [[0, 999], "s6", "camera-slave"] + ], + + "cam-slave-get-vector-with-offset": [[[52, 65], "s3", "vector"]], + + "cam-slave-go": [[[3, 6], "t9", "(function object)"]], + + "cam-slave-init": [ + [[0, 999], "s6", "camera-slave"], + [[47, 50], "t9", "(function object object)"], + [[54, 58], "t9", "(function object object)"] + ], "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index 67f3e2adf0..c174c11c2a 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -2781,5 +2781,17 @@ } }, + "(anon-function 1 cam-combiner)": { + "vars": { + "pp": ["pp", "process"] + } + }, + + "(anon-function 2 cam-combiner)": { + "vars": { + "a0-3": ["vec", "(pointer vector)"] + } + }, + "aaaaaaaaaaaaaaaaaaaaaaa": {} } diff --git a/goal_src/engine/camera/cam-combiner.gc b/goal_src/engine/camera/cam-combiner.gc index 51d66cb94b..3b248536e1 100644 --- a/goal_src/engine/camera/cam-combiner.gc +++ b/goal_src/engine/camera/cam-combiner.gc @@ -5,3 +5,787 @@ ;; name in dgo: cam-combiner ;; dgos: GAME, ENGINE +;; failed to figure out what this is: +(let + ((v1-0 + (new 'static 'state + :name 'cam-combiner-active + :next #f + :exit #f + :code #f + :trans #f + :post #f + :enter #f + :event #f + ) + ) + ) + (set! cam-combiner-active v1-0) + (set! + (-> v1-0 event) + (the-as + (function process int symbol event-message-block object) + (lambda :behavior camera-combiner + ((arg0 basic) (arg1 int) (arg2 basic) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'point-of-interest) + (the-as none (cond + ((-> arg3 param 0) + (set! + (-> + (the-as camera-slave self) + unknown-symbol + ) + #t + ) + (set! + (-> + (the-as camera-slave self) + view-off + quad + ) + (-> + (the-as vector (-> arg3 param 0)) + quad + ) + ) + (let ((f0-0 1.0)) + (set! + (-> + (the-as camera-slave self) + min-z-override + ) + f0-0 + ) + f0-0 + ) + ) + (else + (set! + (-> + (the-as camera-slave self) + unknown-symbol + ) + #f + ) + (let ((f0-1 0.0)) + (set! + (-> + (the-as camera-slave self) + min-z-override + ) + f0-1 + ) + f0-1 + ) + ) + ) + ) + ) + ((= v1-0 'set-interpolation) + (set! (-> (the-as camera-combiner self) interp-val) 0.0) + (let ((f0-4 (/ 5.0 (the float (-> arg3 param 0))))) + (set! + (-> (the-as camera-combiner self) interp-step) + f0-4 + ) + f0-4 + ) + ) + ((= v1-0 'teleport) + (when + (nonzero? + (-> (the-as camera-combiner self) tracking-status) + ) + (cam-calc-follow! + (-> (the-as camera-combiner self) tracking) + (-> (the-as camera-combiner self) trans) + #f + ) + (slave-set-rotation! + (-> (the-as camera-combiner self) tracking) + (-> (the-as camera-combiner self) trans) + (the-as + float + (-> (the-as camera-combiner self) tracking-options) + ) + (-> (the-as camera-combiner self) fov) + #f + ) + ) + ) + ((= v1-0 'stop-tracking) + (set! + (-> (the-as camera-combiner self) tracking-status) + (the-as uint 0) + ) + 0 + ) + ((= v1-0 'start-tracking) + (cond + ((< arg1 1) + (let ((t9-2 format) + (a0-15 0) + (a1-3 + "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%" + ) + ) + (let ((v1-7 (-> arg3 param 0))) + (rtype-of v1-7) + ) + (t9-2 a0-15 a1-3) + ) + ) + ((let ((t9-3 type-type?) + (v1-8 (-> arg3 param 0)) + ) + (not (t9-3 (rtype-of v1-8) camera-slave)) + ) + (let ((t9-4 format) + (a0-18 0) + (a1-5 + "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%" + ) + (v1-10 (-> arg3 param 0)) + ) + (t9-4 a0-18 a1-5 (rtype-of v1-10)) + ) + ) + ((zero? + (-> (the-as camera-combiner self) tracking-status) + ) + (set! + (-> (the-as camera-combiner self) tracking-status) + (the-as uint 1) + ) + (let ((gp-1 (the-as object (-> arg3 param 0)))) + (set! + (-> (the-as camera-combiner self) tracking-options) + (the-as int (-> (the-as camera-slave gp-1) options)) + ) + (set! + (-> (the-as camera-combiner self) tracking no-follow) + (-> (the-as camera-slave gp-1) tracking no-follow) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + tilt-adjust + ) + (-> (the-as camera-slave gp-1) tracking tilt-adjust) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + underwater-blend + ) + (-> + (the-as camera-slave gp-1) + tracking + underwater-blend + ) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + use-point-of-interest + ) + (-> + (the-as camera-slave gp-1) + tracking + use-point-of-interest + ) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + point-of-interest + quad + ) + (-> + (the-as camera-slave gp-1) + tracking + point-of-interest + quad + ) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + point-of-interest-blend + ) + (-> + (the-as camera-slave gp-1) + tracking + point-of-interest-blend + ) + ) + (let ((gp-2 (+ (the-as uint gp-1) 108))) + (cam-calc-follow! + (-> (the-as camera-combiner self) tracking) + (the-as vector gp-2) + #f + ) + (slave-set-rotation! + (-> (the-as camera-combiner self) tracking) + (the-as vector gp-2) + (the-as + float + (-> (the-as camera-combiner self) tracking-options) + ) + (-> (the-as camera-combiner self) fov) + #f + ) + ) + ) + ) + ) + ) + ((= v1-0 'copy-tracking) + (cond + ((< arg1 1) + (let ((t9-10 format) + (a0-27 0) + (a1-11 + "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%" + ) + ) + (let ((v1-23 (-> arg3 param 0))) + (rtype-of v1-23) + ) + (t9-10 a0-27 a1-11) + ) + ) + ((let ((t9-11 type-type?) + (v1-24 (-> arg3 param 0)) + ) + (not (t9-11 (rtype-of v1-24) camera-slave)) + ) + (let ((t9-12 format) + (a0-30 0) + (a1-13 + "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%" + ) + (v1-25 (-> arg3 param 0)) + ) + (t9-12 a0-30 a1-13 (rtype-of v1-25)) + ) + ) + ((nonzero? + (-> (the-as camera-combiner self) tracking-status) + ) + #f + ) + (else + (set! + (-> (the-as camera-combiner self) tracking-status) + (the-as uint 1) + ) + (let ((gp-3 (the-as camera-slave (-> arg3 param 0)))) + (set! + (-> (the-as camera-combiner self) tracking-options) + (the-as int (-> gp-3 options)) + ) + (set! + (-> (the-as camera-combiner self) tracking no-follow) + (-> gp-3 tracking no-follow) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + tilt-adjust + ) + (-> gp-3 tracking tilt-adjust) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + underwater-blend + ) + (-> gp-3 tracking underwater-blend) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + follow-off + quad + ) + (-> gp-3 tracking follow-off quad) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + follow-pt + quad + ) + (-> gp-3 tracking follow-pt quad) + ) + (let* + ((a2-17 (-> (the-as camera-combiner self) tracking)) + (a3-3 (-> gp-3 tracking)) + (v1-36 (-> a3-3 inv-mat vector 0 quad)) + (a0-37 (-> a3-3 inv-mat vector 1 quad)) + (a1-16 (-> a3-3 inv-mat vector 2 quad)) + (a3-4 (-> a3-3 inv-mat vector 3 quad)) + ) + (set! (-> a2-17 inv-mat vector 0 quad) v1-36) + (set! (-> a2-17 inv-mat vector 1 quad) a0-37) + (set! (-> a2-17 inv-mat vector 2 quad) a1-16) + (set! (-> a2-17 inv-mat vector 3 quad) a3-4) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + use-point-of-interest + ) + (-> gp-3 tracking use-point-of-interest) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + point-of-interest + quad + ) + (-> gp-3 tracking point-of-interest quad) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + point-of-interest-blend + ) + (-> gp-3 tracking point-of-interest-blend) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! + (-> v1-0 code) + (lambda :behavior camera-combiner + () + (local-vars (sv-160 cam-rotation-tracker)) + (while #t + (when + (and + (zero? (logand (-> *camera* master-options) 2)) + (!= (-> self tracking-status) 0) + ) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + (when *camera* + (let ((s5-0 (-> *camera* slave 0)) + (s4-0 (-> *camera* slave 1)) + (f30-0 (parameter-ease-sin-clamp (-> self interp-val))) + (gp-0 (new-stack-vector0)) + ) + (set! (-> gp-0 quad) (-> self trans quad)) + (when s5-0 + (cond + (s4-0 + (vector-lerp-clamp! + (-> self trans) + (-> s5-0 0 trans) + (-> s4-0 0 trans) + f30-0 + ) + (set! + (-> self fov) + (lerp-clamp (-> s5-0 0 fov) (-> s4-0 0 fov) f30-0) + ) + (set! + (-> self dist-from-src) + (vector-vector-distance (-> self trans) (-> s5-0 0 trans)) + ) + (set! + (-> self dist-from-dest) + (vector-vector-distance (-> self trans) (-> s4-0 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) + #t + ) + (let* ((a2-4 (-> self inv-camera-rot)) + (a3-2 (-> self tracking)) + (v1-20 (-> a3-2 inv-mat vector 0 quad)) + (a0-10 (-> a3-2 inv-mat vector 1 quad)) + (a1-6 (-> a3-2 inv-mat vector 2 quad)) + (a3-3 (-> a3-2 inv-mat vector 3 quad)) + ) + (set! (-> a2-4 vector 0 quad) v1-20) + (set! (-> a2-4 vector 1 quad) a0-10) + (set! (-> a2-4 vector 2 quad) a1-6) + (set! (-> a2-4 vector 3 quad) a3-3) + ) + ) + (else + (set! sv-160 (-> s5-0 0 tracking)) + (let ((s2-0 (-> s5-0 0 trans)) + (s5-1 (-> s4-0 0 tracking)) + (s0-0 (-> s4-0 0 trans)) + ) + (cond + ((= (-> self tracking-status) 3) + (cam-calc-follow! (-> self tracking) s2-0 #t) + (slave-set-rotation! + (-> self tracking) + s2-0 + (the-as float (-> self tracking-options)) + (-> self fov) + #t + ) + (set! sv-160 (-> self tracking)) + (set! s2-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! s5-1 (-> self tracking)) + (set! s0-0 (-> self trans)) + ) + ) + (let ((s1-0 (new 'stack-no-clear 'matrix))) + (dotimes (v1-35 3) + (set! (-> s1-0 vector v1-35 quad) (the-as uint128 0)) + ) + 0.0 + 0.0 + 0.0 + (let ((s4-1 (new-stack-vector0))) + 0.0 + (let ((s3-0 (new-stack-matrix0))) + (vector-! + (the-as vector (-> s1-0 vector)) + (the-as vector (-> sv-160 inv-mat)) + (the-as vector (-> s5-1 inv-mat)) + ) + (vector-! + (-> s1-0 vector 1) + (-> sv-160 inv-mat vector 1) + (-> s5-1 inv-mat vector 1) + ) + (vector-! + (-> s1-0 vector 2) + (-> sv-160 inv-mat vector 2) + (-> s5-1 inv-mat vector 2) + ) + (let ((f26-0 (vector-length (the-as vector (-> s1-0 vector)))) + (f28-0 (vector-length (-> s1-0 vector 1))) + (f0-13 (vector-length (-> s1-0 vector 2))) + ) + (cond + ((and (< f26-0 f28-0) (< f26-0 f0-13)) + (vector-cross! s4-1 (-> s1-0 vector 1) (-> s1-0 vector 2)) + ) + ((and (< f28-0 f26-0) (< f28-0 f0-13)) + (vector-cross! + s4-1 + (the-as vector (-> s1-0 vector)) + (-> s1-0 vector 2) + ) + ) + (else + (vector-cross! + s4-1 + (the-as vector (-> s1-0 vector)) + (-> s1-0 vector 1) + ) + ) + ) + ) + (vector-normalize! s4-1 1.0) + (let + ((f0-16 + (fabs (vector-dot (the-as vector (-> sv-160 inv-mat)) s4-1)) + ) + (f1-2 (fabs (vector-dot (-> sv-160 inv-mat vector 1) s4-1))) + (f2-2 (fabs (vector-dot (-> sv-160 inv-mat vector 2) s4-1))) + ) + (cond + ((and (< f0-16 f1-2) (< f0-16 f2-2)) + (vector-flatten! + (the-as vector (-> s1-0 vector)) + (the-as vector (-> sv-160 inv-mat)) + s4-1 + ) + (vector-flatten! + (-> s1-0 vector 1) + (the-as vector (-> s5-1 inv-mat)) + s4-1 + ) + ) + ((< f1-2 f2-2) + (vector-flatten! + (the-as vector (-> s1-0 vector)) + (-> sv-160 inv-mat vector 1) + s4-1 + ) + (vector-flatten! + (-> s1-0 vector 1) + (-> s5-1 inv-mat vector 1) + s4-1 + ) + ) + (else + (vector-flatten! + (the-as vector (-> s1-0 vector)) + (-> sv-160 inv-mat vector 2) + s4-1 + ) + (vector-flatten! + (-> s1-0 vector 1) + (-> s5-1 inv-mat vector 2) + s4-1 + ) + ) + ) + ) + (vector-normalize! (the-as vector (-> s1-0 vector)) 1.0) + (vector-normalize! (-> s1-0 vector 1) 1.0) + (vector-cross! + (-> s1-0 vector 2) + (the-as vector (-> s1-0 vector)) + (-> s1-0 vector 1) + ) + (if (< (vector-dot (-> s1-0 vector 2) s4-1) 0.0) + (vector-negate! s4-1 s4-1) + ) + (let + ((f28-1 + (acos + (vector-dot + (the-as vector (-> s1-0 vector)) + (-> s1-0 vector 1) + ) + ) + ) + ) + (cond + ((logtest? (-> *camera* master-options) 8) + (set! + (-> *camera* master-options) + (logand -25 (-> *camera* master-options)) + ) + (when + (and + (< 8192.0 f28-1) + (nonzero? (logand (-> *camera* master-options) 2)) + ) + (vector-! + (the-as vector (-> s1-0 vector)) + (-> *camera* tpos-curr) + s2-0 + ) + (vector-! (-> s1-0 vector 1) s0-0 s2-0) + (vector-flatten! + (the-as vector (-> s1-0 vector)) + (the-as vector (-> s1-0 vector)) + (-> *camera* local-down) + ) + (vector-flatten! + (-> s1-0 vector 1) + (-> s1-0 vector 1) + (-> *camera* local-down) + ) + (when + (and + (< + 4096.0 + (vector-normalize-ret-len! + (the-as vector (-> s1-0 vector)) + 1.0 + ) + ) + (< + 4096.0 + (vector-normalize-ret-len! (-> s1-0 vector 1) 1.0) + ) + ) + (vector-cross! + (-> s1-0 vector 2) + (-> s1-0 vector 1) + (the-as vector (-> s1-0 vector)) + ) + (when (< (vector-dot (-> s1-0 vector 2) s4-1) -0.01) + ) + ) + ) + ) + ((and + (< 16384.0 f28-1) + (< (vector-dot (-> self flip-control-axis) s4-1) 0.0) + ) + (set! + (-> *camera* master-options) + (logxor (-> *camera* master-options) 16) + ) + ) + ) + (set! (-> self flip-control-axis quad) (-> s4-1 quad)) + (when (logtest? (-> *camera* master-options) 16) + (set! f28-1 (- 65536.0 f28-1)) + (vector-negate! s4-1 s4-1) + ) + (let ((f30-1 (* f28-1 (- 1.0 f30-0)))) + (matrix-axis-sin-cos! s3-0 s4-1 (sin f30-1) (cos f30-1)) + ) + ) + (matrix*! (-> self inv-camera-rot) (the-as matrix s5-1) s3-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) (-> *display* time-adjust-ratio)) + ) + ) + ) + (when (>= (-> self interp-val) 1.0) + (deactivate (-> *camera* slave 0 0)) + (set! (-> *camera* slave 0) (-> *camera* slave 1)) + (set! (-> *camera* slave 1) (the-as (pointer camera-slave) #f)) + (+! (-> *camera* num-slaves) -1) + ) + ) + (else + (set! (-> self dist-from-src) 409600.0) + (set! (-> self dist-from-dest) 0.0) + (set! (-> self trans quad) (-> s5-0 0 trans quad)) + (set! (-> self fov) (-> s5-0 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) + #t + ) + (let* ((v1-143 (-> self inv-camera-rot)) + (a3-8 (-> self tracking)) + (a0-80 (-> a3-8 inv-mat vector 0 quad)) + (a1-45 (-> a3-8 inv-mat vector 1 quad)) + (a2-21 (-> a3-8 inv-mat vector 2 quad)) + (a3-9 (-> a3-8 inv-mat vector 3 quad)) + ) + (set! (-> v1-143 vector 0 quad) a0-80) + (set! (-> v1-143 vector 1 quad) a1-45) + (set! (-> v1-143 vector 2 quad) a2-21) + (set! (-> v1-143 vector 3 quad) a3-9) + ) + ) + (else + (let* ((v1-144 (-> self inv-camera-rot)) + (a3-10 (-> s5-0 0 tracking)) + (a0-82 (-> a3-10 inv-mat vector 0 quad)) + (a1-46 (-> a3-10 inv-mat vector 1 quad)) + (a2-22 (-> a3-10 inv-mat vector 2 quad)) + (a3-11 (-> a3-10 inv-mat vector 3 quad)) + ) + (set! (-> v1-144 vector 0 quad) a0-82) + (set! (-> v1-144 vector 1 quad) a1-46) + (set! (-> v1-144 vector 2 quad) a2-22) + (set! (-> v1-144 vector 3 quad) a3-11) + ) + ) + ) + ) + ) + ) + (vector-! (-> self velocity) (-> self trans) gp-0) + ) + ) + (if (and *dproc* *debug-segment*) + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'camera + (new 'static 'rgba :b #xff :a #x80) + ) + ) + (suspend) + ) + (none) + ) + ) + ) + +;; definition for function cam-combiner-init +;; INFO: Return type mismatch int vs none. +(defbehavior cam-combiner-init camera-combiner () + (stack-size-set! (-> self main-thread) 512) + (set! *camera-combiner* self) + (vector-reset! (-> self trans)) + (matrix-identity! (-> self inv-camera-rot)) + (if *math-camera* + (set! (-> self fov) (-> *math-camera* fov)) + (set! (-> self fov) 11650.845) + ) + (set! (-> self interp-val) 0.0) + (set! (-> self interp-step) 0.125) + (set! (-> self tracking-status) (the-as uint 0)) + (vector-reset! (-> self velocity)) + (let ((t9-2 (the-as (function object) enter-state))) + (set! (-> self next-state) cam-combiner-active) + (t9-2) + ) + 0 + (none) + ) diff --git a/goal_src/engine/camera/cam-master.gc b/goal_src/engine/camera/cam-master.gc index bc4ac4e18e..563e3793c0 100644 --- a/goal_src/engine/camera/cam-master.gc +++ b/goal_src/engine/camera/cam-master.gc @@ -4,4 +4,3 @@ ;; name: cam-master.gc ;; name in dgo: cam-master ;; dgos: GAME, ENGINE - diff --git a/goal_src/engine/camera/cam-start.gc b/goal_src/engine/camera/cam-start.gc index 535947d36f..5bedbea90e 100644 --- a/goal_src/engine/camera/cam-start.gc +++ b/goal_src/engine/camera/cam-start.gc @@ -5,3 +5,71 @@ ;; name in dgo: cam-start ;; dgos: GAME, ENGINE +;; 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) + (let ((v0-3 cam-string)) + (set! *camera-base-mode* v0-3) + v0-3 + ) + ) + +;; definition for function cam-start +;; INFO: Return type mismatch int vs none. +(defun cam-start ((arg0 symbol)) + (cam-stop) + (let ((s5-0 (get-process *camera-dead-pool* camera-combiner #x4000))) + (when s5-0 + (let ((t9-2 (method-of-type camera-combiner activate))) + (t9-2 + (the-as camera-combiner s5-0) + *camera-pool* + 'camera-combiner + (the-as pointer #x70004000) + ) + ) + ((the-as (function process object function) run-function-in-process) + s5-0 + cam-combiner-init + ) + (-> s5-0 ppointer) + ) + ) + (let* ((s5-1 (get-process *camera-master-dead-pool* camera-master #x4000)) + (v1-5 (when s5-1 + (let ((t9-5 (method-of-type camera-master activate))) + (t9-5 + (the-as camera-master s5-1) + *camera-pool* + 'camera-master + (the-as pointer #x70004000) + ) + ) + ((the-as (function process object function) set-to-run) + (the-as process (-> s5-1 main-thread)) + cam-master-init + ) + (-> s5-1 ppointer) + ) + ) + ) + (set! *camera* (the-as camera-master (if v1-5 + (-> v1-5 0 self) + ) + ) + ) + ) + (if arg0 + (reset-cameras) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +;; TODO - causes a crash in the tests! +; (cam-start #f) diff --git a/goal_src/engine/camera/cam-states.gc b/goal_src/engine/camera/cam-states.gc index f515cc6206..12c50abbef 100644 --- a/goal_src/engine/camera/cam-states.gc +++ b/goal_src/engine/camera/cam-states.gc @@ -5,3 +5,6 @@ ;; name in dgo: cam-states ;; dgos: GAME, ENGINE +;; TODO - for cam-start +(define-extern cam-string state) +(define-extern *camera-base-mode* state) diff --git a/goal_src/engine/camera/cam-update-h.gc b/goal_src/engine/camera/cam-update-h.gc index 9fac4200d9..8e61bc1c67 100644 --- a/goal_src/engine/camera/cam-update-h.gc +++ b/goal_src/engine/camera/cam-update-h.gc @@ -14,3 +14,8 @@ (define-perm *camera-other-matrix* matrix (matrix-identity! (new 'global 'matrix))) (define-perm *camera-smush-control* smush-control (set-zero! (new 'global 'smush-control))) (define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector))) + + +;; TODO - actually defined in cam-states-dbg +(define-extern cam-free-floating-move (function matrix vector vector int vector)) +(define-extern cam-free-floating-input (function vector vector symbol int vector)) diff --git a/goal_src/engine/camera/cam-update.gc b/goal_src/engine/camera/cam-update.gc index 519e6560fa..3200e2ab5d 100644 --- a/goal_src/engine/camera/cam-update.gc +++ b/goal_src/engine/camera/cam-update.gc @@ -5,3 +5,665 @@ ;; name in dgo: cam-update ;; dgos: GAME, ENGINE +;; 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 +;; Used lq/sq +(defun + update-view-planes + ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float)) + (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) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 hither-top-right) + (-> s5-0 hither-top-right) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 hither-bottom-left) + (-> s5-0 hither-bottom-left) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 hither-bottom-right) + (-> s5-0 hither-bottom-right) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 yon-top-left) + (-> s5-0 yon-top-left) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 yon-top-right) + (-> s5-0 yon-top-right) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 yon-bottom-left) + (-> s5-0 yon-bottom-left) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 yon-bottom-right) + (-> s5-0 yon-bottom-right) + (-> arg0 inv-camera-rot) + ) + (let ((s2-0 (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-5 (-> arg0 inv-camera-rot vector 3 quad))) + (set! (-> sv-240 quad) v1-5) + ) + (vector-! s2-0 (-> 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-0 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-0 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 +(defun update-visible ((arg0 math-camera)) + (local-vars (a0-16 symbol) (s3-0 level-vis-info) (s4-0 level-vis-info)) + (when (not *artist-fix-visible*) + (dotimes (s5-0 (-> *level* length)) + (let ((v1-4 (-> *level* level s5-0))) + (when (= (-> v1-4 status) 'active) + (if + (and + (nonzero? (-> v1-4 bsp nodes)) + (or *update-leaf-when-outside-bsp* (-> v1-4 inside-boxes?)) + ) + (bsp-camera-asm (-> v1-4 bsp) (-> arg0 trans)) + ) + ) + ) + ) + (dotimes (gp-1 (-> *level* length)) + (let ((s5-1 (-> *level* level gp-1))) + (when (= (-> s5-1 status) 'active) + (let ((a2-0 (/ (+ (-> s5-1 bsp visible-list-length) 15) 16))) + (set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?) + (-> s5-1 all-visible?) + #t + ) + ) + (cond + ((or (not (-> s5-1 force-all-visible?)) (-> s5-1 inside-boxes?)) + (cond + ((or *artist-all-visible* (zero? (-> s5-1 bsp nodes))) + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) + ) + ((begin + (set! s4-0 (-> s5-1 vis-info (-> s5-1 vis-self-index))) + (set! s3-0 (-> s5-1 vis-info (-> s5-1 vis-adj-index))) + (let ((v1-32 #f)) + (set! a0-16 #f) + (when s4-0 + (set! v1-32 (nonzero? (logand (shl #x8000 16) (-> s4-0 flags)))) + (if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx)) + (set! v1-32 #f) + ) + ) + (when s3-0 + (set! a0-16 (nonzero? (logand (shl #x8000 16) (-> s3-0 flags)))) + (if (< (-> s3-0 length) (-> s3-0 from-bsp current-leaf-idx)) + (set! a0-16 #f) + ) + ) + v1-32 + ) + ) + (if (!= (-> s5-1 all-visible?) 'loading) + (set! (-> s5-1 all-visible?) #f) + ) + (let* ((a0-19 s5-1) + (t9-2 (method-of-object a0-19 dummy-16)) + (a1-17 s4-0) + (a2-1 (-> s4-0 ramdisk)) + ) + (-> s4-0 string-block) + (when (t9-2 a0-19 (the-as uint a1-17) a2-1) + (countdown (v1-40 8) + (let ((a0-22 (-> s5-1 vis-info v1-40))) + (when a0-22 + (if (!= a0-22 s4-0) + (set! (-> a0-22 current-vis-string) (the-as uint -1)) + ) + ) + ) + ) + (set! (-> s5-1 all-visible?) #f) + ) + ) + ) + (a0-16 + (if (!= (-> s5-1 all-visible?) 'loading) + (set! (-> s5-1 all-visible?) #f) + ) + (let* ((a0-24 s5-1) + (t9-3 (method-of-object a0-24 dummy-16)) + (a1-21 s3-0) + (a2-2 (-> s3-0 ramdisk)) + ) + (-> s3-0 string-block) + (when (t9-3 a0-24 (the-as uint a1-21) a2-2) + (countdown (v1-50 8) + (let ((a0-27 (-> s5-1 vis-info v1-50))) + (when a0-27 + (if (!= a0-27 s3-0) + (set! (-> a0-27 current-vis-string) (the-as uint -1)) + ) + ) + ) + ) + (set! (-> s5-1 all-visible?) #f) + ) + ) + ) + ((and (= (-> s5-1 all-visible?) 'loading) (-> *level* play?)) + ) + (else + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) + ) + ) + ) + (else + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) + ) + ) + ) + (if (and *stats-bsp* (= *master-mode* 'game)) + (format *stdcon* "~0kleaf-index = ~d~%" (-> s5-1 bsp current-leaf-idx)) + ) + ) + ) + ) + #f + ) + ) + +;; 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 +;; 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 + ((s4-1 + (vector-negate-in-place! + (vector-normalize-copy! + (new-stack-vector0) + (-> *standard-dynamics* gravity) + 1.0 + ) + ) + ) + ) + (if (= (vector-length s4-1) 0.0) + (set! (-> s4-1 y) -1.0) + ) + (if (logtest? *external-cam-options* 1) + (set! s4-1 (the-as vector #f)) + ) + (cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) s4-1 s5-0) + ) + ) + ) + (let* ((a2-2 (-> *math-camera* inv-camera-rot)) + (a3-1 *save-camera-inv-rot*) + (v1-11 (-> a3-1 vector 0 quad)) + (a0-14 (-> a3-1 vector 1 quad)) + (a1-2 (-> a3-1 vector 2 quad)) + (a3-2 (-> a3-1 vector 3 quad)) + ) + (set! (-> a2-2 vector 0 quad) v1-11) + (set! (-> a2-2 vector 1 quad) a0-14) + (set! (-> a2-2 vector 2 quad) a1-2) + (set! (-> a2-2 vector 3 quad) a3-2) + ) + arg0 + ) + +;; 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 +;; Used lq/sq +(defun update-camera () + (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 + ) + (dotimes (gp-1 2) + (let ((s5-1 (-> *level* level gp-1))) + (when (!= (-> s5-1 status) 'inactive) + (let ((a0-14 (new-stack-vector0))) + (vector-! + a0-14 + (the-as vector (-> s5-1 info bsphere)) + (-> *math-camera* trans) + ) + (set! + (-> s5-1 level-distance) + (fmax 0.0 (- (vector-length a0-14) (-> s5-1 info bsphere w))) + ) + ) + (when *display-level-spheres* + (add-debug-sphere + #t + (bucket-id debug-draw1) + (-> s5-1 info bsphere) + (-> s5-1 info bsphere w) + (new 'static 'rgba :r #xff :a #x80) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (* 0.00024414062 (-> s5-1 info bsphere x)) + (* 0.00024414062 (-> s5-1 info bsphere y)) + (* 0.00024414062 (-> s5-1 info bsphere z)) + (* 0.00024414062 (-> s5-1 info bsphere w)) + ) + ) + ) + ) + ) + (update-math-camera + *math-camera* + (-> *setting-control* current video-mode) + (-> *setting-control* current aspect-ratio) + ) + (update! *camera-smush-control*) + (cond + ((or (= *master-mode* 'pause) (= *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 + ) + ) + (cond + (*external-cam-mode* + (move-camera-from-pad *math-camera*) + ) + ((nonzero? *camera-look-through-other*) + (set! (-> *math-camera* fov) (-> *camera-other-fov* data)) + (set! (-> *math-camera* trans quad) (-> *camera-other-trans* quad)) + (+! (-> *math-camera* trans y) (get-no-update *camera-smush-control*)) + (let* ((a2-9 (-> *math-camera* inv-camera-rot)) + (a3-4 *camera-other-matrix*) + (v1-86 (-> a3-4 vector 0 quad)) + (a0-29 (-> a3-4 vector 1 quad)) + (a1-10 (-> a3-4 vector 2 quad)) + (a3-5 (-> a3-4 vector 3 quad)) + ) + (set! (-> a2-9 vector 0 quad) v1-86) + (set! (-> a2-9 vector 1 quad) a0-29) + (set! (-> a2-9 vector 2 quad) a1-10) + (set! (-> a2-9 vector 3 quad) a3-5) + ) + (let* ((a2-10 *save-camera-inv-rot*) + (a3-6 *camera-other-matrix*) + (v1-87 (-> a3-6 vector 0 quad)) + (a0-30 (-> a3-6 vector 1 quad)) + (a1-11 (-> a3-6 vector 2 quad)) + (a3-7 (-> a3-6 vector 3 quad)) + ) + (set! (-> a2-10 vector 0 quad) v1-87) + (set! (-> a2-10 vector 1 quad) a0-30) + (set! (-> a2-10 vector 2 quad) a1-11) + (set! (-> a2-10 vector 3 quad) a3-7) + ) + ) + ((and *camera-combiner* (not *external-cam-mode*)) + (set! (-> *math-camera* fov) (-> *camera-combiner* fov)) + (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad)) + (+! (-> *math-camera* trans y) (get-no-update *camera-smush-control*)) + (let* ((v1-100 (-> *math-camera* inv-camera-rot)) + (a3-8 (-> *camera-combiner* inv-camera-rot)) + (a0-36 (-> a3-8 vector 0 quad)) + (a1-12 (-> a3-8 vector 1 quad)) + (a2-11 (-> a3-8 vector 2 quad)) + (a3-9 (-> a3-8 vector 3 quad)) + ) + (set! (-> v1-100 vector 0 quad) a0-36) + (set! (-> v1-100 vector 1 quad) a1-12) + (set! (-> v1-100 vector 2 quad) a2-11) + (set! (-> v1-100 vector 3 quad) a3-9) + ) + (let* ((v1-101 *save-camera-inv-rot*) + (a3-10 (-> *camera-combiner* inv-camera-rot)) + (a0-38 (-> a3-10 vector 0 quad)) + (a1-13 (-> a3-10 vector 1 quad)) + (a2-12 (-> a3-10 vector 2 quad)) + (a3-11 (-> a3-10 vector 3 quad)) + ) + (set! (-> v1-101 vector 0 quad) a0-38) + (set! (-> v1-101 vector 1 quad) a1-13) + (set! (-> v1-101 vector 2 quad) a2-12) + (set! (-> v1-101 vector 3 quad) a3-11) + ) + ) + (else + (move-camera-from-pad *math-camera*) + ) + ) + (matrix-transpose! + (-> *math-camera* camera-rot) + (-> *math-camera* inv-camera-rot) + ) + (cond + (*camera-no-mip-correction* + (set! (-> *math-camera* fov-correction-factor) 1.0) + ) + (else + (let ((f0-28 (fmin 11650.845 (-> *math-camera* fov)))) + (set! (-> *math-camera* fov-correction-factor) (* 0.00008583069 f0-28)) + ) + ) + ) + (if (< 0.0 (-> *math-camera* smooth-t)) + (set! + (-> *math-camera* smooth-t) + (- (-> *math-camera* smooth-t) (-> *math-camera* smooth-step)) + ) + ) + (cond + ((< 0.0 (-> *math-camera* smooth-t)) + (let ((gp-2 (new-stack-quaternion0))) + (matrix->quaternion gp-2 (-> *math-camera* inv-camera-rot)) + (quaternion-slerp! + gp-2 + gp-2 + (-> *math-camera* inv-camera-rot-smooth-from) + (-> *math-camera* smooth-t) + ) + (quaternion->matrix (-> *math-camera* inv-camera-rot-smooth) gp-2) + ) + ) + (else + (let* ((v1-124 (-> *math-camera* inv-camera-rot-smooth)) + (a3-13 (-> *math-camera* inv-camera-rot)) + (a0-45 (-> a3-13 vector 0 quad)) + (a1-18 (-> a3-13 vector 1 quad)) + (a2-14 (-> a3-13 vector 2 quad)) + (a3-14 (-> a3-13 vector 3 quad)) + ) + (set! (-> v1-124 vector 0 quad) a0-45) + (set! (-> v1-124 vector 1 quad) a1-18) + (set! (-> v1-124 vector 2 quad) a2-14) + (set! (-> v1-124 vector 3 quad) a3-14) + ) + ) + ) + (if (and (!= *master-mode* 'menu) *display-camera-info*) + (format + *stdcon* + "cam pos ~M ~M ~M~%" + (-> *math-camera* trans x) + (-> *math-camera* trans y) + (-> *math-camera* trans z) + ) + ) + (when (zero? (-> *math-camera* reset)) + (let* ((v1-136 (-> *math-camera* prev-camera-temp)) + (a3-16 (-> *math-camera* camera-temp)) + (a0-50 (-> a3-16 vector 0 quad)) + (a1-20 (-> a3-16 vector 1 quad)) + (a2-16 (-> a3-16 vector 2 quad)) + (a3-17 (-> a3-16 vector 3 quad)) + ) + (set! (-> v1-136 vector 0 quad) a0-50) + (set! (-> v1-136 vector 1 quad) a1-20) + (set! (-> v1-136 vector 2 quad) a2-16) + (set! (-> v1-136 vector 3 quad) a3-17) + ) + ) + (let ((gp-3 (-> *math-camera* camera-temp)) + (s4-1 (-> *math-camera* camera-rot)) + (s5-2 (-> *math-camera* inv-camera-rot)) + (s3-0 (-> *math-camera* trans)) + ) + (let ((s2-0 (new-stack-vector0))) + (set! (-> s2-0 x) (- (-> s3-0 x))) + (set! (-> s2-0 y) (- (-> s3-0 y))) + (set! (-> s2-0 z) (- (-> s3-0 z))) + (set! (-> s2-0 w) 1.0) + (vector-matrix*! s2-0 s2-0 s4-1) + (set! (-> s4-1 vector 3 quad) (-> s2-0 quad)) + ) + (matrix*! gp-3 s4-1 (-> *math-camera* perspective)) + (set! (-> s5-2 vector 3 quad) (-> s3-0 quad)) + ) + (when (nonzero? (-> *math-camera* reset)) + (let* ((v1-148 (-> *math-camera* prev-camera-temp)) + (a3-18 (-> *math-camera* camera-temp)) + (a0-54 (-> a3-18 vector 0 quad)) + (a1-23 (-> a3-18 vector 1 quad)) + (a2-19 (-> a3-18 vector 2 quad)) + (a3-19 (-> a3-18 vector 3 quad)) + ) + (set! (-> v1-148 vector 0 quad) a0-54) + (set! (-> v1-148 vector 1 quad) a1-23) + (set! (-> v1-148 vector 2 quad) a2-19) + (set! (-> v1-148 vector 3 quad) a3-19) + ) + (set! (-> *math-camera* reset) 0) + 0 + ) + (let ((f0-45 (-> *math-camera* fog-min)) + (f1-10 (-> *math-camera* fog-max)) + ) + (let ((f2-0 (-> *math-camera* d))) + (set! (-> *instance-tie-work* hmge-d x) f0-45) + (set! (-> *instance-tie-work* hmge-d y) f1-10) + (set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0)) + (set! + (-> *instance-tie-work* hmge-d w) + (* f2-0 (-> *math-camera* hmge-scale w)) + ) + (let ((v1-160 (-> *math-camera* hvdf-off quad))) + (set! (-> *instance-tie-work* hvdf-offset quad) v1-160) + ) + (set! (-> *instance-shrub-work* hmge-d x) f0-45) + (set! (-> *instance-shrub-work* hmge-d y) f1-10) + (set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0)) + (set! + (-> *instance-shrub-work* hmge-d w) + (* f2-0 (-> *math-camera* hmge-scale w)) + ) + (set! + (-> *instance-shrub-work* billboard-const x) + (/ (-> *math-camera* x-pix) (* f2-0 (-> *math-camera* x-ratio))) + ) + (set! + (-> *instance-shrub-work* billboard-const y) + (/ (-> *math-camera* y-pix) (* f2-0 (-> *math-camera* y-ratio))) + ) + ) + (set! (-> *instance-shrub-work* billboard-const z) f0-45) + (set! (-> *instance-shrub-work* billboard-const w) f1-10) + ) + (set! + (-> *instance-shrub-work* constants w) + (the-as float (-> *math-camera* vis-gifs 0 fog0)) + ) + (let ((a0-56 (-> *math-camera* hvdf-off quad))) + (set! (-> *instance-shrub-work* hvdf-offset quad) a0-56) + ) + (update-view-planes *math-camera* (-> *math-camera* plane) 1.0) + (update-view-planes *math-camera* (-> *math-camera* guard-plane) 4.0) + (set! + (-> *instance-shrub-work* guard-plane 0 quad) + (-> *math-camera* guard-plane 0 quad) + ) + (set! + (-> *instance-shrub-work* guard-plane 1 quad) + (-> *math-camera* guard-plane 1 quad) + ) + (set! + (-> *instance-shrub-work* guard-plane 2 quad) + (-> *math-camera* guard-plane 2 quad) + ) + (set! + (-> *instance-shrub-work* guard-plane 3 quad) + (-> *math-camera* guard-plane 3 quad) + ) + (set! + (-> *instance-tie-work* guard-plane 0 quad) + (-> *math-camera* guard-plane 0 quad) + ) + (set! + (-> *instance-tie-work* guard-plane 1 quad) + (-> *math-camera* guard-plane 1 quad) + ) + (set! + (-> *instance-tie-work* guard-plane 2 quad) + (-> *math-camera* guard-plane 2 quad) + ) + (set! + (-> *instance-tie-work* guard-plane 3 quad) + (-> *math-camera* guard-plane 3 quad) + ) + (update-visible *math-camera*) + (if (not (paused?)) + (update-wind *wind-work* *wind-scales*) + ) + #f + ) + + + + diff --git a/goal_src/engine/camera/camera-h.gc b/goal_src/engine/camera/camera-h.gc index 9f7c63518a..4671277892 100644 --- a/goal_src/engine/camera/camera-h.gc +++ b/goal_src/engine/camera/camera-h.gc @@ -41,16 +41,17 @@ ;; definition of type cam-index (deftype cam-index (structure) ((flags uint32 :offset-assert 0) - (vec uint128 2 :offset-assert 16) + (vec vector 2 :inline :offset 16) ) :method-count-assert 11 :size-assert #x30 :flag-assert #xb00000030 (:methods - (dummy-9 () none 9) - (dummy-10 () none 10) - ) + (dummy-9 (_type_ symbol entity vector curve) symbol 9) + (dummy-10 (_type_ vector) float 10) ; inlined vector-dot issue? + ) ) + ;; definition of type tracking-point (deftype tracking-point (structure) ((position vector :inline :offset-assert 0) @@ -76,41 +77,41 @@ ;; definition of type tracking-spline (deftype tracking-spline (structure) - ((point tracking-point 32 :inline :offset-assert 0) - (summed-len float :offset-assert 1536) - (free-point int32 :offset-assert 1540) - (used-point int32 :offset-assert 1544) - (partial-point float :offset-assert 1548) - (end-point int32 :offset-assert 1552) - (next-to-last-point int32 :offset-assert 1556) - (max-move float :offset-assert 1560) - (sample-len float :offset-assert 1564) - (used-count int32 :offset-assert 1568) - (old-position vector :inline :offset-assert 1584) - (debug-old-position vector :inline :offset-assert 1600) - (debug-out-position vector :inline :offset-assert 1616) - (debug-last-point int32 :offset-assert 1632) + ((point tracking-point 32 :inline :offset-assert 0) + (summed-len float :offset-assert 1536) + (free-point int32 :offset-assert 1540) + (used-point int32 :offset-assert 1544) + (partial-point float :offset-assert 1548) + (end-point int32 :offset-assert 1552) + (next-to-last-point int32 :offset-assert 1556) + (max-move float :offset-assert 1560) + (sample-len float :offset-assert 1564) + (used-count int32 :offset-assert 1568) + (old-position vector :inline :offset-assert 1584) + (debug-old-position vector :inline :offset-assert 1600) + (debug-out-position vector :inline :offset-assert 1616) + (debug-last-point int32 :offset-assert 1632) ) :method-count-assert 24 :size-assert #x664 :flag-assert #x1800000664 (:methods - (dummy-9 () none 9) - (dummy-10 () none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) - (dummy-20 () none 20) - (dummy-21 () none 21) - (dummy-22 () none 22) - (dummy-23 () none 23) - ) + (TODO-RENAME-9 (_type_) none 9) + (TODO-RENAME-10 (_type_ vector) none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (TODO-RENAME-13 (_type_ int) none 13) + (TODO-RENAME-14 (_type_ vector) none 14) + (TODO-RENAME-15 (_type_) none 15) + (TODO-RENAME-16 (_type_ float) none 16) + (TODO-RENAME-17 (_type_ vector float float symbol) int 17) ; - return value is actually none but they do a manual `return` + (TODO-RENAME-18 (_type_ float vector tracking-spline-sampler) vector 18) + (TODO-RENAME-19 (_type_ float vector tracking-spline-sampler) vector 19) + (TODO-RENAME-20 (_type_ vector int) none 20) + (TODO-RENAME-21 (_type_ vector float float) vector 21) + (TODO-RENAME-22 (_type_ float) none 22) + (dummy-23 () none 23) + ) ) ;; cam-float-seeker moves value toward target in a smooth way, with second order dynamics. @@ -309,13 +310,14 @@ ;; definition of type camera-slave (deftype camera-slave (process) - ((trans vector :inline :offset-assert 112) + ((trans vector :score 999 :inline :offset-assert 112) (fov float :offset-assert 128) (fov0 float :offset-assert 132) (fov1 float :offset-assert 136) (fov-index cam-index :inline :offset-assert 144) (tracking cam-rotation-tracker :inline :offset-assert 192) (view-off-param float :offset-assert 400) + (unknown-symbol symbol :offset 412) ;; from - cam-combiner::lambda2 - I'm convinced `camera-slave` is the only matching process in this case (view-off vector :inline :offset-assert 416) (min-z-override float :offset-assert 432) (view-flat vector :inline :offset-assert 448) @@ -328,7 +330,7 @@ (max-angle-offset float :offset-assert 2192) (max-angle-curr float :offset-assert 2196) (options uint32 :offset-assert 2200) - (cam-entity basic :offset-assert 2204) + (cam-entity entity :offset-assert 2204) ; not totally confirmed yet, could be entity-actor (velocity vector :inline :offset-assert 2208) (desired-pos vector :inline :offset-assert 2224) (time-dist-too-far uint32 :offset-assert 2240) @@ -350,7 +352,7 @@ (spline-tt float :offset-assert 2480) (spline-follow-dist float :offset-assert 2484) (change-event-from uint32 :offset-assert 2488) - (enter-has-run basic :offset-assert 2492) + (enter-has-run symbol :offset-assert 2492) (blend-from-type uint64 :offset-assert 2496) (blend-to-type uint64 :offset-assert 2504) (have-phony-joystick basic :offset-assert 2512) @@ -364,17 +366,18 @@ :method-count-assert 14 :size-assert #xa04 :flag-assert #xe09a00a04 + ;; inherited inspect of process ) ;; definition of type camera-master (deftype camera-master (process) ((master-options uint32 :offset-assert 112) (num-slaves int32 :offset-assert 116) - (slave basic 2 :offset-assert 120) + (slave (pointer camera-slave) 2 :offset-assert 120) (slave-options uint32 :offset-assert 128) (view-off-param-save float :offset-assert 132) (changer uint32 :offset-assert 136) - (cam-entity basic :offset-assert 140) + (cam-entity entity :offset-assert 140) ; not totally confirmed yet (stringMinLength float :offset-assert 144) (stringMaxLength float :offset-assert 148) (stringMinHeight float :offset-assert 152) @@ -426,4 +429,21 @@ :method-count-assert 14 :size-assert #x964 :flag-assert #xe09000964 + ;; inherited inspect of process ) + +;; TODO - for camera +(define-extern cam-circular state) +(define-extern cam-standoff-read-entity state) +(define-extern cam-spline state) +(define-extern *camera-base-mode* state) +(define-extern cam-fixed-read-entity state) +(define-extern camera-line-rel-len (function tracking-point vector float rgba none)) +(define-extern camera-slave-debug (function object object object object object)) ;; passed to engine::method-15 +(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)) +;; TODO - for cam-combiner +(define-extern cam-combiner-active state) +(define-extern paused? (function symbol)) +;; TODO - for cam-start +(define-extern cam-master-init (function none :behavior camera-master)) diff --git a/goal_src/engine/camera/camera.gc b/goal_src/engine/camera/camera.gc index b70a2453c1..746ddc3a79 100644 --- a/goal_src/engine/camera/camera.gc +++ b/goal_src/engine/camera/camera.gc @@ -5,3 +5,2424 @@ ;; name in dgo: camera ;; dgos: GAME, ENGINE +;; 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 +;; 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 + ((method-of-type res-lump get-property-struct) + arg0 + arg2 + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + (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 + #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 +(defun cam-slave-get-flags ((arg0 entity) (arg1 symbol)) + (let + ((gp-0 + ((method-of-type res-lump get-property-value) + arg0 + arg1 + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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* + ) + ) + ) + (logclear (logior gp-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 + ((method-of-type res-lump get-property-value-float) + arg0 + arg1 + 'interp + -1000000000.0 + arg2 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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 + ((method-of-type res-lump get-property-value-float) + arg0 + 'fov + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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 + ((method-of-type res-lump get-property-value-float) + arg0 + 'intro-time + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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 + ((method-of-type res-lump get-property-value-float) + arg0 + 'interpTime + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s5-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'interpTime '-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.001 f0-1) + (set! f0-1 0.0) + ) + f0-1 + ) + ) + ) + +;; definition for function cam-slave-get-rot +(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 quaternion)) + (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 + #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 (the-as matrix arg1) s4-1) + ) + ) + (else + (quaternion->matrix (the-as 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 #f) + ) + (((method-of-type res-lump get-property-struct) + arg0 + 'pivot + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + cam-circular + ) + (((method-of-type res-lump get-property-struct) + arg0 + 'align + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + 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)) + *camera-base-mode* + ) + (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-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 +;; Used lq/sq +(defmethod + dummy-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 uint (cam-slave-get-flags arg1 (string->symbol *res-key-string*))) + ) + (let + ((s3-2 + ((method-of-type res-lump get-property-data) + arg1 + arg0 + 'interp + -1000000000.0 + (the-as pointer #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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 + #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) + (-> (the-as (pointer uint128) (&+ (-> arg3 cverts) 0))) + ) + (set! + (-> obj vec 1 quad) + (-> + (the-as + (pointer uint128) + (&+ (-> arg3 cverts) (* (+ (-> arg3 num-cverts) -1) 16)) + ) + ) + ) + ) + (else + (return #f) + ) + ) + ) + ) + (let ((s4-1 (new-stack-vector0))) + 0.0 + (cond + ((logtest? (-> obj flags) 2) + (vector-! s4-1 (-> obj vec 1) arg2) + (set! (-> obj vec 1 w) (vector-length s4-1)) + (vector-! s4-1 (the-as vector (-> obj vec)) arg2) + (set! (-> obj vec 1 x) (vector-length s4-1)) + (set! (-> obj vec 1 w) (- (-> obj vec 1 w) (-> obj vec 1 x))) + (set! (-> obj vec 0 quad) (-> arg2 quad)) + ) + ((logtest? (-> obj flags) 1) + (vector-! s4-1 (-> obj vec 1) arg2) + (set! (-> obj vec 1 w) (vector-length s4-1)) + (vector-! s4-1 (the-as vector (-> obj vec)) arg2) + (set! (-> obj vec 1 x) (vector-length s4-1)) + (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 +;; Used lq/sq +(defmethod dummy-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) 2) + (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) + (/ (- (vector-length s5-0) (-> obj vec 1 x)) (-> obj vec 1 w)) + ) + ((logtest? (-> obj flags) 1) + (/ (- (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: Return type mismatch int vs none. +;; Used lq/sq +(defmethod TODO-RENAME-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 TODO-RENAME-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)) (the-as uint (* 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)) (the-as uint (* 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 TODO-RENAME-14 tracking-spline ((obj tracking-spline) (arg0 vector)) + (let ((v1-0 (-> obj used-point))) + (set! (-> obj partial-point) (-> arg0 y)) + (when (= (-> obj next-to-last-point) v1-0) + (set! (-> obj summed-len) (-> obj point v1-0 tp-length)) + (if (= (-> arg0 x) (-> obj end-point)) + (set! (-> obj partial-point) 0.99999) + ) + ) + (when (!= (-> arg0 x) v1-0) + (while + (and + (!= (-> obj point v1-0 next) (-> arg0 x)) + (!= (-> 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) (the-as int (-> arg0 x))) + (cond + ((= (-> arg0 x) (-> obj end-point)) + (set! (-> obj partial-point) 0.0) + (set! (-> obj summed-len) 0.0) + ) + ((= (-> arg0 x) (-> 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 TODO-RENAME-15 tracking-spline ((obj tracking-spline)) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-0 (new 'stack-no-clear 'tracking-point))) + (set! (-> s5-0 cur-pt) (-> obj used-point)) + (set! (-> s5-0 partial-pt) (-> obj partial-point)) + (TODO-RENAME-19 obj (-> obj sample-len) (the-as vector 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)) + (the-as uint (* 48 v1-15)) + ) + ) + (the-as + vector + (+ + (the-as uint (the-as vector (-> obj point 0 direction))) + (the-as uint (* 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) + (TODO-RENAME-13 obj a1-1) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 16 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod TODO-RENAME-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)) + (TODO-RENAME-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)) + (the-as uint (* 48 s4-1)) + ) + ) + (the-as + vector + (+ + (the-as uint (the-as vector (-> obj point 0 direction))) + (the-as uint (* 48 v1-11)) + ) + ) + ) + ) + ) + arg0 + ) + (TODO-RENAME-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 +;; Used lq/sq +(defmethod + TODO-RENAME-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)) (the-as uint (* 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)) (the-as uint (* 48 s2-0))) + ) + 1.0 + ) + ) + (if (< (-> obj point s2-0 tp-length) arg1) + (return 0) + ) + (when (and arg3 (= s3-0 -134250495)) + (TODO-RENAME-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) + (TODO-RENAME-16 obj arg2) + ) + ) + ) + ) + 0 + ) + +;; definition for method 18 of type tracking-spline +(defmethod + TODO-RENAME-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 + (while #t + (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 'vector))) + (let ((a2-5 (-> obj point (-> arg2 cur-pt) next))) + (vector-lerp! + s5-0 + (the-as vector (-> obj point (-> arg2 cur-pt))) + (the-as vector (-> obj point a2-5)) + f0-4 + ) + ) + (vector+! arg1 arg1 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)) + ) + ) + ) + (the-as vector #f) + ) + +;; definition for method 19 of type tracking-spline +(defmethod + TODO-RENAME-19 + tracking-spline + ((obj tracking-spline) + (arg0 float) + (arg1 vector) + (arg2 tracking-spline-sampler) + ) + (vector-reset! arg1) + (TODO-RENAME-18 obj arg0 arg1 arg2) + arg1 + ) + +;; definition for method 20 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod + TODO-RENAME-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)) + (f1-9 (* 2.0 f0-2)) + (f28-0 (fmin 1.0 (fmax 0.05 f1-9))) + (v1-8 (-> obj used-point)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (while + (and + (!= v1-8 (-> obj end-point)) + (!= v1-8 (-> obj next-to-last-point)) + (!= v1-8 arg1) + ) + (let ((s1-0 (-> obj point v1-8 next))) + (vector-! + s2-0 + (the-as + vector + (+ (the-as uint (-> obj point 0 direction)) (the-as uint (* 48 s1-0))) + ) + (the-as + vector + (+ (the-as uint (-> obj point 0 direction)) (the-as uint (* 48 v1-8))) + ) + ) + (let* ((f0-4 (vector-normalize-ret-len! s2-0 1.0)) + (f0-5 (* 0.5 f0-4)) + (f26-0 (* (* (fmin 1.0 f0-5) f30-0) (vector-dot arg0 s2-0))) + ) + (let ((f2-7 (vector-dot s2-0 s3-0))) + (cond + ((>= 0.0 f2-7) + ) + (else + (set! f26-0 (* f26-0 (fmax 0.0 (- 0.75 (fabs (* f28-0 f2-7)))))) + ) + ) + ) + (cond + ((< f26-0 0.0) + (if (and *debug-segment* *display-camera-marks*) + (camera-line-rel-len + (-> obj point s1-0) + s2-0 + (* -40.96 f26-0) + (the-as + rgba + (new 'static 'inline-array qword 1 + (new 'static 'qword + :data + (new 'static 'array uint32 4 #xff #xff #x0 #x80) + ) + ) + ) + ) + ) + (vector--float*! arg0 arg0 s2-0 f26-0) + ) + ((and *debug-segment* *display-camera-marks*) + (camera-line-rel-len + (-> obj point s1-0) + s2-0 + (* 40.96 f26-0) + (the-as + rgba + (new 'static 'inline-array qword 1 + (new 'static 'qword + :data + (new 'static 'array uint32 4 #x80 #x80 #x0 #x80) + ) + ) + ) + ) + ) + ) + ) + (set! v1-8 s1-0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 21 of type tracking-spline +;; Used lq/sq +(defmethod + TODO-RENAME-21 + tracking-spline + ((obj tracking-spline) (arg0 vector) (arg1 float) (arg2 float)) + (let ((v1-0 (-> obj used-point)) + (f0-0 (-> obj partial-point)) + ) + (let ((f1-0 (-> obj summed-len))) + 0.0 + 0.0 + (let* ((f1-1 (- f1-0 (* f0-0 (-> obj point v1-0 tp-length)))) + (f2-5 (* 0.1 f1-1)) + (f2-8 + (* + (fmin arg1 (- f2-5 (-> obj max-move))) + (-> *display* 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* ((f2-14 (- f1-8 (* f0-0 (-> obj point v1-0 tp-length)))) + (f2-16 (fmin 204.8 (- f2-14 (-> obj sample-len)))) + ) + (set! (-> obj sample-len) (fmin 16384.0 (+ (-> obj sample-len) f2-16))) + ) + ) + (let ((s4-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (set! (-> s4-0 cur-pt) v1-0) + (set! (-> s4-0 partial-pt) f0-0) + (TODO-RENAME-19 + obj + (* (-> obj max-move) (-> *display* time-adjust-ratio)) + arg0 + s4-0 + ) + (TODO-RENAME-14 obj (the-as vector s4-0)) + (dotimes (s3-0 63) + (TODO-RENAME-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)) + (TODO-RENAME-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 TODO-RENAME-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) + (TODO-RENAME-19 obj (- (-> obj summed-len) arg0) a2-0 s5-0) + ) + (TODO-RENAME-14 obj (the-as vector s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod TODO-RENAME-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 +;; Used lq/sq +(defbehavior cam-slave-init-vars camera-slave () + (cond + (*camera* + (set! (-> self options) (-> *camera* slave-options)) + (set! (-> self change-event-from) (-> *camera* changer)) + ) + (else + (set! (-> self options) (the-as uint 0)) + (set! (-> self change-event-from) (the-as uint #f)) + ) + ) + (cond + (*camera-combiner* + (set! (-> self trans quad) (-> *camera-combiner* trans quad)) + (let* ((v1-9 (-> 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 vector 3 quad)) + ) + (set! (-> v1-9 inv-mat vector 0 quad) a0-1) + (set! (-> v1-9 inv-mat vector 1 quad) a1-0) + (set! (-> v1-9 inv-mat vector 2 quad) a2-0) + (set! (-> v1-9 inv-mat vector 3 quad) a3-1) + ) + (when *camera-init-mat* + (let* ((a2-1 (-> self tracking)) + (a3-2 *camera-init-mat*) + (v1-12 (-> a3-2 vector 0 quad)) + (a0-2 (-> a3-2 vector 1 quad)) + (a1-1 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad)) + ) + (set! (-> a2-1 inv-mat vector 0 quad) v1-12) + (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 vector 3 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) (the-as uint 0)) + (set! (-> self enter-has-run) #f) + (set! (-> self cam-entity) #f) + (set! (-> self tracking no-follow) #f) + (init-cam-float-seeker + (-> self tracking tilt-adjust) + (-> *CAMERA-bank* default-tilt-adjust) + 9.102222 + 91.022224 + 0.25 + ) + (set! (-> self tracking follow-blend) 1.0) + (set! (-> self have-phony-joystick) #f) + (set! (-> self string-val-locked) #f) + (init-cam-float-seeker + (-> self tracking point-of-interest-blend) + 0.0 + 0.005 + 0.02 + 0.125 + ) + (init-cam-float-seeker + (-> self tracking underwater-blend) + 0.0 + 0.007 + 0.03 + 0.125 + ) + (set! (-> self tracking use-point-of-interest) #f) + (TODO-RENAME-10 (-> self position-spline) (-> self trans)) + (none) + ) + +;; definition for function cam-slave-go +;; INFO: Return type mismatch int vs none. +(defun cam-slave-go ((arg0 camera-slave)) + (with-pp + (cam-slave-init-vars) + (let ((t9-1 (the-as (function object) enter-state))) + (set! (-> pp next-state) (the-as state arg0)) + (t9-1) + ) + 0 + (none) + ) + ) + +;; definition for function cam-slave-init +;; INFO: Return type mismatch int vs none. +(defbehavior cam-slave-init camera-slave ((arg0 state) (arg1 entity)) + (stack-size-set! (-> self main-thread) 512) + (change-to-last-brother self) + (if (and (nonzero? camera-slave-debug) *debug-segment*) + (add-connection *debug-engine* self camera-slave-debug self #f #f) + ) + (cam-slave-init-vars) + (let ((v1-7 'cam-voicebox) + (a0-4 (-> arg0 name)) + ) + (cond + ((= a0-4 v1-7) + ) + (arg1 + (set! (-> self cam-entity) arg1) + ) + (else + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) self) + (set! (-> a1-3 num-params) 1) + (set! (-> a1-3 message) 'slave-activated) + (set! (-> a1-3 param 0) (the-as uint self)) + (let ((t9-4 send-event-function)) + (set! a0-4 *camera*) + (t9-4 (the-as process a0-4) a1-3) + ) + ) + ) + ) + (let ((t9-5 (the-as (function object object) (-> arg0 enter)))) + (if t9-5 + (t9-5 a0-4) + ) + ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> arg0 event)) + (let ((t9-6 (the-as (function object object) enter-state))) + (set! (-> self next-state) arg0) + (t9-6 a0-4) + ) + ) + 0 + (none) + ) + +;; definition for function cam-standard-event-handler +;; INFO: Return type mismatch none vs object. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; Used lq/sq +(defbehavior + cam-standard-event-handler camera-slave + ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'go) + (let ((v1-1 (-> arg3 param 0)) + (t9-0 (the-as (function object) enter-state)) + ) + (set! (-> self next-state) (the-as state v1-1)) + (t9-0) + ) + ) + ((or (= v1-0 'change-state) (= v1-0 'change-state-no-go)) + (let ((s5-0 (the-as object (-> arg3 param 0)))) + (cam-slave-init-vars) + (let + ((t9-2 + (the-as + (function object) + (-> (the-as state s5-0) enter) + ) + ) + ) + (if t9-2 + (t9-2) + ) + ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> (the-as state s5-0) event)) + (when (= arg2 'change-state) + (let ((t9-3 (the-as (function object) enter-state))) + (set! (-> self next-state) (the-as state s5-0)) + (t9-3) + ) + ) + ) + ) + ((= v1-0 'point-of-interest) + (the-as none (cond + ((-> arg3 param 0) + (set! + (-> self tracking use-point-of-interest) + #t + ) + (set! + (-> self tracking point-of-interest quad) + (-> (the-as vector (-> arg3 param 0)) quad) + ) + (let ((f0-0 1.0)) + (set! + (-> + self + tracking + point-of-interest-blend + target + ) + f0-0 + ) + f0-0 + ) + ) + (else + (set! + (-> self tracking use-point-of-interest) + #f + ) + (let ((f0-1 0.0)) + (set! + (-> + self + tracking + point-of-interest-blend + target + ) + f0-1 + ) + f0-1 + ) + ) + ) + ) + ) + ((= v1-0 'teleport) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + ) + ) + ) + ) + ) + +;; definition for function cam-curve-pos +;; 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) (-> *display* 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 + (dummy-10 (-> self index) (-> self tracking follow-pt)) + (dummy-10 (-> self index) (-> *camera* tpos-curr-adj)) + ) + ) + ) + (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)) + (dummy-9 + (-> self index) + 'campoints + (-> self cam-entity) + arg0 + (-> self spline-curve) + ) + (set! (-> self spline-exists) #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 (nonzero? (-> *camera* no-intro)) + (set! (-> self intro-t) 1.0) + ) + 0 + (none) + ) + +;; definition for function cam-calc-follow! +;; Used lq/sq +(defun cam-calc-follow! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) + (with-pp + (cond + (arg2 + (update! (-> arg0 tilt-adjust) 0.0) + (update! (-> arg0 point-of-interest-blend) 0.0) + (update! (-> arg0 underwater-blend) 0.0) + ) + (else + (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) + ) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) pp) + (set! (-> a1-7 num-params) 1) + (set! (-> a1-7 message) 'slave-option?) + (set! (-> a1-7 param 0) (the-as uint #x4000)) + (cond + ((send-event-function *camera* a1-7) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (f30-0 + (vector-vector-distance + (-> *camera* tpos-curr-adj) + (-> *camera* tpos-old-adj) + ) + ) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (vector-flatten! + s3-0 + (-> *camera* tgt-face-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s3-0 1.0) + (vector-! s2-0 (-> *camera* tpos-curr-adj) arg1) + (vector-flatten! s2-0 s2-0 (-> *camera* local-down)) + (vector-normalize! s2-0 1.0) + (vector-float*! s5-1 (-> *camera* tgt-face-mat vector 2) 32768.0) + (let* + ((f30-1 + (lerp-clamp + 0.7 + 0.4 + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) + ) + ) + (f0-4 (acos (vector-dot s2-0 s3-0))) + (f28-0 (fmax 1820.4445 f0-4)) + ) + (if (< f28-0 8192.0) + (vector-float*! + s5-1 + s5-1 + (+ + 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-18 (-> arg0 follow-blend)) + (f0-19 (* f0-18 f0-18)) + (f0-20 (* f0-19 f0-19)) + ) + (vector-! s5-1 s5-1 (-> arg0 follow-off)) + (vector-float*! s5-1 s5-1 f0-20) + ) + (+! + (-> arg0 follow-blend) + (* 0.016666668 (-> *display* time-adjust-ratio)) + ) + (vector+! (-> arg0 follow-off) (-> arg0 follow-off) s5-1) + ) + (else + (set! (-> arg0 follow-off quad) (-> s5-1 quad)) + ) + ) + ) + (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* target-height)) + ) + ) + (else + 0.0 + (let ((s3-2 (new-stack-vector0))) + (set! (-> arg0 follow-blend) 0.0) + (cond + ((-> arg0 no-follow) + (vector-reset! s3-2) + ) + (else + (vector-! s3-2 (-> *camera* tpos-curr-adj) arg1) + (vector-normalize! s3-2 1.0) + (let* ((f0-28 (vector-dot (-> *camera* tgt-rot-mat vector 2) s3-2)) + (f30-2 (cond + ((< f0-28 0.0) + 1.0 + ) + (else + (let* ((f0-29 (* f0-28 f0-28)) + (f0-30 (- 1.0 f0-29)) + ) + (* f0-30 (* f0-30 f0-30)) + ) + ) + ) + ) + ) + (vector-! s3-2 arg1 (-> *camera* tpos-curr-adj)) + (vector-flatten! s3-2 s3-2 (-> *camera* local-down)) + (let* ((f0-33 (* 0.000022194603 (+ -20480.0 (vector-length s3-2)))) + (f0-34 (fmin 1.0 f0-33)) + (f0-35 (fmax 0.0 f0-34)) + ) + (vector-float*! + s3-2 + (-> *camera* tgt-rot-mat vector 2) + (* (lerp 2048.0 8192.0 f0-35) f30-2) + ) + ) + ) + ) + ) + (if arg2 + (vector-seek-3d-smooth! + (-> arg0 follow-off) + s3-2 + (* 20480.0 (-> *display* seconds-per-frame)) + 0.05 + ) + (set! (-> arg0 follow-off quad) (-> s3-2 quad)) + ) + ) + (vector+! + (-> arg0 follow-pt) + (-> *camera* tpos-curr-adj) + (-> arg0 follow-off) + ) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (-> *camera* target-height) + ) + ) + ) + ) + (-> arg0 follow-pt) + ) + ) + +;; definition for function mat-remove-z-rot +;; 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 ((f30-0 (vector-dot (-> arg0 vector 1) s4-0))) + (when (< f30-0 0.99999) + (vector-cross! s4-0 (-> arg0 vector 1) s4-0) + (let ((f0-4 (vector-length s4-0))) + (if (< 0.0 (vector-dot s4-0 (-> arg0 vector 2))) + (set! f0-4 (- f0-4)) + ) + (matrix-axis-sin-cos! s5-0 (-> arg0 vector 2) f0-4 f30-0) + ) + (matrix*! arg0 arg0 s5-0) + ) + ) + ) + ) + arg0 + ) + +;; definition for function slave-matrix-blend-2 +;; Used lq/sq +(defun + slave-matrix-blend-2 + ((arg0 matrix) (arg1 float) (arg2 vector) (arg3 matrix)) + (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 (* (* 364.0889 (-> *display* time-adjust-ratio)) f0-3))) + (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 (< (* (* 0.25 (-> *display* time-adjust-ratio)) f28-0) f30-0) + (set! f30-0 (* (* 0.25 (-> *display* time-adjust-ratio)) f28-0)) + ) + (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! +;; 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) + ) + (vector-! s3-0 (-> *camera* tpos-curr) arg1) + (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-6 (* 0.8 (tan (* 0.5 arg2))))) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-6 f0-6)) + (.mov vf2 v1-6) + ) + ) + (.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 1.0) + (let ((f0-8 (vector-dot s2-0 (the-as vector (-> arg0 vector))))) + (when (< f0-8 (fabs f28-0)) + (if (< f28-0 0.0) + (vector--float*! + s2-0 + s2-0 + (the-as vector (-> arg0 vector)) + (* 2.0 f0-8) + ) + ) + (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* 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-15 (* 0.525 (tan (* 0.5 arg2))))) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-23 f0-15)) + (.mov vf2 v1-23) + ) + ) + (.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-17 (vector-dot s2-0 (-> arg0 vector 1)))) + (when (and (< f28-1 0.0) (< f0-17 (- f28-1))) + (vector--float*! s2-0 s2-0 (-> arg0 vector 1) (* 2.0 f0-17)) + (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* 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-25 (* 0.525 (tan (* 0.5 arg2))))) + (vector-float*! s0-1 sv-176 f0-25) + ) + ) + (vector+! s2-0 s2-0 (-> arg0 vector 2)) + (vector-normalize! s2-0 1.0) + (let ((f0-27 (vector-dot s2-0 (-> arg0 vector 1)))) + (cond + ((and (< 0.0 f28-2) (< f0-27 f28-2)) + (set! f30-0 (vector-dot s2-0 s3-0)) + (set! s4-0 #f) + ) + ((< f30-0 0.0) + (let ((f0-32 (- (vector-dot s2-0 s3-0)))) + (if (< f0-32 f30-0) + (set! f30-0 f0-32) + ) + ) + ) + ) + ) + ) + (let ((f0-34 (if s4-0 + (- (acos f30-0)) + (acos f30-0) + ) + ) + ) + (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-34) + ) + ) + ) + (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: Return type mismatch int vs none. +; ;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3] +; ;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4] +; ;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +; ;; Used lq/sq +; (defun +; slave-set-rotation! +; ((arg0 cam-rotation-tracker) +; (arg1 vector) +; (arg2 float) +; (arg3 float) +; (arg4 symbol) +; ) +; (local-vars +; (f0-8 float) +; (sv-192 vector) +; (sv-208 vector) +; (sv-224 matrix) +; (sv-240 (function matrix vector float vector)) +; (sv-256 matrix) +; ) +; (rlet ((vf0 :class vf) +; (vf4 :class vf) +; (vf5 :class vf) +; (vf6 :class vf) +; ) +; (init-vf0-vector) +; (let ((s1-0 (new-stack-vector0)) +; (s5-0 (new-stack-matrix0)) +; ) +; (let ((f30-0 (-> arg0 tilt-adjust value))) +; (cond +; ((< 0.0001 (-> arg0 point-of-interest-blend value)) +; (set! sv-192 (new 'stack-no-clear 'vector)) +; 0.0 +; (vector-! s1-0 (-> arg0 follow-pt) arg1) +; (let ((f28-0 (vector-length s1-0))) +; (vector-! sv-192 (-> arg0 point-of-interest) arg1) +; (vector-normalize! +; sv-192 +; (* f28-0 (-> arg0 point-of-interest-blend value)) +; ) +; (let ((v1-3 s1-0)) +; (let ((a0-5 s1-0)) +; (.mov.vf vf6 vf0 :mask #b1000) +; (.lvf vf4 (&-> a0-5 quad)) +; ) +; (.lvf vf5 (&-> sv-192 quad)) +; (.add.vf vf6 vf4 vf5 :mask #b111) +; (.svf (&-> v1-3 quad) vf6) +; ) +; (vector-normalize! s1-0 f28-0) +; ) +; ) +; (else +; (vector-! s1-0 (-> arg0 follow-pt) arg1) +; ) +; ) +; (forward-down->inv-matrix s5-0 s1-0 (-> *camera* local-down)) +; (when (!= f30-0 0.0) +; 0.0 +; 0.0 +; (set! sv-224 (new 'stack-no-clear 'matrix)) +; (set! sv-208 (new 'stack-no-clear 'vector)) +; (vector-normalize-copy! sv-208 s1-0 1.0) +; (let* ((v1-11 (-> *camera* local-down)) +; (f0-7 (-> sv-208 x)) +; (f1-1 (-> sv-208 y)) +; (f2-0 (-> sv-208 z)) +; (f3-0 (-> v1-11 x)) +; (f4-0 (-> v1-11 y)) +; (f5-0 (-> v1-11 z)) +; ) +; (.mula.s f0-7 f3-0) +; (.madda.s f1-1 f4-0) +; (.madd.s f0-8 f2-0 f5-0) +; ) +; (let* ((f28-1 f0-8) +; (f0-10 (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-10))) +; (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) +; ) +; ) +; ) +; ((< f30-0 0.0) +; (set! f30-0 (if (< 0.0 f28-1) +; (fmax +; f30-0 +; (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) +; ) +; (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))) +; ) +; ) +; ) +; ) +; ) +; (matrix-rotate-x! sv-224 f30-0) +; (let ((t9-7 matrix*!) +; (a0-16 s5-0) +; (a2-3 s5-0) +; ) +; (t9-7 a0-16 sv-224 a2-3) +; ) +; ) +; ) +; (if +; (and +; (= (-> *camera* under-water) 2) +; *target* +; (!= (-> *target* next-state name) 'target-swim-up) +; ) +; (set! (-> arg0 underwater-blend target) 1.0) +; (set! (-> arg0 underwater-blend target) 0.0) +; ) +; (set! sv-240 vector-into-frustum-nosmooth!) +; (set! sv-256 s5-0) +; (let +; ((a2-5 (lerp-clamp arg3 (* 0.25 arg3) (-> arg0 underwater-blend value)))) +; (sv-240 sv-256 arg1 a2-5) +; ) +; (cond +; (arg4 +; (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s1-0 s5-0) +; ) +; (else +; (let* ((v1-31 (-> arg0 inv-mat)) +; (a3-2 s5-0) +; (a0-22 (-> a3-2 vector 0 quad)) +; (a1-16 (-> a3-2 vector 1 quad)) +; (a2-7 (-> a3-2 vector 2 quad)) +; (a3-3 (-> a3-2 vector 3 quad)) +; ) +; (set! (-> v1-31 vector 0 quad) a0-22) +; (set! (-> v1-31 vector 1 quad) a1-16) +; (set! (-> v1-31 vector 2 quad) a2-7) +; (set! (-> v1-31 vector 3 quad) a3-3) +; ) +; ) +; ) +; ) +; (mat-remove-z-rot (-> arg0 inv-mat) (-> *camera* local-down)) +; 0 +; (none) +; ) +; ) + +; ;; definition for function v-slrp2! +; ;; WARN: Stack slot offset 144 signed mismatch +; ;; WARN: Stack slot offset 144 signed mismatch +; ;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3] +; ;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4] +; ;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +; ;; Used lq/sq +; (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) +; ) +; (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 vector 3 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-18 s0-0) +; (f0-9 (-> v1-18 x)) +; (f1-2 (-> v1-18 y)) +; (f2-0 (-> v1-18 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 +; (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) +; (vector+float*! +; arg0 +; arg0 +; s3-0 +; (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0)) +; ) +; ) +; ) +; ) +; arg0 +; ) + +; ;; definition for function v-slrp3! +; ;; WARN: Stack slot offset 144 signed mismatch +; ;; WARN: Stack slot offset 144 signed mismatch +; ;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3] +; ;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4] +; ;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +; ;; Used lq/sq +; (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) +; ) +; (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-9 s1-0) +; (f0-6 (-> v1-9 x)) +; (f1-0 (-> v1-9 y)) +; (f2-0 (-> v1-9 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 +; (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) +; (vector+float*! +; arg0 +; arg0 +; s3-0 +; (* f30-0 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0)) +; ) +; ) +; ) +; ) +; arg0 +; ) + + + + diff --git a/goal_src/engine/camera/math-camera-h.gc b/goal_src/engine/camera/math-camera-h.gc index b26b00cd59..8a8bf42722 100644 --- a/goal_src/engine/camera/math-camera-h.gc +++ b/goal_src/engine/camera/math-camera-h.gc @@ -47,54 +47,54 @@ ) (deftype math-camera (basic) - ((d meters :offset-assert 4) - (f meters :offset-assert 8) - (fov degrees :offset-assert 12) - (x-ratio float :offset-assert 16) - (y-ratio float :offset-assert 20) - (x-pix float :offset-assert 24) - (x-clip float :offset-assert 28) - (x-clip-ratio-in float :offset-assert 32) - (x-clip-ratio-over float :offset-assert 36) - (y-pix float :offset-assert 40) - (y-clip float :offset-assert 44) - (y-clip-ratio-in float :offset-assert 48) - (y-clip-ratio-over float :offset-assert 52) - (cull-info cull-info :inline :offset-assert 56) - (fog-start meters :offset-assert 120) - (fog-end meters :offset-assert 124) - (fog-max float :offset-assert 128) - (fog-min float :offset-assert 132) - (reset int32 :offset-assert 136) - (smooth-step float :offset-assert 140) - (smooth-t float :offset-assert 144) - (perspective matrix :inline :offset-assert 160) - (isometric matrix :inline :offset-assert 224) - (sprite-2d matrix :inline :offset-assert 288) - (sprite-2d-hvdf vector :inline :offset-assert 352) - (camera-rot matrix :inline :offset-assert 368) - (inv-camera-rot matrix :inline :offset-assert 432) - (inv-camera-rot-smooth matrix :inline :offset-assert 496) - (inv-camera-rot-smooth-from quaternion :inline :offset-assert 560) - (camera-temp matrix :inline :offset-assert 576) - (prev-camera-temp matrix :inline :offset-assert 640) - (hmge-scale vector :inline :offset-assert 704) - (inv-hmge-scale vector :inline :offset-assert 720) - (hvdf-off vector :inline :offset-assert 736) - (guard vector :inline :offset-assert 752) - (vis-gifs vis-gif-tag 4 :inline :offset-assert 768) - (vis-gifs-quads uint128 4 :offset 768) - (giftex vis-gif-tag :offset 768) - (gifgr vis-gif-tag :offset 784) - (giftex-trans vis-gif-tag :offset 800) - (gifgr-trans vis-gif-tag :offset 816) - (pfog0 float :offset-assert 832) - (pfog1 float :offset-assert 836) - (trans vector :inline :offset-assert 848) - (plane uint128 4 :offset-assert 864) - (guard-plane uint128 4 :offset-assert 928) - (shrub-mat matrix :inline :offset-assert 992) - (fov-correction-factor float :offset-assert 1056) + ((d meters :offset-assert 4) ;; camera near plane + (f meters :offset-assert 8) ;; camera far plane + (fov degrees :offset-assert 12) ;; field of view angle + (x-ratio float :offset-assert 16) + (y-ratio float :offset-assert 20) + (x-pix float :offset-assert 24) + (x-clip float :offset-assert 28) + (x-clip-ratio-in float :offset-assert 32) + (x-clip-ratio-over float :offset-assert 36) + (y-pix float :offset-assert 40) + (y-clip float :offset-assert 44) + (y-clip-ratio-in float :offset-assert 48) + (y-clip-ratio-over float :offset-assert 52) + (cull-info cull-info :inline :offset-assert 56) + (fog-start meters :offset-assert 120) + (fog-end meters :offset-assert 124) + (fog-max float :offset-assert 128) + (fog-min float :offset-assert 132) + (reset int32 :offset-assert 136) + (smooth-step float :offset-assert 140) + (smooth-t float :offset-assert 144) + (perspective matrix :inline :offset-assert 160) + (isometric matrix :inline :offset-assert 224) + (sprite-2d matrix :inline :offset-assert 288) + (sprite-2d-hvdf vector :inline :offset-assert 352) + (camera-rot matrix :inline :offset-assert 368) + (inv-camera-rot matrix :inline :offset-assert 432) + (inv-camera-rot-smooth matrix :inline :offset-assert 496) + (inv-camera-rot-smooth-from quaternion :inline :offset-assert 560) + (camera-temp matrix :inline :offset-assert 576) + (prev-camera-temp matrix :inline :offset-assert 640) + (hmge-scale vector :inline :offset-assert 704) + (inv-hmge-scale vector :inline :offset-assert 720) + (hvdf-off vector :inline :offset-assert 736) + (guard vector :inline :offset-assert 752) + (vis-gifs vis-gif-tag 4 :inline :offset-assert 768) + (vis-gifs-quads uint128 4 :offset 768) ;; added + (giftex vis-gif-tag :offset 768) + (gifgr vis-gif-tag :offset 784) + (giftex-trans vis-gif-tag :offset 800) + (gifgr-trans vis-gif-tag :offset 816) + (pfog0 float :offset-assert 832) + (pfog1 float :offset-assert 836) + (trans vector :inline :offset-assert 848) + (plane plane 4 :inline :offset-assert 864) + (guard-plane plane 4 :inline :offset-assert 928) + (shrub-mat matrix :inline :offset-assert 992) + (fov-correction-factor float :offset-assert 1056) ) (:methods (new (symbol type) _type_ 0) diff --git a/goal_src/engine/collide/collide-shape-h.gc b/goal_src/engine/collide/collide-shape-h.gc index 765945fc78..ff994e4df0 100644 --- a/goal_src/engine/collide/collide-shape-h.gc +++ b/goal_src/engine/collide/collide-shape-h.gc @@ -346,8 +346,8 @@ (old-status uint64 :offset-assert 280) (prev-status uint64 :offset-assert 288) (reaction-flag uint32 :offset-assert 296) - (reaction basic :offset-assert 300) - (no-reaction basic :offset-assert 304) + (reaction function :offset-assert 300) + (no-reaction function :offset-assert 304) (local-normal vector :inline :offset-assert 320) (surface-normal vector :inline :offset-assert 336) (poly-normal vector :inline :offset-assert 352) @@ -359,23 +359,23 @@ (poly-angle float :offset-assert 424) (touch-angle float :offset-assert 428) (coverage float :offset-assert 432) - (dynam basic :offset-assert 436) - (surf basic :offset-assert 440) + (dynam dynamics :offset-assert 436) + (surf surface :offset-assert 440) ) :method-count-assert 65 :size-assert #x1bc :flag-assert #x41000001bc (:methods - (dummy-56 () none 56) - (dummy-57 () none 57) - (dummy-58 () none 58) - (dummy-59 () none 59) - (dummy-60 () none 60) - (dummy-61 () none 61) - (dummy-62 () none 62) - (dummy-63 () none 63) - (dummy-64 () none 64) - ) + (dummy-56 () none 56) + (dummy-57 () none 57) + (dummy-58 () none 58) + (dummy-59 () none 59) + (dummy-60 () none 60) + (dummy-61 () none 61) + (dummy-62 () none 62) + (dummy-63 () none 63) + (dummy-64 () none 64) + ) ) (defmethod new collide-shape-prim ((allocation symbol) (type-to-make type) (cshape basic) (prim-id uint) (size-bytes int)) diff --git a/goal_src/engine/debug/debug.gc b/goal_src/engine/debug/debug.gc index 66a4313784..5c1728213f 100644 --- a/goal_src/engine/debug/debug.gc +++ b/goal_src/engine/debug/debug.gc @@ -1314,7 +1314,16 @@ ) ) -(defun-debug add-debug-curve ((arg0 symbol) (arg1 bucket-id) (arg2 pointer) (arg3 int) (arg4 (inline-array vector)) (arg5 int) (arg6 rgba)) +(defun-debug + add-debug-curve + ((arg0 symbol) + (arg1 bucket-id) + (arg2 pointer) + (arg3 int) + (arg4 (inline-array vector)) + (arg5 int) + (arg6 rgba) + ) (local-vars (sv-48 vector) (sv-64 int) (sv-80 int)) (if (not arg0) (return #f) diff --git a/goal_src/engine/entity/entity-h.gc b/goal_src/engine/entity/entity-h.gc index a6c4e2cfe8..ba04a6542c 100644 --- a/goal_src/engine/entity/entity-h.gc +++ b/goal_src/engine/entity/entity-h.gc @@ -209,4 +209,6 @@ (defun-extern entity-by-type type entity-actor) (defun-extern entity-by-aid uint entity) (define-extern reset-actors (function symbol none)) -(define-extern *spawn-actors* symbol) \ No newline at end of file +(define-extern *spawn-actors* symbol) +;; TODO - for cam-start +(define-extern reset-cameras (function none)) diff --git a/goal_src/engine/gfx/vis/bsp-h.gc b/goal_src/engine/gfx/vis/bsp-h.gc index 62d57f1959..d94acc32a9 100644 --- a/goal_src/engine/gfx/vis/bsp-h.gc +++ b/goal_src/engine/gfx/vis/bsp-h.gc @@ -186,3 +186,6 @@ ;; offsets of stuff in the scratchpad during bsp draw. (defconstant TERRAIN_BSP_SCRATCHPAD #x0) (defconstant VISIBLE_LIST_SCRATCHPAD #x38b0) + +;; TODO - for cam-update +(define-extern bsp-camera-asm (function bsp-header vector none)) diff --git a/goal_src/engine/gfx/vis/bsp.gc b/goal_src/engine/gfx/vis/bsp.gc index 5cd4305495..f08792a5df 100644 --- a/goal_src/engine/gfx/vis/bsp.gc +++ b/goal_src/engine/gfx/vis/bsp.gc @@ -257,10 +257,10 @@ (let ((at-0 *math-camera*)) (with-vf (vf16 vf17 vf18 vf19 vf20 vf21 vf22 vf23 vf24 vf25 vf26 vf27 vf28 vf29 vf30 vf31) :rw 'write - (.lvf vf16 (&-> at-0 plane 0)) - (.lvf vf17 (&-> at-0 plane 1)) - (.lvf vf18 (&-> at-0 plane 2)) - (.lvf vf19 (&-> at-0 plane 3)) + (.lvf vf16 (&-> at-0 plane 0 quad)) + (.lvf vf17 (&-> at-0 plane 1 quad)) + (.lvf vf18 (&-> at-0 plane 2 quad)) + (.lvf vf19 (&-> at-0 plane 3 quad)) (.lvf vf20 (&-> at-0 shrub-mat vector 0 quad)) (.lvf vf21 (&-> at-0 shrub-mat vector 1 quad)) (.lvf vf22 (&-> at-0 shrub-mat vector 2 quad)) @@ -346,10 +346,10 @@ (let ((at-0 *math-camera*)) (with-vf (vf16 vf17 vf18 vf19 vf20 vf21 vf22 vf23 vf24 vf25 vf26 vf27 vf28 vf29 vf30 vf31) :rw 'write - (.lvf vf16 (&-> at-0 plane 0)) - (.lvf vf17 (&-> at-0 plane 1)) - (.lvf vf18 (&-> at-0 plane 2)) - (.lvf vf19 (&-> at-0 plane 3)) + (.lvf vf16 (&-> at-0 plane 0 quad)) + (.lvf vf17 (&-> at-0 plane 1 quad)) + (.lvf vf18 (&-> at-0 plane 2 quad)) + (.lvf vf19 (&-> at-0 plane 3 quad)) (.lvf vf20 (&-> at-0 shrub-mat vector 0 quad)) (.lvf vf21 (&-> at-0 shrub-mat vector 1 quad)) (.lvf vf22 (&-> at-0 shrub-mat vector 2 quad)) @@ -401,10 +401,10 @@ (let ((at-0 *math-camera*)) (with-vf (vf16 vf17 vf18 vf19 vf20 vf21 vf22 vf23 vf24 vf25 vf26 vf27 vf28 vf29 vf30 vf31) :rw 'write - (.lvf vf16 (&-> at-0 plane 0)) - (.lvf vf17 (&-> at-0 plane 1)) - (.lvf vf18 (&-> at-0 plane 2)) - (.lvf vf19 (&-> at-0 plane 3)) + (.lvf vf16 (&-> at-0 plane 0 quad)) + (.lvf vf17 (&-> at-0 plane 1 quad)) + (.lvf vf18 (&-> at-0 plane 2 quad)) + (.lvf vf19 (&-> at-0 plane 3 quad)) (.lvf vf20 (&-> at-0 shrub-mat vector 0 quad)) (.lvf vf21 (&-> at-0 shrub-mat vector 1 quad)) (.lvf vf22 (&-> at-0 shrub-mat vector 2 quad)) diff --git a/goal_src/engine/level/level-h.gc b/goal_src/engine/level/level-h.gc index 08ffaf053a..07b58e332b 100644 --- a/goal_src/engine/level/level-h.gc +++ b/goal_src/engine/level/level-h.gc @@ -152,7 +152,7 @@ (bsp-name (_type_) symbol 13) (dummy-14 (_type_ object) memory-usage-block 14) (dummy-15 (_type_ vector) symbol 15) - (dummy-16 (_type_) none 16) + (dummy-16 (_type_ uint uint) none 16) (load-continue (_type_) _type_ 17) (load-begin (_type_) _type_ 18) (login (_type_) _type_ 19) diff --git a/test/decompiler/reference/engine/anim/aligner_REF.gc b/test/decompiler/reference/engine/anim/aligner_REF.gc index 746d4acba5..7d3f62b6d1 100644 --- a/test/decompiler/reference/engine/anim/aligner_REF.gc +++ b/test/decompiler/reference/engine/anim/aligner_REF.gc @@ -75,17 +75,17 @@ (-> obj align quat) ) (set! (-> obj transform 1 scale quad) (-> obj align scale quad)) - (let* ((a2-5 (-> obj matrix 1)) + (let* ((a2-5 (-> obj matrix 1 vector)) (a3-0 (-> obj matrix)) (v1-19 (-> a3-0 0 vector 0 quad)) (a0-18 (-> a3-0 0 vector 1 quad)) (a1-12 (-> a3-0 0 vector 2 quad)) (a3-1 (-> a3-0 0 vector 3 quad)) ) - (set! (-> a2-5 vector 0 quad) v1-19) - (set! (-> a2-5 vector 1 quad) a0-18) - (set! (-> a2-5 vector 2 quad) a1-12) - (set! (-> a2-5 vector 3 quad) a3-1) + (set! (-> a2-5 0 quad) v1-19) + (set! (-> a2-5 1 quad) a0-18) + (set! (-> a2-5 2 quad) a1-12) + (set! (-> a2-5 3 quad) a3-1) ) (let ((s5-1 (-> obj process node-list data 1))) (cspace<-matrix-no-push-joint! s5-1 (the-as matrix (-> obj process skel))) @@ -103,7 +103,7 @@ ) (vector*! (the-as vector (-> obj transform)) - (-> s5-1 bone position) + (-> s5-1 bone transform vector 3) (-> obj process root scale) ) ) diff --git a/test/decompiler/reference/engine/anim/mspace-h_REF.gc b/test/decompiler/reference/engine/anim/mspace-h_REF.gc index 3cde6b1ee5..aedefcf3ac 100644 --- a/test/decompiler/reference/engine/anim/mspace-h_REF.gc +++ b/test/decompiler/reference/engine/anim/mspace-h_REF.gc @@ -61,7 +61,7 @@ (defmethod inspect bone ((obj bone)) (format #t "[~8x] ~A~%" obj 'bone) (format #t "~Ttransform: #~%" (-> obj transform)) - (format #t "~Tposition: #~%" (-> obj position)) + (format #t "~Tposition: #~%" (-> obj transform vector 3)) (format #t "~Tscale: #~%" (-> obj scale)) (format #t "~Tcache: #~%" (-> obj cache)) obj diff --git a/test/decompiler/reference/engine/camera/cam-combiner_REF.gc b/test/decompiler/reference/engine/camera/cam-combiner_REF.gc new file mode 100644 index 0000000000..cf9c6cc11c --- /dev/null +++ b/test/decompiler/reference/engine/camera/cam-combiner_REF.gc @@ -0,0 +1,791 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(let + ((v1-0 + (new 'static 'state + :name 'cam-combiner-active + :next #f + :exit #f + :code #f + :trans #f + :post #f + :enter #f + :event #f + ) + ) + ) + (set! cam-combiner-active v1-0) + (set! + (-> v1-0 event) + (the-as + (function process int symbol event-message-block object) + (lambda :behavior camera-combiner + ((arg0 basic) (arg1 int) (arg2 basic) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'point-of-interest) + (the-as none (cond + ((-> arg3 param 0) + (set! + (-> + (the-as camera-slave self) + unknown-symbol + ) + #t + ) + (set! + (-> + (the-as camera-slave self) + view-off + quad + ) + (-> + (the-as vector (-> arg3 param 0)) + quad + ) + ) + (let ((f0-0 1.0)) + (set! + (-> + (the-as camera-slave self) + min-z-override + ) + f0-0 + ) + f0-0 + ) + ) + (else + (set! + (-> + (the-as camera-slave self) + unknown-symbol + ) + #f + ) + (let ((f0-1 0.0)) + (set! + (-> + (the-as camera-slave self) + min-z-override + ) + f0-1 + ) + f0-1 + ) + ) + ) + ) + ) + ((= v1-0 'set-interpolation) + (set! (-> (the-as camera-combiner self) interp-val) 0.0) + (let ((f0-4 (/ 5.0 (the float (-> arg3 param 0))))) + (set! + (-> (the-as camera-combiner self) interp-step) + f0-4 + ) + f0-4 + ) + ) + ((= v1-0 'teleport) + (when + (nonzero? + (-> (the-as camera-combiner self) tracking-status) + ) + (cam-calc-follow! + (-> (the-as camera-combiner self) tracking) + (-> (the-as camera-combiner self) trans) + #f + ) + (slave-set-rotation! + (-> (the-as camera-combiner self) tracking) + (-> (the-as camera-combiner self) trans) + (the-as + float + (-> (the-as camera-combiner self) tracking-options) + ) + (-> (the-as camera-combiner self) fov) + #f + ) + ) + ) + ((= v1-0 'stop-tracking) + (set! + (-> (the-as camera-combiner self) tracking-status) + (the-as uint 0) + ) + 0 + ) + ((= v1-0 'start-tracking) + (cond + ((< arg1 1) + (let ((t9-2 format) + (a0-15 0) + (a1-3 + "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%" + ) + ) + (let ((v1-7 (-> arg3 param 0))) + (rtype-of v1-7) + ) + (t9-2 a0-15 a1-3) + ) + ) + ((let ((t9-3 type-type?) + (v1-8 (-> arg3 param 0)) + ) + (not (t9-3 (rtype-of v1-8) camera-slave)) + ) + (let ((t9-4 format) + (a0-18 0) + (a1-5 + "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%" + ) + (v1-10 (-> arg3 param 0)) + ) + (t9-4 a0-18 a1-5 (rtype-of v1-10)) + ) + ) + ((zero? + (-> (the-as camera-combiner self) tracking-status) + ) + (set! + (-> (the-as camera-combiner self) tracking-status) + (the-as uint 1) + ) + (let ((gp-1 (the-as object (-> arg3 param 0)))) + (set! + (-> (the-as camera-combiner self) tracking-options) + (the-as int (-> (the-as camera-slave gp-1) options)) + ) + (set! + (-> (the-as camera-combiner self) tracking no-follow) + (-> (the-as camera-slave gp-1) tracking no-follow) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + tilt-adjust + ) + (-> (the-as camera-slave gp-1) tracking tilt-adjust) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + underwater-blend + ) + (-> + (the-as camera-slave gp-1) + tracking + underwater-blend + ) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + use-point-of-interest + ) + (-> + (the-as camera-slave gp-1) + tracking + use-point-of-interest + ) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + point-of-interest + quad + ) + (-> + (the-as camera-slave gp-1) + tracking + point-of-interest + quad + ) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + point-of-interest-blend + ) + (-> + (the-as camera-slave gp-1) + tracking + point-of-interest-blend + ) + ) + (let ((gp-2 (+ (the-as uint gp-1) 108))) + (cam-calc-follow! + (-> (the-as camera-combiner self) tracking) + (the-as vector gp-2) + #f + ) + (slave-set-rotation! + (-> (the-as camera-combiner self) tracking) + (the-as vector gp-2) + (the-as + float + (-> (the-as camera-combiner self) tracking-options) + ) + (-> (the-as camera-combiner self) fov) + #f + ) + ) + ) + ) + ) + ) + ((= v1-0 'copy-tracking) + (cond + ((< arg1 1) + (let ((t9-10 format) + (a0-27 0) + (a1-11 + "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%" + ) + ) + (let ((v1-23 (-> arg3 param 0))) + (rtype-of v1-23) + ) + (t9-10 a0-27 a1-11) + ) + ) + ((let ((t9-11 type-type?) + (v1-24 (-> arg3 param 0)) + ) + (not (t9-11 (rtype-of v1-24) camera-slave)) + ) + (let ((t9-12 format) + (a0-30 0) + (a1-13 + "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%" + ) + (v1-25 (-> arg3 param 0)) + ) + (t9-12 a0-30 a1-13 (rtype-of v1-25)) + ) + ) + ((nonzero? + (-> (the-as camera-combiner self) tracking-status) + ) + #f + ) + (else + (set! + (-> (the-as camera-combiner self) tracking-status) + (the-as uint 1) + ) + (let ((gp-3 (the-as camera-slave (-> arg3 param 0)))) + (set! + (-> (the-as camera-combiner self) tracking-options) + (the-as int (-> gp-3 options)) + ) + (set! + (-> (the-as camera-combiner self) tracking no-follow) + (-> gp-3 tracking no-follow) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + tilt-adjust + ) + (-> gp-3 tracking tilt-adjust) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + underwater-blend + ) + (-> gp-3 tracking underwater-blend) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + follow-off + quad + ) + (-> gp-3 tracking follow-off quad) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + follow-pt + quad + ) + (-> gp-3 tracking follow-pt quad) + ) + (let* + ((a2-17 (-> (the-as camera-combiner self) tracking)) + (a3-3 (-> gp-3 tracking)) + (v1-36 (-> a3-3 inv-mat vector 0 quad)) + (a0-37 (-> a3-3 inv-mat vector 1 quad)) + (a1-16 (-> a3-3 inv-mat vector 2 quad)) + (a3-4 (-> a3-3 inv-mat vector 3 quad)) + ) + (set! (-> a2-17 inv-mat vector 0 quad) v1-36) + (set! (-> a2-17 inv-mat vector 1 quad) a0-37) + (set! (-> a2-17 inv-mat vector 2 quad) a1-16) + (set! (-> a2-17 inv-mat vector 3 quad) a3-4) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + use-point-of-interest + ) + (-> gp-3 tracking use-point-of-interest) + ) + (set! + (-> + (the-as camera-combiner self) + tracking + point-of-interest + quad + ) + (-> gp-3 tracking point-of-interest quad) + ) + (copy-cam-float-seeker + (-> + (the-as camera-combiner self) + tracking + point-of-interest-blend + ) + (-> gp-3 tracking point-of-interest-blend) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! + (-> v1-0 code) + (lambda :behavior camera-combiner + () + (local-vars (sv-160 cam-rotation-tracker)) + (while #t + (when + (and + (zero? (logand (-> *camera* master-options) 2)) + (!= (-> self tracking-status) 0) + ) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + (when *camera* + (let ((s5-0 (-> *camera* slave 0)) + (s4-0 (-> *camera* slave 1)) + (f30-0 (parameter-ease-sin-clamp (-> self interp-val))) + (gp-0 (new-stack-vector0)) + ) + (set! (-> gp-0 quad) (-> self trans quad)) + (when s5-0 + (cond + (s4-0 + (vector-lerp-clamp! + (-> self trans) + (-> s5-0 0 trans) + (-> s4-0 0 trans) + f30-0 + ) + (set! + (-> self fov) + (lerp-clamp (-> s5-0 0 fov) (-> s4-0 0 fov) f30-0) + ) + (set! + (-> self dist-from-src) + (vector-vector-distance (-> self trans) (-> s5-0 0 trans)) + ) + (set! + (-> self dist-from-dest) + (vector-vector-distance (-> self trans) (-> s4-0 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) + #t + ) + (let* ((a2-4 (-> self inv-camera-rot)) + (a3-2 (-> self tracking)) + (v1-20 (-> a3-2 inv-mat vector 0 quad)) + (a0-10 (-> a3-2 inv-mat vector 1 quad)) + (a1-6 (-> a3-2 inv-mat vector 2 quad)) + (a3-3 (-> a3-2 inv-mat vector 3 quad)) + ) + (set! (-> a2-4 vector 0 quad) v1-20) + (set! (-> a2-4 vector 1 quad) a0-10) + (set! (-> a2-4 vector 2 quad) a1-6) + (set! (-> a2-4 vector 3 quad) a3-3) + ) + ) + (else + (set! sv-160 (-> s5-0 0 tracking)) + (let ((s2-0 (-> s5-0 0 trans)) + (s5-1 (-> s4-0 0 tracking)) + (s0-0 (-> s4-0 0 trans)) + ) + (cond + ((= (-> self tracking-status) 3) + (cam-calc-follow! (-> self tracking) s2-0 #t) + (slave-set-rotation! + (-> self tracking) + s2-0 + (the-as float (-> self tracking-options)) + (-> self fov) + #t + ) + (set! sv-160 (-> self tracking)) + (set! s2-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! s5-1 (-> self tracking)) + (set! s0-0 (-> self trans)) + ) + ) + (let ((s1-0 (new 'stack-no-clear 'matrix))) + (dotimes (v1-35 3) + (set! (-> s1-0 vector v1-35 quad) (the-as uint128 0)) + ) + 0.0 + 0.0 + 0.0 + (let ((s4-1 (new-stack-vector0))) + 0.0 + (let ((s3-0 (new-stack-matrix0))) + (vector-! + (the-as vector (-> s1-0 vector)) + (the-as vector (-> sv-160 inv-mat)) + (the-as vector (-> s5-1 inv-mat)) + ) + (vector-! + (-> s1-0 vector 1) + (-> sv-160 inv-mat vector 1) + (-> s5-1 inv-mat vector 1) + ) + (vector-! + (-> s1-0 vector 2) + (-> sv-160 inv-mat vector 2) + (-> s5-1 inv-mat vector 2) + ) + (let ((f26-0 (vector-length (the-as vector (-> s1-0 vector)))) + (f28-0 (vector-length (-> s1-0 vector 1))) + (f0-13 (vector-length (-> s1-0 vector 2))) + ) + (cond + ((and (< f26-0 f28-0) (< f26-0 f0-13)) + (vector-cross! s4-1 (-> s1-0 vector 1) (-> s1-0 vector 2)) + ) + ((and (< f28-0 f26-0) (< f28-0 f0-13)) + (vector-cross! + s4-1 + (the-as vector (-> s1-0 vector)) + (-> s1-0 vector 2) + ) + ) + (else + (vector-cross! + s4-1 + (the-as vector (-> s1-0 vector)) + (-> s1-0 vector 1) + ) + ) + ) + ) + (vector-normalize! s4-1 1.0) + (let + ((f0-16 + (fabs (vector-dot (the-as vector (-> sv-160 inv-mat)) s4-1)) + ) + (f1-2 (fabs (vector-dot (-> sv-160 inv-mat vector 1) s4-1))) + (f2-2 (fabs (vector-dot (-> sv-160 inv-mat vector 2) s4-1))) + ) + (cond + ((and (< f0-16 f1-2) (< f0-16 f2-2)) + (vector-flatten! + (the-as vector (-> s1-0 vector)) + (the-as vector (-> sv-160 inv-mat)) + s4-1 + ) + (vector-flatten! + (-> s1-0 vector 1) + (the-as vector (-> s5-1 inv-mat)) + s4-1 + ) + ) + ((< f1-2 f2-2) + (vector-flatten! + (the-as vector (-> s1-0 vector)) + (-> sv-160 inv-mat vector 1) + s4-1 + ) + (vector-flatten! + (-> s1-0 vector 1) + (-> s5-1 inv-mat vector 1) + s4-1 + ) + ) + (else + (vector-flatten! + (the-as vector (-> s1-0 vector)) + (-> sv-160 inv-mat vector 2) + s4-1 + ) + (vector-flatten! + (-> s1-0 vector 1) + (-> s5-1 inv-mat vector 2) + s4-1 + ) + ) + ) + ) + (vector-normalize! (the-as vector (-> s1-0 vector)) 1.0) + (vector-normalize! (-> s1-0 vector 1) 1.0) + (vector-cross! + (-> s1-0 vector 2) + (the-as vector (-> s1-0 vector)) + (-> s1-0 vector 1) + ) + (if (< (vector-dot (-> s1-0 vector 2) s4-1) 0.0) + (vector-negate! s4-1 s4-1) + ) + (let + ((f28-1 + (acos + (vector-dot + (the-as vector (-> s1-0 vector)) + (-> s1-0 vector 1) + ) + ) + ) + ) + (cond + ((logtest? (-> *camera* master-options) 8) + (set! + (-> *camera* master-options) + (logand -25 (-> *camera* master-options)) + ) + (when + (and + (< 8192.0 f28-1) + (nonzero? (logand (-> *camera* master-options) 2)) + ) + (vector-! + (the-as vector (-> s1-0 vector)) + (-> *camera* tpos-curr) + s2-0 + ) + (vector-! (-> s1-0 vector 1) s0-0 s2-0) + (vector-flatten! + (the-as vector (-> s1-0 vector)) + (the-as vector (-> s1-0 vector)) + (-> *camera* local-down) + ) + (vector-flatten! + (-> s1-0 vector 1) + (-> s1-0 vector 1) + (-> *camera* local-down) + ) + (when + (and + (< + 4096.0 + (vector-normalize-ret-len! + (the-as vector (-> s1-0 vector)) + 1.0 + ) + ) + (< + 4096.0 + (vector-normalize-ret-len! (-> s1-0 vector 1) 1.0) + ) + ) + (vector-cross! + (-> s1-0 vector 2) + (-> s1-0 vector 1) + (the-as vector (-> s1-0 vector)) + ) + (when (< (vector-dot (-> s1-0 vector 2) s4-1) -0.01) + ) + ) + ) + ) + ((and + (< 16384.0 f28-1) + (< (vector-dot (-> self flip-control-axis) s4-1) 0.0) + ) + (set! + (-> *camera* master-options) + (logxor (-> *camera* master-options) 16) + ) + ) + ) + (set! (-> self flip-control-axis quad) (-> s4-1 quad)) + (when (logtest? (-> *camera* master-options) 16) + (set! f28-1 (- 65536.0 f28-1)) + (vector-negate! s4-1 s4-1) + ) + (let ((f30-1 (* f28-1 (- 1.0 f30-0)))) + (matrix-axis-sin-cos! s3-0 s4-1 (sin f30-1) (cos f30-1)) + ) + ) + (matrix*! (-> self inv-camera-rot) (the-as matrix s5-1) s3-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) (-> *display* time-adjust-ratio)) + ) + ) + ) + (when (>= (-> self interp-val) 1.0) + (deactivate (-> *camera* slave 0 0)) + (set! (-> *camera* slave 0) (-> *camera* slave 1)) + (set! (-> *camera* slave 1) (the-as (pointer camera-slave) #f)) + (+! (-> *camera* num-slaves) -1) + ) + ) + (else + (set! (-> self dist-from-src) 409600.0) + (set! (-> self dist-from-dest) 0.0) + (set! (-> self trans quad) (-> s5-0 0 trans quad)) + (set! (-> self fov) (-> s5-0 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) + #t + ) + (let* ((v1-143 (-> self inv-camera-rot)) + (a3-8 (-> self tracking)) + (a0-80 (-> a3-8 inv-mat vector 0 quad)) + (a1-45 (-> a3-8 inv-mat vector 1 quad)) + (a2-21 (-> a3-8 inv-mat vector 2 quad)) + (a3-9 (-> a3-8 inv-mat vector 3 quad)) + ) + (set! (-> v1-143 vector 0 quad) a0-80) + (set! (-> v1-143 vector 1 quad) a1-45) + (set! (-> v1-143 vector 2 quad) a2-21) + (set! (-> v1-143 vector 3 quad) a3-9) + ) + ) + (else + (let* ((v1-144 (-> self inv-camera-rot)) + (a3-10 (-> s5-0 0 tracking)) + (a0-82 (-> a3-10 inv-mat vector 0 quad)) + (a1-46 (-> a3-10 inv-mat vector 1 quad)) + (a2-22 (-> a3-10 inv-mat vector 2 quad)) + (a3-11 (-> a3-10 inv-mat vector 3 quad)) + ) + (set! (-> v1-144 vector 0 quad) a0-82) + (set! (-> v1-144 vector 1 quad) a1-46) + (set! (-> v1-144 vector 2 quad) a2-22) + (set! (-> v1-144 vector 3 quad) a3-11) + ) + ) + ) + ) + ) + ) + (vector-! (-> self velocity) (-> self trans) gp-0) + ) + ) + (if (and *dproc* *debug-segment*) + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'camera + (new 'static 'rgba :b #xff :a #x80) + ) + ) + (suspend) + ) + (none) + ) + ) + ) + +;; definition for function cam-combiner-init +;; INFO: Return type mismatch int vs none. +(defbehavior cam-combiner-init camera-combiner () + (stack-size-set! (-> self main-thread) 512) + (set! *camera-combiner* self) + (vector-reset! (-> self trans)) + (matrix-identity! (-> self inv-camera-rot)) + (if *math-camera* + (set! (-> self fov) (-> *math-camera* fov)) + (set! (-> self fov) 11650.845) + ) + (set! (-> self interp-val) 0.0) + (set! (-> self interp-step) 0.125) + (set! (-> self tracking-status) (the-as uint 0)) + (vector-reset! (-> self velocity)) + (let ((t9-2 (the-as (function object) enter-state))) + (set! (-> self next-state) cam-combiner-active) + (t9-2) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/engine/camera/cam-interface_REF.gc b/test/decompiler/reference/engine/camera/cam-interface_REF.gc index f85fcdf4da..437e3e09fb 100644 --- a/test/decompiler/reference/engine/camera/cam-interface_REF.gc +++ b/test/decompiler/reference/engine/camera/cam-interface_REF.gc @@ -26,19 +26,17 @@ (define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector))) ;; definition for function camera-pos -;; INFO: Return type mismatch object vs vector. (defun camera-pos () - (the-as vector (cond - (*camera-combiner* - (-> *camera-combiner* stack) - ) - (*math-camera* - (-> *math-camera* trans) - ) - (else - *camera-dummy-vector* - ) - ) + (cond + (*camera-combiner* + (-> *camera-combiner* trans) + ) + (*math-camera* + (-> *math-camera* trans) + ) + (else + *camera-dummy-vector* + ) ) ) diff --git a/test/decompiler/reference/engine/camera/cam-start_REF.gc b/test/decompiler/reference/engine/camera/cam-start_REF.gc new file mode 100644 index 0000000000..e174bf86c6 --- /dev/null +++ b/test/decompiler/reference/engine/camera/cam-start_REF.gc @@ -0,0 +1,74 @@ +;;-*-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) + (let ((v0-3 cam-string)) + (set! *camera-base-mode* v0-3) + v0-3 + ) + ) + +;; definition for function cam-start +;; INFO: Return type mismatch int vs none. +(defun cam-start ((arg0 symbol)) + (cam-stop) + (let ((s5-0 (get-process *camera-dead-pool* camera-combiner #x4000))) + (when s5-0 + (let ((t9-2 (method-of-type camera-combiner activate))) + (t9-2 + (the-as camera-combiner s5-0) + *camera-pool* + 'camera-combiner + (the-as pointer #x70004000) + ) + ) + ((the-as (function process object function) run-function-in-process) + s5-0 + cam-combiner-init + ) + (-> s5-0 ppointer) + ) + ) + (let* ((s5-1 (get-process *camera-master-dead-pool* camera-master #x4000)) + (v1-5 (when s5-1 + (let ((t9-5 (method-of-type camera-master activate))) + (t9-5 + (the-as camera-master s5-1) + *camera-pool* + 'camera-master + (the-as pointer #x70004000) + ) + ) + ((the-as (function process object function) set-to-run) + (the-as process (-> s5-1 main-thread)) + cam-master-init + ) + (-> s5-1 ppointer) + ) + ) + ) + (set! *camera* (the-as camera-master (if v1-5 + (-> v1-5 0 self) + ) + ) + ) + ) + (if arg0 + (reset-cameras) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(cam-start #f) + + + + diff --git a/test/decompiler/reference/engine/camera/cam-update_REF.gc b/test/decompiler/reference/engine/camera/cam-update_REF.gc new file mode 100644 index 0000000000..09dfbc149d --- /dev/null +++ b/test/decompiler/reference/engine/camera/cam-update_REF.gc @@ -0,0 +1,661 @@ +;;-*-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 +;; Used lq/sq +(defun + update-view-planes + ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float)) + (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) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 hither-top-right) + (-> s5-0 hither-top-right) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 hither-bottom-left) + (-> s5-0 hither-bottom-left) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 hither-bottom-right) + (-> s5-0 hither-bottom-right) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 yon-top-left) + (-> s5-0 yon-top-left) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 yon-top-right) + (-> s5-0 yon-top-right) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 yon-bottom-left) + (-> s5-0 yon-bottom-left) + (-> arg0 inv-camera-rot) + ) + (vector-matrix*! + (-> s5-0 yon-bottom-right) + (-> s5-0 yon-bottom-right) + (-> arg0 inv-camera-rot) + ) + (let ((s2-0 (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-5 (-> arg0 inv-camera-rot vector 3 quad))) + (set! (-> sv-240 quad) v1-5) + ) + (vector-! s2-0 (-> 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-0 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-0 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 +(defun update-visible ((arg0 math-camera)) + (local-vars (a0-16 symbol) (s3-0 level-vis-info) (s4-0 level-vis-info)) + (when (not *artist-fix-visible*) + (dotimes (s5-0 (-> *level* length)) + (let ((v1-4 (-> *level* level s5-0))) + (when (= (-> v1-4 status) 'active) + (if + (and + (nonzero? (-> v1-4 bsp nodes)) + (or *update-leaf-when-outside-bsp* (-> v1-4 inside-boxes?)) + ) + (bsp-camera-asm (-> v1-4 bsp) (-> arg0 trans)) + ) + ) + ) + ) + (dotimes (gp-1 (-> *level* length)) + (let ((s5-1 (-> *level* level gp-1))) + (when (= (-> s5-1 status) 'active) + (let ((a2-0 (/ (+ (-> s5-1 bsp visible-list-length) 15) 16))) + (set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?) + (-> s5-1 all-visible?) + #t + ) + ) + (cond + ((or (not (-> s5-1 force-all-visible?)) (-> s5-1 inside-boxes?)) + (cond + ((or *artist-all-visible* (zero? (-> s5-1 bsp nodes))) + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) + ) + ((begin + (set! s4-0 (-> s5-1 vis-info (-> s5-1 vis-self-index))) + (set! s3-0 (-> s5-1 vis-info (-> s5-1 vis-adj-index))) + (let ((v1-32 #f)) + (set! a0-16 #f) + (when s4-0 + (set! v1-32 (nonzero? (logand (shl #x8000 16) (-> s4-0 flags)))) + (if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx)) + (set! v1-32 #f) + ) + ) + (when s3-0 + (set! a0-16 (nonzero? (logand (shl #x8000 16) (-> s3-0 flags)))) + (if (< (-> s3-0 length) (-> s3-0 from-bsp current-leaf-idx)) + (set! a0-16 #f) + ) + ) + v1-32 + ) + ) + (if (!= (-> s5-1 all-visible?) 'loading) + (set! (-> s5-1 all-visible?) #f) + ) + (let* ((a0-19 s5-1) + (t9-2 (method-of-object a0-19 dummy-16)) + (a1-17 s4-0) + (a2-1 (-> s4-0 ramdisk)) + ) + (-> s4-0 string-block) + (when (t9-2 a0-19 (the-as uint a1-17) a2-1) + (countdown (v1-40 8) + (let ((a0-22 (-> s5-1 vis-info v1-40))) + (when a0-22 + (if (!= a0-22 s4-0) + (set! (-> a0-22 current-vis-string) (the-as uint -1)) + ) + ) + ) + ) + (set! (-> s5-1 all-visible?) #f) + ) + ) + ) + (a0-16 + (if (!= (-> s5-1 all-visible?) 'loading) + (set! (-> s5-1 all-visible?) #f) + ) + (let* ((a0-24 s5-1) + (t9-3 (method-of-object a0-24 dummy-16)) + (a1-21 s3-0) + (a2-2 (-> s3-0 ramdisk)) + ) + (-> s3-0 string-block) + (when (t9-3 a0-24 (the-as uint a1-21) a2-2) + (countdown (v1-50 8) + (let ((a0-27 (-> s5-1 vis-info v1-50))) + (when a0-27 + (if (!= a0-27 s3-0) + (set! (-> a0-27 current-vis-string) (the-as uint -1)) + ) + ) + ) + ) + (set! (-> s5-1 all-visible?) #f) + ) + ) + ) + ((and (= (-> s5-1 all-visible?) 'loading) (-> *level* play?)) + ) + (else + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) + ) + ) + ) + (else + (quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0) + ) + ) + ) + (if (and *stats-bsp* (= *master-mode* 'game)) + (format *stdcon* "~0kleaf-index = ~d~%" (-> s5-1 bsp current-leaf-idx)) + ) + ) + ) + ) + #f + ) + ) + +;; 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 +;; 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 + ((s4-1 + (vector-negate-in-place! + (vector-normalize-copy! + (new-stack-vector0) + (-> *standard-dynamics* gravity) + 1.0 + ) + ) + ) + ) + (if (= (vector-length s4-1) 0.0) + (set! (-> s4-1 y) -1.0) + ) + (if (logtest? *external-cam-options* 1) + (set! s4-1 (the-as vector #f)) + ) + (cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) s4-1 s5-0) + ) + ) + ) + (let* ((a2-2 (-> *math-camera* inv-camera-rot)) + (a3-1 *save-camera-inv-rot*) + (v1-11 (-> a3-1 vector 0 quad)) + (a0-14 (-> a3-1 vector 1 quad)) + (a1-2 (-> a3-1 vector 2 quad)) + (a3-2 (-> a3-1 vector 3 quad)) + ) + (set! (-> a2-2 vector 0 quad) v1-11) + (set! (-> a2-2 vector 1 quad) a0-14) + (set! (-> a2-2 vector 2 quad) a1-2) + (set! (-> a2-2 vector 3 quad) a3-2) + ) + arg0 + ) + +;; 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 +;; Used lq/sq +(defun update-camera () + (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 + ) + (dotimes (gp-1 2) + (let ((s5-1 (-> *level* level gp-1))) + (when (!= (-> s5-1 status) 'inactive) + (let ((a0-14 (new-stack-vector0))) + (vector-! + a0-14 + (the-as vector (-> s5-1 info bsphere)) + (-> *math-camera* trans) + ) + (set! + (-> s5-1 level-distance) + (fmax 0.0 (- (vector-length a0-14) (-> s5-1 info bsphere w))) + ) + ) + (when *display-level-spheres* + (add-debug-sphere + #t + (bucket-id debug-draw1) + (-> s5-1 info bsphere) + (-> s5-1 info bsphere w) + (new 'static 'rgba :r #xff :a #x80) + ) + (format + *stdcon* + "~f ~f ~f ~f~%" + (* 0.00024414062 (-> s5-1 info bsphere x)) + (* 0.00024414062 (-> s5-1 info bsphere y)) + (* 0.00024414062 (-> s5-1 info bsphere z)) + (* 0.00024414062 (-> s5-1 info bsphere w)) + ) + ) + ) + ) + ) + (update-math-camera + *math-camera* + (-> *setting-control* current video-mode) + (-> *setting-control* current aspect-ratio) + ) + (update! *camera-smush-control*) + (cond + ((or (= *master-mode* 'pause) (= *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 + ) + ) + (cond + (*external-cam-mode* + (move-camera-from-pad *math-camera*) + ) + ((nonzero? *camera-look-through-other*) + (set! (-> *math-camera* fov) (-> *camera-other-fov* data)) + (set! (-> *math-camera* trans quad) (-> *camera-other-trans* quad)) + (+! (-> *math-camera* trans y) (get-no-update *camera-smush-control*)) + (let* ((a2-9 (-> *math-camera* inv-camera-rot)) + (a3-4 *camera-other-matrix*) + (v1-86 (-> a3-4 vector 0 quad)) + (a0-29 (-> a3-4 vector 1 quad)) + (a1-10 (-> a3-4 vector 2 quad)) + (a3-5 (-> a3-4 vector 3 quad)) + ) + (set! (-> a2-9 vector 0 quad) v1-86) + (set! (-> a2-9 vector 1 quad) a0-29) + (set! (-> a2-9 vector 2 quad) a1-10) + (set! (-> a2-9 vector 3 quad) a3-5) + ) + (let* ((a2-10 *save-camera-inv-rot*) + (a3-6 *camera-other-matrix*) + (v1-87 (-> a3-6 vector 0 quad)) + (a0-30 (-> a3-6 vector 1 quad)) + (a1-11 (-> a3-6 vector 2 quad)) + (a3-7 (-> a3-6 vector 3 quad)) + ) + (set! (-> a2-10 vector 0 quad) v1-87) + (set! (-> a2-10 vector 1 quad) a0-30) + (set! (-> a2-10 vector 2 quad) a1-11) + (set! (-> a2-10 vector 3 quad) a3-7) + ) + ) + ((and *camera-combiner* (not *external-cam-mode*)) + (set! (-> *math-camera* fov) (-> *camera-combiner* fov)) + (set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad)) + (+! (-> *math-camera* trans y) (get-no-update *camera-smush-control*)) + (let* ((v1-100 (-> *math-camera* inv-camera-rot)) + (a3-8 (-> *camera-combiner* inv-camera-rot)) + (a0-36 (-> a3-8 vector 0 quad)) + (a1-12 (-> a3-8 vector 1 quad)) + (a2-11 (-> a3-8 vector 2 quad)) + (a3-9 (-> a3-8 vector 3 quad)) + ) + (set! (-> v1-100 vector 0 quad) a0-36) + (set! (-> v1-100 vector 1 quad) a1-12) + (set! (-> v1-100 vector 2 quad) a2-11) + (set! (-> v1-100 vector 3 quad) a3-9) + ) + (let* ((v1-101 *save-camera-inv-rot*) + (a3-10 (-> *camera-combiner* inv-camera-rot)) + (a0-38 (-> a3-10 vector 0 quad)) + (a1-13 (-> a3-10 vector 1 quad)) + (a2-12 (-> a3-10 vector 2 quad)) + (a3-11 (-> a3-10 vector 3 quad)) + ) + (set! (-> v1-101 vector 0 quad) a0-38) + (set! (-> v1-101 vector 1 quad) a1-13) + (set! (-> v1-101 vector 2 quad) a2-12) + (set! (-> v1-101 vector 3 quad) a3-11) + ) + ) + (else + (move-camera-from-pad *math-camera*) + ) + ) + (matrix-transpose! + (-> *math-camera* camera-rot) + (-> *math-camera* inv-camera-rot) + ) + (cond + (*camera-no-mip-correction* + (set! (-> *math-camera* fov-correction-factor) 1.0) + ) + (else + (let ((f0-28 (fmin 11650.845 (-> *math-camera* fov)))) + (set! (-> *math-camera* fov-correction-factor) (* 0.00008583069 f0-28)) + ) + ) + ) + (if (< 0.0 (-> *math-camera* smooth-t)) + (set! + (-> *math-camera* smooth-t) + (- (-> *math-camera* smooth-t) (-> *math-camera* smooth-step)) + ) + ) + (cond + ((< 0.0 (-> *math-camera* smooth-t)) + (let ((gp-2 (new-stack-quaternion0))) + (matrix->quaternion gp-2 (-> *math-camera* inv-camera-rot)) + (quaternion-slerp! + gp-2 + gp-2 + (-> *math-camera* inv-camera-rot-smooth-from) + (-> *math-camera* smooth-t) + ) + (quaternion->matrix (-> *math-camera* inv-camera-rot-smooth) gp-2) + ) + ) + (else + (let* ((v1-124 (-> *math-camera* inv-camera-rot-smooth)) + (a3-13 (-> *math-camera* inv-camera-rot)) + (a0-45 (-> a3-13 vector 0 quad)) + (a1-18 (-> a3-13 vector 1 quad)) + (a2-14 (-> a3-13 vector 2 quad)) + (a3-14 (-> a3-13 vector 3 quad)) + ) + (set! (-> v1-124 vector 0 quad) a0-45) + (set! (-> v1-124 vector 1 quad) a1-18) + (set! (-> v1-124 vector 2 quad) a2-14) + (set! (-> v1-124 vector 3 quad) a3-14) + ) + ) + ) + (if (and (!= *master-mode* 'menu) *display-camera-info*) + (format + *stdcon* + "cam pos ~M ~M ~M~%" + (-> *math-camera* trans x) + (-> *math-camera* trans y) + (-> *math-camera* trans z) + ) + ) + (when (zero? (-> *math-camera* reset)) + (let* ((v1-136 (-> *math-camera* prev-camera-temp)) + (a3-16 (-> *math-camera* camera-temp)) + (a0-50 (-> a3-16 vector 0 quad)) + (a1-20 (-> a3-16 vector 1 quad)) + (a2-16 (-> a3-16 vector 2 quad)) + (a3-17 (-> a3-16 vector 3 quad)) + ) + (set! (-> v1-136 vector 0 quad) a0-50) + (set! (-> v1-136 vector 1 quad) a1-20) + (set! (-> v1-136 vector 2 quad) a2-16) + (set! (-> v1-136 vector 3 quad) a3-17) + ) + ) + (let ((gp-3 (-> *math-camera* camera-temp)) + (s4-1 (-> *math-camera* camera-rot)) + (s5-2 (-> *math-camera* inv-camera-rot)) + (s3-0 (-> *math-camera* trans)) + ) + (let ((s2-0 (new-stack-vector0))) + (set! (-> s2-0 x) (- (-> s3-0 x))) + (set! (-> s2-0 y) (- (-> s3-0 y))) + (set! (-> s2-0 z) (- (-> s3-0 z))) + (set! (-> s2-0 w) 1.0) + (vector-matrix*! s2-0 s2-0 s4-1) + (set! (-> s4-1 vector 3 quad) (-> s2-0 quad)) + ) + (matrix*! gp-3 s4-1 (-> *math-camera* perspective)) + (set! (-> s5-2 vector 3 quad) (-> s3-0 quad)) + ) + (when (nonzero? (-> *math-camera* reset)) + (let* ((v1-148 (-> *math-camera* prev-camera-temp)) + (a3-18 (-> *math-camera* camera-temp)) + (a0-54 (-> a3-18 vector 0 quad)) + (a1-23 (-> a3-18 vector 1 quad)) + (a2-19 (-> a3-18 vector 2 quad)) + (a3-19 (-> a3-18 vector 3 quad)) + ) + (set! (-> v1-148 vector 0 quad) a0-54) + (set! (-> v1-148 vector 1 quad) a1-23) + (set! (-> v1-148 vector 2 quad) a2-19) + (set! (-> v1-148 vector 3 quad) a3-19) + ) + (set! (-> *math-camera* reset) 0) + 0 + ) + (let ((f0-45 (-> *math-camera* fog-min)) + (f1-10 (-> *math-camera* fog-max)) + ) + (let ((f2-0 (-> *math-camera* d))) + (set! (-> *instance-tie-work* hmge-d x) f0-45) + (set! (-> *instance-tie-work* hmge-d y) f1-10) + (set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0)) + (set! + (-> *instance-tie-work* hmge-d w) + (* f2-0 (-> *math-camera* hmge-scale w)) + ) + (let ((v1-160 (-> *math-camera* hvdf-off quad))) + (set! (-> *instance-tie-work* hvdf-offset quad) v1-160) + ) + (set! (-> *instance-shrub-work* hmge-d x) f0-45) + (set! (-> *instance-shrub-work* hmge-d y) f1-10) + (set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0)) + (set! + (-> *instance-shrub-work* hmge-d w) + (* f2-0 (-> *math-camera* hmge-scale w)) + ) + (set! + (-> *instance-shrub-work* billboard-const x) + (/ (-> *math-camera* x-pix) (* f2-0 (-> *math-camera* x-ratio))) + ) + (set! + (-> *instance-shrub-work* billboard-const y) + (/ (-> *math-camera* y-pix) (* f2-0 (-> *math-camera* y-ratio))) + ) + ) + (set! (-> *instance-shrub-work* billboard-const z) f0-45) + (set! (-> *instance-shrub-work* billboard-const w) f1-10) + ) + (set! + (-> *instance-shrub-work* constants w) + (the-as float (-> *math-camera* vis-gifs 0 fog0)) + ) + (let ((a0-56 (-> *math-camera* hvdf-off quad))) + (set! (-> *instance-shrub-work* hvdf-offset quad) a0-56) + ) + (update-view-planes *math-camera* (-> *math-camera* plane) 1.0) + (update-view-planes *math-camera* (-> *math-camera* guard-plane) 4.0) + (set! + (-> *instance-shrub-work* guard-plane 0 quad) + (-> *math-camera* guard-plane 0 quad) + ) + (set! + (-> *instance-shrub-work* guard-plane 1 quad) + (-> *math-camera* guard-plane 1 quad) + ) + (set! + (-> *instance-shrub-work* guard-plane 2 quad) + (-> *math-camera* guard-plane 2 quad) + ) + (set! + (-> *instance-shrub-work* guard-plane 3 quad) + (-> *math-camera* guard-plane 3 quad) + ) + (set! + (-> *instance-tie-work* guard-plane 0 quad) + (-> *math-camera* guard-plane 0 quad) + ) + (set! + (-> *instance-tie-work* guard-plane 1 quad) + (-> *math-camera* guard-plane 1 quad) + ) + (set! + (-> *instance-tie-work* guard-plane 2 quad) + (-> *math-camera* guard-plane 2 quad) + ) + (set! + (-> *instance-tie-work* guard-plane 3 quad) + (-> *math-camera* guard-plane 3 quad) + ) + (update-visible *math-camera*) + (if (not (paused?)) + (update-wind *wind-work* *wind-scales*) + ) + #f + ) diff --git a/test/decompiler/reference/engine/camera/camera-h_REF.gc b/test/decompiler/reference/engine/camera/camera-h_REF.gc index 13fb326a95..2ed008d642 100644 --- a/test/decompiler/reference/engine/camera/camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/camera-h_REF.gc @@ -73,15 +73,15 @@ ;; definition of type cam-index (deftype cam-index (structure) - ((flags uint32 :offset-assert 0) - (vec uint128 2 :offset-assert 16) + ((flags uint32 :offset-assert 0) + (vec vector 2 :inline :offset 16) ) :method-count-assert 11 :size-assert #x30 :flag-assert #xb00000030 (:methods - (dummy-9 () none 9) - (dummy-10 () none 10) + (dummy-9 (_type_ symbol entity vector curve) symbol 9) + (dummy-10 (_type_ vector) float 10) ) ) @@ -156,20 +156,20 @@ :size-assert #x664 :flag-assert #x1800000664 (:methods - (dummy-9 () none 9) - (dummy-10 () none 10) + (TODO-RENAME-9 (_type_) none 9) + (TODO-RENAME-10 (_type_ vector) none 10) (dummy-11 () none 11) (dummy-12 () none 12) - (dummy-13 () none 13) - (dummy-14 () none 14) - (dummy-15 () none 15) - (dummy-16 () none 16) - (dummy-17 () none 17) - (dummy-18 () none 18) - (dummy-19 () none 19) - (dummy-20 () none 20) - (dummy-21 () none 21) - (dummy-22 () none 22) + (TODO-RENAME-13 (_type_ int) none 13) + (TODO-RENAME-14 (_type_ vector) none 14) + (TODO-RENAME-15 (_type_) none 15) + (TODO-RENAME-16 (_type_ float) none 16) + (TODO-RENAME-17 (_type_ vector float float symbol) int 17) + (TODO-RENAME-18 (_type_ float vector tracking-spline-sampler) vector 18) + (TODO-RENAME-19 (_type_ float vector tracking-spline-sampler) vector 19) + (TODO-RENAME-20 (_type_ vector int) none 20) + (TODO-RENAME-21 (_type_ vector float float) vector 21) + (TODO-RENAME-22 (_type_ float) none 22) (dummy-23 () none 23) ) ) @@ -462,7 +462,7 @@ (let ((t9-0 (method-of-type process inspect))) (t9-0 obj) ) - (format #t "~T~Ttrans: ~`vector`P~%" (-> obj stack)) + (format #t "~T~Ttrans: ~`vector`P~%" (-> obj trans)) (format #t "~T~Tinv-camera-rot: ~`matrix`P~%" (-> obj inv-camera-rot)) (format #t "~T~Tfov: ~f~%" (-> obj fov)) (format #t "~T~Tinterp-val: ~f~%" (-> obj interp-val)) @@ -490,6 +490,7 @@ (fov-index cam-index :inline :offset-assert 144) (tracking cam-rotation-tracker :inline :offset-assert 192) (view-off-param float :offset-assert 400) + (unknown-symbol symbol :offset 412) (view-off vector :inline :offset-assert 416) (min-z-override float :offset-assert 432) (view-flat vector :inline :offset-assert 448) @@ -502,7 +503,7 @@ (max-angle-offset float :offset-assert 2192) (max-angle-curr float :offset-assert 2196) (options uint32 :offset-assert 2200) - (cam-entity basic :offset-assert 2204) + (cam-entity entity :offset-assert 2204) (velocity vector :inline :offset-assert 2208) (desired-pos vector :inline :offset-assert 2224) (time-dist-too-far uint32 :offset-assert 2240) @@ -524,7 +525,7 @@ (spline-tt float :offset-assert 2480) (spline-follow-dist float :offset-assert 2484) (change-event-from uint32 :offset-assert 2488) - (enter-has-run basic :offset-assert 2492) + (enter-has-run symbol :offset-assert 2492) (blend-from-type uint64 :offset-assert 2496) (blend-to-type uint64 :offset-assert 2504) (have-phony-joystick basic :offset-assert 2512) @@ -545,7 +546,7 @@ (let ((t9-0 (method-of-type process inspect))) (t9-0 obj) ) - (format #t "~T~Ttrans: ~`vector`P~%" (-> obj stack)) + (format #t "~T~Ttrans: ~`vector`P~%" (-> obj trans)) (format #t "~T~Tfov: ~f~%" (-> obj fov)) (format #t "~T~Tfov0: ~f~%" (-> obj fov0)) (format #t "~T~Tfov1: ~f~%" (-> obj fov1)) @@ -608,59 +609,59 @@ ;; definition of type camera-master (deftype camera-master (process) - ((master-options uint32 :offset-assert 112) - (num-slaves int32 :offset-assert 116) - (slave basic 2 :offset-assert 120) - (slave-options uint32 :offset-assert 128) - (view-off-param-save float :offset-assert 132) - (changer uint32 :offset-assert 136) - (cam-entity basic :offset-assert 140) - (stringMinLength float :offset-assert 144) - (stringMaxLength float :offset-assert 148) - (stringMinHeight float :offset-assert 152) - (stringMaxHeight float :offset-assert 156) - (string-min cam-vector-seeker :inline :offset-assert 160) - (string-max cam-vector-seeker :inline :offset-assert 224) - (string-push-z float :offset-assert 284) - (stringCliffHeight float :offset-assert 288) - (no-intro uint32 :offset-assert 292) - (force-blend uint32 :offset-assert 296) - (force-blend-time uint32 :offset-assert 300) - (local-down vector :inline :offset-assert 304) - (drawable-target uint64 :offset-assert 320) - (which-bone int32 :offset-assert 328) - (pov-handle uint64 :offset-assert 336) - (pov-bone int32 :offset-assert 344) - (being-attacked basic :offset-assert 348) - (attack-start uint64 :offset-assert 352) - (on-ground basic :offset-assert 360) - (under-water int32 :offset-assert 364) - (on-pole basic :offset-assert 368) - (tgt-rot-mat matrix :inline :offset-assert 384) - (tgt-face-mat matrix :inline :offset-assert 448) - (tpos-old vector :inline :offset-assert 512) - (tpos-curr vector :inline :offset-assert 528) - (target-height float :offset-assert 544) - (tpos-old-adj vector :inline :offset-assert 560) - (tpos-curr-adj vector :inline :offset-assert 576) - (tpos-tgt vector :inline :offset-assert 592) - (upspeed float :offset-assert 608) - (pitch-off vector :inline :offset-assert 624) - (foot-offset float :offset-assert 640) - (head-offset float :offset-assert 644) - (target-spline tracking-spline :inline :offset-assert 656) - (ease-from vector :inline :offset-assert 2304) - (ease-t float :offset-assert 2320) - (ease-step float :offset-assert 2324) - (ease-to vector :inline :offset-assert 2336) - (outro-curve curve :inline :offset-assert 2352) - (outro-t float :offset-assert 2372) - (outro-t-step float :offset-assert 2376) - (outro-exit-value float :offset-assert 2380) - (water-drip-time uint64 :offset-assert 2384) - (water-drip basic :offset-assert 2392) - (water-drip-mult float :offset-assert 2396) - (water-drip-speed float :offset-assert 2400) + ((master-options uint32 :offset-assert 112) + (num-slaves int32 :offset-assert 116) + (slave (pointer camera-slave) 2 :offset-assert 120) + (slave-options uint32 :offset-assert 128) + (view-off-param-save float :offset-assert 132) + (changer uint32 :offset-assert 136) + (cam-entity entity :offset-assert 140) + (stringMinLength float :offset-assert 144) + (stringMaxLength float :offset-assert 148) + (stringMinHeight float :offset-assert 152) + (stringMaxHeight float :offset-assert 156) + (string-min cam-vector-seeker :inline :offset-assert 160) + (string-max cam-vector-seeker :inline :offset-assert 224) + (string-push-z float :offset-assert 284) + (stringCliffHeight float :offset-assert 288) + (no-intro uint32 :offset-assert 292) + (force-blend uint32 :offset-assert 296) + (force-blend-time uint32 :offset-assert 300) + (local-down vector :inline :offset-assert 304) + (drawable-target uint64 :offset-assert 320) + (which-bone int32 :offset-assert 328) + (pov-handle uint64 :offset-assert 336) + (pov-bone int32 :offset-assert 344) + (being-attacked basic :offset-assert 348) + (attack-start uint64 :offset-assert 352) + (on-ground basic :offset-assert 360) + (under-water int32 :offset-assert 364) + (on-pole basic :offset-assert 368) + (tgt-rot-mat matrix :inline :offset-assert 384) + (tgt-face-mat matrix :inline :offset-assert 448) + (tpos-old vector :inline :offset-assert 512) + (tpos-curr vector :inline :offset-assert 528) + (target-height float :offset-assert 544) + (tpos-old-adj vector :inline :offset-assert 560) + (tpos-curr-adj vector :inline :offset-assert 576) + (tpos-tgt vector :inline :offset-assert 592) + (upspeed float :offset-assert 608) + (pitch-off vector :inline :offset-assert 624) + (foot-offset float :offset-assert 640) + (head-offset float :offset-assert 644) + (target-spline tracking-spline :inline :offset-assert 656) + (ease-from vector :inline :offset-assert 2304) + (ease-t float :offset-assert 2320) + (ease-step float :offset-assert 2324) + (ease-to vector :inline :offset-assert 2336) + (outro-curve curve :inline :offset-assert 2352) + (outro-t float :offset-assert 2372) + (outro-t-step float :offset-assert 2376) + (outro-exit-value float :offset-assert 2380) + (water-drip-time uint64 :offset-assert 2384) + (water-drip basic :offset-assert 2392) + (water-drip-mult float :offset-assert 2396) + (water-drip-speed float :offset-assert 2400) ) :heap-base #x900 :method-count-assert 14 diff --git a/test/decompiler/reference/engine/camera/camera_REF.gc b/test/decompiler/reference/engine/camera/camera_REF.gc new file mode 100644 index 0000000000..24a23e8088 --- /dev/null +++ b/test/decompiler/reference/engine/camera/camera_REF.gc @@ -0,0 +1,2424 @@ +;;-*-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 +;; 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 + ((method-of-type res-lump get-property-struct) + arg0 + arg2 + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + (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 + #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 +(defun cam-slave-get-flags ((arg0 entity) (arg1 symbol)) + (let + ((gp-0 + ((method-of-type res-lump get-property-value) + arg0 + arg1 + 'interp + -1000000000.0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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* + ) + ) + ) + (logclear (logior gp-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 + ((method-of-type res-lump get-property-value-float) + arg0 + arg1 + 'interp + -1000000000.0 + arg2 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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 + ((method-of-type res-lump get-property-value-float) + arg0 + 'fov + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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 + ((method-of-type res-lump get-property-value-float) + arg0 + 'intro-time + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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 + ((method-of-type res-lump get-property-value-float) + arg0 + 'interpTime + 'interp + -1000000000.0 + 0.0 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s5-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'interpTime '-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.001 f0-1) + (set! f0-1 0.0) + ) + f0-1 + ) + ) + ) + +;; definition for function cam-slave-get-rot +(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 quaternion)) + (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 + #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 (the-as matrix arg1) s4-1) + ) + ) + (else + (quaternion->matrix (the-as 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 #f) + ) + (((method-of-type res-lump get-property-struct) + arg0 + 'pivot + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + cam-circular + ) + (((method-of-type res-lump get-property-struct) + arg0 + 'align + 'interp + -1000000000.0 + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + 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)) + *camera-base-mode* + ) + (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-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 +;; Used lq/sq +(defmethod + dummy-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 uint (cam-slave-get-flags arg1 (string->symbol *res-key-string*))) + ) + (let + ((s3-2 + ((method-of-type res-lump get-property-data) + arg1 + arg0 + 'interp + -1000000000.0 + (the-as pointer #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (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 + #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) + (-> (the-as (pointer uint128) (&+ (-> arg3 cverts) 0))) + ) + (set! + (-> obj vec 1 quad) + (-> + (the-as + (pointer uint128) + (&+ (-> arg3 cverts) (* (+ (-> arg3 num-cverts) -1) 16)) + ) + ) + ) + ) + (else + (return #f) + ) + ) + ) + ) + (let ((s4-1 (new-stack-vector0))) + 0.0 + (cond + ((logtest? (-> obj flags) 2) + (vector-! s4-1 (-> obj vec 1) arg2) + (set! (-> obj vec 1 w) (vector-length s4-1)) + (vector-! s4-1 (the-as vector (-> obj vec)) arg2) + (set! (-> obj vec 1 x) (vector-length s4-1)) + (set! (-> obj vec 1 w) (- (-> obj vec 1 w) (-> obj vec 1 x))) + (set! (-> obj vec 0 quad) (-> arg2 quad)) + ) + ((logtest? (-> obj flags) 1) + (vector-! s4-1 (-> obj vec 1) arg2) + (set! (-> obj vec 1 w) (vector-length s4-1)) + (vector-! s4-1 (the-as vector (-> obj vec)) arg2) + (set! (-> obj vec 1 x) (vector-length s4-1)) + (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 +;; Used lq/sq +(defmethod dummy-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) 2) + (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) + (/ (- (vector-length s5-0) (-> obj vec 1 x)) (-> obj vec 1 w)) + ) + ((logtest? (-> obj flags) 1) + (/ (- (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: Return type mismatch int vs none. +;; Used lq/sq +(defmethod TODO-RENAME-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 TODO-RENAME-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)) (the-as uint (* 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)) (the-as uint (* 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 TODO-RENAME-14 tracking-spline ((obj tracking-spline) (arg0 vector)) + (let ((v1-0 (-> obj used-point))) + (set! (-> obj partial-point) (-> arg0 y)) + (when (= (-> obj next-to-last-point) v1-0) + (set! (-> obj summed-len) (-> obj point v1-0 tp-length)) + (if (= (-> arg0 x) (-> obj end-point)) + (set! (-> obj partial-point) 0.99999) + ) + ) + (when (!= (-> arg0 x) v1-0) + (while + (and + (!= (-> obj point v1-0 next) (-> arg0 x)) + (!= (-> 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) (the-as int (-> arg0 x))) + (cond + ((= (-> arg0 x) (-> obj end-point)) + (set! (-> obj partial-point) 0.0) + (set! (-> obj summed-len) 0.0) + ) + ((= (-> arg0 x) (-> 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 TODO-RENAME-15 tracking-spline ((obj tracking-spline)) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (let ((a2-0 (new 'stack-no-clear 'tracking-point))) + (set! (-> s5-0 cur-pt) (-> obj used-point)) + (set! (-> s5-0 partial-pt) (-> obj partial-point)) + (TODO-RENAME-19 obj (-> obj sample-len) (the-as vector 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)) + (the-as uint (* 48 v1-15)) + ) + ) + (the-as + vector + (+ + (the-as uint (the-as vector (-> obj point 0 direction))) + (the-as uint (* 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) + (TODO-RENAME-13 obj a1-1) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 16 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod TODO-RENAME-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)) + (TODO-RENAME-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)) + (the-as uint (* 48 s4-1)) + ) + ) + (the-as + vector + (+ + (the-as uint (the-as vector (-> obj point 0 direction))) + (the-as uint (* 48 v1-11)) + ) + ) + ) + ) + ) + arg0 + ) + (TODO-RENAME-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 +;; Used lq/sq +(defmethod + TODO-RENAME-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)) (the-as uint (* 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)) (the-as uint (* 48 s2-0))) + ) + 1.0 + ) + ) + (if (< (-> obj point s2-0 tp-length) arg1) + (return 0) + ) + (when (and arg3 (= s3-0 -134250495)) + (TODO-RENAME-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) + (TODO-RENAME-16 obj arg2) + ) + ) + ) + ) + 0 + ) + +;; definition for method 18 of type tracking-spline +(defmethod + TODO-RENAME-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 + (while #t + (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 'vector))) + (let ((a2-5 (-> obj point (-> arg2 cur-pt) next))) + (vector-lerp! + s5-0 + (the-as vector (-> obj point (-> arg2 cur-pt))) + (the-as vector (-> obj point a2-5)) + f0-4 + ) + ) + (vector+! arg1 arg1 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)) + ) + ) + ) + (the-as vector #f) + ) + +;; definition for method 19 of type tracking-spline +(defmethod + TODO-RENAME-19 + tracking-spline + ((obj tracking-spline) + (arg0 float) + (arg1 vector) + (arg2 tracking-spline-sampler) + ) + (vector-reset! arg1) + (TODO-RENAME-18 obj arg0 arg1 arg2) + arg1 + ) + +;; definition for method 20 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod + TODO-RENAME-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)) + (f1-9 (* 2.0 f0-2)) + (f28-0 (fmin 1.0 (fmax 0.05 f1-9))) + (v1-8 (-> obj used-point)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (while + (and + (!= v1-8 (-> obj end-point)) + (!= v1-8 (-> obj next-to-last-point)) + (!= v1-8 arg1) + ) + (let ((s1-0 (-> obj point v1-8 next))) + (vector-! + s2-0 + (the-as + vector + (+ (the-as uint (-> obj point 0 direction)) (the-as uint (* 48 s1-0))) + ) + (the-as + vector + (+ (the-as uint (-> obj point 0 direction)) (the-as uint (* 48 v1-8))) + ) + ) + (let* ((f0-4 (vector-normalize-ret-len! s2-0 1.0)) + (f0-5 (* 0.5 f0-4)) + (f26-0 (* (* (fmin 1.0 f0-5) f30-0) (vector-dot arg0 s2-0))) + ) + (let ((f2-7 (vector-dot s2-0 s3-0))) + (cond + ((>= 0.0 f2-7) + ) + (else + (set! f26-0 (* f26-0 (fmax 0.0 (- 0.75 (fabs (* f28-0 f2-7)))))) + ) + ) + ) + (cond + ((< f26-0 0.0) + (if (and *debug-segment* *display-camera-marks*) + (camera-line-rel-len + (-> obj point s1-0) + s2-0 + (* -40.96 f26-0) + (the-as + rgba + (new 'static 'inline-array qword 1 + (new 'static 'qword + :data + (new 'static 'array uint32 4 #xff #xff #x0 #x80) + ) + ) + ) + ) + ) + (vector--float*! arg0 arg0 s2-0 f26-0) + ) + ((and *debug-segment* *display-camera-marks*) + (camera-line-rel-len + (-> obj point s1-0) + s2-0 + (* 40.96 f26-0) + (the-as + rgba + (new 'static 'inline-array qword 1 + (new 'static 'qword + :data + (new 'static 'array uint32 4 #x80 #x80 #x0 #x80) + ) + ) + ) + ) + ) + ) + ) + (set! v1-8 s1-0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 21 of type tracking-spline +;; Used lq/sq +(defmethod + TODO-RENAME-21 + tracking-spline + ((obj tracking-spline) (arg0 vector) (arg1 float) (arg2 float)) + (let ((v1-0 (-> obj used-point)) + (f0-0 (-> obj partial-point)) + ) + (let ((f1-0 (-> obj summed-len))) + 0.0 + 0.0 + (let* ((f1-1 (- f1-0 (* f0-0 (-> obj point v1-0 tp-length)))) + (f2-5 (* 0.1 f1-1)) + (f2-8 + (* + (fmin arg1 (- f2-5 (-> obj max-move))) + (-> *display* 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* ((f2-14 (- f1-8 (* f0-0 (-> obj point v1-0 tp-length)))) + (f2-16 (fmin 204.8 (- f2-14 (-> obj sample-len)))) + ) + (set! (-> obj sample-len) (fmin 16384.0 (+ (-> obj sample-len) f2-16))) + ) + ) + (let ((s4-0 (new 'stack-no-clear 'tracking-spline-sampler))) + (set! (-> s4-0 cur-pt) v1-0) + (set! (-> s4-0 partial-pt) f0-0) + (TODO-RENAME-19 + obj + (* (-> obj max-move) (-> *display* time-adjust-ratio)) + arg0 + s4-0 + ) + (TODO-RENAME-14 obj (the-as vector s4-0)) + (dotimes (s3-0 63) + (TODO-RENAME-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)) + (TODO-RENAME-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 TODO-RENAME-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) + (TODO-RENAME-19 obj (- (-> obj summed-len) arg0) a2-0 s5-0) + ) + (TODO-RENAME-14 obj (the-as vector s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type tracking-spline +;; INFO: Return type mismatch int vs none. +(defmethod TODO-RENAME-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 +;; Used lq/sq +(defbehavior cam-slave-init-vars camera-slave () + (cond + (*camera* + (set! (-> self options) (-> *camera* slave-options)) + (set! (-> self change-event-from) (-> *camera* changer)) + ) + (else + (set! (-> self options) (the-as uint 0)) + (set! (-> self change-event-from) (the-as uint #f)) + ) + ) + (cond + (*camera-combiner* + (set! (-> self trans quad) (-> *camera-combiner* trans quad)) + (let* ((v1-9 (-> 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 vector 3 quad)) + ) + (set! (-> v1-9 inv-mat vector 0 quad) a0-1) + (set! (-> v1-9 inv-mat vector 1 quad) a1-0) + (set! (-> v1-9 inv-mat vector 2 quad) a2-0) + (set! (-> v1-9 inv-mat vector 3 quad) a3-1) + ) + (when *camera-init-mat* + (let* ((a2-1 (-> self tracking)) + (a3-2 *camera-init-mat*) + (v1-12 (-> a3-2 vector 0 quad)) + (a0-2 (-> a3-2 vector 1 quad)) + (a1-1 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad)) + ) + (set! (-> a2-1 inv-mat vector 0 quad) v1-12) + (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 vector 3 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) (the-as uint 0)) + (set! (-> self enter-has-run) #f) + (set! (-> self cam-entity) #f) + (set! (-> self tracking no-follow) #f) + (init-cam-float-seeker + (-> self tracking tilt-adjust) + (-> *CAMERA-bank* default-tilt-adjust) + 9.102222 + 91.022224 + 0.25 + ) + (set! (-> self tracking follow-blend) 1.0) + (set! (-> self have-phony-joystick) #f) + (set! (-> self string-val-locked) #f) + (init-cam-float-seeker + (-> self tracking point-of-interest-blend) + 0.0 + 0.005 + 0.02 + 0.125 + ) + (init-cam-float-seeker + (-> self tracking underwater-blend) + 0.0 + 0.007 + 0.03 + 0.125 + ) + (set! (-> self tracking use-point-of-interest) #f) + (TODO-RENAME-10 (-> self position-spline) (-> self trans)) + (none) + ) + +;; definition for function cam-slave-go +;; INFO: Return type mismatch int vs none. +(defun cam-slave-go ((arg0 camera-slave)) + (with-pp + (cam-slave-init-vars) + (let ((t9-1 (the-as (function object) enter-state))) + (set! (-> pp next-state) (the-as state arg0)) + (t9-1) + ) + 0 + (none) + ) + ) + +;; definition for function cam-slave-init +;; INFO: Return type mismatch int vs none. +(defbehavior cam-slave-init camera-slave ((arg0 state) (arg1 entity)) + (stack-size-set! (-> self main-thread) 512) + (change-to-last-brother self) + (if (and (nonzero? camera-slave-debug) *debug-segment*) + (add-connection *debug-engine* self camera-slave-debug self #f #f) + ) + (cam-slave-init-vars) + (let ((v1-7 'cam-voicebox) + (a0-4 (-> arg0 name)) + ) + (cond + ((= a0-4 v1-7) + ) + (arg1 + (set! (-> self cam-entity) arg1) + ) + (else + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) self) + (set! (-> a1-3 num-params) 1) + (set! (-> a1-3 message) 'slave-activated) + (set! (-> a1-3 param 0) (the-as uint self)) + (let ((t9-4 send-event-function)) + (set! a0-4 *camera*) + (t9-4 (the-as process a0-4) a1-3) + ) + ) + ) + ) + (let ((t9-5 (the-as (function object object) (-> arg0 enter)))) + (if t9-5 + (t9-5 a0-4) + ) + ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> arg0 event)) + (let ((t9-6 (the-as (function object object) enter-state))) + (set! (-> self next-state) arg0) + (t9-6 a0-4) + ) + ) + 0 + (none) + ) + +;; definition for function cam-standard-event-handler +;; INFO: Return type mismatch none vs object. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? +;; Used lq/sq +(defbehavior + cam-standard-event-handler camera-slave + ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'go) + (let ((v1-1 (-> arg3 param 0)) + (t9-0 (the-as (function object) enter-state)) + ) + (set! (-> self next-state) (the-as state v1-1)) + (t9-0) + ) + ) + ((or (= v1-0 'change-state) (= v1-0 'change-state-no-go)) + (let ((s5-0 (the-as object (-> arg3 param 0)))) + (cam-slave-init-vars) + (let + ((t9-2 + (the-as + (function object) + (-> (the-as state s5-0) enter) + ) + ) + ) + (if t9-2 + (t9-2) + ) + ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> (the-as state s5-0) event)) + (when (= arg2 'change-state) + (let ((t9-3 (the-as (function object) enter-state))) + (set! (-> self next-state) (the-as state s5-0)) + (t9-3) + ) + ) + ) + ) + ((= v1-0 'point-of-interest) + (the-as none (cond + ((-> arg3 param 0) + (set! + (-> self tracking use-point-of-interest) + #t + ) + (set! + (-> self tracking point-of-interest quad) + (-> (the-as vector (-> arg3 param 0)) quad) + ) + (let ((f0-0 1.0)) + (set! + (-> + self + tracking + point-of-interest-blend + target + ) + f0-0 + ) + f0-0 + ) + ) + (else + (set! + (-> self tracking use-point-of-interest) + #f + ) + (let ((f0-1 0.0)) + (set! + (-> + self + tracking + point-of-interest-blend + target + ) + f0-1 + ) + f0-1 + ) + ) + ) + ) + ) + ((= v1-0 'teleport) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + ) + ) + ) + ) + ) + +;; definition for function cam-curve-pos +;; 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) (-> *display* 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 + (dummy-10 (-> self index) (-> self tracking follow-pt)) + (dummy-10 (-> self index) (-> *camera* tpos-curr-adj)) + ) + ) + ) + (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)) + (dummy-9 + (-> self index) + 'campoints + (-> self cam-entity) + arg0 + (-> self spline-curve) + ) + (set! (-> self spline-exists) #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 (nonzero? (-> *camera* no-intro)) + (set! (-> self intro-t) 1.0) + ) + 0 + (none) + ) + +;; definition for function cam-calc-follow! +;; Used lq/sq +(defun cam-calc-follow! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) + (with-pp + (cond + (arg2 + (update! (-> arg0 tilt-adjust) 0.0) + (update! (-> arg0 point-of-interest-blend) 0.0) + (update! (-> arg0 underwater-blend) 0.0) + ) + (else + (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) + ) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) pp) + (set! (-> a1-7 num-params) 1) + (set! (-> a1-7 message) 'slave-option?) + (set! (-> a1-7 param 0) (the-as uint #x4000)) + (cond + ((send-event-function *camera* a1-7) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (f30-0 + (vector-vector-distance + (-> *camera* tpos-curr-adj) + (-> *camera* tpos-old-adj) + ) + ) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (vector-flatten! + s3-0 + (-> *camera* tgt-face-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s3-0 1.0) + (vector-! s2-0 (-> *camera* tpos-curr-adj) arg1) + (vector-flatten! s2-0 s2-0 (-> *camera* local-down)) + (vector-normalize! s2-0 1.0) + (vector-float*! s5-1 (-> *camera* tgt-face-mat vector 2) 32768.0) + (let* + ((f30-1 + (lerp-clamp + 0.7 + 0.4 + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) + ) + ) + (f0-4 (acos (vector-dot s2-0 s3-0))) + (f28-0 (fmax 1820.4445 f0-4)) + ) + (if (< f28-0 8192.0) + (vector-float*! + s5-1 + s5-1 + (+ + 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-18 (-> arg0 follow-blend)) + (f0-19 (* f0-18 f0-18)) + (f0-20 (* f0-19 f0-19)) + ) + (vector-! s5-1 s5-1 (-> arg0 follow-off)) + (vector-float*! s5-1 s5-1 f0-20) + ) + (+! + (-> arg0 follow-blend) + (* 0.016666668 (-> *display* time-adjust-ratio)) + ) + (vector+! (-> arg0 follow-off) (-> arg0 follow-off) s5-1) + ) + (else + (set! (-> arg0 follow-off quad) (-> s5-1 quad)) + ) + ) + ) + (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* target-height)) + ) + ) + (else + 0.0 + (let ((s3-2 (new-stack-vector0))) + (set! (-> arg0 follow-blend) 0.0) + (cond + ((-> arg0 no-follow) + (vector-reset! s3-2) + ) + (else + (vector-! s3-2 (-> *camera* tpos-curr-adj) arg1) + (vector-normalize! s3-2 1.0) + (let* ((f0-28 (vector-dot (-> *camera* tgt-rot-mat vector 2) s3-2)) + (f30-2 (cond + ((< f0-28 0.0) + 1.0 + ) + (else + (let* ((f0-29 (* f0-28 f0-28)) + (f0-30 (- 1.0 f0-29)) + ) + (* f0-30 (* f0-30 f0-30)) + ) + ) + ) + ) + ) + (vector-! s3-2 arg1 (-> *camera* tpos-curr-adj)) + (vector-flatten! s3-2 s3-2 (-> *camera* local-down)) + (let* ((f0-33 (* 0.000022194603 (+ -20480.0 (vector-length s3-2)))) + (f0-34 (fmin 1.0 f0-33)) + (f0-35 (fmax 0.0 f0-34)) + ) + (vector-float*! + s3-2 + (-> *camera* tgt-rot-mat vector 2) + (* (lerp 2048.0 8192.0 f0-35) f30-2) + ) + ) + ) + ) + ) + (if arg2 + (vector-seek-3d-smooth! + (-> arg0 follow-off) + s3-2 + (* 20480.0 (-> *display* seconds-per-frame)) + 0.05 + ) + (set! (-> arg0 follow-off quad) (-> s3-2 quad)) + ) + ) + (vector+! + (-> arg0 follow-pt) + (-> *camera* tpos-curr-adj) + (-> arg0 follow-off) + ) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (-> *camera* target-height) + ) + ) + ) + ) + (-> arg0 follow-pt) + ) + ) + +;; definition for function mat-remove-z-rot +;; 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 ((f30-0 (vector-dot (-> arg0 vector 1) s4-0))) + (when (< f30-0 0.99999) + (vector-cross! s4-0 (-> arg0 vector 1) s4-0) + (let ((f0-4 (vector-length s4-0))) + (if (< 0.0 (vector-dot s4-0 (-> arg0 vector 2))) + (set! f0-4 (- f0-4)) + ) + (matrix-axis-sin-cos! s5-0 (-> arg0 vector 2) f0-4 f30-0) + ) + (matrix*! arg0 arg0 s5-0) + ) + ) + ) + ) + arg0 + ) + +;; definition for function slave-matrix-blend-2 +;; Used lq/sq +(defun + slave-matrix-blend-2 + ((arg0 matrix) (arg1 float) (arg2 vector) (arg3 matrix)) + (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 (* (* 364.0889 (-> *display* time-adjust-ratio)) f0-3))) + (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 (< (* (* 0.25 (-> *display* time-adjust-ratio)) f28-0) f30-0) + (set! f30-0 (* (* 0.25 (-> *display* time-adjust-ratio)) f28-0)) + ) + (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! +;; 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) + ) + (vector-! s3-0 (-> *camera* tpos-curr) arg1) + (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-6 (* 0.8 (tan (* 0.5 arg2))))) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-6 f0-6)) + (.mov vf2 v1-6) + ) + ) + (.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 1.0) + (let ((f0-8 (vector-dot s2-0 (the-as vector (-> arg0 vector))))) + (when (< f0-8 (fabs f28-0)) + (if (< f28-0 0.0) + (vector--float*! + s2-0 + s2-0 + (the-as vector (-> arg0 vector)) + (* 2.0 f0-8) + ) + ) + (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* 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-15 (* 0.525 (tan (* 0.5 arg2))))) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-23 f0-15)) + (.mov vf2 v1-23) + ) + ) + (.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-17 (vector-dot s2-0 (-> arg0 vector 1)))) + (when (and (< f28-1 0.0) (< f0-17 (- f28-1))) + (vector--float*! s2-0 s2-0 (-> arg0 vector 1) (* 2.0 f0-17)) + (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* 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-25 (* 0.525 (tan (* 0.5 arg2))))) + (vector-float*! s0-1 sv-176 f0-25) + ) + ) + (vector+! s2-0 s2-0 (-> arg0 vector 2)) + (vector-normalize! s2-0 1.0) + (let ((f0-27 (vector-dot s2-0 (-> arg0 vector 1)))) + (cond + ((and (< 0.0 f28-2) (< f0-27 f28-2)) + (set! f30-0 (vector-dot s2-0 s3-0)) + (set! s4-0 #f) + ) + ((< f30-0 0.0) + (let ((f0-32 (- (vector-dot s2-0 s3-0)))) + (if (< f0-32 f30-0) + (set! f30-0 f0-32) + ) + ) + ) + ) + ) + ) + (let ((f0-34 (if s4-0 + (- (acos f30-0)) + (acos f30-0) + ) + ) + ) + (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-34) + ) + ) + ) + (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: Return type mismatch int vs none. +;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +;; Used lq/sq +(defun + slave-set-rotation! + ((arg0 cam-rotation-tracker) + (arg1 vector) + (arg2 float) + (arg3 float) + (arg4 symbol) + ) + (local-vars + (f0-8 float) + (sv-192 vector) + (sv-208 vector) + (sv-224 matrix) + (sv-240 (function matrix vector float vector)) + (sv-256 matrix) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s1-0 (new-stack-vector0)) + (s5-0 (new-stack-matrix0)) + ) + (let ((f30-0 (-> arg0 tilt-adjust value))) + (cond + ((< 0.0001 (-> arg0 point-of-interest-blend value)) + (set! sv-192 (new 'stack-no-clear 'vector)) + 0.0 + (vector-! s1-0 (-> arg0 follow-pt) arg1) + (let ((f28-0 (vector-length s1-0))) + (vector-! sv-192 (-> arg0 point-of-interest) arg1) + (vector-normalize! + sv-192 + (* f28-0 (-> arg0 point-of-interest-blend value)) + ) + (let ((v1-3 s1-0)) + (let ((a0-5 s1-0)) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> a0-5 quad)) + ) + (.lvf vf5 (&-> sv-192 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> v1-3 quad) vf6) + ) + (vector-normalize! s1-0 f28-0) + ) + ) + (else + (vector-! s1-0 (-> arg0 follow-pt) arg1) + ) + ) + (forward-down->inv-matrix s5-0 s1-0 (-> *camera* local-down)) + (when (!= f30-0 0.0) + 0.0 + 0.0 + (set! sv-224 (new 'stack-no-clear 'matrix)) + (set! sv-208 (new 'stack-no-clear 'vector)) + (vector-normalize-copy! sv-208 s1-0 1.0) + (let* ((v1-11 (-> *camera* local-down)) + (f0-7 (-> sv-208 x)) + (f1-1 (-> sv-208 y)) + (f2-0 (-> sv-208 z)) + (f3-0 (-> v1-11 x)) + (f4-0 (-> v1-11 y)) + (f5-0 (-> v1-11 z)) + ) + (.mula.s f0-7 f3-0) + (.madda.s f1-1 f4-0) + (.madd.s f0-8 f2-0 f5-0) + ) + (let* ((f28-1 f0-8) + (f0-10 (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-10))) + (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) + ) + ) + ) + ((< f30-0 0.0) + (set! f30-0 (if (< 0.0 f28-1) + (fmax + f30-0 + (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))) + ) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))) + ) + ) + ) + ) + ) + (matrix-rotate-x! sv-224 f30-0) + (let ((t9-7 matrix*!) + (a0-16 s5-0) + (a2-3 s5-0) + ) + (t9-7 a0-16 sv-224 a2-3) + ) + ) + ) + (if + (and + (= (-> *camera* under-water) 2) + *target* + (!= (-> *target* next-state name) 'target-swim-up) + ) + (set! (-> arg0 underwater-blend target) 1.0) + (set! (-> arg0 underwater-blend target) 0.0) + ) + (set! sv-240 vector-into-frustum-nosmooth!) + (set! sv-256 s5-0) + (let + ((a2-5 (lerp-clamp arg3 (* 0.25 arg3) (-> arg0 underwater-blend value)))) + (sv-240 sv-256 arg1 a2-5) + ) + (cond + (arg4 + (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s1-0 s5-0) + ) + (else + (let* ((v1-31 (-> arg0 inv-mat)) + (a3-2 s5-0) + (a0-22 (-> a3-2 vector 0 quad)) + (a1-16 (-> a3-2 vector 1 quad)) + (a2-7 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad)) + ) + (set! (-> v1-31 vector 0 quad) a0-22) + (set! (-> v1-31 vector 1 quad) a1-16) + (set! (-> v1-31 vector 2 quad) a2-7) + (set! (-> v1-31 vector 3 quad) a3-3) + ) + ) + ) + ) + (mat-remove-z-rot (-> arg0 inv-mat) (-> *camera* local-down)) + 0 + (none) + ) + ) + +;; definition for function v-slrp2! +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +;; Used lq/sq +(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) + ) + (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 vector 3 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-18 s0-0) + (f0-9 (-> v1-18 x)) + (f1-2 (-> v1-18 y)) + (f2-0 (-> v1-18 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 + (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) + (vector+float*! + arg0 + arg0 + s3-0 + (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0)) + ) + ) + ) + ) + arg0 + ) + +;; definition for function v-slrp3! +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Stack slot offset 144 signed mismatch +;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f3] +;; WARN: Unsupported inline assembly instruction kind - [madda.s f1, f4] +;; WARN: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] +;; Used lq/sq +(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) + ) + (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-9 s1-0) + (f0-6 (-> v1-9 x)) + (f1-0 (-> v1-9 y)) + (f2-0 (-> v1-9 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 + (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) + (vector+float*! + arg0 + arg0 + s3-0 + (* f30-0 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0)) + ) + ) + ) + ) + arg0 + ) + + + + diff --git a/test/decompiler/reference/engine/camera/math-camera-h_REF.gc b/test/decompiler/reference/engine/camera/math-camera-h_REF.gc index 942d3ca572..0943965213 100644 --- a/test/decompiler/reference/engine/camera/math-camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/math-camera-h_REF.gc @@ -116,8 +116,8 @@ (pfog0 float :offset-assert 832) (pfog1 float :offset-assert 836) (trans vector :inline :offset-assert 848) - (plane uint128 4 :offset-assert 864) - (guard-plane uint128 4 :offset-assert 928) + (plane plane 4 :inline :offset-assert 864) + (guard-plane plane 4 :inline :offset-assert 928) (shrub-mat matrix :inline :offset-assert 992) (fov-correction-factor float :offset-assert 1056) ) diff --git a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc index 41ed8c75f4..751300e5f3 100644 --- a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc @@ -482,8 +482,8 @@ (old-status uint64 :offset-assert 280) (prev-status uint64 :offset-assert 288) (reaction-flag uint32 :offset-assert 296) - (reaction basic :offset-assert 300) - (no-reaction basic :offset-assert 304) + (reaction function :offset-assert 300) + (no-reaction function :offset-assert 304) (local-normal vector :inline :offset-assert 320) (surface-normal vector :inline :offset-assert 336) (poly-normal vector :inline :offset-assert 352) @@ -495,8 +495,8 @@ (poly-angle float :offset-assert 424) (touch-angle float :offset-assert 428) (coverage float :offset-assert 432) - (dynam basic :offset-assert 436) - (surf basic :offset-assert 440) + (dynam dynamics :offset-assert 436) + (surf surface :offset-assert 440) ) :method-count-assert 65 :size-assert #x1bc diff --git a/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc b/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc index 8176be4486..bc72f1cf57 100644 --- a/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc +++ b/test/decompiler/reference/engine/draw/process-drawable-h_REF.gc @@ -8,7 +8,7 @@ (the-as cspace (cond (result (empty) - (the-as cspace result) + result ) (else (format 0 "no cspace (~A)~%" arg1) diff --git a/test/decompiler/reference/engine/geometry/cylinder_REF.gc b/test/decompiler/reference/engine/geometry/cylinder_REF.gc index 3298540887..99e20f2c74 100644 --- a/test/decompiler/reference/engine/geometry/cylinder_REF.gc +++ b/test/decompiler/reference/engine/geometry/cylinder_REF.gc @@ -378,7 +378,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/engine/gfx/lights-h_REF.gc b/test/decompiler/reference/engine/gfx/lights-h_REF.gc index 870ed6b7c8..1001af418d 100644 --- a/test/decompiler/reference/engine/gfx/lights-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/lights-h_REF.gc @@ -66,10 +66,10 @@ (format #t "[~8x] ~A~%" obj 'light-ellipse) (format #t "~Tmatrix: #~%" (-> obj matrix)) (format #t "~Tcolor: #~%" (-> obj color)) - (format #t "~Tname: ~A~%" (-> obj name)) - (format #t "~Tdecay-start: ~f~%" (-> obj decay-start)) - (format #t "~Tambient-point-ratio: ~f~%" (-> obj ambient-point-ratio)) - (format #t "~Tlevel: ~f~%" (-> obj level)) + (format #t "~Tname: ~A~%" (-> obj matrix vector 0 w)) + (format #t "~Tdecay-start: ~f~%" (-> obj matrix vector 1 w)) + (format #t "~Tambient-point-ratio: ~f~%" (-> obj matrix vector 2 w)) + (format #t "~Tlevel: ~f~%" (-> obj matrix vector 3 w)) (format #t "~Tfunc-symbol: ~A~%" (-> obj color w)) (format #t "~Tfunc: ~A~%" (-> obj color w)) obj diff --git a/test/decompiler/reference/engine/gfx/vis/bsp_REF.gc b/test/decompiler/reference/engine/gfx/vis/bsp_REF.gc index 7e193be89b..61677279e3 100644 --- a/test/decompiler/reference/engine/gfx/vis/bsp_REF.gc +++ b/test/decompiler/reference/engine/gfx/vis/bsp_REF.gc @@ -218,10 +218,10 @@ ) ) (let ((at-0 *math-camera*)) - (.lvf vf16 (&-> at-0 plane 0)) - (.lvf vf17 (&-> at-0 plane 1)) - (.lvf vf18 (&-> at-0 plane 2)) - (.lvf vf19 (&-> at-0 plane 3)) + (.lvf vf16 (&-> at-0 plane 0 quad)) + (.lvf vf17 (&-> at-0 plane 1 quad)) + (.lvf vf18 (&-> at-0 plane 2 quad)) + (.lvf vf19 (&-> at-0 plane 3 quad)) (.lvf vf20 (&-> at-0 shrub-mat vector 0 quad)) (.lvf vf21 (&-> at-0 shrub-mat vector 1 quad)) (.lvf vf22 (&-> at-0 shrub-mat vector 2 quad)) @@ -312,10 +312,10 @@ ) ) (let ((at-0 *math-camera*)) - (.lvf vf16 (&-> at-0 plane 0)) - (.lvf vf17 (&-> at-0 plane 1)) - (.lvf vf18 (&-> at-0 plane 2)) - (.lvf vf19 (&-> at-0 plane 3)) + (.lvf vf16 (&-> at-0 plane 0 quad)) + (.lvf vf17 (&-> at-0 plane 1 quad)) + (.lvf vf18 (&-> at-0 plane 2 quad)) + (.lvf vf19 (&-> at-0 plane 3 quad)) (.lvf vf20 (&-> at-0 shrub-mat vector 0 quad)) (.lvf vf21 (&-> at-0 shrub-mat vector 1 quad)) (.lvf vf22 (&-> at-0 shrub-mat vector 2 quad)) @@ -382,10 +382,10 @@ ) ) (let ((at-0 *math-camera*)) - (.lvf vf16 (&-> at-0 plane 0)) - (.lvf vf17 (&-> at-0 plane 1)) - (.lvf vf18 (&-> at-0 plane 2)) - (.lvf vf19 (&-> at-0 plane 3)) + (.lvf vf16 (&-> at-0 plane 0 quad)) + (.lvf vf17 (&-> at-0 plane 1 quad)) + (.lvf vf18 (&-> at-0 plane 2 quad)) + (.lvf vf19 (&-> at-0 plane 3 quad)) (.lvf vf20 (&-> at-0 shrub-mat vector 0 quad)) (.lvf vf21 (&-> at-0 shrub-mat vector 1 quad)) (.lvf vf22 (&-> at-0 shrub-mat vector 2 quad)) diff --git a/test/decompiler/reference/engine/level/level-h_REF.gc b/test/decompiler/reference/engine/level/level-h_REF.gc index 9e064dbc07..c99c33550d 100644 --- a/test/decompiler/reference/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/engine/level/level-h_REF.gc @@ -192,7 +192,7 @@ (bsp-name (_type_) symbol 13) (dummy-14 (_type_ object) memory-usage-block 14) (dummy-15 (_type_ vector) symbol 15) - (dummy-16 (_type_) none 16) + (dummy-16 (_type_ uint uint) none 16) (load-continue (_type_) _type_ 17) (load-begin (_type_) _type_ 18) (login (_type_) _type_ 19) diff --git a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc index 5d3936d711..b03b78d125 100644 --- a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc +++ b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc @@ -369,7 +369,7 @@ (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) - (-> csp bone position) + (-> csp bone transform vector 3) ) 1.0 ) diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index 04016f7347..03b3ad8d5d 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -75,6 +75,9 @@ const std::unordered_set g_functions_expected_to_reject = { "(method 15 sync-info-eased)", // needs *res-static-buf* "(method 15 sync-info-paused)", // needs *res-static-buf* + // camera + "slave-set-rotation!", "v-slrp2!", "v-slrp3!", // vector-dot involving the stack + // collide-mesh-h "(method 11 collide-mesh-cache)", // asm @@ -158,6 +161,9 @@ const std::unordered_set g_functions_to_skip_compiling = { // multiply defined. "(method 3 sprite-aux-list)", + // camera + "slave-set-rotation!", "v-slrp2!", "v-slrp3!", // vector-dot involving the stack + // loader - decompiler bug with detecting handle macros "(method 10 external-art-buffer)"};