diff --git a/.vscode/settings.json b/.vscode/settings.json index d4d84f75f3..3600205c1d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -26,6 +26,16 @@ } ] }, + "(.*Flagged as asm.*)": { + "filterFileRegex": ".*ir2\\.asm", + "decorations": [ + { + "overviewRulerColor": "yellow", + "color": "yellow", + "fontWeight": "bold" + } + ] + }, "(INFO:.*)": { "filterFileRegex": ".*ir2\\.asm", "decorations": [ diff --git a/Taskfile.yml b/Taskfile.yml index 32b37d07e1..75f9d6ae06 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -3,7 +3,10 @@ version: '3' tasks: format: cmds: - - python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test -i + - cmd: python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test -i + # npm install -g prettier + - cmd: prettier --write ./decompiler/config/jak1_ntsc_black_label/*.jsonc + ignore_error: true run-game: cmds: - ./out/build/Debug/bin/gk.exe -fakeiso -debug -nodisplay @@ -80,3 +83,6 @@ tasks: - task: type-test - task: offline-tests - task: find-label-types + cast-repl: + cmds: + - cmd: python ./scripts/cast-repl.py diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 608b2edbde..a730ca99bb 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -4738,7 +4738,41 @@ void ArrayFieldAccess::update_with_val(Form* new_val, auto deref = pool.alloc_element(base, false, tokens); result->push_back(deref); } else { - throw std::runtime_error("Not power of two case, not yet implemented (no offset)"); + auto mult_matcher = Matcher::op( + GenericOpMatcher::fixed(FixedOperatorKind::MULTIPLICATION), + {Matcher::match_or({Matcher::cast("uint", Matcher::integer(m_expected_stride)), + Matcher::integer(m_expected_stride)}), + Matcher::any(0)}); + mult_matcher = Matcher::match_or( + {Matcher::cast("uint", mult_matcher), Matcher::cast("int", mult_matcher), mult_matcher}); + + auto op_match = + GenericOpMatcher::or_match({GenericOpMatcher::fixed(FixedOperatorKind::ADDITION), + GenericOpMatcher::fixed(FixedOperatorKind::ADDITION_PTR)}); + auto add_matcher = Matcher::op(op_match, {Matcher::any(1), mult_matcher}); + add_matcher = + Matcher::match_or({add_matcher, Matcher::op(op_match, {mult_matcher, Matcher::any(1)})}); + + auto mr = match(add_matcher, new_val); + if (!mr.matched) { + throw std::runtime_error("Failed to match non-power of two case: " + + new_val->to_string(env)); + } + + auto base = strip_int_or_uint_cast(mr.maps.forms.at(1)); + auto idx = mr.maps.forms.at(0); + + assert(idx && base); + + std::vector tokens = m_deref_tokens; + for (auto& x : tokens) { + if (x.kind() == DerefToken::Kind::EXPRESSION_PLACEHOLDER) { + x = DerefToken::make_int_expr(idx); + } + } + + auto deref = pool.alloc_element(base, false, tokens); + result->push_back(deref); } } else { if (m_expected_stride == 1) { diff --git a/decompiler/ObjectFile/ObjectFileDB.h b/decompiler/ObjectFile/ObjectFileDB.h index 34dfc66029..0ab025483f 100644 --- a/decompiler/ObjectFile/ObjectFileDB.h +++ b/decompiler/ObjectFile/ObjectFileDB.h @@ -67,9 +67,11 @@ class ObjectFileDB { bool print_hex); void analyze_functions_ir1(const Config& config); - void analyze_functions_ir2(const std::string& output_dir, - const Config& config, - const std::unordered_set& skip_functions); + void analyze_functions_ir2( + const std::string& output_dir, + const Config& config, + const std::unordered_set& skip_functions, + const std::unordered_map>& skip_states = {}); void ir2_top_level_pass(const Config& config); void ir2_stack_spill_slot_pass(int seg, ObjectFileData& data); void ir2_basic_block_pass(int seg, const Config& config, ObjectFileData& data); diff --git a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp index 7bfbcca839..41cb690f1d 100644 --- a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp +++ b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp @@ -33,9 +33,11 @@ namespace decompiler { * At this point, we assume that the files are loaded and we've run find_code to locate all * functions, but nothing else. */ -void ObjectFileDB::analyze_functions_ir2(const std::string& output_dir, - const Config& config, - const std::unordered_set& skip_functions) { +void ObjectFileDB::analyze_functions_ir2( + const std::string& output_dir, + const Config& config, + const std::unordered_set& skip_functions, + const std::unordered_map>& skip_states) { // First, do basic analysis on the top level: lg::info("Using IR2 analysis..."); @@ -57,7 +59,7 @@ void ObjectFileDB::analyze_functions_ir2(const std::string& output_dir, ir2_do_segment_analysis_phase2(TOP_LEVEL_SEGMENT, config, data); try { if (data.linked_data.functions_by_seg.size() == 3) { - run_defstate(data.linked_data.functions_by_seg.at(2).front()); + run_defstate(data.linked_data.functions_by_seg.at(2).front(), skip_states); } } catch (const std::exception& e) { lg::error("Failed to find defstates: {}", e.what()); diff --git a/decompiler/analysis/find_defstates.cpp b/decompiler/analysis/find_defstates.cpp index ae5b192c3b..5d6e0b2f15 100644 --- a/decompiler/analysis/find_defstates.cpp +++ b/decompiler/analysis/find_defstates.cpp @@ -73,7 +73,8 @@ std::vector get_defstate_entries( const RegisterAccess& let_dest_var, const TypeSpec& state_type, FormPool& pool, - const std::optional& virtual_child = {}) { + const std::optional& virtual_child = {}, + const std::unordered_map>& skip_states = {}) { std::vector entries; // next, all the handlers @@ -151,15 +152,25 @@ std::vector get_defstate_entries( pool.alloc_single_element_form(nullptr, expected_type, this_entry.val); } } + // name = code/event/etc + if (skip_states.count(state_name) > 0) { + if (skip_states.at(state_name).find(name) != skip_states.at(state_name).end()) { + env.func->warnings.general_warning("SKIP: skipping '{}' handler for state '{}'", name, + state_name); + continue; + } + } entries.push_back(this_entry); } return entries; } -FormElement* rewrite_nonvirtual_defstate(LetElement* elt, - const Env& env, - const std::string& expected_state_name, - FormPool& pool) { +FormElement* rewrite_nonvirtual_defstate( + LetElement* elt, + const Env& env, + const std::string& expected_state_name, + FormPool& pool, + const std::unordered_map>& skip_states = {}) { // first thing in the body should be something like: // (set! teetertotter-idle (the-as (state none) v1-3)) assert(elt->body()->size() > 0); @@ -178,8 +189,9 @@ FormElement* rewrite_nonvirtual_defstate(LetElement* elt, } body_index++; - auto entries = get_defstate_entries(elt->body(), body_index, env, info.first, - elt->entries().at(0).dest, info.second, pool); + auto entries = + get_defstate_entries(elt->body(), body_index, env, info.first, elt->entries().at(0).dest, + info.second, pool, {}, skip_states); return pool.alloc_element(info.second.last_arg().base_type(), info.first, entries, false); @@ -238,10 +250,12 @@ std::string verify_empty_state_and_get_name(DecompiledDataElement* state, const return name_word.symbol_name; } -FormElement* rewrite_virtual_defstate(LetElement* elt, - const Env& env, - const std::string& expected_state_name, - FormPool& pool) { +FormElement* rewrite_virtual_defstate( + LetElement* elt, + const Env& env, + const std::string& expected_state_name, + FormPool& pool, + const std::unordered_map>& skip_states = {}) { assert(elt->body()->size() > 1); // variable at the top of let, contains the static state with name exptected_state_name auto state_var_from_let_def = elt->entries().at(0).dest; @@ -399,7 +413,7 @@ FormElement* rewrite_virtual_defstate(LetElement* elt, auto entries = get_defstate_entries( elt->body(), body_idx + 1, env, expected_state_name, elt->entries().at(0).dest, - method_info.type.substitute_for_method_call(type_name), pool, type_name); + method_info.type.substitute_for_method_call(type_name), pool, type_name, skip_states); return pool.alloc_element(type_name, expected_state_name, entries, true); } @@ -410,7 +424,9 @@ bool is_nonvirtual_state(LetElement* elt) { } // namespace -void run_defstate(Function& top_level_func) { +void run_defstate( + Function& top_level_func, + const std::unordered_map>& skip_states) { auto& env = top_level_func.ir2.env; auto& pool = *top_level_func.ir2.form_pool; if (!top_level_func.ir2.top_form) { @@ -439,12 +455,14 @@ void run_defstate(Function& top_level_func) { } if (is_nonvirtual_state(as_let)) { - auto rewritten = rewrite_nonvirtual_defstate(as_let, env, expected_state_name, pool); + auto rewritten = + rewrite_nonvirtual_defstate(as_let, env, expected_state_name, pool, skip_states); if (rewritten) { fe = rewritten; } } else { - auto rewritten = rewrite_virtual_defstate(as_let, env, expected_state_name, pool); + auto rewritten = + rewrite_virtual_defstate(as_let, env, expected_state_name, pool, skip_states); if (rewritten) { fe = rewritten; } @@ -454,4 +472,4 @@ void run_defstate(Function& top_level_func) { } }); } -} // namespace decompiler \ No newline at end of file +} // namespace decompiler diff --git a/decompiler/analysis/find_defstates.h b/decompiler/analysis/find_defstates.h index 85f29818fd..33b77a54b7 100644 --- a/decompiler/analysis/find_defstates.h +++ b/decompiler/analysis/find_defstates.h @@ -4,5 +4,7 @@ #include "decompiler/util/DecompilerTypeSystem.h" namespace decompiler { -void run_defstate(Function& top_level_func); -} \ No newline at end of file +void run_defstate( + Function& top_level_func, + const std::unordered_map>& skip_states = {}); +} diff --git a/decompiler/analysis/static_refs.cpp b/decompiler/analysis/static_refs.cpp index b78098f595..7e1cfd1425 100644 --- a/decompiler/analysis/static_refs.cpp +++ b/decompiler/analysis/static_refs.cpp @@ -35,7 +35,8 @@ bool try_convert_lambda(const Function& parent_function, "ignored and is no longer required.", lab.name); } - if (!other_func->ir2.env.has_local_vars() || !other_func->ir2.top_form) { + if (!other_func->ir2.env.has_local_vars() || !other_func->ir2.top_form || + !other_func->ir2.expressions_succeeded) { // don't bother if we don't even have vars. return false; } diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 8276fc5ce4..7409718c5c 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -1904,7 +1904,7 @@ ) (deftype vector-array (inline-array-class) - ( + ((data vector :inline :dynamic :offset 16) ) :method-count-assert 9 :size-assert #x10 @@ -1976,7 +1976,7 @@ :size-assert #x28 :flag-assert #xb00000028 (:methods - (debug-draw (_type_ vector) none 9) + (debug-draw (_type_ vector4w) none 9) (ray-capsule-intersect (_type_ vector vector) float 10) ) ) @@ -1991,7 +1991,7 @@ :size-assert #x28 :flag-assert #xb00000028 (:methods - (debug-draw (_type_ vector) none 9) + (debug-draw (_type_ vector4w) none 9) (ray-flat-cyl-intersect (_type_ vector vector) float 10) ) ) @@ -7678,6 +7678,7 @@ (deftype joint-anim-compressed-hdr (structure) ((control-bits uint32 14 :offset-assert 0) + (unknown-half int16 :score 100 :offset 6) ;; see pov-camera-play-and-reposition (num-joints uint32 :offset-assert 56) (matrix-bits uint32 :offset-assert 60) ) @@ -10077,7 +10078,6 @@ :flag-assert #x14004000b0 ;; inherited inspect of process (:methods - (deactivate (_type_) none 10) (dummy-14 (_type_ skeleton-group object) none 14) (dummy-15 (_type_ string object) _type_ 15) (dummy-16 (_type_ int (inline-array vector) vector) collide-shape 16) @@ -10364,11 +10364,12 @@ ;; - Types (deftype pov-camera (process-drawable) - ((flags int32 :offset-assert 176) + ((cspace-array cspace-array :offset 112) + (flags int32 :offset-assert 176) (debounce-start-time uint64 :offset-assert 184) - (notify-handle uint64 :offset-assert 192) - (anim-name basic :offset-assert 200) - (command-list basic :offset-assert 204) + (notify-handle handle :offset-assert 192) + (anim-name string :offset-assert 200) + (command-list pair :offset-assert 204) ;; not a basic atleast! (mask-to-clear uint32 :offset-assert 208) (music-volume-movie float :offset-assert 212) (sfx-volume-movie float :offset-assert 216) @@ -10379,15 +10380,15 @@ :flag-assert #x1e007000dc ;; inherited inspect of process-drawable (:methods - (dummy-20 () none 20) - (dummy-21 () none 21) - (pov-camera-playing () none 22) ;; state - (dummy-23 () none 23) - (dummy-24 () none 24) - (dummy-25 () none 25) - (dummy-26 () none 26) + (pov-camera-abort () _type_ :state 20) + (pov-camera-done-playing () _type_ :state 21) + (pov-camera-playing () _type_ :state 22) ;; state + (pov-camera-start-playing () _type_ :state 23) ;; state + (pov-camera-startup () _type_ :state 24) ;; state + (TODO-RENAME-25 (_type_) symbol 25) + (target-grabbed? (_type_) symbol 26) (dummy-27 () none 27) - (dummy-28 () none 28) + (target-released? () symbol 28) (dummy-29 () none 29) ) ) @@ -13976,8 +13977,8 @@ (:methods (TODO-RENAME-9 (_type_) none 9) (TODO-RENAME-10 (_type_ vector) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) + (print-nth-point (_type_ int) none 11) + (TODO-RENAME-12 (_type_) none 12) (TODO-RENAME-13 (_type_ int) none 13) (TODO-RENAME-14 (_type_ vector) none 14) (TODO-RENAME-15 (_type_) none 15) @@ -13988,7 +13989,7 @@ (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) + (TODO-RENAME-23 (_type_) none 23) ) ) @@ -14134,7 +14135,7 @@ (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) ; not totally confirmed yet + (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) @@ -14147,15 +14148,15 @@ (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) + (drawable-target handle :offset-assert 320) ; likely a `target`? (which-bone int32 :offset-assert 328) - (pov-handle uint64 :offset-assert 336) + (pov-handle handle :offset-assert 336) (pov-bone int32 :offset-assert 344) - (being-attacked basic :offset-assert 348) + (being-attacked symbol :offset-assert 348) (attack-start uint64 :offset-assert 352) - (on-ground basic :offset-assert 360) + (on-ground symbol :offset-assert 360) (under-water int32 :offset-assert 364) - (on-pole basic :offset-assert 368) + (on-pole symbol :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) @@ -15260,6 +15261,7 @@ (define-extern collide-do-primitives (function float)) ;; NOTE - didn't bother to check input args (define-extern moving-sphere-sphere-intersect (function vector vector vector vector float)) (define-extern moving-sphere-moving-sphere-intersect (function vector vector vector vector float)) +(define-extern moving-sphere-triangle-intersect (function vector vector float collide-cache-tri vector vector float)) ;; ---------------------- @@ -15331,7 +15333,7 @@ ;; - Functions (define-extern ray-arbitrary-circle-intersect (function vector vector vector vector float float)) -(define-extern camera-line (function vector vector vector none)) +(define-extern camera-line (function vector vector vector4w none)) ;; ---------------------- @@ -15651,7 +15653,7 @@ ;; - Functions -(define-extern debug-set-camera-pos-rot! (function vector matrix int)) +(define-extern debug-set-camera-pos-rot! (function vector matrix vector)) (define-extern drawable-frag-count (function drawable int)) (define-extern add-debug-light (function symbol bucket-id light vector string symbol)) (define-extern add-debug-text-3d (function symbol bucket-id string vector font-color vector2h symbol)) @@ -15685,7 +15687,7 @@ (define-extern add-debug-lights (function symbol bucket-id (inline-array light) vector symbol)) (define-extern history-init (function pos-history int pos-history)) (define-extern history-draw-and-update (function pos-history int vector symbol)) -(define-extern dma-timeout-cam (function int)) +(define-extern dma-timeout-cam (function vector)) (define-extern display-file-info (function int)) ;; - Unknowns @@ -18124,10 +18126,10 @@ ;; - Functions -(define-extern camera-bounding-box-draw function) +(define-extern camera-bounding-box-draw (function bounding-box basic rgba none)) (define-extern collide-planes-test0 function) (define-extern collide-planes-test1 function) -(define-extern camera-cross function) +(define-extern camera-cross (function vector vector vector vector float basic)) (define-extern collide-planes-intersect function) (define-extern collide-planes function) @@ -18273,13 +18275,13 @@ (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-slave-debug (function camera-slave 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-slave-get-rot (function entity-actor matrix matrix)) (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 @@ -18299,11 +18301,11 @@ ;; - 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 cam-circular (state camera-slave)) +(define-extern cam-standoff-read-entity (state camera-slave)) +(define-extern cam-spline (state camera-slave)) (define-extern *camera-base-mode* state) -(define-extern cam-fixed-read-entity state) +(define-extern cam-fixed-read-entity (state camera-slave)) ;; ---------------------- ;; File - cam-interface @@ -18357,36 +18359,36 @@ ;; - Functions -(define-extern list-keeper-init function) -(define-extern master-track-target function) -(define-extern master-check-regions function) -(define-extern camera-master-debug function) -(define-extern master-unset-region function) -(define-extern reset-target-tracking function) -(define-extern reset-drawable-tracking function) -(define-extern master-switch-to-entity function) -(define-extern reset-drawable-follow function) -(define-extern reset-follow function) -(define-extern in-cam-entity-volume? function) -(define-extern master-base-region function) -(define-extern setup-slave-for-hopefull function) -(define-extern master-is-hopeful-better? function) -(define-extern target-cam-pos (function object)) ;; TODO - strange, not a vector? +(define-extern list-keeper-init (function none :behavior camera-master)) +(define-extern master-track-target (function symbol :behavior camera-master)) ;; TODO - go get that collide-cache function +(define-extern master-check-regions (function object :behavior camera-master)) +(define-extern camera-master-debug (function camera-master symbol symbol none)) +(define-extern master-unset-region (function object :behavior camera-master)) +(define-extern reset-target-tracking (function symbol :behavior camera-master)) +(define-extern reset-drawable-tracking (function symbol :behavior camera-master)) +(define-extern master-switch-to-entity (function entity symbol :behavior camera-master)) +(define-extern reset-drawable-follow (function float :behavior camera-master)) +(define-extern reset-follow (function float :behavior camera-master)) +(define-extern in-cam-entity-volume? (function vector entity float symbol symbol)) +(define-extern master-base-region (function entity float :behavior camera-master)) +(define-extern setup-slave-for-hopefull (function camera-slave none)) +(define-extern master-is-hopeful-better? (function camera-slave camera-slave symbol :behavior camera-master)) ;; TODO - ASM +(define-extern target-cam-pos (function vector)) (define-extern cam-master-init (function none :behavior camera-master)) ;; - Symbols (define-extern cam-free-floating (state camera-slave)) -(define-extern cam-master-active state) -(define-extern list-keeper-active state) +(define-extern cam-master-active (state camera-master)) +(define-extern list-keeper-active (state camera-master)) (define-extern *CAMERA_MASTER-bank* camera-master-bank) ;; - Unknowns -(define-extern cam-fixed state) -(define-extern cam-decel state) -(define-extern cam-eye state) +(define-extern cam-fixed (state camera-slave)) +(define-extern cam-decel (state camera-slave)) +(define-extern cam-eye (state camera-slave)) ;; ---------------------- @@ -18397,124 +18399,144 @@ ;; - Types -; (deftype cam-eye-bank (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype cam-eye-bank (basic) + ((rot-speed float :offset-assert 4) + (max-degrees float :offset-assert 8) + (max-fov float :offset-assert 12) + (min-fov float :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) -; (deftype cam-billy-bank (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype cam-billy-bank (basic) + ((rot-speed float :offset-assert 4) + (tilt-degrees float :offset-assert 8)) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) -; (deftype cam-string-bank (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype cam-string-bank (basic) + ((los-coll-rad meters :offset-assert 4) + (los-coll-rad2 meters :offset-assert 8)) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) -; (deftype los-dist (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype los-dist (structure) + ( + (par-dist float :offset-assert 0) + (lat-dist float :offset-assert 4) + (vert-dist float :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) -; (deftype collide-los-dist-info (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype collide-los-dist-info (structure) + ((min-par float :offset-assert 0) + (max-par float :offset-assert 4) + (min-lat float :offset-assert 8) + (max-lat float :offset-assert 12) + (min-vp float :offset-assert 16) + (max-vp float :offset-assert 20) + (min-vn float :offset-assert 24) + (max-vn float :offset-assert 28) + (count int32 :offset-assert 32)) + :method-count-assert 9 + :size-assert #x24 + :flag-assert #x900000024 + ) -; (deftype collide-los-result (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype collide-los-result (structure) + ((lateral vector :inline :offset-assert 0) + (cw collide-los-dist-info :inline :offset-assert 16) + (ccw collide-los-dist-info :inline :offset-assert 64) + (straddle collide-los-dist-info :inline :offset-assert 112) + (lateral-valid symbol :offset-assert 148)) + :method-count-assert 9 + :size-assert #x98 + :flag-assert #x900000098 + ) -; (deftype cam-stick-bank (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype cam-stick-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16)) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) -; (deftype cam-bike-bank (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype cam-bike-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16)) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) ;; - Functions -(define-extern cam-bike-code function) -(define-extern cam-calc-bike-follow! function) -(define-extern cam-stick-code function) -(define-extern set-string-parms function) -(define-extern cam-string-code function) -(define-extern cam-string-find-position-rel! function) -(define-extern cam-string-set-position-rel! function) -(define-extern cam-debug-reset-coll-tri function) -(define-extern cam-string-follow function) -(define-extern cam-string-line-of-sight function) -(define-extern cam-string-joystick function) -(define-extern cam-string-find-hidden function) -(define-extern cam-collision-record-save function) -(define-extern cam-string-move function) -(define-extern cam-dist-analog-input function) -(define-extern cam-los-collide function) -(define-extern dist-info-init function) -(define-extern los-cw-ccw function) -(define-extern cam-debug-add-los-tri function) -(define-extern cam-los-spline-collide function) -(define-extern cam-los-setup-lateral function) -(define-extern slave-los-state->string function) -(define-extern dist-info-print function) -(define-extern dist-info-valid? function) -(define-extern dist-info-append function) -(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 cam-rotation-tracker vector symbol none)) ;; not confirmed -(define-extern string-push-help function) -(define-extern cam-draw-collide-cache function) +(define-extern cam-bike-code (function none :behavior camera-slave)) +(define-extern cam-calc-bike-follow! (function cam-rotation-tracker vector symbol vector :behavior camera-slave)) +(define-extern cam-stick-code (function none :behavior camera-slave)) +(define-extern set-string-parms (function vector :behavior camera-slave)) +(define-extern cam-string-code (function vector :behavior camera-slave)) +(define-extern cam-string-find-position-rel! (function vector symbol)) +(define-extern cam-string-set-position-rel! (function vector int :behavior camera-slave)) +(define-extern cam-debug-reset-coll-tri (function none)) ;; not confirmed +(define-extern cam-string-follow (function object :behavior camera-slave)) +(define-extern cam-string-line-of-sight (function vector :behavior camera-slave)) +(define-extern cam-string-joystick (function vector :behavior camera-slave)) +(define-extern cam-string-find-hidden (function none :behavior camera-slave)) +(define-extern cam-collision-record-save (function vector vector int basic camera-slave none)) +(define-extern cam-string-move (function object :behavior camera-slave)) +(define-extern cam-dist-analog-input (function int float float)) +(define-extern cam-los-collide (function vector vector clip-travel-vector-to-mesh-return-info int symbol :behavior camera-slave)) +(define-extern dist-info-init (function collide-los-dist-info none)) +(define-extern los-cw-ccw (function (inline-array collide-cache-tri) vector vector float clip-travel-vector-to-mesh-return-info vector float symbol)) +(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none)) +(define-extern cam-los-spline-collide (function vector vector vector float)) +(define-extern cam-los-setup-lateral (function clip-travel-vector-to-mesh-return-info vector vector symbol :behavior camera-slave)) +(define-extern slave-los-state->string (function uint string)) ;; uint comes from 2244 camera-slave +(define-extern dist-info-print (function collide-los-dist-info string object)) +(define-extern dist-info-valid? (function collide-los-dist-info symbol)) +(define-extern dist-info-append (function collide-los-dist-info vector none)) +(define-extern cam-circular-code (function float :behavior camera-slave)) +(define-extern cam-circular-position (function symbol vector :behavior camera-slave)) +(define-extern cam-circular-position-into-max-angle (function vector vector float vector :behavior camera-slave)) +(define-extern cam-standoff-calc-trans (function vector :behavior camera-slave)) +(define-extern string-push-help (function float)) +(define-extern cam-draw-collide-cache (function collide-cache none)) ;; - Symbols -(define-extern cam-string state) +(define-extern cam-string (state camera-slave)) ;; - Unknowns -;;(define-extern *CAM_BIKE-bank* object) ;; unknown type -;;(define-extern *CAM_STICK-bank* 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 -(define-extern cam-standoff state) -(define-extern cam-pov state) -(define-extern cam-pov180 state) -(define-extern cam-pov-track state) -(define-extern cam-billy state) -(define-extern cam-endlessfall state) -(define-extern cam-lookat state) -(define-extern cam-stick state) -(define-extern cam-bike state) +(define-extern *CAM_BIKE-bank* cam-bike-bank) ;; unknown type +(define-extern *CAM_STICK-bank* cam-stick-bank) ;; unknown type +(define-extern *CAM_STRING-bank* cam-string-bank) ;; unknown type +(define-extern *CAM_BILLY-bank* cam-billy-bank) ;; unknown type +(define-extern *CAM_EYE-bank* cam-eye-bank) ;; unknown type +(define-extern cam-standoff (state camera-slave)) ;; unknown type +(define-extern cam-pov (state camera-slave)) ;; unknown type +(define-extern cam-pov180 (state camera-slave)) ;; unknown type +(define-extern cam-pov-track (state camera-slave)) ;; unknown type +(define-extern cam-billy (state camera-slave)) ;; unknown type +(define-extern cam-endlessfall (state camera-slave)) ;; unknown type +(define-extern cam-lookat (state camera-slave)) ;; unknown type +(define-extern cam-stick (state camera-slave)) ;; unknown type +(define-extern cam-bike (state camera-slave)) ;; unknown type ;; ---------------------- @@ -18588,11 +18610,11 @@ ;; - Unknowns -;;(define-extern *camera-orbit-info* object) ;; unknown type -;;(define-extern *CAM_ORBIT-bank* object) ;; unknown type -;;(define-extern *CAM_POINT_WATCH-bank* object) ;; unknown type -(define-extern cam-point-watch state) -(define-extern cam-orbit state) +(define-extern *camera-orbit-info* camera-orbit-info) ;; unknown type +(define-extern *CAM_ORBIT-bank* CAM_ORBIT-bank) ;; unknown type +(define-extern *CAM_POINT_WATCH-bank* cam-point-watch-bank) ;; unknown type +(define-extern cam-point-watch (state camera-slave)) +(define-extern cam-orbit (state camera-slave)) ;; ---------------------- @@ -18643,7 +18665,7 @@ ;; - Types (deftype plane-volume (structure) - ((volume-type basic :offset-assert 0) + ((volume-type symbol :offset-assert 0) (point-count int16 :offset-assert 4) (normal-count int16 :offset-assert 6) (first-point vector :offset-assert 8) @@ -18692,170 +18714,216 @@ ;; - Types -; (deftype cam-layout (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; unrecognized get op: (set! v1 process) parent was UNKNOWN -; ) +(deftype cam-layout (process) + ( + (cam-entity entity-camera :offset-assert 112) + (num-entities int32 :offset-assert 116) + (cur-entity int32 :offset-assert 120) + (num-volumes int32 :offset-assert 124) + (cur-volume int32 :offset-assert 128) + (first-pvol int32 :offset-assert 132) + (first-cutoutvol int32 :offset-assert 136) + (res-key float :offset-assert 140) + ) + :method-count-assert 14 + :heap-base #x200 + :size-assert #x90 + :flag-assert #xe02000090 + ) -; (deftype clm-list (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype clm-basic (basic) + () + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) -; (deftype clm (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype clm (basic) + ( + (title string :offset-assert 4) + (items (array clm-basic) :offset-assert 8) ; array of something + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) -; (deftype clmf-cam-flag-toggle-info (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype clmf-cam-flag-toggle-info (structure) + ( + (key float :offset-assert 0) + (force-on int32 :offset-assert 4) + (force-off int32 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) -; (deftype interp-test-info (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype interp-test-info (structure) + ( + (from vector :inline :offset-assert 0) + (to vector :inline :offset-assert 16) + (origin vector :inline :offset-assert 32) + (color vector4w :offset-assert 48) + (axis vector :offset-assert 52) + (disp string :offset-assert 56) + ) + :method-count-assert 9 + :size-assert #x3c + :flag-assert #x90000003c + ) -; (deftype cam-layout-bank (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype cam-layout-bank (basic) + ( + (spline-t float :offset-assert 4) + (spline-step float :offset-assert 8) + (intro-t float :offset-assert 12) + (intro-step float :offset-assert 16) + (debug-t float :offset-assert 20) + (debug-step float :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) -; (deftype clm-basic (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype clm-item-action (structure) + ( + (button uint64 :offset-assert 0) + (options uint64 :offset-assert 8) + (func symbol :offset-assert 16) + (parm0 int32 :offset 20) + (parm0-basic basic :offset 20) + (parm1-basic basic :offset 24) + (parm1 symbol :offset 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) -; (deftype clm-item-action (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype clm-item (clm-basic) + ( + (description string :offset-assert 4) + (button-symbol symbol :offset-assert 8) + (action clm-item-action :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x2c + :flag-assert #x90000002c + ) -; (deftype clm-item (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype clm-list-item (basic) + ( + (description string :offset-assert 4) + (track-val symbol :offset-assert 8) + (val-func symbol :offset-assert 12) + (val-parm0 int32 :offset 16) + (val-parm0-basic basic :offset 16) + (val-parm1-basic basic :offset 20) + (val-parm1 symbol :offset 20) + (actions (array clm-item-action) :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) -; (deftype clm-list-item (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype clm-list (clm-basic) + ( + (tracker symbol :offset-assert 4) + (cur-list-item int32 :offset-assert 8) + (items (array clm-list-item) :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) -; (deftype volume-descriptor-array (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype volume-descriptor-array (inline-array-class) + ((data plane-volume :inline :dynamic :offset 16) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) ;; - Functions -(define-extern cam-layout-stop (function none)) +(define-extern cam-layout-stop (function symbol)) (define-extern cam-layout-start (function none)) -(define-extern cam-layout-init function) -(define-extern clmf-next-entity function) -(define-extern cam-layout-entity-info function) -(define-extern cam-layout-entity-volume-info function) -(define-extern cam-layout-do-menu function) -(define-extern cam-layout-print function) -(define-extern cam-layout-function-call function) -(define-extern cam-layout-do-action function) -(define-extern clmf-save-single function) -(define-extern cam-layout-save-cam-rot function) -(define-extern cam-layout-save-cam-trans function) -(define-extern cam-layout-save-pivot function) -(define-extern cam-layout-save-align function) -(define-extern cam-layout-save-interesting function) -(define-extern cam-layout-save-fov function) -(define-extern cam-layout-save-focalpull function) -(define-extern cam-layout-save-flags function) -(define-extern cam-layout-save-introsplinetime function) -(define-extern cam-layout-save-introsplineexitval function) -(define-extern cam-layout-save-interptime function) -(define-extern cam-layout-save-splineoffset function) -(define-extern cam-layout-save-spline-follow-dist-offset function) -(define-extern cam-layout-save-campointsoffset function) -(define-extern cam-layout-save-tiltAdjust function) -(define-extern cam-layout-save-stringMinLength function) -(define-extern cam-layout-save-stringMaxLength function) -(define-extern cam-layout-save-stringMinHeight function) -(define-extern cam-layout-save-stringMaxHeight function) -(define-extern cam-layout-save-stringCliffHeight function) -(define-extern cam-layout-save-maxAngle function) -(define-extern cam-layout-save-campoints-flags function) -(define-extern cam-layout-save-focalpull-flags function) -(define-extern cam-index-options->string function) -(define-extern cam-slave-options->string function) -(define-extern fov->maya function) -(define-extern cam-layout-entity-volume-info-create function) -(define-extern clmf-next-volume function) -(define-extern clmf-input function) -(define-extern camera-fov-frame function) -(define-extern interp-test function) -(define-extern v-slrp! function) -(define-extern interp-test-deg function) +(define-extern cam-layout-init (function none :behavior cam-layout)) +(define-extern clmf-next-entity (function int symbol :behavior cam-layout)) +(define-extern cam-layout-entity-info (function entity-actor basic)) +(define-extern cam-layout-entity-volume-info (function symbol :behavior cam-layout)) ; TODO - crash +(define-extern cam-layout-do-menu (function clm none :behavior cam-layout)) +(define-extern cam-layout-print (function int int string pointer)) +(define-extern cam-layout-function-call (function symbol string int basic symbol :behavior cam-layout)) +(define-extern cam-layout-do-action (function clm-item-action symbol :behavior cam-layout)) +(define-extern clmf-save-single (function entity-camera symbol symbol file-stream :behavior cam-layout)) +(define-extern cam-layout-save-cam-rot (function symbol string entity-actor string)) +(define-extern cam-layout-save-cam-trans (function symbol string entity-actor string)) +(define-extern cam-layout-save-pivot (function symbol string entity-actor string)) +(define-extern cam-layout-save-align (function symbol string entity-actor string)) +(define-extern cam-layout-save-interesting (function symbol string entity-actor string)) +(define-extern cam-layout-save-fov (function symbol string entity-actor string)) +(define-extern cam-layout-save-focalpull (function symbol string entity-actor string)) +(define-extern cam-layout-save-flags (function symbol string entity-actor string)) +(define-extern cam-layout-save-introsplinetime (function symbol string entity-actor string)) +(define-extern cam-layout-save-introsplineexitval (function symbol string entity-actor string)) +(define-extern cam-layout-save-interptime (function symbol string entity-actor string)) +(define-extern cam-layout-save-splineoffset (function symbol string entity-actor string)) +(define-extern cam-layout-save-spline-follow-dist-offset (function symbol string entity-actor string)) +(define-extern cam-layout-save-campointsoffset (function symbol string entity-actor string)) +(define-extern cam-layout-save-tiltAdjust (function symbol string entity-actor string)) +(define-extern cam-layout-save-stringMinLength (function symbol string entity-actor string)) +(define-extern cam-layout-save-stringMaxLength (function symbol string entity-actor string)) +(define-extern cam-layout-save-stringMinHeight (function symbol string entity-actor string)) +(define-extern cam-layout-save-stringMaxHeight (function symbol string entity-actor string)) +(define-extern cam-layout-save-stringCliffHeight (function symbol string entity-actor string)) +(define-extern cam-layout-save-maxAngle (function symbol string entity-actor string)) +(define-extern cam-layout-save-campoints-flags (function symbol string entity-actor string)) +(define-extern cam-layout-save-focalpull-flags (function symbol string entity-actor string)) +(define-extern cam-index-options->string (function uint string string)) +(define-extern cam-slave-options->string (function uint string string)) +(define-extern fov->maya (function float float)) +(define-extern cam-layout-entity-volume-info-create (function entity-camera symbol symbol :behavior cam-layout)) ;; TODO - decomp crash +(define-extern clmf-next-volume (function int symbol :behavior cam-layout)) +(define-extern clmf-input (function vector vector int vector)) +(define-extern camera-fov-frame (function matrix vector float float float vector none)) +(define-extern interp-test (function (function vector vector vector float vector float none) interp-test-info basic)) +(define-extern v-slrp! (function vector vector vector float vector)) +(define-extern interp-test-deg (function (function vector vector vector vector float none) interp-test-info basic)) (define-extern camera-line-setup (function vector none)) -(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) -(define-extern clmf-implement function) -(define-extern clmf-pos-rot function) -(define-extern clmf-next-vol-dpad function) -(define-extern clmf-to-edit-cam function) -(define-extern clmf-to-vol-attr function) -(define-extern clmf-to-spline-attr function) -(define-extern clmf-to-intro-attr function) -(define-extern clmf-to-index-attr function) -(define-extern clmf-to-focalpull-attr function) -(define-extern clmf-to-edit function) -(define-extern clmf-to-select function) -(define-extern clmf-look-through function) -(define-extern clmf-save-one function) -(define-extern clmf-save-all function) -(define-extern clmf-cam-flag-toggle function) -(define-extern clmf-cam-flag function) -(define-extern clmf-cam-float-adjust function) -(define-extern clmf-cam-meters function) -(define-extern clmf-cam-fov function) -(define-extern clmf-cam-deg function) -(define-extern clmf-cam-intro-time function) -(define-extern clmf-cam-interp-time function) -(define-extern clmf-cam-float function) -(define-extern clmf-cam-string function) -(define-extern cam-layout-restart function) +(define-extern camera-line-draw (function vector vector symbol)) +(define-extern cam-layout-intersect-dist (function vector vector vector float)) +(define-extern clmf-button-test (function symbol)) +(define-extern clmf-bna (function symbol)) +(define-extern clmf-implement (function symbol)) +(define-extern clmf-pos-rot (function symbol symbol symbol :behavior cam-layout)) +(define-extern clmf-next-vol-dpad (function symbol)) +(define-extern clmf-to-edit-cam (function symbol)) +(define-extern clmf-to-vol-attr (function symbol :behavior cam-layout)) +(define-extern clmf-to-spline-attr (function symbol)) +(define-extern clmf-to-intro-attr (function symbol)) +(define-extern clmf-to-index-attr (function symbol)) +(define-extern clmf-to-focalpull-attr (function symbol)) +(define-extern clmf-to-edit (function symbol :behavior cam-layout)) +(define-extern clmf-to-select (function symbol)) +(define-extern clmf-look-through (function symbol :behavior cam-layout)) +(define-extern clmf-save-one (function symbol symbol :behavior cam-layout)) +(define-extern clmf-save-all (function symbol symbol :behavior cam-layout)) +(define-extern clmf-cam-flag-toggle (function int int symbol :behavior cam-layout)) +(define-extern clmf-cam-flag (function string uint uint symbol :behavior cam-layout)) +(define-extern clmf-cam-float-adjust (function symbol (pointer float) symbol :behavior cam-layout)) +(define-extern clmf-cam-meters (function meters symbol symbol :behavior cam-layout)) +(define-extern clmf-cam-fov (function degrees symbol symbol :behavior cam-layout)) +(define-extern clmf-cam-deg (function degrees symbol symbol :behavior cam-layout)) +(define-extern clmf-cam-intro-time (function float symbol symbol :behavior cam-layout)) +(define-extern clmf-cam-interp-time (function float symbol symbol :behavior cam-layout)) +(define-extern clmf-cam-float (function float symbol symbol :behavior cam-layout)) +(define-extern clmf-cam-string (function string symbol symbol :behavior cam-layout)) +(define-extern cam-layout-restart (function none)) ;; - Symbols @@ -18863,29 +18931,29 @@ ;; - Unknowns -;;(define-extern *camera-layout-blink* object) ;; unknown type -;;(define-extern *last-cur-entity* object) ;; unknown type -;;(define-extern *clm-select* object) ;; unknown type -;;(define-extern *clm* object) ;; unknown type -;;(define-extern cam-layout-active object) ;; unknown type -;;(define-extern *camera-layout-message-ypos* object) ;; unknown type -;;(define-extern *CAM_LAYOUT-bank* object) ;; unknown type -;;(define-extern *clm-edit* object) ;; unknown type -;;(define-extern *clm-focalpull-attr* object) ;; unknown type -;;(define-extern *clm-index-attr* object) ;; unknown type -;;(define-extern *clm-intro-attr* object) ;; unknown type -;;(define-extern *clm-spline-attr* object) ;; unknown type -;;(define-extern *clm-vol-attr* object) ;; unknown type -;;(define-extern *volume-descriptor-current* object) ;; unknown type -;;(define-extern *volume-point-current* object) ;; unknown type -;;(define-extern *volume-normal-current* object) ;; unknown type -;;(define-extern *volume-descriptor* object) ;; unknown type -;;(define-extern *volume-point* object) ;; unknown type -;;(define-extern *volume-normal* object) ;; unknown type -;;(define-extern *clm-cam-attr* object) ;; unknown type -;;(define-extern *clm-cam-lookthrough* object) ;; unknown type -;;(define-extern *clm-save-all* object) ;; unknown type -;;(define-extern *clm-save-one* object) ;; unknown type +(define-extern *camera-layout-blink* symbol) ;; unknown type +(define-extern *last-cur-entity* int) ;; unknown type +(define-extern *clm-select* clm) ;; unknown type +(define-extern *clm* clm) ;; unknown type +(define-extern cam-layout-active (state cam-layout)) ;; unknown type +(define-extern *camera-layout-message-ypos* int) ;; unknown type +(define-extern *CAM_LAYOUT-bank* cam-layout-bank) ;; unknown type +(define-extern *clm-edit* clm) ;; unknown type +(define-extern *clm-focalpull-attr* clm) ;; unknown type +(define-extern *clm-index-attr* clm) ;; unknown type +(define-extern *clm-intro-attr* clm) ;; unknown type +(define-extern *clm-spline-attr* clm) ;; unknown type +(define-extern *clm-vol-attr* clm) ;; unknown type +(define-extern *volume-descriptor-current* int) ;; unknown type +(define-extern *volume-point-current* int) ;; unknown type +(define-extern *volume-normal-current* int) ;; unknown type +(define-extern *volume-descriptor* vol-control) ;; unknown type +(define-extern *volume-point* vector-array) ;; unknown type +(define-extern *volume-normal* vector-array) ;; unknown type +(define-extern *clm-cam-attr* clm) ;; unknown type +(define-extern *clm-cam-lookthrough* clm) ;; unknown type +(define-extern *clm-save-all* clm) ;; unknown type +(define-extern *clm-save-one* clm) ;; unknown type ;; ---------------------- @@ -18896,38 +18964,38 @@ ;; - Types -; (deftype cam-dbg-scratch (structure) -; ((linevec4w UNKNOWN 2 :offset-assert 0) -; (color vector :inline :offset-assert 32) -; (plotvec UNKNOWN 2 :offset-assert 48) -; (linevec UNKNOWN 2 :offset-assert 80) -; (rel-vec vector :inline :offset-assert 112) -; (sphere-v-start vector :inline :offset-assert 128) -; (sphere-v-end vector :inline :offset-assert 144) -; (sphere-v-down vector :inline :offset-assert 160) -; (sphere-vec vector :inline :offset-assert 176) -; (crossvec UNKNOWN 3 :offset-assert 192) -; (bboxvec UNKNOWN 6 :offset-assert 240) -; (fov-vv UNKNOWN 4 :offset-assert 336) -; (fov-src vector :inline :offset-assert 400) -; (fov-dest vector :inline :offset-assert 416) -; (fov-vert vector :inline :offset-assert 432) -; (fov-horz vector :inline :offset-assert 448) -; ) -; :method-count-assert 9 -; :size-assert #x1d0 -; :flag-assert #x9000001d0 -; ) +(deftype cam-dbg-scratch (structure) + ((linevec4w vector4w 2 :inline :offset-assert 0) + (color vector :inline :offset-assert 32) + (plotvec vector 2 :inline :offset-assert 48) + (linevec vector 2 :inline :offset-assert 80) + (rel-vec vector :inline :offset-assert 112) + (sphere-v-start vector :inline :offset-assert 128) + (sphere-v-end vector :inline :offset-assert 144) + (sphere-v-down vector :inline :offset-assert 160) + (sphere-vec vector :inline :offset-assert 176) + (crossvec vector 3 :inline :offset-assert 192) + (bboxvec vector 6 :inline :offset-assert 240) + (fov-vv vector 4 :inline :offset-assert 336) + (fov-src vector :inline :offset-assert 400) + (fov-dest vector :inline :offset-assert 416) + (fov-vert vector :inline :offset-assert 432) + (fov-horz vector :inline :offset-assert 448) + ) + :method-count-assert 9 + :size-assert #x1d0 + :flag-assert #x9000001d0 + ) -; (deftype cam-debug-tri (structure) -; ((vertex UNKNOWN 3 :offset-assert 0) -; (intersect vector :inline :offset-assert 48) -; (color vector4w :offset-assert 64) -; ) -; :method-count-assert 9 -; :size-assert #x44 -; :flag-assert #x900000044 -; ) +(deftype cam-debug-tri (structure) + ((vertex vector 3 :inline :offset-assert 0) + (intersect vector :inline :offset-assert 48) + (color vector4w :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x44 + :flag-assert #x900000044 + ) (deftype cam-collision-record (structure) ((pos vector :inline :offset-assert 0) @@ -18944,57 +19012,55 @@ (view-off-param float :offset-assert 152) (frame int32 :offset-assert 156) (iteration int32 :offset-assert 160) - (move-type basic :offset-assert 164) + (move-type symbol :offset-assert 164) ) :method-count-assert 9 :size-assert #xa8 :flag-assert #x9000000a8 ) -; (deftype cam-collision-record-array (inline-array-class) -; ((length int32 :offset-assert 4) -; (allocated-length int32 :offset-assert 8) -; (data UNKNOWN :dynamic :offset-assert 16) -; ) -; :method-count-assert 9 -; :size-assert #x10 -; :flag-assert #x900000010 -; ) +(deftype cam-collision-record-array (inline-array-class) + ((data cam-collision-record :dynamic :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) ;; - Functions -(define-extern cam-collision-record-draw function) -(define-extern master-draw-coordinates function) -(define-extern cam-debug-draw-tris function) -(define-extern cam-collision-record-step function) -(define-extern camera-sphere function) -(define-extern camera-line-rel function) -(define-extern camera-fov-draw function) -(define-extern cam-line-dma function) -(define-extern camera-line2d function) +(define-extern cam-collision-record-draw (function none)) +(define-extern master-draw-coordinates (function vector none)) +(define-extern cam-debug-draw-tris (function basic basic rgba symbol)) +(define-extern cam-collision-record-step (function int none)) +(define-extern camera-sphere (function vector float rgba none)) +(define-extern camera-line-rel (function vector vector rgba none)) +(define-extern camera-fov-draw (function int int vector float float vector symbol)) +(define-extern cam-line-dma (function pointer)) +(define-extern camera-line2d (function (pointer vector4w) (pointer vector4w) pointer)) (define-extern camera-plot-float-func (function float float float float (function float float) vector4w none)) -(define-extern cam-debug-add-coll-tri function) -(define-extern debug-euler function) -(define-extern bike-cam-limit function) +(define-extern cam-debug-add-coll-tri (function cam-debug-tri vector cam-debug-tri none)) +(define-extern debug-euler (function cam-dbg-scratch object)) +(define-extern bike-cam-limit (function float float)) (define-extern external-cam-reset! (function none)) ;; TODO - unconfirmed ;; - Unknowns -;;(define-extern *camera-old-level* object) ;; unknown type -;;(define-extern *camera-old-cpu* object) ;; unknown type -;;(define-extern *camera-old-vu* object) ;; unknown type -;;(define-extern *camera-old-tfrag-bytes* object) ;; unknown type -;;(define-extern *camera-old-stat-string-tfrag-near* object) ;; unknown type -;;(define-extern *camera-old-stat-string-tfrag* object) ;; unknown type -;;(define-extern *camera-old-stat-string-total* object) ;; unknown type -;;(define-extern *cam-collision-record-show* object) ;; unknown type -;;(define-extern *cam-collision-record* object) ;; unknown type -;;(define-extern *cam-collision-record-last* object) ;; unknown type -;;(define-extern *cam-collision-record-first* object) ;; unknown type -;;(define-extern *cam-debug-los-tri* object) ;; unknown type -;;(define-extern *cam-debug-los-tri-current* object) ;; unknown type -;;(define-extern *cam-debug-coll-tri* object) ;; unknown type -;;(define-extern *cam-debug-coll-tri-current* object) ;; unknown type +(define-extern *camera-old-level* string) ;; unknown type +(define-extern *camera-old-cpu* int) ;; unknown type +(define-extern *camera-old-vu* int) ;; unknown type +(define-extern *camera-old-tfrag-bytes* int) ;; unknown type +(define-extern *camera-old-stat-string-tfrag-near* string) ;; unknown type +(define-extern *camera-old-stat-string-tfrag* string) ;; unknown type +(define-extern *camera-old-stat-string-total* string) ;; unknown type +(define-extern *cam-collision-record-show* int) ;; unknown type +(define-extern *cam-collision-record* cam-collision-record-array) ;; unknown type +(define-extern *cam-collision-record-last* int) ;; unknown type +(define-extern *cam-collision-record-first* int) ;; unknown type +(define-extern *cam-debug-los-tri* (pointer cam-debug-tri)) ;; unknown type +(define-extern *cam-debug-los-tri-current* int) ;; unknown type +(define-extern *cam-debug-coll-tri* (pointer cam-debug-tri)) ;; unknown type +(define-extern *cam-debug-coll-tri-current* int) ;; unknown type ;; ---------------------- @@ -19694,7 +19760,7 @@ (define-extern target-death-anim function) (define-extern death-movie-remap function) -(define-extern pov-camera-init-by-other (function vector skeleton-group string int symbol pair none)) ;; TODO - not confirmed -- sunken-elevator +(define-extern pov-camera-init-by-other (function vector skeleton-group string int process-drawable pair none :behavior pov-camera)) ;; TODO - not confirmed -- sunken-elevator (define-extern target-hit-effect function) (define-extern target-hit-setup-anim function) (define-extern target-hit-move function) @@ -20679,7 +20745,7 @@ ;; - Functions -(define-extern pov-camera-play-and-reposition function) +(define-extern pov-camera-play-and-reposition (function joint-anim-compressed vector float none :behavior pov-camera)) ;; ---------------------- 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 83d31a3dff..46e2811f55 100644 --- a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc @@ -8,9 +8,7 @@ [32, "(function process symbol)"] ], - "hud": [ - [10, "(function none :behavior hud)"] - ], + "hud": [[10, "(function none :behavior hud)"]], "main": [[4, "(function none :behavior process)"]], @@ -512,7 +510,7 @@ [6, "(function process-drawable none)"], [7, "(function none :behavior process-drawable)"], [8, "(function object)"] - ], + ], "default-menu": [ [3, "(function none)"], @@ -574,7 +572,6 @@ [89, "(function debug-menu debug-menu symbol)"], // not 100% sure about the debug-menu, but it has a string at offset 0 [90, "(function debug-menu debug-menu symbol)"] // not 100% sure about the debug-menu, but it has a string at offset 0 ], - "memory-usage": [ [3, "(function basic symbol)"], [2, "(function process symbol)"] @@ -585,22 +582,27 @@ [12, "(function none :behavior anim-tester)"], [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)"] + [1, "(function none :behavior camera-combiner)"], + [ + 2, + "(function basic int basic event-message-block object :behavior camera-combiner)" + ] ], - "title-obs": [ - [0, "(function none)"] - ], + "title-obs": [[0, "(function none)"]], + + "title-obs": [[0, "(function none)"]], "misty-warehouse": [ [3, "(function symbol none :behavior silostep)"], [4, "(function none :behavior silostep)"], [6, "(function none :behavior camera-tracker)"], [7, "(function none :behavior silostep)"], - [8, "(function process int symbol event-message-block none :behavior silostep)"] + [ + 8, + "(function process int symbol event-message-block none :behavior silostep)" + ] ], "rigid-body": [ @@ -675,13 +677,9 @@ [12, "(function sparticle-system sparticle-cpuinfo none)"] ], - "basebutton": [ - [1, "(function symbol :behavior target)"] - ], + "basebutton": [[1, "(function symbol :behavior target)"]], - "entity": [ - [10, "(function process-drawable none)"] - ], + "entity": [[10, "(function process-drawable none)"]], "beach-rocks": [ [2, "(function none :behavior beach-rock)"], @@ -689,12 +687,13 @@ [4, "(function none :behavior beach-rock)"], [5, "(function none :behavior beach-rock)"], [6, "(function none :behavior beach-rock)"], - [7, "(function process int symbol event-message-block none :behavior beach-rock)"] + [ + 7, + "(function process int symbol event-message-block none :behavior beach-rock)" + ] ], - "projectiles": [ - [27, "(function projectile int)"] - ], + "projectiles": [[27, "(function projectile int)"]], "sidekick-human": [ [7, "(function sparticle-launch-control :behavior sequenceC)"], @@ -702,9 +701,7 @@ [16, "(function sparticle-launch-control :behavior sequenceB)"] ], - "demo-obs": [ - [1, "(function target)"] - ], + "demo-obs": [[1, "(function target)"]], "final-door": [ [11, "(function final-door symbol)"], @@ -717,16 +714,32 @@ [6, "(function none :behavior plat-eco)"], // post [7, "(function handle none :behavior plat-eco)"], // code [8, "(function none :behavior plat-eco)"], // trans - [9, "(function process int symbol event-message-block object :behavior plat-eco)"], // event + [ + 9, + "(function process int symbol event-message-block object :behavior plat-eco)" + ], // event [10, "(function symbol :behavior plat-eco)"], // code [11, "(function none :behavior plat-eco)"], // trans [12, "(function int :behavior plat-eco)"], // enter - [13, "(function process int symbol event-message-block object :behavior plat-eco)"] // event + [ + 13, + "(function process int symbol event-message-block object :behavior plat-eco)" + ] // event ], "plat-flip": [ [1, "(function none :behavior plat-flip)"], // code - [2, "(function process int symbol event-message-block object :behavior plat-flip)"] // event + [ + 2, + "(function process int symbol event-message-block object :behavior plat-flip)" + ] // event + ], + + "pov-camera": [ + [ + 1, + "(function process int symbol event-message-block object :behavior pov-camera)" + ] ], "flying-lurker": [ @@ -736,12 +749,13 @@ ], "ambient": [ - [29, "(function process int symbol event-message-block object :behavior level-hint)"] + [ + 29, + "(function process int symbol event-message-block object :behavior level-hint)" + ] ], - "process-taskable": [ - [46, "(function process-taskable symbol)"] - ], + "process-taskable": [[46, "(function process-taskable symbol)"]], "fishermans-boat": [ [5, "(function none :behavior fishermans-boat)"], @@ -749,13 +763,9 @@ [29, "(function none :behavior fishermans-boat)"] ], - "muse": [ - [3, "(function none :behavior muse)"] - ], + "muse": [[3, "(function none :behavior muse)"]], - "relocate": [ - [6, "(function sparticle-system sparticle-cpuinfo none)"] - ], + "relocate": [[6, "(function sparticle-system sparticle-cpuinfo none)"]], "fisher-JUN": [ [27, "(function none :behavior process)"], diff --git a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc index 11fe9c48c0..f14dc84af6 100644 --- a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc @@ -275,12 +275,6 @@ // collide-shape-rider "(method 35 collide-shape)", - // cam-master BUG - "master-is-hopeful-better?", - - // cam-layout BUG - "cam-layout-save-cam-trans", - // process-drawable BUG "cspace-inspect-tree", // BUG: "process-drawable-birth-fuel-cell", // BUG: @@ -366,7 +360,6 @@ "(anon-function 2 target-tube)", "(anon-function 5 orbit-plat)", "(anon-function 2 ogreboss)" - ], // these functions use pairs and the decompiler @@ -449,20 +442,7 @@ // this one is all asm branches "circle-circle-xz-intersect": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14 + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ], "find-knot-span": [0, 1, 2, 3, 5, 6, 7, 8, 9], @@ -489,19 +469,44 @@ "start-perf-stat-collection": [26], "end-perf-stat-collection": [0], "sprite-draw-distorters": [4, 5], - "draw-string":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189], - "get-string-length":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], - "unpack-comp-rle":[1, 3, 5, 6], - "(method 16 level)":[ 1, 5, 13, 14, 15, 19, 26, 53], - "unpack-comp-huf":[2, 4, 5, 6, 7, 8, 9], - "blerc-execute":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33], - "(method 11 fact-info-target)":[42], - "(anon-function 9 game-save)":[3, 4, 5, 6, 7, 8], + "draw-string": [ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189 + ], + "get-string-length": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 + ], + "unpack-comp-rle": [1, 3, 5, 6], + "(method 16 level)": [1, 5, 13, 14, 15, 19, 26, 53], + "unpack-comp-huf": [2, 4, 5, 6, 7, 8, 9], + "blerc-execute": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 + ], + "(method 11 fact-info-target)": [42], + "(anon-function 9 game-save)": [3, 4, 5, 6, 7, 8], //"(anon-function 9 game-save)":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], - "particle-adgif":[0, 1, 2, 3, 4, 5, 7], - "sp-launch-particles-var":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66], - "(method 11 sparticle-launch-control)": [ 27, 28, 35, 46, 48, 49, 77], - "upload-vis-bits":[0,1,2,3,4,5, 6] + "particle-adgif": [0, 1, 2, 3, 4, 5, 7], + "sp-launch-particles-var": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 + ], + "(method 11 sparticle-launch-control)": [27, 28, 35, 46, 48, 49, 77], + "upload-vis-bits": [0, 1, 2, 3, 4, 5, 6] }, // Sometimes the game might use format strings that are fetched dynamically, @@ -510,36 +515,24 @@ // e.g. "function-name":[[op, argc], [op, argc], ...] // where "op" is the op number for the call to format. "dynamic_format_arg_counts": { - "(method 35 progress)":[ + "(method 35 progress)": [ [44, 1], [92, 1] ], - "(method 49 progress)":[ - [35, 1] - ], - "(method 37 progress)":[ - [41, 1] - ], - "(method 38 progress)":[ - [106, 1] - ], - "(method 39 progress)":[ - [41, 1] - ], - "(method 41 progress)":[ - [73, 1] - ], - "(method 42 progress)":[ - [41, 1] - ], - "(method 43 progress)":[ + "(method 49 progress)": [[35, 1]], + "(method 37 progress)": [[41, 1]], + "(method 38 progress)": [[106, 1]], + "(method 39 progress)": [[41, 1]], + "(method 41 progress)": [[73, 1]], + "(method 42 progress)": [[41, 1]], + "(method 43 progress)": [ [51, 1], [94, 1] ], - "":[] + "": [] }, - "mips2c_functions_by_name":[ + "mips2c_functions_by_name": [ "sp-init-fields!", "particle-adgif", "sp-launch-particles-var", @@ -555,5 +548,3 @@ "adgif-shader<-texture-with-update!" ] } - - diff --git a/decompiler/config/jak1_ntsc_black_label/inputs.jsonc b/decompiler/config/jak1_ntsc_black_label/inputs.jsonc index b2ba6c38b3..5132abcca8 100644 --- a/decompiler/config/jak1_ntsc_black_label/inputs.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/inputs.jsonc @@ -262,8 +262,5 @@ //"audio_dir_file_name": "jak1/VAG", "audio_dir_file_name": "", - "streamed_audio_file_names": [ - "VAGWAD.ENG", - "VAGWAD.JAP" - ] + "streamed_audio_file_names": ["VAGWAD.ENG", "VAGWAD.JAP"] } diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index a81fdc51f4..4e2b9b3412 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -1,10 +1,9 @@ - // the format is [label_name, type, special] +// the format is [label_name, type, special] - // if the type is pointer or inline array, special should be an integer size. - // if the type is a value type (like rgba), special should be true. +// if the type is pointer or inline array, special should be an integer size. +// if the type is a value type (like rgba), special should be true. { - "vector-h": [ ["L32", "vector"], ["L31", "vector"], @@ -17,7 +16,6 @@ "quaternion-h": [["L1", "quaternion"]], - "quaternion": [ ["L67", "vector"], ["L68", "vector"], @@ -27,9 +25,7 @@ ["L72", "vector"] ], - "geometry": [ - ["L112", "(pointer float)", 4] - ], + "geometry": [["L112", "(pointer float)", 4]], "trigonometry": [ ["L98", "(pointer float)", 32], @@ -46,13 +42,9 @@ ["L17", "font-work"] ], - "display": [ - ["L76", "(pointer uint32)", 2] - ], + "display": [["L76", "(pointer uint32)", 2]], - "capture": [ - ["L12", "gs-store-image-packet"] - ], + "capture": [["L12", "gs-store-image-packet"]], "main-h": [["L1", "frame-stats"]], @@ -103,21 +95,13 @@ ["L53", "vector"] ], - "sprite": [ - ["L58", "vu-function"] - ], + "sprite": [["L58", "vu-function"]], - "sprite-distort": [ - ["L27", "vu-function"] - ], + "sprite-distort": [["L27", "vu-function"]], - "merc-vu1": [ - ["L1", "vu-function"] - ], + "merc-vu1": [["L1", "vu-function"]], - "background": [ - ["L51", "vu-function"] - ], + "background": [["L51", "vu-function"]], "debug": [ ["L179", "vector2h"], @@ -260,38 +244,24 @@ ["L231", "(pointer uint64)", 1] ], - "progress-static": [ - ["L121", "(array game-text-id)"] - ], + "progress-static": [["L121", "(array game-text-id)"]], - "rigid-body": [ - ["L89", "rigid-body-platform-constants"] - ], + "rigid-body": [["L89", "rigid-body-platform-constants"]], - "nav-enemy": [ - ["L349", "attack-info"] - ], + "nav-enemy": [["L349", "attack-info"]], "basebutton": [ ["L97", "vector"], ["L102", "vector"] ], - "bird-lady": [ - ["L29", "vector"] - ], + "bird-lady": [["L29", "vector"]], - "bird-lady-beach": [ - ["L26", "vector"] - ], + "bird-lady-beach": [["L26", "vector"]], - "mayor": [ - ["L57", "vector"] - ], + "mayor": [["L57", "vector"]], - "sculptor": [ - ["L89", "vector"] - ], + "sculptor": [["L89", "vector"]], "oracle": [ ["L55", "vector"], @@ -304,34 +274,22 @@ ["L30", "vector"] ], - "explorer": [ - ["L77", "vector"] - ], + "explorer": [["L77", "vector"]], - "sage": [ - ["L91", "vector"] - ], + "sage": [["L91", "vector"]], "misty-teetertotter": [ ["L26", "attack-info"], ["L27", "attack-info"] ], - "farmer": [ - ["L28", "vector"] - ], + "farmer": [["L28", "vector"]], - "gambler": [ - ["L52", "vector"] - ], + "gambler": [["L52", "vector"]], - "warrior": [ - ["L30", "vector"] - ], + "warrior": [["L30", "vector"]], - "geologist": [ - ["L38", "vector"] - ], + "geologist": [["L38", "vector"]], "font": [ ["L95", "(inline-array vector)", 250], @@ -376,9 +334,7 @@ "shadow-cpu": [["L122", "shadow-data"]], - "load-boundary": [ - ["L327", "(inline-array lbvtx)", 3] - ], + "load-boundary": [["L327", "(inline-array lbvtx)", 3]], "default-menu": [ ["L6251", "float", true], @@ -419,9 +375,7 @@ // ["L14", "gif-tag-regs", true] // ], - "merc-blend-shape": [ - ["L62", "(pointer int16)", 32] - ], + "merc-blend-shape": [["L62", "(pointer int16)", 32]], "miners": [ ["L111", "vector"], @@ -443,9 +397,7 @@ ["L471", "vector4w"] ], - "assistant": [ - ["L71", "vector"] - ], + "assistant": [["L71", "vector"]], "progress": [ ["L667", "uint64", true], @@ -530,13 +482,9 @@ ["L341", "uint64", true] ], - "projectiles": [ - ["L150", "attack-info"] - ], + "projectiles": [["L150", "attack-info"]], - "generic-obs": [ - ["L455", "quaternion"] - ], + "generic-obs": [["L455", "quaternion"]], "blocking-plane": [ ["L18", "vector"], @@ -561,25 +509,15 @@ ["L994", "uint64", true] ], - "assistant-firecanyon": [ - ["L71", "vector"] - ], + "assistant-firecanyon": [["L71", "vector"]], - "sage-bluehut": [ - ["L82", "vector"] - ], + "sage-bluehut": [["L82", "vector"]], - "flutflut-bluehut": [ - ["L34", "vector"] - ], + "flutflut-bluehut": [["L34", "vector"]], - "sharkey": [ - ["L101", "attack-info"] - ], + "sharkey": [["L101", "attack-info"]], - "assistant-citadel": [ - ["L28", "vector"] - ], + "assistant-citadel": [["L28", "vector"]], "robotboss-h": [ ["L67", "float", true], @@ -612,25 +550,242 @@ ["L323", "vector2h"] ], - "hint-control": [ - ["L45", "(array task-hint-control-group)"] + "hint-control": [["L45", "(array task-hint-control-group)"]], + + "cam-master": [ + ["L356", "vector"], + ["L357", "vector"] ], - "sparticle-launcher": [ - ["L192", "adgif-shader"] + "cam-states": [ + ["L630", "vector"], + ["L631", "vector"], + ["L632", "vector"], + ["L633", "vector"], + ["L672", "float", true], + ["L673", "float", true], + ["L674", "float", true], + ["L675", "float", true], + ["L676", "float", true], + ["L677", "float", true], + ["L678", "float", true], + ["L679", "float", true], + ["L680", "float", true], + ["L681", "float", true], + ["L682", "float", true], + ["L683", "float", true], + ["L684", "float", true], + ["L685", "float", true], + ["L686", "float", true], + ["L687", "float", true], + ["L688", "float", true], + ["L689", "float", true], + ["L690", "float", true], + ["L691", "float", true], + ["L692", "float", true], + ["L693", "float", true], + ["L694", "float", true], + ["L695", "float", true], + ["L696", "float", true], + ["L697", "float", true], + ["L698", "float", true], + ["L699", "float", true], + ["L700", "float", true], + ["L701", "float", true], + ["L702", "float", true], + ["L703", "float", true], + ["L704", "float", true], + ["L705", "float", true], + ["L706", "float", true], + ["L707", "float", true], + ["L708", "float", true], + ["L709", "float", true], + ["L710", "float", true], + ["L711", "float", true], + ["L712", "float", true], + ["L713", "float", true], + ["L714", "float", true], + ["L715", "float", true], + ["L716", "float", true], + ["L717", "float", true], + ["L718", "float", true], + ["L719", "float", true], + ["L720", "float", true], + ["L721", "float", true], + ["L722", "float", true], + ["L723", "float", true], + ["L724", "float", true], + ["L725", "float", true], + ["L726", "float", true], + ["L727", "float", true], + ["L728", "float", true], + ["L729", "float", true], + ["L730", "float", true], + ["L731", "float", true], + ["L732", "float", true], + ["L733", "float", true], + ["L734", "float", true], + ["L735", "float", true], + ["L736", "float", true], + ["L737", "float", true], + ["L738", "float", true], + ["L739", "float", true], + ["L740", "float", true], + ["L741", "float", true], + ["L742", "float", true], + ["L743", "float", true], + ["L744", "float", true], + ["L745", "float", true], + ["L790", "uint64", true], + ["L791", "uint64", true], + ["L792", "uint64", true], + ["L793", "uint64", true] ], - "process-taskable": [ - ["L251", "attack-info"] + "cam-states-dbg": [["L78", "camera-orbit-info"]], + + "cam-layout": [ + ["L766", "quaternion"], + ["L768", "vector"], + ["L775", "vector4w"], + ["L777", "vector4w"], + ["L779", "vector4w"], + ["L781", "vector4w"], + ["L783", "vector4w"], + ["L785", "vector4w"], + ["L787", "vector4w"], + ["L788", "vector4w"], + ["L789", "vector4w"], + ["L790", "vector4w"], + ["L791", "vector"], + ["L792", "vector"], + ["L793", "vector4w"], + ["L794", "vector"], + ["L795", "vector4w"], + ["L796", "vector"], + ["L797", "vector"], + ["L798", "vector4w"], + ["L799", "vector"], + ["L800", "vector4w"], + ["L801", "vector"], + ["L802", "vector"], + ["L803", "vector4w"], + ["L804", "vector"], + ["L805", "vector"], + ["L806", "vector4w"], + ["L807", "vector4w"], + ["L808", "vector"], + ["L809", "vector"], + ["L810", "vector4w"], + ["L811", "vector4w"], + ["L812", "vector"], + ["L813", "vector"], + ["L814", "vector4w"], + ["L815", "vector"], + ["L816", "vector"], + ["L817", "vector4w"], + ["L818", "vector"], + ["L819", "vector"], + ["L820", "vector4w"], + ["L821", "vector"], + ["L822", "vector"], + ["L823", "vector"], + ["L824", "vector"], + ["L832", "vector4w"], + ["L872", "float", true], + ["L873", "float", true], + ["L874", "(pointer float)", 1], + ["L875", "(pointer float)", 1], + ["L876", "float", true], + ["L877", "float", true], + ["L878", "float", true], + ["L879", "float", true], + ["L880", "float", true], + ["L881", "(pointer float)", 1], + ["L882", "float", true], + ["L883", "float", true], + ["L884", "(pointer float)", 1], + ["L885", "(pointer float)", 1], + ["L886", "float", true], + ["L887", "float", true], + ["L888", "(pointer float)", 1], + ["L889", "(pointer float)", 1], + ["L890", "(pointer float)", 1], + ["L891", "(pointer float)", 1], + ["L892", "(pointer float)", 1], + ["L893", "float", true], + ["L894", "float", true], + ["L895", "float", true], + ["L896", "(pointer float)", 1], + ["L897", "(pointer float)", 1], + ["L898", "(pointer float)", 1], + ["L899", "float", true], + ["L900", "(pointer float)", 1], + ["L901", "uint64", true], + ["L904", "uint64", true], + ["L905", "uint64", true], + ["L906", "uint64", true], + ["L907", "uint64", true], + ["L908", "uint64", true], + ["L909", "uint64", true], + ["L910", "uint64", true] ], - "babak-with-cannon": [ - ["L92", "vector"] + "cam-debug": [ + ["L174", "rgba", true], + ["L175", "rgba", true], + ["L176", "rgba", true], + ["L177", "rgba", true], + ["L178", "rgba", true], + ["L209", "rgba", true], + ["L210", "rgba", true], + ["L211", "rgba", true], + ["L212", "rgba", true], + ["L213", "rgba", true], + ["L214", "rgba", true], + ["L215", "rgba", true], + ["L216", "rgba", true], + ["L217", "rgba", true], + ["L218", "rgba", true], + ["L219", "rgba", true], + ["L220", "rgba", true], + ["L221", "rgba", true], + ["L222", "rgba", true], + ["L223", "rgba", true], + ["L224", "rgba", true], + ["L225", "rgba", true], + ["L226", "rgba", true], + ["L227", "rgba", true], + ["L228", "rgba", true], + ["L229", "rgba", true], + ["L230", "rgba", true], + ["L231", "rgba", true], + ["L232", "rgba", true], + ["L233", "rgba", true], + ["L234", "rgba", true], + ["L239", "rgba", true], + ["L240", "rgba", true], + ["L241", "rgba", true], + ["L242", "rgba", true], + ["L243", "vector"], + ["L244", "vector"], + ["L245", "rgba", true], + ["L246", "vector"], + ["L247", "vector"], + ["L254", "vector"], + ["L255", "vector"], + ["L256", "vector"], + ["L257", "vector"], + ["L263", "rgba", true] ], - "flutflut": [ - ["L94", "vector"] - ], + "sparticle-launcher": [["L192", "adgif-shader"]], + + "process-taskable": [["L251", "attack-info"]], + + "babak-with-cannon": [["L92", "vector"]], + + "flutflut": [["L94", "vector"]], "fishermans-boat": [ ["L210", "vector"], @@ -643,9 +798,7 @@ ["L434", "rigid-body-platform-constants"] ], - "training-obs": [ - ["L175", "rigid-body-platform-constants"] - ], + "training-obs": [["L175", "rigid-body-platform-constants"]], "bonelurker": [ ["L72", "attack-info"], @@ -663,13 +816,9 @@ ["L268", "vector"] ], - "citb-plat": [ - ["L155", "rigid-body-platform-constants"] - ], + "citb-plat": [["L155", "rigid-body-platform-constants"]], - "qbert-plat": [ - ["L99", "rigid-body-platform-constants"] - ], + "qbert-plat": [["L99", "rigid-body-platform-constants"]], "misty-conveyor": [ ["L60", "vector"], @@ -691,25 +840,15 @@ ["L46", "vector"] ], - "gnawer": [ - ["L216", "(inline-array gnawer-segment-info)", 10] - ], + "gnawer": [["L216", "(inline-array gnawer-segment-info)", 10]], - "target-tube": [ - ["L142", "vector"] - ], + "target-tube": [["L142", "vector"]], - "assistant-village3": [ - ["L43", "vector"] - ], + "assistant-village3": [["L43", "vector"]], - "sage-village3": [ - ["L74", "vector"] - ], + "sage-village3": [["L74", "vector"]], - "target-snowball": [ - ["L23", "vector"] - ], + "target-snowball": [["L23", "vector"]], "ice-cube": [ ["L212", "attack-info"], @@ -717,9 +856,7 @@ ["L215", "attack-info"] ], - "assistant-lavatube": [ - ["L30", "vector"] - ], + "assistant-lavatube": [["L30", "vector"]], "citadel-part": [ ["L235", "float", true], @@ -737,13 +874,9 @@ ["L245", "uint64", true] ], - "sunken-part": [ - ["L220", "uint64", true] - ], + "sunken-part": [["L220", "uint64", true]], - "ogre-part": [ - ["L93", "uint64", true] - ], + "ogre-part": [["L93", "uint64", true]], "collectables-part": [ ["L309", "float", true], @@ -765,13 +898,9 @@ ["L233", "uint64", true] ], - "village3-part": [ - ["L244", "uint64", true] - ], + "village3-part": [["L244", "uint64", true]], - "lavatube-part": [ - ["L110", "uint64", true] - ], + "lavatube-part": [["L110", "uint64", true]], "hud-classes": [ ["L279", "vector"], @@ -799,9 +928,7 @@ ["L733", "uint64", true] ], - "sky": [ - ["L13", "vu-function"] - ], + "sky": [["L13", "vu-function"]], "sky-tng": [ ["L82", "sky-work"], @@ -826,9 +953,7 @@ ["L314", "float", true] ], - "seagull": [ - ["L226", "(inline-array air-box)", 20] - ], + "seagull": [["L226", "(inline-array air-box)", 20]], "rolling-race-ring": [ ["L94", "vector"], @@ -840,9 +965,7 @@ ["L100", "vector"] ], - "part-tester": [ - ["L32", "uint64", true] - ], + "part-tester": [["L32", "uint64", true]], "anim-tester": [ ["L509", "(inline-array list-field)", 12], @@ -885,9 +1008,7 @@ ["L145", "vector"] ], - "robotboss-misc": [ - ["L99", "vector"] - ], + "robotboss-misc": [["L99", "vector"]], "robotboss": [ ["L646", "attack-info"], diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 00b07e7f44..563474abde 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -14,47 +14,37 @@ [16, "matrix"], [80, "matrix"] ], - "matrix-rotate-xyz!": [ [16, "matrix"], [80, "matrix"] ], - "matrix-rotate-zxy!": [ [16, "matrix"], [80, "matrix"] ], - "matrix-rotate-yxz!": [ [16, "matrix"], [80, "matrix"] ], - "matrix-rotate-yzx!": [ [16, "matrix"], [80, "matrix"] ], - "matrix-rotate-yxy!": [ [16, "vector"], [32, "vector"], [48, "vector"] ], - "matrix-rotate-yx!": [[16, "matrix"]], - "transform-matrix-calc!": [ [16, "matrix"], [80, "matrix"] ], - "transform-matrix-parent-calc!": [ [16, "matrix"], [80, "matrix"] ], - "matrix-with-scale->quaternion": [[16, "matrix"]], - "quaternion-exp!": [[16, "vector"]], "quaternion-slerp!": [[16, "vector"]], "quaternion-zxy!": [ @@ -62,11 +52,9 @@ [32, "vector"], [48, "vector"] ], - "vector-x-quaternion!": [[16, "matrix"]], "vector-y-quaternion!": [[16, "matrix"]], "vector-z-quaternion!": [[16, "matrix"]], - "quaternion-y-angle": [[16, "vector"]], "quaternion-rotate-local-x!": [[16, "quaternion"]], "quaternion-rotate-local-y!": [[16, "quaternion"]], @@ -97,11 +85,9 @@ [16, "quaternion"], [32, "matrix"] ], - "eul->matrix": [[16, "vector"]], "eul->quat": [[16, "matrix"]], "quat->eul": [[16, "matrix"]], - "vector-line-distance": [ [16, "vector"], [32, "vector"], @@ -114,20 +100,14 @@ [48, "vector"], [64, "vector"] ], - "forward-up-nopitch->inv-matrix": [[16, "vector"]], - "forward-up-nopitch->quaternion": [[16, "matrix"]], - "forward-up->quaternion": [ [16, "matrix"], [80, "vector"] ], - "quaternion-from-two-vectors!": [[16, "vector"]], - "quaternion-from-two-vectors-max-angle!": [[16, "vector"]], - "matrix-from-two-vectors!": [[16, "vector"]], "matrix-from-two-vectors-max-angle!": [[16, "vector"]], "matrix-from-two-vectors-max-angle-partial!": [[16, "vector"]], @@ -136,13 +116,11 @@ [16, "vector"], [32, "matrix"] ], - "matrix-rot-diff!": [ [16, "quaternion"], [32, "quaternion"], [48, "quaternion"] ], - "quaternion-seek": [ [16, "matrix"], [80, "matrix"], @@ -154,37 +132,26 @@ [80, "vector"], [96, "vector"] ], - "circle-test": [ [16, "sphere"], [32, "sphere"], [48, "vector"], [64, "vector"] ], - "move-target-from-pad": [ [16, "vector"], [32, "vector"], [48, "matrix"] ], - "draw-sprite2d-xy": [[16, "draw-context"]], "screen-gradient": [[16, "draw-context"]], - "(method 10 oscillating-vector)": [[16, "vector"]], - "show-mc-info": [[16, "mc-slot-info"]], - "update-mood-erase-color2": [[16, "mood-fog"]], - "make-light-kit": [[16, "matrix"]], - "matrix<-parented-transformq!": [[16, "vector"]], - "(method 20 trsqv)": [[16, "vector"]], - "(method 19 trsqv)": [[16, "vector"]], - "(method 17 trsqv)": [ [16, "quaternion"], [32, "vector"], @@ -192,30 +159,23 @@ [64, "vector"], [80, "vector"] ], - "(method 25 trsqv)": [ [16, "vector"], [32, "vector"], [48, "vector"], [64, "vector"] ], - "(method 16 trsqv)": [ [16, "matrix"], [80, "matrix"] ], - "(method 14 trsqv)": [[16, "vector"]], - "(method 13 trsqv)": [[16, "vector"]], - "(method 12 trsqv)": [ [16, "vector"], [32, "vector"] ], - "(method 11 trsqv)": [[16, "vector"]], - "(method 10 trsqv)": [ [16, "vector"], [32, "vector"] @@ -233,23 +193,17 @@ [192, "vector"], [208, "vector4s-3"] ], - "string->sound-name": [[16, "qword"]], - "(method 15 trajectory)": [ [16, "vector"], [32, "vector"] ], - "ripple-add-debug-sphere": [[16, "vector"]], - "camera-teleport-to-entity": [ [16, "transformq"], [64, "event-message-block"] ], - "(method 10 cam-vector-seeker)": [[16, "vector"]], - "joint-mod-look-at-handler": [ [16, "vector"], [32, "vector"], @@ -257,7 +211,6 @@ [80, "vector"], [96, "vector"] ], - "joint-mod-world-look-at-handler": [ [16, "vector"], [32, "vector"], @@ -267,30 +220,23 @@ [160, "vector"], [176, "matrix"] ], - "joint-mod-rotate-handler": [ [16, "quaternion"], [32, "quaternion"], [48, "quaternion"] ], - "joint-mod-wheel-callback": [ [16, "vector"], [32, "vector"], [48, "vector"] ], - "draw-end-credits": [[16, "font-context"]], - "draw-title-credits": [[16, "font-context"]], - "moving-sphere-sphere-intersect": [[16, "vector"]], - "moving-sphere-moving-sphere-intersect": [ [16, "vector"], [32, "vector"] ], - "(method 9 cylinder-flat)": [ [16, "vector"], [32, "vector"], @@ -299,7 +245,6 @@ [368, "matrix"], [432, "vector"] ], - "(method 9 cylinder)": [ [16, "vector"], [32, "vector"], @@ -308,41 +253,33 @@ [816, "matrix"], [880, "matrix"] ], - "ray-arbitrary-circle-intersect": [ [16, "vector"], [32, "vector"] ], - "(method 10 cylinder-flat)": [ [16, "vector"], [32, "vector"] ], - "(method 10 cylinder)": [ [16, "vector"], [32, "vector"] ], - "add-debug-sphere-from-table": [ [16, "vector"], [32, "vector"], [48, "vector"] ], - "make-debug-sphere-table": [ [16, "vector"], [32, "vector"], [48, "vector"], [64, "vector"] ], - "(method 20 actor-link-info)": [[16, "event-message-block"]], "(method 21 actor-link-info)": [[16, "event-message-block"]], "(method 23 actor-link-info)": [[16, "event-message-block"]], - "(method 24 actor-link-info)": [[16, "event-message-block"]], - "internal-draw-debug-line": [ [16, "vector4w-2"], [48, "vector4w-2"] @@ -399,14 +336,10 @@ [32, "tracking-spline-sampler"] ], - "draw-ocean-transition": [ - [16, "sphere"] - ], + "draw-ocean-transition": [[16, "sphere"]], "dm-cam-mode-func": [[16, "event-message-block"]], - "ocean-trans-add-upload-table": [ - [16, "vector"] - ], + "ocean-trans-add-upload-table": [[16, "vector"]], "dm-cam-settings-func": [[16, "event-message-block"]], @@ -440,7 +373,6 @@ [144, "vector"], [160, "vector"] ], - "(anon-function 494 task-control)": [[16, "event-message-block"]], "(anon-function 493 task-control)": [[16, "event-message-block"]], "(anon-function 480 task-control)": [[16, "event-message-block"]], @@ -488,78 +420,60 @@ [80, "quaternion"], [96, "vector"] ], - "closest-pt-in-triangle": [ [16, "vector"], [32, "vector"], [48, "vector"] ], - "vector-circle-tangent-new": [ [16, "sphere"], [32, "vector"], [48, "vector"] ], - "vector-circle-tangent": [ [16, "sphere"], [32, "vector"], [48, "vector"], [64, "vector"] ], - "vector-plane-distance": [[16, "vector"]], - "curve-length": [ [16, "vector"], [32, "vector"] ], - "curve-closest-point": [ [16, "vector"], [32, "vector"] ], - "(method 27 seagull)": [ [16, "vector"], [32, "vector"] ], - "add-debug-air-box": [ [16, "vector"], [32, "vector"] ], - "mem-size": [[16, "memory-usage-block"]], - "display-loop": [[16, "sphere"]], - "(method 14 curve-control)": [[16, "vector"]], - "(method 19 path-control)": [ [16, "vector"], [32, "vector"], [48, "vector"], [64, "vector"] ], - "progress-allowed?": [[16, "event-message-block"]], - "(method 9 align-control)": [ [16, "matrix"], [80, "quaternion"] ], - "(method 10 align-control)": [[16, "vector"]], - "(method 15 load-state)": [ [16, "event-message-block"], [96, "event-message-block"] ], - "(method 43 farmer)": [ - [16, "vector"] - ], + "(method 43 farmer)": [[16, "vector"]], "yakow-post": [ [16, "vector"], @@ -570,14 +484,10 @@ [96, "vector"] ], - "anim-tester-save-object-seqs": [ - [16, "file-stream"] - ], - + "anim-tester-save-object-seqs": [[16, "file-stream"]], "anim-test-obj-list-handler": [[16, "event-message-block"]], "anim-test-anim-list-handler": [[16, "event-message-block"]], "anim-test-sequence-list-handler": [[16, "event-message-block"]], - "anim-test-edit-sequence-list-handler": [[16, "event-message-block"]], "anim-test-edit-seq-insert-item": [[16, "event-message-block"]], "anim-test-edit-sequence-list-handler": [ [112, "event-message-block"], @@ -587,13 +497,7 @@ "anim-tester-start": [[16, "event-message-block"]], "anim-tester-add-sequence": [[16, "event-message-block"]], - "(anon-function 28 task-control)": [[16, "event-message-block"]], - - "instance-tfragment-add-debug-sphere": [ - [16, "vector"] - ], - - "(method 10 game-save)": [[16, "file-stream"]], + "instance-tfragment-add-debug-sphere": [[16, "vector"]], "cam-state-from-entity": [[16, "curve"]], @@ -605,50 +509,28 @@ [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"], @@ -656,33 +538,28 @@ [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 + [112, "matrix"], + [176, "vector"] ], - "v-slrp2!": [ [16, "vector"], [32, "vector"], @@ -690,7 +567,6 @@ [64, "matrix"], [128, "vector"] ], - "v-slrp3!": [ [16, "vector"], [32, "vector"], @@ -705,14 +581,11 @@ [80, "vector"], [96, "matrix"] ], - "cam-master-init": [ [16, "vector"], [32, "vector"] ], - "plane-from-points": [[16, "vector"]], - "update-view-planes": [ [16, "view-frustum"], [144, "vector"], @@ -722,11 +595,8 @@ [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"], @@ -738,27 +608,15 @@ [32, "vector"] ], - "(anon-function 28 task-control)": [[16, "event-message-block"]], + "update-mood-prt-color": [[16, "vector"]], - "update-mood-prt-color": [ - [16, "vector"] - ], + "update-mood-swamp": [[16, "vector"]], - "update-mood-swamp": [ - [16, "vector"] - ], + "update-mood-village1": [[16, "vector"]], - "update-mood-village1": [ - [16, "vector"] - ], + "update-mood-maincave": [[16, "vector"]], - "update-mood-maincave": [ - [16, "vector"] - ], - - "update-mood-ogre": [ - [16, "vector"] - ], + "update-mood-ogre": [[16, "vector"]], "update-mood-finalboss": [ [16, "vector"], @@ -814,29 +672,17 @@ [96, "vector"] ], - "ocean-transition-check": [ - [16, "vector"] - ], + "ocean-transition-check": [[16, "vector"]], - "ocean-trans-add-upload-strip": [ - [16, "vector"] - ], + "ocean-trans-add-upload-strip": [[16, "vector"]], - "draw-ocean-transition-seams": [ - [16, "sphere"] - ], + "draw-ocean-transition-seams": [[16, "sphere"]], - "(method 32 mayor)": [ - [16, "event-message-block"] - ], + "(method 32 mayor)": [[16, "event-message-block"]], - "(method 43 mayor)": [ - [16, "vector"] - ], + "(method 43 mayor)": [[16, "vector"]], - "(method 10 tippy)": [ - [16, "vector"] - ], + "(method 10 tippy)": [[16, "vector"]], "compute-and-draw-shadow": [ [16, "vector"], @@ -850,39 +696,27 @@ [48, "collide-tri-result"] ], - "(method 20 collide-cache)": [ - [16, "vector"] - ], + "(method 20 collide-cache)": [[16, "vector"]], - "(method 12 wobbler)": [ - [16, "vector"] - ], + "(method 12 wobbler)": [[16, "vector"]], - "(method 12 twister)": [ - [16, "matrix"] - ], + "(method 12 twister)": [[16, "matrix"]], "target-on-end-of-teetertotter?": [ [16, "vector"], [32, "vector"] ], - "(event teetertotter-launch)": [ - [16, "event-message-block"] - ], + "(event teetertotter-launch)": [[16, "event-message-block"]], - "(method 17 rigid-body)": [ - [16, "vector"] - ], + "(method 17 rigid-body)": [[16, "vector"]], "matrix-3x3-triple-transpose-product": [ [16, "matrix"], [80, "matrix"] ], - "(method 10 rigid-body)": [ - [16, "quaternion"] - ], + "(method 10 rigid-body)": [[16, "quaternion"]], "(method 13 rigid-body)": [ [16, "vector"], @@ -899,29 +733,17 @@ [32, "vector"] ], - "(method 18 rigid-body)": [ - [16, "vector"] - ], + "(method 18 rigid-body)": [[16, "vector"]], - "(method 24 rigid-body-platform)": [ - [16, "vector"] - ], + "(method 24 rigid-body-platform)": [[16, "vector"]], - "(method 26 rigid-body-platform)": [ - [16, "vector"] - ], + "(method 26 rigid-body-platform)": [[16, "vector"]], - "(method 27 rigid-body-platform)": [ - [16, "vector"] - ], + "(method 27 rigid-body-platform)": [[16, "vector"]], - "(method 22 water-anim)": [ - [16, "vector"] - ], + "(method 22 water-anim)": [[16, "vector"]], - "(anon-function 9 plat-eco)": [ - [16, "event-message-block"] - ], + "(anon-function 9 plat-eco)": [[16, "event-message-block"]], "default-collision-reaction": [ [16, "vector"], @@ -936,40 +758,22 @@ [48, "event-message-block"] ], - "(method 29 sunken-elevator)": [ - [16, "vector"] - ], - "(anon-function 0 title-obs)": [ - [16, "font-context"] - ], + "(method 29 sunken-elevator)": [[16, "vector"]], + "(anon-function 0 title-obs)": [[16, "font-context"]], - "print-game-text": [ - [16, "font-context"] - ], + "print-game-text": [[16, "font-context"]], - "draw-string-xy": [ - [16, "font-context"] - ], + "draw-string-xy": [[16, "font-context"]], - "(method 50 nav-enemy)": [ - [16, "vector"] - ], + "(method 50 nav-enemy)": [[16, "vector"]], - "nav-enemy-init-by-other": [ - [16, "vector"] - ], + "nav-enemy-init-by-other": [[16, "vector"]], - "nav-enemy-turn-to-face-point": [ - [16, "vector"] - ], + "nav-enemy-turn-to-face-point": [[16, "vector"]], - "nav-enemy-facing-point?": [ - [16, "vector"] - ], + "nav-enemy-facing-point?": [[16, "vector"]], - "nav-enemy-jump-post": [ - [16, "vector"] - ], + "nav-enemy-jump-post": [[16, "vector"]], "(method 41 nav-enemy)": [ [16, "vector"], @@ -1004,151 +808,81 @@ [32, "vector"] ], - "(enter nav-enemy-jump-land nav-enemy)": [ - [16, "vector"] - ], - "(code nav-enemy-die nav-enemy)": [ - [16, "event-message-block"] - ], - "(enter nav-enemy-die nav-enemy)": [ - [16, "event-message-block"] - ], - "(trans nav-enemy-flee nav-enemy)": [ - [16, "event-message-block"] - ], - "(trans nav-enemy-patrol nav-enemy)": [ - [16, "event-message-block"] - ], + "(enter nav-enemy-jump-land nav-enemy)": [[16, "vector"]], + "(code nav-enemy-die nav-enemy)": [[16, "event-message-block"]], + "(enter nav-enemy-die nav-enemy)": [[16, "event-message-block"]], + "(trans nav-enemy-flee nav-enemy)": [[16, "event-message-block"]], + "(trans nav-enemy-patrol nav-enemy)": [[16, "event-message-block"]], - "(method 73 nav-enemy)": [ - [16, "event-message-block"] - ], + "(method 73 nav-enemy)": [[16, "event-message-block"]], - "(method 43 nav-enemy)": [ - [16, "event-message-block"] - ], + "(method 43 nav-enemy)": [[16, "event-message-block"]], - "nav-enemy-send-attack": [ - [16, "event-message-block"] - ], + "nav-enemy-send-attack": [[16, "event-message-block"]], - "birth-pickup-at-point": [ - [16, "vector"] - ], + "birth-pickup-at-point": [[16, "vector"]], - "merc-blend-shape": [ - [16, ["array", "int16", 128]] - ], + "merc-blend-shape": [[16, ["array", "int16", 128]]], - "(method 43 bird-lady)": [ - [16, "vector"] - ], + "(method 43 bird-lady)": [[16, "vector"]], - "(method 32 bird-lady-beach)": [ - [16, "event-message-block"] - ], + "(method 32 bird-lady-beach)": [[16, "event-message-block"]], - "muse-to-idle": [ - [16, "event-message-block"] - ], + "muse-to-idle": [[16, "event-message-block"]], - "(method 32 sculptor)": [ - [16, "event-message-block"] - ], + "(method 32 sculptor)": [[16, "event-message-block"]], - "(method 43 sculptor)": [ - [16, "vector"] - ], + "(method 43 sculptor)": [[16, "vector"]], - "(method 32 geologist)": [ - [16, "event-message-block"] - ], + "(method 32 geologist)": [[16, "event-message-block"]], - "(method 43 geologist)": [ - [16, "vector"] - ], + "(method 43 geologist)": [[16, "vector"]], - "(method 32 oracle)": [ - [16, "event-message-block"] - ], + "(method 32 oracle)": [[16, "event-message-block"]], "(method 11 oracle)": [ [16, "vector"], [32, "event-message-block"] ], - "(method 32 explorer)": [ - [16, "event-message-block"] - ], + "(method 32 explorer)": [[16, "event-message-block"]], - "(method 43 explorer)": [ - [16, "vector"] - ], + "(method 43 explorer)": [[16, "vector"]], - "(method 32 assistant)": [ - [16, "event-message-block"] - ], + "(method 32 assistant)": [[16, "event-message-block"]], - "(method 43 assistant)": [ - [16, "vector"] - ], + "(method 43 assistant)": [[16, "vector"]], "(code idle assistant)": [ [16, "vector"], [32, "vector"] ], - "check-drop-level-assistant": [ - [16, "vector"] - ], + "check-drop-level-assistant": [[16, "vector"]], - "(method 32 sage)": [ - [16, "event-message-block"] - ], + "(method 32 sage)": [[16, "event-message-block"]], - "(method 43 sage)": [ - [16, "vector"] - ], + "(method 43 sage)": [[16, "vector"]], - "(trans idle sage)": [ - [16, "event-message-block"] - ], + "(trans idle sage)": [[16, "event-message-block"]], - "(method 32 gambler)": [ - [16, "event-message-block"] - ], + "(method 32 gambler)": [[16, "event-message-block"]], - "(method 43 gambler)": [ - [16, "vector"] - ], + "(method 43 gambler)": [[16, "vector"]], - "(method 32 warrior)": [ - [16, "event-message-block"] - ], + "(method 32 warrior)": [[16, "event-message-block"]], - "(method 43 warrior)": [ - [16, "vector"] - ], + "(method 43 warrior)": [[16, "vector"]], - "(exit play-anim warrior)": [ - [16, "event-message-block"] - ], + "(exit play-anim warrior)": [[16, "event-message-block"]], - "minershort-trans-hook": [ - [16, "vector"] - ], + "minershort-trans-hook": [[16, "vector"]], - "(method 32 minershort)": [ - [16, "event-message-block"] - ], + "(method 32 minershort)": [[16, "event-message-block"]], - "(exit play-anim minershort)": [ - [16, "event-message-block"] - ], + "(exit play-anim minershort)": [[16, "event-message-block"]], - "(method 43 minershort)": [ - [16, "vector"] - ], + "(method 43 minershort)": [[16, "vector"]], "(method 33 progress)": [[16, "event-message-block"]], "hide-progress-screen": [[16, "event-message-block"]], @@ -1167,47 +901,31 @@ "(method 28 progress)": [[16, "font-context"]], "(method 27 progress)": [[16, "font-context"]], - "(method 11 fact-info-target)": [ - [16, "event-message-block"] - ], + "(method 11 fact-info-target)": [[16, "event-message-block"]], - "(anon-function 6 game-info)": [ - [16, "event-message-block"] - ], + "(anon-function 6 game-info)": [[16, "event-message-block"]], - "(anon-function 8 game-info)": [ - [16, "event-message-block"] - ], + "(anon-function 8 game-info)": [[16, "event-message-block"]], - "(method 24 game-info)": [ - [16, "scf-time"] - ], + "(method 24 game-info)": [[16, "scf-time"]], "auto-save-post": [ [16, "font-context"], [112, "font-context"] ], - "auto-save-init-by-other":[ - [16, "event-message-block"] - ], + "auto-save-init-by-other": [[16, "event-message-block"]], - "(code error auto-save)": [ - [16, "event-message-block"] - ], + "(code error auto-save)": [[16, "event-message-block"]], - "(code done auto-save)": [ - [16, "event-message-block"] - ], + "(code done auto-save)": [[16, "event-message-block"]], "update-time-of-day": [ [16, "(array float)"], // TODO - broken! [48, "vector"] ], - "check-drop-level-rain": [ - [16, "vector"] - ], + "check-drop-level-rain": [[16, "vector"]], "update-rain": [ [16, "vector"], @@ -1215,12 +933,7 @@ [48, "event-message-block"] ], - "sparticle-track-sun": [ - [16, "vector"] - ], - - "draw-joint-spheres": [[16, "vector"]], - "(method 16 process-drawable)": [[16, "matrix"], [80, "matrix"], [144, "vector"], [160, "vector"]], + "sparticle-track-sun": [[16, "vector"]], "(method 16 target)": [ [16, "vector"], @@ -1228,44 +941,32 @@ [48, "vector"] ], - "vector-local+!": [ - [16, "vector"] - ], + "vector-local+!": [[16, "vector"]], "move-forward": [ [16, "vector"], [32, "vector"] ], - "set-forward-vel": [ - [16, "vector"] - ], + "set-forward-vel": [[16, "vector"]], "delete-back-vel": [ [16, "vector"], [32, "vector"] ], - "set-side-vel": [ - [16, "vector"] - ], + "set-side-vel": [[16, "vector"]], - "build-conversions": [ - [16, "vector"] - ], + "build-conversions": [[16, "vector"]], "vector-turn-to": [ [16, "vector"], [32, "vector"] ], - "warp-vector-into-surface!": [ - [16, "matrix"] - ], + "warp-vector-into-surface!": [[16, "matrix"]], - "vector<-pad-in-surface!": [ - [16, "vector"] - ], + "vector<-pad-in-surface!": [[16, "vector"]], "local-pad-angle": [ [16, "vector"], @@ -1277,9 +978,7 @@ [32, "vector"] ], - "target-move-dist": [ - [16, "vector"] - ], + "target-move-dist": [[16, "vector"]], "turn-to-vector": [ [16, "vector"], @@ -1322,9 +1021,7 @@ [48, "quaternion"] ], - "level-setup": [ - [16, "event-message-block"] - ], + "level-setup": [[16, "event-message-block"]], "flag-setup": [ [16, "vector"], @@ -1346,9 +1043,7 @@ [96, "vector"] ], - "target-calc-camera-pos": [ - [16, "vector"] - ], + "target-calc-camera-pos": [[16, "vector"]], "joint-points": [ [16, "vector"], @@ -1361,13 +1056,9 @@ [48, "vector"] ], - "target-swim-post": [ - [16, "vector"] - ], + "target-swim-post": [[16, "vector"]], - "target-no-stick-post": [ - [16, "vector"] - ], + "target-no-stick-post": [[16, "vector"]], "target-no-move-post": [ [16, "collide-edge-hold-list"] // a total guess @@ -1406,25 +1097,15 @@ [48, ["inline-array", "sphere", 2]] ], - "(method 32 evilbro)": [ - [16, "event-message-block"] - ], + "(method 32 evilbro)": [[16, "event-message-block"]], - "(exit play-anim evilbro)": [ - [16, "event-message-block"] - ], + "(exit play-anim evilbro)": [[16, "event-message-block"]], - "(method 29 basebutton)": [ - [16, "event-message-block"] - ], + "(method 29 basebutton)": [[16, "event-message-block"]], - "(code use warp-gate)": [ - [16, "event-message-block"] - ], + "(code use warp-gate)": [[16, "event-message-block"]], - "(trans use warp-gate)": [ - [16, "event-message-block"] - ], + "(trans use warp-gate)": [[16, "event-message-block"]], "(anon-function 1 basebutton)": [ [16, "vector"], @@ -1438,15 +1119,11 @@ [112, "vector"] ], - "dm-anim-tester-func": [ - [16, "event-message-block"] - ], + "dm-anim-tester-func": [[16, "event-message-block"]], - "update-actor-vis-box": [ - [16, "vector"] - ], + "update-actor-vis-box": [[16, "vector"]], - "(method 14 level-group)":[ + "(method 14 level-group)": [ [16, "vector"], [32, "vector"] ], @@ -1460,17 +1137,11 @@ [96, "vector"] ], - "(code falling beach-rock)": [ - [16, "event-message-block"] - ], + "(code falling beach-rock)": [[16, "event-message-block"]], - "(method 11 beach-rock)": [ - [16, "vector"] - ], + "(method 11 beach-rock)": [[16, "vector"]], - "birth-func-copy-target-y-rot": [ - [16, "matrix"] - ], + "birth-func-copy-target-y-rot": [[16, "matrix"]], "birth-func-ground-orient": [ [16, "vector"], @@ -1493,9 +1164,7 @@ [48, "quaternion"] ], - "part-tracker-track-target-joint": [ - [16, "vector"] - ], + "part-tracker-track-target-joint": [[16, "vector"]], "process-drawable-burn-effect": [ [16, "rgbaf"], @@ -1503,9 +1172,7 @@ [48, "vector"] ], - "(anon-function 27 projectiles)": [ - [16, "vector"] - ], + "(anon-function 27 projectiles)": [[16, "vector"]], "projectile-collision-reaction": [ [16, "vector"], @@ -1517,13 +1184,9 @@ [208, "vector"] ], - "(event projectile-moving projectile)": [ - [16, "event-message-block"] - ], + "(event projectile-moving projectile)": [[16, "event-message-block"]], - "(code projectile-moving projectile)": [ - [16, "vector"] - ], + "(code projectile-moving projectile)": [[16, "vector"]], "projectile-update-velocity-space-wars": [ [16, "vector"], @@ -1532,17 +1195,11 @@ [64, "vector"] ], - "(code projectile-die projectile)": [ - [16, "event-message-block"] - ], + "(code projectile-die projectile)": [[16, "event-message-block"]], - "projectile-init-by-other": [ - [16, "collide-edge-hold-list"] - ], + "projectile-init-by-other": [[16, "collide-edge-hold-list"]], - "(method 27 projectile-yellow)": [ - [16, "vector"] - ], + "(method 27 projectile-yellow)": [[16, "vector"]], "spawn-projectile-blue": [ [16, "vector"], @@ -1559,83 +1216,49 @@ [48, "event-message-block"] ], - "(method 29 jungle-elevator)": [ - [16, "vector"] - ], + "(method 29 jungle-elevator)": [[16, "vector"]], - "(event bouncer-wait)": [ - [16, "event-message-block"] - ], + "(event bouncer-wait)": [[16, "event-message-block"]], "hopper-find-ground": [ [16, "vector"], [32, "collide-tri-result"] ], - "blocking-plane-init-by-other": [ - [16, "matrix"] - ], + "blocking-plane-init-by-other": [[16, "matrix"]], - "evilsib-trans-hook-wait": [ - [16, "event-message-block"] - ], + "evilsib-trans-hook-wait": [[16, "event-message-block"]], - "(method 32 sequenceB)": [ - [16, "event-message-block"] - ], + "(method 32 sequenceB)": [[16, "event-message-block"]], - "(event play-anim sequenceB)": [ - [16, "event-message-block"] - ], + "(event play-anim sequenceB)": [[16, "event-message-block"]], - "(exit play-anim sequenceB)": [ - [16, "event-message-block"] - ], + "(exit play-anim sequenceB)": [[16, "event-message-block"]], "sequenceC-can-trans-hook-2": [ [16, "vector"], [32, "event-message-block"] ], - "sequenceC-can-trans-hook": [ - [16, "event-message-block"] - ], + "sequenceC-can-trans-hook": [[16, "event-message-block"]], - "(method 32 sequenceC)": [ - [16, "event-message-block"] - ], + "(method 32 sequenceC)": [[16, "event-message-block"]], - "sequenceC-trans-hook": [ - [16, "vector"] - ], + "sequenceC-trans-hook": [[16, "vector"]], - "(trans hidden assistant-firecanyon)": [ - [16, "font-context"] - ], + "(trans hidden assistant-firecanyon)": [[16, "font-context"]], - "(method 32 sage-bluehut)": [ - [16, "event-message-block"] - ], + "(method 32 sage-bluehut)": [[16, "event-message-block"]], - "(exit play-anim sage-bluehut)": [ - [16, "event-message-block"] - ], + "(exit play-anim sage-bluehut)": [[16, "event-message-block"]], - "(method 43 sage-bluehut)": [ - [16, "vector"] - ], + "(method 43 sage-bluehut)": [[16, "vector"]], - "(method 37 sharkey)": [ - [16, "vector"] - ], + "(method 37 sharkey)": [[16, "vector"]], - "(method 39 sharkey)": [ - [16, "vector"] - ], + "(method 39 sharkey)": [[16, "vector"]], - "sharkey-notice-player?": [ - [16, "event-message-block"] - ], + "sharkey-notice-player?": [[16, "event-message-block"]], "sharkey-move-to-attack-position": [ [16, "vector"], @@ -1649,38 +1272,24 @@ [48, "event-message-block"] ], - "(trans nav-enemy-chase sharkey)": [ - [16, "event-message-block"] - ], + "(trans nav-enemy-chase sharkey)": [[16, "event-message-block"]], "(method 43 lurkercrab)": [ [16, "vector"], [32, "vector"] ], - "(enter idle assistant-lavatube-end)": [ - [16, "event-message-block"] - ], + "(enter idle assistant-lavatube-end)": [[16, "event-message-block"]], - "target-has-all-the-cells?": [ - [16, "event-message-block"] - ], + "target-has-all-the-cells?": [[16, "event-message-block"]], - "(code idle power-left)": [ - [16, "event-message-block"] - ], + "(code idle power-left)": [[16, "event-message-block"]], - "(code jump powercellalt)": [ - [16, "trajectory"] - ], + "(code jump powercellalt)": [[16, "trajectory"]], - "(enter target-final-door)": [ - [16, "event-message-block"] - ], + "(enter target-final-door)": [[16, "event-message-block"]], - "(exit target-final-door)": [ - [16, "event-message-block"] - ], + "(exit target-final-door)": [[16, "event-message-block"]], "(code target-final-door)": [ [16, "vector"], @@ -1689,13 +1298,9 @@ [64, "event-message-block"] ], - "(method 43 aphid)": [ - [16, "event-message-block"] - ], + "(method 43 aphid)": [[16, "event-message-block"]], - "(code nav-enemy-give-up aphid)": [ - [16, "vector"] - ], + "(code nav-enemy-give-up aphid)": [[16, "vector"]], "aphid-init-by-other": [ [16, "vector"], @@ -1708,85 +1313,47 @@ [48, "vector"] ], - "crate-standard-event-handler": [ - [16, "event-message-block"] - ], + "crate-standard-event-handler": [[16, "event-message-block"]], - "plat-trans": [ - [16, "vector"] - ], + "plat-trans": [[16, "vector"]], - "(code door-closing eco-door)": [ - [16, "overlaps-others-params"] - ], + "(code door-closing eco-door)": [[16, "overlaps-others-params"]], - "(code door-open eco-door)": [ - [16, "event-message-block"] - ], + "(code door-open eco-door)": [[16, "event-message-block"]], - "(code door-opening eco-door)": [ - [16, "event-message-block"] - ], + "(code door-opening eco-door)": [[16, "event-message-block"]], - "(code door-closed eco-door)": [ - [16, "event-message-block"] - ], + "(code door-closed eco-door)": [[16, "event-message-block"]], - "(code plat-button-teleport-to-other-end plat-button)": [ - [16, "vector"] - ], + "(code plat-button-teleport-to-other-end plat-button)": [[16, "vector"]], - "plat-button-camera-on": [ - [16, "event-message-block"] - ], + "plat-button-camera-on": [[16, "event-message-block"]], - "plat-button-camera-off": [ - [16, "event-message-block"] - ], + "plat-button-camera-off": [[16, "event-message-block"]], - "(trans plat-button-move-downward plat-button)": [ - [16, "vector"] - ], + "(trans plat-button-move-downward plat-button)": [[16, "vector"]], - "(trans plat-button-move-upward plat-button)": [ - [16, "vector"] - ], + "(trans plat-button-move-upward plat-button)": [[16, "vector"]], - "(event plat-idle plat-eco)": [ - [16, "event-message-block"] - ], + "(event plat-idle plat-eco)": [[16, "event-message-block"]], - "(trans plat-idle plat-eco)": [ - [16, "vector"] - ], + "(trans plat-idle plat-eco)": [[16, "vector"]], - "(anon-function 8 plat-eco)": [ - [16, "event-message-block"] - ], + "(anon-function 8 plat-eco)": [[16, "event-message-block"]], "(anon-function 7 plat-eco)": [ [16, "vector"] // code ], - "(event drop-plat-idle)": [ - [16, "event-message-block"] - ], + "(event drop-plat-idle)": [[16, "event-message-block"]], - "(code drop-plat-rise)": [ - [16, "vector"] - ], + "(code drop-plat-rise)": [[16, "vector"]], - "(post drop-plat-rise)": [ - [16, "quaternion"] - ], + "(post drop-plat-rise)": [[16, "quaternion"]], - "(code drop-plat-drop)": [ - [16, "vector"] - ], + "(code drop-plat-drop)": [[16, "vector"]], - "(post drop-plat-drop)": [ - [16, "quaternion"] - ], + "(post drop-plat-drop)": [[16, "quaternion"]], "(method 21 drop-plat)": [ [16, "vector"], @@ -1799,61 +1366,417 @@ [32, "vector"] ], - "citb-drop-plat-drop-all-children": [ - [16, "event-message-block"] - ], + "citb-drop-plat-drop-all-children": [[16, "event-message-block"]], - "citb-drop-plat-drop-children": [ - [16, "event-message-block"] - ], + "citb-drop-plat-drop-children": [[16, "event-message-block"]], - "(event plat-flip-idle)": [ - [16, "event-message-block"] - ], + "(event plat-flip-idle)": [[16, "event-message-block"]], - "(code plat-flip-idle)": [ - [16, "vector"] - ], + "(code plat-flip-idle)": [[16, "vector"]], "(method 27 square-platform)": [ [16, "vector"], [32, "vector"] ], - "(event wedge-plat-tip)": [ - [16, "event-message-block"] + "(event wedge-plat-tip)": [[16, "event-message-block"]], + + "(event wedge-plat-outer-tip)": [[16, "event-message-block"]], + + "(event wall-plat-extending)": [[16, "event-message-block"]], + + "(code wall-plat-extending)": [[16, "vector"]], + + "(event wall-plat-retracting)": [[16, "event-message-block"]], + + "(code wall-plat-retracting)": [[16, "vector"]], + + "(event wall-plat-sync-idle)": [[16, "event-message-block"]], + + "(code wall-plat-sync-idle)": [[16, "vector"]], + + "(method 11 wall-plat)": [[16, "vector"]], + + "reset-target-tracking": [[16, "vector"]], + "reset-drawable-tracking": [[16, "vector"]], + + "master-track-target": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "collide-mesh-cache-tri"], + [160, "vector"], + [176, "vector"], + [192, "vector"], + [208, "vector"], + [224, "vector"] + ], + "master-unset-region": [[16, "event-message-block"]], + "master-base-region": [ + [16, "vector"], + [32, "event-message-block"] + ], + "master-switch-to-entity": [[32, "event-message-block"]], + "master-check-regions": [[16, "event-message-block"]], + + "cam-circular-position-into-max-angle": [ + [16, "matrix"], + [80, "matrix"], + [144, "vector"], + [160, "vector"] + ], + "cam-circular-position": [ + [16, "vector"], + [32, "vector"] + ], + "cam-circular-code": [[16, "vector"]], + "(anon-function 37 cam-states)": [ + [48, "vector"], + [64, "event-message-block"], + [16, "vector"], + [32, "vector"] + ], + "cam-string-find-position-rel!": [ + [16, "vector"], + [32, "vector"], + [48, "bone"], + [144, "matrix"] + ], + "cam-los-spline-collide": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] ], - "(event wedge-plat-outer-tip)": [ - [16, "event-message-block"] + "(event cam-master-active)": [ + [16, "event-message-block"], + [96, "vector"], + [112, "vector"] ], - "(event wall-plat-extending)": [ - [16, "event-message-block"] + "(code cam-master-active)": [[16, "event-message-block"]], + + "(exit cam-eye)": [[16, "event-message-block"]], + + "(code cam-fixed)": [[16, "vector"]], + + "(enter cam-eye)": [[16, "vector"]], + + "(enter cam-billy)": [[16, "vector"]], + + "(code cam-pov180)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"] ], - "(code wall-plat-extending)": [ - [16, "vector"] + "(enter cam-fixed-read-entity)": [ + [16, "vector"], + [32, "event-message-block"] ], - "(event wall-plat-retracting)": [ - [16, "event-message-block"] + "(enter cam-pov-track)": [ + [16, "vector"], + [32, "event-message-block"] ], - "(code wall-plat-retracting)": [ - [16, "vector"] + "(code cam-decel)": [ + [16, "vector"], + [32, "vector"], + [48, "event-message-block"] ], - "(event wall-plat-sync-idle)": [ - [16, "event-message-block"] + "(code cam-eye)": [ + [16, "vector"], + [32, "matrix"], + [96, "vector"], + [112, "vector"], + [128, "vector"] ], - "(code wall-plat-sync-idle)": [ - [16, "vector"] + "(code cam-billy)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "matrix"] ], - "(method 11 wall-plat)": [ - [16, "vector"] + "(enter cam-standoff-read-entity)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "event-message-block"] + ], + + "(code cam-endlessfall)": [ + [16, "matrix"], + [80, "vector"], + [96, "vector"] + ], + + "(enter cam-spline)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "event-message-block"] + ], + + "(code cam-spline)": [[16, "curve"]], + + "(enter cam-circular)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "event-message-block"] + ], + + "los-cw-ccw": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"], + [112, "vector"] + ], + + "cam-string-follow": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"] + ], + + "cam-string-line-of-sight": [ + [16, "clip-travel-vector-to-mesh-return-info"], + [176, "vector"], + [192, "vector"], + [208, "vector"], + [224, "vector"], + [240, "vector"], + [256, "vector"] + ], + + "cam-string-joystick": [ + [16, "vector"], + [32, "matrix"], + [96, "vector"], + [112, "vector"] + ], + + "cam-string-find-hidden": [ + [16, "collide-mesh-cache-tri"], + [112, "vector"], + [128, "vector"] + ], + + "cam-string-move": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"], + [96, "collide-mesh-cache-tri"], + [192, "vector"], + [208, "vector"], + [224, "vector"] + ], + + "cam-string-code": [ + [16, "vector"], + [32, "vector"] + ], + + "(event cam-string)": [[16, "vector"]], + + "(trans cam-stick)": [ + [16, "matrix"], + [80, "vector"], + [96, "vector"], + [112, "vector"] + ], + + "cam-bike-code": [ + [16, "matrix"], + [80, "vector"], + [96, "vector"], + [112, "vector"], + [128, "vector"], + [144, "vector"], + [160, "vector"], + [176, "collide-mesh-cache-tri"], + [272, "vector"] + ], + + "cam-stick-code": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"], + [96, "collide-mesh-cache-tri"], + [192, "vector"] + ], + + "(enter cam-string)": [ + [16, "vector"], + [32, "collide-mesh-cache-tri"], + [128, "vector"], + [144, "vector"], + [160, "vector"] + ], + + "cam-los-collide": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"], + [96, "vector"], + [112, "vector"], + [128, "vector"], + [144, "vector"], + [160, "vector"], + [176, "vector"], + [192, "vector"], + [208, "vector"] + ], + + "(code cam-point-watch)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "matrix"] + ], + + "(code cam-orbit)": [ + [16, "vector"], + [32, "vector"] + ], + + "(enter cam-free-floating)": [[16, "event-message-block"]], + + "(enter cam-orbit)": [[16, "vector"]], + + "(method 25 pov-camera)": [[16, "event-message-block"]], + + "(code pov-camera-start-playing pov-camera)": [[16, "event-message-block"]], + + "(code pov-camera-done-playing pov-camera)": [[16, "event-message-block"]], + + "debug-set-camera-pos-rot!": [[16, "event-message-block"]], + + "camera-master-debug": [[16, "vector"]], + + "(method 23 tracking-spline)": [ + [16, "vector"], + [32, "vector"] + ], + + "master-draw-coordinates": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"] + ], + + "camera-slave-debug": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"], + [112, "vector"], + [128, "curve"], + [160, "vector"], + [176, "vector"], + [192, "vector"] + ], + + "cam-debug-draw-tris": [[16, "vector4w"]], + + "cam-collision-record-draw": [ + [16, "vector4w"], + [32, "vector4w"], + [48, "collide-mesh-cache-tri"], + [144, "vector"] + ], + + "debug-euler": [ + [16, "euler-angles"], + [32, "matrix"] + ], + + "v-slrp!": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "interp-test": [ + [16, "vector"], + [32, "vector"] + ], + + "cam-layout-save-cam-trans": [[16, "vector"]], + + "cam-layout-save-pivot": [[16, "vector"]], + + "cam-layout-save-interesting": [[16, "vector"]], + + "cam-layout-save-align": [[16, "vector"]], + + "clmf-cam-flag-toggle": [[16, "clmf-cam-flag-toggle-info"]], + + "interp-test-deg": [ + [16, "vector"], + [32, "vector"] + ], + + "clmf-pos-rot": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"], + [112, "matrix"], + [176, "vector"] + ], + + "clmf-input": [ + [16, "matrix"], + [80, "vector"] + ], + + "cam-layout-entity-info": [ + [16, "matrix"], + [80, "vector"], + [96, "vector"], + [112, "vector"], + [128, "vector"], + [144, "curve"], + [176, "vector"], + [192, "vector"], + [208, "vector"], + [224, "curve"], + [256, "vector"], + [272, "vector"], + [288, "vector"], + [304, "curve"], + [336, "vector"], + [352, "vector"], + [368, "interp-test-info"], + [432, "vector"] + ], + + "clmf-save-single": [[16, "file-stream"]], + + "pov-camera-play-and-reposition": [[16, "event-message-block"]], + + "cam-layout-entity-volume-info-create": [ + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"], + [96, "vector"], + [112, "vector"], + [128, "vector"], + [144, "vector"] ], "(code plunger-lurker-plunge)": [[16, "event-message-block"]], @@ -1906,26 +1829,19 @@ [144, "matrix"] ], - "(method 10 sparticle-launch-control)":[ - [16, "vector"] - ], + "(method 10 sparticle-launch-control)": [[16, "vector"]], - "sparticle-50-to-60":[ - [16, "quaternion"] - ], + "sparticle-50-to-60": [[16, "quaternion"]], + "sparticle-60-to-50": [[16, "quaternion"]], - "sparticle-60-to-50":[ - [16, "quaternion"] - ], - - "sp-orbiter":[ + "sp-orbiter": [ [16, "vector"], [32, "vector"], [48, "matrix"] ], - "sp-euler-convert":[ + "sp-euler-convert": [ [16, "vector"], [32, "quaternion"] ], @@ -1939,60 +1855,40 @@ [16, "sprite-vec-data-2d"] // TODO this is probably wrong. ], - "birth-func-copy-rot-color": [ - [16, "vector"] - ], + "birth-func-copy-rot-color": [[16, "vector"]], "birth-func-copy2-rot-color": [ [16, "vector"], [32, "vector"] ], - "(code nav-enemy-give-up babak)": [ - [16, "vector"] - ], + "(code nav-enemy-give-up babak)": [[16, "vector"]], - "(method 10 gui-query)": [ - [16, "font-context"] - ], + "(method 10 gui-query)": [[16, "font-context"]], "(method 46 process-taskable)": [ [16, "vector"], [32, "vector"] ], - "(trans release process-taskable)": [ - [16, "event-message-block"] - ], + "(trans release process-taskable)": [[16, "event-message-block"]], - "(trans give-cell process-taskable)": [ - [16, "event-message-block"] - ], + "(trans give-cell process-taskable)": [[16, "event-message-block"]], - "process-taskable-play-anim-code": [ - [16, "event-message-block"] - ], + "process-taskable-play-anim-code": [[16, "event-message-block"]], - "(event idle process-taskable)": [ - [16, "event-message-block"] - ], + "(event idle process-taskable)": [[16, "event-message-block"]], "(trans idle process-taskable)": [ [16, "font-context"], [112, "event-message-block"] ], - "(post idle process-taskable)": [ - [16, "vector"] - ], + "(post idle process-taskable)": [[16, "vector"]], - "babak-with-cannon-ride-cannon-post": [ - [16, "vector"] - ], + "babak-with-cannon-ride-cannon-post": [[16, "vector"]], - "(code babak-with-cannon-jump-onto-cannon)": [ - [16, "vector"] - ], + "(code babak-with-cannon-jump-onto-cannon)": [[16, "vector"]], "(code othercam-running)": [ [16, "vector"], @@ -2009,9 +1905,7 @@ [112, "event-message-block"] ], - "(event wait-for-return flutflut)": [ - [16, "event-message-block"] - ], + "(event wait-for-return flutflut)": [[16, "event-message-block"]], "yakow-generate-travel-vector": [ [16, "vector"], @@ -2023,13 +1917,9 @@ [32, "vector"] ], - "yakow-facing-point?": [ - [16, "vector"] - ], + "yakow-facing-point?": [[16, "vector"]], - "(enter yakow-graze)": [ - [16, "event-message-block"] - ], + "(enter yakow-graze)": [[16, "event-message-block"]], "(method 13 vehicle-path)": [ [16, "vector"], @@ -2047,9 +1937,7 @@ [32, "vector"] ], - "(method 10 vehicle-controller)": [ - [16, "vector"] - ], + "(method 10 vehicle-controller)": [[16, "vector"]], "(method 23 fishermans-boat)": [ [16, "vector"], @@ -2061,69 +1949,37 @@ [112, "vector"] ], - "fishermans-boat-wave": [ - [16, "vector"] - ], + "fishermans-boat-wave": [[16, "vector"]], - "fishermans-boat-spawn-particles": [ - [16, "vector"] - ], + "fishermans-boat-spawn-particles": [[16, "vector"]], - "fishermans-boat-play-sounds": [ - [16, "vector"] - ], + "fishermans-boat-play-sounds": [[16, "vector"]], - "fishermans-boat-post": [ - [16, "event-message-block"] - ], + "fishermans-boat-post": [[16, "event-message-block"]], - "(code fishermans-boat-leaving-village)": [ - [16, "event-message-block"] - ], + "(code fishermans-boat-leaving-village)": [[16, "event-message-block"]], - "(trans fishermans-boat-entering-village)": [ - [16, "event-message-block"] - ], + "(trans fishermans-boat-entering-village)": [[16, "event-message-block"]], - "(code fishermans-boat-leaving-misty)": [ - [16, "event-message-block"] - ], + "(code fishermans-boat-leaving-misty)": [[16, "event-message-block"]], - "(trans fishermans-boat-entering-misty)": [ - [16, "event-message-block"] - ], + "(trans fishermans-boat-entering-misty)": [[16, "event-message-block"]], - "(exit fishermans-boat-player-control)": [ - [16, "event-message-block"] - ], + "(exit fishermans-boat-player-control)": [[16, "event-message-block"]], - "(code fishermans-boat-player-control)": [ - [16, "event-message-block"] - ], + "(code fishermans-boat-player-control)": [[16, "event-message-block"]], - "(code fishermans-boat-ride-to-misty)": [ - [16, "event-message-block"] - ], + "(code fishermans-boat-ride-to-misty)": [[16, "event-message-block"]], - "(event fishermans-boat-ride-to-village1)": [ - [16, "event-message-block"] - ], + "(event fishermans-boat-ride-to-village1)": [[16, "event-message-block"]], - "(code fishermans-boat-ride-to-village1)": [ - [16, "event-message-block"] - ], + "(code fishermans-boat-ride-to-village1)": [[16, "event-message-block"]], - "fishermans-boat-leave-dock?": [ - [16, "font-context"] - ], + "fishermans-boat-leave-dock?": [[16, "font-context"]], - "(trans fishermans-boat-player-control)": [ - [16, "vector"] - ], + "(trans fishermans-boat-player-control)": [[16, "vector"]], - "(code fishermans-boat-measurements)": [ - [16, "vector"] - ], + "(code fishermans-boat-measurements)": [[16, "vector"]], "(method 15 vehicle-controller)": [ [16, "vector"], @@ -2132,78 +1988,44 @@ [64, "vector"] ], - "analyze-point-on-path-segment": [ - [16, "vector"] - ], + "analyze-point-on-path-segment": [[16, "vector"]], - "(method 51 muse)": [ - [16, "vector"] - ], + "(method 51 muse)": [[16, "vector"]], - "muse-check-dest-point": [ - [16, "point-on-path-segment-info"] - ], + "muse-check-dest-point": [[16, "point-on-path-segment-info"]], - "(code muse-caught)": [ - [16, "event-message-block"] - ], + "(code muse-caught)": [[16, "event-message-block"]], - "(method 43 bonelurker)": [ - [16, "event-message-block"] - ], + "(method 43 bonelurker)": [[16, "event-message-block"]], - "bonelurker-stunned-event-handler": [ - [16, "event-message-block"] - ], + "bonelurker-stunned-event-handler": [[16, "event-message-block"]], - "bonelurker-push-post": [ - [16, "vector"] - ], + "bonelurker-push-post": [[16, "vector"]], - "(code nav-enemy-give-up bonelurker)": [ - [16, "vector"] - ], + "(code nav-enemy-give-up bonelurker)": [[16, "vector"]], - "(code bonelurker-stun)": [ - [16, "vector"] - ], + "(code bonelurker-stun)": [[16, "vector"]], - "(method 32 assistant-bluehut)": [ - [16, "event-message-block"] - ], + "(method 32 assistant-bluehut)": [[16, "event-message-block"]], - "(trans idle assistant-bluehut)": [ - [16, "event-message-block"] - ], + "(trans idle assistant-bluehut)": [[16, "event-message-block"]], - "(exit play-anim assistant-bluehut)": [ - [16, "event-message-block"] - ], + "(exit play-anim assistant-bluehut)": [[16, "event-message-block"]], - "(method 32 assistant-levitator)": [ - [16, "event-message-block"] - ], + "(method 32 assistant-levitator)": [[16, "event-message-block"]], - "(exit play-anim assistant-levitator)": [ - [16, "event-message-block"] - ], + "(exit play-anim assistant-levitator)": [[16, "event-message-block"]], "(method 47 assistant-bluehut)": [ [16, "vector"], [32, "vector"] ], - "(method 43 assistant-bluehut)": [ - [16, "vector"] - ], + "(method 43 assistant-bluehut)": [[16, "vector"]], - "check-drop-level-assistant-bluehut": [ - [16, "vector"] - ], + "check-drop-level-assistant-bluehut": [[16, "vector"]], - "assistant-levitator-blue-glow": [ - [16, "vector"] - ], + "assistant-levitator-blue-glow": [[16, "vector"]], "(code idle assistant-bluehut)": [ [16, "vector"], @@ -2219,33 +2041,19 @@ [160, "event-message-block"] ], - "(trans hidden assistant-levitator)": [ - [16, "font-context"] - ], + "(trans hidden assistant-levitator)": [[16, "font-context"]], - "(event square-platform-lowering)": [ - [16, "event-message-block"] - ], + "(event square-platform-lowering)": [[16, "event-message-block"]], - "(method 33 qbert-plat)": [ - [16, "event-message-block"] - ], + "(method 33 qbert-plat)": [[16, "event-message-block"]], - "(method 32 qbert-plat)": [ - [16, "event-message-block"] - ], + "(method 32 qbert-plat)": [[16, "event-message-block"]], - "(event qbert-plat-master-idle)": [ - [16, "event-message-block"] - ], + "(event qbert-plat-master-idle)": [[16, "event-message-block"]], - "(code qbert-plat-master-do-door)": [ - [16, "event-message-block"] - ], + "(code qbert-plat-master-do-door)": [[16, "event-message-block"]], - "(code qbert-plat-master-wait-for-door)": [ - [16, "event-message-block"] - ], + "(code qbert-plat-master-wait-for-door)": [[16, "event-message-block"]], "(code qbert-plat-master-idle)": [ [16, "event-message-block"], @@ -2253,9 +2061,7 @@ [112, "vector"] ], - "keg-event-handler": [ - [16, "event-message-block"] - ], + "keg-event-handler": [[16, "event-message-block"]], "(code keg-paddle-to-path)": [ [16, "vector"], @@ -2281,22 +2087,16 @@ [48, "vector"] ], - "(code keg-conveyor-paddle-idle)": [ - [16, "event-message-block"] - ], + "(code keg-conveyor-paddle-idle)": [[16, "event-message-block"]], "(method 11 keg-conveyor)": [ [16, "vector"], [32, "matrix"] ], - "swamp-bat-slave-event-handler": [ - [16, "event-message-block"] - ], + "swamp-bat-slave-event-handler": [[16, "event-message-block"]], - "swamp-bat-launch-slave": [ - [16, "event-message-block"] - ], + "swamp-bat-launch-slave": [[16, "event-message-block"]], "swamp-bat-slave-path-post": [ [16, "vector"], @@ -2316,29 +2116,17 @@ [32, "vector"] ], - "(code swamp-bat-slave-die)": [ - [16, "vector"] - ], + "(code swamp-bat-slave-die)": [[16, "vector"]], - "swamp-bat-make-path-select-plane": [ - [16, "vector"] - ], + "swamp-bat-make-path-select-plane": [[16, "vector"]], - "(method 44 swamp-rat)": [ - [16, "event-message-block"] - ], + "(method 44 swamp-rat)": [[16, "event-message-block"]], - "(method 39 swamp-rat)": [ - [16, "vector"] - ], + "(method 39 swamp-rat)": [[16, "vector"]], - "(method 38 swamp-rat)": [ - [16, "vector"] - ], + "(method 38 swamp-rat)": [[16, "vector"]], - "(code swamp-rat-spawn)": [ - [16, "vector"] - ], + "(code swamp-rat-spawn)": [[16, "vector"]], "swamp-rat-update-wiggle-target": [ [16, "vector"], @@ -2346,17 +2134,11 @@ [48, "vector"] ], - "swamp-rat-nest-dummy-event-handler": [ - [16, "event-message-block"] - ], + "swamp-rat-nest-dummy-event-handler": [[16, "event-message-block"]], - "(trans swamp-rat-nest-gestate)": [ - [16, "event-message-block"] - ], + "(trans swamp-rat-nest-gestate)": [[16, "event-message-block"]], - "(code swamp-rat-nest-victory)": [ - [16, "event-message-block"] - ], + "(code swamp-rat-nest-victory)": [[16, "event-message-block"]], "swamp-rat-nest-pick-spawn-joint": [ [16, "vector"], @@ -2369,29 +2151,17 @@ [32, "vector"] ], - "cavecrystal-light-control-default-callback": [ - [16, "vector"] - ], + "cavecrystal-light-control-default-callback": [[16, "vector"]], - "spiderwebs-default-event-handler": [ - [16, "event-message-block"] - ], + "spiderwebs-default-event-handler": [[16, "event-message-block"]], - "(enter nav-enemy-die baby-spider)": [ - [16, "event-message-block"] - ], + "(enter nav-enemy-die baby-spider)": [[16, "event-message-block"]], - "(code baby-spider-die-fast)": [ - [16, "event-message-block"] - ], + "(code baby-spider-die-fast)": [[16, "event-message-block"]], - "(method 39 baby-spider)": [ - [16, "vector"] - ], + "(method 39 baby-spider)": [[16, "vector"]], - "(enter nav-enemy-idle baby-spider)": [ - [16, "vector"] - ], + "(enter nav-enemy-idle baby-spider)": [[16, "vector"]], "(method 52 baby-spider)": [ [16, "vector"], @@ -2406,9 +2176,7 @@ [64, "vector"] ], - "(method 28 mother-spider-proj)": [ - [16, "vector"] - ], + "(method 28 mother-spider-proj)": [[16, "vector"]], "(code blue-eco-charger-orb-active)": [ [16, "vector"], @@ -2416,34 +2184,22 @@ [48, "vector"] ], - "(method 21 blue-eco-charger)": [ - [16, "event-message-block"] - ], + "(method 21 blue-eco-charger)": [[16, "event-message-block"]], - "(method 20 blue-eco-charger)": [ - [16, "event-message-block"] - ], + "(method 20 blue-eco-charger)": [[16, "event-message-block"]], - "(code blue-eco-charger-idle)": [ - [16, "event-message-block"] - ], + "(code blue-eco-charger-idle)": [[16, "event-message-block"]], - "(code exit-chamber-charger-puzzle-beaten)": [ - [16, "event-message-block"] - ], + "(code exit-chamber-charger-puzzle-beaten)": [[16, "event-message-block"]], - "(code exit-chamber-idle-in-sunken)": [ - [16, "event-message-block"] - ], + "(code exit-chamber-idle-in-sunken)": [[16, "event-message-block"]], "(event exit-chamber-idle-in-sunken)": [ [16, "event-message-block"], [32, "event-message-block"] ], - "(method 24 exit-chamber)": [ - [16, "vector"] - ], + "(method 24 exit-chamber)": [[16, "vector"]], "(method 23 exit-chamber)": [ [16, "vector"], @@ -2468,13 +2224,9 @@ [112, "vector"] ], - "(event target-tube-start)": [ - [16, "event-message-block"] - ], + "(event target-tube-start)": [[16, "event-message-block"]], - "(exit target-tube-start)": [ - [16, "event-message-block"] - ], + "(exit target-tube-start)": [[16, "event-message-block"]], "(code target-tube-start)": [ [16, "event-message-block"], @@ -2492,41 +2244,23 @@ [96, "vector"] ], - "(method 23 sunkenfisha)": [ - [16, "vector"] - ], + "(method 23 sunkenfisha)": [[16, "vector"]], - "(trans sunkenfisha-idle)": [ - [16, "vector"] - ], + "(trans sunkenfisha-idle)": [[16, "vector"]], - "(method 27 sunkenfisha)": [ - [64, "vector"] - ], + "(method 27 sunkenfisha)": [[64, "vector"]], - "(event idle minecartsteel)": [ - [16, "collide-overlap-result"] - ], + "(event idle minecartsteel)": [[16, "collide-overlap-result"]], - "(method 43 assistant-villagec)": [ - [16, "vector"] - ], + "(method 43 assistant-villagec)": [[16, "vector"]], - "(method 32 sage-villagec)": [ - [16, "event-message-block"] - ], + "(method 32 sage-villagec)": [[16, "event-message-block"]], - "(method 43 sage-villagec)": [ - [16, "vector"] - ], + "(method 43 sage-villagec)": [[16, "vector"]], - "(trans idle sage-villagec)": [ - [16, "event-message-block"] - ], + "(trans idle sage-villagec)": [[16, "event-message-block"]], - "(exit play-anim sage-villagec)": [ - [16, "event-message-block"] - ], + "(exit play-anim sage-villagec)": [[16, "event-message-block"]], "(method 20 cave-trap)": [ [16, "spawn-baby-spider-work"], @@ -2537,21 +2271,13 @@ [208, "vector"] ], - "(trans cave-trap-idle)": [ - [16, "event-message-block"] - ], + "(trans cave-trap-idle)": [[16, "event-message-block"]], - "ice-cube-default-event-handler": [ - [16, "event-message-block"] - ], + "ice-cube-default-event-handler": [[16, "event-message-block"]], - "(trans yeti-slave-appear-jump-up)": [ - [16, "vector"] - ], + "(trans yeti-slave-appear-jump-up)": [[16, "vector"]], - "(code nav-enemy-give-up yeti-slave)": [ - [16, "vector"] - ], + "(code nav-enemy-give-up yeti-slave)": [[16, "vector"]], "(code yeti-resuming-start)": [ [16, "vector"], @@ -2563,17 +2289,11 @@ [32, "vector"] ], - "(trans hidden assistant-lavatube-start)": [ - [16, "font-context"] - ], + "(trans hidden assistant-lavatube-start)": [[16, "font-context"]], - "(method 18 nav-control)": [ - [16, "vector"] - ], + "(method 18 nav-control)": [[16, "vector"]], - "check-drop-level-firehose-pops": [ - [16, "vector"] - ], + "check-drop-level-firehose-pops": [[16, "vector"]], "birth-func-random-rot": [ [16, "matrix"], @@ -2581,140 +2301,80 @@ [96, "vector"] ], - "check-drop-level-bigdoor-open-pops": [ - [16, "vector"] - ], + "check-drop-level-bigdoor-open-pops": [[16, "vector"]], - "check-drop-level-eichar-lighteco-pops": [ - [16, "vector"] - ], + "check-drop-level-eichar-lighteco-pops": [[16, "vector"]], - "check-drop-level-maincave-drip": [ - [16, "vector"] - ], + "check-drop-level-maincave-drip": [[16, "vector"]], - "part-tracker-move-to-target": [ - [16, "vector"] - ], + "part-tracker-move-to-target": [[16, "vector"]], - "part-tracker-track-target": [ - [16, "vector"] - ], + "part-tracker-track-target": [[16, "vector"]], - "check-drop-level-village1-fountain-nosplash": [ - [16, "vector"] - ], + "check-drop-level-village1-fountain-nosplash": [[16, "vector"]], - "check-drop-level-village1-fountain": [ - [16, "vector"] - ], + "check-drop-level-village1-fountain": [[16, "vector"]], - "check-drop-level-sagehut": [ - [16, "vector"] - ], + "check-drop-level-sagehut": [[16, "vector"]], - "check-drop-level-training-mist": [ - [16, "vector"] - ], + "check-drop-level-training-mist": [[16, "vector"]], - "check-drop-level-training-spout-rain": [ - [16, "vector"] - ], + "check-drop-level-training-spout-rain": [[16, "vector"]], - "check-drop-level-sagehut2": [ - [16, "vector"] - ], + "check-drop-level-sagehut2": [[16, "vector"]], - "(method 15 hud-money-all)": [ - [16, "font-context"] - ], + "(method 15 hud-money-all)": [[16, "font-context"]], - "(method 20 hud-money-all)": [ - [16, "event-message-block"] - ], + "(method 20 hud-money-all)": [[16, "event-message-block"]], - "(method 20 hud-money)": [ - [16, "event-message-block"] - ], + "(method 20 hud-money)": [[16, "event-message-block"]], "fuel-cell-hud-orbit-callback": [ [16, "vector"], [32, "vector"] ], - "(method 19 hud-fuel-cell)": [ - [16, "vector"] - ], + "(method 19 hud-fuel-cell)": [[16, "vector"]], "(method 20 hud-fuel-cell)": [ [16, "event-message-block"], [96, "quaternion"] ], - "hide-hud": [ - [16, "event-message-block"] - ], + "hide-hud": [[16, "event-message-block"]], - "hide-bottom-hud": [ - [16, "event-message-block"] - ], + "hide-bottom-hud": [[16, "event-message-block"]], - "disable-hud": [ - [16, "event-message-block"] - ], + "disable-hud": [[16, "event-message-block"]], - "enable-hud": [ - [16, "event-message-block"] - ], + "enable-hud": [[16, "event-message-block"]], - "hide-hud-quick": [ - [16, "event-message-block"] - ], + "hide-hud-quick": [[16, "event-message-block"]], - "show-hud": [ - [16, "event-message-block"] - ], + "show-hud": [[16, "event-message-block"]], - "convert-to-hud-object": [ - [16, "vector"] - ], + "convert-to-hud-object": [[16, "vector"]], - "(method 16 hud)": [ - [16, "event-message-block"] - ], + "(method 16 hud)": [[16, "event-message-block"]], - "(enter hud-hidden)": [ - [16, "event-message-block"] - ], + "(enter hud-hidden)": [[16, "event-message-block"]], - "(enter hud-arriving)": [ - [16, "event-message-block"] - ], + "(enter hud-arriving)": [[16, "event-message-block"]], - "send-hud-increment-event": [ - [16, "event-message-block"] - ], + "send-hud-increment-event": [[16, "event-message-block"]], - "(code hud-collecting)": [ - [16, "vector"] - ], + "(code hud-collecting)": [[16, "vector"]], "battlecontroller-fill-all-spawners": [ [16, "vector"], [32, "event-message-block"] ], - "battlecontroller-camera-on": [ - [16, "event-message-block"] - ], + "battlecontroller-camera-on": [[16, "event-message-block"]], - "(code battlecontroller-die battlecontroller)": [ - [16, "event-message-block"] - ], + "(code battlecontroller-die battlecontroller)": [[16, "event-message-block"]], - "battlecontroller-battle-begin": [ - [16, "event-message-block"] - ], + "battlecontroller-battle-begin": [[16, "event-message-block"]], "battlecontroller-update-spawners": [ [16, "vector"], @@ -2726,9 +2386,7 @@ [32, "vector"] ], - "battlecontroller-camera-off": [ - [16, "event-message-block"] - ], + "battlecontroller-camera-off": [[16, "event-message-block"]], "battlecontroller-spawn-creature-random-spawner": [ [16, "event-message-block"] @@ -2752,17 +2410,11 @@ [96, "vector"] ], - "(code helix-button-startup)": [ - [16, "vector"] - ], + "(code helix-button-startup)": [[16, "vector"]], - "(method 43 green-eco-lurker)": [ - [16, "event-message-block"] - ], + "(method 43 green-eco-lurker)": [[16, "event-message-block"]], - "(method 73 green-eco-lurker)": [ - [16, "event-message-block"] - ], + "(method 73 green-eco-lurker)": [[16, "event-message-block"]], "citb-sagecage-draw-bars": [ [16, "vector"], @@ -2770,9 +2422,7 @@ [48, "vector"] ], - "(code sunken-pipegame-start-up)": [ - [16, "event-message-block"] - ], + "(code sunken-pipegame-start-up)": [[16, "event-message-block"]], "(code race-ring-active)": [ [16, "event-message-block"], @@ -2784,17 +2434,11 @@ [32, "vector"] ], - "init-sky-regs": [ - [16, "vector"] - ], + "init-sky-regs": [[16, "vector"]], - "set-tex-offset": [ - [16, "vector"] - ], + "set-tex-offset": [[16, "vector"]], - "sky-tng-setup-cloud-layer": [ - [16,["inline-array", "sky-vertex", 12]] - ], + "sky-tng-setup-cloud-layer": [[16, ["inline-array", "sky-vertex", 12]]], "fisher-fish-move": [[16, "vector"]], "fisher-fish-water": [[16, "vector"]], diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 1580935c15..82acee0e68 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -1,19 +1,4 @@ -// This file replaces type_hints.jsonc. -// Functions are identified by their "unique name". This is the name after ".function" in the IR2 file. -// Each cast entry represents an override of a register's type at a certain point the function. -// These modifications do not propagate like normal types, so you may have to apply these modifications -// over a range of indices. - -// Entry format: [index, register, override] -// - The index can either be specified as a single integer, or as [min, max]. -// In the case of [min, max], the min index is included, but the max is not. ([1, 4] = 1, 2, 3). -// - The register is a string with the plain PS2 register name. -// - The type is a string with a valid GOAL typespec. -// It is parsed exactly like the compiler, so you can use compound types. -// You should only use register types here. - { - // GCOMMON "(method 2 array)": [ [23, "gp", "(array int32)"], [43, "gp", "(array uint32)"], @@ -30,14 +15,13 @@ [249, "gp", "(array basic)"], [258, "gp", "(array basic)"] ], - "(method 3 array)": [ [44, "gp", "(array int32)"], [62, "gp", "(array uint32)"], [80, "gp", "(array int64)"], [98, "gp", "(array uint64)"], [115, "gp", "(array int8)"], - [132, "gp", "(array int8)"], // bug in game + [132, "gp", "(array int8)"], [150, "gp", "(array int16)"], [168, "gp", "(array uint16)"], [191, "gp", "(array uint128)"], @@ -45,46 +29,34 @@ [226, "gp", "(array float)"], [243, "gp", "(array basic)"] ], - - // GKERNEL "(method 0 cpu-thread)": [[[13, 28], "v0", "cpu-thread"]], - "(method 0 process)": [ [12, "a0", "int"], [[13, 43], "v0", "process"] ], - "(method 0 dead-pool-heap)": [ - [60, "v0", "int"], // a lie, actually the 115 is an align16 constant propagated on addr of heap start. - //[63, "a0", "pointer"], + [60, "v0", "int"], [[61, 73], "v0", "dead-pool-heap"] ], - "(method 21 dead-pool-heap)": [ [5, "v1", "pointer"], [13, "a0", "pointer"], [25, "v1", "pointer"] ], - "(method 5 dead-pool-heap)": [ [3, "v1", "int"], [3, "a0", "int"] ], - "(method 0 protect-frame)": [ [0, "a0", "int"], [[1, 8], "v0", "protect-frame"] ], - "(method 10 process)": [[[24, 30], "s4", "protect-frame"]], - "(method 9 process)": [[43, "s5", "process"]], - "(method 14 dead-pool)": [ [[24, 25], "v1", "(pointer process)"], [[30, 39], "s4", "(pointer process)"] ], - "inspect-process-heap": [ [[4, 11], "s5", "basic"], [17, "s5", "pointer"] @@ -97,14 +69,16 @@ [26, "a1", "symbol"], [42, "a0", "symbol"] ], - "string-cat-to-last-char": [ [3, "s5", "(pointer uint8)"], [4, "s5", "string"] ], // GSTATE - "enter-state": [[68, "s0", "protect-frame"], [101, "t9", "(function object object object object object object none)"]], + "enter-state": [ + [68, "s0", "protect-frame"], + [101, "t9", "(function object object object object object object none)"] + ], // MATH "log2": [[3, "v1", "int"]], @@ -128,31 +102,21 @@ [6, "a0", "vif-bank"], [13, "a0", "vif-bank"] ], - "clear-vu1-mem": [[[0, 11], "v1", "(pointer uint32)"]], "clear-vu0-mem": [[[0, 11], "v1", "(pointer uint32)"]], - "dump-vu1-mem": [[[0, 49], "gp", "(pointer uint32)"]], - "dump-vu1-range": [[[0, 54], "s4", "(pointer uint32)"]], - "ultimate-memcpy": [ [[0, 54], "s4", "dma-bank-spr"], [[0, 54], "s3", "dma-bank-spr"] ], - - // dma-buffer "dma-buffer-add-vu-function": [[[9, 33], "t2", "dma-packet"]], - - // dma-bucket "dma-buffer-add-buckets": [ [[1, 4], "v1", "dma-bucket"], [5, "v1", "pointer"], [[9, 11], "v1", "dma-bucket"], [11, "v1", "pointer"] - //[[6, 15], "v1", "dma-bucket"] ], - "dma-buffer-patch-buckets": [ [7, "a0", "(inline-array dma-bucket)"], [8, "a3", "pointer"], @@ -162,12 +126,10 @@ [13, "a0", "(inline-array dma-bucket)"], [19, "a0", "(inline-array dma-bucket)"] ], - "dma-bucket-insert-tag": [ [[2, 6], "v1", "dma-bucket"], [3, "a0", "dma-bucket"] ], - "disasm-vif-details": [ [[62, 94], "s3", "(pointer uint32)"], [[98, 130], "s3", "(pointer uint16)"], @@ -175,25 +137,19 @@ [[168, 198], "s3", "(pointer uint16)"], [[202, 225], "s3", "(pointer uint16)"] ], - "disasm-vif-tag": [ [[81, 85], "t1", "vif-stcycl-imm"], [242, "a0", "vif-unpack-imm"] ], - "disasm-dma-list": [ [25, "v1", "dma-tag"], - [153, "v1", "dma-packet"], [189, "v1", "dma-packet"], [229, "v1", "dma-packet"], [258, "v1", "dma-packet"], [302, "v1", "dma-packet"], [308, "v1", "dma-packet"], - - //[133, "v1", "(pointer uint64)"], [152, "v1", "(pointer uint64)"], - [167, "v1", "(pointer uint64)"], [176, "v1", "(pointer uint64)"], [198, "v1", "(pointer uint64)"], @@ -205,7 +161,6 @@ [324, "v1", "(pointer uint64)"], [334, "v1", "(pointer uint64)"] ], - "default-buffer-init": [ [[8, 15], "a1", "dma-gif-packet"], [[18, 24], "a1", "gs-gif-tag"], @@ -229,16 +184,11 @@ [63, "a1", "(pointer gs-reg64)"], [[69, 72], "a0", "dma-packet"] ], - - // LEVEL "lookup-level-info": [ [3, "a1", "symbol"], [[4, 16], "a1", "level-load-info"] ], - - // DISPLAY "put-display-alpha-env": [[[0, 5], "v1", "gs-bank"]], - "(method 13 profile-bar)": [ [[27, 43], "t2", "dma-packet"], [[46, 56], "t2", "gs-gif-tag"], @@ -247,7 +197,6 @@ [79, "t3", "(pointer gs-xyzf)"], [110, "t2", "(pointer gs-xyzf)"] ], - "draw-sprite2d-xy": [ [[41, 45], "a3", "dma-packet"], [[51, 54], "a3", "gs-gif-tag"], @@ -258,7 +207,6 @@ [[106, 117], "v1", "(pointer dma-tag)"], [109, "a2", "dma-tag"] ], - "draw-quad2d": [ [[22, 28], "t1", "dma-packet"], [[31, 37], "t1", "gs-gif-tag"], @@ -275,7 +223,6 @@ [[120, 131], "v1", "(pointer dma-tag)"], [123, "a2", "dma-tag"] ], - "set-display-gs-state": [ [[3, 10], "t3", "dma-packet"], [[13, 19], "t3", "gs-gif-tag"], @@ -294,7 +241,6 @@ [61, "t3", "(pointer uint64)"], [63, "t3", "(pointer gs-reg64)"] ], - "set-display-gs-state-offset": [ [[3, 10], "t5", "dma-packet"], [[13, 19], "t5", "gs-gif-tag"], @@ -313,7 +259,6 @@ [68, "t5", "(pointer uint64)"], [70, "t5", "(pointer gs-reg64)"] ], - "reset-display-gs-state": [ [[9, 16], "t0", "dma-packet"], [[19, 25], "t0", "gs-gif-tag"], @@ -323,7 +268,6 @@ [46, "a3", "(pointer gs-reg64)"], [51, "a3", "(pointer gs-frame)"], [53, "a3", "(pointer gs-reg64)"], - [55, "a3", "(pointer gs-test)"], [57, "a3", "(pointer gs-reg64)"], [60, "a3", "(pointer gs-texa)"], @@ -333,11 +277,8 @@ [67, "a3", "(pointer uint64)"], [69, "a3", "(pointer gs-reg64)"] ], - "(method 9 connection)": [[8, "a0", "pointer"]], - "(method 10 connection)": [[8, "a0", "pointer"]], - "(method 0 engine)": [[39, "v0", "pointer"]], "(method 12 engine)": [ @@ -351,56 +292,35 @@ ], "(method 15 engine)": [[[0, 36], "v1", "connection"]], - "(method 19 engine)": [[8, "a0", "connection"]], - "(method 20 engine)": [[8, "a0", "connection"]], - "gs-set-default-store-image": [ [9, "t4", "gif-tag64"], [9, "v1", "gif-tag-regs"] ], - "dma-buffer-add-ref-texture": [ [[25, 29], "a3", "dma-packet"], [[32, 44], "a3", "gs-gif-tag"], [[47, 62], "a2", "dma-packet"] ], - "(method 11 level)": [ [[13, 18], "a1", "dma-packet"], - //[19, "a0", "(pointer uint32)"], [[20, 26], "a0", "dma-packet"], - [[50, 55], "a1", "dma-packet"], - // [56, "a0", "(pointer uint32)"], [[60, 63], "a0", "dma-packet"], - [[87, 92], "a1", "dma-packet"], - // [93, "a0", "(pointer uint32)"], [[97, 100], "a0", "dma-packet"], - [[124, 129], "a1", "dma-packet"], - // [130, "a0", "(pointer uint32)"], [[134, 137], "a0", "dma-packet"], - [[162, 167], "a1", "dma-packet"], - // [168, "a0", "(pointer uint32)"], [[172, 175], "a0", "dma-packet"], - [[199, 204], "a1", "dma-packet"], - // [205, "a0", "(pointer uint32)"], [[209, 212], "a0", "dma-packet"], - [[236, 241], "a1", "dma-packet"], - // [242, "a0", "(pointer uint32)"], [[246, 249], "a0", "dma-packet"], - [[273, 278], "a1", "dma-packet"], - // [279, "a0", "(pointer uint32)"], [[283, 286], "a0", "dma-packet"] ], - "(method 14 texture-page)": [ [[18, 22], "a0", "dma-packet"], [[28, 31], "a0", "gs-gif-tag"], @@ -409,7 +329,6 @@ [[44, 45], "a0", "dma-packet"], [45, "a0", "(pointer uint64)"] ], - "(method 13 texture-page)": [ [[45, 49], "a0", "dma-packet"], [[55, 58], "a0", "gs-gif-tag"], @@ -475,9 +394,7 @@ [[588, 591], "v1", "dma-packet"], [[672, 675], "v1", "dma-packet"] ], - "load-game-text-info": [[4, "v1", "game-text-info"]], - "texture-relocate": [ [[17, 21], "t4", "dma-packet"], [[27, 30], "t4", "gs-gif-tag"], @@ -491,7 +408,6 @@ [77, "t4", "(pointer gs-reg64)"], [[98, 102], "a2", "dma-packet"], [[108, 111], "a2", "gs-gif-tag"], - [132, "a2", "(pointer gs-bitbltbuf)"], [134, "a2", "(pointer gs-reg64)"], [135, "a2", "(pointer gs-trxpos)"], @@ -500,7 +416,6 @@ [141, "a2", "(pointer gs-reg64)"], [143, "a2", "(pointer gs-trxdir)"], [145, "a2", "(pointer gs-reg64)"], - [[157, 161], "a2", "dma-packet"], [[167, 170], "a2", "gs-gif-tag"], [191, "a2", "(pointer gs-bitbltbuf)"], @@ -512,7 +427,6 @@ [202, "a2", "(pointer gs-trxdir)"], [204, "a2", "(pointer gs-reg64)"] ], - "(method 11 texture-pool)": [ [[119, 123], "a0", "dma-packet"], [[129, 132], "a0", "gs-gif-tag"], @@ -521,9 +435,7 @@ [145, "a0", "dma-packet"], [146, "a0", "(pointer uint64)"] ], - "texture-page-login": [[[34, 45], "s2", "texture-page"]], - "upload-vram-data": [ [[9, 15], "a0", "dma-packet"], [[18, 24], "a0", "gs-gif-tag"], @@ -536,9 +448,7 @@ [45, "a0", "(pointer gs-trxdir)"], [47, "a0", "(pointer gs-reg64)"] ], - "texture-page-dir-inspect": [[[133, 136], "v1", "adgif-shader"]], - "upload-vram-pages": [ [[135, 140], "a0", "dma-packet"], [[144, 149], "a0", "gs-gif-tag"], @@ -546,7 +456,6 @@ [154, "a0", "(pointer uint64)"], [[162, 165], "v1", "dma-packet"] ], - "upload-vram-pages-pris": [ [[128, 134], "a0", "dma-packet"], [[137, 143], "a0", "gs-gif-tag"], @@ -554,8 +463,6 @@ [150, "a0", "(pointer gs-reg64)"], [[154, 159], "v1", "dma-packet"] ], - - // RES "(method 19 res-lump)": [ [46, "t2", "(pointer uint64)"], [100, "t3", "(pointer uint64)"], @@ -601,61 +508,35 @@ [[102, 120], "s0", "basic"], [[147, 150], "s0", "collide-mesh"], [[157, 200], "s0", "(array object)"], - //[[197, 199], "s0", "(array basic)"], - //[[236, 240], "a0", "basic"] [235, "s0", "basic"] ], - - // SHADOW-CPU-H "(method 10 shadow-control)": [[1, "v1", "int"]], - - // FACT-H - "(method 0 fact-info-enemy)": [ - [[3, 92], "gp", "fact-info-enemy"] - ], - + "(method 0 fact-info-enemy)": [[[3, 92], "gp", "fact-info-enemy"]], "(method 0 fact-info)": [ //[16, "t9", "(function string none)"], ["_stack_", 16, "res-tag"], [[32, 43], "v1", "(pointer int32)"], [86, "gp", "fact-info"] ], - "(method 0 fact-info-target)": [[[3, 20], "gp", "fact-info-target"]], - "(method 0 align-control)": [[[14, 18], "v0", "align-control"]], - "str-load": [[[20, 36], "s2", "load-chunk-msg"]], - "str-load-status": [ [[18, 22], "v1", "load-chunk-msg"], [26, "v1", "load-chunk-msg"] ], - "str-play-async": [[[8, 16], "s4", "load-chunk-msg"]], - "str-play-stop": [[[7, 14], "s5", "load-chunk-msg"]], - "str-play-queue": [[[19, 27], "s5", "load-chunk-msg"]], - "str-ambient-play": [[[7, 15], "s5", "load-chunk-msg"]], - "str-ambient-stop": [[[7, 16], "s5", "load-chunk-msg"]], - "dgo-load-begin": [[[21, 40], "s2", "load-dgo-msg"]], - "dgo-load-get-next": [[[14, 31], "v1", "load-dgo-msg"]], - "dgo-load-continue": [[[5, 21], "gp", "load-dgo-msg"]], - "string->sound-name": [[[2, 18], "a1", "(pointer uint8)"]], - "ramdisk-load": [[[8, 12], "v1", "ramdisk-rpc-load"]], - "(method 3 generic-tie-interp-point)": [[15, "gp", "(pointer uint128)"]], - "ripple-find-height": [[[22, 72], "s4", "mei-ripple"]], - "(method 0 collide-shape-prim-sphere)": [ [[4, 8], "v0", "collide-shape-prim-sphere"] ], @@ -665,48 +546,34 @@ "(method 0 collide-shape-prim-group)": [ [[11, 18], "v0", "collide-shape-prim-group"] ], - "entity-actor-count": [["_stack_", 16, "res-tag"]], - "entity-actor-lookup": [ ["_stack_", 16, "res-tag"], [[10, 33], "v1", "(pointer uint32)"] ], - "(method 11 joint-mod)": [ [15, "s3", "process-drawable"], [[26, 66], "s3", "fact-info-enemy"] ], - "joint-mod-look-at-handler": [[[2, 254], "gp", "joint-mod"]], - "joint-mod-world-look-at-handler": [[[0, 254], "gp", "joint-mod"]], - "joint-mod-rotate-handler": [[[2, 77], "s4", "joint-mod"]], - "joint-mod-joint-set-handler": [[[2, 13], "s4", "joint-mod"]], - "joint-mod-joint-set*-handler": [[[2, 31], "s5", "joint-mod"]], "joint-mod-wheel-callback": [[[2, 63], "s4", "joint-mod-wheel"]], "joint-mod-set-local-callback": [[[0, 23], "v1", "joint-mod-set-local"]], "joint-mod-set-world-callback": [[[0, 23], "v1", "joint-mod-set-world"]], "joint-mod-blend-local-callback": [[[2, 63], "gp", "joint-mod-blend-local"]], "joint-mod-spinner-callback": [[[2, 63], "gp", "joint-mod-spinner"]], - "(method 11 touching-prims-entry-pool)": [ [[0, 8], "v1", "touching-prims-entry"], [8, "v1", "pointer"], [[9, 11], "v1", "touching-prims-entry"], [[1, 20], "a1", "touching-prims-entry"] ], - "(method 0 touching-list)": [[[6, 9], "v0", "touching-list"]], - "num-func-chan": [[8, "v1", "joint-control-channel"]], - "shrubbery-login-post-texture": [ - //[[13, 41], "a3", "qword"], - // [[13, 41], "a2", "qword"] [[13, 15], "a3", "qword"], [16, "a3", "pointer"], [24, "a3", "pointer"], @@ -718,22 +585,16 @@ [[35, 37], "a3", "qword"], [[35, 37], "a2", "qword"] ], - "(method 3 sparticle-cpuinfo)": [[106, "f0", "float"]], - "camera-teleport-to-entity": [[9, "a0", "transform"]], - "add-debug-sphere-from-table": [[[9, 18], "s1", "(inline-array vector)"]], - "(method 14 actor-link-info)": [[5, "v1", "entity-links"]], "(method 15 actor-link-info)": [[5, "v1", "entity-links"]], - "(method 23 actor-link-info)": [[4, "v1", "entity-links"]], "(method 24 actor-link-info)": [[4, "v1", "entity-links"]], "(method 9 actor-link-info)": [[[0, 36], "s3", "entity-actor"]], "alt-actor-list-subtask-incomplete-count": [[19, "a0", "entity-links"]], "actor-link-dead-hook": [[1, "v1", "entity-links"]], - "check-irx-version": [[[6, 37], "gp", "sound-rpc-get-irx-version"]], "sound-bank-load": [[[9, 11], "v1", "sound-rpc-load-bank"]], "sound-bank-unload": [[[7, 9], "v1", "sound-rpc-unload-bank"]], @@ -780,7 +641,6 @@ "(method 12 ambient-sound)": [[[8, 20], "v1", "sound-rpc-set-param"]], "sound-buffer-dump": [[[14, 25], "s3", "sound-rpc-play"]], "actor-link-subtask-complete-hook": [[1, "v1", "entity-links"]], - "(method 0 vol-control)": [ [30, "s5", "res-lump"], [36, "s5", "res-lump"], @@ -791,25 +651,19 @@ [113, "s5", "res-lump"], [117, "s5", "res-lump"] ], - "point-in-air-box?": [[5, "f1", "float"]], - "(method 3 air-box)": [ [16, "f0", "float"], [22, "f0", "float"], [28, "f0", "float"] ], - "joint-anim-inspect-elt": [ [9, "gp", "joint-anim-matrix"], [26, "gp", "joint-anim-transformq"] ], "(method 12 art-group)": [[13, "a0", "art-joint-anim"]], - "(method 0 path-control)": [["_stack_", 16, "res-tag"]], - "(method 0 curve-control)": [[[13, 55], "s3", "entity"]], - "nav-mesh-connect": [ [[4, 15], "s2", "entity-actor"], [19, "v1", "entity"], @@ -819,7 +673,6 @@ [76, "a0", "entity"], [77, "a0", "entity-links"] ], - "add-debug-point": [ [125, "a3", "pointer"], [[27, 144], "a0", "(pointer uint64)"], @@ -872,18 +725,13 @@ "(method 13 drawable-inline-array-collide-fragment)": [ [[1, 5], "v1", "collide-fragment"] ], - "(method 12 drawable-inline-array-collide-fragment)": [ [[1, 5], "v1", "collide-fragment"] ], - "(method 11 drawable-inline-array-collide-fragment)": [ [[1, 5], "v1", "collide-fragment"] ], - - "main-cheats": [ - [[1123, 1126], "v1", "dma-packet"] - ], + "main-cheats": [[[1123, 1126], "v1", "dma-packet"]], "on": [[33, "t9", "(function cpu-thread function none)"]], "bg": [[37, "a0", "symbol"]], @@ -893,9 +741,7 @@ [[121, 146], "s1", "drawable-inline-array-tfrag"], [[150, 151], "s1", "drawable-tree-instance-tie"] ], - "(method 11 setting-control)": [[[3, 25], "s4", "connection"]], - "(method 9 setting-data)": [ [[4, 345], "s3", "connection"], [[9, 12], "v1", "symbol"], @@ -953,7 +799,6 @@ [[334, 337], "a0", "int"], [[341, 344], "a0", "uint"] ], - "(method 12 level)": [[151, "a0", "symbol"]], "(method 26 level-group)": [[[65, 96], "v0", "level"]], "update-sound-banks": [[[21, 52], "t0", "symbol"]], @@ -962,10 +807,7 @@ [[115, 154], "s3", "continue-point"] ], "(method 20 level)": [[[43, 45], "s3", "ramdisk-rpc-fill"]], - - "(anon-function 29 process-drawable)": [ - [[0, 99999], "s6", "process-drawable"] - ], + "(anon-function 29 process-drawable)": [[[0, 999], "s6", "process-drawable"]], "ja-done?": [[[0, 999], "s6", "process-drawable"]], "ja-min?": [[[0, 999], "s6", "process-drawable"]], @@ -1000,14 +842,11 @@ [[128, 152], "a2", "dma-packet"], [[157, 162], "a1", "dma-packet"] ], - "(top-level-login task-control)": [[165, "v1", "symbol"]], - "task-control-reset": [ [[7, 13], "a0", "task-control"], [[17, 21], "a0", "task-control"] ], - "(anon-function 494 task-control)": [[32, "v0", "float"]], "(anon-function 493 task-control)": [[32, "v0", "float"]], "(anon-function 480 task-control)": [[13, "v0", "float"]], @@ -1078,13 +917,11 @@ ], "(anon-function 38 task-control)": [[13, "v0", "float"]], "(anon-function 28 task-control)": [[13, "v0", "float"]], - "(method 18 game-info)": [ [4, "v1", "symbol"], [5, "v1", "level-load-info"], [10, "s3", "continue-point"] ], - "(method 9 game-info)": [ [ [270, 286], @@ -1092,7 +929,6 @@ "(function cpu-thread function object object object object pointer)" ] ], - "(method 25 game-info)": [ [4, "v1", "game-save-tag"], [53, "v1", "pointer"], @@ -1128,7 +964,6 @@ [480, "s4", "pointer"], [[493, 495], "s4", "game-save-tag"] ], - "(method 11 game-save)": [ [126, "v1", "pointer"], [213, "s4", "pointer"], @@ -1144,7 +979,6 @@ [196, "s4", "pointer"], [[203, 210], "s4", "game-save-tag"] ], - "drawable-load": [ [17, "s5", "drawable"], [18, "s5", "drawable"], @@ -1173,7 +1007,6 @@ [177, "s4", "external-art-buffer"], [183, "s4", "external-art-buffer"], [190, "s4", "external-art-buffer"], - [233, "s4", "spool-anim"], [240, "s4", "spool-anim"], [243, "s4", "spool-anim"], @@ -1182,14 +1015,11 @@ [253, "s4", "spool-anim"], [257, "s4", "spool-anim"] ], - - "(method 10 external-art-control)": [[18, "v1", "spool-anim"]], - + "(method 10 external-art-control)": [[18, "v1", "pointer"]], "(method 16 external-art-control)": [ [37, "a0", "process"], [17, "s5", "process-drawable"] ], - "ja-play-spooled-anim": [ [154, "a0", "process"], [286, "s2", "art-joint-anim"], @@ -1199,26 +1029,21 @@ [320, "s2", "art-joint-anim"], [324, "s2", "art-joint-anim"] ], - "(method 11 external-art-control)": [ [127, "a0", "process"], [151, "a0", "process"], [168, "a0", "process"], [18, "s5", "process-drawable"] ], - "debug-menu-item-var-update-display-str": [ [[44, 49], "v1", "int"], [[61, 69], "v1", "int"] ], - "debug-menu-item-get-max-width": [[[18, 27], "a0", "debug-menu-item-var"]], - "debug-menu-send-msg": [ [[3, 14], "s2", "debug-menu-item"], [[14, 21], "s2", "debug-menu-item-submenu"] ], - "debug-menu-item-var-joypad-handler": [ [[39, 42], "a2", "int"], [[40, 42], "a3", "int"], @@ -1231,7 +1056,6 @@ [[190, 194], "a0", "int"], [[193, 195], "v1", "int"] ], - "debug-menu-find-from-template": [ [3, "s4", "debug-menu"], [[4, 8], "s4", "debug-menu-item"], @@ -1244,18 +1068,11 @@ "dm-cam-render-float": [[[71, 72], "v0", "float"]], - "can-hint-be-played?": [ - [[25, 28], "a0", "level-hint"] // kinda a guess, but its the only process that makes sense - ], - + "can-hint-be-played?": [[[25, 28], "a0", "level-hint"]], "debug-menu-rebuild": [[[4, 13], "a0", "debug-menu-item"]], - "debug-menu-item-submenu-render": [[[39, 44], "v1", "dma-packet"]], - "debug-menu-item-function-render": [[[46, 51], "v1", "dma-packet"]], - "debug-menu-item-flag-render": [[[44, 49], "v1", "dma-packet"]], - "debug-menu-render": [ [[45, 48], "v1", "dma-packet"], [[106, 110], "v1", "dma-packet"] @@ -1267,72 +1084,56 @@ [[8, 20], "v1", "(pointer float)"], [[0, 60], "f1", "float"] ], - "(anon-function 2 memory-usage)": [ [[171, 415], "s5", "process-drawable"], [[212, 213], "v1", "collide-shape"] ], - "(method 8 process-tree)": [ [31, "v1", "symbol"], [6, "a3", "symbol"] ], - "(method 9 align-control)": [ [[27, 31], "t9", "(function object object object object)"] ], - "(method 8 tie-fragment)": [ [150, "a0", "(pointer int32)"], [[157, 160], "a0", "basic"] ], - "letterbox": [[[29, 33], "v1", "dma-packet"]], - "blackout": [[[20, 24], "v1", "dma-packet"]], - - "(method 10 external-art-control)": [[18, "v1", "pointer"]], - "(method 15 load-state)": [ [31, "t9", "(function int)"], [291, "s5", "entity-actor"], [370, "s3", "process-drawable"] ], - "yakow-default-event-handler": [ [27, "a0", "collide-shape"], [32, "a0", "collide-shape"] ], - "(method 11 yakow)": [ [184, "v1", "vector"], [186, "v1", "vector"], [189, "v1", "vector"] ], - "yakow-post": [ [114, "a0", "collide-shape-moving"], [130, "a0", "collide-shape-moving"] ], - "raw-ray-sphere-intersect": [ [23, "v1", "float"], [36, "v1", "uint"] ], - "(method 0 anim-test-obj)": [ [9, "s4", "anim-test-obj"], [10, "s4", "anim-test-obj"], [13, "s4", "anim-test-obj"], [15, "s4", "anim-test-obj"] ], - "(method 0 anim-test-sequence)": [ [8, "s5", "anim-test-sequence"], [11, "s5", "anim-test-sequence"], [13, "s5", "anim-test-sequence"] ], - "(method 0 anim-test-seq-item)": [ [7, "v0", "anim-test-seq-item"], [8, "v1", "anim-test-seq-item"], @@ -1341,7 +1142,6 @@ [14, "v0", "anim-test-seq-item"], [17, "v0", "anim-test-seq-item"] ], - "(method 3 anim-tester)": [ [12, "s5", "anim-test-obj"], [15, "s5", "anim-test-obj"], @@ -1365,7 +1165,6 @@ [126, "s3", "anim-test-seq-item"], [128, "s3", "anim-test-seq-item"] ], - "anim-test-obj-item-valid?": [ [5, "s5", "anim-test-sequence"], [12, "s5", "anim-test-sequence"], @@ -1376,7 +1175,6 @@ [26, "v1", "anim-test-seq-item"], [28, "v1", "anim-test-seq-item"] ], - "anim-test-obj-remove-invalid": [ [84, "v1", "anim-test-sequence"], [88, "v1", "anim-test-sequence"], @@ -1404,7 +1202,6 @@ [36, "s3", "anim-test-seq-item"], [61, "a0", "anim-test-seq-item"] ], - "anim-tester-reset": [ [14, "v1", "anim-test-obj"], [30, "v1", "anim-test-obj"], @@ -1413,12 +1210,10 @@ [43, "v1", "anim-test-obj"], [[50, 53], "v1", "anim-test-obj"] ], - "anim-tester-save-all-objects": [ [[4, 19], "gp", "anim-test-obj"], [17, "v1", "anim-test-obj"] ], - "anim-tester-save-object-seqs": [ [63, "s5", "anim-test-sequence"], [69, "s5", "anim-test-sequence"], @@ -1440,7 +1235,6 @@ [121, "v1", "anim-test-seq-item"], [122, "s4", "anim-test-seq-item"] ], - "anim-test-obj-list-handler": [ [25, "s5", "anim-test-obj"], [31, "s5", "anim-test-obj"], @@ -1450,7 +1244,6 @@ [112, "v1", "anim-tester"], [[202, 205], "v1", "dma-packet"] ], - "anim-test-anim-list-handler": [ [2, "s5", "anim-test-obj"], [25, "s5", "anim-test-obj"], @@ -1471,7 +1264,6 @@ [173, "v1", "anim-test-obj"], [[263, 266], "v1", "dma-packet"] ], - "anim-test-sequence-list-handler": [ [2, "s5", "anim-test-sequence"], [25, "s5", "anim-test-sequence"], @@ -1489,7 +1281,6 @@ [151, "v1", "anim-test-sequence"], [[267, 270], "v1", "dma-packet"] ], - "anim-test-edit-sequence-list-handler": [ [[82, 85], "v1", "dma-packet"], [[148, 151], "v1", "dma-packet"], @@ -1507,7 +1298,6 @@ [491, "s3", "anim-test-seq-item"], [502, "s3", "anim-test-seq-item"] ], - "anim-tester-interface": [ [[34, 48], "gp", "anim-test-obj"], [[70, 73], "v1", "dma-packet"], @@ -1518,7 +1308,6 @@ [[156, 160], "v1", "anim-test-obj"], [[162, 165], "v1", "anim-test-sequence"] ], - "anim-tester-get-playing-item": [ [4, "t9", "(function glst-list int anim-test-seq-item)"], [20, "t9", "(function glst-list int anim-test-seq-item)"], @@ -1527,7 +1316,6 @@ [25, "v0", "anim-test-seq-item"], [5, "v0", "anim-test-seq-item"] ], - "anim-tester-add-newobj": [ ["_stack_", 128, "anim-test-obj"], [[2, 185], "s2", "anim-test-obj"], @@ -1542,22 +1330,17 @@ [171, "v1", "anim-test-seq-item"], [173, "v1", "anim-test-seq-item"] ], - "anim-tester-start": [[20, "t9", "(function process function none)"]], - "anim-tester-set-name": [ [[34, 51], "s3", "anim-test-obj"], [[40, 63], "s5", "anim-test-sequence"] ], - "anim-tester-add-sequence": [[[33, 102], "s5", "anim-test-obj"]], - "(anon-function 11 anim-tester)": [ [[23, 113], "s4", "anim-test-obj"], [[83, 338], "gp", "anim-test-sequence"], [[123, 187], "s4", "art-joint-anim"] ], - "(method 10 bsp-header)": [ [[51, 61], "a0", "(pointer uint128)"], [[51, 61], "a1", "(pointer uint128)"], @@ -1567,34 +1350,30 @@ [5, "a0", "terrain-bsp"], [8, "a0", "terrain-bsp"] ], - "(method 15 bsp-header)": [ [5, "a0", "terrain-bsp"], [8, "a0", "terrain-bsp"] ], "upload-vis-bits": [ - [[4,16], "a1", "(pointer uint128)"], + [[4, 16], "a1", "(pointer uint128)"], [[12, 14], "a0", "(pointer uint128)"], - [[20,22], "a2", "(pointer uint128)"], + [[20, 22], "a2", "(pointer uint128)"], [[28, 30], "a0", "(pointer uint128)"], [[32, 34], "a2", "(pointer uint128)"] ], - "bsp-camera-asm": [ [[4, 14], "a1", "bsp-node"], [[0, 9], "v1", "bsp-node"], [[12, 16], "v1", "bsp-node"] ], - "level-remap-texture": [ [15, "t0", "(pointer int32)"], [21, "t0", "(pointer int32)"], [19, "t0", "(pointer uint64)"], [12, "v1", "int"] ], - "sprite-add-matrix-data": [ [[5, 15], "a2", "dma-packet"], [[24, 29], "a1", "matrix"], @@ -1602,9 +1381,7 @@ [[60, 97], "a1", "matrix"], [[116, 129], "a1", "vector"] ], - "sprite-add-frame-data": [[[8, 16], "a0", "dma-packet"]], - "sprite-add-2d-chunk": [ [[12, 20], "a0", "dma-packet"], [[45, 52], "a0", "dma-packet"], @@ -1612,7 +1389,6 @@ [[80, 87], "v1", "dma-packet"], [65, "a3", "int"] ], - "sprite-add-3d-chunk": [ [[11, 19], "a0", "dma-packet"], [[44, 51], "a0", "dma-packet"], @@ -1620,7 +1396,6 @@ [[79, 87], "v1", "dma-packet"], [65, "a3", "int"] ], - "sprite-add-shadow-chunk": [ [[11, 19], "a0", "dma-packet"], [[37, 44], "a0", "dma-packet"], @@ -1629,7 +1404,6 @@ [[105, 121], "s1", "adgif-shader"], [[130, 138], "v1", "dma-packet"] ], - "sprite-draw": [ [[33, 37], "a0", "dma-packet"], [[43, 46], "a0", "gs-gif-tag"], @@ -1642,7 +1416,6 @@ [[125, 129], "a0", "dma-packet"], [[143, 146], "v1", "dma-packet"] ], - "sprite-init-distorter": [ [59, "a3", "uint"], [[3, 7], "a2", "dma-packet"], @@ -1661,7 +1434,6 @@ [51, "a2", "(pointer gs-reg64)"], [[62, 67], "a1", "dma-packet"] ], - "sprite-draw-distorters": [ [[70, 90], "a0", "vector"], [72, "v1", "vector"], @@ -1721,12 +1493,8 @@ [[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"] - ], + "cam-combiner-init": [[[0, 999], "s6", "camera-combiner"]], "(code cam-combiner-active)": [[[0, 999], "s6", "camera-combiner"]], @@ -1738,20 +1506,12 @@ [[187, 231], "gp", "camera-slave"] ], - "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-master-init": [[[0, 999], "s6", "camera-master"]], "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"] @@ -1883,22 +1643,16 @@ [[78, 79], "a0", "dma-packet"], [79, "a0", "(pointer uint64)"] ], - "(event water-vol-idle water-anim)": [ - [6, "a0", "vector"] - ], + "(event water-vol-idle water-anim)": [[6, "a0", "vector"]], - "(method 22 water-anim)": [ - [25, "s3", "basic"] - ], + "(method 22 water-anim)": [[25, "s3", "basic"]], "(method 25 water-anim)": [ [25, "v0", "(pointer float)"], ["_stack_", 16, "res-tag"] ], - "(method 22 rigid-body-platform)": [ - [26, "f0", "float"] - ], + "(method 22 rigid-body-platform)": [[26, "f0", "float"]], "rigid-body-platform-event-handler": [ [28, "v1", "process-drawable"], @@ -1922,13 +1676,9 @@ [14, "t9", "(function process-drawable int process-drawable)"] ], - "(method 10 rigid-body)": [ - [50, "v1", "vector"] - ], + "(method 10 rigid-body)": [[50, "v1", "vector"]], - "(method 22 mud)": [ - [35, "v0", "(pointer float)"] - ], + "(method 22 mud)": [[35, "v0", "(pointer float)"]], "(method 11 twister)": [ [7, "s4", "twist-joint"], @@ -1943,21 +1693,13 @@ [82, "s4", "twist-joint"] ], - "(code teetertotter-launch)": [ - [11, "v1", "art-joint-anim"] - ], + "(code teetertotter-launch)": [[11, "v1", "art-joint-anim"]], - "(code teetertotter-bend)": [ - [10, "v1", "art-joint-anim"] - ], + "(code teetertotter-bend)": [[10, "v1", "art-joint-anim"]], - "misty-camera-view": [ - [25, "v1", "handle"] - ], + "misty-camera-view": [[25, "v1", "handle"]], - "(method 11 silostep)": [ - [100, "v1", "art-joint-anim"] - ], + "(method 11 silostep)": [[100, "v1", "art-joint-anim"]], "(enter plat-button-pressed sunken-elevator)": [ [40, "v1", "village2cam"], @@ -1972,9 +1714,7 @@ [13, "v0", "(state sunken-elevator)"] ], - "(method 27 sunken-elevator)": [ - [37, "v1", "art-joint-anim"] - ], + "(method 27 sunken-elevator)": [[37, "v1", "art-joint-anim"]], "nav-enemy-set-base-collide-sphere-collide-with": [ [19, "v1", "collide-shape-prim-group"], @@ -1990,16 +1730,10 @@ [55, "s5", "collide-shape-prim"] ], - "nav-enemy-jump-land-anim": [ - [39, "v1", "art-joint-anim"] - ], + "nav-enemy-jump-land-anim": [[39, "v1", "art-joint-anim"]], - "(code nav-enemy-victory nav-enemy)": [ - [27, "v1", "art-joint-anim"] - ], - "(code nav-enemy-notice nav-enemy)": [ - [27, "v1", "art-joint-anim"] - ], + "(code nav-enemy-victory nav-enemy)": [[27, "v1", "art-joint-anim"]], + "(code nav-enemy-notice nav-enemy)": [[27, "v1", "art-joint-anim"]], "(code nav-enemy-patrol nav-enemy)": [ [23, "v1", "art-joint-anim"], [105, "v1", "art-joint-anim"], @@ -2012,12 +1746,8 @@ [91, "v1", "art-joint-anim"] ], - "nav-enemy-set-hit-from-direction": [ - [19, "v1", "process-drawable"] - ], - "(method 45 nav-enemy)": [ - [14, "v1", "process-mask"] - ], + "nav-enemy-set-hit-from-direction": [[19, "v1", "process-drawable"]], + "(method 45 nav-enemy)": [[14, "v1", "process-mask"]], "nav-enemy-default-event-handler": [ [62, "a0", "vector"], @@ -2030,13 +1760,9 @@ [19, "t9", "(function process-drawable int none)"] ], - "(enter nav-enemy-patrol nav-enemy)": [ - [8, "v1", "int"] - ], + "(enter nav-enemy-patrol nav-enemy)": [[8, "v1", "int"]], - "(code nav-enemy-fuel-cell nav-enemy)": [ - [31, "v1", "int"] - ], + "(code nav-enemy-fuel-cell nav-enemy)": [[31, "v1", "int"]], "(method 16 level)": [ [252, "v1", "(pointer uint128)"], @@ -2055,13 +1781,9 @@ [140, "s1", "(pointer uint128)"] ], - "unpack-comp-huf": [ - [[21, 23], "t3", "(pointer uint16)"] - ], + "unpack-comp-huf": [[[21, 23], "t3", "(pointer uint16)"]], - "(method 9 merc-fragment)": [ - [[13,161], "s3", "adgif-shader"] - ], + "(method 9 merc-fragment)": [[[13, 161], "s3", "adgif-shader"]], "(method 9 merc-effect)": [ [49, "s4", "pointer"], @@ -2076,7 +1798,7 @@ [[12, 18], "gp", "(pointer vif-tag)"] ], - "merc-vu1-init-buffer":[ + "merc-vu1-init-buffer": [ [[27, 31], "a0", "dma-packet"], [[37, 40], "a0", "gs-gif-tag"], [44, "a0", "(pointer gs-test)"], @@ -2091,41 +1813,23 @@ [103, "a1", "pointer"] ], - "merc-edge-stats": [ - [[33, 35], "v1", "merc-ctrl"] - ], + "merc-edge-stats": [[[33, 35], "v1", "merc-ctrl"]], - "(method 9 screen-filter)": [ - [[23, 26], "v1", "dma-packet"] - ], + "(method 9 screen-filter)": [[[23, 26], "v1", "dma-packet"]], - "(method 48 mayor)": [ - [32, "a0", "int"] - ], + "(method 48 mayor)": [[32, "a0", "int"]], - "(method 43 mayor)": [ - [19, "v1", "float"] - ], + "(method 43 mayor)": [[19, "v1", "float"]], - "(post idle mayor)": [ - [4, "t9", "(function none)"] - ], + "(post idle mayor)": [[4, "t9", "(function none)"]], - "(method 43 bird-lady)": [ - [19, "v1", "float"] - ], + "(method 43 bird-lady)": [[19, "v1", "float"]], - "muse-to-idle": [ - [57, "v1", "muse"] - ], + "muse-to-idle": [[57, "v1", "muse"]], - "(method 32 sculptor)": [ - [87, "v1", "muse"] - ], + "(method 32 sculptor)": [[87, "v1", "muse"]], - "(method 43 sculptor)": [ - [19, "v1", "float"] - ], + "(method 43 sculptor)": [[19, "v1", "float"]], "(code idle sculptor)": [ [71, "v1", "art-joint-anim"], @@ -2151,21 +1855,13 @@ [936, "v1", "art-joint-anim"] ], - "(method 43 geologist)": [ - [19, "v1", "float"] - ], + "(method 43 geologist)": [[19, "v1", "float"]], - "(anon-function 3 oracle)": [ - [11, "v1", "collide-shape"] - ], + "(anon-function 3 oracle)": [[11, "v1", "collide-shape"]], - "(method 43 farmer)": [ - [19, "v1", "float"] - ], + "(method 43 farmer)": [[19, "v1", "float"]], - "(method 43 explorer)": [ - [19, "v1", "float"] - ], + "(method 43 explorer)": [[19, "v1", "float"]], "(code idle explorer)": [ [36, "v1", "float"], @@ -2188,13 +1884,9 @@ [783, "v1", "art-joint-anim"] ], - "(method 32 assistant)": [ - [39, "v1", "float"] - ], + "(method 32 assistant)": [[39, "v1", "float"]], - "(method 43 assistant)": [ - [19, "v1", "float"] - ], + "(method 43 assistant)": [[19, "v1", "float"]], "(code idle assistant)": [ [35, "v1", "float"], @@ -2210,56 +1902,66 @@ [602, "v1", "art-joint-anim"] ], - "check-drop-level-assistant": [ - [17, "v1", "float"] - ], + "check-drop-level-assistant": [[17, "v1", "float"]], "(method 32 sage)": [ [76, "v1", "float"], [262, "v1", "assistant"] ], - "(method 43 sage)": [ - [19, "v1", "float"] - ], + "(method 43 sage)": [[19, "v1", "float"]], "(code idle sage)": [ [35, "v1", "float"], [155, "v1", "art-joint-anim"] ], - "(method 43 gambler)": [ - [19, "v1", "float"] - ], + "(method 43 gambler)": [[19, "v1", "float"]], - "(code idle gambler)": [ - [93, "v1", "float"] - ], + "(code idle gambler)": [[93, "v1", "float"]], - "(method 32 warrior)": [ - [76, "v1", "handle"] - ], + "(method 32 warrior)": [[76, "v1", "handle"]], - "(method 43 warrior)": [ - [19, "v1", "float"] - ], + "(method 43 warrior)": [[19, "v1", "float"]], "(method 32 minershort)": [ [44, "v1", "float"], [112, "v1", "float"] ], - "(method 43 minershort)": [ - [19, "v1", "float"] - ], + "(method 43 minershort)": [[19, "v1", "float"]], "(method 33 progress)": [ - [30, "t9", "(function process function object object object object object)"], - [159, "t9", "(function process function object object object object object)"], - [288, "t9", "(function process function object object object object object)"], - [417, "t9", "(function process function object object object object object)"], - [546, "t9", "(function process function object object object object object)"], - [675, "t9", "(function process function object object object object object)"], + [ + 30, + "t9", + "(function process function object object object object object)" + ], + [ + 159, + "t9", + "(function process function object object object object object)" + ], + [ + 288, + "t9", + "(function process function object object object object object)" + ], + [ + 417, + "t9", + "(function process function object object object object object)" + ], + [ + 546, + "t9", + "(function process function object object object object object)" + ], + [ + 675, + "t9", + "(function process function object object object object object)" + ], [35, "a0", "manipy"], [38, "v1", "manipy"], [50, "v1", "manipy"], @@ -2291,9 +1993,7 @@ [4, "f0", "float"] ], - "(method 7 progress)": [ - [16, "a2", "pointer"] - ], + "(method 7 progress)": [[16, "a2", "pointer"]], "(method 17 progress)": [ [[466, 471], "v1", "dma-packet"], @@ -2307,24 +2007,16 @@ [[198, 203], "v1", "dma-packet"] ], - "(method 23 progress)": [ - [103, "v1", "float"] - ], + "(method 23 progress)": [[103, "v1", "float"]], - "(post progress-normal)": [ - [416, "a0", "float"] - ], + "(post progress-normal)": [[416, "a0", "float"]], - "(method 53 progress)": [ - [[0, 999], "gp", "progress-screen"] - ], + "(method 53 progress)": [[[0, 999], "gp", "progress-screen"]], "(method 35 progress)": [[38, "s4", "game-text-id"]], "(method 43 progress)": [[45, "s4", "game-text-id"]], "(method 38 progress)": [[58, "a1", "game-text-id"]], - "draw-percent-bar": [ - [[33, 38], "v1", "dma-packet"] - ], + "draw-percent-bar": [[[33, 38], "v1", "dma-packet"]], "(method 11 fact-info-target)": [ [135, "v1", "target"], @@ -2343,9 +2035,7 @@ [[47, 88], "v1", "connection"] ], - "(anon-function 7 game-info)": [ - [2, "v1", "collide-shape"] - ], + "(anon-function 7 game-info)": [[2, "v1", "collide-shape"]], "(method 24 game-info)": [ [112, "s3", "pointer"], @@ -2366,13 +2056,11 @@ // [329, "a0", "pointer"], // [338, "a0", "pointer"], // [[173, 230], "a0", "game-save-tag"], - [252, "a0", "(pointer int32)"], + [252, "a0", "(pointer int32)"], [654, "a0", "pointer"] ], - "auto-save-post":[ - [138, "t9", "(function object string object none)"] - ], + "auto-save-post": [[138, "t9", "(function object string object none)"]], "target-compute-pole": [ [12, "s4", "swingpole"], @@ -2385,13 +2073,9 @@ [87, "s4", "swingpole"] ], - "(method 10 target)": [ - [[10, 13], "t9", "(function process-drawable none)"] - ], + "(method 10 target)": [[[10, 13], "t9", "(function process-drawable none)"]], - "draw-history": [ - [[99, 101], "v1", "int"] - ], + "draw-history": [[[99, 101], "v1", "int"]], "(method 9 attack-info)": [ [82, "v1", "process-drawable"], @@ -2407,9 +2091,7 @@ [38, "f1", "float"] ], - "(method 32 evilbro)": [ - [20, "v1", "handle"] - ], + "(method 32 evilbro)": [[20, "v1", "handle"]], "(code idle evilbro)": [ [27, "v1", "art-joint-anim"], @@ -2417,9 +2099,7 @@ [171, "v1", "float"] ], - "all-texture-tweak-adjust": [ - [[35, 44], "s0", "adgif-shader"] - ], + "all-texture-tweak-adjust": [[[35, 44], "s0", "adgif-shader"]], "build-instance-list": [ [30, "v1", "drawable-tree-instance-shrub"], @@ -2555,9 +2235,7 @@ [[5, 15], "v1", "level-load-info"] ], - "(method 26 basebutton)": [ - [31, "v1", "art-joint-anim"] - ], + "(method 26 basebutton)": [[31, "v1", "art-joint-anim"]], "debug-menu-item-var-make-float": [ [30, "t9", "(function int debug-menu-msg float float int)"] @@ -2568,17 +2246,11 @@ [39, "a2", "int"] ], - "process-status-bits": [ - [[15, 59], "s3", "process-drawable"] - ], + "process-status-bits": [[[15, 59], "s3", "process-drawable"]], - "(method 13 level-group)": [ - [[56, 61], "a0", "entity-actor"] - ], + "(method 13 level-group)": [[[56, 61], "a0", "entity-actor"]], - "(method 24 entity)": [ - [[39, 45], "a0", "entity-actor"] - ], + "(method 24 entity)": [[[39, 45], "a0", "entity-actor"]], "(method 23 level-group)": [ [53, "a0", "entity-actor"], @@ -2603,9 +2275,7 @@ [[123, 127], "a0", "process-drawable"] ], - "(method 3 entity)": [ - [7, "t9", "(function entity entity)"] - ], + "(method 3 entity)": [[7, "t9", "(function entity entity)"]], "(method 3 entity-actor)": [ [7, "t9", "(function entity-actor entity-actor)"] @@ -2618,29 +2288,17 @@ [[384, 494], "s5", "process-drawable"] ], - "(method 22 level-group)": [ - [[28, 30], "v0", "(inline-array vector)"] - ], + "(method 22 level-group)": [[[28, 30], "v0", "(inline-array vector)"]], - "expand-vis-box-with-point": [ - [10, "v0", "(inline-array vector)"] - ], + "expand-vis-box-with-point": [[10, "v0", "(inline-array vector)"]], - "(method 28 entity-ambient)": [ - [79, "v1", "int"] - ], + "(method 28 entity-ambient)": [[79, "v1", "int"]], - "(method 27 entity-ambient)": [ - [[15, 250], "s5", "symbol"] - ], + "(method 27 entity-ambient)": [[[15, 250], "s5", "symbol"]], - "cam-master-effect": [ - [[0, 999], "s6", "camera-master"] - ], + "cam-master-effect": [[[0, 999], "s6", "camera-master"]], - "birth-func-vector-orient": [ - [[7, 24], "s3", "sprite-vec-data-2d"] - ], + "birth-func-vector-orient": [[[7, 24], "s3", "sprite-vec-data-2d"]], "process-drawable-burn-effect": [ [28, "a0", "process-drawable"], @@ -2649,21 +2307,19 @@ [64, "a0", "process-drawable"] ], - "process-drawable-random-point!": [ - [[28, 40], "s4", "collide-shape"] - ], + "process-drawable-random-point!": [[[28, 40], "s4", "collide-shape"]], - "(anon-function 0 dark-eco-pool)": [ - [2, "v1", "state"] - ], + "(anon-function 0 dark-eco-pool)": [[2, "v1", "state"]], "(method 25 dark-eco-pool)": [ - [22, "t9", "(function res-lump symbol symbol float structure (pointer res-tag) pointer object)"] + [ + 22, + "t9", + "(function res-lump symbol symbol float structure (pointer res-tag) pointer object)" + ] ], - "(top-level-login beach-rocks)": [ - [78, "v1", "state"] - ], + "(top-level-login beach-rocks)": [[78, "v1", "state"]], "(method 7 beach-rock)": [ [5, "v1", "int"], @@ -2671,9 +2327,7 @@ [19, "t9", "(function process-drawable int none)"] ], - "(method 10 beach-rock)": [ - [21, "t9", "(function process-drawable none)"] - ], + "(method 10 beach-rock)": [[21, "t9", "(function process-drawable none)"]], "(code falling beach-rock)": [ [138, "gp", "handle"], @@ -2681,18 +2335,14 @@ [[158, 165], "s5", "handle"] ], - "(method 11 beach-rock)": [ - [77, "v1", "int"] - ], + "(method 11 beach-rock)": [[77, "v1", "int"]], "(anon-function 27 projectiles)": [ [27, "s4", "collide-shape"], [36, "s4", "collide-shape"] ], - "projectile-update-velocity-space-wars": [ - [60, "a0", "target"] - ], + "projectile-update-velocity-space-wars": [[60, "a0", "target"]], "projectile-init-by-other": [ [70, "v1", "process-drawable"], @@ -2716,16 +2366,16 @@ ], "spawn-projectile-blue": [ - [69, "s2", "(function process function object object object object object object)"] + [ + 69, + "s2", + "(function process function object object object object object object)" + ] ], - "(method 28 projectile-blue)": [ - [27, "v1", "process-drawable"] - ], + "(method 28 projectile-blue)": [[27, "v1", "process-drawable"]], - "(method 27 projectile-yellow)": [ - [70, "v1", "process-mask"] - ], + "(method 27 projectile-yellow)": [[70, "v1", "process-mask"]], "manipy-init": [[143, "a0", "collide-shape"]], @@ -2742,13 +2392,9 @@ [43, "t9", "(function none :behavior plat-button)"] ], - "(code bouncer-fire)": [ - [17, "v1", "art-joint-anim"] - ], + "(code bouncer-fire)": [[17, "v1", "art-joint-anim"]], - "(method 39 hopper)": [ - [16, "t9", "(function nav-enemy none)"] - ], + "(method 39 hopper)": [[16, "t9", "(function nav-enemy none)"]], "(code nav-enemy-idle hopper)": [ [16, "v1", "art-joint-anim"], @@ -2765,9 +2411,7 @@ [105, "v1", "art-joint-anim"] ], - "(method 39 junglefish)": [ - [12, "t9", "(function nav-enemy none)"] - ], + "(method 39 junglefish)": [[12, "t9", "(function nav-enemy none)"]], "(code nav-enemy-patrol junglefish)": [ [27, "v1", "art-joint-anim"], @@ -2776,9 +2420,7 @@ [251, "v1", "art-joint-anim"] ], - "(code nav-enemy-attack junglefish)": [ - [14, "v1", "art-joint-anim"] - ], + "(code nav-enemy-attack junglefish)": [[14, "v1", "art-joint-anim"]], "(code nav-enemy-victory junglefish)": [ [14, "v1", "art-joint-anim"], @@ -2799,9 +2441,7 @@ [298, "gp", "evilsis"] ], - "sequenceC-can-trans-hook": [ - [12, "v1", "process-taskable"] - ], + "sequenceC-can-trans-hook": [[12, "v1", "process-taskable"]], "(anon-function 7 sidekick-human)": [ [2, "v1", "process-taskable"], @@ -2836,9 +2476,7 @@ [23, "gp", "assistant-bluehut"] ], - "(method 43 sage-bluehut)": [ - [19, "v1", "float"] - ], + "(method 43 sage-bluehut)": [[19, "v1", "float"]], "(code idle sage-bluehut)": [ [34, "v1", "float"], @@ -2852,29 +2490,17 @@ [329, "v1", "art-joint-anim"] ], - "(method 39 sharkey)": [ - [71, "t9", "(function nav-enemy none)"] - ], + "(method 39 sharkey)": [[71, "t9", "(function nav-enemy none)"]], - "(code nav-enemy-patrol sharkey)": [ - [27, "v1", "art-joint-anim"] - ], + "(code nav-enemy-patrol sharkey)": [[27, "v1", "art-joint-anim"]], - "(code nav-enemy-attack sharkey)": [ - [144, "v1", "art-joint-anim"] - ], + "(code nav-enemy-attack sharkey)": [[144, "v1", "art-joint-anim"]], - "(code nav-enemy-chase sharkey)": [ - [40, "v1", "art-joint-anim"] - ], + "(code nav-enemy-chase sharkey)": [[40, "v1", "art-joint-anim"]], - "(code nav-enemy-stop-chase sharkey)": [ - [22, "v1", "art-joint-anim"] - ], + "(code nav-enemy-stop-chase sharkey)": [[22, "v1", "art-joint-anim"]], - "(code nav-enemy-victory sharkey)": [ - [24, "v1", "art-joint-anim"] - ], + "(code nav-enemy-victory sharkey)": [[24, "v1", "art-joint-anim"]], "(code nav-enemy-chase lurkercrab)": [ [17, "v1", "art-joint-anim"], @@ -2888,13 +2514,9 @@ [191, "v1", "art-joint-anim"] ], - "(code nav-enemy-notice lurkerpuppy)": [ - [24, "v1", "art-joint-anim"] - ], + "(code nav-enemy-notice lurkerpuppy)": [[24, "v1", "art-joint-anim"]], - "(code nav-enemy-victory lurkerpuppy)": [ - [20, "v1", "art-joint-anim"] - ], + "(code nav-enemy-victory lurkerpuppy)": [[20, "v1", "art-joint-anim"]], "(code nav-enemy-give-up lurkerpuppy)": [ [18, "v1", "art-joint-anim"], @@ -2950,18 +2572,14 @@ [581, "v1", "handle"] ], - "target-has-all-the-cells?": [ - [17, "v1", "float"] - ], + "target-has-all-the-cells?": [[17, "v1", "float"]], "(code open final-door)": [ [13, "v1", "art-joint-anim"], [66, "v1", "art-joint-anim"] ], - "(code idle powercellalt)": [ - [8, "a1", "process-drawable"] - ], + "(code idle powercellalt)": [[8, "a1", "process-drawable"]], "(code target-final-door)": [ [85, "gp", "handle"], @@ -2991,17 +2609,11 @@ [101, "v1", "art-joint-anim"] ], - "voicebox-track": [ - [4, "a0", "target"] - ], + "voicebox-track": [[4, "a0", "target"]], - "(method 27 plat-button)": [ - [37, "v1", "art-joint-anim"] - ], + "(method 27 plat-button)": [[37, "v1", "art-joint-anim"]], - "(method 11 plat-button)": [ - [17, "v1", "vector"] - ], + "(method 11 plat-button)": [[17, "v1", "vector"]], "(trans plat-button-move-downward plat-button)": [ [[92, 999], "gp", "sound-rpc-set-param"] @@ -3011,17 +2623,11 @@ [[92, 999], "gp", "sound-rpc-set-param"] ], - "(anon-function 7 plat-eco)": [ - [22, "v1", "target"] - ], + "(anon-function 7 plat-eco)": [[22, "v1", "target"]], - "drop-plat-set-fade": [ - [7, "v1", "process-drawable"] - ], + "drop-plat-set-fade": [[7, "v1", "process-drawable"]], - "(code drop-plat-spawn)": [ - [3, "v1", "process-drawable"] - ], + "(code drop-plat-spawn)": [[3, "v1", "process-drawable"]], "(code drop-plat-rise)": [ [10, "v1", "process-drawable"], @@ -3030,26 +2636,18 @@ [85, "v1", "process-drawable"] ], - "(post drop-plat-rise)": [ - [12, "v1", "process-drawable"] - ], + "(post drop-plat-rise)": [[12, "v1", "process-drawable"]], "(code drop-plat-drop)": [ [2, "v1", "process-drawable"], [85, "v1", "process-drawable"] ], - "(post drop-plat-drop)": [ - [12, "v1", "process-drawable"] - ], + "(post drop-plat-drop)": [[12, "v1", "process-drawable"]], - "drop-plat-init-by-other": [ - [22, "v1", "process-drawable"] - ], + "drop-plat-init-by-other": [[22, "v1", "process-drawable"]], - "citb-drop-plat-drop-children": [ - [[23,29], "a0", "drop-plat"] - ], + "citb-drop-plat-drop-children": [[[23, 29], "a0", "drop-plat"]], "citb-drop-plat-spawn-children": [ [98, "t9", "(function process function vector uint uint int)"] @@ -3074,9 +2672,7 @@ [192, "v1", "(pointer float)"] ], - "(method 27 square-platform)": [ - [[26, 33], "a0", "water-vol"] - ], + "(method 27 square-platform)": [[[26, 33], "a0", "water-vol"]], "(method 27 wedge-plat)": [ [4, "v1", "process-drawable"], @@ -3108,22 +2704,16 @@ [60, "v1", "art-joint-anim"] ], - "(code plunger-lurker-idle)": [ - [10, "v1", "art-joint-anim"] - ], + "(code plunger-lurker-idle)": [[10, "v1", "art-joint-anim"]], - "(code flying-lurker-idle)": [ - [92, "v1", "art-joint-anim"] - ], + "(code flying-lurker-idle)": [[92, "v1", "art-joint-anim"]], "(code flying-lurker-fly)": [ [56, "v1", "art-joint-anim"], [110, "v1", "float"] ], - "(code flying-lurker-start)": [ - [36, "v1", "float"] - ], + "(code flying-lurker-start)": [[36, "v1", "float"]], "(method 18 collide-cache)": [ [44, "v1", "collide-shape-prim-sphere"], @@ -3151,13 +2741,9 @@ [109, "v1", "manipy"] ], - "level-hint-task-process": [ - ["_stack_", 16, "res-tag"] - ], + "level-hint-task-process": [["_stack_", 16, "res-tag"]], - "kill-current-level-hint": [ - [[13, 33], "s4", "level-hint"] - ], + "kill-current-level-hint": [[[13, 33], "s4", "level-hint"]], "level-hint-init-by-other": [ [[54, 75], "a0", "string"], @@ -3200,34 +2786,28 @@ [57, "v0", "symbol"] ], "forall-particles-runner": [ - [[19,28], "s4", "sparticle-cpuinfo"], + [[19, 28], "s4", "sparticle-cpuinfo"], [34, "s4", "pointer"], [35, "s3", "pointer"] ], - "(method 2 sparticle-cpuinfo)": [ - [14, "f0", "float"] - ], + "(method 2 sparticle-cpuinfo)": [[14, "f0", "float"]], "sp-kill-particle": [ [7, "a1", "uint"], [7, "v1", "uint"] ], - "sparticle-track-root":[ - [2, "v1", "process-drawable"] - ], + "sparticle-track-root": [[2, "v1", "process-drawable"]], - "sparticle-track-root-prim":[ + "sparticle-track-root-prim": [ [2, "v1", "process-drawable"], [3, "v1", "collide-shape"] ], - "sp-orbiter":[ - [[73, 82], "v1", "sprite-vec-data-2d"] - ], + "sp-orbiter": [[[73, 82], "v1", "sprite-vec-data-2d"]], - "finish-background":[ + "finish-background": [ [249, "a0", "terrain-context"], [297, "a0", "terrain-context"], [307, "a0", "terrain-context"], @@ -3249,55 +2829,34 @@ [[598, 603], "v1", "dma-packet"] ], - "(method 11 drawable-inline-array-node)":[ - [[1, 6], "v1", "drawable"] - ], + "(method 11 drawable-inline-array-node)": [[[1, 6], "v1", "drawable"]], - "(method 12 drawable-inline-array-node)":[ - [[1, 6], "v1", "drawable"] - ], + "(method 12 drawable-inline-array-node)": [[[1, 6], "v1", "drawable"]], - "(method 13 drawable-inline-array-node)":[ - [[1, 6], "v1", "drawable"] - ], + "(method 13 drawable-inline-array-node)": [[[1, 6], "v1", "drawable"]], - "(method 17 drawable-inline-array-node)":[ - [[1, 6], "v1", "drawable"] - ], + "(method 17 drawable-inline-array-node)": [[[1, 6], "v1", "drawable"]], "(code nav-enemy-patrol babak)": [ [25, "v1", "art-joint-anim"], [79, "t9", "(function none)"] ], - "(code nav-enemy-chase babak)": [ - [55, "v1", "art-joint-anim"] - ], + "(code nav-enemy-chase babak)": [[55, "v1", "art-joint-anim"]], - "(code nav-enemy-stare babak)": [ - [154, "v1", "art-joint-anim"] - ], + "(code nav-enemy-stare babak)": [[154, "v1", "art-joint-anim"]], "(code nav-enemy-give-up babak)": [ [43, "v1", "art-joint-anim"], [101, "v1", "art-joint-anim"] ], - "(method 33 process-taskable)": [ - [15, "s5", "spool-anim"] - ], + "(method 33 process-taskable)": [[15, "s5", "spool-anim"]], - "(method 51 process-taskable)": [ - [18, "v1", "spool-anim"] - ], + "(method 51 process-taskable)": [[18, "v1", "spool-anim"]], - "(method 35 process-taskable)": [ - [15, "s5", "spool-anim"] - ] - , - "(method 37 process-taskable)": [ - [15, "s5", "spool-anim"] - ], + "(method 35 process-taskable)": [[15, "s5", "spool-anim"]], + "(method 37 process-taskable)": [[15, "s5", "spool-anim"]], "process-taskable-play-anim-code": [ [68, "gp", "spool-anim"], @@ -3314,29 +2873,17 @@ [24, "a0", "float"] ], - "(event othercam-running)": [ - [23, "v1", "process-taskable"] - ], + "(event othercam-running)": [[23, "v1", "process-taskable"]], - "(code nav-enemy-idle babak-with-cannon)": [ - [22, "v1", "art-joint-anim"] - ], + "(code nav-enemy-idle babak-with-cannon)": [[22, "v1", "art-joint-anim"]], - "(code babak-run-to-cannon)": [ - [14, "v1", "art-joint-anim"] - ], + "(code babak-run-to-cannon)": [[14, "v1", "art-joint-anim"]], - "(code babak-with-cannon-jump-onto-cannon)": [ - [118, "v1", "art-joint-anim"] - ], + "(code babak-with-cannon-jump-onto-cannon)": [[118, "v1", "art-joint-anim"]], - "(code babak-with-cannon-jump-off-cannon)": [ - [28, "v1", "art-joint-anim"] - ], + "(code babak-with-cannon-jump-off-cannon)": [[28, "v1", "art-joint-anim"]], - "(trans nav-enemy-die babak-with-cannon)": [ - [40, "v0", "(state nav-enemy)"] - ], + "(trans nav-enemy-die babak-with-cannon)": [[40, "v0", "(state nav-enemy)"]], "(enter othercam-running)": [ [50, "gp", "process-taskable"], @@ -3366,13 +2913,9 @@ [131, "v1", "art-joint-anim"] ], - "(code yakow-graze-kicked)": [ - [10, "v1", "art-joint-anim"] - ], + "(code yakow-graze-kicked)": [[10, "v1", "art-joint-anim"]], - "(code yakow-kicked)": [ - [81, "v1", "art-joint-anim"] - ], + "(code yakow-kicked)": [[81, "v1", "art-joint-anim"]], "(method 7 fishermans-boat)": [ [20, "t9", "(function rigid-body-platform int rigid-body-platform)"] @@ -3383,13 +2926,9 @@ [87, "v1", "art-joint-anim"] ], - "(code nav-enemy-chase muse)": [ - [35, "v1", "art-joint-anim"] - ], + "(code nav-enemy-chase muse)": [[35, "v1", "art-joint-anim"]], - "(code nav-enemy-jump-land muse)": [ - [31, "v1", "art-joint-anim"] - ], + "(code nav-enemy-jump-land muse)": [[31, "v1", "art-joint-anim"]], "(code muse-caught)": [ [50, "v0", "vector"], @@ -3414,13 +2953,9 @@ [334, "v1", "art-joint-anim"] ], - "(code nav-enemy-stare bonelurker)": [ - [130, "v1", "art-joint-anim"] - ], + "(code nav-enemy-stare bonelurker)": [[130, "v1", "art-joint-anim"]], - "(code bonelurker-stun)": [ - [29, "v1", "art-joint-anim"] - ], + "(code bonelurker-stun)": [[29, "v1", "art-joint-anim"]], "(code nav-enemy-give-up bonelurker)": [ [43, "v1", "art-joint-anim"], @@ -3442,13 +2977,9 @@ [53, "s5", "sage-bluehut"] ], - "(method 43 assistant-bluehut)": [ - [19, "v1", "float"] - ], + "(method 43 assistant-bluehut)": [[19, "v1", "float"]], - "check-drop-level-assistant-bluehut": [ - [17, "v1", "float"] - ], + "check-drop-level-assistant-bluehut": [[17, "v1", "float"]], "(code idle assistant-bluehut)": [ [31, "v1", "art-joint-anim"], @@ -3460,9 +2991,7 @@ [554, "v1", "art-joint-anim"] ], - "assistant-levitator-blue-beam": [ - [15, "v1", "fireboulder"] - ], + "assistant-levitator-blue-beam": [[15, "v1", "fireboulder"]], "(code idle assistant-levitator)": [ [32, "v1", "art-joint-anim"], @@ -3472,13 +3001,9 @@ [311, "v1", "art-joint-anim"] ], - "(event square-platform-lowered)": [ - [8, "a0", "square-platform-master"] - ], + "(event square-platform-lowered)": [[8, "a0", "square-platform-master"]], - "(event square-platform-master-idle)": [ - [6, "a0", "square-platform-button"] - ], + "(event square-platform-master-idle)": [[6, "a0", "square-platform-button"]], "(method 7 square-platform)": [ [24, "t9", "(function baseplat int baseplat)"] @@ -3503,9 +3028,7 @@ [27, "gp", "(pointer rigid-body-platform)"] ], - "(method 32 qbert-plat)": [ - [[4, 10], "a0", "qbert-plat-master"] - ], + "(method 32 qbert-plat)": [[[4, 10], "a0", "qbert-plat-master"]], "(post rigid-body-platform-float qbert-plat)": [ [3, "t9", "(function none :behavior qbert-plat)"] @@ -3538,9 +3061,7 @@ [9, "v1", "process-drawable"] ], - "keg-init-by-other": [ - [142, "v1", "process-drawable"] - ], + "keg-init-by-other": [[142, "v1", "process-drawable"]], "(method 7 keg-conveyor)": [ [14, "t9", "(function process-drawable int process-drawable)"] @@ -3550,9 +3071,7 @@ [26, "t9", "(function process-drawable int process-drawable)"] ], - "(code swamp-bat-slave-die)": [ - [21, "v1", "swamp-bat"] - ], + "(code swamp-bat-slave-die)": [[21, "v1", "swamp-bat"]], // these casts should not be required "swamp-bat-check-slave-paths-match?": [ @@ -3560,63 +3079,39 @@ [7, "a1", "swamp-bat-slave"] ], - "(method 39 swamp-rat)": [ - [37, "t9", "(function nav-enemy none)"] - ], + "(method 39 swamp-rat)": [[37, "t9", "(function nav-enemy none)"]], - "(code nav-enemy-patrol swamp-rat)": [ - [23, "v1", "art-joint-anim"] - ], + "(code nav-enemy-patrol swamp-rat)": [[23, "v1", "art-joint-anim"]], - "(code nav-enemy-stare swamp-rat)": [ - [26, "v1", "art-joint-anim"] - ], + "(code nav-enemy-stare swamp-rat)": [[26, "v1", "art-joint-anim"]], "(code nav-enemy-give-up swamp-rat)": [ [14, "v1", "art-joint-anim"], [72, "v1", "art-joint-anim"] ], - "(code nav-enemy-attack swamp-rat)": [ - [14, "v1", "art-joint-anim"] - ], + "(code nav-enemy-attack swamp-rat)": [[14, "v1", "art-joint-anim"]], - "(code swamp-rat-spawn)": [ - [119, "v1", "art-joint-anim"] - ], + "(code swamp-rat-spawn)": [[119, "v1", "art-joint-anim"]], - "(code spiderwebs-bounce)": [ - [80, "v1", "art-joint-anim"] - ], + "(code spiderwebs-bounce)": [[80, "v1", "art-joint-anim"]], - "(method 39 baby-spider)": [ - [37, "t9", "(function nav-enemy none)"] - ], + "(method 39 baby-spider)": [[37, "t9", "(function nav-enemy none)"]], - "(code baby-spider-hatching)": [ - [14, "v1", "art-joint-anim"] - ], + "(code baby-spider-hatching)": [[14, "v1", "art-joint-anim"]], - "(code nav-enemy-attack baby-spider)": [ - [14, "v1", "art-joint-anim"] - ], + "(code nav-enemy-attack baby-spider)": [[14, "v1", "art-joint-anim"]], "(code nav-enemy-give-up baby-spider)": [ [14, "v1", "art-joint-anim"], [72, "v1", "art-joint-anim"] ], - "(code nav-enemy-patrol baby-spider)": [ - [23, "v1", "art-joint-anim"] - ], + "(code nav-enemy-patrol baby-spider)": [[23, "v1", "art-joint-anim"]], - "(code nav-enemy-notice baby-spider)": [ - [24, "v1", "art-joint-anim"] - ], + "(code nav-enemy-notice baby-spider)": [[24, "v1", "art-joint-anim"]], - "(code nav-enemy-stare baby-spider)": [ - [26, "v1", "art-joint-anim"] - ], + "(code nav-enemy-stare baby-spider)": [[26, "v1", "art-joint-anim"]], "(method 24 mother-spider-proj)": [ [[11, 46], "s5", "sound-rpc-set-param"], @@ -3624,22 +3119,16 @@ [33, "s4", "process-drawable"] ], - "(method 23 exit-chamber)": [ - [107, "a1", "fuel-cell"] - ], + "(method 23 exit-chamber)": [[107, "a1", "fuel-cell"]], - "(code exit-chamber-rise)": [ - [15, "v1", "fuel-cell"] - ], + "(code exit-chamber-rise)": [[15, "v1", "fuel-cell"]], "(method 25 sunken-water)": [ [121, "v1", "uint"], [126, "v1", "uint"] ], - "(code sunkenfisha-idle)": [ - [10, "v1", "art-joint-anim"] - ], + "(code sunkenfisha-idle)": [[10, "v1", "art-joint-anim"]], "(method 27 sunkenfisha)": [ ["_stack_", 16, "res-tag"], @@ -3650,9 +3139,7 @@ [174, "v0", "(pointer float)"] ], - "(method 43 assistant-villagec)": [ - [19, "v1", "float"] - ], + "(method 43 assistant-villagec)": [[19, "v1", "float"]], "(code idle assistant-villagec)": [ [32, "v1", "art-joint-anim"], @@ -3660,13 +3147,9 @@ [176, "v1", "float"] ], - "(method 32 sage-villagec)": [ - [278, "v1", "float"] - ], + "(method 32 sage-villagec)": [[278, "v1", "float"]], - "(method 43 sage-villagec)": [ - [19, "v1", "float"] - ], + "(method 43 sage-villagec)": [[19, "v1", "float"]], "(method 20 cave-trap)": [ [77, "s2", "process-drawable"], @@ -3679,25 +3162,15 @@ [14, "t9", "(function process-drawable int process-drawable)"] ], - "(method 57 ice-cube)": [ - [16, "v1", "collide-shape-prim-sphere"] - ], + "(method 57 ice-cube)": [[16, "v1", "collide-shape-prim-sphere"]], - "(code yeti-slave-appear-jump-up)": [ - [14, "v1", "art-joint-anim"] - ], + "(code yeti-slave-appear-jump-up)": [[14, "v1", "art-joint-anim"]], - "(code yeti-slave-appear-land)": [ - [14, "v1", "art-joint-anim"] - ], + "(code yeti-slave-appear-land)": [[14, "v1", "art-joint-anim"]], - "(code nav-enemy-chase yeti-slave)": [ - [55, "v1", "art-joint-anim"] - ], + "(code nav-enemy-chase yeti-slave)": [[55, "v1", "art-joint-anim"]], - "(code nav-enemy-stare yeti-slave)": [ - [154, "v1", "art-joint-anim"] - ], + "(code nav-enemy-stare yeti-slave)": [[154, "v1", "art-joint-anim"]], "(code nav-enemy-give-up yeti-slave)": [ [43, "v1", "art-joint-anim"], @@ -3711,42 +3184,26 @@ [238, "v1", "art-joint-anim"] ], - "(method 7 yeti-slave)": [ - [14, "t9", "(function nav-enemy int nav-enemy)"] - ], + "(method 7 yeti-slave)": [[14, "t9", "(function nav-enemy int nav-enemy)"]], - "(method 21 yeti)": [ - [5, "s5", "(pointer yeti-slave)"] - ], + "(method 21 yeti)": [[5, "s5", "(pointer yeti-slave)"]], "(code idle assistant-lavatube-start)": [ [32, "v1", "float"], [118, "v1", "art-joint-anim"] ], - "check-drop-level-maincave-drip": [ - [17, "v1", "float"] - ], + "check-drop-level-maincave-drip": [[17, "v1", "float"]], - "snow-bird-bob-func": [ - [3, "v1", "process-drawable"] - ], + "snow-bird-bob-func": [[3, "v1", "process-drawable"]], - "bird-bob-func": [ - [3, "v1", "process-drawable"] - ], + "bird-bob-func": [[3, "v1", "process-drawable"]], - "part-tracker-track-root": [ - [2, "v1", "process-drawable"] - ], + "part-tracker-track-root": [[2, "v1", "process-drawable"]], - "sparticle-track-root-money": [ - [5, "v1", "process-drawable"] - ], + "sparticle-track-root-money": [[5, "v1", "process-drawable"]], - "eco-fadeout": [ - [2, "v1", "process-drawable"] - ], + "eco-fadeout": [[2, "v1", "process-drawable"]], "eco-track-root-prim-fadeout": [ [2, "v1", "process-drawable"], @@ -3754,21 +3211,13 @@ [11, "v1", "process-drawable"] ], - "check-drop-level-sagehut": [ - [18, "v1", "float"] - ], + "check-drop-level-sagehut": [[18, "v1", "float"]], - "check-drop-level-training-spout-rain": [ - [17, "v1", "float"] - ], + "check-drop-level-training-spout-rain": [[17, "v1", "float"]], - "check-drop-level-sagehut2": [ - [18, "v1", "float"] - ], + "check-drop-level-sagehut2": [[18, "v1", "float"]], - "tra-bird-bob-func": [ - [3, "v1", "process-drawable"] - ], + "tra-bird-bob-func": [[3, "v1", "process-drawable"]], "(anon-function 6 relocate)": [ [3, "a0", "int"], @@ -3815,9 +3264,7 @@ [15, "v1", "uint"] ], - "hide-bottom-hud": [ - [22, "v1", "(pointer hud)"] - ], + "hide-bottom-hud": [[22, "v1", "(pointer hud)"]], "disable-hud": [ [22, "a0", "(pointer hud)"], @@ -3825,29 +3272,17 @@ [57, "v1", "(pointer hud)"] ], - "enable-hud": [ - [20, "v1", "(pointer hud)"] - ], + "enable-hud": [[20, "v1", "(pointer hud)"]], - "hide-hud-quick": [ - [20, "v1", "(pointer hud)"] - ], + "hide-hud-quick": [[20, "v1", "(pointer hud)"]], - "set-hud-aspect-ratio": [ - [17, "v1", "(pointer hud)"] - ], + "set-hud-aspect-ratio": [[17, "v1", "(pointer hud)"]], - "hud-hidden?": [ - [14, "v1", "(pointer hud)"] - ], + "hud-hidden?": [[14, "v1", "(pointer hud)"]], - "bottom-hud-hidden?": [ - [16, "v1", "(pointer hud)"] - ], + "bottom-hud-hidden?": [[16, "v1", "(pointer hud)"]], - "show-hud": [ - [31, "v1", "(pointer hud)"] - ], + "show-hud": [[31, "v1", "(pointer hud)"]], "fuel-cell-hud-orbit-callback": [ [12, "s3", "hud-fuel-cell"], @@ -3864,13 +3299,9 @@ [52, "v1", "dma-packet"] ], - "(method 15 hud-money)": [ - [[50, 53], "v1", "dma-packet"] - ], + "(method 15 hud-money)": [[[50, 53], "v1", "dma-packet"]], - "(method 15 hud-money-all)": [ - [[125, 128], "v1", "dma-packet"] - ], + "(method 15 hud-money-all)": [[[125, 128], "v1", "dma-packet"]], "(method 15 hud-buzzers)": [ [58, "v1", "dma-packet"], @@ -3886,9 +3317,7 @@ [311, "v0", "sound-rpc-set-param"] ], - "battlecontroller-default-event-handler": [ - [9, "a0", "process-drawable"] - ], + "battlecontroller-default-event-handler": [[9, "a0", "process-drawable"]], "battlecontroller-update-spawners": [ [19, "s4", "nav-enemy"], @@ -3917,13 +3346,9 @@ [2, "v1", "(pointer process-drawable)"] ], - "update-time-of-day": [ - [46, "v0", "(array float)"] - ], + "update-time-of-day": [[46, "v0", "(array float)"]], - "sky-make-light": [ - [[10, 23], "a0", "sky-sun-data"] - ], + "sky-make-light": [[[10, 23], "a0", "sky-sun-data"]], "make-sky-textures": [ [[90, 94], "a0", "dma-packet"], @@ -4010,21 +3435,13 @@ [4, "t9", "(function none :behavior helix-dark-eco)"] ], - "(code helix-slide-door-close)": [ - [10, "v1", "art-joint-anim"] - ], + "(code helix-slide-door-close)": [[10, "v1", "art-joint-anim"]], - "(code helix-button-startup)": [ - [39, "v1", "process-drawable"] - ], + "(code helix-button-startup)": [[39, "v1", "process-drawable"]], - "(method 73 green-eco-lurker)": [ - [6, "a1", "touching-shapes-entry"] - ], + "(method 73 green-eco-lurker)": [[6, "a1", "touching-shapes-entry"]], - "citb-sagecage-update-collision": [ - [2, "a0", "collide-shape-prim-group"] - ], + "citb-sagecage-update-collision": [[2, "a0", "collide-shape-prim-group"]], "race-ring-set-particle-rotation-callback": [ [1, "v1", "(pointer race-ring)"] @@ -4042,9 +3459,7 @@ [272, "s5", "handle"] ], - "(trans race-ring-active)": [ - [26, "a0", "part-tracker"] - ], + "(trans race-ring-active)": [[26, "a0", "part-tracker"]], "(code anim-tester-process)": [ [41, "v1", "anim-test-obj"], @@ -4059,8 +3474,285 @@ [[423, 426], "v1", "dma-packet"] ], - "anim-tester-disp-frame-num": [ - [[75, 78], "v1", "dma-packet"] + "anim-tester-disp-frame-num": [[[75, 78], "v1", "dma-packet"]], + + "reset-drawable-tracking": [ + [3, "gp", "target"], + [10, "gp", "target"], + [14, "gp", "target"], + [42, "gp", "target"], + [48, "gp", "target"] + ], + "reset-drawable-follow": [ + [3, "v1", "target"], + [10, "v1", "target"], + [16, "v1", "target"] + ], + "master-track-target": [ + [62, "gp", "target"], + [65, "gp", "target"], + [96, "gp", "target"], + [103, "gp", "target"], + [423, "f0", "float"] + ], + + "master-switch-to-entity": [ + ["_stack_", 16, "res-tag"], + [88, "v0", "(pointer string)"], + [233, "v1", "camera-slave"] + ], + + "master-check-regions": [[119, "v1", "connection"]], + "(anon-function 71 cam-states)": [ + [13, "a1", "pov-camera"], + [20, "v1", "pov-camera"], + [41, "v1", "pov-camera"], + [52, "v1", "pov-camera"], + [71, "a1", "pov-camera"] + ], + "(anon-function 68 cam-states)": [[13, "a1", "pov-camera"]], + "(anon-function 75 cam-states)": [ + [13, "a1", "pov-camera"], + [21, "a0", "pov-camera"] + ], + + "(event cam-master-active)": [ + [95, "gp", "matrix"], + [184, "v1", "vector"], + [240, "v1", "target"], + [280, "v1", "target"], + [457, "v1", "camera-slave"], + [511, "v1", "camera-slave"], + [524, "v0", "camera-slave"], + [560, "a0", "camera-slave"], + [570, "v1", "camera-slave"], + [629, "v1", "camera-slave"], + [679, "a0", "camera-slave"], + [690, "v1", "camera-slave"], + [771, "v1", "camera-slave"], + [875, "v1", "camera-slave"], + [928, "v1", "camera-slave"], + [947, "v1", "camera-slave"], + [966, "v1", "camera-slave"], + [994, "v1", "camera-slave"], + [999, "a0", "camera-slave"], + [1011, "a0", "camera-slave"], + [1023, "v1", "projectile"], + [1033, "a0", "camera-slave"], + [1071, "a0", "vector"], + [1371, "v1", "float"] + ], + + "(code cam-pov)": [ + [13, "a1", "pov-camera"], + [21, "a0", "pov-camera"] + ], + + "(code cam-pov-track)": [[13, "a1", "pov-camera"]], + + "(code cam-pov180)": [ + [13, "a1", "pov-camera"], + [20, "v1", "pov-camera"], + [41, "v1", "pov-camera"], + [52, "v1", "pov-camera"], + [71, "a1", "pov-camera"] + ], + + "cam-los-spline-collide": [ + [[52, 83], "s3", "(inline-array collide-cache-tri)"] + ], + + "(event cam-string)": [ + [15, "v1", "float"], + [18, "v1", "float"], + [31, "a0", "vector"], + [35, "a0", "vector"] + ], + + "cam-draw-collide-cache": [ + [[2, 13], "gp", "(inline-array collide-cache-tri)"] + ], + + "cam-los-collide": [[[50, 197], "s1", "(inline-array collide-cache-tri)"]], + + "(anon-function 1 pov-camera)": [ + [9, "v1", "float"], + [16, "v1", "float"] + ], + + "camera-fov-frame": [ + [87, "a0", "vector"], + [128, "a0", "vector"], + [169, "a0", "vector"] + ], + + "camera-sphere": [[[39, 46], "v1", "cam-dbg-scratch"]], + + "camera-line-draw": [ + [34, "a0", "cam-dbg-scratch"], + [42, "a0", "cam-dbg-scratch"] + ], + + "camera-plot-float-func": [ + [54, "v1", "cam-dbg-scratch"], + [62, "a0", "cam-dbg-scratch"], + [66, "a0", "cam-dbg-scratch"], + [103, "v1", "cam-dbg-scratch"], + [240, "v1", "cam-dbg-scratch"] + ], + + "cam-line-dma": [ + [32, "t0", "vector"], + [36, "t0", "vector"], + [45, "t0", "vector"], + [50, "t0", "vector"], + [[12, 16], "a3", "dma-packet"], + [[22, 25], "a3", "gs-gif-tag"], + [[33, 38], "a3", "(pointer uint128)"], + [[46, 52], "a1", "(pointer uint128)"], + [[60, 65], "a0", "dma-packet"], + [[65, 74], "a0", "(pointer uint64)"], + [[77, 80], "a0", "dma-packet"] + ], + + "v-slrp!": [ + [19, "v1", "(pointer float)"], + [26, "v1", "(pointer float)"] + ], + + "clmf-pos-rot": [ + [60, "a1", "int"], + [70, "a2", "symbol"], + [71, "a1", "res-tag"], + [132, "a0", "int"], + [141, "s0", "res-tag"] + ], + + "clmf-next-entity": [[38, "a0", "connection"]], + + "cam-layout-init": [[10, "v1", "connection"]], + + "clmf-save-all": [[18, "v1", "connection"]], + + "cam-layout-save-cam-rot": [[14, "v0", "vector"]], + + "cam-layout-save-campointsoffset": [[13, "v0", "vector"]], + + "cam-layout-entity-info": [ + [205, "v1", "vector"], + [495, "v1", "vector"] + ], + + "cam-layout-save-pivot": [ + [14, "v0", "vector"], + [40, "v0", "vector"] + ], + + "cam-layout-save-interesting": [ + [14, "v0", "vector"], + [40, "v0", "vector"] + ], + + "cam-layout-save-align": [ + [14, "v0", "vector"], + [40, "v0", "vector"] + ], + + "cam-layout-save-splineoffset": [[40, "v0", "vector"]], + + "cam-layout-save-cam-trans": [ + [65, "s5", "vector"], + [67, "s5", "vector"], + [69, "s5", "vector"], + [75, "s5", "vector"], + [77, "s2", "vector"], + [82, "s2", "vector"], + [84, "s2", "vector"], + [86, "s2", "vector"], + [92, "s2", "vector"], + [94, "s5", "vector"], + [95, "s5", "vector"], + [96, "s2", "vector"], + [97, "s2", "vector"], + [110, "s5", "vector"], + [113, "s5", "vector"], + [115, "s5", "vector"], + [117, "s5", "vector"] + ], + + "clmf-cam-flag-toggle": [ + [119, "a0", "int"], + [124, "v1", "int"], + [138, "v0", "int"], + [153, "a0", "int"], + [158, "v1", "int"], + [172, "v0", "int"], + [195, "a0", "int"], + [200, "v1", "int"], + [214, "v0", "int"], + [233, "a0", "int"], + [238, "v1", "int"], + [252, "v0", "int"] + ], + + "clmf-cam-float-adjust": [[49, "a1", "int"]], + + "cam-layout-do-action": [ + [66, "s5", "basic"], + [74, "s5", "basic"], + [80, "s5", "(function object symbol symbol)"] + ], + + "cam-layout-function-call": [ + [11, "gp", "basic"], + [15, "gp", "(function string int basic none)"] + ], + + "cam-layout-do-menu": [ + [[130, 176], "s3", "clm-list"], + [203, "a0", "clm-item"], + [213, "v1", "clm-item"], + [228, "s3", "clm-item"], + [233, "v1", "clm-item"], + [238, "s3", "clm-item"], + [275, "s4", "clm-list"], + [277, "s4", "clm-list"], + [279, "s4", "clm-list"], + [283, "s4", "clm-list"], + [289, "s4", "clm-list"], + [291, "s4", "clm-list"], + [303, "s4", "clm-list"], + [305, "s4", "clm-list"], + [345, "s4", "clm-list"], + [347, "s4", "clm-list"], + [350, "s4", "clm-list"], + [352, "s4", "clm-list"], + [353, "s4", "clm-list"], + [356, "s4", "clm-list"], + [357, "s4", "clm-list"], + [369, "v1", "clm-item"] + ], + + "cam-layout-print": [[[21, 24], "v1", "dma-packet"]], + + "cam-layout-entity-volume-info": [ + [58, "s4", "vector"], + [59, "s4", "vector"], + [61, "s4", "(inline-array plane-volume)"] + ], + + "cam-layout-entity-volume-info-create": [ + ["_stack_", 16, "res-tag"], + [16, "v0", "(inline-array vector)"] + ], + + "clmf-cam-string": [["_stack_", 16, "res-tag"]], + + "in-cam-entity-volume?": [ + ["_stack_", 16, "res-tag"], + [22, "v1", "(inline-array vector)"], + [29, "v1", "(inline-array vector)"], + [34, "v1", "(inline-array vector)"] ], "fisher-fish-move": [ @@ -4074,9 +3766,7 @@ [79, "v1", "fisher"] ], - "(code fisher-fish-caught)": [ - [169, "v1", "fisher"] - ], + "(code fisher-fish-caught)": [[169, "v1", "fisher"]], "(code fisher-fish-die)": [ [35, "v1", "fisher"], @@ -4096,9 +3786,7 @@ [79, "v1", "float"] ], - "(method 38 fisher)": [ - [33, "t9", "(function fisher none)"] - ], + "(method 38 fisher)": [[33, "t9", "(function fisher none)"]], "(enter fisher-done)": [ [137, "f0", "float"], @@ -4106,22 +3794,16 @@ [213, "f0", "float"] ], - "fisher-spawn-ambient": [ - [8, "v1", "float"] - ], + "fisher-spawn-ambient": [[8, "v1", "float"]], "(method 43 fisher)": [ [27, "v1", "float"], [69, "v1", "float"] ], - "(trans play-accept fisher)": [ - [101, "v0", "state"] - ], + "(trans play-accept fisher)": [[101, "v0", "state"]], - "(trans idle fisher)": [ - [4, "v0", "state"] - ], + "(trans idle fisher)": [[4, "v0", "state"]], "(code idle fisher)": [ [132, "v1", "art-joint-anim"], @@ -4133,9 +3815,7 @@ [290, "v1", "art-joint-anim"] ], - "(method 11 torus)": [ - [[5, 22], "s4", "collide-shape-prim-group"] - ], + "(method 11 torus)": [[[5, 22], "s4", "collide-shape-prim-group"]], "(method 12 torus)": [ [11, "v1", "float"], @@ -4147,55 +3827,35 @@ [75, "v1", "art-joint-anim"] ], - "(code darkecobomb-land)": [ - [36, "v1", "art-joint-anim"] - ], + "(code darkecobomb-land)": [[36, "v1", "art-joint-anim"]], "(code darkecobomb-idle)": [ [10, "v1", "art-joint-anim"], [60, "v1", "art-joint-anim"] ], - "redshot-particle-callback": [ - [2, "v1", "(pointer redshot)"] - ], + "redshot-particle-callback": [[2, "v1", "(pointer redshot)"]], - "(event cam-robotboss)": [ - [5, "v1", "vector"] - ], + "(event cam-robotboss)": [[5, "v1", "vector"]], - "ecoclaw-handler": [ - [73, "v1", "vector"] - ], + "ecoclaw-handler": [[73, "v1", "vector"]], - "(event idle silodoor)": [ - [4, "v1", "float"] - ], + "(event idle silodoor)": [[4, "v1", "float"]], "ecoclaw-beam-particle-callback": [ [1, "a0", "(pointer projectile)"], [3, "a0", "(pointer projectile)"] ], - "(method 32 finalbosscam)": [ - [156, "v1", "robotboss"] - ], + "(method 32 finalbosscam)": [[156, "v1", "robotboss"]], - "(trans ecoclaw-activate)": [ - [30, "a0", "part-tracker"] - ], + "(trans ecoclaw-activate)": [[30, "a0", "part-tracker"]], - "robotboss-position": [ - [109, "a0", "process-drawable"] - ], + "robotboss-position": [[109, "a0", "process-drawable"]], - "robotboss-bomb-handler": [ - [6, "v1", "float"] - ], + "robotboss-bomb-handler": [[6, "v1", "float"]], - "robotboss-handler": [ - [6, "v1", "float"] - ], + "robotboss-handler": [[6, "v1", "float"]], "(event robotboss-red-wait)": [ [12, "v1", "float"], @@ -4207,9 +3867,7 @@ [68, "v1", "float"] ], - "(code robotboss-white-eco-movie)": [ - [[188, 215], "gp", "handle"] - ], + "(code robotboss-white-eco-movie)": [[[188, 215], "gp", "handle"]], "(code robotboss-yellow-wait)": [ [336, "v1", "float"], @@ -4262,13 +3920,9 @@ [137, "v1", "float"] ], - "(trans robotboss-blue-wait)": [ - [254, "v1", "float"] - ], + "(trans robotboss-blue-wait)": [[254, "v1", "float"]], - "(code robotboss-blue-wait)": [ - [14, "v1", "art-joint-anim"] - ], + "(code robotboss-blue-wait)": [[14, "v1", "art-joint-anim"]], "(enter green-eco-lurker-appear)": [ [12, "v1", "robotboss"], @@ -4280,17 +3934,11 @@ [93, "v1", "art-joint-anim"] ], - "(code green-eco-lurker-appear-land)": [ - [74, "v1", "art-joint-anim"] - ], + "(code green-eco-lurker-appear-land)": [[74, "v1", "art-joint-anim"]], - "(code nav-enemy-chase green-eco-lurker)": [ - [55, "v1", "art-joint-anim"] - ], + "(code nav-enemy-chase green-eco-lurker)": [[55, "v1", "art-joint-anim"]], - "(code nav-enemy-patrol green-eco-lurker)": [ - [8, "t9", "(function none)"] - ], + "(code nav-enemy-patrol green-eco-lurker)": [[8, "t9", "(function none)"]], "(trans light-eco-child-hit-ground)": [ [63, "v1", "light-eco-mother"], @@ -4298,13 +3946,9 @@ [88, "a1", "light-eco-mother"] ], - "(event plat-path-active plat-eco-finalboss)": [ - [10, "v1", "float"] - ], + "(event plat-path-active plat-eco-finalboss)": [[10, "v1", "float"]], - "(method 45 sage-finalboss)": [ - [[40, 57], "s5", "manipy"] - ], + "(method 45 sage-finalboss)": [[[40, 57], "s5", "manipy"]], "(method 32 sage-finalboss)": [ [[241, 245], "v1", "manipy"], @@ -4327,9 +3971,7 @@ [10, "v1", "(inline-array sage-finalboss-particle)"] ], - "(trans fisher-done)": [ - [[41, 46], "v1", "dma-packet"] - ], + "(trans fisher-done)": [[[41, 46], "v1", "dma-packet"]], "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 d596aec4f4..3294d1f560 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -3128,225 +3128,241 @@ }, "add-debug-outline-triangle": { - "args":["enable", "bucket", "p0", "p1", "p2", "color"] + "args": ["enable", "bucket", "p0", "p1", "p2", "color"] }, "unpack-comp-rle": { - "args":["out", "in"], - "vars":{ - "v1-2":"current-input", - "a2-0":"repeated-value", - "v1-3":"copy-length", - "a2-1":"src-val" + "args": ["out", "in"], + "vars": { + "v1-2": "current-input", + "a2-0": "repeated-value", + "v1-3": "copy-length", + "a2-1": "src-val" } }, "(method 16 level)": { - "args":["obj", "vis-info"], - "vars":{ - "a0-1":"cam-leaf-idx", - "v1-1":"curr-vis-str", - "s4-0":"desired-vis-str", - "s4-1":"vis-buffer", - "s3-1":"vis-load-result", - "v1-28":"dest-bits", - "a1-3":"len", - "a0-19":"bsp-bits", - "a1-5":"len-qw", - "s2-0":"lower-flag-bits", - "s1-0":"spad-start", - "s0-0":"spad-end", - "s3-2":"list-len", - "v1-49":"list-qwc", - "v0-1":"result" + "args": ["obj", "vis-info"], + "vars": { + "a0-1": "cam-leaf-idx", + "v1-1": "curr-vis-str", + "s4-0": "desired-vis-str", + "s4-1": "vis-buffer", + "s3-1": "vis-load-result", + "v1-28": "dest-bits", + "a1-3": "len", + "a0-19": "bsp-bits", + "a1-5": "len-qw", + "s2-0": "lower-flag-bits", + "s1-0": "spad-start", + "s0-0": "spad-end", + "s3-2": "list-len", + "v1-49": "list-qwc", + "v0-1": "result" } }, "(method 9 merc-fragment)": { - "vars":{ - "s5-0":"fp-data", - "s4-0":"eye-ctrl", - "s3-0":"shader", - "v1-7":"eye-tex-block", - "v1-34":"eye-tex-block-2", - "v1-57":"tex", - "a0-36":"seg" + "vars": { + "s5-0": "fp-data", + "s4-0": "eye-ctrl", + "s3-0": "shader", + "v1-7": "eye-tex-block", + "v1-34": "eye-tex-block-2", + "v1-57": "tex", + "a0-36": "seg" } }, "(method 9 merc-effect)": { - "vars":{ - "v1-0":"data", - "v1-1":"tex", - "a0-8":"seg", - "s3-0":"frag-idx", - "s2-0":"ctrl-size", - "s1-0":"geo-size", - "s4-0":["geo", "merc-fragment"], - "s5-0":["ctrl", "merc-fragment-control"] + "vars": { + "v1-0": "data", + "v1-1": "tex", + "a0-8": "seg", + "s3-0": "frag-idx", + "s2-0": "ctrl-size", + "s1-0": "geo-size", + "s4-0": ["geo", "merc-fragment"], + "s5-0": ["ctrl", "merc-fragment-control"] } }, "merc-vu1-add-vu-function": { - "args":["dma", "func", "flush-mode"], + "args": ["dma", "func", "flush-mode"], "vars": { - "v1-0":"func-data", - "a3-0":"qwc", - "a1-1":"dst", - "t0-1":"qwc-this-time" + "v1-0": "func-data", + "a3-0": "qwc", + "a1-1": "dst", + "t0-1": "qwc-this-time" } }, "(method 8 merc-ctrl)": { "vars": { - "s4-0":"ctrl-mem", - "s3-0":"effect-idx", - "s2-0":["fctrl", "merc-fragment-control"], - "s1-0":"frag-idx", - "v1-35":"effect-mem", - "a0-15":"effect-idx2", - "a1-9":["bctrl", "merc-blend-ctrl"], - "a2-1":"blend-frag-idx" + "s4-0": "ctrl-mem", + "s3-0": "effect-idx", + "s2-0": ["fctrl", "merc-fragment-control"], + "s1-0": "frag-idx", + "v1-35": "effect-mem", + "a0-15": "effect-idx2", + "a1-9": ["bctrl", "merc-blend-ctrl"], + "a2-1": "blend-frag-idx" } }, "(method 9 merc-ctrl)": { - "vars":{ - "v1-3":"seg", - "s5-0":"effect-idx", - "a0-4":"idx-with-bit1", - "a0-7":"this-effect", - "a1-5":"last-effect", - "a2-6":"copy-idx" + "vars": { + "v1-3": "seg", + "s5-0": "effect-idx", + "a0-4": "idx-with-bit1", + "a0-7": "this-effect", + "a1-5": "last-effect", + "a2-6": "copy-idx" } }, "merc-vu1-init-buffer": { - "args":["dma-bucket", "test"], + "args": ["dma-bucket", "test"], "vars": { - "gp-0":"bucket", - "s4-0":"dma-buf" + "gp-0": "bucket", + "s4-0": "dma-buf" } }, "(method 9 screen-filter)": { "vars": { - "v1-4":["v1-4", "dma-packet"], - "s5-0":"buf" + "v1-4": ["v1-4", "dma-packet"], + "s5-0": "buf" } }, "(method 11 fact-info-target)": { - "args":["obj", "kind", "amount", "source-handle"], - "vars":{"f0-29":"buzz-count","f30-0":"eco-lev"} + "args": ["obj", "kind", "amount", "source-handle"], + "vars": { "f0-29": "buzz-count", "f30-0": "eco-lev" } }, "auto-save-init-by-other": { - "args":["desired-mode", "notify-proc", "card-idx", "file-idx"] + "args": ["desired-mode", "notify-proc", "card-idx", "file-idx"] }, "debug-menu-item-var-make-int": { - "args":["item", "callback", "inc", "has-range", "range-min", "range-max", "hex"] + "args": [ + "item", + "callback", + "inc", + "has-range", + "range-min", + "range-max", + "hex" + ] }, "debug-menu-item-var-make-float": { - "args":["item", "callback", "inc", "has-range", "range-min", "range-max", "precision"] + "args": [ + "item", + "callback", + "inc", + "has-range", + "range-min", + "range-max", + "precision" + ] }, "(method 0 debug-menu-item-var)": { - "args":["allocation", "type-to-make", "name", "id", "max-width"] + "args": ["allocation", "type-to-make", "name", "id", "max-width"] }, "debug-menu-context-grab-joypad": { - "args":["menu", "callback-arg", "callback-func"] + "args": ["menu", "callback-arg", "callback-func"] }, "debug-menu-context-default-selection": { "args": ["ctxt", "keep-current"], "vars": { - "s5-0":"menu", - "s4-0":"currently-active" + "s5-0": "menu", + "s4-0": "currently-active" } }, "debug-menu-rebuild": { - "args":["menu"], + "args": ["menu"], "vars": { - "s4-0":"max-width", - "s5-0":"entry-count", - "s3-0":"iter", - "a0-1":"current-item" + "s4-0": "max-width", + "s5-0": "entry-count", + "s3-0": "iter", + "a0-1": "current-item" } }, - "debug-menu-context-set-root-menu":{ - "args":["context", "menu"], - "vars":{ - "s4-0":"active" + "debug-menu-context-set-root-menu": { + "args": ["context", "menu"], + "vars": { + "s4-0": "active" } }, "debug-menu-append-item": { - "args":["menu", "item"], + "args": ["menu", "item"], "vars": { - "gp-0":"context", - "s4-0":"was-active" + "gp-0": "context", + "s4-0": "was-active" } }, "(anon-function 82 default-menu)": { - "vars":{"s4-0":["s4-0", "texture-id"]} + "vars": { "s4-0": ["s4-0", "texture-id"] } }, "process-status-bits": { - "vars":{"s3-0":["proc-draw", "process-drawable"]} + "vars": { "s3-0": ["proc-draw", "process-drawable"] } }, - "(method 29 entity-actor)":{ - "args":["obj", "mode", "expected-type"] + "(method 29 entity-actor)": { + "args": ["obj", "mode", "expected-type"] }, - "(method 13 level-group)":{ - "args":["obj", "mode", "expected-type"] + "(method 13 level-group)": { + "args": ["obj", "mode", "expected-type"] }, "(method 24 entity)": { - "args":["obj", "lev-group", "lev", "aid"], - "vars":{ - "v1-4":"level-link", - "t0-5":"other-prev", - "t1-1":"other-front" + "args": ["obj", "lev-group", "lev", "aid"], + "vars": { + "v1-4": "level-link", + "t0-5": "other-prev", + "t1-1": "other-front" } }, "update-actor-vis-box": { - "args":["proc", "min-pt", "max-pt"], - "vars":{"v1-4":"world-bounds-origin", "f0-0":"radius"} + "args": ["proc", "min-pt", "max-pt"], + "vars": { "v1-4": "world-bounds-origin", "f0-0": "radius" } }, "init-entity": { - "args":["proc", "ent"] + "args": ["proc", "ent"] }, "(method 22 entity-actor)": { - "vars":{ - "s5-0":"entity-type", - "v1-0":"info", - "s4-0":"entity-process" + "vars": { + "s5-0": "entity-type", + "v1-0": "info", + "s4-0": "entity-process" } }, "(method 18 bsp-header)": { - "vars":{ - "a2-0":"existing-actor-count", - "s4-0":"birth-idx", - "a0-4":"idx-to-birth", - "v1-25":"actor-to-birth", - "a2-5":"existing-amb-count", - "s4-1":"amb-array", - "s3-0":"bsp-ambs", - "a0-10":"amb-to-birth", - "s4-2":"cams" + "vars": { + "a2-0": "existing-actor-count", + "s4-0": "birth-idx", + "a0-4": "idx-to-birth", + "v1-25": "actor-to-birth", + "a2-5": "existing-amb-count", + "s4-1": "amb-array", + "s3-0": "bsp-ambs", + "a0-10": "amb-to-birth", + "s4-2": "cams" } }, @@ -3401,12 +3417,12 @@ "calculate-completion": { "args": ["the-progress"], "vars": { - "sv-40":"total-cells", - "sv-48":"total-buzzers", - "sv-56":"total-orbs", - "sv-16":"current-cells", - "sv-24":"current-buzzers", - "sv-32":"current-orbs" + "sv-40": "total-cells", + "sv-48": "total-buzzers", + "sv-56": "total-orbs", + "sv-16": "current-cells", + "sv-24": "current-buzzers", + "sv-32": "current-orbs" } }, @@ -3461,6 +3477,37 @@ } }, + "master-track-target": { + "vars": { + "v0-1": ["v0-1", "symbol"], + "v1-14": ["v1-14", "handle"] + } + }, + + "cam-los-spline-collide": { + "vars": { + "s3-0": ["s3-0", "(inline-array collide-cache-tri)"] + } + }, + + "cam-draw-collide-cache": { + "vars": { + "gp-0": ["gp-0", "(inline-array collide-cache-tri)"] + } + }, + + "cam-los-collide": { + "vars": { + "s1-1": ["s1-1", "(inline-array collide-cache-tri)"] + } + }, + + "(event cam-master-active)": { + "vars": { + // "v0-0": ["v0-0", "symbol"] + } + }, + "(code plunger-lurker-plunge)": { "vars": { "gp-1": ["gp-1", "handle"], @@ -3512,10 +3559,10 @@ "upload-vis-bits": { "vars": { - "v1-2":"qwc", - "a0-1":["lev-vis-bits", "(pointer uint128)"], - "a1-1":["all-vis", "(pointer uint128)"], - "a2-2":["spad-vis", "(pointer uint128)"] + "v1-2": "qwc", + "a0-1": ["lev-vis-bits", "(pointer uint128)"], + "a1-1": ["all-vis", "(pointer uint128)"], + "a2-2": ["spad-vis", "(pointer uint128)"] } }, @@ -3531,8 +3578,8 @@ } }, - "(method 9 load-dir-art-group)":{ - "args":["obj", "art-name", "do-reload", "heap", "version"] + "(method 9 load-dir-art-group)": { + "args": ["obj", "art-name", "do-reload", "heap", "version"] }, "(method 15 hud-money)": { diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 302db31f5f..2bd555604e 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -509,8 +509,9 @@ goos::Object decompile_structure(const TypeSpec& type, // want to get the specific function/string/etc implementations. return decompile_at_label(actual_type, label, labels, words, ts, file); } else { - throw std::runtime_error(fmt::format("Basic has the wrong type pointer, got {} expected {}", - word.symbol_name, actual_type.base_type())); + throw std::runtime_error( + fmt::format("Basic has the wrong type pointer, got {} expected {} at label {}:{}", + word.symbol_name, actual_type.base_type(), label.name, label.offset)); } } } diff --git a/goal_src/engine/camera/cam-debug-h.gc b/goal_src/engine/camera/cam-debug-h.gc index 24a33bc67c..5d07b7fd7c 100644 --- a/goal_src/engine/camera/cam-debug-h.gc +++ b/goal_src/engine/camera/cam-debug-h.gc @@ -5,6 +5,33 @@ ;; name in dgo: cam-debug-h ;; dgos: GAME, ENGINE +;; TODO - for cam-layout +(define-extern camera-line-setup (function vector none)) +(define-extern camera-line-draw (function vector vector symbol)) +(define-extern camera-line (function vector vector vector4w none)) +(define-extern camera-cross (function vector vector vector vector float basic)) +(define-extern camera-fov-frame (function matrix vector float float float vector none)) +(define-extern cam-slave-options->string (function uint string string)) +(define-extern cam-index-options->string (function uint string string)) +(define-extern debug-set-camera-pos-rot! (function vector matrix vector)) +(define-extern camera-slave-debug (function camera-slave object object object object)) ;; passed to engine::method-15 +;; TODO - for cam-states +(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none)) +(define-extern cam-collision-record-save (function vector vector int basic camera-slave none)) +(define-extern slave-los-state->string (function uint string)) ;; uint comes from 2244 camera-slave +(define-extern cam-debug-reset-coll-tri (function none)) ;; not confirmed + +(declare-type clm basic) +(define-extern *clm* clm) ;; unknown type +(define-extern *clm-edit* clm) +(define-extern *clm-focalpull-attr* clm) ;; unknown type +(define-extern *clm-index-attr* clm) ;; unknown type +(define-extern *clm-intro-attr* clm) ;; unknown type +(define-extern *clm-spline-attr* clm) ;; unknown type +(define-extern *clm-vol-attr* clm) ;; unknown type +(define-extern *clm-select* clm) ;; unknown type + +;; decomp begins ;; this file is debug only (when *debug-segment* @@ -97,8 +124,4 @@ ) (define-perm *cam-layout* symbol #f) - - (defun-extern debug-set-camera-pos-rot! vector matrix int) ) - -(define-extern camera-line (function vector vector vector none)) diff --git a/goal_src/engine/camera/cam-layout.gc b/goal_src/engine/camera/cam-layout.gc index d72ea04f3b..35664398de 100644 --- a/goal_src/engine/camera/cam-layout.gc +++ b/goal_src/engine/camera/cam-layout.gc @@ -5,3 +5,5147 @@ ;; name in dgo: cam-layout ;; dgos: GAME, ENGINE +;; DECOMP BEGINS + +;; this file is debug only +(when *debug-segment* +(define *camera-layout-blink* #f) + +(deftype cam-layout-bank (basic) + ((spline-t float :offset-assert 4) + (spline-step float :offset-assert 8) + (intro-t float :offset-assert 12) + (intro-step float :offset-assert 16) + (debug-t float :offset-assert 20) + (debug-step float :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + + +(define + *CAM_LAYOUT-bank* + (new 'static 'cam-layout-bank + :spline-t 0.01 + :spline-step 0.0016666667 + :intro-t 0.01 + :intro-step 0.0016666667 + :debug-t 0.01 + :debug-step 0.0033333334 + ) + ) + +(define *camera-layout-message-ypos* 30) + +(deftype clm-basic (basic) + () + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + + +(deftype clm-item-action (structure) + ((button uint64 :offset-assert 0) + (options uint64 :offset-assert 8) + (func symbol :offset-assert 16) + (parm0 int32 :offset 20) + (parm0-basic basic :offset 20) + (parm1-basic basic :offset 24) + (parm1 symbol :offset 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + + +(deftype clm-item (clm-basic) + ((description string :offset-assert 4) + (button-symbol symbol :offset-assert 8) + (action clm-item-action :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x2c + :flag-assert #x90000002c + ) + + +(deftype clm-list-item (basic) + ((description string :offset-assert 4) + (track-val symbol :offset-assert 8) + (val-func symbol :offset-assert 12) + (val-parm0 int32 :offset 16) + (val-parm0-basic basic :offset 16) + (val-parm1-basic basic :offset 20) + (val-parm1 symbol :offset 20) + (actions (array clm-item-action) :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + + +(deftype clm-list (clm-basic) + ((tracker symbol :offset-assert 4) + (cur-list-item int32 :offset-assert 8) + (items (array clm-list-item) :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + + +(deftype clm (basic) + ((title string :offset-assert 4) + (items (array clm-basic) :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(define *volume-point-current* 0) + +(define *volume-point* (new 'debug 'vector-array 1000)) + +(define *volume-normal-current* 0) + +(define *volume-normal* (new 'debug 'vector-array 600)) + +(deftype volume-descriptor-array (inline-array-class) + ((data plane-volume :inline :dynamic :offset 16) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + + +(set! (-> volume-descriptor-array heap-base) (the-as uint 24)) + +(define *volume-descriptor-current* 0) + +(define + *volume-descriptor* + (the-as vol-control (new 'debug 'volume-descriptor-array 100)) + ) + +(deftype cam-layout (process) + ((cam-entity entity-camera :offset-assert 112) + (num-entities int32 :offset-assert 116) + (cur-entity int32 :offset-assert 120) + (num-volumes int32 :offset-assert 124) + (cur-volume int32 :offset-assert 128) + (first-pvol int32 :offset-assert 132) + (first-cutoutvol int32 :offset-assert 136) + (res-key float :offset-assert 140) + ) + :heap-base #x200 + :method-count-assert 14 + :size-assert #x90 + :flag-assert #xe02000090 + ) + + +(defun cam-layout-print ((arg0 int) (arg1 int) (arg2 string)) + (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (gp-0 (-> s5-0 base)) + ) + (draw-string-xy + arg2 + s5-0 + arg0 + arg1 + (font-color white) + (font-flags shadow kerning) + ) + (let ((a3-4 (-> s5-0 base))) + (let ((v1-4 (the-as object (-> s5-0 base)))) + (set! + (-> (the-as dma-packet v1-4) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-4) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-4) vif1) (new 'static 'vif-tag)) + (set! (-> s5-0 base) (&+ (the-as pointer v1-4) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + gp-0 + (the-as (pointer dma-tag) a3-4) + ) + ) + ) + ) + +(defun cam-layout-intersect-dist ((arg0 vector) (arg1 vector) (arg2 vector)) + (let ((f0-1 (vector-dot arg1 arg0)) + (f1-1 (vector-dot arg2 arg0)) + ) + (the-as float (if (< 0.00001 (fabs f1-1)) + (/ (- (-> arg0 w) f0-1) f1-1) + 409600000.0 + ) + ) + ) + ) + +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +(defbehavior + cam-layout-entity-volume-info-create cam-layout + ((arg0 entity-camera) (arg1 symbol)) + (local-vars + (sv-16 res-tag) + (sv-160 vector) + (sv-164 float) + (sv-168 int) + (sv-176 vector) + (sv-192 vector) + (sv-208 vector) + (sv-224 vector) + (sv-240 vector) + (sv-256 int) + (sv-272 int) + (sv-288 int) + ) + (let ((s4-0 0)) + (while #t + (set! sv-16 (new 'static 'res-tag)) + (let + ((s3-0 + (the-as + (inline-array vector) + ((method-of-type res-lump get-property-data) + arg0 + arg1 + 'exact + (the float s4-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (cond + (s3-0 + (when (>= *volume-descriptor-current* 100) + (format 0 "ERROR : camera editing out of volume descriptors~%") + (return #f) + ) + (let + ((s2-0 (-> *volume-descriptor* pos-vol *volume-descriptor-current*))) + (set! (-> s2-0 volume-type) arg1) + (set! (-> s2-0 point-count) 0) + (set! + (-> s2-0 first-point) + (-> *volume-point* data *volume-point-current*) + ) + (set! (-> s2-0 normal-count) 0) + (set! + (-> s2-0 first-normal) + (-> *volume-normal* data *volume-normal-current*) + ) + (set! *volume-descriptor-current* (+ *volume-descriptor-current* 1)) + (+! (-> self num-volumes) 1) + (dotimes (s1-0 (the-as int (-> sv-16 elt-count))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (set! (-> sv-192 quad) (the-as uint128 0)) + (set! sv-208 (new 'stack-no-clear 'vector)) + (set! (-> sv-208 quad) (the-as uint128 0)) + (set! sv-224 (new 'stack-no-clear 'vector)) + (set! (-> sv-224 quad) (the-as uint128 0)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (set! (-> sv-240 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s0-0 (new-stack-vector0))) + (set! sv-256 0) + (set! sv-272 0) + (while (< sv-272 (the-as int (-> sv-16 elt-count))) + (when (!= s1-0 sv-272) + (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) + (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) + (vector-normalize! sv-208 (-> (new 'static 'array float 1 1.0) 0)) + (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) + (vector-normalize! sv-224 (-> (new 'static 'array float 1 1.0) 0)) + (let + ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) + (when (!= f0-6 409600000.0) + (vector+float*! sv-240 sv-192 sv-224 f0-6) + (set! sv-160 (new-stack-vector0)) + (set! sv-164 0.0) + (set! sv-168 0) + (set! sv-176 (new-stack-vector0)) + (set! (-> sv-160 quad) (-> sv-240 quad)) + (set! sv-288 0) + (while (< sv-288 (the-as int (-> sv-16 elt-count))) + (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) + (let + ((f30-0 + (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208) + ) + ) + (cond + ((= f30-0 409600000.0) + ) + ((zero? sv-168) + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-164 8192000.0) + (set! sv-168 1) + ) + ((begin + (vector-float*! sv-240 sv-208 f30-0) + (>= (vector-dot sv-240 sv-176) 0.0) + ) + ) + ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) + (when (< (fabs f30-0) (fabs sv-164)) + (set! sv-164 f30-0) + (set! sv-168 (+ sv-168 1)) + ) + ) + (else + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-168 (+ sv-168 1)) + (if (< (fabs f30-0) (fabs sv-164)) + (set! sv-164 (- sv-164 f30-0)) + (set! sv-164 0.0) + ) + ) + ) + ) + ) + (set! sv-288 (+ sv-288 1)) + ) + (cond + ((zero? sv-168) + ) + ((= sv-164 0.0) + ) + (else + (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) + (if + (< + (-> (new 'static 'array float 1 4096.0) 0) + (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w)) + ) + (goto cfg-47) + ) + ) + ) + (vector+float*! sv-240 sv-160 sv-208 sv-164) + (cond + ((>= *volume-point-current* 999) + (format + 0 + "ERROR : camera editing out of volume points~%" + ) + ) + (else + (set! + (-> *volume-point* data *volume-point-current* quad) + (-> sv-160 quad) + ) + (set! + (-> *volume-point* data (+ *volume-point-current* 1) quad) + (-> sv-240 quad) + ) + (set! *volume-point-current* (+ *volume-point-current* 2)) + (+! (-> s2-0 point-count) 2) + ) + ) + (vector+! s0-0 s0-0 sv-160) + (vector+! s0-0 s0-0 sv-240) + (set! sv-256 (+ sv-256 2)) + sv-256 + ) + ) + ) + ) + ) + (label cfg-47) + (set! sv-272 (+ sv-272 1)) + ) + (when (nonzero? sv-256) + (vector-float*! + s0-0 + s0-0 + (/ (-> (new 'static 'array float 1 1.0) 0) (the float sv-256)) + ) + (cond + ((>= *volume-normal-current* 599) + (format 0 "ERROR : camera editing out of volume normals~%") + ) + (else + (set! + (-> *volume-normal* data *volume-normal-current* quad) + (-> s0-0 quad) + ) + (set! + (-> *volume-normal* data (+ *volume-normal-current* 1) quad) + (-> s3-0 s1-0 quad) + ) + (set! *volume-normal-current* (+ *volume-normal-current* 2)) + (let ((v1-132 (+ (-> s2-0 normal-count) 2))) + (set! (-> s2-0 normal-count) v1-132) + v1-132 + ) + ) + ) + ) + ) + ) + ) + ) + (else + (return #f) + ) + ) + ) + (+! s4-0 1) + ) + ) + (the-as symbol #f) + ) + +(defbehavior cam-layout-entity-volume-info cam-layout () + (dotimes (gp-0 (-> self num-volumes)) + (cond + ((and + (= gp-0 (-> self cur-volume)) + (= *camera-layout-blink* 'volume) + (zero? (logand (-> *display* real-actual-frame-counter) 8)) + ) + ) + (else + (let ((s5-0 (-> *volume-descriptor* pos-vol gp-0))) + (let + ((a0-7 + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 0 #x80)) + ) + ) + (cond + ((= (-> s5-0 volume-type) 'vol) + (set! (-> a0-7 x) 0) + (set! (-> a0-7 y) 192) + (set! (-> a0-7 z) 0) + 0 + ) + ((= (-> s5-0 volume-type) 'pvol) + (set! (-> a0-7 x) 128) + (set! (-> a0-7 y) 128) + (set! (-> a0-7 z) 128) + ) + ((= (-> s5-0 volume-type) 'cutoutvol) + (set! (-> a0-7 x) 192) + (set! (-> a0-7 y) 0) + (set! (-> a0-7 z) 0) + 0 + ) + ) + (camera-line-setup (the-as vector a0-7)) + ) + (let ((s4-0 (the-as object (-> s5-0 first-point)))) + (dotimes (s3-0 (/ (-> s5-0 point-count) 2)) + (camera-line-draw (the-as vector s4-0) (&+ (the-as vector s4-0) 16)) + (set! + s4-0 + (&-> (the-as (inline-array plane-volume) s4-0) 1 first-point) + ) + ) + ) + ) + ) + ) + ) + #f + ) + +(defun v-slrp! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((s2-0 (new-stack-vector0)) + (s1-0 (new-stack-vector0)) + (s0-0 (new-stack-vector0)) + ) + 0.0 + 0.0 + 0.0 + 0.0 + (cond + ((< (-> (new 'static 'array float 1 1.0) 0) arg3) + (set! + arg3 + (-> (the-as (pointer float) (new 'static 'array float 1 1.0)) 0) + ) + ) + ((< arg3 0.0) + (set! + arg3 + (-> (the-as (pointer float) (new 'static 'array float 1 0.0)) 0) + ) + ) + ) + (vector-normalize-copy! s2-0 arg1 (-> (new 'static 'array float 1 1.0) 0)) + (vector-normalize-copy! s1-0 arg2 (-> (new 'static 'array float 1 1.0) 0)) + (vector-cross! s0-0 s2-0 s1-0) + (let* ((f30-0 (vector-length s0-0)) + (f28-0 (asin f30-0)) + ) + (vector-float*! + arg0 + arg1 + (/ (sin (* (- (-> (new 'static 'array float 1 1.0) 0) arg3) f28-0)) f30-0) + ) + (vector+float*! arg0 arg0 arg2 (/ (sin (* arg3 f28-0)) f30-0)) + ) + ) + ) + +(deftype interp-test-info (structure) + ((from vector :inline :offset-assert 0) + (to vector :inline :offset-assert 16) + (origin vector :inline :offset-assert 32) + (color vector4w :offset-assert 48) + (axis vector :offset-assert 52) + (disp string :offset-assert 56) + ) + :method-count-assert 9 + :size-assert #x3c + :flag-assert #x90000003c + ) + + +(defun + interp-test + ((arg0 (function vector vector vector float vector float none)) + (arg1 interp-test-info) + ) + (let ((s3-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (arg0 + s3-0 + (-> arg1 from) + (-> arg1 to) + (-> (new 'static 'array float 1 0.0) 0) + (-> arg1 axis) + (-> (new 'static 'array float 1 65536.0) 0) + ) + (vector+! s3-0 s3-0 (-> arg1 origin)) + (dotimes (s2-0 10) + (set! (-> gp-0 quad) (-> s3-0 quad)) + (arg0 + s3-0 + (-> arg1 from) + (-> arg1 to) + (* 0.1 (+ (-> (new 'static 'array float 1 1.0) 0) (the float s2-0))) + (-> arg1 axis) + (-> (new 'static 'array float 1 65536.0) 0) + ) + (vector+! s3-0 s3-0 (-> arg1 origin)) + (camera-line s3-0 gp-0 (-> arg1 color)) + ) + (arg0 + gp-0 + (-> arg1 from) + (-> arg1 to) + (-> *CAM_LAYOUT-bank* debug-t) + (-> arg1 axis) + (-> (new 'static 'array float 1 65536.0) 0) + ) + (format *stdcon* "~S ~f~%" (-> arg1 disp) (vector-length gp-0)) + (vector+! gp-0 gp-0 (-> arg1 origin)) + (camera-line (-> arg1 origin) gp-0 (-> arg1 color)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + gp-0 + (the-as vector (-> arg1 color)) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + +(defun + interp-test-deg + ((arg0 (function vector vector vector vector float none)) + (arg1 interp-test-info) + ) + (let ((s3-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (arg0 + s3-0 + (-> arg1 from) + (-> arg1 to) + (-> arg1 axis) + (-> (new 'static 'array float 1 0.0) 0) + ) + (vector+! s3-0 s3-0 (-> arg1 origin)) + (dotimes (s2-0 10) + (set! (-> gp-0 quad) (-> s3-0 quad)) + (arg0 + s3-0 + (-> arg1 from) + (-> arg1 to) + (-> arg1 axis) + (* + 182.04445 + (* 18.0 (+ (-> (new 'static 'array float 1 1.0) 0) (the float s2-0))) + ) + ) + (vector+! s3-0 s3-0 (-> arg1 origin)) + (camera-line s3-0 gp-0 (-> arg1 color)) + ) + (arg0 + gp-0 + (-> arg1 from) + (-> arg1 to) + (-> arg1 axis) + (* 182.04445 (* 180.0 (-> *CAM_LAYOUT-bank* debug-t))) + ) + (format *stdcon* "~S ~f~%" (-> arg1 disp) (vector-length gp-0)) + (vector+! gp-0 gp-0 (-> arg1 origin)) + (camera-line (-> arg1 origin) gp-0 (-> arg1 color)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + gp-0 + (the-as vector (-> arg1 color)) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + +(defun cam-layout-entity-info ((arg0 entity-actor)) + (if (not arg0) + (return #f) + ) + (let ((s5-0 (new-stack-matrix0)) + (s4-0 (new-stack-vector0)) + ) + (when + (and + (cam-slave-get-vector-with-offset arg0 s4-0 'trans) + (or + (!= *camera-layout-blink* 'camera) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (cam-slave-get-rot arg0 s5-0) + (camera-fov-frame + s5-0 + s4-0 + (* 0.5 (cam-slave-get-fov arg0)) + (-> (new 'static 'array float 1 0.75) 0) + (-> (new 'static 'array float 1 1.0) 0) + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + ) + ) + ) + (let ((s5-1 (new-stack-vector0))) + (if + (and + (cam-slave-get-vector-with-offset arg0 s5-1 'pivot) + (or + (!= *camera-layout-blink* 'pivot) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-1 + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 #x80 0 0 #x80)) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s5-2 (new-stack-vector0))) + (if + (and + (cam-slave-get-vector-with-offset arg0 s5-2 'align) + (or + (!= *camera-layout-blink* 'align) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-2 + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #x80 0 #x80)) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s5-3 (new-stack-vector0))) + (if + (and + (cam-slave-get-vector-with-offset arg0 s5-3 'interesting) + (or + (!= *camera-layout-blink* 'interesting) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-3 + (the-as + vector + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #x80 0 #x80 #x80) + ) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s3-1 (new 'stack 'curve)) + (s2-0 (new-stack-vector0)) + (s5-4 (new-stack-vector0)) + (s4-1 (new-stack-vector0)) + ) + (when + (and + (get-curve-data! + arg0 + s3-1 + 'campath + 'campath-k + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + (or + (!= *camera-layout-blink* 'spline) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (cond + ((cam-slave-get-vector-with-offset arg0 s4-1 'pivot) + (curve-get-pos! s5-4 (-> (new 'static 'array float 1 0.0) 0) s3-1) + (vector-! s4-1 s4-1 s5-4) + ) + (else + (set! + (-> s4-1 quad) + (-> + (the-as + vector + ((method-of-type res-lump get-property-struct) + arg0 + 'spline-offset + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + s4-1 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + quad + ) + ) + ) + ) + (curve-get-pos! s5-4 (-> (new 'static 'array float 1 0.0) 0) s3-1) + (vector+! s5-4 s5-4 s4-1) + (dotimes (s1-1 8) + (set! (-> s2-0 quad) (-> s5-4 quad)) + (curve-get-pos! + s5-4 + (* (-> (new 'static 'array float 1 0.125) 0) (the float (+ s1-1 1))) + s3-1 + ) + (vector+! s5-4 s5-4 s4-1) + (camera-line + s2-0 + s5-4 + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #xff #xff 0 #x80) + ) + ) + ) + (curve-get-pos! s5-4 (-> *CAM_LAYOUT-bank* spline-t) s3-1) + (vector+! s5-4 s5-4 s4-1) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-4 + (the-as + vector + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #xff #xff 0 #x80) + ) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s3-2 (new 'stack 'curve)) + (s2-1 (new-stack-vector0)) + (s5-5 (new-stack-vector0)) + (s4-2 (new-stack-vector0)) + (s1-2 (new 'stack 'curve)) + ) + (when + (and + (get-curve-data! + arg0 + s3-2 + 'intro + 'intro-k + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + (or + (!= *camera-layout-blink* 'intro) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (cond + ((cam-slave-get-vector-with-offset arg0 s4-2 'pivot) + (curve-get-pos! s5-5 (-> (new 'static 'array float 1 1.0) 0) s3-2) + (vector-! s4-2 s4-2 s5-5) + ) + ((get-curve-data! + arg0 + s1-2 + 'campath + 'campath-k + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + (curve-get-pos! s4-2 (-> (new 'static 'array float 1 0.0) 0) s1-2) + (curve-get-pos! s5-5 (-> (new 'static 'array float 1 1.0) 0) s3-2) + (vector-! s4-2 s4-2 s5-5) + ) + ((cam-slave-get-vector-with-offset arg0 s4-2 'trans) + (curve-get-pos! s5-5 (-> (new 'static 'array float 1 1.0) 0) s3-2) + (vector-! s4-2 s4-2 s5-5) + ) + ) + (curve-get-pos! s5-5 (-> (new 'static 'array float 1 0.0) 0) s3-2) + (vector+! s5-5 s5-5 s4-2) + (dotimes (s1-3 8) + (set! (-> s2-1 quad) (-> s5-5 quad)) + (curve-get-pos! + s5-5 + (* (-> (new 'static 'array float 1 0.125) 0) (the float (+ s1-3 1))) + s3-2 + ) + (vector+! s5-5 s5-5 s4-2) + (camera-line + s2-1 + s5-5 + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + ) + (curve-get-pos! s5-5 (-> *CAM_LAYOUT-bank* intro-t) s3-2) + (vector+! s5-5 s5-5 s4-2) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-5 + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + (curve-get-pos! + s5-5 + (cam-slave-get-float + arg0 + 'intro-exitValue + (-> (new 'static 'array float 1 0.0) 0) + ) + s3-2 + ) + (vector+! s5-5 s5-5 s4-2) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-5 + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let + ((s2-3 + (res-lump-data + arg0 + 'campoints + pointer + :time + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (v1-95 + (res-lump-struct + arg0 + 'campoints-offset + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s4-3 (new 'stack-no-clear 'vector)) + (s3-3 (new 'stack-no-clear 'vector)) + (s5-6 (new 'static 'vector)) + ) + (when + (and + s2-3 + (or + (!= *camera-layout-blink* 'index) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (cond + (v1-95 + (vector+! s4-3 (the-as vector (&+ s2-3 0)) (the-as vector v1-95)) + (vector+! s3-3 (the-as vector (&+ s2-3 16)) (the-as vector v1-95)) + ) + (else + (set! (-> s4-3 quad) (-> (the-as (pointer uint128) (&+ s2-3 0)))) + (set! (-> s3-3 quad) (-> (the-as (pointer uint128) (&+ s2-3 16)))) + ) + ) + (camera-line + s4-3 + s3-3 + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #x80 0 #x80)) + ) + (vector-lerp-clamp! s5-6 s4-3 s3-3 (-> *CAM_LAYOUT-bank* spline-t)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-6 + (the-as + vector + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #xff #xff 0 #x80) + ) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let + ((s4-4 + (res-lump-data + arg0 + 'focalpull + pointer + :time + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (s5-7 (new 'static 'vector)) + ) + (when + (and + s4-4 + (or + (!= *camera-layout-blink* 'focalpull) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (camera-line + (the-as vector (&+ s4-4 0)) + (the-as vector (&+ s4-4 16)) + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #xff #xff #x80)) + ) + (vector-lerp-clamp! + s5-7 + (the-as vector (&+ s4-4 0)) + (the-as vector (&+ s4-4 16)) + (-> *CAM_LAYOUT-bank* spline-t) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-7 + (the-as + vector + (new 'static 'vector4w + :data + (new 'static 'array int32 4 0 #xff #xff #x80) + ) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s5-8 (new 'stack 'interp-test-info)) + (s4-5 (new-stack-vector0)) + ) + (when + (and + (cam-slave-get-vector-with-offset arg0 (-> s5-8 origin) 'pivot) + (cam-slave-get-vector-with-offset arg0 (-> s5-8 to) 'align) + (cam-slave-get-vector-with-offset arg0 (-> s5-8 from) 'trans) + ) + (camera-line + (-> s5-8 from) + (-> s5-8 origin) + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #x80 #x80 #x80 #x80) + ) + ) + (camera-line + (-> s5-8 to) + (-> s5-8 origin) + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #x80 #x80 #x80 #x80) + ) + ) + (vector-! (-> s5-8 from) (-> s5-8 from) (-> s5-8 origin)) + (vector-! (-> s5-8 to) (-> s5-8 to) (-> s5-8 origin)) + (vector-cross! s4-5 (-> s5-8 from) (-> s5-8 to)) + (vector-normalize! s4-5 (-> (new 'static 'array float 1 8192.0) 0)) + (vector+! s4-5 s4-5 (-> s5-8 origin)) + (camera-line + (-> s5-8 origin) + s4-5 + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #x80 #x80 #x80 #x80) + ) + ) + (when (not (paused?)) + (+! (-> *CAM_LAYOUT-bank* debug-t) (-> *CAM_LAYOUT-bank* debug-step)) + (if + (< (-> (new 'static 'array float 1 1.0) 0) (-> *CAM_LAYOUT-bank* debug-t)) + (set! (-> *CAM_LAYOUT-bank* debug-t) 0.0) + ) + ) + (set! (-> s5-8 axis) #f) + (set! (-> s5-8 disp) "li") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 #xff 0 0 #x80)) + ) + (interp-test + (the-as + (function vector vector vector float vector float none) + vector-lerp! + ) + s5-8 + ) + (set! (-> s5-8 disp) "si") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #xff 0 #x80)) + ) + (interp-test + (the-as (function vector vector vector float vector float none) v-slrp!) + s5-8 + ) + (set! (-> s5-8 disp) "si2") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + (interp-test + (the-as (function vector vector vector float vector float none) v-slrp2!) + s5-8 + ) + (set! (-> s5-8 disp) "si3") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 #xff 0 #xff #x80)) + ) + (interp-test-deg + (the-as (function vector vector vector vector float none) v-slrp3!) + s5-8 + ) + (set! (-> s5-8 axis) (-> *camera* local-down)) + (set! (-> s5-8 disp) "si2d") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #xff #xff #x80)) + ) + (interp-test + (the-as (function vector vector vector float vector float none) v-slrp2!) + s5-8 + ) + (set! (-> s5-8 disp) "si3d") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 #xff #xff 0 #x80)) + ) + (interp-test-deg + (the-as (function vector vector vector vector float none) v-slrp3!) + s5-8 + ) + ) + ) + ) + +(defun clmf-button-test () + (cam-layout-print 16 *camera-layout-message-ypos* "button test") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (set! *camera-read-analog* #f) + #f + ) + +(defun clmf-bna () + (cam-layout-print 16 *camera-layout-message-ypos* "button not applicable") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (set! *camera-read-analog* #f) + #t + ) + +(defun clmf-implement () + (cam-layout-print + 16 + *camera-layout-message-ypos* + "button not implemented yet" + ) + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (set! *camera-read-analog* #f) + #t + ) + +(defun clmf-input ((arg0 vector) (arg1 vector) (arg2 int)) + (vector-reset! arg0) + (vector-reset! arg1) + (cond + ((logtest? (-> *cpad-list* cpads arg2 button0-abs 0) (pad-buttons l3)) + (set! + (-> arg0 z) + (- + (-> arg0 z) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 rightx)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + ) + (else + (set! + (-> arg0 y) + (- + (-> arg0 y) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 rightx)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (+! + (-> arg0 x) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 righty)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (set! + (-> arg1 x) + (- + (-> arg1 x) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 leftx)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg2 button0-abs 0) (pad-buttons r1)) + (set! + (-> arg1 y) + (+ + 0.5 + (analog-input + (the-as int (-> *cpad-list* cpads arg2 abutton 9)) + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 32.0) 0) + (-> (new 'static 'array float 1 230.0) 0) + (the-as float 0.5) + ) + (-> arg1 y) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg2 button0-abs 0) (pad-buttons l1)) + (set! + (-> arg1 y) + (- + (-> arg1 y) + (+ + 0.5 + (analog-input + (the-as int (-> *cpad-list* cpads arg2 abutton 8)) + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 32.0) 0) + (-> (new 'static 'array float 1 230.0) 0) + (the-as float 0.5) + ) + ) + ) + ) + ) + ) + (set! + (-> arg1 z) + (- + (-> arg1 z) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 lefty)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + ) + ) + (let ((s5-1 (new-stack-matrix0))) + (let ((a2-8 (new-stack-vector0))) + (set! (-> a2-8 y) -1.0) + (forward-down-nopitch->inv-matrix + s5-1 + (-> *math-camera* inv-camera-rot vector 2) + a2-8 + ) + ) + (vector-matrix*! arg1 arg1 s5-1) + ) + arg1 + ) + +(defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) + (local-vars (s2-0 structure) (s3-1 structure) (sv-192 matrix)) + (cam-layout-print + 16 + *camera-layout-message-ypos* + "x/z pos: left stick, down: l1, up: r1" + ) + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (when (and arg1 (nonzero? arg1)) + (cam-layout-print 16 *camera-layout-message-ypos* "x/y rot: right stick") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (cam-layout-print + 16 + *camera-layout-message-ypos* + "z rot: press left stick & move right" + ) + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + ) + (let ((s5-0 (new-stack-vector0)) + (s4-0 (new-stack-vector0)) + ) + (set! s3-1 (cond + ((or (zero? arg0) (not arg0)) + #f + ) + (else + (if + (not + (res-lump-struct + (-> self cam-entity) + arg0 + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (add-data! + (-> self cam-entity) + (new 'static 'res-tag + :name arg0 + :key-frame -1000000000.0 + :elt-count #x1 + :inlined? #x1 + :elt-type vector + ) + (the-as pointer (new 'static 'vector)) + ) + ) + (set! + s3-1 + (res-lump-struct + (-> self cam-entity) + arg0 + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (when + (and + (not s3-1) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + (clear *temp-string*) + (format *temp-string* "ERROR : can't add ~A" 'vector) + (cam-layout-print 120 100 *temp-string*) + ) + s3-1 + ) + ) + ) + (set! s2-0 (cond + ((or (zero? arg1) (not arg1)) + #f + ) + (else + (if + (not + (res-lump-struct + (-> self cam-entity) + arg1 + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (add-data! + (-> self cam-entity) + (new 'static 'res-tag + :name arg1 + :key-frame -1000000000.0 + :elt-count #x1 + :inlined? #x1 + :elt-type quaternion + ) + (the-as + pointer + (quaternion-identity! (new 'static 'quaternion)) + ) + ) + ) + (set! + s2-0 + (res-lump-struct + (-> self cam-entity) + arg1 + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (when + (and + (not s2-0) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + (clear *temp-string*) + (format *temp-string* "ERROR : can't add ~A" 'quaternion) + (cam-layout-print 120 100 *temp-string*) + ) + s2-0 + ) + ) + ) + (let ((s1-1 (new 'stack-no-clear 'matrix))) + (set! sv-192 (new 'stack-no-clear 'matrix)) + (let ((s0-1 (new 'stack-no-clear 'vector))) + (if (not s3-1) + (return #f) + ) + (clmf-input s5-0 s4-0 0) + (vector+float*! + (the-as vector s3-1) + (the-as vector s3-1) + s4-0 + (-> (new 'static 'array float 1 409.6) 0) + ) + (cond + ((not arg1) + (the-as quaternion #f) + ) + ((zero? arg1) + (the-as quaternion #f) + ) + (else + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) + (vector-float*! s5-0 s5-0 100.0) + (matrix-rotate-x! s1-1 (- (-> s5-0 x))) + (matrix*! sv-192 s1-1 sv-192) + (matrix-rotate-y! s1-1 (-> s5-0 y)) + (matrix*! sv-192 sv-192 s1-1) + (matrix-rotate-z! s1-1 (- (-> s5-0 z))) + (matrix*! sv-192 s1-1 sv-192) + (matrix->quaternion (the-as quaternion s0-1) sv-192) + (quaternion-inverse! + (the-as quaternion s2-0) + (the-as quaternion (-> self cam-entity connect)) + ) + (quaternion*! + (the-as quaternion s2-0) + (the-as quaternion s0-1) + (the-as quaternion s2-0) + ) + (quaternion-normalize! (the-as quaternion s2-0)) + ) + ) + ) + ) + ) + (set! *camera-read-analog* #f) + #t + ) + +(defbehavior clmf-next-volume cam-layout ((arg0 int)) + (if (zero? (-> self num-volumes)) + (return #f) + ) + (set! + (-> self cur-volume) + (mod (+ arg0 (-> self cur-volume)) (-> self num-volumes)) + ) + (while (< (-> self cur-volume) 0) + (+! (-> self cur-volume) (-> self num-volumes)) + ) + #t + ) + +(defun clmf-next-vol-dpad () + (local-vars (a0-1 int)) + (cam-layout-print 16 *camera-layout-message-ypos* "dpad selects volume") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (cond + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down)) + (set! a0-1 1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right)) + (set! a0-1 1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up)) + (set! a0-1 -1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left)) + (set! a0-1 -1) + ) + (else + (set! a0-1 0) + ) + ) + (clmf-next-volume a0-1) + (set! *camera-read-analog* #f) + #t + ) + +(defun clmf-to-edit-cam () + (clmf-next-volume 0) + (set! *clm* *clm-edit*) + #t + ) + +(define *last-cur-entity* -1) + +(defbehavior clmf-next-entity cam-layout ((arg0 int)) + (let ((v1-0 (/ arg0 8))) + (when (zero? (-> self num-entities)) + (set! (-> self cam-entity) #f) + (return #f) + ) + (if (= (- v1-0) (-> self num-entities)) + (set! v1-0 -1) + ) + (if (= v1-0 (-> self num-entities)) + (set! v1-0 1) + ) + (set! + (-> self cur-entity) + (mod (+ v1-0 (-> self cur-entity)) (-> self num-entities)) + ) + ) + (while (< (-> self cur-entity) 0) + (+! (-> self cur-entity) (-> self num-entities)) + ) + (set! *last-cur-entity* (-> self cur-entity)) + (let ((v1-8 (-> self cur-entity)) + (a0-13 (-> *camera-engine* alive-list next0)) + ) + *camera-engine* + (let ((a1-3 (-> a0-13 next0))) + (while (!= a0-13 (-> *camera-engine* alive-list-end)) + (let ((a0-14 (-> (the-as connection a0-13) param1))) + (cond + ((zero? v1-8) + (set! (-> self cam-entity) (the-as entity-camera a0-14)) + (set! *volume-descriptor-current* 0) + (set! *volume-point-current* 0) + (set! *volume-normal-current* 0) + (set! (-> self num-volumes) 0) + (cam-layout-entity-volume-info-create (-> self cam-entity) 'vol) + (set! (-> self first-pvol) (-> self num-volumes)) + (cam-layout-entity-volume-info-create (-> self cam-entity) 'pvol) + (set! (-> self first-cutoutvol) (-> self num-volumes)) + (cam-layout-entity-volume-info-create (-> self cam-entity) 'cutoutvol) + (set! + (-> *CAM_LAYOUT-bank* intro-step) + (cam-slave-get-intro-step (-> self cam-entity)) + ) + (return #f) + ) + (else + (+! v1-8 -1) + ) + ) + ) + (set! a0-13 a1-3) + *camera-engine* + (set! a1-3 (-> a1-3 next0)) + ) + ) + ) + #t + ) + +(defbehavior clmf-to-vol-attr cam-layout () + (set! (-> self res-key) (the float (-> self cur-volume))) + (set! *clm* *clm-vol-attr*) + #t + ) + +(defun clmf-to-spline-attr () + (set! *clm* *clm-spline-attr*) + #t + ) + +(defun clmf-to-intro-attr () + (set! *clm* *clm-intro-attr*) + #t + ) + +(defun clmf-to-index-attr () + (set! *clm* *clm-index-attr*) + #t + ) + +(defun clmf-to-focalpull-attr () + (set! *clm* *clm-focalpull-attr*) + #t + ) + +(defbehavior clmf-to-edit cam-layout () + (set! (-> self res-key) (-> (new 'static 'array float 1 -1000000000.0) 0)) + (set! *clm* *clm-edit*) + #t + ) + +(defun clmf-to-select () + (set! *camera-layout-blink* #f) + (set! *clm* *clm-select*) + #t + ) + +(defbehavior clmf-look-through cam-layout () + (set! (-> *camera-other-fov* data) (cam-slave-get-fov (-> self cam-entity))) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + *camera-other-trans* + 'trans + ) + (set! (-> *camera-other-root* quad) (-> *camera-other-trans* quad)) + (cam-slave-get-rot + (the-as entity-actor (-> self cam-entity)) + *camera-other-matrix* + ) + (set! *camera-look-through-other* 10) + (set! *camera-read-analog* #f) + #f + ) + +(defun fov->maya ((arg0 float)) + (if (= arg0 0.0) + (-> (new 'static 'array float 1 0.0) 0) + (/ 12.700255 (tan (* 0.5 arg0))) + ) + ) + +(defun cam-layout-save-cam-rot ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let ((s3-0 (-> arg2 quat)) + (s5-0 + (res-lump-struct + arg2 + 'rot-offset + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (if arg0 + (format + #t + "setup rot ~f ~f ~f ~f~%" + (-> s3-0 x) + (-> s3-0 y) + (-> s3-0 z) + (-> s3-0 w) + ) + ) + (the-as string (when s5-0 + (if arg0 + (format + #t + "rot offset ~f ~f ~f ~f~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + (-> s5-0 w) + ) + ) + (format + arg1 + " tag rot-offset ~f ~f ~f ~f // vector (quaternion)~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + (-> s5-0 w) + ) + ) + ) + ) + ) + +; TODO - fix me! +; (defun +; cam-layout-save-cam-trans +; ((arg0 symbol) (arg1 string) (arg2 entity-actor)) +; (let ((s1-0 (-> arg2 trans)) +; (s5-0 (method-of-type res-lump get-property-struct)) +; (s2-0 arg2) +; ) +; (format (clear *res-key-string*) "~S~S" 'trans '-offset) +; (let +; ((s5-1 +; (s5-0 +; s2-0 +; (string->symbol *res-key-string*) +; 'interp +; (-> (new 'static 'array float 1 -1000000000.0) 0) +; #f +; (the-as (pointer res-tag) #f) +; *res-static-buf* +; ) +; ) +; ) +; (let +; ((s2-1 +; (res-lump-struct +; arg2 +; 'translation_info +; structure +; :time +; (-> (new 'static 'array float 1 -1000000000.0) 0) +; ) +; ) +; (s3-1 (new-stack-vector0)) +; ) +; (if arg0 +; (format +; #t +; "setup trans ~M ~M ~M (maya)~%" +; (-> s1-0 x) +; (-> s1-0 y) +; (-> s1-0 z) +; ) +; ) +; (set! (-> s3-1 quad) (-> s1-0 quad)) +; (when s5-1 +; (if arg0 +; (format +; #t +; "offset ~M ~M ~M (added)~%" +; (-> (the-as vector s5-1) x) +; (-> (the-as vector s5-1) y) +; (-> (the-as vector s5-1) z) +; ) +; ) +; (vector+! s3-1 s3-1 (the-as vector s5-1)) +; ) +; (when (the-as vector s2-1) +; (if arg0 +; (format +; #t +; "level-trans ~M ~M ~M (subtracted)~%" +; (-> (the-as vector s2-1) x) +; (-> (the-as vector s2-1) y) +; (-> (the-as vector s2-1) z) +; ) +; ) +; (vector-! s3-1 s3-1 (the-as vector s2-1)) +; ) +; (set! s2-1 (or (the-as vector s5-1) s2-1)) +; (set! arg0 (and (the-as vector s2-1) arg0)) +; (if (the-as structure arg0) +; (format +; #t +; "final trans ~M ~M ~M (maya)~%" +; (-> s3-1 x) +; (-> s3-1 y) +; (-> s3-1 z) +; ) +; ) +; ) +; (the-as string (if (the-as vector s5-1) +; (format +; arg1 +; " tag trans-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" +; (-> (the-as vector s5-1) x) +; (-> (the-as vector s5-1) y) +; (-> (the-as vector s5-1) z) +; ) +; ) +; ) +; ) +; ) +; ) + +(defun cam-layout-save-pivot ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s2-0 + (res-lump-struct + arg2 + 'pivot + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s3-0 (method-of-type res-lump get-property-struct)) + ) + (format (clear *res-key-string*) "~S~S" 'pivot '-offset) + (let + ((s5-1 + (the-as + vector + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (s3-1 (new-stack-vector0)) + ) + (the-as string (when s2-0 + (if s5-1 + (vector+! s3-1 s2-0 s5-1) + (set! (-> s3-1 quad) (-> s2-0 quad)) + ) + (if arg0 + (format + #t + "setup pivot ~M ~M ~M~%" + (-> s2-0 x) + (-> s2-0 y) + (-> s2-0 z) + ) + ) + (when s5-1 + (when arg0 + (format + #t + "offset ~M ~M ~M~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + (format + #t + "final pivot ~M ~M ~M~%" + (-> s3-1 x) + (-> s3-1 y) + (-> s3-1 z) + ) + ) + (format + arg1 + " tag pivot-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + ) + ) + ) + ) + ) + ) + +(defun cam-layout-save-align ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s2-0 + (res-lump-struct + arg2 + 'align + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s3-0 (method-of-type res-lump get-property-struct)) + ) + (format (clear *res-key-string*) "~S~S" 'align '-offset) + (let + ((s5-1 + (the-as + vector + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (s3-1 (new-stack-vector0)) + ) + (the-as string (when s2-0 + (if s5-1 + (vector+! s3-1 s2-0 s5-1) + (set! (-> s3-1 quad) (-> s2-0 quad)) + ) + (if arg0 + (format + #t + "setup align ~M ~M ~M~%" + (-> s2-0 x) + (-> s2-0 y) + (-> s2-0 z) + ) + ) + (when s5-1 + (when arg0 + (format + #t + "offset ~M ~M ~M~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + (format + #t + "final align ~M ~M ~M~%" + (-> s3-1 x) + (-> s3-1 y) + (-> s3-1 z) + ) + ) + (format + arg1 + " tag align-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-interesting + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s2-0 + (res-lump-struct + arg2 + 'interesting + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s3-0 (method-of-type res-lump get-property-struct)) + ) + (format (clear *res-key-string*) "~S~S" 'interesting '-offset) + (let + ((s5-1 + (the-as + vector + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (s3-1 (new-stack-vector0)) + ) + (the-as string (when s2-0 + (if s5-1 + (vector+! s3-1 s2-0 s5-1) + (set! (-> s3-1 quad) (-> s2-0 quad)) + ) + (if arg0 + (format + #t + "setup interesting ~M ~M ~M~%" + (-> s2-0 x) + (-> s2-0 y) + (-> s2-0 z) + ) + ) + (when s5-1 + (when arg0 + (format + #t + "offset ~M ~M ~M~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + (format + #t + "final interesting ~M ~M ~M~%" + (-> s3-1 x) + (-> s3-1 y) + (-> s3-1 z) + ) + ) + (format + arg1 + " tag interesting-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + ) + ) + ) + ) + ) + ) + +(defun cam-layout-save-fov ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'fov + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'fov '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + ((= f30-0 0.0) + (if arg0 + (format #t "setup fov deg 0.0 (defaults to 64.0)~%") + ) + (set! f30-0 11650.845) + ) + (arg0 + (format #t "setup fov deg ~R (~f in maya)~%" f30-0 (fov->maya f30-0)) + ) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format + #t + "final ~R (~f in maya) ~%" + (+ f30-0 f28-0) + (fov->maya (+ f30-0 f28-0)) + ) + ) + (format + arg1 + " tag fov-offset DEG(~R) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-focalpull + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'focalPull + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'focalPull '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup focalPull deg ~R (~f in maya)~%" f30-0 (fov->maya f30-0)) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format + #t + "final ~R (~f in maya) ~%" + (+ f30-0 f28-0) + (fov->maya (+ f30-0 f28-0)) + ) + ) + (format + arg1 + " tag focalPull-offset DEG(~R) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun cam-layout-save-flags ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s4-0 + (res-lump-value + arg2 + 'flags + uint128 + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s5-0 (method-of-type res-lump get-property-value)) + (s1-0 arg2) + ) + (format (clear *res-key-string*) "~S~S" 'flags '-on) + (let + ((s5-1 + (s5-0 + s1-0 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s1-1 (method-of-type res-lump get-property-value)) + ) + (format (clear *res-key-string*) "~S~S" 'flags '-off) + (let + ((s3-1 + (s1-1 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when arg0 + (format #t "setup flags ") + (cam-slave-options->string (the-as uint s4-0) (the-as string #t)) + (format #t "~%") + (format #t "forced on ") + (cam-slave-options->string (the-as uint s5-1) (the-as string #t)) + (format #t "~%") + (format #t "forced off ") + (cam-slave-options->string (the-as uint s3-1) (the-as string #t)) + (format #t "~%") + (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) + (format #t "final ") + (cam-slave-options->string (the-as uint s4-1) (the-as string #t)) + ) + (format #t "~%") + ) + (format + arg1 + " tag flags-on 0x~X // int32~%" + s5-1 + ) + (the-as + string + (format + arg1 + " tag flags-off 0x~X // int32~%" + s3-1 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-focalpull-flags + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s4-0 + (res-lump-value + arg2 + 'focalpull-flags + uint128 + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s5-0 (method-of-type res-lump get-property-value)) + (s1-0 arg2) + ) + (format (clear *res-key-string*) "~S~S" 'focalpull-flags '-on) + (let + ((s5-1 + (s5-0 + s1-0 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s1-1 (method-of-type res-lump get-property-value)) + ) + (format (clear *res-key-string*) "~S~S" 'focalpull-flags '-off) + (let + ((s3-1 + (s1-1 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when arg0 + (format #t "setup focalpull-flags ") + (cam-index-options->string (the-as uint s4-0) (the-as string #t)) + (format #t "~%") + (format #t "forced on ") + (cam-index-options->string (the-as uint s5-1) (the-as string #t)) + (format #t "~%") + (format #t "forced off ") + (cam-index-options->string (the-as uint s3-1) (the-as string #t)) + (format #t "~%") + (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) + (format #t "final ") + (cam-index-options->string (the-as uint s4-1) (the-as string #t)) + ) + (format #t "~%") + ) + (format + arg1 + " tag focalpull-flags-on 0x~X // int32~%" + s5-1 + ) + (the-as + string + (format + arg1 + " tag focalpull-flags-off 0x~X // int32~%" + s3-1 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-campoints-flags + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s4-0 + (res-lump-value + arg2 + 'campoints-flags + uint128 + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s5-0 (method-of-type res-lump get-property-value)) + (s1-0 arg2) + ) + (format (clear *res-key-string*) "~S~S" 'campoints-flags '-on) + (let + ((s5-1 + (s5-0 + s1-0 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s1-1 (method-of-type res-lump get-property-value)) + ) + (format (clear *res-key-string*) "~S~S" 'campoints-flags '-off) + (let + ((s3-1 + (s1-1 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when arg0 + (format #t "setup campoints-flags ") + (cam-index-options->string (the-as uint s4-0) (the-as string #t)) + (format #t "~%") + (format #t "forced on ") + (cam-index-options->string (the-as uint s5-1) (the-as string #t)) + (format #t "~%") + (format #t "forced off ") + (cam-index-options->string (the-as uint s3-1) (the-as string #t)) + (format #t "~%") + (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) + (format #t "final ") + (cam-index-options->string (the-as uint s4-1) (the-as string #t)) + ) + (format #t "~%") + ) + (format + arg1 + " tag campoints-flags-on 0x~X // int32~%" + s5-1 + ) + (the-as + string + (format + arg1 + " tag campoints-flags-off 0x~X // int32~%" + s3-1 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-introsplinetime + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'intro-time + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'intro-time '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + ((= f30-0 0.0) + (if arg0 + (format #t "setup intro-time 0.0 (defaults to 1 sec)~%") + ) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + (arg0 + (format #t "setup intro-time ~f~%" f30-0) + ) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag intro-time-offset SECONDS(~f) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-introsplineexitval + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'intro-exitValue + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'intro-exitValue '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when arg0 + (if (= f30-0 0.0) + (format #t "setup intro-exitValue 0.0 (defaults to 0.5)~%") + (format #t "setup intro-exitValue ~f~%" f30-0) + ) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag intro-exitValue-offset ~f // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-interptime + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'interpTime + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'interpTime '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup interpTime ~f~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag interpTime-offset SECONDS(~f) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-splineoffset + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (the-as + string + (when + (and + (not + (res-lump-struct + arg2 + 'pivot + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (res-lump-struct + arg2 + 'spline-offset + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (let + ((s4-1 + (res-lump-struct + arg2 + 'spline-offset + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (when s4-1 + (if arg0 + (format + #t + "spline offset ~M ~M ~M~%" + (-> s4-1 x) + (-> s4-1 y) + (-> s4-1 z) + ) + ) + (format + arg1 + " tag spline-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s4-1 x) + (-> s4-1 y) + (-> s4-1 z) + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-spline-follow-dist-offset + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (the-as + string + (when + (and + (not + (res-lump-struct + arg2 + 'pivot + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ((method-of-type res-lump get-property-value-float) + arg2 + 'spline-follow-dist-offset + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as float #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'spline-follow-dist-offset + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when (the int f30-0) + (if arg0 + (format #t "spline follow dist offset ~M~%" f30-0) + ) + (format + arg1 + " tag spline-follow-dist-offset METERS(~M)~%" + f30-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-campointsoffset + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s5-0 + (res-lump-struct + arg2 + 'campoints-offset + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (the-as string (when s5-0 + (if arg0 + (format + #t + "index offset ~M ~M ~M~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + ) + ) + (format + arg1 + " tag campoints-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-tiltAdjust + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'tiltAdjust + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'tiltAdjust '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup tiltAdjust deg ~R~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format #t "final ~R~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag tiltAdjust-offset DEG(~R) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-stringMinLength + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringMinLength + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringMinLength '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringMinLength ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringMinLength-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-stringMaxLength + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringMaxLength + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringMaxLength '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringMaxLength ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringMaxLength-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-stringMinHeight + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringMinHeight + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringMinHeight '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringMinHeight ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringMinHeight-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-stringMaxHeight + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringMaxHeight + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringMaxHeight '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringMaxHeight ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringMaxHeight-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun + cam-layout-save-stringCliffHeight + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringCliffHeight + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringCliffHeight '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringCliffHeight ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringCliffHeight-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defun cam-layout-save-maxAngle ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'maxAngle + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'maxAngle '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup maxAngle ~R~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format #t "final ~R~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag maxAngle-offset DEG(~R) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +(defbehavior + clmf-save-single cam-layout + ((arg0 entity-camera) (arg1 symbol) (arg2 symbol)) + (clear *temp-string*) + (if arg2 + (format + *temp-string* + "dd_next/caminfo/~s.cam" + (res-lump-struct + arg0 + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (format *temp-string* "dd_next/caminfo/garbage") + ) + (let ((s4-2 (new 'stack 'file-stream *temp-string* 'write))) + (if arg1 + (format + #t + "---------camera '~S'------------~%" + (res-lump-struct + arg0 + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (format s4-2 "#include /next/config_data/standard.m2d~%") + (format + s4-2 + "camera ~s {~%" + (res-lump-struct + arg0 + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (cam-layout-save-cam-rot + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + ; TODO - fix me! + ; (cam-layout-save-cam-trans + ; arg1 + ; (the-as string s4-2) + ; (the-as entity-actor arg0) + ; ) + (cam-layout-save-pivot arg1 (the-as string s4-2) (the-as entity-actor arg0)) + (cam-layout-save-align arg1 (the-as string s4-2) (the-as entity-actor arg0)) + (cam-layout-save-interesting + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-fov arg1 (the-as string s4-2) (the-as entity-actor arg0)) + (cam-layout-save-focalpull + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-flags arg1 (the-as string s4-2) (the-as entity-actor arg0)) + (cam-layout-save-introsplinetime + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-introsplineexitval + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-interptime + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-splineoffset + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-spline-follow-dist-offset + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-campointsoffset + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-tiltAdjust + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringMinLength + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringMaxLength + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringMinHeight + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringMaxHeight + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringCliffHeight + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-maxAngle + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-campoints-flags + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-focalpull-flags + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (format s4-2 "}~%") + (file-stream-close s4-2) + ) + ) + +(defbehavior clmf-save-one cam-layout ((arg0 symbol)) + (let ((s5-1 (logtest? (the-as int arg0) 8)) + (gp-1 (logtest? (the-as int arg0) 16)) + ) + (if s5-1 + (format #t "~%~%~%=================================~%") + ) + (clmf-save-single (-> self cam-entity) s5-1 gp-1) + (if s5-1 + (format #t "===============================~%~%~%~%") + ) + (if gp-1 + (format + #t + "'~S' save completed~%" + (res-lump-struct + (-> self cam-entity) + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + ) + #t + ) + +(defbehavior clmf-save-all cam-layout ((arg0 symbol)) + (let ((s5-1 (logtest? (the-as int arg0) 8)) + (gp-1 (logtest? (the-as int arg0) 16)) + ) + (if s5-1 + (format #t "~%~%~%=================================~%") + ) + (let ((v1-5 (-> *camera-engine* alive-list next0))) + *camera-engine* + (let ((s4-0 (-> v1-5 next0))) + (while (!= v1-5 (-> *camera-engine* alive-list-end)) + (let ((a0-4 (-> (the-as connection v1-5) param1))) + (clmf-save-single (the-as entity-camera a0-4) s5-1 gp-1) + ) + (set! v1-5 s4-0) + *camera-engine* + (set! s4-0 (-> s4-0 next0)) + ) + ) + ) + (if s5-1 + (format #t "===============================~%~%~%~%") + ) + (if gp-1 + (format #t "camera save all completed~%") + ) + ) + #t + ) + +(deftype clmf-cam-flag-toggle-info (structure) + ((key float :offset-assert 0) + (force-on int32 :offset-assert 4) + (force-off int32 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(defbehavior clmf-cam-flag-toggle cam-layout ((arg0 int) (arg1 int)) + (let ((s4-0 (/ arg0 8)) + (gp-0 (new 'stack 'clmf-cam-flag-toggle-info)) + ) + (set! (-> gp-0 key) (-> self res-key)) + (cond + ((and + (= arg1 'vol-flags) + (>= (-> self res-key) (the float (-> self first-cutoutvol))) + ) + (set! + (-> gp-0 key) + (- (-> gp-0 key) (the float (-> self first-cutoutvol))) + ) + (set! arg1 (the-as int 'cutoutvol-flags)) + ) + ((and + (= arg1 'vol-flags) + (>= (-> self res-key) (the float (-> self first-pvol))) + ) + (set! (-> gp-0 key) (- (-> gp-0 key) (the float (-> self first-pvol)))) + (set! arg1 (the-as int 'pvol-flags)) + ) + ) + (let ((s3-0 (method-of-type res-lump get-property-value)) + (s2-0 (-> self cam-entity)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) + (set! + (-> gp-0 force-on) + (the-as + int + (s3-0 + s2-0 + (string->symbol *res-key-string*) + 'exact + (-> gp-0 key) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + (let ((s3-1 (method-of-type res-lump get-property-value)) + (s2-1 (-> self cam-entity)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) + (set! + (-> gp-0 force-off) + (the-as + int + (s3-1 + s2-1 + (string->symbol *res-key-string*) + 'exact + (-> gp-0 key) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + (cond + ((logtest? (-> gp-0 force-off) s4-0) + (logclear! (-> gp-0 force-off) s4-0) + (logior! (-> gp-0 force-on) s4-0) + (let* ((s4-1 (-> self cam-entity)) + (s3-2 (method-of-object s4-1 add-32bit-data!)) + (s2-2 + (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32)) + ) + (s1-2 (shl (the-as int (-> gp-0 key)) 32)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) + (s3-2 + s4-1 + (the-as + res-tag + (make-u128 + s2-2 + (logior + s1-2 + (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32) + ) + ) + ) + (-> gp-0 force-off) + ) + ) + (let* ((s4-2 (-> self cam-entity)) + (s3-3 (method-of-object s4-2 add-32bit-data!)) + (s2-3 + (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32)) + ) + (s1-3 (shl (the-as int (-> gp-0 key)) 32)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) + (s3-3 + s4-2 + (the-as + res-tag + (make-u128 + s2-3 + (logior + s1-3 + (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32) + ) + ) + ) + (-> gp-0 force-on) + ) + ) + ) + ((logtest? (-> gp-0 force-on) s4-0) + (logclear! (-> gp-0 force-on) s4-0) + (let* ((s4-3 (-> self cam-entity)) + (s3-4 (method-of-object s4-3 add-32bit-data!)) + (s2-4 + (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32)) + ) + (s1-4 (shl (the-as int (-> gp-0 key)) 32)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) + (s3-4 + s4-3 + (the-as + res-tag + (make-u128 + s2-4 + (logior + s1-4 + (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32) + ) + ) + ) + (-> gp-0 force-on) + ) + ) + ) + (else + (logior! (-> gp-0 force-off) s4-0) + (let* ((s4-4 (-> self cam-entity)) + (s3-5 (method-of-object s4-4 add-32bit-data!)) + (s2-5 + (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32)) + ) + (s1-5 (shl (the-as int (-> gp-0 key)) 32)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) + (s3-5 + s4-4 + (the-as + res-tag + (make-u128 + s2-5 + (logior + s1-5 + (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32) + ) + ) + ) + (-> gp-0 force-off) + ) + ) + ) + ) + ) + #t + ) + +(defbehavior clmf-cam-flag cam-layout ((arg0 string) (arg1 uint) (arg2 uint)) + (let ((s5-0 (/ (the-as int arg1) 8)) + (f30-0 (-> self res-key)) + ) + (cond + ((and + (= arg2 'vol-flags) + (>= (-> self res-key) (the float (-> self first-cutoutvol))) + ) + (set! f30-0 (- f30-0 (the float (-> self first-cutoutvol)))) + (set! arg2 (the-as uint 'cutoutvol-flags)) + ) + ((and + (= arg2 'vol-flags) + (>= (-> self res-key) (the float (-> self first-pvol))) + ) + (set! f30-0 (- f30-0 (the float (-> self first-pvol)))) + (set! arg2 (the-as uint 'pvol-flags)) + ) + ) + (let ((s3-0 (method-of-type res-lump get-property-value)) + (s2-0 (-> self cam-entity)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg2) '-off) + (cond + ((logtest? + (s3-0 + s2-0 + (string->symbol *res-key-string*) + 'exact + f30-0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + s5-0 + ) + (format arg0 ": off") + ) + ((let ((s3-1 (method-of-type res-lump get-property-value)) + (s2-1 (-> self cam-entity)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg2) '-on) + (logtest? + (s3-1 + s2-1 + (string->symbol *res-key-string*) + 'exact + f30-0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + s5-0 + ) + ) + (format arg0 ": on") + ) + ((zero? + (logand + ((method-of-type res-lump get-property-value) + (-> self cam-entity) + (the-as symbol arg2) + 'exact + f30-0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + s5-0 + ) + ) + (format arg0 ": off(maya)") + ) + (else + (format arg0 ": on(maya)") + ) + ) + ) + ) + #t + ) + +(defbehavior + clmf-cam-float-adjust cam-layout + ((arg0 symbol) (arg1 (pointer float))) + (cam-layout-print 16 *camera-layout-message-ypos* "left stick adjusts value") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + (-> self cam-entity) + arg0 + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (f0-0 (-> arg1 0)) + ) + (if (= f0-0 0.0) + (set! f0-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + (let + ((f0-2 + (+ + f30-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 leftx)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + f0-0 + ) + ) + ) + ) + (add-32bit-data! + (-> self cam-entity) + (new 'static 'res-tag + :name arg0 + :key-frame -1000000000.0 + :elt-count #x1 + :elt-type float + ) + f0-2 + ) + ) + ) + (set! *camera-read-analog* #f) + #t + ) + +(defbehavior clmf-cam-meters cam-layout ((arg0 meters) (arg1 symbol)) + (let + ((f0-0 + (cam-slave-get-float + (-> self cam-entity) + arg1 + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + ) + (format arg0 ": ~M" f0-0) + ) + #t + ) + +(defbehavior clmf-cam-fov cam-layout ((arg0 degrees) (arg1 symbol)) + (format arg0 ": ~R" (cam-slave-get-fov (-> self cam-entity))) + #t + ) + +(defbehavior clmf-cam-deg cam-layout ((arg0 degrees) (arg1 symbol)) + (format + arg0 + ": ~R" + (cam-slave-get-float + (-> self cam-entity) + arg1 + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + #t + ) + +(defbehavior clmf-cam-intro-time cam-layout ((arg0 float) (arg1 symbol)) + (let ((f30-0 (cam-slave-get-intro-step (-> self cam-entity)))) + (format arg0 ": ~f" (/ 0.016666668 f30-0)) + (set! (-> *CAM_LAYOUT-bank* intro-step) f30-0) + ) + #t + ) + +(defbehavior clmf-cam-interp-time cam-layout ((arg0 float) (arg1 symbol)) + (format arg0 ": ~f" (cam-slave-get-interp-time (-> self cam-entity))) + #t + ) + +(defbehavior clmf-cam-float cam-layout ((arg0 float) (arg1 symbol)) + (format + arg0 + ": ~f" + (cam-slave-get-float + (-> self cam-entity) + arg1 + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + #t + ) + +(defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) + (local-vars (sv-16 res-tag)) + (format arg0 ":") + (set! sv-16 (new 'static 'res-tag)) + (let + ((s5-1 + (res-lump-data + (-> self cam-entity) + arg1 + pointer + :tag-ptr + (& sv-16) + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (when s5-1 + (dotimes (s4-0 (the-as int (-> sv-16 elt-count))) + (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4))))) + ) + ) + ) + #t + ) + +(define + *clm-focalpull-attr* + (new 'static 'clm + :title "---focalpull attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 2 :allocated-length 2 + (new 'static 'clm-list-item + :description "radial " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'focalpull-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 16 + :parm1-basic 'focalpull-flags + ) + ) + ) + (new 'static 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'focalpull-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 8 + :parm1-basic 'focalpull-flags + ) + ) + ) + ) + ) + ) + ) + ) + +(define + *clm-index-attr* + (new 'static 'clm + :title "---index attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 2 :allocated-length 2 + (new 'static 'clm-list-item + :description "radial " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'campoints-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 16 + :parm1-basic 'campoints-flags + ) + ) + ) + (new 'static 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'campoints-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 8 + :parm1-basic 'campoints-flags + ) + ) + ) + ) + ) + ) + ) + ) + +(define + *clm-intro-attr* + (new 'static 'clm + :title "---intro attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 2 :allocated-length 2 + (new 'static 'clm-list-item + :description "time " + :track-val #f + :val-func 'clmf-cam-intro-time + :val-parm0-basic 'intro-time + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'intro-time-offset + :parm1-basic (new 'static 'bfloat :data 0.01) + ) + ) + ) + (new 'static 'clm-list-item + :description "exitValue" + :track-val #f + :val-func 'clmf-cam-float + :val-parm0-basic 'intro-exitValue + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'intro-exitValue-offset + :parm1-basic (new 'static 'bfloat :data 0.001) + ) + ) + ) + ) + ) + ) + ) + ) + +(define + *clm-spline-attr* + (new 'static 'clm + :title "---spline attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 1 :allocated-length 1 + (new 'static 'clm-list-item + :description "followDist" + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'spline-follow-dist + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'spline-follow-dist-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + ) + ) + ) + ) + ) + +(define + *clm-vol-attr* + (new 'static 'clm + :title "---volume attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 1 :allocated-length 1 + (new 'static 'clm-list-item + :description "airSwitch" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'vol-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 8 + :parm1-basic 'vol-flags + ) + ) + ) + ) + ) + ) + ) + ) + +(define + *clm-cam-attr* + (new 'static 'clm + :title "---camera attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 18 :allocated-length 18 + (new 'static 'clm-list-item + :description "drag " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x400 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x400 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "fov " + :track-val #f + :val-func 'clmf-cam-fov + :val-parm0-basic 'fov + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'fov-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + (new 'static 'clm-list-item + :description "focalPull " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'focalPull + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'focalPull-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + (new 'static 'clm-list-item + :description "interpTime " + :track-val #f + :val-func 'clmf-cam-interp-time + :val-parm0-basic 'interpTime + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'interpTime-offset + :parm1-basic (new 'static 'bfloat :data 0.01) + ) + ) + ) + (new 'static 'clm-list-item + :description "sameSide " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 16 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 32 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 32 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "MinLength " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMinLength + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMinLength-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "MaxLength " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMaxLength + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMaxLength-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "MinHeight " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMinHeight + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMinHeight-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "MaxHeight " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMaxHeight + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMaxHeight-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "cliffHeight" + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringCliffHeight + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringCliffHeight-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "alternates " + :track-val #f + :val-func 'clmf-cam-string + :val-parm0-basic 'alternates + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 0 :allocated-length 0 + ) + ) + (new 'static 'clm-list-item + :description "maxAngle " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'maxAngle + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'maxAngle-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + (new 'static 'clm-list-item + :description "shrinkAngle" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x4000 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x4000 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "noRotate " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x40000 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x40000 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "tiltAdjust " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'tiltAdjust + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'tiltAdjust-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + (new 'static 'clm-list-item + :description "stickyAngle" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x80000 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x80000 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "airExit" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x100000 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x100000 + :parm1-basic 'flags + ) + ) + ) + ) + ) + ) + ) + ) + +(define + *clm-cam-lookthrough* + (new 'static 'clm + :title "---cam-lookthrough---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 5 :allocated-length 5 + (new 'static 'clm-item + :description " " + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x4 + :func 'clmf-look-through + ) + ) + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func 'clmf-to-edit + ) + ) + (new 'static 'clm-item + :description "pos/rot" + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x8 + :func 'clmf-pos-rot + :parm0-basic 'trans-offset + :parm1-basic 'rot-offset + ) + ) + (new 'static 'clm-item + :description " adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 1 :allocated-length 1 + (new 'static 'clm-list-item + :description "fov" + :track-val #f + :val-func 'clmf-cam-fov + :val-parm0-basic 'fov + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'fov-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + ) + ) + ) + ) + ) + +(define + *clm-edit* + (new 'static 'clm + :title "---edit---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 6 :allocated-length 6 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func 'clmf-to-select + ) + ) + (new 'static 'clm-item + :description "attributes" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func #f) + ) + (new 'static 'clm-item + :description " edit part" + :button-symbol 'circle + :action + (new 'static 'clm-item-action :button #x2000 :options #x1 :func #f) + ) + (new 'static 'clm-item + :description "scale/next" + :button-symbol 'r2 + :action + (new 'static 'clm-item-action :button #x200 :func #f) + ) + (new 'static 'clm-item + :description " pos/rot" + :button-symbol 'l2 + :action + (new 'static 'clm-item-action :button #x100 :func #f) + ) + (new 'static 'clm-list + :tracker '*camera-layout-blink* + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 9 :allocated-length 9 + (new 'static 'clm-list-item + :description "camera " + :track-val 'camera + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func '*clm-cam-attr* + ) + (new 'static 'clm-item-action + :button #x2000 + :func '*clm-cam-lookthrough* + ) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'trans-offset + :parm1-basic 'rot-offset + ) + ) + ) + (new 'static 'clm-list-item + :description "volume " + :track-val 'volume + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-to-vol-attr + ) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-next-vol-dpad) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) + ) + ) + (new 'static 'clm-list-item + :description "align " + :track-val 'align + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'align-offset + :parm1-basic #f + ) + ) + ) + (new 'static 'clm-list-item + :description "pivot " + :track-val 'pivot + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'pivot-offset + :parm1-basic #f + ) + ) + ) + (new 'static 'clm-list-item + :description "interesting" + :track-val 'interesting + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'interesting-offset + :parm1-basic #f + ) + ) + ) + (new 'static 'clm-list-item + :description "spline " + :track-val 'spline + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action :button #x4000 :func 'clmf-to-spline-attr) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'spline-offset + :parm1-basic #f + ) + ) + ) + (new 'static 'clm-list-item + :description "intro " + :track-val 'intro + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-to-intro-attr + ) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) + ) + ) + (new 'static 'clm-list-item + :description "index " + :track-val 'index + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-to-index-attr + ) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'campoints-offset + ) + ) + ) + (new 'static 'clm-list-item + :description "focalpull" + :track-val 'focalpull + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-to-focalpull-attr + ) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) + ) + ) + ) + ) + ) + ) + ) + +(define + *clm-save-all* + (new 'static 'clm + :title "---save all?---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " save all" + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-save-all + :parm0 16 + ) + ) + (new 'static 'clm-item + :description "print all" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func 'clmf-save-all + :parm0 8 + ) + ) + (new 'static 'clm-item + :description " done" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action + :button #x1000 + :options #x1 + :func 'clmf-to-select + ) + ) + ) + ) + ) + +(define + *clm-save-one* + (new 'static 'clm + :title "---single save?---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " single save" + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-save-one + :parm0 16 + ) + ) + (new 'static 'clm-item + :description "single print" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func 'clmf-save-one + :parm0 8 + ) + ) + (new 'static 'clm-item + :description " done" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action + :button #x1000 + :options #x1 + :func 'clmf-to-select + ) + ) + ) + ) + ) + +(define + *clm-select* + (new 'static 'clm + :title "---camera---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 6 :allocated-length 6 + (new 'static 'clm-item + :description " edit" + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x3 + :func 'clmf-to-edit-cam + ) + ) + (new 'static 'clm-item + :description "save one" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action + :button #x1000 + :options #x3 + :func '*clm-save-one* + ) + ) + (new 'static 'clm-item + :description " next" + :button-symbol 'down + :action + (new 'static 'clm-item-action + :button #x40 + :options #x3 + :func 'clmf-next-entity + :parm0 8 + ) + ) + (new 'static 'clm-item + :description " prev" + :button-symbol 'up + :action + (new 'static 'clm-item-action + :button #x10 + :options #x3 + :func 'clmf-next-entity + :parm0 -8 + ) + ) + (new 'static 'clm-item + :description " next 5" + :button-symbol 'right + :action + (new 'static 'clm-item-action + :button #x20 + :options #x3 + :func 'clmf-next-entity + :parm0 40 + ) + ) + (new 'static 'clm-item + :description " prev 5" + :button-symbol 'left + :action + (new 'static 'clm-item-action + :button #x80 + :options #x3 + :func 'clmf-next-entity + :parm0 -40 + ) + ) + ) + ) + ) + +(define *clm* *clm-select*) + +(defbehavior cam-layout-do-action cam-layout ((arg0 clm-item-action)) + (let ((s5-0 (-> arg0 func value))) + (cond + ((not s5-0) + #f + ) + ((zero? s5-0) + #f + ) + ((and (not (-> self cam-entity)) (logtest? (-> arg0 options) 2)) + #f + ) + ((and + (logtest? (-> arg0 options) 8) + (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (-> arg0 button)) + ) + #f + ) + ((and + (zero? (logand (-> arg0 options) 12)) + (logtest? (-> arg0 options) 1) + (zero? (logand (-> *cpad-list* cpads 0 button0-rel 0) (-> arg0 button))) + ) + #f + ) + ((and + (zero? (logand (-> arg0 options) 13)) + (zero? (logand (-> *cpad-list* cpads 0 button0-abs 0) (-> arg0 button))) + ) + #f + ) + ((type-type? (-> (the-as basic s5-0) type) clm) + (set! *clm* (the-as clm s5-0)) + #t + ) + ((type-type? (-> (the-as basic s5-0) type) function) + ((the-as (function object symbol symbol) s5-0) + (-> arg0 parm0) + (the-as symbol (-> arg0 parm1-basic)) + ) + ) + ) + ) + ) + +(defbehavior + cam-layout-function-call cam-layout + ((arg0 symbol) (arg1 string) (arg2 int) (arg3 basic)) + (let ((gp-0 (-> arg0 value))) + (cond + ((not gp-0) + ) + ((zero? gp-0) + ) + ((type-type? (-> (the-as basic gp-0) type) function) + ((the-as (function string int basic none) gp-0) arg1 arg2 arg3) + ) + ) + ) + #f + ) + +(defbehavior cam-layout-do-menu cam-layout ((arg0 clm)) + (set! *camera-layout-message-ypos* 30) + (+! (-> *CAM_LAYOUT-bank* spline-t) (-> *CAM_LAYOUT-bank* spline-step)) + (if (< 1.01 (-> *CAM_LAYOUT-bank* spline-t)) + (set! (-> *CAM_LAYOUT-bank* spline-t) -0.09) + ) + (+! (-> *CAM_LAYOUT-bank* intro-t) (-> *CAM_LAYOUT-bank* intro-step)) + (if (< 1.01 (-> *CAM_LAYOUT-bank* intro-t)) + (set! (-> *CAM_LAYOUT-bank* intro-t) -0.09) + ) + (let ((s5-0 30)) + (let ((s4-0 (cam-state-from-entity (-> self cam-entity)))) + (set! *camera-read-analog* #t) + (let ((s3-0 (-> self cam-entity))) + (clear *temp-string*) + (if s3-0 + (format + *temp-string* + "\"~S\"~%" + (res-lump-struct + s3-0 + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + ) + (if (not s4-0) + (format *temp-string* "no cameras in this level") + (format *temp-string* "~S" (-> s4-0 name)) + ) + ) + (cam-layout-print 320 s5-0 *temp-string*) + (let ((s5-1 (+ s5-0 16))) + (clear *temp-string*) + (format *temp-string* "~S~%" (-> arg0 title)) + (cam-layout-print 320 s5-1 *temp-string*) + (let ((s4-1 (+ s5-1 8))) + (dotimes (s5-2 (-> arg0 items length)) + (cond + ((type-type? (-> arg0 items s5-2 type) clm-list) + (clear *temp-string*) + (format *temp-string* "------------") + (cam-layout-print 320 s4-1 *temp-string*) + (let ((s4-2 (+ s4-1 8))) + (let ((s3-1 (the-as clm-list (-> arg0 items s5-2)))) + (dotimes (s2-1 (-> s3-1 items length)) + (clear *temp-string*) + (format *temp-string* "~S~S" (if (= s2-1 (-> s3-1 cur-list-item)) + "> " + " " + ) + (-> s3-1 items s2-1 description) + ) + (cam-layout-function-call + (-> s3-1 items s2-1 val-func) + *temp-string* + (-> s3-1 items s2-1 val-parm0) + (-> s3-1 items s2-1 val-parm1-basic) + ) + (cam-layout-print 320 s4-2 *temp-string*) + (+! s4-2 8) + ) + ) + (clear *temp-string*) + (format *temp-string* "------------") + (cam-layout-print 320 s4-2 *temp-string*) + (set! s4-1 (+ s4-2 8)) + ) + ) + ((and + (not (-> self cam-entity)) + (logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 2) + ) + ) + ((logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 4) + ) + (else + (let ((s3-2 (-> arg0 items s5-2))) + (clear *temp-string*) + (format + *temp-string* + "~S: ~A~%" + (-> (the-as clm-item s3-2) description) + (if + (logtest? + (-> (the-as clm-item (-> arg0 items s5-2)) action options) + 8 + ) + 'default + (-> (the-as clm-item s3-2) button-symbol) + ) + ) + ) + (cam-layout-print 320 s4-1 *temp-string*) + (+! s4-1 8) + ) + ) + ) + ) + ) + ) + (if (= *master-mode* 'menu) + (goto cfg-65) + ) + (dotimes (s5-3 (-> arg0 items length)) + (cond + ((type-type? (-> arg0 items s5-3 type) clm-list) + (let ((s4-3 (-> arg0 items s5-3)) + (s3-3 0) + ) + (if (-> (the-as clm-list s4-3) tracker) + (set! + (-> (the-as clm-list s4-3) tracker value) + (-> + (the-as clm-list s4-3) + items + (-> (the-as clm-list s4-3) cur-list-item) + track-val + ) + ) + ) + (dotimes + (s2-2 + (-> + (the-as clm-list s4-3) + items + (-> (the-as clm-list s4-3) cur-list-item) + actions + length + ) + ) + (if + (cam-layout-do-action + (-> + (the-as clm-list s4-3) + items + (-> (the-as clm-list s4-3) cur-list-item) + actions + s2-2 + ) + ) + (goto cfg-65) + ) + ) + (cond + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down)) + (set! s3-3 1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right)) + (set! s3-3 1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up)) + (set! s3-3 -1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left)) + (set! s3-3 -1) + ) + ) + (when (nonzero? s3-3) + (set! + (-> (the-as clm-list s4-3) cur-list-item) + (mod + (+ (-> (the-as clm-list s4-3) cur-list-item) s3-3) + (-> (the-as clm-list s4-3) items length) + ) + ) + (while (< (-> (the-as clm-list s4-3) cur-list-item) 0) + (+! + (-> (the-as clm-list s4-3) cur-list-item) + (-> (the-as clm-list s4-3) items length) + ) + ) + (goto cfg-65) + ) + ) + ) + ((cam-layout-do-action (-> (the-as clm-item (-> arg0 items s5-3)) action)) + (goto cfg-65) + ) + ) + ) + (label cfg-65) + (none) + ) + +(defstate cam-layout-active (cam-layout) + :code + (behavior () + (while #t + (cam-layout-entity-info (the-as entity-actor (-> self cam-entity))) + (cam-layout-entity-volume-info) + (cam-layout-do-menu *clm*) + (suspend) + ) + (none) + ) + ) + +(defbehavior cam-layout-init cam-layout () + (set! (-> self res-key) (-> (new 'static 'array float 1 -1000000000.0) 0)) + (set! (-> self num-entities) 0) + (let ((v1-2 (-> *camera-engine* alive-list next0))) + *camera-engine* + (let ((a0-2 (-> v1-2 next0))) + (while (!= v1-2 (-> *camera-engine* alive-list-end)) + (-> (the-as connection v1-2) param1) + (+! (-> self num-entities) 1) + (set! v1-2 a0-2) + *camera-engine* + (set! a0-2 (-> a0-2 next0)) + ) + ) + ) + (set! (-> self cur-entity) *last-cur-entity*) + (clmf-next-entity 0) + (set! *clm* *clm-select*) + (go cam-layout-active) + (none) + ) + +(defun cam-layout-stop () + (set! *cam-layout* #f) + (kill-by-name 'cam-layout *active-pool*) + ) + +(defun cam-layout-start () + (let ((a0-1 (new 'global 'file-stream "dd_next/caminfo/garbage" 'read))) + (file-stream-close a0-1) + ) + (cond + ((not *cam-layout*) + (let* ((gp-0 (get-process *camera-dead-pool* cam-layout #x4000)) + (v1-4 (when gp-0 + (let ((t9-3 (method-of-type cam-layout activate))) + (t9-3 + (the-as cam-layout gp-0) + *default-pool* + 'cam-layout + (the-as pointer #x70004000) + ) + ) + (run-next-time-in-process gp-0 cam-layout-init) + (-> gp-0 ppointer) + ) + ) + ) + (cond + (v1-4 + (logclear! (-> v1-4 0 mask) (process-mask pause menu)) + (set! *cam-layout* #t) + (set! *camera-layout-blink* #f) + ) + (else + (format + 0 + "ERROR : no process available to start cam editing mode~%" + ) + ) + ) + ) + ) + (else + (format 0 "ERROR : cam editing mode already started~%") + ) + ) + *cam-layout* + (none) + ) + +(defun cam-layout-restart () + (cam-layout-stop) + (cam-layout-start) + (none) + ) + +) + + + diff --git a/goal_src/engine/camera/cam-master.gc b/goal_src/engine/camera/cam-master.gc index 7b984d98be..b3a64c23e1 100644 --- a/goal_src/engine/camera/cam-master.gc +++ b/goal_src/engine/camera/cam-master.gc @@ -6,4 +6,2629 @@ ;; dgos: GAME, ENGINE ;; TODO - for basebutton -(define-extern cam-fixed state) +(define-extern cam-fixed (state camera-slave)) + +(define-extern cam-free-floating (state camera-slave)) +(define-extern cam-master-active (state camera-master)) +(define-extern list-keeper-active (state camera-master)) + +;; DECOMP BEGINS + +(deftype camera-master-bank (basic) + ((onscreen-head-height meters :offset-assert 4) + (onscreen-foot-height meters :offset-assert 8) + (target-height meters :offset-assert 12) + (up-move-to-pitch-ratio-in-air float :offset-assert 16) + (down-move-to-pitch-ratio-in-air float :offset-assert 20) + (up-move-to-pitch-on-ground float :offset-assert 24) + (down-move-to-pitch-on-ground float :offset-assert 28) + (pitch-off-blend float :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x24 + :flag-assert #x900000024 + ) + + +(define + *CAMERA_MASTER-bank* + (new 'static 'camera-master-bank + :onscreen-head-height (meters 2.65) + :onscreen-foot-height (meters -0.5) + :target-height (meters 2.15) + :up-move-to-pitch-ratio-in-air 1.0 + :down-move-to-pitch-ratio-in-air 0.5 + :up-move-to-pitch-on-ground 0.9 + :down-move-to-pitch-on-ground 0.9 + :pitch-off-blend 0.5 + ) + ) + +(defbehavior reset-follow camera-master () + (set! (-> self tpos-old quad) (-> (target-cam-pos) quad)) + (set! (-> self tpos-curr quad) (-> self tpos-old quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-tgt quad) (-> self tpos-old quad)) + (let ((f0-0 0.0)) + (set! (-> self upspeed) f0-0) + f0-0 + ) + ) + +(defbehavior reset-target-tracking camera-master () + (set! (-> self tpos-old quad) (-> (target-cam-pos) quad)) + (set! (-> self tpos-curr quad) (-> self tpos-old quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-tgt quad) (-> self tpos-old quad)) + (quaternion->matrix (-> self tgt-rot-mat) (-> *target* control dir-targ)) + (quaternion->matrix + (-> self tgt-face-mat) + (-> *target* control unknown-quaternion00) + ) + (vector-reset! (-> self pitch-off)) + (set! (-> self upspeed) 0.0) + (set! (-> self foot-offset) (-> *CAMERA_MASTER-bank* onscreen-foot-height)) + (set! (-> self head-offset) (-> *CAMERA_MASTER-bank* onscreen-head-height)) + (set! (-> self target-height) (-> *CAMERA_MASTER-bank* target-height)) + (set! + (-> self on-ground) + (not + (and + (logtest? (-> *target* control unknown-surface00 flags) 2048) + (zero? (logand (-> *target* control status) 1)) + ) + ) + ) + (set! (-> self on-pole) #f) + (set! (-> self ease-t) 1.0) + (set! (-> self string-max target y) (-> self stringMaxHeight)) + (set! (-> self string-max target z) (-> self stringMaxLength)) + (set! + (-> self string-push-z) + (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z)) + ) + (cond + ((>= (- (-> *display* base-frame-counter) (if *target* + (-> *target* neck notice-time) + 0 + ) + ) + (the-as int (-> *CAMERA-bank* attack-timeout)) + ) + (set! (-> self being-attacked) #f) + ) + (else + (set! + (-> self attack-start) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self being-attacked) #t) + (when + (and + (zero? (logand (-> self master-options) 64)) + (or + (!= (-> last-try-to-look-at-data horz) 0.0) + (!= (-> last-try-to-look-at-data vert) 0.0) + ) + ) + (set! + (-> self string-max target y) + (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert)) + ) + (set! + (-> self string-max target z) + (fmax (-> self string-max target z) (-> last-try-to-look-at-data horz)) + ) + (set! + (-> self string-push-z) + (fmax (-> self string-push-z) (-> self string-max target z)) + ) + ) + ) + ) + (cond + ((and + (logtest? (-> *target* water flags) 4096) + (zero? (logand (-> *target* water flags) 16)) + ) + (set! (-> self under-water) 2) + ) + (else + (set! (-> self under-water) 0) + 0 + ) + ) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector--float*! + gp-1 + (-> self tpos-curr-adj) + (-> self local-down) + (-> self target-height) + ) + (the-as symbol (TODO-RENAME-10 (-> self target-spline) gp-1)) + ) + ) + +(defbehavior reset-drawable-follow camera-master () + (let ((v1-2 (the-as target (-> self drawable-target process 0)))) + (if (nonzero? (-> v1-2 node-list)) + (vector<-cspace! + (-> self tpos-old) + (-> v1-2 node-list data (-> self which-bone)) + ) + (set! (-> self tpos-old quad) (-> v1-2 control trans quad)) + ) + ) + (set! (-> self tpos-curr quad) (-> self tpos-old quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) + (let ((f0-0 0.0)) + (set! (-> self upspeed) f0-0) + f0-0 + ) + ) + +(defbehavior reset-drawable-tracking camera-master () + (let ((gp-0 (the-as target (-> self drawable-target process 0)))) + (cond + ((nonzero? (-> gp-0 node-list)) + (vector<-cspace! + (-> self tpos-old) + (-> gp-0 node-list data (-> self which-bone)) + ) + (let* ((v1-6 (-> self tgt-rot-mat)) + (a3-0 (-> gp-0 node-list data (-> self which-bone) bone transform)) + (a0-4 (-> a3-0 vector 0 quad)) + (a1-4 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 vector 3 quad)) + ) + (set! (-> v1-6 vector 0 quad) a0-4) + (set! (-> v1-6 vector 1 quad) a1-4) + (set! (-> v1-6 vector 2 quad) a2-0) + (set! (-> v1-6 vector 3 quad) a3-1) + ) + (set! (-> self tgt-rot-mat vector 3 quad) (the-as uint128 0)) + (let* ((v1-8 (-> self tgt-face-mat)) + (a3-2 (-> self tgt-rot-mat)) + (a0-5 (-> a3-2 vector 0 quad)) + (a1-5 (-> a3-2 vector 1 quad)) + (a2-1 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad)) + ) + (set! (-> v1-8 vector 0 quad) a0-5) + (set! (-> v1-8 vector 1 quad) a1-5) + (set! (-> v1-8 vector 2 quad) a2-1) + (set! (-> v1-8 vector 3 quad) a3-3) + ) + ) + (else + (set! (-> self tpos-old quad) (-> gp-0 control trans quad)) + (quaternion->matrix (-> self tgt-rot-mat) (-> gp-0 control quat)) + (let* ((v1-11 (-> self tgt-face-mat)) + (a3-4 (-> self tgt-rot-mat)) + (a0-10 (-> a3-4 vector 0 quad)) + (a1-7 (-> a3-4 vector 1 quad)) + (a2-2 (-> a3-4 vector 2 quad)) + (a3-5 (-> a3-4 vector 3 quad)) + ) + (set! (-> v1-11 vector 0 quad) a0-10) + (set! (-> v1-11 vector 1 quad) a1-7) + (set! (-> v1-11 vector 2 quad) a2-2) + (set! (-> v1-11 vector 3 quad) a3-5) + ) + ) + ) + ) + (set! (-> self tpos-curr quad) (-> self tpos-old quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) + (vector-reset! (-> self pitch-off)) + (set! (-> self upspeed) 0.0) + (set! (-> self foot-offset) (-> *CAMERA_MASTER-bank* onscreen-foot-height)) + (set! (-> self head-offset) (-> *CAMERA_MASTER-bank* onscreen-head-height)) + (set! (-> self target-height) (-> *CAMERA_MASTER-bank* target-height)) + (set! (-> self on-ground) #t) + (set! (-> self on-pole) #f) + (set! (-> self ease-t) 1.0) + (set! (-> self being-attacked) #f) + (set! (-> self string-max target y) (-> self stringMaxHeight)) + (set! (-> self string-max target z) (-> self stringMaxLength)) + (set! + (-> self string-push-z) + (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z)) + ) + (set! (-> self under-water) 0) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector--float*! + gp-1 + (-> self tpos-curr-adj) + (-> self local-down) + (-> self target-height) + ) + (the-as symbol (TODO-RENAME-10 (-> self target-spline) gp-1)) + ) + ) + +(defbehavior master-track-target camera-master () + (cond + ((and + (logtest? (-> self master-options) 2) + (!= (-> self drawable-target) #f) + (not (handle->process (-> self drawable-target))) + ) + (set! (-> self master-options) (logand -3 (-> self master-options))) + (set! (-> self drawable-target) (the-as handle #f)) + ) + ((and + (logtest? (-> self master-options) 2) + (handle->process (-> self drawable-target)) + ) + (let ((gp-0 (-> self drawable-target process 0))) + (if (paused?) + (return (the-as symbol #f)) + ) + (set! (-> self tpos-old quad) (-> self tpos-curr quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-curr-adj quad)) + (cond + ((nonzero? (-> (the-as target gp-0) node-list)) + (let* ((v1-24 (-> self tgt-rot-mat)) + (a3-0 + (-> + (the-as target gp-0) + node-list + data + (-> self which-bone) + bone + transform + ) + ) + (a0-17 (-> a3-0 vector 0 quad)) + (a1-4 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 vector 3 quad)) + ) + (set! (-> v1-24 vector 0 quad) a0-17) + (set! (-> v1-24 vector 1 quad) a1-4) + (set! (-> v1-24 vector 2 quad) a2-0) + (set! (-> v1-24 vector 3 quad) a3-1) + ) + (set! (-> self tgt-rot-mat vector 3 quad) (the-as uint128 0)) + (let* ((a2-1 (-> self tgt-face-mat)) + (a3-2 (-> self tgt-rot-mat)) + (v1-26 (-> a3-2 vector 0 quad)) + (a0-18 (-> a3-2 vector 1 quad)) + (a1-5 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad)) + ) + (set! (-> a2-1 vector 0 quad) v1-26) + (set! (-> a2-1 vector 1 quad) a0-18) + (set! (-> a2-1 vector 2 quad) a1-5) + (set! (-> a2-1 vector 3 quad) a3-3) + ) + (vector<-cspace! + (-> self tpos-curr) + (-> (the-as target gp-0) node-list data (-> self which-bone)) + ) + ) + (else + (quaternion->matrix + (-> self tgt-rot-mat) + (-> (the-as target gp-0) control quat) + ) + (let* ((a2-3 (-> self tgt-face-mat)) + (a3-4 (-> self tgt-rot-mat)) + (v1-31 (-> a3-4 vector 0 quad)) + (a0-21 (-> a3-4 vector 1 quad)) + (a1-9 (-> a3-4 vector 2 quad)) + (a3-5 (-> a3-4 vector 3 quad)) + ) + (set! (-> a2-3 vector 0 quad) v1-31) + (set! (-> a2-3 vector 1 quad) a0-21) + (set! (-> a2-3 vector 2 quad) a1-9) + (set! (-> a2-3 vector 3 quad) a3-5) + ) + ) + ) + ) + (let ((v1-32 (new-stack-vector0))) + 0.0 + (vector-! v1-32 (-> self tpos-curr-adj) (-> self tpos-curr)) + (let* ((f0-2 (vector-dot v1-32 (-> self local-down))) + (f0-3 (if (< 0.0 f0-2) + (* f0-2 (-> *CAMERA_MASTER-bank* up-move-to-pitch-on-ground)) + (* + f0-2 + (-> *CAMERA_MASTER-bank* down-move-to-pitch-on-ground) + ) + ) + ) + ) + (vector+float*! + (-> self tpos-curr-adj) + (-> self tpos-curr) + (-> self local-down) + f0-3 + ) + ) + ) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector--float*! + gp-1 + (-> self tpos-curr-adj) + (-> self local-down) + (-> self target-height) + ) + (TODO-RENAME-17 (-> self target-spline) gp-1 2048.0 0.0 #f) + ) + (TODO-RENAME-22 (-> self target-spline) 40960.0) + ) + ((handle->process (-> self drawable-target)) + (logior! (-> self master-options) 2) + (reset-drawable-tracking) + ) + ) + (the-as symbol (cond + ((handle->process (-> self drawable-target)) + #f + ) + ((and *target* (logtest? (-> self master-options) 2)) + (if (paused?) + (return (the-as symbol #f)) + ) + (cond + ((>= (- (-> *display* base-frame-counter) (if *target* + (-> + *target* + neck + notice-time + ) + 0 + ) + ) + (the-as int (-> *CAMERA-bank* attack-timeout)) + ) + (set! (-> self being-attacked) #f) + ) + (else + (if (not (-> self being-attacked)) + (set! + (-> self attack-start) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (set! (-> self being-attacked) #t) + (when + (and + (zero? (logand (-> self master-options) 64)) + (or + (!= (-> last-try-to-look-at-data horz) 0.0) + (!= (-> last-try-to-look-at-data vert) 0.0) + ) + ) + (set! + (-> self string-max target y) + (fmax + (-> self string-max target y) + (-> last-try-to-look-at-data vert) + ) + ) + (set! + (-> self string-max target z) + (fmax + (-> self string-max target z) + (-> last-try-to-look-at-data horz) + ) + ) + (set! + (-> self string-push-z) + (fmax + (-> self string-push-z) + (-> self string-max target z) + ) + ) + ) + ) + ) + (cond + ((and + (logtest? (-> *target* water flags) 4096) + (zero? (logand (-> *target* water flags) 16)) + ) + (set! (-> self under-water) 2) + ) + ((> (-> self under-water) 0) + (+! (-> self under-water) -1) + ) + ) + (set! (-> self tpos-old quad) (-> self tpos-curr quad)) + (set! + (-> self tpos-old-adj quad) + (-> self tpos-curr-adj quad) + ) + (quaternion->matrix + (-> self tgt-rot-mat) + (-> *target* control dir-targ) + ) + (quaternion->matrix + (-> self tgt-face-mat) + (-> *target* control unknown-quaternion00) + ) + (cond + ((< (-> self ease-t) 1.0) + (new 'stack-no-clear 'vector) + (cond + ((logtest? (-> self master-options) 32) + (vector-lerp! + (-> self tpos-curr) + (-> self ease-from) + (-> self ease-to) + (parameter-ease-sin-clamp (-> self ease-t)) + ) + (set! + (-> self master-options) + (logand -33 (-> self master-options)) + ) + ) + (else + (vector-lerp! + (-> self tpos-curr) + (-> self ease-from) + (target-cam-pos) + (parameter-ease-sin-clamp (-> self ease-t)) + ) + ) + ) + (+! (-> self ease-t) (-> self ease-step)) + ) + (else + (set! (-> self tpos-curr quad) (-> (target-cam-pos) quad)) + ) + ) + (when + (logtest? + (-> *target* control root-prim prim-core action) + 128 + ) + (if *display-cam-los-debug* + (format *stdcon* "ride edge~%") + ) + (let ((s4-2 (new 'stack-no-clear 'collide-mesh-cache-tri)) + (gp-5 (new 'stack-no-clear 'vector)) + (s5-2 (new 'stack-no-clear 'vector)) + ) + (vector--float*! + s5-2 + (-> self tpos-curr) + (-> self local-down) + (-> self target-height) + ) + (vector-float*! gp-5 (-> self tgt-rot-mat vector 2) 4915.2) + (vector-! s5-2 s5-2 gp-5) + (let + ((f0-20 + (dummy-10 + *collide-cache* + s5-2 + gp-5 + 4300.8 + 1 + (the-as process #f) + s4-2 + 4098 + ) + ) + ) + (if (and (< 0.0 f0-20) (< f0-20 1.0)) + (vector+float*! + (-> self tpos-curr) + (-> self tpos-curr) + gp-5 + (+ -1.0 f0-20) + ) + ) + ) + ) + ) + (set! + (-> self on-ground) + (not + (and + (logtest? + (-> *target* control unknown-surface00 flags) + 2048 + ) + (zero? (logand (-> *target* control status) 1)) + ) + ) + ) + (let ((gp-6 (new-stack-vector0))) + 0.0 + (cond + ((and + (and + (logtest? + (-> *target* control unknown-surface00 flags) + 2048 + ) + (zero? (logand (-> *target* control status) 1)) + ) + (!= + (-> *target* control unknown-surface00 name) + 'launch-jump + ) + ) + (if *display-cam-los-debug* + (format *stdcon* "air tracking~%") + ) + (vector+float*! + (-> self tpos-curr-adj) + (-> self tpos-curr-adj) + (-> self local-down) + (-> self upspeed) + ) + (vector+float*! + (-> self tpos-tgt) + (-> self tpos-tgt) + (-> self local-down) + (-> self upspeed) + ) + (vector-! gp-6 (-> self tpos-curr) (-> self tpos-tgt)) + (let ((f30-0 (vector-dot gp-6 (-> self local-down)))) + (vector--float*! gp-6 gp-6 (-> self local-down) f30-0) + (if (< 0.0 f30-0) + (set! (-> self upspeed) (* 0.5 (-> self upspeed))) + ) + (vector+! (-> self tpos-tgt) (-> self tpos-tgt) gp-6) + (let ((f0-30 (* 0.05 f30-0))) + (vector+float*! + (-> self tpos-tgt) + (-> self tpos-tgt) + (-> self local-down) + f0-30 + ) + ) + ) + (vector-! gp-6 (-> self tpos-curr-adj) (-> self tpos-tgt)) + (let* ((f0-32 (vector-dot gp-6 (-> self local-down))) + (f0-33 (if (< 0.0 f0-32) + (* + f0-32 + (-> + *CAMERA_MASTER-bank* + up-move-to-pitch-ratio-in-air + ) + ) + (* + f0-32 + (-> + *CAMERA_MASTER-bank* + down-move-to-pitch-ratio-in-air + ) + ) + ) + ) + ) + (vector+float*! + (-> self tpos-curr-adj) + (-> self tpos-tgt) + (-> self local-down) + f0-33 + ) + ) + (vector-! + gp-6 + (-> *target* control shadow-pos) + (-> self tpos-curr-adj) + ) + (let* ((f0-35 (vector-dot gp-6 (-> self local-down))) + (f0-36 (* 0.03 f0-35)) + ) + (if (and (< f0-36 0.0) (< f0-36 (-> self upspeed))) + (set! (-> self upspeed) f0-36) + ) + ) + ) + (else + (if *display-cam-los-debug* + (format *stdcon* "ground tracking~%") + ) + (vector-! gp-6 (-> self tpos-curr) (-> self tpos-old)) + (let ((f0-38 (vector-dot gp-6 (-> self local-down)))) + (cond + ((logtest? (-> *target* water flags) 512) + (set! (-> self upspeed) 0.0) + ) + ((< 0.0 f0-38) + (set! (-> self upspeed) 0.0) + ) + (else + (set! (-> self upspeed) f0-38) + ) + ) + ) + (set! (-> self tpos-tgt quad) (-> self tpos-curr quad)) + (vector-! + gp-6 + (-> self tpos-curr-adj) + (-> self tpos-curr) + ) + (let* ((f0-42 (vector-dot gp-6 (-> self local-down))) + (f0-43 (if (< 0.0 f0-42) + (* + f0-42 + (-> + *CAMERA_MASTER-bank* + up-move-to-pitch-on-ground + ) + ) + (* + f0-42 + (-> + *CAMERA_MASTER-bank* + down-move-to-pitch-on-ground + ) + ) + ) + ) + ) + (vector+float*! + (-> self tpos-curr-adj) + (-> self tpos-curr) + (-> self local-down) + f0-43 + ) + ) + ) + ) + ) + (if (zero? (logand (-> self slave-options) 16)) + (reset-follow) + ) + (let ((v1-196 (-> *target* water flags))) + (when (and (logtest? v1-196 512) (logtest? v1-196 6144)) + (let + ((f0-45 + (- + (-> *target* water base-height) + (-> self target-height) + ) + ) + ) + (if (< (-> self tpos-curr-adj y) f0-45) + (set! (-> self tpos-curr-adj y) f0-45) + ) + ) + ) + ) + (vector+! + (-> self pitch-off) + (-> self pitch-off) + (-> self tpos-curr) + ) + (vector-! + (-> self pitch-off) + (-> self pitch-off) + (-> self tpos-old) + ) + (vector-float*! + (-> self pitch-off) + (-> self pitch-off) + (-> *CAMERA_MASTER-bank* pitch-off-blend) + ) + (let ((gp-7 (new 'stack-no-clear 'vector))) + (vector--float*! + gp-7 + (-> self tpos-curr-adj) + (-> self local-down) + (-> self target-height) + ) + (let ((v1-207 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! v1-207 (-> *target* control shadow-pos) gp-7) + (let* ((f0-50 (vector-dot v1-207 (-> self local-down))) + (f0-51 (+ -4096.0 f0-50)) + ) + (if (< f0-51 0.0) + (vector+float*! gp-7 gp-7 (-> self local-down) f0-51) + ) + ) + ) + (TODO-RENAME-17 (-> self target-spline) gp-7 2048.0 0.0 #f) + ) + (the-as + symbol + (TODO-RENAME-22 (-> self target-spline) 40960.0) + ) + ) + (*target* + (logior! (-> self master-options) 2) + (reset-target-tracking) + ) + ((logtest? (-> self master-options) 2) + (let + ((v0-1 (the-as symbol (logand -3 (-> self master-options)))) + ) + (set! (-> self master-options) (the-as uint v0-1)) + v0-1 + ) + ) + ) + ) + ) + +(defun + in-cam-entity-volume? + ((arg0 vector) (arg1 entity) (arg2 float) (arg3 symbol)) + (local-vars (sv-16 res-tag)) + (let ((s2-0 0)) + (while #t + (set! sv-16 (new 'static 'res-tag)) + (let + ((v1-1 + (the-as + object + ((method-of-type res-lump get-property-data) + arg1 + arg3 + 'exact + (the float s2-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (cond + ((not (the-as pointer v1-1)) + (return #f) + ) + (else + (dotimes (a0-2 (the-as int (-> sv-16 elt-count))) + (if + (< + arg2 + (- + (vector-dot arg0 (-> (the-as (inline-array vector) v1-1) a0-2)) + (-> (the-as (inline-array vector) v1-1) a0-2 w) + ) + ) + (goto cfg-12) + ) + ) + (return #t) + ) + ) + ) + (label cfg-12) + (+! s2-0 1) + ) + ) + (the-as symbol #f) + ) + +(defbehavior master-unset-region camera-master () + (when (-> self cam-entity) + (set! (-> self cam-entity) #f) + (set! (-> self master-options) (logand -65 (-> self master-options))) + (set! (-> self stringMinHeight) (-> *CAMERA-bank* default-string-min-y)) + (set! (-> self stringMaxHeight) (-> *CAMERA-bank* default-string-max-y)) + (set! (-> self stringMinLength) (-> *CAMERA-bank* default-string-min-z)) + (set! (-> self stringMaxLength) (-> *CAMERA-bank* default-string-max-z)) + (set! (-> self stringCliffHeight) 163840.0) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 1) + (set! (-> a1-0 message) 'point-of-interest) + (set! (-> a1-0 param 0) (the-as uint #f)) + (send-event-function *camera* a1-0) + ) + (set! (-> *camera-combiner* tracking point-of-interest-blend target) 0.0) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query-state) + (set! (-> a1-1 param 0) (the-as uint *camera-base-mode*)) + (when (not (send-event-function *camera* a1-1)) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'change-state) + (set! (-> a1-2 param 0) (the-as uint *camera-base-mode*)) + (set! (-> a1-2 param 1) (the-as uint 450)) + (send-event-function *camera* a1-2) + ) + ) + ) + (set! + (-> *camera-combiner* tracking tilt-adjust target) + (-> *CAMERA-bank* default-tilt-adjust) + ) + (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) 'clear-slave-option) + (set! (-> a1-3 param 0) (the-as uint #x10000)) + (send-event-function *camera* a1-3) + ) + ) + ) + +(defbehavior master-base-region camera-master ((arg0 entity)) + (logior! (-> self master-options) 64) + (set! + (-> self stringMinHeight) + (cam-slave-get-float + arg0 + 'stringMinHeight + (-> *CAMERA-bank* default-string-min-y) + ) + ) + (set! + (-> self stringMaxHeight) + (cam-slave-get-float + arg0 + 'stringMaxHeight + (-> *CAMERA-bank* default-string-max-y) + ) + ) + (set! + (-> self stringMinLength) + (cam-slave-get-float + arg0 + 'stringMinLength + (-> *CAMERA-bank* default-string-min-z) + ) + ) + (set! + (-> self stringMaxLength) + (cam-slave-get-float + arg0 + 'stringMaxLength + (-> *CAMERA-bank* default-string-max-z) + ) + ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (when + (cam-slave-get-vector-with-offset + (the-as entity-actor arg0) + s5-0 + 'interesting + ) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) self) + (set! (-> a1-5 num-params) 1) + (set! (-> a1-5 message) 'point-of-interest) + (set! (-> a1-5 param 0) (the-as uint s5-0)) + (send-event-function *camera* a1-5) + ) + ) + ) + (if (< 405504.0 (-> self stringMaxLength)) + (set! (-> self stringMaxLength) (-> *CAMERA-bank* default-string-max-z)) + ) + (set! + (-> self stringCliffHeight) + (cam-slave-get-float arg0 'stringCliffHeight 163840.0) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) self) + (set! (-> a1-7 num-params) 1) + (set! (-> a1-7 message) 'query-state) + (set! (-> a1-7 param 0) (the-as uint *camera-base-mode*)) + (when (not (send-event-function *camera* a1-7)) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) self) + (set! (-> a1-8 num-params) 2) + (set! (-> a1-8 message) 'change-state) + (set! (-> a1-8 param 0) (the-as uint *camera-base-mode*)) + (set! (-> a1-8 param 1) (the-as uint 450)) + (send-event-function *camera* a1-8) + ) + ) + ) + (when (logtest? #x10000 (cam-slave-get-flags (-> self cam-entity) 'flags)) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) self) + (set! (-> a1-10 num-params) 1) + (set! (-> a1-10 message) 'set-slave-option) + (set! (-> a1-10 param 0) (the-as uint #x10000)) + (send-event-function *camera* a1-10) + ) + ) + (let + ((f0-12 + (cam-slave-get-float + arg0 + 'tiltAdjust + (-> *CAMERA-bank* default-tilt-adjust) + ) + ) + ) + (set! (-> *camera-combiner* tracking tilt-adjust target) f0-12) + f0-12 + ) + ) + +(defun setup-slave-for-hopefull ((arg0 camera-slave)) + (when (= (-> arg0 blend-to-type) 2) + (cam-calc-follow! (-> arg0 tracking) (-> arg0 trans) #f) + (slave-set-rotation! + (-> arg0 tracking) + (-> arg0 trans) + (the-as float (-> arg0 options)) + (-> arg0 fov) + #f + ) + ) + (none) + ) + +(defbehavior + master-is-hopeful-better? camera-master + ((arg0 camera-slave) (arg1 camera-slave)) + (if (not *camera-combiner*) + #f + (< + (vector-dot + (-> arg0 tracking inv-mat vector 2) + (-> *camera-combiner* inv-camera-rot vector 2) + ) + (vector-dot + (-> arg1 tracking inv-mat vector 2) + (-> *camera-combiner* inv-camera-rot vector 2) + ) + ) + ) + ) + +;; 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? +(defbehavior master-switch-to-entity camera-master ((arg0 entity)) + (local-vars + (v0-21 none) + (gp-0 (pointer process)) + (sv-16 res-tag) + (sv-112 process) + (sv-128 string) + (sv-144 string) + ) + (set! (-> self cam-entity) arg0) + 10 + (let ((s4-0 (cam-state-from-entity arg0))) + (cond + ((= s4-0 *camera-base-mode*) + (master-base-region arg0) + (return #t) + ) + (s4-0 + (let ((s3-0 (get-process *camera-dead-pool* camera-slave #x4000))) + (set! gp-0 (when s3-0 + (let ((t9-3 (method-of-type camera-slave activate))) + (t9-3 + (the-as camera-slave s3-0) + self + 'camera-slave + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s3-0 cam-slave-init s4-0 arg0) + (-> s3-0 ppointer) + ) + ) + ) + (when (not gp-0) + (format 0 "ERROR : primary region activate failed~%") + (return #f) + ) + (setup-slave-for-hopefull (the-as camera-slave (ppointer->process gp-0))) + ) + (else + (format + 0 + "ERROR : camera region '~S' didn't produce a state~%" + (res-lump-struct arg0 'name structure) + ) + (return #f) + ) + ) + ) + (set! sv-16 (new 'static 'res-tag)) + (let + ((s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16)))) + (when s4-2 + (dotimes (s3-2 (the-as int (-> sv-16 elt-count))) + (let ((s2-0 (entity-by-name (-> s4-2 s3-2)))) + (set! v0-21 (the-as none (cond + (s2-0 + (let ((s0-0 (cam-state-from-entity s2-0))) + (cond + ((= s0-0 *camera-base-mode*) + (deactivate (-> gp-0 0)) + (master-base-region s2-0) + (return #t) + v0-21 + ) + (else + (the-as none (cond + (s0-0 + (set! + sv-112 + (get-process + *camera-dead-pool* + camera-slave + #x4000 + ) + ) + (let ((s1-0 (when sv-112 + (let + ((t9-15 + (method-of-type + camera-slave + activate + ) + ) + ) + (t9-15 + (the-as + camera-slave + sv-112 + ) + self + 'camera-slave + (the-as + pointer + #x70004000 + ) + ) + ) + (run-now-in-process + sv-112 + cam-slave-init + s0-0 + s2-0 + ) + (-> + sv-112 + ppointer + ) + ) + ) + ) + (the-as none (cond + (s1-0 + (setup-slave-for-hopefull + (the-as + camera-slave + (ppointer->process + s1-0 + ) + ) + ) + (cond + ((master-is-hopeful-better? + (the-as + camera-slave + (ppointer->process + gp-0 + ) + ) + (the-as + camera-slave + (ppointer->process + s1-0 + ) + ) + ) + (deactivate + (-> + gp-0 + 0 + ) + ) + (set! + gp-0 + s1-0 + ) + gp-0 + ) + (else + (deactivate + (-> + s1-0 + 0 + ) + ) + ) + ) + ) + (else + (format + 0 + "ERROR : alternate region activate failed~%" + ) + ) + ) + ) + ) + ) + (else + (let ((s1-1 format) + (s0-1 0) + ) + (set! + sv-128 + "ERROR : alternate camera region '~S' didn't produce a state~%" + ) + (let + ((a2-10 + (res-lump-struct + s2-0 + 'name + structure + ) + ) + ) + (s1-1 s0-1 sv-128 a2-10) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (let ((s2-1 format) + (s1-2 0) + (s0-2 + "ERROR : alternate '~S' not found for '~S'~%" + ) + ) + (set! sv-144 (-> s4-2 s3-2)) + (let + ((a3-8 + (res-lump-struct arg0 'name structure) + ) + ) + (s2-1 s1-2 s0-2 sv-144 a3-8) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (let + ((v1-48 + (the + int + (* + 300.0 + (cam-slave-get-interp-time + (-> (the-as camera-slave (-> gp-0 0)) cam-entity) + ) + ) + ) + ) + ) + (if (nonzero? (-> self force-blend)) + (set! v1-48 (min v1-48 (the-as int (-> self force-blend-time)))) + ) + (let ((a1-16 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-16 from) self) + (set! (-> a1-16 num-params) 2) + (set! (-> a1-16 message) 'change-state) + (set! (-> a1-16 param 0) (the-as uint (ppointer->process gp-0))) + (set! (-> a1-16 param 1) (the-as uint v1-48)) + (send-event-function *camera* a1-16) + ) + ) + #t + ) + +(defbehavior master-check-regions camera-master () + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 1) + (set! (-> a1-0 message) 'query-state) + (set! (-> a1-0 param 0) (the-as uint cam-eye)) + (cond + ((send-event-function *camera* a1-0) + #f + ) + ((or (not *target*) (logtest? (-> self master-options) 1)) + (master-unset-region) + ) + ((and + (logtest? (-> self master-options) 4) + (not (-> self on-ground)) + (or + (not (-> self cam-entity)) + (zero? + (logand #x20000 (cam-slave-get-flags (-> self cam-entity) 'flags)) + ) + ) + ) + #f + ) + ((and + (-> self cam-entity) + (not + (in-cam-entity-volume? + (target-pos 0) + (-> self cam-entity) + 0.0 + 'cutoutvol + ) + ) + (or + (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'pvol) + (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'vol) + (and + (not + ((method-of-type res-lump get-property-data) + (-> self cam-entity) + 'pvol + 'exact + 0.0 + (the-as pointer #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (not + ((method-of-type res-lump get-property-data) + (-> self cam-entity) + 'vol + 'exact + 0.0 + (the-as pointer #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + ) + #f + ) + (else + (let ((v1-17 (-> *camera-engine* alive-list next0))) + *camera-engine* + (let ((gp-5 (-> v1-17 next0))) + (while (!= v1-17 (-> *camera-engine* alive-list-end)) + (let ((s5-1 (-> (the-as connection v1-17) param1))) + (when + (and + (not + (in-cam-entity-volume? + (target-pos 0) + (the-as entity s5-1) + 1024.0 + 'cutoutvol + ) + ) + (in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 0.0 'vol) + ) + (if (master-switch-to-entity (the-as entity s5-1)) + (return #t) + ) + ) + ) + (set! v1-17 gp-5) + *camera-engine* + (set! gp-5 (-> gp-5 next0)) + ) + ) + ) + (master-unset-region) + ) + ) + ) + ) + +;; TODO - fix me +; (defstate cam-master-active (camera-master) +; :event +; (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) +; (local-vars (v0-0 none)) +; (rlet ((vf0 :class vf)) +; (init-vf0-vector) +; (let ((v1-0 arg2)) +; (cond +; ((= v1-0 'dist-from-interp-src) +; (set! v0-0 (the-as none (cond +; ((not *camera-combiner*) +; 409600.0 +; ) +; ((= (-> *camera-combiner* interp-val) 0.0) +; 0.0 +; ) +; (else +; (-> *camera-combiner* dist-from-src) +; ) +; ) +; ) +; ) +; ) +; ((= v1-0 'dist-from-interp-dest) +; (set! v0-0 (the-as none (cond +; ((not *camera-combiner*) +; 0.0 +; ) +; ((= (-> *camera-combiner* interp-val) 0.0) +; 409600.0 +; ) +; (else +; (-> *camera-combiner* dist-from-dest) +; ) +; ) +; ) +; ) +; ) +; ((= v1-0 'level-deactivate) +; (set! +; v0-0 +; (if +; (and +; (-> self cam-entity) +; (= (-> (get-level (-> self cam-entity)) name) (-> arg3 param 0)) +; ) +; (master-unset-region) +; ) +; ) +; ) +; ((= v1-0 'clear-entity) +; (set! v0-0 (the-as none (master-unset-region))) +; ) +; ((= v1-0 'no-intro) +; (set! v0-0 (the-as none 3)) +; (set! (-> self no-intro) (the-as uint v0-0)) +; ) +; ((= v1-0 'force-blend) +; (set! (-> self force-blend) (the-as uint 3)) +; (set! v0-0 (the-as none (-> arg3 param 0))) +; (set! (-> self force-blend-time) (the-as uint v0-0)) +; ) +; ((= v1-0 'teleport-to-transformq) +; (set! v0-0 (when (> arg1 0) +; (let ((gp-1 (the-as object (-> arg3 param 0)))) +; (let ((a1-1 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-1 from) self) +; (set! (-> a1-1 num-params) 2) +; (set! (-> a1-1 message) 'change-state) +; (set! (-> a1-1 param 0) (the-as uint cam-free-floating)) +; (set! (-> a1-1 param 1) (the-as uint 0)) +; (send-event-function self a1-1) +; ) +; (dotimes (s5-1 (-> self num-slaves)) +; (set! +; (-> self slave s5-1 0 trans quad) +; (-> (the-as matrix gp-1) vector 0 quad) +; ) +; (quaternion->matrix +; (the-as matrix (-> self slave s5-1 0 tracking)) +; (the-as quaternion (+ (the-as uint gp-1) 16)) +; ) +; ) +; ) +; (let ((a1-3 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-3 from) self) +; (set! (-> a1-3 num-params) 0) +; (set! (-> a1-3 message) 'teleport) +; (send-event-function self a1-3) +; ) +; ) +; ) +; ) +; ((= v1-0 'teleport-to-other-start-string) +; (let ((gp-2 (new 'stack-no-clear 'vector))) +; (set! (-> *camera-combiner* trans quad) (-> *camera-other-trans* quad)) +; (vector-! gp-2 (-> self tpos-curr-adj) *camera-other-trans*) +; (vector-normalize! gp-2 1.0) +; (forward-down->inv-matrix +; (-> *camera-combiner* inv-camera-rot) +; gp-2 +; (new 'static 'vector :y -1.0) +; ) +; ) +; (let ((a1-8 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-8 from) self) +; (set! (-> a1-8 num-params) 2) +; (set! (-> a1-8 message) 'change-state) +; (set! (-> a1-8 param 0) (the-as uint cam-free-floating)) +; (set! (-> a1-8 param 1) (the-as uint 0)) +; (send-event-function self a1-8) +; ) +; (let ((a1-9 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-9 from) self) +; (set! (-> a1-9 num-params) 0) +; (set! (-> a1-9 message) 'teleport) +; (send-event-function self a1-9) +; ) +; (let ((a1-10 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-10 from) self) +; (set! (-> a1-10 num-params) 2) +; (set! (-> a1-10 message) 'change-state) +; (set! (-> a1-10 param 0) (the-as uint *camera-base-mode*)) +; (set! (-> a1-10 param 1) (the-as uint 0)) +; (set! v0-0 (the-as none (send-event-function self a1-10))) +; ) +; ) +; ((= v1-0 'teleport-to-vector-start-string) +; (set! v0-0 (when (> arg1 0) +; (let ((v1-43 (the-as object (-> arg3 param 0))) +; (gp-3 (new 'stack-no-clear 'vector)) +; ) +; (set! +; (-> *camera-combiner* trans quad) +; (-> (the-as vector v1-43) quad) +; ) +; (vector-! +; gp-3 +; (-> self tpos-curr-adj) +; (the-as vector v1-43) +; ) +; (vector-normalize! gp-3 1.0) +; (forward-down->inv-matrix +; (-> *camera-combiner* inv-camera-rot) +; gp-3 +; (new 'static 'vector :y -1.0) +; ) +; ) +; (let ((a1-17 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-17 from) self) +; (set! (-> a1-17 num-params) 2) +; (set! (-> a1-17 message) 'change-state) +; (set! (-> a1-17 param 0) (the-as uint cam-free-floating)) +; (set! (-> a1-17 param 1) (the-as uint 0)) +; (send-event-function self a1-17) +; ) +; (let ((a1-18 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-18 from) self) +; (set! (-> a1-18 num-params) 2) +; (set! (-> a1-18 message) 'change-state) +; (set! (-> a1-18 param 0) (the-as uint *camera-base-mode*)) +; (set! (-> a1-18 param 1) (the-as uint 0)) +; (send-event-function self a1-18) +; ) +; ) +; ) +; ) +; ((= v1-0 'change-pov) +; (let ((v1-52 (the-as object (-> arg3 param 0)))) +; (cond +; ((< arg1 2) +; (set! (-> self pov-bone) 0) +; 0 +; ) +; (else +; (set! (-> self pov-bone) (the-as int (-> arg3 param 1))) +; ) +; ) +; (set! v0-0 (cond +; ((not (the-as uint v1-52)) +; (set! (-> self pov-handle) (the-as handle #f)) +; #f +; ) +; (else +; (set! +; v0-0 +; (the-as none (process->handle (the-as uint v1-52))) +; ) +; (set! (-> self pov-handle) (the-as handle v0-0)) +; v0-0 +; ) +; ) +; ) +; ) +; ) +; ((= v1-0 'change-target-bone) +; (set! v0-0 (the-as none (-> arg3 param 0))) +; (set! (-> self which-bone) (the-as int v0-0)) +; ) +; ((= v1-0 'change-target) +; (let ((v1-56 (the-as object (-> arg3 param 0)))) +; (cond +; ((< arg1 2) +; (set! (-> self which-bone) 0) +; 0 +; ) +; (else +; (set! (-> self which-bone) (the-as int (-> arg3 param 1))) +; ) +; ) +; (cond +; ((not (the-as uint v1-56)) +; (set! (-> self drawable-target) (the-as handle #f)) +; (set! (-> self master-options) (logand -3 (-> self master-options))) +; ) +; ((= (the-as uint v1-56) *target*) +; (set! (-> self drawable-target) (the-as handle #f)) +; (logior! (-> self master-options) 2) +; (reset-target-tracking) +; ) +; (else +; (set! (-> self drawable-target) (process->handle (the-as uint v1-56))) +; (logior! (-> self master-options) 2) +; (reset-drawable-tracking) +; ) +; ) +; ) +; (set! (-> *camera-combiner* tracking no-follow) #f) +; (set! v0-0 (the-as none #f)) +; ) +; ((= v1-0 'reset-root) +; (dotimes (gp-4 (-> self num-slaves)) +; (set! (-> self slave gp-4 0 trans quad) (the-as uint128 0)) +; (matrix-identity! (the-as matrix (-> self slave gp-4 0 tracking))) +; ) +; (vector-reset! (-> *camera-combiner* trans)) +; (set! +; v0-0 +; (the-as +; none +; (matrix-identity! (the-as matrix (-> *camera-combiner* tracking))) +; ) +; ) +; ) +; ((= v1-0 'set-fov) +; (set! +; (-> *camera-combiner* fov) +; (the-as float (gpr->fpr (-> arg3 param 0))) +; ) +; (dotimes (v1-86 (-> self num-slaves)) +; (set! +; (-> self slave v1-86 0 fov) +; (the-as float (gpr->fpr (-> arg3 param 0))) +; ) +; ) +; (set! v0-0 (the-as none #f)) +; ) +; ((= v1-0 'query-fov) +; (set! v0-0 (the-as none (if (> (-> self num-slaves) 0) +; (-> self slave 0 0 fov) +; 11650.845 +; ) +; ) +; ) +; ) +; ((= v1-0 'intro-done?) +; (set! v0-0 (the-as none #t)) +; (dotimes (v1-91 (-> self num-slaves)) +; (if (< (-> self slave v1-91 0 intro-t) 1.0) +; (set! v0-0 (the-as none #f)) +; ) +; ) +; ) +; ((= v1-0 'query-state) +; (let ((v1-95 (+ (-> self num-slaves) -1))) +; (while +; (not +; (or +; (< v1-95 0) +; (= (-> self slave v1-95 0 next-state) (-> arg3 param 0)) +; ) +; ) +; (+! v1-95 -1) +; ) +; (set! +; v0-0 +; (and +; (>= v1-95 0) +; (= (-> self slave v1-95 0 next-state) (-> arg3 param 0)) +; ) +; ) +; ) +; ) +; ((= v1-0 'change-to-entity-by-name) +; (let ((a0-75 (entity-by-name (the-as string (-> arg3 param 0))))) +; (set! v0-0 (the-as none (if a0-75 +; (master-switch-to-entity a0-75) +; (format +; 0 +; "ERROR : camera entity '~S' not found for change-to-entity-by-name~%" +; (-> arg3 param 0) +; ) +; ) +; ) +; ) +; ) +; ) +; ((= v1-0 'change-state) +; (let ((s1-0 (the-as uint #f)) +; (s2-0 (the-as (pointer process) #f)) +; (s5-2 (the-as (pointer camera-slave) #f)) +; ) +; (let ((s3-0 (the-as object #f)) +; (s4-1 (the-as (pointer camera-slave) #f)) +; ) +; (let ((t9-22 type-type?) +; (v1-101 (-> arg3 param 0)) +; ) +; (cond +; ((t9-22 (rtype-of v1-101) state) +; (set! s1-0 (-> arg3 param 0)) +; ) +; ((let ((t9-23 type-type?) +; (v1-103 (-> arg3 param 0)) +; ) +; (t9-23 (rtype-of v1-103) camera-slave) +; ) +; (set! s2-0 (process->ppointer (-> arg3 param 0))) +; ) +; (else +; (let ((t9-24 format) +; (a0-82 0) +; (a1-25 +; "ERROR : invalid type '~A' to *camera* change-state~%" +; ) +; (v1-106 (-> arg3 param 0)) +; ) +; (t9-24 a0-82 a1-25 (rtype-of v1-106)) +; ) +; ) +; ) +; ) +; (if +; (and +; (> (-> self num-slaves) 0) +; (or +; (= (-> self slave 0 0 next-state name) 'cam-stick) +; (= (-> self slave 0 0 next-state name) 'cam-string) +; ) +; ) +; (set! +; (-> self view-off-param-save) +; (-> self slave 0 0 view-off-param) +; ) +; ) +; (set! (-> self changer) (the-as uint (process->ppointer arg0))) +; (cond +; ((<= (-> self num-slaves) 0) +; (cond +; (s2-0 +; (let ((a1-26 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-26 from) self) +; (set! (-> a1-26 num-params) 1) +; (set! (-> a1-26 message) 'slave-activated) +; (let ((v1-126 s2-0)) +; (set! (-> a1-26 param 0) (the-as uint (if v1-126 +; (-> +; (the-as +; camera-slave +; (-> v1-126 0) +; ) +; self +; ) +; ) +; ) +; ) +; ) +; (send-event-function self a1-26) +; ) +; ) +; (else +; (let +; ((gp-5 +; (the-as +; camera-slave +; (get-process *camera-dead-pool* camera-slave #x4000) +; ) +; ) +; ) +; (set! s2-0 (when gp-5 +; (let ((t9-27 (method-of-type camera-slave activate))) +; (t9-27 +; gp-5 +; self +; 'camera-slave +; (the-as pointer #x70004000) +; ) +; ) +; (run-now-in-process gp-5 cam-slave-init s1-0 #f) +; (-> gp-5 ppointer) +; ) +; ) +; ) +; (cond +; (s2-0 +; ) +; (else +; (format 0 "ERROR : replacement slave failed to activate~%") +; ) +; ) +; ) +; ) +; (when s2-0 +; (let ((a1-31 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-31 from) self) +; (set! (-> a1-31 num-params) 0) +; (set! (-> a1-31 message) 'stop-tracking) +; (send-event-function *camera-combiner* a1-31) +; ) +; (when (= (-> (the-as camera-slave (-> s2-0 0)) blend-to-type) 2) +; (let ((a1-32 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-32 from) self) +; (set! (-> a1-32 num-params) 1) +; (set! (-> a1-32 message) 'start-tracking) +; (set! (-> a1-32 param 0) (the-as uint (if s2-0 +; (-> +; (the-as +; camera-slave +; (-> s2-0 0) +; ) +; self +; ) +; ) +; ) +; ) +; (send-event-function *camera-combiner* a1-32) +; ) +; ) +; ) +; ) +; ((zero? (-> arg3 param 1)) +; (if *math-camera* +; (set! (-> *math-camera* reset) 1) +; ) +; (when (< 1 (-> self num-slaves)) +; (if (= (-> self changer) (-> self slave 1)) +; (set! s5-2 (-> self slave 1)) +; (deactivate (-> self slave 1 0)) +; ) +; (set! (-> self slave 1) (the-as (pointer camera-slave) #f)) +; (+! (-> self num-slaves) -1) +; ) +; (cond +; (s2-0 +; (if (= (-> self changer) (-> self slave 0)) +; (set! s5-2 (-> self slave 0)) +; (deactivate (-> self slave 0 0)) +; ) +; (set! (-> self slave 0) (the-as (pointer camera-slave) #f)) +; (+! (-> self num-slaves) -1) +; (let ((a1-33 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-33 from) self) +; (set! (-> a1-33 num-params) 1) +; (set! (-> a1-33 message) 'slave-activated) +; (let ((v1-166 s2-0)) +; (set! (-> a1-33 param 0) (the-as uint (if v1-166 +; (-> +; (the-as +; camera-slave +; (-> v1-166 0) +; ) +; self +; ) +; ) +; ) +; ) +; ) +; (send-event-function self a1-33) +; ) +; ) +; ((not +; (and +; (= (-> self slave 0 0 next-state) *camera-base-mode*) +; (= (-> self slave 0 0 next-state) s1-0) +; ) +; ) +; (let ((a1-34 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-34 from) self) +; (set! (-> a1-34 num-params) 1) +; (set! (-> a1-34 message) 'change-state-no-go) +; (set! (-> a1-34 param 0) s1-0) +; (send-event-function (ppointer->process (-> self slave 0)) a1-34) +; ) +; (set! s4-1 (-> self slave 0)) +; (set! s3-0 s1-0) +; (set! s2-0 (-> self slave 0)) +; ) +; ) +; (when s2-0 +; (let ((a1-35 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-35 from) self) +; (set! (-> a1-35 num-params) 0) +; (set! (-> a1-35 message) 'stop-tracking) +; (send-event-function *camera-combiner* a1-35) +; ) +; (when (= (-> (the-as camera-slave (-> s2-0 0)) blend-to-type) 2) +; (let ((a1-36 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-36 from) self) +; (set! (-> a1-36 num-params) 1) +; (set! (-> a1-36 message) 'start-tracking) +; (let ((v1-191 s2-0)) +; (set! (-> a1-36 param 0) (the-as uint (if v1-191 +; (-> +; (the-as +; camera-slave +; (-> v1-191 0) +; ) +; self +; ) +; ) +; ) +; ) +; ) +; (send-event-function *camera-combiner* a1-36) +; ) +; ) +; ) +; ) +; (else +; (when (< 1 (-> self num-slaves)) +; (if (= (-> self changer) (-> self slave 0)) +; (set! s5-2 (-> self slave 0)) +; (deactivate (-> self slave 0 0)) +; ) +; (set! (-> self slave 0) (-> self slave 1)) +; (set! (-> self slave 1) (the-as (pointer camera-slave) #f)) +; (+! (-> self num-slaves) -1) +; ) +; (when (< 0.0 (-> self slave 0 0 intro-t-step)) +; (set! (-> self outro-t) (-> self slave 0 0 intro-t)) +; (set! (-> self outro-t-step) (/ -5.0 (the float (-> arg3 param 1)))) +; (set! +; (-> self outro-exit-value) +; (-> self slave 0 0 outro-exit-value) +; ) +; (curve-copy! (-> self outro-curve) (-> self slave 0 0 intro-curve)) +; ) +; (if (nonzero? (-> self no-intro)) +; (set! (-> self outro-t) 0.0) +; ) +; (when +; (not +; (and +; (= (-> self slave 0 0 next-state) *camera-base-mode*) +; (= (-> self slave 0 0 next-state) s1-0) +; ) +; ) +; (cond +; (s2-0 +; (let ((a1-38 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-38 from) self) +; (set! (-> a1-38 num-params) 1) +; (set! (-> a1-38 message) 'slave-activated) +; (let ((v1-228 s2-0)) +; (set! (-> a1-38 param 0) (the-as uint (if v1-228 +; (-> +; (the-as +; camera-slave +; (-> v1-228 0) +; ) +; self +; ) +; ) +; ) +; ) +; ) +; (send-event-function self a1-38) +; ) +; ) +; (else +; (let ((s2-1 (get-process *camera-dead-pool* camera-slave #x4000))) +; (set! s2-0 (when s2-1 +; (let ((t9-42 (method-of-type camera-slave activate))) +; (t9-42 +; (the-as camera-slave s2-1) +; self +; 'camera-slave +; (the-as pointer #x70004000) +; ) +; ) +; (run-now-in-process s2-1 cam-slave-init s1-0 #f) +; (-> s2-1 ppointer) +; ) +; ) +; ) +; (cond +; (s2-0 +; ) +; (else +; (format #t "ERROR : secondary slave activate failed~%") +; ) +; ) +; ) +; ) +; (when s2-0 +; (let ((a1-43 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-43 from) self) +; (set! (-> a1-43 num-params) 1) +; (set! (-> a1-43 message) 'set-interpolation) +; (set! (-> a1-43 param 0) (-> arg3 param 1)) +; (send-event-function *camera-combiner* a1-43) +; ) +; (set! s4-1 (-> self slave 0)) +; (cond +; ((zero? (-> self slave 0 0 blend-from-type)) +; (let ((a1-44 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-44 from) self) +; (set! (-> a1-44 num-params) 1) +; (set! (-> a1-44 message) 'change-state-no-go) +; (set! (-> a1-44 param 0) (the-as uint cam-fixed)) +; (send-event-function +; (ppointer->process (-> self slave 0)) +; a1-44 +; ) +; ) +; (let ((a1-45 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-45 from) self) +; (set! (-> a1-45 num-params) 0) +; (set! (-> a1-45 message) 'stop-tracking) +; (send-event-function *camera-combiner* a1-45) +; ) +; (set! s3-0 cam-fixed) +; ) +; (else +; (let ((a1-46 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-46 from) self) +; (set! (-> a1-46 num-params) 1) +; (set! (-> a1-46 message) 'change-state-no-go) +; (set! (-> a1-46 param 0) (the-as uint cam-decel)) +; (send-event-function +; (ppointer->process (-> self slave 0)) +; a1-46 +; ) +; ) +; (set! s3-0 cam-decel) +; ) +; ) +; (let ((v1-261 (-> *camera-combiner* tracking-status))) +; (cond +; ((zero? v1-261) +; (let +; ((v1-263 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) +; (cond +; ((zero? v1-263) +; ) +; ((= v1-263 1) +; ) +; ((= v1-263 2) +; (cond +; ((= (-> self slave 0 0 blend-from-type) 1) +; (let ((a1-47 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-47 from) self) +; (set! (-> a1-47 num-params) 1) +; (set! (-> a1-47 message) 'copy-tracking) +; (set! +; (-> a1-47 param 0) +; (the-as uint (ppointer->process (-> self slave 0))) +; ) +; (send-event-function *camera-combiner* a1-47) +; ) +; ) +; (else +; (let ((a1-48 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-48 from) self) +; (set! (-> a1-48 num-params) 1) +; (set! (-> a1-48 message) 'start-tracking) +; (set! +; (-> a1-48 param 0) +; (the-as uint (ppointer->process (-> self slave 0))) +; ) +; (send-event-function *camera-combiner* a1-48) +; ) +; ) +; ) +; (set! (-> *camera-combiner* tracking-status) (the-as uint 2)) +; ) +; ) +; ) +; ) +; ((= v1-261 1) +; (let +; ((v1-280 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) +; (cond +; ((zero? v1-280) +; (set! (-> *camera-combiner* tracking-status) (the-as uint 3)) +; ) +; ((= v1-280 1) +; (set! (-> *camera-combiner* tracking-status) (the-as uint 3)) +; ) +; ((= v1-280 2) +; ) +; ) +; ) +; ) +; ((= v1-261 2) +; (let +; ((v1-286 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) +; (cond +; ((zero? v1-286) +; (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) +; 0 +; ) +; ((= v1-286 1) +; (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) +; 0 +; ) +; ((= v1-286 2) +; ) +; ) +; ) +; ) +; ((= v1-261 3) +; (let +; ((v1-295 (-> (the-as camera-slave (-> s2-0 0)) blend-to-type))) +; (cond +; ((zero? v1-295) +; (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) +; 0 +; ) +; ((= v1-295 1) +; (set! (-> *camera-combiner* tracking-status) (the-as uint 0)) +; 0 +; ) +; ((= v1-295 2) +; (set! (-> *camera-combiner* tracking-status) (the-as uint 2)) +; ) +; ) +; ) +; ) +; ) +; ) +; ) +; ) +; ) +; ) +; (when s4-1 +; (let ((a1-49 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-49 from) self) +; (set! (-> a1-49 num-params) 1) +; (set! (-> a1-49 message) 'go) +; (set! (-> a1-49 param 0) (the-as uint s3-0)) +; (send-event-function (the-as process (if s4-1 +; (-> +; (the-as +; camera-slave +; (-> s4-1 0) +; ) +; self +; ) +; ) +; ) +; a1-49 +; ) +; ) +; ) +; ) +; (if s5-2 +; (deactivate (-> s5-2 0)) +; ) +; ) +; (set! v0-0 (the-as none #t)) +; ) +; ((= v1-0 'slave-activated) +; (set! v0-0 (cond +; ((< (-> self num-slaves) 2) +; (set! +; (-> self slave (-> self num-slaves)) +; (the-as +; (pointer camera-slave) +; (process->ppointer (-> arg3 param 0)) +; ) +; ) +; (+! (-> self num-slaves) 1) +; (logior! (-> self master-options) 8) +; (let +; ((f0-15 +; (-> (the-as projectile (-> arg3 param 0)) max-turn) +; ) +; ) +; (set! +; (-> *camera-combiner* tracking tilt-adjust target) +; f0-15 +; ) +; f0-15 +; ) +; ) +; (else +; (format +; 0 +; "ERROR: ERROR : Exceeded maximum number of camera slaves!~%" +; ) +; (deactivate (-> arg3 param 0)) +; ) +; ) +; ) +; ) +; ((= v1-0 'ease-in) +; (cond +; ((< arg1 1) +; (set! (-> self ease-t) 0.0) +; (set! (-> self master-options) (logand -33 (-> self master-options))) +; ) +; ((< arg1 2) +; (if (< (the-as float (gpr->fpr (-> arg3 param 0))) (-> self ease-t)) +; (set! (-> self ease-t) (the-as float (gpr->fpr (-> arg3 param 0)))) +; ) +; (set! (-> self master-options) (logand -33 (-> self master-options))) +; ) +; (else +; (if (< (the-as float (gpr->fpr (-> arg3 param 0))) (-> self ease-t)) +; (set! (-> self ease-t) (the-as float (gpr->fpr (-> arg3 param 0)))) +; ) +; (set! +; (-> self ease-to quad) +; (-> (the-as vector (-> arg3 param 1)) quad) +; ) +; (logior! (-> self master-options) 32) +; ) +; ) +; (set! (-> self ease-step) 0.033333335) +; (set! v0-0 (the-as none (-> self ease-from))) +; (set! (-> (the-as vector v0-0) quad) (-> self tpos-curr-adj quad)) +; ) +; ((= v1-0 'damp-up) +; (let ((f0-22 0.0)) +; (set! (-> self upspeed) f0-22) +; (set! v0-0 (the-as none f0-22)) +; ) +; ) +; ((= v1-0 'reset-follow) +; (set! v0-0 (the-as none (if (handle->process (-> self drawable-target)) +; (reset-drawable-follow) +; (reset-follow) +; ) +; ) +; ) +; ) +; ((= v1-0 'teleport) +; (cond +; ((and +; (logtest? (-> self master-options) 2) +; (handle->process (-> self drawable-target)) +; ) +; (reset-drawable-tracking) +; ) +; ((and *target* (logtest? (-> self master-options) 2)) +; (reset-target-tracking) +; ) +; ) +; (countdown (gp-6 (-> self num-slaves)) +; (let ((a1-53 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-53 from) self) +; (set! (-> a1-53 num-params) 0) +; (set! (-> a1-53 message) arg2) +; (send-event-function (ppointer->process (-> self slave gp-6)) a1-53) +; ) +; ) +; (let ((a1-54 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-54 from) self) +; (set! (-> a1-54 num-params) 0) +; (set! (-> a1-54 message) arg2) +; (set! v0-0 (the-as none (send-event-function *camera-combiner* a1-54))) +; ) +; ) +; ((= v1-0 'toggle-slave-option) +; (set! +; (-> self slave-options) +; (logxor (-> self slave-options) (-> arg3 param 0)) +; ) +; (let ((a0-193 (-> self slave 0)) +; (v1-360 (-> self slave 1)) +; ) +; (if a0-193 +; (set! +; (-> a0-193 0 options) +; (logxor (-> a0-193 0 options) (-> arg3 param 0)) +; ) +; ) +; (set! v0-0 (when v1-360 +; (set! +; v0-0 +; (the-as +; none +; (logxor (-> v1-360 0 options) (-> arg3 param 0)) +; ) +; ) +; (set! (-> v1-360 0 options) (the-as uint v0-0)) +; v0-0 +; ) +; ) +; ) +; ) +; (else +; (set! v0-0 (cond +; ((= v1-0 'slave-option?) +; (if (nonzero? (-> self num-slaves)) +; (logtest? +; (-> self slave (+ (-> self num-slaves) -1) 0 options) +; (-> arg3 param 0) +; ) +; ) +; ) +; ((= v1-0 'set-slave-option) +; (when (nonzero? (-> self num-slaves)) +; (set! +; v0-0 +; (the-as +; none +; (logior +; (-> self slave (+ (-> self num-slaves) -1) 0 options) +; (-> arg3 param 0) +; ) +; ) +; ) +; (set! +; (-> self slave (+ (-> self num-slaves) -1) 0 options) +; (the-as uint v0-0) +; ) +; v0-0 +; ) +; ) +; ((= v1-0 'clear-slave-option) +; (when (nonzero? (-> self num-slaves)) +; (set! +; v0-0 +; (the-as +; none +; (logclear +; (-> self slave (+ (-> self num-slaves) -1) 0 options) +; (-> arg3 param 0) +; ) +; ) +; ) +; (set! +; (-> self slave (+ (-> self num-slaves) -1) 0 options) +; (the-as uint v0-0) +; ) +; v0-0 +; ) +; ) +; ((= v1-0 'no-follow) +; (when (nonzero? (-> self num-slaves)) +; (set! +; (-> +; self +; slave +; (+ (-> self num-slaves) -1) +; 0 +; tracking +; no-follow +; ) +; #t +; ) +; (vector-reset! +; (-> +; self +; slave +; (+ (-> self num-slaves) -1) +; 0 +; tracking +; follow-off +; ) +; ) +; ) +; (set! (-> *camera-combiner* tracking no-follow) #t) +; (set! +; v0-0 +; (the-as none (-> *camera-combiner* tracking follow-off)) +; ) +; (.svf (&-> (the-as vector v0-0) quad) vf0) +; v0-0 +; ) +; ((= v1-0 'yes-follow) +; (if (nonzero? (-> self num-slaves)) +; (set! +; (-> +; self +; slave +; (+ (-> self num-slaves) -1) +; 0 +; tracking +; no-follow +; ) +; #f +; ) +; ) +; (set! (-> *camera-combiner* tracking no-follow) #f) +; #f +; ) +; ((= v1-0 'blend-from-as-fixed) +; (when (nonzero? (-> self num-slaves)) +; (set! +; (-> +; self +; slave +; (+ (-> self num-slaves) -1) +; 0 +; blend-from-type +; ) +; (the-as uint 0) +; ) +; 0 +; ) +; ) +; ((= v1-0 'point-of-interest) +; (when (nonzero? (-> self num-slaves)) +; (let ((a1-60 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-60 from) arg0) +; (set! (-> a1-60 num-params) arg1) +; (set! (-> a1-60 message) arg2) +; (set! (-> a1-60 param 0) (-> arg3 param 0)) +; (set! (-> a1-60 param 1) (-> arg3 param 1)) +; (set! (-> a1-60 param 2) (-> arg3 param 2)) +; (set! (-> a1-60 param 3) (-> arg3 param 3)) +; (set! (-> a1-60 param 4) (-> arg3 param 4)) +; (set! (-> a1-60 param 5) (-> arg3 param 5)) +; (set! (-> a1-60 param 6) (-> arg3 param 6)) +; (send-event-function +; (ppointer->process +; (-> self slave (+ (-> self num-slaves) -1)) +; ) +; a1-60 +; ) +; ) +; ) +; (let ((a1-61 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-61 from) arg0) +; (set! (-> a1-61 num-params) arg1) +; (set! (-> a1-61 message) arg2) +; (set! (-> a1-61 param 0) (-> arg3 param 0)) +; (set! (-> a1-61 param 1) (-> arg3 param 1)) +; (set! (-> a1-61 param 2) (-> arg3 param 2)) +; (set! (-> a1-61 param 3) (-> arg3 param 3)) +; (set! (-> a1-61 param 4) (-> arg3 param 4)) +; (set! (-> a1-61 param 5) (-> arg3 param 5)) +; (set! (-> a1-61 param 6) (-> arg3 param 6)) +; (send-event-function *camera-combiner* a1-61) +; ) +; ) +; ((= v1-0 'part-water-drip) +; (set! +; (-> self water-drip-time) +; (the-as uint (-> *display* base-frame-counter)) +; ) +; (set! +; (-> self water-drip-mult) +; (the-as float (gpr->fpr (-> arg3 param 0))) +; ) +; (let ((f0-24 (the-as float (-> arg3 param 1)))) +; (set! (-> self water-drip-speed) f0-24) +; f0-24 +; ) +; ) +; (else +; (countdown (s3-1 (-> self num-slaves)) +; (let ((a1-62 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-62 from) arg0) +; (set! (-> a1-62 num-params) arg1) +; (set! (-> a1-62 message) arg2) +; (set! (-> a1-62 param 0) (-> arg3 param 0)) +; (set! (-> a1-62 param 1) (-> arg3 param 1)) +; (set! (-> a1-62 param 2) (-> arg3 param 2)) +; (set! (-> a1-62 param 3) (-> arg3 param 3)) +; (set! (-> a1-62 param 4) (-> arg3 param 4)) +; (set! (-> a1-62 param 5) (-> arg3 param 5)) +; (set! (-> a1-62 param 6) (-> arg3 param 6)) +; (send-event-function +; (ppointer->process (-> self slave s3-1)) +; a1-62 +; ) +; ) +; ) +; #f +; ) +; ) +; ) +; ) +; ) +; ) +; (the-as object v0-0) +; ) +; ) +; :enter +; (behavior () +; (if (and (nonzero? camera-master-debug) *debug-segment*) +; (add-connection *debug-engine* self camera-master-debug self #f #f) +; ) +; (none) +; ) +; :trans +; (behavior () +; (when (not (paused?)) +; (vector-negate! +; (-> self local-down) +; (vector-normalize-copy! +; (-> self local-down) +; (-> *standard-dynamics* gravity) +; 1.0 +; ) +; ) +; (cam-master-effect) +; ) +; (none) +; ) +; :code +; (behavior () +; (while #t +; (if (and *dproc* *debug-segment*) +; (add-frame +; (-> *display* frames (-> *display* on-screen) frame profile-bar 0) +; 'camera +; (new 'static 'rgba :r #x40 :b #x40 :a #x80) +; ) +; ) +; (set! (-> self string-min target y) (-> self stringMinHeight)) +; (set! (-> self string-max target y) (-> self stringMaxHeight)) +; (set! (-> self string-min target z) (-> self stringMinLength)) +; (set! (-> self string-max target z) (-> self stringMaxLength)) +; (set! +; (-> self string-push-z) +; (fmax +; (-> self string-min value z) +; (-> *CAMERA-bank* default-string-push-z) +; ) +; ) +; (master-track-target) +; (set! (-> last-try-to-look-at-data horz) 0.0) +; (set! (-> last-try-to-look-at-data vert) 0.0) +; (let ((a1-1 (new 'stack-no-clear 'event-message-block))) +; (set! (-> a1-1 from) self) +; (set! (-> a1-1 num-params) 1) +; (set! (-> a1-1 message) 'slave-option?) +; (set! (-> a1-1 param 0) (the-as uint #x4000)) +; (when (send-event-function *camera* a1-1) +; (set! (-> self string-min target y) 18432.0) +; (set! (-> self string-max target y) 18432.041) +; ) +; ) +; (when (not (paused?)) +; (update! (-> self string-min) (the-as vector #f)) +; (update! (-> self string-max) (the-as vector #f)) +; (master-check-regions) +; ) +; (set! +; (-> self string-min value x) +; (fmin (-> self string-min value x) (+ -4.096 (-> self string-max value x))) +; ) +; (set! +; (-> self string-min value y) +; (fmin (-> self string-min value y) (+ -4.096 (-> self string-max value y))) +; ) +; (set! +; (-> self string-min value z) +; (fmin (-> self string-min value z) (+ -4.096 (-> self string-max value z))) +; ) +; (if (nonzero? (-> self no-intro)) +; (+! (-> self no-intro) -1) +; ) +; (if (nonzero? (-> self force-blend)) +; (+! (-> self force-blend) -1) +; ) +; (suspend) +; ) +; (none) +; ) +; ) + +(deftype list-keeper (process) + ((dummy float :offset-assert 112) + ) + :heap-base #x10 + :method-count-assert 14 + :size-assert #x74 + :flag-assert #xe00100074 + ) + + +(defstate list-keeper-active (camera-master) + :code + (behavior () + (while #t + (change-to-last-brother self) + (suspend) + ) + (none) + ) + ) + +(defbehavior list-keeper-init camera-master () + (go list-keeper-active) + 0 + (none) + ) + +(defbehavior cam-master-init camera-master () + (set! *camera* self) + (stack-size-set! (-> self main-thread) 512) + (logclear! (-> self mask) (process-mask menu)) + (set! (-> self master-options) (the-as uint 4)) + (set! (-> self num-slaves) 0) + (dotimes (v1-5 2) + (set! (-> self slave v1-5) (the-as (pointer camera-slave) #f)) + ) + (set! (-> self slave-options) (the-as uint 560)) + (set! (-> self view-off-param-save) 1.0) + (set! (-> self changer) (the-as uint (process->ppointer self))) + (set! (-> self cam-entity) #f) + (set! (-> self stringMinHeight) (-> *CAMERA-bank* default-string-min-y)) + (set! (-> self stringMaxHeight) (-> *CAMERA-bank* default-string-max-y)) + (set! (-> self stringMinLength) (-> *CAMERA-bank* default-string-min-z)) + (set! (-> self stringMaxLength) (-> *CAMERA-bank* default-string-max-z)) + (set! (-> self stringCliffHeight) 163840.0) + (set! (-> self no-intro) (the-as uint 0)) + (set! (-> self force-blend) (the-as uint 0)) + (set! (-> self string-push-z) (-> *CAMERA-bank* default-string-push-z)) + (let ((gp-0 (new-stack-vector0))) + (set! (-> gp-0 y) (-> *CAMERA-bank* default-string-min-y)) + (set! (-> gp-0 z) (-> *CAMERA-bank* default-string-min-z)) + (init! (-> self string-min) gp-0 40.96 409.6 0.9) + (set! (-> gp-0 y) (-> *CAMERA-bank* default-string-max-y)) + (set! (-> gp-0 z) (-> *CAMERA-bank* default-string-max-z)) + (init! (-> self string-max) gp-0 40.96 409.6 0.9) + ) + (set! (-> self outro-t-step) 0.0) + (set! (-> self drawable-target) (the-as handle #f)) + (set! (-> self which-bone) 0) + (let ((a1-3 (new-stack-vector0))) + (TODO-RENAME-10 (-> self target-spline) a1-3) + ) + (set! (-> self pov-handle) (the-as handle #f)) + (set! (-> self pov-bone) 0) + (let ((gp-1 (get-process *camera-dead-pool* list-keeper #x4000))) + (cond + ((when gp-1 + (let ((t9-5 (method-of-type list-keeper activate))) + (t9-5 + (the-as list-keeper gp-1) + self + 'list-keeper + (the-as pointer #x70004000) + ) + ) + (run-next-time-in-process gp-1 list-keeper-init) + (-> gp-1 ppointer) + ) + ) + (else + (format 0 "ERROR : master camera list keeper failed to activate~%") + ) + ) + ) + (let ((gp-2 (get-process *camera-dead-pool* camera-slave #x4000))) + (cond + ((when gp-2 + (let ((t9-9 (method-of-type camera-slave activate))) + (t9-9 + (the-as camera-slave gp-2) + self + 'camera-slave + (the-as pointer #x70004000) + ) + ) + (run-next-time-in-process gp-2 cam-slave-init cam-free-floating #f) + (-> gp-2 ppointer) + ) + ) + (else + (format 0 "ERROR : first slave failed to activate~%") + ) + ) + ) + (set! + (-> self water-drip) + (create-launch-control group-rain-screend-drop self) + ) + (set! (-> self water-drip-time) (the-as uint -18000)) + (go cam-master-active) + 0 + (none) + ) + + + + diff --git a/goal_src/engine/camera/cam-start.gc b/goal_src/engine/camera/cam-start.gc index 82b5e9d4ef..a0f30b5e9a 100644 --- a/goal_src/engine/camera/cam-start.gc +++ b/goal_src/engine/camera/cam-start.gc @@ -6,6 +6,7 @@ ;; dgos: GAME, ENGINE ;; definition for function cam-stop +;; INFO: Return type mismatch (state camera-slave) vs state. (defun cam-stop () (kill-by-name 'camera-master *active-pool*) (kill-by-name 'camera-slave *active-pool*) @@ -14,7 +15,7 @@ (set! *camera-combiner* #f) (let ((v0-3 cam-string)) (set! *camera-base-mode* v0-3) - v0-3 + (the-as state v0-3) ) ) @@ -23,45 +24,58 @@ (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) - ) - ) - (run-now-in-process s5-0 cam-combiner-init) - (-> s5-0 ppointer) + (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) ) + ) + (run-now-in-process s5-0 cam-combiner-init) + (-> s5-0 ppointer) ) + ) (let ((s5-1 (get-process *camera-master-dead-pool* camera-master #x4000))) - (set! *camera* - (the-as camera-master - (ppointer->process - (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) - ) - ) - (run-next-time-in-process s5-1 cam-master-init) - (-> s5-1 ppointer) - ) - ) - ) - ) + (set! *camera* (the-as camera-master (ppointer->process (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 + ) + ) + ) + (run-next-time-in-process + s5-1 + cam-master-init + ) + (-> s5-1 ppointer) + ) + ) + ) ) + ) (if arg0 - (reset-cameras) - ) + (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-dbg.gc b/goal_src/engine/camera/cam-states-dbg.gc index ae3cdfffed..770dba32a1 100644 --- a/goal_src/engine/camera/cam-states-dbg.gc +++ b/goal_src/engine/camera/cam-states-dbg.gc @@ -5,5 +5,910 @@ ;; name in dgo: cam-states-dbg ;; dgos: GAME, ENGINE -;; TODO - for anim-tester -(define-extern cam-orbit state) +;; DECOMP BEGINS + +(deftype cam-point-watch-bank (basic) + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(define + *CAM_POINT_WATCH-bank* + (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6)) + ) + +(defstate cam-point-watch (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self pivot-rad) 40960.0) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + ) + (none) + ) + :code + (behavior () + (while #t + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (when *camera-read-analog* + (let + ((f28-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 leftx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f30-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 lefty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f26-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f0-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + ) + (cond + ((logtest? + (-> *cpad-list* cpads (-> *CAMERA-bank* joypad) button0-abs 0) + (pad-buttons r2) + ) + (set! + (-> s5-0 y) + (- + (-> s5-0 y) + (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)) + ) + ) + (set! + (-> s5-0 x) + (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))) + ) + (+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) + ) + (else + (set! + (-> s5-0 y) + (- + (-> s5-0 y) + (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)) + ) + ) + (set! + (-> s5-0 x) + (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))) + ) + (+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) + ) + ) + ) + (let ((s4-0 (new-stack-vector0))) + (let ((s3-0 (new-stack-matrix0))) + (matrix-axis-angle! + s3-0 + (the-as vector (-> self tracking)) + (- (-> s5-0 x)) + ) + (vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0) + (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) + (vector-matrix*! s4-0 s4-0 s3-0) + ) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + s4-0 + (-> *camera* local-down) + ) + ) + (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) + (if (< (-> self pivot-rad) 4096.0) + (set! (-> self pivot-rad) 4096.0) + ) + (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) + (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))) + ) + ) + (suspend) + 0 + ) + (none) + ) + ) + +(deftype cam-free-bank (basic) + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(define + *CAM_FREE-bank* + (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6)) + ) + +(defun + cam-free-floating-input + ((arg0 vector) (arg1 vector) (arg2 symbol) (arg3 int)) + (when (and (!= *master-mode* 'menu) (not *cam-layout*)) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons x)) + (set! + (-> arg0 x) + (- + (-> arg0 x) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 6)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if + (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons triangle)) + (+! + (-> arg0 x) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 4)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if + (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons square)) + (+! + (-> arg0 y) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 7)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if + (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons circle)) + (set! + (-> arg0 y) + (- + (-> arg0 y) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 5)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + ) + (when arg2 + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2)) + (+! + (-> arg0 z) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 10)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2)) + (set! + (-> arg0 z) + (- + (-> arg0 z) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 11)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + ) + (cond + ((not *cam-free-move-along-z*) + ) + ((not *camera-read-analog*) + ) + ((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2)) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r1)) + (+! + (-> arg1 y) + (+ + (* 0.2 (-> *CAM_FREE-bank* speed)) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 9)) + 0.0 + 32.0 + 230.0 + (* 0.2 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l1)) + (set! + (-> arg1 y) + (- + (-> arg1 y) + (+ + (* 0.2 (-> *CAM_FREE-bank* speed)) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 8)) + 0.0 + 32.0 + 230.0 + (* 0.2 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + ) + ) + (else + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r1)) + (+! + (-> arg1 y) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 9)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l1)) + (set! + (-> arg1 y) + (- + (-> arg1 y) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 8)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + ) + ) + ) + (when (and (!= *master-mode* 'menu) (not *cam-layout*)) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons left)) + (+! + (-> arg1 x) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 1)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons right)) + (set! + (-> arg1 x) + (- + (-> arg1 x) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 0)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons up)) + (+! + (-> arg1 z) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 2)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons down)) + (set! + (-> arg1 z) + (- + (-> arg1 z) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 3)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + ) + ) + (when *camera-read-analog* + (let + ((f28-14 + (analog-input + (the-as int (-> *cpad-list* cpads arg3 leftx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f30-14 + (analog-input + (the-as int (-> *cpad-list* cpads arg3 lefty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f24-0 + (analog-input + (the-as int (-> *cpad-list* cpads arg3 rightx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f26-0 + (analog-input + (the-as int (-> *cpad-list* cpads arg3 righty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + ) + (when *display-load-boundaries* + (when + (and + (!= arg3 1) + (zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x))) + (zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r1))) + (zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2))) + ) + (+! + f28-14 + (analog-input + (the-as int (-> *cpad-list* cpads 1 leftx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (+! + f30-14 + (analog-input + (the-as int (-> *cpad-list* cpads 1 lefty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (+! + f24-0 + (analog-input + (the-as int (-> *cpad-list* cpads 1 rightx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (+! + f26-0 + (analog-input + (the-as int (-> *cpad-list* cpads 1 righty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + ) + ) + (cond + ((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2)) + (cond + ((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2)) + (set! + (-> arg0 y) + (- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f24-0))) + ) + (set! + (-> arg0 x) + (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0))) + ) + ) + (else + (set! + (-> arg0 y) + (- (-> arg0 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed))) + ) + (set! + (-> arg0 x) + (- (-> arg0 x) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed))) + ) + ) + ) + (+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14)) + ) + ((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2)) + (+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed))) + (+! (-> arg1 y) (* f26-0 (-> *CAM_FREE-bank* speed))) + (+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed))) + ) + (else + (set! + (-> arg0 y) + (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0))) + ) + (set! + (-> arg0 x) + (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0))) + ) + (+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14)) + ) + ) + ) + ) + (vector-float*! arg0 arg0 (-> *display* time-adjust-ratio)) + (vector-float*! arg1 arg1 (-> *display* time-adjust-ratio)) + ) + +(deftype camera-free-floating-move-info (structure) + ((rv vector :inline :offset-assert 0) + (tv vector :inline :offset-assert 16) + (up vector :inline :offset-assert 32) + (tm matrix :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + + +(defun + cam-free-floating-move + ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int)) + (if (logtest? (-> *cpad-list* cpads arg3 valid) 128) + (return (the-as vector #f)) + ) + (if (= *master-mode* 'menu) + (return (the-as vector #f)) + ) + (let ((s3-0 (new 'stack 'camera-free-floating-move-info))) + (cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3) + (cond + (arg2 + (matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y)) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (cond + ((< (vector-dot (-> arg0 vector 1) arg2) 0.0) + (forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2) + ) + (else + (vector-negate! (-> s3-0 up) arg2) + (forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up)) + ) + ) + ) + (else + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + ) + ) + (matrix-axis-angle! + (-> s3-0 tm) + (the-as vector (-> arg0 vector)) + (- (-> s3-0 rv x)) + ) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0) + (vector+! arg1 arg1 (-> s3-0 tv)) + ) + ) + +(defstate cam-free-floating (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + (send-event *camera-combiner* 'stop-tracking) + ) + (none) + ) + :code + (behavior () + (while #t + (let ((a2-0 (-> *camera* local-down))) + (if (logtest? (-> self options) 8) + (set! a2-0 (the-as vector #f)) + ) + (cam-free-floating-move + (the-as matrix (-> self tracking)) + (-> self trans) + a2-0 + (the-as int (-> *CAMERA-bank* joypad)) + ) + ) + (suspend) + ) + (none) + ) + ) + +(deftype camera-orbit-info (structure) + ((radius float :offset-assert 0) + (rot float :offset-assert 4) + (target-off vector :inline :offset-assert 16) + (orbit-off vector :inline :offset-assert 32) + (radius-lerp float :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + + +(deftype CAM_ORBIT-bank (basic) + ((RADIUS_MAX float :offset-assert 4) + (RADIUS_MIN float :offset-assert 8) + (TARGET_OFF_ADJUST float :offset-assert 12) + (ORBIT_OFF_ADJUST float :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + + +(define + *CAM_ORBIT-bank* + (new 'static 'CAM_ORBIT-bank + :RADIUS_MAX 61440.0 + :RADIUS_MIN 409.6 + :TARGET_OFF_ADJUST 81.92 + :ORBIT_OFF_ADJUST 81.92 + ) + ) + +(define *camera-orbit-info* (new 'static 'camera-orbit-info)) + +(set! (-> *camera-orbit-info* radius-lerp) 0.45) + +(set! (-> *camera-orbit-info* target-off y) 4096.0) + +(set! (-> *camera-orbit-info* orbit-off y) 4096.0) + +(defstate cam-orbit (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (if (not *camera-orbit-target*) + (cam-slave-go cam-free-floating) + ) + (let ((v1-4 (new-stack-vector0))) + (vector-! v1-4 (-> self trans) (-> *camera-orbit-target* 0 root trans)) + (set! (-> *camera-orbit-info* rot) (atan (-> v1-4 x) (-> v1-4 z))) + ) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + ) + (none) + ) + :exit + (behavior () + '() + (none) + ) + :code + (behavior () + (while #t + (if (not *camera-orbit-target*) + (cam-slave-go cam-free-floating) + ) + (when *camera-read-analog* + (let + ((f0-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + 128.0 + 32.0 + 110.0 + 0.05 + ) + ) + ) + (cond + ((< (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) f0-0) + (+! + (-> *camera-orbit-info* radius-lerp) + (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) + ) + ) + ((< f0-0 (* 0.05 (- (-> *camera-orbit-info* radius-lerp)))) + (+! + (-> *camera-orbit-info* radius-lerp) + (* 0.05 (- (-> *camera-orbit-info* radius-lerp))) + ) + ) + (else + (+! (-> *camera-orbit-info* radius-lerp) f0-0) + ) + ) + ) + (set! + (-> *camera-orbit-info* radius) + (lerp + (-> *CAM_ORBIT-bank* RADIUS_MIN) + (-> *CAM_ORBIT-bank* RADIUS_MAX) + (-> *camera-orbit-info* radius-lerp) + ) + ) + ) + (cond + ((logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2)) + (if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1)) + (set! + (-> *camera-orbit-info* target-off y) + (- + (-> *camera-orbit-info* target-off y) + (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST) + ) + ) + ) + (if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) + (+! + (-> *camera-orbit-info* target-off y) + (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST) + ) + ) + ) + (else + (if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1)) + (set! + (-> *camera-orbit-info* orbit-off y) + (- + (-> *camera-orbit-info* orbit-off y) + (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST) + ) + ) + ) + (if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) + (+! + (-> *camera-orbit-info* orbit-off y) + (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST) + ) + ) + ) + ) + (when *camera-read-analog* + (let + ((f0-20 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + 128.0 + 32.0 + 110.0 + (* 21845.334 (-> *display* seconds-per-frame)) + ) + ) + ) + (set! + (-> *camera-orbit-info* rot) + (the + float + (sar (shl (the int (+ (-> *camera-orbit-info* rot) f0-20)) 48) 48) + ) + ) + ) + ) + (let ((gp-0 (new-stack-vector0))) + (let ((s5-0 (new-stack-vector0))) + (set-vector! + (-> self trans) + (+ + (-> *camera-orbit-target* 0 root trans x) + (* (sin (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius)) + ) + (-> *camera-orbit-target* 0 root trans y) + (+ + (-> *camera-orbit-target* 0 root trans z) + (* (cos (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius)) + ) + 1.0 + ) + (vector+! + (-> self trans) + (-> self trans) + (-> *camera-orbit-info* orbit-off) + ) + (vector+! + (-> self tracking follow-pt) + (-> *camera-orbit-target* 0 root trans) + (-> *camera-orbit-info* target-off) + ) + (vector-! s5-0 (-> self trans) (-> self tracking follow-pt)) + (set! + (-> gp-0 y) + (the + float + (sar (shl (the int (+ 32768.0 (atan (-> s5-0 x) (-> s5-0 z)))) 48) 48) + ) + ) + (set! (-> gp-0 x) (atan (-> s5-0 y) (vector-xz-length s5-0))) + ) + (set! (-> gp-0 z) 0.0) + (matrix-rotate-zxy! (the-as matrix (-> self tracking)) gp-0) + ) + (suspend) + ) + (none) + ) + ) + + + + diff --git a/goal_src/engine/camera/cam-states.gc b/goal_src/engine/camera/cam-states.gc index 12c50abbef..fe89db446a 100644 --- a/goal_src/engine/camera/cam-states.gc +++ b/goal_src/engine/camera/cam-states.gc @@ -5,6 +5,4499 @@ ;; name in dgo: cam-states ;; dgos: GAME, ENGINE -;; TODO - for cam-start -(define-extern cam-string state) -(define-extern *camera-base-mode* state) +(define-extern cam-string (state camera-slave)) + +;; DECOMP BEGINS + +(defstate cam-fixed (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) + (when (!= (-> gp-0 w) 0.0) + (vector-normalize! gp-0 (the-as float 1.0)) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + gp-0 + (-> *camera* local-down) + ) + ) + ) + ) + (suspend) + ) + (none) + ) + ) + +(defstate cam-fixed-read-entity (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + (-> self trans) + 'trans + ) + (cam-slave-get-rot + (the-as entity-actor (-> self cam-entity)) + (the-as matrix (-> self tracking)) + ) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (cam-curve-setup (-> self trans)) + ((-> cam-fixed enter)) + ) + (else + (format #t "ERROR : cam-fixed-read-entity enter without entity~%") + ) + ) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-0) + ) + ) + (go cam-fixed) + (none) + ) + :code + (behavior () + (while #t + (format *stdcon* "ERROR : stayed in cam-fixed-read-entity~%") + (suspend) + ) + (none) + ) + ) + +(defstate cam-pov (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + ) + (none) + ) + :trans + (behavior () + (when (not (handle->process (-> *camera* pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (vector<-cspace! + (-> self trans) + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + ) + ) + (let* ((v1-5 (-> self tracking)) + (a3-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + bone + transform + ) + ) + (a0-8 (-> a3-0 vector 0 quad)) + (a1-9 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 vector 3 quad)) + ) + (set! (-> v1-5 inv-mat vector 0 quad) a0-8) + (set! (-> v1-5 inv-mat vector 1 quad) a1-9) + (set! (-> v1-5 inv-mat vector 2 quad) a2-0) + (set! (-> v1-5 inv-mat vector 3 quad) a3-1) + ) + (vector-reset! (-> self tracking inv-mat vector 3)) + ) + (suspend) + ) + (none) + ) + ) + +(defstate cam-pov180 (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + ) + (none) + ) + :trans + (behavior () + (when (not (handle->process (-> *camera* pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 #t) + ) + (vector<-cspace! + gp-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + ) + ) + (let + ((v1-11 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + bone + transform + ) + ) + ) + (vector-normalize-copy! s5-0 (-> v1-11 vector 2) (the-as float 1.0)) + ) + (while #t + (when (not (paused?)) + (let + ((s0-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + bone + transform + ) + ) + (s1-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + bone + scale + ) + ) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector<-cspace! + s2-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + ) + ) + (vector-normalize-copy! s3-0 (-> s0-0 vector 2) (the-as float 1.0)) + (set! s4-0 (cond + ((and + (< (vector-vector-distance s2-0 gp-0) 40960.0) + (< (cos (the-as float 3640.889)) (vector-dot s5-0 s3-0)) + ) + (set! (-> self trans quad) (-> s2-0 quad)) + (vector-negate! + (the-as vector (-> self tracking)) + (the-as vector (-> s0-0 vector)) + ) + (set! + (-> self tracking inv-mat vector 1 quad) + (-> s0-0 vector 1 quad) + ) + (vector-negate! + (-> self tracking inv-mat vector 2) + (-> s0-0 vector 2) + ) + (set! + (-> self fov) + (* + 2.0 + (atan + (/ 12.700255 (* 20.3 (-> s1-0 x))) + (the-as float 1.0) + ) + ) + ) + (vector-float*! + (the-as vector (-> self tracking)) + (the-as vector (-> self tracking)) + (/ 1.0 (-> s1-0 x)) + ) + (vector-reset! (-> self tracking inv-mat vector 3)) + (if s4-0 + (set! s4-0 #f) + ) + s4-0 + ) + (else + #t + ) + ) + ) + (set! (-> gp-0 quad) (-> s2-0 quad)) + ) + (set! (-> s5-0 quad) (-> s3-0 quad)) + ) + ) + (suspend) + ) + ) + (none) + ) + ) + +(defstate cam-pov-track (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-0) + ) + ) + (none) + ) + :trans + (behavior () + (if + (or + (not (handle->process (-> *camera* pov-handle))) + (zero? (logand (-> *camera* master-options) 2)) + ) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (if (not (paused?)) + (vector<-cspace! + (-> self trans) + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + ) + ) + ) + (suspend) + ) + (none) + ) + ) + +(defbehavior cam-standoff-calc-trans camera-slave () + (if (-> self tracking no-follow) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (vector+! (-> self trans) (-> self tracking follow-pt) (-> self pivot-pt)) + ) + ) + +(defstate cam-standoff (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('set-standoff-dist) + (vector-normalize! (-> self pivot-pt) (the-as float (-> arg3 param 0))) + (cam-standoff-calc-trans) + ) + (('set-standoff-height) + (vector-flatten! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + ) + (vector--float*! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + (the-as float (-> arg3 param 0)) + ) + (cam-standoff-calc-trans) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (vector-! (-> self pivot-pt) (-> self trans) (-> *camera* tpos-curr-adj)) + (cond + ((logtest? (-> self options) #x8000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (else + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + ) + ) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (cam-standoff-calc-trans) + ) + (suspend) + ) + (none) + ) + ) + +(defstate cam-standoff-read-entity (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + ) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'trans + ) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + s5-0 + 'align + ) + (vector-! (-> self pivot-pt) gp-0 s5-0) + ) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! + (-> self options) + (cam-slave-get-flags (-> self cam-entity) 'flags) + ) + (if (logtest? (-> self options) #x8000) + (cam-slave-get-rot + (the-as entity-actor (-> self cam-entity)) + (the-as matrix (-> self tracking)) + ) + (set! + (-> self tracking tilt-adjust target) + (cam-slave-get-float + (-> self cam-entity) + 'tiltAdjust + (-> *CAMERA-bank* default-tilt-adjust) + ) + ) + ) + ((-> cam-standoff enter)) + ) + (else + (format #t "ERROR : cam-standoff-read-entity enter without entity~%") + ) + ) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-2 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-2) + ) + ) + (go cam-standoff) + (none) + ) + :code + (behavior () + (while #t + (format *stdcon* "ERROR : stayed in cam-standoff-read-entity~%") + (suspend) + ) + (none) + ) + ) + +(deftype cam-eye-bank (basic) + ((rot-speed float :offset-assert 4) + (max-degrees float :offset-assert 8) + (max-fov float :offset-assert 12) + (min-fov float :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + + +(define + *CAM_EYE-bank* + (new 'static 'cam-eye-bank + :rot-speed 364.0889 + :max-degrees 12743.111 + :max-fov 11650.845 + :min-fov 6189.511 + ) + ) + +(defstate cam-eye (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (let + ((v1-3 + (vector-float*! + (new-stack-vector0) + (-> *camera* local-down) + (+ 1024.0 (-> *camera* target-height)) + ) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-3) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (set! (-> self fov) 11650.845) + (none) + ) + :exit + (behavior () + (if + (and + *target* + (logtest? (-> *camera* master-options) 2) + (logtest? (-> *target* state-flags) 512) + ) + (send-event *target* 'end-mode) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 (-> *display* base-frame-counter))) + (while #t + (when (not (paused?)) + (let ((s4-0 (vector-reset! (new-stack-vector0))) + (s5-0 (new-stack-matrix0)) + ) + (when *camera-read-analog* + (let + ((f30-0 + (analog-input + (the-as + int + (+ + (-> *cpad-list* cpads 0 rightx) + -256 + (-> *cpad-list* cpads 0 leftx) + ) + ) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0) + ) + ) + (f0-0 + (analog-input + (the-as + int + (+ + (-> *cpad-list* cpads 0 righty) + -256 + (-> *cpad-list* cpads 0 lefty) + ) + ) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0) + ) + ) + ) + (set! + (-> s4-0 y) + (- (-> s4-0 y) (* (- f30-0) (-> *CAM_EYE-bank* rot-speed))) + ) + (set! + (-> s4-0 x) + (- (-> s4-0 x) (* (- f0-0) (-> *CAM_EYE-bank* rot-speed))) + ) + ) + ) + (cond + ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 x)) + (set! (-> s4-0 x) (-> *CAM_EYE-bank* rot-speed)) + ) + ((< (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + (set! (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + ) + ) + (cond + ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 y)) + (set! (-> s4-0 y) (-> *CAM_EYE-bank* rot-speed)) + ) + ((< (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + (set! (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + ) + ) + (cond + ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) + (set! gp-0 (-> *display* base-frame-counter)) + ) + (else + (let + ((v1-44 (min 10 (max 1 (- (-> *display* base-frame-counter) gp-0))))) + (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-44))) + ) + ) + ) + (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) + (matrix*! + (the-as matrix (-> self tracking)) + (the-as matrix (-> self tracking)) + s5-0 + ) + (when (zero? (logand (-> self options) 8)) + (if + (< + (vector-dot + (-> self tracking inv-mat vector 1) + (-> *camera* local-down) + ) + 0.0 + ) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + (-> self tracking inv-mat vector 2) + (vector-negate! (new-stack-vector0) (-> *camera* local-down)) + ) + ) + ) + (matrix-axis-angle! + s5-0 + (the-as vector (-> self tracking)) + (- (-> s4-0 x)) + ) + (matrix*! + (the-as matrix (-> self tracking)) + (the-as matrix (-> self tracking)) + s5-0 + ) + ) + (when (zero? (logand (-> self options) 8)) + (let + ((f30-1 + (vector-dot + (-> *camera* local-down) + (-> self tracking inv-mat vector 2) + ) + ) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (when (< (sin (-> *CAM_EYE-bank* max-degrees)) (fabs f30-1)) + (vector--float*! + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + f30-1 + ) + (vector-normalize! + (-> self tracking inv-mat vector 2) + (cos (-> *CAM_EYE-bank* max-degrees)) + ) + (if (< f30-1 0.0) + (vector--float*! + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + (sin (-> *CAM_EYE-bank* max-degrees)) + ) + (vector+float*! + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + (sin (-> *CAM_EYE-bank* max-degrees)) + ) + ) + (vector-cross! + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)) + ) + (set! (-> self tracking inv-mat vector 1 w) 0.0) + ) + ) + ) + ) + (let + ((v1-76 + (vector-float*! + (new-stack-vector0) + (-> *camera* local-down) + (+ 1024.0 (-> *camera* target-height)) + ) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-76) + ) + (suspend) + ) + ) + (none) + ) + ) + +(deftype cam-billy-bank (basic) + ((rot-speed float :offset-assert 4) + (tilt-degrees float :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(define + *CAM_BILLY-bank* + (new 'static 'cam-billy-bank :rot-speed 364.0889 :tilt-degrees -1820.4445) + ) + +(defstate cam-billy (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (let + ((v1-3 + (vector-float*! + (new-stack-vector0) + (-> *camera* local-down) + (-> *camera* target-height) + ) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-3) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (set! (-> self fov) 9830.4) + (matrix-rotate-y! (the-as matrix (-> self tracking)) (the-as float -32768.0)) + (none) + ) + :exit + (behavior () + '() + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (let ((s5-0 (vector-reset! (new-stack-vector0))) + (s4-0 (vector-reset! (new-stack-vector0))) + (s3-0 (vector-reset! (new-stack-vector0))) + (s2-0 (new-stack-vector0)) + (gp-0 (new-stack-matrix0)) + ) + 0.0 + (when *camera-read-analog* + (let + ((f1-0 + (analog-input + (the-as + int + (+ + (-> *cpad-list* cpads 0 rightx) + -256 + (-> *cpad-list* cpads 0 leftx) + ) + ) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0) + ) + ) + ) + (set! + (-> s5-0 y) + (- (-> s5-0 y) (* (- f1-0) (-> *CAM_BILLY-bank* rot-speed))) + ) + ) + ) + (cond + ((< (-> *CAM_BILLY-bank* rot-speed) (-> s5-0 y)) + (set! (-> s5-0 y) (-> *CAM_BILLY-bank* rot-speed)) + ) + ((< (-> s5-0 y) (- (-> *CAM_BILLY-bank* rot-speed))) + (set! (-> s5-0 y) (- (-> *CAM_BILLY-bank* rot-speed))) + ) + ) + (set! (-> s3-0 x) (sin (the-as float 37319.11))) + (set! (-> s3-0 z) (cos (the-as float 37319.11))) + (set! (-> s4-0 x) (-> s3-0 z)) + (set! (-> s4-0 z) (- (-> s3-0 x))) + (vector-flatten! + s2-0 + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s2-0 (the-as float 1.0)) + (let + ((f0-14 (acos (vector-dot (-> self tracking inv-mat vector 2) s3-0)))) + (if (< (vector-dot (-> self tracking inv-mat vector 2) s4-0) 0.0) + (set! f0-14 (- f0-14)) + ) + (let ((f0-18 (cond + ((and (< 0.0 f0-14) (< 0.0 (-> s5-0 y))) + (fmin (-> s5-0 y) (fmax 0.0 (* 0.5 (- 10922.667 f0-14)))) + ) + ((and (< f0-14 0.0) (< (-> s5-0 y) 0.0)) + (fmax (-> s5-0 y) (fmin 0.0 (* 0.5 (- -10922.667 f0-14)))) + ) + (else + (-> s5-0 y) + ) + ) + ) + ) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-18) + ) + ) + (vector-matrix*! + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + gp-0 + ) + ) + (set! (-> self tracking inv-mat vector 2 y) 0.0) + (vector-normalize! + (-> self tracking inv-mat vector 2) + (cos (-> *CAM_BILLY-bank* tilt-degrees)) + ) + (set! + (-> self tracking inv-mat vector 2 y) + (sin (-> *CAM_BILLY-bank* tilt-degrees)) + ) + (vector-cross! + (the-as vector (-> self tracking)) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! (the-as vector (-> self tracking)) (the-as float 1.0)) + (vector-cross! + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)) + ) + ) + (vector--float*! + (-> self trans) + (-> *camera* tpos-curr) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (suspend) + ) + (none) + ) + ) + +(defstate cam-spline (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0))) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! + (-> self options) + (cam-slave-get-flags (-> self cam-entity) 'flags) + ) + (if (logtest? (-> self options) #x8000) + (cam-slave-get-rot + (the-as entity-actor (-> self cam-entity)) + (the-as matrix (-> self tracking)) + ) + (set! + (-> self tracking tilt-adjust target) + (cam-slave-get-float + (-> self cam-entity) + 'tiltAdjust + (-> *CAMERA-bank* default-tilt-adjust) + ) + ) + ) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'trans + ) + (cam-curve-setup gp-0) + ) + (vector-negate! (-> self saved-pt) (-> self spline-offset)) + (let + ((a0-8 + (res-lump-struct + (-> self cam-entity) + 'spline-offset + structure + :time + (the-as float -1000000000.0) + ) + ) + ) + (if a0-8 + (vector+! + (-> self spline-offset) + (-> self spline-offset) + (the-as vector a0-8) + ) + ) + ) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (set! + (-> self spline-follow-dist) + (cam-slave-get-float + (-> self cam-entity) + 'spline-follow-dist + (the-as float 0.0) + ) + ) + (cond + ((< 0.0 (-> self spline-follow-dist)) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + ) + (curve-get-pos! s5-1 (the-as float 0.0) (-> self spline-curve)) + (curve-get-pos! gp-1 (the-as float 1.0) (-> self spline-curve)) + (if + (< + (vector-vector-distance-squared s5-1 (-> self tracking follow-pt)) + (vector-vector-distance-squared gp-1 (-> self tracking follow-pt)) + ) + (set! (-> self spline-follow-dist) (- (-> self spline-follow-dist))) + ) + ) + (set! + (-> self spline-tt) + (curve-closest-point + (-> self spline-curve) + (-> self tracking follow-pt) + (the-as float 0.5) + (the-as float -4096.0) + 10 + (-> self spline-follow-dist) + ) + ) + ) + (else + (set! (-> self spline-follow-dist) 0.0) + ) + ) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + (cond + ((logtest? (-> self options) #x8000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (else + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + ) + ) + (else + (format #t "ERROR : cam-spline enter without entity~%") + ) + ) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-2 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-2) + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (new 'stack 'curve) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + ) + (suspend) + ) + (none) + ) + ) + +(defstate cam-decel (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (if (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (when (!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! + s5-0 + (parameter-ease-sin-clamp (-> *camera* outro-t)) + (-> *camera* outro-curve) + ) + (+! + (-> *camera* outro-t) + (* (-> *camera* outro-t-step) (-> *display* time-adjust-ratio)) + ) + (curve-get-pos! + gp-0 + (parameter-ease-sin-clamp (-> *camera* outro-t)) + (-> *camera* outro-curve) + ) + (vector-! gp-0 gp-0 s5-0) + (cond + ((or + (and + (< (-> *camera* outro-t-step) 0.0) + (>= (-> *camera* outro-exit-value) (-> *camera* outro-t)) + ) + (and + (< 0.0 (-> *camera* outro-t-step)) + (>= (-> *camera* outro-t) (-> *camera* outro-exit-value)) + ) + ) + (set! (-> *camera* outro-t) (-> *camera* outro-exit-value)) + (set! (-> *camera* outro-t-step) 0.0) + (vector+! (-> self velocity) (-> self velocity) gp-0) + (send-event *camera* 'outro-done) + ) + (else + (vector+! (-> self trans) (-> self trans) gp-0) + ) + ) + ) + ) + (vector-float*! (-> self velocity) (-> self velocity) 0.9) + (vector+! (-> self trans) (-> self trans) (-> self velocity)) + ) + (suspend) + ) + (none) + ) + ) + +(defstate cam-endlessfall (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 (new 'stack-no-clear 'matrix)) + (f30-0 (-> self velocity y)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-0 quad) (-> self trans quad)) + (set! (-> s4-0 y) 0.0) + (set! (-> s5-0 quad) (-> self velocity quad)) + (set! (-> s5-0 y) 0.0) + ((method-of-type cam-vector-seeker init!) + (the-as cam-vector-seeker gp-0) + s4-0 + (the-as float 81.92) + (fmax 819.2 (vector-length s5-0)) + (the-as float 0.75) + ) + (set! (-> gp-0 vector 2 quad) (-> s5-0 quad)) + ) + (while #t + (when (not (paused?)) + (set! (-> gp-0 vector 0 x) (-> (target-pos 0) x)) + (set! (-> gp-0 vector 0 z) (-> (target-pos 0) z)) + ((method-of-type cam-vector-seeker update!) + (the-as cam-vector-seeker gp-0) + (the-as vector #f) + ) + (when (< 819.2 (-> gp-0 vector 3 y)) + (set! (-> gp-0 vector 3 y) (* 0.9 (-> gp-0 vector 3 y))) + (if (< (-> gp-0 vector 3 y) 819.2) + (set! (-> gp-0 vector 3 y) 819.2) + ) + ) + (set! f30-0 (* 0.9 f30-0)) + (+! (-> self trans y) f30-0) + (set! (-> self trans x) (-> gp-0 vector 1 x)) + (set! (-> self trans z) (-> gp-0 vector 1 z)) + ) + (suspend) + ) + ) + (none) + ) + ) + +(defbehavior + cam-circular-position-into-max-angle camera-slave + ((arg0 vector) (arg1 vector) (arg2 float)) + (let* ((f30-0 (vector-normalize-ret-len! arg0 (the-as float 1.0))) + (f26-0 (vector-normalize-ret-len! arg1 (the-as float 1.0))) + (f0-1 (vector-dot arg0 arg1)) + (f28-0 (acos f0-1)) + (s3-0 (new 'stack-no-clear 'matrix)) + ) + (when *camera-read-analog* + (let + ((f24-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 8192.0 (-> *display* seconds-per-frame)) + ) + ) + (f1-2 + (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 8192.0 (-> *display* seconds-per-frame)) + ) + ) + (s2-0 (new-stack-matrix0)) + ) + (let ((v1-20 (new 'stack-no-clear 'vector))) + 0.0 + (if (< (-> self pivot-rad) f30-0) + (set! f24-0 (- f24-0)) + ) + (vector-cross! v1-20 arg1 arg0) + (let ((f0-9 (vector-dot v1-20 (-> *camera* local-down)))) + (if (< f1-2 0.0) + (set! f1-2 (fmax f1-2 (* -0.15 f28-0))) + ) + (if (< f0-9 0.0) + (set! f1-2 (- f1-2)) + ) + (let* ((f1-3 (+ f24-0 f1-2)) + (f1-5 + (fmin + (* 8192.0 (-> *display* seconds-per-frame)) + (fmax (* -8192.0 (-> *display* seconds-per-frame)) f1-3) + ) + ) + ) + (cond + ((and (< 0.0 f1-5) (< 0.0 f0-9) (< (-> self max-angle-curr) f28-0)) + (set! f1-5 0.0) + ) + ((and (< 0.0 f1-5) (< 0.0 f0-9)) + (set! f1-5 (fmin f1-5 (* 0.15 (- (-> self max-angle-curr) f28-0)))) + ) + ((and (< f1-5 0.0) (< f0-9 0.0) (< (-> self max-angle-curr) f28-0)) + (set! f1-5 0.0) + ) + ((and (< f1-5 0.0) (< f0-9 0.0)) + (set! f1-5 (fmax f1-5 (* 0.15 (- f28-0 (-> self max-angle-curr))))) + ) + ) + (matrix-axis-angle! s2-0 (-> *camera* local-down) f1-5) + ) + ) + ) + (vector-matrix*! arg1 arg1 s2-0) + ) + (let ((f0-15 (vector-dot arg0 arg1))) + (set! f28-0 (acos f0-15)) + ) + ) + (cond + ((< (-> self max-angle-curr) f28-0) + (matrix-from-two-vectors-max-angle! + s3-0 + arg1 + arg0 + (* + (fmin 1.0 (* arg2 (-> *display* time-adjust-ratio))) + (- f28-0 (-> self max-angle-curr)) + ) + ) + (vector-matrix*! arg0 arg1 s3-0) + ) + ((and + (logtest? (-> self options) 2) + (or + (and + (>= f26-0 (+ -8192.0 f30-0)) + (>= f30-0 (+ -8192.0 (-> self pivot-rad))) + ) + (and + (>= (+ 8192.0 f30-0) f26-0) + (>= (+ 8192.0 (-> self pivot-rad)) f30-0) + ) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (vector-cross! s2-1 arg1 arg0) + (vector-normalize! s2-1 (the-as float 1.0)) + (matrix-axis-angle! + s3-0 + s2-1 + (* + (fmin 1.0 (* arg2 (-> *display* time-adjust-ratio))) + (- (-> self max-angle-curr) f28-0) + ) + ) + ) + (vector-matrix*! arg0 arg1 s3-0) + ) + (else + (set! (-> arg0 quad) (-> arg1 quad)) + (if (logtest? (-> self options) 2048) + (set! (-> self max-angle-curr) f28-0) + ) + ) + ) + ) + (vector-normalize! arg0 (-> self pivot-rad)) + ) + +(defbehavior cam-circular-position camera-slave ((arg0 symbol)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (if (logtest? (-> self options) 130) + (vector-! gp-0 (-> self circular-follow) (-> self pivot-pt)) + (vector-! gp-0 (-> self pivot-pt) (-> self circular-follow)) + ) + (vector-! s5-0 (-> self trans) (-> self pivot-pt)) + (when (zero? (logand (-> self options) 4)) + (vector-flatten! gp-0 gp-0 (-> *camera* local-down)) + (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) + ) + (cond + ((logtest? (-> self options) 128) + (let ((f0-1 (- (vector-length gp-0) (-> self pivot-rad)))) + (if (>= 0.0 f0-1) + (vector-reset! gp-0) + (vector-normalize! gp-0 f0-1) + ) + ) + ) + ((not arg0) + (set! (-> self max-angle-curr) (-> self max-angle-offset)) + (cam-circular-position-into-max-angle gp-0 s5-0 (the-as float 1.0)) + ) + (else + (cam-circular-position-into-max-angle gp-0 s5-0 (the-as float 0.05)) + ) + ) + ) + (vector+! (-> self trans) gp-0 (-> self pivot-pt)) + ) + ) + +(defbehavior cam-circular-code camera-slave () + (set! (-> self pivot-pt quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self pivot-pt) (the-as vector #f) (the-as curve #f) #f) + (let ((a2-1 (new-stack-vector0))) + (vector-! a2-1 (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (vector-! + (-> self circular-follow) + (-> self circular-follow) + (-> self pivot-pt) + ) + (if (logtest? (-> self options) 4) + (v-slrp3! + (-> self circular-follow) + (-> self circular-follow) + a2-1 + (the-as vector #f) + (* 182.04445 (-> *display* time-adjust-ratio)) + ) + (v-slrp3! + (-> self circular-follow) + (-> self circular-follow) + a2-1 + (-> *camera* local-down) + (* 182.04445 (-> *display* time-adjust-ratio)) + ) + ) + ) + (vector+! + (-> self circular-follow) + (-> self circular-follow) + (-> self pivot-pt) + ) + (cam-circular-position #t) + (when (!= (-> self fov1) 0.0) + (let + ((f0-7 + (lerp-clamp + (-> self fov0) + (-> self fov1) + (parameter-ease-sin-clamp + (dummy-10 (-> self fov-index) (-> *camera* tpos-curr-adj)) + ) + ) + ) + ) + (set! (-> self fov) f0-7) + f0-7 + ) + ) + ) + +(defstate cam-circular (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (('outro-done) + (set! (-> self trans quad) (-> *camera-combiner* trans quad)) + (cam-circular-position #f) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (cond + ((-> self enter-has-run) + ) + (else + (let ((gp-0 (new-stack-vector0))) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (set! (-> self view-off-param) 1.0) + (set! (-> self circular-follow quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> self max-angle-offset) 0.0) + (cond + ((-> self cam-entity) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + (-> self saved-pt) + 'pivot + ) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'trans + ) + (set! + (-> self pivot-rad) + (vector-length (vector-! gp-0 gp-0 (-> self saved-pt))) + ) + (logior! + (-> self options) + (cam-slave-get-flags (-> self cam-entity) 'flags) + ) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (set! + (-> self tracking tilt-adjust target) + (cam-slave-get-float + (-> self cam-entity) + 'tiltAdjust + (-> *CAMERA-bank* default-tilt-adjust) + ) + ) + (set! + (-> self max-angle-offset) + (cam-slave-get-float (-> self cam-entity) 'maxAngle (the-as float 0.0)) + ) + (if (< (-> self max-angle-offset) 0.0) + (set! (-> self max-angle-offset) 0.0) + ) + (set! + (-> self fov1) + (cam-slave-get-float + (-> self cam-entity) + 'focalPull + (the-as float 0.0) + ) + ) + (cond + ((and + (!= (-> self fov1) 0.0) + (dummy-9 + (-> self fov-index) + 'focalpull + (-> self cam-entity) + (-> self saved-pt) + (the-as curve #f) + ) + ) + (set! (-> self fov0) (-> self fov)) + (set! + (-> self fov) + (lerp-clamp + (-> self fov0) + (-> self fov1) + (dummy-10 (-> self fov-index) (-> *camera* tpos-curr-adj)) + ) + ) + ) + (else + (set! (-> self fov1) 0.0) + ) + ) + (cam-curve-setup (-> self saved-pt)) + (set! (-> self pivot-pt quad) (-> self saved-pt quad)) + (cam-curve-pos + (-> self pivot-pt) + (the-as vector #f) + (the-as curve #f) + #f + ) + ) + ((logtest? (-> self options) 128) + (vector-! + (-> self pivot-pt) + (-> *camera* tpos-curr-adj) + (-> self trans) + ) + (vector-flatten! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + ) + (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) + (set! (-> self pivot-pt quad) (-> self trans quad)) + (set! (-> self saved-pt quad) (-> self pivot-pt quad)) + ) + (else + (vector-! + (-> self pivot-pt) + (-> *camera* tpos-curr-adj) + (-> self trans) + ) + (vector-float*! (-> self pivot-pt) (-> self pivot-pt) 0.5) + (vector-flatten! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + ) + (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) + (vector+! (-> self pivot-pt) (-> self trans) (-> self pivot-pt)) + (set! (-> self saved-pt quad) (-> self pivot-pt quad)) + ) + ) + ) + (cam-circular-position #f) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + ) + (let ((gp-3 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-3 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-3) + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (if (not (paused?)) + (cam-circular-code) + ) + (suspend) + ) + (none) + ) + ) + +(defstate cam-lookat (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (suspend) + ) + (none) + ) + ) + +(deftype cam-string-bank (basic) + ((los-coll-rad meters :offset-assert 4) + (los-coll-rad2 meters :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(define + *CAM_STRING-bank* + (new 'static 'cam-string-bank + :los-coll-rad (meters 1.0) + :los-coll-rad2 (meters 0.5) + ) + ) + +(defun cam-string-find-position-rel! ((arg0 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'bone)) + (f30-0 0.0) + (s2-0 (new 'stack-no-clear 'matrix)) + ) + (vector-flatten! + s5-0 + (-> *camera-combiner* inv-camera-rot vector 2) + (-> *camera* local-down) + ) + (if + (= + (vector-normalize-ret-len! + s5-0 + (- (+ 1024.0 (-> *CAMERA-bank* default-string-min-z))) + ) + 0.0 + ) + (set! (-> s5-0 z) (+ 1024.0 (-> *CAMERA-bank* default-string-min-z))) + ) + (vector--float*! + s5-0 + s5-0 + (-> *camera* local-down) + (-> *CAMERA-bank* default-string-min-y) + ) + (set! (-> arg0 quad) (-> s5-0 quad)) + (while #t + (vector--float*! + s4-0 + arg0 + (-> *camera* local-down) + (-> *camera* target-height) + ) + (if + (< + (dummy-10 + *collide-cache* + (-> *camera* tpos-curr-adj) + arg0 + (the-as float 409.6) + #x4a09 + (the-as process #f) + (the-as collide-mesh-cache-tri s3-0) + 2 + ) + 0.0 + ) + (return #t) + ) + (set! f30-0 (cond + ((>= -32768.0 f30-0) + (format #t "cam-string didn't find a spot~%") + (set! (-> arg0 quad) (-> s5-0 quad)) + (return #f) + f30-0 + ) + ((< 0.0 f30-0) + (- f30-0) + ) + (else + (- 5461.3335 f30-0) + ) + ) + ) + (matrix-axis-angle! s2-0 (-> *camera* local-down) f30-0) + (vector-matrix*! arg0 s5-0 s2-0) + ) + ) + (the-as symbol #f) + ) + +(defbehavior cam-string-set-position-rel! camera-slave ((arg0 vector)) + (vector-flatten! (-> self view-flat) arg0 (-> *camera* local-down)) + (set! (-> self min-z-override) (vector-length (-> self view-flat))) + (vector+! (-> self desired-pos) arg0 (-> *camera* tpos-curr-adj)) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (TODO-RENAME-10 (-> self position-spline) (-> self desired-pos)) + (vector-reset! (-> self velocity)) + (let ((v0-3 (logand -4097 (-> self options)))) + (set! (-> self options) v0-3) + (the-as int v0-3) + ) + ) + +(defun string-push-help () + (the-as float 409.6) + ) + +(defun-debug cam-draw-collide-cache ((arg0 collide-cache)) + (let ((gp-0 (-> arg0 tris))) + (countdown (s5-0 (-> arg0 num-tris)) + (let ((t1-0 #x40000080)) + (add-debug-flat-triangle + #t + (bucket-id debug-draw1) + (the-as vector (-> gp-0 0)) + (-> gp-0 0 vertex 1) + (-> gp-0 0 vertex 2) + (the-as rgba t1-0) + ) + ) + (set! gp-0 (the-as (inline-array collide-cache-tri) (-> gp-0 1))) + ) + ) + 0 + (none) + ) + +(deftype los-dist (structure) + ((par-dist float :offset-assert 0) + (lat-dist float :offset-assert 4) + (vert-dist float :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + + +(deftype collide-los-dist-info (structure) + ((min-par float :offset-assert 0) + (max-par float :offset-assert 4) + (min-lat float :offset-assert 8) + (max-lat float :offset-assert 12) + (min-vp float :offset-assert 16) + (max-vp float :offset-assert 20) + (min-vn float :offset-assert 24) + (max-vn float :offset-assert 28) + (count int32 :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x24 + :flag-assert #x900000024 + ) + + +(defun dist-info-init ((arg0 collide-los-dist-info)) + (set! (-> arg0 min-par) 1.0) + (set! (-> arg0 max-par) 0.0) + (set! (-> arg0 count) 0) + 0 + (none) + ) + +(defun dist-info-valid? ((arg0 collide-los-dist-info)) + (>= (-> arg0 max-par) (-> arg0 min-par)) + ) + +(defun dist-info-append ((arg0 collide-los-dist-info) (arg1 vector)) + (cond + ((dist-info-valid? arg0) + (if (< (-> arg1 x) (-> arg0 min-par)) + (set! (-> arg0 min-par) (-> arg1 x)) + ) + (if (< (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + ) + (if (< (-> arg1 y) (-> arg0 min-lat)) + (set! (-> arg0 min-lat) (-> arg1 y)) + ) + (if (< (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + ) + (cond + ((< (-> arg1 y) 0.0) + (if (< (-> arg1 z) (-> arg0 min-vn)) + (set! (-> arg0 min-vn) (-> arg1 z)) + ) + (if (< (-> arg0 max-vn) (-> arg1 z)) + (set! (-> arg0 max-vn) (-> arg1 z)) + ) + ) + (else + (if (< (-> arg1 z) (-> arg0 min-vp)) + (set! (-> arg0 min-vp) (-> arg1 z)) + ) + (if (< (-> arg0 max-vp) (-> arg1 z)) + (set! (-> arg0 max-vp) (-> arg1 z)) + ) + ) + ) + ) + (else + (set! (-> arg0 min-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 min-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 min-vp) 0.0) + (set! (-> arg0 max-vp) 0.0) + (set! (-> arg0 min-vn) 0.0) + (set! (-> arg0 max-vn) 0.0) + (cond + ((< (-> arg1 y) 0.0) + (set! (-> arg0 min-vn) (-> arg1 z)) + (set! (-> arg0 max-vn) (-> arg1 z)) + ) + (else + (set! (-> arg0 min-vp) (-> arg1 z)) + (set! (-> arg0 max-vp) (-> arg1 z)) + ) + ) + ) + ) + (+! (-> arg0 count) 1) + (none) + ) + +(defun dist-info-print ((arg0 collide-los-dist-info) (arg1 string)) + (cond + ((dist-info-valid? arg0) + (format + *stdcon* + "~S ~2,D mn ~,,2M mx ~,,2M mnl ~,,2M mxl ~,,2M~%" + arg1 + (-> arg0 count) + (-> arg0 min-par) + (-> arg0 max-par) + (-> arg0 min-lat) + (-> arg0 max-lat) + ) + (format + *stdcon* + " mnvp ~,,2M mxvp ~,,2M mnvn ~,,2M mxvn ~,,2M~%" + (-> arg0 min-vp) + (-> arg0 max-vp) + (-> arg0 min-vn) + (-> arg0 max-vn) + ) + ) + (else + (format *stdcon* "~S invalid~%" arg1) + ) + ) + ) + +(deftype collide-los-result (structure) + ((lateral vector :inline :offset-assert 0) + (cw collide-los-dist-info :inline :offset-assert 16) + (ccw collide-los-dist-info :inline :offset-assert 64) + (straddle collide-los-dist-info :inline :offset-assert 112) + (lateral-valid symbol :offset-assert 148) + ) + :method-count-assert 9 + :size-assert #x98 + :flag-assert #x900000098 + ) + + +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +(defun + los-cw-ccw + ((arg0 (inline-array collide-cache-tri)) + (arg1 vector) + (arg2 vector) + (arg3 float) + (arg4 clip-travel-vector-to-mesh-return-info) + (arg5 vector) + (arg6 float) + ) + (local-vars + (sv-128 float) + (sv-144 vector) + (sv-160 vector) + (sv-176 vector) + (sv-192 vector) + (sv-208 int) + ) + (with-pp + (set! sv-128 arg3) + (let ((gp-0 arg4)) + (set! sv-144 arg5) + (let ((s4-0 arg6)) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((f30-0 0.0) + (s0-0 #f) + ) + (set! sv-208 0) + (while (< sv-208 4) + (cond + ((= sv-208 3) + (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 368))) + (set! (-> s5-0 vector sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! + (-> s5-0 vector sv-208 z) + (vector-dot sv-160 (-> *camera* local-down)) + ) + (vector-! + sv-160 + (-> arg0 0 vertex sv-208) + (the-as vector (&-> pp stack 368)) + ) + ) + ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 368))) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (set! sv-208 (+ sv-208 1)) + ) + (cond + ((and s0-0 (!= s4-0 -100000000.0)) + (dotimes (s4-1 4) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 vert-0)) + (the-as vector (+ (the-as uint s5-0) (* s4-1 16))) + ) + ) + #f + ) + ((< (-> s5-0 vector 3 y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 next-normal)) + (the-as vector (+ (the-as uint s5-0) (* s4-2 16))) + ) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 vector 3 y)) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 intersection)) + (the-as vector (+ (the-as uint s5-0) (* s4-3 16))) + ) + ) + ) + #f + ) + ) + ) + ) + ) + ) + ) + ) + +(defun cam-los-spline-collide ((arg0 vector) (arg1 vector) (arg2 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 *collide-cache*) + (f30-0 2.0) + ) + 0.0 + (vector-! s5-0 arg1 arg0) + (dummy-14 + s4-0 + arg0 + s5-0 + (-> *CAM_STRING-bank* los-coll-rad2) + #x4a09 + (the-as process #f) + (the-as int arg2) + ) + (let* ((f0-2 (vector-length s5-0)) + (f28-0 (cond + ((< f0-2 (-> *CAMERA-bank* min-detectable-velocity)) + 0.0 + ) + (else + (let* + ((f0-3 + (/ + (* + 3.0 + (- + (-> *CAM_STRING-bank* los-coll-rad2) + (-> *CAMERA-bank* collide-move-rad) + ) + ) + f0-2 + ) + ) + (f0-4 (- 1.0 f0-3)) + ) + (fmin 1.0 (fmax 0.0 f0-4)) + ) + ) + ) + ) + (s3-0 (-> s4-0 tris)) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (countdown (s4-1 (-> s4-0 num-tris)) + (let + ((f0-7 + (moving-sphere-triangle-intersect + arg0 + s5-0 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> s3-0 0) + s2-0 + s1-0 + ) + ) + ) + (cond + ((or (< f0-7 0.0) (< f28-0 f0-7)) + ) + ((< f0-7 f30-0) + (set! f30-0 f0-7) + ) + ) + ) + (set! s3-0 (the-as (inline-array collide-cache-tri) (-> s3-0 1))) + ) + ) + (if (= f30-0 2.0) + (set! f30-0 -1.0) + ) + f30-0 + ) + ) + +(defbehavior + cam-los-setup-lateral camera-slave + ((arg0 clip-travel-vector-to-mesh-return-info) (arg1 vector) (arg2 vector)) + (cond + ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 vert-0))) + (let ((f30-0 (-> arg0 vert-0 z)) + (f28-0 (-> arg0 vert-0 w)) + ) + (if + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (set! f28-0 (fmax f28-0 (-> arg0 intersection w))) + ) + (if (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (set! f30-0 (fmin f30-0 (- (-> arg0 next-normal w)))) + ) + (cond + ((= (-> self los-state) 2) + (if *display-cam-los-debug* + (format *stdcon* "straddle stick ccw~%") + ) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((= (-> self los-state) 1) + (if *display-cam-los-debug* + (format *stdcon* "straddle stick cw~%") + ) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and + (or + (< 0.01 (-> arg0 vert-1 y)) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 next-normal)) + ) + (< 0.01 (the-as float (-> arg0 gap-poly))) + ) + ) + (or + (< (-> arg0 vert-1 x) -0.01) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 next-normal)) + ) + (< (the-as float (-> arg0 poly)) -0.01) + ) + ) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + (or + (< (-> arg0 boundary-normal y) 0.01) + (< -0.01 (-> arg0 boundary-normal x)) + ) + ) + ) + (when + (not + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + ) + ) + (if + (not + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + ) + (format #t "s diag ccw invalid cw~%") + ) + (if *display-cam-los-debug* + (format *stdcon* "straddle diagonal ccw~%") + ) + (set! (-> self los-state) (the-as uint 2)) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and + (or + (< 0.01 (-> arg0 vert-1 w)) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + (< 0.01 (-> arg0 boundary-normal y)) + ) + ) + (or + (< (-> arg0 vert-1 z) -0.01) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + (< (-> arg0 boundary-normal x) -0.01) + ) + ) + (and + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (or + (< (the-as float (-> arg0 gap-poly)) 0.01) + (< -0.01 (the-as float (-> arg0 poly))) + ) + ) + ) + (if + (not + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + ) + (format #t "s diag cw invalid ccw~%") + ) + (when + (not + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + ) + ) + (if *display-cam-los-debug* + (format *stdcon* "straddle diagonal cw~%") + ) + (set! (-> self los-state) (the-as uint 1)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((< f28-0 (- f30-0)) + (if *display-cam-los-debug* + (format *stdcon* "straddle ccw~%") + ) + (set! (-> self los-state) (the-as uint 2)) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + (else + (if *display-cam-los-debug* + (format *stdcon* "straddle cw~%") + ) + (set! (-> self los-state) (the-as uint 1)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ) + ) + ) + ((and + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (< 0.01 (the-as float (-> arg0 gap-poly))) + (< (the-as float (-> arg0 poly)) -0.01) + (or + (< (-> arg0 boundary-normal y) 0.01) + (< -0.01 (-> arg0 boundary-normal x)) + ) + ) + (if *display-cam-los-debug* + (format *stdcon* "diagonal ccw~%") + ) + (set! (-> self los-state) (the-as uint 2)) + (vector-normalize! + arg1 + (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z)) + ) + ) + ((and + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (< 0.01 (-> arg0 boundary-normal y)) + (< (-> arg0 boundary-normal x) -0.01) + (or + (< (the-as float (-> arg0 gap-poly)) 0.01) + (< -0.01 (the-as float (-> arg0 poly))) + ) + ) + (if *display-cam-los-debug* + (format *stdcon* "diagonal cw~%") + ) + (set! (-> self los-state) (the-as uint 1)) + (vector-normalize! + arg1 + (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad)) + ) + ) + ((and + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + ) + (set! (-> self los-state) (the-as uint 3)) + (vector-normalize! arg1 (the-as float 0.0001)) + ) + ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (if *display-cam-los-debug* + (format *stdcon* "regular cw~%") + ) + (set! (-> self los-state) (the-as uint 1)) + (vector-normalize! + arg1 + (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad)) + ) + ) + ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (if *display-cam-los-debug* + (format *stdcon* "regular ccw~%") + ) + (set! (-> self los-state) (the-as uint 2)) + (vector-normalize! + arg1 + (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z)) + ) + ) + (else + (set! (-> self los-state) (the-as uint 0)) + (vector-reset! arg1) + ) + ) + (cond + ((= (vector-length arg1) 0.0) + (set! (-> arg0 vert-next y) (the-as float #f)) + #f + ) + (else + (vector-! (the-as vector (&-> arg0 found-boundary)) arg1 arg2) + (vector-normalize! + (the-as vector (&-> arg0 found-boundary)) + (the-as float 1.0) + ) + (let ((v0-45 #t)) + (set! (-> arg0 vert-next y) (the-as float v0-45)) + v0-45 + ) + ) + ) + ) + +;; WARN: Unsupported inline assembly instruction kind - [mula.s f2, f5] +;; WARN: Unsupported inline assembly instruction kind - [madda.s f3, f6] +;; WARN: Unsupported inline assembly instruction kind - [madd.s f2, f4, f7] +(defbehavior + cam-los-collide camera-slave + ((arg0 vector) + (arg1 vector) + (arg2 clip-travel-vector-to-mesh-return-info) + (arg3 int) + ) + (local-vars + (s1-3 int) + (s2-2 int) + (f2-1 float) + (sv-224 vector) + (sv-240 vector) + ) + (dist-info-init (the-as collide-los-dist-info (-> arg2 intersection))) + (dist-info-init (the-as collide-los-dist-info (-> arg2 next-normal))) + (dist-info-init (the-as collide-los-dist-info (-> arg2 vert-0))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize-copy! s2-0 arg1 (the-as float 1.0)) + (vector-flatten! s4-0 arg1 (-> *camera* local-down)) + (let ((s0-0 *collide-cache*) + (f26-0 (vector-length arg1)) + (f30-0 (vector-normalize-ret-len! s4-0 (the-as float 1.0))) + ) + (dummy-14 + s0-0 + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad) + #x4a09 + (the-as process #f) + arg3 + ) + (let ((s1-1 (-> s0-0 tris)) + (f28-0 (/ 2048.0 f26-0)) + (f26-1 (/ (+ -8192.0 f26-0) f26-0)) + ) + (if (< f26-1 0.0) + (set! f26-1 0.0) + ) + (if (< 1.0 f28-0) + (set! f28-0 1.0) + ) + (countdown (s0-1 (-> s0-0 num-tris)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (set! sv-224 (new 'stack-no-clear 'vector)) + (let + ((f0-7 + (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad) + (-> s1-1 0) + sv-240 + sv-224 + ) + ) + ) + (cond + ((or (< f0-7 0.0) (< 1.0 f0-7)) + ) + ((let ((f1-2 0.0)) + (let* ((v1-21 arg1) + (f2-0 (-> v1-21 x)) + (f3-0 (-> v1-21 y)) + (f4-0 (-> v1-21 z)) + (f5-0 (-> sv-224 x)) + (f6-0 (-> sv-224 y)) + (f7-0 (-> sv-224 z)) + ) + ; TODO - fix me! + ; (.mula.s f2-0 f5-0) + ; (.madda.s f3-0 f6-0) + ; (.madd.s f2-1 f4-0 f7-0) + ) + (< f1-2 f2-1) + ) + (when (< f28-0 f0-7) + (let* ((t1-2 (new 'stack-no-clear 'vector)) + (t0-2 (new 'stack-no-clear 'vector)) + (f24-0 + (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> s1-1 0) + t0-2 + t1-2 + ) + ) + ) + (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-0) + (when *debug-segment* + (cond + ((= f24-0 -100000000.0) + (let ((t9-11 cam-debug-add-los-tri) + (a0-13 s1-1) + (a2-7 + (new 'static 'vector + :x (the-as float #x80) + :w (the-as float #x80) + ) + ) + ) + (t9-11 a0-13 sv-240 a2-7) + ) + ) + (else + (cam-debug-add-los-tri + s1-1 + sv-240 + (new 'static 'vector + :x (the-as float #x80) + :y (the-as float #x80) + :w (the-as float #x80) + ) + ) + ) + ) + ) + ) + ) + ) + ((< f0-7 f26-1) + (let* ((t1-4 (new 'stack-no-clear 'vector)) + (t0-4 (new 'stack-no-clear 'vector)) + (f24-1 + (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> s1-1 0) + t0-4 + t1-4 + ) + ) + ) + (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-1) + (when *debug-segment* + (if (= f24-1 -100000000.0) + (cam-debug-add-los-tri + s1-1 + sv-240 + (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80)) + ) + (cam-debug-add-los-tri + s1-1 + sv-240 + (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80)) + ) + ) + ) + ) + ) + ) + ) + (set! s1-1 (the-as (inline-array collide-cache-tri) (-> s1-1 1))) + ) + ) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'vector))) + 0.0 + (vector-cross! s4-1 arg1 (-> *camera* local-down)) + (cond + ((!= + (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (when *display-cam-los-debug* + (format *stdcon* "emergency point jump~%") + (format 0 "emergency point jump~%") + ) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline used-point)) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (logior! (-> self options) 4096) + (set! + (-> self good-point quad) + (-> + *camera* + target-spline + point + (-> *camera* target-spline used-point) + position + quad + ) + ) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *debug-segment* + (let ((a1-22 (new 'stack-no-clear 'vector))) + (vector-! a1-22 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-22 -3 'jump self) + ) + ) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (set! (-> self string-trans quad) (-> self good-point quad)) + (vector-! + (-> self view-flat) + (-> self string-trans) + (-> *camera* tpos-curr-adj) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (vector-reset! (-> self velocity)) + (let ((f0-11 (vector-length (-> self view-flat)))) + (if (< f0-11 (-> self min-z-override)) + (set! (-> self min-z-override) f0-11) + ) + ) + ) + (else + (let + ((f30-1 + (cam-los-spline-collide + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> *camera* target-spline end-point)) + ) + ) + arg0 + (the-as vector 4098) + ) + ) + ) + (cond + ((< f30-1 0.0) + (if *display-cam-los-debug* + (format *stdcon* "good ~f~%" f30-1) + ) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> + *camera* + target-spline + point + (-> self los-tgt-spline-pt) + incarnation + ) + ) + (set! (-> self los-last-pos quad) (-> arg0 quad)) + ) + ((begin + (if *display-cam-los-debug* + (format + *stdcon* + "looking vel ~M u ~f pt ~D" + (vector-length (-> self velocity)) + f30-1 + (-> self los-tgt-spline-pt) + ) + ) + (set! s2-2 (-> self los-tgt-spline-pt)) + (set! s1-3 -134250495) + (while (and (!= s2-2 -134250495) (begin + (set! + f30-1 + (cam-los-spline-collide + (the-as + vector + (+ + (the-as + uint + (-> *camera* target-spline) + ) + (* 48 s2-2) + ) + ) + arg0 + (the-as vector 4098) + ) + ) + (< f30-1 0.0) + ) + ) + (set! s1-3 s2-2) + (set! s2-2 (-> *camera* target-spline point s2-2 next)) + ) + (and + (= s2-2 (-> *camera* target-spline used-point)) + (!= (-> *camera* target-spline point s2-2 next) -134250495) + ) + ) + (when *display-cam-los-debug* + (format 0 "looking at used point~%") + (format *stdcon* " at used point~%") + ) + (set! + (-> self los-tgt-spline-pt) + (-> *camera* target-spline point s2-2 next) + ) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> + *camera* + target-spline + point + (-> self los-tgt-spline-pt) + incarnation + ) + ) + (logior! (-> self options) 4096) + (set! + (-> self good-point quad) + (-> *camera* target-spline point s2-2 position quad) + ) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *debug-segment* + (let ((a1-38 (new 'stack-no-clear 'vector))) + (vector-! a1-38 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-38 -3 'jump self) + ) + ) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (set! (-> self string-trans quad) (-> self good-point quad)) + (vector-! + (-> self view-flat) + (-> self string-trans) + (-> *camera* tpos-curr-adj) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (vector-reset! (-> self velocity)) + (let ((f0-14 (vector-length (-> self view-flat)))) + (if (< f0-14 (-> self min-z-override)) + (set! (-> self min-z-override) f0-14) + ) + ) + ) + ((!= s1-3 -134250495) + (if *display-cam-los-debug* + (format *stdcon* " ok~%") + ) + (set! (-> self los-tgt-spline-pt) s1-3) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> + *camera* + target-spline + point + (-> self los-tgt-spline-pt) + incarnation + ) + ) + (set! (-> self los-last-pos quad) (-> arg0 quad)) + ) + (else + (if *display-cam-los-debug* + (format + *stdcon* + "~%failed u ~f cur ~D seen ~D tgt-pt ~D~%" + f30-1 + s2-2 + s1-3 + (-> self los-tgt-spline-pt) + ) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! + s3-1 + (-> self los-last-pos) + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> self los-tgt-spline-pt)) + ) + ) + ) + (let ((f28-1 (vector-length s3-1))) + (if (= f28-1 0.0) + (set! f28-1 0.4096) + ) + (let ((f30-2 (cond + ((and + (= (-> self string-vel-dir) 6) + (< + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + ) + (fmin 1.0 (+ 0.001 f30-1)) + ) + ((= (-> self string-vel-dir) 6) + (fmin 0.9999 f30-1) + ) + (else + (fmax 0.001 (+ -0.001 f30-1)) + ) + ) + ) + ) + (let ((s2-3 (new 'stack-no-clear 'vector))) + (vector-! + s2-3 + (-> *camera* tpos-curr-adj) + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> self los-tgt-spline-pt)) + ) + ) + ) + (vector-flatten! s2-3 s2-3 (-> *camera* local-down)) + (cond + ((and + (< (fabs (- (-> self desired-pos y) (-> self trans y))) 8192.0) + (< f28-1 (+ 1024.0 (-> self string-min-val z))) + (< (vector-length s2-3) 8192.0) + ) + (set! f30-2 0.0) + ) + ((< f28-1 (+ 1024.0 (-> self string-min-val z))) + ) + ((< (* f28-1 f30-2) (-> self string-min-val z)) + (set! f30-2 (/ (-> self string-min-val z) f28-1)) + ) + ) + ) + (when (< 0.0 f30-2) + (vector-! s3-1 (-> *camera* tpos-curr) (-> *camera* tpos-old)) + (vector-! + (-> self good-point) + (-> self los-last-pos) + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> self los-tgt-spline-pt)) + ) + ) + ) + (vector-float*! (-> self good-point) (-> self good-point) f30-2) + (vector+! + (-> self good-point) + (-> self good-point) + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> self los-tgt-spline-pt)) + ) + ) + ) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *display-cam-los-debug* + (format + 0 + "going because u(~f) > 0 frame ~D~%" + f30-2 + (-> *display* base-frame-counter) + ) + (format + *stdcon* + " going because u(~f) > 0 frame ~D~%" + f30-2 + (-> *display* base-frame-counter) + ) + ) + (logior! (-> self options) 4096) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (if *display-cam-los-debug* + (format + *stdcon* + "los-last ~M ~M ~M~%" + (-> self los-last-pos x) + (-> self los-last-pos y) + (-> self los-last-pos z) + ) + ) + (cam-los-setup-lateral arg2 s4-1 arg1) + ) + (cond + ((zero? (logand (-> self options) 1024)) + ) + ((= (-> self string-vel-dir) 5) + ) + ((and (= (-> self string-vel-dir) 2) (= (-> self los-state) 1)) + ) + ((and (= (-> self string-vel-dir) 1) (= (-> self los-state) 2)) + ) + ) + (when *display-cam-los-debug* + (format *stdcon* "state ~S" (slave-los-state->string (-> self los-state))) + (cond + ((zero? (-> self string-vel-dir)) + (format *stdcon* " vzero") + ) + ((= (-> self string-vel-dir) 2) + (format *stdcon* " vcw") + ) + ((= (-> self string-vel-dir) 1) + (format *stdcon* " vccw") + ) + ((= (-> self string-vel-dir) 3) + (format *stdcon* " up") + ) + ((= (-> self string-vel-dir) 4) + (format *stdcon* " down") + ) + ((= (-> self string-vel-dir) 6) + (format *stdcon* " long") + ) + ((= (-> self string-vel-dir) 5) + (format *stdcon* " short") + ) + ) + (format *stdcon* "~%") + ) + (when *display-cam-los-info* + (dist-info-print + (the-as collide-los-dist-info (-> arg2 intersection)) + "cw " + ) + (dist-info-print + (the-as collide-los-dist-info (-> arg2 next-normal)) + "ccw " + ) + (dist-info-print (the-as collide-los-dist-info (-> arg2 vert-0)) "strdl") + ) + (the-as symbol 0) + ) + +(defbehavior cam-string-follow camera-slave () + (let ((f30-0 (vector-length (-> self view-flat)))) + (cond + ((logtest? #x10000 (-> self options)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-cross! s5-0 (-> self view-flat) (-> *camera* local-down)) + (vector-normalize! s5-0 (the-as float 1.0)) + (vector-! gp-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-flatten! gp-0 gp-0 s5-0) + ) + (if (< (vector-dot gp-0 (-> self view-flat)) 0.0) + (vector-! (-> self view-flat) (-> self view-flat) gp-0) + ) + ) + ) + (else + (let ((v1-9 (new 'stack-no-clear 'vector))) + (vector-! v1-9 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-! (-> self view-flat) (-> self view-flat) v1-9) + ) + ) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (let* ((f28-0 (vector-length (-> self view-flat))) + (f0-3 (fmin (-> *camera* string-push-z) (-> self view-off z))) + (f26-0 (-> self view-off z)) + (f0-4 (fmin f0-3 (-> self min-z-override))) + ) + (cond + ((logtest? (-> self options) #x4000) + (let ((a0-17 (new-stack-vector0))) + 0.0 + (vector-! a0-17 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (let ((f0-6 (vector-length a0-17))) + (set! + f0-4 + (lerp-clamp + (the-as float 28672.0) + (the-as float 32768.0) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f0-6))) + ) + ) + ) + ) + (set! f26-0 f0-4) + (+! + (-> self fov) + (fmax -91.022224 (fmin 91.022224 (* 0.1 (- 17294.223 (-> self fov))))) + ) + ) + (else + (+! + (-> self fov) + (fmax -182.04445 (fmin 182.04445 (* 0.1 (- 11650.845 (-> self fov))))) + ) + ) + ) + (cond + ((< f28-0 f0-4) + (vector-normalize! (-> self view-flat) f0-4) + ) + ((and + (< f30-0 f28-0) + (or (= (-> self los-state) 2) (= (-> self los-state) 1)) + ) + (vector-normalize! (-> self view-flat) f30-0) + ) + ((< f26-0 f28-0) + (vector-normalize! (-> self view-flat) f26-0) + (set! (-> self min-z-override) f26-0) + f26-0 + ) + (else + (set! (-> self min-z-override) f28-0) + f28-0 + ) + ) + ) + ) + ) + +(defbehavior cam-string-line-of-sight camera-slave () + (let ((gp-0 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (new 'stack-no-clear 'vector) + (let ((f30-0 (vector-length (-> self view-flat)))) + (vector--float*! + s5-0 + (-> *camera* tpos-curr) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (vector-! s5-0 s5-0 (-> self string-trans)) + (cam-los-collide (-> self string-trans) s5-0 gp-0 4098) + (when (-> gp-0 vert-next y) + (when (or (= (-> self los-state) 2) (= (-> self los-state) 1)) + (let ((a0-6 (new 'stack-no-clear 'vector))) + (vector-! a0-6 (-> *camera* tpos-curr) (-> *camera* tpos-old)) + (if + (and + (< (-> self string-min-val z) f30-0) + (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length a0-6)) + ) + (set! f30-0 (+ -204.8 f30-0)) + ) + ) + ) + (if (< f30-0 (fmin (-> self string-min-val z) (-> self min-z-override))) + (set! f30-0 (fmin (-> self string-min-val z) (-> self min-z-override))) + ) + (if (< f30-0 (-> self min-z-override)) + (set! (-> self min-z-override) f30-0) + ) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + 0.0 + (vector-flatten! + s4-0 + (the-as vector (&-> gp-0 found-boundary)) + (-> *camera* local-down) + ) + (vector-normalize! s4-0 (the-as float 1.0)) + (vector-normalize-copy! s5-1 (-> self view-flat) (the-as float 1.0)) + (let + ((f0-12 + (lerp-clamp + (the-as float 418.7022) + (the-as float 364.0889) + (/ + (- f30-0 (-> self string-min-val z)) + (- (-> self string-max-val z) (-> self string-min-val z)) + ) + ) + ) + ) + (matrix-from-two-vectors-max-angle-partial! + (the-as matrix s3-0) + s5-1 + s4-0 + f0-12 + (the-as float 0.5) + ) + ) + (vector-matrix*! + (-> self view-flat) + (-> self view-flat) + (the-as matrix s3-0) + ) + ) + (vector-normalize! (-> self view-flat) f30-0) + ) + ) + ) + ) + +(defun cam-dist-analog-input ((arg0 int) (arg1 float)) + (let ((f0-0 0.0)) + (cond + ((< arg0 28) + (set! f0-0 (- (fmin arg1 (* 0.083333336 (- 28.0 (the float arg0)) arg1)))) + ) + ((< 160 arg0) + (set! f0-0 (fmin arg1 (* 0.0125 (+ -160.0 (the float arg0)) arg1))) + ) + ) + f0-0 + ) + ) + +(defbehavior cam-string-joystick camera-slave () + (set! (-> self options) (logand -257 (-> self options))) + (let + ((f28-0 + (cam-dist-analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + (the-as float 0.05) + ) + ) + (f0-2 + (/ + (- (vector-length (-> self view-flat)) (-> self string-min-val z)) + (- (-> self string-max-val z) (-> self string-min-val z)) + ) + ) + (f30-0 (-> self view-off-param)) + ) + (if (-> self have-phony-joystick) + (set! f28-0 (* 0.05 (-> self phony-joystick-y))) + ) + (if + (and + (-> *camera* being-attacked) + (< + (- + (-> *display* base-frame-counter) + (the-as int (-> *camera* attack-start)) + ) + 75 + ) + ) + (set! f28-0 0.05) + ) + (if (!= f28-0 0.0) + (logior! (-> self options) 256) + ) + (let ((f26-0 (fmin 1.0 f0-2))) + (let ((f0-3 f26-0)) + (when (< f26-0 0.0) + (let + ((f0-6 + (/ + (- (-> self string-min-val z) (vector-length (-> self view-flat))) + (* 0.5 (-> self string-min-val z)) + ) + ) + ) + (set! f0-3 (fmin 0.75 f0-6)) + ) + ) + (let ((f1-10 (-> self string-min-val y)) + (f2-3 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f1-10 f2-3 f0-3)) + ) + ) + (when (< f26-0 0.0) + (let ((v1-28 (new 'stack-no-clear 'vector))) + (vector-! v1-28 (-> self string-trans) (-> *camera* tpos-curr-adj)) + (let + ((f0-12 + (- + (- (vector-dot v1-28 (-> *camera* local-down))) + (-> *camera* target-height) + ) + ) + ) + (set! + (-> self view-off y) + (fmin (-> *camera* stringCliffHeight) (fmax f0-12 (-> self view-off y))) + ) + ) + ) + ) + (let ((f0-16 (fmax 0.0 f26-0))) + (cond + ((logtest? (-> self options) #x4000) + ) + ((not *camera-read-analog*) + ) + ((and (>= 0.0 f28-0) (>= 0.0 f0-16)) + ) + ((and (>= f28-0 0.0) (>= f0-16 1.0)) + ) + ((and + (< 0.0 f28-0) + (or (= (-> self los-state) 2) (= (-> self los-state) 1)) + ) + ) + ((< (* 0.05 (- 1.0 f0-16)) f28-0) + (let ((f0-17 (+ f0-16 (* 0.05 (- 1.0 f0-16))))) + (set! (-> self view-off-param) (fmax (-> self view-off-param) f0-17)) + (vector-normalize! + (-> self view-flat) + (lerp (-> self string-min-val z) (-> self string-max-val z) f0-17) + ) + ) + ) + ((< f28-0 (* 0.05 (- f0-16))) + (set! (-> self view-off-param) (+ f0-16 (* 0.05 (- f0-16)))) + ) + ((< 0.0 f28-0) + (let ((f0-19 (+ f0-16 (* f28-0 (-> *display* time-adjust-ratio))))) + (set! (-> self view-off-param) (fmax (-> self view-off-param) f0-19)) + (vector-normalize! + (-> self view-flat) + (lerp (-> self string-min-val z) (-> self string-max-val z) f0-19) + ) + ) + ) + ((< f28-0 0.0) + (set! + (-> self view-off-param) + (+ f0-16 (* f28-0 (-> *display* time-adjust-ratio))) + ) + ) + ) + ) + ) + (if (= f28-0 0.0) + (set! (-> self view-off z) (-> self string-max-val z)) + (set! + (-> self view-off z) + (lerp + (-> self string-min-val z) + (-> self string-max-val z) + (-> self view-off-param) + ) + ) + ) + (if (-> *camera* being-attacked) + (set! (-> self view-off-param) f30-0) + ) + ) + (when *camera-read-analog* + (let + ((f0-29 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 21845.334 (-> *display* seconds-per-frame)) + ) + ) + (s4-0 (new-stack-matrix0)) + (gp-2 (new-stack-vector0)) + (s5-2 (new-stack-vector0)) + ) + (if (-> self have-phony-joystick) + (set! + f0-29 + (* 21845.334 (-> self phony-joystick-x) (-> *display* seconds-per-frame)) + ) + ) + (cond + ((and (= (-> self los-state) 2) (< 0.0 f0-29)) + (let + ((f0-34 + (fmax + (-> self string-min-val z) + (fmin (-> self string-max-val z) (vector-length (-> self view-flat))) + ) + ) + ) + (set! + f0-29 + (* + 21845.334 + (+ 0.1 (/ (-> self string-min-val z) f0-34)) + (-> *display* seconds-per-frame) + ) + ) + ) + ) + ((and (= (-> self los-state) 1) (< f0-29 0.0)) + (let + ((f0-40 + (fmax + (-> self string-min-val z) + (fmin (-> self string-max-val z) (vector-length (-> self view-flat))) + ) + ) + ) + (set! + f0-29 + (* + -21845.334 + (+ 0.1 (/ (-> self string-min-val z) f0-40)) + (-> *display* seconds-per-frame) + ) + ) + ) + ) + ) + (cond + ((!= f0-29 0.0) + (logior! (-> self options) 256) + (matrix-axis-angle! s4-0 (-> *camera* local-down) f0-29) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + ((logtest? (-> self options) 1) + (vector-normalize-copy! gp-2 (-> self view-flat) (the-as float 1.0)) + (vector-flatten! + s5-2 + (-> *camera* tgt-rot-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s5-2 (the-as float -1.0)) + (matrix-from-two-vectors-max-angle-partial! + s4-0 + gp-2 + s5-2 + (* 10922.667 (-> *display* seconds-per-frame)) + (the-as float 0.05) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + ) + (when (logtest? (-> self options) #x4000) + (vector-normalize-copy! gp-2 (-> self view-flat) (the-as float 1.0)) + (vector-flatten! + s5-2 + (-> *camera* tgt-rot-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s5-2 (the-as float -1.0)) + (let ((f0-47 (acos (vector-dot s5-2 gp-2)))) + (when (and (< 8192.0 f0-47) (< f0-47 32585.955)) + (matrix-from-two-vectors-max-angle! + s4-0 + gp-2 + s5-2 + (fmin 546.13336 (* 0.5 (+ -8192.0 f0-47))) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + ) + ) + ) + ) + ) + +(defbehavior cam-string-find-hidden camera-slave () + (let ((s4-0 (new 'stack-no-clear 'collide-mesh-cache-tri)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (vector--float*! + s5-0 + (-> *camera* tpos-curr-adj) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (vector-! s5-0 s5-0 (-> self string-trans)) + (cond + ((< + (dummy-10 + *collide-cache* + (-> self string-trans) + s5-0 + (the-as float 40.96) + #x4a09 + (the-as process #f) + s4-0 + 2 + ) + 0.0 + ) + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + ((< (-> self time-dist-too-far) (the-as uint 600)) + (+! (-> self time-dist-too-far) 1) + ) + ((cam-string-find-position-rel! gp-0) + (cam-string-set-position-rel! gp-0) + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + (else + (format 0 "camera position search failed~%") + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + ) + ) + (none) + ) + +;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 +(defbehavior cam-string-move camera-slave () + (local-vars (sv-240 float) (sv-256 float)) + (vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans)) + (if *display-cam-los-debug* + (format *stdcon* "vel ~M~%" (vector-length (-> self velocity))) + ) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector+float*! s5-1 (-> self velocity) s3-0 (the-as float 0.5)) + (vector-normalize! s5-1 (the-as float 1.0)) + (vector-normalize-copy! s4-1 (-> self view-flat) (the-as float 1.0)) + (vector-cross! gp-1 s4-1 s5-1) + (cond + ((and + (< + (vector-length (-> self velocity)) + (-> *CAMERA-bank* min-detectable-velocity) + ) + (< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity)) + ) + (set! (-> self string-vel-dir) (the-as uint 0)) + 0 + ) + ((< + (cos (the-as float 5461.3335)) + (vector-dot (-> *camera* local-down) s5-1) + ) + (set! (-> self string-vel-dir) (the-as uint 4)) + ) + ((< + (vector-dot (-> *camera* local-down) s5-1) + (- (cos (the-as float 5461.3335))) + ) + (set! (-> self string-vel-dir) (the-as uint 3)) + ) + ((< (cos (the-as float 5461.3335)) (vector-dot s4-1 s5-1)) + (set! (-> self string-vel-dir) (the-as uint 6)) + ) + ((< (vector-dot s4-1 s5-1) (- (cos (the-as float 5461.3335)))) + (set! (-> self string-vel-dir) (the-as uint 5)) + ) + ((< (vector-dot (-> *camera* local-down) gp-1) 0.0) + (set! (-> self string-vel-dir) (the-as uint 1)) + ) + (else + (set! (-> self string-vel-dir) (the-as uint 2)) + ) + ) + ) + 0.0 + (let ((f30-2 1.0) + (s5-2 (new-stack-vector0)) + (gp-2 0) + ) + (let ((s4-2 (new 'stack-no-clear 'collide-mesh-cache-tri)) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (when *debug-segment* + (if + (>= + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + (cam-collision-record-save + (-> self string-trans) + (-> self velocity) + -1 + 'no-hit + self + ) + ) + ) + (while + (and + (< 0.01 f30-2) + (and + (< + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + (< gp-2 4) + ) + ) + (vector-float*! s5-2 (-> self velocity) f30-2) + (if *debug-segment* + (cam-collision-record-save (-> self string-trans) s5-2 gp-2 'normal self) + ) + (let ((f28-1 (if (logtest? (-> self options) 32) + (dummy-10 + *collide-cache* + (-> self string-trans) + s5-2 + (-> *CAMERA-bank* collide-move-rad) + #x4a09 + (the-as process #f) + s4-2 + 2 + ) + -100000000.0 + ) + ) + ) + (when *display-cam-los-debug* + (let ((s2-0 format) + (s1-0 *stdcon*) + (s0-0 "vp ~f vr ~f r ~f ta ~f~%") + ) + (set! sv-240 (vector-length s5-2)) + (set! sv-256 f30-2) + (let ((t0-3 (/ (vector-length s5-2) f30-2)) + (t1-1 f28-1) + ) + (s2-0 s1-0 s0-0 sv-240 sv-256 t0-3 t1-1) + ) + ) + ) + (cond + ((>= f28-1 0.0) + (let* ((f1-7 (fmax 0.01 (/ 40.96 (vector-length s5-2)))) + (f0-24 (fmax 0.0 (- f28-1 f1-7))) + ) + (vector+float*! + (-> self string-trans) + (-> self string-trans) + s5-2 + f0-24 + ) + ) + (vector-! s3-1 (-> self string-trans) (-> s4-2 normal)) + (vector-normalize! s3-1 (the-as float 1.0)) + (vector-flatten! (-> self velocity) (-> self velocity) s3-1) + (set! f30-2 (- f30-2 (* f30-2 f28-1))) + (+! gp-2 1) + ) + (else + (vector+! (-> self string-trans) (-> self string-trans) s5-2) + (set! f30-2 0.0) + ) + ) + ) + ) + ) + (cond + ((zero? gp-2) + (set! (-> self options) (logand -1025 (-> self options))) + (if *display-cam-los-debug* + (format *stdcon* "not blocked~%") + ) + ) + (else + (logior! (-> self options) 1024) + (if *display-cam-los-debug* + (format *stdcon* "blocked ~D ~f~%" gp-2 f30-2) + ) + (let ((gp-3 (new-stack-vector0)) + (f30-3 (vector-length (-> self view-flat))) + ) + (vector-! gp-3 (-> self string-trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! gp-3 gp-3 (-> *camera* local-down)) + (let ((f28-3 (vector-length gp-3))) + (cond + ((< f28-3 f30-3) + (vector-normalize-copy! (-> self view-flat) gp-3 f28-3) + (set! (-> self min-z-override) f28-3) + f28-3 + ) + (else + (vector-normalize-copy! (-> self view-flat) gp-3 f30-3) + ) + ) + ) + ) + ) + ) + ) + (when *display-cam-los-debug* + (let ((a0-43 (new-stack-vector0))) + (vector-! a0-43 (-> self desired-pos) (-> self string-trans)) + (format *stdcon* "vel ~M~%" (vector-length a0-43)) + ) + ) + ) + +(defbehavior cam-string-code camera-slave () + (if *debug-segment* + (cam-debug-reset-coll-tri) + ) + (cam-string-follow) + (if (logtest? (-> self options) 512) + (cam-string-line-of-sight) + ) + (if (not (paused?)) + (cam-string-joystick) + ) + (let ((gp-0 (new-stack-vector0))) + (vector--float*! + gp-0 + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* target-height) (-> self view-off y)) + ) + (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-0) + ) + (if (logtest? (-> self options) 64) + (cam-string-find-hidden) + ) + (cond + ((logtest? (-> self options) 4096) + (when *debug-segment* + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-! a1-1 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-1 -2 'jump self) + ) + ) + (set! (-> self options) (logand -4097 (-> self options))) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (cam-string-move) + (vector-! + (-> self view-flat) + (-> self string-trans) + (-> *camera* tpos-curr-adj) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (let ((f0-2 (vector-length (-> self view-flat)))) + (if (< f0-2 (-> self min-z-override)) + (set! (-> self min-z-override) f0-2) + ) + ) + ) + (else + (cam-string-move) + ) + ) + (TODO-RENAME-17 + (-> self position-spline) + (-> self string-trans) + (the-as float 0.04096) + (the-as float 4096.0) + #t + ) + (cond + ((and (logtest? (-> self options) #x4000) (logtest? (-> self options) 256)) + (TODO-RENAME-21 + (-> self position-spline) + (-> self trans) + (the-as float 102.4) + (the-as float 4096.0) + ) + ) + ((logtest? (-> self options) #x4000) + (TODO-RENAME-21 + (-> self position-spline) + (-> self trans) + (the-as float 40.96) + (the-as float 4096.0) + ) + ) + ((logtest? (-> self options) 256) + (TODO-RENAME-21 + (-> self position-spline) + (-> self trans) + (the-as float 102.4) + (the-as float 2457.6) + ) + ) + (else + (TODO-RENAME-21 + (-> self position-spline) + (-> self trans) + (the-as float 20.48) + (the-as float 2457.6) + ) + ) + ) + ) + +(defbehavior set-string-parms camera-slave () + (when (not (-> self string-val-locked)) + (set! (-> self string-min-val quad) (-> *camera* string-min value quad)) + (let ((v0-0 (-> self string-max-val))) + (set! (-> v0-0 quad) (-> *camera* string-max value quad)) + v0-0 + ) + ) + ) + +(defstate cam-string (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + (let ((gp-0 (new-stack-vector0))) + (cam-string-find-position-rel! gp-0) + (cam-string-set-position-rel! gp-0) + ) + ) + (('joystick) + (set! (-> self phony-joystick-x) (the-as float (-> arg3 param 0))) + (set! (-> self phony-joystick-y) (the-as float (-> arg3 param 1))) + (let ((v0-1 (the-as object #t))) + (set! (-> self have-phony-joystick) (the-as symbol v0-1)) + v0-1 + ) + ) + (('set-dist) + (cond + ((-> arg3 param 0) + (set! (-> self string-val-locked) #t) + (set! + (-> self string-min-val quad) + (-> (the-as vector (-> arg3 param 0)) quad) + ) + (set! + (-> self string-max-val quad) + (-> (the-as vector (-> arg3 param 1)) quad) + ) + (set! + (-> self string-max-val x) + (fmax (-> self string-max-val x) (-> self string-min-val x)) + ) + (set! + (-> self string-max-val y) + (fmax (-> self string-max-val y) (-> self string-min-val y)) + ) + (let + ((f0-7 (fmax (-> self string-max-val z) (-> self string-min-val z)))) + (set! (-> self string-max-val z) f0-7) + f0-7 + ) + ) + (else + (set! (-> self string-val-locked) #f) + #f + ) + ) + ) + (('blocked-side?) + (-> self los-state) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set-string-parms) + (set! *camera-base-mode* cam-string) + (set! (-> self string-vel-dir) (the-as uint 0)) + (set! (-> self fov) 11650.845) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (set! (-> self min-z-override) (-> self string-max-val z)) + (if (!= (-> *camera* outro-t-step) 0.0) + (set! (-> self min-z-override) (-> self string-min-val z)) + ) + (let ((gp-0 (new-stack-vector0))) + 0.0 + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (let ((f0-7 (-> self string-min-val y)) + (f1-1 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-7 f1-1 (-> self view-off-param))) + ) + (set! + (-> self view-off z) + (lerp + (-> self string-min-val z) + (-> self string-max-val z) + (-> self view-off-param) + ) + ) + (let ((f30-0 (cond + ((!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! + gp-0 + (-> *camera* outro-exit-value) + (-> *camera* outro-curve) + ) + (vector-! gp-0 gp-0 (-> *camera* tpos-curr-adj)) + (vector-flatten! + (-> self view-flat) + gp-0 + (-> *camera* local-down) + ) + (vector-length (-> self view-flat)) + ) + (else + (vector-flatten! + (-> self view-flat) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-negate! (-> self view-flat) (-> self view-flat)) + 0.0 + ) + ) + ) + ) + (let ((f1-4 (fmin (-> *camera* string-push-z) (-> self min-z-override))) + (f0-17 (-> self view-off z)) + ) + (cond + ((< f30-0 f1-4) + (set! f30-0 f1-4) + ) + ((< f0-17 f30-0) + (set! f30-0 f0-17) + ) + ) + ) + (vector-normalize! (-> self view-flat) f30-0) + (let + ((f30-1 + (/ + (- f30-0 (-> self string-min-val z)) + (- (-> self string-max-val z) (-> self string-min-val z)) + ) + ) + ) + (if (< 1.0 f30-1) + (set! f30-1 1.0) + ) + (if (< f30-1 0.0) + (set! f30-1 0.0) + ) + (let ((f0-22 (-> self string-min-val y)) + (f1-7 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-22 f1-7 f30-1)) + ) + (set! + (-> self view-off z) + (lerp (-> self string-min-val z) (-> self string-max-val z) f30-1) + ) + ) + ) + ) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* target-height) (-> self view-off y)) + ) + (vector+! + (-> self desired-pos) + (-> self desired-pos) + (-> *camera* tpos-curr-adj) + ) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (let ((s4-0 (new 'stack-no-clear 'collide-mesh-cache-tri)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + ) + (vector--float*! + s5-0 + (-> *camera* tpos-curr-adj) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (vector-! gp-1 (-> self string-trans) s5-0) + (let + ((f0-31 + (dummy-10 + *collide-cache* + s5-0 + gp-1 + (-> *CAMERA-bank* collide-move-rad) + #x4a09 + (the-as process #f) + s4-0 + 4098 + ) + ) + ) + (when (and (< 0.0 f0-31) (< f0-31 1.0)) + (vector-float*! gp-1 gp-1 f0-31) + (vector-flatten! (-> self view-flat) gp-1 (-> *camera* local-down)) + (let ((f0-32 (vector-length (-> self view-flat)))) + (cond + ((< f0-32 8192.0) + (let ((gp-2 (new-stack-vector0))) + (cam-string-find-position-rel! gp-2) + (cam-string-set-position-rel! gp-2) + ) + ) + (else + (if (< f0-32 (-> self min-z-override)) + (set! (-> self min-z-override) f0-32) + ) + (let + ((f30-2 + (/ + (- f0-32 (-> self string-min-val z)) + (- (-> self string-max-val z) (-> self string-min-val z)) + ) + ) + ) + (if (< 1.0 f30-2) + (set! f30-2 1.0) + ) + (if (< f30-2 0.0) + (set! f30-2 0.0) + ) + (let ((f0-36 (-> self string-min-val y)) + (f1-16 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-36 f1-16 f30-2)) + ) + (set! + (-> self view-off z) + (lerp (-> self string-min-val z) (-> self string-max-val z) f30-2) + ) + ) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* target-height) (-> self view-off y)) + ) + (vector+! + (-> self desired-pos) + (-> self desired-pos) + (-> *camera* tpos-curr-adj) + ) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + ) + ) + ) + ) + ) + ) + (set! (-> self trans quad) (-> self string-trans quad)) + (set! (-> self los-last-pos quad) (-> self string-trans quad)) + (TODO-RENAME-10 (-> self position-spline) (-> self string-trans)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (set-string-parms) + (cam-string-code) + (TODO-RENAME-9 (-> self position-spline)) + (set! (-> self have-phony-joystick) #f) + ) + (suspend) + ) + (none) + ) + ) + +(deftype cam-stick-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + + +(define + *CAM_STICK-bank* + (new 'static 'cam-stick-bank + :max-z (meters 30.0) + :min-z (meters 5.0) + :max-y (meters 15.0) + :min-y (meters 2.0) + ) + ) + +(defbehavior cam-stick-code camera-slave () + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (let ((gp-0 (new-stack-vector0))) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector-! + gp-0 + (-> self view-flat) + (vector-float*! gp-0 (-> *camera* local-down) (-> self view-off y)) + ) + (vector+! (-> self desired-pos) (-> self tracking follow-pt) gp-0) + ) + (let ((v1-3 (new-stack-vector0)) + (gp-1 (new-stack-vector0)) + ) + (vector-! v1-3 (-> self desired-pos) (-> self trans)) + (vector-float*! v1-3 v1-3 0.2) + (vector-! gp-1 v1-3 (-> self velocity)) + (if (< 409.6 (vector-length gp-1)) + (vector-normalize! gp-1 (the-as float 409.6)) + ) + (vector+! (-> self velocity) (-> self velocity) gp-1) + ) + 0.0 + (let ((f30-1 1.0) + (gp-2 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + (s4-0 4) + (s2-0 0) + ) + (let ((s3-0 (new 'stack-no-clear 'collide-mesh-cache-tri))) + (while + (and + (< 0.01 f30-1) + (and + (< + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + (> s4-0 0) + ) + ) + (+! s4-0 -1) + (vector-float*! gp-2 (-> self velocity) f30-1) + (let ((f28-0 (if (logtest? (-> self options) 32) + (dummy-10 + *collide-cache* + (-> self trans) + gp-2 + (-> *CAMERA-bank* collide-move-rad) + #x4a09 + (the-as process #f) + s3-0 + 2 + ) + -100000000.0 + ) + ) + ) + (cond + ((>= f28-0 0.0) + (vector+float*! (-> self trans) (-> self trans) gp-2 f28-0) + (set! (-> s5-0 quad) (-> s3-0 bbox4w min quad)) + (vector-flatten! (-> self velocity) (-> self velocity) s5-0) + (set! f30-1 (- f30-1 (* f30-1 f28-0))) + (set! s2-0 1) + ) + (else + (vector+! (-> self trans) (-> self trans) gp-2) + (set! f30-1 0.0) + ) + ) + ) + ) + ) + (when (nonzero? s2-0) + 0 + (let ((gp-3 (new-stack-vector0))) + 0.0 + (vector-! gp-3 (-> self trans) (-> self tracking follow-pt)) + (vector-flatten! gp-3 gp-3 (-> *camera* local-down)) + (let + ((f0-14 + (/ + (- (vector-length gp-3) (-> *CAM_STICK-bank* min-z)) + (- (-> *CAM_STICK-bank* max-z) (-> *CAM_STICK-bank* min-z)) + ) + ) + ) + (cond + ((< f0-14 0.0) + (set! f0-14 0.0) + ) + ((< 1.0 f0-14) + (set! f0-14 1.0) + ) + ) + (cond + ((< (- f0-14 (-> self view-off-param)) -0.001) + (set! (-> self view-off-param) f0-14) + ) + ((< 0.001 (- f0-14 (-> self view-off-param))) + (vector-normalize-copy! (-> self view-flat) gp-3 (-> self view-off z)) + ) + ) + ) + ) + ) + ) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #t + ) + (none) + ) + +(defstate cam-stick (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (set! + (-> self view-off y) + (lerp + (-> *CAM_STICK-bank* min-y) + (-> *CAM_STICK-bank* max-y) + (-> self view-off-param) + ) + ) + (set! + (-> self view-off z) + (lerp + (-> *CAM_STICK-bank* min-z) + (-> *CAM_STICK-bank* max-z) + (-> self view-off-param) + ) + ) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (vector-flatten! + (-> self view-flat) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (-> self view-off y) + ) + (vector+! + (-> self desired-pos) + (-> self desired-pos) + (-> self tracking follow-pt) + ) + (set! (-> self trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (when (not (paused?)) + (when *camera-read-analog* + (let + ((f0-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (the-as float 0.05) + ) + ) + ) + (cond + ((< (* 0.05 (- 1.0 (-> self view-off-param))) f0-0) + (+! (-> self view-off-param) (* 0.05 (- 1.0 (-> self view-off-param)))) + ) + ((< f0-0 (* 0.05 (- (-> self view-off-param)))) + (+! (-> self view-off-param) (* 0.05 (- (-> self view-off-param)))) + ) + (else + (+! (-> self view-off-param) f0-0) + ) + ) + ) + ) + (set! + (-> self view-off y) + (lerp + (-> *CAM_STICK-bank* min-y) + (-> *CAM_STICK-bank* max-y) + (-> self view-off-param) + ) + ) + (set! + (-> self view-off z) + (lerp + (-> *CAM_STICK-bank* min-z) + (-> *CAM_STICK-bank* max-z) + (-> self view-off-param) + ) + ) + (when *camera-read-analog* + (let + ((f0-16 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 21845.334 (-> *display* seconds-per-frame)) + ) + ) + (gp-0 (new-stack-matrix0)) + (s3-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + (s4-0 (new-stack-vector0)) + ) + (cond + ((!= f0-16 0.0) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-16) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + ((logtest? (-> self options) 1) + (set-vector! s5-0 0.0 0.0 1.0 1.0) + (vector-normalize-copy! s5-0 (-> self view-flat) (the-as float 1.0)) + (set! (-> s3-0 quad) (-> *camera* tgt-rot-mat vector 2 quad)) + (vector-flatten! s3-0 s3-0 (-> *camera* local-down)) + (vector-negate! s3-0 s3-0) + (set! (-> s4-0 quad) (-> s5-0 quad)) + (vector-normalize-copy! s4-0 s3-0 (the-as float 1.0)) + (matrix-from-two-vectors-max-angle-partial! + gp-0 + s5-0 + s4-0 + (* 10922.667 (-> *display* seconds-per-frame)) + (the-as float 0.05) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + ) + ) + ) + ) + (none) + ) + :code + (behavior () + (while #t + (if (not (paused?)) + (cam-stick-code) + ) + (suspend) + ) + (none) + ) + ) + +(deftype cam-bike-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + + +(define + *CAM_BIKE-bank* + (new 'static 'cam-bike-bank + :max-z (meters 6.0) + :min-z (meters 10.0) + :max-y (meters 3.0) + :min-y (meters 5.0) + ) + ) + +(defbehavior + cam-calc-bike-follow! camera-slave + ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) + (vector-float*! + (-> arg0 follow-off) + (-> *camera* tgt-face-mat vector 2) + 155648.0 + ) + (vector+! + (-> arg0 follow-pt) + (-> *camera* tpos-curr-adj) + (-> arg0 follow-off) + ) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ 12288.0 (-> *camera* target-height)) + ) + (-> arg0 follow-pt) + ) + +(defbehavior cam-bike-code camera-slave () + (let ((s4-0 (new-stack-matrix0))) + (let ((gp-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + ) + (vector-normalize-copy! gp-0 (-> self view-flat) (the-as float 1.0)) + (vector-flatten! + s5-0 + (-> *camera* tgt-rot-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s5-0 (the-as float -1.0)) + (matrix-from-two-vectors-partial-linear! s4-0 gp-0 s5-0 (the-as float 0.2)) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + (let ((gp-1 (new-stack-vector0))) + 0.0 + (vector-! gp-1 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (let ((f30-0 (vector-length gp-1))) + (set! + (-> self view-off z) + (lerp-clamp + (-> *CAM_BIKE-bank* max-z) + (-> *CAM_BIKE-bank* min-z) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) + ) + ) + (set! + (-> self view-off y) + (lerp-clamp + (-> *CAM_BIKE-bank* max-y) + (-> *CAM_BIKE-bank* min-y) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) + ) + ) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector-! + gp-1 + (-> self view-flat) + (vector-float*! gp-1 (-> *camera* local-down) (-> self view-off y)) + ) + (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-1) + ) + (let ((v1-20 (new-stack-vector0)) + (gp-2 (new-stack-vector0)) + ) + (vector-! v1-20 (-> self desired-pos) (-> self trans)) + (vector-float*! v1-20 v1-20 0.2) + (vector-! gp-2 v1-20 (-> self velocity)) + (if (< 409.6 (vector-length gp-2)) + (vector-normalize! gp-2 (the-as float 409.6)) + ) + (vector+! (-> self velocity) (-> self velocity) gp-2) + ) + 0.0 + (let ((f30-2 1.0) + (gp-3 (new-stack-vector0)) + (s5-3 4) + (s4-3 (new 'stack-no-clear 'collide-mesh-cache-tri)) + ) + (while + (and + (< 0.01 f30-2) + (and + (< + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + (> s5-3 0) + ) + ) + (+! s5-3 -1) + (vector-float*! gp-3 (-> self velocity) f30-2) + (let ((f28-0 (if (logtest? (-> self options) 32) + (dummy-10 + *collide-cache* + (-> self trans) + gp-3 + (the-as float 4096.0) + #x4a09 + (the-as process #f) + s4-3 + 2 + ) + -100000000.0 + ) + ) + ) + (cond + ((>= f28-0 0.0) + (vector+float*! (-> self trans) (-> self trans) gp-3 f28-0) + (vector-flatten! + (-> self velocity) + (-> self velocity) + (the-as vector (-> s4-3 bbox4w)) + ) + (set! f30-2 (- f30-2 (* f30-2 f28-0))) + (let ((s3-2 (new-stack-vector0))) + (vector-! s3-2 (-> self trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! s3-2 s3-2 (-> *camera* local-down)) + (vector-normalize-copy! (-> self view-flat) s3-2 (-> self view-off z)) + ) + ) + (else + (vector+! (-> self trans) (-> self trans) gp-3) + (set! f30-2 0.0) + ) + ) + ) + ) + ) + (cam-calc-bike-follow! (-> self tracking) (-> self trans) #t) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #t + ) + (none) + ) + +(defstate cam-bike (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> *camera* foot-offset) 4096.0) + (set! (-> *camera* head-offset) 16384.0) + (set! (-> self view-off x) 0.0) + (set! (-> self view-off y) (-> *CAM_BIKE-bank* max-y)) + (set! (-> self view-off z) (-> *CAM_BIKE-bank* max-z)) + (vector-flatten! + (-> self view-flat) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (-> self view-off y) + ) + (vector+! + (-> self desired-pos) + (-> self desired-pos) + (-> *camera* tpos-curr-adj) + ) + (set! (-> self trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 1)) + (cam-calc-bike-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (if (not (paused?)) + (cam-bike-code) + ) + (suspend) + ) + (none) + ) + ) + +(define *camera-base-mode* (the-as state cam-string)) + + + + diff --git a/goal_src/engine/camera/camera-h.gc b/goal_src/engine/camera/camera-h.gc index 31c51922fa..a5f9badd47 100644 --- a/goal_src/engine/camera/camera-h.gc +++ b/goal_src/engine/camera/camera-h.gc @@ -5,6 +5,34 @@ ;; name in dgo: camera-h ;; dgos: GAME, ENGINE +;; TODO - for cam-layout +(define-extern v-slrp2! (function vector vector vector float vector float vector)) +(define-extern v-slrp3! (function vector vector vector vector float vector)) +(declare-type camera-slave process) +(declare-type camera-master process) +(declare-type tracking-point structure) +(declare-type cam-rotation-tracker structure) +(declare-type camera-combiner process) +;; TODO - for cam-master +(define-extern cam-eye (state camera-slave)) +;; TODO - for camera +(define-extern cam-circular (state camera-slave)) +(define-extern cam-standoff-read-entity (state camera-slave)) +(define-extern cam-spline (state camera-slave)) +(define-extern *camera-base-mode* state) +(define-extern cam-fixed-read-entity (state camera-slave)) +(define-extern camera-line-rel-len (function tracking-point vector float rgba none)) +(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 camera-combiner)) +(define-extern paused? (function symbol)) +;; TODO - for cam-start +(define-extern cam-master-init (function none :behavior camera-master)) + + +;; decomp begins + ;; definition of type camera-bank (deftype camera-bank (basic) ((collide-move-rad float :offset-assert 4) @@ -77,7 +105,7 @@ ;; definition of type tracking-spline (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) @@ -98,8 +126,8 @@ (:methods (TODO-RENAME-9 (_type_) none 9) (TODO-RENAME-10 (_type_ vector) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) + (print-nth-point (_type_ int) none 11) + (TODO-RENAME-12 (_type_) none 12) (TODO-RENAME-13 (_type_ int) none 13) (TODO-RENAME-14 (_type_ vector) none 14) (TODO-RENAME-15 (_type_) none 15) @@ -110,7 +138,7 @@ (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) + (TODO-RENAME-23 (_type_) none 23) ) ) @@ -377,7 +405,7 @@ (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) ; not totally confirmed yet + (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) @@ -390,15 +418,15 @@ (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) + (drawable-target handle :offset-assert 320) ; likely a `target`? (which-bone int32 :offset-assert 328) - (pov-handle uint64 :offset-assert 336) + (pov-handle handle :offset-assert 336) (pov-bone int32 :offset-assert 344) - (being-attacked basic :offset-assert 348) + (being-attacked symbol :offset-assert 348) (attack-start uint64 :offset-assert 352) - (on-ground basic :offset-assert 360) + (on-ground symbol :offset-assert 360) (under-water int32 :offset-assert 364) - (on-pole basic :offset-assert 368) + (on-pole symbol :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) @@ -431,20 +459,3 @@ :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 camera-combiner)) -(define-extern paused? (function symbol)) -;; TODO - for cam-start -(define-extern cam-master-init (function none :behavior camera-master)) -(define-extern v-slrp3! (function vector vector vector vector float vector)) diff --git a/goal_src/engine/camera/camera.gc b/goal_src/engine/camera/camera.gc index 6cd111524b..031b30ab72 100644 --- a/goal_src/engine/camera/camera.gc +++ b/goal_src/engine/camera/camera.gc @@ -200,7 +200,7 @@ ) ) -(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 quaternion)) +(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 matrix)) (let ((s4-0 (method-of-type res-lump get-property-struct)) (s3-0 arg0) ) @@ -223,11 +223,11 @@ (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) + (quaternion->matrix arg1 s4-1) ) ) (else - (quaternion->matrix (the-as matrix arg1) (-> arg0 quat)) + (quaternion->matrix arg1 (-> arg0 quat)) ) ) ) @@ -797,16 +797,16 @@ (< f0-4 1.0) ) (set! (-> arg2 partial-pt) f0-4) - (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) (let ((a2-5 (-> obj point (-> arg2 cur-pt) next))) (vector-lerp! - s5-0 + (the-as vector s5-0) (the-as vector (-> obj point (-> arg2 cur-pt))) (the-as vector (-> obj point a2-5)) f0-4 ) ) - (vector+! arg1 arg1 s5-0) + (vector+! arg1 arg1 (the-as vector s5-0)) ) (return arg1) ) @@ -1856,12 +1856,11 @@ ) ) ) -; ;; 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 + +;; TODO - fix me! +;; 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] ; (defun ; slave-set-rotation! ; ((arg0 cam-rotation-tracker) @@ -2007,13 +2006,11 @@ ; ) ; ) -; ;; 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) @@ -2128,13 +2125,11 @@ ; 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)) diff --git a/goal_src/engine/camera/pov-camera-h.gc b/goal_src/engine/camera/pov-camera-h.gc index 0492f80348..d0ee76beaa 100644 --- a/goal_src/engine/camera/pov-camera-h.gc +++ b/goal_src/engine/camera/pov-camera-h.gc @@ -6,11 +6,12 @@ ;; dgos: GAME, ENGINE (deftype pov-camera (process-drawable) - ((flags int32 :offset-assert 176) + ((cspace-array cspace-array :offset 112) + (flags int32 :offset-assert 176) (debounce-start-time uint64 :offset-assert 184) - (notify-handle uint64 :offset-assert 192) - (anim-name basic :offset-assert 200) - (command-list basic :offset-assert 204) + (notify-handle handle :offset-assert 192) + (anim-name string :offset-assert 200) + (command-list pair :offset-assert 204) ;; not a basic atleast! (mask-to-clear uint32 :offset-assert 208) (music-volume-movie float :offset-assert 212) (sfx-volume-movie float :offset-assert 216) @@ -20,15 +21,15 @@ :size-assert #xdc :flag-assert #x1e007000dc (:methods - (dummy-20 () none 20) - (dummy-21 () none 21) - (pov-camera-playing () none 22) ;; state - (dummy-23 () none 23) - (dummy-24 () none 24) - (dummy-25 () none 25) - (dummy-26 () none 26) + (pov-camera-abort () _type_ :state 20) + (pov-camera-done-playing () _type_ :state 21) + (pov-camera-playing () _type_ :state 22) ;; state + (pov-camera-start-playing () _type_ :state 23) ;; state + (pov-camera-startup () _type_ :state 24) ;; state + (TODO-RENAME-25 (_type_) symbol 25) + (target-grabbed? (_type_) symbol 26) (dummy-27 () none 27) - (dummy-28 () none 28) + (target-released? () symbol 28) (dummy-29 () none 29) ) - ) \ No newline at end of file + ) diff --git a/goal_src/engine/camera/pov-camera.gc b/goal_src/engine/camera/pov-camera.gc index 10f2283cb2..af0c13afc1 100644 --- a/goal_src/engine/camera/pov-camera.gc +++ b/goal_src/engine/camera/pov-camera.gc @@ -5,5 +5,416 @@ ;; name in dgo: pov-camera ;; dgos: GAME, ENGINE -;; TODO - for sunken-elevator -(define-extern pov-camera-init-by-other (function vector skeleton-group string int symbol pair none)) ;; TODO - not confirmed -- sunken-elevator +;; DECOMP BEGINS + +(defmethod TODO-RENAME-25 pov-camera ((obj pov-camera)) + (when + (or + (and + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> obj debounce-start-time)) + ) + 60 + ) + (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + ) + (logtest? (-> obj flags) 2) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (when (logtest? (-> obj flags) 1) + (send-event (handle->process (-> obj notify-handle)) 'notify 'abort-request) + #t + ) + ) + ) + +(defmethod target-grabbed? pov-camera ((obj pov-camera)) + (or (not *target*) (process-grab? *target*)) + ) + +(defmethod target-released? pov-camera () + (or (not *target*) (process-release? *target*)) + ) + +(defstate pov-camera-startup (pov-camera) + :virtual #t + :code + (behavior () + (go-virtual pov-camera-start-playing) + (none) + ) + ) + +(defstate pov-camera-start-playing (pov-camera) + :virtual #t + :code + (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (while (not (target-grabbed? self)) + (suspend) + ) + (let ((gp-0 0)) + (let ((v1-7 (dummy-10 (-> self draw jgeo) "camera" (the-as type #f)))) + (if v1-7 + (set! gp-0 (+ (-> v1-7 number) 1)) + ) + ) + (let* ((s5-0 (get-process *default-dead-pool* othercam #x4000)) + (v1-10 (when s5-0 + (let ((t9-3 (method-of-type othercam activate))) + (t9-3 + (the-as othercam s5-0) + self + 'othercam + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + s5-0 + othercam-init-by-other + self + gp-0 + #t + #t + ) + (-> s5-0 ppointer) + ) + ) + ) + (send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear)) + ) + ) + (go-virtual pov-camera-playing) + (none) + ) + ) + +(defbehavior + pov-camera-play-and-reposition pov-camera + ((arg0 joint-anim-compressed) (arg1 vector) (arg2 float)) + (let ((s4-0 #f)) + (let ((v1-2 (-> self skel root-channel 0))) + (set! (-> v1-2 frame-group) (the-as art-joint-anim arg0)) + (set! (-> v1-2 param 0) (the float (+ (-> arg0 data 9 unknown-half) -1))) + (set! (-> v1-2 param 1) arg2) + (set! (-> v1-2 frame-num) 0.0) + (joint-control-channel-group! + v1-2 + (the-as art-joint-anim arg0) + num-func-seek! + ) + ) + (until (ja-done? 0) + (let + ((v1-4 + (and + (not s4-0) + (< (the float (+ (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + data + 0 + length + ) + -4 + ) + ) + (ja-frame-num 0) + ) + ) + ) + ) + (when v1-4 + (set! s4-0 #t) + (send-event *camera* 'teleport-to-vector-start-string arg1) + ) + ) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) arg2) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + 0 + (none) + ) + +(defstate pov-camera-playing (pov-camera) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (when (= v1-0 'abort) + (when (logtest? (-> self flags) 1) + (logior! (-> self flags) 2) + (if (= (-> self anim-name type) string) + (go-virtual pov-camera-abort) + ) + ) + ) + ) + ) + ) + :enter + (behavior () + (set! + (-> self debounce-start-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (if (= (-> self anim-name type) string) + (backup-load-state-and-set-cmds *load-state* (-> self command-list)) + ) + (none) + ) + :exit + (behavior () + (if (= (-> self anim-name type) string) + (restore-load-state-and-cleanup *load-state*) + ) + (clear-pending-settings-from-process *setting-control* self 'music-volume) + (clear-pending-settings-from-process *setting-control* self 'sfx-volume) + (none) + ) + :code + (behavior () + (push-setting! + *setting-control* + self + 'music-volume + 'rel + (-> self music-volume-movie) + 0 + ) + (push-setting! + *setting-control* + self + 'sfx-volume + 'rel + (-> self sfx-volume-movie) + 0 + ) + (cond + ((= (-> self anim-name type) string) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 frame-group) (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + (set! + (-> a0-4 param 0) + (the float (+ (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-4 param 1) 1.0) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! + a0-4 + (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-25 self) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) 1.0) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (-> self anim-name type) spool-anim) + (ja-play-spooled-anim + (the-as spool-anim (-> self anim-name)) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (method-of-object self TODO-RENAME-25) + ) + ) + ) + (go-virtual pov-camera-done-playing) + (none) + ) + :post + (behavior () + (if (= (-> self anim-name type) string) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + ) + (ja-post) + (none) + ) + ) + +(defstate pov-camera-abort (pov-camera) + :virtual #t + :enter + (behavior () + (logior! (-> self flags) 2) + (none) + ) + :code + (behavior () + (set-blackout-frames 10) + (suspend) + (suspend) + (go-virtual pov-camera-done-playing) + (none) + ) + ) + +(defstate pov-camera-done-playing (pov-camera) + :virtual #t + :code + (behavior () + (while (begin + self + (not ((method-of-object self target-released?))) + ) + (suspend) + ) + (send-event (handle->process (-> self notify-handle)) 'notify 'die) + (suspend) + (suspend) + (dummy-18 self) + (deactivate self) + (none) + ) + ) + +(defmethod dummy-27 pov-camera () + 0 + (none) + ) + +(defmethod dummy-29 pov-camera () + (none) + ) + +(defbehavior + pov-camera-init-by-other pov-camera + ((arg0 vector) + (arg1 skeleton-group) + (arg2 string) + (arg3 int) + (arg4 process-drawable) + (arg5 pair) + ) + ((method-of-object self dummy-29)) + (set! (-> *game-info* pov-camera-handle) (process->handle self)) + (set! (-> self flags) arg3) + (set! (-> self command-list) arg5) + (set! (-> self music-volume-movie) 100.0) + (set! (-> self sfx-volume-movie) 100.0) + (if arg4 + (set! (-> self notify-handle) (process->handle arg4)) + (set! (-> self notify-handle) (the-as handle #f)) + ) + (set! + (-> self debounce-start-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (logclear! + (-> self mask) + (process-mask actor-pause movie enemy platform projectile) + ) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg0 quad)) + (when (logtest? (-> self flags) 4) + (let + ((v1-20 + (if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable)) + arg4 + ) + ) + ) + (quaternion-copy! (-> self root quat) (-> v1-20 root quat)) + ) + ) + (dummy-14 self arg1 '()) + (logior! (-> self draw status) 32) + (logior! (-> self skel status) 1) + (set! (-> self anim-name) arg2) + (cond + ((= (-> arg2 type) string) + (logior! (-> self skel status) 32) + (let ((s5-1 (dummy-10 (-> self draw art-group) arg2 art-joint-anim))) + (if (not s5-1) + (go process-drawable-art-error arg2) + ) + (ja-channel-set! 1) + (set! + (-> self skel root-channel 0 frame-group) + (the-as art-joint-anim s5-1) + ) + ) + ) + ((= (-> arg2 type) spool-anim) + ) + ) + (set! (-> self mask-to-clear) (the-as uint #x4a0800)) + (set! + (-> self event-hook) + (lambda :behavior pov-camera + ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'mask) + (let ((v0-0 (the-as number (-> arg3 param 0)))) + (set! (-> self mask-to-clear) (the-as uint v0-0)) + v0-0 + ) + ) + ((= v1-0 'music-movie-volume) + (let ((f0-0 (the-as float (-> arg3 param 0)))) + (set! (-> self music-volume-movie) f0-0) + f0-0 + ) + ) + ((= v1-0 'sfx-movie-volume) + (let ((f0-1 (the-as float (-> arg3 param 0)))) + (set! (-> self sfx-volume-movie) f0-1) + f0-1 + ) + ) + ) + ) + ) + ) + ) + ((method-of-object self dummy-27)) + (go-virtual pov-camera-startup) + (none) + ) + + + + diff --git a/goal_src/engine/collide/collide-func.gc b/goal_src/engine/collide/collide-func.gc index f1a9f6ccc7..d09210d4e0 100644 --- a/goal_src/engine/collide/collide-func.gc +++ b/goal_src/engine/collide/collide-func.gc @@ -5,6 +5,8 @@ ;; name in dgo: collide-func ;; dgos: GAME, ENGINE +(define-extern moving-sphere-triangle-intersect (function vector vector float collide-cache-tri vector vector float)) + ;; This file contains the primitive intersection functions used for collision. ;; Most take a description of primitive and a "probe" ;; The probe has an origin and a direction. The length of the direction vector is the length @@ -19,6 +21,8 @@ ;; If there's a miss, return COLLISION_MISS, a large negative number. ;; If we are inside of the primitive, return 0.0 +;; decomp begins + (defconstant COLLISION_MISS -100000000.0) diff --git a/goal_src/engine/data/art-h.gc b/goal_src/engine/data/art-h.gc index d1a95e5b12..824b3fc73a 100644 --- a/goal_src/engine/data/art-h.gc +++ b/goal_src/engine/data/art-h.gc @@ -73,6 +73,7 @@ (deftype joint-anim-compressed-hdr (structure) ((control-bits uint32 14 :offset-assert 0) + (unknown-half int16 :offset 6) (num-joints uint32 :offset-assert 56) (matrix-bits uint32 :offset-assert 60) ) diff --git a/goal_src/engine/debug/default-menu.gc b/goal_src/engine/debug/default-menu.gc index a561c4a82a..99e2ff3e31 100644 --- a/goal_src/engine/debug/default-menu.gc +++ b/goal_src/engine/debug/default-menu.gc @@ -12,23 +12,21 @@ (define-extern find-instance-by-name (function string instance)) (define-extern *edit-instance* string) (define-extern cam-free-floating (state camera-slave)) -(define-extern cam-standoff state) -(define-extern cam-pov state) -(define-extern cam-pov180 state) -(define-extern cam-pov-track state) -(define-extern cam-billy state) -(define-extern cam-endlessfall state) -(define-extern cam-lookat state) -(define-extern cam-stick state) -(define-extern cam-bike state) -(define-extern cam-fixed state) -(define-extern cam-decel state) -(define-extern cam-eye state) -(define-extern cam-point-watch state) -(define-extern cam-orbit state) +(define-extern cam-standoff (state camera-slave)) ;; unknown type +(define-extern cam-pov (state camera-slave)) ;; unknown type +(define-extern cam-pov180 (state camera-slave)) ;; unknown type +(define-extern cam-pov-track (state camera-slave)) ;; unknown type +(define-extern cam-billy (state camera-slave)) ;; unknown type +(define-extern cam-endlessfall (state camera-slave)) ;; unknown type +(define-extern cam-lookat (state camera-slave)) ;; unknown type +(define-extern cam-stick (state camera-slave)) ;; unknown type +(define-extern cam-bike (state camera-slave)) ;; unknown type +(define-extern cam-fixed (state camera-slave)) +(define-extern cam-decel (state camera-slave)) +(define-extern cam-eye (state camera-slave)) +(define-extern cam-point-watch (state camera-slave)) +(define-extern cam-orbit (state camera-slave)) (define-extern cam-robotboss (state camera-slave)) -(define-extern cam-layout-stop (function none)) -(define-extern cam-layout-start (function none)) (define-extern prototype-bucket-recalc-fields (function instance none)) (define-extern auto-save-command (function symbol int int process-tree none)) diff --git a/goal_src/engine/draw/process-drawable.gc b/goal_src/engine/draw/process-drawable.gc index c881dd30cb..c38368da06 100644 --- a/goal_src/engine/draw/process-drawable.gc +++ b/goal_src/engine/draw/process-drawable.gc @@ -30,7 +30,7 @@ (define-extern ja-num-frames (function int int)) ;; TODO - for flutflut (define-extern ja-group-size (function int)) -;; TODO - for yakow +;; TODO - for yakow | pov-camera (define-extern ja-frame-num (function int float)) ;; TODO - for anim-tester (define-extern draw-joint-spheres (function process-drawable symbol)) diff --git a/goal_src/engine/geometry/cylinder.gc b/goal_src/engine/geometry/cylinder.gc index 0396e7cbad..8f66e7a044 100644 --- a/goal_src/engine/geometry/cylinder.gc +++ b/goal_src/engine/geometry/cylinder.gc @@ -62,7 +62,7 @@ ) -(defmethod debug-draw cylinder ((obj cylinder) (arg0 vector)) +(defmethod debug-draw cylinder ((obj cylinder) (arg0 vector4w)) "Debug draw a cylinder. This is slow and ugly" (local-vars (sv-896 matrix) @@ -267,7 +267,7 @@ ) -(defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector)) +(defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector4w)) (local-vars (sv-448 vector) (sv-464 int)) (rlet ((vf0 :class vf) (vf4 :class vf) diff --git a/goal_src/engine/geometry/vol-h.gc b/goal_src/engine/geometry/vol-h.gc index ad88159ad4..f0440bc9a6 100644 --- a/goal_src/engine/geometry/vol-h.gc +++ b/goal_src/engine/geometry/vol-h.gc @@ -7,7 +7,7 @@ ;; definition of type plane-volume (deftype plane-volume (structure) - ((volume-type basic :offset-assert 0) + ((volume-type symbol :offset-assert 0) (point-count int16 :offset-assert 4) (normal-count int16 :offset-assert 6) (first-point vector :offset-assert 8) diff --git a/goal_src/engine/math/vector-h.gc b/goal_src/engine/math/vector-h.gc index 9255ec244b..5236bb0574 100644 --- a/goal_src/engine/math/vector-h.gc +++ b/goal_src/engine/math/vector-h.gc @@ -341,7 +341,7 @@ ) (deftype vector-array (inline-array-class) - ( + ((data vector :inline :dynamic :offset 16) ) :method-count-assert 9 :size-assert #x10 @@ -422,7 +422,7 @@ :size-assert #x28 :flag-assert #xb00000028 (:methods - (debug-draw (_type_ vector) none 9) + (debug-draw (_type_ vector4w) none 9) (ray-capsule-intersect (_type_ vector vector) float 10) ) ) @@ -438,7 +438,7 @@ :size-assert #x28 :flag-assert #xb00000028 (:methods - (debug-draw (_type_ vector) none 9) + (debug-draw (_type_ vector4w) none 9) (ray-flat-cyl-intersect (_type_ vector vector) float 10) ) ) diff --git a/goal_src/engine/target/target-h.gc b/goal_src/engine/target/target-h.gc index f81c9c5123..30825ebfef 100644 --- a/goal_src/engine/target/target-h.gc +++ b/goal_src/engine/target/target-h.gc @@ -5,6 +5,27 @@ ;; name in dgo: target-h ;; dgos: GAME, ENGINE +;; TODO - for cam-master +(define-extern target-cam-pos (function vector)) +(defun-extern stop symbol int) +(defun-extern start symbol continue-point target) +;; TODO - for mood +(define-extern target-joint-pos (function vector)) ;; TODO - unconfirmed +;; TODO - for target-util +(define-extern target-falling (state symbol none)) +(define-extern target-slide-down (state none)) +;; TODO - for logic-target - defined in shadow +(define-extern do-target-shadow (function none :behavior target)) +;; TODO - for logic-target - defined in powerups +(define-extern target-powerup-process (function none)) +;; TODO - for logic-target - defined in target-handler +(define-extern target-exit (function none)) +(define-extern target-generic-event-handler (function process int symbol event-message-block object)) +;; TODO - for logic-target - defined in sidekick +(define-extern init-sidekick (function none)) ;; TODO - not finished +;; TODO - for logic-target - defined in target-death +(define-extern target-continue (state continue-point none)) + (declare-type sidekick basic) (declare-type collide-cache basic) (declare-type snowball-info basic) @@ -84,8 +105,3 @@ ) (define-perm *sidekick* sidekick #f) - - -(defun-extern stop symbol int) -(defun-extern start symbol continue-point target) - diff --git a/goal_src/engine/target/target-util.gc b/goal_src/engine/target/target-util.gc index 5b39a5d337..d3a26a7686 100644 --- a/goal_src/engine/target/target-util.gc +++ b/goal_src/engine/target/target-util.gc @@ -1471,63 +1471,65 @@ ) ;; definition for function target-cam-pos +;; INFO: Return type mismatch object vs vector. ;; Used lq/sq (defun target-cam-pos () (let ((gp-0 *target*)) - (cond - ((not gp-0) - (camera-pos) - ) - ((logtest? (-> gp-0 state-flags) 1024) - (add-debug-sphere - *display-camera-marks* - (bucket-id debug-draw1) - (-> gp-0 alt-cam-pos) - 819.2 - (new 'static 'rgba :r #xff :a #x80) - ) - (-> gp-0 alt-cam-pos) - ) - ((logtest? #x20000 (-> gp-0 state-flags)) - (add-debug-sphere - *display-camera-marks* - (bucket-id debug-draw1) - (-> gp-0 alt-cam-pos) - 819.2 - (new 'static 'rgba :r #xff :a #x80) - ) - (-> gp-0 alt-cam-pos) - ) - ((logtest? #x80000 (-> gp-0 state-flags)) - (let ((s5-0 (the-as object (new 'static 'vector)))) - (set! - (-> (the-as vector s5-0) quad) - (-> (&-> (-> gp-0 control) unknown-qword00) 0) - ) - (set! - (-> (the-as vector s5-0) y) - (fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y)) - ) - (add-debug-sphere - *display-camera-marks* - (bucket-id debug-draw1) - (the-as vector s5-0) - 819.2 - (new 'static 'rgba :r #xff :a #x80) - ) - s5-0 - ) - ) - (else - (add-debug-sphere - *display-camera-marks* - (bucket-id debug-draw1) - (the-as vector (&-> (-> gp-0 control) unknown-qword00)) - 819.2 - (new 'static 'rgba :r #xff :a #x80) - ) - (&-> (-> gp-0 control) unknown-qword00) - ) + (the-as vector (cond + ((not gp-0) + (camera-pos) + ) + ((logtest? (-> gp-0 state-flags) 1024) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-draw1) + (-> gp-0 alt-cam-pos) + 819.2 + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 alt-cam-pos) + ) + ((logtest? #x20000 (-> gp-0 state-flags)) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-draw1) + (-> gp-0 alt-cam-pos) + 819.2 + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 alt-cam-pos) + ) + ((logtest? #x80000 (-> gp-0 state-flags)) + (let ((s5-0 (the-as object (new 'static 'vector)))) + (set! + (-> (the-as vector s5-0) quad) + (-> (&-> (-> gp-0 control) unknown-qword00) 0) + ) + (set! + (-> (the-as vector s5-0) y) + (fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y)) + ) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-draw1) + (the-as vector s5-0) + 819.2 + (new 'static 'rgba :r #xff :a #x80) + ) + s5-0 + ) + ) + (else + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-draw1) + (the-as vector (&-> (-> gp-0 control) unknown-qword00)) + 819.2 + (new 'static 'rgba :r #xff :a #x80) + ) + (&-> (-> gp-0 control) unknown-qword00) + ) + ) ) ) ) @@ -1559,4 +1561,4 @@ *unity-quaternion* ) ) - ) \ No newline at end of file + ) diff --git a/goal_src/levels/finalboss/robotboss-weapon.gc b/goal_src/levels/finalboss/robotboss-weapon.gc index 165843dea5..944b68bfc5 100644 --- a/goal_src/levels/finalboss/robotboss-weapon.gc +++ b/goal_src/levels/finalboss/robotboss-weapon.gc @@ -107,17 +107,17 @@ (while (< sv-272 7) (vector+! s4-0 (-> s1-0 sv-272) (-> obj origin)) (vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> obj origin)) - (camera-line s4-0 s3-0 arg0) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) (set! sv-272 (+ sv-272 1)) ) (vector+! s4-0 (-> s1-0 0) (-> obj origin)) - (camera-line s4-0 s3-0 arg0) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) (set! sv-288 0) (while (< sv-288 8) (vector+! s4-0 (-> s1-0 sv-288) (-> obj origin)) (vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0) (vector+! s3-0 (-> s1-0 sv-288) (-> obj origin)) - (camera-line s4-0 s3-0 arg0) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) (set! sv-288 (+ sv-288 1)) ) ) @@ -217,13 +217,7 @@ (camera-line gp-0 s5-0 - (the-as - vector - (new 'static 'vector4w - :data - (new 'static 'array int32 4 #xff #xff 0 #x80) - ) - ) + (new 'static 'vector4w :data (new 'static 'array int32 4 #xff #xff 0 #x80)) ) (set! (-> s5-0 quad) (-> gp-0 quad)) ) diff --git a/scripts/cast-repl.py b/scripts/cast-repl.py new file mode 100644 index 0000000000..f4b5d033e5 --- /dev/null +++ b/scripts/cast-repl.py @@ -0,0 +1,188 @@ +from prompt_toolkit import PromptSession +from prompt_toolkit.history import FileHistory +from jsmin import jsmin +import shlex +import json +import collections + +stack_cast_file_path = "./decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc" +type_cast_file_path = "./decompiler/config/jak1_ntsc_black_label/type_casts.jsonc" +lambda_cast_file_path = "./decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc" + +global_file_name = "" +global_func_name = "" + +def ordered_dict_insert(ordered_dict, index, key, value): + if key in ordered_dict: + raise KeyError("Key already exists") + if index < 0 or index > len(ordered_dict): + raise IndexError("Index out of range") + + keys = list(ordered_dict.keys())[index:] + ordered_dict[key] = value + for k in keys: + ordered_dict.move_to_end(k) + +# TODO - optional size +def stack_cast(function_name, type_name, offset): + with open(stack_cast_file_path, "r+") as config_file: + minified = jsmin(config_file.read()) + json_data = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(minified) + # Check if the function name has already been added + if function_name not in json_data: + ordered_dict_insert(json_data, len(json_data)-1, function_name, []) + # Check if there already exists a cast with the same offset, if so replace it + casts = json_data[function_name] + for cast in casts: + if cast[0] == offset: + print("Found cast with the same offset, replacing!") + cast[1] = type_name + config_file.seek(0) + json.dump(json_data, config_file, indent=2) + config_file.truncate() + return + json_data[function_name].append([offset, type_name]) + config_file.seek(0) + json.dump(json_data, config_file, indent=2) + config_file.truncate() + print("Stack Cast Applied!") + +def type_cast(function_name, register, type_cast, cast_range): + with open(type_cast_file_path, "r+") as config_file: + minified = jsmin(config_file.read()) + json_data = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(minified) + # Check if the function name has already been added + if function_name not in json_data: + ordered_dict_insert(json_data, len(json_data)-1, function_name, []) + + range_start = -1 + range_end = -1 + if "-" in cast_range: + range_start = int(cast_range.split("-")[0]) + range_end = int(cast_range.split("-")[1]) + else: + range_start = int(cast_range) + + # Check if there already exists a cast with the same offset, if so replace it + casts = json_data[function_name] + new_casts = [] + for cast in casts: + cast_range_start = -1 + cast_range_end = -1 + if isinstance(cast[0], list): + cast_range_start = cast[0][0] + cast_range_end = cast[0][1] + else: + cast_range_start = cast[0] + cast_register = cast[1] + + if range_end == -1 and cast_range_end == -1 and range_start == cast_range_start and register == cast_register: + print("Found cast with the same range, replacing!") + continue + elif range_end == -1: + if range_start >= cast_range_start and range_start <= cast_range_end and register == cast_register: + print("Found cast with the same range, replacing!") + continue + elif cast_range_end == -1: + if cast_range_start >= range_start and cast_range_start <= range_end and register == cast_register: + print("Found cast with the same range, replacing!") + continue + new_casts.append(cast) + + json_data[function_name] = new_casts + if range_end == -1: + json_data[function_name].append([range_start, register, type_cast]) + else: + json_data[function_name].append([[range_start, range_end], register, type_cast]) + config_file.seek(0) + json.dump(json_data, config_file, indent=2) + config_file.truncate() + print("Type Cast Applied!") + +def lambda_cast(file_name, func_sig, func_id): + with open(lambda_cast_file_path, "r+") as config_file: + minified = jsmin(config_file.read()) + json_data = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(minified) + # Check if the function name has already been added + if file_name not in json_data: + ordered_dict_insert(json_data, len(json_data)-1, file_name, []) + # Check if there already exists a cast with the same offset, if so replace it + functions = json_data[file_name] + for func in functions: + if func[0] == func_id: + print("Found lambda with the same id, replacing!") + func[1] = func_sig + config_file.seek(0) + json.dump(json_data, config_file, indent=2) + config_file.truncate() + return + json_data[file_name].append([func_id, func_sig]) + config_file.seek(0) + json.dump(json_data, config_file, indent=2) + config_file.truncate() + print("Lambda Cast Applied!") + +def main(): + global global_file_name + global global_func_name + + from pathlib import Path + home = str(Path.home()) + session = PromptSession(history=FileHistory('{}/.castReplHistory'.format(home))) + + # LOOP + while True: + # READ + try: + prompt_string = "castREPL> " + if global_file_name and global_func_name: + prompt_string = "castREPL-{}-{}> ".format(global_file_name, global_func_name) + elif global_file_name: + prompt_string = "castREPL-{}> ".format(global_file_name) + elif global_func_name: + prompt_string = "castREPL-{}> ".format(global_func_name) + text = session.prompt(prompt_string) + except KeyboardInterrupt: + continue + except EOFError: + break + + # TODO - help command + # TODO - command to list current casts + # TODO - command to delete casts + # TODO - command to lookup function signature in all-types + # TODO - command to tie into the C++ program I'll right to narrow down an unknown type + # TODO - command to define function signature in all-types + + # EVAL / CAST / PRINT + tokens = shlex.split(text) + if len(tokens) < 1: + continue + # PROCESS COMMANDS + command = tokens[0] + # Allows you to persist a file name -- cutting down on command args (useful if working on a big file) + if command == "enter-file" and len(tokens) == 2: + global_file_name = tokens[1] + elif command == "exit-file": + global_file_name = "" + # Allows you to persist a function name -- cutting down on command args (useful if working on a big function) + elif command == "enter-func" and len(tokens) == 2: + global_func_name = tokens[1] + elif command == "exit-func": + global_func_name = "" + elif command == "stack" and len(tokens) == 4: + # Stack casts are in the following format stack + stack_cast(tokens[1], tokens[2], int(tokens[3])) + elif command == "lambda" and len(tokens) == 4: + # Stack casts are in the following format lambda + lambda_cast(tokens[1], tokens[2], int(tokens[3])) + elif command == "type" and len(tokens) == 5: + # Stack casts are in the following format type + type_cast(tokens[1], tokens[2], tokens[3], tokens[4]) + else: + print("Invalid Cast Command!") + # Exit + print('GoodBye!') + +if __name__ == '__main__': + main() diff --git a/scripts/requirements.txt b/scripts/requirements.txt new file mode 100644 index 0000000000..8ed67be302 --- /dev/null +++ b/scripts/requirements.txt @@ -0,0 +1,3 @@ +watchdog[watchmedo] +prompt_toolkit +jsmin diff --git a/test/decompiler/reference/engine/camera/cam-layout_REF.gc b/test/decompiler/reference/engine/camera/cam-layout_REF.gc new file mode 100644 index 0000000000..d8cc6d2920 --- /dev/null +++ b/test/decompiler/reference/engine/camera/cam-layout_REF.gc @@ -0,0 +1,5385 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(when *debug-segment* +;; definition for symbol *camera-layout-blink*, type symbol +(define *camera-layout-blink* #f) + +;; definition of type cam-layout-bank +(deftype cam-layout-bank (basic) + ((spline-t float :offset-assert 4) + (spline-step float :offset-assert 8) + (intro-t float :offset-assert 12) + (intro-step float :offset-assert 16) + (debug-t float :offset-assert 20) + (debug-step float :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + +;; definition for method 3 of type cam-layout-bank +(defmethod inspect cam-layout-bank ((obj cam-layout-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tspline-t: ~f~%" (-> obj spline-t)) + (format #t "~Tspline-step: ~f~%" (-> obj spline-step)) + (format #t "~Tintro-t: ~f~%" (-> obj intro-t)) + (format #t "~Tintro-step: ~f~%" (-> obj intro-step)) + (format #t "~Tdebug-t: ~f~%" (-> obj debug-t)) + (format #t "~Tdebug-step: ~f~%" (-> obj debug-step)) + obj + ) + +;; definition for symbol *CAM_LAYOUT-bank*, type cam-layout-bank +(define + *CAM_LAYOUT-bank* + (new 'static 'cam-layout-bank + :spline-t 0.01 + :spline-step 0.0016666667 + :intro-t 0.01 + :intro-step 0.0016666667 + :debug-t 0.01 + :debug-step 0.0033333334 + ) + ) + +;; definition for symbol *camera-layout-message-ypos*, type int +(define *camera-layout-message-ypos* 30) + +;; definition of type clm-basic +(deftype clm-basic (basic) + () + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +;; definition for method 3 of type clm-basic +(defmethod inspect clm-basic ((obj clm-basic)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + obj + ) + +;; definition of type clm-item-action +(deftype clm-item-action (structure) + ((button uint64 :offset-assert 0) + (options uint64 :offset-assert 8) + (func symbol :offset-assert 16) + (parm0 int32 :offset 20) + (parm0-basic basic :offset 20) + (parm1-basic basic :offset 24) + (parm1 symbol :offset 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + +;; definition for method 3 of type clm-item-action +(defmethod inspect clm-item-action ((obj clm-item-action)) + (format #t "[~8x] ~A~%" obj 'clm-item-action) + (format #t "~Tbutton: ~D~%" (-> obj button)) + (format #t "~Toptions: ~D~%" (-> obj options)) + (format #t "~Tfunc: ~A~%" (-> obj func)) + (format #t "~Tparm0: ~A~%" (-> obj parm0)) + (format #t "~Tparm1: ~A~%" (-> obj parm1-basic)) + obj + ) + +;; definition of type clm-item +(deftype clm-item (clm-basic) + ((description string :offset-assert 4) + (button-symbol symbol :offset-assert 8) + (action clm-item-action :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x2c + :flag-assert #x90000002c + ) + +;; definition for method 3 of type clm-item +(defmethod inspect clm-item ((obj clm-item)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdescription: ~A~%" (-> obj description)) + (format #t "~Tbutton-symbol: ~A~%" (-> obj button-symbol)) + (format #t "~Taction: #~%" (-> obj action)) + obj + ) + +;; definition of type clm-list-item +(deftype clm-list-item (basic) + ((description string :offset-assert 4) + (track-val symbol :offset-assert 8) + (val-func symbol :offset-assert 12) + (val-parm0 int32 :offset 16) + (val-parm0-basic basic :offset 16) + (val-parm1-basic basic :offset 20) + (val-parm1 symbol :offset 20) + (actions (array clm-item-action) :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + +;; definition for method 3 of type clm-list-item +(defmethod inspect clm-list-item ((obj clm-list-item)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tdescription: ~A~%" (-> obj description)) + (format #t "~Ttrack-val: ~A~%" (-> obj track-val)) + (format #t "~Tval-func: ~A~%" (-> obj val-func)) + (format #t "~Tval-parm0: ~A~%" (-> obj val-parm0)) + (format #t "~Tval-parm1: ~A~%" (-> obj val-parm1-basic)) + (format #t "~Tactions: ~A~%" (-> obj actions)) + obj + ) + +;; definition of type clm-list +(deftype clm-list (clm-basic) + ((tracker symbol :offset-assert 4) + (cur-list-item int32 :offset-assert 8) + (items (array clm-list-item) :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type clm-list +(defmethod inspect clm-list ((obj clm-list)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Ttracker: ~A~%" (-> obj tracker)) + (format #t "~Tcur-list-item: ~D~%" (-> obj cur-list-item)) + (format #t "~Titems: ~A~%" (-> obj items)) + obj + ) + +;; definition of type clm +(deftype clm (basic) + ((title string :offset-assert 4) + (items (array clm-basic) :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type clm +(defmethod inspect clm ((obj clm)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Ttitle: ~A~%" (-> obj title)) + (format #t "~Titems: ~A~%" (-> obj items)) + obj + ) + +;; definition for symbol *volume-point-current*, type int +(define *volume-point-current* 0) + +;; definition for symbol *volume-point*, type vector-array +(define *volume-point* (new 'debug 'vector-array 1000)) + +;; definition for symbol *volume-normal-current*, type int +(define *volume-normal-current* 0) + +;; definition for symbol *volume-normal*, type vector-array +(define *volume-normal* (new 'debug 'vector-array 600)) + +;; definition of type volume-descriptor-array +(deftype volume-descriptor-array (inline-array-class) + ((data plane-volume :inline :dynamic :offset 16) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type volume-descriptor-array +(defmethod inspect volume-descriptor-array ((obj volume-descriptor-array)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tdata[0] @ #x~X~%" (-> obj data)) + obj + ) + +;; failed to figure out what this is: +(set! (-> volume-descriptor-array heap-base) (the-as uint 24)) + +;; definition for symbol *volume-descriptor-current*, type int +(define *volume-descriptor-current* 0) + +;; definition for symbol *volume-descriptor*, type vol-control +(define + *volume-descriptor* + (the-as vol-control (new 'debug 'volume-descriptor-array 100)) + ) + +;; definition of type cam-layout +(deftype cam-layout (process) + ((cam-entity entity-camera :offset-assert 112) + (num-entities int32 :offset-assert 116) + (cur-entity int32 :offset-assert 120) + (num-volumes int32 :offset-assert 124) + (cur-volume int32 :offset-assert 128) + (first-pvol int32 :offset-assert 132) + (first-cutoutvol int32 :offset-assert 136) + (res-key float :offset-assert 140) + ) + :heap-base #x200 + :method-count-assert 14 + :size-assert #x90 + :flag-assert #xe02000090 + ) + +;; definition for method 3 of type cam-layout +(defmethod inspect cam-layout ((obj cam-layout)) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~T~Tcam-entity: ~A~%" (-> obj cam-entity)) + (format #t "~T~Tnum-entities: ~D~%" (-> obj num-entities)) + (format #t "~T~Tcur-entity: ~D~%" (-> obj cur-entity)) + (format #t "~T~Tnum-volumes: ~D~%" (-> obj num-volumes)) + (format #t "~T~Tcur-volume: ~D~%" (-> obj cur-volume)) + (format #t "~T~Tfirst-pvol: ~D~%" (-> obj first-pvol)) + (format #t "~T~Tfirst-cutoutvol: ~D~%" (-> obj first-cutoutvol)) + (format #t "~T~Tres-key: ~f~%" (-> obj res-key)) + obj + ) + +;; definition for function cam-layout-print +(defun cam-layout-print ((arg0 int) (arg1 int) (arg2 string)) + (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame debug-buf)) + (gp-0 (-> s5-0 base)) + ) + (draw-string-xy + arg2 + s5-0 + arg0 + arg1 + (font-color white) + (font-flags shadow kerning) + ) + (let ((a3-4 (-> s5-0 base))) + (let ((v1-4 (the-as object (-> s5-0 base)))) + (set! + (-> (the-as dma-packet v1-4) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-4) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-4) vif1) (new 'static 'vif-tag)) + (set! (-> s5-0 base) (&+ (the-as pointer v1-4) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + gp-0 + (the-as (pointer dma-tag) a3-4) + ) + ) + ) + ) + +;; definition for function cam-layout-intersect-dist +;; INFO: Return type mismatch number vs float. +(defun cam-layout-intersect-dist ((arg0 vector) (arg1 vector) (arg2 vector)) + (let ((f0-1 (vector-dot arg1 arg0)) + (f1-1 (vector-dot arg2 arg0)) + ) + (the-as float (if (< 0.00001 (fabs f1-1)) + (/ (- (-> arg0 w) f0-1) f1-1) + 409600000.0 + ) + ) + ) + ) + +;; definition for function cam-layout-entity-volume-info-create +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; WARN: Stack slot offset 164 signed mismatch +;; Used lq/sq +(defbehavior + cam-layout-entity-volume-info-create cam-layout + ((arg0 entity-camera) (arg1 symbol)) + (local-vars + (sv-16 res-tag) + (sv-160 vector) + (sv-164 float) + (sv-168 int) + (sv-176 vector) + (sv-192 vector) + (sv-208 vector) + (sv-224 vector) + (sv-240 vector) + (sv-256 int) + (sv-272 int) + (sv-288 int) + ) + (let ((s4-0 0)) + (while #t + (set! sv-16 (new 'static 'res-tag)) + (let + ((s3-0 + (the-as + (inline-array vector) + ((method-of-type res-lump get-property-data) + arg0 + arg1 + 'exact + (the float s4-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (cond + (s3-0 + (when (>= *volume-descriptor-current* 100) + (format 0 "ERROR : camera editing out of volume descriptors~%") + (return #f) + ) + (let + ((s2-0 (-> *volume-descriptor* pos-vol *volume-descriptor-current*))) + (set! (-> s2-0 volume-type) arg1) + (set! (-> s2-0 point-count) 0) + (set! + (-> s2-0 first-point) + (-> *volume-point* data *volume-point-current*) + ) + (set! (-> s2-0 normal-count) 0) + (set! + (-> s2-0 first-normal) + (-> *volume-normal* data *volume-normal-current*) + ) + (set! *volume-descriptor-current* (+ *volume-descriptor-current* 1)) + (+! (-> self num-volumes) 1) + (dotimes (s1-0 (the-as int (-> sv-16 elt-count))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (set! (-> sv-192 quad) (the-as uint128 0)) + (set! sv-208 (new 'stack-no-clear 'vector)) + (set! (-> sv-208 quad) (the-as uint128 0)) + (set! sv-224 (new 'stack-no-clear 'vector)) + (set! (-> sv-224 quad) (the-as uint128 0)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (set! (-> sv-240 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s0-0 (new-stack-vector0))) + (set! sv-256 0) + (set! sv-272 0) + (while (< sv-272 (the-as int (-> sv-16 elt-count))) + (when (!= s1-0 sv-272) + (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) + (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) + (vector-normalize! sv-208 (-> (new 'static 'array float 1 1.0) 0)) + (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) + (vector-normalize! sv-224 (-> (new 'static 'array float 1 1.0) 0)) + (let + ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) + (when (!= f0-6 409600000.0) + (vector+float*! sv-240 sv-192 sv-224 f0-6) + (set! sv-160 (new-stack-vector0)) + (set! sv-164 0.0) + (set! sv-168 0) + (set! sv-176 (new-stack-vector0)) + (set! (-> sv-160 quad) (-> sv-240 quad)) + (set! sv-288 0) + (while (< sv-288 (the-as int (-> sv-16 elt-count))) + (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) + (let + ((f30-0 + (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208) + ) + ) + (cond + ((= f30-0 409600000.0) + ) + ((zero? sv-168) + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-164 8192000.0) + (set! sv-168 1) + ) + ((begin + (vector-float*! sv-240 sv-208 f30-0) + (>= (vector-dot sv-240 sv-176) 0.0) + ) + ) + ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) + (when (< (fabs f30-0) (fabs sv-164)) + (set! sv-164 f30-0) + (set! sv-168 (+ sv-168 1)) + ) + ) + (else + (vector+float*! sv-160 sv-160 sv-208 f30-0) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-168 (+ sv-168 1)) + (if (< (fabs f30-0) (fabs sv-164)) + (set! sv-164 (- sv-164 f30-0)) + (set! sv-164 0.0) + ) + ) + ) + ) + ) + (set! sv-288 (+ sv-288 1)) + ) + (cond + ((zero? sv-168) + ) + ((= sv-164 0.0) + ) + (else + (dotimes (v1-87 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-87 s1-0) (!= v1-87 sv-272)) + (if + (< + (-> (new 'static 'array float 1 4096.0) 0) + (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w)) + ) + (goto cfg-47) + ) + ) + ) + (vector+float*! sv-240 sv-160 sv-208 sv-164) + (cond + ((>= *volume-point-current* 999) + (format + 0 + "ERROR : camera editing out of volume points~%" + ) + ) + (else + (set! + (-> *volume-point* data *volume-point-current* quad) + (-> sv-160 quad) + ) + (set! + (-> *volume-point* data (+ *volume-point-current* 1) quad) + (-> sv-240 quad) + ) + (set! *volume-point-current* (+ *volume-point-current* 2)) + (+! (-> s2-0 point-count) 2) + ) + ) + (vector+! s0-0 s0-0 sv-160) + (vector+! s0-0 s0-0 sv-240) + (set! sv-256 (+ sv-256 2)) + sv-256 + ) + ) + ) + ) + ) + (label cfg-47) + (set! sv-272 (+ sv-272 1)) + ) + (when (nonzero? sv-256) + (vector-float*! + s0-0 + s0-0 + (/ (-> (new 'static 'array float 1 1.0) 0) (the float sv-256)) + ) + (cond + ((>= *volume-normal-current* 599) + (format 0 "ERROR : camera editing out of volume normals~%") + ) + (else + (set! + (-> *volume-normal* data *volume-normal-current* quad) + (-> s0-0 quad) + ) + (set! + (-> *volume-normal* data (+ *volume-normal-current* 1) quad) + (-> s3-0 s1-0 quad) + ) + (set! *volume-normal-current* (+ *volume-normal-current* 2)) + (let ((v1-132 (+ (-> s2-0 normal-count) 2))) + (set! (-> s2-0 normal-count) v1-132) + v1-132 + ) + ) + ) + ) + ) + ) + ) + ) + (else + (return #f) + ) + ) + ) + (+! s4-0 1) + ) + ) + (the-as symbol #f) + ) + +;; definition for function cam-layout-entity-volume-info +(defbehavior cam-layout-entity-volume-info cam-layout () + (dotimes (gp-0 (-> self num-volumes)) + (cond + ((and + (= gp-0 (-> self cur-volume)) + (= *camera-layout-blink* 'volume) + (zero? (logand (-> *display* real-actual-frame-counter) 8)) + ) + ) + (else + (let ((s5-0 (-> *volume-descriptor* pos-vol gp-0))) + (let + ((a0-7 + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 0 #x80)) + ) + ) + (cond + ((= (-> s5-0 volume-type) 'vol) + (set! (-> a0-7 x) 0) + (set! (-> a0-7 y) 192) + (set! (-> a0-7 z) 0) + 0 + ) + ((= (-> s5-0 volume-type) 'pvol) + (set! (-> a0-7 x) 128) + (set! (-> a0-7 y) 128) + (set! (-> a0-7 z) 128) + ) + ((= (-> s5-0 volume-type) 'cutoutvol) + (set! (-> a0-7 x) 192) + (set! (-> a0-7 y) 0) + (set! (-> a0-7 z) 0) + 0 + ) + ) + (camera-line-setup (the-as vector a0-7)) + ) + (let ((s4-0 (the-as object (-> s5-0 first-point)))) + (dotimes (s3-0 (/ (-> s5-0 point-count) 2)) + (camera-line-draw (the-as vector s4-0) (&+ (the-as vector s4-0) 16)) + (set! + s4-0 + (&-> (the-as (inline-array plane-volume) s4-0) 1 first-point) + ) + ) + ) + ) + ) + ) + ) + #f + ) + +;; definition for function v-slrp! +;; Used lq/sq +(defun v-slrp! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((s2-0 (new-stack-vector0)) + (s1-0 (new-stack-vector0)) + (s0-0 (new-stack-vector0)) + ) + 0.0 + 0.0 + 0.0 + 0.0 + (cond + ((< (-> (new 'static 'array float 1 1.0) 0) arg3) + (set! + arg3 + (-> (the-as (pointer float) (new 'static 'array float 1 1.0)) 0) + ) + ) + ((< arg3 0.0) + (set! + arg3 + (-> (the-as (pointer float) (new 'static 'array float 1 0.0)) 0) + ) + ) + ) + (vector-normalize-copy! s2-0 arg1 (-> (new 'static 'array float 1 1.0) 0)) + (vector-normalize-copy! s1-0 arg2 (-> (new 'static 'array float 1 1.0) 0)) + (vector-cross! s0-0 s2-0 s1-0) + (let* ((f30-0 (vector-length s0-0)) + (f28-0 (asin f30-0)) + ) + (vector-float*! + arg0 + arg1 + (/ (sin (* (- (-> (new 'static 'array float 1 1.0) 0) arg3) f28-0)) f30-0) + ) + (vector+float*! arg0 arg0 arg2 (/ (sin (* arg3 f28-0)) f30-0)) + ) + ) + ) + +;; definition of type interp-test-info +(deftype interp-test-info (structure) + ((from vector :inline :offset-assert 0) + (to vector :inline :offset-assert 16) + (origin vector :inline :offset-assert 32) + (color vector4w :offset-assert 48) + (axis vector :offset-assert 52) + (disp string :offset-assert 56) + ) + :method-count-assert 9 + :size-assert #x3c + :flag-assert #x90000003c + ) + +;; definition for method 3 of type interp-test-info +(defmethod inspect interp-test-info ((obj interp-test-info)) + (format #t "[~8x] ~A~%" obj 'interp-test-info) + (format #t "~Tfrom: #~%" (-> obj from)) + (format #t "~Tto: #~%" (-> obj to)) + (format #t "~Torigin: #~%" (-> obj origin)) + (format #t "~Tcolor: #~%" (-> obj color)) + (format #t "~Taxis: #~%" (-> obj axis)) + (format #t "~Tdisp: ~A~%" (-> obj disp)) + obj + ) + +;; definition for function interp-test +;; Used lq/sq +(defun + interp-test + ((arg0 (function vector vector vector float vector float none)) + (arg1 interp-test-info) + ) + (let ((s3-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (arg0 + s3-0 + (-> arg1 from) + (-> arg1 to) + (-> (new 'static 'array float 1 0.0) 0) + (-> arg1 axis) + (-> (new 'static 'array float 1 65536.0) 0) + ) + (vector+! s3-0 s3-0 (-> arg1 origin)) + (dotimes (s2-0 10) + (set! (-> gp-0 quad) (-> s3-0 quad)) + (arg0 + s3-0 + (-> arg1 from) + (-> arg1 to) + (* 0.1 (+ (-> (new 'static 'array float 1 1.0) 0) (the float s2-0))) + (-> arg1 axis) + (-> (new 'static 'array float 1 65536.0) 0) + ) + (vector+! s3-0 s3-0 (-> arg1 origin)) + (camera-line s3-0 gp-0 (-> arg1 color)) + ) + (arg0 + gp-0 + (-> arg1 from) + (-> arg1 to) + (-> *CAM_LAYOUT-bank* debug-t) + (-> arg1 axis) + (-> (new 'static 'array float 1 65536.0) 0) + ) + (format *stdcon* "~S ~f~%" (-> arg1 disp) (vector-length gp-0)) + (vector+! gp-0 gp-0 (-> arg1 origin)) + (camera-line (-> arg1 origin) gp-0 (-> arg1 color)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + gp-0 + (the-as vector (-> arg1 color)) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + +;; definition for function interp-test-deg +;; Used lq/sq +(defun + interp-test-deg + ((arg0 (function vector vector vector vector float none)) + (arg1 interp-test-info) + ) + (let ((s3-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (arg0 + s3-0 + (-> arg1 from) + (-> arg1 to) + (-> arg1 axis) + (-> (new 'static 'array float 1 0.0) 0) + ) + (vector+! s3-0 s3-0 (-> arg1 origin)) + (dotimes (s2-0 10) + (set! (-> gp-0 quad) (-> s3-0 quad)) + (arg0 + s3-0 + (-> arg1 from) + (-> arg1 to) + (-> arg1 axis) + (* + 182.04445 + (* 18.0 (+ (-> (new 'static 'array float 1 1.0) 0) (the float s2-0))) + ) + ) + (vector+! s3-0 s3-0 (-> arg1 origin)) + (camera-line s3-0 gp-0 (-> arg1 color)) + ) + (arg0 + gp-0 + (-> arg1 from) + (-> arg1 to) + (-> arg1 axis) + (* 182.04445 (* 180.0 (-> *CAM_LAYOUT-bank* debug-t))) + ) + (format *stdcon* "~S ~f~%" (-> arg1 disp) (vector-length gp-0)) + (vector+! gp-0 gp-0 (-> arg1 origin)) + (camera-line (-> arg1 origin) gp-0 (-> arg1 color)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + gp-0 + (the-as vector (-> arg1 color)) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + +;; definition for function cam-layout-entity-info +;; Used lq/sq +(defun cam-layout-entity-info ((arg0 entity-actor)) + (if (not arg0) + (return #f) + ) + (let ((s5-0 (new-stack-matrix0)) + (s4-0 (new-stack-vector0)) + ) + (when + (and + (cam-slave-get-vector-with-offset arg0 s4-0 'trans) + (or + (!= *camera-layout-blink* 'camera) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (cam-slave-get-rot arg0 s5-0) + (camera-fov-frame + s5-0 + s4-0 + (* 0.5 (cam-slave-get-fov arg0)) + (-> (new 'static 'array float 1 0.75) 0) + (-> (new 'static 'array float 1 1.0) 0) + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + ) + ) + ) + (let ((s5-1 (new-stack-vector0))) + (if + (and + (cam-slave-get-vector-with-offset arg0 s5-1 'pivot) + (or + (!= *camera-layout-blink* 'pivot) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-1 + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 #x80 0 0 #x80)) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s5-2 (new-stack-vector0))) + (if + (and + (cam-slave-get-vector-with-offset arg0 s5-2 'align) + (or + (!= *camera-layout-blink* 'align) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-2 + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #x80 0 #x80)) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s5-3 (new-stack-vector0))) + (if + (and + (cam-slave-get-vector-with-offset arg0 s5-3 'interesting) + (or + (!= *camera-layout-blink* 'interesting) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-3 + (the-as + vector + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #x80 0 #x80 #x80) + ) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s3-1 (new 'stack 'curve)) + (s2-0 (new-stack-vector0)) + (s5-4 (new-stack-vector0)) + (s4-1 (new-stack-vector0)) + ) + (when + (and + (get-curve-data! + arg0 + s3-1 + 'campath + 'campath-k + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + (or + (!= *camera-layout-blink* 'spline) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (cond + ((cam-slave-get-vector-with-offset arg0 s4-1 'pivot) + (curve-get-pos! s5-4 (-> (new 'static 'array float 1 0.0) 0) s3-1) + (vector-! s4-1 s4-1 s5-4) + ) + (else + (set! + (-> s4-1 quad) + (-> + (the-as + vector + ((method-of-type res-lump get-property-struct) + arg0 + 'spline-offset + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + s4-1 + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + quad + ) + ) + ) + ) + (curve-get-pos! s5-4 (-> (new 'static 'array float 1 0.0) 0) s3-1) + (vector+! s5-4 s5-4 s4-1) + (dotimes (s1-1 8) + (set! (-> s2-0 quad) (-> s5-4 quad)) + (curve-get-pos! + s5-4 + (* (-> (new 'static 'array float 1 0.125) 0) (the float (+ s1-1 1))) + s3-1 + ) + (vector+! s5-4 s5-4 s4-1) + (camera-line + s2-0 + s5-4 + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #xff #xff 0 #x80) + ) + ) + ) + (curve-get-pos! s5-4 (-> *CAM_LAYOUT-bank* spline-t) s3-1) + (vector+! s5-4 s5-4 s4-1) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-4 + (the-as + vector + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #xff #xff 0 #x80) + ) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s3-2 (new 'stack 'curve)) + (s2-1 (new-stack-vector0)) + (s5-5 (new-stack-vector0)) + (s4-2 (new-stack-vector0)) + (s1-2 (new 'stack 'curve)) + ) + (when + (and + (get-curve-data! + arg0 + s3-2 + 'intro + 'intro-k + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + (or + (!= *camera-layout-blink* 'intro) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (cond + ((cam-slave-get-vector-with-offset arg0 s4-2 'pivot) + (curve-get-pos! s5-5 (-> (new 'static 'array float 1 1.0) 0) s3-2) + (vector-! s4-2 s4-2 s5-5) + ) + ((get-curve-data! + arg0 + s1-2 + 'campath + 'campath-k + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + (curve-get-pos! s4-2 (-> (new 'static 'array float 1 0.0) 0) s1-2) + (curve-get-pos! s5-5 (-> (new 'static 'array float 1 1.0) 0) s3-2) + (vector-! s4-2 s4-2 s5-5) + ) + ((cam-slave-get-vector-with-offset arg0 s4-2 'trans) + (curve-get-pos! s5-5 (-> (new 'static 'array float 1 1.0) 0) s3-2) + (vector-! s4-2 s4-2 s5-5) + ) + ) + (curve-get-pos! s5-5 (-> (new 'static 'array float 1 0.0) 0) s3-2) + (vector+! s5-5 s5-5 s4-2) + (dotimes (s1-3 8) + (set! (-> s2-1 quad) (-> s5-5 quad)) + (curve-get-pos! + s5-5 + (* (-> (new 'static 'array float 1 0.125) 0) (the float (+ s1-3 1))) + s3-2 + ) + (vector+! s5-5 s5-5 s4-2) + (camera-line + s2-1 + s5-5 + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + ) + (curve-get-pos! s5-5 (-> *CAM_LAYOUT-bank* intro-t) s3-2) + (vector+! s5-5 s5-5 s4-2) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-5 + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + (curve-get-pos! + s5-5 + (cam-slave-get-float + arg0 + 'intro-exitValue + (-> (new 'static 'array float 1 0.0) 0) + ) + s3-2 + ) + (vector+! s5-5 s5-5 s4-2) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-5 + (the-as + vector + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let + ((s2-3 + (res-lump-data + arg0 + 'campoints + pointer + :time + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (v1-95 + (res-lump-struct + arg0 + 'campoints-offset + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s4-3 (new 'stack-no-clear 'vector)) + (s3-3 (new 'stack-no-clear 'vector)) + (s5-6 (new 'static 'vector)) + ) + (when + (and + s2-3 + (or + (!= *camera-layout-blink* 'index) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (cond + (v1-95 + (vector+! s4-3 (the-as vector (&+ s2-3 0)) (the-as vector v1-95)) + (vector+! s3-3 (the-as vector (&+ s2-3 16)) (the-as vector v1-95)) + ) + (else + (set! (-> s4-3 quad) (-> (the-as (pointer uint128) (&+ s2-3 0)))) + (set! (-> s3-3 quad) (-> (the-as (pointer uint128) (&+ s2-3 16)))) + ) + ) + (camera-line + s4-3 + s3-3 + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #x80 0 #x80)) + ) + (vector-lerp-clamp! s5-6 s4-3 s3-3 (-> *CAM_LAYOUT-bank* spline-t)) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-6 + (the-as + vector + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #xff #xff 0 #x80) + ) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let + ((s4-4 + (res-lump-data + arg0 + 'focalpull + pointer + :time + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (s5-7 (new 'static 'vector)) + ) + (when + (and + s4-4 + (or + (!= *camera-layout-blink* 'focalpull) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + ) + (camera-line + (the-as vector (&+ s4-4 0)) + (the-as vector (&+ s4-4 16)) + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #xff #xff #x80)) + ) + (vector-lerp-clamp! + s5-7 + (the-as vector (&+ s4-4 0)) + (the-as vector (&+ s4-4 16)) + (-> *CAM_LAYOUT-bank* spline-t) + ) + (camera-cross + (new 'static 'vector :y 1024.0) + (new 'static 'vector :z 1024.0) + s5-7 + (the-as + vector + (new 'static 'vector4w + :data + (new 'static 'array int32 4 0 #xff #xff #x80) + ) + ) + (-> (new 'static 'array float 1 4096.0) 0) + ) + ) + ) + (let ((s5-8 (new 'stack 'interp-test-info)) + (s4-5 (new-stack-vector0)) + ) + (when + (and + (cam-slave-get-vector-with-offset arg0 (-> s5-8 origin) 'pivot) + (cam-slave-get-vector-with-offset arg0 (-> s5-8 to) 'align) + (cam-slave-get-vector-with-offset arg0 (-> s5-8 from) 'trans) + ) + (camera-line + (-> s5-8 from) + (-> s5-8 origin) + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #x80 #x80 #x80 #x80) + ) + ) + (camera-line + (-> s5-8 to) + (-> s5-8 origin) + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #x80 #x80 #x80 #x80) + ) + ) + (vector-! (-> s5-8 from) (-> s5-8 from) (-> s5-8 origin)) + (vector-! (-> s5-8 to) (-> s5-8 to) (-> s5-8 origin)) + (vector-cross! s4-5 (-> s5-8 from) (-> s5-8 to)) + (vector-normalize! s4-5 (-> (new 'static 'array float 1 8192.0) 0)) + (vector+! s4-5 s4-5 (-> s5-8 origin)) + (camera-line + (-> s5-8 origin) + s4-5 + (new 'static 'vector4w + :data + (new 'static 'array int32 4 #x80 #x80 #x80 #x80) + ) + ) + (when (not (paused?)) + (+! (-> *CAM_LAYOUT-bank* debug-t) (-> *CAM_LAYOUT-bank* debug-step)) + (if + (< (-> (new 'static 'array float 1 1.0) 0) (-> *CAM_LAYOUT-bank* debug-t)) + (set! (-> *CAM_LAYOUT-bank* debug-t) 0.0) + ) + ) + (set! (-> s5-8 axis) #f) + (set! (-> s5-8 disp) "li") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 #xff 0 0 #x80)) + ) + (interp-test + (the-as + (function vector vector vector float vector float none) + vector-lerp! + ) + s5-8 + ) + (set! (-> s5-8 disp) "si") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #xff 0 #x80)) + ) + (interp-test + (the-as (function vector vector vector float vector float none) v-slrp!) + s5-8 + ) + (set! (-> s5-8 disp) "si2") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 0 0 #xff #x80)) + ) + (interp-test + (the-as (function vector vector vector float vector float none) v-slrp2!) + s5-8 + ) + (set! (-> s5-8 disp) "si3") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 #xff 0 #xff #x80)) + ) + (interp-test-deg + (the-as (function vector vector vector vector float none) v-slrp3!) + s5-8 + ) + (set! (-> s5-8 axis) (-> *camera* local-down)) + (set! (-> s5-8 disp) "si2d") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 0 #xff #xff #x80)) + ) + (interp-test + (the-as (function vector vector vector float vector float none) v-slrp2!) + s5-8 + ) + (set! (-> s5-8 disp) "si3d") + (set! + (-> s5-8 color) + (new 'static 'vector4w :data (new 'static 'array int32 4 #xff #xff 0 #x80)) + ) + (interp-test-deg + (the-as (function vector vector vector vector float none) v-slrp3!) + s5-8 + ) + ) + ) + ) + +;; definition for function clmf-button-test +(defun clmf-button-test () + (cam-layout-print 16 *camera-layout-message-ypos* "button test") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (set! *camera-read-analog* #f) + #f + ) + +;; definition for function clmf-bna +(defun clmf-bna () + (cam-layout-print 16 *camera-layout-message-ypos* "button not applicable") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (set! *camera-read-analog* #f) + #t + ) + +;; definition for function clmf-implement +(defun clmf-implement () + (cam-layout-print + 16 + *camera-layout-message-ypos* + "button not implemented yet" + ) + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (set! *camera-read-analog* #f) + #t + ) + +;; definition for function clmf-input +;; Used lq/sq +(defun clmf-input ((arg0 vector) (arg1 vector) (arg2 int)) + (vector-reset! arg0) + (vector-reset! arg1) + (cond + ((logtest? (-> *cpad-list* cpads arg2 button0-abs 0) (pad-buttons l3)) + (set! + (-> arg0 z) + (- + (-> arg0 z) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 rightx)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + ) + (else + (set! + (-> arg0 y) + (- + (-> arg0 y) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 rightx)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (+! + (-> arg0 x) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 righty)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (set! + (-> arg1 x) + (- + (-> arg1 x) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 leftx)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg2 button0-abs 0) (pad-buttons r1)) + (set! + (-> arg1 y) + (+ + 0.5 + (analog-input + (the-as int (-> *cpad-list* cpads arg2 abutton 9)) + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 32.0) 0) + (-> (new 'static 'array float 1 230.0) 0) + (the-as float 0.5) + ) + (-> arg1 y) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg2 button0-abs 0) (pad-buttons l1)) + (set! + (-> arg1 y) + (- + (-> arg1 y) + (+ + 0.5 + (analog-input + (the-as int (-> *cpad-list* cpads arg2 abutton 8)) + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 32.0) 0) + (-> (new 'static 'array float 1 230.0) 0) + (the-as float 0.5) + ) + ) + ) + ) + ) + ) + (set! + (-> arg1 z) + (- + (-> arg1 z) + (analog-input + (the-as int (-> *cpad-list* cpads arg2 lefty)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + ) + ) + (let ((s5-1 (new-stack-matrix0))) + (let ((a2-8 (new-stack-vector0))) + (set! (-> a2-8 y) -1.0) + (forward-down-nopitch->inv-matrix + s5-1 + (-> *math-camera* inv-camera-rot vector 2) + a2-8 + ) + ) + (vector-matrix*! arg1 arg1 s5-1) + ) + arg1 + ) + +;; definition for function clmf-pos-rot +;; Used lq/sq +(defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) + (local-vars (s2-0 structure) (s3-1 structure) (sv-192 matrix)) + (cam-layout-print + 16 + *camera-layout-message-ypos* + "x/z pos: left stick, down: l1, up: r1" + ) + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (when (and arg1 (nonzero? arg1)) + (cam-layout-print 16 *camera-layout-message-ypos* "x/y rot: right stick") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (cam-layout-print + 16 + *camera-layout-message-ypos* + "z rot: press left stick & move right" + ) + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + ) + (let ((s5-0 (new-stack-vector0)) + (s4-0 (new-stack-vector0)) + ) + (set! s3-1 (cond + ((or (zero? arg0) (not arg0)) + #f + ) + (else + (if + (not + (res-lump-struct + (-> self cam-entity) + arg0 + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (add-data! + (-> self cam-entity) + (new 'static 'res-tag + :name arg0 + :key-frame -1000000000.0 + :elt-count #x1 + :inlined? #x1 + :elt-type vector + ) + (the-as pointer (new 'static 'vector)) + ) + ) + (set! + s3-1 + (res-lump-struct + (-> self cam-entity) + arg0 + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (when + (and + (not s3-1) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + (clear *temp-string*) + (format *temp-string* "ERROR : can't add ~A" 'vector) + (cam-layout-print 120 100 *temp-string*) + ) + s3-1 + ) + ) + ) + (set! s2-0 (cond + ((or (zero? arg1) (not arg1)) + #f + ) + (else + (if + (not + (res-lump-struct + (-> self cam-entity) + arg1 + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (add-data! + (-> self cam-entity) + (new 'static 'res-tag + :name arg1 + :key-frame -1000000000.0 + :elt-count #x1 + :inlined? #x1 + :elt-type quaternion + ) + (the-as + pointer + (quaternion-identity! (new 'static 'quaternion)) + ) + ) + ) + (set! + s2-0 + (res-lump-struct + (-> self cam-entity) + arg1 + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (when + (and + (not s2-0) + (logtest? (-> *display* real-actual-frame-counter) 8) + ) + (clear *temp-string*) + (format *temp-string* "ERROR : can't add ~A" 'quaternion) + (cam-layout-print 120 100 *temp-string*) + ) + s2-0 + ) + ) + ) + (let ((s1-1 (new 'stack-no-clear 'matrix))) + (set! sv-192 (new 'stack-no-clear 'matrix)) + (let ((s0-1 (new 'stack-no-clear 'vector))) + (if (not s3-1) + (return #f) + ) + (clmf-input s5-0 s4-0 0) + (vector+float*! + (the-as vector s3-1) + (the-as vector s3-1) + s4-0 + (-> (new 'static 'array float 1 409.6) 0) + ) + (cond + ((not arg1) + (the-as quaternion #f) + ) + ((zero? arg1) + (the-as quaternion #f) + ) + (else + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) + (vector-float*! s5-0 s5-0 100.0) + (matrix-rotate-x! s1-1 (- (-> s5-0 x))) + (matrix*! sv-192 s1-1 sv-192) + (matrix-rotate-y! s1-1 (-> s5-0 y)) + (matrix*! sv-192 sv-192 s1-1) + (matrix-rotate-z! s1-1 (- (-> s5-0 z))) + (matrix*! sv-192 s1-1 sv-192) + (matrix->quaternion (the-as quaternion s0-1) sv-192) + (quaternion-inverse! + (the-as quaternion s2-0) + (the-as quaternion (-> self cam-entity connect)) + ) + (quaternion*! + (the-as quaternion s2-0) + (the-as quaternion s0-1) + (the-as quaternion s2-0) + ) + (quaternion-normalize! (the-as quaternion s2-0)) + ) + ) + ) + ) + ) + (set! *camera-read-analog* #f) + #t + ) + +;; definition for function clmf-next-volume +(defbehavior clmf-next-volume cam-layout ((arg0 int)) + (if (zero? (-> self num-volumes)) + (return #f) + ) + (set! + (-> self cur-volume) + (mod (+ arg0 (-> self cur-volume)) (-> self num-volumes)) + ) + (while (< (-> self cur-volume) 0) + (+! (-> self cur-volume) (-> self num-volumes)) + ) + #t + ) + +;; definition for function clmf-next-vol-dpad +(defun clmf-next-vol-dpad () + (local-vars (a0-1 int)) + (cam-layout-print 16 *camera-layout-message-ypos* "dpad selects volume") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (cond + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down)) + (set! a0-1 1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right)) + (set! a0-1 1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up)) + (set! a0-1 -1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left)) + (set! a0-1 -1) + ) + (else + (set! a0-1 0) + ) + ) + (clmf-next-volume a0-1) + (set! *camera-read-analog* #f) + #t + ) + +;; definition for function clmf-to-edit-cam +(defun clmf-to-edit-cam () + (clmf-next-volume 0) + (set! *clm* *clm-edit*) + #t + ) + +;; definition for symbol *last-cur-entity*, type int +(define *last-cur-entity* -1) + +;; definition for function clmf-next-entity +(defbehavior clmf-next-entity cam-layout ((arg0 int)) + (let ((v1-0 (/ arg0 8))) + (when (zero? (-> self num-entities)) + (set! (-> self cam-entity) #f) + (return #f) + ) + (if (= (- v1-0) (-> self num-entities)) + (set! v1-0 -1) + ) + (if (= v1-0 (-> self num-entities)) + (set! v1-0 1) + ) + (set! + (-> self cur-entity) + (mod (+ v1-0 (-> self cur-entity)) (-> self num-entities)) + ) + ) + (while (< (-> self cur-entity) 0) + (+! (-> self cur-entity) (-> self num-entities)) + ) + (set! *last-cur-entity* (-> self cur-entity)) + (let ((v1-8 (-> self cur-entity)) + (a0-13 (-> *camera-engine* alive-list next0)) + ) + *camera-engine* + (let ((a1-3 (-> a0-13 next0))) + (while (!= a0-13 (-> *camera-engine* alive-list-end)) + (let ((a0-14 (-> (the-as connection a0-13) param1))) + (cond + ((zero? v1-8) + (set! (-> self cam-entity) (the-as entity-camera a0-14)) + (set! *volume-descriptor-current* 0) + (set! *volume-point-current* 0) + (set! *volume-normal-current* 0) + (set! (-> self num-volumes) 0) + (cam-layout-entity-volume-info-create (-> self cam-entity) 'vol) + (set! (-> self first-pvol) (-> self num-volumes)) + (cam-layout-entity-volume-info-create (-> self cam-entity) 'pvol) + (set! (-> self first-cutoutvol) (-> self num-volumes)) + (cam-layout-entity-volume-info-create (-> self cam-entity) 'cutoutvol) + (set! + (-> *CAM_LAYOUT-bank* intro-step) + (cam-slave-get-intro-step (-> self cam-entity)) + ) + (return #f) + ) + (else + (+! v1-8 -1) + ) + ) + ) + (set! a0-13 a1-3) + *camera-engine* + (set! a1-3 (-> a1-3 next0)) + ) + ) + ) + #t + ) + +;; definition for function clmf-to-vol-attr +(defbehavior clmf-to-vol-attr cam-layout () + (set! (-> self res-key) (the float (-> self cur-volume))) + (set! *clm* *clm-vol-attr*) + #t + ) + +;; definition for function clmf-to-spline-attr +(defun clmf-to-spline-attr () + (set! *clm* *clm-spline-attr*) + #t + ) + +;; definition for function clmf-to-intro-attr +(defun clmf-to-intro-attr () + (set! *clm* *clm-intro-attr*) + #t + ) + +;; definition for function clmf-to-index-attr +(defun clmf-to-index-attr () + (set! *clm* *clm-index-attr*) + #t + ) + +;; definition for function clmf-to-focalpull-attr +(defun clmf-to-focalpull-attr () + (set! *clm* *clm-focalpull-attr*) + #t + ) + +;; definition for function clmf-to-edit +(defbehavior clmf-to-edit cam-layout () + (set! (-> self res-key) (-> (new 'static 'array float 1 -1000000000.0) 0)) + (set! *clm* *clm-edit*) + #t + ) + +;; definition for function clmf-to-select +(defun clmf-to-select () + (set! *camera-layout-blink* #f) + (set! *clm* *clm-select*) + #t + ) + +;; definition for function clmf-look-through +;; Used lq/sq +(defbehavior clmf-look-through cam-layout () + (set! (-> *camera-other-fov* data) (cam-slave-get-fov (-> self cam-entity))) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + *camera-other-trans* + 'trans + ) + (set! (-> *camera-other-root* quad) (-> *camera-other-trans* quad)) + (cam-slave-get-rot + (the-as entity-actor (-> self cam-entity)) + *camera-other-matrix* + ) + (set! *camera-look-through-other* 10) + (set! *camera-read-analog* #f) + #f + ) + +;; definition for function fov->maya +(defun fov->maya ((arg0 float)) + (if (= arg0 0.0) + (-> (new 'static 'array float 1 0.0) 0) + (/ 12.700255 (tan (* 0.5 arg0))) + ) + ) + +;; definition for function cam-layout-save-cam-rot +;; INFO: Return type mismatch object vs string. +(defun cam-layout-save-cam-rot ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let ((s3-0 (-> arg2 quat)) + (s5-0 + (res-lump-struct + arg2 + 'rot-offset + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (if arg0 + (format + #t + "setup rot ~f ~f ~f ~f~%" + (-> s3-0 x) + (-> s3-0 y) + (-> s3-0 z) + (-> s3-0 w) + ) + ) + (the-as string (when s5-0 + (if arg0 + (format + #t + "rot offset ~f ~f ~f ~f~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + (-> s5-0 w) + ) + ) + (format + arg1 + " tag rot-offset ~f ~f ~f ~f // vector (quaternion)~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + (-> s5-0 w) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-cam-trans +;; INFO: Return type mismatch object vs string. +;; Used lq/sq +(defun + cam-layout-save-cam-trans + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let ((s1-0 (-> arg2 trans)) + (s5-0 (method-of-type res-lump get-property-struct)) + (s2-0 arg2) + ) + (format (clear *res-key-string*) "~S~S" 'trans '-offset) + (let + ((s5-1 + (s5-0 + s2-0 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (let + ((s2-1 + (res-lump-struct + arg2 + 'translation_info + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s3-1 (new-stack-vector0)) + ) + (if arg0 + (format + #t + "setup trans ~M ~M ~M (maya)~%" + (-> s1-0 x) + (-> s1-0 y) + (-> s1-0 z) + ) + ) + (set! (-> s3-1 quad) (-> s1-0 quad)) + (when s5-1 + (if arg0 + (format + #t + "offset ~M ~M ~M (added)~%" + (-> (the-as vector s5-1) x) + (-> (the-as vector s5-1) y) + (-> (the-as vector s5-1) z) + ) + ) + (vector+! s3-1 s3-1 (the-as vector s5-1)) + ) + (when (the-as vector s2-1) + (if arg0 + (format + #t + "level-trans ~M ~M ~M (subtracted)~%" + (-> (the-as vector s2-1) x) + (-> (the-as vector s2-1) y) + (-> (the-as vector s2-1) z) + ) + ) + (vector-! s3-1 s3-1 (the-as vector s2-1)) + ) + (set! s2-1 (or (the-as vector s5-1) s2-1)) + (set! arg0 (and (the-as vector s2-1) arg0)) + (if (the-as structure arg0) + (format + #t + "final trans ~M ~M ~M (maya)~%" + (-> s3-1 x) + (-> s3-1 y) + (-> s3-1 z) + ) + ) + ) + (the-as string (if (the-as vector s5-1) + (format + arg1 + " tag trans-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> (the-as vector s5-1) x) + (-> (the-as vector s5-1) y) + (-> (the-as vector s5-1) z) + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-pivot +;; INFO: Return type mismatch object vs string. +;; Used lq/sq +(defun cam-layout-save-pivot ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s2-0 + (res-lump-struct + arg2 + 'pivot + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s3-0 (method-of-type res-lump get-property-struct)) + ) + (format (clear *res-key-string*) "~S~S" 'pivot '-offset) + (let + ((s5-1 + (the-as + vector + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (s3-1 (new-stack-vector0)) + ) + (the-as string (when s2-0 + (if s5-1 + (vector+! s3-1 s2-0 s5-1) + (set! (-> s3-1 quad) (-> s2-0 quad)) + ) + (if arg0 + (format + #t + "setup pivot ~M ~M ~M~%" + (-> s2-0 x) + (-> s2-0 y) + (-> s2-0 z) + ) + ) + (when s5-1 + (when arg0 + (format + #t + "offset ~M ~M ~M~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + (format + #t + "final pivot ~M ~M ~M~%" + (-> s3-1 x) + (-> s3-1 y) + (-> s3-1 z) + ) + ) + (format + arg1 + " tag pivot-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-align +;; INFO: Return type mismatch object vs string. +;; Used lq/sq +(defun cam-layout-save-align ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s2-0 + (res-lump-struct + arg2 + 'align + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s3-0 (method-of-type res-lump get-property-struct)) + ) + (format (clear *res-key-string*) "~S~S" 'align '-offset) + (let + ((s5-1 + (the-as + vector + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (s3-1 (new-stack-vector0)) + ) + (the-as string (when s2-0 + (if s5-1 + (vector+! s3-1 s2-0 s5-1) + (set! (-> s3-1 quad) (-> s2-0 quad)) + ) + (if arg0 + (format + #t + "setup align ~M ~M ~M~%" + (-> s2-0 x) + (-> s2-0 y) + (-> s2-0 z) + ) + ) + (when s5-1 + (when arg0 + (format + #t + "offset ~M ~M ~M~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + (format + #t + "final align ~M ~M ~M~%" + (-> s3-1 x) + (-> s3-1 y) + (-> s3-1 z) + ) + ) + (format + arg1 + " tag align-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-interesting +;; INFO: Return type mismatch object vs string. +;; Used lq/sq +(defun + cam-layout-save-interesting + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s2-0 + (res-lump-struct + arg2 + 'interesting + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s3-0 (method-of-type res-lump get-property-struct)) + ) + (format (clear *res-key-string*) "~S~S" 'interesting '-offset) + (let + ((s5-1 + (the-as + vector + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + #f + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (s3-1 (new-stack-vector0)) + ) + (the-as string (when s2-0 + (if s5-1 + (vector+! s3-1 s2-0 s5-1) + (set! (-> s3-1 quad) (-> s2-0 quad)) + ) + (if arg0 + (format + #t + "setup interesting ~M ~M ~M~%" + (-> s2-0 x) + (-> s2-0 y) + (-> s2-0 z) + ) + ) + (when s5-1 + (when arg0 + (format + #t + "offset ~M ~M ~M~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + (format + #t + "final interesting ~M ~M ~M~%" + (-> s3-1 x) + (-> s3-1 y) + (-> s3-1 z) + ) + ) + (format + arg1 + " tag interesting-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-1 x) + (-> s5-1 y) + (-> s5-1 z) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-fov +;; INFO: Return type mismatch object vs string. +(defun cam-layout-save-fov ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'fov + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'fov '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + ((= f30-0 0.0) + (if arg0 + (format #t "setup fov deg 0.0 (defaults to 64.0)~%") + ) + (set! f30-0 11650.845) + ) + (arg0 + (format #t "setup fov deg ~R (~f in maya)~%" f30-0 (fov->maya f30-0)) + ) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format + #t + "final ~R (~f in maya) ~%" + (+ f30-0 f28-0) + (fov->maya (+ f30-0 f28-0)) + ) + ) + (format + arg1 + " tag fov-offset DEG(~R) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-focalpull +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-focalpull + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'focalPull + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'focalPull '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup focalPull deg ~R (~f in maya)~%" f30-0 (fov->maya f30-0)) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format + #t + "final ~R (~f in maya) ~%" + (+ f30-0 f28-0) + (fov->maya (+ f30-0 f28-0)) + ) + ) + (format + arg1 + " tag focalPull-offset DEG(~R) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-flags +;; INFO: Return type mismatch object vs string. +(defun cam-layout-save-flags ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s4-0 + (res-lump-value + arg2 + 'flags + uint128 + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s5-0 (method-of-type res-lump get-property-value)) + (s1-0 arg2) + ) + (format (clear *res-key-string*) "~S~S" 'flags '-on) + (let + ((s5-1 + (s5-0 + s1-0 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s1-1 (method-of-type res-lump get-property-value)) + ) + (format (clear *res-key-string*) "~S~S" 'flags '-off) + (let + ((s3-1 + (s1-1 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when arg0 + (format #t "setup flags ") + (cam-slave-options->string (the-as uint s4-0) (the-as string #t)) + (format #t "~%") + (format #t "forced on ") + (cam-slave-options->string (the-as uint s5-1) (the-as string #t)) + (format #t "~%") + (format #t "forced off ") + (cam-slave-options->string (the-as uint s3-1) (the-as string #t)) + (format #t "~%") + (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) + (format #t "final ") + (cam-slave-options->string (the-as uint s4-1) (the-as string #t)) + ) + (format #t "~%") + ) + (format + arg1 + " tag flags-on 0x~X // int32~%" + s5-1 + ) + (the-as + string + (format + arg1 + " tag flags-off 0x~X // int32~%" + s3-1 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-focalpull-flags +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-focalpull-flags + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s4-0 + (res-lump-value + arg2 + 'focalpull-flags + uint128 + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s5-0 (method-of-type res-lump get-property-value)) + (s1-0 arg2) + ) + (format (clear *res-key-string*) "~S~S" 'focalpull-flags '-on) + (let + ((s5-1 + (s5-0 + s1-0 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s1-1 (method-of-type res-lump get-property-value)) + ) + (format (clear *res-key-string*) "~S~S" 'focalpull-flags '-off) + (let + ((s3-1 + (s1-1 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when arg0 + (format #t "setup focalpull-flags ") + (cam-index-options->string (the-as uint s4-0) (the-as string #t)) + (format #t "~%") + (format #t "forced on ") + (cam-index-options->string (the-as uint s5-1) (the-as string #t)) + (format #t "~%") + (format #t "forced off ") + (cam-index-options->string (the-as uint s3-1) (the-as string #t)) + (format #t "~%") + (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) + (format #t "final ") + (cam-index-options->string (the-as uint s4-1) (the-as string #t)) + ) + (format #t "~%") + ) + (format + arg1 + " tag focalpull-flags-on 0x~X // int32~%" + s5-1 + ) + (the-as + string + (format + arg1 + " tag focalpull-flags-off 0x~X // int32~%" + s3-1 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-campoints-flags +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-campoints-flags + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s4-0 + (res-lump-value + arg2 + 'campoints-flags + uint128 + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (s5-0 (method-of-type res-lump get-property-value)) + (s1-0 arg2) + ) + (format (clear *res-key-string*) "~S~S" 'campoints-flags '-on) + (let + ((s5-1 + (s5-0 + s1-0 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s1-1 (method-of-type res-lump get-property-value)) + ) + (format (clear *res-key-string*) "~S~S" 'campoints-flags '-off) + (let + ((s3-1 + (s1-1 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when arg0 + (format #t "setup campoints-flags ") + (cam-index-options->string (the-as uint s4-0) (the-as string #t)) + (format #t "~%") + (format #t "forced on ") + (cam-index-options->string (the-as uint s5-1) (the-as string #t)) + (format #t "~%") + (format #t "forced off ") + (cam-index-options->string (the-as uint s3-1) (the-as string #t)) + (format #t "~%") + (let ((s4-1 (logclear (logior s4-0 s5-1) s3-1))) + (format #t "final ") + (cam-index-options->string (the-as uint s4-1) (the-as string #t)) + ) + (format #t "~%") + ) + (format + arg1 + " tag campoints-flags-on 0x~X // int32~%" + s5-1 + ) + (the-as + string + (format + arg1 + " tag campoints-flags-off 0x~X // int32~%" + s3-1 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-introsplinetime +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-introsplinetime + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'intro-time + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'intro-time '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (cond + ((= f30-0 0.0) + (if arg0 + (format #t "setup intro-time 0.0 (defaults to 1 sec)~%") + ) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + (arg0 + (format #t "setup intro-time ~f~%" f30-0) + ) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag intro-time-offset SECONDS(~f) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-introsplineexitval +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-introsplineexitval + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'intro-exitValue + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'intro-exitValue '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when arg0 + (if (= f30-0 0.0) + (format #t "setup intro-exitValue 0.0 (defaults to 0.5)~%") + (format #t "setup intro-exitValue ~f~%" f30-0) + ) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag intro-exitValue-offset ~f // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-interptime +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-interptime + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'interpTime + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'interpTime '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup interpTime ~f~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~f~%" f28-0) + (format #t "final ~f~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag interpTime-offset SECONDS(~f) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-splineoffset +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-splineoffset + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (the-as + string + (when + (and + (not + (res-lump-struct + arg2 + 'pivot + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (res-lump-struct + arg2 + 'spline-offset + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (let + ((s4-1 + (res-lump-struct + arg2 + 'spline-offset + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (when s4-1 + (if arg0 + (format + #t + "spline offset ~M ~M ~M~%" + (-> s4-1 x) + (-> s4-1 y) + (-> s4-1 z) + ) + ) + (format + arg1 + " tag spline-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s4-1 x) + (-> s4-1 y) + (-> s4-1 z) + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-spline-follow-dist-offset +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-spline-follow-dist-offset + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (the-as + string + (when + (and + (not + (res-lump-struct + arg2 + 'pivot + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ((method-of-type res-lump get-property-value-float) + arg2 + 'spline-follow-dist-offset + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (the-as float #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'spline-follow-dist-offset + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when (the int f30-0) + (if arg0 + (format #t "spline follow dist offset ~M~%" f30-0) + ) + (format + arg1 + " tag spline-follow-dist-offset METERS(~M)~%" + f30-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-campointsoffset +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-campointsoffset + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((s5-0 + (res-lump-struct + arg2 + 'campoints-offset + vector + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (the-as string (when s5-0 + (if arg0 + (format + #t + "index offset ~M ~M ~M~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + ) + ) + (format + arg1 + " tag campoints-offset METERS(~M) METERS(~M) METERS(~M) 1.0 // vector~%" + (-> s5-0 x) + (-> s5-0 y) + (-> s5-0 z) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-tiltAdjust +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-tiltAdjust + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'tiltAdjust + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'tiltAdjust '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup tiltAdjust deg ~R~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format #t "final ~R~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag tiltAdjust-offset DEG(~R) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-stringMinLength +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-stringMinLength + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringMinLength + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringMinLength '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringMinLength ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringMinLength-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-stringMaxLength +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-stringMaxLength + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringMaxLength + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringMaxLength '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringMaxLength ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringMaxLength-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-stringMinHeight +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-stringMinHeight + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringMinHeight + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringMinHeight '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringMinHeight ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringMinHeight-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-stringMaxHeight +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-stringMaxHeight + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringMaxHeight + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringMaxHeight '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringMaxHeight ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringMaxHeight-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-stringCliffHeight +;; INFO: Return type mismatch object vs string. +(defun + cam-layout-save-stringCliffHeight + ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'stringCliffHeight + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'stringCliffHeight '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup stringCliffHeight ~M~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~M~%" f28-0) + (format #t "final ~M~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag stringCliffHeight-offset METERS(~M) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-save-maxAngle +;; INFO: Return type mismatch object vs string. +(defun cam-layout-save-maxAngle ((arg0 symbol) (arg1 string) (arg2 entity-actor)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + arg2 + 'maxAngle + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s3-0 (method-of-type res-lump get-property-value-float)) + ) + (format (clear *res-key-string*) "~S~S" 'maxAngle '-offset) + (let + ((f28-0 + (s3-0 + arg2 + (string->symbol *res-key-string*) + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if arg0 + (format #t "setup maxAngle ~R~%" f30-0) + ) + (the-as string (when (!= f28-0 0.0) + (when arg0 + (format #t "offset ~R~%" f28-0) + (format #t "final ~R~%" (+ f30-0 f28-0)) + ) + (format + arg1 + " tag maxAngle-offset DEG(~R) // float~%" + f28-0 + ) + ) + ) + ) + ) + ) + +;; definition for function clmf-save-single +(defbehavior + clmf-save-single cam-layout + ((arg0 entity-camera) (arg1 symbol) (arg2 symbol)) + (clear *temp-string*) + (if arg2 + (format + *temp-string* + "dd_next/caminfo/~s.cam" + (res-lump-struct + arg0 + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (format *temp-string* "dd_next/caminfo/garbage") + ) + (let ((s4-2 (new 'stack 'file-stream *temp-string* 'write))) + (if arg1 + (format + #t + "---------camera '~S'------------~%" + (res-lump-struct + arg0 + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (format s4-2 "#include /next/config_data/standard.m2d~%") + (format + s4-2 + "camera ~s {~%" + (res-lump-struct + arg0 + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + (cam-layout-save-cam-rot + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-cam-trans + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-pivot arg1 (the-as string s4-2) (the-as entity-actor arg0)) + (cam-layout-save-align arg1 (the-as string s4-2) (the-as entity-actor arg0)) + (cam-layout-save-interesting + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-fov arg1 (the-as string s4-2) (the-as entity-actor arg0)) + (cam-layout-save-focalpull + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-flags arg1 (the-as string s4-2) (the-as entity-actor arg0)) + (cam-layout-save-introsplinetime + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-introsplineexitval + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-interptime + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-splineoffset + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-spline-follow-dist-offset + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-campointsoffset + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-tiltAdjust + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringMinLength + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringMaxLength + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringMinHeight + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringMaxHeight + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-stringCliffHeight + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-maxAngle + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-campoints-flags + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (cam-layout-save-focalpull-flags + arg1 + (the-as string s4-2) + (the-as entity-actor arg0) + ) + (format s4-2 "}~%") + (file-stream-close s4-2) + ) + ) + +;; definition for function clmf-save-one +(defbehavior clmf-save-one cam-layout ((arg0 symbol)) + (let ((s5-1 (logtest? (the-as int arg0) 8)) + (gp-1 (logtest? (the-as int arg0) 16)) + ) + (if s5-1 + (format #t "~%~%~%=================================~%") + ) + (clmf-save-single (-> self cam-entity) s5-1 gp-1) + (if s5-1 + (format #t "===============================~%~%~%~%") + ) + (if gp-1 + (format + #t + "'~S' save completed~%" + (res-lump-struct + (-> self cam-entity) + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + ) + #t + ) + +;; definition for function clmf-save-all +(defbehavior clmf-save-all cam-layout ((arg0 symbol)) + (let ((s5-1 (logtest? (the-as int arg0) 8)) + (gp-1 (logtest? (the-as int arg0) 16)) + ) + (if s5-1 + (format #t "~%~%~%=================================~%") + ) + (let ((v1-5 (-> *camera-engine* alive-list next0))) + *camera-engine* + (let ((s4-0 (-> v1-5 next0))) + (while (!= v1-5 (-> *camera-engine* alive-list-end)) + (let ((a0-4 (-> (the-as connection v1-5) param1))) + (clmf-save-single (the-as entity-camera a0-4) s5-1 gp-1) + ) + (set! v1-5 s4-0) + *camera-engine* + (set! s4-0 (-> s4-0 next0)) + ) + ) + ) + (if s5-1 + (format #t "===============================~%~%~%~%") + ) + (if gp-1 + (format #t "camera save all completed~%") + ) + ) + #t + ) + +;; definition of type clmf-cam-flag-toggle-info +(deftype clmf-cam-flag-toggle-info (structure) + ((key float :offset-assert 0) + (force-on int32 :offset-assert 4) + (force-off int32 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type clmf-cam-flag-toggle-info +(defmethod inspect clmf-cam-flag-toggle-info ((obj clmf-cam-flag-toggle-info)) + (format #t "[~8x] ~A~%" obj 'clmf-cam-flag-toggle-info) + (format #t "~Tkey: ~f~%" (-> obj key)) + (format #t "~Tforce-on: ~D~%" (-> obj force-on)) + (format #t "~Tforce-off: ~D~%" (-> obj force-off)) + obj + ) + +;; definition for function clmf-cam-flag-toggle +(defbehavior clmf-cam-flag-toggle cam-layout ((arg0 int) (arg1 int)) + (let ((s4-0 (/ arg0 8)) + (gp-0 (new 'stack 'clmf-cam-flag-toggle-info)) + ) + (set! (-> gp-0 key) (-> self res-key)) + (cond + ((and + (= arg1 'vol-flags) + (>= (-> self res-key) (the float (-> self first-cutoutvol))) + ) + (set! + (-> gp-0 key) + (- (-> gp-0 key) (the float (-> self first-cutoutvol))) + ) + (set! arg1 (the-as int 'cutoutvol-flags)) + ) + ((and + (= arg1 'vol-flags) + (>= (-> self res-key) (the float (-> self first-pvol))) + ) + (set! (-> gp-0 key) (- (-> gp-0 key) (the float (-> self first-pvol)))) + (set! arg1 (the-as int 'pvol-flags)) + ) + ) + (let ((s3-0 (method-of-type res-lump get-property-value)) + (s2-0 (-> self cam-entity)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) + (set! + (-> gp-0 force-on) + (the-as + int + (s3-0 + s2-0 + (string->symbol *res-key-string*) + 'exact + (-> gp-0 key) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + (let ((s3-1 (method-of-type res-lump get-property-value)) + (s2-1 (-> self cam-entity)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) + (set! + (-> gp-0 force-off) + (the-as + int + (s3-1 + s2-1 + (string->symbol *res-key-string*) + 'exact + (-> gp-0 key) + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + (cond + ((logtest? (-> gp-0 force-off) s4-0) + (logclear! (-> gp-0 force-off) s4-0) + (logior! (-> gp-0 force-on) s4-0) + (let* ((s4-1 (-> self cam-entity)) + (s3-2 (method-of-object s4-1 add-32bit-data!)) + (s2-2 + (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32)) + ) + (s1-2 (shl (the-as int (-> gp-0 key)) 32)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) + (s3-2 + s4-1 + (the-as + res-tag + (make-u128 + s2-2 + (logior + s1-2 + (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32) + ) + ) + ) + (-> gp-0 force-off) + ) + ) + (let* ((s4-2 (-> self cam-entity)) + (s3-3 (method-of-object s4-2 add-32bit-data!)) + (s2-3 + (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32)) + ) + (s1-3 (shl (the-as int (-> gp-0 key)) 32)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) + (s3-3 + s4-2 + (the-as + res-tag + (make-u128 + s2-3 + (logior + s1-3 + (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32) + ) + ) + ) + (-> gp-0 force-on) + ) + ) + ) + ((logtest? (-> gp-0 force-on) s4-0) + (logclear! (-> gp-0 force-on) s4-0) + (let* ((s4-3 (-> self cam-entity)) + (s3-4 (method-of-object s4-3 add-32bit-data!)) + (s2-4 + (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32)) + ) + (s1-4 (shl (the-as int (-> gp-0 key)) 32)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-on) + (s3-4 + s4-3 + (the-as + res-tag + (make-u128 + s2-4 + (logior + s1-4 + (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32) + ) + ) + ) + (-> gp-0 force-on) + ) + ) + ) + (else + (logior! (-> gp-0 force-off) s4-0) + (let* ((s4-4 (-> self cam-entity)) + (s3-5 (method-of-object s4-4 add-32bit-data!)) + (s2-5 + (logior (shl #x10000 32) (shr (shl (the-as int int32) 32) 32)) + ) + (s1-5 (shl (the-as int (-> gp-0 key)) 32)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg1) '-off) + (s3-5 + s4-4 + (the-as + res-tag + (make-u128 + s2-5 + (logior + s1-5 + (shr (shl (the-as int (string->symbol *res-key-string*)) 32) 32) + ) + ) + ) + (-> gp-0 force-off) + ) + ) + ) + ) + ) + #t + ) + +;; definition for function clmf-cam-flag +(defbehavior clmf-cam-flag cam-layout ((arg0 string) (arg1 uint) (arg2 uint)) + (let ((s5-0 (/ (the-as int arg1) 8)) + (f30-0 (-> self res-key)) + ) + (cond + ((and + (= arg2 'vol-flags) + (>= (-> self res-key) (the float (-> self first-cutoutvol))) + ) + (set! f30-0 (- f30-0 (the float (-> self first-cutoutvol)))) + (set! arg2 (the-as uint 'cutoutvol-flags)) + ) + ((and + (= arg2 'vol-flags) + (>= (-> self res-key) (the float (-> self first-pvol))) + ) + (set! f30-0 (- f30-0 (the float (-> self first-pvol)))) + (set! arg2 (the-as uint 'pvol-flags)) + ) + ) + (let ((s3-0 (method-of-type res-lump get-property-value)) + (s2-0 (-> self cam-entity)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg2) '-off) + (cond + ((logtest? + (s3-0 + s2-0 + (string->symbol *res-key-string*) + 'exact + f30-0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + s5-0 + ) + (format arg0 ": off") + ) + ((let ((s3-1 (method-of-type res-lump get-property-value)) + (s2-1 (-> self cam-entity)) + ) + (format (clear *res-key-string*) "~S~S" (the-as object arg2) '-on) + (logtest? + (s3-1 + s2-1 + (string->symbol *res-key-string*) + 'exact + f30-0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + s5-0 + ) + ) + (format arg0 ": on") + ) + ((zero? + (logand + ((method-of-type res-lump get-property-value) + (-> self cam-entity) + (the-as symbol arg2) + 'exact + f30-0 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + s5-0 + ) + ) + (format arg0 ": off(maya)") + ) + (else + (format arg0 ": on(maya)") + ) + ) + ) + ) + #t + ) + +;; definition for function clmf-cam-float-adjust +(defbehavior + clmf-cam-float-adjust cam-layout + ((arg0 symbol) (arg1 (pointer float))) + (cam-layout-print 16 *camera-layout-message-ypos* "left stick adjusts value") + (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8)) + (let + ((f30-0 + ((method-of-type res-lump get-property-value-float) + (-> self cam-entity) + arg0 + 'interp + (-> (new 'static 'array float 1 -1000000000.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (f0-0 (-> arg1 0)) + ) + (if (= f0-0 0.0) + (set! f0-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + (let + ((f0-2 + (+ + f30-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 leftx)) + (-> (new 'static 'array float 1 128.0) 0) + (-> (new 'static 'array float 1 48.0) 0) + (-> (new 'static 'array float 1 110.0) 0) + f0-0 + ) + ) + ) + ) + (add-32bit-data! + (-> self cam-entity) + (new 'static 'res-tag + :name arg0 + :key-frame -1000000000.0 + :elt-count #x1 + :elt-type float + ) + f0-2 + ) + ) + ) + (set! *camera-read-analog* #f) + #t + ) + +;; definition for function clmf-cam-meters +(defbehavior clmf-cam-meters cam-layout ((arg0 meters) (arg1 symbol)) + (let + ((f0-0 + (cam-slave-get-float + (-> self cam-entity) + arg1 + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + ) + (format arg0 ": ~M" f0-0) + ) + #t + ) + +;; definition for function clmf-cam-fov +(defbehavior clmf-cam-fov cam-layout ((arg0 degrees) (arg1 symbol)) + (format arg0 ": ~R" (cam-slave-get-fov (-> self cam-entity))) + #t + ) + +;; definition for function clmf-cam-deg +(defbehavior clmf-cam-deg cam-layout ((arg0 degrees) (arg1 symbol)) + (format + arg0 + ": ~R" + (cam-slave-get-float + (-> self cam-entity) + arg1 + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + #t + ) + +;; definition for function clmf-cam-intro-time +(defbehavior clmf-cam-intro-time cam-layout ((arg0 float) (arg1 symbol)) + (let ((f30-0 (cam-slave-get-intro-step (-> self cam-entity)))) + (format arg0 ": ~f" (/ 0.016666668 f30-0)) + (set! (-> *CAM_LAYOUT-bank* intro-step) f30-0) + ) + #t + ) + +;; definition for function clmf-cam-interp-time +(defbehavior clmf-cam-interp-time cam-layout ((arg0 float) (arg1 symbol)) + (format arg0 ": ~f" (cam-slave-get-interp-time (-> self cam-entity))) + #t + ) + +;; definition for function clmf-cam-float +(defbehavior clmf-cam-float cam-layout ((arg0 float) (arg1 symbol)) + (format + arg0 + ": ~f" + (cam-slave-get-float + (-> self cam-entity) + arg1 + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + #t + ) + +;; definition for function clmf-cam-string +;; Used lq/sq +(defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) + (local-vars (sv-16 res-tag)) + (format arg0 ":") + (set! sv-16 (new 'static 'res-tag)) + (let + ((s5-1 + (res-lump-data + (-> self cam-entity) + arg1 + pointer + :tag-ptr + (& sv-16) + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + (when s5-1 + (dotimes (s4-0 (the-as int (-> sv-16 elt-count))) + (format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4))))) + ) + ) + ) + #t + ) + +;; definition for symbol *clm-focalpull-attr*, type clm +(define + *clm-focalpull-attr* + (new 'static 'clm + :title "---focalpull attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 2 :allocated-length 2 + (new 'static 'clm-list-item + :description "radial " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'focalpull-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 16 + :parm1-basic 'focalpull-flags + ) + ) + ) + (new 'static 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'focalpull-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 8 + :parm1-basic 'focalpull-flags + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *clm-index-attr*, type clm +(define + *clm-index-attr* + (new 'static 'clm + :title "---index attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 2 :allocated-length 2 + (new 'static 'clm-list-item + :description "radial " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'campoints-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 16 + :parm1-basic 'campoints-flags + ) + ) + ) + (new 'static 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'campoints-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 8 + :parm1-basic 'campoints-flags + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *clm-intro-attr*, type clm +(define + *clm-intro-attr* + (new 'static 'clm + :title "---intro attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 2 :allocated-length 2 + (new 'static 'clm-list-item + :description "time " + :track-val #f + :val-func 'clmf-cam-intro-time + :val-parm0-basic 'intro-time + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'intro-time-offset + :parm1-basic (new 'static 'bfloat :data 0.01) + ) + ) + ) + (new 'static 'clm-list-item + :description "exitValue" + :track-val #f + :val-func 'clmf-cam-float + :val-parm0-basic 'intro-exitValue + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'intro-exitValue-offset + :parm1-basic (new 'static 'bfloat :data 0.001) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *clm-spline-attr*, type clm +(define + *clm-spline-attr* + (new 'static 'clm + :title "---spline attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 1 :allocated-length 1 + (new 'static 'clm-list-item + :description "followDist" + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'spline-follow-dist + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'spline-follow-dist-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *clm-vol-attr*, type clm +(define + *clm-vol-attr* + (new 'static 'clm + :title "---volume attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 1 :allocated-length 1 + (new 'static 'clm-list-item + :description "airSwitch" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 8 + :val-parm1-basic 'vol-flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 8 + :parm1-basic 'vol-flags + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *clm-cam-attr*, type clm +(define + *clm-cam-attr* + (new 'static 'clm + :title "---camera attributes--" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func '*clm-edit* + ) + ) + (new 'static 'clm-item + :description "adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 18 :allocated-length 18 + (new 'static 'clm-list-item + :description "drag " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x400 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x400 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "fov " + :track-val #f + :val-func 'clmf-cam-fov + :val-parm0-basic 'fov + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'fov-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + (new 'static 'clm-list-item + :description "focalPull " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'focalPull + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'focalPull-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + (new 'static 'clm-list-item + :description "interpTime " + :track-val #f + :val-func 'clmf-cam-interp-time + :val-parm0-basic 'interpTime + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'interpTime-offset + :parm1-basic (new 'static 'bfloat :data 0.01) + ) + ) + ) + (new 'static 'clm-list-item + :description "sameSide " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 16 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 16 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "spherical " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 32 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 32 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "MinLength " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMinLength + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMinLength-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "MaxLength " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMaxLength + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMaxLength-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "MinHeight " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMinHeight + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMinHeight-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "MaxHeight " + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringMaxHeight + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringMaxHeight-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "cliffHeight" + :track-val #f + :val-func 'clmf-cam-meters + :val-parm0-basic 'stringCliffHeight + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'stringCliffHeight-offset + :parm1-basic (new 'static 'bfloat :data 409.6) + ) + ) + ) + (new 'static 'clm-list-item + :description "alternates " + :track-val #f + :val-func 'clmf-cam-string + :val-parm0-basic 'alternates + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 0 :allocated-length 0 + ) + ) + (new 'static 'clm-list-item + :description "maxAngle " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'maxAngle + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'maxAngle-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + (new 'static 'clm-list-item + :description "shrinkAngle" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x4000 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x4000 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "noRotate " + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x40000 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x40000 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "tiltAdjust " + :track-val #f + :val-func 'clmf-cam-deg + :val-parm0-basic 'tiltAdjust + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'tiltAdjust-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + (new 'static 'clm-list-item + :description "stickyAngle" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x80000 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x80000 + :parm1-basic 'flags + ) + ) + ) + (new 'static 'clm-list-item + :description "airExit" + :track-val #f + :val-func 'clmf-cam-flag + :val-parm0 #x100000 + :val-parm1-basic 'flags + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-cam-flag-toggle + :parm0 #x100000 + :parm1-basic 'flags + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *clm-cam-lookthrough*, type clm +(define + *clm-cam-lookthrough* + (new 'static 'clm + :title "---cam-lookthrough---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 5 :allocated-length 5 + (new 'static 'clm-item + :description " " + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x4 + :func 'clmf-look-through + ) + ) + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func 'clmf-to-edit + ) + ) + (new 'static 'clm-item + :description "pos/rot" + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x8 + :func 'clmf-pos-rot + :parm0-basic 'trans-offset + :parm1-basic 'rot-offset + ) + ) + (new 'static 'clm-item + :description " adjust" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :func #f) + ) + (new 'static 'clm-list + :tracker #f + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 1 :allocated-length 1 + (new 'static 'clm-list-item + :description "fov" + :track-val #f + :val-func 'clmf-cam-fov + :val-parm0-basic 'fov + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 1 :allocated-length 1 + (new 'static 'clm-item-action + :button #x4000 + :func 'clmf-cam-float-adjust + :parm0-basic 'fov-offset + :parm1-basic (new 'static 'bfloat :data 91.022224) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *clm-edit*, type clm +(define + *clm-edit* + (new 'static 'clm + :title "---edit---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 6 :allocated-length 6 + (new 'static 'clm-item + :description " ok" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func 'clmf-to-select + ) + ) + (new 'static 'clm-item + :description "attributes" + :button-symbol 'x + :action + (new 'static 'clm-item-action :button #x4000 :options #x1 :func #f) + ) + (new 'static 'clm-item + :description " edit part" + :button-symbol 'circle + :action + (new 'static 'clm-item-action :button #x2000 :options #x1 :func #f) + ) + (new 'static 'clm-item + :description "scale/next" + :button-symbol 'r2 + :action + (new 'static 'clm-item-action :button #x200 :func #f) + ) + (new 'static 'clm-item + :description " pos/rot" + :button-symbol 'l2 + :action + (new 'static 'clm-item-action :button #x100 :func #f) + ) + (new 'static 'clm-list + :tracker '*camera-layout-blink* + :items + (new + 'static + 'boxed-array + :type clm-list-item :length 9 :allocated-length 9 + (new 'static 'clm-list-item + :description "camera " + :track-val 'camera + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func '*clm-cam-attr* + ) + (new 'static 'clm-item-action + :button #x2000 + :func '*clm-cam-lookthrough* + ) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'trans-offset + :parm1-basic 'rot-offset + ) + ) + ) + (new 'static 'clm-list-item + :description "volume " + :track-val 'volume + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-to-vol-attr + ) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-next-vol-dpad) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) + ) + ) + (new 'static 'clm-list-item + :description "align " + :track-val 'align + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'align-offset + :parm1-basic #f + ) + ) + ) + (new 'static 'clm-list-item + :description "pivot " + :track-val 'pivot + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'pivot-offset + :parm1-basic #f + ) + ) + ) + (new 'static 'clm-list-item + :description "interesting" + :track-val 'interesting + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action :button #x4000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-bna) + (new 'static 'clm-item-action :button #x200 :func 'clmf-bna) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'interesting-offset + :parm1-basic #f + ) + ) + ) + (new 'static 'clm-list-item + :description "spline " + :track-val 'spline + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action :button #x4000 :func 'clmf-to-spline-attr) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'spline-offset + :parm1-basic #f + ) + ) + ) + (new 'static 'clm-list-item + :description "intro " + :track-val 'intro + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-to-intro-attr + ) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) + ) + ) + (new 'static 'clm-list-item + :description "index " + :track-val 'index + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-to-index-attr + ) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action + :button #x100 + :func 'clmf-pos-rot + :parm0-basic 'campoints-offset + ) + ) + ) + (new 'static 'clm-list-item + :description "focalpull" + :track-val 'focalpull + :val-func #f + :actions + (new + 'static + 'boxed-array + :type clm-item-action :length 4 :allocated-length 4 + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-to-focalpull-attr + ) + (new 'static 'clm-item-action :button #x2000 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x200 :func 'clmf-implement) + (new 'static 'clm-item-action :button #x100 :func 'clmf-implement) + ) + ) + ) + ) + ) + ) + ) + +;; definition for symbol *clm-save-all*, type clm +(define + *clm-save-all* + (new 'static 'clm + :title "---save all?---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " save all" + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-save-all + :parm0 16 + ) + ) + (new 'static 'clm-item + :description "print all" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func 'clmf-save-all + :parm0 8 + ) + ) + (new 'static 'clm-item + :description " done" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action + :button #x1000 + :options #x1 + :func 'clmf-to-select + ) + ) + ) + ) + ) + +;; definition for symbol *clm-save-one*, type clm +(define + *clm-save-one* + (new 'static 'clm + :title "---single save?---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 3 :allocated-length 3 + (new 'static 'clm-item + :description " single save" + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x1 + :func 'clmf-save-one + :parm0 16 + ) + ) + (new 'static 'clm-item + :description "single print" + :button-symbol 'square + :action + (new 'static 'clm-item-action + :button #x8000 + :options #x1 + :func 'clmf-save-one + :parm0 8 + ) + ) + (new 'static 'clm-item + :description " done" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action + :button #x1000 + :options #x1 + :func 'clmf-to-select + ) + ) + ) + ) + ) + +;; definition for symbol *clm-select*, type clm +(define + *clm-select* + (new 'static 'clm + :title "---camera---" + :items + (new + 'static + 'boxed-array + :type clm-basic :length 6 :allocated-length 6 + (new 'static 'clm-item + :description " edit" + :button-symbol 'x + :action + (new 'static 'clm-item-action + :button #x4000 + :options #x3 + :func 'clmf-to-edit-cam + ) + ) + (new 'static 'clm-item + :description "save one" + :button-symbol 'triangle + :action + (new 'static 'clm-item-action + :button #x1000 + :options #x3 + :func '*clm-save-one* + ) + ) + (new 'static 'clm-item + :description " next" + :button-symbol 'down + :action + (new 'static 'clm-item-action + :button #x40 + :options #x3 + :func 'clmf-next-entity + :parm0 8 + ) + ) + (new 'static 'clm-item + :description " prev" + :button-symbol 'up + :action + (new 'static 'clm-item-action + :button #x10 + :options #x3 + :func 'clmf-next-entity + :parm0 -8 + ) + ) + (new 'static 'clm-item + :description " next 5" + :button-symbol 'right + :action + (new 'static 'clm-item-action + :button #x20 + :options #x3 + :func 'clmf-next-entity + :parm0 40 + ) + ) + (new 'static 'clm-item + :description " prev 5" + :button-symbol 'left + :action + (new 'static 'clm-item-action + :button #x80 + :options #x3 + :func 'clmf-next-entity + :parm0 -40 + ) + ) + ) + ) + ) + +;; definition for symbol *clm*, type clm +(define *clm* *clm-select*) + +;; definition for function cam-layout-do-action +(defbehavior cam-layout-do-action cam-layout ((arg0 clm-item-action)) + (let ((s5-0 (-> arg0 func value))) + (cond + ((not s5-0) + #f + ) + ((zero? s5-0) + #f + ) + ((and (not (-> self cam-entity)) (logtest? (-> arg0 options) 2)) + #f + ) + ((and + (logtest? (-> arg0 options) 8) + (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (-> arg0 button)) + ) + #f + ) + ((and + (zero? (logand (-> arg0 options) 12)) + (logtest? (-> arg0 options) 1) + (zero? (logand (-> *cpad-list* cpads 0 button0-rel 0) (-> arg0 button))) + ) + #f + ) + ((and + (zero? (logand (-> arg0 options) 13)) + (zero? (logand (-> *cpad-list* cpads 0 button0-abs 0) (-> arg0 button))) + ) + #f + ) + ((type-type? (-> (the-as basic s5-0) type) clm) + (set! *clm* (the-as clm s5-0)) + #t + ) + ((type-type? (-> (the-as basic s5-0) type) function) + ((the-as (function object symbol symbol) s5-0) + (-> arg0 parm0) + (the-as symbol (-> arg0 parm1-basic)) + ) + ) + ) + ) + ) + +;; definition for function cam-layout-function-call +(defbehavior + cam-layout-function-call cam-layout + ((arg0 symbol) (arg1 string) (arg2 int) (arg3 basic)) + (let ((gp-0 (-> arg0 value))) + (cond + ((not gp-0) + ) + ((zero? gp-0) + ) + ((type-type? (-> (the-as basic gp-0) type) function) + ((the-as (function string int basic none) gp-0) arg1 arg2 arg3) + ) + ) + ) + #f + ) + +;; definition for function cam-layout-do-menu +;; INFO: Return type mismatch symbol vs none. +(defbehavior cam-layout-do-menu cam-layout ((arg0 clm)) + (set! *camera-layout-message-ypos* 30) + (+! (-> *CAM_LAYOUT-bank* spline-t) (-> *CAM_LAYOUT-bank* spline-step)) + (if (< 1.01 (-> *CAM_LAYOUT-bank* spline-t)) + (set! (-> *CAM_LAYOUT-bank* spline-t) -0.09) + ) + (+! (-> *CAM_LAYOUT-bank* intro-t) (-> *CAM_LAYOUT-bank* intro-step)) + (if (< 1.01 (-> *CAM_LAYOUT-bank* intro-t)) + (set! (-> *CAM_LAYOUT-bank* intro-t) -0.09) + ) + (let ((s5-0 30)) + (let ((s4-0 (cam-state-from-entity (-> self cam-entity)))) + (set! *camera-read-analog* #t) + (let ((s3-0 (-> self cam-entity))) + (clear *temp-string*) + (if s3-0 + (format + *temp-string* + "\"~S\"~%" + (res-lump-struct + s3-0 + 'name + structure + :time + (-> (new 'static 'array float 1 -1000000000.0) 0) + ) + ) + ) + ) + (if (not s4-0) + (format *temp-string* "no cameras in this level") + (format *temp-string* "~S" (-> s4-0 name)) + ) + ) + (cam-layout-print 320 s5-0 *temp-string*) + (let ((s5-1 (+ s5-0 16))) + (clear *temp-string*) + (format *temp-string* "~S~%" (-> arg0 title)) + (cam-layout-print 320 s5-1 *temp-string*) + (let ((s4-1 (+ s5-1 8))) + (dotimes (s5-2 (-> arg0 items length)) + (cond + ((type-type? (-> arg0 items s5-2 type) clm-list) + (clear *temp-string*) + (format *temp-string* "------------") + (cam-layout-print 320 s4-1 *temp-string*) + (let ((s4-2 (+ s4-1 8))) + (let ((s3-1 (the-as clm-list (-> arg0 items s5-2)))) + (dotimes (s2-1 (-> s3-1 items length)) + (clear *temp-string*) + (format *temp-string* "~S~S" (if (= s2-1 (-> s3-1 cur-list-item)) + "> " + " " + ) + (-> s3-1 items s2-1 description) + ) + (cam-layout-function-call + (-> s3-1 items s2-1 val-func) + *temp-string* + (-> s3-1 items s2-1 val-parm0) + (-> s3-1 items s2-1 val-parm1-basic) + ) + (cam-layout-print 320 s4-2 *temp-string*) + (+! s4-2 8) + ) + ) + (clear *temp-string*) + (format *temp-string* "------------") + (cam-layout-print 320 s4-2 *temp-string*) + (set! s4-1 (+ s4-2 8)) + ) + ) + ((and + (not (-> self cam-entity)) + (logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 2) + ) + ) + ((logtest? (-> (the-as clm-item (-> arg0 items s5-2)) action options) 4) + ) + (else + (let ((s3-2 (-> arg0 items s5-2))) + (clear *temp-string*) + (format + *temp-string* + "~S: ~A~%" + (-> (the-as clm-item s3-2) description) + (if + (logtest? + (-> (the-as clm-item (-> arg0 items s5-2)) action options) + 8 + ) + 'default + (-> (the-as clm-item s3-2) button-symbol) + ) + ) + ) + (cam-layout-print 320 s4-1 *temp-string*) + (+! s4-1 8) + ) + ) + ) + ) + ) + ) + (if (= *master-mode* 'menu) + (goto cfg-65) + ) + (dotimes (s5-3 (-> arg0 items length)) + (cond + ((type-type? (-> arg0 items s5-3 type) clm-list) + (let ((s4-3 (-> arg0 items s5-3)) + (s3-3 0) + ) + (if (-> (the-as clm-list s4-3) tracker) + (set! + (-> (the-as clm-list s4-3) tracker value) + (-> + (the-as clm-list s4-3) + items + (-> (the-as clm-list s4-3) cur-list-item) + track-val + ) + ) + ) + (dotimes + (s2-2 + (-> + (the-as clm-list s4-3) + items + (-> (the-as clm-list s4-3) cur-list-item) + actions + length + ) + ) + (if + (cam-layout-do-action + (-> + (the-as clm-list s4-3) + items + (-> (the-as clm-list s4-3) cur-list-item) + actions + s2-2 + ) + ) + (goto cfg-65) + ) + ) + (cond + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down)) + (set! s3-3 1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right)) + (set! s3-3 1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up)) + (set! s3-3 -1) + ) + ((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left)) + (set! s3-3 -1) + ) + ) + (when (nonzero? s3-3) + (set! + (-> (the-as clm-list s4-3) cur-list-item) + (mod + (+ (-> (the-as clm-list s4-3) cur-list-item) s3-3) + (-> (the-as clm-list s4-3) items length) + ) + ) + (while (< (-> (the-as clm-list s4-3) cur-list-item) 0) + (+! + (-> (the-as clm-list s4-3) cur-list-item) + (-> (the-as clm-list s4-3) items length) + ) + ) + (goto cfg-65) + ) + ) + ) + ((cam-layout-do-action (-> (the-as clm-item (-> arg0 items s5-3)) action)) + (goto cfg-65) + ) + ) + ) + (label cfg-65) + (none) + ) + +;; failed to figure out what this is: +(defstate cam-layout-active (cam-layout) + :code + (behavior () + (while #t + (cam-layout-entity-info (the-as entity-actor (-> self cam-entity))) + (cam-layout-entity-volume-info) + (cam-layout-do-menu *clm*) + (suspend) + ) + (none) + ) + ) + +;; definition for function cam-layout-init +(defbehavior cam-layout-init cam-layout () + (set! (-> self res-key) (-> (new 'static 'array float 1 -1000000000.0) 0)) + (set! (-> self num-entities) 0) + (let ((v1-2 (-> *camera-engine* alive-list next0))) + *camera-engine* + (let ((a0-2 (-> v1-2 next0))) + (while (!= v1-2 (-> *camera-engine* alive-list-end)) + (-> (the-as connection v1-2) param1) + (+! (-> self num-entities) 1) + (set! v1-2 a0-2) + *camera-engine* + (set! a0-2 (-> a0-2 next0)) + ) + ) + ) + (set! (-> self cur-entity) *last-cur-entity*) + (clmf-next-entity 0) + (set! *clm* *clm-select*) + (go cam-layout-active) + (none) + ) + +;; definition for function cam-layout-stop +(defun cam-layout-stop () + (set! *cam-layout* #f) + (kill-by-name 'cam-layout *active-pool*) + ) + +;; definition for function cam-layout-start +;; INFO: Return type mismatch symbol vs none. +(defun cam-layout-start () + (let ((a0-1 (new 'global 'file-stream "dd_next/caminfo/garbage" 'read))) + (file-stream-close a0-1) + ) + (cond + ((not *cam-layout*) + (let* ((gp-0 (get-process *camera-dead-pool* cam-layout #x4000)) + (v1-4 (when gp-0 + (let ((t9-3 (method-of-type cam-layout activate))) + (t9-3 + (the-as cam-layout gp-0) + *default-pool* + 'cam-layout + (the-as pointer #x70004000) + ) + ) + (run-next-time-in-process gp-0 cam-layout-init) + (-> gp-0 ppointer) + ) + ) + ) + (cond + (v1-4 + (logclear! (-> v1-4 0 mask) (process-mask pause menu)) + (set! *cam-layout* #t) + (set! *camera-layout-blink* #f) + ) + (else + (format + 0 + "ERROR : no process available to start cam editing mode~%" + ) + ) + ) + ) + ) + (else + (format 0 "ERROR : cam editing mode already started~%") + ) + ) + *cam-layout* + (none) + ) + +;; definition for function cam-layout-restart +(defun cam-layout-restart () + (cam-layout-stop) + (cam-layout-start) + (none) + ) + +) diff --git a/test/decompiler/reference/engine/camera/cam-master_REF.gc b/test/decompiler/reference/engine/camera/cam-master_REF.gc new file mode 100644 index 0000000000..01f64cbe10 --- /dev/null +++ b/test/decompiler/reference/engine/camera/cam-master_REF.gc @@ -0,0 +1,1494 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type camera-master-bank +(deftype camera-master-bank (basic) + ((onscreen-head-height meters :offset-assert 4) + (onscreen-foot-height meters :offset-assert 8) + (target-height meters :offset-assert 12) + (up-move-to-pitch-ratio-in-air float :offset-assert 16) + (down-move-to-pitch-ratio-in-air float :offset-assert 20) + (up-move-to-pitch-on-ground float :offset-assert 24) + (down-move-to-pitch-on-ground float :offset-assert 28) + (pitch-off-blend float :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x24 + :flag-assert #x900000024 + ) + +;; definition for method 3 of type camera-master-bank +(defmethod inspect camera-master-bank ((obj camera-master-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format + #t + "~Tonscreen-head-height: (meters ~m)~%" + (-> obj onscreen-head-height) + ) + (format + #t + "~Tonscreen-foot-height: (meters ~m)~%" + (-> obj onscreen-foot-height) + ) + (format #t "~Ttarget-height: (meters ~m)~%" (-> obj target-height)) + (format + #t + "~Tup-move-to-pitch-ratio-in-air: ~f~%" + (-> obj up-move-to-pitch-ratio-in-air) + ) + (format + #t + "~Tdown-move-to-pitch-ratio-in-air: ~f~%" + (-> obj down-move-to-pitch-ratio-in-air) + ) + (format + #t + "~Tup-move-to-pitch-on-ground: ~f~%" + (-> obj up-move-to-pitch-on-ground) + ) + (format + #t + "~Tdown-move-to-pitch-on-ground: ~f~%" + (-> obj down-move-to-pitch-on-ground) + ) + (format #t "~Tpitch-off-blend: ~f~%" (-> obj pitch-off-blend)) + obj + ) + +;; definition for symbol *CAMERA_MASTER-bank*, type camera-master-bank +(define + *CAMERA_MASTER-bank* + (new 'static 'camera-master-bank + :onscreen-head-height (meters 2.65) + :onscreen-foot-height (meters -0.5) + :target-height (meters 2.15) + :up-move-to-pitch-ratio-in-air 1.0 + :down-move-to-pitch-ratio-in-air 0.5 + :up-move-to-pitch-on-ground 0.9 + :down-move-to-pitch-on-ground 0.9 + :pitch-off-blend 0.5 + ) + ) + +;; definition for function reset-follow +;; Used lq/sq +(defbehavior reset-follow camera-master () + (set! (-> self tpos-old quad) (-> (target-cam-pos) quad)) + (set! (-> self tpos-curr quad) (-> self tpos-old quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-tgt quad) (-> self tpos-old quad)) + (let ((f0-0 0.0)) + (set! (-> self upspeed) f0-0) + f0-0 + ) + ) + +;; definition for function reset-target-tracking +;; INFO: Return type mismatch none vs symbol. +;; Used lq/sq +(defbehavior reset-target-tracking camera-master () + (set! (-> self tpos-old quad) (-> (target-cam-pos) quad)) + (set! (-> self tpos-curr quad) (-> self tpos-old quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-tgt quad) (-> self tpos-old quad)) + (quaternion->matrix (-> self tgt-rot-mat) (-> *target* control dir-targ)) + (quaternion->matrix + (-> self tgt-face-mat) + (-> *target* control unknown-quaternion00) + ) + (vector-reset! (-> self pitch-off)) + (set! (-> self upspeed) 0.0) + (set! (-> self foot-offset) (-> *CAMERA_MASTER-bank* onscreen-foot-height)) + (set! (-> self head-offset) (-> *CAMERA_MASTER-bank* onscreen-head-height)) + (set! (-> self target-height) (-> *CAMERA_MASTER-bank* target-height)) + (set! + (-> self on-ground) + (not + (and + (logtest? (-> *target* control unknown-surface00 flags) 2048) + (zero? (logand (-> *target* control status) 1)) + ) + ) + ) + (set! (-> self on-pole) #f) + (set! (-> self ease-t) 1.0) + (set! (-> self string-max target y) (-> self stringMaxHeight)) + (set! (-> self string-max target z) (-> self stringMaxLength)) + (set! + (-> self string-push-z) + (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z)) + ) + (cond + ((>= (- (-> *display* base-frame-counter) (if *target* + (-> *target* neck notice-time) + 0 + ) + ) + (the-as int (-> *CAMERA-bank* attack-timeout)) + ) + (set! (-> self being-attacked) #f) + ) + (else + (set! + (-> self attack-start) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self being-attacked) #t) + (when + (and + (zero? (logand (-> self master-options) 64)) + (or + (!= (-> last-try-to-look-at-data horz) 0.0) + (!= (-> last-try-to-look-at-data vert) 0.0) + ) + ) + (set! + (-> self string-max target y) + (fmax (-> self string-max target y) (-> last-try-to-look-at-data vert)) + ) + (set! + (-> self string-max target z) + (fmax (-> self string-max target z) (-> last-try-to-look-at-data horz)) + ) + (set! + (-> self string-push-z) + (fmax (-> self string-push-z) (-> self string-max target z)) + ) + ) + ) + ) + (cond + ((and + (logtest? (-> *target* water flags) 4096) + (zero? (logand (-> *target* water flags) 16)) + ) + (set! (-> self under-water) 2) + ) + (else + (set! (-> self under-water) 0) + 0 + ) + ) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector--float*! + gp-1 + (-> self tpos-curr-adj) + (-> self local-down) + (-> self target-height) + ) + (the-as symbol (TODO-RENAME-10 (-> self target-spline) gp-1)) + ) + ) + +;; definition for function reset-drawable-follow +;; Used lq/sq +(defbehavior reset-drawable-follow camera-master () + (let ((v1-2 (the-as target (-> self drawable-target process 0)))) + (if (nonzero? (-> v1-2 node-list)) + (vector<-cspace! + (-> self tpos-old) + (-> v1-2 node-list data (-> self which-bone)) + ) + (set! (-> self tpos-old quad) (-> v1-2 control trans quad)) + ) + ) + (set! (-> self tpos-curr quad) (-> self tpos-old quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) + (let ((f0-0 0.0)) + (set! (-> self upspeed) f0-0) + f0-0 + ) + ) + +;; definition for function reset-drawable-tracking +;; INFO: Return type mismatch none vs symbol. +;; Used lq/sq +(defbehavior reset-drawable-tracking camera-master () + (let ((gp-0 (the-as target (-> self drawable-target process 0)))) + (cond + ((nonzero? (-> gp-0 node-list)) + (vector<-cspace! + (-> self tpos-old) + (-> gp-0 node-list data (-> self which-bone)) + ) + (let* ((v1-6 (-> self tgt-rot-mat)) + (a3-0 (-> gp-0 node-list data (-> self which-bone) bone transform)) + (a0-4 (-> a3-0 vector 0 quad)) + (a1-4 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 vector 3 quad)) + ) + (set! (-> v1-6 vector 0 quad) a0-4) + (set! (-> v1-6 vector 1 quad) a1-4) + (set! (-> v1-6 vector 2 quad) a2-0) + (set! (-> v1-6 vector 3 quad) a3-1) + ) + (set! (-> self tgt-rot-mat vector 3 quad) (the-as uint128 0)) + (let* ((v1-8 (-> self tgt-face-mat)) + (a3-2 (-> self tgt-rot-mat)) + (a0-5 (-> a3-2 vector 0 quad)) + (a1-5 (-> a3-2 vector 1 quad)) + (a2-1 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad)) + ) + (set! (-> v1-8 vector 0 quad) a0-5) + (set! (-> v1-8 vector 1 quad) a1-5) + (set! (-> v1-8 vector 2 quad) a2-1) + (set! (-> v1-8 vector 3 quad) a3-3) + ) + ) + (else + (set! (-> self tpos-old quad) (-> gp-0 control trans quad)) + (quaternion->matrix (-> self tgt-rot-mat) (-> gp-0 control quat)) + (let* ((v1-11 (-> self tgt-face-mat)) + (a3-4 (-> self tgt-rot-mat)) + (a0-10 (-> a3-4 vector 0 quad)) + (a1-7 (-> a3-4 vector 1 quad)) + (a2-2 (-> a3-4 vector 2 quad)) + (a3-5 (-> a3-4 vector 3 quad)) + ) + (set! (-> v1-11 vector 0 quad) a0-10) + (set! (-> v1-11 vector 1 quad) a1-7) + (set! (-> v1-11 vector 2 quad) a2-2) + (set! (-> v1-11 vector 3 quad) a3-5) + ) + ) + ) + ) + (set! (-> self tpos-curr quad) (-> self tpos-old quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-old quad)) + (set! (-> self tpos-curr-adj quad) (-> self tpos-old quad)) + (vector-reset! (-> self pitch-off)) + (set! (-> self upspeed) 0.0) + (set! (-> self foot-offset) (-> *CAMERA_MASTER-bank* onscreen-foot-height)) + (set! (-> self head-offset) (-> *CAMERA_MASTER-bank* onscreen-head-height)) + (set! (-> self target-height) (-> *CAMERA_MASTER-bank* target-height)) + (set! (-> self on-ground) #t) + (set! (-> self on-pole) #f) + (set! (-> self ease-t) 1.0) + (set! (-> self being-attacked) #f) + (set! (-> self string-max target y) (-> self stringMaxHeight)) + (set! (-> self string-max target z) (-> self stringMaxLength)) + (set! + (-> self string-push-z) + (fmax (-> self string-min value z) (-> *CAMERA-bank* default-string-push-z)) + ) + (set! (-> self under-water) 0) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector--float*! + gp-1 + (-> self tpos-curr-adj) + (-> self local-down) + (-> self target-height) + ) + (the-as symbol (TODO-RENAME-10 (-> self target-spline) gp-1)) + ) + ) + +;; definition for function master-track-target +;; INFO: Return type mismatch none vs symbol. +;; Used lq/sq +(defbehavior master-track-target camera-master () + (cond + ((and + (logtest? (-> self master-options) 2) + (!= (-> self drawable-target) #f) + (not (handle->process (-> self drawable-target))) + ) + (set! (-> self master-options) (logand -3 (-> self master-options))) + (set! (-> self drawable-target) (the-as handle #f)) + ) + ((and + (logtest? (-> self master-options) 2) + (handle->process (-> self drawable-target)) + ) + (let ((gp-0 (-> self drawable-target process 0))) + (if (paused?) + (return (the-as symbol #f)) + ) + (set! (-> self tpos-old quad) (-> self tpos-curr quad)) + (set! (-> self tpos-old-adj quad) (-> self tpos-curr-adj quad)) + (cond + ((nonzero? (-> (the-as target gp-0) node-list)) + (let* ((v1-24 (-> self tgt-rot-mat)) + (a3-0 + (-> + (the-as target gp-0) + node-list + data + (-> self which-bone) + bone + transform + ) + ) + (a0-17 (-> a3-0 vector 0 quad)) + (a1-4 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 vector 3 quad)) + ) + (set! (-> v1-24 vector 0 quad) a0-17) + (set! (-> v1-24 vector 1 quad) a1-4) + (set! (-> v1-24 vector 2 quad) a2-0) + (set! (-> v1-24 vector 3 quad) a3-1) + ) + (set! (-> self tgt-rot-mat vector 3 quad) (the-as uint128 0)) + (let* ((a2-1 (-> self tgt-face-mat)) + (a3-2 (-> self tgt-rot-mat)) + (v1-26 (-> a3-2 vector 0 quad)) + (a0-18 (-> a3-2 vector 1 quad)) + (a1-5 (-> a3-2 vector 2 quad)) + (a3-3 (-> a3-2 vector 3 quad)) + ) + (set! (-> a2-1 vector 0 quad) v1-26) + (set! (-> a2-1 vector 1 quad) a0-18) + (set! (-> a2-1 vector 2 quad) a1-5) + (set! (-> a2-1 vector 3 quad) a3-3) + ) + (vector<-cspace! + (-> self tpos-curr) + (-> (the-as target gp-0) node-list data (-> self which-bone)) + ) + ) + (else + (quaternion->matrix + (-> self tgt-rot-mat) + (-> (the-as target gp-0) control quat) + ) + (let* ((a2-3 (-> self tgt-face-mat)) + (a3-4 (-> self tgt-rot-mat)) + (v1-31 (-> a3-4 vector 0 quad)) + (a0-21 (-> a3-4 vector 1 quad)) + (a1-9 (-> a3-4 vector 2 quad)) + (a3-5 (-> a3-4 vector 3 quad)) + ) + (set! (-> a2-3 vector 0 quad) v1-31) + (set! (-> a2-3 vector 1 quad) a0-21) + (set! (-> a2-3 vector 2 quad) a1-9) + (set! (-> a2-3 vector 3 quad) a3-5) + ) + ) + ) + ) + (let ((v1-32 (new-stack-vector0))) + 0.0 + (vector-! v1-32 (-> self tpos-curr-adj) (-> self tpos-curr)) + (let* ((f0-2 (vector-dot v1-32 (-> self local-down))) + (f0-3 (if (< 0.0 f0-2) + (* f0-2 (-> *CAMERA_MASTER-bank* up-move-to-pitch-on-ground)) + (* + f0-2 + (-> *CAMERA_MASTER-bank* down-move-to-pitch-on-ground) + ) + ) + ) + ) + (vector+float*! + (-> self tpos-curr-adj) + (-> self tpos-curr) + (-> self local-down) + f0-3 + ) + ) + ) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector--float*! + gp-1 + (-> self tpos-curr-adj) + (-> self local-down) + (-> self target-height) + ) + (TODO-RENAME-17 (-> self target-spline) gp-1 2048.0 0.0 #f) + ) + (TODO-RENAME-22 (-> self target-spline) 40960.0) + ) + ((handle->process (-> self drawable-target)) + (logior! (-> self master-options) 2) + (reset-drawable-tracking) + ) + ) + (the-as symbol (cond + ((handle->process (-> self drawable-target)) + #f + ) + ((and *target* (logtest? (-> self master-options) 2)) + (if (paused?) + (return (the-as symbol #f)) + ) + (cond + ((>= (- (-> *display* base-frame-counter) (if *target* + (-> + *target* + neck + notice-time + ) + 0 + ) + ) + (the-as int (-> *CAMERA-bank* attack-timeout)) + ) + (set! (-> self being-attacked) #f) + ) + (else + (if (not (-> self being-attacked)) + (set! + (-> self attack-start) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (set! (-> self being-attacked) #t) + (when + (and + (zero? (logand (-> self master-options) 64)) + (or + (!= (-> last-try-to-look-at-data horz) 0.0) + (!= (-> last-try-to-look-at-data vert) 0.0) + ) + ) + (set! + (-> self string-max target y) + (fmax + (-> self string-max target y) + (-> last-try-to-look-at-data vert) + ) + ) + (set! + (-> self string-max target z) + (fmax + (-> self string-max target z) + (-> last-try-to-look-at-data horz) + ) + ) + (set! + (-> self string-push-z) + (fmax + (-> self string-push-z) + (-> self string-max target z) + ) + ) + ) + ) + ) + (cond + ((and + (logtest? (-> *target* water flags) 4096) + (zero? (logand (-> *target* water flags) 16)) + ) + (set! (-> self under-water) 2) + ) + ((> (-> self under-water) 0) + (+! (-> self under-water) -1) + ) + ) + (set! (-> self tpos-old quad) (-> self tpos-curr quad)) + (set! + (-> self tpos-old-adj quad) + (-> self tpos-curr-adj quad) + ) + (quaternion->matrix + (-> self tgt-rot-mat) + (-> *target* control dir-targ) + ) + (quaternion->matrix + (-> self tgt-face-mat) + (-> *target* control unknown-quaternion00) + ) + (cond + ((< (-> self ease-t) 1.0) + (new 'stack-no-clear 'vector) + (cond + ((logtest? (-> self master-options) 32) + (vector-lerp! + (-> self tpos-curr) + (-> self ease-from) + (-> self ease-to) + (parameter-ease-sin-clamp (-> self ease-t)) + ) + (set! + (-> self master-options) + (logand -33 (-> self master-options)) + ) + ) + (else + (vector-lerp! + (-> self tpos-curr) + (-> self ease-from) + (target-cam-pos) + (parameter-ease-sin-clamp (-> self ease-t)) + ) + ) + ) + (+! (-> self ease-t) (-> self ease-step)) + ) + (else + (set! (-> self tpos-curr quad) (-> (target-cam-pos) quad)) + ) + ) + (when + (logtest? + (-> *target* control root-prim prim-core action) + 128 + ) + (if *display-cam-los-debug* + (format *stdcon* "ride edge~%") + ) + (let ((s4-2 (new 'stack-no-clear 'collide-mesh-cache-tri)) + (gp-5 (new 'stack-no-clear 'vector)) + (s5-2 (new 'stack-no-clear 'vector)) + ) + (vector--float*! + s5-2 + (-> self tpos-curr) + (-> self local-down) + (-> self target-height) + ) + (vector-float*! gp-5 (-> self tgt-rot-mat vector 2) 4915.2) + (vector-! s5-2 s5-2 gp-5) + (let + ((f0-20 + (dummy-10 + *collide-cache* + s5-2 + gp-5 + 4300.8 + 1 + (the-as process #f) + s4-2 + 4098 + ) + ) + ) + (if (and (< 0.0 f0-20) (< f0-20 1.0)) + (vector+float*! + (-> self tpos-curr) + (-> self tpos-curr) + gp-5 + (+ -1.0 f0-20) + ) + ) + ) + ) + ) + (set! + (-> self on-ground) + (not + (and + (logtest? + (-> *target* control unknown-surface00 flags) + 2048 + ) + (zero? (logand (-> *target* control status) 1)) + ) + ) + ) + (let ((gp-6 (new-stack-vector0))) + 0.0 + (cond + ((and + (and + (logtest? + (-> *target* control unknown-surface00 flags) + 2048 + ) + (zero? (logand (-> *target* control status) 1)) + ) + (!= + (-> *target* control unknown-surface00 name) + 'launch-jump + ) + ) + (if *display-cam-los-debug* + (format *stdcon* "air tracking~%") + ) + (vector+float*! + (-> self tpos-curr-adj) + (-> self tpos-curr-adj) + (-> self local-down) + (-> self upspeed) + ) + (vector+float*! + (-> self tpos-tgt) + (-> self tpos-tgt) + (-> self local-down) + (-> self upspeed) + ) + (vector-! gp-6 (-> self tpos-curr) (-> self tpos-tgt)) + (let ((f30-0 (vector-dot gp-6 (-> self local-down)))) + (vector--float*! gp-6 gp-6 (-> self local-down) f30-0) + (if (< 0.0 f30-0) + (set! (-> self upspeed) (* 0.5 (-> self upspeed))) + ) + (vector+! (-> self tpos-tgt) (-> self tpos-tgt) gp-6) + (let ((f0-30 (* 0.05 f30-0))) + (vector+float*! + (-> self tpos-tgt) + (-> self tpos-tgt) + (-> self local-down) + f0-30 + ) + ) + ) + (vector-! gp-6 (-> self tpos-curr-adj) (-> self tpos-tgt)) + (let* ((f0-32 (vector-dot gp-6 (-> self local-down))) + (f0-33 (if (< 0.0 f0-32) + (* + f0-32 + (-> + *CAMERA_MASTER-bank* + up-move-to-pitch-ratio-in-air + ) + ) + (* + f0-32 + (-> + *CAMERA_MASTER-bank* + down-move-to-pitch-ratio-in-air + ) + ) + ) + ) + ) + (vector+float*! + (-> self tpos-curr-adj) + (-> self tpos-tgt) + (-> self local-down) + f0-33 + ) + ) + (vector-! + gp-6 + (-> *target* control shadow-pos) + (-> self tpos-curr-adj) + ) + (let* ((f0-35 (vector-dot gp-6 (-> self local-down))) + (f0-36 (* 0.03 f0-35)) + ) + (if (and (< f0-36 0.0) (< f0-36 (-> self upspeed))) + (set! (-> self upspeed) f0-36) + ) + ) + ) + (else + (if *display-cam-los-debug* + (format *stdcon* "ground tracking~%") + ) + (vector-! gp-6 (-> self tpos-curr) (-> self tpos-old)) + (let ((f0-38 (vector-dot gp-6 (-> self local-down)))) + (cond + ((logtest? (-> *target* water flags) 512) + (set! (-> self upspeed) 0.0) + ) + ((< 0.0 f0-38) + (set! (-> self upspeed) 0.0) + ) + (else + (set! (-> self upspeed) f0-38) + ) + ) + ) + (set! (-> self tpos-tgt quad) (-> self tpos-curr quad)) + (vector-! + gp-6 + (-> self tpos-curr-adj) + (-> self tpos-curr) + ) + (let* ((f0-42 (vector-dot gp-6 (-> self local-down))) + (f0-43 (if (< 0.0 f0-42) + (* + f0-42 + (-> + *CAMERA_MASTER-bank* + up-move-to-pitch-on-ground + ) + ) + (* + f0-42 + (-> + *CAMERA_MASTER-bank* + down-move-to-pitch-on-ground + ) + ) + ) + ) + ) + (vector+float*! + (-> self tpos-curr-adj) + (-> self tpos-curr) + (-> self local-down) + f0-43 + ) + ) + ) + ) + ) + (if (zero? (logand (-> self slave-options) 16)) + (reset-follow) + ) + (let ((v1-196 (-> *target* water flags))) + (when (and (logtest? v1-196 512) (logtest? v1-196 6144)) + (let + ((f0-45 + (- + (-> *target* water base-height) + (-> self target-height) + ) + ) + ) + (if (< (-> self tpos-curr-adj y) f0-45) + (set! (-> self tpos-curr-adj y) f0-45) + ) + ) + ) + ) + (vector+! + (-> self pitch-off) + (-> self pitch-off) + (-> self tpos-curr) + ) + (vector-! + (-> self pitch-off) + (-> self pitch-off) + (-> self tpos-old) + ) + (vector-float*! + (-> self pitch-off) + (-> self pitch-off) + (-> *CAMERA_MASTER-bank* pitch-off-blend) + ) + (let ((gp-7 (new 'stack-no-clear 'vector))) + (vector--float*! + gp-7 + (-> self tpos-curr-adj) + (-> self local-down) + (-> self target-height) + ) + (let ((v1-207 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! v1-207 (-> *target* control shadow-pos) gp-7) + (let* ((f0-50 (vector-dot v1-207 (-> self local-down))) + (f0-51 (+ -4096.0 f0-50)) + ) + (if (< f0-51 0.0) + (vector+float*! gp-7 gp-7 (-> self local-down) f0-51) + ) + ) + ) + (TODO-RENAME-17 (-> self target-spline) gp-7 2048.0 0.0 #f) + ) + (the-as + symbol + (TODO-RENAME-22 (-> self target-spline) 40960.0) + ) + ) + (*target* + (logior! (-> self master-options) 2) + (reset-target-tracking) + ) + ((logtest? (-> self master-options) 2) + (let + ((v0-1 (the-as symbol (logand -3 (-> self master-options)))) + ) + (set! (-> self master-options) (the-as uint v0-1)) + v0-1 + ) + ) + ) + ) + ) + +;; definition for function in-cam-entity-volume? +;; Used lq/sq +(defun + in-cam-entity-volume? + ((arg0 vector) (arg1 entity) (arg2 float) (arg3 symbol)) + (local-vars (sv-16 res-tag)) + (let ((s2-0 0)) + (while #t + (set! sv-16 (new 'static 'res-tag)) + (let + ((v1-1 + (the-as + object + ((method-of-type res-lump get-property-data) + arg1 + arg3 + 'exact + (the float s2-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (cond + ((not (the-as pointer v1-1)) + (return #f) + ) + (else + (dotimes (a0-2 (the-as int (-> sv-16 elt-count))) + (if + (< + arg2 + (- + (vector-dot arg0 (-> (the-as (inline-array vector) v1-1) a0-2)) + (-> (the-as (inline-array vector) v1-1) a0-2 w) + ) + ) + (goto cfg-12) + ) + ) + (return #t) + ) + ) + ) + (label cfg-12) + (+! s2-0 1) + ) + ) + (the-as symbol #f) + ) + +;; definition for function master-unset-region +(defbehavior master-unset-region camera-master () + (when (-> self cam-entity) + (set! (-> self cam-entity) #f) + (set! (-> self master-options) (logand -65 (-> self master-options))) + (set! (-> self stringMinHeight) (-> *CAMERA-bank* default-string-min-y)) + (set! (-> self stringMaxHeight) (-> *CAMERA-bank* default-string-max-y)) + (set! (-> self stringMinLength) (-> *CAMERA-bank* default-string-min-z)) + (set! (-> self stringMaxLength) (-> *CAMERA-bank* default-string-max-z)) + (set! (-> self stringCliffHeight) 163840.0) + (send-event *camera* 'point-of-interest #f) + (set! (-> *camera-combiner* tracking point-of-interest-blend target) 0.0) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query-state) + (set! (-> a1-1 param 0) (the-as uint *camera-base-mode*)) + (if (not (send-event-function *camera* a1-1)) + (send-event *camera* 'change-state *camera-base-mode* 450) + ) + ) + (set! + (-> *camera-combiner* tracking tilt-adjust target) + (-> *CAMERA-bank* default-tilt-adjust) + ) + (send-event *camera* 'clear-slave-option #x10000) + ) + ) + +;; definition for function master-base-region +(defbehavior master-base-region camera-master ((arg0 entity)) + (logior! (-> self master-options) 64) + (set! + (-> self stringMinHeight) + (cam-slave-get-float + arg0 + 'stringMinHeight + (-> *CAMERA-bank* default-string-min-y) + ) + ) + (set! + (-> self stringMaxHeight) + (cam-slave-get-float + arg0 + 'stringMaxHeight + (-> *CAMERA-bank* default-string-max-y) + ) + ) + (set! + (-> self stringMinLength) + (cam-slave-get-float + arg0 + 'stringMinLength + (-> *CAMERA-bank* default-string-min-z) + ) + ) + (set! + (-> self stringMaxLength) + (cam-slave-get-float + arg0 + 'stringMaxLength + (-> *CAMERA-bank* default-string-max-z) + ) + ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor arg0) + s5-0 + 'interesting + ) + (send-event *camera* 'point-of-interest s5-0) + ) + ) + (if (< 405504.0 (-> self stringMaxLength)) + (set! (-> self stringMaxLength) (-> *CAMERA-bank* default-string-max-z)) + ) + (set! + (-> self stringCliffHeight) + (cam-slave-get-float arg0 'stringCliffHeight 163840.0) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) self) + (set! (-> a1-7 num-params) 1) + (set! (-> a1-7 message) 'query-state) + (set! (-> a1-7 param 0) (the-as uint *camera-base-mode*)) + (if (not (send-event-function *camera* a1-7)) + (send-event *camera* 'change-state *camera-base-mode* 450) + ) + ) + (if (logtest? #x10000 (cam-slave-get-flags (-> self cam-entity) 'flags)) + (send-event *camera* 'set-slave-option #x10000) + ) + (let + ((f0-12 + (cam-slave-get-float + arg0 + 'tiltAdjust + (-> *CAMERA-bank* default-tilt-adjust) + ) + ) + ) + (set! (-> *camera-combiner* tracking tilt-adjust target) f0-12) + f0-12 + ) + ) + +;; definition for function setup-slave-for-hopefull +(defun setup-slave-for-hopefull ((arg0 camera-slave)) + (when (= (-> arg0 blend-to-type) 2) + (cam-calc-follow! (-> arg0 tracking) (-> arg0 trans) #f) + (slave-set-rotation! + (-> arg0 tracking) + (-> arg0 trans) + (the-as float (-> arg0 options)) + (-> arg0 fov) + #f + ) + ) + (none) + ) + +;; definition for function master-is-hopeful-better? +(defbehavior + master-is-hopeful-better? camera-master + ((arg0 camera-slave) (arg1 camera-slave)) + (if (not *camera-combiner*) + #f + (< + (vector-dot + (-> arg0 tracking inv-mat vector 2) + (-> *camera-combiner* inv-camera-rot vector 2) + ) + (vector-dot + (-> arg1 tracking inv-mat vector 2) + (-> *camera-combiner* inv-camera-rot vector 2) + ) + ) + ) + ) + +;; definition for function master-switch-to-entity +;; 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 master-switch-to-entity camera-master ((arg0 entity)) + (local-vars + (v0-21 none) + (gp-0 (pointer process)) + (sv-16 res-tag) + (sv-112 process) + (sv-128 string) + (sv-144 string) + ) + (set! (-> self cam-entity) arg0) + 10 + (let ((s4-0 (cam-state-from-entity arg0))) + (cond + ((= s4-0 *camera-base-mode*) + (master-base-region arg0) + (return #t) + ) + (s4-0 + (let ((s3-0 (get-process *camera-dead-pool* camera-slave #x4000))) + (set! gp-0 (when s3-0 + (let ((t9-3 (method-of-type camera-slave activate))) + (t9-3 + (the-as camera-slave s3-0) + self + 'camera-slave + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s3-0 cam-slave-init s4-0 arg0) + (-> s3-0 ppointer) + ) + ) + ) + (when (not gp-0) + (format 0 "ERROR : primary region activate failed~%") + (return #f) + ) + (setup-slave-for-hopefull (the-as camera-slave (ppointer->process gp-0))) + ) + (else + (format + 0 + "ERROR : camera region '~S' didn't produce a state~%" + (res-lump-struct arg0 'name structure) + ) + (return #f) + ) + ) + ) + (set! sv-16 (new 'static 'res-tag)) + (let + ((s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16)))) + (when s4-2 + (dotimes (s3-2 (the-as int (-> sv-16 elt-count))) + (let ((s2-0 (entity-by-name (-> s4-2 s3-2)))) + (set! v0-21 (cond + (s2-0 + (let ((s0-0 (cam-state-from-entity s2-0))) + (cond + ((= s0-0 *camera-base-mode*) + (deactivate (-> gp-0 0)) + (master-base-region s2-0) + (return #t) + v0-21 + ) + (s0-0 + (set! + sv-112 + (get-process *camera-dead-pool* camera-slave #x4000) + ) + (let ((s1-0 (when sv-112 + (let + ((t9-15 + (method-of-type camera-slave activate) + ) + ) + (t9-15 + (the-as camera-slave sv-112) + self + 'camera-slave + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + sv-112 + cam-slave-init + s0-0 + s2-0 + ) + (-> sv-112 ppointer) + ) + ) + ) + (cond + (s1-0 + (setup-slave-for-hopefull + (the-as camera-slave (ppointer->process s1-0)) + ) + (cond + ((master-is-hopeful-better? + (the-as camera-slave (ppointer->process gp-0)) + (the-as camera-slave (ppointer->process s1-0)) + ) + (deactivate (-> gp-0 0)) + (set! gp-0 s1-0) + gp-0 + ) + (else + (deactivate (-> s1-0 0)) + ) + ) + ) + (else + (format + 0 + "ERROR : alternate region activate failed~%" + ) + ) + ) + ) + ) + (else + (let ((s1-1 format) + (s0-1 0) + ) + (set! + sv-128 + "ERROR : alternate camera region '~S' didn't produce a state~%" + ) + (let ((a2-10 (res-lump-struct s2-0 'name structure))) + (s1-1 s0-1 sv-128 a2-10) + ) + ) + ) + ) + ) + ) + (else + (let ((s2-1 format) + (s1-2 0) + (s0-2 + "ERROR : alternate '~S' not found for '~S'~%" + ) + ) + (set! sv-144 (-> s4-2 s3-2)) + (let ((a3-8 (res-lump-struct arg0 'name structure))) + (s2-1 s1-2 s0-2 sv-144 a3-8) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (let + ((v1-48 + (the + int + (* + 300.0 + (cam-slave-get-interp-time + (-> (the-as camera-slave (-> gp-0 0)) cam-entity) + ) + ) + ) + ) + ) + (if (nonzero? (-> self force-blend)) + (set! v1-48 (min v1-48 (the-as int (-> self force-blend-time)))) + ) + (send-event *camera* 'change-state (ppointer->process gp-0) v1-48) + ) + #t + ) + +;; definition for function master-check-regions +(defbehavior master-check-regions camera-master () + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 1) + (set! (-> a1-0 message) 'query-state) + (set! (-> a1-0 param 0) (the-as uint cam-eye)) + (cond + ((send-event-function *camera* a1-0) + #f + ) + ((or (not *target*) (logtest? (-> self master-options) 1)) + (master-unset-region) + ) + ((and + (logtest? (-> self master-options) 4) + (not (-> self on-ground)) + (or + (not (-> self cam-entity)) + (zero? + (logand #x20000 (cam-slave-get-flags (-> self cam-entity) 'flags)) + ) + ) + ) + #f + ) + ((and + (-> self cam-entity) + (not + (in-cam-entity-volume? + (target-pos 0) + (-> self cam-entity) + 0.0 + 'cutoutvol + ) + ) + (or + (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'pvol) + (in-cam-entity-volume? (target-pos 0) (-> self cam-entity) 1024.0 'vol) + (and + (not + ((method-of-type res-lump get-property-data) + (-> self cam-entity) + 'pvol + 'exact + 0.0 + (the-as pointer #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (not + ((method-of-type res-lump get-property-data) + (-> self cam-entity) + 'vol + 'exact + 0.0 + (the-as pointer #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + ) + ) + #f + ) + (else + (let ((v1-17 (-> *camera-engine* alive-list next0))) + *camera-engine* + (let ((gp-5 (-> v1-17 next0))) + (while (!= v1-17 (-> *camera-engine* alive-list-end)) + (let ((s5-1 (-> (the-as connection v1-17) param1))) + (when + (and + (not + (in-cam-entity-volume? + (target-pos 0) + (the-as entity s5-1) + 1024.0 + 'cutoutvol + ) + ) + (in-cam-entity-volume? (target-pos 0) (the-as entity s5-1) 0.0 'vol) + ) + (if (master-switch-to-entity (the-as entity s5-1)) + (return #t) + ) + ) + ) + (set! v1-17 gp-5) + *camera-engine* + (set! gp-5 (-> gp-5 next0)) + ) + ) + ) + (master-unset-region) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate cam-master-active (camera-master) + :enter + (behavior () + (if (and (nonzero? camera-master-debug) *debug-segment*) + (add-connection *debug-engine* self camera-master-debug self #f #f) + ) + (none) + ) + :trans + (behavior () + (when (not (paused?)) + (vector-negate! + (-> self local-down) + (vector-normalize-copy! + (-> self local-down) + (-> *standard-dynamics* gravity) + 1.0 + ) + ) + (cam-master-effect) + ) + (none) + ) + :code + (behavior () + (while #t + (if (and *dproc* *debug-segment*) + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'camera + (new 'static 'rgba :r #x40 :b #x40 :a #x80) + ) + ) + (set! (-> self string-min target y) (-> self stringMinHeight)) + (set! (-> self string-max target y) (-> self stringMaxHeight)) + (set! (-> self string-min target z) (-> self stringMinLength)) + (set! (-> self string-max target z) (-> self stringMaxLength)) + (set! + (-> self string-push-z) + (fmax + (-> self string-min value z) + (-> *CAMERA-bank* default-string-push-z) + ) + ) + (master-track-target) + (set! (-> last-try-to-look-at-data horz) 0.0) + (set! (-> last-try-to-look-at-data vert) 0.0) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'slave-option?) + (set! (-> a1-1 param 0) (the-as uint #x4000)) + (when (send-event-function *camera* a1-1) + (set! (-> self string-min target y) 18432.0) + (set! (-> self string-max target y) 18432.041) + ) + ) + (when (not (paused?)) + (update! (-> self string-min) (the-as vector #f)) + (update! (-> self string-max) (the-as vector #f)) + (master-check-regions) + ) + (set! + (-> self string-min value x) + (fmin (-> self string-min value x) (+ -4.096 (-> self string-max value x))) + ) + (set! + (-> self string-min value y) + (fmin (-> self string-min value y) (+ -4.096 (-> self string-max value y))) + ) + (set! + (-> self string-min value z) + (fmin (-> self string-min value z) (+ -4.096 (-> self string-max value z))) + ) + (if (nonzero? (-> self no-intro)) + (+! (-> self no-intro) -1) + ) + (if (nonzero? (-> self force-blend)) + (+! (-> self force-blend) -1) + ) + (suspend) + ) + (none) + ) + ) + +;; definition of type list-keeper +(deftype list-keeper (process) + ((dummy float :offset-assert 112) + ) + :heap-base #x10 + :method-count-assert 14 + :size-assert #x74 + :flag-assert #xe00100074 + ) + +;; definition for method 3 of type list-keeper +(defmethod inspect list-keeper ((obj list-keeper)) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~T~Tdummy: ~f~%" (-> obj dummy)) + obj + ) + +;; failed to figure out what this is: +(defstate list-keeper-active (camera-master) + :code + (behavior () + (while #t + (change-to-last-brother self) + (suspend) + ) + (none) + ) + ) + +;; definition for function list-keeper-init +;; INFO: Return type mismatch int vs none. +(defbehavior list-keeper-init camera-master () + (go list-keeper-active) + 0 + (none) + ) + +;; definition for function cam-master-init +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defbehavior cam-master-init camera-master () + (set! *camera* self) + (stack-size-set! (-> self main-thread) 512) + (logclear! (-> self mask) (process-mask menu)) + (set! (-> self master-options) (the-as uint 4)) + (set! (-> self num-slaves) 0) + (dotimes (v1-5 2) + (set! (-> self slave v1-5) (the-as (pointer camera-slave) #f)) + ) + (set! (-> self slave-options) (the-as uint 560)) + (set! (-> self view-off-param-save) 1.0) + (set! (-> self changer) (the-as uint (process->ppointer self))) + (set! (-> self cam-entity) #f) + (set! (-> self stringMinHeight) (-> *CAMERA-bank* default-string-min-y)) + (set! (-> self stringMaxHeight) (-> *CAMERA-bank* default-string-max-y)) + (set! (-> self stringMinLength) (-> *CAMERA-bank* default-string-min-z)) + (set! (-> self stringMaxLength) (-> *CAMERA-bank* default-string-max-z)) + (set! (-> self stringCliffHeight) 163840.0) + (set! (-> self no-intro) (the-as uint 0)) + (set! (-> self force-blend) (the-as uint 0)) + (set! (-> self string-push-z) (-> *CAMERA-bank* default-string-push-z)) + (let ((gp-0 (new-stack-vector0))) + (set! (-> gp-0 y) (-> *CAMERA-bank* default-string-min-y)) + (set! (-> gp-0 z) (-> *CAMERA-bank* default-string-min-z)) + (init! (-> self string-min) gp-0 40.96 409.6 0.9) + (set! (-> gp-0 y) (-> *CAMERA-bank* default-string-max-y)) + (set! (-> gp-0 z) (-> *CAMERA-bank* default-string-max-z)) + (init! (-> self string-max) gp-0 40.96 409.6 0.9) + ) + (set! (-> self outro-t-step) 0.0) + (set! (-> self drawable-target) (the-as handle #f)) + (set! (-> self which-bone) 0) + (let ((a1-3 (new-stack-vector0))) + (TODO-RENAME-10 (-> self target-spline) a1-3) + ) + (set! (-> self pov-handle) (the-as handle #f)) + (set! (-> self pov-bone) 0) + (let ((gp-1 (get-process *camera-dead-pool* list-keeper #x4000))) + (cond + ((when gp-1 + (let ((t9-5 (method-of-type list-keeper activate))) + (t9-5 + (the-as list-keeper gp-1) + self + 'list-keeper + (the-as pointer #x70004000) + ) + ) + (run-next-time-in-process gp-1 list-keeper-init) + (-> gp-1 ppointer) + ) + ) + (else + (format 0 "ERROR : master camera list keeper failed to activate~%") + ) + ) + ) + (let ((gp-2 (get-process *camera-dead-pool* camera-slave #x4000))) + (cond + ((when gp-2 + (let ((t9-9 (method-of-type camera-slave activate))) + (t9-9 + (the-as camera-slave gp-2) + self + 'camera-slave + (the-as pointer #x70004000) + ) + ) + (run-next-time-in-process gp-2 cam-slave-init cam-free-floating #f) + (-> gp-2 ppointer) + ) + ) + (else + (format 0 "ERROR : first slave failed to activate~%") + ) + ) + ) + (set! + (-> self water-drip) + (create-launch-control group-rain-screend-drop self) + ) + (set! (-> self water-drip-time) (the-as uint -18000)) + (go cam-master-active) + 0 + (none) + ) diff --git a/test/decompiler/reference/engine/camera/cam-start_REF.gc b/test/decompiler/reference/engine/camera/cam-start_REF.gc index 7b9f197e56..113dcaee70 100644 --- a/test/decompiler/reference/engine/camera/cam-start_REF.gc +++ b/test/decompiler/reference/engine/camera/cam-start_REF.gc @@ -2,6 +2,7 @@ (in-package goal) ;; definition for function cam-stop +;; INFO: Return type mismatch (state camera-slave) vs state. (defun cam-stop () (kill-by-name 'camera-master *active-pool*) (kill-by-name 'camera-slave *active-pool*) @@ -10,7 +11,7 @@ (set! *camera-combiner* #f) (let ((v0-3 cam-string)) (set! *camera-base-mode* v0-3) - v0-3 + (the-as state v0-3) ) ) @@ -74,7 +75,3 @@ ;; failed to figure out what this is: (cam-start #f) - - - - diff --git a/test/decompiler/reference/engine/camera/cam-states-dbg_REF.gc b/test/decompiler/reference/engine/camera/cam-states-dbg_REF.gc new file mode 100644 index 0000000000..812a39dea5 --- /dev/null +++ b/test/decompiler/reference/engine/camera/cam-states-dbg_REF.gc @@ -0,0 +1,966 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type cam-point-watch-bank +(deftype cam-point-watch-bank (basic) + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type cam-point-watch-bank +(defmethod inspect cam-point-watch-bank ((obj cam-point-watch-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tspeed: ~f~%" (-> obj speed)) + (format #t "~Trot-speed: (deg ~r)~%" (-> obj rot-speed)) + obj + ) + +;; definition for symbol *CAM_POINT_WATCH-bank*, type cam-point-watch-bank +(define + *CAM_POINT_WATCH-bank* + (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6)) + ) + +;; failed to figure out what this is: +(defstate cam-point-watch (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self pivot-rad) 40960.0) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + ) + (none) + ) + :code + (behavior () + (while #t + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (when *camera-read-analog* + (let + ((f28-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 leftx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f30-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 lefty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f26-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f0-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + ) + (cond + ((logtest? + (-> *cpad-list* cpads (-> *CAMERA-bank* joypad) button0-abs 0) + (pad-buttons r2) + ) + (set! + (-> s5-0 y) + (- + (-> s5-0 y) + (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)) + ) + ) + (set! + (-> s5-0 x) + (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))) + ) + (+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) + ) + (else + (set! + (-> s5-0 y) + (- + (-> s5-0 y) + (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)) + ) + ) + (set! + (-> s5-0 x) + (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))) + ) + (+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) + (+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) + ) + ) + ) + (let ((s4-0 (new-stack-vector0))) + (let ((s3-0 (new-stack-matrix0))) + (matrix-axis-angle! + s3-0 + (the-as vector (-> self tracking)) + (- (-> s5-0 x)) + ) + (vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0) + (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) + (vector-matrix*! s4-0 s4-0 s3-0) + ) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + s4-0 + (-> *camera* local-down) + ) + ) + (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) + (if (< (-> self pivot-rad) 4096.0) + (set! (-> self pivot-rad) 4096.0) + ) + (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) + (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))) + ) + ) + (suspend) + 0 + ) + (none) + ) + ) + +;; definition of type cam-free-bank +(deftype cam-free-bank (basic) + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type cam-free-bank +(defmethod inspect cam-free-bank ((obj cam-free-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tspeed: ~f~%" (-> obj speed)) + (format #t "~Trot-speed: (deg ~r)~%" (-> obj rot-speed)) + obj + ) + +;; definition for symbol *CAM_FREE-bank*, type cam-free-bank +(define + *CAM_FREE-bank* + (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6)) + ) + +;; definition for function cam-free-floating-input +(defun + cam-free-floating-input + ((arg0 vector) (arg1 vector) (arg2 symbol) (arg3 int)) + (when (and (!= *master-mode* 'menu) (not *cam-layout*)) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons x)) + (set! + (-> arg0 x) + (- + (-> arg0 x) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 6)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if + (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons triangle)) + (+! + (-> arg0 x) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 4)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if + (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons square)) + (+! + (-> arg0 y) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 7)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if + (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons circle)) + (set! + (-> arg0 y) + (- + (-> arg0 y) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 5)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + ) + (when arg2 + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2)) + (+! + (-> arg0 z) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 10)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2)) + (set! + (-> arg0 z) + (- + (-> arg0 z) + (+ + (-> *CAM_FREE-bank* rot-speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 11)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* rot-speed) + ) + ) + ) + ) + ) + ) + ) + (cond + ((not *cam-free-move-along-z*) + ) + ((not *camera-read-analog*) + ) + ((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2)) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r1)) + (+! + (-> arg1 y) + (+ + (* 0.2 (-> *CAM_FREE-bank* speed)) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 9)) + 0.0 + 32.0 + 230.0 + (* 0.2 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l1)) + (set! + (-> arg1 y) + (- + (-> arg1 y) + (+ + (* 0.2 (-> *CAM_FREE-bank* speed)) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 8)) + 0.0 + 32.0 + 230.0 + (* 0.2 (-> *CAM_FREE-bank* speed)) + ) + ) + ) + ) + ) + ) + ) + (else + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r1)) + (+! + (-> arg1 y) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 9)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l1)) + (set! + (-> arg1 y) + (- + (-> arg1 y) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 8)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + ) + ) + ) + (when (and (!= *master-mode* 'menu) (not *cam-layout*)) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons left)) + (+! + (-> arg1 x) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 1)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons right)) + (set! + (-> arg1 x) + (- + (-> arg1 x) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 0)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons up)) + (+! + (-> arg1 z) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 2)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + (when *camera-read-buttons* + (if (logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons down)) + (set! + (-> arg1 z) + (- + (-> arg1 z) + (+ + (-> *CAM_FREE-bank* speed) + (analog-input + (the-as int (-> *cpad-list* cpads arg3 abutton 3)) + 0.0 + 32.0 + 230.0 + (-> *CAM_FREE-bank* speed) + ) + ) + ) + ) + ) + ) + ) + (when *camera-read-analog* + (let + ((f28-14 + (analog-input + (the-as int (-> *cpad-list* cpads arg3 leftx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f30-14 + (analog-input + (the-as int (-> *cpad-list* cpads arg3 lefty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f24-0 + (analog-input + (the-as int (-> *cpad-list* cpads arg3 rightx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (f26-0 + (analog-input + (the-as int (-> *cpad-list* cpads arg3 righty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + ) + (when *display-load-boundaries* + (when + (and + (!= arg3 1) + (zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x))) + (zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r1))) + (zero? (logand (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2))) + ) + (+! + f28-14 + (analog-input + (the-as int (-> *cpad-list* cpads 1 leftx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (+! + f30-14 + (analog-input + (the-as int (-> *cpad-list* cpads 1 lefty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (+! + f24-0 + (analog-input + (the-as int (-> *cpad-list* cpads 1 rightx)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + (+! + f26-0 + (analog-input + (the-as int (-> *cpad-list* cpads 1 righty)) + 128.0 + 48.0 + 110.0 + -1.0 + ) + ) + ) + ) + (cond + ((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons r2)) + (cond + ((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2)) + (set! + (-> arg0 y) + (- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f24-0))) + ) + (set! + (-> arg0 x) + (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0))) + ) + ) + (else + (set! + (-> arg0 y) + (- (-> arg0 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed))) + ) + (set! + (-> arg0 x) + (- (-> arg0 x) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed))) + ) + ) + ) + (+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14)) + ) + ((logtest? (-> *cpad-list* cpads arg3 button0-abs 0) (pad-buttons l2)) + (+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed))) + (+! (-> arg1 y) (* f26-0 (-> *CAM_FREE-bank* speed))) + (+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed))) + ) + (else + (set! + (-> arg0 y) + (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0))) + ) + (set! + (-> arg0 x) + (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0))) + ) + (+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14)) + (+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14)) + ) + ) + ) + ) + (vector-float*! arg0 arg0 (-> *display* time-adjust-ratio)) + (vector-float*! arg1 arg1 (-> *display* time-adjust-ratio)) + ) + +;; definition of type camera-free-floating-move-info +(deftype camera-free-floating-move-info (structure) + ((rv vector :inline :offset-assert 0) + (tv vector :inline :offset-assert 16) + (up vector :inline :offset-assert 32) + (tm matrix :inline :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) + +;; definition for method 3 of type camera-free-floating-move-info +(defmethod + inspect + camera-free-floating-move-info + ((obj camera-free-floating-move-info)) + (format #t "[~8x] ~A~%" obj 'camera-free-floating-move-info) + (format #t "~Trv: #~%" (-> obj rv)) + (format #t "~Ttv: #~%" (-> obj tv)) + (format #t "~Tup: #~%" (-> obj up)) + (format #t "~Ttm: #~%" (-> obj tm)) + obj + ) + +;; definition for function cam-free-floating-move +(defun + cam-free-floating-move + ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int)) + (if (logtest? (-> *cpad-list* cpads arg3 valid) 128) + (return (the-as vector #f)) + ) + (if (= *master-mode* 'menu) + (return (the-as vector #f)) + ) + (let ((s3-0 (new 'stack 'camera-free-floating-move-info))) + (cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3) + (cond + (arg2 + (matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y)) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (cond + ((< (vector-dot (-> arg0 vector 1) arg2) 0.0) + (forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2) + ) + (else + (vector-negate! (-> s3-0 up) arg2) + (forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up)) + ) + ) + ) + (else + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + ) + ) + (matrix-axis-angle! + (-> s3-0 tm) + (the-as vector (-> arg0 vector)) + (- (-> s3-0 rv x)) + ) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z))) + (matrix*! arg0 arg0 (-> s3-0 tm)) + (vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0) + (vector+! arg1 arg1 (-> s3-0 tv)) + ) + ) + +;; failed to figure out what this is: +(defstate cam-free-floating (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + (send-event *camera-combiner* 'stop-tracking) + ) + (none) + ) + :code + (behavior () + (while #t + (let ((a2-0 (-> *camera* local-down))) + (if (logtest? (-> self options) 8) + (set! a2-0 (the-as vector #f)) + ) + (cam-free-floating-move + (the-as matrix (-> self tracking)) + (-> self trans) + a2-0 + (the-as int (-> *CAMERA-bank* joypad)) + ) + ) + (suspend) + ) + (none) + ) + ) + +;; definition of type camera-orbit-info +(deftype camera-orbit-info (structure) + ((radius float :offset-assert 0) + (rot float :offset-assert 4) + (target-off vector :inline :offset-assert 16) + (orbit-off vector :inline :offset-assert 32) + (radius-lerp float :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + +;; definition for method 3 of type camera-orbit-info +(defmethod inspect camera-orbit-info ((obj camera-orbit-info)) + (format #t "[~8x] ~A~%" obj 'camera-orbit-info) + (format #t "~Tradius: ~f~%" (-> obj radius)) + (format #t "~Trot: ~f~%" (-> obj rot)) + (format #t "~Ttarget-off: #~%" (-> obj target-off)) + (format #t "~Torbit-off: #~%" (-> obj orbit-off)) + (format #t "~Tradius-lerp: ~f~%" (-> obj radius-lerp)) + obj + ) + +;; definition of type CAM_ORBIT-bank +(deftype CAM_ORBIT-bank (basic) + ((RADIUS_MAX float :offset-assert 4) + (RADIUS_MIN float :offset-assert 8) + (TARGET_OFF_ADJUST float :offset-assert 12) + (ORBIT_OFF_ADJUST float :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type CAM_ORBIT-bank +(defmethod inspect CAM_ORBIT-bank ((obj CAM_ORBIT-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~TRADIUS_MAX: ~f~%" (-> obj RADIUS_MAX)) + (format #t "~TRADIUS_MIN: ~f~%" (-> obj RADIUS_MIN)) + (format #t "~TTARGET_OFF_ADJUST: ~f~%" (-> obj TARGET_OFF_ADJUST)) + (format #t "~TORBIT_OFF_ADJUST: ~f~%" (-> obj ORBIT_OFF_ADJUST)) + obj + ) + +;; definition for symbol *CAM_ORBIT-bank*, type CAM_ORBIT-bank +(define + *CAM_ORBIT-bank* + (new 'static 'CAM_ORBIT-bank + :RADIUS_MAX 61440.0 + :RADIUS_MIN 409.6 + :TARGET_OFF_ADJUST 81.92 + :ORBIT_OFF_ADJUST 81.92 + ) + ) + +;; definition for symbol *camera-orbit-info*, type camera-orbit-info +(define *camera-orbit-info* (new 'static 'camera-orbit-info)) + +;; failed to figure out what this is: +(set! (-> *camera-orbit-info* radius-lerp) 0.45) + +;; failed to figure out what this is: +(set! (-> *camera-orbit-info* target-off y) 4096.0) + +;; failed to figure out what this is: +(set! (-> *camera-orbit-info* orbit-off y) 4096.0) + +;; failed to figure out what this is: +(defstate cam-orbit (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (if (not *camera-orbit-target*) + (cam-slave-go cam-free-floating) + ) + (let ((v1-4 (new-stack-vector0))) + (vector-! v1-4 (-> self trans) (-> *camera-orbit-target* 0 root trans)) + (set! (-> *camera-orbit-info* rot) (atan (-> v1-4 x) (-> v1-4 z))) + ) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + ) + (none) + ) + :exit + (behavior () + '() + (none) + ) + :code + (behavior () + (while #t + (if (not *camera-orbit-target*) + (cam-slave-go cam-free-floating) + ) + (when *camera-read-analog* + (let + ((f0-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + 128.0 + 32.0 + 110.0 + 0.05 + ) + ) + ) + (cond + ((< (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) f0-0) + (+! + (-> *camera-orbit-info* radius-lerp) + (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) + ) + ) + ((< f0-0 (* 0.05 (- (-> *camera-orbit-info* radius-lerp)))) + (+! + (-> *camera-orbit-info* radius-lerp) + (* 0.05 (- (-> *camera-orbit-info* radius-lerp))) + ) + ) + (else + (+! (-> *camera-orbit-info* radius-lerp) f0-0) + ) + ) + ) + (set! + (-> *camera-orbit-info* radius) + (lerp + (-> *CAM_ORBIT-bank* RADIUS_MIN) + (-> *CAM_ORBIT-bank* RADIUS_MAX) + (-> *camera-orbit-info* radius-lerp) + ) + ) + ) + (cond + ((logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2)) + (if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1)) + (set! + (-> *camera-orbit-info* target-off y) + (- + (-> *camera-orbit-info* target-off y) + (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST) + ) + ) + ) + (if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) + (+! + (-> *camera-orbit-info* target-off y) + (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST) + ) + ) + ) + (else + (if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1)) + (set! + (-> *camera-orbit-info* orbit-off y) + (- + (-> *camera-orbit-info* orbit-off y) + (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST) + ) + ) + ) + (if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) + (+! + (-> *camera-orbit-info* orbit-off y) + (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST) + ) + ) + ) + ) + (when *camera-read-analog* + (let + ((f0-20 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + 128.0 + 32.0 + 110.0 + (* 21845.334 (-> *display* seconds-per-frame)) + ) + ) + ) + (set! + (-> *camera-orbit-info* rot) + (the + float + (sar (shl (the int (+ (-> *camera-orbit-info* rot) f0-20)) 48) 48) + ) + ) + ) + ) + (let ((gp-0 (new-stack-vector0))) + (let ((s5-0 (new-stack-vector0))) + (set-vector! + (-> self trans) + (+ + (-> *camera-orbit-target* 0 root trans x) + (* (sin (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius)) + ) + (-> *camera-orbit-target* 0 root trans y) + (+ + (-> *camera-orbit-target* 0 root trans z) + (* (cos (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius)) + ) + 1.0 + ) + (vector+! + (-> self trans) + (-> self trans) + (-> *camera-orbit-info* orbit-off) + ) + (vector+! + (-> self tracking follow-pt) + (-> *camera-orbit-target* 0 root trans) + (-> *camera-orbit-info* target-off) + ) + (vector-! s5-0 (-> self trans) (-> self tracking follow-pt)) + (set! + (-> gp-0 y) + (the + float + (sar (shl (the int (+ 32768.0 (atan (-> s5-0 x) (-> s5-0 z)))) 48) 48) + ) + ) + (set! (-> gp-0 x) (atan (-> s5-0 y) (vector-xz-length s5-0))) + ) + (set! (-> gp-0 z) 0.0) + (matrix-rotate-zxy! (the-as matrix (-> self tracking)) gp-0) + ) + (suspend) + ) + (none) + ) + ) diff --git a/test/decompiler/reference/engine/camera/cam-states_REF.gc b/test/decompiler/reference/engine/camera/cam-states_REF.gc new file mode 100644 index 0000000000..e416ae7f9f --- /dev/null +++ b/test/decompiler/reference/engine/camera/cam-states_REF.gc @@ -0,0 +1,4641 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate cam-fixed (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f) + (when (!= (-> gp-0 w) 0.0) + (vector-normalize! gp-0 (the-as float 1.0)) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + gp-0 + (-> *camera* local-down) + ) + ) + ) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-fixed-read-entity (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + (-> self trans) + 'trans + ) + (cam-slave-get-rot + (the-as entity-actor (-> self cam-entity)) + (the-as matrix (-> self tracking)) + ) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (cam-curve-setup (-> self trans)) + ((-> cam-fixed enter)) + ) + (else + (format #t "ERROR : cam-fixed-read-entity enter without entity~%") + ) + ) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-0) + ) + ) + (go cam-fixed) + (none) + ) + :code + (behavior () + (while #t + (format *stdcon* "ERROR : stayed in cam-fixed-read-entity~%") + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-pov (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + ) + (none) + ) + :trans + (behavior () + (when (not (handle->process (-> *camera* pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (vector<-cspace! + (-> self trans) + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + ) + ) + (let* ((v1-5 (-> self tracking)) + (a3-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + bone + transform + ) + ) + (a0-8 (-> a3-0 vector 0 quad)) + (a1-9 (-> a3-0 vector 1 quad)) + (a2-0 (-> a3-0 vector 2 quad)) + (a3-1 (-> a3-0 vector 3 quad)) + ) + (set! (-> v1-5 inv-mat vector 0 quad) a0-8) + (set! (-> v1-5 inv-mat vector 1 quad) a1-9) + (set! (-> v1-5 inv-mat vector 2 quad) a2-0) + (set! (-> v1-5 inv-mat vector 3 quad) a3-1) + ) + (vector-reset! (-> self tracking inv-mat vector 3)) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-pov180 (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 1)) + (set! (-> self blend-to-type) (the-as uint 1)) + ) + (none) + ) + :trans + (behavior () + (when (not (handle->process (-> *camera* pov-handle))) + (set! (-> self blend-from-type) (the-as uint 0)) + (cam-slave-go cam-fixed) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 #t) + ) + (vector<-cspace! + gp-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + ) + ) + (let + ((v1-11 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + bone + transform + ) + ) + ) + (vector-normalize-copy! s5-0 (-> v1-11 vector 2) (the-as float 1.0)) + ) + (while #t + (when (not (paused?)) + (let + ((s0-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + bone + transform + ) + ) + (s1-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + bone + scale + ) + ) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector<-cspace! + s2-0 + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + ) + ) + (vector-normalize-copy! s3-0 (-> s0-0 vector 2) (the-as float 1.0)) + (set! s4-0 (cond + ((and + (< (vector-vector-distance s2-0 gp-0) 40960.0) + (< (cos (the-as float 3640.889)) (vector-dot s5-0 s3-0)) + ) + (set! (-> self trans quad) (-> s2-0 quad)) + (vector-negate! + (the-as vector (-> self tracking)) + (the-as vector (-> s0-0 vector)) + ) + (set! + (-> self tracking inv-mat vector 1 quad) + (-> s0-0 vector 1 quad) + ) + (vector-negate! + (-> self tracking inv-mat vector 2) + (-> s0-0 vector 2) + ) + (set! + (-> self fov) + (* + 2.0 + (atan + (/ 12.700255 (* 20.3 (-> s1-0 x))) + (the-as float 1.0) + ) + ) + ) + (vector-float*! + (the-as vector (-> self tracking)) + (the-as vector (-> self tracking)) + (/ 1.0 (-> s1-0 x)) + ) + (vector-reset! (-> self tracking inv-mat vector 3)) + (if s4-0 + (set! s4-0 #f) + ) + s4-0 + ) + (else + #t + ) + ) + ) + (set! (-> gp-0 quad) (-> s2-0 quad)) + ) + (set! (-> s5-0 quad) (-> s3-0 quad)) + ) + ) + (suspend) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-pov-track (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-0) + ) + ) + (none) + ) + :trans + (behavior () + (if + (or + (not (handle->process (-> *camera* pov-handle))) + (zero? (logand (-> *camera* master-options) 2)) + ) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (if (not (paused?)) + (vector<-cspace! + (-> self trans) + (-> + (the-as pov-camera (-> *camera* pov-handle process 0)) + node-list + data + (-> *camera* pov-bone) + ) + ) + ) + (suspend) + ) + (none) + ) + ) + +;; definition for function cam-standoff-calc-trans +(defbehavior cam-standoff-calc-trans camera-slave () + (if (-> self tracking no-follow) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (vector+! (-> self trans) (-> self tracking follow-pt) (-> self pivot-pt)) + ) + ) + +;; failed to figure out what this is: +(defstate cam-standoff (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('set-standoff-dist) + (vector-normalize! (-> self pivot-pt) (the-as float (-> arg3 param 0))) + (cam-standoff-calc-trans) + ) + (('set-standoff-height) + (vector-flatten! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + ) + (vector--float*! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + (the-as float (-> arg3 param 0)) + ) + (cam-standoff-calc-trans) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (vector-! (-> self pivot-pt) (-> self trans) (-> *camera* tpos-curr-adj)) + (cond + ((logtest? (-> self options) #x8000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (else + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + ) + ) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (cam-standoff-calc-trans) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-standoff-read-entity (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + ) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'trans + ) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + s5-0 + 'align + ) + (vector-! (-> self pivot-pt) gp-0 s5-0) + ) + (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! + (-> self options) + (cam-slave-get-flags (-> self cam-entity) 'flags) + ) + (if (logtest? (-> self options) #x8000) + (cam-slave-get-rot + (the-as entity-actor (-> self cam-entity)) + (the-as matrix (-> self tracking)) + ) + (set! + (-> self tracking tilt-adjust target) + (cam-slave-get-float + (-> self cam-entity) + 'tiltAdjust + (-> *CAMERA-bank* default-tilt-adjust) + ) + ) + ) + ((-> cam-standoff enter)) + ) + (else + (format #t "ERROR : cam-standoff-read-entity enter without entity~%") + ) + ) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-2 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-2) + ) + ) + (go cam-standoff) + (none) + ) + :code + (behavior () + (while #t + (format *stdcon* "ERROR : stayed in cam-standoff-read-entity~%") + (suspend) + ) + (none) + ) + ) + +;; definition of type cam-eye-bank +(deftype cam-eye-bank (basic) + ((rot-speed float :offset-assert 4) + (max-degrees float :offset-assert 8) + (max-fov float :offset-assert 12) + (min-fov float :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type cam-eye-bank +(defmethod inspect cam-eye-bank ((obj cam-eye-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Trot-speed: ~f~%" (-> obj rot-speed)) + (format #t "~Tmax-degrees: ~f~%" (-> obj max-degrees)) + (format #t "~Tmax-fov: ~f~%" (-> obj max-fov)) + (format #t "~Tmin-fov: ~f~%" (-> obj min-fov)) + obj + ) + +;; definition for symbol *CAM_EYE-bank*, type cam-eye-bank +(define + *CAM_EYE-bank* + (new 'static 'cam-eye-bank + :rot-speed 364.0889 + :max-degrees 12743.111 + :max-fov 11650.845 + :min-fov 6189.511 + ) + ) + +;; failed to figure out what this is: +(defstate cam-eye (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (let + ((v1-3 + (vector-float*! + (new-stack-vector0) + (-> *camera* local-down) + (+ 1024.0 (-> *camera* target-height)) + ) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-3) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (set! (-> self fov) 11650.845) + (none) + ) + :exit + (behavior () + (if + (and + *target* + (logtest? (-> *camera* master-options) 2) + (logtest? (-> *target* state-flags) 512) + ) + (send-event *target* 'end-mode) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 (-> *display* base-frame-counter))) + (while #t + (when (not (paused?)) + (let ((s4-0 (vector-reset! (new-stack-vector0))) + (s5-0 (new-stack-matrix0)) + ) + (when *camera-read-analog* + (let + ((f30-0 + (analog-input + (the-as + int + (+ + (-> *cpad-list* cpads 0 rightx) + -256 + (-> *cpad-list* cpads 0 leftx) + ) + ) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0) + ) + ) + (f0-0 + (analog-input + (the-as + int + (+ + (-> *cpad-list* cpads 0 righty) + -256 + (-> *cpad-list* cpads 0 lefty) + ) + ) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0) + ) + ) + ) + (set! + (-> s4-0 y) + (- (-> s4-0 y) (* (- f30-0) (-> *CAM_EYE-bank* rot-speed))) + ) + (set! + (-> s4-0 x) + (- (-> s4-0 x) (* (- f0-0) (-> *CAM_EYE-bank* rot-speed))) + ) + ) + ) + (cond + ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 x)) + (set! (-> s4-0 x) (-> *CAM_EYE-bank* rot-speed)) + ) + ((< (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + (set! (-> s4-0 x) (- (-> *CAM_EYE-bank* rot-speed))) + ) + ) + (cond + ((< (-> *CAM_EYE-bank* rot-speed) (-> s4-0 y)) + (set! (-> s4-0 y) (-> *CAM_EYE-bank* rot-speed)) + ) + ((< (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + (set! (-> s4-0 y) (- (-> *CAM_EYE-bank* rot-speed))) + ) + ) + (cond + ((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) + (set! gp-0 (-> *display* base-frame-counter)) + ) + (else + (let + ((v1-44 (min 10 (max 1 (- (-> *display* base-frame-counter) gp-0))))) + (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-44))) + ) + ) + ) + (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) + (matrix*! + (the-as matrix (-> self tracking)) + (the-as matrix (-> self tracking)) + s5-0 + ) + (when (zero? (logand (-> self options) 8)) + (if + (< + (vector-dot + (-> self tracking inv-mat vector 1) + (-> *camera* local-down) + ) + 0.0 + ) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (forward-down->inv-matrix + (the-as matrix (-> self tracking)) + (-> self tracking inv-mat vector 2) + (vector-negate! (new-stack-vector0) (-> *camera* local-down)) + ) + ) + ) + (matrix-axis-angle! + s5-0 + (the-as vector (-> self tracking)) + (- (-> s4-0 x)) + ) + (matrix*! + (the-as matrix (-> self tracking)) + (the-as matrix (-> self tracking)) + s5-0 + ) + ) + (when (zero? (logand (-> self options) 8)) + (let + ((f30-1 + (vector-dot + (-> *camera* local-down) + (-> self tracking inv-mat vector 2) + ) + ) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (when (< (sin (-> *CAM_EYE-bank* max-degrees)) (fabs f30-1)) + (vector--float*! + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + f30-1 + ) + (vector-normalize! + (-> self tracking inv-mat vector 2) + (cos (-> *CAM_EYE-bank* max-degrees)) + ) + (if (< f30-1 0.0) + (vector--float*! + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + (sin (-> *CAM_EYE-bank* max-degrees)) + ) + (vector+float*! + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + (sin (-> *CAM_EYE-bank* max-degrees)) + ) + ) + (vector-cross! + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)) + ) + (set! (-> self tracking inv-mat vector 1 w) 0.0) + ) + ) + ) + ) + (let + ((v1-76 + (vector-float*! + (new-stack-vector0) + (-> *camera* local-down) + (+ 1024.0 (-> *camera* target-height)) + ) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-76) + ) + (suspend) + ) + ) + (none) + ) + ) + +;; definition of type cam-billy-bank +(deftype cam-billy-bank (basic) + ((rot-speed float :offset-assert 4) + (tilt-degrees float :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type cam-billy-bank +(defmethod inspect cam-billy-bank ((obj cam-billy-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Trot-speed: ~f~%" (-> obj rot-speed)) + (format #t "~Ttilt-degrees: ~f~%" (-> obj tilt-degrees)) + obj + ) + +;; definition for symbol *CAM_BILLY-bank*, type cam-billy-bank +(define + *CAM_BILLY-bank* + (new 'static 'cam-billy-bank :rot-speed 364.0889 :tilt-degrees -1820.4445) + ) + +;; failed to figure out what this is: +(defstate cam-billy (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (let + ((v1-3 + (vector-float*! + (new-stack-vector0) + (-> *camera* local-down) + (-> *camera* target-height) + ) + ) + ) + (vector-! (-> self trans) (-> *camera* tpos-curr) v1-3) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (set! (-> self fov) 9830.4) + (matrix-rotate-y! (the-as matrix (-> self tracking)) (the-as float -32768.0)) + (none) + ) + :exit + (behavior () + '() + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (let ((s5-0 (vector-reset! (new-stack-vector0))) + (s4-0 (vector-reset! (new-stack-vector0))) + (s3-0 (vector-reset! (new-stack-vector0))) + (s2-0 (new-stack-vector0)) + (gp-0 (new-stack-matrix0)) + ) + 0.0 + (when *camera-read-analog* + (let + ((f1-0 + (analog-input + (the-as + int + (+ + (-> *cpad-list* cpads 0 rightx) + -256 + (-> *cpad-list* cpads 0 leftx) + ) + ) + (the-as float 0.0) + (the-as float 48.0) + (the-as float 110.0) + (the-as float -1.0) + ) + ) + ) + (set! + (-> s5-0 y) + (- (-> s5-0 y) (* (- f1-0) (-> *CAM_BILLY-bank* rot-speed))) + ) + ) + ) + (cond + ((< (-> *CAM_BILLY-bank* rot-speed) (-> s5-0 y)) + (set! (-> s5-0 y) (-> *CAM_BILLY-bank* rot-speed)) + ) + ((< (-> s5-0 y) (- (-> *CAM_BILLY-bank* rot-speed))) + (set! (-> s5-0 y) (- (-> *CAM_BILLY-bank* rot-speed))) + ) + ) + (set! (-> s3-0 x) (sin (the-as float 37319.11))) + (set! (-> s3-0 z) (cos (the-as float 37319.11))) + (set! (-> s4-0 x) (-> s3-0 z)) + (set! (-> s4-0 z) (- (-> s3-0 x))) + (vector-flatten! + s2-0 + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s2-0 (the-as float 1.0)) + (let + ((f0-14 (acos (vector-dot (-> self tracking inv-mat vector 2) s3-0)))) + (if (< (vector-dot (-> self tracking inv-mat vector 2) s4-0) 0.0) + (set! f0-14 (- f0-14)) + ) + (let ((f0-18 (cond + ((and (< 0.0 f0-14) (< 0.0 (-> s5-0 y))) + (fmin (-> s5-0 y) (fmax 0.0 (* 0.5 (- 10922.667 f0-14)))) + ) + ((and (< f0-14 0.0) (< (-> s5-0 y) 0.0)) + (fmax (-> s5-0 y) (fmin 0.0 (* 0.5 (- -10922.667 f0-14)))) + ) + (else + (-> s5-0 y) + ) + ) + ) + ) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-18) + ) + ) + (vector-matrix*! + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) + gp-0 + ) + ) + (set! (-> self tracking inv-mat vector 2 y) 0.0) + (vector-normalize! + (-> self tracking inv-mat vector 2) + (cos (-> *CAM_BILLY-bank* tilt-degrees)) + ) + (set! + (-> self tracking inv-mat vector 2 y) + (sin (-> *CAM_BILLY-bank* tilt-degrees)) + ) + (vector-cross! + (the-as vector (-> self tracking)) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! (the-as vector (-> self tracking)) (the-as float 1.0)) + (vector-cross! + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)) + ) + ) + (vector--float*! + (-> self trans) + (-> *camera* tpos-curr) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-spline (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (cond + ((-> self enter-has-run) + ) + ((-> self cam-entity) + (let ((gp-0 (new-stack-vector0))) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (logior! + (-> self options) + (cam-slave-get-flags (-> self cam-entity) 'flags) + ) + (if (logtest? (-> self options) #x8000) + (cam-slave-get-rot + (the-as entity-actor (-> self cam-entity)) + (the-as matrix (-> self tracking)) + ) + (set! + (-> self tracking tilt-adjust target) + (cam-slave-get-float + (-> self cam-entity) + 'tiltAdjust + (-> *CAMERA-bank* default-tilt-adjust) + ) + ) + ) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'trans + ) + (cam-curve-setup gp-0) + ) + (vector-negate! (-> self saved-pt) (-> self spline-offset)) + (let + ((a0-8 + (res-lump-struct + (-> self cam-entity) + 'spline-offset + structure + :time + (the-as float -1000000000.0) + ) + ) + ) + (if a0-8 + (vector+! + (-> self spline-offset) + (-> self spline-offset) + (the-as vector a0-8) + ) + ) + ) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (set! + (-> self spline-follow-dist) + (cam-slave-get-float + (-> self cam-entity) + 'spline-follow-dist + (the-as float 0.0) + ) + ) + (cond + ((< 0.0 (-> self spline-follow-dist)) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + ) + (curve-get-pos! s5-1 (the-as float 0.0) (-> self spline-curve)) + (curve-get-pos! gp-1 (the-as float 1.0) (-> self spline-curve)) + (if + (< + (vector-vector-distance-squared s5-1 (-> self tracking follow-pt)) + (vector-vector-distance-squared gp-1 (-> self tracking follow-pt)) + ) + (set! (-> self spline-follow-dist) (- (-> self spline-follow-dist))) + ) + ) + (set! + (-> self spline-tt) + (curve-closest-point + (-> self spline-curve) + (-> self tracking follow-pt) + (the-as float 0.5) + (the-as float -4096.0) + 10 + (-> self spline-follow-dist) + ) + ) + ) + (else + (set! (-> self spline-follow-dist) 0.0) + ) + ) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + (cond + ((logtest? (-> self options) #x8000) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 0)) + 0 + ) + (else + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + ) + ) + (else + (format #t "ERROR : cam-spline enter without entity~%") + ) + ) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-2 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-2) + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (new 'stack 'curve) + (set! (-> self trans quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-decel (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (if (not (-> self enter-has-run)) + (set! (-> self saved-pt quad) (-> self trans quad)) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (let ((s5-0 (new-stack-vector0)) + (gp-0 (new-stack-vector0)) + ) + (when (!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! + s5-0 + (parameter-ease-sin-clamp (-> *camera* outro-t)) + (-> *camera* outro-curve) + ) + (+! + (-> *camera* outro-t) + (* (-> *camera* outro-t-step) (-> *display* time-adjust-ratio)) + ) + (curve-get-pos! + gp-0 + (parameter-ease-sin-clamp (-> *camera* outro-t)) + (-> *camera* outro-curve) + ) + (vector-! gp-0 gp-0 s5-0) + (cond + ((or + (and + (< (-> *camera* outro-t-step) 0.0) + (>= (-> *camera* outro-exit-value) (-> *camera* outro-t)) + ) + (and + (< 0.0 (-> *camera* outro-t-step)) + (>= (-> *camera* outro-t) (-> *camera* outro-exit-value)) + ) + ) + (set! (-> *camera* outro-t) (-> *camera* outro-exit-value)) + (set! (-> *camera* outro-t-step) 0.0) + (vector+! (-> self velocity) (-> self velocity) gp-0) + (send-event *camera* 'outro-done) + ) + (else + (vector+! (-> self trans) (-> self trans) gp-0) + ) + ) + ) + ) + (vector-float*! (-> self velocity) (-> self velocity) 0.9) + (vector+! (-> self trans) (-> self trans) (-> self velocity)) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-endlessfall (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 (new 'stack-no-clear 'matrix)) + (f30-0 (-> self velocity y)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-0 quad) (-> self trans quad)) + (set! (-> s4-0 y) 0.0) + (set! (-> s5-0 quad) (-> self velocity quad)) + (set! (-> s5-0 y) 0.0) + ((method-of-type cam-vector-seeker init!) + (the-as cam-vector-seeker gp-0) + s4-0 + (the-as float 81.92) + (fmax 819.2 (vector-length s5-0)) + (the-as float 0.75) + ) + (set! (-> gp-0 vector 2 quad) (-> s5-0 quad)) + ) + (while #t + (when (not (paused?)) + (set! (-> gp-0 vector 0 x) (-> (target-pos 0) x)) + (set! (-> gp-0 vector 0 z) (-> (target-pos 0) z)) + ((method-of-type cam-vector-seeker update!) + (the-as cam-vector-seeker gp-0) + (the-as vector #f) + ) + (when (< 819.2 (-> gp-0 vector 3 y)) + (set! (-> gp-0 vector 3 y) (* 0.9 (-> gp-0 vector 3 y))) + (if (< (-> gp-0 vector 3 y) 819.2) + (set! (-> gp-0 vector 3 y) 819.2) + ) + ) + (set! f30-0 (* 0.9 f30-0)) + (+! (-> self trans y) f30-0) + (set! (-> self trans x) (-> gp-0 vector 1 x)) + (set! (-> self trans z) (-> gp-0 vector 1 z)) + ) + (suspend) + ) + ) + (none) + ) + ) + +;; definition for function cam-circular-position-into-max-angle +;; Used lq/sq +(defbehavior + cam-circular-position-into-max-angle camera-slave + ((arg0 vector) (arg1 vector) (arg2 float)) + (let* ((f30-0 (vector-normalize-ret-len! arg0 (the-as float 1.0))) + (f26-0 (vector-normalize-ret-len! arg1 (the-as float 1.0))) + (f0-1 (vector-dot arg0 arg1)) + (f28-0 (acos f0-1)) + (s3-0 (new 'stack-no-clear 'matrix)) + ) + (when *camera-read-analog* + (let + ((f24-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 8192.0 (-> *display* seconds-per-frame)) + ) + ) + (f1-2 + (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 8192.0 (-> *display* seconds-per-frame)) + ) + ) + (s2-0 (new-stack-matrix0)) + ) + (let ((v1-20 (new 'stack-no-clear 'vector))) + 0.0 + (if (< (-> self pivot-rad) f30-0) + (set! f24-0 (- f24-0)) + ) + (vector-cross! v1-20 arg1 arg0) + (let ((f0-9 (vector-dot v1-20 (-> *camera* local-down)))) + (if (< f1-2 0.0) + (set! f1-2 (fmax f1-2 (* -0.15 f28-0))) + ) + (if (< f0-9 0.0) + (set! f1-2 (- f1-2)) + ) + (let* ((f1-3 (+ f24-0 f1-2)) + (f1-5 + (fmin + (* 8192.0 (-> *display* seconds-per-frame)) + (fmax (* -8192.0 (-> *display* seconds-per-frame)) f1-3) + ) + ) + ) + (cond + ((and (< 0.0 f1-5) (< 0.0 f0-9) (< (-> self max-angle-curr) f28-0)) + (set! f1-5 0.0) + ) + ((and (< 0.0 f1-5) (< 0.0 f0-9)) + (set! f1-5 (fmin f1-5 (* 0.15 (- (-> self max-angle-curr) f28-0)))) + ) + ((and (< f1-5 0.0) (< f0-9 0.0) (< (-> self max-angle-curr) f28-0)) + (set! f1-5 0.0) + ) + ((and (< f1-5 0.0) (< f0-9 0.0)) + (set! f1-5 (fmax f1-5 (* 0.15 (- f28-0 (-> self max-angle-curr))))) + ) + ) + (matrix-axis-angle! s2-0 (-> *camera* local-down) f1-5) + ) + ) + ) + (vector-matrix*! arg1 arg1 s2-0) + ) + (let ((f0-15 (vector-dot arg0 arg1))) + (set! f28-0 (acos f0-15)) + ) + ) + (cond + ((< (-> self max-angle-curr) f28-0) + (matrix-from-two-vectors-max-angle! + s3-0 + arg1 + arg0 + (* + (fmin 1.0 (* arg2 (-> *display* time-adjust-ratio))) + (- f28-0 (-> self max-angle-curr)) + ) + ) + (vector-matrix*! arg0 arg1 s3-0) + ) + ((and + (logtest? (-> self options) 2) + (or + (and + (>= f26-0 (+ -8192.0 f30-0)) + (>= f30-0 (+ -8192.0 (-> self pivot-rad))) + ) + (and + (>= (+ 8192.0 f30-0) f26-0) + (>= (+ 8192.0 (-> self pivot-rad)) f30-0) + ) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (vector-cross! s2-1 arg1 arg0) + (vector-normalize! s2-1 (the-as float 1.0)) + (matrix-axis-angle! + s3-0 + s2-1 + (* + (fmin 1.0 (* arg2 (-> *display* time-adjust-ratio))) + (- (-> self max-angle-curr) f28-0) + ) + ) + ) + (vector-matrix*! arg0 arg1 s3-0) + ) + (else + (set! (-> arg0 quad) (-> arg1 quad)) + (if (logtest? (-> self options) 2048) + (set! (-> self max-angle-curr) f28-0) + ) + ) + ) + ) + (vector-normalize! arg0 (-> self pivot-rad)) + ) + +;; definition for function cam-circular-position +(defbehavior cam-circular-position camera-slave ((arg0 symbol)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (if (logtest? (-> self options) 130) + (vector-! gp-0 (-> self circular-follow) (-> self pivot-pt)) + (vector-! gp-0 (-> self pivot-pt) (-> self circular-follow)) + ) + (vector-! s5-0 (-> self trans) (-> self pivot-pt)) + (when (zero? (logand (-> self options) 4)) + (vector-flatten! gp-0 gp-0 (-> *camera* local-down)) + (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) + ) + (cond + ((logtest? (-> self options) 128) + (let ((f0-1 (- (vector-length gp-0) (-> self pivot-rad)))) + (if (>= 0.0 f0-1) + (vector-reset! gp-0) + (vector-normalize! gp-0 f0-1) + ) + ) + ) + ((not arg0) + (set! (-> self max-angle-curr) (-> self max-angle-offset)) + (cam-circular-position-into-max-angle gp-0 s5-0 (the-as float 1.0)) + ) + (else + (cam-circular-position-into-max-angle gp-0 s5-0 (the-as float 0.05)) + ) + ) + ) + (vector+! (-> self trans) gp-0 (-> self pivot-pt)) + ) + ) + +;; definition for function cam-circular-code +;; Used lq/sq +(defbehavior cam-circular-code camera-slave () + (set! (-> self pivot-pt quad) (-> self saved-pt quad)) + (cam-curve-pos (-> self pivot-pt) (the-as vector #f) (the-as curve #f) #f) + (let ((a2-1 (new-stack-vector0))) + (vector-! a2-1 (-> *camera* tpos-curr-adj) (-> self pivot-pt)) + (vector-! + (-> self circular-follow) + (-> self circular-follow) + (-> self pivot-pt) + ) + (if (logtest? (-> self options) 4) + (v-slrp3! + (-> self circular-follow) + (-> self circular-follow) + a2-1 + (the-as vector #f) + (* 182.04445 (-> *display* time-adjust-ratio)) + ) + (v-slrp3! + (-> self circular-follow) + (-> self circular-follow) + a2-1 + (-> *camera* local-down) + (* 182.04445 (-> *display* time-adjust-ratio)) + ) + ) + ) + (vector+! + (-> self circular-follow) + (-> self circular-follow) + (-> self pivot-pt) + ) + (cam-circular-position #t) + (when (!= (-> self fov1) 0.0) + (let + ((f0-7 + (lerp-clamp + (-> self fov0) + (-> self fov1) + (parameter-ease-sin-clamp + (dummy-10 (-> self fov-index) (-> *camera* tpos-curr-adj)) + ) + ) + ) + ) + (set! (-> self fov) f0-7) + f0-7 + ) + ) + ) + +;; failed to figure out what this is: +(defstate cam-circular (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + #f + ) + (('outro-done) + (set! (-> self trans quad) (-> *camera-combiner* trans quad)) + (cam-circular-position #f) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (cond + ((-> self enter-has-run) + ) + (else + (let ((gp-0 (new-stack-vector0))) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (set! (-> self view-off-param) 1.0) + (set! (-> self circular-follow quad) (-> *camera* tpos-curr-adj quad)) + (set! (-> self max-angle-offset) 0.0) + (cond + ((-> self cam-entity) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + (-> self saved-pt) + 'pivot + ) + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-0 + 'trans + ) + (set! + (-> self pivot-rad) + (vector-length (vector-! gp-0 gp-0 (-> self saved-pt))) + ) + (logior! + (-> self options) + (cam-slave-get-flags (-> self cam-entity) 'flags) + ) + (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) + (set! + (-> self tracking tilt-adjust target) + (cam-slave-get-float + (-> self cam-entity) + 'tiltAdjust + (-> *CAMERA-bank* default-tilt-adjust) + ) + ) + (set! + (-> self max-angle-offset) + (cam-slave-get-float (-> self cam-entity) 'maxAngle (the-as float 0.0)) + ) + (if (< (-> self max-angle-offset) 0.0) + (set! (-> self max-angle-offset) 0.0) + ) + (set! + (-> self fov1) + (cam-slave-get-float + (-> self cam-entity) + 'focalPull + (the-as float 0.0) + ) + ) + (cond + ((and + (!= (-> self fov1) 0.0) + (dummy-9 + (-> self fov-index) + 'focalpull + (-> self cam-entity) + (-> self saved-pt) + (the-as curve #f) + ) + ) + (set! (-> self fov0) (-> self fov)) + (set! + (-> self fov) + (lerp-clamp + (-> self fov0) + (-> self fov1) + (dummy-10 (-> self fov-index) (-> *camera* tpos-curr-adj)) + ) + ) + ) + (else + (set! (-> self fov1) 0.0) + ) + ) + (cam-curve-setup (-> self saved-pt)) + (set! (-> self pivot-pt quad) (-> self saved-pt quad)) + (cam-curve-pos + (-> self pivot-pt) + (the-as vector #f) + (the-as curve #f) + #f + ) + ) + ((logtest? (-> self options) 128) + (vector-! + (-> self pivot-pt) + (-> *camera* tpos-curr-adj) + (-> self trans) + ) + (vector-flatten! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + ) + (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) + (set! (-> self pivot-pt quad) (-> self trans quad)) + (set! (-> self saved-pt quad) (-> self pivot-pt quad)) + ) + (else + (vector-! + (-> self pivot-pt) + (-> *camera* tpos-curr-adj) + (-> self trans) + ) + (vector-float*! (-> self pivot-pt) (-> self pivot-pt) 0.5) + (vector-flatten! + (-> self pivot-pt) + (-> self pivot-pt) + (-> *camera* local-down) + ) + (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) + (vector+! (-> self pivot-pt) (-> self trans) (-> self pivot-pt)) + (set! (-> self saved-pt quad) (-> self pivot-pt quad)) + ) + ) + ) + (cam-circular-position #f) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + ) + (let ((gp-3 (new 'stack-no-clear 'vector))) + (if + (cam-slave-get-vector-with-offset + (the-as entity-actor (-> self cam-entity)) + gp-3 + 'interesting + ) + (send-event *camera* 'point-of-interest gp-3) + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (if (not (paused?)) + (cam-circular-code) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate cam-lookat (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (suspend) + ) + (none) + ) + ) + +;; definition of type cam-string-bank +(deftype cam-string-bank (basic) + ((los-coll-rad meters :offset-assert 4) + (los-coll-rad2 meters :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type cam-string-bank +(defmethod inspect cam-string-bank ((obj cam-string-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tlos-coll-rad: (meters ~m)~%" (-> obj los-coll-rad)) + (format #t "~Tlos-coll-rad2: (meters ~m)~%" (-> obj los-coll-rad2)) + obj + ) + +;; definition for symbol *CAM_STRING-bank*, type cam-string-bank +(define + *CAM_STRING-bank* + (new 'static 'cam-string-bank + :los-coll-rad (meters 1.0) + :los-coll-rad2 (meters 0.5) + ) + ) + +;; definition for function cam-string-find-position-rel! +;; Used lq/sq +(defun cam-string-find-position-rel! ((arg0 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'bone)) + (f30-0 0.0) + (s2-0 (new 'stack-no-clear 'matrix)) + ) + (vector-flatten! + s5-0 + (-> *camera-combiner* inv-camera-rot vector 2) + (-> *camera* local-down) + ) + (if + (= + (vector-normalize-ret-len! + s5-0 + (- (+ 1024.0 (-> *CAMERA-bank* default-string-min-z))) + ) + 0.0 + ) + (set! (-> s5-0 z) (+ 1024.0 (-> *CAMERA-bank* default-string-min-z))) + ) + (vector--float*! + s5-0 + s5-0 + (-> *camera* local-down) + (-> *CAMERA-bank* default-string-min-y) + ) + (set! (-> arg0 quad) (-> s5-0 quad)) + (while #t + (vector--float*! + s4-0 + arg0 + (-> *camera* local-down) + (-> *camera* target-height) + ) + (if + (< + (dummy-10 + *collide-cache* + (-> *camera* tpos-curr-adj) + arg0 + (the-as float 409.6) + #x4a09 + (the-as process #f) + (the-as collide-mesh-cache-tri s3-0) + 2 + ) + 0.0 + ) + (return #t) + ) + (set! f30-0 (cond + ((>= -32768.0 f30-0) + (format #t "cam-string didn't find a spot~%") + (set! (-> arg0 quad) (-> s5-0 quad)) + (return #f) + f30-0 + ) + ((< 0.0 f30-0) + (- f30-0) + ) + (else + (- 5461.3335 f30-0) + ) + ) + ) + (matrix-axis-angle! s2-0 (-> *camera* local-down) f30-0) + (vector-matrix*! arg0 s5-0 s2-0) + ) + ) + (the-as symbol #f) + ) + +;; definition for function cam-string-set-position-rel! +;; INFO: Return type mismatch uint vs int. +;; Used lq/sq +(defbehavior cam-string-set-position-rel! camera-slave ((arg0 vector)) + (vector-flatten! (-> self view-flat) arg0 (-> *camera* local-down)) + (set! (-> self min-z-override) (vector-length (-> self view-flat))) + (vector+! (-> self desired-pos) arg0 (-> *camera* tpos-curr-adj)) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (TODO-RENAME-10 (-> self position-spline) (-> self desired-pos)) + (vector-reset! (-> self velocity)) + (let ((v0-3 (logand -4097 (-> self options)))) + (set! (-> self options) v0-3) + (the-as int v0-3) + ) + ) + +;; definition for function string-push-help +;; INFO: Return type mismatch int vs float. +(defun string-push-help () + (the-as float 409.6) + ) + +;; definition (debug) for function cam-draw-collide-cache +;; INFO: Return type mismatch int vs none. +(defun-debug cam-draw-collide-cache ((arg0 collide-cache)) + (let ((gp-0 (-> arg0 tris))) + (countdown (s5-0 (-> arg0 num-tris)) + (let ((t1-0 #x40000080)) + (add-debug-flat-triangle + #t + (bucket-id debug-draw1) + (the-as vector (-> gp-0 0)) + (-> gp-0 0 vertex 1) + (-> gp-0 0 vertex 2) + (the-as rgba t1-0) + ) + ) + (set! gp-0 (the-as (inline-array collide-cache-tri) (-> gp-0 1))) + ) + ) + 0 + (none) + ) + +;; definition of type los-dist +(deftype los-dist (structure) + ((par-dist float :offset-assert 0) + (lat-dist float :offset-assert 4) + (vert-dist float :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type los-dist +(defmethod inspect los-dist ((obj los-dist)) + (format #t "[~8x] ~A~%" obj 'los-dist) + (format #t "~Tpar-dist: ~f~%" (-> obj par-dist)) + (format #t "~Tlat-dist: ~f~%" (-> obj lat-dist)) + (format #t "~Tvert-dist: ~f~%" (-> obj vert-dist)) + obj + ) + +;; definition of type collide-los-dist-info +(deftype collide-los-dist-info (structure) + ((min-par float :offset-assert 0) + (max-par float :offset-assert 4) + (min-lat float :offset-assert 8) + (max-lat float :offset-assert 12) + (min-vp float :offset-assert 16) + (max-vp float :offset-assert 20) + (min-vn float :offset-assert 24) + (max-vn float :offset-assert 28) + (count int32 :offset-assert 32) + ) + :method-count-assert 9 + :size-assert #x24 + :flag-assert #x900000024 + ) + +;; definition for method 3 of type collide-los-dist-info +(defmethod inspect collide-los-dist-info ((obj collide-los-dist-info)) + (format #t "[~8x] ~A~%" obj 'collide-los-dist-info) + (format #t "~Tmin-par: ~f~%" (-> obj min-par)) + (format #t "~Tmax-par: ~f~%" (-> obj max-par)) + (format #t "~Tmin-lat: ~f~%" (-> obj min-lat)) + (format #t "~Tmax-lat: ~f~%" (-> obj max-lat)) + (format #t "~Tmin-vp: ~f~%" (-> obj min-vp)) + (format #t "~Tmax-vp: ~f~%" (-> obj max-vp)) + (format #t "~Tmin-vn: ~f~%" (-> obj min-vn)) + (format #t "~Tmax-vn: ~f~%" (-> obj max-vn)) + (format #t "~Tcount: ~D~%" (-> obj count)) + obj + ) + +;; definition for function dist-info-init +;; INFO: Return type mismatch int vs none. +(defun dist-info-init ((arg0 collide-los-dist-info)) + (set! (-> arg0 min-par) 1.0) + (set! (-> arg0 max-par) 0.0) + (set! (-> arg0 count) 0) + 0 + (none) + ) + +;; definition for function dist-info-valid? +(defun dist-info-valid? ((arg0 collide-los-dist-info)) + (>= (-> arg0 max-par) (-> arg0 min-par)) + ) + +;; definition for function dist-info-append +;; INFO: Return type mismatch int vs none. +(defun dist-info-append ((arg0 collide-los-dist-info) (arg1 vector)) + (cond + ((dist-info-valid? arg0) + (if (< (-> arg1 x) (-> arg0 min-par)) + (set! (-> arg0 min-par) (-> arg1 x)) + ) + (if (< (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + ) + (if (< (-> arg1 y) (-> arg0 min-lat)) + (set! (-> arg0 min-lat) (-> arg1 y)) + ) + (if (< (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + ) + (cond + ((< (-> arg1 y) 0.0) + (if (< (-> arg1 z) (-> arg0 min-vn)) + (set! (-> arg0 min-vn) (-> arg1 z)) + ) + (if (< (-> arg0 max-vn) (-> arg1 z)) + (set! (-> arg0 max-vn) (-> arg1 z)) + ) + ) + (else + (if (< (-> arg1 z) (-> arg0 min-vp)) + (set! (-> arg0 min-vp) (-> arg1 z)) + ) + (if (< (-> arg0 max-vp) (-> arg1 z)) + (set! (-> arg0 max-vp) (-> arg1 z)) + ) + ) + ) + ) + (else + (set! (-> arg0 min-par) (-> arg1 x)) + (set! (-> arg0 max-par) (-> arg1 x)) + (set! (-> arg0 min-lat) (-> arg1 y)) + (set! (-> arg0 max-lat) (-> arg1 y)) + (set! (-> arg0 min-vp) 0.0) + (set! (-> arg0 max-vp) 0.0) + (set! (-> arg0 min-vn) 0.0) + (set! (-> arg0 max-vn) 0.0) + (cond + ((< (-> arg1 y) 0.0) + (set! (-> arg0 min-vn) (-> arg1 z)) + (set! (-> arg0 max-vn) (-> arg1 z)) + ) + (else + (set! (-> arg0 min-vp) (-> arg1 z)) + (set! (-> arg0 max-vp) (-> arg1 z)) + ) + ) + ) + ) + (+! (-> arg0 count) 1) + (none) + ) + +;; definition for function dist-info-print +(defun dist-info-print ((arg0 collide-los-dist-info) (arg1 string)) + (cond + ((dist-info-valid? arg0) + (format + *stdcon* + "~S ~2,D mn ~,,2M mx ~,,2M mnl ~,,2M mxl ~,,2M~%" + arg1 + (-> arg0 count) + (-> arg0 min-par) + (-> arg0 max-par) + (-> arg0 min-lat) + (-> arg0 max-lat) + ) + (format + *stdcon* + " mnvp ~,,2M mxvp ~,,2M mnvn ~,,2M mxvn ~,,2M~%" + (-> arg0 min-vp) + (-> arg0 max-vp) + (-> arg0 min-vn) + (-> arg0 max-vn) + ) + ) + (else + (format *stdcon* "~S invalid~%" arg1) + ) + ) + ) + +;; definition of type collide-los-result +(deftype collide-los-result (structure) + ((lateral vector :inline :offset-assert 0) + (cw collide-los-dist-info :inline :offset-assert 16) + (ccw collide-los-dist-info :inline :offset-assert 64) + (straddle collide-los-dist-info :inline :offset-assert 112) + (lateral-valid symbol :offset-assert 148) + ) + :method-count-assert 9 + :size-assert #x98 + :flag-assert #x900000098 + ) + +;; definition for method 3 of type collide-los-result +(defmethod inspect collide-los-result ((obj collide-los-result)) + (format #t "[~8x] ~A~%" obj 'collide-los-result) + (format #t "~Tlateral: ~`vector`P~%" (-> obj lateral)) + (format #t "~Tcw: #~%" (-> obj cw)) + (format #t "~Tccw: #~%" (-> obj ccw)) + (format #t "~Tstraddle: #~%" (-> obj straddle)) + (format #t "~Tlateral-valid: ~A~%" (-> obj lateral-valid)) + obj + ) + +;; definition for function los-cw-ccw +;; WARN: Stack slot offset 128 signed mismatch +;; WARN: Stack slot offset 128 signed mismatch +;; Used lq/sq +(defun + los-cw-ccw + ((arg0 (inline-array collide-cache-tri)) + (arg1 vector) + (arg2 vector) + (arg3 float) + (arg4 clip-travel-vector-to-mesh-return-info) + (arg5 vector) + (arg6 float) + ) + (local-vars + (sv-128 float) + (sv-144 vector) + (sv-160 vector) + (sv-176 vector) + (sv-192 vector) + (sv-208 int) + ) + (with-pp + (set! sv-128 arg3) + (let ((gp-0 arg4)) + (set! sv-144 arg5) + (let ((s4-0 arg6)) + (set! sv-160 (new 'stack-no-clear 'vector)) + (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((s5-0 (new 'stack-no-clear 'matrix))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((f30-0 0.0) + (s0-0 #f) + ) + (set! sv-208 0) + (while (< sv-208 4) + (cond + ((= sv-208 3) + (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 368))) + (set! (-> s5-0 vector sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! + (-> s5-0 vector sv-208 z) + (vector-dot sv-160 (-> *camera* local-down)) + ) + (vector-! + sv-160 + (-> arg0 0 vertex sv-208) + (the-as vector (&-> pp stack 368)) + ) + ) + ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 368))) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (set! sv-208 (+ sv-208 1)) + ) + (cond + ((and s0-0 (!= s4-0 -100000000.0)) + (dotimes (s4-1 4) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 vert-0)) + (the-as vector (+ (the-as uint s5-0) (* s4-1 16))) + ) + ) + #f + ) + ((< (-> s5-0 vector 3 y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 next-normal)) + (the-as vector (+ (the-as uint s5-0) (* s4-2 16))) + ) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 vector 3 y)) + (dist-info-append + (the-as collide-los-dist-info (-> gp-0 intersection)) + (the-as vector (+ (the-as uint s5-0) (* s4-3 16))) + ) + ) + ) + #f + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function cam-los-spline-collide +(defun cam-los-spline-collide ((arg0 vector) (arg1 vector) (arg2 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 *collide-cache*) + (f30-0 2.0) + ) + 0.0 + (vector-! s5-0 arg1 arg0) + (dummy-14 + s4-0 + arg0 + s5-0 + (-> *CAM_STRING-bank* los-coll-rad2) + #x4a09 + (the-as process #f) + (the-as int arg2) + ) + (let* ((f0-2 (vector-length s5-0)) + (f28-0 (cond + ((< f0-2 (-> *CAMERA-bank* min-detectable-velocity)) + 0.0 + ) + (else + (let* + ((f0-3 + (/ + (* + 3.0 + (- + (-> *CAM_STRING-bank* los-coll-rad2) + (-> *CAMERA-bank* collide-move-rad) + ) + ) + f0-2 + ) + ) + (f0-4 (- 1.0 f0-3)) + ) + (fmin 1.0 (fmax 0.0 f0-4)) + ) + ) + ) + ) + (s3-0 (-> s4-0 tris)) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (countdown (s4-1 (-> s4-0 num-tris)) + (let + ((f0-7 + (moving-sphere-triangle-intersect + arg0 + s5-0 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> s3-0 0) + s2-0 + s1-0 + ) + ) + ) + (cond + ((or (< f0-7 0.0) (< f28-0 f0-7)) + ) + ((< f0-7 f30-0) + (set! f30-0 f0-7) + ) + ) + ) + (set! s3-0 (the-as (inline-array collide-cache-tri) (-> s3-0 1))) + ) + ) + (if (= f30-0 2.0) + (set! f30-0 -1.0) + ) + f30-0 + ) + ) + +;; definition for function cam-los-setup-lateral +(defbehavior + cam-los-setup-lateral camera-slave + ((arg0 clip-travel-vector-to-mesh-return-info) (arg1 vector) (arg2 vector)) + (cond + ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 vert-0))) + (let ((f30-0 (-> arg0 vert-0 z)) + (f28-0 (-> arg0 vert-0 w)) + ) + (if + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (set! f28-0 (fmax f28-0 (-> arg0 intersection w))) + ) + (if (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (set! f30-0 (fmin f30-0 (- (-> arg0 next-normal w)))) + ) + (cond + ((= (-> self los-state) 2) + (if *display-cam-los-debug* + (format *stdcon* "straddle stick ccw~%") + ) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((= (-> self los-state) 1) + (if *display-cam-los-debug* + (format *stdcon* "straddle stick cw~%") + ) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and + (or + (< 0.01 (-> arg0 vert-1 y)) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 next-normal)) + ) + (< 0.01 (the-as float (-> arg0 gap-poly))) + ) + ) + (or + (< (-> arg0 vert-1 x) -0.01) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 next-normal)) + ) + (< (the-as float (-> arg0 poly)) -0.01) + ) + ) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + (or + (< (-> arg0 boundary-normal y) 0.01) + (< -0.01 (-> arg0 boundary-normal x)) + ) + ) + ) + (when + (not + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + ) + ) + (if + (not + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + ) + (format #t "s diag ccw invalid cw~%") + ) + (if *display-cam-los-debug* + (format *stdcon* "straddle diagonal ccw~%") + ) + (set! (-> self los-state) (the-as uint 2)) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((and + (or + (< 0.01 (-> arg0 vert-1 w)) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + (< 0.01 (-> arg0 boundary-normal y)) + ) + ) + (or + (< (-> arg0 vert-1 z) -0.01) + (and + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + (< (-> arg0 boundary-normal x) -0.01) + ) + ) + (and + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (or + (< (the-as float (-> arg0 gap-poly)) 0.01) + (< -0.01 (the-as float (-> arg0 poly))) + ) + ) + ) + (if + (not + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + ) + (format #t "s diag cw invalid ccw~%") + ) + (when + (not + (dist-info-valid? + (the-as collide-los-dist-info (-> arg0 intersection)) + ) + ) + ) + (if *display-cam-los-debug* + (format *stdcon* "straddle diagonal cw~%") + ) + (set! (-> self los-state) (the-as uint 1)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ((< f28-0 (- f30-0)) + (if *display-cam-los-debug* + (format *stdcon* "straddle ccw~%") + ) + (set! (-> self los-state) (the-as uint 2)) + (vector-normalize! arg1 (+ f28-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + (else + (if *display-cam-los-debug* + (format *stdcon* "straddle cw~%") + ) + (set! (-> self los-state) (the-as uint 1)) + (vector-normalize! arg1 (- f30-0 (-> *CAM_STRING-bank* los-coll-rad))) + ) + ) + ) + ) + ((and + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (< 0.01 (the-as float (-> arg0 gap-poly))) + (< (the-as float (-> arg0 poly)) -0.01) + (or + (< (-> arg0 boundary-normal y) 0.01) + (< -0.01 (-> arg0 boundary-normal x)) + ) + ) + (if *display-cam-los-debug* + (format *stdcon* "diagonal ccw~%") + ) + (set! (-> self los-state) (the-as uint 2)) + (vector-normalize! + arg1 + (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z)) + ) + ) + ((and + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (< 0.01 (-> arg0 boundary-normal y)) + (< (-> arg0 boundary-normal x) -0.01) + (or + (< (the-as float (-> arg0 gap-poly)) 0.01) + (< -0.01 (the-as float (-> arg0 poly))) + ) + ) + (if *display-cam-los-debug* + (format *stdcon* "diagonal cw~%") + ) + (set! (-> self los-state) (the-as uint 1)) + (vector-normalize! + arg1 + (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad)) + ) + ) + ((and + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + ) + (set! (-> self los-state) (the-as uint 3)) + (vector-normalize! arg1 (the-as float 0.0001)) + ) + ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 intersection))) + (if *display-cam-los-debug* + (format *stdcon* "regular cw~%") + ) + (set! (-> self los-state) (the-as uint 1)) + (vector-normalize! + arg1 + (- (-> arg0 intersection z) (-> *CAM_STRING-bank* los-coll-rad)) + ) + ) + ((dist-info-valid? (the-as collide-los-dist-info (-> arg0 next-normal))) + (if *display-cam-los-debug* + (format *stdcon* "regular ccw~%") + ) + (set! (-> self los-state) (the-as uint 2)) + (vector-normalize! + arg1 + (- (-> *CAM_STRING-bank* los-coll-rad) (-> arg0 next-normal z)) + ) + ) + (else + (set! (-> self los-state) (the-as uint 0)) + (vector-reset! arg1) + ) + ) + (cond + ((= (vector-length arg1) 0.0) + (set! (-> arg0 vert-next y) (the-as float #f)) + #f + ) + (else + (vector-! (the-as vector (&-> arg0 found-boundary)) arg1 arg2) + (vector-normalize! + (the-as vector (&-> arg0 found-boundary)) + (the-as float 1.0) + ) + (let ((v0-45 #t)) + (set! (-> arg0 vert-next y) (the-as float v0-45)) + v0-45 + ) + ) + ) + ) + +;; definition for function cam-los-collide +;; INFO: Return type mismatch int vs symbol. +;; WARN: Unsupported inline assembly instruction kind - [mula.s f2, f5] +;; WARN: Unsupported inline assembly instruction kind - [madda.s f3, f6] +;; WARN: Unsupported inline assembly instruction kind - [madd.s f2, f4, f7] +;; Used lq/sq +(defbehavior + cam-los-collide camera-slave + ((arg0 vector) + (arg1 vector) + (arg2 clip-travel-vector-to-mesh-return-info) + (arg3 int) + ) + (local-vars + (s1-3 int) + (s2-2 int) + (f2-1 float) + (sv-224 vector) + (sv-240 vector) + ) + (dist-info-init (the-as collide-los-dist-info (-> arg2 intersection))) + (dist-info-init (the-as collide-los-dist-info (-> arg2 next-normal))) + (dist-info-init (the-as collide-los-dist-info (-> arg2 vert-0))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-normalize-copy! s2-0 arg1 (the-as float 1.0)) + (vector-flatten! s4-0 arg1 (-> *camera* local-down)) + (let ((s0-0 *collide-cache*) + (f26-0 (vector-length arg1)) + (f30-0 (vector-normalize-ret-len! s4-0 (the-as float 1.0))) + ) + (dummy-14 + s0-0 + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad) + #x4a09 + (the-as process #f) + arg3 + ) + (let ((s1-1 (-> s0-0 tris)) + (f28-0 (/ 2048.0 f26-0)) + (f26-1 (/ (+ -8192.0 f26-0) f26-0)) + ) + (if (< f26-1 0.0) + (set! f26-1 0.0) + ) + (if (< 1.0 f28-0) + (set! f28-0 1.0) + ) + (countdown (s0-1 (-> s0-0 num-tris)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (set! sv-224 (new 'stack-no-clear 'vector)) + (let + ((f0-7 + (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad) + (-> s1-1 0) + sv-240 + sv-224 + ) + ) + ) + (cond + ((or (< f0-7 0.0) (< 1.0 f0-7)) + ) + ((let ((f1-2 0.0)) + (let* ((v1-21 arg1) + (f2-0 (-> v1-21 x)) + (f3-0 (-> v1-21 y)) + (f4-0 (-> v1-21 z)) + (f5-0 (-> sv-224 x)) + (f6-0 (-> sv-224 y)) + (f7-0 (-> sv-224 z)) + ) + (.mula.s f2-0 f5-0) + (.madda.s f3-0 f6-0) + (.madd.s f2-1 f4-0 f7-0) + ) + (< f1-2 f2-1) + ) + (when (< f28-0 f0-7) + (let* ((t1-2 (new 'stack-no-clear 'vector)) + (t0-2 (new 'stack-no-clear 'vector)) + (f24-0 + (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> s1-1 0) + t0-2 + t1-2 + ) + ) + ) + (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-0) + (when *debug-segment* + (cond + ((= f24-0 -100000000.0) + (let ((t9-11 cam-debug-add-los-tri) + (a0-13 s1-1) + (a2-7 + (new 'static 'vector + :x (the-as float #x80) + :w (the-as float #x80) + ) + ) + ) + (t9-11 a0-13 sv-240 a2-7) + ) + ) + (else + (cam-debug-add-los-tri + s1-1 + sv-240 + (new 'static 'vector + :x (the-as float #x80) + :y (the-as float #x80) + :w (the-as float #x80) + ) + ) + ) + ) + ) + ) + ) + ) + ((< f0-7 f26-1) + (let* ((t1-4 (new 'stack-no-clear 'vector)) + (t0-4 (new 'stack-no-clear 'vector)) + (f24-1 + (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> s1-1 0) + t0-4 + t1-4 + ) + ) + ) + (los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-1) + (when *debug-segment* + (if (= f24-1 -100000000.0) + (cam-debug-add-los-tri + s1-1 + sv-240 + (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80)) + ) + (cam-debug-add-los-tri + s1-1 + sv-240 + (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80)) + ) + ) + ) + ) + ) + ) + ) + (set! s1-1 (the-as (inline-array collide-cache-tri) (-> s1-1 1))) + ) + ) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'vector))) + 0.0 + (vector-cross! s4-1 arg1 (-> *camera* local-down)) + (cond + ((!= + (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (when *display-cam-los-debug* + (format *stdcon* "emergency point jump~%") + (format 0 "emergency point jump~%") + ) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline used-point)) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (logior! (-> self options) 4096) + (set! + (-> self good-point quad) + (-> + *camera* + target-spline + point + (-> *camera* target-spline used-point) + position + quad + ) + ) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *debug-segment* + (let ((a1-22 (new 'stack-no-clear 'vector))) + (vector-! a1-22 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-22 -3 'jump self) + ) + ) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (set! (-> self string-trans quad) (-> self good-point quad)) + (vector-! + (-> self view-flat) + (-> self string-trans) + (-> *camera* tpos-curr-adj) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (vector-reset! (-> self velocity)) + (let ((f0-11 (vector-length (-> self view-flat)))) + (if (< f0-11 (-> self min-z-override)) + (set! (-> self min-z-override) f0-11) + ) + ) + ) + (else + (let + ((f30-1 + (cam-los-spline-collide + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> *camera* target-spline end-point)) + ) + ) + arg0 + (the-as vector 4098) + ) + ) + ) + (cond + ((< f30-1 0.0) + (if *display-cam-los-debug* + (format *stdcon* "good ~f~%" f30-1) + ) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> + *camera* + target-spline + point + (-> self los-tgt-spline-pt) + incarnation + ) + ) + (set! (-> self los-last-pos quad) (-> arg0 quad)) + ) + ((begin + (if *display-cam-los-debug* + (format + *stdcon* + "looking vel ~M u ~f pt ~D" + (vector-length (-> self velocity)) + f30-1 + (-> self los-tgt-spline-pt) + ) + ) + (set! s2-2 (-> self los-tgt-spline-pt)) + (set! s1-3 -134250495) + (while (and (!= s2-2 -134250495) (begin + (set! + f30-1 + (cam-los-spline-collide + (the-as + vector + (+ + (the-as + uint + (-> *camera* target-spline) + ) + (* 48 s2-2) + ) + ) + arg0 + (the-as vector 4098) + ) + ) + (< f30-1 0.0) + ) + ) + (set! s1-3 s2-2) + (set! s2-2 (-> *camera* target-spline point s2-2 next)) + ) + (and + (= s2-2 (-> *camera* target-spline used-point)) + (!= (-> *camera* target-spline point s2-2 next) -134250495) + ) + ) + (when *display-cam-los-debug* + (format 0 "looking at used point~%") + (format *stdcon* " at used point~%") + ) + (set! + (-> self los-tgt-spline-pt) + (-> *camera* target-spline point s2-2 next) + ) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> + *camera* + target-spline + point + (-> self los-tgt-spline-pt) + incarnation + ) + ) + (logior! (-> self options) 4096) + (set! + (-> self good-point quad) + (-> *camera* target-spline point s2-2 position quad) + ) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *debug-segment* + (let ((a1-38 (new 'stack-no-clear 'vector))) + (vector-! a1-38 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-38 -3 'jump self) + ) + ) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (set! (-> self string-trans quad) (-> self good-point quad)) + (vector-! + (-> self view-flat) + (-> self string-trans) + (-> *camera* tpos-curr-adj) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (vector-reset! (-> self velocity)) + (let ((f0-14 (vector-length (-> self view-flat)))) + (if (< f0-14 (-> self min-z-override)) + (set! (-> self min-z-override) f0-14) + ) + ) + ) + ((!= s1-3 -134250495) + (if *display-cam-los-debug* + (format *stdcon* " ok~%") + ) + (set! (-> self los-tgt-spline-pt) s1-3) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> + *camera* + target-spline + point + (-> self los-tgt-spline-pt) + incarnation + ) + ) + (set! (-> self los-last-pos quad) (-> arg0 quad)) + ) + (else + (if *display-cam-los-debug* + (format + *stdcon* + "~%failed u ~f cur ~D seen ~D tgt-pt ~D~%" + f30-1 + s2-2 + s1-3 + (-> self los-tgt-spline-pt) + ) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! + s3-1 + (-> self los-last-pos) + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> self los-tgt-spline-pt)) + ) + ) + ) + (let ((f28-1 (vector-length s3-1))) + (if (= f28-1 0.0) + (set! f28-1 0.4096) + ) + (let ((f30-2 (cond + ((and + (= (-> self string-vel-dir) 6) + (< + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + ) + (fmin 1.0 (+ 0.001 f30-1)) + ) + ((= (-> self string-vel-dir) 6) + (fmin 0.9999 f30-1) + ) + (else + (fmax 0.001 (+ -0.001 f30-1)) + ) + ) + ) + ) + (let ((s2-3 (new 'stack-no-clear 'vector))) + (vector-! + s2-3 + (-> *camera* tpos-curr-adj) + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> self los-tgt-spline-pt)) + ) + ) + ) + (vector-flatten! s2-3 s2-3 (-> *camera* local-down)) + (cond + ((and + (< (fabs (- (-> self desired-pos y) (-> self trans y))) 8192.0) + (< f28-1 (+ 1024.0 (-> self string-min-val z))) + (< (vector-length s2-3) 8192.0) + ) + (set! f30-2 0.0) + ) + ((< f28-1 (+ 1024.0 (-> self string-min-val z))) + ) + ((< (* f28-1 f30-2) (-> self string-min-val z)) + (set! f30-2 (/ (-> self string-min-val z) f28-1)) + ) + ) + ) + (when (< 0.0 f30-2) + (vector-! s3-1 (-> *camera* tpos-curr) (-> *camera* tpos-old)) + (vector-! + (-> self good-point) + (-> self los-last-pos) + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> self los-tgt-spline-pt)) + ) + ) + ) + (vector-float*! (-> self good-point) (-> self good-point) f30-2) + (vector+! + (-> self good-point) + (-> self good-point) + (the-as + vector + (+ + (the-as uint (-> *camera* target-spline)) + (* 48 (-> self los-tgt-spline-pt)) + ) + ) + ) + (set! (-> self los-last-pos quad) (-> self good-point quad)) + (when *display-cam-los-debug* + (format + 0 + "going because u(~f) > 0 frame ~D~%" + f30-2 + (-> *display* base-frame-counter) + ) + (format + *stdcon* + " going because u(~f) > 0 frame ~D~%" + f30-2 + (-> *display* base-frame-counter) + ) + ) + (logior! (-> self options) 4096) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (if *display-cam-los-debug* + (format + *stdcon* + "los-last ~M ~M ~M~%" + (-> self los-last-pos x) + (-> self los-last-pos y) + (-> self los-last-pos z) + ) + ) + (cam-los-setup-lateral arg2 s4-1 arg1) + ) + (cond + ((zero? (logand (-> self options) 1024)) + ) + ((= (-> self string-vel-dir) 5) + ) + ((and (= (-> self string-vel-dir) 2) (= (-> self los-state) 1)) + ) + ((and (= (-> self string-vel-dir) 1) (= (-> self los-state) 2)) + ) + ) + (when *display-cam-los-debug* + (format *stdcon* "state ~S" (slave-los-state->string (-> self los-state))) + (cond + ((zero? (-> self string-vel-dir)) + (format *stdcon* " vzero") + ) + ((= (-> self string-vel-dir) 2) + (format *stdcon* " vcw") + ) + ((= (-> self string-vel-dir) 1) + (format *stdcon* " vccw") + ) + ((= (-> self string-vel-dir) 3) + (format *stdcon* " up") + ) + ((= (-> self string-vel-dir) 4) + (format *stdcon* " down") + ) + ((= (-> self string-vel-dir) 6) + (format *stdcon* " long") + ) + ((= (-> self string-vel-dir) 5) + (format *stdcon* " short") + ) + ) + (format *stdcon* "~%") + ) + (when *display-cam-los-info* + (dist-info-print + (the-as collide-los-dist-info (-> arg2 intersection)) + "cw " + ) + (dist-info-print + (the-as collide-los-dist-info (-> arg2 next-normal)) + "ccw " + ) + (dist-info-print (the-as collide-los-dist-info (-> arg2 vert-0)) "strdl") + ) + (the-as symbol 0) + ) + +;; definition for function cam-string-follow +;; Used lq/sq +(defbehavior cam-string-follow camera-slave () + (let ((f30-0 (vector-length (-> self view-flat)))) + (cond + ((logtest? #x10000 (-> self options)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-cross! s5-0 (-> self view-flat) (-> *camera* local-down)) + (vector-normalize! s5-0 (the-as float 1.0)) + (vector-! gp-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-flatten! gp-0 gp-0 s5-0) + ) + (if (< (vector-dot gp-0 (-> self view-flat)) 0.0) + (vector-! (-> self view-flat) (-> self view-flat) gp-0) + ) + ) + ) + (else + (let ((v1-9 (new 'stack-no-clear 'vector))) + (vector-! v1-9 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector-! (-> self view-flat) (-> self view-flat) v1-9) + ) + ) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (let* ((f28-0 (vector-length (-> self view-flat))) + (f0-3 (fmin (-> *camera* string-push-z) (-> self view-off z))) + (f26-0 (-> self view-off z)) + (f0-4 (fmin f0-3 (-> self min-z-override))) + ) + (cond + ((logtest? (-> self options) #x4000) + (let ((a0-17 (new-stack-vector0))) + 0.0 + (vector-! a0-17 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (let ((f0-6 (vector-length a0-17))) + (set! + f0-4 + (lerp-clamp + (the-as float 28672.0) + (the-as float 32768.0) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f0-6))) + ) + ) + ) + ) + (set! f26-0 f0-4) + (+! + (-> self fov) + (fmax -91.022224 (fmin 91.022224 (* 0.1 (- 17294.223 (-> self fov))))) + ) + ) + (else + (+! + (-> self fov) + (fmax -182.04445 (fmin 182.04445 (* 0.1 (- 11650.845 (-> self fov))))) + ) + ) + ) + (cond + ((< f28-0 f0-4) + (vector-normalize! (-> self view-flat) f0-4) + ) + ((and + (< f30-0 f28-0) + (or (= (-> self los-state) 2) (= (-> self los-state) 1)) + ) + (vector-normalize! (-> self view-flat) f30-0) + ) + ((< f26-0 f28-0) + (vector-normalize! (-> self view-flat) f26-0) + (set! (-> self min-z-override) f26-0) + f26-0 + ) + (else + (set! (-> self min-z-override) f28-0) + f28-0 + ) + ) + ) + ) + ) + +;; definition for function cam-string-line-of-sight +(defbehavior cam-string-line-of-sight camera-slave () + (let ((gp-0 (new 'stack-no-clear 'clip-travel-vector-to-mesh-return-info)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (new 'stack-no-clear 'vector) + (let ((f30-0 (vector-length (-> self view-flat)))) + (vector--float*! + s5-0 + (-> *camera* tpos-curr) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (vector-! s5-0 s5-0 (-> self string-trans)) + (cam-los-collide (-> self string-trans) s5-0 gp-0 4098) + (when (-> gp-0 vert-next y) + (when (or (= (-> self los-state) 2) (= (-> self los-state) 1)) + (let ((a0-6 (new 'stack-no-clear 'vector))) + (vector-! a0-6 (-> *camera* tpos-curr) (-> *camera* tpos-old)) + (if + (and + (< (-> self string-min-val z) f30-0) + (< (-> *CAMERA-bank* min-detectable-velocity) (vector-length a0-6)) + ) + (set! f30-0 (+ -204.8 f30-0)) + ) + ) + ) + (if (< f30-0 (fmin (-> self string-min-val z) (-> self min-z-override))) + (set! f30-0 (fmin (-> self string-min-val z) (-> self min-z-override))) + ) + (if (< f30-0 (-> self min-z-override)) + (set! (-> self min-z-override) f30-0) + ) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + 0.0 + (vector-flatten! + s4-0 + (the-as vector (&-> gp-0 found-boundary)) + (-> *camera* local-down) + ) + (vector-normalize! s4-0 (the-as float 1.0)) + (vector-normalize-copy! s5-1 (-> self view-flat) (the-as float 1.0)) + (let + ((f0-12 + (lerp-clamp + (the-as float 418.7022) + (the-as float 364.0889) + (/ + (- f30-0 (-> self string-min-val z)) + (- (-> self string-max-val z) (-> self string-min-val z)) + ) + ) + ) + ) + (matrix-from-two-vectors-max-angle-partial! + (the-as matrix s3-0) + s5-1 + s4-0 + f0-12 + (the-as float 0.5) + ) + ) + (vector-matrix*! + (-> self view-flat) + (-> self view-flat) + (the-as matrix s3-0) + ) + ) + (vector-normalize! (-> self view-flat) f30-0) + ) + ) + ) + ) + +;; definition for function cam-dist-analog-input +(defun cam-dist-analog-input ((arg0 int) (arg1 float)) + (let ((f0-0 0.0)) + (cond + ((< arg0 28) + (set! f0-0 (- (fmin arg1 (* 0.083333336 (- 28.0 (the float arg0)) arg1)))) + ) + ((< 160 arg0) + (set! f0-0 (fmin arg1 (* 0.0125 (+ -160.0 (the float arg0)) arg1))) + ) + ) + f0-0 + ) + ) + +;; definition for function cam-string-joystick +;; Used lq/sq +(defbehavior cam-string-joystick camera-slave () + (set! (-> self options) (logand -257 (-> self options))) + (let + ((f28-0 + (cam-dist-analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + (the-as float 0.05) + ) + ) + (f0-2 + (/ + (- (vector-length (-> self view-flat)) (-> self string-min-val z)) + (- (-> self string-max-val z) (-> self string-min-val z)) + ) + ) + (f30-0 (-> self view-off-param)) + ) + (if (-> self have-phony-joystick) + (set! f28-0 (* 0.05 (-> self phony-joystick-y))) + ) + (if + (and + (-> *camera* being-attacked) + (< + (- + (-> *display* base-frame-counter) + (the-as int (-> *camera* attack-start)) + ) + 75 + ) + ) + (set! f28-0 0.05) + ) + (if (!= f28-0 0.0) + (logior! (-> self options) 256) + ) + (let ((f26-0 (fmin 1.0 f0-2))) + (let ((f0-3 f26-0)) + (when (< f26-0 0.0) + (let + ((f0-6 + (/ + (- (-> self string-min-val z) (vector-length (-> self view-flat))) + (* 0.5 (-> self string-min-val z)) + ) + ) + ) + (set! f0-3 (fmin 0.75 f0-6)) + ) + ) + (let ((f1-10 (-> self string-min-val y)) + (f2-3 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f1-10 f2-3 f0-3)) + ) + ) + (when (< f26-0 0.0) + (let ((v1-28 (new 'stack-no-clear 'vector))) + (vector-! v1-28 (-> self string-trans) (-> *camera* tpos-curr-adj)) + (let + ((f0-12 + (- + (- (vector-dot v1-28 (-> *camera* local-down))) + (-> *camera* target-height) + ) + ) + ) + (set! + (-> self view-off y) + (fmin (-> *camera* stringCliffHeight) (fmax f0-12 (-> self view-off y))) + ) + ) + ) + ) + (let ((f0-16 (fmax 0.0 f26-0))) + (cond + ((logtest? (-> self options) #x4000) + ) + ((not *camera-read-analog*) + ) + ((and (>= 0.0 f28-0) (>= 0.0 f0-16)) + ) + ((and (>= f28-0 0.0) (>= f0-16 1.0)) + ) + ((and + (< 0.0 f28-0) + (or (= (-> self los-state) 2) (= (-> self los-state) 1)) + ) + ) + ((< (* 0.05 (- 1.0 f0-16)) f28-0) + (let ((f0-17 (+ f0-16 (* 0.05 (- 1.0 f0-16))))) + (set! (-> self view-off-param) (fmax (-> self view-off-param) f0-17)) + (vector-normalize! + (-> self view-flat) + (lerp (-> self string-min-val z) (-> self string-max-val z) f0-17) + ) + ) + ) + ((< f28-0 (* 0.05 (- f0-16))) + (set! (-> self view-off-param) (+ f0-16 (* 0.05 (- f0-16)))) + ) + ((< 0.0 f28-0) + (let ((f0-19 (+ f0-16 (* f28-0 (-> *display* time-adjust-ratio))))) + (set! (-> self view-off-param) (fmax (-> self view-off-param) f0-19)) + (vector-normalize! + (-> self view-flat) + (lerp (-> self string-min-val z) (-> self string-max-val z) f0-19) + ) + ) + ) + ((< f28-0 0.0) + (set! + (-> self view-off-param) + (+ f0-16 (* f28-0 (-> *display* time-adjust-ratio))) + ) + ) + ) + ) + ) + (if (= f28-0 0.0) + (set! (-> self view-off z) (-> self string-max-val z)) + (set! + (-> self view-off z) + (lerp + (-> self string-min-val z) + (-> self string-max-val z) + (-> self view-off-param) + ) + ) + ) + (if (-> *camera* being-attacked) + (set! (-> self view-off-param) f30-0) + ) + ) + (when *camera-read-analog* + (let + ((f0-29 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 21845.334 (-> *display* seconds-per-frame)) + ) + ) + (s4-0 (new-stack-matrix0)) + (gp-2 (new-stack-vector0)) + (s5-2 (new-stack-vector0)) + ) + (if (-> self have-phony-joystick) + (set! + f0-29 + (* 21845.334 (-> self phony-joystick-x) (-> *display* seconds-per-frame)) + ) + ) + (cond + ((and (= (-> self los-state) 2) (< 0.0 f0-29)) + (let + ((f0-34 + (fmax + (-> self string-min-val z) + (fmin (-> self string-max-val z) (vector-length (-> self view-flat))) + ) + ) + ) + (set! + f0-29 + (* + 21845.334 + (+ 0.1 (/ (-> self string-min-val z) f0-34)) + (-> *display* seconds-per-frame) + ) + ) + ) + ) + ((and (= (-> self los-state) 1) (< f0-29 0.0)) + (let + ((f0-40 + (fmax + (-> self string-min-val z) + (fmin (-> self string-max-val z) (vector-length (-> self view-flat))) + ) + ) + ) + (set! + f0-29 + (* + -21845.334 + (+ 0.1 (/ (-> self string-min-val z) f0-40)) + (-> *display* seconds-per-frame) + ) + ) + ) + ) + ) + (cond + ((!= f0-29 0.0) + (logior! (-> self options) 256) + (matrix-axis-angle! s4-0 (-> *camera* local-down) f0-29) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + ((logtest? (-> self options) 1) + (vector-normalize-copy! gp-2 (-> self view-flat) (the-as float 1.0)) + (vector-flatten! + s5-2 + (-> *camera* tgt-rot-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s5-2 (the-as float -1.0)) + (matrix-from-two-vectors-max-angle-partial! + s4-0 + gp-2 + s5-2 + (* 10922.667 (-> *display* seconds-per-frame)) + (the-as float 0.05) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + ) + (when (logtest? (-> self options) #x4000) + (vector-normalize-copy! gp-2 (-> self view-flat) (the-as float 1.0)) + (vector-flatten! + s5-2 + (-> *camera* tgt-rot-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s5-2 (the-as float -1.0)) + (let ((f0-47 (acos (vector-dot s5-2 gp-2)))) + (when (and (< 8192.0 f0-47) (< f0-47 32585.955)) + (matrix-from-two-vectors-max-angle! + s4-0 + gp-2 + s5-2 + (fmin 546.13336 (* 0.5 (+ -8192.0 f0-47))) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + ) + ) + ) + ) + ) + +;; definition for function cam-string-find-hidden +;; INFO: Return type mismatch int vs none. +(defbehavior cam-string-find-hidden camera-slave () + (let ((s4-0 (new 'stack-no-clear 'collide-mesh-cache-tri)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (vector--float*! + s5-0 + (-> *camera* tpos-curr-adj) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (vector-! s5-0 s5-0 (-> self string-trans)) + (cond + ((< + (dummy-10 + *collide-cache* + (-> self string-trans) + s5-0 + (the-as float 40.96) + #x4a09 + (the-as process #f) + s4-0 + 2 + ) + 0.0 + ) + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + ((< (-> self time-dist-too-far) (the-as uint 600)) + (+! (-> self time-dist-too-far) 1) + ) + ((cam-string-find-position-rel! gp-0) + (cam-string-set-position-rel! gp-0) + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + (else + (format 0 "camera position search failed~%") + (set! (-> self time-dist-too-far) (the-as uint 0)) + 0 + ) + ) + ) + (none) + ) + +;; definition for function cam-string-move +;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16 +;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16 +;; Used lq/sq +(defbehavior cam-string-move camera-slave () + (local-vars (sv-240 float) (sv-256 float)) + (vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans)) + (if *display-cam-los-debug* + (format *stdcon* "vel ~M~%" (vector-length (-> self velocity))) + ) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-0 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (vector+float*! s5-1 (-> self velocity) s3-0 (the-as float 0.5)) + (vector-normalize! s5-1 (the-as float 1.0)) + (vector-normalize-copy! s4-1 (-> self view-flat) (the-as float 1.0)) + (vector-cross! gp-1 s4-1 s5-1) + (cond + ((and + (< + (vector-length (-> self velocity)) + (-> *CAMERA-bank* min-detectable-velocity) + ) + (< (vector-length s3-0) (-> *CAMERA-bank* min-detectable-velocity)) + ) + (set! (-> self string-vel-dir) (the-as uint 0)) + 0 + ) + ((< + (cos (the-as float 5461.3335)) + (vector-dot (-> *camera* local-down) s5-1) + ) + (set! (-> self string-vel-dir) (the-as uint 4)) + ) + ((< + (vector-dot (-> *camera* local-down) s5-1) + (- (cos (the-as float 5461.3335))) + ) + (set! (-> self string-vel-dir) (the-as uint 3)) + ) + ((< (cos (the-as float 5461.3335)) (vector-dot s4-1 s5-1)) + (set! (-> self string-vel-dir) (the-as uint 6)) + ) + ((< (vector-dot s4-1 s5-1) (- (cos (the-as float 5461.3335)))) + (set! (-> self string-vel-dir) (the-as uint 5)) + ) + ((< (vector-dot (-> *camera* local-down) gp-1) 0.0) + (set! (-> self string-vel-dir) (the-as uint 1)) + ) + (else + (set! (-> self string-vel-dir) (the-as uint 2)) + ) + ) + ) + 0.0 + (let ((f30-2 1.0) + (s5-2 (new-stack-vector0)) + (gp-2 0) + ) + (let ((s4-2 (new 'stack-no-clear 'collide-mesh-cache-tri)) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (when *debug-segment* + (if + (>= + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + (cam-collision-record-save + (-> self string-trans) + (-> self velocity) + -1 + 'no-hit + self + ) + ) + ) + (while + (and + (< 0.01 f30-2) + (and + (< + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + (< gp-2 4) + ) + ) + (vector-float*! s5-2 (-> self velocity) f30-2) + (if *debug-segment* + (cam-collision-record-save (-> self string-trans) s5-2 gp-2 'normal self) + ) + (let ((f28-1 (if (logtest? (-> self options) 32) + (dummy-10 + *collide-cache* + (-> self string-trans) + s5-2 + (-> *CAMERA-bank* collide-move-rad) + #x4a09 + (the-as process #f) + s4-2 + 2 + ) + -100000000.0 + ) + ) + ) + (when *display-cam-los-debug* + (let ((s2-0 format) + (s1-0 *stdcon*) + (s0-0 "vp ~f vr ~f r ~f ta ~f~%") + ) + (set! sv-240 (vector-length s5-2)) + (set! sv-256 f30-2) + (let ((t0-3 (/ (vector-length s5-2) f30-2)) + (t1-1 f28-1) + ) + (s2-0 s1-0 s0-0 sv-240 sv-256 t0-3 t1-1) + ) + ) + ) + (cond + ((>= f28-1 0.0) + (let* ((f1-7 (fmax 0.01 (/ 40.96 (vector-length s5-2)))) + (f0-24 (fmax 0.0 (- f28-1 f1-7))) + ) + (vector+float*! + (-> self string-trans) + (-> self string-trans) + s5-2 + f0-24 + ) + ) + (vector-! s3-1 (-> self string-trans) (-> s4-2 normal)) + (vector-normalize! s3-1 (the-as float 1.0)) + (vector-flatten! (-> self velocity) (-> self velocity) s3-1) + (set! f30-2 (- f30-2 (* f30-2 f28-1))) + (+! gp-2 1) + ) + (else + (vector+! (-> self string-trans) (-> self string-trans) s5-2) + (set! f30-2 0.0) + ) + ) + ) + ) + ) + (cond + ((zero? gp-2) + (set! (-> self options) (logand -1025 (-> self options))) + (if *display-cam-los-debug* + (format *stdcon* "not blocked~%") + ) + ) + (else + (logior! (-> self options) 1024) + (if *display-cam-los-debug* + (format *stdcon* "blocked ~D ~f~%" gp-2 f30-2) + ) + (let ((gp-3 (new-stack-vector0)) + (f30-3 (vector-length (-> self view-flat))) + ) + (vector-! gp-3 (-> self string-trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! gp-3 gp-3 (-> *camera* local-down)) + (let ((f28-3 (vector-length gp-3))) + (cond + ((< f28-3 f30-3) + (vector-normalize-copy! (-> self view-flat) gp-3 f28-3) + (set! (-> self min-z-override) f28-3) + f28-3 + ) + (else + (vector-normalize-copy! (-> self view-flat) gp-3 f30-3) + ) + ) + ) + ) + ) + ) + ) + (when *display-cam-los-debug* + (let ((a0-43 (new-stack-vector0))) + (vector-! a0-43 (-> self desired-pos) (-> self string-trans)) + (format *stdcon* "vel ~M~%" (vector-length a0-43)) + ) + ) + ) + +;; definition for function cam-string-code +;; Used lq/sq +(defbehavior cam-string-code camera-slave () + (if *debug-segment* + (cam-debug-reset-coll-tri) + ) + (cam-string-follow) + (if (logtest? (-> self options) 512) + (cam-string-line-of-sight) + ) + (if (not (paused?)) + (cam-string-joystick) + ) + (let ((gp-0 (new-stack-vector0))) + (vector--float*! + gp-0 + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* target-height) (-> self view-off y)) + ) + (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-0) + ) + (if (logtest? (-> self options) 64) + (cam-string-find-hidden) + ) + (cond + ((logtest? (-> self options) 4096) + (when *debug-segment* + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-! a1-1 (-> self good-point) (-> self string-trans)) + (cam-collision-record-save (-> self string-trans) a1-1 -2 'jump self) + ) + ) + (set! (-> self options) (logand -4097 (-> self options))) + (set! (-> self desired-pos quad) (-> self good-point quad)) + (cam-string-move) + (vector-! + (-> self view-flat) + (-> self string-trans) + (-> *camera* tpos-curr-adj) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (let ((f0-2 (vector-length (-> self view-flat)))) + (if (< f0-2 (-> self min-z-override)) + (set! (-> self min-z-override) f0-2) + ) + ) + ) + (else + (cam-string-move) + ) + ) + (TODO-RENAME-17 + (-> self position-spline) + (-> self string-trans) + (the-as float 0.04096) + (the-as float 4096.0) + #t + ) + (cond + ((and (logtest? (-> self options) #x4000) (logtest? (-> self options) 256)) + (TODO-RENAME-21 + (-> self position-spline) + (-> self trans) + (the-as float 102.4) + (the-as float 4096.0) + ) + ) + ((logtest? (-> self options) #x4000) + (TODO-RENAME-21 + (-> self position-spline) + (-> self trans) + (the-as float 40.96) + (the-as float 4096.0) + ) + ) + ((logtest? (-> self options) 256) + (TODO-RENAME-21 + (-> self position-spline) + (-> self trans) + (the-as float 102.4) + (the-as float 2457.6) + ) + ) + (else + (TODO-RENAME-21 + (-> self position-spline) + (-> self trans) + (the-as float 20.48) + (the-as float 2457.6) + ) + ) + ) + ) + +;; definition for function set-string-parms +;; Used lq/sq +(defbehavior set-string-parms camera-slave () + (when (not (-> self string-val-locked)) + (set! (-> self string-min-val quad) (-> *camera* string-min value quad)) + (let ((v0-0 (-> self string-max-val))) + (set! (-> v0-0 quad) (-> *camera* string-max value quad)) + v0-0 + ) + ) + ) + +;; failed to figure out what this is: +(defstate cam-string (camera-slave) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('teleport) + (let ((gp-0 (new-stack-vector0))) + (cam-string-find-position-rel! gp-0) + (cam-string-set-position-rel! gp-0) + ) + ) + (('joystick) + (set! (-> self phony-joystick-x) (the-as float (-> arg3 param 0))) + (set! (-> self phony-joystick-y) (the-as float (-> arg3 param 1))) + (let ((v0-1 (the-as object #t))) + (set! (-> self have-phony-joystick) (the-as symbol v0-1)) + v0-1 + ) + ) + (('set-dist) + (cond + ((-> arg3 param 0) + (set! (-> self string-val-locked) #t) + (set! + (-> self string-min-val quad) + (-> (the-as vector (-> arg3 param 0)) quad) + ) + (set! + (-> self string-max-val quad) + (-> (the-as vector (-> arg3 param 1)) quad) + ) + (set! + (-> self string-max-val x) + (fmax (-> self string-max-val x) (-> self string-min-val x)) + ) + (set! + (-> self string-max-val y) + (fmax (-> self string-max-val y) (-> self string-min-val y)) + ) + (let + ((f0-7 (fmax (-> self string-max-val z) (-> self string-min-val z)))) + (set! (-> self string-max-val z) f0-7) + f0-7 + ) + ) + (else + (set! (-> self string-val-locked) #f) + #f + ) + ) + ) + (('blocked-side?) + (-> self los-state) + ) + (else + (cam-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set-string-parms) + (set! *camera-base-mode* cam-string) + (set! (-> self string-vel-dir) (the-as uint 0)) + (set! (-> self fov) 11650.845) + (set! (-> self los-tgt-spline-pt) (-> *camera* target-spline end-point)) + (set! + (-> self los-tgt-spline-pt-incarnation) + (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) + ) + (set! (-> self min-z-override) (-> self string-max-val z)) + (if (!= (-> *camera* outro-t-step) 0.0) + (set! (-> self min-z-override) (-> self string-min-val z)) + ) + (let ((gp-0 (new-stack-vector0))) + 0.0 + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (let ((f0-7 (-> self string-min-val y)) + (f1-1 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-7 f1-1 (-> self view-off-param))) + ) + (set! + (-> self view-off z) + (lerp + (-> self string-min-val z) + (-> self string-max-val z) + (-> self view-off-param) + ) + ) + (let ((f30-0 (cond + ((!= (-> *camera* outro-t-step) 0.0) + (curve-get-pos! + gp-0 + (-> *camera* outro-exit-value) + (-> *camera* outro-curve) + ) + (vector-! gp-0 gp-0 (-> *camera* tpos-curr-adj)) + (vector-flatten! + (-> self view-flat) + gp-0 + (-> *camera* local-down) + ) + (vector-length (-> self view-flat)) + ) + (else + (vector-flatten! + (-> self view-flat) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-negate! (-> self view-flat) (-> self view-flat)) + 0.0 + ) + ) + ) + ) + (let ((f1-4 (fmin (-> *camera* string-push-z) (-> self min-z-override))) + (f0-17 (-> self view-off z)) + ) + (cond + ((< f30-0 f1-4) + (set! f30-0 f1-4) + ) + ((< f0-17 f30-0) + (set! f30-0 f0-17) + ) + ) + ) + (vector-normalize! (-> self view-flat) f30-0) + (let + ((f30-1 + (/ + (- f30-0 (-> self string-min-val z)) + (- (-> self string-max-val z) (-> self string-min-val z)) + ) + ) + ) + (if (< 1.0 f30-1) + (set! f30-1 1.0) + ) + (if (< f30-1 0.0) + (set! f30-1 0.0) + ) + (let ((f0-22 (-> self string-min-val y)) + (f1-7 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-22 f1-7 f30-1)) + ) + (set! + (-> self view-off z) + (lerp (-> self string-min-val z) (-> self string-max-val z) f30-1) + ) + ) + ) + ) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* target-height) (-> self view-off y)) + ) + (vector+! + (-> self desired-pos) + (-> self desired-pos) + (-> *camera* tpos-curr-adj) + ) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (let ((s4-0 (new 'stack-no-clear 'collide-mesh-cache-tri)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-1 (new 'stack-no-clear 'vector)) + ) + (vector--float*! + s5-0 + (-> *camera* tpos-curr-adj) + (-> *camera* local-down) + (-> *camera* target-height) + ) + (vector-! gp-1 (-> self string-trans) s5-0) + (let + ((f0-31 + (dummy-10 + *collide-cache* + s5-0 + gp-1 + (-> *CAMERA-bank* collide-move-rad) + #x4a09 + (the-as process #f) + s4-0 + 4098 + ) + ) + ) + (when (and (< 0.0 f0-31) (< f0-31 1.0)) + (vector-float*! gp-1 gp-1 f0-31) + (vector-flatten! (-> self view-flat) gp-1 (-> *camera* local-down)) + (let ((f0-32 (vector-length (-> self view-flat)))) + (cond + ((< f0-32 8192.0) + (let ((gp-2 (new-stack-vector0))) + (cam-string-find-position-rel! gp-2) + (cam-string-set-position-rel! gp-2) + ) + ) + (else + (if (< f0-32 (-> self min-z-override)) + (set! (-> self min-z-override) f0-32) + ) + (let + ((f30-2 + (/ + (- f0-32 (-> self string-min-val z)) + (- (-> self string-max-val z) (-> self string-min-val z)) + ) + ) + ) + (if (< 1.0 f30-2) + (set! f30-2 1.0) + ) + (if (< f30-2 0.0) + (set! f30-2 0.0) + ) + (let ((f0-36 (-> self string-min-val y)) + (f1-16 (-> self string-max-val y)) + ) + (set! (-> self view-off y) (lerp f0-36 f1-16 f30-2)) + ) + (set! + (-> self view-off z) + (lerp (-> self string-min-val z) (-> self string-max-val z) f30-2) + ) + ) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (+ (-> *camera* target-height) (-> self view-off y)) + ) + (vector+! + (-> self desired-pos) + (-> self desired-pos) + (-> *camera* tpos-curr-adj) + ) + (set! (-> self string-trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + ) + ) + ) + ) + ) + ) + (set! (-> self trans quad) (-> self string-trans quad)) + (set! (-> self los-last-pos quad) (-> self string-trans quad)) + (TODO-RENAME-10 (-> self position-spline) (-> self string-trans)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (when (not (paused?)) + (set-string-parms) + (cam-string-code) + (TODO-RENAME-9 (-> self position-spline)) + (set! (-> self have-phony-joystick) #f) + ) + (suspend) + ) + (none) + ) + ) + +;; definition of type cam-stick-bank +(deftype cam-stick-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type cam-stick-bank +(defmethod inspect cam-stick-bank ((obj cam-stick-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tmax-z: (meters ~m)~%" (-> obj max-z)) + (format #t "~Tmin-z: (meters ~m)~%" (-> obj min-z)) + (format #t "~Tmax-y: (meters ~m)~%" (-> obj max-y)) + (format #t "~Tmin-y: (meters ~m)~%" (-> obj min-y)) + obj + ) + +;; definition for symbol *CAM_STICK-bank*, type cam-stick-bank +(define + *CAM_STICK-bank* + (new 'static 'cam-stick-bank + :max-z (meters 30.0) + :min-z (meters 5.0) + :max-y (meters 15.0) + :min-y (meters 2.0) + ) + ) + +;; definition for function cam-stick-code +;; Used lq/sq +(defbehavior cam-stick-code camera-slave () + (cam-calc-follow! (-> self tracking) (-> self trans) #t) + (let ((gp-0 (new-stack-vector0))) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector-! + gp-0 + (-> self view-flat) + (vector-float*! gp-0 (-> *camera* local-down) (-> self view-off y)) + ) + (vector+! (-> self desired-pos) (-> self tracking follow-pt) gp-0) + ) + (let ((v1-3 (new-stack-vector0)) + (gp-1 (new-stack-vector0)) + ) + (vector-! v1-3 (-> self desired-pos) (-> self trans)) + (vector-float*! v1-3 v1-3 0.2) + (vector-! gp-1 v1-3 (-> self velocity)) + (if (< 409.6 (vector-length gp-1)) + (vector-normalize! gp-1 (the-as float 409.6)) + ) + (vector+! (-> self velocity) (-> self velocity) gp-1) + ) + 0.0 + (let ((f30-1 1.0) + (gp-2 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + (s4-0 4) + (s2-0 0) + ) + (let ((s3-0 (new 'stack-no-clear 'collide-mesh-cache-tri))) + (while + (and + (< 0.01 f30-1) + (and + (< + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + (> s4-0 0) + ) + ) + (+! s4-0 -1) + (vector-float*! gp-2 (-> self velocity) f30-1) + (let ((f28-0 (if (logtest? (-> self options) 32) + (dummy-10 + *collide-cache* + (-> self trans) + gp-2 + (-> *CAMERA-bank* collide-move-rad) + #x4a09 + (the-as process #f) + s3-0 + 2 + ) + -100000000.0 + ) + ) + ) + (cond + ((>= f28-0 0.0) + (vector+float*! (-> self trans) (-> self trans) gp-2 f28-0) + (set! (-> s5-0 quad) (-> s3-0 bbox4w min quad)) + (vector-flatten! (-> self velocity) (-> self velocity) s5-0) + (set! f30-1 (- f30-1 (* f30-1 f28-0))) + (set! s2-0 1) + ) + (else + (vector+! (-> self trans) (-> self trans) gp-2) + (set! f30-1 0.0) + ) + ) + ) + ) + ) + (when (nonzero? s2-0) + 0 + (let ((gp-3 (new-stack-vector0))) + 0.0 + (vector-! gp-3 (-> self trans) (-> self tracking follow-pt)) + (vector-flatten! gp-3 gp-3 (-> *camera* local-down)) + (let + ((f0-14 + (/ + (- (vector-length gp-3) (-> *CAM_STICK-bank* min-z)) + (- (-> *CAM_STICK-bank* max-z) (-> *CAM_STICK-bank* min-z)) + ) + ) + ) + (cond + ((< f0-14 0.0) + (set! f0-14 0.0) + ) + ((< 1.0 f0-14) + (set! f0-14 1.0) + ) + ) + (cond + ((< (- f0-14 (-> self view-off-param)) -0.001) + (set! (-> self view-off-param) f0-14) + ) + ((< 0.001 (- f0-14 (-> self view-off-param))) + (vector-normalize-copy! (-> self view-flat) gp-3 (-> self view-off z)) + ) + ) + ) + ) + ) + ) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #t + ) + (none) + ) + +;; failed to figure out what this is: +(defstate cam-stick (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> self view-off-param) (-> *camera* view-off-param-save)) + (set! (-> self view-off x) 0.0) + (set! + (-> self view-off y) + (lerp + (-> *CAM_STICK-bank* min-y) + (-> *CAM_STICK-bank* max-y) + (-> self view-off-param) + ) + ) + (set! + (-> self view-off z) + (lerp + (-> *CAM_STICK-bank* min-z) + (-> *CAM_STICK-bank* max-z) + (-> self view-off-param) + ) + ) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (vector-flatten! + (-> self view-flat) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (-> self view-off y) + ) + (vector+! + (-> self desired-pos) + (-> self desired-pos) + (-> self tracking follow-pt) + ) + (set! (-> self trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (set! (-> self blend-from-type) (the-as uint 2)) + (set! (-> self blend-to-type) (the-as uint 2)) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (when (not (paused?)) + (when *camera-read-analog* + (let + ((f0-0 + (analog-input + (the-as int (-> *cpad-list* cpads 0 righty)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (the-as float 0.05) + ) + ) + ) + (cond + ((< (* 0.05 (- 1.0 (-> self view-off-param))) f0-0) + (+! (-> self view-off-param) (* 0.05 (- 1.0 (-> self view-off-param)))) + ) + ((< f0-0 (* 0.05 (- (-> self view-off-param)))) + (+! (-> self view-off-param) (* 0.05 (- (-> self view-off-param)))) + ) + (else + (+! (-> self view-off-param) f0-0) + ) + ) + ) + ) + (set! + (-> self view-off y) + (lerp + (-> *CAM_STICK-bank* min-y) + (-> *CAM_STICK-bank* max-y) + (-> self view-off-param) + ) + ) + (set! + (-> self view-off z) + (lerp + (-> *CAM_STICK-bank* min-z) + (-> *CAM_STICK-bank* max-z) + (-> self view-off-param) + ) + ) + (when *camera-read-analog* + (let + ((f0-16 + (analog-input + (the-as int (-> *cpad-list* cpads 0 rightx)) + (the-as float 128.0) + (the-as float 32.0) + (the-as float 110.0) + (* 21845.334 (-> *display* seconds-per-frame)) + ) + ) + (gp-0 (new-stack-matrix0)) + (s3-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + (s4-0 (new-stack-vector0)) + ) + (cond + ((!= f0-16 0.0) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-16) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + ((logtest? (-> self options) 1) + (set-vector! s5-0 0.0 0.0 1.0 1.0) + (vector-normalize-copy! s5-0 (-> self view-flat) (the-as float 1.0)) + (set! (-> s3-0 quad) (-> *camera* tgt-rot-mat vector 2 quad)) + (vector-flatten! s3-0 s3-0 (-> *camera* local-down)) + (vector-negate! s3-0 s3-0) + (set! (-> s4-0 quad) (-> s5-0 quad)) + (vector-normalize-copy! s4-0 s3-0 (the-as float 1.0)) + (matrix-from-two-vectors-max-angle-partial! + gp-0 + s5-0 + s4-0 + (* 10922.667 (-> *display* seconds-per-frame)) + (the-as float 0.05) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + ) + ) + ) + ) + (none) + ) + :code + (behavior () + (while #t + (if (not (paused?)) + (cam-stick-code) + ) + (suspend) + ) + (none) + ) + ) + +;; definition of type cam-bike-bank +(deftype cam-bike-bank (basic) + ((max-z meters :offset-assert 4) + (min-z meters :offset-assert 8) + (max-y meters :offset-assert 12) + (min-y meters :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +;; definition for method 3 of type cam-bike-bank +(defmethod inspect cam-bike-bank ((obj cam-bike-bank)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tmin-z: (meters ~m)~%" (-> obj max-z)) + (format #t "~Tmax-z: (meters ~m)~%" (-> obj min-z)) + (format #t "~Tmin-y: (meters ~m)~%" (-> obj max-y)) + (format #t "~Tmax-y: (meters ~m)~%" (-> obj min-y)) + obj + ) + +;; definition for symbol *CAM_BIKE-bank*, type cam-bike-bank +(define + *CAM_BIKE-bank* + (new 'static 'cam-bike-bank + :max-z (meters 6.0) + :min-z (meters 10.0) + :max-y (meters 3.0) + :min-y (meters 5.0) + ) + ) + +;; definition for function cam-calc-bike-follow! +(defbehavior + cam-calc-bike-follow! camera-slave + ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) + (vector-float*! + (-> arg0 follow-off) + (-> *camera* tgt-face-mat vector 2) + 155648.0 + ) + (vector+! + (-> arg0 follow-pt) + (-> *camera* tpos-curr-adj) + (-> arg0 follow-off) + ) + (vector--float*! + (-> arg0 follow-pt) + (-> arg0 follow-pt) + (-> *camera* local-down) + (+ 12288.0 (-> *camera* target-height)) + ) + (-> arg0 follow-pt) + ) + +;; definition for function cam-bike-code +;; Used lq/sq +(defbehavior cam-bike-code camera-slave () + (let ((s4-0 (new-stack-matrix0))) + (let ((gp-0 (new-stack-vector0)) + (s5-0 (new-stack-vector0)) + ) + (vector-normalize-copy! gp-0 (-> self view-flat) (the-as float 1.0)) + (vector-flatten! + s5-0 + (-> *camera* tgt-rot-mat vector 2) + (-> *camera* local-down) + ) + (vector-normalize! s5-0 (the-as float -1.0)) + (matrix-from-two-vectors-partial-linear! s4-0 gp-0 s5-0 (the-as float 0.2)) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) + ) + (let ((gp-1 (new-stack-vector0))) + 0.0 + (vector-! gp-1 (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj)) + (let ((f30-0 (vector-length gp-1))) + (set! + (-> self view-off z) + (lerp-clamp + (-> *CAM_BIKE-bank* max-z) + (-> *CAM_BIKE-bank* min-z) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) + ) + ) + (set! + (-> self view-off y) + (lerp-clamp + (-> *CAM_BIKE-bank* max-y) + (-> *CAM_BIKE-bank* min-y) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) + ) + ) + ) + (vector-flatten! + (-> self view-flat) + (-> self view-flat) + (-> *camera* local-down) + ) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector-! + gp-1 + (-> self view-flat) + (vector-float*! gp-1 (-> *camera* local-down) (-> self view-off y)) + ) + (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-1) + ) + (let ((v1-20 (new-stack-vector0)) + (gp-2 (new-stack-vector0)) + ) + (vector-! v1-20 (-> self desired-pos) (-> self trans)) + (vector-float*! v1-20 v1-20 0.2) + (vector-! gp-2 v1-20 (-> self velocity)) + (if (< 409.6 (vector-length gp-2)) + (vector-normalize! gp-2 (the-as float 409.6)) + ) + (vector+! (-> self velocity) (-> self velocity) gp-2) + ) + 0.0 + (let ((f30-2 1.0) + (gp-3 (new-stack-vector0)) + (s5-3 4) + (s4-3 (new 'stack-no-clear 'collide-mesh-cache-tri)) + ) + (while + (and + (< 0.01 f30-2) + (and + (< + (-> *CAMERA-bank* min-detectable-velocity) + (vector-length (-> self velocity)) + ) + (> s5-3 0) + ) + ) + (+! s5-3 -1) + (vector-float*! gp-3 (-> self velocity) f30-2) + (let ((f28-0 (if (logtest? (-> self options) 32) + (dummy-10 + *collide-cache* + (-> self trans) + gp-3 + (the-as float 4096.0) + #x4a09 + (the-as process #f) + s4-3 + 2 + ) + -100000000.0 + ) + ) + ) + (cond + ((>= f28-0 0.0) + (vector+float*! (-> self trans) (-> self trans) gp-3 f28-0) + (vector-flatten! + (-> self velocity) + (-> self velocity) + (the-as vector (-> s4-3 bbox4w)) + ) + (set! f30-2 (- f30-2 (* f30-2 f28-0))) + (let ((s3-2 (new-stack-vector0))) + (vector-! s3-2 (-> self trans) (-> *camera* tpos-curr-adj)) + (vector-flatten! s3-2 s3-2 (-> *camera* local-down)) + (vector-normalize-copy! (-> self view-flat) s3-2 (-> self view-off z)) + ) + ) + (else + (vector+! (-> self trans) (-> self trans) gp-3) + (set! f30-2 0.0) + ) + ) + ) + ) + ) + (cam-calc-bike-follow! (-> self tracking) (-> self trans) #t) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #t + ) + (none) + ) + +;; failed to figure out what this is: +(defstate cam-bike (camera-slave) + :event + cam-standard-event-handler + :enter + (behavior () + (when (not (-> self enter-has-run)) + (set! (-> *camera* foot-offset) 4096.0) + (set! (-> *camera* head-offset) 16384.0) + (set! (-> self view-off x) 0.0) + (set! (-> self view-off y) (-> *CAM_BIKE-bank* max-y)) + (set! (-> self view-off z) (-> *CAM_BIKE-bank* max-z)) + (vector-flatten! + (-> self view-flat) + (-> self tracking inv-mat vector 2) + (-> *camera* local-down) + ) + (vector-negate! (-> self view-flat) (-> self view-flat)) + (vector-normalize! (-> self view-flat) (-> self view-off z)) + (vector--float*! + (-> self desired-pos) + (-> self view-flat) + (-> *camera* local-down) + (-> self view-off y) + ) + (vector+! + (-> self desired-pos) + (-> self desired-pos) + (-> *camera* tpos-curr-adj) + ) + (set! (-> self trans quad) (-> self desired-pos quad)) + (vector-reset! (-> self velocity)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (the-as uint 1)) + (cam-calc-bike-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self options)) + (-> self fov) + #f + ) + ) + (none) + ) + :trans + (behavior () + (if (zero? (logand (-> *camera* master-options) 2)) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code + (behavior () + (while #t + (if (not (paused?)) + (cam-bike-code) + ) + (suspend) + ) + (none) + ) + ) + +;; definition for symbol *camera-base-mode*, type state +(define *camera-base-mode* (the-as state cam-string)) diff --git a/test/decompiler/reference/engine/camera/camera-h_REF.gc b/test/decompiler/reference/engine/camera/camera-h_REF.gc index 5b8f5cfd63..da126ddb26 100644 --- a/test/decompiler/reference/engine/camera/camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/camera-h_REF.gc @@ -158,8 +158,8 @@ (:methods (TODO-RENAME-9 (_type_) none 9) (TODO-RENAME-10 (_type_ vector) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) + (print-nth-point (_type_ int) none 11) + (TODO-RENAME-12 (_type_) none 12) (TODO-RENAME-13 (_type_ int) none 13) (TODO-RENAME-14 (_type_ vector) none 14) (TODO-RENAME-15 (_type_) none 15) @@ -170,7 +170,7 @@ (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) + (TODO-RENAME-23 (_type_) none 23) ) ) @@ -628,15 +628,15 @@ (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) + (drawable-target handle :offset-assert 320) (which-bone int32 :offset-assert 328) - (pov-handle uint64 :offset-assert 336) + (pov-handle handle :offset-assert 336) (pov-bone int32 :offset-assert 344) - (being-attacked basic :offset-assert 348) + (being-attacked symbol :offset-assert 348) (attack-start uint64 :offset-assert 352) - (on-ground basic :offset-assert 360) + (on-ground symbol :offset-assert 360) (under-water int32 :offset-assert 364) - (on-pole basic :offset-assert 368) + (on-pole symbol :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) diff --git a/test/decompiler/reference/engine/camera/camera_REF.gc b/test/decompiler/reference/engine/camera/camera_REF.gc index daf0d1f910..3f834c9bd1 100644 --- a/test/decompiler/reference/engine/camera/camera_REF.gc +++ b/test/decompiler/reference/engine/camera/camera_REF.gc @@ -203,7 +203,7 @@ ) ;; definition for function cam-slave-get-rot -(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 quaternion)) +(defun cam-slave-get-rot ((arg0 entity-actor) (arg1 matrix)) (let ((s4-0 (method-of-type res-lump get-property-struct)) (s3-0 arg0) ) @@ -226,11 +226,11 @@ (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) + (quaternion->matrix arg1 s4-1) ) ) (else - (quaternion->matrix (the-as matrix arg1) (-> arg0 quat)) + (quaternion->matrix arg1 (-> arg0 quat)) ) ) ) @@ -827,16 +827,16 @@ (< f0-4 1.0) ) (set! (-> arg2 partial-pt) f0-4) - (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler))) (let ((a2-5 (-> obj point (-> arg2 cur-pt) next))) (vector-lerp! - s5-0 + (the-as vector s5-0) (the-as vector (-> obj point (-> arg2 cur-pt))) (the-as vector (-> obj point a2-5)) f0-4 ) ) - (vector+! arg1 arg1 s5-0) + (vector+! arg1 arg1 (the-as vector s5-0)) ) (return arg1) ) diff --git a/test/decompiler/reference/engine/camera/pov-camera-h_REF.gc b/test/decompiler/reference/engine/camera/pov-camera-h_REF.gc index b6a78dc171..43181b2240 100644 --- a/test/decompiler/reference/engine/camera/pov-camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/pov-camera-h_REF.gc @@ -3,29 +3,30 @@ ;; definition of type pov-camera (deftype pov-camera (process-drawable) - ((flags int32 :offset-assert 176) - (debounce-start-time uint64 :offset-assert 184) - (notify-handle uint64 :offset-assert 192) - (anim-name basic :offset-assert 200) - (command-list basic :offset-assert 204) - (mask-to-clear uint32 :offset-assert 208) - (music-volume-movie float :offset-assert 212) - (sfx-volume-movie float :offset-assert 216) + ((cspace-array cspace-array :offset 112) + (flags int32 :offset-assert 176) + (debounce-start-time uint64 :offset-assert 184) + (notify-handle handle :offset-assert 192) + (anim-name string :offset-assert 200) + (command-list pair :offset-assert 204) + (mask-to-clear uint32 :offset-assert 208) + (music-volume-movie float :offset-assert 212) + (sfx-volume-movie float :offset-assert 216) ) :heap-base #x70 :method-count-assert 30 :size-assert #xdc :flag-assert #x1e007000dc (:methods - (dummy-20 () none 20) - (dummy-21 () none 21) - (pov-camera-playing () none 22) - (dummy-23 () none 23) - (dummy-24 () none 24) - (dummy-25 () none 25) - (dummy-26 () none 26) + (pov-camera-abort () _type_ :state 20) + (pov-camera-done-playing () _type_ :state 21) + (pov-camera-playing () _type_ :state 22) + (pov-camera-start-playing () _type_ :state 23) + (pov-camera-startup () _type_ :state 24) + (TODO-RENAME-25 (_type_) symbol 25) + (target-grabbed? (_type_) symbol 26) (dummy-27 () none 27) - (dummy-28 () none 28) + (target-released? () symbol 28) (dummy-29 () none 29) ) ) diff --git a/test/decompiler/reference/engine/camera/pov-camera_REF.gc b/test/decompiler/reference/engine/camera/pov-camera_REF.gc new file mode 100644 index 0000000000..a779b39c55 --- /dev/null +++ b/test/decompiler/reference/engine/camera/pov-camera_REF.gc @@ -0,0 +1,426 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 25 of type pov-camera +(defmethod TODO-RENAME-25 pov-camera ((obj pov-camera)) + (when + (or + (and + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> obj debounce-start-time)) + ) + 60 + ) + (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + ) + (logtest? (-> obj flags) 2) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (when (logtest? (-> obj flags) 1) + (send-event (handle->process (-> obj notify-handle)) 'notify 'abort-request) + #t + ) + ) + ) + +;; definition for method 26 of type pov-camera +(defmethod target-grabbed? pov-camera ((obj pov-camera)) + (or (not *target*) (process-grab? *target*)) + ) + +;; definition for method 28 of type pov-camera +(defmethod target-released? pov-camera () + (or (not *target*) (process-release? *target*)) + ) + +;; failed to figure out what this is: +(defstate pov-camera-startup (pov-camera) + :virtual #t + :code + (behavior () + (go-virtual pov-camera-start-playing) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate pov-camera-start-playing (pov-camera) + :virtual #t + :code + (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (while (not (target-grabbed? self)) + (suspend) + ) + (let ((gp-0 0)) + (let ((v1-7 (dummy-10 (-> self draw jgeo) "camera" (the-as type #f)))) + (if v1-7 + (set! gp-0 (+ (-> v1-7 number) 1)) + ) + ) + (let* ((s5-0 (get-process *default-dead-pool* othercam #x4000)) + (v1-10 (when s5-0 + (let ((t9-3 (method-of-type othercam activate))) + (t9-3 + (the-as othercam s5-0) + self + 'othercam + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + s5-0 + othercam-init-by-other + self + gp-0 + #t + #t + ) + (-> s5-0 ppointer) + ) + ) + ) + (send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear)) + ) + ) + (go-virtual pov-camera-playing) + (none) + ) + ) + +;; definition for function pov-camera-play-and-reposition +;; INFO: Return type mismatch int vs none. +(defbehavior + pov-camera-play-and-reposition pov-camera + ((arg0 joint-anim-compressed) (arg1 vector) (arg2 float)) + (let ((s4-0 #f)) + (let ((v1-2 (-> self skel root-channel 0))) + (set! (-> v1-2 frame-group) (the-as art-joint-anim arg0)) + (set! (-> v1-2 param 0) (the float (+ (-> arg0 data 9 unknown-half) -1))) + (set! (-> v1-2 param 1) arg2) + (set! (-> v1-2 frame-num) 0.0) + (joint-control-channel-group! + v1-2 + (the-as art-joint-anim arg0) + num-func-seek! + ) + ) + (until (ja-done? 0) + (let + ((v1-4 + (and + (not s4-0) + (< (the float (+ (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + data + 0 + length + ) + -4 + ) + ) + (ja-frame-num 0) + ) + ) + ) + ) + (when v1-4 + (set! s4-0 #t) + (send-event *camera* 'teleport-to-vector-start-string arg1) + ) + ) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) arg2) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate pov-camera-playing (pov-camera) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (when (= v1-0 'abort) + (when (logtest? (-> self flags) 1) + (logior! (-> self flags) 2) + (if (= (-> self anim-name type) string) + (go-virtual pov-camera-abort) + ) + ) + ) + ) + ) + ) + :enter + (behavior () + (set! + (-> self debounce-start-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (if (= (-> self anim-name type) string) + (backup-load-state-and-set-cmds *load-state* (-> self command-list)) + ) + (none) + ) + :exit + (behavior () + (if (= (-> self anim-name type) string) + (restore-load-state-and-cleanup *load-state*) + ) + (clear-pending-settings-from-process *setting-control* self 'music-volume) + (clear-pending-settings-from-process *setting-control* self 'sfx-volume) + (none) + ) + :code + (behavior () + (push-setting! + *setting-control* + self + 'music-volume + 'rel + (-> self music-volume-movie) + 0 + ) + (push-setting! + *setting-control* + self + 'sfx-volume + 'rel + (-> self sfx-volume-movie) + 0 + ) + (cond + ((= (-> self anim-name type) string) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 frame-group) (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + (set! + (-> a0-4 param 0) + (the float (+ (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-4 param 1) 1.0) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! + a0-4 + (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-25 self) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) 1.0) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (-> self anim-name type) spool-anim) + (ja-play-spooled-anim + (the-as spool-anim (-> self anim-name)) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (method-of-object self TODO-RENAME-25) + ) + ) + ) + (go-virtual pov-camera-done-playing) + (none) + ) + :post + (behavior () + (if (= (-> self anim-name type) string) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + ) + (ja-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate pov-camera-abort (pov-camera) + :virtual #t + :enter + (behavior () + (logior! (-> self flags) 2) + (none) + ) + :code + (behavior () + (set-blackout-frames 10) + (suspend) + (suspend) + (go-virtual pov-camera-done-playing) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate pov-camera-done-playing (pov-camera) + :virtual #t + :code + (behavior () + (while (begin + self + (not ((method-of-object self target-released?))) + ) + (suspend) + ) + (send-event (handle->process (-> self notify-handle)) 'notify 'die) + (suspend) + (suspend) + (dummy-18 self) + (deactivate self) + (none) + ) + ) + +;; definition for method 27 of type pov-camera +;; INFO: Return type mismatch int vs none. +(defmethod dummy-27 pov-camera () + 0 + (none) + ) + +;; definition for method 29 of type pov-camera +;; INFO: Return type mismatch symbol vs none. +(defmethod dummy-29 pov-camera () + (none) + ) + +;; definition for function pov-camera-init-by-other +;; Used lq/sq +(defbehavior + pov-camera-init-by-other pov-camera + ((arg0 vector) + (arg1 skeleton-group) + (arg2 string) + (arg3 int) + (arg4 process-drawable) + (arg5 pair) + ) + ((method-of-object self dummy-29)) + (set! (-> *game-info* pov-camera-handle) (process->handle self)) + (set! (-> self flags) arg3) + (set! (-> self command-list) arg5) + (set! (-> self music-volume-movie) 100.0) + (set! (-> self sfx-volume-movie) 100.0) + (if arg4 + (set! (-> self notify-handle) (process->handle arg4)) + (set! (-> self notify-handle) (the-as handle #f)) + ) + (set! + (-> self debounce-start-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (logclear! + (-> self mask) + (process-mask actor-pause movie enemy platform projectile) + ) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg0 quad)) + (when (logtest? (-> self flags) 4) + (let + ((v1-20 + (if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable)) + arg4 + ) + ) + ) + (quaternion-copy! (-> self root quat) (-> v1-20 root quat)) + ) + ) + (dummy-14 self arg1 '()) + (logior! (-> self draw status) 32) + (logior! (-> self skel status) 1) + (set! (-> self anim-name) arg2) + (cond + ((= (-> arg2 type) string) + (logior! (-> self skel status) 32) + (let ((s5-1 (dummy-10 (-> self draw art-group) arg2 art-joint-anim))) + (if (not s5-1) + (go process-drawable-art-error arg2) + ) + (ja-channel-set! 1) + (set! + (-> self skel root-channel 0 frame-group) + (the-as art-joint-anim s5-1) + ) + ) + ) + ((= (-> arg2 type) spool-anim) + ) + ) + (set! (-> self mask-to-clear) (the-as uint #x4a0800)) + (set! + (-> self event-hook) + (lambda :behavior pov-camera + ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'mask) + (let ((v0-0 (the-as number (-> arg3 param 0)))) + (set! (-> self mask-to-clear) (the-as uint v0-0)) + v0-0 + ) + ) + ((= v1-0 'music-movie-volume) + (let ((f0-0 (the-as float (-> arg3 param 0)))) + (set! (-> self music-volume-movie) f0-0) + f0-0 + ) + ) + ((= v1-0 'sfx-movie-volume) + (let ((f0-1 (the-as float (-> arg3 param 0)))) + (set! (-> self sfx-volume-movie) f0-1) + f0-1 + ) + ) + ) + ) + ) + ) + ) + ((method-of-object self dummy-27)) + (go-virtual pov-camera-startup) + (none) + ) diff --git a/test/decompiler/reference/engine/data/art-h_REF.gc b/test/decompiler/reference/engine/data/art-h_REF.gc index bec132a8af..25c3c3a02f 100644 --- a/test/decompiler/reference/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/engine/data/art-h_REF.gc @@ -118,6 +118,7 @@ ;; definition of type joint-anim-compressed-hdr (deftype joint-anim-compressed-hdr (structure) ((control-bits uint32 14 :offset-assert 0) + (unknown-half int16 :offset 6) (num-joints uint32 :offset-assert 56) (matrix-bits uint32 :offset-assert 60) ) diff --git a/test/decompiler/reference/engine/geometry/cylinder_REF.gc b/test/decompiler/reference/engine/geometry/cylinder_REF.gc index 99e20f2c74..f259a9c9c0 100644 --- a/test/decompiler/reference/engine/geometry/cylinder_REF.gc +++ b/test/decompiler/reference/engine/geometry/cylinder_REF.gc @@ -72,7 +72,7 @@ ;; definition for method 9 of type cylinder ;; INFO: Return type mismatch int vs none. ;; Used lq/sq -(defmethod debug-draw cylinder ((obj cylinder) (arg0 vector)) +(defmethod debug-draw cylinder ((obj cylinder) (arg0 vector4w)) (local-vars (sv-896 matrix) (sv-912 int) @@ -310,7 +310,7 @@ ;; definition for method 9 of type cylinder-flat ;; INFO: Return type mismatch int vs none. ;; Used lq/sq -(defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector)) +(defmethod debug-draw cylinder-flat ((obj cylinder-flat) (arg0 vector4w)) (local-vars (sv-448 vector) (sv-464 int)) (rlet ((vf0 :class vf) (vf4 :class vf) diff --git a/test/decompiler/reference/engine/geometry/vol-h_REF.gc b/test/decompiler/reference/engine/geometry/vol-h_REF.gc index 00c72d435a..52696e236a 100644 --- a/test/decompiler/reference/engine/geometry/vol-h_REF.gc +++ b/test/decompiler/reference/engine/geometry/vol-h_REF.gc @@ -3,7 +3,7 @@ ;; definition of type plane-volume (deftype plane-volume (structure) - ((volume-type basic :offset-assert 0) + ((volume-type symbol :offset-assert 0) (point-count int16 :offset-assert 4) (normal-count int16 :offset-assert 6) (first-point vector :offset-assert 8) diff --git a/test/decompiler/reference/engine/math/vector-h_REF.gc b/test/decompiler/reference/engine/math/vector-h_REF.gc index 179bf1d461..9d0d6fd3b1 100644 --- a/test/decompiler/reference/engine/math/vector-h_REF.gc +++ b/test/decompiler/reference/engine/math/vector-h_REF.gc @@ -513,7 +513,8 @@ ;; definition of type vector-array (deftype vector-array (inline-array-class) - () + ((data vector :inline :dynamic :offset 16) + ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 @@ -524,7 +525,7 @@ (format #t "[~8x] ~A~%" obj (-> obj type)) (format #t "~Tlength: ~D~%" (-> obj length)) (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) - (format #t "~Tdata[0] @ #x~X~%" (-> obj _data)) + (format #t "~Tdata[0] @ #x~X~%" (-> obj data)) obj ) @@ -676,7 +677,7 @@ :size-assert #x28 :flag-assert #xb00000028 (:methods - (debug-draw (_type_ vector) none 9) + (debug-draw (_type_ vector4w) none 9) (ray-capsule-intersect (_type_ vector vector) float 10) ) ) @@ -702,7 +703,7 @@ :size-assert #x28 :flag-assert #xb00000028 (:methods - (debug-draw (_type_ vector) none 9) + (debug-draw (_type_ vector4w) none 9) (ray-flat-cyl-intersect (_type_ vector vector) float 10) ) ) diff --git a/test/decompiler/reference/engine/target/target-util_REF.gc b/test/decompiler/reference/engine/target/target-util_REF.gc index 7af5be7f59..7b12f76bdb 100644 --- a/test/decompiler/reference/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/engine/target/target-util_REF.gc @@ -1677,63 +1677,65 @@ ) ;; definition for function target-cam-pos +;; INFO: Return type mismatch object vs vector. ;; Used lq/sq (defun target-cam-pos () (let ((gp-0 *target*)) - (cond - ((not gp-0) - (camera-pos) - ) - ((logtest? (-> gp-0 state-flags) 1024) - (add-debug-sphere - *display-camera-marks* - (bucket-id debug-draw1) - (-> gp-0 alt-cam-pos) - 819.2 - (new 'static 'rgba :r #xff :a #x80) - ) - (-> gp-0 alt-cam-pos) - ) - ((logtest? #x20000 (-> gp-0 state-flags)) - (add-debug-sphere - *display-camera-marks* - (bucket-id debug-draw1) - (-> gp-0 alt-cam-pos) - 819.2 - (new 'static 'rgba :r #xff :a #x80) - ) - (-> gp-0 alt-cam-pos) - ) - ((logtest? #x80000 (-> gp-0 state-flags)) - (let ((s5-0 (the-as object (new 'static 'vector)))) - (set! - (-> (the-as vector s5-0) quad) - (-> (&-> (-> gp-0 control) unknown-qword00) 0) - ) - (set! - (-> (the-as vector s5-0) y) - (fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y)) - ) - (add-debug-sphere - *display-camera-marks* - (bucket-id debug-draw1) - (the-as vector s5-0) - 819.2 - (new 'static 'rgba :r #xff :a #x80) - ) - s5-0 - ) - ) - (else - (add-debug-sphere - *display-camera-marks* - (bucket-id debug-draw1) - (the-as vector (&-> (-> gp-0 control) unknown-qword00)) - 819.2 - (new 'static 'rgba :r #xff :a #x80) - ) - (&-> (-> gp-0 control) unknown-qword00) - ) + (the-as vector (cond + ((not gp-0) + (camera-pos) + ) + ((logtest? (-> gp-0 state-flags) 1024) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-draw1) + (-> gp-0 alt-cam-pos) + 819.2 + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 alt-cam-pos) + ) + ((logtest? #x20000 (-> gp-0 state-flags)) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-draw1) + (-> gp-0 alt-cam-pos) + 819.2 + (new 'static 'rgba :r #xff :a #x80) + ) + (-> gp-0 alt-cam-pos) + ) + ((logtest? #x80000 (-> gp-0 state-flags)) + (let ((s5-0 (the-as object (new 'static 'vector)))) + (set! + (-> (the-as vector s5-0) quad) + (-> (&-> (-> gp-0 control) unknown-qword00) 0) + ) + (set! + (-> (the-as vector s5-0) y) + (fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y)) + ) + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-draw1) + (the-as vector s5-0) + 819.2 + (new 'static 'rgba :r #xff :a #x80) + ) + s5-0 + ) + ) + (else + (add-debug-sphere + *display-camera-marks* + (bucket-id debug-draw1) + (the-as vector (&-> (-> gp-0 control) unknown-qword00)) + 819.2 + (new 'static 'rgba :r #xff :a #x80) + ) + (&-> (-> gp-0 control) unknown-qword00) + ) + ) ) ) ) diff --git a/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc b/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc index 5fd6484f30..1eefa5f868 100644 --- a/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc +++ b/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc @@ -119,17 +119,17 @@ (while (< sv-272 7) (vector+! s4-0 (-> s1-0 sv-272) (-> obj origin)) (vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> obj origin)) - (camera-line s4-0 s3-0 arg0) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) (set! sv-272 (+ sv-272 1)) ) (vector+! s4-0 (-> s1-0 0) (-> obj origin)) - (camera-line s4-0 s3-0 arg0) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) (set! sv-288 0) (while (< sv-288 8) (vector+! s4-0 (-> s1-0 sv-288) (-> obj origin)) (vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0) (vector+! s3-0 (-> s1-0 sv-288) (-> obj origin)) - (camera-line s4-0 s3-0 arg0) + (camera-line s4-0 s3-0 (the-as vector4w arg0)) (set! sv-288 (+ sv-288 1)) ) ) @@ -250,13 +250,7 @@ (camera-line gp-0 s5-0 - (the-as - vector - (new 'static 'vector4w - :data - (new 'static 'array int32 4 #xff #xff 0 #x80) - ) - ) + (new 'static 'vector4w :data (new 'static 'array int32 4 #xff #xff 0 #x80)) ) (set! (-> s5-0 quad) (-> gp-0 quad)) ) diff --git a/test/offline/config.json b/test/offline/config.jsonc similarity index 93% rename from test/offline/config.json rename to test/offline/config.jsonc index 3790fbd28a..49283cadfe 100644 --- a/test/offline/config.json +++ b/test/offline/config.jsonc @@ -104,6 +104,12 @@ // decompiler BUG "level-hint-task-process", + // cam-states + "cam-los-collide", // vector-dot involving the stack + + // cam-layout + "cam-layout-save-cam-trans", // temporary, im sure this can be fixed + // anim-tester "(method 3 anim-tester)", "anim-tester-save-object-seqs", // anim-tester -- new basic on the stack @@ -113,5 +119,8 @@ ], "skip_compile_states": { + "cam-master-active": [ + "event" + ] } -} \ No newline at end of file +} diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index e960a89362..5d0558a9e6 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -65,7 +65,7 @@ struct OfflineTestConfig { * Read and parse the json config file, config.json, located in test/offline */ OfflineTestConfig parse_config() { - auto json_file_path = file_util::get_file_path({"test", "offline", "config.json"}); + auto json_file_path = file_util::get_file_path({"test", "offline", "config.jsonc"}); auto json = parse_commented_json(file_util::read_text_file(json_file_path), json_file_path); OfflineTestConfig result; result.dgos = json["dgos"].get>(); @@ -75,11 +75,6 @@ OfflineTestConfig parse_config() { result.skip_compile_states = json["skip_compile_states"] .get>>(); - - if (!result.skip_compile_states.empty()) { - fmt::print("skip_compile_states wasn't emtpy. It's not implemented in the decompiler yet\n"); - exit(1); - } return result; } @@ -239,7 +234,8 @@ void disassemble(Decompiler& dc) { } void decompile(Decompiler& dc, const OfflineTestConfig& config) { - dc.db->analyze_functions_ir2({}, *dc.config, config.skip_compile_functions); + dc.db->analyze_functions_ir2({}, *dc.config, config.skip_compile_functions, + config.skip_compile_states); } std::string strip_trailing_newlines(const std::string& in) { @@ -393,4 +389,4 @@ int main(int argc, char* argv[]) { } } return 1; -} \ No newline at end of file +} diff --git a/third-party/googletest b/third-party/googletest index 955c7f837e..7153098229 160000 --- a/third-party/googletest +++ b/third-party/googletest @@ -1 +1 @@ -Subproject commit 955c7f837efad184ec63e771c42542d37545eaef +Subproject commit 7153098229e88295f9655ff1d3b0e2fa9eada5f8