Files
water111 637990314b wip: better stack var support (#4222)
Closes #736

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
2026-04-19 00:14:44 +02:00

3392 lines
127 KiB
Common Lisp
Vendored
Generated

;;-*-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))
(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))
(if (zero? s2-0)
(format s5-0 "~D" (string->int (the-as string (-> s3-0 sql-data s2-0))))
(format s5-0 ",~D" (string->int (the-as string (-> s3-0 sql-data s2-0))))
)
)
(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))
(let ((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))
(let ((sv-48 (new 'stack-no-clear 'vector))
(sv-52 (new 'stack-no-clear 'vector))
(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))
(when (!= (-> this region level) (-> arg0 level))
(let ((gp-0 (new 'static 'vector))
(s3-0 sql-query)
)
(format
(clear *temp-string*)
"select translate_x,translate_y,translate_z from level_info where name='~S'"
(-> this region level)
)
(let ((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))
(let* ((sv-560 this)
(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)))
(let ((sv-576 (new 'stack-no-clear 'vector)))
(when (< 0.0 (vector-dot
(editable-face-method-37 sv-560 (new 'stack-no-clear 'vector))
(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))
(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))
)
(let ((sv-208 v1-15))
(let ((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)))
(+! 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)))
(+! 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)
)
)
)
(let ((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
)
)
)
(sv-292 (+ (-> this length) -1))
(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)))
)
(let ((sv-368 (new-stack-matrix0))
(sv-372 (the-as editable-point #f))
(sv-376 0.0)
(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))
(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)
)
)
(+! 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))
(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))
)
(let ((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))
(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)
)
(let ((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))
(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
)
(let ((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
)
(let ((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
)
(let ((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
)
(let ((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
)
(let ((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))
(let ((sv-36 (new 'debug 'editable-region)))
(let ((sv-40 4095996000.0)
(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)
)
)
(let ((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")
(let ((sv-72 (get-length this))
(sv-80 (new 'debug 'editable-plane sv-36))
(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)
(let ((sv-112 s2-1))
(vector+! sv-112 sv-112 (-> this level-offset))
(let ((sv-120 (get-length this)))
(when (>= sv-120 0)
(let ((sv-128 (new 'debug 'editable-point sv-112 sv-36)))
(let ((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")
(let ((sv-144 (get-length this))
(sv-152 (new 'debug 'editable-face sv-36))
(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)
(let ((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)
(let ((sv-180 s0-0))
(let ((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))
)
(let ((sv-192 (get-length this)))
(when (>= sv-192 0)
(let ((sv-200 (new 'debug 'editable-point sv-176 sv-36)))
(let ((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))
)
)
)
)
)
(+! 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)
)
(let ((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))
(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)
)
(let ((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)
)
)