d/jak2: finish wren and fish (#2106)

finish the forest's ambiance
This commit is contained in:
Tyler Wilding
2023-01-11 19:24:44 -05:00
committed by GitHub
parent fd5191bb9a
commit f162d5ac31
8 changed files with 2130 additions and 31 deletions
+35 -28
View File
@@ -35928,22 +35928,21 @@
;; wren ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#|
(deftype wren (process-drawable)
((move-dest vector :inline :offset-assert 204)
(fly-curve UNKNOWN 2 :offset-assert 220)
(fly-index uint32 :offset-assert 228)
(fly-speed float :offset-assert 232)
(fly-y-rate float :offset-assert 236)
(fly-interp float :offset-assert 240)
(path-u float :offset-assert 244)
(path-du float :offset-assert 248)
(path-du-mod float :offset-assert 252)
(bob-level float :offset-assert 256)
(bob-level-seek float :offset-assert 260)
(bank-angle float :offset-assert 264)
(peck-timer uint64 :offset-assert 268)
(flags uint16 :offset-assert 276)
((move-dest vector :inline :offset-assert 208)
(fly-curve curve-control 2 :offset-assert 224)
(fly-index uint32 :offset-assert 232)
(fly-speed float :offset-assert 236)
(fly-y-rate float :offset-assert 240)
(fly-interp float :offset-assert 244)
(path-u float :offset-assert 248)
(path-du float :offset-assert 252)
(path-du-mod float :offset-assert 256)
(bob-level float :offset-assert 260)
(bob-level-seek float :offset-assert 264)
(bank-angle float :offset-assert 268)
(peck-timer uint64 :offset-assert 272)
(flags uint16 :offset-assert 280)
)
:method-count-assert 28
:size-assert #x11a
@@ -35955,19 +35954,32 @@
(land () _type_ :state 23)
(on-branch () _type_ :state 24)
(die () _type_ :state 25)
(wren-method-26 () none 26)
(wren-method-27 () none 27)
(spooked?
"@returns a [[symbol]] indicating if Jak is considered close enough to the wren to spook it.
If so, it transitions from [[wren::peck]] to [[wren::hunt]]"
(_type_) symbol 26)
(debug-draw-path
"Draws the associated [[curve-control]]s associated with this wren"
(_type_) symbol 27)
)
)
|#
;; (define-extern fly-post function)
(define-extern fly-post (function none :behavior wren))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; fish ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#|
;; +++fish:fish-type
(defenum fish-type
:type int32
:bitfield #f
(red 0)
(blue 1)
(green 2)
(yellow 3))
;; ---fish:fish-type
(deftype minnow (process-drawable)
()
:method-count-assert 21
@@ -35977,9 +35989,7 @@
(idle () _type_ :state 20)
)
)
|#
#|
(deftype fish (structure)
((pos vector :inline :offset-assert 0)
(vel vector :inline :offset-assert 16)
@@ -35988,17 +35998,15 @@
(wander float :offset-assert 64)
(max-speed float :offset-assert 68)
(speed float :offset-assert 72)
(handle uint64 :offset-assert 80)
(handle handle :offset-assert 80)
)
:method-count-assert 9
:size-assert #x58
:flag-assert #x900000058
)
|#
#|
(deftype fish-manager (process-drawable)
((fishes UNKNOWN 12 :offset-assert 204)
((fishes fish 12 :inline :offset-assert 208)
)
:method-count-assert 21
:size-assert #x550
@@ -36007,9 +36015,8 @@
(idle () _type_ :state 20)
)
)
|#
;; (define-extern minnow-init-by-other function)
(define-extern minnow-init-by-other "TODO - fish type" (function object fish-type none :behavior minnow))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; predator-h ;;
+14 -1
View File
@@ -1418,5 +1418,18 @@
"(code active dig-spikey-sphere-door)": [
[32, "projectile-init-by-other-params"]
],
"(enter idle dig-stomp-block-controller)": [[16, "vector"]]
"(enter idle dig-stomp-block-controller)": [[16, "vector"]],
"(post idle fish-manager)": [
[384, "vector"],
[176, "vector"],
[192, "vector"],
[208, "vector"],
[224, "vector"],
[256, "vector"],
[272, "vector"],
[336, "vector"],
[368, "vector"],
[400, "vector"],
[416, "vector"]
]
}
+19 -1
View File
@@ -6515,5 +6515,23 @@
"(method 11 dig-spikey-step)": [[96, "v0", "(pointer float)"]],
"(method 37 dig-tipping-rock)": [[14, "v0", "sound-rpc-set-param"]],
"(method 49 cpad-elevator)": [[2, "v1", "collide-shape-prim-group"]],
"(method 10 cpad-elevator)": [[10, "t9", "(function elevator none)"]]
"(method 10 cpad-elevator)": [[10, "t9", "(function elevator none)"]],
"(code hunt wren)": [[10, "v1", "art-joint-anim"]],
"(code peck wren)": [
[36, "v1", "art-joint-anim"],
[81, "v1", "symbol"]
],
"(code fly wren)": [
[51, "v1", "art-joint-anim"],
[82, "v1", "art-joint-anim"]
],
"(code land wren)": [[17, "v1", "art-joint-anim"]],
"(method 7 wren)": [
[30, "t9", "(function process-drawable int process-drawable)"]
],
"(code idle minnow)": [[10, "v1", "art-joint-anim"]],
"(post idle fish-manager)": [
[517, "v1", "process-drawable"],
[522, "v1", "process-drawable"]
]
}
+1 -1
View File
@@ -33,7 +33,7 @@
"disassemble_data": false,
// unpack textures to assets folder
"process_tpages": false,
"process_tpages": true,
// unpack game text to assets folder
"process_game_text": true,
// unpack game count to assets folder
+495
View File
@@ -5,5 +5,500 @@
;; name in dgo: fish
;; dgos: FOR
;; +++fish-type
(defenum fish-type
:type int32
:bitfield #f
(red 0)
(blue 1)
(green 2)
(yellow 3))
;; ---fish-type
;; DECOMP BEGINS
(defskelgroup skel-minnow minnow 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 1))
(deftype minnow (process-drawable)
()
:heap-base #x50
:method-count-assert 21
:size-assert #xc8
:flag-assert #x15005000c8
(:methods
(idle () _type_ :state 20)
)
)
;; WARN: Return type mismatch object vs none.
(defbehavior minnow-init-by-other minnow ((arg0 object) (arg1 fish-type))
"TODO - fish type"
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (the-as uint128 0))
(quaternion-identity! (-> self root quat))
(vector-identity! (-> self root scale))
(initialize-skeleton
self
(the-as skeleton-group (art-group-get-by-name *level* "skel-minnow" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(setup-masks (-> self draw) 0 -1)
(cond
((= arg1 (fish-type red))
(setup-masks (-> self draw) 4 0)
)
((= arg1 (fish-type blue))
(setup-masks (-> self draw) 1 0)
)
((= arg1 (fish-type green))
(setup-masks (-> self draw) 2 0)
)
(else
(setup-masks (-> self draw) 8 0)
)
)
(go-virtual idle)
(none)
)
(defstate idle (minnow)
:virtual #t
:code (behavior ()
(until #f
(ja-no-eval :group! (-> self draw art-group data 2)
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1)) 5.0)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max 5.0))
)
)
#f
(none)
)
:post (the-as (function none :behavior minnow) ja-post)
)
(deftype fish (structure)
((pos vector :inline :offset-assert 0)
(vel vector :inline :offset-assert 16)
(border-f vector :inline :offset-assert 32)
(avoid-d vector :inline :offset-assert 48)
(wander float :offset-assert 64)
(max-speed float :offset-assert 68)
(speed float :offset-assert 72)
(handle handle :offset-assert 80)
)
:method-count-assert 9
:size-assert #x58
:flag-assert #x900000058
)
(deftype fish-manager (process-drawable)
((fishes fish 12 :inline :offset-assert 208)
)
:heap-base #x4d0
:method-count-assert 21
:size-assert #x550
:flag-assert #x1504d00550
(:methods
(idle () _type_ :state 20)
)
)
(defstate idle (fish-manager)
:virtual #t
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
(format #t "training-manager received event ~s~%" event-type)
(format #t "event-from ~s~%" proc)
)
:code (the-as (function none :behavior fish-manager) sleep-code)
:post (behavior ()
(local-vars
(sv-448 (function vector vector float vector))
(sv-464 vector)
(sv-480 vector)
(sv-496 vector)
(sv-512 vector)
(sv-528 vector)
(sv-544 vector)
(sv-560 vector)
(sv-576 vector)
(sv-592 vector)
(sv-608 vector)
(sv-624 int)
(sv-640 int)
(sv-656 fish)
(sv-672 vector)
(sv-688 vector)
(sv-704 vector)
(sv-720 nav-poly)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((gp-0 (-> self nav))
(s5-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info))
)
(dotimes (s4-0 12)
(let* ((s1-0 (-> self fishes s4-0))
(s2-0 (-> s1-0 pos))
(s3-0 (-> s1-0 vel))
)
(new 'stack-no-clear 'vector)
(new 'stack-no-clear 'vector)
(set! sv-544 (new 'stack-no-clear 'vector))
(new 'stack-no-clear 'vector)
(let ((s0-0 (new-stack-vector0)))
(set! (-> sv-544 quad) (-> s3-0 quad))
(set! sv-448 vector-rotate-around-y!)
(set! sv-464 sv-544)
(set! sv-480 sv-544)
(let ((a2-0 (rand-vu-float-range 0.0 65536.0)))
(sv-448 sv-464 sv-480 a2-0)
)
(vector-float*! sv-544 sv-544 0.5)
(cond
((and *target* (< (-> (target-pos 0) y) 0.0))
(set! sv-512 (new 'stack-no-clear 'vector))
(set! sv-496 s2-0)
(let ((v0-4 (target-pos 0)))
(.lvf vf4 (&-> sv-496 quad))
(.lvf vf5 (&-> v0-4 quad))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.sub.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> sv-512 quad) vf6)
(let* ((v1-21 sv-512)
(f0-5 (+ (* (-> v1-21 x) (-> v1-21 x)) (* (-> v1-21 z) (-> v1-21 z))))
(f1-4 16384.0)
)
(cond
((< f0-5 (* f1-4 f1-4))
(set! (-> s1-0 max-speed) 40960.0)
(vector-normalize! sv-512 (* 4096.0 (/ 4096.0 f0-5)))
(let ((a0-9 (-> s1-0 avoid-d)))
(let ((v1-28 (-> s1-0 avoid-d)))
(let ((a1-6 100000.0))
(.mov vf7 a1-6)
)
(.lvf vf5 (&-> sv-512 quad))
(.lvf vf4 (&-> v1-28 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-9 quad) vf6)
)
#t
)
((let ((f1-9 81920.0))
(< f0-5 (* f1-9 f1-9))
)
(set! (-> s1-0 max-speed) 16384.0)
)
(else
(set! (-> s1-0 max-speed) 4096.0)
)
)
)
)
(else
(set! (-> s1-0 max-speed) 4096.0)
)
)
(set! sv-528 (new 'stack-no-clear 'vector))
(let ((v1-39 s2-0))
(let ((a0-10 sv-544))
(let ((a1-9 -0.1))
(.mov vf7 a1-9)
)
(.lvf vf5 (&-> a0-10 quad))
)
(.lvf vf4 (&-> v1-39 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> sv-528 quad) vf6)
(let ((v1-41 gp-0)
(a0-11 sv-528)
(a1-10 (new 'stack-no-clear 'nav-find-poly-parms))
)
(vector-! (-> a1-10 point) a0-11 (-> v1-41 state mesh bounds))
(set! (-> a1-10 y-threshold) (-> v1-41 nearest-y-threshold))
(set! (-> a1-10 ignore) (the-as uint 2))
(set! sv-720 (find-poly-containing-point-local (-> v1-41 state mesh) a1-10))
)
(new 'stack-no-clear 'vector)
(when sv-720
(let ((a0-14 gp-0)
(t9-7 (method-of-type nav-control clamp-vector-to-mesh-no-gaps))
(a2-3 sv-720)
(t0-0 s5-0)
)
(t9-7 a0-14 sv-528 a2-3 sv-544 t0-0)
)
(cond
((-> s5-0 found-boundary)
(let ((a1-12 (-> s1-0 border-f)))
(let ((v1-48 (-> s1-0 border-f)))
(let ((a0-15 (-> s5-0 boundary-normal)))
(let ((a2-5 -10000.0))
(.mov vf7 a2-5)
)
(.lvf vf5 (&-> a0-15 quad))
)
(.lvf vf4 (&-> v1-48 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a1-12 quad) vf6)
)
)
(else
(set! sv-608 (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0))
(let ((a1-14 sv-608))
(let ((v1-49 s2-0))
(let ((a0-17 sv-608))
(let ((a2-8 4096.0))
(.mov vf7 a2-8)
)
(.lvf vf5 (&-> a0-17 quad))
)
(.lvf vf4 (&-> v1-49 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a1-14 quad) vf6)
)
(set! sv-592 sv-608)
(set! sv-560 sv-608)
(set! sv-576 (new 'stack-no-clear 'vector))
(set! (-> sv-576 x) (cos (-> s1-0 wander)))
(set! (-> sv-576 y) 0.0)
(set! (-> sv-576 z) (sin (-> s1-0 wander)))
(set! (-> sv-576 w) 1.0)
(let ((v1-59 3276.8))
(.mov vf7 v1-59)
)
(.lvf vf5 (&-> sv-576 quad))
(.lvf vf4 (&-> sv-560 quad))
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> sv-592 quad) vf6)
(vector-! sv-608 sv-608 s2-0)
(let ((a0-21 s0-0))
(let ((v1-64 s0-0))
(let ((a1-18 10.0))
(.mov vf7 a1-18)
)
(.lvf vf5 (&-> sv-608 quad))
(.lvf vf4 (&-> v1-64 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-21 quad) vf6)
)
(+! (-> s1-0 wander) (rand-vu-float-range -1820.4445 1820.4445))
)
)
)
(set! sv-624 0)
(set! sv-688 (new 'stack-no-clear 'vector))
(set! (-> sv-688 quad) (the-as uint128 0))
(set! sv-704 (new 'stack-no-clear 'vector))
(set! (-> sv-704 quad) (the-as uint128 0))
(set! sv-640 0)
(while (< sv-640 12)
(when (!= sv-640 s4-0)
(set! sv-656 (-> self fishes sv-640))
(set! sv-672 (new 'stack-no-clear 'vector))
(let ((v1-78 s2-0)
(a0-25 (-> sv-656 pos))
)
(.lvf vf4 (&-> v1-78 quad))
(.lvf vf5 (&-> a0-25 quad))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.sub.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> sv-672 quad) vf6)
(let* ((v1-80 sv-672)
(f0-29 (+ (* (-> v1-80 x) (-> v1-80 x)) (* (-> v1-80 z) (-> v1-80 z))))
(f1-15 4096.0)
)
(when (< f0-29 (* f1-15 f1-15))
(vector-normalize! sv-672 (* 4096.0 (/ 4096.0 f0-29)))
(let ((a0-27 s0-0))
(let ((v1-87 s0-0))
(let ((a1-24 100.0))
(.mov vf7 a1-24)
)
(.lvf vf5 (&-> sv-672 quad))
(.lvf vf4 (&-> v1-87 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-27 quad) vf6)
)
(vector+! sv-688 sv-688 (-> sv-656 pos))
(vector+! sv-704 sv-704 (-> sv-656 vel))
(set! sv-624 (+ sv-624 1))
sv-624
)
)
)
(set! sv-640 (+ sv-640 1))
)
(when (nonzero? sv-624)
(vector-float*! sv-688 sv-688 (/ 1.0 (the float sv-624)))
(vector-! sv-688 sv-688 s2-0)
(let ((t9-13 vector-normalize!)
(a0-35 sv-688)
(f0-35 4096.0)
(f1-21 4096.0)
(v1-104 sv-688)
)
(t9-13 a0-35 (* f0-35 (/ f1-21 (+ (* (-> v1-104 x) (-> v1-104 x)) (* (-> v1-104 z) (-> v1-104 z))))))
)
(let ((a0-36 s0-0))
(let ((v1-106 s0-0))
(let ((a1-36 100.0))
(.mov vf7 a1-36)
)
(.lvf vf5 (&-> sv-688 quad))
(.lvf vf4 (&-> v1-106 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-36 quad) vf6)
)
(vector-float*! sv-704 sv-704 (/ 1.0 (the float sv-624)))
(vector-! sv-704 sv-704 s3-0)
(let ((a0-39 s0-0))
(let ((v1-110 s0-0))
(let ((a1-43 5.0))
(.mov vf7 a1-43)
)
(.lvf vf5 (&-> sv-704 quad))
(.lvf vf4 (&-> v1-110 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-39 quad) vf6)
)
)
(vector-float*! (-> s1-0 avoid-d) (-> s1-0 avoid-d) 0.95)
(vector-float*! (-> s1-0 border-f) (-> s1-0 border-f) 0.99)
(vector+! s0-0 s0-0 (-> s1-0 border-f))
(vector+! s0-0 s0-0 (-> s1-0 avoid-d))
(set! (-> s0-0 y) 0.0)
(let ((a0-44 s3-0))
(let ((v1-117 s3-0))
(let ((a1-52 (-> self clock seconds-per-frame)))
(.mov vf7 a1-52)
)
(.lvf vf5 (&-> s0-0 quad))
(.lvf vf4 (&-> v1-117 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-44 quad) vf6)
)
)
(vector-float*! s3-0 s3-0 0.8)
(let ((a1-54 s2-0))
(let ((v1-120 s2-0))
(let ((a0-46 s3-0))
(let ((a2-10 (-> self clock seconds-per-frame)))
(.mov vf7 a2-10)
)
(.lvf vf5 (&-> a0-46 quad))
)
(.lvf vf4 (&-> v1-120 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a1-54 quad) vf6)
)
(cloest-point-on-mesh (-> self nav) s2-0 s2-0 sv-720)
(set! (-> s2-0 y) -1638.4)
(let ((v1-124 (handle->process (-> s1-0 handle))))
(when v1-124
(set! (-> (the-as process-drawable v1-124) root trans quad) (-> s2-0 quad))
(forward-up->quaternion
(-> (the-as process-drawable v1-124) root quat)
(vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0)
*up-vector*
)
)
)
)
)
)
(none)
)
)
)
;; WARN: Return type mismatch object vs none.
(defmethod init-from-entity! fish-manager ((obj fish-manager) (arg0 entity-actor))
(let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player))))
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s4-0 reaction) cshape-reaction-default)
(set! (-> s4-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(let ((v1-6 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
(set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 9216.0)
(set! (-> s4-0 total-prims) (the-as uint 1))
(set! (-> s4-0 root-prim) v1-6)
)
(set! (-> s4-0 nav-radius) 4096.0)
(let ((v1-8 (-> s4-0 root-prim)))
(set! (-> s4-0 backup-collide-as) (-> v1-8 prim-core collide-as))
(set! (-> s4-0 backup-collide-with) (-> v1-8 prim-core collide-with))
)
(set! (-> obj root) s4-0)
)
(process-drawable-from-entity! obj arg0)
(get-nav-control obj (the-as nav-mesh #f))
(let ((s5-1 (rand-vu-int-count 4)))
(dotimes (s4-1 12)
(let ((s3-0 (-> obj fishes s4-1)))
(let ((f30-1 (* 182.04445 (the float (rand-vu-int-count 360)))))
(set! (-> s3-0 pos quad) (-> obj root trans quad))
(+! (-> s3-0 pos x) (rand-vu-float-range 409.6 4096.0))
(+! (-> s3-0 pos z) (rand-vu-float-range 409.6 4096.0))
(set! (-> s3-0 wander) (rand-vu-float-range 0.0 65536.0))
(set-vector! (-> s3-0 vel) (cos f30-1) 0.0 (sin f30-1) 1.0)
)
(set! (-> s3-0 border-f quad) (the-as uint128 0))
(set! (-> s3-0 avoid-d quad) (the-as uint128 0))
(set! (-> s3-0 max-speed) 16384.0)
(set! (-> s3-0 handle) (ppointer->handle (process-spawn minnow obj s5-1 :to obj)))
)
)
)
(go (method-of-object obj idle))
(none)
)
+490
View File
@@ -7,3 +7,493 @@
;; DECOMP BEGINS
(deftype wren (process-drawable)
((move-dest vector :inline :offset-assert 208)
(fly-curve curve-control 2 :offset-assert 224)
(fly-index uint32 :offset-assert 232)
(fly-speed float :offset-assert 236)
(fly-y-rate float :offset-assert 240)
(fly-interp float :offset-assert 244)
(path-u float :offset-assert 248)
(path-du float :offset-assert 252)
(path-du-mod float :offset-assert 256)
(bob-level float :offset-assert 260)
(bob-level-seek float :offset-assert 264)
(bank-angle float :offset-assert 268)
(peck-timer uint64 :offset-assert 272)
(flags uint16 :offset-assert 280)
)
:heap-base #xa0
:method-count-assert 28
:size-assert #x11a
:flag-assert #x1c00a0011a
(:methods
(hunt () _type_ :state 20)
(peck () _type_ :state 21)
(fly () _type_ :state 22)
(land () _type_ :state 23)
(on-branch () _type_ :state 24)
(die () _type_ :state 25)
(spooked? (_type_) symbol 26)
(debug-draw-path (_type_) symbol 27)
)
)
(defskelgroup skel-wren wren 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 4))
(defmethod debug-draw-path wren ((obj wren))
"Draws the associated [[curve-control]]s associated with this wren"
(dotimes (s5-0 2)
(if (-> obj fly-curve s5-0)
(debug-draw (-> obj fly-curve s5-0))
)
)
#f
)
(defbehavior fly-post wren ()
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
)
(init-vf0-vector)
(seek! (-> self bob-level) (-> self bob-level-seek) (* 12288.0 (-> self clock seconds-per-frame)))
(let ((gp-0 (-> self fly-curve (-> self fly-index))))
(get-point-at-percent-along-path! gp-0 (-> self root trans) (-> self path-u) 'interp)
(seek! (-> self path-u) 1.0 (* (-> self path-du) (-> self path-du-mod) (-> self clock seconds-per-frame)))
(seek! (-> self path-du) 0.2 (* 0.1 (-> self clock seconds-per-frame)))
(let* ((f30-0 (-> self path-u))
(f0-16 (fmin 1.0 (+ 0.125 f30-0)))
(s4-0 (displacement-between-points-at-percent-normalized! gp-0 (new 'stack-no-clear 'vector) f0-16))
(s3-0 (displacement-between-points-at-percent-normalized! gp-0 (new 'stack-no-clear 'vector) f30-0))
(gp-1 (-> self root quat))
)
(forward-up->quaternion gp-1 s4-0 *up-vector*)
(set! (-> self fly-y-rate) (tan (vector-x-angle s4-0)))
(let ((s5-1 (new 'stack-no-clear 'vector)))
(let ((v1-16 s3-0)
(a0-9 s4-0)
)
(.lvf vf1 (&-> v1-16 quad))
(.lvf vf2 (&-> a0-9 quad))
)
(.add.x.vf vf1 vf0 vf0 :mask #b10)
(.add.x.vf vf2 vf0 vf0 :mask #b10)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.svf (&-> s5-1 quad) vf3)
(let* ((f0-19 (acos (vector-dot s3-0 s4-0)))
(f1-8 (if (< 0.0 (vector-dot s5-1 *up-vector*))
(- f0-19)
f0-19
)
)
)
(if (and (-> self next-state) (= (-> self next-state name) 'fly))
(seek! (-> self bank-angle) f1-8 (* f0-19 (-> self clock seconds-per-frame)))
(seek! (-> self bank-angle) 0.0 (* 8192.0 (-> self clock seconds-per-frame)))
)
)
)
(quaternion-rotate-local-z! gp-1 gp-1 (-> self bank-angle))
)
)
0
(debug-draw-path self)
(+! (-> self root trans y) (-> self bob-level))
(ja-post)
(none)
)
)
;; WARN: Return type mismatch object vs symbol.
(defmethod spooked? wren ((obj wren))
"@returns a [[symbol]] indicating if Jak is considered close enough to the wren to spook it.
If so, it transitions from [[wren::peck]] to [[wren::hunt]]"
(let* ((gp-0 *target*)
(a0-2 (if (type? gp-0 process-focusable)
gp-0
)
)
)
(the-as symbol (and a0-2 (< (vector-vector-xz-distance (-> obj root trans) (get-trans a0-2 0)) 102400.0)))
)
)
(defstate hunt (wren)
:virtual #t
:trans (behavior ()
(when (< (vector-vector-xz-distance (-> self root trans) (-> self move-dest)) 2048.0)
(cond
((logtest? (-> self flags) 4)
(set! (-> self flags) (logand -5 (-> self flags)))
(set! (-> self fly-index) (the-as uint 0))
(go-virtual fly)
)
(else
(go-virtual peck)
)
)
)
(none)
)
:code (behavior ()
(until #f
(ja-no-eval :group! (-> self draw art-group data 3)
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
#f
(none)
)
:post (behavior ()
(local-vars (at-0 int))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans))))
(vector-normalize! gp-1 12288.0)
(let ((v1-1 (new 'stack-no-clear 'vector)))
(.lvf vf1 (&-> gp-1 quad))
(let ((f0-0 (-> self clock seconds-per-frame)))
(.mov at-0 f0-0)
)
(.mov vf2 at-0)
(.mov.vf vf1 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-1 quad) vf1)
(vector+! (-> self root trans) (-> self root trans) v1-1)
)
)
(ja-post)
(none)
)
)
)
(defstate peck (wren)
:virtual #t
:enter (behavior ()
(set! (-> self state-time) (-> self clock frame-counter))
(set! (-> self peck-timer) (the-as uint (the int (* 300.0 (rand-vu-float-range 1.4 4.3)))))
(set! (-> self flags) (logand -7 (-> self flags)))
(none)
)
:trans (behavior ()
(when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self peck-timer)))
(let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans))))
(if (< (fabs (deg-diff (quaternion-y-angle (-> self root quat)) (vector-y-angle gp-1))) 728.1778)
(go-virtual hunt)
)
)
)
(when (logtest? (-> self flags) 2)
(set! (-> self flags) (logand -3 (-> self flags)))
(when (spooked? self)
(get-point-in-path! (-> self fly-curve 0) (-> self move-dest) 0.0 'interp)
(set-yaw-angle-clear-roll-pitch!
(-> self root)
(vector-y-angle (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans)))
)
(logior! (-> self flags) 4)
(go-virtual hunt)
)
)
(none)
)
:code (behavior ()
(local-vars (v1-34 symbol))
(until #f
(set! (-> self flags) (logand -2 (-> self flags)))
(let ((f0-0 (rand-vu-float-range 0.0 (get-num-segments (-> self path)))))
(get-point-in-path! (-> self path) (-> self move-dest) f0-0 'interp)
)
(logior! (-> self flags) 2)
(ja-no-eval :group! (-> self draw art-group data 4)
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
#t
(let ((v1-33 (the-as symbol (logand (-> self flags) 2))))
(set! v1-33 v1-33)
(cmove-#f-zero v1-34 v1-33 v1-33)
)
(let ((gp-1 (-> self clock frame-counter))
(s5-1 (the int (* 300.0 (rand-vu-float-range 0.1 0.6))))
(f30-1 1.0)
)
(ja-no-eval :group! (-> self draw art-group data 2) :num! (loop! f30-1) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-1) s5-1)
(suspend)
(ja :num! (loop! f30-1))
)
)
(logior! (-> self flags) 1)
(let ((gp-2 (-> self clock frame-counter))
(s5-2 (the int (* 300.0 (rand-vu-float-range 0.2 1.5))))
(f30-3 1.0)
)
(ja-no-eval :group! (-> self draw art-group data 2) :num! (loop! f30-3) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-2) s5-2)
(suspend)
(ja :num! (loop! f30-3))
)
)
)
#f
(none)
)
:post (behavior ()
(if (logtest? (-> self flags) 1)
(seek-to-point-toward-point! (-> self root) (-> self move-dest) 262144.0 (seconds 0.02))
)
(ja-post)
(none)
)
)
(defstate fly (wren)
:virtual #t
:enter (behavior ()
(set! (-> self path-u) 0.0)
(set! (-> self path-du) 0.0)
(set! (-> self path-du-mod) 1.0)
(set! (-> self fly-speed) 0.0)
(set! (-> self fly-interp) 0.0)
(set! (-> self bob-level) 0.0)
(set! (-> self bob-level-seek) 0.0)
(none)
)
:trans (behavior ()
(when (< 0.99 (-> self path-u))
(if (-> self fly-curve (logand (+ (-> self fly-index) 1) 1))
(go-virtual land)
(go-virtual die)
)
)
(none)
)
:code (behavior ()
(let ((gp-0 (-> self clock frame-counter))
(s5-0 240)
(f30-0 2.0)
)
(ja-no-eval :group! (-> self draw art-group data 5) :num! (loop! f30-0) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-0) s5-0)
(suspend)
(ja :num! (loop! f30-0))
)
)
(ja-channel-push! 2 (seconds 0.3))
(ja-no-eval :group! (-> self draw art-group data 7)
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1)))
:frame-num 0.0
)
(let ((a0-4 (-> self skel root-channel 1)))
(let ((f0-5 0.0))
(set! (-> a0-4 frame-interp 1) f0-5)
(set! (-> a0-4 frame-interp 0) f0-5)
)
(set! (-> a0-4 frame-group) (the-as art-joint-anim (-> self draw art-group data 6)))
(set! (-> a0-4 param 0)
(the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 6)) frames num-frames) -1))
)
(set! (-> a0-4 param 1) 1.0)
(set! (-> a0-4 frame-num) 0.0)
(joint-control-channel-group! a0-4 (the-as art-joint-anim (-> self draw art-group data 6)) num-func-seek!)
)
(until #f
(let ((f0-11 (fmax -0.2 (fmin 0.5 (-> self fly-y-rate)))))
(seek! (-> self fly-interp) (lerp-scale 0.0 1.0 f0-11 -0.2 0.5) (-> self clock seconds-per-frame))
)
(let ((f30-1 (-> self fly-interp)))
(seek! (-> self path-du-mod) (+ 0.9 (* 0.2 f30-1)) (* 0.5 (-> self clock seconds-per-frame)))
(set! (-> self bob-level-seek) (+ -12288.0 (* 24576.0 f30-1)))
(let ((v1-59 (-> self skel root-channel 0)))
(let ((f0-23 (- 1.0 f30-1)))
(set! (-> v1-59 frame-interp 1) f0-23)
(set! (-> v1-59 frame-interp 0) f0-23)
)
(set! (-> v1-59 frame-group) (the-as art-joint-anim (-> self draw art-group data 7)))
)
(let ((v1-62 (-> self skel root-channel 1)))
(set! (-> v1-62 frame-interp 1) f30-1)
(set! (-> v1-62 frame-interp 0) f30-1)
(set! (-> v1-62 frame-group) (the-as art-joint-anim (-> self draw art-group data 6)))
)
(let ((f30-2 (lerp 0.6 2.4 f30-1)))
(ja :num! (loop! f30-2))
(ja :chan 1 :num! (loop! f30-2))
)
)
(suspend)
)
#f
(none)
)
:post fly-post
)
(defstate land (wren)
:virtual #t
:code (behavior ()
(set! (-> self bob-level-seek) 0.0)
(ja-channel-push! 1 (seconds 0.3))
(while (!= (-> self path-u) 1.0)
(ja-no-eval :group! (-> self draw art-group data 8)
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 8)) frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
(go-virtual on-branch)
(none)
)
:post (behavior ()
(seek! (-> self path-du-mod) 0.0 (* 0.5 (-> self clock seconds-per-frame)))
(fly-post)
(none)
)
)
(defstate on-branch (wren)
:virtual #t
:enter (behavior ()
(let ((v1-6 (displacement-between-points-at-percent-normalized!
(-> self fly-curve (logand (+ (-> self fly-index) 1) 1))
(new 'stack-no-clear 'vector)
0.1
)
)
)
(vector+! (-> self move-dest) (-> self root trans) v1-6)
)
(none)
)
:trans (behavior ()
(let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans))))
(when (< (fabs (deg-diff (quaternion-y-angle (-> self root quat)) (vector-y-angle gp-1))) 728.1778)
(when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self peck-timer)))
(set! (-> self fly-index) (logand (+ (-> self fly-index) 1) 1))
(go-virtual fly)
)
)
)
(none)
)
:code (behavior ()
(set! (-> self flags) (logand -2 (-> self flags)))
(ja-channel-push! 1 (seconds 0.2))
(let ((gp-0 (-> self clock frame-counter))
(s5-0 (the int (* 300.0 (rand-vu-float-range 4.2 16.8))))
(f30-1 1.0)
)
(ja-no-eval :group! (-> self draw art-group data 2) :num! (loop! f30-1) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-0) s5-0)
(suspend)
(ja :num! (loop! f30-1))
)
)
(logior! (-> self flags) 1)
(let ((gp-1 (-> self clock frame-counter))
(s5-1 600)
(f30-2 1.0)
)
(ja-no-eval :group! (-> self draw art-group data 2) :num! (loop! f30-2) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-1) s5-1)
(suspend)
(ja :num! (loop! f30-2))
)
)
(none)
)
:post (behavior ()
(if (logtest? (-> self flags) 1)
(seek-to-point-toward-point! (-> self root) (-> self move-dest) 262144.0 (seconds 0.02))
)
(debug-draw-path self)
(ja-post)
(none)
)
)
(defstate die (wren)
:virtual #t
:code (behavior ()
(cleanup-for-death self)
(suspend)
0
(none)
)
)
;; WARN: Return type mismatch process-drawable vs wren.
(defmethod relocate wren ((obj wren) (arg0 int))
(dotimes (v1-0 2)
(when (-> obj fly-curve v1-0)
(if (nonzero? (-> obj fly-curve v1-0))
(&+! (-> obj fly-curve v1-0) arg0)
)
)
)
(the-as wren ((the-as (function process-drawable int process-drawable) (find-parent-method wren 7)) obj arg0))
)
;; WARN: Return type mismatch object vs none.
(defmethod init-from-entity! wren ((obj wren) (arg0 entity-actor))
(set! (-> obj root) (new 'process 'trsqv))
(process-drawable-from-entity! obj arg0)
(initialize-skeleton
obj
(the-as skeleton-group (art-group-get-by-name *level* "skel-wren" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(logclear! (-> obj mask) (process-mask actor-pause))
(let ((f0-0 (rand-vu-float-range 1.5 3.5)))
(set-vector! (-> obj root scale) f0-0 f0-0 f0-0 1.0)
)
(set! (-> obj fly-index) (the-as uint 0))
(set! (-> obj path-u) 0.0)
(set! (-> obj flags) (the-as uint 0))
(set! (-> obj bob-level) 0.0)
(set! (-> obj bank-angle) 0.0)
(set! (-> obj path) (new 'process 'path-control obj 'idle 0.0 arg0 #f))
(logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text))
(cond
((logtest? (-> obj path flags) (path-control-flag not-found))
(dotimes (s5-1 2)
(set! (-> obj fly-curve s5-1) (new 'process 'curve-control obj 'path (the float s5-1)))
(logior! (-> obj fly-curve s5-1 flags) (path-control-flag display draw-line draw-point draw-text))
)
(setup-masks (-> obj draw) 0 -1)
(setup-masks (-> obj draw) 8 0)
(go (method-of-object obj fly))
)
(else
(set! (-> obj fly-curve 0) (new 'process 'curve-control obj 'takeoff -1000000000.0))
(logior! (-> obj fly-curve 0 flags) (path-control-flag display draw-line draw-point draw-text))
(set! (-> obj fly-curve 1) #f)
(setup-masks (-> obj draw) 0 -1)
(setup-masks (-> obj draw) 2 0)
(go (method-of-object obj peck))
)
)
(none)
)
+543
View File
@@ -0,0 +1,543 @@
;;-*-Lisp-*-
(in-package goal)
;; failed to figure out what this is:
(defskelgroup skel-minnow minnow minnow-lod0-jg minnow-idle-ja
((minnow-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 1)
)
;; definition of type minnow
(deftype minnow (process-drawable)
()
:heap-base #x50
:method-count-assert 21
:size-assert #xc8
:flag-assert #x15005000c8
(:methods
(idle () _type_ :state 20)
)
)
;; definition for method 3 of type minnow
(defmethod inspect minnow ((obj minnow))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 obj)
)
(label cfg-4)
obj
)
;; definition for function minnow-init-by-other
;; INFO: Used lq/sq
;; WARN: Return type mismatch object vs none.
(defbehavior minnow-init-by-other minnow ((arg0 object) (arg1 fish-type))
"TODO - fish type"
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (the-as uint128 0))
(quaternion-identity! (-> self root quat))
(vector-identity! (-> self root scale))
(initialize-skeleton
self
(the-as skeleton-group (art-group-get-by-name *level* "skel-minnow" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(setup-masks (-> self draw) 0 -1)
(cond
((= arg1 (fish-type red))
(setup-masks (-> self draw) 4 0)
)
((= arg1 (fish-type blue))
(setup-masks (-> self draw) 1 0)
)
((= arg1 (fish-type green))
(setup-masks (-> self draw) 2 0)
)
(else
(setup-masks (-> self draw) 8 0)
)
)
(go-virtual idle)
(none)
)
;; failed to figure out what this is:
(defstate idle (minnow)
:virtual #t
:code (behavior ()
(until #f
(ja-no-eval :group! (-> self draw art-group data 2)
:num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1)) 5.0)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max 5.0))
)
)
#f
(none)
)
:post (the-as (function none :behavior minnow) ja-post)
)
;; definition of type fish
(deftype fish (structure)
((pos vector :inline :offset-assert 0)
(vel vector :inline :offset-assert 16)
(border-f vector :inline :offset-assert 32)
(avoid-d vector :inline :offset-assert 48)
(wander float :offset-assert 64)
(max-speed float :offset-assert 68)
(speed float :offset-assert 72)
(handle handle :offset-assert 80)
)
:method-count-assert 9
:size-assert #x58
:flag-assert #x900000058
)
;; definition for method 3 of type fish
(defmethod inspect fish ((obj fish))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'fish)
(format #t "~1Tpos: #<vector @ #x~X>~%" (-> obj pos))
(format #t "~1Tvel: #<vector @ #x~X>~%" (-> obj vel))
(format #t "~1Tborder-f: #<vector @ #x~X>~%" (-> obj border-f))
(format #t "~1Tavoid-d: #<vector @ #x~X>~%" (-> obj avoid-d))
(format #t "~1Twander: ~f~%" (-> obj wander))
(format #t "~1Tmax-speed: ~f~%" (-> obj max-speed))
(format #t "~1Tspeed: ~f~%" (-> obj speed))
(format #t "~1Thandle: ~D~%" (-> obj handle))
(label cfg-4)
obj
)
;; definition of type fish-manager
(deftype fish-manager (process-drawable)
((fishes fish 12 :inline :offset-assert 208)
)
:heap-base #x4d0
:method-count-assert 21
:size-assert #x550
:flag-assert #x1504d00550
(:methods
(idle () _type_ :state 20)
)
)
;; definition for method 3 of type fish-manager
(defmethod inspect fish-manager ((obj fish-manager))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 obj)
)
(format #t "~2Tfishes[12] @ #x~X~%" (-> obj fishes))
(label cfg-4)
obj
)
;; failed to figure out what this is:
(defstate idle (fish-manager)
:virtual #t
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
(format #t "training-manager received event ~s~%" event-type)
(format #t "event-from ~s~%" proc)
)
:code (the-as (function none :behavior fish-manager) sleep-code)
:post (behavior ()
(local-vars
(sv-448 (function vector vector float vector))
(sv-464 vector)
(sv-480 vector)
(sv-496 vector)
(sv-512 vector)
(sv-528 vector)
(sv-544 vector)
(sv-560 vector)
(sv-576 vector)
(sv-592 vector)
(sv-608 vector)
(sv-624 int)
(sv-640 int)
(sv-656 fish)
(sv-672 vector)
(sv-688 vector)
(sv-704 vector)
(sv-720 nav-poly)
)
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((gp-0 (-> self nav))
(s5-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info))
)
(dotimes (s4-0 12)
(let* ((s1-0 (-> self fishes s4-0))
(s2-0 (-> s1-0 pos))
(s3-0 (-> s1-0 vel))
)
(new 'stack-no-clear 'vector)
(new 'stack-no-clear 'vector)
(set! sv-544 (new 'stack-no-clear 'vector))
(new 'stack-no-clear 'vector)
(let ((s0-0 (new-stack-vector0)))
(set! (-> sv-544 quad) (-> s3-0 quad))
(set! sv-448 vector-rotate-around-y!)
(set! sv-464 sv-544)
(set! sv-480 sv-544)
(let ((a2-0 (rand-vu-float-range 0.0 65536.0)))
(sv-448 sv-464 sv-480 a2-0)
)
(vector-float*! sv-544 sv-544 0.5)
(cond
((and *target* (< (-> (target-pos 0) y) 0.0))
(set! sv-512 (new 'stack-no-clear 'vector))
(set! sv-496 s2-0)
(let ((v0-4 (target-pos 0)))
(.lvf vf4 (&-> sv-496 quad))
(.lvf vf5 (&-> v0-4 quad))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.sub.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> sv-512 quad) vf6)
(let* ((v1-21 sv-512)
(f0-5 (+ (* (-> v1-21 x) (-> v1-21 x)) (* (-> v1-21 z) (-> v1-21 z))))
(f1-4 16384.0)
)
(cond
((< f0-5 (* f1-4 f1-4))
(set! (-> s1-0 max-speed) 40960.0)
(vector-normalize! sv-512 (* 4096.0 (/ 4096.0 f0-5)))
(let ((a0-9 (-> s1-0 avoid-d)))
(let ((v1-28 (-> s1-0 avoid-d)))
(let ((a1-6 100000.0))
(.mov vf7 a1-6)
)
(.lvf vf5 (&-> sv-512 quad))
(.lvf vf4 (&-> v1-28 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-9 quad) vf6)
)
#t
)
((let ((f1-9 81920.0))
(< f0-5 (* f1-9 f1-9))
)
(set! (-> s1-0 max-speed) 16384.0)
)
(else
(set! (-> s1-0 max-speed) 4096.0)
)
)
)
)
(else
(set! (-> s1-0 max-speed) 4096.0)
)
)
(set! sv-528 (new 'stack-no-clear 'vector))
(let ((v1-39 s2-0))
(let ((a0-10 sv-544))
(let ((a1-9 -0.1))
(.mov vf7 a1-9)
)
(.lvf vf5 (&-> a0-10 quad))
)
(.lvf vf4 (&-> v1-39 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> sv-528 quad) vf6)
(let ((v1-41 gp-0)
(a0-11 sv-528)
(a1-10 (new 'stack-no-clear 'nav-find-poly-parms))
)
(vector-! (-> a1-10 point) a0-11 (-> v1-41 state mesh bounds))
(set! (-> a1-10 y-threshold) (-> v1-41 nearest-y-threshold))
(set! (-> a1-10 ignore) (the-as uint 2))
(set! sv-720 (find-poly-containing-point-local (-> v1-41 state mesh) a1-10))
)
(new 'stack-no-clear 'vector)
(when sv-720
(let ((a0-14 gp-0)
(t9-7 (method-of-type nav-control clamp-vector-to-mesh-no-gaps))
(a2-3 sv-720)
(t0-0 s5-0)
)
(t9-7 a0-14 sv-528 a2-3 sv-544 t0-0)
)
(cond
((-> s5-0 found-boundary)
(let ((a1-12 (-> s1-0 border-f)))
(let ((v1-48 (-> s1-0 border-f)))
(let ((a0-15 (-> s5-0 boundary-normal)))
(let ((a2-5 -10000.0))
(.mov vf7 a2-5)
)
(.lvf vf5 (&-> a0-15 quad))
)
(.lvf vf4 (&-> v1-48 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a1-12 quad) vf6)
)
)
(else
(set! sv-608 (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0))
(let ((a1-14 sv-608))
(let ((v1-49 s2-0))
(let ((a0-17 sv-608))
(let ((a2-8 4096.0))
(.mov vf7 a2-8)
)
(.lvf vf5 (&-> a0-17 quad))
)
(.lvf vf4 (&-> v1-49 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a1-14 quad) vf6)
)
(set! sv-592 sv-608)
(set! sv-560 sv-608)
(set! sv-576 (new 'stack-no-clear 'vector))
(set! (-> sv-576 x) (cos (-> s1-0 wander)))
(set! (-> sv-576 y) 0.0)
(set! (-> sv-576 z) (sin (-> s1-0 wander)))
(set! (-> sv-576 w) 1.0)
(let ((v1-59 3276.8))
(.mov vf7 v1-59)
)
(.lvf vf5 (&-> sv-576 quad))
(.lvf vf4 (&-> sv-560 quad))
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> sv-592 quad) vf6)
(vector-! sv-608 sv-608 s2-0)
(let ((a0-21 s0-0))
(let ((v1-64 s0-0))
(let ((a1-18 10.0))
(.mov vf7 a1-18)
)
(.lvf vf5 (&-> sv-608 quad))
(.lvf vf4 (&-> v1-64 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-21 quad) vf6)
)
(+! (-> s1-0 wander) (rand-vu-float-range -1820.4445 1820.4445))
)
)
)
(set! sv-624 0)
(set! sv-688 (new 'stack-no-clear 'vector))
(set! (-> sv-688 quad) (the-as uint128 0))
(set! sv-704 (new 'stack-no-clear 'vector))
(set! (-> sv-704 quad) (the-as uint128 0))
(set! sv-640 0)
(while (< sv-640 12)
(when (!= sv-640 s4-0)
(set! sv-656 (-> self fishes sv-640))
(set! sv-672 (new 'stack-no-clear 'vector))
(let ((v1-78 s2-0)
(a0-25 (-> sv-656 pos))
)
(.lvf vf4 (&-> v1-78 quad))
(.lvf vf5 (&-> a0-25 quad))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.sub.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> sv-672 quad) vf6)
(let* ((v1-80 sv-672)
(f0-29 (+ (* (-> v1-80 x) (-> v1-80 x)) (* (-> v1-80 z) (-> v1-80 z))))
(f1-15 4096.0)
)
(when (< f0-29 (* f1-15 f1-15))
(vector-normalize! sv-672 (* 4096.0 (/ 4096.0 f0-29)))
(let ((a0-27 s0-0))
(let ((v1-87 s0-0))
(let ((a1-24 100.0))
(.mov vf7 a1-24)
)
(.lvf vf5 (&-> sv-672 quad))
(.lvf vf4 (&-> v1-87 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-27 quad) vf6)
)
(vector+! sv-688 sv-688 (-> sv-656 pos))
(vector+! sv-704 sv-704 (-> sv-656 vel))
(set! sv-624 (+ sv-624 1))
sv-624
)
)
)
(set! sv-640 (+ sv-640 1))
)
(when (nonzero? sv-624)
(vector-float*! sv-688 sv-688 (/ 1.0 (the float sv-624)))
(vector-! sv-688 sv-688 s2-0)
(let ((t9-13 vector-normalize!)
(a0-35 sv-688)
(f0-35 4096.0)
(f1-21 4096.0)
(v1-104 sv-688)
)
(t9-13 a0-35 (* f0-35 (/ f1-21 (+ (* (-> v1-104 x) (-> v1-104 x)) (* (-> v1-104 z) (-> v1-104 z))))))
)
(let ((a0-36 s0-0))
(let ((v1-106 s0-0))
(let ((a1-36 100.0))
(.mov vf7 a1-36)
)
(.lvf vf5 (&-> sv-688 quad))
(.lvf vf4 (&-> v1-106 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-36 quad) vf6)
)
(vector-float*! sv-704 sv-704 (/ 1.0 (the float sv-624)))
(vector-! sv-704 sv-704 s3-0)
(let ((a0-39 s0-0))
(let ((v1-110 s0-0))
(let ((a1-43 5.0))
(.mov vf7 a1-43)
)
(.lvf vf5 (&-> sv-704 quad))
(.lvf vf4 (&-> v1-110 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-39 quad) vf6)
)
)
(vector-float*! (-> s1-0 avoid-d) (-> s1-0 avoid-d) 0.95)
(vector-float*! (-> s1-0 border-f) (-> s1-0 border-f) 0.99)
(vector+! s0-0 s0-0 (-> s1-0 border-f))
(vector+! s0-0 s0-0 (-> s1-0 avoid-d))
(set! (-> s0-0 y) 0.0)
(let ((a0-44 s3-0))
(let ((v1-117 s3-0))
(let ((a1-52 (-> self clock seconds-per-frame)))
(.mov vf7 a1-52)
)
(.lvf vf5 (&-> s0-0 quad))
(.lvf vf4 (&-> v1-117 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-44 quad) vf6)
)
)
(vector-float*! s3-0 s3-0 0.8)
(let ((a1-54 s2-0))
(let ((v1-120 s2-0))
(let ((a0-46 s3-0))
(let ((a2-10 (-> self clock seconds-per-frame)))
(.mov vf7 a2-10)
)
(.lvf vf5 (&-> a0-46 quad))
)
(.lvf vf4 (&-> v1-120 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a1-54 quad) vf6)
)
(cloest-point-on-mesh (-> self nav) s2-0 s2-0 sv-720)
(set! (-> s2-0 y) -1638.4)
(let ((v1-124 (handle->process (-> s1-0 handle))))
(when v1-124
(set! (-> (the-as process-drawable v1-124) root trans quad) (-> s2-0 quad))
(forward-up->quaternion
(-> (the-as process-drawable v1-124) root quat)
(vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0)
*up-vector*
)
)
)
)
)
)
(none)
)
)
)
;; definition for method 11 of type fish-manager
;; INFO: Used lq/sq
;; WARN: Return type mismatch object vs none.
(defmethod init-from-entity! fish-manager ((obj fish-manager) (arg0 entity-actor))
(let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player))))
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s4-0 reaction) cshape-reaction-default)
(set! (-> s4-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(let ((v1-6 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
(set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 9216.0)
(set! (-> s4-0 total-prims) (the-as uint 1))
(set! (-> s4-0 root-prim) v1-6)
)
(set! (-> s4-0 nav-radius) 4096.0)
(let ((v1-8 (-> s4-0 root-prim)))
(set! (-> s4-0 backup-collide-as) (-> v1-8 prim-core collide-as))
(set! (-> s4-0 backup-collide-with) (-> v1-8 prim-core collide-with))
)
(set! (-> obj root) s4-0)
)
(process-drawable-from-entity! obj arg0)
(get-nav-control obj (the-as nav-mesh #f))
(let ((s5-1 (rand-vu-int-count 4)))
(dotimes (s4-1 12)
(let ((s3-0 (-> obj fishes s4-1)))
(let ((f30-1 (* 182.04445 (the float (rand-vu-int-count 360)))))
(set! (-> s3-0 pos quad) (-> obj root trans quad))
(+! (-> s3-0 pos x) (rand-vu-float-range 409.6 4096.0))
(+! (-> s3-0 pos z) (rand-vu-float-range 409.6 4096.0))
(set! (-> s3-0 wander) (rand-vu-float-range 0.0 65536.0))
(set-vector! (-> s3-0 vel) (cos f30-1) 0.0 (sin f30-1) 1.0)
)
(set! (-> s3-0 border-f quad) (the-as uint128 0))
(set! (-> s3-0 avoid-d quad) (the-as uint128 0))
(set! (-> s3-0 max-speed) 16384.0)
(set! (-> s3-0 handle) (ppointer->handle (process-spawn minnow obj s5-1 :to obj)))
)
)
)
(go (method-of-object obj idle))
(none)
)
+533
View File
@@ -0,0 +1,533 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type wren
(deftype wren (process-drawable)
((move-dest vector :inline :offset-assert 208)
(fly-curve curve-control 2 :offset-assert 224)
(fly-index uint32 :offset-assert 232)
(fly-speed float :offset-assert 236)
(fly-y-rate float :offset-assert 240)
(fly-interp float :offset-assert 244)
(path-u float :offset-assert 248)
(path-du float :offset-assert 252)
(path-du-mod float :offset-assert 256)
(bob-level float :offset-assert 260)
(bob-level-seek float :offset-assert 264)
(bank-angle float :offset-assert 268)
(peck-timer uint64 :offset-assert 272)
(flags uint16 :offset-assert 280)
)
:heap-base #xa0
:method-count-assert 28
:size-assert #x11a
:flag-assert #x1c00a0011a
(:methods
(hunt () _type_ :state 20)
(peck () _type_ :state 21)
(fly () _type_ :state 22)
(land () _type_ :state 23)
(on-branch () _type_ :state 24)
(die () _type_ :state 25)
(spooked? (_type_) symbol 26)
(debug-draw-path (_type_) symbol 27)
)
)
;; definition for method 3 of type wren
(defmethod inspect wren ((obj wren))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 obj)
)
(format #t "~2Tmove-dest: #<vector @ #x~X>~%" (-> obj move-dest))
(format #t "~2Tfly-curve[2] @ #x~X~%" (-> obj fly-curve))
(format #t "~2Tfly-index: ~D~%" (-> obj fly-index))
(format #t "~2Tfly-speed: ~f~%" (-> obj fly-speed))
(format #t "~2Tfly-y-rate: ~f~%" (-> obj fly-y-rate))
(format #t "~2Tfly-interp: ~f~%" (-> obj fly-interp))
(format #t "~2Tpath-u: ~f~%" (-> obj path-u))
(format #t "~2Tpath-du: ~f~%" (-> obj path-du))
(format #t "~2Tpath-du-mod: ~f~%" (-> obj path-du-mod))
(format #t "~2Tbob-level: ~f~%" (-> obj bob-level))
(format #t "~2Tbob-level-seek: ~f~%" (-> obj bob-level-seek))
(format #t "~2Tbank-angle: ~f~%" (-> obj bank-angle))
(format #t "~2Tpeck-timer: ~D~%" (-> obj peck-timer))
(format #t "~2Tflags: ~D~%" (-> obj flags))
(label cfg-4)
obj
)
;; failed to figure out what this is:
(defskelgroup skel-wren wren wren-lod0-jg wren-idle-ja
((wren-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 4)
)
;; definition for method 27 of type wren
(defmethod debug-draw-path wren ((obj wren))
"Draws the associated [[curve-control]]s associated with this wren"
(dotimes (s5-0 2)
(if (-> obj fly-curve s5-0)
(debug-draw (-> obj fly-curve s5-0))
)
)
#f
)
;; definition for function fly-post
(defbehavior fly-post wren ()
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
)
(init-vf0-vector)
(seek! (-> self bob-level) (-> self bob-level-seek) (* 12288.0 (-> self clock seconds-per-frame)))
(let ((gp-0 (-> self fly-curve (-> self fly-index))))
(get-point-at-percent-along-path! gp-0 (-> self root trans) (-> self path-u) 'interp)
(seek! (-> self path-u) 1.0 (* (-> self path-du) (-> self path-du-mod) (-> self clock seconds-per-frame)))
(seek! (-> self path-du) 0.2 (* 0.1 (-> self clock seconds-per-frame)))
(let* ((f30-0 (-> self path-u))
(f0-16 (fmin 1.0 (+ 0.125 f30-0)))
(s4-0 (displacement-between-points-at-percent-normalized! gp-0 (new 'stack-no-clear 'vector) f0-16))
(s3-0 (displacement-between-points-at-percent-normalized! gp-0 (new 'stack-no-clear 'vector) f30-0))
(gp-1 (-> self root quat))
)
(forward-up->quaternion gp-1 s4-0 *up-vector*)
(set! (-> self fly-y-rate) (tan (vector-x-angle s4-0)))
(let ((s5-1 (new 'stack-no-clear 'vector)))
(let ((v1-16 s3-0)
(a0-9 s4-0)
)
(.lvf vf1 (&-> v1-16 quad))
(.lvf vf2 (&-> a0-9 quad))
)
(.add.x.vf vf1 vf0 vf0 :mask #b10)
(.add.x.vf vf2 vf0 vf0 :mask #b10)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.svf (&-> s5-1 quad) vf3)
(let* ((f0-19 (acos (vector-dot s3-0 s4-0)))
(f1-8 (if (< 0.0 (vector-dot s5-1 *up-vector*))
(- f0-19)
f0-19
)
)
)
(if (and (-> self next-state) (= (-> self next-state name) 'fly))
(seek! (-> self bank-angle) f1-8 (* f0-19 (-> self clock seconds-per-frame)))
(seek! (-> self bank-angle) 0.0 (* 8192.0 (-> self clock seconds-per-frame)))
)
)
)
(quaternion-rotate-local-z! gp-1 gp-1 (-> self bank-angle))
)
)
0
(debug-draw-path self)
(+! (-> self root trans y) (-> self bob-level))
(ja-post)
(none)
)
)
;; definition for method 26 of type wren
;; WARN: Return type mismatch object vs symbol.
(defmethod spooked? wren ((obj wren))
"@returns a [[symbol]] indicating if Jak is considered close enough to the wren to spook it.
If so, it transitions from [[wren::peck]] to [[wren::hunt]]"
(let* ((gp-0 *target*)
(a0-2 (if (type? gp-0 process-focusable)
gp-0
)
)
)
(the-as symbol (and a0-2 (< (vector-vector-xz-distance (-> obj root trans) (get-trans a0-2 0)) 102400.0)))
)
)
;; failed to figure out what this is:
(defstate hunt (wren)
:virtual #t
:trans (behavior ()
(when (< (vector-vector-xz-distance (-> self root trans) (-> self move-dest)) 2048.0)
(cond
((logtest? (-> self flags) 4)
(set! (-> self flags) (logand -5 (-> self flags)))
(set! (-> self fly-index) (the-as uint 0))
(go-virtual fly)
)
(else
(go-virtual peck)
)
)
)
(none)
)
:code (behavior ()
(until #f
(ja-no-eval :group! wren-hop-ja
:num! (seek! (the float (+ (-> (the-as art-joint-anim wren-hop-ja) frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
#f
(none)
)
:post (behavior ()
(local-vars (at-0 int))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans))))
(vector-normalize! gp-1 12288.0)
(let ((v1-1 (new 'stack-no-clear 'vector)))
(.lvf vf1 (&-> gp-1 quad))
(let ((f0-0 (-> self clock seconds-per-frame)))
(.mov at-0 f0-0)
)
(.mov vf2 at-0)
(.mov.vf vf1 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-1 quad) vf1)
(vector+! (-> self root trans) (-> self root trans) v1-1)
)
)
(ja-post)
(none)
)
)
)
;; failed to figure out what this is:
(defstate peck (wren)
:virtual #t
:enter (behavior ()
(set! (-> self state-time) (-> self clock frame-counter))
(set! (-> self peck-timer) (the-as uint (the int (* 300.0 (rand-vu-float-range 1.4 4.3)))))
(set! (-> self flags) (logand -7 (-> self flags)))
(none)
)
:trans (behavior ()
(when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self peck-timer)))
(let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans))))
(if (< (fabs (deg-diff (quaternion-y-angle (-> self root quat)) (vector-y-angle gp-1))) 728.1778)
(go-virtual hunt)
)
)
)
(when (logtest? (-> self flags) 2)
(set! (-> self flags) (logand -3 (-> self flags)))
(when (spooked? self)
(get-point-in-path! (-> self fly-curve 0) (-> self move-dest) 0.0 'interp)
(set-yaw-angle-clear-roll-pitch!
(-> self root)
(vector-y-angle (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans)))
)
(logior! (-> self flags) 4)
(go-virtual hunt)
)
)
(none)
)
:code (behavior ()
(local-vars (v1-34 symbol))
(until #f
(set! (-> self flags) (logand -2 (-> self flags)))
(let ((f0-0 (rand-vu-float-range 0.0 (get-num-segments (-> self path)))))
(get-point-in-path! (-> self path) (-> self move-dest) f0-0 'interp)
)
(logior! (-> self flags) 2)
(ja-no-eval :group! wren-peck-ja
:num! (seek! (the float (+ (-> (the-as art-joint-anim wren-peck-ja) frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
#t
(let ((v1-33 (the-as symbol (logand (-> self flags) 2))))
(set! v1-33 v1-33)
(cmove-#f-zero v1-34 v1-33 v1-33)
)
(let ((gp-1 (-> self clock frame-counter))
(s5-1 (the int (* 300.0 (rand-vu-float-range 0.1 0.6))))
(f30-1 1.0)
)
(ja-no-eval :group! wren-idle-ja :num! (loop! f30-1) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-1) s5-1)
(suspend)
(ja :num! (loop! f30-1))
)
)
(logior! (-> self flags) 1)
(let ((gp-2 (-> self clock frame-counter))
(s5-2 (the int (* 300.0 (rand-vu-float-range 0.2 1.5))))
(f30-3 1.0)
)
(ja-no-eval :group! wren-idle-ja :num! (loop! f30-3) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-2) s5-2)
(suspend)
(ja :num! (loop! f30-3))
)
)
)
#f
(none)
)
:post (behavior ()
(if (logtest? (-> self flags) 1)
(seek-to-point-toward-point! (-> self root) (-> self move-dest) 262144.0 (seconds 0.02))
)
(ja-post)
(none)
)
)
;; failed to figure out what this is:
(defstate fly (wren)
:virtual #t
:enter (behavior ()
(set! (-> self path-u) 0.0)
(set! (-> self path-du) 0.0)
(set! (-> self path-du-mod) 1.0)
(set! (-> self fly-speed) 0.0)
(set! (-> self fly-interp) 0.0)
(set! (-> self bob-level) 0.0)
(set! (-> self bob-level-seek) 0.0)
(none)
)
:trans (behavior ()
(when (< 0.99 (-> self path-u))
(if (-> self fly-curve (logand (+ (-> self fly-index) 1) 1))
(go-virtual land)
(go-virtual die)
)
)
(none)
)
:code (behavior ()
(let ((gp-0 (-> self clock frame-counter))
(s5-0 240)
(f30-0 2.0)
)
(ja-no-eval :group! wren-takeoff-ja :num! (loop! f30-0) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-0) s5-0)
(suspend)
(ja :num! (loop! f30-0))
)
)
(ja-channel-push! 2 (seconds 0.3))
(ja-no-eval :group! wren-glide-ja
:num! (seek! (the float (+ (-> (the-as art-joint-anim wren-glide-ja) frames num-frames) -1)))
:frame-num 0.0
)
(let ((a0-4 (-> self skel root-channel 1)))
(let ((f0-5 0.0))
(set! (-> a0-4 frame-interp 1) f0-5)
(set! (-> a0-4 frame-interp 0) f0-5)
)
(set! (-> a0-4 frame-group) (the-as art-joint-anim wren-fly-ja))
(set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim wren-fly-ja) frames num-frames) -1)))
(set! (-> a0-4 param 1) 1.0)
(set! (-> a0-4 frame-num) 0.0)
(joint-control-channel-group! a0-4 (the-as art-joint-anim wren-fly-ja) num-func-seek!)
)
(until #f
(let ((f0-11 (fmax -0.2 (fmin 0.5 (-> self fly-y-rate)))))
(seek! (-> self fly-interp) (lerp-scale 0.0 1.0 f0-11 -0.2 0.5) (-> self clock seconds-per-frame))
)
(let ((f30-1 (-> self fly-interp)))
(seek! (-> self path-du-mod) (+ 0.9 (* 0.2 f30-1)) (* 0.5 (-> self clock seconds-per-frame)))
(set! (-> self bob-level-seek) (+ -12288.0 (* 24576.0 f30-1)))
(let ((v1-59 (-> self skel root-channel 0)))
(let ((f0-23 (- 1.0 f30-1)))
(set! (-> v1-59 frame-interp 1) f0-23)
(set! (-> v1-59 frame-interp 0) f0-23)
)
(set! (-> v1-59 frame-group) (the-as art-joint-anim wren-glide-ja))
)
(let ((v1-62 (-> self skel root-channel 1)))
(set! (-> v1-62 frame-interp 1) f30-1)
(set! (-> v1-62 frame-interp 0) f30-1)
(set! (-> v1-62 frame-group) (the-as art-joint-anim wren-fly-ja))
)
(let ((f30-2 (lerp 0.6 2.4 f30-1)))
(ja :num! (loop! f30-2))
(ja :chan 1 :num! (loop! f30-2))
)
)
(suspend)
)
#f
(none)
)
:post fly-post
)
;; failed to figure out what this is:
(defstate land (wren)
:virtual #t
:code (behavior ()
(set! (-> self bob-level-seek) 0.0)
(ja-channel-push! 1 (seconds 0.3))
(while (!= (-> self path-u) 1.0)
(ja-no-eval :group! wren-land-ja
:num! (seek! (the float (+ (-> (the-as art-joint-anim wren-land-ja) frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
(go-virtual on-branch)
(none)
)
:post (behavior ()
(seek! (-> self path-du-mod) 0.0 (* 0.5 (-> self clock seconds-per-frame)))
(fly-post)
(none)
)
)
;; failed to figure out what this is:
(defstate on-branch (wren)
:virtual #t
:enter (behavior ()
(let ((v1-6 (displacement-between-points-at-percent-normalized!
(-> self fly-curve (logand (+ (-> self fly-index) 1) 1))
(new 'stack-no-clear 'vector)
0.1
)
)
)
(vector+! (-> self move-dest) (-> self root trans) v1-6)
)
(none)
)
:trans (behavior ()
(let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self move-dest) (-> self root trans))))
(when (< (fabs (deg-diff (quaternion-y-angle (-> self root quat)) (vector-y-angle gp-1))) 728.1778)
(when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self peck-timer)))
(set! (-> self fly-index) (logand (+ (-> self fly-index) 1) 1))
(go-virtual fly)
)
)
)
(none)
)
:code (behavior ()
(set! (-> self flags) (logand -2 (-> self flags)))
(ja-channel-push! 1 (seconds 0.2))
(let ((gp-0 (-> self clock frame-counter))
(s5-0 (the int (* 300.0 (rand-vu-float-range 4.2 16.8))))
(f30-1 1.0)
)
(ja-no-eval :group! wren-idle-ja :num! (loop! f30-1) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-0) s5-0)
(suspend)
(ja :num! (loop! f30-1))
)
)
(logior! (-> self flags) 1)
(let ((gp-1 (-> self clock frame-counter))
(s5-1 600)
(f30-2 1.0)
)
(ja-no-eval :group! wren-idle-ja :num! (loop! f30-2) :frame-num 0.0)
(until (>= (- (-> self clock frame-counter) gp-1) s5-1)
(suspend)
(ja :num! (loop! f30-2))
)
)
(none)
)
:post (behavior ()
(if (logtest? (-> self flags) 1)
(seek-to-point-toward-point! (-> self root) (-> self move-dest) 262144.0 (seconds 0.02))
)
(debug-draw-path self)
(ja-post)
(none)
)
)
;; failed to figure out what this is:
(defstate die (wren)
:virtual #t
:code (behavior ()
(cleanup-for-death self)
(suspend)
0
(none)
)
)
;; definition for method 7 of type wren
;; WARN: Return type mismatch process-drawable vs wren.
(defmethod relocate wren ((obj wren) (arg0 int))
(dotimes (v1-0 2)
(when (-> obj fly-curve v1-0)
(if (nonzero? (-> obj fly-curve v1-0))
(&+! (-> obj fly-curve v1-0) arg0)
)
)
)
(the-as wren ((the-as (function process-drawable int process-drawable) (find-parent-method wren 7)) obj arg0))
)
;; definition for method 11 of type wren
;; WARN: Return type mismatch object vs none.
(defmethod init-from-entity! wren ((obj wren) (arg0 entity-actor))
(set! (-> obj root) (new 'process 'trsqv))
(process-drawable-from-entity! obj arg0)
(initialize-skeleton
obj
(the-as skeleton-group (art-group-get-by-name *level* "skel-wren" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(logclear! (-> obj mask) (process-mask actor-pause))
(let ((f0-0 (rand-vu-float-range 1.5 3.5)))
(set-vector! (-> obj root scale) f0-0 f0-0 f0-0 1.0)
)
(set! (-> obj fly-index) (the-as uint 0))
(set! (-> obj path-u) 0.0)
(set! (-> obj flags) (the-as uint 0))
(set! (-> obj bob-level) 0.0)
(set! (-> obj bank-angle) 0.0)
(set! (-> obj path) (new 'process 'path-control obj 'idle 0.0 arg0 #f))
(logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text))
(cond
((logtest? (-> obj path flags) (path-control-flag not-found))
(dotimes (s5-1 2)
(set! (-> obj fly-curve s5-1) (new 'process 'curve-control obj 'path (the float s5-1)))
(logior! (-> obj fly-curve s5-1 flags) (path-control-flag display draw-line draw-point draw-text))
)
(setup-masks (-> obj draw) 0 -1)
(setup-masks (-> obj draw) 8 0)
(go (method-of-object obj fly))
)
(else
(set! (-> obj fly-curve 0) (new 'process 'curve-control obj 'takeoff -1000000000.0))
(logior! (-> obj fly-curve 0 flags) (path-control-flag display draw-line draw-point draw-text))
(set! (-> obj fly-curve 1) #f)
(setup-masks (-> obj draw) 0 -1)
(setup-masks (-> obj draw) 2 0)
(go (method-of-object obj peck))
)
)
(none)
)