2020-10-26 21:08:24 -04:00
|
|
|
;;-*-Lisp-*-
|
2020-09-04 14:44:23 -04:00
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: twister.gc
|
|
|
|
;; name in dgo: twister
|
|
|
|
;; dgos: BEA, L1
|
|
|
|
|
2021-11-14 11:14:43 -05:00
|
|
|
;; DECOMP BEGINS
|
|
|
|
|
2021-08-08 13:28:47 -04:00
|
|
|
(deftype twist-joint (structure)
|
|
|
|
((ry float :offset-assert 0)
|
|
|
|
(max-dry float :offset-assert 4)
|
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
:allow-misaligned
|
|
|
|
:method-count-assert 9
|
2021-08-08 13:28:47 -04:00
|
|
|
:size-assert #x8
|
|
|
|
:flag-assert #x900000008
|
|
|
|
)
|
|
|
|
|
2021-11-14 11:14:43 -05:00
|
|
|
|
2021-08-08 13:28:47 -04:00
|
|
|
(deftype twister (basic)
|
2021-08-10 20:43:25 -04:00
|
|
|
((num-joints int32 :offset-assert 4)
|
|
|
|
(first-joint int32 :offset-assert 8)
|
|
|
|
(last-joint int32 :offset-assert 12)
|
|
|
|
(something uint16 :offset 12)
|
|
|
|
(max-speed float :offset-assert 16)
|
|
|
|
(smoothing float :offset-assert 20)
|
|
|
|
(min-dist float :offset-assert 24)
|
|
|
|
(target float :offset-assert 28)
|
|
|
|
(ry float :offset-assert 32)
|
|
|
|
(max-speed-ry float :offset-assert 36)
|
|
|
|
(data twist-joint :inline :dynamic :offset-assert 40)
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
|
|
|
:method-count-assert 13
|
|
|
|
:size-assert #x28
|
|
|
|
:flag-assert #xd00000028
|
|
|
|
(:methods
|
2021-11-14 11:14:43 -05:00
|
|
|
(new (symbol type int int float float float float) _type_ 0)
|
2023-04-05 18:41:05 -04:00
|
|
|
(twister-method-9 (_type_ int int float) none 9)
|
2021-08-08 13:28:47 -04:00
|
|
|
(set-target! (_type_ float) none 10)
|
2023-04-05 18:41:05 -04:00
|
|
|
(twister-method-11 (_type_) none 11)
|
|
|
|
(twister-method-12 (_type_ process-drawable) none 12)
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-11-14 11:14:43 -05:00
|
|
|
|
2022-01-15 20:01:38 -05:00
|
|
|
(defmethod new twister ((allocation symbol)
|
|
|
|
(type-to-make type)
|
|
|
|
(arg0 int)
|
|
|
|
(arg1 int)
|
|
|
|
(arg2 float)
|
|
|
|
(arg3 float)
|
|
|
|
(arg4 float)
|
|
|
|
(arg5 float)
|
|
|
|
)
|
2021-08-08 13:28:47 -04:00
|
|
|
(let* ((gp-0 (+ (- 1 arg0) arg1))
|
2022-01-15 20:01:38 -05:00
|
|
|
(v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* gp-0 16)))))
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
(set! (-> v0-0 first-joint) arg0)
|
|
|
|
(set! (-> v0-0 last-joint) arg1)
|
|
|
|
(set! (-> v0-0 num-joints) gp-0)
|
|
|
|
(set! (-> v0-0 max-speed) arg2)
|
|
|
|
(set! (-> v0-0 smoothing) arg4)
|
|
|
|
(set! (-> v0-0 min-dist) arg5)
|
|
|
|
(set! (-> v0-0 target) 0.0)
|
|
|
|
(set! (-> v0-0 ry) 0.0)
|
|
|
|
(set! (-> v0-0 max-speed-ry) arg3)
|
|
|
|
(dotimes (v1-4 gp-0)
|
|
|
|
(set! (-> v0-0 data v1-4 ry) 0.0)
|
|
|
|
(set! (-> v0-0 data v1-4 max-dry) 0.0)
|
|
|
|
)
|
|
|
|
v0-0
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod asize-of twister ((obj twister))
|
|
|
|
(+ (* (-> obj num-joints) 16) 40)
|
|
|
|
)
|
|
|
|
|
2023-04-05 18:41:05 -04:00
|
|
|
(defmethod twister-method-9 twister ((obj twister) (arg0 int) (arg1 int) (arg2 float))
|
2021-08-08 13:28:47 -04:00
|
|
|
(let ((v1-1 (- arg0 (-> obj first-joint)))
|
|
|
|
(a1-2 (- arg1 (-> obj first-joint)))
|
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
(while (>= a1-2 v1-1)
|
|
|
|
(set! (-> obj data v1-1 max-dry) arg2)
|
|
|
|
(+! v1-1 1)
|
|
|
|
)
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod set-target! twister ((obj twister) (arg0 float))
|
|
|
|
(set! (-> obj target) arg0)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-04-05 18:41:05 -04:00
|
|
|
(defmethod twister-method-11 twister ((obj twister))
|
2021-08-08 13:28:47 -04:00
|
|
|
(let* ((s5-0 (+ (-> obj num-joints) -1))
|
2021-08-11 19:53:13 -04:00
|
|
|
(s4-0 (-> obj data s5-0))
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
(let ((f0-2 (deg-diff (-> s4-0 ry) (-> obj target))))
|
|
|
|
(+! (-> s4-0 ry) (seek-with-smooth 0.0 f0-2 (-> obj max-speed) (-> obj smoothing) (-> obj min-dist)))
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
2022-01-15 20:01:38 -05:00
|
|
|
(let ((f30-1 (-> s4-0 ry)))
|
|
|
|
(while (> s5-0 0)
|
|
|
|
(+! s5-0 -1)
|
|
|
|
(let ((s4-1 (-> obj data s5-0)))
|
|
|
|
(let ((f0-9 (deg-diff f30-1 (-> s4-1 ry))))
|
|
|
|
(cond
|
|
|
|
((= (-> s4-1 max-dry) 0.0)
|
|
|
|
(set! f0-9 0.0)
|
|
|
|
)
|
|
|
|
((< (fabs f0-9) (-> s4-1 max-dry))
|
|
|
|
)
|
|
|
|
((< f0-9 0.0)
|
|
|
|
(set! f0-9
|
|
|
|
(seek-with-smooth f0-9 (- (-> s4-1 max-dry)) (-> obj max-speed) (-> obj smoothing) (-> obj min-dist))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
(set! f0-9 (seek-with-smooth f0-9 (-> s4-1 max-dry) (-> obj max-speed) (-> obj smoothing) (-> obj min-dist)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(+! f30-1 f0-9)
|
|
|
|
)
|
|
|
|
(set! (-> s4-1 ry) f30-1)
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
2023-04-05 18:41:05 -04:00
|
|
|
(defmethod twister-method-12 twister ((obj twister) (arg0 process-drawable))
|
2021-08-08 13:28:47 -04:00
|
|
|
(let ((s4-0 (new 'stack-no-clear 'matrix)))
|
2022-01-15 20:01:38 -05:00
|
|
|
(dotimes (s3-0 (-> obj num-joints))
|
|
|
|
(let ((s2-0 (-> arg0 node-list data (+ (-> obj first-joint) s3-0) bone transform)))
|
|
|
|
(matrix-rotate-y! s4-0 (-> obj data s3-0 ry))
|
|
|
|
(vector-! (-> s2-0 vector 3) (-> s2-0 vector 3) (-> arg0 root trans))
|
|
|
|
(matrix*! s2-0 s2-0 s4-0)
|
|
|
|
(vector+! (-> s2-0 vector 3) (-> s2-0 vector 3) (-> arg0 root trans))
|
|
|
|
)
|
2021-08-08 13:28:47 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|