diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 3d6e31bcc6..9f539027b8 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -136,6 +136,7 @@ (declare-type sql-result basic) (define-extern sql-query (function string sql-result)) +(define-extern *collapse-quote* symbol) (define-extern loading-level kheap) (define-extern dma-sync (function pointer int int int)) @@ -19135,7 +19136,7 @@ (define-extern reset-light-hash "Resets the global [[*light-hash*]] back to having `0` lights, indicies, and buckets. @returns [[none]]" - (function none)) ;; + (function light-hash none)) ;; (define-extern update-light-hash (function light-hash none)) ;; (define-extern lookup-light-sphere-by-name "Search through a given [[light-hash]]'s lights to find the one that matches the given name @@ -39933,6 +39934,7 @@ :type uint32 (mm0 0) (mm1 1) + (mm2 2) ) ;; ---manipulator:manipulator-mode @@ -39967,7 +39969,7 @@ :flag-assert #xf000000b0 (:methods (set-mode (_type_ manipulator-mode) none) ;; 9 - (manipulator-method-10 (_type_) none) ;; 10 + (manipulator-method-10 (_type_ vector vector) none) ;; 10 (manipulator-method-11 (_type_) none) ;; 11 (manipulator-method-12 (_type_ vector) none) ;; 12 (manipulator-method-13 (_type_ vector vector) none) ;; 13 @@ -40087,6 +40089,7 @@ ) ;; ---editable-h:editable-filter +(declare-type editable-array basic) (deftype editable-region (basic) ((changed symbol :offset-assert 4) ;; guessed by decompiler (locked symbol :offset-assert 8) ;; guessed by decompiler @@ -40094,9 +40097,9 @@ (filter editable-filter :offset-assert 24) ;; guessed by decompiler (tree symbol :offset-assert 28) ;; guessed by decompiler (level string :offset-assert 32) ;; guessed by decompiler - (on-enter string :offset-assert 36) ;; guessed by decompiler - (on-inside string :offset-assert 40) ;; guessed by decompiler - (on-exit string :offset-assert 44) ;; guessed by decompiler + (on-enter pair :offset-assert 36) ;; guessed by decompiler + (on-inside pair :offset-assert 40) ;; guessed by decompiler + (on-exit pair :offset-assert 44) ;; guessed by decompiler ) :method-count-assert 13 :size-assert #x30 @@ -40104,10 +40107,10 @@ ;; field on-enter uses ~A with a signed load. field on-inside uses ~A with a signed load. field on-exit uses ~A with a signed load. (:methods (new (symbol type) _type_) ;; 0 - (editable-region-method-9 () none) ;; 9 ;; (editable-region-method-9 (_type_ editable-array int int) symbol) - (editable-region-method-10 () none) ;; 10 ;; (editable-region-method-10 (_type_ int) symbol) - (editable-region-method-11 () none) ;; 11 ;; (editable-region-method-11 (_type_ vector int) none) - (editable-region-method-12 () none) ;; 12 ;; (editable-region-method-12 (_type_) editable-filter) + (save-region! (_type_ editable-array int int) symbol) ;; 9 ;; (editable-region-method-9 (_type_ editable-array int int) symbol) + (editable-region-method-10 (_type_ int) symbol) ;; 10 ;; (editable-region-method-10 (_type_ int) symbol) + (print-region-info (_type_ vector int) none) ;; 11 ;; (editable-region-method-11 (_type_ vector int) none) + (editable-region-method-12 (_type_) editable-filter) ;; 12 ;; (editable-region-method-12 (_type_) editable-filter) ) ) @@ -40142,33 +40145,33 @@ :size-assert #x1c :flag-assert #x240000001c (:methods - (editable-method-9 () none) ;; 9 ;; (get-color (_type_ int) rgba) - (editable-method-10 () none) ;; 10 ;; (editable-method-10 (_type_) none) - (editable-method-11 () none) ;; 11 ;; (editable-method-11 (_type_ vector) symbol) - (editable-method-12 () none) ;; 12 ;; (select-editable! (_type_ symbol) none) - (editable-method-13 () none) ;; 13 ;; (edit-get-distance (_type_ vector) float) - (editable-method-14 () none) ;; 14 ;; (edit-get-trans (_type_) vector) - (editable-method-15 () none) ;; 15 ;; (editable-method-15 (_type_ vector int) none) - (editable-method-16 () none) ;; 16 ;; (edit-coord! (_type_ vector editable-flag) none) - (editable-method-17 () none) ;; 17 ;; (editable-method-17 (_type_ vector) none) - (editable-method-18 () none) ;; 18 ;; (editable-method-18 (_type_ vector matrix) none) - (editable-method-19 () none) ;; 19 ;; (editable-method-19 (_type_ vector) none) - (editable-method-20 () none) ;; 20 ;; (editable-method-20 (_type_ vector vector vector vector) none) - (editable-method-21 () none) ;; 21 ;; (editable-method-21 (_type_ editable-region) none) - (editable-method-22 () none) ;; 22 ;; (editable-method-22 (_type_ editable-array int int) symbol) - (editable-method-23 () none) ;; 23 ;; (editable-method-23 (_type_) symbol) - (editable-method-24 () none) ;; 24 ;; (editable-method-24 (_type_) none) - (editable-method-25 () none) ;; 25 ;; (editable-method-25 (_type_ editable-array) none) - (editable-method-26 () none) ;; 26 ;; (editable-method-26 (_type_ editable editable-array) none) - (editable-method-27 () none) ;; 27 ;; (editable-method-27 (_type_ editable-array) editable) - (editable-method-28 () none) ;; 28 ;; (editable-method-28 (_type_ editable-filter) none) - (editable-method-29 () none) ;; 29 ;; (editable-method-29 (_type_ editable-filter) symbol) - (editable-method-30 () none) ;; 30 - (editable-method-31 () none) ;; 31 - (editable-method-32 () none) ;; 32 - (editable-method-33 () none) ;; 33 - (editable-method-34 () none) ;; 34 - (editable-method-35 () none) ;; 35 + (get-color (_type_) rgba) ;; 9 ;; (get-color (_type_ int) rgba) + (editable-method-10 (_type_) none) ;; 10 ;; (editable-method-10 (_type_) none) + (editable-method-11 (_type_ vector) symbol) ;; 11 ;; (editable-method-11 (_type_ vector) symbol) + (set-selected! (_type_ symbol) none) ;; 12 ;; (select-editable! (_type_ symbol) none) + (editable-method-13 (_type_ vector) float) ;; 13 ;; (edit-get-distance (_type_ vector) float) + (editable-method-14 (_type_ vector vector) float) ;; 14 ;; (edit-get-trans (_type_) vector) + (editable-method-15 (_type_) vector) ;; 15 ;; (editable-method-15 (_type_ vector int) none) + (editable-method-16 (_type_) float) ;; 16 ;; (edit-coord! (_type_ vector editable-flag) none) + (editable-method-17 (_type_ vector editable-flag) none) ;; 17 ;; (editable-method-17 (_type_ vector) none) + (editable-method-18 (_type_ vector int) none) ;; 18 ;; (editable-method-18 (_type_ vector matrix) none) + (editable-method-19 (_type_ vector) none) ;; 19 ;; (editable-method-19 (_type_ vector) none) + (editable-method-20 (_type_ vector matrix) none) ;; 20 ;; (editable-method-20 (_type_ vector vector vector vector) none) + (editable-method-21 (_type_ vector) none) ;; 21 ;; (editable-method-21 (_type_ editable-region) none) + (editable-method-22 (_type_ vector vector vector vector) none) ;; 22 ;; (editable-method-22 (_type_ editable-array int int) symbol) + (change-region! (_type_ editable-region) none) ;; 23 ;; (editable-method-23 (_type_) symbol) + (editable-method-24 (_type_ editable-array int int) symbol) ;; 24 ;; (editable-method-24 (_type_) none) + (editable-method-25 (_type_) symbol) ;; 25 ;; (editable-method-25 (_type_ editable-array) none) + (editable-method-26 (_type_) none) ;; 26 ;; (editable-method-26 (_type_ editable editable-array) none) + (delete! (_type_ editable) none) ;; 27 ;; (editable-method-27 (_type_ editable-array) editable) + (editable-method-28 (_type_ editable editable) none) ;; 28 ;; (editable-method-28 (_type_ editable-filter) none) + (copy-into-editable-array! (_type_ editable-array) editable) ;; 29 ;; (editable-method-29 (_type_ editable-filter) symbol) + (editable-method-30 (_type_ editable-flag) none) ;; 30 + (editable-method-31 (_type_ editable-flag) none) ;; 31 + (get-null-vec (_type_) vector) ;; 32 + (get-null-vec2 (_type_ vector) vector) ;; 33 + (get-level-offset (_type_ editable-array) vector) ;; 34 + (editable-method-35 (_type_ vector) none) ;; 35 ) ) @@ -40201,17 +40204,17 @@ :flag-assert #x140000007c (:methods (new (symbol type int) _type_) ;; 0 - (editable-array-method-9 () none) ;; 9 ;; (editable-array-method-9 (_type_ editable-command mouse-info) symbol) - (editable-array-method-10 () none) ;; 10 ;; (editable-array-method-10 (_type_ vector int) editable) - (editable-array-method-11 () none) ;; 11 ;; (editable-array-method-11 (_type_) int) - (editable-array-method-12 () none) ;; 12 ;; (editable-array-method-12 (_type_ editable-array) none) - (editable-array-method-13 () none) ;; 13 ;; (editable-array-method-13 (_type_ editable-command editable-command string) none) - (editable-array-method-14 () none) ;; 14 ;; (editable-array-method-14 (_type_ (function editable editable-region symbol) editable-region) (array editable)) - (editable-array-method-15 () none) ;; 15 ;; (editable-array-method-15 (_type_ editable) none) - (editable-array-method-16 () none) ;; 16 ;; (editable-array-method-16 (_type_) none) - (editable-array-method-17 () none) ;; 17 ;; (editable-array-method-17 (_type_ vector vector) vector) - (editable-array-method-18 () none) ;; 18 - (editable-array-method-19 () none) ;; 19 + (handle-cmd (_type_ editable-command mouse-info object) symbol) ;; 9 ;; (editable-array-method-9 (_type_ editable-command mouse-info) symbol) + (editable-array-method-10 (_type_ vector int) editable) ;; 10 ;; (editable-array-method-10 (_type_ vector int) editable) + (editable-array-method-11 (_type_ vector vector int) none) ;; 11 ;; (editable-array-method-11 (_type_) int) + (get-length (_type_) int) ;; 12 ;; (editable-array-method-12 (_type_ editable-array) none) + (editable-array-method-13 (_type_ symbol) symbol) ;; 13 ;; (editable-array-method-13 (_type_ editable-command editable-command string) none) + (editable-array-method-14 (_type_ editable-command editable-command string) none) ;; 14 ;; (editable-array-method-14 (_type_ (function editable editable-region symbol) editable-region) (array editable)) + (editable-array-method-15 (_type_ (function editable editable-region symbol) editable-region) (array editable)) ;; 15 ;; (editable-array-method-15 (_type_ editable) none) + (editable-array-method-16 (_type_ editable) none) ;; 16 ;; (editable-array-method-16 (_type_) none) + (editable-array-method-17 (_type_) none) ;; 17 ;; (editable-array-method-17 (_type_ vector vector) vector) + (editable-array-method-18 (_type_ vector vector) vector) ;; 18 + (editable-array-method-19 (_type_ string) symbol) ;; 19 ) ) @@ -40275,7 +40278,8 @@ :flag-assert #x2500000044 (:methods (new (symbol type vector float editable-region) _type_) ;; 0 - (editable-entity-method-36 () none) ;; 36 + (editable-entity-method-36 (_type_) none) ;; 36 + (copy-into-editable-array! (_type_ editable-array) editable-entity :replace) ) ) @@ -40290,8 +40294,9 @@ :flag-assert #x2600000058 (:methods (new (symbol type editable-region) _type_) ;; 0 - (editable-face-method-36 () none) ;; 36 - (editable-face-method-37 () none) ;; 37 + (editable-face-method-36 (_type_ (inline-array vector)) int) ;; 36 + (editable-face-method-37 (_type_ vector) vector) ;; 37 + (copy-into-editable-array! (_type_ editable-array) editable-face :replace) ) ) @@ -40305,8 +40310,9 @@ :flag-assert #x260000002c (:methods (new (symbol type editable-region) _type_) ;; 0 - (editable-plane-method-36 () none) ;; 36 - (editable-plane-method-37 () none) ;; 37 + (editable-plane-method-36 (_type_ (inline-array vector)) int) ;; 36 + (editable-plane-method-37 (_type_ vector) vector) ;; 37 + (copy-into-editable-array! (_type_ editable-array) editable-plane :replace) ) ) @@ -40314,10 +40320,10 @@ (declare-type editable-array basic) (deftype editable-player (process-drawable) ((current editable-array :offset-assert 200) ;; guessed by decompiler - (current-command uint32 :offset-assert 204) - (select-command function :offset-assert 208) ;; guessed by decompiler + (current-command editable-command :offset-assert 204) + (select-command (function object) :offset-assert 208) ;; guessed by decompiler (drag-command uint32 :offset-assert 212) - (extra-command function :offset-assert 216) ;; guessed by decompiler + (extra-command (function object) :offset-assert 216) ;; guessed by decompiler (left-handed basic :offset-assert 220) (light-names basic :offset-assert 224) (external-cam-mode symbol :offset-assert 228) ;; guessed by decompiler @@ -40338,11 +40344,13 @@ :method-count-assert 24 :size-assert #x234 :flag-assert #x1801c00234 + (:state-methods + idle + ) (:methods - (editable-player-method-20 () none) ;; 20 ;; (idle () _type_ :state) - (editable-player-method-21 () none) ;; 21 ;; (editable-player-method-21 (_type_) none) - (editable-player-method-22 () none) ;; 22 - (editable-player-method-23 () none) ;; 23 + (editable-player-method-21 (_type_) none) ;; 21 ;; (editable-player-method-21 (_type_) none) + (editable-player-method-22 (_type_) none) ;; 22 + (editable-player-method-23 (_type_) symbol) ;; 23 ) ) @@ -40371,43 +40379,43 @@ ;; editable ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern common-owner function) -;; (define-extern update-light-sphere-from-editable-light function) ;; (function editable-light none) -;; (define-extern load-editable-lights function) -;; (define-extern *editable-sample-region* object) ;; editable-region -;; (define-extern *editable-light-region* object) ;; editable-region -;; (define-extern *editable-entity-region* object) ;; editable-region +(define-extern common-owner (function editable editable object)) +(define-extern update-light-sphere-from-editable-light (function editable-light object)) +(define-extern load-editable-lights (function editable-array symbol)) +(define-extern *editable-sample-region* editable-region) +(define-extern *editable-light-region* editable-region) +(define-extern *editable-entity-region* editable-region) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; editable-player ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cleanup-selection function) ;; (function editable-array none) -;; (define-extern insert-box function) ;; (function editable-array vector none) -;; (define-extern insert-wall function) -;; (define-extern update-manipulator-position function) -;; (define-extern execute-select function) ;; (function editable-array editable-command mouse-info symbol) -;; (define-extern execute-mouse-move function) ;; (function editable-array editable-command mouse-info symbol) -;; (define-extern execute-move function) ;; (function editable-array editable-command mouse-info symbol) -;; (define-extern get-light-value function) -;; (define-extern set-light-value function) -;; (define-extern keybd-set-time-of-day! function) +(define-extern cleanup-selection (function editable-array object)) +(define-extern insert-box (function editable-array vector vector object)) +(define-extern insert-wall (function editable-array vector vector object)) +(define-extern update-manipulator-position (function editable-array manipulator matrix)) +(define-extern execute-select (function editable-array editable-command mouse-info manipulator symbol)) +(define-extern execute-mouse-move (function editable-array editable-command mouse-info manipulator symbol)) +(define-extern execute-move (function editable-array editable-command mouse-info manipulator symbol)) +(define-extern get-light-value (function uint float)) +(define-extern set-light-value (function int float object)) +(define-extern keybd-set-time-of-day! (function int time-of-day-palette-id object)) (define-extern editable-player-init (function symbol none :behavior editable-player)) -;; (define-extern set-editable-name function) -;; (define-extern select-editable-by-name function) +(define-extern set-editable-name (function string object)) +(define-extern select-editable-by-name (function string object)) (define-extern *editable-menu-context* debug-menu-context) -;; (define-extern editable-menu-command function) ;; (function int none) -;; (define-extern editable-menu-command-no-close function) ;; (function int none) -;; (define-extern dm-region-tree-pick-func function) ;; (function symbol debug-menu-msg symbol) -;; (define-extern dm-editable-flag-pick-func function) ;; (function editable-flag debug-menu-msg symbol) -;; (define-extern dm-editable-filter0-pick-func function) ;; (function editable-filter debug-menu-msg symbol) -;; (define-extern dm-editable-filter1-pick-func function) ;; (function editable-filter debug-menu-msg symbol) -;; (define-extern dm-editable-light-float-func function) ;; (function int debug-menu-msg float float float) -;; (define-extern dm-cam-externalize2 function) ;; (function symbol debug-menu-msg symbol) -;; (define-extern dm-editable-boolean-toggle-pick-func function) ;; (function int debug-menu-msg symbol) -;; (define-extern editable-menu-context-make-menus function) ;; (function debug-menu-context debug-menu-context) -;; (define-extern insert-sample-camera function) ;; (function symbol none) -;; (define-extern *debug-hook* object) ;; pair +(define-extern editable-menu-command (function int object)) +(define-extern editable-menu-command-no-close (function int object)) +(define-extern dm-region-tree-pick-func (function symbol debug-menu-msg symbol)) +(define-extern dm-editable-flag-pick-func (function editable-flag debug-menu-msg symbol)) +(define-extern dm-editable-filter0-pick-func (function editable-filter debug-menu-msg symbol)) +(define-extern dm-editable-filter1-pick-func (function editable-filter debug-menu-msg symbol)) +(define-extern dm-editable-light-float-func (function int debug-menu-msg float float float)) +(define-extern dm-cam-externalize2 (function symbol debug-menu-msg symbol)) +(define-extern dm-editable-boolean-toggle-pick-func (function int debug-menu-msg symbol)) +(define-extern editable-menu-context-make-menus (function debug-menu-context debug-menu-context)) +(define-extern insert-sample-camera (function symbol object)) +(define-extern *debug-hook* pair) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mysql-nav-graph ;; @@ -40428,11 +40436,13 @@ "This string value is stored in their SQL database" :type uint32 :bitfield #t - (visited 0) - (blocked 1) - (pedestrian 2) - (selected 3) - (hidden 4) + (blocker 0) + (pov 1) + (visited 2) + (blocked 3) + (pedestrian 4) + (selected 5) + (hidden 6) ) ;; ---mysql-nav-graph:nav-node-flag @@ -40510,6 +40520,21 @@ ) ;; ---mysql-nav-graph:nav-clock-type +;; +++mysql-nav-graph:nav-minimap-edge-flag +(defenum nav-minimap-edge-flag + "This string value is stored in their SQL database" + :type int32 + :bitfield #t + (blocker 0) + (one-way 1) + (pass-port-mh 2) + (pass-port-inda 3) + (pass-inda-indb 4) + (pass-indb-sluma 5) + (pass-slumb-genb 6) + ) +;; ---mysql-nav-graph:nav-minimap-edge-flag + (deftype mysql-nav-edge (structure) ((mysql-save-flag mysql-save-flag :offset-assert 0) ;; guessed by decompiler (runtime-id uint32 :offset-assert 4) @@ -40529,14 +40554,14 @@ (nav_territory_type uint32 :offset-assert 60) (exclusive_data uint32 :offset-assert 64) (width float :offset-assert 68) - (minimap_edge_flag int32 :offset-assert 72) ;; nav-minimap-edge-flag + (minimap_edge_flag nav-minimap-edge-flag :offset-assert 72) ;; nav-minimap-edge-flag ) :allow-misaligned :method-count-assert 10 :size-assert #x4c :flag-assert #xa0000004c (:methods - (mysql-nav-edge-method-9 () none) ;; 9 ;; (exec-sql! (_type_) symbol) + (exec-sql! (_type_) symbol) ;; 9 ) ) @@ -40561,7 +40586,7 @@ :size-assert #x1c :flag-assert #xa0000001c (:methods - (mysql-nav-visnode-method-9 () none) ;; 9 ;; (exec-sql! (_type_) symbol) + (exec-sql! (_type_) symbol) ;; 9 ) ) @@ -40597,11 +40622,11 @@ (deftype mysql-nav-graph (basic) ((nav_graph_id uint32 :offset-assert 4) - (graph-type basic :offset-assert 8) + (graph-type symbol :offset-assert 8) (node-array mysql-nav-node-array :offset-assert 12) ;; guessed by decompiler (edge-array mysql-nav-edge-array :offset-assert 16) ;; guessed by decompiler (visnode-array mysql-nav-visnode-array :offset-assert 20) ;; guessed by decompiler - (pov-conn-array uint32 :offset-assert 24) + (pov-conn-array (inline-array mysql-nav-pov-conn) :offset-assert 24) (pov-conn-array-length int32 :offset-assert 28) (level-info-array-length int32 :offset-assert 32) (level-info-last-lookup int32 :offset-assert 36) @@ -40612,21 +40637,21 @@ :flag-assert #x1800000428 (:methods (new (symbol type string) _type_) ;; 0 - (init-from-sql! (_type_ string string) symbol) ;; 9 + (init-from-sql! (_type_ symbol string) symbol) ;; 9 (exec-sql! (_type_) symbol) ;; 10 (indexof-nav-node (_type_ int) int) ;; 11 (indexof-nav-edge (_type_ int) int) ;; 12 - (mysql-nav-graph-method-13 (_type_) none) ;; 13 ;; (alloc-new-node! (_type_) int) - (mysql-nav-graph-method-14 (_type_) none) ;; 14 ;; (alloc-new-edge! (_type_) int) - (mysql-nav-graph-method-15 (_type_) none) ;; 15 ;; (indexof-visnode (_type_ int int) int) - (mysql-nav-graph-method-16 (_type_) none) ;; 16 ;; (alloc-new-visnode! (_type_ int int) int) - (mysql-nav-graph-method-17 (_type_) none) ;; 17 ;; (mysql-nav-graph-method-17 (_type_) none) + (alloc-new-node! (_type_) int) ;; 13 + (alloc-new-edge! (_type_) int) ;; 14 + (indexof-visnode (_type_ int int) int) ;; 15 + (alloc-new-visnode! (_type_ int int) int) ;; 16 + (mysql-nav-graph-method-17 (_type_) none) ;; 17 (lookup-level-info2 (_type_ mysql-nav-node symbol) mysql-nav-graph-level-info) ;; 18 - (mysql-nav-graph-method-19 (_type_) none) ;; 19 ;; (mysql-nav-graph-method-19 (_type_) none) - (mysql-nav-graph-method-20 (_type_) none) ;; 20 ;; (mysql-nav-graph-method-20 (_type_) none) - (mysql-nav-graph-method-21 (_type_) none) ;; 21 - (mysql-nav-graph-method-22 (_type_) none) ;; 22 - (mysql-nav-graph-method-23 (_type_) none) ;; 23 + (mysql-nav-graph-method-19 (_type_) int) ;; 19 + (mysql-nav-graph-method-20 (_type_) none) ;; 20 + (get-graph-type (_type_ symbol) symbol) ;; 21 + (mysql-nav-graph-method-22 (_type_) int) ;; 22 + (mysql-nav-graph-method-23 (_type_ vector vector) symbol) ;; 23 ) ) @@ -40634,8 +40659,21 @@ ;; nav-graph-editor ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +++nav-graph-editor:nav-com-type +(defenum nav-com-type + :type uint32 + (undo-move-node 0) + (undo-delete-edge 1) + (undo-delete-node 2) + (undo-new-node 3) + (undo-new-edge 4) + (undo-delete-visnode 5) + (undo-new-visnode 6) + ) +;; ---nav-graph-editor:nav-com-type + (deftype nav-graph-command (structure) - ((com-type uint32 :offset-assert 0) + ((com-type nav-com-type :offset-assert 0) (id int32 :offset-assert 4) (index int32 :offset-assert 8) (move-vec vector :inline :offset-assert 16) @@ -40704,63 +40742,63 @@ create-pov ;; 28 ) (:methods - (nav-graph-editor-method-29 () none) ;; 29 ;; (nav-graph-editor-method-29 (_type_ string string string) none) - (nav-graph-editor-method-30 () none) ;; 30 ;; (nav-graph-editor-method-30 (_type_ int) symbol) - (nav-graph-editor-method-31 () none) ;; 31 ;; (nav-graph-editor-method-31 (_type_ int) symbol) - (nav-graph-editor-method-32 () none) ;; 32 ;; (nav-graph-editor-method-32 (_type_ symbol int) none) - (nav-graph-editor-method-33 () none) ;; 33 ;; (nav-graph-editor-method-33 (_type_ int) none) - (nav-graph-editor-method-34 () none) ;; 34 ;; (nav-graph-editor-method-34 (_type_) object) - (nav-graph-editor-method-35 () none) ;; 35 ;; (nav-graph-editor-method-35 (_type_) none) - (nav-graph-editor-method-36 () none) ;; 36 ;; (nav-graph-editor-method-36 (_type_) none) - (nav-graph-editor-method-37 () none) ;; 37 ;; (nav-graph-editor-method-37 (_type_) none) - (nav-graph-editor-method-38 () none) ;; 38 ;; (nav-graph-editor-method-38 (_type_) none) - (nav-graph-editor-method-39 () none) ;; 39 ;; (nav-graph-editor-method-39 (_type_) none) - (nav-graph-editor-method-40 () none) ;; 40 ;; (nav-graph-editor-method-40 (_type_) none) - (nav-graph-editor-method-41 () none) ;; 41 ;; (nav-graph-editor-method-41 (_type_) none) - (nav-graph-editor-method-42 () none) ;; 42 ;; (nav-graph-editor-method-42 (_type_) symbol) - (nav-graph-editor-method-43 () none) ;; 43 ;; (nav-graph-editor-method-43 (_type_) none) - (nav-graph-editor-method-44 () none) ;; 44 ;; (nav-graph-editor-method-44 (_type_) symbol) - (nav-graph-editor-method-45 () none) ;; 45 ;; (nav-graph-editor-method-45 (_type_) none) - (nav-graph-editor-method-46 () none) ;; 46 ;; (nav-graph-editor-method-46 (_type_) pad-buttons) - (nav-graph-editor-method-47 () none) ;; 47 ;; (nav-graph-editor-method-47 (_type_) none) - (nav-graph-editor-method-48 () none) ;; 48 ;; (nav-graph-editor-method-48 (_type_ uint) nav-graph-command) - (nav-graph-editor-method-49 () none) ;; 49 ;; (nav-graph-editor-method-49 (_type_) nav-graph-command) - (nav-graph-editor-method-50 () none) ;; 50 ;; (nav-graph-editor-method-50 (_type_) none) - (nav-graph-editor-method-51 () none) ;; 51 ;; (nav-graph-editor-method-51 (_type_) none) - (nav-graph-editor-method-52 () none) ;; 52 ;; (nav-graph-editor-method-52 (_type_) uint) - (nav-graph-editor-method-53 () none) ;; 53 ;; (nav-graph-editor-method-53 (_type_ int int) none) - (nav-graph-editor-method-54 () none) ;; 54 ;; (nav-graph-editor-method-54 (_type_ int) none) - (nav-graph-editor-method-55 () none) ;; 55 ;; (nav-graph-editor-method-55 (_type_ int) none) - (nav-graph-editor-method-56 () none) ;; 56 ;; (nav-graph-editor-method-56 (_type_ int) none) - (nav-graph-editor-method-57 () none) ;; 57 ;; (nav-graph-editor-method-57 (_type_ int int) int) - (nav-graph-editor-method-58 () none) ;; 58 ;; (nav-graph-editor-method-58 (_type_) symbol) - (nav-graph-editor-method-59 () none) ;; 59 ;; (nav-graph-editor-method-59 (_type_) pad-buttons) - (nav-graph-editor-method-60 () none) ;; 60 ;; (nav-graph-editor-method-60 (_type_) none) - (nav-graph-editor-method-61 () none) ;; 61 ;; (nav-graph-editor-method-61 (_type_) none) - (nav-graph-editor-method-62 () none) ;; 62 ;; (nav-graph-editor-method-62 (_type_ symbol symbol) none) - (nav-graph-editor-method-63 () none) ;; 63 ;; (nav-graph-editor-method-63 (_type_) none) - (nav-graph-editor-method-64 () none) ;; 64 - (nav-graph-editor-method-65 () none) ;; 65 - (nav-graph-editor-method-66 () none) ;; 66 - (nav-graph-editor-method-67 () none) ;; 67 + (nav-graph-editor-method-29 (_type_) none) ;; 29 ;; (nav-graph-editor-method-29 (_type_ string string string) none) + (nav-graph-editor-method-30 (_type_ string string string) object) ;; 30 ;; (nav-graph-editor-method-30 (_type_ int) symbol) + (nav-graph-editor-method-31 (_type_ int) symbol) ;; 31 ;; (nav-graph-editor-method-31 (_type_ int) symbol) + (nav-graph-editor-method-32 (_type_ int) symbol) ;; 32 ;; (nav-graph-editor-method-32 (_type_ symbol int) none) + (nav-graph-editor-method-33 (_type_ int int) object) ;; 33 ;; (nav-graph-editor-method-33 (_type_ int) none) + (nav-graph-editor-method-34 (_type_ int) none) ;; 34 ;; (nav-graph-editor-method-34 (_type_) object) + (nav-graph-editor-method-35 (_type_ vector vector) none) ;; 35 ;; (nav-graph-editor-method-35 (_type_) none) + (nav-graph-editor-method-36 (_type_) none) ;; 36 ;; (nav-graph-editor-method-36 (_type_) none) + (nav-graph-editor-method-37 (_type_) object) ;; 37 ;; (nav-graph-editor-method-37 (_type_) none) + (nav-graph-editor-method-38 (_type_) none) ;; 38 ;; (nav-graph-editor-method-38 (_type_) none) + (nav-graph-editor-method-39 (_type_) none) ;; 39 ;; (nav-graph-editor-method-39 (_type_) none) + (nav-graph-editor-method-40 (_type_) none) ;; 40 ;; (nav-graph-editor-method-40 (_type_) none) + (nav-graph-editor-method-41 (_type_) none) ;; 41 ;; (nav-graph-editor-method-41 (_type_) none) + (nav-graph-editor-method-42 (_type_) none) ;; 42 ;; (nav-graph-editor-method-42 (_type_) symbol) + (nav-graph-editor-method-43 (_type_) none) ;; 43 ;; (nav-graph-editor-method-43 (_type_) none) + (nav-graph-editor-method-44 (_type_) none) ;; 44 ;; (nav-graph-editor-method-44 (_type_) symbol) + (nav-graph-editor-method-45 (_type_) none) ;; 45 ;; (nav-graph-editor-method-45 (_type_) none) + (nav-graph-editor-method-46 (_type_) none) ;; 46 ;; (nav-graph-editor-method-46 (_type_) pad-buttons) + (nav-graph-editor-method-47 (_type_) symbol) ;; 47 ;; (nav-graph-editor-method-47 (_type_) none) + (nav-graph-editor-method-48 (_type_) none) ;; 48 ;; (nav-graph-editor-method-48 (_type_ uint) nav-graph-command) + (nav-graph-editor-method-49 (_type_) symbol) ;; 49 ;; (nav-graph-editor-method-49 (_type_) nav-graph-command) + (nav-graph-editor-method-50 (_type_) none) ;; 50 ;; (nav-graph-editor-method-50 (_type_) none) + (inc-cmd-id! (_type_) int) ;; 51 ;; (nav-graph-editor-method-51 (_type_) none) + (alloc-new-cmd! (_type_ int) nav-graph-command) ;; 52 ;; (nav-graph-editor-method-52 (_type_) uint) + (get-last-cmd (_type_) nav-graph-command) ;; 53 ;; (nav-graph-editor-method-53 (_type_ int int) none) + (nav-graph-editor-method-54 (_type_) none) ;; 54 ;; (nav-graph-editor-method-54 (_type_ int) none) + (nav-graph-editor-method-55 (_type_) none) ;; 55 ;; (nav-graph-editor-method-55 (_type_ int) none) + (nav-graph-editor-method-56 (_type_) int) ;; 56 ;; (nav-graph-editor-method-56 (_type_ int) none) + (nav-graph-editor-method-57 (_type_ int int) none) ;; 57 ;; (nav-graph-editor-method-57 (_type_ int int) int) + (nav-graph-editor-method-58 (_type_ int) symbol) ;; 58 ;; (nav-graph-editor-method-58 (_type_) symbol) + (nav-graph-editor-method-59 (_type_ int) none) ;; 59 ;; (nav-graph-editor-method-59 (_type_) pad-buttons) + (nav-graph-editor-method-60 (_type_ int) none) ;; 60 ;; (nav-graph-editor-method-60 (_type_) none) + (nav-graph-editor-method-61 (_type_ int int) none) ;; 61 ;; (nav-graph-editor-method-61 (_type_) none) + (nav-graph-editor-method-62 (_type_) symbol) ;; 62 ;; (nav-graph-editor-method-62 (_type_ symbol symbol) none) + (nav-graph-editor-method-63 (_type_) none) ;; 63 ;; (nav-graph-editor-method-63 (_type_) none) + (nav-graph-editor-method-64 (_type_) none) ;; 64 + (nav-graph-editor-method-65 (_type_) none) ;; 65 + (nav-graph-editor-method-66 (_type_ symbol string) none) ;; 66 + (nav-graph-editor-method-67 (_type_) none) ;; 67 ) ) (define-extern *nav-graph-editor* (pointer nav-graph-editor)) -;; (define-extern get-node-draw-position function) -;; (define-extern nav-graph-editor-init-by-other function) ;; (function string none :behavior nav-graph-editor) -(define-extern run-nav-graph-editor (function symbol (pointer process))) +(define-extern get-node-draw-position (function vector mysql-nav-node vector)) +(define-extern nav-graph-editor-init-by-other (function string symbol object :behavior nav-graph-editor)) +(define-extern run-nav-graph-editor (function symbol symbol (pointer nav-graph-editor))) (define-extern get-nav-graph-editor (function nav-graph-editor)) (define-extern exit-nav-graph-editor (function none)) -;; (define-extern nav-graph-set-level function) -;; (define-extern set-minimap-edge-flag function) ;; (function nav-minimap-edge-flag uint) -;; (define-extern set-vehicle-edit-mode function) ;; (function symbol none) -;; (define-extern translate-nav-graph function) ;; (function float float float symbol) -;; (define-extern update-nav-meshes function) ;; (function symbol) -;; (define-extern delete-node-nav-mesh function) -;; (define-extern smooth-nav-graph function) ;; (function string symbol) -;; (define-extern update-height function) ;; (function string symbol) -;; (define-extern update-width function) ;; (function string symbol) +(define-extern nav-graph-set-level (function symbol object)) +(define-extern set-minimap-edge-flag (function nav-minimap-edge-flag none)) +(define-extern set-vehicle-edit-mode (function symbol none)) +(define-extern translate-nav-graph (function float float float symbol)) +(define-extern update-nav-meshes (function symbol)) +(define-extern delete-node-nav-mesh (function int none)) +(define-extern smooth-nav-graph (function string symbol)) +(define-extern update-height (function string symbol)) +(define-extern update-width (function string symbol)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nav-mesh-editor-h ;; @@ -40776,10 +40814,22 @@ :flag-assert #xe00000010 ) +;; +++nav-mesh-editor-h:nav-mesh-poly-flag +(defenum nav-mesh-poly-flag + :type uint32 + :bitfield #t + (gap 0) + (off 1) + (nmpf2 2) + (user0 3) + ) +;; ---nav-mesh-editor-h:nav-mesh-poly-flag + +(declare-type nav-mesh-editable structure) (deftype nav-mesh-poly (structure) ((poly-id uint32 :offset-assert 0) - (flags uint32 :offset-assert 4) - (index basic :offset-assert 8) + (flags nav-mesh-poly-flag :offset-assert 4) + (index int16-array :offset-assert 8) (insert-pos uint32 :offset-assert 12) ) :method-count-assert 15 @@ -40787,12 +40837,12 @@ :flag-assert #xf00000010 (:methods (new (symbol type) _type_) ;; 0 - (nav-mesh-poly-method-9 () none) ;; 9 - (nav-mesh-poly-method-10 () none) ;; 10 - (nav-mesh-poly-method-11 () none) ;; 11 - (nav-mesh-poly-method-12 () none) ;; 12 - (nav-mesh-poly-method-13 () none) ;; 13 - (nav-mesh-poly-method-14 () none) ;; 14 + (init-fields! (_type_) none) ;; 9 + (nav-mesh-poly-method-10 (_type_ nav-mesh-editable) none) ;; 10 + (nav-mesh-poly-method-11 (_type_ int) none) ;; 11 + (nav-mesh-poly-method-12 (_type_ int) none) ;; 12 + (nav-mesh-poly-method-13 (_type_ int) int) ;; 13 + (nav-mesh-poly-method-14 (_type_ int int) object) ;; 14 ) ) @@ -40805,8 +40855,8 @@ ) (deftype nav-mesh-tri-quad (structure) - ((indices int32 4 :offset-assert 0) - (poly uint32 :offset-assert 16) + ((indices uint32 4 :offset-assert 0) ;; changed from int32 + (poly uint32 :offset-assert 16) ) :method-count-assert 9 :size-assert #x14 @@ -40821,10 +40871,18 @@ :flag-assert #xe00000010 ) +;; +++nav-mesh-editor-h:nav-mesh-editable-flag +(defenum nav-mesh-editable-flag + :type uint32 + :bitfield #t + (nmef0 0) + ) +;; ---nav-mesh-editor-h:nav-mesh-editable-flag + (deftype nav-mesh-editable (structure) - ((flags uint32 :offset-assert 0) - (verts basic :offset-assert 4) - (tris basic :offset-assert 8) + ((flags nav-mesh-editable-flag :offset-assert 0) + (verts vector-array :offset-assert 4) + (tris nav-mesh-tri-quad-array :offset-assert 8) (quads nav-mesh-tri-quad-array :offset-assert 12) (navmesh-id uint32 :offset-assert 16) (idx uint32 :offset-assert 20) @@ -40837,16 +40895,17 @@ :size-assert #x28 :flag-assert #x1300000028 (:methods - (nav-mesh-editable-method-9 () none) ;; 9 - (nav-mesh-editable-method-10 () none) ;; 10 - (nav-mesh-editable-method-11 () none) ;; 11 - (nav-mesh-editable-method-12 () none) ;; 12 - (nav-mesh-editable-method-13 () none) ;; 13 - (nav-mesh-editable-method-14 () none) ;; 14 - (nav-mesh-editable-method-15 () none) ;; 15 - (nav-mesh-editable-method-16 () none) ;; 16 - (nav-mesh-editable-method-17 () none) ;; 17 - (nav-mesh-editable-method-18 () none) ;; 18 + (new (symbol type) _type_) ;; 0 + (init-fields! (_type_) none) ;; 9 + (nav-mesh-editable-method-10 (_type_ symbol) none) ;; 10 + (add-vert! (_type_ vector) int) ;; 11 + (nav-mesh-editable-method-12 (_type_ vector symbol) object) ;; 12 + (nav-mesh-editable-method-13 (_type_) none) ;; 13 + (nav-mesh-editable-method-14 (_type_ vector) int) ;; 14 + (nav-mesh-editable-method-15 (_type_ int) object) ;; 15 + (nav-mesh-editable-method-16 (_type_) object) ;; 16 + (nav-mesh-editable-method-17 (_type_) object) ;; 17 + (nav-mesh-editable-method-18 (_type_) none) ;; 18 ) ) @@ -40861,16 +40920,16 @@ (deftype nav-mesh-editor-undo (structure) ((current-nav-mesh nav-mesh-editable :offset-assert 0) (selected-poly uint32 :offset-assert 4) - (index basic :offset-assert 8) + (index int16-array :offset-assert 8) (insert-pos uint32 :offset-assert 12) - (verts basic :offset-assert 16) + (verts vector-array :offset-assert 16) ) :method-count-assert 10 :size-assert #x14 :flag-assert #xa00000014 (:methods (new (symbol type) _type_) ;; 0 - (nav-mesh-editor-undo-method-9 () none) ;; 9 + (init-fields! (_type_) none) ;; 9 ) ) @@ -40883,9 +40942,9 @@ ) (deftype nav-mesh-editor (process-drawable) - ((close-menu-time uint64 :offset-assert 200) - (external-cam-mode basic :offset-assert 208) - (mouse-pressed uint64 :offset-assert 216) + ((close-menu-time time-frame :offset-assert 200) + (external-cam-mode symbol :offset-assert 208) + (mouse-pressed time-frame :offset-assert 216) (mouse-screen-pos vector :inline :offset-assert 224) (mouse-pos vector :inline :offset-assert 240) (mouse-end vector :inline :offset-assert 256) @@ -40901,74 +40960,74 @@ (lock-action basic :offset-assert 400) (mouse-action uint32 :offset-assert 404) (mouse-action-pos-ref vector :inline :offset-assert 416) - (nav-meshes basic :offset-assert 432) + (nav-meshes nav-mesh-editable-array :offset-assert 432) (current-nav-mesh nav-mesh-editable :offset-assert 436) (manipulator manipulator :inline :offset-assert 448) - (level-name basic :offset-assert 624) + (level-name string :offset-assert 624) (level-id uint32 :offset-assert 628) (undo-min uint32 :offset-assert 632) (undo-id uint32 :offset-assert 636) (undo-max uint32 :offset-assert 640) - (undos basic :offset-assert 644) - (hide-unselected basic :offset-assert 648) - (allow-snap basic :offset-assert 652) + (undos nav-mesh-editor-undo-array :offset-assert 644) + (hide-unselected symbol :offset-assert 648) + (allow-snap symbol :offset-assert 652) ) :method-count-assert 28 :size-assert #x290 :flag-assert #x1c02100290 + (:state-methods + idle ;; 20 + ) (:methods - (nav-mesh-editor-method-20 () none) ;; 20 - (nav-mesh-editor-method-21 () none) ;; 21 - (nav-mesh-editor-method-22 () none) ;; 22 - (nav-mesh-editor-method-23 () none) ;; 23 - (nav-mesh-editor-method-24 () none) ;; 24 - (nav-mesh-editor-method-25 () none) ;; 25 - (nav-mesh-editor-method-26 () none) ;; 26 - (nav-mesh-editor-method-27 () none) ;; 27 + (nav-mesh-editor-method-21 (_type_) none) ;; 21 + (nav-mesh-editor-method-22 (_type_) none) ;; 22 + (set-level-info! (_type_ symbol) none) ;; 23 + (select-nav-mesh-by-id (_type_ int) object) ;; 24 + (nav-mesh-editor-method-25 (_type_) none) ;; 25 + (nav-mesh-editor-method-26 (_type_) none) ;; 26 + (nav-mesh-editor-method-27 (_type_) object) ;; 27 ) ) -(define-extern *nav-mesh-editor* nav-mesh-editor) +(define-extern *nav-mesh-editor* (pointer nav-mesh-editor)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nav-mesh-editor ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype triangulation-vert (structure) ((index uint32 :offset-assert 0) - (ear? basic :offset-assert 4) + (ear? symbol :offset-assert 4) (score float :offset-assert 8) ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -;; (define-extern snap-level-navmesh function) -;; (define-extern mouse-intersect-triangle function) -;; (define-extern *clean-vertex-array* object) -;; (define-extern *clean-index-array* object) -;; (define-extern poly-flag-to-string function) -;; (define-extern point-in-cone function) -;; (define-extern segment-in-cone function) -;; (define-extern point-in-triangle function) -;; (define-extern segments-intersect function) -;; (define-extern is-diagonal function) -;; (define-extern *verts-buf-1* object) -;; (define-extern *verts-buf-2* object) -;; (define-extern draw-square-point function) -;; (define-extern get-level-id function) -;; (define-extern nav-mesh-editor-new function) -;; (define-extern nav-delete function) -;; (define-extern nav-mesh-editor-translate function) -;; (define-extern nav-mesh-editor-rotate-y function) -;; (define-extern nav-mesh-editor-load function) -;; (define-extern nav-mesh-editor-set-level function) -;; (define-extern nav-set-lev function) -;; (define-extern nav-set-flag function) -(define-extern nav-mesh-editor-init (function none)) +(define-extern snap-level-navmesh (function vector vector symbol)) +(define-extern mouse-intersect-triangle (function vector vector vector vector float)) +(define-extern *clean-vertex-array* (inline-array vector)) +(define-extern *clean-index-array* (pointer int32)) +(define-extern poly-flag-to-string (function object nav-mesh-poly-flag object)) +(define-extern point-in-cone (function vector vector vector vector symbol)) +(define-extern segment-in-cone (function vector vector vector vector symbol)) +(define-extern point-in-triangle (function vector vector vector vector symbol)) +(define-extern segments-intersect (function vector vector vector vector symbol)) +(define-extern is-diagonal (function int (inline-array triangulation-vert) vector-array int int int symbol)) +(define-extern *verts-buf-1* (inline-array triangulation-vert)) +(define-extern *verts-buf-2* (inline-array triangulation-vert)) +(define-extern draw-square-point (function vector object)) +(define-extern get-level-id (function string int)) +(define-extern nav-mesh-editor-new (function object)) +(define-extern nav-delete (function int object)) +(define-extern nav-mesh-editor-translate (function int float float float object)) +(define-extern nav-mesh-editor-rotate-y (function float object)) +(define-extern nav-mesh-editor-load (function string object)) +(define-extern nav-mesh-editor-set-level (function symbol object)) +(define-extern nav-set-lev (function string object)) +(define-extern nav-set-flag (function nav-mesh-poly-flag object)) +(define-extern nav-mesh-editor-init (function symbol object :behavior nav-mesh-editor)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bug-report ;; @@ -41122,26 +41181,33 @@ ;; visvol-edit ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++visvol-edit:visvol-edit-func +(defenum visvol-edit-func + :type uint64 + (visvol-positive 0) + (visvol-negative 1) + (adjust-sphere 2) + (adjust-vis-distance 3) + ) +;; ---visvol-edit:visvol-edit-func + (deftype visvol-edit-info (structure) - ((editing basic :offset-assert 0) - (current-func uint64 :offset-assert 8) - (analog-func uint64 :offset-assert 16) + ((editing symbol :offset-assert 0) + (current-func visvol-edit-func :offset-assert 8) + (analog-func visvol-edit-func :offset-assert 16) ) :method-count-assert 12 :size-assert #x18 :flag-assert #xc00000018 (:methods - (visvol-edit-info-method-9 () none) ;; 9 - (visvol-edit-info-method-10 () none) ;; 10 - (visvol-edit-info-method-11 () none) ;; 11 + (handle-pad-input (_type_) object) ;; 9 + (draw-menu (_type_ process-drawable) object) ;; 10 + (set-origin-joint-idx! (_type_ process-drawable) none) ;; 11 ) ) -|# -#| (deftype visvol-editor (process) - ((proc uint64 :offset-assert 128) + ((proc handle :offset-assert 128) ) :method-count-assert 15 :size-assert #x88 @@ -41150,12 +41216,11 @@ idle ;; 14 ) ) -|# -;; (define-extern *visvol-edit-info* object) -;; (define-extern visvol-editor-init-by-other function) -;; (define-extern stop-visvol-edit function) -;; (define-extern visvol-edit function) +(define-extern *visvol-edit-info* visvol-edit-info) +(define-extern visvol-editor-init-by-other (function handle object :behavior visvol-editor)) +(define-extern stop-visvol-edit (function object)) +(define-extern visvol-edit (function string object)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collision-editor ;; @@ -41212,9 +41277,9 @@ :size-assert #x1c :flag-assert #xc0000001c (:methods - (collision-edit-info-method-9 (_type_) none) ;; 9 + (handle-pad-input (_type_) none) ;; 9 (draw-menu (_type_ process-drawable) none) ;; 10 - (collision-edit-info-method-11 (_type_ process-drawable) none) ;; 11 + (set-current-prim! (_type_ process-drawable) none) ;; 11 ) ) @@ -41223,7 +41288,7 @@ (define-extern *collision-editor-mesh-names* (array string)) (define-extern *collision-editor-art-group-name* string) (define-extern collision-editor-add-mesh-to-ccache (function collide-shape-prim-group collide-cache none)) -(define-extern print-default-collision (function process-drawable none)) +(define-extern print-default-collision (function none)) (define-extern print-actual-collision (function process-drawable none)) (define-extern collision-edit-get-max-prim (function process-drawable int)) (define-extern collision-edit-get-prim (function process-drawable int collide-shape-prim)) diff --git a/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc b/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc index c9e74c36ba..1a3d40bfd4 100644 --- a/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc @@ -1005,5 +1005,14 @@ [15, "(function external-art-buffer object)"], [16, "(function external-art-buffer object)"], [17, "(function external-art-buffer object)"] - ] + ], + "editable-player": [ + [0, "(function object)"], + [3, "(function object int float object)"], + [4, "(function object int symbol)"], + [31, "(function editable editable-region symbol)"], + [32, "(function editable editable-region symbol)"], + [35, "(function editable symbol)"] + ], + "editable": [[101, "(function object editable-filter)"]] } diff --git a/decompiler/config/jak3/ntsc_v1/hacks.jsonc b/decompiler/config/jak3/ntsc_v1/hacks.jsonc index 0aafe6edfc..773688d881 100644 --- a/decompiler/config/jak3/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak3/ntsc_v1/hacks.jsonc @@ -89,7 +89,6 @@ // CFG failed "draw-inline-array-instance-shrub", - "(method 9 editable-region)", // condition branch assert hit "test-to-from-spr", "test-from-spr", "test-to-spr", @@ -101,7 +100,6 @@ "adgif-shader<-texture!", // jak 3 - "(method 10 manipulator)", "(method 46 ff-squad-control)", "memcpy" ], @@ -466,7 +464,11 @@ "(anon-function 90 ctywide-obs)": [4], "(anon-function 10 cty-sniper-turret)": [44], "(method 33 rub-tower)": [9, 10], - "(method 30 gungame-manager)": [0, 4, 5, 7] + "(method 30 gungame-manager)": [0, 4, 5, 7], + "(method 9 editable-region)": [63], + "(method 10 manipulator)": [4], + "(method 18 mysql-nav-graph)": [0, 1, 2, 3, 4, 7, 9], + "(method 17 nav-mesh-editable)": [0, 1, 2, 7, 9, 24, 28, 33] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak3/ntsc_v1/label_types.jsonc b/decompiler/config/jak3/ntsc_v1/label_types.jsonc index b97d321d40..f96a7f1505 100644 --- a/decompiler/config/jak3/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/label_types.jsonc @@ -2465,5 +2465,29 @@ ["L198", "(pointer uint8)", 16], ["L197", "(pointer uint16)", 48] ], - "game-task": [["L18", "(array game-task-node-command)"]] + "game-task": [["L18", "(array game-task-node-command)"]], + "editable-player": [ + ["L1431", "(inline-array vector4w)", 4], + ["L1499", "uint64", true] + ], + "editable": [ + ["L724", "rgba", true], + ["L725", "rgba", true], + ["L726", "rgba", true], + ["L727", "rgba", true], + ["L728", "rgba", true], + ["L729", "rgba", true], + ["L730", "rgba", true], + ["L680", "vector"], + ["L722", "uint64", true], + ["L723", "rgba", true] + ], + "nav-mesh-editor": [ + ["L560", "uint64", true], + ["L504", "(inline-array triangulation-vert)", 256], + ["L505", "(inline-array triangulation-vert)", 256], + ["L555", "(pointer int32)", 1024], + ["L556", "(inline-array vector)", 1024], + ["L557", "uint64", true] + ] } diff --git a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc index 270864f2f6..2e5f4d1f42 100644 --- a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc @@ -2519,5 +2519,117 @@ [32, "vector"], [48, "vector"], [64, "vector"] + ], + "(method 9 editable-array)": [ + [16, "vector"], + [96, "vector"] + ], + "(method 23 editable-player)": [ + [128, "vector"], + [112, "vector"] + ], + "execute-move": [ + [16, "vector"], + [32, "vector"] + ], + "execute-mouse-move": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"], + [112, "vector"] + ], + "update-manipulator-position": [[16, "vector"]], + "insert-wall": [[32, ["array", "int32", 2]]], + "insert-box": [[32, ["array", "int32", 8]]], + "(method 22 editable)": [ + [16, "vector"], + [32, "vector"] + ], + "(method 21 editable-entity)": [[80, "vector"]], + "(method 13 editable-plane)": [[64, ["inline-array", "vector", 4]]], + "(method 14 editable-point)": [ + [80, ["inline-array", "vector", 4]], + [32, "vector"], + [48, "vector"] + ], + "(method 31 editable-face)": [ + [16, ["inline-array", "vector", 6]], + [112, ["inline-array", "vector", 6]], + [240, ["array", "editable-point", 6]], + [304, "matrix"] + ], + "(method 14 editable-face)": [ + [64, ["inline-array", "vector", 4]], + [208, ["inline-array", "vector", 6]], + [304, ["inline-array", "vector", 6]], + [416, "vector"] + ], + "(method 13 editable-face)": [[64, ["inline-array", "vector", 6]]], + "(method 10 editable-face)": [[16, ["inline-array", "vector", 6]]], + "(method 37 editable-face)": [[16, ["inline-array", "vector", 6]]], + "(method 10 editable-plane)": [[16, ["inline-array", "vector", 4]]], + "(method 13 editable-array)": [ + [96, "vector"], + [160, "vector"] + ], + "(method 23 mysql-nav-graph)": [[16, ["inline-array", "vector", 5]]], + "(post draw-closest-minimap nav-graph-editor)": [ + [64, ["inline-array", "vector", 5]] + ], + "(method 29 nav-graph-editor)": [ + [32, "vector"], + [48, ["inline-array", "vector", 2]], + [112, "vector"], + [128, "vector"], + [144, "vector"] + ], + "(method 32 nav-graph-editor)": [[32, "vector"]], + "(method 31 nav-graph-editor)": [[16, ["inline-array", "vector", 5]]], + "(method 35 nav-graph-editor)": [[16, ["inline-array", "vector", 4]]], + "(method 37 nav-graph-editor)": [ + [80, "vector"], + [880, ["inline-array", "vector", 4]] + ], + "update-height": [[16, "vector"]], + "(method 33 nav-graph-editor)": [ + [16, "vector"], + [48, ["inline-array", "vector", 2]] + ], + "(method 49 nav-graph-editor)": [ + [16, "vector"], + [32, "vector"] + ], + "(method 47 nav-graph-editor)": [ + [48, "vector"], + [96, "vector"], + [128, "vector"] + ], + "(method 22 nav-mesh-editor)": [[80, "vector"]], + "(method 10 nav-mesh-poly)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"], + [96, "vector"], + [112, "vector"], + [128, "vector"] + ], + "snap-level-navmesh": [ + [16, "vector"], + [64, "vector"] + ], + "(method 16 nav-mesh-editable)": [ + [16, "vector"], + [48, "vector"], + [32, "vector"] + ], + "(method 15 nav-mesh-editable)": [[16, "vector"]], + "(method 12 nav-mesh-editable)": [[32, "vector"]], + "(method 14 nav-mesh-editable)": [ + [16, ["inline-array", "vector", 4]], + [80, ["inline-array", "vector", 4]] ] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 870ba670fe..7fa036182a 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -2229,7 +2229,6 @@ [789, "v1", "float"], [792, "v1", "float"], [794, "v0", "float"], - // [784, "v1", "vector"], [589, "v1", "float"], [593, "v1", "float"], @@ -11340,5 +11339,148 @@ [[81, 99], "a0", "(inline-array vector4w)"], [[165, 190], "a0", "(inline-array vector4w)"] ], - "(event idle progress)": [[[10, 80], "v1", "mc-status-code"]] + "(event idle progress)": [[[10, 80], "v1", "mc-status-code"]], + "visvol-edit": [ + [[22, 26], "v1", "handle"], + [[17, 21], "v1", "handle"] + ], + "(method 10 visvol-edit-info)": [ + [228, "v0", "(pointer float)"], + [458, "v0", "(pointer float)"], + [509, "v0", "(pointer float)"] + ], + "(event idle editable-player)": [ + [307, "a1", "vector"], + [[473, 492], "s4", "editable-light"], + [[533, 561], "s4", "editable-entity"], + [[607, 618], "v1", "editable-light"], + [[507, 513], "v1", "float"], + [[303, 313], "v1", "editable-entity"], + [[662, 680], "s3", "editable-light"], + [665, "v1", "(pointer float)"], + [666, "a0", "editable-light"], + [[431, 436], "v1", "float"], + [[580, 587], "v1", "float"], + [635, "v1", "float"] + ], + "keybd-set-time-of-day!": [[[15, 19], "v1", "float"]], + "set-light-value": [ + [[26, 49], "s2", "editable-light"], + [29, "a0", "(pointer float)"] + ], + "get-light-value": [ + [[26, 39], "s3", "editable-light"], + [28, "v1", "(pointer float)"] + ], + "dm-editable-light-float-func": [ + [[32, 108], "s2", "editable-light"], + [36, "a0", "(pointer float)"], + [88, "v1", "(pointer float)"], + [[137, 151], "s3", "editable-light"], + [140, "v1", "(pointer float)"], + [81, "a2", "uint"], + [88, "a1", "int"] + ], + "(method 23 editable-player)": [ + [58, "a1", "int"], + [58, "a0", "int"], + [67, "a0", "int"], + [67, "a1", "int"] + ], + "execute-select": [ + [[552, 556], "a0", "editable"], + [644, "v1", "editable"], + [[595, 599], "a0", "editable"], + [742, "v1", "editable"], + [[693, 697], "a0", "editable"] + ], + "update-manipulator-position": [["_stack_", 48, "euler-angles"]], + "(method 9 editable)": [[35, "a0", "editable-light"]], + "common-owner": [ + [18, "v1", "pair"], + [12, "a2", "pair"], + [17, "v1", "pair"], + [11, "a2", "pair"] + ], + "(method 27 editable)": [ + [[12, 17], "a0", "editable"], + [19, "s4", "pair"], + [18, "s4", "pair"] + ], + "(method 31 editable)": [ + [[4, 8], "a0", "editable"], + [10, "s5", "pair"], + [9, "s5", "pair"] + ], + "(method 30 editable)": [ + [[4, 8], "a0", "editable"], + [10, "s5", "pair"], + [9, "s5", "pair"] + ], + "(method 36 editable-entity)": [[[23, 55], "s5", "process-drawable"]], + "(method 13 editable-plane)": [ + [[63, 66], "s3", "(inline-array vector)"], + [[72, 75], "s3", "(inline-array vector)"], + [89, "s3", "(inline-array vector)"] + ], + "(method 31 editable-face)": [ + ["_stack_", 288, "(array editable-point)"], + ["_stack_", 208, "(inline-array vector)"] + ], + "(method 13 editable-face)": [ + [[57, 60], "s3", "(inline-array vector)"], + [[66, 69], "s3", "(inline-array vector)"], + [83, "s3", "(inline-array vector)"] + ], + "(method 14 editable-face)": [["_stack_", 576, "vector"]], + "(method 13 editable-array)": [ + ["_stack_", 28, "sql-result"], + ["_stack_", 84, "string"], + ["_stack_", 176, "vector"], + [466, "v1", "sql-result"], + [647, "v1", "sql-result"] + ], + "dm-editable-boolean-toggle-pick-func": [[5, "v1", "(pointer float)"]], + "(method 25 editable-light)": [ + [78, "a2", "vector"], + [63, "t0", "uint"], + [70, "a3", "int"] + ], + "update-light-sphere-from-editable-light": [ + [80, "a0", "vector"], + [72, "a1", "int"], + [65, "a2", "uint"] + ], + "load-editable-lights": [ + [345, "a1", "uint"], + [352, "a0", "int"] + ], + "(method 10 mysql-nav-node)": [[4, "v1", "mysql-nav-edge"]], + "(method 19 mysql-nav-graph)": [ + [42, "a0", "mysql-nav-edge"], + [46, "a0", "mysql-nav-edge"], + [60, "a0", "mysql-nav-edge"] + ], + "nav-graph-set-level": [[5, "v1", "nav-graph-editor"]], + "set-minimap-edge-flag": [[[5, 12], "v1", "nav-graph-editor"]], + "set-vehicle-edit-mode": [[[5, 11], "v1", "nav-graph-editor"]], + "translate-nav-graph": [[[14, 34], "v1", "nav-graph-editor"]], + "update-width": [[5, "a0", "nav-graph-editor"]], + "update-height": [[4, "a1", "nav-graph-editor"]], + "smooth-nav-graph": [[5, "a0", "nav-graph-editor"]], + "delete-node-nav-mesh": [[[15, 36], "s5", "nav-graph-editor"]], + "update-nav-meshes": [[[14, 28], "gp", "nav-graph-editor"]], + "(method 47 nav-graph-editor)": [["_stack_", 192, "vector"]], + "draw-square-point": [[[70, 73], "v1", "dma-packet"]], + "(event idle nav-mesh-editor)": [ + [[88, 93], "v1", "float"], + [167, "v1", "float"] + ], + "(method 16 nav-mesh-editable)": [ + [668, "v1", "(inline-array nav-mesh-tri-quad)"] + ], + "(trans idle nav-mesh-editor)": [ + [423, "v0", "int"], + [476, "v0", "int"] + ] } diff --git a/decompiler/config/jak3/ntsc_v1/var_names.jsonc b/decompiler/config/jak3/ntsc_v1/var_names.jsonc index 3fee9e6df4..49154343ac 100644 --- a/decompiler/config/jak3/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak3/ntsc_v1/var_names.jsonc @@ -2164,5 +2164,15 @@ }, "set-font-color": { "args": ["idx", "clr0", "clr1", "clr2", "clr3"] + }, + "(anon-function 101 editable)": { + "vars": { + "gp-0": ["filter-type", "editable-filter"] + } + }, + "(method 12 editable-region)": { + "vars": { + "v0-3": ["filter", "editable-filter"] + } } } diff --git a/game/kernel/jak3/klisten.cpp b/game/kernel/jak3/klisten.cpp index f9dde9ccd0..c573eea496 100644 --- a/game/kernel/jak3/klisten.cpp +++ b/game/kernel/jak3/klisten.cpp @@ -1,6 +1,10 @@ #include "klisten.h" +#include "kmachine.h" + +#include "common/log/log.h" #include "common/symbols.h" +#include "common/util/string_util.h" #include "game/kernel/common/Ptr.h" #include "game/kernel/common/Symbol4.h" @@ -111,8 +115,106 @@ void ProcessListenerMessage(Ptr msg) { SendAck(); } -int sql_query_sync(Ptr /*string_in*/) { - ASSERT_NOT_REACHED(); +// (deftype sql-result (basic) +struct SQLResult { + // (len int32 :offset-assert 4) + s32 len; + // (allocated-length uint32 :offset-assert 8) + u32 allocated_length; + // (error symbol :offset-assert 12) + u32 error; + // (data string :dynamic :offset-assert 16) + // don't be fooled by the [1] here, it can hold as many as we allocate when calling `new` + Ptr data[1]; +}; + +int sql_query_sync(Ptr string_in) { + if (!MasterDebug) { + // not debugging, no sql results. + return s7.offset + S7_OFF_FIX_SYM_EMPTY_PAIR; + } else { + /* Original code, disabled + // output sql query to the compiler + output_sql_query(string_in->data()); + // clear pending listener stuff, so we don't run it again. + ListenerFunction->value() = s7.offset; + ListenerStatus = 1; + ClearPending(); + SendAck(); + */ + + std::string query_str = string_in->data(); + str_util::replace(query_str, "LAST_INSERT_ID()", "last_insert_rowid()"); + lg::debug("[SQL] Query '{}'", query_str); + + // ensure the DB is initialized + initialize_sql_db(); + + // clear global + SqlResult->value() = s7.offset; + + kdebugheap->top.offset -= 0x4000; // not sure what it's used for... + + const auto& result = run_sql_query(query_str); + // TODO - check for errors + + auto sym = find_symbol_from_c(-1, "sql-result"); + if (sym.offset) { + // TODO - can their sql-result type not return multiple rows and the data is just the columns? + // or do they make assumptions and iterate the data like a 2d flattened array + // + // Collect string results + std::vector results; + for (const auto& row : result.rows) { + for (const auto& val : row) { + lg::debug("[SQL] Result \"{}\"", val.data()); + results.push_back(val.data()); + } + } + + // Make the GOAL type to hold them + Ptr type = Ptr(sym->value()); + auto new_result_ptr = call_method_of_type_arg2(intern_from_c(-1, 0, "debug").offset, type, + GOAL_NEW_METHOD, type.offset, results.size()); + SQLResult* new_result = Ptr(new_result_ptr).c(); + for (int i = 0; i < (int)results.size(); i++) { + new_result->data[i] = Ptr(make_debug_string_from_c(results.at(i).data())); + } + new_result->len = results.size(); + + // TODO - possible values here (when to set them?) + // 'error = the default, fairly obvious + // 'select = the result of a select + new_result->error = intern_from_c(-1, 0, "select").offset; + + kdebugheap->top.offset += 0x4000; + + // Store the result in the convienant debugging global (stores last query resp) + SqlResult->value() = new_result_ptr; + return new_result_ptr; + } + + return s7.offset; + + /* Original code, disabled + // didn't we just set these to false? + if (ListenerFunction->value() == s7.offset && SqlResult->value() == s7.offset) { + do { + KernelDispatch(sync_dispatcher->value()); + SendAck(); + if (SqlResult->value() != s7.offset) { + break; + } + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + iVar2 = 99999; + do { + bVar1 = iVar2 != 0; + iVar2 = iVar2 + -1; + } while (bVar1); + } while (SqlResult->value() == s7.offset); + } + */ + } } } // namespace jak3 diff --git a/game/kernel/jak3/kmachine.cpp b/game/kernel/jak3/kmachine.cpp index e96095a773..63bb767807 100644 --- a/game/kernel/jak3/kmachine.cpp +++ b/game/kernel/jak3/kmachine.cpp @@ -4,6 +4,7 @@ #include "common/symbols.h" +#include "game/graphics/display.h" #include "game/graphics/gfx.h" #include "game/graphics/jak3_texture_remap.h" #include "game/graphics/sceGraphicsInterface.h" @@ -309,9 +310,64 @@ u32 KeybdGetData(u32 /*_mouse*/) { // ASSERT_NOT_REACHED(); } -u32 MouseGetData(u32 /*_mouse*/) { - // ASSERT_NOT_REACHED(); - return 0; +u32 MouseGetData(u32 _mouse) { + auto mouse = Ptr(_mouse).c(); + + mouse->active = offset_of_s7() + jak2_symbols::FIX_SYM_TRUE; + mouse->valid = offset_of_s7() + jak2_symbols::FIX_SYM_TRUE; + mouse->cursor = offset_of_s7() + jak2_symbols::FIX_SYM_TRUE; + mouse->status = 1; + // Contrary to the name, this is a 16bitfield + // where: + // 0 = left button + // 1 = right button + // 2 = middle button + mouse->button0 = 0; + + s32 xpos = 0; + s32 ypos = 0; + if (Display::GetMainDisplay()) { + std::tie(xpos, ypos) = Display::GetMainDisplay()->get_input_manager()->get_mouse_pos(); + const auto mouse_button_status = + Display::GetMainDisplay()->get_input_manager()->get_mouse_button_status(); + mouse->button0 |= (mouse_button_status.left ? 1 : 0); + mouse->button0 |= (mouse_button_status.right ? 2 : 0); + mouse->button0 |= (mouse_button_status.middle ? 4 : 0); + } + + // NOTE - ignoring speed and setting position directly + // the game assumes resolutions, so this makes it a lot easier to make it actually + // line up with the mouse cursor + + // TODO - probably factor in scaling as well + auto win_width = 0; + auto win_height = 0; + auto game_width = 0; + auto game_height = 0; + if (Display::GetMainDisplay()) { + win_width = Display::GetMainDisplay()->get_display_manager()->get_window_width(); + win_height = Display::GetMainDisplay()->get_display_manager()->get_window_height(); + game_width = Display::GetMainDisplay()->get_display_manager()->get_window_game_width(); + game_height = Display::GetMainDisplay()->get_display_manager()->get_window_game_height(); + } + xpos -= (win_width - game_width) / 2; + ypos -= (win_height - game_height) / 2; + + // These are used to calculate the speed at which to move the mouse to it's new coordinates + // zero'd out so they are ignored and don't impact the position we are about to set + mouse->deltax = 0; + mouse->deltay = 0; + // These positions will get capped to: + // - [-256.0, 256.0] for width + // - [-208.0, 208.0] for height + // (then 208 or 256 is always added to them to get the final screen coordinate) + // So just normalize the actual window's values to this range + double width_per = xpos / double(game_width); + double height_per = ypos / double(game_height); + mouse->posx = (512.0 * width_per) - 256.0; + mouse->posy = (416.0 * height_per) - 208.0; + // fmt::print("Mouse - X:{}({}), Y:{}({})\n", xpos, mouse->posx, ypos, mouse->posy); + return _mouse; } /*! @@ -522,4 +578,66 @@ void InitMachineScheme() { } } +sqlite::SQLiteDatabase sql_db; + +void initialize_sql_db() { + // If the DB has already been initialized, no-op + if (sql_db.is_open()) { + return; + } + // In the original environment, they relied on a database already being setup with the correct + // schema We are using an embedded SQLite database, which isn't already setup, so we have to do + // that here! + + fs::path db_path = file_util::get_user_misc_dir(g_game_version) / "jak3-editor.db"; + file_util::create_dir_if_needed_for_file(db_path); + + const bool did_db_exist = file_util::file_exists(db_path.string()); + + // Attempt to open the database + const auto opened = sql_db.open_db(db_path.string()); + (void)opened; + + fs::path schema_file = + file_util::get_jak_project_dir() / "goal_src" / "jak3" / "tools" / "editable-schema.sql"; + if (!file_util::file_exists(schema_file.string())) { + lg::error("Unable to locate SQL Schema file at {}", schema_file.string()); + return; + } + + const auto success = sql_db.run_query(file_util::read_text_file(schema_file)); + // TODO - error check + + // If the database did not originally exist, let's seed it with original game data + if (!did_db_exist) { + lg::warn("[SQL]: Seeding database, this may take a bit"); + fs::path level_info_fixture = file_util::get_jak_project_dir() / "goal_src" / "jak3" / "tools" / + "db-fixtures" / "fixture-level_info.sql"; + if (file_util::file_exists(level_info_fixture.string())) { + const auto success = sql_db.run_query(file_util::read_text_file(level_info_fixture)); + // TODO - error check + } + fs::path light_fixture = file_util::get_jak_project_dir() / "goal_src" / "jak3" / "tools" / + "db-fixtures" / "fixture-light.sql"; + if (file_util::file_exists(light_fixture.string())) { + const auto success = sql_db.run_query(file_util::read_text_file(light_fixture)); + // TODO - error check + } + fs::path region_fixture = file_util::get_jak_project_dir() / "goal_src" / "jak3" / "tools" / + "db-fixtures" / "fixture-region.sql"; + if (file_util::file_exists(region_fixture.string())) { + const auto success = sql_db.run_query(file_util::read_text_file(region_fixture)); + // TODO - error check + } + } +} + +sqlite::GenericResponse run_sql_query(const std::string& query) { + if (!sql_db.is_open()) { + // TODO - error + return sqlite::GenericResponse(); + } + return sql_db.run_query(query); +} + } // namespace jak3 diff --git a/game/kernel/jak3/kmachine.h b/game/kernel/jak3/kmachine.h index 8407f9ed54..9eebeb6f52 100644 --- a/game/kernel/jak3/kmachine.h +++ b/game/kernel/jak3/kmachine.h @@ -1,8 +1,68 @@ #pragma once +#include "common/common_types.h" +#include "common/sqlite/sqlite.h" namespace jak3 { void InitParms(int argc, const char* const* argv); void InitMachineScheme(); int InitMachine(); int ShutdownMachine(); + +extern sqlite::SQLiteDatabase sql_db; +void initialize_sql_db(); +sqlite::GenericResponse run_sql_query(const std::string& query); + +struct MouseInfo { + // ((active symbol :offset-assert 4) + u32 active; + // (cursor basic :offset-assert 8) + u32 cursor; + // (valid symbol :offset-assert 12) + u32 valid; + // (id uint8 :offset-assert 16) + u8 id; + u8 pad; + // (status uint16 :offset-assert 18) + u16 status; + // (button0 uint16 :offset-assert 20) + u16 button0; + // (deltax int8 :offset-assert 22) + s8 deltax; + // (deltay int8 :offset-assert 23) + s8 deltay; + // (wheel uint8 :offset-assert 24) + u8 wheel; + u8 pad1[3]; + // (change-time time-frame :offset-assert 32) + // (button0-abs uint32 3 :offset-assert 40) + // (button0-shadow-abs uint32 1 :offset-assert 52) + // (button0-rel uint32 3 :offset-assert 56) + // (pos vector 2 :inline :offset-assert 80) + u32 pad2[13]; + // (posx float :offset 80) + float posx; + // (posy float :offset 84) + float posy; + // (oldposx float :offset 96 :do-not-decompile) + // (oldposy float :offset 100) + // (speedx float :offset 92) + // (speedy float :offset 108) +}; + +// (deftype keybd-info (basic) +// ((active symbol) +// (valid symbol) +// (kdata uint8 16) +// (keys uint8 256) +// ) +// (:methods +// (new (symbol type) _type_) +// ) +// ) +struct KeybdInfo { + u32 active; + u32 valid; + u8 kdata[16]; + u8 keys[256]; +}; } // namespace jak3 \ No newline at end of file diff --git a/game/kernel/jak3/kscheme.h b/game/kernel/jak3/kscheme.h index 776a598555..c9c5052bed 100644 --- a/game/kernel/jak3/kscheme.h +++ b/game/kernel/jak3/kscheme.h @@ -11,6 +11,8 @@ constexpr s32 SYMBOL_OFFSET = 1; extern Ptr SymbolString; extern bool DebugSymbols; +extern Ptr> SqlResult; + /*! * GOAL Type */ @@ -53,6 +55,7 @@ u64 print_object(u32 obj); u64 inspect_object(u32 obj); Ptr> find_symbol_from_c(uint16_t sym_id, const char* name); u64 make_string_from_c(const char* c_str); +u64 make_debug_string_from_c(const char* c_str); u64 call_method_of_type(u32 arg, Ptr type, u32 method_id); u64 new_pair(u32 heap, u32 type, u32 car, u32 cdr); u64 call_goal_function_by_name(const char* name); diff --git a/goal_src/jak3/engine/debug/collision-editor.gc b/goal_src/jak3/engine/debug/collision-editor.gc index 87a727490d..f59be64d36 100644 --- a/goal_src/jak3/engine/debug/collision-editor.gc +++ b/goal_src/jak3/engine/debug/collision-editor.gc @@ -142,7 +142,7 @@ ;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 -(defun print-default-collision ((arg0 process-drawable)) +(defun print-default-collision () (local-vars (sv-224 matrix) (sv-240 symbol) (sv-256 string) (sv-272 float) (sv-288 float)) (let ((gp-0 (process-spawn collision-editor-default-proc :name "collision-editor-default-proc"))) (when gp-0 @@ -162,14 +162,14 @@ ) (format #t " :children (~%") (let* ((t9-10 (method-of-type res-lump get-property-struct)) - (a0-11 (-> (the-as process-drawable (-> gp-0 0)) draw jgeo extra)) + (a0-10 (-> (the-as process-drawable (-> gp-0 0)) draw jgeo extra)) (a1-10 'collide-mesh-group) (a2-3 'interp) (a3-3 -1000000000.0) (t0-0 (the-as float #f)) (s5-1 (the-as (array collide-mesh) - (t9-10 a0-11 a1-10 a2-3 a3-3 (the-as structure t0-0) (the-as (pointer res-tag) #f) *res-static-buf*) + (t9-10 a0-10 a1-10 a2-3 a3-3 (the-as structure t0-0) (the-as (pointer res-tag) #f) *res-static-buf*) ) ) ) @@ -198,12 +198,12 @@ ) (else (let ((t9-19 format) - (a0-23 #t) + (a0-22 #t) (a1-18 " :transform-index (joint-node-index ~S ~S)~%") (a2-5 *collision-editor-art-group-name*) (a3-12 (-> (the-as process-drawable (-> gp-0 0)) node-list data (+ (-> s5-1 s4-0 joint-id) 1) joint name)) ) - (t9-19 a0-23 a1-18 a2-5 a3-12) + (t9-19 a0-22 a1-18 a2-5 a3-12) (let ((s0-0 (new 'stack 'collide-shape-prim-mesh (the-as collide-shape 0) (the-as uint a3-12) (the-as uint t0-0)))) (set! (-> s0-0 cshape) (the-as collide-shape (-> (the-as process-drawable (-> gp-0 0)) root))) (set! (-> s0-0 transform-index) (+ (-> s5-1 s4-0 joint-id) 1)) @@ -213,82 +213,82 @@ (set! (-> s0-0 mesh-cache-id) (the-as uint 0)) (set! (-> s0-0 mesh-id) s4-0) (collision-editor-add-mesh-to-ccache (the-as collide-shape-prim-group s0-0) *collide-cache*) - (let ((a0-26 (the-as object (-> *collide-cache* tris))) + (let ((a0-25 (the-as object (-> *collide-cache* tris))) (v1-41 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) ) (when (nonzero? (-> *collide-cache* num-tris)) - (vector-copy! v1-41 (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0)) - (vector-copy! s2-0 (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0)) + (vector-copy! v1-41 (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0)) + (vector-copy! s2-0 (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0)) ) (countdown (a1-27 (-> *collide-cache* num-tris)) (set! (-> v1-41 x) (fmin (fmin - (fmin (-> v1-41 x) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 x)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 x) + (fmin (-> v1-41 x) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 x)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 x) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 x) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 x) ) ) (set! (-> v1-41 y) (fmin (fmin - (fmin (-> v1-41 y) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 y)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 y) + (fmin (-> v1-41 y) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 y)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 y) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 y) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 y) ) ) (set! (-> v1-41 z) (fmin (fmin - (fmin (-> v1-41 z) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 z)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 z) + (fmin (-> v1-41 z) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 z)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 z) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 z) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 z) ) ) (set! (-> s2-0 x) (fmax (fmax - (fmax (-> s2-0 x) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 x)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 x) + (fmax (-> s2-0 x) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 x)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 x) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 x) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 x) ) ) (set! (-> s2-0 y) (fmax (fmax - (fmax (-> s2-0 y) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 y)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 y) + (fmax (-> s2-0 y) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 y)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 y) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 y) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 y) ) ) (set! (-> s2-0 z) (fmax (fmax - (fmax (-> s2-0 z) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 z)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 z) + (fmax (-> s2-0 z) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 z)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 z) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 z) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 z) ) ) - (set! a0-26 (-> (the-as (inline-array collide-cache-tri) a0-26) 1)) + (set! a0-25 (-> (the-as (inline-array collide-cache-tri) a0-25) 1)) ) (vector+! s3-0 v1-41 s2-0) (vector-float*! s3-0 s3-0 0.5) (vector<-cspace! s1-0 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index))) (vector-! s1-0 s3-0 s1-0) (set! sv-224 (new 'stack-no-clear 'matrix)) - (let* ((a0-35 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) - (a2-11 (-> a0-35 rvec quad)) - (a1-36 (-> a0-35 uvec quad)) - (v1-53 (-> a0-35 fvec quad)) - (a0-36 (-> a0-35 trans quad)) + (let* ((a0-34 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) + (a2-11 (-> a0-34 rvec quad)) + (a1-36 (-> a0-34 uvec quad)) + (v1-53 (-> a0-34 fvec quad)) + (a0-35 (-> a0-34 trans quad)) ) (set! (-> sv-224 rvec quad) a2-11) (set! (-> sv-224 uvec quad) a1-36) (set! (-> sv-224 fvec quad) v1-53) - (set! (-> sv-224 trans quad) a0-36) + (set! (-> sv-224 trans quad) a0-35) ) (vector-reset! (-> sv-224 trans)) (matrix-transpose! sv-224 sv-224) @@ -477,9 +477,9 @@ (current-prim int32) ) (:methods - (collision-edit-info-method-9 (_type_) none) + (handle-pad-input (_type_) none) (draw-menu (_type_ process-drawable) none) - (collision-edit-info-method-11 (_type_ process-drawable) none) + (set-current-prim! (_type_ process-drawable) none) ) ) @@ -524,7 +524,7 @@ (the-as collide-shape-prim #f) ) -(defmethod collision-edit-info-method-9 ((this collision-edit-info)) +(defmethod handle-pad-input ((this collision-edit-info)) (if (cpad-pressed? 0 up) (+! (-> this current-func) -1) ) @@ -549,7 +549,7 @@ (none) ) -(defmethod collision-edit-info-method-11 ((this collision-edit-info) (arg0 process-drawable)) +(defmethod set-current-prim! ((this collision-edit-info) (arg0 process-drawable)) (local-vars (s5-0 int)) (when (not arg0) (set! s5-0 (the-as int #f)) @@ -609,8 +609,8 @@ ) (else (set! *external-cam-mode* 'locked) - (collision-edit-info-method-9 this) - (collision-edit-info-method-11 this arg0) + (handle-pad-input this) + (set-current-prim! this arg0) (let ((s3-0 ">") (s4-0 " ") ) diff --git a/goal_src/jak3/engine/debug/default-menu.gc b/goal_src/jak3/engine/debug/default-menu.gc index 6978819728..717a763236 100644 --- a/goal_src/jak3/engine/debug/default-menu.gc +++ b/goal_src/jak3/engine/debug/default-menu.gc @@ -3175,6 +3175,7 @@ (send-event *target* 'change-mode 'pilot #f arg0 #t) ) +;; og:preserve-this added (defun dm-game-opengoal-cheat-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) (if (= arg1 (debug-menu-msg press)) (logxor! (-> *pc-settings* cheats) (the-as uint (/ arg0 8))) @@ -4936,13 +4937,9 @@ (function "Start Editor" #f - ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (when (not (get-nav-graph-editor)) - (let ((t9-1 run-nav-graph-editor) - (a0-1 'test) - ) - (t9-1 a0-1) + ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (if (not (get-nav-graph-editor)) + (run-nav-graph-editor 'test #f) ) - ) ) ) (function @@ -4956,24 +4953,22 @@ (function "Toggle Plane Mode" #f - ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) - (let ((a0-1 (get-nav-graph-editor))) - (if a0-1 - ((method-of-object a0-1 nav-graph-editor-method-64)) + ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) + (if a0-1 + (nav-graph-editor-method-64 a0-1) + ) + ) ) - ) - ) ) (function "Toggle Hover Mode" #f - ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) - (let ((a0-1 (get-nav-graph-editor))) - (if a0-1 - ((method-of-object a0-1 nav-graph-editor-method-65)) + ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) + (if a0-1 + (nav-graph-editor-method-65 a0-1) + ) + ) ) - ) - ) ) (menu "Load" @@ -4982,13 +4977,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'hover - 'foresta - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'hover (the-as string 'foresta)) ) - ) ) ) ) @@ -4997,13 +4988,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'hover - 'sewc - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'hover (the-as string 'sewc)) ) - ) ) ) ) @@ -5012,13 +4999,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'hover - 'sewg - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'hover (the-as string 'sewg)) ) - ) ) ) ) @@ -5027,13 +5010,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'hover - 'sewl - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'hover (the-as string 'sewl)) ) - ) ) ) ) @@ -5042,12 +5021,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'traffic - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'traffic (the-as string #f)) ) - ) ) ) ) @@ -5056,12 +5032,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'minimap - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'minimap (the-as string #f)) ) - ) ) ) ) @@ -5070,12 +5043,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'flyingsaw_2 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'flyingsaw_2 (the-as string #f)) ) - ) ) ) ) @@ -5084,12 +5054,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'flyingsaw_3 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'flyingsaw_3 (the-as string #f)) ) - ) ) ) ) @@ -5098,12 +5065,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'forest-plant-1 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'forest-plant-1 (the-as string #f)) ) - ) ) ) ) @@ -5112,12 +5076,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'forest-plant-2 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'forest-plant-2 (the-as string #f)) ) - ) ) ) ) @@ -5126,12 +5087,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'forest-plant-3 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'forest-plant-3 (the-as string #f)) ) - ) ) ) ) @@ -5140,12 +5098,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'forest-plant-4 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'forest-plant-4 (the-as string #f)) ) - ) ) ) ) @@ -5154,12 +5109,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'beast - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'beast (the-as string #f)) ) - ) ) ) ) @@ -5168,12 +5120,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'wasminimap - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'wasminimap (the-as string #f)) ) - ) ) ) ) @@ -5182,12 +5131,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'desrescue - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'desrescue (the-as string #f)) ) - ) ) ) ) @@ -5196,12 +5142,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'assault - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'assault (the-as string #f)) ) - ) ) ) ) @@ -5210,12 +5153,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'timer-chase-1 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'timer-chase-1 (the-as string #f)) ) - ) ) ) ) @@ -5224,12 +5164,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'protect-hq - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'protect-hq (the-as string #f)) ) - ) ) ) ) @@ -5238,12 +5175,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'blow-tower - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'blow-tower (the-as string #f)) ) - ) ) ) ) @@ -5252,12 +5186,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'desert-lizard - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'desert-lizard (the-as string #f)) ) - ) ) ) ) @@ -5266,12 +5197,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'terraformer-walk - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'terraformer-walk (the-as string #f)) ) - ) ) ) ) @@ -5280,12 +5208,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'terraformer-fly - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'terraformer-fly (the-as string #f)) ) - ) ) ) ) @@ -5294,12 +5219,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'beast-battle - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'beast-battle (the-as string #f)) ) - ) ) ) ) @@ -5308,12 +5230,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'desert-chase-marauder - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'desert-chase-marauder (the-as string #f)) ) - ) ) ) ) @@ -5321,13 +5240,12 @@ (function "Save" #f - ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) - (let ((a0-1 (get-nav-graph-editor))) - (if a0-1 - ((method-of-object a0-1 nav-graph-editor-method-67)) + ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) + (if a0-1 + (nav-graph-editor-method-67 a0-1) + ) + ) ) - ) - ) ) ) ) @@ -5344,20 +5262,7 @@ ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (when (not *nav-mesh-editor*) (kill-by-type nav-mesh-editor *active-pool*) - (let ((gp-0 (get-process *default-dead-pool* nav-mesh-editor #x4000 1))) - (when gp-0 - (let ((t9-2 (method-of-type nav-mesh-editor activate))) - (t9-2 (the-as nav-mesh-editor gp-0) *entity-pool* "nav-mesh-editor" (the-as pointer #x70004000)) - ) - (let ((t9-3 run-function-in-process) - (a0-4 gp-0) - (a1-4 nav-mesh-editor-init) - ) - ((the-as (function object object none) t9-3) a0-4 a1-4) - ) - (-> gp-0 ppointer) - ) - ) + (process-spawn nav-mesh-editor :init nav-mesh-editor-init #f :name "nav-mesh-editor" :to *entity-pool*) ) ) ) @@ -7115,24 +7020,24 @@ ((and (cpad-hold? 0 l3) (cpad-hold? 0 select)) (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg activate) (debug-menu-dest activation)) (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) - ;; (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) ) ((and (cpad-hold? 1 start) *editable*) - ;; (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg activate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg activate) (debug-menu-dest activation)) (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) ) ((and (cpad-hold? 0 l3) (cpad-hold? 0 start)) (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg activate) (debug-menu-dest activation)) (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) - ;; (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) ) ) ) (else (debug-menu-context-send-msg *debug-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) (debug-menu-context-send-msg *popup-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) - ;; (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) ) ) #f diff --git a/goal_src/jak3/engine/debug/editable-h.gc b/goal_src/jak3/engine/debug/editable-h.gc index 95ceb24764..da09423ac9 100644 --- a/goal_src/jak3/engine/debug/editable-h.gc +++ b/goal_src/jak3/engine/debug/editable-h.gc @@ -136,6 +136,10 @@ (declare-type editable-plane editable) (declare-type editable-region basic) +(define-extern *editable-sample-region* editable-region) +(define-extern *editable-light-region* editable-region) +(define-extern *editable-entity-region* editable-region) + ;; DECOMP BEGINS ;; this file is debug only @@ -444,16 +448,16 @@ (filter editable-filter) (tree symbol) (level string) - (on-enter string) - (on-inside string) - (on-exit string) + (on-enter pair) + (on-inside pair) + (on-exit pair) ) (:methods (new (symbol type) _type_) - (editable-region-method-9 () none) - (editable-region-method-10 () none) - (editable-region-method-11 () none) - (editable-region-method-12 () none) + (save-region! (_type_ editable-array int int) symbol) + (editable-region-method-10 (_type_ int) symbol) + (print-region-info (_type_ vector int) none) + (editable-region-method-12 (_type_) editable-filter) ) ) @@ -467,33 +471,33 @@ (prefix basic) ) (:methods - (editable-method-9 () none) - (editable-method-10 () none) - (editable-method-11 () none) - (editable-method-12 () none) - (editable-method-13 () none) - (editable-method-14 () none) - (editable-method-15 () none) - (editable-method-16 () none) - (editable-method-17 () none) - (editable-method-18 () none) - (editable-method-19 () none) - (editable-method-20 () none) - (editable-method-21 () none) - (editable-method-22 () none) - (editable-method-23 () none) - (editable-method-24 () none) - (editable-method-25 () none) - (editable-method-26 () none) - (editable-method-27 () none) - (editable-method-28 () none) - (editable-method-29 () none) - (editable-method-30 () none) - (editable-method-31 () none) - (editable-method-32 () none) - (editable-method-33 () none) - (editable-method-34 () none) - (editable-method-35 () none) + (get-color (_type_) rgba) + (editable-method-10 (_type_) none) + (editable-method-11 (_type_ vector) symbol) + (set-selected! (_type_ symbol) none) + (editable-method-13 (_type_ vector) float) + (editable-method-14 (_type_ vector vector) float) + (editable-method-15 (_type_) vector) + (editable-method-16 (_type_) float) + (editable-method-17 (_type_ vector editable-flag) none) + (editable-method-18 (_type_ vector int) none) + (editable-method-19 (_type_ vector) none) + (editable-method-20 (_type_ vector matrix) none) + (editable-method-21 (_type_ vector) none) + (editable-method-22 (_type_ vector vector vector vector) none) + (change-region! (_type_ editable-region) none) + (editable-method-24 (_type_ editable-array int int) symbol) + (editable-method-25 (_type_) symbol) + (editable-method-26 (_type_) none) + (delete! (_type_ editable) none) + (editable-method-28 (_type_ editable editable) none) + (copy-into-editable-array! (_type_ editable-array) editable) + (editable-method-30 (_type_ editable-flag) none) + (editable-method-31 (_type_ editable-flag) none) + (get-null-vec (_type_) vector) + (get-null-vec2 (_type_ vector) vector) + (get-level-offset (_type_ editable-array) vector) + (editable-method-35 (_type_ vector) none) ) ) @@ -523,17 +527,17 @@ ) (:methods (new (symbol type int) _type_) - (editable-array-method-9 () none) - (editable-array-method-10 () none) - (editable-array-method-11 () none) - (editable-array-method-12 () none) - (editable-array-method-13 () none) - (editable-array-method-14 () none) - (editable-array-method-15 () none) - (editable-array-method-16 () none) - (editable-array-method-17 () none) - (editable-array-method-18 () none) - (editable-array-method-19 () none) + (handle-cmd (_type_ editable-command mouse-info object) symbol) + (editable-array-method-10 (_type_ vector int) editable) + (editable-array-method-11 (_type_ vector vector int) none) + (get-length (_type_) int) + (editable-array-method-13 (_type_ symbol) symbol) + (editable-array-method-14 (_type_ editable-command editable-command string) none) + (editable-array-method-15 (_type_ (function editable editable-region symbol) editable-region) (array editable)) + (editable-array-method-16 (_type_ editable) none) + (editable-array-method-17 (_type_) none) + (editable-array-method-18 (_type_ vector vector) vector) + (editable-array-method-19 (_type_ string) symbol) ) ) @@ -592,21 +596,16 @@ (set! (-> gp-0 region) #f) (set! (-> gp-0 name) "undefined") (set! (-> gp-0 prefix) "undefined") - (let* ((s3-0 gp-0) - (s2-0 (method-of-object s3-0 editable-method-23)) - ) - (set! arg1 (cond - (arg1 - (empty) - arg1 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s2-0) - ) + (change-region! gp-0 (cond + (arg1 + (empty) + arg1 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (vector-copy! (-> gp-0 trans) arg0) (set! (-> gp-0 radius) 2048.0) (set! (-> gp-0 owner) '()) @@ -627,21 +626,16 @@ (set! (-> s5-0 region) #f) (set! (-> s5-0 name) "undefined") (set! (-> s5-0 prefix) "undefined") - (let* ((s2-0 s5-0) - (s1-0 (method-of-object s2-0 editable-method-23)) - ) - (set! arg2 (cond - (arg2 - (empty) - arg2 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s1-0) - ) + (change-region! s5-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (vector-copy! (-> s5-0 trans) arg0) (set! (-> s5-0 radius) arg1) (set! (-> s5-0 owner) '()) @@ -677,21 +671,16 @@ (defmethod new editable-light ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region)) (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> gp-0 region) #f) - (let* ((s2-0 gp-0) - (s1-0 (method-of-object s2-0 editable-method-23)) - ) - (set! arg2 (cond - (arg2 - (empty) - arg2 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s1-0) - ) + (change-region! gp-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (vector-copy! (-> gp-0 trans) arg0) (set! (-> gp-0 radius) arg1) (set! (-> gp-0 owner) '()) @@ -721,7 +710,8 @@ ) (:methods (new (symbol type vector float editable-region) _type_) - (editable-entity-method-36 () none) + (editable-entity-method-36 (_type_) none) + (copy-into-editable-array! (_type_ editable-array) editable-entity :replace) ) ) @@ -729,21 +719,16 @@ (defmethod new editable-entity ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region)) (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> gp-0 region) #f) - (let* ((s2-0 gp-0) - (s1-0 (method-of-object s2-0 editable-method-23)) - ) - (set! arg2 (cond - (arg2 - (empty) - arg2 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s1-0) - ) + (change-region! gp-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (vector-copy! (-> gp-0 trans) arg0) (set! (-> gp-0 radius) arg1) (set! (-> gp-0 owner) '()) @@ -761,8 +746,9 @@ ) (:methods (new (symbol type editable-region) _type_) - (editable-face-method-36 () none) - (editable-face-method-37 () none) + (editable-face-method-36 (_type_ (inline-array vector)) int) + (editable-face-method-37 (_type_ vector) vector) + (copy-into-editable-array! (_type_ editable-array) editable-face :replace) ) ) @@ -772,21 +758,16 @@ (set! (-> gp-0 region) #f) (set! (-> gp-0 name) "undefined") (set! (-> gp-0 prefix) "undefined") - (let* ((s4-0 gp-0) - (s3-0 (method-of-object s4-0 editable-method-23)) - ) - (set! arg0 (cond - (arg0 - (empty) - arg0 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s3-0) - ) + (change-region! gp-0 (cond + (arg0 + (empty) + arg0 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (set! (-> gp-0 owner) '()) gp-0 ) @@ -799,8 +780,9 @@ ) (:methods (new (symbol type editable-region) _type_) - (editable-plane-method-36 () none) - (editable-plane-method-37 () none) + (editable-plane-method-36 (_type_ (inline-array vector)) int) + (editable-plane-method-37 (_type_ vector) vector) + (copy-into-editable-array! (_type_ editable-array) editable-plane :replace) ) ) @@ -810,21 +792,16 @@ (set! (-> gp-0 region) #f) (set! (-> gp-0 name) "undefined") (set! (-> gp-0 prefix) "undefined") - (let* ((s4-0 gp-0) - (s3-0 (method-of-object s4-0 editable-method-23)) - ) - (set! arg0 (cond - (arg0 - (empty) - arg0 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s3-0) - ) + (change-region! gp-0 (cond + (arg0 + (empty) + arg0 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (set! (-> gp-0 owner) '()) (set! (-> gp-0 radius) 20480.0) gp-0 @@ -833,10 +810,10 @@ (deftype editable-player (process-drawable) ((current editable-array) - (current-command uint32) - (select-command function) + (current-command editable-command) + (select-command (function object)) (drag-command uint32) - (extra-command function) + (extra-command (function object)) (left-handed basic) (light-names basic) (external-cam-mode symbol) @@ -854,11 +831,13 @@ (float-min float) (float-id uint32) ) + (:state-methods + idle + ) (:methods - (editable-player-method-20 () none) - (editable-player-method-21 () none) - (editable-player-method-22 () none) - (editable-player-method-23 () none) + (editable-player-method-21 (_type_) none) + (editable-player-method-22 (_type_) none) + (editable-player-method-23 (_type_) symbol) ) ) diff --git a/goal_src/jak3/engine/debug/editable-player.gc b/goal_src/jak3/engine/debug/editable-player.gc index 6f1a65831b..07cc4b4d71 100644 --- a/goal_src/jak3/engine/debug/editable-player.gc +++ b/goal_src/jak3/engine/debug/editable-player.gc @@ -10,3 +10,3652 @@ ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) + +;; WARN: Return type mismatch int vs object. +(defun cleanup-selection ((arg0 editable-array)) + (let* ((v1-0 (-> arg0 length)) + (a0-1 0) + (a1-2 (-> arg0 data a0-1)) + ) + (while (< a0-1 v1-0) + (if a1-2 + (logclear! (-> a1-2 flags) (editable-flag mark)) + ) + (+! a0-1 1) + (set! a1-2 (-> arg0 data a0-1)) + ) + ) + (let* ((s5-0 (-> arg0 length)) + (s4-0 0) + (a0-2 (-> arg0 data s4-0)) + ) + (while (< s4-0 s5-0) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (editable-method-31 a0-2 (editable-flag)) + ) + (+! s4-0 1) + (set! a0-2 (-> arg0 data s4-0)) + ) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun insert-box ((arg0 editable-array) (arg1 vector) (arg2 vector)) + (if (not (-> arg0 region)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((f30-0 (* 4096.0 (-> arg0 edit-param0))) + (s2-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'array 'int32 8)) + ) + (let ((s3-0 (-> arg0 region))) + (if (= f30-0 0.0) + (set! f30-0 40960.0) + ) + (dotimes (s0-0 8) + (set! (-> s4-0 s0-0) (get-length arg0)) + (set! (-> arg0 data (-> s4-0 s0-0)) (the-as editable #t)) + ) + (dotimes (v1-13 8) + (when (< (-> s4-0 v1-13) 0) + (dotimes (v1-14 8) + (set! (-> arg0 data (-> s4-0 v1-14)) #f) + ) + (return (the-as object #f)) + ) + ) + (vector-copy! s2-0 arg1) + (set! (-> s2-0 y) (- (-> s2-0 y) f30-0)) + (set! (-> s2-0 x) (- (-> s2-0 x) f30-0)) + (set! (-> s2-0 z) (- (-> s2-0 z) f30-0)) + (set! (-> arg0 data (-> s4-0 0)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (set! (-> s2-0 y) (- (-> s2-0 y) f30-0)) + (+! (-> s2-0 x) f30-0) + (set! (-> s2-0 z) (- (-> s2-0 z) f30-0)) + (set! (-> arg0 data (-> s4-0 1)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (set! (-> s2-0 y) (- (-> s2-0 y) f30-0)) + (set! (-> s2-0 x) (- (-> s2-0 x) f30-0)) + (+! (-> s2-0 z) f30-0) + (set! (-> arg0 data (-> s4-0 2)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (set! (-> s2-0 y) (- (-> s2-0 y) f30-0)) + (+! (-> s2-0 x) f30-0) + (+! (-> s2-0 z) f30-0) + (set! (-> arg0 data (-> s4-0 3)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (+! (-> s2-0 y) f30-0) + (set! (-> s2-0 x) (- (-> s2-0 x) f30-0)) + (set! (-> s2-0 z) (- (-> s2-0 z) f30-0)) + (set! (-> arg0 data (-> s4-0 4)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (+! (-> s2-0 y) f30-0) + (+! (-> s2-0 x) f30-0) + (set! (-> s2-0 z) (- (-> s2-0 z) f30-0)) + (set! (-> arg0 data (-> s4-0 5)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (+! (-> s2-0 y) f30-0) + (set! (-> s2-0 x) (- (-> s2-0 x) f30-0)) + (+! (-> s2-0 z) f30-0) + (set! (-> arg0 data (-> s4-0 6)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (+! (-> s2-0 y) f30-0) + (+! (-> s2-0 x) f30-0) + (+! (-> s2-0 z) f30-0) + (set! (-> arg0 data (-> s4-0 7)) (new 'debug 'editable-point s2-0 s3-0)) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 0)) #t) + (set-selected! (-> arg0 data (-> s4-0 1)) #t) + (set-selected! (-> arg0 data (-> s4-0 2)) #t) + (set-selected! (-> arg0 data (-> s4-0 3)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 4)) #t) + (set-selected! (-> arg0 data (-> s4-0 5)) #t) + (set-selected! (-> arg0 data (-> s4-0 6)) #t) + (set-selected! (-> arg0 data (-> s4-0 7)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command flip-side) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 0)) #t) + (set-selected! (-> arg0 data (-> s4-0 2)) #t) + (set-selected! (-> arg0 data (-> s4-0 4)) #t) + (set-selected! (-> arg0 data (-> s4-0 6)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 1)) #t) + (set-selected! (-> arg0 data (-> s4-0 3)) #t) + (set-selected! (-> arg0 data (-> s4-0 5)) #t) + (set-selected! (-> arg0 data (-> s4-0 7)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command flip-side) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 0)) #t) + (set-selected! (-> arg0 data (-> s4-0 1)) #t) + (set-selected! (-> arg0 data (-> s4-0 4)) #t) + (set-selected! (-> arg0 data (-> s4-0 5)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command flip-side) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 2)) #t) + (set-selected! (-> arg0 data (-> s4-0 3)) #t) + (set-selected! (-> arg0 data (-> s4-0 6)) #t) + (set-selected! (-> arg0 data (-> s4-0 7)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set! (-> arg0 region) s3-0) + ) + (dotimes (s3-1 8) + (set-selected! (-> arg0 data (-> s4-0 s3-1)) #t) + ) + ) + (handle-cmd arg0 (editable-command select-current-owner) (the-as mouse-info #f) arg2) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun insert-wall ((arg0 editable-array) (arg1 vector) (arg2 vector)) + (if (not (-> arg0 region)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((f30-0 (* 4096.0 (-> arg0 edit-param0))) + (s1-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'array 'int32 2)) + ) + (let ((s3-0 (-> arg0 region))) + (if (= f30-0 0.0) + (set! f30-0 40960.0) + ) + (dotimes (s0-0 2) + (set! (-> s4-0 s0-0) (get-length arg0)) + (set! (-> arg0 data (-> s4-0 s0-0)) (the-as editable #t)) + ) + (dotimes (v1-13 2) + (when (< (-> s4-0 v1-13) 0) + (dotimes (v1-14 2) + (set! (-> arg0 data (-> s4-0 v1-14)) #f) + ) + (return (the-as object #f)) + ) + ) + (vector-copy! s1-0 arg1) + (set! (-> s1-0 y) (- (-> s1-0 y) f30-0)) + (set! (-> s1-0 x) (- (-> s1-0 x) f30-0)) + (set! (-> arg0 data (-> s4-0 0)) (new 'debug 'editable-point s1-0 s3-0)) + (vector-copy! s1-0 arg1) + (+! (-> s1-0 y) f30-0) + (+! (-> s1-0 x) f30-0) + (set! (-> arg0 data (-> s4-0 1)) (new 'debug 'editable-point s1-0 s3-0)) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 0)) #t) + (set-selected! (-> arg0 data (-> s4-0 1)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set! (-> arg0 region) s3-0) + ) + (dotimes (s3-1 2) + (set-selected! (-> arg0 data (-> s4-0 s3-1)) #t) + ) + ) + (handle-cmd arg0 (editable-command select-current-owner) (the-as mouse-info #f) arg2) + 0 + ) + +(defun update-manipulator-position ((arg0 editable-array) (arg1 manipulator)) + (local-vars (sv-32 vector) (sv-40 int) (sv-48 euler-angles)) + (set! sv-32 (new-stack-vector0)) + (set! sv-40 0) + (set! sv-48 (the-as euler-angles #f)) + (let* ((s4-0 (-> arg0 length)) + (s3-0 0) + (s2-0 (-> arg0 data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (set! sv-48 (the-as euler-angles (get-null-vec s2-0))) + (vector+! sv-32 sv-32 (editable-method-15 s2-0)) + (set! sv-40 (+ sv-40 1)) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s2-0 region)) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> arg0 data s3-0)) + ) + ) + (when (nonzero? sv-40) + (vector-float*! (-> arg1 position) sv-32 (/ 1.0 (the float sv-40))) + (set! (-> arg1 angles quad) (-> sv-48 quad)) + (eul->matrix (-> arg1 mat) sv-48) + ) + ) + +(defun execute-select ((arg0 editable-array) (arg1 editable-command) (arg2 mouse-info) (arg3 manipulator)) + (case arg1 + (((editable-command select-none)) + (let* ((s5-1 (-> arg0 length)) + (s4-1 0) + (a0-2 (-> arg0 data s4-1)) + ) + (while (< s4-1 s5-1) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (set-selected! a0-2 #f) + ) + (+! s4-1 1) + (set! a0-2 (-> arg0 data s4-1)) + ) + ) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) #f) + ) + ) + (((editable-command select-all)) + (let* ((s5-2 (-> arg0 length)) + (s4-2 0) + (a0-4 (-> arg0 data s4-2)) + ) + (while (< s4-2 s5-2) + (if (and a0-4 (or (and (logtest? (-> a0-4 region filter) (-> arg0 filter 0)) + (logtest? (-> a0-4 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> a0-4 flags) (editable-flag selected)) + ) + ) + (set-selected! a0-4 #t) + ) + (+! s4-2 1) + (set! a0-4 (-> arg0 data s4-2)) + ) + ) + ) + (((editable-command select-one)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-7 arg0) + (t9-4 (method-of-object a0-7 editable-array-method-10)) + (a1-12 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-12 x) (-> arg2 posx)) + (set! (-> a1-12 y) (-> arg2 posy)) + (set! (-> a1-12 z) 0.0) + (set! (-> a1-12 w) 1.0) + (let ((s3-1 (t9-4 a0-7 a1-12 0))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (when s3-1 + (set-selected! s3-1 #t) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s3-1 region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-add)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-13 arg0) + (t9-10 (method-of-object a0-13 editable-array-method-10)) + (a1-17 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-17 x) (-> arg2 posx)) + (set! (-> a1-17 y) (-> arg2 posy)) + (set! (-> a1-17 z) 0.0) + (set! (-> a1-17 w) 1.0) + (let ((s4-3 (t9-10 a0-13 a1-17 0))) + (when s4-3 + (set-selected! s4-3 #t) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s4-3 region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-remove)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-18 arg0) + (t9-15 (method-of-object a0-18 editable-array-method-10)) + (a1-21 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-21 x) (-> arg2 posx)) + (set! (-> a1-21 y) (-> arg2 posy)) + (set! (-> a1-21 z) 0.0) + (set! (-> a1-21 w) 1.0) + (let ((s4-4 (t9-15 a0-18 a1-21 0))) + (when s4-4 + (set-selected! s4-4 #f) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s4-4 region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-toggle)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-23 arg0) + (t9-20 (method-of-object a0-23 editable-array-method-10)) + (a1-25 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-25 x) (-> arg2 posx)) + (set! (-> a1-25 y) (-> arg2 posy)) + (set! (-> a1-25 z) 0.0) + (set! (-> a1-25 w) 1.0) + (let ((s4-5 (t9-20 a0-23 a1-25 1))) + (when s4-5 + (set-selected! s4-5 'toggle) + (if (and (logtest? (-> s4-5 flags) (editable-flag selected)) (not (-> arg0 region-lock?))) + (set! (-> arg0 region) (-> s4-5 region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-region)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-28 arg0) + (t9-25 (method-of-object a0-28 editable-array-method-10)) + (a1-29 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-29 x) (-> arg2 posx)) + (set! (-> a1-29 y) (-> arg2 posy)) + (set! (-> a1-29 z) 0.0) + (set! (-> a1-29 w) 1.0) + (let ((s3-6 (t9-25 a0-28 a1-29 0))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (when s3-6 + (set-selected! s3-6 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s3-6 region)) + (handle-cmd arg0 (editable-command select-current-region) arg2 arg3) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-face)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-35 arg0) + (t9-32 (method-of-object a0-35 editable-array-method-10)) + (a1-35 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-35 x) (-> arg2 posx)) + (set! (-> a1-35 y) (-> arg2 posy)) + (set! (-> a1-35 z) 0.0) + (set! (-> a1-35 w) 1.0) + (let ((s3-8 (t9-32 a0-35 a1-35 0))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (when s3-8 + (set-selected! s3-8 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s3-8 region)) + (handle-cmd arg0 (editable-command select-current-face) arg2 arg3) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-prim)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-42 arg0) + (t9-39 (method-of-object a0-42 editable-array-method-10)) + (a1-41 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-41 x) (-> arg2 posx)) + (set! (-> a1-41 y) (-> arg2 posy)) + (set! (-> a1-41 z) 0.0) + (set! (-> a1-41 w) 1.0) + (let ((s3-10 (t9-39 a0-42 a1-41 0))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (when s3-10 + (set-selected! s3-10 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s3-10 region)) + (handle-cmd arg0 (editable-command select-current-prim) arg2 arg3) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-current-region)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (when (-> arg0 region) + (let ((s3-12 (-> arg0 region))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set! (-> arg0 region) s3-12) + ) + (let* ((s4-6 (-> arg0 length)) + (s3-13 0) + (a0-50 (-> arg0 data s3-13)) + ) + (while (< s3-13 s4-6) + (when (and a0-50 (or (and (logtest? (-> a0-50 region filter) (-> arg0 filter 0)) + (logtest? (-> a0-50 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> a0-50 flags) (editable-flag selected)) + ) + ) + (if (= (-> arg0 region) (-> a0-50 region)) + (set-selected! a0-50 #t) + ) + ) + (+! s3-13 1) + (set! a0-50 (-> arg0 data s3-13)) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-current-owner)) + (let* ((s4-7 (-> arg0 length)) + (s3-14 0) + (v1-145 (-> arg0 data s3-14)) + ) + (while (< s3-14 s4-7) + (when (and v1-145 (logtest? (-> v1-145 flags) (editable-flag selected))) + (let* ((s2-8 (-> v1-145 owner)) + (a0-56 (car s2-8)) + ) + (while (not (null? s2-8)) + (set-selected! (the-as editable a0-56) #t) + (set! s2-8 (cdr s2-8)) + (set! a0-56 (car s2-8)) + ) + ) + ) + (+! s3-14 1) + (set! v1-145 (-> arg0 data s3-14)) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-current-face)) + (let* ((s4-8 (-> arg0 length)) + (s3-15 0) + (v1-159 (-> arg0 data s3-15)) + ) + (while (< s3-15 s4-8) + (when (and v1-159 (logtest? (-> v1-159 flags) (editable-flag selected))) + (let* ((s2-9 (-> v1-159 owner)) + (a0-62 (car s2-9)) + ) + (while (not (null? s2-9)) + (set-selected! (the-as editable a0-62) #t) + (set! s2-9 (cdr s2-9)) + (set! a0-62 (car s2-9)) + ) + ) + ) + (+! s3-15 1) + (set! v1-159 (-> arg0 data s3-15)) + ) + ) + (let* ((s4-9 (-> arg0 length)) + (s3-16 0) + (s2-10 (-> arg0 data s3-16)) + ) + (while (< s3-16 s4-9) + (when (and s2-10 (or (and (logtest? (-> s2-10 region filter) (-> arg0 filter 0)) + (logtest? (-> s2-10 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> s2-10 flags) (editable-flag selected)) + ) + ) + (let* ((s1-0 (-> s2-10 owner)) + (v1-180 (car s1-0)) + ) + (while (not (null? s1-0)) + (if (logtest? (-> (the-as editable v1-180) flags) (editable-flag selected)) + (set-selected! s2-10 #t) + ) + (set! s1-0 (cdr s1-0)) + (set! v1-180 (car s1-0)) + ) + ) + ) + (+! s3-16 1) + (set! s2-10 (-> arg0 data s3-16)) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-current-prim)) + (countdown (s4-10 10) + (let* ((s3-17 (-> arg0 length)) + (s2-11 0) + (v1-195 (-> arg0 data s2-11)) + ) + (while (< s2-11 s3-17) + (when (and v1-195 (logtest? (-> v1-195 flags) (editable-flag selected))) + (let* ((s1-1 (-> v1-195 owner)) + (a0-76 (car s1-1)) + ) + (while (not (null? s1-1)) + (set-selected! (the-as editable a0-76) #t) + (set! s1-1 (cdr s1-1)) + (set! a0-76 (car s1-1)) + ) + ) + ) + (+! s2-11 1) + (set! v1-195 (-> arg0 data s2-11)) + ) + ) + (let* ((s3-18 (-> arg0 length)) + (s2-12 0) + (s1-2 (-> arg0 data s2-12)) + ) + (while (< s2-12 s3-18) + (when (and s1-2 (or (and (logtest? (-> s1-2 region filter) (-> arg0 filter 0)) + (logtest? (-> s1-2 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> s1-2 flags) (editable-flag selected)) + ) + ) + (let* ((s0-0 (-> s1-2 owner)) + (v1-216 (car s0-0)) + ) + (while (not (null? s0-0)) + (if (logtest? (-> (the-as editable v1-216) flags) (editable-flag selected)) + (set-selected! s1-2 #t) + ) + (set! s0-0 (cdr s0-0)) + (set! v1-216 (car s0-0)) + ) + ) + ) + (+! s2-12 1) + (set! s1-2 (-> arg0 data s2-12)) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command cancel)) + (editable-array-method-14 arg0 (editable-command none) (editable-command none) (the-as string #f)) + ) + (((editable-command pick-target)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-90 arg0) + (t9-60 (method-of-object a0-90 editable-array-method-10)) + (a1-75 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-75 x) (-> arg2 posx)) + (set! (-> a1-75 y) (-> arg2 posy)) + (set! (-> a1-75 z) 0.0) + (set! (-> a1-75 w) 1.0) + (let ((v1-235 (t9-60 a0-90 a1-75 0))) + (when v1-235 + (set! (-> arg0 target) v1-235) + (handle-cmd arg0 (-> arg0 target-command) arg2 arg3) + ) + ) + ) + (editable-array-method-14 arg0 (editable-command none) (editable-command none) (the-as string #f)) + ) + (((editable-command pick-loc) (editable-command pick-yes-no)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (handle-cmd arg0 (-> arg0 target-command) arg2 arg3) + (editable-array-method-14 arg0 (editable-command none) (editable-command none) (the-as string #f)) + ) + (((editable-command edit-plane-clear)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (set! (-> arg0 edit-plane) #f) + (editable-array-method-17 arg0) + ) + (((editable-command edit-plane-set)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (cond + ((-> arg0 target) + (set! (-> arg0 edit-plane) (the-as editable-plane (as-type (-> arg0 target) editable-plane))) + (editable-array-method-17 arg0) + ) + (else + (editable-array-method-15 + arg0 + (the-as (function editable editable-region symbol) (lambda ((arg0 editable)) (type? arg0 editable-plane))) + (the-as editable-region #f) + ) + (cond + ((>= (-> arg0 selection length) 1) + (set! (-> arg0 edit-plane) (the-as editable-plane (-> arg0 selection 0))) + (editable-array-method-17 arg0) + ) + (else + (editable-array-method-14 + arg0 + (editable-command pick-target) + (editable-command edit-plane-set) + "pick the plane to edit-from" + ) + ) + ) + ) + ) + ) + (((editable-command print-region-info)) + (let ((s5-6 (-> arg0 region))) + (when s5-6 + (format #t "~%~%region-~D~%~%" (-> s5-6 id)) + (let ((a2-39 (-> s5-6 on-enter))) + (if a2-39 + (format #t "(on-enter ~S)~%" a2-39) + ) + ) + (let ((a2-40 (-> s5-6 on-inside))) + (if a2-40 + (format #t "(on-inside ~S)~%" a2-40) + ) + ) + (let ((a2-41 (-> s5-6 on-exit))) + (if a2-41 + (format #t "(on-exit ~S)~%" a2-41) + ) + ) + (format #t "~%~%") + ) + ) + (format #t "~%selected:~%") + (let* ((s5-7 (-> arg0 length)) + (s4-13 0) + (a2-42 (-> arg0 data s4-13)) + ) + (while (< s4-13 s5-7) + (if (and a2-42 (logtest? (-> a2-42 flags) (editable-flag selected))) + (format #t "~A~%" a2-42) + ) + (+! s4-13 1) + (set! a2-42 (-> arg0 data s4-13)) + ) + ) + (format #t "~%~%") + ) + (else + (return #f) + ) + ) + #t + ) + +(defun execute-mouse-move ((arg0 editable-array) (arg1 editable-command) (arg2 mouse-info) (arg3 manipulator)) + (local-vars + (v0-2 object) + (sv-128 (function vector vector float vector)) + (sv-144 vector) + (sv-160 vector) + (sv-176 vector) + (sv-192 vector) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (set! v0-2 (cond + ((= arg1 (editable-command camera-tumble)) + (set-setting! 'mouse-input 'abs #t 0) + (let ((s5-1 (new-stack-vector0)) + (f30-0 0.0) + ) + (let* ((s4-1 (-> arg0 length)) + (s3-0 0) + (a0-2 (-> arg0 data s3-0)) + ) + (while (< s3-0 s4-1) + (when (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (vector+! s5-1 s5-1 (editable-method-15 a0-2)) + (set! f30-0 (+ 1.0 f30-0)) + ) + (+! s3-0 1) + (set! a0-2 (-> arg0 data s3-0)) + ) + ) + (cond + ((= f30-0 0.0) + (remove-setting! 'mouse-tumble-point) + ) + (else + (vector-float/! s5-1 s5-1 f30-0) + (set-setting! 'mouse-tumble-point 'abs s5-1 0) + ) + ) + ) + ) + ((= arg1 (editable-command camera-xy)) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= arg1 (editable-command camera-xz)) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= arg1 (editable-command drag-move)) + (let* ((s4-2 (-> arg0 length)) + (s3-1 0) + (a0-8 (-> arg0 data s3-1)) + ) + (while (< s3-1 s4-2) + (if (and a0-8 (logtest? (-> a0-8 flags) (editable-flag selected))) + (editable-method-17 a0-8 (-> arg3 speed) (editable-flag no-update)) + ) + (+! s3-1 1) + (set! a0-8 (-> arg0 data s3-1)) + ) + ) + (let* ((s5-2 (-> arg0 length)) + (s4-3 0) + (a0-9 (-> arg0 data s4-3)) + ) + (while (< s4-3 s5-2) + (if (and a0-9 (logtest? (-> a0-9 flags) (editable-flag selected))) + (editable-method-30 a0-9 (editable-flag)) + ) + (+! s4-3 1) + (set! a0-9 (-> arg0 data s4-3)) + ) + ) + (cleanup-selection arg0) + ) + ((= arg1 (editable-command snap-rotate)) + (let* ((s4-4 (-> arg0 length)) + (s3-2 0) + (a0-11 (-> arg0 data s3-2)) + ) + (while (< s3-2 s4-4) + (if (and a0-11 (logtest? (-> a0-11 flags) (editable-flag selected))) + (editable-method-35 a0-11 (-> *editable* 0 mouse-normal)) + ) + (+! s3-2 1) + (set! a0-11 (-> arg0 data s3-2)) + ) + ) + (let* ((s4-5 (-> arg0 length)) + (s3-3 0) + (a0-12 (-> arg0 data s3-3)) + ) + (while (< s3-3 s4-5) + (if (and a0-12 (logtest? (-> a0-12 flags) (editable-flag selected))) + (editable-method-30 a0-12 (editable-flag)) + ) + (+! s3-3 1) + (set! a0-12 (-> arg0 data s3-3)) + ) + ) + (cleanup-selection arg0) + (update-manipulator-position arg0 arg3) + ) + ((= arg1 (editable-command drag-rotate)) + (let ((v1-70 0)) + (let* ((a0-15 (-> arg0 length)) + (a1-22 0) + (a3-5 (-> arg0 data a1-22)) + ) + (while (< a1-22 a0-15) + (if (and a3-5 (logtest? (-> a3-5 flags) (editable-flag selected))) + (+! v1-70 1) + ) + (+! a1-22 1) + (set! a3-5 (-> arg0 data a1-22)) + ) + ) + (cond + ((= v1-70 1) + (let* ((s4-6 (-> arg0 length)) + (s3-4 0) + (a0-19 (-> arg0 data s3-4)) + ) + (while (< s3-4 s4-6) + (if (and a0-19 (logtest? (-> a0-19 flags) (editable-flag selected))) + (get-null-vec2 a0-19 (-> arg3 angles)) + ) + (+! s3-4 1) + (set! a0-19 (-> arg0 data s3-4)) + ) + ) + ) + (else + (let* ((s3-5 (-> arg0 length)) + (s2-1 0) + (s1-2 (-> arg0 data s2-1)) + ) + (while (< s2-1 s3-5) + (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (set! sv-176 (new 'stack-no-clear 'vector)) + (set! sv-128 vector-rotate-around-y!) + (set! sv-144 (new 'stack-no-clear 'vector)) + (set! sv-160 (new 'stack-no-clear 'vector)) + (let ((v1-92 (editable-method-15 s1-2)) + (a0-23 (-> arg3 position)) + ) + (.lvf vf4 (&-> v1-92 quad)) + (.lvf vf5 (&-> a0-23 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-160 quad) vf6) + (let* ((a2-16 (* 182.04445 (- (-> arg2 posx) (-> arg2 pos 1 x)))) + (v0-11 (sv-128 sv-144 sv-160 a2-16)) + (v1-95 (-> arg3 position)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> v0-11 quad)) + (.lvf vf5 (&-> v1-95 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + (let* ((v1-98 (editable-method-15 s1-2)) + (s0-1 (vector-! s0-0 sv-176 v1-98)) + ) + (editable-method-17 s1-2 s0-1 (editable-flag no-update)) + ) + ) + ) + (+! s2-1 1) + (set! s1-2 (-> arg0 data s2-1)) + ) + ) + (let* ((s5-3 (-> arg0 length)) + (s4-7 0) + (a0-28 (-> arg0 data s4-7)) + ) + (while (< s4-7 s5-3) + (if (and a0-28 (logtest? (-> a0-28 flags) (editable-flag selected))) + (editable-method-30 a0-28 (editable-flag)) + ) + (+! s4-7 1) + (set! a0-28 (-> arg0 data s4-7)) + ) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + ((= arg1 (editable-command drag-scale)) + (let* ((s3-6 (-> arg0 length)) + (s2-2 0) + (s1-3 (-> arg0 data s2-2)) + ) + (while (< s2-2 s3-6) + (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) + (let ((s0-2 (new 'stack-no-clear 'vector))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((v1-125 (editable-method-15 s1-3)) + (a0-33 (-> arg3 position)) + ) + (.lvf vf4 (&-> v1-125 quad)) + (.lvf vf5 (&-> a0-33 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-192 quad) vf6) + (let* ((f0-5 (* 0.01 (- (-> arg2 posx) (-> arg2 pos 1 x)))) + (s0-3 (vector-float*! s0-2 sv-192 f0-5)) + ) + (case (-> arg3 action) + (((manipulator-action ma1)) + (set! (-> s0-3 y) 0.0) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma2)) + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma3)) + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 y) 0.0) + ) + (((manipulator-action ma4)) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma5)) + (set! (-> s0-3 y) 0.0) + ) + (((manipulator-action ma6)) + (set! (-> s0-3 x) 0.0) + ) + (((manipulator-action ma7)) + ) + (else + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 y) 0.0) + (set! (-> s0-3 z) 0.0) + ) + ) + (editable-method-17 s1-3 s0-3 (editable-flag no-update)) + ) + ) + ) + (+! s2-2 1) + (set! s1-3 (-> arg0 data s2-2)) + ) + ) + (let* ((s5-4 (-> arg0 length)) + (s4-8 0) + (a0-42 (-> arg0 data s4-8)) + ) + (while (< s4-8 s5-4) + (if (and a0-42 (logtest? (-> a0-42 flags) (editable-flag selected))) + (editable-method-30 a0-42 (editable-flag)) + ) + (+! s4-8 1) + (set! a0-42 (-> arg0 data s4-8)) + ) + ) + (cleanup-selection arg0) + ) + (else + (return #f) + v0-2 + ) + ) + ) + #t + ) + ) + +(defun execute-move ((arg0 editable-array) (arg1 editable-command) (arg2 mouse-info) (arg3 manipulator)) + (case arg1 + (((editable-command drag-resize)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 x) (* 0.001 + (vector-vector-distance (-> *math-camera* trans) (-> arg3 position)) + (- (-> arg2 posx) (-> arg2 pos 1 x)) + ) + ) + (set! (-> s3-0 y) 0.0) + (set! (-> s3-0 z) 0.0) + (set! (-> s3-0 w) 1.0) + (let* ((s5-1 (-> arg0 length)) + (s4-1 0) + (a0-3 (-> arg0 data s4-1)) + ) + (while (< s4-1 s5-1) + (if (and a0-3 (logtest? (-> a0-3 flags) (editable-flag selected))) + (editable-method-19 a0-3 s3-0) + ) + (+! s4-1 1) + (set! a0-3 (-> arg0 data s4-1)) + ) + ) + ) + ) + (((editable-command refresh-filter)) + (let* ((s5-2 (-> arg0 length)) + (s4-2 0) + (s3-1 (-> arg0 data s4-2)) + ) + (while (< s4-2 s5-2) + (if (and s3-1 (-> s3-1 region)) + (set! (-> s3-1 region filter) (editable-region-method-12 (-> s3-1 region))) + ) + (+! s4-2 1) + (set! s3-1 (-> arg0 data s4-2)) + ) + ) + ) + (((editable-command resize)) + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 x) 0.0) + (set! (-> s5-3 y) (* 4096.0 (-> arg0 edit-param0))) + (set! (-> s5-3 z) 0.0) + (set! (-> s5-3 w) 1.0) + (let* ((s4-3 (-> arg0 length)) + (s3-2 0) + (a0-8 (-> arg0 data s3-2)) + ) + (while (< s3-2 s4-3) + (if (and a0-8 (logtest? (-> a0-8 flags) (editable-flag selected))) + (editable-method-19 a0-8 s5-3) + ) + (+! s3-2 1) + (set! a0-8 (-> arg0 data s3-2)) + ) + ) + ) + ) + (((editable-command insert-sphere)) + (let ((s3-3 (get-length arg0))) + (when (>= s3-3 0) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-3 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-1 (new 'debug 'editable-sphere a2-3 2048.0 (-> arg0 region))) + ) + (set! (-> arg0 data s3-3) s2-1) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-1 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-point)) + (let ((s3-4 (get-length arg0))) + (when (>= s3-4 0) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-7 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-3 (new 'debug 'editable-point a2-7 (-> arg0 region))) + ) + (set! (-> arg0 data s3-4) s2-3) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-3 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-sample)) + (let ((s3-5 (get-length arg0))) + (when (>= s3-5 0) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-11 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-5 (new 'debug 'editable-sample a2-11 *editable-sample-region*)) + ) + (set! (-> arg0 data s3-5) s2-5) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-5 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-simple-camera)) + (let ((s3-6 (get-length arg0))) + (when (>= s3-6 0) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let ((s2-8 (new 'debug 'editable-sample (math-camera-pos) *editable-sample-region*))) + (set! (-> arg0 data s3-6) s2-8) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-8 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-light)) + (let ((s3-7 (get-length arg0))) + (when (>= s3-7 0) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-18 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-10 (new 'debug 'editable-light a2-18 2048.0 *editable-light-region*)) + ) + (set! (-> arg0 data s3-7) s2-10) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-10 #t) + (editable-method-25 s2-10) + ) + (update-light-hash *light-hash*) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-entity)) + (let ((s3-8 (get-length arg0))) + (when (>= s3-8 0) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-22 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-12 (new 'debug 'editable-entity a2-22 6144.0 *editable-entity-region*)) + ) + (set! (-> arg0 data s3-8) s2-12) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-12 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-box)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((a1-49 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0)))) + (insert-box arg0 a1-49 (the-as vector arg3)) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-wall)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((a1-54 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0)))) + (insert-wall arg0 a1-54 (the-as vector arg3)) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-face)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((s3-12 (get-length arg0))) + 0 + (editable-array-method-15 + arg0 + (lambda ((arg0 editable) (arg1 editable-region)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) + (-> arg0 region) + ) + (let ((s4-5 (-> arg0 selection length))) + (cond + ((= s4-5 1) + (cond + ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) + (set! (-> arg0 selection 1) (-> arg0 target)) + (+! (-> arg0 selection length) 1) + (+! s4-5 1) + ) + (else + (editable-array-method-14 + arg0 + (editable-command pick-target) + (editable-command insert-face) + "pick the point to complete the face" + ) + (return #f) + ) + ) + ) + ((and (>= s4-5 2) (>= 6 s4-5)) + ) + (else + (format + 0 + "ERROR: face can only be inserted if there are 2-6 points selected in the current region, got ~D.~%" + s4-5 + ) + (return #f) + ) + ) + (when (>= s3-12 0) + (let ((s2-15 (new 'debug 'editable-face (-> arg0 region)))) + (set! (-> arg0 data s3-12) s2-15) + (dotimes (s3-13 s4-5) + (set! (-> s2-15 vertex s3-13) (the-as editable-point (-> arg0 selection s3-13))) + (set! (-> arg0 selection s3-13 owner) (cons s2-15 (-> arg0 selection s3-13 owner))) + ) + (set! (-> s2-15 length) s4-5) + (set-selected! s2-15 #t) + (editable-method-30 s2-15 (editable-flag no-plane-snap)) + (editable-method-31 s2-15 (editable-flag no-plane-snap)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-plane)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let ((s2-16 (get-length arg0))) + 0 + (editable-array-method-15 + arg0 + (lambda ((arg0 editable) (arg1 editable-region)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) + (-> arg0 region) + ) + (let ((s4-7 (-> arg0 selection length))) + (cond + ((= s4-7 1) + (cond + ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) + (set! (-> arg0 selection 1) (-> arg0 target)) + (+! (-> arg0 selection length) 1) + (+! s4-7 1) + ) + (else + (editable-array-method-14 + arg0 + (editable-command pick-target) + (editable-command insert-plane) + "pick the point to complete the plane" + ) + (return #f) + ) + ) + ) + ((= s4-7 2) + ) + (else + (format + 0 + "ERROR: plane can only be inserted if there are 2 points selected in the current region, got ~D.~%" + s4-7 + ) + (return #f) + ) + ) + (when (>= s2-16 0) + (let ((s3-15 (new 'debug 'editable-plane (-> arg0 region)))) + (set! (-> arg0 data s2-16) s3-15) + (dotimes (s2-17 s4-7) + (set! (-> s3-15 vertex s2-17) (the-as editable-point (-> arg0 selection s2-17))) + (set! (-> arg0 selection s2-17 owner) (cons s3-15 (-> arg0 selection s2-17 owner))) + ) + (set! (-> s3-15 length) s4-7) + (set-selected! s3-15 #t) + (editable-method-30 s3-15 (editable-flag no-plane-snap)) + (editable-method-31 s3-15 (editable-flag no-plane-snap)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (else + (return #f) + ) + ) + #t + ) + +(defmethod handle-cmd ((this editable-array) (arg0 editable-command) (arg1 mouse-info) (arg2 object)) + (with-pp + (if (execute-select this arg0 arg1 (the-as manipulator arg2)) + (return #f) + ) + (if (execute-move this arg0 arg1 (the-as manipulator arg2)) + (return #f) + ) + (if (execute-mouse-move this arg0 arg1 (the-as manipulator arg2)) + (return #f) + ) + (cond + ((= arg0 (editable-command copy)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (set! (-> this selection length) 0) + (let* ((s3-2 (-> this length)) + (s2-1 0) + (s1-0 (-> this data s2-1)) + ) + (while (< s2-1 s3-2) + (when (and s1-0 (logtest? (-> s1-0 flags) (editable-flag selected))) + (copy-into-editable-array! s1-0 this) + (when (= (-> s1-0 type) editable-light) + (editable-method-25 s1-0) + (update-light-hash *light-hash*) + ) + ) + (+! s2-1 1) + (set! s1-0 (-> this data s2-1)) + ) + ) + (handle-cmd this (editable-command select-none) arg1 arg2) + (let ((s5-1 (the-as editable-region #f))) + (dotimes (s4-1 (-> this selection length)) + (let ((a0-13 (-> this selection s4-1))) + (when (and a0-13 (logtest? s4-1 1)) + (set! s5-1 (-> a0-13 region)) + (set-selected! a0-13 #t) + ) + ) + ) + (if (not (-> this region-lock?)) + (set! (-> this region) s5-1) + ) + ) + ) + ((= arg0 (editable-command copy-region)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (when (and (-> this region) (not (-> this region locked))) + (handle-cmd this (editable-command select-current-region) arg1 arg2) + (let ((v1-52 (copy (-> this region) 'debug))) + (set! (-> v1-52 id) (the-as uint 0)) + (set! (-> v1-52 changed) #t) + (set! (-> this region) v1-52) + ) + (handle-cmd this (editable-command copy) arg1 arg2) + ) + ) + ((= arg0 (editable-command delete)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((s5-3 (-> this length)) + (s4-3 0) + (s3-4 (-> this data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and s3-4 (logtest? (-> s3-4 flags) (editable-flag selected))) + (editable-array-method-16 this s3-4) + (when (= (-> s3-4 type) editable-light) + (editable-method-25 s3-4) + (update-light-hash *light-hash*) + ) + ) + (+! s4-3 1) + (set! s3-4 (-> this data s4-3)) + ) + ) + (if (not (-> this region-lock?)) + (set! (-> this region) #f) + ) + ) + ((= arg0 (editable-command delete-region)) + (when (-> this region) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (when (!= (-> this region) *editable-light-region*) + (handle-cmd this (editable-command select-current-region) arg1 arg2) + (handle-cmd this (editable-command delete) arg1 arg2) + (set! (-> this region) #f) + ) + ) + ) + ((= arg0 (editable-command snap-to-ground)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((s4-5 (new 'stack-no-clear 'vector)) + (s3-7 (-> this length)) + (s2-4 0) + (s1-1 (-> this data s2-4)) + ) + (while (< s2-4 s3-7) + (when (and s1-1 (logtest? (-> s1-1 flags) (editable-flag selected))) + (if (editable-method-11 s1-1 s4-5) + (editable-method-21 s1-1 s4-5) + ) + ) + (+! s2-4 1) + (set! s1-1 (-> this data s2-4)) + ) + ) + (update-manipulator-position this (the-as manipulator arg2)) + ) + ((= arg0 (editable-command snap-y)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (cond + ((-> this target) + (let* ((s4-7 (editable-method-15 (-> this target))) + (s3-9 (-> this length)) + (s2-5 0) + (a0-38 (-> this data s2-5)) + ) + (while (< s2-5 s3-9) + (if (and a0-38 (logtest? (-> a0-38 flags) (editable-flag selected))) + (editable-method-18 a0-38 s4-7 80) + ) + (+! s2-5 1) + (set! a0-38 (-> this data s2-5)) + ) + ) + ) + (else + (editable-array-method-14 + this + (editable-command pick-target) + (editable-command snap-y) + "pick the editable to use the y from" + ) + ) + ) + (update-manipulator-position this (the-as manipulator arg2)) + ) + ((= arg0 (editable-command snap-xz)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (cond + ((-> this target) + (let* ((s4-9 (editable-method-15 (-> this target))) + (s3-11 (-> this length)) + (s2-6 0) + (a0-43 (-> this data s2-6)) + ) + (while (< s2-6 s3-11) + (if (and a0-43 (logtest? (-> a0-43 flags) (editable-flag selected))) + (editable-method-18 a0-43 s4-9 104) + ) + (+! s2-6 1) + (set! a0-43 (-> this data s2-6)) + ) + ) + ) + (else + (editable-array-method-14 + this + (editable-command pick-target) + (editable-command snap-xz) + "pick the editable to use the xz from" + ) + ) + ) + (update-manipulator-position this (the-as manipulator arg2)) + ) + ((= arg0 (editable-command region-set)) + (when (and (-> this region) (not (-> this region locked))) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((s5-5 (-> this length)) + (s4-11 0) + (a0-47 (-> this data s4-11)) + ) + (while (< s4-11 s5-5) + (if (and a0-47 (logtest? (-> a0-47 flags) (editable-flag selected))) + (change-region! a0-47 (-> this region)) + ) + (+! s4-11 1) + (set! a0-47 (-> this data s4-11)) + ) + ) + ) + ) + ((= arg0 (editable-command region-add)) + (when (and (-> this region) (not (-> this region locked))) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (if (-> this target) + (change-region! (-> this target) (-> this region)) + (editable-array-method-14 + this + (editable-command pick-target) + (editable-command region-add) + "pick the editable to add to current region" + ) + ) + ) + ) + ((= arg0 (editable-command region-new)) + (let ((v1-178 (new 'debug 'editable-region))) + (if (and (-> this region) (not (-> this region locked))) + (set! (-> v1-178 tree) (-> this region tree)) + ) + (set! (-> this region) v1-178) + ) + (handle-cmd this (editable-command region-set) arg1 arg2) + ) + ((= arg0 (editable-command flip-side)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((s5-8 (-> this length)) + (s4-14 0) + (a0-61 (-> this data s4-14)) + ) + (while (< s4-14 s5-8) + (if (and a0-61 (logtest? (-> a0-61 flags) (editable-flag selected))) + (editable-method-26 a0-61) + ) + (+! s4-14 1) + (set! a0-61 (-> this data s4-14)) + ) + ) + ) + ((= arg0 (editable-command rotate-level)) + (let* ((f0-1 (* 182.04445 (-> this edit-param0))) + (s5-9 (matrix-rotate-y! (new 'stack-no-clear 'matrix) f0-1)) + (s4-15 (-> this length)) + (s3-12 0) + (a0-63 (-> this data s3-12)) + ) + (while (< s3-12 s4-15) + (if (and a0-63 region (= (-> a0-63 region level) (-> this level))) + (editable-method-20 a0-63 (-> this level-offset) s5-9) + ) + (+! s3-12 1) + (set! a0-63 (-> this data s3-12)) + ) + ) + ) + ((= arg0 (editable-command translate-y-level)) + (let ((s5-10 (new 'stack-no-clear 'vector))) + (set! (-> s5-10 x) 0.0) + (set! (-> s5-10 y) (* 4096.0 (-> this edit-param0))) + (set! (-> s5-10 z) 0.0) + (set! (-> s5-10 w) 1.0) + (let* ((s4-16 (-> this length)) + (s3-13 0) + (a0-64 (-> this data s3-13)) + ) + (while (< s3-13 s4-16) + (if (and a0-64 region (= (-> a0-64 region level) (-> this level))) + (editable-method-17 a0-64 s5-10 (editable-flag x y z)) + ) + (+! s3-13 1) + (set! a0-64 (-> this data s3-13)) + ) + ) + ) + ) + ((= arg0 (editable-command save)) + (let* ((s5-11 (-> this length)) + (s4-17 0) + (v1-234 (-> this data s4-17)) + ) + (while (< s4-17 s5-11) + (if (and v1-234 (-> v1-234 region)) + (save-region! (-> v1-234 region) this 0 0) + ) + (+! s4-17 1) + (set! v1-234 (-> this data s4-17)) + ) + ) + (save-region! *editable-sample-region* this 0 0) + (save-region! *editable-light-region* this 0 0) + (save-region! *editable-entity-region* this 0 0) + ) + ((= arg0 (editable-command load)) + (handle-cmd this (editable-command select-none) arg1 arg2) + (dotimes (v1-251 (-> this length)) + (set! (-> this data v1-251) #f) + ) + (set! (-> this length) 0) + (let* ((s5-12 this) + (s4-18 (method-of-object s5-12 editable-array-method-13)) + (v1-256 (level-get-target-inside *level*)) + ) + (s4-18 s5-12 (if v1-256 + (-> v1-256 info dbname) + #f + ) + ) + ) + (handle-cmd this (editable-command update-game) (the-as mouse-info #f) #f) + ) + ((= arg0 (editable-command update-game)) + (reset-light-hash *light-hash*) + (let* ((s5-13 (-> this length)) + (s4-19 0) + (a0-79 (-> this data s4-19)) + ) + (while (< s4-19 s5-13) + (if a0-79 + (editable-method-25 a0-79) + ) + (+! s4-19 1) + (set! a0-79 (-> this data s4-19)) + ) + ) + (update-light-hash *light-hash*) + ) + ((or (= arg0 (editable-command exit)) (= arg0 (editable-command kill))) + (deactivate pp) + ) + ) + #f + ) + ) + +(defmethod deactivate ((this editable-player)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + ;; og:preserve-this put the pad back to normal + (pc-treat-pad0-as-pad1 #f) + (dotimes (v1-0 (-> *level* length)) + (let ((a1-3 (-> *level* level v1-0))) + (if (= (-> a1-3 status) 'active) + (set! (-> a1-3 light-hash) (-> a1-3 bsp light-hash)) + ) + ) + ) + (set! *editable* (the-as (pointer editable-player) #f)) + (set! *external-cam-mode* (-> this external-cam-mode)) + ((method-of-type process-drawable deactivate) this) + (none) + ) + +;; WARN: Return type mismatch process-drawable vs editable-player. +(defmethod relocate ((this editable-player) (offset int)) + (let ((v1-0 *kernel-context*)) + (set! (-> v1-0 relocating-process) this) + (set! (-> v1-0 relocating-min) (the-as int (&-> this type))) + (set! (-> v1-0 relocating-max) + (the-as int (+ (+ (-> this allocated-length) -4 (-> process size)) (the-as int this))) + ) + (set! (-> v1-0 relocating-offset) offset) + ) + (let ((v1-2 (-> this current))) + (if (and (>= (the-as int v1-2) (-> *kernel-context* relocating-min)) + (< (the-as int v1-2) (-> *kernel-context* relocating-max)) + ) + (&+! (-> this current) offset) + ) + ) + (the-as editable-player ((method-of-type process-drawable relocate) this offset)) + ) + +(defmethod editable-player-method-21 ((this editable-player)) + (set! *display-region-marks* #f) + (let* ((s5-0 (-> this current length)) + (s4-0 0) + (a0-2 (-> this current data s4-0)) + ) + (while (< s4-0 s5-0) + (if (and a0-2 (or (and (logtest? (-> a0-2 region filter) (-> this current filter 0)) + (logtest? (-> a0-2 region filter) (-> this current filter 1)) + ) + (logtest? (-> a0-2 flags) (editable-flag selected)) + ) + ) + (editable-method-10 a0-2) + ) + (+! s4-0 1) + (set! a0-2 (-> this current data s4-0)) + ) + ) + (let ((s4-1 (new-stack-vector0)) + (s5-1 0) + ) + (let* ((s3-0 (-> this current length)) + (s2-0 0) + (a0-5 (-> this current data s2-0)) + ) + (while (< s2-0 s3-0) + (when (and a0-5 (logtest? (-> a0-5 flags) (editable-flag selected))) + (vector+! s4-1 s4-1 (editable-method-15 a0-5)) + (+! s5-1 1) + ) + (+! s2-0 1) + (set! a0-5 (-> this current data s2-0)) + ) + ) + (if (nonzero? s5-1) + (manipulator-method-11 (-> this manipulator)) + ) + ) + (when #t + (format *stdcon* "~0K") + (format *stdcon* "~16S~16S~16S~%" "Left button" "Middle button" "Right button") + (format + *stdcon* + "~16S~16S~16S~%" + (editable-command->string + (if (and (nonzero? (-> this command 1)) (or (= (-> this command 0) (editable-command none)) (mouse-hold? left))) + (-> this command 1) + (-> this command 0) + ) + ) + (editable-command->string + (if (and (nonzero? (-> this command 5)) (or (= (-> this command 4) (editable-command none)) (mouse-hold? middle))) + (-> this command 5) + (-> this command 4) + ) + ) + (editable-command->string + (if (and (nonzero? (-> this command 3)) (or (= (-> this command 2) (editable-command none)) (mouse-hold? right))) + (-> this command 3) + (-> this command 2) + ) + ) + ) + (let* ((s5-3 (-> this current length)) + (s4-3 0) + (v1-52 (-> this current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and v1-52 (logtest? (-> v1-52 flags) (editable-flag selected))) + (let ((s3-2 (-> v1-52 name))) + (if (not (string-prefix= "undefined" s3-2)) + (format *stdcon* "~s~%" s3-2) + ) + ) + ) + (+! s4-3 1) + (set! v1-52 (-> this current data s4-3)) + ) + ) + (when (!= *master-mode* 'menu) + (let ((a2-5 (-> this current target-message))) + (if a2-5 + (format *stdcon* "~%~3L~S~0L~%" a2-5) + ) + ) + (when (cpad-hold? 1 triangle) + (let* ((s5-4 (-> this current length)) + (s4-4 0) + (a0-33 (-> this current data s4-4)) + ) + (while (< s4-4 s5-4) + (when (and a0-33 (or (and (logtest? (-> a0-33 region filter) (-> this current filter 0)) + (logtest? (-> a0-33 region filter) (-> this current filter 1)) + ) + (logtest? (-> a0-33 flags) (editable-flag selected)) + ) + ) + (if (and (-> a0-33 region) (!= (-> a0-33 type) editable-point)) + (print-region-info (-> a0-33 region) (editable-method-15 a0-33) (if (cpad-hold? 1 circle) + 1 + 0 + ) + ) + ) + ) + (+! s4-4 1) + (set! a0-33 (-> this current data s4-4)) + ) + ) + (format *stdcon* "~%") + (cond + ((-> this current region) + (let ((s5-5 (-> this current region))) + (format + *stdcon* + "~%region: region-~D ~S ~S~S~%" + (-> s5-5 id) + (-> s5-5 level) + (-> s5-5 tree) + (if (-> s5-5 changed) + " (modified)" + "" + ) + ) + (format *stdcon* " (on-enter ~S)~%" (-> s5-5 on-enter)) + (format *stdcon* " (on-inside ~S)~%" (-> s5-5 on-inside)) + (format *stdcon* " (on-exit ~S)~%" (-> s5-5 on-exit)) + ) + ) + (else + (format *stdcon* "no region~%") + ) + ) + (when (-> this current edit-plane) + (let ((a2-13 (-> this current edit-plane))) + (format *stdcon* "~%edit-plane: ~A~%" a2-13) + ) + ) + (format *stdcon* "~%selected:~%") + (let* ((s5-6 (-> this current length)) + (s4-5 0) + (a2-14 (-> this current data s4-5)) + ) + (while (< s4-5 s5-6) + (if (and a2-14 (logtest? (-> a2-14 flags) (editable-flag selected))) + (format *stdcon* " ~A~%" a2-14) + ) + (+! s4-5 1) + (set! a2-14 (-> this current data s4-5)) + ) + ) + ) + ) + (format *stdcon* "~1K~%") + ) + 0 + (none) + ) + +(defmethod editable-player-method-22 ((this editable-player)) + (cond + ((or (logtest? (-> *keybd* keys 0) 4) (logtest? (-> *keybd* keys 0) 64)) + (set-setting! 'mouse-input 'abs #t 0) + (set! (-> this command 0) (editable-command camera-rotate)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command camera-zoom)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command camera-move)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 left) (not (-> this left-handed))) (and (cpad-hold? 1 square) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command copy-region)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command delete-region)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command region-add)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 right) (not (-> this left-handed))) (and (cpad-hold? 1 circle) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command update-game)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command delete)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command copy)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 up) (not (-> this left-handed))) (and (cpad-hold? 1 triangle) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command select-none)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command print-region-info)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command flip-side)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 down) (not (-> this left-handed))) (and (cpad-hold? 1 x) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command insert-sample)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command insert-simple-camera)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command insert-entity)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (set! (-> this command 0) (editable-command none)) + (set! (-> this command 1) (editable-command camera-tumble)) + (set! (-> this command 2) (editable-command none)) + (set! (-> this command 3) (editable-command camera-xz)) + (set! (-> this command 4) (editable-command none)) + (set! (-> this command 5) (editable-command camera-xy)) + ) + ((or (or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16)) + (and (cpad-hold? 1 up) + (cpad-hold? 1 left) + (or (and (cpad-hold? 1 up) (not (-> this left-handed))) (and (cpad-hold? 1 triangle) (-> this left-handed))) + ) + ) + (set! (-> this command 0) (editable-command select-region)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command select-prim)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command select-face)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((logtest? (-> *keybd* keys 0) 8) + (set! (-> this command 0) (editable-command none)) + (set! (-> this command 1) (editable-command drag-rotate)) + (set! (-> this command 2) (editable-command none)) + (set! (-> this command 3) (editable-command snap-rotate)) + (set! (-> this command 4) (editable-command none)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((or (and (cpad-hold? 1 left) (not (-> this left-handed))) (and (cpad-hold? 1 square) (-> this left-handed))) + (set! (-> this command 0) (editable-command none)) + (set! (-> this command 1) (editable-command drag-move)) + (set! (-> this command 2) (editable-command none)) + (set! (-> this command 3) (editable-command drag-move)) + (set! (-> this command 4) (editable-command none)) + (set! (-> this command 5) (editable-command drag-move)) + ) + ((or (and (cpad-hold? 1 right) (not (-> this left-handed))) (and (cpad-hold? 1 circle) (-> this left-handed))) + (set! (-> this command 0) (editable-command insert-light)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command insert-sphere)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command insert-point)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((or (or (logtest? (-> *keybd* keys 0) 2) (logtest? (-> *keybd* keys 0) 32)) + (or (and (cpad-hold? 1 up) (not (-> this left-handed))) (and (cpad-hold? 1 triangle) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command select-add)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command select-remove)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command select-toggle)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((or (and (cpad-hold? 1 down) (not (-> this left-handed))) (and (cpad-hold? 1 x) (-> this left-handed))) + (set! (-> this command 0) (editable-command insert-face)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command insert-box)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command insert-plane)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + (else + (set! (-> this command 0) (editable-command none)) + (set! (-> this command 1) (editable-command drag-move)) + (set! (-> this command 2) (editable-command none)) + (set! (-> this command 3) (editable-command drag-resize)) + (set! (-> this command 4) (editable-command none)) + (set! (-> this command 5) (editable-command drag-scale)) + ) + ) + 0 + (none) + ) + +(defun get-light-value ((arg0 uint)) + (let ((f30-0 0.0)) + (let* ((s5-0 (-> *editable* 0 current length)) + (s4-0 0) + (s3-0 (-> *editable* 0 current data s4-0)) + ) + (while (< s4-0 s5-0) + (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) + (let ((v1-8 (as-type s3-0 editable-light))) + (if (the-as editable-light v1-8) + (set! f30-0 (-> (&+ (the-as (pointer float) v1-8) arg0) 0)) + ) + ) + ) + (+! s4-0 1) + (set! s3-0 (-> *editable* 0 current data s4-0)) + ) + ) + f30-0 + ) + ) + +;; WARN: Return type mismatch symbol vs object. +(defun set-light-value ((arg0 int) (arg1 float)) + (let* ((s4-0 (-> *editable* 0 current length)) + (s3-0 0) + (s2-0 (-> *editable* 0 current data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (let ((a0-7 (as-type s2-0 editable-light))) + (when (the-as editable-light a0-7) + (set! (-> (&+ (the-as (pointer float) a0-7) arg0) 0) arg1) + (logior! (-> (the-as editable-light a0-7) flags) (editable-flag changed)) + (let ((v1-12 (-> (the-as editable-light a0-7) region))) + (if v1-12 + (set! (-> v1-12 changed) #t) + ) + ) + (update-light-sphere-from-editable-light (the-as editable-light a0-7)) + ) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> *editable* 0 current data s3-0)) + ) + ) + #f + ) + +(defmethod editable-player-method-23 ((this editable-player)) + (let ((s5-0 (-> this current)) + (s4-0 (new + 'stack + 'font-context + *font-default-matrix* + 20 + 379 + 0.0 + (font-color menu-selected-parent) + (font-flags shadow kerning) + ) + ) + ) + (set! (-> s4-0 flags) (font-flags)) + (set-width! s4-0 340) + (set-height! s4-0 80) + (set-scale! s4-0 1.0) + (cond + ((or (= (-> this current-command) (editable-command select-add)) + (= (-> this current-command) (editable-command select-remove)) + (= (-> this current-command) (editable-command select-toggle)) + ) + (set-vector! + (-> this mouse-box 1) + (the-as float (the int (-> *mouse* posx))) + (the-as float (the int (-> *mouse* posy))) + 0.0 + (the-as float #x1) + ) + (let ((v1-11 3) + (a0-12 (abs (- (the-as int (-> this mouse-box 1 x)) (the-as uint (the-as int (-> this mouse-box 0 x)))))) + ) + (when (and (< v1-11 a0-12) + (let ((v1-13 3) + (a0-15 (abs (- (the-as int (-> this mouse-box 1 y)) (the-as uint (the-as int (-> this mouse-box 0 y)))))) + ) + (< v1-13 a0-15) + ) + ) + (let ((s4-1 (new 'static 'vector4w)) + (s3-0 (new 'static 'inline-array vector4w 4 + (new 'static 'vector4w) + (new 'static 'vector4w) + (new 'static 'vector4w) + (new 'static 'vector4w) + ) + ) + ) + (set-vector! (-> s3-0 0) (the-as int (-> this mouse-box 0 x)) (the-as int (-> this mouse-box 0 y)) 0 1) + (set-vector! (-> s3-0 1) (the-as int (-> this mouse-box 1 x)) (the-as int (-> this mouse-box 0 y)) 0 1) + (set-vector! (-> s3-0 2) (the-as int (-> this mouse-box 1 x)) (the-as int (-> this mouse-box 1 y)) 0 1) + (set-vector! (-> s3-0 3) (the-as int (-> this mouse-box 0 x)) (the-as int (-> this mouse-box 1 y)) 0 1) + (set-vector! s4-1 128 128 128 128) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> s3-0 0) (-> s3-0 1) s4-1) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> s3-0 1) (-> s3-0 2) s4-1) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> s3-0 2) (-> s3-0 3) s4-1) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> s3-0 3) (-> s3-0 0) s4-1) + ) + ) + ) + (let ((a1-7 (new 'stack-no-clear 'vector))) + (set! (-> a1-7 x) (the float (min (the-as int (-> this mouse-box 0 x)) (the-as int (-> this mouse-box 1 x))))) + (set! (-> a1-7 y) (the float (min (the-as int (-> this mouse-box 0 y)) (the-as int (-> this mouse-box 1 y))))) + (set! (-> a1-7 z) 0.0) + (set! (-> a1-7 w) 1.0) + (let ((a2-5 (new 'stack-no-clear 'vector))) + (set! (-> a2-5 x) (the float (max (the-as int (-> this mouse-box 0 x)) (the-as int (-> this mouse-box 1 x))))) + (set! (-> a2-5 y) (the float (max (the-as int (-> this mouse-box 0 y)) (the-as int (-> this mouse-box 1 y))))) + (set! (-> a2-5 z) 0.0) + (set! (-> a2-5 w) 1.0) + (cond + ((and (not (mouse-hold? left)) (= (-> this current-command) (editable-command select-add))) + (if (and (< 3.0 (- (-> a2-5 x) (-> a1-7 x))) (< 3.0 (- (-> a2-5 y) (-> a1-7 y)))) + (editable-array-method-11 s5-0 a1-7 a2-5 0) + (handle-cmd s5-0 (editable-command select-add) *mouse* (-> this manipulator)) + ) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ((and (not (mouse-hold? right)) (= (-> this current-command) (editable-command select-remove))) + (if (and (< 3.0 (- (-> a2-5 x) (-> a1-7 x))) (< 3.0 (- (-> a2-5 y) (-> a1-7 y)))) + (editable-array-method-11 s5-0 a1-7 a2-5 2) + (handle-cmd s5-0 (editable-command select-remove) *mouse* (-> this manipulator)) + ) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ((and (not (mouse-hold? middle)) (= (-> this current-command) (editable-command select-toggle))) + (if (and (< 3.0 (- (-> a2-5 x) (-> a1-7 x))) (< 3.0 (- (-> a2-5 y) (-> a1-7 y)))) + (editable-array-method-11 s5-0 a1-7 a2-5 1) + (handle-cmd s5-0 (editable-command select-toggle) *mouse* (-> this manipulator)) + ) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ) + ) + ) + ) + ((= (-> this current-command) (editable-command drag-move)) + (manipulator-method-13 (-> this manipulator) (-> this mouse-pos) (-> this mouse-end)) + (when (not (mouse-hold? left)) + (manipulator-method-14 (-> this manipulator)) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ) + ((= (-> this current-command) (editable-command drag-scale)) + (manipulator-method-13 (-> this manipulator) (-> this mouse-pos) (-> this mouse-end)) + (when (not (mouse-hold? middle)) + (manipulator-method-14 (-> this manipulator)) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ) + ((= (-> this current-command) (editable-command drag-rotate)) + (manipulator-method-13 (-> this manipulator) (-> this mouse-pos) (-> this mouse-end)) + (when (not (mouse-hold? left)) + (manipulator-method-14 (-> this manipulator)) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ) + ((= (-> this current-command) (editable-command drag-resize)) + ) + ((= (-> this current-command) (editable-command select-user1)) + (when (!= (-> *keybd* keys 58) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-1 print-game-text)) + (format (clear *temp-string*) "Red:~F" (-> this float-variable)) + (s5-1 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user2)) + (when (!= (-> *keybd* keys 59) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-2 print-game-text)) + (format (clear *temp-string*) "Green:~F" (-> this float-variable)) + (s5-2 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user3)) + (when (!= (-> *keybd* keys 60) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-3 print-game-text)) + (format (clear *temp-string*) "Blue:~F" (-> this float-variable)) + (s5-3 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user4)) + (when (!= (-> *keybd* keys 61) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-4 print-game-text)) + (format (clear *temp-string*) "Palette Index:~F" (-> this float-variable)) + (s5-4 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user5)) + (when (!= (-> *keybd* keys 62) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-5 print-game-text)) + (format (clear *temp-string*) "Decay Start:~F" (-> this float-variable)) + (s5-5 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user6)) + (when (!= (-> *keybd* keys 63) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-6 print-game-text)) + (format (clear *temp-string*) "Ambient Point Ratio:~F" (-> this float-variable)) + (s5-6 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user7)) + (when (!= (-> *keybd* keys 64) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-7 print-game-text)) + (format (clear *temp-string*) "Brightness:~F" (-> this float-variable)) + (s5-7 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user8)) + (when (!= (-> *keybd* keys 65) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-8 print-game-text)) + (format (clear *temp-string*) "Shadow-Ambi:~F" (-> this float-variable)) + (s5-8 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user9)) + (when (!= (-> *keybd* keys 66) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-9 print-game-text)) + (format (clear *temp-string*) "Shadow-Dir0:~F" (-> this float-variable)) + (s5-9 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user10)) + (when (!= (-> *keybd* keys 67) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-10 print-game-text)) + (format (clear *temp-string*) "Shadow-Dir1:~F" (-> this float-variable)) + (s5-10 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user11)) + (when (!= (-> *keybd* keys 68) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-11 print-game-text)) + (format (clear *temp-string*) "Shadow-Dir2:~F" (-> this float-variable)) + (s5-11 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user12)) + (when (!= (-> *keybd* keys 69) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-12 print-game-text)) + (format (clear *temp-string*) "Shadow-Dir3:~F" (-> this float-variable)) + (s5-12 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + (else + (return #f) + ) + ) + ) + #t + ) + +;; WARN: Return type mismatch time-of-day-palette-id vs object. +(defun keybd-set-time-of-day! ((arg0 int) (arg1 time-of-day-palette-id)) + (cond + ((= arg1 (time-of-day-palette-id unk3)) + (send-event + (ppointer->process *time-of-day*) + 'dest-clock-ratio-set + (the-as float (if *time-of-day-fast* + 60.0 + 1.0 + ) + ) + (seconds 2) + ) + ) + (else + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0) + (send-event (ppointer->process *time-of-day*) 'change 'hour arg0) + ) + ) + (send-event (ppointer->process *time-of-day*) 'change 'minutes 0) + (send-event (ppointer->process *time-of-day*) 'change 'seconds 0) + (send-event (ppointer->process *time-of-day*) 'change 'frames 0) + (set! *teleport-count* 1) + (set! (-> *time-of-day-context* mode) arg1) + arg1 + ) + +(defstate idle (editable-player) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-0 object)) + (case message + (('execute) + (let ((a2-1 (-> block param 0))) + (case a2-1 + ((32 31 39 33 35 36) + (editable-array-method-14 + (-> self current) + (editable-command pick-loc) + (the-as editable-command a2-1) + "click on the point to insert at (up target, down camera)" + ) + ) + ((57 1 53 41 61 62) + (if (not (-> self left-handed)) + (editable-array-method-14 + (-> self current) + (editable-command pick-yes-no) + (the-as editable-command a2-1) + "press x to confirm, square to cancel" + ) + (editable-array-method-14 + (-> self current) + (editable-command pick-yes-no) + (the-as editable-command a2-1) + "press down to confirm, left to cancel" + ) + ) + ) + (else + (handle-cmd (-> self current) (the-as editable-command a2-1) *mouse* (-> self manipulator)) + ) + ) + ) + ) + (('exit) + (deactivate self) + ) + (('menu) + (set! v0-0 (+ (current-time) (the-as time-frame (-> block param 0)))) + (set! (-> self close-menu-time) (the-as time-frame v0-0)) + v0-0 + ) + (('select-by-name) + (let ((gp-1 (-> block param 0))) + (handle-cmd (-> self current) (editable-command select-none) *mouse* #f) + (let* ((s5-1 (-> self current length)) + (s4-0 0) + (s3-0 (-> self current data s4-0)) + ) + (while (< s4-0 s5-1) + (when (and s3-0 (or (and (logtest? (-> s3-0 region filter) (-> self current filter 0)) + (logtest? (-> s3-0 region filter) (-> self current filter 1)) + ) + (logtest? (-> s3-0 flags) (editable-flag selected)) + ) + ) + (if (string= (the-as string (-> s3-0 prefix)) (the-as string gp-1)) + (set-selected! s3-0 #t) + ) + ) + (+! s4-0 1) + (set! s3-0 (-> self current data s4-0)) + ) + ) + ) + (update-manipulator-position (-> self current) (-> self manipulator)) + ) + (('on-enter 'on-exit 'on-inside) + (let ((s4-1 (-> self current region))) + (when s4-1 + (let ((gp-2 (-> block param 0))) + (set! (-> *syntax-context* got-error?) #f) + (eval! *syntax-context* (the-as pair gp-2)) + (when (not (-> *syntax-context* got-error?)) + (set! (-> s4-1 changed) #t) + (cond + ((= message 'on-enter) + (set! (-> s4-1 on-enter) (the-as pair gp-2)) + ) + ((= message 'on-inside) + (set! (-> s4-1 on-inside) (the-as pair gp-2)) + ) + ((= message 'on-exit) + (set! (-> s4-1 on-exit) (the-as pair gp-2)) + ) + ) + ) + ) + (set! v0-0 (editable-region-method-12 s4-1)) + (set! (-> s4-1 filter) (the-as editable-filter v0-0)) + v0-0 + ) + ) + ) + (('select) + (let ((gp-3 (-> block param 0))) + (handle-cmd (-> self current) (editable-command select-none) (the-as mouse-info #f) (-> self manipulator)) + (let* ((s5-2 (-> self current length)) + (s4-2 0) + (a0-51 (-> self current data s4-2)) + ) + (while (< s4-2 s5-2) + (when (and a0-51 (or (and (logtest? (-> a0-51 region filter) (-> self current filter 0)) + (logtest? (-> a0-51 region filter) (-> self current filter 1)) + ) + (logtest? (-> a0-51 flags) (editable-flag selected)) + ) + ) + (when (and (-> a0-51 region) (= gp-3 (-> a0-51 region id))) + (set! (-> self current region) (-> a0-51 region)) + (set-selected! a0-51 #t) + ) + ) + (+! s4-2 1) + (set! a0-51 (-> self current data s4-2)) + ) + ) + ) + #f + ) + (('set-pos) + (let* ((s5-3 (-> self current length)) + (s4-3 0) + (s3-1 (-> self current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) + (let ((v1-81 (as-type s3-1 editable-entity))) + (when v1-81 + (vector-copy! (-> v1-81 trans) (the-as vector (-> block param 0))) + (logior! (-> v1-81 flags) (editable-flag changed)) + (let ((v1-82 (-> v1-81 region))) + (if v1-82 + (set! (-> v1-82 changed) #t) + ) + ) + ) + ) + ) + (+! s4-3 1) + (set! s3-1 (-> self current data s4-3)) + ) + ) + #f + ) + (('name) + (let* ((s5-4 (-> self current length)) + (s4-4 0) + (s3-2 (-> self current data s4-4)) + ) + (while (< s4-4 s5-4) + (when (and s3-2 (logtest? (-> s3-2 flags) (editable-flag selected))) + (let ((s2-0 (as-type s3-2 editable-entity))) + (when s2-0 + (copy-string<-string (-> s2-0 name) (the-as string (-> block param 0))) + (logior! (-> s2-0 flags) (editable-flag changed)) + (let ((a0-73 (-> s2-0 region))) + (if a0-73 + (set! (-> a0-73 changed) #t) + ) + ) + ) + ) + ) + (+! s4-4 1) + (set! s3-2 (-> self current data s4-4)) + ) + ) + #f + ) + (('level) + (let ((gp-4 (lookup-level-info (the-as symbol (-> block param 0))))) + (when (-> gp-4 dbname) + (let* ((s5-5 (-> self current length)) + (s4-5 0) + (s3-3 (-> self current data s4-5)) + ) + (while (< s4-5 s5-5) + (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) + (let ((v1-109 (as-type s3-3 editable))) + (when (and v1-109 (-> v1-109 region)) + (set! (-> v1-109 region level) (the-as string (-> gp-4 dbname))) + (set! (-> v1-109 region changed) #t) + (logior! (-> v1-109 flags) (editable-flag changed)) + ) + ) + ) + (+! s4-5 1) + (set! s3-3 (-> self current data s4-5)) + ) + ) + #f + ) + ) + ) + (('get-level) + (-> self current level) + ) + (('direction) + (let* ((f30-0 (the-as float (-> block param 0))) + (f28-0 (the-as float (-> block param 1))) + (f26-0 (the-as float (-> block param 2))) + (f24-0 (if (and (zero? (-> block param 0)) (zero? (-> block param 1)) (zero? (-> block param 2))) + 0.0 + 1.0 + ) + ) + (gp-5 (-> self current length)) + (s5-6 0) + (s3-4 (-> self current data s5-6)) + ) + (while (< s5-6 gp-5) + (when (and s3-4 (logtest? (-> s3-4 flags) (editable-flag selected))) + (let ((s4-6 (as-type s3-4 editable-light))) + (when (and s4-6 (!= (-> (the-as editable-light s4-6) color w) -2.0)) + (set-vector! (-> (the-as editable-light s4-6) direction) f30-0 f28-0 f26-0 f24-0) + (vector-normalize! (-> (the-as editable-light s4-6) direction) 1.0) + (logior! (-> (the-as editable-light s4-6) flags) (editable-flag changed)) + (let ((a0-99 (-> (the-as editable-light s4-6) region))) + (if a0-99 + (set! (-> a0-99 changed) #t) + ) + ) + ) + ) + ) + (+! s5-6 1) + (set! s3-4 (-> self current data s5-6)) + ) + ) + #f + ) + (('angles) + (let* ((f30-1 (the-as float (-> block param 0))) + (f28-1 (the-as float (-> block param 1))) + (f26-1 (the-as float (-> block param 2))) + (gp-6 (-> self current length)) + (s5-7 0) + (s3-5 (-> self current data s5-7)) + ) + (while (< s5-7 gp-6) + (when (and s3-5 (logtest? (-> s3-5 flags) (editable-flag selected))) + (let ((s4-7 (as-type s3-5 editable-entity))) + (when s4-7 + (set-eul! (-> s4-7 angles) (* 182.04445 f30-1) (* 182.04445 f28-1) (* 182.04445 f26-1) 21) + (logior! (-> s4-7 flags) (editable-flag changed)) + (let ((v1-156 (-> s4-7 region))) + (if v1-156 + (set! (-> v1-156 changed) #t) + ) + ) + (editable-entity-method-36 s4-7) + ) + ) + ) + (+! s5-7 1) + (set! s3-5 (-> self current data s5-7)) + ) + ) + (update-manipulator-position (-> self current) (-> self manipulator)) + ) + (('color) + (let* ((f30-2 (the-as float (-> block param 0))) + (f28-2 (the-as float (-> block param 1))) + (f26-2 (the-as float (-> block param 2))) + (f24-1 (the-as float (-> block param 3))) + (gp-7 (-> self current length)) + (s5-8 0) + (s4-8 (-> self current data s5-8)) + ) + (while (< s5-8 gp-7) + (when (and s4-8 (logtest? (-> s4-8 flags) (editable-flag selected))) + (let ((v1-174 (as-type s4-8 editable-light))) + (when v1-174 + (set-vector! (-> v1-174 color) f30-2 f28-2 f26-2 f24-1) + (logior! (-> v1-174 flags) (editable-flag changed)) + (let ((v1-175 (-> v1-174 region))) + (if v1-175 + (set! (-> v1-175 changed) #t) + ) + ) + ) + ) + ) + (+! s5-8 1) + (set! s4-8 (-> self current data s5-8)) + ) + ) + #f + ) + (('param) + (let ((s5-9 (-> block param 0)) + (f30-3 (the-as float (-> block param 1))) + ) + (when (and (>= (the-as int s5-9) 0) (>= 2 (the-as int s5-9))) + (let* ((gp-8 (-> self current length)) + (s4-9 0) + (s3-6 (-> self current data s4-9)) + ) + (while (< s4-9 gp-8) + (when (and s3-6 (logtest? (-> s3-6 flags) (editable-flag selected))) + (let ((v1-189 (as-type s3-6 editable-light))) + (when (the-as editable-light v1-189) + (set! (-> (the-as editable-light (+ (* s5-9 4) (the-as uint v1-189))) decay-start) f30-3) + (logior! (-> (the-as editable-light v1-189) flags) (editable-flag changed)) + (let ((v1-190 (-> (the-as editable-light v1-189) region))) + (if v1-190 + (set! (-> v1-190 changed) #t) + ) + ) + ) + ) + ) + (+! s4-9 1) + (set! s3-6 (-> self current data s4-9)) + ) + ) + #f + ) + ) + ) + ) + ) + :trans (behavior () + (let ((gp-0 (-> self current))) + (set! (-> gp-0 move-lock?) #f) + (when (cpad-pressed? 1 start) + (when (!= *master-mode* 'menu) + (set-master-mode 'menu) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons start)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons start)) + ) + ) + (when (or (and (= *master-mode* 'menu) (> (-> self close-menu-time) 0) (>= (current-time) (-> self close-menu-time))) + (cpad-pressed? 1 start) + ) + (debug-menu-context-send-msg *editable-menu-context* (debug-menu-msg deactivate) (debug-menu-dest activation)) + (set-master-mode *last-master-mode*) + (set! (-> self close-menu-time) 0) + 0 + ) + (debug-menus-handler *editable-menu-context*) + (set-setting! 'cpad1-skip-buttons 'abs #t 0) + (set-setting! 'mouse-input 'abs #f 0) + (when (!= *master-mode* 'menu) + (if (= (-> self current-command) (editable-command none)) + (editable-player-method-22 self) + ) + (case (-> self current target-mode) + (((editable-command pick-target) (editable-command pick-loc)) + (set! (-> self command 0) (-> self current target-mode)) + ) + (((editable-command pick-yes-no)) + (when (!= *master-mode* 'menu) + (cond + ((not (-> self left-handed)) + (cond + ((cpad-hold? 1 x) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons x)) + (handle-cmd gp-0 (-> self current target-mode) *mouse* (-> self manipulator)) + ) + ((cpad-pressed? 1 square) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons square)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons square)) + (handle-cmd gp-0 (editable-command cancel) *mouse* (-> self manipulator)) + ) + ) + ) + (else + (cond + ((cpad-hold? 1 down) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons down)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons down)) + (handle-cmd gp-0 (-> self current target-mode) *mouse* (-> self manipulator)) + ) + ((cpad-pressed? 1 left) + (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons left)) + (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons left)) + (handle-cmd gp-0 (editable-command cancel) *mouse* (-> self manipulator)) + ) + ) + ) + ) + ) + ) + ) + (when (mouse-hold? left) + (+! (-> self float-variable) (* (- (-> *mouse* posx) (-> *mouse* pos 1 x)) (-> self float-step))) + (set! (-> self float-variable) (fmax (fmin (-> self float-variable) (-> self float-max)) (-> self float-min))) + ) + (cond + ((= (-> *keybd* keys 12) 2) + (handle-cmd gp-0 (editable-command print-region-info) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 11) 2) + (set! (-> *editable-work* hide) (not (-> *editable-work* hide))) + ) + ((= (-> *keybd* keys 43) 2) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-copy! s5-0 (-> self manipulator position)) + (set! (-> s5-0 w) 4096.0) + (let* ((s4-0 (-> self current length)) + (s3-0 0) + (s2-0 (-> self current data s3-0)) + ) + (while (< s3-0 s4-0) + (if (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (set! (-> s5-0 w) + (fmax + (-> s5-0 w) + (* 1.1 (+ (editable-method-16 s2-0) (vector-vector-distance s5-0 (editable-method-15 s2-0)))) + ) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> self current data s3-0)) + ) + ) + (send-event *camera* 'point-of-interest s5-0) + ) + ) + ((and (= (-> *keybd* keys 22) 2) (or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16))) + (handle-cmd gp-0 (editable-command save) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 41) 2) + (handle-cmd gp-0 (editable-command select-none) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 9) 2) + (handle-cmd gp-0 (editable-command insert-face) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 5) 2) + (handle-cmd gp-0 (editable-command insert-box) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 26) 2) + (handle-cmd gp-0 (editable-command insert-wall) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 15) 2) + (handle-cmd gp-0 (editable-command insert-light) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 19) 2) + (handle-cmd gp-0 (editable-command insert-point) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 22) 2) + (handle-cmd gp-0 (editable-command insert-sphere) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 8) 2) + (handle-cmd gp-0 (editable-command insert-entity) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 24) 2) + (handle-cmd gp-0 (editable-command update-game) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 30) 2) + (keybd-set-time-of-day! 7 (time-of-day-palette-id)) + ) + ((= (-> *keybd* keys 31) 2) + (keybd-set-time-of-day! 10 (time-of-day-palette-id unk0)) + ) + ((= (-> *keybd* keys 32) 2) + (keybd-set-time-of-day! 12 (time-of-day-palette-id unk1)) + ) + ((= (-> *keybd* keys 33) 2) + (keybd-set-time-of-day! 14 (time-of-day-palette-id unk0 unk1)) + ) + ((= (-> *keybd* keys 34) 2) + (keybd-set-time-of-day! 18 (time-of-day-palette-id unk2)) + ) + ((= (-> *keybd* keys 35) 2) + (keybd-set-time-of-day! 19 (time-of-day-palette-id unk0 unk2)) + ) + ((= (-> *keybd* keys 36) 2) + (keybd-set-time-of-day! 23 (time-of-day-palette-id unk1 unk2)) + ) + ((= (-> *keybd* keys 37) 2) + (keybd-set-time-of-day! 4 (time-of-day-palette-id unk0 unk1 unk2)) + ) + ((= (-> *keybd* keys 38) 2) + (keybd-set-time-of-day! 0 (time-of-day-palette-id unk3)) + ) + ((= (-> *keybd* keys 39) 2) + (case *subdivide-draw-mode* + (((subdivide-setting textured)) + (set! *subdivide-draw-mode* (subdivide-setting outline)) + (set! *subdivide-scissor-draw-mode* (subdivide-setting outline)) + (set! *subdivide-foreground-draw-mode* (subdivide-setting outline)) + (set! *subdivide-ocean-draw-mode* (subdivide-setting outline)) + ) + (((subdivide-setting outline)) + (set! *subdivide-draw-mode* (subdivide-setting gouraud)) + (set! *subdivide-scissor-draw-mode* (subdivide-setting gouraud)) + (set! *subdivide-foreground-draw-mode* (subdivide-setting gouraud)) + (set! *subdivide-ocean-draw-mode* (subdivide-setting gouraud)) + ) + (((subdivide-setting gouraud)) + ;; og:preserve-this + (set! *subdivide-draw-mode* (the subdivide-setting 0)) + (set! *subdivide-scissor-draw-mode* (the subdivide-setting 0)) + (set! *subdivide-foreground-draw-mode* (the subdivide-setting 0)) + (set! *subdivide-ocean-draw-mode* (the subdivide-setting 0)) + 0 + ) + (((subdivide-setting hack)) + ;; og:preserve-this + (set! *subdivide-draw-mode* (the subdivide-setting 0)) + (set! *subdivide-scissor-draw-mode* (the subdivide-setting 0)) + (set! *subdivide-foreground-draw-mode* (the subdivide-setting 0)) + (set! *subdivide-ocean-draw-mode* (the subdivide-setting 0)) + 0 + ) + ) + ) + ((and (= (-> *keybd* keys 76) 2) (or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16))) + (handle-cmd gp-0 (editable-command delete) *mouse* (-> self manipulator)) + ) + ((= (-> *keybd* keys 44) 2) + (handle-cmd gp-0 (editable-command snap-to-ground) *mouse* (-> self manipulator)) + ) + ) + (vector-copy! (-> self mouse-pos) (-> *math-camera* trans)) + (let ((a1-33 (new 'stack-no-clear 'vector)) + (a2-20 (new 'stack-no-clear 'vector)) + (a3-19 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-19 x) (-> *mouse* posx)) + (set! (-> a3-19 y) (-> *mouse* posy)) + (set! (-> a3-19 z) 0.0) + (set! (-> a3-19 w) 1.0) + (vector-copy! a2-20 (-> *math-camera* inv-camera-rot fvec)) + (vector+*! a1-33 (-> self mouse-pos) (-> *math-camera* inv-camera-rot fvec) 16384000.0) + (reverse-transform-point! (-> self mouse-end) a1-33 a2-20 a3-19) + ) + (let ((s5-1 (new 'stack 'collide-query))) + (vector-copy! (-> s5-1 start-pos) (-> self mouse-pos)) + (vector-! (-> s5-1 move-dist) (-> self mouse-end) (-> self mouse-pos)) + (let ((v1-236 s5-1)) + (set! (-> v1-236 radius) 409.6) + (set! (-> v1-236 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-236 ignore-process0) #f) + (set! (-> v1-236 ignore-process1) #f) + (set! (-> v1-236 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-236 action-mask) (collide-action solid)) + ) + (let ((f0-16 (fill-and-probe-using-line-sphere *collide-cache* s5-1))) + (cond + ((>= f0-16 0.0) + (vector+*! (-> self mouse-hit) (-> s5-1 start-pos) (-> s5-1 move-dist) f0-16) + (vector-copy! (-> self mouse-normal) (-> s5-1 best-other-tri normal)) + ) + (else + (vector-copy! (-> self mouse-hit) (-> self mouse-end)) + (vector-copy! (-> self mouse-normal) *y-vector*) + ) + ) + ) + ) + (cond + ((editable-player-method-23 self) + ) + ((= (-> *keybd* keys 58) 1) + (set! (-> self current-command) (editable-command select-user1)) + (set! (-> self float-id) (the-as uint 60)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.00390625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.9921875) + ) + ((= (-> *keybd* keys 59) 1) + (set! (-> self current-command) (editable-command select-user2)) + (set! (-> self float-id) (the-as uint 64)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.00390625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.9921875) + ) + ((= (-> *keybd* keys 60) 1) + (set! (-> self current-command) (editable-command select-user3)) + (set! (-> self float-id) (the-as uint 68)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.00390625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.9921875) + ) + ((= (-> *keybd* keys 61) 1) + (set! (-> self current-command) (editable-command select-user4)) + (set! (-> self float-id) (the-as uint 72)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 1.0) + (set! (-> self float-min) -2.0) + (set! (-> self float-max) 7.0) + ) + ((= (-> *keybd* keys 62) 1) + (set! (-> self current-command) (editable-command select-user5)) + (set! (-> self float-id) (the-as uint 76)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.00390625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.0) + ) + ((= (-> *keybd* keys 63) 1) + (set! (-> self current-command) (editable-command select-user6)) + (set! (-> self float-id) (the-as uint 80)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.00390625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.0) + ) + ((= (-> *keybd* keys 64) 1) + (set! (-> self current-command) (editable-command select-user7)) + (set! (-> self float-id) (the-as uint 84)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.00390625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.0) + ) + ((= (-> *keybd* keys 65) 1) + (set! (-> self current-command) (editable-command select-user8)) + (set! (-> self float-id) (the-as uint 88)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.0625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.0) + ) + ((= (-> *keybd* keys 66) 1) + (set! (-> self current-command) (editable-command select-user9)) + (set! (-> self float-id) (the-as uint 92)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.0625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.0) + ) + ((= (-> *keybd* keys 67) 1) + (set! (-> self current-command) (editable-command select-user10)) + (set! (-> self float-id) (the-as uint 96)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.0625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.0) + ) + ((= (-> *keybd* keys 68) 1) + (set! (-> self current-command) (editable-command select-user11)) + (set! (-> self float-id) (the-as uint 100)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.0625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.0) + ) + ((= (-> *keybd* keys 69) 1) + (set! (-> self current-command) (editable-command select-user12)) + (set! (-> self float-id) (the-as uint 104)) + (set! (-> self float-variable) (get-light-value (-> self float-id))) + (set! (-> self float-step) 0.0625) + (set! (-> self float-min) 0.0) + (set! (-> self float-max) 1.0) + ) + ((or (logtest? (-> *keybd* keys 0) 2) (logtest? (-> *keybd* keys 0) 32)) + (when (and (mouse-pressed? left) (= (-> self command 0) (editable-command select-add))) + (set-vector! + (-> self mouse-box 0) + (the-as float (the int (-> *mouse* posx))) + (the-as float (the int (-> *mouse* posy))) + 0.0 + (the-as float #x1) + ) + (set! (-> self current-command) (editable-command select-add)) + ) + (when (and (mouse-pressed? middle) (= (-> self command 4) (editable-command select-toggle))) + (set-vector! + (-> self mouse-box 0) + (the-as float (the int (-> *mouse* posx))) + (the-as float (the int (-> *mouse* posy))) + 0.0 + (the-as float #x1) + ) + (set! (-> self current-command) (editable-command select-toggle)) + ) + (when (and (mouse-pressed? right) (= (-> self command 2) (editable-command select-remove))) + (set-vector! + (-> self mouse-box 0) + (the-as float (the int (-> *mouse* posx))) + (the-as float (the int (-> *mouse* posy))) + 0.0 + (the-as float #x1) + ) + (set! (-> self current-command) (editable-command select-remove)) + ) + ) + ((or (logtest? (-> *keybd* keys 0) 4) (logtest? (-> *keybd* keys 0) 64)) + ) + ((or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16)) + ) + (else + (let ((v1-360 0)) + (let* ((a0-254 (-> self current length)) + (a1-40 0) + (a3-21 (-> self current data a1-40)) + ) + (while (< a1-40 a0-254) + (if (and a3-21 (logtest? (-> a3-21 flags) (editable-flag selected))) + (+! v1-360 1) + ) + (+! a1-40 1) + (set! a3-21 (-> self current data a1-40)) + ) + ) + (cond + ((nonzero? v1-360) + (manipulator-method-10 (-> self manipulator) (-> self mouse-pos) (-> self mouse-end)) + ) + (else + (set! (-> self manipulator action) (manipulator-action ma0)) + 0 + ) + ) + ) + (when (nonzero? (-> self manipulator action)) + (cond + ((and (mouse-pressed? middle) (= (-> self command 5) (editable-command drag-scale))) + (if (= (-> *keybd* keys 6) 1) + (handle-cmd gp-0 (editable-command copy) *mouse* (-> self manipulator)) + ) + (set-mode (-> self manipulator) (manipulator-mode mm2)) + (manipulator-method-12 (-> self manipulator) (-> self mouse-end)) + (set! (-> self current-command) (editable-command drag-scale)) + ) + ((and (mouse-pressed? left) (= (-> self command 1) (editable-command drag-move))) + (if (= (-> *keybd* keys 6) 1) + (handle-cmd gp-0 (editable-command copy) *mouse* (-> self manipulator)) + ) + (set-mode (-> self manipulator) (manipulator-mode mm0)) + (manipulator-method-12 (-> self manipulator) (-> self mouse-end)) + (set! (-> self current-command) (editable-command drag-move)) + ) + ((and (mouse-pressed? left) (= (-> self command 1) (editable-command drag-rotate))) + (if (= (-> *keybd* keys 6) 1) + (handle-cmd gp-0 (editable-command copy) *mouse* (-> self manipulator)) + ) + (set-mode (-> self manipulator) (manipulator-mode mm1)) + (manipulator-method-12 (-> self manipulator) (-> self mouse-end)) + (set! (-> self current-command) (editable-command drag-rotate)) + ) + ) + ) + ) + ) + (when (not (or (= (-> self current-command) (editable-command select-add)) + (= (-> self current-command) (editable-command select-remove)) + (= (-> self current-command) (editable-command select-toggle)) + ) + ) + (if (mouse-pressed? left) + (handle-cmd gp-0 (-> self command 0) *mouse* (-> self manipulator)) + ) + (if (mouse-hold? left) + (handle-cmd gp-0 (-> self command 1) *mouse* (-> self manipulator)) + ) + (if (mouse-pressed? right) + (handle-cmd gp-0 (-> self command 2) *mouse* (-> self manipulator)) + ) + (if (mouse-hold? right) + (handle-cmd gp-0 (-> self command 3) *mouse* (-> self manipulator)) + ) + (when (mouse-pressed? middle) + (let ((a2-37 (-> self command 4))) + (case a2-37 + (((editable-command delete)) + (if (not (-> self left-handed)) + (editable-array-method-14 gp-0 (editable-command pick-yes-no) a2-37 "press x to confirm, square to cancel") + (editable-array-method-14 gp-0 (editable-command pick-yes-no) a2-37 "press down to confirm, left to cancel") + ) + ) + (else + (handle-cmd gp-0 a2-37 *mouse* (-> self manipulator)) + ) + ) + ) + ) + (if (mouse-hold? middle) + (handle-cmd gp-0 (-> self command 5) *mouse* (-> self manipulator)) + ) + ) + ) + ) + ) + :code (behavior () + (until #f + (suspend) + ) + #f + ) + :post (behavior () + (editable-player-method-21 self) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior editable-player-init editable-player ((arg0 symbol)) + (set! *editable-temp-id* 0) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + (set! *display-actor-marks* #f) + (set! (-> *editable-work* hide) #f) + (logclear! (-> self mask) (process-mask freeze pause menu)) + (+! (-> self clock ref-count) -1) + (+! (-> *display* real-clock ref-count) 1) + (set! (-> self clock) (-> *display* real-clock)) + (set! (-> self current) (new 'debug 'editable-array 4096)) + (add-setting! 'mouse #t 0.0 0) + (add-setting! 'cursor #t 0.0 0) + (add-setting! 'keybd #t 0.0 0) + (set! (-> self current-command) (editable-command none)) + (set! (-> self select-command) (the-as (function object) 8)) + (set! (-> self drag-command) (the-as uint 20)) + (set! (-> self extra-command) (the-as (function object) 24)) + (set! (-> self left-handed) #f) + (set! (-> self light-names) #f) + (set! (-> self command 0) (the-as editable-command (-> self select-command))) + (set! (-> self command 1) (editable-command none)) + (set! (-> self command 2) (editable-command none)) + (set! (-> self command 3) (the-as editable-command (-> self extra-command))) + (set! (-> self command 4) (editable-command none)) + (set! (-> self command 5) (the-as editable-command (-> self drag-command))) + (let* ((s5-0 (-> self current)) + (s4-0 (method-of-object s5-0 editable-array-method-13)) + (s3-0 (if arg0 + (lookup-level-info arg0) + ) + ) + (gp-1 (level-get-target-inside *level*)) + (a1-6 (cond + (s3-0 + (let ((gp-2 (level-get *level* (-> s3-0 dbname)))) + (when gp-2 + (format 0 "setting level~d ~s to *light-hash*~%" (-> gp-2 index) (-> gp-2 name)) + (set! (-> gp-2 light-hash) *light-hash*) + ) + ) + (-> s3-0 dbname) + ) + (gp-1 + (let ((s3-1 (level-get *level* (-> gp-1 info dbname)))) + (when s3-1 + (format 0 "setting level~d ~s to *light-hash*~%" (-> s3-1 index) (-> s3-1 name)) + (set! (-> s3-1 light-hash) *light-hash*) + ) + ) + (-> gp-1 info dbname) + ) + ) + ) + ) + (s4-0 s5-0 a1-6) + ) + (set! *editable* (the-as (pointer editable-player) (process->ppointer self))) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (set! (-> self external-cam-mode) *external-cam-mode*) + (set! *external-cam-mode* 'pad-1) + (matrix-identity! (-> self manipulator mat)) + (handle-cmd (-> self current) (editable-command update-game) (the-as mouse-info #f) (-> self manipulator)) + ;; og:preserve-this automatically swap controller to pad1 + (pc-treat-pad0-as-pad1 #t) + (go-virtual idle) + (none) + ) + +;; WARN: Return type mismatch string vs object. +(defun set-editable-name ((arg0 string)) + (copy-string<-string *editable-default-name* arg0) + ) + +(defun select-editable-by-name ((arg0 string)) + (send-event (ppointer->process *editable*) 'select-by-name arg0) + ) + +(define *editable-menu-context* (new 'debug 'debug-menu-context)) + +(set! (-> *editable-menu-context* joypad-number) 1) + +(defun editable-menu-command ((arg0 int)) + (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) + (send-event (ppointer->process *editable*) 'menu 90) + ) + +(defun editable-menu-command-no-close ((arg0 int)) + (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) + ) + +;; WARN: Return type mismatch object vs symbol. +(defun dm-region-tree-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (when (and *editable* (-> *editable* 0 current region)) + (let ((s5-0 (-> *editable* 0 current region))) + (set! (-> s5-0 tree) arg0) + (set! (-> s5-0 changed) #t) + (set! (-> s5-0 filter) (editable-region-method-12 s5-0)) + ) + ) + ) + (the-as + symbol + (and *editable* (-> *editable* 0 current region) (= arg0 (-> *editable* 0 current region tree))) + ) + ) + +(defun dm-editable-flag-pick-func ((arg0 editable-flag) (arg1 debug-menu-msg)) + (when *editable* + (let ((gp-0 (/ (the-as int arg0) 8))) + (editable-array-method-15 + (-> *editable* 0 current) + (the-as (function editable editable-region symbol) true-func) + (the-as editable-region #f) + ) + (when (= arg1 (debug-menu-msg press)) + (let* ((v1-10 (-> *editable* 0 current length)) + (a0-2 0) + (a1-4 (-> *editable* 0 current data a0-2)) + ) + (while (< a0-2 v1-10) + (if (and a1-4 (logtest? (-> a1-4 flags) (editable-flag selected))) + (logxor! (-> a1-4 flags) (the-as uint gp-0)) + ) + (+! a0-2 1) + (set! a1-4 (-> *editable* 0 current data a0-2)) + ) + ) + ) + (and (>= (-> *editable* 0 current selection length) 1) + (logtest? (-> *editable* 0 current selection 0 flags) gp-0) + ) + ) + ) + ) + +(defun dm-editable-filter0-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) + (when *editable* + (let ((v1-1 (/ (the-as int arg0) 8))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *editable* 0 current filter 0) (the-as uint v1-1)) + ) + (logtest? (-> *editable* 0 current filter 0) v1-1) + ) + ) + ) + +(defun dm-editable-filter1-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) + (when *editable* + (let ((v1-1 (/ (the-as int arg0) 8))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *editable* 0 current filter 1) (the-as uint v1-1)) + ) + (logtest? (-> *editable* 0 current filter 1) v1-1) + ) + ) + ) + +(defun dm-editable-light-float-func ((arg0 int) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (cond + ((not *editable*) + arg3 + ) + ((= arg1 (debug-menu-msg press)) + (let* ((s4-0 (-> *editable* 0 current length)) + (s3-0 0) + (s2-0 (-> *editable* 0 current data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (let ((a0-7 (as-type s2-0 editable-light))) + (when (the-as editable-light a0-7) + (set! (-> (&+ (the-as (pointer float) a0-7) (/ arg0 8)) 0) arg2) + (logior! (-> (the-as editable-light a0-7) flags) (editable-flag changed)) + (when (= (-> (the-as editable-light a0-7) color w) -2.0) + (let ((a1-2 0) + (v1-17 0) + ) + (dotimes (a2-1 5) + (let ((f0-2 (-> (the-as editable-light a0-7) shadows a2-1))) + (when (!= f0-2 1.0) + (set! a1-2 (logior a1-2 (ash 1 a2-1))) + (set! v1-17 (logior v1-17 (ash (logand (the int (* 16.0 f0-2)) 15) (* a2-1 4)))) + ) + ) + ) + (set! (-> (the-as editable-light a0-7) direction x) + (the-as + float + (logior (logand (the-as uint (-> (the-as editable-light a0-7) direction x)) (the-as uint #xffffffff00ffffff)) + (shr (shl a1-2 56) 32) + ) + ) + ) + (set! (-> (the-as editable-light a0-7) direction x) + (the-as + float + (logior (logand (the-as int (-> (the-as editable-light a0-7) direction x)) -16777216) (shr (shl v1-17 40) 40)) + ) + ) + ) + ) + (let ((v1-21 (-> (the-as editable-light a0-7) region))) + (if v1-21 + (set! (-> v1-21 changed) #t) + ) + ) + (update-light-sphere-from-editable-light (the-as editable-light a0-7)) + ) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> *editable* 0 current data s3-0)) + ) + ) + (the-as float #f) + ) + (else + (let ((f30-0 arg3)) + (let* ((s5-1 (-> *editable* 0 current length)) + (s4-1 0) + (s3-1 (-> *editable* 0 current data s4-1)) + ) + (while (< s4-1 s5-1) + (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) + (let ((v1-35 (as-type s3-1 editable-light))) + (if (the-as editable-light v1-35) + (set! f30-0 (-> (&+ (the-as (pointer float) v1-35) (/ arg0 8)) 0)) + ) + ) + ) + (+! s4-1 1) + (set! s3-1 (-> *editable* 0 current data s4-1)) + ) + ) + f30-0 + ) + ) + ) + ) + +(defun dm-cam-externalize2 ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (cond + ((= arg0 'reset) + (if (!= *external-cam-mode* 'locked) + (external-cam-reset!) + ) + ) + ((= arg0 'allow-z) + (set! *external-cam-options* (logxor *external-cam-options* (external-cam-option allow-z))) + ) + ((= *external-cam-mode* arg0) + (set! *external-cam-mode* #f) + ) + (else + (if (not *external-cam-mode*) + (external-cam-reset!) + ) + (set! *external-cam-mode* arg0) + ) + ) + ) + (if (= arg0 'allow-z) + (logtest? *external-cam-options* (external-cam-option allow-z)) + (= *external-cam-mode* arg0) + ) + ) + +;; WARN: Return type mismatch float vs symbol. +(defun dm-editable-boolean-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (the-as symbol (cond + (*editable* + (let ((v1-3 (&+ (the-as (pointer float) (-> *editable* 0)) (/ arg0 8)))) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-3 0) (the-as float (not (-> v1-3 0)))) + ) + (-> v1-3 0) + ) + ) + (else + (the-as float #f) + ) + ) + ) + ) + +(defun editable-menu-context-make-menus ((arg0 debug-menu-context)) + (debug-menu-make-from-template + arg0 + '(main-menu + "Editable" + (flag "Cam 1" pad-1 dm-cam-externalize2) + (flag "Left Handed" 216 dm-editable-boolean-toggle-pick-func) + (menu + "Insert" + (function "Sphere" 31 editable-menu-command) + (function "Point" 32 editable-menu-command) + (function "Sample" 33 editable-menu-command) + (function "Light" 35 editable-menu-command) + (function "Entity" 36 editable-menu-command) + (function "Face" 37 editable-menu-command) + (function "Plane" 38 editable-menu-command) + (function "Box" 39 editable-menu-command) + (function "Wall" 40 editable-menu-command) + (function "Edit-Plane Set" 51 editable-menu-command) + (function "Edit-Plane Clear" 52 editable-menu-command) + ) + (menu + "Select" + (function "None" 8 editable-menu-command) + (function "All" 7 editable-menu-command) + (function "Owner" 12 editable-menu-command) + (function "Current Region" 13 editable-menu-command) + (function "Current Face" 14 editable-menu-command) + (function "Current Prim" 15 editable-menu-command) + ) + (menu + "Selection" + (function "Copy" 42 editable-menu-command) + (function "Delete" 41 editable-menu-command) + (function "Flip Side" 48 editable-menu-command) + (function "Snap to Ground" 44 editable-menu-command) + (function "Snap XZ" 45 editable-menu-command) + (function "Snap Y" 46 editable-menu-command) + (function "Resize to Param" 43 editable-menu-command) + (function "Set to current Region" 49 editable-menu-command) + (function "Set to new Region" 50 editable-menu-command) + (flag "No Save" 2 dm-editable-flag-pick-func) + (flag "Top Set" 512 dm-editable-flag-pick-func) + (flag "Bot Set" 1024 dm-editable-flag-pick-func) + ) + (menu + "Region" + (function "Print Info" 59 editable-menu-command) + (function "Copy" 54 editable-menu-command) + (function "Delete" 53 editable-menu-command) + (function "Add to current Region" 55 editable-menu-command) + (flag + "Region Lock" + #f + ,(lambda ((arg0 object) (arg1 int)) + (if (= arg1 4) + (set! (-> *editable* 0 current region-lock?) (not (-> *editable* 0 current region-lock?))) + ) + (-> *editable* 0 current region-lock?) + ) + ) + (flag "Camera" camera dm-region-tree-pick-func) + (flag "Target" target dm-region-tree-pick-func) + (flag "Water" water dm-region-tree-pick-func) + (flag "Data" data dm-region-tree-pick-func) + (flag "City Vis" city_vis dm-region-tree-pick-func) + ) + (menu + "Filter" + (flag "None" 1 dm-editable-filter0-pick-func) + (flag "Unknown" 2 dm-editable-filter0-pick-func) + (flag "Sound" 4 dm-editable-filter0-pick-func) + (flag "Part" 8 dm-editable-filter0-pick-func) + (flag "Load" 64 dm-editable-filter0-pick-func) + (flag "User Setting" 16 dm-editable-filter0-pick-func) + (flag "Cam Setting" 32 dm-editable-filter0-pick-func) + (flag "Camera" 256 dm-editable-filter1-pick-func) + (flag "Target" 512 dm-editable-filter1-pick-func) + (flag "Water" 1024 dm-editable-filter1-pick-func) + (flag "Data" 2048 dm-editable-filter1-pick-func) + (flag "Sample" 8192 dm-editable-filter1-pick-func) + (flag "Light" 16384 dm-editable-filter1-pick-func) + (flag "Entity" 32768 dm-editable-filter1-pick-func) + (flag "City Vis" 4096 dm-editable-filter1-pick-func) + ) + (menu + "Light" + (flag "Show Light Names" 220 dm-editable-boolean-toggle-pick-func) + (float-var + "Red" + 60 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Green" + 64 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Blue" + 68 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Palette Index" + 72 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 1.0) + #t + (new 'static 'bfloat :data -2.0) + (new 'static 'bfloat :data 7.0) + 0 + ) + (float-var "Decay Start" 76 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.00390625) #t 0 1 0) + (float-var + "Ambient Point Ratio" + 80 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 1 + 0 + ) + (float-var "Brightness" 84 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.00390625) #t 0 1 0) + (float-var "Shadow Ambi" 88 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + (float-var "Shadow Dir0" 92 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + (float-var "Shadow Dir1" 96 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + (float-var "Shadow Dir2" 100 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + (float-var "Shadow Dir3" 104 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + ) + (float-var + "Param" + #f + ,(lambda ((arg0 object) (arg1 int) (arg2 float)) (cond + ((= arg1 4) + (if (and *editable* (nonzero? *editable*)) + (set! (-> *editable* 0 current edit-param0) arg2) + ) + ) + ((or (not *editable*) (zero? *editable*)) + 0 + ) + (else + (-> *editable* 0 current edit-param0) + ) + ) + ) + 3 + (new 'static 'bfloat :data 0.5) + #t + 0 + 500 + 1 + ) + (function "Rotate Level" 61 editable-menu-command) + (function "Trans Y Level" 62 editable-menu-command) + (function "Revert" 57 editable-menu-command) + (function "Save" 56 editable-menu-command-no-close) + (function "Update Game" 58 editable-menu-command-no-close) + (function "Cancel" 19 editable-menu-command) + (function "Exit" 1 editable-menu-command) + ) + ) + arg0 + ) + +(editable-menu-context-make-menus *editable-menu-context*) + +;; WARN: Return type mismatch int vs object. +(defun insert-sample-camera ((arg0 symbol)) + (cond + (level + (let ((s5-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" + arg0 + ) + (let ((s5-1 (s5-0 *temp-string*))) + (cond + ((and (= (-> s5-1 content-type) 'select) (= (-> s5-1 length) 4)) + (let ((f26-0 (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 0))))) + (f28-0 (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 1))))) + (f30-3 (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 2))))) + (s5-2 (string->int (the-as string (-> s5-1 sql-data 3)))) + (s3-0 (math-camera-pos)) + (s4-1 (clear *temp-string*)) + ) + (format + s4-1 + "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" + s5-2 + (* 0.00024414062 (- (-> s3-0 x) f26-0)) + (* 0.00024414062 (- (-> s3-0 y) f28-0)) + (* 0.00024414062 (- (-> s3-0 z) f30-3)) + ) + (let ((a2-2 (sql-query s4-1))) + (cond + ((= (-> a2-2 content-type) 'modify) + (format + (clear s4-1) + "update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D" + s5-2 + ) + (let ((a2-4 (sql-query s4-1))) + (when (!= (-> a2-4 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A~%" a2-4) + (return (the-as object #f)) + ) + ) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (format #t "EDITABLE: saved camera sample point for level ~A~%" arg0) + ) + (else + (format 0 "ERROR: sql: insert error ~A~%" a2-2) + ) + ) + ) + ) + ) + (else + (format 0 "ERROR: sql: select error ~A~%" s5-1) + ) + ) + ) + ) + ) + (else + (format 0 "ERROR: EDITABLE: no current level~%") + ) + ) + 0 + ) + +(define *debug-hook* + (cons + (lambda () (when (and *debug-segment* *manual-sample-point*) + (when (cpad-pressed? 1 select) + (cond + (*editable* + #f + ) + ((not *artist-fix-visible*) + (insert-sample-camera (-> (level-get-target-inside *level*) info dbname)) + ) + (else + (let ((gp-1 0)) + (dotimes (s5-0 (-> *level* length)) + (let ((v1-14 (-> *level* level s5-0))) + (when (= (-> v1-14 status) 'active) + (when (!= (-> v1-14 bsp visible-list-length) 4) + (if (not (logtest? *fix-visible-level-mask* (ash 1 gp-1))) + (insert-sample-camera (-> v1-14 name)) + ) + (+! gp-1 1) + ) + ) + ) + ) + ) + #f + ) + ) + ) + ) + ) + *debug-hook* + ) + ) diff --git a/goal_src/jak3/engine/debug/editable.gc b/goal_src/jak3/engine/debug/editable.gc index af60efe6b8..4549a43b5e 100644 --- a/goal_src/jak3/engine/debug/editable.gc +++ b/goal_src/jak3/engine/debug/editable.gc @@ -7,3 +7,3242 @@ ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) + +;; WARN: Return type mismatch symbol vs object. +(defun common-owner ((arg0 editable) (arg1 editable)) + (let* ((v1-0 (the-as object (-> arg0 owner))) + (a0-1 (-> (the-as pair v1-0) car)) + ) + (while (not (null? v1-0)) + (let* ((a2-0 (the-as object (-> arg1 owner))) + (a3-0 (-> (the-as pair a2-0) car)) + ) + (while (not (null? a2-0)) + (if (= a0-1 a3-0) + (return (the-as object #t)) + ) + (set! a2-0 (-> (the-as pair a2-0) cdr)) + (set! a3-0 (-> (the-as pair a2-0) car)) + ) + ) + (set! v1-0 (-> (the-as pair v1-0) cdr)) + (set! a0-1 (-> (the-as pair v1-0) car)) + ) + ) + #f + ) + +(defmethod new editable-region ((allocation symbol) (type-to-make type)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 changed) #t) + (set! (-> gp-0 locked) #f) + (let ((v1-12 (cond + ((and *editable* (-> *editable* 0 current level)) + (-> *editable* 0 current level) + ) + ((level-get-target-inside *level*) + (-> (level-get-target-inside *level*) info dbname) + ) + ) + ) + ) + (set! (-> gp-0 level) (the-as string v1-12)) + ) + (set! (-> gp-0 tree) 'camera) + (set! (-> gp-0 on-enter) #f) + (set! (-> gp-0 on-exit) #f) + (set! (-> gp-0 on-inside) #f) + (set! (-> gp-0 filter) (editable-region-method-12 gp-0)) + gp-0 + ) + ) + +(defmethod print ((this editable-region)) + (format #t "#<~A region-~D ~A ~A @ #x~X>" (-> this type) (-> this id) (-> this level) (-> this tree) this) + this + ) + +(defmethod editable-region-method-10 ((this editable-region) (arg0 int)) + (local-vars (sv-16 string) (sv-32 string)) + (when (nonzero? (-> this id)) + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "delete from region_sphere where region_id=~D" (-> this id)) + (let ((a2-1 (sql-query s5-0))) + (when (!= (-> a2-1 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 this) + (return #t) + ) + ) + (clear s5-0) + (format s5-0 "select region_face_id from region_face where region_id=~D" (-> this id)) + (let ((s3-0 (sql-query s5-0))) + (when (!= (-> s3-0 content-type) 'select) + (format 0 "ERROR: sql: face select error ~A for ~A~%" s3-0 this) + (return #t) + ) + (when (> (-> s3-0 length) 0) + (clear s5-0) + (format s5-0 "delete from region_point where region_face_id in (") + (dotimes (s2-0 (-> s3-0 length)) + (cond + ((zero? s2-0) + (let ((s1-0 format) + (s0-0 s5-0) + ) + (set! sv-16 "~D") + (let ((a2-4 (string->int (the-as string (-> s3-0 sql-data s2-0))))) + (s1-0 s0-0 sv-16 a2-4) + ) + ) + ) + (else + (let ((s1-1 format) + (s0-1 s5-0) + ) + (set! sv-32 ",~D") + (let ((a2-5 (string->int (the-as string (-> s3-0 sql-data s2-0))))) + (s1-1 s0-1 sv-32 a2-5) + ) + ) + ) + ) + ) + (format s5-0 ")") + (let ((a2-6 (sql-query s5-0))) + (when (!= (-> a2-6 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-6 this) + (return #t) + ) + ) + ) + ) + (clear s5-0) + (format s5-0 "delete from region_face where region_id=~D" (-> this id)) + (let ((a2-8 (sql-query s5-0))) + (when (!= (-> a2-8 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-8 this) + (return #t) + ) + ) + (when (zero? arg0) + (clear s5-0) + (format s5-0 "delete from region where region_id=~D" (-> this id)) + (let ((a2-10 (sql-query s5-0))) + (when (!= (-> a2-10 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-10 this) + (return #t) + ) + ) + ) + ) + ) + #f + ) + +(defmethod save-region! ((this editable-region) (arg0 editable-array) (arg1 int) (arg2 int)) + (local-vars (v0-0 symbol)) + (set! v0-0 + (when (-> this changed) + (format 0 "NOTICE: saving ~A~%" this) + (let ((s5-0 *collapse-quote*)) + (set! *collapse-quote* #f) + (case (-> this tree) + (('entity) + (let* ((s3-0 (-> arg0 length)) + (s2-0 0) + (s1-0 (-> arg0 data s2-0)) + ) + (while (< s2-0 s3-0) + (when (and s1-0 (= (-> s1-0 region) this) (not (logtest? (-> s1-0 flags) (editable-flag no-save)))) + (when (not (editable-method-24 s1-0 arg0 1 0)) + (format 0 "ERROR: sql: insert error for ~A~%" s1-0) + (return #f) + ) + ) + (+! s2-0 1) + (set! s1-0 (-> arg0 data s2-0)) + ) + ) + ) + (('light) + (let* ((s3-1 (-> arg0 length)) + (s2-1 0) + (s1-1 (-> arg0 data s2-1)) + ) + (while (< s2-1 s3-1) + (when (and s1-1 (= (-> s1-1 region) this) (not (logtest? (-> s1-1 flags) (editable-flag no-save)))) + (when (not (editable-method-24 s1-1 arg0 1 0)) + (format 0 "ERROR: sql: insert error for ~A~%" s1-1) + (return #f) + ) + ) + (+! s2-1 1) + (set! s1-1 (-> arg0 data s2-1)) + ) + ) + ) + (('sample) + (let ((s3-2 (clear *temp-string*))) + (format s3-2 "delete from sample_point where level_info_id=~D and source='manual'" (-> arg0 level-info-id)) + (let ((a2-7 (sql-query s3-2))) + (when (!= (-> a2-7 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-7 this) + (return #t) + ) + ) + (format + (clear s3-2) + "update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D" + (-> arg0 level-info-id) + ) + (let ((a2-9 (sql-query s3-2))) + (when (!= (-> a2-9 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-9 this) + (return #t) + ) + ) + ) + (let* ((s3-3 (-> arg0 length)) + (s2-3 0) + (s1-2 (-> arg0 data s2-3)) + ) + (while (< s2-3 s3-3) + (when (and s1-2 (= (-> s1-2 region) this) (not (logtest? (-> s1-2 flags) (editable-flag no-save)))) + (when (not (editable-method-24 s1-2 arg0 1 0)) + (format 0 "ERROR: sql: insert error for ~A~%" s1-2) + (return #f) + ) + ) + (+! s2-3 1) + (set! s1-2 (-> arg0 data s2-3)) + ) + ) + ) + (else + (cond + ((zero? (-> this id)) + (let ((s3-4 (clear *temp-string*))) + (format s3-4 "insert into region set level_name='~S',tree='~S'" (-> this level) (-> this tree)) + (let ((a2-13 (-> this on-enter))) + (if a2-13 + (format s3-4 ",on_enter='~S'" a2-13) + (format s3-4 ",on_enter=''") + ) + ) + (let ((a2-14 (-> this on-exit))) + (if a2-14 + (format s3-4 ",on_exit='~S'" a2-14) + (format s3-4 ",on_exit=''") + ) + ) + (let ((a2-15 (-> this on-inside))) + (if a2-15 + (format s3-4 ",on_inside='~S'" a2-15) + (format s3-4 ",on_inside=''") + ) + ) + (let ((s3-5 (sql-query s3-4))) + (when (= (-> s3-5 content-type) 'modify) + (let ((v1-64 (sql-query "select LAST_INSERT_ID()"))) + (when (= (-> v1-64 content-type) 'select) + (set! (-> this id) (the-as uint (string->int (the-as string (-> v1-64 sql-data 0))))) + (goto cfg-77) + ) + ) + ) + (format 0 "ERROR: sql: insert error ~A for ~A~%" s3-5 this) + ) + ) + (set! v0-0 #f) + (b! #t cfg-91 :delay (nop!)) + (the-as none 0) + ) + (else + (let ((s3-6 (clear *temp-string*))) + (format s3-6 "update region set level_name='~S',tree='~S'" (-> this level) (-> this tree)) + (let ((a2-18 (-> this on-enter))) + (if a2-18 + (format s3-6 ",on_enter='~S'" a2-18) + (format s3-6 ",on_enter=NULL") + ) + ) + (let ((a2-19 (-> this on-exit))) + (if a2-19 + (format s3-6 ",on_exit='~S'" a2-19) + (format s3-6 ",on_exit=NULL") + ) + ) + (let ((a2-20 (-> this on-inside))) + (if a2-20 + (format s3-6 ",on_inside='~S'" a2-20) + (format s3-6 ",on_inside=NULL") + ) + ) + (format s3-6 " where region_id=~D" (-> this id)) + (let ((a2-22 (sql-query s3-6))) + (when (!= (-> a2-22 content-type) 'modify) + (format 0 "ERROR: sql: update error ~A for ~A~%" a2-22 this) + (return #f) + ) + ) + ) + ) + ) + (label cfg-77) + (editable-region-method-10 this 1) + (let* ((s3-7 (-> arg0 length)) + (s2-4 0) + (s1-3 (-> arg0 data s2-4)) + ) + (while (< s2-4 s3-7) + (when (and s1-3 (= (-> s1-3 region) this) (not (logtest? (-> s1-3 flags) (editable-flag no-save)))) + (when (not (editable-method-24 s1-3 arg0 1 0)) + (format 0 "ERROR: sql: insert error for ~A~%" s1-3) + (return #f) + ) + ) + (+! s2-4 1) + (set! s1-3 (-> arg0 data s2-4)) + ) + ) + ) + ) + (set! (-> this changed) #f) + (set! v0-0 #t) + (set! *collapse-quote* s5-0) + ) + v0-0 + ) + ) + (label cfg-91) + v0-0 + ) + +(defmethod print-region-info ((this editable-region) (arg0 vector) (arg1 int)) + (local-vars (sv-32 vector2h)) + (set! sv-32 (new 'stack 'vector2h)) + (add-debug-x #t (bucket-id debug-no-zbuf1) arg0 (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80))) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 577) + ) + (format (clear *temp-string*) "region-~D~%" (-> this id)) + (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + (when (>= arg1 1) + (let ((s4-1 (-> this on-enter))) + (when s4-1 + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 577) + ) + (format (clear *temp-string*) "(on-enter ~S)" s4-1) + (s3-1 s2-1 (the-as bucket-id s1-1) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((s4-2 (-> this on-inside))) + (when s4-2 + (let ((s3-2 add-debug-text-3d) + (s2-2 #t) + (s1-2 577) + ) + (format (clear *temp-string*) "(on-inside ~S)" s4-2) + (s3-2 s2-2 (the-as bucket-id s1-2) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((s5-1 (-> this on-exit))) + (when s5-1 + (let ((s4-3 add-debug-text-3d) + (s3-3 #t) + (s2-3 577) + ) + (format (clear *temp-string*) "(on-exit ~S)" s5-1) + (s4-3 s3-3 (the-as bucket-id s2-3) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs editable-filter. +(defmethod editable-region-method-12 ((this editable-region)) + (let* ((s5-0 0) + (s4-0 + (lambda ((arg0 object)) + (let ((filter-type (editable-filter))) + (when (not (type? arg0 string)) + (format (clear *temp-string*) "~A" arg0) + (set! arg0 *temp-string*) + ) + (if (>= (string-position "(sound-play" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter sound)))) + ) + (if (>= (string-position "(part-tracker" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter part)))) + ) + (if (>= (string-position "(want-" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter load)))) + ) + (if (>= (string-position "(setting-" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter user-setting)))) + ) + (if (>= (string-position "(water" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter water-command)))) + ) + (the-as editable-filter filter-type) + ) + ) + ) + (filter + (logior (logior (logior (the-as editable-filter s5-0) (s4-0 (-> this on-inside))) (s4-0 (-> this on-enter))) + (s4-0 (-> this on-exit)) + ) + ) + ) + (when (zero? filter) + (if (and (not (-> this on-inside)) (not (-> this on-enter)) (not (-> this on-exit))) + (set! filter (editable-filter none)) + (set! filter (editable-filter unknown)) + ) + ) + (case (-> this tree) + (('target) + (set! filter (the-as editable-filter (logior (the-as int filter) (editable-filter target)))) + ) + (('camera) + (set! filter (the-as editable-filter (logior (the-as int filter) (editable-filter camera)))) + ) + (('data) + (set! filter (the-as editable-filter (logior (the-as int filter) (editable-filter data)))) + ) + (('water) + (set! filter (the-as editable-filter (logior (the-as int filter) (editable-filter water)))) + ) + (('city_vis) + (set! filter (editable-filter city_vis)) + ) + (('sample) + (set! filter (editable-filter sample)) + ) + (('light) + (set! filter (editable-filter light)) + ) + (('sound) + (set! filter (editable-filter sound)) + ) + (('entity) + (set! filter (editable-filter entity)) + ) + ) + (the-as editable-filter filter) + ) + ) + +(defmethod editable-method-25 ((this editable)) + #t + ) + +(defmethod editable-method-30 ((this editable) (arg0 editable-flag)) + (let* ((s5-0 (the-as object (-> this owner))) + (a0-1 (-> (the-as pair s5-0) car)) + ) + (while (not (null? s5-0)) + (editable-method-30 (the-as editable a0-1) arg0) + (set! s5-0 (-> (the-as pair s5-0) cdr)) + (set! a0-1 (-> (the-as pair s5-0) car)) + ) + ) + 0 + (none) + ) + +(defmethod editable-method-31 ((this editable) (arg0 editable-flag)) + (let* ((s5-0 (the-as object (-> this owner))) + (a0-1 (-> (the-as pair s5-0) car)) + ) + (while (not (null? s5-0)) + (editable-method-31 (the-as editable a0-1) arg0) + (set! s5-0 (-> (the-as pair s5-0) cdr)) + (set! a0-1 (-> (the-as pair s5-0) car)) + ) + ) + 0 + (none) + ) + +(defmethod change-region! ((this editable) (arg0 editable-region)) + (when (not (and (-> this region) (-> this region locked))) + (if arg0 + (set! (-> arg0 changed) #t) + ) + (if (-> this region) + (set! (-> this region changed) #t) + ) + (logior! (-> this flags) (editable-flag changed)) + (set! (-> this region) arg0) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs rgba. +(defmethod get-color ((this editable)) + (the-as rgba (cond + ((and (logtest? (-> this flags) (editable-flag selected)) + (< (mod (-> *display* real-clock frame-counter) 60) 30) + ) + (the-as int (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + ) + ((logtest? (-> this flags) (editable-flag no-save)) + (shl #x80ff 16) + ) + ((= (-> this type) editable-point) + (the-as int (new 'static 'rgba :r #xff :g #x80 :a #x80)) + ) + ((= (-> this type) editable-sample) + (the-as int (new 'static 'rgba :g #x80 :b #xff :a #x80)) + ) + ((= (-> this type) editable-light) + (if (= (-> (the-as editable-light this) color w) -2.0) + (the-as int (new 'static 'rgba :r #xff :b #xff :a #x80)) + (the-as int (new 'static 'rgba :r #x80 :b #xff :a #x80)) + ) + ) + ((= (-> this type) editable-entity) + (the-as int (new 'static 'rgba :r #xff :b #xff :a #x80)) + ) + (else + (the-as int (new 'static 'rgba :r #xff :a #x80)) + ) + ) + ) + ) + +(defmethod editable-method-10 ((this editable)) + (when (logtest? (-> this flags) (editable-flag selected)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (when (editable-method-11 this s5-0) + (set! (-> s5-0 y) (-> s5-0 y)) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + s5-0 + (the-as rgba (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + ) + ) + ) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 this) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ) + 0 + (none) + ) + +(defmethod set-selected! ((this editable) (arg0 symbol)) + (case arg0 + (('toggle) + (logxor! (-> this flags) (editable-flag selected)) + ) + ((#f) + (logclear! (-> this flags) (editable-flag selected)) + ) + (else + (logior! (-> this flags) (editable-flag selected)) + ) + ) + 0 + (none) + ) + +(defmethod editable-method-13 ((this editable) (arg0 vector)) + -1.0 + ) + +(defmethod editable-method-14 ((this editable) (arg0 vector) (arg1 vector)) + -1.0 + ) + +(defmethod editable-method-22 ((this editable) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (local-vars (sv-48 vector) (sv-52 vector)) + (set! sv-48 (new 'stack-no-clear 'vector)) + (set! sv-52 (new 'stack-no-clear 'vector)) + (let ((s4-0 (editable-method-15 this))) + (reverse-transform-point! sv-48 s4-0 arg2 arg0) + (reverse-transform-point! sv-52 s4-0 arg2 arg1) + (vector-! arg3 sv-52 sv-48) + (vector-! (new 'stack-no-clear 'vector) s4-0 (-> *math-camera* trans)) + ) + (if (< 20480.0 (vector-length arg3)) + (vector-normalize! arg3 20480.0) + ) + (editable-method-17 this arg3 (editable-flag x y z)) + 0 + (none) + ) + +(defmethod editable-method-11 ((this editable) (arg0 vector)) + (with-pp + (let ((s5-0 (new 'stack 'collide-query))) + (vector-copy! (-> s5-0 start-pos) (editable-method-15 this)) + (set-vector! (-> s5-0 move-dist) 0.0 -204800.0 0.0 1.0) + (let ((v1-5 s5-0)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) + (collide-spec backgnd crate obstacle hit-by-player-list hit-by-others-list collectable pusher) + ) + (set! (-> v1-5 ignore-process0) pp) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) + (vector-copy! arg0 (-> s5-0 best-other-tri intersect)) + (set! (-> arg0 w) 1.0) + #t + ) + ) + ) + ) + +(defmethod editable-method-26 ((this editable)) + 0 + (none) + ) + +(defmethod editable-method-19 ((this editable) (arg0 vector)) + 0 + (none) + ) + +(defmethod editable-method-24 ((this editable) (arg0 editable-array) (arg1 int) (arg2 int)) + #t + ) + +(defmethod editable-method-17 ((this editable) (arg0 vector) (arg1 editable-flag)) + 0 + (none) + ) + +(defmethod editable-method-18 ((this editable) (arg0 vector) (arg1 int)) + 0 + (none) + ) + +(defmethod editable-method-20 ((this editable) (arg0 vector) (arg1 matrix)) + 0 + (none) + ) + +(defmethod editable-method-15 ((this editable)) + *null-vector* + ) + +(defmethod editable-method-16 ((this editable)) + 0.0 + ) + +(defmethod editable-method-21 ((this editable) (arg0 vector)) + 0 + (none) + ) + +(defmethod editable-method-35 ((this editable) (arg0 vector)) + 0 + (none) + ) + +(defmethod editable-method-28 ((this editable) (arg0 editable) (arg1 editable)) + 0 + (none) + ) + +(defmethod delete! ((this editable) (arg0 editable)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (let* ((s4-0 (the-as object (-> this owner))) + (a0-3 (-> (the-as pair s4-0) car)) + ) + (while (not (null? s4-0)) + (editable-method-28 (the-as editable a0-3) this arg0) + (set! s4-0 (-> (the-as pair s4-0) cdr)) + (set! a0-3 (-> (the-as pair s4-0) car)) + ) + ) + 0 + (none) + ) + +(defmethod copy-into-editable-array! ((this editable) (arg0 editable-array)) + (local-vars (s4-0 editable)) + (let ((v1-0 0)) + (while (< v1-0 (-> arg0 selection length)) + (when (= this (-> arg0 selection v1-0)) + (set! s4-0 (-> arg0 selection (+ v1-0 1))) + (goto cfg-10) + ) + (+! v1-0 2) + ) + ) + (let ((s3-0 (get-length arg0))) + (set! s4-0 (when (>= s3-0 0) + (set! s4-0 (copy this 'debug)) + (let ((v1-9 (-> arg0 region))) + (if v1-9 + (set! (-> s4-0 region) v1-9) + ) + ) + (set! (-> s4-0 region changed) #t) + (logior! (-> this flags) (editable-flag changed)) + (set! (-> s4-0 id) (the-as uint 0)) + (set! (-> s4-0 owner) '()) + (set-selected! s4-0 #f) + (set! (-> s4-0 prefix) (new 'debug 'string 32 (the-as string (-> this prefix)))) + (let ((s2-0 (new 'debug 'string 32 (the-as string #f)))) + (format s2-0 "~s-~d" (-> this prefix) *editable-temp-id*) + (set! (-> s4-0 name) s2-0) + ) + (set! *editable-temp-id* (+ *editable-temp-id* 1)) + (set! (-> arg0 data s3-0) s4-0) + (set! (-> arg0 selection (-> arg0 selection length)) this) + (set! (-> arg0 selection (+ (-> arg0 selection length) 1)) s4-0) + (+! (-> arg0 selection length) 2) + s4-0 + ) + ) + ) + (label cfg-10) + s4-0 + ) + +(defmethod get-null-vec ((this editable)) + *null-vector* + ) + +(defmethod get-null-vec2 ((this editable) (arg0 vector)) + *null-vector* + ) + +(defmethod get-level-offset ((this editable) (arg0 editable-array)) + (local-vars (sv-16 sql-result)) + (when (!= (-> this region level) (-> arg0 level)) + (let ((gp-0 (new 'static 'vector))) + (let ((s3-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z from level_info where name='~S'" + (-> this region level) + ) + (set! sv-16 (s3-0 *temp-string*)) + ) + (when (= (-> sv-16 content-type) 'select) + (set-vector! + gp-0 + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) + 1.0 + ) + (return gp-0) + ) + ) + ) + (-> arg0 level-offset) + ) + +(defmethod print ((this editable-point)) + (format + #t + "#<~A~S~m ~m ~m :r ~m" + (-> this type) + (if (logtest? (-> this flags) (editable-flag changed)) + " (m)" + "" + ) + (-> this trans x) + (-> this trans y) + (-> this trans z) + (-> this radius) + ) + (format #t " @ #x~X>" this) + this + ) + +;; WARN: Function (method 30 editable-point) has a return type of none, but the expression builder found a return statement. +(defmethod editable-method-30 ((this editable-point) (arg0 editable-flag)) + (if (logtest? arg0 (editable-flag no-update)) + (return #f) + ) + (let ((s4-0 (-> *editable* 0 current))) + (cond + ((logtest? (-> this flags) (editable-flag top-set)) + (let* ((s3-0 (-> s4-0 length)) + (s2-0 0) + (s1-0 (-> s4-0 data s2-0)) + ) + (while (< s2-0 s3-0) + (if (and s1-0 + (= (-> s1-0 region) (-> this region)) + (common-owner s1-0 this) + (logtest? (-> s1-0 flags) (editable-flag top-set)) + ) + (editable-method-18 s1-0 (-> this trans) 144) + ) + (+! s2-0 1) + (set! s1-0 (-> s4-0 data s2-0)) + ) + ) + ) + ((logtest? (-> this flags) (editable-flag bot-set)) + (let* ((s3-1 (-> s4-0 length)) + (s2-1 0) + (s1-1 (-> s4-0 data s2-1)) + ) + (while (< s2-1 s3-1) + (if (and s1-1 + (= (-> s1-1 region) (-> this region)) + (common-owner s1-1 this) + (logtest? (-> s1-1 flags) (editable-flag bot-set)) + ) + (editable-method-18 s1-1 (-> this trans) 144) + ) + (+! s2-1 1) + (set! s1-1 (-> s4-0 data s2-1)) + ) + ) + ) + ) + ) + (call-parent-method this arg0) + 0 + (none) + ) + +(defmethod editable-method-17 ((this editable-point) (arg0 vector) (arg1 editable-flag)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (vector+! (-> this trans) (-> this trans) arg0) + (editable-method-30 this arg1) + 0 + (none) + ) + +(defmethod editable-method-18 ((this editable-point) (arg0 vector) (arg1 int)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (if (logtest? arg1 8) + (set! (-> this trans x) (-> arg0 x)) + ) + (if (logtest? arg1 16) + (set! (-> this trans y) (-> arg0 y)) + ) + (if (logtest? arg1 32) + (set! (-> this trans z) (-> arg0 z)) + ) + (editable-method-30 this (the-as editable-flag arg1)) + 0 + (none) + ) + +(defmethod editable-method-15 ((this editable-point)) + (-> this trans) + ) + +(defmethod editable-method-20 ((this editable-point) (arg0 vector) (arg1 matrix)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this trans) arg0))) + (vector-matrix*! s4-1 s4-1 arg1) + (vector+! (-> this trans) s4-1 arg0) + ) + 0 + (none) + ) + +(defmethod editable-method-10 ((this editable-point)) + (let* ((f0-1 (- (vector-vector-distance (math-camera-pos) (-> this trans)) (-> this radius))) + (s2-0 (cond + ((logtest? (-> this flags) (editable-flag selected)) + 6 + ) + ((>= f0-1 983040.0) + 3 + ) + ((>= f0-1 491520.0) + 4 + ) + ((>= f0-1 245760.0) + 5 + ) + (else + 6 + ) + ) + ) + ) + (add-debug-sphere-from-table (bucket-id debug) (-> this trans) (-> this radius) (get-color this) s2-0) + ) + ((method-of-type editable editable-method-10) this) + (none) + ) + +(defmethod editable-method-13 ((this editable-point) (arg0 vector)) + (let ((a0-1 (new 'stack-no-clear 'sphere)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 quad) (-> this trans quad)) + (set! (-> a0-1 r) (-> this radius)) + (when (sphere-in-view-frustum? a0-1) + (reverse-transform-point! s5-0 (-> this trans) (-> *math-camera* inv-camera-rot fvec) arg0) + (let ((f0-1 (vector-vector-distance (editable-method-15 this) s5-0))) + (if (>= (-> this radius) f0-1) + (return f0-1) + ) + ) + ) + ) + -1.0 + ) + +(defmethod editable-method-14 ((this editable-point) (arg0 vector) (arg1 vector)) + (let ((a0-1 (new 'stack-no-clear 'sphere))) + (new 'stack-no-clear 'vector) + (set! (-> a0-1 quad) (-> this trans quad)) + (set! (-> a0-1 r) (-> this radius)) + (when (sphere-in-view-frustum? a0-1) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-copy! s4-0 (-> *math-camera* inv-camera-rot fvec)) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (v1-7 4) + (set! (-> s5-0 v1-7 quad) (the-as uint128 0)) + ) + (let ((t9-1 reverse-transform-point!) + (a0-4 (-> s5-0 0)) + (a1-3 (-> this trans)) + (a2-1 s4-0) + (a3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-0 x) (-> arg0 x)) + (set! (-> a3-0 y) (-> arg0 y)) + (set! (-> a3-0 z) 0.0) + (set! (-> a3-0 w) 1.0) + (t9-1 a0-4 a1-3 a2-1 a3-0) + ) + (let ((t9-2 reverse-transform-point!) + (a0-5 (-> s5-0 1)) + (a1-4 (-> this trans)) + (a2-2 s4-0) + (a3-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-1 x) (-> arg1 x)) + (set! (-> a3-1 y) (-> arg0 y)) + (set! (-> a3-1 z) 0.0) + (set! (-> a3-1 w) 1.0) + (t9-2 a0-5 a1-4 a2-2 a3-1) + ) + (let ((t9-3 reverse-transform-point!) + (a0-6 (-> s5-0 2)) + (a1-5 (-> this trans)) + (a2-3 s4-0) + (a3-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-2 x) (-> arg1 x)) + (set! (-> a3-2 y) (-> arg1 y)) + (set! (-> a3-2 z) 0.0) + (set! (-> a3-2 w) 1.0) + (t9-3 a0-6 a1-5 a2-3 a3-2) + ) + (let ((t9-4 reverse-transform-point!) + (a0-7 (-> s5-0 3)) + (a1-6 (-> this trans)) + (a2-4 s4-0) + (a3-3 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-3 x) (-> arg0 x)) + (set! (-> a3-3 y) (-> arg1 y)) + (set! (-> a3-3 z) 0.0) + (set! (-> a3-3 w) 1.0) + (t9-4 a0-7 a1-6 a2-4 a3-3) + ) + (dotimes (s3-1 4) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (transform-point-vector! s2-1 (-> s5-0 s3-1)) + (if (< (-> s2-1 z) 0.0) + (return -1.0) + ) + ) + ) + (let ((s3-2 0)) + (dotimes (s2-2 4) + (let ((s1-1 (vector-cross! (new 'stack-no-clear 'vector) s4-0 (vector-! + (new 'stack-no-clear 'vector) + (-> s5-0 (if (= s2-2 3) + 0 + (+ s2-2 1) + ) + ) + (-> s5-0 s2-2) + ) + ) + ) + ) + (vector-normalize! s1-1 1.0) + (let ((f0-19 (vector-dot s1-1 (vector-! (new 'stack-no-clear 'vector) (-> this trans) (-> s5-0 s2-2))))) + (if (< f0-19 (- (-> this radius))) + (return -1.0) + ) + (if (< 0.0 f0-19) + (+! s3-2 1) + ) + ) + ) + ) + (if (= s3-2 4) + (return 1.0) + ) + ) + (dotimes (s4-1 4) + (let ((a3-4 (new 'stack-no-clear 'vector))) + (if (< (vector-segment-distance-point! + (-> this trans) + (-> s5-0 (if (= s4-1 3) + 0 + (+ s4-1 1) + ) + ) + (-> s5-0 s4-1) + a3-4 + ) + (-> this radius) + ) + (return 1.0) + ) + ) + ) + ) + ) + ) + ) + -1.0 + ) + +(defmethod editable-method-21 ((this editable-point) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)))) + (vector-normalize! s4-1 (-> this radius)) + (vector-! (-> this trans) arg0 s4-1) + ) + (editable-method-30 this (editable-flag no-plane-snap)) + 0 + (none) + ) + +(defmethod editable-method-24 ((this editable-point) (arg0 editable-array) (arg1 int) (arg2 int)) + (case arg1 + ((2) + (let ((s3-0 (get-level-offset this arg0)) + (s4-0 (clear *temp-string*)) + ) + (format + s4-0 + "insert into region_point set region_face_id=LAST_INSERT_ID(),idx=~D,x=~f,y=~f,z=~f" + arg2 + (- (-> this trans x) (-> s3-0 x)) + (- (-> this trans y) (-> s3-0 y)) + (- (-> this trans z) (-> s3-0 z)) + ) + (let ((a0-6 (sql-query s4-0))) + (when (= (-> a0-6 content-type) 'modify) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +(defmethod editable-method-19 ((this editable-sphere) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> this radius) (-> arg0 x)) + (set! (-> this radius) (-> arg0 y)) + ) + (if (< (-> this radius) 0.0) + (set! (-> this radius) 0.0) + ) + (editable-method-30 this (editable-flag no-plane-snap)) + 0 + (none) + ) + +;; WARN: Return type mismatch meters vs float. +(defmethod editable-method-16 ((this editable-sphere)) + (the-as float (-> this radius)) + ) + +(defmethod editable-method-24 ((this editable-sphere) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (get-level-offset this arg0)) + (s5-0 (clear *temp-string*)) + ) + (format + s5-0 + "insert into region_sphere set region_id=~D,x=~f,y=~f,z=~f,r=~f" + (-> this region id) + (- (-> this trans x) (-> s4-0 x)) + (- (-> this trans y) (-> s4-0 y)) + (- (-> this trans z) (-> s4-0 z)) + (-> this radius) + ) + (= (-> (sql-query s5-0) content-type) 'modify) + ) + ) + +(defmethod editable-method-24 ((this editable-sample) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s5-0 (clear *temp-string*))) + (format + s5-0 + "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" + (-> arg0 level-info-id) + (* 0.00024414062 (- (-> this trans x) (-> arg0 level-offset x))) + (* 0.00024414062 (- (-> this trans y) (-> arg0 level-offset y))) + (* 0.00024414062 (- (-> this trans z) (-> arg0 level-offset z))) + ) + (let ((a0-4 (sql-query s5-0))) + (when (= (-> a0-4 content-type) 'modify) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + ) + ) + ) + +(defmethod print ((this editable-light)) + (format + #t + "#<~A~S ~S ~m ~m ~m" + (-> this type) + (if (logtest? (-> this flags) (editable-flag changed)) + " (m)" + "" + ) + (-> this name) + (-> this trans x) + (-> this trans y) + (-> this trans z) + ) + (format #t " :r ~m @ #x~X>" (-> this radius) this) + this + ) + +(defmethod editable-method-25 ((this editable-light)) + (let ((v1-0 *light-hash*)) + (let* ((a2-0 (-> v1-0 num-lights)) + (a1-1 (-> v1-0 light-sphere-array a2-0)) + ) + (set! (-> a1-1 name) (-> this name)) + (set! (-> a1-1 decay-start) (-> this decay-start)) + (set! (-> a1-1 ambient-point-ratio) (-> this ambient-point-ratio)) + (set! (-> a1-1 brightness) (-> this brightness)) + (vector-copy! (-> a1-1 bsphere) (-> this trans)) + (set! (-> a1-1 bsphere w) (-> this radius)) + (when (= (-> this color w) -2.0) + (let ((a3-2 0) + (a2-6 0) + ) + (let ((t0-0 (-> this shadows))) + (dotimes (t1-0 5) + (when (!= (-> t0-0 t1-0) 1.0) + (set! a3-2 (logior a3-2 (ash 1 t1-0))) + (set! a2-6 (logior a2-6 (ash (logand (the int (* 16.0 (-> t0-0 t1-0))) 15) (* t1-0 4)))) + ) + ) + ) + (set! (-> this direction x) + (the-as + float + (logior (logand (the-as uint (-> this direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a3-2 56) 32)) + ) + ) + (set! (-> this direction x) + (the-as float (logior (logand (the-as int (-> this direction x)) -16777216) (shr (shl a2-6 40) 40))) + ) + ) + ) + (set! (-> (the-as vector (&-> a1-1 shadow)) quad) (-> this direction quad)) + (vector-copy! (-> a1-1 color) (-> this color)) + (set! (-> a1-1 palette-index) (the int (-> this color w))) + ) + (+! (-> v1-0 num-lights) 1) + ) + #t + ) + +;; WARN: Return type mismatch int vs object. +(defun update-light-sphere-from-editable-light ((arg0 editable-light)) + (let ((v1-0 (lookup-light-sphere-by-name (-> arg0 name) *light-hash*))) + (when v1-0 + (set! (-> v1-0 name) (-> arg0 name)) + (set! (-> v1-0 decay-start) (-> arg0 decay-start)) + (set! (-> v1-0 ambient-point-ratio) (-> arg0 ambient-point-ratio)) + (set! (-> v1-0 brightness) (-> arg0 brightness)) + (vector-copy! (-> v1-0 bsphere) (-> arg0 trans)) + (set! (-> v1-0 bsphere w) (-> arg0 radius)) + (when (= (-> arg0 color w) -2.0) + (let ((a1-3 0) + (a0-6 0) + ) + (let ((a2-0 (-> arg0 shadows))) + (dotimes (a3-0 5) + (when (!= (-> a2-0 a3-0) 1.0) + (set! a1-3 (logior a1-3 (ash 1 a3-0))) + (set! a0-6 (logior a0-6 (ash (logand (the int (* 16.0 (-> a2-0 a3-0))) 15) (* a3-0 4)))) + ) + ) + ) + (set! (-> arg0 direction x) + (the-as + float + (logior (logand (the-as uint (-> arg0 direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a1-3 56) 32)) + ) + ) + (set! (-> arg0 direction x) + (the-as float (logior (logand (the-as int (-> arg0 direction x)) -16777216) (shr (shl a0-6 40) 40))) + ) + ) + ) + (set! (-> (the-as vector (&-> v1-0 shadow)) quad) (-> arg0 direction quad)) + (vector-copy! (-> v1-0 color) (-> arg0 color)) + (let ((v0-1 (the int (-> arg0 color w)))) + (set! (-> v1-0 palette-index) v0-1) + v0-1 + ) + ) + ) + ) + +(defmethod editable-method-19 ((this editable-light) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> this radius) (-> arg0 x)) + (set! (-> this radius) (-> arg0 y)) + ) + (if (< (-> this radius) 0.0) + (set! (-> this radius) 0.0) + ) + (update-light-sphere-from-editable-light this) + (editable-method-30 this (editable-flag no-plane-snap)) + 0 + (none) + ) + +(defmethod editable-method-17 ((this editable-light) (arg0 vector) (arg1 editable-flag)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (vector+! (-> this trans) (-> this trans) arg0) + (update-light-sphere-from-editable-light this) + (editable-method-30 this arg1) + 0 + (none) + ) + +;; WARN: Function (method 27 editable-light) has a return type of none, but the expression builder found a return statement. +(defmethod delete! ((this editable-light) (arg0 editable)) + (call-parent-method this arg0) + (when (nonzero? (-> this id)) + (let ((s5-1 (clear *temp-string*))) + (format s5-1 "delete from light where light_id=~D" (-> this id)) + (let ((a2-1 (sql-query s5-1))) + (when (!= (-> a2-1 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 this) + (return 0) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod editable-method-24 ((this editable-light) (arg0 editable-array) (arg1 int) (arg2 int)) + (cond + ((logtest? (-> this flags) (editable-flag changed)) + (let ((s5-0 (clear *temp-string*))) + (when (zero? (-> this id)) + (format s5-0 "insert into light set level_name='~S'" (-> this region level)) + (let ((s3-0 (sql-query s5-0))) + (when (= (-> s3-0 content-type) 'modify) + (let ((v1-7 (sql-query "select LAST_INSERT_ID()"))) + (when (= (-> v1-7 content-type) 'select) + (set! (-> this id) (the-as uint (string->int (the-as string (-> v1-7 sql-data 0))))) + (goto cfg-8) + ) + ) + ) + (format 0 "ERROR: sql: id insert error ~A for ~A~%" s3-0 this) + ) + (return #f) + (label cfg-8) + (let ((s3-1 (new 'debug 'string 32 (the-as string #f)))) + (if (= (-> this color w) -2.0) + (format s3-1 "shadow-~d" (-> this id)) + (format s3-1 "light-~d" (-> this id)) + ) + (set! (-> this name) s3-1) + ) + ) + (format (clear s5-0) "update light set level_name='~S', name='~S'" (-> this region level) (-> this name)) + (format + s5-0 + ", pos_x=~f, pos_y=~f, pos_z=~f, r=~f" + (* 0.00024414062 (- (-> this trans x) (-> arg0 level-offset x))) + (* 0.00024414062 (- (-> this trans y) (-> arg0 level-offset y))) + (* 0.00024414062 (- (-> this trans z) (-> arg0 level-offset z))) + (/ (-> this radius) METER_LENGTH) + ) + (if (= (-> this direction w) 0.0) + (format s5-0 ", dir_x=0.0, dir_y=0.0, dir_z=0.0") + (format + s5-0 + ", dir_x=~f, dir_y=~f, dir_z=~f" + (-> this direction x) + (-> this direction y) + (-> this direction z) + ) + ) + (format + s5-0 + ", color0_r=~f, color0_g=~f, color0_b=~f, color0_a=~f" + (-> this color x) + (-> this color y) + (-> this color z) + (-> this color w) + ) + (format + s5-0 + ", decay_start=~f, ambient_point_ratio=~f, brightness=~f" + (-> this decay-start) + (-> this ambient-point-ratio) + (-> this brightness) + ) + (format + s5-0 + ", shadow_ambi =~d, shadow_dir_0 =~d, shadow_dir_1 =~d, shadow_dir_2 =~d, shadow_dir_3 =~d" + (the int (* 16.0 (-> this shadow-ambi))) + (the int (* 16.0 (-> this shadow-dir0))) + (the int (* 16.0 (-> this shadow-dir1))) + (the int (* 16.0 (-> this shadow-dir2))) + (the int (* 16.0 (-> this shadow-dir3))) + ) + (format s5-0 " where light_id=~D" (-> this id)) + (let ((a0-23 (sql-query s5-0))) + (when (= (-> a0-23 content-type) 'modify) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +(defmethod editable-method-10 ((this editable-light)) + (if (!= (-> this direction w) 0.0) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 this) + (-> this direction) + (* -1.2 (-> this radius)) + (the-as rgba (new 'static 'rgba :r #xff :b #xff :a #x80)) + ) + ) + (when (-> *editable* 0 light-names) + (let ((s5-1 add-debug-text-3d) + (s4-1 #t) + (s3-1 577) + ) + (format (clear *temp-string*) "~S~%" (-> this name)) + (s5-1 s4-1 (the-as bucket-id s3-1) *temp-string* (-> this trans) (font-color white) (the-as vector2h #f)) + ) + ) + ((method-of-type editable-sphere editable-method-10) this) + (none) + ) + +;; WARN: Return type mismatch euler-angles vs vector. +(defmethod get-null-vec ((this editable-entity)) + (the-as vector (-> this angles)) + ) + +;; WARN: Return type mismatch euler-angles vs vector. +(defmethod get-null-vec2 ((this editable-entity) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (set! (-> this angles quad) (-> arg0 quad)) + (editable-entity-method-36 this) + (the-as vector (-> this angles)) + ) + +(defmethod editable-method-35 ((this editable-entity) (arg0 vector)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (let ((s5-0 (new 'stack-no-clear 'quaternion))) + (logior! (-> this flags) (editable-flag changed)) + (eul->matrix s4-0 (-> this angles)) + (quaternion-from-two-vectors! s5-0 (-> s4-0 uvec) arg0) + (matrix*! s4-0 s4-0 (quaternion->matrix (new 'stack-no-clear 'matrix) s5-0)) + ) + (matrix->eul (-> this angles) s4-0 21) + ) + (editable-entity-method-36 this) + 0 + (none) + ) + +(defmethod editable-method-21 ((this editable-entity) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (new 'stack-no-clear 'vector) + (eul->matrix s4-0 (-> this angles)) + (let ((s5-0 (new 'stack 'collide-query))) + (vector-copy! (-> s5-0 start-pos) (-> this trans)) + (vector-float*! (-> s5-0 move-dist) (-> s4-0 uvec) -4096000.0) + (let ((v1-8 s5-0)) + (set! (-> v1-8 radius) 409.6) + (set! (-> v1-8 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-8 ignore-process0) #f) + (set! (-> v1-8 ignore-process1) #f) + (set! (-> v1-8 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-8 action-mask) (collide-action solid)) + ) + (let ((f0-2 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (if (>= f0-2 0.0) + (vector+*! (-> this trans) (-> s5-0 start-pos) (-> s5-0 move-dist) f0-2) + ) + ) + ) + ) + (editable-method-30 this (editable-flag no-plane-snap)) + (editable-entity-method-36 this) + 0 + (none) + ) + +(defmethod editable-method-30 ((this editable-entity) (arg0 editable-flag)) + (editable-entity-method-36 this) + (none) + ) + +;; WARN: Function (method 27 editable-entity) has a return type of none, but the expression builder found a return statement. +(defmethod delete! ((this editable-entity) (arg0 editable)) + (call-parent-method this arg0) + (when (nonzero? (-> this id)) + (let ((s5-1 (clear *temp-string*))) + (format s5-1 "delete from entity where entity_id=~D" (-> this id)) + (let ((a2-1 (sql-query s5-1))) + (when (!= (-> a2-1 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 this) + (return 0) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod copy-into-editable-array! ((this editable-entity) (arg0 editable-array)) + (let ((gp-1 (call-parent-method this arg0))) + (copy-string<-string (-> gp-1 name) (-> this name)) + (set! (-> gp-1 idx) 0) + (let ((a0-5 (new 'debug 'editable-region))) + (let ((v1-1 a0-5)) + (set! (-> v1-1 locked) #t) + (set! (-> v1-1 changed) #f) + (set! (-> v1-1 tree) 'entity) + (set! (-> v1-1 filter) (editable-filter entity)) + (set! (-> v1-1 level) (-> this region level)) + ) + (set! (-> gp-1 region) a0-5) + ) + gp-1 + ) + ) + +(defmethod editable-method-17 ((this editable-entity) (arg0 vector) (arg1 editable-flag)) + (call-parent-method this arg0 arg1) + (editable-entity-method-36 this) + (none) + ) + +(defmethod editable-method-18 ((this editable-entity) (arg0 vector) (arg1 int)) + (call-parent-method this arg0 arg1) + (editable-entity-method-36 this) + (none) + ) + +(defmethod editable-method-20 ((this editable-entity) (arg0 vector) (arg1 matrix)) + (call-parent-method this arg0 arg1) + (let ((s4-1 (new 'stack-no-clear 'matrix))) + (eul->matrix s4-1 (-> this angles)) + (matrix*! s4-1 s4-1 arg1) + (matrix->eul (-> this angles) s4-1 21) + ) + (editable-entity-method-36 this) + (none) + ) + +;; WARN: Return type mismatch int vs rgba. +(defmethod get-color ((this editable-entity)) + (the-as rgba (cond + ((or (string-suffix= (-> this name) "path") + (string-suffix= (-> this name) "chase-ring") + (string-suffix= (-> this name) "pickup") + (string-suffix= (-> this name) "rally-bollard") + (string-suffix= (-> this name) "freeze") + ) + (set! (-> this radius) (* 0.05 (vector-vector-distance (math-camera-pos) (-> this trans)))) + (cond + ((and (logtest? (-> this flags) (editable-flag selected)) + (< (mod (-> *display* real-clock frame-counter) 60) 30) + ) + (the-as int (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + ) + ((or (string-suffix= (-> this name) "pickup") (string-suffix= (-> this name) "freeze")) + (cond + ((string-prefix= "a-" (-> this name)) + (the-as int (new 'static 'rgba :r #xff :a #x80)) + ) + ((string-prefix= "b-" (-> this name)) + (shl #x80ff 16) + ) + (else + (the-as int (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + ) + ) + ) + (else + (the-as int (new 'static 'rgba :g #xff :a #x80)) + ) + ) + ) + (else + (set! (-> this radius) 4096.0) + (the-as int ((method-of-type editable get-color) this)) + ) + ) + ) + ) + +(defmethod editable-entity-method-36 ((this editable-entity)) + (with-pp + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "~S-~D" (-> this name) (-> this idx)) + (let ((s5-1 (as-type (process-by-name s5-0 *active-pool*) process-drawable))) + (when (and s5-1 (-> (the-as process-drawable s5-1) root)) + (let ((v1-2 (as-type (-> (the-as process-drawable s5-1) entity) entity-actor))) + (when v1-2 + (vector-copy! (-> v1-2 extra trans) (-> this trans)) + (vector-copy! (-> v1-2 trans) (-> this trans)) + (eul->quat (-> v1-2 quat) (-> this angles)) + ) + ) + (vector-copy! (-> (the-as process-drawable s5-1) root trans) (-> this trans)) + (eul->quat (-> (the-as process-drawable s5-1) root quat) (-> this angles)) + (let ((gp-1 pp)) + (set! pp s5-1) + (ja-post) + (set! pp gp-1) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod editable-method-24 ((this editable-entity) (arg0 editable-array) (arg1 int) (arg2 int)) + (if (string= "entity" (-> this name)) + (return #t) + ) + (cond + ((logtest? (-> this flags) (editable-flag changed)) + (let ((s4-0 (get-level-offset this arg0)) + (s5-1 (clear *temp-string*)) + ) + 0 + (format s5-1 "select level_info_id from level_info where name='~S'" (-> this region level)) + (let ((a2-2 (sql-query s5-1))) + (when (!= (-> a2-2 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A~%" a2-2) + (return #f) + ) + (let ((s3-0 (string->int (the-as string (-> a2-2 sql-data 0))))) + (when (zero? (-> this id)) + (format (clear s5-1) "select ifnull(max(idx) + 1, 1) from entity where name='~S'" (-> this name)) + (let ((v1-14 (sql-query s5-1))) + (if (= (-> v1-14 content-type) 'select) + (set! (-> this idx) (string->int (the-as string (-> v1-14 sql-data 0)))) + ) + ) + (format + (clear s5-1) + "insert entity set level_id=~D,path='region-editor',idx=~D,name='~S'" + s3-0 + (-> this idx) + (-> this name) + ) + (let ((s2-2 (sql-query s5-1))) + (when (= (-> s2-2 content-type) 'modify) + (let ((v1-17 (sql-query "select LAST_INSERT_ID()"))) + (when (= (-> v1-17 content-type) 'select) + (set! (-> this id) (the-as uint (string->int (the-as string (-> v1-17 sql-data 0))))) + (goto cfg-16) + ) + ) + ) + (format 0 "ERROR: sql: id ---- insert error ~A for ~A~%" s2-2 this) + ) + (return #f) + ) + (label cfg-16) + (format + (clear s5-1) + "update entity set level_id=~D, name='~S', path='region-editor-~D'" + s3-0 + (-> this name) + (-> this id) + ) + ) + ) + (format + s5-1 + ", position_x=~f, position_y=~f, position_z=~f" + (* 0.00024414062 (- (-> this trans x) (-> s4-0 x))) + (* 0.00024414062 (- (-> this trans y) (-> s4-0 y))) + (* 0.00024414062 (- (-> this trans z) (-> s4-0 z))) + ) + (format + s5-1 + ", rot_x=~f, rot_y=~f, rot_z=~f" + (* 0.005493164 (-> this angles x)) + (* 0.005493164 (-> this angles y)) + (* 0.005493164 (-> this angles z)) + ) + (format s5-1 " where entity_id=~D" (-> this id)) + (let ((a0-31 (sql-query s5-1))) + (when (= (-> a0-31 content-type) 'modify) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +(defmethod editable-method-15 ((this editable-face)) + "The center of the obj." + (cond + ((>= (-> this length) 3) + (let ((s5-0 (new 'static 'vector))) + (set! (-> s5-0 quad) (the-as uint128 0)) + (vector+! s5-0 s5-0 (editable-method-15 (-> this vertex 0))) + (vector+! s5-0 s5-0 (editable-method-15 (-> this vertex 1))) + (vector+! s5-0 s5-0 (editable-method-15 (-> this vertex 2))) + (vector-float*! s5-0 s5-0 0.33333334) + ) + ) + ((>= (-> this length) 2) + (let ((s5-1 (new 'static 'vector))) + (set! (-> s5-1 quad) (the-as uint128 0)) + (vector+! s5-1 s5-1 (editable-method-15 (-> this vertex 0))) + (vector+! s5-1 s5-1 (editable-method-15 (-> this vertex 1))) + (vector-float*! s5-1 s5-1 0.5) + ) + ) + (else + *null-vector* + ) + ) + ) + +(defmethod editable-method-24 ((this editable-face) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (clear *temp-string*))) + (format s4-0 "insert into region_face set kind='face',region_id=~D" (-> this region id)) + (if (logtest? (-> this flags) (editable-flag orient)) + (format s4-0 ",flags='orient'") + ) + (let ((a0-5 (sql-query s4-0))) + (if (!= (-> a0-5 content-type) 'modify) + (return #f) + ) + ) + ) + (dotimes (s4-1 (-> this length)) + (editable-method-24 (-> this vertex s4-1) arg0 2 s4-1) + ) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + +(defmethod delete! ((this editable-face) (arg0 editable)) + (dotimes (s4-0 (-> this length)) + (let ((s3-0 (-> this vertex s4-0))) + (set! (-> s3-0 owner) (delete! this (-> s3-0 owner))) + ) + ) + (call-parent-method this arg0) + (none) + ) + +(defmethod editable-method-28 ((this editable-face) (arg0 editable) (arg1 editable)) + (-> this length) + (countdown (v1-1 (-> this length)) + (when (= (-> this vertex v1-1) arg0) + (let ((a0-5 v1-1) + (a1-2 (+ (-> this length) -2)) + ) + (while (>= a1-2 a0-5) + (set! (-> this vertex a0-5) (-> this vertex (+ a0-5 1))) + (+! a0-5 1) + ) + ) + (+! (-> this length) -1) + ) + ) + (if (< (-> this length) 3) + (editable-method-16 arg1) + ) + ((method-of-type editable editable-method-28) this arg0 arg1) + (none) + ) + +(defmethod copy-into-editable-array! ((this editable-face) (arg0 editable-array)) + (let ((gp-1 (call-parent-method this arg0))) + (dotimes (s4-0 (-> gp-1 length)) + (set! (-> gp-1 vertex s4-0) (the-as editable-point (copy-into-editable-array! (-> gp-1 vertex s4-0) arg0))) + (set! (-> gp-1 vertex s4-0 owner) (cons gp-1 (-> gp-1 vertex s4-0 owner))) + ) + gp-1 + ) + ) + +(defmethod editable-method-26 ((this editable-face)) + (logxor! (-> this flags) (editable-flag orient)) + (editable-face-method-37 this (-> this normal)) + (logior! (-> this flags) (editable-flag changed)) + (set! (-> this region changed) #t) + 0 + (none) + ) + +(defmethod editable-face-method-36 ((this editable-face) (arg0 (inline-array vector))) + (let ((v1-0 (-> this length))) + (cond + ((or (zero? v1-0) (= v1-0 1)) + 0 + ) + ((= v1-0 2) + (let ((s4-0 (editable-method-15 (-> this vertex 0))) + (v1-3 (editable-method-15 (-> this vertex 1))) + ) + (vector-copy! (-> arg0 0) s4-0) + (vector-copy! (-> arg0 1) s4-0) + (set! (-> arg0 1 y) (-> v1-3 y)) + (vector-copy! (-> arg0 2) v1-3) + (set! (-> arg0 2 y) (-> s4-0 y)) + (vector-copy! (-> arg0 3) v1-3) + ) + 4 + ) + (else + (dotimes (s4-1 (-> this length)) + (vector-copy! (-> arg0 s4-1) (editable-method-15 (-> this vertex s4-1))) + ) + (-> this length) + ) + ) + ) + ) + +(defmethod editable-face-method-37 ((this editable-face) (arg0 vector)) + (let ((s4-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-0 6) + (set! (-> s4-0 v1-0 quad) (the-as uint128 0)) + ) + (if (>= (editable-face-method-36 this s4-0) 3) + (normal-of-plane arg0 (-> s4-0 0) (-> s4-0 1) (-> s4-0 2)) + ) + ) + (if (logtest? (-> this flags) (editable-flag orient)) + (vector-negate! arg0 arg0) + ) + arg0 + ) + +(defmethod editable-method-13 ((this editable-face) (arg0 vector)) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (editable-face-method-37 this (new 'stack-no-clear 'vector))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s2-0 (editable-method-15 (-> this vertex 0))) + (transform-point-vector! gp-0 s2-0) + (when (< 0.0 (-> gp-0 z)) + (reverse-transform-point! gp-0 s2-0 s5-0 arg0) + (let ((s3-1 (the-as object (new 'stack-no-clear 'inline-array 'vector 6)))) + (dotimes (v1-5 6) + (set! (-> (the-as (inline-array vector) s3-1) v1-5 quad) (the-as uint128 0)) + ) + (let ((s4-1 (editable-face-method-36 this (the-as (inline-array vector) s3-1))) + (s2-1 0) + (s1-1 (vector-negate! (new 'stack-no-clear 'vector) s5-0)) + ) + (while (< (+ s2-1 2) s4-1) + (if (or (point-in-triangle-cross + gp-0 + s5-0 + (-> (the-as (inline-array vector) s3-1) 0) + (-> (the-as (inline-array vector) s3-1) 1) + (-> (the-as (inline-array vector) s3-1) 2) + ) + (point-in-triangle-cross + gp-0 + s1-1 + (-> (the-as (inline-array vector) s3-1) 0) + (-> (the-as (inline-array vector) s3-1) 1) + (-> (the-as (inline-array vector) s3-1) 2) + ) + ) + (return (vector-vector-distance (camera-pos) gp-0)) + ) + (+! s2-1 1) + (set! s3-1 (-> (the-as (inline-array vector) s3-1) 1)) + ) + ) + ) + ) + ) + -1.0 + ) + +(defmethod editable-method-14 ((this editable-face) (arg0 vector) (arg1 vector)) + (local-vars (sv-560 editable-face) (sv-576 vector)) + (set! sv-560 this) + (let ((s3-0 arg0) + (s4-0 arg1) + (s2-0 (new 'stack-no-clear 'vector)) + (s5-0 (editable-face-method-37 sv-560 (new 'stack-no-clear 'vector))) + (s1-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'inline-array 'vector 4)) + ) + (dotimes (v1-1 4) + (set! (-> gp-0 v1-1 quad) (the-as uint128 0)) + ) + (vector-copy! s1-0 (editable-method-15 (-> sv-560 vertex 0))) + (transform-point-vector! s2-0 s1-0) + (when (< 0.0 (-> s2-0 z)) + (vector-copy! s5-0 (-> *math-camera* inv-camera-rot fvec)) + (let ((t9-3 reverse-transform-point!) + (a0-9 (-> gp-0 0)) + (a1-3 s1-0) + (a2-1 s5-0) + (a3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-0 x) (-> s3-0 x)) + (set! (-> a3-0 y) (-> s3-0 y)) + (set! (-> a3-0 z) 0.0) + (set! (-> a3-0 w) 1.0) + (t9-3 a0-9 a1-3 a2-1 a3-0) + ) + (let ((t9-4 reverse-transform-point!) + (a0-10 (-> gp-0 1)) + (a1-4 s1-0) + (a2-2 s5-0) + (a3-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-1 x) (-> s4-0 x)) + (set! (-> a3-1 y) (-> s3-0 y)) + (set! (-> a3-1 z) 0.0) + (set! (-> a3-1 w) 1.0) + (t9-4 a0-10 a1-4 a2-2 a3-1) + ) + (let ((t9-5 reverse-transform-point!) + (a0-11 (-> gp-0 2)) + (a1-5 s1-0) + (a2-3 s5-0) + (a3-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-2 x) (-> s4-0 x)) + (set! (-> a3-2 y) (-> s4-0 y)) + (set! (-> a3-2 z) 0.0) + (set! (-> a3-2 w) 1.0) + (t9-5 a0-11 a1-5 a2-3 a3-2) + ) + (let ((t9-6 reverse-transform-point!) + (a0-12 (-> gp-0 3)) + (a1-6 s1-0) + (a2-4 s5-0) + (a3-3 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-3 x) (-> s3-0 x)) + (set! (-> a3-3 y) (-> s4-0 y)) + (set! (-> a3-3 z) 0.0) + (set! (-> a3-3 w) 1.0) + (t9-6 a0-12 a1-6 a2-4 a3-3) + ) + (dotimes (s4-1 4) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (transform-point-vector! s3-1 (-> gp-0 s4-1)) + (when (< (-> s3-1 z) 0.0) + ) + ) + ) + (let ((s4-2 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-19 6) + (set! (-> s4-2 v1-19 quad) (the-as uint128 0)) + ) + (let ((s0-1 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-22 6) + (set! (-> s0-1 v1-22 quad) (the-as uint128 0)) + ) + (let ((s3-2 (editable-face-method-36 sv-560 s0-1))) + 0 + (let ((s2-1 (vector-negate! (new 'stack-no-clear 'vector) s5-0))) + (set! sv-576 (new 'stack-no-clear 'vector)) + (let ((f30-0 0.0) + (t9-10 (method-of-object sv-560 editable-face-method-37)) + (a1-10 (new 'stack-no-clear 'vector)) + ) + (when (< f30-0 (vector-dot + (t9-10 sv-560 a1-10) + (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> s0-1 0)) + ) + ) + (vector-copy! s2-1 s5-0) + #t + ) + ) + (vector-copy! sv-576 (-> s0-1 2)) + (vector-copy! (-> s0-1 2) (-> s0-1 3)) + (vector-copy! (-> s0-1 3) sv-576) + (dotimes (v1-40 4) + (vector-! (-> s4-2 v1-40) (-> s0-1 v1-40) s1-0) + (vector+*! (-> s4-2 v1-40) (-> s4-2 v1-40) s5-0 (- (vector-dot s5-0 (-> s4-2 v1-40)))) + (vector+! (-> s4-2 v1-40) (-> s4-2 v1-40) s1-0) + ) + 0 + 0 + (dotimes (v1-45 4) + (let ((a0-39 0)) + (let ((a1-19 0) + (a2-10 (vector-cross! (new 'stack-no-clear 'vector) s5-0 (vector-! + (new 'stack-no-clear 'vector) + (-> gp-0 (if (= v1-45 3) + 0 + (+ v1-45 1) + ) + ) + (-> gp-0 v1-45) + ) + ) + ) + ) + (dotimes (a3-8 s3-2) + (if (< (vector-dot a2-10 (vector-! (new 'stack-no-clear 'vector) (-> s4-2 a3-8) (-> gp-0 v1-45))) 0.0) + (+! a0-39 1) + (+! a1-19 1) + ) + ) + ) + (if (= a0-39 s3-2) + (return -1.0) + ) + ) + ) + (dotimes (v1-48 s3-2) + (let ((a1-22 0) + (a0-41 0) + ) + (let ((a2-12 (vector-cross! (new 'stack-no-clear 'vector) s2-1 (vector-! + (new 'stack-no-clear 'vector) + (-> s4-2 (if (= v1-48 (+ s3-2 -1)) + 0 + (+ v1-48 1) + ) + ) + (-> s4-2 v1-48) + ) + ) + ) + ) + (dotimes (a3-10 4) + (if (< (vector-dot a2-12 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 a3-10) (-> s4-2 v1-48))) 0.0) + (+! a1-22 1) + (+! a0-41 1) + ) + ) + ) + (if (= a0-41 4) + (return -1.0) + ) + ) + ) + ) + ) + ) + ) + (return 1.0) + ) + ) + -1.0 + ) + +;; WARN: Function (method 31 editable-face) has a return type of none, but the expression builder found a return statement. +(defmethod editable-method-31 ((this editable-face) (arg0 editable-flag)) + (local-vars + (sv-208 (inline-array vector)) + (sv-216 int) + (sv-288 (array editable-point)) + (sv-292 int) + (sv-296 int) + (sv-368 matrix) + (sv-372 editable-point) + (sv-376 number) + (sv-380 symbol) + (sv-400 float) + ) + (if (or (logtest? arg0 (editable-flag no-update)) (logtest? (-> this flags) (editable-flag mark))) + (return #f) + ) + (logior! (-> this flags) (editable-flag mark)) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-7 6) + (set! (-> s5-0 v1-7 quad) (the-as uint128 0)) + ) + (let ((s4-0 (editable-face-method-36 this s5-0))) + (when (and (>= s4-0 4) (>= (-> this length) 3)) + (let ((v1-14 0)) + (dotimes (a0-7 s4-0) + (if (logtest? (-> this vertex a0-7 flags) (editable-flag selected)) + (+! v1-14 1) + ) + ) + (cond + ((= v1-14 s4-0) + (set! arg0 (logior arg0 (editable-flag no-plane-snap))) + ) + ((= v1-14 2) + (let ((v1-15 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (a0-12 6) + (set! (-> v1-15 a0-12 quad) (the-as uint128 0)) + ) + (set! sv-208 v1-15) + ) + (set! sv-216 0) + (dotimes (s2-2 s4-0) + (when (not (logtest? (-> this vertex s2-2 flags) (editable-flag selected))) + (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-2))) + (set! sv-216 (+ sv-216 1)) + ) + ) + (dotimes (s2-3 s4-0) + (when (logtest? (-> this vertex s2-3 flags) (editable-flag selected)) + (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-3))) + (set! sv-216 (+ sv-216 1)) + ) + ) + (normal-of-plane (-> this normal) (-> sv-208 0) (-> sv-208 1) (-> sv-208 2)) + (vector-copy! (-> this center) (editable-method-15 this)) + ) + ) + ) + (when (not (logtest? arg0 (editable-flag no-plane-snap))) + (when (= (-> this normal w) 0.0) + (editable-face-method-37 this (-> this normal)) + (vector-copy! (-> this center) (editable-method-15 this)) + ) + (let ((s3-2 0) + (s2-5 (-> this normal)) + (s1-2 (-> this center)) + ) + (while (< s3-2 s4-0) + (when (logtest? (-> this vertex s3-2 flags) (editable-flag selected)) + (let* ((a1-14 (vector-! (new 'stack-no-clear 'vector) (-> s5-0 s3-2) s1-2)) + (f0-2 (vector-dot a1-14 s2-5)) + ) + (editable-method-18 (-> this vertex s3-2) (vector+float*! a1-14 (-> s5-0 s3-2) s2-5 (- f0-2)) 120) + ) + ) + (+! s3-2 1) + ) + ) + ) + (set! sv-288 + (the-as + (array editable-point) + ((method-of-type array new) + (the-as symbol (new 'stack-no-clear 'array 'editable-point 6)) + array + editable-point + 6 + ) + ) + ) + (set! sv-292 (+ (-> this length) -1)) + (set! sv-296 1) + (editable-face-method-37 this (-> this normal)) + (dotimes (v1-85 sv-292) + (set! (-> sv-288 v1-85) (-> this vertex (+ v1-85 1))) + ) + (set! sv-368 (new-stack-matrix0)) + (set! sv-372 (the-as editable-point #f)) + (set! sv-376 0.0) + (set! sv-380 #t) + (vector-normalize! + (vector-! (-> sv-368 fvec) (editable-method-15 this) (editable-method-15 (-> this vertex 0))) + 1.0 + ) + (vector-normalize! (editable-face-method-37 this (-> sv-368 uvec)) 1.0) + (vector-normalize! (vector-cross! (-> sv-368 rvec) (-> sv-368 fvec) (-> sv-368 uvec)) 1.0) + (vector-copy! (-> sv-368 trans) (editable-method-15 (-> this vertex 0))) + (set! (-> sv-368 trans w) 1.0) + (matrix-4x4-inverse! sv-368 sv-368) + (while (< sv-296 (-> this length)) + (set! sv-372 (the-as editable-point #f)) + (dotimes (s5-4 sv-292) + (when (-> sv-288 s5-4) + (let* ((a1-27 (editable-method-15 (-> sv-288 s5-4))) + (a0-48 (vector-matrix*! (new 'stack-no-clear 'vector) a1-27 sv-368)) + ) + (set! sv-400 (vector-y-angle a0-48)) + ) + (cond + (sv-380 + (when (or (not sv-372) (< (the-as float sv-376) sv-400)) + (set! sv-372 (-> sv-288 s5-4)) + (set! sv-376 sv-400) + ) + ) + (else + (when (or (not sv-372) (< sv-400 (the-as float sv-376))) + (set! sv-372 (-> sv-288 s5-4)) + (set! sv-376 sv-400) + ) + ) + ) + ) + ) + (set! (-> this vertex sv-296) sv-372) + (dotimes (v1-131 sv-292) + (if (= sv-372 (-> sv-288 v1-131)) + (set! (-> sv-288 v1-131) #f) + ) + ) + (set! sv-296 (+ sv-296 1)) + (set! sv-380 (not sv-380)) + ) + (if (< (vector-dot (-> this normal) (editable-face-method-37 this (new 'stack-no-clear 'vector))) 0.0) + (logxor! (-> this flags) (editable-flag orient)) + ) + ) + ) + ) + (editable-face-method-37 this (-> this normal)) + (vector-copy! (-> this center) (editable-method-15 this)) + 0 + (none) + ) + +(defmethod editable-method-10 ((this editable-face)) + (local-vars (sv-112 int)) + (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-0 6) + (set! (-> gp-0 v1-0 quad) (the-as uint128 0)) + ) + (set! sv-112 (editable-face-method-36 this gp-0)) + (when (>= sv-112 3) + (let ((s1-0 (editable-face-method-37 this (new 'stack-no-clear 'vector)))) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 this) + s1-0 + (meters 2) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ) + (let ((t1-1 (if (logtest? (-> this flags) (editable-flag selected)) + 1 + 0 + ) + ) + ) + (if (or (= t1-1 1) (not (-> *editable-work* hide))) + (add-debug-bound + (bucket-id debug) + gp-0 + sv-112 + (if (logtest? (-> this flags) (editable-flag orient)) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + (if (not (logtest? (-> this flags) (editable-flag orient))) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + t1-1 + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod editable-method-15 ((this editable-plane)) + (if (>= (-> this length) 1) + (editable-method-15 (-> this vertex 0)) + *null-vector* + ) + ) + +(defmethod editable-method-24 ((this editable-plane) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (clear *temp-string*))) + (format + s4-0 + "insert into region_face set kind='plane',region_id=~D,radius=~f" + (-> this region id) + (-> this radius) + ) + (let ((a0-4 (sql-query s4-0))) + (if (!= (-> a0-4 content-type) 'modify) + (return #f) + ) + ) + ) + (dotimes (s4-1 (-> this length)) + (editable-method-24 (-> this vertex s4-1) arg0 2 s4-1) + ) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + +(defmethod delete! ((this editable-plane) (arg0 editable)) + (dotimes (s4-0 (-> this length)) + (let ((s3-0 (-> this vertex s4-0))) + (set! (-> s3-0 owner) (delete! this (-> s3-0 owner))) + ) + ) + (call-parent-method this arg0) + (none) + ) + +(defmethod editable-method-28 ((this editable-plane) (arg0 editable) (arg1 editable)) + (editable-method-16 arg1) + ((method-of-type editable editable-method-28) this arg0 arg1) + (none) + ) + +(defmethod copy-into-editable-array! ((this editable-plane) (arg0 editable-array)) + (let ((gp-1 (call-parent-method this arg0))) + (dotimes (s4-0 (-> gp-1 length)) + (set! (-> gp-1 vertex s4-0) (the-as editable-point (copy-into-editable-array! (-> gp-1 vertex s4-0) arg0))) + (set! (-> gp-1 vertex s4-0 owner) (cons gp-1 (-> gp-1 vertex s4-0 owner))) + ) + gp-1 + ) + ) + +(defmethod editable-method-26 ((this editable-plane)) + (let ((s5-1 (vector-! + (new 'stack-no-clear 'vector) + (editable-method-15 (-> this vertex 1)) + (editable-method-15 (-> this vertex 0)) + ) + ) + ) + (editable-method-18 (-> this vertex 1) (vector-! s5-1 (editable-method-15 (-> this vertex 0)) s5-1) 56) + ) + (set! (-> this region changed) #t) + (logior! (-> this flags) (editable-flag changed)) + 0 + (none) + ) + +(defmethod editable-plane-method-36 ((this editable-plane) (arg0 (inline-array vector))) + (case (-> this length) + ((2) + (let* ((v1-2 (editable-plane-method-37 this (new 'stack-no-clear 'vector))) + (s5-1 (vector-cross! + (new 'stack-no-clear 'vector) + v1-2 + (if (< 0.7 (fabs (vector-dot v1-2 (new 'static 'vector :z 1.0 :w 1.0)))) + (new 'static 'vector :x 1.0 :w 1.0) + (new 'static 'vector :z 1.0 :w 1.0) + ) + ) + ) + (s4-1 (vector-cross! (new 'stack-no-clear 'vector) s5-1 v1-2)) + (f30-0 (-> this radius)) + ) + (let ((v1-4 (editable-method-15 (-> this vertex 0)))) + (vector+float*! (-> arg0 0) v1-4 s5-1 (the-as float f30-0)) + (vector+float*! (-> arg0 0) (-> arg0 0) s4-1 (- f30-0)) + (vector+float*! (-> arg0 1) v1-4 s5-1 (- f30-0)) + (vector+float*! (-> arg0 1) (-> arg0 1) s4-1 (- f30-0)) + (vector+float*! (-> arg0 2) v1-4 s5-1 (the-as float f30-0)) + (vector+float*! (-> arg0 2) (-> arg0 2) s4-1 (the-as float f30-0)) + (vector+float*! (-> arg0 3) v1-4 s5-1 (- f30-0)) + ) + (vector+float*! (-> arg0 3) (-> arg0 3) s4-1 (the-as float f30-0)) + ) + 4 + ) + (else + 0 + ) + ) + ) + +(defmethod editable-plane-method-37 ((this editable-plane) (arg0 vector)) + (case (-> this length) + ((2) + (let ((s3-0 (-> this vertex 0)) + (a0-1 (-> this vertex 1)) + ) + (vector-! arg0 (editable-method-15 a0-1) (editable-method-15 s3-0)) + ) + (vector-normalize! arg0 1.0) + ) + ) + arg0 + ) + +(defmethod editable-method-13 ((this editable-plane) (arg0 vector)) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (editable-plane-method-37 this (new 'stack-no-clear 'vector))) + ) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (vector-copy! s1-0 (editable-method-15 (-> this vertex 0))) + (transform-point-vector! gp-0 s1-0) + ) + (when (< 0.0 (-> gp-0 z)) + (reverse-transform-point! gp-0 (editable-method-15 (-> this vertex 0)) s5-0 arg0) + (let ((s3-1 (the-as object (new 'stack-no-clear 'inline-array 'vector 4)))) + (dotimes (v1-6 4) + (set! (-> (the-as (inline-array vector) s3-1) v1-6 quad) (the-as uint128 0)) + ) + (let ((s4-1 (editable-plane-method-36 this (the-as (inline-array vector) s3-1))) + (s2-2 0) + (s1-2 (vector-negate! (new 'stack-no-clear 'vector) s5-0)) + ) + (while (< (+ s2-2 2) s4-1) + (if (or (point-in-triangle-cross + gp-0 + s5-0 + (-> (the-as (inline-array vector) s3-1) 0) + (-> (the-as (inline-array vector) s3-1) 1) + (-> (the-as (inline-array vector) s3-1) 2) + ) + (point-in-triangle-cross + gp-0 + s1-2 + (-> (the-as (inline-array vector) s3-1) 0) + (-> (the-as (inline-array vector) s3-1) 1) + (-> (the-as (inline-array vector) s3-1) 2) + ) + ) + (return (vector-vector-distance (camera-pos) gp-0)) + ) + (+! s2-2 1) + (set! s3-1 (-> (the-as (inline-array vector) s3-1) 1)) + ) + ) + ) + ) + ) + -1.0 + ) + +(defmethod editable-method-10 ((this editable-plane)) + (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (v1-0 4) + (set! (-> gp-0 v1-0 quad) (the-as uint128 0)) + ) + (let ((s4-0 (editable-plane-method-36 this gp-0))) + (when (>= s4-0 3) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 (-> this vertex 0)) + (editable-method-15 (-> this vertex 1)) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + #f + (the-as rgba -1) + ) + (let ((t1-1 (if (logtest? (-> this flags) (editable-flag selected)) + 1 + 0 + ) + ) + ) + (if (or (= t1-1 1) (not (-> *editable-work* hide))) + (add-debug-bound + (bucket-id debug) + gp-0 + s4-0 + (if (logtest? (-> this flags) (editable-flag orient)) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + (if (not (logtest? (-> this flags) (editable-flag orient))) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + t1-1 + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod editable-method-19 ((this editable-plane) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> this radius) (-> arg0 x)) + (set! (-> this radius) (-> arg0 y)) + ) + (if (< (-> this radius) 0.0) + (set! (-> this radius) 0.0) + ) + (editable-method-30 this (editable-flag no-plane-snap)) + 0 + (none) + ) + +;; WARN: Return type mismatch (array editable) vs editable-array. +(defmethod relocate ((this editable-array) (offset int)) + (the-as editable-array (when (nonzero? (-> this selection)) + (let ((v0-0 (&+ (-> this selection) offset))) + (set! (-> this selection) v0-0) + v0-0 + ) + ) + ) + ) + +(defmethod length ((this editable-array)) + (-> this length) + ) + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this editable-array)) + (the-as int (+ (-> this type size) (* (-> this allocated-length) 4))) + ) + +(defmethod get-length ((this editable-array)) + (dotimes (v1-0 (-> this length)) + (if (not (-> this data v1-0)) + (return v1-0) + ) + ) + (when (< (-> this length) (-> this allocated-length)) + (+! (-> this length) 1) + (return (+ (-> this length) -1)) + ) + -1 + ) + +(defmethod editable-array-method-10 ((this editable-array) (arg0 vector) (arg1 int)) + (when (or (!= (-> arg0 x) (-> *editable-work* last-x)) (!= (-> arg0 y) (-> *editable-work* last-y))) + (set! (-> *editable-work* last-found) 0) + (set! (-> *editable-work* last-x) (-> arg0 x)) + (set! (-> *editable-work* last-y) (-> arg0 y)) + ) + 4095996000.0 + (let ((s5-0 (the-as editable #f))) + (set! (-> *editable-work* num-found) 0) + (let* ((s2-0 (-> this length)) + (s1-0 0) + (s0-0 (-> this data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (or (and (logtest? (-> s0-0 region filter) (-> this filter 0)) + (logtest? (-> s0-0 region filter) (-> this filter 1)) + ) + (logtest? (-> s0-0 flags) (editable-flag selected)) + ) + ) + (let ((f0-5 (editable-method-13 s0-0 arg0))) + (when (>= f0-5 0.0) + (set! (-> *editable-work* found (-> *editable-work* num-found)) s0-0) + (set! (-> *editable-work* dists (-> *editable-work* num-found)) (the-as uint f0-5)) + (if (< (-> *editable-work* num-found) 255) + (+! (-> *editable-work* num-found) 1) + ) + ) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> this data s1-0)) + ) + ) + (countdown (v1-43 (-> *editable-work* num-found)) + (when (> v1-43 0) + (countdown (a0-12 v1-43) + (when (< (the-as float (-> *editable-work* dists v1-43)) (the-as float (-> *editable-work* dists a0-12))) + (let ((a1-10 (-> *editable-work* found v1-43)) + (f0-7 (-> *editable-work* dists v1-43)) + ) + (set! (-> *editable-work* found v1-43) (-> *editable-work* found a0-12)) + (set! (-> *editable-work* dists v1-43) (-> *editable-work* dists a0-12)) + (set! (-> *editable-work* found a0-12) a1-10) + (set! (-> *editable-work* dists a0-12) f0-7) + ) + ) + ) + ) + ) + (when (nonzero? (-> *editable-work* num-found)) + (when (>= (-> *editable-work* last-found) (-> *editable-work* num-found)) + (set! (-> *editable-work* last-found) 0) + 0 + ) + (set! s5-0 (cond + ((zero? arg1) + (set! s5-0 (-> *editable-work* found (-> *editable-work* last-found))) + (+! (-> *editable-work* last-found) 1) + s5-0 + ) + (else + (-> *editable-work* found 0) + ) + ) + ) + ) + s5-0 + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod editable-array-method-11 ((this editable-array) (arg0 vector) (arg1 vector) (arg2 int)) + (let* ((s2-0 (-> this length)) + (s1-0 0) + (s0-0 (-> this data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (or (and (logtest? (-> s0-0 region filter) (-> this filter 0)) + (logtest? (-> s0-0 region filter) (-> this filter 1)) + ) + (logtest? (-> s0-0 flags) (editable-flag selected)) + ) + ) + (when (>= (editable-method-14 s0-0 arg0 arg1) 0.0) + (let ((v1-13 arg2)) + (cond + ((zero? v1-13) + (set-selected! s0-0 #t) + ) + ((= v1-13 2) + (set-selected! s0-0 #f) + ) + ((= v1-13 1) + (set-selected! s0-0 'toggle) + ) + ) + ) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> this data s1-0)) + ) + ) + (none) + ) + +(defmethod editable-array-method-15 ((this editable-array) (arg0 (function editable editable-region symbol)) (arg1 editable-region)) + (let ((gp-0 (-> this selection))) + (set! (-> gp-0 length) 0) + (let* ((s2-0 (-> this length)) + (s1-0 0) + (s0-0 (-> this data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (logtest? (-> s0-0 flags) (editable-flag selected))) + (when (arg0 s0-0 arg1) + (set! (-> gp-0 (-> gp-0 length)) s0-0) + (+! (-> gp-0 length) 1) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> this data s1-0)) + ) + ) + gp-0 + ) + ) + +(defmethod editable-array-method-16 ((this editable-array) (arg0 editable)) + (let ((gp-0 (-> arg0 region))) + (when gp-0 + (delete! arg0 (the-as editable this)) + (let* ((v1-3 (-> this length)) + (a0-2 0) + (a1-4 (-> this data a0-2)) + ) + (while (< a0-2 v1-3) + (if (and a1-4 (= arg0 a1-4)) + (set! (-> this data a0-2) #f) + ) + (+! a0-2 1) + (set! a1-4 (-> this data a0-2)) + ) + ) + (let* ((v1-6 (-> this length)) + (a0-3 0) + (a1-14 (-> this data a0-3)) + ) + (while (< a0-3 v1-6) + (if (and a1-14 (= (-> a1-14 region) gp-0) (!= a1-14 arg0)) + (goto cfg-21) + ) + (+! a0-3 1) + (set! a1-14 (-> this data a0-3)) + ) + ) + (editable-region-method-10 gp-0 0) + ) + ) + (label cfg-21) + 0 + (none) + ) + +(defun load-editable-lights ((arg0 editable-array)) + (local-vars (sv-16 sql-result)) + (let ((s5-0 sql-query)) + (format + (clear *temp-string*) + "select light_id,name,pos_x,pos_y,pos_z,r,dir_x,dir_y,dir_z,color0_r,color0_g,color0_b,color0_a,decay_start,ambient_point_ratio,brightness,shadow_ambi,shadow_dir_0,shadow_dir_1,shadow_dir_2,shadow_dir_3 from light where level_name='~S'" + (-> arg0 level) + ) + (set! sv-16 (s5-0 *temp-string*)) + ) + (format #t "sql: read light ~D~%" (/ (-> sv-16 length) 16)) + (if (!= (-> sv-16 content-type) 'select) + (return #f) + ) + (let ((s5-1 0)) + (while (< s5-1 (-> sv-16 length)) + (let ((s3-0 (get-length arg0))) + (when (>= s3-0 0) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 2)))))) + (set! (-> s4-1 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 3)))))) + (set! (-> s4-1 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 4)))))) + (set! (-> s4-1 w) 1.0) + (vector+! s4-1 s4-1 (-> arg0 level-offset)) + (let ((s4-2 (new 'debug 'editable-light s4-1 2048.0 *editable-light-region*))) + (set! (-> arg0 data s3-0) s4-2) + (set! (-> s4-2 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s5-1))))) + (set! (-> s4-2 name) (the-as string (-> sv-16 sql-data (+ s5-1 1)))) + (set! (-> s4-2 radius) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 5)))))) + (set-vector! + (-> s4-2 direction) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 6)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 7)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 8)))) + 1.0 + ) + (set-vector! + (-> s4-2 color) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 9)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 10)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 11)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 12)))) + ) + (if (or (= (-> s4-2 color w) -2.0) + (and (= (-> s4-2 direction x) 0.0) (= (-> s4-2 direction y) 0.0) (= (-> s4-2 direction z) 0.0)) + ) + (set! (-> s4-2 direction w) 0.0) + ) + (set! (-> s4-2 decay-start) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 13))))) + (set! (-> s4-2 ambient-point-ratio) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 14))))) + (set! (-> s4-2 brightness) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 15))))) + (set! (-> s4-2 shadow-ambi) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 16)))))) + ) + (set! (-> s4-2 shadow-dir0) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 17)))))) + ) + (set! (-> s4-2 shadow-dir1) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 18)))))) + ) + (set! (-> s4-2 shadow-dir2) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 19)))))) + ) + (set! (-> s4-2 shadow-dir3) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 20)))))) + ) + (let ((a0-51 0) + (v1-92 0) + ) + (let ((a1-5 (-> s4-2 shadows))) + (dotimes (a2-3 5) + (when (!= (-> a1-5 a2-3) 1.0) + (set! a0-51 (logior a0-51 (ash 1 a2-3))) + (set! v1-92 (logior v1-92 (ash (logand (the int (* 16.0 (-> a1-5 a2-3))) 15) (* a2-3 4)))) + ) + ) + ) + (set! (-> s4-2 direction x) + (the-as + float + (logior (logand (the-as uint (-> s4-2 direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a0-51 56) 32)) + ) + ) + (set! (-> s4-2 direction x) + (the-as float (logior (logand (the-as int (-> s4-2 direction x)) -16777216) (shr (shl v1-92 40) 40))) + ) + ) + ) + ) + ) + ) + (+! s5-1 21) + ) + ) + (set! (-> *editable-light-region* changed) #f) + #f + ) + +(defmethod editable-array-method-13 ((this editable-array) (arg0 symbol)) + (local-vars + (sv-16 sql-result) + (sv-20 sql-result) + (sv-24 sql-result) + (sv-28 sql-result) + (sv-32 sql-result) + (sv-36 editable-region) + (sv-40 number) + (sv-44 number) + (sv-64 int) + (sv-72 int) + (sv-80 editable-plane) + (sv-84 string) + (sv-112 vector) + (sv-120 int) + (sv-128 editable-point) + (sv-136 int) + (sv-144 int) + (sv-152 editable-face) + (sv-156 object) + (sv-176 vector) + (sv-180 editable) + (sv-184 int) + (sv-192 int) + (sv-200 editable-point) + (sv-208 int) + (sv-216 sql-result) + ) + (format #t "sql: load from level ~A~%" arg0) + (set! (-> *editable-sample-region* level) (the-as string arg0)) + (set! (-> *editable-light-region* level) (the-as string arg0)) + (set! (-> *editable-entity-region* level) (the-as string arg0)) + (vector-reset! (-> this level-offset)) + (set! (-> this level-info-id) (the-as uint -1)) + (set! (-> this level) (the-as uint arg0)) + (let ((s4-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" + arg0 + ) + (set! sv-16 (s4-0 *temp-string*)) + ) + (when (and (= (-> sv-16 content-type) 'select) (>= (-> sv-16 length) 3)) + (set-vector! + (-> this level-offset) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) + 1.0 + ) + (set! (-> this level-info-id) (the-as uint (string->int (the-as string (-> sv-16 sql-data 3))))) + ) + (let ((s4-2 sql-query)) + (format + (clear *temp-string*) + "select region_id,level_name,tree,on_enter,on_exit,on_inside from region where level_name='~S'" + arg0 + ) + (set! sv-20 (s4-2 *temp-string*)) + ) + (if (!= (-> sv-20 content-type) 'select) + (return #f) + ) + (format #t "sql: read region ~D~%" (/ (-> sv-20 length) 6)) + (let ((s4-3 sql-query)) + (format + (clear *temp-string*) + "select region_face.region_id,region_face_id,kind,flags,radius from region,region_face where level_name='~S' and region.region_id=region_face.region_id" + arg0 + ) + (set! sv-24 (s4-3 *temp-string*)) + ) + (if (!= (-> sv-24 content-type) 'select) + (return #f) + ) + (format #t "sql: read face ~D~%" (/ (-> sv-24 length) 5)) + (let ((s4-4 sql-query)) + (format + (clear *temp-string*) + "select region_face.region_face_id,idx,x,y,z from region,region_face,region_point where level_name='~S' and region.region_id=region_face.region_id and region_face.region_face_id=region_point.region_face_id" + arg0 + ) + (set! sv-28 (s4-4 *temp-string*)) + ) + (if (!= (-> sv-28 content-type) 'select) + (return #f) + ) + (format #t "sql: read point ~D~%" (/ (-> sv-28 length) 5)) + (let ((s4-5 sql-query)) + (format + (clear *temp-string*) + "select region_sphere.region_id,x,y,z,r from region,region_sphere where level_name='~S' and region.region_id=region_sphere.region_id" + arg0 + ) + (set! sv-32 (s4-5 *temp-string*)) + ) + (if (!= (-> sv-32 content-type) 'select) + (return #f) + ) + (format #t "sql: read sphere ~D~%" (/ (-> sv-32 length) 5)) + (let ((s4-6 0)) + (while (< s4-6 (-> sv-20 length)) + (set! sv-36 (new 'debug 'editable-region)) + (set! sv-40 4095996000.0) + (set! sv-44 -4095996000.0) + (set! (-> sv-36 id) (the-as uint (string->int (the-as string (-> sv-20 sql-data s4-6))))) + (set! (-> sv-36 level) (the-as string (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 1)))))) + (set! (-> sv-36 tree) (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 2))))) + (set! (-> sv-36 on-enter) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 3))) "") + #f + (-> sv-20 sql-data (+ s4-6 3)) + ) + ) + ) + (set! (-> sv-36 on-exit) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 4))) "") + #f + (-> sv-20 sql-data (+ s4-6 4)) + ) + ) + ) + (set! (-> sv-36 on-inside) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 5))) "") + #f + (-> sv-20 sql-data (+ s4-6 5)) + ) + ) + ) + (let* ((v1-75 (-> this length)) + (a0-54 0) + (a1-17 (-> this data a0-54)) + ) + (while (< a0-54 v1-75) + (if (and a1-17 (-> a1-17 region) (= (-> a1-17 region id) (-> sv-36 id))) + (set! (-> this data a0-54) #f) + ) + (+! a0-54 1) + (set! a1-17 (-> this data a0-54)) + ) + ) + (let ((s3-5 0)) + (while (< s3-5 (-> sv-32 length)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-32 sql-data s3-5)))) + (let ((s2-0 (get-length this))) + (when (>= s2-0 0) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 x) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 1))))) + (set! (-> s1-1 y) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 2))))) + (set! (-> s1-1 z) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 3))))) + (set! (-> s1-1 w) 1.0) + (vector+! s1-1 s1-1 (-> this level-offset)) + (let ((s1-2 (new 'debug 'editable-sphere s1-1 2048.0 sv-36))) + (set! (-> s1-2 radius) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 4))))) + (set! (-> this data s2-0) s1-2) + ) + ) + ) + ) + ) + (+! s3-5 5) + ) + ) + (set! sv-64 0) + (while (< sv-64 (-> sv-24 length)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-24 sql-data sv-64)))) + (cond + ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "plane") + (set! sv-72 (get-length this)) + (set! sv-80 (new 'debug 'editable-plane sv-36)) + (set! sv-84 (the-as string (-> sv-24 sql-data (+ sv-64 1)))) + (when (>= sv-72 0) + (set! (-> this data sv-72) sv-80) + (set! (-> sv-80 radius) (string->float (the-as string (-> sv-24 sql-data (+ sv-64 4))))) + (countdown (s3-6 (/ (-> sv-28 length) 5)) + (when (string= (the-as string (-> (the-as sql-result (+ (* 20 s3-6) (the-as int sv-28))) sql-data 0)) sv-84) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 2))))) + (set! (-> s2-1 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 3))))) + (set! (-> s2-1 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 4))))) + (set! (-> s2-1 w) 1.0) + (set! sv-112 s2-1) + ) + (vector+! sv-112 sv-112 (-> this level-offset)) + (set! sv-120 (get-length this)) + (when (>= sv-120 0) + (set! sv-128 (new 'debug 'editable-point sv-112 sv-36)) + (set! sv-136 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 1))))) + (set! (-> this data sv-120) sv-128) + (set! (-> sv-80 vertex sv-136) sv-128) + (set! (-> sv-80 length) (max (-> sv-80 length) (+ sv-136 1))) + (set! (-> sv-128 owner) (cons sv-80 (-> sv-128 owner))) + ) + ) + ) + (editable-method-30 sv-80 (editable-flag no-plane-snap)) + (editable-method-31 sv-80 (editable-flag no-plane-snap)) + ) + ) + ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "face") + (set! sv-144 (get-length this)) + (set! sv-152 (new 'debug 'editable-face sv-36)) + (set! sv-156 (-> sv-24 sql-data (+ sv-64 1))) + (when (>= sv-144 0) + (set! (-> this data sv-144) sv-152) + (if (string= (the-as string (-> sv-24 sql-data (+ sv-64 3))) "orient") + (logior! (-> sv-152 flags) (editable-flag orient)) + ) + (let ((s3-7 (/ (-> sv-28 length) 5))) + (while (begin (label cfg-78) (nonzero? s3-7)) + (+! s3-7 -1) + (when (string= + (the-as string (-> (the-as sql-result (+ (* 20 s3-7) (the-as int sv-28))) sql-data 0)) + (the-as string sv-156) + ) + (let ((s2-2 (new 'stack-no-clear 'vector))) + (set! (-> s2-2 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 2))))) + (set! (-> s2-2 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 3))))) + (set! (-> s2-2 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 4))))) + (set! (-> s2-2 w) 1.0) + (set! sv-176 s2-2) + ) + (vector+! sv-176 sv-176 (-> this level-offset)) + (let* ((s2-3 (-> this length)) + (s1-3 0) + (s0-0 (-> this data s1-3)) + ) + (while (< s1-3 s2-3) + (when (and s0-0 (= (-> s0-0 region) sv-36) (type? s0-0 editable-point)) + (when (vector= (the-as vector (&+ s0-0 28)) sv-176) + (set! sv-180 s0-0) + (set! sv-184 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 1))))) + (set! (-> sv-152 vertex sv-184) (the-as editable-point sv-180)) + (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-184 1))) + (set! (-> sv-180 owner) (cons sv-152 (-> sv-180 owner))) + (goto cfg-78) + ) + ) + (+! s1-3 1) + (set! s0-0 (-> this data s1-3)) + ) + ) + (if (< (-> sv-176 y) (the-as float sv-40)) + (set! sv-40 (-> sv-176 y)) + ) + (if (< (the-as float sv-44) (-> sv-176 y)) + (set! sv-44 (-> sv-176 y)) + ) + (set! sv-192 (get-length this)) + (when (>= sv-192 0) + (set! sv-200 (new 'debug 'editable-point sv-176 sv-36)) + (set! sv-208 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 1))))) + (set! (-> this data sv-192) sv-200) + (set! (-> sv-152 vertex sv-208) sv-200) + (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-208 1))) + (set! (-> sv-200 owner) (cons sv-152 (-> sv-200 owner))) + ) + ) + ) + ) + (editable-method-30 sv-152 (editable-flag no-plane-snap)) + (editable-method-31 sv-152 (editable-flag no-plane-snap)) + ) + ) + ) + ) + (set! sv-64 (+ sv-64 5)) + ) + (let* ((v1-291 (-> this length)) + (a0-158 0) + (a1-57 (-> this data a0-158)) + ) + (while (< a0-158 v1-291) + (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) + (let ((a2-29 (&+ a1-57 28))) + (if (= (the-as float (-> a2-29 name)) (the-as float sv-40)) + (logior! (-> a1-57 flags) (editable-flag bot-set)) + ) + (if (= (the-as float (-> a2-29 name)) (the-as float sv-44)) + (logior! (-> a1-57 flags) (editable-flag top-set)) + ) + ) + ) + (+! a0-158 1) + (set! a1-57 (-> this data a0-158)) + ) + ) + (set! (-> sv-36 changed) #f) + (+! s4-6 6) + ) + ) + (let ((s4-7 sql-query)) + (format + (clear *temp-string*) + "select x,y,z from sample_point where level_info_id='~D' and source='manual'" + (-> this level-info-id) + ) + (set! sv-216 (s4-7 *temp-string*)) + ) + (if (!= (-> sv-216 content-type) 'select) + (return #f) + ) + (let ((s4-8 0)) + (while (< s4-8 (-> sv-216 length)) + (let ((s3-9 (get-length this))) + (when (>= s3-9 0) + (let ((s2-4 (new 'stack-no-clear 'vector))) + (set! (-> s2-4 x) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data s4-8))))) + (set! (-> s2-4 y) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 1)))))) + (set! (-> s2-4 z) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 2)))))) + (set! (-> s2-4 w) 1.0) + (vector+! s2-4 s2-4 (-> this level-offset)) + (set! (-> this data s3-9) (new 'debug 'editable-sample s2-4 *editable-sample-region*)) + ) + ) + ) + (+! s4-8 3) + ) + ) + (set! (-> *editable-sample-region* changed) #f) + (load-editable-lights this) + (editable-array-method-19 this (the-as string arg0)) + (handle-cmd this (editable-command refresh-filter) (the-as mouse-info #f) #f) + #t + ) + +(defmethod editable-array-method-19 ((this editable-array) (arg0 string)) + (local-vars (sv-16 sql-result)) + (let ((s4-0 sql-query)) + (format + (clear *temp-string*) + "select entity_id,name,idx,position_x,position_y,position_z,rot_x,rot_y,rot_z from entity where level_id=~D and path like 'region-editor-%'" + (-> this level-info-id) + ) + (set! sv-16 (s4-0 *temp-string*)) + ) + (format #t "sql: read entity ~D~%" (/ (-> sv-16 length) 9)) + (if (!= (-> sv-16 content-type) 'select) + (return #f) + ) + (let ((s4-1 0)) + (while (< s4-1 (-> sv-16 length)) + (let ((s3-1 (get-length this))) + (when (>= s3-1 0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s2-0 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 3)))))) + (set! (-> s2-0 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 4)))))) + (set! (-> s2-0 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 5)))))) + (set! (-> s2-0 w) 1.0) + (vector+! s2-0 s2-0 (-> this level-offset)) + (let ((s1-0 (new 'debug 'editable-region))) + (let ((v1-22 s1-0)) + (set! (-> v1-22 locked) #t) + (set! (-> v1-22 changed) #f) + (set! (-> v1-22 tree) 'entity) + (set! (-> v1-22 filter) (editable-filter entity)) + (set! (-> v1-22 level) arg0) + ) + (let ((s2-1 (new 'debug 'editable-entity s2-0 6144.0 s1-0))) + (logclear! (-> s2-1 flags) (editable-flag changed)) + (set! (-> s1-0 changed) #f) + (set! (-> this data s3-1) s2-1) + (set! (-> s2-1 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s4-1))))) + (copy-string<-string (-> s2-1 name) (the-as string (-> sv-16 sql-data (+ s4-1 1)))) + (set! (-> s2-1 idx) (string->int (the-as string (-> sv-16 sql-data (+ s4-1 2))))) + (set-eul! + (-> s2-1 angles) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 6))))) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 7))))) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 8))))) + 21 + ) + ) + ) + ) + ) + ) + (+! s4-1 9) + ) + ) + (set! (-> *editable-entity-region* changed) #f) + #f + ) + +(defmethod editable-array-method-14 ((this editable-array) (arg0 editable-command) (arg1 editable-command) (arg2 string)) + (set! (-> this target) #f) + (set! (-> this target-mode) arg0) + (set! (-> this target-command) arg1) + (set! (-> this target-message) arg2) + 0 + (none) + ) + +(defmethod editable-array-method-17 ((this editable-array)) + (cond + ((-> this edit-plane) + (editable-plane-method-37 (-> this edit-plane) (-> this edit-plane-normal)) + (vector-copy! (-> this edit-plane-center) (editable-method-15 (-> this edit-plane vertex 0))) + ) + (else + (vector-negate! (-> this edit-plane-normal) (-> *math-camera* inv-camera-rot fvec)) + (let ((v1-9 (vector-float*! (-> this edit-plane-center) (-> *math-camera* inv-camera-rot fvec) 24576.0))) + (vector+! v1-9 v1-9 (-> *math-camera* trans)) + ) + ) + ) + 0 + (none) + ) + +(defmethod editable-array-method-18 ((this editable-array) (arg0 vector) (arg1 vector)) + (cond + ((and (cpad-hold? 0 up) *target*) + (vector-copy! arg0 (get-trans *target* 0)) + ) + ((and (cpad-hold? 0 down) *camera*) + (vector-copy! arg0 (math-camera-pos)) + ) + (else + (editable-array-method-17 this) + (reverse-transform-point! arg0 (-> this edit-plane-center) (-> this edit-plane-normal) arg1) + ) + ) + arg0 + ) + +(when (zero? *editable-sample-region*) + (let ((v1-6 (new 'debug 'editable-region))) + (set! (-> v1-6 locked) #t) + (set! (-> v1-6 changed) #f) + (set! (-> v1-6 tree) 'sample) + (set! (-> v1-6 filter) (editable-filter sample)) + (set! *editable-sample-region* v1-6) + ) + (let ((v1-8 (new 'debug 'editable-region))) + (set! (-> v1-8 locked) #t) + (set! (-> v1-8 changed) #f) + (set! (-> v1-8 tree) 'light) + (set! (-> v1-8 filter) (editable-filter light)) + (set! *editable-light-region* v1-8) + ) + (let ((v0-108 (new 'debug 'editable-region))) + (set! (-> v0-108 locked) #t) + (set! (-> v0-108 changed) #f) + (set! (-> v0-108 tree) 'entity) + (set! (-> v0-108 filter) (editable-filter entity)) + (set! *editable-entity-region* v0-108) + ) + ) diff --git a/goal_src/jak3/engine/debug/manipulator.gc b/goal_src/jak3/engine/debug/manipulator.gc index 65648cf007..7eb369c97d 100644 --- a/goal_src/jak3/engine/debug/manipulator.gc +++ b/goal_src/jak3/engine/debug/manipulator.gc @@ -25,6 +25,7 @@ :type uint32 (mm0 0) (mm1 1) + (mm2 2) ) ;; ---manipulator-mode @@ -48,7 +49,7 @@ ) (:methods (set-mode (_type_ manipulator-mode) none) - (manipulator-method-10 (_type_) none) + (manipulator-method-10 (_type_ vector vector) none) (manipulator-method-11 (_type_) none) (manipulator-method-12 (_type_ vector) none) (manipulator-method-13 (_type_ vector vector) none) @@ -167,7 +168,129 @@ (none) ) -;; ERROR: function was not converted to expressions. Cannot decompile. +(defmethod manipulator-method-10 ((this manipulator) (arg0 vector) (arg1 vector)) + (local-vars (v1-11 symbol) (sv-160 symbol) (sv-176 vector)) + (set! sv-176 arg1) + (let ((s4-0 (-> this position))) + 0.0 + (let* ((v0-0 + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> this position)) 1.0) + ) + (s3-0 (< (fabs (vector-dot v0-0 (-> this mat rvec))) 0.9)) + (s2-0 (< (fabs (vector-dot v0-0 (-> this mat uvec))) 0.9)) + ) + (b! (< (fabs (vector-dot v0-0 (-> this mat fvec))) 0.9) cfg-6 :delay (set! v1-11 #t)) + (set! sv-160 v1-11) + (set! sv-160 #f) + (label cfg-6) + (let ((f28-0 (the-as float #x7f800000)) + (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s4-0))) + ) + (set! (-> this action) (manipulator-action ma0)) + (let ((s1-0 (new 'stack-no-clear 'vector))) + 0.0 + (let* ((s0-0 (new 'stack-no-clear 'vector)) + (v1-16 arg0) + (s0-1 (vector-! s0-0 sv-176 v1-16)) + ) + (let ((f0-14 (ray-sphere-intersect arg0 s0-1 s4-0 (/ f30-1 5)))) + (when (and (< 0.0 f0-14) (>= f28-0 f0-14)) + (set! f28-0 f0-14) + (set! (-> this action) (manipulator-action ma7)) + ) + ) + (when (= (-> this action) (manipulator-action ma0)) + (when (and s3-0 s2-0) + (let ((f0-18 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)) + f30-1 + ) + (* 0.3 f30-1) + ) + ) + ) + (when (and (< 0.0 f0-18) (>= f28-0 f0-18)) + (set! f28-0 f0-18) + (set! (-> this action) (manipulator-action ma4)) + ) + ) + ) + (when (and s3-0 sv-160) + (let ((f0-22 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)) + f30-1 + ) + (* 0.3 f30-1) + ) + ) + ) + (when (and (< 0.0 f0-22) (>= f28-0 f0-22)) + (set! f28-0 f0-22) + (set! (-> this action) (manipulator-action ma5)) + ) + ) + ) + (when (and s2-0 sv-160) + (let ((f0-26 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat uvec) (-> this mat fvec)) + f30-1 + ) + (* 0.3 f30-1) + ) + ) + ) + (when (and (< 0.0 f0-26) (>= f28-0 f0-26)) + (set! f28-0 f0-26) + (set! (-> this action) (manipulator-action ma6)) + ) + ) + ) + (when s3-0 + (let ((f0-31 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat rvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (when (and (< 0.0 f0-31) (>= f28-0 f0-31)) + (set! f28-0 f0-31) + (set! (-> this action) (manipulator-action ma1)) + ) + ) + ) + (when s2-0 + (let ((f0-36 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat uvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (if (and (< 0.0 f0-36) (>= f28-0 f0-36)) + (set! (-> this action) (manipulator-action ma2)) + ) + ) + ) + (when sv-160 + (let ((f0-41 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat fvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (if (and (< 0.0 f0-41) (>= f0-41 f0-41)) + (set! (-> this action) (manipulator-action ma3)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) (defmethod manipulator-method-11 ((this manipulator)) (local-vars (sv-240 rgba) (sv-256 vector) (sv-272 vector)) diff --git a/goal_src/jak3/engine/debug/nav-mesh-editor-h.gc b/goal_src/jak3/engine/debug/nav-mesh-editor-h.gc index 8e8361a1c2..b12b6ad696 100644 --- a/goal_src/jak3/engine/debug/nav-mesh-editor-h.gc +++ b/goal_src/jak3/engine/debug/nav-mesh-editor-h.gc @@ -5,7 +5,26 @@ ;; name in dgo: nav-mesh-editor-h ;; dgos: GAME -(define-extern nav-mesh-editor-init (function none)) +;; +++nav-mesh-editor-h:nav-mesh-poly-flag +(defenum nav-mesh-poly-flag + :type uint32 + :bitfield #t + (gap 0) + (off 1) + (nmpf2 2) + (user0 3) + ) +;; ---nav-mesh-editor-h:nav-mesh-poly-flag + +;; +++nav-mesh-editor-h:nav-mesh-editable-flag +(defenum nav-mesh-editable-flag + :type uint32 + :bitfield #t + (nmef0 0) + ) +;; ---nav-mesh-editor-h:nav-mesh-editable-flag + +(declare-type nav-mesh-editable structure) ;; DECOMP BEGINS @@ -30,18 +49,18 @@ (deftype nav-mesh-poly (structure) ((poly-id uint32) - (flags uint32) - (index basic) + (flags nav-mesh-poly-flag) + (index int16-array) (insert-pos uint32) ) (:methods (new (symbol type) _type_) - (nav-mesh-poly-method-9 () none) - (nav-mesh-poly-method-10 () none) - (nav-mesh-poly-method-11 () none) - (nav-mesh-poly-method-12 () none) - (nav-mesh-poly-method-13 () none) - (nav-mesh-poly-method-14 () none) + (init-fields! (_type_) none) + (nav-mesh-poly-method-10 (_type_ nav-mesh-editable) none) + (nav-mesh-poly-method-11 (_type_ int) none) + (nav-mesh-poly-method-12 (_type_ int) none) + (nav-mesh-poly-method-13 (_type_ int) int) + (nav-mesh-poly-method-14 (_type_ int int) object) ) ) @@ -51,8 +70,17 @@ ) ) + (set! (-> nav-mesh-poly-array heap-base) (the-as uint 16)) +(defmethod init-fields! ((this nav-mesh-poly)) + (set! (-> this index) (new 'debug 'int16-array 512)) + (set! (-> this index length) 0) + (set! (-> this insert-pos) (the-as uint 0)) + 0 + (none) + ) + ;; WARN: Return type mismatch object vs nav-mesh-poly. (defmethod new nav-mesh-poly ((allocation symbol) (type-to-make type)) (let ((t9-0 (method-of-type structure new)) @@ -64,7 +92,7 @@ (set! gp-0 0) (goto cfg-4) ) - ((method-of-type nav-mesh-poly nav-mesh-poly-method-9)) + ((method-of-type nav-mesh-poly init-fields!) (the-as nav-mesh-poly gp-0)) (label cfg-4) (the-as nav-mesh-poly gp-0) ) @@ -72,7 +100,7 @@ ) (deftype nav-mesh-tri-quad (structure) - ((indices int32 4) + ((indices uint32 4) (poly uint32) ) ) @@ -87,9 +115,9 @@ (set! (-> nav-mesh-tri-quad-array heap-base) (the-as uint 32)) (deftype nav-mesh-editable (structure) - ((flags uint32) - (verts basic) - (tris basic) + ((flags nav-mesh-editable-flag) + (verts vector-array) + (tris nav-mesh-tri-quad-array) (quads nav-mesh-tri-quad-array) (navmesh-id uint32) (idx uint32) @@ -99,16 +127,17 @@ (selected-poly uint32) ) (:methods - (nav-mesh-editable-method-9 () none) - (nav-mesh-editable-method-10 () none) - (nav-mesh-editable-method-11 () none) - (nav-mesh-editable-method-12 () none) - (nav-mesh-editable-method-13 () none) - (nav-mesh-editable-method-14 () none) - (nav-mesh-editable-method-15 () none) - (nav-mesh-editable-method-16 () none) - (nav-mesh-editable-method-17 () none) - (nav-mesh-editable-method-18 () none) + (new (symbol type) _type_) + (init-fields! (_type_) none) + (nav-mesh-editable-method-10 (_type_ symbol) none) + (add-vert! (_type_ vector) int) + (nav-mesh-editable-method-12 (_type_ vector symbol) object) + (nav-mesh-editable-method-13 (_type_) none) + (nav-mesh-editable-method-14 (_type_ vector) int) + (nav-mesh-editable-method-15 (_type_ int) object) + (nav-mesh-editable-method-16 (_type_) object) + (nav-mesh-editable-method-17 (_type_) object) + (nav-mesh-editable-method-18 (_type_) none) ) ) @@ -121,16 +150,52 @@ (set! (-> nav-mesh-editable-array heap-base) (the-as uint 48)) +(defmethod init-fields! ((this nav-mesh-editable)) + (set! (-> this verts) (new 'debug 'vector-array 1024)) + (set! (-> this verts length) 0) + (set! (-> this tris) (new 'debug 'nav-mesh-tri-quad-array 512)) + (set! (-> this tris length) 0) + (set! (-> this quads) (new 'debug 'nav-mesh-tri-quad-array 512)) + (set! (-> this quads length) 0) + (set! (-> this polys) (new 'debug 'nav-mesh-poly-array 92)) + (dotimes (s5-0 (-> this polys length)) + (init-fields! (-> this polys data s5-0)) + (set! (-> this polys data s5-0 poly-id) (the-as uint s5-0)) + ) + (set! (-> this navmesh-id) (the-as uint 0)) + (logior! (-> this flags) (nav-mesh-editable-flag nmef0)) + 0 + (none) + ) + +;; WARN: Return type mismatch object vs nav-mesh-editable. +(defmethod new nav-mesh-editable ((allocation symbol) (type-to-make type)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (-> type-to-make size) + (let ((gp-0 (the-as object (t9-0 allocation v1-1)))) + (when (zero? (the-as structure gp-0)) + (set! gp-0 0) + (goto cfg-4) + ) + ((method-of-type nav-mesh-editable init-fields!) (the-as nav-mesh-editable gp-0)) + (label cfg-4) + (the-as nav-mesh-editable gp-0) + ) + ) + ) + (deftype nav-mesh-editor-undo (structure) ((current-nav-mesh nav-mesh-editable) (selected-poly uint32) - (index basic) + (index int16-array) (insert-pos uint32) - (verts basic) + (verts vector-array) ) (:methods (new (symbol type) _type_) - (nav-mesh-editor-undo-method-9 () none) + (init-fields! (_type_) none) ) ) @@ -143,6 +208,13 @@ (set! (-> nav-mesh-editor-undo-array heap-base) (the-as uint 32)) +(defmethod init-fields! ((this nav-mesh-editor-undo)) + (set! (-> this index) (new 'debug 'int16-array 2048)) + (set! (-> this verts) (new 'debug 'vector-array 1024)) + 0 + (none) + ) + ;; WARN: Return type mismatch object vs nav-mesh-editor-undo. (defmethod new nav-mesh-editor-undo ((allocation symbol) (type-to-make type)) (let ((t9-0 (method-of-type structure new)) @@ -154,7 +226,7 @@ (set! gp-0 0) (goto cfg-4) ) - ((method-of-type nav-mesh-editor-undo nav-mesh-editor-undo-method-9)) + ((method-of-type nav-mesh-editor-undo init-fields!) (the-as nav-mesh-editor-undo gp-0)) (label cfg-4) (the-as nav-mesh-editor-undo gp-0) ) @@ -162,9 +234,9 @@ ) (deftype nav-mesh-editor (process-drawable) - ((close-menu-time uint64) - (external-cam-mode basic) - (mouse-pressed uint64) + ((close-menu-time time-frame) + (external-cam-mode symbol) + (mouse-pressed time-frame) (mouse-screen-pos vector :inline) (mouse-pos vector :inline) (mouse-end vector :inline) @@ -180,29 +252,31 @@ (lock-action basic) (mouse-action uint32) (mouse-action-pos-ref vector :inline) - (nav-meshes basic) + (nav-meshes nav-mesh-editable-array) (current-nav-mesh nav-mesh-editable) (manipulator manipulator :inline) - (level-name basic) + (level-name string) (level-id uint32) (undo-min uint32) (undo-id uint32) (undo-max uint32) - (undos basic) - (hide-unselected basic) - (allow-snap basic) + (undos nav-mesh-editor-undo-array) + (hide-unselected symbol) + (allow-snap symbol) ) + (:state-methods + idle + ) (:methods - (nav-mesh-editor-method-20 () none) - (nav-mesh-editor-method-21 () none) - (nav-mesh-editor-method-22 () none) - (nav-mesh-editor-method-23 () none) - (nav-mesh-editor-method-24 () none) - (nav-mesh-editor-method-25 () none) - (nav-mesh-editor-method-26 () none) - (nav-mesh-editor-method-27 () none) + (nav-mesh-editor-method-21 (_type_) none) + (nav-mesh-editor-method-22 (_type_) none) + (set-level-info! (_type_ symbol) none) + (select-nav-mesh-by-id (_type_ int) object) + (nav-mesh-editor-method-25 (_type_) none) + (nav-mesh-editor-method-26 (_type_) none) + (nav-mesh-editor-method-27 (_type_) object) ) ) -(define *nav-mesh-editor* (the-as nav-mesh-editor #f)) +(define *nav-mesh-editor* (the-as (pointer nav-mesh-editor) #f)) diff --git a/goal_src/jak3/engine/debug/nav-mesh-editor.gc b/goal_src/jak3/engine/debug/nav-mesh-editor.gc index 66ad71bd5b..507a524a55 100644 --- a/goal_src/jak3/engine/debug/nav-mesh-editor.gc +++ b/goal_src/jak3/engine/debug/nav-mesh-editor.gc @@ -7,3 +7,4902 @@ ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) + +(defun snap-level-navmesh ((arg0 vector) (arg1 vector)) + (local-vars (sv-96 nav-poly) (sv-112 vector) (sv-128 int)) + (dotimes (s4-0 (-> *level* length)) + (let ((v1-3 (-> *level* level s4-0))) + (when (= (-> v1-3 status) 'active) + (let ((s3-0 (-> v1-3 bsp nav-meshes))) + (when (nonzero? s3-0) + (dotimes (s2-0 (-> s3-0 length)) + (let ((s1-0 (-> s3-0 s2-0))) + (-> s1-0 aid) + (let ((v1-8 (as-type s1-0 entity-nav-mesh))) + (when v1-8 + (let ((s1-1 (-> v1-8 nav-mesh))) + (new 'stack-no-clear 'vector) + (dotimes (s0-0 (the-as int (-> s1-1 poly-count))) + (set! sv-96 (-> s1-1 poly-array s0-0)) + (set! sv-112 (new 'stack-no-clear 'vector)) + (set! sv-128 0) + (while (< sv-128 (the-as int (-> sv-96 vertex-count))) + (when (transform-point-vector! + sv-112 + (vector+! (new 'stack-no-clear 'vector) (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) + ) + (when (and (< (fabs (- (-> arg0 x) (+ -2048.0 (-> sv-112 x)))) 8.0) + (< (fabs (- (-> arg0 y) (+ -2048.0 (-> sv-112 y)))) 8.0) + ) + (vector+! arg1 (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) + (return #t) + ) + ) + (set! sv-128 (+ sv-128 1)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + +(defmethod add-vert! ((this nav-mesh-editable) (arg0 vector)) + (vector-copy! (-> this verts data (-> this verts length)) arg0) + (+! (-> this verts length) 1) + (+ (-> this verts length) -1) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-editable-method-12 ((this nav-mesh-editable) (arg0 vector) (arg1 symbol)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (dotimes (s2-0 (-> this polys length)) + (let ((s1-0 (-> this polys data s2-0))) + (dotimes (s0-0 (-> s1-0 index length)) + (when (transform-point-vector! s3-0 (-> this verts data (-> s1-0 index data s0-0))) + (if (and (< (fabs (- (-> arg0 x) (+ -2048.0 (-> s3-0 x)))) 8.0) + (and (< (fabs (- (-> arg0 y) (+ -2048.0 (-> s3-0 y)))) 8.0) + (or (not arg1) (!= (-> s1-0 index data s0-0) (-> this + polys + data + (-> this selected-poly) + index + data + (-> this polys data (-> this selected-poly) insert-pos) + ) + ) + ) + ) + ) + (return (the-as object (-> s1-0 index data s0-0))) + ) + ) + ) + ) + ) + ) + -1 + ) + +(defun mouse-intersect-triangle ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let ((s5-0 (normal-of-plane (new 'stack-no-clear 'vector) arg1 arg2 arg3)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (reverse-transform-point! gp-0 arg1 s5-0 arg0) + (let ((s1-1 (vector-negate! (new 'stack-no-clear 'vector) s5-0))) + (if (or (point-in-triangle-cross gp-0 s5-0 arg1 arg2 arg3) (point-in-triangle-cross gp-0 s1-1 arg1 arg2 arg3)) + (return (vector-vector-distance (camera-pos) gp-0)) + ) + ) + ) + -1.0 + ) + +(defmethod nav-mesh-editable-method-14 ((this nav-mesh-editable) (arg0 vector)) + (dotimes (s4-0 (-> this tris length)) + (let ((s3-0 (-> this tris data s4-0))) + (-> this tris data s4-0) + (let ((v1-5 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (a0-3 4) + (set! (-> v1-5 a0-3 quad) (the-as uint128 0)) + ) + ) + (if (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-0 indices 0)) + (-> this verts data (-> s3-0 indices 1)) + (-> this verts data (-> s3-0 indices 2)) + ) + ) + (return (the-as int (-> s3-0 poly))) + ) + ) + ) + (dotimes (s4-1 (-> this quads length)) + (let ((s3-1 (-> this quads data s4-1))) + (-> this quads data s4-1) + (let ((v1-27 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (a0-9 4) + (set! (-> v1-27 a0-9 quad) (the-as uint128 0)) + ) + ) + (if (or (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-1 indices 0)) + (-> this verts data (-> s3-1 indices 2)) + (-> this verts data (-> s3-1 indices 3)) + ) + ) + (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-1 indices 0)) + (-> this verts data (-> s3-1 indices 3)) + (-> this verts data (-> s3-1 indices 2)) + ) + ) + (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-1 indices 0)) + (-> this verts data (-> s3-1 indices 2)) + (-> this verts data (-> s3-1 indices 1)) + ) + ) + (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-1 indices 0)) + (-> this verts data (-> s3-1 indices 3)) + (-> this verts data (-> s3-1 indices 1)) + ) + ) + ) + (return (the-as int (-> s3-1 poly))) + ) + ) + ) + -1 + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-mesh-editable-method-13 ((this nav-mesh-editable)) + (set! (-> this tris length) 0) + (set! (-> this quads length) 0) + (dotimes (s5-0 (-> this polys length)) + (let ((a0-2 (-> this polys data s5-0))) + (if (nonzero? (-> a0-2 index length)) + (nav-mesh-poly-method-10 a0-2 this) + ) + ) + ) + (none) + ) + +(defmethod nav-mesh-editable-method-10 ((this nav-mesh-editable) (arg0 symbol)) + (let ((s4-0 (-> this tris)) + (s3-0 (-> this verts)) + ) + (dotimes (s2-0 (-> s4-0 length)) + (let ((s1-0 (-> s4-0 data s2-0))) + (if arg0 + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (-> s3-0 data (-> s1-0 indices 0)) + (-> s3-0 data (-> s1-0 indices 1)) + (-> s3-0 data (-> s1-0 indices 2)) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x20) + ) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s3-0 data (-> s1-0 indices 2)) + (-> s3-0 data (-> s1-0 indices 0)) + (if (and arg0 (= (-> s4-0 data s2-0 poly) (-> this selected-poly))) + *color-red* + *color-light-red* + ) + #f + (the-as rgba -1) + ) + ) + ) + ) + (let ((s4-1 (-> this quads)) + (s3-1 (-> this verts)) + ) + (dotimes (s2-1 (-> s4-1 length)) + (let ((s1-1 (-> s4-1 data s2-1))) + (when arg0 + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (-> s3-1 data (-> s1-1 indices 0)) + (-> s3-1 data (-> s1-1 indices 1)) + (-> s3-1 data (-> s1-1 indices 2)) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x20) + ) + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (-> s3-1 data (-> s1-1 indices 0)) + (-> s3-1 data (-> s1-1 indices 2)) + (-> s3-1 data (-> s1-1 indices 3)) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x20) + ) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s3-1 data (-> s1-1 indices 3)) + (-> s3-1 data (-> s1-1 indices 0)) + (if (and arg0 (= (-> s4-1 data s2-1 poly) (-> this selected-poly))) + *color-red* + *color-light-red* + ) + #f + (the-as rgba -1) + ) + ) + ) + ) + (dotimes (s4-2 (-> this polys length)) + (let ((s3-2 (-> this polys data s4-2)) + (s2-2 (and arg0 (= s4-2 (-> this selected-poly)))) + ) + (let ((s1-2 (if s2-2 + *color-blue* + *color-light-blue* + ) + ) + ) + (dotimes (s0-0 (-> s3-2 index length)) + (let ((a2-5 (-> s3-2 index data (mod (+ s0-0 1) (-> s3-2 index length)))) + (v1-70 (-> s3-2 index data s0-0)) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> this verts data a2-5) + (-> this verts data v1-70) + s1-2 + #f + (the-as rgba -1) + ) + ) + ) + ) + (when (and s2-2 (< 1 (-> s3-2 index length))) + (let ((v1-86 (-> s3-2 index data (mod (the-as int (+ (-> s3-2 insert-pos) 1)) (-> s3-2 index length)))) + (a2-9 (-> s3-2 index data (-> s3-2 insert-pos))) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> this verts data a2-9) + (-> this verts data v1-86) + *color-green* + #f + *color-white* + ) + ) + ) + ) + ) + 0 + (none) + ) + +(define *clean-vertex-array* (new 'static 'inline-array vector 1024 + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + ) + ) + +(define *clean-index-array* (new 'static 'array int32 1024 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-editable-method-17 ((this nav-mesh-editable)) + ;; og:preserve-this added v1-13 and v1-17 + (local-vars (sv-16 symbol) (sv-32 int) (sv-48 vector) (v1-13 symbol) (v1-17 symbol)) + (let ((s5-0 0)) + (let ((s4-0 0)) + (b! #t cfg-33 :delay (nop!)) + (label cfg-1) + (let ((s3-0 (-> this polys data s4-0)) + (s2-0 0) + ) + (let ((s0-0 -1) + (s1-0 0) + ) + (b! #t cfg-28 :delay (nop!)) + (label cfg-2) + (set! sv-16 (the-as symbol #f)) + (set! sv-48 (-> this verts data (-> s3-0 index data s1-0))) + (b! (not #t) cfg-25 :delay (nop!)) + (let ((v1-10 (or (= s0-0 -1) + (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* s0-0)) sv-48)) + ) + ) + ) + (b! (not v1-10) cfg-13 :likely-delay (set! v1-13 v1-10)) + ) + (let ((a0-10 (!= s1-0 (+ (-> s3-0 index length) -1)))) + (b! a0-10 cfg-13 :likely-delay (set! v1-17 a0-10)) + ) + (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* 0)) sv-48)) + (label cfg-13) + (set! sv-32 0) + (while (< sv-32 s5-0) + (when (and (not sv-16) (< (vector-vector-distance (-> *clean-vertex-array* sv-32) sv-48) 204.8)) + (set! sv-16 #t) + (set! s0-0 sv-32) + (set! (-> *clean-index-array* s2-0) sv-32) + (+! s2-0 1) + ) + (set! sv-32 (+ sv-32 1)) + ) + (when (not sv-16) + (vector-copy! (-> *clean-vertex-array* s5-0) sv-48) + (set! s0-0 s5-0) + (set! (-> *clean-index-array* s2-0) s5-0) + (+! s2-0 1) + (+! s5-0 1) + ) + (b! #t cfg-27 :delay (nop!)) + (label cfg-25) + (if (>= (the-as int (-> s3-0 insert-pos)) s1-0) + (set! (-> s3-0 insert-pos) (the-as uint s0-0)) + ) + (label cfg-27) + (+! s1-0 1) + (label cfg-28) + (b! (< s1-0 (-> s3-0 index length)) cfg-2) + ) + (set! (-> s3-0 index length) s2-0) + (dotimes (v1-52 s2-0) + (set! (-> s3-0 index data v1-52) (-> *clean-index-array* v1-52)) + ) + ) + (+! s4-0 1) + (label cfg-33) + (b! (< s4-0 (-> this polys length)) cfg-1) + ) + (set! (-> this verts length) s5-0) + (dotimes (v1-60 s5-0) + (vector-copy! (-> this verts data v1-60) (-> *clean-vertex-array* v1-60)) + ) + ) + (nav-mesh-editable-method-13 this) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-poly-method-14 ((this nav-mesh-poly) (arg0 int) (arg1 int)) + (set! (-> this poly-id) (the-as uint arg1)) + (set! (-> this index length) 0) + (let ((s3-0 (clear *temp-string*))) + (format + s3-0 + "select navmesh_vertex_idx,navmesh_shape_idx from navmesh_shape where entity_id=~D and navmesh_poly_idx=~D~%" + arg0 + arg1 + ) + (let ((s5-1 (sql-query s3-0))) + (when (!= (-> s5-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s5-1 this) + (return (the-as object #f)) + ) + (let ((s4-1 0)) + (while (< s4-1 (-> s5-1 length)) + (set! (-> this index data (string->int (the-as string (-> s5-1 sql-data (+ s4-1 1))))) + (string->int (the-as string (-> s5-1 sql-data s4-1))) + ) + (+! (-> this index length) 1) + (+! s4-1 2) + ) + ) + ) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +;; WARN: new jak 2 until loop case, check carefully +(defmethod nav-mesh-editable-method-15 ((this nav-mesh-editable) (arg0 int)) + (set! (-> this verts length) 0) + (let ((s3-0 (clear *temp-string*)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-0 x) 0.0) + (set! (-> s4-0 y) 0.0) + (set! (-> s4-0 z) 0.0) + (clear s3-0) + (format + s3-0 + "select translate_x,translate_y,translate_z from level_info where level_info_id=~D~%" + (-> this level-id) + ) + (let ((s2-0 (sql-query s3-0))) + (when (!= (-> s2-0 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s2-0 this) + (return (the-as object #f)) + ) + (set! (-> s4-0 x) (string->float (the-as string (-> s2-0 sql-data 0)))) + (set! (-> s4-0 y) (string->float (the-as string (-> s2-0 sql-data 1)))) + (set! (-> s4-0 z) (string->float (the-as string (-> s2-0 sql-data 2)))) + ) + (clear s3-0) + (format s3-0 "select navmesh_vertex_idx,x,y,z from navmesh_vertex where entity_id=~D~%" arg0) + (let ((s3-1 (sql-query s3-0))) + (when (!= (-> s3-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s3-1 this) + (return (the-as object #f)) + ) + (let ((s2-1 0)) + 0 + (while (< s2-1 (-> s3-1 length)) + (set-vector! + (-> this verts data (string->int (the-as string (-> s3-1 sql-data s2-1)))) + (* 4096.0 (+ (-> s4-0 x) (string->float (the-as string (-> s3-1 sql-data (+ s2-1 1)))))) + (* 4096.0 (+ (-> s4-0 y) (string->float (the-as string (-> s3-1 sql-data (+ s2-1 2)))))) + (* 4096.0 (+ (-> s4-0 z) (string->float (the-as string (-> s3-1 sql-data (+ s2-1 3)))))) + 1.0 + ) + (+! (-> this verts length) 1) + (+! s2-1 4) + ) + ) + ) + ) + (dotimes (v1-32 92) + (set! (-> this polys data v1-32 index length) 0) + ) + (let ((s4-1 (clear *temp-string*))) + (format s4-1 "select navmesh_poly_idx,flag from navmesh_poly where entity_id=~D~%" arg0) + (let ((s4-2 (sql-query s4-1))) + (when (!= (-> s4-2 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s4-2 this) + (return (the-as object #f)) + ) + (let ((s3-2 0) + (s2-2 0) + ) + (while (< s3-2 (-> s4-2 length)) + (let ((a2-6 (string->int (the-as string (-> s4-2 sql-data s3-2))))) + (nav-mesh-poly-method-14 (-> this polys data s2-2) arg0 a2-6) + ) + (set! (-> this polys data s2-2 flags) (nav-mesh-poly-flag)) + (let ((s1-1 (new 'global 'string 0 (the-as string (-> s4-2 sql-data (+ s3-2 1)))))) + (copy-string<-string s1-1 (the-as string (-> s4-2 sql-data (+ s3-2 1)))) + (until #f + (cond + ((string-prefix= "gap" s1-1) + (logior! (-> this polys data s2-2 flags) (nav-mesh-poly-flag gap)) + ) + ((string-prefix= "off" s1-1) + (logior! (-> this polys data s2-2 flags) (nav-mesh-poly-flag off)) + ) + ((string-prefix= "switch" s1-1) + (logior! (-> this polys data s2-2 flags) (nav-mesh-poly-flag nmpf2)) + ) + ((string-prefix= "user0" s1-1) + (logior! (-> this polys data s2-2 flags) (nav-mesh-poly-flag user0)) + ) + (else + #t + (goto cfg-30) + ) + ) + (let ((a1-20 (string-skip-to-char (-> s1-1 data) (the-as uint 44)))) + (if (= (-> a1-20 0) 44) + (set! a1-20 (&-> a1-20 1)) + ) + (string-suck-up! s1-1 a1-20) + ) + ) + ) + #f + (label cfg-30) + (+! s2-2 1) + (+! s3-2 2) + ) + ) + ) + ) + (logclear! (-> this flags) (nav-mesh-editable-flag nmef0)) + (nav-mesh-editable-method-17 this) + (set! (-> this navmesh-id) (the-as uint arg0)) + 0 + ) + +;; WARN: Return type mismatch symbol vs object. +(defun poly-flag-to-string ((arg0 object) (arg1 nav-mesh-poly-flag)) + (let ((v1-0 #t)) + (when (logtest? arg1 (nav-mesh-poly-flag gap)) + (if (not v1-0) + (format arg0 ",") + ) + (format arg0 "gap") + (set! v1-0 #f) + ) + (when (logtest? arg1 (nav-mesh-poly-flag off)) + (if (not v1-0) + (format arg0 ",") + ) + (format arg0 "off") + (set! v1-0 #f) + ) + (when (logtest? arg1 (nav-mesh-poly-flag user0)) + (if (not v1-0) + (format arg0 ",") + ) + (format arg0 "user0") + #f + ) + ) + ) + +;; WARN: Function (method 18 nav-mesh-editable) has a return type of none, but the expression builder found a return statement. +(defmethod nav-mesh-editable-method-18 ((this nav-mesh-editable)) + (format #t "Deleting nav-mesh ~D...~%" (-> this navmesh-id)) + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "delete from navmesh_vertex where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-2 (sql-query s5-0))) + (when (!= (-> a2-2 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-2 this) + (return #f) + ) + ) + ) + (let ((s5-1 (clear *temp-string*))) + (format s5-1 "delete from navmesh_shape where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-4 (sql-query s5-1))) + (when (!= (-> a2-4 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-4 this) + (return #f) + ) + ) + ) + (let ((s5-2 (clear *temp-string*))) + (format s5-2 "delete from navmesh_face where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-6 (sql-query s5-2))) + (when (!= (-> a2-6 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-6 this) + (return #f) + ) + ) + ) + (let ((s5-3 (clear *temp-string*))) + (format s5-3 "delete from navmesh_poly where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-8 (sql-query s5-3))) + (when (!= (-> a2-8 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-8 this) + (return #f) + ) + ) + ) + (let ((s5-4 (clear *temp-string*))) + (format s5-4 "delete from entity where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-10 (sql-query s5-4))) + (when (!= (-> a2-10 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-10 this) + (return #f) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-editable-method-16 ((this nav-mesh-editable)) + (format #t "Saving nav-mesh ~D~%" (-> this navmesh-id)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (clear *temp-string*))) + (format + s5-0 + "select translate_x,translate_y,translate_z from level_info where level_info_id=~D~%" + (-> this level-id) + ) + (let ((s5-1 (sql-query s5-0))) + (when (!= (-> s5-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s5-1 this) + (return (the-as object #f)) + ) + (set! (-> s4-0 x) (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 0))))) + (set! (-> s4-0 y) (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 1))))) + (set! (-> s4-0 z) (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 2))))) + ) + ) + (let ((s5-2 (new-stack-vector0))) + (dotimes (v1-7 (-> this verts length)) + (vector+! s5-2 s5-2 (-> this verts data v1-7)) + ) + (let ((v1-10 s5-2) + (a0-13 s5-2) + (f0-7 (the float (-> this verts length))) + ) + (vector-float*! v1-10 a0-13 (/ 1.0 f0-7)) + ) + (set! (-> s5-2 x) (- (-> s5-2 x) (-> s4-0 x))) + (set! (-> s5-2 y) (- (-> s5-2 y) (-> s4-0 y))) + (set! (-> s5-2 z) (- (-> s5-2 z) (-> s4-0 z))) + (cond + ((nonzero? (-> this navmesh-id)) + (let ((s4-1 (clear *temp-string*))) + (format s4-1 "update entity set ") + (format s4-1 "level_id=~D," (-> this level-id)) + (format s4-1 "position_x=~M," (-> s5-2 x)) + (format s4-1 "position_y=~M," (-> s5-2 y)) + (format s4-1 "position_z=~M " (-> s5-2 z)) + (format s4-1 "where ") + (format s4-1 "entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-11 (sql-query s4-1))) + (when (!= (-> a2-11 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-11 this) + (set! (-> this navmesh-id) (the-as uint 0)) + (return (the-as object #f)) + ) + ) + ) + ) + (else + (let ((s4-2 (clear *temp-string*))) + (format s4-2 "select ifnull(max(idx) + 1, 1) from entity where name='nav-mesh'~%") + (let ((a2-12 (sql-query s4-2))) + (when (!= (-> a2-12 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-12 this) + (return (the-as object #f)) + ) + (set! (-> this idx) (the-as uint (string->int (the-as string (-> a2-12 sql-data 0))))) + ) + (clear s4-2) + (format s4-2 "insert entity set ") + (format s4-2 "level_id=~D," (-> this level-id)) + (format s4-2 "name='nav-mesh',") + (format s4-2 "idx=~D," (-> this idx)) + (format s4-2 "path='navmesh-editor-~D'," (-> this idx)) + (format s4-2 "position_x=~M," (-> s5-2 x)) + (format s4-2 "position_y=~M," (-> s5-2 y)) + (format s4-2 "position_z=~M~%" (-> s5-2 z)) + (let ((a2-19 (sql-query s4-2))) + (when (!= (-> a2-19 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-19 this) + (set! (-> this navmesh-id) (the-as uint 0)) + (return (the-as object #f)) + ) + ) + ) + (let ((v1-22 (sql-query "select LAST_INSERT_ID()"))) + (if (= (-> v1-22 content-type) 'select) + (set! (-> this navmesh-id) (the-as uint (string->int (the-as string (-> v1-22 sql-data 0))))) + ) + ) + ) + ) + ) + ) + (format 0 "Saving vertices ...~%") + (let ((s5-3 (clear *temp-string*)) + (s4-3 (new 'stack-no-clear 'vector)) + (s3-0 0) + ) + (format s5-3 "delete from navmesh_vertex where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-21 (sql-query s5-3))) + (when (!= (-> a2-21 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-21 this) + (return (the-as object #f)) + ) + ) + (clear s5-3) + (format + s5-3 + "select translate_x,translate_y,translate_z from level_info where level_info_id=~D~%" + (-> this level-id) + ) + (let ((s2-0 (sql-query s5-3))) + (when (!= (-> s2-0 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s2-0 this) + (return (the-as object #f)) + ) + (set! (-> s4-3 x) (* 4096.0 (string->float (the-as string (-> s2-0 sql-data 0))))) + (set! (-> s4-3 y) (* 4096.0 (string->float (the-as string (-> s2-0 sql-data 1))))) + (set! (-> s4-3 z) (* 4096.0 (string->float (the-as string (-> s2-0 sql-data 2))))) + ) + (clear s5-3) + (dotimes (s2-1 (-> this verts length)) + (if (zero? s3-0) + (format s5-3 "insert into navmesh_vertex (entity_id,navmesh_vertex_idx,x,y,z) values ") + (format s5-3 ", ") + ) + (format + s5-3 + "(~D,~D,~M,~M,~M)" + (-> this navmesh-id) + s2-1 + (- (-> this verts data s2-1 x) (-> s4-3 x)) + (- (-> this verts data s2-1 y) (-> s4-3 y)) + (- (-> this verts data s2-1 z) (-> s4-3 z)) + ) + (+! s3-0 1) + (when (>= s3-0 16) + (format s5-3 "~%") + (let ((a2-25 (sql-query s5-3))) + (when (!= (-> a2-25 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-25 this) + (return (the-as object #f)) + ) + ) + (set! s3-0 0) + (clear s5-3) + ) + ) + (when (> s3-0 0) + (format s5-3 "~%") + (let ((a2-26 (sql-query s5-3))) + (when (!= (-> a2-26 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-26 this) + (return (the-as object #f)) + ) + ) + ) + ) + (format 0 "Saving polygons ...~%") + (let ((s5-4 0) + (s4-4 (clear *temp-string*)) + ) + (format s4-4 "delete from navmesh_shape where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-28 (sql-query s4-4))) + (when (!= (-> a2-28 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-28 this) + (return (the-as object #f)) + ) + ) + (clear s4-4) + (format s4-4 "delete from navmesh_poly where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-30 (sql-query s4-4))) + (when (!= (-> a2-30 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-30 this) + (return (the-as object #f)) + ) + ) + (dotimes (s3-1 (-> this polys length)) + (let ((s2-2 (-> this polys data s3-1))) + (when (< 2 (-> s2-2 index length)) + (let ((s1-0 0)) + (clear s4-4) + (format s4-4 "insert navmesh_poly set navmesh_poly_idx=~D,entity_id=~D,flag='" s5-4 (-> this navmesh-id)) + (poly-flag-to-string s4-4 (-> s2-2 flags)) + (format s4-4 "'~%") + (let ((a2-32 (sql-query s4-4))) + (when (!= (-> a2-32 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-32 this) + (return (the-as object #f)) + ) + ) + (clear s4-4) + (dotimes (s0-0 (-> s2-2 index length)) + (if (zero? s1-0) + (format + s4-4 + "insert into navmesh_shape (entity_id,navmesh_poly_idx,navmesh_vertex_idx,navmesh_shape_idx) values " + ) + (format s4-4 ", ") + ) + (format s4-4 "(~D,~D,~D,~D)" (-> this navmesh-id) s5-4 (-> s2-2 index data s0-0) s0-0) + (+! s1-0 1) + (when (>= s1-0 16) + (format s4-4 "~%") + (let ((a2-34 (sql-query s4-4))) + (when (!= (-> a2-34 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-34 this) + (return (the-as object #f)) + ) + ) + (set! s1-0 0) + (clear s4-4) + ) + ) + (when (> s1-0 0) + (format s4-4 "~%") + (let ((a2-35 (sql-query s4-4))) + (when (!= (-> a2-35 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-35 this) + (return (the-as object #f)) + ) + ) + ) + ) + (+! s5-4 1) + ) + ) + ) + ) + (format 0 "Saving faces ...~%") + (let ((s5-5 (clear *temp-string*)) + (s4-5 0) + ) + (format s5-5 "delete from navmesh_face where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-37 (sql-query s5-5))) + (when (!= (-> a2-37 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-37 this) + (return (the-as object #f)) + ) + ) + (clear s5-5) + (dotimes (s3-2 (-> this tris length)) + (if (zero? s4-5) + (format + s5-5 + "insert into navmesh_face (entity_id,navmesh_vertex_idx_1,navmesh_vertex_idx_2,navmesh_vertex_idx_3,navmesh_vertex_idx_4,flag) values " + ) + (format s5-5 ", ") + ) + (format + s5-5 + "(~D,~D,~D,~D,~D,'" + (-> this navmesh-id) + (-> (the-as (inline-array nav-mesh-tri-quad) (+ (* s3-2 32) (the-as int (-> this tris)))) 0 indices 3) + (-> this tris data s3-2 indices 1) + (-> this tris data s3-2 indices 2) + -1 + ) + (poly-flag-to-string s5-5 (-> this polys data (-> this tris data s3-2 poly) flags)) + (format s5-5 "')") + (+! s4-5 1) + (when (>= s4-5 16) + (format s5-5 "~%") + (let ((a2-40 (sql-query s5-5))) + (when (!= (-> a2-40 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-40 this) + (return (the-as object #f)) + ) + ) + (set! s4-5 0) + (clear s5-5) + ) + ) + (dotimes (s3-3 (-> this quads length)) + (if (zero? s4-5) + (format + s5-5 + "insert into navmesh_face (entity_id,navmesh_vertex_idx_1,navmesh_vertex_idx_2,navmesh_vertex_idx_3,navmesh_vertex_idx_4,flag) values " + ) + (format s5-5 ", ") + ) + (format + s5-5 + "(~D,~D,~D,~D,~D,'" + (-> this navmesh-id) + (-> this quads data s3-3 indices 0) + (-> this quads data s3-3 indices 1) + (-> this quads data s3-3 indices 2) + (-> this quads data s3-3 indices 3) + ) + (poly-flag-to-string s5-5 (-> this polys data (-> this quads data s3-3 poly) flags)) + (format s5-5 "')") + (+! s4-5 1) + (when (>= s4-5 16) + (format s5-5 "~%") + (let ((a2-43 (sql-query s5-5))) + (when (!= (-> a2-43 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-43 this) + (return (the-as object #f)) + ) + ) + (set! s4-5 0) + (clear s5-5) + ) + ) + (when (> s4-5 0) + (format s5-5 "~%") + (let ((a2-44 (sql-query s5-5))) + (when (!= (-> a2-44 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-44 this) + (return (the-as object #f)) + ) + ) + ) + ) + 0 + ) + +(defmethod nav-mesh-poly-method-13 ((this nav-mesh-poly) (arg0 int)) + (dotimes (v1-0 (-> this index length)) + (if (= (-> this index data v1-0) arg0) + (return v1-0) + ) + ) + -1 + ) + +(defmethod nav-mesh-poly-method-11 ((this nav-mesh-poly) (arg0 int)) + (cond + ((zero? (-> this index length)) + (set! (-> this index data 0) arg0) + (+! (-> this index length) 1) + (set! (-> this insert-pos) (-> this insert-pos)) + ) + ((= (-> this insert-pos) (+ (-> this index length) -1)) + (set! (-> this index data (+ (-> this insert-pos) 1)) arg0) + (+! (-> this index length) 1) + (+! (-> this insert-pos) 1) + ) + ((< (-> this insert-pos) (the-as uint (-> this index length))) + (when (and (!= (-> this index data (-> this insert-pos)) arg0) + (!= (-> this index data (mod (the-as int (+ (-> this insert-pos) 1)) (-> this index length))) arg0) + ) + (dotimes (v1-35 (+ (- (the-as int (-> this insert-pos))) (-> this index length))) + (set! (-> this index data (- (-> this index length) v1-35)) + (-> this index data (+ (- -1 v1-35) (-> this index length))) + ) + ) + (set! (-> this index data (+ (-> this insert-pos) 1)) arg0) + (+! (-> this index length) 1) + (+! (-> this insert-pos) 1) + ) + ) + ) + 0 + (none) + ) + +(defmethod nav-mesh-poly-method-12 ((this nav-mesh-poly) (arg0 int)) + (when (< (the-as uint arg0) (the-as uint (-> this index length))) + (if (and (>= (-> this insert-pos) (the-as uint arg0)) (> (-> this insert-pos) 0)) + (+! (-> this insert-pos) -1) + ) + (dotimes (v1-9 (+ (- arg0) (-> this index length))) + (set! (-> this index data (+ arg0 v1-9)) (-> this index data (+ v1-9 1 arg0))) + ) + (+! (-> this index length) -1) + ) + 0 + (none) + ) + +(deftype triangulation-vert (structure) + ((index uint32) + (ear? symbol) + (score float) + ) + ) + + +;; WARN: disable def twice: 23. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defun point-in-cone ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg0 arg2)) + (a0-2 (vector-! (new 'stack-no-clear 'vector) arg1 arg2)) + (a1-2 (vector-! (new 'stack-no-clear 'vector) arg3 arg2)) + ) + (if (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) a1-2 a0-2) y)) + (and (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a1-2) y) 0.0) + (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a0-2) y)) + ) + (or (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a1-2) y)) + (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a0-2) y) 0.0) + ) + ) + ) + ) + +;; WARN: disable def twice: 23. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defun segment-in-cone ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (a1-2 (vector-! (new 'stack-no-clear 'vector) arg2 arg0)) + (a2-2 (vector-! (new 'stack-no-clear 'vector) arg3 arg0)) + ) + (if (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) a2-2 a1-2) y)) + (and (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a2-2) y) 0.0) + (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a1-2) y)) + ) + (or (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a2-2) y)) + (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a1-2) y) 0.0) + ) + ) + ) + ) + +(defun point-in-triangle ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (local-vars (v0-0 symbol)) + (let ((t0-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1)) + (t1-2 (vector-! (new 'stack-no-clear 'vector) arg3 arg2)) + (v1-3 (vector-! (new 'stack-no-clear 'vector) arg1 arg3)) + ) + (if (or (< 0.0 + (-> (vector-cross! (new 'stack-no-clear 'vector) (vector-! (new 'stack-no-clear 'vector) arg0 arg2) t1-2) y) + ) + (< 0.0 + (-> (vector-cross! (new 'stack-no-clear 'vector) (vector-! (new 'stack-no-clear 'vector) arg0 arg1) t0-1) y) + ) + (< 0.0 + (-> (vector-cross! (new 'stack-no-clear 'vector) (vector-! (new 'stack-no-clear 'vector) arg0 arg3) v1-3) y) + ) + ) + (return #f) + ) + ) + (return #t) + v0-0 + ) + +(defun segments-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let* ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg0)) + (f0-2 (- (* (-> arg1 x) (-> arg3 z)) (* (-> arg1 z) (-> arg3 x)))) + (f1-3 f0-2) + (f1-5 (* f1-3 f1-3)) + (f2-1 (-> arg1 x)) + (f2-3 (* f2-1 f2-1)) + (f3-0 (-> arg1 z)) + (f2-4 (+ f2-3 (* f3-0 f3-0))) + (f3-3 (-> arg3 x)) + (f3-5 (* f3-3 f3-3)) + (f4-0 (-> arg3 z)) + (f3-6 (+ f3-5 (* f4-0 f4-0))) + ) + (when (< (* (/ f3-6 10000) f2-4) f1-5) + (let ((f1-9 (/ (- (* (-> v1-1 x) (-> arg3 z)) (* (-> v1-1 z) (-> arg3 x))) f0-2))) + (if (or (< f1-9 0.0) (< 1.0 f1-9)) + (return #f) + ) + ) + (let ((f0-3 (/ (- (* (-> v1-1 x) (-> arg1 z)) (* (-> v1-1 z) (-> arg1 x))) f0-2))) + (if (or (< f0-3 0.0) (< 1.0 f0-3)) + (return #f) + ) + ) + (return #t) + ) + ) + #f + ) + +(defun is-diagonal ((arg0 int) (arg1 (inline-array triangulation-vert)) (arg2 vector-array) (arg3 int) (arg4 int) (arg5 int)) + (mod (+ arg0 -1 arg3) arg0) + (mod (+ arg0 1 arg5) arg0) + (let ((v1-9 (vector-! + (new 'stack-no-clear 'vector) + (-> arg2 data (-> arg1 arg4 index)) + (-> arg2 data (-> arg1 arg3 index)) + ) + ) + (a0-8 (vector-! + (new 'stack-no-clear 'vector) + (-> arg2 data (-> arg1 arg5 index)) + (-> arg2 data (-> arg1 arg4 index)) + ) + ) + ) + (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-9 a0-8) y) 0.0) + (return #f) + ) + ) + (dotimes (s0-0 arg0) + (if (and (!= s0-0 arg3) + (!= s0-0 arg4) + (!= s0-0 arg5) + (and (< (-> (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! + (new 'stack-no-clear 'vector) + (-> arg2 data (-> arg1 s0-0 index)) + (-> arg2 data (-> arg1 (mod (+ arg0 -1 s0-0) arg0) index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> arg2 data (-> arg1 (mod (+ arg0 1 s0-0) arg0) index)) + (-> arg2 data (-> arg1 s0-0 index)) + ) + ) + y + ) + 0.0 + ) + (point-in-triangle + (-> arg2 data (-> arg1 s0-0 index)) + (-> arg2 data (-> arg1 arg3 index)) + (-> arg2 data (-> arg1 arg4 index)) + (-> arg2 data (-> arg1 arg5 index)) + ) + ) + ) + (return #f) + ) + ) + #t + ) + +(define *verts-buf-1* (new 'static 'inline-array triangulation-vert 256 + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + ) + ) + +(define *verts-buf-2* (new 'static 'inline-array triangulation-vert 256 + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + ) + ) + +;; WARN: Function (method 10 nav-mesh-poly) has a return type of none, but the expression builder found a return statement. +(defmethod nav-mesh-poly-method-10 ((this nav-mesh-poly) (arg0 nav-mesh-editable)) + (local-vars + (sv-288 int) + (sv-304 int) + (sv-320 int) + (sv-336 int) + (sv-352 int) + (sv-368 vector) + (sv-384 vector) + (sv-400 vector) + (sv-416 int) + (sv-432 int) + (sv-448 int) + (sv-464 int) + (sv-480 int) + (sv-496 int) + (sv-512 vector) + (sv-528 vector) + (sv-544 vector) + (sv-560 vector) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 *verts-buf-1*) + (s2-0 *verts-buf-2*) + ) + *verts-buf-1* + (let ((s1-0 (-> this index length)) + (s3-0 (-> arg0 verts)) + ) + (dotimes (v1-2 s1-0) + (set! (-> s4-0 v1-2 index) (the-as uint (-> this index data v1-2))) + ) + (while (< 3 s1-0) + (set! sv-288 0) + (set! sv-304 1) + (set! sv-320 2) + (let ((s0-0 0)) + (set! sv-336 -1) + -1 + (let ((f30-0 0.0)) + (set! sv-352 0) + (while (< sv-352 s1-0) + (set! (-> s4-0 sv-304 ear?) #f) + (when (is-diagonal s1-0 s4-0 s3-0 sv-288 sv-304 sv-320) + 1.0 + (new 'stack-no-clear 'vector) + (set! sv-400 (new 'stack-no-clear 'vector)) + (let ((v1-25 (-> s3-0 data (-> s4-0 sv-288 index))) + (a0-11 (-> s3-0 data (-> s4-0 sv-304 index))) + ) + (.lvf vf4 (&-> v1-25 quad)) + (.lvf vf5 (&-> a0-11 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-400 quad) vf6) + (set! sv-368 (new 'stack-no-clear 'vector)) + (let ((v1-34 (-> s3-0 data (-> s4-0 sv-304 index))) + (a0-18 (-> s3-0 data (-> s4-0 sv-320 index))) + ) + (.lvf vf4 (&-> v1-34 quad)) + (.lvf vf5 (&-> a0-18 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-368 quad) vf6) + (set! sv-384 (new 'stack-no-clear 'vector)) + (let ((v1-43 (-> s3-0 data (-> s4-0 sv-320 index))) + (a0-25 (-> s3-0 data (-> s4-0 sv-288 index))) + ) + (.lvf vf4 (&-> v1-43 quad)) + (.lvf vf5 (&-> a0-25 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-384 quad) vf6) + 0.0 + 0.0 + (let* ((f28-0 (vector-vector-angle-safe sv-400 sv-368)) + (t9-2 vector-vector-angle-safe) + (a1-6 sv-384) + (f0-5 (* f28-0 (t9-2 sv-368 a1-6) (vector-vector-angle-safe sv-384 sv-400))) + ) + (set! (-> s4-0 sv-304 ear?) #t) + (when (or (= sv-336 -1) (< f30-0 f0-5)) + (set! sv-336 sv-304) + (set! f30-0 f0-5) + ) + ) + ) + (set! sv-288 (mod (+ sv-288 1) s1-0)) + (set! sv-304 (mod (+ sv-304 1) s1-0)) + (set! sv-320 (mod (+ sv-320 1) s1-0)) + (set! sv-352 (+ sv-352 1)) + ) + ) + (set! sv-416 0) + (set! sv-432 1) + (set! sv-448 2) + (set! sv-464 -1) + (let ((f30-1 0.0)) + (set! sv-480 3) + (set! sv-496 0) + (while (< sv-496 s1-0) + (when (and (-> s4-0 sv-432 ear?) + (-> s4-0 sv-448 ear?) + (is-diagonal s1-0 s4-0 s3-0 sv-480 sv-416 sv-432) + (is-diagonal s1-0 s4-0 s3-0 sv-448 sv-480 sv-416) + ) + 1.0 + (set! sv-560 (new 'stack-no-clear 'vector)) + (let ((v1-90 (-> s3-0 data (-> s4-0 sv-416 index))) + (a0-41 (-> s3-0 data (-> s4-0 sv-432 index))) + ) + (.lvf vf4 (&-> v1-90 quad)) + (.lvf vf5 (&-> a0-41 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-560 quad) vf6) + (set! sv-512 (new 'stack-no-clear 'vector)) + (let ((v1-99 (-> s3-0 data (-> s4-0 sv-432 index))) + (a0-48 (-> s3-0 data (-> s4-0 sv-448 index))) + ) + (.lvf vf4 (&-> v1-99 quad)) + (.lvf vf5 (&-> a0-48 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-512 quad) vf6) + (set! sv-528 (new 'stack-no-clear 'vector)) + (let ((v1-108 (-> s3-0 data (-> s4-0 sv-448 index))) + (a0-55 (-> s3-0 data (-> s4-0 sv-480 index))) + ) + (.lvf vf4 (&-> v1-108 quad)) + (.lvf vf5 (&-> a0-55 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-528 quad) vf6) + (set! sv-544 (new 'stack-no-clear 'vector)) + (let ((v1-117 (-> s3-0 data (-> s4-0 sv-480 index))) + (a0-62 (-> s3-0 data (-> s4-0 sv-416 index))) + ) + (.lvf vf4 (&-> v1-117 quad)) + (.lvf vf5 (&-> a0-62 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-544 quad) vf6) + 0.0 + 0.0 + (let* ((f28-2 (vector-vector-angle-safe sv-560 sv-512)) + (t9-7 vector-vector-angle-safe) + (a1-11 sv-528) + (f28-3 (* f28-2 (t9-7 sv-512 a1-11))) + (t9-8 vector-vector-angle-safe) + (a1-12 sv-544) + (f0-12 (* f28-3 (t9-8 sv-528 a1-12) (vector-vector-angle-safe sv-544 sv-560))) + ) + (when (or (= sv-464 -1) (< f30-1 f0-12)) + (set! sv-336 sv-432) + (set! sv-464 sv-448) + (set! f30-1 f0-12) + ) + ) + ) + (set! sv-416 (mod (+ sv-416 1) s1-0)) + (set! sv-432 (mod (+ sv-432 1) s1-0)) + (set! sv-448 (mod (+ sv-448 1) s1-0)) + (set! sv-480 (mod (+ sv-480 1) s1-0)) + (set! sv-496 (+ sv-496 1)) + ) + ) + (when (= sv-336 -1) + (format *stdcon* "cannot find any ear~%") + (return #f) + ) + (let ((a0-70 0) + (a1-15 1) + (a2-3 2) + (a3-3 3) + ) + (dotimes (v1-146 s1-0) + (cond + ((= a1-15 sv-336) + (cond + ((!= sv-464 -1) + (let ((t0-9 (-> arg0 quads data (-> arg0 quads length))) + (t1-6 (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a0-70 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a2-3 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + ) + ) + ) + (when (< 0.01 (vector-length t1-6)) + (set! (-> t0-9 indices 0) (-> s4-0 a0-70 index)) + (set! (-> t0-9 indices 1) (-> s4-0 a1-15 index)) + (set! (-> t0-9 indices 2) (-> s4-0 a2-3 index)) + (set! (-> t0-9 indices 3) (-> s4-0 a3-3 index)) + (set! (-> t0-9 poly) (-> this poly-id)) + (+! (-> arg0 quads length) 1) + ) + ) + ) + (else + (let ((t0-17 (-> arg0 tris data (-> arg0 tris length))) + (t1-25 (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a0-70 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a2-3 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + ) + ) + ) + (when (< 0.01 (vector-length t1-25)) + (set! (-> t0-17 indices 0) (-> s4-0 a0-70 index)) + (set! (-> t0-17 indices 1) (-> s4-0 a1-15 index)) + (set! (-> t0-17 indices 2) (-> s4-0 a2-3 index)) + (set! (-> t0-17 poly) (-> this poly-id)) + (+! (-> arg0 tris length) 1) + ) + ) + ) + ) + ) + ((= a1-15 sv-464) + ) + (else + (set! (-> s2-0 s0-0 index) (-> s4-0 a1-15 index)) + (+! s0-0 1) + ) + ) + (set! a0-70 (mod (+ a0-70 1) s1-0)) + (set! a1-15 (mod (+ a1-15 1) s1-0)) + (set! a2-3 (mod (+ a2-3 1) s1-0)) + (set! a3-3 (mod (+ a3-3 1) s1-0)) + ) + ) + (set! s1-0 s0-0) + ) + (let ((v1-149 s4-0)) + (set! s4-0 s2-0) + (set! s2-0 v1-149) + ) + ) + (when (= s1-0 3) + (let ((v1-158 (-> arg0 tris data (-> arg0 tris length))) + (a0-75 + (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! (new 'stack-no-clear 'vector) (-> s3-0 data (-> s4-0 0 index)) (-> s3-0 data (-> s4-0 1 index))) + (vector-! (new 'stack-no-clear 'vector) (-> s3-0 data (-> s4-0 2 index)) (-> s3-0 data (-> s4-0 1 index))) + ) + ) + ) + (when (< 0.01 (vector-length a0-75)) + (set! (-> v1-158 indices 0) (-> s4-0 0 index)) + (set! (-> v1-158 indices 1) (-> s4-0 1 index)) + (set! (-> v1-158 indices 2) (-> s4-0 2 index)) + (set! (-> v1-158 poly) (-> this poly-id)) + (+! (-> arg0 tris length) 1) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod nav-mesh-editor-method-21 ((this nav-mesh-editor)) + (set! *display-region-marks* #f) + (when #f + (format *stdcon* "~0K") + (format *stdcon* "~16S~16S~16S~%" "Left button" "Middle button" "Right button") + (when (!= *master-mode* 'menu) + ) + (format *stdcon* "~1K~%") + ) + 0 + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-mesh-editor-method-22 ((this nav-mesh-editor)) + (vector-copy! (-> this mouse-pos) (-> *math-camera* trans)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! (new 'stack-no-clear 'vector) *up-vector*) + (set-vector! s2-0 (-> *mouse* posx) (-> *mouse* posy) 0.0 1.0) + (vector-copy! (-> this mouse-screen-pos) s2-0) + (cond + (*ocean-map* + (vector-copy! s3-0 *up-vector*) + (vector-copy! s4-0 (-> this mouse-pos)) + (set! (-> s4-0 y) (get-base-height *ocean-map*)) + (reverse-transform-point! s5-0 s4-0 s3-0 s2-0) + (vector-copy! (-> this mouse-hit) s5-0) + (vector-copy! (-> this mouse-normal) *y-vector*) + (set! (-> this mouse-collide) (the-as basic #t)) + ) + (else + (vector-copy! s3-0 (-> *math-camera* inv-camera-rot fvec)) + (vector+*! s4-0 (-> this mouse-pos) (-> *math-camera* inv-camera-rot fvec) 4096000.0) + (reverse-transform-point! s5-0 s4-0 s3-0 s2-0) + ) + ) + ) + (vector-copy! (-> this mouse-end) s5-0) + (let ((s4-1 (new 'stack 'collide-query))) + (vector-copy! (-> s4-1 start-pos) (-> this mouse-pos)) + (vector-! (-> s4-1 move-dist) s5-0 (-> this mouse-pos)) + (let ((v1-19 s4-1)) + (set! (-> v1-19 radius) 409.6) + (set! (-> v1-19 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-19 ignore-process0) #f) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s4-1))) + (cond + ((>= f0-7 0.0) + (vector+*! (-> this mouse-hit) (-> s4-1 start-pos) (-> s4-1 move-dist) f0-7) + (vector+! + (-> this mouse-hit-pick) + (-> this mouse-hit) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-1 move-dist) 4096.0) + ) + (vector-copy! (-> this mouse-normal) (-> s4-1 best-other-tri normal)) + (set! (-> this mouse-collide) (the-as basic #t)) + ) + (else + (when (not *ocean-map*) + (vector+! (-> this mouse-hit) (-> s4-1 start-pos) (-> s4-1 move-dist)) + (set! (-> this mouse-collide) #f) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch pointer vs object. +(defun draw-square-point ((arg0 vector)) + (let* ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (gp-0 (-> s5-0 base)) + ) + (when (transform-point-vector! s4-0 arg0) + (let ((v1-9 (+ (the int (+ -1792.0 (-> s4-0 x))) -1)) + (a0-4 (+ (the int (+ -1840.0 (-> s4-0 y))) -1)) + ) + (when (and (> v1-9 0) (< v1-9 512) (> a0-4 0) (< a0-4 416) (draw-sprite2d-xy + s5-0 + (+ (the int (+ -1792.0 (-> s4-0 x))) -3) + (+ (the int (+ -1840.0 (-> s4-0 y))) -3) + 7 + 7 + (new 'static 'rgba :r #x80 :a #xff) + #x3fffff + ) + ) + ) + ) + ) + (let ((a3-1 (-> s5-0 base))) + (when (!= gp-0 a3-1) + (let ((v1-18 (the-as object (-> s5-0 base)))) + (set! (-> (the-as dma-packet v1-18) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-18) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-18) vif1) (new 'static 'vif-tag)) + (set! (-> s5-0 base) (&+ (the-as pointer v1-18) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id debug-no-zbuf1) + gp-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + ) + +(defstate idle (nav-mesh-editor) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('exit) + (deactivate self) + ) + (('menu) + (let ((v0-0 (the-as object (+ (current-time) (the-as time-frame (-> block param 0)))))) + (set! (-> self close-menu-time) (the-as time-frame v0-0)) + v0-0 + ) + ) + (('new-nav-mesh) + (dotimes (v1-4 32) + (let ((a0-12 (-> self nav-meshes data v1-4))) + (when (logtest? (-> a0-12 flags) (nav-mesh-editable-flag nmef0)) + (logclear! (-> a0-12 flags) (nav-mesh-editable-flag nmef0)) + (set! (-> a0-12 level-id) (-> self level-id)) + (set! (-> self current-nav-mesh) a0-12) + (return #f) + ) + ) + ) + #f + ) + (('delete-nav-mesh) + (let ((v1-9 (-> block param 0))) + (dotimes (a0-15 32) + (let ((gp-0 (-> self nav-meshes data a0-15))) + (when (and (not (logtest? (-> gp-0 flags) (nav-mesh-editable-flag nmef0))) (= (-> gp-0 navmesh-id) v1-9)) + (if (= (-> self current-nav-mesh) gp-0) + (set! (-> self current-nav-mesh) #f) + ) + (nav-mesh-editable-method-18 gp-0) + (logior! (-> gp-0 flags) (nav-mesh-editable-flag nmef0)) + (return #f) + ) + ) + ) + ) + (format #t "nav mesh not found~%") + ) + (('translate-nav-mesh) + (let ((s5-0 (-> block param 0)) + (f30-0 (the-as float (-> block param 1))) + (f28-0 (the-as float (-> block param 2))) + (f26-0 (the-as float (-> block param 3))) + ) + (dotimes (s4-0 32) + (let ((gp-1 (-> self nav-meshes data s4-0))) + (format #t "~D~%" (-> gp-1 navmesh-id)) + (when (and (not (logtest? (-> gp-1 flags) (nav-mesh-editable-flag nmef0))) (= (-> gp-1 navmesh-id) s5-0)) + (format #t "nav mesh not found~%") + (dotimes (v1-30 (-> gp-1 verts length)) + (+! (-> gp-1 verts data v1-30 x) f30-0) + (+! (-> gp-1 verts data v1-30 y) f28-0) + (+! (-> gp-1 verts data v1-30 z) f26-0) + ) + (nav-mesh-editable-method-17 gp-1) + (return #f) + ) + ) + ) + ) + #f + ) + (('rotate-nav-mesh) + (let ((f30-1 (the-as float (-> block param 0)))) + (dotimes (gp-2 32) + (let ((s5-1 (-> self nav-meshes data gp-2))) + (when (not (logtest? (-> s5-1 flags) (nav-mesh-editable-flag nmef0))) + (format #t "nav mesh not found~%") + (dotimes (s4-1 (-> s5-1 verts length)) + (vector-rotate-around-y! (-> s5-1 verts data s4-1) (-> s5-1 verts data s4-1) f30-1) + ) + (nav-mesh-editable-method-17 s5-1) + ) + ) + ) + ) + #f + ) + ) + ) + :trans (behavior () + (when (= (-> *keybd* keys 82) 2) + (let ((v1-2 0)) + (dotimes (a0-2 32) + (case (-> self nav-meshes data a0-2) + (((-> self current-nav-mesh)) + (set! v1-2 a0-2) + (goto cfg-8) + ) + ) + ) + (label cfg-8) + (dotimes (a1-5 32) + (+! v1-2 1) + (if (>= v1-2 32) + (set! v1-2 0) + ) + (let ((a0-11 (-> self nav-meshes data v1-2))) + (when (not (logtest? (-> a0-11 flags) (nav-mesh-editable-flag nmef0))) + (set! (-> self current-nav-mesh) a0-11) + (let ((a1-6 (-> a0-11 selected-poly))) + (vector-copy! + (-> self manipulator position) + (-> a0-11 verts data (-> a0-11 polys data a1-6 index data (-> a0-11 polys data a1-6 insert-pos))) + ) + ) + (goto cfg-17) + ) + ) + ) + ) + ) + (label cfg-17) + (when (= (-> *keybd* keys 81) 2) + (let ((v1-9 0)) + (dotimes (a0-17 32) + (case (-> self nav-meshes data a0-17) + (((-> self current-nav-mesh)) + (set! v1-9 a0-17) + (goto cfg-25) + ) + ) + ) + (label cfg-25) + (dotimes (a1-19 32) + (+! v1-9 -1) + (if (< v1-9 0) + (set! v1-9 31) + ) + (let ((a0-26 (-> self nav-meshes data v1-9))) + (when (not (logtest? (-> a0-26 flags) (nav-mesh-editable-flag nmef0))) + (set! (-> self current-nav-mesh) a0-26) + (let ((a1-20 (-> a0-26 selected-poly))) + (vector-copy! + (-> self manipulator position) + (-> a0-26 verts data (-> a0-26 polys data a1-20 index data (-> a0-26 polys data a1-20 insert-pos))) + ) + ) + (goto cfg-34) + ) + ) + ) + ) + ) + (label cfg-34) + (when (= (-> *keybd* keys 19) 2) + (set! (-> self allow-snap) (not (-> self allow-snap))) + (format #t "navmesh snap ~A~%" (-> self allow-snap)) + ) + (if (= (-> *keybd* keys 24) 2) + (nav-mesh-editor-method-27 self) + ) + (if (= (-> *keybd* keys 21) 2) + (nav-mesh-editor-method-26 self) + ) + (if (= (-> *keybd* keys 11) 2) + (set! (-> self hide-unselected) (not (-> self hide-unselected))) + ) + (when (-> self current-nav-mesh) + (let ((v1-33 (-> self current-nav-mesh)) + (a0-41 (the-as object -1)) + ) + (when (= (-> *keybd* keys 40) 2) + (dotimes (a1-31 92) + (when (< (-> v1-33 polys data a1-31 index length) 3) + (set! (-> v1-33 polys data a1-31 index length) 0) + (set! (-> v1-33 polys data a1-31 insert-pos) (the-as uint 0)) + (if (= (the-as int a0-41) -1) + (set! a0-41 a1-31) + ) + ) + ) + (set! a0-41 (cond + ((!= (the-as int a0-41) -1) + (set! (-> v1-33 selected-poly) (the-as uint a0-41)) + a0-41 + ) + (else + (format #t "increase MAX_NAV_MESH_POLYS (~D)~%" 92) + ) + ) + ) + ) + ) + ) + (nav-mesh-editor-method-22 self) + (when (not (-> self lock-action)) + (manipulator-method-10 (-> self manipulator) (-> self mouse-pos) (-> self mouse-end)) + (set! (-> self mouse-action) (the-as uint 0)) + (cond + ((or (logtest? (-> *keybd* keys 0) 4) (logtest? (-> *keybd* keys 0) 64)) + (set! (-> self manipulator action) (manipulator-action ma0)) + (set! (-> self mouse-action) (the-as uint 1)) + (when (mouse-pressed? left) + (when (not (time-elapsed? (-> self mouse-pressed) (seconds 0.2))) + (vector-copy! (-> self mouse-tumble) (-> self mouse-hit)) + (set! (-> self mouse-tumble w) 40960.0) + (send-event *camera* 'point-of-interest (-> self mouse-tumble)) + ) + (set-time! (-> self mouse-pressed)) + ) + ) + (else + (if (nonzero? (-> self manipulator action)) + (set! (-> self mouse-action) (the-as uint 2)) + ) + ) + ) + ) + (if (-> self current-nav-mesh) + (manipulator-method-11 (-> self manipulator)) + ) + (when (and (= (-> *keybd* keys 22) 2) (or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16))) + (dotimes (gp-0 32) + (let ((a0-59 (-> self nav-meshes data gp-0))) + (if (not (logtest? (-> a0-59 flags) (nav-mesh-editable-flag nmef0))) + (nav-mesh-editable-method-16 a0-59) + ) + ) + ) + ) + (when (and (or (logtest? (-> *keybd* keys 0) 2) (logtest? (-> *keybd* keys 0) 32)) (mouse-pressed? left)) + (dotimes (gp-1 32) + (let ((s5-0 (-> self nav-meshes data gp-1))) + (when (not (logtest? (-> s5-0 flags) (nav-mesh-editable-flag nmef0))) + (let ((a0-68 (nav-mesh-editable-method-14 s5-0 (-> self mouse-screen-pos)))) + (when (and (or (= s5-0 (-> self current-nav-mesh)) (not (-> self hide-unselected))) (>= a0-68 0)) + (set! (-> s5-0 selected-poly) (the-as uint a0-68)) + (vector-copy! + (-> self manipulator position) + (-> s5-0 verts data (-> s5-0 polys data a0-68 index data (-> s5-0 polys data a0-68 insert-pos))) + ) + (set! (-> self current-nav-mesh) s5-0) + ) + ) + ) + ) + ) + ) + (let ((gp-2 #f)) + (vector-copy! (-> self mouse-snap) (-> self mouse-hit)) + (when (-> self allow-snap) + (dotimes (s5-1 32) + (let ((s4-0 (-> self nav-meshes data s5-1))) + (when (and (not (logtest? (-> s4-0 flags) (nav-mesh-editable-flag nmef0))) + (or (= s4-0 (-> self current-nav-mesh)) (not (-> self hide-unselected))) + ) + (let ((a0-83 + (the-as int (nav-mesh-editable-method-12 s4-0 (-> self mouse-screen-pos) (= (-> self current-nav-mesh) s4-0))) + ) + ) + (when (>= a0-83 0) + (vector-copy! (-> self mouse-hit) (-> s4-0 verts data a0-83)) + (set! gp-2 #t) + (set! (-> self mouse-collide) (the-as basic #t)) + ) + ) + ) + ) + ) + (when *display-nav-marks* + (let ((s5-2 (new 'stack-no-clear 'vector))) + (when (snap-level-navmesh (-> self mouse-screen-pos) s5-2) + (vector-copy! (-> self mouse-hit) s5-2) + (set! gp-2 #t) + (set! (-> self mouse-collide) (the-as basic #t)) + ) + ) + ) + (if gp-2 + (draw-square-point (-> self mouse-hit)) + ) + ) + ) + (format *stdcon* "level ~S~%" (-> self level-name)) + (let ((gp-3 (-> self current-nav-mesh))) + (when gp-3 + (let ((s5-3 (-> gp-3 polys data (-> gp-3 selected-poly))) + (s4-1 (the-as int (nav-mesh-editable-method-12 gp-3 (-> self mouse-screen-pos) #t))) + ) + -1 + (format *stdcon* "polycount = ~D~%" (+ (-> gp-3 tris length) (-> gp-3 quads length))) + (format *stdcon* "~D~%" (-> gp-3 verts length)) + (format *stdcon* "nav mesh id ~D~%" (-> gp-3 navmesh-id)) + (cond + ((= (-> *keybd* keys 76) 2) + (when (nonzero? (-> s5-3 index length)) + (nav-mesh-editor-method-25 self) + (nav-mesh-poly-method-12 s5-3 (the-as int (-> s5-3 insert-pos))) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + (nav-mesh-editable-method-17 gp-3) + ) + ) + ((= (-> *keybd* keys 6) 2) + (when (nonzero? (-> s5-3 index length)) + (when (>= s4-1 0) + (let ((a1-57 -1)) + (dotimes (v1-164 92) + (when (< (-> gp-3 polys data v1-164 index length) 3) + (set! (-> gp-3 polys data v1-164 index length) 0) + (set! (-> gp-3 polys data v1-164 insert-pos) (the-as uint 0)) + (if (= a1-57 -1) + (set! a1-57 v1-164) + ) + ) + ) + (cond + ((= a1-57 -1) + (format #t "increase MAX_NAV_MESH_POLYS (~D)~%" 92) + ) + (else + (let ((v1-169 (the-as int (-> s5-3 insert-pos))) + (s1-0 0) + (s3-0 0) + (a0-126 #f) + (s2-0 (-> gp-3 polys data a1-57)) + ) + (dotimes (a1-61 (+ (-> s5-3 index length) 1)) + (cond + ((not a0-126) + (set! (-> *clean-index-array* s1-0) (-> s5-3 index data v1-169)) + (when (= (-> s5-3 index data v1-169) s4-1) + (set! a0-126 #t) + (+! a1-61 -1) + (+! v1-169 -1) + ) + (+! s1-0 1) + ) + (else + (set! (-> s2-0 index data s3-0) (-> s5-3 index data v1-169)) + (+! s3-0 1) + ) + ) + (+! v1-169 1) + (if (= v1-169 (-> s5-3 index length)) + (set! v1-169 0) + ) + ) + (when (and (>= s1-0 3) (>= s3-0 3)) + (nav-mesh-editor-method-25 self) + (dotimes (v1-176 s1-0) + (set! (-> s5-3 index data v1-176) (-> *clean-index-array* v1-176)) + ) + (set! (-> s5-3 index length) s1-0) + (set! (-> s5-3 insert-pos) (the-as uint 0)) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + (set! (-> s2-0 index length) s3-0) + (set! (-> s2-0 insert-pos) (the-as uint 0)) + 0 + ) + ) + (nav-mesh-editable-method-17 gp-3) + ) + ) + ) + ) + ) + ) + ((= (-> *keybd* keys 79) 2) + (when (nonzero? (-> s5-3 index length)) + (set! (-> s5-3 insert-pos) (the-as uint (mod (the-as int (+ (-> s5-3 insert-pos) 1)) (-> s5-3 index length)))) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + ((= (-> *keybd* keys 80) 2) + (when (nonzero? (-> s5-3 index length)) + (set! (-> s5-3 insert-pos) + (the-as uint (mod (+ (-> s5-3 index length) -1 (-> s5-3 insert-pos)) (-> s5-3 index length))) + ) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + ((or (mouse-hold? left) (mouse-hold? right) (mouse-hold? middle)) + (when (not (-> self lock-action)) + (when (= (-> self mouse-action) 2) + (nav-mesh-editor-method-25 self) + (manipulator-method-12 (-> self manipulator) (-> self mouse-end)) + ) + (vector-copy! (-> self mouse-action-pos-ref) (-> self mouse-end)) + (vector-copy! (-> self manipulator-back-pos) (-> self manipulator-pos)) + ) + (set! (-> self lock-action) (the-as basic #t)) + ) + (else + (when (-> self lock-action) + (when (-> self manipulator dragging?) + (manipulator-method-14 (-> self manipulator)) + (nav-mesh-editable-method-17 gp-3) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + (set! (-> self lock-action) #f) + ) + ) + (cond + ((or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16)) + (set-setting! 'mouse-input 'abs #f 0) + (when (>= s4-1 0) + (vector-copy! (-> self mouse-hit) (-> gp-3 verts data s4-1)) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> self mouse-hit) (meters 1) *color-red*) + (nav-mesh-poly-method-13 s5-3 s4-1) + ) + (if (nonzero? (-> s5-3 index length)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos))) + (meters 1) + *color-blue* + ) + ) + (when (mouse-pressed? left) + (when (-> self mouse-collide) + (nav-mesh-editor-method-25 self) + (if (>= s4-1 0) + (nav-mesh-poly-method-11 s5-3 s4-1) + (nav-mesh-poly-method-11 s5-3 (add-vert! gp-3 (-> self mouse-hit))) + ) + (nav-mesh-editable-method-17 gp-3) + ) + ) + (if (> (-> s5-3 index length) 0) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + ((= (-> self mouse-action) 1) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= (-> self mouse-action) 2) + (set-setting! 'mouse-input 'abs #f 0) + (when (mouse-hold? left) + (manipulator-method-13 (-> self manipulator) (-> self mouse-pos) (-> self mouse-end)) + (if (and (= (-> self manipulator action) (manipulator-action ma7)) (-> self mouse-collide)) + (vector-copy! (-> self manipulator position) (-> self mouse-hit)) + ) + (when (= (-> self manipulator action) (manipulator-action ma7)) + (if (and (-> self allow-snap) + (>= s4-1 0) + (> (-> s5-3 index length) 0) + (!= s4-1 (-> s5-3 index data (-> s5-3 insert-pos))) + ) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data s4-1)) + ) + ) + ) + (if (> (-> s5-3 index length) 0) + (vector-copy! (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos))) (-> self manipulator position)) + ) + ) + ((zero? (-> self mouse-action)) + (set-setting! 'mouse-input 'abs #f 0) + (when (mouse-pressed? left) + (let ((a1-90 (nav-mesh-editable-method-12 gp-3 (-> self mouse-screen-pos) #t)) + (a0-232 -1) + ) + (if (>= (the-as int a1-90) 0) + (set! a0-232 (nav-mesh-poly-method-13 s5-3 (the-as int a1-90))) + ) + (when (>= a0-232 0) + (set! (-> s5-3 insert-pos) (the-as uint a0-232)) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + ) + ) + (else + (set-setting! 'mouse-input 'abs #f 0) + ) + ) + ) + ) + ) + (dotimes (gp-4 32) + (let ((v1-329 (-> self nav-meshes data gp-4))) + (when (or (= v1-329 (-> self current-nav-mesh)) (not (-> self hide-unselected))) + (if (not (logtest? (-> v1-329 flags) (nav-mesh-editable-flag nmef0))) + (nav-mesh-editable-method-10 v1-329 (= v1-329 (-> self current-nav-mesh))) + ) + ) + ) + ) + ) + :code (behavior () + (set-setting! 'mouse-input 'abs #t 0) + (until #f + (suspend) + ) + #f + ) + :post (behavior () + '() + ) + ) + +(defun get-level-id ((arg0 string)) + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "select level_info_id from level_info where name='~S'" arg0) + (let ((a2-1 (sql-query s5-0))) + (when (!= (-> a2-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A~%" a2-1) + (return (the-as int #f)) + ) + (string->int (the-as string (-> a2-1 sql-data 0))) + ) + ) + ) + +(defmethod set-level-info! ((this nav-mesh-editor) (arg0 symbol)) + (set! (-> this level-id) (the-as uint (get-level-id (the-as string arg0)))) + (set! (-> this level-name) (the-as string arg0)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod select-nav-mesh-by-id ((this nav-mesh-editor) (arg0 int)) + (set! (-> this undo-id) (the-as uint 0)) + (set! (-> this undo-min) (the-as uint 0)) + (set! (-> this undo-max) (the-as uint 0)) + (dotimes (s4-0 (-> this nav-meshes length)) + (init-fields! (-> this nav-meshes data s4-0)) + (set! (-> this nav-meshes data s4-0 level-id) (the-as uint 0)) + (set! (-> this nav-meshes data s4-0 navmesh-id) (the-as uint 0)) + (logior! (-> this nav-meshes data s4-0 flags) (nav-mesh-editable-flag nmef0)) + ) + (let ((s4-1 (clear *temp-string*))) + (format + s4-1 + "select distinct entity.entity_id from entity,navmesh_poly where entity.entity_id=navmesh_poly.entity_id and entity.name='nav-mesh' and entity.level_id=~D~%" + arg0 + ) + (let ((s4-2 (sql-query s4-1))) + (when (!= (-> s4-2 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s4-2 this) + (return (the-as object #f)) + ) + (let ((s3-0 0)) + 0 + (while (< s3-0 (-> s4-2 length)) + (let ((s2-0 (string->int (the-as string (-> s4-2 sql-data s3-0))))) + (dotimes (v1-23 32) + (let ((a0-20 (-> this nav-meshes data v1-23))) + (when (logtest? (-> a0-20 flags) (nav-mesh-editable-flag nmef0)) + (set! (-> a0-20 level-id) (the-as uint arg0)) + (nav-mesh-editable-method-15 a0-20 s2-0) + (set! v1-23 32) + ) + ) + ) + ) + (+! s3-0 1) + ) + ) + ) + ) + 0 + ) + +;; WARN: Function (method 25 nav-mesh-editor) has a return type of none, but the expression builder found a return statement. +(defmethod nav-mesh-editor-method-25 ((this nav-mesh-editor)) + (if (not (-> this current-nav-mesh)) + (return #f) + ) + (let ((v1-7 (-> this undos data (logand (-> this undo-id) 31)))) + (set! (-> v1-7 current-nav-mesh) (-> this current-nav-mesh)) + (let ((a1-2 (-> this current-nav-mesh))) + (set! (-> v1-7 selected-poly) (-> a1-2 selected-poly)) + (let ((t0-0 0)) + (dotimes (a2-1 (-> a1-2 polys length)) + (let ((a3-2 (-> a1-2 polys data a2-1))) + (set! (-> v1-7 index data t0-0) (-> a3-2 index length)) + (let ((t0-1 (+ t0-0 1))) + (dotimes (t1-3 (-> a3-2 index length)) + (set! (-> v1-7 index data t0-1) (-> a3-2 index data t1-3)) + (+! t0-1 1) + ) + (set! (-> v1-7 index data t0-1) (the-as int (-> a3-2 insert-pos))) + (set! t0-0 (+ t0-1 1)) + ) + ) + ) + ) + (set! (-> v1-7 verts length) (-> a1-2 verts length)) + (dotimes (a2-6 (-> a1-2 verts length)) + (vector-copy! (-> v1-7 verts data a2-6) (-> a1-2 verts data a2-6)) + ) + ) + ) + (+! (-> this undo-id) 1) + (set! (-> this undo-max) (-> this undo-id)) + (while (< (the-as uint 31) (- (-> this undo-id) (-> this undo-min))) + (+! (-> this undo-min) 1) + ) + 0 + (none) + ) + +;; WARN: Function (method 26 nav-mesh-editor) has a return type of none, but the expression builder found a return statement. +(defmethod nav-mesh-editor-method-26 ((this nav-mesh-editor)) + (if (>= (-> this undo-id) (-> this undo-max)) + (return #f) + ) + (+! (-> this undo-id) 1) + (let ((v1-10 (-> this undos data (logand (+ (-> this undo-id) -1) 31)))) + (set! (-> this current-nav-mesh) (-> v1-10 current-nav-mesh)) + (let ((a0-1 (-> this current-nav-mesh))) + (set! (-> a0-1 selected-poly) (-> v1-10 selected-poly)) + (let ((a3-0 0)) + (dotimes (a1-4 (-> a0-1 polys length)) + (let ((a2-2 (-> a0-1 polys data a1-4))) + (set! (-> a2-2 index length) (-> v1-10 index data a3-0)) + (let ((a3-1 (+ a3-0 1))) + (dotimes (t0-4 (-> a2-2 index length)) + (set! (-> a2-2 index data t0-4) (-> v1-10 index data a3-1)) + (+! a3-1 1) + ) + (set! (-> a2-2 insert-pos) (the-as uint (-> v1-10 index data a3-1))) + (set! a3-0 (+ a3-1 1)) + ) + ) + ) + ) + (set! (-> a0-1 verts length) (-> v1-10 verts length)) + (dotimes (a1-9 (-> a0-1 verts length)) + (vector-copy! (-> a0-1 verts data a1-9) (-> v1-10 verts data a1-9)) + ) + (nav-mesh-editable-method-17 a0-1) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-editor-method-27 ((this nav-mesh-editor)) + (if (>= (-> this undo-min) (-> this undo-id)) + (return (the-as object #f)) + ) + (let ((v1-8 (-> this undos data (logand (+ (-> this undo-id) -1) 31)))) + (set! (-> this current-nav-mesh) (-> v1-8 current-nav-mesh)) + (let ((s5-0 (-> this current-nav-mesh))) + (set! (-> s5-0 selected-poly) (-> v1-8 selected-poly)) + (let ((a2-0 0)) + (dotimes (a0-5 (-> s5-0 polys length)) + (let ((a1-2 (-> s5-0 polys data a0-5))) + (set! (-> a1-2 index length) (-> v1-8 index data a2-0)) + (let ((a2-1 (+ a2-0 1))) + (dotimes (a3-4 (-> a1-2 index length)) + (set! (-> a1-2 index data a3-4) (-> v1-8 index data a2-1)) + (+! a2-1 1) + ) + (set! (-> a1-2 insert-pos) (the-as uint (-> v1-8 index data a2-1))) + (set! a2-0 (+ a2-1 1)) + ) + ) + ) + ) + (set! (-> s5-0 verts length) (-> v1-8 verts length)) + (dotimes (a0-10 (-> s5-0 verts length)) + (vector-copy! (-> s5-0 verts data a0-10) (-> v1-8 verts data a0-10)) + ) + (nav-mesh-editable-method-17 s5-0) + (let ((a0-13 (-> s5-0 polys data (-> s5-0 selected-poly)))) + (vector-copy! (-> this manipulator position) (-> s5-0 verts data (-> a0-13 index data (-> a0-13 insert-pos)))) + ) + ) + ) + (+! (-> this undo-id) -1) + 0 + ) + +(defmethod deactivate ((this nav-mesh-editor)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (set! *nav-mesh-editor* (the-as (pointer nav-mesh-editor) #f)) + ((method-of-type process-drawable deactivate) this) + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-new () + (if *nav-mesh-editor* + (send-event (ppointer->process *nav-mesh-editor*) 'new-nav-mesh) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun nav-delete ((arg0 int)) + (if *nav-mesh-editor* + (send-event (ppointer->process *nav-mesh-editor*) 'delete-nav-mesh arg0) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-translate ((arg0 int) (arg1 float) (arg2 float) (arg3 float)) + (if *nav-mesh-editor* + (send-event (ppointer->process *nav-mesh-editor*) 'translate-nav-mesh arg0 arg1 arg2 arg3) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-rotate-y ((arg0 float)) + (if *nav-mesh-editor* + (send-event (ppointer->process *nav-mesh-editor*) 'rotate-nav-mesh arg0) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-load ((arg0 string)) + (when *nav-mesh-editor* + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "select level_info_id from level_info where name='~S'" arg0) + (let ((a2-1 (sql-query s5-0))) + (when (!= (-> a2-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A~%" a2-1) + (return (the-as object #f)) + ) + (select-nav-mesh-by-id (-> *nav-mesh-editor* 0) (string->int (the-as string (-> a2-1 sql-data 0)))) + ) + ) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-set-level ((arg0 symbol)) + (if *nav-mesh-editor* + (set-level-info! (-> *nav-mesh-editor* 0) arg0) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun nav-set-lev ((arg0 string)) + (when (and *nav-mesh-editor* (-> *nav-mesh-editor* 0 current-nav-mesh)) + (let ((gp-0 (-> *nav-mesh-editor* 0 current-nav-mesh))) + (set! (-> gp-0 level-id) (the-as uint (get-level-id arg0))) + ) + ) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun nav-set-flag ((arg0 nav-mesh-poly-flag)) + (when (and *nav-mesh-editor* (-> *nav-mesh-editor* 0 current-nav-mesh)) + (let ((a1-0 (-> *nav-mesh-editor* 0 current-nav-mesh))) + (set! (-> a1-0 polys data (-> a1-0 selected-poly) flags) arg0) + ) + ) + 0 + ) + +(defbehavior nav-mesh-editor-init nav-mesh-editor ((arg0 symbol)) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + (set! *display-actor-marks* #f) + (if (not arg0) + (set! arg0 (-> (level-get-target-inside *level*) name)) + ) + (logclear! (-> self mask) (process-mask freeze pause menu)) + (+! (-> self clock ref-count) -1) + (+! (-> *display* real-clock ref-count) 1) + (set! (-> self clock) (-> *display* real-clock)) + (add-setting! 'mouse #t 0.0 0) + (add-setting! 'cursor #t 0.0 0) + (add-setting! 'keybd #t 0.0 0) + (set! *nav-mesh-editor* (the-as (pointer nav-mesh-editor) (process->ppointer self))) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (set! (-> self external-cam-mode) *external-cam-mode*) + (set! *external-cam-mode* 'pad-1) + (matrix-identity! (-> self manipulator mat)) + (set! (-> self manipulator-pos quad) (the-as uint128 0)) + (set-level-info! self arg0) + (set! (-> self nav-meshes) (new 'debug 'nav-mesh-editable-array 32)) + (dotimes (s5-0 (-> self nav-meshes length)) + (init-fields! (-> self nav-meshes data s5-0)) + (set! (-> self nav-meshes data s5-0 level-id) (the-as uint 0)) + ) + (set! (-> self undos) (new 'debug 'nav-mesh-editor-undo-array 32)) + (dotimes (s5-1 (-> self undos length)) + (init-fields! (-> self undos data s5-1)) + ) + (set! (-> self undo-id) (the-as uint 0)) + (set! (-> self undo-min) (the-as uint 0)) + (set! (-> self undo-max) (the-as uint 0)) + (set! (-> self current-nav-mesh) #f) + (set! (-> self lock-action) #f) + (set! (-> self hide-unselected) #f) + (set! (-> self allow-snap) #t) + (nav-mesh-editor-load (the-as string arg0)) + (go-virtual idle) + ) diff --git a/goal_src/jak3/engine/debug/nav/mysql-nav-graph.gc b/goal_src/jak3/engine/debug/nav/mysql-nav-graph.gc index b9dd54228a..1e84935919 100644 --- a/goal_src/jak3/engine/debug/nav/mysql-nav-graph.gc +++ b/goal_src/jak3/engine/debug/nav/mysql-nav-graph.gc @@ -51,11 +51,13 @@ "This string value is stored in their SQL database" :type uint32 :bitfield #t - (visited 0) - (blocked 1) - (pedestrian 2) - (selected 3) - (hidden 4) + (blocker 0) + (pov 1) + (visited 2) + (blocked 3) + (pedestrian 4) + (selected 5) + (hidden 6) ) ;; ---nav-node-flag @@ -70,6 +72,21 @@ ) ;; ---mysql-save-flag +;; +++mysql-nav-graph:nav-minimap-edge-flag +(defenum nav-minimap-edge-flag + "This string value is stored in their SQL database" + :type int32 + :bitfield #t + (blocker 0) + (one-way 1) + (pass-port-mh 2) + (pass-port-inda 3) + (pass-inda-indb 4) + (pass-indb-sluma 5) + (pass-slumb-genb 6) + ) +;; ---mysql-nav-graph:nav-minimap-edge-flag + (declare-type mysql-nav-edge structure) @@ -130,11 +147,11 @@ (nav_territory_type uint32) (exclusive_data uint32) (width float) - (minimap_edge_flag int32) + (minimap_edge_flag nav-minimap-edge-flag) ) :allow-misaligned (:methods - (mysql-nav-edge-method-9 () none) + (exec-sql! (_type_) symbol) ) ) @@ -157,7 +174,7 @@ (nav_edge_id uint32) ) (:methods - (mysql-nav-visnode-method-9 () none) + (exec-sql! (_type_) symbol) ) ) @@ -190,11 +207,11 @@ (deftype mysql-nav-graph (basic) ((nav_graph_id uint32) - (graph-type basic) + (graph-type symbol) (node-array mysql-nav-node-array) (edge-array mysql-nav-edge-array) (visnode-array mysql-nav-visnode-array) - (pov-conn-array uint32) + (pov-conn-array (inline-array mysql-nav-pov-conn)) (pov-conn-array-length int32) (level-info-array-length int32) (level-info-last-lookup int32) @@ -202,20 +219,1191 @@ ) (:methods (new (symbol type string) _type_) - (init-from-sql! (_type_ string string) symbol) + (init-from-sql! (_type_ symbol string) symbol) (exec-sql! (_type_) symbol) (indexof-nav-node (_type_ int) int) (indexof-nav-edge (_type_ int) int) - (mysql-nav-graph-method-13 (_type_) none) - (mysql-nav-graph-method-14 (_type_) none) - (mysql-nav-graph-method-15 (_type_) none) - (mysql-nav-graph-method-16 (_type_) none) + (alloc-new-node! (_type_) int) + (alloc-new-edge! (_type_) int) + (indexof-visnode (_type_ int int) int) + (alloc-new-visnode! (_type_ int int) int) (mysql-nav-graph-method-17 (_type_) none) (lookup-level-info2 (_type_ mysql-nav-node symbol) mysql-nav-graph-level-info) - (mysql-nav-graph-method-19 (_type_) none) + (mysql-nav-graph-method-19 (_type_) int) (mysql-nav-graph-method-20 (_type_) none) - (mysql-nav-graph-method-21 (_type_) none) - (mysql-nav-graph-method-22 (_type_) none) - (mysql-nav-graph-method-23 (_type_) none) + (get-graph-type (_type_ symbol) symbol) + (mysql-nav-graph-method-22 (_type_) int) + (mysql-nav-graph-method-23 (_type_ vector vector) symbol) + ) + ) + + +;; WARN: Return type mismatch object vs mysql-nav-graph. +(defmethod new mysql-nav-graph ((allocation symbol) (type-to-make type) (arg0 string)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (if (zero? gp-0) + (return (the-as mysql-nav-graph 0)) + ) + (set! (-> gp-0 node-array) (new 'debug 'mysql-nav-node-array 3000)) + (set! (-> gp-0 node-array length) 0) + (set! (-> gp-0 edge-array) (new 'debug 'mysql-nav-edge-array 5000)) + (set! (-> gp-0 edge-array length) 0) + (set! (-> gp-0 visnode-array) (new 'debug 'mysql-nav-visnode-array 3000)) + (set! (-> gp-0 visnode-array length) 0) + (set! (-> gp-0 pov-conn-array) (the-as (inline-array mysql-nav-pov-conn) (malloc 'debug #x3e80))) + (set! (-> gp-0 pov-conn-array-length) 0) + (set! (-> gp-0 graph-type) (get-graph-type gp-0 (the-as symbol arg0))) + (let ((s4-0 (clear *temp-string*))) + (format *temp-string* "select nav_graph_id from nav_graph where name='~S'" arg0) + (format 0 "~S~%" *temp-string*) + (let ((a2-7 (sql-query s4-0))) + (when (not (and (= (-> a2-7 content-type) 'select) (> (-> a2-7 length) 0))) + (format 0 "ERROR: sql: select error ~A for ~A~%" a2-7 gp-0) + (return (the-as mysql-nav-graph #f)) + ) + (set! (-> gp-0 nav_graph_id) (the-as uint (string->int (the-as string (-> a2-7 sql-data 0))))) + ) + ) + gp-0 + ) + ) + +(defmethod get-graph-type ((this mysql-nav-graph) (arg0 symbol)) + (case arg0 + (('minimap 'wasminimap) + 'minimap + ) + (else + 'unknown + ) + ) + ) + +(defmethod alloc-new-node! ((this mysql-nav-graph)) + (cond + ((>= (-> this node-array length) 3000) + (format #t "mysql-nav-graph : nodes buffer too small, increase NAV_GRAPH_EDITOR_NODE_COUNT~%") + -1 + ) + (else + (let ((gp-0 (-> this node-array data (-> this node-array length))) + (s5-0 (-> this node-array length)) + ) + (+! (-> this node-array length) 1) + (set! (-> gp-0 mysql-save-flag) (mysql-save-flag)) + (logior! (-> gp-0 mysql-save-flag) (mysql-save-flag insert)) + (set! (-> gp-0 runtime-id) (the-as uint s5-0)) + (set! (-> gp-0 nav_graph_id) (-> this nav_graph_id)) + (set! (-> gp-0 level_name) (-> (level-get-target-inside *level*) name)) + s5-0 + ) + ) + ) + ) + +(defmethod alloc-new-edge! ((this mysql-nav-graph)) + (cond + ((>= (-> this edge-array length) 5000) + (format #t "mysql-nav-graph : edges buffer too small, increase NAV_GRAPH_EDITOR_EDGE_COUNT~%") + -1 + ) + (else + (let ((v1-5 (-> this edge-array data (-> this edge-array length))) + (v0-1 (-> this edge-array length)) + ) + (+! (-> this edge-array length) 1) + (set! (-> v1-5 mysql-save-flag) (mysql-save-flag)) + (logior! (-> v1-5 mysql-save-flag) (mysql-save-flag insert)) + (set! (-> v1-5 runtime-id) (the-as uint v0-1)) + (set! (-> v1-5 nav_graph_id) (-> this nav_graph_id)) + (set! (-> v1-5 directionality) (nav-directionality default)) + v0-1 + ) + ) + ) + ) + +(defmethod indexof-visnode ((this mysql-nav-graph) (arg0 int) (arg1 int)) + (dotimes (v1-0 (-> this visnode-array length)) + (let ((a3-2 (-> this visnode-array data v1-0))) + (if (and (= (-> a3-2 runtime-edge-id) arg0) (= (-> a3-2 runtime-node-id) arg1)) + (return v1-0) + ) + ) + ) + -1 + ) + +(defmethod alloc-new-visnode! ((this mysql-nav-graph) (arg0 int) (arg1 int)) + (cond + ((>= (-> this visnode-array length) 3000) + (format #t "mysql-nav-graph : visnodes buffer too small, increase NAV_GRAPH_EDITOR_VISNODE_COUNT~%") + -1 + ) + (else + (let ((v1-3 (indexof-visnode this arg0 arg1))) + (when (>= v1-3 0) + (logclear! (-> this visnode-array data v1-3 mysql-save-flag) (mysql-save-flag delete)) + (return v1-3) + ) + ) + (let ((v1-9 (-> this visnode-array data (-> this visnode-array length))) + (v0-1 (-> this visnode-array length)) + ) + (+! (-> this visnode-array length) 1) + (set! (-> v1-9 mysql-save-flag) (mysql-save-flag)) + (logior! (-> v1-9 mysql-save-flag) (mysql-save-flag insert)) + (set! (-> v1-9 runtime-edge-id) arg0) + (set! (-> v1-9 runtime-node-id) arg1) + (set! (-> v1-9 nav_graph_id) (-> this nav_graph_id)) + v0-1 + ) + ) + ) + ) + +(defmethod exec-sql! ((this mysql-nav-node)) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag delete)) + ) + (return #t) + ) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (let ((s5-0 (clear *temp-string*))) + (case (-> this mysql-save-flag) + (((mysql-save-flag insert)) + (format s5-0 "insert nav_node set ") + ) + (((mysql-save-flag update)) + (format s5-0 "update nav_node set ") + ) + (((mysql-save-flag delete)) + (format s5-0 "delete from nav_node where ") + ) + ) + (case (-> this mysql-save-flag) + ((8 4) + (format s5-0 "nav_graph_id=~D," (-> this nav_graph_id)) + (format s5-0 "x=~M," (-> this position x)) + (format s5-0 "y=~M," (-> this position y)) + (format s5-0 "z=~M," (-> this position z)) + (format s5-0 "level_name='~S'," (-> this level_name)) + (format s5-0 "data_int_0=~D," (-> this data_int_0)) + (format s5-0 "data_int_1=~D," (-> this data_int_1)) + (format s5-0 "angle=~R," (-> this angle)) + (format s5-0 "radius=~M," (-> this radius)) + (format s5-0 "nav_node_flag='") + (let ((v1-20 #t)) + (when (logtest? (-> this nav_node_flag) (nav-node-flag blocker)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "blocker") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag pov)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "pov") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag visited)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "visited") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag blocked)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "blocked") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag pedestrian)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "pedestrian") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag selected)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "selected") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag hidden)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "hidden") + ) + ) + (format s5-0 "',") + (format s5-0 "nav_mesh_id=~D" (-> this nav_mesh_id)) + (if (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + (format s5-0 " where nav_node_id=~D" (-> this nav_node_id)) + ) + (let ((a2-11 (sql-query s5-0))) + (when (!= (-> a2-11 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-11 this) + (return #f) + ) + ) + (when (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (let ((v1-44 (sql-query "select LAST_INSERT_ID()"))) + (if (= (-> v1-44 content-type) 'select) + (set! (-> this nav_node_id) (the-as uint (string->int (the-as string (-> v1-44 sql-data 0))))) + ) + ) + ) + ) + (((mysql-save-flag delete)) + (format s5-0 "nav_node_id=~D" (-> this nav_node_id)) + (let ((a2-13 (sql-query s5-0))) + (when (!= (-> a2-13 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-13 this) + (return #f) + ) + ) + ) + ) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag insert)) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + #t + ) + +(defmethod exec-sql! ((this mysql-nav-edge)) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag delete)) + ) + (return #t) + ) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (let ((s5-0 (clear *temp-string*))) + (case (-> this mysql-save-flag) + (((mysql-save-flag insert)) + (format s5-0 "insert nav_edge set ") + ) + (((mysql-save-flag update)) + (format s5-0 "update nav_edge set ") + ) + (((mysql-save-flag delete)) + (format s5-0 "delete from nav_edge where ") + ) + ) + (case (-> this mysql-save-flag) + ((8 4) + (format s5-0 "nav_graph_id=~D," (-> this nav_graph_id)) + (format s5-0 "nav_node_id_1=~D," (-> this nav_node_id_1)) + (format s5-0 "nav_node_id_2=~D," (-> this nav_node_id_2)) + (let ((t9-7 format) + (a0-21 s5-0) + (a1-8 "directionality='~S',") + (v1-20 (-> this directionality)) + ) + (t9-7 a0-21 a1-8 (cond + ((= v1-20 (nav-directionality directed)) + "directed" + ) + ((= v1-20 (nav-directionality bi_directional)) + "bi_directional" + ) + (else + "default" + ) + ) + ) + ) + (format s5-0 "speed_limit=~M," (-> this speed_limit)) + (format s5-0 "density=~F," (-> this density)) + (format s5-0 "traffic_edge_flag='") + (let ((v1-21 #t)) + (when (logtest? (-> this traffic_edge_flag) 1) + (if (not v1-21) + (format s5-0 ",") + ) + (format s5-0 "pedestrian") + ) + ) + (format s5-0 "',") + (format s5-0 "nav_clock_mask='") + (let ((v1-24 #t)) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-1)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-1") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-1a)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-1a") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-2)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-2") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-2a)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-2a") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-3)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-3") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-3a)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-3a") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-4)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-4") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-4a)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-4a") + ) + ) + (format s5-0 "',") + (let ((t9-32 format) + (a0-82 s5-0) + (a1-33 "nav_clock_type='~S',") + (v1-41 (-> this nav_clock_type)) + ) + (t9-32 a0-82 a1-33 (cond + ((= v1-41 (nav-clock-type clock2)) + "clock2" + ) + ((= v1-41 (nav-clock-type clock3)) + "clock3" + ) + ((= v1-41 (nav-clock-type clock4)) + "clock4" + ) + (else + "no-clock" + ) + ) + ) + ) + (format s5-0 "nav_territory_type=~D," (-> this nav_territory_type)) + (format s5-0 "exclusive_data=~D," (-> this exclusive_data)) + (format s5-0 "width=~M," (-> this width)) + (format s5-0 "minimap_edge_flag='") + (let ((v1-42 #t)) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "blocker") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag one-way)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "one-way") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-port-mh)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-port-mh") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-port-inda)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-port-inda") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-inda-indb)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-inda-indb") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-indb-sluma)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-indb-sluma") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-slumb-genb)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-slumb-genb") + ) + ) + (format s5-0 "'") + (if (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + (format s5-0 " where nav_edge_id=~D" (-> this nav_edge_id)) + ) + (let ((a2-16 (sql-query s5-0))) + (when (!= (-> a2-16 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-16 this) + (return #f) + ) + ) + (when (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (let ((v1-66 (sql-query "select LAST_INSERT_ID()"))) + (if (= (-> v1-66 content-type) 'select) + (set! (-> this nav_edge_id) (the-as uint (string->int (the-as string (-> v1-66 sql-data 0))))) + ) + ) + ) + ) + (((mysql-save-flag delete)) + (format s5-0 "nav_edge_id=~D" (-> this nav_edge_id)) + (let ((a2-18 (sql-query s5-0))) + (when (!= (-> a2-18 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-18 this) + (return #f) + ) + ) + ) + ) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag insert)) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + #t + ) + +(defmethod exec-sql! ((this mysql-nav-visnode)) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag delete)) + ) + (return #t) + ) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (let ((s5-0 (clear *temp-string*))) + (case (-> this mysql-save-flag) + (((mysql-save-flag insert)) + (format s5-0 "insert nav_visible_nodes set ") + ) + (((mysql-save-flag update)) + (format s5-0 "update nav_visible_nodes set ") + ) + (((mysql-save-flag delete)) + (format s5-0 "delete from nav_visible_nodes where ") + ) + ) + (case (-> this mysql-save-flag) + ((8 4) + (format s5-0 "nav_graph_id=~D," (-> this nav_graph_id)) + (format s5-0 "nav_edge_id=~D," (-> this nav_edge_id)) + (format s5-0 "nav_node_id=~D" (-> this nav_node_id)) + (let ((a2-3 (sql-query s5-0))) + (when (!= (-> a2-3 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-3 this) + (return #f) + ) + ) + ) + (((mysql-save-flag delete)) + (format s5-0 "nav_graph_id=~D and " (-> this nav_graph_id)) + (format s5-0 "nav_edge_id=~D and " (-> this nav_edge_id)) + (format s5-0 "nav_node_id=~D" (-> this nav_node_id)) + (let ((a2-7 (sql-query s5-0))) + (when (!= (-> a2-7 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-7 this) + (return #f) + ) + ) + ) + ) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag insert)) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + #t + ) + +(defmethod indexof-nav-node ((this mysql-nav-graph) (arg0 int)) + (dotimes (v1-0 (-> this node-array length)) + (if (= arg0 (-> this node-array data v1-0 nav_node_id)) + (return v1-0) + ) + ) + -1 + ) + +(defmethod indexof-nav-edge ((this mysql-nav-graph) (arg0 int)) + (dotimes (v1-0 (-> this edge-array length)) + (if (= arg0 (-> this edge-array data v1-0 nav_edge_id)) + (return v1-0) + ) + ) + -1 + ) + +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +(defmethod init-from-sql! ((this mysql-nav-graph) (arg0 symbol) (arg1 string)) + (local-vars (sv-16 string) (sv-32 int) (sv-48 int) (sv-64 int)) + (set! (-> this node-array length) 0) + (set! (-> this edge-array length) 0) + (set! (-> this visnode-array length) 0) + (set! (-> this graph-type) (get-graph-type this arg0)) + (let ((s3-0 (clear *temp-string*))) + (format s3-0 "select nav_graph_id from nav_graph where name='~S'" arg0) + (format 0 "~S~%" s3-0) + (let ((a2-3 (sql-query s3-0))) + (when (!= (-> a2-3 content-type) 'select) + (format 0 "ERROR: sql: select error ~A for ~A~%" a2-3 this) + (return #f) + ) + (set! (-> this nav_graph_id) (the-as uint (string->int (the-as string (-> a2-3 sql-data 0))))) + ) + ) + (format #t "Loading nodes ...~%") + (let ((s4-1 0) + (s3-1 256) + ) + (until #f + (let ((s2-0 (clear *temp-string*))) + (format + s2-0 + "select nav_node_id,x,y,z,level_name,angle,radius,nav_node_flag,nav_mesh_id,nav_graph_id,data_int_0,data_int_1 from nav_node" + ) + (format s2-0 " where nav_graph_id = ~D" (-> this nav_graph_id)) + (if arg1 + (format s2-0 " and level_name='~S'" arg1) + ) + (if (= (-> this nav_graph_id) 20) + (format s2-0 " order by nav_node_id") + ) + (format s2-0 " limit ~D,~D" s4-1 s3-1) + (let ((s2-1 (sql-query s2-0))) + (when (!= (-> s2-1 content-type) 'select) + (format 0 "ERROR: sql: select error ~A for ~A~%" s2-1 this) + (return #f) + ) + (let ((s1-0 0)) + (while (< s1-0 (-> s2-1 length)) + (when (= (string->int (the-as string (-> s2-1 sql-data (+ s1-0 9)))) (-> this nav_graph_id)) + (let ((s0-1 (-> this node-array data (-> this node-array length)))) + (set! (-> s0-1 mysql-save-flag) (mysql-save-flag)) + (set! (-> s0-1 runtime-id) (the-as uint (-> this node-array length))) + (set! (-> s0-1 nav_graph_id) (-> this nav_graph_id)) + (set! (-> s0-1 nav_node_id) (the-as uint (string->int (the-as string (-> s2-1 sql-data s1-0))))) + (set! (-> s0-1 position x) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 1)))))) + (set! (-> s0-1 position y) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 2)))))) + (set! (-> s0-1 position z) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 3)))))) + (set! (-> s0-1 level_name) (string->symbol (the-as string (-> s2-1 sql-data (+ s1-0 4))))) + (set! (-> s0-1 data_int_0) (the-as uint (string->int (the-as string (-> s2-1 sql-data (+ s1-0 10)))))) + (set! (-> s0-1 data_int_1) (the-as uint (string->int (the-as string (-> s2-1 sql-data (+ s1-0 11)))))) + (set! (-> s0-1 angle) (* 182.04445 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 5)))))) + (set! (-> s0-1 radius) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 6)))))) + (set! (-> s0-1 nav_node_flag) (nav-node-flag)) + (set! sv-16 (new 'global 'string 0 (the-as string (-> s2-1 sql-data (+ s1-0 7))))) + (copy-string<-string sv-16 (the-as string (-> s2-1 sql-data (+ s1-0 7)))) + (until #f + (cond + ((string-prefix= "blocker" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocker)) + ) + ((string-prefix= "pov" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag pov)) + ) + ((string-prefix= "visited" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag visited)) + ) + ((string-prefix= "blocked" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocked)) + ) + ((string-prefix= "pedestrian" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag pedestrian)) + ) + ((string-prefix= "selected" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag selected)) + ) + ((string-prefix= "hidden" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag hidden)) + ) + (else + #t + (goto cfg-33) + ) + ) + (let ((a1-22 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) + (if (= (-> a1-22 0) 44) + (set! a1-22 (&-> a1-22 1)) + ) + (string-suck-up! sv-16 a1-22) + ) + ) + #f + (label cfg-33) + (set! (-> s0-1 nav_mesh_id) (the-as uint (string->int (the-as string (-> s2-1 sql-data (+ s1-0 8)))))) + ) + (+! (-> this node-array length) 1) + ) + (+! s1-0 12) + ) + ) + (when (< (-> s2-1 length) (* 10 s3-1)) + #t + (goto cfg-40) + ) + ) + ) + (+! s4-1 s3-1) + ) + ) + #f + (label cfg-40) + (format #t "~D nodes.~%" (-> this node-array length)) + (format #t "Loading edges ...~%") + (let ((s5-1 0) + (s4-2 256) + ) + (until #f + (let ((s3-2 (clear *temp-string*))) + (format + s3-2 + "select nav_edge_id,nav_node_id_1,nav_node_id_2,directionality,speed_limit,density,traffic_edge_flag,nav_clock_mask,nav_territory_type,exclusive_data,width,minimap_edge_flag,nav_graph_id from nav_edge" + ) + (format s3-2 " where nav_graph_id = ~D" (-> this nav_graph_id)) + (format s3-2 " limit ~D,~D" s5-1 s4-2) + (let ((s3-3 (sql-query s3-2))) + (when (!= (-> s3-3 content-type) 'select) + (format 0 "ERROR: sql: select error ~A for ~A~%" s3-3 this) + (return #f) + ) + (let ((s2-2 0)) + (while (< s2-2 (-> s3-3 length)) + (when (= (string->int (the-as string (-> s3-3 sql-data (+ s2-2 12)))) (-> this nav_graph_id)) + (let ((s0-2 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 1)))))) + (set! sv-32 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 2))))) + (set! sv-48 (indexof-nav-node this s0-2)) + (set! sv-64 (indexof-nav-node this sv-32)) + (let ((s1-2 (-> this edge-array data (-> this edge-array length)))) + (when (and (!= sv-48 -1) (!= sv-64 -1)) + (set! (-> s1-2 nav_graph_id) (-> this nav_graph_id)) + (set! (-> s1-2 nav_edge_id) (the-as uint (string->int (the-as string (-> s3-3 sql-data s2-2))))) + (set! (-> s1-2 nav_node_id_1) (the-as uint s0-2)) + (set! (-> s1-2 nav_node_id_2) (the-as uint sv-32)) + (set! (-> s1-2 mysql-save-flag) (mysql-save-flag)) + (set! (-> s1-2 runtime-id) (the-as uint (-> this edge-array length))) + (set! (-> s1-2 runtime-node-id-1) sv-48) + (set! (-> s1-2 runtime-node-id-2) sv-64) + (let ((s0-3 (-> s3-3 sql-data (+ s2-2 3)))) + (cond + ((string= "default" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality default)) + 0 + ) + ((string= "directed" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality directed)) + ) + ((string= "bi_directional" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality bi_directional)) + ) + ) + ) + (set! (-> s1-2 speed_limit) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 4)))))) + (set! (-> s1-2 density) (string->float (the-as string (-> s3-3 sql-data (+ s2-2 5))))) + (set! (-> s1-2 traffic_edge_flag) 0) + (let ((s0-4 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 6)))))) + (copy-string<-string s0-4 (the-as string (-> s3-3 sql-data (+ s2-2 6)))) + (until #f + (cond + ((string-prefix= "pedestrian" s0-4) + (logior! (-> s1-2 traffic_edge_flag) 1) + ) + (else + #t + (goto cfg-64) + ) + ) + (let ((a1-38 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) + (if (= (-> a1-38 0) 44) + (set! a1-38 (&-> a1-38 1)) + ) + (string-suck-up! s0-4 a1-38) + ) + ) + ) + #f + (label cfg-64) + (set! (-> s1-2 nav_clock_mask) (nav-clock-mask)) + (let ((s0-5 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 7)))))) + (copy-string<-string s0-5 (the-as string (-> s3-3 sql-data (+ s2-2 7)))) + (until #f + (cond + ((string-prefix= "phase-1a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1a)) + ) + ((string-prefix= "phase-1" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1)) + ) + ((string-prefix= "phase-2a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2a)) + ) + ((string-prefix= "phase-2" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2)) + ) + ((string-prefix= "phase-3a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3a)) + ) + ((string-prefix= "phase-3" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3)) + ) + ((string-prefix= "phase-4a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4a)) + ) + ((string-prefix= "phase-4" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4)) + ) + (else + #t + (goto cfg-86) + ) + ) + (let ((a1-50 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) + (if (= (-> a1-50 0) 44) + (set! a1-50 (&-> a1-50 1)) + ) + (string-suck-up! s0-5 a1-50) + ) + ) + ) + #f + (label cfg-86) + (set! (-> s1-2 nav_territory_type) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 8)))))) + (set! (-> s1-2 exclusive_data) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 9)))))) + (set! (-> s1-2 width) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 10)))))) + (set! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag)) + (let ((s0-6 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 11)))))) + (copy-string<-string s0-6 (the-as string (-> s3-3 sql-data (+ s2-2 11)))) + (until #f + (cond + ((string-prefix= "blocker" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag blocker)) + ) + ((string-prefix= "one-way" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag one-way)) + ) + ((string-prefix= "pass-port-mh" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-mh)) + ) + ((string-prefix= "pass-port-inda" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-inda)) + ) + ((string-prefix= "pass-inda-indb" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-inda-indb)) + ) + ((string-prefix= "pass-indb-sluma" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-indb-sluma)) + ) + ((string-prefix= "pass-slumb-genb" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-slumb-genb)) + ) + (else + #t + (goto cfg-106) + ) + ) + (let ((a1-61 (string-skip-to-char (-> s0-6 data) (the-as uint 44)))) + (if (= (-> a1-61 0) 44) + (set! a1-61 (&-> a1-61 1)) + ) + (string-suck-up! s0-6 a1-61) + ) + ) + ) + #f + (label cfg-106) + (+! (-> this edge-array length) 1) + ) + ) + ) + ) + (+! s2-2 13) + ) + ) + (when (< (-> s3-3 length) (* 13 s4-2)) + #t + (goto cfg-113) + ) + ) + ) + (+! s5-1 s4-2) + ) + ) + #f + (label cfg-113) + (format #t "~D edges.~%" (-> this edge-array length)) + (format #t "Loading visnodes ...~%") + (let ((s5-2 0) + (s4-3 256) + ) + (until #f + (let ((s3-4 (clear *temp-string*))) + (format s3-4 "select nav_edge_id,nav_node_id,nav_graph_id from nav_visible_nodes") + (format s3-4 " where nav_graph_id = ~D" (-> this nav_graph_id)) + (format s3-4 " limit ~D,~D" s5-2 s4-3) + (let ((s3-5 (sql-query s3-4))) + (when (!= (-> s3-5 content-type) 'select) + (format 0 "ERROR: sql: select error ~A for ~A~%" s3-5 this) + (return #f) + ) + (let ((s2-3 0)) + (while (< s2-3 (-> s3-5 length)) + (when (= (string->int (the-as string (-> s3-5 sql-data (+ s2-3 2)))) (-> this nav_graph_id)) + (let ((s1-4 (-> this visnode-array data (-> this visnode-array length)))) + (set! (-> s1-4 mysql-save-flag) (mysql-save-flag)) + (set! (-> s1-4 nav_graph_id) (-> this nav_graph_id)) + (set! (-> s1-4 nav_edge_id) (the-as uint (string->int (the-as string (-> s3-5 sql-data s2-3))))) + (set! (-> s1-4 nav_node_id) (the-as uint (string->int (the-as string (-> s3-5 sql-data (+ s2-3 1)))))) + (set! (-> s1-4 runtime-edge-id) (indexof-nav-edge this (the-as int (-> s1-4 nav_edge_id)))) + (set! (-> s1-4 runtime-node-id) (indexof-nav-node this (the-as int (-> s1-4 nav_node_id)))) + ) + (+! (-> this visnode-array length) 1) + ) + (+! s2-3 3) + ) + ) + (when (< (-> s3-5 length) (* 3 s4-3)) + #t + (goto cfg-126) + ) + ) + ) + (+! s5-2 s4-3) + ) + ) + #f + (label cfg-126) + (format #t "~D visnodes.~%" (-> this visnode-array length)) + (mysql-nav-graph-method-22 this) + #t + ) + +(defmethod temp-edge-size ((this mysql-nav-node)) + (let ((v0-0 0)) + (let ((v1-0 (the-as object (-> this temp-edge-list)))) + (while v1-0 + (+! v0-0 1) + (set! v1-0 (-> (the-as mysql-nav-edge v1-0) temp-next-edge)) + ) + ) + v0-0 + ) + ) + +(defmethod mysql-nav-graph-method-17 ((this mysql-nav-graph)) + (dotimes (v1-0 (-> this node-array length)) + (set! (-> this node-array data v1-0 temp-edge-list) (the-as (inline-array mysql-nav-edge) #f)) + ) + (dotimes (v1-3 (-> this edge-array length)) + (set! (-> this edge-array data v1-3 temp-next-edge) #f) + ) + (countdown (v1-7 (-> this edge-array length)) + (let ((a1-17 (-> this edge-array data v1-7))) + (when (not (logtest? (-> a1-17 mysql-save-flag) (mysql-save-flag delete))) + (let ((a2-8 (-> this node-array data (-> a1-17 runtime-node-id-1)))) + (when (not (logtest? (-> a2-8 mysql-save-flag) (mysql-save-flag delete))) + (cond + ((-> a2-8 temp-edge-list) + (set! (-> a1-17 temp-next-edge) (the-as mysql-nav-edge (-> a2-8 temp-edge-list))) + (set! (-> a2-8 temp-edge-list) (the-as (inline-array mysql-nav-edge) a1-17)) + ) + (else + (set! (-> a2-8 temp-edge-list) (the-as (inline-array mysql-nav-edge) a1-17)) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod lookup-level-info2 ((this mysql-nav-graph) (arg0 mysql-nav-node) (arg1 symbol)) + (let ((s5-0 (the-as mysql-nav-graph-level-info #f))) + (b! (>= (-> this level-info-last-lookup) (-> this level-info-array-length)) cfg-3 :delay #f) + (let ((v1-5 (-> this level-info-array (-> this level-info-last-lookup)))) + (let ((a0-2 (-> v1-5 level))) + (b! (!= (-> arg0 level_name) a0-2) cfg-3 :delay (empty-form)) + ) + (set! s5-0 v1-5) + ) + (b! #t cfg-18 :delay (nop!)) + (label cfg-3) + (let ((v1-6 0)) + (b! #t cfg-9 :delay (nop!)) + (label cfg-4) + (let ((a0-6 (-> this level-info-array v1-6))) + (let ((a3-1 (-> a0-6 level))) + (b! (!= (-> arg0 level_name) a3-1) cfg-8 :delay (empty-form)) + ) + (if arg1 + (set! (-> this level-info-last-lookup) v1-6) + ) + (set! s5-0 a0-6) + ) + (b! #t cfg-18 :delay (nop!)) + (label cfg-8) + (+! v1-6 1) + (label cfg-9) + (b! (< v1-6 (-> this level-info-array-length)) cfg-4) + ) + (let ((v1-9 (-> this level-info-array-length))) + (cond + ((< v1-9 32) + (if arg1 + (set! (-> this level-info-last-lookup) v1-9) + ) + (set! s5-0 (-> this level-info-array v1-9)) + (set! (-> s5-0 level) (-> arg0 level_name)) + (set! (-> s5-0 node-count) 0) + (+! (-> this level-info-array-length) 1) + ) + (else + (format + 0 + "mysql-nav-graph::lookup-level-info: Error, too many unique level names in nav-graph. May need to increase the max (currently ~d)~%" + 32 + ) + (dotimes (s4-0 (-> this level-info-array-length)) + (let ((v1-17 (-> this level-info-array s4-0))) + (format 0 "~d ~s~%" s4-0 (-> v1-17 level)) + ) + ) + (break!) + 0 + ) + ) + ) + (label cfg-18) + s5-0 + ) + ) + +(defmethod mysql-nav-graph-method-19 ((this mysql-nav-graph)) + (set! (-> this level-info-array-length) 0) + (set! (-> this level-info-last-lookup) 0) + (dotimes (v1-0 32) + (let ((a0-3 (-> this level-info-array v1-0))) + (set! (-> a0-3 level) #f) + (set! (-> a0-3 level-id) (the-as uint v1-0)) + (set! (-> a0-3 node-count) 0) + (set! (-> a0-3 branch-count) 0) + (set! (-> a0-3 to-link-count) 0) + ) + 0 + ) + (dotimes (s5-0 (-> this node-array length)) + (let ((s4-0 (-> this node-array data s5-0))) + (when (not (logtest? (-> s4-0 mysql-save-flag) (mysql-save-flag delete))) + (let ((v1-10 (lookup-level-info2 this s4-0 #t))) + (set! (-> s4-0 level-node-index) (-> v1-10 node-count)) + (+! (-> v1-10 node-count) 1) + (let ((a0-10 (the-as object (-> s4-0 temp-edge-list)))) + (while a0-10 + (when (not (logtest? (-> (the-as mysql-nav-edge a0-10) mysql-save-flag) (mysql-save-flag delete))) + (if (!= (-> v1-10 level) + (-> this node-array data (-> (the-as mysql-nav-edge a0-10) runtime-node-id-2) level_name) + ) + (+! (-> v1-10 to-link-count) 1) + ) + (+! (-> v1-10 branch-count) 1) + ) + (set! a0-10 (-> (the-as mysql-nav-edge a0-10) temp-next-edge)) + ) + ) + ) + ) + ) + ) + 0 + ) + +(defmethod mysql-nav-graph-method-20 ((this mysql-nav-graph)) + (mysql-nav-graph-method-17 this) + (mysql-nav-graph-method-19 this) + 0 + (none) + ) + +(defmethod exec-sql! ((this mysql-nav-graph)) + (format #t "Saving nodes ...~%") + (dotimes (s5-0 (-> this node-array length)) + (let ((a0-3 (-> this node-array data s5-0))) + (set! (-> a0-3 nav_graph_id) (-> this nav_graph_id)) + (if (not (exec-sql! a0-3)) + (return #f) + ) + ) + ) + (format #t "Done.~%") + (format #t "Saving edges ...~%") + (dotimes (s5-1 (-> this edge-array length)) + (let ((a0-7 (-> this edge-array data s5-1))) + (set! (-> a0-7 nav_graph_id) (-> this nav_graph_id)) + (set! (-> a0-7 nav_node_id_1) (-> this node-array data (-> a0-7 runtime-node-id-1) nav_node_id)) + (set! (-> a0-7 nav_node_id_2) (-> this node-array data (-> a0-7 runtime-node-id-2) nav_node_id)) + (exec-sql! a0-7) + ) + ) + (format #t "Done.~%") + (format #t "Saving visible nodes ...~%") + (dotimes (s5-2 (-> this visnode-array length)) + (let ((a0-11 (-> this visnode-array data s5-2))) + (set! (-> a0-11 nav_graph_id) (-> this nav_graph_id)) + (set! (-> a0-11 nav_node_id) (-> this node-array data (-> a0-11 runtime-node-id) nav_node_id)) + (set! (-> a0-11 nav_edge_id) (-> this edge-array data (-> a0-11 runtime-edge-id) nav_edge_id)) + (if (not (exec-sql! a0-11)) + (return #f) + ) + ) + ) + (format #t "Done.~%") + #t + ) + +(defmethod mysql-nav-graph-method-23 ((this mysql-nav-graph) (arg0 vector) (arg1 vector)) + (let ((s3-0 (new 'stack-no-clear 'inline-array 'vector 5))) + (dotimes (s2-0 (-> this edge-array length)) + (let ((v1-3 (-> this edge-array data s2-0))) + (when (and (logtest? (-> v1-3 minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (not (logtest? (-> v1-3 mysql-save-flag) (mysql-save-flag delete))) + ) + (set! (-> s3-0 0 quad) + (-> (the-as + (pointer uint128) + (+ (the-as uint (-> this node-array data 0 position)) (* 80 (-> v1-3 runtime-node-id-1))) + ) + ) + ) + (set! (-> s3-0 1 quad) + (-> (the-as + (pointer uint128) + (+ (the-as uint (-> this node-array data 0 position)) (* 80 (-> v1-3 runtime-node-id-2))) + ) + ) + ) + (vector-! (-> s3-0 2) (-> s3-0 1) (-> s3-0 0)) + (set! (-> s3-0 2 y) 0.0) + (vector-normalize! (-> s3-0 2) 1.0) + (vector-rotate90-around-y! (-> s3-0 2) (-> s3-0 2)) + (vector+! (-> s3-0 3) (-> s3-0 0) (-> s3-0 1)) + (vector-float*! (-> s3-0 3) (-> s3-0 3) 0.5) + (let ((f0-3 (vector-dot (-> s3-0 3) (-> s3-0 2))) + (f1-1 (vector-dot arg0 (-> s3-0 2))) + (f2-1 (vector-dot arg1 (-> s3-0 2))) + ) + (when (< (* (- f1-1 f0-3) (- f2-1 f0-3)) 0.0) + (vector-! (-> s3-0 4) arg1 arg0) + (vector-float*! (-> s3-0 4) (-> s3-0 4) (/ (- f0-3 f1-1) (- f2-1 f1-1))) + (vector+! (-> s3-0 4) (-> s3-0 4) arg0) + (if (>= (+ 409.6 (* 0.5 (vector-vector-xz-distance (-> s3-0 0) (-> s3-0 1)))) + (vector-vector-xz-distance (-> s3-0 4) (-> s3-0 3)) + ) + (return #f) + ) + ) + ) + ) + ) + ) + ) + #t + ) + +(defmethod mysql-nav-graph-method-22 ((this mysql-nav-graph)) + (let ((s4-0 (-> this node-array length)) + (s5-0 0) + ) + (when (< 1 s4-0) + (dotimes (s3-0 (+ s4-0 -1)) + (let ((s2-0 (-> this node-array data s3-0))) + (when (and (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pov)) + (not (logtest? (-> s2-0 mysql-save-flag) (mysql-save-flag delete))) + ) + (let ((s1-0 (+ s3-0 1))) + (while (< s1-0 s4-0) + (let ((s0-0 (-> this node-array data s1-0))) + (when (and (logtest? (-> s0-0 nav_node_flag) (nav-node-flag pov)) + (not (logtest? (-> s0-0 mysql-save-flag) (mysql-save-flag delete))) + ) + (when (mysql-nav-graph-method-23 this (-> s2-0 position) (-> s0-0 position)) + (cond + ((< s5-0 1000) + (let ((v1-22 (-> this pov-conn-array s5-0))) + (+! s5-0 1) + (set! (-> v1-22 runtime-node-id-1) (the-as int (-> s2-0 runtime-id))) + (set! (-> v1-22 runtime-node-id-2) (the-as int (-> s0-0 runtime-id))) + ) + ) + ((= s5-0 1000) + (format #t "mysql-nav-graph : pov-conn-array too small, increase NAV_GRAPH_EDITOR_POV_CONN_COUNT~%") + ) + ) + ) + ) + ) + (+! s1-0 1) + ) + ) + ) + ) + ) + ) + (let ((v0-3 (min 1000 s5-0))) + (set! (-> this pov-conn-array-length) v0-3) + v0-3 + ) ) ) diff --git a/goal_src/jak3/engine/debug/nav/nav-graph-editor.gc b/goal_src/jak3/engine/debug/nav/nav-graph-editor.gc index acb102e391..9fcb17c0f1 100644 --- a/goal_src/jak3/engine/debug/nav/nav-graph-editor.gc +++ b/goal_src/jak3/engine/debug/nav/nav-graph-editor.gc @@ -6,18 +6,32 @@ ;; dgos: GAME (declare-type nav-graph-editor process) -(define-extern run-nav-graph-editor (function symbol (pointer process))) +(define-extern run-nav-graph-editor (function symbol symbol (pointer nav-graph-editor))) (define-extern get-nav-graph-editor (function nav-graph-editor)) (define-extern exit-nav-graph-editor (function none)) (define-extern *nav-graph-editor* (pointer nav-graph-editor)) +;; +++nav-com-type +(defenum nav-com-type + :type uint32 + (undo-move-node 0) + (undo-delete-edge 1) + (undo-delete-node 2) + (undo-new-node 3) + (undo-new-edge 4) + (undo-delete-visnode 5) + (undo-new-visnode 6) + ) +;; ---nav-com-type + + ;; DECOMP BEGINS ;; this file is debug only (declare-file (debug)) (deftype nav-graph-command (structure) - ((com-type uint32) + ((com-type nav-com-type) (id int32) (index int32) (move-vec vector :inline) @@ -81,52 +95,2517 @@ create-pov ) (:methods - (nav-graph-editor-method-29 () none) - (nav-graph-editor-method-30 () none) - (nav-graph-editor-method-31 () none) - (nav-graph-editor-method-32 () none) - (nav-graph-editor-method-33 () none) - (nav-graph-editor-method-34 () none) - (nav-graph-editor-method-35 () none) - (nav-graph-editor-method-36 () none) - (nav-graph-editor-method-37 () none) - (nav-graph-editor-method-38 () none) - (nav-graph-editor-method-39 () none) - (nav-graph-editor-method-40 () none) - (nav-graph-editor-method-41 () none) - (nav-graph-editor-method-42 () none) - (nav-graph-editor-method-43 () none) - (nav-graph-editor-method-44 () none) - (nav-graph-editor-method-45 () none) - (nav-graph-editor-method-46 () none) - (nav-graph-editor-method-47 () none) - (nav-graph-editor-method-48 () none) - (nav-graph-editor-method-49 () none) - (nav-graph-editor-method-50 () none) - (nav-graph-editor-method-51 () none) - (nav-graph-editor-method-52 () none) - (nav-graph-editor-method-53 () none) - (nav-graph-editor-method-54 () none) - (nav-graph-editor-method-55 () none) - (nav-graph-editor-method-56 () none) - (nav-graph-editor-method-57 () none) - (nav-graph-editor-method-58 () none) - (nav-graph-editor-method-59 () none) - (nav-graph-editor-method-60 () none) - (nav-graph-editor-method-61 () none) - (nav-graph-editor-method-62 () none) - (nav-graph-editor-method-63 () none) - (nav-graph-editor-method-64 () none) - (nav-graph-editor-method-65 () none) - (nav-graph-editor-method-66 () none) - (nav-graph-editor-method-67 () none) + (nav-graph-editor-method-29 (_type_) none) + (nav-graph-editor-method-30 (_type_ string string string) object) + (nav-graph-editor-method-31 (_type_ int) symbol) + (nav-graph-editor-method-32 (_type_ int) symbol) + (nav-graph-editor-method-33 (_type_ int int) object) + (nav-graph-editor-method-34 (_type_ int) none) + (nav-graph-editor-method-35 (_type_ vector vector) none) + (nav-graph-editor-method-36 (_type_) none) + (nav-graph-editor-method-37 (_type_) object) + (nav-graph-editor-method-38 (_type_) none) + (nav-graph-editor-method-39 (_type_) none) + (nav-graph-editor-method-40 (_type_) none) + (nav-graph-editor-method-41 (_type_) none) + (nav-graph-editor-method-42 (_type_) none) + (nav-graph-editor-method-43 (_type_) none) + (nav-graph-editor-method-44 (_type_) none) + (nav-graph-editor-method-45 (_type_) none) + (nav-graph-editor-method-46 (_type_) none) + (nav-graph-editor-method-47 (_type_) symbol) + (nav-graph-editor-method-48 (_type_) none) + (nav-graph-editor-method-49 (_type_) symbol) + (nav-graph-editor-method-50 (_type_) none) + (inc-cmd-id! (_type_) int) + (alloc-new-cmd! (_type_ int) nav-graph-command) + (get-last-cmd (_type_) nav-graph-command) + (nav-graph-editor-method-54 (_type_) none) + (nav-graph-editor-method-55 (_type_) none) + (nav-graph-editor-method-56 (_type_) int) + (nav-graph-editor-method-57 (_type_ int int) none) + (nav-graph-editor-method-58 (_type_ int) symbol) + (nav-graph-editor-method-59 (_type_ int) none) + (nav-graph-editor-method-60 (_type_ int) none) + (nav-graph-editor-method-61 (_type_ int int) none) + (nav-graph-editor-method-62 (_type_) symbol) + (nav-graph-editor-method-63 (_type_) none) + (nav-graph-editor-method-64 (_type_) none) + (nav-graph-editor-method-65 (_type_) none) + (nav-graph-editor-method-66 (_type_ symbol string) none) + (nav-graph-editor-method-67 (_type_) none) ) ) (define *nav-graph-editor* (the-as (pointer nav-graph-editor) #f)) -;; stub +(defun get-node-draw-position ((arg0 vector) (arg1 mysql-nav-node)) + (vector-copy! arg0 (-> arg1 position)) + (+! (-> arg0 y) (* 0.05 (- (-> (camera-pos) y) (-> arg0 y)))) + arg0 + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-66 ((this nav-graph-editor) (arg0 symbol) (arg1 string)) + (case arg0 + (('minimap) + (set! (-> this vehicle-edit-mode) #t) + (set! (-> this default-node nav_node_flag) (nav-node-flag)) + (set! (-> this clipping-dist) 3276800.0) + ) + (('hover) + (set! (-> this hover-edit-mode) #t) + ) + ) + (if (= (-> (level-get-target-inside *level*) name) 'desert) + (+! (-> this clipping-dist) 4096000.0) + ) + (set! (-> this command-array length) 0) + (init-from-sql! (-> this nav-graph) arg0 arg1) + (set! (-> this default-node nav_graph_id) (-> this nav-graph nav_graph_id)) + (set! (-> this default-edge nav_graph_id) (-> this nav-graph nav_graph_id)) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-67 ((this nav-graph-editor)) + (set! (-> this command-array length) 0) + (exec-sql! (-> this nav-graph)) + (none) + ) + +(defmethod deactivate ((this nav-graph-editor)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (set! *nav-graph-editor* (the-as (pointer nav-graph-editor) #f)) + ((method-of-type process deactivate) this) + (none) + ) + +(defmethod relocate ((this nav-graph-editor) (offset int)) + (call-parent-method this offset) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-64 ((this nav-graph-editor)) + (let ((v0-0 (not (-> this vehicle-edit-mode)))) + (set! (-> this vehicle-edit-mode) v0-0) + (set! (-> this default-node nav_node_flag) (if v0-0 + (nav-node-flag) + (nav-node-flag pedestrian) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-65 ((this nav-graph-editor)) + (set! (-> this hover-edit-mode) (not (-> this hover-edit-mode))) + (none) + ) + +(defmethod nav-graph-editor-method-58 ((this nav-graph-editor) (arg0 int)) + (when (not (-> this hover-edit-mode)) + (let ((gp-0 (-> this nav-graph node-array data arg0))) + (dotimes (s5-0 (-> *level* length)) + (let ((s4-0 (-> *level* level s5-0))) + (when (= (-> s4-0 status) 'active) + (let ((s3-0 (-> s4-0 bsp nav-meshes))) + (when (nonzero? s3-0) + (dotimes (s2-0 (-> s3-0 length)) + (let ((s1-0 (-> s3-0 s2-0))) + (-> s1-0 aid) + (let ((v1-14 (as-type s1-0 entity-nav-mesh))) + (when v1-14 + (let ((a0-7 (-> v1-14 nav-mesh)) + (a1-2 (new 'stack-no-clear 'nav-poly)) + ) + (vector-! (-> a1-2 vertex 0) (-> gp-0 position) (the-as vector (-> a0-7 bounds))) + (set! (-> a1-2 vertex1 x) 163840.0) + (set! (-> a1-2 data 20) (the-as uint 2)) + (when (nav-mesh-method-45 a0-7 a1-2) + (set! (-> gp-0 nav_mesh_id) (-> s1-0 aid)) + (set! (-> gp-0 level_name) (-> s4-0 name)) + (logior! (-> gp-0 mysql-save-flag) (mysql-save-flag update)) + (format *stdcon* "~S~%" (-> gp-0 level_name)) + (return #f) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + ) + +(defmethod nav-graph-editor-method-31 ((this nav-graph-editor) (arg0 int)) + (let ((s3-0 (-> this nav-graph edge-array data arg0)) + (s4-0 (new 'stack-no-clear 'inline-array 'vector 5)) + ) + (format *stdcon* "flags ( ") + (let ((s2-0 (-> s3-0 minimap_edge_flag))) + (if (= (logand s2-0 (nav-minimap-edge-flag blocker)) (nav-minimap-edge-flag blocker)) + (format *stdcon* "blocker ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-indb-sluma)) (nav-minimap-edge-flag pass-indb-sluma)) + (format *stdcon* "pass-indb-sluma ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-port-mh)) (nav-minimap-edge-flag pass-port-mh)) + (format *stdcon* "pass-port-mh ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-inda-indb)) (nav-minimap-edge-flag pass-inda-indb)) + (format *stdcon* "pass-inda-indb ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-slumb-genb)) (nav-minimap-edge-flag pass-slumb-genb)) + (format *stdcon* "pass-slumb-genb ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-port-inda)) (nav-minimap-edge-flag pass-port-inda)) + (format *stdcon* "pass-port-inda ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag one-way)) (nav-minimap-edge-flag one-way)) + (format *stdcon* "one-way ") + ) + ) + (format *stdcon* ")~%") + (vector-average! + (-> s4-0 3) + (get-node-draw-position + (new 'stack-no-clear 'vector) + (-> this nav-graph node-array data (-> s3-0 runtime-node-id-1)) + ) + (get-node-draw-position + (new 'stack-no-clear 'vector) + (-> this nav-graph node-array data (-> s3-0 runtime-node-id-2)) + ) + ) + (dotimes (s3-1 (-> this nav-graph visnode-array length)) + (let ((v1-32 (-> this nav-graph visnode-array data s3-1)) + (s2-2 (new 'stack-no-clear 'vector)) + ) + (when (and (= (-> v1-32 runtime-edge-id) arg0) (not (logtest? (-> v1-32 mysql-save-flag) (mysql-save-flag delete)))) + (get-node-draw-position s2-2 (-> this nav-graph node-array data (-> v1-32 runtime-node-id))) + (vector-! (-> s4-0 0) s2-2 (-> s4-0 3)) + (vector-normalize! (-> s4-0 0) (fmax 15360.0 (+ -15360.0 (vector-length (-> s4-0 0))))) + (vector-rotate-around-y! (-> s4-0 1) (-> s4-0 0) 24576.0) + (vector-normalize! (-> s4-0 1) 16384.0) + (vector-rotate-around-y! (-> s4-0 2) (-> s4-0 0) -24576.0) + (vector-normalize! (-> s4-0 2) 16384.0) + (vector+! (-> s4-0 0) (-> s4-0 0) (-> s4-0 3)) + (vector+! (-> s4-0 2) (-> s4-0 2) (-> s4-0 0)) + (vector+! (-> s4-0 1) (-> s4-0 1) (-> s4-0 0)) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 0) + (-> s4-0 1) + *color-light-yellow* + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 0) + (-> s4-0 2) + *color-light-yellow* + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 1) + (-> s4-0 2) + *color-light-yellow* + #f + (the-as rgba -1) + ) + (vector-lerp! (-> s4-0 0) (-> s4-0 1) (-> s4-0 2) 0.5) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 3) + (-> s4-0 0) + *color-light-yellow* + #f + (the-as rgba -1) + ) + ) + ) + ) + ) + #f + ) + +(defmethod nav-graph-editor-method-34 ((this nav-graph-editor) (arg0 int)) + (let* ((gp-0 (-> this nav-graph edge-array data arg0)) + (a1-6 (-> this nav-graph node-array data (-> gp-0 runtime-node-id-1))) + (s2-0 (-> this nav-graph node-array data (-> gp-0 runtime-node-id-2))) + (s3-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s5-0 a1-6) + (get-node-draw-position s4-0 s2-0) + (vector-! s3-0 s5-0 s4-0) + (set! (-> s3-0 y) 0.0) + (vector-rotate90-around-y! s3-0 s3-0) + (vector-normalize! s3-0 (-> gp-0 width)) + (add-debug-line + #t + (bucket-id debug) + (vector+! (new 'stack-no-clear 'vector) s5-0 s3-0) + (vector+! (new 'stack-no-clear 'vector) s4-0 s3-0) + *color-red* + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug) + (vector-! (new 'stack-no-clear 'vector) s5-0 s3-0) + (vector-! (new 'stack-no-clear 'vector) s4-0 s3-0) + *color-red* + #f + (the-as rgba -1) + ) + ) + 0 + (none) + ) + +(defmethod nav-graph-editor-method-32 ((this nav-graph-editor) (arg0 int)) + (let ((gp-0 (-> this nav-graph node-array data arg0)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (format *stdcon* "Radius = ~M~%" (-> gp-0 radius)) + (get-node-draw-position s5-0 gp-0) + (cond + ((= (-> this nav-graph nav_graph_id) 4) + (add-debug-sphere #t (bucket-id debug) s5-0 (-> gp-0 radius) *color-green*) + ) + (else + (new 'stack-no-clear 'vector) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (sincos! s4-1 (-> gp-0 angle)) + (set! (-> s4-1 z) (-> s4-1 y)) + (set! (-> s4-1 y) 0.0) + (set! (-> s4-1 w) 1.0) + (add-debug-sphere + #t + (bucket-id debug) + (vector+*! (new 'stack-no-clear 'vector) s5-0 s4-1 (-> gp-0 radius)) + (-> gp-0 radius) + *color-green* + ) + (add-debug-sphere + #t + (bucket-id debug) + (vector+*! (new 'stack-no-clear 'vector) s5-0 s4-1 (- (-> gp-0 radius))) + (-> gp-0 radius) + *color-green* + ) + ) + ) + ) + ) + ) + +(defmethod nav-graph-editor-method-30 ((this nav-graph-editor) (arg0 string) (arg1 string) (arg2 string)) + (format *stdcon* "~0K") + (format *stdcon* "~3L~18S~18S~18S~%~0L" "Left button" "Middle button" "Right button") + (format *stdcon* "~18S~18S~18S~%" arg0 arg1 arg2) + (format *stdcon* "~1K") + ) + +(defmethod nav-graph-editor-method-29 ((this nav-graph-editor)) + (local-vars + (sv-224 int) + (sv-240 (function _varargs_ object)) + (sv-256 mysql-nav-node) + (sv-272 vector) + (sv-288 vector) + (sv-304 symbol) + (sv-320 int) + (sv-336 (function _varargs_ object)) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> this nav-graph))) + (nav-graph-editor-method-36 this) + (dotimes (s4-0 (-> s5-0 node-array length)) + (let ((s2-0 (-> s5-0 node-array data s4-0))) + (set! (-> s2-0 visible) #f) + (when (and (not (logtest? (-> s2-0 nav_node_flag) (nav-node-flag hidden))) + (not (logtest? (-> s2-0 mysql-save-flag) (mysql-save-flag delete))) + ) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (get-node-draw-position s3-0 s2-0) + (vector-copy! s1-0 s3-0) + (set! (-> s1-0 w) (-> s2-0 radius)) + ) + (set! (-> s2-0 cam-dist) (vector-vector-distance-squared s3-0 (camera-pos))) + (let ((f0-2 (-> s2-0 cam-dist)) + (f1-0 (-> this clipping-dist)) + ) + (set! (-> s2-0 visible) (< f0-2 (* f1-0 f1-0))) + ) + (if (or (and (-> this vehicle-edit-mode) (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian))) + (and (not (-> this vehicle-edit-mode)) (not (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian)))) + ) + (set! (-> s2-0 visible) #f) + ) + (when (-> s2-0 visible) + (let ((v1-22 (new 'stack-no-clear 'inline-array 'vector 2))) + (let ((a1-2 (-> v1-22 0))) + (let ((a0-13 s3-0)) + (let ((a2-1 -4096.0)) + (.mov vf6 a2-1) + ) + (.lvf vf4 (&-> a0-13 quad)) + ) + (.add.x.vf.w vf5 vf0 vf0) + (.add.x.vf.xyz vf5 vf4 vf6) + (.svf (&-> a1-2 quad) vf5) + ) + (let ((a1-3 (-> v1-22 1))) + (let ((a0-14 s3-0)) + (let ((a2-3 4096.0)) + (.mov vf6 a2-3) + ) + (.lvf vf4 (&-> a0-14 quad)) + ) + (.add.x.vf.w vf5 vf0 vf0) + (.add.x.vf.xyz vf5 vf4 vf6) + (.svf (&-> a1-3 quad) vf5) + ) + (add-debug-box + #t + (bucket-id debug) + (-> v1-22 0) + (-> v1-22 1) + (cond + ((logtest? (-> s2-0 nav_node_flag) (nav-node-flag blocker)) + *color-red* + ) + ((logtest? (-> s2-0 nav_node_flag) (nav-node-flag pov)) + *color-blue* + ) + (else + *color-yellow* + ) + ) + ) + ) + (add-debug-x #t (bucket-id debug) s3-0 *color-red*) + (let ((s1-2 add-debug-text-3d) + (s0-1 #t) + ) + (set! sv-224 583) + (set! sv-240 format) + (let ((a0-18 (clear *temp-string*)) + (a1-6 "~D") + (a2-6 (-> s2-0 nav_mesh_id)) + ) + (sv-240 a0-18 a1-6 a2-6) + ) + (let* ((a2-7 *temp-string*) + (a3-2 s3-0) + (v1-29 (-> s2-0 level_name)) + (t0-1 (cond + ((= v1-29 'ctyport) + 3 + ) + ((= v1-29 'ctyinda) + 4 + ) + ((= v1-29 'ctyindb) + 5 + ) + ((= v1-29 'ctypal) + 6 + ) + ((= v1-29 'ctysluma) + 7 + ) + ((= v1-29 'ctyslumb) + 8 + ) + ((= v1-29 'ctyslumc) + 9 + ) + (else + 1 + ) + ) + ) + (t1-0 #f) + ) + (s1-2 s0-1 (the-as bucket-id sv-224) a2-7 a3-2 (the-as font-color t0-1) (the-as vector2h t1-0)) + ) + ) + (let ((s1-3 (new 'stack-no-clear 'vector))) + (let ((s0-2 (new 'stack-no-clear 'vector))) + (sincos! s0-2 (-> s2-0 angle)) + (set! (-> s1-3 x) (-> s0-2 y)) + (set! (-> s1-3 y) 0.0) + (set! (-> s1-3 z) (- (-> s0-2 x))) + ) + (set! (-> s1-3 w) 1.0) + (add-debug-vector #t (bucket-id debug-no-zbuf1) s3-0 s1-3 (meters 2) *color-green*) + ) + ) + ) + ) + ) + ) + (dotimes (s4-1 (-> s5-0 edge-array length)) + (let ((s3-1 (-> s5-0 edge-array data s4-1))) + (when (not (logtest? (-> s3-1 mysql-save-flag) (mysql-save-flag delete))) + (let ((s1-4 (-> s5-0 node-array data (-> s3-1 runtime-node-id-1)))) + (set! sv-256 (-> s5-0 node-array data (-> s3-1 runtime-node-id-2))) + (set! sv-272 (new 'stack-no-clear 'vector)) + (set! sv-288 (new 'stack-no-clear 'vector)) + (new 'stack-no-clear 'vector) + (let ((s2-1 (new 'stack-no-clear 'vector)) + (s0-3 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s2-1 s1-4) + (get-node-draw-position s0-3 sv-256) + (cond + ((and (>= (-> s3-1 runtime-node-id-1) 0) + (>= (-> s3-1 runtime-node-id-2) 0) + (or (-> s1-4 visible) (-> sv-256 visible)) + ) + (vector-! sv-272 s0-3 s2-1) + (let* ((f0-11 (vector-length sv-272)) + (f1-5 (fmax (* 0.75 f0-11) (+ -8192.0 f0-11))) + ) + (vector-float*! sv-272 sv-272 (/ f1-5 f0-11)) + ) + (let ((v1-64 sv-288)) + (let ((a0-40 s2-1)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-40 quad)) + ) + (.lvf vf5 (&-> sv-272 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-64 quad) vf6) + ) + (let ((v1-66 (-> this nav-graph graph-type))) + (cond + ((or (= v1-66 'quote) (= v1-66 'minimap)) + (if (logtest? (-> s3-1 minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (nav-graph-editor-method-35 this s2-1 sv-288) + (add-debug-line #t (bucket-id debug-no-zbuf1) s2-1 sv-288 *color-dark-red* #f *color-white*) + ) + ) + (else + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + s2-1 + sv-288 + (if (logtest? (-> s1-4 nav_node_flag) (nav-node-flag pedestrian)) + *color-dark-red* + *color-dark-blue* + ) + #f + *color-white* + ) + (let ((s1-5 add-debug-text-3d)) + (set! sv-304 #t) + (set! sv-320 577) + (set! sv-336 format) + (let ((a0-48 (clear *temp-string*)) + (a1-18 "~d") + (a2-12 (-> s3-1 nav_territory_type)) + ) + (sv-336 a0-48 a1-18 a2-12) + ) + (let ((a2-13 *temp-string*) + (a3-7 (vector-float*! (new 'stack-no-clear 'vector) (vector+! (new 'stack-no-clear 'vector) s2-1 s0-3) 0.5)) + (t0-5 3) + (t1-4 #f) + ) + (s1-5 sv-304 (the-as bucket-id sv-320) a2-13 a3-7 (the-as font-color t0-5) (the-as vector2h t1-4)) + ) + ) + ) + ) + ) + ) + (else + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-36 ((this nav-graph-editor)) + (let ((gp-0 (-> this nav-graph))) + (dotimes (s5-0 (-> gp-0 pov-conn-array-length)) + (let* ((v1-1 (-> gp-0 pov-conn-array s5-0)) + (a1-2 (-> gp-0 node-array data (-> v1-1 runtime-node-id-1))) + (s4-0 (-> gp-0 node-array data (-> v1-1 runtime-node-id-2))) + (s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s3-0 a1-2) + (get-node-draw-position s2-0 s4-0) + (add-debug-line #t (bucket-id debug) s3-0 s2-0 *color-light-blue* #f (the-as rgba -1)) + ) + ) + ) + (none) + ) + +(defmethod nav-graph-editor-method-35 ((this nav-graph-editor) (arg0 vector) (arg1 vector)) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (a0-1 4) + (set! (-> v1-0 a0-1 quad) (the-as uint128 0)) + ) + (vector-copy! (-> v1-0 0) arg0) + (+! (-> v1-0 0 y) 65536.0) + (vector-copy! (-> v1-0 1) arg0) + (+! (-> v1-0 1 y) -65536.0) + (vector-copy! (-> v1-0 2) arg1) + (+! (-> v1-0 2 y) 65536.0) + (vector-copy! (-> v1-0 3) arg1) + (+! (-> v1-0 3 y) -65536.0) + (set! (-> v1-0 0 w) 1.0) + (set! (-> v1-0 1 w) 1.0) + (set! (-> v1-0 2 w) 1.0) + (set! (-> v1-0 3 w) 1.0) + (add-debug-bound + (bucket-id debug-no-zbuf1) + v1-0 + 4 + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :g #x80 :a #x40) + 0 + ) + ) + 0 + (none) + ) + +(defmethod nav-graph-editor-method-37 ((this nav-graph-editor)) + (with-pp + (vector-copy! (-> this mouse-pos) (camera-pos)) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s4-0 *up-vector*) + (set-vector! s1-0 (-> *mouse* posx) (-> *mouse* posy) 0.0 1.0) + (cond + ((not (-> this vehicle-edit-mode)) + (vector-copy! s3-0 (-> (camera-matrix) fvec)) + (vector+*! s2-0 (-> this mouse-pos) (-> (camera-matrix) fvec) (-> this clipping-dist)) + (reverse-transform-point! s5-1 s2-0 s3-0 s1-0) + (let ((s4-3 (new 'stack 'collide-query))) + (vector-copy! (-> s4-3 start-pos) (-> this mouse-pos)) + (vector-! (-> s4-3 move-dist) s5-1 (-> this mouse-pos)) + (let ((v1-12 s4-3)) + (set! (-> v1-12 radius) 4096.0) + (set! (-> v1-12 collide-with) (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list)) + (set! (-> v1-12 ignore-process0) pp) + (set! (-> v1-12 ignore-process1) #f) + (set! (-> v1-12 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-12 action-mask) (collide-action solid)) + ) + (let ((f0-6 (fill-and-probe-using-line-sphere *collide-cache* s4-3))) + (cond + ((>= f0-6 0.0) + (vector+*! (-> this mouse-hit) (-> s4-3 start-pos) (-> s4-3 move-dist) f0-6) + (vector+! + (-> this mouse-hit-pick) + (-> this mouse-hit) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-3 move-dist) 4096.0) + ) + (vector-copy! (-> this mouse-normal) (-> s4-3 best-other-tri normal)) + (dotimes (s5-3 (-> *level* length)) + (let ((s4-4 (-> *level* level s5-3))) + (when (= (-> s4-4 status) 'active) + (let ((s3-3 (-> s4-4 bsp nav-meshes))) + (when (nonzero? s3-3) + (dotimes (s2-1 (-> s3-3 length)) + (let* ((s0-2 (-> s3-3 s2-1)) + (s1-1 (-> s0-2 aid)) + (v1-27 (as-type s0-2 entity-nav-mesh)) + ) + (when v1-27 + (let ((a0-23 (-> v1-27 nav-mesh)) + (a1-7 (new 'stack-no-clear 'nav-poly)) + ) + (vector-! (-> a1-7 vertex 0) (-> this mouse-hit) (the-as vector (-> a0-23 bounds))) + (set! (-> a1-7 vertex1 x) 40960.0) + (set! (-> a1-7 data 20) (the-as uint 2)) + (if (nav-mesh-method-45 a0-23 a1-7) + (format *stdcon* "Mouse : ~S ~D~%" (-> s4-4 name) s1-1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (vector+*! (-> this mouse-hit) (-> s4-3 start-pos) (-> s4-3 move-dist) 1.0) + (vector+*! (-> this mouse-hit-pick) (-> s4-3 start-pos) (-> s4-3 move-dist) 1.0) + ) + ) + ) + ) + (let ((s5-4 (new 'stack-no-clear 'vector))) + (vector-copy! s5-4 (-> this mouse-hit)) + (let ((s4-5 (quaternion-from-two-vectors! (new 'stack-no-clear 'quaternion) *up-vector* (-> this mouse-normal)))) + (add-debug-vector + #t + (bucket-id debug) + s5-4 + (vector-orient-by-quat! (new 'stack-no-clear 'vector) (new 'static 'vector :x 8192.0 :w 1.0) s4-5) + (meters 0.00024414062) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-4 + (vector-orient-by-quat! (new 'stack-no-clear 'vector) (new 'static 'vector :x -8192.0 :w 1.0) s4-5) + (meters 0.00024414062) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-4 + (vector-orient-by-quat! (new 'stack-no-clear 'vector) (new 'static 'vector :z 8192.0 :w 1.0) s4-5) + (meters 0.00024414062) + *color-green* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-4 + (vector-orient-by-quat! (new 'stack-no-clear 'vector) (new 'static 'vector :z -8192.0 :w 1.0) s4-5) + (meters 0.00024414062) + *color-green* + ) + ) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> this mouse-hit) + (-> this mouse-normal) + (meters 5) + *color-red* + ) + ) + ((and (-> this next-state) (= (-> this next-state name) 'move-plane)) + (vector-cross! s3-0 *up-vector* (-> (camera-matrix) rvec)) + (vector-normalize! s3-0 1.0) + (vector-copy! s2-0 (-> this mouse-hit)) + (reverse-transform-point! s5-1 s2-0 s3-0 s1-0) + (set! (-> this plane-height) (-> s5-1 y)) + (let ((s5-5 (new 'stack-no-clear 'vector))) + (set-vector! s5-5 (-> this mouse-hit x) (-> this plane-height) (-> this mouse-hit z) 1.0) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :x 4096.0 :w 1.0) + (meters 0.0024414062) + *color-red* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :x -4096.0 :w 1.0) + (meters 0.0024414062) + *color-red* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :z 4096.0 :w 1.0) + (meters 0.0024414062) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :z -4096.0 :w 1.0) + (meters 0.0024414062) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :y 4096.0 :w 1.0) + (meters 0.009765625) + *color-green* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :y -4096.0 :w 1.0) + (meters 0.009765625) + *color-green* + ) + (let ((gp-2 (vector+! (new 'stack-no-clear 'vector) s5-5 (new 'static 'vector :x 12288.0 :z 12288.0 :w 1.0))) + (s4-8 (vector+! (new 'stack-no-clear 'vector) s5-5 (new 'static 'vector :x 12288.0 :z -12288.0 :w 1.0))) + (s3-9 (vector+! (new 'stack-no-clear 'vector) s5-5 (new 'static 'vector :x -12288.0 :z -12288.0 :w 1.0))) + (s2-7 (vector+! (new 'stack-no-clear 'vector) s5-5 (new 'static 'vector :x -12288.0 :z 12288.0 :w 1.0))) + ) + (add-debug-line #t (bucket-id debug) gp-2 s4-8 *color-white* #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) s4-8 s3-9 *color-white* #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) s3-9 s2-7 *color-white* #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) s2-7 gp-2 *color-white* #f (the-as rgba -1)) + ) + ) + ) + (else + (vector-copy! s3-0 *up-vector*) + (vector-copy! s2-0 (-> this mouse-pos)) + (set! (-> s2-0 y) (-> this plane-height)) + (reverse-transform-point! s5-1 s2-0 s3-0 s1-0) + (vector-copy! s4-0 s3-0) + (let ((v1-57 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (a0-67 4) + (set! (-> v1-57 a0-67 quad) (the-as uint128 0)) + ) + (vector+! (-> v1-57 0) s5-1 (new 'static 'vector :x 8192.0 :z 8192.0 :w 1.0)) + (vector+! (-> v1-57 1) s5-1 (new 'static 'vector :x 8192.0 :z -8192.0 :w 1.0)) + (vector+! (-> v1-57 2) s5-1 (new 'static 'vector :x -8192.0 :z -8192.0 :w 1.0)) + (vector+! (-> v1-57 3) s5-1 (new 'static 'vector :x -8192.0 :z 8192.0 :w 1.0)) + ) + (let ((f30-0 50.0)) + (if (= (-> this nav-graph nav_graph_id) 2) + (set! f30-0 4.0) + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :x 4096.0 :w 1.0) + (the-as meters f30-0) + *color-red* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :x -4096.0 :w 1.0) + (the-as meters f30-0) + *color-red* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :z 4096.0 :w 1.0) + (the-as meters f30-0) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :z -4096.0 :w 1.0) + (the-as meters f30-0) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :y 4096.0 :w 1.0) + (the-as meters f30-0) + *color-green* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :y -4096.0 :w 1.0) + (the-as meters f30-0) + *color-green* + ) + ) + (vector-copy! (-> this mouse-hit) s5-1) + (vector-copy! (-> this mouse-hit-pick) s5-1) + (let ((v0-19 (the-as object (-> this mouse-normal)))) + (set! (-> (the-as vector v0-19) quad) (-> s4-0 quad)) + v0-19 + ) + ) + ) + ) + ) + ) + +(defmethod nav-graph-editor-method-45 ((this nav-graph-editor)) + (set! (-> this selected-index) -1) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-46 ((this nav-graph-editor)) + (let ((s5-0 (-> this nav-graph))) + (dotimes (s4-0 (-> s5-0 node-array length)) + (let ((s3-0 (-> s5-0 node-array data s4-0))) + (when (and (-> s3-0 visible) + (not (logtest? (-> s3-0 nav_node_flag) (nav-node-flag hidden))) + (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) + (or (and (logtest? (-> s3-0 nav_node_flag) (nav-node-flag blocker)) + (logtest? (-> this default-node nav_node_flag) (nav-node-flag blocker)) + ) + (and (not (logtest? (-> s3-0 nav_node_flag) (nav-node-flag blocker))) + (not (logtest? (-> this default-node nav_node_flag) (nav-node-flag blocker))) + ) + ) + ) + (let ((s1-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s1-0 s3-0) + (vector-copy! s2-0 s1-0) + (set! (-> s2-0 w) 11468.8) + (when (< 0.0 (ray-sphere-intersect + (-> this mouse-pos) + (vector-! (new 'stack-no-clear 'vector) (-> this mouse-hit-pick) (-> this mouse-pos)) + s2-0 + (-> s2-0 w) + ) + ) + (let ((f0-4 (+ -8192.0 (-> s3-0 cam-dist)))) + (when (or (= (-> this selected-index) -1) (< f0-4 (-> this selected-dist))) + (set! (-> this selected-index) s4-0) + (set! (-> this selected-dist) f0-4) + (set! (-> this selected-node-edge?) #t) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-48 ((this nav-graph-editor)) + (set! (-> this closest-node) -1) + (set! (-> this dist-closest-node) 0.0) + (let ((s5-0 (-> this nav-graph))) + (dotimes (s4-0 (-> s5-0 node-array length)) + (let ((v1-4 (-> s5-0 node-array data s4-0))) + (when (and (-> v1-4 visible) + (not (logtest? (-> v1-4 nav_node_flag) (nav-node-flag blocker hidden))) + (not (logtest? (-> v1-4 mysql-save-flag) (mysql-save-flag delete))) + ) + (let ((f0-1 (vector-vector-distance (-> v1-4 position) (-> this mouse-hit)))) + (when (or (< (-> this closest-node) 0) (< f0-1 (-> this dist-closest-node))) + (set! (-> this closest-node) s4-0) + (set! (-> this dist-closest-node) f0-1) + ) + ) + ) + ) + ) + ) + (none) + ) + +(defmethod nav-graph-editor-method-49 ((this nav-graph-editor)) + (local-vars (sv-80 mysql-nav-node) (sv-96 vector)) + (set! (-> this closest-edge) -1) + (set! (-> this dist-closest-edge) 0.0) + (let ((s5-0 (-> this nav-graph))) + 0.0 + (dotimes (s4-0 (-> s5-0 edge-array length)) + (let ((s3-0 (-> s5-0 edge-array data s4-0))) + (when (and (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) + (not (logtest? (-> s3-0 minimap_edge_flag) (nav-minimap-edge-flag blocker))) + ) + (let ((s2-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-1)))) + (set! sv-80 (-> s5-0 node-array data (-> s3-0 runtime-node-id-2))) + (new 'stack-no-clear 'vector) + (set! sv-96 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s0-0 s2-0) + (get-node-draw-position s1-0 sv-80) + (when (and (>= (-> s3-0 runtime-node-id-1) 0) + (>= (-> s3-0 runtime-node-id-2) 0) + (or (-> s2-0 visible) (-> sv-80 visible)) + ) + (let ((f0-2 (vector-segment-distance-point! (-> this mouse-hit) s1-0 s0-0 sv-96))) + (when (or (< (-> this closest-edge) 0) (< f0-2 (-> this dist-closest-edge))) + (set! (-> this closest-edge) s4-0) + (set! (-> this dist-closest-edge) f0-2) + ) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + +(defmethod nav-graph-editor-method-47 ((this nav-graph-editor)) + (local-vars + (sv-160 mysql-nav-node) + (sv-176 mysql-nav-node) + (sv-192 vector) + (sv-208 vector) + (sv-224 vector) + (sv-240 vector) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> this nav-graph))) + (dotimes (s4-0 (-> s5-0 edge-array length)) + (let ((s1-0 (-> s5-0 edge-array data s4-0))) + (when (not (logtest? (-> s1-0 mysql-save-flag) (mysql-save-flag delete))) + (set! sv-160 (-> s5-0 node-array data (-> s1-0 runtime-node-id-1))) + (set! sv-176 (-> s5-0 node-array data (-> s1-0 runtime-node-id-2))) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (get-node-draw-position sv-192 sv-160) + (get-node-draw-position s0-0 sv-176) + (when (and (>= (-> s1-0 runtime-node-id-1) 0) + (>= (-> s1-0 runtime-node-id-2) 0) + (or (-> sv-160 visible) (-> sv-176 visible)) + ) + (vector-! s2-0 s0-0 sv-192) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (vector-copy! s1-1 sv-192) + (set! sv-208 (new 'stack-no-clear 'vector)) + (let ((v1-26 (-> s0-0 quad))) + (set! (-> sv-208 quad) v1-26) + ) + (let ((v0-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 4915.2))) + (vector+! s1-1 s1-1 v0-2) + (vector-! sv-208 sv-208 v0-2) + ) + (let ((a1-8 s2-0) + (v1-29 s1-1) + ) + (vector-! a1-8 sv-208 v1-29) + ) + (let ((f30-0 0.0) + (s0-1 ray-cylinder-intersect) + ) + (set! sv-224 (-> this mouse-pos)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (let ((v1-32 (-> this mouse-hit-pick)) + (a0-17 (-> this mouse-pos)) + ) + (.lvf vf4 (&-> v1-32 quad)) + (.lvf vf5 (&-> a0-17 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-240 quad) vf6) + (let ((a3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 1.0)) + (t0-0 1024.0) + (t1-0 (vector-length s2-0)) + (t2-0 s3-0) + ) + (when (< f30-0 (s0-1 sv-224 sv-240 s1-1 a3-0 t0-0 t1-0 t2-0)) + (let ((f0-1 (vector-vector-distance s3-0 (-> this mouse-pos)))) + (when (or (= (-> this selected-index) -1) (< f0-1 (-> this selected-dist))) + (set! (-> this selected-index) s4-0) + (set! (-> this selected-dist) f0-1) + (set! (-> this selected-node-edge?) #f) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + ) + +(defmethod nav-graph-editor-method-33 ((this nav-graph-editor) (arg0 int) (arg1 int)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (-> this nav-graph))) + (when (>= arg1 0) + (cond + (arg0 + (let ((gp-0 (-> v1-0 node-array data arg1))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s5-0 gp-0) + (vector-copy! s4-0 s5-0) + (set! (-> s4-0 w) 11468.8) + (let ((v1-4 (new 'stack-no-clear 'inline-array 'vector 2))) + (let ((a1-2 (-> v1-4 0))) + (let ((a0-7 s5-0)) + (let ((a2-2 -4096.0)) + (.mov vf6 a2-2) + ) + (.lvf vf4 (&-> a0-7 quad)) + ) + (.add.x.vf.w vf5 vf0 vf0) + (.add.x.vf.xyz vf5 vf4 vf6) + (.svf (&-> a1-2 quad) vf5) + ) + (let ((a0-8 (-> v1-4 1))) + (let ((a1-4 4096.0)) + (.mov vf6 a1-4) + ) + (.lvf vf4 (&-> s5-0 quad)) + (.add.x.vf.w vf5 vf0 vf0) + (.add.x.vf.xyz vf5 vf4 vf6) + (.svf (&-> a0-8 quad) vf5) + ) + (add-debug-box #t (bucket-id debug) (-> v1-4 0) (-> v1-4 1) *color-green*) + ) + ) + (format *stdcon* "selected node level : ~S~%" (-> gp-0 level_name)) + ) + ) + (else + (let* ((a0-14 (-> v1-0 edge-array data arg1)) + (a1-11 (-> v1-0 node-array data (-> a0-14 runtime-node-id-1))) + (gp-1 (-> v1-0 node-array data (-> a0-14 runtime-node-id-2))) + (s4-1 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s4-1 a1-11) + (get-node-draw-position s5-1 gp-1) + (add-debug-line-sphere + #t + (bucket-id debug) + s4-1 + (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1) + 1024.0 + *color-green* + ) + ) + ) + ) + ) + ) + ) + ) + +(defmethod inc-cmd-id! ((this nav-graph-editor)) + (+! (-> this command-id) 1) + (-> this command-id) + ) + +(defmethod alloc-new-cmd! ((this nav-graph-editor) (arg0 int)) + (let* ((v1-1 (-> this command-array length)) + (v0-0 (-> this command-array data v1-1)) + ) + (+! (-> this command-array length) 1) + (set! (-> this max-command) v1-1) + (set! (-> v0-0 com-type) (the-as nav-com-type arg0)) + (set! (-> v0-0 id) (-> this command-id)) + v0-0 + ) + ) + +(defmethod get-last-cmd ((this nav-graph-editor)) + (-> this command-array data (+ (-> this command-array length) -1)) + ) + +(defmethod nav-graph-editor-method-54 ((this nav-graph-editor)) + (+! (-> this command-array length) -1) + (set! (-> this max-command) (-> this command-array length)) + (none) + ) + +;; WARN: new jak 2 until loop case, check carefully +(defmethod nav-graph-editor-method-62 ((this nav-graph-editor)) + (if (zero? (-> this command-array length)) + (return #f) + ) + (let ((s5-0 (-> this command-array data (+ (-> this command-array length) -1) id))) + (until #f + (if (zero? (-> this command-array length)) + (return #t) + ) + (let ((s4-0 (-> this command-array data (+ (-> this command-array length) -1)))) + (if (!= s5-0 (-> s4-0 id)) + (return #t) + ) + (case (-> s4-0 com-type) + (((nav-com-type undo-move-node)) + (format #t "Undo move-node ~D~%" (-> s4-0 id)) + (vector-! + (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> s4-0 index)))) + (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> s4-0 index)))) + (-> s4-0 move-vec) + ) + (nav-graph-editor-method-58 this (-> s4-0 index)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + (((nav-com-type undo-delete-edge)) + (format #t "Undo delete-edge ~D~%" (-> s4-0 id)) + (logclear! (-> this nav-graph edge-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + (((nav-com-type undo-delete-node)) + (format #t "Undo delete-node ~D~%" (-> s4-0 id)) + (logclear! (-> this nav-graph node-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + (((nav-com-type undo-delete-visnode)) + (format #t "Undo delete-visnode ~D~%" (-> s4-0 id)) + (logclear! (-> this nav-graph visnode-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + ) + (((nav-com-type undo-new-node)) + (format #t "Undo new-node ~D~%" (-> s4-0 id)) + (logior! (-> this nav-graph node-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + (((nav-com-type undo-new-visnode)) + (format #t "Undo new-visnode ~D~%" (-> s4-0 id)) + (logior! (-> this nav-graph visnode-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + ) + (((nav-com-type undo-new-edge)) + (format #t "Undo new-edge ~D~%" (-> s4-0 id)) + (logior! (-> this nav-graph edge-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + ) + ) + (+! (-> this command-array length) -1) + ) + ) + #f + ) + +(defmethod nav-graph-editor-method-55 ((this nav-graph-editor)) + (let ((gp-0 (alloc-new-node! (-> this nav-graph)))) + (when (!= gp-0 -1) + (let ((v1-6 (-> this nav-graph node-array data gp-0)) + (a0-4 (-> this default-node)) + ) + (vector-copy! (-> v1-6 position) (-> this mouse-hit)) + (set! (-> v1-6 angle) (-> a0-4 angle)) + (set! (-> v1-6 radius) (-> a0-4 radius)) + (set! (-> v1-6 nav_mesh_id) (-> a0-4 nav_mesh_id)) + (if (-> this hover-edit-mode) + (set! (-> v1-6 level_name) (-> a0-4 level_name)) + ) + (set! (-> v1-6 nav_node_flag) (-> a0-4 nav_node_flag)) + ) + (nav-graph-editor-method-58 this gp-0) + (set! (-> (alloc-new-cmd! this 3) index) gp-0) + ) + ) + (none) + ) + +(defmethod nav-graph-editor-method-57 ((this nav-graph-editor) (arg0 int) (arg1 int)) + (let ((s5-0 (indexof-visnode (-> this nav-graph) arg0 arg1))) + (if (= s5-0 -1) + (set! s5-0 (alloc-new-visnode! (-> this nav-graph) arg0 arg1)) + ) + (when (!= s5-0 -1) + (logclear! (-> this nav-graph visnode-array data s5-0 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 6) index) s5-0) + ) + ) + (none) + ) + +(defmethod nav-graph-editor-method-56 ((this nav-graph-editor)) + (let ((gp-0 (alloc-new-edge! (-> this nav-graph)))) + (when (!= gp-0 -1) + (let ((v1-6 (-> this nav-graph edge-array data gp-0)) + (a0-4 (-> this default-edge)) + ) + (set! (-> v1-6 runtime-node-id-1) (-> this edge-src)) + (set! (-> v1-6 runtime-node-id-2) (-> this edge-dst)) + (set! (-> v1-6 directionality) (nav-directionality bi_directional)) + (set! (-> v1-6 speed_limit) (-> a0-4 speed_limit)) + (set! (-> v1-6 density) (-> a0-4 density)) + (set! (-> v1-6 traffic_edge_flag) (-> a0-4 traffic_edge_flag)) + (set! (-> v1-6 nav_clock_mask) (-> a0-4 nav_clock_mask)) + (set! (-> v1-6 nav_clock_type) (-> a0-4 nav_clock_type)) + (set! (-> v1-6 width) (-> a0-4 width)) + (set! (-> v1-6 minimap_edge_flag) (-> a0-4 minimap_edge_flag)) + ) + (set! (-> (alloc-new-cmd! this 4) index) gp-0) + ) + gp-0 + ) + ) + +;; WARN: Function (method 61 nav-graph-editor) has a return type of none, but the expression builder found a return statement. +(defmethod nav-graph-editor-method-61 ((this nav-graph-editor) (arg0 int) (arg1 int)) + (case (indexof-visnode (-> this nav-graph) arg0 arg1) + ((-1) + (return #f) + ) + ) + (let ((s5-1 (alloc-new-visnode! (-> this nav-graph) arg0 arg1))) + (when (!= s5-1 -1) + (inc-cmd-id! this) + (logior! (-> this nav-graph visnode-array data s5-1 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 5) index) s5-1) + ) + ) + 0 + (none) + ) + +(defmethod nav-graph-editor-method-59 ((this nav-graph-editor) (arg0 int)) + (inc-cmd-id! this) + (let ((s5-0 (-> this nav-graph node-array data arg0))) + (logior! (-> s5-0 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 2) index) arg0) + (dotimes (s3-0 (-> this nav-graph edge-array length)) + (let ((v1-13 (-> this nav-graph edge-array data s3-0))) + (when (and (not (logtest? (-> v1-13 mysql-save-flag) (mysql-save-flag delete))) + (or (= (-> v1-13 runtime-node-id-1) arg0) (= (-> v1-13 runtime-node-id-2) arg0)) + ) + (logior! (-> v1-13 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 1) index) s3-0) + ) + ) + ) + (dotimes (s4-1 (-> this nav-graph visnode-array length)) + (let ((v1-23 (-> this nav-graph visnode-array data s4-1))) + (when (and (not (logtest? (-> v1-23 mysql-save-flag) (mysql-save-flag delete))) + (= (-> v1-23 runtime-node-id) (-> s5-0 runtime-id)) + ) + (logior! (-> v1-23 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 5) index) s4-1) + ) + ) + ) + ) + (mysql-nav-graph-method-22 (-> this nav-graph)) + 0 + (none) + ) + +(defmethod nav-graph-editor-method-60 ((this nav-graph-editor) (arg0 int)) + (inc-cmd-id! this) + (let ((s5-0 (-> this nav-graph edge-array data arg0))) + (logior! (-> s5-0 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 1) index) arg0) + (dotimes (s4-1 (-> this nav-graph visnode-array length)) + (let ((v1-11 (-> this nav-graph visnode-array data s4-1))) + (when (and (not (logtest? (-> v1-11 mysql-save-flag) (mysql-save-flag delete))) + (= (-> v1-11 runtime-edge-id) (-> s5-0 runtime-id)) + ) + (logior! (-> v1-11 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 5) index) s4-1) + ) + ) + ) + (dotimes (s4-2 2) + (let ((s3-0 (if (zero? s4-2) + (-> s5-0 runtime-node-id-1) + (-> s5-0 runtime-node-id-2) + ) + ) + (v1-19 #f) + ) + (dotimes (a0-16 (-> this nav-graph edge-array length)) + (let ((a1-7 (-> this nav-graph edge-array data a0-16))) + (if (and (not (logtest? (-> a1-7 mysql-save-flag) (mysql-save-flag delete))) + (or (= (-> a1-7 runtime-node-id-1) s3-0) (= (-> a1-7 runtime-node-id-2) s3-0)) + ) + (set! v1-19 #t) + ) + ) + ) + (when (not v1-19) + (let ((v1-24 (-> this nav-graph node-array data s3-0))) + (logior! (-> v1-24 mysql-save-flag) (mysql-save-flag delete)) + ) + (set! (-> (alloc-new-cmd! this 2) index) s3-0) + ) + ) + ) + ) + (mysql-nav-graph-method-22 (-> this nav-graph)) + 0 + (none) + ) + +;; WARN: Return type mismatch pad-buttons vs none. +(defmethod nav-graph-editor-method-63 ((this nav-graph-editor)) + (if (cpad-pressed? 0 triangle) + (nav-graph-editor-method-62 this) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (none) + ) + +;; WARN: Return type mismatch pad-buttons vs none. +(defmethod nav-graph-editor-method-50 ((this nav-graph-editor)) + (if (cpad-pressed? 0 up) + (go (method-of-object this create)) + ) + (if (cpad-pressed? 0 down) + (go (method-of-object this adjust-it)) + ) + (if (cpad-pressed? 0 left) + (go (method-of-object this adjust-minimap)) + ) + (if (cpad-pressed? 0 right) + (go (method-of-object this adjust-plane)) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons up)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons down)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons left)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons right)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right)) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-38 ((this nav-graph-editor)) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (cond + ((not (mouse-hold? left)) + (let ((a0-4 (get-last-cmd this))) + (vector-! + (-> a0-4 move-vec) + (the-as + vector + (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> this selected-index))) + ) + (-> a0-4 move-vec) + ) + ) + (mysql-nav-graph-method-22 (-> this nav-graph)) + (go (method-of-object this create)) + ) + (else + (vector-copy! (-> this nav-graph node-array data (-> this selected-index) position) (-> this mouse-hit)) + (nav-graph-editor-method-58 this (-> this selected-index)) + ) + ) + (none) + ) + +(defstate move-node (nav-graph-editor) + :virtual #t + :enter (behavior () + (inc-cmd-id! self) + (let ((v1-3 (alloc-new-cmd! self 0))) + (let ((a0-5 (-> self nav-graph node-array data (-> self selected-index)))) + (logior! (-> a0-5 mysql-save-flag) (mysql-save-flag update)) + ) + (set! (-> v1-3 index) (-> self selected-index)) + (set! (-> v1-3 move-vec quad) + (-> (the-as + (pointer uint128) + (+ (the-as uint (-> self nav-graph node-array data 0 position)) (* 80 (-> self selected-index))) + ) + ) + ) + ) + (mysql-nav-graph-method-22 (-> self nav-graph)) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Move node" "" "") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-38 self) + ) + ) + +(defstate adjust-plane (nav-graph-editor) + :virtual #t + :trans (behavior () + (if (mouse-hold? left) + (go-virtual move-plane) + ) + (when (and (mouse-hold? middle) (>= (-> self selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons middle)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons middle)) + (set! (-> self plane-height) (-> self nav-graph node-array data (-> self selected-index) position y)) + ) + (nav-graph-editor-method-45 self) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Move plane" "Snap to node" "") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-50 self) + (nav-graph-editor-method-46 self) + (nav-graph-editor-method-33 self (the-as int (-> self selected-node-edge?)) (-> self selected-index)) + ) + ) + +(defstate move-plane (nav-graph-editor) + :virtual #t + :enter (behavior () + (set-vector! (-> self mouse-spos-hold) (-> *mouse* posx) (-> *mouse* posy) 0.0 1.0) + (set! (-> self plane-height-hold) (-> self plane-height)) + ) + :trans (behavior () + (if (not (mouse-hold? left)) + (go-virtual adjust-plane) + ) + ) + :code sleep-code + :post (behavior () + (format *stdcon* "~0K") + (let ((t9-1 format) + (a0-1 *stdcon*) + (a1-1 "~3L~%~0L") + ) + "Moving plane" + (t9-1 a0-1 a1-1) + ) + (format *stdcon* "~1K") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-50 self) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-41 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-46 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (add-debug-line-sphere + #t + (bucket-id debug) + (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> this edge-src)))) + (vector-! + (new 'stack-no-clear 'vector) + (-> this mouse-hit) + (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> this edge-src)))) + ) + 1024.0 + (if (>= (-> this selected-index) 0) + *color-green* + *color-red* + ) + ) + (cond + ((and (mouse-pressed? left) (begin + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (let ((v1-20 (logclear (-> *mouse* button0-rel 0) (mouse-buttons left)))) + (set! (-> *mouse* button0-rel 0) v1-20) + (and v1-20 (!= (-> this selected-index) (-> this edge-src))) + ) + ) + ) + (cond + ((>= (-> this selected-index) 0) + (set! (-> this edge-dst) (-> this selected-index)) + ) + (else + (set! (-> this edge-dst) (the-as int (nav-graph-editor-method-55 this))) + (mysql-nav-graph-method-22 (-> this nav-graph)) + (if (= (-> this edge-dst) -1) + (go (method-of-object this create)) + ) + ) + ) + (when (= (nav-graph-editor-method-56 this) -1) + (mysql-nav-graph-method-22 (-> this nav-graph)) + (go (method-of-object this create)) + ) + (inc-cmd-id! this) + (set! (-> this edge-src) (-> this edge-dst)) + ) + ((mouse-pressed? right) + (if (= (-> this edge-dst) -2) + (nav-graph-editor-method-62 this) + ) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (go (method-of-object this create)) + ) + ) + (none) + ) + +(defstate create-edge (nav-graph-editor) + :virtual #t + :enter (behavior () + (cond + ((and (>= (-> self selected-index) 0) (-> self selected-node-edge?)) + (set! (-> self edge-src) (-> self selected-index)) + (set! (-> self edge-dst) -1) + ) + (else + (inc-cmd-id! self) + (set! (-> self edge-src) (the-as int (nav-graph-editor-method-55 self))) + (mysql-nav-graph-method-22 (-> self nav-graph)) + (set! (-> self edge-dst) -2) + (if (= (-> self edge-src) -1) + (go-virtual create) + ) + ) + ) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Dest node/pos" "" "Cancel") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-41 self) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-40 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-46 this) + (nav-graph-editor-method-47 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (cond + ((mouse-pressed? left) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons left)) + (go (method-of-object this create-edge)) + ) + ((and (mouse-pressed? right) (>= (-> this selected-index) 0) (not (-> this selected-node-edge?))) + ) + (else + (nav-graph-editor-method-63 this) + (nav-graph-editor-method-50 this) + ) + ) + (none) + ) + +(defstate edit-edge (nav-graph-editor) + :virtual #t + :enter (behavior () + (set! (-> self edge-src) -1) + (set! (-> self edge-dst) -1) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Create edge" "" "Delete edge") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-40 self) + ) + ) + +(defstate adjust-edge-visibility (nav-graph-editor) + :virtual #t + :enter (behavior () + (set! (-> self edge-visibility) (-> self selected-index)) + ) + :exit (behavior () + (set! (-> self edge-visibility) -1) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Add node" "Remove Node" "Exit") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-31 self (-> self edge-visibility)) + (nav-graph-editor-method-45 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-46 self) + (nav-graph-editor-method-33 self (the-as int (-> self selected-node-edge?)) (-> self selected-index)) + (cond + ((and (mouse-hold? left) (>= (-> self selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons left)) + (nav-graph-editor-method-57 self (-> self edge-visibility) (-> self selected-index)) + ) + ((and (mouse-hold? middle) (>= (-> self selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons middle)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons middle)) + (nav-graph-editor-method-61 self (-> self edge-visibility) (-> self selected-index)) + ) + ((mouse-hold? right) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (go-virtual adjust-minimap) + ) + ) + ) + ) + +(defstate adjust-node-angle (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (cond + ((not (mouse-hold? left)) + (go-virtual adjust-it) + ) + (else + (let ((v1-12 (-> self nav-graph node-array data (-> self selected-index)))) + (logior! (-> v1-12 mysql-save-flag) (mysql-save-flag update)) + (+! (-> v1-12 angle) (* 182.04445 (-> *mouse* speedx))) + (format *stdcon* "Angle = ~R~%" (-> v1-12 angle)) + ) + ) + ) + ) + ) + +(defstate adjust-node-radius (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (cond + ((not (mouse-hold? right)) + (go-virtual adjust-it) + ) + (else + (let ((v1-12 (-> self nav-graph node-array data (-> self selected-index)))) + (logior! (-> v1-12 mysql-save-flag) (mysql-save-flag update)) + (+! (-> v1-12 radius) (* 409.6 (-> *mouse* speedx))) + (if (< (-> v1-12 radius) 0.0) + (set! (-> v1-12 radius) 0.0) + ) + ) + (nav-graph-editor-method-32 self (-> self selected-index)) + ) + ) + ) + ) + +(defstate adjust-edge-width (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (cond + ((not (mouse-hold? right)) + (go-virtual adjust-it) + ) + (else + (let ((v1-12 (-> self nav-graph edge-array data (-> self selected-index)))) + (logior! (-> v1-12 mysql-save-flag) (mysql-save-flag update)) + (+! (-> v1-12 width) (* 409.6 (-> *mouse* speedx))) + (if (< (-> v1-12 width) 0.0) + (set! (-> v1-12 width) 0.0) + ) + ) + (nav-graph-editor-method-34 self (-> self selected-index)) + ) + ) + ) + ) + +(defstate adjust-edge-density (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-33 self (the-as int (-> self selected-node-edge?)) (-> self selected-index)) + (cond + ((not (mouse-hold? middle)) + (go-virtual adjust-it) + ) + (else + (let ((gp-0 (-> self nav-graph edge-array data (-> self selected-index)))) + (format *stdcon* "Density = ~F~%" (-> gp-0 density)) + (logior! (-> gp-0 mysql-save-flag) (mysql-save-flag update)) + (+! (-> gp-0 density) (/ (-> *mouse* speedx) 100)) + (if (< (-> gp-0 density) 0.0) + (set! (-> gp-0 density) 0.0) + ) + (if (< 1.0 (-> gp-0 density)) + (set! (-> gp-0 density) 1.0) + ) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-42 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-46 this) + (nav-graph-editor-method-47 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (when (>= (-> this selected-index) 0) + (if (-> this selected-node-edge?) + (nav-graph-editor-method-32 this (-> this selected-index)) + (nav-graph-editor-method-31 this (-> this selected-index)) + ) + ) + (cond + ((and (mouse-hold? left) (>= (-> this selected-index) 0)) + (if (-> this selected-node-edge?) + (go (method-of-object this adjust-node-angle)) + ) + ) + ((and (mouse-hold? right) (>= (-> this selected-index) 0)) + (if (-> this selected-node-edge?) + (go (method-of-object this adjust-node-radius)) + (go (method-of-object this adjust-edge-width)) + ) + ) + ((and (mouse-hold? middle) (>= (-> this selected-index) 0) (not (-> this selected-node-edge?))) + (go (method-of-object this adjust-edge-density)) + ) + (else + (nav-graph-editor-method-63 this) + (nav-graph-editor-method-50 this) + ) + ) + (none) + ) + +(defstate adjust-it (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (cond + ((>= (-> self selected-index) 0) + (if (-> self selected-node-edge?) + (nav-graph-editor-method-30 self "Node angle" "" "Node radius") + (nav-graph-editor-method-30 self "Edge speed limit" "Edge Density" "Edge Width") + ) + ) + (else + (nav-graph-editor-method-30 self "" "" "") + ) + ) + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-42 self) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-43 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-47 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (if (and (>= (-> this selected-index) 0) (not (-> this selected-node-edge?))) + (nav-graph-editor-method-31 this (-> this selected-index)) + ) + (cond + ((and (mouse-hold? left) (>= (-> this selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons left)) + (go (method-of-object this adjust-edge-visibility)) + ) + ((mouse-hold? right) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (go (method-of-object this draw-closest-minimap)) + ) + ((mouse-hold? middle) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons middle)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons middle)) + (let ((v1-41 (-> this minimap-make-mode))) + (set! (-> this minimap-make-mode) (the-as uint (cond + ((zero? v1-41) + 1 + ) + ((= v1-41 1) + 2 + ) + (else + 0 + ) + ) + ) + ) + ) + (case (-> this minimap-make-mode) + ((1) + (logior! (-> this default-edge minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (logior! (-> this default-node nav_node_flag) (nav-node-flag blocker)) + (logclear! (-> this default-node nav_node_flag) (nav-node-flag pov)) + ) + ((2) + (logclear! (-> this default-edge minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (logclear! (-> this default-node nav_node_flag) (nav-node-flag blocker)) + (logior! (-> this default-node nav_node_flag) (nav-node-flag pov)) + ) + (else + (logclear! (-> this default-edge minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (logclear! (-> this default-node nav_node_flag) (nav-node-flag blocker)) + (logclear! (-> this default-node nav_node_flag) (nav-node-flag pov)) + ) + ) + ) + (else + (nav-graph-editor-method-63 this) + (nav-graph-editor-method-50 this) + ) + ) + (none) + ) + +(defstate adjust-minimap (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (let* ((a0-0 self) + (t9-0 (method-of-object a0-0 nav-graph-editor-method-30)) + (a1-0 "Edge Visibility") + (v1-1 (-> self minimap-make-mode)) + ) + (t9-0 + a0-0 + a1-0 + (cond + ((zero? v1-1) + "Making Edges" + ) + ((= v1-1 2) + "Making POV" + ) + (else + "Making Blockers" + ) + ) + "Show Closest" + ) + ) + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-43 self) + ) + ) + +(defstate draw-closest-minimap (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-45 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-48 self) + (nav-graph-editor-method-49 self) + (when (>= (-> self closest-node) 0) + (let ((a1-0 (-> self nav-graph node-array data (-> self closest-node))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (when (not (logtest? (-> a1-0 mysql-save-flag) (mysql-save-flag delete))) + (get-node-draw-position gp-0 a1-0) + (add-debug-sphere #t (bucket-id debug) gp-0 (meters 4.5) (new 'static 'rgba :r #xff :a #x40)) + ) + ) + ) + (when (>= (-> self closest-edge) 0) + (let* ((s4-0 (-> self nav-graph edge-array data (-> self closest-edge))) + (a1-2 (-> self nav-graph node-array data (-> s4-0 runtime-node-id-1))) + (s3-0 (-> self nav-graph node-array data (-> s4-0 runtime-node-id-2))) + (gp-1 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position gp-1 a1-2) + (get-node-draw-position s5-0 s3-0) + (when (not (logtest? (-> s4-0 mysql-save-flag) (mysql-save-flag delete))) + (let ((s4-1 (new 'stack-no-clear 'inline-array 'vector 5))) + (vector-! (-> s4-1 4) s5-0 gp-1) + (vector-rotate90-around-y! (-> s4-1 4) (-> s4-1 4)) + (vector-normalize! (-> s4-1 4) (-> self dist-closest-edge)) + (vector+! (-> s4-1 0) gp-1 (-> s4-1 4)) + (vector+! (-> s4-1 1) s5-0 (-> s4-1 4)) + (vector-! (-> s4-1 2) s5-0 (-> s4-1 4)) + (vector-! (-> s4-1 3) gp-1 (-> s4-1 4)) + (let ((gp-2 *color-dark-green*)) + (add-debug-line #t (bucket-id debug) (-> s4-1 0) (-> s4-1 1) gp-2 #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) (-> s4-1 1) (-> s4-1 2) gp-2 #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) (-> s4-1 2) (-> s4-1 3) gp-2 #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) (-> s4-1 3) (-> s4-1 0) gp-2 #f (the-as rgba -1)) + ) + ) + ) + ) + ) + (cond + ((mouse-hold? right) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (go-virtual adjust-minimap) + ) + (else + (nav-graph-editor-method-63 self) + (nav-graph-editor-method-50 self) + ) + ) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-39 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-46 this) + (nav-graph-editor-method-47 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (cond + ((and (mouse-hold? left) (>= (-> this selected-index) 0) (-> this selected-node-edge?)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons left)) + (go (method-of-object this move-node)) + ) + ((mouse-hold? right) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (case (-> this minimap-make-mode) + ((2) + (go (method-of-object this create-pov)) + ) + (else + (go (method-of-object this create-edge)) + ) + ) + ) + ((and (mouse-hold? middle) (>= (-> this selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons middle)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons middle)) + (if (-> this selected-node-edge?) + (nav-graph-editor-method-59 this (-> this selected-index)) + (nav-graph-editor-method-60 this (-> this selected-index)) + ) + ) + (else + (nav-graph-editor-method-63 this) + (nav-graph-editor-method-50 this) + ) + ) + (none) + ) + +(defstate create (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (let* ((a0-0 self) + (t9-0 (method-of-object a0-0 nav-graph-editor-method-30)) + (a1-0 "Move node") + (a2-0 "Delete node/edge") + (v1-1 (-> self minimap-make-mode)) + ) + (t9-0 a0-0 a1-0 a2-0 (if (= v1-1 2) + "Create POV" + "Create edge(s)" + ) + ) + ) + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-39 self) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-44 ((this nav-graph-editor)) + (if (not (mouse-hold? right)) + (go (method-of-object this create)) + ) + (none) + ) + +(defstate create-pov (nav-graph-editor) + :virtual #t + :enter (behavior () + (cond + ((and (>= (-> self selected-index) 0) (-> self selected-node-edge?)) + ) + (else + (inc-cmd-id! self) + (nav-graph-editor-method-55 self) + (mysql-nav-graph-method-22 (-> self nav-graph)) + ) + ) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "" "" "") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-44 self) + ) + ) + +(defbehavior nav-graph-editor-init-by-other nav-graph-editor ((arg0 string) (arg1 symbol)) + (add-setting! 'mouse #t 0.0 0) + (add-setting! 'cursor #t 0.0 0) + (set! (-> self minimap-make-mode) (the-as uint 0)) + (set! (-> self nav-graph) (new 'debug 'mysql-nav-graph arg0)) + (set! (-> self command-array) (new 'debug 'nav-graph-command-array 256)) + (set! (-> self command-array length) 0) + (set! *nav-graph-editor* (the-as (pointer nav-graph-editor) (process->ppointer self))) + (let ((v1-8 (-> self default-node))) + (set! (-> v1-8 angle) 0.0) + (set! (-> v1-8 radius) 16384.0) + (set! (-> v1-8 nav_mesh_id) (the-as uint 0)) + (set! (-> v1-8 level_name) arg1) + (set! (-> v1-8 nav_node_flag) (nav-node-flag pedestrian)) + ) + (let ((v1-9 (-> self default-edge))) + (set! (-> v1-9 directionality) (nav-directionality default)) + (set! (-> v1-9 speed_limit) 40960.0) + (set! (-> v1-9 density) 0.25) + (set! (-> v1-9 traffic_edge_flag) 0) + (set! (-> v1-9 nav_clock_mask) (nav-clock-mask phase-1)) + (set! (-> v1-9 nav_clock_type) (nav-clock-type no-clock)) + (set! (-> v1-9 width) 16384.0) + (set! (-> v1-9 minimap_edge_flag) (nav-minimap-edge-flag)) + ) + 0 + (set! (-> self command-id) 0) + (set! (-> self edge-visibility) -1) + (cond + ((= arg0 'hover) + (set! (-> self vehicle-edit-mode) #t) + (set! (-> self hover-edit-mode) #t) + (set! (-> self default-node nav_node_flag) (nav-node-flag)) + 0 + ) + (else + (set! (-> self vehicle-edit-mode) #f) + (set! (-> self hover-edit-mode) #f) + ) + ) + (set! (-> self plane-height) (-> (target-pos 0) y)) + (set! (-> self clipping-dist) 2048000.0) + (go-virtual create) + ) + +(defun run-nav-graph-editor ((arg0 symbol) (arg1 symbol)) + (when (not *nav-graph-editor*) + (let ((s4-0 (process-spawn + nav-graph-editor + arg0 + (if arg1 + arg1 + 'unknown + ) + :name "nav-graph-editor" + ) + ) + ) + (when arg1 + (let ((v1-4 *nav-graph-editor*)) + (if v1-4 + (nav-graph-editor-method-66 (-> v1-4 0) arg0 (the-as string arg1)) + ) + ) + ) + s4-0 + ) + ) + ) + +;; WARN: Return type mismatch process vs nav-graph-editor. (defun get-nav-graph-editor () - (the nav-graph-editor #f) - ) \ No newline at end of file + (the-as nav-graph-editor (ppointer->process *nav-graph-editor*)) + ) + +(defun exit-nav-graph-editor () + (if *nav-graph-editor* + (deactivate (ppointer->process *nav-graph-editor*)) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs object. +(defun nav-graph-set-level ((arg0 symbol)) + (let ((v1-0 (ppointer->process *nav-graph-editor*))) + (when v1-0 + (let ((v1-2 (-> (the-as nav-graph-editor v1-0) nav-graph))) + (dotimes (a1-1 (-> v1-2 node-array length)) + (set! (-> v1-2 node-array data a1-1 level_name) arg0) + (logior! (-> v1-2 node-array data a1-1 mysql-save-flag) (mysql-save-flag update)) + ) + ) + #f + ) + ) + ) + +;; WARN: Return type mismatch mysql-save-flag vs none. +(defun set-minimap-edge-flag ((arg0 nav-minimap-edge-flag)) + (let ((v1-0 (ppointer->process *nav-graph-editor*))) + (when v1-0 + (when (>= (-> (the-as nav-graph-editor v1-0) edge-visibility) 0) + (let ((v1-4 (-> (the-as nav-graph-editor v1-0) + nav-graph + edge-array + data + (-> (the-as nav-graph-editor v1-0) edge-visibility) + ) + ) + ) + (when (not (logtest? (-> v1-4 minimap_edge_flag) (nav-minimap-edge-flag blocker))) + (set! (-> v1-4 minimap_edge_flag) arg0) + (logior! (-> v1-4 mysql-save-flag) (mysql-save-flag update)) + ) + ) + ) + ) + ) + (none) + ) + +(defun set-vehicle-edit-mode ((arg0 symbol)) + (let ((v1-0 (ppointer->process *nav-graph-editor*))) + (when v1-0 + (set! (-> (the-as nav-graph-editor v1-0) vehicle-edit-mode) arg0) + (set! (-> (the-as nav-graph-editor v1-0) default-node nav_node_flag) (if arg0 + (nav-node-flag) + (nav-node-flag pedestrian) + ) + ) + ) + ) + (none) + ) + +(defun translate-nav-graph ((arg0 float) (arg1 float) (arg2 float)) + (when (ppointer->process *nav-graph-editor*) + (let ((v1-2 (ppointer->process *nav-graph-editor*))) + (dotimes (a3-2 (-> (the-as nav-graph-editor v1-2) nav-graph node-array length)) + (let ((t0-3 (-> (the-as nav-graph-editor v1-2) nav-graph node-array data a3-2))) + (+! (-> t0-3 position x) arg0) + (+! (-> t0-3 position y) arg1) + (+! (-> t0-3 position z) arg2) + (logior! (-> t0-3 mysql-save-flag) (mysql-save-flag update)) + ) + ) + ) + #f + ) + ) + +(defun update-nav-meshes () + (when (ppointer->process *nav-graph-editor*) + (let ((gp-0 (ppointer->process *nav-graph-editor*))) + (dotimes (s5-0 (-> (the-as nav-graph-editor gp-0) nav-graph node-array length)) + (if (not (logtest? (-> (the-as nav-graph-editor gp-0) nav-graph node-array data s5-0 mysql-save-flag) + (mysql-save-flag delete) + ) + ) + (nav-graph-editor-method-58 (the-as nav-graph-editor gp-0) s5-0) + ) + ) + ) + #f + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun delete-node-nav-mesh ((arg0 int)) + (when (ppointer->process *nav-graph-editor*) + (let ((s5-0 (ppointer->process *nav-graph-editor*)) + (a1-0 0) + ) + (while (< a1-0 (-> (the-as nav-graph-editor s5-0) nav-graph node-array length)) + (let ((v1-7 (-> (the-as nav-graph-editor s5-0) nav-graph node-array data a1-0))) + (when (and (not (logtest? (-> v1-7 mysql-save-flag) (mysql-save-flag delete))) (= arg0 (-> v1-7 nav_mesh_id))) + (nav-graph-editor-method-59 (-> *nav-graph-editor* 0) a1-0) + (set! a1-0 0) + ) + ) + (set! a1-0 (+ a1-0 1)) + ) + ) + ) + (none) + ) + +(defun smooth-nav-graph ((arg0 string)) + (local-vars + (sv-96 int) + (sv-112 int) + (sv-128 int) + (sv-144 mysql-nav-edge) + (sv-160 vector) + (sv-176 vector) + (sv-192 vector) + (sv-208 vector) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let* ((v1-0 *nav-graph-editor*) + (s5-0 (-> (the-as nav-graph-editor (if v1-0 + (the-as nav-graph-editor (-> v1-0 0 self)) + ) + ) + nav-graph + ) + ) + ) + (dotimes (s4-0 (-> s5-0 node-array length)) + (let ((s3-0 (-> s5-0 node-array data s4-0)) + (s2-0 (new-stack-vector0)) + (s0-0 (new-stack-vector0)) + (s1-0 (new-stack-vector0)) + ) + (set! sv-96 0) + (set! sv-112 0) + (when (and (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) (= (-> s3-0 level_name) arg0)) + (set! sv-128 0) + (while (< sv-128 (-> s5-0 edge-array length)) + (set! sv-144 (-> s5-0 edge-array data sv-128)) + (when (not (logtest? (-> sv-144 mysql-save-flag) (mysql-save-flag delete))) + (when (= (-> sv-144 runtime-node-id-1) s4-0) + (let ((v1-27 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) + (a1-3 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) + ) + (set! sv-176 s1-0) + (set! sv-160 s1-0) + (let ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-3 position) (-> v1-27 position)) 1.0)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-160 quad)) + (.lvf vf5 (&-> v0-0 quad)) + ) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + (set! sv-112 (+ sv-112 1)) + sv-112 + ) + (when (= (-> sv-144 runtime-node-id-2) s4-0) + (let ((v1-40 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) + (a1-9 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) + ) + (set! sv-208 s0-0) + (set! sv-192 s0-0) + (let ((v0-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-9 position) (-> v1-40 position)) 1.0)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-192 quad)) + (.lvf vf5 (&-> v0-1 quad)) + ) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-208 quad) vf6) + (set! sv-96 (+ sv-96 1)) + sv-96 + ) + ) + (set! sv-128 (+ sv-128 1)) + ) + (cond + ((and (>= sv-112 2) (= sv-96 1)) + (vector-copy! s2-0 s0-0) + ) + ((and (>= sv-96 2) (= sv-112 1)) + (vector-copy! s2-0 s1-0) + ) + (else + (vector-normalize! s0-0 0.5) + (vector-normalize! s1-0 1.0) + (vector+! s2-0 s0-0 s1-0) + ) + ) + (vector-normalize! s2-0 1.0) + (logior! (-> s3-0 mysql-save-flag) (mysql-save-flag update)) + (set! (-> s3-0 angle) (+ -16384.0 (vector-y-angle s2-0))) + ) + ) + ) + ) + #f + ) + ) + +(defun update-height ((arg0 string)) + (let* ((v1-0 *nav-graph-editor*) + (v1-2 (-> (the-as nav-graph-editor (if v1-0 + (the-as nav-graph-editor (-> v1-0 0 self)) + ) + ) + nav-graph + ) + ) + ) + (dotimes (a1-1 (-> v1-2 node-array length)) + (let ((a2-3 (-> v1-2 node-array data a1-1))) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (if (and (not (logtest? (-> a2-3 nav_node_flag) (nav-node-flag pedestrian))) + (not (logtest? (-> a2-3 mysql-save-flag) (mysql-save-flag delete))) + (= (-> a2-3 level_name) arg0) + ) + (logior! (-> a2-3 mysql-save-flag) (mysql-save-flag update)) + ) + ) + ) + ) + #f + ) + +(defun update-width ((arg0 string)) + (local-vars (sv-16 (array entity-nav-mesh)) (sv-32 int) (sv-48 uint) (sv-64 entity-nav-mesh)) + (let* ((v1-0 *nav-graph-editor*) + (s5-0 (-> (the-as nav-graph-editor (if v1-0 + (the-as nav-graph-editor (-> v1-0 0 self)) + ) + ) + nav-graph + ) + ) + ) + (dotimes (s4-0 (-> s5-0 edge-array length)) + (let ((s3-0 (-> s5-0 edge-array data s4-0))) + (when (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) + (let ((s2-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-1))) + (s1-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-2))) + ) + (when (and (= (-> s2-0 level_name) arg0) + (= (-> s1-0 level_name) arg0) + (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian)) + (logtest? (-> s1-0 nav_node_flag) (nav-node-flag pedestrian)) + ) + (cond + ((= (-> s2-0 nav_mesh_id) (-> s1-0 nav_mesh_id)) + (dotimes (s0-0 (-> *level* length)) + (let ((v1-25 (-> *level* level s0-0))) + (when (= (-> v1-25 status) 'active) + (set! sv-16 (-> v1-25 bsp nav-meshes)) + (when (nonzero? sv-16) + (set! sv-32 0) + (while (< sv-32 (-> sv-16 length)) + (set! sv-64 (-> sv-16 sv-32)) + (set! sv-48 (-> sv-64 aid)) + (let ((v1-36 (if (type? sv-64 entity-nav-mesh) + sv-64 + ) + ) + ) + (when (and v1-36 (= sv-48 (-> s2-0 nav_mesh_id))) + (let* ((f0-0 (nav-mesh-method-37 (-> v1-36 nav-mesh) (-> s2-0 position) (-> s1-0 position) 16384.0)) + (f0-1 (+ -409.6 f0-0)) + ) + (when (and (< 0.0 f0-1) (!= f0-1 (-> s3-0 width))) + (set! (-> s3-0 width) f0-1) + (logior! (-> s3-0 mysql-save-flag) (mysql-save-flag update)) + ) + (if (>= 0.0 f0-1) + (format #t "!!!! edge ~D ~D outside nav-mesh~%" (-> s2-0 nav_node_id) (-> s1-0 nav_node_id)) + ) + ) + ) + ) + (set! sv-32 (+ sv-32 1)) + ) + ) + ) + ) + ) + #f + ) + (else + (format #t "***** edge ~D ~D overlaps 2 nav-meshes~%" (-> s2-0 nav_node_id) (-> s1-0 nav_node_id)) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) diff --git a/goal_src/jak3/engine/debug/visvol-edit.gc b/goal_src/jak3/engine/debug/visvol-edit.gc index 5c9175192b..494fe27495 100644 --- a/goal_src/jak3/engine/debug/visvol-edit.gc +++ b/goal_src/jak3/engine/debug/visvol-edit.gc @@ -5,5 +5,478 @@ ;; name in dgo: visvol-edit ;; dgos: GAME +;; +++visvol-edit-func +(defenum visvol-edit-func + :type uint64 + (visvol-positive 0) + (visvol-negative 1) + (adjust-sphere 2) + (adjust-vis-distance 3) + ) +;; ---visvol-edit-func + + ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) + +(deftype visvol-edit-info (structure) + ((editing symbol) + (current-func visvol-edit-func) + (analog-func visvol-edit-func) + ) + (:methods + (handle-pad-input (_type_) object) + (draw-menu (_type_ process-drawable) object) + (set-origin-joint-idx! (_type_ process-drawable) none) + ) + ) + + +(deftype visvol-editor (process) + ((proc handle) + ) + (:state-methods + idle + ) + ) + + +;; WARN: Return type mismatch int vs object. +(defmethod handle-pad-input ((this visvol-edit-info)) + (if (cpad-pressed? 0 up) + (+! (-> this current-func) -1) + ) + (if (cpad-pressed? 0 left) + (+! (-> this current-func) -4) + ) + (if (cpad-pressed? 0 down) + (+! (-> this current-func) 1) + ) + (if (cpad-pressed? 0 right) + (+! (-> this current-func) 4) + ) + (cond + ((< (the-as int (-> this current-func)) 0) + (let ((v0-0 2)) + (set! (-> this current-func) (the-as visvol-edit-func v0-0)) + v0-0 + ) + ) + ((>= (the-as int (-> this current-func)) 3) + (set! (-> this current-func) (visvol-edit-func visvol-positive)) + 0 + ) + ) + ) + +;; WARN: Function (method 11 visvol-edit-info) has a return type of none, but the expression builder found a return statement. +(defmethod set-origin-joint-idx! ((this visvol-edit-info) (arg0 process-drawable)) + (if (or (not arg0) (!= (-> this analog-func) 2)) + (return #f) + ) + (let ((v0-1 (the-as int (-> arg0 draw origin-joint-index)))) + (let ((v1-7 (+ (-> arg0 node-list length) -1))) + (when (cpad-pressed? 0 r1) + (set! v0-1 (the-as int (+ (the-as uint v0-1) 1))) + (if (cpad-hold? 0 l1) + (set! v0-1 (the-as int (+ (the-as uint v0-1) 4))) + ) + (case v0-1 + ((1 2) + (set! v0-1 3) + ) + ) + ) + (when (cpad-pressed? 0 l1) + (+! v0-1 -1) + (if (cpad-hold? 0 r1) + (+! v0-1 -4) + ) + (case v0-1 + ((1 2) + (set! v0-1 0) + ) + ) + ) + (if (< v0-1 0) + (set! v0-1 v1-7) + ) + (if (< v1-7 v0-1) + (set! v0-1 0) + ) + ) + (set! (-> arg0 draw origin-joint-index) (the-as uint v0-1)) + ) + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod draw-menu ((this visvol-edit-info) (arg0 process-drawable)) + (when (cpad-pressed? 0 l2) + (set! (-> this editing) (not (-> this editing))) + (cond + ((-> this editing) + (set! *external-cam-mode* 'locked) + ) + (*target* + (set! *external-cam-mode* #f) + ) + (else + (set! *external-cam-mode* 'pad-0) + ) + ) + ) + (cond + ((or (not (-> this editing)) (cpad-hold? 0 r2)) + (if (not (-> this editing)) + (format *stdcon* "press l2 to edit visvol~%") + (format *stdcon* "release r2 to continue editing visvol~%") + ) + (if (or (cpad-hold? 0 r2) (not *target*)) + (set! *external-cam-mode* 'pad-0) + ) + ) + (else + (set! *external-cam-mode* 'locked) + (handle-pad-input this) + (set-origin-joint-idx! this arg0) + (let ((s3-0 ">") + (s4-0 " ") + ) + (if (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) + (set! s3-0 " ") + ) + (format *stdcon* " r2/l2: move camera~%") + (format + *stdcon* + " r1/l1: select joint ~D ~S~%" + (if arg0 + (the-as int (-> arg0 draw origin-joint-index)) + -1 + ) + (if (and arg0 (-> arg0 node-list data (-> arg0 draw origin-joint-index) joint)) + (-> arg0 node-list data (-> arg0 draw origin-joint-index) joint name) + "?" + ) + ) + (format *stdcon* " dpad: select function~%") + (format *stdcon* " x, tri: toggle/call~%") + (format *stdcon* "------------------------~%") + (let ((t9-9 format) + (a0-14 *stdcon*) + (a1-9 " ~S analog: ~S~%") + (a2-1 (if (= (-> this current-func) (visvol-edit-func visvol-positive)) + s3-0 + s4-0 + ) + ) + (v1-45 (-> this analog-func)) + ) + (t9-9 a0-14 a1-9 a2-1 (cond + ((= v1-45 (visvol-edit-func visvol-positive)) + (set! *display-xyz-axes* #t) + "visvol positive" + ) + ((= v1-45 (visvol-edit-func visvol-negative)) + (set! *display-xyz-axes* #t) + "visvol negative" + ) + ((= v1-45 (visvol-edit-func adjust-sphere)) + (set! *display-xyz-axes* #f) + "adjust sphere" + ) + ((= v1-45 (visvol-edit-func adjust-vis-distance)) + (set! *display-xyz-axes* #f) + "adjust vis distance" + ) + (else + "???" + ) + ) + ) + ) + (format *stdcon* " ~S print to listener~%" (if (= (-> this current-func) (visvol-edit-func visvol-negative)) + s3-0 + s4-0 + ) + ) + (format *stdcon* " ~S quit~%" (cond + ((= (-> this current-func) (visvol-edit-func adjust-sphere)) + (empty) + s3-0 + ) + (else + s4-0 + ) + ) + ) + ) + (let ((v1-51 0)) + (if (cpad-pressed? 0 x) + (+! v1-51 1) + ) + (if (cpad-pressed? 0 triangle) + (+! v1-51 -1) + ) + (when (nonzero? v1-51) + (case (-> this current-func) + (((visvol-edit-func visvol-positive)) + (+! (-> this analog-func) v1-51) + ) + (((visvol-edit-func visvol-negative)) + (when arg0 + (let ((s4-1 (entity-by-name (-> arg0 name)))) + (when s4-1 + (let ((f30-0 (res-lump-float s4-1 'vis-dist :default 200.0)) + (s4-2 (res-lump-data s4-1 'visvol (pointer float))) + ) + (when s4-2 + (format #t "~%actor-vis ~S ~M " (-> arg0 name) f30-0) + (format #t "~M ~M ~M ~M ~M ~M~%~%" (-> s4-2 0) (-> s4-2 1) (-> s4-2 2) (-> s4-2 4) (-> s4-2 5) (-> s4-2 6)) + ) + ) + ) + ) + (format + #t + "~%:bounds (static-spherem ~M ~M ~M ~M)~%" + (-> arg0 draw bounds x) + (-> arg0 draw bounds y) + (-> arg0 draw bounds z) + (-> arg0 draw bounds w) + ) + (let ((v1-63 (-> arg0 draw origin-joint-index))) + (format + #t + ":origin-joint ~s~%~%" + (if (and (>= v1-63 0) (< v1-63 (the-as uint (-> arg0 node-list length))) (-> arg0 node-list data v1-63 joint)) + (-> arg0 node-list data v1-63 joint name) + "?" + ) + ) + ) + ) + ) + (((visvol-edit-func adjust-sphere)) + (kill-by-type visvol-editor *active-pool*) + ) + (else + (format 0 "~%ERROR: bad visvol-edit-func~%") + ) + ) + ) + ) + (cond + ((< (the-as int (-> this analog-func)) 0) + (set! (-> this analog-func) (visvol-edit-func adjust-vis-distance)) + ) + ((>= (the-as int (-> this analog-func)) 4) + (set! (-> this analog-func) (visvol-edit-func visvol-positive)) + 0 + ) + ) + (when arg0 + (let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0)) + (f30-1 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 1.0)) + (f0-10 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 1.0)) + ) + (when (or (!= f28-0 0.0) (!= f30-1 0.0) (!= f26-0 0.0) (!= f0-10 0.0)) + (case (-> this analog-func) + (((visvol-edit-func visvol-positive) (visvol-edit-func visvol-negative)) + (set! f28-0 (* 1228.8 f28-0)) + (set! f30-1 (* -1228.8 f30-1)) + (set! f26-0 (* 1228.8 f26-0)) + (let ((f0-11 (/ f0-10 -100))) + (set! f0-10 (+ 1.0 f0-11)) + ) + ) + (((visvol-edit-func adjust-sphere)) + (set! f28-0 (* -409.6 f28-0)) + (set! f30-1 (* -409.6 f30-1)) + (set! f26-0 (* -409.6 f26-0)) + (let ((f0-12 (/ f0-10 100))) + (set! f0-10 (+ 1.0 f0-12)) + ) + ) + (((visvol-edit-func adjust-vis-distance)) + (let ((f1-15 (/ f28-0 100))) + (set! f28-0 (+ 1.0 f1-15)) + ) + (let ((f1-17 (/ f30-1 -100))) + (set! f30-1 (+ 1.0 f1-17)) + ) + (let ((f1-19 (/ f26-0 100))) + (set! f26-0 (+ 1.0 f1-19)) + ) + ) + ) + (case (-> this analog-func) + (((visvol-edit-func visvol-positive)) + (let ((a0-57 (entity-by-name (-> arg0 name)))) + (when a0-57 + (let ((v1-110 (res-lump-data a0-57 'visvol (pointer float)))) + (when v1-110 + (let ((a2-23 (&-> v1-110 4)) + (a0-58 (&-> v1-110 4)) + (a1-29 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-29 x) f28-0) + (set! (-> a1-29 y) f30-1) + (set! (-> a1-29 z) f26-0) + (set! (-> a1-29 w) 1.0) + (vector+! (the-as vector a2-23) (the-as vector a0-58) a1-29) + ) + (set! (-> v1-110 4) (fmax (-> v1-110 4) (+ 4096.0 (-> v1-110 0)))) + (set! (-> v1-110 5) (fmax (-> v1-110 5) (+ 4096.0 (-> v1-110 1)))) + (set! (-> v1-110 6) (fmax (-> v1-110 6) (+ 4096.0 (-> v1-110 2)))) + ) + ) + ) + ) + ) + (((visvol-edit-func visvol-negative)) + (let ((a0-65 (entity-by-name (-> arg0 name)))) + (when a0-65 + (let ((v1-112 (res-lump-data a0-65 'visvol (pointer float)))) + (when v1-112 + (let ((a2-26 (&-> v1-112 0)) + (a0-66 (&-> v1-112 0)) + (a1-34 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-34 x) f28-0) + (set! (-> a1-34 y) f30-1) + (set! (-> a1-34 z) f26-0) + (set! (-> a1-34 w) 1.0) + (vector+! (the-as vector a2-26) (the-as vector a0-66) a1-34) + ) + (set! (-> v1-112 0) (fmin (-> v1-112 0) (+ -4096.0 (-> v1-112 4)))) + (set! (-> v1-112 1) (fmin (-> v1-112 1) (+ -4096.0 (-> v1-112 5)))) + (set! (-> v1-112 2) (fmin (-> v1-112 2) (+ -4096.0 (-> v1-112 6)))) + ) + ) + ) + ) + ) + (((visvol-edit-func adjust-sphere)) + (set! (-> arg0 draw bounds w) (* (-> arg0 draw bounds w) f0-10)) + (let ((s4-3 (matrix-copy! (new 'stack-no-clear 'matrix) (matrix-local->world #f #f))) + (s2-0 (matrix-copy! + (new 'stack-no-clear 'matrix) + (-> arg0 node-list data (-> arg0 draw origin-joint-index) bone transform) + ) + ) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-1 x) f28-0) + (set! (-> s3-1 y) f30-1) + (set! (-> s3-1 z) f26-0) + (set! (-> s3-1 w) 1.0) + (vector-reset! (-> s4-3 trans)) + (vector-matrix*! s3-1 s3-1 s4-3) + (vector-reset! (-> s2-0 trans)) + (matrix-transpose! s2-0 s2-0) + (vector-matrix*! s3-1 s3-1 s2-0) + (+! (-> arg0 draw bounds x) (-> s3-1 x)) + (+! (-> arg0 draw bounds y) (-> s3-1 y)) + (+! (-> arg0 draw bounds z) (-> s3-1 z)) + ) + ) + (((visvol-edit-func adjust-vis-distance)) + (let ((s4-4 (entity-by-name (-> arg0 name)))) + (when s4-4 + (let ((f0-36 (* (res-lump-float s4-4 'vis-dist :default 200.0) f30-1))) + (add-32bit-data! + s4-4 + (new 'static 'res-tag :name 'vis-dist :key-frame -1000000000.0 :elt-count #x1 :elt-type float) + f0-36 + ) + ) + ) + ) + ) + ) + ) + ) + (case (-> this analog-func) + (((visvol-edit-func adjust-vis-distance)) + (let ((a0-93 (entity-by-name (-> arg0 name)))) + (when a0-93 + (let ((f0-37 (res-lump-float a0-93 'vis-dist :default 200.0))) + (format *stdcon* "~%vis distance: ~M" f0-37) + ) + ) + ) + ) + ) + ) + ) + ) + (case (-> this analog-func) + (((visvol-edit-func adjust-sphere)) + (when arg0 + (let ((a1-53 (-> arg0 draw origin-joint-index))) + (show-maya-skeleton arg0 (the-as int a1-53) #x46400000) + ) + ) + ) + ) + 0 + ) + +(define *visvol-edit-info* (the-as visvol-edit-info 0)) + +(define *visvol-edit-info* (new 'static 'visvol-edit-info :editing #t)) + +(defstate idle (visvol-editor) + :virtual #t + :enter (behavior () + (set! *display-actor-vis* #t) + ) + :exit (behavior () + (set! *display-xyz-axes* #f) + (set! *display-actor-vis* #f) + (set! *external-cam-mode* #f) + ) + :trans (behavior () + (draw-menu + *visvol-edit-info* + (the-as process-drawable (as-type (handle->process (-> self proc)) process-drawable)) + ) + ) + :code sleep-code + ) + +(defbehavior visvol-editor-init-by-other visvol-editor ((arg0 handle)) + (set! (-> self proc) arg0) + (go-virtual idle) + ) + +;; WARN: Return type mismatch int vs object. +(defun stop-visvol-edit () + (kill-by-type visvol-editor *active-pool*) + 0 + ) + +;; WARN: Return type mismatch int vs object. +(defun visvol-edit ((arg0 string)) + (stop-visvol-edit) + (let* ((v1-0 (process->ppointer (process-by-name arg0 *active-pool*))) + (gp-0 (logior (if v1-0 + (new 'static 'handle :pid (-> v1-0 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-0) + ) + ) + ) + (if (not (handle->process gp-0)) + (set! gp-0 (process->handle *debug-actor*)) + (debug-actor arg0) + ) + (process-spawn visvol-editor gp-0 :name "visvol-editor") + ) + 0 + ) diff --git a/goal_src/jak3/engine/game/main.gc b/goal_src/jak3/engine/game/main.gc index 28b9a37f2c..07d6ced349 100644 --- a/goal_src/jak3/engine/game/main.gc +++ b/goal_src/jak3/engine/game/main.gc @@ -1564,6 +1564,9 @@ ;; wrap up this frame (drawing of stdcon, debugging, etc.) (end-display arg0) + ;; og:preserve-this push text below the imgui bar if it's currently open + (when (pc-is-imgui-visible?) + (format *stdcon* "~%~%")) ;; finalize the DMA chain. This does have some potentially complicated texture stuff. ;; Note that, in debug mode, this will do a sync-path, waiting for VU1 to finish. diff --git a/goal_src/jak3/engine/gfx/foreground/lights.gc b/goal_src/jak3/engine/gfx/foreground/lights.gc index 06f6700c27..950f550aa2 100644 --- a/goal_src/jak3/engine/gfx/foreground/lights.gc +++ b/goal_src/jak3/engine/gfx/foreground/lights.gc @@ -20,9 +20,13 @@ (vector-lerp! (-> light-out color) (-> light-a color) (-> light-b color) clamped-alpha) (vector-deg-slerp (-> light-out direction) (-> light-a direction) (-> light-b direction) clamped-alpha) (let ((extra-x-a (-> light-a extra x)) - (extra-x-b (-> light-b extra x))) - (set! (-> light-out extra x) (+ extra-x-a (* clamped-alpha (- extra-x-b extra-x-a)))))) - light-out) + (extra-x-b (-> light-b extra x)) + ) + (set! (-> light-out extra x) (+ extra-x-a (* clamped-alpha (- extra-x-b extra-x-a)))) + ) + ) + light-out + ) (defun light-group-slerp ((light-group-out light-group) (light-group-a light-group) (light-group-b light-group) (alpha float)) "Linearly interpolate between two [[light-groups]]s by calling [[light-slerp]] on each respective collection of lights @@ -32,8 +36,15 @@ @param alpha @returns The linearly interpolated [[light-group]]" (dotimes (group-idx 4) - (light-slerp (-> light-group-out lights group-idx) (-> light-group-a lights group-idx) (-> light-group-b lights group-idx) alpha)) - light-group-out) + (light-slerp + (-> light-group-out lights group-idx) + (-> light-group-a lights group-idx) + (-> light-group-b lights group-idx) + alpha + ) + ) + light-group-out + ) (defun light-group-process! ((vu-lights vu-lights) (light-group light-group) (vec1 vector) (vec2 vector)) "Unused, needlessly calls [[rotate-y<-vector+vector]] on the two [[vector]]s and calls [[vu-lights<-light-group!]] @@ -44,7 +55,8 @@ @returns [[none]]" (rotate-y<-vector+vector vec2 vec1) (vu-lights<-light-group! vu-lights light-group) - (none)) + (none) + ) (define *default-lights* (new 'global 'vu-lights)) @@ -59,7 +71,8 @@ (set-vector! (-> lights direction 0) 1.0 0.0 0.0 1.0) (set-vector! (-> lights direction 1) 0.0 1.0 0.0 1.0) (set-vector! (-> lights direction 2) 0.0 0.0 1.0 1.0) - lights) + lights + ) ;; WARN: Return type mismatch pointer vs none. (defun-debug init-light-hash () @@ -75,8 +88,12 @@ (set! (-> *light-hash* num-buckets) (the-as uint 0)) (set! (-> *light-hash* bucket-array) (the-as (inline-array light-hash-bucket) (malloc 'loading-level 4096))) (set! (-> *light-hash* index-array) (malloc 'loading-level #x10000)) - (set! (-> *light-hash* light-sphere-array) (the-as (inline-array light-sphere) (malloc 'loading-level #x4000)))) - (none)) + (set! (-> *light-hash* light-sphere-array) + (the-as (inline-array light-sphere) (malloc 'loading-level #x4000)) + ) + ) + (none) + ) (init-light-hash) @@ -84,18 +101,20 @@ (def-mips2c light-hash-add-items (function light-hash light-sphere integer object)) -(defun-debug reset-light-hash () +(defun-debug reset-light-hash ((arg0 light-hash)) "Resets the global [[*light-hash*]] back to having `0` lights, indicies, and buckets. @returns [[none]]" (set! (-> *light-hash* num-lights) (the-as uint 0)) (set! (-> *light-hash* num-indices) (the-as uint 0)) (set! (-> *light-hash* num-buckets) (the-as uint 0)) 0 - (none)) + (none) + ) (defun-debug update-light-hash ((arg0 light-hash)) (let ((v1-0 (new 'stack-no-clear 'bounding-box)) - (s5-0 (new 'stack-no-clear 'vector))) + (s5-0 (new 'stack-no-clear 'vector)) + ) (let ((s4-0 (new 'stack-no-clear 'vector))) (let ((f0-0 0.0)) (set-vector! (-> v1-0 min) 4095996000.0 4095996000.0 4095996000.0 1.0) @@ -108,40 +127,71 @@ (set! (-> v1-0 max x) (fmax (-> v1-0 max x) (+ (-> a1-9 bsphere x) (-> a1-9 bsphere w)))) (set! (-> v1-0 max y) (fmax (-> v1-0 max y) (+ (-> a1-9 bsphere y) (-> a1-9 bsphere w)))) (set! (-> v1-0 max z) (fmax (-> v1-0 max z) (+ (-> a1-9 bsphere z) (-> a1-9 bsphere w)))) - (+! f0-0 (-> a1-9 bsphere w)))) - (set! (-> arg0 base-trans quad) (-> v1-0 min quad)) + (+! f0-0 (-> a1-9 bsphere w)) + ) + ) + (vector-copy! (-> arg0 base-trans) (-> v1-0 min)) (let ((f0-1 (/ f0-0 (the float (-> arg0 num-lights))))) (dotimes (a0-8 3) (set! (-> s5-0 data a0-8) (- (-> v1-0 max data a0-8) (-> v1-0 min data a0-8))) - (set! (-> s4-0 data a0-8) (if (= (-> s5-0 data a0-8) 0.0) 1.0 (/ (-> s5-0 data a0-8) (/ f0-1 (the float (-> arg0 num-lights))))))))) + (set! (-> s4-0 data a0-8) (if (= (-> s5-0 data a0-8) 0.0) + 1.0 + (/ (-> s5-0 data a0-8) (/ f0-1 (the float (-> arg0 num-lights)))) + ) + ) + ) + ) + ) (let ((f0-5 (cube-root (/ (the float (-> arg0 num-lights)) (* (-> s4-0 x) (-> s4-0 y) (-> s4-0 z)))))) (set! (-> arg0 dimension-array x) (max 1 (min 16 (the int (+ 0.5 (* f0-5 (-> s4-0 x))))))) (set! (-> arg0 dimension-array y) (max 1 (min 4 (the int (+ 0.5 (* f0-5 (-> s4-0 y))))))) - (set! (-> arg0 dimension-array z) (max 1 (min 16 (the int (+ 0.5 (* f0-5 (-> s4-0 z))))))))) + (set! (-> arg0 dimension-array z) (max 1 (min 16 (the int (+ 0.5 (* f0-5 (-> s4-0 z))))))) + ) + ) (set! (-> arg0 bucket-step 0) (the-as uint (* (-> arg0 dimension-array z) (-> arg0 dimension-array x)))) (set! (-> arg0 bucket-step 1) (the-as uint (-> arg0 dimension-array x))) (dotimes (v1-13 3) - (set! (-> arg0 axis-scale data v1-13) (/ (the float (-> arg0 dimension-array data v1-13)) (-> s5-0 data v1-13))))) - (set! (-> arg0 num-buckets) (the-as uint (* (* (-> arg0 dimension-array x) (-> arg0 dimension-array y)) (-> arg0 dimension-array z)))) + (set! (-> arg0 axis-scale data v1-13) + (/ (the float (-> arg0 dimension-array data v1-13)) (-> s5-0 data v1-13)) + ) + ) + ) + (set! (-> arg0 num-buckets) + (the-as uint (* (* (-> arg0 dimension-array x) (-> arg0 dimension-array y)) (-> arg0 dimension-array z))) + ) (dotimes (v1-19 (the-as int (-> arg0 num-buckets))) - (let ((a0-27 (the-as light-hash-bucket (+ (the-as uint (the-as light-hash-bucket (-> arg0 bucket-array))) (* v1-19 4))))) + (let ((a0-27 + (the-as light-hash-bucket (+ (the-as uint (the-as light-hash-bucket (-> arg0 bucket-array))) (* v1-19 4))) + ) + ) (set! (-> a0-27 index) (the-as uint 0)) - (set! (-> a0-27 count) (the-as uint 0))) - 0) + (set! (-> a0-27 count) (the-as uint 0)) + ) + 0 + ) (dotimes (s5-1 (the-as int (-> arg0 num-lights))) - (light-hash-count-items arg0 (-> arg0 light-sphere-array s5-1))) + (light-hash-count-items arg0 (-> arg0 light-sphere-array s5-1)) + ) (let ((v1-26 0)) (dotimes (a0-31 (the-as int (-> arg0 num-buckets))) - (let ((a1-38 (the-as light-hash-bucket (+ (the-as uint (the-as light-hash-bucket (-> arg0 bucket-array))) (* a0-31 4))))) + (let ((a1-38 + (the-as light-hash-bucket (+ (the-as uint (the-as light-hash-bucket (-> arg0 bucket-array))) (* a0-31 4))) + ) + ) (set! (-> a1-38 index) (the-as uint v1-26)) (+! v1-26 (-> a1-38 count)) - (set! (-> a1-38 count) (the-as uint 0))) - 0) - (set! (-> arg0 num-indices) (the-as uint v1-26))) + (set! (-> a1-38 count) (the-as uint 0)) + ) + 0 + ) + (set! (-> arg0 num-indices) (the-as uint v1-26)) + ) (dotimes (s5-2 (the-as int (-> arg0 num-lights))) - (light-hash-add-items arg0 (-> arg0 light-sphere-array s5-2) s5-2)) + (light-hash-add-items arg0 (-> arg0 light-sphere-array s5-2) s5-2) + ) 0 - (none)) + (none) + ) (defun lookup-light-sphere-by-name ((name string) (hash light-hash)) "Search through a given [[light-hash]]'s lights to find the one that matches the given name @@ -150,8 +200,15 @@ @returns Either the [[light]] or [[#f]]" (when (and hash (nonzero? hash)) (dotimes (num-lights (the-as int (-> hash num-lights))) - (let ((light (-> hash light-sphere-array num-lights))) (if (string= name (-> light name)) (return light))))) - (the-as light-sphere #f)) + (let ((light (-> hash light-sphere-array num-lights))) + (if (string= name (-> light name)) + (return light) + ) + ) + ) + ) + (the-as light-sphere #f) + ) (def-mips2c light-hash-get-bucket-index (function light-hash vector int)) @@ -163,17 +220,19 @@ @param! out One of the groups and where the merged result is stored @param other The other group to merge with @returns [[none]]" - (local-vars (v1-0 float) - (v1-1 float) - (v1-3 float) - (v1-5 float) - (a1-1 float) - (a1-3 float) - (a2-0 float) - (a2-2 float) - (a2-4 float) - (a3-0 float) - (f6-0 float)) + (local-vars + (v1-0 float) + (v1-1 float) + (v1-3 float) + (v1-5 float) + (a1-1 float) + (a1-3 float) + (a2-0 float) + (a2-2 float) + (a2-4 float) + (a3-0 float) + (f6-0 float) + ) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -194,7 +253,8 @@ (vf3 :class vf) (vf4 :class vf) (vf5 :class vf) - (vf6 :class vf)) + (vf6 :class vf) + ) (init-vf0-vector) (nop!) (.max.w.vf vf1 vf0 vf0) @@ -239,7 +299,10 @@ (let ((v1-2 (shl (the-as int v1-1) 32))) (b! (zero? a2-1) cfg-9 :delay (set! f6-0 (-> other dir0 extra x))) (b! (zero? a3-1) cfg-10 :delay (nop!)) - (b! (zero? v1-2) cfg-11 :delay (nop!))))) + (b! (zero? v1-2) cfg-11 :delay (nop!)) + ) + ) + ) (.mul.x.vf acc vf15 vf15) (nop!) (.add.mul.x.vf acc vf16 vf16 acc) @@ -330,7 +393,16 @@ (nop!) (.mov a2-4 vf15) (nop!) - (let ((f10-1 (/ f1-0 a2-4))) (nop!) (nop!) (set! (-> out dir0 extra x) a2-4) (nop!) (nop!) (let ((a2-6 f10-1)) (.mov vf15 a2-6))) + (let ((f10-1 (/ f1-0 a2-4))) + (nop!) + (nop!) + (set! (-> out dir0 extra x) a2-4) + (nop!) + (nop!) + (let ((a2-6 f10-1)) + (.mov vf15 a2-6) + ) + ) (.mul.x.vf vf3 vf3 vf15) (nop!) (nop!) @@ -358,7 +430,16 @@ (nop!) (.mov a1-3 vf16) (nop!) - (let ((f11-1 (/ f1-0 a1-3))) (nop!) (nop!) (set! (-> out dir1 extra x) a1-3) (nop!) (nop!) (let ((a1-5 f11-1)) (.mov vf16 a1-5))) + (let ((f11-1 (/ f1-0 a1-3))) + (nop!) + (nop!) + (set! (-> out dir1 extra x) a1-3) + (nop!) + (nop!) + (let ((a1-5 f11-1)) + (.mov vf16 a1-5) + ) + ) (.mul.x.vf vf4 vf4 vf16) (nop!) (nop!) @@ -368,7 +449,10 @@ (nop!) (.svf (&-> out dir1 direction quad) vf26) (label cfg-7) - (b! (zero? v1-4) cfg-12 :delay (nop!))))) + (b! (zero? v1-4) cfg-12 :delay (nop!)) + ) + ) + ) (.mul.vf vf24 vf27 vf27) (nop!) (.mul.vf vf17 vf17 vf23) @@ -386,7 +470,17 @@ (nop!) (.mov v1-5 vf17) (nop!) - (let ((f12-1 (/ f1-0 v1-5))) (nop!) (nop!) (set! (-> out dir2 extra x) v1-5) (nop!) (nop!) (let ((v1-7 f12-1)) (.mov vf17 v1-7)))) + (let ((f12-1 (/ f1-0 v1-5))) + (nop!) + (nop!) + (set! (-> out dir2 extra x) v1-5) + (nop!) + (nop!) + (let ((v1-7 f12-1)) + (.mov vf17 v1-7) + ) + ) + ) (.mul.x.vf vf5 vf5 vf17) (nop!) (nop!) @@ -415,7 +509,9 @@ (set! (-> out dir2 extra x) f6-0) (label cfg-12) 0 - (none))) + (none) + ) + ) (defun light-group-scale! ((group light-group) (backup-ptr (pointer light-group)) (scale float)) "Given a [[light-group]], a `pointer` to a [[light-group]] to back it up, and a scale value, @@ -424,12 +520,17 @@ @param pointer A location to backup the original [[light]]s @param scale The value to scale by @returns [[none]]" - (if (!= group backup-ptr) (mem-copy! (the-as pointer group) backup-ptr 192)) + (if (!= group backup-ptr) + (mem-copy! (the-as pointer group) backup-ptr 192) + ) (when (!= scale 1.0) (dotimes (light-idx 4) - (set! (-> group lights light-idx extra x) (* (-> group lights light-idx extra x) scale)))) + (set! (-> group lights light-idx extra x) (* (-> group lights light-idx extra x) scale)) + ) + ) 0 - (none)) + (none) + ) (defun light-group-madd! ((group light-group) (backup-ptr (pointer light-group)) (other light-group) (scalar float)) "Scales the ambient and direction info of one [[light-group]]'s [[light]]s using a scalar value and another [[light-group]] @@ -438,36 +539,53 @@ @param other The other [[light-group]] used as part of the operation @param scalar An arbitrary scalar value multipled against each field @returns [[none]]" - (if (!= group backup-ptr) (mem-copy! (the-as pointer group) backup-ptr 192)) + (if (!= group backup-ptr) + (mem-copy! (the-as pointer group) backup-ptr 192) + ) (when (!= scalar 0.0) (let ((new-light (new 'stack 'light)) - (ambi-scaled (* (-> other ambi extra x) scalar))) + (ambi-scaled (* (-> other ambi extra x) scalar)) + ) (let ((dir0-scaled (* (-> other dir0 extra x) scalar)) (dir1-scaled (* (-> other dir1 extra x) scalar)) - (dir2-scaled (* (-> other dir2 extra x) scalar))) + (dir2-scaled (* (-> other dir2 extra x) scalar)) + ) (when (!= dir0-scaled 0.0) (mem-copy! (the-as pointer new-light) (the-as pointer (-> other dir0)) 48) (set! (-> new-light extra x) dir0-scaled) (light-merge! group (the-as light-group new-light)) - (set! (-> group dir0 extra y) 0.0)) + (set! (-> group dir0 extra y) 0.0) + ) (when (!= dir1-scaled 0.0) (mem-copy! (the-as pointer new-light) (the-as pointer (-> other dir1)) 48) (set! (-> new-light extra x) dir1-scaled) (light-merge! group (the-as light-group new-light)) - (set! (-> group dir1 extra y) 0.0)) + (set! (-> group dir1 extra y) 0.0) + ) (when (!= dir2-scaled 0.0) (mem-copy! (the-as pointer new-light) (the-as pointer (-> other dir2)) 48) (set! (-> new-light extra x) dir2-scaled) (light-merge! group (the-as light-group new-light)) - (set! (-> group dir2 extra y) 0.0))) - (vector4-scale! (the-as vector4 (-> group ambi color)) (the-as vector4 (-> group ambi color)) (-> group ambi extra x)) - (vector4-madd! (the-as vector4 (-> group ambi color)) - (the-as vector4 (-> group ambi color)) - (the-as vector4 (-> other ambi color)) - ambi-scaled)) - (set! (-> group ambi extra x) 1.0)) + (set! (-> group dir2 extra y) 0.0) + ) + ) + (vector4-scale! + (the-as vector4 (-> group ambi color)) + (the-as vector4 (-> group ambi color)) + (-> group ambi extra x) + ) + (vector4-madd! + (the-as vector4 (-> group ambi color)) + (the-as vector4 (-> group ambi color)) + (the-as vector4 (-> other ambi color)) + ambi-scaled + ) + ) + (set! (-> group ambi extra x) 1.0) + ) 0 - (none)) + (none) + ) (defun light-group-lerp! ((group light-group) (backup-ptr (pointer light-group)) (other light-group) (scalar float)) "Linearly interpolates between two [[light-group]]'s. @@ -479,7 +597,8 @@ (light-group-scale! group backup-ptr (- 1.0 scalar)) (light-group-madd! group backup-ptr other scalar) 0 - (none)) + (none) + ) (defun shadow-info-copy! ((dest light-group) (src light-group)) "Copies `extra.y` from `src` into `dest` for each [[light]] @@ -487,6 +606,8 @@ @param src @returns [[none]]" (dotimes (light-idx 4) - (set! (-> dest lights light-idx extra y) (-> src lights light-idx extra y))) + (set! (-> dest lights light-idx extra y) (-> src lights light-idx extra y)) + ) 0 - (none)) + (none) + ) diff --git a/goal_src/jak3/engine/ps2/pad.gc b/goal_src/jak3/engine/ps2/pad.gc index 65c4f8764b..2d5a975f4e 100644 --- a/goal_src/jak3/engine/ps2/pad.gc +++ b/goal_src/jak3/engine/ps2/pad.gc @@ -785,7 +785,8 @@ (set! (-> mouse button0-rel 0) (logclear (-> mouse button0-abs 0) (-> mouse button0-abs 1))) ) ) - (if (and (-> mouse active) (-> mouse valid) (-> mouse cursor)) + ;; og:preserve-this added pc port check + (if (and (-> mouse active) (-> mouse valid) (-> mouse cursor) (#if PC_PORT (not *disable-mouse*) #t)) (add-debug-cursor #t (bucket-id debug-no-zbuf2) diff --git a/goal_src/jak3/kernel/gkernel-h.gc b/goal_src/jak3/kernel/gkernel-h.gc index 6b2ad730af..a869e439c6 100644 --- a/goal_src/jak3/kernel/gkernel-h.gc +++ b/goal_src/jak3/kernel/gkernel-h.gc @@ -523,6 +523,7 @@ ) (define *sql-result* (the-as sql-result #f)) +(define-extern *collapse-quote* symbol) (defmacro defbehavior (name process-type bindings &rest body) "define a new behavior. This is simply a function where self is bound to the process register, diff --git a/goal_src/jak3/levels/city/common/nav-graph.gc b/goal_src/jak3/levels/city/common/nav-graph.gc index 7b55d11349..ec13489ad8 100644 --- a/goal_src/jak3/levels/city/common/nav-graph.gc +++ b/goal_src/jak3/levels/city/common/nav-graph.gc @@ -1116,7 +1116,7 @@ (set! (-> arg0 node-array length) 0) (set! (-> arg0 edge-array length) 0) (set! (-> arg0 visnode-array length) 0) - (set! (-> arg0 graph-type) (the-as basic (mysql-nav-graph-method-21 arg0))) + (set! (-> arg0 graph-type) (get-graph-type arg0 (the-as symbol arg1))) (let ((s3-0 (clear *temp-string*))) (format s3-0 "select nav_graph_id from nav_graph where name='~S'" arg1) (let ((a2-2 (sql-query s3-0))) diff --git a/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc b/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc index e13b351555..76779964ef 100644 --- a/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc @@ -162,7 +162,7 @@ ;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. -(defun print-default-collision ((arg0 process-drawable)) +(defun print-default-collision () (local-vars (sv-224 matrix) (sv-240 symbol) (sv-256 string) (sv-272 float) (sv-288 float)) (let ((gp-0 (process-spawn collision-editor-default-proc :name "collision-editor-default-proc"))) (when gp-0 @@ -182,14 +182,14 @@ ) (format #t " :children (~%") (let* ((t9-10 (method-of-type res-lump get-property-struct)) - (a0-11 (-> (the-as process-drawable (-> gp-0 0)) draw jgeo extra)) + (a0-10 (-> (the-as process-drawable (-> gp-0 0)) draw jgeo extra)) (a1-10 'collide-mesh-group) (a2-3 'interp) (a3-3 -1000000000.0) (t0-0 (the-as float #f)) (s5-1 (the-as (array collide-mesh) - (t9-10 a0-11 a1-10 a2-3 a3-3 (the-as structure t0-0) (the-as (pointer res-tag) #f) *res-static-buf*) + (t9-10 a0-10 a1-10 a2-3 a3-3 (the-as structure t0-0) (the-as (pointer res-tag) #f) *res-static-buf*) ) ) ) @@ -218,12 +218,12 @@ ) (else (let ((t9-19 format) - (a0-23 #t) + (a0-22 #t) (a1-18 " :transform-index (joint-node-index ~S ~S)~%") (a2-5 *collision-editor-art-group-name*) (a3-12 (-> (the-as process-drawable (-> gp-0 0)) node-list data (+ (-> s5-1 s4-0 joint-id) 1) joint name)) ) - (t9-19 a0-23 a1-18 a2-5 a3-12) + (t9-19 a0-22 a1-18 a2-5 a3-12) (let ((s0-0 (new 'stack 'collide-shape-prim-mesh (the-as collide-shape 0) (the-as uint a3-12) (the-as uint t0-0)))) (set! (-> s0-0 cshape) (the-as collide-shape (-> (the-as process-drawable (-> gp-0 0)) root))) (set! (-> s0-0 transform-index) (+ (-> s5-1 s4-0 joint-id) 1)) @@ -233,82 +233,82 @@ (set! (-> s0-0 mesh-cache-id) (the-as uint 0)) (set! (-> s0-0 mesh-id) s4-0) (collision-editor-add-mesh-to-ccache (the-as collide-shape-prim-group s0-0) *collide-cache*) - (let ((a0-26 (the-as object (-> *collide-cache* tris))) + (let ((a0-25 (the-as object (-> *collide-cache* tris))) (v1-41 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) ) (when (nonzero? (-> *collide-cache* num-tris)) - (vector-copy! v1-41 (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0)) - (vector-copy! s2-0 (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0)) + (vector-copy! v1-41 (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0)) + (vector-copy! s2-0 (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0)) ) (countdown (a1-27 (-> *collide-cache* num-tris)) (set! (-> v1-41 x) (fmin (fmin - (fmin (-> v1-41 x) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 x)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 x) + (fmin (-> v1-41 x) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 x)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 x) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 x) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 x) ) ) (set! (-> v1-41 y) (fmin (fmin - (fmin (-> v1-41 y) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 y)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 y) + (fmin (-> v1-41 y) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 y)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 y) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 y) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 y) ) ) (set! (-> v1-41 z) (fmin (fmin - (fmin (-> v1-41 z) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 z)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 z) + (fmin (-> v1-41 z) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 z)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 z) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 z) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 z) ) ) (set! (-> s2-0 x) (fmax (fmax - (fmax (-> s2-0 x) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 x)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 x) + (fmax (-> s2-0 x) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 x)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 x) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 x) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 x) ) ) (set! (-> s2-0 y) (fmax (fmax - (fmax (-> s2-0 y) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 y)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 y) + (fmax (-> s2-0 y) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 y)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 y) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 y) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 y) ) ) (set! (-> s2-0 z) (fmax (fmax - (fmax (-> s2-0 z) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 z)) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 z) + (fmax (-> s2-0 z) (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 0 z)) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 1 z) ) - (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 z) + (-> (the-as (inline-array collide-cache-tri) a0-25) 0 vertex 2 z) ) ) - (set! a0-26 (-> (the-as (inline-array collide-cache-tri) a0-26) 1)) + (set! a0-25 (-> (the-as (inline-array collide-cache-tri) a0-25) 1)) ) (vector+! s3-0 v1-41 s2-0) (vector-float*! s3-0 s3-0 0.5) (vector<-cspace! s1-0 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index))) (vector-! s1-0 s3-0 s1-0) (set! sv-224 (new 'stack-no-clear 'matrix)) - (let* ((a0-35 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) - (a2-11 (-> a0-35 rvec quad)) - (a1-36 (-> a0-35 uvec quad)) - (v1-53 (-> a0-35 fvec quad)) - (a0-36 (-> a0-35 trans quad)) + (let* ((a0-34 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) + (a2-11 (-> a0-34 rvec quad)) + (a1-36 (-> a0-34 uvec quad)) + (v1-53 (-> a0-34 fvec quad)) + (a0-35 (-> a0-34 trans quad)) ) (set! (-> sv-224 rvec quad) a2-11) (set! (-> sv-224 uvec quad) a1-36) (set! (-> sv-224 fvec quad) v1-53) - (set! (-> sv-224 trans quad) a0-36) + (set! (-> sv-224 trans quad) a0-35) ) (vector-reset! (-> sv-224 trans)) (matrix-transpose! sv-224 sv-224) @@ -501,9 +501,9 @@ (current-prim int32) ) (:methods - (collision-edit-info-method-9 (_type_) none) + (handle-pad-input (_type_) none) (draw-menu (_type_ process-drawable) none) - (collision-edit-info-method-11 (_type_ process-drawable) none) + (set-current-prim! (_type_ process-drawable) none) ) ) @@ -553,7 +553,7 @@ ;; definition for method 9 of type collision-edit-info ;; WARN: Return type mismatch int vs none. -(defmethod collision-edit-info-method-9 ((this collision-edit-info)) +(defmethod handle-pad-input ((this collision-edit-info)) (if (cpad-pressed? 0 up) (+! (-> this current-func) -1) ) @@ -580,7 +580,7 @@ ;; definition for method 11 of type collision-edit-info ;; WARN: Return type mismatch int vs none. -(defmethod collision-edit-info-method-11 ((this collision-edit-info) (arg0 process-drawable)) +(defmethod set-current-prim! ((this collision-edit-info) (arg0 process-drawable)) (local-vars (s5-0 int)) (when (not arg0) (set! s5-0 (the-as int #f)) @@ -643,8 +643,8 @@ ) (else (set! *external-cam-mode* 'locked) - (collision-edit-info-method-9 this) - (collision-edit-info-method-11 this arg0) + (handle-pad-input this) + (set-current-prim! this arg0) (let ((s3-0 ">") (s4-0 " ") ) @@ -968,3 +968,7 @@ (process-spawn collision-editor gp-2 :name "collision-editor") ) ) + + + + diff --git a/test/decompiler/reference/jak3/engine/debug/default-menu_REF.gc b/test/decompiler/reference/jak3/engine/debug/default-menu_REF.gc index 2b564097fb..93a73237f1 100644 --- a/test/decompiler/reference/jak3/engine/debug/default-menu_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/default-menu_REF.gc @@ -4934,13 +4934,9 @@ (function "Start Editor" #f - ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (when (not (get-nav-graph-editor)) - (let ((t9-1 run-nav-graph-editor) - (a0-1 'test) - ) - (t9-1 a0-1) + ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (if (not (get-nav-graph-editor)) + (run-nav-graph-editor 'test #f) ) - ) ) ) (function @@ -4954,24 +4950,22 @@ (function "Toggle Plane Mode" #f - ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) - (let ((a0-1 (get-nav-graph-editor))) - (if a0-1 - ((method-of-object a0-1 nav-graph-editor-method-64)) + ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) + (if a0-1 + (nav-graph-editor-method-64 a0-1) + ) + ) ) - ) - ) ) (function "Toggle Hover Mode" #f - ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) - (let ((a0-1 (get-nav-graph-editor))) - (if a0-1 - ((method-of-object a0-1 nav-graph-editor-method-65)) + ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) + (if a0-1 + (nav-graph-editor-method-65 a0-1) + ) + ) ) - ) - ) ) (menu "Load" @@ -4980,13 +4974,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'hover - 'foresta - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'hover (the-as string 'foresta)) ) - ) ) ) ) @@ -4995,13 +4985,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'hover - 'sewc - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'hover (the-as string 'sewc)) ) - ) ) ) ) @@ -5010,13 +4996,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'hover - 'sewg - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'hover (the-as string 'sewg)) ) - ) ) ) ) @@ -5025,13 +5007,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'hover - 'sewl - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'hover (the-as string 'sewl)) ) - ) ) ) ) @@ -5040,12 +5018,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'traffic - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'traffic (the-as string #f)) ) - ) ) ) ) @@ -5054,12 +5029,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'minimap - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'minimap (the-as string #f)) ) - ) ) ) ) @@ -5068,12 +5040,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'flyingsaw_2 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'flyingsaw_2 (the-as string #f)) ) - ) ) ) ) @@ -5082,12 +5051,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'flyingsaw_3 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'flyingsaw_3 (the-as string #f)) ) - ) ) ) ) @@ -5096,12 +5062,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'forest-plant-1 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'forest-plant-1 (the-as string #f)) ) - ) ) ) ) @@ -5110,12 +5073,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'forest-plant-2 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'forest-plant-2 (the-as string #f)) ) - ) ) ) ) @@ -5124,12 +5084,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'forest-plant-3 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'forest-plant-3 (the-as string #f)) ) - ) ) ) ) @@ -5138,12 +5095,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'forest-plant-4 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'forest-plant-4 (the-as string #f)) ) - ) ) ) ) @@ -5152,12 +5106,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'beast - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'beast (the-as string #f)) ) - ) ) ) ) @@ -5166,12 +5117,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'wasminimap - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'wasminimap (the-as string #f)) ) - ) ) ) ) @@ -5180,12 +5128,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'desrescue - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'desrescue (the-as string #f)) ) - ) ) ) ) @@ -5194,12 +5139,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'assault - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'assault (the-as string #f)) ) - ) ) ) ) @@ -5208,12 +5150,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'timer-chase-1 - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'timer-chase-1 (the-as string #f)) ) - ) ) ) ) @@ -5222,12 +5161,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'protect-hq - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'protect-hq (the-as string #f)) ) - ) ) ) ) @@ -5236,12 +5172,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'blow-tower - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'blow-tower (the-as string #f)) ) - ) ) ) ) @@ -5250,12 +5183,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'desert-lizard - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'desert-lizard (the-as string #f)) ) - ) ) ) ) @@ -5264,12 +5194,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'terraformer-walk - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'terraformer-walk (the-as string #f)) ) - ) ) ) ) @@ -5278,12 +5205,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'terraformer-fly - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'terraformer-fly (the-as string #f)) ) - ) ) ) ) @@ -5292,12 +5216,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'beast-battle - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'beast-battle (the-as string #f)) ) - ) ) ) ) @@ -5306,12 +5227,9 @@ #f ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) - (when a0-1 - (let ((t9-1 (method-of-object a0-1 nav-graph-editor-method-66))) - 'desert-chase-marauder - (t9-1) + (if a0-1 + (nav-graph-editor-method-66 a0-1 'desert-chase-marauder (the-as string #f)) ) - ) ) ) ) @@ -5319,13 +5237,12 @@ (function "Save" #f - ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) - (let ((a0-1 (get-nav-graph-editor))) - (if a0-1 - ((method-of-object a0-1 nav-graph-editor-method-67)) + ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (let ((a0-1 (get-nav-graph-editor))) + (if a0-1 + (nav-graph-editor-method-67 a0-1) + ) + ) ) - ) - ) ) ) ) @@ -5342,20 +5259,7 @@ ,(lambda ((arg0 int) (arg1 debug-menu-msg) (arg2 float)) (when (not *nav-mesh-editor*) (kill-by-type nav-mesh-editor *active-pool*) - (let ((gp-0 (get-process *default-dead-pool* nav-mesh-editor #x4000 1))) - (when gp-0 - (let ((t9-2 (method-of-type nav-mesh-editor activate))) - (t9-2 (the-as nav-mesh-editor gp-0) *entity-pool* "nav-mesh-editor" (the-as pointer #x70004000)) - ) - (let ((t9-3 run-function-in-process) - (a0-4 gp-0) - (a1-4 nav-mesh-editor-init) - ) - ((the-as (function object object none) t9-3) a0-4 a1-4) - ) - (-> gp-0 ppointer) - ) - ) + (process-spawn nav-mesh-editor :init nav-mesh-editor-init #f :name "nav-mesh-editor" :to *entity-pool*) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/debug/editable-h_REF.gc b/test/decompiler/reference/jak3/engine/debug/editable-h_REF.gc index 09a26ea600..62c1bec862 100644 --- a/test/decompiler/reference/jak3/engine/debug/editable-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/editable-h_REF.gc @@ -312,16 +312,16 @@ (filter editable-filter) (tree symbol) (level string) - (on-enter string) - (on-inside string) - (on-exit string) + (on-enter pair) + (on-inside pair) + (on-exit pair) ) (:methods (new (symbol type) _type_) - (editable-region-method-9 () none) - (editable-region-method-10 () none) - (editable-region-method-11 () none) - (editable-region-method-12 () none) + (save-region! (_type_ editable-array int int) symbol) + (editable-region-method-10 (_type_ int) symbol) + (print-region-info (_type_ vector int) none) + (editable-region-method-12 (_type_) editable-filter) ) ) @@ -355,33 +355,33 @@ (prefix basic) ) (:methods - (editable-method-9 () none) - (editable-method-10 () none) - (editable-method-11 () none) - (editable-method-12 () none) - (editable-method-13 () none) - (editable-method-14 () none) - (editable-method-15 () none) - (editable-method-16 () none) - (editable-method-17 () none) - (editable-method-18 () none) - (editable-method-19 () none) - (editable-method-20 () none) - (editable-method-21 () none) - (editable-method-22 () none) - (editable-method-23 () none) - (editable-method-24 () none) - (editable-method-25 () none) - (editable-method-26 () none) - (editable-method-27 () none) - (editable-method-28 () none) - (editable-method-29 () none) - (editable-method-30 () none) - (editable-method-31 () none) - (editable-method-32 () none) - (editable-method-33 () none) - (editable-method-34 () none) - (editable-method-35 () none) + (get-color (_type_) rgba) + (editable-method-10 (_type_) none) + (editable-method-11 (_type_ vector) symbol) + (set-selected! (_type_ symbol) none) + (editable-method-13 (_type_ vector) float) + (editable-method-14 (_type_ vector vector) float) + (editable-method-15 (_type_) vector) + (editable-method-16 (_type_) float) + (editable-method-17 (_type_ vector editable-flag) none) + (editable-method-18 (_type_ vector int) none) + (editable-method-19 (_type_ vector) none) + (editable-method-20 (_type_ vector matrix) none) + (editable-method-21 (_type_ vector) none) + (editable-method-22 (_type_ vector vector vector vector) none) + (change-region! (_type_ editable-region) none) + (editable-method-24 (_type_ editable-array int int) symbol) + (editable-method-25 (_type_) symbol) + (editable-method-26 (_type_) none) + (delete! (_type_ editable) none) + (editable-method-28 (_type_ editable editable) none) + (copy-into-editable-array! (_type_ editable-array) editable) + (editable-method-30 (_type_ editable-flag) none) + (editable-method-31 (_type_ editable-flag) none) + (get-null-vec (_type_) vector) + (get-null-vec2 (_type_ vector) vector) + (get-level-offset (_type_ editable-array) vector) + (editable-method-35 (_type_ vector) none) ) ) @@ -467,17 +467,17 @@ ) (:methods (new (symbol type int) _type_) - (editable-array-method-9 () none) - (editable-array-method-10 () none) - (editable-array-method-11 () none) - (editable-array-method-12 () none) - (editable-array-method-13 () none) - (editable-array-method-14 () none) - (editable-array-method-15 () none) - (editable-array-method-16 () none) - (editable-array-method-17 () none) - (editable-array-method-18 () none) - (editable-array-method-19 () none) + (handle-cmd (_type_ editable-command mouse-info object) symbol) + (editable-array-method-10 (_type_ vector int) editable) + (editable-array-method-11 (_type_ vector vector int) none) + (get-length (_type_) int) + (editable-array-method-13 (_type_ symbol) symbol) + (editable-array-method-14 (_type_ editable-command editable-command string) none) + (editable-array-method-15 (_type_ (function editable editable-region symbol) editable-region) (array editable)) + (editable-array-method-16 (_type_ editable) none) + (editable-array-method-17 (_type_) none) + (editable-array-method-18 (_type_ vector vector) vector) + (editable-array-method-19 (_type_ string) symbol) ) ) @@ -631,21 +631,16 @@ (set! (-> gp-0 region) #f) (set! (-> gp-0 name) "undefined") (set! (-> gp-0 prefix) "undefined") - (let* ((s3-0 gp-0) - (s2-0 (method-of-object s3-0 editable-method-23)) - ) - (set! arg1 (cond - (arg1 - (empty) - arg1 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s2-0) - ) + (change-region! gp-0 (cond + (arg1 + (empty) + arg1 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (vector-copy! (-> gp-0 trans) arg0) (set! (-> gp-0 radius) 2048.0) (set! (-> gp-0 owner) '()) @@ -726,21 +721,16 @@ (set! (-> s5-0 region) #f) (set! (-> s5-0 name) "undefined") (set! (-> s5-0 prefix) "undefined") - (let* ((s2-0 s5-0) - (s1-0 (method-of-object s2-0 editable-method-23)) - ) - (set! arg2 (cond - (arg2 - (empty) - arg2 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s1-0) - ) + (change-region! s5-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (vector-copy! (-> s5-0 trans) arg0) (set! (-> s5-0 radius) arg1) (set! (-> s5-0 owner) '()) @@ -906,21 +896,16 @@ (defmethod new editable-light ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region)) (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> gp-0 region) #f) - (let* ((s2-0 gp-0) - (s1-0 (method-of-object s2-0 editable-method-23)) - ) - (set! arg2 (cond - (arg2 - (empty) - arg2 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s1-0) - ) + (change-region! gp-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (vector-copy! (-> gp-0 trans) arg0) (set! (-> gp-0 radius) arg1) (set! (-> gp-0 owner) '()) @@ -951,7 +936,8 @@ ) (:methods (new (symbol type vector float editable-region) _type_) - (editable-entity-method-36 () none) + (editable-entity-method-36 (_type_) none) + (copy-into-editable-array! (_type_ editable-array) editable-entity :replace) ) ) @@ -1020,21 +1006,16 @@ (defmethod new editable-entity ((allocation symbol) (type-to-make type) (arg0 vector) (arg1 float) (arg2 editable-region)) (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> gp-0 region) #f) - (let* ((s2-0 gp-0) - (s1-0 (method-of-object s2-0 editable-method-23)) - ) - (set! arg2 (cond - (arg2 - (empty) - arg2 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s1-0) - ) + (change-region! gp-0 (cond + (arg2 + (empty) + arg2 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (vector-copy! (-> gp-0 trans) arg0) (set! (-> gp-0 radius) arg1) (set! (-> gp-0 owner) '()) @@ -1053,8 +1034,9 @@ ) (:methods (new (symbol type editable-region) _type_) - (editable-face-method-36 () none) - (editable-face-method-37 () none) + (editable-face-method-36 (_type_ (inline-array vector)) int) + (editable-face-method-37 (_type_ vector) vector) + (copy-into-editable-array! (_type_ editable-array) editable-face :replace) ) ) @@ -1127,21 +1109,16 @@ (set! (-> gp-0 region) #f) (set! (-> gp-0 name) "undefined") (set! (-> gp-0 prefix) "undefined") - (let* ((s4-0 gp-0) - (s3-0 (method-of-object s4-0 editable-method-23)) - ) - (set! arg0 (cond - (arg0 - (empty) - arg0 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s3-0) - ) + (change-region! gp-0 (cond + (arg0 + (empty) + arg0 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (set! (-> gp-0 owner) '()) gp-0 ) @@ -1155,8 +1132,9 @@ ) (:methods (new (symbol type editable-region) _type_) - (editable-plane-method-36 () none) - (editable-plane-method-37 () none) + (editable-plane-method-36 (_type_ (inline-array vector)) int) + (editable-plane-method-37 (_type_ vector) vector) + (copy-into-editable-array! (_type_ editable-array) editable-plane :replace) ) ) @@ -1228,21 +1206,16 @@ (set! (-> gp-0 region) #f) (set! (-> gp-0 name) "undefined") (set! (-> gp-0 prefix) "undefined") - (let* ((s4-0 gp-0) - (s3-0 (method-of-object s4-0 editable-method-23)) - ) - (set! arg0 (cond - (arg0 - (empty) - arg0 - ) - (else - (new 'debug 'editable-region) - ) - ) - ) - (s3-0) - ) + (change-region! gp-0 (cond + (arg0 + (empty) + arg0 + ) + (else + (new 'debug 'editable-region) + ) + ) + ) (set! (-> gp-0 owner) '()) (set! (-> gp-0 radius) 20480.0) gp-0 @@ -1252,10 +1225,10 @@ ;; definition of type editable-player (deftype editable-player (process-drawable) ((current editable-array) - (current-command uint32) - (select-command function) + (current-command editable-command) + (select-command (function object)) (drag-command uint32) - (extra-command function) + (extra-command (function object)) (left-handed basic) (light-names basic) (external-cam-mode symbol) @@ -1273,11 +1246,13 @@ (float-min float) (float-id uint32) ) + (:state-methods + idle + ) (:methods - (editable-player-method-20 () none) - (editable-player-method-21 () none) - (editable-player-method-22 () none) - (editable-player-method-23 () none) + (editable-player-method-21 (_type_) none) + (editable-player-method-22 (_type_) none) + (editable-player-method-23 (_type_) symbol) ) ) diff --git a/test/decompiler/reference/jak3/engine/debug/editable-player_REF.gc b/test/decompiler/reference/jak3/engine/debug/editable-player_REF.gc new file mode 100644 index 0000000000..5de433b6d5 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/editable-player_REF.gc @@ -0,0 +1,3232 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; definition for function cleanup-selection +;; WARN: Return type mismatch int vs object. +(defun cleanup-selection ((arg0 editable-array)) + (let* ((v1-0 (-> arg0 length)) + (a0-1 0) + (a1-2 (-> arg0 data a0-1)) + ) + (while (< a0-1 v1-0) + (if a1-2 + (logclear! (-> a1-2 flags) (editable-flag mark)) + ) + (+! a0-1 1) + (set! a1-2 (-> arg0 data a0-1)) + ) + ) + (let* ((s5-0 (-> arg0 length)) + (s4-0 0) + (a0-2 (-> arg0 data s4-0)) + ) + (while (< s4-0 s5-0) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (editable-method-31 a0-2 (editable-flag)) + ) + (+! s4-0 1) + (set! a0-2 (-> arg0 data s4-0)) + ) + ) + 0 + ) + +;; definition for function insert-box +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs object. +(defun insert-box ((arg0 editable-array) (arg1 vector) (arg2 vector)) + (if (not (-> arg0 region)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((f30-0 (* 4096.0 (-> arg0 edit-param0))) + (s2-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'array 'int32 8)) + ) + (let ((s3-0 (-> arg0 region))) + (if (= f30-0 0.0) + (set! f30-0 40960.0) + ) + (dotimes (s0-0 8) + (set! (-> s4-0 s0-0) (get-length arg0)) + (set! (-> arg0 data (-> s4-0 s0-0)) (the-as editable #t)) + ) + (dotimes (v1-13 8) + (when (< (-> s4-0 v1-13) 0) + (dotimes (v1-14 8) + (set! (-> arg0 data (-> s4-0 v1-14)) #f) + ) + (return (the-as object #f)) + ) + ) + (vector-copy! s2-0 arg1) + (set! (-> s2-0 y) (- (-> s2-0 y) f30-0)) + (set! (-> s2-0 x) (- (-> s2-0 x) f30-0)) + (set! (-> s2-0 z) (- (-> s2-0 z) f30-0)) + (set! (-> arg0 data (-> s4-0 0)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (set! (-> s2-0 y) (- (-> s2-0 y) f30-0)) + (+! (-> s2-0 x) f30-0) + (set! (-> s2-0 z) (- (-> s2-0 z) f30-0)) + (set! (-> arg0 data (-> s4-0 1)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (set! (-> s2-0 y) (- (-> s2-0 y) f30-0)) + (set! (-> s2-0 x) (- (-> s2-0 x) f30-0)) + (+! (-> s2-0 z) f30-0) + (set! (-> arg0 data (-> s4-0 2)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (set! (-> s2-0 y) (- (-> s2-0 y) f30-0)) + (+! (-> s2-0 x) f30-0) + (+! (-> s2-0 z) f30-0) + (set! (-> arg0 data (-> s4-0 3)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (+! (-> s2-0 y) f30-0) + (set! (-> s2-0 x) (- (-> s2-0 x) f30-0)) + (set! (-> s2-0 z) (- (-> s2-0 z) f30-0)) + (set! (-> arg0 data (-> s4-0 4)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (+! (-> s2-0 y) f30-0) + (+! (-> s2-0 x) f30-0) + (set! (-> s2-0 z) (- (-> s2-0 z) f30-0)) + (set! (-> arg0 data (-> s4-0 5)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (+! (-> s2-0 y) f30-0) + (set! (-> s2-0 x) (- (-> s2-0 x) f30-0)) + (+! (-> s2-0 z) f30-0) + (set! (-> arg0 data (-> s4-0 6)) (new 'debug 'editable-point s2-0 s3-0)) + (vector-copy! s2-0 arg1) + (+! (-> s2-0 y) f30-0) + (+! (-> s2-0 x) f30-0) + (+! (-> s2-0 z) f30-0) + (set! (-> arg0 data (-> s4-0 7)) (new 'debug 'editable-point s2-0 s3-0)) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 0)) #t) + (set-selected! (-> arg0 data (-> s4-0 1)) #t) + (set-selected! (-> arg0 data (-> s4-0 2)) #t) + (set-selected! (-> arg0 data (-> s4-0 3)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 4)) #t) + (set-selected! (-> arg0 data (-> s4-0 5)) #t) + (set-selected! (-> arg0 data (-> s4-0 6)) #t) + (set-selected! (-> arg0 data (-> s4-0 7)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command flip-side) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 0)) #t) + (set-selected! (-> arg0 data (-> s4-0 2)) #t) + (set-selected! (-> arg0 data (-> s4-0 4)) #t) + (set-selected! (-> arg0 data (-> s4-0 6)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 1)) #t) + (set-selected! (-> arg0 data (-> s4-0 3)) #t) + (set-selected! (-> arg0 data (-> s4-0 5)) #t) + (set-selected! (-> arg0 data (-> s4-0 7)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command flip-side) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 0)) #t) + (set-selected! (-> arg0 data (-> s4-0 1)) #t) + (set-selected! (-> arg0 data (-> s4-0 4)) #t) + (set-selected! (-> arg0 data (-> s4-0 5)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command flip-side) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 2)) #t) + (set-selected! (-> arg0 data (-> s4-0 3)) #t) + (set-selected! (-> arg0 data (-> s4-0 6)) #t) + (set-selected! (-> arg0 data (-> s4-0 7)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set! (-> arg0 region) s3-0) + ) + (dotimes (s3-1 8) + (set-selected! (-> arg0 data (-> s4-0 s3-1)) #t) + ) + ) + (handle-cmd arg0 (editable-command select-current-owner) (the-as mouse-info #f) arg2) + 0 + ) + +;; definition for function insert-wall +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs object. +(defun insert-wall ((arg0 editable-array) (arg1 vector) (arg2 vector)) + (if (not (-> arg0 region)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((f30-0 (* 4096.0 (-> arg0 edit-param0))) + (s1-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'array 'int32 2)) + ) + (let ((s3-0 (-> arg0 region))) + (if (= f30-0 0.0) + (set! f30-0 40960.0) + ) + (dotimes (s0-0 2) + (set! (-> s4-0 s0-0) (get-length arg0)) + (set! (-> arg0 data (-> s4-0 s0-0)) (the-as editable #t)) + ) + (dotimes (v1-13 2) + (when (< (-> s4-0 v1-13) 0) + (dotimes (v1-14 2) + (set! (-> arg0 data (-> s4-0 v1-14)) #f) + ) + (return (the-as object #f)) + ) + ) + (vector-copy! s1-0 arg1) + (set! (-> s1-0 y) (- (-> s1-0 y) f30-0)) + (set! (-> s1-0 x) (- (-> s1-0 x) f30-0)) + (set! (-> arg0 data (-> s4-0 0)) (new 'debug 'editable-point s1-0 s3-0)) + (vector-copy! s1-0 arg1) + (+! (-> s1-0 y) f30-0) + (+! (-> s1-0 x) f30-0) + (set! (-> arg0 data (-> s4-0 1)) (new 'debug 'editable-point s1-0 s3-0)) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set-selected! (-> arg0 data (-> s4-0 0)) #t) + (set-selected! (-> arg0 data (-> s4-0 1)) #t) + (set! (-> arg0 region) s3-0) + (handle-cmd arg0 (editable-command insert-face) (the-as mouse-info #f) arg2) + (handle-cmd arg0 (editable-command select-none) (the-as mouse-info #f) arg2) + (set! (-> arg0 region) s3-0) + ) + (dotimes (s3-1 2) + (set-selected! (-> arg0 data (-> s4-0 s3-1)) #t) + ) + ) + (handle-cmd arg0 (editable-command select-current-owner) (the-as mouse-info #f) arg2) + 0 + ) + +;; definition for function update-manipulator-position +;; INFO: Used lq/sq +(defun update-manipulator-position ((arg0 editable-array) (arg1 manipulator)) + (local-vars (sv-32 vector) (sv-40 int) (sv-48 euler-angles)) + (set! sv-32 (new-stack-vector0)) + (set! sv-40 0) + (set! sv-48 (the-as euler-angles #f)) + (let* ((s4-0 (-> arg0 length)) + (s3-0 0) + (s2-0 (-> arg0 data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (set! sv-48 (the-as euler-angles (get-null-vec s2-0))) + (vector+! sv-32 sv-32 (editable-method-15 s2-0)) + (set! sv-40 (+ sv-40 1)) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s2-0 region)) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> arg0 data s3-0)) + ) + ) + (when (nonzero? sv-40) + (vector-float*! (-> arg1 position) sv-32 (/ 1.0 (the float sv-40))) + (set! (-> arg1 angles quad) (-> sv-48 quad)) + (eul->matrix (-> arg1 mat) sv-48) + ) + ) + +;; definition for function execute-select +(defun execute-select ((arg0 editable-array) (arg1 editable-command) (arg2 mouse-info) (arg3 manipulator)) + (case arg1 + (((editable-command select-none)) + (let* ((s5-1 (-> arg0 length)) + (s4-1 0) + (a0-2 (-> arg0 data s4-1)) + ) + (while (< s4-1 s5-1) + (if (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (set-selected! a0-2 #f) + ) + (+! s4-1 1) + (set! a0-2 (-> arg0 data s4-1)) + ) + ) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) #f) + ) + ) + (((editable-command select-all)) + (let* ((s5-2 (-> arg0 length)) + (s4-2 0) + (a0-4 (-> arg0 data s4-2)) + ) + (while (< s4-2 s5-2) + (if (and a0-4 (or (and (logtest? (-> a0-4 region filter) (-> arg0 filter 0)) + (logtest? (-> a0-4 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> a0-4 flags) (editable-flag selected)) + ) + ) + (set-selected! a0-4 #t) + ) + (+! s4-2 1) + (set! a0-4 (-> arg0 data s4-2)) + ) + ) + ) + (((editable-command select-one)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-7 arg0) + (t9-4 (method-of-object a0-7 editable-array-method-10)) + (a1-12 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-12 x) (-> arg2 posx)) + (set! (-> a1-12 y) (-> arg2 posy)) + (set! (-> a1-12 z) 0.0) + (set! (-> a1-12 w) 1.0) + (let ((s3-1 (t9-4 a0-7 a1-12 0))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (when s3-1 + (set-selected! s3-1 #t) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s3-1 region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-add)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-13 arg0) + (t9-10 (method-of-object a0-13 editable-array-method-10)) + (a1-17 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-17 x) (-> arg2 posx)) + (set! (-> a1-17 y) (-> arg2 posy)) + (set! (-> a1-17 z) 0.0) + (set! (-> a1-17 w) 1.0) + (let ((s4-3 (t9-10 a0-13 a1-17 0))) + (when s4-3 + (set-selected! s4-3 #t) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s4-3 region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-remove)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-18 arg0) + (t9-15 (method-of-object a0-18 editable-array-method-10)) + (a1-21 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-21 x) (-> arg2 posx)) + (set! (-> a1-21 y) (-> arg2 posy)) + (set! (-> a1-21 z) 0.0) + (set! (-> a1-21 w) 1.0) + (let ((s4-4 (t9-15 a0-18 a1-21 0))) + (when s4-4 + (set-selected! s4-4 #f) + (if (not (-> arg0 region-lock?)) + (set! (-> arg0 region) (-> s4-4 region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-toggle)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-23 arg0) + (t9-20 (method-of-object a0-23 editable-array-method-10)) + (a1-25 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-25 x) (-> arg2 posx)) + (set! (-> a1-25 y) (-> arg2 posy)) + (set! (-> a1-25 z) 0.0) + (set! (-> a1-25 w) 1.0) + (let ((s4-5 (t9-20 a0-23 a1-25 1))) + (when s4-5 + (set-selected! s4-5 'toggle) + (if (and (logtest? (-> s4-5 flags) (editable-flag selected)) (not (-> arg0 region-lock?))) + (set! (-> arg0 region) (-> s4-5 region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-region)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-28 arg0) + (t9-25 (method-of-object a0-28 editable-array-method-10)) + (a1-29 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-29 x) (-> arg2 posx)) + (set! (-> a1-29 y) (-> arg2 posy)) + (set! (-> a1-29 z) 0.0) + (set! (-> a1-29 w) 1.0) + (let ((s3-6 (t9-25 a0-28 a1-29 0))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (when s3-6 + (set-selected! s3-6 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s3-6 region)) + (handle-cmd arg0 (editable-command select-current-region) arg2 arg3) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-face)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-35 arg0) + (t9-32 (method-of-object a0-35 editable-array-method-10)) + (a1-35 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-35 x) (-> arg2 posx)) + (set! (-> a1-35 y) (-> arg2 posy)) + (set! (-> a1-35 z) 0.0) + (set! (-> a1-35 w) 1.0) + (let ((s3-8 (t9-32 a0-35 a1-35 0))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (when s3-8 + (set-selected! s3-8 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s3-8 region)) + (handle-cmd arg0 (editable-command select-current-face) arg2 arg3) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-prim)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-42 arg0) + (t9-39 (method-of-object a0-42 editable-array-method-10)) + (a1-41 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-41 x) (-> arg2 posx)) + (set! (-> a1-41 y) (-> arg2 posy)) + (set! (-> a1-41 z) 0.0) + (set! (-> a1-41 w) 1.0) + (let ((s3-10 (t9-39 a0-42 a1-41 0))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (when s3-10 + (set-selected! s3-10 #t) + (set! (-> arg0 backup-region) (-> arg0 region)) + (set! (-> arg0 region) (-> s3-10 region)) + (handle-cmd arg0 (editable-command select-current-prim) arg2 arg3) + (if (-> arg0 region-lock?) + (set! (-> arg0 region) (-> arg0 backup-region)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-current-region)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (when (-> arg0 region) + (let ((s3-12 (-> arg0 region))) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set! (-> arg0 region) s3-12) + ) + (let* ((s4-6 (-> arg0 length)) + (s3-13 0) + (a0-50 (-> arg0 data s3-13)) + ) + (while (< s3-13 s4-6) + (when (and a0-50 (or (and (logtest? (-> a0-50 region filter) (-> arg0 filter 0)) + (logtest? (-> a0-50 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> a0-50 flags) (editable-flag selected)) + ) + ) + (if (= (-> arg0 region) (-> a0-50 region)) + (set-selected! a0-50 #t) + ) + ) + (+! s3-13 1) + (set! a0-50 (-> arg0 data s3-13)) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-current-owner)) + (let* ((s4-7 (-> arg0 length)) + (s3-14 0) + (v1-145 (-> arg0 data s3-14)) + ) + (while (< s3-14 s4-7) + (when (and v1-145 (logtest? (-> v1-145 flags) (editable-flag selected))) + (let* ((s2-8 (-> v1-145 owner)) + (a0-56 (car s2-8)) + ) + (while (not (null? s2-8)) + (set-selected! (the-as editable a0-56) #t) + (set! s2-8 (cdr s2-8)) + (set! a0-56 (car s2-8)) + ) + ) + ) + (+! s3-14 1) + (set! v1-145 (-> arg0 data s3-14)) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-current-face)) + (let* ((s4-8 (-> arg0 length)) + (s3-15 0) + (v1-159 (-> arg0 data s3-15)) + ) + (while (< s3-15 s4-8) + (when (and v1-159 (logtest? (-> v1-159 flags) (editable-flag selected))) + (let* ((s2-9 (-> v1-159 owner)) + (a0-62 (car s2-9)) + ) + (while (not (null? s2-9)) + (set-selected! (the-as editable a0-62) #t) + (set! s2-9 (cdr s2-9)) + (set! a0-62 (car s2-9)) + ) + ) + ) + (+! s3-15 1) + (set! v1-159 (-> arg0 data s3-15)) + ) + ) + (let* ((s4-9 (-> arg0 length)) + (s3-16 0) + (s2-10 (-> arg0 data s3-16)) + ) + (while (< s3-16 s4-9) + (when (and s2-10 (or (and (logtest? (-> s2-10 region filter) (-> arg0 filter 0)) + (logtest? (-> s2-10 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> s2-10 flags) (editable-flag selected)) + ) + ) + (let* ((s1-0 (-> s2-10 owner)) + (v1-180 (car s1-0)) + ) + (while (not (null? s1-0)) + (if (logtest? (-> (the-as editable v1-180) flags) (editable-flag selected)) + (set-selected! s2-10 #t) + ) + (set! s1-0 (cdr s1-0)) + (set! v1-180 (car s1-0)) + ) + ) + ) + (+! s3-16 1) + (set! s2-10 (-> arg0 data s3-16)) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command select-current-prim)) + (countdown (s4-10 10) + (let* ((s3-17 (-> arg0 length)) + (s2-11 0) + (v1-195 (-> arg0 data s2-11)) + ) + (while (< s2-11 s3-17) + (when (and v1-195 (logtest? (-> v1-195 flags) (editable-flag selected))) + (let* ((s1-1 (-> v1-195 owner)) + (a0-76 (car s1-1)) + ) + (while (not (null? s1-1)) + (set-selected! (the-as editable a0-76) #t) + (set! s1-1 (cdr s1-1)) + (set! a0-76 (car s1-1)) + ) + ) + ) + (+! s2-11 1) + (set! v1-195 (-> arg0 data s2-11)) + ) + ) + (let* ((s3-18 (-> arg0 length)) + (s2-12 0) + (s1-2 (-> arg0 data s2-12)) + ) + (while (< s2-12 s3-18) + (when (and s1-2 (or (and (logtest? (-> s1-2 region filter) (-> arg0 filter 0)) + (logtest? (-> s1-2 region filter) (-> arg0 filter 1)) + ) + (logtest? (-> s1-2 flags) (editable-flag selected)) + ) + ) + (let* ((s0-0 (-> s1-2 owner)) + (v1-216 (car s0-0)) + ) + (while (not (null? s0-0)) + (if (logtest? (-> (the-as editable v1-216) flags) (editable-flag selected)) + (set-selected! s1-2 #t) + ) + (set! s0-0 (cdr s0-0)) + (set! v1-216 (car s0-0)) + ) + ) + ) + (+! s2-12 1) + (set! s1-2 (-> arg0 data s2-12)) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command cancel)) + (editable-array-method-14 arg0 (editable-command none) (editable-command none) (the-as string #f)) + ) + (((editable-command pick-target)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a0-90 arg0) + (t9-60 (method-of-object a0-90 editable-array-method-10)) + (a1-75 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-75 x) (-> arg2 posx)) + (set! (-> a1-75 y) (-> arg2 posy)) + (set! (-> a1-75 z) 0.0) + (set! (-> a1-75 w) 1.0) + (let ((v1-235 (t9-60 a0-90 a1-75 0))) + (when v1-235 + (set! (-> arg0 target) v1-235) + (handle-cmd arg0 (-> arg0 target-command) arg2 arg3) + ) + ) + ) + (editable-array-method-14 arg0 (editable-command none) (editable-command none) (the-as string #f)) + ) + (((editable-command pick-loc) (editable-command pick-yes-no)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (handle-cmd arg0 (-> arg0 target-command) arg2 arg3) + (editable-array-method-14 arg0 (editable-command none) (editable-command none) (the-as string #f)) + ) + (((editable-command edit-plane-clear)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (set! (-> arg0 edit-plane) #f) + (editable-array-method-17 arg0) + ) + (((editable-command edit-plane-set)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (cond + ((-> arg0 target) + (set! (-> arg0 edit-plane) (the-as editable-plane (as-type (-> arg0 target) editable-plane))) + (editable-array-method-17 arg0) + ) + (else + (editable-array-method-15 + arg0 + (the-as (function editable editable-region symbol) (lambda ((arg0 editable)) (type? arg0 editable-plane))) + (the-as editable-region #f) + ) + (cond + ((>= (-> arg0 selection length) 1) + (set! (-> arg0 edit-plane) (the-as editable-plane (-> arg0 selection 0))) + (editable-array-method-17 arg0) + ) + (else + (editable-array-method-14 + arg0 + (editable-command pick-target) + (editable-command edit-plane-set) + "pick the plane to edit-from" + ) + ) + ) + ) + ) + ) + (((editable-command print-region-info)) + (let ((s5-6 (-> arg0 region))) + (when s5-6 + (format #t "~%~%region-~D~%~%" (-> s5-6 id)) + (let ((a2-39 (-> s5-6 on-enter))) + (if a2-39 + (format #t "(on-enter ~S)~%" a2-39) + ) + ) + (let ((a2-40 (-> s5-6 on-inside))) + (if a2-40 + (format #t "(on-inside ~S)~%" a2-40) + ) + ) + (let ((a2-41 (-> s5-6 on-exit))) + (if a2-41 + (format #t "(on-exit ~S)~%" a2-41) + ) + ) + (format #t "~%~%") + ) + ) + (format #t "~%selected:~%") + (let* ((s5-7 (-> arg0 length)) + (s4-13 0) + (a2-42 (-> arg0 data s4-13)) + ) + (while (< s4-13 s5-7) + (if (and a2-42 (logtest? (-> a2-42 flags) (editable-flag selected))) + (format #t "~A~%" a2-42) + ) + (+! s4-13 1) + (set! a2-42 (-> arg0 data s4-13)) + ) + ) + (format #t "~%~%") + ) + (else + (return #f) + ) + ) + #t + ) + +;; definition for function execute-mouse-move +;; INFO: Used lq/sq +(defun execute-mouse-move ((arg0 editable-array) (arg1 editable-command) (arg2 mouse-info) (arg3 manipulator)) + (local-vars + (v0-2 object) + (sv-128 (function vector vector float vector)) + (sv-144 vector) + (sv-160 vector) + (sv-176 vector) + (sv-192 vector) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (set! v0-2 (cond + ((= arg1 (editable-command camera-tumble)) + (set-setting! 'mouse-input 'abs #t 0) + (let ((s5-1 (new-stack-vector0)) + (f30-0 0.0) + ) + (let* ((s4-1 (-> arg0 length)) + (s3-0 0) + (a0-2 (-> arg0 data s3-0)) + ) + (while (< s3-0 s4-1) + (when (and a0-2 (logtest? (-> a0-2 flags) (editable-flag selected))) + (vector+! s5-1 s5-1 (editable-method-15 a0-2)) + (set! f30-0 (+ 1.0 f30-0)) + ) + (+! s3-0 1) + (set! a0-2 (-> arg0 data s3-0)) + ) + ) + (cond + ((= f30-0 0.0) + (remove-setting! 'mouse-tumble-point) + ) + (else + (vector-float/! s5-1 s5-1 f30-0) + (set-setting! 'mouse-tumble-point 'abs s5-1 0) + ) + ) + ) + ) + ((= arg1 (editable-command camera-xy)) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= arg1 (editable-command camera-xz)) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= arg1 (editable-command drag-move)) + (let* ((s4-2 (-> arg0 length)) + (s3-1 0) + (a0-8 (-> arg0 data s3-1)) + ) + (while (< s3-1 s4-2) + (if (and a0-8 (logtest? (-> a0-8 flags) (editable-flag selected))) + (editable-method-17 a0-8 (-> arg3 speed) (editable-flag no-update)) + ) + (+! s3-1 1) + (set! a0-8 (-> arg0 data s3-1)) + ) + ) + (let* ((s5-2 (-> arg0 length)) + (s4-3 0) + (a0-9 (-> arg0 data s4-3)) + ) + (while (< s4-3 s5-2) + (if (and a0-9 (logtest? (-> a0-9 flags) (editable-flag selected))) + (editable-method-30 a0-9 (editable-flag)) + ) + (+! s4-3 1) + (set! a0-9 (-> arg0 data s4-3)) + ) + ) + (cleanup-selection arg0) + ) + ((= arg1 (editable-command snap-rotate)) + (let* ((s4-4 (-> arg0 length)) + (s3-2 0) + (a0-11 (-> arg0 data s3-2)) + ) + (while (< s3-2 s4-4) + (if (and a0-11 (logtest? (-> a0-11 flags) (editable-flag selected))) + (editable-method-35 a0-11 (-> *editable* 0 mouse-normal)) + ) + (+! s3-2 1) + (set! a0-11 (-> arg0 data s3-2)) + ) + ) + (let* ((s4-5 (-> arg0 length)) + (s3-3 0) + (a0-12 (-> arg0 data s3-3)) + ) + (while (< s3-3 s4-5) + (if (and a0-12 (logtest? (-> a0-12 flags) (editable-flag selected))) + (editable-method-30 a0-12 (editable-flag)) + ) + (+! s3-3 1) + (set! a0-12 (-> arg0 data s3-3)) + ) + ) + (cleanup-selection arg0) + (update-manipulator-position arg0 arg3) + ) + ((= arg1 (editable-command drag-rotate)) + (let ((v1-70 0)) + (let* ((a0-15 (-> arg0 length)) + (a1-22 0) + (a3-5 (-> arg0 data a1-22)) + ) + (while (< a1-22 a0-15) + (if (and a3-5 (logtest? (-> a3-5 flags) (editable-flag selected))) + (+! v1-70 1) + ) + (+! a1-22 1) + (set! a3-5 (-> arg0 data a1-22)) + ) + ) + (cond + ((= v1-70 1) + (let* ((s4-6 (-> arg0 length)) + (s3-4 0) + (a0-19 (-> arg0 data s3-4)) + ) + (while (< s3-4 s4-6) + (if (and a0-19 (logtest? (-> a0-19 flags) (editable-flag selected))) + (get-null-vec2 a0-19 (-> arg3 angles)) + ) + (+! s3-4 1) + (set! a0-19 (-> arg0 data s3-4)) + ) + ) + ) + (else + (let* ((s3-5 (-> arg0 length)) + (s2-1 0) + (s1-2 (-> arg0 data s2-1)) + ) + (while (< s2-1 s3-5) + (when (and s1-2 (logtest? (-> s1-2 flags) (editable-flag selected))) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (set! sv-176 (new 'stack-no-clear 'vector)) + (set! sv-128 vector-rotate-around-y!) + (set! sv-144 (new 'stack-no-clear 'vector)) + (set! sv-160 (new 'stack-no-clear 'vector)) + (let ((v1-92 (editable-method-15 s1-2)) + (a0-23 (-> arg3 position)) + ) + (.lvf vf4 (&-> v1-92 quad)) + (.lvf vf5 (&-> a0-23 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-160 quad) vf6) + (let* ((a2-16 (* 182.04445 (- (-> arg2 posx) (-> arg2 pos 1 x)))) + (v0-11 (sv-128 sv-144 sv-160 a2-16)) + (v1-95 (-> arg3 position)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> v0-11 quad)) + (.lvf vf5 (&-> v1-95 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + (let* ((v1-98 (editable-method-15 s1-2)) + (s0-1 (vector-! s0-0 sv-176 v1-98)) + ) + (editable-method-17 s1-2 s0-1 (editable-flag no-update)) + ) + ) + ) + (+! s2-1 1) + (set! s1-2 (-> arg0 data s2-1)) + ) + ) + (let* ((s5-3 (-> arg0 length)) + (s4-7 0) + (a0-28 (-> arg0 data s4-7)) + ) + (while (< s4-7 s5-3) + (if (and a0-28 (logtest? (-> a0-28 flags) (editable-flag selected))) + (editable-method-30 a0-28 (editable-flag)) + ) + (+! s4-7 1) + (set! a0-28 (-> arg0 data s4-7)) + ) + ) + ) + ) + ) + (cleanup-selection arg0) + ) + ((= arg1 (editable-command drag-scale)) + (let* ((s3-6 (-> arg0 length)) + (s2-2 0) + (s1-3 (-> arg0 data s2-2)) + ) + (while (< s2-2 s3-6) + (when (and s1-3 (logtest? (-> s1-3 flags) (editable-flag selected))) + (let ((s0-2 (new 'stack-no-clear 'vector))) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((v1-125 (editable-method-15 s1-3)) + (a0-33 (-> arg3 position)) + ) + (.lvf vf4 (&-> v1-125 quad)) + (.lvf vf5 (&-> a0-33 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-192 quad) vf6) + (let* ((f0-5 (* 0.01 (- (-> arg2 posx) (-> arg2 pos 1 x)))) + (s0-3 (vector-float*! s0-2 sv-192 f0-5)) + ) + (case (-> arg3 action) + (((manipulator-action ma1)) + (set! (-> s0-3 y) 0.0) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma2)) + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma3)) + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 y) 0.0) + ) + (((manipulator-action ma4)) + (set! (-> s0-3 z) 0.0) + ) + (((manipulator-action ma5)) + (set! (-> s0-3 y) 0.0) + ) + (((manipulator-action ma6)) + (set! (-> s0-3 x) 0.0) + ) + (((manipulator-action ma7)) + ) + (else + (set! (-> s0-3 x) 0.0) + (set! (-> s0-3 y) 0.0) + (set! (-> s0-3 z) 0.0) + ) + ) + (editable-method-17 s1-3 s0-3 (editable-flag no-update)) + ) + ) + ) + (+! s2-2 1) + (set! s1-3 (-> arg0 data s2-2)) + ) + ) + (let* ((s5-4 (-> arg0 length)) + (s4-8 0) + (a0-42 (-> arg0 data s4-8)) + ) + (while (< s4-8 s5-4) + (if (and a0-42 (logtest? (-> a0-42 flags) (editable-flag selected))) + (editable-method-30 a0-42 (editable-flag)) + ) + (+! s4-8 1) + (set! a0-42 (-> arg0 data s4-8)) + ) + ) + (cleanup-selection arg0) + ) + (else + (return #f) + v0-2 + ) + ) + ) + #t + ) + ) + +;; definition for function execute-move +(defun execute-move ((arg0 editable-array) (arg1 editable-command) (arg2 mouse-info) (arg3 manipulator)) + (case arg1 + (((editable-command drag-resize)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 x) (* 0.001 + (vector-vector-distance (-> *math-camera* trans) (-> arg3 position)) + (- (-> arg2 posx) (-> arg2 pos 1 x)) + ) + ) + (set! (-> s3-0 y) 0.0) + (set! (-> s3-0 z) 0.0) + (set! (-> s3-0 w) 1.0) + (let* ((s5-1 (-> arg0 length)) + (s4-1 0) + (a0-3 (-> arg0 data s4-1)) + ) + (while (< s4-1 s5-1) + (if (and a0-3 (logtest? (-> a0-3 flags) (editable-flag selected))) + (editable-method-19 a0-3 s3-0) + ) + (+! s4-1 1) + (set! a0-3 (-> arg0 data s4-1)) + ) + ) + ) + ) + (((editable-command refresh-filter)) + (let* ((s5-2 (-> arg0 length)) + (s4-2 0) + (s3-1 (-> arg0 data s4-2)) + ) + (while (< s4-2 s5-2) + (if (and s3-1 (-> s3-1 region)) + (set! (-> s3-1 region filter) (editable-region-method-12 (-> s3-1 region))) + ) + (+! s4-2 1) + (set! s3-1 (-> arg0 data s4-2)) + ) + ) + ) + (((editable-command resize)) + (let ((s5-3 (new 'stack-no-clear 'vector))) + (set! (-> s5-3 x) 0.0) + (set! (-> s5-3 y) (* 4096.0 (-> arg0 edit-param0))) + (set! (-> s5-3 z) 0.0) + (set! (-> s5-3 w) 1.0) + (let* ((s4-3 (-> arg0 length)) + (s3-2 0) + (a0-8 (-> arg0 data s3-2)) + ) + (while (< s3-2 s4-3) + (if (and a0-8 (logtest? (-> a0-8 flags) (editable-flag selected))) + (editable-method-19 a0-8 s5-3) + ) + (+! s3-2 1) + (set! a0-8 (-> arg0 data s3-2)) + ) + ) + ) + ) + (((editable-command insert-sphere)) + (let ((s3-3 (get-length arg0))) + (when (>= s3-3 0) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-3 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-1 (new 'debug 'editable-sphere a2-3 2048.0 (-> arg0 region))) + ) + (set! (-> arg0 data s3-3) s2-1) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-1 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-point)) + (let ((s3-4 (get-length arg0))) + (when (>= s3-4 0) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-7 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-3 (new 'debug 'editable-point a2-7 (-> arg0 region))) + ) + (set! (-> arg0 data s3-4) s2-3) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-3 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-sample)) + (let ((s3-5 (get-length arg0))) + (when (>= s3-5 0) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-11 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-5 (new 'debug 'editable-sample a2-11 *editable-sample-region*)) + ) + (set! (-> arg0 data s3-5) s2-5) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-5 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-simple-camera)) + (let ((s3-6 (get-length arg0))) + (when (>= s3-6 0) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let ((s2-8 (new 'debug 'editable-sample (math-camera-pos) *editable-sample-region*))) + (set! (-> arg0 data s3-6) s2-8) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-8 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-light)) + (let ((s3-7 (get-length arg0))) + (when (>= s3-7 0) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-18 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-10 (new 'debug 'editable-light a2-18 2048.0 *editable-light-region*)) + ) + (set! (-> arg0 data s3-7) s2-10) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-10 #t) + (editable-method-25 s2-10) + ) + (update-light-hash *light-hash*) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-entity)) + (let ((s3-8 (get-length arg0))) + (when (>= s3-8 0) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((a2-22 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0))) + (s2-12 (new 'debug 'editable-entity a2-22 6144.0 *editable-entity-region*)) + ) + (set! (-> arg0 data s3-8) s2-12) + (handle-cmd arg0 (editable-command select-none) arg2 arg3) + (set-selected! s2-12 #t) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-box)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((a1-49 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0)))) + (insert-box arg0 a1-49 (the-as vector arg3)) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-wall)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((a1-54 (editable-array-method-18 arg0 (new 'stack-no-clear 'vector) (-> arg2 pos 0)))) + (insert-wall arg0 a1-54 (the-as vector arg3)) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-face)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (let ((s3-12 (get-length arg0))) + 0 + (editable-array-method-15 + arg0 + (lambda ((arg0 editable) (arg1 editable-region)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) + (-> arg0 region) + ) + (let ((s4-5 (-> arg0 selection length))) + (cond + ((= s4-5 1) + (cond + ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) + (set! (-> arg0 selection 1) (-> arg0 target)) + (+! (-> arg0 selection length) 1) + (+! s4-5 1) + ) + (else + (editable-array-method-14 + arg0 + (editable-command pick-target) + (editable-command insert-face) + "pick the point to complete the face" + ) + (return #f) + ) + ) + ) + ((and (>= s4-5 2) (>= 6 s4-5)) + ) + (else + (format + 0 + "ERROR: face can only be inserted if there are 2-6 points selected in the current region, got ~D.~%" + s4-5 + ) + (return #f) + ) + ) + (when (>= s3-12 0) + (let ((s2-15 (new 'debug 'editable-face (-> arg0 region)))) + (set! (-> arg0 data s3-12) s2-15) + (dotimes (s3-13 s4-5) + (set! (-> s2-15 vertex s3-13) (the-as editable-point (-> arg0 selection s3-13))) + (set! (-> arg0 selection s3-13 owner) (cons s2-15 (-> arg0 selection s3-13 owner))) + ) + (set! (-> s2-15 length) s4-5) + (set-selected! s2-15 #t) + (editable-method-30 s2-15 (editable-flag no-plane-snap)) + (editable-method-31 s2-15 (editable-flag no-plane-snap)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (((editable-command insert-plane)) + (if (and (-> arg0 region) (-> arg0 region locked)) + (set! (-> arg0 region) (new 'debug 'editable-region)) + ) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let ((s2-16 (get-length arg0))) + 0 + (editable-array-method-15 + arg0 + (lambda ((arg0 editable) (arg1 editable-region)) (and (type? arg0 editable-point) (= (-> arg0 region) arg1))) + (-> arg0 region) + ) + (let ((s4-7 (-> arg0 selection length))) + (cond + ((= s4-7 1) + (cond + ((and (-> arg0 target) (type? (-> arg0 target) editable-point) (= (-> arg0 target region) (-> arg0 region))) + (set! (-> arg0 selection 1) (-> arg0 target)) + (+! (-> arg0 selection length) 1) + (+! s4-7 1) + ) + (else + (editable-array-method-14 + arg0 + (editable-command pick-target) + (editable-command insert-plane) + "pick the point to complete the plane" + ) + (return #f) + ) + ) + ) + ((= s4-7 2) + ) + (else + (format + 0 + "ERROR: plane can only be inserted if there are 2 points selected in the current region, got ~D.~%" + s4-7 + ) + (return #f) + ) + ) + (when (>= s2-16 0) + (let ((s3-15 (new 'debug 'editable-plane (-> arg0 region)))) + (set! (-> arg0 data s2-16) s3-15) + (dotimes (s2-17 s4-7) + (set! (-> s3-15 vertex s2-17) (the-as editable-point (-> arg0 selection s2-17))) + (set! (-> arg0 selection s2-17 owner) (cons s3-15 (-> arg0 selection s2-17 owner))) + ) + (set! (-> s3-15 length) s4-7) + (set-selected! s3-15 #t) + (editable-method-30 s3-15 (editable-flag no-plane-snap)) + (editable-method-31 s3-15 (editable-flag no-plane-snap)) + ) + ) + ) + ) + (update-manipulator-position arg0 arg3) + ) + (else + (return #f) + ) + ) + #t + ) + +;; definition for method 9 of type editable-array +(defmethod handle-cmd ((this editable-array) (arg0 editable-command) (arg1 mouse-info) (arg2 object)) + (with-pp + (if (execute-select this arg0 arg1 (the-as manipulator arg2)) + (return #f) + ) + (if (execute-move this arg0 arg1 (the-as manipulator arg2)) + (return #f) + ) + (if (execute-mouse-move this arg0 arg1 (the-as manipulator arg2)) + (return #f) + ) + (cond + ((= arg0 (editable-command copy)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (set! (-> this selection length) 0) + (let* ((s3-2 (-> this length)) + (s2-1 0) + (s1-0 (-> this data s2-1)) + ) + (while (< s2-1 s3-2) + (when (and s1-0 (logtest? (-> s1-0 flags) (editable-flag selected))) + (copy-into-editable-array! s1-0 this) + (when (= (-> s1-0 type) editable-light) + (editable-method-25 s1-0) + (update-light-hash *light-hash*) + ) + ) + (+! s2-1 1) + (set! s1-0 (-> this data s2-1)) + ) + ) + (handle-cmd this (editable-command select-none) arg1 arg2) + (let ((s5-1 (the-as editable-region #f))) + (dotimes (s4-1 (-> this selection length)) + (let ((a0-13 (-> this selection s4-1))) + (when (and a0-13 (logtest? s4-1 1)) + (set! s5-1 (-> a0-13 region)) + (set-selected! a0-13 #t) + ) + ) + ) + (if (not (-> this region-lock?)) + (set! (-> this region) s5-1) + ) + ) + ) + ((= arg0 (editable-command copy-region)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (when (and (-> this region) (not (-> this region locked))) + (handle-cmd this (editable-command select-current-region) arg1 arg2) + (let ((v1-52 (copy (-> this region) 'debug))) + (set! (-> v1-52 id) (the-as uint 0)) + (set! (-> v1-52 changed) #t) + (set! (-> this region) v1-52) + ) + (handle-cmd this (editable-command copy) arg1 arg2) + ) + ) + ((= arg0 (editable-command delete)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((s5-3 (-> this length)) + (s4-3 0) + (s3-4 (-> this data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and s3-4 (logtest? (-> s3-4 flags) (editable-flag selected))) + (editable-array-method-16 this s3-4) + (when (= (-> s3-4 type) editable-light) + (editable-method-25 s3-4) + (update-light-hash *light-hash*) + ) + ) + (+! s4-3 1) + (set! s3-4 (-> this data s4-3)) + ) + ) + (if (not (-> this region-lock?)) + (set! (-> this region) #f) + ) + ) + ((= arg0 (editable-command delete-region)) + (when (-> this region) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (when (!= (-> this region) *editable-light-region*) + (handle-cmd this (editable-command select-current-region) arg1 arg2) + (handle-cmd this (editable-command delete) arg1 arg2) + (set! (-> this region) #f) + ) + ) + ) + ((= arg0 (editable-command snap-to-ground)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((s4-5 (new 'stack-no-clear 'vector)) + (s3-7 (-> this length)) + (s2-4 0) + (s1-1 (-> this data s2-4)) + ) + (while (< s2-4 s3-7) + (when (and s1-1 (logtest? (-> s1-1 flags) (editable-flag selected))) + (if (editable-method-11 s1-1 s4-5) + (editable-method-21 s1-1 s4-5) + ) + ) + (+! s2-4 1) + (set! s1-1 (-> this data s2-4)) + ) + ) + (update-manipulator-position this (the-as manipulator arg2)) + ) + ((= arg0 (editable-command snap-y)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (cond + ((-> this target) + (let* ((s4-7 (editable-method-15 (-> this target))) + (s3-9 (-> this length)) + (s2-5 0) + (a0-38 (-> this data s2-5)) + ) + (while (< s2-5 s3-9) + (if (and a0-38 (logtest? (-> a0-38 flags) (editable-flag selected))) + (editable-method-18 a0-38 s4-7 80) + ) + (+! s2-5 1) + (set! a0-38 (-> this data s2-5)) + ) + ) + ) + (else + (editable-array-method-14 + this + (editable-command pick-target) + (editable-command snap-y) + "pick the editable to use the y from" + ) + ) + ) + (update-manipulator-position this (the-as manipulator arg2)) + ) + ((= arg0 (editable-command snap-xz)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (cond + ((-> this target) + (let* ((s4-9 (editable-method-15 (-> this target))) + (s3-11 (-> this length)) + (s2-6 0) + (a0-43 (-> this data s2-6)) + ) + (while (< s2-6 s3-11) + (if (and a0-43 (logtest? (-> a0-43 flags) (editable-flag selected))) + (editable-method-18 a0-43 s4-9 104) + ) + (+! s2-6 1) + (set! a0-43 (-> this data s2-6)) + ) + ) + ) + (else + (editable-array-method-14 + this + (editable-command pick-target) + (editable-command snap-xz) + "pick the editable to use the xz from" + ) + ) + ) + (update-manipulator-position this (the-as manipulator arg2)) + ) + ((= arg0 (editable-command region-set)) + (when (and (-> this region) (not (-> this region locked))) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((s5-5 (-> this length)) + (s4-11 0) + (a0-47 (-> this data s4-11)) + ) + (while (< s4-11 s5-5) + (if (and a0-47 (logtest? (-> a0-47 flags) (editable-flag selected))) + (change-region! a0-47 (-> this region)) + ) + (+! s4-11 1) + (set! a0-47 (-> this data s4-11)) + ) + ) + ) + ) + ((= arg0 (editable-command region-add)) + (when (and (-> this region) (not (-> this region locked))) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (if (-> this target) + (change-region! (-> this target) (-> this region)) + (editable-array-method-14 + this + (editable-command pick-target) + (editable-command region-add) + "pick the editable to add to current region" + ) + ) + ) + ) + ((= arg0 (editable-command region-new)) + (let ((v1-178 (new 'debug 'editable-region))) + (if (and (-> this region) (not (-> this region locked))) + (set! (-> v1-178 tree) (-> this region tree)) + ) + (set! (-> this region) v1-178) + ) + (handle-cmd this (editable-command region-set) arg1 arg2) + ) + ((= arg0 (editable-command flip-side)) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (let* ((s5-8 (-> this length)) + (s4-14 0) + (a0-61 (-> this data s4-14)) + ) + (while (< s4-14 s5-8) + (if (and a0-61 (logtest? (-> a0-61 flags) (editable-flag selected))) + (editable-method-26 a0-61) + ) + (+! s4-14 1) + (set! a0-61 (-> this data s4-14)) + ) + ) + ) + ((= arg0 (editable-command rotate-level)) + (let* ((f0-1 (* 182.04445 (-> this edit-param0))) + (s5-9 (matrix-rotate-y! (new 'stack-no-clear 'matrix) f0-1)) + (s4-15 (-> this length)) + (s3-12 0) + (a0-63 (-> this data s3-12)) + ) + (while (< s3-12 s4-15) + (if (and a0-63 region (= (-> a0-63 region level) (-> this level))) + (editable-method-20 a0-63 (-> this level-offset) s5-9) + ) + (+! s3-12 1) + (set! a0-63 (-> this data s3-12)) + ) + ) + ) + ((= arg0 (editable-command translate-y-level)) + (let ((s5-10 (new 'stack-no-clear 'vector))) + (set! (-> s5-10 x) 0.0) + (set! (-> s5-10 y) (* 4096.0 (-> this edit-param0))) + (set! (-> s5-10 z) 0.0) + (set! (-> s5-10 w) 1.0) + (let* ((s4-16 (-> this length)) + (s3-13 0) + (a0-64 (-> this data s3-13)) + ) + (while (< s3-13 s4-16) + (if (and a0-64 region (= (-> a0-64 region level) (-> this level))) + (editable-method-17 a0-64 s5-10 (editable-flag x y z)) + ) + (+! s3-13 1) + (set! a0-64 (-> this data s3-13)) + ) + ) + ) + ) + ((= arg0 (editable-command save)) + (let* ((s5-11 (-> this length)) + (s4-17 0) + (v1-234 (-> this data s4-17)) + ) + (while (< s4-17 s5-11) + (if (and v1-234 (-> v1-234 region)) + (save-region! (-> v1-234 region) this 0 0) + ) + (+! s4-17 1) + (set! v1-234 (-> this data s4-17)) + ) + ) + (save-region! *editable-sample-region* this 0 0) + (save-region! *editable-light-region* this 0 0) + (save-region! *editable-entity-region* this 0 0) + ) + ((= arg0 (editable-command load)) + (handle-cmd this (editable-command select-none) arg1 arg2) + (dotimes (v1-251 (-> this length)) + (set! (-> this data v1-251) #f) + ) + (set! (-> this length) 0) + (let* ((s5-12 this) + (s4-18 (method-of-object s5-12 editable-array-method-13)) + (v1-256 (level-get-target-inside *level*)) + ) + (s4-18 s5-12 (if v1-256 + (-> v1-256 info dbname) + #f + ) + ) + ) + (handle-cmd this (editable-command update-game) (the-as mouse-info #f) #f) + ) + ((= arg0 (editable-command update-game)) + (reset-light-hash *light-hash*) + (let* ((s5-13 (-> this length)) + (s4-19 0) + (a0-79 (-> this data s4-19)) + ) + (while (< s4-19 s5-13) + (if a0-79 + (editable-method-25 a0-79) + ) + (+! s4-19 1) + (set! a0-79 (-> this data s4-19)) + ) + ) + (update-light-hash *light-hash*) + ) + ((or (= arg0 (editable-command exit)) (= arg0 (editable-command kill))) + (deactivate pp) + ) + ) + #f + ) + ) + +;; definition for method 10 of type editable-player +(defmethod deactivate ((this editable-player)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (dotimes (v1-0 (-> *level* length)) + (let ((a1-3 (-> *level* level v1-0))) + (if (= (-> a1-3 status) 'active) + (set! (-> a1-3 light-hash) (-> a1-3 bsp light-hash)) + ) + ) + ) + (set! *editable* (the-as (pointer editable-player) #f)) + (set! *external-cam-mode* (-> this external-cam-mode)) + ((method-of-type process-drawable deactivate) this) + (none) + ) + +;; definition for method 7 of type editable-player +;; WARN: Return type mismatch process-drawable vs editable-player. +(defmethod relocate ((this editable-player) (offset int)) + (let ((v1-0 *kernel-context*)) + (set! (-> v1-0 relocating-process) this) + (set! (-> v1-0 relocating-min) (the-as int (&-> this type))) + (set! (-> v1-0 relocating-max) + (the-as int (+ (+ (-> this allocated-length) -4 (-> process size)) (the-as int this))) + ) + (set! (-> v1-0 relocating-offset) offset) + ) + (let ((v1-2 (-> this current))) + (if (and (>= (the-as int v1-2) (-> *kernel-context* relocating-min)) + (< (the-as int v1-2) (-> *kernel-context* relocating-max)) + ) + (&+! (-> this current) offset) + ) + ) + (the-as editable-player ((method-of-type process-drawable relocate) this offset)) + ) + +;; definition for method 21 of type editable-player +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-player-method-21 ((this editable-player)) + (set! *display-region-marks* #f) + (let* ((s5-0 (-> this current length)) + (s4-0 0) + (a0-2 (-> this current data s4-0)) + ) + (while (< s4-0 s5-0) + (if (and a0-2 (or (and (logtest? (-> a0-2 region filter) (-> this current filter 0)) + (logtest? (-> a0-2 region filter) (-> this current filter 1)) + ) + (logtest? (-> a0-2 flags) (editable-flag selected)) + ) + ) + (editable-method-10 a0-2) + ) + (+! s4-0 1) + (set! a0-2 (-> this current data s4-0)) + ) + ) + (let ((s4-1 (new-stack-vector0)) + (s5-1 0) + ) + (let* ((s3-0 (-> this current length)) + (s2-0 0) + (a0-5 (-> this current data s2-0)) + ) + (while (< s2-0 s3-0) + (when (and a0-5 (logtest? (-> a0-5 flags) (editable-flag selected))) + (vector+! s4-1 s4-1 (editable-method-15 a0-5)) + (+! s5-1 1) + ) + (+! s2-0 1) + (set! a0-5 (-> this current data s2-0)) + ) + ) + (if (nonzero? s5-1) + (manipulator-method-11 (-> this manipulator)) + ) + ) + (when #t + (format *stdcon* "~0K") + (format *stdcon* "~16S~16S~16S~%" "Left button" "Middle button" "Right button") + (format + *stdcon* + "~16S~16S~16S~%" + (editable-command->string + (if (and (nonzero? (-> this command 1)) (or (= (-> this command 0) (editable-command none)) (mouse-hold? left))) + (-> this command 1) + (-> this command 0) + ) + ) + (editable-command->string + (if (and (nonzero? (-> this command 5)) (or (= (-> this command 4) (editable-command none)) (mouse-hold? middle))) + (-> this command 5) + (-> this command 4) + ) + ) + (editable-command->string + (if (and (nonzero? (-> this command 3)) (or (= (-> this command 2) (editable-command none)) (mouse-hold? right))) + (-> this command 3) + (-> this command 2) + ) + ) + ) + (let* ((s5-3 (-> this current length)) + (s4-3 0) + (v1-52 (-> this current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and v1-52 (logtest? (-> v1-52 flags) (editable-flag selected))) + (let ((s3-2 (-> v1-52 name))) + (if (not (string-prefix= "undefined" s3-2)) + (format *stdcon* "~s~%" s3-2) + ) + ) + ) + (+! s4-3 1) + (set! v1-52 (-> this current data s4-3)) + ) + ) + (when (!= *master-mode* 'menu) + (let ((a2-5 (-> this current target-message))) + (if a2-5 + (format *stdcon* "~%~3L~S~0L~%" a2-5) + ) + ) + (when (cpad-hold? 1 triangle) + (let* ((s5-4 (-> this current length)) + (s4-4 0) + (a0-33 (-> this current data s4-4)) + ) + (while (< s4-4 s5-4) + (when (and a0-33 (or (and (logtest? (-> a0-33 region filter) (-> this current filter 0)) + (logtest? (-> a0-33 region filter) (-> this current filter 1)) + ) + (logtest? (-> a0-33 flags) (editable-flag selected)) + ) + ) + (if (and (-> a0-33 region) (!= (-> a0-33 type) editable-point)) + (print-region-info (-> a0-33 region) (editable-method-15 a0-33) (if (cpad-hold? 1 circle) + 1 + 0 + ) + ) + ) + ) + (+! s4-4 1) + (set! a0-33 (-> this current data s4-4)) + ) + ) + (format *stdcon* "~%") + (cond + ((-> this current region) + (let ((s5-5 (-> this current region))) + (format + *stdcon* + "~%region: region-~D ~S ~S~S~%" + (-> s5-5 id) + (-> s5-5 level) + (-> s5-5 tree) + (if (-> s5-5 changed) + " (modified)" + "" + ) + ) + (format *stdcon* " (on-enter ~S)~%" (-> s5-5 on-enter)) + (format *stdcon* " (on-inside ~S)~%" (-> s5-5 on-inside)) + (format *stdcon* " (on-exit ~S)~%" (-> s5-5 on-exit)) + ) + ) + (else + (format *stdcon* "no region~%") + ) + ) + (when (-> this current edit-plane) + (let ((a2-13 (-> this current edit-plane))) + (format *stdcon* "~%edit-plane: ~A~%" a2-13) + ) + ) + (format *stdcon* "~%selected:~%") + (let* ((s5-6 (-> this current length)) + (s4-5 0) + (a2-14 (-> this current data s4-5)) + ) + (while (< s4-5 s5-6) + (if (and a2-14 (logtest? (-> a2-14 flags) (editable-flag selected))) + (format *stdcon* " ~A~%" a2-14) + ) + (+! s4-5 1) + (set! a2-14 (-> this current data s4-5)) + ) + ) + ) + ) + (format *stdcon* "~1K~%") + ) + 0 + (none) + ) + +;; definition for method 22 of type editable-player +;; WARN: Return type mismatch int vs none. +(defmethod editable-player-method-22 ((this editable-player)) + (cond + ((or (logtest? (-> *keybd* keys 0) 4) (logtest? (-> *keybd* keys 0) 64)) + (set-setting! 'mouse-input 'abs #t 0) + (set! (-> this command 0) (editable-command camera-rotate)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command camera-zoom)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command camera-move)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 left) (not (-> this left-handed))) (and (cpad-hold? 1 square) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command copy-region)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command delete-region)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command region-add)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 right) (not (-> this left-handed))) (and (cpad-hold? 1 circle) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command update-game)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command delete)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command copy)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 up) (not (-> this left-handed))) (and (cpad-hold? 1 triangle) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command select-none)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command print-region-info)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command flip-side)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((and (or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (or (and (cpad-hold? 1 down) (not (-> this left-handed))) (and (cpad-hold? 1 x) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command insert-sample)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command insert-simple-camera)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command insert-entity)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((or (cpad-hold? 1 l2) (cpad-hold? 1 r2)) + (set! (-> this command 0) (editable-command none)) + (set! (-> this command 1) (editable-command camera-tumble)) + (set! (-> this command 2) (editable-command none)) + (set! (-> this command 3) (editable-command camera-xz)) + (set! (-> this command 4) (editable-command none)) + (set! (-> this command 5) (editable-command camera-xy)) + ) + ((or (or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16)) + (and (cpad-hold? 1 up) + (cpad-hold? 1 left) + (or (and (cpad-hold? 1 up) (not (-> this left-handed))) (and (cpad-hold? 1 triangle) (-> this left-handed))) + ) + ) + (set! (-> this command 0) (editable-command select-region)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command select-prim)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command select-face)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((logtest? (-> *keybd* keys 0) 8) + (set! (-> this command 0) (editable-command none)) + (set! (-> this command 1) (editable-command drag-rotate)) + (set! (-> this command 2) (editable-command none)) + (set! (-> this command 3) (editable-command snap-rotate)) + (set! (-> this command 4) (editable-command none)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((or (and (cpad-hold? 1 left) (not (-> this left-handed))) (and (cpad-hold? 1 square) (-> this left-handed))) + (set! (-> this command 0) (editable-command none)) + (set! (-> this command 1) (editable-command drag-move)) + (set! (-> this command 2) (editable-command none)) + (set! (-> this command 3) (editable-command drag-move)) + (set! (-> this command 4) (editable-command none)) + (set! (-> this command 5) (editable-command drag-move)) + ) + ((or (and (cpad-hold? 1 right) (not (-> this left-handed))) (and (cpad-hold? 1 circle) (-> this left-handed))) + (set! (-> this command 0) (editable-command insert-light)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command insert-sphere)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command insert-point)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((or (or (logtest? (-> *keybd* keys 0) 2) (logtest? (-> *keybd* keys 0) 32)) + (or (and (cpad-hold? 1 up) (not (-> this left-handed))) (and (cpad-hold? 1 triangle) (-> this left-handed))) + ) + (set! (-> this command 0) (editable-command select-add)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command select-remove)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command select-toggle)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + ((or (and (cpad-hold? 1 down) (not (-> this left-handed))) (and (cpad-hold? 1 x) (-> this left-handed))) + (set! (-> this command 0) (editable-command insert-face)) + (set! (-> this command 1) (editable-command none)) + (set! (-> this command 2) (editable-command insert-box)) + (set! (-> this command 3) (editable-command none)) + (set! (-> this command 4) (editable-command insert-plane)) + (set! (-> this command 5) (editable-command none)) + 0 + ) + (else + (set! (-> this command 0) (editable-command none)) + (set! (-> this command 1) (editable-command drag-move)) + (set! (-> this command 2) (editable-command none)) + (set! (-> this command 3) (editable-command drag-resize)) + (set! (-> this command 4) (editable-command none)) + (set! (-> this command 5) (editable-command drag-scale)) + ) + ) + 0 + (none) + ) + +;; definition for function get-light-value +(defun get-light-value ((arg0 uint)) + (let ((f30-0 0.0)) + (let* ((s5-0 (-> *editable* 0 current length)) + (s4-0 0) + (s3-0 (-> *editable* 0 current data s4-0)) + ) + (while (< s4-0 s5-0) + (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) + (let ((v1-8 (as-type s3-0 editable-light))) + (if (the-as editable-light v1-8) + (set! f30-0 (-> (&+ (the-as (pointer float) v1-8) arg0) 0)) + ) + ) + ) + (+! s4-0 1) + (set! s3-0 (-> *editable* 0 current data s4-0)) + ) + ) + f30-0 + ) + ) + +;; definition for function set-light-value +;; WARN: Return type mismatch symbol vs object. +(defun set-light-value ((arg0 int) (arg1 float)) + (let* ((s4-0 (-> *editable* 0 current length)) + (s3-0 0) + (s2-0 (-> *editable* 0 current data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (let ((a0-7 (as-type s2-0 editable-light))) + (when (the-as editable-light a0-7) + (set! (-> (&+ (the-as (pointer float) a0-7) arg0) 0) arg1) + (logior! (-> (the-as editable-light a0-7) flags) (editable-flag changed)) + (let ((v1-12 (-> (the-as editable-light a0-7) region))) + (if v1-12 + (set! (-> v1-12 changed) #t) + ) + ) + (update-light-sphere-from-editable-light (the-as editable-light a0-7)) + ) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> *editable* 0 current data s3-0)) + ) + ) + #f + ) + +;; definition for method 23 of type editable-player +(defmethod editable-player-method-23 ((this editable-player)) + (let ((s5-0 (-> this current)) + (s4-0 (new + 'stack + 'font-context + *font-default-matrix* + 20 + 379 + 0.0 + (font-color menu-selected-parent) + (font-flags shadow kerning) + ) + ) + ) + (set! (-> s4-0 flags) (font-flags)) + (set-width! s4-0 340) + (set-height! s4-0 80) + (set-scale! s4-0 1.0) + (cond + ((or (= (-> this current-command) (editable-command select-add)) + (= (-> this current-command) (editable-command select-remove)) + (= (-> this current-command) (editable-command select-toggle)) + ) + (set-vector! + (-> this mouse-box 1) + (the-as float (the int (-> *mouse* posx))) + (the-as float (the int (-> *mouse* posy))) + 0.0 + (the-as float #x1) + ) + (let ((v1-11 3) + (a0-12 (abs (- (the-as int (-> this mouse-box 1 x)) (the-as uint (the-as int (-> this mouse-box 0 x)))))) + ) + (when (and (< v1-11 a0-12) + (let ((v1-13 3) + (a0-15 (abs (- (the-as int (-> this mouse-box 1 y)) (the-as uint (the-as int (-> this mouse-box 0 y)))))) + ) + (< v1-13 a0-15) + ) + ) + (let ((s4-1 (new 'static 'vector4w)) + (s3-0 (new 'static 'inline-array vector4w 4 + (new 'static 'vector4w) + (new 'static 'vector4w) + (new 'static 'vector4w) + (new 'static 'vector4w) + ) + ) + ) + (set-vector! (-> s3-0 0) (the-as int (-> this mouse-box 0 x)) (the-as int (-> this mouse-box 0 y)) 0 1) + (set-vector! (-> s3-0 1) (the-as int (-> this mouse-box 1 x)) (the-as int (-> this mouse-box 0 y)) 0 1) + (set-vector! (-> s3-0 2) (the-as int (-> this mouse-box 1 x)) (the-as int (-> this mouse-box 1 y)) 0 1) + (set-vector! (-> s3-0 3) (the-as int (-> this mouse-box 0 x)) (the-as int (-> this mouse-box 1 y)) 0 1) + (set-vector! s4-1 128 128 128 128) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> s3-0 0) (-> s3-0 1) s4-1) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> s3-0 1) (-> s3-0 2) s4-1) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> s3-0 2) (-> s3-0 3) s4-1) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> s3-0 3) (-> s3-0 0) s4-1) + ) + ) + ) + (let ((a1-7 (new 'stack-no-clear 'vector))) + (set! (-> a1-7 x) (the float (min (the-as int (-> this mouse-box 0 x)) (the-as int (-> this mouse-box 1 x))))) + (set! (-> a1-7 y) (the float (min (the-as int (-> this mouse-box 0 y)) (the-as int (-> this mouse-box 1 y))))) + (set! (-> a1-7 z) 0.0) + (set! (-> a1-7 w) 1.0) + (let ((a2-5 (new 'stack-no-clear 'vector))) + (set! (-> a2-5 x) (the float (max (the-as int (-> this mouse-box 0 x)) (the-as int (-> this mouse-box 1 x))))) + (set! (-> a2-5 y) (the float (max (the-as int (-> this mouse-box 0 y)) (the-as int (-> this mouse-box 1 y))))) + (set! (-> a2-5 z) 0.0) + (set! (-> a2-5 w) 1.0) + (cond + ((and (not (mouse-hold? left)) (= (-> this current-command) (editable-command select-add))) + (if (and (< 3.0 (- (-> a2-5 x) (-> a1-7 x))) (< 3.0 (- (-> a2-5 y) (-> a1-7 y)))) + (editable-array-method-11 s5-0 a1-7 a2-5 0) + (handle-cmd s5-0 (editable-command select-add) *mouse* (-> this manipulator)) + ) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ((and (not (mouse-hold? right)) (= (-> this current-command) (editable-command select-remove))) + (if (and (< 3.0 (- (-> a2-5 x) (-> a1-7 x))) (< 3.0 (- (-> a2-5 y) (-> a1-7 y)))) + (editable-array-method-11 s5-0 a1-7 a2-5 2) + (handle-cmd s5-0 (editable-command select-remove) *mouse* (-> this manipulator)) + ) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ((and (not (mouse-hold? middle)) (= (-> this current-command) (editable-command select-toggle))) + (if (and (< 3.0 (- (-> a2-5 x) (-> a1-7 x))) (< 3.0 (- (-> a2-5 y) (-> a1-7 y)))) + (editable-array-method-11 s5-0 a1-7 a2-5 1) + (handle-cmd s5-0 (editable-command select-toggle) *mouse* (-> this manipulator)) + ) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ) + ) + ) + ) + ((= (-> this current-command) (editable-command drag-move)) + (manipulator-method-13 (-> this manipulator) (-> this mouse-pos) (-> this mouse-end)) + (when (not (mouse-hold? left)) + (manipulator-method-14 (-> this manipulator)) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ) + ((= (-> this current-command) (editable-command drag-scale)) + (manipulator-method-13 (-> this manipulator) (-> this mouse-pos) (-> this mouse-end)) + (when (not (mouse-hold? middle)) + (manipulator-method-14 (-> this manipulator)) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ) + ((= (-> this current-command) (editable-command drag-rotate)) + (manipulator-method-13 (-> this manipulator) (-> this mouse-pos) (-> this mouse-end)) + (when (not (mouse-hold? left)) + (manipulator-method-14 (-> this manipulator)) + (update-manipulator-position s5-0 (-> this manipulator)) + (set! (-> this current-command) (editable-command none)) + 0 + ) + ) + ((= (-> this current-command) (editable-command drag-resize)) + ) + ((= (-> this current-command) (editable-command select-user1)) + (when (!= (-> *keybd* keys 58) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-1 print-game-text)) + (format (clear *temp-string*) "Red:~F" (-> this float-variable)) + (s5-1 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user2)) + (when (!= (-> *keybd* keys 59) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-2 print-game-text)) + (format (clear *temp-string*) "Green:~F" (-> this float-variable)) + (s5-2 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user3)) + (when (!= (-> *keybd* keys 60) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-3 print-game-text)) + (format (clear *temp-string*) "Blue:~F" (-> this float-variable)) + (s5-3 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user4)) + (when (!= (-> *keybd* keys 61) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-4 print-game-text)) + (format (clear *temp-string*) "Palette Index:~F" (-> this float-variable)) + (s5-4 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user5)) + (when (!= (-> *keybd* keys 62) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-5 print-game-text)) + (format (clear *temp-string*) "Decay Start:~F" (-> this float-variable)) + (s5-5 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user6)) + (when (!= (-> *keybd* keys 63) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-6 print-game-text)) + (format (clear *temp-string*) "Ambient Point Ratio:~F" (-> this float-variable)) + (s5-6 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user7)) + (when (!= (-> *keybd* keys 64) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-7 print-game-text)) + (format (clear *temp-string*) "Brightness:~F" (-> this float-variable)) + (s5-7 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user8)) + (when (!= (-> *keybd* keys 65) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-8 print-game-text)) + (format (clear *temp-string*) "Shadow-Ambi:~F" (-> this float-variable)) + (s5-8 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user9)) + (when (!= (-> *keybd* keys 66) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-9 print-game-text)) + (format (clear *temp-string*) "Shadow-Dir0:~F" (-> this float-variable)) + (s5-9 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user10)) + (when (!= (-> *keybd* keys 67) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-10 print-game-text)) + (format (clear *temp-string*) "Shadow-Dir1:~F" (-> this float-variable)) + (s5-10 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user11)) + (when (!= (-> *keybd* keys 68) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-11 print-game-text)) + (format (clear *temp-string*) "Shadow-Dir2:~F" (-> this float-variable)) + (s5-11 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + ((= (-> this current-command) (editable-command select-user12)) + (when (!= (-> *keybd* keys 69) 1) + (set! (-> this current-command) (editable-command none)) + 0 + ) + (set-light-value (the-as int (-> this float-id)) (-> this float-variable)) + (let ((s5-12 print-game-text)) + (format (clear *temp-string*) "Shadow-Dir3:~F" (-> this float-variable)) + (s5-12 *temp-string* s4-0 #f 44 (bucket-id hud-draw-hud-alpha)) + ) + ) + (else + (return #f) + ) + ) + ) + #t + ) + +;; definition for function keybd-set-time-of-day! +;; WARN: Return type mismatch time-of-day-palette-id vs object. +(defun keybd-set-time-of-day! ((arg0 int) (arg1 time-of-day-palette-id)) + (cond + ((= arg1 (time-of-day-palette-id unk3)) + (send-event + (ppointer->process *time-of-day*) + 'dest-clock-ratio-set + (the-as float (if *time-of-day-fast* + 60.0 + 1.0 + ) + ) + (seconds 2) + ) + ) + (else + (send-event (ppointer->process *time-of-day*) 'change 'ratio 0.0) + (send-event (ppointer->process *time-of-day*) 'change 'hour arg0) + ) + ) + (send-event (ppointer->process *time-of-day*) 'change 'minutes 0) + (send-event (ppointer->process *time-of-day*) 'change 'seconds 0) + (send-event (ppointer->process *time-of-day*) 'change 'frames 0) + (set! *teleport-count* 1) + (set! (-> *time-of-day-context* mode) arg1) + arg1 + ) + +;; failed to figure out what this is: +(defstate idle (editable-player) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-0 object)) + (case message + (('execute) + (let ((a2-1 (-> block param 0))) + (case a2-1 + ((32 31 39 33 35 36) + (editable-array-method-14 + (-> self current) + (editable-command pick-loc) + (the-as editable-command a2-1) + "click on the point to insert at (up target, down camera)" + ) + ) + ((57 1 53 41 61 62) + (if (not (-> self left-handed)) + (editable-array-method-14 + (-> self current) + (editable-command pick-yes-no) + (the-as editable-command a2-1) + "press x to confirm, square to cancel" + ) + (editable-array-method-14 + (-> self current) + (editable-command pick-yes-no) + (the-as editable-command a2-1) + "press down to confirm, left to cancel" + ) + ) + ) + (else + (handle-cmd (-> self current) (the-as editable-command a2-1) *mouse* (-> self manipulator)) + ) + ) + ) + ) + (('exit) + (deactivate self) + ) + (('menu) + (set! v0-0 (+ (current-time) (the-as time-frame (-> block param 0)))) + (set! (-> self close-menu-time) (the-as time-frame v0-0)) + v0-0 + ) + (('select-by-name) + (let ((gp-1 (-> block param 0))) + (handle-cmd (-> self current) (editable-command select-none) *mouse* #f) + (let* ((s5-1 (-> self current length)) + (s4-0 0) + (s3-0 (-> self current data s4-0)) + ) + (while (< s4-0 s5-1) + (when (and s3-0 (or (and (logtest? (-> s3-0 region filter) (-> self current filter 0)) + (logtest? (-> s3-0 region filter) (-> self current filter 1)) + ) + (logtest? (-> s3-0 flags) (editable-flag selected)) + ) + ) + (if (string= (the-as string (-> s3-0 prefix)) (the-as string gp-1)) + (set-selected! s3-0 #t) + ) + ) + (+! s4-0 1) + (set! s3-0 (-> self current data s4-0)) + ) + ) + ) + (update-manipulator-position (-> self current) (-> self manipulator)) + ) + (('on-enter 'on-exit 'on-inside) + (let ((s4-1 (-> self current region))) + (when s4-1 + (let ((gp-2 (-> block param 0))) + (set! (-> *syntax-context* got-error?) #f) + (eval! *syntax-context* (the-as pair gp-2)) + (when (not (-> *syntax-context* got-error?)) + (set! (-> s4-1 changed) #t) + (cond + ((= message 'on-enter) + (set! (-> s4-1 on-enter) (the-as pair gp-2)) + ) + ((= message 'on-inside) + (set! (-> s4-1 on-inside) (the-as pair gp-2)) + ) + ((= message 'on-exit) + (set! (-> s4-1 on-exit) (the-as pair gp-2)) + ) + ) + ) + ) + (set! v0-0 (editable-region-method-12 s4-1)) + (set! (-> s4-1 filter) (the-as editable-filter v0-0)) + v0-0 + ) + ) + ) + (('select) + (let ((gp-3 (-> block param 0))) + (handle-cmd (-> self current) (editable-command select-none) (the-as mouse-info #f) (-> self manipulator)) + (let* ((s5-2 (-> self current length)) + (s4-2 0) + (a0-51 (-> self current data s4-2)) + ) + (while (< s4-2 s5-2) + (when (and a0-51 (or (and (logtest? (-> a0-51 region filter) (-> self current filter 0)) + (logtest? (-> a0-51 region filter) (-> self current filter 1)) + ) + (logtest? (-> a0-51 flags) (editable-flag selected)) + ) + ) + (when (and (-> a0-51 region) (= gp-3 (-> a0-51 region id))) + (set! (-> self current region) (-> a0-51 region)) + (set-selected! a0-51 #t) + ) + ) + (+! s4-2 1) + (set! a0-51 (-> self current data s4-2)) + ) + ) + ) + #f + ) + (('set-pos) + (let* ((s5-3 (-> self current length)) + (s4-3 0) + (s3-1 (-> self current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) + (let ((v1-81 (as-type s3-1 editable-entity))) + (when v1-81 + (vector-copy! (-> v1-81 trans) (the-as vector (-> block param 0))) + (logior! (-> v1-81 flags) (editable-flag changed)) + (let ((v1-82 (-> v1-81 region))) + (if v1-82 + (set! (-> v1-82 changed) #t) + ) + ) + ) + ) + ) + (+! s4-3 1) + (set! s3-1 (-> self current data s4-3)) + ) + ) + #f + ) + (('name) + (let* ((s5-4 (-> self current length)) + (s4-4 0) + (s3-2 (-> self current data s4-4)) + ) + (while (< s4-4 s5-4) + (when (and s3-2 (logtest? (-> s3-2 flags) (editable-flag selected))) + (let ((s2-0 (as-type s3-2 editable-entity))) + (when s2-0 + (copy-string<-string (-> s2-0 name) (the-as string (-> block param 0))) + (logior! (-> s2-0 flags) (editable-flag changed)) + (let ((a0-73 (-> s2-0 region))) + (if a0-73 + (set! (-> a0-73 changed) #t) + ) + ) + ) + ) + ) + (+! s4-4 1) + (set! s3-2 (-> self current data s4-4)) + ) + ) + #f + ) + (('level) + (let ((gp-4 (lookup-level-info (the-as symbol (-> block param 0))))) + (when (-> gp-4 dbname) + (let* ((s5-5 (-> self current length)) + (s4-5 0) + (s3-3 (-> self current data s4-5)) + ) + (while (< s4-5 s5-5) + (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) + (let ((v1-109 (as-type s3-3 editable))) + (when (and v1-109 (-> v1-109 region)) + (set! (-> v1-109 region level) (the-as string (-> gp-4 dbname))) + (set! (-> v1-109 region changed) #t) + (logior! (-> v1-109 flags) (editable-flag changed)) + ) + ) + ) + (+! s4-5 1) + (set! s3-3 (-> self current data s4-5)) + ) + ) + #f + ) + ) + ) + (('get-level) + (-> self current level) + ) + (('direction) + (let* ((f30-0 (the-as float (-> block param 0))) + (f28-0 (the-as float (-> block param 1))) + (f26-0 (the-as float (-> block param 2))) + (f24-0 (if (and (zero? (-> block param 0)) (zero? (-> block param 1)) (zero? (-> block param 2))) + 0.0 + 1.0 + ) + ) + (gp-5 (-> self current length)) + (s5-6 0) + (s3-4 (-> self current data s5-6)) + ) + (while (< s5-6 gp-5) + (when (and s3-4 (logtest? (-> s3-4 flags) (editable-flag selected))) + (let ((s4-6 (as-type s3-4 editable-light))) + (when (and s4-6 (!= (-> (the-as editable-light s4-6) color w) -2.0)) + (set-vector! (-> (the-as editable-light s4-6) direction) f30-0 f28-0 f26-0 f24-0) + (vector-normalize! (-> (the-as editable-light s4-6) direction) 1.0) + (logior! (-> (the-as editable-light s4-6) flags) (editable-flag changed)) + (let ((a0-99 (-> (the-as editable-light s4-6) region))) + (if a0-99 + (set! (-> a0-99 changed) #t) + ) + ) + ) + ) + ) + (+! s5-6 1) + (set! s3-4 (-> self current data s5-6)) + ) + ) + #f + ) + (('angles) + (let* ((f30-1 (the-as float (-> block param 0))) + (f28-1 (the-as float (-> block param 1))) + (f26-1 (the-as float (-> block param 2))) + (gp-6 (-> self current length)) + (s5-7 0) + (s3-5 (-> self current data s5-7)) + ) + (while (< s5-7 gp-6) + (when (and s3-5 (logtest? (-> s3-5 flags) (editable-flag selected))) + (let ((s4-7 (as-type s3-5 editable-entity))) + (when s4-7 + (set-eul! (-> s4-7 angles) (* 182.04445 f30-1) (* 182.04445 f28-1) (* 182.04445 f26-1) 21) + (logior! (-> s4-7 flags) (editable-flag changed)) + (let ((v1-156 (-> s4-7 region))) + (if v1-156 + (set! (-> v1-156 changed) #t) + ) + ) + (editable-entity-method-36 s4-7) + ) + ) + ) + (+! s5-7 1) + (set! s3-5 (-> self current data s5-7)) + ) + ) + (update-manipulator-position (-> self current) (-> self manipulator)) + ) + (('color) + (let* ((f30-2 (the-as float (-> block param 0))) + (f28-2 (the-as float (-> block param 1))) + (f26-2 (the-as float (-> block param 2))) + (f24-1 (the-as float (-> block param 3))) + (gp-7 (-> self current length)) + (s5-8 0) + (s4-8 (-> self current data s5-8)) + ) + (while (< s5-8 gp-7) + (when (and s4-8 (logtest? (-> s4-8 flags) (editable-flag selected))) + (let ((v1-174 (as-type s4-8 editable-light))) + (when v1-174 + (set-vector! (-> v1-174 color) f30-2 f28-2 f26-2 f24-1) + (logior! (-> v1-174 flags) (editable-flag changed)) + (let ((v1-175 (-> v1-174 region))) + (if v1-175 + (set! (-> v1-175 changed) #t) + ) + ) + ) + ) + ) + (+! s5-8 1) + (set! s4-8 (-> self current data s5-8)) + ) + ) + #f + ) + (('param) + (let ((s5-9 (-> block param 0)) + (f30-3 (the-as float (-> block param 1))) + ) + (when (and (>= (the-as int s5-9) 0) (>= 2 (the-as int s5-9))) + (let* ((gp-8 (-> self current length)) + (s4-9 0) + (s3-6 (-> self current data s4-9)) + ) + (while (< s4-9 gp-8) + (when (and s3-6 (logtest? (-> s3-6 flags) (editable-flag selected))) + (let ((v1-189 (as-type s3-6 editable-light))) + (when (the-as editable-light v1-189) + (set! (-> (the-as editable-light (+ (* s5-9 4) (the-as uint v1-189))) decay-start) f30-3) + (logior! (-> (the-as editable-light v1-189) flags) (editable-flag changed)) + (let ((v1-190 (-> (the-as editable-light v1-189) region))) + (if v1-190 + (set! (-> v1-190 changed) #t) + ) + ) + ) + ) + ) + (+! s4-9 1) + (set! s3-6 (-> self current data s4-9)) + ) + ) + #f + ) + ) + ) + ) + ) + :code (behavior () + (until #f + (suspend) + ) + #f + ) + :post (behavior () + (editable-player-method-21 self) + ) + ) + +;; definition for function editable-player-init +;; WARN: Return type mismatch object vs none. +(defbehavior editable-player-init editable-player ((arg0 symbol)) + (set! *editable-temp-id* 0) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + (set! *display-actor-marks* #f) + (set! (-> *editable-work* hide) #f) + (logclear! (-> self mask) (process-mask freeze pause menu)) + (+! (-> self clock ref-count) -1) + (+! (-> *display* real-clock ref-count) 1) + (set! (-> self clock) (-> *display* real-clock)) + (set! (-> self current) (new 'debug 'editable-array 4096)) + (add-setting! 'mouse #t 0.0 0) + (add-setting! 'cursor #t 0.0 0) + (add-setting! 'keybd #t 0.0 0) + (set! (-> self current-command) (editable-command none)) + (set! (-> self select-command) (the-as (function object) 8)) + (set! (-> self drag-command) (the-as uint 20)) + (set! (-> self extra-command) (the-as (function object) 24)) + (set! (-> self left-handed) #f) + (set! (-> self light-names) #f) + (set! (-> self command 0) (the-as editable-command (-> self select-command))) + (set! (-> self command 1) (editable-command none)) + (set! (-> self command 2) (editable-command none)) + (set! (-> self command 3) (the-as editable-command (-> self extra-command))) + (set! (-> self command 4) (editable-command none)) + (set! (-> self command 5) (the-as editable-command (-> self drag-command))) + (let* ((s5-0 (-> self current)) + (s4-0 (method-of-object s5-0 editable-array-method-13)) + (s3-0 (if arg0 + (lookup-level-info arg0) + ) + ) + (gp-1 (level-get-target-inside *level*)) + (a1-6 (cond + (s3-0 + (let ((gp-2 (level-get *level* (-> s3-0 dbname)))) + (when gp-2 + (format 0 "setting level~d ~s to *light-hash*~%" (-> gp-2 index) (-> gp-2 name)) + (set! (-> gp-2 light-hash) *light-hash*) + ) + ) + (-> s3-0 dbname) + ) + (gp-1 + (let ((s3-1 (level-get *level* (-> gp-1 info dbname)))) + (when s3-1 + (format 0 "setting level~d ~s to *light-hash*~%" (-> s3-1 index) (-> s3-1 name)) + (set! (-> s3-1 light-hash) *light-hash*) + ) + ) + (-> gp-1 info dbname) + ) + ) + ) + ) + (s4-0 s5-0 a1-6) + ) + (set! *editable* (the-as (pointer editable-player) (process->ppointer self))) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (set! (-> self external-cam-mode) *external-cam-mode*) + (set! *external-cam-mode* 'pad-1) + (matrix-identity! (-> self manipulator mat)) + (handle-cmd (-> self current) (editable-command update-game) (the-as mouse-info #f) (-> self manipulator)) + (go-virtual idle) + (none) + ) + +;; definition for function set-editable-name +;; WARN: Return type mismatch string vs object. +(defun set-editable-name ((arg0 string)) + (copy-string<-string *editable-default-name* arg0) + ) + +;; definition for function select-editable-by-name +(defun select-editable-by-name ((arg0 string)) + (send-event (ppointer->process *editable*) 'select-by-name arg0) + ) + +;; definition for symbol *editable-menu-context*, type debug-menu-context +(define *editable-menu-context* (new 'debug 'debug-menu-context)) + +;; failed to figure out what this is: +(set! (-> *editable-menu-context* joypad-number) 1) + +;; definition for function editable-menu-command +(defun editable-menu-command ((arg0 int)) + (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) + (send-event (ppointer->process *editable*) 'menu 90) + ) + +;; definition for function editable-menu-command-no-close +(defun editable-menu-command-no-close ((arg0 int)) + (send-event (ppointer->process *editable*) 'execute (/ arg0 8)) + ) + +;; definition for function dm-region-tree-pick-func +;; WARN: Return type mismatch object vs symbol. +(defun dm-region-tree-pick-func ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (when (and *editable* (-> *editable* 0 current region)) + (let ((s5-0 (-> *editable* 0 current region))) + (set! (-> s5-0 tree) arg0) + (set! (-> s5-0 changed) #t) + (set! (-> s5-0 filter) (editable-region-method-12 s5-0)) + ) + ) + ) + (the-as + symbol + (and *editable* (-> *editable* 0 current region) (= arg0 (-> *editable* 0 current region tree))) + ) + ) + +;; definition for function dm-editable-flag-pick-func +(defun dm-editable-flag-pick-func ((arg0 editable-flag) (arg1 debug-menu-msg)) + (when *editable* + (let ((gp-0 (/ (the-as int arg0) 8))) + (editable-array-method-15 + (-> *editable* 0 current) + (the-as (function editable editable-region symbol) true-func) + (the-as editable-region #f) + ) + (when (= arg1 (debug-menu-msg press)) + (let* ((v1-10 (-> *editable* 0 current length)) + (a0-2 0) + (a1-4 (-> *editable* 0 current data a0-2)) + ) + (while (< a0-2 v1-10) + (if (and a1-4 (logtest? (-> a1-4 flags) (editable-flag selected))) + (logxor! (-> a1-4 flags) (the-as uint gp-0)) + ) + (+! a0-2 1) + (set! a1-4 (-> *editable* 0 current data a0-2)) + ) + ) + ) + (and (>= (-> *editable* 0 current selection length) 1) + (logtest? (-> *editable* 0 current selection 0 flags) gp-0) + ) + ) + ) + ) + +;; definition for function dm-editable-filter0-pick-func +(defun dm-editable-filter0-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) + (when *editable* + (let ((v1-1 (/ (the-as int arg0) 8))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *editable* 0 current filter 0) (the-as uint v1-1)) + ) + (logtest? (-> *editable* 0 current filter 0) v1-1) + ) + ) + ) + +;; definition for function dm-editable-filter1-pick-func +(defun dm-editable-filter1-pick-func ((arg0 editable-filter) (arg1 debug-menu-msg)) + (when *editable* + (let ((v1-1 (/ (the-as int arg0) 8))) + (if (= arg1 (debug-menu-msg press)) + (logxor! (-> *editable* 0 current filter 1) (the-as uint v1-1)) + ) + (logtest? (-> *editable* 0 current filter 1) v1-1) + ) + ) + ) + +;; definition for function dm-editable-light-float-func +(defun dm-editable-light-float-func ((arg0 int) (arg1 debug-menu-msg) (arg2 float) (arg3 float)) + (cond + ((not *editable*) + arg3 + ) + ((= arg1 (debug-menu-msg press)) + (let* ((s4-0 (-> *editable* 0 current length)) + (s3-0 0) + (s2-0 (-> *editable* 0 current data s3-0)) + ) + (while (< s3-0 s4-0) + (when (and s2-0 (logtest? (-> s2-0 flags) (editable-flag selected))) + (let ((a0-7 (as-type s2-0 editable-light))) + (when (the-as editable-light a0-7) + (set! (-> (&+ (the-as (pointer float) a0-7) (/ arg0 8)) 0) arg2) + (logior! (-> (the-as editable-light a0-7) flags) (editable-flag changed)) + (when (= (-> (the-as editable-light a0-7) color w) -2.0) + (let ((a1-2 0) + (v1-17 0) + ) + (dotimes (a2-1 5) + (let ((f0-2 (-> (the-as editable-light a0-7) shadows a2-1))) + (when (!= f0-2 1.0) + (set! a1-2 (logior a1-2 (ash 1 a2-1))) + (set! v1-17 (logior v1-17 (ash (logand (the int (* 16.0 f0-2)) 15) (* a2-1 4)))) + ) + ) + ) + (set! (-> (the-as editable-light a0-7) direction x) + (the-as + float + (logior (logand (the-as uint (-> (the-as editable-light a0-7) direction x)) (the-as uint #xffffffff00ffffff)) + (shr (shl a1-2 56) 32) + ) + ) + ) + (set! (-> (the-as editable-light a0-7) direction x) + (the-as + float + (logior (logand (the-as int (-> (the-as editable-light a0-7) direction x)) -16777216) (shr (shl v1-17 40) 40)) + ) + ) + ) + ) + (let ((v1-21 (-> (the-as editable-light a0-7) region))) + (if v1-21 + (set! (-> v1-21 changed) #t) + ) + ) + (update-light-sphere-from-editable-light (the-as editable-light a0-7)) + ) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> *editable* 0 current data s3-0)) + ) + ) + (the-as float #f) + ) + (else + (let ((f30-0 arg3)) + (let* ((s5-1 (-> *editable* 0 current length)) + (s4-1 0) + (s3-1 (-> *editable* 0 current data s4-1)) + ) + (while (< s4-1 s5-1) + (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) + (let ((v1-35 (as-type s3-1 editable-light))) + (if (the-as editable-light v1-35) + (set! f30-0 (-> (&+ (the-as (pointer float) v1-35) (/ arg0 8)) 0)) + ) + ) + ) + (+! s4-1 1) + (set! s3-1 (-> *editable* 0 current data s4-1)) + ) + ) + f30-0 + ) + ) + ) + ) + +;; definition for function dm-cam-externalize2 +(defun dm-cam-externalize2 ((arg0 symbol) (arg1 debug-menu-msg)) + (when (= arg1 (debug-menu-msg press)) + (cond + ((= arg0 'reset) + (if (!= *external-cam-mode* 'locked) + (external-cam-reset!) + ) + ) + ((= arg0 'allow-z) + (set! *external-cam-options* (logxor *external-cam-options* (external-cam-option allow-z))) + ) + ((= *external-cam-mode* arg0) + (set! *external-cam-mode* #f) + ) + (else + (if (not *external-cam-mode*) + (external-cam-reset!) + ) + (set! *external-cam-mode* arg0) + ) + ) + ) + (if (= arg0 'allow-z) + (logtest? *external-cam-options* (external-cam-option allow-z)) + (= *external-cam-mode* arg0) + ) + ) + +;; definition for function dm-editable-boolean-toggle-pick-func +;; WARN: Return type mismatch float vs symbol. +(defun dm-editable-boolean-toggle-pick-func ((arg0 int) (arg1 debug-menu-msg)) + (the-as symbol (cond + (*editable* + (let ((v1-3 (&+ (the-as (pointer float) (-> *editable* 0)) (/ arg0 8)))) + (if (= arg1 (debug-menu-msg press)) + (set! (-> v1-3 0) (the-as float (not (-> v1-3 0)))) + ) + (-> v1-3 0) + ) + ) + (else + (the-as float #f) + ) + ) + ) + ) + +;; definition for function editable-menu-context-make-menus +(defun editable-menu-context-make-menus ((arg0 debug-menu-context)) + (debug-menu-make-from-template + arg0 + '(main-menu + "Editable" + (flag "Cam 1" pad-1 dm-cam-externalize2) + (flag "Left Handed" 216 dm-editable-boolean-toggle-pick-func) + (menu + "Insert" + (function "Sphere" 31 editable-menu-command) + (function "Point" 32 editable-menu-command) + (function "Sample" 33 editable-menu-command) + (function "Light" 35 editable-menu-command) + (function "Entity" 36 editable-menu-command) + (function "Face" 37 editable-menu-command) + (function "Plane" 38 editable-menu-command) + (function "Box" 39 editable-menu-command) + (function "Wall" 40 editable-menu-command) + (function "Edit-Plane Set" 51 editable-menu-command) + (function "Edit-Plane Clear" 52 editable-menu-command) + ) + (menu + "Select" + (function "None" 8 editable-menu-command) + (function "All" 7 editable-menu-command) + (function "Owner" 12 editable-menu-command) + (function "Current Region" 13 editable-menu-command) + (function "Current Face" 14 editable-menu-command) + (function "Current Prim" 15 editable-menu-command) + ) + (menu + "Selection" + (function "Copy" 42 editable-menu-command) + (function "Delete" 41 editable-menu-command) + (function "Flip Side" 48 editable-menu-command) + (function "Snap to Ground" 44 editable-menu-command) + (function "Snap XZ" 45 editable-menu-command) + (function "Snap Y" 46 editable-menu-command) + (function "Resize to Param" 43 editable-menu-command) + (function "Set to current Region" 49 editable-menu-command) + (function "Set to new Region" 50 editable-menu-command) + (flag "No Save" 2 dm-editable-flag-pick-func) + (flag "Top Set" 512 dm-editable-flag-pick-func) + (flag "Bot Set" 1024 dm-editable-flag-pick-func) + ) + (menu + "Region" + (function "Print Info" 59 editable-menu-command) + (function "Copy" 54 editable-menu-command) + (function "Delete" 53 editable-menu-command) + (function "Add to current Region" 55 editable-menu-command) + (flag + "Region Lock" + #f + ,(lambda ((arg0 object) (arg1 int)) + (if (= arg1 4) + (set! (-> *editable* 0 current region-lock?) (not (-> *editable* 0 current region-lock?))) + ) + (-> *editable* 0 current region-lock?) + ) + ) + (flag "Camera" camera dm-region-tree-pick-func) + (flag "Target" target dm-region-tree-pick-func) + (flag "Water" water dm-region-tree-pick-func) + (flag "Data" data dm-region-tree-pick-func) + (flag "City Vis" city_vis dm-region-tree-pick-func) + ) + (menu + "Filter" + (flag "None" 1 dm-editable-filter0-pick-func) + (flag "Unknown" 2 dm-editable-filter0-pick-func) + (flag "Sound" 4 dm-editable-filter0-pick-func) + (flag "Part" 8 dm-editable-filter0-pick-func) + (flag "Load" 64 dm-editable-filter0-pick-func) + (flag "User Setting" 16 dm-editable-filter0-pick-func) + (flag "Cam Setting" 32 dm-editable-filter0-pick-func) + (flag "Camera" 256 dm-editable-filter1-pick-func) + (flag "Target" 512 dm-editable-filter1-pick-func) + (flag "Water" 1024 dm-editable-filter1-pick-func) + (flag "Data" 2048 dm-editable-filter1-pick-func) + (flag "Sample" 8192 dm-editable-filter1-pick-func) + (flag "Light" 16384 dm-editable-filter1-pick-func) + (flag "Entity" 32768 dm-editable-filter1-pick-func) + (flag "City Vis" 4096 dm-editable-filter1-pick-func) + ) + (menu + "Light" + (flag "Show Light Names" 220 dm-editable-boolean-toggle-pick-func) + (float-var + "Red" + 60 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Green" + 64 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Blue" + 68 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + (new 'static 'bfloat :data 1.9921875) + 0 + ) + (float-var + "Palette Index" + 72 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 1.0) + #t + (new 'static 'bfloat :data -2.0) + (new 'static 'bfloat :data 7.0) + 0 + ) + (float-var "Decay Start" 76 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.00390625) #t 0 1 0) + (float-var + "Ambient Point Ratio" + 80 + dm-editable-light-float-func + 2 + (new 'static 'bfloat :data 0.00390625) + #t + 0 + 1 + 0 + ) + (float-var "Brightness" 84 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.00390625) #t 0 1 0) + (float-var "Shadow Ambi" 88 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + (float-var "Shadow Dir0" 92 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + (float-var "Shadow Dir1" 96 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + (float-var "Shadow Dir2" 100 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + (float-var "Shadow Dir3" 104 dm-editable-light-float-func 2 (new 'static 'bfloat :data 0.0625) #t 0 1 0) + ) + (float-var + "Param" + #f + ,(lambda ((arg0 object) (arg1 int) (arg2 float)) (cond + ((= arg1 4) + (if (and *editable* (nonzero? *editable*)) + (set! (-> *editable* 0 current edit-param0) arg2) + ) + ) + ((or (not *editable*) (zero? *editable*)) + 0 + ) + (else + (-> *editable* 0 current edit-param0) + ) + ) + ) + 3 + (new 'static 'bfloat :data 0.5) + #t + 0 + 500 + 1 + ) + (function "Rotate Level" 61 editable-menu-command) + (function "Trans Y Level" 62 editable-menu-command) + (function "Revert" 57 editable-menu-command) + (function "Save" 56 editable-menu-command-no-close) + (function "Update Game" 58 editable-menu-command-no-close) + (function "Cancel" 19 editable-menu-command) + (function "Exit" 1 editable-menu-command) + ) + ) + arg0 + ) + +;; failed to figure out what this is: +(editable-menu-context-make-menus *editable-menu-context*) + +;; definition for function insert-sample-camera +;; WARN: Return type mismatch int vs object. +(defun insert-sample-camera ((arg0 symbol)) + (cond + (level + (let ((s5-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" + arg0 + ) + (let ((s5-1 (s5-0 *temp-string*))) + (cond + ((and (= (-> s5-1 content-type) 'select) (= (-> s5-1 length) 4)) + (let ((f26-0 (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 0))))) + (f28-0 (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 1))))) + (f30-3 (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 2))))) + (s5-2 (string->int (the-as string (-> s5-1 sql-data 3)))) + (s3-0 (math-camera-pos)) + (s4-1 (clear *temp-string*)) + ) + (format + s4-1 + "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" + s5-2 + (* 0.00024414062 (- (-> s3-0 x) f26-0)) + (* 0.00024414062 (- (-> s3-0 y) f28-0)) + (* 0.00024414062 (- (-> s3-0 z) f30-3)) + ) + (let ((a2-2 (sql-query s4-1))) + (cond + ((= (-> a2-2 content-type) 'modify) + (format + (clear s4-1) + "update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D" + s5-2 + ) + (let ((a2-4 (sql-query s4-1))) + (when (!= (-> a2-4 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A~%" a2-4) + (return (the-as object #f)) + ) + ) + (sound-play-by-spec (static-sound-spec "beep" :group 0 :fo-curve 1) (new-sound-id) (the-as vector #t)) + (format #t "EDITABLE: saved camera sample point for level ~A~%" arg0) + ) + (else + (format 0 "ERROR: sql: insert error ~A~%" a2-2) + ) + ) + ) + ) + ) + (else + (format 0 "ERROR: sql: select error ~A~%" s5-1) + ) + ) + ) + ) + ) + (else + (format 0 "ERROR: EDITABLE: no current level~%") + ) + ) + 0 + ) + +;; definition for symbol *debug-hook*, type pair +(define *debug-hook* + (cons + (lambda () (when (and *debug-segment* *manual-sample-point*) + (when (cpad-pressed? 1 select) + (cond + (*editable* + #f + ) + ((not *artist-fix-visible*) + (insert-sample-camera (-> (level-get-target-inside *level*) info dbname)) + ) + (else + (let ((gp-1 0)) + (dotimes (s5-0 (-> *level* length)) + (let ((v1-14 (-> *level* level s5-0))) + (when (= (-> v1-14 status) 'active) + (when (!= (-> v1-14 bsp visible-list-length) 4) + (if (not (logtest? *fix-visible-level-mask* (ash 1 gp-1))) + (insert-sample-camera (-> v1-14 name)) + ) + (+! gp-1 1) + ) + ) + ) + ) + ) + #f + ) + ) + ) + ) + ) + *debug-hook* + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/debug/editable_REF.gc b/test/decompiler/reference/jak3/engine/debug/editable_REF.gc new file mode 100644 index 0000000000..435dde50af --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/editable_REF.gc @@ -0,0 +1,3432 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; definition for function common-owner +;; WARN: Return type mismatch symbol vs object. +(defun common-owner ((arg0 editable) (arg1 editable)) + (let* ((v1-0 (the-as object (-> arg0 owner))) + (a0-1 (-> (the-as pair v1-0) car)) + ) + (while (not (null? v1-0)) + (let* ((a2-0 (the-as object (-> arg1 owner))) + (a3-0 (-> (the-as pair a2-0) car)) + ) + (while (not (null? a2-0)) + (if (= a0-1 a3-0) + (return (the-as object #t)) + ) + (set! a2-0 (-> (the-as pair a2-0) cdr)) + (set! a3-0 (-> (the-as pair a2-0) car)) + ) + ) + (set! v1-0 (-> (the-as pair v1-0) cdr)) + (set! a0-1 (-> (the-as pair v1-0) car)) + ) + ) + #f + ) + +;; definition for method 0 of type editable-region +(defmethod new editable-region ((allocation symbol) (type-to-make type)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 changed) #t) + (set! (-> gp-0 locked) #f) + (let ((v1-12 (cond + ((and *editable* (-> *editable* 0 current level)) + (-> *editable* 0 current level) + ) + ((level-get-target-inside *level*) + (-> (level-get-target-inside *level*) info dbname) + ) + ) + ) + ) + (set! (-> gp-0 level) (the-as string v1-12)) + ) + (set! (-> gp-0 tree) 'camera) + (set! (-> gp-0 on-enter) #f) + (set! (-> gp-0 on-exit) #f) + (set! (-> gp-0 on-inside) #f) + (set! (-> gp-0 filter) (editable-region-method-12 gp-0)) + gp-0 + ) + ) + +;; definition for method 2 of type editable-region +(defmethod print ((this editable-region)) + (format #t "#<~A region-~D ~A ~A @ #x~X>" (-> this type) (-> this id) (-> this level) (-> this tree) this) + this + ) + +;; definition for method 10 of type editable-region +;; INFO: Used lq/sq +(defmethod editable-region-method-10 ((this editable-region) (arg0 int)) + (local-vars (sv-16 string) (sv-32 string)) + (when (nonzero? (-> this id)) + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "delete from region_sphere where region_id=~D" (-> this id)) + (let ((a2-1 (sql-query s5-0))) + (when (!= (-> a2-1 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 this) + (return #t) + ) + ) + (clear s5-0) + (format s5-0 "select region_face_id from region_face where region_id=~D" (-> this id)) + (let ((s3-0 (sql-query s5-0))) + (when (!= (-> s3-0 content-type) 'select) + (format 0 "ERROR: sql: face select error ~A for ~A~%" s3-0 this) + (return #t) + ) + (when (> (-> s3-0 length) 0) + (clear s5-0) + (format s5-0 "delete from region_point where region_face_id in (") + (dotimes (s2-0 (-> s3-0 length)) + (cond + ((zero? s2-0) + (let ((s1-0 format) + (s0-0 s5-0) + ) + (set! sv-16 "~D") + (let ((a2-4 (string->int (the-as string (-> s3-0 sql-data s2-0))))) + (s1-0 s0-0 sv-16 a2-4) + ) + ) + ) + (else + (let ((s1-1 format) + (s0-1 s5-0) + ) + (set! sv-32 ",~D") + (let ((a2-5 (string->int (the-as string (-> s3-0 sql-data s2-0))))) + (s1-1 s0-1 sv-32 a2-5) + ) + ) + ) + ) + ) + (format s5-0 ")") + (let ((a2-6 (sql-query s5-0))) + (when (!= (-> a2-6 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-6 this) + (return #t) + ) + ) + ) + ) + (clear s5-0) + (format s5-0 "delete from region_face where region_id=~D" (-> this id)) + (let ((a2-8 (sql-query s5-0))) + (when (!= (-> a2-8 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-8 this) + (return #t) + ) + ) + (when (zero? arg0) + (clear s5-0) + (format s5-0 "delete from region where region_id=~D" (-> this id)) + (let ((a2-10 (sql-query s5-0))) + (when (!= (-> a2-10 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-10 this) + (return #t) + ) + ) + ) + ) + ) + #f + ) + +;; definition for method 9 of type editable-region +(defmethod save-region! ((this editable-region) (arg0 editable-array) (arg1 int) (arg2 int)) + (local-vars (v0-0 symbol)) + (set! v0-0 + (when (-> this changed) + (format 0 "NOTICE: saving ~A~%" this) + (let ((s5-0 *collapse-quote*)) + (set! *collapse-quote* #f) + (case (-> this tree) + (('entity) + (let* ((s3-0 (-> arg0 length)) + (s2-0 0) + (s1-0 (-> arg0 data s2-0)) + ) + (while (< s2-0 s3-0) + (when (and s1-0 (= (-> s1-0 region) this) (not (logtest? (-> s1-0 flags) (editable-flag no-save)))) + (when (not (editable-method-24 s1-0 arg0 1 0)) + (format 0 "ERROR: sql: insert error for ~A~%" s1-0) + (return #f) + ) + ) + (+! s2-0 1) + (set! s1-0 (-> arg0 data s2-0)) + ) + ) + ) + (('light) + (let* ((s3-1 (-> arg0 length)) + (s2-1 0) + (s1-1 (-> arg0 data s2-1)) + ) + (while (< s2-1 s3-1) + (when (and s1-1 (= (-> s1-1 region) this) (not (logtest? (-> s1-1 flags) (editable-flag no-save)))) + (when (not (editable-method-24 s1-1 arg0 1 0)) + (format 0 "ERROR: sql: insert error for ~A~%" s1-1) + (return #f) + ) + ) + (+! s2-1 1) + (set! s1-1 (-> arg0 data s2-1)) + ) + ) + ) + (('sample) + (let ((s3-2 (clear *temp-string*))) + (format s3-2 "delete from sample_point where level_info_id=~D and source='manual'" (-> arg0 level-info-id)) + (let ((a2-7 (sql-query s3-2))) + (when (!= (-> a2-7 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-7 this) + (return #t) + ) + ) + (format + (clear s3-2) + "update level_info set last_update=last_update, sample_point_update=NULL where level_info_id=~D" + (-> arg0 level-info-id) + ) + (let ((a2-9 (sql-query s3-2))) + (when (!= (-> a2-9 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-9 this) + (return #t) + ) + ) + ) + (let* ((s3-3 (-> arg0 length)) + (s2-3 0) + (s1-2 (-> arg0 data s2-3)) + ) + (while (< s2-3 s3-3) + (when (and s1-2 (= (-> s1-2 region) this) (not (logtest? (-> s1-2 flags) (editable-flag no-save)))) + (when (not (editable-method-24 s1-2 arg0 1 0)) + (format 0 "ERROR: sql: insert error for ~A~%" s1-2) + (return #f) + ) + ) + (+! s2-3 1) + (set! s1-2 (-> arg0 data s2-3)) + ) + ) + ) + (else + (cond + ((zero? (-> this id)) + (let ((s3-4 (clear *temp-string*))) + (format s3-4 "insert into region set level_name='~S',tree='~S'" (-> this level) (-> this tree)) + (let ((a2-13 (-> this on-enter))) + (if a2-13 + (format s3-4 ",on_enter='~S'" a2-13) + (format s3-4 ",on_enter=''") + ) + ) + (let ((a2-14 (-> this on-exit))) + (if a2-14 + (format s3-4 ",on_exit='~S'" a2-14) + (format s3-4 ",on_exit=''") + ) + ) + (let ((a2-15 (-> this on-inside))) + (if a2-15 + (format s3-4 ",on_inside='~S'" a2-15) + (format s3-4 ",on_inside=''") + ) + ) + (let ((s3-5 (sql-query s3-4))) + (when (= (-> s3-5 content-type) 'modify) + (let ((v1-64 (sql-query "select LAST_INSERT_ID()"))) + (when (= (-> v1-64 content-type) 'select) + (set! (-> this id) (the-as uint (string->int (the-as string (-> v1-64 sql-data 0))))) + (goto cfg-77) + ) + ) + ) + (format 0 "ERROR: sql: insert error ~A for ~A~%" s3-5 this) + ) + ) + (set! v0-0 #f) + (b! #t cfg-91 :delay (nop!)) + (the-as none 0) + ) + (else + (let ((s3-6 (clear *temp-string*))) + (format s3-6 "update region set level_name='~S',tree='~S'" (-> this level) (-> this tree)) + (let ((a2-18 (-> this on-enter))) + (if a2-18 + (format s3-6 ",on_enter='~S'" a2-18) + (format s3-6 ",on_enter=NULL") + ) + ) + (let ((a2-19 (-> this on-exit))) + (if a2-19 + (format s3-6 ",on_exit='~S'" a2-19) + (format s3-6 ",on_exit=NULL") + ) + ) + (let ((a2-20 (-> this on-inside))) + (if a2-20 + (format s3-6 ",on_inside='~S'" a2-20) + (format s3-6 ",on_inside=NULL") + ) + ) + (format s3-6 " where region_id=~D" (-> this id)) + (let ((a2-22 (sql-query s3-6))) + (when (!= (-> a2-22 content-type) 'modify) + (format 0 "ERROR: sql: update error ~A for ~A~%" a2-22 this) + (return #f) + ) + ) + ) + ) + ) + (label cfg-77) + (editable-region-method-10 this 1) + (let* ((s3-7 (-> arg0 length)) + (s2-4 0) + (s1-3 (-> arg0 data s2-4)) + ) + (while (< s2-4 s3-7) + (when (and s1-3 (= (-> s1-3 region) this) (not (logtest? (-> s1-3 flags) (editable-flag no-save)))) + (when (not (editable-method-24 s1-3 arg0 1 0)) + (format 0 "ERROR: sql: insert error for ~A~%" s1-3) + (return #f) + ) + ) + (+! s2-4 1) + (set! s1-3 (-> arg0 data s2-4)) + ) + ) + ) + ) + (set! (-> this changed) #f) + (set! v0-0 #t) + (set! *collapse-quote* s5-0) + ) + v0-0 + ) + ) + (label cfg-91) + v0-0 + ) + +;; definition for method 11 of type editable-region +;; WARN: Return type mismatch int vs none. +(defmethod print-region-info ((this editable-region) (arg0 vector) (arg1 int)) + (local-vars (sv-32 vector2h)) + (set! sv-32 (new 'stack 'vector2h)) + (add-debug-x #t (bucket-id debug-no-zbuf1) arg0 (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80))) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 577) + ) + (format (clear *temp-string*) "region-~D~%" (-> this id)) + (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + (when (>= arg1 1) + (let ((s4-1 (-> this on-enter))) + (when s4-1 + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 577) + ) + (format (clear *temp-string*) "(on-enter ~S)" s4-1) + (s3-1 s2-1 (the-as bucket-id s1-1) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((s4-2 (-> this on-inside))) + (when s4-2 + (let ((s3-2 add-debug-text-3d) + (s2-2 #t) + (s1-2 577) + ) + (format (clear *temp-string*) "(on-inside ~S)" s4-2) + (s3-2 s2-2 (the-as bucket-id s1-2) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((s5-1 (-> this on-exit))) + (when s5-1 + (let ((s4-3 add-debug-text-3d) + (s3-3 #t) + (s2-3 577) + ) + (format (clear *temp-string*) "(on-exit ~S)" s5-1) + (s4-3 s3-3 (the-as bucket-id s2-3) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type editable-region +;; WARN: Return type mismatch int vs editable-filter. +(defmethod editable-region-method-12 ((this editable-region)) + (let* ((s5-0 0) + (s4-0 + (lambda ((arg0 object)) + (let ((filter-type (editable-filter))) + (when (not (type? arg0 string)) + (format (clear *temp-string*) "~A" arg0) + (set! arg0 *temp-string*) + ) + (if (>= (string-position "(sound-play" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter sound)))) + ) + (if (>= (string-position "(part-tracker" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter part)))) + ) + (if (>= (string-position "(want-" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter load)))) + ) + (if (>= (string-position "(setting-" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter user-setting)))) + ) + (if (>= (string-position "(water" (the-as string arg0)) 0) + (set! filter-type (the-as editable-filter (logior (the-as int filter-type) (editable-filter water-command)))) + ) + (the-as editable-filter filter-type) + ) + ) + ) + (filter + (logior (logior (logior (the-as editable-filter s5-0) (s4-0 (-> this on-inside))) (s4-0 (-> this on-enter))) + (s4-0 (-> this on-exit)) + ) + ) + ) + (when (zero? filter) + (if (and (not (-> this on-inside)) (not (-> this on-enter)) (not (-> this on-exit))) + (set! filter (editable-filter none)) + (set! filter (editable-filter unknown)) + ) + ) + (case (-> this tree) + (('target) + (set! filter (the-as editable-filter (logior (the-as int filter) (editable-filter target)))) + ) + (('camera) + (set! filter (the-as editable-filter (logior (the-as int filter) (editable-filter camera)))) + ) + (('data) + (set! filter (the-as editable-filter (logior (the-as int filter) (editable-filter data)))) + ) + (('water) + (set! filter (the-as editable-filter (logior (the-as int filter) (editable-filter water)))) + ) + (('city_vis) + (set! filter (editable-filter city_vis)) + ) + (('sample) + (set! filter (editable-filter sample)) + ) + (('light) + (set! filter (editable-filter light)) + ) + (('sound) + (set! filter (editable-filter sound)) + ) + (('entity) + (set! filter (editable-filter entity)) + ) + ) + (the-as editable-filter filter) + ) + ) + +;; definition for method 25 of type editable +(defmethod editable-method-25 ((this editable)) + #t + ) + +;; definition for method 30 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-30 ((this editable) (arg0 editable-flag)) + (let* ((s5-0 (the-as object (-> this owner))) + (a0-1 (-> (the-as pair s5-0) car)) + ) + (while (not (null? s5-0)) + (editable-method-30 (the-as editable a0-1) arg0) + (set! s5-0 (-> (the-as pair s5-0) cdr)) + (set! a0-1 (-> (the-as pair s5-0) car)) + ) + ) + 0 + (none) + ) + +;; definition for method 31 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-31 ((this editable) (arg0 editable-flag)) + (let* ((s5-0 (the-as object (-> this owner))) + (a0-1 (-> (the-as pair s5-0) car)) + ) + (while (not (null? s5-0)) + (editable-method-31 (the-as editable a0-1) arg0) + (set! s5-0 (-> (the-as pair s5-0) cdr)) + (set! a0-1 (-> (the-as pair s5-0) car)) + ) + ) + 0 + (none) + ) + +;; definition for method 23 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod change-region! ((this editable) (arg0 editable-region)) + (when (not (and (-> this region) (-> this region locked))) + (if arg0 + (set! (-> arg0 changed) #t) + ) + (if (-> this region) + (set! (-> this region changed) #t) + ) + (logior! (-> this flags) (editable-flag changed)) + (set! (-> this region) arg0) + ) + 0 + (none) + ) + +;; definition for method 9 of type editable +;; WARN: Return type mismatch int vs rgba. +(defmethod get-color ((this editable)) + (the-as rgba (cond + ((and (logtest? (-> this flags) (editable-flag selected)) + (< (mod (-> *display* real-clock frame-counter) 60) 30) + ) + (the-as int (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + ) + ((logtest? (-> this flags) (editable-flag no-save)) + (shl #x80ff 16) + ) + ((= (-> this type) editable-point) + (the-as int (new 'static 'rgba :r #xff :g #x80 :a #x80)) + ) + ((= (-> this type) editable-sample) + (the-as int (new 'static 'rgba :g #x80 :b #xff :a #x80)) + ) + ((= (-> this type) editable-light) + (if (= (-> (the-as editable-light this) color w) -2.0) + (the-as int (new 'static 'rgba :r #xff :b #xff :a #x80)) + (the-as int (new 'static 'rgba :r #x80 :b #xff :a #x80)) + ) + ) + ((= (-> this type) editable-entity) + (the-as int (new 'static 'rgba :r #xff :b #xff :a #x80)) + ) + (else + (the-as int (new 'static 'rgba :r #xff :a #x80)) + ) + ) + ) + ) + +;; definition for method 10 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-10 ((this editable)) + (when (logtest? (-> this flags) (editable-flag selected)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (when (editable-method-11 this s5-0) + (set! (-> s5-0 y) (-> s5-0 y)) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + s5-0 + (the-as rgba (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + ) + ) + ) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 this) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod set-selected! ((this editable) (arg0 symbol)) + (case arg0 + (('toggle) + (logxor! (-> this flags) (editable-flag selected)) + ) + ((#f) + (logclear! (-> this flags) (editable-flag selected)) + ) + (else + (logior! (-> this flags) (editable-flag selected)) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type editable +(defmethod editable-method-13 ((this editable) (arg0 vector)) + -1.0 + ) + +;; definition for method 14 of type editable +(defmethod editable-method-14 ((this editable) (arg0 vector) (arg1 vector)) + -1.0 + ) + +;; definition for method 22 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-22 ((this editable) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (local-vars (sv-48 vector) (sv-52 vector)) + (set! sv-48 (new 'stack-no-clear 'vector)) + (set! sv-52 (new 'stack-no-clear 'vector)) + (let ((s4-0 (editable-method-15 this))) + (reverse-transform-point! sv-48 s4-0 arg2 arg0) + (reverse-transform-point! sv-52 s4-0 arg2 arg1) + (vector-! arg3 sv-52 sv-48) + (vector-! (new 'stack-no-clear 'vector) s4-0 (-> *math-camera* trans)) + ) + (if (< 20480.0 (vector-length arg3)) + (vector-normalize! arg3 20480.0) + ) + (editable-method-17 this arg3 (editable-flag x y z)) + 0 + (none) + ) + +;; definition for method 11 of type editable +;; INFO: Used lq/sq +(defmethod editable-method-11 ((this editable) (arg0 vector)) + (with-pp + (let ((s5-0 (new 'stack 'collide-query))) + (vector-copy! (-> s5-0 start-pos) (editable-method-15 this)) + (set-vector! (-> s5-0 move-dist) 0.0 -204800.0 0.0 1.0) + (let ((v1-5 s5-0)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) + (collide-spec backgnd crate obstacle hit-by-player-list hit-by-others-list collectable pusher) + ) + (set! (-> v1-5 ignore-process0) pp) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) + (vector-copy! arg0 (-> s5-0 best-other-tri intersect)) + (set! (-> arg0 w) 1.0) + #t + ) + ) + ) + ) + +;; definition for method 26 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-26 ((this editable)) + 0 + (none) + ) + +;; definition for method 19 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-19 ((this editable) (arg0 vector)) + 0 + (none) + ) + +;; definition for method 24 of type editable +(defmethod editable-method-24 ((this editable) (arg0 editable-array) (arg1 int) (arg2 int)) + #t + ) + +;; definition for method 17 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 ((this editable) (arg0 vector) (arg1 editable-flag)) + 0 + (none) + ) + +;; definition for method 18 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-18 ((this editable) (arg0 vector) (arg1 int)) + 0 + (none) + ) + +;; definition for method 20 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-20 ((this editable) (arg0 vector) (arg1 matrix)) + 0 + (none) + ) + +;; definition for method 15 of type editable +(defmethod editable-method-15 ((this editable)) + *null-vector* + ) + +;; definition for method 16 of type editable +(defmethod editable-method-16 ((this editable)) + 0.0 + ) + +;; definition for method 21 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-21 ((this editable) (arg0 vector)) + 0 + (none) + ) + +;; definition for method 35 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-35 ((this editable) (arg0 vector)) + 0 + (none) + ) + +;; definition for method 28 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-28 ((this editable) (arg0 editable) (arg1 editable)) + 0 + (none) + ) + +;; definition for method 27 of type editable +;; WARN: Return type mismatch int vs none. +(defmethod delete! ((this editable) (arg0 editable)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (let* ((s4-0 (the-as object (-> this owner))) + (a0-3 (-> (the-as pair s4-0) car)) + ) + (while (not (null? s4-0)) + (editable-method-28 (the-as editable a0-3) this arg0) + (set! s4-0 (-> (the-as pair s4-0) cdr)) + (set! a0-3 (-> (the-as pair s4-0) car)) + ) + ) + 0 + (none) + ) + +;; definition for method 29 of type editable +(defmethod copy-into-editable-array! ((this editable) (arg0 editable-array)) + (local-vars (s4-0 editable)) + (let ((v1-0 0)) + (while (< v1-0 (-> arg0 selection length)) + (when (= this (-> arg0 selection v1-0)) + (set! s4-0 (-> arg0 selection (+ v1-0 1))) + (goto cfg-10) + ) + (+! v1-0 2) + ) + ) + (let ((s3-0 (get-length arg0))) + (set! s4-0 (when (>= s3-0 0) + (set! s4-0 (copy this 'debug)) + (let ((v1-9 (-> arg0 region))) + (if v1-9 + (set! (-> s4-0 region) v1-9) + ) + ) + (set! (-> s4-0 region changed) #t) + (logior! (-> this flags) (editable-flag changed)) + (set! (-> s4-0 id) (the-as uint 0)) + (set! (-> s4-0 owner) '()) + (set-selected! s4-0 #f) + (set! (-> s4-0 prefix) (new 'debug 'string 32 (the-as string (-> this prefix)))) + (let ((s2-0 (new 'debug 'string 32 (the-as string #f)))) + (format s2-0 "~s-~d" (-> this prefix) *editable-temp-id*) + (set! (-> s4-0 name) s2-0) + ) + (set! *editable-temp-id* (+ *editable-temp-id* 1)) + (set! (-> arg0 data s3-0) s4-0) + (set! (-> arg0 selection (-> arg0 selection length)) this) + (set! (-> arg0 selection (+ (-> arg0 selection length) 1)) s4-0) + (+! (-> arg0 selection length) 2) + s4-0 + ) + ) + ) + (label cfg-10) + s4-0 + ) + +;; definition for method 32 of type editable +(defmethod get-null-vec ((this editable)) + *null-vector* + ) + +;; definition for method 33 of type editable +(defmethod get-null-vec2 ((this editable) (arg0 vector)) + *null-vector* + ) + +;; definition for method 34 of type editable +(defmethod get-level-offset ((this editable) (arg0 editable-array)) + (local-vars (sv-16 sql-result)) + (when (!= (-> this region level) (-> arg0 level)) + (let ((gp-0 (new 'static 'vector))) + (let ((s3-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z from level_info where name='~S'" + (-> this region level) + ) + (set! sv-16 (s3-0 *temp-string*)) + ) + (when (= (-> sv-16 content-type) 'select) + (set-vector! + gp-0 + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) + 1.0 + ) + (return gp-0) + ) + ) + ) + (-> arg0 level-offset) + ) + +;; definition for method 2 of type editable-point +(defmethod print ((this editable-point)) + (format + #t + "#<~A~S~m ~m ~m :r ~m" + (-> this type) + (if (logtest? (-> this flags) (editable-flag changed)) + " (m)" + "" + ) + (-> this trans x) + (-> this trans y) + (-> this trans z) + (-> this radius) + ) + (format #t " @ #x~X>" this) + this + ) + +;; definition for method 30 of type editable-point +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 30 editable-point) has a return type of none, but the expression builder found a return statement. +(defmethod editable-method-30 ((this editable-point) (arg0 editable-flag)) + (if (logtest? arg0 (editable-flag no-update)) + (return #f) + ) + (let ((s4-0 (-> *editable* 0 current))) + (cond + ((logtest? (-> this flags) (editable-flag top-set)) + (let* ((s3-0 (-> s4-0 length)) + (s2-0 0) + (s1-0 (-> s4-0 data s2-0)) + ) + (while (< s2-0 s3-0) + (if (and s1-0 + (= (-> s1-0 region) (-> this region)) + (common-owner s1-0 this) + (logtest? (-> s1-0 flags) (editable-flag top-set)) + ) + (editable-method-18 s1-0 (-> this trans) 144) + ) + (+! s2-0 1) + (set! s1-0 (-> s4-0 data s2-0)) + ) + ) + ) + ((logtest? (-> this flags) (editable-flag bot-set)) + (let* ((s3-1 (-> s4-0 length)) + (s2-1 0) + (s1-1 (-> s4-0 data s2-1)) + ) + (while (< s2-1 s3-1) + (if (and s1-1 + (= (-> s1-1 region) (-> this region)) + (common-owner s1-1 this) + (logtest? (-> s1-1 flags) (editable-flag bot-set)) + ) + (editable-method-18 s1-1 (-> this trans) 144) + ) + (+! s2-1 1) + (set! s1-1 (-> s4-0 data s2-1)) + ) + ) + ) + ) + ) + (call-parent-method this arg0) + 0 + (none) + ) + +;; definition for method 17 of type editable-point +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 ((this editable-point) (arg0 vector) (arg1 editable-flag)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (vector+! (-> this trans) (-> this trans) arg0) + (editable-method-30 this arg1) + 0 + (none) + ) + +;; definition for method 18 of type editable-point +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-18 ((this editable-point) (arg0 vector) (arg1 int)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (if (logtest? arg1 8) + (set! (-> this trans x) (-> arg0 x)) + ) + (if (logtest? arg1 16) + (set! (-> this trans y) (-> arg0 y)) + ) + (if (logtest? arg1 32) + (set! (-> this trans z) (-> arg0 z)) + ) + (editable-method-30 this (the-as editable-flag arg1)) + 0 + (none) + ) + +;; definition for method 15 of type editable-point +(defmethod editable-method-15 ((this editable-point)) + (-> this trans) + ) + +;; definition for method 20 of type editable-point +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-20 ((this editable-point) (arg0 vector) (arg1 matrix)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this trans) arg0))) + (vector-matrix*! s4-1 s4-1 arg1) + (vector+! (-> this trans) s4-1 arg0) + ) + 0 + (none) + ) + +;; definition for method 10 of type editable-point +(defmethod editable-method-10 ((this editable-point)) + (let* ((f0-1 (- (vector-vector-distance (math-camera-pos) (-> this trans)) (-> this radius))) + (s2-0 (cond + ((logtest? (-> this flags) (editable-flag selected)) + 6 + ) + ((>= f0-1 983040.0) + 3 + ) + ((>= f0-1 491520.0) + 4 + ) + ((>= f0-1 245760.0) + 5 + ) + (else + 6 + ) + ) + ) + ) + (add-debug-sphere-from-table (bucket-id debug) (-> this trans) (-> this radius) (get-color this) s2-0) + ) + ((method-of-type editable editable-method-10) this) + (none) + ) + +;; definition for method 13 of type editable-point +;; INFO: Used lq/sq +(defmethod editable-method-13 ((this editable-point) (arg0 vector)) + (let ((a0-1 (new 'stack-no-clear 'sphere)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 quad) (-> this trans quad)) + (set! (-> a0-1 r) (-> this radius)) + (when (sphere-in-view-frustum? a0-1) + (reverse-transform-point! s5-0 (-> this trans) (-> *math-camera* inv-camera-rot fvec) arg0) + (let ((f0-1 (vector-vector-distance (editable-method-15 this) s5-0))) + (if (>= (-> this radius) f0-1) + (return f0-1) + ) + ) + ) + ) + -1.0 + ) + +;; definition for method 14 of type editable-point +;; INFO: Used lq/sq +(defmethod editable-method-14 ((this editable-point) (arg0 vector) (arg1 vector)) + (let ((a0-1 (new 'stack-no-clear 'sphere))) + (new 'stack-no-clear 'vector) + (set! (-> a0-1 quad) (-> this trans quad)) + (set! (-> a0-1 r) (-> this radius)) + (when (sphere-in-view-frustum? a0-1) + (new 'stack-no-clear 'vector) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-copy! s4-0 (-> *math-camera* inv-camera-rot fvec)) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (v1-7 4) + (set! (-> s5-0 v1-7 quad) (the-as uint128 0)) + ) + (let ((t9-1 reverse-transform-point!) + (a0-4 (-> s5-0 0)) + (a1-3 (-> this trans)) + (a2-1 s4-0) + (a3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-0 x) (-> arg0 x)) + (set! (-> a3-0 y) (-> arg0 y)) + (set! (-> a3-0 z) 0.0) + (set! (-> a3-0 w) 1.0) + (t9-1 a0-4 a1-3 a2-1 a3-0) + ) + (let ((t9-2 reverse-transform-point!) + (a0-5 (-> s5-0 1)) + (a1-4 (-> this trans)) + (a2-2 s4-0) + (a3-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-1 x) (-> arg1 x)) + (set! (-> a3-1 y) (-> arg0 y)) + (set! (-> a3-1 z) 0.0) + (set! (-> a3-1 w) 1.0) + (t9-2 a0-5 a1-4 a2-2 a3-1) + ) + (let ((t9-3 reverse-transform-point!) + (a0-6 (-> s5-0 2)) + (a1-5 (-> this trans)) + (a2-3 s4-0) + (a3-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-2 x) (-> arg1 x)) + (set! (-> a3-2 y) (-> arg1 y)) + (set! (-> a3-2 z) 0.0) + (set! (-> a3-2 w) 1.0) + (t9-3 a0-6 a1-5 a2-3 a3-2) + ) + (let ((t9-4 reverse-transform-point!) + (a0-7 (-> s5-0 3)) + (a1-6 (-> this trans)) + (a2-4 s4-0) + (a3-3 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-3 x) (-> arg0 x)) + (set! (-> a3-3 y) (-> arg1 y)) + (set! (-> a3-3 z) 0.0) + (set! (-> a3-3 w) 1.0) + (t9-4 a0-7 a1-6 a2-4 a3-3) + ) + (dotimes (s3-1 4) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (transform-point-vector! s2-1 (-> s5-0 s3-1)) + (if (< (-> s2-1 z) 0.0) + (return -1.0) + ) + ) + ) + (let ((s3-2 0)) + (dotimes (s2-2 4) + (let ((s1-1 (vector-cross! (new 'stack-no-clear 'vector) s4-0 (vector-! + (new 'stack-no-clear 'vector) + (-> s5-0 (if (= s2-2 3) + 0 + (+ s2-2 1) + ) + ) + (-> s5-0 s2-2) + ) + ) + ) + ) + (vector-normalize! s1-1 1.0) + (let ((f0-19 (vector-dot s1-1 (vector-! (new 'stack-no-clear 'vector) (-> this trans) (-> s5-0 s2-2))))) + (if (< f0-19 (- (-> this radius))) + (return -1.0) + ) + (if (< 0.0 f0-19) + (+! s3-2 1) + ) + ) + ) + ) + (if (= s3-2 4) + (return 1.0) + ) + ) + (dotimes (s4-1 4) + (let ((a3-4 (new 'stack-no-clear 'vector))) + (if (< (vector-segment-distance-point! + (-> this trans) + (-> s5-0 (if (= s4-1 3) + 0 + (+ s4-1 1) + ) + ) + (-> s5-0 s4-1) + a3-4 + ) + (-> this radius) + ) + (return 1.0) + ) + ) + ) + ) + ) + ) + ) + -1.0 + ) + +;; definition for method 21 of type editable-point +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-21 ((this editable-point) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)))) + (vector-normalize! s4-1 (-> this radius)) + (vector-! (-> this trans) arg0 s4-1) + ) + (editable-method-30 this (editable-flag no-plane-snap)) + 0 + (none) + ) + +;; definition for method 24 of type editable-point +(defmethod editable-method-24 ((this editable-point) (arg0 editable-array) (arg1 int) (arg2 int)) + (case arg1 + ((2) + (let ((s3-0 (get-level-offset this arg0)) + (s4-0 (clear *temp-string*)) + ) + (format + s4-0 + "insert into region_point set region_face_id=LAST_INSERT_ID(),idx=~D,x=~f,y=~f,z=~f" + arg2 + (- (-> this trans x) (-> s3-0 x)) + (- (-> this trans y) (-> s3-0 y)) + (- (-> this trans z) (-> s3-0 z)) + ) + (let ((a0-6 (sql-query s4-0))) + (when (= (-> a0-6 content-type) 'modify) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +;; definition for method 19 of type editable-sphere +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-19 ((this editable-sphere) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> this radius) (-> arg0 x)) + (set! (-> this radius) (-> arg0 y)) + ) + (if (< (-> this radius) 0.0) + (set! (-> this radius) 0.0) + ) + (editable-method-30 this (editable-flag no-plane-snap)) + 0 + (none) + ) + +;; definition for method 16 of type editable-sphere +;; WARN: Return type mismatch meters vs float. +(defmethod editable-method-16 ((this editable-sphere)) + (the-as float (-> this radius)) + ) + +;; definition for method 24 of type editable-sphere +(defmethod editable-method-24 ((this editable-sphere) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (get-level-offset this arg0)) + (s5-0 (clear *temp-string*)) + ) + (format + s5-0 + "insert into region_sphere set region_id=~D,x=~f,y=~f,z=~f,r=~f" + (-> this region id) + (- (-> this trans x) (-> s4-0 x)) + (- (-> this trans y) (-> s4-0 y)) + (- (-> this trans z) (-> s4-0 z)) + (-> this radius) + ) + (= (-> (sql-query s5-0) content-type) 'modify) + ) + ) + +;; definition for method 24 of type editable-sample +(defmethod editable-method-24 ((this editable-sample) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s5-0 (clear *temp-string*))) + (format + s5-0 + "insert into sample_point set level_info_id=~D,x=~f,y=~f,z=~f,source='manual'" + (-> arg0 level-info-id) + (* 0.00024414062 (- (-> this trans x) (-> arg0 level-offset x))) + (* 0.00024414062 (- (-> this trans y) (-> arg0 level-offset y))) + (* 0.00024414062 (- (-> this trans z) (-> arg0 level-offset z))) + ) + (let ((a0-4 (sql-query s5-0))) + (when (= (-> a0-4 content-type) 'modify) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + ) + ) + ) + +;; definition for method 2 of type editable-light +(defmethod print ((this editable-light)) + (format + #t + "#<~A~S ~S ~m ~m ~m" + (-> this type) + (if (logtest? (-> this flags) (editable-flag changed)) + " (m)" + "" + ) + (-> this name) + (-> this trans x) + (-> this trans y) + (-> this trans z) + ) + (format #t " :r ~m @ #x~X>" (-> this radius) this) + this + ) + +;; definition for method 25 of type editable-light +;; INFO: Used lq/sq +(defmethod editable-method-25 ((this editable-light)) + (let ((v1-0 *light-hash*)) + (let* ((a2-0 (-> v1-0 num-lights)) + (a1-1 (-> v1-0 light-sphere-array a2-0)) + ) + (set! (-> a1-1 name) (-> this name)) + (set! (-> a1-1 decay-start) (-> this decay-start)) + (set! (-> a1-1 ambient-point-ratio) (-> this ambient-point-ratio)) + (set! (-> a1-1 brightness) (-> this brightness)) + (vector-copy! (-> a1-1 bsphere) (-> this trans)) + (set! (-> a1-1 bsphere w) (-> this radius)) + (when (= (-> this color w) -2.0) + (let ((a3-2 0) + (a2-6 0) + ) + (let ((t0-0 (-> this shadows))) + (dotimes (t1-0 5) + (when (!= (-> t0-0 t1-0) 1.0) + (set! a3-2 (logior a3-2 (ash 1 t1-0))) + (set! a2-6 (logior a2-6 (ash (logand (the int (* 16.0 (-> t0-0 t1-0))) 15) (* t1-0 4)))) + ) + ) + ) + (set! (-> this direction x) + (the-as + float + (logior (logand (the-as uint (-> this direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a3-2 56) 32)) + ) + ) + (set! (-> this direction x) + (the-as float (logior (logand (the-as int (-> this direction x)) -16777216) (shr (shl a2-6 40) 40))) + ) + ) + ) + (set! (-> (the-as vector (&-> a1-1 shadow)) quad) (-> this direction quad)) + (vector-copy! (-> a1-1 color) (-> this color)) + (set! (-> a1-1 palette-index) (the int (-> this color w))) + ) + (+! (-> v1-0 num-lights) 1) + ) + #t + ) + +;; definition for function update-light-sphere-from-editable-light +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs object. +(defun update-light-sphere-from-editable-light ((arg0 editable-light)) + (let ((v1-0 (lookup-light-sphere-by-name (-> arg0 name) *light-hash*))) + (when v1-0 + (set! (-> v1-0 name) (-> arg0 name)) + (set! (-> v1-0 decay-start) (-> arg0 decay-start)) + (set! (-> v1-0 ambient-point-ratio) (-> arg0 ambient-point-ratio)) + (set! (-> v1-0 brightness) (-> arg0 brightness)) + (vector-copy! (-> v1-0 bsphere) (-> arg0 trans)) + (set! (-> v1-0 bsphere w) (-> arg0 radius)) + (when (= (-> arg0 color w) -2.0) + (let ((a1-3 0) + (a0-6 0) + ) + (let ((a2-0 (-> arg0 shadows))) + (dotimes (a3-0 5) + (when (!= (-> a2-0 a3-0) 1.0) + (set! a1-3 (logior a1-3 (ash 1 a3-0))) + (set! a0-6 (logior a0-6 (ash (logand (the int (* 16.0 (-> a2-0 a3-0))) 15) (* a3-0 4)))) + ) + ) + ) + (set! (-> arg0 direction x) + (the-as + float + (logior (logand (the-as uint (-> arg0 direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a1-3 56) 32)) + ) + ) + (set! (-> arg0 direction x) + (the-as float (logior (logand (the-as int (-> arg0 direction x)) -16777216) (shr (shl a0-6 40) 40))) + ) + ) + ) + (set! (-> (the-as vector (&-> v1-0 shadow)) quad) (-> arg0 direction quad)) + (vector-copy! (-> v1-0 color) (-> arg0 color)) + (let ((v0-1 (the int (-> arg0 color w)))) + (set! (-> v1-0 palette-index) v0-1) + v0-1 + ) + ) + ) + ) + +;; definition for method 19 of type editable-light +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-19 ((this editable-light) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> this radius) (-> arg0 x)) + (set! (-> this radius) (-> arg0 y)) + ) + (if (< (-> this radius) 0.0) + (set! (-> this radius) 0.0) + ) + (update-light-sphere-from-editable-light this) + (editable-method-30 this (editable-flag no-plane-snap)) + 0 + (none) + ) + +;; definition for method 17 of type editable-light +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-17 ((this editable-light) (arg0 vector) (arg1 editable-flag)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (vector+! (-> this trans) (-> this trans) arg0) + (update-light-sphere-from-editable-light this) + (editable-method-30 this arg1) + 0 + (none) + ) + +;; definition for method 27 of type editable-light +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 27 editable-light) has a return type of none, but the expression builder found a return statement. +(defmethod delete! ((this editable-light) (arg0 editable)) + (call-parent-method this arg0) + (when (nonzero? (-> this id)) + (let ((s5-1 (clear *temp-string*))) + (format s5-1 "delete from light where light_id=~D" (-> this id)) + (let ((a2-1 (sql-query s5-1))) + (when (!= (-> a2-1 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 this) + (return 0) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 24 of type editable-light +(defmethod editable-method-24 ((this editable-light) (arg0 editable-array) (arg1 int) (arg2 int)) + (cond + ((logtest? (-> this flags) (editable-flag changed)) + (let ((s5-0 (clear *temp-string*))) + (when (zero? (-> this id)) + (format s5-0 "insert into light set level_name='~S'" (-> this region level)) + (let ((s3-0 (sql-query s5-0))) + (when (= (-> s3-0 content-type) 'modify) + (let ((v1-7 (sql-query "select LAST_INSERT_ID()"))) + (when (= (-> v1-7 content-type) 'select) + (set! (-> this id) (the-as uint (string->int (the-as string (-> v1-7 sql-data 0))))) + (goto cfg-8) + ) + ) + ) + (format 0 "ERROR: sql: id insert error ~A for ~A~%" s3-0 this) + ) + (return #f) + (label cfg-8) + (let ((s3-1 (new 'debug 'string 32 (the-as string #f)))) + (if (= (-> this color w) -2.0) + (format s3-1 "shadow-~d" (-> this id)) + (format s3-1 "light-~d" (-> this id)) + ) + (set! (-> this name) s3-1) + ) + ) + (format (clear s5-0) "update light set level_name='~S', name='~S'" (-> this region level) (-> this name)) + (format + s5-0 + ", pos_x=~f, pos_y=~f, pos_z=~f, r=~f" + (* 0.00024414062 (- (-> this trans x) (-> arg0 level-offset x))) + (* 0.00024414062 (- (-> this trans y) (-> arg0 level-offset y))) + (* 0.00024414062 (- (-> this trans z) (-> arg0 level-offset z))) + (/ (-> this radius) METER_LENGTH) + ) + (if (= (-> this direction w) 0.0) + (format s5-0 ", dir_x=0.0, dir_y=0.0, dir_z=0.0") + (format + s5-0 + ", dir_x=~f, dir_y=~f, dir_z=~f" + (-> this direction x) + (-> this direction y) + (-> this direction z) + ) + ) + (format + s5-0 + ", color0_r=~f, color0_g=~f, color0_b=~f, color0_a=~f" + (-> this color x) + (-> this color y) + (-> this color z) + (-> this color w) + ) + (format + s5-0 + ", decay_start=~f, ambient_point_ratio=~f, brightness=~f" + (-> this decay-start) + (-> this ambient-point-ratio) + (-> this brightness) + ) + (format + s5-0 + ", shadow_ambi =~d, shadow_dir_0 =~d, shadow_dir_1 =~d, shadow_dir_2 =~d, shadow_dir_3 =~d" + (the int (* 16.0 (-> this shadow-ambi))) + (the int (* 16.0 (-> this shadow-dir0))) + (the int (* 16.0 (-> this shadow-dir1))) + (the int (* 16.0 (-> this shadow-dir2))) + (the int (* 16.0 (-> this shadow-dir3))) + ) + (format s5-0 " where light_id=~D" (-> this id)) + (let ((a0-23 (sql-query s5-0))) + (when (= (-> a0-23 content-type) 'modify) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +;; definition for method 10 of type editable-light +(defmethod editable-method-10 ((this editable-light)) + (if (!= (-> this direction w) 0.0) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 this) + (-> this direction) + (* -1.2 (-> this radius)) + (the-as rgba (new 'static 'rgba :r #xff :b #xff :a #x80)) + ) + ) + (when (-> *editable* 0 light-names) + (let ((s5-1 add-debug-text-3d) + (s4-1 #t) + (s3-1 577) + ) + (format (clear *temp-string*) "~S~%" (-> this name)) + (s5-1 s4-1 (the-as bucket-id s3-1) *temp-string* (-> this trans) (font-color white) (the-as vector2h #f)) + ) + ) + ((method-of-type editable-sphere editable-method-10) this) + (none) + ) + +;; definition for method 32 of type editable-entity +;; WARN: Return type mismatch euler-angles vs vector. +(defmethod get-null-vec ((this editable-entity)) + (the-as vector (-> this angles)) + ) + +;; definition for method 33 of type editable-entity +;; INFO: Used lq/sq +;; WARN: Return type mismatch euler-angles vs vector. +(defmethod get-null-vec2 ((this editable-entity) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (set! (-> this angles quad) (-> arg0 quad)) + (editable-entity-method-36 this) + (the-as vector (-> this angles)) + ) + +;; definition for method 35 of type editable-entity +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-35 ((this editable-entity) (arg0 vector)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (let ((s5-0 (new 'stack-no-clear 'quaternion))) + (logior! (-> this flags) (editable-flag changed)) + (eul->matrix s4-0 (-> this angles)) + (quaternion-from-two-vectors! s5-0 (-> s4-0 uvec) arg0) + (matrix*! s4-0 s4-0 (quaternion->matrix (new 'stack-no-clear 'matrix) s5-0)) + ) + (matrix->eul (-> this angles) s4-0 21) + ) + (editable-entity-method-36 this) + 0 + (none) + ) + +;; definition for method 21 of type editable-entity +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-21 ((this editable-entity) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (new 'stack-no-clear 'vector) + (eul->matrix s4-0 (-> this angles)) + (let ((s5-0 (new 'stack 'collide-query))) + (vector-copy! (-> s5-0 start-pos) (-> this trans)) + (vector-float*! (-> s5-0 move-dist) (-> s4-0 uvec) -4096000.0) + (let ((v1-8 s5-0)) + (set! (-> v1-8 radius) 409.6) + (set! (-> v1-8 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-8 ignore-process0) #f) + (set! (-> v1-8 ignore-process1) #f) + (set! (-> v1-8 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-8 action-mask) (collide-action solid)) + ) + (let ((f0-2 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (if (>= f0-2 0.0) + (vector+*! (-> this trans) (-> s5-0 start-pos) (-> s5-0 move-dist) f0-2) + ) + ) + ) + ) + (editable-method-30 this (editable-flag no-plane-snap)) + (editable-entity-method-36 this) + 0 + (none) + ) + +;; definition for method 30 of type editable-entity +(defmethod editable-method-30 ((this editable-entity) (arg0 editable-flag)) + (editable-entity-method-36 this) + (none) + ) + +;; definition for method 27 of type editable-entity +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 27 editable-entity) has a return type of none, but the expression builder found a return statement. +(defmethod delete! ((this editable-entity) (arg0 editable)) + (call-parent-method this arg0) + (when (nonzero? (-> this id)) + (let ((s5-1 (clear *temp-string*))) + (format s5-1 "delete from entity where entity_id=~D" (-> this id)) + (let ((a2-1 (sql-query s5-1))) + (when (!= (-> a2-1 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-1 this) + (return 0) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 29 of type editable-entity +(defmethod copy-into-editable-array! ((this editable-entity) (arg0 editable-array)) + (let ((gp-1 (call-parent-method this arg0))) + (copy-string<-string (-> gp-1 name) (-> this name)) + (set! (-> gp-1 idx) 0) + (let ((a0-5 (new 'debug 'editable-region))) + (let ((v1-1 a0-5)) + (set! (-> v1-1 locked) #t) + (set! (-> v1-1 changed) #f) + (set! (-> v1-1 tree) 'entity) + (set! (-> v1-1 filter) (editable-filter entity)) + (set! (-> v1-1 level) (-> this region level)) + ) + (set! (-> gp-1 region) a0-5) + ) + gp-1 + ) + ) + +;; definition for method 17 of type editable-entity +(defmethod editable-method-17 ((this editable-entity) (arg0 vector) (arg1 editable-flag)) + (call-parent-method this arg0 arg1) + (editable-entity-method-36 this) + (none) + ) + +;; definition for method 18 of type editable-entity +(defmethod editable-method-18 ((this editable-entity) (arg0 vector) (arg1 int)) + (call-parent-method this arg0 arg1) + (editable-entity-method-36 this) + (none) + ) + +;; definition for method 20 of type editable-entity +(defmethod editable-method-20 ((this editable-entity) (arg0 vector) (arg1 matrix)) + (call-parent-method this arg0 arg1) + (let ((s4-1 (new 'stack-no-clear 'matrix))) + (eul->matrix s4-1 (-> this angles)) + (matrix*! s4-1 s4-1 arg1) + (matrix->eul (-> this angles) s4-1 21) + ) + (editable-entity-method-36 this) + (none) + ) + +;; definition for method 9 of type editable-entity +;; WARN: Return type mismatch int vs rgba. +(defmethod get-color ((this editable-entity)) + (the-as rgba (cond + ((or (string-suffix= (-> this name) "path") + (string-suffix= (-> this name) "chase-ring") + (string-suffix= (-> this name) "pickup") + (string-suffix= (-> this name) "rally-bollard") + (string-suffix= (-> this name) "freeze") + ) + (set! (-> this radius) (* 0.05 (vector-vector-distance (math-camera-pos) (-> this trans)))) + (cond + ((and (logtest? (-> this flags) (editable-flag selected)) + (< (mod (-> *display* real-clock frame-counter) 60) 30) + ) + (the-as int (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + ) + ((or (string-suffix= (-> this name) "pickup") (string-suffix= (-> this name) "freeze")) + (cond + ((string-prefix= "a-" (-> this name)) + (the-as int (new 'static 'rgba :r #xff :a #x80)) + ) + ((string-prefix= "b-" (-> this name)) + (shl #x80ff 16) + ) + (else + (the-as int (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + ) + ) + ) + (else + (the-as int (new 'static 'rgba :g #xff :a #x80)) + ) + ) + ) + (else + (set! (-> this radius) 4096.0) + (the-as int ((method-of-type editable get-color) this)) + ) + ) + ) + ) + +;; definition for method 36 of type editable-entity +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-entity-method-36 ((this editable-entity)) + (with-pp + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "~S-~D" (-> this name) (-> this idx)) + (let ((s5-1 (as-type (process-by-name s5-0 *active-pool*) process-drawable))) + (when (and s5-1 (-> (the-as process-drawable s5-1) root)) + (let ((v1-2 (as-type (-> (the-as process-drawable s5-1) entity) entity-actor))) + (when v1-2 + (vector-copy! (-> v1-2 extra trans) (-> this trans)) + (vector-copy! (-> v1-2 trans) (-> this trans)) + (eul->quat (-> v1-2 quat) (-> this angles)) + ) + ) + (vector-copy! (-> (the-as process-drawable s5-1) root trans) (-> this trans)) + (eul->quat (-> (the-as process-drawable s5-1) root quat) (-> this angles)) + (let ((gp-1 pp)) + (set! pp s5-1) + (ja-post) + (set! pp gp-1) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 24 of type editable-entity +(defmethod editable-method-24 ((this editable-entity) (arg0 editable-array) (arg1 int) (arg2 int)) + (if (string= "entity" (-> this name)) + (return #t) + ) + (cond + ((logtest? (-> this flags) (editable-flag changed)) + (let ((s4-0 (get-level-offset this arg0)) + (s5-1 (clear *temp-string*)) + ) + 0 + (format s5-1 "select level_info_id from level_info where name='~S'" (-> this region level)) + (let ((a2-2 (sql-query s5-1))) + (when (!= (-> a2-2 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A~%" a2-2) + (return #f) + ) + (let ((s3-0 (string->int (the-as string (-> a2-2 sql-data 0))))) + (when (zero? (-> this id)) + (format (clear s5-1) "select ifnull(max(idx) + 1, 1) from entity where name='~S'" (-> this name)) + (let ((v1-14 (sql-query s5-1))) + (if (= (-> v1-14 content-type) 'select) + (set! (-> this idx) (string->int (the-as string (-> v1-14 sql-data 0)))) + ) + ) + (format + (clear s5-1) + "insert entity set level_id=~D,path='region-editor',idx=~D,name='~S'" + s3-0 + (-> this idx) + (-> this name) + ) + (let ((s2-2 (sql-query s5-1))) + (when (= (-> s2-2 content-type) 'modify) + (let ((v1-17 (sql-query "select LAST_INSERT_ID()"))) + (when (= (-> v1-17 content-type) 'select) + (set! (-> this id) (the-as uint (string->int (the-as string (-> v1-17 sql-data 0))))) + (goto cfg-16) + ) + ) + ) + (format 0 "ERROR: sql: id ---- insert error ~A for ~A~%" s2-2 this) + ) + (return #f) + ) + (label cfg-16) + (format + (clear s5-1) + "update entity set level_id=~D, name='~S', path='region-editor-~D'" + s3-0 + (-> this name) + (-> this id) + ) + ) + ) + (format + s5-1 + ", position_x=~f, position_y=~f, position_z=~f" + (* 0.00024414062 (- (-> this trans x) (-> s4-0 x))) + (* 0.00024414062 (- (-> this trans y) (-> s4-0 y))) + (* 0.00024414062 (- (-> this trans z) (-> s4-0 z))) + ) + (format + s5-1 + ", rot_x=~f, rot_y=~f, rot_z=~f" + (* 0.005493164 (-> this angles x)) + (* 0.005493164 (-> this angles y)) + (* 0.005493164 (-> this angles z)) + ) + (format s5-1 " where entity_id=~D" (-> this id)) + (let ((a0-31 (sql-query s5-1))) + (when (= (-> a0-31 content-type) 'modify) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + ) + ) + ) + (else + #t + ) + ) + ) + +;; definition for method 15 of type editable-face +;; INFO: Used lq/sq +(defmethod editable-method-15 ((this editable-face)) + "The center of the obj." + (cond + ((>= (-> this length) 3) + (let ((s5-0 (new 'static 'vector))) + (set! (-> s5-0 quad) (the-as uint128 0)) + (vector+! s5-0 s5-0 (editable-method-15 (-> this vertex 0))) + (vector+! s5-0 s5-0 (editable-method-15 (-> this vertex 1))) + (vector+! s5-0 s5-0 (editable-method-15 (-> this vertex 2))) + (vector-float*! s5-0 s5-0 0.33333334) + ) + ) + ((>= (-> this length) 2) + (let ((s5-1 (new 'static 'vector))) + (set! (-> s5-1 quad) (the-as uint128 0)) + (vector+! s5-1 s5-1 (editable-method-15 (-> this vertex 0))) + (vector+! s5-1 s5-1 (editable-method-15 (-> this vertex 1))) + (vector-float*! s5-1 s5-1 0.5) + ) + ) + (else + *null-vector* + ) + ) + ) + +;; definition for method 24 of type editable-face +(defmethod editable-method-24 ((this editable-face) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (clear *temp-string*))) + (format s4-0 "insert into region_face set kind='face',region_id=~D" (-> this region id)) + (if (logtest? (-> this flags) (editable-flag orient)) + (format s4-0 ",flags='orient'") + ) + (let ((a0-5 (sql-query s4-0))) + (if (!= (-> a0-5 content-type) 'modify) + (return #f) + ) + ) + ) + (dotimes (s4-1 (-> this length)) + (editable-method-24 (-> this vertex s4-1) arg0 2 s4-1) + ) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + +;; definition for method 27 of type editable-face +(defmethod delete! ((this editable-face) (arg0 editable)) + (dotimes (s4-0 (-> this length)) + (let ((s3-0 (-> this vertex s4-0))) + (set! (-> s3-0 owner) (delete! this (-> s3-0 owner))) + ) + ) + (call-parent-method this arg0) + (none) + ) + +;; definition for method 28 of type editable-face +(defmethod editable-method-28 ((this editable-face) (arg0 editable) (arg1 editable)) + (-> this length) + (countdown (v1-1 (-> this length)) + (when (= (-> this vertex v1-1) arg0) + (let ((a0-5 v1-1) + (a1-2 (+ (-> this length) -2)) + ) + (while (>= a1-2 a0-5) + (set! (-> this vertex a0-5) (-> this vertex (+ a0-5 1))) + (+! a0-5 1) + ) + ) + (+! (-> this length) -1) + ) + ) + (if (< (-> this length) 3) + (editable-method-16 arg1) + ) + ((method-of-type editable editable-method-28) this arg0 arg1) + (none) + ) + +;; definition for method 29 of type editable-face +(defmethod copy-into-editable-array! ((this editable-face) (arg0 editable-array)) + (let ((gp-1 (call-parent-method this arg0))) + (dotimes (s4-0 (-> gp-1 length)) + (set! (-> gp-1 vertex s4-0) (the-as editable-point (copy-into-editable-array! (-> gp-1 vertex s4-0) arg0))) + (set! (-> gp-1 vertex s4-0 owner) (cons gp-1 (-> gp-1 vertex s4-0 owner))) + ) + gp-1 + ) + ) + +;; definition for method 26 of type editable-face +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-26 ((this editable-face)) + (logxor! (-> this flags) (editable-flag orient)) + (editable-face-method-37 this (-> this normal)) + (logior! (-> this flags) (editable-flag changed)) + (set! (-> this region changed) #t) + 0 + (none) + ) + +;; definition for method 36 of type editable-face +;; INFO: Used lq/sq +(defmethod editable-face-method-36 ((this editable-face) (arg0 (inline-array vector))) + (let ((v1-0 (-> this length))) + (cond + ((or (zero? v1-0) (= v1-0 1)) + 0 + ) + ((= v1-0 2) + (let ((s4-0 (editable-method-15 (-> this vertex 0))) + (v1-3 (editable-method-15 (-> this vertex 1))) + ) + (vector-copy! (-> arg0 0) s4-0) + (vector-copy! (-> arg0 1) s4-0) + (set! (-> arg0 1 y) (-> v1-3 y)) + (vector-copy! (-> arg0 2) v1-3) + (set! (-> arg0 2 y) (-> s4-0 y)) + (vector-copy! (-> arg0 3) v1-3) + ) + 4 + ) + (else + (dotimes (s4-1 (-> this length)) + (vector-copy! (-> arg0 s4-1) (editable-method-15 (-> this vertex s4-1))) + ) + (-> this length) + ) + ) + ) + ) + +;; definition for method 37 of type editable-face +;; INFO: Used lq/sq +(defmethod editable-face-method-37 ((this editable-face) (arg0 vector)) + (let ((s4-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-0 6) + (set! (-> s4-0 v1-0 quad) (the-as uint128 0)) + ) + (if (>= (editable-face-method-36 this s4-0) 3) + (normal-of-plane arg0 (-> s4-0 0) (-> s4-0 1) (-> s4-0 2)) + ) + ) + (if (logtest? (-> this flags) (editable-flag orient)) + (vector-negate! arg0 arg0) + ) + arg0 + ) + +;; definition for method 13 of type editable-face +;; INFO: Used lq/sq +(defmethod editable-method-13 ((this editable-face) (arg0 vector)) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (editable-face-method-37 this (new 'stack-no-clear 'vector))) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s2-0 (editable-method-15 (-> this vertex 0))) + (transform-point-vector! gp-0 s2-0) + (when (< 0.0 (-> gp-0 z)) + (reverse-transform-point! gp-0 s2-0 s5-0 arg0) + (let ((s3-1 (the-as object (new 'stack-no-clear 'inline-array 'vector 6)))) + (dotimes (v1-5 6) + (set! (-> (the-as (inline-array vector) s3-1) v1-5 quad) (the-as uint128 0)) + ) + (let ((s4-1 (editable-face-method-36 this (the-as (inline-array vector) s3-1))) + (s2-1 0) + (s1-1 (vector-negate! (new 'stack-no-clear 'vector) s5-0)) + ) + (while (< (+ s2-1 2) s4-1) + (if (or (point-in-triangle-cross + gp-0 + s5-0 + (-> (the-as (inline-array vector) s3-1) 0) + (-> (the-as (inline-array vector) s3-1) 1) + (-> (the-as (inline-array vector) s3-1) 2) + ) + (point-in-triangle-cross + gp-0 + s1-1 + (-> (the-as (inline-array vector) s3-1) 0) + (-> (the-as (inline-array vector) s3-1) 1) + (-> (the-as (inline-array vector) s3-1) 2) + ) + ) + (return (vector-vector-distance (camera-pos) gp-0)) + ) + (+! s2-1 1) + (set! s3-1 (-> (the-as (inline-array vector) s3-1) 1)) + ) + ) + ) + ) + ) + -1.0 + ) + +;; definition for method 14 of type editable-face +;; INFO: Used lq/sq +(defmethod editable-method-14 ((this editable-face) (arg0 vector) (arg1 vector)) + (local-vars (sv-560 editable-face) (sv-576 vector)) + (set! sv-560 this) + (let ((s3-0 arg0) + (s4-0 arg1) + (s2-0 (new 'stack-no-clear 'vector)) + (s5-0 (editable-face-method-37 sv-560 (new 'stack-no-clear 'vector))) + (s1-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'inline-array 'vector 4)) + ) + (dotimes (v1-1 4) + (set! (-> gp-0 v1-1 quad) (the-as uint128 0)) + ) + (vector-copy! s1-0 (editable-method-15 (-> sv-560 vertex 0))) + (transform-point-vector! s2-0 s1-0) + (when (< 0.0 (-> s2-0 z)) + (vector-copy! s5-0 (-> *math-camera* inv-camera-rot fvec)) + (let ((t9-3 reverse-transform-point!) + (a0-9 (-> gp-0 0)) + (a1-3 s1-0) + (a2-1 s5-0) + (a3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-0 x) (-> s3-0 x)) + (set! (-> a3-0 y) (-> s3-0 y)) + (set! (-> a3-0 z) 0.0) + (set! (-> a3-0 w) 1.0) + (t9-3 a0-9 a1-3 a2-1 a3-0) + ) + (let ((t9-4 reverse-transform-point!) + (a0-10 (-> gp-0 1)) + (a1-4 s1-0) + (a2-2 s5-0) + (a3-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-1 x) (-> s4-0 x)) + (set! (-> a3-1 y) (-> s3-0 y)) + (set! (-> a3-1 z) 0.0) + (set! (-> a3-1 w) 1.0) + (t9-4 a0-10 a1-4 a2-2 a3-1) + ) + (let ((t9-5 reverse-transform-point!) + (a0-11 (-> gp-0 2)) + (a1-5 s1-0) + (a2-3 s5-0) + (a3-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-2 x) (-> s4-0 x)) + (set! (-> a3-2 y) (-> s4-0 y)) + (set! (-> a3-2 z) 0.0) + (set! (-> a3-2 w) 1.0) + (t9-5 a0-11 a1-5 a2-3 a3-2) + ) + (let ((t9-6 reverse-transform-point!) + (a0-12 (-> gp-0 3)) + (a1-6 s1-0) + (a2-4 s5-0) + (a3-3 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-3 x) (-> s3-0 x)) + (set! (-> a3-3 y) (-> s4-0 y)) + (set! (-> a3-3 z) 0.0) + (set! (-> a3-3 w) 1.0) + (t9-6 a0-12 a1-6 a2-4 a3-3) + ) + (dotimes (s4-1 4) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (transform-point-vector! s3-1 (-> gp-0 s4-1)) + (when (< (-> s3-1 z) 0.0) + ) + ) + ) + (let ((s4-2 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-19 6) + (set! (-> s4-2 v1-19 quad) (the-as uint128 0)) + ) + (let ((s0-1 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-22 6) + (set! (-> s0-1 v1-22 quad) (the-as uint128 0)) + ) + (let ((s3-2 (editable-face-method-36 sv-560 s0-1))) + 0 + (let ((s2-1 (vector-negate! (new 'stack-no-clear 'vector) s5-0))) + (set! sv-576 (new 'stack-no-clear 'vector)) + (let ((f30-0 0.0) + (t9-10 (method-of-object sv-560 editable-face-method-37)) + (a1-10 (new 'stack-no-clear 'vector)) + ) + (when (< f30-0 (vector-dot + (t9-10 sv-560 a1-10) + (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> s0-1 0)) + ) + ) + (vector-copy! s2-1 s5-0) + #t + ) + ) + (vector-copy! sv-576 (-> s0-1 2)) + (vector-copy! (-> s0-1 2) (-> s0-1 3)) + (vector-copy! (-> s0-1 3) sv-576) + (dotimes (v1-40 4) + (vector-! (-> s4-2 v1-40) (-> s0-1 v1-40) s1-0) + (vector+*! (-> s4-2 v1-40) (-> s4-2 v1-40) s5-0 (- (vector-dot s5-0 (-> s4-2 v1-40)))) + (vector+! (-> s4-2 v1-40) (-> s4-2 v1-40) s1-0) + ) + 0 + 0 + (dotimes (v1-45 4) + (let ((a0-39 0)) + (let ((a1-19 0) + (a2-10 (vector-cross! (new 'stack-no-clear 'vector) s5-0 (vector-! + (new 'stack-no-clear 'vector) + (-> gp-0 (if (= v1-45 3) + 0 + (+ v1-45 1) + ) + ) + (-> gp-0 v1-45) + ) + ) + ) + ) + (dotimes (a3-8 s3-2) + (if (< (vector-dot a2-10 (vector-! (new 'stack-no-clear 'vector) (-> s4-2 a3-8) (-> gp-0 v1-45))) 0.0) + (+! a0-39 1) + (+! a1-19 1) + ) + ) + ) + (if (= a0-39 s3-2) + (return -1.0) + ) + ) + ) + (dotimes (v1-48 s3-2) + (let ((a1-22 0) + (a0-41 0) + ) + (let ((a2-12 (vector-cross! (new 'stack-no-clear 'vector) s2-1 (vector-! + (new 'stack-no-clear 'vector) + (-> s4-2 (if (= v1-48 (+ s3-2 -1)) + 0 + (+ v1-48 1) + ) + ) + (-> s4-2 v1-48) + ) + ) + ) + ) + (dotimes (a3-10 4) + (if (< (vector-dot a2-12 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 a3-10) (-> s4-2 v1-48))) 0.0) + (+! a1-22 1) + (+! a0-41 1) + ) + ) + ) + (if (= a0-41 4) + (return -1.0) + ) + ) + ) + ) + ) + ) + ) + (return 1.0) + ) + ) + -1.0 + ) + +;; definition for method 31 of type editable-face +;; INFO: Used lq/sq +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Stack slot offset 292 signed mismatch +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 31 editable-face) has a return type of none, but the expression builder found a return statement. +(defmethod editable-method-31 ((this editable-face) (arg0 editable-flag)) + (local-vars + (sv-208 (inline-array vector)) + (sv-216 int) + (sv-288 (array editable-point)) + (sv-292 int) + (sv-296 int) + (sv-368 matrix) + (sv-372 editable-point) + (sv-376 number) + (sv-380 symbol) + (sv-400 float) + ) + (if (or (logtest? arg0 (editable-flag no-update)) (logtest? (-> this flags) (editable-flag mark))) + (return #f) + ) + (logior! (-> this flags) (editable-flag mark)) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-7 6) + (set! (-> s5-0 v1-7 quad) (the-as uint128 0)) + ) + (let ((s4-0 (editable-face-method-36 this s5-0))) + (when (and (>= s4-0 4) (>= (-> this length) 3)) + (let ((v1-14 0)) + (dotimes (a0-7 s4-0) + (if (logtest? (-> this vertex a0-7 flags) (editable-flag selected)) + (+! v1-14 1) + ) + ) + (cond + ((= v1-14 s4-0) + (set! arg0 (logior arg0 (editable-flag no-plane-snap))) + ) + ((= v1-14 2) + (let ((v1-15 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (a0-12 6) + (set! (-> v1-15 a0-12 quad) (the-as uint128 0)) + ) + (set! sv-208 v1-15) + ) + (set! sv-216 0) + (dotimes (s2-2 s4-0) + (when (not (logtest? (-> this vertex s2-2 flags) (editable-flag selected))) + (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-2))) + (set! sv-216 (+ sv-216 1)) + ) + ) + (dotimes (s2-3 s4-0) + (when (logtest? (-> this vertex s2-3 flags) (editable-flag selected)) + (vector-copy! (-> sv-208 sv-216) (editable-method-15 (-> this vertex s2-3))) + (set! sv-216 (+ sv-216 1)) + ) + ) + (normal-of-plane (-> this normal) (-> sv-208 0) (-> sv-208 1) (-> sv-208 2)) + (vector-copy! (-> this center) (editable-method-15 this)) + ) + ) + ) + (when (not (logtest? arg0 (editable-flag no-plane-snap))) + (when (= (-> this normal w) 0.0) + (editable-face-method-37 this (-> this normal)) + (vector-copy! (-> this center) (editable-method-15 this)) + ) + (let ((s3-2 0) + (s2-5 (-> this normal)) + (s1-2 (-> this center)) + ) + (while (< s3-2 s4-0) + (when (logtest? (-> this vertex s3-2 flags) (editable-flag selected)) + (let* ((a1-14 (vector-! (new 'stack-no-clear 'vector) (-> s5-0 s3-2) s1-2)) + (f0-2 (vector-dot a1-14 s2-5)) + ) + (editable-method-18 (-> this vertex s3-2) (vector+float*! a1-14 (-> s5-0 s3-2) s2-5 (- f0-2)) 120) + ) + ) + (+! s3-2 1) + ) + ) + ) + (set! sv-288 + (the-as + (array editable-point) + ((method-of-type array new) + (the-as symbol (new 'stack-no-clear 'array 'editable-point 6)) + array + editable-point + 6 + ) + ) + ) + (set! sv-292 (+ (-> this length) -1)) + (set! sv-296 1) + (editable-face-method-37 this (-> this normal)) + (dotimes (v1-85 sv-292) + (set! (-> sv-288 v1-85) (-> this vertex (+ v1-85 1))) + ) + (set! sv-368 (new-stack-matrix0)) + (set! sv-372 (the-as editable-point #f)) + (set! sv-376 0.0) + (set! sv-380 #t) + (vector-normalize! + (vector-! (-> sv-368 fvec) (editable-method-15 this) (editable-method-15 (-> this vertex 0))) + 1.0 + ) + (vector-normalize! (editable-face-method-37 this (-> sv-368 uvec)) 1.0) + (vector-normalize! (vector-cross! (-> sv-368 rvec) (-> sv-368 fvec) (-> sv-368 uvec)) 1.0) + (vector-copy! (-> sv-368 trans) (editable-method-15 (-> this vertex 0))) + (set! (-> sv-368 trans w) 1.0) + (matrix-4x4-inverse! sv-368 sv-368) + (while (< sv-296 (-> this length)) + (set! sv-372 (the-as editable-point #f)) + (dotimes (s5-4 sv-292) + (when (-> sv-288 s5-4) + (let* ((a1-27 (editable-method-15 (-> sv-288 s5-4))) + (a0-48 (vector-matrix*! (new 'stack-no-clear 'vector) a1-27 sv-368)) + ) + (set! sv-400 (vector-y-angle a0-48)) + ) + (cond + (sv-380 + (when (or (not sv-372) (< (the-as float sv-376) sv-400)) + (set! sv-372 (-> sv-288 s5-4)) + (set! sv-376 sv-400) + ) + ) + (else + (when (or (not sv-372) (< sv-400 (the-as float sv-376))) + (set! sv-372 (-> sv-288 s5-4)) + (set! sv-376 sv-400) + ) + ) + ) + ) + ) + (set! (-> this vertex sv-296) sv-372) + (dotimes (v1-131 sv-292) + (if (= sv-372 (-> sv-288 v1-131)) + (set! (-> sv-288 v1-131) #f) + ) + ) + (set! sv-296 (+ sv-296 1)) + (set! sv-380 (not sv-380)) + ) + (if (< (vector-dot (-> this normal) (editable-face-method-37 this (new 'stack-no-clear 'vector))) 0.0) + (logxor! (-> this flags) (editable-flag orient)) + ) + ) + ) + ) + (editable-face-method-37 this (-> this normal)) + (vector-copy! (-> this center) (editable-method-15 this)) + 0 + (none) + ) + +;; definition for method 10 of type editable-face +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-10 ((this editable-face)) + (local-vars (sv-112 int)) + (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 6))) + (dotimes (v1-0 6) + (set! (-> gp-0 v1-0 quad) (the-as uint128 0)) + ) + (set! sv-112 (editable-face-method-36 this gp-0)) + (when (>= sv-112 3) + (let ((s1-0 (editable-face-method-37 this (new 'stack-no-clear 'vector)))) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 this) + s1-0 + (meters 2) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + ) + (let ((t1-1 (if (logtest? (-> this flags) (editable-flag selected)) + 1 + 0 + ) + ) + ) + (if (or (= t1-1 1) (not (-> *editable-work* hide))) + (add-debug-bound + (bucket-id debug) + gp-0 + sv-112 + (if (logtest? (-> this flags) (editable-flag orient)) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + (if (not (logtest? (-> this flags) (editable-flag orient))) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + t1-1 + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 15 of type editable-plane +(defmethod editable-method-15 ((this editable-plane)) + (if (>= (-> this length) 1) + (editable-method-15 (-> this vertex 0)) + *null-vector* + ) + ) + +;; definition for method 24 of type editable-plane +(defmethod editable-method-24 ((this editable-plane) (arg0 editable-array) (arg1 int) (arg2 int)) + (let ((s4-0 (clear *temp-string*))) + (format + s4-0 + "insert into region_face set kind='plane',region_id=~D,radius=~f" + (-> this region id) + (-> this radius) + ) + (let ((a0-4 (sql-query s4-0))) + (if (!= (-> a0-4 content-type) 'modify) + (return #f) + ) + ) + ) + (dotimes (s4-1 (-> this length)) + (editable-method-24 (-> this vertex s4-1) arg0 2 s4-1) + ) + (logclear! (-> this flags) (editable-flag changed)) + #t + ) + +;; definition for method 27 of type editable-plane +(defmethod delete! ((this editable-plane) (arg0 editable)) + (dotimes (s4-0 (-> this length)) + (let ((s3-0 (-> this vertex s4-0))) + (set! (-> s3-0 owner) (delete! this (-> s3-0 owner))) + ) + ) + (call-parent-method this arg0) + (none) + ) + +;; definition for method 28 of type editable-plane +(defmethod editable-method-28 ((this editable-plane) (arg0 editable) (arg1 editable)) + (editable-method-16 arg1) + ((method-of-type editable editable-method-28) this arg0 arg1) + (none) + ) + +;; definition for method 29 of type editable-plane +(defmethod copy-into-editable-array! ((this editable-plane) (arg0 editable-array)) + (let ((gp-1 (call-parent-method this arg0))) + (dotimes (s4-0 (-> gp-1 length)) + (set! (-> gp-1 vertex s4-0) (the-as editable-point (copy-into-editable-array! (-> gp-1 vertex s4-0) arg0))) + (set! (-> gp-1 vertex s4-0 owner) (cons gp-1 (-> gp-1 vertex s4-0 owner))) + ) + gp-1 + ) + ) + +;; definition for method 26 of type editable-plane +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-26 ((this editable-plane)) + (let ((s5-1 (vector-! + (new 'stack-no-clear 'vector) + (editable-method-15 (-> this vertex 1)) + (editable-method-15 (-> this vertex 0)) + ) + ) + ) + (editable-method-18 (-> this vertex 1) (vector-! s5-1 (editable-method-15 (-> this vertex 0)) s5-1) 56) + ) + (set! (-> this region changed) #t) + (logior! (-> this flags) (editable-flag changed)) + 0 + (none) + ) + +;; definition for method 36 of type editable-plane +(defmethod editable-plane-method-36 ((this editable-plane) (arg0 (inline-array vector))) + (case (-> this length) + ((2) + (let* ((v1-2 (editable-plane-method-37 this (new 'stack-no-clear 'vector))) + (s5-1 (vector-cross! + (new 'stack-no-clear 'vector) + v1-2 + (if (< 0.7 (fabs (vector-dot v1-2 (new 'static 'vector :z 1.0 :w 1.0)))) + (new 'static 'vector :x 1.0 :w 1.0) + (new 'static 'vector :z 1.0 :w 1.0) + ) + ) + ) + (s4-1 (vector-cross! (new 'stack-no-clear 'vector) s5-1 v1-2)) + (f30-0 (-> this radius)) + ) + (let ((v1-4 (editable-method-15 (-> this vertex 0)))) + (vector+float*! (-> arg0 0) v1-4 s5-1 (the-as float f30-0)) + (vector+float*! (-> arg0 0) (-> arg0 0) s4-1 (- f30-0)) + (vector+float*! (-> arg0 1) v1-4 s5-1 (- f30-0)) + (vector+float*! (-> arg0 1) (-> arg0 1) s4-1 (- f30-0)) + (vector+float*! (-> arg0 2) v1-4 s5-1 (the-as float f30-0)) + (vector+float*! (-> arg0 2) (-> arg0 2) s4-1 (the-as float f30-0)) + (vector+float*! (-> arg0 3) v1-4 s5-1 (- f30-0)) + ) + (vector+float*! (-> arg0 3) (-> arg0 3) s4-1 (the-as float f30-0)) + ) + 4 + ) + (else + 0 + ) + ) + ) + +;; definition for method 37 of type editable-plane +(defmethod editable-plane-method-37 ((this editable-plane) (arg0 vector)) + (case (-> this length) + ((2) + (let ((s3-0 (-> this vertex 0)) + (a0-1 (-> this vertex 1)) + ) + (vector-! arg0 (editable-method-15 a0-1) (editable-method-15 s3-0)) + ) + (vector-normalize! arg0 1.0) + ) + ) + arg0 + ) + +;; definition for method 13 of type editable-plane +;; INFO: Used lq/sq +(defmethod editable-method-13 ((this editable-plane) (arg0 vector)) + (let ((gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (editable-plane-method-37 this (new 'stack-no-clear 'vector))) + ) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (vector-copy! s1-0 (editable-method-15 (-> this vertex 0))) + (transform-point-vector! gp-0 s1-0) + ) + (when (< 0.0 (-> gp-0 z)) + (reverse-transform-point! gp-0 (editable-method-15 (-> this vertex 0)) s5-0 arg0) + (let ((s3-1 (the-as object (new 'stack-no-clear 'inline-array 'vector 4)))) + (dotimes (v1-6 4) + (set! (-> (the-as (inline-array vector) s3-1) v1-6 quad) (the-as uint128 0)) + ) + (let ((s4-1 (editable-plane-method-36 this (the-as (inline-array vector) s3-1))) + (s2-2 0) + (s1-2 (vector-negate! (new 'stack-no-clear 'vector) s5-0)) + ) + (while (< (+ s2-2 2) s4-1) + (if (or (point-in-triangle-cross + gp-0 + s5-0 + (-> (the-as (inline-array vector) s3-1) 0) + (-> (the-as (inline-array vector) s3-1) 1) + (-> (the-as (inline-array vector) s3-1) 2) + ) + (point-in-triangle-cross + gp-0 + s1-2 + (-> (the-as (inline-array vector) s3-1) 0) + (-> (the-as (inline-array vector) s3-1) 1) + (-> (the-as (inline-array vector) s3-1) 2) + ) + ) + (return (vector-vector-distance (camera-pos) gp-0)) + ) + (+! s2-2 1) + (set! s3-1 (-> (the-as (inline-array vector) s3-1) 1)) + ) + ) + ) + ) + ) + -1.0 + ) + +;; definition for method 10 of type editable-plane +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-10 ((this editable-plane)) + (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (v1-0 4) + (set! (-> gp-0 v1-0 quad) (the-as uint128 0)) + ) + (let ((s4-0 (editable-plane-method-36 this gp-0))) + (when (>= s4-0 3) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (editable-method-15 (-> this vertex 0)) + (editable-method-15 (-> this vertex 1)) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :a #x80)) + #f + (the-as rgba -1) + ) + (let ((t1-1 (if (logtest? (-> this flags) (editable-flag selected)) + 1 + 0 + ) + ) + ) + (if (or (= t1-1 1) (not (-> *editable-work* hide))) + (add-debug-bound + (bucket-id debug) + gp-0 + s4-0 + (if (logtest? (-> this flags) (editable-flag orient)) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + (if (not (logtest? (-> this flags) (editable-flag orient))) + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :r #x80 :g #x80 :a #x40) + ) + t1-1 + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 19 of type editable-plane +;; WARN: Return type mismatch int vs none. +(defmethod editable-method-19 ((this editable-plane) (arg0 vector)) + (let ((v1-0 (-> this region))) + (if v1-0 + (set! (-> v1-0 changed) #t) + ) + ) + (logior! (-> this flags) (editable-flag changed)) + (if (= (-> arg0 y) 0.0) + (+! (-> this radius) (-> arg0 x)) + (set! (-> this radius) (-> arg0 y)) + ) + (if (< (-> this radius) 0.0) + (set! (-> this radius) 0.0) + ) + (editable-method-30 this (editable-flag no-plane-snap)) + 0 + (none) + ) + +;; definition for method 7 of type editable-array +;; WARN: Return type mismatch (array editable) vs editable-array. +(defmethod relocate ((this editable-array) (offset int)) + (the-as editable-array (when (nonzero? (-> this selection)) + (let ((v0-0 (&+ (-> this selection) offset))) + (set! (-> this selection) v0-0) + v0-0 + ) + ) + ) + ) + +;; definition for method 4 of type editable-array +(defmethod length ((this editable-array)) + (-> this length) + ) + +;; definition for method 5 of type editable-array +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this editable-array)) + (the-as int (+ (-> this type size) (* (-> this allocated-length) 4))) + ) + +;; definition for method 12 of type editable-array +(defmethod get-length ((this editable-array)) + (dotimes (v1-0 (-> this length)) + (if (not (-> this data v1-0)) + (return v1-0) + ) + ) + (when (< (-> this length) (-> this allocated-length)) + (+! (-> this length) 1) + (return (+ (-> this length) -1)) + ) + -1 + ) + +;; definition for method 10 of type editable-array +(defmethod editable-array-method-10 ((this editable-array) (arg0 vector) (arg1 int)) + (when (or (!= (-> arg0 x) (-> *editable-work* last-x)) (!= (-> arg0 y) (-> *editable-work* last-y))) + (set! (-> *editable-work* last-found) 0) + (set! (-> *editable-work* last-x) (-> arg0 x)) + (set! (-> *editable-work* last-y) (-> arg0 y)) + ) + 4095996000.0 + (let ((s5-0 (the-as editable #f))) + (set! (-> *editable-work* num-found) 0) + (let* ((s2-0 (-> this length)) + (s1-0 0) + (s0-0 (-> this data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (or (and (logtest? (-> s0-0 region filter) (-> this filter 0)) + (logtest? (-> s0-0 region filter) (-> this filter 1)) + ) + (logtest? (-> s0-0 flags) (editable-flag selected)) + ) + ) + (let ((f0-5 (editable-method-13 s0-0 arg0))) + (when (>= f0-5 0.0) + (set! (-> *editable-work* found (-> *editable-work* num-found)) s0-0) + (set! (-> *editable-work* dists (-> *editable-work* num-found)) (the-as uint f0-5)) + (if (< (-> *editable-work* num-found) 255) + (+! (-> *editable-work* num-found) 1) + ) + ) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> this data s1-0)) + ) + ) + (countdown (v1-43 (-> *editable-work* num-found)) + (when (> v1-43 0) + (countdown (a0-12 v1-43) + (when (< (the-as float (-> *editable-work* dists v1-43)) (the-as float (-> *editable-work* dists a0-12))) + (let ((a1-10 (-> *editable-work* found v1-43)) + (f0-7 (-> *editable-work* dists v1-43)) + ) + (set! (-> *editable-work* found v1-43) (-> *editable-work* found a0-12)) + (set! (-> *editable-work* dists v1-43) (-> *editable-work* dists a0-12)) + (set! (-> *editable-work* found a0-12) a1-10) + (set! (-> *editable-work* dists a0-12) f0-7) + ) + ) + ) + ) + ) + (when (nonzero? (-> *editable-work* num-found)) + (when (>= (-> *editable-work* last-found) (-> *editable-work* num-found)) + (set! (-> *editable-work* last-found) 0) + 0 + ) + (set! s5-0 (cond + ((zero? arg1) + (set! s5-0 (-> *editable-work* found (-> *editable-work* last-found))) + (+! (-> *editable-work* last-found) 1) + s5-0 + ) + (else + (-> *editable-work* found 0) + ) + ) + ) + ) + s5-0 + ) + ) + +;; definition for method 11 of type editable-array +;; WARN: Return type mismatch symbol vs none. +(defmethod editable-array-method-11 ((this editable-array) (arg0 vector) (arg1 vector) (arg2 int)) + (let* ((s2-0 (-> this length)) + (s1-0 0) + (s0-0 (-> this data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (or (and (logtest? (-> s0-0 region filter) (-> this filter 0)) + (logtest? (-> s0-0 region filter) (-> this filter 1)) + ) + (logtest? (-> s0-0 flags) (editable-flag selected)) + ) + ) + (when (>= (editable-method-14 s0-0 arg0 arg1) 0.0) + (let ((v1-13 arg2)) + (cond + ((zero? v1-13) + (set-selected! s0-0 #t) + ) + ((= v1-13 2) + (set-selected! s0-0 #f) + ) + ((= v1-13 1) + (set-selected! s0-0 'toggle) + ) + ) + ) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> this data s1-0)) + ) + ) + (none) + ) + +;; definition for method 15 of type editable-array +(defmethod editable-array-method-15 ((this editable-array) (arg0 (function editable editable-region symbol)) (arg1 editable-region)) + (let ((gp-0 (-> this selection))) + (set! (-> gp-0 length) 0) + (let* ((s2-0 (-> this length)) + (s1-0 0) + (s0-0 (-> this data s1-0)) + ) + (while (< s1-0 s2-0) + (when (and s0-0 (logtest? (-> s0-0 flags) (editable-flag selected))) + (when (arg0 s0-0 arg1) + (set! (-> gp-0 (-> gp-0 length)) s0-0) + (+! (-> gp-0 length) 1) + ) + ) + (+! s1-0 1) + (set! s0-0 (-> this data s1-0)) + ) + ) + gp-0 + ) + ) + +;; definition for method 16 of type editable-array +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-16 ((this editable-array) (arg0 editable)) + (let ((gp-0 (-> arg0 region))) + (when gp-0 + (delete! arg0 (the-as editable this)) + (let* ((v1-3 (-> this length)) + (a0-2 0) + (a1-4 (-> this data a0-2)) + ) + (while (< a0-2 v1-3) + (if (and a1-4 (= arg0 a1-4)) + (set! (-> this data a0-2) #f) + ) + (+! a0-2 1) + (set! a1-4 (-> this data a0-2)) + ) + ) + (let* ((v1-6 (-> this length)) + (a0-3 0) + (a1-14 (-> this data a0-3)) + ) + (while (< a0-3 v1-6) + (if (and a1-14 (= (-> a1-14 region) gp-0) (!= a1-14 arg0)) + (goto cfg-21) + ) + (+! a0-3 1) + (set! a1-14 (-> this data a0-3)) + ) + ) + (editable-region-method-10 gp-0 0) + ) + ) + (label cfg-21) + 0 + (none) + ) + +;; definition for function load-editable-lights +(defun load-editable-lights ((arg0 editable-array)) + (local-vars (sv-16 sql-result)) + (let ((s5-0 sql-query)) + (format + (clear *temp-string*) + "select light_id,name,pos_x,pos_y,pos_z,r,dir_x,dir_y,dir_z,color0_r,color0_g,color0_b,color0_a,decay_start,ambient_point_ratio,brightness,shadow_ambi,shadow_dir_0,shadow_dir_1,shadow_dir_2,shadow_dir_3 from light where level_name='~S'" + (-> arg0 level) + ) + (set! sv-16 (s5-0 *temp-string*)) + ) + (format #t "sql: read light ~D~%" (/ (-> sv-16 length) 16)) + (if (!= (-> sv-16 content-type) 'select) + (return #f) + ) + (let ((s5-1 0)) + (while (< s5-1 (-> sv-16 length)) + (let ((s3-0 (get-length arg0))) + (when (>= s3-0 0) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 2)))))) + (set! (-> s4-1 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 3)))))) + (set! (-> s4-1 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 4)))))) + (set! (-> s4-1 w) 1.0) + (vector+! s4-1 s4-1 (-> arg0 level-offset)) + (let ((s4-2 (new 'debug 'editable-light s4-1 2048.0 *editable-light-region*))) + (set! (-> arg0 data s3-0) s4-2) + (set! (-> s4-2 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s5-1))))) + (set! (-> s4-2 name) (the-as string (-> sv-16 sql-data (+ s5-1 1)))) + (set! (-> s4-2 radius) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s5-1 5)))))) + (set-vector! + (-> s4-2 direction) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 6)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 7)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 8)))) + 1.0 + ) + (set-vector! + (-> s4-2 color) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 9)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 10)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 11)))) + (string->float (the-as string (-> sv-16 sql-data (+ s5-1 12)))) + ) + (if (or (= (-> s4-2 color w) -2.0) + (and (= (-> s4-2 direction x) 0.0) (= (-> s4-2 direction y) 0.0) (= (-> s4-2 direction z) 0.0)) + ) + (set! (-> s4-2 direction w) 0.0) + ) + (set! (-> s4-2 decay-start) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 13))))) + (set! (-> s4-2 ambient-point-ratio) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 14))))) + (set! (-> s4-2 brightness) (string->float (the-as string (-> sv-16 sql-data (+ s5-1 15))))) + (set! (-> s4-2 shadow-ambi) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 16)))))) + ) + (set! (-> s4-2 shadow-dir0) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 17)))))) + ) + (set! (-> s4-2 shadow-dir1) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 18)))))) + ) + (set! (-> s4-2 shadow-dir2) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 19)))))) + ) + (set! (-> s4-2 shadow-dir3) + (* 0.0625 (the float (string->int (the-as string (-> sv-16 sql-data (+ s5-1 20)))))) + ) + (let ((a0-51 0) + (v1-92 0) + ) + (let ((a1-5 (-> s4-2 shadows))) + (dotimes (a2-3 5) + (when (!= (-> a1-5 a2-3) 1.0) + (set! a0-51 (logior a0-51 (ash 1 a2-3))) + (set! v1-92 (logior v1-92 (ash (logand (the int (* 16.0 (-> a1-5 a2-3))) 15) (* a2-3 4)))) + ) + ) + ) + (set! (-> s4-2 direction x) + (the-as + float + (logior (logand (the-as uint (-> s4-2 direction x)) (the-as uint #xffffffff00ffffff)) (shr (shl a0-51 56) 32)) + ) + ) + (set! (-> s4-2 direction x) + (the-as float (logior (logand (the-as int (-> s4-2 direction x)) -16777216) (shr (shl v1-92 40) 40))) + ) + ) + ) + ) + ) + ) + (+! s5-1 21) + ) + ) + (set! (-> *editable-light-region* changed) #f) + #f + ) + +;; definition for method 13 of type editable-array +(defmethod editable-array-method-13 ((this editable-array) (arg0 symbol)) + (local-vars + (sv-16 sql-result) + (sv-20 sql-result) + (sv-24 sql-result) + (sv-28 sql-result) + (sv-32 sql-result) + (sv-36 editable-region) + (sv-40 number) + (sv-44 number) + (sv-64 int) + (sv-72 int) + (sv-80 editable-plane) + (sv-84 string) + (sv-112 vector) + (sv-120 int) + (sv-128 editable-point) + (sv-136 int) + (sv-144 int) + (sv-152 editable-face) + (sv-156 object) + (sv-176 vector) + (sv-180 editable) + (sv-184 int) + (sv-192 int) + (sv-200 editable-point) + (sv-208 int) + (sv-216 sql-result) + ) + (format #t "sql: load from level ~A~%" arg0) + (set! (-> *editable-sample-region* level) (the-as string arg0)) + (set! (-> *editable-light-region* level) (the-as string arg0)) + (set! (-> *editable-entity-region* level) (the-as string arg0)) + (vector-reset! (-> this level-offset)) + (set! (-> this level-info-id) (the-as uint -1)) + (set! (-> this level) (the-as uint arg0)) + (let ((s4-0 sql-query)) + (format + (clear *temp-string*) + "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" + arg0 + ) + (set! sv-16 (s4-0 *temp-string*)) + ) + (when (and (= (-> sv-16 content-type) 'select) (>= (-> sv-16 length) 3)) + (set-vector! + (-> this level-offset) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 0)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 1)))) + (* 4096.0 (string->float (the-as string (-> sv-16 sql-data 2)))) + 1.0 + ) + (set! (-> this level-info-id) (the-as uint (string->int (the-as string (-> sv-16 sql-data 3))))) + ) + (let ((s4-2 sql-query)) + (format + (clear *temp-string*) + "select region_id,level_name,tree,on_enter,on_exit,on_inside from region where level_name='~S'" + arg0 + ) + (set! sv-20 (s4-2 *temp-string*)) + ) + (if (!= (-> sv-20 content-type) 'select) + (return #f) + ) + (format #t "sql: read region ~D~%" (/ (-> sv-20 length) 6)) + (let ((s4-3 sql-query)) + (format + (clear *temp-string*) + "select region_face.region_id,region_face_id,kind,flags,radius from region,region_face where level_name='~S' and region.region_id=region_face.region_id" + arg0 + ) + (set! sv-24 (s4-3 *temp-string*)) + ) + (if (!= (-> sv-24 content-type) 'select) + (return #f) + ) + (format #t "sql: read face ~D~%" (/ (-> sv-24 length) 5)) + (let ((s4-4 sql-query)) + (format + (clear *temp-string*) + "select region_face.region_face_id,idx,x,y,z from region,region_face,region_point where level_name='~S' and region.region_id=region_face.region_id and region_face.region_face_id=region_point.region_face_id" + arg0 + ) + (set! sv-28 (s4-4 *temp-string*)) + ) + (if (!= (-> sv-28 content-type) 'select) + (return #f) + ) + (format #t "sql: read point ~D~%" (/ (-> sv-28 length) 5)) + (let ((s4-5 sql-query)) + (format + (clear *temp-string*) + "select region_sphere.region_id,x,y,z,r from region,region_sphere where level_name='~S' and region.region_id=region_sphere.region_id" + arg0 + ) + (set! sv-32 (s4-5 *temp-string*)) + ) + (if (!= (-> sv-32 content-type) 'select) + (return #f) + ) + (format #t "sql: read sphere ~D~%" (/ (-> sv-32 length) 5)) + (let ((s4-6 0)) + (while (< s4-6 (-> sv-20 length)) + (set! sv-36 (new 'debug 'editable-region)) + (set! sv-40 4095996000.0) + (set! sv-44 -4095996000.0) + (set! (-> sv-36 id) (the-as uint (string->int (the-as string (-> sv-20 sql-data s4-6))))) + (set! (-> sv-36 level) (the-as string (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 1)))))) + (set! (-> sv-36 tree) (string->symbol (the-as string (-> sv-20 sql-data (+ s4-6 2))))) + (set! (-> sv-36 on-enter) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 3))) "") + #f + (-> sv-20 sql-data (+ s4-6 3)) + ) + ) + ) + (set! (-> sv-36 on-exit) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 4))) "") + #f + (-> sv-20 sql-data (+ s4-6 4)) + ) + ) + ) + (set! (-> sv-36 on-inside) (the-as pair (if (string= (the-as string (-> sv-20 sql-data (+ s4-6 5))) "") + #f + (-> sv-20 sql-data (+ s4-6 5)) + ) + ) + ) + (let* ((v1-75 (-> this length)) + (a0-54 0) + (a1-17 (-> this data a0-54)) + ) + (while (< a0-54 v1-75) + (if (and a1-17 (-> a1-17 region) (= (-> a1-17 region id) (-> sv-36 id))) + (set! (-> this data a0-54) #f) + ) + (+! a0-54 1) + (set! a1-17 (-> this data a0-54)) + ) + ) + (let ((s3-5 0)) + (while (< s3-5 (-> sv-32 length)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-32 sql-data s3-5)))) + (let ((s2-0 (get-length this))) + (when (>= s2-0 0) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 x) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 1))))) + (set! (-> s1-1 y) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 2))))) + (set! (-> s1-1 z) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 3))))) + (set! (-> s1-1 w) 1.0) + (vector+! s1-1 s1-1 (-> this level-offset)) + (let ((s1-2 (new 'debug 'editable-sphere s1-1 2048.0 sv-36))) + (set! (-> s1-2 radius) (string->float (the-as string (-> sv-32 sql-data (+ s3-5 4))))) + (set! (-> this data s2-0) s1-2) + ) + ) + ) + ) + ) + (+! s3-5 5) + ) + ) + (set! sv-64 0) + (while (< sv-64 (-> sv-24 length)) + (when (= (-> sv-36 id) (string->int (the-as string (-> sv-24 sql-data sv-64)))) + (cond + ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "plane") + (set! sv-72 (get-length this)) + (set! sv-80 (new 'debug 'editable-plane sv-36)) + (set! sv-84 (the-as string (-> sv-24 sql-data (+ sv-64 1)))) + (when (>= sv-72 0) + (set! (-> this data sv-72) sv-80) + (set! (-> sv-80 radius) (string->float (the-as string (-> sv-24 sql-data (+ sv-64 4))))) + (countdown (s3-6 (/ (-> sv-28 length) 5)) + (when (string= (the-as string (-> (the-as sql-result (+ (* 20 s3-6) (the-as int sv-28))) sql-data 0)) sv-84) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 2))))) + (set! (-> s2-1 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 3))))) + (set! (-> s2-1 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 4))))) + (set! (-> s2-1 w) 1.0) + (set! sv-112 s2-1) + ) + (vector+! sv-112 sv-112 (-> this level-offset)) + (set! sv-120 (get-length this)) + (when (>= sv-120 0) + (set! sv-128 (new 'debug 'editable-point sv-112 sv-36)) + (set! sv-136 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-6) 1))))) + (set! (-> this data sv-120) sv-128) + (set! (-> sv-80 vertex sv-136) sv-128) + (set! (-> sv-80 length) (max (-> sv-80 length) (+ sv-136 1))) + (set! (-> sv-128 owner) (cons sv-80 (-> sv-128 owner))) + ) + ) + ) + (editable-method-30 sv-80 (editable-flag no-plane-snap)) + (editable-method-31 sv-80 (editable-flag no-plane-snap)) + ) + ) + ((string= (the-as string (-> sv-24 sql-data (+ sv-64 2))) "face") + (set! sv-144 (get-length this)) + (set! sv-152 (new 'debug 'editable-face sv-36)) + (set! sv-156 (-> sv-24 sql-data (+ sv-64 1))) + (when (>= sv-144 0) + (set! (-> this data sv-144) sv-152) + (if (string= (the-as string (-> sv-24 sql-data (+ sv-64 3))) "orient") + (logior! (-> sv-152 flags) (editable-flag orient)) + ) + (let ((s3-7 (/ (-> sv-28 length) 5))) + (while (begin (label cfg-78) (nonzero? s3-7)) + (+! s3-7 -1) + (when (string= + (the-as string (-> (the-as sql-result (+ (* 20 s3-7) (the-as int sv-28))) sql-data 0)) + (the-as string sv-156) + ) + (let ((s2-2 (new 'stack-no-clear 'vector))) + (set! (-> s2-2 x) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 2))))) + (set! (-> s2-2 y) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 3))))) + (set! (-> s2-2 z) (string->float (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 4))))) + (set! (-> s2-2 w) 1.0) + (set! sv-176 s2-2) + ) + (vector+! sv-176 sv-176 (-> this level-offset)) + (let* ((s2-3 (-> this length)) + (s1-3 0) + (s0-0 (-> this data s1-3)) + ) + (while (< s1-3 s2-3) + (when (and s0-0 (= (-> s0-0 region) sv-36) (type? s0-0 editable-point)) + (when (vector= (the-as vector (&+ s0-0 28)) sv-176) + (set! sv-180 s0-0) + (set! sv-184 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 1))))) + (set! (-> sv-152 vertex sv-184) (the-as editable-point sv-180)) + (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-184 1))) + (set! (-> sv-180 owner) (cons sv-152 (-> sv-180 owner))) + (goto cfg-78) + ) + ) + (+! s1-3 1) + (set! s0-0 (-> this data s1-3)) + ) + ) + (if (< (-> sv-176 y) (the-as float sv-40)) + (set! sv-40 (-> sv-176 y)) + ) + (if (< (the-as float sv-44) (-> sv-176 y)) + (set! sv-44 (-> sv-176 y)) + ) + (set! sv-192 (get-length this)) + (when (>= sv-192 0) + (set! sv-200 (new 'debug 'editable-point sv-176 sv-36)) + (set! sv-208 (string->int (the-as string (-> sv-28 sql-data (+ (* 5 s3-7) 1))))) + (set! (-> this data sv-192) sv-200) + (set! (-> sv-152 vertex sv-208) sv-200) + (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-208 1))) + (set! (-> sv-200 owner) (cons sv-152 (-> sv-200 owner))) + ) + ) + ) + ) + (editable-method-30 sv-152 (editable-flag no-plane-snap)) + (editable-method-31 sv-152 (editable-flag no-plane-snap)) + ) + ) + ) + ) + (set! sv-64 (+ sv-64 5)) + ) + (let* ((v1-291 (-> this length)) + (a0-158 0) + (a1-57 (-> this data a0-158)) + ) + (while (< a0-158 v1-291) + (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) + (let ((a2-29 (&+ a1-57 28))) + (if (= (the-as float (-> a2-29 name)) (the-as float sv-40)) + (logior! (-> a1-57 flags) (editable-flag bot-set)) + ) + (if (= (the-as float (-> a2-29 name)) (the-as float sv-44)) + (logior! (-> a1-57 flags) (editable-flag top-set)) + ) + ) + ) + (+! a0-158 1) + (set! a1-57 (-> this data a0-158)) + ) + ) + (set! (-> sv-36 changed) #f) + (+! s4-6 6) + ) + ) + (let ((s4-7 sql-query)) + (format + (clear *temp-string*) + "select x,y,z from sample_point where level_info_id='~D' and source='manual'" + (-> this level-info-id) + ) + (set! sv-216 (s4-7 *temp-string*)) + ) + (if (!= (-> sv-216 content-type) 'select) + (return #f) + ) + (let ((s4-8 0)) + (while (< s4-8 (-> sv-216 length)) + (let ((s3-9 (get-length this))) + (when (>= s3-9 0) + (let ((s2-4 (new 'stack-no-clear 'vector))) + (set! (-> s2-4 x) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data s4-8))))) + (set! (-> s2-4 y) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 1)))))) + (set! (-> s2-4 z) (* 4096.0 (string->float (the-as string (-> sv-216 sql-data (+ s4-8 2)))))) + (set! (-> s2-4 w) 1.0) + (vector+! s2-4 s2-4 (-> this level-offset)) + (set! (-> this data s3-9) (new 'debug 'editable-sample s2-4 *editable-sample-region*)) + ) + ) + ) + (+! s4-8 3) + ) + ) + (set! (-> *editable-sample-region* changed) #f) + (load-editable-lights this) + (editable-array-method-19 this (the-as string arg0)) + (handle-cmd this (editable-command refresh-filter) (the-as mouse-info #f) #f) + #t + ) + +;; definition for method 19 of type editable-array +(defmethod editable-array-method-19 ((this editable-array) (arg0 string)) + (local-vars (sv-16 sql-result)) + (let ((s4-0 sql-query)) + (format + (clear *temp-string*) + "select entity_id,name,idx,position_x,position_y,position_z,rot_x,rot_y,rot_z from entity where level_id=~D and path like 'region-editor-%'" + (-> this level-info-id) + ) + (set! sv-16 (s4-0 *temp-string*)) + ) + (format #t "sql: read entity ~D~%" (/ (-> sv-16 length) 9)) + (if (!= (-> sv-16 content-type) 'select) + (return #f) + ) + (let ((s4-1 0)) + (while (< s4-1 (-> sv-16 length)) + (let ((s3-1 (get-length this))) + (when (>= s3-1 0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s2-0 x) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 3)))))) + (set! (-> s2-0 y) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 4)))))) + (set! (-> s2-0 z) (* 4096.0 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 5)))))) + (set! (-> s2-0 w) 1.0) + (vector+! s2-0 s2-0 (-> this level-offset)) + (let ((s1-0 (new 'debug 'editable-region))) + (let ((v1-22 s1-0)) + (set! (-> v1-22 locked) #t) + (set! (-> v1-22 changed) #f) + (set! (-> v1-22 tree) 'entity) + (set! (-> v1-22 filter) (editable-filter entity)) + (set! (-> v1-22 level) arg0) + ) + (let ((s2-1 (new 'debug 'editable-entity s2-0 6144.0 s1-0))) + (logclear! (-> s2-1 flags) (editable-flag changed)) + (set! (-> s1-0 changed) #f) + (set! (-> this data s3-1) s2-1) + (set! (-> s2-1 id) (the-as uint (string->int (the-as string (-> sv-16 sql-data s4-1))))) + (copy-string<-string (-> s2-1 name) (the-as string (-> sv-16 sql-data (+ s4-1 1)))) + (set! (-> s2-1 idx) (string->int (the-as string (-> sv-16 sql-data (+ s4-1 2))))) + (set-eul! + (-> s2-1 angles) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 6))))) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 7))))) + (* 182.04445 (string->float (the-as string (-> sv-16 sql-data (+ s4-1 8))))) + 21 + ) + ) + ) + ) + ) + ) + (+! s4-1 9) + ) + ) + (set! (-> *editable-entity-region* changed) #f) + #f + ) + +;; definition for method 14 of type editable-array +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-14 ((this editable-array) (arg0 editable-command) (arg1 editable-command) (arg2 string)) + (set! (-> this target) #f) + (set! (-> this target-mode) arg0) + (set! (-> this target-command) arg1) + (set! (-> this target-message) arg2) + 0 + (none) + ) + +;; definition for method 17 of type editable-array +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod editable-array-method-17 ((this editable-array)) + (cond + ((-> this edit-plane) + (editable-plane-method-37 (-> this edit-plane) (-> this edit-plane-normal)) + (vector-copy! (-> this edit-plane-center) (editable-method-15 (-> this edit-plane vertex 0))) + ) + (else + (vector-negate! (-> this edit-plane-normal) (-> *math-camera* inv-camera-rot fvec)) + (let ((v1-9 (vector-float*! (-> this edit-plane-center) (-> *math-camera* inv-camera-rot fvec) 24576.0))) + (vector+! v1-9 v1-9 (-> *math-camera* trans)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 18 of type editable-array +;; INFO: Used lq/sq +(defmethod editable-array-method-18 ((this editable-array) (arg0 vector) (arg1 vector)) + (cond + ((and (cpad-hold? 0 up) *target*) + (vector-copy! arg0 (get-trans *target* 0)) + ) + ((and (cpad-hold? 0 down) *camera*) + (vector-copy! arg0 (math-camera-pos)) + ) + (else + (editable-array-method-17 this) + (reverse-transform-point! arg0 (-> this edit-plane-center) (-> this edit-plane-normal) arg1) + ) + ) + arg0 + ) + +;; failed to figure out what this is: +(when (zero? *editable-sample-region*) + (let ((v1-6 (new 'debug 'editable-region))) + (set! (-> v1-6 locked) #t) + (set! (-> v1-6 changed) #f) + (set! (-> v1-6 tree) 'sample) + (set! (-> v1-6 filter) (editable-filter sample)) + (set! *editable-sample-region* v1-6) + ) + (let ((v1-8 (new 'debug 'editable-region))) + (set! (-> v1-8 locked) #t) + (set! (-> v1-8 changed) #f) + (set! (-> v1-8 tree) 'light) + (set! (-> v1-8 filter) (editable-filter light)) + (set! *editable-light-region* v1-8) + ) + (let ((v0-108 (new 'debug 'editable-region))) + (set! (-> v0-108 locked) #t) + (set! (-> v0-108 changed) #f) + (set! (-> v0-108 tree) 'entity) + (set! (-> v0-108 filter) (editable-filter entity)) + (set! *editable-entity-region* v0-108) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc b/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc index 426b751e7d..66f737a2bc 100644 --- a/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc +++ b/test/decompiler/reference/jak3/engine/debug/manipulator_REF.gc @@ -19,7 +19,7 @@ ) (:methods (set-mode (_type_ manipulator-mode) none) - (manipulator-method-10 (_type_) none) + (manipulator-method-10 (_type_ vector vector) none) (manipulator-method-11 (_type_) none) (manipulator-method-12 (_type_ vector) none) (manipulator-method-13 (_type_ vector vector) none) @@ -163,7 +163,131 @@ ) ;; definition for method 10 of type manipulator -;; ERROR: function was not converted to expressions. Cannot decompile. +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod manipulator-method-10 ((this manipulator) (arg0 vector) (arg1 vector)) + (local-vars (v1-11 symbol) (sv-160 symbol) (sv-176 vector)) + (set! sv-176 arg1) + (let ((s4-0 (-> this position))) + 0.0 + (let* ((v0-0 + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> *math-camera* trans) (-> this position)) 1.0) + ) + (s3-0 (< (fabs (vector-dot v0-0 (-> this mat rvec))) 0.9)) + (s2-0 (< (fabs (vector-dot v0-0 (-> this mat uvec))) 0.9)) + ) + (b! (< (fabs (vector-dot v0-0 (-> this mat fvec))) 0.9) cfg-6 :delay (set! v1-11 #t)) + (set! sv-160 v1-11) + (set! sv-160 #f) + (label cfg-6) + (let ((f28-0 (the-as float #x7f800000)) + (f30-1 (* 0.15 (vector-vector-distance (-> *math-camera* trans) s4-0))) + ) + (set! (-> this action) (manipulator-action ma0)) + (let ((s1-0 (new 'stack-no-clear 'vector))) + 0.0 + (let* ((s0-0 (new 'stack-no-clear 'vector)) + (v1-16 arg0) + (s0-1 (vector-! s0-0 sv-176 v1-16)) + ) + (let ((f0-14 (ray-sphere-intersect arg0 s0-1 s4-0 (/ f30-1 5)))) + (when (and (< 0.0 f0-14) (>= f28-0 f0-14)) + (set! f28-0 f0-14) + (set! (-> this action) (manipulator-action ma7)) + ) + ) + (when (= (-> this action) (manipulator-action ma0)) + (when (and s3-0 s2-0) + (let ((f0-18 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat uvec)) + f30-1 + ) + (* 0.3 f30-1) + ) + ) + ) + (when (and (< 0.0 f0-18) (>= f28-0 f0-18)) + (set! f28-0 f0-18) + (set! (-> this action) (manipulator-action ma4)) + ) + ) + ) + (when (and s3-0 sv-160) + (let ((f0-22 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat rvec) (-> this mat fvec)) + f30-1 + ) + (* 0.3 f30-1) + ) + ) + ) + (when (and (< 0.0 f0-22) (>= f28-0 f0-22)) + (set! f28-0 f0-22) + (set! (-> this action) (manipulator-action ma5)) + ) + ) + ) + (when (and s2-0 sv-160) + (let ((f0-26 (ray-sphere-intersect + arg0 + s0-1 + (vector+*! + (new 'stack-no-clear 'vector) + s4-0 + (vector+! (new 'stack-no-clear 'vector) (-> this mat uvec) (-> this mat fvec)) + f30-1 + ) + (* 0.3 f30-1) + ) + ) + ) + (when (and (< 0.0 f0-26) (>= f28-0 f0-26)) + (set! f28-0 f0-26) + (set! (-> this action) (manipulator-action ma6)) + ) + ) + ) + (when s3-0 + (let ((f0-31 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat rvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (when (and (< 0.0 f0-31) (>= f28-0 f0-31)) + (set! f28-0 f0-31) + (set! (-> this action) (manipulator-action ma1)) + ) + ) + ) + (when s2-0 + (let ((f0-36 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat uvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (if (and (< 0.0 f0-36) (>= f28-0 f0-36)) + (set! (-> this action) (manipulator-action ma2)) + ) + ) + ) + (when sv-160 + (let ((f0-41 (ray-cylinder-intersect arg0 s0-1 s4-0 (-> this mat fvec) (/ f30-1 10) (* 1.3 f30-1) s1-0))) + (if (and (< 0.0 f0-41) (>= f0-41 f0-41)) + (set! (-> this action) (manipulator-action ma3)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) ;; definition for method 11 of type manipulator ;; INFO: Used lq/sq @@ -486,3 +610,7 @@ 0 (none) ) + + + + diff --git a/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor-h_REF.gc b/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor-h_REF.gc new file mode 100644 index 0000000000..228917ab12 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor-h_REF.gc @@ -0,0 +1,465 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; definition of type vector-array +(deftype vector-array (inline-array-class) + ((data vector :inline :dynamic) + ) + ) + +;; definition for method 3 of type vector-array +(defmethod inspect ((this vector-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> vector-array heap-base) (the-as uint 16)) + +;; definition of type int16-array +(deftype int16-array (inline-array-class) + ((data int16 :dynamic) + ) + ) + +;; definition for method 3 of type int16-array +(defmethod inspect ((this int16-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> int16-array heap-base) (the-as uint 2)) + +;; definition of type nav-mesh-poly +(deftype nav-mesh-poly (structure) + ((poly-id uint32) + (flags nav-mesh-poly-flag) + (index int16-array) + (insert-pos uint32) + ) + (:methods + (new (symbol type) _type_) + (init-fields! (_type_) none) + (nav-mesh-poly-method-10 (_type_ nav-mesh-editable) none) + (nav-mesh-poly-method-11 (_type_ int) none) + (nav-mesh-poly-method-12 (_type_ int) none) + (nav-mesh-poly-method-13 (_type_ int) int) + (nav-mesh-poly-method-14 (_type_ int int) object) + ) + ) + +;; definition for method 3 of type nav-mesh-poly +(defmethod inspect ((this nav-mesh-poly)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'nav-mesh-poly) + (format #t "~1Tpoly-id: ~D~%" (-> this poly-id)) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tindex: ~A~%" (-> this index)) + (format #t "~1Tinsert-pos: ~D~%" (-> this insert-pos)) + (label cfg-4) + this + ) + +;; definition of type nav-mesh-poly-array +(deftype nav-mesh-poly-array (inline-array-class) + ((data nav-mesh-poly :inline :dynamic) + ) + ) + +;; definition for method 3 of type nav-mesh-poly-array +(defmethod inspect ((this nav-mesh-poly-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> nav-mesh-poly-array heap-base) (the-as uint 16)) + +;; definition for method 9 of type nav-mesh-poly +;; WARN: Return type mismatch int vs none. +(defmethod init-fields! ((this nav-mesh-poly)) + (set! (-> this index) (new 'debug 'int16-array 512)) + (set! (-> this index length) 0) + (set! (-> this insert-pos) (the-as uint 0)) + 0 + (none) + ) + +;; definition for method 0 of type nav-mesh-poly +;; WARN: Return type mismatch object vs nav-mesh-poly. +(defmethod new nav-mesh-poly ((allocation symbol) (type-to-make type)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (-> type-to-make size) + (let ((gp-0 (the-as object (t9-0 allocation v1-1)))) + (when (zero? (the-as structure gp-0)) + (set! gp-0 0) + (goto cfg-4) + ) + ((method-of-type nav-mesh-poly init-fields!) (the-as nav-mesh-poly gp-0)) + (label cfg-4) + (the-as nav-mesh-poly gp-0) + ) + ) + ) + +;; definition of type nav-mesh-tri-quad +(deftype nav-mesh-tri-quad (structure) + ((indices uint32 4) + (poly uint32) + ) + ) + +;; definition for method 3 of type nav-mesh-tri-quad +(defmethod inspect ((this nav-mesh-tri-quad)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'nav-mesh-tri-quad) + (format #t "~1Tindices[4] @ #x~X~%" (-> this indices)) + (format #t "~1Tpoly: ~D~%" (-> this poly)) + (label cfg-4) + this + ) + +;; definition of type nav-mesh-tri-quad-array +(deftype nav-mesh-tri-quad-array (inline-array-class) + ((data nav-mesh-tri-quad :inline :dynamic) + ) + ) + +;; definition for method 3 of type nav-mesh-tri-quad-array +(defmethod inspect ((this nav-mesh-tri-quad-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> nav-mesh-tri-quad-array heap-base) (the-as uint 32)) + +;; definition of type nav-mesh-editable +(deftype nav-mesh-editable (structure) + ((flags nav-mesh-editable-flag) + (verts vector-array) + (tris nav-mesh-tri-quad-array) + (quads nav-mesh-tri-quad-array) + (navmesh-id uint32) + (idx uint32) + (level-name symbol) + (level-id uint32) + (polys nav-mesh-poly-array) + (selected-poly uint32) + ) + (:methods + (new (symbol type) _type_) + (init-fields! (_type_) none) + (nav-mesh-editable-method-10 (_type_ symbol) none) + (add-vert! (_type_ vector) int) + (nav-mesh-editable-method-12 (_type_ vector symbol) object) + (nav-mesh-editable-method-13 (_type_) none) + (nav-mesh-editable-method-14 (_type_ vector) int) + (nav-mesh-editable-method-15 (_type_ int) object) + (nav-mesh-editable-method-16 (_type_) object) + (nav-mesh-editable-method-17 (_type_) object) + (nav-mesh-editable-method-18 (_type_) none) + ) + ) + +;; definition for method 3 of type nav-mesh-editable +(defmethod inspect ((this nav-mesh-editable)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'nav-mesh-editable) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tverts: ~A~%" (-> this verts)) + (format #t "~1Ttris: ~A~%" (-> this tris)) + (format #t "~1Tquads: ~A~%" (-> this quads)) + (format #t "~1Tnavmesh-id: ~D~%" (-> this navmesh-id)) + (format #t "~1Tidx: ~D~%" (-> this idx)) + (format #t "~1Tlevel-name: ~A~%" (-> this level-name)) + (format #t "~1Tlevel-id: ~D~%" (-> this level-id)) + (format #t "~1Tpolys: ~A~%" (-> this polys)) + (format #t "~1Tselected-poly: ~D~%" (-> this selected-poly)) + (label cfg-4) + this + ) + +;; definition of type nav-mesh-editable-array +(deftype nav-mesh-editable-array (inline-array-class) + ((data nav-mesh-editable :inline :dynamic) + ) + ) + +;; definition for method 3 of type nav-mesh-editable-array +(defmethod inspect ((this nav-mesh-editable-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> nav-mesh-editable-array heap-base) (the-as uint 48)) + +;; definition for method 9 of type nav-mesh-editable +;; WARN: Return type mismatch int vs none. +(defmethod init-fields! ((this nav-mesh-editable)) + (set! (-> this verts) (new 'debug 'vector-array 1024)) + (set! (-> this verts length) 0) + (set! (-> this tris) (new 'debug 'nav-mesh-tri-quad-array 512)) + (set! (-> this tris length) 0) + (set! (-> this quads) (new 'debug 'nav-mesh-tri-quad-array 512)) + (set! (-> this quads length) 0) + (set! (-> this polys) (new 'debug 'nav-mesh-poly-array 92)) + (dotimes (s5-0 (-> this polys length)) + (init-fields! (-> this polys data s5-0)) + (set! (-> this polys data s5-0 poly-id) (the-as uint s5-0)) + ) + (set! (-> this navmesh-id) (the-as uint 0)) + (logior! (-> this flags) (nav-mesh-editable-flag nmef0)) + 0 + (none) + ) + +;; definition for method 0 of type nav-mesh-editable +;; WARN: Return type mismatch object vs nav-mesh-editable. +(defmethod new nav-mesh-editable ((allocation symbol) (type-to-make type)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (-> type-to-make size) + (let ((gp-0 (the-as object (t9-0 allocation v1-1)))) + (when (zero? (the-as structure gp-0)) + (set! gp-0 0) + (goto cfg-4) + ) + ((method-of-type nav-mesh-editable init-fields!) (the-as nav-mesh-editable gp-0)) + (label cfg-4) + (the-as nav-mesh-editable gp-0) + ) + ) + ) + +;; definition of type nav-mesh-editor-undo +(deftype nav-mesh-editor-undo (structure) + ((current-nav-mesh nav-mesh-editable) + (selected-poly uint32) + (index int16-array) + (insert-pos uint32) + (verts vector-array) + ) + (:methods + (new (symbol type) _type_) + (init-fields! (_type_) none) + ) + ) + +;; definition for method 3 of type nav-mesh-editor-undo +(defmethod inspect ((this nav-mesh-editor-undo)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'nav-mesh-editor-undo) + (format #t "~1Tcurrent-nav-mesh: #~%" (-> this current-nav-mesh)) + (format #t "~1Tselected-poly: ~D~%" (-> this selected-poly)) + (format #t "~1Tindex: ~A~%" (-> this index)) + (format #t "~1Tinsert-pos: ~D~%" (-> this insert-pos)) + (format #t "~1Tverts: ~A~%" (-> this verts)) + (label cfg-4) + this + ) + +;; definition of type nav-mesh-editor-undo-array +(deftype nav-mesh-editor-undo-array (inline-array-class) + ((data nav-mesh-editor-undo :inline :dynamic) + ) + ) + +;; definition for method 3 of type nav-mesh-editor-undo-array +(defmethod inspect ((this nav-mesh-editor-undo-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> nav-mesh-editor-undo-array heap-base) (the-as uint 32)) + +;; definition for method 9 of type nav-mesh-editor-undo +;; WARN: Return type mismatch int vs none. +(defmethod init-fields! ((this nav-mesh-editor-undo)) + (set! (-> this index) (new 'debug 'int16-array 2048)) + (set! (-> this verts) (new 'debug 'vector-array 1024)) + 0 + (none) + ) + +;; definition for method 0 of type nav-mesh-editor-undo +;; WARN: Return type mismatch object vs nav-mesh-editor-undo. +(defmethod new nav-mesh-editor-undo ((allocation symbol) (type-to-make type)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (-> type-to-make size) + (let ((gp-0 (the-as object (t9-0 allocation v1-1)))) + (when (zero? (the-as structure gp-0)) + (set! gp-0 0) + (goto cfg-4) + ) + ((method-of-type nav-mesh-editor-undo init-fields!) (the-as nav-mesh-editor-undo gp-0)) + (label cfg-4) + (the-as nav-mesh-editor-undo gp-0) + ) + ) + ) + +;; definition of type nav-mesh-editor +(deftype nav-mesh-editor (process-drawable) + ((close-menu-time time-frame) + (external-cam-mode symbol) + (mouse-pressed time-frame) + (mouse-screen-pos vector :inline) + (mouse-pos vector :inline) + (mouse-end vector :inline) + (mouse-hit vector :inline) + (mouse-hit-pick vector :inline) + (mouse-snap vector :inline) + (mouse-normal vector :inline) + (mouse-collide basic) + (mouse-tumble-dist float) + (mouse-tumble vector :inline) + (manipulator-pos vector :inline) + (manipulator-back-pos vector :inline) + (lock-action basic) + (mouse-action uint32) + (mouse-action-pos-ref vector :inline) + (nav-meshes nav-mesh-editable-array) + (current-nav-mesh nav-mesh-editable) + (manipulator manipulator :inline) + (level-name string) + (level-id uint32) + (undo-min uint32) + (undo-id uint32) + (undo-max uint32) + (undos nav-mesh-editor-undo-array) + (hide-unselected symbol) + (allow-snap symbol) + ) + (:state-methods + idle + ) + (:methods + (nav-mesh-editor-method-21 (_type_) none) + (nav-mesh-editor-method-22 (_type_) none) + (set-level-info! (_type_ symbol) none) + (select-nav-mesh-by-id (_type_ int) object) + (nav-mesh-editor-method-25 (_type_) none) + (nav-mesh-editor-method-26 (_type_) none) + (nav-mesh-editor-method-27 (_type_) object) + ) + ) + +;; definition for method 3 of type nav-mesh-editor +(defmethod inspect ((this nav-mesh-editor)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tclose-menu-time: ~D~%" (-> this close-menu-time)) + (format #t "~2Texternal-cam-mode: ~A~%" (-> this external-cam-mode)) + (format #t "~2Tmouse-pressed: ~D~%" (-> this mouse-pressed)) + (format #t "~2Tmouse-screen-pos: #~%" (-> this mouse-screen-pos)) + (format #t "~2Tmouse-pos: #~%" (-> this mouse-pos)) + (format #t "~2Tmouse-end: #~%" (-> this mouse-end)) + (format #t "~2Tmouse-hit: #~%" (-> this mouse-hit)) + (format #t "~2Tmouse-hit-pick: #~%" (-> this mouse-hit-pick)) + (format #t "~2Tmouse-snap: #~%" (-> this mouse-snap)) + (format #t "~2Tmouse-normal: #~%" (-> this mouse-normal)) + (format #t "~2Tmouse-collide: ~A~%" (-> this mouse-collide)) + (format #t "~2Tmouse-tumble-dist: ~f~%" (-> this mouse-tumble-dist)) + (format #t "~2Tmouse-tumble: #~%" (-> this mouse-tumble)) + (format #t "~2Tmanipulator-pos: #~%" (-> this manipulator-pos)) + (format #t "~2Tmanipulator-back-pos: #~%" (-> this manipulator-back-pos)) + (format #t "~2Tlock-action: ~A~%" (-> this lock-action)) + (format #t "~2Tmouse-action: ~D~%" (-> this mouse-action)) + (format #t "~2Tmouse-action-pos-ref: #~%" (-> this mouse-action-pos-ref)) + (format #t "~2Tnav-meshes: ~A~%" (-> this nav-meshes)) + (format #t "~2Tcurrent-nav-mesh: #~%" (-> this current-nav-mesh)) + (format #t "~2Tmanipulator: #~%" (-> this manipulator)) + (format #t "~2Tlevel-name: ~A~%" (-> this level-name)) + (format #t "~2Tlevel-id: ~D~%" (-> this level-id)) + (format #t "~2Tundo-min: ~D~%" (-> this undo-min)) + (format #t "~2Tundo-id: ~D~%" (-> this undo-id)) + (format #t "~2Tundo-max: ~D~%" (-> this undo-max)) + (format #t "~2Tundos: ~A~%" (-> this undos)) + (format #t "~2Thide-unselected: ~A~%" (-> this hide-unselected)) + (format #t "~2Tallow-snap: ~A~%" (-> this allow-snap)) + (label cfg-4) + this + ) + +;; definition for symbol *nav-mesh-editor*, type (pointer nav-mesh-editor) +(define *nav-mesh-editor* (the-as (pointer nav-mesh-editor) #f)) + +;; failed to figure out what this is: +0 diff --git a/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor_REF.gc b/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor_REF.gc new file mode 100644 index 0000000000..400c2f653e --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/nav-mesh-editor_REF.gc @@ -0,0 +1,4981 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; definition for function snap-level-navmesh +;; INFO: Used lq/sq +(defun snap-level-navmesh ((arg0 vector) (arg1 vector)) + (local-vars (sv-96 nav-poly) (sv-112 vector) (sv-128 int)) + (dotimes (s4-0 (-> *level* length)) + (let ((v1-3 (-> *level* level s4-0))) + (when (= (-> v1-3 status) 'active) + (let ((s3-0 (-> v1-3 bsp nav-meshes))) + (when (nonzero? s3-0) + (dotimes (s2-0 (-> s3-0 length)) + (let ((s1-0 (-> s3-0 s2-0))) + (-> s1-0 aid) + (let ((v1-8 (as-type s1-0 entity-nav-mesh))) + (when v1-8 + (let ((s1-1 (-> v1-8 nav-mesh))) + (new 'stack-no-clear 'vector) + (dotimes (s0-0 (the-as int (-> s1-1 poly-count))) + (set! sv-96 (-> s1-1 poly-array s0-0)) + (set! sv-112 (new 'stack-no-clear 'vector)) + (set! sv-128 0) + (while (< sv-128 (the-as int (-> sv-96 vertex-count))) + (when (transform-point-vector! + sv-112 + (vector+! (new 'stack-no-clear 'vector) (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) + ) + (when (and (< (fabs (- (-> arg0 x) (+ -2048.0 (-> sv-112 x)))) 8.0) + (< (fabs (- (-> arg0 y) (+ -2048.0 (-> sv-112 y)))) 8.0) + ) + (vector+! arg1 (the-as vector (-> s1-1 bounds)) (-> sv-96 vertex sv-128)) + (return #t) + ) + ) + (set! sv-128 (+ sv-128 1)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + +;; definition for method 11 of type nav-mesh-editable +;; INFO: Used lq/sq +(defmethod add-vert! ((this nav-mesh-editable) (arg0 vector)) + (vector-copy! (-> this verts data (-> this verts length)) arg0) + (+! (-> this verts length) 1) + (+ (-> this verts length) -1) + ) + +;; definition for method 12 of type nav-mesh-editable +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-editable-method-12 ((this nav-mesh-editable) (arg0 vector) (arg1 symbol)) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (dotimes (s2-0 (-> this polys length)) + (let ((s1-0 (-> this polys data s2-0))) + (dotimes (s0-0 (-> s1-0 index length)) + (when (transform-point-vector! s3-0 (-> this verts data (-> s1-0 index data s0-0))) + (if (and (< (fabs (- (-> arg0 x) (+ -2048.0 (-> s3-0 x)))) 8.0) + (and (< (fabs (- (-> arg0 y) (+ -2048.0 (-> s3-0 y)))) 8.0) + (or (not arg1) (!= (-> s1-0 index data s0-0) (-> this + polys + data + (-> this selected-poly) + index + data + (-> this polys data (-> this selected-poly) insert-pos) + ) + ) + ) + ) + ) + (return (the-as object (-> s1-0 index data s0-0))) + ) + ) + ) + ) + ) + ) + -1 + ) + +;; definition for function mouse-intersect-triangle +(defun mouse-intersect-triangle ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let ((s5-0 (normal-of-plane (new 'stack-no-clear 'vector) arg1 arg2 arg3)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (reverse-transform-point! gp-0 arg1 s5-0 arg0) + (let ((s1-1 (vector-negate! (new 'stack-no-clear 'vector) s5-0))) + (if (or (point-in-triangle-cross gp-0 s5-0 arg1 arg2 arg3) (point-in-triangle-cross gp-0 s1-1 arg1 arg2 arg3)) + (return (vector-vector-distance (camera-pos) gp-0)) + ) + ) + ) + -1.0 + ) + +;; definition for method 14 of type nav-mesh-editable +;; INFO: Used lq/sq +(defmethod nav-mesh-editable-method-14 ((this nav-mesh-editable) (arg0 vector)) + (dotimes (s4-0 (-> this tris length)) + (let ((s3-0 (-> this tris data s4-0))) + (-> this tris data s4-0) + (let ((v1-5 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (a0-3 4) + (set! (-> v1-5 a0-3 quad) (the-as uint128 0)) + ) + ) + (if (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-0 indices 0)) + (-> this verts data (-> s3-0 indices 1)) + (-> this verts data (-> s3-0 indices 2)) + ) + ) + (return (the-as int (-> s3-0 poly))) + ) + ) + ) + (dotimes (s4-1 (-> this quads length)) + (let ((s3-1 (-> this quads data s4-1))) + (-> this quads data s4-1) + (let ((v1-27 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (a0-9 4) + (set! (-> v1-27 a0-9 quad) (the-as uint128 0)) + ) + ) + (if (or (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-1 indices 0)) + (-> this verts data (-> s3-1 indices 2)) + (-> this verts data (-> s3-1 indices 3)) + ) + ) + (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-1 indices 0)) + (-> this verts data (-> s3-1 indices 3)) + (-> this verts data (-> s3-1 indices 2)) + ) + ) + (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-1 indices 0)) + (-> this verts data (-> s3-1 indices 2)) + (-> this verts data (-> s3-1 indices 1)) + ) + ) + (< 0.0 (mouse-intersect-triangle + arg0 + (-> this verts data (-> s3-1 indices 0)) + (-> this verts data (-> s3-1 indices 3)) + (-> this verts data (-> s3-1 indices 1)) + ) + ) + ) + (return (the-as int (-> s3-1 poly))) + ) + ) + ) + -1 + ) + +;; definition for method 13 of type nav-mesh-editable +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-mesh-editable-method-13 ((this nav-mesh-editable)) + (set! (-> this tris length) 0) + (set! (-> this quads length) 0) + (dotimes (s5-0 (-> this polys length)) + (let ((a0-2 (-> this polys data s5-0))) + (if (nonzero? (-> a0-2 index length)) + (nav-mesh-poly-method-10 a0-2 this) + ) + ) + ) + (none) + ) + +;; definition for method 10 of type nav-mesh-editable +;; WARN: Return type mismatch int vs none. +(defmethod nav-mesh-editable-method-10 ((this nav-mesh-editable) (arg0 symbol)) + (let ((s4-0 (-> this tris)) + (s3-0 (-> this verts)) + ) + (dotimes (s2-0 (-> s4-0 length)) + (let ((s1-0 (-> s4-0 data s2-0))) + (if arg0 + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (-> s3-0 data (-> s1-0 indices 0)) + (-> s3-0 data (-> s1-0 indices 1)) + (-> s3-0 data (-> s1-0 indices 2)) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x20) + ) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s3-0 data (-> s1-0 indices 2)) + (-> s3-0 data (-> s1-0 indices 0)) + (if (and arg0 (= (-> s4-0 data s2-0 poly) (-> this selected-poly))) + *color-red* + *color-light-red* + ) + #f + (the-as rgba -1) + ) + ) + ) + ) + (let ((s4-1 (-> this quads)) + (s3-1 (-> this verts)) + ) + (dotimes (s2-1 (-> s4-1 length)) + (let ((s1-1 (-> s4-1 data s2-1))) + (when arg0 + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (-> s3-1 data (-> s1-1 indices 0)) + (-> s3-1 data (-> s1-1 indices 1)) + (-> s3-1 data (-> s1-1 indices 2)) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x20) + ) + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (-> s3-1 data (-> s1-1 indices 0)) + (-> s3-1 data (-> s1-1 indices 2)) + (-> s3-1 data (-> s1-1 indices 3)) + (new 'static 'rgba :r #x80 :g #x40 :b #x80 :a #x20) + ) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s3-1 data (-> s1-1 indices 3)) + (-> s3-1 data (-> s1-1 indices 0)) + (if (and arg0 (= (-> s4-1 data s2-1 poly) (-> this selected-poly))) + *color-red* + *color-light-red* + ) + #f + (the-as rgba -1) + ) + ) + ) + ) + (dotimes (s4-2 (-> this polys length)) + (let ((s3-2 (-> this polys data s4-2)) + (s2-2 (and arg0 (= s4-2 (-> this selected-poly)))) + ) + (let ((s1-2 (if s2-2 + *color-blue* + *color-light-blue* + ) + ) + ) + (dotimes (s0-0 (-> s3-2 index length)) + (let ((a2-5 (-> s3-2 index data (mod (+ s0-0 1) (-> s3-2 index length)))) + (v1-70 (-> s3-2 index data s0-0)) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> this verts data a2-5) + (-> this verts data v1-70) + s1-2 + #f + (the-as rgba -1) + ) + ) + ) + ) + (when (and s2-2 (< 1 (-> s3-2 index length))) + (let ((v1-86 (-> s3-2 index data (mod (the-as int (+ (-> s3-2 insert-pos) 1)) (-> s3-2 index length)))) + (a2-9 (-> s3-2 index data (-> s3-2 insert-pos))) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> this verts data a2-9) + (-> this verts data v1-86) + *color-green* + #f + *color-white* + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for symbol *clean-vertex-array*, type (inline-array vector) +(define *clean-vertex-array* (new 'static 'inline-array vector 1024 + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + (new 'static 'vector) + ) + ) + +;; definition for symbol *clean-index-array*, type (pointer int32) +(define *clean-index-array* (new 'static 'array int32 1024 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ) + ) + +;; definition for method 17 of type nav-mesh-editable +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-editable-method-17 ((this nav-mesh-editable)) + (local-vars (sv-16 symbol) (sv-32 int) (sv-48 vector)) + (let ((s5-0 0)) + (let ((s4-0 0)) + (b! #t cfg-33 :delay (nop!)) + (label cfg-1) + (let ((s3-0 (-> this polys data s4-0)) + (s2-0 0) + ) + (let ((s0-0 -1) + (s1-0 0) + ) + (b! #t cfg-28 :delay (nop!)) + (label cfg-2) + (set! sv-16 (the-as symbol #f)) + (set! sv-48 (-> this verts data (-> s3-0 index data s1-0))) + (b! (not #t) cfg-25 :delay (nop!)) + (let ((v1-10 (or (= s0-0 -1) + (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* s0-0)) sv-48)) + ) + ) + ) + (b! (not v1-10) cfg-13 :likely-delay (set! v1-13 v1-10)) + ) + (let ((a0-10 (!= s1-0 (+ (-> s3-0 index length) -1)))) + (b! a0-10 cfg-13 :likely-delay (set! v1-17 a0-10)) + ) + (< 204.8 (vector-vector-distance (-> *clean-vertex-array* (-> *clean-index-array* 0)) sv-48)) + (label cfg-13) + (set! sv-32 0) + (while (< sv-32 s5-0) + (when (and (not sv-16) (< (vector-vector-distance (-> *clean-vertex-array* sv-32) sv-48) 204.8)) + (set! sv-16 #t) + (set! s0-0 sv-32) + (set! (-> *clean-index-array* s2-0) sv-32) + (+! s2-0 1) + ) + (set! sv-32 (+ sv-32 1)) + ) + (when (not sv-16) + (vector-copy! (-> *clean-vertex-array* s5-0) sv-48) + (set! s0-0 s5-0) + (set! (-> *clean-index-array* s2-0) s5-0) + (+! s2-0 1) + (+! s5-0 1) + ) + (b! #t cfg-27 :delay (nop!)) + (label cfg-25) + (if (>= (the-as int (-> s3-0 insert-pos)) s1-0) + (set! (-> s3-0 insert-pos) (the-as uint s0-0)) + ) + (label cfg-27) + (+! s1-0 1) + (label cfg-28) + (b! (< s1-0 (-> s3-0 index length)) cfg-2) + ) + (set! (-> s3-0 index length) s2-0) + (dotimes (v1-52 s2-0) + (set! (-> s3-0 index data v1-52) (-> *clean-index-array* v1-52)) + ) + ) + (+! s4-0 1) + (label cfg-33) + (b! (< s4-0 (-> this polys length)) cfg-1) + ) + (set! (-> this verts length) s5-0) + (dotimes (v1-60 s5-0) + (vector-copy! (-> this verts data v1-60) (-> *clean-vertex-array* v1-60)) + ) + ) + (nav-mesh-editable-method-13 this) + 0 + ) + +;; definition for method 14 of type nav-mesh-poly +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-poly-method-14 ((this nav-mesh-poly) (arg0 int) (arg1 int)) + (set! (-> this poly-id) (the-as uint arg1)) + (set! (-> this index length) 0) + (let ((s3-0 (clear *temp-string*))) + (format + s3-0 + "select navmesh_vertex_idx,navmesh_shape_idx from navmesh_shape where entity_id=~D and navmesh_poly_idx=~D~%" + arg0 + arg1 + ) + (let ((s5-1 (sql-query s3-0))) + (when (!= (-> s5-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s5-1 this) + (return (the-as object #f)) + ) + (let ((s4-1 0)) + (while (< s4-1 (-> s5-1 length)) + (set! (-> this index data (string->int (the-as string (-> s5-1 sql-data (+ s4-1 1))))) + (string->int (the-as string (-> s5-1 sql-data s4-1))) + ) + (+! (-> this index length) 1) + (+! s4-1 2) + ) + ) + ) + ) + 0 + ) + +;; definition for method 15 of type nav-mesh-editable +;; WARN: Return type mismatch int vs object. +;; WARN: new jak 2 until loop case, check carefully +(defmethod nav-mesh-editable-method-15 ((this nav-mesh-editable) (arg0 int)) + (set! (-> this verts length) 0) + (let ((s3-0 (clear *temp-string*)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-0 x) 0.0) + (set! (-> s4-0 y) 0.0) + (set! (-> s4-0 z) 0.0) + (clear s3-0) + (format + s3-0 + "select translate_x,translate_y,translate_z from level_info where level_info_id=~D~%" + (-> this level-id) + ) + (let ((s2-0 (sql-query s3-0))) + (when (!= (-> s2-0 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s2-0 this) + (return (the-as object #f)) + ) + (set! (-> s4-0 x) (string->float (the-as string (-> s2-0 sql-data 0)))) + (set! (-> s4-0 y) (string->float (the-as string (-> s2-0 sql-data 1)))) + (set! (-> s4-0 z) (string->float (the-as string (-> s2-0 sql-data 2)))) + ) + (clear s3-0) + (format s3-0 "select navmesh_vertex_idx,x,y,z from navmesh_vertex where entity_id=~D~%" arg0) + (let ((s3-1 (sql-query s3-0))) + (when (!= (-> s3-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s3-1 this) + (return (the-as object #f)) + ) + (let ((s2-1 0)) + 0 + (while (< s2-1 (-> s3-1 length)) + (set-vector! + (-> this verts data (string->int (the-as string (-> s3-1 sql-data s2-1)))) + (* 4096.0 (+ (-> s4-0 x) (string->float (the-as string (-> s3-1 sql-data (+ s2-1 1)))))) + (* 4096.0 (+ (-> s4-0 y) (string->float (the-as string (-> s3-1 sql-data (+ s2-1 2)))))) + (* 4096.0 (+ (-> s4-0 z) (string->float (the-as string (-> s3-1 sql-data (+ s2-1 3)))))) + 1.0 + ) + (+! (-> this verts length) 1) + (+! s2-1 4) + ) + ) + ) + ) + (dotimes (v1-32 92) + (set! (-> this polys data v1-32 index length) 0) + ) + (let ((s4-1 (clear *temp-string*))) + (format s4-1 "select navmesh_poly_idx,flag from navmesh_poly where entity_id=~D~%" arg0) + (let ((s4-2 (sql-query s4-1))) + (when (!= (-> s4-2 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s4-2 this) + (return (the-as object #f)) + ) + (let ((s3-2 0) + (s2-2 0) + ) + (while (< s3-2 (-> s4-2 length)) + (let ((a2-6 (string->int (the-as string (-> s4-2 sql-data s3-2))))) + (nav-mesh-poly-method-14 (-> this polys data s2-2) arg0 a2-6) + ) + (set! (-> this polys data s2-2 flags) (nav-mesh-poly-flag)) + (let ((s1-1 (new 'global 'string 0 (the-as string (-> s4-2 sql-data (+ s3-2 1)))))) + (copy-string<-string s1-1 (the-as string (-> s4-2 sql-data (+ s3-2 1)))) + (until #f + (cond + ((string-prefix= "gap" s1-1) + (logior! (-> this polys data s2-2 flags) (nav-mesh-poly-flag gap)) + ) + ((string-prefix= "off" s1-1) + (logior! (-> this polys data s2-2 flags) (nav-mesh-poly-flag off)) + ) + ((string-prefix= "switch" s1-1) + (logior! (-> this polys data s2-2 flags) (nav-mesh-poly-flag nmpf2)) + ) + ((string-prefix= "user0" s1-1) + (logior! (-> this polys data s2-2 flags) (nav-mesh-poly-flag user0)) + ) + (else + #t + (goto cfg-30) + ) + ) + (let ((a1-20 (string-skip-to-char (-> s1-1 data) (the-as uint 44)))) + (if (= (-> a1-20 0) 44) + (set! a1-20 (&-> a1-20 1)) + ) + (string-suck-up! s1-1 a1-20) + ) + ) + ) + #f + (label cfg-30) + (+! s2-2 1) + (+! s3-2 2) + ) + ) + ) + ) + (logclear! (-> this flags) (nav-mesh-editable-flag nmef0)) + (nav-mesh-editable-method-17 this) + (set! (-> this navmesh-id) (the-as uint arg0)) + 0 + ) + +;; definition for function poly-flag-to-string +;; WARN: Return type mismatch symbol vs object. +(defun poly-flag-to-string ((arg0 object) (arg1 nav-mesh-poly-flag)) + (let ((v1-0 #t)) + (when (logtest? arg1 (nav-mesh-poly-flag gap)) + (if (not v1-0) + (format arg0 ",") + ) + (format arg0 "gap") + (set! v1-0 #f) + ) + (when (logtest? arg1 (nav-mesh-poly-flag off)) + (if (not v1-0) + (format arg0 ",") + ) + (format arg0 "off") + (set! v1-0 #f) + ) + (when (logtest? arg1 (nav-mesh-poly-flag user0)) + (if (not v1-0) + (format arg0 ",") + ) + (format arg0 "user0") + #f + ) + ) + ) + +;; definition for method 18 of type nav-mesh-editable +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 18 nav-mesh-editable) has a return type of none, but the expression builder found a return statement. +(defmethod nav-mesh-editable-method-18 ((this nav-mesh-editable)) + (format #t "Deleting nav-mesh ~D...~%" (-> this navmesh-id)) + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "delete from navmesh_vertex where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-2 (sql-query s5-0))) + (when (!= (-> a2-2 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-2 this) + (return #f) + ) + ) + ) + (let ((s5-1 (clear *temp-string*))) + (format s5-1 "delete from navmesh_shape where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-4 (sql-query s5-1))) + (when (!= (-> a2-4 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-4 this) + (return #f) + ) + ) + ) + (let ((s5-2 (clear *temp-string*))) + (format s5-2 "delete from navmesh_face where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-6 (sql-query s5-2))) + (when (!= (-> a2-6 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-6 this) + (return #f) + ) + ) + ) + (let ((s5-3 (clear *temp-string*))) + (format s5-3 "delete from navmesh_poly where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-8 (sql-query s5-3))) + (when (!= (-> a2-8 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-8 this) + (return #f) + ) + ) + ) + (let ((s5-4 (clear *temp-string*))) + (format s5-4 "delete from entity where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-10 (sql-query s5-4))) + (when (!= (-> a2-10 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-10 this) + (return #f) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 16 of type nav-mesh-editable +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-editable-method-16 ((this nav-mesh-editable)) + (format #t "Saving nav-mesh ~D~%" (-> this navmesh-id)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (clear *temp-string*))) + (format + s5-0 + "select translate_x,translate_y,translate_z from level_info where level_info_id=~D~%" + (-> this level-id) + ) + (let ((s5-1 (sql-query s5-0))) + (when (!= (-> s5-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s5-1 this) + (return (the-as object #f)) + ) + (set! (-> s4-0 x) (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 0))))) + (set! (-> s4-0 y) (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 1))))) + (set! (-> s4-0 z) (* 4096.0 (string->float (the-as string (-> s5-1 sql-data 2))))) + ) + ) + (let ((s5-2 (new-stack-vector0))) + (dotimes (v1-7 (-> this verts length)) + (vector+! s5-2 s5-2 (-> this verts data v1-7)) + ) + (let ((v1-10 s5-2) + (a0-13 s5-2) + (f0-7 (the float (-> this verts length))) + ) + (vector-float*! v1-10 a0-13 (/ 1.0 f0-7)) + ) + (set! (-> s5-2 x) (- (-> s5-2 x) (-> s4-0 x))) + (set! (-> s5-2 y) (- (-> s5-2 y) (-> s4-0 y))) + (set! (-> s5-2 z) (- (-> s5-2 z) (-> s4-0 z))) + (cond + ((nonzero? (-> this navmesh-id)) + (let ((s4-1 (clear *temp-string*))) + (format s4-1 "update entity set ") + (format s4-1 "level_id=~D," (-> this level-id)) + (format s4-1 "position_x=~M," (-> s5-2 x)) + (format s4-1 "position_y=~M," (-> s5-2 y)) + (format s4-1 "position_z=~M " (-> s5-2 z)) + (format s4-1 "where ") + (format s4-1 "entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-11 (sql-query s4-1))) + (when (!= (-> a2-11 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-11 this) + (set! (-> this navmesh-id) (the-as uint 0)) + (return (the-as object #f)) + ) + ) + ) + ) + (else + (let ((s4-2 (clear *temp-string*))) + (format s4-2 "select ifnull(max(idx) + 1, 1) from entity where name='nav-mesh'~%") + (let ((a2-12 (sql-query s4-2))) + (when (!= (-> a2-12 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-12 this) + (return (the-as object #f)) + ) + (set! (-> this idx) (the-as uint (string->int (the-as string (-> a2-12 sql-data 0))))) + ) + (clear s4-2) + (format s4-2 "insert entity set ") + (format s4-2 "level_id=~D," (-> this level-id)) + (format s4-2 "name='nav-mesh',") + (format s4-2 "idx=~D," (-> this idx)) + (format s4-2 "path='navmesh-editor-~D'," (-> this idx)) + (format s4-2 "position_x=~M," (-> s5-2 x)) + (format s4-2 "position_y=~M," (-> s5-2 y)) + (format s4-2 "position_z=~M~%" (-> s5-2 z)) + (let ((a2-19 (sql-query s4-2))) + (when (!= (-> a2-19 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-19 this) + (set! (-> this navmesh-id) (the-as uint 0)) + (return (the-as object #f)) + ) + ) + ) + (let ((v1-22 (sql-query "select LAST_INSERT_ID()"))) + (if (= (-> v1-22 content-type) 'select) + (set! (-> this navmesh-id) (the-as uint (string->int (the-as string (-> v1-22 sql-data 0))))) + ) + ) + ) + ) + ) + ) + (format 0 "Saving vertices ...~%") + (let ((s5-3 (clear *temp-string*)) + (s4-3 (new 'stack-no-clear 'vector)) + (s3-0 0) + ) + (format s5-3 "delete from navmesh_vertex where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-21 (sql-query s5-3))) + (when (!= (-> a2-21 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-21 this) + (return (the-as object #f)) + ) + ) + (clear s5-3) + (format + s5-3 + "select translate_x,translate_y,translate_z from level_info where level_info_id=~D~%" + (-> this level-id) + ) + (let ((s2-0 (sql-query s5-3))) + (when (!= (-> s2-0 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s2-0 this) + (return (the-as object #f)) + ) + (set! (-> s4-3 x) (* 4096.0 (string->float (the-as string (-> s2-0 sql-data 0))))) + (set! (-> s4-3 y) (* 4096.0 (string->float (the-as string (-> s2-0 sql-data 1))))) + (set! (-> s4-3 z) (* 4096.0 (string->float (the-as string (-> s2-0 sql-data 2))))) + ) + (clear s5-3) + (dotimes (s2-1 (-> this verts length)) + (if (zero? s3-0) + (format s5-3 "insert into navmesh_vertex (entity_id,navmesh_vertex_idx,x,y,z) values ") + (format s5-3 ", ") + ) + (format + s5-3 + "(~D,~D,~M,~M,~M)" + (-> this navmesh-id) + s2-1 + (- (-> this verts data s2-1 x) (-> s4-3 x)) + (- (-> this verts data s2-1 y) (-> s4-3 y)) + (- (-> this verts data s2-1 z) (-> s4-3 z)) + ) + (+! s3-0 1) + (when (>= s3-0 16) + (format s5-3 "~%") + (let ((a2-25 (sql-query s5-3))) + (when (!= (-> a2-25 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-25 this) + (return (the-as object #f)) + ) + ) + (set! s3-0 0) + (clear s5-3) + ) + ) + (when (> s3-0 0) + (format s5-3 "~%") + (let ((a2-26 (sql-query s5-3))) + (when (!= (-> a2-26 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-26 this) + (return (the-as object #f)) + ) + ) + ) + ) + (format 0 "Saving polygons ...~%") + (let ((s5-4 0) + (s4-4 (clear *temp-string*)) + ) + (format s4-4 "delete from navmesh_shape where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-28 (sql-query s4-4))) + (when (!= (-> a2-28 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-28 this) + (return (the-as object #f)) + ) + ) + (clear s4-4) + (format s4-4 "delete from navmesh_poly where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-30 (sql-query s4-4))) + (when (!= (-> a2-30 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-30 this) + (return (the-as object #f)) + ) + ) + (dotimes (s3-1 (-> this polys length)) + (let ((s2-2 (-> this polys data s3-1))) + (when (< 2 (-> s2-2 index length)) + (let ((s1-0 0)) + (clear s4-4) + (format s4-4 "insert navmesh_poly set navmesh_poly_idx=~D,entity_id=~D,flag='" s5-4 (-> this navmesh-id)) + (poly-flag-to-string s4-4 (-> s2-2 flags)) + (format s4-4 "'~%") + (let ((a2-32 (sql-query s4-4))) + (when (!= (-> a2-32 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-32 this) + (return (the-as object #f)) + ) + ) + (clear s4-4) + (dotimes (s0-0 (-> s2-2 index length)) + (if (zero? s1-0) + (format + s4-4 + "insert into navmesh_shape (entity_id,navmesh_poly_idx,navmesh_vertex_idx,navmesh_shape_idx) values " + ) + (format s4-4 ", ") + ) + (format s4-4 "(~D,~D,~D,~D)" (-> this navmesh-id) s5-4 (-> s2-2 index data s0-0) s0-0) + (+! s1-0 1) + (when (>= s1-0 16) + (format s4-4 "~%") + (let ((a2-34 (sql-query s4-4))) + (when (!= (-> a2-34 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-34 this) + (return (the-as object #f)) + ) + ) + (set! s1-0 0) + (clear s4-4) + ) + ) + (when (> s1-0 0) + (format s4-4 "~%") + (let ((a2-35 (sql-query s4-4))) + (when (!= (-> a2-35 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-35 this) + (return (the-as object #f)) + ) + ) + ) + ) + (+! s5-4 1) + ) + ) + ) + ) + (format 0 "Saving faces ...~%") + (let ((s5-5 (clear *temp-string*)) + (s4-5 0) + ) + (format s5-5 "delete from navmesh_face where entity_id=~D~%" (-> this navmesh-id)) + (let ((a2-37 (sql-query s5-5))) + (when (!= (-> a2-37 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-37 this) + (return (the-as object #f)) + ) + ) + (clear s5-5) + (dotimes (s3-2 (-> this tris length)) + (if (zero? s4-5) + (format + s5-5 + "insert into navmesh_face (entity_id,navmesh_vertex_idx_1,navmesh_vertex_idx_2,navmesh_vertex_idx_3,navmesh_vertex_idx_4,flag) values " + ) + (format s5-5 ", ") + ) + (format + s5-5 + "(~D,~D,~D,~D,~D,'" + (-> this navmesh-id) + (-> (the-as (inline-array nav-mesh-tri-quad) (+ (* s3-2 32) (the-as int (-> this tris)))) 0 indices 3) + (-> this tris data s3-2 indices 1) + (-> this tris data s3-2 indices 2) + -1 + ) + (poly-flag-to-string s5-5 (-> this polys data (-> this tris data s3-2 poly) flags)) + (format s5-5 "')") + (+! s4-5 1) + (when (>= s4-5 16) + (format s5-5 "~%") + (let ((a2-40 (sql-query s5-5))) + (when (!= (-> a2-40 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-40 this) + (return (the-as object #f)) + ) + ) + (set! s4-5 0) + (clear s5-5) + ) + ) + (dotimes (s3-3 (-> this quads length)) + (if (zero? s4-5) + (format + s5-5 + "insert into navmesh_face (entity_id,navmesh_vertex_idx_1,navmesh_vertex_idx_2,navmesh_vertex_idx_3,navmesh_vertex_idx_4,flag) values " + ) + (format s5-5 ", ") + ) + (format + s5-5 + "(~D,~D,~D,~D,~D,'" + (-> this navmesh-id) + (-> this quads data s3-3 indices 0) + (-> this quads data s3-3 indices 1) + (-> this quads data s3-3 indices 2) + (-> this quads data s3-3 indices 3) + ) + (poly-flag-to-string s5-5 (-> this polys data (-> this quads data s3-3 poly) flags)) + (format s5-5 "')") + (+! s4-5 1) + (when (>= s4-5 16) + (format s5-5 "~%") + (let ((a2-43 (sql-query s5-5))) + (when (!= (-> a2-43 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-43 this) + (return (the-as object #f)) + ) + ) + (set! s4-5 0) + (clear s5-5) + ) + ) + (when (> s4-5 0) + (format s5-5 "~%") + (let ((a2-44 (sql-query s5-5))) + (when (!= (-> a2-44 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-44 this) + (return (the-as object #f)) + ) + ) + ) + ) + 0 + ) + +;; definition for method 13 of type nav-mesh-poly +(defmethod nav-mesh-poly-method-13 ((this nav-mesh-poly) (arg0 int)) + (dotimes (v1-0 (-> this index length)) + (if (= (-> this index data v1-0) arg0) + (return v1-0) + ) + ) + -1 + ) + +;; definition for method 11 of type nav-mesh-poly +;; WARN: Return type mismatch int vs none. +(defmethod nav-mesh-poly-method-11 ((this nav-mesh-poly) (arg0 int)) + (cond + ((zero? (-> this index length)) + (set! (-> this index data 0) arg0) + (+! (-> this index length) 1) + (set! (-> this insert-pos) (-> this insert-pos)) + ) + ((= (-> this insert-pos) (+ (-> this index length) -1)) + (set! (-> this index data (+ (-> this insert-pos) 1)) arg0) + (+! (-> this index length) 1) + (+! (-> this insert-pos) 1) + ) + ((< (-> this insert-pos) (the-as uint (-> this index length))) + (when (and (!= (-> this index data (-> this insert-pos)) arg0) + (!= (-> this index data (mod (the-as int (+ (-> this insert-pos) 1)) (-> this index length))) arg0) + ) + (dotimes (v1-35 (+ (- (the-as int (-> this insert-pos))) (-> this index length))) + (set! (-> this index data (- (-> this index length) v1-35)) + (-> this index data (+ (- -1 v1-35) (-> this index length))) + ) + ) + (set! (-> this index data (+ (-> this insert-pos) 1)) arg0) + (+! (-> this index length) 1) + (+! (-> this insert-pos) 1) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type nav-mesh-poly +;; WARN: Return type mismatch int vs none. +(defmethod nav-mesh-poly-method-12 ((this nav-mesh-poly) (arg0 int)) + (when (< (the-as uint arg0) (the-as uint (-> this index length))) + (if (and (>= (-> this insert-pos) (the-as uint arg0)) (> (-> this insert-pos) 0)) + (+! (-> this insert-pos) -1) + ) + (dotimes (v1-9 (+ (- arg0) (-> this index length))) + (set! (-> this index data (+ arg0 v1-9)) (-> this index data (+ v1-9 1 arg0))) + ) + (+! (-> this index length) -1) + ) + 0 + (none) + ) + +;; definition of type triangulation-vert +(deftype triangulation-vert (structure) + ((index uint32) + (ear? symbol) + (score float) + ) + ) + +;; definition for method 3 of type triangulation-vert +(defmethod inspect ((this triangulation-vert)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'triangulation-vert) + (format #t "~1Tindex: ~D~%" (-> this index)) + (format #t "~1Tear?: ~A~%" (-> this ear?)) + (format #t "~1Tscore: ~f~%" (-> this score)) + (label cfg-4) + this + ) + +;; definition for function point-in-cone +;; WARN: disable def twice: 23. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defun point-in-cone ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg0 arg2)) + (a0-2 (vector-! (new 'stack-no-clear 'vector) arg1 arg2)) + (a1-2 (vector-! (new 'stack-no-clear 'vector) arg3 arg2)) + ) + (if (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) a1-2 a0-2) y)) + (and (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a1-2) y) 0.0) + (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a0-2) y)) + ) + (or (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a1-2) y)) + (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a0-2) y) 0.0) + ) + ) + ) + ) + +;; definition for function segment-in-cone +;; WARN: disable def twice: 23. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defun segment-in-cone ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)) + (a1-2 (vector-! (new 'stack-no-clear 'vector) arg2 arg0)) + (a2-2 (vector-! (new 'stack-no-clear 'vector) arg3 arg0)) + ) + (if (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) a2-2 a1-2) y)) + (and (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a2-2) y) 0.0) + (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a1-2) y)) + ) + (or (< 0.0 (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a2-2) y)) + (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-1 a1-2) y) 0.0) + ) + ) + ) + ) + +;; definition for function point-in-triangle +(defun point-in-triangle ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (local-vars (v0-0 symbol)) + (let ((t0-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1)) + (t1-2 (vector-! (new 'stack-no-clear 'vector) arg3 arg2)) + (v1-3 (vector-! (new 'stack-no-clear 'vector) arg1 arg3)) + ) + (if (or (< 0.0 + (-> (vector-cross! (new 'stack-no-clear 'vector) (vector-! (new 'stack-no-clear 'vector) arg0 arg2) t1-2) y) + ) + (< 0.0 + (-> (vector-cross! (new 'stack-no-clear 'vector) (vector-! (new 'stack-no-clear 'vector) arg0 arg1) t0-1) y) + ) + (< 0.0 + (-> (vector-cross! (new 'stack-no-clear 'vector) (vector-! (new 'stack-no-clear 'vector) arg0 arg3) v1-3) y) + ) + ) + (return #f) + ) + ) + (return #t) + v0-0 + ) + +;; definition for function segments-intersect +(defun segments-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) + (let* ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg0)) + (f0-2 (- (* (-> arg1 x) (-> arg3 z)) (* (-> arg1 z) (-> arg3 x)))) + (f1-3 f0-2) + (f1-5 (* f1-3 f1-3)) + (f2-1 (-> arg1 x)) + (f2-3 (* f2-1 f2-1)) + (f3-0 (-> arg1 z)) + (f2-4 (+ f2-3 (* f3-0 f3-0))) + (f3-3 (-> arg3 x)) + (f3-5 (* f3-3 f3-3)) + (f4-0 (-> arg3 z)) + (f3-6 (+ f3-5 (* f4-0 f4-0))) + ) + (when (< (* (/ f3-6 10000) f2-4) f1-5) + (let ((f1-9 (/ (- (* (-> v1-1 x) (-> arg3 z)) (* (-> v1-1 z) (-> arg3 x))) f0-2))) + (if (or (< f1-9 0.0) (< 1.0 f1-9)) + (return #f) + ) + ) + (let ((f0-3 (/ (- (* (-> v1-1 x) (-> arg1 z)) (* (-> v1-1 z) (-> arg1 x))) f0-2))) + (if (or (< f0-3 0.0) (< 1.0 f0-3)) + (return #f) + ) + ) + (return #t) + ) + ) + #f + ) + +;; definition for function is-diagonal +(defun is-diagonal ((arg0 int) (arg1 (inline-array triangulation-vert)) (arg2 vector-array) (arg3 int) (arg4 int) (arg5 int)) + (mod (+ arg0 -1 arg3) arg0) + (mod (+ arg0 1 arg5) arg0) + (let ((v1-9 (vector-! + (new 'stack-no-clear 'vector) + (-> arg2 data (-> arg1 arg4 index)) + (-> arg2 data (-> arg1 arg3 index)) + ) + ) + (a0-8 (vector-! + (new 'stack-no-clear 'vector) + (-> arg2 data (-> arg1 arg5 index)) + (-> arg2 data (-> arg1 arg4 index)) + ) + ) + ) + (if (< (-> (vector-cross! (new 'stack-no-clear 'vector) v1-9 a0-8) y) 0.0) + (return #f) + ) + ) + (dotimes (s0-0 arg0) + (if (and (!= s0-0 arg3) + (!= s0-0 arg4) + (!= s0-0 arg5) + (and (< (-> (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! + (new 'stack-no-clear 'vector) + (-> arg2 data (-> arg1 s0-0 index)) + (-> arg2 data (-> arg1 (mod (+ arg0 -1 s0-0) arg0) index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> arg2 data (-> arg1 (mod (+ arg0 1 s0-0) arg0) index)) + (-> arg2 data (-> arg1 s0-0 index)) + ) + ) + y + ) + 0.0 + ) + (point-in-triangle + (-> arg2 data (-> arg1 s0-0 index)) + (-> arg2 data (-> arg1 arg3 index)) + (-> arg2 data (-> arg1 arg4 index)) + (-> arg2 data (-> arg1 arg5 index)) + ) + ) + ) + (return #f) + ) + ) + #t + ) + +;; definition for symbol *verts-buf-1*, type (inline-array triangulation-vert) +(define *verts-buf-1* (new 'static 'inline-array triangulation-vert 256 + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + ) + ) + +;; definition for symbol *verts-buf-2*, type (inline-array triangulation-vert) +(define *verts-buf-2* (new 'static 'inline-array triangulation-vert 256 + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + (new 'static 'triangulation-vert) + ) + ) + +;; definition for method 10 of type nav-mesh-poly +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 10 nav-mesh-poly) has a return type of none, but the expression builder found a return statement. +(defmethod nav-mesh-poly-method-10 ((this nav-mesh-poly) (arg0 nav-mesh-editable)) + (local-vars + (sv-288 int) + (sv-304 int) + (sv-320 int) + (sv-336 int) + (sv-352 int) + (sv-368 vector) + (sv-384 vector) + (sv-400 vector) + (sv-416 int) + (sv-432 int) + (sv-448 int) + (sv-464 int) + (sv-480 int) + (sv-496 int) + (sv-512 vector) + (sv-528 vector) + (sv-544 vector) + (sv-560 vector) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 *verts-buf-1*) + (s2-0 *verts-buf-2*) + ) + *verts-buf-1* + (let ((s1-0 (-> this index length)) + (s3-0 (-> arg0 verts)) + ) + (dotimes (v1-2 s1-0) + (set! (-> s4-0 v1-2 index) (the-as uint (-> this index data v1-2))) + ) + (while (< 3 s1-0) + (set! sv-288 0) + (set! sv-304 1) + (set! sv-320 2) + (let ((s0-0 0)) + (set! sv-336 -1) + -1 + (let ((f30-0 0.0)) + (set! sv-352 0) + (while (< sv-352 s1-0) + (set! (-> s4-0 sv-304 ear?) #f) + (when (is-diagonal s1-0 s4-0 s3-0 sv-288 sv-304 sv-320) + 1.0 + (new 'stack-no-clear 'vector) + (set! sv-400 (new 'stack-no-clear 'vector)) + (let ((v1-25 (-> s3-0 data (-> s4-0 sv-288 index))) + (a0-11 (-> s3-0 data (-> s4-0 sv-304 index))) + ) + (.lvf vf4 (&-> v1-25 quad)) + (.lvf vf5 (&-> a0-11 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-400 quad) vf6) + (set! sv-368 (new 'stack-no-clear 'vector)) + (let ((v1-34 (-> s3-0 data (-> s4-0 sv-304 index))) + (a0-18 (-> s3-0 data (-> s4-0 sv-320 index))) + ) + (.lvf vf4 (&-> v1-34 quad)) + (.lvf vf5 (&-> a0-18 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-368 quad) vf6) + (set! sv-384 (new 'stack-no-clear 'vector)) + (let ((v1-43 (-> s3-0 data (-> s4-0 sv-320 index))) + (a0-25 (-> s3-0 data (-> s4-0 sv-288 index))) + ) + (.lvf vf4 (&-> v1-43 quad)) + (.lvf vf5 (&-> a0-25 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-384 quad) vf6) + 0.0 + 0.0 + (let* ((f28-0 (vector-vector-angle-safe sv-400 sv-368)) + (t9-2 vector-vector-angle-safe) + (a1-6 sv-384) + (f0-5 (* f28-0 (t9-2 sv-368 a1-6) (vector-vector-angle-safe sv-384 sv-400))) + ) + (set! (-> s4-0 sv-304 ear?) #t) + (when (or (= sv-336 -1) (< f30-0 f0-5)) + (set! sv-336 sv-304) + (set! f30-0 f0-5) + ) + ) + ) + (set! sv-288 (mod (+ sv-288 1) s1-0)) + (set! sv-304 (mod (+ sv-304 1) s1-0)) + (set! sv-320 (mod (+ sv-320 1) s1-0)) + (set! sv-352 (+ sv-352 1)) + ) + ) + (set! sv-416 0) + (set! sv-432 1) + (set! sv-448 2) + (set! sv-464 -1) + (let ((f30-1 0.0)) + (set! sv-480 3) + (set! sv-496 0) + (while (< sv-496 s1-0) + (when (and (-> s4-0 sv-432 ear?) + (-> s4-0 sv-448 ear?) + (is-diagonal s1-0 s4-0 s3-0 sv-480 sv-416 sv-432) + (is-diagonal s1-0 s4-0 s3-0 sv-448 sv-480 sv-416) + ) + 1.0 + (set! sv-560 (new 'stack-no-clear 'vector)) + (let ((v1-90 (-> s3-0 data (-> s4-0 sv-416 index))) + (a0-41 (-> s3-0 data (-> s4-0 sv-432 index))) + ) + (.lvf vf4 (&-> v1-90 quad)) + (.lvf vf5 (&-> a0-41 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-560 quad) vf6) + (set! sv-512 (new 'stack-no-clear 'vector)) + (let ((v1-99 (-> s3-0 data (-> s4-0 sv-432 index))) + (a0-48 (-> s3-0 data (-> s4-0 sv-448 index))) + ) + (.lvf vf4 (&-> v1-99 quad)) + (.lvf vf5 (&-> a0-48 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-512 quad) vf6) + (set! sv-528 (new 'stack-no-clear 'vector)) + (let ((v1-108 (-> s3-0 data (-> s4-0 sv-448 index))) + (a0-55 (-> s3-0 data (-> s4-0 sv-480 index))) + ) + (.lvf vf4 (&-> v1-108 quad)) + (.lvf vf5 (&-> a0-55 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-528 quad) vf6) + (set! sv-544 (new 'stack-no-clear 'vector)) + (let ((v1-117 (-> s3-0 data (-> s4-0 sv-480 index))) + (a0-62 (-> s3-0 data (-> s4-0 sv-416 index))) + ) + (.lvf vf4 (&-> v1-117 quad)) + (.lvf vf5 (&-> a0-62 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-544 quad) vf6) + 0.0 + 0.0 + (let* ((f28-2 (vector-vector-angle-safe sv-560 sv-512)) + (t9-7 vector-vector-angle-safe) + (a1-11 sv-528) + (f28-3 (* f28-2 (t9-7 sv-512 a1-11))) + (t9-8 vector-vector-angle-safe) + (a1-12 sv-544) + (f0-12 (* f28-3 (t9-8 sv-528 a1-12) (vector-vector-angle-safe sv-544 sv-560))) + ) + (when (or (= sv-464 -1) (< f30-1 f0-12)) + (set! sv-336 sv-432) + (set! sv-464 sv-448) + (set! f30-1 f0-12) + ) + ) + ) + (set! sv-416 (mod (+ sv-416 1) s1-0)) + (set! sv-432 (mod (+ sv-432 1) s1-0)) + (set! sv-448 (mod (+ sv-448 1) s1-0)) + (set! sv-480 (mod (+ sv-480 1) s1-0)) + (set! sv-496 (+ sv-496 1)) + ) + ) + (when (= sv-336 -1) + (format *stdcon* "cannot find any ear~%") + (return #f) + ) + (let ((a0-70 0) + (a1-15 1) + (a2-3 2) + (a3-3 3) + ) + (dotimes (v1-146 s1-0) + (cond + ((= a1-15 sv-336) + (cond + ((!= sv-464 -1) + (let ((t0-9 (-> arg0 quads data (-> arg0 quads length))) + (t1-6 (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a0-70 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a2-3 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + ) + ) + ) + (when (< 0.01 (vector-length t1-6)) + (set! (-> t0-9 indices 0) (-> s4-0 a0-70 index)) + (set! (-> t0-9 indices 1) (-> s4-0 a1-15 index)) + (set! (-> t0-9 indices 2) (-> s4-0 a2-3 index)) + (set! (-> t0-9 indices 3) (-> s4-0 a3-3 index)) + (set! (-> t0-9 poly) (-> this poly-id)) + (+! (-> arg0 quads length) 1) + ) + ) + ) + (else + (let ((t0-17 (-> arg0 tris data (-> arg0 tris length))) + (t1-25 (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a0-70 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + (vector-! + (new 'stack-no-clear 'vector) + (-> s3-0 data (-> s4-0 a2-3 index)) + (-> s3-0 data (-> s4-0 a1-15 index)) + ) + ) + ) + ) + (when (< 0.01 (vector-length t1-25)) + (set! (-> t0-17 indices 0) (-> s4-0 a0-70 index)) + (set! (-> t0-17 indices 1) (-> s4-0 a1-15 index)) + (set! (-> t0-17 indices 2) (-> s4-0 a2-3 index)) + (set! (-> t0-17 poly) (-> this poly-id)) + (+! (-> arg0 tris length) 1) + ) + ) + ) + ) + ) + ((= a1-15 sv-464) + ) + (else + (set! (-> s2-0 s0-0 index) (-> s4-0 a1-15 index)) + (+! s0-0 1) + ) + ) + (set! a0-70 (mod (+ a0-70 1) s1-0)) + (set! a1-15 (mod (+ a1-15 1) s1-0)) + (set! a2-3 (mod (+ a2-3 1) s1-0)) + (set! a3-3 (mod (+ a3-3 1) s1-0)) + ) + ) + (set! s1-0 s0-0) + ) + (let ((v1-149 s4-0)) + (set! s4-0 s2-0) + (set! s2-0 v1-149) + ) + ) + (when (= s1-0 3) + (let ((v1-158 (-> arg0 tris data (-> arg0 tris length))) + (a0-75 + (vector-cross! + (new 'stack-no-clear 'vector) + (vector-! (new 'stack-no-clear 'vector) (-> s3-0 data (-> s4-0 0 index)) (-> s3-0 data (-> s4-0 1 index))) + (vector-! (new 'stack-no-clear 'vector) (-> s3-0 data (-> s4-0 2 index)) (-> s3-0 data (-> s4-0 1 index))) + ) + ) + ) + (when (< 0.01 (vector-length a0-75)) + (set! (-> v1-158 indices 0) (-> s4-0 0 index)) + (set! (-> v1-158 indices 1) (-> s4-0 1 index)) + (set! (-> v1-158 indices 2) (-> s4-0 2 index)) + (set! (-> v1-158 poly) (-> this poly-id)) + (+! (-> arg0 tris length) 1) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 21 of type nav-mesh-editor +;; WARN: Return type mismatch int vs none. +(defmethod nav-mesh-editor-method-21 ((this nav-mesh-editor)) + (set! *display-region-marks* #f) + (when #f + (format *stdcon* "~0K") + (format *stdcon* "~16S~16S~16S~%" "Left button" "Middle button" "Right button") + (when (!= *master-mode* 'menu) + ) + (format *stdcon* "~1K~%") + ) + 0 + (none) + ) + +;; definition for method 22 of type nav-mesh-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-mesh-editor-method-22 ((this nav-mesh-editor)) + (vector-copy! (-> this mouse-pos) (-> *math-camera* trans)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! (new 'stack-no-clear 'vector) *up-vector*) + (set-vector! s2-0 (-> *mouse* posx) (-> *mouse* posy) 0.0 1.0) + (vector-copy! (-> this mouse-screen-pos) s2-0) + (cond + (*ocean-map* + (vector-copy! s3-0 *up-vector*) + (vector-copy! s4-0 (-> this mouse-pos)) + (set! (-> s4-0 y) (get-base-height *ocean-map*)) + (reverse-transform-point! s5-0 s4-0 s3-0 s2-0) + (vector-copy! (-> this mouse-hit) s5-0) + (vector-copy! (-> this mouse-normal) *y-vector*) + (set! (-> this mouse-collide) (the-as basic #t)) + ) + (else + (vector-copy! s3-0 (-> *math-camera* inv-camera-rot fvec)) + (vector+*! s4-0 (-> this mouse-pos) (-> *math-camera* inv-camera-rot fvec) 4096000.0) + (reverse-transform-point! s5-0 s4-0 s3-0 s2-0) + ) + ) + ) + (vector-copy! (-> this mouse-end) s5-0) + (let ((s4-1 (new 'stack 'collide-query))) + (vector-copy! (-> s4-1 start-pos) (-> this mouse-pos)) + (vector-! (-> s4-1 move-dist) s5-0 (-> this mouse-pos)) + (let ((v1-19 s4-1)) + (set! (-> v1-19 radius) 409.6) + (set! (-> v1-19 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-19 ignore-process0) #f) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (let ((f0-7 (fill-and-probe-using-line-sphere *collide-cache* s4-1))) + (cond + ((>= f0-7 0.0) + (vector+*! (-> this mouse-hit) (-> s4-1 start-pos) (-> s4-1 move-dist) f0-7) + (vector+! + (-> this mouse-hit-pick) + (-> this mouse-hit) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-1 move-dist) 4096.0) + ) + (vector-copy! (-> this mouse-normal) (-> s4-1 best-other-tri normal)) + (set! (-> this mouse-collide) (the-as basic #t)) + ) + (else + (when (not *ocean-map*) + (vector+! (-> this mouse-hit) (-> s4-1 start-pos) (-> s4-1 move-dist)) + (set! (-> this mouse-collide) #f) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function draw-square-point +;; WARN: Return type mismatch pointer vs object. +(defun draw-square-point ((arg0 vector)) + (let* ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (gp-0 (-> s5-0 base)) + ) + (when (transform-point-vector! s4-0 arg0) + (let ((v1-9 (+ (the int (+ -1792.0 (-> s4-0 x))) -1)) + (a0-4 (+ (the int (+ -1840.0 (-> s4-0 y))) -1)) + ) + (when (and (> v1-9 0) (< v1-9 512) (> a0-4 0) (< a0-4 416) (draw-sprite2d-xy + s5-0 + (+ (the int (+ -1792.0 (-> s4-0 x))) -3) + (+ (the int (+ -1840.0 (-> s4-0 y))) -3) + 7 + 7 + (new 'static 'rgba :r #x80 :a #xff) + #x3fffff + ) + ) + ) + ) + ) + (let ((a3-1 (-> s5-0 base))) + (when (!= gp-0 a3-1) + (let ((v1-18 (the-as object (-> s5-0 base)))) + (set! (-> (the-as dma-packet v1-18) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-18) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-18) vif1) (new 'static 'vif-tag)) + (set! (-> s5-0 base) (&+ (the-as pointer v1-18) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id debug-no-zbuf1) + gp-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate idle (nav-mesh-editor) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('exit) + (deactivate self) + ) + (('menu) + (let ((v0-0 (the-as object (+ (current-time) (the-as time-frame (-> block param 0)))))) + (set! (-> self close-menu-time) (the-as time-frame v0-0)) + v0-0 + ) + ) + (('new-nav-mesh) + (dotimes (v1-4 32) + (let ((a0-12 (-> self nav-meshes data v1-4))) + (when (logtest? (-> a0-12 flags) (nav-mesh-editable-flag nmef0)) + (logclear! (-> a0-12 flags) (nav-mesh-editable-flag nmef0)) + (set! (-> a0-12 level-id) (-> self level-id)) + (set! (-> self current-nav-mesh) a0-12) + (return #f) + ) + ) + ) + #f + ) + (('delete-nav-mesh) + (let ((v1-9 (-> block param 0))) + (dotimes (a0-15 32) + (let ((gp-0 (-> self nav-meshes data a0-15))) + (when (and (not (logtest? (-> gp-0 flags) (nav-mesh-editable-flag nmef0))) (= (-> gp-0 navmesh-id) v1-9)) + (if (= (-> self current-nav-mesh) gp-0) + (set! (-> self current-nav-mesh) #f) + ) + (nav-mesh-editable-method-18 gp-0) + (logior! (-> gp-0 flags) (nav-mesh-editable-flag nmef0)) + (return #f) + ) + ) + ) + ) + (format #t "nav mesh not found~%") + ) + (('translate-nav-mesh) + (let ((s5-0 (-> block param 0)) + (f30-0 (the-as float (-> block param 1))) + (f28-0 (the-as float (-> block param 2))) + (f26-0 (the-as float (-> block param 3))) + ) + (dotimes (s4-0 32) + (let ((gp-1 (-> self nav-meshes data s4-0))) + (format #t "~D~%" (-> gp-1 navmesh-id)) + (when (and (not (logtest? (-> gp-1 flags) (nav-mesh-editable-flag nmef0))) (= (-> gp-1 navmesh-id) s5-0)) + (format #t "nav mesh not found~%") + (dotimes (v1-30 (-> gp-1 verts length)) + (+! (-> gp-1 verts data v1-30 x) f30-0) + (+! (-> gp-1 verts data v1-30 y) f28-0) + (+! (-> gp-1 verts data v1-30 z) f26-0) + ) + (nav-mesh-editable-method-17 gp-1) + (return #f) + ) + ) + ) + ) + #f + ) + (('rotate-nav-mesh) + (let ((f30-1 (the-as float (-> block param 0)))) + (dotimes (gp-2 32) + (let ((s5-1 (-> self nav-meshes data gp-2))) + (when (not (logtest? (-> s5-1 flags) (nav-mesh-editable-flag nmef0))) + (format #t "nav mesh not found~%") + (dotimes (s4-1 (-> s5-1 verts length)) + (vector-rotate-around-y! (-> s5-1 verts data s4-1) (-> s5-1 verts data s4-1) f30-1) + ) + (nav-mesh-editable-method-17 s5-1) + ) + ) + ) + ) + #f + ) + ) + ) + :trans (behavior () + (when (= (-> *keybd* keys 82) 2) + (let ((v1-2 0)) + (dotimes (a0-2 32) + (case (-> self nav-meshes data a0-2) + (((-> self current-nav-mesh)) + (set! v1-2 a0-2) + (goto cfg-8) + ) + ) + ) + (label cfg-8) + (dotimes (a1-5 32) + (+! v1-2 1) + (if (>= v1-2 32) + (set! v1-2 0) + ) + (let ((a0-11 (-> self nav-meshes data v1-2))) + (when (not (logtest? (-> a0-11 flags) (nav-mesh-editable-flag nmef0))) + (set! (-> self current-nav-mesh) a0-11) + (let ((a1-6 (-> a0-11 selected-poly))) + (vector-copy! + (-> self manipulator position) + (-> a0-11 verts data (-> a0-11 polys data a1-6 index data (-> a0-11 polys data a1-6 insert-pos))) + ) + ) + (goto cfg-17) + ) + ) + ) + ) + ) + (label cfg-17) + (when (= (-> *keybd* keys 81) 2) + (let ((v1-9 0)) + (dotimes (a0-17 32) + (case (-> self nav-meshes data a0-17) + (((-> self current-nav-mesh)) + (set! v1-9 a0-17) + (goto cfg-25) + ) + ) + ) + (label cfg-25) + (dotimes (a1-19 32) + (+! v1-9 -1) + (if (< v1-9 0) + (set! v1-9 31) + ) + (let ((a0-26 (-> self nav-meshes data v1-9))) + (when (not (logtest? (-> a0-26 flags) (nav-mesh-editable-flag nmef0))) + (set! (-> self current-nav-mesh) a0-26) + (let ((a1-20 (-> a0-26 selected-poly))) + (vector-copy! + (-> self manipulator position) + (-> a0-26 verts data (-> a0-26 polys data a1-20 index data (-> a0-26 polys data a1-20 insert-pos))) + ) + ) + (goto cfg-34) + ) + ) + ) + ) + ) + (label cfg-34) + (when (= (-> *keybd* keys 19) 2) + (set! (-> self allow-snap) (not (-> self allow-snap))) + (format #t "navmesh snap ~A~%" (-> self allow-snap)) + ) + (if (= (-> *keybd* keys 24) 2) + (nav-mesh-editor-method-27 self) + ) + (if (= (-> *keybd* keys 21) 2) + (nav-mesh-editor-method-26 self) + ) + (if (= (-> *keybd* keys 11) 2) + (set! (-> self hide-unselected) (not (-> self hide-unselected))) + ) + (when (-> self current-nav-mesh) + (let ((v1-33 (-> self current-nav-mesh)) + (a0-41 (the-as object -1)) + ) + (when (= (-> *keybd* keys 40) 2) + (dotimes (a1-31 92) + (when (< (-> v1-33 polys data a1-31 index length) 3) + (set! (-> v1-33 polys data a1-31 index length) 0) + (set! (-> v1-33 polys data a1-31 insert-pos) (the-as uint 0)) + (if (= (the-as int a0-41) -1) + (set! a0-41 a1-31) + ) + ) + ) + (set! a0-41 (cond + ((!= (the-as int a0-41) -1) + (set! (-> v1-33 selected-poly) (the-as uint a0-41)) + a0-41 + ) + (else + (format #t "increase MAX_NAV_MESH_POLYS (~D)~%" 92) + ) + ) + ) + ) + ) + ) + (nav-mesh-editor-method-22 self) + (when (not (-> self lock-action)) + (manipulator-method-10 (-> self manipulator) (-> self mouse-pos) (-> self mouse-end)) + (set! (-> self mouse-action) (the-as uint 0)) + (cond + ((or (logtest? (-> *keybd* keys 0) 4) (logtest? (-> *keybd* keys 0) 64)) + (set! (-> self manipulator action) (manipulator-action ma0)) + (set! (-> self mouse-action) (the-as uint 1)) + (when (mouse-pressed? left) + (when (not (time-elapsed? (-> self mouse-pressed) (seconds 0.2))) + (vector-copy! (-> self mouse-tumble) (-> self mouse-hit)) + (set! (-> self mouse-tumble w) 40960.0) + (send-event *camera* 'point-of-interest (-> self mouse-tumble)) + ) + (set-time! (-> self mouse-pressed)) + ) + ) + (else + (if (nonzero? (-> self manipulator action)) + (set! (-> self mouse-action) (the-as uint 2)) + ) + ) + ) + ) + (if (-> self current-nav-mesh) + (manipulator-method-11 (-> self manipulator)) + ) + (when (and (= (-> *keybd* keys 22) 2) (or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16))) + (dotimes (gp-0 32) + (let ((a0-59 (-> self nav-meshes data gp-0))) + (if (not (logtest? (-> a0-59 flags) (nav-mesh-editable-flag nmef0))) + (nav-mesh-editable-method-16 a0-59) + ) + ) + ) + ) + (when (and (or (logtest? (-> *keybd* keys 0) 2) (logtest? (-> *keybd* keys 0) 32)) (mouse-pressed? left)) + (dotimes (gp-1 32) + (let ((s5-0 (-> self nav-meshes data gp-1))) + (when (not (logtest? (-> s5-0 flags) (nav-mesh-editable-flag nmef0))) + (let ((a0-68 (nav-mesh-editable-method-14 s5-0 (-> self mouse-screen-pos)))) + (when (and (or (= s5-0 (-> self current-nav-mesh)) (not (-> self hide-unselected))) (>= a0-68 0)) + (set! (-> s5-0 selected-poly) (the-as uint a0-68)) + (vector-copy! + (-> self manipulator position) + (-> s5-0 verts data (-> s5-0 polys data a0-68 index data (-> s5-0 polys data a0-68 insert-pos))) + ) + (set! (-> self current-nav-mesh) s5-0) + ) + ) + ) + ) + ) + ) + (let ((gp-2 #f)) + (vector-copy! (-> self mouse-snap) (-> self mouse-hit)) + (when (-> self allow-snap) + (dotimes (s5-1 32) + (let ((s4-0 (-> self nav-meshes data s5-1))) + (when (and (not (logtest? (-> s4-0 flags) (nav-mesh-editable-flag nmef0))) + (or (= s4-0 (-> self current-nav-mesh)) (not (-> self hide-unselected))) + ) + (let ((a0-83 + (the-as int (nav-mesh-editable-method-12 s4-0 (-> self mouse-screen-pos) (= (-> self current-nav-mesh) s4-0))) + ) + ) + (when (>= a0-83 0) + (vector-copy! (-> self mouse-hit) (-> s4-0 verts data a0-83)) + (set! gp-2 #t) + (set! (-> self mouse-collide) (the-as basic #t)) + ) + ) + ) + ) + ) + (when *display-nav-marks* + (let ((s5-2 (new 'stack-no-clear 'vector))) + (when (snap-level-navmesh (-> self mouse-screen-pos) s5-2) + (vector-copy! (-> self mouse-hit) s5-2) + (set! gp-2 #t) + (set! (-> self mouse-collide) (the-as basic #t)) + ) + ) + ) + (if gp-2 + (draw-square-point (-> self mouse-hit)) + ) + ) + ) + (format *stdcon* "level ~S~%" (-> self level-name)) + (let ((gp-3 (-> self current-nav-mesh))) + (when gp-3 + (let ((s5-3 (-> gp-3 polys data (-> gp-3 selected-poly))) + (s4-1 (the-as int (nav-mesh-editable-method-12 gp-3 (-> self mouse-screen-pos) #t))) + ) + -1 + (format *stdcon* "polycount = ~D~%" (+ (-> gp-3 tris length) (-> gp-3 quads length))) + (format *stdcon* "~D~%" (-> gp-3 verts length)) + (format *stdcon* "nav mesh id ~D~%" (-> gp-3 navmesh-id)) + (cond + ((= (-> *keybd* keys 76) 2) + (when (nonzero? (-> s5-3 index length)) + (nav-mesh-editor-method-25 self) + (nav-mesh-poly-method-12 s5-3 (the-as int (-> s5-3 insert-pos))) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + (nav-mesh-editable-method-17 gp-3) + ) + ) + ((= (-> *keybd* keys 6) 2) + (when (nonzero? (-> s5-3 index length)) + (when (>= s4-1 0) + (let ((a1-57 -1)) + (dotimes (v1-164 92) + (when (< (-> gp-3 polys data v1-164 index length) 3) + (set! (-> gp-3 polys data v1-164 index length) 0) + (set! (-> gp-3 polys data v1-164 insert-pos) (the-as uint 0)) + (if (= a1-57 -1) + (set! a1-57 v1-164) + ) + ) + ) + (cond + ((= a1-57 -1) + (format #t "increase MAX_NAV_MESH_POLYS (~D)~%" 92) + ) + (else + (let ((v1-169 (the-as int (-> s5-3 insert-pos))) + (s1-0 0) + (s3-0 0) + (a0-126 #f) + (s2-0 (-> gp-3 polys data a1-57)) + ) + (dotimes (a1-61 (+ (-> s5-3 index length) 1)) + (cond + ((not a0-126) + (set! (-> *clean-index-array* s1-0) (-> s5-3 index data v1-169)) + (when (= (-> s5-3 index data v1-169) s4-1) + (set! a0-126 #t) + (+! a1-61 -1) + (+! v1-169 -1) + ) + (+! s1-0 1) + ) + (else + (set! (-> s2-0 index data s3-0) (-> s5-3 index data v1-169)) + (+! s3-0 1) + ) + ) + (+! v1-169 1) + (if (= v1-169 (-> s5-3 index length)) + (set! v1-169 0) + ) + ) + (when (and (>= s1-0 3) (>= s3-0 3)) + (nav-mesh-editor-method-25 self) + (dotimes (v1-176 s1-0) + (set! (-> s5-3 index data v1-176) (-> *clean-index-array* v1-176)) + ) + (set! (-> s5-3 index length) s1-0) + (set! (-> s5-3 insert-pos) (the-as uint 0)) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + (set! (-> s2-0 index length) s3-0) + (set! (-> s2-0 insert-pos) (the-as uint 0)) + 0 + ) + ) + (nav-mesh-editable-method-17 gp-3) + ) + ) + ) + ) + ) + ) + ((= (-> *keybd* keys 79) 2) + (when (nonzero? (-> s5-3 index length)) + (set! (-> s5-3 insert-pos) (the-as uint (mod (the-as int (+ (-> s5-3 insert-pos) 1)) (-> s5-3 index length)))) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + ((= (-> *keybd* keys 80) 2) + (when (nonzero? (-> s5-3 index length)) + (set! (-> s5-3 insert-pos) + (the-as uint (mod (+ (-> s5-3 index length) -1 (-> s5-3 insert-pos)) (-> s5-3 index length))) + ) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + ((or (mouse-hold? left) (mouse-hold? right) (mouse-hold? middle)) + (when (not (-> self lock-action)) + (when (= (-> self mouse-action) 2) + (nav-mesh-editor-method-25 self) + (manipulator-method-12 (-> self manipulator) (-> self mouse-end)) + ) + (vector-copy! (-> self mouse-action-pos-ref) (-> self mouse-end)) + (vector-copy! (-> self manipulator-back-pos) (-> self manipulator-pos)) + ) + (set! (-> self lock-action) (the-as basic #t)) + ) + (else + (when (-> self lock-action) + (when (-> self manipulator dragging?) + (manipulator-method-14 (-> self manipulator)) + (nav-mesh-editable-method-17 gp-3) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + (set! (-> self lock-action) #f) + ) + ) + (cond + ((or (logtest? (-> *keybd* keys 0) 1) (logtest? (-> *keybd* keys 0) 16)) + (set-setting! 'mouse-input 'abs #f 0) + (when (>= s4-1 0) + (vector-copy! (-> self mouse-hit) (-> gp-3 verts data s4-1)) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> self mouse-hit) (meters 1) *color-red*) + (nav-mesh-poly-method-13 s5-3 s4-1) + ) + (if (nonzero? (-> s5-3 index length)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos))) + (meters 1) + *color-blue* + ) + ) + (when (mouse-pressed? left) + (when (-> self mouse-collide) + (nav-mesh-editor-method-25 self) + (if (>= s4-1 0) + (nav-mesh-poly-method-11 s5-3 s4-1) + (nav-mesh-poly-method-11 s5-3 (add-vert! gp-3 (-> self mouse-hit))) + ) + (nav-mesh-editable-method-17 gp-3) + ) + ) + (if (> (-> s5-3 index length) 0) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + ((= (-> self mouse-action) 1) + (set-setting! 'mouse-input 'abs #t 0) + ) + ((= (-> self mouse-action) 2) + (set-setting! 'mouse-input 'abs #f 0) + (when (mouse-hold? left) + (manipulator-method-13 (-> self manipulator) (-> self mouse-pos) (-> self mouse-end)) + (if (and (= (-> self manipulator action) (manipulator-action ma7)) (-> self mouse-collide)) + (vector-copy! (-> self manipulator position) (-> self mouse-hit)) + ) + (when (= (-> self manipulator action) (manipulator-action ma7)) + (if (and (-> self allow-snap) + (>= s4-1 0) + (> (-> s5-3 index length) 0) + (!= s4-1 (-> s5-3 index data (-> s5-3 insert-pos))) + ) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data s4-1)) + ) + ) + ) + (if (> (-> s5-3 index length) 0) + (vector-copy! (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos))) (-> self manipulator position)) + ) + ) + ((zero? (-> self mouse-action)) + (set-setting! 'mouse-input 'abs #f 0) + (when (mouse-pressed? left) + (let ((a1-90 (nav-mesh-editable-method-12 gp-3 (-> self mouse-screen-pos) #t)) + (a0-232 -1) + ) + (if (>= (the-as int a1-90) 0) + (set! a0-232 (nav-mesh-poly-method-13 s5-3 (the-as int a1-90))) + ) + (when (>= a0-232 0) + (set! (-> s5-3 insert-pos) (the-as uint a0-232)) + (vector-copy! (-> self manipulator position) (-> gp-3 verts data (-> s5-3 index data (-> s5-3 insert-pos)))) + ) + ) + ) + ) + (else + (set-setting! 'mouse-input 'abs #f 0) + ) + ) + ) + ) + ) + (dotimes (gp-4 32) + (let ((v1-329 (-> self nav-meshes data gp-4))) + (when (or (= v1-329 (-> self current-nav-mesh)) (not (-> self hide-unselected))) + (if (not (logtest? (-> v1-329 flags) (nav-mesh-editable-flag nmef0))) + (nav-mesh-editable-method-10 v1-329 (= v1-329 (-> self current-nav-mesh))) + ) + ) + ) + ) + ) + :code (behavior () + (set-setting! 'mouse-input 'abs #t 0) + (until #f + (suspend) + ) + #f + ) + :post (behavior () + '() + ) + ) + +;; definition for function get-level-id +(defun get-level-id ((arg0 string)) + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "select level_info_id from level_info where name='~S'" arg0) + (let ((a2-1 (sql-query s5-0))) + (when (!= (-> a2-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A~%" a2-1) + (return (the-as int #f)) + ) + (string->int (the-as string (-> a2-1 sql-data 0))) + ) + ) + ) + +;; definition for method 23 of type nav-mesh-editor +;; WARN: Return type mismatch int vs none. +(defmethod set-level-info! ((this nav-mesh-editor) (arg0 symbol)) + (set! (-> this level-id) (the-as uint (get-level-id (the-as string arg0)))) + (set! (-> this level-name) (the-as string arg0)) + 0 + (none) + ) + +;; definition for method 24 of type nav-mesh-editor +;; WARN: Return type mismatch int vs object. +(defmethod select-nav-mesh-by-id ((this nav-mesh-editor) (arg0 int)) + (set! (-> this undo-id) (the-as uint 0)) + (set! (-> this undo-min) (the-as uint 0)) + (set! (-> this undo-max) (the-as uint 0)) + (dotimes (s4-0 (-> this nav-meshes length)) + (init-fields! (-> this nav-meshes data s4-0)) + (set! (-> this nav-meshes data s4-0 level-id) (the-as uint 0)) + (set! (-> this nav-meshes data s4-0 navmesh-id) (the-as uint 0)) + (logior! (-> this nav-meshes data s4-0 flags) (nav-mesh-editable-flag nmef0)) + ) + (let ((s4-1 (clear *temp-string*))) + (format + s4-1 + "select distinct entity.entity_id from entity,navmesh_poly where entity.entity_id=navmesh_poly.entity_id and entity.name='nav-mesh' and entity.level_id=~D~%" + arg0 + ) + (let ((s4-2 (sql-query s4-1))) + (when (!= (-> s4-2 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A for ~A~%" s4-2 this) + (return (the-as object #f)) + ) + (let ((s3-0 0)) + 0 + (while (< s3-0 (-> s4-2 length)) + (let ((s2-0 (string->int (the-as string (-> s4-2 sql-data s3-0))))) + (dotimes (v1-23 32) + (let ((a0-20 (-> this nav-meshes data v1-23))) + (when (logtest? (-> a0-20 flags) (nav-mesh-editable-flag nmef0)) + (set! (-> a0-20 level-id) (the-as uint arg0)) + (nav-mesh-editable-method-15 a0-20 s2-0) + (set! v1-23 32) + ) + ) + ) + ) + (+! s3-0 1) + ) + ) + ) + ) + 0 + ) + +;; definition for method 25 of type nav-mesh-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 25 nav-mesh-editor) has a return type of none, but the expression builder found a return statement. +(defmethod nav-mesh-editor-method-25 ((this nav-mesh-editor)) + (if (not (-> this current-nav-mesh)) + (return #f) + ) + (let ((v1-7 (-> this undos data (logand (-> this undo-id) 31)))) + (set! (-> v1-7 current-nav-mesh) (-> this current-nav-mesh)) + (let ((a1-2 (-> this current-nav-mesh))) + (set! (-> v1-7 selected-poly) (-> a1-2 selected-poly)) + (let ((t0-0 0)) + (dotimes (a2-1 (-> a1-2 polys length)) + (let ((a3-2 (-> a1-2 polys data a2-1))) + (set! (-> v1-7 index data t0-0) (-> a3-2 index length)) + (let ((t0-1 (+ t0-0 1))) + (dotimes (t1-3 (-> a3-2 index length)) + (set! (-> v1-7 index data t0-1) (-> a3-2 index data t1-3)) + (+! t0-1 1) + ) + (set! (-> v1-7 index data t0-1) (the-as int (-> a3-2 insert-pos))) + (set! t0-0 (+ t0-1 1)) + ) + ) + ) + ) + (set! (-> v1-7 verts length) (-> a1-2 verts length)) + (dotimes (a2-6 (-> a1-2 verts length)) + (vector-copy! (-> v1-7 verts data a2-6) (-> a1-2 verts data a2-6)) + ) + ) + ) + (+! (-> this undo-id) 1) + (set! (-> this undo-max) (-> this undo-id)) + (while (< (the-as uint 31) (- (-> this undo-id) (-> this undo-min))) + (+! (-> this undo-min) 1) + ) + 0 + (none) + ) + +;; definition for method 26 of type nav-mesh-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 26 nav-mesh-editor) has a return type of none, but the expression builder found a return statement. +(defmethod nav-mesh-editor-method-26 ((this nav-mesh-editor)) + (if (>= (-> this undo-id) (-> this undo-max)) + (return #f) + ) + (+! (-> this undo-id) 1) + (let ((v1-10 (-> this undos data (logand (+ (-> this undo-id) -1) 31)))) + (set! (-> this current-nav-mesh) (-> v1-10 current-nav-mesh)) + (let ((a0-1 (-> this current-nav-mesh))) + (set! (-> a0-1 selected-poly) (-> v1-10 selected-poly)) + (let ((a3-0 0)) + (dotimes (a1-4 (-> a0-1 polys length)) + (let ((a2-2 (-> a0-1 polys data a1-4))) + (set! (-> a2-2 index length) (-> v1-10 index data a3-0)) + (let ((a3-1 (+ a3-0 1))) + (dotimes (t0-4 (-> a2-2 index length)) + (set! (-> a2-2 index data t0-4) (-> v1-10 index data a3-1)) + (+! a3-1 1) + ) + (set! (-> a2-2 insert-pos) (the-as uint (-> v1-10 index data a3-1))) + (set! a3-0 (+ a3-1 1)) + ) + ) + ) + ) + (set! (-> a0-1 verts length) (-> v1-10 verts length)) + (dotimes (a1-9 (-> a0-1 verts length)) + (vector-copy! (-> a0-1 verts data a1-9) (-> v1-10 verts data a1-9)) + ) + (nav-mesh-editable-method-17 a0-1) + ) + ) + 0 + (none) + ) + +;; definition for method 27 of type nav-mesh-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs object. +(defmethod nav-mesh-editor-method-27 ((this nav-mesh-editor)) + (if (>= (-> this undo-min) (-> this undo-id)) + (return (the-as object #f)) + ) + (let ((v1-8 (-> this undos data (logand (+ (-> this undo-id) -1) 31)))) + (set! (-> this current-nav-mesh) (-> v1-8 current-nav-mesh)) + (let ((s5-0 (-> this current-nav-mesh))) + (set! (-> s5-0 selected-poly) (-> v1-8 selected-poly)) + (let ((a2-0 0)) + (dotimes (a0-5 (-> s5-0 polys length)) + (let ((a1-2 (-> s5-0 polys data a0-5))) + (set! (-> a1-2 index length) (-> v1-8 index data a2-0)) + (let ((a2-1 (+ a2-0 1))) + (dotimes (a3-4 (-> a1-2 index length)) + (set! (-> a1-2 index data a3-4) (-> v1-8 index data a2-1)) + (+! a2-1 1) + ) + (set! (-> a1-2 insert-pos) (the-as uint (-> v1-8 index data a2-1))) + (set! a2-0 (+ a2-1 1)) + ) + ) + ) + ) + (set! (-> s5-0 verts length) (-> v1-8 verts length)) + (dotimes (a0-10 (-> s5-0 verts length)) + (vector-copy! (-> s5-0 verts data a0-10) (-> v1-8 verts data a0-10)) + ) + (nav-mesh-editable-method-17 s5-0) + (let ((a0-13 (-> s5-0 polys data (-> s5-0 selected-poly)))) + (vector-copy! (-> this manipulator position) (-> s5-0 verts data (-> a0-13 index data (-> a0-13 insert-pos)))) + ) + ) + ) + (+! (-> this undo-id) -1) + 0 + ) + +;; definition for method 10 of type nav-mesh-editor +(defmethod deactivate ((this nav-mesh-editor)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (set! *nav-mesh-editor* (the-as (pointer nav-mesh-editor) #f)) + ((method-of-type process-drawable deactivate) this) + (none) + ) + +;; definition for function nav-mesh-editor-new +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-new () + (if *nav-mesh-editor* + (send-event (ppointer->process *nav-mesh-editor*) 'new-nav-mesh) + ) + 0 + ) + +;; definition for function nav-delete +;; WARN: Return type mismatch int vs object. +(defun nav-delete ((arg0 int)) + (if *nav-mesh-editor* + (send-event (ppointer->process *nav-mesh-editor*) 'delete-nav-mesh arg0) + ) + 0 + ) + +;; definition for function nav-mesh-editor-translate +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-translate ((arg0 int) (arg1 float) (arg2 float) (arg3 float)) + (if *nav-mesh-editor* + (send-event (ppointer->process *nav-mesh-editor*) 'translate-nav-mesh arg0 arg1 arg2 arg3) + ) + 0 + ) + +;; definition for function nav-mesh-editor-rotate-y +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-rotate-y ((arg0 float)) + (if *nav-mesh-editor* + (send-event (ppointer->process *nav-mesh-editor*) 'rotate-nav-mesh arg0) + ) + 0 + ) + +;; definition for function nav-mesh-editor-load +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-load ((arg0 string)) + (when *nav-mesh-editor* + (let ((s5-0 (clear *temp-string*))) + (format s5-0 "select level_info_id from level_info where name='~S'" arg0) + (let ((a2-1 (sql-query s5-0))) + (when (!= (-> a2-1 content-type) 'select) + (format 0 "ERROR: sql: modify error ~A~%" a2-1) + (return (the-as object #f)) + ) + (select-nav-mesh-by-id (-> *nav-mesh-editor* 0) (string->int (the-as string (-> a2-1 sql-data 0)))) + ) + ) + ) + 0 + ) + +;; definition for function nav-mesh-editor-set-level +;; WARN: Return type mismatch int vs object. +(defun nav-mesh-editor-set-level ((arg0 symbol)) + (if *nav-mesh-editor* + (set-level-info! (-> *nav-mesh-editor* 0) arg0) + ) + 0 + ) + +;; definition for function nav-set-lev +;; WARN: Return type mismatch int vs object. +(defun nav-set-lev ((arg0 string)) + (when (and *nav-mesh-editor* (-> *nav-mesh-editor* 0 current-nav-mesh)) + (let ((gp-0 (-> *nav-mesh-editor* 0 current-nav-mesh))) + (set! (-> gp-0 level-id) (the-as uint (get-level-id arg0))) + ) + ) + 0 + ) + +;; definition for function nav-set-flag +;; WARN: Return type mismatch int vs object. +(defun nav-set-flag ((arg0 nav-mesh-poly-flag)) + (when (and *nav-mesh-editor* (-> *nav-mesh-editor* 0 current-nav-mesh)) + (let ((a1-0 (-> *nav-mesh-editor* 0 current-nav-mesh))) + (set! (-> a1-0 polys data (-> a1-0 selected-poly) flags) arg0) + ) + ) + 0 + ) + +;; definition for function nav-mesh-editor-init +;; INFO: Used lq/sq +(defbehavior nav-mesh-editor-init nav-mesh-editor ((arg0 symbol)) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + (set! *display-actor-marks* #f) + (if (not arg0) + (set! arg0 (-> (level-get-target-inside *level*) name)) + ) + (logclear! (-> self mask) (process-mask freeze pause menu)) + (+! (-> self clock ref-count) -1) + (+! (-> *display* real-clock ref-count) 1) + (set! (-> self clock) (-> *display* real-clock)) + (add-setting! 'mouse #t 0.0 0) + (add-setting! 'cursor #t 0.0 0) + (add-setting! 'keybd #t 0.0 0) + (set! *nav-mesh-editor* (the-as (pointer nav-mesh-editor) (process->ppointer self))) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (set! (-> self external-cam-mode) *external-cam-mode*) + (set! *external-cam-mode* 'pad-1) + (matrix-identity! (-> self manipulator mat)) + (set! (-> self manipulator-pos quad) (the-as uint128 0)) + (set-level-info! self arg0) + (set! (-> self nav-meshes) (new 'debug 'nav-mesh-editable-array 32)) + (dotimes (s5-0 (-> self nav-meshes length)) + (init-fields! (-> self nav-meshes data s5-0)) + (set! (-> self nav-meshes data s5-0 level-id) (the-as uint 0)) + ) + (set! (-> self undos) (new 'debug 'nav-mesh-editor-undo-array 32)) + (dotimes (s5-1 (-> self undos length)) + (init-fields! (-> self undos data s5-1)) + ) + (set! (-> self undo-id) (the-as uint 0)) + (set! (-> self undo-min) (the-as uint 0)) + (set! (-> self undo-max) (the-as uint 0)) + (set! (-> self current-nav-mesh) #f) + (set! (-> self lock-action) #f) + (set! (-> self hide-unselected) #f) + (set! (-> self allow-snap) #t) + (nav-mesh-editor-load (the-as string arg0)) + (go-virtual idle) + ) diff --git a/test/decompiler/reference/jak3/engine/debug/nav/mysql-nav-graph_REF.gc b/test/decompiler/reference/jak3/engine/debug/nav/mysql-nav-graph_REF.gc new file mode 100644 index 0000000000..2e6bbb2a54 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/nav/mysql-nav-graph_REF.gc @@ -0,0 +1,1516 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; definition of type mysql-nav-node +(deftype mysql-nav-node (structure) + ((mysql-save-flag mysql-save-flag) + (runtime-id uint32) + (temp-edge-list (inline-array mysql-nav-edge)) + (level-node-index int32) + (cam-dist float) + (visible symbol) + (nav_node_id uint32) + (nav_graph_id uint32) + (position vector :inline) + (level_name symbol) + (angle float) + (radius float) + (nav_node_flag nav-node-flag) + (nav_mesh_id uint32) + (data_int_0 uint32) + (data_int_1 uint32) + ) + (:methods + (exec-sql! (_type_) symbol) + (temp-edge-size (_type_) int) + ) + ) + +;; definition for method 3 of type mysql-nav-node +(defmethod inspect ((this mysql-nav-node)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'mysql-nav-node) + (format #t "~1Tmysql-save-flag: ~D~%" (-> this mysql-save-flag)) + (format #t "~1Truntime-id: ~D~%" (-> this runtime-id)) + (format #t "~1Ttemp-edge-list: ~A~%" (-> this temp-edge-list)) + (format #t "~1Tlevel-node-index: ~D~%" (-> this level-node-index)) + (format #t "~1Tcam-dist: ~f~%" (-> this cam-dist)) + (format #t "~1Tvisible: ~A~%" (-> this visible)) + (format #t "~1Tnav_node_id: ~D~%" (-> this nav_node_id)) + (format #t "~1Tnav_graph_id: ~D~%" (-> this nav_graph_id)) + (format #t "~1Tposition: #~%" (-> this position)) + (format #t "~1Tlevel_name: ~A~%" (-> this level_name)) + (format #t "~1Tangle: ~f~%" (-> this angle)) + (format #t "~1Tradius: ~f~%" (-> this radius)) + (format #t "~1Tnav_node_flag: ~D~%" (-> this nav_node_flag)) + (format #t "~1Tnav_mesh_id: ~D~%" (-> this nav_mesh_id)) + (format #t "~1Tdata_int_0: ~D~%" (-> this data_int_0)) + (format #t "~1Tdata_int_1: ~D~%" (-> this data_int_1)) + (label cfg-4) + this + ) + +;; definition of type mysql-nav-node-array +(deftype mysql-nav-node-array (inline-array-class) + ((data mysql-nav-node :inline :dynamic) + ) + ) + +;; definition for method 3 of type mysql-nav-node-array +(defmethod inspect ((this mysql-nav-node-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> mysql-nav-node-array heap-base) (the-as uint 80)) + +;; definition of type mysql-nav-edge +(deftype mysql-nav-edge (structure) + ((mysql-save-flag mysql-save-flag) + (runtime-id uint32) + (runtime-node-id-1 int32) + (runtime-node-id-2 int32) + (temp-next-edge mysql-nav-edge) + (nav_edge_id uint32) + (nav_graph_id uint32) + (nav_node_id_1 uint32) + (nav_node_id_2 uint32) + (directionality nav-directionality) + (speed_limit float) + (density float) + (traffic_edge_flag int32) + (nav_clock_mask nav-clock-mask) + (nav_clock_type nav-clock-type) + (nav_territory_type uint32) + (exclusive_data uint32) + (width float) + (minimap_edge_flag nav-minimap-edge-flag) + ) + :allow-misaligned + (:methods + (exec-sql! (_type_) symbol) + ) + ) + +;; definition for method 3 of type mysql-nav-edge +(defmethod inspect ((this mysql-nav-edge)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'mysql-nav-edge) + (format #t "~1Tmysql-save-flag: ~D~%" (-> this mysql-save-flag)) + (format #t "~1Truntime-id: ~D~%" (-> this runtime-id)) + (format #t "~1Truntime-node-id-1: ~D~%" (-> this runtime-node-id-1)) + (format #t "~1Truntime-node-id-2: ~D~%" (-> this runtime-node-id-2)) + (format #t "~1Ttemp-next-edge: #~%" (-> this temp-next-edge)) + (format #t "~1Tnav_edge_id: ~D~%" (-> this nav_edge_id)) + (format #t "~1Tnav_graph_id: ~D~%" (-> this nav_graph_id)) + (format #t "~1Tnav_node_id_1: ~D~%" (-> this nav_node_id_1)) + (format #t "~1Tnav_node_id_2: ~D~%" (-> this nav_node_id_2)) + (format #t "~1Tdirectionality: ~D~%" (-> this directionality)) + (format #t "~1Tspeed_limit: ~f~%" (-> this speed_limit)) + (format #t "~1Tdensity: ~f~%" (-> this density)) + (format #t "~1Ttraffic_edge_flag: ~D~%" (-> this traffic_edge_flag)) + (format #t "~1Tnav_clock_mask: ~D~%" (-> this nav_clock_mask)) + (format #t "~1Tnav_clock_type: ~D~%" (-> this nav_clock_type)) + (format #t "~1Tnav_territory_type: ~D~%" (-> this nav_territory_type)) + (format #t "~1Texclusive_data: ~D~%" (-> this exclusive_data)) + (format #t "~1Twidth: ~f~%" (-> this width)) + (format #t "~1Tminimap_edge_flag: ~D~%" (-> this minimap_edge_flag)) + (label cfg-4) + this + ) + +;; definition of type mysql-nav-edge-array +(deftype mysql-nav-edge-array (inline-array-class) + ((data mysql-nav-edge :inline :dynamic) + ) + ) + +;; definition for method 3 of type mysql-nav-edge-array +(defmethod inspect ((this mysql-nav-edge-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> mysql-nav-edge-array heap-base) (the-as uint 80)) + +;; definition of type mysql-nav-visnode +(deftype mysql-nav-visnode (structure) + ((mysql-save-flag mysql-save-flag) + (runtime-node-id int32) + (runtime-edge-id int32) + (nav_visnode_id uint32) + (nav_graph_id uint32) + (nav_node_id uint32) + (nav_edge_id uint32) + ) + (:methods + (exec-sql! (_type_) symbol) + ) + ) + +;; definition for method 3 of type mysql-nav-visnode +(defmethod inspect ((this mysql-nav-visnode)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'mysql-nav-visnode) + (format #t "~1Tmysql-save-flag: ~D~%" (-> this mysql-save-flag)) + (format #t "~1Truntime-node-id: ~D~%" (-> this runtime-node-id)) + (format #t "~1Truntime-edge-id: ~D~%" (-> this runtime-edge-id)) + (format #t "~1Tnav_visnode_id: ~D~%" (-> this nav_visnode_id)) + (format #t "~1Tnav_graph_id: ~D~%" (-> this nav_graph_id)) + (format #t "~1Tnav_node_id: ~D~%" (-> this nav_node_id)) + (format #t "~1Tnav_edge_id: ~D~%" (-> this nav_edge_id)) + (label cfg-4) + this + ) + +;; definition of type mysql-nav-visnode-array +(deftype mysql-nav-visnode-array (inline-array-class) + ((data mysql-nav-visnode :inline :dynamic) + ) + ) + +;; definition for method 3 of type mysql-nav-visnode-array +(defmethod inspect ((this mysql-nav-visnode-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> mysql-nav-visnode-array heap-base) (the-as uint 32)) + +;; definition of type mysql-nav-pov-conn +(deftype mysql-nav-pov-conn (structure) + ((runtime-node-id-1 int32) + (runtime-node-id-2 int32) + ) + ) + +;; definition for method 3 of type mysql-nav-pov-conn +(defmethod inspect ((this mysql-nav-pov-conn)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'mysql-nav-pov-conn) + (format #t "~1Truntime-node-id-1: ~D~%" (-> this runtime-node-id-1)) + (format #t "~1Truntime-node-id-2: ~D~%" (-> this runtime-node-id-2)) + (label cfg-4) + this + ) + +;; definition of type mysql-nav-graph-level-info +(deftype mysql-nav-graph-level-info (structure) + ((level symbol) + (level-id uint32) + (node-count int32) + (branch-count int32) + (to-link-count int32) + ) + :allow-misaligned + ) + +;; definition for method 3 of type mysql-nav-graph-level-info +(defmethod inspect ((this mysql-nav-graph-level-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'mysql-nav-graph-level-info) + (format #t "~1Tlevel: ~A~%" (-> this level)) + (format #t "~1Tlevel-id: ~D~%" (-> this level-id)) + (format #t "~1Tnode-count: ~D~%" (-> this node-count)) + (format #t "~1Tbranch-count: ~D~%" (-> this branch-count)) + (format #t "~1Tto-link-count: ~D~%" (-> this to-link-count)) + (label cfg-4) + this + ) + +;; definition of type mysql-nav-graph +(deftype mysql-nav-graph (basic) + ((nav_graph_id uint32) + (graph-type symbol) + (node-array mysql-nav-node-array) + (edge-array mysql-nav-edge-array) + (visnode-array mysql-nav-visnode-array) + (pov-conn-array (inline-array mysql-nav-pov-conn)) + (pov-conn-array-length int32) + (level-info-array-length int32) + (level-info-last-lookup int32) + (level-info-array mysql-nav-graph-level-info 32 :inline) + ) + (:methods + (new (symbol type string) _type_) + (init-from-sql! (_type_ symbol string) symbol) + (exec-sql! (_type_) symbol) + (indexof-nav-node (_type_ int) int) + (indexof-nav-edge (_type_ int) int) + (alloc-new-node! (_type_) int) + (alloc-new-edge! (_type_) int) + (indexof-visnode (_type_ int int) int) + (alloc-new-visnode! (_type_ int int) int) + (mysql-nav-graph-method-17 (_type_) none) + (lookup-level-info2 (_type_ mysql-nav-node symbol) mysql-nav-graph-level-info) + (mysql-nav-graph-method-19 (_type_) int) + (mysql-nav-graph-method-20 (_type_) none) + (get-graph-type (_type_ symbol) symbol) + (mysql-nav-graph-method-22 (_type_) int) + (mysql-nav-graph-method-23 (_type_ vector vector) symbol) + ) + ) + +;; definition for method 3 of type mysql-nav-graph +(defmethod inspect ((this mysql-nav-graph)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tnav_graph_id: ~D~%" (-> this nav_graph_id)) + (format #t "~1Tgraph-type: ~A~%" (-> this graph-type)) + (format #t "~1Tnode-array: ~A~%" (-> this node-array)) + (format #t "~1Tedge-array: ~A~%" (-> this edge-array)) + (format #t "~1Tvisnode-array: ~A~%" (-> this visnode-array)) + (format #t "~1Tpov-conn-array: #x~X~%" (-> this pov-conn-array)) + (format #t "~1Tpov-conn-array-length: ~D~%" (-> this pov-conn-array-length)) + (format #t "~1Tlevel-info-array-length: ~D~%" (-> this level-info-array-length)) + (format #t "~1Tlevel-info-last-lookup: ~D~%" (-> this level-info-last-lookup)) + (format #t "~1Tlevel-info-array[32] @ #x~X~%" (-> this level-info-array)) + (label cfg-4) + this + ) + +;; definition for method 0 of type mysql-nav-graph +;; WARN: Return type mismatch object vs mysql-nav-graph. +(defmethod new mysql-nav-graph ((allocation symbol) (type-to-make type) (arg0 string)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (if (zero? gp-0) + (return (the-as mysql-nav-graph 0)) + ) + (set! (-> gp-0 node-array) (new 'debug 'mysql-nav-node-array 3000)) + (set! (-> gp-0 node-array length) 0) + (set! (-> gp-0 edge-array) (new 'debug 'mysql-nav-edge-array 5000)) + (set! (-> gp-0 edge-array length) 0) + (set! (-> gp-0 visnode-array) (new 'debug 'mysql-nav-visnode-array 3000)) + (set! (-> gp-0 visnode-array length) 0) + (set! (-> gp-0 pov-conn-array) (the-as (inline-array mysql-nav-pov-conn) (malloc 'debug #x3e80))) + (set! (-> gp-0 pov-conn-array-length) 0) + (set! (-> gp-0 graph-type) (get-graph-type gp-0 (the-as symbol arg0))) + (let ((s4-0 (clear *temp-string*))) + (format *temp-string* "select nav_graph_id from nav_graph where name='~S'" arg0) + (format 0 "~S~%" *temp-string*) + (let ((a2-7 (sql-query s4-0))) + (when (not (and (= (-> a2-7 content-type) 'select) (> (-> a2-7 length) 0))) + (format 0 "ERROR: sql: select error ~A for ~A~%" a2-7 gp-0) + (return (the-as mysql-nav-graph #f)) + ) + (set! (-> gp-0 nav_graph_id) (the-as uint (string->int (the-as string (-> a2-7 sql-data 0))))) + ) + ) + gp-0 + ) + ) + +;; definition for method 21 of type mysql-nav-graph +(defmethod get-graph-type ((this mysql-nav-graph) (arg0 symbol)) + (case arg0 + (('minimap 'wasminimap) + 'minimap + ) + (else + 'unknown + ) + ) + ) + +;; definition for method 13 of type mysql-nav-graph +(defmethod alloc-new-node! ((this mysql-nav-graph)) + (cond + ((>= (-> this node-array length) 3000) + (format #t "mysql-nav-graph : nodes buffer too small, increase NAV_GRAPH_EDITOR_NODE_COUNT~%") + -1 + ) + (else + (let ((gp-0 (-> this node-array data (-> this node-array length))) + (s5-0 (-> this node-array length)) + ) + (+! (-> this node-array length) 1) + (set! (-> gp-0 mysql-save-flag) (mysql-save-flag)) + (logior! (-> gp-0 mysql-save-flag) (mysql-save-flag insert)) + (set! (-> gp-0 runtime-id) (the-as uint s5-0)) + (set! (-> gp-0 nav_graph_id) (-> this nav_graph_id)) + (set! (-> gp-0 level_name) (-> (level-get-target-inside *level*) name)) + s5-0 + ) + ) + ) + ) + +;; definition for method 14 of type mysql-nav-graph +(defmethod alloc-new-edge! ((this mysql-nav-graph)) + (cond + ((>= (-> this edge-array length) 5000) + (format #t "mysql-nav-graph : edges buffer too small, increase NAV_GRAPH_EDITOR_EDGE_COUNT~%") + -1 + ) + (else + (let ((v1-5 (-> this edge-array data (-> this edge-array length))) + (v0-1 (-> this edge-array length)) + ) + (+! (-> this edge-array length) 1) + (set! (-> v1-5 mysql-save-flag) (mysql-save-flag)) + (logior! (-> v1-5 mysql-save-flag) (mysql-save-flag insert)) + (set! (-> v1-5 runtime-id) (the-as uint v0-1)) + (set! (-> v1-5 nav_graph_id) (-> this nav_graph_id)) + (set! (-> v1-5 directionality) (nav-directionality default)) + v0-1 + ) + ) + ) + ) + +;; definition for method 15 of type mysql-nav-graph +(defmethod indexof-visnode ((this mysql-nav-graph) (arg0 int) (arg1 int)) + (dotimes (v1-0 (-> this visnode-array length)) + (let ((a3-2 (-> this visnode-array data v1-0))) + (if (and (= (-> a3-2 runtime-edge-id) arg0) (= (-> a3-2 runtime-node-id) arg1)) + (return v1-0) + ) + ) + ) + -1 + ) + +;; definition for method 16 of type mysql-nav-graph +(defmethod alloc-new-visnode! ((this mysql-nav-graph) (arg0 int) (arg1 int)) + (cond + ((>= (-> this visnode-array length) 3000) + (format #t "mysql-nav-graph : visnodes buffer too small, increase NAV_GRAPH_EDITOR_VISNODE_COUNT~%") + -1 + ) + (else + (let ((v1-3 (indexof-visnode this arg0 arg1))) + (when (>= v1-3 0) + (logclear! (-> this visnode-array data v1-3 mysql-save-flag) (mysql-save-flag delete)) + (return v1-3) + ) + ) + (let ((v1-9 (-> this visnode-array data (-> this visnode-array length))) + (v0-1 (-> this visnode-array length)) + ) + (+! (-> this visnode-array length) 1) + (set! (-> v1-9 mysql-save-flag) (mysql-save-flag)) + (logior! (-> v1-9 mysql-save-flag) (mysql-save-flag insert)) + (set! (-> v1-9 runtime-edge-id) arg0) + (set! (-> v1-9 runtime-node-id) arg1) + (set! (-> v1-9 nav_graph_id) (-> this nav_graph_id)) + v0-1 + ) + ) + ) + ) + +;; definition for method 9 of type mysql-nav-node +(defmethod exec-sql! ((this mysql-nav-node)) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag delete)) + ) + (return #t) + ) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (let ((s5-0 (clear *temp-string*))) + (case (-> this mysql-save-flag) + (((mysql-save-flag insert)) + (format s5-0 "insert nav_node set ") + ) + (((mysql-save-flag update)) + (format s5-0 "update nav_node set ") + ) + (((mysql-save-flag delete)) + (format s5-0 "delete from nav_node where ") + ) + ) + (case (-> this mysql-save-flag) + ((8 4) + (format s5-0 "nav_graph_id=~D," (-> this nav_graph_id)) + (format s5-0 "x=~M," (-> this position x)) + (format s5-0 "y=~M," (-> this position y)) + (format s5-0 "z=~M," (-> this position z)) + (format s5-0 "level_name='~S'," (-> this level_name)) + (format s5-0 "data_int_0=~D," (-> this data_int_0)) + (format s5-0 "data_int_1=~D," (-> this data_int_1)) + (format s5-0 "angle=~R," (-> this angle)) + (format s5-0 "radius=~M," (-> this radius)) + (format s5-0 "nav_node_flag='") + (let ((v1-20 #t)) + (when (logtest? (-> this nav_node_flag) (nav-node-flag blocker)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "blocker") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag pov)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "pov") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag visited)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "visited") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag blocked)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "blocked") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag pedestrian)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "pedestrian") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag selected)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "selected") + (set! v1-20 #f) + ) + (when (logtest? (-> this nav_node_flag) (nav-node-flag hidden)) + (if (not v1-20) + (format s5-0 ",") + ) + (format s5-0 "hidden") + ) + ) + (format s5-0 "',") + (format s5-0 "nav_mesh_id=~D" (-> this nav_mesh_id)) + (if (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + (format s5-0 " where nav_node_id=~D" (-> this nav_node_id)) + ) + (let ((a2-11 (sql-query s5-0))) + (when (!= (-> a2-11 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-11 this) + (return #f) + ) + ) + (when (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (let ((v1-44 (sql-query "select LAST_INSERT_ID()"))) + (if (= (-> v1-44 content-type) 'select) + (set! (-> this nav_node_id) (the-as uint (string->int (the-as string (-> v1-44 sql-data 0))))) + ) + ) + ) + ) + (((mysql-save-flag delete)) + (format s5-0 "nav_node_id=~D" (-> this nav_node_id)) + (let ((a2-13 (sql-query s5-0))) + (when (!= (-> a2-13 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-13 this) + (return #f) + ) + ) + ) + ) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag insert)) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + #t + ) + +;; definition for method 9 of type mysql-nav-edge +(defmethod exec-sql! ((this mysql-nav-edge)) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag delete)) + ) + (return #t) + ) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (let ((s5-0 (clear *temp-string*))) + (case (-> this mysql-save-flag) + (((mysql-save-flag insert)) + (format s5-0 "insert nav_edge set ") + ) + (((mysql-save-flag update)) + (format s5-0 "update nav_edge set ") + ) + (((mysql-save-flag delete)) + (format s5-0 "delete from nav_edge where ") + ) + ) + (case (-> this mysql-save-flag) + ((8 4) + (format s5-0 "nav_graph_id=~D," (-> this nav_graph_id)) + (format s5-0 "nav_node_id_1=~D," (-> this nav_node_id_1)) + (format s5-0 "nav_node_id_2=~D," (-> this nav_node_id_2)) + (let ((t9-7 format) + (a0-21 s5-0) + (a1-8 "directionality='~S',") + (v1-20 (-> this directionality)) + ) + (t9-7 a0-21 a1-8 (cond + ((= v1-20 (nav-directionality directed)) + "directed" + ) + ((= v1-20 (nav-directionality bi_directional)) + "bi_directional" + ) + (else + "default" + ) + ) + ) + ) + (format s5-0 "speed_limit=~M," (-> this speed_limit)) + (format s5-0 "density=~F," (-> this density)) + (format s5-0 "traffic_edge_flag='") + (let ((v1-21 #t)) + (when (logtest? (-> this traffic_edge_flag) 1) + (if (not v1-21) + (format s5-0 ",") + ) + (format s5-0 "pedestrian") + ) + ) + (format s5-0 "',") + (format s5-0 "nav_clock_mask='") + (let ((v1-24 #t)) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-1)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-1") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-1a)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-1a") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-2)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-2") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-2a)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-2a") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-3)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-3") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-3a)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-3a") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-4)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-4") + (set! v1-24 #f) + ) + (when (logtest? (-> this nav_clock_mask) (nav-clock-mask phase-4a)) + (if (not v1-24) + (format s5-0 ",") + ) + (format s5-0 "phase-4a") + ) + ) + (format s5-0 "',") + (let ((t9-32 format) + (a0-82 s5-0) + (a1-33 "nav_clock_type='~S',") + (v1-41 (-> this nav_clock_type)) + ) + (t9-32 a0-82 a1-33 (cond + ((= v1-41 (nav-clock-type clock2)) + "clock2" + ) + ((= v1-41 (nav-clock-type clock3)) + "clock3" + ) + ((= v1-41 (nav-clock-type clock4)) + "clock4" + ) + (else + "no-clock" + ) + ) + ) + ) + (format s5-0 "nav_territory_type=~D," (-> this nav_territory_type)) + (format s5-0 "exclusive_data=~D," (-> this exclusive_data)) + (format s5-0 "width=~M," (-> this width)) + (format s5-0 "minimap_edge_flag='") + (let ((v1-42 #t)) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "blocker") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag one-way)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "one-way") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-port-mh)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-port-mh") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-port-inda)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-port-inda") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-inda-indb)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-inda-indb") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-indb-sluma)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-indb-sluma") + (set! v1-42 #f) + ) + (when (logtest? (-> this minimap_edge_flag) (nav-minimap-edge-flag pass-slumb-genb)) + (if (not v1-42) + (format s5-0 ",") + ) + (format s5-0 "pass-slumb-genb") + ) + ) + (format s5-0 "'") + (if (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + (format s5-0 " where nav_edge_id=~D" (-> this nav_edge_id)) + ) + (let ((a2-16 (sql-query s5-0))) + (when (!= (-> a2-16 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-16 this) + (return #f) + ) + ) + (when (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (let ((v1-66 (sql-query "select LAST_INSERT_ID()"))) + (if (= (-> v1-66 content-type) 'select) + (set! (-> this nav_edge_id) (the-as uint (string->int (the-as string (-> v1-66 sql-data 0))))) + ) + ) + ) + ) + (((mysql-save-flag delete)) + (format s5-0 "nav_edge_id=~D" (-> this nav_edge_id)) + (let ((a2-18 (sql-query s5-0))) + (when (!= (-> a2-18 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-18 this) + (return #f) + ) + ) + ) + ) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag insert)) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + #t + ) + +;; definition for method 9 of type mysql-nav-visnode +(defmethod exec-sql! ((this mysql-nav-visnode)) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag delete)) + ) + (return #t) + ) + (if (and (logtest? (-> this mysql-save-flag) (mysql-save-flag insert)) + (logtest? (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + ) + (let ((s5-0 (clear *temp-string*))) + (case (-> this mysql-save-flag) + (((mysql-save-flag insert)) + (format s5-0 "insert nav_visible_nodes set ") + ) + (((mysql-save-flag update)) + (format s5-0 "update nav_visible_nodes set ") + ) + (((mysql-save-flag delete)) + (format s5-0 "delete from nav_visible_nodes where ") + ) + ) + (case (-> this mysql-save-flag) + ((8 4) + (format s5-0 "nav_graph_id=~D," (-> this nav_graph_id)) + (format s5-0 "nav_edge_id=~D," (-> this nav_edge_id)) + (format s5-0 "nav_node_id=~D" (-> this nav_node_id)) + (let ((a2-3 (sql-query s5-0))) + (when (!= (-> a2-3 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-3 this) + (return #f) + ) + ) + ) + (((mysql-save-flag delete)) + (format s5-0 "nav_graph_id=~D and " (-> this nav_graph_id)) + (format s5-0 "nav_edge_id=~D and " (-> this nav_edge_id)) + (format s5-0 "nav_node_id=~D" (-> this nav_node_id)) + (let ((a2-7 (sql-query s5-0))) + (when (!= (-> a2-7 content-type) 'modify) + (format 0 "ERROR: sql: modify error ~A for ~A~%" a2-7 this) + (return #f) + ) + ) + ) + ) + ) + (logclear! (-> this mysql-save-flag) (mysql-save-flag insert)) + (logclear! (-> this mysql-save-flag) (mysql-save-flag update)) + #t + ) + +;; definition for method 11 of type mysql-nav-graph +(defmethod indexof-nav-node ((this mysql-nav-graph) (arg0 int)) + (dotimes (v1-0 (-> this node-array length)) + (if (= arg0 (-> this node-array data v1-0 nav_node_id)) + (return v1-0) + ) + ) + -1 + ) + +;; definition for method 12 of type mysql-nav-graph +(defmethod indexof-nav-edge ((this mysql-nav-graph) (arg0 int)) + (dotimes (v1-0 (-> this edge-array length)) + (if (= arg0 (-> this edge-array data v1-0 nav_edge_id)) + (return v1-0) + ) + ) + -1 + ) + +;; definition for method 9 of type mysql-nav-graph +;; INFO: Used lq/sq +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +;; WARN: new jak 2 until loop case, check carefully +(defmethod init-from-sql! ((this mysql-nav-graph) (arg0 symbol) (arg1 string)) + (local-vars (sv-16 string) (sv-32 int) (sv-48 int) (sv-64 int)) + (set! (-> this node-array length) 0) + (set! (-> this edge-array length) 0) + (set! (-> this visnode-array length) 0) + (set! (-> this graph-type) (get-graph-type this arg0)) + (let ((s3-0 (clear *temp-string*))) + (format s3-0 "select nav_graph_id from nav_graph where name='~S'" arg0) + (format 0 "~S~%" s3-0) + (let ((a2-3 (sql-query s3-0))) + (when (!= (-> a2-3 content-type) 'select) + (format 0 "ERROR: sql: select error ~A for ~A~%" a2-3 this) + (return #f) + ) + (set! (-> this nav_graph_id) (the-as uint (string->int (the-as string (-> a2-3 sql-data 0))))) + ) + ) + (format #t "Loading nodes ...~%") + (let ((s4-1 0) + (s3-1 256) + ) + (until #f + (let ((s2-0 (clear *temp-string*))) + (format + s2-0 + "select nav_node_id,x,y,z,level_name,angle,radius,nav_node_flag,nav_mesh_id,nav_graph_id,data_int_0,data_int_1 from nav_node" + ) + (format s2-0 " where nav_graph_id = ~D" (-> this nav_graph_id)) + (if arg1 + (format s2-0 " and level_name='~S'" arg1) + ) + (if (= (-> this nav_graph_id) 20) + (format s2-0 " order by nav_node_id") + ) + (format s2-0 " limit ~D,~D" s4-1 s3-1) + (let ((s2-1 (sql-query s2-0))) + (when (!= (-> s2-1 content-type) 'select) + (format 0 "ERROR: sql: select error ~A for ~A~%" s2-1 this) + (return #f) + ) + (let ((s1-0 0)) + (while (< s1-0 (-> s2-1 length)) + (when (= (string->int (the-as string (-> s2-1 sql-data (+ s1-0 9)))) (-> this nav_graph_id)) + (let ((s0-1 (-> this node-array data (-> this node-array length)))) + (set! (-> s0-1 mysql-save-flag) (mysql-save-flag)) + (set! (-> s0-1 runtime-id) (the-as uint (-> this node-array length))) + (set! (-> s0-1 nav_graph_id) (-> this nav_graph_id)) + (set! (-> s0-1 nav_node_id) (the-as uint (string->int (the-as string (-> s2-1 sql-data s1-0))))) + (set! (-> s0-1 position x) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 1)))))) + (set! (-> s0-1 position y) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 2)))))) + (set! (-> s0-1 position z) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 3)))))) + (set! (-> s0-1 level_name) (string->symbol (the-as string (-> s2-1 sql-data (+ s1-0 4))))) + (set! (-> s0-1 data_int_0) (the-as uint (string->int (the-as string (-> s2-1 sql-data (+ s1-0 10)))))) + (set! (-> s0-1 data_int_1) (the-as uint (string->int (the-as string (-> s2-1 sql-data (+ s1-0 11)))))) + (set! (-> s0-1 angle) (* 182.04445 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 5)))))) + (set! (-> s0-1 radius) (* 4096.0 (string->float (the-as string (-> s2-1 sql-data (+ s1-0 6)))))) + (set! (-> s0-1 nav_node_flag) (nav-node-flag)) + (set! sv-16 (new 'global 'string 0 (the-as string (-> s2-1 sql-data (+ s1-0 7))))) + (copy-string<-string sv-16 (the-as string (-> s2-1 sql-data (+ s1-0 7)))) + (until #f + (cond + ((string-prefix= "blocker" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocker)) + ) + ((string-prefix= "pov" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag pov)) + ) + ((string-prefix= "visited" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag visited)) + ) + ((string-prefix= "blocked" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag blocked)) + ) + ((string-prefix= "pedestrian" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag pedestrian)) + ) + ((string-prefix= "selected" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag selected)) + ) + ((string-prefix= "hidden" sv-16) + (logior! (-> s0-1 nav_node_flag) (nav-node-flag hidden)) + ) + (else + #t + (goto cfg-33) + ) + ) + (let ((a1-22 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) + (if (= (-> a1-22 0) 44) + (set! a1-22 (&-> a1-22 1)) + ) + (string-suck-up! sv-16 a1-22) + ) + ) + #f + (label cfg-33) + (set! (-> s0-1 nav_mesh_id) (the-as uint (string->int (the-as string (-> s2-1 sql-data (+ s1-0 8)))))) + ) + (+! (-> this node-array length) 1) + ) + (+! s1-0 12) + ) + ) + (when (< (-> s2-1 length) (* 10 s3-1)) + #t + (goto cfg-40) + ) + ) + ) + (+! s4-1 s3-1) + ) + ) + #f + (label cfg-40) + (format #t "~D nodes.~%" (-> this node-array length)) + (format #t "Loading edges ...~%") + (let ((s5-1 0) + (s4-2 256) + ) + (until #f + (let ((s3-2 (clear *temp-string*))) + (format + s3-2 + "select nav_edge_id,nav_node_id_1,nav_node_id_2,directionality,speed_limit,density,traffic_edge_flag,nav_clock_mask,nav_territory_type,exclusive_data,width,minimap_edge_flag,nav_graph_id from nav_edge" + ) + (format s3-2 " where nav_graph_id = ~D" (-> this nav_graph_id)) + (format s3-2 " limit ~D,~D" s5-1 s4-2) + (let ((s3-3 (sql-query s3-2))) + (when (!= (-> s3-3 content-type) 'select) + (format 0 "ERROR: sql: select error ~A for ~A~%" s3-3 this) + (return #f) + ) + (let ((s2-2 0)) + (while (< s2-2 (-> s3-3 length)) + (when (= (string->int (the-as string (-> s3-3 sql-data (+ s2-2 12)))) (-> this nav_graph_id)) + (let ((s0-2 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 1)))))) + (set! sv-32 (string->int (the-as string (-> s3-3 sql-data (+ s2-2 2))))) + (set! sv-48 (indexof-nav-node this s0-2)) + (set! sv-64 (indexof-nav-node this sv-32)) + (let ((s1-2 (-> this edge-array data (-> this edge-array length)))) + (when (and (!= sv-48 -1) (!= sv-64 -1)) + (set! (-> s1-2 nav_graph_id) (-> this nav_graph_id)) + (set! (-> s1-2 nav_edge_id) (the-as uint (string->int (the-as string (-> s3-3 sql-data s2-2))))) + (set! (-> s1-2 nav_node_id_1) (the-as uint s0-2)) + (set! (-> s1-2 nav_node_id_2) (the-as uint sv-32)) + (set! (-> s1-2 mysql-save-flag) (mysql-save-flag)) + (set! (-> s1-2 runtime-id) (the-as uint (-> this edge-array length))) + (set! (-> s1-2 runtime-node-id-1) sv-48) + (set! (-> s1-2 runtime-node-id-2) sv-64) + (let ((s0-3 (-> s3-3 sql-data (+ s2-2 3)))) + (cond + ((string= "default" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality default)) + 0 + ) + ((string= "directed" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality directed)) + ) + ((string= "bi_directional" (the-as string s0-3)) + (set! (-> s1-2 directionality) (nav-directionality bi_directional)) + ) + ) + ) + (set! (-> s1-2 speed_limit) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 4)))))) + (set! (-> s1-2 density) (string->float (the-as string (-> s3-3 sql-data (+ s2-2 5))))) + (set! (-> s1-2 traffic_edge_flag) 0) + (let ((s0-4 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 6)))))) + (copy-string<-string s0-4 (the-as string (-> s3-3 sql-data (+ s2-2 6)))) + (until #f + (cond + ((string-prefix= "pedestrian" s0-4) + (logior! (-> s1-2 traffic_edge_flag) 1) + ) + (else + #t + (goto cfg-64) + ) + ) + (let ((a1-38 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) + (if (= (-> a1-38 0) 44) + (set! a1-38 (&-> a1-38 1)) + ) + (string-suck-up! s0-4 a1-38) + ) + ) + ) + #f + (label cfg-64) + (set! (-> s1-2 nav_clock_mask) (nav-clock-mask)) + (let ((s0-5 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 7)))))) + (copy-string<-string s0-5 (the-as string (-> s3-3 sql-data (+ s2-2 7)))) + (until #f + (cond + ((string-prefix= "phase-1a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1a)) + ) + ((string-prefix= "phase-1" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-1)) + ) + ((string-prefix= "phase-2a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2a)) + ) + ((string-prefix= "phase-2" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-2)) + ) + ((string-prefix= "phase-3a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3a)) + ) + ((string-prefix= "phase-3" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-3)) + ) + ((string-prefix= "phase-4a" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4a)) + ) + ((string-prefix= "phase-4" s0-5) + (logior! (-> s1-2 nav_clock_mask) (nav-clock-mask phase-4)) + ) + (else + #t + (goto cfg-86) + ) + ) + (let ((a1-50 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) + (if (= (-> a1-50 0) 44) + (set! a1-50 (&-> a1-50 1)) + ) + (string-suck-up! s0-5 a1-50) + ) + ) + ) + #f + (label cfg-86) + (set! (-> s1-2 nav_territory_type) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 8)))))) + (set! (-> s1-2 exclusive_data) (the-as uint (string->int (the-as string (-> s3-3 sql-data (+ s2-2 9)))))) + (set! (-> s1-2 width) (* 4096.0 (string->float (the-as string (-> s3-3 sql-data (+ s2-2 10)))))) + (set! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag)) + (let ((s0-6 (new 'global 'string 0 (the-as string (-> s3-3 sql-data (+ s2-2 11)))))) + (copy-string<-string s0-6 (the-as string (-> s3-3 sql-data (+ s2-2 11)))) + (until #f + (cond + ((string-prefix= "blocker" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag blocker)) + ) + ((string-prefix= "one-way" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag one-way)) + ) + ((string-prefix= "pass-port-mh" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-mh)) + ) + ((string-prefix= "pass-port-inda" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-port-inda)) + ) + ((string-prefix= "pass-inda-indb" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-inda-indb)) + ) + ((string-prefix= "pass-indb-sluma" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-indb-sluma)) + ) + ((string-prefix= "pass-slumb-genb" s0-6) + (logior! (-> s1-2 minimap_edge_flag) (nav-minimap-edge-flag pass-slumb-genb)) + ) + (else + #t + (goto cfg-106) + ) + ) + (let ((a1-61 (string-skip-to-char (-> s0-6 data) (the-as uint 44)))) + (if (= (-> a1-61 0) 44) + (set! a1-61 (&-> a1-61 1)) + ) + (string-suck-up! s0-6 a1-61) + ) + ) + ) + #f + (label cfg-106) + (+! (-> this edge-array length) 1) + ) + ) + ) + ) + (+! s2-2 13) + ) + ) + (when (< (-> s3-3 length) (* 13 s4-2)) + #t + (goto cfg-113) + ) + ) + ) + (+! s5-1 s4-2) + ) + ) + #f + (label cfg-113) + (format #t "~D edges.~%" (-> this edge-array length)) + (format #t "Loading visnodes ...~%") + (let ((s5-2 0) + (s4-3 256) + ) + (until #f + (let ((s3-4 (clear *temp-string*))) + (format s3-4 "select nav_edge_id,nav_node_id,nav_graph_id from nav_visible_nodes") + (format s3-4 " where nav_graph_id = ~D" (-> this nav_graph_id)) + (format s3-4 " limit ~D,~D" s5-2 s4-3) + (let ((s3-5 (sql-query s3-4))) + (when (!= (-> s3-5 content-type) 'select) + (format 0 "ERROR: sql: select error ~A for ~A~%" s3-5 this) + (return #f) + ) + (let ((s2-3 0)) + (while (< s2-3 (-> s3-5 length)) + (when (= (string->int (the-as string (-> s3-5 sql-data (+ s2-3 2)))) (-> this nav_graph_id)) + (let ((s1-4 (-> this visnode-array data (-> this visnode-array length)))) + (set! (-> s1-4 mysql-save-flag) (mysql-save-flag)) + (set! (-> s1-4 nav_graph_id) (-> this nav_graph_id)) + (set! (-> s1-4 nav_edge_id) (the-as uint (string->int (the-as string (-> s3-5 sql-data s2-3))))) + (set! (-> s1-4 nav_node_id) (the-as uint (string->int (the-as string (-> s3-5 sql-data (+ s2-3 1)))))) + (set! (-> s1-4 runtime-edge-id) (indexof-nav-edge this (the-as int (-> s1-4 nav_edge_id)))) + (set! (-> s1-4 runtime-node-id) (indexof-nav-node this (the-as int (-> s1-4 nav_node_id)))) + ) + (+! (-> this visnode-array length) 1) + ) + (+! s2-3 3) + ) + ) + (when (< (-> s3-5 length) (* 3 s4-3)) + #t + (goto cfg-126) + ) + ) + ) + (+! s5-2 s4-3) + ) + ) + #f + (label cfg-126) + (format #t "~D visnodes.~%" (-> this visnode-array length)) + (mysql-nav-graph-method-22 this) + #t + ) + +;; definition for method 10 of type mysql-nav-node +(defmethod temp-edge-size ((this mysql-nav-node)) + (let ((v0-0 0)) + (let ((v1-0 (the-as object (-> this temp-edge-list)))) + (while v1-0 + (+! v0-0 1) + (set! v1-0 (-> (the-as mysql-nav-edge v1-0) temp-next-edge)) + ) + ) + v0-0 + ) + ) + +;; definition for method 17 of type mysql-nav-graph +;; WARN: Return type mismatch int vs none. +(defmethod mysql-nav-graph-method-17 ((this mysql-nav-graph)) + (dotimes (v1-0 (-> this node-array length)) + (set! (-> this node-array data v1-0 temp-edge-list) (the-as (inline-array mysql-nav-edge) #f)) + ) + (dotimes (v1-3 (-> this edge-array length)) + (set! (-> this edge-array data v1-3 temp-next-edge) #f) + ) + (countdown (v1-7 (-> this edge-array length)) + (let ((a1-17 (-> this edge-array data v1-7))) + (when (not (logtest? (-> a1-17 mysql-save-flag) (mysql-save-flag delete))) + (let ((a2-8 (-> this node-array data (-> a1-17 runtime-node-id-1)))) + (when (not (logtest? (-> a2-8 mysql-save-flag) (mysql-save-flag delete))) + (cond + ((-> a2-8 temp-edge-list) + (set! (-> a1-17 temp-next-edge) (the-as mysql-nav-edge (-> a2-8 temp-edge-list))) + (set! (-> a2-8 temp-edge-list) (the-as (inline-array mysql-nav-edge) a1-17)) + ) + (else + (set! (-> a2-8 temp-edge-list) (the-as (inline-array mysql-nav-edge) a1-17)) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 18 of type mysql-nav-graph +(defmethod lookup-level-info2 ((this mysql-nav-graph) (arg0 mysql-nav-node) (arg1 symbol)) + (let ((s5-0 (the-as mysql-nav-graph-level-info #f))) + (b! (>= (-> this level-info-last-lookup) (-> this level-info-array-length)) cfg-3 :delay #f) + (let ((v1-5 (-> this level-info-array (-> this level-info-last-lookup)))) + (let ((a0-2 (-> v1-5 level))) + (b! (!= (-> arg0 level_name) a0-2) cfg-3 :delay (empty-form)) + ) + (set! s5-0 v1-5) + ) + (b! #t cfg-18 :delay (nop!)) + (label cfg-3) + (let ((v1-6 0)) + (b! #t cfg-9 :delay (nop!)) + (label cfg-4) + (let ((a0-6 (-> this level-info-array v1-6))) + (let ((a3-1 (-> a0-6 level))) + (b! (!= (-> arg0 level_name) a3-1) cfg-8 :delay (empty-form)) + ) + (if arg1 + (set! (-> this level-info-last-lookup) v1-6) + ) + (set! s5-0 a0-6) + ) + (b! #t cfg-18 :delay (nop!)) + (label cfg-8) + (+! v1-6 1) + (label cfg-9) + (b! (< v1-6 (-> this level-info-array-length)) cfg-4) + ) + (let ((v1-9 (-> this level-info-array-length))) + (cond + ((< v1-9 32) + (if arg1 + (set! (-> this level-info-last-lookup) v1-9) + ) + (set! s5-0 (-> this level-info-array v1-9)) + (set! (-> s5-0 level) (-> arg0 level_name)) + (set! (-> s5-0 node-count) 0) + (+! (-> this level-info-array-length) 1) + ) + (else + (format + 0 + "mysql-nav-graph::lookup-level-info: Error, too many unique level names in nav-graph. May need to increase the max (currently ~d)~%" + 32 + ) + (dotimes (s4-0 (-> this level-info-array-length)) + (let ((v1-17 (-> this level-info-array s4-0))) + (format 0 "~d ~s~%" s4-0 (-> v1-17 level)) + ) + ) + (break!) + 0 + ) + ) + ) + (label cfg-18) + s5-0 + ) + ) + +;; definition for method 19 of type mysql-nav-graph +(defmethod mysql-nav-graph-method-19 ((this mysql-nav-graph)) + (set! (-> this level-info-array-length) 0) + (set! (-> this level-info-last-lookup) 0) + (dotimes (v1-0 32) + (let ((a0-3 (-> this level-info-array v1-0))) + (set! (-> a0-3 level) #f) + (set! (-> a0-3 level-id) (the-as uint v1-0)) + (set! (-> a0-3 node-count) 0) + (set! (-> a0-3 branch-count) 0) + (set! (-> a0-3 to-link-count) 0) + ) + 0 + ) + (dotimes (s5-0 (-> this node-array length)) + (let ((s4-0 (-> this node-array data s5-0))) + (when (not (logtest? (-> s4-0 mysql-save-flag) (mysql-save-flag delete))) + (let ((v1-10 (lookup-level-info2 this s4-0 #t))) + (set! (-> s4-0 level-node-index) (-> v1-10 node-count)) + (+! (-> v1-10 node-count) 1) + (let ((a0-10 (the-as object (-> s4-0 temp-edge-list)))) + (while a0-10 + (when (not (logtest? (-> (the-as mysql-nav-edge a0-10) mysql-save-flag) (mysql-save-flag delete))) + (if (!= (-> v1-10 level) + (-> this node-array data (-> (the-as mysql-nav-edge a0-10) runtime-node-id-2) level_name) + ) + (+! (-> v1-10 to-link-count) 1) + ) + (+! (-> v1-10 branch-count) 1) + ) + (set! a0-10 (-> (the-as mysql-nav-edge a0-10) temp-next-edge)) + ) + ) + ) + ) + ) + ) + 0 + ) + +;; definition for method 20 of type mysql-nav-graph +;; WARN: Return type mismatch int vs none. +(defmethod mysql-nav-graph-method-20 ((this mysql-nav-graph)) + (mysql-nav-graph-method-17 this) + (mysql-nav-graph-method-19 this) + 0 + (none) + ) + +;; definition for method 10 of type mysql-nav-graph +(defmethod exec-sql! ((this mysql-nav-graph)) + (format #t "Saving nodes ...~%") + (dotimes (s5-0 (-> this node-array length)) + (let ((a0-3 (-> this node-array data s5-0))) + (set! (-> a0-3 nav_graph_id) (-> this nav_graph_id)) + (if (not (exec-sql! a0-3)) + (return #f) + ) + ) + ) + (format #t "Done.~%") + (format #t "Saving edges ...~%") + (dotimes (s5-1 (-> this edge-array length)) + (let ((a0-7 (-> this edge-array data s5-1))) + (set! (-> a0-7 nav_graph_id) (-> this nav_graph_id)) + (set! (-> a0-7 nav_node_id_1) (-> this node-array data (-> a0-7 runtime-node-id-1) nav_node_id)) + (set! (-> a0-7 nav_node_id_2) (-> this node-array data (-> a0-7 runtime-node-id-2) nav_node_id)) + (exec-sql! a0-7) + ) + ) + (format #t "Done.~%") + (format #t "Saving visible nodes ...~%") + (dotimes (s5-2 (-> this visnode-array length)) + (let ((a0-11 (-> this visnode-array data s5-2))) + (set! (-> a0-11 nav_graph_id) (-> this nav_graph_id)) + (set! (-> a0-11 nav_node_id) (-> this node-array data (-> a0-11 runtime-node-id) nav_node_id)) + (set! (-> a0-11 nav_edge_id) (-> this edge-array data (-> a0-11 runtime-edge-id) nav_edge_id)) + (if (not (exec-sql! a0-11)) + (return #f) + ) + ) + ) + (format #t "Done.~%") + #t + ) + +;; definition for method 23 of type mysql-nav-graph +;; INFO: Used lq/sq +(defmethod mysql-nav-graph-method-23 ((this mysql-nav-graph) (arg0 vector) (arg1 vector)) + (let ((s3-0 (new 'stack-no-clear 'inline-array 'vector 5))) + (dotimes (s2-0 (-> this edge-array length)) + (let ((v1-3 (-> this edge-array data s2-0))) + (when (and (logtest? (-> v1-3 minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (not (logtest? (-> v1-3 mysql-save-flag) (mysql-save-flag delete))) + ) + (set! (-> s3-0 0 quad) + (-> (the-as + (pointer uint128) + (+ (the-as uint (-> this node-array data 0 position)) (* 80 (-> v1-3 runtime-node-id-1))) + ) + ) + ) + (set! (-> s3-0 1 quad) + (-> (the-as + (pointer uint128) + (+ (the-as uint (-> this node-array data 0 position)) (* 80 (-> v1-3 runtime-node-id-2))) + ) + ) + ) + (vector-! (-> s3-0 2) (-> s3-0 1) (-> s3-0 0)) + (set! (-> s3-0 2 y) 0.0) + (vector-normalize! (-> s3-0 2) 1.0) + (vector-rotate90-around-y! (-> s3-0 2) (-> s3-0 2)) + (vector+! (-> s3-0 3) (-> s3-0 0) (-> s3-0 1)) + (vector-float*! (-> s3-0 3) (-> s3-0 3) 0.5) + (let ((f0-3 (vector-dot (-> s3-0 3) (-> s3-0 2))) + (f1-1 (vector-dot arg0 (-> s3-0 2))) + (f2-1 (vector-dot arg1 (-> s3-0 2))) + ) + (when (< (* (- f1-1 f0-3) (- f2-1 f0-3)) 0.0) + (vector-! (-> s3-0 4) arg1 arg0) + (vector-float*! (-> s3-0 4) (-> s3-0 4) (/ (- f0-3 f1-1) (- f2-1 f1-1))) + (vector+! (-> s3-0 4) (-> s3-0 4) arg0) + (if (>= (+ 409.6 (* 0.5 (vector-vector-xz-distance (-> s3-0 0) (-> s3-0 1)))) + (vector-vector-xz-distance (-> s3-0 4) (-> s3-0 3)) + ) + (return #f) + ) + ) + ) + ) + ) + ) + ) + #t + ) + +;; definition for method 22 of type mysql-nav-graph +(defmethod mysql-nav-graph-method-22 ((this mysql-nav-graph)) + (let ((s4-0 (-> this node-array length)) + (s5-0 0) + ) + (when (< 1 s4-0) + (dotimes (s3-0 (+ s4-0 -1)) + (let ((s2-0 (-> this node-array data s3-0))) + (when (and (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pov)) + (not (logtest? (-> s2-0 mysql-save-flag) (mysql-save-flag delete))) + ) + (let ((s1-0 (+ s3-0 1))) + (while (< s1-0 s4-0) + (let ((s0-0 (-> this node-array data s1-0))) + (when (and (logtest? (-> s0-0 nav_node_flag) (nav-node-flag pov)) + (not (logtest? (-> s0-0 mysql-save-flag) (mysql-save-flag delete))) + ) + (when (mysql-nav-graph-method-23 this (-> s2-0 position) (-> s0-0 position)) + (cond + ((< s5-0 1000) + (let ((v1-22 (-> this pov-conn-array s5-0))) + (+! s5-0 1) + (set! (-> v1-22 runtime-node-id-1) (the-as int (-> s2-0 runtime-id))) + (set! (-> v1-22 runtime-node-id-2) (the-as int (-> s0-0 runtime-id))) + ) + ) + ((= s5-0 1000) + (format #t "mysql-nav-graph : pov-conn-array too small, increase NAV_GRAPH_EDITOR_POV_CONN_COUNT~%") + ) + ) + ) + ) + ) + (+! s1-0 1) + ) + ) + ) + ) + ) + ) + (let ((v0-3 (min 1000 s5-0))) + (set! (-> this pov-conn-array-length) v0-3) + v0-3 + ) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/debug/nav/nav-graph-editor_REF.gc b/test/decompiler/reference/jak3/engine/debug/nav/nav-graph-editor_REF.gc new file mode 100644 index 0000000000..35ec7ff285 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/nav/nav-graph-editor_REF.gc @@ -0,0 +1,2755 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; definition of type nav-graph-command +(deftype nav-graph-command (structure) + ((com-type nav-com-type) + (id int32) + (index int32) + (move-vec vector :inline) + ) + ) + +;; definition for method 3 of type nav-graph-command +(defmethod inspect ((this nav-graph-command)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'nav-graph-command) + (format #t "~1Tcom-type: ~D~%" (-> this com-type)) + (format #t "~1Tid: ~D~%" (-> this id)) + (format #t "~1Tindex: ~D~%" (-> this index)) + (format #t "~1Tmove-vec: #~%" (-> this move-vec)) + (label cfg-4) + this + ) + +;; definition of type nav-graph-command-array +(deftype nav-graph-command-array (inline-array-class) + ((data nav-graph-command :inline :dynamic) + ) + ) + +;; definition for method 3 of type nav-graph-command-array +(defmethod inspect ((this nav-graph-command-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> nav-graph-command-array heap-base) (the-as uint 32)) + +;; definition of type nav-graph-editor +(deftype nav-graph-editor (process) + ((nav-graph mysql-nav-graph) + (mode symbol) + (command-id int32) + (max-command int32) + (selected-index int32) + (selected-dist float) + (selected-node-edge? symbol) + (closest-node int32) + (dist-closest-node float) + (closest-edge int32) + (dist-closest-edge float) + (mouse-pos vector :inline) + (mouse-hit vector :inline) + (mouse-hit-pick vector :inline) + (mouse-normal vector :inline) + (mouse-spos-hold vector :inline) + (edge-src int32) + (edge-dst int32) + (edge-visibility int32) + (vehicle-edit-mode symbol) + (hover-edit-mode symbol) + (plane-height float) + (plane-height-hold float) + (minimap-make-mode uint8) + (clipping-dist float) + (default-node mysql-nav-node :inline) + (default-edge mysql-nav-edge :inline) + (command-array nav-graph-command-array) + ) + (:state-methods + move-node + move-plane + create + edit-edge + create-edge + adjust-plane + adjust-it + adjust-minimap + adjust-node-angle + adjust-node-radius + adjust-edge-visibility + adjust-edge-width + adjust-edge-density + draw-closest-minimap + create-pov + ) + (:methods + (nav-graph-editor-method-29 (_type_) none) + (nav-graph-editor-method-30 (_type_ string string string) object) + (nav-graph-editor-method-31 (_type_ int) symbol) + (nav-graph-editor-method-32 (_type_ int) symbol) + (nav-graph-editor-method-33 (_type_ int int) object) + (nav-graph-editor-method-34 (_type_ int) none) + (nav-graph-editor-method-35 (_type_ vector vector) none) + (nav-graph-editor-method-36 (_type_) none) + (nav-graph-editor-method-37 (_type_) object) + (nav-graph-editor-method-38 (_type_) none) + (nav-graph-editor-method-39 (_type_) none) + (nav-graph-editor-method-40 (_type_) none) + (nav-graph-editor-method-41 (_type_) none) + (nav-graph-editor-method-42 (_type_) none) + (nav-graph-editor-method-43 (_type_) none) + (nav-graph-editor-method-44 (_type_) none) + (nav-graph-editor-method-45 (_type_) none) + (nav-graph-editor-method-46 (_type_) none) + (nav-graph-editor-method-47 (_type_) symbol) + (nav-graph-editor-method-48 (_type_) none) + (nav-graph-editor-method-49 (_type_) symbol) + (nav-graph-editor-method-50 (_type_) none) + (inc-cmd-id! (_type_) int) + (alloc-new-cmd! (_type_ int) nav-graph-command) + (get-last-cmd (_type_) nav-graph-command) + (nav-graph-editor-method-54 (_type_) none) + (nav-graph-editor-method-55 (_type_) none) + (nav-graph-editor-method-56 (_type_) int) + (nav-graph-editor-method-57 (_type_ int int) none) + (nav-graph-editor-method-58 (_type_ int) symbol) + (nav-graph-editor-method-59 (_type_ int) none) + (nav-graph-editor-method-60 (_type_ int) none) + (nav-graph-editor-method-61 (_type_ int int) none) + (nav-graph-editor-method-62 (_type_) symbol) + (nav-graph-editor-method-63 (_type_) none) + (nav-graph-editor-method-64 (_type_) none) + (nav-graph-editor-method-65 (_type_) none) + (nav-graph-editor-method-66 (_type_ symbol string) none) + (nav-graph-editor-method-67 (_type_) none) + ) + ) + +;; definition for method 3 of type nav-graph-editor +(defmethod inspect ((this nav-graph-editor)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 this) + ) + (format #t "~2Tnav-graph: ~A~%" (-> this nav-graph)) + (format #t "~2Tmode: ~D~%" (-> this mode)) + (format #t "~2Tcommand-id: ~D~%" (-> this command-id)) + (format #t "~2Tmax-command: ~D~%" (-> this max-command)) + (format #t "~2Tselected-index: ~D~%" (-> this selected-index)) + (format #t "~2Tselected-dist: ~f~%" (-> this selected-dist)) + (format #t "~2Tselected-node-edge?: ~A~%" (-> this selected-node-edge?)) + (format #t "~2Tclosest-node: ~D~%" (-> this closest-node)) + (format #t "~2Tdist-closest-node: ~f~%" (-> this dist-closest-node)) + (format #t "~2Tclosest-edge: ~D~%" (-> this closest-edge)) + (format #t "~2Tdist-closest-edge: ~f~%" (-> this dist-closest-edge)) + (format #t "~2Tmouse-pos: #~%" (-> this mouse-pos)) + (format #t "~2Tmouse-hit: #~%" (-> this mouse-hit)) + (format #t "~2Tmouse-hit-pick: #~%" (-> this mouse-hit-pick)) + (format #t "~2Tmouse-normal: #~%" (-> this mouse-normal)) + (format #t "~2Tmouse-spos-hold: #~%" (-> this mouse-spos-hold)) + (format #t "~2Tedge-src: ~D~%" (-> this edge-src)) + (format #t "~2Tedge-dst: ~D~%" (-> this edge-dst)) + (format #t "~2Tedge-visibility: ~D~%" (-> this edge-visibility)) + (format #t "~2Tvehicle-edit-mode: ~A~%" (-> this vehicle-edit-mode)) + (format #t "~2Thover-edit-mode: ~A~%" (-> this hover-edit-mode)) + (format #t "~2Tplane-height: ~f~%" (-> this plane-height)) + (format #t "~2Tplane-height-hold: ~f~%" (-> this plane-height-hold)) + (format #t "~2Tminimap-make-mode: ~D~%" (-> this minimap-make-mode)) + (format #t "~2Tclipping-dist: ~f~%" (-> this clipping-dist)) + (format #t "~2Tdefault-node: #~%" (-> this default-node)) + (format #t "~2Tdefault-edge: #~%" (-> this default-edge)) + (format #t "~2Tcommand-array: ~A~%" (-> this command-array)) + (label cfg-4) + this + ) + +;; definition for symbol *nav-graph-editor*, type (pointer nav-graph-editor) +(define *nav-graph-editor* (the-as (pointer nav-graph-editor) #f)) + +;; definition for function get-node-draw-position +;; INFO: Used lq/sq +(defun get-node-draw-position ((arg0 vector) (arg1 mysql-nav-node)) + (vector-copy! arg0 (-> arg1 position)) + (+! (-> arg0 y) (* 0.05 (- (-> (camera-pos) y) (-> arg0 y)))) + arg0 + ) + +;; definition for method 66 of type nav-graph-editor +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-66 ((this nav-graph-editor) (arg0 symbol) (arg1 string)) + (case arg0 + (('minimap) + (set! (-> this vehicle-edit-mode) #t) + (set! (-> this default-node nav_node_flag) (nav-node-flag)) + (set! (-> this clipping-dist) 3276800.0) + ) + (('hover) + (set! (-> this hover-edit-mode) #t) + ) + ) + (if (= (-> (level-get-target-inside *level*) name) 'desert) + (+! (-> this clipping-dist) 4096000.0) + ) + (set! (-> this command-array length) 0) + (init-from-sql! (-> this nav-graph) arg0 arg1) + (set! (-> this default-node nav_graph_id) (-> this nav-graph nav_graph_id)) + (set! (-> this default-edge nav_graph_id) (-> this nav-graph nav_graph_id)) + (none) + ) + +;; definition for method 67 of type nav-graph-editor +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-67 ((this nav-graph-editor)) + (set! (-> this command-array length) 0) + (exec-sql! (-> this nav-graph)) + (none) + ) + +;; definition for method 10 of type nav-graph-editor +(defmethod deactivate ((this nav-graph-editor)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (set! *nav-graph-editor* (the-as (pointer nav-graph-editor) #f)) + ((method-of-type process deactivate) this) + (none) + ) + +;; definition for method 7 of type nav-graph-editor +(defmethod relocate ((this nav-graph-editor) (offset int)) + (call-parent-method this offset) + ) + +;; definition for method 64 of type nav-graph-editor +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-64 ((this nav-graph-editor)) + (let ((v0-0 (not (-> this vehicle-edit-mode)))) + (set! (-> this vehicle-edit-mode) v0-0) + (set! (-> this default-node nav_node_flag) (if v0-0 + (nav-node-flag) + (nav-node-flag pedestrian) + ) + ) + ) + (none) + ) + +;; definition for method 65 of type nav-graph-editor +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-65 ((this nav-graph-editor)) + (set! (-> this hover-edit-mode) (not (-> this hover-edit-mode))) + (none) + ) + +;; definition for method 58 of type nav-graph-editor +(defmethod nav-graph-editor-method-58 ((this nav-graph-editor) (arg0 int)) + (when (not (-> this hover-edit-mode)) + (let ((gp-0 (-> this nav-graph node-array data arg0))) + (dotimes (s5-0 (-> *level* length)) + (let ((s4-0 (-> *level* level s5-0))) + (when (= (-> s4-0 status) 'active) + (let ((s3-0 (-> s4-0 bsp nav-meshes))) + (when (nonzero? s3-0) + (dotimes (s2-0 (-> s3-0 length)) + (let ((s1-0 (-> s3-0 s2-0))) + (-> s1-0 aid) + (let ((v1-14 (as-type s1-0 entity-nav-mesh))) + (when v1-14 + (let ((a0-7 (-> v1-14 nav-mesh)) + (a1-2 (new 'stack-no-clear 'nav-poly)) + ) + (vector-! (-> a1-2 vertex 0) (-> gp-0 position) (the-as vector (-> a0-7 bounds))) + (set! (-> a1-2 vertex1 x) 163840.0) + (set! (-> a1-2 data 20) (the-as uint 2)) + (when (nav-mesh-method-45 a0-7 a1-2) + (set! (-> gp-0 nav_mesh_id) (-> s1-0 aid)) + (set! (-> gp-0 level_name) (-> s4-0 name)) + (logior! (-> gp-0 mysql-save-flag) (mysql-save-flag update)) + (format *stdcon* "~S~%" (-> gp-0 level_name)) + (return #f) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + ) + +;; definition for method 31 of type nav-graph-editor +(defmethod nav-graph-editor-method-31 ((this nav-graph-editor) (arg0 int)) + (let ((s3-0 (-> this nav-graph edge-array data arg0)) + (s4-0 (new 'stack-no-clear 'inline-array 'vector 5)) + ) + (format *stdcon* "flags ( ") + (let ((s2-0 (-> s3-0 minimap_edge_flag))) + (if (= (logand s2-0 (nav-minimap-edge-flag blocker)) (nav-minimap-edge-flag blocker)) + (format *stdcon* "blocker ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-indb-sluma)) (nav-minimap-edge-flag pass-indb-sluma)) + (format *stdcon* "pass-indb-sluma ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-port-mh)) (nav-minimap-edge-flag pass-port-mh)) + (format *stdcon* "pass-port-mh ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-inda-indb)) (nav-minimap-edge-flag pass-inda-indb)) + (format *stdcon* "pass-inda-indb ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-slumb-genb)) (nav-minimap-edge-flag pass-slumb-genb)) + (format *stdcon* "pass-slumb-genb ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag pass-port-inda)) (nav-minimap-edge-flag pass-port-inda)) + (format *stdcon* "pass-port-inda ") + ) + (if (= (logand s2-0 (nav-minimap-edge-flag one-way)) (nav-minimap-edge-flag one-way)) + (format *stdcon* "one-way ") + ) + ) + (format *stdcon* ")~%") + (vector-average! + (-> s4-0 3) + (get-node-draw-position + (new 'stack-no-clear 'vector) + (-> this nav-graph node-array data (-> s3-0 runtime-node-id-1)) + ) + (get-node-draw-position + (new 'stack-no-clear 'vector) + (-> this nav-graph node-array data (-> s3-0 runtime-node-id-2)) + ) + ) + (dotimes (s3-1 (-> this nav-graph visnode-array length)) + (let ((v1-32 (-> this nav-graph visnode-array data s3-1)) + (s2-2 (new 'stack-no-clear 'vector)) + ) + (when (and (= (-> v1-32 runtime-edge-id) arg0) (not (logtest? (-> v1-32 mysql-save-flag) (mysql-save-flag delete)))) + (get-node-draw-position s2-2 (-> this nav-graph node-array data (-> v1-32 runtime-node-id))) + (vector-! (-> s4-0 0) s2-2 (-> s4-0 3)) + (vector-normalize! (-> s4-0 0) (fmax 15360.0 (+ -15360.0 (vector-length (-> s4-0 0))))) + (vector-rotate-around-y! (-> s4-0 1) (-> s4-0 0) 24576.0) + (vector-normalize! (-> s4-0 1) 16384.0) + (vector-rotate-around-y! (-> s4-0 2) (-> s4-0 0) -24576.0) + (vector-normalize! (-> s4-0 2) 16384.0) + (vector+! (-> s4-0 0) (-> s4-0 0) (-> s4-0 3)) + (vector+! (-> s4-0 2) (-> s4-0 2) (-> s4-0 0)) + (vector+! (-> s4-0 1) (-> s4-0 1) (-> s4-0 0)) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 0) + (-> s4-0 1) + *color-light-yellow* + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 0) + (-> s4-0 2) + *color-light-yellow* + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 1) + (-> s4-0 2) + *color-light-yellow* + #f + (the-as rgba -1) + ) + (vector-lerp! (-> s4-0 0) (-> s4-0 1) (-> s4-0 2) 0.5) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 3) + (-> s4-0 0) + *color-light-yellow* + #f + (the-as rgba -1) + ) + ) + ) + ) + ) + #f + ) + +;; definition for method 34 of type nav-graph-editor +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-34 ((this nav-graph-editor) (arg0 int)) + (let* ((gp-0 (-> this nav-graph edge-array data arg0)) + (a1-6 (-> this nav-graph node-array data (-> gp-0 runtime-node-id-1))) + (s2-0 (-> this nav-graph node-array data (-> gp-0 runtime-node-id-2))) + (s3-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s5-0 a1-6) + (get-node-draw-position s4-0 s2-0) + (vector-! s3-0 s5-0 s4-0) + (set! (-> s3-0 y) 0.0) + (vector-rotate90-around-y! s3-0 s3-0) + (vector-normalize! s3-0 (-> gp-0 width)) + (add-debug-line + #t + (bucket-id debug) + (vector+! (new 'stack-no-clear 'vector) s5-0 s3-0) + (vector+! (new 'stack-no-clear 'vector) s4-0 s3-0) + *color-red* + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug) + (vector-! (new 'stack-no-clear 'vector) s5-0 s3-0) + (vector-! (new 'stack-no-clear 'vector) s4-0 s3-0) + *color-red* + #f + (the-as rgba -1) + ) + ) + 0 + (none) + ) + +;; definition for method 32 of type nav-graph-editor +(defmethod nav-graph-editor-method-32 ((this nav-graph-editor) (arg0 int)) + (let ((gp-0 (-> this nav-graph node-array data arg0)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (format *stdcon* "Radius = ~M~%" (-> gp-0 radius)) + (get-node-draw-position s5-0 gp-0) + (cond + ((= (-> this nav-graph nav_graph_id) 4) + (add-debug-sphere #t (bucket-id debug) s5-0 (-> gp-0 radius) *color-green*) + ) + (else + (new 'stack-no-clear 'vector) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (sincos! s4-1 (-> gp-0 angle)) + (set! (-> s4-1 z) (-> s4-1 y)) + (set! (-> s4-1 y) 0.0) + (set! (-> s4-1 w) 1.0) + (add-debug-sphere + #t + (bucket-id debug) + (vector+*! (new 'stack-no-clear 'vector) s5-0 s4-1 (-> gp-0 radius)) + (-> gp-0 radius) + *color-green* + ) + (add-debug-sphere + #t + (bucket-id debug) + (vector+*! (new 'stack-no-clear 'vector) s5-0 s4-1 (- (-> gp-0 radius))) + (-> gp-0 radius) + *color-green* + ) + ) + ) + ) + ) + ) + +;; definition for method 30 of type nav-graph-editor +(defmethod nav-graph-editor-method-30 ((this nav-graph-editor) (arg0 string) (arg1 string) (arg2 string)) + (format *stdcon* "~0K") + (format *stdcon* "~3L~18S~18S~18S~%~0L" "Left button" "Middle button" "Right button") + (format *stdcon* "~18S~18S~18S~%" arg0 arg1 arg2) + (format *stdcon* "~1K") + ) + +;; definition for method 29 of type nav-graph-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-29 ((this nav-graph-editor)) + (local-vars + (sv-224 int) + (sv-240 (function _varargs_ object)) + (sv-256 mysql-nav-node) + (sv-272 vector) + (sv-288 vector) + (sv-304 symbol) + (sv-320 int) + (sv-336 (function _varargs_ object)) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> this nav-graph))) + (nav-graph-editor-method-36 this) + (dotimes (s4-0 (-> s5-0 node-array length)) + (let ((s2-0 (-> s5-0 node-array data s4-0))) + (set! (-> s2-0 visible) #f) + (when (and (not (logtest? (-> s2-0 nav_node_flag) (nav-node-flag hidden))) + (not (logtest? (-> s2-0 mysql-save-flag) (mysql-save-flag delete))) + ) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (get-node-draw-position s3-0 s2-0) + (vector-copy! s1-0 s3-0) + (set! (-> s1-0 w) (-> s2-0 radius)) + ) + (set! (-> s2-0 cam-dist) (vector-vector-distance-squared s3-0 (camera-pos))) + (let ((f0-2 (-> s2-0 cam-dist)) + (f1-0 (-> this clipping-dist)) + ) + (set! (-> s2-0 visible) (< f0-2 (* f1-0 f1-0))) + ) + (if (or (and (-> this vehicle-edit-mode) (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian))) + (and (not (-> this vehicle-edit-mode)) (not (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian)))) + ) + (set! (-> s2-0 visible) #f) + ) + (when (-> s2-0 visible) + (let ((v1-22 (new 'stack-no-clear 'inline-array 'vector 2))) + (let ((a1-2 (-> v1-22 0))) + (let ((a0-13 s3-0)) + (let ((a2-1 -4096.0)) + (.mov vf6 a2-1) + ) + (.lvf vf4 (&-> a0-13 quad)) + ) + (.add.x.vf.w vf5 vf0 vf0) + (.add.x.vf.xyz vf5 vf4 vf6) + (.svf (&-> a1-2 quad) vf5) + ) + (let ((a1-3 (-> v1-22 1))) + (let ((a0-14 s3-0)) + (let ((a2-3 4096.0)) + (.mov vf6 a2-3) + ) + (.lvf vf4 (&-> a0-14 quad)) + ) + (.add.x.vf.w vf5 vf0 vf0) + (.add.x.vf.xyz vf5 vf4 vf6) + (.svf (&-> a1-3 quad) vf5) + ) + (add-debug-box + #t + (bucket-id debug) + (-> v1-22 0) + (-> v1-22 1) + (cond + ((logtest? (-> s2-0 nav_node_flag) (nav-node-flag blocker)) + *color-red* + ) + ((logtest? (-> s2-0 nav_node_flag) (nav-node-flag pov)) + *color-blue* + ) + (else + *color-yellow* + ) + ) + ) + ) + (add-debug-x #t (bucket-id debug) s3-0 *color-red*) + (let ((s1-2 add-debug-text-3d) + (s0-1 #t) + ) + (set! sv-224 583) + (set! sv-240 format) + (let ((a0-18 (clear *temp-string*)) + (a1-6 "~D") + (a2-6 (-> s2-0 nav_mesh_id)) + ) + (sv-240 a0-18 a1-6 a2-6) + ) + (let* ((a2-7 *temp-string*) + (a3-2 s3-0) + (v1-29 (-> s2-0 level_name)) + (t0-1 (cond + ((= v1-29 'ctyport) + 3 + ) + ((= v1-29 'ctyinda) + 4 + ) + ((= v1-29 'ctyindb) + 5 + ) + ((= v1-29 'ctypal) + 6 + ) + ((= v1-29 'ctysluma) + 7 + ) + ((= v1-29 'ctyslumb) + 8 + ) + ((= v1-29 'ctyslumc) + 9 + ) + (else + 1 + ) + ) + ) + (t1-0 #f) + ) + (s1-2 s0-1 (the-as bucket-id sv-224) a2-7 a3-2 (the-as font-color t0-1) (the-as vector2h t1-0)) + ) + ) + (let ((s1-3 (new 'stack-no-clear 'vector))) + (let ((s0-2 (new 'stack-no-clear 'vector))) + (sincos! s0-2 (-> s2-0 angle)) + (set! (-> s1-3 x) (-> s0-2 y)) + (set! (-> s1-3 y) 0.0) + (set! (-> s1-3 z) (- (-> s0-2 x))) + ) + (set! (-> s1-3 w) 1.0) + (add-debug-vector #t (bucket-id debug-no-zbuf1) s3-0 s1-3 (meters 2) *color-green*) + ) + ) + ) + ) + ) + ) + (dotimes (s4-1 (-> s5-0 edge-array length)) + (let ((s3-1 (-> s5-0 edge-array data s4-1))) + (when (not (logtest? (-> s3-1 mysql-save-flag) (mysql-save-flag delete))) + (let ((s1-4 (-> s5-0 node-array data (-> s3-1 runtime-node-id-1)))) + (set! sv-256 (-> s5-0 node-array data (-> s3-1 runtime-node-id-2))) + (set! sv-272 (new 'stack-no-clear 'vector)) + (set! sv-288 (new 'stack-no-clear 'vector)) + (new 'stack-no-clear 'vector) + (let ((s2-1 (new 'stack-no-clear 'vector)) + (s0-3 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s2-1 s1-4) + (get-node-draw-position s0-3 sv-256) + (cond + ((and (>= (-> s3-1 runtime-node-id-1) 0) + (>= (-> s3-1 runtime-node-id-2) 0) + (or (-> s1-4 visible) (-> sv-256 visible)) + ) + (vector-! sv-272 s0-3 s2-1) + (let* ((f0-11 (vector-length sv-272)) + (f1-5 (fmax (* 0.75 f0-11) (+ -8192.0 f0-11))) + ) + (vector-float*! sv-272 sv-272 (/ f1-5 f0-11)) + ) + (let ((v1-64 sv-288)) + (let ((a0-40 s2-1)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-40 quad)) + ) + (.lvf vf5 (&-> sv-272 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-64 quad) vf6) + ) + (let ((v1-66 (-> this nav-graph graph-type))) + (cond + ((or (= v1-66 'quote) (= v1-66 'minimap)) + (if (logtest? (-> s3-1 minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (nav-graph-editor-method-35 this s2-1 sv-288) + (add-debug-line #t (bucket-id debug-no-zbuf1) s2-1 sv-288 *color-dark-red* #f *color-white*) + ) + ) + (else + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + s2-1 + sv-288 + (if (logtest? (-> s1-4 nav_node_flag) (nav-node-flag pedestrian)) + *color-dark-red* + *color-dark-blue* + ) + #f + *color-white* + ) + (let ((s1-5 add-debug-text-3d)) + (set! sv-304 #t) + (set! sv-320 577) + (set! sv-336 format) + (let ((a0-48 (clear *temp-string*)) + (a1-18 "~d") + (a2-12 (-> s3-1 nav_territory_type)) + ) + (sv-336 a0-48 a1-18 a2-12) + ) + (let ((a2-13 *temp-string*) + (a3-7 (vector-float*! (new 'stack-no-clear 'vector) (vector+! (new 'stack-no-clear 'vector) s2-1 s0-3) 0.5)) + (t0-5 3) + (t1-4 #f) + ) + (s1-5 sv-304 (the-as bucket-id sv-320) a2-13 a3-7 (the-as font-color t0-5) (the-as vector2h t1-4)) + ) + ) + ) + ) + ) + ) + (else + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 36 of type nav-graph-editor +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-36 ((this nav-graph-editor)) + (let ((gp-0 (-> this nav-graph))) + (dotimes (s5-0 (-> gp-0 pov-conn-array-length)) + (let* ((v1-1 (-> gp-0 pov-conn-array s5-0)) + (a1-2 (-> gp-0 node-array data (-> v1-1 runtime-node-id-1))) + (s4-0 (-> gp-0 node-array data (-> v1-1 runtime-node-id-2))) + (s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s3-0 a1-2) + (get-node-draw-position s2-0 s4-0) + (add-debug-line #t (bucket-id debug) s3-0 s2-0 *color-light-blue* #f (the-as rgba -1)) + ) + ) + ) + (none) + ) + +;; definition for method 35 of type nav-graph-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-35 ((this nav-graph-editor) (arg0 vector) (arg1 vector)) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (a0-1 4) + (set! (-> v1-0 a0-1 quad) (the-as uint128 0)) + ) + (vector-copy! (-> v1-0 0) arg0) + (+! (-> v1-0 0 y) 65536.0) + (vector-copy! (-> v1-0 1) arg0) + (+! (-> v1-0 1 y) -65536.0) + (vector-copy! (-> v1-0 2) arg1) + (+! (-> v1-0 2 y) 65536.0) + (vector-copy! (-> v1-0 3) arg1) + (+! (-> v1-0 3 y) -65536.0) + (set! (-> v1-0 0 w) 1.0) + (set! (-> v1-0 1 w) 1.0) + (set! (-> v1-0 2 w) 1.0) + (set! (-> v1-0 3 w) 1.0) + (add-debug-bound + (bucket-id debug-no-zbuf1) + v1-0 + 4 + (new 'static 'rgba :r #x80 :a #x40) + (new 'static 'rgba :g #x80 :a #x40) + 0 + ) + ) + 0 + (none) + ) + +;; definition for method 37 of type nav-graph-editor +;; INFO: Used lq/sq +(defmethod nav-graph-editor-method-37 ((this nav-graph-editor)) + (with-pp + (vector-copy! (-> this mouse-pos) (camera-pos)) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (vector-copy! s4-0 *up-vector*) + (set-vector! s1-0 (-> *mouse* posx) (-> *mouse* posy) 0.0 1.0) + (cond + ((not (-> this vehicle-edit-mode)) + (vector-copy! s3-0 (-> (camera-matrix) fvec)) + (vector+*! s2-0 (-> this mouse-pos) (-> (camera-matrix) fvec) (-> this clipping-dist)) + (reverse-transform-point! s5-1 s2-0 s3-0 s1-0) + (let ((s4-3 (new 'stack 'collide-query))) + (vector-copy! (-> s4-3 start-pos) (-> this mouse-pos)) + (vector-! (-> s4-3 move-dist) s5-1 (-> this mouse-pos)) + (let ((v1-12 s4-3)) + (set! (-> v1-12 radius) 4096.0) + (set! (-> v1-12 collide-with) (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list)) + (set! (-> v1-12 ignore-process0) pp) + (set! (-> v1-12 ignore-process1) #f) + (set! (-> v1-12 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-12 action-mask) (collide-action solid)) + ) + (let ((f0-6 (fill-and-probe-using-line-sphere *collide-cache* s4-3))) + (cond + ((>= f0-6 0.0) + (vector+*! (-> this mouse-hit) (-> s4-3 start-pos) (-> s4-3 move-dist) f0-6) + (vector+! + (-> this mouse-hit-pick) + (-> this mouse-hit) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s4-3 move-dist) 4096.0) + ) + (vector-copy! (-> this mouse-normal) (-> s4-3 best-other-tri normal)) + (dotimes (s5-3 (-> *level* length)) + (let ((s4-4 (-> *level* level s5-3))) + (when (= (-> s4-4 status) 'active) + (let ((s3-3 (-> s4-4 bsp nav-meshes))) + (when (nonzero? s3-3) + (dotimes (s2-1 (-> s3-3 length)) + (let* ((s0-2 (-> s3-3 s2-1)) + (s1-1 (-> s0-2 aid)) + (v1-27 (as-type s0-2 entity-nav-mesh)) + ) + (when v1-27 + (let ((a0-23 (-> v1-27 nav-mesh)) + (a1-7 (new 'stack-no-clear 'nav-poly)) + ) + (vector-! (-> a1-7 vertex 0) (-> this mouse-hit) (the-as vector (-> a0-23 bounds))) + (set! (-> a1-7 vertex1 x) 40960.0) + (set! (-> a1-7 data 20) (the-as uint 2)) + (if (nav-mesh-method-45 a0-23 a1-7) + (format *stdcon* "Mouse : ~S ~D~%" (-> s4-4 name) s1-1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (vector+*! (-> this mouse-hit) (-> s4-3 start-pos) (-> s4-3 move-dist) 1.0) + (vector+*! (-> this mouse-hit-pick) (-> s4-3 start-pos) (-> s4-3 move-dist) 1.0) + ) + ) + ) + ) + (let ((s5-4 (new 'stack-no-clear 'vector))) + (vector-copy! s5-4 (-> this mouse-hit)) + (let ((s4-5 (quaternion-from-two-vectors! (new 'stack-no-clear 'quaternion) *up-vector* (-> this mouse-normal)))) + (add-debug-vector + #t + (bucket-id debug) + s5-4 + (vector-orient-by-quat! (new 'stack-no-clear 'vector) (new 'static 'vector :x 8192.0 :w 1.0) s4-5) + (meters 0.00024414062) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-4 + (vector-orient-by-quat! (new 'stack-no-clear 'vector) (new 'static 'vector :x -8192.0 :w 1.0) s4-5) + (meters 0.00024414062) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-4 + (vector-orient-by-quat! (new 'stack-no-clear 'vector) (new 'static 'vector :z 8192.0 :w 1.0) s4-5) + (meters 0.00024414062) + *color-green* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-4 + (vector-orient-by-quat! (new 'stack-no-clear 'vector) (new 'static 'vector :z -8192.0 :w 1.0) s4-5) + (meters 0.00024414062) + *color-green* + ) + ) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> this mouse-hit) + (-> this mouse-normal) + (meters 5) + *color-red* + ) + ) + ((and (-> this next-state) (= (-> this next-state name) 'move-plane)) + (vector-cross! s3-0 *up-vector* (-> (camera-matrix) rvec)) + (vector-normalize! s3-0 1.0) + (vector-copy! s2-0 (-> this mouse-hit)) + (reverse-transform-point! s5-1 s2-0 s3-0 s1-0) + (set! (-> this plane-height) (-> s5-1 y)) + (let ((s5-5 (new 'stack-no-clear 'vector))) + (set-vector! s5-5 (-> this mouse-hit x) (-> this plane-height) (-> this mouse-hit z) 1.0) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :x 4096.0 :w 1.0) + (meters 0.0024414062) + *color-red* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :x -4096.0 :w 1.0) + (meters 0.0024414062) + *color-red* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :z 4096.0 :w 1.0) + (meters 0.0024414062) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :z -4096.0 :w 1.0) + (meters 0.0024414062) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :y 4096.0 :w 1.0) + (meters 0.009765625) + *color-green* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-5 + (new 'static 'vector :y -4096.0 :w 1.0) + (meters 0.009765625) + *color-green* + ) + (let ((gp-2 (vector+! (new 'stack-no-clear 'vector) s5-5 (new 'static 'vector :x 12288.0 :z 12288.0 :w 1.0))) + (s4-8 (vector+! (new 'stack-no-clear 'vector) s5-5 (new 'static 'vector :x 12288.0 :z -12288.0 :w 1.0))) + (s3-9 (vector+! (new 'stack-no-clear 'vector) s5-5 (new 'static 'vector :x -12288.0 :z -12288.0 :w 1.0))) + (s2-7 (vector+! (new 'stack-no-clear 'vector) s5-5 (new 'static 'vector :x -12288.0 :z 12288.0 :w 1.0))) + ) + (add-debug-line #t (bucket-id debug) gp-2 s4-8 *color-white* #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) s4-8 s3-9 *color-white* #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) s3-9 s2-7 *color-white* #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) s2-7 gp-2 *color-white* #f (the-as rgba -1)) + ) + ) + ) + (else + (vector-copy! s3-0 *up-vector*) + (vector-copy! s2-0 (-> this mouse-pos)) + (set! (-> s2-0 y) (-> this plane-height)) + (reverse-transform-point! s5-1 s2-0 s3-0 s1-0) + (vector-copy! s4-0 s3-0) + (let ((v1-57 (new 'stack-no-clear 'inline-array 'vector 4))) + (dotimes (a0-67 4) + (set! (-> v1-57 a0-67 quad) (the-as uint128 0)) + ) + (vector+! (-> v1-57 0) s5-1 (new 'static 'vector :x 8192.0 :z 8192.0 :w 1.0)) + (vector+! (-> v1-57 1) s5-1 (new 'static 'vector :x 8192.0 :z -8192.0 :w 1.0)) + (vector+! (-> v1-57 2) s5-1 (new 'static 'vector :x -8192.0 :z -8192.0 :w 1.0)) + (vector+! (-> v1-57 3) s5-1 (new 'static 'vector :x -8192.0 :z 8192.0 :w 1.0)) + ) + (let ((f30-0 50.0)) + (if (= (-> this nav-graph nav_graph_id) 2) + (set! f30-0 4.0) + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :x 4096.0 :w 1.0) + (the-as meters f30-0) + *color-red* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :x -4096.0 :w 1.0) + (the-as meters f30-0) + *color-red* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :z 4096.0 :w 1.0) + (the-as meters f30-0) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :z -4096.0 :w 1.0) + (the-as meters f30-0) + *color-blue* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :y 4096.0 :w 1.0) + (the-as meters f30-0) + *color-green* + ) + (add-debug-vector + #t + (bucket-id debug) + s5-1 + (new 'static 'vector :y -4096.0 :w 1.0) + (the-as meters f30-0) + *color-green* + ) + ) + (vector-copy! (-> this mouse-hit) s5-1) + (vector-copy! (-> this mouse-hit-pick) s5-1) + (let ((v0-19 (the-as object (-> this mouse-normal)))) + (set! (-> (the-as vector v0-19) quad) (-> s4-0 quad)) + v0-19 + ) + ) + ) + ) + ) + ) + +;; definition for method 45 of type nav-graph-editor +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-45 ((this nav-graph-editor)) + (set! (-> this selected-index) -1) + (none) + ) + +;; definition for method 46 of type nav-graph-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-46 ((this nav-graph-editor)) + (let ((s5-0 (-> this nav-graph))) + (dotimes (s4-0 (-> s5-0 node-array length)) + (let ((s3-0 (-> s5-0 node-array data s4-0))) + (when (and (-> s3-0 visible) + (not (logtest? (-> s3-0 nav_node_flag) (nav-node-flag hidden))) + (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) + (or (and (logtest? (-> s3-0 nav_node_flag) (nav-node-flag blocker)) + (logtest? (-> this default-node nav_node_flag) (nav-node-flag blocker)) + ) + (and (not (logtest? (-> s3-0 nav_node_flag) (nav-node-flag blocker))) + (not (logtest? (-> this default-node nav_node_flag) (nav-node-flag blocker))) + ) + ) + ) + (let ((s1-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s1-0 s3-0) + (vector-copy! s2-0 s1-0) + (set! (-> s2-0 w) 11468.8) + (when (< 0.0 (ray-sphere-intersect + (-> this mouse-pos) + (vector-! (new 'stack-no-clear 'vector) (-> this mouse-hit-pick) (-> this mouse-pos)) + s2-0 + (-> s2-0 w) + ) + ) + (let ((f0-4 (+ -8192.0 (-> s3-0 cam-dist)))) + (when (or (= (-> this selected-index) -1) (< f0-4 (-> this selected-dist))) + (set! (-> this selected-index) s4-0) + (set! (-> this selected-dist) f0-4) + (set! (-> this selected-node-edge?) #t) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 48 of type nav-graph-editor +;; WARN: Return type mismatch symbol vs none. +(defmethod nav-graph-editor-method-48 ((this nav-graph-editor)) + (set! (-> this closest-node) -1) + (set! (-> this dist-closest-node) 0.0) + (let ((s5-0 (-> this nav-graph))) + (dotimes (s4-0 (-> s5-0 node-array length)) + (let ((v1-4 (-> s5-0 node-array data s4-0))) + (when (and (-> v1-4 visible) + (not (logtest? (-> v1-4 nav_node_flag) (nav-node-flag blocker hidden))) + (not (logtest? (-> v1-4 mysql-save-flag) (mysql-save-flag delete))) + ) + (let ((f0-1 (vector-vector-distance (-> v1-4 position) (-> this mouse-hit)))) + (when (or (< (-> this closest-node) 0) (< f0-1 (-> this dist-closest-node))) + (set! (-> this closest-node) s4-0) + (set! (-> this dist-closest-node) f0-1) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 49 of type nav-graph-editor +;; INFO: Used lq/sq +(defmethod nav-graph-editor-method-49 ((this nav-graph-editor)) + (local-vars (sv-80 mysql-nav-node) (sv-96 vector)) + (set! (-> this closest-edge) -1) + (set! (-> this dist-closest-edge) 0.0) + (let ((s5-0 (-> this nav-graph))) + 0.0 + (dotimes (s4-0 (-> s5-0 edge-array length)) + (let ((s3-0 (-> s5-0 edge-array data s4-0))) + (when (and (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) + (not (logtest? (-> s3-0 minimap_edge_flag) (nav-minimap-edge-flag blocker))) + ) + (let ((s2-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-1)))) + (set! sv-80 (-> s5-0 node-array data (-> s3-0 runtime-node-id-2))) + (new 'stack-no-clear 'vector) + (set! sv-96 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s0-0 s2-0) + (get-node-draw-position s1-0 sv-80) + (when (and (>= (-> s3-0 runtime-node-id-1) 0) + (>= (-> s3-0 runtime-node-id-2) 0) + (or (-> s2-0 visible) (-> sv-80 visible)) + ) + (let ((f0-2 (vector-segment-distance-point! (-> this mouse-hit) s1-0 s0-0 sv-96))) + (when (or (< (-> this closest-edge) 0) (< f0-2 (-> this dist-closest-edge))) + (set! (-> this closest-edge) s4-0) + (set! (-> this dist-closest-edge) f0-2) + ) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + +;; definition for method 47 of type nav-graph-editor +;; INFO: Used lq/sq +(defmethod nav-graph-editor-method-47 ((this nav-graph-editor)) + (local-vars + (sv-160 mysql-nav-node) + (sv-176 mysql-nav-node) + (sv-192 vector) + (sv-208 vector) + (sv-224 vector) + (sv-240 vector) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> this nav-graph))) + (dotimes (s4-0 (-> s5-0 edge-array length)) + (let ((s1-0 (-> s5-0 edge-array data s4-0))) + (when (not (logtest? (-> s1-0 mysql-save-flag) (mysql-save-flag delete))) + (set! sv-160 (-> s5-0 node-array data (-> s1-0 runtime-node-id-1))) + (set! sv-176 (-> s5-0 node-array data (-> s1-0 runtime-node-id-2))) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (set! sv-192 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector))) + (get-node-draw-position sv-192 sv-160) + (get-node-draw-position s0-0 sv-176) + (when (and (>= (-> s1-0 runtime-node-id-1) 0) + (>= (-> s1-0 runtime-node-id-2) 0) + (or (-> sv-160 visible) (-> sv-176 visible)) + ) + (vector-! s2-0 s0-0 sv-192) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (vector-copy! s1-1 sv-192) + (set! sv-208 (new 'stack-no-clear 'vector)) + (let ((v1-26 (-> s0-0 quad))) + (set! (-> sv-208 quad) v1-26) + ) + (let ((v0-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 4915.2))) + (vector+! s1-1 s1-1 v0-2) + (vector-! sv-208 sv-208 v0-2) + ) + (let ((a1-8 s2-0) + (v1-29 s1-1) + ) + (vector-! a1-8 sv-208 v1-29) + ) + (let ((f30-0 0.0) + (s0-1 ray-cylinder-intersect) + ) + (set! sv-224 (-> this mouse-pos)) + (set! sv-240 (new 'stack-no-clear 'vector)) + (let ((v1-32 (-> this mouse-hit-pick)) + (a0-17 (-> this mouse-pos)) + ) + (.lvf vf4 (&-> v1-32 quad)) + (.lvf vf5 (&-> a0-17 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-240 quad) vf6) + (let ((a3-0 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 1.0)) + (t0-0 1024.0) + (t1-0 (vector-length s2-0)) + (t2-0 s3-0) + ) + (when (< f30-0 (s0-1 sv-224 sv-240 s1-1 a3-0 t0-0 t1-0 t2-0)) + (let ((f0-1 (vector-vector-distance s3-0 (-> this mouse-pos)))) + (when (or (= (-> this selected-index) -1) (< f0-1 (-> this selected-dist))) + (set! (-> this selected-index) s4-0) + (set! (-> this selected-dist) f0-1) + (set! (-> this selected-node-edge?) #f) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) + ) + +;; definition for method 33 of type nav-graph-editor +;; INFO: Used lq/sq +(defmethod nav-graph-editor-method-33 ((this nav-graph-editor) (arg0 int) (arg1 int)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (-> this nav-graph))) + (when (>= arg1 0) + (cond + (arg0 + (let ((gp-0 (-> v1-0 node-array data arg1))) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s5-0 gp-0) + (vector-copy! s4-0 s5-0) + (set! (-> s4-0 w) 11468.8) + (let ((v1-4 (new 'stack-no-clear 'inline-array 'vector 2))) + (let ((a1-2 (-> v1-4 0))) + (let ((a0-7 s5-0)) + (let ((a2-2 -4096.0)) + (.mov vf6 a2-2) + ) + (.lvf vf4 (&-> a0-7 quad)) + ) + (.add.x.vf.w vf5 vf0 vf0) + (.add.x.vf.xyz vf5 vf4 vf6) + (.svf (&-> a1-2 quad) vf5) + ) + (let ((a0-8 (-> v1-4 1))) + (let ((a1-4 4096.0)) + (.mov vf6 a1-4) + ) + (.lvf vf4 (&-> s5-0 quad)) + (.add.x.vf.w vf5 vf0 vf0) + (.add.x.vf.xyz vf5 vf4 vf6) + (.svf (&-> a0-8 quad) vf5) + ) + (add-debug-box #t (bucket-id debug) (-> v1-4 0) (-> v1-4 1) *color-green*) + ) + ) + (format *stdcon* "selected node level : ~S~%" (-> gp-0 level_name)) + ) + ) + (else + (let* ((a0-14 (-> v1-0 edge-array data arg1)) + (a1-11 (-> v1-0 node-array data (-> a0-14 runtime-node-id-1))) + (gp-1 (-> v1-0 node-array data (-> a0-14 runtime-node-id-2))) + (s4-1 (new 'stack-no-clear 'vector)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position s4-1 a1-11) + (get-node-draw-position s5-1 gp-1) + (add-debug-line-sphere + #t + (bucket-id debug) + s4-1 + (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1) + 1024.0 + *color-green* + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for method 51 of type nav-graph-editor +(defmethod inc-cmd-id! ((this nav-graph-editor)) + (+! (-> this command-id) 1) + (-> this command-id) + ) + +;; definition for method 52 of type nav-graph-editor +(defmethod alloc-new-cmd! ((this nav-graph-editor) (arg0 int)) + (let* ((v1-1 (-> this command-array length)) + (v0-0 (-> this command-array data v1-1)) + ) + (+! (-> this command-array length) 1) + (set! (-> this max-command) v1-1) + (set! (-> v0-0 com-type) (the-as nav-com-type arg0)) + (set! (-> v0-0 id) (-> this command-id)) + v0-0 + ) + ) + +;; definition for method 53 of type nav-graph-editor +(defmethod get-last-cmd ((this nav-graph-editor)) + (-> this command-array data (+ (-> this command-array length) -1)) + ) + +;; definition for method 54 of type nav-graph-editor +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-54 ((this nav-graph-editor)) + (+! (-> this command-array length) -1) + (set! (-> this max-command) (-> this command-array length)) + (none) + ) + +;; definition for method 62 of type nav-graph-editor +;; WARN: new jak 2 until loop case, check carefully +(defmethod nav-graph-editor-method-62 ((this nav-graph-editor)) + (if (zero? (-> this command-array length)) + (return #f) + ) + (let ((s5-0 (-> this command-array data (+ (-> this command-array length) -1) id))) + (until #f + (if (zero? (-> this command-array length)) + (return #t) + ) + (let ((s4-0 (-> this command-array data (+ (-> this command-array length) -1)))) + (if (!= s5-0 (-> s4-0 id)) + (return #t) + ) + (case (-> s4-0 com-type) + (((nav-com-type undo-move-node)) + (format #t "Undo move-node ~D~%" (-> s4-0 id)) + (vector-! + (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> s4-0 index)))) + (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> s4-0 index)))) + (-> s4-0 move-vec) + ) + (nav-graph-editor-method-58 this (-> s4-0 index)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + (((nav-com-type undo-delete-edge)) + (format #t "Undo delete-edge ~D~%" (-> s4-0 id)) + (logclear! (-> this nav-graph edge-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + (((nav-com-type undo-delete-node)) + (format #t "Undo delete-node ~D~%" (-> s4-0 id)) + (logclear! (-> this nav-graph node-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + (((nav-com-type undo-delete-visnode)) + (format #t "Undo delete-visnode ~D~%" (-> s4-0 id)) + (logclear! (-> this nav-graph visnode-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + ) + (((nav-com-type undo-new-node)) + (format #t "Undo new-node ~D~%" (-> s4-0 id)) + (logior! (-> this nav-graph node-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + (((nav-com-type undo-new-visnode)) + (format #t "Undo new-visnode ~D~%" (-> s4-0 id)) + (logior! (-> this nav-graph visnode-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + ) + (((nav-com-type undo-new-edge)) + (format #t "Undo new-edge ~D~%" (-> s4-0 id)) + (logior! (-> this nav-graph edge-array data (-> s4-0 index) mysql-save-flag) (mysql-save-flag delete)) + (mysql-nav-graph-method-22 (-> this nav-graph)) + ) + ) + ) + (+! (-> this command-array length) -1) + ) + ) + #f + ) + +;; definition for method 55 of type nav-graph-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-55 ((this nav-graph-editor)) + (let ((gp-0 (alloc-new-node! (-> this nav-graph)))) + (when (!= gp-0 -1) + (let ((v1-6 (-> this nav-graph node-array data gp-0)) + (a0-4 (-> this default-node)) + ) + (vector-copy! (-> v1-6 position) (-> this mouse-hit)) + (set! (-> v1-6 angle) (-> a0-4 angle)) + (set! (-> v1-6 radius) (-> a0-4 radius)) + (set! (-> v1-6 nav_mesh_id) (-> a0-4 nav_mesh_id)) + (if (-> this hover-edit-mode) + (set! (-> v1-6 level_name) (-> a0-4 level_name)) + ) + (set! (-> v1-6 nav_node_flag) (-> a0-4 nav_node_flag)) + ) + (nav-graph-editor-method-58 this gp-0) + (set! (-> (alloc-new-cmd! this 3) index) gp-0) + ) + ) + (none) + ) + +;; definition for method 57 of type nav-graph-editor +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-57 ((this nav-graph-editor) (arg0 int) (arg1 int)) + (let ((s5-0 (indexof-visnode (-> this nav-graph) arg0 arg1))) + (if (= s5-0 -1) + (set! s5-0 (alloc-new-visnode! (-> this nav-graph) arg0 arg1)) + ) + (when (!= s5-0 -1) + (logclear! (-> this nav-graph visnode-array data s5-0 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 6) index) s5-0) + ) + ) + (none) + ) + +;; definition for method 56 of type nav-graph-editor +(defmethod nav-graph-editor-method-56 ((this nav-graph-editor)) + (let ((gp-0 (alloc-new-edge! (-> this nav-graph)))) + (when (!= gp-0 -1) + (let ((v1-6 (-> this nav-graph edge-array data gp-0)) + (a0-4 (-> this default-edge)) + ) + (set! (-> v1-6 runtime-node-id-1) (-> this edge-src)) + (set! (-> v1-6 runtime-node-id-2) (-> this edge-dst)) + (set! (-> v1-6 directionality) (nav-directionality bi_directional)) + (set! (-> v1-6 speed_limit) (-> a0-4 speed_limit)) + (set! (-> v1-6 density) (-> a0-4 density)) + (set! (-> v1-6 traffic_edge_flag) (-> a0-4 traffic_edge_flag)) + (set! (-> v1-6 nav_clock_mask) (-> a0-4 nav_clock_mask)) + (set! (-> v1-6 nav_clock_type) (-> a0-4 nav_clock_type)) + (set! (-> v1-6 width) (-> a0-4 width)) + (set! (-> v1-6 minimap_edge_flag) (-> a0-4 minimap_edge_flag)) + ) + (set! (-> (alloc-new-cmd! this 4) index) gp-0) + ) + gp-0 + ) + ) + +;; definition for method 61 of type nav-graph-editor +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 61 nav-graph-editor) has a return type of none, but the expression builder found a return statement. +(defmethod nav-graph-editor-method-61 ((this nav-graph-editor) (arg0 int) (arg1 int)) + (case (indexof-visnode (-> this nav-graph) arg0 arg1) + ((-1) + (return #f) + ) + ) + (let ((s5-1 (alloc-new-visnode! (-> this nav-graph) arg0 arg1))) + (when (!= s5-1 -1) + (inc-cmd-id! this) + (logior! (-> this nav-graph visnode-array data s5-1 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 5) index) s5-1) + ) + ) + 0 + (none) + ) + +;; definition for method 59 of type nav-graph-editor +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-59 ((this nav-graph-editor) (arg0 int)) + (inc-cmd-id! this) + (let ((s5-0 (-> this nav-graph node-array data arg0))) + (logior! (-> s5-0 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 2) index) arg0) + (dotimes (s3-0 (-> this nav-graph edge-array length)) + (let ((v1-13 (-> this nav-graph edge-array data s3-0))) + (when (and (not (logtest? (-> v1-13 mysql-save-flag) (mysql-save-flag delete))) + (or (= (-> v1-13 runtime-node-id-1) arg0) (= (-> v1-13 runtime-node-id-2) arg0)) + ) + (logior! (-> v1-13 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 1) index) s3-0) + ) + ) + ) + (dotimes (s4-1 (-> this nav-graph visnode-array length)) + (let ((v1-23 (-> this nav-graph visnode-array data s4-1))) + (when (and (not (logtest? (-> v1-23 mysql-save-flag) (mysql-save-flag delete))) + (= (-> v1-23 runtime-node-id) (-> s5-0 runtime-id)) + ) + (logior! (-> v1-23 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 5) index) s4-1) + ) + ) + ) + ) + (mysql-nav-graph-method-22 (-> this nav-graph)) + 0 + (none) + ) + +;; definition for method 60 of type nav-graph-editor +;; WARN: Return type mismatch int vs none. +(defmethod nav-graph-editor-method-60 ((this nav-graph-editor) (arg0 int)) + (inc-cmd-id! this) + (let ((s5-0 (-> this nav-graph edge-array data arg0))) + (logior! (-> s5-0 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 1) index) arg0) + (dotimes (s4-1 (-> this nav-graph visnode-array length)) + (let ((v1-11 (-> this nav-graph visnode-array data s4-1))) + (when (and (not (logtest? (-> v1-11 mysql-save-flag) (mysql-save-flag delete))) + (= (-> v1-11 runtime-edge-id) (-> s5-0 runtime-id)) + ) + (logior! (-> v1-11 mysql-save-flag) (mysql-save-flag delete)) + (set! (-> (alloc-new-cmd! this 5) index) s4-1) + ) + ) + ) + (dotimes (s4-2 2) + (let ((s3-0 (if (zero? s4-2) + (-> s5-0 runtime-node-id-1) + (-> s5-0 runtime-node-id-2) + ) + ) + (v1-19 #f) + ) + (dotimes (a0-16 (-> this nav-graph edge-array length)) + (let ((a1-7 (-> this nav-graph edge-array data a0-16))) + (if (and (not (logtest? (-> a1-7 mysql-save-flag) (mysql-save-flag delete))) + (or (= (-> a1-7 runtime-node-id-1) s3-0) (= (-> a1-7 runtime-node-id-2) s3-0)) + ) + (set! v1-19 #t) + ) + ) + ) + (when (not v1-19) + (let ((v1-24 (-> this nav-graph node-array data s3-0))) + (logior! (-> v1-24 mysql-save-flag) (mysql-save-flag delete)) + ) + (set! (-> (alloc-new-cmd! this 2) index) s3-0) + ) + ) + ) + ) + (mysql-nav-graph-method-22 (-> this nav-graph)) + 0 + (none) + ) + +;; definition for method 63 of type nav-graph-editor +;; WARN: Return type mismatch pad-buttons vs none. +(defmethod nav-graph-editor-method-63 ((this nav-graph-editor)) + (if (cpad-pressed? 0 triangle) + (nav-graph-editor-method-62 this) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (none) + ) + +;; definition for method 50 of type nav-graph-editor +;; WARN: Return type mismatch pad-buttons vs none. +(defmethod nav-graph-editor-method-50 ((this nav-graph-editor)) + (if (cpad-pressed? 0 up) + (go (method-of-object this create)) + ) + (if (cpad-pressed? 0 down) + (go (method-of-object this adjust-it)) + ) + (if (cpad-pressed? 0 left) + (go (method-of-object this adjust-minimap)) + ) + (if (cpad-pressed? 0 right) + (go (method-of-object this adjust-plane)) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons up)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons down)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons left)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left)) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons right)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right)) + (none) + ) + +;; definition for method 38 of type nav-graph-editor +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-38 ((this nav-graph-editor)) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (cond + ((not (mouse-hold? left)) + (let ((a0-4 (get-last-cmd this))) + (vector-! + (-> a0-4 move-vec) + (the-as + vector + (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> this selected-index))) + ) + (-> a0-4 move-vec) + ) + ) + (mysql-nav-graph-method-22 (-> this nav-graph)) + (go (method-of-object this create)) + ) + (else + (vector-copy! (-> this nav-graph node-array data (-> this selected-index) position) (-> this mouse-hit)) + (nav-graph-editor-method-58 this (-> this selected-index)) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate move-node (nav-graph-editor) + :virtual #t + :enter (behavior () + (inc-cmd-id! self) + (let ((v1-3 (alloc-new-cmd! self 0))) + (let ((a0-5 (-> self nav-graph node-array data (-> self selected-index)))) + (logior! (-> a0-5 mysql-save-flag) (mysql-save-flag update)) + ) + (set! (-> v1-3 index) (-> self selected-index)) + (set! (-> v1-3 move-vec quad) + (-> (the-as + (pointer uint128) + (+ (the-as uint (-> self nav-graph node-array data 0 position)) (* 80 (-> self selected-index))) + ) + ) + ) + ) + (mysql-nav-graph-method-22 (-> self nav-graph)) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Move node" "" "") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-38 self) + ) + ) + +;; failed to figure out what this is: +(defstate adjust-plane (nav-graph-editor) + :virtual #t + :trans (behavior () + (if (mouse-hold? left) + (go-virtual move-plane) + ) + (when (and (mouse-hold? middle) (>= (-> self selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons middle)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons middle)) + (set! (-> self plane-height) (-> self nav-graph node-array data (-> self selected-index) position y)) + ) + (nav-graph-editor-method-45 self) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Move plane" "Snap to node" "") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-50 self) + (nav-graph-editor-method-46 self) + (nav-graph-editor-method-33 self (the-as int (-> self selected-node-edge?)) (-> self selected-index)) + ) + ) + +;; failed to figure out what this is: +(defstate move-plane (nav-graph-editor) + :virtual #t + :enter (behavior () + (set-vector! (-> self mouse-spos-hold) (-> *mouse* posx) (-> *mouse* posy) 0.0 1.0) + (set! (-> self plane-height-hold) (-> self plane-height)) + ) + :trans (behavior () + (if (not (mouse-hold? left)) + (go-virtual adjust-plane) + ) + ) + :code sleep-code + :post (behavior () + (format *stdcon* "~0K") + (let ((t9-1 format) + (a0-1 *stdcon*) + (a1-1 "~3L~%~0L") + ) + "Moving plane" + (t9-1 a0-1 a1-1) + ) + (format *stdcon* "~1K") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-50 self) + ) + ) + +;; definition for method 41 of type nav-graph-editor +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-41 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-46 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (add-debug-line-sphere + #t + (bucket-id debug) + (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> this edge-src)))) + (vector-! + (new 'stack-no-clear 'vector) + (-> this mouse-hit) + (the-as vector (+ (the-as uint (-> this nav-graph node-array data 0 position)) (* 80 (-> this edge-src)))) + ) + 1024.0 + (if (>= (-> this selected-index) 0) + *color-green* + *color-red* + ) + ) + (cond + ((and (mouse-pressed? left) (begin + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (let ((v1-20 (logclear (-> *mouse* button0-rel 0) (mouse-buttons left)))) + (set! (-> *mouse* button0-rel 0) v1-20) + (and v1-20 (!= (-> this selected-index) (-> this edge-src))) + ) + ) + ) + (cond + ((>= (-> this selected-index) 0) + (set! (-> this edge-dst) (-> this selected-index)) + ) + (else + (set! (-> this edge-dst) (the-as int (nav-graph-editor-method-55 this))) + (mysql-nav-graph-method-22 (-> this nav-graph)) + (if (= (-> this edge-dst) -1) + (go (method-of-object this create)) + ) + ) + ) + (when (= (nav-graph-editor-method-56 this) -1) + (mysql-nav-graph-method-22 (-> this nav-graph)) + (go (method-of-object this create)) + ) + (inc-cmd-id! this) + (set! (-> this edge-src) (-> this edge-dst)) + ) + ((mouse-pressed? right) + (if (= (-> this edge-dst) -2) + (nav-graph-editor-method-62 this) + ) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (go (method-of-object this create)) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate create-edge (nav-graph-editor) + :virtual #t + :enter (behavior () + (cond + ((and (>= (-> self selected-index) 0) (-> self selected-node-edge?)) + (set! (-> self edge-src) (-> self selected-index)) + (set! (-> self edge-dst) -1) + ) + (else + (inc-cmd-id! self) + (set! (-> self edge-src) (the-as int (nav-graph-editor-method-55 self))) + (mysql-nav-graph-method-22 (-> self nav-graph)) + (set! (-> self edge-dst) -2) + (if (= (-> self edge-src) -1) + (go-virtual create) + ) + ) + ) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Dest node/pos" "" "Cancel") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-41 self) + ) + ) + +;; definition for method 40 of type nav-graph-editor +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-40 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-46 this) + (nav-graph-editor-method-47 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (cond + ((mouse-pressed? left) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons left)) + (go (method-of-object this create-edge)) + ) + ((and (mouse-pressed? right) (>= (-> this selected-index) 0) (not (-> this selected-node-edge?))) + ) + (else + (nav-graph-editor-method-63 this) + (nav-graph-editor-method-50 this) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate edit-edge (nav-graph-editor) + :virtual #t + :enter (behavior () + (set! (-> self edge-src) -1) + (set! (-> self edge-dst) -1) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Create edge" "" "Delete edge") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-40 self) + ) + ) + +;; failed to figure out what this is: +(defstate adjust-edge-visibility (nav-graph-editor) + :virtual #t + :enter (behavior () + (set! (-> self edge-visibility) (-> self selected-index)) + ) + :exit (behavior () + (set! (-> self edge-visibility) -1) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "Add node" "Remove Node" "Exit") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-31 self (-> self edge-visibility)) + (nav-graph-editor-method-45 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-46 self) + (nav-graph-editor-method-33 self (the-as int (-> self selected-node-edge?)) (-> self selected-index)) + (cond + ((and (mouse-hold? left) (>= (-> self selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons left)) + (nav-graph-editor-method-57 self (-> self edge-visibility) (-> self selected-index)) + ) + ((and (mouse-hold? middle) (>= (-> self selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons middle)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons middle)) + (nav-graph-editor-method-61 self (-> self edge-visibility) (-> self selected-index)) + ) + ((mouse-hold? right) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (go-virtual adjust-minimap) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate adjust-node-angle (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (cond + ((not (mouse-hold? left)) + (go-virtual adjust-it) + ) + (else + (let ((v1-12 (-> self nav-graph node-array data (-> self selected-index)))) + (logior! (-> v1-12 mysql-save-flag) (mysql-save-flag update)) + (+! (-> v1-12 angle) (* 182.04445 (-> *mouse* speedx))) + (format *stdcon* "Angle = ~R~%" (-> v1-12 angle)) + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate adjust-node-radius (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (cond + ((not (mouse-hold? right)) + (go-virtual adjust-it) + ) + (else + (let ((v1-12 (-> self nav-graph node-array data (-> self selected-index)))) + (logior! (-> v1-12 mysql-save-flag) (mysql-save-flag update)) + (+! (-> v1-12 radius) (* 409.6 (-> *mouse* speedx))) + (if (< (-> v1-12 radius) 0.0) + (set! (-> v1-12 radius) 0.0) + ) + ) + (nav-graph-editor-method-32 self (-> self selected-index)) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate adjust-edge-width (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (cond + ((not (mouse-hold? right)) + (go-virtual adjust-it) + ) + (else + (let ((v1-12 (-> self nav-graph edge-array data (-> self selected-index)))) + (logior! (-> v1-12 mysql-save-flag) (mysql-save-flag update)) + (+! (-> v1-12 width) (* 409.6 (-> *mouse* speedx))) + (if (< (-> v1-12 width) 0.0) + (set! (-> v1-12 width) 0.0) + ) + ) + (nav-graph-editor-method-34 self (-> self selected-index)) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate adjust-edge-density (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-33 self (the-as int (-> self selected-node-edge?)) (-> self selected-index)) + (cond + ((not (mouse-hold? middle)) + (go-virtual adjust-it) + ) + (else + (let ((gp-0 (-> self nav-graph edge-array data (-> self selected-index)))) + (format *stdcon* "Density = ~F~%" (-> gp-0 density)) + (logior! (-> gp-0 mysql-save-flag) (mysql-save-flag update)) + (+! (-> gp-0 density) (/ (-> *mouse* speedx) 100)) + (if (< (-> gp-0 density) 0.0) + (set! (-> gp-0 density) 0.0) + ) + (if (< 1.0 (-> gp-0 density)) + (set! (-> gp-0 density) 1.0) + ) + ) + ) + ) + ) + ) + +;; definition for method 42 of type nav-graph-editor +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-42 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-46 this) + (nav-graph-editor-method-47 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (when (>= (-> this selected-index) 0) + (if (-> this selected-node-edge?) + (nav-graph-editor-method-32 this (-> this selected-index)) + (nav-graph-editor-method-31 this (-> this selected-index)) + ) + ) + (cond + ((and (mouse-hold? left) (>= (-> this selected-index) 0)) + (if (-> this selected-node-edge?) + (go (method-of-object this adjust-node-angle)) + ) + ) + ((and (mouse-hold? right) (>= (-> this selected-index) 0)) + (if (-> this selected-node-edge?) + (go (method-of-object this adjust-node-radius)) + (go (method-of-object this adjust-edge-width)) + ) + ) + ((and (mouse-hold? middle) (>= (-> this selected-index) 0) (not (-> this selected-node-edge?))) + (go (method-of-object this adjust-edge-density)) + ) + (else + (nav-graph-editor-method-63 this) + (nav-graph-editor-method-50 this) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate adjust-it (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (cond + ((>= (-> self selected-index) 0) + (if (-> self selected-node-edge?) + (nav-graph-editor-method-30 self "Node angle" "" "Node radius") + (nav-graph-editor-method-30 self "Edge speed limit" "Edge Density" "Edge Width") + ) + ) + (else + (nav-graph-editor-method-30 self "" "" "") + ) + ) + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-42 self) + ) + ) + +;; definition for method 43 of type nav-graph-editor +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-43 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-47 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (if (and (>= (-> this selected-index) 0) (not (-> this selected-node-edge?))) + (nav-graph-editor-method-31 this (-> this selected-index)) + ) + (cond + ((and (mouse-hold? left) (>= (-> this selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons left)) + (go (method-of-object this adjust-edge-visibility)) + ) + ((mouse-hold? right) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (go (method-of-object this draw-closest-minimap)) + ) + ((mouse-hold? middle) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons middle)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons middle)) + (let ((v1-41 (-> this minimap-make-mode))) + (set! (-> this minimap-make-mode) (the-as uint (cond + ((zero? v1-41) + 1 + ) + ((= v1-41 1) + 2 + ) + (else + 0 + ) + ) + ) + ) + ) + (case (-> this minimap-make-mode) + ((1) + (logior! (-> this default-edge minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (logior! (-> this default-node nav_node_flag) (nav-node-flag blocker)) + (logclear! (-> this default-node nav_node_flag) (nav-node-flag pov)) + ) + ((2) + (logclear! (-> this default-edge minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (logclear! (-> this default-node nav_node_flag) (nav-node-flag blocker)) + (logior! (-> this default-node nav_node_flag) (nav-node-flag pov)) + ) + (else + (logclear! (-> this default-edge minimap_edge_flag) (nav-minimap-edge-flag blocker)) + (logclear! (-> this default-node nav_node_flag) (nav-node-flag blocker)) + (logclear! (-> this default-node nav_node_flag) (nav-node-flag pov)) + ) + ) + ) + (else + (nav-graph-editor-method-63 this) + (nav-graph-editor-method-50 this) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate adjust-minimap (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (let* ((a0-0 self) + (t9-0 (method-of-object a0-0 nav-graph-editor-method-30)) + (a1-0 "Edge Visibility") + (v1-1 (-> self minimap-make-mode)) + ) + (t9-0 + a0-0 + a1-0 + (cond + ((zero? v1-1) + "Making Edges" + ) + ((= v1-1 2) + "Making POV" + ) + (else + "Making Blockers" + ) + ) + "Show Closest" + ) + ) + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-43 self) + ) + ) + +;; failed to figure out what this is: +(defstate draw-closest-minimap (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-45 self) + (nav-graph-editor-method-37 self) + (nav-graph-editor-method-48 self) + (nav-graph-editor-method-49 self) + (when (>= (-> self closest-node) 0) + (let ((a1-0 (-> self nav-graph node-array data (-> self closest-node))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (when (not (logtest? (-> a1-0 mysql-save-flag) (mysql-save-flag delete))) + (get-node-draw-position gp-0 a1-0) + (add-debug-sphere #t (bucket-id debug) gp-0 (meters 4.5) (new 'static 'rgba :r #xff :a #x40)) + ) + ) + ) + (when (>= (-> self closest-edge) 0) + (let* ((s4-0 (-> self nav-graph edge-array data (-> self closest-edge))) + (a1-2 (-> self nav-graph node-array data (-> s4-0 runtime-node-id-1))) + (s3-0 (-> self nav-graph node-array data (-> s4-0 runtime-node-id-2))) + (gp-1 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (get-node-draw-position gp-1 a1-2) + (get-node-draw-position s5-0 s3-0) + (when (not (logtest? (-> s4-0 mysql-save-flag) (mysql-save-flag delete))) + (let ((s4-1 (new 'stack-no-clear 'inline-array 'vector 5))) + (vector-! (-> s4-1 4) s5-0 gp-1) + (vector-rotate90-around-y! (-> s4-1 4) (-> s4-1 4)) + (vector-normalize! (-> s4-1 4) (-> self dist-closest-edge)) + (vector+! (-> s4-1 0) gp-1 (-> s4-1 4)) + (vector+! (-> s4-1 1) s5-0 (-> s4-1 4)) + (vector-! (-> s4-1 2) s5-0 (-> s4-1 4)) + (vector-! (-> s4-1 3) gp-1 (-> s4-1 4)) + (let ((gp-2 *color-dark-green*)) + (add-debug-line #t (bucket-id debug) (-> s4-1 0) (-> s4-1 1) gp-2 #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) (-> s4-1 1) (-> s4-1 2) gp-2 #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) (-> s4-1 2) (-> s4-1 3) gp-2 #f (the-as rgba -1)) + (add-debug-line #t (bucket-id debug) (-> s4-1 3) (-> s4-1 0) gp-2 #f (the-as rgba -1)) + ) + ) + ) + ) + ) + (cond + ((mouse-hold? right) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (go-virtual adjust-minimap) + ) + (else + (nav-graph-editor-method-63 self) + (nav-graph-editor-method-50 self) + ) + ) + ) + ) + +;; definition for method 39 of type nav-graph-editor +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-39 ((this nav-graph-editor)) + (nav-graph-editor-method-45 this) + (nav-graph-editor-method-37 this) + (nav-graph-editor-method-46 this) + (nav-graph-editor-method-47 this) + (nav-graph-editor-method-33 this (the-as int (-> this selected-node-edge?)) (-> this selected-index)) + (cond + ((and (mouse-hold? left) (>= (-> this selected-index) 0) (-> this selected-node-edge?)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons left)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons left)) + (go (method-of-object this move-node)) + ) + ((mouse-hold? right) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons right)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons right)) + (case (-> this minimap-make-mode) + ((2) + (go (method-of-object this create-pov)) + ) + (else + (go (method-of-object this create-edge)) + ) + ) + ) + ((and (mouse-hold? middle) (>= (-> this selected-index) 0)) + (logclear! (-> *mouse* button0-abs 0) (mouse-buttons middle)) + (logclear! (-> *mouse* button0-rel 0) (mouse-buttons middle)) + (if (-> this selected-node-edge?) + (nav-graph-editor-method-59 this (-> this selected-index)) + (nav-graph-editor-method-60 this (-> this selected-index)) + ) + ) + (else + (nav-graph-editor-method-63 this) + (nav-graph-editor-method-50 this) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate create (nav-graph-editor) + :virtual #t + :enter (behavior () + '() + ) + :code sleep-code + :post (behavior () + (let* ((a0-0 self) + (t9-0 (method-of-object a0-0 nav-graph-editor-method-30)) + (a1-0 "Move node") + (a2-0 "Delete node/edge") + (v1-1 (-> self minimap-make-mode)) + ) + (t9-0 a0-0 a1-0 a2-0 (if (= v1-1 2) + "Create POV" + "Create edge(s)" + ) + ) + ) + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-39 self) + ) + ) + +;; definition for method 44 of type nav-graph-editor +;; WARN: Return type mismatch object vs none. +(defmethod nav-graph-editor-method-44 ((this nav-graph-editor)) + (if (not (mouse-hold? right)) + (go (method-of-object this create)) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate create-pov (nav-graph-editor) + :virtual #t + :enter (behavior () + (cond + ((and (>= (-> self selected-index) 0) (-> self selected-node-edge?)) + ) + (else + (inc-cmd-id! self) + (nav-graph-editor-method-55 self) + (mysql-nav-graph-method-22 (-> self nav-graph)) + ) + ) + ) + :code sleep-code + :post (behavior () + (nav-graph-editor-method-30 self "" "" "") + (nav-graph-editor-method-29 self) + (nav-graph-editor-method-44 self) + ) + ) + +;; definition for function nav-graph-editor-init-by-other +(defbehavior nav-graph-editor-init-by-other nav-graph-editor ((arg0 string) (arg1 symbol)) + (add-setting! 'mouse #t 0.0 0) + (add-setting! 'cursor #t 0.0 0) + (set! (-> self minimap-make-mode) (the-as uint 0)) + (set! (-> self nav-graph) (new 'debug 'mysql-nav-graph arg0)) + (set! (-> self command-array) (new 'debug 'nav-graph-command-array 256)) + (set! (-> self command-array length) 0) + (set! *nav-graph-editor* (the-as (pointer nav-graph-editor) (process->ppointer self))) + (let ((v1-8 (-> self default-node))) + (set! (-> v1-8 angle) 0.0) + (set! (-> v1-8 radius) 16384.0) + (set! (-> v1-8 nav_mesh_id) (the-as uint 0)) + (set! (-> v1-8 level_name) arg1) + (set! (-> v1-8 nav_node_flag) (nav-node-flag pedestrian)) + ) + (let ((v1-9 (-> self default-edge))) + (set! (-> v1-9 directionality) (nav-directionality default)) + (set! (-> v1-9 speed_limit) 40960.0) + (set! (-> v1-9 density) 0.25) + (set! (-> v1-9 traffic_edge_flag) 0) + (set! (-> v1-9 nav_clock_mask) (nav-clock-mask phase-1)) + (set! (-> v1-9 nav_clock_type) (nav-clock-type no-clock)) + (set! (-> v1-9 width) 16384.0) + (set! (-> v1-9 minimap_edge_flag) (nav-minimap-edge-flag)) + ) + 0 + (set! (-> self command-id) 0) + (set! (-> self edge-visibility) -1) + (cond + ((= arg0 'hover) + (set! (-> self vehicle-edit-mode) #t) + (set! (-> self hover-edit-mode) #t) + (set! (-> self default-node nav_node_flag) (nav-node-flag)) + 0 + ) + (else + (set! (-> self vehicle-edit-mode) #f) + (set! (-> self hover-edit-mode) #f) + ) + ) + (set! (-> self plane-height) (-> (target-pos 0) y)) + (set! (-> self clipping-dist) 2048000.0) + (go-virtual create) + ) + +;; definition for function run-nav-graph-editor +;; WARN: Return type mismatch (pointer process) vs (pointer nav-graph-editor). +(defun run-nav-graph-editor ((arg0 symbol) (arg1 symbol)) + (the-as + (pointer nav-graph-editor) + (when (not *nav-graph-editor*) + (let ((s4-0 (process-spawn + nav-graph-editor + arg0 + (if arg1 + arg1 + 'unknown + ) + :name "nav-graph-editor" + ) + ) + ) + (when arg1 + (let ((v1-4 *nav-graph-editor*)) + (if v1-4 + (nav-graph-editor-method-66 (-> v1-4 0) arg0 (the-as string arg1)) + ) + ) + ) + s4-0 + ) + ) + ) + ) + +;; definition for function get-nav-graph-editor +;; WARN: Return type mismatch process vs nav-graph-editor. +(defun get-nav-graph-editor () + (the-as nav-graph-editor (ppointer->process *nav-graph-editor*)) + ) + +;; definition for function exit-nav-graph-editor +(defun exit-nav-graph-editor () + (if *nav-graph-editor* + (deactivate (ppointer->process *nav-graph-editor*)) + ) + (none) + ) + +;; definition for function nav-graph-set-level +;; WARN: Return type mismatch symbol vs object. +(defun nav-graph-set-level ((arg0 symbol)) + (let ((v1-0 (ppointer->process *nav-graph-editor*))) + (when v1-0 + (let ((v1-2 (-> (the-as nav-graph-editor v1-0) nav-graph))) + (dotimes (a1-1 (-> v1-2 node-array length)) + (set! (-> v1-2 node-array data a1-1 level_name) arg0) + (logior! (-> v1-2 node-array data a1-1 mysql-save-flag) (mysql-save-flag update)) + ) + ) + #f + ) + ) + ) + +;; definition for function set-minimap-edge-flag +;; WARN: Return type mismatch mysql-save-flag vs none. +(defun set-minimap-edge-flag ((arg0 nav-minimap-edge-flag)) + (let ((v1-0 (ppointer->process *nav-graph-editor*))) + (when v1-0 + (when (>= (-> (the-as nav-graph-editor v1-0) edge-visibility) 0) + (let ((v1-4 (-> (the-as nav-graph-editor v1-0) + nav-graph + edge-array + data + (-> (the-as nav-graph-editor v1-0) edge-visibility) + ) + ) + ) + (when (not (logtest? (-> v1-4 minimap_edge_flag) (nav-minimap-edge-flag blocker))) + (set! (-> v1-4 minimap_edge_flag) arg0) + (logior! (-> v1-4 mysql-save-flag) (mysql-save-flag update)) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function set-vehicle-edit-mode +;; WARN: Return type mismatch int vs none. +(defun set-vehicle-edit-mode ((arg0 symbol)) + (let ((v1-0 (ppointer->process *nav-graph-editor*))) + (when v1-0 + (set! (-> (the-as nav-graph-editor v1-0) vehicle-edit-mode) arg0) + (set! (-> (the-as nav-graph-editor v1-0) default-node nav_node_flag) (if arg0 + (nav-node-flag) + (nav-node-flag pedestrian) + ) + ) + ) + ) + (none) + ) + +;; definition for function translate-nav-graph +(defun translate-nav-graph ((arg0 float) (arg1 float) (arg2 float)) + (when (ppointer->process *nav-graph-editor*) + (let ((v1-2 (ppointer->process *nav-graph-editor*))) + (dotimes (a3-2 (-> (the-as nav-graph-editor v1-2) nav-graph node-array length)) + (let ((t0-3 (-> (the-as nav-graph-editor v1-2) nav-graph node-array data a3-2))) + (+! (-> t0-3 position x) arg0) + (+! (-> t0-3 position y) arg1) + (+! (-> t0-3 position z) arg2) + (logior! (-> t0-3 mysql-save-flag) (mysql-save-flag update)) + ) + ) + ) + #f + ) + ) + +;; definition for function update-nav-meshes +(defun update-nav-meshes () + (when (ppointer->process *nav-graph-editor*) + (let ((gp-0 (ppointer->process *nav-graph-editor*))) + (dotimes (s5-0 (-> (the-as nav-graph-editor gp-0) nav-graph node-array length)) + (if (not (logtest? (-> (the-as nav-graph-editor gp-0) nav-graph node-array data s5-0 mysql-save-flag) + (mysql-save-flag delete) + ) + ) + (nav-graph-editor-method-58 (the-as nav-graph-editor gp-0) s5-0) + ) + ) + ) + #f + ) + ) + +;; definition for function delete-node-nav-mesh +;; WARN: Return type mismatch symbol vs none. +(defun delete-node-nav-mesh ((arg0 int)) + (when (ppointer->process *nav-graph-editor*) + (let ((s5-0 (ppointer->process *nav-graph-editor*)) + (a1-0 0) + ) + (while (< a1-0 (-> (the-as nav-graph-editor s5-0) nav-graph node-array length)) + (let ((v1-7 (-> (the-as nav-graph-editor s5-0) nav-graph node-array data a1-0))) + (when (and (not (logtest? (-> v1-7 mysql-save-flag) (mysql-save-flag delete))) (= arg0 (-> v1-7 nav_mesh_id))) + (nav-graph-editor-method-59 (-> *nav-graph-editor* 0) a1-0) + (set! a1-0 0) + ) + ) + (set! a1-0 (+ a1-0 1)) + ) + ) + ) + (none) + ) + +;; definition for function smooth-nav-graph +;; INFO: Used lq/sq +(defun smooth-nav-graph ((arg0 string)) + (local-vars + (sv-96 int) + (sv-112 int) + (sv-128 int) + (sv-144 mysql-nav-edge) + (sv-160 vector) + (sv-176 vector) + (sv-192 vector) + (sv-208 vector) + ) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let* ((v1-0 *nav-graph-editor*) + (s5-0 (-> (the-as nav-graph-editor (if v1-0 + (the-as nav-graph-editor (-> v1-0 0 self)) + ) + ) + nav-graph + ) + ) + ) + (dotimes (s4-0 (-> s5-0 node-array length)) + (let ((s3-0 (-> s5-0 node-array data s4-0)) + (s2-0 (new-stack-vector0)) + (s0-0 (new-stack-vector0)) + (s1-0 (new-stack-vector0)) + ) + (set! sv-96 0) + (set! sv-112 0) + (when (and (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) (= (-> s3-0 level_name) arg0)) + (set! sv-128 0) + (while (< sv-128 (-> s5-0 edge-array length)) + (set! sv-144 (-> s5-0 edge-array data sv-128)) + (when (not (logtest? (-> sv-144 mysql-save-flag) (mysql-save-flag delete))) + (when (= (-> sv-144 runtime-node-id-1) s4-0) + (let ((v1-27 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) + (a1-3 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) + ) + (set! sv-176 s1-0) + (set! sv-160 s1-0) + (let ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-3 position) (-> v1-27 position)) 1.0)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-160 quad)) + (.lvf vf5 (&-> v0-0 quad)) + ) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + (set! sv-112 (+ sv-112 1)) + sv-112 + ) + (when (= (-> sv-144 runtime-node-id-2) s4-0) + (let ((v1-40 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) + (a1-9 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) + ) + (set! sv-208 s0-0) + (set! sv-192 s0-0) + (let ((v0-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-9 position) (-> v1-40 position)) 1.0)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-192 quad)) + (.lvf vf5 (&-> v0-1 quad)) + ) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-208 quad) vf6) + (set! sv-96 (+ sv-96 1)) + sv-96 + ) + ) + (set! sv-128 (+ sv-128 1)) + ) + (cond + ((and (>= sv-112 2) (= sv-96 1)) + (vector-copy! s2-0 s0-0) + ) + ((and (>= sv-96 2) (= sv-112 1)) + (vector-copy! s2-0 s1-0) + ) + (else + (vector-normalize! s0-0 0.5) + (vector-normalize! s1-0 1.0) + (vector+! s2-0 s0-0 s1-0) + ) + ) + (vector-normalize! s2-0 1.0) + (logior! (-> s3-0 mysql-save-flag) (mysql-save-flag update)) + (set! (-> s3-0 angle) (+ -16384.0 (vector-y-angle s2-0))) + ) + ) + ) + ) + #f + ) + ) + +;; definition for function update-height +;; INFO: Used lq/sq +(defun update-height ((arg0 string)) + (let* ((v1-0 *nav-graph-editor*) + (v1-2 (-> (the-as nav-graph-editor (if v1-0 + (the-as nav-graph-editor (-> v1-0 0 self)) + ) + ) + nav-graph + ) + ) + ) + (dotimes (a1-1 (-> v1-2 node-array length)) + (let ((a2-3 (-> v1-2 node-array data a1-1))) + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (if (and (not (logtest? (-> a2-3 nav_node_flag) (nav-node-flag pedestrian))) + (not (logtest? (-> a2-3 mysql-save-flag) (mysql-save-flag delete))) + (= (-> a2-3 level_name) arg0) + ) + (logior! (-> a2-3 mysql-save-flag) (mysql-save-flag update)) + ) + ) + ) + ) + #f + ) + +;; definition for function update-width +;; INFO: Used lq/sq +(defun update-width ((arg0 string)) + (local-vars (sv-16 (array entity-nav-mesh)) (sv-32 int) (sv-48 uint) (sv-64 entity-nav-mesh)) + (let* ((v1-0 *nav-graph-editor*) + (s5-0 (-> (the-as nav-graph-editor (if v1-0 + (the-as nav-graph-editor (-> v1-0 0 self)) + ) + ) + nav-graph + ) + ) + ) + (dotimes (s4-0 (-> s5-0 edge-array length)) + (let ((s3-0 (-> s5-0 edge-array data s4-0))) + (when (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) + (let ((s2-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-1))) + (s1-0 (-> s5-0 node-array data (-> s3-0 runtime-node-id-2))) + ) + (when (and (= (-> s2-0 level_name) arg0) + (= (-> s1-0 level_name) arg0) + (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian)) + (logtest? (-> s1-0 nav_node_flag) (nav-node-flag pedestrian)) + ) + (cond + ((= (-> s2-0 nav_mesh_id) (-> s1-0 nav_mesh_id)) + (dotimes (s0-0 (-> *level* length)) + (let ((v1-25 (-> *level* level s0-0))) + (when (= (-> v1-25 status) 'active) + (set! sv-16 (-> v1-25 bsp nav-meshes)) + (when (nonzero? sv-16) + (set! sv-32 0) + (while (< sv-32 (-> sv-16 length)) + (set! sv-64 (-> sv-16 sv-32)) + (set! sv-48 (-> sv-64 aid)) + (let ((v1-36 (if (type? sv-64 entity-nav-mesh) + sv-64 + ) + ) + ) + (when (and v1-36 (= sv-48 (-> s2-0 nav_mesh_id))) + (let* ((f0-0 (nav-mesh-method-37 (-> v1-36 nav-mesh) (-> s2-0 position) (-> s1-0 position) 16384.0)) + (f0-1 (+ -409.6 f0-0)) + ) + (when (and (< 0.0 f0-1) (!= f0-1 (-> s3-0 width))) + (set! (-> s3-0 width) f0-1) + (logior! (-> s3-0 mysql-save-flag) (mysql-save-flag update)) + ) + (if (>= 0.0 f0-1) + (format #t "!!!! edge ~D ~D outside nav-mesh~%" (-> s2-0 nav_node_id) (-> s1-0 nav_node_id)) + ) + ) + ) + ) + (set! sv-32 (+ sv-32 1)) + ) + ) + ) + ) + ) + #f + ) + (else + (format #t "***** edge ~D ~D overlaps 2 nav-meshes~%" (-> s2-0 nav_node_id) (-> s1-0 nav_node_id)) + ) + ) + ) + ) + ) + ) + ) + ) + #f + ) diff --git a/test/decompiler/reference/jak3/engine/debug/visvol-edit_REF.gc b/test/decompiler/reference/jak3/engine/debug/visvol-edit_REF.gc new file mode 100644 index 0000000000..82efb29b03 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/visvol-edit_REF.gc @@ -0,0 +1,508 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; definition of type visvol-edit-info +(deftype visvol-edit-info (structure) + ((editing symbol) + (current-func visvol-edit-func) + (analog-func visvol-edit-func) + ) + (:methods + (handle-pad-input (_type_) object) + (draw-menu (_type_ process-drawable) object) + (set-origin-joint-idx! (_type_ process-drawable) none) + ) + ) + +;; definition for method 3 of type visvol-edit-info +(defmethod inspect ((this visvol-edit-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'visvol-edit-info) + (format #t "~1Tediting: ~A~%" (-> this editing)) + (format #t "~1Tcurrent-func: ~D~%" (-> this current-func)) + (format #t "~1Tanalog-func: ~D~%" (-> this analog-func)) + (label cfg-4) + this + ) + +;; definition of type visvol-editor +(deftype visvol-editor (process) + ((proc handle) + ) + (:state-methods + idle + ) + ) + +;; definition for method 3 of type visvol-editor +(defmethod inspect ((this visvol-editor)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 this) + ) + (format #t "~2Tproc: ~D~%" (-> this proc)) + (label cfg-4) + this + ) + +;; definition for method 9 of type visvol-edit-info +;; WARN: Return type mismatch int vs object. +(defmethod handle-pad-input ((this visvol-edit-info)) + (if (cpad-pressed? 0 up) + (+! (-> this current-func) -1) + ) + (if (cpad-pressed? 0 left) + (+! (-> this current-func) -4) + ) + (if (cpad-pressed? 0 down) + (+! (-> this current-func) 1) + ) + (if (cpad-pressed? 0 right) + (+! (-> this current-func) 4) + ) + (cond + ((< (the-as int (-> this current-func)) 0) + (let ((v0-0 2)) + (set! (-> this current-func) (the-as visvol-edit-func v0-0)) + v0-0 + ) + ) + ((>= (the-as int (-> this current-func)) 3) + (set! (-> this current-func) (visvol-edit-func visvol-positive)) + 0 + ) + ) + ) + +;; definition for method 11 of type visvol-edit-info +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 11 visvol-edit-info) has a return type of none, but the expression builder found a return statement. +(defmethod set-origin-joint-idx! ((this visvol-edit-info) (arg0 process-drawable)) + (if (or (not arg0) (!= (-> this analog-func) 2)) + (return #f) + ) + (let ((v0-1 (the-as int (-> arg0 draw origin-joint-index)))) + (let ((v1-7 (+ (-> arg0 node-list length) -1))) + (when (cpad-pressed? 0 r1) + (set! v0-1 (the-as int (+ (the-as uint v0-1) 1))) + (if (cpad-hold? 0 l1) + (set! v0-1 (the-as int (+ (the-as uint v0-1) 4))) + ) + (case v0-1 + ((1 2) + (set! v0-1 3) + ) + ) + ) + (when (cpad-pressed? 0 l1) + (+! v0-1 -1) + (if (cpad-hold? 0 r1) + (+! v0-1 -4) + ) + (case v0-1 + ((1 2) + (set! v0-1 0) + ) + ) + ) + (if (< v0-1 0) + (set! v0-1 v1-7) + ) + (if (< v1-7 v0-1) + (set! v0-1 0) + ) + ) + (set! (-> arg0 draw origin-joint-index) (the-as uint v0-1)) + ) + (none) + ) + +;; definition for method 10 of type visvol-edit-info +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs object. +(defmethod draw-menu ((this visvol-edit-info) (arg0 process-drawable)) + (when (cpad-pressed? 0 l2) + (set! (-> this editing) (not (-> this editing))) + (cond + ((-> this editing) + (set! *external-cam-mode* 'locked) + ) + (*target* + (set! *external-cam-mode* #f) + ) + (else + (set! *external-cam-mode* 'pad-0) + ) + ) + ) + (cond + ((or (not (-> this editing)) (cpad-hold? 0 r2)) + (if (not (-> this editing)) + (format *stdcon* "press l2 to edit visvol~%") + (format *stdcon* "release r2 to continue editing visvol~%") + ) + (if (or (cpad-hold? 0 r2) (not *target*)) + (set! *external-cam-mode* 'pad-0) + ) + ) + (else + (set! *external-cam-mode* 'locked) + (handle-pad-input this) + (set-origin-joint-idx! this arg0) + (let ((s3-0 ">") + (s4-0 " ") + ) + (if (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) + (set! s3-0 " ") + ) + (format *stdcon* " r2/l2: move camera~%") + (format + *stdcon* + " r1/l1: select joint ~D ~S~%" + (if arg0 + (the-as int (-> arg0 draw origin-joint-index)) + -1 + ) + (if (and arg0 (-> arg0 node-list data (-> arg0 draw origin-joint-index) joint)) + (-> arg0 node-list data (-> arg0 draw origin-joint-index) joint name) + "?" + ) + ) + (format *stdcon* " dpad: select function~%") + (format *stdcon* " x, tri: toggle/call~%") + (format *stdcon* "------------------------~%") + (let ((t9-9 format) + (a0-14 *stdcon*) + (a1-9 " ~S analog: ~S~%") + (a2-1 (if (= (-> this current-func) (visvol-edit-func visvol-positive)) + s3-0 + s4-0 + ) + ) + (v1-45 (-> this analog-func)) + ) + (t9-9 a0-14 a1-9 a2-1 (cond + ((= v1-45 (visvol-edit-func visvol-positive)) + (set! *display-xyz-axes* #t) + "visvol positive" + ) + ((= v1-45 (visvol-edit-func visvol-negative)) + (set! *display-xyz-axes* #t) + "visvol negative" + ) + ((= v1-45 (visvol-edit-func adjust-sphere)) + (set! *display-xyz-axes* #f) + "adjust sphere" + ) + ((= v1-45 (visvol-edit-func adjust-vis-distance)) + (set! *display-xyz-axes* #f) + "adjust vis distance" + ) + (else + "???" + ) + ) + ) + ) + (format *stdcon* " ~S print to listener~%" (if (= (-> this current-func) (visvol-edit-func visvol-negative)) + s3-0 + s4-0 + ) + ) + (format *stdcon* " ~S quit~%" (cond + ((= (-> this current-func) (visvol-edit-func adjust-sphere)) + (empty) + s3-0 + ) + (else + s4-0 + ) + ) + ) + ) + (let ((v1-51 0)) + (if (cpad-pressed? 0 x) + (+! v1-51 1) + ) + (if (cpad-pressed? 0 triangle) + (+! v1-51 -1) + ) + (when (nonzero? v1-51) + (case (-> this current-func) + (((visvol-edit-func visvol-positive)) + (+! (-> this analog-func) v1-51) + ) + (((visvol-edit-func visvol-negative)) + (when arg0 + (let ((s4-1 (entity-by-name (-> arg0 name)))) + (when s4-1 + (let ((f30-0 (res-lump-float s4-1 'vis-dist :default 200.0)) + (s4-2 (res-lump-data s4-1 'visvol (pointer float))) + ) + (when s4-2 + (format #t "~%actor-vis ~S ~M " (-> arg0 name) f30-0) + (format #t "~M ~M ~M ~M ~M ~M~%~%" (-> s4-2 0) (-> s4-2 1) (-> s4-2 2) (-> s4-2 4) (-> s4-2 5) (-> s4-2 6)) + ) + ) + ) + ) + (format + #t + "~%:bounds (static-spherem ~M ~M ~M ~M)~%" + (-> arg0 draw bounds x) + (-> arg0 draw bounds y) + (-> arg0 draw bounds z) + (-> arg0 draw bounds w) + ) + (let ((v1-63 (-> arg0 draw origin-joint-index))) + (format + #t + ":origin-joint ~s~%~%" + (if (and (>= v1-63 0) (< v1-63 (the-as uint (-> arg0 node-list length))) (-> arg0 node-list data v1-63 joint)) + (-> arg0 node-list data v1-63 joint name) + "?" + ) + ) + ) + ) + ) + (((visvol-edit-func adjust-sphere)) + (kill-by-type visvol-editor *active-pool*) + ) + (else + (format 0 "~%ERROR: bad visvol-edit-func~%") + ) + ) + ) + ) + (cond + ((< (the-as int (-> this analog-func)) 0) + (set! (-> this analog-func) (visvol-edit-func adjust-vis-distance)) + ) + ((>= (the-as int (-> this analog-func)) 4) + (set! (-> this analog-func) (visvol-edit-func visvol-positive)) + 0 + ) + ) + (when arg0 + (let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0)) + (f30-1 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 1.0)) + (f0-10 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 1.0)) + ) + (when (or (!= f28-0 0.0) (!= f30-1 0.0) (!= f26-0 0.0) (!= f0-10 0.0)) + (case (-> this analog-func) + (((visvol-edit-func visvol-positive) (visvol-edit-func visvol-negative)) + (set! f28-0 (* 1228.8 f28-0)) + (set! f30-1 (* -1228.8 f30-1)) + (set! f26-0 (* 1228.8 f26-0)) + (let ((f0-11 (/ f0-10 -100))) + (set! f0-10 (+ 1.0 f0-11)) + ) + ) + (((visvol-edit-func adjust-sphere)) + (set! f28-0 (* -409.6 f28-0)) + (set! f30-1 (* -409.6 f30-1)) + (set! f26-0 (* -409.6 f26-0)) + (let ((f0-12 (/ f0-10 100))) + (set! f0-10 (+ 1.0 f0-12)) + ) + ) + (((visvol-edit-func adjust-vis-distance)) + (let ((f1-15 (/ f28-0 100))) + (set! f28-0 (+ 1.0 f1-15)) + ) + (let ((f1-17 (/ f30-1 -100))) + (set! f30-1 (+ 1.0 f1-17)) + ) + (let ((f1-19 (/ f26-0 100))) + (set! f26-0 (+ 1.0 f1-19)) + ) + ) + ) + (case (-> this analog-func) + (((visvol-edit-func visvol-positive)) + (let ((a0-57 (entity-by-name (-> arg0 name)))) + (when a0-57 + (let ((v1-110 (res-lump-data a0-57 'visvol (pointer float)))) + (when v1-110 + (let ((a2-23 (&-> v1-110 4)) + (a0-58 (&-> v1-110 4)) + (a1-29 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-29 x) f28-0) + (set! (-> a1-29 y) f30-1) + (set! (-> a1-29 z) f26-0) + (set! (-> a1-29 w) 1.0) + (vector+! (the-as vector a2-23) (the-as vector a0-58) a1-29) + ) + (set! (-> v1-110 4) (fmax (-> v1-110 4) (+ 4096.0 (-> v1-110 0)))) + (set! (-> v1-110 5) (fmax (-> v1-110 5) (+ 4096.0 (-> v1-110 1)))) + (set! (-> v1-110 6) (fmax (-> v1-110 6) (+ 4096.0 (-> v1-110 2)))) + ) + ) + ) + ) + ) + (((visvol-edit-func visvol-negative)) + (let ((a0-65 (entity-by-name (-> arg0 name)))) + (when a0-65 + (let ((v1-112 (res-lump-data a0-65 'visvol (pointer float)))) + (when v1-112 + (let ((a2-26 (&-> v1-112 0)) + (a0-66 (&-> v1-112 0)) + (a1-34 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-34 x) f28-0) + (set! (-> a1-34 y) f30-1) + (set! (-> a1-34 z) f26-0) + (set! (-> a1-34 w) 1.0) + (vector+! (the-as vector a2-26) (the-as vector a0-66) a1-34) + ) + (set! (-> v1-112 0) (fmin (-> v1-112 0) (+ -4096.0 (-> v1-112 4)))) + (set! (-> v1-112 1) (fmin (-> v1-112 1) (+ -4096.0 (-> v1-112 5)))) + (set! (-> v1-112 2) (fmin (-> v1-112 2) (+ -4096.0 (-> v1-112 6)))) + ) + ) + ) + ) + ) + (((visvol-edit-func adjust-sphere)) + (set! (-> arg0 draw bounds w) (* (-> arg0 draw bounds w) f0-10)) + (let ((s4-3 (matrix-copy! (new 'stack-no-clear 'matrix) (matrix-local->world #f #f))) + (s2-0 (matrix-copy! + (new 'stack-no-clear 'matrix) + (-> arg0 node-list data (-> arg0 draw origin-joint-index) bone transform) + ) + ) + (s3-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-1 x) f28-0) + (set! (-> s3-1 y) f30-1) + (set! (-> s3-1 z) f26-0) + (set! (-> s3-1 w) 1.0) + (vector-reset! (-> s4-3 trans)) + (vector-matrix*! s3-1 s3-1 s4-3) + (vector-reset! (-> s2-0 trans)) + (matrix-transpose! s2-0 s2-0) + (vector-matrix*! s3-1 s3-1 s2-0) + (+! (-> arg0 draw bounds x) (-> s3-1 x)) + (+! (-> arg0 draw bounds y) (-> s3-1 y)) + (+! (-> arg0 draw bounds z) (-> s3-1 z)) + ) + ) + (((visvol-edit-func adjust-vis-distance)) + (let ((s4-4 (entity-by-name (-> arg0 name)))) + (when s4-4 + (let ((f0-36 (* (res-lump-float s4-4 'vis-dist :default 200.0) f30-1))) + (add-32bit-data! + s4-4 + (new 'static 'res-tag :name 'vis-dist :key-frame -1000000000.0 :elt-count #x1 :elt-type float) + f0-36 + ) + ) + ) + ) + ) + ) + ) + ) + (case (-> this analog-func) + (((visvol-edit-func adjust-vis-distance)) + (let ((a0-93 (entity-by-name (-> arg0 name)))) + (when a0-93 + (let ((f0-37 (res-lump-float a0-93 'vis-dist :default 200.0))) + (format *stdcon* "~%vis distance: ~M" f0-37) + ) + ) + ) + ) + ) + ) + ) + ) + (case (-> this analog-func) + (((visvol-edit-func adjust-sphere)) + (when arg0 + (let ((a1-53 (-> arg0 draw origin-joint-index))) + (show-maya-skeleton arg0 (the-as int a1-53) #x46400000) + ) + ) + ) + ) + 0 + ) + +;; definition for symbol *visvol-edit-info*, type visvol-edit-info +(define *visvol-edit-info* (the-as visvol-edit-info 0)) + +;; definition for symbol *visvol-edit-info*, type visvol-edit-info +(define *visvol-edit-info* (new 'static 'visvol-edit-info :editing #t)) + +;; failed to figure out what this is: +(defstate idle (visvol-editor) + :virtual #t + :enter (behavior () + (set! *display-actor-vis* #t) + ) + :exit (behavior () + (set! *display-xyz-axes* #f) + (set! *display-actor-vis* #f) + (set! *external-cam-mode* #f) + ) + :trans (behavior () + (draw-menu + *visvol-edit-info* + (the-as process-drawable (as-type (handle->process (-> self proc)) process-drawable)) + ) + ) + :code sleep-code + ) + +;; definition for function visvol-editor-init-by-other +(defbehavior visvol-editor-init-by-other visvol-editor ((arg0 handle)) + (set! (-> self proc) arg0) + (go-virtual idle) + ) + +;; definition for function stop-visvol-edit +;; WARN: Return type mismatch int vs object. +(defun stop-visvol-edit () + (kill-by-type visvol-editor *active-pool*) + 0 + ) + +;; definition for function visvol-edit +;; WARN: Return type mismatch int vs object. +(defun visvol-edit ((arg0 string)) + (stop-visvol-edit) + (let* ((v1-0 (process->ppointer (process-by-name arg0 *active-pool*))) + (gp-0 (logior (if v1-0 + (new 'static 'handle :pid (-> v1-0 0 pid)) + (new 'static 'handle) + ) + (new 'static 'handle :process v1-0) + ) + ) + ) + (if (not (handle->process gp-0)) + (set! gp-0 (process->handle *debug-actor*)) + (debug-actor arg0) + ) + (process-spawn visvol-editor gp-0 :name "visvol-editor") + ) + 0 + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/lights_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/lights_REF.gc index de99d79b54..30ff1a8cab 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/lights_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/lights_REF.gc @@ -109,7 +109,7 @@ ;; definition (debug) for function reset-light-hash ;; WARN: Return type mismatch int vs none. -(defun-debug reset-light-hash () +(defun-debug reset-light-hash ((arg0 light-hash)) "Resets the global [[*light-hash*]] back to having `0` lights, indicies, and buckets. @returns [[none]]" (set! (-> *light-hash* num-lights) (the-as uint 0)) diff --git a/test/decompiler/reference/jak3/levels/city/common/nav-graph_REF.gc b/test/decompiler/reference/jak3/levels/city/common/nav-graph_REF.gc index 97ba045ec0..ab4dc05775 100644 --- a/test/decompiler/reference/jak3/levels/city/common/nav-graph_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/common/nav-graph_REF.gc @@ -1213,7 +1213,7 @@ (set! (-> arg0 node-array length) 0) (set! (-> arg0 edge-array length) 0) (set! (-> arg0 visnode-array length) 0) - (set! (-> arg0 graph-type) (the-as basic (mysql-nav-graph-method-21 arg0))) + (set! (-> arg0 graph-type) (get-graph-type arg0 (the-as symbol arg1))) (let ((s3-0 (clear *temp-string*))) (format s3-0 "select nav_graph_id from nav_graph where name='~S'" arg1) (let ((a2-2 (sql-query s3-0))) diff --git a/test/offline/config/jak3/config.jsonc b/test/offline/config/jak3/config.jsonc index 41e3f959fa..1316a8e682 100644 --- a/test/offline/config/jak3/config.jsonc +++ b/test/offline/config/jak3/config.jsonc @@ -390,7 +390,8 @@ "(method 37 cloth-system)", "(method 19 rope-prim-system)", // funny casts with matrix. - "sprite-add-matrix-data" + "sprite-add-matrix-data", + "(method 17 nav-mesh-editable)" // weird delay branch that tries to set a variable that doesn't exist ], "skip_compile_states": { @@ -403,6 +404,7 @@ "(hostile spydroid)": ["trans"], // reassigning process to a conditional "(explode krimson-wall-break)": ["code"], // art-joint-anim cast "(active desert-chase-ambush-manager)": ["code"], - "(riding-idle-ship bt-grunt)": ["code"] // int->float attempted on a function + "(riding-idle-ship bt-grunt)": ["code"], // int->float attempted on a function + "(idle editable-player)": ["trans"] // fails to use subdivide-setting enum in places where it's set with r0 } }