jak-project/goal_src/jak2/levels/tomb/widow-baron.gc

1123 lines
43 KiB
Common Lisp
Raw Normal View History

;;-*-Lisp-*-
(in-package goal)
;; name: widow-baron.gc
;; name in dgo: widow-baron
;; dgos: TOA
(declare-type baron-pod process-drawable)
(declare-type tomb-boss-pillar process-drawable)
;; DECOMP BEGINS
(deftype widow-float-seeker (structure)
((target float :offset-assert 0)
(value float :offset-assert 4)
(vel float :offset-assert 8)
(accel float :offset-assert 12)
(max-vel float :offset-assert 16)
(max-partial float :offset-assert 20)
(bounce-high float :offset-assert 24)
)
:allow-misaligned
:method-count-assert 13
:size-assert #x1c
:flag-assert #xd0000001c
(:methods
(widow-float-seeker-method-9 (_type_ float float float float float) none 9)
(widow-float-seeker-method-10 (_type_ (pointer float)) none 10)
(widow-float-seeker-method-11 (_type_ float) none 11)
(widow-float-seeker-method-12 (_type_ float) none 12)
)
)
(defmethod widow-float-seeker-method-9 widow-float-seeker ((obj widow-float-seeker) (arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
(set! (-> obj target) arg0)
(set! (-> obj value) arg0)
(set! (-> obj vel) 0.0)
(set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3)
(set! (-> obj bounce-high) arg4)
0
(none)
)
(defmethod widow-float-seeker-method-10 widow-float-seeker ((obj widow-float-seeker) (arg0 (pointer float)))
(set! (-> obj target) (-> arg0 0))
(set! (-> obj value) (-> arg0 1))
(set! (-> obj vel) (-> arg0 2))
(set! (-> obj accel) (-> arg0 3))
(set! (-> obj max-vel) (-> arg0 4))
(set! (-> obj max-partial) (-> arg0 5))
(set! (-> obj bounce-high) (-> arg0 6))
0
(none)
)
(defmethod widow-float-seeker-method-11 widow-float-seeker ((obj widow-float-seeker) (arg0 float))
(with-pp
0.0
0.0
(let* ((f1-2 (- (+ (-> obj target) arg0) (-> obj value)))
(f0-6 (if (= (-> obj target) 0.0)
(* (-> obj max-partial) (fabs f1-2))
(-> obj max-vel)
)
)
)
(let ((f1-3 (* f1-2 (* (-> obj accel) (-> pp clock time-adjust-ratio)))))
(+! (-> obj vel) f1-3)
)
(let ((f1-6 (fabs (-> obj vel)))
(f0-7 (fmin f0-6 (-> obj max-vel)))
)
(if (< f0-7 f1-6)
(set! (-> obj vel) (* (-> obj vel) (/ f0-7 f1-6)))
)
)
)
(let ((f0-11 (* (-> obj vel) (-> pp clock time-adjust-ratio))))
(+! (-> obj value) f0-11)
)
(when (and (!= (-> obj target) 0.0) (>= (-> obj value) (-> obj target)) (< 0.0 (-> obj vel)))
(set! (-> obj value) (-> obj target))
(set! (-> obj vel) (* (-> obj vel) (- (-> obj bounce-high))))
)
0
(none)
)
)
(defmethod widow-float-seeker-method-12 widow-float-seeker ((obj widow-float-seeker) (arg0 float))
(set! (-> obj value) (+ (-> obj target) arg0))
(set! (-> obj vel) 0.0)
0
(none)
)
(deftype widow-rand-vector (structure)
((min-time int32 :offset-assert 0)
(max-time int32 :offset-assert 4)
(xz-max float :offset-assert 8)
(y-max float :offset-assert 12)
(timer int32 :offset-assert 16)
(value vector :inline :offset-assert 32)
)
:method-count-assert 11
:size-assert #x30
:flag-assert #xb00000030
(:methods
(init (_type_ int int float float) none 9)
(widow-rand-vector-method-10 (_type_) none 10)
)
)
(defmethod init widow-rand-vector ((obj widow-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float))
(set! (-> obj min-time) arg0)
(set! (-> obj max-time) arg1)
(set! (-> obj xz-max) (* 0.5 arg2))
(set! (-> obj y-max) (* 0.5 arg3))
(set! (-> obj timer) 0)
(vector-reset! (-> obj value))
0
(none)
)
(defmethod widow-rand-vector-method-10 widow-rand-vector ((obj widow-rand-vector))
(with-pp
(set! (-> obj timer)
(- (the-as time-frame (-> obj timer)) (- (current-time) (-> pp clock old-frame-counter)))
)
(when (<= (-> obj timer) 0)
(set! (-> obj timer) (rand-vu-int-range (-> obj min-time) (-> obj max-time)))
(set! (-> obj value x) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max)))
(set! (-> obj value y) (rand-vu-float-range (- (-> obj y-max)) (-> obj y-max)))
(set! (-> obj value z) (rand-vu-float-range (- (-> obj xz-max)) (-> obj xz-max)))
)
0
(none)
)
)
(deftype widow-oscillator (structure)
((target vector :inline :offset-assert 0)
(value vector :inline :offset-assert 16)
(vel vector :inline :offset-assert 32)
(accel float :offset-assert 48)
(max-vel float :offset-assert 52)
(damping float :offset-assert 56)
)
:method-count-assert 11
:size-assert #x3c
:flag-assert #xb0000003c
(:methods
(widow-oscillator-method-9 (_type_ vector float float float) none 9)
(widow-oscillator-method-10 (_type_ vector) none 10)
)
)
(defmethod widow-oscillator-method-9 widow-oscillator ((obj widow-oscillator) (arg0 vector) (arg1 float) (arg2 float) (arg3 float))
(cond
(arg0
(set! (-> obj target quad) (-> arg0 quad))
(set! (-> obj value quad) (-> arg0 quad))
)
(else
(vector-reset! (-> obj target))
(vector-reset! (-> obj value))
)
)
(vector-reset! (-> obj vel))
(set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2)
(set! (-> obj damping) arg3)
0
(none)
)
(defmethod widow-oscillator-method-10 widow-oscillator ((obj widow-oscillator) (arg0 vector))
(with-pp
(let ((gp-0 (new 'stack-no-clear 'vector)))
(let ((f30-0 (fmax (-> obj max-vel) (vector-length (-> obj vel)))))
(cond
(arg0
(vector+! gp-0 (-> obj target) arg0)
(vector-! gp-0 gp-0 (-> obj value))
)
(else
(vector-! gp-0 (-> obj target) (-> obj value))
)
)
(vector-normalize! gp-0 (* (-> obj accel) (-> pp clock time-adjust-ratio)))
(vector+! (-> obj vel) (-> obj vel) gp-0)
(let ((f0-3 (vector-length (-> obj vel))))
(if (< f30-0 f0-3)
(vector-float*! (-> obj vel) (-> obj vel) (/ f30-0 f0-3))
)
)
)
(vector-float*! (-> obj vel) (-> obj vel) (-> obj damping))
(vector-float*! gp-0 (-> obj vel) (-> pp clock time-adjust-ratio))
(vector+! (-> obj value) (-> obj value) gp-0)
)
0
(none)
)
)
(defskelgroup skel-widow widow widow-lod0-jg widow-drill-ja
((widow-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 12)
:shadow widow-shadow-mg
:origin-joint-index 3
)
(deftype widow-shot (guard-shot)
()
:heap-base #x170
:method-count-assert 40
:size-assert #x1f0
:flag-assert #x28017001f0
)
(deftype widow (process-drawable)
((bomb handle 8 :offset-assert 200)
(next-launch int32 :offset-assert 264)
(launch-dest vector :inline :offset-assert 272)
(next-jumper int32 :offset-assert 288)
(ammos handle 2 :offset-assert 296)
(ammo-timers time-frame 2 :offset-assert 312)
(bomb-hits int32 :offset-assert 328)
(circle-center vector :inline :offset-assert 336)
(theta cam-float-seeker :inline :offset-assert 352)
(traj trajectory :inline :offset-assert 384)
(osc widow-oscillator :inline :offset-assert 432)
(noise-osc widow-oscillator :inline :offset-assert 496)
(rand-vec widow-rand-vector :inline :offset-assert 560)
(attack-from-high-deg symbol :offset-assert 608)
(which-gun int32 :offset-assert 612)
(which-pod int32 :offset-assert 616)
(left-cover-angle widow-float-seeker :inline :offset 620)
(right-cover-angle widow-float-seeker :inline :offset 648)
(left-cover-jm joint-mod :offset-assert 676)
(right-cover-jm joint-mod :offset-assert 680)
(drill-speed cam-float-seeker :inline :offset-assert 684)
(drill-angle float :offset-assert 708)
(left-drill-jm joint-mod :offset-assert 712)
(right-drill-jm joint-mod :offset-assert 716)
(flying symbol :offset-assert 720)
(previous-anim int32 :offset-assert 724)
(launched-a-bomb symbol :offset-assert 728)
(old-bomb-hits int32 :offset-assert 732)
(catwalk handle 8 :offset-assert 736)
(heart handle :offset-assert 800)
(pod handle :offset-assert 808)
(baron (pointer manipy) :offset-assert 816)
(drill-spark-part sparticle-launch-control :offset-assert 820)
(drill-spark-part-alt sparticle-launch-control :offset-assert 824)
(extract-stone-time time-frame :offset-assert 832)
(extract-stone-part sparticle-launch-control :offset-assert 840)
(insert-stone-time time-frame :offset-assert 848)
(insert-stone-part sparticle-launch-control :offset-assert 856)
(land-part sparticle-launch-control :offset-assert 860)
(green-charge-part sparticle-launch-control :offset-assert 864)
(green-fire-part sparticle-launch-control :offset-assert 868)
(lightning lightning-control 5 :offset-assert 872)
(stop-catwalk-sound symbol :offset-assert 892)
(catwalk-sound sound-id :offset-assert 896)
(drill-sound sound-id :offset-assert 900)
(drill-sound-playing symbol :offset-assert 904)
(drill-sweeten-sound sound-id :offset-assert 908)
(drill-sweeten-sound-playing symbol :offset-assert 912)
(movie-handle handle :offset-assert 920)
(tilt cam-float-seeker :inline :offset-assert 928)
(targetted-catwalk int32 :offset-assert 952)
(hover-sound sound-id :offset-assert 956)
(hover-sound-playing symbol :offset-assert 960)
(shake-sound sound-id :offset-assert 964)
(shake-sound-playing symbol :offset-assert 968)
(hud handle :offset-assert 976)
(last-want-stone-talker int8 :offset-assert 984)
(last-general-flying-talker int8 :offset-assert 985)
(last-launch-droids-talker int8 :offset-assert 986)
(last-launch-bombs-talker int8 :offset-assert 987)
(last-shoot-gun-talker int8 :offset-assert 988)
(last-stone-charge-up-talker int8 :offset-assert 989)
(last-after-stone-shot-talker int8 :offset-assert 990)
(last-leave-perch-talker int8 :offset-assert 991)
(last-damaged-talker int8 :offset-assert 992)
(kicked-bombs int8 :offset-assert 993)
(launch-stages-completed int8 :offset-assert 994)
(current-shoot-stage int16 :offset-assert 996)
(last-gun-hit-stage int16 :offset-assert 998)
(gun-hits int16 :offset-assert 1000)
(last-attack-id uint32 :offset-assert 1004)
)
:heap-base #x370
:method-count-assert 47
:size-assert #x3f0
:flag-assert #x2f037003f0
(:methods
(beaten () _type_ :state 20)
(kaboom () _type_ :state 21)
(hover-low-stage-3 () _type_ :state 22)
(hover-shooting-stage-3 () _type_ :state 23)
(hover-launch-bombs-stage-3 () _type_ :state 24)
(hover-big-blast-stage-3 () _type_ :state 25)
(hover-rise-stage-3 () _type_ :state 26)
(hover-jump-down-stage-3 () _type_ :state 27)
(big-reaction-stage-2 () _type_ :state 28)
(watch-bombs-stage-2 () _type_ :state 29)
(launch-bombs-stage-2 () _type_ :state 30)
(back-to-perch-stage-2 () _type_ :state 31)
(hover-low-stage-2 () _type_ :state 32)
(hover-shooting-stage-2 () _type_ :state 33)
(hover-rise-stage-2 () _type_ :state 34)
(hover-seek-under-stage-2 () _type_ :state 35)
(hover-jump-down-stage-2 () _type_ :state 36)
(launch-droids-stage-2 () _type_ :state 37)
(big-reaction-stage-1 () _type_ :state 38)
(watch-bombs-stage-1 () _type_ :state 39)
(launch-bombs-stage-1 () _type_ :state 40)
(watch-droids-stage-1 () _type_ :state 41)
(launch-droids-stage-1 () _type_ :state 42)
(hidden () _type_ :state 43)
(widow-method-44 (_type_ vector vector) symbol 44)
(widow-method-45 (_type_ vector vector vector) none 45)
(widow-method-46 (_type_ vector int) none 46)
)
)
(deftype baron-pod (process-drawable)
((red-tip-change-time time-frame :offset-assert 200)
(alt-red-tip-on symbol :offset-assert 208)
(blink-time time-frame :offset-assert 216)
(blink-mask int32 :offset-assert 224)
(has-stone symbol :offset-assert 228)
)
:heap-base #x70
:method-count-assert 22
:size-assert #xe8
:flag-assert #x16007000e8
(:methods
(idle () _type_ :state 20)
(baron-pod-method-21 (_type_ symbol) none 21)
)
)
(defskelgroup skel-baron-pod baron-pod baron-pod-lod0-jg baron-pod-idle-ja
((baron-pod-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 3)
:shadow baron-pod-shadow-mg
:origin-joint-index 3
)
(defmethod baron-pod-method-21 baron-pod ((obj baron-pod) (arg0 symbol))
(when (>= (- (current-time) (-> obj red-tip-change-time)) 0)
(set! (-> obj alt-red-tip-on) (not (-> obj alt-red-tip-on)))
(set! (-> obj red-tip-change-time) (+ (current-time) (seconds 0.5)))
(set! arg0 #t)
)
(when (>= (- (current-time) (-> obj blink-time)) 0)
(set! (-> obj blink-mask) 0)
(dotimes (s5-0 10)
(let* ((f30-0 0.5)
(v1-17 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-18 (the-as number (logior #x3f800000 v1-17)))
)
(if (< f30-0 (+ -1.0 (the-as float v1-18)))
(logior! (-> obj blink-mask) (ash 1 s5-0))
)
)
)
(set! (-> obj blink-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.25 0.75)))))
(set! arg0 #t)
)
(when arg0
(remove-from-process *part-engine* obj)
(add-connection *part-engine* obj 13 obj 3264 (new 'static 'vector :w 819200.0))
(add-connection *part-engine* obj 14 obj 3264 (new 'static 'vector :w 819200.0))
(if (-> obj alt-red-tip-on)
(add-connection *part-engine* obj 5 obj 3251 (new 'static 'vector :w 819200.0))
(add-connection *part-engine* obj 6 obj 3251 (new 'static 'vector :w 819200.0))
)
(let ((s5-2 (-> obj blink-mask)))
(if (logtest? s5-2 1)
(add-connection *part-engine* obj 8 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 2)
(add-connection *part-engine* obj 9 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 4)
(add-connection *part-engine* obj 10 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 8)
(add-connection *part-engine* obj 11 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 16)
(add-connection *part-engine* obj 12 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 32)
(add-connection *part-engine* obj 15 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 64)
(add-connection *part-engine* obj 16 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 128)
(add-connection *part-engine* obj 17 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 256)
(add-connection *part-engine* obj 18 obj 3252 (new 'static 'vector :w 819200.0))
)
(if (logtest? s5-2 512)
(add-connection *part-engine* obj 19 obj 3252 (new 'static 'vector :w 819200.0))
)
)
(cond
((-> obj has-stone)
(add-connection *part-engine* obj 4 obj 3258 (new 'static 'vector :y 4096.0 :w 819200.0))
(add-connection *part-engine* obj 4 obj 3259 (new 'static 'vector :y 4096.0 :w 819200.0))
)
(else
(add-connection *part-engine* obj 4 obj 3256 (new 'static 'vector :y 4096.0 :w 819200.0))
(add-connection *part-engine* obj 4 obj 3257 (new 'static 'vector :y 4096.0 :w 819200.0))
)
)
)
(if (-> obj has-stone)
(spawn (-> obj part) (-> obj root trans))
)
0
(none)
)
(defstate idle (baron-pod)
:virtual #t
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('frame)
(let ((v1-3 (ja-group)))
(when (not (and v1-3 (= v1-3 (-> self draw art-group data 4))))
(ja :group! (-> self draw art-group data 4) :num! min)
(set! (-> self draw bounds w) 81920.0)
)
)
(when (and (< (ja-aframe-num 0) 834.0) (>= (the-as float (-> block param 0)) 834.0))
(setup-masks (-> self draw) 4 2)
(set! (-> self has-stone) #t)
(baron-pod-method-21 self #t)
)
)
(('finale)
(setup-masks (-> self draw) 8 0)
)
)
)
:trans (behavior ()
(baron-pod-method-21 self #f)
)
:code sleep-code
:post transform-post
)
;; WARN: Return type mismatch object vs none.
(defbehavior baron-pod-init-by-other baron-pod ((arg0 vector))
(let ((s5-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction) cshape-reaction-default)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(set! (-> s5-0 penetrated-by) (the-as penetrate -1))
(let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-7 transform-index) 3)
(set-vector! (-> v1-7 local-sphere) 0.0 0.0 9216.0 4096.0)
(set! (-> s5-0 total-prims) (the-as uint 1))
(set! (-> s5-0 root-prim) v1-7)
)
(set! (-> s5-0 nav-radius) 8192.0)
(let ((v1-9 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with))
)
(set! (-> self root) s5-0)
)
(set! (-> self root trans quad) (-> arg0 quad))
(initialize-skeleton
self
(the-as skeleton-group (art-group-get-by-name *level* "skel-baron-pod" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(setup-masks (-> self draw) 0 12)
(set! (-> self root pause-adjust-distance) 245760.0)
(let ((v1-21 (-> self node-list data)))
(set! (-> v1-21 0 param0) (the-as (function cspace transformq none) cspace<-parent-joint!))
(set! (-> v1-21 0 param1) (the-as basic (-> self parent)))
(set! (-> v1-21 0 param2) (the-as basic 3))
)
(set! (-> self blink-time) 0)
(set! (-> self red-tip-change-time) 0)
(set! (-> self has-stone) #f)
(set! (-> self part) (create-launch-control (-> *part-group-id-table* 728) self))
(baron-pod-method-21 self #t)
(go-virtual idle)
(none)
)
(deftype tomb-boss-bridge (process-drawable)
()
:heap-base #x50
:method-count-assert 21
:size-assert #xc8
:flag-assert #x15005000c8
(:methods
(idle () _type_ :state 20)
)
)
(defstate idle (tomb-boss-bridge)
:virtual #t
:trans (behavior ()
(when (task-node-closed? (game-task-node tomb-boss-introduction))
(cleanup-for-death self)
(deactivate self)
)
)
:code sleep-code
)
;; WARN: Return type mismatch object vs none.
(defmethod init-from-entity! tomb-boss-bridge ((obj tomb-boss-bridge) (arg0 entity-actor))
"Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that.
This commonly includes things such as:
- stack size
- collision information
- loading the skeleton group / bones
- sounds"
(case ((method-of-type res-lump get-property-struct)
(-> obj entity)
'tomb-boss-bridge-type
'interp
-1000000000.0
(the-as structure 'a)
(the-as (pointer res-tag) #f)
*res-static-buf*
)
(('b)
(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-tomb-boss-bridge-b" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
)
(else
(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-tomb-boss-bridge-a" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
)
)
(set! (-> obj draw light-index) (the-as uint 2))
(ja-post)
(go (method-of-object obj idle))
(none)
)
(defbehavior widow-want-stone-talker widow ()
(if (or (>= (-> self bomb-hits) 4) (let* ((f30-0 0.001)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(< f30-0 (+ -1.0 (the-as float v1-5)))
)
)
(return (the-as sound-id #f))
)
(let ((v1-9 (rand-vu-int-count 5)))
(if (>= v1-9 (-> self last-want-stone-talker))
(+! v1-9 1)
)
(set! (-> self last-want-stone-talker) v1-9)
(cond
((zero? v1-9)
(talker-spawn-func (-> *talker-speech* 241) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 1)
(talker-spawn-func (-> *talker-speech* 242) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 2)
(talker-spawn-func (-> *talker-speech* 243) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 3)
(talker-spawn-func (-> *talker-speech* 244) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 4)
(talker-spawn-func (-> *talker-speech* 245) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 5)
(talker-spawn-func (-> *talker-speech* 246) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-general-flying-talker widow ()
(if (or (>= (-> self bomb-hits) 4) (let* ((f30-0 0.002)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(< f30-0 (+ -1.0 (the-as float v1-5)))
)
)
(return (the-as sound-id #f))
)
(let ((v1-9 (rand-vu-int-count 4)))
(if (>= v1-9 (-> self last-general-flying-talker))
(+! v1-9 1)
)
(set! (-> self last-general-flying-talker) v1-9)
(cond
((zero? v1-9)
(talker-spawn-func (-> *talker-speech* 273) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 1)
(talker-spawn-func (-> *talker-speech* 288) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 2)
(talker-spawn-func (-> *talker-speech* 289) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 3)
(talker-spawn-func (-> *talker-speech* 290) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 4)
(talker-spawn-func (-> *talker-speech* 291) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-launch-droids-talker widow ()
(if (or (>= (-> self bomb-hits) 4) (let* ((f30-0 0.9)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(< f30-0 (+ -1.0 (the-as float v1-5)))
)
)
(return (the-as sound-id #f))
)
(let ((v1-9 (rand-vu-int-count 4)))
(if (>= v1-9 (-> self last-launch-droids-talker))
(+! v1-9 1)
)
(set! (-> self last-launch-droids-talker) v1-9)
(cond
((zero? v1-9)
(talker-spawn-func (-> *talker-speech* 247) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 1)
(talker-spawn-func (-> *talker-speech* 248) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 2)
(talker-spawn-func (-> *talker-speech* 249) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 3)
(talker-spawn-func (-> *talker-speech* 250) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 4)
(talker-spawn-func (-> *talker-speech* 299) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-launch-bombs-talker widow ()
(if (or (>= (-> self bomb-hits) 4) (let* ((f30-0 0.9)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(< f30-0 (+ -1.0 (the-as float v1-5)))
)
)
(return (the-as sound-id #f))
)
(let ((v1-9 (rand-vu-int-count 5)))
(if (>= v1-9 (-> self last-launch-bombs-talker))
(+! v1-9 1)
)
(set! (-> self last-launch-bombs-talker) v1-9)
(cond
((zero? v1-9)
(talker-spawn-func (-> *talker-speech* 251) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 1)
(talker-spawn-func (-> *talker-speech* 252) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 2)
(talker-spawn-func (-> *talker-speech* 255) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 3)
(talker-spawn-func (-> *talker-speech* 256) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 4)
(talker-spawn-func (-> *talker-speech* 267) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 5)
(talker-spawn-func (-> *talker-speech* 272) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-shoot-gun-talker widow ()
(if (or (>= (-> self bomb-hits) 4) (let* ((f30-0 0.7)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(< f30-0 (+ -1.0 (the-as float v1-5)))
)
)
(return (the-as sound-id #f))
)
(let ((v1-9 (rand-vu-int-count 10)))
(if (>= v1-9 (-> self last-shoot-gun-talker))
(+! v1-9 1)
)
(set! (-> self last-shoot-gun-talker) v1-9)
(cond
((zero? v1-9)
(talker-spawn-func (-> *talker-speech* 253) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 1)
(talker-spawn-func (-> *talker-speech* 254) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 2)
(talker-spawn-func (-> *talker-speech* 257) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 3)
(talker-spawn-func (-> *talker-speech* 258) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 4)
(talker-spawn-func (-> *talker-speech* 286) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 5)
(talker-spawn-func (-> *talker-speech* 268) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 6)
(talker-spawn-func (-> *talker-speech* 269) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 7)
(talker-spawn-func (-> *talker-speech* 292) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 8)
(talker-spawn-func (-> *talker-speech* 293) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 9)
(talker-spawn-func (-> *talker-speech* 300) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 10)
(talker-spawn-func (-> *talker-speech* 274) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-stone-charge-up-talker widow ()
(if (or (>= (-> self bomb-hits) 4) (let* ((f30-0 0.6)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(< f30-0 (+ -1.0 (the-as float v1-5)))
)
)
(return (the-as sound-id #f))
)
(let ((v1-9 (rand-vu-int-count 5)))
(if (>= v1-9 (-> self last-stone-charge-up-talker))
(+! v1-9 1)
)
(set! (-> self last-stone-charge-up-talker) v1-9)
(cond
((zero? v1-9)
(talker-spawn-func (-> *talker-speech* 259) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 1)
(talker-spawn-func (-> *talker-speech* 260) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 2)
(talker-spawn-func (-> *talker-speech* 264) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 3)
(talker-spawn-func (-> *talker-speech* 296) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 4)
(talker-spawn-func (-> *talker-speech* 298) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 5)
(talker-spawn-func (-> *talker-speech* 266) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-after-stone-shot-talker widow ()
(if (or (>= (-> self bomb-hits) 4) (let* ((f30-0 0.6)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(< f30-0 (+ -1.0 (the-as float v1-5)))
)
)
(return (the-as sound-id #f))
)
(let ((v1-9 (rand-vu-int-count 5)))
(if (>= v1-9 (-> self last-after-stone-shot-talker))
(+! v1-9 1)
)
(set! (-> self last-after-stone-shot-talker) v1-9)
(cond
((zero? v1-9)
(talker-spawn-func (-> *talker-speech* 261) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 1)
(talker-spawn-func (-> *talker-speech* 262) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 2)
(talker-spawn-func (-> *talker-speech* 263) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 3)
(talker-spawn-func (-> *talker-speech* 297) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 4)
(talker-spawn-func (-> *talker-speech* 271) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 5)
(talker-spawn-func (-> *talker-speech* 265) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-leave-perch-talker widow ()
(if (or (>= (-> self bomb-hits) 4) (let* ((f30-0 0.4)
(v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-5 (the-as number (logior #x3f800000 v1-4)))
)
(< f30-0 (+ -1.0 (the-as float v1-5)))
)
)
(return (the-as sound-id #f))
)
(let ((v1-9 (rand-vu-int-count 4)))
(if (>= v1-9 (-> self last-leave-perch-talker))
(+! v1-9 1)
)
(set! (-> self last-leave-perch-talker) v1-9)
(cond
((zero? v1-9)
(talker-spawn-func (-> *talker-speech* 270) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 1)
(talker-spawn-func (-> *talker-speech* 277) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 2)
(talker-spawn-func (-> *talker-speech* 275) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 3)
(talker-spawn-func (-> *talker-speech* 276) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-9 4)
(talker-spawn-func (-> *talker-speech* 285) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-damaged-talker widow ()
(let* ((f30-0 0.99)
(v1-2 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-3 (the-as number (logior #x3f800000 v1-2)))
)
(if (< f30-0 (+ -1.0 (the-as float v1-3)))
(return (the-as sound-id #f))
)
)
(let ((v1-7 (rand-vu-int-count 11)))
(if (>= v1-7 (-> self last-damaged-talker))
(+! v1-7 1)
)
(set! (-> self last-damaged-talker) v1-7)
(cond
((zero? v1-7)
(talker-spawn-func (-> *talker-speech* 278) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 1)
(talker-spawn-func (-> *talker-speech* 279) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 2)
(talker-spawn-func (-> *talker-speech* 280) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 3)
(talker-spawn-func (-> *talker-speech* 281) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 4)
(talker-spawn-func (-> *talker-speech* 282) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 5)
(talker-spawn-func (-> *talker-speech* 283) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 6)
(talker-spawn-func (-> *talker-speech* 284) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 7)
(talker-spawn-func (-> *talker-speech* 294) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 8)
(talker-spawn-func (-> *talker-speech* 295) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 9)
(talker-spawn-func (-> *talker-speech* 287) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 10)
(talker-spawn-func (-> *talker-speech* 307) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-7 11)
(talker-spawn-func (-> *talker-speech* 304) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
)
(defbehavior widow-handler widow ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-0 object) (sv-224 symbol) (sv-240 symbol) (sv-256 vector) (sv-272 matrix))
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
(case arg2
(('attack)
(let ((v1-1 (the-as object (-> arg3 param 1))))
(when (and (logtest? (attack-mask penetrate-using) (-> (the-as attack-info v1-1) mask))
(logtest? (penetrate dark-bomb) (-> (the-as attack-info v1-1) penetrate-using))
(!= (-> self last-attack-id) (-> (the-as attack-info v1-1) id))
)
(set! (-> self last-attack-id) (-> (the-as attack-info v1-1) id))
(send-event self 'bomb-hit (target-pos 0) 4)
(let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000)))
(when gp-2
(let ((t9-3 (method-of-type part-tracker activate)))
(t9-3
(the-as part-tracker gp-2)
*entity-pool*
(symbol->string (-> part-tracker symbol))
(the-as pointer #x70004000)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
)
(let ((s5-0 run-function-in-process)
(s4-0 gp-2)
(s3-0 part-tracker-init)
(s2-0 (-> *part-group-id-table* 710))
(s1-0 600)
(s0-0 #f)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
(set! sv-224 (the-as symbol #f))
(set! sv-240 (the-as symbol #f))
(set! sv-272 *launch-matrix*)
(set! sv-256 (-> sv-272 trans))
(let ((v1-16 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 11)) quad)))
(set! (-> sv-256 quad) v1-16)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
((the-as (function object object object object object object object object none) s5-0)
s4-0
s3-0
s2-0
s1-0
s0-0
sv-224
sv-240
sv-272
)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
(-> gp-2 ppointer)
)
)
)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
)
(('shot-hit-target)
(when (< (-> self last-gun-hit-stage) (-> self current-shoot-stage))
(+! (-> self gun-hits) 1)
(set! v0-0 (-> self current-shoot-stage))
(set! (-> self last-gun-hit-stage) (the-as int v0-0))
v0-0
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
)
(('bomb-kicked)
(set! v0-0 (+ (-> self kicked-bombs) 1))
(set! (-> self kicked-bombs) (the-as int v0-0))
v0-0
)
(('widow-get-center)
(-> self circle-center)
)
(('debris-hit)
(when (< -819.2 (-> self osc vel y))
(sound-play "wid-debris-hit")
(case (-> arg3 param 0)
((1)
(set! (-> self osc vel y) (+ -3072.0 (-> self osc vel y)))
)
((2)
(set! (-> self osc vel y) (+ -2048.0 (-> self osc vel y)))
)
)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
)
(('catwalk-hit)
(let ((v1-26 (-> arg3 param 0)))
(when (and (> (the-as int v1-26) 0) (< (the-as int v1-26) 8))
(let ((v1-28 (new 'stack-no-clear 'event-message-block)))
(set! (-> v1-28 from) (process->ppointer arg0))
(set! (-> v1-28 num-params) arg1)
(set! (-> v1-28 message) arg2)
(set! (-> v1-28 param 0) (-> arg3 param 0))
(set! (-> v1-28 param 1) (-> arg3 param 1))
(set! (-> v1-28 param 2) (-> arg3 param 2))
(set! (-> v1-28 param 3) (-> arg3 param 3))
(set! (-> v1-28 param 4) (-> arg3 param 4))
(set! (-> v1-28 param 5) (-> arg3 param 5))
(send-event-function (handle->process (-> self catwalk 0)) v1-28)
)
)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
)
(('child-jumped)
(set! v0-0 (logclear (-> (the-as spydroid arg0) enemy-flags) (enemy-flag alert)))
(set! (-> (the-as spydroid arg0) enemy-flags) (the-as enemy-flag v0-0))
v0-0
)
(('bomb-hit)
(set! (-> self bomb-hits) (min 4 (+ (-> self bomb-hits) (-> arg3 param 1))))
(let ((v1-33 (handle->process (-> self hud))))
(if v1-33
(set! (-> (the-as hud-widow v1-33) values 1 target) (/ (* 100 (- 4 (-> self bomb-hits))) 4))
)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
(when (and (not (-> self flying)) (< (-> self bomb-hits) 4))
(let* ((s4-2 (-> arg3 param 0))
(v0-9 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3)))
(s5-2 (-> self node-list data 3 bone transform))
(s4-3 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (the-as vector s4-2) v0-9) 1.0))
(f30-0 (vector-dot s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-2 vector 2) 1.0)))
(f28-0
(vector-dot s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> s5-2 vector)) 1.0))
)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
(ja-channel-push! 1 (seconds 0.03))
(set! (-> self drill-speed target) 0.0)
(cond
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
((< (cos 5461.3335) f30-0)
(ja :group! (-> self draw art-group data 25) :num! min)
(setup-masks (-> self draw) 2 128)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
((and (< (cos 8192.0) f30-0) (< 0.0 f28-0))
(ja :group! (-> self draw art-group data 26) :num! min)
(setup-masks (-> self draw) 4 256)
)
((< (cos 8192.0) f30-0)
(ja :group! (-> self draw art-group data 27) :num! min)
(setup-masks (-> self draw) 8 512)
)
((< 0.0 f28-0)
(ja :group! (-> self draw art-group data 23) :num! min)
(setup-masks (-> self draw) 16 1024)
)
(else
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
(ja :group! (-> self draw art-group data 24) :num! min)
(setup-masks (-> self draw) 32 2048)
)
)
)
)
[opengoal] make `none` a child of `object` (#3001) Previously, `object` and `none` were both top-level types. This made decompilation rather messy as they have no LCA and resulted in a lot of variables coming out as type `none` which is very very wrong and additionally there were plenty of casts to `object`. This changes it so `none` becomes a child of `object` (it is still represented by `NullType` which remains unusable in compilation). This change makes `object` the sole top-level type, and the type that can represent *any* GOAL object. I believe this matches the original GOAL built-in type structure. A function that has a return type of `object` can now return an integer or a `none` at the same time. However, keep in mind that the return value of `(none)` is still undefined, just as before. This also makes a cast to `object` meaningless in 90% of the situations it showed up in (as every single thing is already an `object`) and the decompiler will no longer emit them. Casts to `none` are also reduced. Yay! Additionally, state handlers also don't get the final `(none)` printed out anymore. The return type of a state handler is completely meaningless outside the event handler (which is return type `object` anyway) so there are no limitations on what the last form needs to be. I did this instead of making them return `object` to trick the decompiler into not trying to output a variable to be used as a return value (internally, in the decompiler they still have return type `none`, but they have `object` elsewhere). Fixes #1703 Fixes #830 Fixes #928
2023-09-22 05:54:49 -04:00
(when (-> self flying)
(set! (-> self drill-speed target) 0.0)
(cond
((>= (-> self bomb-hits) 4)
#f
)
((begin
(ja-channel-push! 1 (seconds 0.03))
(let* ((gp-3 (-> arg3 param 0))
(v0-28 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3)))
(s5-8 (-> self node-list data 3 bone transform))
(f0-20 (vector-dot
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) (the-as vector gp-3) v0-28) 1.0)
(vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (-> s5-8 vector)) 1.0)
)
)
)
(< 0.0 f0-20)
)
)
(ja :group! (-> self draw art-group data 37) :num! min)
(setup-masks (-> self draw) 16 1024)
)
(else
(ja :group! (-> self draw art-group data 36) :num! min)
(setup-masks (-> self draw) 32 2048)
)
)
)
)
)
)